Add Match.regs (#2819)

This commit is contained in:
Ville Skyttä
2019-08-11 06:21:54 +03:00
committed by Jelle Zijlstra
parent 679e1a9a8c
commit 1edd6cd8a8
3 changed files with 6 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ class SRE_Match(object):
def groups(self) -> Tuple[Optional[str], ...]: ...
def span(self) -> Tuple[int, int]:
raise IndexError()
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
class SRE_Scanner(object):
pattern: str

View File

@@ -404,6 +404,8 @@ class Match(Generic[AnyStr]):
def start(self, group: Union[int, str] = ...) -> int: ...
def end(self, group: Union[int, str] = ...) -> int: ...
def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
# We need a second TypeVar with the same definition as AnyStr, because
# Pattern is generic over AnyStr (determining the type of its .pattern

View File

@@ -545,6 +545,8 @@ class Match(Generic[AnyStr]):
def start(self, group: Union[int, str] = ...) -> int: ...
def end(self, group: Union[int, str] = ...) -> int: ...
def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
if sys.version_info >= (3, 6):
def __getitem__(self, g: Union[int, str]) -> AnyStr: ...