mς ™%άGc@s–dZdklZydklZWndefd„ƒYZnXdddgZdefd„ƒYZdefd „ƒYZ dfd „ƒ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. this is to support the connection pool's usage of __del__ to return connections to the underlying Queue, which can apparently 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.(stime(sdequetdequecBstZd„ZRS(NcCs |idƒS(Ni(tselftpop(R((t4/home/holguin2/public_html/spyce/sqlalchemy/queue.pytpoplefts(t__name__t __module__R(((RRstEmptytFulltQueuecBstZdZRS(s4Exception raised by Queue.get(block=0)/get_nowait().(RRt__doc__(((RRs cBstZdZRS(s4Exception raised by Queue.put(block=0)/put_nowait().(RRR (((RRs cBs•tZdd„Zd„Zd„Zd„Zedd„Zd„Z edd„Z d „Z d „Z d „Z d „Zd „Zd„Zd„ZRS(NicCsvy dk}Wntj odk}nX|i|ƒ|iƒ|_|i|iƒ|_ |i|iƒ|_ dS(svInitialize a queue object with a given maximum size. If maxsize is <= 0, the queue size is infinite. N( t threadingt ImportErrortdummy_threadingRt_inittmaxsizetRLocktmutext Conditiont not_emptytnot_full(RRR ((Rt__init__s  cCs*|iiƒ|iƒ}|iiƒ|S(s9Return the approximate size of the queue (not reliable!).N(RRtacquiret_qsizetntrelease(RR((Rtqsize4s    cCs*|iiƒ|iƒ}|iiƒ|S(sCReturn True if the queue is empty, False otherwise (not reliable!).N(RRRt_emptyRR(RR((Rtempty;s    cCs*|iiƒ|iƒ}|iiƒ|S(sBReturn True if the queue is full, False otherwise (not reliable!).N(RRRt_fullRR(RR((RtfullBs    cCs|iiƒzζ|p|iƒo t‚qΨn§|djo&x–|iƒo|iiƒqBWnt|djot dƒ‚nt ƒ|}xF|iƒo8|t ƒ}|djo t‚n|ii|ƒq’W|i |ƒ|iiƒWd|iiƒ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 numberf0.0N(RRRtblockRRttimeouttNonetwaitt ValueErrort_timetendtimet remainingt_puttitemRtnotifyR(RR(RR R&R%((RtputIs.            cCs|i|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. N(RR*R(tFalse(RR(((Rt put_nowaitjscCs |iiƒzι|p|iƒo t‚qΨn§|djo&x–|iƒo|iiƒqBWnt|djot dƒ‚nt ƒ|}xF|iƒo8|t ƒ}|djo t‚n|ii|ƒq’W|i ƒ}|iiƒ|SWd|iiƒXdS(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 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 numberf0.0N(RRRRRRR R!R"R#R$R%R&t_getR(RR)R(RRR R(R&R%((Rtgetrs0             cCs |itƒ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. N(RR.R+(R((Rt get_nowait”scCs||_tƒ|_dS(N(RRRtqueue(RR((RR‘s cCs t|iƒS(N(tlenRR0(R((RR₯scCs|i S(N(RR0(R((RR©scCs&|idjot|iƒ|ijS(Ni(RRR1R0(R((RR­scCs|ii|ƒdS(N(RR0tappendR((RR(((RR'±scCs |iiƒS(N(RR0R(R((RR-΅s(RRRRRRtTrueR!R*R,R.R/RRRRR'R-(((RR s    ! "     N( R ttimeR$t collectionsRtlistt__all__t ExceptionRRR (RRR7R R$R((Rt?s