Qf, ddlZddlZddlmZddlmZmZddlmZ ddl m Z gdZ ddl m Z Gd d eZGd d ZGddeZGddeZGddZe eZ yy#e $rdZ YOwxYw#e $rGdd eZ YZwxYw)N)deque)heappushheappop) monotonic) SimpleQueue)EmptyFullQueue PriorityQueue LifoQueuer)rceZdZ y)rN__name__ __module__ __qualname__,/opt/alt/python312/lib64/python3.12/queue.pyrrs> rrceZdZ y)r Nrrrrr r s:rr ceZdZ ddZdZdZdZdZdZddZ dd Z d Z d Z d Z d ZdZdZeej&Zy)r 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*|dkr td|jj||_dddy#1swYyxYw)Nrz!task_done() called too many times)r!r" ValueError notify_all)r$ unfinisheds r task_donezQueue.task_done9sb  ..2JQ>$%HII##..0$.D ! ! s AAA&c |j5|jr'|jj|jr'dddy#1swYyxYwN)r!r"waitr$s rjoinz Queue.joinOsD  ''##((*''! s 3A  Ach |j5|jcdddS#1swYyxYwr-r_qsizer/s rqsizez Queue.qsize\s$G ZZ;;= ! !ZZs(1cj |j5|j cdddS#1swYyxYwr-r2r/s remptyz Queue.emptyas+ ZZ{{}$ % %ZZs)2c |j5d|jcxkxr|jknccdddS#1swYyxYwr)rrr3r/s rfullz Queue.fullos6 ZZt||4t{{}4 5 5ZZs (AA Nc |j5|jdkDr|s#|j|jk\rt|V|j|jk\r|jj |j|jk\r8n|dkr t dt |z}|j|jk\rQ|t z }|dkrt|jj ||j|jk\rQ|j||xjdz c_|jjdddy#1swYyxYw)Nr''timeout' must be a non-negative numberr') r rr3r r.r(time_putr"rnotify)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 E0B E0'AE00E9c. |j5|s|jst|<|js|jj|js+nq|dkr t dt |z}|jsD|t z }|dkrt|jj||jsD|j }|jj|cdddS#1swYyxYw)Nrr:r;) rr3rr.r(r<_getr r>)r$r@rArBrCr?s rgetz Queue.gets ^^{{}K++-NN'')++-1 !JKK&7*++- '$& 0I C'# NN'' 2 ++- 99;D MM "%  ^^sAD $A1D +D  Dc* |j|dSNF)r@rDr$r?s r put_nowaitzQueue.put_nowait xxEx**rc( |jdSrIrGr/s r get_nowaitzQueue.get_nowait xxex$$rc"t|_yr-)rqueuer#s rrz Queue._inits W rc,t|jSr-lenrSr/s rr3z Queue._qsize4::rc:|jj|yr-rSappendrKs rr=z Queue._put $rc6|jjSr-)rSpopleftr/s rrFz Queue._getszz!!##r)rTN)rrrr%r+r0r4r6r8rDrGrLrPrr3r=rF classmethodtypes GenericAlias__class_getitem__rrrr r sa "./, +! % 5$@>+% $$E$6$67rr c&eZdZ dZdZdZdZy)r cg|_yr-rSr#s rrzPriorityQueue._init  rc,t|jSr-rUr/s rr3zPriorityQueue._qsizerWrc0t|j|yr-)rrSrKs rr=zPriorityQueue._putsT"rc,t|jSr-)rrSr/s rrFzPriorityQueue._getstzz""rNrrrrr3r=rFrrrr r s ##rr c&eZdZ dZdZdZdZy)r cg|_yr-rer#s rrzLifoQueue._initrfrc,t|jSr-rUr/s rr3zLifoQueue._qsizerWrc:|jj|yr-rYrKs rr=zLifoQueue._putr[rc6|jjSr-)rSpopr/s rrFzLifoQueue._getszz~~rNrjrrrr r sL  rr c`eZdZ dZd dZd dZdZdZdZdZ e e jZ y) _PySimpleQueuecVt|_tjd|_yr)r_queuer Semaphore_countr/s rr%z_PySimpleQueue.__init__ sg ))!, rNcp |jj||jjyr-)rtrZrvrelease)r$r?r@rAs rrDz_PySimpleQueue.puts+ 4  rc ||dkr td|jj||st|jj S)Nrr:)r(rvacquirerrtr])r$r@rAs rrGz_PySimpleQueue.getsM   7Q;FG G{{""5'2K{{""$$rc* |j|dSrIrJrKs rrLz_PySimpleQueue.put_nowait*rMrc( |jdSrIrOr/s rrPz_PySimpleQueue.get_nowait2rQrc4 t|jdk(SrrVrtr/s rr6z_PySimpleQueue.empty:sQ4;;1$$rc. t|jSr-r~r/s rr4z_PySimpleQueue.qsize>sG4;;rr^)rrrr%rDrGrLrPr6r4r_r`rarbrrrrrrrs=-%"+%% $E$6$67rrr)rr` collectionsrheapqrrr<rrtr ImportError__all__r Exceptionr r r r rrrrrrs- #"" R   9 @8@8F#E#&    @8@8F Kw K    s"A+A8+A54A58B  B