Your IP : 3.138.178.162


Current Path : /opt/alt/python311/lib64/python3.11/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/concurrent/futures/__pycache__/_base.cpython-311.opt-1.pyc

�

c��f1Y�
��dZddlZddlZddlZddlZddlZdZdZdZdZ	dZ
dZd	Zd
Z
dZe
eee
egZe
ded
ede
dediZejd��ZGd�de��ZGd�de��ZeZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�d e��Zd!�Zd"�Zd.d#�Z ej!d$d%��Z"defd&�Z#d.d'�Z$Gd(�d)e��Z%Gd*�d+e��Z&Gd,�d-e'��Z(dS)/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��eZdZdZdS)�Errorz-Base class for all future-related exceptions.N��__name__�
__module__�__qualname__�__doc__���?/opt/alt/python311/lib64/python3.11/concurrent/futures/_base.pyrr-s������7�7��Drrc��eZdZdZdS)�CancelledErrorzThe Future was cancelled.Nrrrrrr1s������#�#��Drrc��eZdZdZdS)�InvalidStateErrorz+The operation is not allowed in this state.Nrrrrrr7s������5�5��Drrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�_Waiterz;Provides the event that wait() and as_completed() block on.c�D�tj��|_g|_dS�N)�	threading�Event�event�finished_futures��selfs r�__init__z_Waiter.__init__=s���_�&�&��
� "����rc�:�|j�|��dSr!�r%�append�r'�futures  r�
add_resultz_Waiter.add_resultA�����$�$�V�,�,�,�,�,rc�:�|j�|��dSr!r*r,s  r�
add_exceptionz_Waiter.add_exceptionDr/rc�:�|j�|��dSr!r*r,s  r�
add_cancelledz_Waiter.add_cancelledGr/rN)rrrrr(r.r1r3rrrrr;sV������E�E�#�#�#�-�-�-�-�-�-�-�-�-�-�-rrc�@��eZdZdZ�fd�Z�fd�Z�fd�Z�fd�Z�xZS)�_AsCompletedWaiterzUsed by as_completed().c���tt|�����tj��|_dSr!)�superr5r(r"�Lock�lock)r'�	__class__s �rr(z_AsCompletedWaiter.__init__Ms3���
� �$�'�'�0�0�2�2�2��N�$�$��	�	�	rc����|j5tt|���|��|j���ddd��dS#1swxYwYdSr!)r9r7r5r.r$�set�r'r-r:s  �rr.z_AsCompletedWaiter.add_resultQs����
�Y�	�	��$�d�+�+�6�6�v�>�>�>��J�N�N����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��AA�A�Ac����|j5tt|���|��|j���ddd��dS#1swxYwYdSr!)r9r7r5r1r$r<r=s  �rr1z _AsCompletedWaiter.add_exceptionV����
�Y�	�	��$�d�+�+�9�9�&�A�A�A��J�N�N����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	r>c����|j5tt|���|��|j���ddd��dS#1swxYwYdSr!)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�|��t���|��|j���dSr!)r7r.r$r<r=s  �rr.z _FirstCompletedWaiter.add_resultcs3���
�����6�"�"�"��
�������rc�|��t���|��|j���dSr!)r7r1r$r<r=s  �rr1z#_FirstCompletedWaiter.add_exceptiong�3���
�����f�%�%�%��
�������rc�|��t���|��|j���dSr!)r7r3r$r<r=s  �rr3z#_FirstCompletedWaiter.add_cancelledkrHr)rrrrr.r1r3rBrCs@rrErE`sp�������4�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���||_||_tj��|_t�����dSr!)�num_pending_calls�stop_on_exceptionr"r8r9r7r()r'rMrNr:s   �rr(z_AllCompletedWaiter.__init__rs>���!2���!2����N�$�$��	�
���������rc��|j5|xjdzc_|js|j���ddd��dS#1swxYwYdS)N�)r9rMr$r<r&s r�_decrement_pending_callsz,_AllCompletedWaiter._decrement_pending_callsxs���
�Y�	!�	!��"�"�a�'�"�"��)�
!��
��� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s�1A�A
�
A
c�r��t���|��|���dSr!)r7r.rQr=s  �rr.z_AllCompletedWaiter.add_result~s3���
�����6�"�"�"��%�%�'�'�'�'�'rc���t���|��|jr|j���dS|���dSr!)r7r1rNr$r<rQr=s  �rr1z!_AllCompletedWaiter.add_exception�sV���
�����f�%�%�%��!�	,��J�N�N�������)�)�+�+�+�+�+rc�r��t���|��|���dSr!)r7r3rQr=s  �rr3z!_AllCompletedWaiter.add_cancelled�s3���
�����f�%�%�%��%�%�'�'�'�'�'r)
rrrrr(rQr.r1r3rBrCs@rrKrKos��������F�F������!�!�!�(�(�(�(�(�,�,�,�,�,�(�(�(�(�(�(�(�(�(rrKc�$�eZdZdZd�Zd�Zd�ZdS)�_AcquireFutureszDA context manager that does an ordered acquire of Future conditions.c�<�t|t���|_dS)N)�key)�sorted�id�futures)r'r[s  rr(z_AcquireFutures.__init__�s���g�2�.�.�.����rc�L�|jD]}|j����dSr!)r[�
_condition�acquirer,s  r�	__enter__z_AcquireFutures.__enter__��5���l�	(�	(�F���%�%�'�'�'�'�	(�	(rc�L�|jD]}|j����dSr!)r[r]�release)r'�argsr-s   r�__exit__z_AcquireFutures.__exit__�r`rN)rrrrr(r_rdrrrrVrV�sG������N�N�/�/�/�(�(�(�(�(�(�(�(rrVc�v�|tkrt��}n|tkrt��}net	d�|D����}|t
krt
|d���}n/|tkrt
|d���}ntd|z���|D]}|j	�
|���|S)Nc3�@K�|]}|jttfvV��dSr!��_stater
r��.0�fs  r�	<genexpr>z._create_and_install_waiters.<locals>.<genexpr>�sH����P�P�GH���!7�� B�B�P�P�P�P�P�PrT)rNFzInvalid return condition: %r)rr5rrE�sumrrKr�
ValueError�_waitersr+)�fs�return_when�waiter�
pending_countrks     r�_create_and_install_waitersrt�s����m�#�#�#�%�%���	��	'�	'�&�(�(����P�P�LN�P�P�P�P�P�
��/�)�)�(��$�O�O�O�F�F�
�M�
)�
)�(��%�P�P�P�F�F��;�k�I�J�J�J�
�"�"��	�
���&�!�!�!�!��Mrc#�K�|rv|d}|D]}|�|���|j5|j�|��ddd��n#1swxYwY~|���V�|�tdSdS)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{�s�����
���r�F��&�	"�	"�K����q�!�!�!�!�
�\�	&�	&�
�J���f�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�
��f�f�h�h����
�����s�A�A�Ac	#�&K�|�|tj��z}t|��}t|��}t	|��5td�|D����}||z
}t|t��}ddd��n#1swxYwYt|��}	t|||f���Ed{V��|r�|�d}n=|tj��z
}|dkr!tdt|��|fz���|j
�|��|j5|j
}g|_
|j
���ddd��n#1swxYwY|���t||||f���Ed{V��|��|D];}|j5|j�|��ddd��n#1swxYwY�<dS#|D];}|j5|j�|��ddd��n#1swxYwY�<wxYw)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�DK�|]}|jttfv�|V��dSr!rgris  rrlzas_completed.<locals>.<genexpr>�sE����C�C���8� 6��A�A�A��A�A�A�A�C�Cr)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�G�M�	��	�	�@�@��C�C��C�C�C�C�C���x�-��,�R��?�?��@�@�@�@�@�@�@�@�@�@�@����@�@�@�@��H�~�~�H�*�*�8�V�8:�u�>�>�>�	>�	>�	>�	>�	>�	>�	>��	J���#���'�$�.�*:�*:�:���!�#�#�&�;���L�L�-�?9�9�:�:�:�
�L���l�+�+�+���
%�
%�!�2��*,��'���"�"�$�$�$�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%�
������.�x��<>��=�J�J�J�
J�
J�
J�
J�
J�
J�
J�'�	J�0�	*�	*�A���
*�
*��
�!�!�&�)�)�)�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*��	*�	*���	*�	*�A���
*�
*��
�!�!�&�)�)�)�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*��	*���sy�4B�B�B�#A>G�!(E�	G�E�G�E�3G�G�G	�	G	�H�H	�7H�H
�H�
H
�H�DoneAndNotDoneFuturesz
done not_donec��t|��}t|��5d�|D��}||z
}|tkr|rt||��cddd��S|tkr7|r5td�|D����rt||��cddd��St
|��t
|��krt||��cddd��St||��}ddd��n#1swxYwY|j�	|��|D];}|j
5|j�|��ddd��n#1swxYwY�<|�
|j��t|||z
��S)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.
    c�<�h|]}|jttfv�|��Srrgris  r�	<setcomp>zwait.<locals>.<setcomp>"s7��F�F�F�a��h�#9�8�"D�D�D��D�D�DrNc3�jK�|].}|���s|����*|V��/dSr!)r�	exceptionris  rrlzwait.<locals>.<genexpr>(sP����G�G���+�+�-�-�G�,-�K�K�M�M�,E��,E�,E�,E�,E�G�Gr)r<rVrr�r�anyr�rtr$r�r]rorw�updater%)rpr�rq�done�not_donerrrks       rr�r�s���2

