%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���f������dZddlZddlZddlZddlZddlmZ	ddl
mZddlm
Z	ddlmZgd�Zej*Zej.Zej2Zej6Zej8Z	ej:Z	ej>Zd	Z ejCd
�ejDZ#	ejHZ%ejLZ&[da'da(d�Z)d
�Z*d�Z+d�Z,d�Z-d�Z.eZ/d�Z$Gd�d�Z0e0Z1Gd�d�Z2Gd�d�Z3Gd�de3�Z4Gd�d�Z5Gd�d�Z6Gd�d e7�Z8ed!�jrZ:d"�Z;e$�a<iZ=iZ>e�Z?e�a@eA�aBd#�ZCGd$�d%�ZD	dd&lmEaFmGZHt�ZMd-�ZNGd.�d/eD�ZOGd0�d1eD�ZPGd2�d3eD�ZQd4�ZRd5�ZSd6�ZTd7�ZUd8�ZVd9�ZWgZXdaYd:�ZZdd;lm[Z[eP�a\d<�Z]d=�Z^	dd>lm_Z`d@�ZbecedA�rej�eb�B�yy#e$r
ddlmZY���wxYw#e$rd�ZY���wxYw#e$rdZ Y��wxYw#e$rdZ%Y��twxYw#e$rdd'lImJZKdd(lmLZLeLd)d*�ZGd+�ZHd,�aFY��wxYw#e$r	dd?lam`Z`Y��wxYw)Cz;Thread module emulating a subset of Java's threading model.�N)�	monotonic)�WeakSet)�count)�deque)�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgs�gettrace�
getprofile�setprofile_all_threads�settrace_all_threadsc��y�NT�r$�� /usr/lib/python3.12/threading.py�_is_main_interpreterr'4s��r%T�
get_native_idFc��|ay)z�Set a profile function for all threads started from the threading module.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.
    N��
_profile_hook��funcs r&rrJs	���Mr%c�D�t|�tj|�y)z�Set a profile function for all threads started from the threading module
    and all Python threads that are currently executing.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.
    N)r�_sys�_setprofileallthreadsr,s r&r r Ss���t�����t�$r%c��tS)z;Get the profiler function as set by threading.setprofile().r*r$r%r&rr]s���r%c��|ay)z�Set a trace function for all threads started from the threading module.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.
    N��_trace_hookr,s r&rras	���Kr%c�D�t|�tj|�y)z�Set a trace function for all threads started from the threading module
    and all Python threads that are currently executing.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.
    N)rr/�_settraceallthreadsr,s r&r!r!js��
�T�N����T�"r%c��tS)z6Get the trace function as set by threading.settrace().r3r$r%r&rrts���r%c�:�t�t|i|��St|i|��S)a2Factory function that returns a new reentrant lock.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it again
    without blocking; the thread must release it once for each time it has
    acquired it.

    )�_CRLock�_PyRLock)�args�kwargss  r&rr|s)������(��(�(��D�#�F�#�#r%c�R�eZdZdZd�Zd�Zd�Zd
d�ZeZd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)�_RLocka,This class implements reentrant lock objects.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it
    again without blocking; the thread must release it once for each time it
    has acquired it.

    c�>�t�|_d|_d|_y�Nr)�_allocate_lock�_block�_owner�_count��selfs r&�__init__z_RLock.__init__�s��$�&��������r%c�6�|j}	t|j}d|jj�rdnd|jj|jj||jtt|��fzS#t$rY�vwxYw)Nz)<%s %s.%s object owner=%r count=%d at %s>�locked�unlocked)rC�_active�name�KeyErrorrBrI�	__class__�
__module__�__qualname__rD�hex�id)rF�owners  r&�__repr__z_RLock.__repr__�s�������	��E�N�'�'�E�;����*�*�,�H�*��N�N�%�%��N�N�'�'���K�K���4��M�
>
�
�	
���	��	�s�B�	B�Bc�T�|jj�d|_d|_yr@)rB�_at_fork_reinitrCrDrEs r&rVz_RLock._at_fork_reinit�s �����#�#�%������r%c��t�}|j|k(r|xjdz
c_y|jj	||�}|r||_d|_|S)aAcquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        When invoked with the floating-point timeout argument set to a positive
        value, block for at most the number of seconds specified by timeout
        and as long as the lock cannot be acquired.  Return true if the lock has
        been acquired, false if the timeout has elapsed.

        �)rrCrDrB�acquire)rF�blocking�timeout�me�rcs     r&rYz_RLock.acquire�sT��4�[���;�;�"���K�K�1��K��
�[�[�
 �
 ��7�
3��
��D�K��D�K��	r%c��|jt�k7rtd��|jdz
x|_}|s"d|_|jj�yy)amRelease a lock, decrementing the recursion level.

        If after the decrement it is zero, reset the lock to unlocked (not owned
        by any thread), and if any other threads are blocked waiting for the
        lock to become unlocked, allow exactly one of them to proceed. If after
        the decrement the recursion level is still nonzero, the lock remains
        locked and owned by the calling thread.

        Only call this method when the calling thread owns the lock. A
        RuntimeError is raised if this method is called when the lock is
        unlocked.

        There is no return value.

        �cannot release un-acquired lockrXN)rCr�RuntimeErrorrDrB�release)rFrs  r&raz_RLock.release�sQ�� �;�;�)�+�%��@�A�A�"�k�k�A�o�-���e���D�K��K�K���!�r%c�$�|j�y�N�ra�rF�t�v�tbs    r&�__exit__z_RLock.__exit__�������r%c�V�|jj�|\|_|_yrc)rBrYrDrC)rF�states  r&�_acquire_restorez_RLock._acquire_restore�s ��������#(� ���T�[r%c��|jdk(rtd��|j}d|_|j}d|_|jj	�||fS)Nrr_)rDr`rCrBra)rFrrSs   r&�
