MCPcopy Index your code
hub / github.com/python/cpython / UID

Class UID

Lib/plistlib.py:80–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78_MIN_READ_BUF_SIZE = 1 << 20
79
80class UID:
81 def __init__(self, data):
82 if not isinstance(data, int):
83 raise TypeError("data must be an int")
84 if data >= 1 << 64:
85 raise ValueError("UIDs cannot be >= 2**64")
86 if data < 0:
87 raise ValueError("UIDs must be positive")
88 self.data = data
89
90 def __index__(self):
91 return self.data
92
93 def __repr__(self):
94 return "%s(%s)" % (self.__class__.__name__, repr(self.data))
95
96 def __reduce__(self):
97 return self.__class__, (self.data,)
98
99 def __eq__(self, other):
100 if not isinstance(other, UID):
101 return NotImplemented
102 return self.data == other.data
103
104 def __hash__(self):
105 return hash(self.data)
106
107#
108# XML support

Callers 13

test_invalid_uidMethod · 0.90
test_uidMethod · 0.90
test_uid_dataMethod · 0.90
test_uid_eqMethod · 0.90
test_uid_hashMethod · 0.90
test_uid_reprMethod · 0.90
test_uid_indexMethod · 0.90
test_uid_pickleMethod · 0.90
test_uid_copyMethod · 0.90

Calls

no outgoing calls

Tested by 12

test_invalid_uidMethod · 0.72
test_uidMethod · 0.72
test_uid_dataMethod · 0.72
test_uid_eqMethod · 0.72
test_uid_hashMethod · 0.72
test_uid_reprMethod · 0.72
test_uid_indexMethod · 0.72
test_uid_pickleMethod · 0.72
test_uid_copyMethod · 0.72