
    IxhX                     t   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZej        d             Zej        ddefd            Z	d Z
ej        ej        fd            Zej        ddefd            Zej        d             Z G d	 d
          Z G d dej        ej                  Z G d dej                  ZdS )    Nc              #      K   t          j                    }t          j        |            	 | V  t          j        |           d S # t          j        |           w xY wN)osgetcwdchdir)dirorigs     W/var/www/html/what/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/context.pypushdr   
   sO      9;;DHSMMM			
s   A Ac           
   #     K   |Gt           j                            |                               dd                              dd          }| t	          j        t          j        d          } | dj        di t                                 	 d}d	}d

                    ||f          } | |j        ddt          |           it                                  ||          5  |V  ddd           n# 1 swxY w Y    | dj        di t                                 dS #  | dj        di t                                 w xY w)z
    Get a tarball, extract it, change to that directory, yield, then
    clean up.
    `runner` is the function to invoke commands.
    `pushd` is a context manager for changing the directory.
    Nz.tar.gz z.tgzT)shellzmkdir {target_dir}zwget {url} -O -z7tar x{compression} --strip-components=1 -C {target_dir}z | compressionzrm -Rf {target_dir} )r   pathbasenamereplace	functoolspartial
subprocess
check_callformatvarsjoininfer_compression)url
target_dirrunnerr   getterextractcmds          r
   tarball_contextr"      s      W%%c**229bAAII&RTUU
~":#8EEE
 F&&00001117"Kjj&'*++zszGG&7&<&<GGGHHHU: 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+$+55dff5566666+$+55dff556666s1   AD( (C9-D( 9C==D(  C=D( ($Ec                 f    | dd         }t          ddd          }|                    |d          S )zF
    Given a URL or filename, infer the compression code for tar.
    NzjJ)gzbzxz)dictget)r   compression_indicatormappings      r
   r   r   0   s;    
  Hccc***G;;,c222    c              #   p   K   t          j                    }	 |V   | |           dS #  | |           w xY w)zk
    Create a temporary directory context. Pass a custom remover
    to override the removal behavior.
    N)tempfilemkdtemp)removertemp_dirs     r
   r4   r4   ;   sP       !!Hs   ( 5Tc              #     K   d| v rdnd} |            5 }|d| |g}|r|                     d|g           t          t          j        j        d          }|r|nd}t          j        ||           |V  ddd           dS # 1 swxY w Y   dS )z
    Check out the repo indicated by url.

    If dest_ctx is supplied, it should be a context manager
    to yield the target directory for the check out.
    githgclonez--branchwN)stdout)extendopenr   r   devnullr   r   )	r   branchquietdest_ctxexerepo_dirr!   r=   r:   s	            r
   repo_contextrC   H   s       C<<%%TC	 xGS(+ 	-JJ
F+,,,rw,,!+tc&1111                 s   ABBBc               #      K   d V  d S r   r   r   r/   r
   nullrE   [   s      	EEEEEr/   c                       e Zd ZdZdZeffdZd Zed             Z	ed             Z
ed             Zd Zd	 Zed
dZd ZdS )ExceptionTrapaG  
    A context manager that will catch certain exceptions and provide an
    indication they occurred.

    >>> with ExceptionTrap() as trap:
    ...     raise Exception()
    >>> bool(trap)
    True

    >>> with ExceptionTrap() as trap:
    ...     pass
    >>> bool(trap)
    False

    >>> with ExceptionTrap(ValueError) as trap:
    ...     raise ValueError("1 + 1 is not 3")
    >>> bool(trap)
    True

    >>> with ExceptionTrap(ValueError) as trap:
    ...     raise Exception()
    Traceback (most recent call last):
    ...
    Exception

    >>> bool(trap)
    False
    )NNNc                     || _         d S r   )
exceptions)selfrI   s     r
   __init__zExceptionTrap.__init__   s    $r/   c                     | S r   r   rJ   s    r
   	__enter__zExceptionTrap.__enter__       r/   c                     | j         d         S Nr   exc_inforM   s    r
   typezExceptionTrap.type       }Qr/   c                     | j         d         S )N   rR   rM   s    r
   valuezExceptionTrap.value   rU   r/   c                     | j         d         S )N   rR   rM   s    r
   tbzExceptionTrap.tb   rU   r/   c                 V    |d         }|ot          || j                  }|r|| _        |S rQ   )
