Ë
    hKêje  ã                  óÐ   — d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZmZmZ ddlmZmZmZ  ed	d
¬«      Z	  G d„ de«      Z G d„ d
e«      Z e«        G d„ de«      «       Zy)z8
This module provides the base definition for patterns.
é    )ÚannotationsN)ÚIterableÚIterator)Ú	dataclass)ÚAnyÚOptionalÚTypeVarÚUnioné   )ÚAnyStrÚ
deprecatedÚoverrideÚRegexPatternSelfÚRegexPattern)Úboundc                  óB   — e Zd ZdZdZdd„Z ed«      d	d„«       Zd
d„Zy)ÚPatternzG
	The :class:`Pattern` class is the abstract definition of a pattern.
	©Úincludec                ó   — || _         y)zâ
		Initializes the :class:`Pattern` instance.

		*include* (:class:`bool` or :data:`None`) is whether the matched files
		should be included (:data:`True`), excluded (:data:`False`), or is a
		null-operation (:data:`None`).
		Nr   )Úselfr   s     úU/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/pathspec/pattern.pyÚ__init__zPattern.__init__'   s   € ð €$„,ðó    zXPattern.match() is deprecated. Use Pattern.match_file() with a loop for similar results.c              #  óF   K  — |D ]  }| j                  |«      €Œ|–— Œ y­w)a´  
		.. version-deprecated:: 0.10.0
			This method is no longer used. Use the :meth:`self.match_file <.Pattern.match_file>`
			method with a loop for similar results.

		Matches this pattern against the specified files.

		*files* (:class:`~collections.abc.Iterable` of :class:`str`) contains each
		file relative to the root directory.

		Returns an :class:`~collections.abc.Iterable` yielding each matched file
		path (:class:`str`).
		N)Ú
match_file)r   ÚfilesÚfiles      r   ÚmatchzPattern.match7   s+   è ø€ ð$ ò €dØ
‡o�o�dÓÑ'Ø
ƒJñùs   ‚!š!c                óL   — t        dj                  | j                  ¬«      «      ‚)zÅ
		Matches this pattern against the specified file.

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

		Returns the match result if *file* matched; otherwise, :data:`None`.
		z?{cls.__module__}.{cls.__qualname__} must override match_file().)Úcls)ÚNotImplementedErrorÚformatÚ	__class__)r   r   s     r   r   zPattern.match_fileM   s$   € ô 	ØDß
�Fˆt�~‰~€FÓó	 ð  r   N)r   úOptional[bool]ÚreturnÚNone)r   zIterable[str]r&   zIterator[str])r   Ústrr&   zOptional[Any])	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   © r   r   r   r      s6   „ ñð
€óñ  ðóòó	ðô$
 r   r   c                  ó‚   ‡ — e Zd ZdZdZ	 d
	 	 	 	 	 dˆ fd„Zdd„Zdd„Zdd„Zdd„Z	e
dd„«       Ze	 	 	 	 dd	„«       Zˆ xZS )r   za
	The :class:`RegexPattern` class is an implementation of a pattern using
	regular expressions.
	)ÚpatternÚregexc                óv  •— d}t        |t        t        f«      rL|�J d|›d|›d�«       ‚| j                  |«      \  }}|�X|€J d|›d|›d�«       ‚t	        j
                  |«      }n2|�t        |d«      r|}n!|€|�J d|›d|›d	�«       ‚t        d
|›d�«      ‚t        t        | �+  |«       || _        	 || _        y)a(  
		Initializes the :class:`RegexPattern` instance.

		*pattern* (:class:`str`, :class:`bytes`, :class:`re.Pattern`, or
		:data:`None`) is the pattern to compile into a regular expression.

		*include* (:class:`bool` or :data:`None`) must be :data:`None` unless
		*pattern* is a precompiled regular expression (:class:`re.Pattern`) in which
		case it is whether matched files should be included (:data:`True`), excluded
		(:data:`False`), or is a null operation (:data:`None`).

			.. note:: Subclasses do not need to support the *include* parameter.
		Nzinclude=z must be null when pattern=z is a string.z
raw_regex=z must be non-null when include=z is not None.r   z	 is null.zpattern=z& is not a string, re.Pattern, or None.)Ú
isinstancer(   ÚbytesÚpattern_to_regexÚreÚcompileÚhasattrÚ	TypeErrorÚsuperr   r   r0   r1   )r   r0   r   r1   Ú	raw_regexr$   s        €r   r   zRegexPattern.__init__f   s  ø€ ð$ !%€%Ü�œ#œu˜Ô&Ø
ˆ/ð Ø€w€lÐ. g \°Ð?óˆ/ð ×-Ñ-¨gÓ6Ñ€9ˆgð ÐØÐ ð Øˆ	€~Ð5¨W¨L¸ÐFóÐ ô �J‰J�yÓ!�EàÐœw w°Ô8ð �5à€ð ˆ/ð Ø€w€lÐ. g \°Ð;óˆ/ô
 