_release_savez_RLock._release_save�sT���;�;�!���@�A�A����������������������u�~�r%c�0�|jt�k(Src)rCrrEs r&�	_is_ownedz_RLock._is_owned�s���{�{�i�k�)�)r%c�J�|jt�k7ry|jSr@)rCrrDrEs r&�_recursion_countz_RLock._recursion_counts���;�;�)�+�%���{�{�r%N�T���)�__name__rOrP�__doc__rGrTrVrY�	__enter__rarirmrorqrsr$r%r&r>r>�sA����


��
"�H�I�"�.�
)��*�
r%r>c�f�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zdd�Zdd�Z
dd
�Zd�Zd�Zy)r	ajClass that implements a condition variable.

    A condition variable allows one or more threads to wait until they are
    notified by another thread.

    If the lock argument is given and not None, it must be a Lock or RLock
    object, and it is used as the underlying lock. Otherwise, a new RLock object
    is created and used as the underlying lock.

    Nc�:�|�
t�}||_|j|_|j|_t	|d�r|j
|_t	|d�r|j|_t	|d�r|j|_t�|_	y)Nrormrq)
r�_lockrYra�hasattrrormrq�_deque�_waiters�rF�locks  r&rGzCondition.__init__s|���<��7�D���
��|�|����|�|����4��)�!%�!3�!3�D���4�+�,�$(�$9�$9�D�!��4��%�!�^�^�D�N����
r%c�l�|jj�|jj�yrc)r{rVr~�clearrEs r&rVzCondition._at_fork_reinit's"���
�
�"�"�$��
�
���r%c�6�|jj�Src)r{rxrEs r&rxzCondition.__enter__+s���z�z�#�#�%�%r%c�4�|jj|�Src)r{ri)rFr;s  r&rizCondition.__exit__.s��"�t�z�z�"�"�D�)�)r%c�J�d|jt|j�fzS)Nz<Condition(%s, %d)>)r{�lenr~rEs r&rTzCondition.__repr__1s��$��
�
�C��
�
�4F�'G�G�Gr%c�8�|jj�yrc)r{rarEs r&rozCondition._release_save4����
�
���r%c�8�|jj�yrc)r{rY)rF�xs  r&rmzCondition._acquire_restore7r�r%c�p�|jjd�r|jj�yy)NFT)r{rYrarEs r&rqzCondition._is_owned:s,���:�:���e�$��J�J��� ��r%c�N�|j�std��t�}|j�|jj|�|j
�}d}	|�|j�d}n)|dkDr|jd|�}n|jd�}||j|�|s	|jj|�SS#t$rYSwxYw#|j|�|s,	|jj|�w#t$rYwwxYwwxYw)akWait until notified or until a timeout occurs.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method releases the underlying lock, and then blocks until it is
        awakened by a notify() or notify_all() call for the same condition
        variable in another thread, or until the optional timeout occurs. Once
        awakened or timed out, it re-acquires the lock and returns.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        When the underlying lock is an RLock, it is not released using its
        release() method, since this may not actually unlock the lock when it
        was acquired multiple times recursively. Instead, an internal interface
        of the RLock class is used, which really unlocks it even when it has
        been recursively acquired several times. Another internal interface is
        then used to restore the recursion level when the lock is reacquired.

        zcannot wait on un-acquired lockFTr)
rqr`rArYr~�appendrorm�remove�
ValueError)rFr[�waiter�saved_state�gotits     r&�waitzCondition.waitCs��.�~�~���@�A�A��!�������
�
���V�$��(�(�*����	������ ����Q�;�"�N�N�4��9�E�"�N�N�5�1�E���!�!�+�.����M�M�(�(��0���"�����	
�!�!�+�.����M�M�(�(��0��!������sB�$?C#�7C�	C �C �#D$�8D�D$�	D �D$�D � D$c��d}|}|�}|sB|�%|�t�|z}n|t�z
}|dkr	|S|j|�|�}|s�B|S)z�Wait until a condition evaluates to True.

        predicate should be a callable which result will be interpreted as a
        boolean value.  A timeout may be provided giving the maximum time to
        wait.

        Nr)�_timer�)rF�	predicater[�endtime�waittime�results      r&�wait_forzCondition.wait_forssm�����������#��?�#�g��0�G�&���0�H��1�}���
�
�I�I�h���[�F���
r%c��|j�std��|j}|r=|dkDr7|d}	|j�|dz}	|j	|�|r|dkDr�5yyyy#t$rY�)wxYw#t
$rY�&wxYw)aKWake up one or more threads waiting on this condition, if any.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method wakes up at most n of the threads waiting for the condition
        variable; it is a no-op if no threads are waiting.

        z!cannot notify on un-acquired lockrrXN)rqr`r~rar�r�)rF�n�waitersr�s    r&�notifyzCondition.notify�s����~�~���B�C�C��-�-���!�a�%��Q�Z�F�	
���� ��Q���
����v�&��!�a�%�g�%�g�� �
�
�
���
��
�s#�A(�A7�(	A4�3A4�7	B�Bc�L�|jt|j��y)z�Wake up all threads waiting on this condition.

        If the calling thread has not acquired the lock when this method
        is called, a RuntimeError is raised.

        N)r�r�r~rEs r&�
notify_allzCondition.notify_all�s��	
���C��
�
�&�'r%c�\�ddl}|jdtd��|j�y)zvWake up all threads waiting on this condition.

        This method is deprecated, use notify_all() instead.

        rNz3notifyAll() is deprecated, use notify_all() instead���
