ATLAS Offline Software
Loading...
Searching...
No Matches
python.ConfigFactory.FactoryBlock Class Reference
Collaboration diagram for python.ConfigFactory.FactoryBlock:

Public Member Functions

 makeConfig (self, funcOptions)

Public Attributes

 factoryName

Static Public Attributes

dict subAlgs = field(default_factory=dict)

Detailed Description

 

Definition at line 48 of file ConfigFactory.py.

Member Function Documentation

◆ makeConfig()

python.ConfigFactory.FactoryBlock.makeConfig ( self,
funcOptions )
Parameters
----------
funcOptions: dict
    dictionary containing options for the algorithm read from the YAML file

Returns
-------
    configSequence, and the names of the arguments passed to the algorithm

Definition at line 59 of file ConfigFactory.py.

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

Member Data Documentation

◆ factoryName

python.ConfigFactory.FactoryBlock.factoryName

Definition at line 101 of file ConfigFactory.py.

◆ subAlgs

dict python.ConfigFactory.FactoryBlock.subAlgs = field(default_factory=dict)
static

Definition at line 56 of file ConfigFactory.py.


The documentation for this class was generated from the following file: