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, algName, options, defaults, subAlgs=None)
 
def makeConfig (self, funcOptions)
 

Public Attributes

 alg
 
 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,
  algName,
  options,
  defaults,
  subAlgs = None 
)

Definition at line 49 of file ConfigFactory.py.

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

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 60 of file ConfigFactory.py.

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

Member Data Documentation

◆ alg

python.ConfigFactory.FactoryBlock.alg

Definition at line 50 of file ConfigFactory.py.

◆ algName

python.ConfigFactory.FactoryBlock.algName

Definition at line 51 of file ConfigFactory.py.

◆ defaults

python.ConfigFactory.FactoryBlock.defaults

Definition at line 53 of file ConfigFactory.py.

◆ options

python.ConfigFactory.FactoryBlock.options

Definition at line 52 of file ConfigFactory.py.

◆ subAlgs

python.ConfigFactory.FactoryBlock.subAlgs

Definition at line 55 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