diff --git a/stdlib/@python2/BaseHTTPServer.pyi b/stdlib/@python2/BaseHTTPServer.pyi index 46946aa37c46..9aad705bde6c 100644 --- a/stdlib/@python2/BaseHTTPServer.pyi +++ b/stdlib/@python2/BaseHTTPServer.pyi @@ -1,14 +1,14 @@ import mimetools import SocketServer -from typing import Any, BinaryIO, Callable, Mapping, Tuple +from typing import Any, BinaryIO, Callable, Mapping class HTTPServer(SocketServer.TCPServer): server_name: str server_port: int - def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ... + def __init__(self, server_address: tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ... class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): - client_address: Tuple[str, int] + client_address: tuple[str, int] server: SocketServer.BaseServer close_connection: bool command: str @@ -23,8 +23,8 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): error_content_type: str protocol_version: str MessageClass: type - responses: Mapping[int, Tuple[str, str]] - def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ... + responses: Mapping[int, tuple[str, str]] + def __init__(self, request: bytes, client_address: tuple[str, int], server: SocketServer.BaseServer) -> None: ... def handle(self) -> None: ... def handle_one_request(self) -> None: ... def send_error(self, code: int, message: str | None = ...) -> None: ... diff --git a/stdlib/@python2/CGIHTTPServer.pyi b/stdlib/@python2/CGIHTTPServer.pyi index 393dcb83217f..cc08bc02d666 100644 --- a/stdlib/@python2/CGIHTTPServer.pyi +++ b/stdlib/@python2/CGIHTTPServer.pyi @@ -1,6 +1,5 @@ import SimpleHTTPServer -from typing import List class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): - cgi_directories: List[str] + cgi_directories: list[str] def do_POST(self) -> None: ... diff --git a/stdlib/@python2/ConfigParser.pyi b/stdlib/@python2/ConfigParser.pyi index 89167b3e7ec8..d8bd0c6e7104 100644 --- a/stdlib/@python2/ConfigParser.pyi +++ b/stdlib/@python2/ConfigParser.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsNoArgReadline -from typing import IO, Any, Dict, List, Sequence, Tuple +from typing import IO, Any, Sequence DEFAULTSECT: str MAX_INTERPOLATION_DEPTH: int @@ -42,7 +42,7 @@ class InterpolationDepthError(InterpolationError): class ParsingError(Error): filename: str - errors: List[Tuple[Any, Any]] + errors: list[tuple[Any, Any]] def __init__(self, filename: str) -> None: ... def append(self, lineno: Any, line: Any) -> None: ... @@ -53,26 +53,26 @@ class MissingSectionHeaderError(ParsingError): class RawConfigParser: _dict: Any - _sections: Dict[Any, Any] - _defaults: Dict[Any, Any] + _sections: dict[Any, Any] + _defaults: dict[Any, Any] _optcre: Any SECTCRE: Any OPTCRE: Any OPTCRE_NV: Any - def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ... - def defaults(self) -> Dict[Any, Any]: ... - def sections(self) -> List[str]: ... + def __init__(self, defaults: dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ... + def defaults(self) -> dict[Any, Any]: ... + def sections(self) -> list[str]: ... def add_section(self, section: str) -> None: ... def has_section(self, section: str) -> bool: ... - def options(self, section: str) -> List[str]: ... - def read(self, filenames: str | Sequence[str]) -> List[str]: ... + def options(self, section: str) -> list[str]: ... + def read(self, filenames: str | Sequence[str]) -> list[str]: ... def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ... def get(self, section: str, option: str) -> str: ... - def items(self, section: str) -> List[Tuple[Any, Any]]: ... + def items(self, section: str) -> list[tuple[Any, Any]]: ... def _get(self, section: str, conv: type, option: str) -> Any: ... def getint(self, section: str, option: str) -> int: ... def getfloat(self, section: str, option: str) -> float: ... - _boolean_states: Dict[str, bool] + _boolean_states: dict[str, bool] def getboolean(self, section: str, option: str) -> bool: ... def optionxform(self, optionstr: str) -> str: ... def has_option(self, section: str, option: str) -> bool: ... @@ -84,8 +84,8 @@ class RawConfigParser: class ConfigParser(RawConfigParser): _KEYCRE: Any - def get(self, section: str, option: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> Any: ... - def items(self, section: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> List[Tuple[str, Any]]: ... + def get(self, section: str, option: str, raw: bool = ..., vars: dict[Any, Any] | None = ...) -> Any: ... + def items(self, section: str, raw: bool = ..., vars: dict[Any, Any] | None = ...) -> list[tuple[str, Any]]: ... def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ... def _interpolation_replace(self, match: Any) -> str: ... @@ -93,5 +93,5 @@ class SafeConfigParser(ConfigParser): _interpvar_re: Any def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ... def _interpolate_some( - self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int + self, option: str, accum: list[Any], rest: str, section: str, map: dict[Any, Any], depth: int ) -> None: ... diff --git a/stdlib/@python2/Cookie.pyi b/stdlib/@python2/Cookie.pyi index 3d01c3c66152..dcc27a2d349d 100644 --- a/stdlib/@python2/Cookie.pyi +++ b/stdlib/@python2/Cookie.pyi @@ -1,8 +1,8 @@ -from typing import Any, Dict +from typing import Any class CookieError(Exception): ... -class Morsel(Dict[Any, Any]): +class Morsel(dict[Any, Any]): key: Any def __init__(self): ... def __setitem__(self, K, V): ... @@ -14,7 +14,7 @@ class Morsel(Dict[Any, Any]): def js_output(self, attrs: Any | None = ...): ... def OutputString(self, attrs: Any | None = ...): ... -class BaseCookie(Dict[Any, Any]): +class BaseCookie(dict[Any, Any]): def value_decode(self, val): ... def value_encode(self, val): ... def __init__(self, input: Any | None = ...): ... diff --git a/stdlib/@python2/HTMLParser.pyi b/stdlib/@python2/HTMLParser.pyi index ebc2735e9c48..755f0d058b15 100644 --- a/stdlib/@python2/HTMLParser.pyi +++ b/stdlib/@python2/HTMLParser.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, List, Tuple +from typing import AnyStr from markupbase import ParserBase @@ -10,8 +10,8 @@ class HTMLParser(ParserBase): def get_starttag_text(self) -> AnyStr: ... def set_cdata_mode(self, AnyStr) -> None: ... def clear_cdata_mode(self) -> None: ... - def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... - def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... + def handle_startendtag(self, tag: AnyStr, attrs: list[tuple[AnyStr, AnyStr]]): ... + def handle_starttag(self, tag: AnyStr, attrs: list[tuple[AnyStr, AnyStr]]): ... def handle_endtag(self, tag: AnyStr): ... def handle_charref(self, name: AnyStr): ... def handle_entityref(self, name: AnyStr): ... diff --git a/stdlib/@python2/Queue.pyi b/stdlib/@python2/Queue.pyi index 24743a80280d..a53380723188 100644 --- a/stdlib/@python2/Queue.pyi +++ b/stdlib/@python2/Queue.pyi @@ -1,4 +1,5 @@ -from typing import Any, Deque, Generic, TypeVar +from collections import deque +from typing import Any, Generic, TypeVar _T = TypeVar("_T") @@ -12,7 +13,7 @@ class Queue(Generic[_T]): not_full: Any all_tasks_done: Any unfinished_tasks: Any - queue: Deque[Any] # undocumented + queue: deque[Any] # undocumented def __init__(self, maxsize: int = ...) -> None: ... def task_done(self) -> None: ... def join(self) -> None: ... diff --git a/stdlib/@python2/SocketServer.pyi b/stdlib/@python2/SocketServer.pyi index e5a19ffd5e68..809066516b00 100644 --- a/stdlib/@python2/SocketServer.pyi +++ b/stdlib/@python2/SocketServer.pyi @@ -1,11 +1,11 @@ import sys from socket import SocketType -from typing import Any, BinaryIO, Callable, ClassVar, List, Text, Tuple, Union +from typing import Any, BinaryIO, Callable, ClassVar, Text, Union class BaseServer: address_family: int RequestHandlerClass: Callable[..., BaseRequestHandler] - server_address: Tuple[str, int] + server_address: tuple[str, int] socket: SocketType allow_reuse_address: bool request_queue_size: int @@ -17,19 +17,19 @@ class BaseServer: def serve_forever(self, poll_interval: float = ...) -> None: ... def shutdown(self) -> None: ... def server_close(self) -> None: ... - def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - def get_request(self) -> Tuple[SocketType, Tuple[str, int]]: ... - def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ... + def finish_request(self, request: bytes, client_address: tuple[str, int]) -> None: ... + def get_request(self) -> tuple[SocketType, tuple[str, int]]: ... + def handle_error(self, request: bytes, client_address: tuple[str, int]) -> None: ... def handle_timeout(self) -> None: ... - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... + def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ... def server_activate(self) -> None: ... def server_bind(self) -> None: ... - def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ... + def verify_request(self, request: bytes, client_address: tuple[str, int]) -> bool: ... class TCPServer(BaseServer): def __init__( self, - server_address: Tuple[str, int], + server_address: tuple[str, int], RequestHandlerClass: Callable[..., BaseRequestHandler], bind_and_activate: bool = ..., ) -> None: ... @@ -37,7 +37,7 @@ class TCPServer(BaseServer): class UDPServer(BaseServer): def __init__( self, - server_address: Tuple[str, int], + server_address: tuple[str, int], RequestHandlerClass: Callable[..., BaseRequestHandler], bind_and_activate: bool = ..., ) -> None: ... @@ -61,16 +61,16 @@ if sys.platform != "win32": if sys.platform != "win32": class ForkingMixIn: timeout: float | None # undocumented - active_children: List[int] | None # undocumented + active_children: list[int] | None # undocumented max_children: int # undocumented def collect_children(self) -> None: ... # undocumented def handle_timeout(self) -> None: ... # undocumented - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... + def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ... class ThreadingMixIn: daemon_threads: bool - def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... + def process_request_thread(self, request: bytes, client_address: tuple[str, int]) -> None: ... # undocumented + def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ... if sys.platform != "win32": class ForkingTCPServer(ForkingMixIn, TCPServer): ... diff --git a/stdlib/@python2/StringIO.pyi b/stdlib/@python2/StringIO.pyi index efa90f8e0330..4aa0cb3fcd5a 100644 --- a/stdlib/@python2/StringIO.pyi +++ b/stdlib/@python2/StringIO.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List +from typing import IO, Any, AnyStr, Generic, Iterable, Iterator class StringIO(IO[AnyStr], Generic[AnyStr]): closed: bool @@ -14,7 +14,7 @@ class StringIO(IO[AnyStr], Generic[AnyStr]): def tell(self) -> int: ... def read(self, n: int = ...) -> AnyStr: ... def readline(self, length: int = ...) -> AnyStr: ... - def readlines(self, sizehint: int = ...) -> List[AnyStr]: ... + def readlines(self, sizehint: int = ...) -> list[AnyStr]: ... def truncate(self, size: int | None = ...) -> int: ... def write(self, s: AnyStr) -> int: ... def writelines(self, iterable: Iterable[AnyStr]) -> None: ... diff --git a/stdlib/@python2/UserDict.pyi b/stdlib/@python2/UserDict.pyi index dce7bebafd66..fd21ff0e684b 100644 --- a/stdlib/@python2/UserDict.pyi +++ b/stdlib/@python2/UserDict.pyi @@ -1,11 +1,11 @@ -from typing import Any, Container, Dict, Generic, Iterable, Iterator, List, Mapping, Sized, Tuple, TypeVar, overload +from typing import Any, Container, Generic, Iterable, Iterator, Mapping, Sized, TypeVar, overload _KT = TypeVar("_KT") _VT = TypeVar("_VT") _T = TypeVar("_T") -class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]): - data: Dict[_KT, _VT] +class UserDict(dict[_KT, _VT], Generic[_KT, _VT]): + data: dict[_KT, _VT] def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ... # TODO: __iter__ is not available for UserDict @@ -21,18 +21,18 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): def get(self, k: _KT) -> _VT | None: ... @overload def get(self, k: _KT, default: _VT | _T) -> _VT | _T: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... + def values(self) -> list[_VT]: ... + def items(self) -> list[tuple[_KT, _VT]]: ... def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ... def __contains__(self, o: Any) -> bool: ... # From typing.MutableMapping[_KT, _VT] def clear(self) -> None: ... def pop(self, k: _KT, default: _VT = ...) -> _VT: ... - def popitem(self) -> Tuple[_KT, _VT]: ... + def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ... @overload def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def update(self, m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... diff --git a/stdlib/@python2/UserList.pyi b/stdlib/@python2/UserList.pyi index 4dfc738a8f2a..36a4bc6a001c 100644 --- a/stdlib/@python2/UserList.pyi +++ b/stdlib/@python2/UserList.pyi @@ -1,10 +1,10 @@ from _typeshed import Self -from typing import Iterable, List, MutableSequence, TypeVar, overload +from typing import Iterable, MutableSequence, TypeVar, overload _T = TypeVar("_T") class UserList(MutableSequence[_T]): - data: List[_T] + data: list[_T] def insert(self, index: int, object: _T) -> None: ... @overload def __setitem__(self, i: int, o: _T) -> None: ... diff --git a/stdlib/@python2/UserString.pyi b/stdlib/@python2/UserString.pyi index 123c1cb43f79..be802a9e2c72 100644 --- a/stdlib/@python2/UserString.pyi +++ b/stdlib/@python2/UserString.pyi @@ -1,5 +1,5 @@ from _typeshed import Self -from typing import Any, Iterable, List, MutableSequence, Sequence, Text, Tuple, TypeVar, overload +from typing import Any, Iterable, MutableSequence, Sequence, Text, TypeVar, overload _MST = TypeVar("_MST", bound=MutableString) @@ -26,7 +26,7 @@ class UserString(Sequence[UserString]): def count(self, sub: int, start: int = ..., end: int = ...) -> int: ... def decode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ... def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ... - def endswith(self, suffix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... + def endswith(self, suffix: Text | tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... def expandtabs(self: Self, tabsize: int = ...) -> Self: ... def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ... def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ... @@ -43,17 +43,17 @@ class UserString(Sequence[UserString]): def ljust(self: Self, width: int, *args: Any) -> Self: ... def lower(self: Self) -> Self: ... def lstrip(self: Self, chars: Text | None = ...) -> Self: ... - def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ... + def partition(self, sep: Text) -> tuple[Text, Text, Text]: ... def replace(self: Self, old: Text, new: Text, maxsplit: int = ...) -> Self: ... def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ... def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ... def rjust(self: Self, width: int, *args: Any) -> Self: ... - def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ... + def rpartition(self, sep: Text) -> tuple[Text, Text, Text]: ... def rstrip(self: Self, chars: Text | None = ...) -> Self: ... - def split(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ... - def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ... - def splitlines(self, keepends: int = ...) -> List[Text]: ... - def startswith(self, prefix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... + def split(self, sep: Text | None = ..., maxsplit: int = ...) -> list[Text]: ... + def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> list[Text]: ... + def splitlines(self, keepends: int = ...) -> list[Text]: ... + def startswith(self, prefix: Text | tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... def strip(self: Self, chars: Text | None = ...) -> Self: ... def swapcase(self: Self) -> Self: ... def title(self: Self) -> Self: ... diff --git a/stdlib/@python2/__builtin__.pyi b/stdlib/@python2/__builtin__.pyi index f1a25140675f..331ef05a855e 100644 --- a/stdlib/@python2/__builtin__.pyi +++ b/stdlib/@python2/__builtin__.pyi @@ -13,14 +13,11 @@ from typing import ( ByteString, Callable, Container, - Dict, - FrozenSet, Generic, ItemsView, Iterable, Iterator, KeysView, - List, Mapping, MutableMapping, MutableSequence, @@ -29,15 +26,12 @@ from typing import ( Protocol, Reversible, Sequence, - Set, Sized, SupportsAbs, SupportsComplex, SupportsFloat, SupportsInt, Text, - Tuple, - Type, TypeVar, ValuesView, overload, @@ -64,12 +58,12 @@ _TT = TypeVar("_TT", bound=type) class object: __doc__: str | None - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __module__: str @property - def __class__(self: _T) -> Type[_T]: ... + def __class__(self: _T) -> type[_T]: ... @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... # noqa: F811 + def __class__(self, __type: type[object]) -> None: ... # noqa: F811 def __init__(self) -> None: ... def __new__(cls) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... @@ -82,46 +76,46 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ... + def __reduce__(self) -> str | tuple[Any, ...]: ... + def __reduce_ex__(self, protocol: int) -> str | tuple[Any, ...]: ... class staticmethod(object): # Special, only valid as a decorator. __func__: Callable[..., Any] def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... + def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ... + def __get__(self, obj: _T, type: type[_T] | None = ...) -> Callable[..., Any]: ... class classmethod(object): # Special, only valid as a decorator. __func__: Callable[..., Any] def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... + def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ... + def __get__(self, obj: _T, type: type[_T] | None = ...) -> Callable[..., Any]: ... class type(object): __base__: type - __bases__: Tuple[type, ...] + __bases__: tuple[type, ...] __basicsize__: int - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __dictoffset__: int __flags__: int __itemsize__: int __module__: str - __mro__: Tuple[type, ...] + __mro__: tuple[type, ...] __name__: str __weakrefoffset__: int @overload def __init__(self, o: object) -> None: ... @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ... + def __init__(self, name: str, bases: tuple[type, ...], dict: dict[str, Any]) -> None: ... @overload def __new__(cls, o: object) -> type: ... @overload - def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ... + def __new__(cls, name: str, bases: tuple[type, ...], namespace: dict[str, Any]) -> type: ... def __call__(self, *args: Any, **kwds: Any) -> Any: ... - def __subclasses__(self: _TT) -> List[_TT]: ... + def __subclasses__(self: _TT) -> list[_TT]: ... # Note: the documentation doesn't specify what the return type is, the standard # implementation seems to be returning a list. - def mro(self) -> List[type]: ... + def mro(self) -> list[type]: ... def __instancecheck__(self, instance: Any) -> bool: ... def __subclasscheck__(self, subclass: type) -> bool: ... @@ -133,9 +127,9 @@ class super(object): class int: @overload - def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... + def __new__(cls: type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... @overload - def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... + def __new__(cls: type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... @property def real(self) -> int: ... @property @@ -153,7 +147,7 @@ class int: def __div__(self, x: int) -> int: ... def __truediv__(self, x: int) -> float: ... def __mod__(self, x: int) -> int: ... - def __divmod__(self, x: int) -> Tuple[int, int]: ... + def __divmod__(self, x: int) -> tuple[int, int]: ... def __radd__(self, x: int) -> int: ... def __rsub__(self, x: int) -> int: ... def __rmul__(self, x: int) -> int: ... @@ -161,7 +155,7 @@ class int: def __rdiv__(self, x: int) -> int: ... def __rtruediv__(self, x: int) -> float: ... def __rmod__(self, x: int) -> int: ... - def __rdivmod__(self, x: int) -> Tuple[int, int]: ... + def __rdivmod__(self, x: int) -> tuple[int, int]: ... @overload def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ... @overload @@ -181,7 +175,7 @@ class int: def __pos__(self) -> int: ... def __invert__(self) -> int: ... def __trunc__(self) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... + def __getnewargs__(self) -> tuple[int]: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: int) -> bool: ... @@ -197,8 +191,8 @@ class int: def __index__(self) -> int: ... class float: - def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... + def __new__(cls: type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... + def as_integer_ratio(self) -> tuple[int, int]: ... def hex(self) -> str: ... def is_integer(self) -> bool: ... @classmethod @@ -215,7 +209,7 @@ class float: def __div__(self, x: float) -> float: ... def __truediv__(self, x: float) -> float: ... def __mod__(self, x: float) -> float: ... - def __divmod__(self, x: float) -> Tuple[float, float]: ... + def __divmod__(self, x: float) -> tuple[float, float]: ... def __pow__( self, x: float, mod: None = ... ) -> float: ... # In Python 3, returns complex if self is negative and x is not whole @@ -226,9 +220,9 @@ class float: def __rdiv__(self, x: float) -> float: ... def __rtruediv__(self, x: float) -> float: ... def __rmod__(self, x: float) -> float: ... - def __rdivmod__(self, x: float) -> Tuple[float, float]: ... + def __rdivmod__(self, x: float) -> tuple[float, float]: ... def __rpow__(self, x: float, mod: None = ...) -> float: ... - def __getnewargs__(self) -> Tuple[float]: ... + def __getnewargs__(self) -> tuple[float]: ... def __trunc__(self) -> int: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... @@ -247,9 +241,9 @@ class float: class complex: @overload - def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ... + def __new__(cls: type[_T], real: float = ..., imag: float = ...) -> _T: ... @overload - def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... + def __new__(cls: type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... @property def real(self) -> float: ... @property @@ -291,7 +285,7 @@ class unicode(basestring, Sequence[unicode]): def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: unicode | tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> unicode: ... @@ -311,21 +305,21 @@ class unicode(basestring, Sequence[unicode]): def ljust(self, width: int, fillchar: unicode = ...) -> unicode: ... def lower(self) -> unicode: ... def lstrip(self, chars: unicode = ...) -> unicode: ... - def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def partition(self, sep: unicode) -> tuple[unicode, unicode, unicode]: ... def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ... def rfind(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... + def rpartition(self, sep: unicode) -> tuple[unicode, unicode, unicode]: ... + def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> list[unicode]: ... def rstrip(self, chars: unicode = ...) -> unicode: ... - def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> list[unicode]: ... + def splitlines(self, keepends: bool = ...) -> list[unicode]: ... + def startswith(self, __prefix: unicode | tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... - def translate(self, table: Dict[int, Any] | unicode) -> unicode: ... + def translate(self, table: dict[int, Any] | unicode) -> unicode: ... def upper(self) -> unicode: ... def zfill(self, width: int) -> unicode: ... @overload @@ -352,7 +346,7 @@ class unicode(basestring, Sequence[unicode]): def __int__(self) -> int: ... def __float__(self) -> float: ... def __hash__(self) -> int: ... - def __getnewargs__(self) -> Tuple[unicode]: ... + def __getnewargs__(self) -> tuple[unicode]: ... class _FormatMapMapping(Protocol): def __getitem__(self, __key: str) -> Any: ... @@ -364,7 +358,7 @@ class str(Sequence[str], basestring): def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: Text | tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> str: ... @@ -385,35 +379,35 @@ class str(Sequence[str], basestring): @overload def lstrip(self, __chars: unicode) -> unicode: ... @overload - def partition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... + def partition(self, __sep: bytearray) -> tuple[str, bytearray, str]: ... @overload - def partition(self, __sep: str) -> Tuple[str, str, str]: ... + def partition(self, __sep: str) -> tuple[str, str, str]: ... @overload - def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def partition(self, __sep: unicode) -> tuple[unicode, unicode, unicode]: ... def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ... def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def rjust(self, __width: int, __fillchar: str = ...) -> str: ... @overload - def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... + def rpartition(self, __sep: bytearray) -> tuple[str, bytearray, str]: ... @overload - def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... + def rpartition(self, __sep: str) -> tuple[str, str, str]: ... @overload - def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def rpartition(self, __sep: unicode) -> tuple[unicode, unicode, unicode]: ... @overload - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... + def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... @overload - def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... + def rsplit(self, sep: unicode, maxsplit: int = ...) -> list[unicode]: ... @overload def rstrip(self, __chars: str = ...) -> str: ... @overload def rstrip(self, __chars: unicode) -> unicode: ... @overload - def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... + def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... @overload - def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: unicode, maxsplit: int = ...) -> list[unicode]: ... + def splitlines(self, keepends: bool = ...) -> list[str]: ... + def startswith(self, __prefix: Text | tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... @overload def strip(self, __chars: str = ...) -> str: ... @overload @@ -441,7 +435,7 @@ class str(Sequence[str], basestring): def __repr__(self) -> str: ... def __rmul__(self, n: int) -> str: ... def __str__(self) -> str: ... - def __getnewargs__(self) -> Tuple[str]: ... + def __getnewargs__(self) -> tuple[str]: ... def __getslice__(self, start: int, stop: int) -> str: ... def __float__(self) -> float: ... def __int__(self) -> int: ... @@ -463,7 +457,7 @@ class bytearray(MutableSequence[int], ByteString): def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... def count(self, __sub: str) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: bytes | tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... def extend(self, iterable: str | Iterable[int]) -> None: ... def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... @@ -480,17 +474,17 @@ class bytearray(MutableSequence[int], ByteString): def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ... def lower(self) -> bytearray: ... def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... + def partition(self, __sep: bytes) -> tuple[bytearray, bytearray, bytearray]: ... def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ... def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... + def rpartition(self, __sep: bytes) -> tuple[bytearray, bytearray, bytearray]: ... + def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> list[bytearray]: ... def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... - def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> list[bytearray]: ... + def splitlines(self, keepends: bool = ...) -> list[bytearray]: ... + def startswith(self, __prefix: bytes | tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def strip(self, __bytes: bytes | None = ...) -> bytearray: ... def swapcase(self) -> bytearray: ... def title(self) -> bytearray: ... @@ -532,9 +526,9 @@ class bytearray(MutableSequence[int], ByteString): class memoryview(Sized, Container[str]): format: str itemsize: int - shape: Tuple[int, ...] | None - strides: Tuple[int, ...] | None - suboffsets: Tuple[int, ...] | None + shape: tuple[int, ...] | None + strides: tuple[int, ...] | None + suboffsets: tuple[int, ...] | None readonly: bool ndim: int def __init__(self, obj: ReadableBuffer) -> None: ... @@ -550,11 +544,11 @@ class memoryview(Sized, Container[str]): @overload def __setitem__(self, i: int, o: int) -> None: ... def tobytes(self) -> bytes: ... - def tolist(self) -> List[int]: ... + def tolist(self) -> list[int]: ... @final class bool(int): - def __new__(cls: Type[_T], __o: object = ...) -> _T: ... + def __new__(cls: type[_T], __o: object = ...) -> _T: ... @overload def __and__(self, x: bool) -> bool: ... @overload @@ -579,7 +573,7 @@ class bool(int): def __rxor__(self, x: bool) -> bool: ... @overload def __rxor__(self, x: int) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... + def __getnewargs__(self) -> tuple[int]: ... class slice(object): start: Any @@ -590,27 +584,27 @@ class slice(object): @overload def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ... __hash__: None # type: ignore - def indices(self, len: int) -> Tuple[int, int, int]: ... + def indices(self, len: int) -> tuple[int, int, int]: ... class tuple(Sequence[_T_co], Generic[_T_co]): - def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... + def __new__(cls: type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... def __len__(self) -> int: ... def __contains__(self, x: object) -> bool: ... @overload def __getitem__(self, x: int) -> _T_co: ... @overload - def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ... + def __getitem__(self, x: slice) -> tuple[_T_co, ...]: ... def __iter__(self) -> Iterator[_T_co]: ... - def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __le__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ... + def __lt__(self, x: tuple[_T_co, ...]) -> bool: ... + def __le__(self, x: tuple[_T_co, ...]) -> bool: ... + def __gt__(self, x: tuple[_T_co, ...]) -> bool: ... + def __ge__(self, x: tuple[_T_co, ...]) -> bool: ... @overload - def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ... + def __add__(self, x: tuple[_T_co, ...]) -> tuple[_T_co, ...]: ... @overload - def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ... - def __mul__(self, n: int) -> Tuple[_T_co, ...]: ... - def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ... + def __add__(self, x: tuple[Any, ...]) -> tuple[Any, ...]: ... + def __mul__(self, n: int) -> tuple[_T_co, ...]: ... + def __rmul__(self, n: int) -> tuple[_T_co, ...]: ... def count(self, __value: Any) -> int: ... def index(self, __value: Any) -> int: ... @@ -641,25 +635,25 @@ class list(MutableSequence[_T], Generic[_T]): @overload def __getitem__(self, i: int) -> _T: ... @overload - def __getitem__(self, s: slice) -> List[_T]: ... + def __getitem__(self, s: slice) -> list[_T]: ... @overload def __setitem__(self, i: int, o: _T) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_T]: ... + def __getslice__(self, start: int, stop: int) -> list[_T]: ... def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, x: List[_T]) -> List[_T]: ... + def __add__(self, x: list[_T]) -> list[_T]: ... def __iadd__(self: Self, x: Iterable[_T]) -> Self: ... - def __mul__(self, n: int) -> List[_T]: ... - def __rmul__(self, n: int) -> List[_T]: ... + def __mul__(self, n: int) -> list[_T]: ... + def __rmul__(self, n: int) -> list[_T]: ... def __contains__(self, o: object) -> bool: ... def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: List[_T]) -> bool: ... - def __ge__(self, x: List[_T]) -> bool: ... - def __lt__(self, x: List[_T]) -> bool: ... - def __le__(self, x: List[_T]) -> bool: ... + def __gt__(self, x: list[_T]) -> bool: ... + def __ge__(self, x: list[_T]) -> bool: ... + def __lt__(self, x: list[_T]) -> bool: ... + def __le__(self, x: list[_T]) -> bool: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): # NOTE: Keyword arguments are special. If they are used, _KT must include @@ -669,31 +663,31 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): @overload def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... + def __init__(self, iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __new__(cls: type[_T1], *args: Any, **kwargs: Any) -> _T1: ... def has_key(self, k: _KT) -> bool: ... def clear(self) -> None: ... - def copy(self) -> Dict[_KT, _VT]: ... - def popitem(self) -> Tuple[_KT, _VT]: ... + def copy(self) -> dict[_KT, _VT]: ... + def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... @overload def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def update(self, __m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... @overload def update(self, **kwargs: _VT) -> None: ... def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ... def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... def viewitems(self) -> ItemsView[_KT, _VT]: ... @classmethod @overload - def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... + def fromkeys(cls, __iterable: Iterable[_T]) -> dict[_T, Any]: ... @classmethod @overload - def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... + def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -706,39 +700,39 @@ class set(MutableSet[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ...) -> None: ... def add(self, element: _T) -> None: ... def clear(self) -> None: ... - def copy(self) -> Set[_T]: ... - def difference(self, *s: Iterable[Any]) -> Set[_T]: ... + def copy(self) -> set[_T]: ... + def difference(self, *s: Iterable[Any]) -> set[_T]: ... def difference_update(self, *s: Iterable[Any]) -> None: ... def discard(self, element: _T) -> None: ... - def intersection(self, *s: Iterable[Any]) -> Set[_T]: ... + def intersection(self, *s: Iterable[Any]) -> set[_T]: ... def intersection_update(self, *s: Iterable[Any]) -> None: ... def isdisjoint(self, s: Iterable[Any]) -> bool: ... def issubset(self, s: Iterable[Any]) -> bool: ... def issuperset(self, s: Iterable[Any]) -> bool: ... def pop(self) -> _T: ... def remove(self, element: _T) -> None: ... - def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ... + def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ... def symmetric_difference_update(self, s: Iterable[_T]) -> None: ... - def union(self, *s: Iterable[_T]) -> Set[_T]: ... + def union(self, *s: Iterable[_T]) -> set[_T]: ... def update(self, *s: Iterable[_T]) -> None: ... def __len__(self) -> int: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_T]: ... def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... + def __and__(self, s: AbstractSet[object]) -> set[_T]: ... + def __iand__(self, s: AbstractSet[object]) -> set[_T]: ... + def __or__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ior__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... @overload - def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... + def __sub__(self: set[str], s: AbstractSet[Text | None]) -> set[_T]: ... @overload - def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... + def __sub__(self, s: AbstractSet[_T | None]) -> set[_T]: ... @overload # type: ignore - def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... + def __isub__(self: set[str], s: AbstractSet[Text | None]) -> set[_T]: ... @overload - def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... + def __isub__(self, s: AbstractSet[_T | None]) -> set[_T]: ... + def __xor__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ixor__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... def __le__(self, s: AbstractSet[object]) -> bool: ... def __lt__(self, s: AbstractSet[object]) -> bool: ... def __ge__(self, s: AbstractSet[object]) -> bool: ... @@ -747,31 +741,31 @@ class set(MutableSet[_T], Generic[_T]): class frozenset(AbstractSet[_T_co], Generic[_T_co]): def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... - def copy(self) -> FrozenSet[_T_co]: ... - def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... + def copy(self) -> frozenset[_T_co]: ... + def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ... + def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ... def isdisjoint(self, s: Iterable[_T_co]) -> bool: ... def issubset(self, s: Iterable[object]) -> bool: ... def issuperset(self, s: Iterable[object]) -> bool: ... - def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... + def symmetric_difference(self, s: Iterable[_T_co]) -> frozenset[_T_co]: ... + def union(self, *s: Iterable[_T_co]) -> frozenset[_T_co]: ... def __len__(self) -> int: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... + def __and__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __or__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... + def __sub__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __xor__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... def __le__(self, s: AbstractSet[object]) -> bool: ... def __lt__(self, s: AbstractSet[object]) -> bool: ... def __ge__(self, s: AbstractSet[object]) -> bool: ... def __gt__(self, s: AbstractSet[object]) -> bool: ... -class enumerate(Iterator[Tuple[int, _T]], Generic[_T]): +class enumerate(Iterator[tuple[int, _T]], Generic[_T]): def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[int, _T]]: ... - def next(self) -> Tuple[int, _T]: ... + def __iter__(self) -> Iterator[tuple[int, _T]]: ... + def next(self) -> tuple[int, _T]: ... class xrange(Sized, Iterable[int], Reversible[int]): @overload @@ -821,29 +815,29 @@ def cmp(__x: Any, __y: Any) -> int: ... _N1 = TypeVar("_N1", bool, int, float, complex) -def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... +def coerce(__x: _N1, __y: _N1) -> tuple[_N1, _N1]: ... def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... def delattr(__obj: Any, __name: Text) -> None: ... -def dir(__o: object = ...) -> List[str]: ... +def dir(__o: object = ...) -> list[str]: ... _N2 = TypeVar("_N2", int, float) -def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ... +def divmod(__x: _N2, __y: _N2) -> tuple[_N2, _N2]: ... def eval( - __source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... + __source: Text | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... ) -> Any: ... -def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ... +def execfile(__filename: str, __globals: dict[str, Any] | None = ..., __locals: dict[str, Any] | None = ...) -> None: ... def exit(code: object = ...) -> NoReturn: ... @overload def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore @overload -def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore +def filter(__function: None, __iterable: tuple[_T | None, ...]) -> tuple[_T, ...]: ... # type: ignore @overload -def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore +def filter(__function: Callable[[_T], Any], __iterable: tuple[_T, ...]) -> tuple[_T, ...]: ... # type: ignore @overload -def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ... +def filter(__function: None, __iterable: Iterable[_T | None]) -> list[_T]: ... @overload -def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... +def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> list[_T]: ... def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode @overload def getattr(__o: Any, name: Text) -> Any: ... @@ -861,7 +855,7 @@ def getattr(__o: object, name: str, __default: list[Any]) -> Any | list[Any]: .. def getattr(__o: object, name: str, __default: dict[Any, Any]) -> Any | dict[Any, Any]: ... @overload def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ... -def globals() -> Dict[str, Any]: ... +def globals() -> dict[str, Any]: ... def hasattr(__obj: Any, __name: Text) -> bool: ... def hash(__obj: object) -> int: ... def hex(__number: int | _SupportsIndex) -> str: ... @@ -874,20 +868,20 @@ def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... @overload def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ... -def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... +def isinstance(__obj: object, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... +def issubclass(__cls: type, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... def len(__obj: Sized) -> int: ... -def locals() -> Dict[str, Any]: ... +def locals() -> dict[str, Any]: ... @overload -def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... +def map(__func: None, __iter1: Iterable[_T1]) -> list[_T1]: ... @overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... +def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[tuple[_T1, _T2]]: ... @overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... +def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> list[tuple[_T1, _T2, _T3]]: ... @overload def map( __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4]]: ... @overload def map( __func: None, @@ -896,7 +890,7 @@ def map( __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def map( __func: None, @@ -907,15 +901,15 @@ def map( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... +) -> list[tuple[Any, ...]]: ... @overload -def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... +def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> list[_S]: ... @overload -def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... +def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3, _T4], _S], @@ -923,7 +917,7 @@ def map( __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], @@ -932,7 +926,7 @@ def map( __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[..., _S], @@ -943,7 +937,7 @@ def map( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[_S]: ... +) -> list[_S]: ... @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload @@ -983,7 +977,7 @@ def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ... @overload def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ... def quit(code: object = ...) -> NoReturn: ... -def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811 +def range(__x: int, __y: int = ..., __step: int = ...) -> list[int]: ... # noqa: F811 def raw_input(__prompt: Any = ...) -> str: ... @overload def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ... @@ -1006,27 +1000,27 @@ def round(number: SupportsFloat, ndigits: int) -> float: ... def setattr(__obj: Any, __name: Text, __value: Any) -> None: ... def sorted( __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ... -) -> List[_T]: ... +) -> list[_T]: ... @overload def sum(__iterable: Iterable[_T]) -> _T | int: ... @overload def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... def unichr(__i: int) -> unicode: ... -def vars(__object: Any = ...) -> Dict[str, Any]: ... +def vars(__object: Any = ...) -> dict[str, Any]: ... @overload -def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... +def zip(__iter1: Iterable[_T1]) -> list[tuple[_T1]]: ... @overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... +def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[tuple[_T1, _T2]]: ... @overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... +def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> list[tuple[_T1, _T2, _T3]]: ... @overload def zip( __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4]]: ... @overload def zip( __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def zip( __iter1: Iterable[Any], @@ -1036,7 +1030,7 @@ def zip( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... +) -> list[tuple[Any, ...]]: ... def __import__( name: Text, globals: Mapping[str, Any] | None = ..., @@ -1064,13 +1058,13 @@ class buffer(Sized): def __mul__(self, x: int) -> str: ... class BaseException(object): - args: Tuple[Any, ...] + args: tuple[Any, ...] message: Any def __init__(self, *args: object) -> None: ... def __str__(self) -> str: ... def __repr__(self) -> str: ... def __getitem__(self, i: int) -> Any: ... - def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... + def __getslice__(self, start: int, stop: int) -> tuple[Any, ...]: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... @@ -1179,7 +1173,7 @@ class file(BinaryIO): def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... + def readlines(self, hint: int = ...) -> list[str]: ... def write(self, data: str) -> int: ... def writelines(self, data: Iterable[str]) -> None: ... def truncate(self, pos: int | None = ...) -> int: ... diff --git a/stdlib/@python2/__future__.pyi b/stdlib/@python2/__future__.pyi index 8f5ff06ac080..df05b0d7c2de 100644 --- a/stdlib/@python2/__future__.pyi +++ b/stdlib/@python2/__future__.pyi @@ -1,5 +1,4 @@ import sys -from typing import List class _Feature: def __init__(self, optionalRelease: sys._version_info, mandatoryRelease: sys._version_info, compiler_flag: int) -> None: ... @@ -14,4 +13,4 @@ nested_scopes: _Feature print_function: _Feature unicode_literals: _Feature with_statement: _Feature -all_feature_names: List[str] # undocumented +all_feature_names: list[str] # undocumented diff --git a/stdlib/@python2/_codecs.pyi b/stdlib/@python2/_codecs.pyi index 83601f6621bb..fa6922207c25 100644 --- a/stdlib/@python2/_codecs.pyi +++ b/stdlib/@python2/_codecs.pyi @@ -1,9 +1,9 @@ import codecs import sys -from typing import Any, Callable, Dict, Text, Tuple, Union +from typing import Any, Callable, Text, Union # For convenience: -_Handler = Callable[[Exception], Tuple[Text, int]] +_Handler = Callable[[Exception], tuple[Text, int]] _String = Union[bytes, str] _Errors = Union[str, Text, None] _Decodable = Union[bytes, Text] @@ -13,7 +13,7 @@ _Encodable = Union[bytes, Text] class _EncodingMap(object): def size(self) -> int: ... -_MapT = Union[Dict[int, int], _EncodingMap] +_MapT = Union[dict[int, int], _EncodingMap] def register(__search_function: Callable[[str], Any]) -> None: ... def register_error(__errors: str | Text, __handler: _Handler) -> None: ... @@ -22,45 +22,45 @@ def lookup_error(__name: str | Text) -> _Handler: ... def decode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ... def encode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ... def charmap_build(__map: Text) -> _MapT: ... -def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[Text, int]: ... -def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[bytes, int]: ... -def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ... -def escape_encode(__data: bytes, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def latin_1_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def raw_unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def readbuffer_encode(__data: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_16_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_16_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... +def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> tuple[Text, int]: ... +def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> tuple[Text, int]: ... +def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> tuple[bytes, int]: ... +def escape_decode(__data: _String, __errors: _Errors = ...) -> tuple[str, int]: ... +def escape_encode(__data: bytes, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> tuple[Text, int]: ... +def latin_1_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def raw_unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> tuple[Text, int]: ... +def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def readbuffer_encode(__data: _String, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> tuple[Text, int]: ... +def unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> tuple[Text, int]: ... +def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_16_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_16_be_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_16_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_16_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> tuple[bytes, int]: ... def utf_16_ex_decode( __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[Text, int, int]: ... -def utf_16_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_32_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_32_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... +) -> tuple[Text, int, int]: ... +def utf_16_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_16_le_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_32_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_32_be_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_32_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_32_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> tuple[bytes, int]: ... def utf_32_ex_decode( __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[Text, int, int]: ... -def utf_32_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_7_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_7_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_8_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... +) -> tuple[Text, int, int]: ... +def utf_32_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_32_le_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_7_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_7_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... +def utf_8_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... +def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... if sys.platform == "win32": - def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... - def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... + def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> tuple[Text, int]: ... + def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> tuple[bytes, int]: ... diff --git a/stdlib/@python2/_collections.pyi b/stdlib/@python2/_collections.pyi index 96412654802e..98509176d4e6 100644 --- a/stdlib/@python2/_collections.pyi +++ b/stdlib/@python2/_collections.pyi @@ -1,12 +1,12 @@ from _typeshed import Self -from typing import Any, Callable, Dict, Generic, Iterator, TypeVar +from typing import Any, Callable, Generic, Iterator, TypeVar _K = TypeVar("_K") _V = TypeVar("_V") _T = TypeVar("_T") _T2 = TypeVar("_T2") -class defaultdict(Dict[_K, _V]): +class defaultdict(dict[_K, _V]): default_factory: None def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ... def __missing__(self, key: _K) -> _V: ... diff --git a/stdlib/@python2/_csv.pyi b/stdlib/@python2/_csv.pyi index ebe44bab67d9..e01ccc19cb19 100644 --- a/stdlib/@python2/_csv.pyi +++ b/stdlib/@python2/_csv.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, Iterator, List, Protocol, Sequence, Text, Type, Union +from typing import Any, Iterable, Iterator, Protocol, Sequence, Text, Union QUOTE_ALL: int QUOTE_MINIMAL: int @@ -18,12 +18,12 @@ class Dialect: strict: int def __init__(self) -> None: ... -_DialectLike = Union[str, Dialect, Type[Dialect]] +_DialectLike = Union[str, Dialect, type[Dialect]] -class _reader(Iterator[List[str]]): +class _reader(Iterator[list[str]]): dialect: Dialect line_num: int - def next(self) -> List[str]: ... + def next(self) -> list[str]: ... class _writer: dialect: Dialect @@ -38,5 +38,5 @@ def reader(csvfile: Iterable[Text], dialect: _DialectLike = ..., **fmtparams: An def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ... def unregister_dialect(name: str) -> None: ... def get_dialect(name: str) -> Dialect: ... -def list_dialects() -> List[str]: ... +def list_dialects() -> list[str]: ... def field_size_limit(new_limit: int = ...) -> int: ... diff --git a/stdlib/@python2/_curses.pyi b/stdlib/@python2/_curses.pyi index 32c1f761ac9e..4b2941e74753 100644 --- a/stdlib/@python2/_curses.pyi +++ b/stdlib/@python2/_curses.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, BinaryIO, Tuple, Union, overload +from typing import IO, Any, BinaryIO, Union, overload _chtype = Union[str, bytes, int] @@ -263,7 +263,7 @@ def baudrate() -> int: ... def beep() -> None: ... def can_change_color() -> bool: ... def cbreak(__flag: bool = ...) -> None: ... -def color_content(__color_number: int) -> Tuple[int, int, int]: ... +def color_content(__color_number: int) -> tuple[int, int, int]: ... # Changed in Python 3.8.8 and 3.9.2 def color_pair(__color_number: int) -> int: ... @@ -278,8 +278,8 @@ def erasechar() -> bytes: ... def filter() -> None: ... def flash() -> None: ... def flushinp() -> None: ... -def getmouse() -> Tuple[int, int, int, int, int]: ... -def getsyx() -> Tuple[int, int]: ... +def getmouse() -> tuple[int, int, int, int, int]: ... +def getsyx() -> tuple[int, int]: ... def getwin(__file: BinaryIO) -> _CursesWindow: ... def halfdelay(__tenths: int) -> None: ... def has_colors() -> bool: ... @@ -297,7 +297,7 @@ def killchar() -> bytes: ... def longname() -> bytes: ... def meta(__yes: bool) -> None: ... def mouseinterval(__interval: int) -> None: ... -def mousemask(__newmask: int) -> Tuple[int, int]: ... +def mousemask(__newmask: int) -> tuple[int, int]: ... def napms(__ms: int) -> int: ... def newpad(__nlines: int, __ncols: int) -> _CursesWindow: ... def newwin(__nlines: int, __ncols: int, __begin_y: int = ..., __begin_x: int = ...) -> _CursesWindow: ... @@ -307,7 +307,7 @@ def noecho() -> None: ... def nonl() -> None: ... def noqiflush() -> None: ... def noraw() -> None: ... -def pair_content(__pair_number: int) -> Tuple[int, int]: ... +def pair_content(__pair_number: int) -> tuple[int, int]: ... def pair_number(__attr: int) -> int: ... def putp(__string: bytes) -> None: ... def qiflush(__flag: bool = ...) -> None: ... @@ -405,8 +405,8 @@ class _CursesWindow: def echochar(self, __ch: _chtype, __attr: int = ...) -> None: ... def enclose(self, __y: int, __x: int) -> bool: ... def erase(self) -> None: ... - def getbegyx(self) -> Tuple[int, int]: ... - def getbkgd(self) -> Tuple[int, int]: ... + def getbegyx(self) -> tuple[int, int]: ... + def getbkgd(self) -> tuple[int, int]: ... @overload def getch(self) -> int: ... @overload @@ -415,8 +415,8 @@ class _CursesWindow: def getkey(self) -> str: ... @overload def getkey(self, y: int, x: int) -> str: ... - def getmaxyx(self) -> Tuple[int, int]: ... - def getparyx(self) -> Tuple[int, int]: ... + def getmaxyx(self) -> tuple[int, int]: ... + def getparyx(self) -> tuple[int, int]: ... @overload def getstr(self) -> _chtype: ... @overload @@ -425,7 +425,7 @@ class _CursesWindow: def getstr(self, y: int, x: int) -> _chtype: ... @overload def getstr(self, y: int, x: int, n: int) -> _chtype: ... - def getyx(self) -> Tuple[int, int]: ... + def getyx(self) -> tuple[int, int]: ... @overload def hline(self, ch: _chtype, n: int) -> None: ... @overload diff --git a/stdlib/@python2/_dummy_threading.pyi b/stdlib/@python2/_dummy_threading.pyi index 48f5b6d6dda9..10fbc938f86d 100644 --- a/stdlib/@python2/_dummy_threading.pyi +++ b/stdlib/@python2/_dummy_threading.pyi @@ -1,18 +1,18 @@ from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type +from typing import Any, Callable, Iterable, Mapping, Optional, Text # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] -__all__: List[str] +__all__: list[str] def active_count() -> int: ... def activeCount() -> int: ... def current_thread() -> Thread: ... def currentThread() -> Thread: ... -def enumerate() -> List[Thread]: ... +def enumerate() -> list[Thread]: ... def settrace(func: _TF) -> None: ... def setprofile(func: _PF | None) -> None: ... def stack_size(size: int = ...) -> int: ... @@ -52,7 +52,7 @@ class Lock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -62,7 +62,7 @@ class _RLock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -73,7 +73,7 @@ class Condition: def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -85,7 +85,7 @@ class Condition: class Semaphore: def __init__(self, value: int = ...) -> None: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def __enter__(self, blocking: bool = ...) -> bool: ... diff --git a/stdlib/@python2/_functools.pyi b/stdlib/@python2/_functools.pyi index e68398238f9b..d695e76994c9 100644 --- a/stdlib/@python2/_functools.pyi +++ b/stdlib/@python2/_functools.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Iterable, Tuple, TypeVar, overload +from typing import Any, Callable, Iterable, TypeVar, overload _T = TypeVar("_T") _S = TypeVar("_S") @@ -10,7 +10,7 @@ def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T class partial(object): func: Callable[..., Any] - args: Tuple[Any, ...] - keywords: Dict[str, Any] + args: tuple[Any, ...] + keywords: dict[str, Any] def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/stdlib/@python2/_heapq.pyi b/stdlib/@python2/_heapq.pyi index 08a8add08e9a..a2a38dc9c3ed 100644 --- a/stdlib/@python2/_heapq.pyi +++ b/stdlib/@python2/_heapq.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, Iterable, List, TypeVar +from typing import Any, Callable, Iterable, TypeVar _T = TypeVar("_T") -def heapify(__heap: List[Any]) -> None: ... -def heappop(__heap: List[_T]) -> _T: ... -def heappush(__heap: List[_T], __item: _T) -> None: ... -def heappushpop(__heap: List[_T], __item: _T) -> _T: ... -def heapreplace(__heap: List[_T], __item: _T) -> _T: ... -def nlargest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ... -def nsmallest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ... +def heapify(__heap: list[Any]) -> None: ... +def heappop(__heap: list[_T]) -> _T: ... +def heappush(__heap: list[_T], __item: _T) -> None: ... +def heappushpop(__heap: list[_T], __item: _T) -> _T: ... +def heapreplace(__heap: list[_T], __item: _T) -> _T: ... +def nlargest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> list[_T]: ... +def nsmallest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> list[_T]: ... diff --git a/stdlib/@python2/_hotshot.pyi b/stdlib/@python2/_hotshot.pyi index b048f6fb83d5..aa188a2b4fae 100644 --- a/stdlib/@python2/_hotshot.pyi +++ b/stdlib/@python2/_hotshot.pyi @@ -1,9 +1,9 @@ -from typing import Any, Tuple +from typing import Any def coverage(a: str) -> Any: ... def logreader(a: str) -> LogReaderType: ... def profiler(a: str, *args, **kwargs) -> Any: ... -def resolution() -> Tuple[Any, ...]: ... +def resolution() -> tuple[Any, ...]: ... class LogReaderType(object): def close(self) -> None: ... diff --git a/stdlib/@python2/_io.pyi b/stdlib/@python2/_io.pyi index 6abcac8be1f5..3c1eab23b854 100644 --- a/stdlib/@python2/_io.pyi +++ b/stdlib/@python2/_io.pyi @@ -1,6 +1,6 @@ from _typeshed import Self from mmap import mmap -from typing import IO, Any, BinaryIO, Iterable, List, Text, TextIO, Tuple, Type, Union +from typing import IO, Any, BinaryIO, Iterable, Text, TextIO, Union _bytearray_like = Union[bytearray, mmap] @@ -30,13 +30,13 @@ class _IOBase(BinaryIO): def truncate(self, size: int | None = ...) -> int: ... def writable(self) -> bool: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... + def __exit__(self, t: type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... def __iter__(self: Self) -> Self: ... # The parameter type of writelines[s]() is determined by that of write(): def writelines(self, lines: Iterable[bytes]) -> None: ... # The return type of readline[s]() and next() is determined by that of read(): def readline(self, limit: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... def next(self) -> bytes: ... # These don't actually exist but we need to pretend that it does # so that this class is concrete. @@ -77,8 +77,8 @@ class BufferedWriter(_BufferedIOBase): class BytesIO(_BufferedIOBase): def __init__(self, initial_bytes: bytes = ...) -> None: ... - def __setstate__(self, state: Tuple[Any, ...]) -> None: ... - def __getstate__(self) -> Tuple[Any, ...]: ... + def __setstate__(self, state: tuple[Any, ...]) -> None: ... + def __getstate__(self) -> tuple[Any, ...]: ... # BytesIO does not contain a "name" field. This workaround is necessary # to allow BytesIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. @@ -104,8 +104,8 @@ class IncrementalNewlineDecoder(object): newlines: str | unicode def __init__(self, decoder, translate, z=...) -> None: ... def decode(self, input, final) -> Any: ... - def getstate(self) -> Tuple[Any, int]: ... - def setstate(self, state: Tuple[Any, int]) -> None: ... + def getstate(self) -> tuple[Any, int]: ... + def setstate(self, state: tuple[Any, int]) -> None: ... def reset(self) -> None: ... # Note: In the actual _io.py, _TextIOBase inherits from _IOBase. @@ -138,14 +138,14 @@ class _TextIOBase(TextIO): def write(self, pbuf: unicode) -> int: ... def writelines(self, lines: Iterable[unicode]) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... + def __exit__(self, t: type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... def __iter__(self: Self) -> Self: ... class StringIO(_TextIOBase): line_buffering: bool def __init__(self, initial_value: unicode | None = ..., newline: unicode | None = ...) -> None: ... - def __setstate__(self, state: Tuple[Any, ...]) -> None: ... - def __getstate__(self) -> Tuple[Any, ...]: ... + def __setstate__(self, state: tuple[Any, ...]) -> None: ... + def __getstate__(self) -> tuple[Any, ...]: ... # StringIO does not contain a "name" field. This workaround is necessary # to allow StringIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. diff --git a/stdlib/@python2/_json.pyi b/stdlib/@python2/_json.pyi index a9868b3e60fd..57c70e80564e 100644 --- a/stdlib/@python2/_json.pyi +++ b/stdlib/@python2/_json.pyi @@ -1,7 +1,7 @@ -from typing import Any, Tuple +from typing import Any def encode_basestring_ascii(*args, **kwargs) -> str: ... -def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ... +def scanstring(a, b, *args, **kwargs) -> tuple[Any, ...]: ... class Encoder(object): ... class Scanner(object): ... diff --git a/stdlib/@python2/_markupbase.pyi b/stdlib/@python2/_markupbase.pyi index d8bc79f34e8c..368d32bd5b4c 100644 --- a/stdlib/@python2/_markupbase.pyi +++ b/stdlib/@python2/_markupbase.pyi @@ -1,8 +1,6 @@ -from typing import Tuple - class ParserBase: def __init__(self) -> None: ... def error(self, message: str) -> None: ... def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... + def getpos(self) -> tuple[int, int]: ... def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/@python2/_msi.pyi b/stdlib/@python2/_msi.pyi index a1030a66160f..754febe68da9 100644 --- a/stdlib/@python2/_msi.pyi +++ b/stdlib/@python2/_msi.pyi @@ -1,5 +1,4 @@ import sys -from typing import List if sys.platform == "win32": @@ -44,6 +43,6 @@ if sys.platform == "win32": __new__: None # type: ignore __init__: None # type: ignore def UuidCreate() -> str: ... - def FCICreate(cabname: str, files: List[str]) -> None: ... + def FCICreate(cabname: str, files: list[str]) -> None: ... def OpenDatabase(name: str, flags: int) -> _Database: ... def CreateRecord(count: int) -> _Record: ... diff --git a/stdlib/@python2/_osx_support.pyi b/stdlib/@python2/_osx_support.pyi index 1b890d8d8a0a..72645167c1af 100644 --- a/stdlib/@python2/_osx_support.pyi +++ b/stdlib/@python2/_osx_support.pyi @@ -1,13 +1,13 @@ -from typing import Dict, Iterable, List, Sequence, Tuple, TypeVar +from typing import Iterable, Sequence, TypeVar _T = TypeVar("_T") _K = TypeVar("_K") _V = TypeVar("_V") -__all__: List[str] +__all__: list[str] -_UNIVERSAL_CONFIG_VARS: Tuple[str, ...] # undocumented -_COMPILER_CONFIG_VARS: Tuple[str, ...] # undocumented +_UNIVERSAL_CONFIG_VARS: tuple[str, ...] # undocumented +_COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented _INITPRE: str # undocumented def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented @@ -17,17 +17,17 @@ def _find_build_tool(toolname: str) -> str: ... # undocumented _SYSTEM_VERSION: str | None # undocumented def _get_system_version() -> str: ... # undocumented -def _remove_original_values(_config_vars: Dict[str, str]) -> None: ... # undocumented -def _save_modified_value(_config_vars: Dict[str, str], cv: str, newvalue: str) -> None: ... # undocumented +def _remove_original_values(_config_vars: dict[str, str]) -> None: ... # undocumented +def _save_modified_value(_config_vars: dict[str, str], cv: str, newvalue: str) -> None: ... # undocumented def _supports_universal_builds() -> bool: ... # undocumented -def _find_appropriate_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_universal_flags(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_unsupported_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _override_all_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _check_for_unavailable_sdk(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> List[str]: ... -def customize_config_vars(_config_vars: Dict[str, str]) -> Dict[str, str]: ... -def customize_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... +def _find_appropriate_compiler(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _remove_universal_flags(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _remove_unsupported_archs(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _override_all_archs(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _check_for_unavailable_sdk(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> list[str]: ... +def customize_config_vars(_config_vars: dict[str, str]) -> dict[str, str]: ... +def customize_compiler(_config_vars: dict[str, str]) -> dict[str, str]: ... def get_platform_osx( - _config_vars: Dict[str, str], osname: _T, release: _K, machine: _V -) -> Tuple[str | _T, str | _K, str | _V]: ... + _config_vars: dict[str, str], osname: _T, release: _K, machine: _V +) -> tuple[str | _T, str | _K, str | _V]: ... diff --git a/stdlib/@python2/_random.pyi b/stdlib/@python2/_random.pyi index 7c2dd61af49f..8bd1afad48cb 100644 --- a/stdlib/@python2/_random.pyi +++ b/stdlib/@python2/_random.pyi @@ -1,7 +1,5 @@ -from typing import Tuple - # Actually Tuple[(int,) * 625] -_State = Tuple[int, ...] +_State = tuple[int, ...] class Random(object): def __init__(self, seed: object = ...) -> None: ... diff --git a/stdlib/@python2/_socket.pyi b/stdlib/@python2/_socket.pyi index c505384c5226..d081494be68f 100644 --- a/stdlib/@python2/_socket.pyi +++ b/stdlib/@python2/_socket.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Tuple, overload +from typing import IO, Any, overload AF_APPLETALK: int AF_ASH: int @@ -252,29 +252,29 @@ class SocketType(object): proto: int timeout: float def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... - def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ... - def bind(self, address: Tuple[Any, ...]) -> None: ... + def accept(self) -> tuple[SocketType, tuple[Any, ...]]: ... + def bind(self, address: tuple[Any, ...]) -> None: ... def close(self) -> None: ... - def connect(self, address: Tuple[Any, ...]) -> None: ... - def connect_ex(self, address: Tuple[Any, ...]) -> int: ... + def connect(self, address: tuple[Any, ...]) -> None: ... + def connect_ex(self, address: tuple[Any, ...]) -> int: ... def dup(self) -> SocketType: ... def fileno(self) -> int: ... - def getpeername(self) -> Tuple[Any, ...]: ... - def getsockname(self) -> Tuple[Any, ...]: ... + def getpeername(self) -> tuple[Any, ...]: ... + def getsockname(self) -> tuple[Any, ...]: ... def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ... def gettimeout(self) -> float: ... def listen(self, backlog: int) -> None: ... def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ... def recv(self, buffersize: int, flags: int = ...) -> str: ... def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... - def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ... + def recvfrom(self, buffersize: int, flags: int = ...) -> tuple[Any, ...]: ... def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... def send(self, data: str, flags: int = ...) -> int: ... def sendall(self, data: str, flags: int = ...) -> None: ... @overload - def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ... + def sendto(self, data: str, address: tuple[Any, ...]) -> int: ... @overload - def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ... + def sendto(self, data: str, flags: int, address: tuple[Any, ...]) -> int: ... def setblocking(self, flag: bool) -> None: ... def setsockopt(self, level: int, option: int, value: int | str) -> None: ... def settimeout(self, value: float | None) -> None: ... diff --git a/stdlib/@python2/_sre.pyi b/stdlib/@python2/_sre.pyi index 3bacc097451e..ba61c56344ac 100644 --- a/stdlib/@python2/_sre.pyi +++ b/stdlib/@python2/_sre.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterable, List, Mapping, Sequence, Tuple, overload +from typing import Any, Iterable, Mapping, Sequence, overload CODESIZE: int MAGIC: int @@ -13,11 +13,11 @@ class SRE_Match(object): def group(self) -> str: ... @overload def group(self, group: int = ...) -> str | None: ... - def groupdict(self) -> Dict[int, str | None]: ... - def groups(self) -> Tuple[str | None, ...]: ... - def span(self) -> Tuple[int, int]: ... + def groupdict(self) -> dict[int, str | None]: ... + def groups(self) -> tuple[str | None, ...]: ... + def span(self) -> tuple[int, int]: ... @property - def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented + def regs(self) -> tuple[tuple[int, int], ...]: ... # undocumented class SRE_Scanner(object): pattern: str @@ -30,19 +30,19 @@ class SRE_Pattern(object): groups: int groupindex: Mapping[str, int] indexgroup: Sequence[int] - def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Tuple[Any, ...] | str]: ... - def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Tuple[Any, ...] | str]: ... + def findall(self, source: str, pos: int = ..., endpos: int = ...) -> list[tuple[Any, ...] | str]: ... + def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[tuple[Any, ...] | str]: ... def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ... def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ... def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ... - def split(self, source: str, maxsplit: int = ...) -> List[str | None]: ... - def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ... - def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ... + def split(self, source: str, maxsplit: int = ...) -> list[str | None]: ... + def sub(self, repl: str, string: str, count: int = ...) -> tuple[Any, ...]: ... + def subn(self, repl: str, string: str, count: int = ...) -> tuple[Any, ...]: ... def compile( pattern: str, flags: int, - code: List[int], + code: list[int], groups: int = ..., groupindex: Mapping[str, int] = ..., indexgroup: Sequence[int] = ..., diff --git a/stdlib/@python2/_struct.pyi b/stdlib/@python2/_struct.pyi index 316307eaabca..89357ab0bbc8 100644 --- a/stdlib/@python2/_struct.pyi +++ b/stdlib/@python2/_struct.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Tuple +from typing import Any, AnyStr class error(Exception): ... @@ -8,12 +8,12 @@ class Struct(object): def __init__(self, fmt: str) -> None: ... def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ... def pack(self, *args) -> str: ... - def unpack(self, s: str) -> Tuple[Any, ...]: ... - def unpack_from(self, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ... + def unpack(self, s: str) -> tuple[Any, ...]: ... + def unpack_from(self, buffer: bytearray, offset: int = ...) -> tuple[Any, ...]: ... def _clearcache() -> None: ... def calcsize(fmt: str) -> int: ... def pack(fmt: AnyStr, obj: Any) -> str: ... def pack_into(fmt: AnyStr, buffer: bytearray, offset: int, obj: Any) -> None: ... -def unpack(fmt: AnyStr, data: str) -> Tuple[Any, ...]: ... -def unpack_from(fmt: AnyStr, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ... +def unpack(fmt: AnyStr, data: str) -> tuple[Any, ...]: ... +def unpack_from(fmt: AnyStr, buffer: bytearray, offset: int = ...) -> tuple[Any, ...]: ... diff --git a/stdlib/@python2/_symtable.pyi b/stdlib/@python2/_symtable.pyi index 5b2370449c31..ca21f8d5e521 100644 --- a/stdlib/@python2/_symtable.pyi +++ b/stdlib/@python2/_symtable.pyi @@ -1,5 +1,3 @@ -from typing import Dict, List - CELL: int DEF_BOUND: int DEF_FREE: int @@ -25,13 +23,13 @@ USE: int class _symtable_entry(object): ... class symtable(object): - children: List[_symtable_entry] + children: list[_symtable_entry] id: int lineno: int name: str nested: int optimized: int - symbols: Dict[str, int] + symbols: dict[str, int] type: int - varnames: List[str] + varnames: list[str] def __init__(self, src: str, filename: str, startstr: str) -> None: ... diff --git a/stdlib/@python2/_thread.pyi b/stdlib/@python2/_thread.pyi index 562ece61e042..0470ebd4830f 100644 --- a/stdlib/@python2/_thread.pyi +++ b/stdlib/@python2/_thread.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import Any, Callable, Dict, NoReturn, Tuple, Type +from typing import Any, Callable, NoReturn error = RuntimeError @@ -13,10 +13,10 @@ class LockType: def locked(self) -> bool: ... def __enter__(self) -> bool: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ... +def start_new_thread(function: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> int: ... def interrupt_main() -> None: ... def exit() -> NoReturn: ... def allocate_lock() -> LockType: ... diff --git a/stdlib/@python2/_typeshed/__init__.pyi b/stdlib/@python2/_typeshed/__init__.pyi index ca698e29ae8a..0d1dc3866b56 100644 --- a/stdlib/@python2/_typeshed/__init__.pyi +++ b/stdlib/@python2/_typeshed/__init__.pyi @@ -14,7 +14,7 @@ import array import mmap -from typing import Any, Container, Iterable, Protocol, Text, Tuple, TypeVar, Union +from typing import Any, Container, Iterable, Protocol, Text, TypeVar, Union from typing_extensions import Literal, final _KT = TypeVar("_KT") @@ -48,7 +48,7 @@ class SupportsRDivMod(Protocol[_T_contra, _T_co]): class SupportsItems(Protocol[_KT_co, _VT_co]): # We want dictionaries to support this on Python 2. - def items(self) -> Iterable[Tuple[_KT_co, _VT_co]]: ... + def items(self) -> Iterable[tuple[_KT_co, _VT_co]]: ... class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): def keys(self) -> Iterable[_KT]: ... diff --git a/stdlib/@python2/_typeshed/wsgi.pyi b/stdlib/@python2/_typeshed/wsgi.pyi index a1f10443a6f0..6dc2b5cc021d 100644 --- a/stdlib/@python2/_typeshed/wsgi.pyi +++ b/stdlib/@python2/_typeshed/wsgi.pyi @@ -4,28 +4,28 @@ # file. They are provided for type checking purposes. from sys import _OptExcInfo -from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text, Tuple +from typing import Any, Callable, Iterable, Optional, Protocol, Text class StartResponse(Protocol): def __call__( - self, status: str, headers: List[Tuple[str, str]], exc_info: _OptExcInfo | None = ... + self, status: str, headers: list[tuple[str, str]], exc_info: _OptExcInfo | None = ... ) -> Callable[[bytes], Any]: ... -WSGIEnvironment = Dict[Text, Any] +WSGIEnvironment = dict[Text, Any] WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] # WSGI input streams per PEP 3333 class InputStream(Protocol): def read(self, size: int = ...) -> bytes: ... def readline(self, size: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... def __iter__(self) -> Iterable[bytes]: ... # WSGI error streams per PEP 3333 class ErrorStream(Protocol): def flush(self) -> None: ... def write(self, s: str) -> None: ... - def writelines(self, seq: List[str]) -> None: ... + def writelines(self, seq: list[str]) -> None: ... class _Readable(Protocol): def read(self, size: int = ...) -> bytes: ... diff --git a/stdlib/@python2/_warnings.pyi b/stdlib/@python2/_warnings.pyi index ccc51fecb8da..8f531c47af55 100644 --- a/stdlib/@python2/_warnings.pyi +++ b/stdlib/@python2/_warnings.pyi @@ -1,23 +1,23 @@ -from typing import Any, Dict, List, Tuple, Type, overload +from typing import Any, overload default_action: str -once_registry: Dict[Any, Any] +once_registry: dict[Any, Any] -filters: List[Tuple[Any, ...]] +filters: list[tuple[Any, ...]] @overload -def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ...) -> None: ... +def warn(message: str, category: type[Warning] | None = ..., stacklevel: int = ...) -> None: ... @overload def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ... @overload def warn_explicit( message: str, - category: Type[Warning], + category: type[Warning], filename: str, lineno: int, module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., + registry: dict[str | tuple[str, type[Warning], int], int] | None = ..., + module_globals: dict[str, Any] | None = ..., ) -> None: ... @overload def warn_explicit( @@ -26,6 +26,6 @@ def warn_explicit( filename: str, lineno: int, module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., + registry: dict[str | tuple[str, type[Warning], int], int] | None = ..., + module_globals: dict[str, Any] | None = ..., ) -> None: ... diff --git a/stdlib/@python2/_weakref.pyi b/stdlib/@python2/_weakref.pyi index a283d4cb60d3..9a37de3174b6 100644 --- a/stdlib/@python2/_weakref.pyi +++ b/stdlib/@python2/_weakref.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Generic, List, TypeVar, overload +from typing import Any, Callable, Generic, TypeVar, overload _C = TypeVar("_C", bound=Callable[..., Any]) _T = TypeVar("_T") @@ -17,7 +17,7 @@ class ReferenceType(Generic[_T]): ref = ReferenceType def getweakrefcount(__object: Any) -> int: ... -def getweakrefs(object: Any) -> List[Any]: ... +def getweakrefs(object: Any) -> list[Any]: ... @overload def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ... diff --git a/stdlib/@python2/_winreg.pyi b/stdlib/@python2/_winreg.pyi index 5b8ec1130ca1..0381dc03ba01 100644 --- a/stdlib/@python2/_winreg.pyi +++ b/stdlib/@python2/_winreg.pyi @@ -1,6 +1,6 @@ import sys from types import TracebackType -from typing import Any, Tuple, Type, Union +from typing import Any, Union if sys.platform == "win32": _KeyType = Union[HKEYType, int] @@ -12,15 +12,15 @@ if sys.platform == "win32": def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ... def DeleteValue(__key: _KeyType, __value: str) -> None: ... def EnumKey(__key: _KeyType, __index: int) -> str: ... - def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ... + def EnumValue(__key: _KeyType, __index: int) -> tuple[str, Any, int]: ... def ExpandEnvironmentStrings(__str: str) -> str: ... def FlushKey(__key: _KeyType) -> None: ... def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ... def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... - def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ... + def QueryInfoKey(__key: _KeyType) -> tuple[int, int, int]: ... def QueryValue(__key: _KeyType, __sub_key: str | None) -> str: ... - def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ... + def QueryValueEx(__key: _KeyType, __name: str) -> tuple[Any, int]: ... def SaveKey(__key: _KeyType, __file_name: str) -> None: ... def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ... def SetValueEx( @@ -90,7 +90,7 @@ if sys.platform == "win32": def __int__(self) -> int: ... def __enter__(self) -> HKEYType: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def Close(self) -> None: ... def Detach(self) -> int: ... diff --git a/stdlib/@python2/abc.pyi b/stdlib/@python2/abc.pyi index ac14246d44a5..49ec775f91e8 100644 --- a/stdlib/@python2/abc.pyi +++ b/stdlib/@python2/abc.pyi @@ -1,6 +1,6 @@ import _weakrefset from _typeshed import SupportsWrite -from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar +from typing import Any, Callable, TypeVar _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) @@ -15,11 +15,11 @@ class ABCMeta(type): _abc_negative_cache: _weakrefset.WeakSet[Any] _abc_negative_cache_version: int _abc_registry: _weakrefset.WeakSet[Any] - def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> None: ... + def __init__(self, name: str, bases: tuple[type, ...], namespace: dict[str, Any]) -> None: ... def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... def _dump_registry(cls: ABCMeta, file: SupportsWrite[Any] | None = ...) -> None: ... - def register(cls: ABCMeta, subclass: Type[Any]) -> None: ... + def register(cls: ABCMeta, subclass: type[Any]) -> None: ... # TODO: The real abc.abstractproperty inherits from "property". class abstractproperty(object): diff --git a/stdlib/@python2/aifc.pyi b/stdlib/@python2/aifc.pyi index 42f20b7466a1..b8049e857304 100644 --- a/stdlib/@python2/aifc.pyi +++ b/stdlib/@python2/aifc.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, List, NamedTuple, Text, Tuple, Union, overload +from typing import IO, Any, NamedTuple, Text, Union, overload from typing_extensions import Literal class Error(Exception): ... @@ -12,7 +12,7 @@ class _aifc_params(NamedTuple): compname: bytes _File = Union[Text, IO[bytes]] -_Marker = Tuple[int, int, bytes] +_Marker = tuple[int, int, bytes] class Aifc_read: def __init__(self, f: _File) -> None: ... @@ -28,7 +28,7 @@ class Aifc_read: def getcomptype(self) -> bytes: ... def getcompname(self) -> bytes: ... def getparams(self) -> _aifc_params: ... - def getmarkers(self) -> List[_Marker] | None: ... + def getmarkers(self) -> list[_Marker] | None: ... def getmark(self, id: int) -> _Marker: ... def setpos(self, pos: int) -> None: ... def readframes(self, nframes: int) -> bytes: ... @@ -50,11 +50,11 @@ class Aifc_write: def setcomptype(self, comptype: bytes, compname: bytes) -> None: ... def getcomptype(self) -> bytes: ... def getcompname(self) -> bytes: ... - def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ... + def setparams(self, params: tuple[int, int, int, int, bytes, bytes]) -> None: ... def getparams(self) -> _aifc_params: ... def setmark(self, id: int, pos: int, name: bytes) -> None: ... def getmark(self, id: int) -> _Marker: ... - def getmarkers(self) -> List[_Marker] | None: ... + def getmarkers(self) -> list[_Marker] | None: ... def tell(self) -> int: ... def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol def writeframes(self, data: Any) -> None: ... diff --git a/stdlib/@python2/argparse.pyi b/stdlib/@python2/argparse.pyi index 4d77f6582c5f..e82a8c621e40 100644 --- a/stdlib/@python2/argparse.pyi +++ b/stdlib/@python2/argparse.pyi @@ -1,22 +1,4 @@ -from typing import ( - IO, - Any, - Callable, - Dict, - Generator, - Iterable, - List, - NoReturn, - Pattern, - Protocol, - Sequence, - Text, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import IO, Any, Callable, Generator, Iterable, NoReturn, Pattern, Protocol, Sequence, Text, TypeVar, Union, overload _T = TypeVar("_T") _ActionT = TypeVar("_ActionT", bound=Action) @@ -39,8 +21,8 @@ class ArgumentError(Exception): # undocumented class _AttributeHolder: - def _get_kwargs(self) -> List[Tuple[str, Any]]: ... - def _get_args(self) -> List[Any]: ... + def _get_kwargs(self) -> list[tuple[str, Any]]: ... + def _get_args(self) -> list[Any]: ... # undocumented class _ActionsContainer: @@ -49,14 +31,14 @@ class _ActionsContainer: argument_default: Any conflict_handler: _Text - _registries: Dict[_Text, Dict[Any, Any]] - _actions: List[Action] - _option_string_actions: Dict[_Text, Action] - _action_groups: List[_ArgumentGroup] - _mutually_exclusive_groups: List[_MutuallyExclusiveGroup] - _defaults: Dict[str, Any] + _registries: dict[_Text, dict[Any, Any]] + _actions: list[Action] + _option_string_actions: dict[_Text, Action] + _action_groups: list[_ArgumentGroup] + _mutually_exclusive_groups: list[_MutuallyExclusiveGroup] + _defaults: dict[str, Any] _negative_number_matcher: Pattern[str] - _has_negative_number_optionals: List[bool] + _has_negative_number_optionals: list[bool] def __init__(self, description: Text | None, prefix_chars: Text, argument_default: Any, conflict_handler: Text) -> None: ... def register(self, registry_name: Text, value: Any, object: Any) -> None: ... def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ... @@ -65,7 +47,7 @@ class _ActionsContainer: def add_argument( self, *name_or_flags: Text, - action: Text | Type[Action] = ..., + action: Text | type[Action] = ..., nargs: int | Text = ..., const: Any = ..., default: Any = ..., @@ -73,7 +55,7 @@ class _ActionsContainer: choices: Iterable[_T] = ..., required: bool = ..., help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., + metavar: Text | tuple[Text, ...] | None = ..., dest: Text | None = ..., version: Text = ..., **kwargs: Any, @@ -83,13 +65,13 @@ class _ActionsContainer: def _add_action(self, action: _ActionT) -> _ActionT: ... def _remove_action(self, action: Action) -> None: ... def _add_container_actions(self, container: _ActionsContainer) -> None: ... - def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> Dict[str, Any]: ... - def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ... - def _pop_action_class(self, kwargs: Any, default: Type[Action] | None = ...) -> Type[Action]: ... - def _get_handler(self) -> Callable[[Action, Iterable[Tuple[Text, Action]]], Any]: ... + def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> dict[str, Any]: ... + def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def _pop_action_class(self, kwargs: Any, default: type[Action] | None = ...) -> type[Action]: ... + def _get_handler(self) -> Callable[[Action, Iterable[tuple[Text, Action]]], Any]: ... def _check_conflict(self, action: Action) -> None: ... - def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> NoReturn: ... - def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> None: ... + def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[Text, Action]]) -> NoReturn: ... + def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[Text, Action]]) -> None: ... class _FormatterClass(Protocol): def __call__(self, prog: str) -> HelpFormatter: ... @@ -138,8 +120,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): title: Text = ..., description: Text | None = ..., prog: Text = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., + parser_class: type[ArgumentParser] = ..., + action: type[Action] = ..., option_string: Text = ..., dest: Text | None = ..., help: Text | None = ..., @@ -151,21 +133,21 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def format_help(self) -> str: ... def parse_known_args( self, args: Sequence[Text] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, List[str]]: ... - def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ... + ) -> tuple[Namespace, list[str]]: ... + def convert_arg_line_to_args(self, arg_line: Text) -> list[str]: ... def exit(self, status: int = ..., message: Text | None = ...) -> NoReturn: ... def error(self, message: Text) -> NoReturn: ... # undocumented - def _get_optional_actions(self) -> List[Action]: ... - def _get_positional_actions(self) -> List[Action]: ... - def _parse_known_args(self, arg_strings: List[Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ... - def _read_args_from_files(self, arg_strings: List[Text]) -> List[Text]: ... + def _get_optional_actions(self) -> list[Action]: ... + def _get_positional_actions(self) -> list[Action]: ... + def _parse_known_args(self, arg_strings: list[Text], namespace: Namespace) -> tuple[Namespace, list[str]]: ... + def _read_args_from_files(self, arg_strings: list[Text]) -> list[Text]: ... def _match_argument(self, action: Action, arg_strings_pattern: Text) -> int: ... - def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> List[int]: ... - def _parse_optional(self, arg_string: Text) -> Tuple[Action | None, Text, Text | None] | None: ... - def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Text | None]]: ... + def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> list[int]: ... + def _parse_optional(self, arg_string: Text) -> tuple[Action | None, Text, Text | None] | None: ... + def _get_option_tuples(self, option_string: Text) -> list[tuple[Action, Text, Text | None]]: ... def _get_nargs_pattern(self, action: Action) -> _Text: ... - def _get_values(self, action: Action, arg_strings: List[Text]) -> Any: ... + def _get_values(self, action: Action, arg_strings: list[Text]) -> Any: ... def _get_value(self, action: Action, arg_string: Text) -> Any: ... def _check_value(self, action: Action, value: Any) -> None: ... def _get_formatter(self) -> HelpFormatter: ... @@ -184,7 +166,7 @@ class HelpFormatter: _current_section: Any _whitespace_matcher: Pattern[str] _long_break_matcher: Pattern[str] - _Section: Type[Any] # Nested class + _Section: type[Any] # Nested class def __init__( self, prog: Text, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ... ) -> None: ... @@ -208,11 +190,11 @@ class HelpFormatter: def _format_text(self, text: Text) -> _Text: ... def _format_action(self, action: Action) -> _Text: ... def _format_action_invocation(self, action: Action) -> _Text: ... - def _metavar_formatter(self, action: Action, default_metavar: Text) -> Callable[[int], Tuple[_Text, ...]]: ... + def _metavar_formatter(self, action: Action, default_metavar: Text) -> Callable[[int], tuple[_Text, ...]]: ... def _format_args(self, action: Action, default_metavar: Text) -> _Text: ... def _expand_help(self, action: Action) -> _Text: ... def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ... - def _split_lines(self, text: Text, width: int) -> List[_Text]: ... + def _split_lines(self, text: Text, width: int) -> list[_Text]: ... def _fill_text(self, text: Text, width: int, indent: Text) -> _Text: ... def _get_help_string(self, action: Action) -> _Text | None: ... def _get_default_metavar_for_optional(self, action: Action) -> _Text: ... @@ -232,7 +214,7 @@ class Action(_AttributeHolder): choices: Iterable[Any] | None required: bool help: _Text | None - metavar: _Text | Tuple[_Text, ...] | None + metavar: _Text | tuple[_Text, ...] | None def __init__( self, option_strings: Sequence[Text], @@ -244,7 +226,7 @@ class Action(_AttributeHolder): choices: Iterable[_T] | None = ..., required: bool = ..., help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., + metavar: Text | tuple[Text, ...] | None = ..., ) -> None: ... def __call__( self, parser: ArgumentParser, namespace: Namespace, values: Text | Sequence[Any] | None, option_string: Text | None = ... @@ -266,7 +248,7 @@ class FileType: # undocumented class _ArgumentGroup(_ActionsContainer): title: _Text | None - _group_actions: List[Action] + _group_actions: list[Action] def __init__( self, container: _ActionsContainer, title: Text | None = ..., description: Text | None = ..., **kwargs: Any ) -> None: ... @@ -290,7 +272,7 @@ class _StoreConstAction(Action): default: Any = ..., required: bool = ..., help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., + metavar: Text | tuple[Text, ...] | None = ..., ) -> None: ... # undocumented @@ -318,7 +300,7 @@ class _AppendConstAction(Action): default: Any = ..., required: bool = ..., help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., + metavar: Text | tuple[Text, ...] | None = ..., ) -> None: ... # undocumented @@ -342,24 +324,24 @@ class _VersionAction(Action): # undocumented class _SubParsersAction(Action): - _ChoicesPseudoAction: Type[Any] # nested class + _ChoicesPseudoAction: type[Any] # nested class _prog_prefix: _Text - _parser_class: Type[ArgumentParser] - _name_parser_map: Dict[_Text, ArgumentParser] - choices: Dict[_Text, ArgumentParser] - _choices_actions: List[Action] + _parser_class: type[ArgumentParser] + _name_parser_map: dict[_Text, ArgumentParser] + choices: dict[_Text, ArgumentParser] + _choices_actions: list[Action] def __init__( self, option_strings: Sequence[Text], prog: Text, - parser_class: Type[ArgumentParser], + parser_class: type[ArgumentParser], dest: Text = ..., help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., + metavar: Text | tuple[Text, ...] | None = ..., ) -> None: ... # TODO: Type keyword args properly. def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ... - def _get_subactions(self) -> List[Action]: ... + def _get_subactions(self) -> list[Action]: ... # undocumented class ArgumentTypeError(Exception): ... diff --git a/stdlib/@python2/array.pyi b/stdlib/@python2/array.pyi index 39670fe734fc..ea9b21a8eccb 100644 --- a/stdlib/@python2/array.pyi +++ b/stdlib/@python2/array.pyi @@ -1,4 +1,4 @@ -from typing import Any, BinaryIO, Generic, Iterable, List, MutableSequence, Text, Tuple, TypeVar, Union, overload +from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, Text, TypeVar, Union, overload from typing_extensions import Literal _IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] @@ -20,12 +20,12 @@ class array(MutableSequence[_T], Generic[_T]): @overload def __init__(self, typecode: str, __initializer: bytes | Iterable[_T] = ...) -> None: ... def append(self, __v: _T) -> None: ... - def buffer_info(self) -> Tuple[int, int]: ... + def buffer_info(self) -> tuple[int, int]: ... def byteswap(self) -> None: ... def count(self, __v: Any) -> int: ... def extend(self, __bb: Iterable[_T]) -> None: ... def fromfile(self, __f: BinaryIO, __n: int) -> None: ... - def fromlist(self, __list: List[_T]) -> None: ... + def fromlist(self, __list: list[_T]) -> None: ... def fromunicode(self, __ustr: str) -> None: ... def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence def insert(self, __i: int, __v: _T) -> None: ... @@ -34,7 +34,7 @@ class array(MutableSequence[_T], Generic[_T]): def remove(self, __v: Any) -> None: ... def reverse(self) -> None: ... def tofile(self, __f: BinaryIO) -> None: ... - def tolist(self) -> List[_T]: ... + def tolist(self) -> list[_T]: ... def tounicode(self) -> str: ... def write(self, f: BinaryIO) -> None: ... def fromstring(self, __buffer: bytes) -> None: ... diff --git a/stdlib/@python2/asynchat.pyi b/stdlib/@python2/asynchat.pyi index 0f5526d71b1d..e55dbf258a14 100644 --- a/stdlib/@python2/asynchat.pyi +++ b/stdlib/@python2/asynchat.pyi @@ -1,7 +1,7 @@ import asyncore import socket from abc import abstractmethod -from typing import Sequence, Tuple +from typing import Sequence class simple_producer: def __init__(self, data: bytes, buffer_size: int = ...) -> None: ... @@ -34,4 +34,4 @@ class fifo: def is_empty(self) -> bool: ... def first(self) -> bytes: ... def push(self, data: bytes | simple_producer) -> None: ... - def pop(self) -> Tuple[int, bytes]: ... + def pop(self) -> tuple[int, bytes]: ... diff --git a/stdlib/@python2/asyncore.pyi b/stdlib/@python2/asyncore.pyi index 20a4f7b3c887..a7ef4df1f0a9 100644 --- a/stdlib/@python2/asyncore.pyi +++ b/stdlib/@python2/asyncore.pyi @@ -1,10 +1,10 @@ import sys from _typeshed import FileDescriptorLike from socket import SocketType -from typing import Any, Dict, Optional, Tuple, overload +from typing import Any, Optional, overload # cyclic dependence with asynchat -_maptype = Dict[int, Any] +_maptype = dict[int, Any] socket_map: _maptype # undocumented @@ -40,9 +40,9 @@ class dispatcher: def readable(self) -> bool: ... def writable(self) -> bool: ... def listen(self, num: int) -> None: ... - def bind(self, addr: Tuple[Any, ...] | str) -> None: ... - def connect(self, address: Tuple[Any, ...] | str) -> None: ... - def accept(self) -> Tuple[SocketType, Any] | None: ... + def bind(self, addr: tuple[Any, ...] | str) -> None: ... + def connect(self, address: tuple[Any, ...] | str) -> None: ... + def accept(self) -> tuple[SocketType, Any] | None: ... def send(self, data: bytes) -> int: ... def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... @@ -73,7 +73,7 @@ class dispatcher: @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... def gettimeout(self) -> float: ... - def ioctl(self, control: object, option: Tuple[int, int, int]) -> None: ... + def ioctl(self, control: object, option: tuple[int, int, int]) -> None: ... # TODO the return value may be BinaryIO or TextIO, depending on mode def makefile( self, mode: str = ..., buffering: int = ..., encoding: str = ..., errors: str = ..., newline: str = ... @@ -83,7 +83,7 @@ class dispatcher: def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ... def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ... def sendall(self, data: bytes, flags: int = ...) -> None: ... - def sendto(self, data: bytes, address: Tuple[str, int] | str, flags: int = ...) -> int: ... + def sendto(self, data: bytes, address: tuple[str, int] | str, flags: int = ...) -> int: ... def setblocking(self, flag: bool) -> None: ... def settimeout(self, value: float | None) -> None: ... def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ... @@ -96,7 +96,7 @@ class dispatcher_with_send(dispatcher): # incompatible signature: # def send(self, data: bytes) -> Optional[int]: ... -def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ... +def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ... def close_all(map: _maptype | None = ..., ignore_all: bool = ...) -> None: ... if sys.platform != "win32": diff --git a/stdlib/@python2/audioop.pyi b/stdlib/@python2/audioop.pyi index 71671afe487e..b08731b85b0b 100644 --- a/stdlib/@python2/audioop.pyi +++ b/stdlib/@python2/audioop.pyi @@ -1,12 +1,10 @@ -from typing import Tuple - -AdpcmState = Tuple[int, int] -RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]] +AdpcmState = tuple[int, int] +RatecvState = tuple[int, tuple[tuple[int, int], ...]] class error(Exception): ... def add(__fragment1: bytes, __fragment2: bytes, __width: int) -> bytes: ... -def adpcm2lin(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... +def adpcm2lin(__fragment: bytes, __width: int, __state: AdpcmState | None) -> tuple[bytes, AdpcmState]: ... def alaw2lin(__fragment: bytes, __width: int) -> bytes: ... def avg(__fragment: bytes, __width: int) -> int: ... def avgpp(__fragment: bytes, __width: int) -> int: ... @@ -14,16 +12,16 @@ def bias(__fragment: bytes, __width: int, __bias: int) -> bytes: ... def byteswap(__fragment: bytes, __width: int) -> bytes: ... def cross(__fragment: bytes, __width: int) -> int: ... def findfactor(__fragment: bytes, __reference: bytes) -> float: ... -def findfit(__fragment: bytes, __reference: bytes) -> Tuple[int, float]: ... +def findfit(__fragment: bytes, __reference: bytes) -> tuple[int, float]: ... def findmax(__fragment: bytes, __length: int) -> int: ... def getsample(__fragment: bytes, __width: int, __index: int) -> int: ... -def lin2adpcm(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... +def lin2adpcm(__fragment: bytes, __width: int, __state: AdpcmState | None) -> tuple[bytes, AdpcmState]: ... def lin2alaw(__fragment: bytes, __width: int) -> bytes: ... def lin2lin(__fragment: bytes, __width: int, __newwidth: int) -> bytes: ... def lin2ulaw(__fragment: bytes, __width: int) -> bytes: ... def max(__fragment: bytes, __width: int) -> int: ... def maxpp(__fragment: bytes, __width: int) -> int: ... -def minmax(__fragment: bytes, __width: int) -> Tuple[int, int]: ... +def minmax(__fragment: bytes, __width: int) -> tuple[int, int]: ... def mul(__fragment: bytes, __width: int, __factor: float) -> bytes: ... def ratecv( __fragment: bytes, @@ -34,7 +32,7 @@ def ratecv( __state: RatecvState | None, __weightA: int = ..., __weightB: int = ..., -) -> Tuple[bytes, RatecvState]: ... +) -> tuple[bytes, RatecvState]: ... def reverse(__fragment: bytes, __width: int) -> bytes: ... def rms(__fragment: bytes, __width: int) -> int: ... def tomono(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ... diff --git a/stdlib/@python2/bdb.pyi b/stdlib/@python2/bdb.pyi index ad929bbfd844..fcb93c2bbf4f 100644 --- a/stdlib/@python2/bdb.pyi +++ b/stdlib/@python2/bdb.pyi @@ -1,9 +1,9 @@ from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, Set, SupportsInt, Tuple, Type, TypeVar +from typing import IO, Any, Callable, Iterable, Mapping, SupportsInt, TypeVar _T = TypeVar("_T") _TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type -_ExcInfo = Tuple[Type[BaseException], BaseException, FrameType] +_ExcInfo = tuple[type[BaseException], BaseException, FrameType] GENERATOR_AND_COROUTINE_FLAGS: int @@ -11,9 +11,9 @@ class BdbQuit(Exception): ... class Bdb: - skip: Set[str] | None - breaks: Dict[str, List[int]] - fncache: Dict[str, str] + skip: set[str] | None + breaks: dict[str, list[int]] + fncache: dict[str, str] frame_returning: FrameType | None botframe: FrameType | None quitting: bool @@ -53,21 +53,21 @@ class Bdb: def clear_all_breaks(self) -> None: ... def get_bpbynumber(self, arg: SupportsInt) -> Breakpoint: ... def get_break(self, filename: str, lineno: int) -> bool: ... - def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ... - def get_file_breaks(self, filename: str) -> List[Breakpoint]: ... - def get_all_breaks(self) -> List[Breakpoint]: ... - def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[List[Tuple[FrameType, int]], int]: ... + def get_breaks(self, filename: str, lineno: int) -> list[Breakpoint]: ... + def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... + def get_all_breaks(self) -> list[Breakpoint]: ... + def get_stack(self, f: FrameType | None, t: TracebackType | None) -> tuple[list[tuple[FrameType, int]], int]: ... def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ... - def run(self, cmd: str | CodeType, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runeval(self, expr: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runctx(self, cmd: str | CodeType, globals: Dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... + def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... + def runeval(self, expr: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... + def runctx(self, cmd: str | CodeType, globals: dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... class Breakpoint: next: int = ... - bplist: Dict[Tuple[str, int], List[Breakpoint]] = ... - bpbynumber: List[Breakpoint | None] = ... + bplist: dict[tuple[str, int], list[Breakpoint]] = ... + bpbynumber: list[Breakpoint | None] = ... funcname: str | None func_first_executable_line: int | None @@ -90,5 +90,5 @@ class Breakpoint: def __str__(self) -> str: ... def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ... -def effective(file: str, line: int, frame: FrameType) -> Tuple[Breakpoint, bool] | Tuple[None, None]: ... +def effective(file: str, line: int, frame: FrameType) -> tuple[Breakpoint, bool] | tuple[None, None]: ... def set_trace() -> None: ... diff --git a/stdlib/@python2/binhex.pyi b/stdlib/@python2/binhex.pyi index 02d094faf923..4e295b8ed903 100644 --- a/stdlib/@python2/binhex.pyi +++ b/stdlib/@python2/binhex.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Tuple, Union +from typing import IO, Any, Union class Error(Exception): ... @@ -12,7 +12,7 @@ class FInfo: Creator: str Flags: int -_FileInfoTuple = Tuple[str, FInfo, int, int] +_FileInfoTuple = tuple[str, FInfo, int, int] _FileHandleUnion = Union[str, IO[bytes]] def getfileinfo(name: str) -> _FileInfoTuple: ... diff --git a/stdlib/@python2/builtins.pyi b/stdlib/@python2/builtins.pyi index f1a25140675f..331ef05a855e 100644 --- a/stdlib/@python2/builtins.pyi +++ b/stdlib/@python2/builtins.pyi @@ -13,14 +13,11 @@ from typing import ( ByteString, Callable, Container, - Dict, - FrozenSet, Generic, ItemsView, Iterable, Iterator, KeysView, - List, Mapping, MutableMapping, MutableSequence, @@ -29,15 +26,12 @@ from typing import ( Protocol, Reversible, Sequence, - Set, Sized, SupportsAbs, SupportsComplex, SupportsFloat, SupportsInt, Text, - Tuple, - Type, TypeVar, ValuesView, overload, @@ -64,12 +58,12 @@ _TT = TypeVar("_TT", bound=type) class object: __doc__: str | None - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __module__: str @property - def __class__(self: _T) -> Type[_T]: ... + def __class__(self: _T) -> type[_T]: ... @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... # noqa: F811 + def __class__(self, __type: type[object]) -> None: ... # noqa: F811 def __init__(self) -> None: ... def __new__(cls) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... @@ -82,46 +76,46 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ... + def __reduce__(self) -> str | tuple[Any, ...]: ... + def __reduce_ex__(self, protocol: int) -> str | tuple[Any, ...]: ... class staticmethod(object): # Special, only valid as a decorator. __func__: Callable[..., Any] def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... + def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ... + def __get__(self, obj: _T, type: type[_T] | None = ...) -> Callable[..., Any]: ... class classmethod(object): # Special, only valid as a decorator. __func__: Callable[..., Any] def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... + def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ... + def __get__(self, obj: _T, type: type[_T] | None = ...) -> Callable[..., Any]: ... class type(object): __base__: type - __bases__: Tuple[type, ...] + __bases__: tuple[type, ...] __basicsize__: int - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __dictoffset__: int __flags__: int __itemsize__: int __module__: str - __mro__: Tuple[type, ...] + __mro__: tuple[type, ...] __name__: str __weakrefoffset__: int @overload def __init__(self, o: object) -> None: ... @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ... + def __init__(self, name: str, bases: tuple[type, ...], dict: dict[str, Any]) -> None: ... @overload def __new__(cls, o: object) -> type: ... @overload - def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ... + def __new__(cls, name: str, bases: tuple[type, ...], namespace: dict[str, Any]) -> type: ... def __call__(self, *args: Any, **kwds: Any) -> Any: ... - def __subclasses__(self: _TT) -> List[_TT]: ... + def __subclasses__(self: _TT) -> list[_TT]: ... # Note: the documentation doesn't specify what the return type is, the standard # implementation seems to be returning a list. - def mro(self) -> List[type]: ... + def mro(self) -> list[type]: ... def __instancecheck__(self, instance: Any) -> bool: ... def __subclasscheck__(self, subclass: type) -> bool: ... @@ -133,9 +127,9 @@ class super(object): class int: @overload - def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... + def __new__(cls: type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... @overload - def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... + def __new__(cls: type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... @property def real(self) -> int: ... @property @@ -153,7 +147,7 @@ class int: def __div__(self, x: int) -> int: ... def __truediv__(self, x: int) -> float: ... def __mod__(self, x: int) -> int: ... - def __divmod__(self, x: int) -> Tuple[int, int]: ... + def __divmod__(self, x: int) -> tuple[int, int]: ... def __radd__(self, x: int) -> int: ... def __rsub__(self, x: int) -> int: ... def __rmul__(self, x: int) -> int: ... @@ -161,7 +155,7 @@ class int: def __rdiv__(self, x: int) -> int: ... def __rtruediv__(self, x: int) -> float: ... def __rmod__(self, x: int) -> int: ... - def __rdivmod__(self, x: int) -> Tuple[int, int]: ... + def __rdivmod__(self, x: int) -> tuple[int, int]: ... @overload def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ... @overload @@ -181,7 +175,7 @@ class int: def __pos__(self) -> int: ... def __invert__(self) -> int: ... def __trunc__(self) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... + def __getnewargs__(self) -> tuple[int]: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: int) -> bool: ... @@ -197,8 +191,8 @@ class int: def __index__(self) -> int: ... class float: - def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... + def __new__(cls: type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... + def as_integer_ratio(self) -> tuple[int, int]: ... def hex(self) -> str: ... def is_integer(self) -> bool: ... @classmethod @@ -215,7 +209,7 @@ class float: def __div__(self, x: float) -> float: ... def __truediv__(self, x: float) -> float: ... def __mod__(self, x: float) -> float: ... - def __divmod__(self, x: float) -> Tuple[float, float]: ... + def __divmod__(self, x: float) -> tuple[float, float]: ... def __pow__( self, x: float, mod: None = ... ) -> float: ... # In Python 3, returns complex if self is negative and x is not whole @@ -226,9 +220,9 @@ class float: def __rdiv__(self, x: float) -> float: ... def __rtruediv__(self, x: float) -> float: ... def __rmod__(self, x: float) -> float: ... - def __rdivmod__(self, x: float) -> Tuple[float, float]: ... + def __rdivmod__(self, x: float) -> tuple[float, float]: ... def __rpow__(self, x: float, mod: None = ...) -> float: ... - def __getnewargs__(self) -> Tuple[float]: ... + def __getnewargs__(self) -> tuple[float]: ... def __trunc__(self) -> int: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... @@ -247,9 +241,9 @@ class float: class complex: @overload - def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ... + def __new__(cls: type[_T], real: float = ..., imag: float = ...) -> _T: ... @overload - def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... + def __new__(cls: type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... @property def real(self) -> float: ... @property @@ -291,7 +285,7 @@ class unicode(basestring, Sequence[unicode]): def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: unicode | tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> unicode: ... @@ -311,21 +305,21 @@ class unicode(basestring, Sequence[unicode]): def ljust(self, width: int, fillchar: unicode = ...) -> unicode: ... def lower(self) -> unicode: ... def lstrip(self, chars: unicode = ...) -> unicode: ... - def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def partition(self, sep: unicode) -> tuple[unicode, unicode, unicode]: ... def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ... def rfind(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... + def rpartition(self, sep: unicode) -> tuple[unicode, unicode, unicode]: ... + def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> list[unicode]: ... def rstrip(self, chars: unicode = ...) -> unicode: ... - def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> list[unicode]: ... + def splitlines(self, keepends: bool = ...) -> list[unicode]: ... + def startswith(self, __prefix: unicode | tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... - def translate(self, table: Dict[int, Any] | unicode) -> unicode: ... + def translate(self, table: dict[int, Any] | unicode) -> unicode: ... def upper(self) -> unicode: ... def zfill(self, width: int) -> unicode: ... @overload @@ -352,7 +346,7 @@ class unicode(basestring, Sequence[unicode]): def __int__(self) -> int: ... def __float__(self) -> float: ... def __hash__(self) -> int: ... - def __getnewargs__(self) -> Tuple[unicode]: ... + def __getnewargs__(self) -> tuple[unicode]: ... class _FormatMapMapping(Protocol): def __getitem__(self, __key: str) -> Any: ... @@ -364,7 +358,7 @@ class str(Sequence[str], basestring): def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: Text | tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> str: ... @@ -385,35 +379,35 @@ class str(Sequence[str], basestring): @overload def lstrip(self, __chars: unicode) -> unicode: ... @overload - def partition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... + def partition(self, __sep: bytearray) -> tuple[str, bytearray, str]: ... @overload - def partition(self, __sep: str) -> Tuple[str, str, str]: ... + def partition(self, __sep: str) -> tuple[str, str, str]: ... @overload - def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def partition(self, __sep: unicode) -> tuple[unicode, unicode, unicode]: ... def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ... def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... def rjust(self, __width: int, __fillchar: str = ...) -> str: ... @overload - def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... + def rpartition(self, __sep: bytearray) -> tuple[str, bytearray, str]: ... @overload - def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... + def rpartition(self, __sep: str) -> tuple[str, str, str]: ... @overload - def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... + def rpartition(self, __sep: unicode) -> tuple[unicode, unicode, unicode]: ... @overload - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... + def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... @overload - def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... + def rsplit(self, sep: unicode, maxsplit: int = ...) -> list[unicode]: ... @overload def rstrip(self, __chars: str = ...) -> str: ... @overload def rstrip(self, __chars: unicode) -> unicode: ... @overload - def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... + def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... @overload - def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: unicode, maxsplit: int = ...) -> list[unicode]: ... + def splitlines(self, keepends: bool = ...) -> list[str]: ... + def startswith(self, __prefix: Text | tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... @overload def strip(self, __chars: str = ...) -> str: ... @overload @@ -441,7 +435,7 @@ class str(Sequence[str], basestring): def __repr__(self) -> str: ... def __rmul__(self, n: int) -> str: ... def __str__(self) -> str: ... - def __getnewargs__(self) -> Tuple[str]: ... + def __getnewargs__(self) -> tuple[str]: ... def __getslice__(self, start: int, stop: int) -> str: ... def __float__(self) -> float: ... def __int__(self) -> int: ... @@ -463,7 +457,7 @@ class bytearray(MutableSequence[int], ByteString): def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... def count(self, __sub: str) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def endswith(self, __suffix: bytes | tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... def extend(self, iterable: str | Iterable[int]) -> None: ... def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... @@ -480,17 +474,17 @@ class bytearray(MutableSequence[int], ByteString): def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ... def lower(self) -> bytearray: ... def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... + def partition(self, __sep: bytes) -> tuple[bytearray, bytearray, bytearray]: ... def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ... def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... + def rpartition(self, __sep: bytes) -> tuple[bytearray, bytearray, bytearray]: ... + def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> list[bytearray]: ... def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... - def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... + def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> list[bytearray]: ... + def splitlines(self, keepends: bool = ...) -> list[bytearray]: ... + def startswith(self, __prefix: bytes | tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... def strip(self, __bytes: bytes | None = ...) -> bytearray: ... def swapcase(self) -> bytearray: ... def title(self) -> bytearray: ... @@ -532,9 +526,9 @@ class bytearray(MutableSequence[int], ByteString): class memoryview(Sized, Container[str]): format: str itemsize: int - shape: Tuple[int, ...] | None - strides: Tuple[int, ...] | None - suboffsets: Tuple[int, ...] | None + shape: tuple[int, ...] | None + strides: tuple[int, ...] | None + suboffsets: tuple[int, ...] | None readonly: bool ndim: int def __init__(self, obj: ReadableBuffer) -> None: ... @@ -550,11 +544,11 @@ class memoryview(Sized, Container[str]): @overload def __setitem__(self, i: int, o: int) -> None: ... def tobytes(self) -> bytes: ... - def tolist(self) -> List[int]: ... + def tolist(self) -> list[int]: ... @final class bool(int): - def __new__(cls: Type[_T], __o: object = ...) -> _T: ... + def __new__(cls: type[_T], __o: object = ...) -> _T: ... @overload def __and__(self, x: bool) -> bool: ... @overload @@ -579,7 +573,7 @@ class bool(int): def __rxor__(self, x: bool) -> bool: ... @overload def __rxor__(self, x: int) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... + def __getnewargs__(self) -> tuple[int]: ... class slice(object): start: Any @@ -590,27 +584,27 @@ class slice(object): @overload def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ... __hash__: None # type: ignore - def indices(self, len: int) -> Tuple[int, int, int]: ... + def indices(self, len: int) -> tuple[int, int, int]: ... class tuple(Sequence[_T_co], Generic[_T_co]): - def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... + def __new__(cls: type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... def __len__(self) -> int: ... def __contains__(self, x: object) -> bool: ... @overload def __getitem__(self, x: int) -> _T_co: ... @overload - def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ... + def __getitem__(self, x: slice) -> tuple[_T_co, ...]: ... def __iter__(self) -> Iterator[_T_co]: ... - def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __le__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ... + def __lt__(self, x: tuple[_T_co, ...]) -> bool: ... + def __le__(self, x: tuple[_T_co, ...]) -> bool: ... + def __gt__(self, x: tuple[_T_co, ...]) -> bool: ... + def __ge__(self, x: tuple[_T_co, ...]) -> bool: ... @overload - def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ... + def __add__(self, x: tuple[_T_co, ...]) -> tuple[_T_co, ...]: ... @overload - def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ... - def __mul__(self, n: int) -> Tuple[_T_co, ...]: ... - def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ... + def __add__(self, x: tuple[Any, ...]) -> tuple[Any, ...]: ... + def __mul__(self, n: int) -> tuple[_T_co, ...]: ... + def __rmul__(self, n: int) -> tuple[_T_co, ...]: ... def count(self, __value: Any) -> int: ... def index(self, __value: Any) -> int: ... @@ -641,25 +635,25 @@ class list(MutableSequence[_T], Generic[_T]): @overload def __getitem__(self, i: int) -> _T: ... @overload - def __getitem__(self, s: slice) -> List[_T]: ... + def __getitem__(self, s: slice) -> list[_T]: ... @overload def __setitem__(self, i: int, o: _T) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_T]: ... + def __getslice__(self, start: int, stop: int) -> list[_T]: ... def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, x: List[_T]) -> List[_T]: ... + def __add__(self, x: list[_T]) -> list[_T]: ... def __iadd__(self: Self, x: Iterable[_T]) -> Self: ... - def __mul__(self, n: int) -> List[_T]: ... - def __rmul__(self, n: int) -> List[_T]: ... + def __mul__(self, n: int) -> list[_T]: ... + def __rmul__(self, n: int) -> list[_T]: ... def __contains__(self, o: object) -> bool: ... def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: List[_T]) -> bool: ... - def __ge__(self, x: List[_T]) -> bool: ... - def __lt__(self, x: List[_T]) -> bool: ... - def __le__(self, x: List[_T]) -> bool: ... + def __gt__(self, x: list[_T]) -> bool: ... + def __ge__(self, x: list[_T]) -> bool: ... + def __lt__(self, x: list[_T]) -> bool: ... + def __le__(self, x: list[_T]) -> bool: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): # NOTE: Keyword arguments are special. If they are used, _KT must include @@ -669,31 +663,31 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): @overload def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... + def __init__(self, iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __new__(cls: type[_T1], *args: Any, **kwargs: Any) -> _T1: ... def has_key(self, k: _KT) -> bool: ... def clear(self) -> None: ... - def copy(self) -> Dict[_KT, _VT]: ... - def popitem(self) -> Tuple[_KT, _VT]: ... + def copy(self) -> dict[_KT, _VT]: ... + def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... @overload def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def update(self, __m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... @overload def update(self, **kwargs: _VT) -> None: ... def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ... def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... def viewitems(self) -> ItemsView[_KT, _VT]: ... @classmethod @overload - def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... + def fromkeys(cls, __iterable: Iterable[_T]) -> dict[_T, Any]: ... @classmethod @overload - def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... + def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -706,39 +700,39 @@ class set(MutableSet[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ...) -> None: ... def add(self, element: _T) -> None: ... def clear(self) -> None: ... - def copy(self) -> Set[_T]: ... - def difference(self, *s: Iterable[Any]) -> Set[_T]: ... + def copy(self) -> set[_T]: ... + def difference(self, *s: Iterable[Any]) -> set[_T]: ... def difference_update(self, *s: Iterable[Any]) -> None: ... def discard(self, element: _T) -> None: ... - def intersection(self, *s: Iterable[Any]) -> Set[_T]: ... + def intersection(self, *s: Iterable[Any]) -> set[_T]: ... def intersection_update(self, *s: Iterable[Any]) -> None: ... def isdisjoint(self, s: Iterable[Any]) -> bool: ... def issubset(self, s: Iterable[Any]) -> bool: ... def issuperset(self, s: Iterable[Any]) -> bool: ... def pop(self) -> _T: ... def remove(self, element: _T) -> None: ... - def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ... + def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ... def symmetric_difference_update(self, s: Iterable[_T]) -> None: ... - def union(self, *s: Iterable[_T]) -> Set[_T]: ... + def union(self, *s: Iterable[_T]) -> set[_T]: ... def update(self, *s: Iterable[_T]) -> None: ... def __len__(self) -> int: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_T]: ... def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... + def __and__(self, s: AbstractSet[object]) -> set[_T]: ... + def __iand__(self, s: AbstractSet[object]) -> set[_T]: ... + def __or__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ior__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... @overload - def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... + def __sub__(self: set[str], s: AbstractSet[Text | None]) -> set[_T]: ... @overload - def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... + def __sub__(self, s: AbstractSet[_T | None]) -> set[_T]: ... @overload # type: ignore - def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... + def __isub__(self: set[str], s: AbstractSet[Text | None]) -> set[_T]: ... @overload - def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... + def __isub__(self, s: AbstractSet[_T | None]) -> set[_T]: ... + def __xor__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ixor__(self, s: AbstractSet[_S]) -> set[_T | _S]: ... def __le__(self, s: AbstractSet[object]) -> bool: ... def __lt__(self, s: AbstractSet[object]) -> bool: ... def __ge__(self, s: AbstractSet[object]) -> bool: ... @@ -747,31 +741,31 @@ class set(MutableSet[_T], Generic[_T]): class frozenset(AbstractSet[_T_co], Generic[_T_co]): def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... - def copy(self) -> FrozenSet[_T_co]: ... - def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... + def copy(self) -> frozenset[_T_co]: ... + def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ... + def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ... def isdisjoint(self, s: Iterable[_T_co]) -> bool: ... def issubset(self, s: Iterable[object]) -> bool: ... def issuperset(self, s: Iterable[object]) -> bool: ... - def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... + def symmetric_difference(self, s: Iterable[_T_co]) -> frozenset[_T_co]: ... + def union(self, *s: Iterable[_T_co]) -> frozenset[_T_co]: ... def __len__(self) -> int: ... def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... + def __and__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __or__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... + def __sub__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __xor__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... def __le__(self, s: AbstractSet[object]) -> bool: ... def __lt__(self, s: AbstractSet[object]) -> bool: ... def __ge__(self, s: AbstractSet[object]) -> bool: ... def __gt__(self, s: AbstractSet[object]) -> bool: ... -class enumerate(Iterator[Tuple[int, _T]], Generic[_T]): +class enumerate(Iterator[tuple[int, _T]], Generic[_T]): def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[int, _T]]: ... - def next(self) -> Tuple[int, _T]: ... + def __iter__(self) -> Iterator[tuple[int, _T]]: ... + def next(self) -> tuple[int, _T]: ... class xrange(Sized, Iterable[int], Reversible[int]): @overload @@ -821,29 +815,29 @@ def cmp(__x: Any, __y: Any) -> int: ... _N1 = TypeVar("_N1", bool, int, float, complex) -def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... +def coerce(__x: _N1, __y: _N1) -> tuple[_N1, _N1]: ... def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... def delattr(__obj: Any, __name: Text) -> None: ... -def dir(__o: object = ...) -> List[str]: ... +def dir(__o: object = ...) -> list[str]: ... _N2 = TypeVar("_N2", int, float) -def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ... +def divmod(__x: _N2, __y: _N2) -> tuple[_N2, _N2]: ... def eval( - __source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... + __source: Text | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... ) -> Any: ... -def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ... +def execfile(__filename: str, __globals: dict[str, Any] | None = ..., __locals: dict[str, Any] | None = ...) -> None: ... def exit(code: object = ...) -> NoReturn: ... @overload def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore @overload -def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore +def filter(__function: None, __iterable: tuple[_T | None, ...]) -> tuple[_T, ...]: ... # type: ignore @overload -def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore +def filter(__function: Callable[[_T], Any], __iterable: tuple[_T, ...]) -> tuple[_T, ...]: ... # type: ignore @overload -def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ... +def filter(__function: None, __iterable: Iterable[_T | None]) -> list[_T]: ... @overload -def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... +def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> list[_T]: ... def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode @overload def getattr(__o: Any, name: Text) -> Any: ... @@ -861,7 +855,7 @@ def getattr(__o: object, name: str, __default: list[Any]) -> Any | list[Any]: .. def getattr(__o: object, name: str, __default: dict[Any, Any]) -> Any | dict[Any, Any]: ... @overload def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ... -def globals() -> Dict[str, Any]: ... +def globals() -> dict[str, Any]: ... def hasattr(__obj: Any, __name: Text) -> bool: ... def hash(__obj: object) -> int: ... def hex(__number: int | _SupportsIndex) -> str: ... @@ -874,20 +868,20 @@ def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... @overload def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ... -def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... +def isinstance(__obj: object, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... +def issubclass(__cls: type, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... def len(__obj: Sized) -> int: ... -def locals() -> Dict[str, Any]: ... +def locals() -> dict[str, Any]: ... @overload -def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... +def map(__func: None, __iter1: Iterable[_T1]) -> list[_T1]: ... @overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... +def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[tuple[_T1, _T2]]: ... @overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... +def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> list[tuple[_T1, _T2, _T3]]: ... @overload def map( __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4]]: ... @overload def map( __func: None, @@ -896,7 +890,7 @@ def map( __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def map( __func: None, @@ -907,15 +901,15 @@ def map( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... +) -> list[tuple[Any, ...]]: ... @overload -def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... +def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> list[_S]: ... @overload -def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... +def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3, _T4], _S], @@ -923,7 +917,7 @@ def map( __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], @@ -932,7 +926,7 @@ def map( __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], -) -> List[_S]: ... +) -> list[_S]: ... @overload def map( __func: Callable[..., _S], @@ -943,7 +937,7 @@ def map( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[_S]: ... +) -> list[_S]: ... @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload @@ -983,7 +977,7 @@ def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ... @overload def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ... def quit(code: object = ...) -> NoReturn: ... -def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811 +def range(__x: int, __y: int = ..., __step: int = ...) -> list[int]: ... # noqa: F811 def raw_input(__prompt: Any = ...) -> str: ... @overload def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ... @@ -1006,27 +1000,27 @@ def round(number: SupportsFloat, ndigits: int) -> float: ... def setattr(__obj: Any, __name: Text, __value: Any) -> None: ... def sorted( __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ... -) -> List[_T]: ... +) -> list[_T]: ... @overload def sum(__iterable: Iterable[_T]) -> _T | int: ... @overload def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... def unichr(__i: int) -> unicode: ... -def vars(__object: Any = ...) -> Dict[str, Any]: ... +def vars(__object: Any = ...) -> dict[str, Any]: ... @overload -def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... +def zip(__iter1: Iterable[_T1]) -> list[tuple[_T1]]: ... @overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... +def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> list[tuple[_T1, _T2]]: ... @overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... +def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> list[tuple[_T1, _T2, _T3]]: ... @overload def zip( __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4]]: ... @overload def zip( __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> list[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def zip( __iter1: Iterable[Any], @@ -1036,7 +1030,7 @@ def zip( __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... +) -> list[tuple[Any, ...]]: ... def __import__( name: Text, globals: Mapping[str, Any] | None = ..., @@ -1064,13 +1058,13 @@ class buffer(Sized): def __mul__(self, x: int) -> str: ... class BaseException(object): - args: Tuple[Any, ...] + args: tuple[Any, ...] message: Any def __init__(self, *args: object) -> None: ... def __str__(self) -> str: ... def __repr__(self) -> str: ... def __getitem__(self, i: int) -> Any: ... - def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... + def __getslice__(self, start: int, stop: int) -> tuple[Any, ...]: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... @@ -1179,7 +1173,7 @@ class file(BinaryIO): def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... + def readlines(self, hint: int = ...) -> list[str]: ... def write(self, data: str) -> int: ... def writelines(self, data: Iterable[str]) -> None: ... def truncate(self, pos: int | None = ...) -> int: ... diff --git a/stdlib/@python2/bz2.pyi b/stdlib/@python2/bz2.pyi index fa26410f94c5..bec8994dbe29 100644 --- a/stdlib/@python2/bz2.pyi +++ b/stdlib/@python2/bz2.pyi @@ -1,6 +1,6 @@ import io from _typeshed import ReadableBuffer, Self, WriteableBuffer -from typing import IO, Any, Iterable, List, Text, Union +from typing import IO, Any, Iterable, Text, Union from typing_extensions import SupportsIndex _PathOrFile = Union[Text, IO[bytes]] @@ -15,7 +15,7 @@ class BZ2File(io.BufferedIOBase, IO[bytes]): def read1(self, size: int = ...) -> bytes: ... def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore def readinto(self, b: WriteableBuffer) -> int: ... - def readlines(self, size: SupportsIndex = ...) -> List[bytes]: ... + def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... diff --git a/stdlib/@python2/cPickle.pyi b/stdlib/@python2/cPickle.pyi index d8db140cdda1..9169a8df02b0 100644 --- a/stdlib/@python2/cPickle.pyi +++ b/stdlib/@python2/cPickle.pyi @@ -1,7 +1,7 @@ -from typing import IO, Any, List +from typing import IO, Any HIGHEST_PROTOCOL: int -compatible_formats: List[str] +compatible_formats: list[str] format_version: str class Pickler: diff --git a/stdlib/@python2/cProfile.pyi b/stdlib/@python2/cProfile.pyi index 8c1dce395ad9..2bb063c032a8 100644 --- a/stdlib/@python2/cProfile.pyi +++ b/stdlib/@python2/cProfile.pyi @@ -1,14 +1,14 @@ from _typeshed import Self from types import CodeType -from typing import Any, Callable, Dict, Text, Tuple, TypeVar +from typing import Any, Callable, Text, TypeVar def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... _T = TypeVar("_T") -_Label = Tuple[str, int, str] +_Label = tuple[str, int, str] class Profile: stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented @@ -22,7 +22,7 @@ class Profile: def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... - def runctx(self: Self, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> Self: ... + def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... def label(code: str | CodeType) -> _Label: ... # undocumented diff --git a/stdlib/@python2/cStringIO.pyi b/stdlib/@python2/cStringIO.pyi index 7703e030c332..33a20dd4a739 100644 --- a/stdlib/@python2/cStringIO.pyi +++ b/stdlib/@python2/cStringIO.pyi @@ -1,5 +1,5 @@ from abc import ABCMeta -from typing import IO, Iterable, Iterator, List, overload +from typing import IO, Iterable, Iterator, overload # This class isn't actually abstract, but you can't instantiate it # directly, so we might as well treat it as abstract in the stub. @@ -12,7 +12,7 @@ class InputType(IO[str], Iterator[str], metaclass=ABCMeta): def isatty(self) -> bool: ... def read(self, size: int = ...) -> str: ... def readline(self, size: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... + def readlines(self, hint: int = ...) -> list[str]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... def truncate(self, size: int | None = ...) -> int: ... @@ -31,7 +31,7 @@ class OutputType(IO[str], Iterator[str], metaclass=ABCMeta): def isatty(self) -> bool: ... def read(self, size: int = ...) -> str: ... def readline(self, size: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... + def readlines(self, hint: int = ...) -> list[str]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... def truncate(self, size: int | None = ...) -> int: ... diff --git a/stdlib/@python2/calendar.pyi b/stdlib/@python2/calendar.pyi index ce765210dc1e..cd0ec70a4dd7 100644 --- a/stdlib/@python2/calendar.pyi +++ b/stdlib/@python2/calendar.pyi @@ -1,8 +1,8 @@ import datetime from time import struct_time -from typing import Any, Iterable, List, Optional, Sequence, Tuple +from typing import Any, Iterable, Optional, Sequence -_LocaleType = Tuple[Optional[str], Optional[str]] +_LocaleType = tuple[Optional[str], Optional[str]] class IllegalMonthError(ValueError): def __init__(self, month: int) -> None: ... @@ -15,7 +15,7 @@ class IllegalWeekdayError(ValueError): def isleap(year: int) -> bool: ... def leapdays(y1: int, y2: int) -> int: ... def weekday(year: int, month: int, day: int) -> int: ... -def monthrange(year: int, month: int) -> Tuple[int, int]: ... +def monthrange(year: int, month: int) -> tuple[int, int]: ... class Calendar: firstweekday: int @@ -24,14 +24,14 @@ class Calendar: def setfirstweekday(self, firstweekday: int) -> None: ... def iterweekdays(self) -> Iterable[int]: ... def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ... - def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ... + def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: ... def itermonthdays(self, year: int, month: int) -> Iterable[int]: ... - def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ... - def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ... - def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ... - def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ... - def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ... - def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ... + def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ... + def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ... + def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ... + def yeardatescalendar(self, year: int, width: int = ...) -> list[list[int]]: ... + def yeardays2calendar(self, year: int, width: int = ...) -> list[list[tuple[int, int]]]: ... + def yeardayscalendar(self, year: int, width: int = ...) -> list[list[int]]: ... class TextCalendar(Calendar): def prweek(self, theweek: int, width: int) -> None: ... @@ -46,7 +46,7 @@ class TextCalendar(Calendar): def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... def firstweekday() -> int: ... -def monthcalendar(year: int, month: int) -> List[List[int]]: ... +def monthcalendar(year: int, month: int) -> list[list[int]]: ... def prweek(theweek: int, width: int) -> None: ... def week(theweek: int, width: int) -> str: ... def weekheader(width: int) -> str: ... @@ -85,7 +85,7 @@ c: TextCalendar def setfirstweekday(firstweekday: int) -> None: ... def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... -def timegm(tuple: Tuple[int, ...] | struct_time) -> int: ... +def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... # Data attributes day_name: Sequence[str] diff --git a/stdlib/@python2/cgi.pyi b/stdlib/@python2/cgi.pyi index 2817c3639482..2b2b82a58a43 100644 --- a/stdlib/@python2/cgi.pyi +++ b/stdlib/@python2/cgi.pyi @@ -1,6 +1,6 @@ from _typeshed import SupportsGetItem, SupportsItemAccess -from builtins import type as _type -from typing import IO, Any, AnyStr, Iterable, Iterator, List, Mapping, Protocol +from builtins import list as List, type as _type # aliases to avoid name clashes with `FieldStorage` attributes +from typing import IO, Any, AnyStr, Iterable, Iterator, Mapping, Protocol from UserDict import UserDict def parse( @@ -8,10 +8,10 @@ def parse( environ: SupportsItemAccess[str, str] = ..., keep_blank_values: bool = ..., strict_parsing: bool = ..., -) -> dict[str, List[str]]: ... -def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, List[str]]: ... -def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> List[tuple[str, str]]: ... -def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, List[bytes]]: ... +) -> dict[str, list[str]]: ... +def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, list[str]]: ... +def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... +def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, list[bytes]]: ... class _Environ(Protocol): def __getitem__(self, __k: str) -> str: ... @@ -86,7 +86,7 @@ class FieldStorage(object): # In Python 2 it always returns bytes and ignores the "binary" flag def make_file(self, binary: Any = ...) -> IO[bytes]: ... -class FormContentDict(UserDict[str, List[str]]): +class FormContentDict(UserDict[str, list[str]]): query_string: str def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ... diff --git a/stdlib/@python2/cgitb.pyi b/stdlib/@python2/cgitb.pyi index daa0233ee69a..aff45db6198c 100644 --- a/stdlib/@python2/cgitb.pyi +++ b/stdlib/@python2/cgitb.pyi @@ -1,16 +1,16 @@ from types import FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type +from typing import IO, Any, Callable, Optional, Text -_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +_ExcInfo = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]] def reset() -> str: ... # undocumented def small(text: str) -> str: ... # undocumented def strong(text: str) -> str: ... # undocumented def grey(text: str) -> str: ... # undocumented -def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented +def lookup(name: str, frame: FrameType, locals: dict[str, Any]) -> tuple[str | None, Any]: ... # undocumented def scanvars( - reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any] -) -> List[Tuple[str, str | None, Any]]: ... # undocumented + reader: Callable[[], bytes], frame: FrameType, locals: dict[str, Any] +) -> list[tuple[str, str | None, Any]]: ... # undocumented def html(einfo: _ExcInfo, context: int = ...) -> str: ... def text(einfo: _ExcInfo, context: int = ...) -> str: ... @@ -18,7 +18,7 @@ class Hook: # undocumented def __init__( self, display: int = ..., logdir: Text | None = ..., context: int = ..., file: IO[str] | None = ..., format: str = ... ) -> None: ... - def __call__(self, etype: Type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... + def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... def handle(self, info: _ExcInfo | None = ...) -> None: ... def handler(info: _ExcInfo | None = ...) -> None: ... diff --git a/stdlib/@python2/cmath.pyi b/stdlib/@python2/cmath.pyi index 1e19687b4885..ef54d7f43854 100644 --- a/stdlib/@python2/cmath.pyi +++ b/stdlib/@python2/cmath.pyi @@ -1,4 +1,4 @@ -from typing import SupportsComplex, SupportsFloat, Tuple, Union +from typing import SupportsComplex, SupportsFloat, Union e: float pi: float @@ -18,7 +18,7 @@ def isnan(__z: _C) -> bool: ... def log(__x: _C, __y_obj: _C = ...) -> complex: ... def log10(__z: _C) -> complex: ... def phase(__z: _C) -> float: ... -def polar(__z: _C) -> Tuple[float, float]: ... +def polar(__z: _C) -> tuple[float, float]: ... def rect(__r: float, __phi: float) -> complex: ... def sin(__z: _C) -> complex: ... def sinh(__z: _C) -> complex: ... diff --git a/stdlib/@python2/cmd.pyi b/stdlib/@python2/cmd.pyi index ffccba84ec16..f6d818591a4e 100644 --- a/stdlib/@python2/cmd.pyi +++ b/stdlib/@python2/cmd.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, List, Tuple +from typing import IO, Any, Callable class Cmd: prompt: str @@ -14,7 +14,7 @@ class Cmd: use_rawinput: bool stdin: IO[str] stdout: IO[str] - cmdqueue: List[str] + cmdqueue: list[str] completekey: str def __init__(self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ...) -> None: ... old_completer: Callable[[str, int], str | None] | None @@ -23,17 +23,17 @@ class Cmd: def postcmd(self, stop: bool, line: str) -> bool: ... def preloop(self) -> None: ... def postloop(self) -> None: ... - def parseline(self, line: str) -> Tuple[str | None, str | None, str]: ... + def parseline(self, line: str) -> tuple[str | None, str | None, str]: ... def onecmd(self, line: str) -> bool: ... def emptyline(self) -> bool: ... def default(self, line: str) -> bool: ... - def completedefault(self, *ignored: Any) -> List[str]: ... - def completenames(self, text: str, *ignored: Any) -> List[str]: ... - completion_matches: List[str] | None - def complete(self, text: str, state: int) -> List[str] | None: ... - def get_names(self) -> List[str]: ... + def completedefault(self, *ignored: Any) -> list[str]: ... + def completenames(self, text: str, *ignored: Any) -> list[str]: ... + completion_matches: list[str] | None + def complete(self, text: str, state: int) -> list[str] | None: ... + def get_names(self) -> list[str]: ... # Only the first element of args matters. - def complete_help(self, *args: Any) -> List[str]: ... + def complete_help(self, *args: Any) -> list[str]: ... def do_help(self, arg: str) -> bool | None: ... - def print_topics(self, header: str, cmds: List[str] | None, cmdlen: Any, maxcol: int) -> None: ... - def columnize(self, list: List[str] | None, displaywidth: int = ...) -> None: ... + def print_topics(self, header: str, cmds: list[str] | None, cmdlen: Any, maxcol: int) -> None: ... + def columnize(self, list: list[str] | None, displaywidth: int = ...) -> None: ... diff --git a/stdlib/@python2/codecs.pyi b/stdlib/@python2/codecs.pyi index 3ba91b373709..339578ca1ae7 100644 --- a/stdlib/@python2/codecs.pyi +++ b/stdlib/@python2/codecs.pyi @@ -1,23 +1,7 @@ import types from _typeshed import Self from abc import abstractmethod -from typing import ( - IO, - Any, - BinaryIO, - Callable, - Generator, - Iterable, - Iterator, - List, - Protocol, - Text, - TextIO, - Tuple, - Type, - Union, - overload, -) +from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, Text, TextIO, Union, overload from typing_extensions import Literal # TODO: this only satisfies the most common interface, where @@ -30,10 +14,10 @@ _Decoded = Text _Encoded = bytes class _Encoder(Protocol): - def __call__(self, input: _Decoded, errors: str = ...) -> Tuple[_Encoded, int]: ... # signature of Codec().encode + def __call__(self, input: _Decoded, errors: str = ...) -> tuple[_Encoded, int]: ... # signature of Codec().encode class _Decoder(Protocol): - def __call__(self, input: _Encoded, errors: str = ...) -> Tuple[_Decoded, int]: ... # signature of Codec().decode + def __call__(self, input: _Encoded, errors: str = ...) -> tuple[_Decoded, int]: ... # signature of Codec().decode class _StreamReader(Protocol): def __call__(self, stream: IO[_Encoded], errors: str = ...) -> StreamReader: ... @@ -83,10 +67,10 @@ def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: . def lookup(__encoding: str) -> CodecInfo: ... def utf_16_be_decode( __data: _Encoded, __errors: str | None = ..., __final: bool = ... -) -> Tuple[_Decoded, int]: ... # undocumented -def utf_16_be_encode(__str: _Decoded, __errors: str | None = ...) -> Tuple[_Encoded, int]: ... # undocumented +) -> tuple[_Decoded, int]: ... # undocumented +def utf_16_be_encode(__str: _Decoded, __errors: str | None = ...) -> tuple[_Encoded, int]: ... # undocumented -class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): +class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): @property def encode(self) -> _Encoder: ... @property @@ -141,19 +125,19 @@ BOM_UTF32_LE: bytes # It is expected that different actions be taken depending on which of the # three subclasses of `UnicodeError` is actually ...ed. However, the Union # is still needed for at least one of the cases. -def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[str | bytes, int]]) -> None: ... -def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[str | bytes, int]]: ... -def strict_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def replace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def ignore_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def backslashreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... +def register_error(__errors: str, __handler: Callable[[UnicodeError], tuple[str | bytes, int]]) -> None: ... +def lookup_error(__name: str) -> Callable[[UnicodeError], tuple[str | bytes, int]]: ... +def strict_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def replace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def ignore_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def xmlcharrefreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def backslashreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... class Codec: # These are sort of @abstractmethod but sort of not. # The StreamReader and StreamWriter subclasses only implement one. - def encode(self, input: _Decoded, errors: str = ...) -> Tuple[_Encoded, int]: ... - def decode(self, input: _Encoded, errors: str = ...) -> Tuple[_Decoded, int]: ... + def encode(self, input: _Decoded, errors: str = ...) -> tuple[_Encoded, int]: ... + def decode(self, input: _Encoded, errors: str = ...) -> tuple[_Decoded, int]: ... class IncrementalEncoder: errors: str @@ -171,8 +155,8 @@ class IncrementalDecoder: @abstractmethod def decode(self, input: _Encoded, final: bool = ...) -> _Decoded: ... def reset(self) -> None: ... - def getstate(self) -> Tuple[_Encoded, int]: ... - def setstate(self, state: Tuple[_Encoded, int]) -> None: ... + def getstate(self) -> tuple[_Encoded, int]: ... + def setstate(self, state: tuple[_Encoded, int]) -> None: ... # These are not documented but used in encodings/*.py implementations. class BufferedIncrementalEncoder(IncrementalEncoder): @@ -186,7 +170,7 @@ class BufferedIncrementalDecoder(IncrementalDecoder): buffer: bytes def __init__(self, errors: str = ...) -> None: ... @abstractmethod - def _buffer_decode(self, input: _Encoded, errors: str, final: bool) -> Tuple[_Decoded, int]: ... + def _buffer_decode(self, input: _Encoded, errors: str, final: bool) -> tuple[_Decoded, int]: ... def decode(self, input: _Encoded, final: bool = ...) -> _Decoded: ... # TODO: it is not possible to specify the requirement that all other @@ -198,7 +182,7 @@ class StreamWriter(Codec): def writelines(self, list: Iterable[_Decoded]) -> None: ... def reset(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... class StreamReader(Codec): @@ -206,10 +190,10 @@ class StreamReader(Codec): def __init__(self, stream: IO[_Encoded], errors: str = ...) -> None: ... def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> _Decoded: ... def readline(self, size: int | None = ..., keepends: bool = ...) -> _Decoded: ... - def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> List[_Decoded]: ... + def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> list[_Decoded]: ... def reset(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... def __iter__(self) -> Iterator[_Decoded]: ... def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... @@ -219,7 +203,7 @@ class StreamReaderWriter(TextIO): def __init__(self, stream: IO[_Encoded], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... def read(self, size: int = ...) -> _Decoded: ... def readline(self, size: int | None = ...) -> _Decoded: ... - def readlines(self, sizehint: int | None = ...) -> List[_Decoded]: ... + def readlines(self, sizehint: int | None = ...) -> list[_Decoded]: ... def next(self) -> Text: ... def __iter__(self: Self) -> Self: ... # This actually returns None, but that's incompatible with the supertype @@ -229,7 +213,7 @@ class StreamReaderWriter(TextIO): # Same as write() def seek(self, offset: int, whence: int = ...) -> int: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... # These methods don't actually exist directly, but they are needed to satisfy the TextIO # interface. At runtime, they are delegated through __getattr__. @@ -255,7 +239,7 @@ class StreamRecoder(BinaryIO): ) -> None: ... def read(self, size: int = ...) -> bytes: ... def readline(self, size: int | None = ...) -> bytes: ... - def readlines(self, sizehint: int | None = ...) -> List[bytes]: ... + def readlines(self, sizehint: int | None = ...) -> list[bytes]: ... def next(self) -> bytes: ... def __iter__(self: Self) -> Self: ... def write(self, data: bytes) -> int: ... @@ -263,7 +247,7 @@ class StreamRecoder(BinaryIO): def reset(self) -> None: ... def __getattr__(self, name: str) -> Any: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... # These methods don't actually exist directly, but they are needed to satisfy the BinaryIO # interface. At runtime, they are delegated through __getattr__. def seek(self, offset: int, whence: int = ...) -> int: ... diff --git a/stdlib/@python2/collections.pyi b/stdlib/@python2/collections.pyi index 36a9a48cf0ff..706e8624caac 100644 --- a/stdlib/@python2/collections.pyi +++ b/stdlib/@python2/collections.pyi @@ -4,14 +4,12 @@ from typing import ( Any, Callable as Callable, Container as Container, - Dict, Generic, Hashable as Hashable, ItemsView as ItemsView, Iterable as Iterable, Iterator as Iterator, KeysView as KeysView, - List, Mapping as Mapping, MappingView as MappingView, MutableMapping as MutableMapping, @@ -20,8 +18,6 @@ from typing import ( Reversible, Sequence as Sequence, Sized as Sized, - Tuple, - Type, TypeVar, ValuesView as ValuesView, overload, @@ -36,7 +32,7 @@ _VT = TypeVar("_VT") # namedtuple is special-cased in the type checker; the initializer is ignored. def namedtuple( typename: str | unicode, field_names: str | unicode | Iterable[str | unicode], verbose: bool = ..., rename: bool = ... -) -> Type[Tuple[Any, ...]]: ... +) -> type[tuple[Any, ...]]: ... class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ... @@ -63,7 +59,7 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): def __reversed__(self) -> Iterator[_T]: ... def __iadd__(self: Self, iterable: Iterable[_T]) -> Self: ... -class Counter(Dict[_T, int], Generic[_T]): +class Counter(dict[_T, int], Generic[_T]): @overload def __init__(self, **kwargs: int) -> None: ... @overload @@ -72,7 +68,7 @@ class Counter(Dict[_T, int], Generic[_T]): def __init__(self, iterable: Iterable[_T]) -> None: ... def copy(self: Self) -> Self: ... def elements(self) -> Iterator[_T]: ... - def most_common(self, n: int | None = ...) -> List[Tuple[_T, int]]: ... + def most_common(self, n: int | None = ...) -> list[tuple[_T, int]]: ... @overload def subtract(self, __mapping: Mapping[_T, int]) -> None: ... @overload @@ -85,7 +81,7 @@ class Counter(Dict[_T, int], Generic[_T]): @overload def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ... @overload - def update(self, __m: Iterable[_T] | Iterable[Tuple[_T, int]], **kwargs: int) -> None: ... + def update(self, __m: Iterable[_T] | Iterable[tuple[_T, int]], **kwargs: int) -> None: ... @overload def update(self, **kwargs: int) -> None: ... def __add__(self, other: Counter[_T]) -> Counter[_T]: ... @@ -97,12 +93,12 @@ class Counter(Dict[_T, int], Generic[_T]): def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... -class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): - def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ... +class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): + def popitem(self, last: bool = ...) -> tuple[_KT, _VT]: ... def copy(self: Self) -> Self: ... def __reversed__(self) -> Iterator[_KT]: ... -class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): +class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]): default_factory: Callable[[], _VT] @overload def __init__(self, **kwargs: _VT) -> None: ... @@ -115,8 +111,8 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): @overload def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[tuple[_KT, _VT]]) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... def __missing__(self, key: _KT) -> _VT: ... def copy(self: Self) -> Self: ... diff --git a/stdlib/@python2/colorsys.pyi b/stdlib/@python2/colorsys.pyi index 8db2e2c9ab3a..00c5f9d22cb1 100644 --- a/stdlib/@python2/colorsys.pyi +++ b/stdlib/@python2/colorsys.pyi @@ -1,11 +1,9 @@ -from typing import Tuple - -def rgb_to_yiq(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def yiq_to_rgb(y: float, i: float, q: float) -> Tuple[float, float, float]: ... -def rgb_to_hls(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hls_to_rgb(h: float, l: float, s: float) -> Tuple[float, float, float]: ... -def rgb_to_hsv(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hsv_to_rgb(h: float, s: float, v: float) -> Tuple[float, float, float]: ... +def rgb_to_yiq(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def yiq_to_rgb(y: float, i: float, q: float) -> tuple[float, float, float]: ... +def rgb_to_hls(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def hls_to_rgb(h: float, l: float, s: float) -> tuple[float, float, float]: ... +def rgb_to_hsv(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ... # TODO undocumented ONE_SIXTH: float diff --git a/stdlib/@python2/commands.pyi b/stdlib/@python2/commands.pyi index 970d6ccf2032..2c36033583ec 100644 --- a/stdlib/@python2/commands.pyi +++ b/stdlib/@python2/commands.pyi @@ -1,8 +1,8 @@ -from typing import AnyStr, Text, Tuple, overload +from typing import AnyStr, Text, overload def getstatus(file: Text) -> str: ... def getoutput(cmd: Text) -> str: ... -def getstatusoutput(cmd: Text) -> Tuple[int, str]: ... +def getstatusoutput(cmd: Text) -> tuple[int, str]: ... @overload def mk2arg(head: bytes, x: bytes) -> bytes: ... @overload diff --git a/stdlib/@python2/contextlib.pyi b/stdlib/@python2/contextlib.pyi index 673cdc434d12..6cb18831fc17 100644 --- a/stdlib/@python2/contextlib.pyi +++ b/stdlib/@python2/contextlib.pyi @@ -1,11 +1,11 @@ from types import TracebackType -from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Protocol, Type, TypeVar +from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Protocol, TypeVar _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) _F = TypeVar("_F", bound=Callable[..., Any]) -_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool] +_ExitFunc = Callable[[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool] class GeneratorContextManager(ContextManager[_T_co]): def __call__(self, func: _F) -> _F: ... diff --git a/stdlib/@python2/copy.pyi b/stdlib/@python2/copy.pyi index c88f92846ddf..a5f9420e3811 100644 --- a/stdlib/@python2/copy.pyi +++ b/stdlib/@python2/copy.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, TypeVar +from typing import Any, TypeVar _T = TypeVar("_T") @@ -6,7 +6,7 @@ _T = TypeVar("_T") PyStringMap: Any # Note: memo and _nil are internal kwargs. -def deepcopy(x: _T, memo: Dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... +def deepcopy(x: _T, memo: dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... def copy(x: _T) -> _T: ... class Error(Exception): ... diff --git a/stdlib/@python2/copy_reg.pyi b/stdlib/@python2/copy_reg.pyi index 91b099888bab..f6fe5cd28582 100644 --- a/stdlib/@python2/copy_reg.pyi +++ b/stdlib/@python2/copy_reg.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union +from typing import Any, Callable, Hashable, Optional, SupportsInt, TypeVar, Union _TypeT = TypeVar("_TypeT", bound=type) -_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] +_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Optional[Any]]] -__all__: List[str] +__all__: list[str] def pickle( ob_type: _TypeT, diff --git a/stdlib/@python2/copyreg.pyi b/stdlib/@python2/copyreg.pyi index 91b099888bab..f6fe5cd28582 100644 --- a/stdlib/@python2/copyreg.pyi +++ b/stdlib/@python2/copyreg.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union +from typing import Any, Callable, Hashable, Optional, SupportsInt, TypeVar, Union _TypeT = TypeVar("_TypeT", bound=type) -_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] +_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Optional[Any]]] -__all__: List[str] +__all__: list[str] def pickle( ob_type: _TypeT, diff --git a/stdlib/@python2/csv.pyi b/stdlib/@python2/csv.pyi index 886de6210ca9..a52db42291af 100644 --- a/stdlib/@python2/csv.pyi +++ b/stdlib/@python2/csv.pyi @@ -16,20 +16,8 @@ from _csv import ( unregister_dialect as unregister_dialect, writer as writer, ) -from typing import ( - Any, - Dict as _DictReadMapping, - Generic, - Iterable, - Iterator, - List, - Mapping, - Sequence, - Text, - Type, - TypeVar, - overload, -) +from builtins import dict as _DictReadMapping +from typing import Any, Generic, Iterable, Iterator, Mapping, Sequence, Text, TypeVar, overload _T = TypeVar("_T") @@ -96,7 +84,7 @@ class DictWriter(Generic[_T]): def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ... class Sniffer(object): - preferred: List[str] + preferred: list[str] def __init__(self) -> None: ... - def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ... + def sniff(self, sample: str, delimiters: str | None = ...) -> type[Dialect]: ... def has_header(self, sample: str) -> bool: ... diff --git a/stdlib/@python2/ctypes/__init__.pyi b/stdlib/@python2/ctypes/__init__.pyi index 55b12cd42ce8..3d659a5e2d4f 100644 --- a/stdlib/@python2/ctypes/__init__.pyi +++ b/stdlib/@python2/ctypes/__init__.pyi @@ -7,13 +7,10 @@ from typing import ( Generic, Iterable, Iterator, - List, Mapping, Optional, Sequence, Text, - Tuple, - Type, TypeVar, Union as _UnionT, overload, @@ -32,7 +29,7 @@ class CDLL(object): _func_restype_: ClassVar[_CData] = ... _name: str = ... _handle: int = ... - _FuncPtr: Type[_FuncPointer] = ... + _FuncPtr: type[_FuncPointer] = ... def __init__( self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ... ) -> None: ... @@ -46,7 +43,7 @@ if sys.platform == "win32": class PyDLL(CDLL): ... class LibraryLoader(Generic[_DLLT]): - def __init__(self, dlltype: Type[_DLLT]) -> None: ... + def __init__(self, dlltype: type[_DLLT]) -> None: ... def __getattr__(self, name: str) -> _DLLT: ... def __getitem__(self, name: str) -> _DLLT: ... def LoadLibrary(self, name: str) -> _DLLT: ... @@ -69,42 +66,42 @@ class _CDataMeta(type): # By default mypy complains about the following two methods, because strictly speaking cls # might not be a Type[_CT]. However this can never actually happen, because the only class that # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. - def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore - def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore class _CData(metaclass=_CDataMeta): _b_base: int = ... _b_needsfree_: bool = ... _objects: Mapping[Any, int] | None = ... @classmethod - def from_buffer(cls: Type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ... + def from_buffer(cls: type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ... @classmethod - def from_buffer_copy(cls: Type[_CT], source: _ReadOnlyBuffer, offset: int = ...) -> _CT: ... + def from_buffer_copy(cls: type[_CT], source: _ReadOnlyBuffer, offset: int = ...) -> _CT: ... @classmethod - def from_address(cls: Type[_CT], address: int) -> _CT: ... + def from_address(cls: type[_CT], address: int) -> _CT: ... @classmethod - def from_param(cls: Type[_CT], obj: Any) -> _UnionT[_CT, _CArgObject]: ... + def from_param(cls: type[_CT], obj: Any) -> _UnionT[_CT, _CArgObject]: ... @classmethod - def in_dll(cls: Type[_CT], library: CDLL, name: str) -> _CT: ... + def in_dll(cls: type[_CT], library: CDLL, name: str) -> _CT: ... class _CanCastTo(_CData): ... class _PointerLike(_CanCastTo): ... -_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CData] -_PF = _UnionT[Tuple[int], Tuple[int, str], Tuple[int, str, Any]] +_ECT = Callable[[Optional[type[_CData]], _FuncPointer, tuple[_CData, ...]], _CData] +_PF = _UnionT[tuple[int], tuple[int, str], tuple[int, str, Any]] class _FuncPointer(_PointerLike, _CData): - restype: _UnionT[Type[_CData], Callable[[int], Any], None] = ... - argtypes: Sequence[Type[_CData]] = ... + restype: _UnionT[type[_CData], Callable[[int], Any], None] = ... + argtypes: Sequence[type[_CData]] = ... errcheck: _ECT = ... @overload def __init__(self, address: int) -> None: ... @overload def __init__(self, callable: Callable[..., Any]) -> None: ... @overload - def __init__(self, func_spec: Tuple[_UnionT[str, int], CDLL], paramflags: Tuple[_PF, ...] = ...) -> None: ... + def __init__(self, func_spec: tuple[_UnionT[str, int], CDLL], paramflags: tuple[_PF, ...] = ...) -> None: ... @overload - def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[_PF, ...] = ..., iid: pointer[c_int] = ...) -> None: ... + def __init__(self, vtlb_index: int, name: str, paramflags: tuple[_PF, ...] = ..., iid: pointer[c_int] = ...) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class _NamedFuncPointer(_FuncPointer): @@ -113,15 +110,15 @@ class _NamedFuncPointer(_FuncPointer): class ArgumentError(Exception): ... def CFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... -) -> Type[_FuncPointer]: ... + restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... +) -> type[_FuncPointer]: ... if sys.platform == "win32": def WINFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... - ) -> Type[_FuncPointer]: ... + restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... + ) -> type[_FuncPointer]: ... -def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ... +def PYFUNCTYPE(restype: type[_CData] | None, *argtypes: type[_CData]) -> type[_FuncPointer]: ... class _CArgObject: ... @@ -135,12 +132,12 @@ _CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int] _CVoidConstPLike = _UnionT[_CVoidPLike, bytes] def addressof(obj: _CData) -> int: ... -def alignment(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... +def alignment(obj_or_type: _UnionT[_CData, type[_CData]]) -> int: ... def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... _CastT = TypeVar("_CastT", bound=_CanCastTo) -def cast(obj: _UnionT[_CData, _CArgObject, int], typ: Type[_CastT]) -> _CastT: ... +def cast(obj: _UnionT[_CData, _CArgObject, int], typ: type[_CastT]) -> _CastT: ... def create_string_buffer(init: _UnionT[int, bytes], size: int | None = ...) -> Array[c_char]: ... c_buffer = create_string_buffer @@ -160,32 +157,32 @@ if sys.platform == "win32": def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> None: ... def memset(dst: _CVoidPLike, c: int, count: int) -> None: ... -def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ... +def POINTER(type: type[_CT]) -> type[pointer[_CT]]: ... # The real ctypes.pointer is a function, not a class. The stub version of pointer behaves like # ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer, # it can be instantiated directly (to mimic the behavior of the real pointer function). class pointer(Generic[_CT], _PointerLike, _CData): - _type_: Type[_CT] = ... + _type_: type[_CT] = ... contents: _CT = ... def __init__(self, arg: _CT = ...) -> None: ... @overload def __getitem__(self, i: int) -> _CT: ... @overload - def __getitem__(self, s: slice) -> List[_CT]: ... + def __getitem__(self, s: slice) -> list[_CT]: ... @overload def __setitem__(self, i: int, o: _CT) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[_CT]) -> None: ... def resize(obj: _CData, size: int) -> None: ... -def set_conversion_mode(encoding: str, errors: str) -> Tuple[str, str]: ... +def set_conversion_mode(encoding: str, errors: str) -> tuple[str, str]: ... def set_errno(value: int) -> int: ... if sys.platform == "win32": def set_last_error(value: int) -> int: ... -def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... +def sizeof(obj_or_type: _UnionT[_CData, type[_CData]]) -> int: ... def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ... if sys.platform == "win32": @@ -246,7 +243,7 @@ class _CField: size: int = ... class _StructUnionMeta(_CDataMeta): - _fields_: Sequence[_UnionT[Tuple[str, Type[_CData]], Tuple[str, Type[_CData], int]]] = ... + _fields_: Sequence[_UnionT[tuple[str, type[_CData]], tuple[str, type[_CData], int]]] = ... _pack_: int = ... _anonymous_: Sequence[str] = ... def __getattr__(self, name: str) -> _CField: ... @@ -263,7 +260,7 @@ class LittleEndianStructure(Structure): ... class Array(Generic[_CT], _CData): _length_: int = ... - _type_: Type[_CT] = ... + _type_: type[_CT] = ... raw: bytes = ... # Note: only available if _CT == c_char value: Any = ... # Note: bytes if _CT == c_char, Text if _CT == c_wchar, unavailable otherwise # TODO These methods cannot be annotated correctly at the moment. @@ -282,7 +279,7 @@ class Array(Generic[_CT], _CData): @overload def __getitem__(self, i: int) -> Any: ... @overload - def __getitem__(self, s: slice) -> List[Any]: ... + def __getitem__(self, s: slice) -> list[Any]: ... @overload def __setitem__(self, i: int, o: Any) -> None: ... @overload diff --git a/stdlib/@python2/curses/ascii.pyi b/stdlib/@python2/curses/ascii.pyi index 05efb326687a..66efbe36a7df 100644 --- a/stdlib/@python2/curses/ascii.pyi +++ b/stdlib/@python2/curses/ascii.pyi @@ -1,4 +1,4 @@ -from typing import List, TypeVar +from typing import TypeVar _CharT = TypeVar("_CharT", str, int) @@ -39,7 +39,7 @@ US: int SP: int DEL: int -controlnames: List[int] +controlnames: list[int] def isalnum(c: str | int) -> bool: ... def isalpha(c: str | int) -> bool: ... diff --git a/stdlib/@python2/datetime.pyi b/stdlib/@python2/datetime.pyi index 8b19a3d316f2..8c805e96e1eb 100644 --- a/stdlib/@python2/datetime.pyi +++ b/stdlib/@python2/datetime.pyi @@ -1,5 +1,5 @@ from time import struct_time -from typing import AnyStr, ClassVar, SupportsAbs, Tuple, Type, TypeVar, Union, overload +from typing import AnyStr, ClassVar, SupportsAbs, TypeVar, Union, overload _S = TypeVar("_S") @@ -20,13 +20,13 @@ class date: min: ClassVar[date] max: ClassVar[date] resolution: ClassVar[timedelta] - def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ... + def __new__(cls: type[_S], year: int, month: int, day: int) -> _S: ... @classmethod - def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ... + def fromtimestamp(cls: type[_S], __timestamp: float) -> _S: ... @classmethod - def today(cls: Type[_S]) -> _S: ... + def today(cls: type[_S]) -> _S: ... @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... + def fromordinal(cls: type[_S], n: int) -> _S: ... @property def year(self) -> int: ... @property @@ -53,14 +53,14 @@ class date: def __hash__(self) -> int: ... def weekday(self) -> int: ... def isoweekday(self) -> int: ... - def isocalendar(self) -> Tuple[int, int, int]: ... + def isocalendar(self) -> tuple[int, int, int]: ... class time: min: ClassVar[time] max: ClassVar[time] resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ... + cls: type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ... ) -> _S: ... @property def hour(self) -> int: ... @@ -95,7 +95,7 @@ class timedelta(SupportsAbs[timedelta]): max: ClassVar[timedelta] resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], + cls: type[_S], days: float = ..., seconds: float = ..., microseconds: float = ..., @@ -139,7 +139,7 @@ class datetime(date): max: ClassVar[datetime] resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], + cls: type[_S], year: int, month: int, day: int, @@ -166,21 +166,21 @@ class datetime(date): @property def tzinfo(self) -> _tzinfo | None: ... @classmethod - def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ... + def fromtimestamp(cls: type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ... @classmethod - def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ... + def utcfromtimestamp(cls: type[_S], t: float) -> _S: ... @classmethod - def today(cls: Type[_S]) -> _S: ... + def today(cls: type[_S]) -> _S: ... @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... + def fromordinal(cls: type[_S], n: int) -> _S: ... @overload @classmethod - def now(cls: Type[_S], tz: None = ...) -> _S: ... + def now(cls: type[_S], tz: None = ...) -> _S: ... @overload @classmethod def now(cls, tz: _tzinfo) -> datetime: ... @classmethod - def utcnow(cls: Type[_S]) -> _S: ... + def utcnow(cls: type[_S]) -> _S: ... @classmethod def combine(cls, date: _date, time: _time) -> datetime: ... def strftime(self, fmt: _Text) -> str: ... @@ -223,4 +223,4 @@ class datetime(date): def __hash__(self) -> int: ... def weekday(self) -> int: ... def isoweekday(self) -> int: ... - def isocalendar(self) -> Tuple[int, int, int]: ... + def isocalendar(self) -> tuple[int, int, int]: ... diff --git a/stdlib/@python2/dbm/__init__.pyi b/stdlib/@python2/dbm/__init__.pyi index 95f6d9cf0363..738c60792a4e 100644 --- a/stdlib/@python2/dbm/__init__.pyi +++ b/stdlib/@python2/dbm/__init__.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import Iterator, MutableMapping, Tuple, Type, Union +from typing import Iterator, MutableMapping, Union from typing_extensions import Literal _KeyType = Union[str, bytes] @@ -15,12 +15,12 @@ class _Database(MutableMapping[_KeyType, bytes]): def __del__(self) -> None: ... def __enter__(self) -> _Database: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... class _error(Exception): ... -error = Tuple[Type[_error], Type[OSError]] +error = tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... def open(file: str, flag: Literal["r", "w", "c", "n"] = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/@python2/dbm/dumb.pyi b/stdlib/@python2/dbm/dumb.pyi index fb5e2da5fa2c..163ceb53d685 100644 --- a/stdlib/@python2/dbm/dumb.pyi +++ b/stdlib/@python2/dbm/dumb.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import Iterator, MutableMapping, Type, Union +from typing import Iterator, MutableMapping, Union _KeyType = Union[str, bytes] _ValueType = Union[str, bytes] @@ -19,7 +19,7 @@ class _Database(MutableMapping[_KeyType, bytes]): def __del__(self) -> None: ... def __enter__(self) -> _Database: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/@python2/dbm/gnu.pyi b/stdlib/@python2/dbm/gnu.pyi index 0e9339bf81f9..b8b10cb62b3e 100644 --- a/stdlib/@python2/dbm/gnu.pyi +++ b/stdlib/@python2/dbm/gnu.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import List, Type, TypeVar, Union, overload +from typing import TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] @@ -20,13 +20,13 @@ class _gdbm: def __len__(self) -> int: ... def __enter__(self) -> _gdbm: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @overload def get(self, k: _KeyType) -> bytes | None: ... @overload def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... + def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime __new__: None # type: ignore diff --git a/stdlib/@python2/dbm/ndbm.pyi b/stdlib/@python2/dbm/ndbm.pyi index caeeecb27104..dec50baaaaf4 100644 --- a/stdlib/@python2/dbm/ndbm.pyi +++ b/stdlib/@python2/dbm/ndbm.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import List, Type, TypeVar, Union, overload +from typing import TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] @@ -19,13 +19,13 @@ class _dbm: def __del__(self) -> None: ... def __enter__(self) -> _dbm: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @overload def get(self, k: _KeyType) -> bytes | None: ... @overload def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... + def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime __new__: None # type: ignore diff --git a/stdlib/@python2/decimal.pyi b/stdlib/@python2/decimal.pyi index 915bddadb584..dfdb6577c894 100644 --- a/stdlib/@python2/decimal.pyi +++ b/stdlib/@python2/decimal.pyi @@ -1,14 +1,14 @@ from types import TracebackType -from typing import Any, Container, Dict, List, NamedTuple, Sequence, Text, Tuple, Type, TypeVar, Union +from typing import Any, Container, NamedTuple, Sequence, Text, TypeVar, Union _Decimal = Union[Decimal, int] -_DecimalNew = Union[Decimal, float, Text, Tuple[int, Sequence[int], int]] +_DecimalNew = Union[Decimal, float, Text, tuple[int, Sequence[int], int]] _ComparableNum = Union[Decimal, float] _DecimalT = TypeVar("_DecimalT", bound=Decimal) class DecimalTuple(NamedTuple): sign: int - digits: Tuple[int, ...] + digits: tuple[int, ...] exponent: int ROUND_DOWN: str @@ -41,7 +41,7 @@ def getcontext() -> Context: ... def localcontext(ctx: Context | None = ...) -> _ContextManager: ... class Decimal(object): - def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ... + def __new__(cls: type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ... @classmethod def from_float(cls, __f: float) -> Decimal: ... def __nonzero__(self) -> bool: ... @@ -54,7 +54,7 @@ class Decimal(object): def to_eng_string(self, context: Context | None = ...) -> str: ... def __abs__(self, round: bool = ..., context: Context | None = ...) -> Decimal: ... def __add__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __divmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ... + def __divmod__(self, other: _Decimal, context: Context | None = ...) -> tuple[Decimal, Decimal]: ... def __eq__(self, other: object, context: Context | None = ...) -> bool: ... def __floordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def __ge__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ... @@ -67,7 +67,7 @@ class Decimal(object): def __pos__(self, context: Context | None = ...) -> Decimal: ... def __pow__(self, other: _Decimal, modulo: _Decimal | None = ..., context: Context | None = ...) -> Decimal: ... def __radd__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rdivmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ... + def __rdivmod__(self, other: _Decimal, context: Context | None = ...) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def __rmod__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def __rmul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... @@ -136,7 +136,7 @@ class Decimal(object): def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ... + def __reduce__(self) -> tuple[type[Decimal], tuple[str]]: ... def __copy__(self) -> Decimal: ... def __deepcopy__(self, memo: Any) -> Decimal: ... def __format__(self, specifier: str, context: Context | None = ...) -> str: ... @@ -146,9 +146,9 @@ class _ContextManager(object): saved_context: Context def __init__(self, new_context: Context) -> None: ... def __enter__(self) -> Context: ... - def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... -_TrapType = Type[DecimalException] +_TrapType = type[DecimalException] class Context(object): prec: int @@ -157,19 +157,19 @@ class Context(object): Emax: int capitals: int _clamp: int - traps: Dict[_TrapType, bool] - flags: Dict[_TrapType, bool] + traps: dict[_TrapType, bool] + flags: dict[_TrapType, bool] def __init__( self, prec: int | None = ..., rounding: str | None = ..., - traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., - flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., + traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., + flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., Emin: int | None = ..., Emax: int | None = ..., capitals: int | None = ..., _clamp: int | None = ..., - _ignored_flags: List[_TrapType] | None = ..., + _ignored_flags: list[_TrapType] | None = ..., ) -> None: ... def clear_flags(self) -> None: ... def copy(self) -> Context: ... @@ -192,7 +192,7 @@ class Context(object): def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divmod(self, __x: _Decimal, __y: _Decimal) -> Tuple[Decimal, Decimal]: ... + def divmod(self, __x: _Decimal, __y: _Decimal) -> tuple[Decimal, Decimal]: ... def exp(self, __x: _Decimal) -> Decimal: ... def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ... def is_canonical(self, __x: _Decimal) -> bool: ... diff --git a/stdlib/@python2/difflib.pyi b/stdlib/@python2/difflib.pyi index 41ffc6a286d1..c4e59f54c66d 100644 --- a/stdlib/@python2/difflib.pyi +++ b/stdlib/@python2/difflib.pyi @@ -1,19 +1,4 @@ -from typing import ( - Any, - AnyStr, - Callable, - Generic, - Iterable, - Iterator, - List, - NamedTuple, - Sequence, - Text, - Tuple, - TypeVar, - Union, - overload, -) +from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Text, TypeVar, Union, overload _T = TypeVar("_T") @@ -35,9 +20,9 @@ class SequenceMatcher(Generic[_T]): def set_seq1(self, a: Sequence[_T]) -> None: ... def set_seq2(self, b: Sequence[_T]) -> None: ... def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... - def get_matching_blocks(self) -> List[Match]: ... - def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ... + def get_matching_blocks(self) -> list[Match]: ... + def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ... + def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[tuple[str, int, int, int, int]]]: ... def ratio(self) -> float: ... def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... @@ -46,11 +31,11 @@ class SequenceMatcher(Generic[_T]): @overload def get_close_matches( # type: ignore word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ... -) -> List[AnyStr]: ... +) -> list[AnyStr]: ... @overload def get_close_matches( word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... -) -> List[Sequence[_T]]: ... +) -> list[Sequence[_T]]: ... class Differ: def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ... diff --git a/stdlib/@python2/dircache.pyi b/stdlib/@python2/dircache.pyi index 366909d87133..dc1e129648e8 100644 --- a/stdlib/@python2/dircache.pyi +++ b/stdlib/@python2/dircache.pyi @@ -1,7 +1,7 @@ -from typing import List, MutableSequence, Text +from typing import MutableSequence, Text def reset() -> None: ... -def listdir(path: Text) -> List[str]: ... +def listdir(path: Text) -> list[str]: ... opendir = listdir diff --git a/stdlib/@python2/dis.pyi b/stdlib/@python2/dis.pyi index 1d6537667a60..f6be1a8dfa83 100644 --- a/stdlib/@python2/dis.pyi +++ b/stdlib/@python2/dis.pyi @@ -13,17 +13,17 @@ from opcode import ( opmap as opmap, opname as opname, ) -from typing import Any, Callable, Dict, Iterator, List, Tuple, Union +from typing import Any, Callable, Iterator, Union # Strictly this should not have to include Callable, but mypy doesn't use FunctionType # for functions (python/mypy#3171) _have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]] _have_code_or_string = Union[_have_code, str, bytes] -COMPILER_FLAG_NAMES: Dict[int, str] +COMPILER_FLAG_NAMES: dict[int, str] -def findlabels(code: _have_code) -> List[int]: ... -def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ... +def findlabels(code: _have_code) -> list[int]: ... +def findlinestarts(code: _have_code) -> Iterator[tuple[int, int]]: ... def dis(x: _have_code_or_string = ...) -> None: ... def distb(tb: types.TracebackType = ...) -> None: ... def disassemble(co: _have_code, lasti: int = ...) -> None: ... diff --git a/stdlib/@python2/distutils/ccompiler.pyi b/stdlib/@python2/distutils/ccompiler.pyi index b0539bf9e5dc..7c7023ed0b65 100644 --- a/stdlib/@python2/distutils/ccompiler.pyi +++ b/stdlib/@python2/distutils/ccompiler.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union -_Macro = Union[Tuple[str], Tuple[str, Optional[str]]] +_Macro = Union[tuple[str], tuple[str, Optional[str]]] def gen_lib_options( - compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str] -) -> List[str]: ... -def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ... + compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str] +) -> list[str]: ... +def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ... def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ... def new_compiler( plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ... @@ -17,34 +17,34 @@ class CCompiler: force: bool verbose: bool output_dir: str | None - macros: List[_Macro] - include_dirs: List[str] - libraries: List[str] - library_dirs: List[str] - runtime_library_dirs: List[str] - objects: List[str] + macros: list[_Macro] + include_dirs: list[str] + libraries: list[str] + library_dirs: list[str] + runtime_library_dirs: list[str] + objects: list[str] def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... def add_include_dir(self, dir: str) -> None: ... - def set_include_dirs(self, dirs: List[str]) -> None: ... + def set_include_dirs(self, dirs: list[str]) -> None: ... def add_library(self, libname: str) -> None: ... - def set_libraries(self, libnames: List[str]) -> None: ... + def set_libraries(self, libnames: list[str]) -> None: ... def add_library_dir(self, dir: str) -> None: ... - def set_library_dirs(self, dirs: List[str]) -> None: ... + def set_library_dirs(self, dirs: list[str]) -> None: ... def add_runtime_library_dir(self, dir: str) -> None: ... - def set_runtime_library_dirs(self, dirs: List[str]) -> None: ... + def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... def define_macro(self, name: str, value: str | None = ...) -> None: ... def undefine_macro(self, name: str) -> None: ... def add_link_object(self, object: str) -> None: ... - def set_link_objects(self, objects: List[str]) -> None: ... - def detect_language(self, sources: str | List[str]) -> str | None: ... - def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> str | None: ... + def set_link_objects(self, objects: list[str]) -> None: ... + def detect_language(self, sources: str | list[str]) -> str | None: ... + def find_library_file(self, dirs: list[str], lib: str, debug: bool = ...) -> str | None: ... def has_function( self, funcname: str, - includes: List[str] | None = ..., - include_dirs: List[str] | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., + includes: list[str] | None = ..., + include_dirs: list[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., ) -> bool: ... def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... @@ -52,18 +52,18 @@ class CCompiler: def set_executables(self, **args: str) -> None: ... def compile( self, - sources: List[str], + sources: list[str], output_dir: str | None = ..., macros: _Macro | None = ..., - include_dirs: List[str] | None = ..., + include_dirs: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - depends: List[str] | None = ..., - ) -> List[str]: ... + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + depends: list[str] | None = ..., + ) -> list[str]: ... def create_static_lib( self, - objects: List[str], + objects: list[str], output_libname: str, output_dir: str | None = ..., debug: bool = ..., @@ -72,59 +72,59 @@ class CCompiler: def link( self, target_desc: str, - objects: List[str], + objects: list[str], output_filename: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... def link_executable( self, - objects: List[str], + objects: list[str], output_progname: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., target_lang: str | None = ..., ) -> None: ... def link_shared_lib( self, - objects: List[str], + objects: list[str], output_libname: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... def link_shared_object( self, - objects: List[str], + objects: list[str], output_filename: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... @@ -132,17 +132,17 @@ class CCompiler: self, source: str, output_file: str | None = ..., - macros: List[_Macro] | None = ..., - include_dirs: List[str] | None = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + macros: list[_Macro] | None = ..., + include_dirs: list[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., ) -> None: ... def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... - def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ... + def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ... def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... - def spawn(self, cmd: List[str]) -> None: ... + def execute(self, func: Callable[..., None], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... + def spawn(self, cmd: list[str]) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... def move_file(self, src: str, dst: str) -> str: ... def announce(self, msg: str, level: int = ...) -> None: ... diff --git a/stdlib/@python2/distutils/cmd.pyi b/stdlib/@python2/distutils/cmd.pyi index d4e90bf69970..3b5b85912cbe 100644 --- a/stdlib/@python2/distutils/cmd.pyi +++ b/stdlib/@python2/distutils/cmd.pyi @@ -1,9 +1,9 @@ from abc import abstractmethod from distutils.dist import Distribution -from typing import Any, Callable, Iterable, List, Text, Tuple +from typing import Any, Callable, Iterable, Text class Command: - sub_commands: List[Tuple[str, Callable[[Command], bool] | None]] + sub_commands: list[tuple[str, Callable[[Command], bool] | None]] def __init__(self, dist: Distribution) -> None: ... @abstractmethod def initialize_options(self) -> None: ... @@ -14,15 +14,15 @@ class Command: def announce(self, msg: Text, level: int = ...) -> None: ... def debug_print(self, msg: Text) -> None: ... def ensure_string(self, option: str, default: str | None = ...) -> None: ... - def ensure_string_list(self, option: str | List[str]) -> None: ... + def ensure_string_list(self, option: str | list[str]) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... - def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ... + def set_undefined_options(self, src_cmd: Text, *option_pairs: tuple[str, str]) -> None: ... def get_finalized_command(self, command: Text, create: int = ...) -> Command: ... def reinitialize_command(self, command: Command | Text, reinit_subcommands: int = ...) -> Command: ... def run_command(self, command: Text) -> None: ... - def get_sub_commands(self) -> List[str]: ... + def get_sub_commands(self) -> list[str]: ... def warn(self, msg: Text) -> None: ... def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Text | None = ..., level: int = ...) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... @@ -34,7 +34,7 @@ class Command: preserve_times: int = ..., link: str | None = ..., level: Any = ..., - ) -> Tuple[str, bool]: ... # level is not used + ) -> tuple[str, bool]: ... # level is not used def copy_tree( self, infile: str, @@ -43,7 +43,7 @@ class Command: preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ..., - ) -> List[str]: ... # level is not used + ) -> list[str]: ... # level is not used def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used def make_archive( @@ -57,10 +57,10 @@ class Command: ) -> str: ... def make_file( self, - infiles: str | List[str] | Tuple[str], + infiles: str | list[str] | tuple[str], outfile: str, func: Callable[..., Any], - args: List[Any], + args: list[Any], exec_msg: str | None = ..., skip_msg: str | None = ..., level: Any = ..., diff --git a/stdlib/@python2/distutils/command/config.pyi b/stdlib/@python2/distutils/command/config.pyi index d0fd762e83b2..790a8b485a56 100644 --- a/stdlib/@python2/distutils/command/config.pyi +++ b/stdlib/@python2/distutils/command/config.pyi @@ -3,14 +3,14 @@ from distutils.ccompiler import CCompiler from distutils.core import Command as Command from distutils.errors import DistutilsExecError as DistutilsExecError from distutils.sysconfig import customize_compiler as customize_compiler -from typing import Dict, List, Pattern, Sequence, Tuple +from typing import Pattern, Sequence -LANG_EXT: Dict[str, str] +LANG_EXT: dict[str, str] class config(Command): description: str = ... # Tuple is full name, short name, description - user_options: Sequence[Tuple[str, str | None, str]] = ... + user_options: Sequence[tuple[str, str | None, str]] = ... compiler: str | CCompiler | None = ... cc: str | None = ... include_dirs: Sequence[str] | None = ... @@ -74,7 +74,7 @@ class config(Command): library_dirs: Sequence[str] | None = ..., headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., - other_libraries: List[str] = ..., + other_libraries: list[str] = ..., ) -> bool: ... def check_header( self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ... diff --git a/stdlib/@python2/distutils/command/install_egg_info.pyi b/stdlib/@python2/distutils/command/install_egg_info.pyi index bf3d0737f244..1bee1ed07e45 100644 --- a/stdlib/@python2/distutils/command/install_egg_info.pyi +++ b/stdlib/@python2/distutils/command/install_egg_info.pyi @@ -1,10 +1,10 @@ from distutils.cmd import Command -from typing import ClassVar, List, Tuple +from typing import ClassVar class install_egg_info(Command): description: ClassVar[str] - user_options: ClassVar[List[Tuple[str, str | None, str]]] + user_options: ClassVar[list[tuple[str, str | None, str]]] def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... - def get_outputs(self) -> List[str]: ... + def get_outputs(self) -> list[str]: ... diff --git a/stdlib/@python2/distutils/command/upload.pyi b/stdlib/@python2/distutils/command/upload.pyi index 3835d9fd6ec6..005db872b0bf 100644 --- a/stdlib/@python2/distutils/command/upload.pyi +++ b/stdlib/@python2/distutils/command/upload.pyi @@ -1,8 +1,8 @@ from distutils.config import PyPIRCCommand -from typing import ClassVar, List, Tuple +from typing import ClassVar class upload(PyPIRCCommand): description: ClassVar[str] - boolean_options: ClassVar[List[str]] + boolean_options: ClassVar[list[str]] def run(self) -> None: ... def upload_file(self, command, pyversion, filename) -> None: ... diff --git a/stdlib/@python2/distutils/config.pyi b/stdlib/@python2/distutils/config.pyi index bcd626c81d48..5814a82841cc 100644 --- a/stdlib/@python2/distutils/config.pyi +++ b/stdlib/@python2/distutils/config.pyi @@ -1,6 +1,6 @@ from abc import abstractmethod from distutils.cmd import Command -from typing import ClassVar, List, Tuple +from typing import ClassVar DEFAULT_PYPIRC: str @@ -9,8 +9,8 @@ class PyPIRCCommand(Command): DEFAULT_REALM: ClassVar[str] repository: None realm: None - user_options: ClassVar[List[Tuple[str, str | None, str]]] - boolean_options: ClassVar[List[str]] + user_options: ClassVar[list[tuple[str, str | None, str]]] + boolean_options: ClassVar[list[str]] def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... @abstractmethod diff --git a/stdlib/@python2/distutils/core.pyi b/stdlib/@python2/distutils/core.pyi index 48bd7b5018bc..6564c9a86ded 100644 --- a/stdlib/@python2/distutils/core.pyi +++ b/stdlib/@python2/distutils/core.pyi @@ -1,7 +1,7 @@ from distutils.cmd import Command as Command from distutils.dist import Distribution as Distribution from distutils.extension import Extension as Extension -from typing import Any, List, Mapping, Tuple, Type +from typing import Any, Mapping def setup( *, @@ -15,34 +15,34 @@ def setup( maintainer_email: str = ..., url: str = ..., download_url: str = ..., - packages: List[str] = ..., - py_modules: List[str] = ..., - scripts: List[str] = ..., - ext_modules: List[Extension] = ..., - classifiers: List[str] = ..., - distclass: Type[Distribution] = ..., + packages: list[str] = ..., + py_modules: list[str] = ..., + scripts: list[str] = ..., + ext_modules: list[Extension] = ..., + classifiers: list[str] = ..., + distclass: type[Distribution] = ..., script_name: str = ..., - script_args: List[str] = ..., + script_args: list[str] = ..., options: Mapping[str, Any] = ..., license: str = ..., - keywords: List[str] | str = ..., - platforms: List[str] | str = ..., - cmdclass: Mapping[str, Type[Command]] = ..., - data_files: List[Tuple[str, List[str]]] = ..., + keywords: list[str] | str = ..., + platforms: list[str] | str = ..., + cmdclass: Mapping[str, type[Command]] = ..., + data_files: list[tuple[str, list[str]]] = ..., package_dir: Mapping[str, str] = ..., - obsoletes: List[str] = ..., - provides: List[str] = ..., - requires: List[str] = ..., - command_packages: List[str] = ..., - command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., - package_data: Mapping[str, List[str]] = ..., + obsoletes: list[str] = ..., + provides: list[str] = ..., + requires: list[str] = ..., + command_packages: list[str] = ..., + command_options: Mapping[str, Mapping[str, tuple[Any, Any]]] = ..., + package_data: Mapping[str, list[str]] = ..., include_package_data: bool = ..., - libraries: List[str] = ..., - headers: List[str] = ..., + libraries: list[str] = ..., + headers: list[str] = ..., ext_package: str = ..., - include_dirs: List[str] = ..., + include_dirs: list[str] = ..., password: str = ..., fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = ..., stop_after: str = ...) -> Distribution: ... diff --git a/stdlib/@python2/distutils/dep_util.pyi b/stdlib/@python2/distutils/dep_util.pyi index 6f779d540e5e..929d6ffd0c81 100644 --- a/stdlib/@python2/distutils/dep_util.pyi +++ b/stdlib/@python2/distutils/dep_util.pyi @@ -1,5 +1,3 @@ -from typing import List, Tuple - def newer(source: str, target: str) -> bool: ... -def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ... -def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ... +def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... +def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ... diff --git a/stdlib/@python2/distutils/dir_util.pyi b/stdlib/@python2/distutils/dir_util.pyi index 4c4a22102558..ffe5ff1cfbd4 100644 --- a/stdlib/@python2/distutils/dir_util.pyi +++ b/stdlib/@python2/distutils/dir_util.pyi @@ -1,7 +1,5 @@ -from typing import List - -def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ... -def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... +def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> list[str]: ... +def create_tree(base_dir: str, files: list[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... def copy_tree( src: str, dst: str, @@ -11,5 +9,5 @@ def copy_tree( update: int = ..., verbose: int = ..., dry_run: int = ..., -) -> List[str]: ... +) -> list[str]: ... def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... diff --git a/stdlib/@python2/distutils/dist.pyi b/stdlib/@python2/distutils/dist.pyi index adba8f093569..8e6eeafc15b3 100644 --- a/stdlib/@python2/distutils/dist.pyi +++ b/stdlib/@python2/distutils/dist.pyi @@ -1,9 +1,9 @@ from distutils.cmd import Command -from typing import Any, Dict, Iterable, Mapping, Text, Tuple, Type +from typing import Any, Iterable, Mapping, Text class Distribution: - cmdclass: Dict[str, Type[Command]] + cmdclass: dict[str, type[Command]] def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ... - def get_option_dict(self, command: str) -> Dict[str, Tuple[str, Text]]: ... + def get_option_dict(self, command: str) -> dict[str, tuple[str, Text]]: ... def parse_config_files(self, filenames: Iterable[Text] | None = ...) -> None: ... def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/@python2/distutils/extension.pyi b/stdlib/@python2/distutils/extension.pyi index 9335fad86418..cff84ef59b6b 100644 --- a/stdlib/@python2/distutils/extension.pyi +++ b/stdlib/@python2/distutils/extension.pyi @@ -1,21 +1,19 @@ -from typing import List, Tuple - class Extension: def __init__( self, name: str, - sources: List[str], - include_dirs: List[str] = ..., - define_macros: List[Tuple[str, str | None]] = ..., - undef_macros: List[str] = ..., - library_dirs: List[str] = ..., - libraries: List[str] = ..., - runtime_library_dirs: List[str] = ..., - extra_objects: List[str] = ..., - extra_compile_args: List[str] = ..., - extra_link_args: List[str] = ..., - export_symbols: List[str] = ..., + sources: list[str], + include_dirs: list[str] = ..., + define_macros: list[tuple[str, str | None]] = ..., + undef_macros: list[str] = ..., + library_dirs: list[str] = ..., + libraries: list[str] = ..., + runtime_library_dirs: list[str] = ..., + extra_objects: list[str] = ..., + extra_compile_args: list[str] = ..., + extra_link_args: list[str] = ..., + export_symbols: list[str] = ..., swig_opts: str | None = ..., # undocumented - depends: List[str] = ..., + depends: list[str] = ..., language: str = ..., ) -> None: ... diff --git a/stdlib/@python2/distutils/fancy_getopt.pyi b/stdlib/@python2/distutils/fancy_getopt.pyi index d0e3309c2d77..02301aed63f4 100644 --- a/stdlib/@python2/distutils/fancy_getopt.pyi +++ b/stdlib/@python2/distutils/fancy_getopt.pyi @@ -1,21 +1,21 @@ -from typing import Any, List, Mapping, Optional, Tuple, overload +from typing import Any, Mapping, Optional, overload -_Option = Tuple[str, Optional[str], str] -_GR = Tuple[List[str], OptionDummy] +_Option = tuple[str, Optional[str], str] +_GR = tuple[list[str], OptionDummy] def fancy_getopt( - options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: List[str] | None -) -> List[str] | _GR: ... -def wrap_text(text: str, width: int) -> List[str]: ... + options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None +) -> list[str] | _GR: ... +def wrap_text(text: str, width: int) -> list[str]: ... class FancyGetopt: - def __init__(self, option_table: List[_Option] | None = ...) -> None: ... + def __init__(self, option_table: list[_Option] | None = ...) -> None: ... # TODO kinda wrong, `getopt(object=object())` is invalid @overload - def getopt(self, args: List[str] | None = ...) -> _GR: ... + def getopt(self, args: list[str] | None = ...) -> _GR: ... @overload - def getopt(self, args: List[str] | None, object: Any) -> List[str]: ... - def get_option_order(self) -> List[Tuple[str, str]]: ... - def generate_help(self, header: str | None = ...) -> List[str]: ... + def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... + def get_option_order(self) -> list[tuple[str, str]]: ... + def generate_help(self, header: str | None = ...) -> list[str]: ... class OptionDummy: ... diff --git a/stdlib/@python2/distutils/file_util.pyi b/stdlib/@python2/distutils/file_util.pyi index cfe840e71040..a7f24105a678 100644 --- a/stdlib/@python2/distutils/file_util.pyi +++ b/stdlib/@python2/distutils/file_util.pyi @@ -1,4 +1,4 @@ -from typing import Sequence, Tuple +from typing import Sequence def copy_file( src: str, @@ -9,6 +9,6 @@ def copy_file( link: str | None = ..., verbose: bool = ..., dry_run: bool = ..., -) -> Tuple[str, str]: ... +) -> tuple[str, str]: ... def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stdlib/@python2/distutils/spawn.pyi b/stdlib/@python2/distutils/spawn.pyi index 0fffc5402c62..dda05ad7e85a 100644 --- a/stdlib/@python2/distutils/spawn.pyi +++ b/stdlib/@python2/distutils/spawn.pyi @@ -1,4 +1,2 @@ -from typing import List - -def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... +def spawn(cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... def find_executable(executable: str, path: str | None = ...) -> str | None: ... diff --git a/stdlib/@python2/distutils/text_file.pyi b/stdlib/@python2/distutils/text_file.pyi index 26ba5a6fabb6..364bcf9ff154 100644 --- a/stdlib/@python2/distutils/text_file.pyi +++ b/stdlib/@python2/distutils/text_file.pyi @@ -1,4 +1,4 @@ -from typing import IO, List, Tuple +from typing import IO class TextFile: def __init__( @@ -15,7 +15,7 @@ class TextFile: ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, line: List[int] | Tuple[int, int] | int = ...) -> None: ... + def warn(self, msg: str, line: list[int] | tuple[int, int] | int = ...) -> None: ... def readline(self) -> str | None: ... - def readlines(self) -> List[str]: ... + def readlines(self) -> list[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/@python2/distutils/util.pyi b/stdlib/@python2/distutils/util.pyi index c0882d1dd1cb..6f5e755f5c35 100644 --- a/stdlib/@python2/distutils/util.pyi +++ b/stdlib/@python2/distutils/util.pyi @@ -1,17 +1,17 @@ -from typing import Any, Callable, List, Mapping, Tuple +from typing import Any, Callable, Mapping def get_platform() -> str: ... def convert_path(pathname: str) -> str: ... def change_root(new_root: str, pathname: str) -> str: ... def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... -def split_quoted(s: str) -> List[str]: ... +def split_quoted(s: str) -> list[str]: ... def execute( - func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... + func: Callable[..., None], args: tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... ) -> None: ... def strtobool(val: str) -> bool: ... def byte_compile( - py_files: List[str], + py_files: list[str], optimize: int = ..., force: bool = ..., prefix: str | None = ..., diff --git a/stdlib/@python2/distutils/version.pyi b/stdlib/@python2/distutils/version.pyi index 1a0ea71c2eea..a9c4bee32174 100644 --- a/stdlib/@python2/distutils/version.pyi +++ b/stdlib/@python2/distutils/version.pyi @@ -1,6 +1,6 @@ from _typeshed import Self from abc import abstractmethod -from typing import Pattern, Text, Tuple, TypeVar +from typing import Pattern, Text, TypeVar _T = TypeVar("_T", bound=Version) @@ -17,8 +17,8 @@ class Version: class StrictVersion(Version): version_re: Pattern[str] - version: Tuple[int, int, int] - prerelease: Tuple[Text, int] | None + version: tuple[int, int, int] + prerelease: tuple[Text, int] | None def __init__(self, vstring: Text | None = ...) -> None: ... def parse(self: Self, vstring: Text) -> Self: ... def __str__(self) -> str: ... @@ -27,7 +27,7 @@ class StrictVersion(Version): class LooseVersion(Version): component_re: Pattern[str] vstring: Text - version: Tuple[Text | int, ...] + version: tuple[Text | int, ...] def __init__(self, vstring: Text | None = ...) -> None: ... def parse(self: Self, vstring: Text) -> Self: ... def __str__(self) -> str: ... diff --git a/stdlib/@python2/doctest.pyi b/stdlib/@python2/doctest.pyi index 6c3b922244f4..9f95d122eea5 100644 --- a/stdlib/@python2/doctest.pyi +++ b/stdlib/@python2/doctest.pyi @@ -1,12 +1,12 @@ import types import unittest -from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Type +from typing import Any, Callable, NamedTuple class TestResults(NamedTuple): failed: int attempted: int -OPTIONFLAGS_BY_NAME: Dict[str, int] +OPTIONFLAGS_BY_NAME: dict[str, int] def register_optionflag(name: str) -> int: ... @@ -34,7 +34,7 @@ class Example: exc_msg: str | None lineno: int indent: int - options: Dict[int, bool] + options: dict[int, bool] def __init__( self, source: str, @@ -42,21 +42,21 @@ class Example: exc_msg: str | None = ..., lineno: int = ..., indent: int = ..., - options: Dict[int, bool] | None = ..., + options: dict[int, bool] | None = ..., ) -> None: ... def __hash__(self) -> int: ... class DocTest: - examples: List[Example] - globs: Dict[str, Any] + examples: list[Example] + globs: dict[str, Any] name: str filename: str | None lineno: int | None docstring: str | None def __init__( self, - examples: List[Example], - globs: Dict[str, Any], + examples: list[Example], + globs: dict[str, Any], name: str, filename: str | None, lineno: int | None, @@ -66,9 +66,9 @@ class DocTest: def __lt__(self, other: DocTest) -> bool: ... class DocTestParser: - def parse(self, string: str, name: str = ...) -> List[str | Example]: ... - def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... - def get_examples(self, string: str, name: str = ...) -> List[Example]: ... + def parse(self, string: str, name: str = ...) -> list[str | Example]: ... + def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... + def get_examples(self, string: str, name: str = ...) -> list[Example]: ... class DocTestFinder: def __init__( @@ -79,12 +79,12 @@ class DocTestFinder: obj: object, name: str | None = ..., module: None | bool | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., - ) -> List[DocTest]: ... + globs: dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., + ) -> list[DocTest]: ... _Out = Callable[[str], Any] -_ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType] +_ExcInfo = tuple[type[BaseException], BaseException, types.TracebackType] class DocTestRunner: DIVIDER: str @@ -127,11 +127,11 @@ master: DocTestRunner | None def testmod( m: types.ModuleType | None = ..., name: str | None = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., verbose: bool | None = ..., report: bool = ..., optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., raise_on_error: bool = ..., exclude_empty: bool = ..., ) -> TestResults: ... @@ -140,17 +140,17 @@ def testfile( module_relative: bool = ..., name: str | None = ..., package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., verbose: bool | None = ..., report: bool = ..., optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., raise_on_error: bool = ..., parser: DocTestParser = ..., encoding: str | None = ..., ) -> TestResults: ... def run_docstring_examples( - f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... + f: object, globs: dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... @@ -182,8 +182,8 @@ _DocTestSuite = unittest.TestSuite def DocTestSuite( module: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., test_finder: DocTestFinder | None = ..., **options: Any, ) -> _DocTestSuite: ... @@ -196,7 +196,7 @@ def DocFileTest( path: str, module_relative: bool = ..., package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., parser: DocTestParser = ..., encoding: str | None = ..., **options: Any, @@ -204,6 +204,6 @@ def DocFileTest( def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ... def script_from_examples(s: str) -> str: ... def testsource(module: None | str | types.ModuleType, name: str) -> str: ... -def debug_src(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... -def debug_script(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... +def debug_src(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... +def debug_script(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ... diff --git a/stdlib/@python2/dummy_thread.pyi b/stdlib/@python2/dummy_thread.pyi index 0a28b3aaeeb9..1bd324b7eaaf 100644 --- a/stdlib/@python2/dummy_thread.pyi +++ b/stdlib/@python2/dummy_thread.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Dict, NoReturn, Tuple +from typing import Any, Callable, NoReturn class error(Exception): def __init__(self, *args: Any) -> None: ... -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ... +def start_new_thread(function: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> None: ... def exit() -> NoReturn: ... def get_ident() -> int: ... def allocate_lock() -> LockType: ... diff --git a/stdlib/@python2/email/mime/application.pyi b/stdlib/@python2/email/mime/application.pyi index 4245e3e0f980..308b296c4d53 100644 --- a/stdlib/@python2/email/mime/application.pyi +++ b/stdlib/@python2/email/mime/application.pyi @@ -1,7 +1,7 @@ from email.mime.nonmultipart import MIMENonMultipart -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Optional, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +_ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEApplication(MIMENonMultipart): def __init__( diff --git a/stdlib/@python2/encodings/utf_8.pyi b/stdlib/@python2/encodings/utf_8.pyi index d38bd58d0e43..349b61432eab 100644 --- a/stdlib/@python2/encodings/utf_8.pyi +++ b/stdlib/@python2/encodings/utf_8.pyi @@ -1,11 +1,11 @@ import codecs -from typing import Text, Tuple +from typing import Text class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: Text, final: bool = ...) -> bytes: ... class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ... + def _buffer_decode(self, input: bytes, errors: str, final: bool) -> tuple[Text, int]: ... class StreamWriter(codecs.StreamWriter): ... class StreamReader(codecs.StreamReader): ... diff --git a/stdlib/@python2/filecmp.pyi b/stdlib/@python2/filecmp.pyi index 0be5596c2bdb..c50faedf2fa1 100644 --- a/stdlib/@python2/filecmp.pyi +++ b/stdlib/@python2/filecmp.pyi @@ -1,11 +1,11 @@ -from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Sequence, Text, Tuple +from typing import AnyStr, Callable, Generic, Iterable, Sequence, Text -DEFAULT_IGNORES: List[str] +DEFAULT_IGNORES: list[str] def cmp(f1: bytes | Text, f2: bytes | Text, shallow: int | bool = ...) -> bool: ... def cmpfiles( a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: int | bool = ... -) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ... +) -> tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ... class dircmp(Generic[AnyStr]): def __init__( @@ -16,22 +16,22 @@ class dircmp(Generic[AnyStr]): hide: Sequence[AnyStr] ignore: Sequence[AnyStr] # These properties are created at runtime by __getattr__ - subdirs: Dict[AnyStr, dircmp[AnyStr]] - same_files: List[AnyStr] - diff_files: List[AnyStr] - funny_files: List[AnyStr] - common_dirs: List[AnyStr] - common_files: List[AnyStr] - common_funny: List[AnyStr] - common: List[AnyStr] - left_only: List[AnyStr] - right_only: List[AnyStr] - left_list: List[AnyStr] - right_list: List[AnyStr] + subdirs: dict[AnyStr, dircmp[AnyStr]] + same_files: list[AnyStr] + diff_files: list[AnyStr] + funny_files: list[AnyStr] + common_dirs: list[AnyStr] + common_files: list[AnyStr] + common_funny: list[AnyStr] + common: list[AnyStr] + left_only: list[AnyStr] + right_only: list[AnyStr] + left_list: list[AnyStr] + right_list: list[AnyStr] def report(self) -> None: ... def report_partial_closure(self) -> None: ... def report_full_closure(self) -> None: ... - methodmap: Dict[str, Callable[[], None]] + methodmap: dict[str, Callable[[], None]] def phase0(self) -> None: ... def phase1(self) -> None: ... def phase2(self) -> None: ... diff --git a/stdlib/@python2/fnmatch.pyi b/stdlib/@python2/fnmatch.pyi index e933b7b2cb62..ead2dd5bf38e 100644 --- a/stdlib/@python2/fnmatch.pyi +++ b/stdlib/@python2/fnmatch.pyi @@ -1,8 +1,8 @@ -from typing import AnyStr, Iterable, List, Union +from typing import AnyStr, Iterable, Union _EitherStr = Union[str, unicode] def fnmatch(filename: _EitherStr, pattern: _EitherStr) -> bool: ... def fnmatchcase(filename: _EitherStr, pattern: _EitherStr) -> bool: ... -def filter(names: Iterable[AnyStr], pattern: _EitherStr) -> List[AnyStr]: ... +def filter(names: Iterable[AnyStr], pattern: _EitherStr) -> list[AnyStr]: ... def translate(pattern: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/formatter.pyi b/stdlib/@python2/formatter.pyi index da165f2d55e3..f5d8348d08a1 100644 --- a/stdlib/@python2/formatter.pyi +++ b/stdlib/@python2/formatter.pyi @@ -1,8 +1,8 @@ -from typing import IO, Any, Iterable, List, Tuple +from typing import IO, Any, Iterable AS_IS: None -_FontType = Tuple[str, bool, bool, bool] -_StylesType = Tuple[Any, ...] +_FontType = tuple[str, bool, bool, bool] +_StylesType = tuple[Any, ...] class NullFormatter: writer: NullWriter | None @@ -28,9 +28,9 @@ class NullFormatter: class AbstractFormatter: writer: NullWriter align: str | None - align_stack: List[str | None] - font_stack: List[_FontType] - margin_stack: List[int] + align_stack: list[str | None] + font_stack: list[_FontType] + margin_stack: list[int] spacing: str | None style_stack: Any nospace: int @@ -68,7 +68,7 @@ class NullWriter: def new_font(self, font: _FontType) -> None: ... def new_margin(self, margin: int, level: int) -> None: ... def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... + def new_styles(self, styles: tuple[Any, ...]) -> None: ... def send_paragraph(self, blankline: int) -> None: ... def send_line_break(self) -> None: ... def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... @@ -81,7 +81,7 @@ class AbstractWriter(NullWriter): def new_font(self, font: _FontType) -> None: ... def new_margin(self, margin: int, level: int) -> None: ... def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... + def new_styles(self, styles: tuple[Any, ...]) -> None: ... def send_paragraph(self, blankline: int) -> None: ... def send_line_break(self) -> None: ... def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... diff --git a/stdlib/@python2/fractions.pyi b/stdlib/@python2/fractions.pyi index 872e20ede688..dd30adecaf9d 100644 --- a/stdlib/@python2/fractions.pyi +++ b/stdlib/@python2/fractions.pyi @@ -1,6 +1,6 @@ from decimal import Decimal from numbers import Integral, Rational, Real -from typing import Tuple, Type, TypeVar, Union, overload +from typing import TypeVar, Union, overload from typing_extensions import Literal _ComparableNum = Union[int, float, Decimal, Real] @@ -18,10 +18,10 @@ def gcd(a: Integral, b: Integral) -> Integral: ... class Fraction(Rational): @overload def __new__( - cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... + cls: type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... ) -> _T: ... @overload - def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ... + def __new__(cls: type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ... @classmethod def from_float(cls, f: float) -> Fraction: ... @classmethod @@ -108,13 +108,13 @@ class Fraction(Rational): @overload def __rmod__(self, other: float) -> float: ... @overload - def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... + def __divmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ... @overload - def __divmod__(self, other: float) -> Tuple[float, Fraction]: ... + def __divmod__(self, other: float) -> tuple[float, Fraction]: ... @overload - def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... + def __rdivmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ... @overload - def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ... + def __rdivmod__(self, other: float) -> tuple[float, Fraction]: ... @overload def __pow__(self, other: int) -> Fraction: ... @overload diff --git a/stdlib/@python2/ftplib.pyi b/stdlib/@python2/ftplib.pyi index 1149d4549c16..b8c2bbd40371 100644 --- a/stdlib/@python2/ftplib.pyi +++ b/stdlib/@python2/ftplib.pyi @@ -1,7 +1,7 @@ from _typeshed import SupportsRead, SupportsReadline from socket import socket from ssl import SSLContext -from typing import Any, BinaryIO, Callable, List, Text, Tuple, Type, Union +from typing import Any, BinaryIO, Callable, Text, Union from typing_extensions import Literal _IntOrStr = Union[int, Text] @@ -17,7 +17,7 @@ class error_temp(Error): ... class error_perm(Error): ... class error_proto(Error): ... -all_errors: Tuple[Type[Exception], ...] +all_errors: tuple[type[Exception], ...] class FTP: debugging: int @@ -57,10 +57,10 @@ class FTP: def sendport(self, host: Text, port: int) -> str: ... def sendeprt(self, host: Text, port: int) -> str: ... def makeport(self) -> socket: ... - def makepasv(self) -> Tuple[str, int]: ... + def makepasv(self) -> tuple[str, int]: ... def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ...) -> str: ... # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. - def ntransfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> Tuple[socket, int]: ... + def ntransfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> tuple[socket, int]: ... def transfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> socket: ... def retrbinary( self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: _IntOrStr | None = ... @@ -76,7 +76,7 @@ class FTP: def retrlines(self, cmd: Text, callback: Callable[[str], Any] | None = ...) -> str: ... def storlines(self, cmd: Text, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ... def acct(self, password: Text) -> str: ... - def nlst(self, *args: Text) -> List[str]: ... + def nlst(self, *args: Text) -> list[str]: ... # Technically only the last arg can be a Callable but ... def dir(self, *args: str | Callable[[str], None]) -> None: ... def rename(self, fromname: Text, toname: Text) -> str: ... @@ -100,7 +100,7 @@ class FTP_TLS(FTP): certfile: str | None = ..., context: SSLContext | None = ..., timeout: float = ..., - source_address: Tuple[str, int] | None = ..., + source_address: tuple[str, int] | None = ..., ) -> None: ... ssl_version: int keyfile: str | None @@ -113,14 +113,14 @@ class FTP_TLS(FTP): class Netrc: def __init__(self, filename: Text | None = ...) -> None: ... - def get_hosts(self) -> List[str]: ... - def get_account(self, host: Text) -> Tuple[str | None, str | None, str | None]: ... - def get_macros(self) -> List[str]: ... - def get_macro(self, macro: Text) -> Tuple[str, ...]: ... + def get_hosts(self) -> list[str]: ... + def get_account(self, host: Text) -> tuple[str | None, str | None, str | None]: ... + def get_macros(self) -> list[str]: ... + def get_macro(self, macro: Text) -> tuple[str, ...]: ... def parse150(resp: str) -> int | None: ... # undocumented -def parse227(resp: str) -> Tuple[str, int]: ... # undocumented -def parse229(resp: str, peer: Any) -> Tuple[str, int]: ... # undocumented +def parse227(resp: str) -> tuple[str, int]: ... # undocumented +def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ... diff --git a/stdlib/@python2/functools.pyi b/stdlib/@python2/functools.pyi index dd873708fea4..026a74faf6ff 100644 --- a/stdlib/@python2/functools.pyi +++ b/stdlib/@python2/functools.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Generic, Iterable, Sequence, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Sequence, TypeVar, overload _AnyCallable = Callable[..., Any] @@ -19,12 +19,12 @@ def update_wrapper( def wraps( wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... ) -> Callable[[_AnyCallable], _AnyCallable]: ... -def total_ordering(cls: Type[_T]) -> Type[_T]: ... +def total_ordering(cls: type[_T]) -> type[_T]: ... def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ... class partial(Generic[_T]): func = ... # Callable[..., _T] - args: Tuple[Any, ...] - keywords: Dict[str, Any] + args: tuple[Any, ...] + keywords: dict[str, Any] def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... diff --git a/stdlib/@python2/gc.pyi b/stdlib/@python2/gc.pyi index b1fb1acc07d2..0ee05387a5a8 100644 --- a/stdlib/@python2/gc.pyi +++ b/stdlib/@python2/gc.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Tuple +from typing import Any def enable() -> None: ... def disable() -> None: ... @@ -6,15 +6,15 @@ def isenabled() -> bool: ... def collect(generation: int = ...) -> int: ... def set_debug(flags: int) -> None: ... def get_debug() -> int: ... -def get_objects() -> List[Any]: ... +def get_objects() -> list[Any]: ... def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ... -def get_count() -> Tuple[int, int, int]: ... -def get_threshold() -> Tuple[int, int, int]: ... -def get_referrers(*objs: Any) -> List[Any]: ... -def get_referents(*objs: Any) -> List[Any]: ... +def get_count() -> tuple[int, int, int]: ... +def get_threshold() -> tuple[int, int, int]: ... +def get_referrers(*objs: Any) -> list[Any]: ... +def get_referents(*objs: Any) -> list[Any]: ... def is_tracked(obj: Any) -> bool: ... -garbage: List[Any] +garbage: list[Any] DEBUG_STATS: int DEBUG_COLLECTABLE: int diff --git a/stdlib/@python2/genericpath.pyi b/stdlib/@python2/genericpath.pyi index ba29db4692bb..fecb3b70af42 100644 --- a/stdlib/@python2/genericpath.pyi +++ b/stdlib/@python2/genericpath.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsLessThanT -from typing import List, Sequence, Text, Tuple, Union, overload +from typing import Sequence, Text, Union, overload from typing_extensions import Literal # All overloads can return empty string. Ideally, Literal[""] would be a valid @@ -10,9 +10,9 @@ def commonprefix(m: Sequence[str]) -> str | Literal[""]: ... # type: ignore @overload def commonprefix(m: Sequence[Text]) -> Text: ... # type: ignore @overload -def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... +def commonprefix(m: Sequence[list[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... @overload -def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... +def commonprefix(m: Sequence[tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... def exists(path: Text) -> bool: ... def getsize(filename: Text) -> int: ... def isfile(path: Text) -> bool: ... diff --git a/stdlib/@python2/getopt.pyi b/stdlib/@python2/getopt.pyi index 370d4d5c1cba..43a01ee73982 100644 --- a/stdlib/@python2/getopt.pyi +++ b/stdlib/@python2/getopt.pyi @@ -1,5 +1,3 @@ -from typing import List, Tuple - class GetoptError(Exception): opt: str msg: str @@ -8,5 +6,5 @@ class GetoptError(Exception): error = GetoptError -def getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ... -def gnu_getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ... +def getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ... +def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ... diff --git a/stdlib/@python2/gettext.pyi b/stdlib/@python2/gettext.pyi index a91234f6b2d3..02e306978160 100644 --- a/stdlib/@python2/gettext.pyi +++ b/stdlib/@python2/gettext.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Container, Dict, List, Sequence, Type +from typing import IO, Any, Container, Sequence def bindtextdomain(domain: str, localedir: str = ...) -> str: ... def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ... @@ -22,7 +22,7 @@ class NullTranslations(object): def ngettext(self, singular: str, plural: str, n: int) -> str: ... def lngettext(self, singular: str, plural: str, n: int) -> str: ... def ungettext(self, singular: str | unicode, plural: str | unicode, n: int) -> unicode: ... - def info(self) -> Dict[str, str]: ... + def info(self) -> dict[str, str]: ... def charset(self) -> str | None: ... def output_charset(self) -> str | None: ... def set_output_charset(self, charset: str | None) -> None: ... @@ -34,12 +34,12 @@ class GNUTranslations(NullTranslations): def find( domain: str, localedir: str | None = ..., languages: Sequence[str] | None = ..., all: Any = ... -) -> str | List[str] | None: ... +) -> str | list[str] | None: ... def translation( domain: str, localedir: str | None = ..., languages: Sequence[str] | None = ..., - class_: Type[NullTranslations] | None = ..., + class_: type[NullTranslations] | None = ..., fallback: bool = ..., codeset: str | None = ..., ) -> NullTranslations: ... diff --git a/stdlib/@python2/glob.pyi b/stdlib/@python2/glob.pyi index f5a389a0ddfa..2fc01a03a48b 100644 --- a/stdlib/@python2/glob.pyi +++ b/stdlib/@python2/glob.pyi @@ -1,7 +1,7 @@ -from typing import AnyStr, Iterator, List +from typing import AnyStr, Iterator -def glob(pathname: AnyStr) -> List[AnyStr]: ... +def glob(pathname: AnyStr) -> list[AnyStr]: ... def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ... -def glob1(dirname: str | unicode, pattern: AnyStr) -> List[AnyStr]: ... -def glob0(dirname: str | unicode, basename: AnyStr) -> List[AnyStr]: ... +def glob1(dirname: str | unicode, pattern: AnyStr) -> list[AnyStr]: ... +def glob0(dirname: str | unicode, basename: AnyStr) -> list[AnyStr]: ... def has_magic(s: str | unicode) -> bool: ... # undocumented diff --git a/stdlib/@python2/grp.pyi b/stdlib/@python2/grp.pyi index 6e937ec0f262..1651663eb242 100644 --- a/stdlib/@python2/grp.pyi +++ b/stdlib/@python2/grp.pyi @@ -1,12 +1,12 @@ import sys -from typing import List, NamedTuple +from typing import NamedTuple if sys.platform != "win32": class struct_group(NamedTuple): gr_name: str gr_passwd: str | None gr_gid: int - gr_mem: List[str] - def getgrall() -> List[struct_group]: ... + gr_mem: list[str] + def getgrall() -> list[struct_group]: ... def getgrgid(id: int) -> struct_group: ... def getgrnam(name: str) -> struct_group: ... diff --git a/stdlib/@python2/hashlib.pyi b/stdlib/@python2/hashlib.pyi index 9c53d2b6b30d..8f881aaaf419 100644 --- a/stdlib/@python2/hashlib.pyi +++ b/stdlib/@python2/hashlib.pyi @@ -1,4 +1,4 @@ -from typing import Tuple, Union +from typing import Union _DataType = Union[str, unicode, bytearray, buffer, memoryview] @@ -25,8 +25,8 @@ def sha256(s: _DataType = ...) -> _hash: ... def sha384(s: _DataType = ...) -> _hash: ... def sha512(s: _DataType = ...) -> _hash: ... -algorithms: Tuple[str, ...] -algorithms_guaranteed: Tuple[str, ...] -algorithms_available: Tuple[str, ...] +algorithms: tuple[str, ...] +algorithms_guaranteed: tuple[str, ...] +algorithms_available: tuple[str, ...] def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = ...) -> str: ... diff --git a/stdlib/@python2/heapq.pyi b/stdlib/@python2/heapq.pyi index 78ce6fd03928..5c393436d3c2 100644 --- a/stdlib/@python2/heapq.pyi +++ b/stdlib/@python2/heapq.pyi @@ -1,15 +1,15 @@ from _typeshed import SupportsLessThan -from typing import Callable, Iterable, List, TypeVar +from typing import Callable, Iterable, TypeVar _T = TypeVar("_T") def cmp_lt(x, y) -> bool: ... -def heappush(heap: List[_T], item: _T) -> None: ... -def heappop(heap: List[_T]) -> _T: ... -def heappushpop(heap: List[_T], item: _T) -> _T: ... -def heapify(x: List[_T]) -> None: ... -def heapreplace(heap: List[_T], item: _T) -> _T: ... +def heappush(heap: list[_T], item: _T) -> None: ... +def heappop(heap: list[_T]) -> _T: ... +def heappushpop(heap: list[_T], item: _T) -> _T: ... +def heapify(x: list[_T]) -> None: ... +def heapreplace(heap: list[_T], item: _T) -> _T: ... def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def _heapify_max(__x: List[_T]) -> None: ... # undocumented +def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... +def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... +def _heapify_max(__x: list[_T]) -> None: ... # undocumented diff --git a/stdlib/@python2/htmlentitydefs.pyi b/stdlib/@python2/htmlentitydefs.pyi index 749b3039dfc3..3fcc4be2d5a0 100644 --- a/stdlib/@python2/htmlentitydefs.pyi +++ b/stdlib/@python2/htmlentitydefs.pyi @@ -1,5 +1,3 @@ -from typing import Dict - -name2codepoint: Dict[str, int] -codepoint2name: Dict[int, str] -entitydefs: Dict[str, str] +name2codepoint: dict[str, int] +codepoint2name: dict[int, str] +entitydefs: dict[str, str] diff --git a/stdlib/@python2/httplib.pyi b/stdlib/@python2/httplib.pyi index f2163818fae4..b72423fc8ea9 100644 --- a/stdlib/@python2/httplib.pyi +++ b/stdlib/@python2/httplib.pyi @@ -1,9 +1,9 @@ import mimetools -from typing import Any, Dict, Protocol +from typing import Any, Protocol class HTTPMessage(mimetools.Message): def addcontinue(self, key: str, more: str) -> None: ... - dict: Dict[str, str] + dict: dict[str, str] def addheader(self, key: str, value: str) -> None: ... unixfrom: str headers: Any @@ -151,7 +151,7 @@ class LineAndFileWrapper: # Constants -responses: Dict[int, str] +responses: dict[int, str] HTTP_PORT: int HTTPS_PORT: int diff --git a/stdlib/@python2/imaplib.pyi b/stdlib/@python2/imaplib.pyi index c4346851bdac..b7e455f45062 100644 --- a/stdlib/@python2/imaplib.pyi +++ b/stdlib/@python2/imaplib.pyi @@ -1,33 +1,34 @@ import subprocess import time +from builtins import list as List # alias to avoid name clashes with `IMAP4.list` from socket import socket as _socket from ssl import SSLSocket -from typing import IO, Any, Callable, Dict, List, Pattern, Text, Tuple, Type, Union +from typing import IO, Any, Callable, Pattern, Text, Union from typing_extensions import Literal # TODO: Commands should use their actual return types, not this type alias. -# E.g. Tuple[Literal["OK"], List[bytes]] -_CommandResults = Tuple[str, List[Any]] +# E.g. tuple[Literal["OK"], list[bytes]] +_CommandResults = tuple[str, list[Any]] -_AnyResponseData = Union[List[None], List[Union[bytes, Tuple[bytes, bytes]]]] +_AnyResponseData = Union[list[None], list[Union[bytes, tuple[bytes, bytes]]]] class IMAP4: - error: Type[Exception] = ... - abort: Type[Exception] = ... - readonly: Type[Exception] = ... + error: type[Exception] = ... + abort: type[Exception] = ... + readonly: type[Exception] = ... mustquote: Pattern[Text] = ... debug: int = ... state: str = ... literal: Text | None = ... - tagged_commands: Dict[bytes, List[bytes] | None] - untagged_responses: Dict[str, List[bytes | Tuple[bytes, bytes]]] + tagged_commands: dict[bytes, List[bytes] | None] + untagged_responses: dict[str, List[bytes | tuple[bytes, bytes]]] continuation_response: str = ... is_readonly: bool = ... tagnum: int = ... tagpre: str = ... tagre: Pattern[Text] = ... welcome: bytes = ... - capabilities: Tuple[str] = ... + capabilities: tuple[str] = ... PROTOCOL_VERSION: str = ... def __init__(self, host: str = ..., port: int = ...) -> None: ... def open(self, host: str = ..., port: int = ...) -> None: ... @@ -44,7 +45,7 @@ class IMAP4: def recent(self) -> _CommandResults: ... def response(self, code: str) -> _CommandResults: ... def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ... - def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> Tuple[str, str]: ... + def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> tuple[str, str]: ... def capability(self) -> _CommandResults: ... def check(self) -> _CommandResults: ... def close(self) -> _CommandResults: ... @@ -53,24 +54,24 @@ class IMAP4: def delete(self, mailbox: str) -> _CommandResults: ... def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ... def expunge(self) -> _CommandResults: ... - def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ... + def fetch(self, message_set: str, message_parts: str) -> tuple[str, _AnyResponseData]: ... def getacl(self, mailbox: str) -> _CommandResults: ... def getannotation(self, mailbox: str, entry: str, attribute: str) -> _CommandResults: ... def getquota(self, root: str) -> _CommandResults: ... def getquotaroot(self, mailbox: str) -> _CommandResults: ... - def list(self, directory: str = ..., pattern: str = ...) -> Tuple[str, _AnyResponseData]: ... - def login(self, user: str, password: str) -> Tuple[Literal["OK"], List[bytes]]: ... + def list(self, directory: str = ..., pattern: str = ...) -> tuple[str, _AnyResponseData]: ... + def login(self, user: str, password: str) -> tuple[Literal["OK"], List[bytes]]: ... def login_cram_md5(self, user: str, password: str) -> _CommandResults: ... - def logout(self) -> Tuple[str, _AnyResponseData]: ... + def logout(self) -> tuple[str, _AnyResponseData]: ... def lsub(self, directory: str = ..., pattern: str = ...) -> _CommandResults: ... def myrights(self, mailbox: str) -> _CommandResults: ... def namespace(self) -> _CommandResults: ... - def noop(self) -> Tuple[str, List[bytes]]: ... + def noop(self) -> tuple[str, List[bytes]]: ... def partial(self, message_num: str, message_part: str, start: str, length: str) -> _CommandResults: ... def proxyauth(self, user: str) -> _CommandResults: ... def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ... def search(self, charset: str | None, *criteria: str) -> _CommandResults: ... - def select(self, mailbox: str = ..., readonly: bool = ...) -> Tuple[str, List[bytes | None]]: ... + def select(self, mailbox: str = ..., readonly: bool = ...) -> tuple[str, List[bytes | None]]: ... def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ... def setannotation(self, *args: str) -> _CommandResults: ... def setquota(self, root: str, limits: str) -> _CommandResults: ... @@ -126,5 +127,5 @@ class _Authenticator: def Internaldate2tuple(resp: str) -> time.struct_time: ... def Int2AP(num: int) -> str: ... -def ParseFlags(resp: str) -> Tuple[str]: ... +def ParseFlags(resp: str) -> tuple[str]: ... def Time2Internaldate(date_time: float | time.struct_time | str) -> str: ... diff --git a/stdlib/@python2/imghdr.pyi b/stdlib/@python2/imghdr.pyi index d60cafa4c78f..dcfc3506fb9a 100644 --- a/stdlib/@python2/imghdr.pyi +++ b/stdlib/@python2/imghdr.pyi @@ -1,4 +1,4 @@ -from typing import Any, BinaryIO, Callable, List, Protocol, Text, Union, overload +from typing import Any, BinaryIO, Callable, Protocol, Text, Union, overload class _ReadableBinary(Protocol): def tell(self) -> int: ... @@ -12,4 +12,4 @@ def what(file: _File, h: None = ...) -> str | None: ... @overload def what(file: Any, h: bytes) -> str | None: ... -tests: List[Callable[[bytes, BinaryIO | None], str | None]] +tests: list[Callable[[bytes, BinaryIO | None], str | None]] diff --git a/stdlib/@python2/imp.pyi b/stdlib/@python2/imp.pyi index 128bd900e996..15d689249563 100644 --- a/stdlib/@python2/imp.pyi +++ b/stdlib/@python2/imp.pyi @@ -1,5 +1,5 @@ import types -from typing import IO, Any, Iterable, List, Tuple +from typing import IO, Any, Iterable C_BUILTIN: int C_EXTENSION: int @@ -13,16 +13,16 @@ PY_SOURCE: int SEARCH_ERROR: int def acquire_lock() -> None: ... -def find_module(name: str, path: Iterable[str] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]] | None: ... +def find_module(name: str, path: Iterable[str] = ...) -> tuple[IO[Any], str, tuple[str, str, int]] | None: ... def get_magic() -> str: ... -def get_suffixes() -> List[Tuple[str, str, int]]: ... +def get_suffixes() -> list[tuple[str, str, int]]: ... def init_builtin(name: str) -> types.ModuleType: ... def init_frozen(name: str) -> types.ModuleType: ... def is_builtin(name: str) -> int: ... def is_frozen(name: str) -> bool: ... def load_compiled(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... def load_dynamic(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... -def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ... +def load_module(name: str, file: str, pathname: str, description: tuple[str, str, int]) -> types.ModuleType: ... def load_source(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... def lock_held() -> bool: ... def new_module(name: str) -> types.ModuleType: ... diff --git a/stdlib/@python2/inspect.pyi b/stdlib/@python2/inspect.pyi index c6118ea8aebb..aa0450ce6785 100644 --- a/stdlib/@python2/inspect.pyi +++ b/stdlib/@python2/inspect.pyi @@ -1,5 +1,5 @@ from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType -from typing import Any, AnyStr, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, Union +from typing import Any, AnyStr, Callable, NamedTuple, Optional, Sequence, Union # Types and members class EndOfBlock(Exception): ... @@ -11,7 +11,7 @@ class BlockFinder: passline: bool last: int def tokeneater( - self, type: int, token: AnyStr, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: AnyStr + self, type: int, token: AnyStr, srow_scol: tuple[int, int], erow_ecol: tuple[int, int], line: AnyStr ) -> None: ... CO_GENERATOR: int @@ -29,7 +29,7 @@ class ModuleInfo(NamedTuple): mode: str module_type: int -def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> List[Tuple[str, Any]]: ... +def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> list[tuple[str, Any]]: ... def getmoduleinfo(path: str | unicode) -> ModuleInfo | None: ... def getmodulename(path: AnyStr) -> AnyStr | None: ... def ismodule(object: object) -> bool: ... @@ -50,9 +50,9 @@ def isgetsetdescriptor(object: object) -> bool: ... def ismemberdescriptor(object: object) -> bool: ... # Retrieving source code -_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]] +_SourceObjectType = Union[ModuleType, type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]] -def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ... +def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ... def getabsfile(object: _SourceObjectType) -> str: ... def getblock(lines: Sequence[AnyStr]) -> Sequence[AnyStr]: ... def getdoc(object: object) -> str | None: ... @@ -60,28 +60,28 @@ def getcomments(object: object) -> str | None: ... def getfile(object: _SourceObjectType) -> str: ... def getmodule(object: object) -> ModuleType | None: ... def getsourcefile(object: _SourceObjectType) -> str | None: ... -def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ... +def getsourcelines(object: _SourceObjectType) -> tuple[list[str], int]: ... def getsource(object: _SourceObjectType) -> str: ... def cleandoc(doc: AnyStr) -> AnyStr: ... def indentsize(line: str | unicode) -> int: ... # Classes and functions -def getclasstree(classes: List[type], unique: bool = ...) -> List[Tuple[type, Tuple[type, ...]] | List[Any]]: ... +def getclasstree(classes: list[type], unique: bool = ...) -> list[tuple[type, tuple[type, ...]] | list[Any]]: ... class ArgSpec(NamedTuple): - args: List[str] + args: list[str] varargs: str | None keywords: str | None - defaults: Tuple[Any, ...] + defaults: tuple[Any, ...] class ArgInfo(NamedTuple): - args: List[str] + args: list[str] varargs: str | None keywords: str | None - locals: Dict[str, Any] + locals: dict[str, Any] class Arguments(NamedTuple): - args: List[str | List[Any]] + args: list[str | list[Any]] varargs: str | None keywords: str | None @@ -94,8 +94,8 @@ def formatargspec( def formatargvalues( args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=... ) -> str: ... -def getmro(cls: type) -> Tuple[type, ...]: ... -def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ... +def getmro(cls: type) -> tuple[type, ...]: ... +def getcallargs(func, *args, **kwds) -> dict[str, Any]: ... # The interpreter stack @@ -103,18 +103,18 @@ class Traceback(NamedTuple): filename: str lineno: int function: str - code_context: List[str] | None + code_context: list[str] | None index: int | None # type: ignore -_FrameInfo = Tuple[FrameType, str, int, str, Optional[List[str]], Optional[int]] +_FrameInfo = tuple[FrameType, str, int, str, Optional[list[str]], Optional[int]] -def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ... +def getouterframes(frame: FrameType, context: int = ...) -> list[_FrameInfo]: ... def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ... -def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ... +def getinnerframes(traceback: TracebackType, context: int = ...) -> list[_FrameInfo]: ... def getlineno(frame: FrameType) -> int: ... def currentframe(depth: int = ...) -> FrameType: ... -def stack(context: int = ...) -> List[_FrameInfo]: ... -def trace(context: int = ...) -> List[_FrameInfo]: ... +def stack(context: int = ...) -> list[_FrameInfo]: ... +def trace(context: int = ...) -> list[_FrameInfo]: ... # Create private type alias to avoid conflict with symbol of same # name created in Attribute class. @@ -126,4 +126,4 @@ class Attribute(NamedTuple): defining_class: type object: _Object -def classify_class_attrs(cls: type) -> List[Attribute]: ... +def classify_class_attrs(cls: type) -> list[Attribute]: ... diff --git a/stdlib/@python2/itertools.pyi b/stdlib/@python2/itertools.pyi index 12996d44628b..c16ca8debb03 100644 --- a/stdlib/@python2/itertools.pyi +++ b/stdlib/@python2/itertools.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Generic, Iterable, Iterator, Sequence, Tuple, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Iterator, Sequence, TypeVar, overload _T = TypeVar("_T") _S = TypeVar("_S") @@ -24,9 +24,9 @@ def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterato def ifilter(predicate: Callable[[_T], Any] | None, iterable: Iterable[_T]) -> Iterator[_T]: ... def ifilterfalse(predicate: Callable[[_T], Any] | None, iterable: Iterable[_T]) -> Iterator[_T]: ... @overload -def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ... +def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[tuple[_T, Iterator[_T]]]: ... @overload -def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... +def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[tuple[_S, Iterator[_T]]]: ... @overload def islice(iterable: Iterable[_T], stop: int | None) -> Iterator[_T]: ... @overload @@ -88,21 +88,21 @@ def imap( ) -> Iterator[_S]: ... def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ... def takewhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... -def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ... +def tee(iterable: Iterable[_T], n: int = ...) -> tuple[Iterator[_T], ...]: ... @overload -def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... +def izip(iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ... @overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... +def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[tuple[_T1, _T2]]: ... @overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... +def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[tuple[_T1, _T2, _T3]]: ... @overload def izip( iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4]]: ... @overload def izip( iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def izip( iter1: Iterable[_T1], @@ -111,7 +111,7 @@ def izip( iter4: Iterable[_T4], iter5: Iterable[_T5], iter6: Iterable[_T6], -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... @overload def izip( iter1: Iterable[Any], @@ -122,22 +122,22 @@ def izip( iter6: Iterable[Any], iter7: Iterable[Any], *iterables: Iterable[Any], -) -> Iterator[Tuple[Any, ...]]: ... +) -> Iterator[tuple[Any, ...]]: ... def izip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ... @overload -def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... +def product(iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ... @overload -def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... +def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[tuple[_T1, _T2]]: ... @overload -def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... +def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[tuple[_T1, _T2, _T3]]: ... @overload def product( iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4]]: ... @overload def product( iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def product( iter1: Iterable[_T1], @@ -146,7 +146,7 @@ def product( iter4: Iterable[_T4], iter5: Iterable[_T5], iter6: Iterable[_T6], -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... +) -> Iterator[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... @overload def product( iter1: Iterable[Any], @@ -157,9 +157,9 @@ def product( iter6: Iterable[Any], iter7: Iterable[Any], *iterables: Iterable[Any], -) -> Iterator[Tuple[Any, ...]]: ... +) -> Iterator[tuple[Any, ...]]: ... @overload -def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ... +def product(*iterables: Iterable[Any], repeat: int) -> Iterator[tuple[Any, ...]]: ... def permutations(iterable: Iterable[_T], r: int = ...) -> Iterator[Sequence[_T]]: ... def combinations(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... diff --git a/stdlib/@python2/json.pyi b/stdlib/@python2/json.pyi index bfbddb2a6835..fa6fdc49b9a9 100644 --- a/stdlib/@python2/json.pyi +++ b/stdlib/@python2/json.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsRead -from typing import IO, Any, Callable, Dict, List, Text, Tuple, Type +from typing import IO, Any, Callable, Text def dumps( obj: Any, @@ -7,9 +7,9 @@ def dumps( ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., + cls: type[JSONEncoder] | None = ..., indent: int | None = ..., - separators: Tuple[str, str] | None = ..., + separators: tuple[str, str] | None = ..., encoding: str = ..., default: Callable[[Any], Any] | None = ..., sort_keys: bool = ..., @@ -22,9 +22,9 @@ def dump( ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., + cls: type[JSONEncoder] | None = ..., indent: int | None = ..., - separators: Tuple[str, str] | None = ..., + separators: tuple[str, str] | None = ..., encoding: str = ..., default: Callable[[Any], Any] | None = ..., sort_keys: bool = ..., @@ -33,23 +33,23 @@ def dump( def loads( s: Text | bytes, encoding: Any = ..., - cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., + cls: type[JSONDecoder] | None = ..., + object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... def load( fp: SupportsRead[Text | bytes], encoding: str | None = ..., - cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., + cls: type[JSONDecoder] | None = ..., + object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... @@ -65,7 +65,7 @@ class JSONDecoder(object): object_pairs_hook: Callable[..., Any] = ..., ) -> None: ... def decode(self, s: Text | bytes, _w: Any = ...) -> Any: ... - def raw_decode(self, s: Text | bytes, idx: int = ...) -> Tuple[Any, Any]: ... + def raw_decode(self, s: Text | bytes, idx: int = ...) -> tuple[Any, Any]: ... class JSONEncoder(object): item_separator: str @@ -84,7 +84,7 @@ class JSONEncoder(object): allow_nan: bool = ..., sort_keys: bool = ..., indent: int | None = ..., - separators: Tuple[Text | bytes, Text | bytes] = ..., + separators: tuple[Text | bytes, Text | bytes] = ..., encoding: Text | bytes = ..., default: Callable[..., Any] = ..., ) -> None: ... diff --git a/stdlib/@python2/lib2to3/pgen2/grammar.pyi b/stdlib/@python2/lib2to3/pgen2/grammar.pyi index 22799dd551b8..32eed63d42f9 100644 --- a/stdlib/@python2/lib2to3/pgen2/grammar.pyi +++ b/stdlib/@python2/lib2to3/pgen2/grammar.pyi @@ -1,19 +1,19 @@ from _typeshed import Self, StrPath -from typing import Dict, List, Optional, Text, Tuple +from typing import Optional, Text -_Label = Tuple[int, Optional[Text]] -_DFA = List[List[Tuple[int, int]]] -_DFAS = Tuple[_DFA, Dict[int, int]] +_Label = tuple[int, Optional[Text]] +_DFA = list[list[tuple[int, int]]] +_DFAS = tuple[_DFA, dict[int, int]] class Grammar: - symbol2number: Dict[Text, int] - number2symbol: Dict[int, Text] - states: List[_DFA] - dfas: Dict[int, _DFAS] - labels: List[_Label] - keywords: Dict[Text, int] - tokens: Dict[int, int] - symbol2label: Dict[Text, int] + symbol2number: dict[Text, int] + number2symbol: dict[int, Text] + states: list[_DFA] + dfas: dict[int, _DFAS] + labels: list[_Label] + keywords: dict[Text, int] + tokens: dict[int, int] + symbol2label: dict[Text, int] start: int def __init__(self) -> None: ... def dump(self, filename: StrPath) -> None: ... @@ -22,4 +22,4 @@ class Grammar: def report(self) -> None: ... opmap_raw: Text -opmap: Dict[Text, Text] +opmap: dict[Text, Text] diff --git a/stdlib/@python2/lib2to3/pgen2/literals.pyi b/stdlib/@python2/lib2to3/pgen2/literals.pyi index 160d6fd76f76..c7a219b5f9af 100644 --- a/stdlib/@python2/lib2to3/pgen2/literals.pyi +++ b/stdlib/@python2/lib2to3/pgen2/literals.pyi @@ -1,6 +1,6 @@ -from typing import Dict, Match, Text +from typing import Match, Text -simple_escapes: Dict[Text, Text] +simple_escapes: dict[Text, Text] def escape(m: Match[str]) -> Text: ... def evalString(s: Text) -> Text: ... diff --git a/stdlib/@python2/lib2to3/pgen2/parse.pyi b/stdlib/@python2/lib2to3/pgen2/parse.pyi index eed165db551c..be66a8e21e7e 100644 --- a/stdlib/@python2/lib2to3/pgen2/parse.pyi +++ b/stdlib/@python2/lib2to3/pgen2/parse.pyi @@ -1,6 +1,6 @@ from lib2to3.pgen2.grammar import _DFAS, Grammar from lib2to3.pytree import _NL, _Convert, _RawNode -from typing import Any, List, Sequence, Set, Text, Tuple +from typing import Any, Sequence, Text _Context = Sequence[Any] @@ -14,9 +14,9 @@ class ParseError(Exception): class Parser: grammar: Grammar convert: _Convert - stack: List[Tuple[_DFAS, int, _RawNode]] + stack: list[tuple[_DFAS, int, _RawNode]] rootnode: _NL | None - used_names: Set[Text] + used_names: set[Text] def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... def setup(self, start: int | None = ...) -> None: ... def addtoken(self, type: int, value: Text | None, context: _Context) -> bool: ... diff --git a/stdlib/@python2/lib2to3/pgen2/pgen.pyi b/stdlib/@python2/lib2to3/pgen2/pgen.pyi index 67dbbccdd4a6..5b2dc70ed826 100644 --- a/stdlib/@python2/lib2to3/pgen2/pgen.pyi +++ b/stdlib/@python2/lib2to3/pgen2/pgen.pyi @@ -1,7 +1,7 @@ from _typeshed import StrPath from lib2to3.pgen2 import grammar from lib2to3.pgen2.tokenize import _TokenInfo -from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Text, Tuple +from typing import IO, Any, Iterable, Iterator, NoReturn, Text class PgenGrammar(grammar.Grammar): ... @@ -9,36 +9,36 @@ class ParserGenerator: filename: StrPath stream: IO[Text] generator: Iterator[_TokenInfo] - first: Dict[Text, Dict[Text, int]] + first: dict[Text, dict[Text, int]] def __init__(self, filename: StrPath, stream: IO[Text] | None = ...) -> None: ... def make_grammar(self) -> PgenGrammar: ... - def make_first(self, c: PgenGrammar, name: Text) -> Dict[int, int]: ... + def make_first(self, c: PgenGrammar, name: Text) -> dict[int, int]: ... def make_label(self, c: PgenGrammar, label: Text) -> int: ... def addfirstsets(self) -> None: ... def calcfirst(self, name: Text) -> None: ... - def parse(self) -> Tuple[Dict[Text, List[DFAState]], Text]: ... - def make_dfa(self, start: NFAState, finish: NFAState) -> List[DFAState]: ... - def dump_nfa(self, name: Text, start: NFAState, finish: NFAState) -> List[DFAState]: ... + def parse(self) -> tuple[dict[Text, list[DFAState]], Text]: ... + def make_dfa(self, start: NFAState, finish: NFAState) -> list[DFAState]: ... + def dump_nfa(self, name: Text, start: NFAState, finish: NFAState) -> list[DFAState]: ... def dump_dfa(self, name: Text, dfa: Iterable[DFAState]) -> None: ... - def simplify_dfa(self, dfa: List[DFAState]) -> None: ... - def parse_rhs(self) -> Tuple[NFAState, NFAState]: ... - def parse_alt(self) -> Tuple[NFAState, NFAState]: ... - def parse_item(self) -> Tuple[NFAState, NFAState]: ... - def parse_atom(self) -> Tuple[NFAState, NFAState]: ... + def simplify_dfa(self, dfa: list[DFAState]) -> None: ... + def parse_rhs(self) -> tuple[NFAState, NFAState]: ... + def parse_alt(self) -> tuple[NFAState, NFAState]: ... + def parse_item(self) -> tuple[NFAState, NFAState]: ... + def parse_atom(self) -> tuple[NFAState, NFAState]: ... def expect(self, type: int, value: Any | None = ...) -> Text: ... def gettoken(self) -> None: ... def raise_error(self, msg: str, *args: Any) -> NoReturn: ... class NFAState: - arcs: List[Tuple[Text | None, NFAState]] + arcs: list[tuple[Text | None, NFAState]] def __init__(self) -> None: ... def addarc(self, next: NFAState, label: Text | None = ...) -> None: ... class DFAState: - nfaset: Dict[NFAState, Any] + nfaset: dict[NFAState, Any] isfinal: bool - arcs: Dict[Text, DFAState] - def __init__(self, nfaset: Dict[NFAState, Any], final: NFAState) -> None: ... + arcs: dict[Text, DFAState] + def __init__(self, nfaset: dict[NFAState, Any], final: NFAState) -> None: ... def addarc(self, next: DFAState, label: Text) -> None: ... def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: Any) -> bool: ... diff --git a/stdlib/@python2/lib2to3/pgen2/token.pyi b/stdlib/@python2/lib2to3/pgen2/token.pyi index 3f4e41d49bd5..967c4df5d721 100644 --- a/stdlib/@python2/lib2to3/pgen2/token.pyi +++ b/stdlib/@python2/lib2to3/pgen2/token.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Text +from typing import Text ENDMARKER: int NAME: int @@ -56,7 +56,7 @@ NL: int ERRORTOKEN: int N_TOKENS: int NT_OFFSET: int -tok_name: Dict[int, Text] +tok_name: dict[int, Text] def ISTERMINAL(x: int) -> bool: ... def ISNONTERMINAL(x: int) -> bool: ... diff --git a/stdlib/@python2/lib2to3/pgen2/tokenize.pyi b/stdlib/@python2/lib2to3/pgen2/tokenize.pyi index 477341c1a54e..d93d3f482766 100644 --- a/stdlib/@python2/lib2to3/pgen2/tokenize.pyi +++ b/stdlib/@python2/lib2to3/pgen2/tokenize.pyi @@ -1,9 +1,9 @@ from lib2to3.pgen2.token import * # noqa -from typing import Callable, Iterable, Iterator, List, Text, Tuple +from typing import Callable, Iterable, Iterator, Text -_Coord = Tuple[int, int] +_Coord = tuple[int, int] _TokenEater = Callable[[int, Text, _Coord, _Coord, Text], None] -_TokenInfo = Tuple[int, Text, _Coord, _Coord, Text] +_TokenInfo = tuple[int, Text, _Coord, _Coord, Text] class TokenError(Exception): ... class StopTokenizing(Exception): ... @@ -11,13 +11,13 @@ class StopTokenizing(Exception): ... def tokenize(readline: Callable[[], Text], tokeneater: _TokenEater = ...) -> None: ... class Untokenizer: - tokens: List[Text] + tokens: list[Text] prev_row: int prev_col: int def __init__(self) -> None: ... def add_whitespace(self, start: _Coord) -> None: ... def untokenize(self, iterable: Iterable[_TokenInfo]) -> Text: ... - def compat(self, token: Tuple[int, Text], iterable: Iterable[_TokenInfo]) -> None: ... + def compat(self, token: tuple[int, Text], iterable: Iterable[_TokenInfo]) -> None: ... def untokenize(iterable: Iterable[_TokenInfo]) -> Text: ... def generate_tokens(readline: Callable[[], Text]) -> Iterator[_TokenInfo]: ... diff --git a/stdlib/@python2/lib2to3/pytree.pyi b/stdlib/@python2/lib2to3/pytree.pyi index 2a069128f6b2..d96df2a9dc9e 100644 --- a/stdlib/@python2/lib2to3/pytree.pyi +++ b/stdlib/@python2/lib2to3/pytree.pyi @@ -1,12 +1,12 @@ from _typeshed import Self from lib2to3.pgen2.grammar import Grammar -from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union +from typing import Any, Callable, Iterator, Optional, Text, TypeVar, Union _P = TypeVar("_P") _NL = Union[Node, Leaf] -_Context = Tuple[Text, int, int] -_Results = Dict[Text, _NL] -_RawNode = Tuple[int, Text, _Context, Optional[List[_NL]]] +_Context = tuple[Text, int, int] +_Results = dict[Text, _NL] +_RawNode = tuple[int, Text, _Context, Optional[list[_NL]]] _Convert = Callable[[Grammar, _RawNode], Any] HUGE: int @@ -17,7 +17,7 @@ class Base: type: int parent: Node | None prefix: Text - children: List[_NL] + children: list[_NL] was_changed: bool was_checked: bool def __eq__(self, other: Any) -> bool: ... @@ -25,7 +25,7 @@ class Base: def clone(self: Self) -> Self: ... def post_order(self) -> Iterator[_NL]: ... def pre_order(self) -> Iterator[_NL]: ... - def replace(self, new: _NL | List[_NL]) -> None: ... + def replace(self, new: _NL | list[_NL]) -> None: ... def get_lineno(self) -> int: ... def changed(self) -> None: ... def remove(self) -> int | None: ... @@ -40,14 +40,14 @@ class Base: def set_prefix(self, prefix: Text) -> None: ... class Node(Base): - fixers_applied: List[Any] + fixers_applied: list[Any] def __init__( self, type: int, - children: List[_NL], + children: list[_NL], context: Any | None = ..., prefix: Text | None = ..., - fixers_applied: List[Any] | None = ..., + fixers_applied: list[Any] | None = ..., ) -> None: ... def set_child(self, i: int, child: _NL) -> None: ... def insert_child(self, i: int, child: _NL) -> None: ... @@ -57,9 +57,9 @@ class Leaf(Base): lineno: int column: int value: Text - fixers_applied: List[Any] + fixers_applied: list[Any] def __init__( - self, type: int, value: Text, context: _Context | None = ..., prefix: Text | None = ..., fixers_applied: List[Any] = ... + self, type: int, value: Text, context: _Context | None = ..., prefix: Text | None = ..., fixers_applied: list[Any] = ... ) -> None: ... def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ... @@ -70,8 +70,8 @@ class BasePattern: name: Text | None def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns def match(self, node: _NL, results: _Results | None = ...) -> bool: ... - def match_seq(self, nodes: List[_NL], results: _Results | None = ...) -> bool: ... - def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... + def match_seq(self, nodes: list[_NL], results: _Results | None = ...) -> bool: ... + def generate_matches(self, nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... class LeafPattern(BasePattern): def __init__(self, type: int | None = ..., content: Text | None = ..., name: Text | None = ...) -> None: ... @@ -88,4 +88,4 @@ class WildcardPattern(BasePattern): class NegatedPattern(BasePattern): def __init__(self, content: Text | None = ...) -> None: ... -def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... +def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... diff --git a/stdlib/@python2/linecache.pyi b/stdlib/@python2/linecache.pyi index 8628a0c58adc..68c907499867 100644 --- a/stdlib/@python2/linecache.pyi +++ b/stdlib/@python2/linecache.pyi @@ -1,9 +1,9 @@ -from typing import Any, Dict, List, Text +from typing import Any, Text -_ModuleGlobals = Dict[str, Any] +_ModuleGlobals = dict[str, Any] def getline(filename: Text, lineno: int, module_globals: _ModuleGlobals | None = ...) -> str: ... def clearcache() -> None: ... -def getlines(filename: Text, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... +def getlines(filename: Text, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... def checkcache(filename: Text | None = ...) -> None: ... -def updatecache(filename: Text, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... +def updatecache(filename: Text, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... diff --git a/stdlib/@python2/locale.pyi b/stdlib/@python2/locale.pyi index 21a7da166e29..c75d865b8746 100644 --- a/stdlib/@python2/locale.pyi +++ b/stdlib/@python2/locale.pyi @@ -1,7 +1,7 @@ # workaround for mypy#2010 from __builtin__ import str as _str from decimal import Decimal -from typing import Any, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple +from typing import Any, Callable, Iterable, Mapping, Sequence CODESET: int D_T_FMT: int @@ -75,9 +75,9 @@ CHAR_MAX: int class Error(Exception): ... def setlocale(category: int, locale: _str | Iterable[_str] | None = ...) -> _str: ... -def localeconv() -> Mapping[_str, int | _str | List[int]]: ... +def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... -def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[_str | None, _str | None]: ... +def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ... def getlocale(category: int = ...) -> Sequence[_str]: ... def getpreferredencoding(do_setlocale: bool = ...) -> _str: ... def normalize(localename: _str) -> _str: ... @@ -91,6 +91,6 @@ def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... def atoi(string: _str) -> int: ... def str(val: float) -> _str: ... -locale_alias: Dict[_str, _str] # undocumented -locale_encoding_alias: Dict[_str, _str] # undocumented -windows_locale: Dict[int, _str] # undocumented +locale_alias: dict[_str, _str] # undocumented +locale_encoding_alias: dict[_str, _str] # undocumented +windows_locale: dict[int, _str] # undocumented diff --git a/stdlib/@python2/logging/__init__.pyi b/stdlib/@python2/logging/__init__.pyi index f981e2400624..9ca64dc966ae 100644 --- a/stdlib/@python2/logging/__init__.pyi +++ b/stdlib/@python2/logging/__init__.pyi @@ -2,27 +2,11 @@ import threading from _typeshed import StrPath, SupportsWrite from time import struct_time from types import FrameType, TracebackType -from typing import ( - IO, - Any, - Callable, - Dict, - Generic, - List, - Mapping, - MutableMapping, - Optional, - Sequence, - Text, - Tuple, - TypeVar, - Union, - overload, -) +from typing import IO, Any, Callable, Generic, Mapping, MutableMapping, Optional, Sequence, Text, TypeVar, Union, overload -_SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]] +_SysExcInfoType = Union[tuple[type, BaseException, Optional[TracebackType]], tuple[None, None, None]] _ExcInfoType = Union[None, bool, _SysExcInfoType] -_ArgsType = Union[Tuple[Any, ...], Mapping[str, Any]] +_ArgsType = Union[tuple[Any, ...], Mapping[str, Any]] _FilterType = Union[Filter, Callable[[LogRecord], int]] _Level = Union[int, Text] @@ -34,10 +18,10 @@ _srcfile: str | None def currentframe() -> FrameType: ... -_levelNames: Dict[int | str, str | int] # Union[int:str, str:int] +_levelNames: dict[int | str, str | int] # Union[int:str, str:int] class Filterer(object): - filters: List[Filter] + filters: list[Filter] def __init__(self) -> None: ... def addFilter(self, filter: _FilterType) -> None: ... def removeFilter(self, filter: _FilterType) -> None: ... @@ -48,7 +32,7 @@ class Logger(Filterer): level: int parent: Logger | PlaceHolder propagate: bool - handlers: List[Handler] + handlers: list[Handler] disabled: int def __init__(self, name: str, level: _Level = ...) -> None: ... def setLevel(self, level: _Level) -> None: ... @@ -56,35 +40,35 @@ class Logger(Filterer): def getEffectiveLevel(self) -> int: ... def getChild(self, suffix: str) -> Logger: ... def debug( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def info( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def warning( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... warn = warning def error( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def critical( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... fatal = critical def log( - self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def exception( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def _log( - self, level: int, msg: Any, args: _ArgsType, exc_info: _ExcInfoType | None = ..., extra: Dict[str, Any] | None = ... + self, level: int, msg: Any, args: _ArgsType, exc_info: _ExcInfoType | None = ..., extra: dict[str, Any] | None = ... ) -> None: ... # undocumented def filter(self, record: LogRecord) -> bool: ... def addHandler(self, hdlr: Handler) -> None: ... def removeHandler(self, hdlr: Handler) -> None: ... - def findCaller(self) -> Tuple[str, int, str]: ... + def findCaller(self) -> tuple[str, int, str]: ... def handle(self, record: LogRecord) -> None: ... def makeRecord( self, @@ -181,27 +165,27 @@ class LoggerAdapter(Generic[_L]): logger: _L extra: Mapping[str, Any] def __init__(self, logger: _L, extra: Mapping[str, Any]) -> None: ... - def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> Tuple[Any, MutableMapping[str, Any]]: ... + def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> tuple[Any, MutableMapping[str, Any]]: ... def debug( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def info( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def warning( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def error( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def exception( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def critical( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def log( - self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... def isEnabledFor(self, level: int) -> bool: ... @@ -210,17 +194,17 @@ def getLogger() -> Logger: ... @overload def getLogger(name: Text | str) -> Logger: ... def getLoggerClass() -> type: ... -def debug(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def info(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def warning(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def debug(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def info(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def warning(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... warn = warning -def error(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def critical(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def exception(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def error(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def critical(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... +def exception(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any) -> None: ... def log( - level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any + level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: dict[str, Any] | None = ..., **kwargs: Any ) -> None: ... fatal = critical diff --git a/stdlib/@python2/logging/config.pyi b/stdlib/@python2/logging/config.pyi index 03707bb98f55..5597347d0961 100644 --- a/stdlib/@python2/logging/config.pyi +++ b/stdlib/@python2/logging/config.pyi @@ -1,10 +1,10 @@ from _typeshed import StrPath from threading import Thread -from typing import IO, Any, Dict +from typing import IO, Any _Path = StrPath -def dictConfig(config: Dict[str, Any]) -> None: ... -def fileConfig(fname: str | IO[str], defaults: Dict[str, str] | None = ..., disable_existing_loggers: bool = ...) -> None: ... +def dictConfig(config: dict[str, Any]) -> None: ... +def fileConfig(fname: str | IO[str], defaults: dict[str, str] | None = ..., disable_existing_loggers: bool = ...) -> None: ... def listen(port: int = ...) -> Thread: ... def stopListening() -> None: ... diff --git a/stdlib/@python2/logging/handlers.pyi b/stdlib/@python2/logging/handlers.pyi index d18d57e77af4..360e76c66558 100644 --- a/stdlib/@python2/logging/handlers.pyi +++ b/stdlib/@python2/logging/handlers.pyi @@ -1,7 +1,7 @@ from _typeshed import StrPath from logging import FileHandler, Handler, LogRecord from socket import SocketKind, SocketType -from typing import Any, ClassVar, Dict, List, Tuple +from typing import Any, ClassVar DEFAULT_TCP_LOGGING_PORT: int DEFAULT_UDP_LOGGING_PORT: int @@ -84,14 +84,14 @@ class SysLogHandler(Handler): LOG_LOCAL5: int LOG_LOCAL6: int LOG_LOCAL7: int - address: Tuple[str, int] | str # undocumented + address: tuple[str, int] | str # undocumented unixsocket: bool # undocumented socktype: SocketKind # undocumented facility: int # undocumented - priority_names: ClassVar[Dict[str, int]] # undocumented - facility_names: ClassVar[Dict[str, int]] # undocumented - priority_map: ClassVar[Dict[str, str]] # undocumented - def __init__(self, address: Tuple[str, int] | str = ..., facility: int = ..., socktype: SocketKind | None = ...) -> None: ... + priority_names: ClassVar[dict[str, int]] # undocumented + facility_names: ClassVar[dict[str, int]] # undocumented + priority_map: ClassVar[dict[str, str]] # undocumented + def __init__(self, address: tuple[str, int] | str = ..., facility: int = ..., socktype: SocketKind | None = ...) -> None: ... def encodePriority(self, facility: int | str, priority: int | str) -> int: ... def mapPriority(self, levelName: str) -> str: ... @@ -106,17 +106,17 @@ class SMTPHandler(Handler): # TODO `secure` can also be an empty tuple def __init__( self, - mailhost: str | Tuple[str, int], + mailhost: str | tuple[str, int], fromaddr: str, - toaddrs: List[str], + toaddrs: list[str], subject: str, - credentials: Tuple[str, str] | None = ..., - secure: Tuple[str] | Tuple[str, str] | None = ..., + credentials: tuple[str, str] | None = ..., + secure: tuple[str] | tuple[str, str] | None = ..., ) -> None: ... def getSubject(self, record: LogRecord) -> str: ... class BufferingHandler(Handler): - buffer: List[LogRecord] + buffer: list[LogRecord] def __init__(self, capacity: int) -> None: ... def shouldFlush(self, record: LogRecord) -> bool: ... @@ -126,4 +126,4 @@ class MemoryHandler(BufferingHandler): class HTTPHandler(Handler): def __init__(self, host: str, url: str, method: str = ...) -> None: ... - def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ... + def mapLogRecord(self, record: LogRecord) -> dict[str, Any]: ... diff --git a/stdlib/@python2/macpath.pyi b/stdlib/@python2/macpath.pyi index bcb882e23eef..73d55b15328f 100644 --- a/stdlib/@python2/macpath.pyi +++ b/stdlib/@python2/macpath.pyi @@ -27,7 +27,7 @@ from posixpath import ( splitext as splitext, supports_unicode_filenames as supports_unicode_filenames, ) -from typing import AnyStr, Text, Tuple, overload +from typing import AnyStr, Text, overload altsep: str | None @@ -52,4 +52,4 @@ def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... @overload def join(__p1: Text, *p: Text) -> Text: ... -def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(s: AnyStr) -> tuple[AnyStr, AnyStr]: ... diff --git a/stdlib/@python2/mailbox.pyi b/stdlib/@python2/mailbox.pyi index 18a66fa964c4..9c4aa66cdbb7 100644 --- a/stdlib/@python2/mailbox.pyi +++ b/stdlib/@python2/mailbox.pyi @@ -5,17 +5,13 @@ from typing import ( Any, AnyStr, Callable, - Dict, Generic, Iterable, Iterator, - List, Mapping, Protocol, Sequence, Text, - Tuple, - Type, TypeVar, Union, overload, @@ -27,10 +23,10 @@ _MessageT = TypeVar("_MessageT", bound=Message) _MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]] class _HasIteritems(Protocol): - def iteritems(self) -> Iterator[Tuple[str, _MessageData]]: ... + def iteritems(self) -> Iterator[tuple[str, _MessageData]]: ... class _HasItems(Protocol): - def items(self) -> Iterator[Tuple[str, _MessageData]]: ... + def items(self) -> Iterator[tuple[str, _MessageData]]: ... linesep: bytes @@ -55,12 +51,12 @@ class Mailbox(Generic[_MessageT]): # As '_ProxyFile' doesn't implement the full IO spec, and BytesIO is incompatible with it, get_file return is Any here def get_file(self, key: str) -> Any: ... def iterkeys(self) -> Iterator[str]: ... - def keys(self) -> List[str]: ... + def keys(self) -> list[str]: ... def itervalues(self) -> Iterator[_MessageT]: ... def __iter__(self) -> Iterator[_MessageT]: ... - def values(self) -> List[_MessageT]: ... - def iteritems(self) -> Iterator[Tuple[str, _MessageT]]: ... - def items(self) -> List[Tuple[str, _MessageT]]: ... + def values(self) -> list[_MessageT]: ... + def iteritems(self) -> Iterator[tuple[str, _MessageT]]: ... + def items(self) -> list[tuple[str, _MessageT]]: ... def __contains__(self, key: str) -> bool: ... def __len__(self) -> int: ... def clear(self) -> None: ... @@ -68,8 +64,8 @@ class Mailbox(Generic[_MessageT]): def pop(self, key: str, default: None = ...) -> _MessageT | None: ... @overload def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ... - def popitem(self) -> Tuple[str, _MessageT]: ... - def update(self, arg: _HasIteritems | _HasItems | Iterable[Tuple[str, _MessageData]] | None = ...) -> None: ... + def popitem(self) -> tuple[str, _MessageT]: ... + def update(self, arg: _HasIteritems | _HasItems | Iterable[tuple[str, _MessageData]] | None = ...) -> None: ... def flush(self) -> None: ... def lock(self) -> None: ... def unlock(self) -> None: ... @@ -80,7 +76,7 @@ class Maildir(Mailbox[MaildirMessage]): colon: str def __init__(self, dirname: Text, factory: Callable[[IO[Any]], MaildirMessage] | None = ..., create: bool = ...) -> None: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... + def list_folders(self) -> list[str]: ... def get_folder(self, folder: Text) -> Maildir: ... def add_folder(self, folder: Text) -> Maildir: ... def remove_folder(self, folder: Text) -> None: ... @@ -103,18 +99,18 @@ class MMDF(_mboxMMDF[MMDFMessage]): class MH(Mailbox[MHMessage]): def __init__(self, path: Text, factory: Callable[[IO[Any]], MHMessage] | None = ..., create: bool = ...) -> None: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... + def list_folders(self) -> list[str]: ... def get_folder(self, folder: Text) -> MH: ... def add_folder(self, folder: Text) -> MH: ... def remove_folder(self, folder: Text) -> None: ... - def get_sequences(self) -> Dict[str, List[int]]: ... + def get_sequences(self) -> dict[str, list[int]]: ... def set_sequences(self, sequences: Mapping[str, Sequence[int]]) -> None: ... def pack(self) -> None: ... class Babyl(_singlefileMailbox[BabylMessage]): def __init__(self, path: Text, factory: Callable[[IO[Any]], BabylMessage] | None = ..., create: bool = ...) -> None: ... def get_file(self, key: str) -> IO[bytes]: ... - def get_labels(self) -> List[str]: ... + def get_labels(self) -> list[str]: ... class Message(email.message.Message): def __init__(self, message: _MessageData | None = ...) -> None: ... @@ -133,7 +129,7 @@ class MaildirMessage(Message): class _mboxMMDFMessage(Message): def get_from(self) -> str: ... - def set_from(self, from_: str, time_: bool | Tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... + def set_from(self, from_: str, time_: bool | tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... def get_flags(self) -> str: ... def set_flags(self, flags: Iterable[str]) -> None: ... def add_flag(self, flag: str) -> None: ... @@ -142,13 +138,13 @@ class _mboxMMDFMessage(Message): class mboxMessage(_mboxMMDFMessage): ... class MHMessage(Message): - def get_sequences(self) -> List[str]: ... + def get_sequences(self) -> list[str]: ... def set_sequences(self, sequences: Iterable[str]) -> None: ... def add_sequence(self, sequence: str) -> None: ... def remove_sequence(self, sequence: str) -> None: ... class BabylMessage(Message): - def get_labels(self) -> List[str]: ... + def get_labels(self) -> list[str]: ... def set_labels(self, labels: Iterable[str]) -> None: ... def add_label(self, label: str) -> None: ... def remove_label(self, label: str) -> None: ... @@ -163,13 +159,13 @@ class _ProxyFile(Generic[AnyStr]): def read(self, size: int | None = ...) -> AnyStr: ... def read1(self, size: int | None = ...) -> AnyStr: ... def readline(self, size: int | None = ...) -> AnyStr: ... - def readlines(self, sizehint: int | None = ...) -> List[AnyStr]: ... + def readlines(self, sizehint: int | None = ...) -> list[AnyStr]: ... def __iter__(self) -> Iterator[AnyStr]: ... def tell(self) -> int: ... def seek(self, offset: int, whence: int = ...) -> None: ... def close(self) -> None: ... def __enter__(self) -> _ProxyFile[AnyStr]: ... - def __exit__(self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... def seekable(self) -> bool: ... diff --git a/stdlib/@python2/mailcap.pyi b/stdlib/@python2/mailcap.pyi index b29854f3c744..56218d1370fe 100644 --- a/stdlib/@python2/mailcap.pyi +++ b/stdlib/@python2/mailcap.pyi @@ -1,8 +1,8 @@ -from typing import Dict, List, Mapping, Sequence, Tuple, Union +from typing import Mapping, Sequence, Union -_Cap = Dict[str, Union[str, int]] +_Cap = dict[str, Union[str, int]] def findmatch( - caps: Mapping[str, List[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... -) -> Tuple[str | None, _Cap | None]: ... -def getcaps() -> Dict[str, List[_Cap]]: ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... +) -> tuple[str | None, _Cap | None]: ... +def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/@python2/markupbase.pyi b/stdlib/@python2/markupbase.pyi index 727daaacf25e..869c341b66aa 100644 --- a/stdlib/@python2/markupbase.pyi +++ b/stdlib/@python2/markupbase.pyi @@ -1,8 +1,6 @@ -from typing import Tuple - class ParserBase(object): def __init__(self) -> None: ... def error(self, message: str) -> None: ... def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... + def getpos(self) -> tuple[int, int]: ... def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/@python2/math.pyi b/stdlib/@python2/math.pyi index caddcedd864b..643242a73fa9 100644 --- a/stdlib/@python2/math.pyi +++ b/stdlib/@python2/math.pyi @@ -1,4 +1,4 @@ -from typing import Iterable, SupportsFloat, SupportsInt, Tuple +from typing import Iterable, SupportsFloat, SupportsInt e: float pi: float @@ -23,7 +23,7 @@ def fabs(__x: SupportsFloat) -> float: ... def factorial(__x: SupportsInt) -> int: ... def floor(__x: SupportsFloat) -> float: ... def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def frexp(__x: SupportsFloat) -> Tuple[float, int]: ... +def frexp(__x: SupportsFloat) -> tuple[float, int]: ... def fsum(__seq: Iterable[float]) -> float: ... def gamma(__x: SupportsFloat) -> float: ... def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ... @@ -34,7 +34,7 @@ def lgamma(__x: SupportsFloat) -> float: ... def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... def log10(__x: SupportsFloat) -> float: ... def log1p(__x: SupportsFloat) -> float: ... -def modf(__x: SupportsFloat) -> Tuple[float, float]: ... +def modf(__x: SupportsFloat) -> tuple[float, float]: ... def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ... def radians(__x: SupportsFloat) -> float: ... def sin(__x: SupportsFloat) -> float: ... diff --git a/stdlib/@python2/mimetypes.pyi b/stdlib/@python2/mimetypes.pyi index a9661dab56ad..a7cddca65921 100644 --- a/stdlib/@python2/mimetypes.pyi +++ b/stdlib/@python2/mimetypes.pyi @@ -1,29 +1,29 @@ import sys -from typing import IO, Dict, List, Sequence, Text, Tuple +from typing import IO, Sequence, Text -def guess_type(url: Text, strict: bool = ...) -> Tuple[str | None, str | None]: ... -def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... +def guess_type(url: Text, strict: bool = ...) -> tuple[str | None, str | None]: ... +def guess_all_extensions(type: str, strict: bool = ...) -> list[str]: ... def guess_extension(type: str, strict: bool = ...) -> str | None: ... def init(files: Sequence[str] | None = ...) -> None: ... -def read_mime_types(file: str) -> Dict[str, str] | None: ... +def read_mime_types(file: str) -> dict[str, str] | None: ... def add_type(type: str, ext: str, strict: bool = ...) -> None: ... inited: bool -knownfiles: List[str] -suffix_map: Dict[str, str] -encodings_map: Dict[str, str] -types_map: Dict[str, str] -common_types: Dict[str, str] +knownfiles: list[str] +suffix_map: dict[str, str] +encodings_map: dict[str, str] +types_map: dict[str, str] +common_types: dict[str, str] class MimeTypes: - suffix_map: Dict[str, str] - encodings_map: Dict[str, str] - types_map: Tuple[Dict[str, str], Dict[str, str]] - types_map_inv: Tuple[Dict[str, str], Dict[str, str]] - def __init__(self, filenames: Tuple[str, ...] = ..., strict: bool = ...) -> None: ... + suffix_map: dict[str, str] + encodings_map: dict[str, str] + types_map: tuple[dict[str, str], dict[str, str]] + types_map_inv: tuple[dict[str, str], dict[str, str]] + def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = ...) -> None: ... def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... - def guess_type(self, url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... - def guess_all_extensions(self, type: str, strict: bool = ...) -> List[str]: ... + def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... + def guess_all_extensions(self, type: str, strict: bool = ...) -> list[str]: ... def read(self, filename: str, strict: bool = ...) -> None: ... def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... if sys.platform == "win32": diff --git a/stdlib/@python2/modulefinder.pyi b/stdlib/@python2/modulefinder.pyi index 76fd014daf6e..c319712ca31e 100644 --- a/stdlib/@python2/modulefinder.pyi +++ b/stdlib/@python2/modulefinder.pyi @@ -1,18 +1,18 @@ from types import CodeType -from typing import IO, Any, Container, Dict, Iterable, List, Sequence, Tuple +from typing import IO, Any, Container, Iterable, Sequence LOAD_CONST: int # undocumented IMPORT_NAME: int # undocumented STORE_NAME: int # undocumented STORE_GLOBAL: int # undocumented -STORE_OPS: Tuple[int, int] # undocumented +STORE_OPS: tuple[int, int] # undocumented EXTENDED_ARG: int # undocumented -packagePathMap: Dict[str, List[str]] # undocumented +packagePathMap: dict[str, list[str]] # undocumented def AddPackagePath(packagename: str, path: str) -> None: ... -replacePackageMap: Dict[str, str] # undocumented +replacePackageMap: dict[str, str] # undocumented def ReplacePackage(oldname: str, newname: str) -> None: ... @@ -22,19 +22,19 @@ class Module: # undocumented class ModuleFinder: - modules: Dict[str, Module] - path: List[str] # undocumented - badmodules: Dict[str, Dict[str, int]] # undocumented + modules: dict[str, Module] + path: list[str] # undocumented + badmodules: dict[str, dict[str, int]] # undocumented debug: int # undocumented indent: int # undocumented excludes: Container[str] # undocumented - replace_paths: Sequence[Tuple[str, str]] # undocumented + replace_paths: Sequence[tuple[str, str]] # undocumented def __init__( self, - path: List[str] | None = ..., + path: list[str] | None = ..., debug: int = ..., excludes: Container[str] = ..., - replace_paths: Sequence[Tuple[str, str]] = ..., + replace_paths: Sequence[tuple[str, str]] = ..., ) -> None: ... def msg(self, level: int, str: str, *args: Any) -> None: ... # undocumented def msgin(self, *args: Any) -> None: ... # undocumented @@ -42,22 +42,22 @@ class ModuleFinder: def run_script(self, pathname: str) -> None: ... def load_file(self, pathname: str) -> None: ... # undocumented def import_hook( - self, name: str, caller: Module | None = ..., fromlist: List[str] | None = ..., level: int = ... + self, name: str, caller: Module | None = ..., fromlist: list[str] | None = ..., level: int = ... ) -> Module | None: ... # undocumented def determine_parent(self, caller: Module | None, level: int = ...) -> Module | None: ... # undocumented - def find_head_package(self, parent: Module, name: str) -> Tuple[Module, str]: ... # undocumented + def find_head_package(self, parent: Module, name: str) -> tuple[Module, str]: ... # undocumented def load_tail(self, q: Module, tail: str) -> Module: ... # undocumented def ensure_fromlist(self, m: Module, fromlist: Iterable[str], recursive: int = ...) -> None: ... # undocumented def find_all_submodules(self, m: Module) -> Iterable[str]: ... # undocumented def import_module(self, partname: str, fqname: str, parent: Module) -> Module | None: ... # undocumented - def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: Tuple[str, str, str]) -> Module: ... # undocumented + def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: tuple[str, str, str]) -> Module: ... # undocumented def scan_code(self, co: CodeType, m: Module) -> None: ... # undocumented def load_package(self, fqname: str, pathname: str) -> Module: ... # undocumented def add_module(self, fqname: str) -> Module: ... # undocumented def find_module( self, name: str, path: str | None, parent: Module | None = ... - ) -> Tuple[IO[Any] | None, str | None, Tuple[str, str, int]]: ... # undocumented + ) -> tuple[IO[Any] | None, str | None, tuple[str, str, int]]: ... # undocumented def report(self) -> None: ... - def any_missing(self) -> List[str]: ... # undocumented - def any_missing_maybe(self) -> Tuple[List[str], List[str]]: ... # undocumented + def any_missing(self) -> list[str]: ... # undocumented + def any_missing_maybe(self) -> tuple[list[str], list[str]]: ... # undocumented def replace_paths_in_code(self, co: CodeType) -> CodeType: ... # undocumented diff --git a/stdlib/@python2/msilib/__init__.pyi b/stdlib/@python2/msilib/__init__.pyi index fa6757696845..8a97e3cec44b 100644 --- a/stdlib/@python2/msilib/__init__.pyi +++ b/stdlib/@python2/msilib/__init__.pyi @@ -1,6 +1,6 @@ import sys from types import ModuleType -from typing import Any, Container, Dict, Iterable, List, Sequence, Set, Tuple, Type +from typing import Any, Container, Iterable, Sequence from typing_extensions import Literal if sys.platform == "win32": @@ -24,19 +24,19 @@ if sys.platform == "win32": class Table: name: str - fields: List[Tuple[int, str, int]] + fields: list[tuple[int, str, int]] def __init__(self, name: str) -> None: ... def add_field(self, index: int, name: str, type: int) -> None: ... def sql(self) -> str: ... def create(self, db: _Database) -> None: ... class _Unspecified: ... def change_sequence( - seq: Sequence[Tuple[str, str | None, int]], + seq: Sequence[tuple[str, str | None, int]], action: str, - seqno: int | Type[_Unspecified] = ..., - cond: str | Type[_Unspecified] = ..., + seqno: int | type[_Unspecified] = ..., + cond: str | type[_Unspecified] = ..., ) -> None: ... - def add_data(db: _Database, table: str, values: Iterable[Tuple[Any, ...]]) -> None: ... + def add_data(db: _Database, table: str, values: Iterable[tuple[Any, ...]]) -> None: ... def add_stream(db: _Database, name: str, path: str) -> None: ... def init_database( name: str, schema: ModuleType, ProductName: str, ProductCode: str, ProductVersion: str, Manufacturer: str @@ -47,14 +47,14 @@ if sys.platform == "win32": class CAB: name: str - files: List[Tuple[str, str]] - filenames: Set[str] + files: list[tuple[str, str]] + filenames: set[str] index: int def __init__(self, name: str) -> None: ... def gen_id(self, file: str) -> str: ... - def append(self, full: str, file: str, logical: str) -> Tuple[int, str]: ... + def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ... def commit(self, db: _Database) -> None: ... - _directories: Set[str] + _directories: set[str] class Directory: db: _Database @@ -63,9 +63,9 @@ if sys.platform == "win32": physical: str logical: str component: str | None - short_names: Set[str] - ids: Set[str] - keyfiles: Dict[str, str] + short_names: set[str] + ids: set[str] + keyfiles: dict[str, str] componentflags: int | None absolute: str def __init__( @@ -88,7 +88,7 @@ if sys.platform == "win32": ) -> None: ... def make_short(self, file: str) -> str: ... def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ... - def glob(self, pattern: str, exclude: Container[str] | None = ...) -> List[str]: ... + def glob(self, pattern: str, exclude: Container[str] | None = ...) -> list[str]: ... def remove_pyc(self) -> None: ... class Binary: diff --git a/stdlib/@python2/msilib/schema.pyi b/stdlib/@python2/msilib/schema.pyi index d59e9767c3de..4ad9a1783fcd 100644 --- a/stdlib/@python2/msilib/schema.pyi +++ b/stdlib/@python2/msilib/schema.pyi @@ -1,5 +1,4 @@ import sys -from typing import List, Tuple if sys.platform == "win32": from . import Table @@ -90,6 +89,6 @@ if sys.platform == "win32": Upgrade: Table Verb: Table - tables: List[Table] + tables: list[Table] - _Validation_records: List[Tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] + _Validation_records: list[tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] diff --git a/stdlib/@python2/msilib/sequence.pyi b/stdlib/@python2/msilib/sequence.pyi index e4f400d33233..87dff754009d 100644 --- a/stdlib/@python2/msilib/sequence.pyi +++ b/stdlib/@python2/msilib/sequence.pyi @@ -1,9 +1,9 @@ import sys -from typing import List, Optional, Tuple +from typing import Optional if sys.platform == "win32": - _SequenceType = List[Tuple[str, Optional[str], int]] + _SequenceType = list[tuple[str, Optional[str], int]] AdminExecuteSequence: _SequenceType AdminUISequence: _SequenceType @@ -11,4 +11,4 @@ if sys.platform == "win32": InstallExecuteSequence: _SequenceType InstallUISequence: _SequenceType - tables: List[str] + tables: list[str] diff --git a/stdlib/@python2/msilib/text.pyi b/stdlib/@python2/msilib/text.pyi index 4ae8ee68184b..879429ecea85 100644 --- a/stdlib/@python2/msilib/text.pyi +++ b/stdlib/@python2/msilib/text.pyi @@ -1,9 +1,8 @@ import sys -from typing import List, Tuple if sys.platform == "win32": - ActionText: List[Tuple[str, str, str | None]] - UIText: List[Tuple[str, str | None]] + ActionText: list[tuple[str, str, str | None]] + UIText: list[tuple[str, str | None]] - tables: List[str] + tables: list[str] diff --git a/stdlib/@python2/multiprocessing/dummy/__init__.pyi b/stdlib/@python2/multiprocessing/dummy/__init__.pyi index 80a1456d1be8..a5381ed3839c 100644 --- a/stdlib/@python2/multiprocessing/dummy/__init__.pyi +++ b/stdlib/@python2/multiprocessing/dummy/__init__.pyi @@ -2,7 +2,7 @@ import array import threading import weakref from Queue import Queue -from typing import Any, List +from typing import Any class DummyProcess(threading.Thread): _children: weakref.WeakKeyDictionary[Any, Any] @@ -35,7 +35,7 @@ JoinableQueue = Queue def Array(typecode, sequence, lock=...) -> array.array[Any]: ... def Manager() -> Any: ... def Pool(processes=..., initializer=..., initargs=...) -> Any: ... -def active_children() -> List[Any]: ... +def active_children() -> list[Any]: ... def current_process() -> threading.Thread: ... def freeze_support() -> None: ... def shutdown() -> None: ... diff --git a/stdlib/@python2/multiprocessing/dummy/connection.pyi b/stdlib/@python2/multiprocessing/dummy/connection.pyi index ae5e05e9ccdd..f01b3f8cd660 100644 --- a/stdlib/@python2/multiprocessing/dummy/connection.pyi +++ b/stdlib/@python2/multiprocessing/dummy/connection.pyi @@ -1,7 +1,7 @@ from Queue import Queue -from typing import Any, List, Tuple +from typing import Any -families: List[None] +families: list[None] class Connection(object): _in: Any @@ -22,4 +22,4 @@ class Listener(object): def close(self) -> None: ... def Client(address) -> Connection: ... -def Pipe(duplex=...) -> Tuple[Connection, Connection]: ... +def Pipe(duplex=...) -> tuple[Connection, Connection]: ... diff --git a/stdlib/@python2/multiprocessing/pool.pyi b/stdlib/@python2/multiprocessing/pool.pyi index 27c0cb1d9c7b..3a1245fe1b7f 100644 --- a/stdlib/@python2/multiprocessing/pool.pyi +++ b/stdlib/@python2/multiprocessing/pool.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, List +from typing import Any, Callable, Iterable, Iterator class AsyncResult: def get(self, timeout: float | None = ...) -> Any: ... @@ -20,15 +20,15 @@ class Pool(object): initargs: Iterable[Any] = ..., maxtasksperchild: int | None = ..., ) -> None: ... - def apply(self, func: Callable[..., Any], args: Iterable[Any] = ..., kwds: Dict[str, Any] = ...) -> Any: ... + def apply(self, func: Callable[..., Any], args: Iterable[Any] = ..., kwds: dict[str, Any] = ...) -> Any: ... def apply_async( self, func: Callable[..., Any], args: Iterable[Any] = ..., - kwds: Dict[str, Any] = ..., + kwds: dict[str, Any] = ..., callback: Callable[..., None] | None = ..., ) -> AsyncResult: ... - def map(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: int | None = ...) -> List[Any]: ... + def map(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: int | None = ...) -> list[Any]: ... def map_async( self, func: Callable[..., Any], diff --git a/stdlib/@python2/mutex.pyi b/stdlib/@python2/mutex.pyi index e0931dc1188a..fd5363de73e5 100644 --- a/stdlib/@python2/mutex.pyi +++ b/stdlib/@python2/mutex.pyi @@ -1,10 +1,11 @@ -from typing import Any, Callable, Deque, TypeVar +from collections import deque +from typing import Any, Callable, TypeVar _T = TypeVar("_T") class mutex: locked: bool - queue: Deque[Any] + queue: deque[Any] def __init__(self) -> None: ... def test(self) -> bool: ... def testandset(self) -> bool: ... diff --git a/stdlib/@python2/netrc.pyi b/stdlib/@python2/netrc.pyi index 3033c2f78955..3d92c7b4d43b 100644 --- a/stdlib/@python2/netrc.pyi +++ b/stdlib/@python2/netrc.pyi @@ -1,4 +1,4 @@ -from typing import Dict, List, Optional, Text, Tuple +from typing import Optional, Text class NetrcParseError(Exception): filename: str | None @@ -7,10 +7,10 @@ class NetrcParseError(Exception): def __init__(self, msg: str, filename: Text | None = ..., lineno: int | None = ...) -> None: ... # (login, account, password) tuple -_NetrcTuple = Tuple[str, Optional[str], Optional[str]] +_NetrcTuple = tuple[str, Optional[str], Optional[str]] class netrc: - hosts: Dict[str, _NetrcTuple] - macros: Dict[str, List[str]] + hosts: dict[str, _NetrcTuple] + macros: dict[str, list[str]] def __init__(self, file: Text | None = ...) -> None: ... def authenticators(self, host: str) -> _NetrcTuple | None: ... diff --git a/stdlib/@python2/nis.pyi b/stdlib/@python2/nis.pyi index bc6c2bc07256..b762ae46241c 100644 --- a/stdlib/@python2/nis.pyi +++ b/stdlib/@python2/nis.pyi @@ -1,9 +1,8 @@ import sys -from typing import Dict, List if sys.platform != "win32": - def cat(map: str, domain: str = ...) -> Dict[str, str]: ... + def cat(map: str, domain: str = ...) -> dict[str, str]: ... def get_default_domain() -> str: ... - def maps(domain: str = ...) -> List[str]: ... + def maps(domain: str = ...) -> list[str]: ... def match(key: str, map: str, domain: str = ...) -> str: ... class error(Exception): ... diff --git a/stdlib/@python2/nntplib.pyi b/stdlib/@python2/nntplib.pyi index 4b1ac2cbfb1f..602617665ea8 100644 --- a/stdlib/@python2/nntplib.pyi +++ b/stdlib/@python2/nntplib.pyi @@ -2,7 +2,8 @@ import datetime import socket import ssl from _typeshed import Self -from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, Union +from builtins import list as List # alias to avoid a name clash with a method named `list` in `_NNTPBase` +from typing import IO, Any, Iterable, NamedTuple, Union _File = Union[IO[bytes], bytes, str, None] @@ -27,7 +28,7 @@ class GroupInfo(NamedTuple): class ArticleInfo(NamedTuple): number: int message_id: str - lines: List[bytes] + lines: list[bytes] def decode_header(header_str: str) -> str: ... @@ -48,32 +49,32 @@ class _NNTPBase: def __enter__(self: Self) -> Self: ... def __exit__(self, *args: Any) -> None: ... def getwelcome(self) -> str: ... - def getcapabilities(self) -> Dict[str, List[str]]: ... + def getcapabilities(self) -> dict[str, List[str]]: ... def set_debuglevel(self, level: int) -> None: ... def debug(self, level: int) -> None: ... - def capabilities(self) -> Tuple[str, Dict[str, List[str]]]: ... - def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> Tuple[str, List[str]]: ... + def capabilities(self) -> tuple[str, dict[str, List[str]]]: ... + def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, List[str]]: ... + def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, List[str]]: ... + def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> tuple[str, List[str]]: ... def description(self, group: str) -> str: ... - def descriptions(self, group_pattern: str) -> Tuple[str, Dict[str, str]]: ... - def group(self, name: str) -> Tuple[str, int, int, int, str]: ... - def help(self, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def stat(self, message_spec: Any = ...) -> Tuple[str, int, str]: ... - def next(self) -> Tuple[str, int, str]: ... - def last(self) -> Tuple[str, int, str]: ... - def head(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def body(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def article(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... + def descriptions(self, group_pattern: str) -> tuple[str, dict[str, str]]: ... + def group(self, name: str) -> tuple[str, int, int, int, str]: ... + def help(self, *, file: _File = ...) -> tuple[str, List[str]]: ... + def stat(self, message_spec: Any = ...) -> tuple[str, int, str]: ... + def next(self) -> tuple[str, int, str]: ... + def last(self) -> tuple[str, int, str]: ... + def head(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... + def body(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... + def article(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... def slave(self) -> str: ... - def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... + def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> tuple[str, List[str]]: ... + def xover(self, start: int, end: int, *, file: _File = ...) -> tuple[str, List[tuple[int, dict[str, str]]]]: ... def over( - self, message_spec: None | str | List[Any] | Tuple[Any, ...], *, file: _File = ... - ) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... - def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ... - def xpath(self, id: Any) -> Tuple[str, str]: ... - def date(self) -> Tuple[str, datetime.datetime]: ... + self, message_spec: None | str | List[Any] | tuple[Any, ...], *, file: _File = ... + ) -> tuple[str, List[tuple[int, dict[str, str]]]]: ... + def xgtitle(self, group: str, *, file: _File = ...) -> tuple[str, List[tuple[str, str]]]: ... + def xpath(self, id: Any) -> tuple[str, str]: ... + def date(self) -> tuple[str, datetime.datetime]: ... def post(self, data: bytes | Iterable[bytes]) -> str: ... def ihave(self, message_id: Any, data: bytes | Iterable[bytes]) -> str: ... def quit(self) -> str: ... diff --git a/stdlib/@python2/ntpath.pyi b/stdlib/@python2/ntpath.pyi index 514db760886f..33732903cb4c 100644 --- a/stdlib/@python2/ntpath.pyi +++ b/stdlib/@python2/ntpath.pyi @@ -1,7 +1,7 @@ import os import sys from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload +from typing import Any, AnyStr, Callable, Sequence, Text, TypeVar, overload _T = TypeVar("_T") @@ -74,11 +74,11 @@ def relpath(path: Text, start: Text | None = ...) -> Text: ... def samefile(f1: Text, f2: Text) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitdrive(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitext(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated + def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... +def walk(path: AnyStr, visit: Callable[[_T, AnyStr, list[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/opcode.pyi b/stdlib/@python2/opcode.pyi index 893dd7c7df9c..be162da4e496 100644 --- a/stdlib/@python2/opcode.pyi +++ b/stdlib/@python2/opcode.pyi @@ -1,15 +1,15 @@ -from typing import Dict, List, Sequence +from typing import Sequence cmp_op: Sequence[str] -hasconst: List[int] -hasname: List[int] -hasjrel: List[int] -hasjabs: List[int] -haslocal: List[int] -hascompare: List[int] -hasfree: List[int] -opname: List[str] +hasconst: list[int] +hasname: list[int] +hasjrel: list[int] +hasjabs: list[int] +haslocal: list[int] +hascompare: list[int] +hasfree: list[int] +opname: list[str] -opmap: Dict[str, int] +opmap: dict[str, int] HAVE_ARGUMENT: int EXTENDED_ARG: int diff --git a/stdlib/@python2/operator.pyi b/stdlib/@python2/operator.pyi index 76a8a9b6bee4..cff20b85898b 100644 --- a/stdlib/@python2/operator.pyi +++ b/stdlib/@python2/operator.pyi @@ -1,16 +1,4 @@ -from typing import ( - Any, - Container, - Generic, - Mapping, - MutableMapping, - MutableSequence, - Sequence, - SupportsAbs, - Tuple, - TypeVar, - overload, -) +from typing import Any, Container, Generic, Mapping, MutableMapping, MutableSequence, Sequence, SupportsAbs, TypeVar, overload _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) @@ -128,26 +116,26 @@ class attrgetter(Generic[_T_co]): @overload def __new__(cls, attr: str) -> attrgetter[Any]: ... @overload - def __new__(cls, attr: str, __attr2: str) -> attrgetter[Tuple[Any, Any]]: ... + def __new__(cls, attr: str, __attr2: str) -> attrgetter[tuple[Any, Any]]: ... @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[Tuple[Any, Any, Any]]: ... + def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[tuple[Any, Any, Any]]: ... @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[Tuple[Any, Any, Any, Any]]: ... + def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[tuple[Any, Any, Any, Any]]: ... @overload - def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ... + def __new__(cls, attr: str, *attrs: str) -> attrgetter[tuple[Any, ...]]: ... def __call__(self, obj: Any) -> _T_co: ... class itemgetter(Generic[_T_co]): @overload def __new__(cls, item: Any) -> itemgetter[Any]: ... @overload - def __new__(cls, item: Any, __item2: Any) -> itemgetter[Tuple[Any, Any]]: ... + def __new__(cls, item: Any, __item2: Any) -> itemgetter[tuple[Any, Any]]: ... @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[Tuple[Any, Any, Any]]: ... + def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[tuple[Any, Any, Any]]: ... @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[Tuple[Any, Any, Any, Any]]: ... + def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[tuple[Any, Any, Any, Any]]: ... @overload - def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ... + def __new__(cls, item: Any, *items: Any) -> itemgetter[tuple[Any, ...]]: ... def __call__(self, obj: Any) -> _T_co: ... class methodcaller: diff --git a/stdlib/@python2/optparse.pyi b/stdlib/@python2/optparse.pyi index 08a926e301b3..a99bc0a6fb3b 100644 --- a/stdlib/@python2/optparse.pyi +++ b/stdlib/@python2/optparse.pyi @@ -1,9 +1,9 @@ -from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple, Type, Union, overload +from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, Union, overload # See https://groups.google.com/forum/#!topic/python-ideas/gA1gdj3RZ5g _Text = Union[str, unicode] -NO_DEFAULT: Tuple[_Text, ...] +NO_DEFAULT: tuple[_Text, ...] SUPPRESS_HELP: _Text SUPPRESS_USAGE: _Text @@ -42,7 +42,7 @@ class HelpFormatter: indent_increment: int level: int max_help_position: int - option_strings: Dict[Option, _Text] + option_strings: dict[Option, _Text] parser: OptionParser short_first: Any width: int @@ -76,25 +76,25 @@ class TitledHelpFormatter(HelpFormatter): def format_usage(self, usage: _Text) -> _Text: ... class Option: - ACTIONS: Tuple[_Text, ...] - ALWAYS_TYPED_ACTIONS: Tuple[_Text, ...] - ATTRS: List[_Text] - CHECK_METHODS: List[Callable[..., Any]] | None - CONST_ACTIONS: Tuple[_Text, ...] - STORE_ACTIONS: Tuple[_Text, ...] - TYPED_ACTIONS: Tuple[_Text, ...] - TYPES: Tuple[_Text, ...] - TYPE_CHECKER: Dict[_Text, Callable[..., Any]] - _long_opts: List[_Text] - _short_opts: List[_Text] + ACTIONS: tuple[_Text, ...] + ALWAYS_TYPED_ACTIONS: tuple[_Text, ...] + ATTRS: list[_Text] + CHECK_METHODS: list[Callable[..., Any]] | None + CONST_ACTIONS: tuple[_Text, ...] + STORE_ACTIONS: tuple[_Text, ...] + TYPED_ACTIONS: tuple[_Text, ...] + TYPES: tuple[_Text, ...] + TYPE_CHECKER: dict[_Text, Callable[..., Any]] + _long_opts: list[_Text] + _short_opts: list[_Text] action: _Text dest: _Text | None default: Any nargs: int type: Any callback: Callable[..., Any] | None - callback_args: Tuple[Any, ...] | None - callback_kwargs: Dict[_Text, Any] | None + callback_args: tuple[Any, ...] | None + callback_kwargs: dict[_Text, Any] | None help: _Text | None metavar: _Text | None def __init__(self, *opts: _Text | None, **attrs: Any) -> None: ... @@ -104,9 +104,9 @@ class Option: def _check_const(self) -> None: ... def _check_dest(self) -> None: ... def _check_nargs(self) -> None: ... - def _check_opt_strings(self, opts: Iterable[_Text | None]) -> List[_Text]: ... + def _check_opt_strings(self, opts: Iterable[_Text | None]) -> list[_Text]: ... def _check_type(self) -> None: ... - def _set_attrs(self, attrs: Dict[_Text, Any]) -> None: ... + def _set_attrs(self, attrs: dict[_Text, Any]) -> None: ... def _set_opt_strings(self, opts: Iterable[_Text]) -> None: ... def check_value(self, opt: _Text, value: Any) -> Any: ... def convert_value(self, opt: _Text, value: Any) -> Any: ... @@ -118,13 +118,13 @@ class Option: make_option = Option class OptionContainer: - _long_opt: Dict[_Text, Option] - _short_opt: Dict[_Text, Option] + _long_opt: dict[_Text, Option] + _short_opt: dict[_Text, Option] conflict_handler: _Text - defaults: Dict[_Text, Any] + defaults: dict[_Text, Any] description: Any - option_class: Type[Option] - def __init__(self, option_class: Type[Option], conflict_handler: Any, description: Any) -> None: ... + option_class: type[Option] + def __init__(self, option_class: type[Option], conflict_handler: Any, description: Any) -> None: ... def _check_conflict(self, option: Any) -> None: ... def _create_option_mappings(self) -> None: ... def _share_option_mappings(self, parser: OptionParser) -> None: ... @@ -145,7 +145,7 @@ class OptionContainer: def set_description(self, description: Any) -> None: ... class OptionGroup(OptionContainer): - option_list: List[Option] + option_list: list[Option] parser: OptionParser title: _Text def __init__(self, parser: OptionParser, title: _Text, description: _Text | None = ...) -> None: ... @@ -167,13 +167,13 @@ class OptionParser(OptionContainer): allow_interspersed_args: bool epilog: _Text | None formatter: HelpFormatter - largs: List[_Text] | None - option_groups: List[OptionGroup] - option_list: List[Option] + largs: list[_Text] | None + option_groups: list[OptionGroup] + option_list: list[Option] process_default_values: Any prog: _Text | None - rargs: List[Any] | None - standard_option_list: List[Option] + rargs: list[Any] | None + standard_option_list: list[Option] usage: _Text | None values: Values | None version: _Text @@ -181,7 +181,7 @@ class OptionParser(OptionContainer): self, usage: _Text | None = ..., option_list: Iterable[Option] | None = ..., - option_class: Type[Option] = ..., + option_class: type[Option] = ..., version: _Text | None = ..., conflict_handler: _Text = ..., description: _Text | None = ..., @@ -193,19 +193,19 @@ class OptionParser(OptionContainer): def _add_help_option(self) -> None: ... def _add_version_option(self) -> None: ... def _create_option_list(self) -> None: ... - def _get_all_options(self) -> List[Option]: ... - def _get_args(self, args: Iterable[Any]) -> List[Any]: ... + def _get_all_options(self) -> list[Option]: ... + def _get_args(self, args: Iterable[Any]) -> list[Any]: ... def _init_parsing_state(self) -> None: ... def _match_long_opt(self, opt: _Text) -> _Text: ... def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ... - def _process_args(self, largs: List[Any], rargs: List[Any], values: Values) -> None: ... - def _process_long_opt(self, rargs: List[Any], values: Any) -> None: ... - def _process_short_opts(self, rargs: List[Any], values: Any) -> None: ... + def _process_args(self, largs: list[Any], rargs: list[Any], values: Values) -> None: ... + def _process_long_opt(self, rargs: list[Any], values: Any) -> None: ... + def _process_short_opts(self, rargs: list[Any], values: Any) -> None: ... @overload def add_option_group(self, __opt_group: OptionGroup) -> OptionGroup: ... @overload def add_option_group(self, *args: Any, **kwargs: Any) -> OptionGroup: ... - def check_values(self, values: Values, args: List[_Text]) -> Tuple[Values, List[_Text]]: ... + def check_values(self, values: Values, args: list[_Text]) -> tuple[Values, list[_Text]]: ... def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... def error(self, msg: _Text) -> None: ... @@ -219,7 +219,7 @@ class OptionParser(OptionContainer): def get_prog_name(self) -> _Text: ... def get_usage(self) -> _Text: ... def get_version(self) -> _Text: ... - def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> Tuple[Values, List[AnyStr]]: ... + def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> tuple[Values, list[AnyStr]]: ... def print_usage(self, file: IO[str] | None = ...) -> None: ... def print_help(self, file: IO[str] | None = ...) -> None: ... def print_version(self, file: IO[str] | None = ...) -> None: ... diff --git a/stdlib/@python2/os/__init__.pyi b/stdlib/@python2/os/__init__.pyi index 1955c07020de..c14ae1207c50 100644 --- a/stdlib/@python2/os/__init__.pyi +++ b/stdlib/@python2/os/__init__.pyi @@ -7,17 +7,14 @@ from typing import ( Any, AnyStr, Callable, - Dict, Generic, Iterator, - List, Mapping, MutableMapping, NamedTuple, NoReturn, Sequence, Text, - Tuple, TypeVar, Union, overload, @@ -90,7 +87,7 @@ W_OK: int X_OK: int class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): - def copy(self) -> Dict[AnyStr, AnyStr]: ... + def copy(self) -> dict[AnyStr, AnyStr]: ... def __delitem__(self, key: AnyStr) -> None: ... def __getitem__(self, key: AnyStr) -> AnyStr: ... def __setitem__(self, key: AnyStr, value: AnyStr) -> None: ... @@ -100,9 +97,9 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): environ: _Environ[str] if sys.platform != "win32": # Unix only - confstr_names: Dict[str, int] - pathconf_names: Dict[str, int] - sysconf_names: Dict[str, int] + confstr_names: dict[str, int] + pathconf_names: dict[str, int] + sysconf_names: dict[str, int] EX_OK: int EX_USAGE: int @@ -161,12 +158,12 @@ if sys.platform != "win32": def getegid() -> int: ... def geteuid() -> int: ... def getgid() -> int: ... - def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac + def getgroups() -> list[int]: ... # Unix only, behaves differently on Mac def initgroups(username: str, gid: int) -> None: ... def getpgid(pid: int) -> int: ... def getpgrp() -> int: ... - def getresuid() -> Tuple[int, int, int]: ... - def getresgid() -> Tuple[int, int, int]: ... + def getresuid() -> tuple[int, int, int]: ... + def getresgid() -> tuple[int, int, int]: ... def getuid() -> int: ... def setegid(egid: int) -> None: ... def seteuid(euid: int) -> None: ... @@ -181,7 +178,7 @@ if sys.platform != "win32": def getsid(pid: int) -> int: ... def setsid() -> None: ... def setuid(uid: int) -> None: ... - def uname() -> Tuple[str, str, str, str, str]: ... + def uname() -> tuple[str, str, str, str, str]: ... @overload def getenv(key: Text) -> str | None: ... @@ -198,7 +195,7 @@ def fstat(fd: int) -> Any: ... def fsync(fd: FileDescriptorLike) -> None: ... def lseek(fd: int, pos: int, how: int) -> int: ... def open(file: Text, flags: int, mode: int = ...) -> int: ... -def pipe() -> Tuple[int, int]: ... +def pipe() -> tuple[int, int]: ... def read(fd: int, n: int) -> bytes: ... def write(fd: int, string: bytes | buffer) -> int: ... def access(path: Text, mode: int) -> bool: ... @@ -230,7 +227,7 @@ def symlink(source: Text, link_name: Text) -> None: ... def unlink(path: Text) -> None: ... # TODO: add ns, dir_fd, follow_symlinks argument -def utime(path: Text, times: Tuple[float, float] | None) -> None: ... +def utime(path: Text, times: tuple[float, float] | None) -> None: ... if sys.platform != "win32": # Unix only @@ -242,7 +239,7 @@ if sys.platform != "win32": def fstatvfs(fd: int) -> _StatVFS: ... def ftruncate(fd: int, length: int) -> None: ... def isatty(fd: int) -> bool: ... - def openpty() -> Tuple[int, int]: ... # some flavors of Unix + def openpty() -> tuple[int, int]: ... # some flavors of Unix def tcgetpgrp(fd: int) -> int: ... def tcsetpgrp(fd: int, pg: int) -> None: ... def ttyname(fd: int) -> str: ... @@ -258,7 +255,7 @@ if sys.platform != "win32": def walk( top: AnyStr, topdown: bool = ..., onerror: Callable[[OSError], Any] | None = ..., followlinks: bool = ... -) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... +) -> Iterator[tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... def abort() -> NoReturn: ... # These are defined as execl(file, *args) but the first *arg is mandatory. @@ -271,7 +268,7 @@ def execlpe(file: Text, __arg0: bytes | Text, *args: Any) -> NoReturn: ... # The docs say `args: tuple or list of strings` # The implementation enforces tuple or list so we can't use Sequence. -_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]] +_ExecVArgs = Union[tuple[Union[bytes, Text], ...], list[bytes], list[Text], list[Union[bytes, Text]]] def execv(path: Text, args: _ExecVArgs) -> NoReturn: ... def execve(path: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... @@ -283,22 +280,22 @@ def kill(pid: int, sig: int) -> None: ... if sys.platform != "win32": # Unix only def fork() -> int: ... - def forkpty() -> Tuple[int, int]: ... # some flavors of Unix + def forkpty() -> tuple[int, int]: ... # some flavors of Unix def killpg(__pgid: int, __signal: int) -> None: ... def nice(increment: int) -> int: ... def plock(op: int) -> None: ... # ???op is int? def popen(command: str, *args, **kwargs) -> IO[Any]: ... -def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... -def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ... -def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... +def popen2(cmd: str, *args, **kwargs) -> tuple[IO[Any], IO[Any]]: ... +def popen3(cmd: str, *args, **kwargs) -> tuple[IO[Any], IO[Any], IO[Any]]: ... +def popen4(cmd: str, *args, **kwargs) -> tuple[IO[Any], IO[Any]]: ... def spawnl(mode: int, path: Text, arg0: bytes | Text, *args: bytes | Text) -> int: ... def spawnle(mode: int, path: Text, arg0: bytes | Text, *args: Any) -> int: ... # Imprecise sig -def spawnv(mode: int, path: Text, args: List[bytes | Text]) -> int: ... -def spawnve(mode: int, path: Text, args: List[bytes | Text], env: Mapping[str, str]) -> int: ... +def spawnv(mode: int, path: Text, args: list[bytes | Text]) -> int: ... +def spawnve(mode: int, path: Text, args: list[bytes | Text], env: Mapping[str, str]) -> int: ... def system(command: Text) -> int: ... -def times() -> Tuple[float, float, float, float, float]: ... -def waitpid(pid: int, options: int) -> Tuple[int, int]: ... +def times() -> tuple[float, float, float, float, float]: ... +def waitpid(pid: int, options: int) -> tuple[int, int]: ... def urandom(n: int) -> bytes: ... if sys.platform == "win32": @@ -308,11 +305,11 @@ else: # Unix only def spawnlp(mode: int, file: Text, arg0: bytes | Text, *args: bytes | Text) -> int: ... def spawnlpe(mode: int, file: Text, arg0: bytes | Text, *args: Any) -> int: ... # Imprecise signature - def spawnvp(mode: int, file: Text, args: List[bytes | Text]) -> int: ... - def spawnvpe(mode: int, file: Text, args: List[bytes | Text], env: Mapping[str, str]) -> int: ... - def wait() -> Tuple[int, int]: ... - def wait3(options: int) -> Tuple[int, int, Any]: ... - def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ... + def spawnvp(mode: int, file: Text, args: list[bytes | Text]) -> int: ... + def spawnvpe(mode: int, file: Text, args: list[bytes | Text], env: Mapping[str, str]) -> int: ... + def wait() -> tuple[int, int]: ... + def wait3(options: int) -> tuple[int, int, Any]: ... + def wait4(pid: int, options: int) -> tuple[int, int, Any]: ... def WCOREDUMP(status: int) -> bool: ... def WIFCONTINUED(status: int) -> bool: ... def WIFSTOPPED(status: int) -> bool: ... @@ -322,7 +319,7 @@ else: def WSTOPSIG(status: int) -> int: ... def WTERMSIG(status: int) -> int: ... def confstr(name: str | int) -> str | None: ... - def getloadavg() -> Tuple[float, float, float]: ... + def getloadavg() -> tuple[float, float, float]: ... def sysconf(name: str | int) -> int: ... def tmpfile() -> IO[Any]: ... diff --git a/stdlib/@python2/os/path.pyi b/stdlib/@python2/os/path.pyi index 2ce2f592f0e2..4e484ce8a096 100644 --- a/stdlib/@python2/os/path.pyi +++ b/stdlib/@python2/os/path.pyi @@ -1,6 +1,6 @@ import os import sys -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload +from typing import Any, AnyStr, Callable, Sequence, Text, TypeVar, overload _T = TypeVar("_T") @@ -74,11 +74,11 @@ def relpath(path: Text, start: Text | None = ...) -> Text: ... def samefile(f1: Text, f2: Text) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitdrive(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitext(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated + def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... +def walk(path: AnyStr, visit: Callable[[_T, AnyStr, list[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/os2emxpath.pyi b/stdlib/@python2/os2emxpath.pyi index 514db760886f..33732903cb4c 100644 --- a/stdlib/@python2/os2emxpath.pyi +++ b/stdlib/@python2/os2emxpath.pyi @@ -1,7 +1,7 @@ import os import sys from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload +from typing import Any, AnyStr, Callable, Sequence, Text, TypeVar, overload _T = TypeVar("_T") @@ -74,11 +74,11 @@ def relpath(path: Text, start: Text | None = ...) -> Text: ... def samefile(f1: Text, f2: Text) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitdrive(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitext(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated + def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... +def walk(path: AnyStr, visit: Callable[[_T, AnyStr, list[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/ossaudiodev.pyi b/stdlib/@python2/ossaudiodev.pyi index af3e2c210930..f221c95b8036 100644 --- a/stdlib/@python2/ossaudiodev.pyi +++ b/stdlib/@python2/ossaudiodev.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, overload +from typing import Any, overload from typing_extensions import Literal AFMT_AC3: int @@ -114,8 +114,8 @@ SOUND_MIXER_TREBLE: int SOUND_MIXER_VIDEO: int SOUND_MIXER_VOLUME: int -control_labels: List[str] -control_names: List[str] +control_labels: list[str] +control_names: list[str] # TODO: oss_audio_device return type @overload diff --git a/stdlib/@python2/parser.pyi b/stdlib/@python2/parser.pyi index ff8bf039ee80..73ebff4c4fe7 100644 --- a/stdlib/@python2/parser.pyi +++ b/stdlib/@python2/parser.pyi @@ -1,12 +1,12 @@ from types import CodeType -from typing import Any, List, Sequence, Text, Tuple +from typing import Any, Sequence, Text def expr(source: Text) -> STType: ... def suite(source: Text) -> STType: ... def sequence2st(sequence: Sequence[Any]) -> STType: ... def tuple2st(sequence: Sequence[Any]) -> STType: ... -def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... -def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... +def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... +def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> tuple[Any]: ... def compilest(st: STType, filename: Text = ...) -> CodeType: ... def isexpr(st: STType) -> bool: ... def issuite(st: STType) -> bool: ... @@ -17,5 +17,5 @@ class STType: def compile(self, filename: Text = ...) -> CodeType: ... def isexpr(self) -> bool: ... def issuite(self) -> bool: ... - def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... - def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... + def tolist(self, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... + def totuple(self, line_info: bool = ..., col_info: bool = ...) -> tuple[Any]: ... diff --git a/stdlib/@python2/pdb.pyi b/stdlib/@python2/pdb.pyi index 6d3a6d5c5903..78d0c163ca72 100644 --- a/stdlib/@python2/pdb.pyi +++ b/stdlib/@python2/pdb.pyi @@ -1,7 +1,7 @@ from bdb import Bdb from cmd import Cmd from types import FrameType, TracebackType -from typing import IO, Any, Callable, ClassVar, Dict, Iterable, List, Mapping, Tuple, TypeVar +from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, TypeVar _T = TypeVar("_T") @@ -9,9 +9,9 @@ line_prefix: str # undocumented class Restart(Exception): ... -def run(statement: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... -def runeval(expression: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... -def runctx(statement: str, globals: Dict[str, Any], locals: Mapping[str, Any]) -> None: ... +def run(statement: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... +def runeval(expression: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... +def runctx(statement: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> None: ... def runcall(func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... def set_trace() -> None: ... def post_mortem(t: TracebackType | None = ...) -> None: ... @@ -20,19 +20,19 @@ def pm() -> None: ... class Pdb(Bdb, Cmd): # Everything here is undocumented, except for __init__ - commands_resuming: ClassVar[List[str]] + commands_resuming: ClassVar[list[str]] - aliases: Dict[str, str] + aliases: dict[str, str] mainpyfile: str _wait_for_mainpyfile: bool - rcLines: List[str] - commands: Dict[int, List[str]] - commands_doprompt: Dict[int, bool] - commands_silent: Dict[int, bool] + rcLines: list[str] + commands: dict[int, list[str]] + commands_doprompt: dict[int, bool] + commands_silent: dict[int, bool] commands_defining: bool commands_bnum: int | None lineno: int | None - stack: List[Tuple[FrameType, int]] + stack: list[tuple[FrameType, int]] curindex: int curframe: FrameType | None curframe_locals: Mapping[str, Any] @@ -47,11 +47,11 @@ class Pdb(Bdb, Cmd): def displayhook(self, obj: object) -> None: ... def handle_command_def(self, line: str) -> bool: ... def defaultFile(self) -> str: ... - def lineinfo(self, identifier: str) -> Tuple[None, None, None] | Tuple[str, str, int]: ... + def lineinfo(self, identifier: str) -> tuple[None, None, None] | tuple[str, str, int]: ... def checkline(self, filename: str, lineno: int) -> int: ... def _getval(self, arg: str) -> object: ... def print_stack_trace(self) -> None: ... - def print_stack_entry(self, frame_lineno: Tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... + def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... def lookupmodule(self, filename: str) -> str | None: ... def _runscript(self, filename: str) -> None: ... def do_commands(self, arg: str) -> bool | None: ... @@ -157,7 +157,7 @@ class Pdb(Bdb, Cmd): # undocumented -def find_function(funcname: str, filename: str) -> Tuple[str, str, int] | None: ... +def find_function(funcname: str, filename: str) -> tuple[str, str, int] | None: ... def main() -> None: ... def help() -> None: ... diff --git a/stdlib/@python2/pickle.pyi b/stdlib/@python2/pickle.pyi index 07e32e64b449..bb9b6614f329 100644 --- a/stdlib/@python2/pickle.pyi +++ b/stdlib/@python2/pickle.pyi @@ -1,7 +1,7 @@ -from typing import IO, Any, Callable, Iterator, Optional, Tuple, Type, Union +from typing import IO, Any, Callable, Iterator, Optional, Union HIGHEST_PROTOCOL: int -bytes_types: Tuple[Type[Any], ...] # undocumented +bytes_types: tuple[type[Any], ...] # undocumented def dump(obj: Any, file: IO[bytes], protocol: int | None = ...) -> None: ... def dumps(obj: Any, protocol: int | None = ...) -> bytes: ... @@ -14,10 +14,10 @@ class UnpicklingError(PickleError): ... _reducedtype = Union[ str, - Tuple[Callable[..., Any], Tuple[Any, ...]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]], + tuple[Callable[..., Any], tuple[Any, ...]], + tuple[Callable[..., Any], tuple[Any, ...], Any], + tuple[Callable[..., Any], tuple[Any, ...], Any, Optional[Iterator[Any]]], + tuple[Callable[..., Any], tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]], ] class Pickler: diff --git a/stdlib/@python2/pickletools.pyi b/stdlib/@python2/pickletools.pyi index 14ec0fdff03a..915b700dc8e5 100644 --- a/stdlib/@python2/pickletools.pyi +++ b/stdlib/@python2/pickletools.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, Iterator, List, MutableMapping, Text, Tuple, Type +from typing import IO, Any, Callable, Iterator, MutableMapping, Text _Reader = Callable[[IO[bytes]], Any] @@ -77,9 +77,9 @@ long4: ArgumentDescriptor class StackObject(object): name: str - obtype: Type[Any] | Tuple[Type[Any], ...] + obtype: type[Any] | tuple[type[Any], ...] doc: str - def __init__(self, name: str, obtype: Type[Any] | Tuple[Type[Any], ...], doc: str) -> None: ... + def __init__(self, name: str, obtype: type[Any] | tuple[type[Any], ...], doc: str) -> None: ... pyint: StackObject pylong: StackObject @@ -100,8 +100,8 @@ class OpcodeInfo(object): name: str code: str arg: ArgumentDescriptor | None - stack_before: List[StackObject] - stack_after: List[StackObject] + stack_before: list[StackObject] + stack_after: list[StackObject] proto: int doc: str def __init__( @@ -109,15 +109,15 @@ class OpcodeInfo(object): name: str, code: str, arg: ArgumentDescriptor | None, - stack_before: List[StackObject], - stack_after: List[StackObject], + stack_before: list[StackObject], + stack_after: list[StackObject], proto: int, doc: str, ) -> None: ... -opcodes: List[OpcodeInfo] +opcodes: list[OpcodeInfo] -def genops(pickle: bytes | IO[bytes]) -> Iterator[Tuple[OpcodeInfo, Any | None, int | None]]: ... +def genops(pickle: bytes | IO[bytes]) -> Iterator[tuple[OpcodeInfo, Any | None, int | None]]: ... def optimize(p: bytes | IO[bytes]) -> bytes: ... def dis( pickle: bytes | IO[bytes], out: IO[str] | None = ..., memo: MutableMapping[int, Any] | None = ..., indentlevel: int = ... diff --git a/stdlib/@python2/pkgutil.pyi b/stdlib/@python2/pkgutil.pyi index fd42af916cfe..3b006b376641 100644 --- a/stdlib/@python2/pkgutil.pyi +++ b/stdlib/@python2/pkgutil.pyi @@ -1,19 +1,19 @@ from _typeshed import SupportsRead -from typing import IO, Any, Callable, Iterable, Iterator, List, Tuple, Union +from typing import IO, Any, Callable, Iterable, Iterator, Union Loader = Any MetaPathFinder = Any PathEntryFinder = Any -_ModuleInfoLike = Tuple[Union[MetaPathFinder, PathEntryFinder], str, bool] +_ModuleInfoLike = tuple[Union[MetaPathFinder, PathEntryFinder], str, bool] -def extend_path(path: List[str], name: str) -> List[str]: ... +def extend_path(path: list[str], name: str) -> list[str]: ... class ImpImporter: def __init__(self, path: str | None = ...) -> None: ... class ImpLoader: - def __init__(self, fullname: str, file: IO[str], filename: str, etc: Tuple[str, str, int]) -> None: ... + def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ... def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... diff --git a/stdlib/@python2/platform.pyi b/stdlib/@python2/platform.pyi index b984a2b2d3d5..7d71ee943da1 100644 --- a/stdlib/@python2/platform.pyi +++ b/stdlib/@python2/platform.pyi @@ -1,4 +1,4 @@ -from typing import Any, Tuple +from typing import Any __copyright__: Any DEV_NULL: Any @@ -19,16 +19,16 @@ class _popen: __del__: Any def popen(cmd, mode=..., bufsize: Any | None = ...): ... -def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> Tuple[str, str, str, str]: ... +def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> tuple[str, str, str, str]: ... def mac_ver( - release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ... -) -> Tuple[str, Tuple[str, str, str], str]: ... + release: str = ..., versioninfo: tuple[str, str, str] = ..., machine: str = ... +) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ... -) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ... + release: str = ..., vendor: str = ..., vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... +) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system, release, version): ... -def architecture(executable=..., bits=..., linkage=...) -> Tuple[str, str]: ... -def uname() -> Tuple[str, str, str, str, str, str]: ... +def architecture(executable=..., bits=..., linkage=...) -> tuple[str, str]: ... +def uname() -> tuple[str, str, str, str, str, str]: ... def system() -> str: ... def node() -> str: ... def release() -> str: ... @@ -37,9 +37,9 @@ def machine() -> str: ... def processor() -> str: ... def python_implementation() -> str: ... def python_version() -> str: ... -def python_version_tuple() -> Tuple[str, str, str]: ... +def python_version_tuple() -> tuple[str, str, str]: ... def python_branch() -> str: ... def python_revision() -> str: ... -def python_build() -> Tuple[str, str]: ... +def python_build() -> tuple[str, str]: ... def python_compiler() -> str: ... def platform(aliased: int = ..., terse: int = ...) -> str: ... diff --git a/stdlib/@python2/plistlib.pyi b/stdlib/@python2/plistlib.pyi index d815e3c35404..02a1cb506d1d 100644 --- a/stdlib/@python2/plistlib.pyi +++ b/stdlib/@python2/plistlib.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Dict as DictT, Mapping, Text, Union +from typing import IO, Any, Mapping, Text, Union _Path = Union[str, Text] @@ -11,7 +11,7 @@ def writePlistToResource(rootObject: Mapping[str, Any], path: _Path, restype: st def readPlistFromString(data: str) -> Any: ... def writePlistToString(rootObject: Mapping[str, Any]) -> str: ... -class Dict(DictT[str, Any]): +class Dict(dict[str, Any]): def __getattr__(self, attr: str) -> Any: ... def __setattr__(self, attr: str, value: Any) -> None: ... def __delattr__(self, attr: str) -> None: ... diff --git a/stdlib/@python2/popen2.pyi b/stdlib/@python2/popen2.pyi index 0efee4e6d271..43f6804e0659 100644 --- a/stdlib/@python2/popen2.pyi +++ b/stdlib/@python2/popen2.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, TextIO, Tuple, TypeVar +from typing import Any, Iterable, TextIO, TypeVar _T = TypeVar("_T") @@ -22,6 +22,6 @@ class Popen4(Popen3): fromchild: TextIO def __init__(self, cmd: Iterable[Any] = ..., bufsize: int = ...) -> None: ... -def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ... -def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ... -def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ... +def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> tuple[TextIO, TextIO]: ... +def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> tuple[TextIO, TextIO, TextIO]: ... +def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> tuple[TextIO, TextIO]: ... diff --git a/stdlib/@python2/poplib.pyi b/stdlib/@python2/poplib.pyi index 7a71f9850dfe..4525cac1e687 100644 --- a/stdlib/@python2/poplib.pyi +++ b/stdlib/@python2/poplib.pyi @@ -1,7 +1,7 @@ import socket -from typing import Any, BinaryIO, List, Pattern, Text, Tuple, overload +from typing import Any, BinaryIO, Pattern, Text, overload -_LongResp = Tuple[bytes, List[bytes], int] +_LongResp = tuple[bytes, list[bytes], int] class error_proto(Exception): ... @@ -22,7 +22,7 @@ class POP3: def set_debuglevel(self, level: int) -> None: ... def user(self, user: Text) -> bytes: ... def pass_(self, pswd: Text) -> bytes: ... - def stat(self) -> Tuple[int, int]: ... + def stat(self) -> tuple[int, int]: ... def list(self, which: Any | None = ...) -> _LongResp: ... def retr(self, which: Any) -> _LongResp: ... def dele(self, which: Any) -> bytes: ... diff --git a/stdlib/@python2/posix.pyi b/stdlib/@python2/posix.pyi index c39ce325289b..7ea9c0015ab0 100644 --- a/stdlib/@python2/posix.pyi +++ b/stdlib/@python2/posix.pyi @@ -1,12 +1,12 @@ from _typeshed import FileDescriptorLike -from typing import IO, AnyStr, Dict, List, Mapping, NamedTuple, Sequence, Tuple, TypeVar +from typing import IO, AnyStr, Mapping, NamedTuple, Sequence, TypeVar error = OSError -confstr_names: Dict[str, int] -environ: Dict[str, str] -pathconf_names: Dict[str, int] -sysconf_names: Dict[str, int] +confstr_names: dict[str, int] +environ: dict[str, str] +pathconf_names: dict[str, int] +sysconf_names: dict[str, int] _T = TypeVar("_T") @@ -112,7 +112,7 @@ def fchown(fd: int, uid: int, gid: int) -> None: ... def fdatasync(fd: FileDescriptorLike) -> None: ... def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ... def fork() -> int: ... -def forkpty() -> Tuple[int, int]: ... +def forkpty() -> tuple[int, int]: ... def fpathconf(fd: int, name: str) -> None: ... def fstat(fd: int) -> stat_result: ... def fstatvfs(fd: int) -> statvfs_result: ... @@ -123,15 +123,15 @@ def getcwdu() -> unicode: ... def getegid() -> int: ... def geteuid() -> int: ... def getgid() -> int: ... -def getgroups() -> List[int]: ... -def getloadavg() -> Tuple[float, float, float]: ... +def getgroups() -> list[int]: ... +def getloadavg() -> tuple[float, float, float]: ... def getlogin() -> str: ... def getpgid(pid: int) -> int: ... def getpgrp() -> int: ... def getpid() -> int: ... def getppid() -> int: ... -def getresgid() -> Tuple[int, int, int]: ... -def getresuid() -> Tuple[int, int, int]: ... +def getresgid() -> tuple[int, int, int]: ... +def getresuid() -> tuple[int, int, int]: ... def getsid(pid: int) -> int: ... def getuid() -> int: ... def initgroups(username: str, gid: int) -> None: ... @@ -140,7 +140,7 @@ def kill(pid: int, sig: int) -> None: ... def killpg(pgid: int, sig: int) -> None: ... def lchown(path: unicode, uid: int, gid: int) -> None: ... def link(source: unicode, link_name: str) -> None: ... -def listdir(path: AnyStr) -> List[AnyStr]: ... +def listdir(path: AnyStr) -> list[AnyStr]: ... def lseek(fd: int, pos: int, how: int) -> None: ... def lstat(path: unicode) -> stat_result: ... def major(device: int) -> int: ... @@ -151,9 +151,9 @@ def mkfifo(path: unicode, mode: int = ...) -> None: ... def mknod(filename: unicode, mode: int = ..., device: int = ...) -> None: ... def nice(increment: int) -> int: ... def open(file: unicode, flags: int, mode: int = ...) -> int: ... -def openpty() -> Tuple[int, int]: ... +def openpty() -> tuple[int, int]: ... def pathconf(path: unicode, name: str) -> str: ... -def pipe() -> Tuple[int, int]: ... +def pipe() -> tuple[int, int]: ... def popen(command: str, mode: str = ..., bufsize: int = ...) -> IO[str]: ... def putenv(varname: str, value: str) -> None: ... def read(fd: int, n: int) -> str: ... @@ -182,20 +182,20 @@ def sysconf(name: str | int) -> int: ... def system(command: unicode) -> int: ... def tcgetpgrp(fd: int) -> int: ... def tcsetpgrp(fd: int, pg: int) -> None: ... -def times() -> Tuple[float, float, float, float, float]: ... +def times() -> tuple[float, float, float, float, float]: ... def tmpfile() -> IO[str]: ... def ttyname(fd: int) -> str: ... def umask(mask: int) -> int: ... -def uname() -> Tuple[str, str, str, str, str]: ... +def uname() -> tuple[str, str, str, str, str]: ... def unlink(path: unicode) -> None: ... def unsetenv(varname: str) -> None: ... def urandom(n: int) -> str: ... -def utime(path: unicode, times: Tuple[int, int] | None) -> None: ... +def utime(path: unicode, times: tuple[int, int] | None) -> None: ... def wait() -> int: ... -_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] +_r = tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] -def wait3(options: int) -> Tuple[int, int, _r]: ... -def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ... +def wait3(options: int) -> tuple[int, int, _r]: ... +def wait4(pid: int, options: int) -> tuple[int, int, _r]: ... def waitpid(pid: int, options: int) -> int: ... def write(fd: int, str: str) -> int: ... diff --git a/stdlib/@python2/posixpath.pyi b/stdlib/@python2/posixpath.pyi index 514db760886f..33732903cb4c 100644 --- a/stdlib/@python2/posixpath.pyi +++ b/stdlib/@python2/posixpath.pyi @@ -1,7 +1,7 @@ import os import sys from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload +from typing import Any, AnyStr, Callable, Sequence, Text, TypeVar, overload _T = TypeVar("_T") @@ -74,11 +74,11 @@ def relpath(path: Text, start: Text | None = ...) -> Text: ... def samefile(f1: Text, f2: Text) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitdrive(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... +def splitext(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated + def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... +def walk(path: AnyStr, visit: Callable[[_T, AnyStr, list[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/pprint.pyi b/stdlib/@python2/pprint.pyi index 407a9afb8e47..e22c4464eb4d 100644 --- a/stdlib/@python2/pprint.pyi +++ b/stdlib/@python2/pprint.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Dict, Tuple +from typing import IO, Any def pformat(object: object, indent: int = ..., width: int = ..., depth: int | None = ...) -> str: ... def pprint( @@ -14,4 +14,4 @@ class PrettyPrinter: def pprint(self, object: object) -> None: ... def isreadable(self, object: object) -> bool: ... def isrecursive(self, object: object) -> bool: ... - def format(self, object: object, context: Dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... + def format(self, object: object, context: dict[int, Any], maxlevels: int, level: int) -> tuple[str, bool, bool]: ... diff --git a/stdlib/@python2/profile.pyi b/stdlib/@python2/profile.pyi index cf9e9e547e1b..640cb930ddfa 100644 --- a/stdlib/@python2/profile.pyi +++ b/stdlib/@python2/profile.pyi @@ -1,13 +1,13 @@ from _typeshed import Self -from typing import Any, Callable, Dict, Text, Tuple, TypeVar +from typing import Any, Callable, Text, TypeVar def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... _T = TypeVar("_T") -_Label = Tuple[str, int, str] +_Label = tuple[str, int, str] class Profile: bias: int @@ -21,6 +21,6 @@ class Profile: def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... - def runctx(self: Self, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> Self: ... + def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... def calibrate(self, m: int, verbose: int = ...) -> float: ... diff --git a/stdlib/@python2/pstats.pyi b/stdlib/@python2/pstats.pyi index 7c8129b5da49..e2cf6e437826 100644 --- a/stdlib/@python2/pstats.pyi +++ b/stdlib/@python2/pstats.pyi @@ -1,13 +1,13 @@ from _typeshed import Self from cProfile import Profile as _cProfile from profile import Profile -from typing import IO, Any, Dict, Iterable, List, Text, Tuple, TypeVar, Union, overload +from typing import IO, Any, Iterable, Text, TypeVar, Union, overload _Selector = Union[str, float, int] _T = TypeVar("_T", bound=Stats) class Stats: - sort_arg_dict_default: Dict[str, Tuple[Any, str]] + sort_arg_dict_default: dict[str, tuple[Any, str]] def __init__( self: _T, __arg: None | str | Text | Profile | _cProfile = ..., @@ -19,7 +19,7 @@ class Stats: def get_top_level_stats(self) -> None: ... def add(self: Self, *arg_list: None | str | Text | Profile | _cProfile | Self) -> Self: ... def dump_stats(self, filename: Text) -> None: ... - def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ... + def get_sort_arg_defs(self) -> dict[str, tuple[tuple[tuple[int, int], ...], str]]: ... @overload def sort_stats(self: Self, field: int) -> Self: ... @overload @@ -27,12 +27,12 @@ class Stats: def reverse_order(self: Self) -> Self: ... def strip_dirs(self: Self) -> Self: ... def calc_callees(self) -> None: ... - def eval_print_amount(self, sel: _Selector, list: List[str], msg: str) -> Tuple[List[str], str]: ... - def get_print_list(self, sel_list: Iterable[_Selector]) -> Tuple[int, List[str]]: ... + def eval_print_amount(self, sel: _Selector, list: list[str], msg: str) -> tuple[list[str], str]: ... + def get_print_list(self, sel_list: Iterable[_Selector]) -> tuple[int, list[str]]: ... def print_stats(self: Self, *amount: _Selector) -> Self: ... def print_callees(self: Self, *amount: _Selector) -> Self: ... def print_callers(self: Self, *amount: _Selector) -> Self: ... def print_call_heading(self, name_size: int, column_title: str) -> None: ... - def print_call_line(self, name_size: int, source: str, call_dict: Dict[str, Any], arrow: str = ...) -> None: ... + def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = ...) -> None: ... def print_title(self) -> None: ... def print_line(self, func: str) -> None: ... diff --git a/stdlib/@python2/pty.pyi b/stdlib/@python2/pty.pyi index d9d9fd98e41b..2c90faf18aa3 100644 --- a/stdlib/@python2/pty.pyi +++ b/stdlib/@python2/pty.pyi @@ -1,5 +1,5 @@ import sys -from typing import Callable, Iterable, Tuple +from typing import Callable, Iterable if sys.platform != "win32": _Reader = Callable[[int], bytes] @@ -9,8 +9,8 @@ if sys.platform != "win32": STDERR_FILENO: int CHILD: int - def openpty() -> Tuple[int, int]: ... - def master_open() -> Tuple[int, str]: ... + def openpty() -> tuple[int, int]: ... + def master_open() -> tuple[int, str]: ... def slave_open(tty_name: str) -> int: ... - def fork() -> Tuple[int, int]: ... + def fork() -> tuple[int, int]: ... def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> None: ... diff --git a/stdlib/@python2/pwd.pyi b/stdlib/@python2/pwd.pyi index 583999fd84b7..e64cbf6a1ac3 100644 --- a/stdlib/@python2/pwd.pyi +++ b/stdlib/@python2/pwd.pyi @@ -1,8 +1,7 @@ import sys -from typing import List, Tuple if sys.platform != "win32": - class struct_passwd(Tuple[str, str, int, int, str, str, str]): + class struct_passwd(tuple[str, str, int, int, str, str, str]): pw_name: str pw_passwd: str pw_uid: int @@ -10,6 +9,6 @@ if sys.platform != "win32": pw_gecos: str pw_dir: str pw_shell: str - def getpwall() -> List[struct_passwd]: ... + def getpwall() -> list[struct_passwd]: ... def getpwuid(__uid: int) -> struct_passwd: ... def getpwnam(__name: str) -> struct_passwd: ... diff --git a/stdlib/@python2/py_compile.pyi b/stdlib/@python2/py_compile.pyi index 44905b43da33..3c26f451116e 100644 --- a/stdlib/@python2/py_compile.pyi +++ b/stdlib/@python2/py_compile.pyi @@ -1,4 +1,4 @@ -from typing import List, Text, Type, Union +from typing import Text, Union _EitherStr = Union[bytes, Text] @@ -7,7 +7,7 @@ class PyCompileError(Exception): exc_value: BaseException file: str msg: str - def __init__(self, exc_type: Type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... + def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... def compile(file: _EitherStr, cfile: _EitherStr | None = ..., dfile: _EitherStr | None = ..., doraise: bool = ...) -> None: ... -def main(args: List[Text] | None = ...) -> int: ... +def main(args: list[Text] | None = ...) -> int: ... diff --git a/stdlib/@python2/pyclbr.pyi b/stdlib/@python2/pyclbr.pyi index 893079901665..317e934694c5 100644 --- a/stdlib/@python2/pyclbr.pyi +++ b/stdlib/@python2/pyclbr.pyi @@ -1,13 +1,13 @@ -from typing import Dict, List, Sequence +from typing import Sequence class Class: module: str name: str - super: List[Class | str] | None - methods: Dict[str, int] + super: list[Class | str] | None + methods: dict[str, int] file: int lineno: int - def __init__(self, module: str, name: str, super: List[Class | str] | None, file: str, lineno: int) -> None: ... + def __init__(self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int) -> None: ... class Function: module: str @@ -16,5 +16,5 @@ class Function: lineno: int def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ... -def readmodule(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class]: ... -def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class | Function | List[str]]: ... +def readmodule(module: str, path: Sequence[str] | None = ...) -> dict[str, Class]: ... +def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> dict[str, Class | Function | list[str]]: ... diff --git a/stdlib/@python2/pydoc.pyi b/stdlib/@python2/pydoc.pyi index dee0c4710b39..a43b7333c7b0 100644 --- a/stdlib/@python2/pydoc.pyi +++ b/stdlib/@python2/pydoc.pyi @@ -1,35 +1,20 @@ from _typeshed import SupportsWrite from types import MethodType, ModuleType, TracebackType -from typing import ( - IO, - Any, - AnyStr, - Callable, - Container, - Dict, - List, - Mapping, - MutableMapping, - NoReturn, - Optional, - Text, - Tuple, - Type, -) +from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional, Text from repr import Repr # the return type of sys.exc_info(), used by ErrorDuringImport.__init__ -_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +_Exc_Info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]] __author__: str __date__: str __version__: str __credits__: str -def pathdirs() -> List[str]: ... +def pathdirs() -> list[str]: ... def getdoc(object: object) -> Text: ... -def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def splitdoc(doc: AnyStr) -> tuple[AnyStr, AnyStr]: ... def classname(object: object, modname: str) -> str: ... def isdata(object: object) -> bool: ... def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ... @@ -37,14 +22,14 @@ def cram(text: str, maxlen: int) -> str: ... def stripid(text: str) -> str: ... def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ... -def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ... +def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ... def ispackage(path: str) -> bool: ... def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ... -def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> str | None: ... +def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = ...) -> str | None: ... class ErrorDuringImport(Exception): filename: str - exc: Type[BaseException] | None + exc: type[BaseException] | None value: BaseException | None tb: TracebackType | None def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ... @@ -97,12 +82,12 @@ class HTMLDoc(Doc): ) -> str: ... def bigsection(self, title: str, *args: Any) -> str: ... def preformat(self, text: str) -> str: ... - def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ... + def multicolumn(self, list: list[Any], format: Callable[[Any], str], cols: int = ...) -> str: ... def grey(self, text: str) -> str: ... def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ... def classlink(self, object: object, modname: str) -> str: ... def modulelink(self, object: object) -> str: ... - def modpkglink(self, modpkginfo: Tuple[str, str, bool, bool]) -> str: ... + def modpkglink(self, modpkginfo: tuple[str, str, bool, bool]) -> str: ... def markup( self, text: str, @@ -112,7 +97,7 @@ class HTMLDoc(Doc): methods: Mapping[str, str] = ..., ) -> str: ... def formattree( - self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ... ) -> str: ... def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... def docclass( @@ -164,7 +149,7 @@ class TextDoc(Doc): def indent(self, text: str, prefix: str = ...) -> str: ... def section(self, title: str, contents: str) -> str: ... def formattree( - self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ..., prefix: str = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ... ) -> str: ... def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... @@ -204,16 +189,16 @@ html: HTMLDoc class _OldStyleClass: ... -def resolve(thing: str | object, forceload: bool = ...) -> Tuple[object, str] | None: ... +def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ... def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ... def writedoc(thing: str | object, forceload: bool = ...) -> None: ... def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ... class Helper: - keywords: Dict[str, str | Tuple[str, str]] - symbols: Dict[str, str] - topics: Dict[str, str | Tuple[str, ...]] + keywords: dict[str, str | tuple[str, str]] + symbols: dict[str, str] + topics: dict[str, str | tuple[str, ...]] def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ... input: IO[str] output: IO[str] @@ -222,7 +207,7 @@ class Helper: def getline(self, prompt: str) -> str: ... def help(self, request: Any) -> None: ... def intro(self) -> None: ... - def list(self, items: List[str], columns: int = ..., width: int = ...) -> None: ... + def list(self, items: list[str], columns: int = ..., width: int = ...) -> None: ... def listkeywords(self) -> None: ... def listsymbols(self) -> None: ... def listtopics(self) -> None: ... diff --git a/stdlib/@python2/pydoc_data/topics.pyi b/stdlib/@python2/pydoc_data/topics.pyi index 1c48f4022fd6..091d34300106 100644 --- a/stdlib/@python2/pydoc_data/topics.pyi +++ b/stdlib/@python2/pydoc_data/topics.pyi @@ -1,3 +1 @@ -from typing import Dict - -topics: Dict[str, str] +topics: dict[str, str] diff --git a/stdlib/@python2/pyexpat/__init__.pyi b/stdlib/@python2/pyexpat/__init__.pyi index bd73f850b559..8faaec294316 100644 --- a/stdlib/@python2/pyexpat/__init__.pyi +++ b/stdlib/@python2/pyexpat/__init__.pyi @@ -1,12 +1,12 @@ import pyexpat.errors as errors import pyexpat.model as model from _typeshed import SupportsRead -from typing import Any, Callable, Dict, List, Optional, Text, Tuple +from typing import Any, Callable, Optional, Text EXPAT_VERSION: str # undocumented -version_info: Tuple[int, int, int] # undocumented +version_info: tuple[int, int, int] # undocumented native_encoding: str # undocumented -features: List[Tuple[str, int]] # undocumented +features: list[tuple[str, int]] # undocumented class ExpatError(Exception): code: int @@ -19,7 +19,7 @@ XML_PARAM_ENTITY_PARSING_NEVER: int XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int XML_PARAM_ENTITY_PARSING_ALWAYS: int -_Model = Tuple[int, int, Optional[str], Tuple[Any, ...]] +_Model = tuple[int, int, Optional[str], tuple[Any, ...]] class XMLParserType(object): def Parse(self, __data: Text | bytes, __isfinal: bool = ...) -> int: ... @@ -48,8 +48,8 @@ class XMLParserType(object): EndDoctypeDeclHandler: Callable[[], Any] | None ElementDeclHandler: Callable[[str, _Model], Any] | None AttlistDeclHandler: Callable[[str, str, str, str | None, bool], Any] | None - StartElementHandler: Callable[[str, Dict[str, str]], Any] | Callable[[str, List[str]], Any] | Callable[ - [str, Dict[str, str], List[str]], Any + StartElementHandler: Callable[[str, dict[str, str]], Any] | Callable[[str, list[str]], Any] | Callable[ + [str, dict[str, str], list[str]], Any ] | None EndElementHandler: Callable[[str], Any] | None ProcessingInstructionHandler: Callable[[str, str], Any] | None @@ -71,5 +71,5 @@ def ErrorString(__code: int) -> str: ... # intern is undocumented def ParserCreate( - encoding: Text | None = ..., namespace_separator: Text | None = ..., intern: Dict[str, Any] | None = ... + encoding: Text | None = ..., namespace_separator: Text | None = ..., intern: dict[str, Any] | None = ... ) -> XMLParserType: ... diff --git a/stdlib/@python2/random.pyi b/stdlib/@python2/random.pyi index 6fb5d602067c..df279a03c24a 100644 --- a/stdlib/@python2/random.pyi +++ b/stdlib/@python2/random.pyi @@ -1,5 +1,5 @@ import _random -from typing import Any, Callable, Iterator, List, MutableSequence, Protocol, Sequence, TypeVar, overload +from typing import Any, Callable, Iterator, MutableSequence, Protocol, Sequence, TypeVar, overload _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) @@ -22,7 +22,7 @@ class Random(_random.Random): def randint(self, a: int, b: int) -> int: ... def choice(self, seq: Sequence[_T]) -> _T: ... def shuffle(self, x: MutableSequence[Any], random: Callable[[], None] = ...) -> None: ... - def sample(self, population: _Sampleable[_T], k: int) -> List[_T]: ... + def sample(self, population: _Sampleable[_T], k: int) -> list[_T]: ... def random(self) -> float: ... def uniform(self, a: float, b: float) -> float: ... def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ... @@ -52,7 +52,7 @@ def randrange(start: int, stop: int, step: int = ...) -> int: ... def randint(a: int, b: int) -> int: ... def choice(seq: Sequence[_T]) -> _T: ... def shuffle(x: MutableSequence[Any], random: Callable[[], float] = ...) -> None: ... -def sample(population: _Sampleable[_T], k: int) -> List[_T]: ... +def sample(population: _Sampleable[_T], k: int) -> list[_T]: ... def random() -> float: ... def uniform(a: float, b: float) -> float: ... def triangular(low: float = ..., high: float = ..., mode: float = ...) -> float: ... diff --git a/stdlib/@python2/re.pyi b/stdlib/@python2/re.pyi index fbe021ce67be..ba555968ad4b 100644 --- a/stdlib/@python2/re.pyi +++ b/stdlib/@python2/re.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Callable, Iterator, List, Match, Pattern, Tuple, overload +from typing import Any, AnyStr, Callable, Iterator, Match, Pattern, overload # ----- re variables and constants ----- DEBUG: int @@ -32,13 +32,13 @@ def match(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[Any @overload def match(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ... @overload -def split(pattern: 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: 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: str | unicode, string: AnyStr, flags: int = ...) -> List[Any]: ... +def findall(pattern: str | unicode, string: AnyStr, flags: int = ...) -> list[Any]: ... @overload -def findall(pattern: 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 @@ -65,15 +65,15 @@ def sub( flags: int = ..., ) -> AnyStr: ... @overload -def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> Tuple[AnyStr, int]: ... +def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> tuple[AnyStr, int]: ... @overload def subn( pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ... -) -> Tuple[AnyStr, int]: ... +) -> tuple[AnyStr, int]: ... @overload def subn( pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ... -) -> Tuple[AnyStr, int]: ... +) -> tuple[AnyStr, int]: ... @overload def subn( pattern: Pattern[str] | Pattern[unicode], @@ -81,7 +81,7 @@ def subn( string: AnyStr, count: int = ..., flags: int = ..., -) -> Tuple[AnyStr, int]: ... +) -> tuple[AnyStr, int]: ... def escape(string: AnyStr) -> AnyStr: ... def purge() -> None: ... def template(pattern: AnyStr | Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ... diff --git a/stdlib/@python2/repr.pyi b/stdlib/@python2/repr.pyi index bdb8822ac77d..6b6f5ea9325e 100644 --- a/stdlib/@python2/repr.pyi +++ b/stdlib/@python2/repr.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any class Repr: maxarray: int @@ -27,7 +27,7 @@ class Repr: def repr_str(self, x, level: complex) -> str: ... def repr_tuple(self, x, level: complex) -> str: ... -def _possibly_sorted(x) -> List[Any]: ... +def _possibly_sorted(x) -> list[Any]: ... aRepr: Repr diff --git a/stdlib/@python2/resource.pyi b/stdlib/@python2/resource.pyi index 476438d53674..1a655604b129 100644 --- a/stdlib/@python2/resource.pyi +++ b/stdlib/@python2/resource.pyi @@ -1,11 +1,11 @@ import sys -from typing import NamedTuple, Tuple +from typing import NamedTuple if sys.platform != "win32": class error(Exception): ... RLIM_INFINITY: int - def getrlimit(resource: int) -> Tuple[int, int]: ... - def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ... + def getrlimit(resource: int) -> tuple[int, int]: ... + def setrlimit(resource: int, limits: tuple[int, int]) -> None: ... RLIMIT_CORE: int RLIMIT_CPU: int RLIMIT_FSIZE: int diff --git a/stdlib/@python2/rlcompleter.pyi b/stdlib/@python2/rlcompleter.pyi index a61c61eb24f2..fcd385f335fb 100644 --- a/stdlib/@python2/rlcompleter.pyi +++ b/stdlib/@python2/rlcompleter.pyi @@ -1,7 +1,7 @@ -from typing import Any, Dict, Union +from typing import Any, Union _Text = Union[str, unicode] class Completer: - def __init__(self, namespace: Dict[str, Any] | None = ...) -> None: ... + def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ... def complete(self, text: _Text, state: int) -> str | None: ... diff --git a/stdlib/@python2/sched.pyi b/stdlib/@python2/sched.pyi index f718dd7a57bd..9247a95da974 100644 --- a/stdlib/@python2/sched.pyi +++ b/stdlib/@python2/sched.pyi @@ -1,18 +1,18 @@ -from typing import Any, Callable, Dict, List, NamedTuple, Text, Tuple +from typing import Any, Callable, NamedTuple, Text class Event(NamedTuple): time: float priority: Any action: Callable[..., Any] - argument: Tuple[Any, ...] - kwargs: Dict[Text, Any] + argument: tuple[Any, ...] + kwargs: dict[Text, Any] class scheduler: def __init__(self, timefunc: Callable[[], float], delayfunc: Callable[[float], None]) -> None: ... - def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... - def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... + def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: tuple[Any, ...]) -> Event: ... + def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: tuple[Any, ...]) -> Event: ... def run(self) -> None: ... def cancel(self, event: Event) -> None: ... def empty(self) -> bool: ... @property - def queue(self) -> List[Event]: ... + def queue(self) -> list[Event]: ... diff --git a/stdlib/@python2/select.pyi b/stdlib/@python2/select.pyi index b960fd4e24b5..cd799d75b5b1 100644 --- a/stdlib/@python2/select.pyi +++ b/stdlib/@python2/select.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import FileDescriptorLike -from typing import Any, Iterable, List, Tuple +from typing import Any, Iterable if sys.platform != "win32": PIPE_BUF: int @@ -21,11 +21,11 @@ class poll: def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> List[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ... def select( __rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = ... -) -> Tuple[List[Any], List[Any], List[Any]]: ... +) -> tuple[list[Any], list[Any], list[Any]]: ... class error(Exception): ... @@ -54,7 +54,7 @@ if sys.platform != "linux" and sys.platform != "win32": def close(self) -> None: ... def control( self, __changelist: Iterable[kevent] | None, __maxevents: int, __timeout: float | None = ... - ) -> List[kevent]: ... + ) -> list[kevent]: ... def fileno(self) -> int: ... @classmethod def fromfd(cls, __fd: FileDescriptorLike) -> kqueue: ... @@ -106,7 +106,7 @@ if sys.platform == "linux": def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ..., maxevents: int = ...) -> List[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ..., maxevents: int = ...) -> list[tuple[int, int]]: ... @classmethod def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ... EPOLLERR: int diff --git a/stdlib/@python2/shelve.pyi b/stdlib/@python2/shelve.pyi index d9b1a00e58df..0e795c4148a7 100644 --- a/stdlib/@python2/shelve.pyi +++ b/stdlib/@python2/shelve.pyi @@ -1,12 +1,12 @@ import collections -from typing import Any, Dict, Iterator, List, Tuple +from typing import Any, Iterator class Shelf(collections.MutableMapping[Any, Any]): def __init__( - self, dict: Dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... + self, dict: dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... ) -> None: ... def __iter__(self) -> Iterator[str]: ... - def keys(self) -> List[Any]: ... + def keys(self) -> list[Any]: ... def __len__(self) -> int: ... def has_key(self, key: Any) -> bool: ... def __contains__(self, key: Any) -> bool: ... @@ -22,13 +22,13 @@ class Shelf(collections.MutableMapping[Any, Any]): class BsdDbShelf(Shelf): def __init__( - self, dict: Dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... + self, dict: dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... ) -> None: ... - def set_location(self, key: Any) -> Tuple[str, Any]: ... - def next(self) -> Tuple[str, Any]: ... - def previous(self) -> Tuple[str, Any]: ... - def first(self) -> Tuple[str, Any]: ... - def last(self) -> Tuple[str, Any]: ... + def set_location(self, key: Any) -> tuple[str, Any]: ... + def next(self) -> tuple[str, Any]: ... + def previous(self) -> tuple[str, Any]: ... + def first(self) -> tuple[str, Any]: ... + def last(self) -> tuple[str, Any]: ... class DbfilenameShelf(Shelf): def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... diff --git a/stdlib/@python2/shlex.pyi b/stdlib/@python2/shlex.pyi index aac3192a1d12..6c4557a98036 100644 --- a/stdlib/@python2/shlex.pyi +++ b/stdlib/@python2/shlex.pyi @@ -1,7 +1,7 @@ from _typeshed import Self -from typing import IO, Any, List, Text +from typing import IO, Any, Text -def split(s: str | None, comments: bool = ..., posix: bool = ...) -> List[str]: ... +def split(s: str | None, comments: bool = ..., posix: bool = ...) -> list[str]: ... class shlex: def __init__(self, instream: IO[Any] | Text = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ... diff --git a/stdlib/@python2/shutil.pyi b/stdlib/@python2/shutil.pyi index 4805c8e4cdb7..f92cf1c9f1a0 100644 --- a/stdlib/@python2/shutil.pyi +++ b/stdlib/@python2/shutil.pyi @@ -1,9 +1,9 @@ from _typeshed import SupportsRead, SupportsWrite -from typing import Any, AnyStr, Callable, Iterable, List, Sequence, Set, Text, Tuple, Type, TypeVar, Union +from typing import Any, AnyStr, Callable, Iterable, Sequence, Text, TypeVar, Union _AnyStr = TypeVar("_AnyStr", str, unicode) _AnyPath = TypeVar("_AnyPath", str, unicode) -_PathReturn = Type[None] +_PathReturn = type[None] class Error(EnvironmentError): ... class SpecialFileError(EnvironmentError): ... @@ -15,9 +15,9 @@ def copymode(src: Text, dst: Text) -> None: ... def copystat(src: Text, dst: Text) -> None: ... def copy(src: Text, dst: Text) -> _PathReturn: ... def copy2(src: Text, dst: Text) -> _PathReturn: ... -def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ... +def ignore_patterns(*patterns: Text) -> Callable[[Any, list[_AnyStr]], set[_AnyStr]]: ... def copytree( - src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: None | Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]] = ... + src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: None | Callable[[AnyStr, list[AnyStr]], Iterable[AnyStr]] = ... ) -> _PathReturn: ... def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Callable[[Any, _AnyPath, Any], Any] | None = ...) -> None: ... @@ -35,11 +35,11 @@ def make_archive( group: str | None = ..., logger: Any | None = ..., ) -> _AnyStr: ... -def get_archive_formats() -> List[Tuple[str, str]]: ... +def get_archive_formats() -> list[tuple[str, str]]: ... def register_archive_format( name: str, function: Callable[..., Any], - extra_args: Sequence[Tuple[str, Any] | List[Any]] | None = ..., + extra_args: Sequence[tuple[str, Any] | list[Any]] | None = ..., description: str = ..., ) -> None: ... def unregister_archive_format(name: str) -> None: ... diff --git a/stdlib/@python2/signal.pyi b/stdlib/@python2/signal.pyi index fb8f3324dfbf..7f86f03e638a 100644 --- a/stdlib/@python2/signal.pyi +++ b/stdlib/@python2/signal.pyi @@ -1,5 +1,5 @@ from types import FrameType -from typing import Callable, Tuple, Union +from typing import Callable, Union SIG_DFL: int SIG_IGN: int @@ -60,8 +60,8 @@ _HANDLER = Union[Callable[[int, FrameType], None], int, None] def alarm(time: int) -> int: ... def getsignal(signalnum: int) -> _HANDLER: ... def pause() -> None: ... -def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ... -def getitimer(which: int) -> Tuple[float, float]: ... +def setitimer(which: int, seconds: float, interval: float = ...) -> tuple[float, float]: ... +def getitimer(which: int) -> tuple[float, float]: ... def set_wakeup_fd(fd: int) -> int: ... def siginterrupt(signalnum: int, flag: bool) -> None: ... def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: ... diff --git a/stdlib/@python2/site.pyi b/stdlib/@python2/site.pyi index c77c9397f612..fc331c113163 100644 --- a/stdlib/@python2/site.pyi +++ b/stdlib/@python2/site.pyi @@ -1,12 +1,12 @@ -from typing import Iterable, List +from typing import Iterable -PREFIXES: List[str] +PREFIXES: list[str] ENABLE_USER_SITE: bool | None USER_SITE: str | None USER_BASE: str | None def main() -> None: ... def addsitedir(sitedir: str, known_paths: Iterable[str] | None = ...) -> None: ... -def getsitepackages(prefixes: Iterable[str] | None = ...) -> List[str]: ... +def getsitepackages(prefixes: Iterable[str] | None = ...) -> list[str]: ... def getuserbase() -> str: ... def getusersitepackages() -> str: ... diff --git a/stdlib/@python2/smtpd.pyi b/stdlib/@python2/smtpd.pyi index 1c17b82d8ab5..6778611a56d9 100644 --- a/stdlib/@python2/smtpd.pyi +++ b/stdlib/@python2/smtpd.pyi @@ -1,9 +1,9 @@ import asynchat import asyncore import socket -from typing import Any, List, Text, Tuple, Type +from typing import Any, Text -_Address = Tuple[str, int] # (host, port) +_Address = tuple[str, int] # (host, port) class SMTPChannel(asynchat.async_chat): COMMAND: int @@ -22,24 +22,24 @@ class SMTPChannel(asynchat.async_chat): def smtp_DATA(self, arg: str) -> None: ... class SMTPServer(asyncore.dispatcher): - channel_class: Type[SMTPChannel] + channel_class: type[SMTPChannel] data_size_limit: int enable_SMTPUTF8: bool def __init__(self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ...) -> None: ... def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ... def process_message( - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str, **kwargs: Any + self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str, **kwargs: Any ) -> str | None: ... class DebuggingServer(SMTPServer): ... class PureProxy(SMTPServer): def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str + self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str ) -> str | None: ... class MailmanProxy(PureProxy): def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str + self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str ) -> str | None: ... diff --git a/stdlib/@python2/sndhdr.pyi b/stdlib/@python2/sndhdr.pyi index 189529fd21d6..0213a5d0cbb3 100644 --- a/stdlib/@python2/sndhdr.pyi +++ b/stdlib/@python2/sndhdr.pyi @@ -1,6 +1,6 @@ -from typing import Text, Tuple, Union +from typing import Text, Union -_SndHeaders = Tuple[str, int, int, int, Union[int, str]] +_SndHeaders = tuple[str, int, int, int, Union[int, str]] def what(filename: Text) -> _SndHeaders | None: ... def whathdr(filename: Text) -> _SndHeaders | None: ... diff --git a/stdlib/@python2/socket.pyi b/stdlib/@python2/socket.pyi index fe77c72839b6..3a69a3239d32 100644 --- a/stdlib/@python2/socket.pyi +++ b/stdlib/@python2/socket.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, BinaryIO, Iterable, List, Text, Tuple, Union, overload +from typing import Any, BinaryIO, Iterable, Text, Union, overload # ----- Constants ----- # Some socket families are listed in the "Socket families" section of the docs, @@ -373,13 +373,13 @@ class timeout(error): # Addresses can be either tuples of varying lengths (AF_INET, AF_INET6, # AF_NETLINK, AF_TIPC) or strings (AF_UNIX). -_Address = Union[Tuple[Any, ...], str] +_Address = Union[tuple[Any, ...], str] _RetAddress = Any # TODO Most methods allow bytes as address objects _WriteBuffer = Union[bytearray, memoryview] -_CMSG = Tuple[int, int, bytes] +_CMSG = tuple[int, int, bytes] class socket: family: int @@ -387,7 +387,7 @@ class socket: proto: int def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... # --- methods --- - def accept(self) -> Tuple[socket, _RetAddress]: ... + def accept(self) -> tuple[socket, _RetAddress]: ... def bind(self, address: _Address | bytes) -> None: ... def close(self) -> None: ... def connect(self, address: _Address | bytes) -> None: ... @@ -403,13 +403,13 @@ class socket: def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... def gettimeout(self) -> float | None: ... if sys.platform == "win32": - def ioctl(self, control: int, option: int | Tuple[int, int, int]) -> None: ... + def ioctl(self, control: int, option: int | tuple[int, int, int]) -> None: ... def listen(self, __backlog: int) -> None: ... # Note that the makefile's documented windows-specific behavior is not represented def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... - def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ... - def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ... + def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ... + def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ... def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ... def send(self, data: bytes, flags: int = ...) -> int: ... def sendall(self, data: bytes, flags: int = ...) -> None: ... # return type: None on success @@ -427,9 +427,9 @@ class socket: # ----- Functions ----- def create_connection( - address: Tuple[str | None, int], + address: tuple[str | None, int], timeout: float | None = ..., - source_address: Tuple[bytearray | bytes | Text, int] | None = ..., + source_address: tuple[bytearray | bytes | Text, int] | None = ..., ) -> socket: ... def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ... @@ -441,22 +441,22 @@ def getaddrinfo( socktype: int = ..., proto: int = ..., flags: int = ..., -) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[Any, ...]]]: ... +) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[Any, ...]]]: ... def getfqdn(name: str = ...) -> str: ... def gethostbyname(hostname: str) -> str: ... -def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ... +def gethostbyname_ex(hostname: str) -> tuple[str, list[str], list[str]]: ... def gethostname() -> str: ... -def gethostbyaddr(ip_address: str) -> Tuple[str, List[str], List[str]]: ... -def getnameinfo(sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int) -> Tuple[str, str]: ... +def gethostbyaddr(ip_address: str) -> tuple[str, list[str], list[str]]: ... +def getnameinfo(sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int) -> tuple[str, str]: ... def getprotobyname(protocolname: str) -> int: ... def getservbyname(servicename: str, protocolname: str = ...) -> int: ... def getservbyport(port: int, protocolname: str = ...) -> str: ... if sys.platform == "win32": - def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> Tuple[socket, socket]: ... + def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> tuple[socket, socket]: ... else: - def socketpair(family: int | None = ..., type: int = ..., proto: int = ...) -> Tuple[socket, socket]: ... + def socketpair(family: int | None = ..., type: int = ..., proto: int = ...) -> tuple[socket, socket]: ... def ntohl(x: int) -> int: ... # param & ret val are 32-bit ints def ntohs(x: int) -> int: ... # param & ret val are 16-bit ints diff --git a/stdlib/@python2/spwd.pyi b/stdlib/@python2/spwd.pyi index 95122ce43d1e..b21242fc49e4 100644 --- a/stdlib/@python2/spwd.pyi +++ b/stdlib/@python2/spwd.pyi @@ -1,5 +1,5 @@ import sys -from typing import List, NamedTuple +from typing import NamedTuple if sys.platform != "win32": class struct_spwd(NamedTuple): @@ -12,5 +12,5 @@ if sys.platform != "win32": sp_inact: int sp_expire: int sp_flag: int - def getspall() -> List[struct_spwd]: ... + def getspall() -> list[struct_spwd]: ... def getspnam(name: str) -> struct_spwd: ... diff --git a/stdlib/@python2/sqlite3/dbapi2.pyi b/stdlib/@python2/sqlite3/dbapi2.pyi index 023a0506f4aa..37b3b6df71b0 100644 --- a/stdlib/@python2/sqlite3/dbapi2.pyi +++ b/stdlib/@python2/sqlite3/dbapi2.pyi @@ -1,5 +1,5 @@ from datetime import date, datetime, time -from typing import Any, Callable, Generator, Iterable, Iterator, List, Protocol, Text, Tuple, Type, TypeVar +from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, Text, TypeVar _T = TypeVar("_T") @@ -14,8 +14,8 @@ def DateFromTicks(ticks: float) -> Date: ... def TimeFromTicks(ticks: float) -> Time: ... def TimestampFromTicks(ticks: float) -> Timestamp: ... -version_info: Tuple[int, int, int] -sqlite_version_info: Tuple[int, int, int] +version_info: tuple[int, int, int] +sqlite_version_info: tuple[int, int, int] Binary = buffer # The remaining definitions are imported from _sqlite3. @@ -67,12 +67,12 @@ def connect( detect_types: int = ..., isolation_level: str | None = ..., check_same_thread: bool = ..., - factory: Type[Connection] | None = ..., + factory: type[Connection] | None = ..., cached_statements: int = ..., ) -> Connection: ... def enable_callback_tracebacks(__enable: bool) -> None: ... def enable_shared_cache(enable: int) -> None: ... -def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ... +def register_adapter(__type: type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ... def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ... class Cache(object): @@ -144,8 +144,8 @@ class Cursor(Iterator[Any]): def execute(self, __sql: str, __parameters: Iterable[Any] = ...) -> Cursor: ... def executemany(self, __sql: str, __seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ... def executescript(self, __sql_script: bytes | Text) -> Cursor: ... - def fetchall(self) -> List[Any]: ... - def fetchmany(self, size: int | None = ...) -> List[Any]: ... + def fetchall(self) -> list[Any]: ... + def fetchmany(self, size: int | None = ...) -> list[Any]: ... def fetchone(self) -> Any: ... def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ... def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/stdlib/@python2/sre_compile.pyi b/stdlib/@python2/sre_compile.pyi index efc3e568a07c..30b4d2cb628c 100644 --- a/stdlib/@python2/sre_compile.pyi +++ b/stdlib/@python2/sre_compile.pyi @@ -12,10 +12,10 @@ from sre_constants import ( SRE_INFO_PREFIX as SRE_INFO_PREFIX, ) from sre_parse import SubPattern -from typing import Any, List, Pattern, Tuple, Type +from typing import Any, Pattern MAXCODE: int -STRING_TYPES: Tuple[Type[str], Type[unicode]] +STRING_TYPES: tuple[type[str], type[unicode]] _IsStringType = int def isstring(obj: Any) -> _IsStringType: ... diff --git a/stdlib/@python2/sre_constants.pyi b/stdlib/@python2/sre_constants.pyi index bc15754d6fa1..09280512a7f4 100644 --- a/stdlib/@python2/sre_constants.pyi +++ b/stdlib/@python2/sre_constants.pyi @@ -1,4 +1,4 @@ -from typing import Dict, List, TypeVar +from typing import TypeVar MAGIC: int MAXREPEAT: int @@ -72,14 +72,14 @@ CATEGORY_UNI_NOT_LINEBREAK: str _T = TypeVar("_T") -def makedict(list: List[_T]) -> Dict[_T, int]: ... +def makedict(list: list[_T]) -> dict[_T, int]: ... -OP_IGNORE: Dict[str, str] -AT_MULTILINE: Dict[str, str] -AT_LOCALE: Dict[str, str] -AT_UNICODE: Dict[str, str] -CH_LOCALE: Dict[str, str] -CH_UNICODE: Dict[str, str] +OP_IGNORE: dict[str, str] +AT_MULTILINE: dict[str, str] +AT_LOCALE: dict[str, str] +AT_UNICODE: dict[str, str] +CH_LOCALE: dict[str, str] +CH_UNICODE: dict[str, str] SRE_FLAG_TEMPLATE: int SRE_FLAG_IGNORECASE: int SRE_FLAG_LOCALE: int diff --git a/stdlib/@python2/sre_parse.pyi b/stdlib/@python2/sre_parse.pyi index 35f6d4d32ae2..c4307bb9bb53 100644 --- a/stdlib/@python2/sre_parse.pyi +++ b/stdlib/@python2/sre_parse.pyi @@ -1,38 +1,38 @@ -from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union +from typing import Any, Iterable, Match, Optional, Pattern as _Pattern, Union SPECIAL_CHARS: str REPEAT_CHARS: str -DIGITS: Set[Any] -OCTDIGITS: Set[Any] -HEXDIGITS: Set[Any] -WHITESPACE: Set[Any] -ESCAPES: Dict[str, Tuple[str, int]] -CATEGORIES: Dict[str, Tuple[str, str] | Tuple[str, List[Tuple[str, str]]]] -FLAGS: Dict[str, int] +DIGITS: set[Any] +OCTDIGITS: set[Any] +HEXDIGITS: set[Any] +WHITESPACE: set[Any] +ESCAPES: dict[str, tuple[str, int]] +CATEGORIES: dict[str, tuple[str, str] | tuple[str, list[tuple[str, str]]]] +FLAGS: dict[str, int] class Pattern: flags: int - open: List[int] + open: list[int] groups: int - groupdict: Dict[str, int] + groupdict: dict[str, int] lookbehind: int def __init__(self) -> None: ... def opengroup(self, name: str = ...) -> int: ... def closegroup(self, gid: int) -> None: ... def checkgroup(self, gid: int) -> bool: ... -_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern] -_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern] -_OpInType = List[Tuple[str, int]] -_OpBranchType = Tuple[None, List[SubPattern]] +_OpSubpatternType = tuple[Optional[int], int, int, SubPattern] +_OpGroupRefExistsType = tuple[int, SubPattern, SubPattern] +_OpInType = list[tuple[str, int]] +_OpBranchType = tuple[None, list[SubPattern]] _AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType] _CodeType = Union[str, _AvType] class SubPattern: pattern: str - data: List[_CodeType] + data: list[_CodeType] width: int | None - def __init__(self, pattern, data: List[_CodeType] = ...) -> None: ... + def __init__(self, pattern, data: list[_CodeType] = ...) -> None: ... def dump(self, level: int = ...) -> None: ... def __len__(self) -> int: ... def __delitem__(self, index: int | slice) -> None: ... @@ -48,7 +48,7 @@ class Tokenizer: def __init__(self, string: str) -> None: ... def match(self, char: str, skip: int = ...) -> int: ... def get(self) -> str | None: ... - def tell(self) -> Tuple[int, str | None]: ... + def tell(self) -> tuple[int, str | None]: ... def seek(self, index: int) -> None: ... def isident(char: str) -> bool: ... @@ -56,7 +56,7 @@ def isdigit(char: str) -> bool: ... def isname(name: str) -> bool: ... def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ... -_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]] +_Template = tuple[list[tuple[int, int]], list[Optional[int]]] def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ... def expand_template(template: _Template, match: Match[Any]) -> str: ... diff --git a/stdlib/@python2/ssl.pyi b/stdlib/@python2/ssl.pyi index aabecaaba87a..67ba3bb18bdd 100644 --- a/stdlib/@python2/ssl.pyi +++ b/stdlib/@python2/ssl.pyi @@ -1,14 +1,14 @@ import socket import sys from _typeshed import StrPath -from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Union, overload +from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Optional, Text, Union, overload from typing_extensions import Literal -_PCTRTT = Tuple[Tuple[str, str], ...] -_PCTRTTT = Tuple[_PCTRTT, ...] -_PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]] +_PCTRTT = tuple[tuple[str, str], ...] +_PCTRTTT = tuple[_PCTRTT, ...] +_PeerCertRetDictType = dict[str, Union[str, _PCTRTTT, _PCTRTT]] _PeerCertRetType = Union[_PeerCertRetDictType, bytes, None] -_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]] +_EnumRetType = list[tuple[bytes, str, Union[set[str], bool]]] _PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes] _SC1ArgT = SSLSocket @@ -60,7 +60,7 @@ def RAND_egd(path: str) -> None: ... def RAND_add(__s: bytes, __entropy: float) -> None: ... def match_hostname(cert: _PeerCertRetType, hostname: str) -> None: ... def cert_time_to_seconds(cert_time: str) -> int: ... -def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... +def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... @@ -110,10 +110,10 @@ HAS_ALPN: bool HAS_ECDH: bool HAS_SNI: bool HAS_NPN: bool -CHANNEL_BINDING_TYPES: List[str] +CHANNEL_BINDING_TYPES: list[str] OPENSSL_VERSION: str -OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int] +OPENSSL_VERSION_INFO: tuple[int, int, int, int, int] OPENSSL_VERSION_NUMBER: int ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int @@ -200,12 +200,12 @@ class SSLSocket(socket.socket): def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... - def cipher(self) -> Tuple[str, str, int] | None: ... + def cipher(self) -> tuple[str, str, int] | None: ... def compression(self) -> str | None: ... def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... - def accept(self) -> Tuple[SSLSocket, socket._RetAddress]: ... + def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ... def unwrap(self) -> socket.socket: ... def version(self) -> str | None: ... def pending(self) -> int: ... @@ -219,13 +219,13 @@ class SSLContext: verify_flags: int verify_mode: int def __init__(self, protocol: int) -> None: ... - def cert_store_stats(self) -> Dict[str, int]: ... + def cert_store_stats(self) -> dict[str, int]: ... def load_cert_chain(self, certfile: StrPath, keyfile: StrPath | None = ..., password: _PasswordType | None = ...) -> None: ... def load_default_certs(self, purpose: Purpose = ...) -> None: ... def load_verify_locations( self, cafile: StrPath | None = ..., capath: StrPath | None = ..., cadata: Text | bytes | None = ... ) -> None: ... - def get_ca_certs(self, binary_form: bool = ...) -> List[_PeerCertRetDictType] | List[bytes]: ... + def get_ca_certs(self, binary_form: bool = ...) -> list[_PeerCertRetDictType] | list[bytes]: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, __cipherlist: str) -> None: ... def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ... @@ -241,7 +241,7 @@ class SSLContext: suppress_ragged_eofs: bool = ..., server_hostname: str | None = ..., ) -> SSLSocket: ... - def session_stats(self) -> Dict[str, int]: ... + def session_stats(self) -> dict[str, int]: ... # TODO below documented in cpython but not in docs.python.org # taken from python 3.4 diff --git a/stdlib/@python2/string.pyi b/stdlib/@python2/string.pyi index fe028dab39bd..79fce4f893c7 100644 --- a/stdlib/@python2/string.pyi +++ b/stdlib/@python2/string.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Iterable, List, Mapping, Sequence, Text, Tuple, overload +from typing import Any, AnyStr, Iterable, Mapping, Sequence, Text, overload ascii_letters: str ascii_lowercase: str @@ -27,9 +27,9 @@ def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: .. def rindex(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... def count(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... def lower(s: AnyStr) -> AnyStr: ... -def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def rsplit(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... +def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> list[AnyStr]: ... +def rsplit(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> list[AnyStr]: ... +def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> list[AnyStr]: ... def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... def joinfields(word: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... def lstrip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ... @@ -60,7 +60,7 @@ class Template: class Formatter(object): def format(self, format_string: str, *args, **kwargs) -> str: ... def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... - def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ... + def parse(self, format_string: str) -> Iterable[tuple[str, str, str, str]]: ... def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... def check_unused_args(self, used_args: Sequence[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ... diff --git a/stdlib/@python2/stringold.pyi b/stdlib/@python2/stringold.pyi index d221547f1c07..80402b0069e3 100644 --- a/stdlib/@python2/stringold.pyi +++ b/stdlib/@python2/stringold.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, Iterable, List +from typing import AnyStr, Iterable whitespace: str lowercase: str @@ -8,7 +8,7 @@ digits: str hexdigits: str octdigits: str _idmap: str -_idmapL: List[str] | None +_idmapL: list[str] | None index_error = ValueError atoi_error = ValueError atof_error = ValueError @@ -20,8 +20,8 @@ def swapcase(s: AnyStr) -> AnyStr: ... def strip(s: AnyStr) -> AnyStr: ... def lstrip(s: AnyStr) -> AnyStr: ... def rstrip(s: AnyStr) -> AnyStr: ... -def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... +def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> list[AnyStr]: ... +def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> list[AnyStr]: ... def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... def joinfields(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... diff --git a/stdlib/@python2/strop.pyi b/stdlib/@python2/strop.pyi index 81035eaabe79..9321bbe5bf5e 100644 --- a/stdlib/@python2/strop.pyi +++ b/stdlib/@python2/strop.pyi @@ -1,4 +1,4 @@ -from typing import List, Sequence +from typing import Sequence lowercase: str uppercase: str @@ -19,8 +19,8 @@ def maketrans(frm: str, to: str) -> str: ... def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: ... def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int: ... def rstrip(s: str) -> str: ... -def split(s: str, sep: str, maxsplit: int = ...) -> List[str]: ... -def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]: ... +def split(s: str, sep: str, maxsplit: int = ...) -> list[str]: ... +def splitfields(s: str, sep: str, maxsplit: int = ...) -> list[str]: ... def strip(s: str) -> str: ... def swapcase(s: str) -> str: ... def translate(s: str, table: str, deletechars: str = ...) -> str: ... diff --git a/stdlib/@python2/struct.pyi b/stdlib/@python2/struct.pyi index bf27d12783da..7129fbc4cfb6 100644 --- a/stdlib/@python2/struct.pyi +++ b/stdlib/@python2/struct.pyi @@ -1,6 +1,6 @@ from array import array from mmap import mmap -from typing import Any, Text, Tuple, Union +from typing import Any, Text, Union class error(Exception): ... @@ -10,8 +10,8 @@ _WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap] def pack(fmt: _FmtType, *v: Any) -> bytes: ... def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... -def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ... -def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... +def unpack(__format: _FmtType, __buffer: _BufferType) -> tuple[Any, ...]: ... +def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> tuple[Any, ...]: ... def calcsize(__format: _FmtType) -> int: ... class Struct: @@ -20,5 +20,5 @@ class Struct: def __init__(self, format: _FmtType) -> None: ... def pack(self, *v: Any) -> bytes: ... def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... - def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ... - def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... + def unpack(self, __buffer: _BufferType) -> tuple[Any, ...]: ... + def unpack_from(self, buffer: _BufferType, offset: int = ...) -> tuple[Any, ...]: ... diff --git a/stdlib/@python2/subprocess.pyi b/stdlib/@python2/subprocess.pyi index 8c101272322a..d2149c81aaaf 100644 --- a/stdlib/@python2/subprocess.pyi +++ b/stdlib/@python2/subprocess.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, Generic, Mapping, Optional, Sequence, Text, Tuple, TypeVar, Union +from typing import IO, Any, Callable, Generic, Mapping, Optional, Sequence, Text, TypeVar, Union _FILE = Union[None, int, IO[Any]] _TXT = Union[bytes, Text] @@ -96,7 +96,7 @@ class Popen(Generic[_T]): def poll(self) -> int | None: ... def wait(self) -> int: ... # morally: -> Tuple[Optional[bytes], Optional[bytes]] - def communicate(self, input: _TXT | None = ...) -> Tuple[bytes, bytes]: ... + def communicate(self, input: _TXT | None = ...) -> tuple[bytes, bytes]: ... def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... diff --git a/stdlib/@python2/sunau.pyi b/stdlib/@python2/sunau.pyi index 3ee4b9651346..6d5caee7b199 100644 --- a/stdlib/@python2/sunau.pyi +++ b/stdlib/@python2/sunau.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, NoReturn, Text, Tuple, Union +from typing import IO, Any, NoReturn, Text, Union _File = Union[Text, IO[bytes]] @@ -19,7 +19,7 @@ AUDIO_FILE_ENCODING_ADPCM_G723_5: int AUDIO_FILE_ENCODING_ALAW_8: int AUDIO_UNKNOWN_SIZE: int -_sunau_params = Tuple[int, int, int, int, str, str] +_sunau_params = tuple[int, int, int, int, str, str] class Au_read: def __init__(self, f: _File) -> None: ... diff --git a/stdlib/@python2/symbol.pyi b/stdlib/@python2/symbol.pyi index a3561fe6b26f..052e3f1f8f42 100644 --- a/stdlib/@python2/symbol.pyi +++ b/stdlib/@python2/symbol.pyi @@ -1,5 +1,3 @@ -from typing import Dict - single_input: int file_input: int eval_input: int @@ -86,4 +84,4 @@ testlist1: int encoding_decl: int yield_expr: int -sym_name: Dict[int, str] +sym_name: dict[int, str] diff --git a/stdlib/@python2/symtable.pyi b/stdlib/@python2/symtable.pyi index bd3f25c7cb63..c0b701cc1df5 100644 --- a/stdlib/@python2/symtable.pyi +++ b/stdlib/@python2/symtable.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Sequence, Text, Tuple +from typing import Any, Sequence, Text def symtable(code: Text, filename: Text, compile_type: Text) -> SymbolTable: ... @@ -15,17 +15,17 @@ class SymbolTable(object): def has_import_star(self) -> bool: ... def get_identifiers(self) -> Sequence[str]: ... def lookup(self, name: str) -> Symbol: ... - def get_symbols(self) -> List[Symbol]: ... - def get_children(self) -> List[SymbolTable]: ... + def get_symbols(self) -> list[Symbol]: ... + def get_children(self) -> list[SymbolTable]: ... class Function(SymbolTable): - def get_parameters(self) -> Tuple[str, ...]: ... - def get_locals(self) -> Tuple[str, ...]: ... - def get_globals(self) -> Tuple[str, ...]: ... - def get_frees(self) -> Tuple[str, ...]: ... + def get_parameters(self) -> tuple[str, ...]: ... + def get_locals(self) -> tuple[str, ...]: ... + def get_globals(self) -> tuple[str, ...]: ... + def get_frees(self) -> tuple[str, ...]: ... class Class(SymbolTable): - def get_methods(self) -> Tuple[str, ...]: ... + def get_methods(self) -> tuple[str, ...]: ... class Symbol(object): def __init__(self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ...) -> None: ... diff --git a/stdlib/@python2/sys.pyi b/stdlib/@python2/sys.pyi index d4858ec251fa..409b776cdcb0 100644 --- a/stdlib/@python2/sys.pyi +++ b/stdlib/@python2/sys.pyi @@ -1,9 +1,9 @@ from types import ClassType, FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, NoReturn, Text, Tuple, Type, Union +from typing import IO, Any, Callable, NoReturn, Text, Union # The following type alias are stub-only and do not exist during runtime -_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] -_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]] +_ExcInfo = tuple[type[BaseException], BaseException, TracebackType] +_OptExcInfo = Union[_ExcInfo, tuple[None, None, None]] class _flags: bytes_warning: int @@ -36,17 +36,17 @@ class _float_info: radix: int rounds: int -class _version_info(Tuple[int, int, int, str, int]): +class _version_info(tuple[int, int, int, str, int]): major: int minor: int micro: int releaselevel: str serial: int -_mercurial: Tuple[str, str, str] +_mercurial: tuple[str, str, str] api_version: int -argv: List[str] -builtin_module_names: Tuple[str, ...] +argv: list[str] +builtin_module_names: tuple[str, ...] byteorder: str copyright: str dont_write_bytecode: bool @@ -59,8 +59,8 @@ long_info: object maxint: int maxsize: int maxunicode: int -modules: Dict[str, Any] -path: List[str] +modules: dict[str, Any] +path: list[str] platform: str prefix: str py3kwarning: bool @@ -70,7 +70,7 @@ __stdout__: IO[str] stderr: IO[str] stdin: IO[str] stdout: IO[str] -subversion: Tuple[str, str, str] +subversion: tuple[str, str, str] version: str warnoptions: object float_info: _float_info @@ -81,11 +81,11 @@ last_type: type last_value: BaseException last_traceback: TracebackType # TODO precise types -meta_path: List[Any] -path_hooks: List[Any] -path_importer_cache: Dict[str, Any] +meta_path: list[Any] +path_hooks: list[Any] +path_importer_cache: dict[str, Any] displayhook: Callable[[object], Any] -excepthook: Callable[[Type[BaseException], BaseException, TracebackType], Any] +excepthook: Callable[[type[BaseException], BaseException, TracebackType], Any] exc_type: type | None exc_value: BaseException | ClassType exc_traceback: TracebackType @@ -103,7 +103,7 @@ class _WindowsVersionType: def getwindowsversion() -> _WindowsVersionType: ... def _clear_type_cache() -> None: ... -def _current_frames() -> Dict[int, FrameType]: ... +def _current_frames() -> dict[int, FrameType]: ... def _getframe(depth: int = ...) -> FrameType: ... def call_tracing(fn: Any, args: Any) -> Any: ... def __displayhook__(value: object) -> None: ... diff --git a/stdlib/@python2/sysconfig.pyi b/stdlib/@python2/sysconfig.pyi index 2bef9e467bc9..17077144f6e9 100644 --- a/stdlib/@python2/sysconfig.pyi +++ b/stdlib/@python2/sysconfig.pyi @@ -1,17 +1,17 @@ -from typing import IO, Any, Dict, List, Tuple, overload +from typing import IO, Any, overload def get_config_var(name: str) -> str | None: ... @overload -def get_config_vars() -> Dict[str, Any]: ... +def get_config_vars() -> dict[str, Any]: ... @overload -def get_config_vars(arg: str, *args: str) -> List[Any]: ... -def get_scheme_names() -> Tuple[str, ...]: ... -def get_path_names() -> Tuple[str, ...]: ... -def get_path(name: str, scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> str: ... -def get_paths(scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> Dict[str, str]: ... +def get_config_vars(arg: str, *args: str) -> list[Any]: ... +def get_scheme_names() -> tuple[str, ...]: ... +def get_path_names() -> tuple[str, ...]: ... +def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> str: ... +def get_paths(scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... def is_python_build(check_home: bool = ...) -> bool: ... -def parse_config_h(fp: IO[Any], vars: Dict[str, Any] | None = ...) -> Dict[str, Any]: ... +def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = ...) -> dict[str, Any]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stdlib/@python2/tabnanny.pyi b/stdlib/@python2/tabnanny.pyi index 95873761ee75..cf6eefc2e15f 100644 --- a/stdlib/@python2/tabnanny.pyi +++ b/stdlib/@python2/tabnanny.pyi @@ -1,4 +1,4 @@ -from typing import Iterable, Text, Tuple +from typing import Iterable, Text verbose: int filename_only: int @@ -10,4 +10,4 @@ class NannyNag(Exception): def get_line(self) -> str: ... def check(file: Text) -> None: ... -def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ... +def process_tokens(tokens: Iterable[tuple[int, str, tuple[int, int], tuple[int, int], str]]) -> None: ... diff --git a/stdlib/@python2/tarfile.pyi b/stdlib/@python2/tarfile.pyi index c08c96b6f0d5..4f1efe5e4070 100644 --- a/stdlib/@python2/tarfile.pyi +++ b/stdlib/@python2/tarfile.pyi @@ -1,6 +1,6 @@ import io from types import TracebackType -from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Text, Tuple, Type +from typing import IO, Callable, Iterable, Iterator, Mapping, Text # tar constants NUL: bytes @@ -38,11 +38,11 @@ DEFAULT_FORMAT: int # tarfile constants -SUPPORTED_TYPES: Tuple[bytes, ...] -REGULAR_TYPES: Tuple[bytes, ...] -GNU_TYPES: Tuple[bytes, ...] -PAX_FIELDS: Tuple[str, ...] -PAX_NUMBER_FIELDS: Dict[str, type] +SUPPORTED_TYPES: tuple[bytes, ...] +REGULAR_TYPES: tuple[bytes, ...] +GNU_TYPES: tuple[bytes, ...] +PAX_FIELDS: tuple[str, ...] +PAX_NUMBER_FIELDS: dict[str, type] ENCODING: str @@ -56,7 +56,7 @@ def open( bufsize: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -76,12 +76,12 @@ class TarFile(Iterable[TarInfo]): mode: str fileobj: IO[bytes] | None format: int | None - tarinfo: Type[TarInfo] + tarinfo: type[TarInfo] dereference: bool | None ignore_zeros: bool | None encoding: str | None errors: str - fileobject: Type[ExFileObject] + fileobject: type[ExFileObject] pax_headers: Mapping[str, str] | None debug: int | None errorlevel: int | None @@ -93,7 +93,7 @@ class TarFile(Iterable[TarInfo]): mode: str = ..., fileobj: IO[bytes] | None = ..., format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -105,7 +105,7 @@ class TarFile(Iterable[TarInfo]): ) -> None: ... def __enter__(self) -> TarFile: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def __iter__(self) -> Iterator[TarInfo]: ... @classmethod @@ -117,7 +117,7 @@ class TarFile(Iterable[TarInfo]): bufsize: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -135,7 +135,7 @@ class TarFile(Iterable[TarInfo]): *, compresslevel: int = ..., format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -152,7 +152,7 @@ class TarFile(Iterable[TarInfo]): compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -169,7 +169,7 @@ class TarFile(Iterable[TarInfo]): compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -186,7 +186,7 @@ class TarFile(Iterable[TarInfo]): preset: int | None = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -195,8 +195,8 @@ class TarFile(Iterable[TarInfo]): errorlevel: int | None = ..., ) -> TarFile: ... def getmember(self, name: str) -> TarInfo: ... - def getmembers(self) -> List[TarInfo]: ... - def getnames(self) -> List[str]: ... + def getmembers(self) -> list[TarInfo]: ... + def getnames(self) -> list[str]: ... def list(self, verbose: bool = ...) -> None: ... def next(self) -> TarInfo | None: ... def extractall(self, path: Text = ..., members: Iterable[TarInfo] | None = ...) -> None: ... diff --git a/stdlib/@python2/telnetlib.pyi b/stdlib/@python2/telnetlib.pyi index dfb01f26398e..5cd47e28a95c 100644 --- a/stdlib/@python2/telnetlib.pyi +++ b/stdlib/@python2/telnetlib.pyi @@ -1,5 +1,5 @@ import socket -from typing import Any, Callable, Match, Pattern, Sequence, Tuple +from typing import Any, Callable, Match, Pattern, Sequence DEBUGLEVEL: int TELNET_PORT: int @@ -108,4 +108,4 @@ class Telnet: def listener(self) -> None: ... def expect( self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... - ) -> Tuple[int, Match[bytes] | None, bytes]: ... + ) -> tuple[int, Match[bytes] | None, bytes]: ... diff --git a/stdlib/@python2/tempfile.pyi b/stdlib/@python2/tempfile.pyi index c5f67d243ac8..25397d130165 100644 --- a/stdlib/@python2/tempfile.pyi +++ b/stdlib/@python2/tempfile.pyi @@ -1,6 +1,6 @@ from random import Random from thread import LockType -from typing import IO, Any, AnyStr, Iterable, Iterator, List, Text, Tuple, overload +from typing import IO, Any, AnyStr, Iterable, Iterator, Text, overload TMP_MAX: int tempdir: str @@ -39,7 +39,7 @@ class _TemporaryFileWrapper(IO[str]): def read(self, n: int = ...) -> str: ... def readable(self) -> bool: ... def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... + def readlines(self, hint: int = ...) -> list[str]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... @@ -82,9 +82,9 @@ class TemporaryDirectory: def __exit__(self, type, value, traceback) -> None: ... @overload -def mkstemp() -> Tuple[int, str]: ... +def mkstemp() -> tuple[int, str]: ... @overload -def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ..., text: bool = ...) -> Tuple[int, AnyStr]: ... +def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ..., text: bool = ...) -> tuple[int, AnyStr]: ... @overload def mkdtemp() -> str: ... @overload @@ -95,6 +95,6 @@ def mktemp() -> str: ... def mktemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ...) -> AnyStr: ... def gettempdir() -> str: ... def gettempprefix() -> str: ... -def _candidate_tempdir_list() -> List[str]: ... +def _candidate_tempdir_list() -> list[str]: ... def _get_candidate_names() -> _RandomNameSequence | None: ... def _get_default_tempdir() -> str: ... diff --git a/stdlib/@python2/termios.pyi b/stdlib/@python2/termios.pyi index cee6b85f9ba5..7142df15715d 100644 --- a/stdlib/@python2/termios.pyi +++ b/stdlib/@python2/termios.pyi @@ -1,9 +1,9 @@ import sys from _typeshed import FileDescriptorLike -from typing import Any, List, Union +from typing import Any, Union if sys.platform != "win32": - _Attr = List[Union[int, List[Union[bytes, int]]]] + _Attr = list[Union[int, list[Union[bytes, int]]]] # TODO constants not really documented B0: int @@ -237,7 +237,7 @@ if sys.platform != "win32": VWERASE: int XCASE: int XTABS: int - def tcgetattr(__fd: FileDescriptorLike) -> List[Any]: ... + def tcgetattr(__fd: FileDescriptorLike) -> list[Any]: ... def tcsetattr(__fd: FileDescriptorLike, __when: int, __attributes: _Attr) -> None: ... def tcsendbreak(__fd: FileDescriptorLike, __duration: int) -> None: ... def tcdrain(__fd: FileDescriptorLike) -> None: ... diff --git a/stdlib/@python2/textwrap.pyi b/stdlib/@python2/textwrap.pyi index c4147b4bd538..cb9c034cc4ba 100644 --- a/stdlib/@python2/textwrap.pyi +++ b/stdlib/@python2/textwrap.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, Dict, List, Pattern +from typing import AnyStr, Pattern class TextWrapper(object): width: int = ... @@ -16,7 +16,7 @@ class TextWrapper(object): wordsep_re: Pattern[str] = ... wordsep_simple_re: Pattern[str] = ... whitespace_trans: str = ... - unicode_whitespace_trans: Dict[int, int] = ... + unicode_whitespace_trans: dict[int, int] = ... uspace: int = ... x: int = ... def __init__( @@ -31,7 +31,7 @@ class TextWrapper(object): drop_whitespace: bool = ..., break_on_hyphens: bool = ..., ) -> None: ... - def wrap(self, text: AnyStr) -> List[AnyStr]: ... + def wrap(self, text: AnyStr) -> list[AnyStr]: ... def fill(self, text: AnyStr) -> AnyStr: ... def wrap( @@ -45,7 +45,7 @@ def wrap( break_long_words: bool = ..., drop_whitespace: bool = ..., break_on_hyphens: bool = ..., -) -> List[AnyStr]: ... +) -> list[AnyStr]: ... def fill( text: AnyStr, width: int = ..., diff --git a/stdlib/@python2/this.pyi b/stdlib/@python2/this.pyi index 0687a6675cca..8de996b04aec 100644 --- a/stdlib/@python2/this.pyi +++ b/stdlib/@python2/this.pyi @@ -1,4 +1,2 @@ -from typing import Dict - s: str -d: Dict[str, str] +d: dict[str, str] diff --git a/stdlib/@python2/threading.pyi b/stdlib/@python2/threading.pyi index dac7e414d293..5f66360bff6c 100644 --- a/stdlib/@python2/threading.pyi +++ b/stdlib/@python2/threading.pyi @@ -1,18 +1,18 @@ from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar +from typing import Any, Callable, Iterable, Mapping, Optional, Text, TypeVar # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] -__all__: List[str] +__all__: list[str] def active_count() -> int: ... def activeCount() -> int: ... def current_thread() -> Thread: ... def currentThread() -> Thread: ... -def enumerate() -> List[Thread]: ... +def enumerate() -> list[Thread]: ... def settrace(func: _TF) -> None: ... def setprofile(func: _PF | None) -> None: ... def stack_size(size: int = ...) -> int: ... @@ -52,7 +52,7 @@ class Lock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -62,7 +62,7 @@ class _RLock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -73,7 +73,7 @@ class Condition: def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... @@ -85,7 +85,7 @@ class Condition: class Semaphore: def __init__(self, value: int = ...) -> None: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ...) -> bool: ... def __enter__(self, blocking: bool = ...) -> bool: ... diff --git a/stdlib/@python2/time.pyi b/stdlib/@python2/time.pyi index 48ae9da9c65e..cbe5d63017b0 100644 --- a/stdlib/@python2/time.pyi +++ b/stdlib/@python2/time.pyi @@ -1,13 +1,13 @@ import sys -from typing import Any, NamedTuple, Tuple +from typing import Any, NamedTuple -_TimeTuple = Tuple[int, int, int, int, int, int, int, int, int] +_TimeTuple = tuple[int, int, int, int, int, int, int, int, int] accept2dyear: bool altzone: int daylight: int timezone: int -tzname: Tuple[str, str] +tzname: tuple[str, str] class _struct_time(NamedTuple): tm_year: int diff --git a/stdlib/@python2/timeit.pyi b/stdlib/@python2/timeit.pyi index ecb528725a9c..3a7f6e0e0841 100644 --- a/stdlib/@python2/timeit.pyi +++ b/stdlib/@python2/timeit.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, List, Sequence, Text, Union +from typing import IO, Any, Callable, Sequence, Text, Union _str = Union[str, Text] _Timer = Callable[[], float] @@ -10,10 +10,10 @@ class Timer: def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ... def print_exc(self, file: IO[str] | None = ...) -> None: ... def timeit(self, number: int = ...) -> float: ... - def repeat(self, repeat: int = ..., number: int = ...) -> List[float]: ... + def repeat(self, repeat: int = ..., number: int = ...) -> list[float]: ... def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ...) -> float: ... -def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...) -> List[float]: ... +def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...) -> list[float]: ... _timerFunc = Callable[[], float] diff --git a/stdlib/@python2/toaiff.pyi b/stdlib/@python2/toaiff.pyi index b70e026d6d8e..d4b86f9bb756 100644 --- a/stdlib/@python2/toaiff.pyi +++ b/stdlib/@python2/toaiff.pyi @@ -1,11 +1,10 @@ from pipes import Template -from typing import Dict, List -table: Dict[str, Template] +table: dict[str, Template] t: Template uncompress: Template class error(Exception): ... def toaiff(filename: str) -> str: ... -def _toaiff(filename: str, temps: List[str]) -> str: ... +def _toaiff(filename: str, temps: list[str]) -> str: ... diff --git a/stdlib/@python2/token.pyi b/stdlib/@python2/token.pyi index 4ba710470624..d88aba8678a0 100644 --- a/stdlib/@python2/token.pyi +++ b/stdlib/@python2/token.pyi @@ -1,5 +1,3 @@ -from typing import Dict - ENDMARKER: int NAME: int NUMBER: int @@ -55,7 +53,7 @@ OP: int ERRORTOKEN: int N_TOKENS: int NT_OFFSET: int -tok_name: Dict[int, str] +tok_name: dict[int, str] def ISTERMINAL(x: int) -> bool: ... def ISNONTERMINAL(x: int) -> bool: ... diff --git a/stdlib/@python2/tokenize.pyi b/stdlib/@python2/tokenize.pyi index 98ec01a6cb75..f045f76cc39e 100644 --- a/stdlib/@python2/tokenize.pyi +++ b/stdlib/@python2/tokenize.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Tuple +from typing import Any, Callable, Generator, Iterable, Iterator __author__: str __credits__: str @@ -97,27 +97,27 @@ VBAREQUAL: int Whitespace: str chain: type double3prog: type -endprogs: Dict[str, Any] +endprogs: dict[str, Any] pseudoprog: type single3prog: type -single_quoted: Dict[str, str] +single_quoted: dict[str, str] t: str tabsize: int -tok_name: Dict[int, str] +tok_name: dict[int, str] tokenprog: type -triple_quoted: Dict[str, str] +triple_quoted: dict[str, str] x: str -_Pos = Tuple[int, int] -_TokenType = Tuple[int, str, _Pos, _Pos, str] +_Pos = tuple[int, int] +_TokenType = tuple[int, str, _Pos, _Pos, str] def any(*args, **kwargs) -> str: ... def generate_tokens(readline: Callable[[], str]) -> Generator[_TokenType, None, None]: ... def group(*args: str) -> str: ... def maybe(*args: str) -> str: ... def printtoken(type: int, token: str, srow_scol: _Pos, erow_ecol: _Pos, line: str) -> None: ... -def tokenize(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... -def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... +def tokenize(readline: Callable[[], str], tokeneater: Callable[[tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... +def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... def untokenize(iterable: Iterable[_TokenType]) -> str: ... class StopTokenizing(Exception): ... @@ -126,8 +126,8 @@ class TokenError(Exception): ... class Untokenizer: prev_col: int prev_row: int - tokens: List[str] + tokens: list[str] def __init__(self) -> None: ... def add_whitespace(self, _Pos) -> None: ... - def compat(self, token: Tuple[int, Any], iterable: Iterator[_TokenType]) -> None: ... + def compat(self, token: tuple[int, Any], iterable: Iterator[_TokenType]) -> None: ... def untokenize(self, iterable: Iterable[_TokenType]) -> str: ... diff --git a/stdlib/@python2/trace.pyi b/stdlib/@python2/trace.pyi index 62f228673a55..82777cd6a5ea 100644 --- a/stdlib/@python2/trace.pyi +++ b/stdlib/@python2/trace.pyi @@ -1,25 +1,25 @@ import types from _typeshed import StrPath -from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, TypeVar +from typing import Any, Callable, Mapping, Optional, Sequence, TypeVar _T = TypeVar("_T") _localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] -_fileModuleFunction = Tuple[str, Optional[str], str] +_fileModuleFunction = tuple[str, Optional[str], str] class CoverageResults: def __init__( self, - counts: Dict[Tuple[str, int], int] | None = ..., - calledfuncs: Dict[_fileModuleFunction, int] | None = ..., + counts: dict[tuple[str, int], int] | None = ..., + calledfuncs: dict[_fileModuleFunction, int] | None = ..., infile: StrPath | None = ..., - callers: Dict[Tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., + callers: dict[tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., outfile: StrPath | None = ..., ) -> None: ... # undocumented def update(self, other: CoverageResults) -> None: ... def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: StrPath | None = ...) -> None: ... def write_results_file( self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = ... - ) -> Tuple[int, int]: ... + ) -> tuple[int, int]: ... class Trace: def __init__( diff --git a/stdlib/@python2/traceback.pyi b/stdlib/@python2/traceback.pyi index 2152ab255942..94c75e5ef6b1 100644 --- a/stdlib/@python2/traceback.pyi +++ b/stdlib/@python2/traceback.pyi @@ -1,11 +1,11 @@ from types import FrameType, TracebackType -from typing import IO, List, Optional, Tuple, Type +from typing import IO, Optional -_PT = Tuple[str, int, str, Optional[str]] +_PT = tuple[str, int, str, Optional[str]] def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ... def print_exception( - etype: Type[BaseException] | None, + etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, limit: int | None = ..., @@ -14,14 +14,14 @@ def print_exception( def print_exc(limit: int | None = ..., file: IO[str] | None = ...) -> None: ... def print_last(limit: int | None = ..., file: IO[str] | None = ...) -> None: ... def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ... -def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> List[_PT]: ... -def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[_PT]: ... -def format_list(extracted_list: List[_PT]) -> List[str]: ... -def format_exception_only(etype: Type[BaseException] | None, value: BaseException | None) -> List[str]: ... +def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> list[_PT]: ... +def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> list[_PT]: ... +def format_list(extracted_list: list[_PT]) -> list[str]: ... +def format_exception_only(etype: type[BaseException] | None, value: BaseException | None) -> list[str]: ... def format_exception( - etype: Type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, limit: int | None = ... -) -> List[str]: ... + etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, limit: int | None = ... +) -> list[str]: ... def format_exc(limit: int | None = ...) -> str: ... -def format_tb(tb: TracebackType | None, limit: int | None = ...) -> List[str]: ... -def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[str]: ... +def format_tb(tb: TracebackType | None, limit: int | None = ...) -> list[str]: ... +def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> list[str]: ... def tb_lineno(tb: TracebackType) -> int: ... diff --git a/stdlib/@python2/turtle.pyi b/stdlib/@python2/turtle.pyi index 4cc5ea8d3c14..cb52479864a2 100644 --- a/stdlib/@python2/turtle.pyi +++ b/stdlib/@python2/turtle.pyi @@ -1,5 +1,5 @@ from _typeshed import Self -from typing import Any, Callable, Dict, List, Sequence, Text, Tuple, Union, overload +from typing import Any, Callable, Sequence, Text, Union, overload # TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module. Canvas = Any @@ -9,18 +9,18 @@ PhotoImage = Any # alias we use for return types. Really, these two aliases should be the # same, but as per the "no union returns" typeshed policy, we'll return # Any instead. -_Color = Union[Text, Tuple[float, float, float]] +_Color = Union[Text, tuple[float, float, float]] _AnyColor = Any # TODO: Replace this with a TypedDict once it becomes standardized. -_PenState = Dict[str, Any] +_PenState = dict[str, Any] _Speed = Union[str, float] -_PolygonCoords = Sequence[Tuple[float, float]] +_PolygonCoords = Sequence[tuple[float, float]] # TODO: Type this more accurately # Vec2D is actually a custom subclass of 'tuple'. -Vec2D = Tuple[float, float] +Vec2D = tuple[float, float] class TurtleScreenBase(object): cv: Canvas = ... @@ -51,7 +51,7 @@ class TurtleScreen(TurtleScreenBase): @overload def colormode(self, cmode: float) -> None: ... def reset(self) -> None: ... - def turtles(self) -> List[Turtle]: ... + def turtles(self) -> list[Turtle]: ... @overload def bgcolor(self) -> _AnyColor: ... @overload @@ -70,7 +70,7 @@ class TurtleScreen(TurtleScreenBase): def window_width(self) -> int: ... def window_height(self) -> int: ... def getcanvas(self) -> Canvas: ... - def getshapes(self) -> List[str]: ... + def getshapes(self) -> list[str]: ... def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... def onkey(self, fun: Callable[[], Any], key: str) -> None: ... def listen(self, xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... @@ -80,7 +80,7 @@ class TurtleScreen(TurtleScreenBase): @overload def bgpic(self, picname: str) -> None: ... @overload - def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... + def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> tuple[int, int]: ... # Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well @overload def screensize(self, canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... @@ -90,7 +90,7 @@ class TurtleScreen(TurtleScreenBase): addshape = register_shape class TNavigator(object): - START_ORIENTATION: Dict[str, Vec2D] = ... + START_ORIENTATION: dict[str, Vec2D] = ... DEFAULT_MODE: str = ... DEFAULT_ANGLEOFFSET: int = ... DEFAULT_ANGLEORIENT: int = ... @@ -106,18 +106,18 @@ class TNavigator(object): def xcor(self) -> float: ... def ycor(self) -> float: ... @overload - def goto(self, x: Tuple[float, float], y: None = ...) -> None: ... + def goto(self, x: tuple[float, float], y: None = ...) -> None: ... @overload def goto(self, x: float, y: float) -> None: ... def home(self) -> None: ... def setx(self, x: float) -> None: ... def sety(self, y: float) -> None: ... @overload - def distance(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... + def distance(self, x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def distance(self, x: float, y: float) -> float: ... @overload - def towards(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... + def towards(self, x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def towards(self, x: float, y: float) -> float: ... def heading(self) -> float: ... @@ -163,7 +163,7 @@ class TPen(object): @overload def fillcolor(self, r: float, g: float, b: float) -> None: ... @overload - def color(self) -> Tuple[_AnyColor, _AnyColor]: ... + def color(self) -> tuple[_AnyColor, _AnyColor]: ... @overload def color(self, color: _Color) -> None: ... @overload @@ -188,7 +188,7 @@ class TPen(object): pensize: int = ..., speed: int = ..., resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., + stretchfactor: tuple[float, float] = ..., outline: int = ..., tilt: float = ..., ) -> None: ... @@ -215,7 +215,7 @@ class RawTurtle(TPen, TNavigator): def shape(self, name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload - def shapesize(self) -> Tuple[float, float, float]: ... # type: ignore + def shapesize(self) -> tuple[float, float, float]: ... # type: ignore @overload def shapesize( self, stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ... @@ -230,13 +230,13 @@ class RawTurtle(TPen, TNavigator): # a compound stamp or not. So, as per the "no Union return" policy, # we return Any. def stamp(self) -> Any: ... - def clearstamp(self, stampid: int | Tuple[int, ...]) -> None: ... + def clearstamp(self, stampid: int | tuple[int, ...]) -> None: ... def clearstamps(self, n: int | None = ...) -> None: ... def filling(self) -> bool: ... def begin_fill(self) -> None: ... def end_fill(self) -> None: ... def dot(self, size: int | None = ..., *color: _Color) -> None: ... - def write(self, arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... + def write(self, arg: object, move: bool = ..., align: str = ..., font: tuple[str, int, str] = ...) -> None: ... def begin_poly(self) -> None: ... def end_poly(self) -> None: ... def get_poly(self) -> _PolygonCoords | None: ... @@ -296,7 +296,7 @@ def colormode(cmode: None = ...) -> float: ... @overload def colormode(cmode: float) -> None: ... def reset() -> None: ... -def turtles() -> List[Turtle]: ... +def turtles() -> list[Turtle]: ... @overload def bgcolor() -> _AnyColor: ... @overload @@ -315,7 +315,7 @@ def update() -> None: ... def window_width() -> int: ... def window_height() -> int: ... def getcanvas() -> Canvas: ... -def getshapes() -> List[str]: ... +def getshapes() -> list[str]: ... def onclick(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... def onkey(fun: Callable[[], Any], key: str) -> None: ... def listen(xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... @@ -325,7 +325,7 @@ def bgpic(picname: None = ...) -> str: ... @overload def bgpic(picname: str) -> None: ... @overload -def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... +def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> tuple[int, int]: ... @overload def screensize(canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... @@ -353,18 +353,18 @@ def pos() -> Vec2D: ... def xcor() -> float: ... def ycor() -> float: ... @overload -def goto(x: Tuple[float, float], y: None = ...) -> None: ... +def goto(x: tuple[float, float], y: None = ...) -> None: ... @overload def goto(x: float, y: float) -> None: ... def home() -> None: ... def setx(x: float) -> None: ... def sety(y: float) -> None: ... @overload -def distance(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... +def distance(x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def distance(x: float, y: float) -> float: ... @overload -def towards(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... +def towards(x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def towards(x: float, y: float) -> float: ... def heading() -> float: ... @@ -410,7 +410,7 @@ def fillcolor(color: _Color) -> None: ... @overload def fillcolor(r: float, g: float, b: float) -> None: ... @overload -def color() -> Tuple[_AnyColor, _AnyColor]: ... +def color() -> tuple[_AnyColor, _AnyColor]: ... @overload def color(color: _Color) -> None: ... @overload @@ -435,7 +435,7 @@ def pen( pensize: int = ..., speed: int = ..., resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., + stretchfactor: tuple[float, float] = ..., outline: int = ..., tilt: float = ..., ) -> None: ... @@ -459,7 +459,7 @@ def shape(name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload -def shapesize() -> Tuple[float, float, float]: ... # type: ignore +def shapesize() -> tuple[float, float, float]: ... # type: ignore @overload def shapesize(stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...) -> None: ... def settiltangle(angle: float) -> None: ... @@ -473,13 +473,13 @@ def tilt(angle: float) -> None: ... # a compound stamp or not. So, as per the "no Union return" policy, # we return Any. def stamp() -> Any: ... -def clearstamp(stampid: int | Tuple[int, ...]) -> None: ... +def clearstamp(stampid: int | tuple[int, ...]) -> None: ... def clearstamps(n: int | None = ...) -> None: ... def filling() -> bool: ... def begin_fill() -> None: ... def end_fill() -> None: ... def dot(size: int | None = ..., *color: _Color) -> None: ... -def write(arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... +def write(arg: object, move: bool = ..., align: str = ..., font: tuple[str, int, str] = ...) -> None: ... def begin_poly() -> None: ... def end_poly() -> None: ... def get_poly() -> _PolygonCoords | None: ... diff --git a/stdlib/@python2/types.pyi b/stdlib/@python2/types.pyi index 0feee4530586..d2194296aa17 100644 --- a/stdlib/@python2/types.pyi +++ b/stdlib/@python2/types.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, List, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Iterable, Iterator, TypeVar, overload _T = TypeVar("_T") @@ -16,7 +16,7 @@ BooleanType = bool ComplexType = complex StringType = str UnicodeType = unicode -StringTypes: Tuple[Type[StringType], Type[UnicodeType]] +StringTypes: tuple[type[StringType], type[UnicodeType]] BufferType = buffer TupleType = tuple ListType = list @@ -27,12 +27,12 @@ class _Cell: cell_contents: Any class FunctionType: - func_closure: Tuple[_Cell, ...] | None = ... + func_closure: tuple[_Cell, ...] | None = ... func_code: CodeType = ... - func_defaults: Tuple[Any, ...] | None = ... - func_dict: Dict[str, Any] = ... + func_defaults: tuple[Any, ...] | None = ... + func_dict: dict[str, Any] = ... func_doc: str | None = ... - func_globals: Dict[str, Any] = ... + func_globals: dict[str, Any] = ... func_name: str = ... __closure__ = func_closure __code__ = func_code @@ -43,10 +43,10 @@ class FunctionType: def __init__( self, code: CodeType, - globals: Dict[str, Any], + globals: dict[str, Any], name: str | None = ..., - argdefs: Tuple[object, ...] | None = ..., - closure: Tuple[_Cell, ...] | None = ..., + argdefs: tuple[object, ...] | None = ..., + closure: tuple[_Cell, ...] | None = ..., ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __get__(self, obj: object | None, type: type | None) -> UnboundMethodType: ... @@ -55,19 +55,19 @@ LambdaType = FunctionType class CodeType: co_argcount: int - co_cellvars: Tuple[str, ...] + co_cellvars: tuple[str, ...] co_code: str - co_consts: Tuple[Any, ...] + co_consts: tuple[Any, ...] co_filename: str co_firstlineno: int co_flags: int - co_freevars: Tuple[str, ...] + co_freevars: tuple[str, ...] co_lnotab: str co_name: str - co_names: Tuple[str, ...] + co_names: tuple[str, ...] co_nlocals: int co_stacksize: int - co_varnames: Tuple[str, ...] + co_varnames: tuple[str, ...] def __init__( self, argcount: int, @@ -75,15 +75,15 @@ class CodeType: stacksize: int, flags: int, codestring: str, - constants: Tuple[Any, ...], - names: Tuple[str, ...], - varnames: Tuple[str, ...], + constants: tuple[Any, ...], + names: tuple[str, ...], + varnames: tuple[str, ...], filename: str, name: str, firstlineno: int, lnotab: str, - freevars: Tuple[str, ...] = ..., - cellvars: Tuple[str, ...] = ..., + freevars: tuple[str, ...] = ..., + cellvars: tuple[str, ...] = ..., ) -> None: ... class GeneratorType: @@ -95,7 +95,7 @@ class GeneratorType: def next(self) -> Any: ... def send(self, __arg: Any) -> Any: ... @overload - def throw(self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...) -> Any: ... + def throw(self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...) -> Any: ... @overload def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Any: ... @@ -127,7 +127,7 @@ class ModuleType: __name__: str __package__: str | None __path__: Iterable[str] | None - __dict__: Dict[str, Any] + __dict__: dict[str, Any] def __init__(self, name: str, doc: str | None = ...) -> None: ... FileType = file @@ -141,15 +141,15 @@ class TracebackType: class FrameType: f_back: FrameType - f_builtins: Dict[str, Any] + f_builtins: dict[str, Any] f_code: CodeType f_exc_type: None f_exc_value: None f_exc_traceback: None - f_globals: Dict[str, Any] + f_globals: dict[str, Any] f_lasti: int f_lineno: int | None - f_locals: Dict[str, Any] + f_locals: dict[str, Any] f_restricted: bool f_trace: Callable[[], None] def clear(self) -> None: ... @@ -161,15 +161,15 @@ class EllipsisType: ... class DictProxyType: # TODO is it possible to have non-string keys? # no __init__ - def copy(self) -> Dict[Any, Any]: ... + def copy(self) -> dict[Any, Any]: ... def get(self, key: str, default: _T = ...) -> Any | _T: ... def has_key(self, key: str) -> bool: ... - def items(self) -> List[Tuple[str, Any]]: ... - def iteritems(self) -> Iterator[Tuple[str, Any]]: ... + def items(self) -> list[tuple[str, Any]]: ... + def iteritems(self) -> Iterator[tuple[str, Any]]: ... def iterkeys(self) -> Iterator[str]: ... def itervalues(self) -> Iterator[Any]: ... - def keys(self) -> List[str]: ... - def values(self) -> List[Any]: ... + def keys(self) -> list[str]: ... + def values(self) -> list[Any]: ... def __contains__(self, key: str) -> bool: ... def __getitem__(self, key: str) -> Any: ... def __iter__(self) -> Iterator[str]: ... diff --git a/stdlib/@python2/typing_extensions.pyi b/stdlib/@python2/typing_extensions.pyi index c9916e2a58f6..245463896f26 100644 --- a/stdlib/@python2/typing_extensions.pyi +++ b/stdlib/@python2/typing_extensions.pyi @@ -1,6 +1,6 @@ import abc from _typeshed import Self -from typing import ( +from typing import ( # noqa Y022 TYPE_CHECKING as TYPE_CHECKING, Any, Callable, @@ -9,14 +9,12 @@ from typing import ( Counter as Counter, DefaultDict as DefaultDict, Deque as Deque, - Dict, ItemsView, KeysView, Mapping, NewType as NewType, NoReturn as NoReturn, Text as Text, - Tuple, Type as Type, TypeVar, ValuesView, @@ -26,7 +24,7 @@ from typing import ( _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., Any]) -_TC = TypeVar("_TC", bound=Type[object]) +_TC = TypeVar("_TC", bound=type[object]) class _SpecialForm: def __getitem__(self, typeargs: Any) -> Any: ... @@ -66,10 +64,10 @@ OrderedDict = _Alias() def get_type_hints( obj: Callable[..., Any], - globalns: Dict[str, Any] | None = ..., - localns: Dict[str, Any] | None = ..., + globalns: dict[str, Any] | None = ..., + localns: dict[str, Any] | None = ..., include_extras: bool = ..., -) -> Dict[str, Any]: ... +) -> dict[str, Any]: ... Annotated: _SpecialForm = ... _AnnotatedAlias: Any = ... # undocumented @@ -90,11 +88,11 @@ class ParamSpecKwargs: class ParamSpec: __name__: str - __bound__: Type[Any] | None + __bound__: type[Any] | None __covariant__: bool __contravariant__: bool def __init__( - self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ... + self, name: str, *, bound: None | type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ... ) -> None: ... @property def args(self) -> ParamSpecArgs: ... diff --git a/stdlib/@python2/unittest.pyi b/stdlib/@python2/unittest.pyi index 65a5a7878de6..d5ca2de7e9b1 100644 --- a/stdlib/@python2/unittest.pyi +++ b/stdlib/@python2/unittest.pyi @@ -1,35 +1,15 @@ import datetime import types from abc import ABCMeta, abstractmethod -from typing import ( - Any, - Callable, - Dict, - FrozenSet, - Iterable, - Iterator, - List, - Mapping, - NoReturn, - Pattern, - Sequence, - Set, - Text, - TextIO, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import Any, Callable, Iterable, Iterator, Mapping, NoReturn, Pattern, Sequence, Text, TextIO, TypeVar, Union, overload _T = TypeVar("_T") _FT = TypeVar("_FT") -_ExceptionType = Union[Type[BaseException], Tuple[Type[BaseException], ...]] +_ExceptionType = Union[type[BaseException], tuple[type[BaseException], ...]] _Regexp = Union[Text, Pattern[Text]] -_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None]] +_SysExcInfoType = Union[tuple[type[BaseException], BaseException, types.TracebackType], tuple[None, None, None]] class Testable(metaclass=ABCMeta): @abstractmethod @@ -42,11 +22,11 @@ class Testable(metaclass=ABCMeta): # TODO ABC for test runners? class TestResult: - errors: List[Tuple[TestCase, str]] - failures: List[Tuple[TestCase, str]] - skipped: List[Tuple[TestCase, str]] - expectedFailures: List[Tuple[TestCase, str]] - unexpectedSuccesses: List[TestCase] + errors: list[tuple[TestCase, str]] + failures: list[tuple[TestCase, str]] + skipped: list[tuple[TestCase, str]] + expectedFailures: list[tuple[TestCase, str]] + unexpectedSuccesses: list[TestCase] shouldStop: bool testsRun: int buffer: bool @@ -66,7 +46,7 @@ class TestResult: class _AssertRaisesBaseContext: expected: Any - failureException: Type[BaseException] + failureException: type[BaseException] obj_name: str expected_regex: Pattern[str] @@ -76,7 +56,7 @@ class _AssertRaisesContext(_AssertRaisesBaseContext): def __exit__(self, exc_type, exc_value, tb) -> bool: ... class TestCase(Testable): - failureException: Type[BaseException] + failureException: type[BaseException] longMessage: bool maxDiff: int | None # undocumented @@ -141,10 +121,10 @@ class TestCase(Testable): def assertSequenceEqual( self, first: Sequence[Any], second: Sequence[Any], msg: object = ..., seq_type: type = ... ) -> None: ... - def assertListEqual(self, first: List[Any], second: List[Any], msg: object = ...) -> None: ... - def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: object = ...) -> None: ... - def assertSetEqual(self, first: Set[Any] | FrozenSet[Any], second: Set[Any] | FrozenSet[Any], msg: object = ...) -> None: ... - def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: object = ...) -> None: ... + def assertListEqual(self, first: list[Any], second: list[Any], msg: object = ...) -> None: ... + def assertTupleEqual(self, first: tuple[Any, ...], second: tuple[Any, ...], msg: object = ...) -> None: ... + def assertSetEqual(self, first: set[Any] | frozenset[Any], second: set[Any] | frozenset[Any], msg: object = ...) -> None: ... + def assertDictEqual(self, first: dict[Any, Any], second: dict[Any, Any], msg: object = ...) -> None: ... def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertLessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... @overload @@ -174,8 +154,8 @@ class TestCase(Testable): def assertIsNotNone(self, expr: Any, msg: object = ...) -> None: ... def assertIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... def assertNotIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... - def assertIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: object = ...) -> None: ... - def assertNotIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: object = ...) -> None: ... + def assertIsInstance(self, obj: Any, cls: type | tuple[type, ...], msg: object = ...) -> None: ... + def assertNotIsInstance(self, obj: Any, cls: type | tuple[type, ...], msg: object = ...) -> None: ... def fail(self, msg: object = ...) -> NoReturn: ... def countTestCases(self) -> int: ... def defaultTestResult(self) -> TestResult: ... @@ -210,13 +190,13 @@ class TestSuite(Testable): class TestLoader: testMethodPrefix: str sortTestMethodsUsing: Callable[[str, str], int] | None - suiteClass: Callable[[List[TestCase]], TestSuite] - def loadTestsFromTestCase(self, testCaseClass: Type[TestCase]) -> TestSuite: ... + suiteClass: Callable[[list[TestCase]], TestSuite] + def loadTestsFromTestCase(self, testCaseClass: type[TestCase]) -> TestSuite: ... def loadTestsFromModule(self, module: types.ModuleType = ..., use_load_tests: bool = ...) -> TestSuite: ... def loadTestsFromName(self, name: str = ..., module: types.ModuleType | None = ...) -> TestSuite: ... - def loadTestsFromNames(self, names: List[str] = ..., module: types.ModuleType | None = ...) -> TestSuite: ... + def loadTestsFromNames(self, names: list[str] = ..., module: types.ModuleType | None = ...) -> TestSuite: ... def discover(self, start_dir: str, pattern: str = ..., top_level_dir: str | None = ...) -> TestSuite: ... - def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ... + def getTestCaseNames(self, testCaseClass: type[TestCase] = ...) -> list[str]: ... defaultTestLoader: TestLoader @@ -224,7 +204,7 @@ class TextTestResult(TestResult): def __init__(self, stream: TextIO, descriptions: bool, verbosity: int) -> None: ... def getDescription(self, test: TestCase) -> str: ... # undocumented def printErrors(self) -> None: ... # undocumented - def printErrorList(self, flavour: str, errors: List[Tuple[TestCase, str]]) -> None: ... # undocumented + def printErrorList(self, flavour: str, errors: list[tuple[TestCase, str]]) -> None: ... # undocumented class TextTestRunner: def __init__( @@ -234,7 +214,7 @@ class TextTestRunner: verbosity: int = ..., failfast: bool = ..., buffer: bool = ..., - resultclass: Type[TestResult] | None = ..., + resultclass: type[TestResult] | None = ..., ) -> None: ... def _makeResult(self) -> TestResult: ... def run(self, test: Testable) -> TestResult: ... # undocumented @@ -256,7 +236,7 @@ def main( module: None | Text | types.ModuleType = ..., defaultTest: str | None = ..., argv: Sequence[str] | None = ..., - testRunner: Type[TextTestRunner] | TextTestRunner | None = ..., + testRunner: type[TextTestRunner] | TextTestRunner | None = ..., testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ..., diff --git a/stdlib/@python2/urllib.pyi b/stdlib/@python2/urllib.pyi index 538194d89911..56a75af74bb3 100644 --- a/stdlib/@python2/urllib.pyi +++ b/stdlib/@python2/urllib.pyi @@ -1,5 +1,5 @@ from _typeshed import Self -from typing import IO, Any, AnyStr, List, Mapping, Sequence, Text, Tuple +from typing import IO, Any, AnyStr, Mapping, Sequence, Text def url2pathname(pathname: AnyStr) -> AnyStr: ... def pathname2url(pathname: AnyStr) -> AnyStr: ... @@ -82,7 +82,7 @@ class addbase: fp: Any def read(self, n: int = ...) -> bytes: ... def readline(self, limit: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... def fileno(self) -> int: ... # Optional[int], but that is rare def __iter__(self: Self) -> Self: ... def next(self) -> bytes: ... @@ -124,7 +124,7 @@ def unquote(s: AnyStr) -> AnyStr: ... def unquote_plus(s: AnyStr) -> AnyStr: ... def quote(s: AnyStr, safe: Text = ...) -> AnyStr: ... def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ... -def urlencode(query: Sequence[Tuple[Any, Any]] | Mapping[Any, Any], doseq=...) -> str: ... +def urlencode(query: Sequence[tuple[Any, Any]] | Mapping[Any, Any], doseq=...) -> str: ... def getproxies() -> Mapping[str, str]: ... def proxy_bypass(host: str) -> Any: ... # undocumented diff --git a/stdlib/@python2/urllib2.pyi b/stdlib/@python2/urllib2.pyi index bf6157b8428b..990384ebdcd1 100644 --- a/stdlib/@python2/urllib2.pyi +++ b/stdlib/@python2/urllib2.pyi @@ -1,6 +1,6 @@ import ssl from httplib import HTTPConnectionProtocol, HTTPResponse -from typing import Any, AnyStr, Callable, Dict, List, Mapping, Sequence, Text, Tuple, Type, Union +from typing import Any, AnyStr, Callable, Mapping, Sequence, Text, Union from urllib import addinfourl _string = Union[str, unicode] @@ -17,17 +17,17 @@ class Request(object): host: str port: str data: str - headers: Dict[str, str] + headers: dict[str, str] unverifiable: bool type: str | None origin_req_host = ... - unredirected_hdrs: Dict[str, str] + unredirected_hdrs: dict[str, str] timeout: float | None # Undocumented, only set after __init__() by OpenerDirector.open() def __init__( self, url: str, data: str | None = ..., - headers: Dict[str, str] = ..., + headers: dict[str, str] = ..., origin_req_host: str | None = ..., unverifiable: bool = ..., ) -> None: ... @@ -51,7 +51,7 @@ class Request(object): def header_items(self): ... class OpenerDirector(object): - addheaders: List[Tuple[str, str]] + addheaders: list[tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... def open(self, fullurl: Request | _string, data: _string | None = ..., timeout: float | None = ...) -> addinfourl | None: ... def error(self, proto: _string, *args: Any): ... @@ -68,7 +68,7 @@ def urlopen( context: ssl.SSLContext | None = ..., ) -> addinfourl: ... def install_opener(opener: OpenerDirector) -> None: ... -def build_opener(*handlers: BaseHandler | Type[BaseHandler]) -> OpenerDirector: ... +def build_opener(*handlers: BaseHandler | type[BaseHandler]) -> OpenerDirector: ... class BaseHandler: handler_order: int @@ -101,8 +101,8 @@ class ProxyHandler(BaseHandler): class HTTPPasswordMgr: def __init__(self) -> None: ... def add_password(self, realm: Text | None, uri: Text | Sequence[Text], user: Text, passwd: Text) -> None: ... - def find_user_password(self, realm: Text | None, authuri: Text) -> Tuple[Any, Any]: ... - def reduce_uri(self, uri: _string, default_port: bool = ...) -> Tuple[Any, Any]: ... + def find_user_password(self, realm: Text | None, authuri: Text) -> tuple[Any, Any]: ... + def reduce_uri(self, uri: _string, default_port: bool = ...) -> tuple[Any, Any]: ... def is_suburi(self, base: _string, test: _string) -> bool: ... class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): ... @@ -129,7 +129,7 @@ class AbstractDigestAuthHandler: def retry_http_digest_auth(self, req: Request, auth: str) -> HTTPResponse | None: ... def get_cnonce(self, nonce: str) -> str: ... def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ... - def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ... + def get_algorithm_impls(self, algorithm: str) -> tuple[Callable[[str], str], Callable[[str, str], str]]: ... def get_entity_digest(self, data: bytes | None, chal: Mapping[str, str]) -> str | None: ... class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): @@ -181,5 +181,5 @@ class CacheFTPHandler(FTPHandler): def check_cache(self): ... def clear_cache(self): ... -def parse_http_list(s: AnyStr) -> List[AnyStr]: ... -def parse_keqv_list(l: List[AnyStr]) -> Dict[AnyStr, AnyStr]: ... +def parse_http_list(s: AnyStr) -> list[AnyStr]: ... +def parse_keqv_list(l: list[AnyStr]) -> dict[AnyStr, AnyStr]: ... diff --git a/stdlib/@python2/urlparse.pyi b/stdlib/@python2/urlparse.pyi index 6668c743373a..625928a74135 100644 --- a/stdlib/@python2/urlparse.pyi +++ b/stdlib/@python2/urlparse.pyi @@ -1,13 +1,13 @@ -from typing import AnyStr, Dict, List, NamedTuple, Sequence, Tuple, Union, overload +from typing import AnyStr, NamedTuple, Sequence, Union, overload _String = Union[str, unicode] -uses_relative: List[str] -uses_netloc: List[str] -uses_params: List[str] -non_hierarchical: List[str] -uses_query: List[str] -uses_fragment: List[str] +uses_relative: list[str] +uses_netloc: list[str] +uses_params: list[str] +non_hierarchical: list[str] +uses_query: list[str] +uses_fragment: list[str] scheme_chars: str MAX_CACHE_SIZE: int @@ -47,15 +47,15 @@ class ParseResult(_ParseResult, ResultMixin): def urlparse(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> ParseResult: ... def urlsplit(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> SplitResult: ... @overload -def urlunparse(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... +def urlunparse(data: tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... @overload def urlunparse(data: Sequence[AnyStr]) -> AnyStr: ... @overload -def urlunsplit(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... +def urlunsplit(data: tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... @overload def urlunsplit(data: Sequence[AnyStr]) -> AnyStr: ... def urljoin(base: AnyStr, url: AnyStr, allow_fragments: bool = ...) -> AnyStr: ... -def urldefrag(url: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def urldefrag(url: AnyStr) -> tuple[AnyStr, AnyStr]: ... def unquote(s: AnyStr) -> AnyStr: ... -def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[AnyStr, List[AnyStr]]: ... -def parse_qsl(qs: AnyStr, keep_blank_values: int = ..., strict_parsing: bool = ...) -> List[Tuple[AnyStr, AnyStr]]: ... +def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[AnyStr, list[AnyStr]]: ... +def parse_qsl(qs: AnyStr, keep_blank_values: int = ..., strict_parsing: bool = ...) -> list[tuple[AnyStr, AnyStr]]: ... diff --git a/stdlib/@python2/uuid.pyi b/stdlib/@python2/uuid.pyi index 2c8a9fb1c097..8ba2d7e5aa24 100644 --- a/stdlib/@python2/uuid.pyi +++ b/stdlib/@python2/uuid.pyi @@ -1,9 +1,9 @@ -from typing import Any, Text, Tuple +from typing import Any, Text # Because UUID has properties called int and bytes we need to rename these temporarily. _Int = int _Bytes = bytes -_FieldsType = Tuple[int, int, int, int, int, int] +_FieldsType = tuple[int, int, int, int, int, int] class UUID: def __init__( diff --git a/stdlib/@python2/warnings.pyi b/stdlib/@python2/warnings.pyi index 0d187bf70c33..2e872a4fb28e 100644 --- a/stdlib/@python2/warnings.pyi +++ b/stdlib/@python2/warnings.pyi @@ -1,23 +1,23 @@ from _warnings import warn as warn, warn_explicit as warn_explicit from types import ModuleType, TracebackType -from typing import List, TextIO, Type, overload +from typing import TextIO, overload from typing_extensions import Literal def showwarning( - message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... + message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... ) -> None: ... -def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... +def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... def filterwarnings( - action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ... + action: str, message: str = ..., category: type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ... ) -> None: ... -def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... +def simplefilter(action: str, category: type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... def resetwarnings() -> None: ... class _OptionError(Exception): ... class WarningMessage: message: Warning | str - category: Type[Warning] + category: type[Warning] filename: str lineno: int file: TextIO | None @@ -25,7 +25,7 @@ class WarningMessage: def __init__( self, message: Warning | str, - category: Type[Warning], + category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., @@ -39,13 +39,13 @@ class catch_warnings: def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ... @overload def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ... - def __enter__(self) -> List[WarningMessage] | None: ... + def __enter__(self) -> list[WarningMessage] | None: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... class _catch_warnings_without_records(catch_warnings): def __enter__(self) -> None: ... class _catch_warnings_with_records(catch_warnings): - def __enter__(self) -> List[WarningMessage]: ... + def __enter__(self) -> list[WarningMessage]: ... diff --git a/stdlib/@python2/wave.pyi b/stdlib/@python2/wave.pyi index 0e9fe612cd24..ceae301145d8 100644 --- a/stdlib/@python2/wave.pyi +++ b/stdlib/@python2/wave.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, BinaryIO, NoReturn, Text, Tuple, Union +from typing import IO, Any, BinaryIO, NoReturn, Text, Union _File = Union[Text, IO[bytes]] @@ -6,7 +6,7 @@ class Error(Exception): ... WAVE_FORMAT_PCM: int -_wave_params = Tuple[int, int, int, int, str, str] +_wave_params = tuple[int, int, int, int, str, str] class Wave_read: def __init__(self, f: _File) -> None: ... diff --git a/stdlib/@python2/weakref.pyi b/stdlib/@python2/weakref.pyi index da380dcd2c0c..aae85deba9f4 100644 --- a/stdlib/@python2/weakref.pyi +++ b/stdlib/@python2/weakref.pyi @@ -1,5 +1,5 @@ from _weakrefset import WeakSet as WeakSet -from typing import Any, Callable, Generic, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar, overload from _weakref import ( CallableProxyType as CallableProxyType, @@ -16,13 +16,13 @@ _T = TypeVar("_T") _KT = TypeVar("_KT") _VT = TypeVar("_VT") -ProxyTypes: Tuple[Type[Any], ...] +ProxyTypes: tuple[type[Any], ...] class WeakValueDictionary(MutableMapping[_KT, _VT]): @overload def __init__(self) -> None: ... @overload - def __init__(self, __other: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__(self, __other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -32,14 +32,14 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def __iter__(self) -> Iterator[_KT]: ... def __str__(self) -> str: ... def copy(self) -> WeakValueDictionary[_KT, _VT]: ... - def keys(self) -> List[_KT]: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... + def keys(self) -> list[_KT]: ... + def values(self) -> list[_VT]: ... + def items(self) -> list[tuple[_KT, _VT]]: ... def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ... def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... - def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ... + def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... class KeyedRef(ref[_T], Generic[_KT, _T]): key: _KT @@ -51,7 +51,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): @overload def __init__(self, dict: None = ...) -> None: ... @overload - def __init__(self, dict: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -61,11 +61,11 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def __iter__(self) -> Iterator[_KT]: ... def __str__(self) -> str: ... def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... - def keys(self) -> List[_KT]: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... + def keys(self) -> list[_KT]: ... + def values(self) -> list[_VT]: ... + def items(self) -> list[tuple[_KT, _VT]]: ... def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ... def iterkeyrefs(self) -> Iterator[ref[_KT]]: ... - def keyrefs(self) -> List[ref[_KT]]: ... + def keyrefs(self) -> list[ref[_KT]]: ... diff --git a/stdlib/@python2/webbrowser.pyi b/stdlib/@python2/webbrowser.pyi index f634bc11ca7d..8f1c8b060b4c 100644 --- a/stdlib/@python2/webbrowser.pyi +++ b/stdlib/@python2/webbrowser.pyi @@ -1,5 +1,5 @@ import sys -from typing import Callable, List, Sequence, Text +from typing import Callable, Sequence, Text class Error(Exception): ... @@ -12,7 +12,7 @@ def open_new(url: Text) -> bool: ... def open_new_tab(url: Text) -> bool: ... class BaseBrowser: - args: List[str] + args: list[str] name: str basename: str def __init__(self, name: Text = ...) -> None: ... @@ -21,7 +21,7 @@ class BaseBrowser: def open_new_tab(self, url: Text) -> bool: ... class GenericBrowser(BaseBrowser): - args: List[str] + args: list[str] name: str basename: str def __init__(self, name: Text | Sequence[Text]) -> None: ... @@ -31,45 +31,45 @@ class BackgroundBrowser(GenericBrowser): def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... class UnixBrowser(BaseBrowser): - raise_opts: List[str] | None + raise_opts: list[str] | None background: bool redirect_stdout: bool - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... class Mozilla(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Galeon(UnixBrowser): - raise_opts: List[str] - remote_args: List[str] + raise_opts: list[str] + remote_args: list[str] remote_action: str remote_action_newwin: str background: bool class Chrome(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Opera(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Elinks(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str diff --git a/stdlib/@python2/wsgiref/handlers.pyi b/stdlib/@python2/wsgiref/handlers.pyi index d7e35ba8aff6..4dd63ac75035 100644 --- a/stdlib/@python2/wsgiref/handlers.pyi +++ b/stdlib/@python2/wsgiref/handlers.pyi @@ -1,17 +1,17 @@ from abc import abstractmethod from types import TracebackType -from typing import IO, Callable, List, MutableMapping, Optional, Text, Tuple, Type +from typing import IO, Callable, MutableMapping, Optional, Text from .headers import Headers from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment from .util import FileWrapper -_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +_exc_info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]] def format_date_time(timestamp: float | None) -> str: ... # undocumented class BaseHandler: - wsgi_version: Tuple[int, int] # undocumented + wsgi_version: tuple[int, int] # undocumented wsgi_multithread: bool wsgi_multiprocess: bool wsgi_run_once: bool @@ -22,12 +22,12 @@ class BaseHandler: os_environ: MutableMapping[str, str] - wsgi_file_wrapper: Type[FileWrapper] | None - headers_class: Type[Headers] # undocumented + wsgi_file_wrapper: type[FileWrapper] | None + headers_class: type[Headers] # undocumented traceback_limit: int | None error_status: str - error_headers: List[Tuple[Text, Text]] + error_headers: list[tuple[Text, Text]] error_body: bytes def run(self, application: WSGIApplication) -> None: ... def setup_environ(self) -> None: ... @@ -36,7 +36,7 @@ class BaseHandler: def set_content_length(self) -> None: ... def cleanup_headers(self) -> None: ... def start_response( - self, status: Text, headers: List[Tuple[Text, Text]], exc_info: _exc_info | None = ... + self, status: Text, headers: list[tuple[Text, Text]], exc_info: _exc_info | None = ... ) -> Callable[[bytes], None]: ... def send_preamble(self) -> None: ... def write(self, data: bytes) -> None: ... @@ -48,7 +48,7 @@ class BaseHandler: def client_is_modern(self) -> bool: ... def log_exception(self, exc_info: _exc_info) -> None: ... def handle_error(self) -> None: ... - def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... + def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... @abstractmethod def _write(self, data: bytes) -> None: ... @abstractmethod diff --git a/stdlib/@python2/wsgiref/headers.pyi b/stdlib/@python2/wsgiref/headers.pyi index 08061fee7664..5c939a342510 100644 --- a/stdlib/@python2/wsgiref/headers.pyi +++ b/stdlib/@python2/wsgiref/headers.pyi @@ -1,6 +1,6 @@ -from typing import List, Pattern, Tuple, overload +from typing import Pattern, overload -_HeaderList = List[Tuple[str, str]] +_HeaderList = list[tuple[str, str]] tspecials: Pattern[str] # undocumented @@ -12,13 +12,13 @@ class Headers: def __getitem__(self, name: str) -> str | None: ... def has_key(self, name: str) -> bool: ... def __contains__(self, name: str) -> bool: ... - def get_all(self, name: str) -> List[str]: ... + def get_all(self, name: str) -> list[str]: ... @overload def get(self, name: str, default: str) -> str: ... @overload def get(self, name: str, default: str | None = ...) -> str | None: ... - def keys(self) -> List[str]: ... - def values(self) -> List[str]: ... + def keys(self) -> list[str]: ... + def values(self) -> list[str]: ... def items(self) -> _HeaderList: ... def setdefault(self, name: str, value: str) -> str: ... def add_header(self, _name: str, _value: str | None, **_params: str | None) -> None: ... diff --git a/stdlib/@python2/wsgiref/simple_server.pyi b/stdlib/@python2/wsgiref/simple_server.pyi index a74a26fed935..6faba328f935 100644 --- a/stdlib/@python2/wsgiref/simple_server.pyi +++ b/stdlib/@python2/wsgiref/simple_server.pyi @@ -1,5 +1,5 @@ from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer -from typing import List, Type, TypeVar, overload +from typing import TypeVar, overload from .handlers import SimpleHandler from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment @@ -25,13 +25,13 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): def get_stderr(self) -> ErrorStream: ... def handle(self) -> None: ... -def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... +def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... _S = TypeVar("_S", bound=WSGIServer) @overload -def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ... +def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: type[WSGIRequestHandler] = ...) -> WSGIServer: ... @overload def make_server( - host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ... + host: str, port: int, app: WSGIApplication, server_class: type[_S], handler_class: type[WSGIRequestHandler] = ... ) -> _S: ... diff --git a/stdlib/@python2/xdrlib.pyi b/stdlib/@python2/xdrlib.pyi index 378504c37227..f59843f8ee9d 100644 --- a/stdlib/@python2/xdrlib.pyi +++ b/stdlib/@python2/xdrlib.pyi @@ -1,4 +1,4 @@ -from typing import Callable, List, Sequence, TypeVar +from typing import Callable, Sequence, TypeVar _T = TypeVar("_T") @@ -50,6 +50,6 @@ class Unpacker: def unpack_string(self) -> bytes: ... def unpack_opaque(self) -> bytes: ... def unpack_bytes(self) -> bytes: ... - def unpack_list(self, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_array(self, unpack_item: Callable[[], _T]) -> List[_T]: ... + def unpack_list(self, unpack_item: Callable[[], _T]) -> list[_T]: ... + def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> list[_T]: ... + def unpack_array(self, unpack_item: Callable[[], _T]) -> list[_T]: ... diff --git a/stdlib/@python2/xml/dom/domreg.pyi b/stdlib/@python2/xml/dom/domreg.pyi index 2496b3884ea1..b9e2dd9eb263 100644 --- a/stdlib/@python2/xml/dom/domreg.pyi +++ b/stdlib/@python2/xml/dom/domreg.pyi @@ -1,8 +1,8 @@ from _typeshed.xml import DOMImplementation -from typing import Callable, Dict, Iterable, Tuple +from typing import Callable, Iterable -well_known_implementations: Dict[str, str] -registered: Dict[str, Callable[[], DOMImplementation]] +well_known_implementations: dict[str, str] +registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = ..., features: str | Iterable[Tuple[str, str | None]] = ...) -> DOMImplementation: ... +def getDOMImplementation(name: str | None = ..., features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/@python2/xml/dom/minicompat.pyi b/stdlib/@python2/xml/dom/minicompat.pyi index e9b0395ab50d..254f8a0c1657 100644 --- a/stdlib/@python2/xml/dom/minicompat.pyi +++ b/stdlib/@python2/xml/dom/minicompat.pyi @@ -1,17 +1,17 @@ -from typing import Any, Iterable, List, Tuple, Type, TypeVar +from typing import Any, Iterable, TypeVar _T = TypeVar("_T") -StringTypes: Tuple[Type[str]] +StringTypes: tuple[type[str]] -class NodeList(List[_T]): +class NodeList(list[_T]): length: int def item(self, index: int) -> _T | None: ... -class EmptyNodeList(Tuple[Any, ...]): +class EmptyNodeList(tuple[Any, ...]): length: int def item(self, index: int) -> None: ... def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ... -def defproperty(klass: Type[Any], name: str, doc: str) -> None: ... +def defproperty(klass: type[Any], name: str, doc: str) -> None: ... diff --git a/stdlib/@python2/xml/etree/ElementPath.pyi b/stdlib/@python2/xml/etree/ElementPath.pyi index 02fe84567543..5a2dd69c1bee 100644 --- a/stdlib/@python2/xml/etree/ElementPath.pyi +++ b/stdlib/@python2/xml/etree/ElementPath.pyi @@ -1,14 +1,14 @@ -from typing import Callable, Dict, Generator, List, Pattern, Tuple, TypeVar +from typing import Callable, Generator, Pattern, TypeVar from xml.etree.ElementTree import Element xpath_tokenizer_re: Pattern[str] -_token = Tuple[str, str] +_token = tuple[str, str] _next = Callable[[], _token] -_callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]] +_callback = Callable[[_SelectorContext, list[Element]], Generator[Element, None, None]] -def xpath_tokenizer(pattern: str, namespaces: Dict[str, str] | None = ...) -> Generator[_token, None, None]: ... -def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ... +def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_token, None, None]: ... +def get_parent_map(context: _SelectorContext) -> dict[Element, Element]: ... def prepare_child(next: _next, token: _token) -> _callback: ... def prepare_star(next: _next, token: _token) -> _callback: ... def prepare_self(next: _next, token: _token) -> _callback: ... @@ -16,16 +16,16 @@ def prepare_descendant(next: _next, token: _token) -> _callback: ... def prepare_parent(next: _next, token: _token) -> _callback: ... def prepare_predicate(next: _next, token: _token) -> _callback: ... -ops: Dict[str, Callable[[_next, _token], _callback]] +ops: dict[str, Callable[[_next, _token], _callback]] class _SelectorContext: - parent_map: Dict[Element, Element] | None + parent_map: dict[Element, Element] | None root: Element def __init__(self, root: Element) -> None: ... _T = TypeVar("_T") -def iterfind(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ... -def find(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ... -def findall(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ... -def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: Dict[str, str] | None = ...) -> _T | str: ... +def iterfind(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... +def find(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... +def findall(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... +def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: dict[str, str] | None = ...) -> _T | str: ... diff --git a/stdlib/@python2/xml/etree/ElementTree.pyi b/stdlib/@python2/xml/etree/ElementTree.pyi index a7a0a1c65f46..a6cbae35d04f 100644 --- a/stdlib/@python2/xml/etree/ElementTree.pyi +++ b/stdlib/@python2/xml/etree/ElementTree.pyi @@ -3,17 +3,14 @@ from typing import ( IO, Any, Callable, - Dict, Generator, ItemsView, Iterable, Iterator, KeysView, - List, MutableSequence, Sequence, Text, - Tuple, TypeVar, Union, overload, @@ -23,7 +20,7 @@ VERSION: str class ParseError(SyntaxError): code: int - position: Tuple[int, int] + position: tuple[int, int] def iselement(element: object) -> bool: ... @@ -53,31 +50,31 @@ _file_or_filename = Union[Text, FileDescriptor, IO[Any]] class Element(MutableSequence[Element]): tag: _str_result_type - attrib: Dict[_str_result_type, _str_result_type] + attrib: dict[_str_result_type, _str_result_type] text: _str_result_type | None tail: _str_result_type | None def __init__( self, tag: _str_argument_type | Callable[..., Element], - attrib: Dict[_str_argument_type, _str_argument_type] = ..., + attrib: dict[_str_argument_type, _str_argument_type] = ..., **extra: _str_argument_type, ) -> None: ... def append(self, __subelement: Element) -> None: ... def clear(self) -> None: ... def extend(self, __elements: Iterable[Element]) -> None: ... def find( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> Element | None: ... def findall( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> List[Element]: ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... + ) -> list[Element]: ... @overload def findtext( - self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, default: None = ..., namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> _str_result_type | None: ... @overload def findtext( - self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, default: _T, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> _T | _str_result_type: ... @overload def get(self, key: _str_argument_type, default: None = ...) -> _str_result_type | None: ... @@ -87,11 +84,11 @@ class Element(MutableSequence[Element]): def items(self) -> ItemsView[_str_result_type, _str_result_type]: ... def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ... def iterfind( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> Generator[Element, None, None]: ... def itertext(self) -> Generator[_str_result_type, None, None]: ... def keys(self) -> KeysView[_str_result_type]: ... - def makeelement(self, __tag: _str_argument_type, __attrib: Dict[_str_argument_type, _str_argument_type]) -> Element: ... + def makeelement(self, __tag: _str_argument_type, __attrib: dict[_str_argument_type, _str_argument_type]) -> Element: ... def remove(self, __subelement: Element) -> None: ... def set(self, __key: _str_argument_type, __value: _str_argument_type) -> None: ... def __delitem__(self, i: int | slice) -> None: ... @@ -104,13 +101,13 @@ class Element(MutableSequence[Element]): def __setitem__(self, i: int, o: Element) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ... - def getchildren(self) -> List[Element]: ... - def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ... + def getchildren(self) -> list[Element]: ... + def getiterator(self, tag: _str_argument_type | None = ...) -> list[Element]: ... def SubElement( parent: Element, tag: _str_argument_type, - attrib: Dict[_str_argument_type, _str_argument_type] = ..., + attrib: dict[_str_argument_type, _str_argument_type] = ..., **extra: _str_argument_type, ) -> Element: ... def Comment(text: _str_argument_type | None = ...) -> Element: ... @@ -127,23 +124,23 @@ class ElementTree: def getroot(self) -> Element: ... def parse(self, source: _file_or_filename, parser: XMLParser | None = ...) -> Element: ... def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ... - def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ... + def getiterator(self, tag: _str_argument_type | None = ...) -> list[Element]: ... def find( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> Element | None: ... @overload def findtext( - self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, default: None = ..., namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> _str_result_type | None: ... @overload def findtext( - self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, default: _T, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> _T | _str_result_type: ... def findall( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> List[Element]: ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... + ) -> list[Element]: ... def iterfind( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... + self, path: _str_argument_type, namespaces: dict[_str_argument_type, _str_argument_type] | None = ... ) -> Generator[Element, None, None]: ... def write( self, @@ -157,14 +154,14 @@ class ElementTree: def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ... def tostring(element: Element, encoding: str | None = ..., method: str | None = ...) -> bytes: ... -def tostringlist(element: Element, encoding: str | None = ..., method: str | None = ...) -> List[bytes]: ... +def tostringlist(element: Element, encoding: str | None = ..., method: str | None = ...) -> list[bytes]: ... def dump(elem: Element) -> None: ... def parse(source: _file_or_filename, parser: XMLParser | None = ...) -> ElementTree: ... def iterparse( source: _file_or_filename, events: Sequence[str] | None = ..., parser: XMLParser | None = ... -) -> Iterator[Tuple[str, Any]]: ... +) -> Iterator[tuple[str, Any]]: ... def XML(text: _parser_input_type, parser: XMLParser | None = ...) -> Element: ... -def XMLID(text: _parser_input_type, parser: XMLParser | None = ...) -> Tuple[Element, Dict[_str_result_type, Element]]: ... +def XMLID(text: _parser_input_type, parser: XMLParser | None = ...) -> tuple[Element, dict[_str_result_type, Element]]: ... # This is aliased to XML in the source. fromstring = XML @@ -180,13 +177,13 @@ def fromstringlist(sequence: Sequence[_parser_input_type], parser: XMLParser | N # TreeBuilder is called by client code (they could pass strs, bytes or whatever); # but we don't want to use a too-broad type, or it would be too hard to write # elementfactories. -_ElementFactory = Callable[[Any, Dict[Any, Any]], Element] +_ElementFactory = Callable[[Any, dict[Any, Any]], Element] class TreeBuilder: def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ... def close(self) -> Element: ... def data(self, __data: _parser_input_type) -> None: ... - def start(self, __tag: _parser_input_type, __attrs: Dict[_parser_input_type, _parser_input_type]) -> Element: ... + def start(self, __tag: _parser_input_type, __attrs: dict[_parser_input_type, _parser_input_type]) -> Element: ... def end(self, __tag: _parser_input_type) -> Element: ... class XMLParser: diff --git a/stdlib/@python2/xml/sax/__init__.pyi b/stdlib/@python2/xml/sax/__init__.pyi index 0c6da9a87d13..7a35805f9f16 100644 --- a/stdlib/@python2/xml/sax/__init__.pyi +++ b/stdlib/@python2/xml/sax/__init__.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, List, NoReturn, Text +from typing import IO, Any, NoReturn, Text from xml.sax.handler import ContentHandler, ErrorHandler from xml.sax.xmlreader import Locator, XMLReader @@ -19,9 +19,9 @@ class SAXNotRecognizedException(SAXException): ... class SAXNotSupportedException(SAXException): ... class SAXReaderNotAvailable(SAXNotSupportedException): ... -default_parser_list: List[str] +default_parser_list: list[str] -def make_parser(parser_list: List[str] = ...) -> XMLReader: ... +def make_parser(parser_list: list[str] = ...) -> XMLReader: ... def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ... def parseString(string: bytes | Text, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ... def _create_parser(parser_name: str) -> XMLReader: ... diff --git a/stdlib/@python2/xml/sax/xmlreader.pyi b/stdlib/@python2/xml/sax/xmlreader.pyi index 8afc566b16a1..684e9cef1f42 100644 --- a/stdlib/@python2/xml/sax/xmlreader.pyi +++ b/stdlib/@python2/xml/sax/xmlreader.pyi @@ -1,4 +1,4 @@ -from typing import Mapping, Tuple +from typing import Mapping class XMLReader: def __init__(self) -> None: ... @@ -64,7 +64,7 @@ class AttributesImpl: def values(self): ... class AttributesNSImpl(AttributesImpl): - def __init__(self, attrs: Mapping[Tuple[str, str], str], qnames: Mapping[Tuple[str, str], str]) -> None: ... + def __init__(self, attrs: Mapping[tuple[str, str], str], qnames: Mapping[tuple[str, str], str]) -> None: ... def getValueByQName(self, name): ... def getNameByQName(self, name): ... def getQNameByName(self, name): ... diff --git a/stdlib/@python2/xmlrpclib.pyi b/stdlib/@python2/xmlrpclib.pyi index 5a7d0fc34f0e..0defb96bffb8 100644 --- a/stdlib/@python2/xmlrpclib.pyi +++ b/stdlib/@python2/xmlrpclib.pyi @@ -5,14 +5,14 @@ from ssl import SSLContext from StringIO import StringIO from time import struct_time from types import InstanceType -from typing import IO, Any, AnyStr, Callable, Iterable, List, Mapping, MutableMapping, Tuple, Type, Union +from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, MutableMapping, Union _Unmarshaller = Any -_timeTuple = Tuple[int, int, int, int, int, int, int, int, int] +_timeTuple = tuple[int, int, int, int, int, int, int, int, int] # Represents types that can be compared against a DateTime object _dateTimeComp = Union[unicode, DateTime, datetime] # A "host description" used by Transport factories -_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]] +_hostDesc = Union[str, tuple[str, Mapping[Any, Any]]] def escape(s: AnyStr, replace: Callable[[AnyStr, AnyStr, AnyStr], AnyStr] = ...) -> AnyStr: ... @@ -47,13 +47,13 @@ class Fault(Error): faultString: str def __init__(self, faultCode: Any, faultString: str, **extra: Any) -> None: ... -boolean: Type[bool] -Boolean: Type[bool] +boolean: type[bool] +Boolean: type[bool] class DateTime: value: str def __init__(self, value: str | unicode | datetime | float | int | _timeTuple | struct_time = ...) -> None: ... - def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ... + def make_comparable(self, other: _dateTimeComp) -> tuple[unicode, unicode]: ... def __lt__(self, other: _dateTimeComp) -> bool: ... def __le__(self, other: _dateTimeComp) -> bool: ... def __gt__(self, other: _dateTimeComp) -> bool: ... @@ -72,7 +72,7 @@ class Binary: def decode(self, data: str) -> None: ... def encode(self, out: IO[str]) -> None: ... -WRAPPERS: Tuple[Type[Any], ...] +WRAPPERS: tuple[type[Any], ...] # Still part of the public API, but see http://bugs.python.org/issue1773632 FastParser: None @@ -112,8 +112,8 @@ class Marshaller: | float | str | unicode - | List[Any] - | Tuple[Any, ...] + | list[Any] + | tuple[Any, ...] | Mapping[Any, Any] | datetime | InstanceType @@ -150,7 +150,7 @@ class Marshaller: class Unmarshaller: def append(self, object: Any) -> None: ... def __init__(self, use_datetime: bool = ...) -> None: ... - def close(self) -> Tuple[Any, ...]: ... + def close(self) -> tuple[Any, ...]: ... def getmethodname(self) -> str | None: ... def xml(self, encoding: str, standalone: bool) -> None: ... def start(self, tag: str, attrs: Any) -> None: ... @@ -173,25 +173,25 @@ class Unmarshaller: def end_methodName(self, data: str) -> None: ... class _MultiCallMethod: - def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ... + def __init__(self, call_list: list[tuple[str, tuple[Any, ...]]], name: str) -> None: ... class MultiCallIterator: - def __init__(self, results: List[Any]) -> None: ... + def __init__(self, results: list[Any]) -> None: ... class MultiCall: def __init__(self, server: ServerProxy) -> None: ... def __getattr__(self, name: str) -> _MultiCallMethod: ... def __call__(self) -> MultiCallIterator: ... -def getparser(use_datetime: bool = ...) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ... +def getparser(use_datetime: bool = ...) -> tuple[ExpatParser | SlowParser, Unmarshaller]: ... def dumps( - params: Tuple[Any, ...] | Fault, + params: tuple[Any, ...] | Fault, methodname: str | None = ..., methodresponse: bool | None = ..., encoding: str | None = ..., allow_none: bool = ..., ) -> str: ... -def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], str | None]: ... +def loads(data: str, use_datetime: bool = ...) -> tuple[tuple[Any, ...], str | None]: ... def gzip_encode(data: str) -> str: ... def gzip_decode(data: str, max_decode: int = ...) -> str: ... @@ -201,7 +201,7 @@ class GzipDecodedResponse(GzipFile): def close(self): ... class _Method: - def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ... + def __init__(self, send: Callable[[str, tuple[Any, ...]], Any], name: str) -> None: ... def __getattr__(self, name: str) -> _Method: ... def __call__(self, *args: Any) -> Any: ... @@ -210,18 +210,18 @@ class Transport: accept_gzip_encoding: bool encode_threshold: int | None def __init__(self, use_datetime: bool = ...) -> None: ... - def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ... + def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple[Any, ...]: ... verbose: bool - def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ... - def getparser(self) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ... - def get_host_info(self, host: _hostDesc) -> Tuple[str, List[Tuple[str, str]] | None, Mapping[Any, Any] | None]: ... + def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple[Any, ...]: ... + def getparser(self) -> tuple[ExpatParser | SlowParser, Unmarshaller]: ... + def get_host_info(self, host: _hostDesc) -> tuple[str, list[tuple[str, str]] | None, Mapping[Any, Any] | None]: ... def make_connection(self, host: _hostDesc) -> HTTPConnection: ... def close(self) -> None: ... def send_request(self, connection: HTTPConnection, handler: str, request_body: str) -> None: ... def send_host(self, connection: HTTPConnection, host: str) -> None: ... def send_user_agent(self, connection: HTTPConnection) -> None: ... def send_content(self, connection: HTTPConnection, request_body: str) -> None: ... - def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ... + def parse_response(self, response: HTTPResponse) -> tuple[Any, ...]: ... class SafeTransport(Transport): def __init__(self, use_datetime: bool = ..., context: SSLContext | None = ...) -> None: ... diff --git a/stdlib/@python2/zipfile.pyi b/stdlib/@python2/zipfile.pyi index 5a0879492a88..2bafc44aa33d 100644 --- a/stdlib/@python2/zipfile.pyi +++ b/stdlib/@python2/zipfile.pyi @@ -1,10 +1,10 @@ import io from _typeshed import StrPath from types import TracebackType -from typing import IO, Any, Callable, Dict, Iterable, List, Pattern, Protocol, Sequence, Text, Tuple, Type, Union +from typing import IO, Any, Callable, Iterable, Pattern, Protocol, Sequence, Text, Union _SZI = Union[Text, ZipInfo] -_DT = Tuple[int, int, int, int, int, int] +_DT = tuple[int, int, int, int, int, int] class BadZipfile(Exception): ... @@ -18,7 +18,7 @@ class ZipExtFile(io.BufferedIOBase): PATTERN: Pattern[str] = ... - newlines: List[bytes] | None + newlines: list[bytes] | None mode: str name: str def __init__( @@ -42,19 +42,19 @@ class ZipFile: filename: Text | None debug: int comment: bytes - filelist: List[ZipInfo] + filelist: list[ZipInfo] fp: IO[bytes] | None - NameToInfo: Dict[Text, ZipInfo] + NameToInfo: dict[Text, ZipInfo] start_dir: int # undocumented def __init__(self, file: StrPath | IO[bytes], mode: Text = ..., compression: int = ..., allowZip64: bool = ...) -> None: ... def __enter__(self) -> ZipFile: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def close(self) -> None: ... def getinfo(self, name: Text) -> ZipInfo: ... - def infolist(self) -> List[ZipInfo]: ... - def namelist(self) -> List[Text]: ... + def infolist(self) -> list[ZipInfo]: ... + def namelist(self) -> list[Text]: ... def open(self, name: _SZI, mode: Text = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ... def extract(self, member: _SZI, path: StrPath | None = ..., pwd: bytes | None = ...) -> str: ... def extractall(self, path: StrPath | None = ..., members: Iterable[Text] | None = ..., pwd: bytes | None = ...) -> None: ... diff --git a/stdlib/_ast.pyi b/stdlib/_ast.pyi index bf184dd7977c..d1feaf235310 100644 --- a/stdlib/_ast.pyi +++ b/stdlib/_ast.pyi @@ -1,5 +1,4 @@ import sys -import typing from typing import Any, ClassVar from typing_extensions import Literal @@ -11,8 +10,8 @@ if sys.version_info >= (3, 8): _identifier = str class AST: - _attributes: ClassVar[typing.Tuple[str, ...]] - _fields: ClassVar[typing.Tuple[str, ...]] + _attributes: ClassVar[tuple[str, ...]] + _fields: ClassVar[tuple[str, ...]] def __init__(self, *args: Any, **kwargs: Any) -> None: ... # TODO: Not all nodes have all of the following attributes lineno: int diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 8716dec052df..047285d89cbf 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -21,7 +21,7 @@ from typing_extensions import ParamSpec AbstractContextManager = ContextManager if sys.version_info >= (3, 7): - from typing import AsyncContextManager + from typing import AsyncContextManager # noqa Y022 AbstractAsyncContextManager = AsyncContextManager diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 03eeff4beb4e..8a1dcd4fc477 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -1,7 +1,7 @@ import abc import sys from _typeshed import Self as TypeshedSelf # see #6932 for why the alias cannot have a leading underscore -from typing import ( +from typing import ( # noqa Y022 TYPE_CHECKING as TYPE_CHECKING, Any, AsyncContextManager as AsyncContextManager, diff --git a/stubs/enum34/@python2/enum.pyi b/stubs/enum34/@python2/enum.pyi index 901d7d5fd62c..37b8e5806c6c 100644 --- a/stubs/enum34/@python2/enum.pyi +++ b/stubs/enum34/@python2/enum.pyi @@ -1,10 +1,10 @@ import sys from _typeshed import Self from abc import ABCMeta -from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union +from typing import Any, Iterator, Mapping, TypeVar, Union _T = TypeVar("_T") -_S = TypeVar("_S", bound=Type[Enum]) +_S = TypeVar("_S", bound=type[Enum]) # Note: EnumMeta actually subclasses type directly, not ABCMeta. # This is a temporary workaround to allow multiple creation of enums with builtins @@ -12,12 +12,12 @@ _S = TypeVar("_S", bound=Type[Enum]) # spurious inconsistent metaclass structure. See #1595. # Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself class EnumMeta(ABCMeta): - def __iter__(self: Type[_T]) -> Iterator[_T]: ... - def __reversed__(self: Type[_T]) -> Iterator[_T]: ... + def __iter__(self: type[_T]) -> Iterator[_T]: ... + def __reversed__(self: type[_T]) -> Iterator[_T]: ... def __contains__(self, member: object) -> bool: ... - def __getitem__(self: Type[_T], name: str) -> _T: ... + def __getitem__(self: type[_T], name: str) -> _T: ... @property - def __members__(self: Type[_T]) -> Mapping[str, _T]: ... + def __members__(self: type[_T]) -> Mapping[str, _T]: ... def __len__(self) -> int: ... class Enum(metaclass=EnumMeta): @@ -25,21 +25,21 @@ class Enum(metaclass=EnumMeta): value: Any _name_: str _value_: Any - _member_names_: List[str] # undocumented - _member_map_: Dict[str, Enum] # undocumented - _value2member_map_: Dict[int, Enum] # undocumented + _member_names_: list[str] # undocumented + _member_map_: dict[str, Enum] # undocumented + _value2member_map_: dict[int, Enum] # undocumented if sys.version_info >= (3, 7): - _ignore_: Union[str, List[str]] + _ignore_: Union[str, list[str]] _order_: str __order__: str @classmethod def _missing_(cls, value: object) -> Any: ... @staticmethod - def _generate_next_value_(name: str, start: int, count: int, last_values: List[Any]) -> Any: ... - def __new__(cls: Type[_T], value: object) -> _T: ... + def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: ... + def __new__(cls: type[_T], value: object) -> _T: ... def __repr__(self) -> str: ... def __str__(self) -> str: ... - def __dir__(self) -> List[str]: ... + def __dir__(self) -> list[str]: ... def __format__(self, format_spec: str) -> str: ... def __hash__(self) -> Any: ... def __reduce_ex__(self, proto: object) -> Any: ... diff --git a/stubs/futures/@python2/concurrent/futures/_base.pyi b/stubs/futures/@python2/concurrent/futures/_base.pyi index 13c6bb2294cd..f4f827cbdbda 100644 --- a/stubs/futures/@python2/concurrent/futures/_base.pyi +++ b/stubs/futures/@python2/concurrent/futures/_base.pyi @@ -3,7 +3,7 @@ from _typeshed import Self from abc import abstractmethod from logging import Logger from types import TracebackType -from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Optional, Protocol, Set, Tuple, TypeVar +from typing import Any, Callable, Container, Generic, Iterable, Iterator, Optional, Protocol, TypeVar FIRST_COMPLETED: str FIRST_EXCEPTION: str @@ -41,7 +41,7 @@ class Future(Generic[_T]): def set_running_or_notify_cancel(self) -> bool: ... def set_result(self, result: _T) -> None: ... def exception(self, timeout: Optional[float] = ...) -> Any: ... - def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ... + def exception_info(self, timeout: Optional[float] = ...) -> tuple[Any, Optional[TracebackType]]: ... def set_exception(self, exception: Any) -> None: ... def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... @@ -55,11 +55,11 @@ class Executor: def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... def wait( fs: _Collection[Future[_T]], timeout: Optional[float] = ..., return_when: str = ... -) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ... +) -> tuple[set[Future[_T]], set[Future[_T]]]: ... class _Waiter: event: threading.Event - finished_futures: List[Future[Any]] + finished_futures: list[Future[Any]] def __init__(self) -> None: ... def add_result(self, future: Future[Any]) -> None: ... def add_exception(self, future: Future[Any]) -> None: ... diff --git a/stubs/ipaddress/@python2/ipaddress.pyi b/stubs/ipaddress/@python2/ipaddress.pyi index d623752b5df7..c6390dffc23d 100644 --- a/stubs/ipaddress/@python2/ipaddress.pyi +++ b/stubs/ipaddress/@python2/ipaddress.pyi @@ -1,5 +1,5 @@ from _typeshed import Self -from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, Tuple, TypeVar, overload +from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, TypeVar, overload # Undocumented length constants IPV4LENGTH: int @@ -123,7 +123,7 @@ class IPv6Address(_BaseAddress): @property def sixtofour(self) -> Optional[IPv4Address]: ... @property - def teredo(self) -> Optional[Tuple[IPv4Address, IPv4Address]]: ... + def teredo(self) -> Optional[tuple[IPv4Address, IPv4Address]]: ... class IPv6Network(_BaseNetwork[IPv6Address]): @property @@ -139,11 +139,11 @@ def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[I def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[IPv6Network]: ... def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ... @overload -def get_mixed_type_key(obj: _A) -> Tuple[int, _A]: ... +def get_mixed_type_key(obj: _A) -> tuple[int, _A]: ... @overload -def get_mixed_type_key(obj: IPv4Network) -> Tuple[int, IPv4Address, IPv4Address]: ... +def get_mixed_type_key(obj: IPv4Network) -> tuple[int, IPv4Address, IPv4Address]: ... @overload -def get_mixed_type_key(obj: IPv6Network) -> Tuple[int, IPv6Address, IPv6Address]: ... +def get_mixed_type_key(obj: IPv6Network) -> tuple[int, IPv6Address, IPv6Address]: ... class AddressValueError(ValueError): ... class NetmaskValueError(ValueError): ... diff --git a/stubs/protobuf/google/protobuf/internal/containers.pyi b/stubs/protobuf/google/protobuf/internal/containers.pyi index 170f34cb5f29..c7c26dc05e1b 100644 --- a/stubs/protobuf/google/protobuf/internal/containers.pyi +++ b/stubs/protobuf/google/protobuf/internal/containers.pyi @@ -1,5 +1,5 @@ from collections.abc import MutableMapping -from typing import Any, Callable, Iterable, Iterator, List, Optional, Sequence, Text, TypeVar, Union, overload +from typing import Any, Callable, Iterable, Iterator, Optional, Sequence, Text, TypeVar, Union, overload from typing_extensions import SupportsIndex from google.protobuf.descriptor import Descriptor @@ -23,7 +23,7 @@ class BaseContainer(Sequence[_T]): @overload def __getitem__(self, key: SupportsIndex) -> _T: ... @overload - def __getitem__(self, key: slice) -> List[_T]: ... + def __getitem__(self, key: slice) -> list[_T]: ... class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): def __init__(self, message_listener: MessageListener, message_descriptor: Descriptor) -> None: ... @@ -37,7 +37,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): def __setitem__(self, key: int, value: _ScalarV) -> None: ... @overload def __setitem__(self, key: slice, value: Iterable[_ScalarV]) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_ScalarV]: ... + def __getslice__(self, start: int, stop: int) -> list[_ScalarV]: ... def __setslice__(self, start: int, stop: int, values: Iterable[_ScalarV]) -> None: ... def __delitem__(self, key: Union[int, slice]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... @@ -52,7 +52,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]): def MergeFrom(self: _M, other: _M) -> None: ... def remove(self, elem: _MessageV) -> None: ... def pop(self, key: int = ...) -> _MessageV: ... - def __getslice__(self, start: int, stop: int) -> List[_MessageV]: ... + def __getslice__(self, start: int, stop: int) -> list[_MessageV]: ... def __delitem__(self, key: Union[int, slice]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi b/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi index f85bb54bb817..47f40a972dff 100644 --- a/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi +++ b/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi @@ -1,4 +1,4 @@ -from typing import Generic, List, Text, Tuple, TypeVar +from typing import Generic, Text, TypeVar from google.protobuf.descriptor import EnumDescriptor @@ -11,8 +11,8 @@ class _EnumTypeWrapper(Generic[_V]): def __init__(self, enum_type: EnumDescriptor) -> None: ... def Name(self, number: _V) -> str: ... def Value(self, name: Text | bytes) -> _V: ... - def keys(self) -> List[str]: ... - def values(self) -> List[_V]: ... - def items(self) -> List[Tuple[str, _V]]: ... + def keys(self) -> list[str]: ... + def values(self) -> list[_V]: ... + def items(self) -> list[tuple[str, _V]]: ... class EnumTypeWrapper(_EnumTypeWrapper[int]): ... diff --git a/stubs/protobuf/google/protobuf/internal/well_known_types.pyi b/stubs/protobuf/google/protobuf/internal/well_known_types.pyi index 6b6b95a197cf..ce4d188cfb0a 100644 --- a/stubs/protobuf/google/protobuf/internal/well_known_types.pyi +++ b/stubs/protobuf/google/protobuf/internal/well_known_types.pyi @@ -1,5 +1,5 @@ from datetime import datetime, timedelta -from typing import Any as tAny, Dict, Optional, Type +from typing import Any as tAny, Optional class Error(Exception): ... class ParseError(Error): ... @@ -91,4 +91,4 @@ class ListValue: def add_struct(self): ... def add_list(self): ... -WKTBASES: Dict[str, Type[tAny]] +WKTBASES: dict[str, type[tAny]] diff --git a/stubs/protobuf/google/protobuf/json_format.pyi b/stubs/protobuf/google/protobuf/json_format.pyi index 75fda13431a6..6ecc10c520ca 100644 --- a/stubs/protobuf/google/protobuf/json_format.pyi +++ b/stubs/protobuf/google/protobuf/json_format.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Text, TypeVar, Union +from typing import Any, Optional, Text, TypeVar, Union from google.protobuf.descriptor_pool import DescriptorPool from google.protobuf.message import Message @@ -26,7 +26,7 @@ def MessageToDict( use_integers_for_enums: bool = ..., descriptor_pool: Optional[DescriptorPool] = ..., float_precision: Optional[int] = ..., -) -> Dict[Text, Any]: ... +) -> dict[Text, Any]: ... def Parse( text: Union[bytes, Text], message: _MessageT, diff --git a/stubs/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index 9e23bae8f622..55f087701af3 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -1,4 +1,4 @@ -from typing import Any, Sequence, Tuple, Type, TypeVar +from typing import Any, Sequence, TypeVar from .descriptor import Descriptor, FieldDescriptor from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor @@ -23,12 +23,12 @@ class Message: def ParseFromString(self, serialized: bytes) -> int: ... def SerializeToString(self, deterministic: bool = ...) -> bytes: ... def SerializePartialToString(self, deterministic: bool = ...) -> bytes: ... - def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ... + def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ... def HasExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> bool: ... def ClearExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> None: ... def ByteSize(self) -> int: ... @classmethod - def FromString(cls: Type[_M], s: bytes) -> _M: ... + def FromString(cls: type[_M], s: bytes) -> _M: ... @property def Extensions(self: _M) -> _ExtensionDict[_M]: ... # Intentionally left out typing on these three methods, because they are diff --git a/stubs/protobuf/google/protobuf/message_factory.pyi b/stubs/protobuf/google/protobuf/message_factory.pyi index d8a42d30bc65..ae299d8aeb69 100644 --- a/stubs/protobuf/google/protobuf/message_factory.pyi +++ b/stubs/protobuf/google/protobuf/message_factory.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterable, Optional, Type +from typing import Any, Iterable, Optional from google.protobuf.descriptor import Descriptor from google.protobuf.descriptor_pb2 import FileDescriptorProto @@ -8,7 +8,7 @@ from google.protobuf.message import Message class MessageFactory: pool: Any def __init__(self, pool: Optional[DescriptorPool] = ...) -> None: ... - def GetPrototype(self, descriptor: Descriptor) -> Type[Message]: ... - def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ... + def GetPrototype(self, descriptor: Descriptor) -> type[Message]: ... + def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ... -def GetMessages(file_protos: Iterable[FileDescriptorProto]) -> Dict[str, Type[Message]]: ... +def GetMessages(file_protos: Iterable[FileDescriptorProto]) -> dict[str, type[Message]]: ... diff --git a/stubs/protobuf/google/protobuf/service.pyi b/stubs/protobuf/google/protobuf/service.pyi index 4874d5356ded..7f7a762ac9fa 100644 --- a/stubs/protobuf/google/protobuf/service.pyi +++ b/stubs/protobuf/google/protobuf/service.pyi @@ -1,5 +1,5 @@ from concurrent.futures import Future -from typing import Callable, Optional, Text, Type +from typing import Callable, Optional, Text from google.protobuf.descriptor import MethodDescriptor, ServiceDescriptor from google.protobuf.message import Message @@ -16,8 +16,8 @@ class Service: request: Message, done: Optional[Callable[[Message], None]], ) -> Optional[Future[Message]]: ... - def GetRequestClass(self, method_descriptor: MethodDescriptor) -> Type[Message]: ... - def GetResponseClass(self, method_descriptor: MethodDescriptor) -> Type[Message]: ... + def GetRequestClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ... + def GetResponseClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ... class RpcController: def Reset(self) -> None: ... @@ -34,6 +34,6 @@ class RpcChannel: method_descriptor: MethodDescriptor, rpc_controller: RpcController, request: Message, - response_class: Type[Message], + response_class: type[Message], done: Optional[Callable[[Message], None]], ) -> Optional[Future[Message]]: ... diff --git a/stubs/protobuf/google/protobuf/symbol_database.pyi b/stubs/protobuf/google/protobuf/symbol_database.pyi index 09e32e9de2f7..0644a9be82f3 100644 --- a/stubs/protobuf/google/protobuf/symbol_database.pyi +++ b/stubs/protobuf/google/protobuf/symbol_database.pyi @@ -1,16 +1,16 @@ -from typing import Dict, Iterable, Type, Union +from typing import Iterable, Union from google.protobuf.descriptor import Descriptor, EnumDescriptor, FileDescriptor, ServiceDescriptor from google.protobuf.message import Message from google.protobuf.message_factory import MessageFactory class SymbolDatabase(MessageFactory): - def RegisterMessage(self, message: Union[Type[Message], Message]) -> Union[Type[Message], Message]: ... + def RegisterMessage(self, message: Union[type[Message], Message]) -> Union[type[Message], Message]: ... def RegisterMessageDescriptor(self, message_descriptor: Descriptor) -> None: ... def RegisterEnumDescriptor(self, enum_descriptor: EnumDescriptor) -> EnumDescriptor: ... def RegisterServiceDescriptor(self, service_descriptor: ServiceDescriptor) -> None: ... def RegisterFileDescriptor(self, file_descriptor: FileDescriptor) -> None: ... - def GetSymbol(self, symbol: str) -> Type[Message]: ... - def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ... + def GetSymbol(self, symbol: str) -> type[Message]: ... + def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ... def Default(): ... diff --git a/stubs/protobuf/google/protobuf/text_format.pyi b/stubs/protobuf/google/protobuf/text_format.pyi index 52f866047f17..f70959d02b47 100644 --- a/stubs/protobuf/google/protobuf/text_format.pyi +++ b/stubs/protobuf/google/protobuf/text_format.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsWrite -from typing import Any, Callable, Iterable, Optional, Text, Tuple, TypeVar, Union +from typing import Any, Callable, Iterable, Optional, Text, TypeVar, Union from .descriptor import FieldDescriptor from .descriptor_pool import DescriptorPool @@ -190,7 +190,7 @@ class Tokenizer: def TryConsume(self, token: str) -> bool: ... def Consume(self, token: str) -> None: ... def ConsumeComment(self) -> str: ... - def ConsumeCommentOrTrailingComment(self) -> Tuple[bool, str]: ... + def ConsumeCommentOrTrailingComment(self) -> tuple[bool, str]: ... def TryConsumeIdentifier(self) -> bool: ... def ConsumeIdentifier(self) -> str: ... def TryConsumeIdentifierOrNumber(self) -> bool: ... diff --git a/stubs/six/@python2/six/__init__.pyi b/stubs/six/@python2/six/__init__.pyi index 5c448102bd4a..3727d68344e5 100644 --- a/stubs/six/@python2/six/__init__.pyi +++ b/stubs/six/@python2/six/__init__.pyi @@ -17,8 +17,6 @@ from typing import ( NoReturn, Pattern, Text, - Tuple, - Type, TypeVar, ValuesView, overload, @@ -40,11 +38,11 @@ PY2: Literal[True] PY3: Literal[False] PY34: Literal[False] -string_types: tuple[Type[str], Type[unicode]] -integer_types: tuple[Type[int], Type[long]] -class_types: tuple[Type[Type[Any]], Type[types.ClassType]] -text_type: Type[unicode] -binary_type: Type[str] +string_types: tuple[type[str], type[unicode]] +integer_types: tuple[type[int], type[long]] +class_types: tuple[type[type[Any]], type[types.ClassType]] +text_type: type[unicode] +binary_type: type[str] MAXSIZE: int @@ -62,9 +60,9 @@ class Iterator: def get_method_function(meth: types.MethodType) -> types.FunctionType: ... def get_method_self(meth: types.MethodType) -> object | None: ... -def get_function_closure(fun: types.FunctionType) -> Tuple[types._Cell, ...] | None: ... +def get_function_closure(fun: types.FunctionType) -> tuple[types._Cell, ...] | None: ... def get_function_code(fun: types.FunctionType) -> types.CodeType: ... -def get_function_defaults(fun: types.FunctionType) -> Tuple[Any, ...] | None: ... +def get_function_defaults(fun: types.FunctionType) -> tuple[Any, ...] | None: ... def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ... def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ... def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ... @@ -89,9 +87,9 @@ def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ... @overload def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str = ...) -> None: ... -def reraise(tp: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ... +def reraise(tp: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ... def exec_(_code_: unicode | types.CodeType, _globs_: dict[str, Any] = ..., _locs_: dict[str, Any] = ...): ... -def raise_from(value: BaseException | Type[BaseException], from_value: BaseException | None) -> NoReturn: ... +def raise_from(value: BaseException | type[BaseException], from_value: BaseException | None) -> NoReturn: ... print_ = print @@ -105,7 +103,7 @@ def python_2_unicode_compatible(klass: _T) -> _T: ... class _LazyDescr(object): name: str def __init__(self, name: str) -> None: ... - def __get__(self, obj: object | None, type: Type[Any] | None = ...) -> Any: ... + def __get__(self, obj: object | None, type: type[Any] | None = ...) -> Any: ... class MovedModule(_LazyDescr): mod: str