From 2ba693978875d35b28bc6b71938812140364b898 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Fri, 26 Jun 2020 03:40:27 -0700 Subject: [PATCH] imaplib: update for py39 (#4271) --- stdlib/2and3/imaplib.pyi | 22 +++++++++++++++++----- tests/stubtest_whitelists/py3_common.txt | 1 - 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/stdlib/2and3/imaplib.pyi b/stdlib/2and3/imaplib.pyi index a5962a836..3304d610f 100644 --- a/stdlib/2and3/imaplib.pyi +++ b/stdlib/2and3/imaplib.pyi @@ -30,13 +30,17 @@ class IMAP4: welcome: bytes = ... capabilities: Tuple[str] = ... PROTOCOL_VERSION: str = ... - def __init__(self, host: str = ..., port: int = ...) -> None: ... + if sys.version_info >= (3, 9): + def __init__(self, host: str = ..., port: int = ..., timeout: Optional[float] = ...) -> None: ... + def open(self, host: str = ..., port: int = ..., timeout: Optional[float] = ...) -> None: ... + else: + def __init__(self, host: str = ..., port: int = ...) -> None: ... + def open(self, host: str = ..., port: int = ...) -> None: ... def __getattr__(self, attr: str) -> Any: ... host: str = ... port: int = ... sock: _socket = ... file: Union[IO[Text], IO[bytes]] = ... - def open(self, host: str = ..., port: int = ...) -> None: ... def read(self, size: int) -> bytes: ... def readline(self) -> bytes: ... def send(self, data: bytes) -> None: ... @@ -94,7 +98,9 @@ class IMAP4: class IMAP4_SSL(IMAP4): keyfile: str = ... certfile: str = ... - if sys.version_info >= (3, 3): + if sys.version_info >= (3, 9): + def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ..., ssl_context: Optional[SSLContext] = ..., timeout: Optional[float] = ...) -> None: ... + elif sys.version_info >= (3, 3): def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ..., ssl_context: Optional[SSLContext] = ...) -> None: ... else: def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ... @@ -103,7 +109,10 @@ class IMAP4_SSL(IMAP4): sock: _socket = ... sslobj: SSLSocket = ... file: IO[Any] = ... - def open(self, host: str = ..., port: Optional[int] = ...) -> None: ... + if sys.version_info >= (3, 9): + def open(self, host: str = ..., port: Optional[int] = ..., timeout: Optional[float] = ...) -> None: ... + else: + def open(self, host: str = ..., port: Optional[int] = ...) -> None: ... def read(self, size: int) -> bytes: ... def readline(self) -> bytes: ... def send(self, data: bytes) -> None: ... @@ -122,7 +131,10 @@ class IMAP4_stream(IMAP4): process: subprocess.Popen[bytes] = ... writefile: IO[Any] = ... readfile: IO[Any] = ... - def open(self, host: str = ..., port: Optional[int] = ...) -> None: ... + if sys.version_info >= (3, 9): + def open(self, host: Optional[str] = ..., port: Optional[int] = ..., timeout: Optional[float] = ...) -> None: ... + else: + def open(self, host: Optional[str] = ..., port: Optional[int] = ...) -> None: ... def read(self, size: int) -> bytes: ... def readline(self) -> bytes: ... def send(self, data: bytes) -> None: ... diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 450e83267..2f29f37be 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -216,7 +216,6 @@ http.cookies.Morsel.setdefault http.cookies.Morsel.update http.server.HTTPServer.__init__ imaplib.IMAP4_SSL.ssl -imaplib.IMAP4_stream.open importlib.abc.FileLoader.get_filename importlib.abc.Loader.exec_module importlib.abc.MetaPathFinder.find_spec