
    2.a                     8    d Z ddlZg dZi ZdZd Zd Zd Zd Zy)	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	translated   c                  ,    t         j                          y)zClear the pattern cacheN)_cacheclear     6/usr/lib/python3/dist-packages/docker/utils/fnmatch.py_purger      s    
LLNr   c                 Z    | j                         } |j                         }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pats     r   r   r      s'      ::<D
))+CtS!!r   c                     	 t         |   }|j                  |       duS # t        $ rV t        |      }t        t               t        k\  rt         j                          t        j                  |      xt         |<   }Y qw xY w)zTest 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   re_patress       r   r   r   /   sk    / <<T))  /nv;)#LLN!zz#.sf	/s   	 AA=<A=c                 L   dt        |       }}d}||k  r| |   }|dz   }|dk(  r;||k  r0| |   dk(  r(|dz   }||k  r| |   dk(  r|dz   }||k\  r|dz   }n|dz   }n|dz   }n|d	k(  r|d
z   }n|dk(  r|}||k  r| |   dk(  r|dz   }||k  r| |   dk(  r|dz   }||k  r| |   dk7  r|dz   }||k  r	| |   dk7  r||k\  r|dz   }nY| || j                  dd      }|dz   }|d   dk(  r	d|dd z   }n|d   dk(  rd|z   }| d| d}n|t        j                  |      z   }||k  r|dz   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stuffs          r   r   r   ?   s   
 c#hqA
C
a%FE81uQ3Eq5SVs]AA6*C
 .C Gm#X,C#XA1uQ3E1uQ3Ea%CFcME a%CFcMAvEkAa((v6E8s?%)OE1X_ 5LEQugQ'		!$CW a%Z 9r   )	__doc__r   __all__r   r   r   r   r   r   r
   r   r   <module>r/      s2   
 

1		
"** 4r   