stacklevel)�warnings�warn�DeprecationWarningr��rFr�s  r&�	notifyAllzCondition.notifyAll�s*��	��
�
�K�(�Q�	�	8����r%rc�rX)rvrOrPrwrGrVrxrirTrormrqr�r�r�r�r�r$r%r&r	r		sJ��	�!�$�&�*�H����.�`�.�<(�	r%r	c�8�eZdZdZdd�Zd�Zd	d�ZeZdd�Zd�Z	y)
raGThis class implements semaphore objects.

    Semaphores manage a counter representing the number of release() calls minus
    the number of acquire() calls, plus an initial value. The acquire() method
    blocks if necessary until it can return without making the counter
    negative. If not given, value defaults to 1.

    c�b�|dkrtd��tt��|_||_y)Nrz$semaphore initial value must be >= 0)r�r	r�_cond�_value)rF�values  r&rGzSemaphore.__init__�s*���1�9��C�D�D��t�v�&��
���r%c	��|j}d|j�d|j�dt|�d�d|j�d�	S)N�<�.� at �#x�: value=�>)rNrOrPrRr��rF�clss  r&rTzSemaphore.__repr__�sK���n�n���C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H��+�+��a�)�	*r%Nc�b�|s
|�td��d}d}|j5|jdk(rS|sng|�#|�t�|z}n|t�z
}|dkrnB|jj	|�|jdk(r�S|xjdzc_d}ddd�|S#1swY|SxYw)a�Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.

        When invoked with a timeout other than None, it will block for at
        most timeout seconds.  If acquire does not complete successfully in
        that interval, return false.  Return true otherwise.

        Nz.can't specify timeout for non-blocking acquireFrrXT)r�r�r�r�r�)rFrZr[r]r�s     r&rYzSemaphore.acquire�s���0�G�/��M�N�N�
����
�Z�Z�	��+�+��"����&���"'�'�G�"3��")�E�G�"3��"�a�<�!��
�
����(��+�+��"����q� ����	��	�	��	�s�A"B$�B$�$B.c���|dkrtd��|j5|xj|z
c_|jj|�ddd�y#1swYyxYw)z�Release a semaphore, incrementing the internal counter by one or more.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        rX�n must be one or moreN)r�r�r�r��rFr�s  r&razSemaphore.releasesS��
�q�5��4�5�5�
�Z�Z�	!��K�K�1��K��J�J���a� �	!�	!�	!�s�1A�A c�$�|j�yrcrdres    r&rizSemaphore.__exit__rjr%r�)TN)
rvrOrPrwrGrTrYrxrarir$r%r&rr�s(����*�
+�Z�I�!�r%rc�2��eZdZdZd�fd�	Zd�Zdd�Z�xZS)ra�Implements a bounded semaphore.

    A bounded semaphore checks to make sure its current value doesn't exceed its
    initial value. If it does, ValueError is raised. In most situations
    semaphores are used to guard resources with limited capacity.

    If the semaphore is released too many times it's a sign of a bug. If not
    given, value defaults to 1.

    Like regular semaphores, bounded semaphores manage a counter representing
    the number of release() calls minus the number of acquire() calls, plus an
    initial value. The acquire() method blocks if necessary until it can return
    without making the counter negative. If not given, value defaults to 1.

    c�2��t�|�|�||_yrc)�superrG�_initial_value)rFr�rNs  �r&rGzBoundedSemaphore.__init__%s���
�����#��r%c��|j}d|j�d|j�dt|�d�d|j�d|j
�d�S)Nr�r�r�r�r��/r�)rNrOrPrRr�r�r�s  r&rTzBoundedSemaphore.__repr__)sY���n�n���C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H��+�+��a��(;�(;�'<�A�?�	@r%c��|dkrtd��|j5|j|z|jkDrtd��|xj|z
c_|jj	|�ddd�y#1swYyxYw)a>Release a semaphore, incrementing the internal counter by one or more.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        If the number of releases exceeds the number of acquires,
        raise a ValueError.

        rXr�z!Semaphore released too many timesN)r�r�r�r�r�r�s  r&razBoundedSemaphore.release.su��
�q�5��4�5�5�
�Z�Z�	!��{�{�Q���!4�!4�4� �!D�E�E��K�K�1��K��J�J���a� �		!�	!�	!�s�AA>�>Br�)rvrOrPrwrGrTra�
__classcell__)rNs@r&rrs���� $�@�
!r%rc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd
�Zy	)rz�Class implementing event objects.

    Events manage a flag that can be set to true with the set() method and reset
    to false with the clear() method. The wait() method blocks until the flag is
    true.  The flag is initially false.

    c�B�tt��|_d|_y)NF)r	rr��_flagrEs r&rGzEvent.__init__Ls���t�v�&��
���
r%c	��|j}|jrdnd}d|j�d|j�dt	|�d�d|�d�	S)	N�set�unsetr�r�r�r�z: r�)rNr�rOrPrR)rFr��statuss   r&rTzEvent.__repr__PsL���n�n���*�*��'���3�>�>�"�!�C�$4�$4�#5�T�"�T�(�2��b���PQ�R�Rr%c�8�|jj�yrc)r�rVrEs r&rVzEvent._at_fork_reinitUs���
�
�"�"�$r%c��|jS)z5Return true if and only if the internal flag is true.)r�rEs r&�is_setzEvent.is_setYs���z�z�r%c�Z�ddl}|jdtd��|j�S)zyReturn true if and only if the internal flag is true.

        This method is deprecated, use is_set() instead.

        rNz+isSet() is deprecated, use is_set() insteadr�r�)r�r�r�r�r�s  r&�isSetzEvent.isSet]s,��	��
�
�C�(�Q�	�	8��{�{�}�r%c��|j5d|_|jj�ddd�y#1swYyxYw)z�Set the internal flag to true.

        All threads waiting for it to become true are awakened. Threads
        that call wait() once the flag is true will not block at all.

        TN)r�r�r�rEs r&r�z	Event.seths7���Z�Z�	$��D�J��J�J�!�!�#�	$�	$�	$�s	�"8�Ac�T�|j5d|_ddd�y#1swYyxYw)z�Reset the internal flag to false.

        Subsequently, threads calling wait() will block until set() is called to
        set the internal flag to true again.

        FN)r�r�rEs r&r�zEvent.clearss'���Z�Z�	��D�J�	�	�	�s��'Nc��|j5|j}|s|jj|�}|cddd�S#1swYyxYw)aHBlock until the internal flag is true.

        If the internal flag is true on entry, return immediately. Otherwise,
        block until another thread calls set() to set the flag to true, or until
        the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        This method returns the internal flag on exit, so it will always return
        True except if a timeout is given and the operation times out.

        N)r�r�r�)rFr[�signaleds   r&r�z
Event.wait}sA���Z�Z�	��z�z�H���:�:�?�?�7�3���		�	�	�s�+A�Arc)rvrOrPrwrGrTrVr�r�r�r�r�r$r%r&rrAs0����S�
%��	�	$��r%rc��eZdZdZdd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ed
��Zed��Zed��Zy)rz�Implements a Barrier.

    Useful for synchronizing a fixed number of threads at known synchronization
    points.  Threads block on 'wait()' and are simultaneously awoken once they
    have all made that call.

    Nc�z�tt��|_||_||_||_d|_d|_y)aWCreate a barrier, initialised to 'parties' threads.

        'action' is a callable which, when supplied, will be called by one of
        the threads after they have all entered the barrier and just prior to
        releasing them all. If a 'timeout' is provided, it is used as the
        default for all subsequent 'wait()' calls.

        rN)r	rr��_action�_timeout�_parties�_staterD)rF�parties�actionr[s    r&rGzBarrier.__init__�s5���t�v�&��
������
���
������r%c��|j}|jr*d|j�d|j�dt	|�d�d�Sd|j�d|j�dt	|�d�d|j
�d|j�d�S)	Nr�r�r�r�z	: broken>z
: waiters=r�r�)rN�brokenrOrPrR�	n_waitingr�r�s  r&rTzBarrier.__repr__�s����n�n���;�;��s�~�~�&�a��(8�(8�'9��b��h�r�]�)�T�T��C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H� �N�N�+�1�T�\�\�N�!�=�	>r%c���|�|j}|j5|j�|j}|xjdz
c_	|dz|jk(r|j�n|j
|�||xjdzc_|j�cddd�S#|xjdzc_|j�wxYw#1swYyxYw)aNWait for the barrier.

        When the specified number of threads have started waiting, they are all
        simultaneously awoken. If an 'action' was provided for the barrier, one
        of the threads will have executed that callback prior to returning.
        Returns an individual index number from 0 to 'parties-1'.

        NrX)r�r��_enterrDr��_release�_wait�_exit)rFr[�indexs   r&r�zBarrier.wait�s����?��m�m�G�
�Z�Z�	��K�K�M��K�K�E��K�K�1��K�
��1�9��
�
�-��M�M�O��J�J�w�'�����q� ���
�
��	�	�����q� ���
�
���	�	�s#�2C�5B2�%C�2'C�C�C%c��|jdvr)|jj�|jdvr�)|jdkrt�|jdk(sJ�y)N�rurXr)r�r�r�rrEs r&r�zBarrier._enter�sO���k�k�W�$��J�J�O�O���k�k�W�$��;�;��?�$�$��{�{�a���r%c��	|jr|j�d|_|jj�y#|j	��xYw)NrX)r�r�r�r��_breakrEs r&r�zBarrier._release�sA��		��|�|������D�K��J�J�!�!�#��	��K�K�M��s�=A�Ac����jj�fd�|�s�j�t��jdkrt��jdk(sJ�y)Nc�"���jdk7Sr@�r�rEs�r&�<lambda>zBarrier._wait.<locals>.<lambda>�s���D�K�K�1�,<�r%rrX)r�r�r�rr��rFr[s` r&r�z
Barrier._wait�sJ����z�z�"�"�#<�g�F��K�K�M�$�$��;�;��?�$�$��{�{�a���r%c��|jdk(r1|jdvr"d|_|jj�yyy)Nrr�)rDr�r�r�rEs r&r�z
Barrier._exits;���;�;�!���{�{�g�%�����
�
�%�%�'�&�r%c��|j5|jdkDr.|jdk(rd|_n|jdk(rd|_nd|_|jj�ddd�y#1swYyxYw)z�Reset the barrier to the initial state.

        Any threads currently waiting will get the BrokenBarrier exception
        raised.

        rru���N)r�rDr�r�rEs r&�resetz
Barrier.resetsj���Z�Z�	$��{�{�Q���;�;�!�#�"$�D�K��[�[�B�&�#%�D�K�����J�J�!�!�#�	$�	$�	$�s�AA5�5A>c�f�|j5|j�ddd�y#1swYyxYw)z�Place the barrier into a 'broken' state.

        Useful in case of error.  Any currently waiting threads and threads
        attempting to 'wait()' will have BrokenBarrierError raised.

        N)r�r�rEs r&�abortz
Barrier.aborts)���Z�Z�	��K�K�M�	�	�	�s�'�0c�F�d|_|jj�y)Nr�)r�r�r�rEs r&r�zBarrier._break%s������
�
���r%c��|jS)z:Return the number of threads required to trip the barrier.)r�rEs r&r�zBarrier.parties+s���}�}�r%c�:�|jdk(r|jSy)z>Return the number of threads currently waiting at the barrier.r)r�rDrEs r&r�zBarrier.n_waiting0s��
�;�;�!���;�;��r%c� �|jdk(S)z0Return True if the barrier is in a broken state.r�r�rEs r&r�zBarrier.broken9s���{�{�b� � r%�NNrc)rvrOrPrwrGrTr�r�r�r�r�r�r�r��propertyr�r�r�r$r%r&rr�su���� >��< �
� �(�$�(� ����������!��!r%rc��eZdZy)rN)rvrOrPr$r%r&rr?s��r%rrXc��|t�zSrc)�_counter)�
name_templates r&�_newnamerEs���8�:�%�%r%c��tD�cgc]}|j�r�|��}}tj|�ycc}w)a!
    Drop any shutdown locks that don't correspond to running threads anymore.

    Calling this from time to time avoids an ever-growing _shutdown_locks
    set when Thread objects are not joined explicitly. See bpo-37788.

    This must be called with _shutdown_locks_lock acquired.
    N)�_shutdown_locksrI�difference_update)r��	to_removes  r&�_maintain_shutdown_locksrWs3��#2�G�$������G�I�G��%�%�i�0��Hs�;�;c�&�eZdZdZdZ		ddd�d�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zerd�Z
