Skip to content

Commit a92bcdb

Browse files
authored
Fix argument name discrepancies in asyncio tasks documentation
1 parent 3b359ff commit a92bcdb

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

@@ -928,19 +928,19 @@ Waiting primitives
928928
Removed the *loop* parameter.
929929

930930
.. versionchanged:: 3.11
931-
Passing coroutine objects to ``wait()`` directly is forbidden.
931+
Forbade passing coroutine objects to ``wait()`` directly.
932932

933933
.. versionchanged:: 3.12
934934
Added support for generators yielding tasks.
935935

936936

937-
.. function:: as_completed(aws, *, timeout=None)
937+
.. function:: as_completed(fs, *, timeout=None)
938938

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

943-
The object returned by ``as_completed()`` can be iterated as an
943+
The object returned by ``as_completed()`` can be iterated over as an
944944
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
945945
iteration is used, the originally-supplied awaitables are yielded if they
946946
are tasks or futures. This makes it easy to correlate previously-scheduled
@@ -985,7 +985,7 @@ Waiting primitives
985985
Removed the *loop* parameter.
986986

987987
.. deprecated:: 3.10
988-
Deprecation warning is emitted if not all awaitable objects in the *aws*
988+
Deprecation warning is emitted if not all awaitable objects in the *fs*
989989
iterable are Future-like objects and there is no running event loop.
990990

991991
.. versionchanged:: 3.12
@@ -1011,7 +1011,7 @@ Running in threads
10111011

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

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

@@ -1061,13 +1061,13 @@ Scheduling from other threads
10611061

10621062
.. function:: run_coroutine_threadsafe(coro, loop)
10631063

1064-
Submit a coroutine to the given event loop. Thread-safe.
1064+
Submit a coroutine to the given event loop. Thread-safe.
10651065

10661066
Return a :class:`concurrent.futures.Future` to wait for the result
10671067
from another OS thread.
10681068

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

10721072
def in_thread(loop: asyncio.AbstractEventLoop) -> None:
10731073
# Run some blocking IO
@@ -1089,7 +1089,7 @@ Scheduling from other threads
10891089
# Run something in a thread
10901090
await asyncio.to_thread(in_thread, loop)
10911091

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

10941094
@contextlib.contextmanager
10951095
def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:
@@ -1140,7 +1140,7 @@ Scheduling from other threads
11401140
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
11411141
section of the documentation.
11421142

1143-
Unlike other asyncio functions this function requires the *loop*
1143+
Unlike other asyncio functions, this function requires the *loop*
11441144
argument to be passed explicitly.
11451145

11461146
.. versionadded:: 3.5.1
@@ -1225,10 +1225,10 @@ Task object
12251225

12261226
An optional keyword-only *eager_start* argument allows eagerly starting
12271227
the execution of the :class:`asyncio.Task` at task creation time.
1228-
If set to ``True`` and the event loop is running, the task will start
1228+
If set to ``True`` with the event loop running, the task will start
12291229
executing the coroutine immediately, until the first time the coroutine
12301230
blocks. If the coroutine returns or raises without blocking, the task
1231-
will be finished eagerly and will skip scheduling to the event loop.
1231+
will be finished eagerly and the event loop scheduling step is skipped.
12321232

12331233
.. versionchanged:: 3.7
12341234
Added support for the :mod:`contextvars` module.
@@ -1359,8 +1359,7 @@ Task object
13591359
Return the name of the Task.
13601360

13611361
If no name has been explicitly assigned to the Task, the default
1362-
asyncio Task implementation generates a default name during
1363-
instantiation.
1362+
implementation generates a default name during instantiation.
13641363

13651364
.. versionadded:: 3.8
13661365

@@ -1514,6 +1513,6 @@ Task object
15141513
cancellation requests go down to zero.
15151514

15161515
This method is used by asyncio's internals and isn't expected to be
1517-
used by end-user code. See :meth:`uncancel` for more details.
1516+
used by end-user code. See :meth:`uncancel` for more details.
15181517

15191518
.. versionadded:: 3.11

0 commit comments

Comments
 (0)