
    W-Ph~                         d Z ddlZddlZddlZddlmZmZmZmZm	Z
mZmZmZmZ  G d de          Z G d de          Z ej                     G d d	e                      ZdS )
z8
This module provides the base definition for patterns.
    N)	AnyAnyStrIterableIteratorMatchOptionalPatternTupleUnionc                   v    e Zd ZdZdZdee         ddfdZdee	         de
e	         fdZd	e	dee         fd
ZdS )r	   zG
	The :class:`Pattern` class is the abstract definition of a pattern.
	includer   returnNc                     || _         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     P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pathspec/pattern.py__init__zPattern.__init__   s     $,     filesc              #      K   t          j        d                    | j                  t          d           |D ]}|                     |          |V  dS )a  
		DEPRECATED: This method is no longer used and has been replaced by
		:meth:`.match_file`. Use the :meth:`.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 (e.g., ``"relative/path/to/file"``).

		Returns an :class:`~collections.abc.Iterable` yielding each matched file
		path (:class:`str`).
		z{cls.__module__}.{cls.__qualname__}.match() is deprecated. Use {cls.__module__}.{cls.__qualname__}.match_file() with a loop for similar results.cls   )
stacklevelN)warningswarnformat	__class__DeprecationWarning
match_file)r   r   files      r   matchzPattern.match.   sy       - Ft~F 2q	B B B B   d
ood'
JJJ r   r!   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().r   )NotImplementedErrorr   r   )r   r!   s     r   r    zPattern.match_fileF   s*     	D
Ft~F	  	   r   )__name__
__module____qualname____doc__	__slots__r   boolr   r   strr   r"   r   r     r   r   r	   r	      s         
Xd^       (3-    0
 C 
 HSM 
  
  
  
  
  
 r   r	   c                        e Zd ZdZdZ	 ddeeedf         dee	         ddf fdZ
dd de	fd	Zd
eded         fdZededeee	f         fd            Z xZS )RegexPatternza
	The :class:`RegexPattern` class is an implementation of a pattern using
	regular expressions.
	)patternregexNr/   r   r   c                    t          |t          t          f          rB|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.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   r/   r0   )r   r/   r   r0   r   s       r   r   zRegexPattern.__init___   s   & #u&& Q
//MwMMWMMM // ))'22>5' JuEww88 55 //IwIIWIII ///
 
OgOOO	P	PPd$$W---3:$,
 "$* r   otherc                 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.
		)r2   r.   r   r0   NotImplemented)r   r:   s     r   __eq__zRegexPattern.__eq__   s9     |$$ 
,%-
'
EDJ%+,EE
r   r!   RegexMatchResultc                 j    | j         +| j                            |          }|t          |          S dS )a  
		Matches this pattern against the specified file.

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

		Returns the match result (:class:`.RegexMatchResult`) if *file* matched;
		otherwise, :data:`None`.
		N)r   r0   r"   r>   )r   r!   r"   s      r   r    zRegexPattern.match_file   s:     
\:D!!5E"""	r   c                 
    |dfS )a  
		Convert the pattern into an uncompiled regular expression.

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

		Returns the uncompiled regular expression (:class:`str` or :data:`None`),
		and 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   r/   s     r   r4   zRegexPattern.pattern_to_regex   s     
$r   )N)r%   r&   r'   r(   r)   r   r   PatternHintr   r*   r   r=   r+   r    classmethodr
   r4   __classcell__)r   s   @r   r.   r.   S   s         !7 7d*+7 D>7 	7 7 7 7 7 7r	 	D 	 	 	 	C H-?$@    " C E#t),<    +    r   r.   c                   "    e Zd ZU dZdZeed<   dS )r>   zq
	The :class:`RegexMatchResult` data class is used to return information about
	the matched regular expression.
	)r"   r"   N)r%   r&   r'   r(   r)   	MatchHint__annotations__r,   r   r   r>   r>      s5           	 r   r>   )r(   dataclassesr5   r   typingr   r   r   r   r   rE   r   r	   rA   r
   r   objectr.   	dataclassr>   r,   r   r   <module>rK      sG        				 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	<  <  <  <  < f <  <  < ~p p p p p7 p p pf     v     r   