File: message.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (130 lines) | stat: -rw-r--r-- 6,134 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Stubs for email.message (Python 3.4)

from typing import (
    List, Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any
)
import sys
from email.charset import Charset
from email.errors import MessageDefect
if sys.version_info >= (3, 3):
    from email.policy import Policy
if sys.version_info >= (3, 4):
    from email.contentmanager import ContentManager
else:
    ContentManager = object  # Hack so we can reference it in argument types.

_T = TypeVar('_T')

_PayloadType = Union[List[Message], str, bytes]
_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:
    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 = ...) \
                    -> Optional[_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 = ...,
                      maxheaderlen: int = ...) -> str: ...
        def set_param(self, param: str, value: str,
                      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: ...

class MIMEPart:
    if sys.version_info >= (3, 3):
        def __init__(self, policy: Policy = ...) -> None: ...
    else:
        def __init__(self) -> 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: Any,
                    content_manager: Optional[ContentManager] = ...,
                    **kw: Any) -> None: ...