o
    `۷i5                     @   s<   d Z ddlZddlmZ G dd deZG dd deZdS )	z8
This module provides the base definition for patterns.
    N   )unicodec                   @   s$   e Zd ZdZdZdd Zdd ZdS )PatternzG
	The :class:`Pattern` class is the abstract definition of a pattern.
	includec                 C   s
   || _ 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    r   ^/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/_private/thirdparty/pathspec/pattern.py__init__   s   	zPattern.__init__c                 C   s   t d| jj| jj)a3  
		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{}.{} must override match().)NotImplementedErrorformat	__class__
__module____name__)r   filesr   r   r	   match#   s   
zPattern.matchN)r   r   __qualname____doc__	__slots__r
   r   r   r   r   r	   r      s
    r   c                       sB   e Zd ZdZdZd fdd	Zdd Zdd	 Zed
d Z	  Z
S )RegexPatternza
	The :class:`RegexPattern` class is an implementation of a pattern
	using regular expressions.
	)regexNc                    s   d| _ 	 t|ttfr(|du sJ d||| |\}}|dur't|}n$|dur4t|dr4|}n|du rE|du sDJ d||nt	d|t
t| | || _ dS )a>  
		Initializes the :class:`RegexPattern` instance.

		*pattern* (:class:`unicode`, :class:`bytes`, :class:`re.RegexObject`,
		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.RegexObject`)
		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.
		Nz8include:{!r} must be null when pattern:{!r} is a string.r   z4include:{!r} must be null when pattern:{!r} is null.z3pattern:{!r} is not a string, RegexObject, or None.)r   
isinstancer   bytesr   pattern_to_regexrecompilehasattr	TypeErrorsuperr   r
   )r   patternr   r   r   r   r	   r
   9   s   

zRegexPattern.__init__c                 C   s&   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.
		)r   r   r   r   NotImplemented)r   otherr   r   r	   __eq__i   s   
zRegexPattern.__eq__c                 c   s4    | j dur|D ]}| j|dur|V  qdS dS )a/  
		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`).
		N)r   r   r   )r   r   pathr   r   r	   r   t   s   

zRegexPattern.matchc                 C   s   |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   )clsr   r   r   r	   r      s   zRegexPattern.pattern_to_regex)N)r   r   r   r   r   r
   r#   r   classmethodr   __classcell__r   r   r    r	   r   0   s    0r   )r   r   compatr   objectr   r   r   r   r   r	   <module>   s
   %