
    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dS )z8
This module provides the base definition for patterns.
    )annotationsN)IterableIterator)	dataclass)AnyOptionalTypeVarUnion   )AnyStr
deprecatedoverrideRegexPatternSelfRegexPattern)boundc                  P    e Zd ZdZdZddZ ed          dd            ZddZdS )PatternzG
	The :class:`Pattern` class is the abstract definition of a pattern.
	includer   Optional[bool]returnNonec                    || _         dS )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     Z/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/pathspec/pattern.py__init__zPattern.__init__'   s     $,     zXPattern.match() is deprecated. Use Pattern.match_file() with a loop for similar results.filesIterable[str]Iterator[str]c              #  F   K   |D ]}|                      |          |V  dS )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   r   files      r   matchzPattern.match7   s=      $   d
ood'
JJJ r   r#   strOptional[Any]c                R    t          d                    | 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
Ft~F	  	   r   N)r   r   r   r   )r   r   r   r    )r#   r%   r   r&   )	__name__
__module____qualname____doc__	__slots__r   r   r$   r"    r   r   r   r      s         
     *   	 $
  
  
  
  
  
 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regexNr3   Union[AnyStr, re.Pattern, None]r   r   r   r   c                   d}t          |t          t          f          rU|J d|d|d            |                     |          \  }}|'|J d|d|d            t	          j        |          }n>|t          |d          r|}n)||J d|d|d	            nt          d
|d          t          t          |           
                    |           || _        	 || _        dS )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   r3   r4   )r   r3   r   r4   	raw_regexr+   s        r   r   zRegexPattern.__init__f   sK   $ !%%#u&& J
//?w??g??? // --g669g   F	FFWFFF !   Jy!!Eww88 55 //;w;;g;;; ///
 
HgHHH	I	IId$$W---6=$,
 &+$* r   r%   c                @    | j         j         d| j        d| j        dS )z;
		Returns a debug representation of this regex pattern.
		z	(pattern=z
, include=))r+   r,   r3   r   r   s    r   __repr__zRegexPattern.__repr__   s,     N#	Y	Ydl	Y	Y	Y	Y	YYr   c                .    t          | j        p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%   r3   rB   s    r   __str__zRegexPattern.__str__   s     
T\R	 	  r   r   r   c                ^    |                      | j        | j                  }| j        |_        |S )zZ
		Performa a shallow copy of the pattern.

		Returns the copy (:class:`RegexPattern`).
		)r+   r4   r   r3   r   others     r   __copy__zRegexPattern.__copy__   s)     ..T\
2
2%,%-	,r   rI   objectboolc                z    t          |t                    r | j        |j        k    o| 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.
		)r7   r   r   r4   NotImplementedrH   s     r   __eq__zRegexPattern.__eq__   s9     |$$ 
,%-
'
EDJ%+,EE
r   r#   r   Optional[RegexMatchResult]c                d    | j         x}&|                    |          x}t          |          S dS )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)r4   searchRegexMatchResult)r   r#   r4   r$   s       r   r"   zRegexPattern.match_file   s;     ZE$d###0
5
!
!!	r   'tuple[Optional[AnyStr], Optional[bool]]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`.
		Tr1   )r(   r3   s     r   r9   zRegexPattern.pattern_to_regex   s    . 4r   )N)r3   r5   r   r   r   r   )r   r%   )r   r   r   r   )rI   rK   r   rL   )r#   r   r   rP   )r3   r   r   rT   )r,   r-   r.   r/   r0   r   rC   rF   rJ   rO   r   r"   classmethodr9   __classcell__)r+   s   @r   r   r   Z   s          !; ; ; ; ; ; ;zZ Z Z Z! ! ! !   	 	 	 	    ($    +    r   c                  "    e Zd ZU dZdZded<   dS )rS   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/   r0   __annotations__r1   r   r   rS   rS      s2            r   rS   )r/   
__future__r   r:   collections.abcr   r   dataclassesr   typingr   r   r	   r
   _typingr   r   r   r   rK   r   r   rS   r1   r   r   <module>r_      s    # " " " " " 				                                
 7-^DDD 
:  :  :  :  : f :  :  : zW W W W W7 W W Wt     v     r   