�R���B�	��	�	�>�>�F�F�2�F�F�F����9���?�*�*��*�(��x�8�8�>�>�>�>�>�>�>�>��_�,�,�$�,��G�G�d�G�G�G�G�G�
=�,�T�8�<�<�>�>�>�>�>�>�>�>��t�9�9��B�����(��x�8�8�>�>�>�>�>�>�>�>�-�R��=�=��>�>�>�>�>�>�>�>�>�>�>����>�>�>�>� �L���g����
�&�&��
�\�	&�	&�
�J���f�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&��	�K�K��'�(�(�(� ��r�D�y�1�1�1s5�.C4�5C4�/C4�C4�4C8�;C8�$E�E	�E	c��		|�|��|���~S#|���wxYw#~wxYwr!)�result�cancel)�futr�s  r�_result_or_cancelr�:sR���	��:�:�g�&�&��J�J�L�L�L�
�C��
�J�J�L�L�L�L�����
����s�-�A�A�A�A	c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zdd�Z
dd
�Zd�Zd�Zd�Zeej��ZdS)�Futurez5Represents the result of an asynchronous computation.c��tj��|_t|_d|_d|_g|_g|_dS)z8Initializes the future. Should not be called by clients.N)	r"�	Conditionr]rrh�_result�
_exceptionro�_done_callbacksr&s rr(zFuture.__init__Hs<��#�-�/�/��������������
�!����rc��|jD]9}	||���#t$rt�d|��Y�6wxYwdS)N�!exception calling callback for %r)r��	Exception�LOGGERr�)r'�callbacks  r�_invoke_callbackszFuture._invoke_callbacksQss���,�	L�	L�H�
L����������
L�
L�
L�� � �!D�d�K�K�K�K�K�
L����	L�	Ls��%?�?c��|j5|jtkr�|jrKd|jjt
|��t|j|jjjfzcddd��Sd|jjt
|��t|j|jjjfzcddd��Sd|jjt
|��t|jfzcddd��S#1swxYwYdS)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__Xsh��
�_�	;�	;��{�h�&�&��?�9�;���/��4���1�$�+�>���1�:�	?<�<�	;�	;�	;�	;�	;�	;�	;�	;�>���/��4���1�$�+�>���.�7�	A9�9�	;�	;�	;�	;�	;�	;�	;�	;�*��N�+��t�H�H�,�T�[�9�-;�;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�AC1�+>C1�6.C1�1C5�8C5c�B�|j5|jttfvr	ddd��dS|jtt
fvr	ddd��dSt|_|j���ddd��n#1swxYwY|���dS)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�1��	)�	)�	)�	)�	)�	)�	)�	)��{�y�*@�A�A�A��	)�	)�	)�	)�	)�	)�	)�	)�$�D�K��O�&�&�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	
��� � � ��ts�B�B�%B�B�Bc�n�|j5|jttfvcddd��S#1swxYwYdS)z(Return True if the future was cancelled.N)r]rhr	r
r&s rrzFuture.cancelleds���
�_�	F�	F��;�9�.D�"E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�	F�	Fs�*�.�.c�d�|j5|jtkcddd��S#1swxYwYdS)z1Return True if the future is currently executing.N)r]rhrr&s rr
zFuture.running�sx��
�_�	*�	*��;�'�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�	*�	*s�%�)�)c�z�|j5|jtttfvcddd��S#1swxYwYdS)z>Return True if the future was cancelled or finished executing.N)r]rhr	r
rr&s rr�zFuture.done�s���
�_�	P�	P��;�9�.D�h�"O�O�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P����	P�	P�	P�	P�	P�	Ps�0�4�4c�<�|jr	|j�#d}wxYw|jSr!)r�r�r&s r�__get_resultzFuture.__get_result�s1���?�	 �
��o�%���������<�s��c�<�|j5|jtttfvr(|j�|��	ddd��dS	ddd��n#1swxYwY	||��dS#t$rt�	d|��YdSwxYw)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�O��$�+�+�B�/�/�/��	�	�	�	�	�	�	�	�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	H��B�t�H�H�H�H�H���	H�	H�	H����@�$�G�G�G�G�G�G�	H���s#�7A�A� A�%A2�2%B�BNc���	|j5|jttfvrt	���|jt
kr"|���cddd��d}S|j�|��|jttfvrt	���|jt
kr"|���cddd��d}St���#1swxYwY	d}dS#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�sP�� 	���

)�

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

)�

)�

)�

)�

)�

)�

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

)�

)�

)�

)�

)�

)�

)� �D�D�'�.�.�(�

)�

)�

)�

)����

)�

)�

)�

)�

)� �D�D�D��4�D�K�K�K�KsB�C,�AC�C,�A C�?C,�C�C � C,�#C �$C,�,C0c��|j5|jttfvrt	���|jt
kr|jcddd��S|j�|��|jttfvrt	���|jt
kr|jcddd��St���#1swxYwYdS)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�A�$�&�&�&����(�(���	
	%�
	%�
	%�
	%�
	%�
	%�
	%�
	%�
