| The Gaudi Framework v29r0 (ff2e7097)

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

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

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

## Classes
class | DefaultName

## Public Member Functions
def | __new__ (cls, args, kwargs)
def | __init__ (self, name=DefaultName)
def | __getstate__ (self)
def | __getnewargs__ (self)
def | __setstate__ (self, dict)
def | __len__ (self)
def | __iter__ (self)
def | __deepcopy__ (self, memo)
def | __iadd__ (self, configs, descr=None)
def | __getattr__ (self, attr)
def | __setattr__ (self, name, value)
def | __delattr__ (self, attr)
def | __nonzero__ (self)
def | remove (self, items)
def | removeAll (self)
def | copyChild (self, child)
def | setParent (self, parentName)
def | getParent (self)
def | hasParent (self, parent)
def | copyChildAndSetParent (self, cfg, parent)
def | getChildren (self)
def | getTools (self)
def | children (self)
def | getAllChildren (self)
def | getSequence (self)
def | setup (self)
def | getProperties (self)
def | getPropertiesWithDescription (self)
def | getValuedProperties (self)
def | properties (self)
def | getDefaultProperties (cls)
def | getDefaultProperty (cls, name)
def | getProp (self, name)
def | setProp (self, name, value)
def | isPropertySet (self, name)
def | getType (cls)
def | getName (self)
def | name (self)
def | getJobOptName (self)
def | isPublic (self)
def | jobOptName (self)
def | getFullName (self)
def | getFullJobOptName (self)
def | getPrintTitle (self)
def | getTitleName (self)
def | setDefaults (cls, handle)
def | clone (self, name=None, kwargs)
def | splitName (self)
def | addTool (self, tool, name=None)
def | __repr__ (self)
def | __str__ (self, indent=0, headerLastIndentUnit=indentUnit)

## Static Public Attributes
| propertyNoValue
string | indentUnit = '| '
int | printHeaderWidth = 100
int | printHeaderPre = 5
dictionary | allConfigurables = {}
dictionary | configurableServices = {}

## Private Member Functions
def | _isInSetDefaults (self)
def | __setupServices (self)
def | __setupDlls (self)
def | __setupDefaults (self)

## Static Private Member Functions
def | _printHeader (indentStr, title)
def | _printFooter (indentStr, title)

## Private Attributes
| __children
| __tools
| _name
| _inSetDefaults
| _initok
| _setupok

## Static Private Attributes
| __metaclass__ = ConfigurableMeta.ConfigurableMeta
tuple | __slots__
bool | _configurationLocked = False

## Detailed Description

    Base class for Gaudi components that implement the IProperty interface.
       Provides most of the boilerplate code, but the actual useful classes
       are its derived ConfigurableAlgorithm, ConfigurableService, and
       ConfigurableAlgTool.

Definition at line 107 of file Configurable.py.

## Constructor & Destructor Documentation

def GaudiKernel.Configurable.Configurable.__init__ | ( |  | self,
|  |  | name = `DefaultName`
| ) |  |

Definition at line 278 of file Configurable.py.

278 def __init__(self, name=DefaultName):
279 # check class readiness, all required overloads should be there now
280 klass = self.__class__
281
282 # this is an abstract class
283 if klass == Configurable:
284 raise TypeError, "%s is an ABC and can not be instantiated" % str(
285 Configurable)
286
287 # the following methods require overloading
288 # NOT YET meths = { 'getServices' : 1, # retrieve list of services to configure
289 meths = {'getDlls': 1, # provide list of Dlls to load
290 'getGaudiType': 1, # return string describing component class
291 'getHandle': 1} # provide access to C++ side component instance
292 # 'getType' : 1 } # return the type of the actual C++ component
293
294 for meth, nArgs in meths.items():
295 try:
296 f = getattr(klass, meth).im_func
297 except AttributeError:
298 raise NotImplementedError, "%s is missing in class %s" % (
299 meth, str(klass))
300
301 # in addition, verify the number of arguments w/o defaults
302 nargcount = f.func_code.co_argcount
303 ndefaults = f.func_defaults and len(f.func_defaults) or 0
304 if not nargcount - ndefaults <= nArgs <= nargcount:
305 raise TypeError, "%s.%s requires exactly %d arguments" % (
306 klass, meth, nArgs)
307
308 # for using this Configurable as a (Gaudi) sequence
309 self.__children = []
310 self.__tools = {}
311
312 # know who we are
313 if name == Configurable.DefaultName:
314 if hasattr(self.__class__, 'DefaultedName'):
315 self._name = self.__class__.DefaultedName
316 else:
317 self._name = self.getType()
318 else:
319 self._name = name
320
321 # set to True when collecting defaults, False otherwise
322 self._inSetDefaults = False
323
324 # for later, in case __init__ itself is overridden
325 self._initok = True
326
327 # for debugging purposes (temporary)
328 self._setupok = False
329
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.__init__
def __init__(self, name=DefaultName)
Definition: Configurable.py:278
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:325
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:315
GaudiKernel.Configurable.Configurable._setupok
_setupok
Definition: Configurable.py:328
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:310
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:322
GaudiKernel.Configurable.Configurable.DefaultName
Definition: Configurable.py:114

## Member Function Documentation

def GaudiKernel.Configurable.Configurable.__deepcopy__ | ( |  | self,
|  |  | memo
| ) |  |

Definition at line 361 of file Configurable.py.

361 def __deepcopy__(self, memo):
362 newconf = object.__new__(self.__class__)
363 self.__class__.__init__(newconf, self.getName())
364
365 for proxy in self._properties.values():
366 try:
367 proxy.__set__(newconf, proxy.__get__(self))
368 except AttributeError:
369 pass # means property was not set for self
370
371 for c in self.__children:
372 newconf += c # processes proper copy semantics
373
374 return newconf
375
GaudiKernel.Configurable.Configurable.__deepcopy__
def __deepcopy__(self, memo)
Definition: Configurable.py:361
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715

def GaudiKernel.Configurable.Configurable.__delattr__ | ( |  | self,
|  |  | attr
| ) |  |

Definition at line 436 of file Configurable.py.

