mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
Improve email.* (#207)
* improve email * complete email.message * complete email.policy * complete email.parser * complete email.generator * complete email.headerregistry * complete email.contentmanager * complete email.header * complete email.charset * complete email.errors * complete email.feedparser
This commit is contained in:
committed by
Guido van Rossum
parent
191e153427
commit
5b5f01f33c
@@ -1,11 +1,32 @@
|
||||
# Stubs for email (Python 3.4)
|
||||
|
||||
from typing import IO, Any
|
||||
from typing import Callable, Optional, BinaryIO, TextIO
|
||||
import sys
|
||||
from email.message import Message, Policy
|
||||
|
||||
def message_from_string(s: str, *args, **kwargs): ...
|
||||
def message_from_bytes(s: bytes, *args, **kwargs): ...
|
||||
def message_from_file(fp: IO[str], *args, **kwargs): ...
|
||||
def message_from_binary_file(fp: IO[bytes], *args, **kwargs): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def message_from_string(s: str, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> Message: ...
|
||||
def message_from_bytes(s: bytes, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> Message: ...
|
||||
def message_from_file(fp: TextIO, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> Message: ...
|
||||
def message_from_binary_file(fp: BinaryIO,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> Message: ...
|
||||
elif sys.version_info >= (3, 2):
|
||||
def message_from_string(s: str, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_bytes(s: bytes, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_file(fp: TextIO, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_binary_file(fp: BinaryIO, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
|
||||
# Names in __all__ with no definition:
|
||||
# base64mime
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# Stubs for email._policybase (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class _PolicyBase:
|
||||
def __init__(self, **kw) -> None: ...
|
||||
def clone(self, **kw): ...
|
||||
def __setattr__(self, name, value): ...
|
||||
def __add__(self, other): ...
|
||||
|
||||
class Policy(_PolicyBase):
|
||||
raise_on_defect = ... # type: Any
|
||||
linesep = ... # type: Any
|
||||
cte_type = ... # type: Any
|
||||
max_line_length = ... # type: Any
|
||||
def handle_defect(self, obj, defect): ...
|
||||
def register_defect(self, obj, defect): ...
|
||||
def header_max_count(self, name): ...
|
||||
def header_source_parse(self, sourcelines): ...
|
||||
def header_store_parse(self, name, value): ...
|
||||
def header_fetch_parse(self, name, value): ...
|
||||
def fold(self, name, value): ...
|
||||
def fold_binary(self, name, value): ...
|
||||
|
||||
class Compat32(Policy):
|
||||
def header_source_parse(self, sourcelines): ...
|
||||
def header_store_parse(self, name, value): ...
|
||||
def header_fetch_parse(self, name, value): ...
|
||||
def fold(self, name, value): ...
|
||||
def fold_binary(self, name, value): ...
|
||||
|
||||
compat32 = ... # type: Any
|
||||
@@ -1,25 +1,27 @@
|
||||
# Stubs for email.charset (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
def add_charset(charset, header_enc=..., body_enc=..., output_charset=...): ...
|
||||
def add_alias(alias, canonical): ...
|
||||
def add_codec(charset, codecname): ...
|
||||
from typing import Optional, Iterator, Any
|
||||
|
||||
class Charset:
|
||||
input_charset = ... # type: Any
|
||||
header_encoding = ... # type: Any
|
||||
body_encoding = ... # type: Any
|
||||
output_charset = ... # type: Any
|
||||
input_codec = ... # type: Any
|
||||
output_codec = ... # type: Any
|
||||
def __init__(self, input_charset=...) -> None: ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def get_body_encoding(self): ...
|
||||
def get_output_charset(self): ...
|
||||
def header_encode(self, string): ...
|
||||
def header_encode_lines(self, string, maxlengths): ...
|
||||
def body_encode(self, string): ...
|
||||
input_charset = ... # type: str
|
||||
header_encoding = ... # type: int
|
||||
body_encoding = ... # type: int
|
||||
output_charset = ... # type: Optional[str]
|
||||
input_codec = ... # type: Optional[str]
|
||||
output_codec = ... # type: Optional[str]
|
||||
def __init__(self, input_charset: str = ...) -> None: ...
|
||||
def get_body_encoding(self) -> str: ...
|
||||
def get_output_charset(self) -> Optional[str]: ...
|
||||
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: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
|
||||
def add_charset(charset: Charset, header_enc: Optional[int] = ...,
|
||||
body_enc: Optional[int] = ...,
|
||||
output_charset: Optional[str] = ...) -> None: ...
|
||||
def add_alias(alias: str, canonical: str) -> None: ...
|
||||
def add_codec(charset: str, codecname: str) -> None: ...
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
# Stubs for email.contentmanager (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Callable
|
||||
import sys
|
||||
import email.message
|
||||
from email.message import Message
|
||||
|
||||
class ContentManager:
|
||||
get_handlers = ... # type: Any
|
||||
set_handlers = ... # type: Any
|
||||
def __init__(self) -> None: ...
|
||||
def add_get_handler(self, key, handler): ...
|
||||
def get_content(self, msg, *args, **kw): ...
|
||||
def add_set_handler(self, typekey, handler): ...
|
||||
def set_content(self, msg, obj, *args, **kw): ...
|
||||
if sys.version_info >= (3, 4):
|
||||
|
||||
raw_data_manager = ... # type: Any
|
||||
EmailMessage = email.message.EmailMessage
|
||||
MIMEPart = email.message.MIMEPart
|
||||
|
||||
def get_text_content(msg, errors=...): ...
|
||||
def get_non_text_content(msg): ...
|
||||
def get_message_content(msg): ...
|
||||
def get_and_fixup_unknown_message_content(msg): ...
|
||||
def set_text_content(msg, string, subtype=..., charset=..., cte=..., disposition=...,
|
||||
filename=..., cid=..., params=..., headers=...): ...
|
||||
def set_message_content(msg, message, subtype=..., cte=..., disposition=..., filename=...,
|
||||
cid=..., params=..., headers=...): ...
|
||||
def set_bytes_content(msg, data, maintype, subtype, cte=..., disposition=..., filename=...,
|
||||
cid=..., params=..., headers=...): ...
|
||||
class ContentManager:
|
||||
def __init__(self) -> None: ...
|
||||
def get_content(self, msg: Message, *args: Any, **kw: Any) -> Any: ...
|
||||
def set_content(self, msg: Message, obj: Any, *args: Any,
|
||||
**kw: Any) -> Any: ...
|
||||
def add_get_handler(self, key: str, handler: Callable[..., Any]) -> None: ...
|
||||
def add_set_handler(self, typekey: type,
|
||||
handler: Callable[..., Any]) -> None: ...
|
||||
|
||||
raw_data_manager = ... # type: ContentManager
|
||||
|
||||
@@ -1,44 +1,22 @@
|
||||
# Stubs for email.errors (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
import sys
|
||||
|
||||
class MessageError(Exception): ...
|
||||
class MessageParseError(MessageError): ...
|
||||
class HeaderParseError(MessageParseError): ...
|
||||
class BoundaryError(MessageParseError): ...
|
||||
class MultipartConversionError(MessageError, TypeError): ...
|
||||
class CharsetError(MessageError): ...
|
||||
|
||||
class MessageDefect(ValueError):
|
||||
line = ... # type: Any
|
||||
def __init__(self, line=...) -> None: ...
|
||||
|
||||
class MessageDefect(ValueError): ...
|
||||
class NoBoundaryInMultipartDefect(MessageDefect): ...
|
||||
class StartBoundaryNotFoundDefect(MessageDefect): ...
|
||||
class CloseBoundaryNotFoundDefect(MessageDefect): ...
|
||||
class FirstHeaderLineIsContinuationDefect(MessageDefect): ...
|
||||
class MisplacedEnvelopeHeaderDefect(MessageDefect): ...
|
||||
class MissingHeaderBodySeparatorDefect(MessageDefect): ...
|
||||
|
||||
MalformedHeaderDefect = ... # type: Any
|
||||
|
||||
class MalformedHeaderDefect(MessageDefect): ...
|
||||
class MultipartInvariantViolationDefect(MessageDefect): ...
|
||||
class InvalidMultipartContentTransferEncodingDefect(MessageDefect): ...
|
||||
class UndecodableBytesDefect(MessageDefect): ...
|
||||
class InvalidBase64PaddingDefect(MessageDefect): ...
|
||||
class InvalidBase64CharactersDefect(MessageDefect): ...
|
||||
|
||||
class HeaderDefect(MessageDefect):
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
|
||||
class InvalidHeaderDefect(HeaderDefect): ...
|
||||
class HeaderMissingRequiredValue(HeaderDefect): ...
|
||||
|
||||
class NonPrintableDefect(HeaderDefect):
|
||||
non_printables = ... # type: Any
|
||||
def __init__(self, non_printables) -> None: ...
|
||||
|
||||
class ObsoleteHeaderDefect(HeaderDefect): ...
|
||||
class NonASCIILocalPartDefect(HeaderDefect): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class CloseBoundaryNotFoundDefect(MessageDefect): ...
|
||||
class MissingHeaderBodySeparatorDefect(MessageDefect): ...
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
# Stubs for email.feedparser (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class BufferedSubFile:
|
||||
def __init__(self) -> None: ...
|
||||
def push_eof_matcher(self, pred): ...
|
||||
def pop_eof_matcher(self): ...
|
||||
def close(self): ...
|
||||
def readline(self): ...
|
||||
def unreadline(self, line): ...
|
||||
def push(self, data): ...
|
||||
def pushlines(self, lines): ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
from typing import Callable
|
||||
import sys
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
|
||||
class FeedParser:
|
||||
policy = ... # type: Any
|
||||
def __init__(self, _factory=..., *, policy=...) -> None: ...
|
||||
def feed(self, data): ...
|
||||
def close(self): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _factory: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
_factory: Callable[[], Message] = ...) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
def close(self) -> Message: ...
|
||||
|
||||
class BytesFeedParser(FeedParser):
|
||||
def feed(self, data): ...
|
||||
if sys.version_info >= (3, 2):
|
||||
class BytesFeedParser:
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _factory: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
_factory: Callable[[], Message] = ...) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
def close(self) -> Message: ...
|
||||
|
||||
@@ -1,19 +1,44 @@
|
||||
# Stubs for email.generator (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import TextIO, Optional
|
||||
import sys
|
||||
from email.policy import Policy
|
||||
from email.message import Message
|
||||
|
||||
class Generator:
|
||||
maxheaderlen = ... # type: Any
|
||||
policy = ... # type: Any
|
||||
def __init__(self, outfp, mangle_from_=..., maxheaderlen=..., *, policy=...) -> None: ...
|
||||
def write(self, s): ...
|
||||
def flatten(self, msg, unixfrom=..., linesep=...): ...
|
||||
def clone(self, fp): ...
|
||||
def clone(self, fp: TextIO) -> 'Generator': ...
|
||||
def write(self, s: str) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, outfp: TextIO, mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, outfp: TextIO, # type: ignore
|
||||
mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
def flatten(self, msg: Message, unixfrom: bool = ...,
|
||||
linesep: Optional[str] =...) -> None: ...
|
||||
else:
|
||||
def flatten(self, msg: Message, # type: ignore
|
||||
unixfrom: bool = ...) -> None: ...
|
||||
|
||||
class BytesGenerator(Generator):
|
||||
def write(self, s): ...
|
||||
if sys.version_info >= (3, 2):
|
||||
class BytesGenerator:
|
||||
def clone(self, fp: TextIO) -> 'Generator': ...
|
||||
def write(self, s: str) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, outfp: TextIO, mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, outfp: TextIO, # type: ignore
|
||||
mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ...) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ...,
|
||||
linesep: Optional[str] =...) -> None: ...
|
||||
|
||||
class DecodedGenerator(Generator):
|
||||
def __init__(self, outfp, mangle_from_=..., maxheaderlen=..., fmt=...) -> None: ...
|
||||
# TODO `fmt` is positional
|
||||
def __init__(self, outfp: TextIO, mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ..., *, fmt: Optional[str]) -> None: ...
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
# Stubs for email.header (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
def decode_header(header): ...
|
||||
def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ...
|
||||
from typing import Union, Optional, Any, List, Tuple
|
||||
from email.charset import Charset
|
||||
|
||||
class Header:
|
||||
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=...,
|
||||
continuation_ws=..., errors=...): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def append(self, s, charset=..., errors=...): ...
|
||||
def encode(self, splitchars=..., maxlinelen=..., linesep=...): ...
|
||||
def __init__(self, s: Union[bytes, str, None] = ...,
|
||||
charset: Union[Charset, str, None] = ...,
|
||||
maxlinelen: Optional[int] = ...,
|
||||
header_name: Optional[str] = ..., 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 __str__(self) -> str: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
|
||||
class _ValueFormatter:
|
||||
def __init__(self, headerlen, maxlen, continuation_ws, splitchars) -> None: ...
|
||||
def newline(self): ...
|
||||
def add_transition(self): ...
|
||||
def feed(self, fws, string, charset): ...
|
||||
|
||||
class _Accumulator(list):
|
||||
def __init__(self, initial_size=...) -> None: ...
|
||||
def push(self, fws, string): ...
|
||||
def pop_from(self, i=...): ...
|
||||
def __len__(self): ...
|
||||
def reset(self, startval=...): ...
|
||||
def is_onlyws(self): ...
|
||||
def part_count(self): ...
|
||||
def decode_header(header: Header) -> List[Tuple[bytes, Optional[str]]]: ...
|
||||
def make_header(decoded_seq: List[Tuple[bytes, Optional[str]]],
|
||||
maxlinelen: Optional[int] =...,
|
||||
header_name: Optional[str] = ...,
|
||||
continuation_ws: str = ...) -> Header: ...
|
||||
|
||||
@@ -1,133 +1,101 @@
|
||||
# Stubs for email.headerregistry (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Tuple, Optional, Any, Union, Mapping
|
||||
import sys
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
import datetime as dt
|
||||
|
||||
class Address:
|
||||
def __init__(self, display_name=..., username=..., domain=..., addr_spec=...) -> None: ...
|
||||
@property
|
||||
def display_name(self): ...
|
||||
@property
|
||||
def username(self): ...
|
||||
@property
|
||||
def domain(self): ...
|
||||
@property
|
||||
def addr_spec(self): ...
|
||||
def __eq__(self, other): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
class Group:
|
||||
def __init__(self, display_name=..., addresses=...) -> None: ...
|
||||
@property
|
||||
def display_name(self): ...
|
||||
@property
|
||||
def addresses(self): ...
|
||||
def __eq__(self, other): ...
|
||||
class BaseHeader(str):
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def defects(self) -> Tuple[MessageDefect, ...]: ...
|
||||
@property
|
||||
def max_count(self) -> Optional[int]: ...
|
||||
def __new__(cls, name: str, value: Any) -> 'BaseHeader': ...
|
||||
def init(self, *args: Any, **kw: Any) -> None: ...
|
||||
def fold(self, *, policy: Policy) -> str: ...
|
||||
|
||||
class BaseHeader(str):
|
||||
def __new__(cls, name, value): ...
|
||||
def init(self, name, parse_tree, defects): ...
|
||||
@property
|
||||
def name(self): ...
|
||||
@property
|
||||
def defects(self): ...
|
||||
def __reduce__(self): ...
|
||||
def fold(self, policy): ...
|
||||
class UnstructuredHeader:
|
||||
@classmethod
|
||||
def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class UnstructuredHeader:
|
||||
max_count = ... # type: Any
|
||||
value_parser = ... # type: Any
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
class UniqueUnstructuredHeader(UnstructuredHeader): ...
|
||||
|
||||
class UniqueUnstructuredHeader(UnstructuredHeader):
|
||||
max_count = ... # type: Any
|
||||
class DateHeader:
|
||||
datetime = ... # type: dt.datetime
|
||||
@classmethod
|
||||
def parse(cls, string: Union[str, dt.datetime],
|
||||
kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class DateHeader:
|
||||
max_count = ... # type: Any
|
||||
value_parser = ... # type: Any
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def datetime(self): ...
|
||||
class UniqueDateHeader(DateHeader): ...
|
||||
|
||||
class UniqueDateHeader(DateHeader):
|
||||
max_count = ... # type: Any
|
||||
class AddressHeader:
|
||||
groups = ... # type: Tuple[Group, ...]
|
||||
addresses = ... # type: Tuple[Address, ...]
|
||||
@classmethod
|
||||
def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class AddressHeader:
|
||||
max_count = ... # type: Any
|
||||
@staticmethod
|
||||
def value_parser(value): ...
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def groups(self): ...
|
||||
@property
|
||||
def addresses(self): ...
|
||||
class UniqueAddressHeader(AddressHeader): ...
|
||||
|
||||
class UniqueAddressHeader(AddressHeader):
|
||||
max_count = ... # type: Any
|
||||
class SingleAddressHeader(AddressHeader):
|
||||
@property
|
||||
def address(self) -> Address: ...
|
||||
|
||||
class SingleAddressHeader(AddressHeader):
|
||||
@property
|
||||
def address(self): ...
|
||||
class UniqueSingleAddressHeader(SingleAddressHeader): ...
|
||||
|
||||
class UniqueSingleAddressHeader(SingleAddressHeader):
|
||||
max_count = ... # type: Any
|
||||
class MIMEVersionHeader:
|
||||
version = ... # type: Optional[str]
|
||||
major = ... # type: Optional[int]
|
||||
minor = ... # type: Optional[int]
|
||||
@classmethod
|
||||
def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class MIMEVersionHeader:
|
||||
max_count = ... # type: Any
|
||||
value_parser = ... # type: Any
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def major(self): ...
|
||||
@property
|
||||
def minor(self): ...
|
||||
@property
|
||||
def version(self): ...
|
||||
class ParameterizedMIMEHeader:
|
||||
params = ... # type: Mapping[str, Any]
|
||||
@classmethod
|
||||
def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class ParameterizedMIMEHeader:
|
||||
max_count = ... # type: Any
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def params(self): ...
|
||||
class ContentTypeHeader(ParameterizedMIMEHeader):
|
||||
content_type = ... # type: str
|
||||
maintype = ... # type: str
|
||||
subtype = ... # type: str
|
||||
|
||||
class ContentTypeHeader(ParameterizedMIMEHeader):
|
||||
value_parser = ... # type: Any
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def maintype(self): ...
|
||||
@property
|
||||
def subtype(self): ...
|
||||
@property
|
||||
def content_type(self): ...
|
||||
class ContentDispositionHeader(ParameterizedMIMEHeader):
|
||||
content_disposition = ... # type: str
|
||||
|
||||
class ContentDispositionHeader(ParameterizedMIMEHeader):
|
||||
value_parser = ... # type: Any
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def content_disposition(self): ...
|
||||
class ContentTransferEncoding:
|
||||
cte = ... # type: str
|
||||
@classmethod
|
||||
def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ...
|
||||
|
||||
class ContentTransferEncodingHeader:
|
||||
max_count = ... # type: Any
|
||||
value_parser = ... # type: Any
|
||||
@classmethod
|
||||
def parse(cls, value, kwds): ...
|
||||
def init(self, *args, **kw): ...
|
||||
@property
|
||||
def cte(self): ...
|
||||
class HeaderRegistry:
|
||||
def __init__(self, base_class: BaseHeader = ...,
|
||||
default_class: BaseHeader = ...,
|
||||
use_default_map: bool = ...) -> None: ...
|
||||
def map_to_type(self, name: str, cls: BaseHeader) -> None: ...
|
||||
def __getitem__(self, name: str) -> BaseHeader: ...
|
||||
def __call__(self, name: str, value: Any) -> BaseHeader: ...
|
||||
|
||||
class HeaderRegistry:
|
||||
registry = ... # type: Any
|
||||
base_class = ... # type: Any
|
||||
default_class = ... # type: Any
|
||||
def __init__(self, base_class=..., default_class=..., use_default_map=...) -> None: ...
|
||||
def map_to_type(self, name, cls): ...
|
||||
def __getitem__(self, name): ...
|
||||
def __call__(self, name, value): ...
|
||||
class Address:
|
||||
display_name = ... # type: str
|
||||
username = ... # type: str
|
||||
domain = ... # type: str
|
||||
@property
|
||||
def addr_spec(self) -> str: ...
|
||||
def __init__(self, display_name: str = ...,
|
||||
username: Optional[str] = ...,
|
||||
domain: Optional[str] = ...,
|
||||
addr_spec: Optional[str]=...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class Group:
|
||||
display_name = ... # type: Optional[str]
|
||||
addresses = ... # type: Tuple[Address, ...]
|
||||
def __init__(self, display_name: Optional[str] = ...,
|
||||
addresses: Optional[Tuple[Address, ...]] = ...) \
|
||||
-> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
@@ -1,74 +1,149 @@
|
||||
# Stubs for email.message (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import (
|
||||
Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any
|
||||
)
|
||||
import sys
|
||||
from email.charset import Charset
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
from email.contentmanager import ContentManager
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
_PayloadType = Union[List[Message], str]
|
||||
_CharsetType = Union[Charset, str, None]
|
||||
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
_ParamType = Union[str, Tuple[Optional[str], Optional[str], str]]
|
||||
|
||||
class Message:
|
||||
policy = ... # type: Any
|
||||
preamble = ... # type: Any
|
||||
defects = ... # type: Any
|
||||
def __init__(self, policy=...) -> None: ...
|
||||
def as_string(self, unixfrom=..., maxheaderlen=..., policy=...): ...
|
||||
def __bytes__(self): ...
|
||||
def as_bytes(self, unixfrom=..., policy=...): ...
|
||||
def is_multipart(self): ...
|
||||
def set_unixfrom(self, unixfrom): ...
|
||||
def get_unixfrom(self): ...
|
||||
def attach(self, payload): ...
|
||||
def get_payload(self, i=..., decode=...): ...
|
||||
def set_payload(self, payload, charset=...): ...
|
||||
def set_charset(self, charset): ...
|
||||
def get_charset(self): ...
|
||||
def __len__(self): ...
|
||||
def __getitem__(self, name): ...
|
||||
def __setitem__(self, name, val): ...
|
||||
def __delitem__(self, name): ...
|
||||
def __contains__(self, name): ...
|
||||
def __iter__(self): ...
|
||||
def keys(self): ...
|
||||
def values(self): ...
|
||||
def items(self): ...
|
||||
def get(self, name, failobj=...): ...
|
||||
def set_raw(self, name, value): ...
|
||||
def raw_items(self): ...
|
||||
def get_all(self, name, failobj=...): ...
|
||||
def add_header(self, _name, _value, **_params): ...
|
||||
def replace_header(self, _name, _value): ...
|
||||
def get_content_type(self): ...
|
||||
def get_content_maintype(self): ...
|
||||
def get_content_subtype(self): ...
|
||||
def get_default_type(self): ...
|
||||
def set_default_type(self, ctype): ...
|
||||
def get_params(self, failobj=..., header=..., unquote=...): ...
|
||||
def get_param(self, param, failobj=..., header=..., unquote=...): ...
|
||||
def set_param(self, param, value, header=..., requote=..., charset=..., language=...,
|
||||
replace=...): ...
|
||||
def del_param(self, param, header=..., requote=...): ...
|
||||
def set_type(self, type, header=..., requote=...): ...
|
||||
def get_filename(self, failobj=...): ...
|
||||
def get_boundary(self, failobj=...): ...
|
||||
def set_boundary(self, boundary): ...
|
||||
def get_content_charset(self, failobj=...): ...
|
||||
def get_charsets(self, failobj=...): ...
|
||||
preamble = ... # type: Optional[str]
|
||||
epilogue = ... # type: Optional[str]
|
||||
defects = ... # type: 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 attach(self, payload: 'Message') -> None: ...
|
||||
def get_payload(self, i: int = ..., decode: bool = ...) -> _PayloadType: ...
|
||||
def set_payload(self, payload: _PayloadType,
|
||||
charset: _CharsetType = ...) -> None: ...
|
||||
def set_charset(self, charset: _CharsetType) -> None: ...
|
||||
def get_charset(self) -> _CharsetType: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, name: str) -> bool: ...
|
||||
def __getitem__(self, name: str) -> Optional[str]: ...
|
||||
def __setitem__(self, name: str, val: str) -> None: ...
|
||||
def __delitem__(self, name: str) -> None: ...
|
||||
def keys(self) -> List[str]: ...
|
||||
def values(self) -> List[str]: ...
|
||||
def items(self) -> List[Tuple[str, str]]: ...
|
||||
def get(self, name: str, failobj: _T = ...) -> Union[str, _T]: ...
|
||||
def get_all(self, name: str, failobj: _T = ...) -> Union[List[str], _T]: ...
|
||||
def add_header(self, _name: str, _value: str, **_params: _ParamsType) \
|
||||
-> None: ...
|
||||
def replace_header(self, _name: str, _value: str) -> None: ...
|
||||
def get_content_type(self) -> str: ...
|
||||
def get_content_maintype(self) -> str: ...
|
||||
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 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 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 walk(self) -> Generator['Message', None, None]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def get_content_disposition(self) -> Optional[str]: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ...,
|
||||
policy: Optional[Policy] = ...) -> str: ...
|
||||
def as_bytes(self, unixfrom: bool = ...,
|
||||
policy: Optional[Policy] = ...) -> bytes: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def set_param(self, param: str, value: str, header: str = ...,
|
||||
requote: bool = ..., charset: str = ...,
|
||||
language: str = ..., replace: bool = ...) -> None: ...
|
||||
else:
|
||||
def as_string(self, unixfrom: bool = ..., # type: ignore
|
||||
maxheaderlen: int = ...) -> str: ...
|
||||
def set_param(self, param: str, value: str, # type: ignore
|
||||
header: str = ..., requote: bool = ...,
|
||||
charset: str = ..., language: str = ...) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self) -> None: ... # type: ignore
|
||||
|
||||
class MIMEPart(Message):
|
||||
def __init__(self, policy=...) -> None: ...
|
||||
@property
|
||||
def is_attachment(self): ...
|
||||
def get_body(self, preferencelist=...): ...
|
||||
def iter_attachments(self): ...
|
||||
def iter_parts(self): ...
|
||||
def get_content(self, *args, content_manager=..., **kw): ...
|
||||
def set_content(self, *args, content_manager=..., **kw): ...
|
||||
def make_related(self, boundary=...): ...
|
||||
def make_alternative(self, boundary=...): ...
|
||||
def make_mixed(self, boundary=...): ...
|
||||
def add_related(self, *args, **kw): ...
|
||||
def add_alternative(self, *args, **kw): ...
|
||||
def add_attachment(self, *args, **kw): ...
|
||||
def clear(self): ...
|
||||
def clear_content(self): ...
|
||||
class EmailMessage:
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
def get_body(self,
|
||||
preferencelist: Sequence[str] = ...) -> Optional[Message]: ...
|
||||
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_attachement(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def clear_content(self) -> None: ...
|
||||
if sys.version_info >= (3, 4, 2):
|
||||
def is_attachment(self) -> bool: ...
|
||||
else:
|
||||
@property
|
||||
def is_attachment(self) -> bool: ...
|
||||
|
||||
class EmailMessage(MIMEPart):
|
||||
def set_content(self, *args, **kw): ...
|
||||
class MIMEPart:
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
def get_body(self,
|
||||
preferencelist: Sequence[str] = ...) -> Optional[Message]: ...
|
||||
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_attachement(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def clear_content(self) -> None: ...
|
||||
if sys.version_info >= (3, 4, 2):
|
||||
def is_attachment(self) -> bool: ...
|
||||
else:
|
||||
@property
|
||||
def is_attachment(self) -> bool: ...
|
||||
|
||||
@@ -1,29 +1,61 @@
|
||||
# Stubs for email.parser (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Callable, Optional, TextIO, BinaryIO
|
||||
import email.feedparser
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
import sys
|
||||
|
||||
FeedParser = email.feedparser.FeedParser
|
||||
BytesFeedParser = email.feedparser.BytesFeedParser
|
||||
|
||||
class Parser:
|
||||
policy = ... # type: Any
|
||||
def __init__(self, _class=..., *, policy=...) -> None: ...
|
||||
def parse(self, fp, headersonly=...): ...
|
||||
def parsestr(self, text, headersonly=...): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
class HeaderParser(Parser):
|
||||
def parse(self, fp, headersonly=...): ...
|
||||
def parsestr(self, text, headersonly=...): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
class BytesParser:
|
||||
parser = ... # type: Any
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
def parse(self, fp, headersonly=...): ...
|
||||
def parsebytes(self, text, headersonly=...): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class BytesHeaderParser(BytesParser):
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
class BytesParser:
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ...
|
||||
def parsestr(self, text: str, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
class BytesHeaderParser(BytesParser):
|
||||
def parse(self, fp, headersonly=...): ...
|
||||
def parsebytes(self, text, headersonly=...): ...
|
||||
|
||||
@@ -1,26 +1,68 @@
|
||||
# Stubs for email.policy (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
import email._policybase
|
||||
from typing import Any, Optional, Tuple, Union, Callable
|
||||
import sys
|
||||
from email.message import Message
|
||||
from email.errors import MessageDefect
|
||||
from email.header import Header
|
||||
from email.contentmanager import ContentManager
|
||||
from abc import abstractmethod
|
||||
|
||||
Policy = email._policybase.Policy
|
||||
Compat32 = email._policybase.Compat32
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
class EmailPolicy(Policy):
|
||||
refold_source = ... # type: Any
|
||||
header_factory = ... # type: Any
|
||||
content_manager = ... # type: Any
|
||||
def __init__(self, **kw) -> None: ...
|
||||
def header_max_count(self, name): ...
|
||||
def header_source_parse(self, sourcelines): ...
|
||||
def header_store_parse(self, name, value): ...
|
||||
def header_fetch_parse(self, name, value): ...
|
||||
def fold(self, name, value): ...
|
||||
def fold_binary(self, name, value): ...
|
||||
class Policy:
|
||||
max_line_length = ... # type: Optional[int]
|
||||
linesep = ... # type: str
|
||||
cte_type = ... # type: str
|
||||
raise_on_defect = ... # type: bool
|
||||
if sys.version_info >= (3, 5):
|
||||
mange_from = ... # type: bool
|
||||
def __init__(**kw: Any) -> None: ...
|
||||
def clone(**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]: ...
|
||||
@abstractmethod
|
||||
def header_source_parse(self, sourcelines: List[str]) -> str: ...
|
||||
@abstractmethod
|
||||
def header_store_parse(self, name: str,
|
||||
value: str) -> Tuple[str, str]: ...
|
||||
@abstractmethod
|
||||
def header_fetch_parse(self, name: str,
|
||||
value: str) -> str: ...
|
||||
@abstractmethod
|
||||
def fold(self, name: str, value: str) -> str: ...
|
||||
@abstractmethod
|
||||
def fold_binary(self, name: str, value: str) -> bytes: ...
|
||||
|
||||
default = ... # type: Any
|
||||
strict = ... # type: Any
|
||||
SMTP = ... # type: Any
|
||||
HTTP = ... # type: Any
|
||||
class Compat32(Policy):
|
||||
def header_source_parse(self, sourcelines: List[str]) -> str: ...
|
||||
def header_store_parse(self, name: str,
|
||||
value: str) -> Tuple[str, str]: ...
|
||||
def header_fetch_parse(self, name: str, # type: ignore
|
||||
value: str) -> Union[str, Header]: ...
|
||||
def fold(self, name: str, value: str) -> str: ...
|
||||
def fold_binary(self, name: str, value: str) -> bytes: ...
|
||||
|
||||
compat32 = ... # type: Compat32
|
||||
|
||||
class EmailPolicy(Policy):
|
||||
utf8 = ... # type: bool
|
||||
refold_source = ... # type: str
|
||||
header_factory = ... # type: Callable[[str, str], str]
|
||||
if sys.version_info >= (3, 4):
|
||||
content_manager = ... # type: ContentManager
|
||||
def header_source_parse(self, sourcelines: List[str]) -> str: ...
|
||||
def header_store_parse(self, name: str,
|
||||
value: str) -> Tuple[str, str]: ...
|
||||
def header_fetch_parse(self, name: str, value: str) -> str: ...
|
||||
def fold(self, name: str, value: str) -> str: ...
|
||||
def fold_binary(self, name: str, value: str) -> bytes: ...
|
||||
|
||||
default = ... # type: EmailPolicy
|
||||
SMTP = ... # type: EmailPolicy
|
||||
SMTPUTF8 = ... # type: EmailPolicy
|
||||
HTTP = ... # type: EmailPolicy
|
||||
strict = ... # type: EmailPolicy
|
||||
|
||||
Reference in New Issue
Block a user