|
def | __init__ (self, descr, docString, default) |
|
def | __get__ (self, obj, type=None) |
|
def | __set__ (self, obj, value) |
|
def | isHandle (self, value) |
|
def | isConfig (self, value) |
|
def | getDefaultConfigurable (self, typeAndName, requester) |
|
def | convertDefaultToBeSet (self, obj, default) |
|
def | convertValueToBeSet (self, obj, value) |
|
def | setDefault (self, value) |
|
def | getDefault (self) |
|
def | fullPropertyName (self, obj) |
|
def | __delete__ (self, obj) |
|
Definition at line 361 of file PropertyProxy.py.
◆ __init__()
def python.PropertyProxy.GaudiHandlePropertyProxy.__init__ |
( |
|
self, |
|
|
|
descr, |
|
|
|
docString, |
|
|
|
default |
|
) |
| |
◆ __delete__()
def python.PropertyProxy.PropertyProxy.__delete__ |
( |
|
self, |
|
|
|
obj |
|
) |
| |
|
inherited |
Definition at line 172 of file PropertyProxy.py.
172 def __delete__( self, obj ):
173 if obj
in self.history:
174 del self.history[ obj ]
175 self.descr.__delete__( obj )
◆ __get__()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.__get__ |
( |
|
self, |
|
|
|
obj, |
|
|
|
type = None |
|
) |
| |
|
inherited |
Reimplemented from python.PropertyProxy.PropertyProxy.
Definition at line 199 of file PropertyProxy.py.
199 def __get__( self, obj, type = None ):
201 return self.descr.__get__( obj, type )
202 except AttributeError:
205 default = obj.__class__.getDefaultProperty( self.descr.__name__ )
207 if obj.isPrinting():
return default
208 default = self.convertDefaultToBeSet( obj, default )
210 if self.isConfig(default):
214 default = copy.deepcopy(default)
219 self.__set__( obj, default )
220 elif isinstance(default,GaudiHandleArray):
224 default = copy.deepcopy(default)
231 self.__set__( obj, default )
234 except AttributeError
as e:
236 traceback.print_exc()
238 raise RuntimeError(
"AttributeError(%s)" % e.args)
240 return self.descr.__get__( obj, type )
◆ __set__()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.__set__ |
( |
|
self, |
|
|
|
obj, |
|
|
|
value |
|
) |
| |
|
inherited |
Reimplemented from python.PropertyProxy.PropertyProxy.
Definition at line 243 of file PropertyProxy.py.
243 def __set__( self, obj, value ):
247 'can not change property "%s" of locked configurable "%s"' %
248 (self.descr.__name__, obj.getJobOptName()) )
252 if not obj._isInSetDefaults()
or obj
not in self.history:
253 value = self.convertValueToBeSet( obj, value )
255 self.descr.__set__( obj, value )
256 log.verbose(
"Setting %s = %r", self.fullPropertyName( obj ), value )
257 self.history.setdefault( obj, [] ).
append( value )
◆ convertDefaultToBeSet()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.convertDefaultToBeSet |
( |
|
self, |
|
|
|
obj, |
|
|
|
default |
|
) |
| |
|
inherited |
Reimplemented in python.PropertyProxy.GaudiHandleArrayPropertyProxy.
Definition at line 291 of file PropertyProxy.py.
291 def convertDefaultToBeSet( self, obj, default ):
293 isString =
type(default)
is str
294 if not isString
and self.isConfig(default):
297 elif isString
or self.isHandle(default):
300 typeAndName = default
301 default = self._handleType( typeAndName )
303 typeAndName = default.typeAndName
304 if not self._handleType.isPublic
and typeAndName:
307 conf = self.getDefaultConfigurable(typeAndName, self.fullPropertyName(obj))
309 except AttributeError
as e:
311 raise RuntimeError(*e.args)
313 raise RuntimeError(
"%s: Default configurable for class %s not found in ConfigurableDb.CfgDb" % \
314 (self.fullPropertyName(obj),default.getType() ) )
317 raise TypeError(
"%s: default value %r is not of type %s or %s" % \
318 (self.fullPropertyName(obj),default,self._confTypeName,self._handleType.__name__) )
◆ convertValueToBeSet()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.convertValueToBeSet |
( |
|
self, |
|
|
|
obj, |
|
|
|
value |
|
) |
| |
|
inherited |
Reimplemented in python.PropertyProxy.GaudiHandleArrayPropertyProxy.
Definition at line 322 of file PropertyProxy.py.
322 def convertValueToBeSet( self, obj, value ):
323 if value
is None: value =
''
324 isString =
type(value)
is str
327 return self._handleType(value)
328 elif self.isHandle(value):
330 return self._handleType(value.toStringProperty())
331 elif self.isConfig(value):
332 if self._handleType.isPublic:
335 if not value.isInToolSvc():
336 suggestion =
'You may need to add jobOptions lines something like:' + os.linesep + \
337 'from AthenaCommon.AppMgr import ToolSvc' + os.linesep + \
339 if value.getName() == value.getType():
340 suggestion +=
'%s()' % value.__class__.__name__
342 suggestion +=
'%s(%r)' % (value.__class__.__name__,value.getName())
343 raise RuntimeError( self.fullPropertyName(obj) +
344 ': Public tool %s is not yet in ToolSvc. %s' %
345 (value.getJobOptName(),suggestion) )
347 return self._handleType(value.toStringProperty())
348 elif value.hasParent( obj.getJobOptName() ):
353 return obj.copyChildAndSetParent( value, obj.getJobOptName() )
355 raise TypeError(
"Property %s value %r is not a %s nor a %s nor a string" % \
356 (self.fullPropertyName(obj),value,self._confTypeName,self._handleType.__name__) )
◆ fullPropertyName()
def python.PropertyProxy.PropertyProxy.fullPropertyName |
( |
|
self, |
|
|
|
obj |
|
) |
| |
|
inherited |
Definition at line 93 of file PropertyProxy.py.
93 def fullPropertyName( self, obj ):
94 return (obj.getJobOptName()
or obj.getName()) +
'.' + self.descr.__name__
◆ getDefault()
def python.PropertyProxy.PropertyProxy.getDefault |
( |
|
self | ) |
|
|
inherited |
◆ getDefaultConfigurable()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.getDefaultConfigurable |
( |
|
self, |
|
|
|
typeAndName, |
|
|
|
requester |
|
) |
| |
|
inherited |
Return the configurable instance corresponding to the toolhandle if possible.
Otherwise return None
Definition at line 270 of file PropertyProxy.py.
270 def getDefaultConfigurable(self,typeAndName,requester):
271 """Return the configurable instance corresponding to the toolhandle if possible.
272 Otherwise return None"""
275 typeAndNameTuple = typeAndName.split(
'/')
276 confType = typeAndNameTuple[0]
277 confClass = ConfigurableDb.getConfigurable(confType)
280 log.error(
"%s: Configurable %s is not a %s",
281 requester, confType, self._confTypeName )
284 confName = typeAndNameTuple[1]
288 return confClass(confName)
◆ isConfig()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.isConfig |
( |
|
self, |
|
|
|
value |
|
) |
| |
|
inherited |
Check if <value> is a configurable of the correct type
Definition at line 265 of file PropertyProxy.py.
265 def isConfig(self,value):
266 """Check if <value> is a configurable of the correct type"""
◆ isHandle()
def python.PropertyProxy.GaudiHandlePropertyProxyBase.isHandle |
( |
|
self, |
|
|
|
value |
|
) |
| |
|
inherited |
Check if <value> is a handle of the correct type
Definition at line 260 of file PropertyProxy.py.
260 def isHandle(self,value):
261 """Check if <value> is a handle of the correct type"""
262 return isinstance(value,self._handleType)
◆ setDefault()
def python.PropertyProxy.PropertyProxy.setDefault |
( |
|
self, |
|
|
|
value |
|
) |
| |
|
inherited |
Definition at line 85 of file PropertyProxy.py.
85 def setDefault( self, value ):
86 self.__default = value
◆ __default
python.PropertyProxy.PropertyProxy.__default |
|
privateinherited |
◆ __doc__
python.PropertyProxy.PropertyProxy.__doc__ |
|
privateinherited |
◆ _confTypeName
python.PropertyProxy.GaudiHandlePropertyProxyBase._confTypeName |
|
privateinherited |
◆ _handleType
python.PropertyProxy.GaudiHandlePropertyProxyBase._handleType |
|
privateinherited |
◆ descr
python.PropertyProxy.PropertyProxy.descr |
|
inherited |
◆ history
python.PropertyProxy.PropertyProxy.history |
|
inherited |
◆ default
The documentation for this class was generated from the following file: