Ë
    hKêj  ã                   ó€   — d Z ddlZddlmZ ddlmZ ddlmZmZ dZ		  G d„ de«      Z
 G d	„ d
e«      Z G d„ de«      Zy)zA
This module provides common classes for the gitignore patterns.
é    N)ÚLiteral)ÚRegexPattern)ÚAnyStrÚassert_unreachableÚlatin1c                   óR   — e Zd ZdZdZededefd„«       Zedede	d   defd	„«       Z
y
)Ú_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        }| }n;t        | t        «      rt        }| j                  t        «      }nt        d| ›d�«      ‚dj                  d„ |D «       «      }|t        u r|j                  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   ó2   K  — | ]  }|d v rd|› �n|–— Œ y­w)z\[]!*#?ú\Nr
   )Ú.0Úxs     úe/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pathspec/patterns/gitignore/base.pyú	<genexpr>z/_GitIgnoreBasePattern.escape.<locals>.<genexpr>6   s!   è ø€ ÒLÀ A¨¡O˜"˜Q˜C™¸Ó:ÑLùs   ‚)Ú
isinstanceÚstrÚbytesÚdecodeÚ_BYTES_ENCODINGÚ	TypeErrorÚjoinÚencode)r   Úreturn_typeÚstringÚ
out_stringÚ	out_bytess        r   Úescapez_GitIgnoreBasePattern.escape"   s„   € ô �”3ÔÜ€;Ø�6Ü�!”UÔÜ€;Ø�H‰H”_Ó%�6ä	�R˜�uÐ=Ð>Ó	?Ð?ð �w‰wÑLÀVÔLÓL€*à”EÑØ× Ñ ¤Ó1€9Ø
Ðà
Ðó    ÚpatternÚrange_error)ÚliteralÚraisec                 óÒ  — 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k7  r|dz  }||k  r	| |   dk7  rŒ||k  rL|dz  }d}| |   dk(  r|dz  }|dz  }n| |   dk(  r
|dz  }|dz  }|| || j                  dd«      z  }||z  }|}nM|dk(  r|dz  }nB|dk(  rt	        d| || ›d| ›d�«      ‚t        d|›d�«       n|t        j                  |«      z  }||k  r�Œ?|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.

		*range_error* (:class:`int`) is how to handle invalid range notation in the
		pattern:

		-	:data:`"literal"`: Invalid notation will be treated as a literal string.

		-	:data:`"raise"`: Invalid notation will cause a :class:`_RangeError` to be
			raised.

		Returns the regular expression (:class:`str`).
		Fr   r   é   r   TÚ*z[^/]*ú?z[^/]ú[ú!ú^ú]z\\r%   z\[r&   zInvalid range notation=z found in pattern=ú.zrange_error=z is invalid.z9Escape character found with no next character to escape: )ÚlenÚrer!   ÚreplaceÚ_RangeErrorr   Ú
ValueError)	r#   r$   r!   ÚregexÚiÚendÚcharÚjÚexprs	            r   Ú_translate_segment_globz-_GitIgnoreBasePattern._translate_segment_glob>   s(  € ð2 €&Ø
€%ØŒc�'‹l€S€!Ø	ˆC‹à
�!‰*€4Øˆ�6€1áà€FØ	ŒR�Y‰Y�t‹_Ñ‚Eà�Šà‚Fà�Šð 
ˆWÑ�Eà�Šð 
ˆV�O�Eà�Šð 	
€Að 	ˆ3‚w�G˜A‘J #Ò%¨°©°sÒ):Øˆ!�V€Qð 	ˆ3‚w�7˜1‘: Ò$Øˆ!�V€Qð ˆcŠ'�g˜a‘j CÒ'Øˆ!�V€Qð ˆcŠ'�g˜a‘j CÓ'ð 	ˆ3‚wð ˆ!�V€QØ€Tà�‰
�cÒà
ˆc�k€dØˆ1�f�aØ
�!‰*˜Ò
ð ˆc�k€dØˆ1�f€að 
ˆW�Q�qˆ\×!Ñ! $¨Ó/Ñ/€Tð ˆd�]€Uð 
�Qð 	�yÒ ð ˆu�n�eØ
˜Ò
 äØ	  ¨¨1 Ð 0Ð0BØ
ˆ�Aðó	ð 	ô
 ˜L˜KÐ+¨<Ð8Õ9ð 
ŒR�Y‰Y�t‹_Ñ€EðC 	
ˆCŒñF Ü	Ø?À¸{ÐKó
ð ð 
€,r"   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Ústaticmethodr   r!   r   r   r;   r
   r"   r   r	   r	      sg   „ ñð €àðˆvð ˜&ò ó ðð6 ðCØðCàÐ)Ñ*ðCð 
òCó ñCr"   r	   c                   ó   — e Zd ZdZy)ÚGitIgnorePatternErrorzU
	The :class:`GitIgnorePatternError` class indicates an invalid gitignore
	pattern.
	N©r<   r=   r>   r?   r
   r"   r   rC   rC   Å   ó   „ ñð r"   rC   c                   ó   — e Zd ZdZy)r3   zi
	The :class:`_RangeError` class indicates an invalid range notation was found
	in a gitignore pattern.
	NrD   r
   r"   r   r3   r3   Í   rE   r"   r3   )r?   r1   Útypingr   Úpathspec.patternr   Úpathspec._typingr   r   r   r	   r4   rC   r3   r
   r"   r   ú<module>rJ      sR   ðñó 
õ
õ÷ð €ðô
l˜Lô lô^˜Jô ôÐ'õ r"   