From c3641ccc649abeba3b86f9760b82f51d66fd2a5c Mon Sep 17 00:00:00 2001 From: jpy-git Date: Sat, 1 Jan 2022 20:46:58 +0000 Subject: [PATCH] Python2: fix groupindex and lastgroup for re --- stdlib/@python2/typing.pyi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stdlib/@python2/typing.pyi b/stdlib/@python2/typing.pyi index a1b02e81990c..e707fc71e855 100644 --- a/stdlib/@python2/typing.pyi +++ b/stdlib/@python2/typing.pyi @@ -395,8 +395,7 @@ class Match(Generic[AnyStr]): # string. re: Pattern[Any] # Can be None if there are no groups or if the last group was unnamed; - # otherwise matches the type of the pattern. - lastgroup: Any | None + lastgroup: str | None def expand(self, template: str | Text) -> Any: ... @overload def group(self, group1: int = ...) -> AnyStr: ... @@ -422,7 +421,7 @@ _AnyStr2 = TypeVar("_AnyStr2", bytes, Text) class Pattern(Generic[AnyStr]): flags: int - groupindex: Dict[AnyStr, int] + groupindex: Mapping[str, int] groups: int pattern: AnyStr def search(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Match[_AnyStr2] | None: ...