436 def __delattr__(self, attr):
437 # remove as property, otherwise try as child
438 try:
439 # remove history etc., then reset to default (in case set before)
440 prop = self._properties[attr]
441 prop.__delete__(self)
442 prop.__set__(self, prop.default)
443 return # reaches here? was property: done now
444 except KeyError:
445 pass
446 # otherwise, remove the private tool
447 if attr in self.__tools:
448 del self.__tools[attr]
449
450 # otherwise, remove child, if one is so named
451 for c in self.__children:
452 if c.getName() == attr:
453 self.__children.remove(c)
454
455 # potentially, there are left over caches (certain user derived classes)
456 try:
457 del self.__dict__[attr]
458 except (AttributeError, KeyError):
459 pass
460
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.__delattr__
def __delattr__(self, attr)
Definition: Configurable.py:436
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:310

def GaudiKernel.Configurable.Configurable.__getattr__ | ( |  | self,
|  |  | attr
| ) |  |

Definition at line 410 of file Configurable.py.

410 def __getattr__(self, attr): # until ToolProperties exist ...
411
412 if attr in self.__tools:
413 return self.__tools[attr]
414
415 if attr in self._properties:
416 if isinstance(self._properties[attr].__get__(self), DataObjectHandleBase):
417 return self._properties[attr].__get__(self)
418
419 for c in self.__children:
420 if c.getName() == attr:
421 return c
422
423 raise AttributeError(
424 "'%s' object has no attribute '%s'" % (self.__class__, attr))
425
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.__getattr__
def __getattr__(self, attr)
Definition: Configurable.py:410
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:310

def GaudiKernel.Configurable.Configurable.__getnewargs__ | ( |  | self | ) |

Definition at line 344 of file Configurable.py.

344 def __getnewargs__(self):
345 return (self._name,)
346
GaudiKernel.Configurable.Configurable.__getnewargs__
def __getnewargs__(self)
Definition: Configurable.py:344
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:315

def GaudiKernel.Configurable.Configurable.__getstate__ | ( |  | self | ) |

Definition at line 331 of file Configurable.py.

331 def __getstate__(self):
332 dict = {}
333 for name, proxy in self._properties.items():
334 try:
335 dict[name] = proxy.__get__(self)
336 except AttributeError:
337 pass
338
339 dict['_Configurable__children'] = self.__children
340 dict['_Configurable__tools'] = self.__tools
341 dict['_name'] = self._name
342 return dict
343
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:315
GaudiKernel.Configurable.Configurable.__getstate__
def __getstate__(self)
Definition: Configurable.py:331
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:310

def GaudiKernel.Configurable.Configurable.__iadd__ | ( |  | self,
|  |  | configs,
|  |  | descr = `None`
| ) |  |

Definition at line 377 of file Configurable.py.

377 def __iadd__(self, configs, descr=None):
378 if not type(configs) in (list, tuple):
379 configs = (configs, )
380
381 joname = self.getJobOptName()
382
383 for cfg in configs:
384 # prevent type mismatches
385 if not isinstance(cfg, Configurable):
386 raise TypeError("'%s' is not a Configurable" % str(cfg))
387
388 cc = self.copyChildAndSetParent(cfg, joname)
389
390 # filters dupes; usually "ok" (backdoor should catch them)
391 ccjo = cc.getJobOptName()
392 for c in self.__children:
393 if c.getJobOptName() == ccjo:
394 log.error(
395 'attempt to add a duplicate ... dupe ignored%s', error_explanation)
396 break
397 else:
398 self.__children.append(cc)
399
400 try:
401 if descr: # support for tool properties
402 descr.__set__(self, cc)
403 else:
404 setattr(self, cc.getName(), cc)
405 except AttributeError:
406 pass # to allow free addition of tools/subalgorithms
407
408 return self
409
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.copyChildAndSetParent
def copyChildAndSetParent(self, cfg, parent)
Definition: Configurable.py:486
GaudiKernel.Configurable.Configurable.__iadd__
def __iadd__(self, configs, descr=None)
Definition: Configurable.py:377
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:721

def GaudiKernel.Configurable.Configurable.__iter__ | ( |  | self | ) |

Definition at line 357 of file Configurable.py.

357 def __iter__(self):
358 return iter(self.__children)
359
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.__iter__
def __iter__(self)
Definition: Configurable.py:357

def GaudiKernel.Configurable.Configurable.__len__ | ( |  | self | ) |

Definition at line 354 of file Configurable.py.

354 def __len__(self):
355 return len(self.__children)
356
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.__len__
def __len__(self)
Definition: Configurable.py:354

def GaudiKernel.Configurable.Configurable.__new__ | ( |  | cls,
|  |  | args,
|  |  | kwargs
| ) |  |

    To Gaudi, any object with the same type/name is the same object. Hence,
       this is mimicked in the configuration: instantiating a new Configurable
       of a type with the same name will return the same instance.

Definition at line 139 of file Configurable.py.

