o nh@s<dZddlmZddlZddlZddlZddlmZmZddl m Z m Z m Z e r2ddl mZmZmZgdZd;dddZe d?d dZd@d$dZd%d&Ze dAd(d)Ze dBd+d)ZdCd-d)Ze dDd.d/Ze dEd0d/ZdFd1d/Zed2Zed3ZdGd5d6ZdHd7d8Zd9d:ZdS)Iz Filename globbing utility. Mostly a copy of `glob` from Python 3.5. Changes include: * `yield from` and PEP3102 `*` removed. * Hidden files are not ignored. ) annotationsN)IterableIterator) TYPE_CHECKINGAnyStroverload) BytesPathStrOrBytesPathStrPath)globiglobescapeFpathnamer recursiveboolreturn list[AnyStr]cCstt||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. )r)listr )rrrR/opt/prometheus-monitoring-scripts/lib/python3.10/site-packages/setuptools/glob.pyr s r Iterator[AnyStr]cCs*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)rritsrrrr %s r ccstj|\}}|rt|rtnt}t|s/|r$tj|r"|VdStj|r-|VdS|s;|||EdHdS||krIt|rIt ||}n|g}t|sRt }|D]}|||D] }tj ||Vq[qTdSN) ospathsplitrglob2glob1 has_magiclexistsisdirrglob0join)rrdirnamebasename glob_in_dirdirsnamerrrr7s0   rr'r patternstr list[str]cCdSrrr'r,rrrr![r!rbytes list[bytes]cCr/rrr0rrrr!]r1r str | byteslist[str] | list[bytes]cCsT|st|trtjd}ntj}zt|}Wn ty#gYSwt||SNASCII) isinstancer2rcurdirencodelistdirOSErrorfnmatchfilter)r'r,namesrrrr!_s   cCs:|s tj|r |gSgStjtj||r|gSgSr)rrr$r#r&)r'r(rrrr%ms r% Iterator[str]cCr/rrr0rrrr }r1r Iterator[bytes]cCr/rrr0rrrr r1Iterator[str | bytes]ccs.t|sJ|ddVt|EdHdS)Nr)r _rlistdirr0rrrr s cCr/rrr'rrrrCr1rCcCr/rrrDrrrrCr1ccs|st|trtjd}ntj}zt|}Wn ty#YdSw|D]}|V|r4tj||n|}t |D] }tj||Vq:q&dSr6) r8r2rr9r:r;r<rr&rC)r'r?xryrrrrCs"   z([*?[])s([*?[])rcCs&t|tr t|duSt|duSr)r8r2magic_check_bytessearch magic_check)rrrrr"s r"cCst|tr |dkS|dkS)Ns**z**)r8r2)r,rrrrs rcCsBtj|\}}t|trtd|}||Std|}||S)zEscape all special characters.s[\1]z[\1])rr splitdriver8r2rGsubrI)rdriverrrr s    r )F)rrrrrr)rrrrrr)r'r r,r-rr.)r'rr,r2rr3)r'r r,r4rr5)r'r r,r-rr@)r'rr,r2rrA)r'r r,r4rrB)r'r rr@)r'rrrA)r'r rrB)rr4rr)r,r4rr)__doc__ __future__rr=rrecollections.abcrrtypingrrr _typeshedrr r __all__r r rr!r%r rCcompilerIrGr"rr rrrrsD    $