this metaclass installs PropertyProxy descriptors for Gaudi properties
More...
this metaclass installs PropertyProxy descriptors for Gaudi properties
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 14 of file ConfigurableMeta.py.
| 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 65 of file ConfigurableMeta.py.
66 def __call__( cls, *args, **kwargs ):
67 """To Gaudi, any object with the same type/name is the same object. Hence,
68 this is mimicked in the configuration: instantiating a new Configurable
69 of a type with the same name will return the same instance."""
73 cfg = cls.__new__( cls, *args, **kwargs )
76 if not hasattr(cfg,
'_initok')
or not cfg._initok:
77 cls.__init__( cfg, *args, **kwargs )
| def GaudiKernel.ConfigurableMeta.ConfigurableMeta.__new__ |
( |
|
self, |
|
|
|
name, |
|
|
|
bases, |
|
|
|
dct |
|
) |
| |
Definition at line 19 of file ConfigurableMeta.py.
20 def __new__( self, name, bases, dct ):
22 if 'getType' in dct
and not isinstance( dct[
'getType' ], classmethod ):
23 dct[
'getType' ] = classmethod( dct[
'getType' ] )
25 if 'setDefaults' in dct
and not isinstance( dct[
'setDefaults' ], classmethod ):
26 dct[
'setDefaults' ] = classmethod( dct[
'setDefaults' ] )
31 newclass = type.__new__( self, name, bases, dct )
34 newclass.configurables = {}
38 slots = dct.get(
'__slots__' )
40 props = [ x
for x
in slots
if x[0] !=
'_' ]
41 propDict = dct.get(
'_propertyDocDct')
43 docString = propDict
and propDict.get(prop)
44 if type(slots) == dict:
48 proxy = PropertyProxy.PropertyProxyFactory( getattr( newclass, prop ), docString, default )
50 properties[ prop ] = proxy
51 setattr( newclass, prop, proxy )
56 bprops = base._properties.copy()
57 bprops.update( properties )
59 except AttributeError:
62 newclass._properties = properties