| 20 | |
| 21 | |
| 22 | class 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 | |
| 38 | class WeakIdentityKeyDictionary(MutableMapping): |
no outgoing calls
no test coverage detected