HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_vendor/__pycache__/contextlib2.cpython-39.pyc
a

?�fB�@s�dZddlZddlZddlZddlmZddlmZgd�Zedg7Zej	dd�dkr`ej
Zne�d	e
fd
di�Zdd
�Zdd�ZGdd�de�ZGdd�de
�ZGdd�de�Zdd�ZGdd�de
�ZGdd�de
�ZGdd�de�ZGdd�de�ZGd d!�d!e
�Zej	dd"kZe�r2d#d$�Zd%d&�Znd'd$�Zd(d&�Zzdd)lmZWne�yjeZ Yn
0d*d+�Z Gd,d-�d-e
�Z!Gd.d�de!�Z"Gd/d0�d0e�Z#dS)1zAcontextlib2 - backports and enhancements to the contextlib module�N)�deque��wraps)	�contextmanager�closing�nullcontext�AbstractContextManager�ContextDecorator�	ExitStack�redirect_stdout�redirect_stderr�suppress�ContextStack�)���ABC�	__slots__�cCs0||vrdS|�|�|jD]}t||�q|S�N)�append�	__bases__�_classic_mro)�C�result�Brr�;/usr/lib/python3.9/site-packages/pip/_vendor/contextlib2.pyrs

rcGstz
|j}Wn ty*tt|g��}Yn0|D]>}|D],}||jvr8|j|dur`tSq0q8tSq0dS)NT)�__mro__�AttributeError�tupler�__dict__�NotImplemented)r�methods�mro�methodrrrr�_check_methods$s


r%c@s2eZdZdZdd�Zejdd��Zedd��Z	dS)	rz,An abstract base class for context managers.cCs|S)z0Return `self` upon entering the runtime context.r��selfrrr�	__enter__8sz AbstractContextManager.__enter__cCsdS)z9Raise any exception triggered within the runtime context.Nr)r'�exc_type�	exc_value�	tracebackrrr�__exit__<szAbstractContextManager.__exit__cCs|turt|dd�StS)z<Check whether subclass is considered a subclass of this ABC.r(r,)rr%r!)�clsrrrr�__subclasshook__Asz'AbstractContextManager.__subclasshook__N)
�__name__�
__module__�__qualname__�__doc__r(�abc�abstractmethodr,�classmethodr.rrrrr5s
rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r	zJA base class or mixin that enables context managers to work as decorators.cCst�dt�|��S)a�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
        z2refresh_cm was never added to the standard library)�warnings�warn�DeprecationWarning�_recreate_cmr&rrr�
refresh_cmLs
�zContextDecorator.refresh_cmcCs|S)a6Return 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.
        rr&rrrr9]s
zContextDecorator._recreate_cmcst����fdd��}|S)Ncs:�����|i|��Wd�S1s,0YdSr)r9��args�kwds��funcr'rr�innerjs
z(ContextDecorator.__call__.<locals>.innerr)r'r?r@rr>r�__call__iszContextDecorator.__call__N)r/r0r1r2r:r9rArrrrr	Isr	c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_GeneratorContextManagerz%Helper for @contextmanager decorator.cCsN||i|��|_||||_|_|_t|dd�}|durDt|�j}||_dS)Nr2)�genr?r<r=�getattr�typer2)r'r?r<r=�docrrr�__init__ts
z!_GeneratorContextManager.__init__cCs|�|j|j|j�Sr)�	__class__r?r<r=r&rrrr9�sz%_GeneratorContextManager._recreate_cmcCs,zt|j�WSty&td��Yn0dS)Nzgenerator didn't yield)�nextrC�
StopIteration�RuntimeErrorr&rrrr(�sz"_GeneratorContextManager.__enter__c
Cs|dur6zt|j�Wnty*YdS0td��n�|durD|�}z|j�|||�td��Wn�ty�}z||uWYd}~Sd}~0ty�}z@||ur�WYd}~dStr�|j|ur�WYd}~dS�WYd}~n(d}~0t��d|u�r��Yn0dS)Nzgenerator didn't stopz#generator didn't stop after throw()F�)	rIrCrJrK�throw�_HAVE_EXCEPTION_CHAINING�	__cause__�sys�exc_info)r'rE�valuer+�excrrrr,�s,
z!_GeneratorContextManager.__exit__N)r/r0r1r2rGr9r(r,rrrrrBqs
rBcst���fdd��}|S)a�@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>

    cst�||�Sr)rBr;�r?rr�helper�szcontextmanager.<locals>.helperr)r?rUrrTrr�src@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra2Context 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
