Vc!DdZddlZddlZddlZddlZddlZddlZddlZgdZddddddZ ddddddZ ddZ dd Z dd Z d Zd Zdd ZdZdZddZdZdZdZejdZejdZdZdZdZdZejeeddzZ dS)zFilename globbing utility.N)globiglobescapeFroot_dirdir_fd recursiveinclude_hiddenc Dtt|||||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 /usr/lib64/python3.11/glob.pyrr s2 h&I%3555 6 66cvtjd||tjd|||||tj|}n |dd}t ||||d|}|r|rPt |ddr9 t |}|rtj|f|}n#t$rYnwxYw|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. z glob.globz glob.glob/2NrFr ) sysauditosfspath_iglob _isrecursivenext itertoolschain StopIteration)r rrr r itss rrrsIk8Y///ImXy(FCCC 9X&&BQB< (FIu- / / /B y\(2A2,%?%? RA /_aT2..    D  Is'B)) B65B6c#Ktj|\}}t|sI|r#t t |||r|Vn"t t |||r|VdS|sH|r*t|rt|||||Ed{Vnt|||||Ed{VdS||kr%t|rt||||d|}n|g}t|r!|rt|rt} nt} nt} |D]E}| t ||||||D]$} tj || V%FdS)NrT) rpathsplit has_magic_lexists_join_isdirr_glob2_glob1r_glob0join) r rrr dironlyr dirnamebasenamedirs glob_in_dirnames rrr<s) h//GX X     h116:: eHg..77    =h// =h&',:<<< < < < < < < < <h&'-;=== = = = = = = =(y11gxD%3555y  !h// ! KK KK ..Kh 8 8(FG.<>>> . .D',,w-- - - - - ...rct|||}st|sfd|D}tj||S)Nc3>K|]}st||VdSN) _ishidden).0xr s r z_glob1..ls3HHq^H9Q<<HHHHHHHr)_listdirr3fnmatchfilter)r+patternrr*r namess ` rr'r'isX Wfg . .EIYw//IHHHHEHHH >% ) ))rct|r"tt|||r|gSnt||r|gSgSr2)r#r$r%)r+r,rr*r s rr(r(osT E'8,,f 5 5 :   '6 " " :  Irc&t||ddSNF)r(r+r:s rglob0r@| '7D% 0 00rc&t||ddSr>)r'r?s rglob1rCrArc#TK|ddVt||||Ed{VdS)Nrr) _rlistdir)r+r:rr*r s rr&r&sb "1"+&'(6888888888888rc#K d}d}|E|rtj|t|x}}n|}t|tr tj}nA|r|}nD"%C=+4C C= C-*C=,C--C=1 D"=DD"DD"D>"D;;D>> E  E ctjt|||5}t|cdddS#1swxYwYdSr2) contextlibclosingrVr )r+rr*rs rr7r7s  HWfg>> ? ?2BxxsAAAc#Kt|||}|D]S}|st|s@|V|rt||n|}t||||D]}t||VTdS)Nr)r7r3r$rE)r+rr*r r;r5r ys rrErEs Wfg . .E ""  "1 "GGG(/65!$$$QDtVW.<>>> " "Aqkk!!!! ""rc|tj|S tj||dS#tt f$rYdSwxYw)NrGTF)rr lexistslstatrQ ValueError)r rs rr#r#sh )wx((( &))))t Z uus;AAc|tj|S tj||}tj|jS#t tf$rYdSwxYw)NrGF)rr isdirstatS_ISDIRst_moderQr_)r rsts rr%r%st 'w}}X&&&( WXf - - -|BJ''' Z uusAA'&A'cR|r|s|p|Stj||Sr2)rr r))r+r,s rr$r$s2 #(#"(" 7<< * **rz([*?[])s([*?[])ct|trt|}nt|}|duSr2)rKrLmagic_check_bytessearch magic_check)rmatchs rr"r"sG!U&!((++""1%%  rc|ddvS)Nr)..)r s rr3r3s 7n $$rcDt|tr|dkS|dkS)Ns**z**)rKrL)r:s rrrs)'5!!%$rctj|\}}t|trt d|}ntd|}||zS)z#Escape all special characters. s[\1]z[\1])rr splitdriverKrLrhsubrj)r drives rrrsd g((22OE8(E""6$((8<<??7H55 8 r O_DIRECTORY)F)!__doc__rXrrer8rrbr__all__rrrr'r(r@rCr&rVr7rEr#r%r$compilerjrhr"r3rrO_RDONLYgetattrrJrorrr|s   % % %#DE66666$!%TU< '.'.'.'.Z****    111111 8888   D """"    ( ( (+++ bj## BJz**%%%   +M1 = ==r