
    zPjM                     f    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ  G d	 d
e      Zy)z
This module provides the simple backend for :class:`~pathspec.gitignore.GitIgnoreSpec`.

WARNING: The *pathspec._backends.simple* package is not part of the public API.
Its contents and structure are likely to change.
    )Sequence)Optional)RegexPattern)	_DIR_MARK)override   )SimplePsBackendc            	            e Zd ZU dZeeeef      ed<   dddde	e   de
e   de
e   ddf fd	Zed
edee
e   e
e   f   fd       Z xZS )SimpleGiBackendz
	The :class:`SimpleGiBackend` class is the default (or simple) implementation
	used by :class:`~pathspec.gitignore.GitIgnoreSpec` for matching files.
		_patternsN	no_filter
no_reversepatternsr   r   returnc                *    t         |   |||       y)a  
		Initialize the :class:`SimpleGiBackend` instance.

		*patterns* (:class:`Sequence` of :class:`.RegexPattern`) contains the
		compiled patterns.

		*no_filter* (:class:`bool`) is whether to keep no-op patterns (:data:`True`),
		or remove them (:data:`False`).

		*no_reverse* (:class:`bool`) is whether to keep the pattern order
		(:data:`True`), or reverse the order (:data:`True`).
		r   N)super__init__)selfr   r   r   	__class__s       [/root/$HERMES_HOME/venv/lib/python3.12/site-packages/pathspec/_backends/simple/gitignore.pyr   zSimpleGiBackend.__init__!   s    & '8yZH    filec                 X   | j                   }d}d}d}| j                  D ]  \  }}|j                  x}|j                  |      x}	)|	j                  j                         j                  t              }
|
rd}nd}|r||kD  r|}|}|}n|r|
s||k\  r|}|}|}|s}|dk(  s ||fS  ||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`).
		Nr   r      )_is_reversedr   include
match_filematch	groupdictgetr   )r   r   is_reversedout_include	out_indexout_priorityindexpatternr   r   dir_markprioritys               r   r   zSimpleGiBackend.match_file6   s     !!+ $+!),  neWW,$$T*	*7
 {{$$&**95HX X<kil 
X(l":kilx1} 
y	!!E D y	!!r   )__name__
__module____qualname____doc__listtupleintr   __annotations__r   r   boolr   r   strr   __classcell__)r   s   @r   r   r      s     sL()** ##I\"I d^	I
 tnI I* 1"C 1"E(4.(3-*G$H 1" 1"r   r   N)r-   collections.abcr   typingr   pathspec.patternr    pathspec.patterns.gitignore.specr   pathspec._typingr   pathspecr	   r    r   r   <module>r<      s6   P"o P"r   