139 def __new__(cls, *args, **kwargs):
140 """To Gaudi, any object with the same type/name is the same object. Hence,
141 this is mimicked in the configuration: instantiating a new Configurable
142 of a type with the same name will return the same instance."""
143
144 global log
145 # try to get the name of the Configurable (having a name is compulsory)
146 if 'name' in kwargs:
147 # simple keyword (by far the easiest)
148 name = kwargs['name']
149 elif 'name' in cls.__init__.func_code.co_varnames:
150 # either positional in args, or default
151 index = list(cls.__init__.func_code.co_varnames).index('name')
152 try:
153 # var names index is offset by one as __init__ is to be called with self
154 name = args[index - 1]
155 except IndexError:
156 # retrieve default value, then
157 name = cls.__init__.func_defaults[index - (len(args) + 1)]
158 else:
159 # positional index is assumed (will work most of the time)
160 try:
161 name = args[1] # '0' is for self
162 except (IndexError, TypeError):
163 raise TypeError(
164 'no "name" argument while instantiating "%s"' % cls.__name__)
165
166 argname = name
167 if name == Configurable.DefaultName:
168 if hasattr(cls, 'DefaultedName'):
169 name = cls.DefaultedName
170 else:
171 name = cls.getType()
172 elif not name or type(name) != str:
173 # unnamed, highly specialized user code, etc. ... unacceptable
174 raise TypeError(
175 'could not retrieve name from %s.__init__ arguments' % cls.__name__)
176
177 # Handle the case of global tools to prepend ToolSvc in the name.
178 # This is needed for compatibility with old JobOptions files being read
179 if issubclass(cls, ConfigurableAlgTool) and '.' not in name:
180 name = 'ToolSvc.' + name
181
182 # close backdoor access to otherwise private subalgs/tools
183 # PM if 0 <= name.find( '.' ):
184 # PM # temp protection for old style types
185 # PM from OldStyleConfig import GenericConfigurable
186 # PM if not issubclass( cls, GenericConfigurable ): # except raised for new types only
187 # PM raise NameError( '"%s": backdoor access to private configurables not allowed' % name )
188
189 # ordinary recycle case
190 if name in cls.configurables:
191 conf = cls.configurables[name]
192 if name != argname: # special case: user derived <-> real ... make same
193 cls.configurables[conf.getType()] = conf
194 #---PM: Initialize additional properties
195 for n, v in kwargs.items():
196 if n != "name": # it should not be confused with a normal property
197 setattr(conf, n, v)
198 if not cls._configurationLocked and not "_enabled" in kwargs and isinstance(conf, ConfigurableUser):
199 # Ensure that the ConfigurableUser gets enabled if nothing is
200 # specified in the constructor.
201 setattr(conf, "_enabled", True)
202 return conf
203
204 # a couple of special cases (note that these cases don't mix)
205 spos = name.find('/')
206 ti_name = None
207 if spos < 0:
208 ti_name = "%s/%s" % (name, name)
209 if ti_name in cls.configurables:
210 # support for old-style name as type/name lookup where name==type
211 return cls.configurables[ti_name]
212
213 i_name = None
214 if spos > 0:
215 i_name = name[:spos]
216 if i_name == name[spos + 1:] and i_name in cls.configurables:
217 # this is the opposite of the above special case
218 return cls.configurables[i_name]
219
220 # the following is purely for debugging support and should realistically bomb
221 conf = cls.allConfigurables.get(name, None) or\
222 (spos < 0 and cls.allConfigurables.get(ti_name, None)) or\
223 (spos > 0 and i_name == name[spos + 1:]
224 and cls.allConfigurables.get(i_name, None))
225 if conf: # wrong type used?
226 if conf.__class__ is ConfigurableGeneric:
227 # If the instance found is ConfigurableGeneric then
228 # we create a new one with the proper type and fill with
229 # the contents of the generic one
230 newconf = object.__new__(cls)
231 cls.__init__(newconf, *args, **kwargs)
232 # initialize with the properties of generic configurable
233 # (we map the names of the properties to lowercase versions because
234 # old options are not case sensitive)
235 names = {}
236 for n in newconf.__slots__:
237 names[n.lower()] = n
238 for n in conf._properties:
239 if names[n.lower()] != n:
240 log.warning("Option '%s' was used for %s, but the correct spelling is '%s'" % (
241 n, name, names[n.lower()]))
242 setattr(newconf, names[n.lower()], getattr(conf, n))
243 for n, v in kwargs.items():
244 setattr(newconf, n, v)
245 cls.configurables[name] = newconf
246 cls.allConfigurables[name] = newconf
247 return newconf
248 else:
249 # will be an actual error in the future (now only report as such)
250 log.error('attempt to redefine type of "%s" (was: %s, new: %s)%s',
251 name, conf.__class__.__name__, cls.__name__, error_explanation)
252 # in the future:
253 # return None # will bomb on use (or go unharmed on non-use)
254 # for now, allow use through allConfigurables lookup
255 #---PM: Initialize additional properties
256 for n, v in kwargs.items():
257 setattr(conf, n, v)
258 return conf
259
260 # still here: create a new instance and initialize it
261 conf = object.__new__(cls)
262 cls.__init__(conf, *args, **kwargs)
263
264 # update normal, per-class cache
265 cls.configurables[name] = conf
266
267 for base in cls.__bases__:
268 if base.__name__ == 'ConfigurableService':
269 cls.configurableServices[name] = conf
270
271 # update generics super-cache, if needed
272 cls.allConfigurables[name] = conf
273 #-->PM#if hasattr( cls, 'getType' ) and name.find('/') < 0:
274 #-->PM# cls.allConfigurables[ cls.getType() + '/' + name ] = conf
275
276 return conf
277
GaudiKernel.Configurable.Configurable.allConfigurables
dictionary allConfigurables
Definition: Configurable.py:133
GaudiKernel.Configurable.Configurable.configurableServices
dictionary configurableServices
Definition: Configurable.py:134
GaudiKernel.Configurable.Configurable.__new__
def __new__(cls, args, kwargs)
Definition: Configurable.py:139
GaudiKernel.Configurable.Configurable.__init__
def __init__(self, name=DefaultName)
Definition: Configurable.py:278
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable.Configurable._configurationLocked
bool _configurationLocked
Definition: Configurable.py:137
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712
GaudiKernel.Configurable.Configurable.DefaultName
Definition: Configurable.py:114

def GaudiKernel.Configurable.Configurable.__nonzero__ | ( |  | self | ) |

Definition at line 461 of file Configurable.py.

461 def __nonzero__(self):
462 return True
463
GaudiKernel.Configurable.Configurable.__nonzero__
def __nonzero__(self)
Definition: Configurable.py:461

def GaudiKernel.Configurable.Configurable.__repr__ | ( |  | self | ) |

Definition at line 874 of file Configurable.py.

874 def __repr__(self):
875 return '{0}({1!r})'.format(self.__class__.__name__, self.name())
876
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:718
GaudiKernel.Configurable.Configurable.__repr__
def __repr__(self)
Definition: Configurable.py:874

def GaudiKernel.Configurable.Configurable.__setattr__ | ( |  | self,
|  |  | name,
|  |  | value
| ) |  |

Definition at line 426 of file Configurable.py.

