mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterator, List, Optional
|
||||
from typing import Any, Iterator, List
|
||||
|
||||
QP: int # undocumented
|
||||
BASE64: int # undocumented
|
||||
@@ -8,12 +8,12 @@ class Charset:
|
||||
input_charset: str
|
||||
header_encoding: int
|
||||
body_encoding: int
|
||||
output_charset: Optional[str]
|
||||
input_codec: Optional[str]
|
||||
output_codec: Optional[str]
|
||||
output_charset: str | None
|
||||
input_codec: str | None
|
||||
output_codec: str | None
|
||||
def __init__(self, input_charset: str = ...) -> None: ...
|
||||
def get_body_encoding(self) -> str: ...
|
||||
def get_output_charset(self) -> Optional[str]: ...
|
||||
def get_output_charset(self) -> str | None: ...
|
||||
def header_encode(self, string: str) -> str: ...
|
||||
def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> List[str]: ...
|
||||
def body_encode(self, string: str) -> str: ...
|
||||
@@ -22,7 +22,7 @@ class Charset:
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
|
||||
def add_charset(
|
||||
charset: str, header_enc: Optional[int] = ..., body_enc: Optional[int] = ..., output_charset: Optional[str] = ...
|
||||
charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ...
|
||||
) -> None: ...
|
||||
def add_alias(alias: str, canonical: str) -> None: ...
|
||||
def add_codec(charset: str, codecname: str) -> None: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
class MessageError(Exception): ...
|
||||
class MessageParseError(MessageError): ...
|
||||
@@ -9,7 +8,7 @@ class MultipartConversionError(MessageError, TypeError): ...
|
||||
class CharsetError(MessageError): ...
|
||||
|
||||
class MessageDefect(ValueError):
|
||||
def __init__(self, line: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, line: str | None = ...) -> None: ...
|
||||
|
||||
class NoBoundaryInMultipartDefect(MessageDefect): ...
|
||||
class StartBoundaryNotFoundDefect(MessageDefect): ...
|
||||
@@ -31,7 +30,7 @@ class InvalidHeaderDefect(HeaderDefect): ...
|
||||
class HeaderMissingRequiredValue(HeaderDefect): ...
|
||||
|
||||
class NonPrintableDefect(HeaderDefect):
|
||||
def __init__(self, non_printables: Optional[str]) -> None: ...
|
||||
def __init__(self, non_printables: str | None) -> None: ...
|
||||
|
||||
class ObsoleteHeaderDefect(HeaderDefect): ...
|
||||
class NonASCIILocalPartDefect(HeaderDefect): ...
|
||||
|
||||
@@ -1,40 +1,30 @@
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
from typing import BinaryIO, Optional, TextIO
|
||||
from typing import BinaryIO, TextIO
|
||||
|
||||
class Generator:
|
||||
def clone(self, fp: TextIO) -> Generator: ...
|
||||
def write(self, s: str) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
outfp: TextIO,
|
||||
mangle_from_: Optional[bool] = ...,
|
||||
maxheaderlen: Optional[int] = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
self, outfp: TextIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ...
|
||||
) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ...
|
||||
|
||||
class BytesGenerator:
|
||||
def clone(self, fp: BinaryIO) -> BytesGenerator: ...
|
||||
def write(self, s: str) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
outfp: BinaryIO,
|
||||
mangle_from_: Optional[bool] = ...,
|
||||
maxheaderlen: Optional[int] = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
self, outfp: BinaryIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ...
|
||||
) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ...
|
||||
|
||||
class DecodedGenerator(Generator):
|
||||
def __init__(
|
||||
self,
|
||||
outfp: TextIO,
|
||||
mangle_from_: Optional[bool] = ...,
|
||||
maxheaderlen: Optional[int] = ...,
|
||||
fmt: Optional[str] = ...,
|
||||
mangle_from_: bool | None = ...,
|
||||
maxheaderlen: int | None = ...,
|
||||
fmt: str | None = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
policy: Policy | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
from email.charset import Charset
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
class Header:
|
||||
def __init__(
|
||||
self,
|
||||
s: Union[bytes, str, None] = ...,
|
||||
charset: Union[Charset, str, None] = ...,
|
||||
maxlinelen: Optional[int] = ...,
|
||||
header_name: Optional[str] = ...,
|
||||
s: bytes | str | None = ...,
|
||||
charset: Charset | str | None = ...,
|
||||
maxlinelen: int | None = ...,
|
||||
header_name: str | None = ...,
|
||||
continuation_ws: str = ...,
|
||||
errors: str = ...,
|
||||
) -> None: ...
|
||||
def append(self, s: Union[bytes, str], charset: Union[Charset, str, None] = ..., errors: str = ...) -> None: ...
|
||||
def encode(self, splitchars: str = ..., maxlinelen: Optional[int] = ..., linesep: str = ...) -> str: ...
|
||||
def append(self, s: bytes | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ...
|
||||
def encode(self, splitchars: str = ..., maxlinelen: int | None = ..., linesep: str = ...) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
|
||||
def decode_header(header: Union[Header, str]) -> List[Tuple[bytes, Optional[str]]]: ...
|
||||
def decode_header(header: Header | str) -> List[Tuple[bytes, str | None]]: ...
|
||||
def make_header(
|
||||
decoded_seq: List[Tuple[bytes, Optional[str]]],
|
||||
maxlinelen: Optional[int] = ...,
|
||||
header_name: Optional[str] = ...,
|
||||
decoded_seq: List[Tuple[bytes, str | None]],
|
||||
maxlinelen: int | None = ...,
|
||||
header_name: str | None = ...,
|
||||
continuation_ws: str = ...,
|
||||
) -> Header: ...
|
||||
|
||||
@@ -11,7 +11,7 @@ from email._header_value_parser import (
|
||||
)
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
from typing import Any, Dict, Iterable, Mapping, Optional, Tuple, Type, Union
|
||||
from typing import Any, Dict, Iterable, Mapping, Tuple, Type
|
||||
|
||||
class BaseHeader(str):
|
||||
@property
|
||||
@@ -19,7 +19,7 @@ class BaseHeader(str):
|
||||
@property
|
||||
def defects(self) -> Tuple[MessageDefect, ...]: ...
|
||||
@property
|
||||
def max_count(self) -> Optional[int]: ...
|
||||
def max_count(self) -> int | None: ...
|
||||
def __new__(cls, name: str, value: Any) -> BaseHeader: ...
|
||||
def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect]) -> None: ...
|
||||
def fold(self, *, policy: Policy) -> str: ...
|
||||
@@ -38,7 +38,7 @@ class DateHeader:
|
||||
@staticmethod
|
||||
def value_parser(value: str) -> UnstructuredTokenList: ...
|
||||
@classmethod
|
||||
def parse(cls, value: Union[str, _datetime], kwds: Dict[str, Any]) -> None: ...
|
||||
def parse(cls, value: str | _datetime, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class UniqueDateHeader(DateHeader): ...
|
||||
|
||||
@@ -62,11 +62,11 @@ class UniqueSingleAddressHeader(SingleAddressHeader): ...
|
||||
|
||||
class MIMEVersionHeader:
|
||||
@property
|
||||
def version(self) -> Optional[str]: ...
|
||||
def version(self) -> str | None: ...
|
||||
@property
|
||||
def major(self) -> Optional[int]: ...
|
||||
def major(self) -> int | None: ...
|
||||
@property
|
||||
def minor(self) -> Optional[int]: ...
|
||||
def minor(self) -> int | None: ...
|
||||
@staticmethod
|
||||
def value_parser(value: str) -> MIMEVersion: ...
|
||||
@classmethod
|
||||
@@ -128,14 +128,14 @@ class Address:
|
||||
@property
|
||||
def addr_spec(self) -> str: ...
|
||||
def __init__(
|
||||
self, display_name: str = ..., username: Optional[str] = ..., domain: Optional[str] = ..., addr_spec: Optional[str] = ...
|
||||
self, display_name: str = ..., username: str | None = ..., domain: str | None = ..., addr_spec: str | None = ...
|
||||
) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class Group:
|
||||
@property
|
||||
def display_name(self) -> Optional[str]: ...
|
||||
def display_name(self) -> str | None: ...
|
||||
@property
|
||||
def addresses(self) -> Tuple[Address, ...]: ...
|
||||
def __init__(self, display_name: Optional[str] = ..., addresses: Optional[Iterable[Address]] = ...) -> None: ...
|
||||
def __init__(self, display_name: str | None = ..., addresses: Iterable[Address] | None = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from email.message import Message
|
||||
from typing import Iterator, Optional
|
||||
from typing import Iterator
|
||||
|
||||
def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ...
|
||||
def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: Optional[str] = ...) -> Iterator[str]: ...
|
||||
def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: str | None = ...) -> Iterator[str]: ...
|
||||
|
||||
@@ -14,15 +14,15 @@ _HeaderType = Any
|
||||
|
||||
class Message:
|
||||
policy: Policy # undocumented
|
||||
preamble: Optional[str]
|
||||
epilogue: Optional[str]
|
||||
preamble: str | None
|
||||
epilogue: str | None
|
||||
defects: List[MessageDefect]
|
||||
def __str__(self) -> str: ...
|
||||
def is_multipart(self) -> bool: ...
|
||||
def set_unixfrom(self, unixfrom: str) -> None: ...
|
||||
def get_unixfrom(self) -> Optional[str]: ...
|
||||
def get_unixfrom(self) -> str | None: ...
|
||||
def attach(self, payload: Message) -> None: ...
|
||||
def get_payload(self, i: Optional[int] = ..., decode: bool = ...) -> Any: ... # returns Optional[_PayloadType]
|
||||
def get_payload(self, i: int | None = ..., decode: bool = ...) -> Any: ... # returns _PayloadType | None
|
||||
def set_payload(self, payload: _PayloadType, charset: _CharsetType = ...) -> None: ...
|
||||
def set_charset(self, charset: _CharsetType) -> None: ...
|
||||
def get_charset(self) -> _CharsetType: ...
|
||||
@@ -34,8 +34,8 @@ class Message:
|
||||
def keys(self) -> List[str]: ...
|
||||
def values(self) -> List[_HeaderType]: ...
|
||||
def items(self) -> List[Tuple[str, _HeaderType]]: ...
|
||||
def get(self, name: str, failobj: _T = ...) -> Union[_HeaderType, _T]: ...
|
||||
def get_all(self, name: str, failobj: _T = ...) -> Union[List[_HeaderType], _T]: ...
|
||||
def get(self, name: str, failobj: _T = ...) -> _HeaderType | _T: ...
|
||||
def get_all(self, name: str, failobj: _T = ...) -> List[_HeaderType] | _T: ...
|
||||
def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ...
|
||||
def replace_header(self, _name: str, _value: _HeaderType) -> None: ...
|
||||
def get_content_type(self) -> str: ...
|
||||
@@ -43,19 +43,19 @@ class Message:
|
||||
def get_content_subtype(self) -> str: ...
|
||||
def get_default_type(self) -> str: ...
|
||||
def set_default_type(self, ctype: str) -> None: ...
|
||||
def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> Union[List[Tuple[str, str]], _T]: ...
|
||||
def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> Union[_T, _ParamType]: ...
|
||||
def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> List[Tuple[str, str]] | _T: ...
|
||||
def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> _T | _ParamType: ...
|
||||
def del_param(self, param: str, header: str = ..., requote: bool = ...) -> None: ...
|
||||
def set_type(self, type: str, header: str = ..., requote: bool = ...) -> None: ...
|
||||
def get_filename(self, failobj: _T = ...) -> Union[_T, str]: ...
|
||||
def get_boundary(self, failobj: _T = ...) -> Union[_T, str]: ...
|
||||
def get_filename(self, failobj: _T = ...) -> _T | str: ...
|
||||
def get_boundary(self, failobj: _T = ...) -> _T | str: ...
|
||||
def set_boundary(self, boundary: str) -> None: ...
|
||||
def get_content_charset(self, failobj: _T = ...) -> Union[_T, str]: ...
|
||||
def get_charsets(self, failobj: _T = ...) -> Union[_T, List[str]]: ...
|
||||
def get_content_charset(self, failobj: _T = ...) -> _T | str: ...
|
||||
def get_charsets(self, failobj: _T = ...) -> _T | List[str]: ...
|
||||
def walk(self) -> Generator[Message, None, None]: ...
|
||||
def get_content_disposition(self) -> Optional[str]: ...
|
||||
def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Optional[Policy] = ...) -> str: ...
|
||||
def as_bytes(self, unixfrom: bool = ..., policy: Optional[Policy] = ...) -> bytes: ...
|
||||
def get_content_disposition(self) -> str | None: ...
|
||||
def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Policy | None = ...) -> str: ...
|
||||
def as_bytes(self, unixfrom: bool = ..., policy: Policy | None = ...) -> bytes: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def set_param(
|
||||
self,
|
||||
@@ -63,28 +63,28 @@ class Message:
|
||||
value: str,
|
||||
header: str = ...,
|
||||
requote: bool = ...,
|
||||
charset: Optional[str] = ...,
|
||||
charset: str | None = ...,
|
||||
language: str = ...,
|
||||
replace: bool = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
|
||||
class MIMEPart(Message):
|
||||
def __init__(self, policy: Optional[Policy] = ...) -> None: ...
|
||||
def get_body(self, preferencelist: Sequence[str] = ...) -> Optional[Message]: ...
|
||||
def __init__(self, policy: Policy | None = ...) -> None: ...
|
||||
def get_body(self, preferencelist: Sequence[str] = ...) -> Message | None: ...
|
||||
def iter_attachments(self) -> Iterator[Message]: ...
|
||||
def iter_parts(self) -> Iterator[Message]: ...
|
||||
def get_content(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> Any: ...
|
||||
def set_content(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ...
|
||||
def make_related(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def make_alternative(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def make_mixed(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def add_related(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ...
|
||||
def add_alternative(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ...
|
||||
def add_attachment(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ...
|
||||
def get_content(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> Any: ...
|
||||
def set_content(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ...
|
||||
def make_related(self, boundary: str | None = ...) -> None: ...
|
||||
def make_alternative(self, boundary: str | None = ...) -> None: ...
|
||||
def make_mixed(self, boundary: str | None = ...) -> None: ...
|
||||
def add_related(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ...
|
||||
def add_alternative(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ...
|
||||
def add_attachment(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def clear_content(self) -> None: ...
|
||||
def as_string(self, unixfrom: bool = ..., maxheaderlen: Optional[int] = ..., policy: Optional[Policy] = ...) -> str: ...
|
||||
def as_string(self, unixfrom: bool = ..., maxheaderlen: int | None = ..., policy: Policy | None = ...) -> str: ...
|
||||
def is_attachment(self) -> bool: ...
|
||||
|
||||
class EmailMessage(MIMEPart): ...
|
||||
|
||||
@@ -7,10 +7,10 @@ _ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
class MIMEApplication(MIMENonMultipart):
|
||||
def __init__(
|
||||
self,
|
||||
_data: Union[str, bytes],
|
||||
_data: str | bytes,
|
||||
_subtype: str = ...,
|
||||
_encoder: Callable[[MIMEApplication], None] = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
policy: Policy | None = ...,
|
||||
**_params: _ParamsType,
|
||||
) -> None: ...
|
||||
|
||||
@@ -7,10 +7,10 @@ _ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
class MIMEAudio(MIMENonMultipart):
|
||||
def __init__(
|
||||
self,
|
||||
_audiodata: Union[str, bytes],
|
||||
_subtype: Optional[str] = ...,
|
||||
_audiodata: str | bytes,
|
||||
_subtype: str | None = ...,
|
||||
_encoder: Callable[[MIMEAudio], None] = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
policy: Policy | None = ...,
|
||||
**_params: _ParamsType,
|
||||
) -> None: ...
|
||||
|
||||
@@ -5,4 +5,4 @@ from typing import Optional, Tuple, Union
|
||||
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
|
||||
class MIMEBase(email.message.Message):
|
||||
def __init__(self, _maintype: str, _subtype: str, *, policy: Optional[Policy] = ..., **_params: _ParamsType) -> None: ...
|
||||
def __init__(self, _maintype: str, _subtype: str, *, policy: Policy | None = ..., **_params: _ParamsType) -> None: ...
|
||||
|
||||
@@ -7,10 +7,10 @@ _ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
class MIMEImage(MIMENonMultipart):
|
||||
def __init__(
|
||||
self,
|
||||
_imagedata: Union[str, bytes],
|
||||
_subtype: Optional[str] = ...,
|
||||
_imagedata: str | bytes,
|
||||
_subtype: str | None = ...,
|
||||
_encoder: Callable[[MIMEImage], None] = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
policy: Policy | None = ...,
|
||||
**_params: _ParamsType,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from email.message import Message
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.policy import Policy
|
||||
from typing import Optional
|
||||
|
||||
class MIMEMessage(MIMENonMultipart):
|
||||
def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Optional[Policy] = ...) -> None: ...
|
||||
def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Policy | None = ...) -> None: ...
|
||||
|
||||
@@ -9,9 +9,9 @@ class MIMEMultipart(MIMEBase):
|
||||
def __init__(
|
||||
self,
|
||||
_subtype: str = ...,
|
||||
boundary: Optional[str] = ...,
|
||||
_subparts: Optional[Sequence[Message]] = ...,
|
||||
boundary: str | None = ...,
|
||||
_subparts: Sequence[Message] | None = ...,
|
||||
*,
|
||||
policy: Optional[Policy] = ...,
|
||||
policy: Policy | None = ...,
|
||||
**_params: _ParamsType,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.policy import Policy
|
||||
from typing import Optional
|
||||
|
||||
class MIMEText(MIMENonMultipart):
|
||||
def __init__(
|
||||
self, _text: str, _subtype: str = ..., _charset: Optional[str] = ..., *, policy: Optional[Policy] = ...
|
||||
) -> None: ...
|
||||
def __init__(self, _text: str, _subtype: str = ..., _charset: str | None = ..., *, policy: Policy | None = ...) -> None: ...
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import email.feedparser
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
from typing import BinaryIO, Callable, Optional, TextIO
|
||||
from typing import BinaryIO, Callable, TextIO
|
||||
|
||||
FeedParser = email.feedparser.FeedParser
|
||||
BytesFeedParser = email.feedparser.BytesFeedParser
|
||||
|
||||
class Parser:
|
||||
def __init__(self, _class: Optional[Callable[[], Message]] = ..., *, policy: Policy = ...) -> None: ...
|
||||
def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
class HeaderParser(Parser):
|
||||
def __init__(self, _class: Optional[Callable[[], Message]] = ..., *, policy: Policy = ...) -> None: ...
|
||||
def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ from email.contentmanager import ContentManager
|
||||
from email.errors import MessageDefect
|
||||
from email.header import Header
|
||||
from email.message import Message
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
from typing import Any, Callable, List, Tuple
|
||||
|
||||
class Policy:
|
||||
max_line_length: Optional[int]
|
||||
max_line_length: int | None
|
||||
linesep: str
|
||||
cte_type: str
|
||||
raise_on_defect: bool
|
||||
@@ -15,7 +15,7 @@ class Policy:
|
||||
def clone(self, **kw: Any) -> Policy: ...
|
||||
def handle_defect(self, obj: Message, defect: MessageDefect) -> None: ...
|
||||
def register_defect(self, obj: Message, defect: MessageDefect) -> None: ...
|
||||
def header_max_count(self, name: str) -> Optional[int]: ...
|
||||
def header_max_count(self, name: str) -> int | None: ...
|
||||
@abstractmethod
|
||||
def header_source_parse(self, sourcelines: List[str]) -> Tuple[str, str]: ...
|
||||
@abstractmethod
|
||||
@@ -30,7 +30,7 @@ class Policy:
|
||||
class Compat32(Policy):
|
||||
def header_source_parse(self, sourcelines: List[str]) -> Tuple[str, str]: ...
|
||||
def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ...
|
||||
def header_fetch_parse(self, name: str, value: str) -> Union[str, Header]: ... # type: ignore
|
||||
def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore
|
||||
def fold(self, name: str, value: str) -> str: ...
|
||||
def fold_binary(self, name: str, value: str) -> bytes: ...
|
||||
|
||||
|
||||
@@ -8,17 +8,17 @@ _PDTZ = Tuple[int, int, int, int, int, int, int, int, int, Optional[int]]
|
||||
|
||||
def quote(str: str) -> str: ...
|
||||
def unquote(str: str) -> str: ...
|
||||
def parseaddr(addr: Optional[str]) -> Tuple[str, str]: ...
|
||||
def formataddr(pair: Tuple[Optional[str], str], charset: Union[str, Charset] = ...) -> str: ...
|
||||
def parseaddr(addr: str | None) -> Tuple[str, str]: ...
|
||||
def formataddr(pair: Tuple[str | None, str], charset: str | Charset = ...) -> str: ...
|
||||
def getaddresses(fieldvalues: List[str]) -> List[Tuple[str, str]]: ...
|
||||
@overload
|
||||
def parsedate(data: None) -> None: ...
|
||||
@overload
|
||||
def parsedate(data: str) -> Optional[Tuple[int, int, int, int, int, int, int, int, int]]: ...
|
||||
def parsedate(data: str) -> Tuple[int, int, int, int, int, int, int, int, int] | None: ...
|
||||
@overload
|
||||
def parsedate_tz(data: None) -> None: ...
|
||||
@overload
|
||||
def parsedate_tz(data: str) -> Optional[_PDTZ]: ...
|
||||
def parsedate_tz(data: str) -> _PDTZ | None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
@@ -30,11 +30,11 @@ else:
|
||||
def parsedate_to_datetime(data: str) -> datetime.datetime: ...
|
||||
|
||||
def mktime_tz(data: _PDTZ) -> int: ...
|
||||
def formatdate(timeval: Optional[float] = ..., localtime: bool = ..., usegmt: bool = ...) -> str: ...
|
||||
def formatdate(timeval: float | None = ..., localtime: bool = ..., usegmt: bool = ...) -> str: ...
|
||||
def format_datetime(dt: datetime.datetime, usegmt: bool = ...) -> str: ...
|
||||
def localtime(dt: Optional[datetime.datetime] = ..., isdst: int = ...) -> datetime.datetime: ...
|
||||
def make_msgid(idstring: Optional[str] = ..., domain: Optional[str] = ...) -> str: ...
|
||||
def decode_rfc2231(s: str) -> Tuple[Optional[str], Optional[str], str]: ...
|
||||
def encode_rfc2231(s: str, charset: Optional[str] = ..., language: Optional[str] = ...) -> str: ...
|
||||
def localtime(dt: datetime.datetime | None = ..., isdst: int = ...) -> datetime.datetime: ...
|
||||
def make_msgid(idstring: str | None = ..., domain: str | None = ...) -> str: ...
|
||||
def decode_rfc2231(s: str) -> Tuple[str | None, str | None, str]: ...
|
||||
def encode_rfc2231(s: str, charset: str | None = ..., language: str | None = ...) -> str: ...
|
||||
def collapse_rfc2231_value(value: _ParamType, errors: str = ..., fallback_charset: str = ...) -> str: ...
|
||||
def decode_params(params: List[Tuple[str, str]]) -> List[Tuple[str, _ParamType]]: ...
|
||||
|
||||
Reference in New Issue
Block a user