The Gaudi Framework  v36r16 (ea80daf8)
GaudiConfig2._configurables Namespace Reference

Classes

class  ConfigMetaHelper
 
class  Configurable
 
class  ConfigurableMeta
 
class  Property
 

Functions

def useGlobalInstances (enable)
 
def opt_repr (value)
 
def makeConfigurableClass (name, **namespace)
 
def all_options (explicit_defaults=False)
 

Function Documentation

◆ all_options()

def GaudiConfig2._configurables.all_options (   explicit_defaults = False)
Return a dictionary with all explicitly set options, or with also the
defaults if explicit_defaults is set to True.

Definition at line 338 of file _configurables.py.

338 def all_options(explicit_defaults=False):
339  """
340  Return a dictionary with all explicitly set options, or with also the
341  defaults if explicit_defaults is set to True.
342  """
343  opts = {}
344  for c in Configurable.instances.values():
345  opts.update(c.__opt_properties__(explicit_defaults))
346  return opts

◆ makeConfigurableClass()

def GaudiConfig2._configurables.makeConfigurableClass (   name,
**  namespace 
)
Create a Configurable specialization.

Definition at line 328 of file _configurables.py.

328 def makeConfigurableClass(name, **namespace):
329  """
330  Create a Configurable specialization.
331  """
332  properties = namespace.pop("properties", {})
333  namespace.update({pname: Property(*pargs) for pname, pargs in properties.items()})
334 
335  return type(name, (Configurable,), namespace)
336 
337 

◆ opt_repr()

def GaudiConfig2._configurables.opt_repr (   value)
String representation of the value, such that it can be consumed be the
Gaudi option parsers.

Definition at line 125 of file _configurables.py.

125 def opt_repr(value):
126  """
127  String representation of the value, such that it can be consumed be the
128  Gaudi option parsers.
129  """
130  if hasattr(value, "__opt_repr__"):
131  return value.__opt_repr__()
132  elif isinstance(value, str):
133  return '"{}"'.format(value.replace('"', '\\"'))
134  return repr(value)
135 
136 

◆ useGlobalInstances()

def GaudiConfig2._configurables.useGlobalInstances (   enable)
Enable or disable the global instances database.

By default global instances are enabled.

Definition at line 19 of file _configurables.py.

19 def useGlobalInstances(enable):
20  """
21  Enable or disable the global instances database.
22 
23  By default global instances are enabled.
24  """
25  global _GLOBAL_INSTANCES
26  if enable == _GLOBAL_INSTANCES:
27  return
28  if not enable:
29  assert (
30  not Configurable.instances
31  ), "Configurable instances DB not empty, cannot be disabled"
32  _GLOBAL_INSTANCES = enable
33 
34 
GaudiConfig2._configurables.opt_repr
def opt_repr(value)
Definition: _configurables.py:125
GaudiConfig2._configurables.all_options
def all_options(explicit_defaults=False)
Definition: _configurables.py:338
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
gaudirun.type
type
Definition: gaudirun.py:162
GaudiConfig2._configurables.makeConfigurableClass
def makeConfigurableClass(name, **namespace)
Definition: _configurables.py:328
GaudiConfig2._configurables.useGlobalInstances
def useGlobalInstances(enable)
Definition: _configurables.py:19