
    MjB                        d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZmZ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 ddlmZmZ ddlmZm Z   e	dd          Z!	  G d dee                   Z"dS )aQ  
This module provides :class:`.GitIgnoreSpec` which replicates *.gitignore*
behavior, and handles edge-cases where Git's behavior differs from what's
documented. Git allows including files from excluded directories which directly
contradicts the documentation. This uses :class:`.GitIgnoreSpecPattern` to fully
replicate Git's handling.
    )annotations)IterableSequence)CallableOptionalTypeVarUnioncastoverload)BackendNamesHint_Backend_TestBackendFactoryHintmake_gitignore_backend)PathSpec)Pattern)GitIgnoreBasicPattern)GitIgnoreSpecPattern)AnyStroverride)_is_iterablelookup_patternSelfGitIgnoreSpec)boundc                       e Zd ZdZd fdZeeddddd                        Zee	 ddddd d                        Zee	 ddddd  fd                        Zee	d!d                        Z
 xZS )"r   z
	The :class:`GitIgnoreSpec` class extends :class:`.PathSpec` to replicate
	*gitignore* behavior. This is uses :class:`.GitIgnoreSpecPattern` to fully
	replicate Git's handling.
	otherobjectreturnboolc                    t          |t                    r!t                                          |          S t          |t                    rdS t
          S )z
		Tests the equality of this gitignore-spec with *other* (:class:`.GitIgnoreSpec`)
		by comparing their :attr:`self.patterns <.PathSpec.patterns>` attributes. A
		non-:class:`GitIgnoreSpec` will not compare equal.
		F)
isinstancer   super__eq__r   NotImplemented)selfr   	__class__s     f/lsinfo/ai/hellotax_ai/training_center/backend/venv/lib/python3.11/site-packages/pathspec/gitignore.pyr$   zGitIgnoreSpec.__eq__8   sJ     }%% 
''..

%"" 
%
    Nbackend_test_backend_factorycls
type[Self]pattern_factory<Union[str, type[Pattern], Callable[[AnyStr], Pattern], None]linesIterable[AnyStr]r+   "Union[BackendNamesHint, str, None]r,   r   r   c                   d S N )r-   r/   r1   r+   r,   s        r(   
from_lineszGitIgnoreSpec.from_linesF   	     #r)   c                   d S r5   r6   )r-   r1   r/   r+   r,   s        r(   r7   zGitIgnoreSpec.from_linesR   r8   r)   c          	        t          |t          t          f          st          |          rt	          |          r||}}|t
          }n5|dk    rt
          }n't          |t                    rt          |          }n|}t          |t                    r3t          |t                    rt          d|d| dt           d          t                                          ||||          }|S )a  
		Compiles the pattern lines.

		*lines* (:class:`~collections.abc.Iterable`) yields each uncompiled pattern
		(:class:`str`). This simply has to yield each line, so it can be a
		:class:`io.TextIOBase` (e.g., from :func:`open` or :class:`io.StringIO`) or
		the result from :meth:`str.splitlines`.

		*pattern_factory* does not need to be set for :class:`GitIgnoreSpec`. If
		set, it should be either ``"gitignore"`` or :class:`.GitIgnoreSpecPattern`.
		There is no guarantee it will work with any other pattern class. Default is
		:data:`None` for :class:`.GitIgnoreSpecPattern`.

		*backend* (:class:`str` or :data:`None`) is the pattern (regular expression)
		matching backend to use. Default is :data:`None` for "best" to use the best
		available backend. Priority of backends is: "re2", "hyperscan", "simple".
		The "simple" backend is always available.

		Returns the :class:`GitIgnoreSpec` instance.
		N	gitignorezpattern_factory=z (resolved to z) cannot be z) because it will give unexpected results.r*   )r"   strbytescallabler   r   r   type
issubclassr   	TypeErrorr#   r7   )r-   r1   r/   r+   r,   use_factoryr&   r'   s          r(   r7   zGitIgnoreSpec.from_lines^   s   < e%% 3% 3l?>[>[ 3!?E? %;;+%% &;;/3'' !00;; ; k4  +455 
    &  
 
  
		KWl		m	m$	+r)   namer   patternsSequence[Pattern]r   c                "    t          | |          S )aM  
		.. warning:: This method is not part of the public API. It is subject to
			change.

		Create the backend for the patterns.

		*name* (:class:`str`) is the name of the backend.

		*patterns* (:class:`~collections.abc.Sequence` of :class:`.Pattern`)
		contains the compiled patterns.

		Returns the backend (:class:`._Backend`).
		r   )rC   rD   s     r(   _make_backendzGitIgnoreSpec._make_backend   s    & 
 h	/	//r)   )r   r   r   r    )r-   r.   r/   r0   r1   r2   r+   r3   r,   r   r   r   r5   )r-   r.   r1   r2   r/   r0   r+   r3   r,   r   r   r   )rC   r   rD   rE   r   r   )__name__
__module____qualname____doc__r$   r   classmethodr7   r   staticmethodrG   __classcell__)r'   s   @r(   r   r   1   sH               1537     + (  SW
 1537     + (  SW7
 15377 7 7 7 7 7 7 + (7r 0 0 0 , (0 0 0 0 0r)   N)#rK   
__future__r   collections.abcr   r   typingr   r   r   r	   r
   r   pathspec.backendr   r   r   pathspec._backends.aggr   pathspec.pathspecr   pathspec.patternr   !pathspec.patterns.gitignore.basicr    pathspec.patterns.gitignore.specr   pathspec._typingr   r   pathspec.utilr   r   r   r   r6   r)   r(   <module>rZ      s    # " " " " "                                         
 
 
 
 
 
                         wv_---{0 {0 {0 {0 {0H12 {0 {0 {0 {0 {0r)   