Skip to content

Commit

Permalink
Backport PR #9687: Fix callbackregistry docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby authored and MeeseeksDev[bot] committed Nov 5, 2017
1 parent 44b8d41 commit a1650f9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/matplotlib/cbook/__init__.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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])):
Expand Down

0 comments on commit a1650f9

Please sign in to comment.