d
�Zd�Zd�Zd�Zdd�Zd d�Zed��Zej,d��Zed��Zered��Zd�Zed��Zej,d��Zd�Zd�Zd�Zd�Zy)!raA class that represents a thread of control.

    This class can be safely subclassed in a limited fashion. There are two ways
    to specify the activity: by passing a callable object to the constructor, or
    by overriding the run() method in a subclass.

    FN)�daemonc�,�|�Jd��|�i}|rt|�}n#td�}|�	|j}|d|�d�z
}||_||_||_||_|�|rt�std��||_
nt�j|_
d|_
trd|_d|_t#�|_d|_d|_t*j,|_t1�|_t4j7|�y#t$rY��wxYw)	aUThis constructor should always be called with keyword arguments. Arguments are:

        *group* should be None; reserved for future extension when a ThreadGroup
        class is implemented.

        *target* is the callable object to be invoked by the run()
        method. Defaults to None, meaning nothing is called.

        *name* is the thread name. By default, a unique name is constructed of
        the form "Thread-N" where N is a small decimal number.

        *args* is a list or tuple of arguments for the target invocation. Defaults to ().

        *kwargs* is a dictionary of keyword arguments for the target
        invocation. Defaults to {}.

        If a subclass overrides the constructor, it must make sure to invoke
        the base class constructor (Thread.__init__()) before doing anything
        else to the thread.

        Nz#group argument must be None for nowz	Thread-%dz (�)z4daemon threads are disabled in this (sub)interpreterFT)�strrrv�AttributeError�_target�_name�_args�_kwargs�_daemon_threads_allowedr`�	_daemonicr
