
    miP                     h    d Z ddlZddlmZ ddlmZ dZ	  G d de          Z G d d	e          Z	dS )
zA
This module provides common classes for the gitignore patterns.
    N)RegexPattern)AnyStrlatin1c                   V    e Zd ZdZdZededefd            Zededefd            Z	dS )	_GitIgnoreBasePatternz
	.. warning:: This class is not part of the public API. It is subject to
		change.

	The :class:`_GitIgnoreBasePattern` class is the base implementation for a
	compiled gitignore pattern.
	 sreturnc                 \   t          | t                    r
t          }| }nJt          | t                    r"t          }|                     t                    }nt          d| d          d                    d |D                       }|t          u r|                    t                    S |S )z
		Escape special characters in the given string.

		*s* (:class:`str` or :class:`bytes`) a filename or a string that you want to
		escape, usually before adding it to a ".gitignore".

		Returns the escaped string (:class:`str` or :class:`bytes`).
		zs:z! is not a unicode or byte string. c              3   ,   K   | ]}|d v rd| n|V  dS )z[]!*#?\Nr   ).0xs     x/var/www/html/bestrading.cuttalo.com/scripts/kaggle-env/lib/python3.11/site-packages/pathspec/patterns/gitignore/base.py	<genexpr>z/_GitIgnoreBasePattern.escape.<locals>.<genexpr>2   s4      JJaAMMQqJJJJJJ    )
isinstancestrbytesdecode_BYTES_ENCODING	TypeErrorjoinencode)r	   return_typestring
out_strings       r   escapez_GitIgnoreBasePattern.escape   s     3 @;66!U @;HH_%%66	>>>>	?	?? wwJJ6JJJJJ*E


O
,
,,
r   patternc                    d}d}dt          |           }}||k     r>| |         }|dz  }|rd}|t          j        |          z  }n|dk    rd}n|dk    r|dz  }n|d	k    r|d
z  }n|dk    r|}||k     r| |         dk    s| |         dk    r|dz  }||k     r| |         dk    r|dz  }||k     r#| |         dk    r|dz  }||k     r| |         dk    ||k     r]|dz  }d}| |         dk    r|dz  }|dz  }n| |         dk    r
|dz  }|dz  }|| ||                             dd          z  }||z  }|}n|dz  }n|t          j        |          z  }||k     >|rt	          d|           |S )a  
		Translates the glob pattern to a regular expression. This is used in the
		constructor to translate a path segment glob pattern to its corresponding
		regular expression.

		*pattern* (:class:`str`) is the glob pattern.

		Returns the regular expression (:class:`str`).
		Fr   r      r   T*z[^/]*?z[^/][!^]z\\z\[z9Escape character found with no next character to escape: )lenrer   replace
ValueError)r    r   regexiendcharjexprs           r   _translate_segment_globz-_GitIgnoreBasePattern._translate_segment_glob9   s)    &
%c'llS!	C
!*461 RF	RYt__EEFF 
WEE 
VOEE 	
A 	3wwGAJ#%%s):):!VQ 	3ww71:$$!VQ c''gajC''!VQ c''gajC'' 	3ww !VQT
c
ckd1faa
!*

 ckd1fa 
WQqS\!!$///T d]U 
QQ
 e^UU 
RYt__Eo 	
Cr  	KKK
 
  
,r   N)
__name__
__module____qualname____doc__	__slots__staticmethodr   r   r   r3   r   r   r   r   r      s          v &    ,4 nc nc n n n ,n n nr   r   c                       e Zd ZdZdS )GitIgnorePatternErrorzU
	The :class:`GitIgnorePatternError` class indicates an invalid gitignore
	pattern.
	N)r4   r5   r6   r7   r   r   r   r;   r;      s          r   r;   )
r7   r*   pathspec.patternr   pathspec._typingr   r   r   r,   r;   r   r   r   <module>r>      s     
			     	 	 	 	 	 	 
V V V V VL V V Vr    J     r   