3 e @sdZddlZddlZddlZdddgZdddZdddZd d Zd d Zd dZ ddZ ddZ ej dZ ej dZddZddZddZdS)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. NglobiglobescapeFcCstt||dS)ayReturn 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)pathnamerr5/tmp/pip-build-vlmub77e/setuptools/setuptools/glob.pyrs cCs,t||}|r(t|r(t|}| s(t|S)aReturn 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 _isrecursivenextAssertionError)rritsrrr rs   ccstjj|\}}|r t|r tnt}t|sZ|rDtjj|rV|Vntjj|rV|VdS|sr|||EdHdS||krt|rt ||}n|g}t|st }x0|D](}x"|||D]}tjj ||VqWqWdS)N) ospathsplitr glob2glob1 has_magiclexistsisdirr glob0join)rrdirnamebasename glob_in_dirdirsnamerrr r 0s(    r c CsR|s"t|trtjjd}ntj}ytj|}Wntk rDgSXtj||S)NASCII) isinstancebytesrcurdirencodelistdirOSErrorfnmatchfilter)rpatternnamesrrr rTs rcCs8|stjj|r4|gSntjjtjj||r4|gSgS)N)rrrrr)rrrrr ras  rccs6t|s t|ddVxt|D] }|Vq$WdS)Nr)r r _rlistdir)rr(xrrr rqs rc cs|s"t|trtjjd}ntj}ytj|}Wntjk rFdSXxJ|D]B}|V|rjtjj||n|}x t |D]}tjj||VqxWqNWdS)Nr) r r!rr"r#r$errorrrr*)rr)r+ryrrr r*ys  r*z([*?[])s([*?[])cCs(t|trtj|}n tj|}|dk S)N)r r!magic_check_bytessearch magic_check)rmatchrrr rs   rcCst|tr|dkS|dkSdS)Ns**z**)r r!)r(rrr r s r cCs<tjj|\}}t|tr(tjd|}n tjd|}||S)z#Escape all special characters. s[\1]z[\1])rr splitdriver r!r.subr0)rdriverrr rs   )F)F)__doc__rrer&__all__rrr rrrr*compiler0r.rr rrrrr s    $