Fix a signature in smtpd.SMTPServer (#5203)

Fixes #5202.

Use an appropriate type for the data argument of smtpd.SMTPServer.process_message.
This commit is contained in:
Sean B. Palmer
2021-04-10 21:22:07 +01:00
committed by GitHub
parent 087435ca65
commit 4dd10fe31d

View File

@@ -2,7 +2,7 @@ import asynchat
import asyncore
import socket
import sys
from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type
from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type, Union
_Address = Tuple[str, int] # (host, port)
@@ -79,7 +79,9 @@ class SMTPServer(asyncore.dispatcher):
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]: ...
def process_message(
self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: Union[bytes, str], **kwargs: Any
) -> Optional[str]: ...
class DebuggingServer(SMTPServer): ...
class PureProxy(SMTPServer): ...