o _a @sdZddlZddlZddlZgdZdddZdddZd d Zd d Zd dZ ddZ ddZ e dZ e 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. N)globiglobescapeFcCstt||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)pathnamerr1/usr/lib/python3/dist-packages/setuptools/glob.pyrs rcCs*t||}|rt|rt|}|rJ|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 _isrecursivenext)rritsrrr rs rccstj|\}}|rt|rtnt}t|s/|r$tj|r"|VdStj|r-|VdS|s;|||EdHdS||krIt|rIt ||}n|g}t|sRt }|D]}|||D] }tj ||Vq[qTdSN) ospathsplitr glob2glob1 has_magiclexistsisdirr glob0join)rrdirnamebasename glob_in_dirdirsnamerrr r 0s0   r cCsT|st|trtjd}ntj}zt|}Wn ty#gYSwt||SNASCII) isinstancebytesrcurdirencodelistdirOSErrorfnmatchfilter)rpatternnamesrrr rTs   rcCs:|s tj|r |gSgStjtj||r|gSgSr)rrrrr)rrrrr ras rccs4t|sJ|ddVt|D]}|VqdS)Nr)r _rlistdir)rr)xrrr rqs   rccs|st|trtjd}ntj}zt|}Wn tjy$YdSw|D]}|V|r5tj||n|}t |D] }tj||Vq;q'dSr) r!r"rr#r$r%errorrrr+)rr*r,ryrrr r+ys"  r+z([*?[])s([*?[])cCs.t|trt|}|duSt|}|duSr)r!r"magic_check_bytessearch magic_check)rmatchrrr rs   rcCst|tr |dkS|dkS)Ns**z**)r!r")r)rrr r s r cCsBtj|\}}t|trtd|}||Std|}||S)z#Escape all special characters. s[\1]z[\1])rr splitdriver!r"r/subr1)rdriverrr rs    r)F)__doc__rrer'__all__rrr rrrr+compiler1r/rr rrrrr s"  $