22
33
44====================
5- Coroutines and Tasks
5+ Coroutines and tasks
66====================
77
88This section outlines high-level asyncio APIs to work with coroutines
@@ -231,7 +231,7 @@ A good example of a low-level function that returns a Future object
231231is :meth: `loop.run_in_executor `.
232232
233233
234- Creating Tasks
234+ Creating tasks
235235==============
236236
237237**Source code: ** :source: `Lib/asyncio/tasks.py `
@@ -291,7 +291,7 @@ Creating Tasks
291291 Added the *context * parameter.
292292
293293
294- Task Cancellation
294+ Task cancellation
295295=================
296296
297297Tasks can easily and safely be cancelled.
@@ -315,7 +315,7 @@ remove the cancellation state.
315315
316316.. _taskgroups :
317317
318- Task Groups
318+ Task groups
319319===========
320320
321321Task groups combine a task creation API with a convenient
@@ -414,7 +414,7 @@ reported by :meth:`asyncio.Task.cancelling`.
414414 Improved handling of simultaneous internal and external cancellations
415415 and correct preservation of cancellation counts.
416416
417- Terminating a Task Group
417+ Terminating a task group
418418------------------------
419419
420420While terminating a task group is not natively supported by the standard
@@ -485,13 +485,13 @@ Sleeping
485485 for 5 seconds::
486486
487487 import asyncio
488- import datetime
488+ import datetime as dt
489489
490490 async def display_date():
491491 loop = asyncio.get_running_loop()
492492 end_time = loop.time() + 5.0
493493 while True:
494- print(datetime .datetime.now())
494+ print(dt .datetime.now())
495495 if (loop.time() + 1.0) >= end_time:
496496 break
497497 await asyncio.sleep(1)
@@ -506,7 +506,7 @@ Sleeping
506506 Raises :exc: `ValueError ` if *delay * is :data: `~math.nan `.
507507
508508
509- Running Tasks Concurrently
509+ Running tasks concurrently
510510==========================
511511
512512.. awaitablefunction :: gather(*aws, return_exceptions=False)
@@ -608,7 +608,7 @@ Running Tasks Concurrently
608608
609609.. _eager-task-factory :
610610
611- Eager Task Factory
611+ Eager task factory
612612==================
613613
614614.. function :: eager_task_factory(loop, coro, *, name=None, context=None)
@@ -651,7 +651,7 @@ Eager Task Factory
651651 .. versionadded :: 3.12
652652
653653
654- Shielding From Cancellation
654+ Shielding from cancellation
655655===========================
656656
657657.. awaitablefunction :: shield(aw)
@@ -881,7 +881,7 @@ Timeouts
881881 Raises :exc: `TimeoutError ` instead of :exc: `asyncio.TimeoutError `.
882882
883883
884- Waiting Primitives
884+ Waiting primitives
885885==================
886886
887887.. function :: wait(aws, *, timeout=None, return_when=ALL_COMPLETED)
@@ -1001,7 +1001,7 @@ Waiting Primitives
10011001 or as a plain :term: `iterator ` (previously it was only a plain iterator).
10021002
10031003
1004- Running in Threads
1004+ Running in threads
10051005==================
10061006
10071007.. function :: to_thread(func, /, *args, **kwargs)
@@ -1061,7 +1061,7 @@ Running in Threads
10611061 .. versionadded :: 3.9
10621062
10631063
1064- Scheduling From Other Threads
1064+ Scheduling from other threads
10651065=============================
10661066
10671067.. function :: run_coroutine_threadsafe(coro, loop)
@@ -1140,7 +1140,7 @@ Introspection
11401140
11411141.. _asyncio-task-obj :
11421142
1143- Task Object
1143+ Task object
11441144===========
11451145
11461146.. class :: Task(coro, *, loop=None, name=None, context=None, eager_start=False)
0 commit comments