�O� � ��)�)�)��{�y�*@�A�A�A�$�&�&�&����(�(���
	%�
	%�
	%�
	%�
	%�
	%�
	%�
	%�#�n�n�$�
	%�
	%�
	%�
	%����
	%�
	%�
	%�
	%�
	%�
	%s�:B=�AB=�/B=�=C�Cc��|j5|jtkr9t|_|jD]}|�|���	ddd��dS|jtkrt|_	ddd��dSt�	dt|��|j��td���#1swxYwYdS)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�sH��.�_�	A�	A��{�i�'�'�4���"�m�/�/�F��(�(��.�.�.�.��	A�	A�	A�	A�	A�	A�	A�	A����'�'�%����	A�	A�	A�	A�	A�	A�	A�	A���� C� "�4��� $��-�-�-�#�#?�@�@�@�	A�	A�	A�	A����	A�	A�	A�	A�	A�	As�=B9�B9�<=B9�9B=�B=c��|j5|jttthvr(td�|j|�����||_t|_|jD]}|�	|���|j�
��ddd��n#1swxYwY|���dS)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�K�'�
�(9�(9�$�+�t�(L�(L�M�M�M�!�D�L�"�D�K��-�
(�
(���!�!�$�'�'�'�'��O�&�&�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	
��� � � � � ��BB#�#B'�*B'c��|j5|jttthvr(td�|j|�����||_t|_|jD]}|�	|���|j�
��ddd��n#1swxYwY|���dS)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�K�'�
�(9�(9�$�+�t�(L�(L�M�M�M�'�D�O�"�D�K��-�
+�
+���$�$�T�*�*�*�*��O�&�&�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	
��� � � � � r�r!)rrrrr(r�r�r�rr
r�r�r�r�r�r�r�r��classmethod�types�GenericAlias�__class_getitem__rrrr�r�Es������?�?�"�"�"�L�L�L�;�;�;�(���&F�F�F�
*�*�*�
P�P�P�
 � � �H�H�H�(!�!�!�!�F%�%�%�%�D&A�&A�&A�P
!�
!�
!�
!�
!�
!�$��E�$6�7�7���rr�c�@�eZdZdZd�Zddd�d�Zd
dd	�d
�Zd�Zd�ZdS)�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���fd�t|�D������fd�}|��S)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.
        Nc�,��g|]}�j�g|�R���Sr)r�)rjrcr�r's  ��r�
<listcomp>z Executor.map.<locals>.<listcomp>`s-���
A�
A�
A��k�d�k�"�$�t�$�$�$�
A�
A�
Arc3�h�K�	�����r`��$t������V�n8t�����tj��z
��V���`�D]}|����dS#�D]}|����wxYwr!)r�r�rxr~rr�)r-r�rpr�s ���r�result_iteratorz%Executor.map.<locals>.result_iteratords������
$��
�
�����W���/������9�9�9�9�9�9�/������(�T�^�EU�EU�:U�V�V�V�V�V��W�!�$�$�F��M�M�O�O�O�O�$�$��b�$�$�F��M�M�O�O�O�O�$���s�A6B�B1)r~r�zip)r'r�r�r��	iterablesr�r�rps```   @@r�mapzExecutor.mapGst�������,�����!1�!1�1�H�
A�
A�
A�
A�
A��i��
A�
A�
A��	$�	$�	$�	$�	$�	$�	$��� � � rTF)�cancel_futuresc��dS)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�2�|�d���dS)NT)r�F)r�)r'�exc_type�exc_val�exc_tbs    rrdzExecutor.__exit__�s���
�
�4�
� � � ��ur)T)	rrrrr�r�r�r_rdrrrr�r�9s�������M�M�	$�	$�	$�+/�!�*!�*!�*!�*!�*!�X
�E�
�
�
�
�
� �������rr�c��eZdZdZdS)�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�s-��2�
���������������������#��#���
��
���
���	�1������
������Y��Y�
�{��K��j���
��	�/�	0�	0��	�	�	�	�	�I�	�	�	�	�	�	�	�	�U�	�	�	���	�	�	�	�	��	�	�	�
-�
-�
-�
-�
-�f�
-�
-�
-����������,
�
�
�
�
�G�
�
�
�(�(�(�(�(�'�(�(�(�<(�(�(�(�(�f�(�(�(����,���,<*�<*�<*�<*�|/��.���2�2���}�02�02�02�02�f����r8�r8�r8�r8�r8�V�r8�r8�r8�hO�O�O�O�O�v�O�O�O�d�����\�����r

?>