| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Properties | Private Attributes | List of all members
GaudiKernel.PropertyProxy.PropertyProxy Class Reference
Inheritance diagram for GaudiKernel.PropertyProxy.PropertyProxy:
[legend]
Collaboration diagram for GaudiKernel.PropertyProxy.PropertyProxy:
[legend]

## Public Member Functions
def | __init__ (self, descr, docString=None, default=None)
def | setDefault (self, value)
def | getDefault (self)
def | fullPropertyName (self, obj)
def | __get__ (self, obj, type=None)
def | __set__ (self, obj, value)
def | __delete__ (self, obj)

## Public Attributes
| history
| descr

## Properties
| default = property(getDefault, setDefault)

## Private Attributes
| __doc__
| __default

## Detailed Description

Definition at line 68 of file PropertyProxy.py.

## Constructor & Destructor Documentation

def GaudiKernel.PropertyProxy.PropertyProxy.__init__ | ( |  | self,
|  |  | descr,
|  |  | docString = `None`,
|  |  | default = `None`
| ) |  |

Definition at line 69 of file PropertyProxy.py.

69 def __init__(self, descr, docString=None, default=None):
70 self.history = {}
71 self.descr = descr
72 if docString:
73 self.__doc__ = docString
74 if default is not None:
75 self.default = default
76
GaudiKernel.PropertyProxy.PropertyProxy.history
history
Definition: PropertyProxy.py:70
GaudiKernel.PropertyProxy.PropertyProxy.descr
descr
Definition: PropertyProxy.py:71
GaudiKernel.PropertyProxy.PropertyProxy.default
default
Definition: PropertyProxy.py:83
GaudiKernel.PropertyProxy.PropertyProxy.__init__
def __init__(self, descr, docString=None, default=None)
Definition: PropertyProxy.py:69
GaudiKernel.PropertyProxy.PropertyProxy.__doc__
__doc__
Definition: PropertyProxy.py:73

## Member Function Documentation

def GaudiKernel.PropertyProxy.PropertyProxy.__delete__ | ( |  | self,
|  |  | obj
| ) |  |

Definition at line 151 of file PropertyProxy.py.

151 def __delete__(self, obj):
152 if obj in self.history:
153 del self.history[obj]
154 self.descr.__delete__(obj)
155
156
GaudiKernel.PropertyProxy.PropertyProxy.history
history
Definition: PropertyProxy.py:70
GaudiKernel.PropertyProxy.PropertyProxy.__delete__
def __delete__(self, obj)
Definition: PropertyProxy.py:151

def GaudiKernel.PropertyProxy.PropertyProxy.__get__ | ( |  | self,
|  |  | obj,
|  |  | type = `None`
| ) |  |

Definition at line 88 of file PropertyProxy.py.

88 def __get__(self, obj, type=None):
89 try:
90 return self.descr.__get__(obj, type)
91 except AttributeError:
92 # special case for lists and dictionaries:
93 # allow default to work with on += and []
94 if self.__default.__class__ in [list, dict]:
95 self.descr.__set__(
96 obj, self.__default.__class__(self.__default))
97 return self.descr.__get__(obj, type)
98 else:
99 # for non lists (or dicts) return a reference to the default
100 # return self.__default
101 raise
102
GaudiKernel.PropertyProxy.PropertyProxy.__get__
def __get__(self, obj, type=None)
Definition: PropertyProxy.py:88
GaudiKernel.PropertyProxy.PropertyProxy.__default
__default
Definition: PropertyProxy.py:78

def GaudiKernel.PropertyProxy.PropertyProxy.__set__ | ( |  | self,
|  |  | obj,
|  |  | value
| ) |  |

Definition at line 103 of file PropertyProxy.py.

