MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/439319_Shuffle_Merge_Files/recipe-439319.py:125–154  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

123
124
125def main(argv):
126
127 OneCharOpts = "hn:m:"
128 MultiCharList = [
129 "help", "nprocs=", "maxlines="
130 ]
131
132 try:
133 opts, args = getopt.getopt( argv, OneCharOpts, MultiCharList )
134 except getopt.GetoptError:
135 usage(os.path.basename(sys.argv[0]))
136 sys.exit(2)
137
138 NProcs = 8
139 MaxLines = 20
140 FileNamePrefix = "ttt"
141
142 for opt, arg in opts:
143 if opt in ["-h", "--help"]:
144 usage(os.path.basename(sys.argv[0]))
145 sys.exit()
146 elif opt in ["-n", "--nprocs"]:
147 NProcs = arg.strip()
148 elif opt in ["-m", "--maxlines"]:
149 MaxLines = arg.strip()
150
151 if len(args) >= 1:
152 FileNamePrefix = args[0]
153
154 ShuffleMerge( FileNamePrefix, NProcs, MaxLines )
155
156if __name__ == "__main__":
157

Callers 1

recipe-439319.pyFile · 0.70

Calls 5

ShuffleMergeFunction · 0.85
usageFunction · 0.70
getoptMethod · 0.45
exitMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected