Skip to content

imaplib, nntplib, plistlib, poplib: use lower-case list and dict #5890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stdlib/imaplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 = ...
Expand Down
30 changes: 16 additions & 14 deletions stdlib/nntplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
Expand All @@ -49,31 +51,31 @@ 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]: ...
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]]]]: ...
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: ...
Expand Down
4 changes: 2 additions & 2 deletions stdlib/plistlib.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: ...
Expand Down
4 changes: 2 additions & 2 deletions stdlib/poplib.pyi
Original file line number Diff line number Diff line change
@@ -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]

Expand Down Expand Up @@ -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):
Expand Down