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

Public Member Functions

def __init__ (self, alg, factoryName, algName, options, defaults, subAlgs=None)
 
def makeConfig (self, funcOptions)
 

Public Attributes

 alg
 
 factoryName
 
 algName
 
 options
 
 defaults
 
 subAlgs
 

Detailed Description

 

Definition at line 46 of file ConfigFactory.py.

Constructor & Destructor Documentation

◆ __init__()

def python.ConfigFactory.FactoryBlock.__init__ (   self,
  alg,
  factoryName,
  algName,
  options,
  defaults,
  subAlgs = None 
)

Definition at line 49 of file ConfigFactory.py.

49  def __init__(self, alg, factoryName, algName, options, defaults, subAlgs=None):
50  self.alg = alg
51  self.factoryName = factoryName
52  self.algName = algName
53  self.options = options
54  self.defaults = defaults
55  if subAlgs is None:
56  self.subAlgs = {}
57  else:
58  self.subAlgs = subAlgs
59 
60 

Member Function Documentation

◆ makeConfig()

def python.ConfigFactory.FactoryBlock.makeConfig (   self,
  funcOptions 
)
Parameters
----------
funcName: str
    name associated with the algorithm. This name must have been added to the
    list of available algorithms
funcOptions: dict
    dictionary containing options for the algorithm read from the YAML file

Returns
-------
    configSequence

Definition at line 61 of file ConfigFactory.py.

61  def makeConfig(self, funcOptions):
62  """
63  Parameters
64  ----------
65  funcName: str
66  name associated with the algorithm. This name must have been added to the
67  list of available algorithms
68  funcOptions: dict
69  dictionary containing options for the algorithm read from the YAML file
70 
71  Returns
72  -------
73  configSequence
74  """
75  configSeq = ConfigSequence()
76 
77  func = self.alg
78  funcName = self.algName
79  funcDefaults = getDefaultArgs(func)
80  defaults = self.defaults
81 
82  args = {}
83  # loop over all options for the function
84  for arg in getFuncArgs(func):
85  # supplied from config file
86  if arg in funcOptions:
87  args[arg] = funcOptions[arg]
88  # defaults set in function def
89  elif arg in funcDefaults:
90  args[arg] = funcDefaults[arg]
91  # defaults provided when func was added
92  elif defaults is not None and arg in defaults:
93  args[arg] = defaults[arg]
94  elif arg == 'seq':
95  # 'seq' should be first arg of func (not needed for class)
96  args[arg] = configSeq
97  elif arg == 'kwargs':
98  # cannot handle arbitrary parameters
99  continue
100  else:
101  raise ValueError(f"{arg} is required for {funcName}")
102  if inspect.isclass(func):
103  configSeq.append(func(**args))
104  else:
105  func(**args)
106  configSeq.setFactoryName(self.factoryName)
107  return configSeq, args.keys()
108 
109 

Member Data Documentation

◆ alg

python.ConfigFactory.FactoryBlock.alg

Definition at line 50 of file ConfigFactory.py.

◆ algName

python.ConfigFactory.FactoryBlock.algName

Definition at line 52 of file ConfigFactory.py.

◆ defaults

python.ConfigFactory.FactoryBlock.defaults

Definition at line 54 of file ConfigFactory.py.

◆ factoryName

python.ConfigFactory.FactoryBlock.factoryName

Definition at line 51 of file ConfigFactory.py.

◆ options

python.ConfigFactory.FactoryBlock.options

Definition at line 53 of file ConfigFactory.py.

◆ subAlgs

python.ConfigFactory.FactoryBlock.subAlgs

Definition at line 56 of file ConfigFactory.py.


The documentation for this class was generated from the following file:
python.ConfigFactory.getDefaultArgs
def getDefaultArgs(func)
Definition: ConfigFactory.py:25
python.ConfigFactory.getFuncArgs
def getFuncArgs(func)
Definition: ConfigFactory.py:35
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18