
                         8    S r SSKr/ SQr0 rSrS rS rS rS rg)	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                  ,    [         R                  5         g)zClear the pattern cacheN)_cacheclear     'lib/third_party/docker/utils/fnmatch.py_purger      s    
LLNr   c                 X    U R                  5       n UR                  5       n[        X5      $ )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t!!r   c                     [         U   nUR                  U 5      SL$ ! [         aX    [        U5      n[        [         5      [        :  a  [         R                  5         [        R                  " U5      =[         U'   n Ntf = f)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B ?B c                 V   S[        U 5      p!SnX:  Ga  X   nUS-   nUS:X  a;  X:  a0  X   S:X  a(  US-   nX:  a  X   S:X  a  US-   nX:  a  US-   nOUS-   nOUS-   nOUS	:X  a  US
-   nOUS:X  a  UnXR:  a  X   S:X  a  US-   nXR:  a  X   S:X  a  US-   nXR:  a  X   S:w  a  US-   nXR:  a
  X   S:w  a  M  XR:  a  US-   nO[XU R                  SS5      nUS-   nUS   S:X  a	  SUSS -   nOUS   S:X  a  SU-   nU SU S3nOU[        R                  " U5      -   nX:  a  GM  US-   $ )z^Translate 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#hq
C
%FE8u3E5SVs]AA6*C
 .C Gm#X,C#XAu3Eu3E%CFcME %CFcMvEka((v6E8s?%)OE1X_ 5LEQugQ'		!$CW %Z 9r   )	__doc__r   __all__r   r   r   r   r   r   r
   r   r   <module>r/      s2   
 

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