Files
intellecton/venv/lib/python3.12/site-packages/pathspec/__pycache__/pattern.cpython-312.pyc
T

125 lines
8.4 KiB
Plaintext
Raw Normal View History

Ë
JÀjeãóЗdZddlmZddlZddlmZmZddlmZddl m
Z
m Z m Z m
Z
ddlmZmZmZe d d
¬ «Z Gd „d
e«ZGd„d
e«Ze«Gd„de««Zy)z8
This module provides the base definition for patterns.
é)Ú annotationsN)ÚIterableÚIterator)Ú dataclass)ÚAnyÚOptionalÚTypeVarÚUnioné)ÚAnyStrÚ
deprecatedÚoverrideÚRegexPatternSelfÚ RegexPattern)ÚboundcóB—eZdZdZdZdd„Zed«d d„«Zd
d„Zy) Ú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)Úselfrs úS/home/antigravity/intellecton/venv/lib/python3.12/site-packages/pathspec/pattern.pyÚ__init__zPattern.__init__'s€ð€$„,ðózXPattern.match() is deprecated. Use Pattern.match_file() with a loop for similar results.c#óFK—|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.match7s+èø€ð$ò€dØ
‡o�o�dÓÑ'Ø
ƒJñùs‚!š!cóL—tdj|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__)rrs rrzPattern.match_fileMs$€ô ØDß
�Fˆt�~‰~€FÓó ð rN)rúOptional[bool]ÚreturnÚNone)rz
Iterable[str]r&z
Iterator[str])rÚstrr&z
Optional[Any]) Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú __slots__rr
rr©rrrrs6„ñð
€óñ 
ðóòó ðô$
 rrc󂇗eZdZdZdZ d
d ˆfd„
Zd d„Zd d„Zd
d„Zdd„Z e
dd„«Z e dd „«Z
ˆxZS)rza
The :class:`RegexPattern` class is an implementation of a pattern using
regular expressions.
)ÚpatternÚregexcóv•—d}t|ttf«rL|�Jd|›d|›d�«‚|j|«\}}|�X|€Jd|›d|›d�«‚t j
|«}n2|�t
|d«r|}n!|€|�Jd|›d|›d �«‚td
|›d �«‚tt|�+|«||_ ||_ 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.
Nzinclude=z must be null when pattern=z
is a string.z
raw_regex=z must be non-null when include=z
is not None.rz is null.zpattern=z& is not a string, re.Pattern, or None.)
Ú
isinstancer(ÚbytesÚpattern_to_regexÚreÚcompileÚhasattrÚ TypeErrorÚsuperrrr0r1)rr0rr1Ú raw_regexr$s €rrzRegexPattern.__init__fsø€ð$!%€%Ü�œ#œ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=€$„,ðð
&+€$„*ðrcóh—|jj›d|j›d|j›d�S)z;
Returns a debug representation of this regex pattern.
z (pattern=z
, include=ú))r$r)r0r©rs rÚ__repr__zRegexPattern.__repr__£s3€ð
�N‰N× #Ñ #Ð $ I¨d¯l©lÐ-=¸ZÈÏ É ÐGWÐWXÐ YÐYrcó4—t|jxsd«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(r0r>s rÚ__str__zRegexPattern.__str__©s€ô
ˆT�\‰\Ò
˜RÓ Ð rcót—|j|j|j«}|j|_|S)zZ
Performa a shallow copy of the pattern.
Returns the copy (:class:`RegexPattern`).
)r$r1rr0©rÚothers rÚ__copy__zRegexPattern.__copy__²s,€ð �.‰.˜Ÿ™ T§\¡\Ó
2€%Ø—,‘,€%„-Ø €,rcó–—t|t«r4|j|jk(xr|j|jk(StS)z¯
Tests the equality of this regex pattern with *other* (:class:`RegexPattern`)
by comparing their :attr:`~Pattern.include` and :attr:`~RegexPattern.regex`
attributes.
)r3rrr1ÚNotImplementedrDs rÚ__eq__zRegexPattern.__eq__¼s9€ô �”|Ô$Ø
�,‰,˜%Ÿ-™-Ñ
'Ò
E¨D¯J©J¸%¿+¹+Ñ,EÐEä
Ðrcó\—|jx}�|j|«x}� t|«Sy)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)rrr1rs rrzRegexPattern.match_fileÇs5€ð�Z‰ZЀEÐ$Ø—‘˜dÓ#Ð#ˆÐ0ä
˜5Ó
!Ð!à
rcó
—|dfS)aF
Convert the pattern into an uncompiled regular expression.