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 210 of file GeneratorSettingsSemantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 220 of file GeneratorSettingsSemantics.py.

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

Member Function Documentation

◆ default()

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

Definition at line 242 of file GeneratorSettingsSemantics.py.

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

◆ merge()

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

Definition at line 257 of file GeneratorSettingsSemantics.py.

257 def merge(self, current_value, incoming_value):
258 """Merge two unresolved layer sets during CA merging."""
259 current_settings = self.store(current_value)
260 incoming_settings = self.store(incoming_value)
261 return GeneratorSettingsValue(
262 current_settings.layers + incoming_settings.layers
263 )
264
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 265 of file GeneratorSettingsSemantics.py.

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

◆ store()

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

Definition at line 225 of file GeneratorSettingsSemantics.py.

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

Member Data Documentation

◆ __handled_types__

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

Definition at line 218 of file GeneratorSettingsSemantics.py.


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