r�_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�_tstate_lockr�_started�_is_stopped�_initializedr/�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)rF�group�targetrLr;r<r�target_names        r&rGzThread.__init__rs��.�}�C�C�C�}��>��F���t�9�D��K�(�D��!��"(�/�/�K��b��
�Q�/�/�D������
���
�������5�7�"�#Y�Z�Z�#�D�N�+�-�4�4�D�N����!�"�D�O� ������
� ��� ����{�{���"9�";����
�
�d���1&����s�D�	D�Dc���|jj�|rB|j�5|jj�|jj�yyd|_d|_yr#)rrVrrYr)rF�is_alives  r&�_reset_internal_lockszThread._reset_internal_locks�s`��	
�
�
�%�%�'��� � �,��!�!�1�1�3��!�!�)�)�+�-� $�D�� $�D�r%c�R�|jsJd��d}|jj�rd}|j�|jrd}|j
r|dz
}|j�|d|jzz
}d|jj�d|j�d	|�d
�S)Nz Thread.__init__() was not called�initial�started�stoppedz daemonz %sr��(z, z)>)
rrr�r#rrrrNrvr
)rFr�s  r&rTzThread.__repr__�s���� � �D�"D�D� ����=�=���!��F��
�
������F��>�>��i��F��;�;�"��e�d�k�k�)�)�F��!%���!8�!8�$�*�*�f�M�Mr%c��|jstd��|jj�rtd��t5|t
|<ddd�	t
|jd�|jj�y#1swY�;xYw#t$r$t5t
|=ddd��#1swY�xYwwxYw)a-Start the thread's activity.

        It must be called at most once per thread object. It arranges for the
        object's run() method to be invoked in a separate thread of control.

        This method will raise a RuntimeError if called more than once on the
        same thread object.

        zthread.__init__() not calledz threads can only be started onceNr$)
rr`rr��_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionr�rEs r&�startzThread.start�s���� � ��=�>�>��=�=���!��A�B�B�
�	 ��F�4�L�	 �	��d�o�o�r�2�
	
�
�
����	 �	 ���	�#�
!��4�L�
!��
!���	�s0�
B�B�B�C�"B3�*	C�3B<	�8Cc��	|j�&|j|ji|j��|`|`|`y#|`|`|`wxYw)aXMethod representing the thread's activity.

        You may override this method in a subclass. The standard run() method
        invokes the callable object passed to the object's constructor as the
        target argument, if any, with sequential and keyword arguments taken
        from the args and kwargs arguments, respectively.

        N)rrrrEs r&�runz
