diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index a5c4a31780d6..809772598dcc 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -5,7 +5,7 @@ from _typeshed import Self from socket import socket as _socket from ssl import SSLContext, SSLSocket from types import TracebackType -from typing import IO, Any, Callable, Dict, List, Pattern, Tuple, Type, Union +from typing import IO, Any, Callable, List, Pattern, Tuple, Type, Union from typing_extensions import Literal # TODO: Commands should use their actual return types, not this type alias. @@ -22,8 +22,8 @@ class IMAP4: debug: int = ... state: str = ... literal: str | 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 = ... diff --git a/stdlib/nntplib.pyi b/stdlib/nntplib.pyi index f06b278134b2..4acb8b210a7a 100644 --- a/stdlib/nntplib.pyi +++ b/stdlib/nntplib.pyi @@ -3,7 +3,7 @@ import socket import ssl import sys from _typeshed import Self -from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, Union +from typing import IO, Any, Iterable, NamedTuple, Tuple, Union _File = Union[IO[bytes], bytes, str, None] @@ -28,10 +28,12 @@ class GroupInfo(NamedTuple): class ArticleInfo(NamedTuple): number: int message_id: str - lines: List[bytes] + lines: list[bytes] def decode_header(header_str: str) -> str: ... +_list = list # conflicts with a method named "list" + class _NNTPBase: encoding: str errors: str @@ -49,17 +51,17 @@ 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 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 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]: ... @@ -67,13 +69,13 @@ class _NNTPBase: 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]]]]: ... + self, message_spec: None | str | _list[Any] | Tuple[Any, ...], *, file: _File = ... + ) -> Tuple[str, _list[Tuple[int, dict[str, str]]]]: ... if sys.version_info < (3, 9): - def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[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: ... diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 26de8f77eb39..3b5c2b78c81a 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -1,6 +1,6 @@ import sys from enum import Enum -from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Type +from typing import IO, Any, Dict as _Dict, Mapping, MutableMapping, Type class PlistFormat(Enum): FMT_XML: int @@ -41,7 +41,7 @@ if sys.version_info < (3, 9): def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ... if sys.version_info < (3, 7): - 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/poplib.pyi b/stdlib/poplib.pyi index 79447c597f20..8d19067f0445 100644 --- a/stdlib/poplib.pyi +++ b/stdlib/poplib.pyi @@ -1,6 +1,6 @@ import socket import ssl -from typing import Any, BinaryIO, Dict, List, Pattern, Tuple, overload +from typing import Any, BinaryIO, List, Pattern, Tuple, overload _LongResp = Tuple[bytes, List[bytes], int] @@ -41,7 +41,7 @@ class POP3: @overload def uidl(self, which: Any) -> bytes: ... def utf8(self) -> bytes: ... - def capa(self) -> Dict[str, List[str]]: ... + def capa(self) -> dict[str, List[str]]: ... def stls(self, context: ssl.SSLContext | None = ...) -> bytes: ... class POP3_SSL(POP3):