ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
python.TriggerConfigAccessBase.TriggerConfigAccess Class Reference
Collaboration diagram for python.TriggerConfigAccessBase.TriggerConfigAccess:

Public Member Functions

def __init__ (self, configType, mainkey, filename=None, jsonString=None, dbalias=None, dbkey=None, useCrest=False, crestServer="")
 
def load (self)
 
def __str__ (self)
 
def __iter__ (self)
 
def __getitem__ (self, item)
 
def __len__ (self)
 
def config (self)
 
def prettyPrint (self)
 
def name (self)
 
def filetype (self)
 
def printSummary (self)
 
def writeFile (self, filename=None)
 

Public Attributes

 loader
 

Private Member Functions

def _getLoader (self, *configType, filename=None, jsonString=None, dbalias=None, dbkey=None, bool useCrest=False, str crestServer="")
 

Private Attributes

 _mainkey
 
 _config
 

Detailed Description

base class to hold the configuration (OrderedDict) 
and provides basic functions to access and print


Definition at line 425 of file TriggerConfigAccessBase.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TriggerConfigAccessBase.TriggerConfigAccess.__init__ (   self,
  configType,
  mainkey,
  filename = None,
  jsonString = None,
  dbalias = None,
  dbkey = None,
  useCrest = False,
  crestServer = "" 
)

Definition at line 430 of file TriggerConfigAccessBase.py.

430  def __init__(self, configType, mainkey, filename = None, jsonString = None, dbalias = None, dbkey = None, useCrest=False, crestServer=""):
431  self._getLoader(configType = configType, filename = filename, jsonString = jsonString, dbalias = dbalias, dbkey = dbkey,
432  useCrest=useCrest, crestServer=crestServer)
433  self._mainkey = mainkey
434  self._config = None
435 

Member Function Documentation

◆ __getitem__()

def python.TriggerConfigAccessBase.TriggerConfigAccess.__getitem__ (   self,
  item 
)

Definition at line 459 of file TriggerConfigAccessBase.py.

459  def __getitem__(self, item):
460  return self._config[item]
461 

◆ __iter__()

def python.TriggerConfigAccessBase.TriggerConfigAccess.__iter__ (   self)

Definition at line 456 of file TriggerConfigAccessBase.py.

456  def __iter__(self):
457  return iter(self[self._mainkey])
458 

◆ __len__()

def python.TriggerConfigAccessBase.TriggerConfigAccess.__len__ (   self)

Definition at line 462 of file TriggerConfigAccessBase.py.

462  def __len__(self):
463  return len(self[self._mainkey])
464 

◆ __str__()

def python.TriggerConfigAccessBase.TriggerConfigAccess.__str__ (   self)

Definition at line 453 of file TriggerConfigAccessBase.py.

453  def __str__(self):
454  return str(self._config)
455 

◆ _getLoader()

def python.TriggerConfigAccessBase.TriggerConfigAccess._getLoader (   self,
configType,
  filename = None,
  jsonString = None,
  dbalias = None,
  dbkey = None,
bool   useCrest = False,
str   crestServer = "" 
)
private

Definition at line 436 of file TriggerConfigAccessBase.py.

436  def _getLoader(self, *, configType, filename = None, jsonString = None, dbalias = None, dbkey = None,
437  useCrest:bool = False, crestServer:str = ""):
438  if filename:
439  self.loader = ConfigFileLoader( configType, filename )
440  elif dbalias and dbkey:
441  if useCrest:
442  self.loader = ConfigCrestLoader(configType=configType, dbalias=dbalias, dbkey=dbkey, crestServer=crestServer)
443  else:
444  self.loader = ConfigDBLoader( configType, dbalias, dbkey)
445  elif jsonString:
446  self.loader = ConfigDirectLoader( configType, jsonString )
447  else:
448  raise RuntimeError("Neither input file, nor JSON nor db alias and key provided")
449 

◆ config()

def python.TriggerConfigAccessBase.TriggerConfigAccess.config (   self)
returns the configuration 

Definition at line 465 of file TriggerConfigAccessBase.py.

465  def config(self):
466  """ returns the configuration """
467  return self._config
468 

◆ filetype()

def python.TriggerConfigAccessBase.TriggerConfigAccess.filetype (   self)

Definition at line 476 of file TriggerConfigAccessBase.py.

476  def filetype(self):
477  return self["filetype"]
478 

◆ load()

def python.TriggerConfigAccessBase.TriggerConfigAccess.load (   self)

Definition at line 450 of file TriggerConfigAccessBase.py.

450  def load(self):
451  self._config = self.loader.load()
452 

◆ name()

def python.TriggerConfigAccessBase.TriggerConfigAccess.name (   self)

Definition at line 473 of file TriggerConfigAccessBase.py.

473  def name(self):
474  return self["name"]
475 

◆ prettyPrint()

def python.TriggerConfigAccessBase.TriggerConfigAccess.prettyPrint (   self)

Definition at line 469 of file TriggerConfigAccessBase.py.

469  def prettyPrint(self):
470  if self._config:
471  print(json.dumps(self._config, indent = 4, separators=(',', ': ')))
472 

◆ printSummary()

def python.TriggerConfigAccessBase.TriggerConfigAccess.printSummary (   self)
print summary info, should be overwritten by derived classes 

Definition at line 479 of file TriggerConfigAccessBase.py.

479  def printSummary(self):
480  """ print summary info, should be overwritten by derived classes """
481  log.info("Configuration name: {0}".format(self.name()))
482  log.info("Configuration size: {0}".format(len(self)))
483 

◆ writeFile()

def python.TriggerConfigAccessBase.TriggerConfigAccess.writeFile (   self,
  filename = None 
)

Definition at line 484 of file TriggerConfigAccessBase.py.

484  def writeFile(self, filename = None):
485  if filename is None:
486  filename: str = self.loader.getWriteFilename()
487  with open(filename, 'w') as fh:
488  json.dump(self.config(), fh, indent = 4, separators=(',', ': '))
489  log.info("Wrote file %s", filename)

Member Data Documentation

◆ _config

python.TriggerConfigAccessBase.TriggerConfigAccess._config
private

Definition at line 434 of file TriggerConfigAccessBase.py.

◆ _mainkey

python.TriggerConfigAccessBase.TriggerConfigAccess._mainkey
private

Definition at line 433 of file TriggerConfigAccessBase.py.

◆ loader

python.TriggerConfigAccessBase.TriggerConfigAccess.loader

Definition at line 438 of file TriggerConfigAccessBase.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
python.base_data.config
config
Definition: base_data.py:21
python.Bindings.__iter__
__iter__
Definition: Control/AthenaPython/python/Bindings.py:791
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
python.root_pickle.load
def load(f, use_proxy=1, key=None)
Definition: root_pickle.py:476
python.Bindings.__getitem__
__getitem__
Definition: Control/AthenaPython/python/Bindings.py:779