Complete stubs for email package in python2 (#1936)

Fix #685, fix #275
This commit is contained in:
Svyatoslav Ilinskiy
2018-03-06 21:38:01 -08:00
committed by Jelle Zijlstra
parent 89e5d9607c
commit d702d3621c
14 changed files with 165 additions and 6 deletions

View File

@@ -0,0 +1,8 @@
def base64_len(s: bytes) -> int: ...
def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ...
def encode(s, binary=..., maxlinelen=..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(s, convert_eols=...): ...
body_decode = decode
decodestring = decode

View File

@@ -0,0 +1,22 @@
def add_charset(charset, header_enc=..., body_enc=..., output_charset=...) -> None: ...
def add_alias(alias, canonical) -> None: ...
def add_codec(charset, codecname) -> None: ...
class Charset:
input_charset = ...
header_encoding = ...
body_encoding = ...
output_charset = ...
input_codec = ...
output_codec = ...
def __init__(self, input_charset=...) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def get_body_encoding(self): ...
def convert(self, s): ...
def to_splittable(self, s): ...
def from_splittable(self, ustr, to_output: bool = ...): ...
def get_output_charset(self): ...
def encoded_header_len(self, s): ...
def header_encode(self, s, convert: bool = ...): ...
def body_encode(self, s, convert: bool = ...): ...

View File

@@ -0,0 +1,4 @@
def encode_base64(msg) -> None: ...
def encode_quopri(msg) -> None: ...
def encode_7or8bit(msg) -> None: ...
def encode_noop(msg) -> None: ...

View File

@@ -0,0 +1,18 @@
class BufferedSubFile:
def __init__(self) -> None: ...
def push_eof_matcher(self, pred) -> None: ...
def pop_eof_matcher(self): ...
def close(self) -> None: ...
def readline(self): ...
def unreadline(self, line) -> None: ...
def push(self, data): ...
def pushlines(self, lines) -> None: ...
def is_closed(self): ...
def __iter__(self): ...
def next(self): ...
class FeedParser:
def __init__(self, _factory=...) -> None: ...
def feed(self, data) -> None: ...
def close(self): ...

View File

@@ -0,0 +1,9 @@
class Generator:
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ...) -> None: ...
def write(self, s) -> None: ...
def flatten(self, msg, unixfrom: bool = ...) -> None: ...
def clone(self, fp): ...
class DecodedGenerator(Generator):
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ...

11
stdlib/2/email/header.pyi Normal file
View File

@@ -0,0 +1,11 @@
def decode_header(header): ...
def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ...
class Header:
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=...,
errors=...) -> None: ...
def __unicode__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def append(self, s, charset=..., errors=...) -> None: ...
def encode(self, splitchars=...): ...

View File

@@ -0,0 +1,5 @@
from typing import Generator
def walk(self) -> Generator: ...
def body_line_iterator(msg, decode: bool = ...) -> Generator: ...
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator: ...

View File

@@ -0,0 +1,45 @@
from typing import Generator
class Message:
preamble = ...
epilogue = ...
defects = ...
def __init__(self): ...
def as_string(self, unixfrom=...): ...
def is_multipart(self) -> bool: ...
def set_unixfrom(self, unixfrom) -> None: ...
def get_unixfrom(self): ...
def attach(self, payload) -> None: ...
def get_payload(self, i=..., decode: bool = ...): ...
def set_payload(self, payload, charset=...) -> None: ...
def set_charset(self, charset): ...
def get_charset(self): ...
def __len__(self): ...
def __getitem__(self, name): ...
def __setitem__(self, name, val) -> None: ...
def __delitem__(self, name) -> None: ...
def __contains__(self, name): ...
def has_key(self, name) -> bool: ...
def keys(self): ...
def values(self): ...
def items(self): ...
def get(self, name, failobj=...): ...
def get_all(self, name, failobj=...): ...
def add_header(self, _name, _value, **_params) -> None: ...
def replace_header(self, _name, _value) -> None: ...
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) -> None: ...
def get_params(self, failobj=..., header=..., unquote: bool = ...): ...
def get_param(self, param, failobj=..., header=..., unquote: bool = ...): ...
def set_param(self, param, value, header=..., requote: bool = ..., charset=..., language=...) -> None: ...
def del_param(self, param, header=..., requote: bool = ...): ...
def set_type(self, type, header=..., requote: bool = ...): ...
def get_filename(self, failobj=...): ...
def get_boundary(self, failobj=...): ...
def set_boundary(self, boundary) -> None: ...
def get_content_charset(self, failobj=...): ...
def get_charsets(self, failobj=...): ...
def walk(self) -> Generator: ...

View File

@@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ...

View File

@@ -1,8 +1,4 @@
# NOTE: This stub is incomplete.
from email import message
# import message
# TODO
# class MIMEBase(message.Message):
class MIMEBase:
class MIMEBase(message.Message):
def __init__(self, _maintype, _subtype, **_params) -> None: ...

View File

@@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ...

View File

@@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
def __init__(self, _msg, _subtype=...) -> None: ...

View File

@@ -0,0 +1,8 @@
class Parser:
def __init__(self, *args, **kws) -> None: ...
def parse(self, fp, headersonly: bool = ...): ...
def parsestr(self, text, headersonly: bool = ...): ...
class HeaderParser(Parser):
def parse(self, fp, headersonly: bool = ...): ...
def parsestr(self, text, headersonly: bool = ...): ...

View File

@@ -0,0 +1,18 @@
def header_quopri_check(c): ...
def body_quopri_check(c): ...
def header_quopri_len(s): ...
def body_quopri_len(str): ...
def unquote(s): ...
def quote(c): ...
def header_encode(header, charset: str = ..., keep_eols: bool = ..., maxlinelen: int = ..., eol=...): ...
def encode(body, binary: bool = ..., maxlinelen: int = ..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(encoded, eol=...): ...
body_decode = decode
decodestring = decode
def header_decode(s): ...