426 def __setattr__(self, name, value):
427 if self._configurationLocked:
428 raise RuntimeError(
429 "%s: Configuration cannot be modified after the ApplicationMgr has been started." % self.name())
430 try:
431 super(Configurable, self).__setattr__(name, value)
432 except AttributeError:
433 raise AttributeError("Configurable '%s' does not have property '%s'."
434 % (self.__class__.__name__, name))
435
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:718
GaudiKernel.Configurable.Configurable._configurationLocked
bool _configurationLocked
Definition: Configurable.py:137
GaudiKernel.Configurable.Configurable.__setattr__
def __setattr__(self, name, value)
Definition: Configurable.py:426

def GaudiKernel.Configurable.Configurable.__setstate__ | ( |  | self,
|  |  | dict
| ) |  |

Definition at line 347 of file Configurable.py.

347 def __setstate__(self, dict):
348 self._initok = True
349 for n, v in dict.items():
350 setattr(self, n, v)
351 return
352
GaudiKernel.Configurable.Configurable.__setstate__
def __setstate__(self, dict)
Definition: Configurable.py:347
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:325

def GaudiKernel.Configurable.Configurable.__setupDefaults | ( |  | self | ) |
| private

Definition at line 851 of file Configurable.py.

851 def __setupDefaults(self):
852 # set handle defaults flags to inform __setattr__ that it is being
853 # called during setDefaults of the concrete Configurable
854 self._inSetDefaults = True
855 self.setDefaults(self)
856 self._inSetDefaults = False
857
GaudiKernel.Configurable.Configurable.__setupDefaults
def __setupDefaults(self)
Definition: Configurable.py:851
GaudiKernel.Configurable.Configurable.setDefaults
def setDefaults(cls, handle)
Definition: Configurable.py:748
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:322

def GaudiKernel.Configurable.Configurable.__setupDlls | ( |  | self | ) |
| private

Definition at line 839 of file Configurable.py.

839 def __setupDlls(self):
840 dlls = self.getDlls()
841 if not dlls:
842 dlls = []
843 elif type(dlls) == types.StringType:
844 dlls = [dlls]
845
846 from __main__ import theApp
847 dlls = filter(lambda d: d not in theApp.Dlls, dlls)
848 if dlls:
849 theApp.Dlls += dlls
850
GaudiKernel.Configurable.Configurable.__setupDlls
def __setupDlls(self)
Definition: Configurable.py:839
gaudirun.type
type
Definition: gaudirun.py:133

def GaudiKernel.Configurable.Configurable.__setupServices | ( |  | self | ) |
| private

Definition at line 822 of file Configurable.py.

822 def __setupServices(self):
823 #svcs = self.getServices()
824 # if not svcs:
825 svcs = []
826 # elif type(svcs) == types.StringType:
827 # svcs = [ svcs ]
828
829 import __main__
830 for svc in svcs:
831 handle = __main__.Service(svc)
832 # services should be configurables as well, but aren't for now
833 # handle.setup()
834
835 # allow Configurable to make some changes
836 if hasattr(self, 'configure' + svc):
837 eval('self.configure' + svc + '( handle )')
838
GaudiKernel.Configurable.Configurable.__setupServices
def __setupServices(self)
Definition: Configurable.py:822

def GaudiKernel.Configurable.Configurable.__str__ | ( |  | self,
|  |  | indent = `0`,
|  |  | headerLastIndentUnit = `indentUnit`
| ) |  |

Definition at line 877 of file Configurable.py.

877 def __str__(self, indent=0, headerLastIndentUnit=indentUnit):
878 global log # to print some info depending on output level
879 indentStr = indent * Configurable.indentUnit
880 # print header
881 title = self.getPrintTitle()
882 # print line to easily see start-of-configurable
883 if indent > 0:
884 headerIndent = (indent - 1) * \
885 Configurable.indentUnit + headerLastIndentUnit
886 else:
887 headerIndent = ''
888 rep = Configurable._printHeader(headerIndent, title)
889 rep += os.linesep
890 # print own properties
891 props = self.getProperties()
892 defs = self.getDefaultProperties()
893 if not props:
894 rep += indentStr + '|-<no properties>' + os.linesep
895 else:
896 # get property name with
897 nameWidth = 0
898 for p in props.keys():
899 nameWidth = max(nameWidth, len(p))
900 for p, v in props.items():
901 # start with indent and property name
902 prefix = indentStr + '|-%-*s' % (nameWidth, p)
903 # add memory address for debugging (not for defaults)
904 if log.isEnabledFor(logging.DEBUG):
905 if v != Configurable.propertyNoValue:
906 address = ' @%11s' % hex(id(v))
907 else:
908 address = 13 * ' '
909 prefix += address
910 # add value and default
911 default = defs.get(p)
912 if v == Configurable.propertyNoValue:
913 # show default value as value, and no extra 'default'
914 strVal = repr(default)
915 strDef = None
916 else:
917 # convert configurable to handle
918 if hasattr(v, "getGaudiHandle"):
919 vv = v.getGaudiHandle()
920 else:
921 vv = v
922 if isinstance(vv, GaudiHandle) or isinstance(vv, GaudiHandleArray):
923 strVal = repr(vv)
924 # the default may not be a GaudiHandle (?)
925 if hasattr(default, "toStringProperty"):
926 strDef = repr(default.toStringProperty())
927 else:
928 strDef = repr(default)
929 if strDef == repr(vv.toStringProperty()):
930 strDef = None
931 else:
932 strVal = repr(vv)
933 strDef = repr(default)
934 # add the value
935 line = prefix + ' = ' + strVal
936 # add default if present
937 if strDef is not None:
938 # put default on new line if too big
939 if len(line) + len(strDef) > Configurable.printHeaderWidth:
940 line += os.linesep + indentStr + '| ' + \
941 (len(prefix) - len(indentStr) - 3) * ' '
942 line += ' (default: %s)' % (strDef,)
943 # add the line to the total string
944 rep += line + os.linesep
945 # print out full private configurables
946 # if isinstance(v,Configurable) and not v.isPublic():
GaudiKernel.Configurable.Configurable.getPrintTitle
def getPrintTitle(self)
Definition: Configurable.py:739
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:304
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:596
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:647
GaudiKernel.Configurable.Configurable.__str__
def __str__(self, indent=0, headerLastIndentUnit=indentUnit)
Definition: Configurable.py:877

