MCPcopy Create free account
hub / github.com/ipython/ipython / unregister

Method unregister

IPython/core/events.py:65–78  ·  view source on GitHub ↗

Remove a callback from the given event.

(self, event, function)

Source from the content-addressed store, hash-verified

63 self.callbacks[event].append(callback_proto.adapt(function))
64
65 def unregister(self, event, function):
66 """Remove a callback from the given event."""
67 if function in self.callbacks[event]:
68 return self.callbacks[event].remove(function)
69
70 # Remove callback in case ``function`` was adapted by `backcall`.
71 for callback in self.callbacks[event]:
72 try:
73 if callback.__wrapped__ is function:
74 return self.callbacks[event].remove(callback)
75 except AttributeError:
76 pass
77
78 raise ValueError('Function {!r} is not registered as a {} callback'.format(function, event))
79
80 def trigger(self, event, *args, **kwargs):
81 """Call callbacks for ``event``.

Calls 2

removeMethod · 0.45
formatMethod · 0.45

Tested by 6

func1Method · 0.64
func2Method · 0.64
test_silent_postexecMethod · 0.64