ATLAS Offline Software
Functions | Variables
trigconf_property Namespace Reference

Functions

def myhelp (option, opt_str, value, parser)
 
def main ()
 

Variables

 __author__
 

Function Documentation

◆ main()

def trigconf_property.main ( )

Definition at line 25 of file trigconf_property.py.

25 def main():
26  import optparse
27  parser = optparse.OptionParser(usage='', add_help_option=False)
28 
29  parser.add_option('-d', '--db', type='string', action='store', default='TRIGGERDB',
30  help='Trigger DB alias [%default]')
31 
32  parser.add_option('-s', '--short', action='store_true',
33  help='Only print property values')
34 
35  parser.add_option('--l2', action='store_true', help='Only show L2')
36  parser.add_option('--ef', action='store_true', help='Only show EF')
37  parser.add_option("-h", "--help", action="callback", callback=myhelp)
38 
39  (opts, args) = parser.parse_args()
40 
41  if len(args)<3:
42  parser.print_help()
43  return 1
44 
45  comp = args[0]
46  prop = args[1]
47  smk = args[2:]
48 
49  res = getPropertyFromDB(opts.db, smk, comp, prop)
50  if len(res)==0:
51  print('Cannot find property in DB')
52  return 2
53 
54  # Filter L2/EF
55  if opts.l2 is True and not opts.ef: res = filter(lambda x: x[4]=='L2',res)
56  if opts.ef is True and not opts.l2: res = filter(lambda x: x[4]=='EF',res)
57 
58  for p in res:
59  if opts.short:
60  print(p[3])
61  else:
62  print('%s %d %s %s %s' % (p[4],p[0],p[1],p[2],p[3]))
63 
64 

◆ myhelp()

def trigconf_property.myhelp (   option,
  opt_str,
  value,
  parser 
)
Custom help callback since optparse does not preserve newlines

Definition at line 17 of file trigconf_property.py.

17 def myhelp(option, opt_str, value, parser):
18  """Custom help callback since optparse does not preserve newlines"""
19 
20  print(__doc__)
21  parser.print_help()
22  sys.exit(1)
23 
24 

Variable Documentation

◆ __author__

trigconf_property.__author__
private

Definition at line 12 of file trigconf_property.py.

covarianceTool.filter
filter
Definition: covarianceTool.py:514
python.TrigConfigSvcUtils.getPropertyFromDB
def getPropertyFromDB(connection, smk, component, parameter)
Definition: TrigConfigSvcUtils.py:396
trigconf_property.main
def main()
Definition: trigconf_property.py:25
trigconf_property.myhelp
def myhelp(option, opt_str, value, parser)
Definition: trigconf_property.py:17
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70