Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
 ‹EYc@smdZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZd
ddd
ddgZeƒZejjjZejjjZdefd„ƒYZd
efd„ƒYZdefd„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdS(sÌSynchronized queues.

The :mod:`eventlet.queue` module implements multi-producer, multi-consumer
queues that work across greenlets, with the API similar to the classes found in
the standard :mod:`Queue` and :class:`multiprocessing <multiprocessing.Queue>`
modules.

A major difference is that queues in this module operate as channels when
initialized with *maxsize* of zero. In such case, both :meth:`Queue.empty`
and :meth:`Queue.full` return ``True`` and :meth:`Queue.put` always blocks until
a call to :meth:`Queue.get` retrieves the item.

An interesting difference, made possible because of greenthreads, is
that :meth:`Queue.qsize`, :meth:`Queue.empty`, and :meth:`Queue.full` *can* be
used as indicators of whether the subsequent :meth:`Queue.get`
or :meth:`Queue.put` will not block.  The new methods :meth:`Queue.getting`
and :meth:`Queue.putting` report on the number of greenthreads blocking
in :meth:`put <Queue.put>` or :meth:`get <Queue.get>` respectively.
iÿÿÿÿ(tprint_functionN(tEvent(t
getcurrent(tget_hub(tsix(tqueue(tTimeouttQueuet
PriorityQueuet	LifoQueuet
LightQueuetFulltEmptytWaitercBsneZdZdgZd„Zd„Zd„Zd„ZeZe	d„ƒZ
d
d„Zd„Z
d	„ZRS(s6A low level synchronization class.

    Wrapper around greenlet's ``switch()`` and ``throw()`` calls that makes them safe:

    * switching will occur only if the waiting greenlet is executing :meth:`wait`
      method currently. Otherwise, :meth:`switch` and :meth:`throw` are no-ops.
    * any error raised in the greenlet is handled inside :meth:`switch` and :meth:`throw`

    The :meth:`switch` and :meth:`throw` methods must only be called from the :class:`Hub` greenlet.
    The :meth:`wait` method must be called from a greenlet other than :class:`Hub`.
    tgreenletcCs
d|_dS(N(tNoneR(tself((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt__init__NscCsD|jrd}nd}dt|ƒjtt|ƒƒ||jfS(Ns waitingts<%s at %s%s greenlet=%r>(twaitingttypet__name__thextidR(RR((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt__repr__Qs
		cCs5|jrd}nd}dt|ƒj||jfS(sD
        >>> print(Waiter())
        <Waiter greenlet=None>
        s waitingRs<%s%s greenlet=%s>(RRRR(RR((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt__str__Zs		cCs
|jdk	S(N(RR(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt__nonzero__escCs
|jdk	S(N(RR(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyRjscCs_tƒtƒjks!tdƒ‚|jdk	r[y|jj|ƒWq[tjƒq[XndS(sWake up the greenlet that is calling wait() currently (if there is one).
        Can only be called from Hub's greenlet.
        s3Can only use Waiter.switch method from the mainloopN(RRRtAssertionErrorRtswitcht	tracebackt	print_exc(Rtvalue((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyRns	cGs_tƒtƒjks!tdƒ‚|jdk	r[y|jj|ŒWq[tjƒq[XndS(suMake greenlet calling wait() wake up (if there is a wait()).
        Can only be called from Hub's greenlet.
        s3Can only use Waiter.switch method from the mainloopN(RRRRRtthrowRR(Rt
throw_args((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR zs	cCsS|jdks%td|jfƒ‚tƒ|_ztƒjƒSWdd|_XdS(s2Wait until switch() or throw() is called.
        s!This Waiter is already used by %rN(RRRRRR(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytwait‡s
%N(Rt
__module__t__doc__t	__slots__RRRRt__bool__tpropertyRRRR R"(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR
@s							
cBsÈeZdZdd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„Zd„Zd
„Zedd„Zd„Zedd„Zd„Zd„Zd„ZRS(s 
    This is a variant of Queue that behaves mostly like the standard
    :class:`Stdlib_Queue`.  It differs by not supporting the
    :meth:`task_done <Stdlib_Queue.task_done>` or
    :meth:`join <Stdlib_Queue.join>` methods, and is a little faster for
    not having that overhead.
    cCs_|dks|dkr$d|_n	||_tƒ|_tƒ|_d|_|j|ƒdS(Ni(Rtmaxsizetsettgetterstputterst
_event_unlockt_init(RR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR›s		cCstjƒ|_dS(N(tcollectionstdequeR(RR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR-§scCs
|jjƒS(N(Rtpopleft(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt_getªscCs|jj|ƒdS(N(Rtappend(Rtitem((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt_put­scCs,dt|ƒjtt|ƒƒ|jƒfS(Ns
<%s at %s %s>(RRRRt_format(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR°scCsdt|ƒj|jƒfS(Ns<%s %s>(RRR5(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR³scCsœd|jf}t|ddƒr6|d|j7}n|jrY|dt|jƒ7}n|jr||dt|jƒ7}n|jdk	r˜|d7}n|S(Ns
maxsize=%rRs	 queue=%rs getters[%s]s putters[%s]s
 unlocking(R(tgetattrRRR*tlenR+R,(Rtresult((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR5¶s		
cCs
t|jƒS(sReturn the size of the queue.(R7R(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytqsizeÂscCsD|jdk	r7|dks*||jkr7|jƒn||_dS(syResizes the queue's maximum size.

        If the size is increased, and there are putters waiting, they may be woken up.N(R(Rt_schedule_unlock(Rtsize((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytresizeÆs*
cCs
t|jƒS(s`Returns the number of greenthreads that are blocked waiting to put
        items into the queue.(R7R+(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytputtingÐscCs
t|jƒS(sVReturns the number of greenthreads that are blocked waiting on an
        empty queue.(R7R*(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytgettingÕscCs|jƒS(s;Return ``True`` if the queue is empty, ``False`` otherwise.(R9(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytemptyÚscCs"|jdk	o!|jƒ|jkS(skReturn ``True`` if the queue is full, ``False`` otherwise.

        ``Queue(None)`` is never full.
        N(R(RR9(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytfullÞscCs~|jdks$|jƒ|jkrJ|j|ƒ|jrz|jƒqzn0|r¾tƒjtƒkr¾xL|jr´|jj	ƒ}|ri|j|ƒ|j
ƒ}|j|ƒdSqiWt‚n¼|rtt
|ƒ}|jj|ƒt|tƒ}zd|jr|jƒn|jƒ}||ks3td|fƒ‚|jtk	rR|j|ƒnWd|jƒ|jj|ƒXnt‚dS(s#Put an item into the queue.

        If optional arg *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 :class:`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 :class:`Full` exception (*timeout*
        is ignored in that case).
        Ns!Invalid switch into Queue.put: %r(R(RR9R4R*R:RRRtpopR1RRt
ItemWaiterR+taddRR"RR3t_NONEtcanceltdiscard(RR3tblockttimeouttgettertwaiterR8((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytputæs6$
	

		

cCs|j|tƒdS(s²Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the :class:`Full` exception.
        N(RKtFalse(RR3((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt
put_nowaitscCs|jƒr,|jr"|jƒn|jƒS|rœtƒjtƒkrœxH|jr’|jjƒ}|rK|j|ƒ|jƒr|jƒSqKqKWt	‚ny|rt
ƒ}t|t	ƒ}z4|jj
|ƒ|jrã|jƒn|jƒSWd|jj|ƒ|jƒXnt	‚dS(sRemove 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 :class:`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 :class:`Empty` exception
        (*timeout* is ignored in that case).
        N(R9R+R:R1RRRRARRR
RR*RCR"RFRE(RRGRHtputterRJ((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytgets.
	


			
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 :class:`Empty` exception.
        (RORL(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt
get_nowait@scCs|zkxdtri|jƒrv|jrv|jjƒ}|rfy|jƒ}Wn|jtjƒŒqsX|j|ƒqfq|j	r|jr|j	jƒ}|rf|jjƒ}|rú|j
}t|_
|j|ƒ|jƒ}|j|ƒ|j|ƒq
|j	j
|ƒqfq|j	re|jsF|jdksF|jƒ|jkre|j	jƒ}|j|ƒqPqWWdd|_XdS(N(tTrueR9R*RAR1R tsystexc_infoRR+R3RDR4RCR(RR,(RRIR3RN((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt_unlockHs:			

	cCs1|jdkr-tƒjd|jƒ|_ndS(Ni(R,RRtschedule_call_globalRT(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR:osN(RR#R$RRR-R1R4RRR5R9R<R=R>R?R@RQRKRMRORPRTR:(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR
’s(								
				,	&		'RBcBseZdgZd„ZRS(R3cCstj|ƒ||_dS(N(R
RR3(RR3((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyRws
(RR#R%R(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyRBts	cBsGeZdZdd„Zd„Zd„Zd„Zd„Zd„Z	RS(s¯Create a queue object with a given maximum size.

    If *maxsize* is less than zero or ``None``, the queue size is infinite.

    ``Queue(0)`` is a channel, that is, its :meth:`put` method always blocks
    until the item is delivered. (This is unlike the standard
    :class:`Stdlib_Queue`, where 0 means infinite size).

    In all other respects, this Queue class resembles the standard library,
    :class:`Stdlib_Queue`.
    cCs)tj||ƒd|_tƒ|_dS(Ni(R
Rtunfinished_tasksRt_cond(RR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR‰s	cCs9tj|ƒ}|jr5|d|j|jf7}n|S(Ns tasks=%s _cond=%s(R
R5RVRW(RR8((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR5Žs	cCstj||ƒ|jƒdS(N(R
R4t_put_bookkeeping(RR3((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR4”scCs2|jd7_|jjƒr.|jjƒndS(Ni(RVRWtreadytreset(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyRX˜scCsS|jdkrtdƒ‚n|jd8_|jdkrO|jjdƒndS(sYIndicate that a formerly enqueued task is complete. Used by queue consumer threads.
        For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to
        :meth:`task_done` tells the queue that the processing on the task is complete.

        If a :meth:`join` is currently blocking, it will resume when all items have been processed
        (meaning that a :meth:`task_done` call was received for every item that had been
        :meth:`put <Queue.put>` into the queue).

        Raises a :exc:`ValueError` if called more times than there were items placed in the queue.
        is!task_done() called too many timesiN(RVt
ValueErrorRWtsendR(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt	task_dones
cCs#|jdkr|jjƒndS(s’Block 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 :meth:`task_done` to indicate
        that the item was retrieved and all work on it is complete. When the count of
        unfinished tasks drops to zero, :meth:`join` unblocks.
        iN(RVRWR"(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pytjoin¯sN(
RR#R$RRR5R4RXR]R^(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR|s				cBs5eZdZd„Zejd„Zejd„ZRS(s¦A subclass of :class:`Queue` that retrieves entries in priority order (lowest first).

    Entries are typically tuples of the form: ``(priority number, data)``.
    cCs
g|_dS(N(R(RR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR-ÁscCs||j|ƒ|jƒdS(N(RRX(RR3theappush((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR4ÄscCs
||jƒS(N(R(Rtheappop((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR1Ès(	RR#R$R-theapqR_R4R`R1(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR»s	cBs)eZdZd„Zd„Zd„ZRS(sNA subclass of :class:`Queue` that retrieves most recently added entries first.cCs
g|_dS(N(R(RR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR-ÏscCs|jj|ƒ|jƒdS(N(RR2RX(RR3((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR4ÒscCs
|jjƒS(N(RRA(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR1Ös(RR#R$R-R4R1(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyR	Ìs		( R$t
__future__RRRRaR.Rteventlet.eventRteventlet.greenthreadRt
eventlet.hubsRteventlet.supportRteventlet.support.six.movesRtStdlib_Queueteventlet.timeoutRt__all__tobjectRDtmovesRRR
R
RBRRR	(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/queue.pyt<module>)s*	Râ?