def main(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'hn:s:', ['ham-keep=', 'spam-keep=']) except getopt.error as msg: usage(1, msg) nsets = seed = hamkeep = spamkeep = None for opt, arg in opts: if opt == '-h': usage(0) elif opt == '-n': nsets = int(arg) elif opt == '-s': seed = int(arg) elif opt == '--ham-keep': hamkeep = int(arg) elif opt == '--spam-keep': spamkeep = int(arg) if args: usage(1, "Positional arguments not supported") if nsets is None: usage(1, "-n is required") msgs.setparms(hamkeep, spamkeep, seed=seed) drive(nsets)
def main(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'hn:s:o:', ['HamTrain=', 'SpamTrain=', 'HamTest=', 'SpamTest=', 'ham-keep=', 'spam-keep=', 'option=']) except getopt.error as msg: usage(1, msg) nsets = seed = hamtrain = spamtrain = None hamtest = spamtest = hamkeep = spamkeep = None for opt, arg in opts: if opt == '-h': usage(0) elif opt == '-n': nsets = int(arg) elif opt == '-s': seed = int(arg) elif opt == '--HamTest': hamtest = int(arg) elif opt == '--SpamTest': spamtest = int(arg) elif opt == '--HamTrain': hamtrain = int(arg) elif opt == '--SpamTrain': spamtrain = int(arg) elif opt == '--ham-keep': hamkeep = int(arg) elif opt == '--spam-keep': spamkeep = int(arg) elif opt in ('-o', '--option'): options.set_from_cmdline(arg, sys.stderr) if args: usage(1, "Positional arguments not supported") if nsets is None: usage(1, "-n is required") if hamkeep is not None: msgs.setparms(hamkeep, spamkeep, seed=seed) else: msgs.setparms(hamtrain, spamtrain, hamtest, spamtest, seed) drive(nsets)
usage(0) elif opt == '-n': nsets = int(arg) elif opt == '-s': seed = int(arg) elif opt == '--HamTest': hamtest = int(arg) elif opt == '--SpamTest': spamtest = int(arg) elif opt == '--HamTrain': hamtrain = int(arg) elif opt == '--SpamTrain': spamtrain = int(arg) elif opt == '--ham-keep': hamkeep = int(arg) elif opt == '--spam-keep': spamkeep = int(arg) elif opt in ('-o', '--option'): options.set_from_cmdline(arg, sys.stderr) if args: usage(1, "Positional arguments not supported") if nsets is None: usage(1, "-n is required") if hamkeep is not None: msgs.setparms(hamkeep, spamkeep, seed=seed) else: msgs.setparms(hamtrain, spamtrain, hamtest, spamtest, seed) drive(nsets) if __name__ == "__main__": main()
try: opts, args = getopt.getopt(sys.argv[1:], 'hn:s:', ['ham-keep=', 'spam-keep=']) except getopt.error, msg: usage(1, msg) nsets = seed = hamkeep = spamkeep = None for opt, arg in opts: if opt == '-h': usage(0) elif opt == '-n': nsets = int(arg) elif opt == '-s': seed = int(arg) elif opt == '--ham-keep': hamkeep = int(arg) elif opt == '--spam-keep': spamkeep = int(arg) if args: usage(1, "Positional arguments not supported") if nsets is None: usage(1, "-n is required") msgs.setparms(hamkeep, spamkeep, seed=seed) drive(nsets) if __name__ == "__main__": main()
seed = int(arg) elif opt == '--HamTest': hamtest = int(arg) elif opt == '--SpamTest': spamtest = int(arg) elif opt == '--HamTrain': hamtrain = int(arg) elif opt == '--SpamTrain': spamtrain = int(arg) elif opt == '--ham-keep': hamkeep = int(arg) elif opt == '--spam-keep': spamkeep = int(arg) elif opt in ('-o', '--option'): options.set_from_cmdline(arg, sys.stderr) if args: usage(1, "Positional arguments not supported") if nsets is None: usage(1, "-n is required") if hamkeep is not None: msgs.setparms(hamkeep, spamkeep, seed=seed) else: msgs.setparms(hamtrain, spamtrain, hamtest, spamtest, seed) drive(nsets) if __name__ == "__main__": main()