%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/concurrent/futures/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/concurrent/futures/__pycache__/_base.cpython-312.pyc

�

���f1Y�
���dZddlZddlZddlZddlZddlZdZdZdZdZ	dZ
dZd	Zd
Z
dZe
eee
egZe
ded
ede
dediZej"d�ZGd�de�ZGd�de�ZeZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�d e�Zd!�Zd"�Zd.d#�Z ejBd$d%�Z"defd&�Z#d.d'�Z$Gd(�d)e�Z%Gd*�d+e�Z&Gd,�d-e'�Z(y)/z"Brian Quinlan (brian@sweetapp.com)�N�FIRST_COMPLETED�FIRST_EXCEPTION�
ALL_COMPLETED�
_AS_COMPLETED�PENDING�RUNNING�	CANCELLED�CANCELLED_AND_NOTIFIED�FINISHED�pending�running�	cancelled�finishedzconcurrent.futuresc��eZdZdZy)�Errorz-Base class for all future-related exceptions.N��__name__�
__module__�__qualname__�__doc__���//usr/lib/python3.12/concurrent/futures/_base.pyrr-s��7�rrc��eZdZdZy)�CancelledErrorzThe Future was cancelled.Nrrrrrr1s��#�rrc��eZdZdZy)�InvalidStateErrorz+The operation is not allowed in this state.Nrrrrrr7s��5�rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�_Waiterz;Provides the event that wait() and as_completed() block on.c�D�tj�|_g|_y�N)�	threading�Event�event�finished_futures��selfs r�__init__z_Waiter.__init__=s���_�_�&��
� "��rc�:�|jj|�yr!�r%�append�r'�futures  r�
add_resultz_Waiter.add_resultA������$�$�V�,rc�:�|jj|�yr!r*r,s  r�
add_exceptionz_Waiter.add_exceptionDr/rc�:�|jj|�yr!r*r,s  r�
add_cancelledz_Waiter.add_cancelledGr/rN)rrrrr(r.r1r3rrrrr;s��E�#�-�-�-rrc�@��eZdZdZ�fd�Z�fd�Z�fd�Z�fd�Z�xZS)�_AsCompletedWaiterzUsed by as_completed().c�\��tt|��tj�|_yr!)�superr5r(r"�Lock�lock)r'�	__class__s �rr(z_AsCompletedWaiter.__init__Ms���
� �$�0�2��N�N�$��	rc���|j5tt|�|�|jj�ddd�y#1swYyxYwr!)r9r7r5r.r$�set�r'r-r:s  �rr.z_AsCompletedWaiter.add_resultQs=���
�Y�Y�	��$�d�6�v�>��J�J�N�N��	�	�	���.A�Ac���|j5tt|�|�|jj�ddd�y#1swYyxYwr!)r9r7r5r1r$r<r=s  �rr1z _AsCompletedWaiter.add_exceptionV�=���
�Y�Y�	��$�d�9�&�A��J�J�N�N��	�	�	�r>c���|j5tt|�|�|jj�ddd�y#1swYyxYwr!)r9r7r5r3r$r<r=s  �rr3z _AsCompletedWaiter.add_cancelled[r@r>)	rrrrr(r.r1r3�
__classcell__�r:s@rr5r5Js���!�%��
�
�rr5c�6��eZdZdZ�fd�Z�fd�Z�fd�Z�xZS)�_FirstCompletedWaiterz*Used by wait(return_when=FIRST_COMPLETED).c�X��t�|�|�|jj�yr!)r7r.r$r<r=s  �rr.z _FirstCompletedWaiter.add_resultcs���
���6�"��
�
���rc�X��t�|�|�|jj�yr!)r7r1r$r<r=s  �rr1z#_FirstCompletedWaiter.add_exceptiong����
���f�%��
�
���rc�X��t�|�|�|jj�yr!)r7r3r$r<r=s  �rr3z#_FirstCompletedWaiter.add_cancelledkrHr)rrrrr.r1r3rBrCs@rrErE`s���4����rrEc�F��eZdZdZ�fd�Zd�Z�fd�Z�fd�Z�fd�Z�xZ	S)�_AllCompletedWaiterz<Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED).c�p��||_||_tj�|_t
�|��yr!)�num_pending_calls�stop_on_exceptionr"r8r9r7r()r'rMrNr:s   �rr(z_AllCompletedWaiter.__init__rs,���!2���!2����N�N�$��	�
���rc��|j5|xjdzc_|js|jj�ddd�y#1swYyxYw)N�)r9rMr$r<r&s r�_decrement_pending_callsz,_AllCompletedWaiter._decrement_pending_callsxsF��
�Y�Y�	!��"�"�a�'�"��)�)��
�
��� �	!�	!�	!�s�<A�Ac�D��t�|�|�|j�yr!)r7r.rQr=s  �rr.z_AllCompletedWaiter.add_result~s���
���6�"��%�%�'rc���t�|�|�|jr|jj	�y|j�yr!)r7r1rNr$r<rQr=s  �rr1z!_AllCompletedWaiter.add_exception�s3���
���f�%��!�!��J�J�N�N���)�)�+rc�D��t�|�|�|j�yr!)r7r3rQr=s  �rr3z!_AllCompletedWaiter.add_cancelled�s���
���f�%��%�%�'r)
rrrrr(rQr.r1r3rBrCs@rrKrKos$���F��!�(�,�(�(rrKc�"�eZdZdZd�Zd�Zd�Zy)�_AcquireFutureszDA context manager that does an ordered acquire of Future conditions.c�0�t|t��|_y)N)�key)�sorted�id�futures)r'r[s  rr(z_AcquireFutures.__init__�s���g�2�.��rc�Z�|jD]}|jj��yr!)r[�
_condition�acquirer,s  r�	__enter__z_AcquireFutures.__enter__��'���l�l�	(�F����%�%�'�	(rc�Z�|jD]}|jj��yr!)r[r]�release)r'�argsr-s   r�__exit__z_AcquireFutures.__exit__�r`rN)rrrrr(r_rdrrrrVrV�s��N�/�(�(rrVc�6�|tk(rt�}nb|tk(rt�}nNt	d�|D��}|t
k(rt
|d��}n%|tk(rt
|d��}ntd|z��|D]}|jj|��|S)Nc3�LK�|]}|jttfv���y�wr!��_stater
r��.0�fs  r�	<genexpr>z._create_and_install_waiters.<locals>.<genexpr>�s&����P�GH����!7�� B�B�P�s�"$T)rNFzInvalid return condition: %r)rr5rrE�sumrrKr�
ValueError�_waitersr+)�fs�return_when�waiter�
pending_countrks     r�_create_and_install_waitersrt�s����m�#�#�%��	��	'�&�(���P�LN�P�P�
��/�)�(��$�O�F�
�M�
)�(��%�P�F��;�k�I�J�J�
�"��	�
�
���&�!�"��Mrc#��K�|rd|d}|D]}|j|��|j5|jj|�ddd�~|j���|r�cyy#1swY�!xYw�w)a~
    Iterate on the list *fs*, yielding finished futures one by one in
    reverse order.
    Before yielding a future, *waiter* is removed from its waiters
    and the future is removed from each set in the collection of sets
    *ref_collect*.

    The aim of this function is to avoid keeping stale references after
    the future is yielded and before the iterator resumes.
    ���N)�remover]ro�pop)rprr�ref_collectrk�futures_sets     r�_yield_finished_futuresr{�sq����
��r�F��&�	"�K����q�!�	"�
�\�\�	&�
�J�J���f�%�	&�
��f�f�h��
�	&�	&�s"�,A6�A*�
A6�(A6�*A3�/A6c	#�K�|�|tj�z}t|�}t|�}t	|�5td�|D��}||z
}t|t�}ddd�t�}	t||f��Ed{���r�|�d}n5tj�z
}|dkrtdt|�|fz��|jj|�|j5|j}g|_
|jj�ddd�|j�t||||f��Ed{���|r��|D]2}|j 5|j"j%|�ddd��4y#1swY��)xYw7��#1swY�|xYw7�[#1swY�]xYw#|D]>}|j 5|j"j%�ddd��4#1swY�=xYwwxYw�w)anAn iterator over the given futures that yields each as it completes.

    Args:
        fs: The sequence of Futures (possibly created by different Executors) to
            iterate over.
        timeout: The maximum number of seconds to wait. If None, then there
            is no limit on the wait time.

    Returns:
        An iterator that yields the given Futures as they complete (finished or
        cancelled). If any given Futures are duplicated, they will be returned
        once.

    Raises:
        TimeoutError: If the entire result iterator could not be generated
            before the given timeout.
    Nc3�PK�|]}|jttfvr|��� y�wr!rgris  rrlzas_completed.<locals>.<genexpr>�s,����C���8�8� 6��A�A��C�s�$&)ryrz%d (of %d) futures unfinished)�time�	monotonicr<�lenrVrtr�listr{�TimeoutErrorr$�waitr9r%�clear�reverser]rorw)	rp�timeout�end_time�
