示例#1
0
 def get_inp_params(args):
   # define input parameters and validators
   inp = {
     '-s': [lambda s: s.isdigit() and int(s) in C.GAME_CT_DICT, lambda s: int(s)],
     '-g': [lambda g: g.isdigit(), lambda g: int(g)],
     '-r': [lambda r: r.isdigit() and int(r) in [0,1], lambda r: int(r) > 0]
   }
   
   call_conv = "gamedata.py -s <season, integer> -g <game_num, integer> -r <reg_season, binary>"
   
   out = cli_opts(args, inp, call_conv)
   return out['-s'], out['-g'], out['-r']
 def get_shop_file():
   # define command line input arg, validator, and converter
   inp = {
     '-f': [lambda f: True, lambda f: f],                # shop source
     '-o': [lambda f: True, lambda f: f],                # listing output
     '-d': [lambda d: d in ['w','w+','a'], lambda d: d]  # how to deal with out file
   }
   
   # define command line calling convetion for script for error reporting
   call_conv = 'fill_shop_listings.py -f <shop file> -o <listings out> -d <over/append out>'
   
   # parse args
   arg_dict = cli_opts(sys.argv[1:], inp, call_conv)
 
   return arg_dict['-f'], arg_dict['-o'], arg_dict['-d']
    def get_shop_file():
        # define command line input arg, validator, and converter
        inp = {
            "-f": [lambda f: True, lambda f: f],  # shop source
            "-o": [lambda f: True, lambda f: f],  # about output
            "-d": [lambda d: d in ["w", "w+", "a"], lambda d: d],  # how to deal with out file
        }

        # define command line calling convetion for script for error reporting
        call_conv = "fill_shop_about.py -f <shop file> -o <about out> -d <over/append out>"

        # parse args
        arg_dict = cli_opts(sys.argv[1:], inp, call_conv)

        return arg_dict["-f"], arg_dict["-o"], arg_dict["-d"]
示例#4
0
    def get_inp_params(args):
        # define input parameters and validators
        inp = {
            '-s': [
                lambda s: s.isdigit() and int(s) in C.GAME_CT_DICT,
                lambda s: int(s)
            ],
            '-g': [lambda g: g.isdigit(), lambda g: int(g)],
            '-r':
            [lambda r: r.isdigit() and int(r) in [0, 1], lambda r: int(r) > 0]
        }

        call_conv = "gamedata.py -s <season, integer> -g <game_num, integer> -r <reg_season, binary>"

        out = cli_opts(args, inp, call_conv)
        return out['-s'], out['-g'], out['-r']
示例#5
0
 def get_shop_ct():
   def isFloat(s):
     try:
       float(s)
       return True
     except:
       return False
       
   # define command line input arg, validator, and converter
   inp = {
     '-n': [lambda n: n.isdigit() and int(n) > 0, lambda n: int(n)],
     '-t': [lambda t: isFloat(t), lambda n: float(n)],
     '-d': [lambda d: d in ['w','w+','a'], lambda d: d]
   }
   
   # define command line calling convetion for script for error reporting
   call_conv = 'shop_qry_base.py -n <number of shops (positive)> -d <file access type> -ts <test size float>'
   
   # parse args
   arg_dict = cli_opts(sys.argv[1:], inp, call_conv)
 
   return arg_dict['-n'], arg_dict['-t'], arg_dict['-d']