o
    5‘ði®  ã                   @  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
r2ddlmZmZmZ g d¢Zd;d<dd„Zd;d=dd„Zd=dd„Zed>dd„ƒZed?d d„ƒZd@d$d„Zd%d&„ ZedAd(d)„ƒZedBd+d)„ƒZdCd-d)„ZedDd.d/„ƒZedEd0d/„ƒZdFd1d/„Ze d2¡Ze d3¡ZdGd5d6„ZdHd7d8„Zd9d:„ ZdS )Iz¡
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ÚescapeFÚpathnamer   Ú	recursiveÚboolÚreturnúlist[AnyStr]c                 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   úN/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/glob.pyr      s   r   ú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| ƒs/|r$t j | ¡r"| V  d S t j |¡r-| V  d S |s;|||ƒE d H  d S || krIt|ƒrIt	||ƒ}n|g}t|ƒsRt
}|D ]}|||ƒD ]
}t j ||¡V  q[qTd S ©N)ÚosÚpathÚsplitr   Úglob2Úglob1Ú	has_magicÚlexistsÚisdirr   Úglob0Újoin)r   r   ÚdirnameÚbasenameÚglob_in_dirÚdirsÚnamer   r   r   r   7   s0   €þÿÿr   r'   r
   ÚpatternÚstrú	list[str]c                 C  ó   d S r   r   ©r'   r,   r   r   r   r!   [   ó   r!   r   Úbytesúlist[bytes]c                 C  r/   r   r   r0   r   r   r   r!   ]   r1   r	   ústr | bytesúlist[str] | list[bytes]c                 C  sT   | st |tƒrtj d¡} ntj} zt | ¡}W n ty#   g  Y S w t ||¡S ©NÚASCII)	Ú
isinstancer2   r   ÚcurdirÚencodeÚlistdirÚOSErrorÚfnmatchÚfilter)r'   r,   Únamesr   r   r   r!   _   s   
ÿc                 C  s:   |st j | ¡r|gS g S t j t j | |¡¡r|gS g S r   )r   r   r$   r#   r&   )r'   r(   r   r   r   r%   m   s   þr%   úIterator[str]c                 C  r/   r   r   r0   r   r   r   r    }   r1   r    úIterator[bytes]c                 C  r/   r   r   r0   r   r   r   r       r1   úIterator[str | bytes]c                 c  s.   � t |ƒsJ ‚|d d… V  t| ƒE d H  d S )Nr   )r   Ú	_rlistdirr0   r   r   r   r    �   s   €c                 C  r/   r   r   ©r'   r   r   r   rC   ˆ   r1   rC   c                 C  r/   r   r   rD   r   r   r   rC   Š   r1   c                 c  s�   � | st | tƒrtj d¡} ntj} zt | ¡}W n
 ty#   Y d S w |D ]}|V  | r4tj | |¡n|}t	|ƒD ]
}tj ||¡V  q:q&d S r6   )
r8   r2   r   r9   r:   r;   r<   r   r&   rC   )r'   r?   Úxr   Úyr   r   r   rC   Œ   s"   €
ÿÿüz([*?[])s   ([*?[])r   c                 C  s&   t | tƒrt | ¡d uS t | ¡d uS r   )r8   r2   Úmagic_check_bytesÚsearchÚmagic_check)r   r   r   r   r"   ¢   s   
r"   c                 C  s   t | tƒr	| dkS | dkS )Ns   **z**)r8   r2   )r,   r   r   r   r   ©   s   
r   c                 C  sB   t j | ¡\}} t| tƒrt d| ¡} ||  S t d| ¡} ||  S )zEscape all special characters.s   [\1]z[\1])r   r   Ú
splitdriver8   r2   rG   ÚsubrI   )r   Údriver   r   r   r   °   s   
ÿr   )F)r   r   r   r   r   r   )r   r   r   r   r   r   )r'   r
   r,   r-   r   r.   )r'   r   r,   r2   r   r3   )r'   r	   r,   r4   r   r5   )r'   r
   r,   r-   r   r@   )r'   r   r,   r2   r   rA   )r'   r	   r,   r4   r   rB   )r'   r
   r   r@   )r'   r   r   rA   )r'   r	   r   rB   )r   r4   r   r   )r,   r4   r   r   )Ú__doc__Ú
__future__r   r=   r   ÚreÚcollections.abcr   r   Útypingr   r   r   Ú	_typeshedr   r	   r
   Ú__all__r   r   r   r!   r%   r    rC   ÚcompilerI   rG   r"   r   r   r   r   r   r   Ú<module>   sD    
$






