mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-21 11:21:19 +08:00
Use PEP 604 syntax wherever possible, part II (#7514)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@ from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
|
||||
# using a type alias ("_HeaderType = Any") breaks mypy, who knows why
|
||||
from typing import Any, Any as _HeaderType, Generator, Iterator, Optional, Sequence, TypeVar, Union
|
||||
from typing import Any, Any as _HeaderType, Generator, Iterator, Sequence, TypeVar, Union
|
||||
|
||||
__all__ = ["Message", "EmailMessage"]
|
||||
|
||||
@@ -12,8 +12,8 @@ _T = TypeVar("_T")
|
||||
|
||||
_PayloadType = list[Message] | str | bytes
|
||||
_CharsetType = Charset | str | None
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamType = Union[str, tuple[Optional[str], Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
_ParamType = Union[str, tuple[str | None, str | None, str]]
|
||||
|
||||
class Message:
|
||||
policy: Policy # undocumented
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.policy import Policy
|
||||
from typing import Callable, Optional, Union
|
||||
from typing import Callable, Union
|
||||
|
||||
__all__ = ["MIMEApplication"]
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEApplication(MIMENonMultipart):
|
||||
def __init__(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.policy import Policy
|
||||
from typing import Callable, Optional, Union
|
||||
from typing import Callable, Union
|
||||
|
||||
__all__ = ["MIMEAudio"]
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEAudio(MIMENonMultipart):
|
||||
def __init__(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import email.message
|
||||
from email.policy import Policy
|
||||
from typing import Optional, Union
|
||||
from typing import Union
|
||||
|
||||
__all__ = ["MIMEBase"]
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEBase(email.message.Message):
|
||||
def __init__(self, _maintype: str, _subtype: str, *, policy: Policy | None = ..., **_params: _ParamsType) -> None: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.policy import Policy
|
||||
from typing import Callable, Optional, Union
|
||||
from typing import Callable, Union
|
||||
|
||||
__all__ = ["MIMEImage"]
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEImage(MIMENonMultipart):
|
||||
def __init__(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from email.message import Message
|
||||
from email.mime.base import MIMEBase
|
||||
from email.policy import Policy
|
||||
from typing import Optional, Sequence, Union
|
||||
from typing import Sequence, Union
|
||||
|
||||
__all__ = ["MIMEMultipart"]
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEMultipart(MIMEBase):
|
||||
def __init__(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
import sys
|
||||
from email.charset import Charset
|
||||
from typing import Optional, Union, overload
|
||||
from typing import Union, overload
|
||||
|
||||
__all__ = [
|
||||
"collapse_rfc2231_value",
|
||||
@@ -21,8 +21,8 @@ __all__ = [
|
||||
"unquote",
|
||||
]
|
||||
|
||||
_ParamType = Union[str, tuple[Optional[str], Optional[str], str]]
|
||||
_PDTZ = tuple[int, int, int, int, int, int, int, int, int, Optional[int]]
|
||||
_ParamType = Union[str, tuple[str | None, str | None, str]]
|
||||
_PDTZ = tuple[int, int, int, int, int, int, int, int, int, int | None]
|
||||
|
||||
def quote(str: str) -> str: ...
|
||||
def unquote(str: str) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user