Ë
    hKêju  ã                  ó®   — d Z ddlmZ ddlmZmZmZ 	 ddlZddl	m
Z
 ddlmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZ  G d„ de«      Zy# e$ r dZY Œ;w xY w)zß
This module provides the :module:`re2` backend for :class:`~pathspec.gitignore.GitIgnoreSpec`.

WARNING: The *pathspec._backends.re2* package is not part of the public API. Its
contents and structure are likely to change.
é    )Úannotations)ÚCallableÚOptionalÚUnionN)ÚRegexPattern)ÚGitIgnoreSpecPatternÚ_BYTES_ENCODINGÚ_DIR_MARK_CGÚ_DIR_MARK_OPT)Úoverrideé   )ÚRe2RegexDatÚRe2RegexDebug)ÚRe2PsBackendc                  óR   — e Zd ZdZee	 	 	 	 	 	 	 	 	 	 dd„«       «       Zedd„«       Zy)ÚRe2GiBackendz�
	The :class:`Re2GiBackend` class is the :module:`re2` implementation used by
	:class:`~pathspec.gitignore.GitIgnoreSpec` for matching files.
	c           
     óØ  — t        |j                  «       «      }|� ||«       g }|D �]®  }||   }|j                  €Œ|j                  €J |«       ‚t	        |t
        «      sJ |«       ‚|j                  j                  }g }	t	        |t        «      rÅt	        |t        «      r|}
n,t	        |t        «      sJ |«       ‚|j                  t        «      }
t        |
v r~|
j                  t        «      r@|
dt        t        «        }|	j!                  |› d�df«       |	j!                  |› d�df«       n)|
j#                  t        d«      }|	j!                  |df«       |	s|	j!                  |df«       |	D ]h  \  }}| r)|j!                  t%        |j                  |||¬«      «       n'|j!                  t'        |j                  ||¬«      «       |j)                  |«       Œj �Œ± |j+                  «        |S )aV  
		Create the re2 regex set.

		*debug* (:class:`bool`) is whether to include additional debugging
		information for the regular expressions.

		*patterns* (:class:`dict`) maps pattern index (:class:`int`) to pattern
		(:class:`.RegexPattern`).

		*regex_set* (:class:`re2.Set`) is the regex set.

		*sort_indices* (:class:`callable` or :data:`None`) is a function used to
		sort the patterns by index. This is used during testing to ensure the order
		of patterns is not accidentally relied on.

		Returns a :class:`list` indexed by regex id (:class:`int`) to its data
		(:class:`Re2RegexDat`).
		Nú/Tú$F)ÚincludeÚindexÚis_dir_patternÚregex)r   r   r   )ÚlistÚkeysr   r   Ú
isinstancer   Úpatternr   ÚstrÚbytesÚdecoder	   r
   Úendswithr   ÚlenÚappendÚreplacer   r   ÚAddÚCompile)ÚdebugÚpatternsÚ	regex_setÚsort_indicesÚindicesÚ
regex_dataÚpattern_indexr   r   Úuse_regexesÚ	regex_strÚ
base_regexr   s                úe/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pathspec/_backends/re2/gitignore.pyÚ	_init_setzRe2GiBackend._init_set*   sí  € ô6 �—‘“Ó!€'ØÐÙ�Ôð #%€*Øó 5€mØ�mÑ$€7Ø‡o�oÐØà
�-‰-Ð
#Ð, WÓ,Ð
#Ü
�WœlÔ
+Ð4¨WÓ4Ð
+Ø�=‰=× Ñ €5à79€;Ü�Ô.Ô/ô
 �%œÔØ�Yä�uœeÔ$Ð+ eÓ+Ð$Ø—‘œoÓ.€Yä�yÑ à×Ñœ=Ô)ð Ð1œs¤=Ó1Ð1Ð2€jØ×Ñ˜Z˜L¨Ð*¨DÐ1Ô2Ø×Ñ˜Z˜L¨Ð*¨EÐ2Õ3ð ×$Ñ$¤\°3Ó7€jØ×Ñ˜* dÐ+Ô,á
à×Ñ˜˜u�~Ô&à +ò Ñ€uˆnÙØ×Ñ”}Ø�o‰oØØ#Øô	õ ð ×Ñ”{Ø�o‰oØØ#ôô ð ‡M�M�%ÕòðM5ðp ×ÑÔØ	Ðó    c                ó4  — | j                   j                  |«      }|syd}d}d}| j                  }|D ]Q  }||   }|j                  }	|	rd}
nd}
|j                  }|j
                  }|r|	r||kD  s|
|k(  r||kD  s|
|kD  sŒL|}|}|
}ŒS |dk7  s
J |||f«       ‚||fS )a  
		Check the file against the patterns.

		*file* (:class:`str`) is the normalized file path to check.

		Returns a :class:`tuple` containing whether to include *file* (:class:`bool`
		or :data:`None`), and the index of the last matched pattern (:class:`int` or
		:data:`None`).
		)NNNéÿÿÿÿr   é   )Ú_setÚMatchÚ_regex_datar   r   r   )ÚselfÚfileÚ	match_idsÚout_includeÚ	out_indexÚout_priorityr,   Úregex_idÚ	regex_datr   Úpriorityr   r   s                r1   Ú
match_filezRe2GiBackend.match_file†   sÖ   € ð $(§9¡9§?¡?°4Ó#8€)Ù	Ø
à $€+Ø€)Ø€,à×Ñ€*Øò €hØ˜(Ñ#€9à×,Ñ,€>Ùà�Hð €Hð ×Ñ€7Ø�?‰?€5á‘ E¨IÒ$5Ø�LÒ  U¨YÒ%6Ø�,Óà€KØ€IØ�Lð-ð0 
�bŠÐ@˜9 k°<Ð@Ó@ˆØ
�yÐ	!Ð!r3   N)
r'   Úboolr(   zdict[int, RegexPattern]r)   zre2.Setr*   z%Optional[Callable[[list[int]], None]]Úreturnzlist[Re2RegexDat])r;   r   rE   z$tuple[Optional[bool], Optional[int]])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústaticmethodr2   rC   © r3   r1   r   r   $   sm   „ ñð
 ØðXØ	ðXà#ðXð ðXð 6ð	Xð
 òXó ó ðXðt ò-"ó ñ-"r3   r   )rI   Ú
__future__r   Útypingr   r   r   Úre2ÚModuleNotFoundErrorÚpathspec.patternr   Ú pathspec.patterns.gitignore.specr   r	   r
   r   Úpathspec._typingr   Ú_baser   r   Úpathspecr   r   rK   r3   r1   ú<module>rU      sc   ðñõ #÷ñ ð
Ûõ÷ó õ
÷õôP"�<õ P"øð) ò Ø‚ðús   ”A
 Á
AÁA