ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ sWc@sdZddlZddlZddlmZddlmZddddd d d gZed g7Zdefd YZ de fdYZ dZ defdYZ defdYZ d e fdYZd e fdYZd efdYZejddkZer7dZdZndZdZyddlmZWnek rveZn XdZdefdYZd efd YZdS(!sAcontextlib2 - backports and enhancements to the contextlib moduleiN(tdeque(twrapstcontextmanagertclosingtContextDecoratort ExitStacktredirect_stdouttredirect_stderrtsuppresst ContextStackcBs)eZdZdZdZdZRS(sJA base class or mixin that enables context managers to work as decorators.cCstjdt|jS(sReturns the context manager used to actually wrap the call to the decorated function. The default implementation just returns *self*. Overriding this method allows otherwise one-shot context managers like _GeneratorContextManager to support use as decorators via implicit recreation. DEPRECATED: refresh_cm was never added to the standard library's ContextDecorator API s2refresh_cm was never added to the standard library(twarningstwarntDeprecationWarningt _recreate_cm(tself((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt refresh_cms cCs|S(s6Return a recreated instance of self. Allows an otherwise one-shot context manager like _GeneratorContextManager to support use as a decorator via implicit recreation. This is a private interface just for _GeneratorContextManager. See issue #11647 for details. ((R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR "s cs"tfd}|S(Ncs$j||SWdQXdS(N(R (targstkwds(tfuncR(s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pytinner/s (R(RRR((RRs</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt__call__.s(t__name__t __module__t__doc__RR R(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs  t_GeneratorContextManagercBs2eZdZdZdZdZdZRS(s%Helper for @contextmanager decorator.cCsl||||_||||_|_|_t|dd}|dkr_t|j}n||_dS(NR(tgenRRRtgetattrtNonettypeR(RRRRtdoc((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt__init__9s  cCs|j|j|j|jS(N(t __class__RRR(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR GscCs5yt|jSWntk r0tdnXdS(Nsgenerator didn't yield(tnextRt StopIterationt RuntimeError(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt __enter__Ms cCs|dkrAyt|jWntk r1dSXtdn|dkrY|}ny&|jj|||tdWnztk r}||k Stk r}||krtStr|j|krtSn#t j d|k rqnXdS(Nsgenerator didn't stops#generator didn't stop after throw()i( RR RR!R"tthrowtFalset_HAVE_EXCEPTION_CHAININGt __cause__tsystexc_info(RRtvaluet tracebacktexc((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt__exit__Ss,      (RRRRR R#R-(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR6s    cstfd}|S(s@contextmanager decorator. Typical usage: @contextmanager def some_generator(): try: yield finally: This makes this: with some_generator() as : equivalent to this: try: = finally: cst||S(N(R(RR(R(s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pythelpers(R(RR.((Rs</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR~scBs)eZdZdZdZdZRS(s2Context to automatically close something at the end of a block. Code like this: with closing(.open()) as f: is equivalent to this: f = .open() try: finally: f.close() cCs ||_dS(N(tthing(RR/((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRscCs|jS(N(R/(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#scGs|jjdS(N(R/tclose(RR)((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-s(RRRRR#R-(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs  t_RedirectStreamcBs)eZdZdZdZdZRS(cCs||_g|_dS(N(t _new_targett _old_targets(Rt new_target((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs cCs9|jjtt|jtt|j|j|jS(N(R3tappendRR(t_streamtsetattrR2(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#scCs tt|j|jjdS(N(R7R(R6R3tpop(Rtexctypetexcinsttexctb((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-sN(RRRR6RR#R-(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR1s  cBseZdZdZRS(sAContext manager for temporarily redirecting stdout to another file. # How to send help() to stderr with redirect_stdout(sys.stderr): help(dir) # How to write help() to a file with open('help.txt', 'w') as f: with redirect_stdout(f): help(pow) tstdout(RRRR6(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs cBseZdZdZRS(sCContext manager for temporarily redirecting stderr to another file.tstderr(RRRR6(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRscBs)eZdZdZdZdZRS(s?Context manager to suppress specified exceptions After the exception is suppressed, execution proceeds with the next statement following the with statement. with suppress(FileNotFoundError): os.remove(somefile) # Execution still resumes here if the file was already removed cGs ||_dS(N(t _exceptions(Rt exceptions((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRscCsdS(N((R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#scCs|dk ot||jS(N(Rt issubclassR>(RR9R:R;((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-s (RRRRR#R-(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs   iicsfd}|S(NcsOx?|j}||krdS|dks4|kr8Pn|}qW||_dS(N(t __context__R(tnew_exctold_exct exc_context(t frame_exc(s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt_fix_exception_contexts   ((RERF((REs</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt_make_context_fixers cCsCy|dj}|dWn!tk r>||d_nXdS(Ni(RAt BaseException(t exc_detailst fixed_ctx((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt_reraise_with_existing_contexts    cCsdS(NcSsdS(N(R(RBRC((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pytt((RE((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRGscBs|\}}}ddUdS(Ns!raise exc_type, exc_value, exc_tb((RItexc_typet exc_valuetexc_tb((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRK"s(t InstanceTypecCs#t|}|tkr|jS|S(N(RRQR(tobjtobj_type((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt _get_type.s  cBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( sContext manager for dynamic management of a stack of exit callbacks For example: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception cCst|_dS(N(Rt_exit_callbacks(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRAscCs+t|}|j|_t|_|S(s?Preserve the context stack by transferring it to a new instance(RRUR(Rt new_stack((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pytpop_allDs  cs,fd}|_|j|dS(s:Helper to correctly register callbacks to __exit__ methodscs |S(N((RI(tcmtcm_exit(s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt _exit_wrapperMsN(t__self__tpush(RRXRYRZ((RXRYs</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt _push_cm_exitKs cCsQt|}y |j}Wn!tk r<|jj|nX|j|||S(sRegisters a callback with the standard __exit__ method signature Can suppress exceptions the same way __exit__ methods can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself) (RTR-tAttributeErrorRUR5R](Rtexitt_cb_typet exit_method((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR\Rs   cs/fd}|_|j|S(s\Registers an arbitrary callback and arguments. Cannot suppress exceptions. csdS(N((RNR,ttb(RtcallbackR(s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRZks(t __wrapped__R\(RRcRRRZ((RRcRs</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRcfs  cCs8t|}|j}|j|}|j|||S(sEnters the supplied context manager If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method. (RTR-R#R](RRXt_cm_typet_exittresult((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt enter_contextss   cCs|jddddS(s$Immediately unwind the context stackN(R-R(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR0scCs|S(N((R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#sc Gs|ddk }tjd}t|}t}t}xx|jr|jj}y%||rwt}t}d}nWq;tj}||d|dt}|}q;Xq;W|rt|n|o|S(Nii(NNN( RR(R)RGR%RUR8tTrueRK( RRIt received_excRERFtsuppressed_exct pending_raisetcbtnew_exc_details((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-s(      ( RRRRRWR]R\RcRhR0R#R-(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR5s       cBs2eZdZdZdZdZdZRS(s+Backwards compatibility alias for ExitStackcCs'tjdttt|jdS(Ns*ContextStack has been renamed to ExitStack(R R R tsuperR R(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRs cCs |j|S(N(R\(RRc((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt register_exitscOs|j|||S(N(Rc(RRcRR((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pytregisterscCs |jS(N(RW(R((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pytpreserves(RRRRRpRqRr(((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR s    (RR(R t collectionsRt functoolsRt__all__tobjectRRRRR1RRRt version_infoR&RGRKttypesRQt ImportErrorRRTRR (((s</opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyts8    (H "      p