total_futuresrrrr�wait_timeoutrks	         r�as_completedr��s����$���T�^�^�-�-��	�R��B���G�M�	��	�@��C��C�C���x�-��,�R��?��@��H�~�H�*�*�8�V�8:�u�>�	>�	>����#��'�$�.�.�*:�:���!�#�&�;���L�-�?9�9�:�:�
�L�L���l�+����
%�!�2�2��*,��'����"�"�$�
%�
����.�x��<>��=�J�
J�
J�'�0�	*�A����
*��
�
�!�!�&�)�
*�
*�	*�G@�@��	>��
%�
%��
J��
*�
*���	*�A����
*��
�
�!�!�&�)�
*�
*�
*��	*�s��;G>�(F�%G>�9F6�F�A'F6�3.F�!+F6�F(�
F6�G>�%F*�G>�F�G>�F6�F%�!F6�*F3	�/G>�6G;�G-	�$	G;�-G6
�2	G;�;G>�DoneAndNotDoneFuturesz
done not_donec���t|�}t|�5|D�chc]}|jttfvr|��}}||z
}|t
k(r|rt
||�cddd�S|tk(r)|r'td�|D��rt
||�cddd�St|�t|�k(rt
||�cddd�St||�}ddd�jj|�|D]2}|j5|jj|�ddd��4j!|j"�t
|||z
�Scc}w#1swY��xYw#1swY�yxYw)anWait for the futures in the given sequence to complete.

    Args:
        fs: The sequence of Futures (possibly created by different Executors) to
            wait upon.
        timeout: The maximum number of seconds to wait. If None, then there
            is no limit on the wait time.
        return_when: Indicates when this function should return. The options
            are:

            FIRST_COMPLETED - Return when any future finishes or is
                              cancelled.
            FIRST_EXCEPTION - Return when any future finishes by raising an
                              exception. If no future raises an exception
                              then it is equivalent to ALL_COMPLETED.
            ALL_COMPLETED -   Return when all futures finish or are cancelled.

    Returns:
        A named 2-tuple of sets. The first set, named 'done', contains the
        futures that completed (is finished or cancelled) before the wait
        completed. The second set, named 'not_done', contains uncompleted
        futures. Duplicate futures given to *fs* are removed and will be
        returned only once.
    Nc3�`K�|]&}|j�s|j��|���(y�wr!)r�	exceptionris  rrlzwait.<locals>.<genexpr>(s-����G���+�+�-�A�K�K�M�,E��G�s�,.)r<rVrhr
rrr�r�anyr�rtr$r�r]rorw�updater%)rpr�rqrk�done�not_donerrs       rr�r�sn��2

�R��B�	��	�>��F�a��h�h�#9�8�"D�D��F��F���9���?�*��(��x�8�>�>��_�,�$��G�d�G�G�,�T�8�<�>�>��t�9��B���(��x�8�>�>�-�R��=��>� �L�L���g��
�&��
�\�\�	&�
�J�J���f�%�	&�	&�&�	�K�K��'�'�(� ��r�D�y�1�1��+F�>�>��$	&�	&�s9�E�!E�E�$(E�"E�E�E#�E�E �#E,	c��		|j|�|j�~S#|j�wxYw#~wxYwr!)�result�cancel)�futr�s  r�_result_or_cancelr�:s9���	��:�:�g�&��J�J�L�
��
�J�J�L��
�s�%�:�7�:�=c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zdd�Z
dd
�Zd�Zd�Zd�Zeej(�Zy)�Futurez5Represents the result of an asynchronous computation.c��tj�|_t|_d|_d|_g|_g|_y)z8Initializes the future. Should not be called by clients.N)	r"�	Conditionr]rrh�_result�
_exceptionro�_done_callbacksr&s rr(zFuture.__init__Hs6��#�-�-�/��������������
�!��rc��|jD]}	||��
y#t$rtjd|�Y�0wxYw)N�!exception calling callback for %r)r��	Exception�LOGGERr�)r'�callbacks  r�_invoke_callbackszFuture._invoke_callbacksQsJ���,�,�	L�H�
L����	L���
L�� � �!D�d�K�
L�s��>�>c�h�|j5|jtk(r�|jr^d|jj
t
|�t|j|jjj
fzcddd�Sd|jj
t
|�t|j|jjj
fzcddd�Sd|jj
t
|�t|jfzcddd�S#1swYyxYw)Nz<%s at %#x state=%s raised %s>z <%s at %#x state=%s returned %s>z<%s at %#x state=%s>)	r]rhrr�r:rrZ�_STATE_TO_DESCRIPTION_MAPr�r&s r�__repr__zFuture.__repr__Xs���
�_�_�	;��{�{�h�&��?�?�;����/�/��4��1�$�+�+�>����1�1�:�:�	?<�<�	;�	;�>����/�/��4��1�$�+�+�>����.�.�7�7�	A9�9�	;�	;�*��N�N�+�+��t�H�,�T�[�[�9�-;�;�	;�	;�	;�s�A4D(�AD(�)5D(�(D1c�8�|j5|jttfvr
	ddd�y|jtt
fvr
	ddd�yt|_|jj
�ddd�|j�y#1swY�xYw)z�Cancel the future if possible.

        Returns True if the future was cancelled, False otherwise. A future
        cannot be cancelled if it is running or has already completed.
        NFT)r]rhrrr	r
�
notify_allr�r&s rr�z
Future.cancells����_�_�	)��{�{�w��1�1��	)�	)��{�{�y�*@�A�A��	)�	)�$�D�K��O�O�&�&�(�	)�	
��� ��	)�	)�s�B�B�%B�Bc�v�|j5|jttfvcddd�S#1swYyxYw)z(Return True if the future was cancelled.N)r]rhr	r
r&s rrzFuture.cancelleds4��
�_�_�	F��;�;�9�.D�"E�E�	F�	F�	F�s�/�8c�l�|j5|jtk(cddd�S#1swYyxYw)z1Return True if the future is currently executing.N)r]rhrr&s rr
zFuture.running�s*��
�_�_�	*��;�;�'�)�	*�	*�	*�s�*�3c��|j5|jtttfvcddd�S#1swYyxYw)z>Return True if the future was cancelled or finished executing.N)r]rhr	r
rr&s rr�zFuture.done�s6��
�_�_�	P��;�;�9�.D�h�"O�O�	P�	P�	P�s�4�=c�Z�|jr
	|j�|jS#d}wxYwr!)r�r�r&s r�__get_resultzFuture.__get_result�s-���?�?�
��o�o�%�
�<�<�����s�&�*c�(�|j5|jtttfvr%|j
j
|�	ddd�y	ddd�	||�y#1swY�xYw#t$rtjd|�YywxYw)a%Attaches a callable that will be called when the future finishes.

        Args:
            fn: A callable that will be called with this future as its only
                argument when the future completes or is cancelled. The callable
                will always be called by a thread in the same process in which
                it was added. If the future has already completed or been
                cancelled then the callable will be called immediately. These
                callables are called in the order that they were added.
        Nr�)
r]rhr	r
rr�r+r�r�r�)r'�fns  r�add_done_callbackzFuture.add_done_callback�s����_�_�	��{�{�9�.D�h�"O�O��$�$�+�+�B�/��	�	�O�	�	H��t�H�	�	���	H����@�$�G�	H�s�:A#�A/�#A,�/B�BNc���	|j5|jttfvr
t	��|jt
k(r|j
�cddd�d}S|jj|�|jttfvr
t	��|jt
k(r|j
�cddd�d}St��#1swYd}yxYw#d}wxYw)aBReturn the result of the call that the future represents.

        Args:
            timeout: The number of seconds to wait for the result if the future
                isn't done. If None, then there is no limit on the wait time.

        Returns:
            The result of the call that the future represents.

        Raises:
            CancelledError: If the future was cancelled.
            TimeoutError: If the future didn't finish executing before the given
                timeout.
            Exception: If the call raised then that exception will be raised.
        N)	r]rhr	r
rr�_Future__get_resultr�r��r'r�s  rr�z
Future.result�s��� 	����

)��;�;�9�.D�"E�E�(�*�*��[�[�H�,��,�,�.�	

)�

)� �D����$�$�W�-��;�;�9�.D�"E�E�(�*�*��[�[�H�,��,�,�.�

)�

)� �D�'�.�(�

)� �D��4�D�s<�C"�AC�	C"�AC�>	C"�

C�C�C"�C"�"C&c��|j5|jttfvr
t	��|jt
k(r|jcddd�S|jj|�|jttfvr
t	��|jt
k(r|jcddd�St��#1swYyxYw)aUReturn the exception raised by the call that the future represents.

        Args:
            timeout: The number of seconds to wait for the exception if the
                future isn't done. If None, then there is no limit on the wait
                time.

        Returns:
            The exception raised by the call that the future represents or None
            if the call completed without raising.

        Raises:
            CancelledError: If the future was cancelled.
            TimeoutError: If the future didn't finish executing before the given
                timeout.
        N)	r]rhr	r
rrr�r�r�r�s  rr�zFuture.exception�s���$�_�_�
	%��{�{�y�*@�A�A�$�&�&�����(����	
	%�
	%�
�O�O� � ��)��{�{�y�*@�A�A�$�&�&�����(����
	%�
	%�#�n�$�
	%�
	%�s�AC�AC�=
C�Cc��|j5|jtk(r7t|_|jD]}|j|��	ddd�y|jtk(rt|_	ddd�ytjdt|�|j�td��#1swYyxYw)a�Mark the future as running or process any cancel notifications.

        Should only be used by Executor implementations and unit tests.

        If the future has been cancelled (cancel() was called and returned
        True) then any threads waiting on the future completing (though calls
        to as_completed() or wait()) are notified and False is returned.

        If the future was not cancelled then it is put in the running state
        (future calls to running() will return True) and True is returned.

        This method should be called by Executor implementations before
        executing the work associated with this future. If this method returns
        False then the work should not be executed.

        Returns:
            False if the Future was cancelled, True otherwise.

        Raises:
            RuntimeError: if this method was already called or if set_result()
                or set_exception() was called.
        NFTz!Future %s in unexpected state: %szFuture in unexpected state)r]rhr	r
ror3rrr��criticalrZ�RuntimeError)r'rrs  r�set_running_or_notify_cancelz#Future.set_running_or_notify_cancel�s���.�_�_�	A��{�{�i�'�4���"�m�m�/�F��(�(��.�/��	A�	A�����'�%����	A�	A���� C� "�4�� $���-�#�#?�@�@�	A�	A�s�AB5�B5�5B5�5B>c��|j5|jttthvr%tdj
|j|���||_t|_|jD]}|j|��|jj�ddd�|j�y#1swY�xYw)z�Sets the return value of work associated with the future.

        Should only be used by Executor implementations and unit tests.
        �{}: {!r}N)r]rhr	r
rr�formatr�ror.r�r�)r'r�rrs   r�
set_resultzFuture.set_results���
�_�_�	)��{�{�y�*@�(�K�K�'�
�(9�(9�$�+�+�t�(L�M�M�!�D�L�"�D�K��-�-�
(���!�!�$�'�
(��O�O�&�&�(�	)�	
��� �	)�	)���BB7�7Cc��|j5|jttthvr%tdj
|j|���||_t|_|jD]}|j|��|jj�ddd�|j�y#1swY�xYw)z�Sets the result of the future as being the given exception.

        Should only be used by Executor implementations and unit tests.
        r�N)r]rhr	r
rrr�r�ror1r�r�)r'r�rrs   r�
set_exceptionzFuture.set_exception(s���
�_�_�	)��{�{�y�*@�(�K�K�'�
�(9�(9�$�+�+�t�(L�M�M�'�D�O�"�D�K��-�-�
+���$�$�T�*�
+��O�O�&�&�(�	)�	
��� �	)�	)�r�r!)rrrrr(r�r�r�rr
r�r�r�r�r�r�r�r��classmethod�types�GenericAlias�__class_getitem__rrrr�r�Esf��?�"�L�;�(�&F�
*�
P�
 �H�(!�F%�D&A�P
!�
!�$�E�$6�$6�7�rr�c�>�eZdZdZd�Zddd�d�Zddd�d	�Zd
�Zd�Zy)
�ExecutorzCThis is an abstract base class for concrete asynchronous executors.c��t��)a Submits a callable to be executed with the given arguments.

        Schedules the callable to be executed as fn(*args, **kwargs) and returns
        a Future instance representing the execution of the callable.

        Returns:
            A Future representing the given call.
        )�NotImplementedError)r'r�rc�kwargss    r�submitzExecutor.submit<s
��"�#�#rNrP)r��	chunksizec��������tj�z�t|�D�cgc]}|j|g|�����c}����fd�}|�Scc}w)a}Returns an iterator equivalent to map(fn, iter).

        Args:
            fn: A callable that will take as many arguments as there are
                passed iterables.
            timeout: The maximum number of seconds to wait. If None, then there
                is no limit on the wait time.
            chunksize: The size of the chunks the iterable will be broken into
                before being passed to a child process. This argument is only
                used by ProcessPoolExecutor; it is ignored by
                ThreadPoolExecutor.

        Returns:
            An iterator equivalent to: map(func, *iterables) but the calls may
            be evaluated out-of-order.

        Raises:
            TimeoutError: If the entire result iterator could not be generated
                before the given timeout.
            Exception: If fn(*args) raises for any values.
        c3�>�K�	�j��rR��t�j����n1t�j��tj�z
����r�R�D]}|j��y#�D]}|j��wxYw�wr!)r�r�rxr~rr�)r-r�rpr�s ���r�result_iteratorz%Executor.map.<locals>.result_iteratords������
$��
�
�����/�����9�9�/�����(�T�^�^�EU�:U�V�V��!�$�F��M�M�O�$��b�$�F��M�M�O�$�s�B�A#B�)B�B�B)r~r�zipr�)	r'r�r�r��	iterablesrcr�r�rps	  `    @@r�mapzExecutor.mapGsV���,������!1�1�H�14�i��
A��k�d�k�k�"�$�t�$�
A��	$�� � ��#Bs�AF)�cancel_futuresc��y)a;Clean-up the resources associated with the Executor.

        It is safe to call this method several times. Otherwise, no other
        methods can be called after this one.

        Args:
            wait: If True then shutdown will not return until all running
                futures have finished executing and the resources used by the
                executor have been reclaimed.
            cancel_futures: If True then shutdown will cancel all pending
                futures. Futures that are completed or running will not be
                cancelled.
        Nr)r'r�r�s   r�shutdownzExecutor.shutdownss��	
rc��|Sr!rr&s rr_zExecutor.__enter__�s���rc�(�|jd��y)NT)r�F)r�)r'�exc_type�exc_val�exc_tbs    rrdzExecutor.__exit__�s���
�
�4�
� �r)T)	rrrrr�r�r�r_rdrrrr�r�9s-��M�	$�+/�!�*!�X
�E�
� �rr�c��eZdZdZy)�BrokenExecutorzR
    Raised when a executor has become non-functional after a severe failure.
    Nrrrrr�r��s��rr�r!))�
__author__�collections�loggingr"r~r�rrrrrrr	r
r�_FUTURE_STATESr��	getLoggerr�r�rrr�r�objectrr5rErKrVrtr{r��
namedtupler�r�r�r�r�r�r�rrr�<module>r�sf��2�
������#��#���
��
���
���	�1������
������Y��Y�
�{��K��j���
��	�	�/�	0��	�I�	�	�U�	���	��	�
-�f�
-����,
�G�
�(�'�(�<(�f�(��,�,<*�|/��.�.���2���}�02�f�r8�V�r8�hO�v�O�d�\�r

Zerion Mini Shell 1.0