示例#1
0
文件: u.py 项目: sanketsharma411/quac
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
示例#2
0
文件: u.py 项目: myndworkz/quac
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
示例#3
0
文件: u.py 项目: shikhach/quac
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