3 K]W@sdZddlZddlZddlZddlmZdddgZdddZdd dZd d Z d d Z ddZ ddZ ddZ ejdZejdZddZddZddZdS)z Filename globbing utility. Mostly a copy of `glob` from Python 3.5. Changes include: * `yield from` and PEP3102 `*` removed. * `bytes` changed to `six.binary_type`. * Hidden files are not ignored. N) binary_typeglobiglobescapeFcCstt||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)pathnamerr /usr/lib/python3.6/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)rritsr r r r s   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)rrdirnamebasenamexdirsZ glob_in_dirnamer r r r 2s4        r c CsR|s"t|trtjjd}ntj}ytj|}Wntk rDgSXtj||S)NASCII) isinstancerrcurdirencodelistdirOSErrorfnmatchfilter)rpatternnamesr r r r]s rcCs8|stjj|r4|gSntjjtjj||r4|gSgS)N)rrrrr)rrr r r rjs  rccs6t|s t|ddVxt|D] }|Vq$WdS)Nr)r r _rlistdir)rr(rr r r rzs rc cs|s"t|trttjd}ntj}ytj|}Wntjk rFdSXxJ|D]B}|V|rjtjj||n|}x t|D]}tjj||VqxWqNWdS)Nr ) r!rrr"r$errorrrr*)rr)rryr r r r*s  r*z([*?[])s([*?[])cCs(t|trtj|}n tj|}|dk S)N)r!rmagic_check_bytessearch magic_check)rmatchr r r rs   rcCst|tr|dkS|dkSdS)Ns**z**)r!r)r(r r r r s r cCs<tjj|\}}t|tr(tjd|}n tjd|}||S)z#Escape all special characters. s[\1]z[\1])rr splitdriver!rr-subr/)rZdriver r r rs   )F)F)__doc__rrer&Zsetuptools.extern.sixr__all__rrr rrrr*compiler/r-rr rr r r r s"    +