Skip to content

Commit

Permalink
Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Selivanov committed Oct 15, 2018
1 parent 67efe1b commit 89b2baa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/gevent/greenlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,37 +522,38 @@ def start_later(self, seconds):
self._start_event.start(self.switch)

@staticmethod
def add_spawn_callback(cb):
def add_spawn_callback(callback):
"""
add_spawn_callback(callback) -> None
Set up a *callback* to be invoked when :class:`Greenlet` objects
are started.
The invocation order of spawn callbacks is unspecified. Adding one
callback more than one time will not cause it to be called more
The invocation order of spawn callbacks is unspecified. Adding the
same callback more than one time will not cause it to be called more
than once.
.. versionadded:: 1.3.8
"""
global _spawn_callbacks
if _spawn_callbacks is None:
_spawn_callbacks = set()
_spawn_callbacks.add(cb)
_spawn_callbacks.add(callback)

@staticmethod
def remove_spawn_callback(cb):
def remove_spawn_callback(callback):
"""
remove_spawn_callback(callback) -> None
Remove *callback* function added with :meth:`Greenlet.add_spawn_callback`.
This function will not fail if *callback* has been already removed.
This function will not fail if *callback* has been already removed or
if *callback* was never added.
.. versionadded:: 1.3.8
"""
global _spawn_callbacks
if _spawn_callbacks is not None:
_spawn_callbacks.discard(cb)
_spawn_callbacks.discard(callback)
if not _spawn_callbacks:
_spawn_callbacks = None

Expand Down

0 comments on commit 89b2baa

Please sign in to comment.