Repository URL to install this package:
|
Version:
4.0.111 ▾
|
contego
/
home
/
tvault
/
.virtenv
/
lib
/
python2.7
/
site-packages
/
sqlalchemy
/
util
/
queue.pyc
|
|---|
ó
EYc @ s d Z d d l m Z d d l m Z d d l m Z d d d g Z d e f d YZ d e f d
YZ
d d
d YZ d 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ÿÿÿÿ( t deque( t timei ( t threadingt Emptyt Fullt Queuec B s e Z d Z RS( s4 Exception raised by Queue.get(block=0)/get_nowait().( t __name__t
__module__t __doc__( ( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyR s c B s e Z d Z RS( s4 Exception raised by Queue.put(block=0)/put_nowait().( R R R ( ( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyR # s c B s e Z d d Z d Z d Z d Z e d d Z d Z e d d Z
d Z d Z d
Z
d Z d Z d
Z d Z RS( i c C sJ | j | t j | _ t j | j | _ t j | j | _ d S( sx Initialize a queue object with a given maximum size.
If `maxsize` is <= 0, the queue size is infinite.
N( t _initR t RLockt mutext Conditiont not_emptyt not_full( t selft maxsize( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyt __init__* s
c C s* | j j | j } | j j | S( s9 Return the approximate size of the queue (not reliable!).( R t acquiret _qsizet release( R t n( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyt qsize= s
c C s* | j j | j } | j j | S( sK Return True if the queue is empty, False otherwise (not
reliable!).( R R t _emptyR ( R R ( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyt emptyE s
c C s* | j j | j } | j j | S( sJ Return True if the queue is full, False otherwise (not
reliable!).( R R t _fullR ( R R ( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyt fullN s
c C sú | j j zØ | s. | j rÊ t qÊ n | d k r] x | j rY | j j q= Wnm | d k rx t d n t | } xB | j rÉ | t } | d k r¶ t n | j j | q W| j | | j j
Wd | j j Xd S( s Put 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).
i s# 'timeout' must be a positive numberg N( R R R R t Nonet waitt
ValueErrort _timet _putR
t notifyR ( R t itemt blockt timeoutt endtimet remaining( ( sJ /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/util/queue.pyt putW s&