AlkantarClanX12
Current Path : /opt/alt/python311/lib64/python3.11/asyncio/__pycache__/ |
Current File : //opt/alt/python311/lib64/python3.11/asyncio/__pycache__/taskgroups.cpython-311.pyc |
� c��f! � �J � d gZ ddlmZ ddlmZ ddlmZ G d� d � � ZdS )� TaskGroup� )�events)� exceptions)�tasksc �T � e Zd ZdZd� Zd� Zd� Zd� Zddd�d�Zd e d e fd�Zd� Zd � Z dS )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 | _ d S )NF)�_entered�_exiting� _aborting�_loop�_parent_task�_parent_cancel_requested�set�_tasks�_errors�_base_error�_on_completed_fut��selfs �9/opt/alt/python311/lib64/python3.11/asyncio/taskgroups.py�__init__zTaskGroup.__init__ sV � ��� ��� ������ � ���(-��%��e�e���������!%����� c �t � dg}| j r*|� dt | j � � � �� � | j r*|� dt | j � � � �� � | j r|� d� � n| j r|� d� � d� |� � }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���;� 5��K�K�3��T�[�!1�!1�3�3�4�4�4��<� 7��K�K�5�#�d�l�"3�"3�5�5�6�6�6��>� #��K�K��%�%�%�%� �]� #��K�K� �"�"�"��8�8�D�>�>��'�H�'�'�'�'r c � � K � | j rt d| �d�� � �| j �t j � � | _ t j | j � � | _ | j �t d| �d�� � �d| _ | S )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�>�>�>�@� @� @��:���0�2�2�D�J�!�.�t�z�:�:�����$��F�T�F�F�F�H� H� H��� ��r c � � K � d| _ |�#| � |� � r| j �|| _ |t j u r|nd }| j r| j � � � dk rd }|�| j s| � � � | j r{| j �| j � � � | _ | j � d {V �� n9# t j $ r'}| j s|}| � � � Y d }~nd }~ww xY wd | _ | j �{| j rJ �| j �| j �|r | j s|�|�(|t j ur| j � |� � | j r% t! d| j � � }|d �# d | _ w xY wd S )NT� zunhandled errors in a TaskGroup)r �_is_base_errorr r �CancelledErrorr r �uncancelr �_abortr r r � create_futurer r �BaseExceptionGroup)r �et�exc�tb�propagate_cancellation_error�ex�mes r � __aexit__zTaskGroup.__aexit__D s� � � � ��� ��O��#�#�C�(�(� �� �(�"�D�� ��2�2�2�C�C�� %��(� 4�� �)�)�+�+�q�0�0� 04�,� �>��>� � ��� � � � �k� *��%�-�)-��)A�)A�)C�)C��&� "��,�,�,�,�,�,�,�,�,���,� "� "� "��~� "� 46�0��K�K�M�M�M���������� "���� &*�D�"�'