New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix callbackregistry docstring. #9687
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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*. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'm not sure what |
||
|
||
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])): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious to me what the signal
s
is here, or even what type it should haveThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can indeed be anything (hashable):