/snap/core24/1643/usr/lib/python3.12/asyncio/__pycache__
Edit: /snap/core24/1643/usr/lib/python3.12/asyncio/__pycache__/taskgroups.cpython-312.pyc (7927B)
Цi+" @ d Z ddlmZ ddlmZ ddlmZ G d d Zy)) TaskGroup )events)
exceptions)tasksc R e Zd ZdZd Zd Zd Zd ZddddZd e d
e
fdZd Zd
Z
y)r a9 Asynchronous context manager for managing groups of tasks.
Example use:
async with asyncio.TaskGroup() as group:
task1 = group.create_task(some_coroutine(...))
task2 = group.create_task(other_coroutine(...))
print("Both tasks have completed now.")
All tasks are awaited when the context manager exits.
Any exceptions other than `asyncio.CancelledError` raised within
a task will cancel all remaining tasks and wait for them to exit.
The exceptions are then combined and raised as an `ExceptionGroup`.
c d| _ d| _ d| _ d | _ d | _ d| _ t
| _ g | _ d | _ d | _
y )NF)_entered_exiting _aborting_loop_parent_task_parent_cancel_requestedset_tasks_errors_base_error_on_completed_futselfs )/usr/lib/python3.12/asyncio/taskgroups.py__init__zTaskGroup.__init__ sN
(-%e!% c x dg}| j r'|j dt | j | j r'|j dt | j | j r|j d n| j
r|j d dj
| }d| dS ) N ztasks=zerrors=
cancellingentered z
)r appendlenr r r join)r infoinfo_strs r __repr__zTaskGroup.__repr__( s t;;KK&T[[!1 234<<KK'#dll"3!456>>KK%
]]KK "88D>H:Q''r c K | j rt d| d | j t j | _ t j | j | _ | j t d| d d| _ | S w)N
TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr r get_running_loopr current_taskr
r s r
__aenter__zTaskGroup.__aenter__6 s ==TH$=>@
@::002DJ!..tzz:$TH$EFH
H
s B Bc K d| _ |$| j | r| j || _ |t j u r|nd }| j
r| j j dk( rd }|| j s| j | j rT| j | j j | _ | j d { d | _ | j rT| j rJ | j | j |r| j s||-|t j ur| j j | | j r t! d| j }|d y 7 # t j $ r(}| j s|}| j Y d }~d }~ww xY w# d | _ w xY ww)NT zunhandled errors in a TaskGroup)r
_is_base_errorr r CancelledErrorr r
uncancelr _abortr r r
create_futurer r BaseExceptionGroup)r etexctbpropagate_cancellation_errorexmes r __aexit__zTaskGroup.__aexit__D s
O##C( ("D 222C %(( ))+q0 04,
>>>
kk%%-)-)A)A)C&
",,,, &*D"' kk* ;;'""" (..
>b
(A(AALL$<<
$'(I4<<Xd"
; -,,
"~~ 460KKM
"H $sa CGE= E;E= G/A1G!F; :G;E= =F8F3.G3F88G; GGN)namecontextc | j st d| d | j r| j st d| d | j rt d| d || j
j
| }n| j
j
|| }t j || |j r| j | |S | j j | |j | j |S )zbCreate a new task in this group and return it.
Similar to `asyncio.create_task`.
r&