a DOg,@sddlZddlZddlmZddlmZmZddlmZzddl m Z Wne y^dZ Yn0gdZ zddl m Z Wn"e yGdd d eZ Yn0Gd d d eZGd d d ZGdddeZGdddeZGdddZe dureZ dS)N)deque)heappushheappop) monotonic) SimpleQueue)EmptyFullQueue PriorityQueue LifoQueuer)rc@s eZdZdS)rN__name__ __module__ __qualname__rr*/opt/alt/python39/lib64/python3.9/queue.pyrsrc@s eZdZdS)rNr rrrrrsrc@seZdZd ddZddZddZdd Zd d Zd d Zd!ddZ d"ddZ ddZ ddZ ddZ ddZddZddZeejZdS)#r rcCsN||_||t|_t|j|_t|j|_t|j|_d|_ dSNr) maxsize_init threadingZLockmutexZ Condition not_emptynot_fullall_tasks_doneunfinished_tasksselfrrrr__init__"s  zQueue.__init__cCs\|jB|jd}|dkr4|dkr*td|j||_Wdn1sN0YdS)Nrz!task_done() called too many times)rr ValueErrorZ notify_all)rZ unfinishedrrr task_done9s  zQueue.task_donecCs<|j"|jr|jqWdn1s.0YdSN)rrwaitrrrrjoinOs z Queue.joincCs2|j|WdS1s$0YdSr!r_qsizer#rrrqsize\sz Queue.qsizecCs4|j| WdS1s&0YdSr!r%r#rrremptyas z Queue.emptycCsH|j.d|jko |knWdS1s:0YdSr)rrr&r#rrrfullosz Queue.fullTNcCs|j|jdkr|s*||jkrtnr|durN||jkr|jq2nN|dkr`tdnr#rrrr&szPriorityQueue._qsizecCst|j|dSr!)rr=r9rrrr-szPriorityQueue._putcCs t|jSr!)rr=r#rrrr5szPriorityQueue._getNr rrrr&r-r5rrrrr sr c@s,eZdZddZddZddZddZd S) r cCs g|_dSr!rGrrrrrszLifoQueue._initcCs t|jSr!r>r#rrrr&szLifoQueue._qsizecCs|j|dSr!r@r9rrrr-szLifoQueue._putcCs |jSr!)r=popr#rrrr5szLifoQueue._getNrHrrrrr sr c@sReZdZddZdddZdddZd d Zd d Zd dZddZ e e j Z dS)_PySimpleQueuecCst|_td|_dSr)r_queuerZ Semaphore_countr#rrrr sz_PySimpleQueue.__init__TNcCs|j||jdSr!)rKrArLrelease)rr/r0r1rrrr4s z_PySimpleQueue.putcCs4|dur|dkrtd|j||s*t|jS)Nrr*)rrLacquirerrKrB)rr0r1rrrr6s z_PySimpleQueue.getcCs|j|ddSr7r8r9rrrr:*sz_PySimpleQueue.put_nowaitcCs |jddSr7r;r#rrrr<2sz_PySimpleQueue.get_nowaitcCst|jdkSrr?rKr#rrrr(:sz_PySimpleQueue.emptycCs t|jSr!rOr#rrrr'>sz_PySimpleQueue.qsize)TN)TN)r rrrr4r6r:r<r(r'rCrDrErFrrrrrJs  rJ)rrD collectionsrheapqrrr,rrKr ImportError__all__r Exceptionrr r r rJrrrrs*     DC