||_dSr��thing)r'rWrrrrG�szclosing.__init__cCs|jSrrVr&rrrr(�szclosing.__enter__cGs|j��dSr)rW�close)r'rQrrrr,�szclosing.__exit__N�r/r0r1r2rGr(r,rrrrr�src@s(eZdZdZdd�Zdd�Zdd�ZdS)�_RedirectStreamNcCs||_g|_dSr)�_new_target�_old_targets)r'�
new_targetrrrrG�sz_RedirectStream.__init__cCs*|j�tt|j��tt|j|j�|jSr)r\rrDrP�_stream�setattrr[r&rrrr(�sz_RedirectStream.__enter__cCstt|j|j���dSr)r_rPr^r\�pop�r'�exctype�excinst�exctbrrrr,sz_RedirectStream.__exit__)r/r0r1r^rGr(r,rrrrrZ�srZc@seZdZdZdZdS)raAContext 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)
    �stdoutN�r/r0r1r2r^rrrrrsrc@seZdZdZdZdS)rzCContext manager for temporarily redirecting stderr to another file.�stderrNrfrrrrrsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
a?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
||_dSr)�_exceptions)r'�
exceptionsrrrrG)szsuppress.__init__cCsdSrrr&rrrr(,szsuppress.__enter__cCs|duot||j�Sr)�
issubclassrhrarrrr,/s
zsuppress.__exit__NrYrrrrr
s
r
rcs�fdd�}|S)Ncs4|j}||urdS|dus*|�ur$q*|}q||_dSr)�__context__)�new_exc�old_exc�exc_context��	frame_excrr�_fix_exception_context@sz3_make_context_fixer.<locals>._fix_exception_contextr)rprqrror�_make_context_fixer?s
rrcCs:z|dj}|d�Wnty4||d_�Yn0dS)NrL)rk�
BaseException)�exc_details�	fixed_ctxrrr�_reraise_with_existing_contextOs

rvcCsdd�S)NcSsdSrr)rlrmrrr�<lambda>[�z%_make_context_fixer.<locals>.<lambda>rrorrrrrZscCs|\}}}td�dS)Nz!raise exc_type, exc_value, exc_tb)�exec)rtr)r*Zexc_tbrrrrv_s
)�InstanceTypecCst|�}|tur|jS|Sr)rErzrH)�objZobj_typerrr�	_get_typeksr|c@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r
a�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

    cCst�|_dSr)r�_exit_callbacksr&rrrrGszExitStack.__init__cCst|��}|j|_t�|_|S)z?Preserve the context stack by transferring it to a new instance)rEr}r)r'�	new_stackrrr�pop_all�s
zExitStack.pop_allcs"��fdd�}�|_|�|�dS)z:Helper to correctly register callbacks to __exit__ methodscs��g|�R�Srr)rt��cm�cm_exitrr�
_exit_wrapper�sz.ExitStack._push_cm_exit.<locals>._exit_wrapperN)�__self__�push)r'r�r�r�rr�r�
_push_cm_exit�szExitStack._push_cm_exitcCsBt|�}z
|j}Wnty0|j�|�Yn0|�||�|S)aRegisters 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)
        )r|r,rr}rr�)r'�exit�_cb_type�exit_methodrrrr��s

zExitStack.pushcs$���fdd�}�|_|�|��S)z\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        cs��i���dSrr)r)rS�tb�r<�callbackr=rrr��sz)ExitStack.callback.<locals>._exit_wrapper)�__wrapped__r�)r'r�r<r=r�rr�rr��s
zExitStack.callbackcCs(t|�}|j}|�|�}|�||�|S)z�Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        )r|r,r(r�)r'r��_cm_type�_exitrrrr�
enter_context�s

zExitStack.enter_contextcCs|�ddd�dS)z$Immediately unwind the context stackN)r,r&rrrrX�szExitStack.closecCs|Srrr&rrrr(�szExitStack.__enter__c	Gs�|ddu}t��d}t|�}d}d}|jr�|j��}z||�rNd}d}d}Wq(t��}||d|d�d}|}Yq(0q(|r�t|�|o�|S)NrrLFT)NNN)rPrQrrr}r`rv)	r'rt�received_excrprq�suppressed_exc�
pending_raise�cb�new_exc_detailsrrrr,�s(
zExitStack.__exit__N)
r/r0r1r2rGrr�r�r�r�rXr(r,rrrrr
ss

r
cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
rz+Backwards compatibility alias for ExitStackcst�dt�tt|���dS)Nz*ContextStack has been renamed to ExitStack)r6r7r8�superrrGr&�rHrrrG�s�zContextStack.__init__cCs
|�|�Sr)r�)r'r�rrr�
register_exit�szContextStack.register_exitcOs|j|g|�Ri|��Sr)r�)r'r�r<r=rrr�register�szContextStack.registercCs|��Sr)rr&rrr�preserve�szContextStack.preserve)	r/r0r1r2rGr�r�r��
__classcell__rrr�rr�s
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
raMContext 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
    NcCs
||_dSr��enter_result)r'r�rrrrG�sznullcontext.__init__cCs|jSrr�r&rrrr(sznullcontext.__enter__cGsdSrr)r'�excinforrrr,sznullcontext.__exit__)NrYrrrrr�s
r)$r2r3rPr6�collectionsr�	functoolsr�__all__�version_inforZ_abc_ABC�ABCMeta�objectrr%rr	rBrrrZrrr
rNrrrv�typesrz�ImportErrorrEr|r
rrrrrr�<module>sF

(H"

q