
    .Ph6                         d dl Z d dlZddlmZ e j         ee j                   ee j                  z  z   Z G d d          Z	d Z
dS )    N   )legacy_end_markerc                   h    e Zd ZU dZeed<   efdefdZd Ze	d             Z
d Zd Zd Zd	 Z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                 v    |r%t          |          t          t                    k    s
J d            || _        d S )NzInvalid separators)set_default_sepsr   )selfr   s     I/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/zipp/glob.py__init__zTranslator.__init__   s:    MD		S%7%77779M777			    c                 x    |                      |                     |                     |                              S )zH
        Given a glob pattern, produce a regex that matches it.
        )extend
match_dirstranslate_corer   patterns     r   	translatezTranslator.translate   s0     {{4??4+>+>w+G+GHHIIIr   c                     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)\z r   s     r   r   zTranslator.extend"   s     $w####r   c                     | dS )z
        Ensure that zipfile.Path directory names are matched.

        zipfile.Path directory names always end in a slash.
        z[/]?r   r   s     r   r   zTranslator.match_dirs.   s         r   c           
          |                      |           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   s     r   r   zTranslator.translate_core6   sL     	G$$$wws4<$2E2Eg2N2N)O)OPPQQQr   c                 (   |                     d          p}t          j        |                     d                                        dd                              ddt          j        | 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   matchs     r   r   zTranslator.replaceE   sy     {{5!! 
Iekk!nn%%WXu%%WU:")DI"6"6:::;;WUG$$		
r   c                     dt          j        | j                   d}t          j        ||          }t	          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              3   *   K   | ]}d |v o|d k    V  dS )z**Nr   ).0segments     r   	<genexpr>z,Translator.restrict_rglob.<locals>.<genexpr>[   s/      KKwtw27d?KKKKKKr   z&** must appear alone in a path segmentN)r$   r%   r   splitany
ValueError)r   r   seps_patternsegmentss       r   r   zTranslator.restrict_rglobP   sl     5BIdi004448L'22KK(KKKKK 	GEFFF	G 	Gr   c                 n    d }dt          j        | j                   d}t          j        |||          S )z@
        Ensure that * will not match an empty segment.
        c                 @    |                      d          }|dk    rdn|S )Nr   *z?*)r#   )r&   r,   s     r   handle_segmentz1Translator.star_not_empty.<locals>.handle_segmentc   s#    kk!nnG"c>>44w6r   r"   r)   )r$   r%   r   sub)r   r   r6   not_seps_patterns       r   r    zTranslator.star_not_empty^   sE    
	7 	7 	7 :49!5!5999v&@@@r   N)__name__
__module____qualname____doc__str__annotations__r
   r   r   r   r   r   r   r   r   r    r   r   r   r   r   	   s         
 
 III#0  S    J J J 	$ 	$ 	$! ! !R R R	
 	
 	
G G G
A 
A 
A 
A 
Ar   r   c                 ,    t          j        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   s    r   r   r   k   s     ;EwOOOr   )osr$   compat.py313r   sepr=   altsepboolr
   r   r   r   r   r   <module>rF      s    				 				 + + + + + +RY$$ry//99_A _A _A _A _A _A _A _AD	P 	P 	P 	P 	Pr   