Skip to content

Commit

Permalink
Fix 'callable' type descriptions (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Jul 12, 2021
1 parent 8679a11 commit 048be2e
Show file tree
Hide file tree
Showing 26 changed files with 37 additions and 34 deletions.
4 changes: 2 additions & 2 deletions docs/source/guide/examples/fizz_buzz_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def fizz_buzz(send, cancelled):
Parameters
----------
send : callable(object) -> None
send
Callable accepting the message to be sent, and returning nothing. The
message argument should be pickleable, and preferably immutable (or at
least, not intended to be mutated).
cancelled : callable
cancelled
Callable accepting no arguments and returning a boolean result. It
returns ``True`` if cancellation has been requested, and ``False``
otherwise.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/asyncio/event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable, called on the main thread (under a running
event loop) as a result of each ping sent. The return value of the
callable is ignored.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/asyncio/event_loop_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run_until(self, object, trait, condition, timeout):
Object whose trait we monitor.
trait : str
Name of the trait to monitor for changes.
condition : callable
condition
Single-argument callable, returning a boolean. This will be
called with *object* as the only input.
timeout : float
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/asyncio/pingee.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Pingee:
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable that's called on the main thread
every time a ping is received.
event_loop : asyncio.AbstractEventLoop
Expand Down
4 changes: 2 additions & 2 deletions traits_futures/background_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def background_task(self):
Returns
-------
collections.abc.Callable
CallTask
Callable accepting arguments ``send`` and ``cancelled``. The
callable can use ``send`` to send messages and ``cancelled`` to
check whether cancellation has been requested.
Expand All @@ -91,7 +91,7 @@ def submit_call(executor, callable, *args, **kwargs):
----------
executor : TraitsExecutor
Executor to submit the task to.
callable : collections.abc.Callable
callable
Callable to execute in the background.
*args
Positional arguments to pass to the callable.
Expand Down
4 changes: 2 additions & 2 deletions traits_futures/background_iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def background_task(self):
Returns
-------
collections.abc.Callable
task : IterationTask
Callable accepting arguments ``send`` and ``cancelled``. The
callable can use ``send`` to send messages and ``cancelled`` to
check whether cancellation has been requested.
Expand All @@ -119,7 +119,7 @@ def submit_iteration(executor, callable, *args, **kwargs):
----------
executor : TraitsExecutor
Executor to submit the task to.
callable : collections.abc.Callable
callable
Callable returning an iterator when called with the given arguments.
*args
Positional arguments to pass to the callable.
Expand Down
4 changes: 2 additions & 2 deletions traits_futures/background_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def background_task(self):
Returns
-------
collections.abc.Callable
task : ProgressTask
Callable accepting arguments ``send`` and ``cancelled``. The
callable can use ``send`` to send messages and ``cancelled`` to
check whether cancellation has been requested.
Expand All @@ -165,7 +165,7 @@ def submit_progress(executor, callable, *args, **kwargs):
----------
executor : TraitsExecutor
Executor to submit the task to.
callable : collections.abc.Callable
callable
Callable that executes the progress-providing function. This callable
must accept a "progress" named argument, in addition to the provided
arguments. The callable may then call the "progress" argument to
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/base_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def _executor_initialized(self, cancel):
Parameters
----------
cancel : callable
cancel
The callback to be called when the user requests cancellation.
The callback accepts no arguments, and has no return value.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/ets_event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable, called on the main thread (under a running
event loop) as a result of each ping sent. The return value of the
callable is ignored.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/i_event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable, called on the main thread (under a running
event loop) as a result of each ping sent. The return value of the
callable is ignored.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/i_event_loop_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_until(self, object, trait, condition, timeout):
Object whose trait we monitor.
trait : str
Name of the trait to monitor for changes.
condition : callable
condition
Single-argument callable, returning a boolean. This will be
called with *object* as the only input.
timeout : float
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/i_message_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def route_until(self, condition, timeout=None):
Parameters
----------
condition : callable
condition
Zero-argument callable returning a boolean. When this condition
becomes true, this method will stop routing messages. If the
condition is already true on entry, no messages will be routed.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/i_pingee.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IPingee(abc.ABC):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable that's called on the main thread
every time a ping is received.
"""
Expand Down
5 changes: 4 additions & 1 deletion traits_futures/i_task_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def background_task(self):
Returns
-------
task : callable
task : object
Callable accepting arguments ``send`` and ``cancelled``. The
callable can use ``send`` to send messages and ``cancelled`` to
check whether cancellation has been requested.
"""

@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/multiprocessing_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def route_until(self, condition, timeout=None):
Parameters
----------
condition : callable
condition
Zero-argument callable returning a boolean. When this condition
becomes true, this method will stop routing messages. If the
condition is already true on entry, no messages will be routed.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/multithreading_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def route_until(self, condition, timeout=None):
Parameters
----------
condition : callable
condition
Zero-argument callable returning a boolean. When this condition
becomes true, this method will stop routing messages. If the
condition is already true on entry, no messages will be routed.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/qt/event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable, called on the main thread (under a running
event loop) as a result of each ping sent. The return value of the
callable is ignored.
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/qt/event_loop_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def run_until(self, object, trait, condition, timeout):
Object whose trait we monitor.
trait : str
Name of the trait to monitor for changes.
condition : callable
condition
Single-argument callable, returning a boolean. This will be
called with *object* as the only input.
timeout : float
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/qt/pingee.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Pingee(QObject):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable that's called on the main thread
every time a ping is received.
"""
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/testing/test_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def run_until(self, object, trait, condition, timeout=SAFETY_TIMEOUT):
Object whose trait we monitor.
trait : str
Name of the trait to monitor for changes.
condition : callable
condition
Single-argument callable, returning a boolean. This will be
called with *object* as the only input.
timeout : float, optional
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/tests/i_pingee_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def connected_pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Callback to execute whenever a ping is received.
"""
pingee = self._event_loop.pingee(on_ping=on_ping)
Expand Down
6 changes: 3 additions & 3 deletions traits_futures/traits_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def submit_call(self, callable, *args, **kwargs):
Parameters
----------
callable : an arbitrary callable
callable
Function to execute in the background.
*args
Positional arguments to pass to that function.
Expand Down Expand Up @@ -222,7 +222,7 @@ def submit_iteration(self, callable, *args, **kwargs):
Parameters
----------
callable : an arbitrary callable
callable
Function executed in the background to provide the iterable.
*args
Positional arguments to pass to that function.
Expand Down Expand Up @@ -251,7 +251,7 @@ def submit_progress(self, callable, *args, **kwargs):
Parameters
----------
callable : callable accepting a "progress" named argument
callable
Function executed in the background to provide the iterable. This
should accept a "progress" named argument. The callable can then
call the "progress" object to report progress.
Expand Down
4 changes: 2 additions & 2 deletions traits_futures/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class BackgroundTaskWrapper:
Parameters
----------
background_task : collections.abc.Callable
background_task
Callable representing the background task. This will be called
with arguments ``send`` and ``cancelled``.
sender : IMessageSender
Object used to send messages.
cancelled : collections.abc.Callable
cancelled
Zero-argument callable returning bool. This can be called to check
whether cancellation has been requested.
"""
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/wx/event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def pingee(self, on_ping):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable, called on the main thread (under a running
event loop) as a result of each ping sent. The return value of the
callable is ignored.
Expand Down
4 changes: 2 additions & 2 deletions traits_futures/wx/event_loop_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TimeoutTimer(wx.Timer):
----------
timeout : float
Timeout in seconds.
callback : callable
callback
Callable taking no arguments, to be executed when the timer
times out.
args : tuple, optional
Expand Down Expand Up @@ -195,7 +195,7 @@ def run_until(self, object, trait, condition, timeout):
Object whose trait we monitor.
trait : str
Name of the trait to monitor for changes.
condition : callable
condition
Single-argument callable, returning a boolean. This will be
called with *object* as the only input.
timeout : float
Expand Down
2 changes: 1 addition & 1 deletion traits_futures/wx/pingee.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Pingee(wx.EvtHandler):
Parameters
----------
on_ping : callable
on_ping
Zero-argument callable that's called on the main thread
every time a ping is received.
"""
Expand Down

0 comments on commit 048be2e

Please sign in to comment.