def GaudiKernel.Configurable.Configurable._isInSetDefaults | ( |  | self | ) |
| private

Definition at line 819 of file Configurable.py.

819 def _isInSetDefaults(self):
820 return self._inSetDefaults
821
GaudiKernel.Configurable.Configurable._isInSetDefaults
def _isInSetDefaults(self)
Definition: Configurable.py:819
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:322

def GaudiKernel.Configurable.Configurable._printFooter | ( |  | indentStr,
|  |  | title
| ) |  |
| static private

Definition at line 867 of file Configurable.py.

867 def _printFooter(indentStr, title):
868 preLen = Configurable.printHeaderPre
869 postLen = Configurable.printHeaderWidth - \
870 preLen - 12 - len(title) # - len(indentStr)
871 postLen = max(preLen, postLen)
872 return indentStr + '\\%s (End of %s) %s' % (preLen * '-', title, postLen * '-')
873
GaudiKernel.Configurable.Configurable._printFooter
def _printFooter(indentStr, title)
Definition: Configurable.py:867

def GaudiKernel.Configurable.Configurable._printHeader | ( |  | indentStr,
|  |  | title
| ) |  |
| static private

Definition at line 859 of file Configurable.py.

859 def _printHeader(indentStr, title):
860 preLen = Configurable.printHeaderPre
861 postLen = Configurable.printHeaderWidth - \
862 preLen - 3 - len(title) # - len(indentStr)
863 postLen = max(preLen, postLen)
864 return indentStr + '/%s %s %s' % (preLen * '*', title, postLen * '*')
865
GaudiKernel.Configurable.Configurable._printHeader
def _printHeader(indentStr, title)
Definition: Configurable.py:859

def GaudiKernel.Configurable.Configurable.addTool | ( |  | self,
|  |  | tool,
|  |  | name = `None`
| ) |  |

Definition at line 798 of file Configurable.py.

798 def addTool(self, tool, name=None):
799 if isclass(tool) and issubclass(tool, ConfigurableAlgTool):
800 if name is None:
801 name = tool.__name__
802 priv_tool = tool(self.getName() + '.' + name)
803 elif isinstance(tool, ConfigurableAlgTool):
804 if name is None:
805 name = tool.splitName()[1]
806 priv_tool = tool.clone(self.getName() + '.' + name)
807 else:
808 if isclass(tool):
809 classname = tool.__name__
810 else:
811 classname = type(tool).__name__
812 raise TypeError, "addTool requires AlgTool configurable. Got %s type" % classname
813 self.__tools[name] = priv_tool
814 if name in self.__slots__:
815 # this is to avoid that the property hides the tool
816 setattr(self, name, self.__tools[name])
817 return self.__tools[name]
818
GaudiKernel.Configurable.Configurable.addTool
def addTool(self, tool, name=None)
Definition: Configurable.py:798
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715
GaudiKernel.Configurable.Configurable.__slots__
tuple __slots__
Definition: Configurable.py:124
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:310

def GaudiKernel.Configurable.Configurable.children | ( |  | self | ) |

Definition at line 512 of file Configurable.py.

512 def children(self):
513 log.error(
514 "children() is deprecated, use getChildren() instead for consistency")
515 log.error("getChildren() returns a copy; to add a child, use 'parent += child'%s",
516 error_explanation)
517 return self.__children # by ref, for compatibility
518
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.children
def children(self)
Definition: Configurable.py:512

def GaudiKernel.Configurable.Configurable.clone | ( |  | self,
|  |  | name = `None`,
|  |  | kwargs
| ) |  |

Definition at line 751 of file Configurable.py.

751 def clone(self, name=None, **kwargs):
752 if not name:
753 if hasattr(self, 'DefaultedName'):
754 name = self.DefaultedName
755 else:
756 name = self.getType()
757
758 newconf = Configurable.__new__(self.__class__, name)
759 self.__class__.__init__(newconf, name)
760
761 for proxy in self._properties.values():
762 try:
763 value = proxy.__get__(self)
764 if type(value) in [str, list, dict, tuple]:
765 # clone the values of the properties for basic types
766 value = type(value)(value)
767 proxy.__set__(newconf, value)
768 except AttributeError:
769 pass
770
771 for c in self.__children:
772 newconf += c # processes proper copy semantics
773
774 for n, t in self.__tools.items():
775 newconf.addTool(t, n)
776
777 for name, value in kwargs.items():
778 setattr(newconf, name, value)
779
780 return newconf
781
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.clone
def clone(self, name=None, kwargs)
Definition: Configurable.py:751
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712

def GaudiKernel.Configurable.Configurable.copyChild | ( |  | self,
|  |  | child
| ) |  |

Definition at line 474 of file Configurable.py.

474 def copyChild(self, child):
475 return copy.deepcopy(child)
476
GaudiKernel.Configurable.Configurable.copyChild
def copyChild(self, child)
Definition: Configurable.py:474

def GaudiKernel.Configurable.Configurable.copyChildAndSetParent | ( |  | self,
|  |  | cfg,
|  |  | parent
| ) |  |

Definition at line 486 of file Configurable.py.

486 def copyChildAndSetParent(self, cfg, parent):
487 cc = self.copyChild(cfg)
488
489 if hasattr(cc, 'setParent') and parent:
490 try:
491 cc.setParent(parent)
492 except RuntimeError, e:
493 # temporary backdoor resolution for compatibility
494 log.error(str(e) + '%s', error_explanation)
495 ccbd = cc.configurables[cc.getJobOptName()]
496
497 # merge properties, new over pre-existing
498 for proxy in self._properties.values():
499 if proxy.history.has_key(cc):
500 proxy.__set__(ccbd, proxy.__get__(cc))
501
502 # consolidate
503 cc = ccbd
504 return cc
505
GaudiKernel.Configurable.Configurable.copyChildAndSetParent
def copyChildAndSetParent(self, cfg, parent)
Definition: Configurable.py:486
GaudiKernel.Configurable.Configurable.copyChild
def copyChild(self, child)
Definition: Configurable.py:474

