The Gaudi Framework  v36r13 (995e4364)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataHandle.py
Go to the documentation of this file.
1 
11 __doc__ = """The python module holding python bindings to DataHandle"""
12 
13 
14 class DataHandle(object):
15 
16  __slots__ = ("Path", "Mode", "Type", "IsCondition")
17 
18  __hash__ = None # Make class non-hashable for Python2 (default in Python3)
19 
20  def __init__(self, path, mode="R", _type="unknown_t", isCond=False):
21  object.__init__(self)
22  self.Path = path
23  self.Mode = mode
24  self.Type = _type
25  self.IsCondition = isCond
26 
27  def __getstate__(self):
28  return {s: getattr(self, s) for s in self.__slots__}
29 
30  def __setstate__(self, state):
31  for s in state:
32  setattr(self, s, state[s])
33 
34  def __eq__(self, other):
35  """
36  Need especially Configurable.isPropertySet when checked against default.
37  """
38  if isinstance(other, DataHandle):
39  return self.__getstate__() == other.__getstate__()
40  if isinstance(other, str):
41  return self.Path == other
42  if other is None:
43  return False
44  raise ValueError(
45  "Unknown equality check: type=%r, repr=%r" % (type(other), other)
46  )
47 
48  def __ne__(self, other):
49  """
50  This is mandatory if __eq__ is defined.
51  """
52  return not self == other
53 
54  def __str__(self):
55  return self.Path
56 
57  def __repr__(self):
58  args = "'%s','%s','%s'" % (self.Path, self.Mode, self.Type)
59  if self.IsCondition:
60  args += ",%s" % self.IsCondition
61  return "%s(%s)" % (self.__class__.__name__, args)
62 
63  def toStringProperty(self):
64  return self.__str__()
65 
66  def path(self):
67  return self.Path
68 
69  def mode(self):
70  return self.Mode
71 
72  def type(self):
73  return self.Type
74 
75  def isCondition(self):
76  return self.IsCondition
77 
78  def __opt_value__(self):
79  return repr(str(self))
GaudiKernel.DataHandle.DataHandle.__eq__
def __eq__(self, other)
Definition: DataHandle.py:34
GaudiKernel.DataHandle.DataHandle
Definition: DataHandle.py:14
GaudiKernel.DataHandle.DataHandle.__getstate__
def __getstate__(self)
Definition: DataHandle.py:27
GaudiKernel.DataHandle.DataHandle.mode
def mode(self)
Definition: DataHandle.py:69
GaudiKernel.DataHandle.DataHandle.Type
Type
Definition: DataHandle.py:24
GaudiKernel.DataHandle.DataHandle.__ne__
def __ne__(self, other)
Definition: DataHandle.py:48
GaudiKernel.DataHandle.DataHandle.isCondition
def isCondition(self)
Definition: DataHandle.py:75
GaudiKernel.DataHandle.DataHandle.__slots__
__slots__
Definition: DataHandle.py:16
GaudiKernel.DataHandle.DataHandle.Mode
Mode
Definition: DataHandle.py:23
GaudiKernel.DataHandle.DataHandle.path
def path(self)
Definition: DataHandle.py:66
GaudiKernel.DataHandle.DataHandle.__setstate__
def __setstate__(self, state)
Definition: DataHandle.py:30
GaudiKernel.DataHandle.DataHandle.__str__
def __str__(self)
Definition: DataHandle.py:54
GaudiKernel.DataHandle.DataHandle.type
def type(self)
Definition: DataHandle.py:72
GaudiKernel.DataHandle.DataHandle.toStringProperty
def toStringProperty(self)
Definition: DataHandle.py:63
GaudiKernel.DataHandle.DataHandle.__repr__
def __repr__(self)
Definition: DataHandle.py:57
GaudiKernel.DataHandle.DataHandle.Path
Path
Definition: DataHandle.py:22
GaudiKernel.DataHandle.DataHandle.__opt_value__
def __opt_value__(self)
Definition: DataHandle.py:78
GaudiKernel.DataHandle.DataHandle.IsCondition
IsCondition
Definition: DataHandle.py:25
GaudiKernel.DataHandle.DataHandle.__init__
def __init__(self, path, mode="R", _type="unknown_t", isCond=False)
Definition: DataHandle.py:20