e1Y SrSSKrSSKrSSKrSSKrSSKrSrSrSrSr Sr Sr S r S r S r\ \ \ \ \/r\ S \ S \ S\ S\S0r\R""S5r"SS\5r"SS\5r\r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS \5rS!rS"rS.S#jr \RB"S$S%5r"S\4S&jr#S.S'jr$"S(S)\5r%"S*S+\5r&"S,S-\'5r(g)/z"Brian Quinlan (brian@sweetapp.com)NFIRST_COMPLETEDFIRST_EXCEPTION ALL_COMPLETED _AS_COMPLETEDPENDINGRUNNING CANCELLEDCANCELLED_AND_NOTIFIEDFINISHEDpendingrunning cancelledfinishedzconcurrent.futuresc\rSrSrSrSrg)Error-z-Base class for all future-related exceptions.N__name__ __module__ __qualname____firstlineno____doc____static_attributes__r>/opt/imh/python3.13/lib/python3.13/concurrent/futures/_base.pyrr-s7rrc\rSrSrSrSrg)CancelledError1zThe Future was cancelled.rNrrrrrr1s#rrc\rSrSrSrSrg)InvalidStateError7z+The operation is not allowed in this state.rNrrrrr!r!7s5rr!c0\rSrSrSrSrSrSrSrSr g) _Waiter;z;Provides the event that wait() and as_completed() block on.cF[R"5Ul/UlgN) threadingEventeventfinished_futuresselfs r__init___Waiter.__init__=s__& "rc:URRU5 gr'r+appendr-futures r add_result_Waiter.add_resultA $$V,rc:URRU5 gr'r1r3s r add_exception_Waiter.add_exceptionDr7rc:URRU5 gr'r1r3s r add_cancelled_Waiter.add_cancelledGr7r)r*r+N) rrrrrr.r5r9r<rrrrr$r$;sE#---rr$cP^\rSrSrSrU4SjrU4SjrU4SjrU4SjrSr U=r $)_AsCompletedWaiterJzUsed by as_completed().c^>[[U] 5 [R"5Ulgr')superr?r.r(Locklock)r- __class__s rr._AsCompletedWaiter.__init__Ms  $02NN$ rc>UR [[U]U5 URR 5 SSS5 g!,(df  g=fr')rDrBr?r5r*setr-r4rEs rr5_AsCompletedWaiter.add_resultQs2 YY $d 6v > JJNN YY .A Ac>UR [[U]U5 URR 5 SSS5 g!,(df  g=fr')rDrBr?r9r*rHrIs rr9 _AsCompletedWaiter.add_exceptionV2 YY $d 9& A JJNN YYrKc>UR [[U]U5 URR 5 SSS5 g!,(df  g=fr')rDrBr?r<r*rHrIs rr< _AsCompletedWaiter.add_cancelled[rNrK)rD) rrrrrr.r5r9r<r __classcell__rEs@rr?r?Js!%  rr?cD^\rSrSrSrU4SjrU4SjrU4SjrSrU=r $)_FirstCompletedWaiter`z*Used by wait(return_when=FIRST_COMPLETED).cX>[TU]U5 URR5 gr')rBr5r*rHrIs rr5 _FirstCompletedWaiter.add_resultcs 6" rcX>[TU]U5 URR5 gr')rBr9r*rHrIs rr9#_FirstCompletedWaiter.add_exceptiong f% rcX>[TU]U5 URR5 gr')rBr<r*rHrIs rr<#_FirstCompletedWaiter.add_cancelledkrZrr) rrrrrr5r9r<rrQrRs@rrTrT`s4rrTcV^\rSrSrSrU4SjrSrU4SjrU4SjrU4Sjr Sr U=r $) _AllCompletedWaiterozXlX l[R"5Ul[ TU]5 gr')num_pending_callsstop_on_exceptionr(rCrDrBr.)r-rarbrEs rr._AllCompletedWaiter.__init__rs(!2!2NN$  rcUR U=RS-slUR(dURR5 SSS5 g!,(df  g=f)N)rDrar*rHr,s r_decrement_pending_calls,_AllCompletedWaiter._decrement_pending_callsxs; YY  " "a ' "))  YYs AA A%cD>[TU]U5 UR5 gr')rBr5rfrIs rr5_AllCompletedWaiter.add_result~s 6" %%'rc>[TU]U5 UR(aURR 5 gUR 5 gr')rBr9rbr*rHrfrIs rr9!_AllCompletedWaiter.add_exceptions3 f%  ! ! JJNN   ) ) +rcD>[TU]U5 UR5 gr')rBr<rfrIs rr<!_AllCompletedWaiter.add_cancelleds f% %%'r)rDrarb) rrrrrr.rfr5r9r<rrQrRs@rr^r^os$F ! (,((rr^c*\rSrSrSrSrSrSrSrg)_AcquireFutureszDA context manager that does an ordered acquire of Future conditions.c*[U[S9Ulg)N)key)sortedidfutures)r-rus rr._AcquireFutures.__init__sg2. rc^URHnURR5 M gr')ru _conditionacquirer3s r __enter___AcquireFutures.__enter__"llF    % % '#rc^URHnURR5 M gr')rurxrelease)r-argsr4s r__exit___AcquireFutures.__exit__r|r)ruN) rrrrrr.rzrrrrrrorosN/((rroc6U[:Xa [5nO_U[:Xa [5nOJ[ SU55nU[ :Xa [ USS9nO#U[:Xa [ USS9nO[SU-5eUHnURRU5 M U$)Nc3R# UHoR[[4;v M g7fr'_stater r .0fs r ._create_and_install_waiters..s!PLNq!7 BBBs%'T)rbFzInvalid return condition: %r) rr?rrTsumrr^r ValueError_waitersr2)fs return_whenwaiter pending_countrs r_create_and_install_waitersrsm##%  '&(PLNPP  / )($OF M )(%PF;kIJ J  &! Mrc## U(alUSnUHnURU5 M UR URRU5 SSS5 AUR5v U(aMkgg!,(df  N,=f7f)a^ Iterate on the list *fs*, yielding finished futures one by one in reverse order. Before yielding a future, *waiter* is removed from its waiters and the future is removed from each set in the collection of sets *ref_collect*. The aim of this function is to avoid keeping stale references after the future is yielded and before the iterator resumes. N)removerxrpop)rr ref_collectr futures_sets r_yield_finished_futuresrse rF&K   q !' \\ JJ  f % ffh "\s"3BA7"B5B7 BBc #B# UbU[R"5-n[U5n[U5n[ U5 [SU55nX- n[ U[ 5nSSS5 [W5n[UWU4S9ShvN W(aUcSnO7W[R"5- nUS:a[S[U5U4-5eURRU5 UR URn/Ul URR5 SSS5 UR5 [XFX4S9ShvN U(aMUH3nUR  UR"R%U5 SSS5 M5 g!,(df  GN6=fGN!,(df  N=fNm!,(df  Mo=f!UHEnUR  UR"R%W5 SSS5 M5!,(df  MD=f f=f7f)a:An iterator over the given futures that yields each as it completes. Args: fs: The sequence of Futures (possibly created by different Executors) to iterate over. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. Returns: An iterator that yields the given Futures as they complete (finished or cancelled). If any given Futures are duplicated, they will be returned once. Raises: TimeoutError: If the entire result iterator could not be generated before the given timeout. Nc3^# UH#nUR[[4;dMUv M% g7fr'rrs rras_completed..s+Ca88 6AA2s- -)rrz%d (of %d) futures unfinished)time monotonicrHlenrorrlistr TimeoutErrorr*waitrDr+clearreverserxrr) rtimeoutend_time total_futuresrr r wait_timeoutrs r as_completedrs$T^^-- RBGM  CCC-,R?  H~H**8V8:u> > ># '$..*:: !#&;L-?99:: LL  l +!22*,' ""$    .x<>=J J J'g0A !!&)G   > J A !!&)s=H'F&H:G F' A/G9.F*'&G F; GH,F= H F$H'G* F84G= G HH!H = H H  HHDoneAndNotDoneFuturesz done not_donec[U5n[U5 UVs1sH!nUR[[4;dMUiM# nnX- nU[ :XaU(a[ XE5sSSS5 $U[:Xa2U(a+[SU55(a[ XE5sSSS5 $[U5[U5:Xa[ XE5sSSS5 $[X5nSSS5 WRRU5 UH3nUR URRU5 SSS5 M5 WR!UR"5 [ X@U- 5$s snf!,(df  N=f!,(df  M=f)aWait for the futures in the given sequence to complete. Args: fs: The sequence of Futures (possibly created by different Executors) to wait upon. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. return_when: Indicates when this function should return. The options are: FIRST_COMPLETED - Return when any future finishes or is cancelled. FIRST_EXCEPTION - Return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to ALL_COMPLETED. ALL_COMPLETED - Return when all futures finish or are cancelled. Returns: A named 2-tuple of sets. The first set, named 'done', contains the futures that completed (is finished or cancelled) before the wait completed. The second set, named 'not_done', contains uncompleted futures. Duplicate futures given to *fs* are removed and will be returned only once. Nc3z# UH1nUR5(aMUR5cM-Uv M3 g7fr')r exceptionrs rrwait..(s/Gd++-,-KKM1ds ;; ;)rHrorr r rrranyrrr*rrxrrupdater+)rrrrdonenot_doners rrrsI2 RB  F2ahh#98"DD2F9 ? *(8   _,$GdGGG,T<   t9B (8  -R=   LLg  \\ JJ  f %\ KK''( Dy 11+F  $\s?E,E'E'!E,/2E,+"E, E,E='E,, E:= F cURU5UR5 A$!UR5 f=f!Af=fr')resultcancel)futrs r_result_or_cancelr:s9 ::g& JJL  JJL s%:7:=c\rSrSrSrSrSrSrSrSr Sr S r S r S r SS jrSSjrSrSrSr\"\R*5rSrg )FutureiEz5Represents the result of an asynchronous computation.c[R"5Ul[UlSUlSUl/Ul/Ulg)z8Initializes the future. Should not be called by clients.N) r( Conditionrxrr_result _exceptionr_done_callbacksr,s rr.Future.__init__Hs6#--/   !rcURH nU"U5 M g![a [RSU5 M4f=f)N!exception calling callback for %r)r ExceptionLOGGERr)r-callbacks r_invoke_callbacksFuture._invoke_callbacksQsC,,H L- L  !DdK Ls AAc~UR UR[:XaUR(a^SURR [ U5[URURRR 4-sSSS5 $SURR [ U5[URURRR 4-sSSS5 $SURR [ U5[UR4-sSSS5 $!,(df  g=f)Nz<%s at %#x state=%s raised %s>z <%s at %#x state=%s returned %s>z<%s at %#x state=%s>) rxrr rrErrt_STATE_TO_DESCRIPTION_MAPrr,s r__repr__Future.__repr__Xs __{{h&??;//41$++>11:: ?<<_>//41$++> ..77 A99_*NN++tH,T[[9-;;__sA:D.AD./5D.. D<cJUR UR[[4;a SSS5 gUR[[ 4;a SSS5 g[UlURR 5 SSS5 UR5 g!,(df  N=f)zCancel the future if possible. Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed. NFT)rxrrr r r notify_allrr,s rr Future.cancells{ __{{w11_{{y*@AA _$DK OO & & (  _sBB%B B"cUR UR[[4;sSSS5 $!,(df  g=f)z(Return True if the future was cancelled.N)rxrr r r,s rrFuture.cancelleds% __;;9.D"EE__s0 >cvUR UR[:HsSSS5 $!,(df  g=f)z1Return True if the future is currently executing.N)rxrrr,s rr Future.runnings __;;')__s* 8cUR UR[[[4;sSSS5 $!,(df  g=f)z>Return True if the future was cancelled or finished executing.N)rxrr r r r,s rr Future.dones' __;;9.Dh"OO__s 5 AcdUR(a UReUR$!Snf=fr')rrr,s r __get_resultFuture.__get_results- ?? oo% << s +/c8UR UR[[[4;a%UR R U5 SSS5 gSSS5 U"U5 g!,(df  N=f![a [RSU5 gf=f)aAttaches a callable that will be called when the future finishes. Args: fn: A callable that will be called with this future as its only argument when the future completes or is cancelled. The callable will always be called by a thread in the same process in which it was added. If the future has already completed or been cancelled then the callable will be called immediately. These callables are called in the order that they were added. Nr) rxrr r r rr2rrr)r-fns radd_done_callbackFuture.add_done_callbacks}__{{9.Dh"OO$$++B/_O H tH _  H   @$ G Hs# TR5 T(aZTc[TR55v O2[TR5T[R"5- 5v T(aMZTHnUR 5 M g!THnUR 5 M f=f7fr')rrrrrr)r4rrrs rresult_iterator%Executor.map..result_iteratords{ $ /99/(T^^EU:UVV b!FMMO!bFMMO!sB.A/B6B.B++B.)rrzipr) r-rrr iterablesrrrrs ` @@rmap Executor.mapGsV,  !11H14i Akk"$t$ A $  #BsAF)cancel_futurescg)aClean-up the resources associated with the Executor. It is safe to call this method several times. Otherwise, no other methods can be called after this one. Args: wait: If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed. cancel_futures: If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled. Nr)r-rrs rshutdownExecutor.shutdownss rcU$r'rr,s rrzExecutor.__enter__s rc"URSS9 g)NT)rF)r)r-exc_typeexc_valexc_tbs rrExecutor.__exit__s 4  rr)T) rrrrrrrrrzrrrrrrr9s-M $+/!*!X E rrc\rSrSrSrSrg)BrokenExecutorizJ Raised when a executor has become non-functional after a severe failure. rNrrrrrrsrrr')) __author__ collectionsloggingr(rrrrrrrrr r r _FUTURE_STATESr getLoggerrrrrrr!objectr$r?rTr^rorrr namedtuplerrrrrrrrrrrsb2  ##      1      Y Y {K j    / 0 I  U     -f -, G ('(< (f (,,<*|$..2}02fr8Vr8hOvOd\r