Your IP : 3.141.45.177
�
�g�$ � �@ � d Z ddlmZ ddlmZ ddlmZ G d� d� Zy))� TaskGroup� )�events)�
exceptions)�tasksc �X � e Zd ZdZd� Zd� Zd� Zd� Zd� Zddd�d �Z d
e
defd�Zd
� Z
d� Zy)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_requested�set�_tasks�_errors�_base_error�_on_completed_fut��selfs �9/opt/alt/python312/lib64/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|� d�S ) N� ztasks=zerrors=�
cancelling�entered� z
<TaskGroup�>)r �append�lenr r r �join)r �info�info_strs r �__repr__zTaskGroup.__repr__( s� � ��t���;�;��K�K�&��T�[�[�!1� 2�3�4��<�<��K�K�'�#�d�l�l�"3�!4�5�6��>�>��K�K��%�
�]�]��K�K� �"��8�8�D�>���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� � �� ��=�=���T�H�$=�>�@�
@��:�:���0�0�2�D�J�!�.�.�t�z�z�:������$���T�H�$E�F�H�
H���
���s �B Bc � � K � d } | j ||� � d { ��� d | _ d | _ d | _ d }S 7 �# d | _ d | _ d | _ d }w xY w�w�N)�_aexitr
r r )r �et�exc�tbs r � __aexit__zTaskGroup.__aexit__D sc � �� �
��
����R��-�-� !%�D���D�L�#�D���C� .�� !%�D���D�L�#�D���C�s% �A�9 �7�9 �A�9 �A�Ac � � 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 r�T| j rJ �| j �
| j � |r| j s |�d }|�-|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 w# d }w xY w# d }w xY w# d }w xY w�w)NT� zunhandled errors in a TaskGroup)r
�_is_base_errorr r �CancelledErrorr r
�uncancelr �_abortr r r �
create_futurer r �BaseExceptionGroup)r r. r/ �propagate_cancellation_error�exs r r- zTaskGroup._aexitR s� � �� ���
��O��#�#�C�(�� � �(�"�D�� ��2�2�2�C�� %��(�(�� � �)�)�+�q�0� 04�,�
�>��>�>� ���
� �k�k��%�%�-�)-���)A�)A�)C��&�
"��,�,�,�,� &*�D�"�'