| 1 |
import socket |
| 2 |
import ssl |
| 3 |
import sys |
| 4 |
from _typeshed import StrOrBytesPath |
| 5 |
from builtins import list as _list |
| 6 |
from re import Pattern |
| 7 |
from typing import Any, BinaryIO, Final, NoReturn, overload |
| 8 |
from typing_extensions import TypeAlias, deprecated |
| 9 |
|
| 10 |
__all__ = ["POP3", "error_proto", "POP3_SSL"] |
| 11 |
|
| 12 |
_LongResp: TypeAlias = tuple[bytes, list[bytes], int] |
| 13 |
|
| 14 |
class error_proto(Exception): ... |
| 15 |
|
| 16 |
POP3_PORT: Final = 110 |
| 17 |
POP3_SSL_PORT: Final = 995 |
| 18 |
CR: Final = b"\r" |
| 19 |
LF: Final = b"\n" |
| 20 |
CRLF: Final = b"\r\n" |
| 21 |
HAVE_SSL: Final[bool] |
| 22 |
|
| 23 |
class POP3: |
| 24 |
encoding: str |
| 25 |
host: str |
| 26 |
port: int |
| 27 |
sock: socket.socket |
| 28 |
file: BinaryIO |
| 29 |
welcome: bytes |
| 30 |
def __init__(self, host: str, port: int = 110, timeout: float = ...) -> None: ... |
| 31 |
def getwelcome(self) -> bytes: ... |
| 32 |
def set_debuglevel(self, level: int) -> None: ... |
| 33 |
def user(self, user: str) -> bytes: ... |
| 34 |
def pass_(self, pswd: str) -> bytes: ... |
| 35 |
def stat(self) -> tuple[int, int]: ... |
| 36 |
def list(self, which: Any | None = None) -> _LongResp: ... |
| 37 |
def retr(self, which: Any) -> _LongResp: ... |
| 38 |
def dele(self, which: Any) -> bytes: ... |
| 39 |
def noop(self) -> bytes: ... |
| 40 |
def rset(self) -> bytes: ... |
| 41 |
def quit(self) -> bytes: ... |
| 42 |
def close(self) -> None: ... |
| 43 |
def rpop(self, user: str) -> bytes: ... |
| 44 |
timestamp: Pattern[str] |
| 45 |
def apop(self, user: str, password: str) -> bytes: ... |
| 46 |
def top(self, which: Any, howmuch: int) -> _LongResp: ... |
| 47 |
@overload |
| 48 |
def uidl(self) -> _LongResp: ... |
| 49 |
@overload |
| 50 |
def uidl(self, which: Any) -> bytes: ... |
| 51 |
def utf8(self) -> bytes: ... |
| 52 |
def capa(self) -> dict[str, _list[str]]: ... |
| 53 |
def stls(self, context: ssl.SSLContext | None = None) -> bytes: ... |
| 54 |
|
| 55 |
class POP3_SSL(POP3): |
| 56 |
if sys.version_info >= (3, 12): |
| 57 |
def __init__( |
| 58 |
self, host: str, port: int = 995, *, timeout: float = ..., context: ssl.SSLContext | None = None |
| 59 |
) -> None: ... |
| 60 |
def stls(self, context: Any = None) -> NoReturn: ... |
| 61 |
else: |
| 62 |
@overload |
| 63 |
def __init__( |
| 64 |
self, |
| 65 |
host: str, |
| 66 |
port: int = 995, |
| 67 |
keyfile: None = None, |
| 68 |
certfile: None = None, |
| 69 |
timeout: float = ..., |
| 70 |
context: ssl.SSLContext | None = None, |
| 71 |
) -> None: ... |
| 72 |
@overload |
| 73 |
@deprecated( |
| 74 |
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; " |
| 75 |
"removed in Python 3.12. Use `context` parameter instead." |
| 76 |
) |
| 77 |
def __init__( |
| 78 |
self, |
| 79 |
host: str, |
| 80 |
port: int = 995, |
| 81 |
keyfile: StrOrBytesPath | None = None, |
| 82 |
certfile: StrOrBytesPath | None = None, |
| 83 |
timeout: float = ..., |
| 84 |
context: None = None, |
| 85 |
) -> None: ... |
| 86 |
keyfile: StrOrBytesPath | None |
| 87 |
certfile: StrOrBytesPath | None |
| 88 |
|
| 89 |
|
| 90 |
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ... |