/usr/lib/python2.6/site-packages/concurrent/futures
NameSizeModeActions
process.py148740644editdlrm
process.pyc126420644editdlrm
thread.py46380644editdlrm
thread.pyc46110644editdlrm
_base.py210060644editdlrm
_base.pyc248760644editdlrm
__init__.py8870644editdlrm
__init__.pyc8010644editdlrm
Edit: /usr/lib/python2.6/site-packages/concurrent/futures/_base.pyc (24876B)
Ñò m Vc @sÛddkZddkZddkZddkZddkZdZdZdZdZdZ dZ dZ d Z d Z d Ze e e e egZhd e 6d e 6de 6de 6de6ZeidƒZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd!„Zdd"„Zei d#d$ƒZ!ded%„Z"d&efd'„ƒYZ#d(efd)„ƒYZ$dS(*iÿÿÿÿNs"Brian Quinlan (brian@sweetapp.com)tFIRST_COMPLETEDtFIRST_EXCEPTIONt ALL_COMPLETEDt _AS_COMPLETEDtPENDINGtRUNNINGt CANCELLEDtCANCELLED_AND_NOTIFIEDtFINISHEDtpendingtrunningt cancelledtfinishedsconcurrent.futurestErrorcBseZdZRS(s-Base class for all future-related exceptions.(t__name__t __module__t__doc__(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR -stCancelledErrorcBseZdZRS(sThe Future was cancelled.(RRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR1st TimeoutErrorcBseZdZRS(s*The operation exceeded the given deadline.(RRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR5st_WaitercBs2eZdZd„Zd„Zd„Zd„ZRS(s;Provides the event that wait() and as_completed() block on.cCstiƒ|_g|_dS(N(t threadingtEventteventtfinished_futures(tself((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt__init__;scCs|ii|ƒdS(N(Rtappend(Rtfuture((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt add_result?scCs|ii|ƒdS(N(RR(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt add_exceptionBscCs|ii|ƒdS(N(RR(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt add_cancelledEs(RRRRRRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR9s    t_AsCompletedWaitercBs2eZdZd„Zd„Zd„Zd„ZRS(sUsed by as_completed().cCs&tt|ƒiƒtiƒ|_dS(N(tsuperRRRtLocktlock(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRKscCsB|iiiƒz'tt|ƒi|ƒ|iiƒWdQXdS(N(R"t__exit__t __enter__R RRRtset(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyROscCsB|iiiƒz'tt|ƒi|ƒ|iiƒWdQXdS(N(R"R#R$R RRRR%(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRTscCsB|iiiƒz'tt|ƒi|ƒ|iiƒWdQXdS(N(R"R#R$R RRRR%(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRYs(RRRRRRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRHs    t_FirstCompletedWaitercBs)eZdZd„Zd„Zd„ZRS(s*Used by wait(return_when=FIRST_COMPLETED).cCs'tt|ƒi|ƒ|iiƒdS(N(R R&RRR%(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRascCs'tt|ƒi|ƒ|iiƒdS(N(R R&RRR%(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRescCs'tt|ƒi|ƒ|iiƒdS(N(R R&RRR%(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRis(RRRRRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR&^s  t_AllCompletedWaitercBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(s<Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED).cCs8||_||_tiƒ|_tt|ƒiƒdS(N(tnum_pending_callststop_on_exceptionRR!R"R R'R(RR(R)((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRps  cCsI|iiiƒz.|id8_|ip|iiƒnWdQXdS(Ni(R"R#R$R(RR%(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt_decrement_pending_callsvs cCs$tt|ƒi|ƒ|iƒdS(N(R R'RR*(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR|scCs?tt|ƒi|ƒ|io|iiƒn |iƒdS(N(R R'RR)RR%R*(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR€s cCs$tt|ƒi|ƒ|iƒdS(N(R R'RR*(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR‡s(RRRRR*RRR(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR'ms     t_AcquireFuturescBs)eZdZd„Zd„Zd„ZRS(sDA context manager that does an ordered acquire of Future conditions.cCst|dtƒ|_dS(Ntkey(tsortedtidtfutures(RR/((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRŽscCs%x|iD]}|iiƒq WdS(N(R/t _conditiontacquire(RR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR$‘s cGs%x|iD]}|iiƒq WdS(N(R/R0trelease(RtargsR((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR#•s (RRRRR$R#(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR+‹s  cCsÅ|tjo tƒ}n‡|tjo tƒ}nmtd„|Dƒƒ}|tjot|dtƒ}n4|tjot|dt ƒ}nt d|ƒ‚x|D]}|i i |ƒq§W|S(Ncss(x!|]}|ittgjVqWdS(N(t_stateRR(t.0tf((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pys  s R)sInvalid return condition: %r( RRRR&tsumRR'tTrueRtFalset ValueErrort_waitersR(tfst return_whentwaitert pending_countR6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt_create_and_install_waiters™s      c cs“|dj o|tiƒ}nt|ƒ}t|ƒiiƒz3td„|Dƒƒ}||}t|tƒ}WdQXzðx|D] }|Vq„WxÓ|oË|djo d}nD|tiƒ}|djo&tdt |ƒt |ƒfƒ‚n|i i |ƒ|i iiƒz#|i }g|_ |i iƒWdQXx |D]}|V|i|ƒqHWq–WWdx|D]}|ii|ƒqtWXdS(snAn 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. css3x,|]%}|ittgjo |VqqWdS(N(R4RR(R5R6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pys Æs Nis%d (of %d) futures unfinished(tNonettimeR%R+R#R$R@RRtlenRtwaitR"RtcleartremoveR;( R<ttimeouttend_timeR R R>Rt wait_timeoutR6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt as_completed®sB          tDoneAndNotDoneFuturess done not_donec Cs1t|ƒiiƒz¿td„|Dƒƒ}t|ƒ|}|tjo|ot||ƒS|tjo0|o)td„|Dƒƒot||ƒSnt|ƒt|ƒjot||ƒSt ||ƒ}WdQX|i i |ƒx|D]}|i i |ƒqðW|i|iƒt|t|ƒ|ƒS(sWait 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. css3x,|]%}|ittgjo |VqqWdS(N(R4RR(R5R6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pys s css>x7|]0}|iƒ o|iƒdj o |VqqWdS(N(R t exceptionRA(R5R6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pys s N(R+R#R$R%RRKRtanyRCR@RRDR;RFtupdateR(R<RGR=tdonetnot_doneR>R6((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRDês"tFuturecBs§eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z dd „Z dd „Zdd „Zd „Zd„Zd„Zd„ZRS(s5Represents the result of an asynchronous computation.cCsItiƒ|_t|_d|_d|_d|_g|_ g|_ dS(s8Initializes the future. Should not be called by clients.N( Rt ConditionR0RR4RAt_resultt _exceptiont _tracebackR;t_done_callbacks(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRs     cCsLxE|iD]:}y||ƒWq tj otid|ƒq Xq WdS(Ns!exception calling callback for %r(RVt ExceptiontLOGGERRL(Rtcallback((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt_invoke_callbacks's  cCs¹|iiiƒzž|itjoi|io.dtt|ƒƒt|i|ii i fSdtt|ƒƒt|i|i i i fSndtt|ƒƒt|ifSWdQXdS(Ns!s#s( R0R#R$R4RRTthexR.t_STATE_TO_DESCRIPTION_MAPt __class__RRS(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt__repr__.s   cCsu|iiiƒzP|ittgjotS|ittgjot St|_|ii ƒWdQX|i ƒt S(s»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. N( R0R#R$R4RRR9RRR8t notify_allRZ(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytcancel?s  cCs2|iiiƒz|ittgjSWdQXdS(s(Return True if the future has cancelled.N(R0R#R$R4RR(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR RscCs,|iiiƒz|itjSWdQXdS(s1Return True if the future is currently executing.N(R0R#R$R4R(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR WscCs5|iiiƒz|itttgjSWdQXdS(s>Return True of the future was cancelled or finished executing.N(R0R#R$R4RRR(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRO\scCs4|iot|iƒ|i|i‚n|iSdS(N(RTttypeRURS(R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt __get_resultas cCsW|iiiƒz2|itttgjo|ii|ƒdSWdQX||ƒdS(s%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. N( R0R#R$R4RRRRVR(Rtfn((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytadd_done_callbackgs  cCs´|iiiƒz™|ittgjo tƒ‚n|itjo |iƒS|ii |ƒ|ittgjo tƒ‚n%|itjo |iƒSt ƒ‚WdQXdS(sBReturn 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( R0R#R$R4RRRRt_Future__get_resultRDR(RRG((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytresultxs    cCsÀ|iiiƒz¥|ittgjo tƒ‚n"|itjo|i|i fS|ii |ƒ|ittgjo tƒ‚n+|itjo|i|i fSt ƒ‚WdQXdS(sqReturn a tuple of (exception, traceback) 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( R0R#R$R4RRRRRTRURDR(RRG((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytexception_info—s  cCs|i|ƒdS(sUReturn 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. i(Rg(RRG((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRL¸scCs¤|iiiƒz‰|itjo/t|_x|iD]}|i|ƒq8WtS|it jot |_t St i dt|ƒ|iƒtdƒ‚WdQXdS(s¸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. s!Future %s in unexpected state: %ssFuture in unexpected stateN(R0R#R$R4RRR;RR9RRR8RXtcriticalR.t RuntimeError(RR>((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytset_running_or_notify_cancelÌs      cCsi|iiiƒzD||_t|_x|iD]}|i|ƒq1W|iiƒWdQX|i ƒdS(s‹Sets the return value of work associated with the future. Should only be used by Executor implementations and unit tests. N( R0R#R$RSRR4R;RR_RZ(RRfR>((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt set_resultôs   cCsr|iiiƒzM||_||_t|_x|iD]}|i|ƒq:W|ii ƒWdQX|i ƒdS(s£Sets the result of the future as being the given exception and traceback. Should only be used by Executor implementations and unit tests. N( R0R#R$RTRURR4R;RR_RZ(RRLt tracebackR>((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytset_exception_infos    cCs|i|dƒdS(sSets the result of the future as being the given exception. Should only be used by Executor implementations and unit tests. N(RmRA(RRL((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyt set_exceptionsN(RRRRRZR^R`R R ROReRdRARfRgRLRjRkRmRn(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRQs"          !  ( tExecutorcBs>eZdZd„Zd„Zed„Zd„Zd„ZRS(sCThis is an abstract base class for concrete asynchronous executors.cOs tƒ‚dS(s 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(tNotImplementedError(RRcR3tkwargs((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytsubmits cs‚|idƒ‰ˆdj oˆtiƒ‰ng}ti|ŒD]}||i||ŒqD~‰‡‡‡fd†}|ƒS(s}Returns a 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. 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. RGc3slzIxBˆD]:}ˆdjo|iƒVq |iˆtiƒƒVq WWdxˆD]}|iƒqSWXdS(N(RARfRBR`(R(R<RHRG(s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytresult_iterator?s  N(tgetRARBt itertoolstizipRr(RRct iterablesRqt_[1]R3Rs((R<RHRGs9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytmap%s  6 cCsdS(s‹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. N((RRD((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytshutdownKs cCs|S(N((R((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR$XscCs|idtƒtS(NRD(RzR8R9(Rtexc_typetexc_valtexc_tb((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyR#[s( RRRRrRyR8RzR$R#(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pyRos  & (%t collectionstloggingRRuRBt __author__RRRRRRRRRt_FUTURE_STATESR\t getLoggerRXRWR RRtobjectRRR&R'R+R@RARJt namedtupleRKRDRQRo(((s9/tmp/pip-build-U5v4wA/futures/concurrent/futures/_base.pytsR         : 0ý