
    
_d                         d Z ddlZddlZddlZg dZddZddZd Zd Zd Z	d	 Z
d
 Z ej                  d      Z ej                  d      Zd Zd Zd Zy)z
Filename globbing utility. Mostly a copy of `glob` from Python 3.5.

Changes include:
 * `yield from` and PEP3102 `*` removed.
 * Hidden files are not ignored.
    N)globiglobescapec                 .    t        t        | |            S )ay  Return a list of paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    )	recursive)listr   )pathnamer   s     1/usr/lib/python3/dist-packages/setuptools/glob.pyr   r      s     h)455    c                 V    t        | |      }|rt        |       rt        |      }|rJ |S )a  Return an iterator which yields the paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    )_iglob_isrecursivenext)r	   r   itss       r
   r   r      s/     
)	$B\(+HuIr   c              #   (  K   t         j                  j                  |       \  }}|rt        |      rt        nt
        }t        |       sJ|r$t         j                  j                  |       r|  y t         j                  j                  |      r|  y |s |||      E d {    y || k7  rt        |      rt        ||      }n|g}t        |      st        }|D ]2  } |||      D ]$  }t         j                  j                  ||       & 4 y 7 nwN)ospathsplitr   glob2glob1	has_magiclexistsisdirr   glob0join)r	   r   dirnamebasenameglob_in_dirdirsnames          r
   r   r   0   s     h/GX$h)?%UKXwwx(
 	 ww}}W%w111 (y1gy)yX .2 	.D'',,w--	.. 	2s   BD!D"A/Dc                     | s@t        |t              r t        j                  j	                  d      } nt        j                  } 	 t        j
                  |       }t        j                  ||      S # t        $ r g cY S w xY wNASCII)	
isinstancebytesr   curdirencodelistdirOSErrorfnmatchfilter)r   patternnamess      r
   r   r   T   sh    gu%ii&&w/GiiG

7# >>%))  	s   A/ /A=<A=c                     |s$t         j                  j                  |       r|gS g S t         j                  j                  t         j                  j	                  | |            r|gS g S r   )r   r   r   r   r   )r   r   s     r
   r   r   a   sT     77==!: I 77??277<<:;:Ir   c              #   \   K   t        |      sJ |d d  t        |       D ]  }|  y w)Nr   )r   	_rlistdir)r   r.   xs      r
   r   r   q   s9        
"1+w s   *,c              #     K   | s@t        | t              r t        j                  j	                  d      } nt        j                  } 	 t        j
                  |       }|D ]\  }| | r t        j                  j                  | |      n|}t        |      D ]$  }t        j                  j                  ||       & ^ y # t        j                  $ r Y y w xY wwr$   )
r&   r'   r   r(   r)   r*   errorr   r   r2   )r   r/   r3   r   ys        r
   r2   r2   y   s     gu%ii&&w/GiiG

7#  %+2rww||GQ'4 	%A'',,q!$$	%% 88 s+   ACB= A"C=CCCCz([*?[])s   ([*?[])c                     t        | t              rt        j                  |       }|d uS t        j                  |       }|d uS r   )r&   r'   magic_check_bytessearchmagic_check)r   matchs     r
   r   r      sF    !U!((+  ""1%r   c                 6    t        | t              r| dk(  S | dk(  S )Ns   **z**)r&   r'   )r.   s    r
   r   r      s!    '5!%$r   c                     t         j                  j                  |       \  }} t        | t              rt
        j                  d|       } || z   S t        j                  d|       } || z   S )zEscape all special characters.s   [\1]z[\1])r   r   
splitdriver&   r'   r8   subr:   )r	   drives     r
   r   r      sb     gg((2OE8(E"$((8< 8 ??7H58r   )F)__doc__r   rer,   __all__r   r   r   r   r   r   r2   compiler:   r8   r   r   r    r   r
   <module>rF      sp    
 	 
%6$.H
*	 %" bjj#BJJz* 	r   