stubs for smtpd (#1203)

This commit is contained in:
Jelle Zijlstra
2017-04-24 15:02:51 -07:00
committed by Łukasz Langa
parent 0fcece539b
commit e8e002d9c0
2 changed files with 89 additions and 2 deletions

View File

@@ -9,13 +9,13 @@ class simple_producer:
def __init__(self, data: str, buffer_size: int = ...) -> None: ...
def more(self) -> str: ...
class async_chat (asyncore.dispatcher):
class async_chat(asyncore.dispatcher):
ac_in_buffer_size = ... # type: int
ac_out_buffer_size = ... # type: int
def __init__(self, sock: socket.socket = None, map: asyncore._maptype = None) -> None: ...
@abstractmethod
def collect_incoming_data(self, data: str) -> None: ...
def collect_incoming_data(self, data: bytes) -> None: ...
@abstractmethod
def found_terminator(self) -> None: ...
def set_terminator(self, term: Union[str, int, None]) -> None: ...

87
stdlib/2and3/smtpd.pyi Normal file
View File

@@ -0,0 +1,87 @@
# Stubs for smtpd (Python 2 and 3)
import sys
import socket
import asyncore
import asynchat
from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type
_Address = Tuple[str, int] # (host, port)
class SMTPChannel(asynchat.async_chat):
COMMAND: int
DATA: int
if sys.version_info >= (3, 3):
command_size_limits: DefaultDict[str, int]
if sys.version_info >= (3,):
smtp_server: SMTPServer
conn: socket.socket
addr: Any
received_lines: List[Text]
smtp_state: int
seen_greeting: str
mailfrom: str
rcpttos: List[str]
received_data: str
fqdn: str
peer: str
command_size_limit: int
data_size_limit: int
if sys.version_info >= (3, 5):
enable_SMTPUTF8: bool
if sys.version_info >= (3, 3):
@property
def max_command_size_limit(self) -> int: ...
if sys.version_info >= (3, 5):
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ..., enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ...
elif sys.version_info >= (3, 4):
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...) -> None: ...
else:
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ...
def push(self, msg: Text) -> None: ...
def collect_incoming_data(self, data: bytes) -> None: ...
def found_terminator(self) -> None: ...
def smtp_HELO(self, arg: str) -> None: ...
def smtp_NOOP(self, arg: str) -> None: ...
def smtp_QUIT(self, arg: str) -> None: ...
def smtp_MAIL(self, arg: str) -> None: ...
def smtp_RCPT(self, arg: str) -> None: ...
def smtp_RSET(self, arg: str) -> None: ...
def smtp_DATA(self, arg: str) -> None: ...
if sys.version_info >= (3, 3):
def smtp_EHLO(self, arg: str) -> None: ...
def smtp_HELP(self, arg: str) -> None: ...
def smtp_VRFY(self, arg: str) -> None: ...
def smtp_EXPN(self, arg: str) -> None: ...
class SMTPServer(asyncore.dispatcher):
channel_class: Type[SMTPChannel]
data_size_limit: int
enable_SMTPUTF8: bool
if sys.version_info >= (3, 5):
def __init__(self, localaddr: _Address, remoteaddr: _Address,
data_size_limit: int = ..., map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ...
elif sys.version_info >= (3, 4):
def __init__(self, localaddr: _Address, remoteaddr: _Address,
data_size_limit: int = ..., map: Optional[asyncore._maptype] = ...) -> None: ...
else:
def __init__(self, localaddr: _Address, remoteaddr: _Address,
data_size_limit: int = ...) -> None: ...
def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ...
def process_message(self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: str, **kwargs: Any) -> Optional[str]: ...
class DebuggingServer(SMTPServer): ...
class PureProxy(SMTPServer): ...
class MailmanProxy(PureProxy): ...