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