o
    Nrfß  ã                   @   s@   d Z ddlZg d¢Zi ZdZdd„ Zdd„ Zd	d
„ Zdd„ ZdS )a£  Filename matching with shell patterns.

fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.

The functions operate by translating the pattern into a regular
expression.  They cache the compiled regular expressions for speed.

The function translate(PATTERN) returns a regular expression
corresponding to PATTERN.  (It does not compile it.)
é    N)ÚfnmatchÚfnmatchcaseÚ	translateéd   c                   C   s   t  ¡  dS )zClear the pattern cacheN)Ú_cacheÚclear© r   r   ú]/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/docker/utils/fnmatch.pyÚ_purge   s   r
   c                 C   s   |   ¡ } |  ¡ }t| |ƒS )a½  Test whether FILENAME matches PATTERN.

    Patterns are Unix shell style:

    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq

    An initial period in FILENAME is not special.
    Both FILENAME and PATTERN are first case-normalized
    if the operating system requires it.
    If you don't want this, use fnmatchcase(FILENAME, PATTERN).
    )Úlowerr   )ÚnameÚpatr   r   r	   r      s   
r   c                 C   s\   zt | }W n  ty&   t|ƒ}tt ƒtkrt  ¡  t |¡ t |< }Y nw | | ¡duS )zŽTest whether FILENAME matches PATTERN, including case.
    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N)	r   ÚKeyErrorr   ÚlenÚ	_MAXCACHEr   ÚreÚcompileÚmatch)r   r   Zre_patÚresr   r   r	   r   /   s   ür   c                 C   s¶  dt | ƒ}}d}||k rÖ| | }|d }|dkrK||k rE| | dkrE|d }||k r5| | dkr5|d }||kr?|› d}n“|› d}n|› d}n‡|d	krU|› d
}n}|dkrË|}||k ri| | dkri|d }||k rw| | dkrw|d }||k r| | dkr|d }||k r| | dks||kr™|› d}n9| ||…  dd¡}|d }|d dkr·d|dd… › }n|d dkrÂd|› }|› d|› d}n|t |¡ }||k s|› dS )zfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    r   ú^é   Ú*ú/z.*z(.*/)?z[^/]*ú?z[^/]ú[ú!ú]z\[ú\z\\Nú$)r   Úreplacer   Úescape)r   ÚiÚnr   ÚcÚjÚstuffr   r   r	   r   ?   sJ   ÿ
Õ
-r   )	Ú__doc__r   Ú__all__r   r   r
   r   r   r   r   r   r   r	   Ú<module>   s    