103 def __set__(self, obj, value):
104 # check value/property compatibility if possible
105 proptype, allowcompat = None, False
106 if hasattr(self, 'default'):
107 proptype = type(self.default)
108 if self.descr.__name__ == 'OutputLevel': # old-style compat for Btag
109 allowcompat = True
110 elif obj in self.history:
111 proptype = type(self.history[obj][0])
112 allowcompat = True
113
114 # check if type known; allow special initializer for typed instances
115 # Do not perform the check for PropertyReference, should be delayed until
116 # binding (if ever done)
117 if proptype and proptype != type(None) and \
118 not derives_from(value, 'PropertyReference'):
119 try:
120 # check value itself
121 value = _isCompatible(proptype, value)
122
123 # check element in case of list
124 if proptype == list:
125 try:
126 oldvec = self.descr.__get__(obj, type)
127 if oldvec:
128 tpo = type(oldvec[0])
129 for v in value:
130 _isCompatible(tpo, v)
131 except AttributeError:
132 # value not yet set
133 pass
134 except ValueError, e:
135 if allowcompat:
136 log.error('inconsistent value types for %s.%s (%s)' %
137 (obj.getName(), self.descr.__name__, str(e)))
138 else:
139 raise
140
141 # allow a property to be set if we're in non-default mode, or if it
142 # simply hasn't been set before
143 if not obj._isInSetDefaults() or not obj in self.history:
144 # by convention, 'None' for default is used to designate objects setting
145 if hasattr(self, 'default') and self.default == None:
146 obj.__iadd__(value, self.descr) # to establish hierarchy
147 else:
148 self.descr.__set__(obj, value)
149 self.history.setdefault(obj, []).append(value)
150
GaudiKernel.PropertyProxy.PropertyProxy.history
history
Definition: PropertyProxy.py:70
GaudiKernel.PropertyProxy.PropertyProxy.descr
descr
Definition: PropertyProxy.py:71
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.PropertyProxy.PropertyProxy.default
default
Definition: PropertyProxy.py:83
GaudiKernel.PropertyProxy.PropertyProxy.__set__
def __set__(self, obj, value)
Definition: PropertyProxy.py:103
GaudiKernel.PropertyProxy.derives_from
def derives_from(derived, base)
Definition: PropertyProxy.py:22
GaudiKernel.PropertyProxy._isCompatible
def _isCompatible(tp, value)
Definition: PropertyProxy.py:37

def GaudiKernel.PropertyProxy.PropertyProxy.fullPropertyName | ( |  | self,
|  |  | obj
| ) |  |

Definition at line 85 of file PropertyProxy.py.

85 def fullPropertyName(self, obj):
86 return (obj.getJobOptName() or obj.getName()) + '.' + self.descr.__name__
87
GaudiKernel.PropertyProxy.PropertyProxy.fullPropertyName
def fullPropertyName(self, obj)
Definition: PropertyProxy.py:85

def GaudiKernel.PropertyProxy.PropertyProxy.getDefault | ( |  | self | ) |

Definition at line 80 of file PropertyProxy.py.

80 def getDefault(self):
81 return self.__default
82
GaudiKernel.PropertyProxy.PropertyProxy.getDefault
def getDefault(self)
Definition: PropertyProxy.py:80
GaudiKernel.PropertyProxy.PropertyProxy.__default
__default
Definition: PropertyProxy.py:78

def GaudiKernel.PropertyProxy.PropertyProxy.setDefault | ( |  | self,
|  |  | value
| ) |  |

Definition at line 77 of file PropertyProxy.py.

77 def setDefault(self, value):
78 self.__default = value
79
GaudiKernel.PropertyProxy.PropertyProxy.__default
__default
Definition: PropertyProxy.py:78
GaudiKernel.PropertyProxy.PropertyProxy.setDefault
def setDefault(self, value)
Definition: PropertyProxy.py:77

## Member Data Documentation

GaudiKernel.PropertyProxy.PropertyProxy.__default
| private

Definition at line 78 of file PropertyProxy.py.

GaudiKernel.PropertyProxy.PropertyProxy.__doc__
| private

Definition at line 73 of file PropertyProxy.py.

GaudiKernel.PropertyProxy.PropertyProxy.descr

Definition at line 71 of file PropertyProxy.py.

GaudiKernel.PropertyProxy.PropertyProxy.history

Definition at line 70 of file PropertyProxy.py.

## Property Documentation

GaudiKernel.PropertyProxy.PropertyProxy.default = property(getDefault, setDefault)
| static

Definition at line 83 of file PropertyProxy.py.

The documentation for this class was generated from the following file:

- GaudiKernel/python/GaudiKernel/PropertyProxy.py