
    d!                     D   d Z ddlZddlZddlZddlZddlZddlZddlZg dZddddddZ	ddddddZ
	 ddZdd	Zdd
Zd Zd ZddZd Zd ZddZd Zd Zd Z ej        d          Z ej        d          Zd Zd Zd Zd Zej         eedd          z  Z dS )zFilename globbing utility.    N)globiglobescapeFroot_dirdir_fd	recursiveinclude_hiddenc          	      D    t          t          | ||||                    S )a  Return 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   )pathnamer   r   r	   r
   s          /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/glob.pyr   r      s2     h&I%35 5 5 6 6 6    c                v   t          j        d| |           t          j        d| |||           |t          j        |          }n
| dd         }t	          | |||d|          }| r|rPt          | dd                   r9	 t          |          }|rt          j        |f|          }n# t          $ r Y nw xY w|S )a  Return 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/2Nr   Fr
      )
sysauditosfspath_iglob_isrecursivenext	itertoolschainStopIteration)r   r   r   r	   r
   itss          r   r   r      s     Ik8Y///ImXy(FCCC9X&&BQB<	(FIu-
/ 
/ 
/B y \(2A2,%?%? 	RA /_aT2.. 	 	 	D	Is   'B) )
B65B6c              #     K   t           j                            |           \  }}t          |           sM|rJ |r#t	          t          ||           |          r| V  n"t          t          ||          |          r| V  d S |sH|r*t          |          rt          |||||          E d {V  nt          |||||          E d {V  d S || k    r%t          |          rt          ||||d|          }n|g}t          |          r!|rt          |          rt          }	nt          }	nt          }	|D ]E} |	t          ||          ||||          D ]$}
t           j                            ||
          V  %Fd S )Nr   T)r   pathsplit	has_magic_lexists_join_isdirr   _glob2_glob1r   _glob0join)r   r   r   r	   dironlyr
   dirnamebasenamedirsglob_in_dirnames              r   r   r   <   s1     h//GXX 	 	h116::  eHg..77   	=h// 	=h&',:< < < < < < < < < < < h&'-;= = = = = = = = = = (y11gxD%35 5 5 y  	!h// 	! KK KK . .Kh 8 8(FG.<> > > 	. 	.D',,w------	.. .r   c                     t          | ||          }st          |          sfd|D             }t          j        ||          S )Nc              3   >   K   | ]}st          |          |V  d S N)	_ishidden).0xr
   s     r   	<genexpr>z_glob1.<locals>.<genexpr>l   s3      HHq^H9Q<<HHHHHHHr   )_listdirr3   fnmatchfilter)r+   patternr   r*   r
   namess       ` r   r'   r'   i   sX    Wfg..E IYw// IHHHHEHHH>%)))r   c                 t    |r"t          t          | |          |          r|gS nt          | |          r|gS g S r2   )r#   r$   r%   )r+   r,   r   r*   r
   s        r   r(   r(   o   sT     E'8,,f55 	:	
 '6"" 	:Ir   c                 &    t          | |d d          S NF)r(   r+   r:   s     r   glob0r@   |       '7D%000r   c                 &    t          | |d d          S r>   )r'   r?   s     r   glob1rC      rA   r   c              #   v   K   t          |          sJ |d d         V  t          | |||          E d {V  d S )Nr   r   )r   	_rlistdir)r+   r:   r   r*   r
   s        r   r&   r&      sv           
"1"+&'(68 8 8 8 8 8 8 8 8 8 8 8r   c              #     K   	 d }d }|E| rt          j        | t          |          x}}n|}t          | t                    rt           j        }nA| r| }n<t          | t                    rt	          t           j        d          }nt           j        }	 t          j        |          5 }|D ]G}	 |r|                                r| ||j	                  V  n	|j	        V  8# t          $ r Y Dw xY w	 d d d            n# 1 swxY w Y   |t          j        |           d S d S # |t          j        |           w w xY w# t          $ r Y d S w xY w)Nr   ASCII)r   open_dir_open_flags
isinstancebytesfsencodecurdirscandiris_dirr/   OSErrorclose)r+   r   r*   fdrM   argr   entrys           r   _iterdirrV      s      77OFKKKKSS'5)) '; 	CC'' 		7++CC)C	C 	B  E& 1%,,.. 1'3&.huz&:&: : : : :&+j 0 0 0"   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ~ ~r~    sr   BD> D" %C=+4C C= 
C-*C=,C--C=1D" =DD" DD" D> "D;;D> >
EEc                     t          j        t          | ||                    5 }t          |          cd d d            S # 1 swxY w Y   d S r2   )
contextlibclosingrV   r   )r+   r   r*   r   s       r   r7   r7      s    		HWfg>>	?	? 2Bxx                 s   A  AAc              #      K   t          | ||          }|D ]S}|st          |          s@|V  | rt          | |          n|}t          ||||          D ]}t          ||          V  Td S )Nr   )r7   r3   r$   rE   )r+   r   r*   r
   r;   r5   r    ys           r   rE   rE      s      Wfg..E " " 	"1 	"GGG(/65!$$$QDtVW.<> > > " "Aqkk!!!!" "r   c                     |t           j                            |           S 	 t          j        | |           dS # t          t
          f$ r Y dS w xY w)NrG   TF)r   r    lexistslstatrQ   
ValueError)r   r   s     r   r#   r#      se    ~wx(((
&)))) t Z    uus   ; AAc                     |t           j                            |           S 	 t          j        | |          }t          j        |j                  S # t          t          f$ r Y dS w xY w)NrG   F)r   r    isdirstatS_ISDIRst_moderQ   r_   )r   r   sts      r   r%   r%      sq    ~w}}X&&&(WXf--- |BJ''' Z    uus   A A'&A'c                 R    | r|s| p|S t           j                            | |          S r2   )r   r    r)   )r+   r,   s     r   r$   r$      s2     #( #"("7<<***r   z([*?[])s   ([*?[])c                     t          | t                    rt                              |           }nt                              |           }|d uS r2   )rK   rL   magic_check_bytessearchmagic_check)r   matchs     r   r"   r"      sG    !U &!((++""1%%r   c                     | d         dv S )Nr   )..    )r    s    r   r3   r3      s    7n$$r   c                 D    t          | t                    r| dk    S | dk    S )Ns   **z**)rK   rL   )r:   s    r   r   r      s)    '5!! %$r   c                     t           j                            |           \  }} t          | t                    rt
                              d|           } nt                              d|           } || z   S )z#Escape all special characters.
    s   [\1]z[\1])r   r    
splitdriverK   rL   rh   subrj   )r   drives     r   r   r      sd    
 g((22OE8(E"" 6$((8<<??7H558r   O_DIRECTORY)F)!__doc__rX   r   rer8   r   rb   r   __all__r   r   r   r'   r(   r@   rC   r&   rV   r7   rE   r#   r%   r$   compilerj   rh   r"   r3   r   r   O_RDONLYgetattrrJ   ro   r   r   <module>r|      s           				 				       




%
%
%#DE6 6 6 6 6$ !%TU    <  '. '. '. '.Z* * * *	 	 	 	1 1 11 1 18 8 8 8     D  
" " " "	 	 		( 	( 	(+ + + bj##BJz**   % % %  
 
 
 +M1 = ==r   