MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / remove

Method remove

lib/sqlalchemy/event/registry.py:317–332  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

315 self.dispatch_target.dispatch._listen(self, *args, **kw)
316
317 def remove(self) -> None:
318 key = self._key
319
320 if key not in _key_to_collection:
321 raise exc.InvalidRequestError(
322 "No listeners found for event %s / %r / %s "
323 % (self.target, self.identifier, self.fn)
324 )
325
326 dispatch_reg = _key_to_collection.pop(key)
327
328 for collection_ref, listener_ref in dispatch_reg.items():
329 collection = collection_ref()
330 listener_fn = listener_ref()
331 if collection is not None and listener_fn is not None:
332 collection.remove(self.with_wrapper(listener_fn))
333
334 def contains(self) -> bool:
335 """Return True if this event key is registered to listen."""

Callers 4

removeFunction · 0.45
_remove_dispatcherFunction · 0.45
_removeMethod · 0.45
remove_from_listMethod · 0.45

Calls 3

with_wrapperMethod · 0.95
popMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected