Skip to content

Commit

Permalink
Document 'positional-only' arguments (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Jul 13, 2021
1 parent c31916b commit 4d4912f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
10 changes: 7 additions & 3 deletions traits_futures/background_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@ def background_task(self):

def submit_call(executor, callable, *args, **kwargs):
"""
Convenience function to submit a background call to an executor.
Submit a simple call to an executor.
Parameters
----------
executor : TraitsExecutor
Executor to submit the task to.
Executor to submit the task to. This argument should always be passed
by position rather than by name. Future versions of the library may
enforce this restriction.
callable
Callable to execute in the background.
Callable to execute in the background. This argument should always be
passed by position rather than by name. Future versions of the library
may enforce this restriction.
*args
Positional arguments to pass to the callable.
**kwargs
Expand Down
8 changes: 6 additions & 2 deletions traits_futures/background_iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,18 @@ def background_task(self):

def submit_iteration(executor, callable, *args, **kwargs):
"""
Convenience function to submit a background iteration to an executor.
Submit an iteration to an executor.
Parameters
----------
executor : TraitsExecutor
Executor to submit the task to.
Executor to submit the task to. This argument should always be
passed by position rather than by name. Future versions of the library
may enforce this restriction.
callable
Callable returning an iterator when called with the given arguments.
This argument should always be passed by position rather than by name.
Future versions of the library may enforce this restriction.
*args
Positional arguments to pass to the callable.
**kwargs
Expand Down
11 changes: 7 additions & 4 deletions traits_futures/background_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,20 @@ def background_task(self):

def submit_progress(executor, callable, *args, **kwargs):
"""
Convenience function to submit a background progress call.
Submit a progress-reporting task to an executor.
Parameters
----------
executor : TraitsExecutor
Executor to submit the task to.
Executor to submit the task to. This argument should always be passed
by position rather than by name. Future versions of the library may
enforce this restriction.
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
report progress.
arguments. The callable may then call the "progress" argument to report
progress. This argument should always be passed by position rather than
by name. Future versions of the library may enforce this restriction.
*args
Positional arguments to pass to the callable.
**kwargs
Expand Down

0 comments on commit 4d4912f

Please sign in to comment.