python (3.12.0)

(root)/
lib/
python3.12/
__pycache__/
queue.cpython-312.pyc

ˑe,dZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZgdZ
	ddl
mZGddeZGd
dZGddeZGddeZGddZeeZyy#e$rdZYOwxYw#e$rGd	d
eZYZwxYw)z'A multi-producer, multi-consumer queue.N)deque)heappushheappop)	monotonic)SimpleQueue)EmptyFullQueue
PriorityQueue	LifoQueuer)rceZdZdZy)rz4Exception raised by Queue.get(block=0)/get_nowait().N__name__
__module____qualname____doc__9/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/queue.pyrrs>rrceZdZdZy)r	z4Exception raised by Queue.put(block=0)/put_nowait().Nrrrrr	r	s:rr	ceZdZdZddZdZdZdZdZdZ	dd	Z
dd
ZdZdZ
d
ZdZdZdZeej(Zy)r
zjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    cL||_|j|tj|_tj
|j|_tj
|j|_tj
|j|_d|_	yNr)
maxsize_init	threadingLockmutex	Condition	not_emptynot_fullall_tasks_doneunfinished_tasksselfrs  r__init__zQueue.__init__"sv

7^^%
#,,TZZ8"++DJJ7
(11$**= !rc|j5|jdz
}|dkr*|dkrtd|jj||_dddy#1swYyxYw)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  For each get() used to fetch a task,
        a subsequent call to task_done() tells the queue that the processing
        on the task is complete.

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

        Raises a ValueError if called more times than there were items
        placed in the queue.
        rz!task_done() called too many timesN)r"r#
ValueError
notify_all)r%
unfinisheds  r	task_donezQueue.task_done9sf
 
 	/..2JQ>$%HII##..0$.D!
	/	/	/sAAA%c|j5|jr'|jj|jr'dddy#1swYyxYw)aBlocks 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 task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)r"r#waitr%s rjoinz
Queue.joinOsH
 
 	+''##((*''	+	+	+s3A

Acf|j5|jcdddS#1swYyxYw)9Return the approximate size of the queue (not reliable!).Nr_qsizer/s rqsizezQueue.qsize\s'
ZZ	!;;=	!	!	!s'0ch|j5|jcdddS#1swYyxYw)aReturn True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        Nr3r/s remptyzQueue.emptyas,ZZ	%{{}$	%	%	%s(1c|j5d|jcxkxr|jknccdddS#1swYyxYw)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr4r/s rfullz
Queue.fullos7ZZ	5t||4t{{}4	5	5	5s	(?ANc|j5|jdkDr|s#|j|jk\rt|V|j|jk\r|jj	|j|jk\r8n|dkrtdt
|z}|j|jk\rQ|t
z
}|dkrt|jj	||j|jk\rQ|j||xjdz
c_|jjdddy#1swYyxYw)aPut 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 non-negative 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).
        rN''timeout' must be a non-negative numberr()r!rr4r	r.r)time_putr#r notify)r%itemblocktimeoutendtime	remainings      rputz	Queue.putzs]]	$||a{{}4"
_++-4<<7

**,++-4<<7q[$%NOO"fw.G++-4<<7$+df$4	$+"&J

**95	++-4<<7

IIdO!!Q&!NN!!#'	$	$	$sBE/BE/&AE//E8c,|j5|s|jst|<|js|jj|js+nq|dkrt	dt|z}|jsD|tz
}|dkrt|jj||jsD|j
}|jj|cdddS#1swYyxYw)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 non-negative 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).
        Nrr;r<)	r r4rr.r)r=_getr!r?)r%rArBrCrDr@s      rgetz	Queue.gets^^	{{}K++-NN'')++-1 !JKK&7*++- '$& 0I C'#NN''	2	++-
99;DMM  "%			sAD
#A1D
+D

Dc(|j|dS)zPut an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        FrArEr%r@s  r
put_nowaitzQueue.put_nowaitxxEx**rc&|jdSzRemove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        FrKrIr/s r
get_nowaitzQueue.get_nowaitxxex$$rc"t|_yN)rqueuer$s  rrzQueue._initsW
rc,t|jSrVlenrWr/s rr4zQueue._qsize4::rc:|jj|yrVrWappendrMs  rr>z
Queue._put

$rc6|jjSrV)rWpopleftr/s rrHz
Queue._getszz!!##r)rTN)rrrrr&r,r0r5r7r9rErIrNrSrr4r>rHclassmethodtypesGenericAlias__class_getitem__rrrr
r
sa
"./,+!
%	5$@>+% $$E$6$67rr
c(eZdZdZdZdZdZdZy)rzVariant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    cg|_yrVrWr$s  rrzPriorityQueue._init	
rc,t|jSrVrYr/s rr4zPriorityQueue._qsizer[rc0t|j|yrV)rrWrMs  rr>zPriorityQueue._putsT"rc,t|jSrV)rrWr/s rrHzPriorityQueue._getstzz""rNrrrrrr4r>rHrrrrrs
##rrc(eZdZdZdZdZdZdZy)rzBVariant of Queue that retrieves most recently added entries first.cg|_yrVrir$s  rrzLifoQueue._initrjrc,t|jSrVrYr/s rr4zLifoQueue._qsizer[rc:|jj|yrVr]rMs  rr>zLifoQueue._putr_rc6|jjSrV)rWpopr/s rrHzLifoQueue._getszz~~rNrnrrrrrsL  rrcbeZdZdZdZd
dZd
dZdZdZdZ	d	Z
eejZy)_PySimpleQueuezYSimple, unbounded FIFO queue.

    This pure Python implementation is not reentrant.
    cVt|_tjd|_yr)r_queuer	Semaphore_countr/s rr&z_PySimpleQueue.__init__sg))!,rNcn|jj||jjy)zPut the item on the queue.

        The optional 'block' and 'timeout' arguments are ignored, as this method
        never blocks.  They are provided for compatibility with the Queue class.
        N)rxr^rzrelease)r%r@rArBs    rrEz_PySimpleQueue.puts&	
4 rc||dkrtd|jj||st|jjS)rGrr;)r)rzacquirerrxra)r%rArBs   rrIz_PySimpleQueue.getsH7Q;FGG{{""5'2K{{""$$rc(|j|dS)zPut an item into the queue without blocking.

        This is exactly equivalent to `put(item, block=False)` and is only provided
        for compatibility with the Queue class.
        FrKrLrMs  rrNz_PySimpleQueue.put_nowait*rOrc&|jdSrQrRr/s rrSz_PySimpleQueue.get_nowait2rTrc2t|jdk(S)zCReturn True if the queue is empty, False otherwise (not reliable!).rrZrxr/s rr7z_PySimpleQueue.empty:s4;;1$$rc,t|jS)r2rr/s rr5z_PySimpleQueue.qsize>s4;;rrb)rrrrr&rErIrNrSr7r5rcrdrerfrrrrvrvs=-%"+%% $E$6$67rrv)rrrdcollectionsrheapqrrr=rrxrImportError__all__r	Exceptionr	r
rrrvrrr<module>rs-#""R
	9	
@8@8F#E#&
 
  @8@8F Kw	K

	

s"A,A9,A65A69BB