Your IP : 3.145.88.233


Current Path : /opt/alt/python313/lib64/python3.13/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/concurrent/futures/__pycache__/_base.cpython-313.pyc

�

���g1Y�
���SrSSKrSSKrSSKrSSKrSSKrSrSrSrSr	Sr
SrS	rS
r
Sr\
\\\
\/r\
S\S
\S\
S\S0r\R""S5r"SS\5r"SS\5r\r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS \5rS!rS"rS.S#jr \RB"S$S%5r"S\4S&jr#S.S'jr$"S(S)\5r%"S*S+\5r&"S,S-\'5r(g)/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��\rSrSrSrSrg)�Error�-z-Base class for all future-related exceptions.�N��__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��?/opt/alt/python313/lib64/python3.13/concurrent/futures/_base.pyrr-s��7�rrc��\rSrSrSrSrg)�CancelledError�1zThe Future was cancelled.rNrrrrrr1s��#�rrc��\rSrSrSrSrg)�InvalidStateError�7z+The operation is not allowed in this state.rNrrrrr!r!7s��5�rr!c�0�\rSrSrSrSrSrSrSrSr	g)	�_Waiter�;z;Provides the event that wait() and as_completed() block on.c�F�[R"5Ul/Ulg�N)�	threading�Event�event�finished_futures��selfs r�__init__�_Waiter.__init__=s���_�_�&��
� "��rc�:�URRU5 gr'�r+�append�r-�futures  r�
add_result�_Waiter.add_resultA������$�$�V�,rc�:�URRU5 gr'r1r3s  r�
add_exception�_Waiter.add_exceptionDr7rc�:�URRU5 gr'r1r3s  r�
add_cancelled�_Waiter.add_cancelledGr7r)r*r+N)
rrrrrr.r5r9r<rrrrr$r$;s��E�#�-�-�-rr$c�P^�\rSrSrSrU4SjrU4SjrU4SjrU4SjrSr	U=r
$)�_AsCompletedWaiter�JzUsed by as_completed().c�^>�[[U]5 [R"5Ulgr')�superr?r.r(�Lock�lock)r-�	__class__s �rr.�_AsCompletedWaiter.__init__Ms���
� �$�0�2��N�N�$��	rc�>�UR [[U]U5 URR5 SSS5 g!,(df   g=fr')rDrBr?r5r*�set�r-r4rEs  �rr5�_AsCompletedWaiter.add_resultQs2���
�Y�Y��$�d�6�v�>��J�J�N�N���Y�Y���.A�
Ac�>�UR [[U]U5 URR5 SSS5 g!,(df   g=fr')rDrBr?r9r*rHrIs  �rr9� _AsCompletedWaiter.add_exceptionV�2���
�Y�Y��$�d�9�&�A��J�J�N�N���Y�Y�rKc�>�UR [[U]U5 URR5 SSS5 g!,(df   g=fr')rDrBr?r<r*rHrIs  �rr<� _AsCompletedWaiter.add_cancelled[rNrK)rD)rrrrrr.r5r9r<r�
__classcell__�rEs@rr?r?Js���!�%��
�
�rr?c�D^�\rSrSrSrU4SjrU4SjrU4SjrSrU=r	$)�_FirstCompletedWaiter�`z*Used by wait(return_when=FIRST_COMPLETED).c�X>�[TU]U5 URR5 gr')rBr5r*rHrIs  �rr5� _FirstCompletedWaiter.add_resultcs���
���6�"��
�
���rc�X>�[TU]U5 URR5 gr')rBr9r*rHrIs  �rr9�#_FirstCompletedWaiter.add_exceptiong����
���f�%��
�
���rc�X>�[TU]U5 URR5 gr')rBr<r*rHrIs  �rr<�#_FirstCompletedWaiter.add_cancelledkrZrr)
rrrrrr5r9r<rrQrRs@rrTrT`s���4����rrTc�V^�\rSrSrSrU4SjrSrU4SjrU4SjrU4Sjr	Sr
U=r$)	�_AllCompletedWaiter�oz<Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED).c�n>�XlX l[R"5Ul[
TU]5 gr')�num_pending_calls�stop_on_exceptionr(rCrDrBr.)r-rarbrEs   �rr.�_AllCompletedWaiter.__init__rs(���!2��!2���N�N�$��	�
���rc���UR U=RS-slUR(dURR5 SSS5 g!,(df   g=f)N�)rDrar*rHr,s r�_decrement_pending_calls�,_AllCompletedWaiter._decrement_pending_callsxs;��
�Y�Y��"�"�a�'�"��)�)��
�
��� ��Y�Y�s�AA�
A%c�D>�[TU]U5 UR5 gr')rBr5rfrIs  �rr5�_AllCompletedWaiter.add_result~s���
���6�"��%�%�'rc�>�[TU]U5 UR(aURR	5 gUR5 gr')rBr9rbr*rHrfrIs  �rr9�!_AllCompletedWaiter.add_exception�s3���
���f�%��!�!��J�J�N�N���)�)�+rc�D>�[TU]U5 UR5 gr')rBr<rfrIs  �rr<�!_AllCompletedWaiter.add_cancelled�s���
���f�%��%�%�'r)rDrarb)rrrrrr.rfr5r9r<rrQrRs@rr^r^os$���F��!�(�,�(�(rr^c�*�\rSrSrSrSrSrSrSrg)�_AcquireFutures�zDA context manager that does an ordered acquire of Future conditions.c�*�[U[S9Ulg)N)�key)�sorted�id�futures)r-rus  rr.�_AcquireFutures.__init__�s���g�2�.��rc�^�URHnURR5 M gr')ru�
_condition�acquirer3s  r�	__enter__�_AcquireFutures.__enter__��"���l�l�F����%�%�'�#rc�^�URHnURR5 M gr')rurx�release)r-�argsr4s   r�__exit__�_AcquireFutures.__exit__�r|r)ruN)	rrrrrr.rzr�rrrrroro�s��N�/�(�(rroc�6�U[:Xa[5nO_U[:Xa[5nOJ[	SU55nU[
:Xa[
USS9nO#U[:Xa[
USS9nO[SU-5eUHnURRU5 M  U$)Nc3�R# �UHoR[[4;v� M g7fr'��_stater
r��.0�fs  r�	<genexpr>�._create_and_install_waiters.<locals>.<genexpr>�s!���P�LN�q���!7�� B�B�B�s�%'T)rbFzInvalid return condition: %r)rr?rrT�sumrr^r�
ValueError�_waitersr2)�fs�return_when�waiter�
pending_countr�s     r�_create_and_install_waitersr��s����m�#�#�%��	��	'�&�(���P�LN�P�P�
��/�)�(��$�O�F�
�M�
)�(��%�P�F��;�k�I�J�J�
��	�
�
���&�!���Mrc#�# �U(alUSnUHnURU5 M UR URRU5 SSS5 AUR5v� U(aMkgg!,(df   N,=f7f)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)�removerxr��pop)r�r��ref_collectr��futures_sets     r�_yield_finished_futuresr��se���
��r�F��&�K����q�!�'�
�\�\�
�J�J���f�%��
��f�f�h��
�"��\�s"�3B�A7�"B�5B�7
B�Bc	#�B# �UbU[R"5-n[U5n[U5n[	U5 [SU55nX-
n[U[5nSSS5 [W5n[UWU4S9Shv�N W(a�UcSnO7W[R"5-
nUS:a[S[U5U4-5eURRU5 UR URn/Ul
URR5 SSS5 UR5 [XFX4S9Shv�N U(aM�UH3nUR  UR"R%U5 SSS5 M5 g!,(df   GN6=fGN!,(df   N�=fNm!,(df   Mo=f!UHEnUR  UR"R%W5 SSS5 M5!,(df   MD=f f=f7f)a:An 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�^# �UH#nUR[[4;dMUv� M% g7fr'r�r�s  rr��as_completed.<locals>.<genexpr>�s+���C��a��8�8� 6��A�A���2�s�-�	-)r�rz%d (of %d) futures unfinished)�time�	monotonicrH�lenror�r�listr��TimeoutErrorr*�waitrDr+�clear�reverserxr�r�)	r��timeout�end_time�
total_futuresrrr��wait_timeoutr�s	         r�as_completedr��s����$���T�^�^�-�-��	�R��B���G�M�	��	��C��C�C���-��,�R��?��
��H�~�H�*�*�8�V�8:�u�>�	>�	>����#��'�$�.�.�*:�:���!�#�&�;���L�-�?9�9�:�:�
�L�L���l�+����!�2�2��*,��'����"�"�$��
����.�x�<>�=�J�
J�
J�'�g�0�A�����
�
�!�!�&�)����G
�	��	>����
J�����A�����
�
�!�!�&�)�������s��=H�'F�&H�:G�	F'�
A/G�9.F*�'&G�
F;�G�H�,F=�
H�
F$�H�'G�*
F8�4G�=
G	�H�H�!H	�=
H�
H
�H�H�DoneAndNotDoneFuturesz
done not_donec��[U5n[U5 UVs1sH!nUR[[4;dMUiM# nnX-
nU[
:XaU(a[
XE5sSSS5 $U[:Xa2U(a+[SU55(a[
XE5sSSS5 $[U5[U5:Xa[
XE5sSSS5 $[X5nSSS5 WRRU5 UH3nUR URRU5 SSS5 M5 WR!UR"5 [
X@U-
5$s snf!,(df   N�=f!,(df   M�=f)aWait 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�z# �UH1nUR5(aMUR5cM-Uv� M3 g7fr')r�	exceptionr�s  rr��wait.<locals>.<genexpr>(s/���G�d���+�+�-��,-�K�K�M��1�d�s�;�;�	;)rHror�r
rrr�r�anyr�r�r*r�rxr�r��updater+)r�r�r�r��done�not_doner�s       rr�r�sI��2

�R��B�	��	��F�2�a��h�h�#9�8�"D�D��2��F��9���?�*��(��8�
�	��_�,�$��G�d�G�G�G�,�T�<�
�	��t�9��B���(��8�
�	�-�R�=��
� �L�L���g��
��
�\�\�
�J�J���f�%��\��	�K�K��'�'�(� ��D�y�1�1��+F�
�	��$�\�s?�E,�E'�E'�!E,�/2E,�+"E,�E,�E=�'E,�,
E:�=
F	c��URU5UR5 A$!UR5 f=f!Af=fr')�result�cancel)�futr�s  r�_result_or_cancelr�:s9���	��:�:�g�&��J�J�L�
��
�J�J�L��
�s�%�:�7�:�=c��\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SS
jrSSjrSrSrSr\"\R*5rSrg)�FutureiEz5Represents the result of an asynchronous computation.c��[R"5Ul[UlSUlSUl/Ul/Ulg)z8Initializes the future. Should not be called by clients.N)	r(�	Conditionrxrr��_result�
_exceptionr��_done_callbacksr,s rr.�Future.__init__Hs6��#�-�-�/��������������
�!��rc��URHnU"U5 M g![a [RSU5 M4f=f)N�!exception calling callback for %r)r��	Exception�LOGGERr�)r-�callbacks  r�_invoke_callbacks�Future._invoke_callbacksQsC���,�,�H�
L����-���
L�� � �!D�d�K�
L�s�� A�Ac�~�UR UR[:Xa�UR(a^SURR
[
U5[URURRR
4-sSSS5 $SURR
[
U5[URURRR
4-sSSS5 $SURR
[
U5[UR4-sSSS5 $!,(df   g=f)Nz<%s at %#x state=%s raised %s>z <%s at %#x state=%s returned %s>z<%s at %#x state=%s>)	rxr�rr�rErrt�_STATE_TO_DESCRIPTION_MAPr�r,s r�__repr__�Future.__repr__Xs���
�_�_��{�{�h�&��?�?�;����/�/��4��1�$�+�+�>����1�1�:�:�	?<�<��_�>����/�/��4��1�$�+�+�>����.�.�7�7�	A9�9��_�*��N�N�+�+��t�H�,�T�[�[�9�-;�;��_�_�s�A:D.�AD.�/5D.�.
D<c�J�UR UR[[4;a
SSS5 gUR[[
4;a
SSS5 g[UlURR
5 SSS5 UR5 g!,(df   N=f)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)rxr�rrr	r
�
notify_allr�r,s rr��
Future.cancells{���_�_��{�{�w��1�1���_��{�{�y�*@�A�A���_�$�D�K��O�O�&�&�(��	
��� ���_�s�B�B�%B�
B"c��UR UR[[4;sSSS5 $!,(df   g=f)z(Return True if the future was cancelled.N)rxr�r	r
r,s rr�Future.cancelleds%��
�_�_��;�;�9�.D�"E�E��_�_�s�0�
>c�v�UR UR[:HsSSS5 $!,(df   g=f)z1Return True if the future is currently executing.N)rxr�rr,s rr
�Future.running�s��
�_�_��;�;�'�)��_�_�s�*�
8c��UR UR[[[4;sSSS5 $!,(df   g=f)z>Return True if the future was cancelled or finished executing.N)rxr�r	r
rr,s rr��Future.done�s'��
�_�_��;�;�9�.D�h�"O�O��_�_�s	�5�
Ac�d�UR(a
UReUR$!Snf=fr')r�r�r,s r�__get_result�Future.__get_result�s-���?�?�
��o�o�%�
�<�<�����s�+�/c�8�UR UR[[[4;a%UR
R
U5 SSS5 gSSS5 U"U5 g!,(df   N=f![a [RSU5 gf=f)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�)
rxr�r	r
rr�r2r�r�r�)r-�fns  r�add_done_callback�Future.add_done_callback�s}���_�_��{�{�9�.D�h�"O�O��$�$�+�+�B�/���_�O��	H��t�H��_���	H����@�$�G�	H�s�<A%�A6�%
A3�6 B�BNc���UR UR[[4;a
[	5eUR[
:XaUR
5sSSS5 Sn$URRU5 UR[[4;a
[	5eUR[
:XaUR
5sSSS5 Sn$[5e!,(df   O=fSng!Snf=f)a�Return 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)	rxr�r	r
rr�_Future__get_resultr�r��r-r�s  rr��
Future.result�s��� 	�����;�;�9�.D�"E�E�(�*�*��[�[�H�,��,�,�.�	!�� �D����$�$�W�-��;�;�9�.D�"E�E�(�*�*��[�[�H�,��,�,�.�!�� �D�'�.�(�!���� �D��4�D�s6�C/�AC�	C/�"A"C�	C/�
C�
C(�$C/�/C3c��UR UR[[4;a
[	5eUR[
:XaURsSSS5 $URRU5 UR[[4;a
[	5eUR[
:XaURsSSS5 $[5e!,(df   g=f)a�Return 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)	rxr�r	r
rrr�r�r�r�s  rr��Future.exception�s���$�_�_��{�{�y�*@�A�A�$�&�&�����(����	�_�
�O�O� � ��)��{�{�y�*@�A�A�$�&�&�����(�����_�#�n�$��_�s�AC
�AC
�
C
�
Cc��UR UR[:Xa9[UlURHnURU5 M SSS5 gUR[:Xa[UlSSS5 g[RS[U5UR5 [S5e!,(df   g=f)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)rxr�r	r
r�r<rrr��criticalrt�RuntimeError)r-r�s  r�set_running_or_notify_cancel�#Future.set_running_or_notify_cancel�s���.�_�_��{�{�i�'�4���"�m�m�F��(�(��.�,���_�����'�%�����_���� C� "�4�� $���-�#�#?�@�@��_�s�AB9� B9�5B9�9
Cc��UR UR[[[1;a%[SR
URU55eXl[UlURHnURU5 M URR5 SSS5 UR5 g!,(df   N=f)z{Sets the return value of work associated with the future.

Should only be used by Executor implementations and unit tests.
�{}: {!r}N)rxr�r	r
rr!�formatr�r�r5r�r�)r-r�r�s   r�
set_result�Future.set_results���
�_�_��{�{�y�*@�(�K�K�'�
�(9�(9�$�+�+�t�(L�M�M�!�L�"�D�K��-�-���!�!�$�'�(��O�O�&�&�(��	
��� ��_���BB:�:
Cc��UR UR[[[1;a%[SR
URU55eXl[UlURHnURU5 M URR5 SSS5 UR5 g!,(df   N=f)z}Sets the result of the future as being the given exception.

Should only be used by Executor implementations and unit tests.
r�N)rxr�r	r
rr!r�r�r�r9r�r�)r-r�r�s   r�
set_exception�Future.set_exception(s���
�_�_��{�{�y�*@�(�K�K�'�
�(9�(9�$�+�+�t�(L�M�M�'�O�"�D�K��-�-���$�$�T�*�(��O�O�&�&�(��	
��� ��_�r�)rxr�r�r�r�r�r')rrrrrr.r�r�r�rr
r�r�r�r�r�r�r�r��classmethod�types�GenericAlias�__class_getitem__rrrrr�r�Esf��?�"�L�;�(�&F�
*�
P�
 �H�(!�F%�D&A�P
!�
!�$�E�$6�$6�7�rr�c�L�\rSrSrSrSrSSS.SjrSSS	.S
jjrSrSr	S
r
g)�Executori9zCThis is an abstract base class for concrete asynchronous executors.c��[5e)z�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�r�kwargss    r�submit�Executor.submit<s
��"�#�#rNre)r��	chunksizec�^^^�TbT[R"5-m[U6Vs/sHoPR"U/UQ76PM snmUUU4SjnU"5$s snf)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�`># �TR5 T(aZTc[TR55v� O2[TR5T[R"5-
5v� T(aMZTHnUR5 M g!THnUR5 M f=f7fr')r�r�r�r�r�r�)r4r�r�r�s ���r�result_iterator�%Executor.map.<locals>.result_iteratords{����
$��
�
�����/�����9�9�/�����(�T�^�^�EU�:U�V�V��b�!�F��M�M�O�!��b�F��M�M�O�!�s�B.�A/B�6B.�B+�+B.)r�r��zipr�)	r-r�r�r��	iterablesrr�r�r�s	  `    @@r�map�Executor.mapGsV���,������!1�1�H�14�i��
A���k�k�"�$�t�$��
A��	$�� � ��#Bs�AF)�cancel_futuresc��g)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�rs   r�shutdown�Executor.shutdownss��	
rc��U$r'rr,s rrz�Executor.__enter__�s���rc�"�URSS9 g)NT)r�F)r)r-�exc_type�exc_val�exc_tbs    rr��Executor.__exit__�s���
�
�4�
� �rr)T)rrrrrr�rrrzr�rrrrr�r�9s-��M�	$�+/�!�*!�X
�E�
� �rr�c��\rSrSrSrSrg)�BrokenExecutori�zJ
Raised when a executor has become non-functional after a severe failure.
rNrrrrrr�s��rrr'))�
__author__�collections�loggingr(r�r�rrrrrrr	r
r�_FUTURE_STATESr��	getLoggerr�r�rrr�r!�objectr$r?rTr^ror�r�r��
namedtupler�r�r�r�r�r�rrrr�<module>rsb��2�
������#��#���
��
���
���	�1������
������Y��Y�
�{��K��j���
�	�	�/�	0��	�I�	�	�U�	���	��	�
-�f�
-����,
�G�
�(�'�(�<(�f�(��,�,<*�|$�.�.���2���}�02�f�r8�V�r8�hO�v�O�d�\�r

?>