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

Ë
jeãóÐdZddlmZddlZddlmZmZddlmZddl m
Z
m Z m Z m
Z
ddlmZmZmZe d d
¬ «Z Gd d
e«ZGdd
e«Ze«Gdde««Zy)z8
This module provides the base definition for patterns.
é)Ú annotationsN)ÚIterableÚIterator)Ú dataclass)ÚAnyÚOptionalÚTypeVarÚUnioné)ÚAnyStrÚ
deprecatedÚoverrideÚRegexPatternSelfÚ RegexPattern)ÚboundcóBeZdZdZdZddZed«d d«Zd
dZy) ÚPatternzG
The :class:`Pattern` class is the abstract definition of a pattern.
©Úincludecó||_y)
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Ø
‡ooÑ
ƒJñùs!š!cóLtdj|j¬««)
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$ô Ø
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 dZd dZd
dZddZ e
dd«Z e dd „«Z
ˆxZS)rza
The :class:`RegexPattern` class is an implementation of a pattern using
regular expressions.
)ÚpatternÚregexcóvd}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Ó€9ˆgðÐØ Ð ðØˆ €~Ð5¨W¨L¸
ÐÐ ô
J‰J !Мw w°Ô ð ˆ/ðØ€w€lÐ. g \°Ðˆ
hg\Ð!GÐHÓ IÐŒ $ -à6=€$„,ðð
&+€$„*ðrcóh|jjd|jd|jdS)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Ð-=¸Ï É ÐGWÐWXÐ YÐYrcó4t|jxsd«S)
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)
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Ð
Ð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ÓÐ
˜

rcó
|dfS)aF
Convert the pattern into an uncompiled regular expression.