Hacked By AnonymousFox
3
� f � @ s� d Z dddddgZddlZddlZdd lmZ dd
lmZ ddlmZ ddlm Z G d
d� de
�ZG dd� de
�ZG dd� d�Z
G dd� de
�ZG dd� de
�Zejs�e
Zejd� dS )ZQueues�Queue�
PriorityQueue� LifoQueue� QueueFull�
QueueEmpty� N� )�compat)�events)�locks)� coroutinec @ s e Zd ZdZdS )r z]Exception raised when Queue.get_nowait() is called on a Queue object
which is empty.
N)�__name__�
__module__�__qualname__�__doc__� r r �3/opt/alt/python36/lib64/python3.6/asyncio/queues.pyr s c @ s e Zd ZdZdS )r zgException raised when the Queue.put_nowait() method is called on a Queue
object which is full.
N)r r
r r r r r r r s c @ s� e Zd ZdZd)dd�dd�Zdd� Zd d
� Zdd� Zd
d� Zdd� Z dd� Z
dd� Zdd� Ze
dd� �Zdd� Zdd� Zedd� �Zdd � Zed!d"� �Zd#d$� Zd%d&� Zed'd(� �ZdS )*r a A queue, useful for coordinating producer and consumer coroutines.
If maxsize is less than or equal to zero, the queue size is infinite. If it
is an integer greater than 0, then "yield from put()" will block when the
queue reaches maxsize, until an item is removed by get().
Unlike the standard library Queue, you can reliably know this Queue's size
with qsize(), since your single-threaded asyncio application won't be
interrupted between calling qsize() and doing an operation on the Queue.
r N)�loopc C sb |d krt j� | _n|| _|| _tj� | _tj� | _d| _t j
| jd�| _| jj� | j
|� d S )Nr )r )r Zget_event_loop�_loop�_maxsize�collections�deque�_getters�_putters�_unfinished_tasksr
ZEvent� _finished�set�_init)�self�maxsizer r r r �__init__( s
zQueue.__init__c C s t j� | _d S )N)r r �_queue)r r r r r r : s zQueue._initc C s
| j j� S )N)r �popleft)r r r r �_get= s z
Queue._getc C s | j j|� d S )N)r �append)r �itemr r r �_put@ s z
Queue._putc C s* x$|r$|j � }|j� s|jd � P qW d S )N)r! �doneZ
set_result)r �waitersZwaiterr r r �_wakeup_nextE s
zQueue._wakeup_nextc C s dj t| �jt| �| j� �S )Nz<{} at {:#x} {}>)�format�typer �id�_format)r r r r �__repr__M s zQueue.__repr__c C s dj t| �j| j� �S )Nz<{} {}>)r) r* r r, )r r r r �__str__Q s z
Queue.__str__c C sz dj | j�}t| dd �r,|dj t| j��7 }| jrF|dj t| j��7 }| jr`|dj t| j��7 }| jrv|dj | j�7 }|S )Nzmaxsize={!r}r z _queue={!r}z
_getters[{}]z
_putters[{}]z tasks={}) r) r �getattr�listr r �lenr r )r �resultr r r r, T s z
Queue._formatc C s
t | j�S )zNumber of items in the queue.)r1 r )r r r r �qsize` s zQueue.qsizec C s | j S )z%Number of items allowed in the queue.)r )r r r r r d s z
Queue.maxsizec C s | j S )z3Return True if the queue is empty, False otherwise.)r )r r r r �emptyi s zQueue.emptyc C s | j dkrdS | j� | j kS dS )z�Return True if there are maxsize items in the queue.
Note: if the Queue was initialized with maxsize=0 (the default),
then full() is never True.
r FN)r r3 )r r r r �fullm s
z
Queue.fullc c st xh| j � rh| jj� }| jj|� y|E dH W q |j� | j � r^|j� r^| j| j� � Y qX qW | j|�S )z�Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free
slot is available before adding item.
This method is a coroutine.
N) r5 r �
create_futurer r# �cancel� cancelledr( �
put_nowait)r r$ Zputterr r r �putx s
z Queue.putc C s>