Thread.run�sI��	7��|�|�'�����d�j�j�9�D�L�L�9���d�j�$�,����d�j�$�,�s	�2;�Ac�Z�	|j�y#|jrt�Yy�xYwrc)�_bootstrap_innerrr/rEs r&r.zThread._bootstrap�s+��	��!�!�#��	��~�~�$�,���s��*�*c�"�t�|_yrc)rrrEs r&�
_set_identzThread._set_idents���k��r%c�"�t�|_yrc)r(rrEs r&�_set_native_idzThread._set_native_ids��+�o�D�Or%c��t�|_|jj�|js9t5t�tj|j�ddd�yy#1swYyxYw)z�
        Set a lock object which will be released by the interpreter when
        the underlying thread state (see pystate.h) gets deleted.
        N)�
_set_sentinelrrYr�_shutdown_locks_lockrrrrEs r&�_set_tstate_lockzThread._set_tstate_locksc��
*�O������!�!�#��{�{�%�
7�(�*��#�#�D�$5�$5�6�
7�
7��
7�
7�s�*A0�0A9c�(�	|j�|j�tr|j�|jj�t5|t|j<t|=ddd�trtjt�trtjt�	|j�|j#�y#1swY�ixYw#|j!|�Y�2xYw#|j#�wxYwrc)r6r<rr8rr�r+rKrr,r4r/rr+rr2r�_deleterEs r&r4zThread._bootstrap_inner s���	��O�O���!�!�#�%��#�#�%��M�M����#�
!�'+�����$��4�L�
!���
�
�k�*�����
�.�
.����
�
�L�L�N�
!�
!��
.��'�'��-���L�L�N�s7�AC?�C�3AC?�:C'�C$� C?�'C<�:C?�?Dc���|j}|�|j�rJ�d|_d|_|jst5t�ddd�yy#1swYyxYwr#)rrIrrr;rrs  r&�_stopzThread._stop7sc��"� � �����{�{�}�$�$���� ����{�{�%�
+�(�*�
+�
+��
+�
+�s�A�Ac�X�t5tt�=ddd�y#1swYyxYw)zARemove current thread from the dict of currently running threads.N)r+rKrrEs r&r>zThread._deleteRs$��
�	%��	��$�	%�	%�	%�s� �)c��|jstd��|jj�std��|t	�urtd��|�|j�y|jt
|d���y)aWait until the thread terminates.

        This blocks the calling thread until the thread whose join() method is
        called terminates -- either normally or through an unhandled exception
        or until the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof). As join() always returns None, you must call
        is_alive() after join() to decide whether a timeout happened -- if the
        thread is still alive, the join() call timed out.

        When the timeout argument is not present or None, the operation will
        block until the thread terminates.

        A thread can be join()ed many times.

        join() raises a RuntimeError if an attempt is made to join the current
        thread as that would cause a deadlock. It is also an error to join() a
        thread before it has been started and attempts to do so raises the same
        exception.

        �Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)r[)rr`rr�r
�_wait_for_tstate_lock�maxr�s  r&�joinzThread.join[sv��0� � ��=�>�>��}�}�#�#�%��H�I�I��>�#�#��;�<�<��?��&�&�(�
�&�&�s�7�A��&�?r%c��|j}|�|jsJ�y	|j||�r!|j�|j	�yy#|j�r |j�|j	��xYwrc)rrrYrar@rI)rF�blockr[r�s    r&rDzThread._wait_for_tstate_lock�sw��� � ���<��#�#�#�#��	��|�|�E�7�+������
�
��,��	��{�{�}�
�����
�
���s�2A�3Bc�@�|jsJd��|jS)z�A string used for identification purposes only.

        It has no semantics. Multiple threads may be given the same name. The
        initial name is set by the constructor.

        rC)rr
rEs r&rLzThread.name�s#��� � �@�"@�@� ��z�z�r%c�J�|jsJd��t|�|_y)NrC)rr
r
)rFrLs  r&rLzThread.name�s"��� � �@�"@�@� ���Y��
r%c�@�|jsJd��|jS)a4Thread identifier of this thread or None if it has not been started.

        This is a nonzero integer. See the get_ident() function. Thread
        identifiers may be recycled when a thread exits and another thread is
        created. The identifier is available even after the thread has exited.

        rC)rrrEs r&�identzThread.ident�s#��� � �@�"@�@� ��{�{�r%c�@�|jsJd��|jS)z�Native integral thread ID of this thread, or None if it has not been started.

            This is a non-negative integer. See the get_native_id() function.
            This represents the Thread ID as reported by the kernel.

            rC)rrrEs r&�	native_idzThread.native_id�s#���$�$�D�&D�D�$��?�?�"r%c��|jsJd��|js|jj�sy|j	d�|jS)z�Return whether the thread is alive.

        This method returns True just before the run() method starts until just
        after the run() method terminates. See also the module function
        enumerate().

        rCF)rrrr�rDrEs r&r#zThread.is_alive�sQ��� � �@�"@�@� ����4�=�=�#7�#7�#9���"�"�5�)��#�#�#�#r%c�@�|jsJd��|jS)a�A boolean value indicating whether this thread is a daemon thread.

        This must be set before start() is called, otherwise RuntimeError is
        raised. Its initial value is inherited from the creating thread; the
        main thread is not a daemon thread and therefore all threads created in
        the main thread default to daemon = False.

        The entire Python program exits when only daemon threads are left.

        rC)rrrEs r&rz
Thread.daemon�s#��� � �@�"@�@� ��~�~�r%c��|jstd��|rt�std��|jj	�rtd��||_y)NrCz/daemon threads are disabled in this interpreterz)cannot set daemon status of active thread)rr`rrr�r)rF�daemonics  r&rz
Thread.daemon�sO��� � ��=�>�>��3�5��P�Q�Q��=�=���!��J�K�K�!��r%c�R�ddl}|jdtd��|jS)zwReturn whether this thread is a daemon.

        This method is deprecated, use the daemon attribute instead.

        rNz:isDaemon() is deprecated, get the daemon attribute insteadr�r��r�r�r�rr�s  r&�isDaemonzThread.isDaemon�s*��	��
