Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -3,7 +3,7 @@ from email.message import Message as _Message
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Dict, Optional, Pattern, Protocol, Sequence, Tuple, Type, Union, overload
from typing import Any, Dict, Pattern, Protocol, Sequence, Tuple, Type, Union, overload
_Reply = Tuple[int, bytes]
_SendErrs = Dict[str, _Reply]
@@ -23,9 +23,9 @@ class SMTPServerDisconnected(SMTPException): ...
class SMTPResponseException(SMTPException):
smtp_code: int
smtp_error: Union[bytes, str]
args: Union[Tuple[int, Union[bytes, str]], Tuple[int, bytes, str]]
def __init__(self, code: int, msg: Union[bytes, str]) -> None: ...
smtp_error: bytes | str
args: Tuple[int, bytes | str] | Tuple[int, bytes, str]
def __init__(self, code: int, msg: bytes | str) -> None: ...
class SMTPSenderRefused(SMTPResponseException):
smtp_code: int
@@ -49,40 +49,40 @@ def quotedata(data: str) -> str: ...
class _AuthObject(Protocol):
@overload
def __call__(self, challenge: None = ...) -> Optional[str]: ...
def __call__(self, challenge: None = ...) -> str | None: ...
@overload
def __call__(self, challenge: bytes) -> str: ...
class SMTP:
debuglevel: int = ...
sock: Optional[socket] = ...
sock: socket | None = ...
# Type of file should match what socket.makefile() returns
file: Optional[Any] = ...
helo_resp: Optional[bytes] = ...
file: Any | None = ...
helo_resp: bytes | None = ...
ehlo_msg: str = ...
ehlo_resp: Optional[bytes] = ...
ehlo_resp: bytes | None = ...
does_esmtp: bool = ...
default_port: int = ...
timeout: float
esmtp_features: Dict[str, str]
command_encoding: str
source_address: Optional[_SourceAddress]
source_address: _SourceAddress | None
local_hostname: str
def __init__(
self,
host: str = ...,
port: int = ...,
local_hostname: Optional[str] = ...,
local_hostname: str | None = ...,
timeout: float = ...,
source_address: Optional[_SourceAddress] = ...,
source_address: _SourceAddress | None = ...,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
) -> None: ...
def set_debuglevel(self, debuglevel: int) -> None: ...
def connect(self, host: str = ..., port: int = ..., source_address: Optional[_SourceAddress] = ...) -> _Reply: ...
def send(self, s: Union[bytes, str]) -> None: ...
def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ...
def send(self, s: bytes | str) -> None: ...
def putcmd(self, cmd: str, args: str = ...) -> None: ...
def getreply(self) -> _Reply: ...
def docmd(self, cmd: str, args: str = ...) -> _Reply: ...
@@ -94,7 +94,7 @@ class SMTP:
def noop(self) -> _Reply: ...
def mail(self, sender: str, options: Sequence[str] = ...) -> _Reply: ...
def rcpt(self, recip: str, options: Sequence[str] = ...) -> _Reply: ...
def data(self, msg: Union[bytes, str]) -> _Reply: ...
def data(self, msg: bytes | str) -> _Reply: ...
def verify(self, address: str) -> _Reply: ...
vrfy = verify
def expn(self, address: str) -> _Reply: ...
@@ -106,25 +106,23 @@ class SMTP:
def auth_cram_md5(self, challenge: None = ...) -> None: ...
@overload
def auth_cram_md5(self, challenge: bytes) -> str: ...
def auth_plain(self, challenge: Optional[bytes] = ...) -> str: ...
def auth_login(self, challenge: Optional[bytes] = ...) -> str: ...
def auth_plain(self, challenge: bytes | None = ...) -> str: ...
def auth_login(self, challenge: bytes | None = ...) -> str: ...
def login(self, user: str, password: str, *, initial_response_ok: bool = ...) -> _Reply: ...
def starttls(
self, keyfile: Optional[str] = ..., certfile: Optional[str] = ..., context: Optional[SSLContext] = ...
) -> _Reply: ...
def starttls(self, keyfile: str | None = ..., certfile: str | None = ..., context: SSLContext | None = ...) -> _Reply: ...
def sendmail(
self,
from_addr: str,
to_addrs: Union[str, Sequence[str]],
msg: Union[bytes, str],
to_addrs: str | Sequence[str],
msg: bytes | str,
mail_options: Sequence[str] = ...,
rcpt_options: Sequence[str] = ...,
) -> _SendErrs: ...
def send_message(
self,
msg: _Message,
from_addr: Optional[str] = ...,
to_addrs: Optional[Union[str, Sequence[str]]] = ...,
from_addr: str | None = ...,
to_addrs: str | Sequence[str] | None = ...,
mail_options: Sequence[str] = ...,
rcpt_options: Sequence[str] = ...,
) -> _SendErrs: ...
@@ -133,28 +131,24 @@ class SMTP:
class SMTP_SSL(SMTP):
default_port: int = ...
keyfile: Optional[str]
certfile: Optional[str]
keyfile: str | None
certfile: str | None
context: SSLContext
def __init__(
self,
host: str = ...,
port: int = ...,
local_hostname: Optional[str] = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
local_hostname: str | None = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
timeout: float = ...,
source_address: Optional[_SourceAddress] = ...,
context: Optional[SSLContext] = ...,
source_address: _SourceAddress | None = ...,
context: SSLContext | None = ...,
) -> None: ...
LMTP_PORT: int
class LMTP(SMTP):
def __init__(
self,
host: str = ...,
port: int = ...,
local_hostname: Optional[str] = ...,
source_address: Optional[_SourceAddress] = ...,
self, host: str = ..., port: int = ..., local_hostname: str | None = ..., source_address: _SourceAddress | None = ...
) -> None: ...