issubclassrI   rS   )rJ   rS   rT   matchess       r
   __exit__zExceptionTrap.__exit__   s5    {<:dDO<< 	%$DMr/   c                 *    t          | j                  S r   )boolrT   rM   s    r
   __bool__zExceptionTrap.__bool__   s    DIr/   _testc                N     t          j                   fd            }|S )a  
        Wrap func and replace the result with the truth
        value of the trap (True if an exception occurred).

        First, give the decorator an alias to support Python 3.8
        Syntax.

        >>> raises = ExceptionTrap(ValueError).raises

        Now decorate a function that always fails.

        >>> @raises
        ... def fail():
        ...     raise ValueError('failed')
        >>> fail()
        True
        c                      t          j                  5 } | i | d d d            n# 1 swxY w Y    |          S r   )rG   rI   )argskwargstraprd   funcrJ   s      r
   wrapperz%ExceptionTrap.raises.<locals>.wrapper   s    t// &4d%f%%%& & & & & & & & & & & & & & &5;;s   	+//)r   wraps)rJ   rj   rd   rk   s   ``` r
   raiseszExceptionTrap.raises   sF    & 
			 	 	 	 	 	 
		
 r/   c                 D    |                      |t          j                  S )a  
        Wrap func and replace the result with the truth
        value of the trap (True if no exception).

        First, give the decorator an alias to support Python 3.8
        Syntax.

        >>> passes = ExceptionTrap(ValueError).passes

        Now decorate a function that always fails.

        >>> @passes
        ... def fail():
        ...     raise ValueError('failed')

        >>> fail()
        False
        rc   )rm   operatornot_)rJ   rj   s     r
   passeszExceptionTrap.passes   s    & {{4x}{555r/   N)__name__
__module____qualname____doc__rS   	ExceptionrK   rN   propertyrT   rX   r[   r_   rb   ra   rm   rq   r   r/   r
   rG   rG   `   s         :  H#,, % % % %       X      X      X      %)     66 6 6 6 6r/   rG   c                       e Zd ZdZdS )suppressz
    A version of contextlib.suppress with decorator support.

    >>> @suppress(KeyError)
    ... def key_error():
    ...     {}['']
    >>> key_error()
    N)rr   rs   rt   ru   r   r/   r
   ry   ry      s           r/   ry   c                   *    e Zd ZdZ	 	 ddZd Zd ZdS )	on_interrupta  
    Replace a KeyboardInterrupt with SystemExit(1)

    >>> def do_interrupt():
    ...     raise KeyboardInterrupt()
    >>> on_interrupt('error')(do_interrupt)()
    Traceback (most recent call last):
    ...
    SystemExit: 1
    >>> on_interrupt('error', code=255)(do_interrupt)()
    Traceback (most recent call last):
    ...
    SystemExit: 255
    >>> on_interrupt('suppress')(do_interrupt)()
    >>> with __import__('pytest').raises(KeyboardInterrupt):
    ...     on_interrupt('ignore')(do_interrupt)()
    errorrW   c                 "    || _         || _        d S r   )actioncode)rJ   r~   r   s      r
   rK   zon_interrupt.__init__   s     			r/   c                     | S r   r   rM   s    r
   rN   zon_interrupt.__enter__   rO   r/   c                     |t           us| j        dk    rd S | j        dk    rt          | j                  || j        dk    S )Nignorer|   ry   )KeyboardInterruptr~   
SystemExitr   )rJ   exctypeexcinstexctbs       r
   r_   zon_interrupt.__exit__   sK    +++t{h/F/FF[G##TY''W4{j((r/   N)r|   rW   )rr   rs   rt   ru   rK   rN   r_   r   r/   r
   r{   r{      sZ         (       ) ) ) ) )r/   r{   )r   r   
contextlibr   r1   shutilro   contextmanagerr   r"   r   rmtreer4   rC   rE   rG   ry   ContextDecoratorr{   r   r/   r
   <module>r      s   				                   $(U 7 7 7 763 3 3 ] 	 	 	 	 !    $ 
 
 
j6 j6 j6 j6 j6 j6 j6 j6Z    z"J$?   %) %) %) %) %):. %) %) %) %) %)r/   