�
�R�(�Q�	�	8��{�{�r%c�J�ddl}|jdtd��||_y)ztSet whether this thread is a daemon.

        This method is deprecated, use the .daemon property instead.

        rNz;setDaemon() is deprecated, set the daemon attribute insteadr�r�rT)rFrRr�s   r&�	setDaemonzThread.setDaemon�s'��	��
�
�S�(�Q�	�	8���r%c�R�ddl}|jdtd��|jS)z�Return a string used for identification purposes only.

        This method is deprecated, use the name attribute instead.

        rNz7getName() is deprecated, get the name attribute insteadr�r��r�r�r�rLr�s  r&�getNamezThread.getNames*��	��
�
�O�(�Q�	�	8��y�y�r%c�J�ddl}|jdtd��||_y)zrSet the name string for this thread.

        This method is deprecated, use the name attribute instead.

        rNz7setName() is deprecated, set the name attribute insteadr�r�rY)rFrLr�s   r&�setNamezThread.setNames'��	��
�
�O�(�Q�	�	8���	r%)NNNr$Nrcrt)rvrOrPrwrrGr$rTr0r2r.r6rr8r<r4r@r>rFrDr�rL�setterrLrNr#rrUrWrZr\r$r%r&rrgs����L�59�!%�:�15�:�x%�"N��47�"�("��	.�7��.+�6%�$@�L�6����
�[�[�����	��	��	�	#�
�	#�$������]�]�"��"�	�	�	�	r%r)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplerz'exc_type exc_value exc_traceback threadc��t|�Src)r_)r;s r&rr$s
����%�%r%c��|jtk(ryt�!tj�tj}n&|j�|jj
}|�yy|j�|jj}n
t�}td|�d�|d��t|j|j|j|��|j�y)z9
        Handle uncaught Thread.run() exception.
        NzException in thread �:T��file�flush)rf)
�exc_type�
SystemExitr/r�threadrrLr�print�_print_exception�	exc_value�
exc_tracebackrg)r;rrLs   r&rr's����=�=�J�&������� 7��[�[�F�
�[�[�
$��[�[�(�(�F��~��
��;�;�"��;�;�#�#�D��;�D�
�$�T�F�!�,���	'���������8J�8J�$�	&����r%c�������t�tj���td����td��tj�t�t������fd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec�X��	t}|��}tg�
��|��}||�d}y#t$rm}d|_~���j�
�j}n|j
}�d|d�����j�
�j}n�	}|�
��Yd}~d}yd}~wwxYw#d}wxYw)NTz"Exception in threading.excepthook:re)rrr/�__suppress_context__rr)rj�hookr;�excr�sys_excepthook�local_print�	local_sys�old_excepthook�old_sys_excepthook�sys_exc_infos      �����r&�invoke_excepthookz2_make_invoke_excepthook.<locals>.invoke_excepthookZs����	��D��|�%��!�";�L�N�";�F�";�<�D���J�*�D��)�	,�'+�C�$���$��)9�)9�)E�"�)�)�������<�#�4�
1��$��)=�)=�)I�!*�!5�!5��!3���L�N�+��D��)	,��(�D�s'�&,�	B"�A!B�B%�B"�"B%�%B))rr/r`�exc_infork)rzrurvrwrxrys @@@@@r&rrJs^���
 �N��������9�:�:��!��3�4�4��=�=�L��K��I���@�r%c�$�eZdZdZdd�Zd�Zd�Zy)rz�Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    Nc��tj|�||_||_|�|ng|_|�|ni|_t
�|_yrc)rrG�interval�functionr;r<r�finished)rFr~rr;r<s     r&rGzTimer.__init__�sA������� ��
� ��
� �,�D�"��	� &� 2�f�������
r%c�8�|jj�y)z)Stop the timer if it hasn't finished yet.N)r�r�rEs r&�cancelzTimer.cancel�s���
�
���r%c��|jj|j�|jj�s&|j|j
i|j��|jj�yrc)r�r�r~r�rr;r<r�rEs r&r2z	Timer.run�sS���
�
���4�=�=�)��}�}�#�#�%��D�M�M�4�9�9�4����4��
�
���r%r�)rvrOrPrwrGr�r2r$r%r&rrs��� ��r%rc��eZdZd�Zy)�_MainThreadc�0�tj|dd��|j�|jj	�|j�tr|j�t5|t|j<ddd�y#1swYyxYw)N�
MainThreadF�rLr)rrGr<rr�r6rr8r+rKrrEs r&rGz_MainThread.__init__�so������<���>������
�
��������!����!�
�	(�#'�G�D�K�K� �	(�	(�	(�s�/B�BN)rvrOrPrGr$r%r&r�r��s��(r%r�c�&�eZdZd�Zd�Zd�Zdd�Zy)�_DummyThreadc�2�tj|td�t���|jj�|j
�tr|j�t5|t|j<ddd�y#1swYyxYw)NzDummy-%dr�)rrGrrrr�r6rr8r+rKrrEs r&rGz_DummyThread.__init__�sq������8�J�#7�6�8�	�	:��
�
��������!����!�
�	(�#'�G�D�K�K� �	(�	(�	(�s�0B
�
Bc��yrcr$rEs r&r@z_DummyThread._stop�s��r%c�T�|js|jj�sJ�yr#)rrr�rEs r&r#z_DummyThread.is_alive�s#���#�#��
�
�(<�(<�(>�>�>�r%Nc��Jd��)Nzcannot join a dummy threadr$r�s  r&rFz_DummyThread.join�s
��2�2�2�ur%rc)rvrOrPrGr@r#rFr$r%r&r�r��s��(�
��3r%r�c�X�	tt�S#t$r
t�cYSwxYw)z�Return the current Thread object, corresponding to the caller's thread of control.

    If the caller's thread of control was not created through the threading
    module, a dummy thread object with limited functionality is returned.

    )rKrrMr�r$r%r&r
r
�s+����y�{�#�#�����~���s��)�)c�N�ddl}|jdtd��t�S)z�Return the current Thread object, corresponding to the caller's thread of control.

    This function is deprecated, use current_thread() instead.

    rNz;currentThread() is deprecated, use current_thread() insteadr�r�)r�r�r�r
�r�s r&�
currentThreadr��s)����M�M�O�$���4���r%c�x�t5tt�tt�zcddd�S#1swYyxYw)z�Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().

    N)r+r�rKr,r$r%r&rr�s,��
