Make more miscellaneous fields read-only, annotate _json.make_encoder (#7439)

This commit is contained in:
Alex Waygood
2022-03-06 23:41:49 +00:00
committed by GitHub
parent 6cdecae6f9
commit bc72b25a2a
7 changed files with 63 additions and 31 deletions

View File

@@ -1049,15 +1049,21 @@ class ByteString(Sequence[int], metaclass=ABCMeta): ...
@_final
class Match(Generic[AnyStr]):
pos: int
endpos: int
lastindex: int | None
lastgroup: str | None
string: AnyStr
@property
def pos(self) -> int: ...
@property
def endpos(self) -> int: ...
@property
def lastindex(self) -> int | None: ...
@property
def lastgroup(self) -> str | None: ...
@property
def string(self) -> AnyStr: ...
# The regular expression object whose match() or search() method produced
# this match instance.
re: Pattern[AnyStr]
@property
def re(self) -> Pattern[AnyStr]: ...
def expand(self, template: AnyStr) -> AnyStr: ...
# group() returns "AnyStr" or "AnyStr | None", depending on the pattern.
@overload
@@ -1095,10 +1101,14 @@ class Match(Generic[AnyStr]):
@_final
class Pattern(Generic[AnyStr]):
flags: int
groupindex: Mapping[str, int]
groups: int
pattern: AnyStr
@property
def flags(self) -> int: ...
@property
def groupindex(self) -> Mapping[str, int]: ...
@property
def groups(self) -> int: ...
@property
def pattern(self) -> AnyStr: ...
def search(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ...
def match(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ...
def fullmatch(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ...