mς
­fIc           @   sX   d  Z  d k Z d k Z d k Z d g Z d   Z d   Z e i d  Z d   Z	 d S(   s   Filename globbing utility.Nt   globc         C   sb  t  |   p& t i i |   o |  g Sq3 g  Sn t i i |   \ } } | p t t i	 |  Sn' t  |  o t
 |  } n
 | g } t  |  pr g  } xΌ | D]] } | p t i i |  o= t i i | |  } t i i |  o | i |  qq¦ q¦ WnT g  } xJ | D]B } t | |  } x* | D]" } | i t i i | |   q4WqW| S(   s   Return a list of paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la fnmatch.

    N(   t	   has_magict   pathnamet   ost   patht   lexistst   splitt   dirnamet   basenamet   glob1t   curdirR    t   listt   resultt   isdirt   joint   namet   appendt   sublist(   R   R   R   R   R   R   R   (    (    t!   /mit/python/lib/python2.4/glob.pyR    	   s6     	   $c         C   s{   |  p t i }  n y t i |   } Wn t i j
 o g  Sn X| d d j o t d   |  } n t i | |  S(   Ni    t   .c         C   s   |  d d j S(   Ni    R   (   t   x(   R   (    (    R   t   <lambda>1   s    (	   R   R   R
   t   listdirt   namest   errort   patternt   filtert   fnmatch(   R   R   R   (    (    R   R	   *   s     	s   [*?[]c         C   s   t  i |   d  j	 S(   N(   t   magic_checkt   searcht   st   None(   R   (    (    R   R   7   s    (
   t   __doc__R   R   t   ret   __all__R    R	   t   compileR   R   (   R"   R    R   R   R!   R   R   R	   (    (    R   t   ?   s   					!	