def GaudiKernel.Configurable.Configurable.getAllChildren | ( |  | self | ) |

    Get all (private) configurable children, both explicit ones (added with +=)
    and the ones in the private GaudiHandle properties

Definition at line 519 of file Configurable.py.

519 def getAllChildren(self):
520 """Get all (private) configurable children, both explicit ones (added with +=)
521 and the ones in the private GaudiHandle properties"""
522 childs = []
523 # add private configurable properties (also inside handles)
524 for proxy in self._properties.values():
525 try:
526 c = proxy.__get__(self)
527 except AttributeError:
528 pass
529 else:
530 if isinstance(c, Configurable) and not c.isPublic():
531 childs.append(c)
532 elif isinstance(c, GaudiHandle):
533 try:
534 conf = c.configurable
535 except AttributeError:
536 pass
537 else:
538 if not conf.isPublic():
539 childs.append(conf)
540 elif isinstance(c, GaudiHandleArray):
541 # only setup private arrays
542 if not c.isPublic():
543 for ci in c:
544 if isinstance(ci, Configurable):
545 childs.append(ci)
546 else:
547 try:
548 conf = ci.configurable
549 except AttributeError:
550 pass
551 else:
552 childs.append(conf)
553
554 # add explicit children
555 childs += self.__children
556 return childs
557
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.getAllChildren
def getAllChildren(self)
Definition: Configurable.py:519

def GaudiKernel.Configurable.Configurable.getChildren | ( |  | self | ) |

Definition at line 506 of file Configurable.py.

506 def getChildren(self):
507 return self.__children[:] # read only
508
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.getChildren
def getChildren(self)
Definition: Configurable.py:506

def GaudiKernel.Configurable.Configurable.getDefaultProperties | ( |  | cls | ) |

Definition at line 647 of file Configurable.py.

647 def getDefaultProperties(cls):
648 class collector:
649 pass
650
651 # user provided defaults
652 c = collector()
653 cls.setDefaults(c)
654
655 # defaults from C++
656 for k, v in cls._properties.items():
657 if not k in c.__dict__ and hasattr(v, 'default'):
658 c.__dict__[k] = v.default
659
660 return c.__dict__
661
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:647

def GaudiKernel.Configurable.Configurable.getDefaultProperty | ( |  | cls,
|  |  | name
| ) |  |

Definition at line 663 of file Configurable.py.

663 def getDefaultProperty(cls, name):
664 class collector:
665 pass
666
667 # user provided defaults
668 c = collector()
669 cls.setDefaults(c)
670
671 if name in c.__dict__:
672 return c.__dict__[name]
673
674 # defaults from C++
675 try:
676 v = cls._properties[name]
677 if hasattr(v, 'default'):
678 return v.default
679 except KeyError:
680 pass
681
682 return None
683
GaudiKernel.Configurable.Configurable.getDefaultProperty
def getDefaultProperty(cls, name)
Definition: Configurable.py:663

def GaudiKernel.Configurable.Configurable.getFullJobOptName | ( |  | self | ) |

Definition at line 736 of file Configurable.py.

736 def getFullJobOptName(self):
737 return "%s/%s" % (self.getType(), self.getJobOptName() or self.getName())
738
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:721
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715
GaudiKernel.Configurable.Configurable.getFullJobOptName
def getFullJobOptName(self)
Definition: Configurable.py:736
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712

def GaudiKernel.Configurable.Configurable.getFullName | ( |  | self | ) |

Definition at line 733 of file Configurable.py.

733 def getFullName(self):
734 return str(self.getType() + '/' + self.getName())
735
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:733
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712

def GaudiKernel.Configurable.Configurable.getJobOptName | ( |  | self | ) |

Definition at line 721 of file Configurable.py.

721 def getJobOptName(self): # full hierachical name
722 return self.getName()
723
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:721
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715

def GaudiKernel.Configurable.Configurable.getName | ( |  | self | ) |

Definition at line 715 of file Configurable.py.

715 def getName(self):
716 return self._name
717
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:315
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715

def GaudiKernel.Configurable.Configurable.getParent | ( |  | self | ) |

Definition at line 480 of file Configurable.py.

480 def getParent(self):
481 return ""
482
GaudiKernel.Configurable.Configurable.getParent
def getParent(self)
Definition: Configurable.py:480

def GaudiKernel.Configurable.Configurable.getPrintTitle | ( |  | self | ) |

Definition at line 739 of file Configurable.py.

739 def getPrintTitle(self):
740 return self.getGaudiType() + ' ' + self.getTitleName()
741
GaudiKernel.Configurable.Configurable.getTitleName
def getTitleName(self)
Definition: Configurable.py:742
GaudiKernel.Configurable.Configurable.getPrintTitle
def getPrintTitle(self)
Definition: Configurable.py:739

def GaudiKernel.Configurable.Configurable.getProp | ( |  | self,
|  |  | name
| ) |  |

    Returns the value of the given property.

Definition at line 684 of file Configurable.py.

684 def getProp(self, name):
685 """Returns the value of the given property.
686 """
687 if hasattr(self, name):
688 return getattr(self, name)
689 else:
690 return self.getDefaultProperties()[name]
691
GaudiKernel.Configurable.Configurable.getProp
def getProp(self, name)
Definition: Configurable.py:684
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:647

def GaudiKernel.Configurable.Configurable.getProperties | ( |  | self | ) |

Definition at line 596 of file Configurable.py.

596 def getProperties(self):
597 props = {}
598 for name, proxy in self._properties.items():
599 try:
600 props[name] = proxy.__get__(self)
601 except AttributeError:
602 props[name] = Configurable.propertyNoValue
603
604 return props
605
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:596

def GaudiKernel.Configurable.Configurable.getPropertiesWithDescription | ( |  | self | ) |

    Get all properties with their description string as { name : (value, desc) }.

Definition at line 606 of file Configurable.py.

