Python equivalent to the C++ Property interface
Definition at line 238 of file Bindings.py.
◆ __init__()
def GaudiPython.Bindings.iProperty.__init__ |
( |
|
self, |
|
|
|
name, |
|
|
|
ip = None |
|
) |
| |
Reimplemented in GaudiPython.Bindings.iJobOptSvc, GaudiPython.Bindings.iToolSvc, GaudiPython.Bindings.iNTupleSvc, GaudiPython.Bindings.iHistogramSvc, GaudiPython.Bindings.iDataSvc, GaudiPython.Bindings.iAlgTool, GaudiPython.Bindings.iAlgorithm, and GaudiPython.Bindings.iService.
Definition at line 241 of file Bindings.py.
241 def __init__(self, name, ip=None):
243 self.__dict__[
'_ip'] = InterfaceCast(gbl.IProperty)(ip)
245 self.__dict__[
'_ip'] =
None 246 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
247 optsvc = Helper.service(self._svcloc,
'JobOptionsSvc')
249 self.__dict__[
'_optsvc'] = InterfaceCast(
250 gbl.IJobOptionsSvc)(optsvc)
252 self.__dict__[
'_optsvc'] =
None 253 self.__dict__[
'_name'] = name
◆ __call_interface_method__()
def GaudiPython.Bindings.iProperty.__call_interface_method__ |
( |
|
self, |
|
|
|
ifname, |
|
|
|
method, |
|
|
* |
args |
|
) |
| |
Definition at line 263 of file Bindings.py.
263 def __call_interface_method__(self, ifname, method, *args):
264 if not getattr(self, ifname):
265 self.retrieveInterface()
266 return getattr(getattr(self, ifname), method)(*args)
◆ __getattr__()
def GaudiPython.Bindings.iProperty.__getattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
The method which returns the value for the given property
- In the case of the valid instance it returns the valid property value through IProperty interface
- In the case of placeholder the property value is retrieved from JobOptionsCatalogue
Definition at line 324 of file Bindings.py.
324 def __getattr__(self, name):
326 The method which returns the value for the given property 327 - In the case of the valid instance it returns the valid property value through IProperty interface 328 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue 330 ip = self.getInterface()
332 if not gbl.Gaudi.Utils.hasProperty(ip, name):
333 raise AttributeError(
'property %s does not exist' % name)
334 prop = ip.getProperty(name)
335 if StringProperty ==
type(prop):
337 elif StringPropertyRef ==
type(prop):
340 return eval(prop.toString(), {}, {})
344 props = self._optsvc.getProperties(self._name)
346 if not p.name() == name:
350 return eval(p.value(), {}, {})
353 raise AttributeError(
'property %s does not exist' % name)
◆ __setattr__()
def GaudiPython.Bindings.iProperty.__setattr__ |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
The method which is used for setting the property from the given value.
- In the case of the valid instance it sets the property through IProperty interface
- In the case of placeholder the property is added to JobOptionsCatalogue
Definition at line 268 of file Bindings.py.
268 def __setattr__(self, name, value):
270 The method which is used for setting the property from the given value. 271 - In the case of the valid instance it sets the property through IProperty interface 272 - In the case of placeholder the property is added to JobOptionsCatalogue 274 if hasattr(value,
'toStringProperty'):
276 value =
'%s' % value.toStringProperty()
277 ip = self.getInterface()
279 if not gbl.Gaudi.Utils.hasProperty(ip, name):
280 raise AttributeError(
'property %s does not exist' % name)
281 prop = ip.getProperty(name)
284 canSetValue = (hasattr(prop,
'value')
285 and 'const&[' not in prop.value.func_doc
286 and type(value) ==
type(prop.value()))
288 canSetValue = (hasattr(prop,
'value')
289 and type(value) ==
type(prop.value()))
292 if not prop.setValue(value):
293 raise AttributeError(
294 'property %s could not be set from %s' % (name, value))
296 if tuple ==
type(value):
298 elif hasattr(value,
'toString'):
299 value = value.toString()
300 elif not long ==
type(value):
305 sc = cppyy.gbl.GaudiPython.Helper.setPropertyFromString(
308 sc = prop.fromString(value)
310 raise AttributeError(
311 'property %s could not be set from %s' % (name, value))
313 if type(value) == str:
314 value =
'"%s"' % value
315 elif type(value) == tuple:
317 elif hasattr(value,
'toString'):
318 value = value.toString()
319 elif type(value) == long:
321 sp = gbl.GaudiPython.Helpers.mkStringProperty(name, str(value))
bool PyHelper() addPropertyToCatalogue(IInterface *p, char *comp, char *name, char *value)
def ROOT6WorkAroundEnabled(id=None)
◆ getInterface()
def GaudiPython.Bindings.iProperty.getInterface |
( |
|
self | ) |
|
Definition at line 255 of file Bindings.py.
255 def getInterface(self):
257 self.retrieveInterface()
◆ name()
def GaudiPython.Bindings.iProperty.name |
( |
|
self | ) |
|
◆ properties()
def GaudiPython.Bindings.iProperty.properties |
( |
|
self | ) |
|
Definition at line 355 of file Bindings.py.
358 ip = self.getInterface()
360 props = ip.getProperties()
361 propsFrom = self._name
363 props = self._optsvc.getProperties(self._name)
364 propsFrom =
"jobOptionsSvc" 368 dct[p.name()] = PropertyEntry(p)
369 except (ValueError, TypeError)
as e:
370 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
371 (e.__class__.__name__, e.args,
372 propsFrom, p.name(), p.value()))
◆ retrieveInterface()
def GaudiPython.Bindings.iProperty.retrieveInterface |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: