Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/queue.cpython-39.opt-1.pyc

a

���e�,�@s�dZddlZddlZddlmZddlmZmZddlm	Zzddl
mZWneybdZYn0gd�Z
zddl
mZWn"ey�Gd	d
�d
e�ZYn0Gdd�de�ZGd
d�d�ZGdd�de�ZGdd�de�ZGdd�d�Zedur�eZdS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic)�SimpleQueue)�Empty�Full�Queue�
PriorityQueue�	LifoQueuer)rc@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N��__name__�
__module__�__qualname__�__doc__�rr�*/opt/alt/python39/lib64/python3.9/queue.pyrsrc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().Nrrrrrrsrc@s�eZdZdZd!dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zeej�ZdS)$r	zjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rcCsN||_|�|�t��|_t�|j�|_t�|j�|_t�|j�|_d|_	dS�Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks��selfrrrr�__init__"s

zQueue.__init__cCs\|j�B|jd}|dkr4|dkr*td��|j��||_Wd�n1sN0YdS)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  For each get() used to fetch a task,
        a subsequent call to task_done() tells the queue that the processing
        on the task is complete.

        If a join() is currently blocking, it will resume when all items
        have been processed (meaning that a task_done() call was received
        for every item that had been put() into the queue).

        Raises a ValueError if called more times than there were items
        placed in the queue.
        �rz!task_done() called too many timesN)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done9s

zQueue.task_donecCs<|j�"|jr|j��qWd�n1s.0YdS)a�Blocks until all items in the Queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)rr�wait�rrrr�joinOs	z
Queue.joincCs2|j�|��Wd�S1s$0YdS)�9Return the approximate size of the queue (not reliable!).N�r�_qsizer#rrr�qsize\szQueue.qsizecCs4|j�|��Wd�S1s&0YdS)a�Return True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        Nr&r#rrr�emptyaszQueue.emptycCsH|j�.d|jko |��knWd�S1s:0YdS)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr'r#rrr�fullosz
Queue.fullTNcCs�|j��|jdkr�|s*|��|jkr�t�nr|durN|��|jkr�|j��q2nN|dkr`td��n<t�|}|��|jkr�|t�}|dkr�t�|j�|�qj|�|�|jd7_|j	�
�Wd�n1s�0YdS)aPut an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).
        rN�''timeout' must be a non-negative number�r)rrr'rr"r �time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putzs&




z	Queue.putcCs�|j��|s|��s�t�nf|dur8|��s�|j��q"nH|dkrJtd��n6t�|}|��s�|t�}|dkrrt�|j�|�qT|��}|j��|Wd�S1s�0YdS)�Remove and return an item from the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until an item is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Empty exception if no item was available within that time.
        Otherwise ('block' is false), return an item if one is immediately
        available, else raise the Empty exception ('timeout' is ignored
        in that case).
        Nrr+r,)	rr'rr"r r-�_getrr/)rr1r2r3r4r0rrr�get�s$



z	Queue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        F�r1�r5�rr0rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�S�z�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        Fr9�r8r#rrr�
get_nowait�szQueue.get_nowaitcCst�|_dS�N)r�queuerrrrr�szQueue._initcCs
t|j�Sr@��lenrAr#rrrr'�szQueue._qsizecCs|j�|�dSr@�rA�appendr;rrrr.�sz
Queue._putcCs
|j��Sr@)rA�popleftr#rrrr7�sz
Queue._get)r)TN)TN)r
rrrrr!r$r(r)r*r5r8r<r?rr'r.r7�classmethod�types�GenericAlias�__class_getitem__rrrrr	s 


 

r	c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r
z�Variant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    cCs
g|_dSr@�rArrrrr�szPriorityQueue._initcCs
t|j�Sr@rBr#rrrr'�szPriorityQueue._qsizecCst|j|�dSr@)rrAr;rrrr.�szPriorityQueue._putcCs
t|j�Sr@)rrAr#rrrr7�szPriorityQueue._getN�r
rrrrr'r.r7rrrrr
�s
r
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBVariant of Queue that retrieves most recently added entries first.cCs
g|_dSr@rKrrrrr�szLifoQueue._initcCs
t|j�Sr@rBr#rrrr'�szLifoQueue._qsizecCs|j�|�dSr@rDr;rrrr.�szLifoQueue._putcCs
|j��Sr@)rA�popr#rrrr7�szLifoQueue._getNrLrrrrr�s
rc@sVeZdZdZdd�Zddd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
eej
�ZdS)�_PySimpleQueuezYSimple, unbounded FIFO queue.

    This pure Python implementation is not reentrant.
    cCst�|_t�d�|_dSr)r�_queuerZ	Semaphore�_countr#rrrrsz_PySimpleQueue.__init__TNcCs|j�|�|j��dS)z�Put the item on the queue.

        The optional 'block' and 'timeout' arguments are ignored, as this method
        never blocks.  They are provided for compatibility with the Queue class.
        N)rOrErP�release)rr0r1r2rrrr5sz_PySimpleQueue.putcCs4|dur|dkrtd��|j�||�s*t�|j��S)r6Nrr+)r rP�acquirerrOrF)rr1r2rrrr8s
z_PySimpleQueue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        This is exactly equivalent to `put(item, block=False)` and is only provided
        for compatibility with the Queue class.
        Fr9r:r;rrrr<*sz_PySimpleQueue.put_nowaitcCs|jdd�Sr=r>r#rrrr?2sz_PySimpleQueue.get_nowaitcCst|j�dkS)zCReturn True if the queue is empty, False otherwise (not reliable!).r�rCrOr#rrrr):sz_PySimpleQueue.emptycCs
t|j�S)r%rSr#rrrr(>sz_PySimpleQueue.qsize)TN)TN)r
rrrrr5r8r<r?r)r(rGrHrIrJrrrrrNs	
	
rN)rrrH�collectionsr�heapqrrr-rrOr�ImportError�__all__r�	Exceptionrr	r
rrNrrrr�<module>s,
DC

Hacked By AnonymousFox1.0, Coded By AnonymousFox