Qf' ddlZddlZddlZddlZddlmZddl m Z ddl m Z  ddlmZgdZej(Zej,Zej0Zej4Zej6Z ej8Z ej<ZdZejAd ejBZ" ejFZ$ejJZ%[da&da'd Z(d Z)d Z*dZ+dZ,dZ-eZ.dZ#GddZ/e/Z0GddZ1GddZ2Gdde2Z3GddZ4GddZ5Gdde6Z7e d jpZ9d!Z:e#a;iZea?e@aAd"ZBGd#d$ZC dd%lmDaEmFZGtZLd,ZMGd-d.eCZNGd/d0eCZOGd1d2eCZPd3ZQd4ZRd5ZSd6ZTd7ZUd8ZVgZWd aXd9ZYdd:lmZZZeOa[d;Z\d<Z] dd=lm^Z_d?Zaebed@rejeaAyy#e$r ddlmZYwxYw#e$rdZYwxYw#e$rd ZYwxYw#e$rdZ$YtwxYw#e$rdd&lHmIZJdd'lmKZKeKd(d)ZFd*ZGd+aEYwxYw#e$r dd>l`m_Z_YwxYw)BN) monotonic)WeakSet)count)deque) get_ident active_count Conditioncurrent_thread enumerate main_thread TIMEOUT_MAXEventLockRLock SemaphoreBoundedSemaphoreThreadBarrierBrokenBarrierErrorTimer ThreadError setprofilesettracelocal stack_size excepthookExceptHookArgsgettrace getprofilesetprofile_all_threadssettrace_all_threadscyNTr$0/opt/alt/python312/lib64/python3.12/threading.py_is_main_interpreterr'4sr%T get_native_idFc |ayN _profile_hookfuncs r&rrJs Mr%cF t|tj|yr*)r_sys_setprofileallthreadsr-s r&r r Ss tt$r%c tSr*r+r$r%r&rr]s E r%c |ayr* _trace_hookr-s r&rras Kr%cF t|tj|yr*)rr0_settraceallthreadsr-s r&r!r!js  TNT"r%c tSr*r4r$r%r&rrts @ r%c< t t|i|St|i|Sr*)_CRLock_PyRLock)argskwargss r&rr|s.((( D #F ##r%cPeZdZ dZdZdZd dZeZdZdZ dZ dZ d Z d Z y ) _RLockc>t|_d|_d|_yNr)_allocate_lock_block_owner_countselfs r&__init__z_RLock.__init__s$&   r%c 6|j} t|j}d|jj rdnd|j j|j j||jtt|fzS#t$rYvwxYw)Nz)<%s %s.%s object owner=%r count=%d at %s>lockedunlocked) rD_activenameKeyErrorrCrJ __class__ __module__ __qualname__rEhexid)rGowners r&__repr__z_RLock.__repr__s  EN''E; **,H* NN % % NN ' '  KK 4M >      sB BBcT|jjd|_d|_yrA)rC_at_fork_reinitrDrErFs r&rWz_RLock._at_fork_reinits  ##%  r%c t}|j|k(r|xjdz c_y|jj ||}|r||_d|_|SN)rrDrErCacquire)rGblockingtimeoutmercs r&r[z_RLock.acquiresY 2[ ;;"  KK1 K [[ 7 3 DKDK r%c |jtk7r td|jdz x|_}|s"d|_|jj yy)Ncannot release un-acquired lockrZ)rDr RuntimeErrorrErCrelease)rGrs r&rcz_RLock.releasesV  ;;)+ %@A A"kkAo- eDK KK   !r%c$|jyr*rcrGtvtbs r&__exit__z_RLock.__exit__  r%cV|jj|\|_|_yr*)rCr[rErD)rGstates r&_acquire_restorez_RLock._acquire_restores  #(  T[r%c|jdk(r td|j}d|_|j}d|_|jj ||fS)Nrra)rErbrDrCrc)rGrrTs r& _release_savez_RLock._release_savesT ;;! @A A     u~r%c0|jtk(Sr*)rDrrFs r& _is_ownedz_RLock._is_owneds{{ik))r%cJ|jtk7ry|jSrA)rDrrErFs r&_recursion_countz_RLock._recursion_counts ;;)+ %{{r%NT)__name__rPrQrHrUrWr[ __enter__rcrjrnrprrrtr$r%r&r?r?sA   "HI". )* r%r?cdeZdZ ddZdZdZdZdZdZdZ d Z dd Z dd Z dd Z d ZdZy)r Nc:| t}||_|j|_|j|_t |dr|j |_t |dr|j |_t |dr|j|_t|_ y)Nrprnrr) r_lockr[rchasattrrprnrr_deque_waitersrGlocks r&rHzCondition.__init__s| <7D || ||  4 )!%!3!3D  4+ ,$($9$9D ! 4 %!^^DN r%cl|jj|jjyr*)r{rWr~clearrFs r&rWzCondition._at_fork_reinit's" ""$ r%c6|jjSr*)r{rxrFs r&rxzCondition.__enter__+szz##%%r%c4|jj|Sr*)r{rj)rGr<s r&rjzCondition.__exit__.s"tzz""D))r%cJd|jt|jfzS)Nz)r{lenr~rFs r&rUzCondition.__repr__1s$ C 4F'GGGr%c8|jjyr*)r{rcrFs r&rpzCondition._release_save4 r%c8|jjyr*)r{r[)rGxs r&rnzCondition._acquire_restore7rr%cp|jjdr|jjyy)NFT)r{r[rcrFs r&rrzCondition._is_owned:s, ::  e $ JJ   r%cP |js tdt}|j|jj ||j }d} ||jd}n)|dkDr|jd|}n|jd}||j||s |jj|SS#t$rYSwxYw#|j||s, |jj|w#t$rYwwxYwwxYw)Nzcannot wait on un-acquired lockFTr) rrrbrBr[r~appendrprnremove ValueError)rGr]waiter saved_stategotits r&waitzCondition.waitCs ,~~@A A! V$((*   Q;"NN49E"NN51E  ! !+ .MM((0"  ! !+ .MM((0!sB%?C$8C C! C!$D%9DD% D!D% D!!D%c d}|}|}|sB|%|t|z}n|tz }|dkr |S|j||}|sB|SrA)_timer)rG predicater]endtimewaittimeresults r&wait_forzCondition.wait_forssr #?#g0G&0H1}  IIh [F r%c |js td|j}|r=|dkDr7|d} |j|dz} |j ||r|dkDr5yyyy#t$rY)wxYw#t $rY&wxYw)Nz!cannot notify on un-acquired lockrrZ)rrrbr~rcrr)rGnwaitersrs r&notifyzCondition.notifys ~~BC C--!a%QZF  Q v&!a%g%g       s#A) A8) A54A58 BBcN |jt|jyr*)rrr~rFs r& notify_allzCondition.notify_alls C &'r%c^ ddl}|jdtd|jy)Nrz3notifyAll() is deprecated, use notify_all() instead stacklevel)warningswarnDeprecationWarningrrGrs r& notifyAllzCondition.notifyAlls/  K(Q  8 r%r*rZ)rwrPrQrHrWrxrjrUrprnrrrrrrrr$r%r&r r sJ !$&*H.`.<( r%r c6eZdZ ddZdZddZeZddZdZy) rcb|dkr tdtt|_||_y)Nrz$semaphore initial value must be >= 0)rr r_cond_value)rGvalues r&rHzSemaphore.__init__s* 19CD Dtv&  r%c |j}d|jd|jdt|dd|jd S)N<. at #x: value=>)rOrPrQrSrrGclss r&rUzSemaphore.__repr__sKnnCNN#1S%5%5$6d2d8B-H++a) *r%Ncd |s | tdd}d}|j5|jdk(rS|sng|#|t|z}n|tz }|dkrnB|jj ||jdk(rS|xjdzc_d}ddd|S#1swY|SxYw)Nz.can't specify timeout for non-blocking acquireFrrZT)rrrrr)rGr\r]r_rs r&r[zSemaphore.acquires .G/MN N  ZZ++"&"''G"3")EG"3"a<! (++" q   sA"B%B%%B/c |dkr td|j5|xj|z c_|jj|dddy#1swYyxYw)NrZn must be one or more)rrrrrGrs r&rczSemaphore.releasesM q545 5 ZZ KK1 K JJ  a ZZs 1AA!c$|jyr*rerfs r&rjzSemaphore.__exit__rkr%r)TN) rwrPrQrHrUr[rxrcrjr$r%r&rrs( * +ZI !r%rc0eZdZ dfd ZdZddZxZS)rc2t||||_yr*)superrH_initial_value)rGrrOs r&rHzBoundedSemaphore.__init__%s #r%c |j}d|jd|jdt|dd|jd|j d S)Nrrrrr/r)rOrPrQrSrrrs r&rUzBoundedSemaphore.__repr__)sYnnCNN#1S%5%5$6d2d8B-H++a(;(;'>"!C$4$4#5T"T(2bPQRRr%c8|jjyr*)rrWrFs r&rWzEvent._at_fork_reinitUs ""$r%c |jSr*)rrFs r&is_setz Event.is_setYsCzzr%c\ ddl}|jdtd|jS)Nrz+isSet() is deprecated, use is_set() insteadrr)rrrrrs r&isSetz Event.isSet]s1  C(Q  8{{}r%c |j5d|_|jjdddy#1swYyxYwr#)rrrrFs r&rz Event.seths1 ZZDJ JJ ! ! #ZZs "9AcV |j5d|_dddy#1swYyxYwr)rrrFs r&rz Event.clearss! ZZDJZZs(Nc |j5|j}|s|jj|}|cdddS#1swYyxYwr*)rrr)rGr]signaleds r&rz Event.wait}s@ ZZzzH::??73   ZZs +AA r*) rwrPrQrHrUrWrrrrrr$r%r&rrAs0S %  $r%rc~eZdZ ddZdZddZdZdZdZdZ d Z d Z d Z e d Ze d Ze dZy)rNc |dkr tdtt|_||_||_||_d|_d|_y)NrZzparties must be > 0r) rr rr_action_timeout_parties_staterE)rGpartiesactionr]s r&rHzBarrier.__init__sM  Q;23 3tv&      r%c |j}|jr*d|jd|jdt |ddSd|jd|jdt |dd|j d|j d S) Nrrrrz : broken>z : waiters=rr)rObrokenrPrQrS n_waitingrrs r&rUzBarrier.__repr__snn ;;s~~&a(8(8'9bhr])T TCNN#1S%5%5$6d2d8B-H NN+1T\\N!= >r%c | |j}|j5|j|j}|xjdz c_ |dz|jk(r|j n|j |||xjdzc_|jcdddS#|xjdzc_|jwxYw#1swYyxYwrY)rr_enterrEr_release_wait_exit)rGr]indexs r&rz Barrier.waits  ?mmG ZZ KKMKKE KK1 K 19 -MMOJJw' q     q  Zs#2C5B3%C3'CCC&c|jdvr)|jj|jdvr)|jdkrty)NrvrZr)rrrrrFs r&rzBarrier._entersBkkW$ JJOO kkW$ ;;?$ $ r%c |jr|jd|_|jjy#|j xYwrY)rrrr_breakrFs r&rzBarrier._releasesA || DK JJ ! ! #  KKM s =AAcjjfd|sjtjdkrty)Nc"jdk7SrArrFsr&zBarrier._wait..sDKK1,{{b  r%NNr*)rwrPrQrHrUrrrrrrrrpropertyrrrr$r%r&rrsu$><   ($( !!r%rc eZdZy)rN)rwrPrQr$r%r&rrAsr%rrZc|tzSr*)_counter) name_templates r&_newnamerGs 8: %%r%c tDcgc]}|jr|}}tj|ycc}wr*)_shutdown_locksrJdifference_update)r to_removes r&_maintain_shutdown_locksrYs9#2G/$/IG%%i0Hs<<c$eZdZ dZ ddddZdZdZdZdZd Z d Z e rd Z d Z d ZdZdZddZddZedZej*dZedZe redZdZedZej*dZdZdZdZdZy) rFN)daemonc |i}|r t|}n#td}| |j}|d|dz }||_||_||_||_||rts td||_ ntj|_ d|_ trd|_d|_t#|_d|_d|_t*j,|_t1|_t4j7|y#t$rYwxYw)Nz Thread-%dz ()z4daemon threads are disabled in this (sub)interpreterFT)strrrwAttributeError_target_name_args_kwargs_daemon_threads_allowedrb _daemonicr r _ident_HAVE_THREAD_NATIVE_ID _native_id _tstate_lockr_started _is_stopped _initializedr0stderr_stderr_make_invoke_excepthook_invoke_excepthook _danglingadd)rGgrouptargetrMr<r=r  target_names r&rHzThread.__init__ts , >F t9DK(D!"(//Kb Q//D     57"#YZZ#DN+-44DN !"DO    {{ "9"; d1&sC?? D  D c|jj|rB|j5|jj|jjyyd|_d|_yr#)rrWrr[r)rGis_alives r&_reset_internal_lockszThread._reset_internal_lockss` %%'   ,!!113!!))+- $D  $D r%c,d}|jjrd}|j|jrd}|jr|dz }|j |d|j zz }d|j jd|jd|d S) Ninitialstartedstoppedz daemonz %sr(z, z)>) rrr%rrrrOrwr)rGrs r&rUzThread.__repr__s} ==   !F    F >> i F ;; " edkk) )F!%!8!8$**fMMr%c |js td|jjr tdt5|t |<ddd t |jd|jjy#1swY;xYw#t$r$t5t |=ddd#1swYxYwwxYw)Nzthread.__init__() not calledz threads can only be started oncer$) rrbrr_active_limbo_lock_limbo_start_new_thread _bootstrap ExceptionrrFs r&startz Thread.starts   => > ==   !AB B F4L   door 2   #4L$ $  s0 BBBC#B4+ C4B= 9Cc |j&|j|ji|j|`|`|`y#|`|`|`wxYwr*)rrrrFs r&runz Thread.runsN  7||' djj9DLL9 dj$, dj$,s 2<AcZ |jy#|jrtYyxYwr*)_bootstrap_innerrr0rFs r&r0zThread._bootstraps+   ! ! # ~~$, s **c"t|_yr*)rrrFs r& _set_identzThread._set_idents k r%c"t|_yr*)r(rrFs r&_set_native_idzThread._set_native_ids +oDOr%c t|_|jj|js9t5t t j|jdddyy#1swYyxYwr*) _set_sentinelrr[r _shutdown_locks_lockrrr rFs r&_set_tstate_lockzThread._set_tstate_locks] *O !!#{{%(*##D$5$56&%%%s *A11A:c( |j|jtr|j|jj t 5|t|j<t|=dddtrtjttrtjt |j|j#y#1swYixYw#|j!|Y2xYw#|j#wxYwr*)r8r>rr:rrr-rLrr.r5r0rr,rr4r_deleterFs r&r6zThread._bootstrap_inner"s  OO   ! ! #%##% MM   #'+ $4L$ k* . .  LLN$# .''- LLNs7AC?C3AC?:C'C$ C?'C<:C??Dc|j}|d|_d|_|jst5t dddyyy#1swYyxYwr#)rrr r=rrs r&_stopz Thread._stop9sJ"     {{%(*&%%%s AAcZ t5tt=dddy#1swYyxYwr*)r-rLrrFs r&r@zThread._deleteTsK  $  s!*c  |js td|jjs td|t ur td||j y|j t |dy)NThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)r])rrbrrr _wait_for_tstate_lockmaxrs r&joinz Thread.join]s{ .  => >}}##%HI I ># #;< < ?  & & (  & &s7A & ?r%c|j}|y |j||r!|j|jyy#|j r |j|jxYwr*)rr[rcrBrJ)rGblockr]rs r&rFzThread._wait_for_tstate_locksj   <  ||E7+  , {{}   s 2A3A8c |jSr*)rrFs r&rMz Thread.names zzr%c$t||_yr*)r r)rGrMs r&rMz Thread.namesY r%c |jSr*)rrFs r&identz Thread.idents {{r%c |jSr*)rrFs r& native_idzThread.native_ids ?? "r%c |js|jjsy|jd|j Sr)rrrrFrFs r&r%zThread.is_alivesA    4==#7#7#9 ""5)####r%c |jSr*)rrFs r&r z Thread.daemons ~~r%c|js td|rts td|jj r td||_y)NrEz/daemon threads are disabled in this interpreterz)cannot set daemon status of active thread)rrbrrrr)rGdaemonics r&r z Thread.daemonsO  => > 35PQ Q ==   !JK K!r%cT ddl}|jdtd|jS)Nrz:isDaemon() is deprecated, get the daemon attribute insteadrrrrrr rs r&isDaemonzThread.isDaemons/  R(Q  8{{r%cL ddl}|jdtd||_y)Nrz;setDaemon() is deprecated, set the daemon attribute insteadrrrV)rGrTrs r& setDaemonzThread.setDaemons,  S(Q  8 r%cT ddl}|jdtd|jS)Nrz7getName() is deprecated, get the name attribute insteadrrrrrrMrs r&getNamezThread.getNames/  O(Q  8yyr%cL ddl}|jdtd||_y)Nrz7setName() is deprecated, set the name attribute insteadrrr[)rGrMrs r&setNamezThread.setNames,  O(Q  8 r%)NNNr$Nr*ru)rwrPrQrrHr&rUr2r4r0r8rr:r>r6rBr@rHrFrrMsetterrNrPr%r rWrYr\r^r$r%r&rrisL59!%:15:x%" N47"(" . 7.+6%$@L6 [[    #  # $   ]]""    r%r) _excepthook_ExceptHookArgs)print_exception) namedtuplerz'exc_type exc_value exc_traceback threadct|Sr*)ra)r<s r&rr&s %%r%c |jtk(ryt!tjtj}n&|j|jj }|yy|j|jj }n t}td|d|dt|j|j|j||jy)NzException in thread :Tfileflush)rh) exc_type SystemExitr0rthreadrrMrprint_print_exception exc_value exc_tracebackri)r<rrMs r&rr)s  ==J &    7[[F [[ $[[((F~  ;; ";;##D;D $TF!, '8J8J$ & r%cttj td tdtjttfd}|S)Nzthreading.excepthook is Nonezsys.excepthook is NonecX t}|}tg |}||d}y#t$rm}d|_~j j}n |j }d|dj j}n }| Yd}~d}yd}~wwxYw#d}wxYw)NTz"Exception in threading.excepthook:rg)rrr1__suppress_context__rr) rlhookr<excrsys_excepthook local_print local_sysold_excepthookold_sys_excepthook sys_exc_infos r&invoke_excepthookz2_make_invoke_excepthook..invoke_excepthook\s D|%!";LN";F";rrr8rr:r-rLrrFs r&rHz_MainThread.__init__sf<>    !    ! #'GDKK   s /B  BN)rwrPrQrHr$r%r&rrs(r%rc&eZdZdZdZdZddZy) _DummyThreadc2tj|tdt|jj |j tr|jt5|t|j<dddy#1swYyxYw)NzDummy-%dr) rrHrrrrr8rr:r-rLrrFs r&rHz_DummyThread.__init__sh8J#768  :   !    ! #'GDKK   s 0B  Bcyr*r$rFs r&rBz_DummyThread._stops r%cyr#r$rFs r&r%z_DummyThread.is_alivesr%Ncyr*r$rs r&rHz_DummyThread.joinsr%r*)rwrPrQrHrBr%rHr$r%r&rrs( 3r%rcZ ttS#t$r tcYSwxYwr*)rLrrNrr$r%r&r r s0 y{## ~s **cP ddl}|jdtdtS)Nrz;currentThread() is deprecated, use current_thread() insteadrr)rrrr rs r& currentThreadrs.  MMO$4  r%cz t5ttttzcdddS#1swYyxYwr*)r-rrLr.r$r%r&rrs- 7|c&k)**  s1:cP ddl}|jdtdtS)Nrz7activeCount() is deprecated, use active_count() insteadrr)rrrrrs r& activeCountrs-  MMK$4 >r%cxttjttjzSr*)listrLvaluesr.r$r%r& _enumeraters$  !D$9 99r%c t5ttjttjzcdddS#1swYyxYwr*)r-rrLrr.r$r%r&r r s< GNN$%V]]_(==>>  s ;A  Ac tr tdtj|g|i|}tj |y)Nz$can't register atexit after shutdown)_SHUTTING_DOWNrb functoolspartial_threading_atexitsr)r.argr=calls r&_register_atexitrs@ABB   T 2C 26 2Dd#r%)rc tjr trydat t D] }| tj tk(r5tj}|jtjn t5tt}tjdddsy|D]"}|j|j$]#1swY4xYwr#) _main_threadrr'rreversedrrNrrrcrBr=rrrr[) atexit_calltlocklocksrs r& _shutdownr's$8$:N 23  4Y[())     !)E  ! ! #" D LLN LLN  ! !s $C))C2c tSr*)rr$r%r&r r _s r%)_local)rc tai} tt}|atata t5tt}|jt|D]}||ura|jdt}t|t r)t |_d|_d|_|j)||_|||<h|jd|j-t.j1tj1tj|dddy#t$rt }Y.wxYw#1swYyxYw)NTrF)rr-rLrrNrrrBr=rrrupdaterr& isinstancerrOrrr>rrBr.r) new_activecurrentthreadsrlrNs r& _after_forkrqs,J )+&L*+eO jl#y!F ,,T2! fl3'2F$#/FL',F$++- % $* 5!,,U3 %(   z"7    -    sD8C3E8EEEregister_at_fork)after_in_child)dos_ossysr0_threadrtimerr _weakrefsetr itertoolsrrE _collectionsrr} ImportError collections__all__start_new_threadr/daemon_threads_allowedr allocate_lockrBr<rr'r r(rrerrorrrr:r r,r5rr rrr!rrr?r;r rrrrrbr__next__rrr-rLr.rr=rrrrr`rrar tracebackrbrnrc__excepthook__rrrrr rrrrr rrrrrrr rr_threading_localrr|rr$r%r&rsA#%,, <,,!88&&%%     "77#))M! NN?#mm mmG!!    %#  ${{z qqhTTn*!y*!ZOOz`!`!F  !9  &W   I &'% 1 nnb +<\0jF< (& (*3632   * : >$" } 2p'' 7!t 3"#C 4$}4,++,:   #"# G|&(=& 13O&(` '&'skG,, G>9H % H&H)I, G;:G;>H  H  HHH&%H&) I  I  II