The setting of Gaudi component properties needs to be deferred and
history of who set what where needs to be collected. This is done
by using PropertyProxy descriptors rather than the default ones.
Definition at line 25 of file ConfigurableMeta.py.
◆ __call__()
def GaudiKernel.ConfigurableMeta.ConfigurableMeta.__call__ |
( |
|
cls, |
|
|
* |
args, |
|
|
** |
kwargs |
|
) |
| |
To Gaudi, any object with the same type/name is the same object. Hence,
this is mimicked in the configuration: instantiating a new Configurable
of a type with the same name will return the same instance.
Definition at line 78 of file ConfigurableMeta.py.
78 def __call__(cls, *args, **kwargs):
79 """To Gaudi, any object with the same type/name is the same object. Hence,
80 this is mimicked in the configuration: instantiating a new Configurable
81 of a type with the same name will return the same instance."""
85 cfg = cls.__new__(cls, *args, **kwargs)
88 if not hasattr(cfg,
"_initok")
or not cfg._initok:
89 cls.__init__(cfg, *args, **kwargs)
◆ __new__()
def GaudiKernel.ConfigurableMeta.ConfigurableMeta.__new__ |
( |
|
self, |
|
|
|
name, |
|
|
|
bases, |
|
|
|
dct |
|
) |
| |
Definition at line 30 of file ConfigurableMeta.py.
30 def __new__(self, name, bases, dct):
32 if "getType" in dct
and not isinstance(dct[
"getType"], classmethod):
33 dct[
"getType"] = classmethod(dct[
"getType"])
35 if "setDefaults" in dct
and not isinstance(dct[
"setDefaults"], classmethod):
36 dct[
"setDefaults"] = classmethod(dct[
"setDefaults"])
41 newclass = type.__new__(self, name, bases, dct)
44 newclass.configurables = {}
48 slots = dct.get(
"__slots__")
50 props = [x
for x
in slots
if x[0] !=
"_"]
51 propDict = dct.get(
"_propertyDocDct")
53 docString = propDict
and propDict.get(prop)
54 if isinstance(slots, dict):
58 proxy = PropertyProxy.PropertyProxyFactory(
59 getattr(newclass, prop), docString, default
62 properties[prop] = proxy
63 setattr(newclass, prop, proxy)
68 bprops = base._properties.copy()
69 bprops.update(properties)
71 except AttributeError:
74 newclass._properties = properties
The documentation for this class was generated from the following file: