a class to mimic the gaudi C++ {Tool,Svc}Handle classes: automatic call
to `initialize` when __getattr__ is called on the instance.
Definition at line 209 of file Configurables.py.
◆ __init__()
| python.Configurables._PyCompHandle.__init__ |
( |
| self, |
|
|
| parent, |
|
|
| attr_name ) |
Definition at line 213 of file Configurables.py.
213 def __init__(self, parent, attr_name):
214 msg = parent.msg.verbose
215 try:
216 parentName=parent.name()
217 except TypeError:
218 parentName=parent.name
219 msg(
'installing py-comp-handle for [%s.%s]...',
220 parentName, attr_name)
221 self.__dict__.update({
222 '_parent': parent,
223 '_name': attr_name,
224 '_attr': getattr(parent, attr_name),
225 '_init_called': False,
226 })
227 msg(
'installing py-comp-handle for [%s.%s]... [done]',
228 parentName, attr_name)
229 return
230
◆ __getattribute__()
| python.Configurables._PyCompHandle.__getattribute__ |
( |
| self, |
|
|
| n ) |
Definition at line 241 of file Configurables.py.
241 def __getattribute__(self, n):
242 if n.startswith('_'):
243 return super().__getattribute__(n)
244 obj = self.__dict__['_attr']
245 self._init_once(obj)
246 return getattr(obj, n)
247
◆ __setattr__()
| python.Configurables._PyCompHandle.__setattr__ |
( |
| self, |
|
|
| n, |
|
|
| v ) |
Definition at line 248 of file Configurables.py.
248 def __setattr__(self, n, v):
249 if n.startswith('_'):
250 return super().__setattr__(n,v)
251 obj = self.__dict__['_attr']
252 self._init_once(obj)
253 return setattr(obj, n, v)
254
255
◆ _init_once()
| python.Configurables._PyCompHandle._init_once |
( |
| self, |
|
|
| obj ) |
|
protected |
Definition at line 231 of file Configurables.py.
231 def _init_once(self, obj):
232 if self.__dict__['_init_called']:
233 return
234 parent = self.__dict__['_parent']
235
236 obj.initialize()
237 self.__dict__['_init_called'] = True
238
239 setattr(parent, self.__dict__['_name'], obj)
240
The documentation for this class was generated from the following file: