3 (\@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)pathnamerrk/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-rm6ck8ia/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   ccs tjj|\}}t|sF|r0tjj|rB|Vntjj|rB|VdS|s|rrt|rrx4t||D] }|VqbWnxt||D] }|Vq~WdS||krt|rt ||}n|g}t|r|rt|rt}qt}nt }x0|D](}x"|||D]}tjj ||VqWqWdS)N) ospathsplit has_magiclexistsisdirr glob2glob1r glob0join)rrdirnamebasenamexdirs glob_in_dirnamerrr r 0s4        r c CsR|s"t|trtjjd}ntj}ytj|}Wntk rDgSXtj||S)NASCII) isinstancebytesrcurdirencodelistdirOSErrorfnmatchfilter)rpatternnamesrrr r[s rcCs8|stjj|r4|gSntjjtjj||r4|gSgS)N)rrrrr)rrrrr rhs  rccs6t|s t|ddVxt|D] }|Vq$WdS)Nr)r r _rlistdir)rr)rrrr rxs 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*rryrrr r+s  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    +