�*��7�|�c�&�k�)�*�*�*�s�0�9c�N�ddl}|jdtd��t�S)zxReturn the number of Thread objects currently alive.

    This function is deprecated, use active_count() instead.

    rNz7activeCount() is deprecated, use active_count() insteadr�r�)r�r�r�rr�s r&�activeCountr��s(����M�M�K�$���4��>�r%c�x�ttj��ttj��zSrc)�listrK�valuesr,r$r%r&�
_enumerater��s$������ �!�D�����$9�9�9r%c��t5ttj��ttj��zcddd�S#1swYyxYw)z�Return a list of all Thread objects currently alive.

    The list includes daemonic threads, dummy thread objects created by
    current_thread(), and the main thread. It excludes terminated threads and
    threads that have not yet been started.

    N)r+r�rKr�r,r$r%r&rr�s;��
�>��G�N�N�$�%��V�]�]�_�(=�=�>�>�>�s�;A�Ac��trtd��tj|g|��i|��}tj|�y)a�CPython internal: register *func* to be called before joining threads.

    The registered *func* is called with its arguments just before all
    non-daemon threads are joined in `_shutdown()`. It provides a similar
    purpose to `atexit.register()`, but its functions are called prior to
    threading shutdown instead of interpreter shutdown.

    For similarity to atexit, the registered functions are called in reverse.
    z$can't register atexit after shutdownN)�_SHUTTING_DOWNr`�	functools�partial�_threading_atexitsr�)r-�argr<�calls    r&�_register_atexitr�s;����A�B�B����T�2�C�2�6�2�D����d�#r%)rc��tjrt�rydat	t
�D]	}|��tjt�k(rKtj}|�J�|j�sJ�|j�tj�n		t5tt�}tj�ddd�sy|D]"}|j!�|j��$�]#1swY�4xYw)zS
    Wait until the Python thread state of all non-daemon threads get deleted.
    NT)�_main_threadrr'r��reversedr�rLrrrIrar@r;r�rr�rY)�atexit_call�tlock�locksr�s    r&�	_shutdownr�%s������$8�$:���N� � 2�3����
�����Y�[�(��)�)��� � � ��|�|�~��~�
�
�
������	
��
!�	$���)�E��!�!�#�	$����	�D��L�L�N��L�L�N�	��	$�	$�s�'$C>�>Dc��tS)z�Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
    )r�r$r%r&rr]s
���r%)�_local)rc���t�ai}	tt�}|at�at�a
t5tt��}|jt�|D]�}||ura|jd�t�}t|t �r)t
|_d|_d|_|j)�||_|||<�h|jd�|j-���t.j1�tj1�tj|�t3t�dk(sJ�	ddd�y#t$rt�}Y��CwxYw#1swYyxYw)zL
    Cleanup threading module state that should not exist after a fork.
    Tr�FrXN)rr+rKrrMr�r�rAr;r�rr��updaterr$�
isinstancer�rNr
rr<rr@r,r�r�)�
new_active�current�threadsrjrLs     r&�_after_forkr�osG������J� ��)�+�&���L�*�+���e�O�	�!��j�l�#�����y�!��	�F��� ��,�,�T�2�!����f�l�3�'2�F�$�#/�F�L�',�F�$��+�+�-� %��
�$*�
�5�!��,�,�U�3�����%	�(	�����
�
�����z�"��7�|�q� � � �9!�!��� ��-��	 ��!�!�s�E�DE&�E#�"E#�&E/�register_at_fork)�after_in_child)erw�os�_os�sysr/�_threadr��timerr��_weakrefsetr�	itertoolsrrD�_collectionsrr}�ImportError�collections�__all__�start_new_threadr-�daemon_threads_allowedr�
allocate_lockrAr:rr'rr(rr��errorrrr9r
r+r4rr rrr!rrr>r:r	rrrrr`r�__next__r�rr+rKr,rr;r�rrrr^rr_r�	tracebackr`rlra�__excepthook__rrr�r�r
r�rr�r�rr�r�r�rr�r�rr�r�_threading_localr�r|r�r$r%r&�<module>r�s��A�����#��%�,�,�<���,�,��!�8�8���&�&���%�%�
����	�
�"�7�7��#��)�)�M�!���N�N�?�#��m�m����m�m�G��!�!���
�
����%���#����$�{�{�z��q�q�hT�T�n*!�y�*!�ZO�O�z^!�^!�B	��	�
�!�9����&��W��
��	���I�	�
&�'���%��1� n�n�b
+�<�\��0�j�F��<
(�&�
(�*3�6�3�2
�	�
*�	�:�	>�����$�"��}��2�p�'�'�
7!�t�3�"�#��C����4�$��y4�,�+�+�,��:����� �#�"��#��
���G���x&�(�=�&� ��1�3�O�&��(��`
�'�&�'�sk�G-�-G?�:H�&H�'H*�I�-G<�;G<�?H�
H�H�H�H'�&H'�* I
�I
�I�I

Zerion Mini Shell 1.0