Vc!csDdZddlZddlZddlZddlZddlZddlZddlZgdZddddddZ ddddddZ ddZ dd Z dd Z d Zd Zdd ZdZdZddZdZdZdZejdZejdZdZdZdZdZejeeddzZ dS)zFilename globbing utility.N)globiglobescapeFroot_dirdir_fd recursiveinclude_hiddenc sDtt|||||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)pathnamerrrr /usr/lib64/python3.11/glob.pyrr s2 h&I%3555 6 66csvtjd||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/2NrFri) sysZauditosZfspath_iglob _isrecursiveZnext itertoolsZchainZ StopIteration)r rrrritss r rrsIk8Y///ImXy(FCCC 9X&&BQB< (FIu- / / /B y\(2A2,%?%? RA /_aT2..    D  Is'B)) B65B6c#sKtj|\}}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) rpathZsplit has_magic_lexists_join_isdirr_glob2_glob1r_glob0join) r rrrdironlyrdirnamebasenameZdirsZ glob_in_dirnames r rr<s) h//GX X     h116:: eHg..77    =h// =h&',:<<< < < < < < < < <h&'-;=== = = = = = = =(y11gxD%3555y  !h// ! KK KK ..Kh 8 8(FG.<>>> . .D',,w-- - - - - ...r cst|||}st|sfd|D}tj||S)Nc3s>K|]}st||VdSN) _ishidden)Z.0xrs r z z_glob1..ls3HHq^H9Q<<HHHHHHHr )_listdirr$fnmatchZfilter)r patternrrrnamess ` r rrisX Wfg . .EIYw//IHHHHEHHH >% ) ))r cst|r"tt|||r|gSnt||r|gSgSr#)rrr)r r!rrrr r rrosT E'8,,f 5 5 :   '6 " " :  Ir c&t||ddSNF)rr r( r glob0r.| '7D% 0 00r cr*r+)rr,r-r glob1r0r/r c#sTK|ddVt||||Ed{VdS)Nrr) _rlistdir)r r(rrrr r rrsb "1"+&'(6888888888888r c#sK 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 cstjt|||5}t|cdddS#1swxYwYdSr#) contextlibZclosingr9r )r rrrs r r&r&s  HWfg>> ? ?2BxxsAAAc#sKt|||}|D]S}|st|s@|V|rt||n|}t||||D]}t||VTdS)Nr)r&r$rr1)r rrrr)r%rZyr8r r1r1s Wfg . .E ""  "1 "GGG(/65!$$$QDtVW.<>>> " "Aqkk!!!! ""r cs|tj|S tj||dS#tt f$rYdSwxYw)Nr2TF)rrZlexistsZlstatr7 ValueError)r rr-r rrsh )wx((( &))))t Z uus;AAcs|tj|S tj||}tj|jS#t tf$rYdSwxYw)Nr2F)rrZisdirstatZS_ISDIRZst_moder7r;)r rZsts r rrst 'w}}X&&&( WXf - - -|BJ''' Z uusAA'&A'csR|r|s|p|Stj||Sr#)rrr)r r!r-r rrs2 #(#"(" 7<< * **r z([*?[])s([*?[])cst|trt|}nt|}|duSr#)r4r5magic_check_bytesZsearch magic_check)rZmatchr-r rrsG!U&!((++""1%%  r cs|ddvS)Nr)z.i.)r r r$r$s 7n $$r csDt|tr|dkS|dkS)Ns**z**)r4r5)r(r@r rrs)'5!!%$r cstj|\}}t|trt d|}ntd|}||zS)z#Escape all special characters. s[\1]z[\1])rrZ splitdriver4r5r=Zsubr>)r Zdriver-r rrsd g((22OE8(E""6$((8<<??7H55 8 r Z O_DIRECTORY)F)!Z__doc__r:rZrer'rr<rZ__all__rrrrrr.r0rr9r&r1rrrZcompiler>r=rr$rrZO_RDONLYZgetattrr3r?r r rAs   % % %#DE66666$!%TU< '.'.'.'.Z****    111111 8888   D """"    ( ( (+++ bj## BJz**%%%   +M1 = ==r