|
| 1 | +# Stubs for poplib (Python 2 and 3) |
| 2 | + |
| 3 | +from mypy_extensions import NoReturn |
| 4 | +import socket |
| 5 | +import ssl |
| 6 | +import sys |
| 7 | +from typing import Any, BinaryIO, Dict, List, Optional, Pattern, Text, Tuple |
| 8 | + |
| 9 | +class error_proto(Exception): pass |
| 10 | + |
| 11 | +POP3_PORT: int |
| 12 | +POP3_SSL_PORT: int |
| 13 | +CR: bytes |
| 14 | +LF: bytes |
| 15 | +CRLF: bytes |
| 16 | + |
| 17 | + |
| 18 | +class POP3: |
| 19 | + if sys.version_info >= (3, 0): |
| 20 | + encoding: Text |
| 21 | + |
| 22 | + host: Text |
| 23 | + port: int |
| 24 | + sock: socket.socket |
| 25 | + file: BinaryIO |
| 26 | + welcome: bytes |
| 27 | + |
| 28 | + def __init__(self, host: Text, port: int = ..., timeout: float = ...) -> None: ... |
| 29 | + def getwelcome(self) -> bytes: ... |
| 30 | + def set_debuglevel(self, level: int) -> None: ... |
| 31 | + def user(self, user: Text) -> bytes: ... |
| 32 | + def pass_(self, pswd: Text) -> bytes: ... |
| 33 | + def stat(self) -> Tuple[int, int]: ... |
| 34 | + def list(self, which: Optional[Text] = ...) -> bytes: ... |
| 35 | + def retr(self, which: Text) -> bytes: ... |
| 36 | + def dele(self, which: Text) -> bytes: ... |
| 37 | + def noop(self) -> bytes: ... |
| 38 | + def rset(self) -> bytes: ... |
| 39 | + def quit(self) -> bytes: ... |
| 40 | + def close(self) -> None: ... |
| 41 | + def rpop(self, user: Text) -> bytes: ... |
| 42 | + |
| 43 | + timestamp: Pattern[Text] |
| 44 | + |
| 45 | + if sys.version_info < (3, 0): |
| 46 | + def apop(self, user: Text, secret: Text) -> bytes: ... |
| 47 | + else: |
| 48 | + def apop(self, user: Text, password: Text) -> bytes: ... |
| 49 | + def top(self, which: Text, howmuch: int) -> bytes: ... |
| 50 | + def uidl(self, which: Optional[Text] = ...) -> bytes: ... |
| 51 | + if sys.version_info >= (3, 5): |
| 52 | + def utf8(self) -> bytes: ... |
| 53 | + if sys.version_info >= (3, 4): |
| 54 | + def capa(self) -> Dict[Text, List[Text]]: ... |
| 55 | + def stls(self, context: Optional[ssl.SSLContext] = ...) -> bytes: ... |
| 56 | + |
| 57 | + |
| 58 | +class POP3_SSL(POP3): |
| 59 | + if sys.version_info >= (3, 0): |
| 60 | + def __init__(self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., |
| 61 | + timeout: float = ..., context: Optional[ssl.SSLContext] = ...) -> None: ... |
| 62 | + else: |
| 63 | + def __init__(self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., |
| 64 | + timeout: float = ...) -> None: ... |
| 65 | + |
| 66 | + if sys.version_info >= (3, 4): |
| 67 | + # "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored |
| 68 | + def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> bytes: ... |
0 commit comments