Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)

* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
Akuli
2021-05-15 15:33:39 +03:00
committed by GitHub
parent b0ef85288d
commit 17dcea4a68
106 changed files with 1539 additions and 3275 deletions

View File

@@ -1,7 +1,6 @@
import asynchat
import asyncore
import socket
import sys
from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type, Union
_Address = Tuple[str, int] # (host, port)
@@ -10,39 +9,35 @@ class SMTPChannel(asynchat.async_chat):
COMMAND: int
DATA: int
if sys.version_info >= (3,):
command_size_limits: DefaultDict[str, int]
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_limits: DefaultDict[str, int]
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
command_size_limit: int
data_size_limit: int
enable_SMTPUTF8: bool
@property
def max_command_size_limit(self) -> int: ...
if sys.version_info >= (3,):
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: ...
else:
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ...
enable_SMTPUTF8: bool
@property
def max_command_size_limit(self) -> int: ...
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: ...
# base asynchat.async_chat.push() accepts bytes
def push(self, msg: Text) -> None: ... # type: ignore
def collect_incoming_data(self, data: bytes) -> None: ...
@@ -54,30 +49,25 @@ class SMTPChannel(asynchat.async_chat):
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: ...
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,):
def __init__(
self,
localaddr: _Address,
remoteaddr: _Address,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
else:
def __init__(self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ...) -> None: ...
def __init__(
self,
localaddr: _Address,
remoteaddr: _Address,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ...
def process_message(
self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: Union[bytes, str], **kwargs: Any