check_new_syntax.py: check nested annotations (#6167)

This commit is contained in:
Akuli
2021-10-13 21:28:38 +00:00
committed by GitHub
parent f30b5ae363
commit 75ca712f3c
6 changed files with 28 additions and 24 deletions

View File

@@ -14,6 +14,8 @@ _CommandResults = Tuple[str, List[Any]]
_AnyResponseData = Union[List[None], List[Union[bytes, Tuple[bytes, bytes]]]]
_list = list # conflicts with a method named "list"
class IMAP4:
error: Type[Exception]
abort: Type[Exception]
@@ -22,8 +24,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
@@ -69,23 +71,23 @@ class IMAP4:
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 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 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: ...
def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ...
def starttls(self, ssl_context: Any | None = ...) -> Tuple[Literal["OK"], List[None]]: ...
def starttls(self, ssl_context: Any | None = ...) -> Tuple[Literal["OK"], _list[None]]: ...
def status(self, mailbox: str, names: str) -> _CommandResults: ...
def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ...
def subscribe(self, mailbox: str) -> _CommandResults: ...

View File

@@ -38,7 +38,7 @@ class MapResult(ApplyResult[List[_T]]):
pool: Pool,
chunksize: int,
length: int,
callback: Callable[[List[_T]], None] | None,
callback: Callable[[list[_T]], None] | None,
error_callback: Callable[[BaseException], None] | None,
) -> None: ...
else:
@@ -47,7 +47,7 @@ class MapResult(ApplyResult[List[_T]]):
cache: dict[int, ApplyResult[Any]],
chunksize: int,
length: int,
callback: Callable[[List[_T]], None] | None,
callback: Callable[[list[_T]], None] | None,
error_callback: Callable[[BaseException], None] | None,
) -> None: ...

View File

@@ -12,6 +12,8 @@ CR: bytes
LF: bytes
CRLF: bytes
_list = list # conflicts with a method named "list"
class POP3:
encoding: str
host: str
@@ -41,7 +43,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):