a
    ¿5h®  ã                   @  s¢  d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
mZmZ e
rdddlmZmZmZ g d¢Zd:d	d
ddœdd„Zd;d	d
ddœdd„Zd	d
ddœdd„Zeddddœdd„ƒZeddddœdd„ƒZddd dœd!d„Zd"d#„ Zeddd$dœd%d&„ƒZeddd'dœd(d&„ƒZddd)dœd*d&„Zedd$d+œd,d-„ƒZedd'd+œd.d-„ƒZdd)d+œd/d-„Ze d0¡Ze d1¡Zdd
d2œd3d4„Zdd
d5œd6d7„Zd8d9„ ZdS )<z¡
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)ÚIterableÚIterator)ÚTYPE_CHECKINGÚAnyStrÚoverload)Ú	BytesPathÚStrOrBytesPathÚStrPath)ÚglobÚiglobÚescapeFr   Úboolzlist[AnyStr])ÚpathnameÚ	recursiveÚreturnc                 C  s   t t| |dƒS )ay  Return 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   )r   r   © r   ú.lib/python3.9/site-packages/setuptools/glob.pyr      s    r   zIterator[AnyStr]c                 C  s*   t | |ƒ}|r&t| ƒr&t|ƒ}|r&J ‚|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.
    )Ú_iglobÚ_isrecursiveÚnext)r   r   ÚitÚsr   r   r   r   %   s
    
r   c                 c  sÎ   t j | ¡\}}|r t|ƒr tnt}t| ƒsZ|rDt j | ¡rV| V  nt j |¡rV| V  d S |sr|||ƒE d H  d S || krŽt|ƒrŽt	||ƒ}n|g}t|ƒs t
}|D ]$}|||ƒD ]}t j ||¡V  q²q¤d S ©N)ÚosÚpathÚsplitr   Úglob2Úglob1Ú	has_magicÚlexistsÚisdirr   Úglob0Újoin)r   r   ÚdirnameÚbasenameZglob_in_dirÚdirsÚnamer   r   r   r   7   s(    r   r
   Ústrz	list[str])r%   Úpatternr   c                 C  s   d S r   r   ©r%   r*   r   r   r   r   [   s    r   r   Úbyteszlist[bytes]c                 C  s   d S r   r   r+   r   r   r   r   ]   s    r	   zstr | byteszlist[str] | list[bytes]c                 C  sT   | s"t |tƒrtj d¡} ntj} zt | ¡}W n tyF   g  Y S 0 t ||¡S ©NÚASCII)	Ú
isinstancer,   r   ÚcurdirÚencodeÚlistdirÚOSErrorÚfnmatchÚfilter)r%   r*   Únamesr   r   r   r   _   s    

c                 C  s8   |st j | ¡r4|gS nt j t j | |¡¡r4|gS g S r   )r   r   r"   r!   r$   )r%   r&   r   r   r   r#   m   s    r#   zIterator[str]c                 C  s   d S r   r   r+   r   r   r   r   }   s    r   zIterator[bytes]c                 C  s   d S r   r   r+   r   r   r   r      s    zIterator[str | bytes]c                 c  s,   t |ƒsJ ‚|d d… V  t| ƒE d H  d S )Nr   )r   Ú	_rlistdirr+   r   r   r   r      s    )r%   r   c                 C  s   d S r   r   ©r%   r   r   r   r7   ˆ   s    r7   c                 C  s   d S r   r   r8   r   r   r   r7   Š   s    c                 c  sŽ   | s"t | tƒrtj d¡} ntj} zt | ¡}W n tyD   Y d S 0 |D ]>}|V  | rftj | |¡n|}t	|ƒD ]}tj ||¡V  qrqJd S r-   )
r/   r,   r   r0   r1   r2   r3   r   r$   r7   )r%   r6   Úxr   Úyr   r   r   r7   Œ   s    
z([*?[])s   ([*?[]))r   r   c                 C  s*   t | tƒrt | ¡d uS t | ¡d uS d S r   )r/   r,   Úmagic_check_bytesÚsearchÚmagic_check)r   r   r   r   r    ¢   s    
r    )r*   r   c                 C  s   t | tƒr| dkS | dkS d S )Ns   **z**)r/   r,   )r*   r   r   r   r   ©   s    
r   c                 C  s<   t j | ¡\}} t| tƒr(t d| ¡} nt d| ¡} ||  S )zEscape all special characters.s   [\1]z[\1])r   r   Ú
splitdriver/   r,   r;   Úsubr=   )r   Údriver   r   r   r   °   s
    
r   )F)F)Ú__doc__Z
__future__r   r4   r   ÚreÚcollections.abcr   r   Útypingr   r   r   Z	_typeshedr   r	   r
   Ú__all__r   r   r   r   r#   r   r7   Úcompiler=   r;   r    r   r   r   r   r   r   Ú<module>   sB   $

