Your IP : 3.147.67.237


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/queue.cpython-33.pyc

�
��f�"c@sdZyddlZWnek
r6ddlZYnXddlmZddlmZmZyddl	m
Z	Wn"ek
r�ddl	m	Z	YnXddd	d
dgZGdd�de�Z
Gd
d�de�ZGdd	�d	�ZGdd
�d
e�ZGdd�de�ZdS(u'A multi-producer, multi-consumer queue.iN(udeque(uheappushuheappop(u	monotonic(utimeuEmptyuFulluQueueu
PriorityQueueu	LifoQueuecBs|EeZdZdZdS(uEmptyu4Exception raised by Queue.get(block=0)/get_nowait().N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u*/opt/alt/python33/lib64/python3.3/queue.pyuEmptyscBs|EeZdZdZdS(uFullu4Exception raised by Queue.put(block=0)/put_nowait().N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u*/opt/alt/python33/lib64/python3.3/queue.pyuFullscBs�|EeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d ddd�Zd ddd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS(!uQueueujCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    icCsq||_|j|�tj�|_tj|j�|_tj|j�|_tj|j�|_d|_	dS(Ni(
umaxsizeu_initu	threadinguLockumutexu	Conditionu	not_emptyunot_fulluall_tasks_doneuunfinished_tasks(uselfumaxsize((u*/opt/alt/python33/lib64/python3.3/queue.pyu__init__s	
uQueue.__init__c	Csa|j�R|jd}|dkrN|dkr>td��n|jj�n||_WdQXdS(u.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.
        iiu!task_done() called too many timesN(uall_tasks_doneuunfinished_tasksu
ValueErroru
notify_all(uselfu
unfinished((u*/opt/alt/python33/lib64/python3.3/queue.pyu	task_done5s

uQueue.task_donecCs1|j�"x|jr&|jj�q
WWdQXdS(u�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(uall_tasks_doneuunfinished_tasksuwait(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyujoinKs	
u
Queue.joincCs|j�|j�SWdQXdS(u9Return the approximate size of the queue (not reliable!).N(umutexu_qsize(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyuqsizeXs
uQueue.qsizecCs|j�|j�SWdQXdS(u�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(umutexu_qsize(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyuempty]s
uQueue.emptyc
Cs5|j�&d|jko(|j�kSSWdQXdS(uOReturn 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.
        iN(umutexumaxsizeu_qsize(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyufullks
u
Queue.fullc
Cs$|j�|jdkr�|s@|j�|jkr�t�q�q�|dkrxx�|j�|jkrt|jj�qOWq�|dkr�td��q�t�|}xN|j�|jkr�|t�}|dkr�t�n|jj|�q�Wn|j|�|j	d7_	|j
j�WdQXdS(uPut 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).
        iu''timeout' must be a non-negative numbergiN(unot_fullumaxsizeu_qsizeuFulluNoneuwaitu
ValueErrorutimeu_putuunfinished_tasksu	not_emptyunotify(uselfuitemublockutimeoutuendtimeu	remaining((u*/opt/alt/python33/lib64/python3.3/queue.pyuputvs&


	
u	Queue.putc	Cs�|j��|s(|j�s�t�q�n�|dkrWx�|j�sS|jj�q7Wnm|dkrrtd��nRt�|}xB|j�s�|t�}|dkr�t�n|jj|�q�W|j�}|jj	�|SWdQXdS(uRemove 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).
        iu''timeout' must be a non-negative numbergN(
u	not_emptyu_qsizeuEmptyuNoneuwaitu
ValueErrorutimeu_getunot_fullunotify(uselfublockutimeoutuendtimeu	remaininguitem((u*/opt/alt/python33/lib64/python3.3/queue.pyuget�s$


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

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        ublockF(uputuFalse(uselfuitem((u*/opt/alt/python33/lib64/python3.3/queue.pyu
put_nowait�suQueue.put_nowaitcCs|jdd�S(u�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        ublockF(ugetuFalse(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu
get_nowait�suQueue.get_nowaitcCst�|_dS(N(udequeuqueue(uselfumaxsize((u*/opt/alt/python33/lib64/python3.3/queue.pyu_init�suQueue._initcCs
t|j�S(N(ulenuqueue(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_qsize�suQueue._qsizecCs|jj|�dS(N(uqueueuappend(uselfuitem((u*/opt/alt/python33/lib64/python3.3/queue.pyu_put�su
Queue._putcCs
|jj�S(N(uqueueupopleft(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_get�su
Queue._getNT(u__name__u
__module__u__qualname__u__doc__u__init__u	task_doneujoinuqsizeuemptyufulluTrueuNoneuputugetu
put_nowaitu
get_nowaitu_initu_qsizeu_putu_get(u
__locals__((u*/opt/alt/python33/lib64/python3.3/queue.pyuQueues
 
cBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u
PriorityQueueu�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(uqueue(uselfumaxsize((u*/opt/alt/python33/lib64/python3.3/queue.pyu_init�suPriorityQueue._initcCs
t|j�S(N(ulenuqueue(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_qsize�suPriorityQueue._qsizecCst|j|�dS(N(uheappushuqueue(uselfuitem((u*/opt/alt/python33/lib64/python3.3/queue.pyu_put�suPriorityQueue._putcCs
t|j�S(N(uheappopuqueue(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_get�suPriorityQueue._getN(u__name__u
__module__u__qualname__u__doc__u_initu_qsizeu_putu_get(u
__locals__((u*/opt/alt/python33/lib64/python3.3/queue.pyu
PriorityQueue�s
cBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u	LifoQueueuBVariant of Queue that retrieves most recently added entries first.cCs
g|_dS(N(uqueue(uselfumaxsize((u*/opt/alt/python33/lib64/python3.3/queue.pyu_init�suLifoQueue._initcCs
t|j�S(N(ulenuqueue(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_qsize�suLifoQueue._qsizecCs|jj|�dS(N(uqueueuappend(uselfuitem((u*/opt/alt/python33/lib64/python3.3/queue.pyu_put�suLifoQueue._putcCs
|jj�S(N(uqueueupop(uself((u*/opt/alt/python33/lib64/python3.3/queue.pyu_get�suLifoQueue._getN(u__name__u
__module__u__qualname__u__doc__u_initu_qsizeu_putu_get(u
__locals__((u*/opt/alt/python33/lib64/python3.3/queue.pyu	LifoQueue�s
(u__doc__u	threadinguImportErrorudummy_threadingucollectionsudequeuheapquheappushuheappoputimeu	monotonicu__all__u	ExceptionuEmptyuFulluQueueu
PriorityQueueu	LifoQueue(((u*/opt/alt/python33/lib64/python3.3/queue.pyu<module>s 

�

?>