--- /dev/null
+# Stubs for imaplib (Python 2)\r
+\r
+import imaplib\r
+import subprocess\r
+import sys\r
+import time\r
+from socket import socket as _socket\r
+from ssl import SSLSocket\r
+from typing import Any, Callable, Dict, IO, List, Optional, Pattern, Text, Tuple, Type, Union\r
+\r
+CommandResults = Tuple[str, List[Any]]\r
+\r
+\r
+class IMAP4:\r
+ error: Type[Exception] = ...\r
+ abort: Type[Exception] = ...\r
+ readonly: Type[Exception] = ...\r
+ mustquote: Pattern[Text] = ...\r
+ debug: int = ...\r
+ state: str = ...\r
+ literal: Optional[Text] = ...\r
+ tagged_commands: Dict[str, str] = ...\r
+ untagged_responses: Dict[str, str] = ...\r
+ continuation_response: str = ...\r
+ is_readonly: bool = ...\r
+ tagnum: int = ...\r
+ tagpre: str = ...\r
+ tagre: Pattern[Text] = ...\r
+ welcome: bytes = ...\r
+ capabilities: Tuple[str] = ...\r
+ PROTOCOL_VERSION: str = ...\r
+ def __init__(self, host: str, port: int) -> None: ...\r
+ def __getattr__(self, attr: str) -> Any: ...\r
+ host: str = ...\r
+ port: int = ...\r
+ sock: _socket = ...\r
+ file: Union[IO[Text], IO[bytes]] = ...\r
+ def open(self, host: str = ..., port: int = ...) -> None: ...\r
+ def read(self, size: int) -> bytes: ...\r
+ def readline(self) -> bytes: ...\r
+ def send(self, data: bytes) -> None: ...\r
+ def shutdown(self) -> None: ...\r
+ def socket(self) -> _socket: ...\r
+ def recent(self) -> CommandResults: ...\r
+ def response(self, code: str) -> CommandResults: ...\r
+ def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ...\r
+ def authenticate(self, mechanism: str, authobject: Callable) -> Tuple[str, str]: ...\r
+ def capability(self) -> CommandResults: ...\r
+ def check(self) -> CommandResults: ...\r
+ def close(self) -> CommandResults: ...\r
+ def copy(self, message_set: str, new_mailbox: str) -> CommandResults: ...\r
+ def create(self, mailbox: str) -> CommandResults: ...\r
+ def delete(self, mailbox: str) -> CommandResults: ...\r
+ def deleteacl(self, mailbox: str, who: str) -> CommandResults: ...\r
+ def expunge(self) -> CommandResults: ...\r
+ def fetch(self, message_set: str, message_parts: str) -> CommandResults: ...\r
+ def getacl(self, mailbox: str) -> CommandResults: ...\r
+ def getannotation(self, mailbox: str, entry: str, attribute: str) -> CommandResults: ...\r
+ def getquota(self, root: str) -> CommandResults: ...\r
+ def getquotaroot(self, mailbox: str) -> CommandResults: ...\r
+ def list(self, directory: str = ..., pattern: str = ...) -> CommandResults: ...\r
+ def login(self, user: str, password: str) -> CommandResults: ...\r
+ def login_cram_md5(self, user: str, password: str) -> CommandResults: ...\r
+ def logout(self) -> CommandResults: ...\r
+ def lsub(self, directory: str = ..., pattern: str = ...) -> CommandResults: ...\r
+ def myrights(self, mailbox: str) -> CommandResults: ...\r
+ def namespace(self) -> CommandResults: ...\r
+ def noop(self) -> CommandResults: ...\r
+ def partial(self, message_num: str, message_part: str, start: str, length: str) -> CommandResults: ...\r
+ def proxyauth(self, user: str) -> CommandResults: ...\r
+ def rename(self, oldmailbox: str, newmailbox: str) -> CommandResults: ...\r
+ def search(self, charset: str, *criteria: str) -> CommandResults: ...\r
+ def select(self, mailbox: str = ..., readonly: bool = ...) -> CommandResults: ...\r
+ def setacl(self, mailbox: str, who: str, what: str) -> CommandResults: ...\r
+ def setannotation(self, *args: List[str]) -> CommandResults: ...\r
+ def setquota(self, root: str, limits: str) -> CommandResults: ...\r
+ def sort(self, sort_criteria: str, charset: str, *search_criteria: List[str]) -> CommandResults: ...\r
+ if sys.version_info >= (3,):\r
+ def starttls(self, ssl_context: Optional[Any] = ...) -> CommandResults: ...\r
+ def status(self, mailbox: str, names: str) -> CommandResults: ...\r
+ def store(self, message_set: str, command: str, flags: str) -> CommandResults: ...\r
+ def subscribe(self, mailbox: str) -> CommandResults: ...\r
+ def thread(self, threading_algorithm: str, charset: str, *search_criteria: List[str]) -> CommandResults: ...\r
+ def uid(self, command: str, *args: List[str]) -> CommandResults: ...\r
+ def unsubscribe(self, mailbox: str) -> CommandResults: ...\r
+ def xatom(self, name: str, *args: List[str]) -> CommandResults: ...\r
+ def print_log(self) -> None: ...\r
+\r
+class IMAP4_SSL(IMAP4):\r
+ keyfile: str = ...\r
+ certfile: str = ...\r
+ def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ...\r
+ host: str = ...\r
+ port: int = ...\r
+ sock: _socket = ...\r
+ sslobj: SSLSocket = ...\r
+ file: IO[Any] = ...\r
+ def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...\r
+ def read(self, size: int) -> bytes: ...\r
+ def readline(self) -> bytes: ...\r
+ def send(self, data: bytes) -> None: ...\r
+ def shutdown(self) -> None: ...\r
+ def socket(self) -> _socket: ...\r
+ def ssl(self) -> SSLSocket: ...\r
+\r
+\r
+class IMAP4_stream(IMAP4):\r
+ command: str = ...\r
+ def __init__(self, command: str) -> None: ...\r
+ host: str = ...\r
+ port: int = ...\r
+ sock: _socket = ...\r
+ file: IO[Any] = ...\r
+ process: subprocess.Popen = ...\r
+ writefile: IO[Any] = ...\r
+ readfile: IO[Any] = ...\r
+ def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...\r
+ def read(self, size: int) -> bytes: ...\r
+ def readline(self) -> bytes: ...\r
+ def send(self, data: bytes) -> None: ...\r
+ def shutdown(self) -> None: ...\r
+\r
+class _Authenticator:\r
+ mech: Callable = ...\r
+ def __init__(self, mechinst: Callable) -> None: ...\r
+ def process(self, data: str) -> str: ...\r
+ def encode(self, inp: bytes) -> str: ...\r
+ def decode(self, inp: str) -> bytes: ...\r
+\r
+def Internaldate2tuple(resp: str) -> time.struct_time: ...\r
+def Int2AP(num: int) -> str: ...\r
+def ParseFlags(resp: str) -> Tuple[str]: ...\r
+def Time2Internaldate(date_time: Union[float, time.struct_time, str]) -> str: ...\r