Qf"NdZddlZddlZddlZddlZddlZddlZddlZgdZddddddZ ddddddZ ddZ dd Z dd Z d Zd Zdd ZdZdZddZdZdZdZej.dZej.dZdZdZdZdZej<eeddzZ y)zFilename globbing utility.N)globiglobescapeFroot_dirdir_fd recursiveinclude_hiddenc 4tt|||||S)aReturn a list of paths matching a pathname pattern. The pattern may contain simple shell-style wildcards a la fnmatch. Unlike fnmatch, filenames starting with a dot are special cases that are not matched by '*' and '?' patterns by default. If `include_hidden` is true, the patterns '*', '?', '**' will match hidden directories. If `recursive` is true, the pattern '**' will match any files and zero or more directories and subdirectories. r)listr)pathnamerrr r s +/opt/alt/python312/lib64/python3.12/glob.pyrr s# h&I%35 66cTtjd||tjd|||||tj|}n|dd}t ||||d|}|r|r5t |ddr' t |}|rtj|f|}|S|S#t$rY|SwxYw)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. z glob.globz glob.glob/2NrFr ) sysauditosfspath_iglob _isrecursivenext itertoolschain StopIteration)r rrr r itss rrrsIIk8Y/IImXy(FC99X&BQ< (FIu- /B y\(2A,%? RA__aT2. I2I   I s2$B B'&B'c#Ktjj|\}}t|s<|rJ|rt t |||r|yt t |||r|y|s?|r$t|rt|||||Ed{yt|||||Ed{y||k7rt|rt||||d|}n|g}t|r|rt|rt} n t} nt} |D]@}| t ||||||D]$} tjj|| &By77w)NrT) rpathsplit has_magic_lexists_join_isdirr_glob2_glob1r_glob0join) r rrr dironlyr dirnamebasenamedirs glob_in_dirnames rrr<sT h/GX X { h16: eHg.7  h/h&',:< < < h&'-;= = =(y1gxD%35y h/ K K h 8(FG.<>D'',,w- ->+ < =s%B EEE'E(BEEczt|||}s t|s fd|D}tj||S)Nc3>K|]}s t|r|ywN) _ishidden).0xr s r z_glob1..lsHEq^9Q<Es)_listdirr3fnmatchfilter)r+patternrr*r namess ` rr'r'is6 Wfg .EYw/HEH >>% ))rc^|rtt|||r|gSgSt||r|gSgSr2)r#r$r%)r+r,rr*r s rr(r(os> E'8,f 5:  I '6 ":  Irct||ddSNF)r(r+r:s rglob0r@| '7D% 00rct||ddSr>)r'r?s rglob1rCrArc#Kt|sJ|r t||r|ddt||||Ed{y7w)Nrr)rr% _rlistdir)r+r:rr*r s rr&r&sG   fWf-bqk&'(6888s 5?=?c#K d}d}|D|rtj|t|x}}n|}t|trQtj }n@|r|}n;t|trt tj d}ntj } tj|5}|D]:} |r|jr%|||jn|j< ddd|tj|yy#t$rYjwxYw#1swY1xYw#|tj|wwxYw#t$rYywxYww)NrASCII) ropen_dir_open_flags isinstancebytesfsencodecurdirscandiris_dirr/OSErrorclose)r+rr*fdrMargrentrys r_iterdirrVs$   777OFKKS'5);; C  ' 7+C))C CBE&%,,.'3&.uzz&: :&+jj 0  !~ #!~  s}E B D>D!$D+7D"D%D!-D>E  DDDDDD!!D;;D>> E E  E  E ctjt|||5}t|cdddS#1swYyxYwr2) contextlibclosingrVr )r+rr*rs rr7r7s3   HWfg> ?2Bx ? ?s 6?c#Kt|||}|D]F}|s t|r||r t||n|}t||||D]}t||Hyw)Nr)r7r3r$rE)r+rr*r r;r5r ys rrErEs` Wfg .E  1G(/5!$QDtVW.<>Aqk!> s A9Ac|tjj|S tj||y#tt f$rYywxYw)NrGTF)rr lexistslstatrQ ValueError)r rs rr#r#sK ~wwx(( &) Z s;A  A c|tjj|S tj||}tj|j S#t tf$rYywxYw)NrGF)rr isdirstatS_ISDIRst_moderQr_)r rsts rr%r%s] ~ww}}X&&( WWXf -||BJJ'' Z sAA+*A+cV|r|s|xs|Stjj||Sr2)rr r))r+r,s rr$r$s' ("(" 77<< **rz([*?[])s([*?[])ct|trtj|}|duStj|}|duSr2)rKrLmagic_check_bytessearch magic_check)rmatchs rr"r"sF!U!((+  ""1%  rc|ddvS)Nr)..)r s rr3r3s 7n $$rc6t|tr|dk(S|dk(S)Ns**z**)rKrL)r:s rrrs!'5!%$rctjj|\}}t|trt j d|}||zStj d|}||zS)z#Escape all special characters. s[\1]z[\1])rr splitdriverKrLrhsubrj)r drives rrrsb gg((2OE8(E"$((8< 8 ??7H5 8 r O_DIRECTORY)F)!__doc__rXrrer8rrbr__all__rrrr'r(r@rCr&rVr7rEr#r%r$compilerjrhr"r3rrO_RDONLYgetattrrJrorrr|s   %#DE6$!%TU< '.Z* 11 8 D "  (+ bjj# BJJz*% ++M1 ==r