606 def getPropertiesWithDescription(self):
607 """Get all properties with their description string as { name : (value, desc) }."""
608 props = {}
609 for name, proxy in self._properties.items():
610 try:
611 props[name] = (proxy.__get__(self), proxy.__doc__)
612 except AttributeError:
613 props[name] = (Configurable.propertyNoValue, proxy.__doc__)
614 return props
615
GaudiKernel.Configurable.Configurable.getPropertiesWithDescription
def getPropertiesWithDescription(self)
Definition: Configurable.py:606

def GaudiKernel.Configurable.Configurable.getSequence | ( |  | self | ) |

Definition at line 558 of file Configurable.py.

558 def getSequence(self):
559 elems = []
560 for c in self.__children:
561 elems.append(c.getFullName())
562 return elems
563
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.getSequence
def getSequence(self)
Definition: Configurable.py:558

def GaudiKernel.Configurable.Configurable.getTitleName | ( |  | self | ) |

Definition at line 742 of file Configurable.py.

742 def getTitleName(self):
743 if log.isEnabledFor(logging.DEBUG):
744 return self.getFullJobOptName()
745 else:
746 return self.getFullName()
747
GaudiKernel.Configurable.Configurable.getTitleName
def getTitleName(self)
Definition: Configurable.py:742
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:733
GaudiKernel.Configurable.Configurable.getFullJobOptName
def getFullJobOptName(self)
Definition: Configurable.py:736

def GaudiKernel.Configurable.Configurable.getTools | ( |  | self | ) |

Definition at line 509 of file Configurable.py.

509 def getTools(self):
510 return self.__tools.values() # read only
511
GaudiKernel.Configurable.Configurable.getTools
def getTools(self)
Definition: Configurable.py:509

def GaudiKernel.Configurable.Configurable.getType | ( |  | cls | ) |

Definition at line 712 of file Configurable.py.

712 def getType(cls):
713 return cls.__name__
714
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:712

def GaudiKernel.Configurable.Configurable.getValuedProperties | ( |  | self | ) |

Definition at line 616 of file Configurable.py.

616 def getValuedProperties(self):
617 props = {}
618 for name, proxy in self._properties.items():
619 if self.isPropertySet(name):
620 value = proxy.__get__(self)
621 if hasattr(value, 'getFullName'):
622 value = value.getFullName()
623 elif type(value) in [list, tuple]:
624 new_value = []
625 for i in value:
626 if hasattr(i, 'getFullName'):
627 new_value.append(i.getFullName())
628 else:
629 new_value.append(i)
630 value = type(value)(new_value)
631 elif type(value) is dict:
632 new_value = {}
633 for i in value:
634 if hasattr(value[i], 'getFullName'):
635 new_value[i] = value[i].getFullName()
636 else:
637 new_value[i] = value[i]
638 value = new_value
639 props[name] = value
640
641 return props
642
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:733
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable.Configurable.isPropertySet
def isPropertySet(self, name)
Definition: Configurable.py:697
GaudiKernel.Configurable.Configurable.getValuedProperties
def getValuedProperties(self)
Definition: Configurable.py:616

def GaudiKernel.Configurable.Configurable.hasParent | ( |  | self,
|  |  | parent
| ) |  |

Definition at line 483 of file Configurable.py.

483 def hasParent(self, parent):
484 return False
485
GaudiKernel.Configurable.Configurable.hasParent
def hasParent(self, parent)
Definition: Configurable.py:483

def GaudiKernel.Configurable.Configurable.isPropertySet | ( |  | self,
|  |  | name
| ) |  |

    Tell if the property 'name' has been set or not.

    Because of a problem with list and dictionary properties, in those cases
    if the value is equal to the default, the property is considered as not
    set.

Definition at line 697 of file Configurable.py.

697 def isPropertySet(self, name):
698 """Tell if the property 'name' has been set or not.
699
700 Because of a problem with list and dictionary properties, in those cases
701 if the value is equal to the default, the property is considered as not
702 set.
703 """
704 if not hasattr(self, name):
705 return False
706 default = self.getDefaultProperty(name)
707 if isinstance(default, (list, dict, DataObjectHandleBase)):
708 value = getattr(self, name)
709 return value != default
710 return True
711
GaudiKernel.Configurable.Configurable.isPropertySet
def isPropertySet(self, name)
Definition: Configurable.py:697
GaudiKernel.Configurable.Configurable.getDefaultProperty
def getDefaultProperty(cls, name)
Definition: Configurable.py:663

def GaudiKernel.Configurable.Configurable.isPublic | ( |  | self | ) |

Definition at line 724 of file Configurable.py.

724 def isPublic(self):
725 return True
726
GaudiKernel.Configurable.Configurable.isPublic
def isPublic(self)
Definition: Configurable.py:724

def GaudiKernel.Configurable.Configurable.jobOptName | ( |  | self | ) |

Definition at line 728 of file Configurable.py.

728 def jobOptName(self):
729 log.error("jobOptName() is deprecated, use getJobOptName() instead for consistency%s",
730 error_explanation)
731 return self.getJobOptName() # compatibility
732
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:721
GaudiKernel.Configurable.Configurable.jobOptName
def jobOptName(self)
Definition: Configurable.py:728

def GaudiKernel.Configurable.Configurable.name | ( |  | self | ) |

Definition at line 718 of file Configurable.py.

718 def name(self):
719 return self.getName()
720
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:718
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715

def GaudiKernel.Configurable.Configurable.properties | ( |  | self | ) |

Definition at line 643 of file Configurable.py.

643 def properties(self):
644 return self.getProperties() # compatibility
645
GaudiKernel.Configurable.Configurable.properties
def properties(self)
Definition: Configurable.py:643
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:596

def GaudiKernel.Configurable.Configurable.remove | ( |  | self,
|  |  | items
| ) |  |

Definition at line 464 of file Configurable.py.

464 def remove(self, items):
465 if type(items) != list and type(items) != tuple:
466 items = [items]
467
468 self.__children = [e for e in self.__children if not e in items]
469
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.remove
def remove(self, items)
Definition: Configurable.py:464
gaudirun.type
type
Definition: gaudirun.py:133

def GaudiKernel.Configurable.Configurable.removeAll | ( |  | self | ) |

Definition at line 470 of file Configurable.py.

