def parse_args(ap, args=sys.argv[1:]): '''Parse command line arguments and set a few globals based on the result. Note that this function must be called before logging_init().''' try: args = shlex.split(os.environ['QUACARGS']) + args except KeyError: pass args = ap.parse_args(args) try: multicore.init(args.cores) except AttributeError: pass try: rand.seed(args.random_seed) rand_np.seed(args.random_seed) except AttributeError: pass try: global verbose verbose = args.verbose except AttributeError: pass try: global log_timestamps log_timestamps = not args.notimes except AttributeError: pass return args
def parse_args(ap): '''Parse command line arguments and set a few globals based on the result. Note that this function must be called before logging_init().''' args = ap.parse_args() try: multicore.init(args.cores) except AttributeError: pass try: rand.seed(args.random_seed) rand_np.seed(args.random_seed) except AttributeError: pass try: global verbose verbose = args.verbose except AttributeError: pass return args