MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Doc/includes/ndiff.py:71–101  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

69# return false iff a problem
70
71def main(args):
72 import getopt
73 try:
74 opts, args = getopt.getopt(args, "qr:")
75 except getopt.error as detail:
76 return fail(str(detail))
77 noisy = 1
78 qseen = rseen = 0
79 for opt, val in opts:
80 if opt == "-q":
81 qseen = 1
82 noisy = 0
83 elif opt == "-r":
84 rseen = 1
85 whichfile = val
86 if qseen and rseen:
87 return fail("can't specify both -q and -r")
88 if rseen:
89 if args:
90 return fail("no args allowed with -r option")
91 if whichfile in ("1", "2"):
92 restore(whichfile)
93 return 1
94 return fail("-r value must be 1 or 2")
95 if len(args) != 2:
96 return fail("need 2 filename args")
97 f1name, f2name = args
98 if noisy:
99 print('-:', f1name)
100 print('+:', f2name)
101 return fcompare(f1name, f2name)
102
103# read ndiff output from stdin, and print file1 (which=='1') or
104# file2 (which=='2') to stdout

Callers 1

ndiff.pyFile · 0.70

Calls 4

strFunction · 0.85
fcompareFunction · 0.85
failFunction · 0.70
restoreFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…