Ë
    hKê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"y)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.
	c                óp   •— t        |t        «      rt        ‰| �  |«      S t        |t        «      ry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)ÚselfÚotherÚ	__class__s     €úW/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pathspec/gitignore.pyr    zGitIgnoreSpec.__eq__8   s1   ø€ ô �”}Ô%Ü
‰'‰.˜Ó
ÐÜ�%œÔ"Ø
ä
Ðó    N©ÚbackendÚ_test_backend_factoryc                ó   — y ©N© )ÚclsÚpattern_factoryÚlinesr(   r)   s        r%   Ú
from_lineszGitIgnoreSpec.from_linesF   ó   € ð r&   c                ó   — y r+   r,   )r-   r/   r.   r(   r)   s        r%   r0   zGitIgnoreSpec.from_linesR   r1   r&   c          	     óf  •— t        |t        t        f«      st        |«      rt	        |«      r||}}|€t
        }n*|dk(  rt
        }nt        |t        «      rt        |«      }n|}t        |t        «      r)t        |t        «      rt        d|›d|› dt        › d�«      ‚t        ‰| �1  ||||¬«      }|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.
		Ú	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   r0   )r-   r/   r.   r(   r)   Úuse_factoryr"   r$   s          €r%   r0   zGitIgnoreSpec.from_lines^   sÆ   ø€ ô< �œœe˜Ô%¬°%¬¼lÈ?Ô>[à! ?�E€?ð ÐÜ%�;Ø˜+Ò%ô &�;Ü�/¤3Ô'Ü Ó0�;à €;ô ˆkœ4Ô Ü�+Ô4Ô5ä	Ø�Ð)¨¸°}ð EÜ&Ð'ð (ðó
ð ô 
‰Ñ	˜K¨¸ÐWlÐ	Ó	m€$Ø	€+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   )ÚnameÚpatternss     r%   Ú_make_backendzGitIgnoreSpec._make_backend™   s   € ô& 
   hÓ	/Ð/r&   )r#   ÚobjectÚreturnÚbool)r-   ú
type[Self]r.   ú<Union[str, type[Pattern], Callable[[AnyStr], Pattern], None]r/   úIterable[AnyStr]r(   ú"Union[BackendNamesHint, str, None]r)   r   rA   r   r+   )r-   rC   r/   rE   r.   rD   r(   rF   r)   r   rA   r   )r=   r   r>   zSequence[Pattern]rA   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r    r   Úclassmethodr0   r   Ústaticmethodr?   Ú__classcell__)r$   s   @r%   r   r   1   sr  ø„ ñõð Øð 15Ø37ñØðàOðð 
ðð
 .ðð 1ðð òó ó ðð Øð SWðð
 15Ø37ñØðà	ðð Pðð
 .ðð 1ðð òó ó ðð Øð SWð7ð
 15Ø37ñ7Øð7à	ð7ð Pð7ð
 .ð7ð 1ð7ð ô7ó ó ð7ðr Øð0Øð0àð0ð ò0ó ó ô0r&   N)#rJ   Ú
__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   r,   r&   r%   ú<module>rY      sr   ðñõ #÷÷÷ ÷ñ õõõ
õõ÷÷ñ ˆv˜_Ô-€ðô{0�HÐ1Ñ2õ {0r&   