CMS 3D CMS Logo

Classes | Functions
main Namespace Reference

Classes

class  SkeletonOptionParser
 

Functions

def generator ()
 
def parse_args (args)
 

Function Documentation

◆ generator()

def main.generator ( )
Code generator function, parse user arguments and load appropriate
template module. Once loaded, run its data method depending on
user requested input parameter, e.g. print_etags, print_tags or
generate template code.

Definition at line 75 of file main.py.

75 def generator():
76  """
77  Code generator function, parse user arguments and load appropriate
78  template module. Once loaded, run its data method depending on
79  user requested input parameter, e.g. print_etags, print_tags or
80  generate template code.
81  """
82  optmgr = SkeletonOptionParser()
83  opts, args = optmgr.get_opt()
84  test_env(os.path.join(opts.tdir, opts.tmpl), opts.tmpl)
85  config = {'pname': opts.pname, 'tmpl': opts.tmpl, 'author': opts.author,
86  'args': parse_args(args), 'debug': opts.debug,
87  'ftype': opts.ftype}
88  if opts.ketags:
89  etags = opts.ketags.split(',')
90  config.update({'tmpl_etags': etags})
91  else:
92  config.update({'tmpl_etags': []})
93  obj = code_generator(config)
94  if opts.etags:
95  obj.print_etags()
96  sys.exit(0)
97  elif opts.tags:
98  obj.print_tags()
99  sys.exit(0)
100  elif opts.templates:
101  for name in os.listdir(template_directory()):
102  print(name)
103  sys.exit(0)
104  obj.generate()
105 

References utils.code_generator(), parse_args(), print(), utils.template_directory(), and utils.test_env().

◆ parse_args()

def main.parse_args (   args)

Definition at line 63 of file main.py.

63 def parse_args(args):
64  "Parse input arguments"
65  output = {}
66  for arg in args:
67  key, val = arg.split('=')
68  key = key.strip()
69  val = val.strip()
70  if val[0] == '[' and val[-1] == ']':
71  val = eval(val, { "__builtins__": None }, {})
72  output[key] = val
73  return output
74 

Referenced by generator(), das.DASOptionParser.get_opt(), main.SkeletonOptionParser.get_opt(), das_client.DASOptionParser.get_opt(), query.DDOptionParser.getOpt(), valtools.webpage.parseArgs(), and batchmanager.BatchManager.ParseOptions().

utils.template_directory
def template_directory()
Definition: utils.py:23
main.generator
def generator()
Definition: main.py:75
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
utils.test_env
def test_env(tdir, tmpl)
Definition: utils.py:53
main.parse_args
def parse_args(args)
Definition: main.py:63
utils.code_generator
def code_generator(kwds)
Definition: utils.py:122