ATLAS Offline Software
Public Member Functions | Private Member Functions | List of all members
python.Configurables._PyCompHandle Class Reference
Inheritance diagram for python.Configurables._PyCompHandle:
Collaboration diagram for python.Configurables._PyCompHandle:

Public Member Functions

def __init__ (self, parent, attr_name)
 
def __getattribute__ (self, n)
 
def __setattr__ (self, n, v)
 

Private Member Functions

def _init_once (self, obj)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def 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 

Member Function Documentation

◆ __getattribute__()

def 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__()

def 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()

def python.Configurables._PyCompHandle._init_once (   self,
  obj 
)
private

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  # FIXME: should we raise something in case initialize failed ?
236  obj.initialize()
237  self.__dict__['_init_called'] = True
238  # replace the handle with the proxied object
239  setattr(parent, self.__dict__['_name'], obj)
240 

The documentation for this class was generated from the following file:
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.PyAthenaComps.__setattr__
__setattr__
Definition: PyAthenaComps.py:39
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67