o
    Uh                     @   sD   d dl Z d dlZe jee jee j  ZG dd dZdd ZdS )    Nc                   @   sd   e Zd ZU dZeed< efdefddZdd Zdd Z	d	d
 Z
dd Zdd Zdd Zdd ZdS )
Translatorz
    >>> Translator('xyz')
    Traceback (most recent call last):
    ...
    AssertionError: Invalid separators

    >>> Translator('')
    Traceback (most recent call last):
    ...
    AssertionError: Invalid separators
    sepsc                 C   s&   |r
t |t tksJ d|| _d S )NzInvalid separators)set_default_sepsr   )selfr    r   ]/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/zipp/glob.py__init__   s   
zTranslator.__init__c                 C   s   |  | | |S )zH
        Given a glob pattern, produce a regex that matches it.
        )extend
match_dirstranslate_corer   patternr   r   r   	translate   s   zTranslator.translatec                 C   s   d| dS )z
        Extend regex for pattern-wide concerns.

        Apply '(?s:)' to create a non-matching group that
        matches newlines (valid on Unix).

        Append '\Z' to imply fullmatch even when match is used.
        z(?s:z)\Zr   r   r   r   r   r
          	zTranslator.extendc                 C   s
   | dS )z
        Ensure that zipfile.Path directory names are matched.

        zipfile.Path directory names always end in a slash.
        z[/]?r   r   r   r   r   r   +   s   
zTranslator.match_dirsc                 C   s&   |  | dt| jt| |S )a?  
        Given a glob pattern, produce a regex that matches it.

        >>> t = Translator()
        >>> t.translate_core('*.txt').replace('\\\\', '')
        '[^/]*\\.txt'
        >>> t.translate_core('a?txt')
        'a[^/]txt'
        >>> t.translate_core('**/*').replace('\\\\', '')
        '.*/[^/][^/]*'
         )restrict_rglobjoinmapreplaceseparatestar_not_emptyr   r   r   r   r   3   s   
zTranslator.translate_corec                 C   sB   | dp t| dddddt| j ddd	S )
zM
        Perform the replacements for a match from :func:`separate`.
        r   r   z\*\*z.*z\*[^z]*z\?z[^/])groupreescaper   r   )r   matchr   r   r   r   B   s   
zTranslator.replacec                 C   s>   dt | j d}t ||}tdd |D rtddS )z
        Raise ValueError if ** appears in anything but a full path segment.

        >>> Translator().translate('**foo')
        Traceback (most recent call last):
        ...
        ValueError: ** must appear alone in a path segment
        []+c                 s   s     | ]}d |v o|d kV  qdS )z**Nr   ).0segmentr   r   r   	<genexpr>X   s    z,Translator.restrict_rglob.<locals>.<genexpr>z&** must appear alone in a path segmentN)r   r   r   splitany
ValueError)r   r   seps_patternsegmentsr   r   r   r   M   s
   	zTranslator.restrict_rglobc                 C   s*   dd }dt | j d}t |||S )z@
        Ensure that * will not match an empty segment.
        c                 S   s   |  d}|dkrdS |S )Nr   *z?*)r   )r   r    r   r   r   handle_segment`   s   
z1Translator.star_not_empty.<locals>.handle_segmentr   r   )r   r   r   sub)r   r   r(   not_seps_patternr   r   r   r   [   s   zTranslator.star_not_emptyN)__name__
__module____qualname____doc__str__annotations__r   r	   r   r
   r   r   r   r   r   r   r   r   r   r      s   
 r   c                 C   s   t d| S )z
    Separate out character sets to avoid translating their contents.

    >>> [m.group(0) for m in separate('*.txt')]
    ['*.txt']
    >>> [m.group(0) for m in separate('a[?]txt')]
    ['a', '[?]', 'txt']
    z+([^\[]+)|(?P<set>[\[].*?[\]])|([\[][^\]]*$))r   finditer)r   r   r   r   r   h   r   r   )	osr   sepr/   altsepboolr   r   r   r   r   r   r   <module>   s
    a