Your IP : 18.224.45.82


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/taskgroups.cpython-312.opt-1.pyc

�

�Q�f+"��@�dZddlmZddlmZddlmZGd�d�Zy))�	TaskGroup�)�events)�
exceptions)�tasksc�R�eZdZdZd�Zd�Zd�Zd�Zddd�d�Zd	e	d
e
fd�Zd�Zd
�Z
y)ra9Asynchronous 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}|jr'|jdt|j����|jr'|jdt|j����|jr|jd�n|j
r|jd�dj
|�}d|�d�S)	N�ztasks=zerrors=�
cancelling�entered� z
<TaskGroup�>)r�append�lenrrr	�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�'�'rc��K�|jrtd|�d���|j�tj�|_tj|j�|_|j�td|�d���d|_|S�w)N�
TaskGroup z has already been enteredz! cannot determine the parent taskT)r	�RuntimeErrorrr�get_running_loopr�current_taskr
rs r�
__aenter__zTaskGroup.__aenter__6s������=�=���T�H�$=�>�@�
@��:�:���0�0�2�D�J�!�.�.�t�z�z�:������$���T�H�$E�F�H�
H���
���s�B	Bc��vK�d|_|�$|j|�r|j�||_|tjur|nd}|j
r|jj�dk(rd}|�|js|j�|jrT|j�|jj�|_	|j�d{���d|_|jr�T|j�|j�|r|js|�|�-|tjur|jj|�|jr	t!d|j�}|d�y7��#tj$r(}|js|}|j�Yd}~��d}~wwxYw#d|_wxYw�w)NT�zunhandled errors in a TaskGroup)r
�_is_base_errorrr�CancelledErrorrr
�uncancelr�_abortrrr�
create_futurerr�BaseExceptionGroup)r�et�exc�tb�propagate_cancellation_error�ex�mes       r�	__aexit__zTaskGroup.__aexit__Ds�������
��O��#�#�C�(�� � �(�"�D����2�2�2�C��	%��(�(�� � �)�)�+�q�0�04�,�
�>��>�>����
��k�k��%�%�-�)-���)A�)A�)C��&�

"��,�,�,�,�&*�D�"�'�k�k�.���'��"�"�"�(����.�.�
�>�b�
�(A�(A�A��L�L����$��<�<�
$�'�(I�4�<�<�X���d�"�
�;-���,�,�
"��~�~�46�0��K�K�M���
"��H $���sa�CF9�E/�E-�E/�F9�/A#F9�F-�,F9�-E/�/F*�F%� F9�%F*�*F9�-	F6�6F9N)�name�contextc��|jstd|�d���|jr|jstd|�d���|jrtd|�d���|�|j
j
|�}n|j
j
||��}tj||�|j�r|j|�|S|jj|�|j|j�|S)zbCreate a new task in this group and return it.

        Similar to `asyncio.create_task`.
        r&z has not been enteredz is finishedz is shutting down)r;)
r	r'r
rrr�create_taskr�_set_task_name�done�
_on_task_done�add�add_done_callback)r�coror:r;�tasks     rr=zTaskGroup.create_task�s���
�}�}���D�8�3H�I�J�J��=�=������D�8�<�@�A�A��>�>���D�8�3D�E�F�F��?��:�:�)�)�$�/�D��:�:�)�)�$��)�@�D�
���T�4�(��9�9�;����t�$���
�K�K�O�O�D�!��"�"�4�#5�#5�6��rr4�returnc�.�t|ttf�S)N)�
isinstance�
SystemExit�KeyboardInterrupt)rr4s  rr-zTaskGroup._is_base_error�s���#�
�,=�>�?�?rc�v�d|_|jD]#}|j�r�|j��%y)NT)rrr?�cancel)r�ts  rr0zTaskGroup._abort�s)��������A��6�6�8����
�rc���|jj|�|j�A|js5|jj�s|jj	d�|j�ry|j
�}|�y|jj|�|j|�r|j�||_
|jj�r1|jjd|�d|j�d�||d��y|js?|js2|j!�d|_|jj#�yyy)NTzTask z% has errored out but its parent task z is already completed)�message�	exceptionrD)r�discardrr?�
set_result�	cancelledrOrrr-rr
r�call_exception_handlerrrr0rK)rrDr4s   rr@zTaskGroup._on_task_done�s3�������D�!��!�!�-�d�k�k��)�)�.�.�0��&�&�1�1�$�7��>�>����n�n����;�������C� ����s�#��(8�(8�(@�"�D�����!�!�#�
�J�J�-�-�"�4�(�+#�#'�#4�#4�"5�5J�L� ��	/�
�
��~�~�d�&C�&C�&
�K�K�M�,0�D�)����$�$�&�+'D�~r)�__name__�
__module__�__qualname__�__doc__rr$r*r9r=�
BaseException�boolr-r0r@�rrrrsI���
&�(��O$�b)-�d��<@�-�@�D�@��2'rrN)�__all__rrrrrrZrr�<module>r\s!��
�����d'�d'r

?>