/usr/lib64/python3.9/concurrent/futures/__pycache__
NameSizeModeActions
process.cpython-39.opt-1.pyc212290644editdlrm
process.cpython-39.opt-2.pyc158730644editdlrm
process.cpython-39.pyc213960644editdlrm
thread.cpython-39.opt-1.pyc59060644editdlrm
thread.cpython-39.opt-2.pyc53600644editdlrm
thread.cpython-39.pyc59060644editdlrm
_base.cpython-39.opt-1.pyc224360644editdlrm
_base.cpython-39.opt-2.pyc143940644editdlrm
_base.cpython-39.pyc224360644editdlrm
__init__.cpython-39.opt-1.pyc11100644editdlrm
__init__.cpython-39.opt-2.pyc10340644editdlrm
__init__.cpython-39.pyc11100644editdlrm
Edit: /usr/lib64/python3.9/concurrent/futures/__pycache__/_base.cpython-39.opt-1.pyc (22436B)
a ´i1Xã @sxdZddlZddlZddlZddlZddlZdZdZdZdZ dZ dZ d Z d Z d Ze e e e egZe d e d e de dediZe d¡ZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd „d eƒZGd!d"„d"eƒZd#d$„Zd%d&„Zd3d'd(„Z e !d)d*¡Z"defd+d,„Z#Gd-d.„d.eƒZ$Gd/d0„d0eƒZ%Gd1d2„d2e&ƒZ'dS)4z"Brian Quinlan (brian@sweetapp.com)éNÚFIRST_COMPLETEDÚFIRST_EXCEPTIONÚ ALL_COMPLETEDÚ _AS_COMPLETEDÚPENDINGÚRUNNINGÚ CANCELLEDÚCANCELLED_AND_NOTIFIEDÚFINISHEDÚpendingÚrunningÚ cancelledÚfinishedzconcurrent.futuresc@seZdZdZdS)ÚErrorz-Base class for all future-related exceptions.N©Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú0/usr/lib64/python3.9/concurrent/futures/_base.pyr-src@seZdZdZdS)ÚCancelledErrorzThe Future was cancelled.Nrrrrrr1src@seZdZdZdS)Ú TimeoutErrorz*The operation exceeded the given deadline.Nrrrrrr5src@seZdZdZdS)ÚInvalidStateErrorz+The operation is not allowed in this state.Nrrrrrr9src@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú_Waiterz;Provides the event that wait() and as_completed() block on.cCst ¡|_g|_dS©N)Ú threadingÚEventÚeventÚfinished_futures©ÚselfrrrÚ__init__?s z_Waiter.__init__cCs|j |¡dSr©rÚappend©r!ÚfuturerrrÚ add_resultCsz_Waiter.add_resultcCs|j |¡dSrr#r%rrrÚ add_exceptionFsz_Waiter.add_exceptioncCs|j |¡dSrr#r%rrrÚ add_cancelledIsz_Waiter.add_cancelledN)rrrrr"r'r(r)rrrrr=s rcsDeZdZdZ‡fdd„Z‡fdd„Z‡fdd„Z‡fdd „Z‡ZS) Ú_AsCompletedWaiterzUsed by as_completed().cstt|ƒ ¡t ¡|_dSr)Úsuperr*r"rÚLockÚlockr ©Ú __class__rrr"Osz_AsCompletedWaiter.__init__csD|j�*tt|ƒ |¡|j ¡Wdƒn1s60YdSr)r-r+r*r'rÚsetr%r.rrr'Ssz_AsCompletedWaiter.add_resultcsD|j�*tt|ƒ |¡|j ¡Wdƒn1s60YdSr)r-r+r*r(rr0r%r.rrr(Xsz _AsCompletedWaiter.add_exceptioncsD|j�*tt|ƒ |¡|j ¡Wdƒn1s60YdSr)r-r+r*r)rr0r%r.rrr)]sz _AsCompletedWaiter.add_cancelled) rrrrr"r'r(r)Ú __classcell__rrr.rr*Ls    r*cs8eZdZdZ‡fdd„Z‡fdd„Z‡fdd„Z‡ZS)Ú_FirstCompletedWaiterz*Used by wait(return_when=FIRST_COMPLETED).cstƒ |¡|j ¡dSr)r+r'rr0r%r.rrr'es z _FirstCompletedWaiter.add_resultcstƒ |¡|j ¡dSr)r+r(rr0r%r.rrr(is z#_FirstCompletedWaiter.add_exceptioncstƒ |¡|j ¡dSr)r+r)rr0r%r.rrr)ms z#_FirstCompletedWaiter.add_cancelled)rrrrr'r(r)r1rrr.rr2bs  r2csLeZdZdZ‡fdd„Zdd„Z‡fdd„Z‡fdd „Z‡fd d „Z‡Z S) Ú_AllCompletedWaiterz£sz._create_and_install_waiters..T)r5FzInvalid return condition: %r) rr*rr2Úsumrr3rÚ ValueErrorÚ_waitersr$)ÚfsÚ return_whenÚwaiterÚ pending_countrGrrrÚ_create_and_install_waiters�sÿ rPccsd|r`|d}|D]}| |¡q|j�|j |¡Wdƒn1sH0Y~| ¡VqdS)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)Úremover=rKÚpop)rLrNÚ ref_collectrGÚ futures_setrrrÚ_yield_finished_futures³s  *rVc csÄ|dur|t ¡}t|ƒ}t|ƒ}t|ƒ�4tdd„|Dƒƒ}||}t|tƒ}Wdƒn1sf0Yt|ƒ}�zt|||fd�EdH|�r:|dur¦d}n(|t ¡}|dkrÎt dt|ƒ|fƒ‚|j   |¡|j �&|j }g|_ |j  ¡Wdƒn1�s0Y| ¡t||||fd�EdHq’W|D]:}|j�|j |¡Wdƒn1�sn0Y�q@nB|D]:}|j�|j |¡Wdƒn1�s°0Y�q‚0dS)anAn 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. Ncss |]}|jttfvr|VqdSrrCrErrrrHásÿzas_completed..)rTrz%d (of %d) futures unfinished)ÚtimeÚ monotonicr0Úlenr8rPrÚlistrVrrÚwaitr-rÚclearÚreverser=rKrR) rLÚtimeoutÚend_timeÚ total_futuresrr rNÚ wait_timeoutrGrrrÚ as_completedÉsP  ÿ(ÿ  ÿÿ *ÿ2þrbÚDoneAndNotDoneFuturesz done not_donec Cs6t|ƒ}t|ƒ�²dd„|Dƒ}||}|tkrL|rLt||ƒWdƒS|tkr‚|r‚tdd„|Dƒƒr‚t||ƒWdƒSt|ƒt|ƒkrªt||ƒWdƒSt||ƒ}Wdƒn1sÈ0Y|j  |¡|D]8}|j �|j   |¡Wdƒqâ1�s0Yqâ|  |j¡t|||ƒS)aoWait 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. cSsh|]}|jttfvr|’qSrrCrErrrÚ $sÿzwait..Ncss&|]}| ¡s| ¡dur|VqdSr)r Ú exceptionrErrrrH*sÿzwait..)r0r8rrcrÚanyrYrPrr[r=rKrRÚupdater)rLr^rMÚdoneÚnot_donerNrGrrrr[ s$   ( . r[c@sŽeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z ddd„Z d dd„Zdd„Zdd„Zdd„ZeejƒZdS)!ÚFuturez5Represents the result of an asynchronous computation.cCs,t ¡|_t|_d|_d|_g|_g|_dS)z8Initializes the future. Should not be called by clients.N) rÚ Conditionr=rrDÚ_resultÚ _exceptionrKÚ_done_callbacksr rrrr">s  zFuture.__init__c Cs<|jD]0}z ||ƒWqty4t d|¡Yq0qdS)Nú!exception calling callback for %r)rnÚ ExceptionÚLOGGERre)r!ÚcallbackrrrÚ_invoke_callbacksGs    zFuture._invoke_callbackscCsº|j� |jtkr||jrJd|jjt|ƒt|j|jjjfWdƒSd|jjt|ƒt|j|jjjfWdƒSd|jjt|ƒt|jfWdƒS1s¬0YdS)Nz<%s at %#x state=%s raised %s>z <%s at %#x state=%s returned %s>z<%s at %#x state=%s>) r=rDr rmr/rr;Ú_STATE_TO_DESCRIPTION_MAPrlr rrrÚ__repr__Ns( üüýzFuture.__repr__cCs~|j�\|jttfvr&WdƒdS|jttfvrDWdƒdSt|_|j ¡Wdƒn1sh0Y| ¡dS)z»Cancel 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)r=rDrr rr Ú notify_allrsr rrrÚcancelbs(z Future.cancelcCs8|j�|jttfvWdƒS1s*0YdS)z(Return True if the future was cancelled.N)r=rDrr r rrrr uszFuture.cancelledcCs4|j�|jtkWdƒS1s&0YdS)z1Return True if the future is currently executing.N)r=rDrr rrrr zszFuture.runningcCs:|j� |jtttfvWdƒS1s,0YdS)z>Return True if the future was cancelled or finished executing.N)r=rDrr r r rrrrhsz Future.donecCs(|jrz|j‚Wd}q$d}0n|jSdSr)rmrlr rrrÚ __get_result„s zFuture.__get_resultcCs‚|j�<|jtttfvr4|j |¡WdƒdSWdƒn1sH0Yz ||ƒWnty|t  d|¡Yn0dS)a%Attaches 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. Nro) r=rDrr r rnr$rprqre)r!ÚfnrrrÚadd_done_callbackŽs  .  zFuture.add_done_callbackNcCsÄz¸|j�š|jttfvr tƒ‚n&|jtkrF| ¡WdƒWd}S|j |¡|jttfvrhtƒ‚n,|jtkrŽ| ¡WdƒWd}Stƒ‚Wdƒn1s¨0YWd}nd}0dS)aBReturn the result of the call that the future represents. Args: timeout: The number of seconds to wait for the result if the future isn't done. If None, then there is no limit on the wait time. Returns: The result of the call that the future represents. Raises: CancelledError: If the future was cancelled. TimeoutError: If the future didn't finish executing before the given timeout. Exception: If the call raised then that exception will be raised. N) r=rDrr rr Ú_Future__get_resultr[r©r!r^rrrÚresult¢s"  ô  û&z Future.resultcCs¤|j�Š|jttfvrtƒ‚n|jtkr<|jWdƒS|j |¡|jttfvr^tƒ‚n$|jtkr||jWdƒStƒ‚Wdƒn1s–0YdS)aUReturn the exception raised by the call that the future represents. Args: timeout: The number of seconds to wait for the exception if the future isn't done. If None, then there is no limit on the wait time. Returns: The exception raised by the call that the future represents or None if the call completed without raising. Raises: CancelledError: If the future was cancelled. TimeoutError: If the future didn't finish executing before the given timeout. N) r=rDrr rr rmr[rr|rrrreÅs   zFuture.exceptioncCsœ|j�‚|jtkr>t|_|jD]}| |¡qWdƒdS|jtkr^t|_WdƒdSt  dt |ƒ|j¡t dƒ‚Wdƒn1sŽ0YdS)a¸Mark the future as running or process any cancel notifications. Should only be used by Executor implementations and unit tests. If the future has been cancelled (cancel() was called and returned True) then any threads waiting on the future completing (though calls to as_completed() or wait()) are notified and False is returned. If the future was not cancelled then it is put in the running state (future calls to running() will return True) and True is returned. This method should be called by Executor implementations before executing the work associated with this future. If this method returns False then the work should not be executed. Returns: False if the Future was cancelled, True otherwise. Raises: RuntimeError: if this method was already called or if set_result() or set_exception() was called. NFTz!Future %s in unexpected state: %szFuture in unexpected state) r=rDrr rKr)rrrqÚcriticalr;Ú RuntimeError)r!rNrrrÚset_running_or_notify_cancelçs    þz#Future.set_running_or_notify_cancelcCs€|j�^|jttthvr*td |j|¡ƒ‚||_t|_|jD]}|  |¡q<|j  ¡Wdƒn1sj0Y|  ¡dS)z‹Sets the return value of work associated with the future. Should only be used by Executor implementations and unit tests. ú{}: {!r}N) r=rDrr r rÚformatrlrKr'rvrs)r!r}rNrrrÚ set_results  (zFuture.set_resultcCs€|j�^|jttthvr*td |j|¡ƒ‚||_t|_|jD]}|  |¡q<|j  ¡Wdƒn1sj0Y|  ¡dS)z�Sets the result of the future as being the given exception. Should only be used by Executor implementations and unit tests. r�N) r=rDrr r rr‚rmrKr(rvrs)r!rerNrrrÚ set_exceptions  (zFuture.set_exception)N)N)rrrrr"rsrurwr r rhr{rzr}rer€rƒr„Ú classmethodÚtypesÚ GenericAliasÚ__class_getitem__rrrrrj;s    # "(rjc@sHeZdZdZdd„Zdddœdd„Zdd d œd d „Zdd„Zdd„ZdS)ÚExecutorzCThis is an abstract base class for concrete asynchronous executors.cOs tƒ‚dS)a Submits a callable to be executed with the given arguments. Schedules the callable to be executed as fn(*args, **kwargs) and returns a Future instance representing the execution of the callable. Returns: A Future representing the given call. N)ÚNotImplementedError)r!ryrAÚkwargsrrrÚsubmit2s zExecutor.submitNr6)r^Ú chunksizecsBˆdurˆt ¡‰‡‡fdd„t|ŽDƒ‰‡‡‡fdd„}|ƒS)a}Returns an iterator equivalent to map(fn, iter). Args: fn: A callable that will take as many arguments as there are passed iterables. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. chunksize: The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor. Returns: An iterator equivalent to: map(func, *iterables) but the calls may be evaluated out-of-order. Raises: TimeoutError: If the entire result iterator could not be generated before the given timeout. Exception: If fn(*args) raises for any values. Ncsg|]}ˆjˆg|¢RŽ‘qSr)rŒ)rFrA)ryr!rrÚ Vóz Executor.map..c 3snzTˆ ¡ˆr@ˆdur&ˆ ¡ ¡Vq ˆ ¡ ˆt ¡¡Vq WˆD] }| ¡qFnˆD] }| ¡qZ0dSr)r]rSr}rWrXrw)r&)r_rLr^rrÚresult_iteratorZs ÿz%Executor.map..result_iterator)rWrXÚzip)r!ryr^r�Ú iterablesr�r)r_ryrLr!r^rÚmap=s   z Executor.mapTF)Úcancel_futurescCsdS)a;Clean-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!r[r”rrrÚshutdowniszExecutor.shutdowncCs|Srrr rrrr?yszExecutor.__enter__cCs|jdd�dS)NT)r[F)r•)r!Úexc_typeÚexc_valÚexc_tbrrrrB|s zExecutor.__exit__)T) rrrrrŒr“r•r?rBrrrrr‰/s  ,r‰c@seZdZdZdS)ÚBrokenExecutorzR Raised when a executor has become non-functional after a severe failure. Nrrrrrr™�sr™)N)(Ú __author__Ú collectionsÚloggingrrWr†rrrrrrrr r Ú_FUTURE_STATESrtÚ getLoggerrqrprrrrÚobjectrr*r2r3r8rPrVrbÚ namedtuplercr[rjr‰rr™rrrrÚs^û û  >ÿ2uR