MCPcopy Create free account
hub / github.com/apache/fory / IdentityWeakRef

Class IdentityWeakRef

python/pyfory/lib/collection.py:22–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class IdentityWeakRef(ref):
23 __slots__ = "object_id"
24
25 def __init__(self, obj, callback=None):
26 super(IdentityWeakRef, self).__init__(obj, callback)
27 self.object_id = id(obj)
28
29 def __hash__(self):
30 return self.object_id
31
32 def __eq__(self, other):
33 if type(other) is not IdentityWeakRef:
34 return False
35 return self.object_id == other.object_id
36
37
38class WeakIdentityKeyDictionary(MutableMapping):

Callers 10

removeMethod · 0.85
__delitem__Method · 0.85
__getitem__Method · 0.85
__setitem__Method · 0.85
getMethod · 0.85
__contains__Method · 0.85
popMethod · 0.85
setdefaultMethod · 0.85
updateMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected