Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/queue.cpython-35.opt-1.pyc



��YfL"�
@s�dZyddlZWnek
r6ddlZYnXddlmZddlmZmZddl	m
Z	dddd	d
gZGdd�de�Z
Gdd�de�ZGd
d�d�ZGdd	�d	e�ZGdd
�d
e�ZdS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic�Empty�Full�Queue�
PriorityQueue�	LifoQueuec@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N)�__name__�
__module__�__qualname__�__doc__�rr�*/opt/alt/python35/lib64/python3.5/queue.pyr
sc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().N)rrr
rrrrrrsc@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dddd�Z
dddd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �ZdS)!rzjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rcCsq||_|j|�tj�|_tj|j�|_tj|j�|_tj|j�|_d|_	dS)Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks)�selfrrrr�__init__s	
zQueue.__init__c	Cs\|j�L|jd}|dkrH|dkr;td��|jj�||_WdQRXdS)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_done2s


zQueue.task_donec	Cs2|j�"x|jr&|jj�q
WWdQRXdS)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�joinHs	
z
Queue.joinc	Cs|j�|j�SWdQRXdS)z9Return the approximate size of the queue (not reliable!).N)r�_qsize)rrrr�qsizeUs
zQueue.qsizec	Cs |j�|j�SWdQRXdS)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.
        N)rr )rrrr�emptyZs
zQueue.emptyc
Cs6|j�&d|jko(|j�kSSWdQRXdS)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 )rrrr�fullhs
z
Queue.fullTNc
Cs|j�|jdkr�|s=|j�|jkr�t�n�|dkrux�|j�|jkrq|jj�qLWns|dkr�td��nXt�|}xH|j�|jkr�|t�}|dkr�t�|jj|�q�W|j|�|jd7_|j	j
�WdQRXdS)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).
        rNz''timeout' must be a non-negative numbergr)rrr rrr�time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putss&
	


z	Queue.putc	Cs�|j��|s%|j�s�t�n�|dkrTx�|j�sP|jj�q4Wnj|dkrotd��nOt�|}x?|j�s�|t�}|dkr�t�|jj|�qW|j�}|jj�|SWdQRXdS)aRemove 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).
        Nrz''timeout' must be a non-negative numberg)	rr rrrr$�_getrr&)rr(r)r*r+r'rrr�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.
        r(F)r,)rr'rrr�
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.
        r(F)r.)rrrr�
get_nowait�szQueue.get_nowaitcCst�|_dS)N)r�queue)rrrrrr�szQueue._initcCs
t|j�S)N)�lenr1)rrrrr �szQueue._qsizecCs|jj|�dS)N)r1�append)rr'rrrr%�sz
Queue._putcCs
|jj�S)N)r1�popleft)rrrrr-�sz
Queue._get)rrr
rrrrr!r"r#r,r.r/r0rr r%r-rrrrrs
 
c@sFeZdZdZdd�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|_dS)N)r1)rrrrrr�szPriorityQueue._initcCs
t|j�S)N)r2r1)rrrrr �szPriorityQueue._qsizecCst|j|�dS)N)rr1)rr'rrrr%�szPriorityQueue._putcCs
t|j�S)N)rr1)rrrrr-�szPriorityQueue._getN)rrr
rrr r%r-rrrrr	�s
c@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r
zBVariant of Queue that retrieves most recently added entries first.cCs
g|_dS)N)r1)rrrrrr�szLifoQueue._initcCs
t|j�S)N)r2r1)rrrrr �szLifoQueue._qsizecCs|jj|�dS)N)r1r3)rr'rrrr%�szLifoQueue._putcCs
|jj�S)N)r1�pop)rrrrr-�szLifoQueue._getN)rrr
rrr r%r-rrrrr
�s
)rr�ImportErrorZdummy_threading�collectionsr�heapqrrr$r�__all__�	Exceptionrrrr	r
rrrr�<module>s
�

Hacked By AnonymousFox1.0, Coded By AnonymousFox