1 # Stubs for imaplib (Python 2)
\r
7 from socket import socket as _socket
\r
8 from ssl import SSLSocket
\r
9 from typing import Any, Callable, Dict, IO, List, Optional, Pattern, Text, Tuple, Type, Union
\r
11 CommandResults = Tuple[str, List[Any]]
\r
15 error: Type[Exception] = ...
\r
16 abort: Type[Exception] = ...
\r
17 readonly: Type[Exception] = ...
\r
18 mustquote: Pattern[Text] = ...
\r
21 literal: Optional[Text] = ...
\r
22 tagged_commands: Dict[str, str] = ...
\r
23 untagged_responses: Dict[str, str] = ...
\r
24 continuation_response: str = ...
\r
25 is_readonly: bool = ...
\r
28 tagre: Pattern[Text] = ...
\r
29 welcome: bytes = ...
\r
30 capabilities: Tuple[str] = ...
\r
31 PROTOCOL_VERSION: str = ...
\r
32 def __init__(self, host: str, port: int) -> None: ...
\r
33 def __getattr__(self, attr: str) -> Any: ...
\r
37 file: Union[IO[Text], IO[bytes]] = ...
\r
38 def open(self, host: str = ..., port: int = ...) -> None: ...
\r
39 def read(self, size: int) -> bytes: ...
\r
40 def readline(self) -> bytes: ...
\r
41 def send(self, data: bytes) -> None: ...
\r
42 def shutdown(self) -> None: ...
\r
43 def socket(self) -> _socket: ...
\r
44 def recent(self) -> CommandResults: ...
\r
45 def response(self, code: str) -> CommandResults: ...
\r
46 def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ...
\r
47 def authenticate(self, mechanism: str, authobject: Callable) -> Tuple[str, str]: ...
\r
48 def capability(self) -> CommandResults: ...
\r
49 def check(self) -> CommandResults: ...
\r
50 def close(self) -> CommandResults: ...
\r
51 def copy(self, message_set: str, new_mailbox: str) -> CommandResults: ...
\r
52 def create(self, mailbox: str) -> CommandResults: ...
\r
53 def delete(self, mailbox: str) -> CommandResults: ...
\r
54 def deleteacl(self, mailbox: str, who: str) -> CommandResults: ...
\r
55 def expunge(self) -> CommandResults: ...
\r
56 def fetch(self, message_set: str, message_parts: str) -> CommandResults: ...
\r
57 def getacl(self, mailbox: str) -> CommandResults: ...
\r
58 def getannotation(self, mailbox: str, entry: str, attribute: str) -> CommandResults: ...
\r
59 def getquota(self, root: str) -> CommandResults: ...
\r
60 def getquotaroot(self, mailbox: str) -> CommandResults: ...
\r
61 def list(self, directory: str = ..., pattern: str = ...) -> CommandResults: ...
\r
62 def login(self, user: str, password: str) -> CommandResults: ...
\r
63 def login_cram_md5(self, user: str, password: str) -> CommandResults: ...
\r
64 def logout(self) -> CommandResults: ...
\r
65 def lsub(self, directory: str = ..., pattern: str = ...) -> CommandResults: ...
\r
66 def myrights(self, mailbox: str) -> CommandResults: ...
\r
67 def namespace(self) -> CommandResults: ...
\r
68 def noop(self) -> CommandResults: ...
\r
69 def partial(self, message_num: str, message_part: str, start: str, length: str) -> CommandResults: ...
\r
70 def proxyauth(self, user: str) -> CommandResults: ...
\r
71 def rename(self, oldmailbox: str, newmailbox: str) -> CommandResults: ...
\r
72 def search(self, charset: str, *criteria: str) -> CommandResults: ...
\r
73 def select(self, mailbox: str = ..., readonly: bool = ...) -> CommandResults: ...
\r
74 def setacl(self, mailbox: str, who: str, what: str) -> CommandResults: ...
\r
75 def setannotation(self, *args: List[str]) -> CommandResults: ...
\r
76 def setquota(self, root: str, limits: str) -> CommandResults: ...
\r
77 def sort(self, sort_criteria: str, charset: str, *search_criteria: List[str]) -> CommandResults: ...
\r
78 if sys.version_info >= (3,):
\r
79 def starttls(self, ssl_context: Optional[Any] = ...) -> CommandResults: ...
\r
80 def status(self, mailbox: str, names: str) -> CommandResults: ...
\r
81 def store(self, message_set: str, command: str, flags: str) -> CommandResults: ...
\r
82 def subscribe(self, mailbox: str) -> CommandResults: ...
\r
83 def thread(self, threading_algorithm: str, charset: str, *search_criteria: List[str]) -> CommandResults: ...
\r
84 def uid(self, command: str, *args: List[str]) -> CommandResults: ...
\r
85 def unsubscribe(self, mailbox: str) -> CommandResults: ...
\r
86 def xatom(self, name: str, *args: List[str]) -> CommandResults: ...
\r
87 def print_log(self) -> None: ...
\r
89 class IMAP4_SSL(IMAP4):
\r
92 def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ...
\r
96 sslobj: SSLSocket = ...
\r
98 def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
\r
99 def read(self, size: int) -> bytes: ...
\r
100 def readline(self) -> bytes: ...
\r
101 def send(self, data: bytes) -> None: ...
\r
102 def shutdown(self) -> None: ...
\r
103 def socket(self) -> _socket: ...
\r
104 def ssl(self) -> SSLSocket: ...
\r
107 class IMAP4_stream(IMAP4):
\r
109 def __init__(self, command: str) -> None: ...
\r
112 sock: _socket = ...
\r
113 file: IO[Any] = ...
\r
114 process: subprocess.Popen = ...
\r
115 writefile: IO[Any] = ...
\r
116 readfile: IO[Any] = ...
\r
117 def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
\r
118 def read(self, size: int) -> bytes: ...
\r
119 def readline(self) -> bytes: ...
\r
120 def send(self, data: bytes) -> None: ...
\r
121 def shutdown(self) -> None: ...
\r
123 class _Authenticator:
\r
124 mech: Callable = ...
\r
125 def __init__(self, mechinst: Callable) -> None: ...
\r
126 def process(self, data: str) -> str: ...
\r
127 def encode(self, inp: bytes) -> str: ...
\r
128 def decode(self, inp: str) -> bytes: ...
\r
130 def Internaldate2tuple(resp: str) -> time.struct_time: ...
\r
131 def Int2AP(num: int) -> str: ...
\r
132 def ParseFlags(resp: str) -> Tuple[str]: ...
\r
133 def Time2Internaldate(date_time: Union[float, time.struct_time, str]) -> str: ...
\r