The Gaudi Framework  v37r0 (b608885e)
GaudiConfig2._configurables Namespace Reference

Classes

class  Configurable
 
class  ConfigurableMeta
 
class  Property
 

Functions

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

Variables

 _GLOBAL_INSTANCES
 (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE". More...
 

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 323 of file _configurables.py.

323 def all_options(explicit_defaults=False):
324  """
325  Return a dictionary with all explicitly set options, or with also the
326  defaults if explicit_defaults is set to True.
327  """
328  opts = {}
329  for c in Configurable.instances.values():
330  opts.update(c.__opt_properties__(explicit_defaults))
331  return opts

◆ makeConfigurableClass()

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

Definition at line 313 of file _configurables.py.

313 def makeConfigurableClass(name, **namespace):
314  """
315  Create a Configurable specialization.
316  """
317  properties = namespace.pop("properties", {})
318  namespace.update({pname: Property(*pargs) for pname, pargs in properties.items()})
319 
320  return type(name, (Configurable,), namespace)
321 
322 

◆ 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 118 of file _configurables.py.

118 def opt_repr(value):
119  """
120  String representation of the value, such that it can be consumed be the
121  Gaudi option parsers.
122  """
123  if hasattr(value, "__opt_repr__"):
124  return value.__opt_repr__()
125  elif isinstance(value, str):
126  return '"{}"'.format(value.replace('"', '\\"'))
127  return repr(value)
128 
129 

◆ useGlobalInstances()

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

By default global instances are enabled.

Definition at line 15 of file _configurables.py.

15 def useGlobalInstances(enable):
16  """
17  Enable or disable the global instances database.
18 
19  By default global instances are enabled.
20  """
21  global _GLOBAL_INSTANCES
22  if enable == _GLOBAL_INSTANCES:
23  return
24  if not enable:
25  assert (
26  not Configurable.instances
27  ), "Configurable instances DB not empty, cannot be disabled"
28  _GLOBAL_INSTANCES = enable
29 
30 

Variable Documentation

◆ _GLOBAL_INSTANCES

GaudiConfig2._configurables._GLOBAL_INSTANCES
private

(c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE".

# # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #

Classes and functions for handling Configurables

Definition at line 12 of file _configurables.py.

GaudiConfig2._configurables.opt_repr
def opt_repr(value)
Definition: _configurables.py:118
GaudiConfig2._configurables.all_options
def all_options(explicit_defaults=False)
Definition: _configurables.py:323
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:313
GaudiConfig2._configurables.useGlobalInstances
def useGlobalInstances(enable)
Definition: _configurables.py:15