ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/
Upload File :
Current File : //proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyo

�
Bu�_c	@s>dZddlZddlZddlZddlmZddlmZddddd	d
ddd
g	Zedg7Zej	d d+kr�ej
Znejde
fid,d6�Zd�Zd�Zdefd��YZd	e
fd��YZdefd��YZd�Zde
fd��YZde
fd��YZdefd��YZdefd��YZd
e
fd ��YZej	d!dkZer�d"�Zd#�Znd$�Zd%�Zydd&lmZWnek
r�eZ n
Xd'�Z d
e
fd(��YZ!de!fd)��YZ"defd*��YZ#dS(-sAcontextlib2 - backports and enhancements to the contextlib modulei����N(tdeque(twrapstcontextmanagertclosingtnullcontexttAbstractContextManagertContextDecoratort	ExitStacktredirect_stdouttredirect_stderrtsuppresstContextStackiiitABCt	__slots__cCsB||krdS|j|�x|jD]}t||�q'W|S(N(tappendt	__bases__t_classic_mro(tCtresulttB((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRs
cGs�y
|j}Wn&tk
r5tt|g��}nXxM|D]E}x<|D]0}||jkrJ|j|dkrvtSPqJqJWtSq=WtS(N(t__mro__tAttributeErrorttupleRt__dict__tNonetNotImplementedtTrue(RtmethodstmrotmethodR((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt_check_methods$s



cBs8eZdZd�Zejd��Zed��ZRS(s,An abstract base class for context managers.cCs|S(s0Return `self` upon entering the runtime context.((tself((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt	__enter__8scCsdS(s9Raise any exception triggered within the runtime context.N(R(Rtexc_typet	exc_valuet	traceback((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt__exit__<scCs |tkrt|dd�StS(s<Check whether subclass is considered a subclass of this ABC.R R$(RRR(tclsR((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt__subclasshook__As(	t__name__t
__module__t__doc__R tabctabstractmethodR$tclassmethodR&(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR5s	cBs)eZdZd�Zd�Zd�ZRS(sJA base class or mixin that enables context managers to work as decorators.cCstjdt�|j�S(s�Returns 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(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt
refresh_cmLs
	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((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR0]s
cs"t����fd��}|S(Ncs$�j���||�SWdQXdS(N(R0(targstkwds(tfuncR(sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pytinnerjs
(R(RR4R5((R4RsH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt__call__is(R'R(R)R1R0R6(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRIs		t_GeneratorContextManagercBs2eZdZd�Zd�Zd�Zd�ZRS(s%Helper for @contextmanager decorator.cCsl|||�|_||||_|_|_t|dd�}|dkr_t|�j}n||_dS(NR)(tgenR4R2R3tgetattrRttypeR)(RR4R2R3tdoc((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt__init__tscCs|j|j|j|j�S(N(t	__class__R4R2R3(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR0�scCs5yt|j�SWntk
r0td��nXdS(Nsgenerator didn't yield(tnextR8t
StopIterationtRuntimeError(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR �s
cCs|dkrAyt|j�Wntk
r1dSXtd��n�|dkrY|�}ny&|jj|||�td��Wnztk
r�}||k	Stk
r�}||kr�tStr�|j|kr�tS�n#t	j
�d|k	r��q�nXdS(Nsgenerator didn't stops#generator didn't stop after throw()i(RR>R8R?R@tthrowtFalset_HAVE_EXCEPTION_CHAININGt	__cause__tsystexc_info(RR:tvalueR#texc((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$�s,

(R'R(R)R<R0R R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR7qs
			cst���fd��}|S(s�@contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>

    cst�||�S(N(R7(R2R3(R4(sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pythelper�s(R(R4RI((R4sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR�scBs)eZdZd�Zd�Zd�ZRS(s2Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    cCs
||_dS(N(tthing(RRJ((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<�scCs|jS(N(RJ(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR �scGs|jj�dS(N(RJtclose(RRF((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$�s(R'R(R)R<R R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR�s		t_RedirectStreamcBs)eZdZd�Zd�Zd�ZRS(cCs||_g|_dS(N(t_new_targett_old_targets(Rt
new_target((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<�s	cCs9|jjtt|j��tt|j|j�|jS(N(RNRR9REt_streamtsetattrRM(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR �scCs tt|j|jj��dS(N(RQRERPRNtpop(Rtexctypetexcinsttexctb((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$sN(R'R(RRPR<R R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRL�s		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(R'R(R)RP(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRscBseZdZdZRS(sCContext manager for temporarily redirecting stderr to another file.tstderr(R'R(R)RP(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR	scBs)eZdZd�Zd�Zd�ZRS(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((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<)scCsdS(N((R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR ,scCs|dk	ot||j�S(N(Rt
issubclassRX(RRSRTRU((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$/s
(R'R(R)R<R R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR
s			ics�fd�}|S(NcsNx>|j}||krdS|dks4|�kr8Pn|}q||_dS(N(t__context__R(tnew_exctold_exctexc_context(t	frame_exc(sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt_fix_exception_context@s		((R_R`((R_sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt_make_context_fixer?s
cCsCy|dj}|d�Wn!tk
r>||d_�nXdS(Ni(R[t
BaseException(texc_detailst	fixed_ctx((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt_reraise_with_existing_contextOs


cCsd�S(NcSsdS(N(R(R\R]((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt<lambda>[s((R_((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRaZscBs|\}}}ddUdS(Ns!raise exc_type, exc_value, exc_tb((RcR!R"texc_tb((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRe_s(tInstanceTypecCs#t|�}|tkr|jS|S(N(R:RhR=(tobjtobj_type((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt	_get_typekscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s�Context 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((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<scCs+t|��}|j|_t�|_|S(s?Preserve the context stack by transferring it to a new instance(R:RlR(Rt	new_stack((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pytpop_all�scs,��fd�}�|_|j|�dS(s:Helper to correctly register callbacks to __exit__ methodscs
��|�S(N((Rc(tcmtcm_exit(sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt
_exit_wrapper�sN(t__self__tpush(RRoRpRq((RoRpsH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt
_push_cm_exit�s	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)
        (RkR$RRlRRt(Rtexitt_cb_typetexit_method((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRs�s


cs/���fd�}�|_|j|��S(s\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        cs����dS(N((R!RHttb(R2tcallbackR3(sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRq�s(t__wrapped__Rs(RRyR2R3Rq((R2RyR3sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRy�s	
cCs8t|�}|j}|j|�}|j||�|S(s�Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        (RkR$R Rt(RRot_cm_typet_exitR((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt
enter_context�s
	cCs|jddd�dS(s$Immediately unwind the context stackN(R$R(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRK�scCs|S(N((R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR �sc	Gs�|ddk	}tj�d}t|�}t}t}xx|jr�|jj�}y%||�rwt}t}d}nWq;tj�}||d|d�t}|}q;Xq;W|r�t|�n|o�|S(Nii(NNN(	RRERFRaRBRlRRRRe(	RRctreceived_excR_R`tsuppressed_exct
pending_raisetcbtnew_exc_details((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$�s(

(R'R(R)R<RnRtRsRyR}RKR R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyRss					
	
		cBs2eZdZd�Zd�Zd�Zd�ZRS(s+Backwards compatibility alias for ExitStackcCs'tjdt�tt|�j�dS(Ns*ContextStack has been renamed to ExitStack(R-R.R/tsuperRR<(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<�s	cCs
|j|�S(N(Rs(RRy((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt
register_exit�scOs|j|||�S(N(Ry(RRyR2R3((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pytregister�scCs
|j�S(N(Rn(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pytpreserve�s(R'R(R)R<R�R�R�(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR�s
			cBs,eZdZdd�Zd�Zd�ZRS(sMContext manager that does no additional processing.
    Used as a stand-in for a normal context manager, when a particular
    block of code is only sometimes used with a normal context manager:
    cm = optional_cm if condition else nullcontext()
    with cm:
        # Perform operation, using optional_cm if condition is True
    cCs
||_dS(N(tenter_result(RR�((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR<�scCs|jS(N(R�(R((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR scGsdS(N((Rtexcinfo((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR$sN(R'R(R)RR<R R$(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyR�s	(ii(($R)R*RER-tcollectionsRt	functoolsRt__all__tversion_infoRt_abc_ABCtABCMetatobjectRRRRR7RRRLRR	R
RCRaRettypesRhtImportErrorR:RkRRR(((sH/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/contextlib2.pyt<module>sL	
	
	(H	"			

	q

Zerion Mini Shell 1.0