diff --git a/stdlib/2/re.pyi b/stdlib/2/re.pyi index 110e194af..2a2c2cb03 100644 --- a/stdlib/2/re.pyi +++ b/stdlib/2/re.pyi @@ -6,7 +6,7 @@ from typing import ( List, Iterator, overload, Callable, Tuple, Sequence, Dict, - Generic, AnyStr, Match, Pattern, Any, Union + Generic, AnyStr, Match, Pattern, Any, Optional, Union ) # ----- re variables and constants ----- @@ -34,14 +34,14 @@ def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ... def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ... @overload -def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr]: ... +def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload -def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Match[AnyStr]: ... +def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload -def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr]: ... +def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload -def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Match[AnyStr]: ... +def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload def split(pattern: Union[str, unicode], string: AnyStr, diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 957b32083..a8803e6bb 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -388,9 +388,9 @@ class Pattern(Generic[AnyStr]): pattern = ... # type: AnyStr def search(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Match[AnyStr]: ... + endpos: int = ...) -> Optional[Match[AnyStr]]: ... def match(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Match[AnyStr]: ... + endpos: int = ...) -> Optional[Match[AnyStr]]: ... def split(self, string: AnyStr, maxsplit: int = ...) -> list[AnyStr]: ... def findall(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> list[Any]: ... diff --git a/stdlib/3/re.pyi b/stdlib/3/re.pyi index 451774f1e..942f9bf6b 100644 --- a/stdlib/3/re.pyi +++ b/stdlib/3/re.pyi @@ -79,14 +79,14 @@ def compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]: ... def compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... @overload -def search(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr]: ... +def search(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload -def search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr]: ... +def search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload -def match(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr]: ... +def match(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload -def match(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr]: ... +def match(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... # New in Python 3.4 @overload diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index e21528f41..4c17b5c7a 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -498,9 +498,9 @@ class Pattern(Generic[AnyStr]): pattern = ... # type: AnyStr def search(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Match[AnyStr]: ... + endpos: int = ...) -> Optional[Match[AnyStr]]: ... def match(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Match[AnyStr]: ... + endpos: int = ...) -> Optional[Match[AnyStr]]: ... # New in Python 3.4 def fullmatch(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ...