From 1c2687ea505ac259a38ba3102b49c0154eb9072b 2023-10-24 15:04:58 From: Matthias Bussonnier Date: 2023-10-24 15:04:58 Subject: [PATCH] Attempt to remove backcall. This was meant to allow this API to evolve, but I have the impression was not use much. This will reduce our dependencies and reliance on older packages. --- diff --git a/IPython/core/events.py b/IPython/core/events.py index 3a66e75..a4c818b 100644 --- a/IPython/core/events.py +++ b/IPython/core/events.py @@ -13,8 +13,6 @@ events and the arguments which will be passed to them. This API is experimental in IPython 2.0, and may be revised in future versions. """ -from backcall import callback_prototype - class EventManager(object): """Manage a collection of events and a sequence of callbacks for each. @@ -63,23 +61,14 @@ class EventManager(object): """ if not callable(function): raise TypeError('Need a callable, got %r' % function) - callback_proto = available_events.get(event) if function not in self.callbacks[event]: - self.callbacks[event].append(callback_proto.adapt(function)) + self.callbacks[event].append(function) def unregister(self, event, function): """Remove a callback from the given event.""" if function in self.callbacks[event]: return self.callbacks[event].remove(function) - # Remove callback in case ``function`` was adapted by `backcall`. - for callback in self.callbacks[event]: - try: - if callback.__wrapped__ is function: - return self.callbacks[event].remove(callback) - except AttributeError: - pass - raise ValueError('Function {!r} is not registered as a {} callback'.format(function, event)) def trigger(self, event, *args, **kwargs): diff --git a/setup.cfg b/setup.cfg index 047c015..1f558f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,6 @@ python_requires = >=3.9 zip_safe = False install_requires = appnope; sys_platform == "darwin" - backcall colorama; sys_platform == "win32" decorator exceptiongroup; python_version<'3.11'