470 def removeAll(self):
471 self.remove(self.__children)
472
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:309
GaudiKernel.Configurable.Configurable.removeAll
def removeAll(self)
Definition: Configurable.py:470
GaudiKernel.Configurable.Configurable.remove
def remove(self, items)
Definition: Configurable.py:464

def GaudiKernel.Configurable.Configurable.setDefaults | ( |  | cls,
|  |  | handle
| ) |  |

Definition at line 748 of file Configurable.py.

748 def setDefaults(cls, handle):
749 pass
750
GaudiKernel.Configurable.Configurable.setDefaults
def setDefaults(cls, handle)
Definition: Configurable.py:748

def GaudiKernel.Configurable.Configurable.setParent | ( |  | self,
|  |  | parentName
| ) |  |

Definition at line 477 of file Configurable.py.

477 def setParent(self, parentName):
478 pass
479
GaudiKernel.Configurable.Configurable.setParent
def setParent(self, parentName)
Definition: Configurable.py:477

def GaudiKernel.Configurable.Configurable.setProp | ( |  | self,
|  |  | name,
|  |  | value
| ) |  |

    Set the value of a given property

Definition at line 692 of file Configurable.py.

692 def setProp(self, name, value):
693 """Set the value of a given property
694 """
695 return setattr(self, name, value)
696
GaudiKernel.Configurable.Configurable.setProp
def setProp(self, name, value)
Definition: Configurable.py:692

def GaudiKernel.Configurable.Configurable.setup | ( |  | self | ) |

Definition at line 564 of file Configurable.py.

564 def setup(self):
565 # make sure base class init has been called
566 if not hasattr(self, '_initok') or not self._initok:
567 # could check more, but this is the only explanation
568 raise TypeError, \
569 "Configurable.__init__ not called in %s override" % self.__class__.__name__
570
571 # log.debug("calling setup() on " + self.getFullJobOptName())
572
573 # setup self: this collects all values on the python side
574 self.__setupServices()
575 self.__setupDlls()
576 self.__setupDefaults()
577
578 # setup children
579 for c in self.getAllChildren():
580 c.setup()
581
582 # now get handle to work with for moving properties into the catalogue
583 handle = self.getHandle()
584 if not handle:
585 log.debug('no handle for %s: not transporting properties', self._name)
586 return # allowed, done early
587
588 # pass final set of properties on to handle on the C++ side or JobOptSvc
589 for name in self._properties.keys():
590 if hasattr(self, name): # means property has python-side value/default
591 setattr(handle, name, getattr(self, name))
592
593 # for debugging purposes
594 self._setupok = True
595
GaudiKernel.Configurable.Configurable.setup
def setup(self)
Definition: Configurable.py:564
GaudiKernel.Configurable.Configurable.__setupDefaults
def __setupDefaults(self)
Definition: Configurable.py:851
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:325
GaudiKernel.Configurable.Configurable.__setupDlls
def __setupDlls(self)
Definition: Configurable.py:839
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:315
GaudiKernel.Configurable.Configurable._setupok
_setupok
Definition: Configurable.py:328
GaudiKernel.Configurable.Configurable.__setupServices
def __setupServices(self)
Definition: Configurable.py:822
GaudiKernel.Configurable.Configurable.getAllChildren
def getAllChildren(self)
Definition: Configurable.py:519

def GaudiKernel.Configurable.Configurable.splitName | ( |  | self | ) |

Definition at line 782 of file Configurable.py.

782 def splitName(self):
783 fullname = self.getName()
784 dot = fullname.find('.')
785 if dot != -1:
786 parentname = fullname[:dot]
787 longname = fullname[dot + 1:]
788 else:
789 parentname = ''
790 longname = fullname
791 dot = longname.find('.')
792 if dot != -1:
793 name = longname[:dot]
794 else:
795 name = longname
796 return parentname, name, longname
797
GaudiKernel.Configurable.Configurable.splitName
def splitName(self)
Definition: Configurable.py:782
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:715

## Member Data Documentation

GaudiKernel.Configurable.Configurable.__children
| private

Definition at line 309 of file Configurable.py.

GaudiKernel.Configurable.Configurable.__metaclass__ = ConfigurableMeta.ConfigurableMeta
| static private

Definition at line 122 of file Configurable.py.

tuple GaudiKernel.Configurable.Configurable.__slots__
| static private

Initial value:
1 = (
2 '__children', # controlled components, e.g. private AlgTools
3 '__tools', # private AlgTools (#PM-->)
4 '_name', # the (unqualified) component name
5 '_inSetDefaults', # currently setting default values
6 '_initok', # used to enforce base class init
7 '_setupok' # for debugging purposes (temporary)
8 )

Definition at line 124 of file Configurable.py.

GaudiKernel.Configurable.Configurable.__tools
| private

Definition at line 310 of file Configurable.py.

bool GaudiKernel.Configurable.Configurable._configurationLocked = False
| static private

Definition at line 137 of file Configurable.py.

GaudiKernel.Configurable.Configurable._initok
| private

Definition at line 325 of file Configurable.py.

GaudiKernel.Configurable.Configurable._inSetDefaults
| private

Definition at line 322 of file Configurable.py.

GaudiKernel.Configurable.Configurable._name
| private

Definition at line 315 of file Configurable.py.

GaudiKernel.Configurable.Configurable._setupok
| private

Definition at line 328 of file Configurable.py.

dictionary GaudiKernel.Configurable.Configurable.allConfigurables = {}
| static

Definition at line 133 of file Configurable.py.

dictionary GaudiKernel.Configurable.Configurable.configurableServices = {}
| static

Definition at line 134 of file Configurable.py.

string GaudiKernel.Configurable.Configurable.indentUnit = '| '
| static

Definition at line 118 of file Configurable.py.

int GaudiKernel.Configurable.Configurable.printHeaderPre = 5
| static

Definition at line 120 of file Configurable.py.

int GaudiKernel.Configurable.Configurable.printHeaderWidth = 100
| static

Definition at line 119 of file Configurable.py.

GaudiKernel.Configurable.Configurable.propertyNoValue
| static

Definition at line 117 of file Configurable.py.

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

- GaudiKernel/python/GaudiKernel/Configurable.py