%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyc

�
��4]c@s�dZddlmZddlmZddlmZdddgZdefd	��YZ	defd
��YZ
dd
d��YZdS(s�An adaptation of Py2.3/2.4's Queue module which supports reentrant
behavior, using RLock instead of Lock for its mutex object.  The
Queue object is used exclusively by the sqlalchemy.pool.QueuePool
class.

This is to support the connection pool's usage of weakref callbacks to return
connections to the underlying Queue, which can in extremely
rare cases be invoked within the ``get()`` method of the Queue itself,
producing a ``put()`` inside the ``get()`` and therefore a reentrant
condition.

i����(tdeque(ttimei(t	threadingtEmptytFulltQueuecBseZdZRS(s4Exception raised by Queue.get(block=0)/get_nowait().(t__name__t
__module__t__doc__(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyRscBseZdZRS(s4Exception raised by Queue.put(block=0)/put_nowait().(RRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR$scBs�eZded�Zd�Zd�Zd�Zedd�Z	d�Z
edd�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�ZRS(icCsS|j|�tj�|_tj|j�|_tj|j�|_||_dS(s�Initialize a queue object with a given maximum size.

        If `maxsize` is <= 0, the queue size is infinite.

        If `use_lifo` is True, this Queue acts like a Stack (LIFO).
        N(t_initRtRLocktmutext	Conditiont	not_emptytnot_fulltuse_lifo(tselftmaxsizeR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyt__init__+s

cCs*|jj�|j�}|jj�|S(s9Return the approximate size of the queue (not reliable!).(Rtacquiret_qsizetrelease(Rtn((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pytqsizeBs

cCs*|jj�|j�}|jj�|S(sKReturn True if the queue is empty, False otherwise (not
        reliable!).(RRt_emptyR(RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pytemptyJs

cCs*|jj�|j�}|jj�|S(sJReturn True if the queue is full, False otherwise (not
        reliable!).(RRt_fullR(RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pytfullSs

cCs�|jj�z�|s.|j�r�t�q�n�|dkr]x�|j�rY|jj�q=Wnm|dkrxtd��nt�|}xB|j�r�|t�}|dkr�t�n|jj|�q�W|j|�|j	j
�Wd|jj�XdS(sPut 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 positive 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).
        is#'timeout' must be a positive numbergN(RRRRtNonetwaitt
ValueErrort_timet_putR
tnotifyR(Rtitemtblockttimeouttendtimet	remaining((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pytput\s&



	
cCs|j|t�S(s�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'tFalse(RR"((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyt
put_nowaitscCs�|jj�z�|s.|j�r�t�q�n�|dkr]x�|j�rY|jj�q=Wnm|dkrxtd��nt�|}xB|j�r�|t�}|dkr�t�n|jj|�q�W|j�}|j	j
�|SWd|jj�XdS(s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 positive 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).
        is#'timeout' must be a positive numbergN(R
RRRRRRRt_getRR!R(RR#R$R%R&R"((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pytget�s(


	
cCs
|jt�S(s�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+R((R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyt
get_nowait�scCs||_t�|_dS(N(RRtqueue(RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR	�s	cCs
t|j�S(N(tlenR-(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR�scCs|jS(N(R-(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR�scCs%|jdko$t|j�|jkS(Ni(RR.R-(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR�scCs|jj|�dS(N(R-tappend(RR"((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR �scCs'|jr|jj�S|jj�SdS(N(RR-tpoptpopleft(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR*�s	
N(RRR(RRRRtTrueRR'R)R+R,R	RRRR R*(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyR*s					#	"						N((RtcollectionsRRRtcompatRt__all__t	ExceptionRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/queue.pyt<module>s

Zerion Mini Shell 1.0