ATLAS Offline Software
Loading...
Searching...
No Matches
python.GeneratorSettingsSemantics.GeneratorSettingsSemantics Class Reference
Inheritance diagram for python.GeneratorSettingsSemantics.GeneratorSettingsSemantics:
Collaboration diagram for python.GeneratorSettingsSemantics.GeneratorSettingsSemantics:

Public Member Functions

 __init__ (self, cpp_type)
 store (self, assigned_value)
 default (self, default_commands)
 merge (self, current_value, incoming_value)
 opt_value (self, stored_value)

Static Private Attributes

list __handled_types__ = [re.compile(r"^GeneratorSettings<.*>$")]

Detailed Description

Semantics for generator settings properties.

Gaudi sees the property as a sequence of strings, but CA merging receives
GeneratorSettingsLayer objects so fragments can be combined by precedence
before the final list is handed to the C++ component.

Definition at line 212 of file GeneratorSettingsSemantics.py.

Constructor & Destructor Documentation

◆ __init__()

python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.__init__ ( self,
cpp_type )

Definition at line 222 of file GeneratorSettingsSemantics.py.

222 def __init__(self, cpp_type):
223 # SequenceSemantics needs the element semantics even though we store a
224 # custom helper value instead of Gaudi's normal list helper.
225 super().__init__(cpp_type, valueSem=getSemanticsFor("std::string"))
226

Member Function Documentation

◆ default()

python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.default ( self,
default_commands )
Store C++ defaults as the lowest-precedence command layer.

Definition at line 244 of file GeneratorSettingsSemantics.py.

244 def default(self, default_commands):
245 """Store C++ defaults as the lowest-precedence command layer."""
246 if not default_commands:
247 return GeneratorSettingsValue()
248 if isinstance(default_commands, str):
249 raise TypeError("generator settings must be assigned from a sequence")
250 return GeneratorSettingsValue([
251 GeneratorSettingsLayer(
252 source=self.name or "<default>",
253 values=tuple(default_commands or ()),
254 precedence=GeneratorSettingsPrecedence.BASE,
255 report_context=self.name,
256 )
257 ])
258

◆ merge()

python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.merge ( self,
current_value,
incoming_value )
Merge two unresolved layer sets during CA merging.

Definition at line 259 of file GeneratorSettingsSemantics.py.

259 def merge(self, current_value, incoming_value):
260 """Merge two unresolved layer sets during CA merging."""
261 current_settings = self.store(current_value)
262 incoming_settings = self.store(incoming_value)
263 return GeneratorSettingsValue(
264 current_settings.layers + incoming_settings.layers
265 )
266
Definition merge.py:1

◆ opt_value()

python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.opt_value ( self,
stored_value )
Return the final plain command list.
This is the point where all layers are resolved. 
Print duplicate and conflict warnings here.

Definition at line 267 of file GeneratorSettingsSemantics.py.

267 def opt_value(self, stored_value):
268 """
269 Return the final plain command list.
270 This is the point where all layers are resolved.
271 Print duplicate and conflict warnings here.
272 """
273 settings_value = self.store(stored_value)
274 return settings_value.resolve(report_context=self.name, emit_report=True)
275
276

◆ store()

python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.store ( self,
assigned_value )
Convert user input into the internal unresolved layer container.

Definition at line 227 of file GeneratorSettingsSemantics.py.

227 def store(self, assigned_value):
228 """Convert user input into the internal unresolved layer container."""
229 if isinstance(assigned_value, GeneratorSettingsValue):
230 return assigned_value
231 if isinstance(assigned_value, GeneratorSettingsLayer):
232 return GeneratorSettingsValue([assigned_value])
233 if isinstance(assigned_value, str):
234 raise TypeError("generator settings must be assigned from a sequence")
235 return GeneratorSettingsValue([
236 GeneratorSettingsLayer(
237 source=self.name or "<unknown>",
238 values=tuple(assigned_value or ()),
239 precedence=GeneratorSettingsPrecedence.USER,
240 report_context=self.name,
241 )
242 ])
243

Member Data Documentation

◆ __handled_types__

list python.GeneratorSettingsSemantics.GeneratorSettingsSemantics.__handled_types__ = [re.compile(r"^GeneratorSettings<.*>$")]
staticprivate

Definition at line 220 of file GeneratorSettingsSemantics.py.


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