/opt/alt/python35/lib64/python3.5/asyncio/__pycache__
NameSizeModeActions
base_events.cpython-35.opt-1.pyc413790644editdlrm
base_events.cpython-35.opt-2.pyc337780644editdlrm
base_events.cpython-35.pyc416590644editdlrm
base_subprocess.cpython-35.opt-1.pyc99330644editdlrm
base_subprocess.cpython-35.opt-2.pyc98230644editdlrm
base_subprocess.cpython-35.pyc100580644editdlrm
compat.cpython-35.opt-1.pyc7940644editdlrm
compat.cpython-35.opt-2.pyc6650644editdlrm
compat.cpython-35.pyc7940644editdlrm
constants.cpython-35.opt-1.pyc2420644editdlrm
constants.cpython-35.opt-2.pyc2050644editdlrm
constants.cpython-35.pyc2420644editdlrm
coroutines.cpython-35.opt-1.pyc89840644editdlrm
coroutines.cpython-35.opt-2.pyc87440644editdlrm
coroutines.cpython-35.pyc91170644editdlrm
events.cpython-35.opt-1.pyc259460644editdlrm
events.cpython-35.opt-2.pyc184590644editdlrm
events.cpython-35.pyc260820644editdlrm
futures.cpython-35.opt-1.pyc158730644editdlrm
futures.cpython-35.opt-2.pyc97460644editdlrm
futures.cpython-35.pyc161570644editdlrm
locks.cpython-35.opt-1.pyc160870644editdlrm
locks.cpython-35.opt-2.pyc95240644editdlrm
locks.cpython-35.pyc160870644editdlrm
log.cpython-35.opt-1.pyc2440644editdlrm
log.cpython-35.opt-2.pyc1950644editdlrm
log.cpython-35.pyc2440644editdlrm
proactor_events.cpython-35.opt-1.pyc177930644editdlrm
proactor_events.cpython-35.opt-2.pyc173730644editdlrm
proactor_events.cpython-35.pyc180390644editdlrm
protocols.cpython-35.opt-1.pyc60910644editdlrm
protocols.cpython-35.opt-2.pyc23160644editdlrm
protocols.cpython-35.pyc60910644editdlrm
queues.cpython-35.opt-1.pyc88330644editdlrm
queues.cpython-35.opt-2.pyc59500644editdlrm
queues.cpython-35.pyc88330644editdlrm
selector_events.cpython-35.opt-1.pyc325760644editdlrm
selector_events.cpython-35.opt-2.pyc309740644editdlrm
selector_events.cpython-35.pyc326410644editdlrm
sslproto.cpython-35.opt-1.pyc214360644editdlrm
sslproto.cpython-35.opt-2.pyc145940644editdlrm
sslproto.cpython-35.pyc216870644editdlrm
streams.cpython-35.opt-1.pyc205650644editdlrm
streams.cpython-35.opt-2.pyc142670644editdlrm
streams.cpython-35.pyc208970644editdlrm
subprocess.cpython-35.opt-1.pyc74800644editdlrm
subprocess.cpython-35.opt-2.pyc73030644editdlrm
subprocess.cpython-35.pyc75160644editdlrm
tasks.cpython-35.opt-1.pyc213380644editdlrm
tasks.cpython-35.opt-2.pyc144190644editdlrm
tasks.cpython-35.pyc215420644editdlrm
test_utils.cpython-35.opt-1.pyc177360644editdlrm
test_utils.cpython-35.opt-2.pyc164240644editdlrm
test_utils.cpython-35.pyc181430644editdlrm
transports.cpython-35.opt-1.pyc124370644editdlrm
transports.cpython-35.opt-2.pyc67980644editdlrm
transports.cpython-35.pyc124730644editdlrm
unix_events.cpython-35.opt-1.pyc322870644editdlrm
unix_events.cpython-35.opt-2.pyc285680644editdlrm
unix_events.cpython-35.pyc327010644editdlrm
windows_events.cpython-35.opt-1.pyc231540644editdlrm
windows_events.cpython-35.opt-2.pyc220180644editdlrm
windows_events.cpython-35.pyc231540644editdlrm
windows_utils.cpython-35.opt-1.pyc57930644editdlrm
windows_utils.cpython-35.opt-2.pyc51940644editdlrm
windows_utils.cpython-35.pyc58950644editdlrm
__init__.cpython-35.opt-1.pyc8670644editdlrm
__init__.cpython-35.opt-2.pyc8010644editdlrm
__init__.cpython-35.pyc8670644editdlrm
Edit: /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/futures.cpython-35.pyc (16157B)
 yzfD@sNdZddddddgZddlZddlZddlZddlZddlZd d lm Z d d lm Z d Z d Z dZ ejjjZejjZejjZejd ZGdddeZGdddZddZGdddZddZddZddZddZddddZdS)z.A Future class similar to the one in PEP 3148.CancelledError TimeoutErrorInvalidStateErrorFuture wrap_futureisfutureN)compat)eventsZPENDINGZ CANCELLEDZFINISHEDc@seZdZdZdS)rz+The operation is not allowed in this state.N)__name__ __module__ __qualname____doc__rr4/opt/alt/python35/lib64/python3.5/asyncio/futures.pyrs c@sLeZdZdZdZddZdd Zd d Zd d ZdS)_TracebackLoggera Helper to log a traceback upon destruction if not cleared. This solves a nasty problem with Futures and Tasks that have an exception set: if nobody asks for the exception, the exception is never logged. This violates the Zen of Python: 'Errors should never pass silently. Unless explicitly silenced.' However, we don't want to log the exception as soon as set_exception() is called: if the calling code is written properly, it will get the exception and handle it properly. But we *do* want to log it if result() or exception() was never called -- otherwise developers waste a lot of time wondering why their buggy code fails silently. An earlier attempt added a __del__() method to the Future class itself, but this backfired because the presence of __del__() prevents garbage collection from breaking cycles. A way out of this catch-22 is to avoid having a __del__() method on the Future class itself, but instead to have a reference to a helper object with a __del__() method that logs the traceback, where we ensure that the helper object doesn't participate in cycles, and only the Future has a reference to it. The helper object is added when set_exception() is called. When the Future is collected, and the helper is present, the helper object is also collected, and its __del__() method will log the traceback. When the Future's result() or exception() method is called (and a helper object is present), it removes the helper object, after calling its clear() method to prevent it from logging. One downside is that we do a fair amount of work to extract the traceback from the exception, even when it is never logged. It would seem cheaper to just store the exception object, but that references the traceback, which references stack frames, which may reference the Future, which references the _TracebackLogger, and then the _TracebackLogger would be included in a cycle, which is what we're trying to avoid! As an optimization, we don't immediately format the exception; we only do the work when activate() is called, which call is delayed until after all the Future's callbacks have run. Since usually a Future has at least one callback (typically set by 'yield from') and usually that callback extracts the callback, thereby removing the need to format the exception. PS. I don't claim credit for this solution. I first heard of it in a discussion about closing files when they are collected. loopsource_tracebackexctbcCs.|j|_|j|_||_d|_dS)N)_loopr_source_tracebackrrr)selffuturerrrr__init__Us   z_TracebackLogger.__init__cCs@|j}|dk r<d|_tj|j||j|_dS)N)r tracebackformat_exception __class__ __traceback__r)rrrrractivate[s    z_TracebackLogger.activatecCsd|_d|_dS)N)rr)rrrrclearbs z_TracebackLogger.clearcCs|jrd}|jrQdjtj|j}|d7}|d|j7}|dj|jj7}|jjd|idS)Nz*Future/Task exception was never retrieved z0Future/Task created at (most recent call last): z%s message)rrjoinr format_listrstriprcall_exception_handler)rmsgsrcrrr__del__fs   z_TracebackLogger.__del__N)rrrr) r r r r __slots__rrr r)rrrrr!s 0   rcCst|jdo|jdk S)zCheck for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. _asyncio_future_blockingN)hasattrrr+)objrrrrqsc@s$eZdZdZeZdZdZdZdZ dZ dZ dZ ddddZ ddZd d Zd d Zejrd dZddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zejr eZ dS)%raThis class is *almost* compatible with concurrent.futures.Future. Differences: - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon_threadsafe(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) NFrcCs^|dkrtj|_n ||_g|_|jjrZtjtjd|_ dS)zInitialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. Nr) r get_event_loopr _callbacksZ get_debugr extract_stacksys _getframer)rrrrrrs    zFuture.__init__cCs|j}t|}|s!d}dd}|dkrL||d}nn|dkrdj||d||d}n9|dkrdj||d|d||d }d |S) Nr!cSstj|fS)N)r Z_format_callback_source)callbackrrr format_cbsz,Future.__format_callbacks..format_cbrrz{}, {}z{}, <{} more>, {}zcb=[%s])r/lenformat)rcbsizer4rrrZ__format_callbackss     ) zFuture.__format_callbackscCs|jjg}|jtkrt|jdk rL|jdj|jn(tj|j}|jdj||j r|j|j |j r|j d}|jd|d|df|S)Nzexception={!r}z result={}rzcreated at %s:%srr6) _statelower _FINISHED _exceptionappendr8reprlibrepr_resultr/_Future__format_callbacksr)rinforesultframerrr _repr_infos   zFuture._repr_infocCs)|j}d|jjdj|fS)Nz<%s %s> )rGrr r#)rrDrrr__repr__s zFuture.__repr__cCsb|js dS|j}dd|jjd|d|i}|jrN|j|d<|jj|dS)Nr"z %s exception was never retrieved exceptionrr)_log_tracebackr>rr rrr&)rrcontextrrrr)s      zFuture.__del__cCs3d|_|jtkrdSt|_|jdS)zCancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. FT)rKr;_PENDING _CANCELLED_schedule_callbacks)rrrrcancels    z Future.cancelcCsX|jdd}|sdSg|jddrB)rrrrrEs     z Future.resultcCse|jtkrt|jtkr0tdd|_|jdk r^|jjd|_|jS)a&Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. zException is not set.FN) r;rNrr=rrKrTr r>)rrrrrJ)s    zFuture.exceptioncCs9|jtkr%|jj||n|jj|dS)zAdd a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. N)r;rMrrQr/r?)rfnrrradd_done_callback;szFuture.add_done_callbackcsRfdd|jD}t|jt|}|rN||jdd<|S)z}Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. cs"g|]}|kr|qSrr).0f)rUrr Ns z/Future.remove_done_callback..N)r/r7)rrUZfiltered_callbacksZ removed_countr)rUrremove_done_callbackIs zFuture.remove_done_callbackcCsJ|jtkr*tdj|j|||_t|_|jdS)zMark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. z{}: {!r}N)r;rMrr8rBr=rO)rrErrr set_resultVs   zFuture.set_resultcCs|jtkr*tdj|j|t|trB|}t|tkr`td||_t |_|j t j rd|_ n(t|||_|jj|jjdS)zMark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. z{}: {!r}zPStopIteration interacts badly with generators and cannot be raised into a FutureTN)r;rMrr8 isinstancetype StopIteration TypeErrorr>r=rOr PY34rKrrTrrQr)rrJrrr set_exceptionbs       zFuture.set_exceptionccs<|jsd|_|V|js2td|jS)NTz"yield from wasn't used with future)rSr+AssertionErrorrE)rrrr__iter__zs   zFuture.__iter__)!r r r rrMr;rBr>rrr+rKrTrrCrGrIr r`r)rPrOrRrSrErJrVrZr[rarcZPY35 __await__rrrrr|s8                 cCs!|jrdS|j|dS)z?Helper setting the result only if the future was not cancelled.N)rRr[)ZfutrErrr_set_result_unless_cancelleds recCs}|jst|jr(|j|js8dS|j}|dk r`|j|n|j}|j|dS)z8Copy state from a future to a concurrent.futures.Future.N) rSrbrRrPZset_running_or_notify_cancelrJrarEr[) concurrentsourcerJrErrr_set_concurrent_future_states      rhcCs|jst|jr"dS|j s5t|jrN|jnA|j}|dk rv|j|n|j}|j|dS)zqInternal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. N)rSrbrRrPrJrarEr[)rgdestrJrErrr_copy_future_states      rjcst r/ttjj r/tdt r^ttjj r^tdtrsjndtrjndddfdd}fdd }j|j|dS) aChain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. z(A future is required for source argumentz-A future is required for destination argumentNcSs-t|rt||n t||dS)N)rrjrh)rotherrrr _set_states z!_chain_future.._set_statecsE|jrAdks$kr1jnjjdS)N)rRrPcall_soon_threadsafe) destination) dest_looprg source_looprr_call_check_cancels  z)_chain_future.._call_check_cancelcs?dkskr(|nj|dS)N)rm)rg)rlrornrprr_call_set_statesz&_chain_future.._call_set_state)rr\rffuturesrr_rrV)rgrnrqrrr)rlrornrgrpr _chain_futures    rtrcCsot|r|St|tjjs:tdj||dkrRtj}|j }t |||S)z&Wrap concurrent.futures.Future object.z/concurrent.futures.Future is expected, got {!r}N) rr\rfrsrrbr8r r.Z create_futurert)rrZ new_futurerrrrs     )r__all__Zconcurrent.futures._baserfZloggingr@r1rr!r r rMrNr=rsZ_baseErrorrrDEBUGZ STACK_DEBUGrrrrrerhrjrtrrrrrs6        P     '