##// END OF EJS Templates
Attempt to remove backcall....
Matthias Bussonnier -
Show More
@@ -13,8 +13,6 b' events and the arguments which will be passed to them.'
13 13 This API is experimental in IPython 2.0, and may be revised in future versions.
14 14 """
15 15
16 from backcall import callback_prototype
17
18 16
19 17 class EventManager(object):
20 18 """Manage a collection of events and a sequence of callbacks for each.
@@ -63,23 +61,14 b' class EventManager(object):'
63 61 """
64 62 if not callable(function):
65 63 raise TypeError('Need a callable, got %r' % function)
66 callback_proto = available_events.get(event)
67 64 if function not in self.callbacks[event]:
68 self.callbacks[event].append(callback_proto.adapt(function))
65 self.callbacks[event].append(function)
69 66
70 67 def unregister(self, event, function):
71 68 """Remove a callback from the given event."""
72 69 if function in self.callbacks[event]:
73 70 return self.callbacks[event].remove(function)
74 71
75 # Remove callback in case ``function`` was adapted by `backcall`.
76 for callback in self.callbacks[event]:
77 try:
78 if callback.__wrapped__ is function:
79 return self.callbacks[event].remove(callback)
80 except AttributeError:
81 pass
82
83 72 raise ValueError('Function {!r} is not registered as a {} callback'.format(function, event))
84 73
85 74 def trigger(self, event, *args, **kwargs):
@@ -30,7 +30,6 b' python_requires = >=3.9'
30 30 zip_safe = False
31 31 install_requires =
32 32 appnope; sys_platform == "darwin"
33 backcall
34 33 colorama; sys_platform == "win32"
35 34 decorator
36 35 exceptiongroup; python_version<'3.11'
General Comments 0
You need to be logged in to leave comments. Login now