
    mi'                        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     h/var/www/html/bestrading.cuttalo.com/scripts/kaggle-env/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                  l     e Zd ZdZdZ	 dd f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                   t          |t          t          f          rB|J d|d|d            |                     |          \  }}|t	          j        |          }n@|t          |d          r|}n+||J d|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   r3   r4   )r   r3   r   r4   r+   s       r   r   zRegexPattern.__init__f   s    & #u&& Q
//MwMMWMMM // ))'22>5' JuEww88 55 //IwIIWIII // 55 
OgOOO	P	PPd$$W---29$,
 &+$* 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   rA   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   NotImplementedr@   s     r   __eq__zRegexPattern.__eq__   s9     |$$ 
,%-
'
EDJ%+,EE
r   r#   r   Optional[RegexMatchResult]c                j    | j         +| j                            |          }|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)r   r4   searchRegexMatchResult)r   r#   r$   s      r   r"   zRegexPattern.match_file   s:     
\:T""5E"""	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    . 
$r   )N)r3   r5   r   r   r   r   )r   r   r   r   )rA   r   r   rC   )r#   r   r   rG   )r3   r   r   rK   )r,   r-   r.   r/   r0   r   rB   rF   r   r"   classmethodr9   __classcell__)r+   s   @r   r   r   Z   s          !9 9 9 9 9 9 9v   	 	 	 	    ("    +    r   c                  "    e Zd ZU dZdZded<   dS )rJ   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   rJ   rJ      s2            r   rJ   )r/   
__future__r   r:   collections.abcr   r   dataclassesr   typingr   r   r	   r
   _typingr   r   r   r   objectr   r   rJ   r1   r   r   <module>rW      s    # " " " " " 				                                
 7-^DDD 
:  :  :  :  : f :  :  : zE E E E E7 E E EP     v     r   