mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-01 12:56:51 +08:00
Fix return type of re.match, re.search (#1886)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]]: ...
|
||||
|
||||
Reference in New Issue
Block a user