Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24780a3

Browse files
authored
imaplib, nntplib, plistlib, poplib: use lower-case list and dict (#5890)
1 parent ce11072 commit 24780a3

4 files changed

Lines changed: 23 additions & 21 deletions

File tree

stdlib/imaplib.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from _typeshed import Self
55
from socket import socket as _socket
66
from ssl import SSLContext, SSLSocket
77
from types import TracebackType
8-
from typing import IO, Any, Callable, Dict, List, Pattern, Tuple, Type, Union
8+
from typing import IO, Any, Callable, List, Pattern, Tuple, Type, Union
99
from typing_extensions import Literal
1010

1111
# TODO: Commands should use their actual return types, not this type alias.
@@ -22,8 +22,8 @@ class IMAP4:
2222
debug: int = ...
2323
state: str = ...
2424
literal: str | None = ...
25-
tagged_commands: Dict[bytes, List[bytes] | None]
26-
untagged_responses: Dict[str, List[bytes | Tuple[bytes, bytes]]]
25+
tagged_commands: dict[bytes, List[bytes] | None]
26+
untagged_responses: dict[str, List[bytes | Tuple[bytes, bytes]]]
2727
continuation_response: str = ...
2828
is_readonly: bool = ...
2929
tagnum: int = ...

stdlib/nntplib.pyi

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import socket
33
import ssl
44
import sys
55
from _typeshed import Self
6-
from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, Union
6+
from typing import IO, Any, Iterable, NamedTuple, Tuple, Union
77

88
_File = Union[IO[bytes], bytes, str, None]
99

@@ -28,10 +28,12 @@ class GroupInfo(NamedTuple):
2828
class ArticleInfo(NamedTuple):
2929
number: int
3030
message_id: str
31-
lines: List[bytes]
31+
lines: list[bytes]
3232

3333
def decode_header(header_str: str) -> str: ...
3434

35+
_list = list # conflicts with a method named "list"
36+
3537
class _NNTPBase:
3638
encoding: str
3739
errors: str
@@ -49,31 +51,31 @@ class _NNTPBase:
4951
def __enter__(self: Self) -> Self: ...
5052
def __exit__(self, *args: Any) -> None: ...
5153
def getwelcome(self) -> str: ...
52-
def getcapabilities(self) -> Dict[str, List[str]]: ...
54+
def getcapabilities(self) -> dict[str, _list[str]]: ...
5355
def set_debuglevel(self, level: int) -> None: ...
5456
def debug(self, level: int) -> None: ...
55-
def capabilities(self) -> Tuple[str, Dict[str, List[str]]]: ...
56-
def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ...
57-
def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ...
58-
def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> Tuple[str, List[str]]: ...
57+
def capabilities(self) -> Tuple[str, dict[str, _list[str]]]: ...
58+
def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, _list[str]]: ...
59+
def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, _list[str]]: ...
60+
def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> Tuple[str, _list[str]]: ...
5961
def description(self, group: str) -> str: ...
60-
def descriptions(self, group_pattern: str) -> Tuple[str, Dict[str, str]]: ...
62+
def descriptions(self, group_pattern: str) -> Tuple[str, dict[str, str]]: ...
6163
def group(self, name: str) -> Tuple[str, int, int, int, str]: ...
62-
def help(self, *, file: _File = ...) -> Tuple[str, List[str]]: ...
64+
def help(self, *, file: _File = ...) -> Tuple[str, _list[str]]: ...
6365
def stat(self, message_spec: Any = ...) -> Tuple[str, int, str]: ...
6466
def next(self) -> Tuple[str, int, str]: ...
6567
def last(self) -> Tuple[str, int, str]: ...
6668
def head(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ...
6769
def body(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ...
6870
def article(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ...
6971
def slave(self) -> str: ...
70-
def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, List[str]]: ...
71-
def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ...
72+
def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, _list[str]]: ...
73+
def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, _list[Tuple[int, dict[str, str]]]]: ...
7274
def over(
73-
self, message_spec: None | str | List[Any] | Tuple[Any, ...], *, file: _File = ...
74-
) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ...
75+
self, message_spec: None | str | _list[Any] | Tuple[Any, ...], *, file: _File = ...
76+
) -> Tuple[str, _list[Tuple[int, dict[str, str]]]]: ...
7577
if sys.version_info < (3, 9):
76-
def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ...
78+
def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, _list[Tuple[str, str]]]: ...
7779
def xpath(self, id: Any) -> Tuple[str, str]: ...
7880
def date(self) -> Tuple[str, datetime.datetime]: ...
7981
def post(self, data: bytes | Iterable[bytes]) -> str: ...

stdlib/plistlib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from enum import Enum
3-
from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Type
3+
from typing import IO, Any, Dict as _Dict, Mapping, MutableMapping, Type
44

55
class PlistFormat(Enum):
66
FMT_XML: int
@@ -41,7 +41,7 @@ if sys.version_info < (3, 9):
4141
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
4242

4343
if sys.version_info < (3, 7):
44-
class Dict(DictT[str, Any]):
44+
class Dict(_Dict[str, Any]):
4545
def __getattr__(self, attr: str) -> Any: ...
4646
def __setattr__(self, attr: str, value: Any) -> None: ...
4747
def __delattr__(self, attr: str) -> None: ...

stdlib/poplib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import socket
22
import ssl
3-
from typing import Any, BinaryIO, Dict, List, Pattern, Tuple, overload
3+
from typing import Any, BinaryIO, List, Pattern, Tuple, overload
44

55
_LongResp = Tuple[bytes, List[bytes], int]
66

@@ -41,7 +41,7 @@ class POP3:
4141
@overload
4242
def uidl(self, which: Any) -> bytes: ...
4343
def utf8(self) -> bytes: ...
44-
def capa(self) -> Dict[str, List[str]]: ...
44+
def capa(self) -> dict[str, List[str]]: ...
4545
def stls(self, context: ssl.SSLContext | None = ...) -> bytes: ...
4646

4747
class POP3_SSL(POP3):

0 commit comments

Comments
 (0)