�h�g�\Ð!GÐHÓ	IÐIäŒ�dÑ$ WÔ-à6=€$„,ðð
 &+€$„*ðr   c                óh   — | j                   j                  › d| j                  ›d| j                  ›d�S )z;
		Returns a debug representation of this regex pattern.
		z	(pattern=z
, include=ú))r$   r)   r0   r   ©r   s    r   Ú__repr__zRegexPattern.__repr__£   s3   € ð �N‰N×#Ñ#Ð$ I¨d¯l©lÐ-=¸ZÈÏÉÐGWÐWXÐ	YÐYr   c                ó4   — t        | j                  xs d«      S )zÎ
		Returns a string representation of this regex pattern. Equivalent to uncompiled pattern.

		The string representation is the uncompiled pattern if it is not
		:data:`None`; otherwise, an empty string.
		Ú )r(   r0   r>   s    r   Ú__str__zRegexPattern.__str__©   s   € ô 
ˆT�\‰\Ò˜RÓ	 Ð r   c                ót   — | j                  | j                  | j                  «      }| j                  |_        |S )zZ
		Performa a shallow copy of the pattern.

		Returns the copy (:class:`RegexPattern`).
		)r$   r1   r   r0   ©r   Úothers     r   Ú__copy__zRegexPattern.__copy__²   s,   € ð �.‰.˜Ÿ™ T§\¡\Ó
2€%Ø—,‘,€%„-Ø	€,r   c                ó–   — t        |t        «      r4| j                  |j                  k(  xr | j                  |j                  k(  S t        S )z¯
		Tests the equality of this regex pattern with *other* (:class:`RegexPattern`)
		by comparing their :attr:`~Pattern.include` and :attr:`~RegexPattern.regex`
		attributes.
		)r3   r   r   r1   ÚNotImplementedrD   s     r   Ú__eq__zRegexPattern.__eq__¼   s9   € ô �”|Ô$Ø
�,‰,˜%Ÿ-™-Ñ
'Ò
E¨D¯J©J¸%¿+¹+Ñ,EÐEä
Ðr   c                ó\   — | j                   x}�|j                  |«      x}�t        |«      S y)a  
		Matches this pattern against the specified file.

		*file* (:class:`str` or :class:`bytes`) is the file path relative to the
		root directory (e.g., "relative/path/to/file").

		Returns the match result (:class:`.RegexMatchResult`) if *file* matched;
		otherwise, :data:`None`.
		N)r1   ÚsearchÚRegexMatchResult)r   r   r1   r   s       r   r   zRegexPattern.match_fileÇ   s5   € ð �Z‰ZÐ€EÐ$Ø—‘˜dÓ#Ð#ˆÐ0ä
˜5Ó
!Ð!à	r   c                ó
   — |dfS )aF  
		Convert the pattern into an uncompiled regular expression.

		*pattern* (:class:`str` or :class:`bytes`) is the pattern to convert into a
		regular expression.

		Returns a :class:`tuple` containing:

			-	*pattern* (:class:`str`, :class:`bytes` or :data:`None`) is the
				uncompiled regular expression .

			-	*include* (:class:`bool` or :data:`None`) is whether matched files
				should be included (:data:`True`), excluded (:data:`False`), or is a
				null-operation (:data:`None`).

			.. note:: The default implementation simply returns *pattern* and
			   :data:`True`.
		Tr.   )r!   r0   s     r   r5   zRegexPattern.pattern_to_regexÚ   s   € ð. �4ˆÐr   )N)r0   zUnion[AnyStr, re.Pattern, None]r   r%   r&   r'   )r&   r(   )r   r   r&   r   )rE   Úobjectr&   Úbool)r   r   r&   zOptional[RegexMatchResult])r0   r   r&   z'tuple[Optional[AnyStr], Optional[bool]])r)   r*   r+   r,   r-   r   r?   rB   rF   rI   r   r   Úclassmethodr5   Ú__classcell__)r$   s   @r   r   r   Z   s…   ø„ ñð€ð !ð;à*ð;ð ð;ð õ	;ózZó!óó	ð òó ðð$ ðàðð .òó ôr   c                  ó    — e Zd ZU dZdZded<   y)rL   zq
	The :class:`RegexMatchResult` data class is used to return information about
	the matched regular expression.
	)r   zre.Matchr   N)r)   r*   r+   r,   r-   Ú__annotations__r.   r   r   rL   rL   ô   s   … ñð€ð 	ƒðr   rL   )r,   Ú
__future__r   r6   Úcollections.abcr   r   Údataclassesr   Útypingr   r   r	   r
   Ú_typingr   r   r   r   rN   r   r   rL   r.   r   r   ú<module>rY      s~   ðñõ #ã 	÷õ÷ó ÷ñ ñ
 Ð-°^ÔDÐ ðô
: ˆfô : ôzW�7ô Wñt ƒô�vó ó ñr   