MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _collection_gced

Function _collection_gced

lib/sqlalchemy/event/registry.py:104–118  ·  view source on GitHub ↗
(ref: weakref.ref[Any])

Source from the content-addressed store, hash-verified

102
103
104def _collection_gced(ref: weakref.ref[Any]) -> None:
105 # defaultdict, so can't get a KeyError
106 if not _collection_to_key or ref not in _collection_to_key:
107 return
108
109 ref = cast("weakref.ref[RefCollection[EventTarget]]", ref)
110
111 listener_to_key = _collection_to_key.pop(ref)
112 for key in listener_to_key.values():
113 if key in _key_to_collection:
114 # defaultdict, so can't get a KeyError
115 dispatch_reg = _key_to_collection[key]
116 dispatch_reg.pop(ref)
117 if not dispatch_reg:
118 _key_to_collection.pop(key)
119
120
121def _stored_in_collection(

Callers

nothing calls this directly

Calls 3

castFunction · 0.50
popMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected