o
    “si,  ã                   @   sÄ   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d„ ƒZejddefdd„ƒZ	dd„ Z
ejejfdd	„ƒZejdd
efdd„ƒZejdd„ ƒZG dd„ dƒZG dd„ dejejƒZdS )é    Nc              	   c   s8   � t  ¡ }t  | ¡ z| V  W t  |¡ d S t  |¡ w ©N)ÚosÚgetcwdÚchdir)ÚdirÚorig© r   úpC:\Users\PC\students\dividedattentionclub\venv\lib\python3.10\site-packages\setuptools/_vendor/jaraco/context.pyÚpushd
   s   €
r
   c                 c   s  � |du rt j | ¡ dd¡ dd¡}|du rtjtjdd�}|djdi t	ƒ ¤Žƒ zMd}d	}d
 
||f¡}||jddt| ƒit	ƒ ¤Žƒ ||ƒ� |V  W d  ƒ n1 sWw   Y  W |djdi t	ƒ ¤Žƒ dS W |djdi t	ƒ ¤Žƒ dS |djdi t	ƒ ¤Žƒ 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   )r   ÚpathÚbasenameÚreplaceÚ	functoolsÚpartialÚ
subprocessÚ
check_callÚformatÚvarsÚjoinÚinfer_compression)ÚurlÚ
target_dirÚrunnerr
   ÚgetterÚextractÚcmdr   r   r	   Útarball_context   s"   €
ÿý2r   c                 C   s&   | dd… }t dddd�}| |d¡S )zF
    Given a URL or filename, infer the compression code for tar.
    éþÿÿÿNÚzÚjÚJ)ÚgzZbzÚxz)ÚdictÚget)r   Zcompression_indicatorÚmappingr   r   r	   r   0   s   r   c                 c   s*   � t  ¡ }z
|V  W | |ƒ dS | |ƒ w )zk
    Create a temporary directory context. Pass a custom remover
    to override the removal behavior.
    N)ÚtempfileÚmkdtemp)ZremoverÚtemp_dirr   r   r	   r+   ;   s
   €r+   Tc           	      c   sŠ   � d| v rdnd}|ƒ �/}|d| |g}|r|  d|g¡ ttjjdƒ}|r'|nd}tj||d� |V  W d  ƒ dS 1 s>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ÚquietZdest_ctxÚexeÚrepo_dirr   r3   r0   r   r   r	   Úrepo_contextH   s   €"ùr8   c                   c   s   � d V  d S r   r   r   r   r   r	   Únull[   s   €
r9   c                   @   st   e Zd ZdZdZeffdd„Zdd„ Zedd„ ƒZ	ed	d
„ ƒZ
edd„ ƒZdd„ Zdd„ Zedœdd„Zd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                 C   s
   || _ d S r   )Ú
exceptions)Úselfr;   r   r   r	   Ú__init__€   ó   
zExceptionTrap.__init__c                 C   s   | S r   r   ©r<   r   r   r	   Ú	__enter__ƒ   s   zExceptionTrap.__enter__c                 C   ó
   | j d S ©Nr   ©Úexc_infor?   r   r   r	   Útype†   ó   
zExceptionTrap.typec                 C   rA   )Né   rC   r?   r   r   r	   ÚvalueŠ   rF   zExceptionTrap.valuec                 C   rA   )Né   rC   r?   r   r   r	   ÚtbŽ   rF   zExceptionTrap.tbc                 G   s&   |d }|ot || jƒ}|r|| _|S rB   )Ú
issubclassr;   rD   )r<   rD   rE   Úmatchesr   r   r	   Ú__exit__’   s
   zExceptionTrap.__exit__c                 C   s
   t | jƒS r   )ÚboolrE   r?   r   r   r	   Ú__bool__™   r>   zExceptionTrap.__bool__©Ú_testc                   s   t  ˆ¡‡ ‡‡fd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                     sF   t ˆjƒ�}ˆ| i |¤Ž W d   ƒ ˆ |ƒS 1 sw   Y  ˆ |ƒS r   )r:   r;   )ÚargsÚkwargsZtrap©rQ   Úfuncr<   r   r	   Úwrapper¯   s   
ÿþz%ExceptionTrap.raises.<locals>.wrapper)r   Úwraps)r<   rU   rQ   rV   r   rT   r	   Úraisesœ   s   zExceptionTrap.raisesc                 C   s   | j |tjd�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
        rP   )rX   ÚoperatorÚnot_)r<   rU   r   r   r	   Úpasses·   s   zExceptionTrap.passesN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rD   Ú	Exceptionr=   r@   ÚpropertyrE   rH   rJ   rM   rO   rN   rX   r[   r   r   r   r	   r:   `   s    


r:   c                   @   s   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)r\   r]   r^   r_   r   r   r   r	   rb   Í   s    rb   )r   r   Ú
contextlibr   r)   ÚshutilrY   Úcontextmanagerr
   r   r   Úrmtreer+   r8   r9   r:   rb   ÚContextDecoratorr   r   r   r	   Ú<module>   s(    
	
m