Skip to content

Commit a0896d5

Browse files
committed
Fix argument name discrepancies in asyncio tasks documentation
1 parent 0376015 commit a0896d5

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

Doc/library/asyncio-task.rst

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ Eager task factory
649649
Shielding from cancellation
650650
===========================
651651

652-
.. awaitablefunction:: shield(aw)
652+
.. awaitablefunction:: shield(arg)
653653

654654
Protect an :ref:`awaitable object <asyncio-awaitables>`
655655
from being :meth:`cancelled <Task.cancel>`.
@@ -686,7 +686,7 @@ Shielding from cancellation
686686

687687
.. important::
688688

689-
Save a reference to tasks passed to this function, to avoid
689+
Save a reference to tasks passed to this function to avoid
690690
a task disappearing mid-execution. The event loop only keeps
691691
weak references to tasks. A task that isn't referenced elsewhere
692692
may get garbage collected at any time, even before it's done.
@@ -708,10 +708,10 @@ Timeouts
708708
that can be used to limit the amount of time spent waiting on
709709
something.
710710

711-
*delay* can either be ``None``, or a float/int number of
712-
seconds to wait. If *delay* is ``None``, no time limit will
713-
be applied; this can be useful if the delay is unknown when
714-
the context manager is created.
711+
*delay* can either be ``None``, or a float/int representing
712+
the number of seconds to wait. If *delay* is ``None``, no time
713+
limit will be applied; this can be useful if the delay is
714+
unknown when the context manager is created.
715715

716716
In either case, the context manager can be rescheduled after
717717
creation using :meth:`Timeout.reschedule`.
@@ -826,9 +826,9 @@ Timeouts
826826

827827
If *aw* is a coroutine it is automatically scheduled as a Task.
828828

829-
*timeout* can either be ``None`` or a float or int number of seconds
830-
to wait for. If *timeout* is ``None``, block until the future
831-
completes.
829+
*timeout* can either be ``None`` or a float or int representing
830+
the number of seconds to wait for. If *timeout* is ``None``,
831+
block until the future completes.
832832

833833
If a timeout occurs, it cancels the task and raises
834834
:exc:`TimeoutError`.
@@ -879,14 +879,14 @@ Timeouts
879879
Waiting primitives
880880
==================
881881

882-
.. function:: wait(aws, *, timeout=None, return_when=ALL_COMPLETED)
882+
.. function:: wait(fs, *, timeout=None, return_when=ALL_COMPLETED)
883883
:async:
884884

885-
Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the *aws*
885+
Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the *fs*
886886
iterable concurrently and block until the condition specified
887-
by *return_when*.
887+
by *return_when* is satisfied.
888888

889-
The *aws* iterable must not be empty.
889+
The *fs* iterable must not be empty.
890890

891891
Returns two sets of Tasks/Futures: ``(done, pending)``.
892892

@@ -931,19 +931,19 @@ Waiting primitives
931931
Removed the *loop* parameter.
932932

933933
.. versionchanged:: 3.11
934-
Passing coroutine objects to ``wait()`` directly is forbidden.
934+
Forbade passing coroutine objects to ``wait()`` directly.
935935

936936
.. versionchanged:: 3.12
937937
Added support for generators yielding tasks.
938938

939939

940-
.. function:: as_completed(aws, *, timeout=None)
940+
.. function:: as_completed(fs, *, timeout=None)
941941

942-
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable
942+
Run :ref:`awaitable objects <asyncio-awaitables>` in the *fs* iterable
943943
concurrently. The returned object can be iterated to obtain the results
944944
of the awaitables as they finish.
945945

946-
The object returned by ``as_completed()`` can be iterated as an
946+
The object returned by ``as_completed()`` can be iterated over as an
947947
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
948948
iteration is used, the originally-supplied awaitables are yielded if they
949949
are tasks or futures. This makes it easy to correlate previously-scheduled
@@ -992,7 +992,7 @@ Waiting primitives
992992
Removed the *loop* parameter.
993993

994994
.. deprecated:: 3.10
995-
Deprecation warning is emitted if not all awaitable objects in the *aws*
995+
Deprecation warning is emitted if not all awaitable objects in the *fs*
996996
iterable are Future-like objects and there is no running event loop.
997997

998998
.. versionchanged:: 3.12
@@ -1018,7 +1018,7 @@ Running in threads
10181018

10191019
Return a coroutine that can be awaited to get the eventual result of *func*.
10201020

1021-
This coroutine function is primarily intended to be used for executing
1021+
This coroutine function is primarily intended to be used to execute
10221022
IO-bound functions/methods that would otherwise block the event loop if
10231023
they were run in the main thread. For example::
10241024

@@ -1068,13 +1068,13 @@ Scheduling from other threads
10681068

10691069
.. function:: run_coroutine_threadsafe(coro, loop)
10701070

1071-
Submit a coroutine to the given event loop. Thread-safe.
1071+
Submit a coroutine to the given event loop. Thread-safe.
10721072

10731073
Return a :class:`concurrent.futures.Future` to wait for the result
10741074
from another OS thread.
10751075

10761076
This function is meant to be called from a different OS thread
1077-
than the one where the event loop is running. Example::
1077+
than the one where the event loop is running. Example::
10781078

10791079
def in_thread(loop: asyncio.AbstractEventLoop) -> None:
10801080
# Run some blocking IO
@@ -1096,7 +1096,7 @@ Scheduling from other threads
10961096
# Run something in a thread
10971097
await asyncio.to_thread(in_thread, loop)
10981098

1099-
It's also possible to run the other way around. Example::
1099+
It's also possible to run the other way around. Example::
11001100

11011101
@contextlib.contextmanager
11021102
def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:
@@ -1147,7 +1147,7 @@ Scheduling from other threads
11471147
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
11481148
section of the documentation.
11491149

1150-
Unlike other asyncio functions this function requires the *loop*
1150+
Unlike other asyncio functions, this function requires the *loop*
11511151
argument to be passed explicitly.
11521152

11531153
.. versionadded:: 3.5.1
@@ -1232,10 +1232,10 @@ Task object
12321232

12331233
An optional keyword-only *eager_start* argument allows eagerly starting
12341234
the execution of the :class:`asyncio.Task` at task creation time.
1235-
If set to ``True`` and the event loop is running, the task will start
1235+
If set to ``True`` with the event loop running, the task will start
12361236
executing the coroutine immediately, until the first time the coroutine
12371237
blocks. If the coroutine returns or raises without blocking, the task
1238-
will be finished eagerly and will skip scheduling to the event loop.
1238+
will be finished eagerly and the event loop scheduling step is skipped.
12391239

12401240
Tasks are :ref:`generic <generics>` over the return type of their wrapped
12411241
coroutines.
@@ -1369,8 +1369,7 @@ Task object
13691369
Return the name of the Task.
13701370

13711371
If no name has been explicitly assigned to the Task, the default
1372-
asyncio Task implementation generates a default name during
1373-
instantiation.
1372+
implementation generates a default name during instantiation.
13741373

13751374
.. versionadded:: 3.8
13761375

@@ -1524,6 +1523,6 @@ Task object
15241523
cancellation requests go down to zero.
15251524

15261525
This method is used by asyncio's internals and isn't expected to be
1527-
used by end-user code. See :meth:`uncancel` for more details.
1526+
used by end-user code. See :meth:`uncancel` for more details.
15281527

15291528
.. versionadded:: 3.11

0 commit comments

Comments
 (0)