mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 22:11:54 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, AnyStr, Callable, Iterator, List, Match, Optional, Pattern, Tuple, Union, overload
|
||||
from typing import Any, AnyStr, Callable, Iterator, List, Match, Pattern, Tuple, overload
|
||||
|
||||
# ----- re variables and constants -----
|
||||
DEBUG: int
|
||||
@@ -24,65 +24,59 @@ def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ...
|
||||
@overload
|
||||
def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ...
|
||||
@overload
|
||||
def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
|
||||
def search(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
|
||||
def search(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
|
||||
def match(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
|
||||
def match(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def split(pattern: Union[str, unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
|
||||
def split(pattern: str | unicode, string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
|
||||
@overload
|
||||
def split(
|
||||
pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, maxsplit: int = ..., flags: int = ...
|
||||
) -> List[AnyStr]: ...
|
||||
def split(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
|
||||
@overload
|
||||
def findall(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> List[Any]: ...
|
||||
def findall(pattern: str | unicode, string: AnyStr, flags: int = ...) -> List[Any]: ...
|
||||
@overload
|
||||
def findall(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> List[Any]: ...
|
||||
def findall(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> List[Any]: ...
|
||||
|
||||
# Return an iterator yielding match objects over all non-overlapping matches
|
||||
# for the RE pattern in string. The string is scanned left-to-right, and
|
||||
# matches are returned in the order found. Empty matches are included in the
|
||||
# result unless they touch the beginning of another match.
|
||||
@overload
|
||||
def finditer(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
|
||||
def finditer(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
|
||||
@overload
|
||||
def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
|
||||
def finditer(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
|
||||
@overload
|
||||
def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
|
||||
def sub(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
|
||||
@overload
|
||||
def sub(
|
||||
pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
|
||||
pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
|
||||
) -> AnyStr: ...
|
||||
@overload
|
||||
def sub(
|
||||
pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
|
||||
) -> AnyStr: ...
|
||||
def sub(pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
|
||||
@overload
|
||||
def sub(
|
||||
pattern: Union[Pattern[str], Pattern[unicode]],
|
||||
pattern: Pattern[str] | Pattern[unicode],
|
||||
repl: Callable[[Match[AnyStr]], AnyStr],
|
||||
string: AnyStr,
|
||||
count: int = ...,
|
||||
flags: int = ...,
|
||||
) -> AnyStr: ...
|
||||
@overload
|
||||
def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(
|
||||
pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
|
||||
pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
|
||||
) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(
|
||||
pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
|
||||
pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
|
||||
) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(
|
||||
pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
|
||||
) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(
|
||||
pattern: Union[Pattern[str], Pattern[unicode]],
|
||||
pattern: Pattern[str] | Pattern[unicode],
|
||||
repl: Callable[[Match[AnyStr]], AnyStr],
|
||||
string: AnyStr,
|
||||
count: int = ...,
|
||||
@@ -90,4 +84,4 @@ def subn(
|
||||
) -> Tuple[AnyStr, int]: ...
|
||||
def escape(string: AnyStr) -> AnyStr: ...
|
||||
def purge() -> None: ...
|
||||
def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: int = ...) -> Pattern[AnyStr]: ...
|
||||
def template(pattern: AnyStr | Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ...
|
||||
|
||||
Reference in New Issue
Block a user