;
Źā"Ic               @   sa   d  Z  d d l Z d d d d g Z i  Z i  Z d   Z d   Z d	   Z d
   Z d   Z	 d S(   u£  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.)
i    Nu   filteru   fnmatchu   fnmatchcaseu	   translatec             C   s=   d d l  } | j j |   }  | j j |  } t |  |  S(   u½  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).
    i    N(   u   osu   pathu   normcaseu   fnmatchcase(   u   nameu   patu   os(    (    u$   /mit/python/lib/python3.0/fnmatch.pyu   fnmatch   s    c             C   s„   t  |  t  o t n t } | j |   } | d  k oe t  |  t  o. t |  d  } t |  } t | d  } n t |   } t j	 |  | |  <} n | j
 S(   Nu
   ISO-8859-1(   u
   isinstanceu   bytesu   _cachebu   _cacheu   getu   Noneu   stru	   translateu   reu   compileu   match(   u   patu   cacheu   regexu   pat_stru   res_stru   res(    (    u$   /mit/python/lib/python3.0/fnmatch.pyu   _compile_pattern)   s    c             C   s¾   d d l  } d d l } g  } | j j |  } t |  } | j | k o3 xk |  D]$ } | |  o | j |  qS qS Wn< x8 |  D]0 } | | j j |   o | j |  q q W| S(   u2   Return the subset of the list NAMES that match PATi    N(   u   osu	   posixpathu   pathu   normcaseu   _compile_patternu   append(   u   namesu   patu   osu	   posixpathu   resultu   matchu   name(    (    u$   /mit/python/lib/python3.0/fnmatch.pyu   filter6   s      c             C   s   t  |  } | |   d k	 S(   u   Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N(   u   _compile_patternu   None(   u   nameu   patu   match(    (    u$   /mit/python/lib/python3.0/fnmatch.pyu   fnmatchcaseG   s    c             C   sĖ  d t  |   } } d } x§| | k  o|  | } | d } | d k o | d } q | d k o | d } q | d k o+| } | | k  o |  | d	 k o | d } n | | k  o |  | d
 k o | d } n x- | | k  o |  | d
 k o | d } qį W| | k o | d } q¾|  | |  j d d  } | d } | d d	 k o d | d d  } n  | d d k o d | } n d | | f } q | t j |  } q W| d S(   uf   Translate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    i    u    i   u   *u   .*u   ?u   .u   [u   !u   ]u   \[u   \u   \\u   ^Nu   %s[%s]u   $(   u   lenu   replaceu   reu   escape(   u   patu   iu   nu   resu   cu   ju   stuff(    (    u$   /mit/python/lib/python3.0/fnmatch.pyu	   translateQ   s<     

 
(
   u   __doc__u   reu   __all__u   _cacheu   _cachebu   fnmatchu   _compile_patternu   filteru   fnmatchcaseu	   translate(    (    (    u$   /mit/python/lib/python3.0/fnmatch.pyu   <module>   s   				
