From a1650f95189fa926bb1c2d1d1872b536354c3fbb Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 5 Nov 2017 15:53:28 +0000 Subject: [PATCH] Backport PR #9687: Fix callbackregistry docstring. --- lib/matplotlib/cbook/__init__.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 0fc3052f783f..94db12478fe8 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -255,8 +255,7 @@ def _exception_printer(exc): class CallbackRegistry(object): - """Handle registering and disconnecting for a set of signals and - callbacks: + """Handle registering and disconnecting for a set of signals and callbacks: >>> def oneat(x): ... print('eat', x) @@ -332,9 +331,7 @@ def __setstate__(self, state): self.__init__(**state) def connect(self, s, func): - """ - register *func* to be called when a signal *s* is generated - func will be called + """Register *func* to be called when signal *s* is generated. """ self._func_cid_map.setdefault(s, WeakKeyDictionary()) # Note proxy not needed in python 3. @@ -363,8 +360,7 @@ def _remove_proxy(self, proxy): del self._func_cid_map[signal] def disconnect(self, cid): - """ - disconnect the callback registered with callback id *cid* + """Disconnect the callback registered with callback id *cid*. """ for eventname, callbackd in list(six.iteritems(self.callbacks)): try: @@ -381,8 +377,10 @@ def disconnect(self, cid): def process(self, s, *args, **kwargs): """ - process signal `s`. All of the functions registered to receive - callbacks on `s` will be called with ``**args`` and ``**kwargs`` + Process signal *s*. + + All of the functions registered to receive callbacks on *s* will be + called with ``*args`` and ``**kwargs``. """ if s in self.callbacks: for cid, proxy in list(six.iteritems(self.callbacks[s])):