ConfigurableMeta::ConfigurableMeta Class Reference
List of all members.
Detailed Description
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.
Member Function Documentation
| def 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.
00066 :
00067 """To Gaudi, any object with the same type/name is the same object. Hence,
00068 this is mimicked in the configuration: instantiating a new Configurable
00069 of a type with the same name will return the same instance."""
00070
00071
00072
00073 cfg = cls.__new__( cls, *args, **kwargs )
00074
00075
00076 if not hasattr(cfg, '_initok') or not cfg._initok:
00077 cls.__init__( cfg, *args, **kwargs )
00078
00079 return cfg
| def ConfigurableMeta::ConfigurableMeta::__new__ |
( |
|
self, |
|
|
|
name, |
|
|
|
bases, |
|
|
|
dct | |
|
) |
| | |
Definition at line 19 of file ConfigurableMeta.py.
00020 :
00021
00022 if 'getType' in dct and not isinstance( dct[ 'getType' ], classmethod ):
00023 dct[ 'getType' ] = classmethod( dct[ 'getType' ] )
00024
00025 if 'setDefaults' in dct and not isinstance( dct[ 'setDefaults' ], classmethod ):
00026 dct[ 'setDefaults' ] = classmethod( dct[ 'setDefaults' ] )
00027
00028
00029
00030
00031 newclass = type.__new__( self, name, bases, dct )
00032
00033
00034 newclass.configurables = {}
00035
00036
00037 properties = {}
00038 slots = dct.get( '__slots__' )
00039 if slots:
00040 props = [ x for x in slots if x[0] != '_' ]
00041 propDict = dct.get('_propertyDocDct')
00042 for prop in props:
00043 docString = propDict and propDict.get(prop)
00044 if type(slots) == dict:
00045 default = slots[prop]
00046 else:
00047 default = None
00048 proxy = PropertyProxy.PropertyProxyFactory( getattr( newclass, prop ), docString, default )
00049
00050 properties[ prop ] = proxy
00051 setattr( newclass, prop, proxy )
00052
00053
00054 for base in bases:
00055 try:
00056 bprops = base._properties.copy()
00057 bprops.update( properties )
00058 properties = bprops
00059 except AttributeError:
00060 pass
00061
00062 newclass._properties = properties
00063
00064 return newclass
The documentation for this class was generated from the following file:
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r0/GaudiKernel/python/GaudiKernel/ConfigurableMeta.py