AlkantarClanX12

Your IP : 13.58.200.16


Current Path : /opt/alt/python311/lib64/python3.11/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/asyncio/__pycache__/taskgroups.cpython-311.pyc

�

c��f!��J�dgZddlmZddlmZddlmZGd�d��ZdS)�	TaskGroup�)�events)�
exceptions)�tasksc�T�eZdZdZd�Zd�Zd�Zd�Zddd�d�Zd	e	d
e
fd�Zd�Zd
�Z
dS)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|_
dS)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}|jr*|�dt|j������|jr*|�dt|j������|jr|�d��n|jr|�d��d�|��}d|�d�S)	N�ztasks=zerrors=�
cancelling�entered� z
<TaskGroup�>)r�append�lenrrr	�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�'�'�'�'rc��K�|jrtd|�d����|j�tj��|_tj|j��|_|j�td|�d����d|_|S)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�>�>�>�@�@�
@��:���0�2�2�D�J�!�.�t�z�:�:�����$��F�T�F�F�F�H�H�
H���
��rc��K�d|_|�#|�|��r|j�||_|tjur|nd}|jr|j���dkrd}|�|js|�	��|j
r{|j�|j�
��|_	|j�d{V��n9#tj$r'}|js|}|�	��Yd}~nd}~wwxYwd|_|j
�{|j
rJ�|j�|j�|r	|js|�|�(|tjur|j�|��|jr%	t!d|j��}|d�#d|_wxYwdS)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�C��	%��(�	4�� �)�)�+�+�q�0�0�04�,�
�>��>�

����
�
�
��k�	*��%�-�)-��)A�)A�)C�)C��&�

"��,�,�,�,�,�,�,�,�,���,�
"�
"�
"��~�
"�46�0��K�K�M�M�M����������
"����&*�D�"�'�k�	*�*�;������'��"�"�(�	/���	/�.�.�
�>�b�
�(A�A�A��L����$�$�$��<�	$�
$�'�(I�4�<�X�X���d�"��#���#�#�#�#�	$�	$s$�1
B?�?C5�C0�0C5�E2�2	E;N)�name�contextc��|jstd|�d����|jr|jstd|�d����|jrtd|�d����|�|j�|��}n|j�||���}tj||��|�	|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 downN)r;)r	r'r
rrr�create_taskr�_set_task_name�add_done_callback�
_on_task_done�add)r�coror:r;�tasks     rr=zTaskGroup.create_task�s���
�}�	K��I�D�I�I�I�J�J�J��=�	B���	B��@�D�@�@�@�A�A�A��>�	G��E�D�E�E�E�F�F�F��?��:�)�)�$�/�/�D�D��:�)�)�$��)�@�@�D�
��T�4�(�(�(����t�1�2�2�2����������rr4�returnc�h�t|t��sJ�t|ttf��S)N)�
isinstance�
BaseException�
SystemExit�KeyboardInterrupt)rr4s  rr-zTaskGroup._is_base_error�s.���#�}�-�-�-�-�-��#�
�,=�>�?�?�?rc�x�d|_|jD]*}|���s|����+dS)NT)rr�done�cancel)r�ts  rr0zTaskGroup._abort�sB�������	�	�A��6�6�8�8�
����
�
�
��	�	rc��|j�|��|j�:|js3|j���s|j�d��|���rdS|���}|�dS|j�|��|�	|��r|j
�||_
|j���r,|j�
d|�d|j�d�||d���dS|js=|js8|���d|_|j���dSdSdS)NTzTask z% has errored out but its parent task z is already completed)�message�	exceptionrC)r�discardrrK�
set_result�	cancelledrPrrr-rr
r�call_exception_handlerrrr0rL)rrCr4s   rr@zTaskGroup._on_task_done�s�������D�!�!�!��!�-�d�k�-��)�.�.�0�0�
8��&�1�1�$�7�7�7��>�>���	��F��n�n�����;��F�����C� � � ����s�#�#�	#��(8�(@�"�D����!�!�#�#�		�
�J�-�-�L�4�L�L�#'�#4�L�L�L� ��	/�/�
�
�
�
�F��~�	'�d�&C�	'�&
�K�K�M�M�M�,0�D�)���$�$�&�&�&�&�&�+	'�	'�	'�	'r)�__name__�
__module__�__qualname__�__doc__rr$r*r9r=rG�boolr-r0r@�rrrrs���������
&�
&�
&�(�(�(����O$�O$�O$�b)-�d������0@�-�@�D�@�@�@�@����2'�2'�2'�2'�2'rN)�__all__rrrrrrZrr�<module>r\s���
�-��������������������^'�^'�^'�^'�^'�^'�^'�^'�^'�^'r