Debian Codegraph @

jedi/third_party/typeshed/stdlib/smtpd.pyi

raw symbols SCIP
1 import asynchat
2 import asyncore
3 import socket
4 import sys
5 from collections import defaultdict
6 from typing import Any
7 from typing_extensions import TypeAlias, deprecated
8
9 if sys.version_info >= (3, 11):
10 __all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy"]
11 else:
12 __all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy", "MailmanProxy"]
13
14 _Address: TypeAlias = tuple[str, int] # (host, port)
15
16 class SMTPChannel(asynchat.async_chat):
17 COMMAND: int
18 DATA: int
19
20 command_size_limits: defaultdict[str, int]
21 smtp_server: SMTPServer
22 conn: socket.socket
23 addr: Any
24 received_lines: list[str]
25 smtp_state: int
26 seen_greeting: str
27 mailfrom: str
28 rcpttos: list[str]
29 received_data: str
30 fqdn: str
31 peer: str
32
33 command_size_limit: int
34 data_size_limit: int
35
36 enable_SMTPUTF8: bool
37 @property
38 def max_command_size_limit(self) -> int: ...
39 def __init__(
40 self,
41 server: SMTPServer,
42 conn: socket.socket,
43 addr: Any,
44 data_size_limit: int = 33554432,
45 map: asyncore._MapType | None = None,
46 enable_SMTPUTF8: bool = False,
47 decode_data: bool = False,
48 ) -> None: ...
49 # base asynchat.async_chat.push() accepts bytes
50 def push(self, msg: str) -> None: ... # type: ignore[override]
51 def collect_incoming_data(self, data: bytes) -> None: ...
52 def found_terminator(self) -> None: ...
53 def smtp_HELO(self, arg: str) -> None: ...
54 def smtp_NOOP(self, arg: str) -> None: ...
55 def smtp_QUIT(self, arg: str) -> None: ...
56 def smtp_MAIL(self, arg: str) -> None: ...
57 def smtp_RCPT(self, arg: str) -> None: ...
58 def smtp_RSET(self, arg: str) -> None: ...
59 def smtp_DATA(self, arg: str) -> None: ...
60 def smtp_EHLO(self, arg: str) -> None: ...
61 def smtp_HELP(self, arg: str) -> None: ...
62 def smtp_VRFY(self, arg: str) -> None: ...
63 def smtp_EXPN(self, arg: str) -> None: ...
64
65 class SMTPServer(asyncore.dispatcher):
66 channel_class: type[SMTPChannel]
67
68 data_size_limit: int
69 enable_SMTPUTF8: bool
70 def __init__(
71 self,
72 localaddr: _Address,
73 remoteaddr: _Address,
74 data_size_limit: int = 33554432,
75 map: asyncore._MapType | None = None,
76 enable_SMTPUTF8: bool = False,
77 decode_data: bool = False,
78 ) -> None: ...
79 def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ...
80 def process_message(
81 self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str, **kwargs: Any
82 ) -> str | None: ...
83
84 class DebuggingServer(SMTPServer): ...
85
86 class PureProxy(SMTPServer):
87 def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override]
88
89 if sys.version_info < (3, 11):
90 @deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
91 class MailmanProxy(PureProxy):
92 def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override]