From 3e638aa3c301b0401e26e1fa92d208e7974d8a36 Mon Sep 17 00:00:00 2001 From: Reid Swan Date: Fri, 13 Dec 2019 13:05:57 +0200 Subject: [PATCH] Add __enter__, __exit__ to IMAP4, make __init__ arguments optional (#3540) Fixes #3537 --- stdlib/2and3/imaplib.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/2and3/imaplib.pyi b/stdlib/2and3/imaplib.pyi index 07272ce02..07f770dfb 100644 --- a/stdlib/2and3/imaplib.pyi +++ b/stdlib/2and3/imaplib.pyi @@ -29,7 +29,7 @@ class IMAP4: welcome: bytes = ... capabilities: Tuple[str] = ... PROTOCOL_VERSION: str = ... - def __init__(self, host: str, port: int) -> None: ... + def __init__(self, host: str = ..., port: int = ...) -> None: ... def __getattr__(self, attr: str) -> Any: ... host: str = ... port: int = ... @@ -54,6 +54,8 @@ class IMAP4: def deleteacl(self, mailbox: str, who: str) -> CommandResults: ... if sys.version_info >= (3, 5): def enable(self, capability: str) -> CommandResults: ... + def __enter__(self) -> IMAP4: ... + def __exit__(self, *args) -> None: ... def expunge(self) -> CommandResults: ... def fetch(self, message_set: str, message_parts: str) -> CommandResults: ... def getacl(self, mailbox: str) -> CommandResults: ...