1
- from typing import Any
1
+ from email .message import Message as _Message
2
+ from typing import (
3
+ Any , AnyStr , Dict , Generic , List , Optional , Sequence , Tuple , Union )
4
+
5
+ _Reply = Tuple [int , bytes ]
6
+ _SendErrs = Dict [str , _Reply ]
2
7
3
8
class SMTPException (OSError ): ...
4
9
class SMTPServerDisconnected (SMTPException ): ...
5
10
6
11
class SMTPResponseException (SMTPException ):
7
- smtp_code = ... # type: Any
8
- smtp_error = ... # type: Any
9
- args = ... # type: Any
10
- def __init__ (self , code , msg ) -> None : ...
12
+ smtp_code = ... # type: int
13
+ smtp_error = ... # type: Union[bytes, str]
14
+ args = ... # type: Union[Tuple[int, Union[bytes, str]], Tuple[int, bytes, str]]
15
+ def __init__ (self , code : int , msg : Union [ bytes , str ] ) -> None : ...
11
16
12
17
class SMTPSenderRefused (SMTPResponseException ):
13
- smtp_code = ... # type: Any
14
- smtp_error = ... # type: Any
15
- sender = ... # type: Any
16
- args = ... # type: Any
17
- def __init__ (self , code , msg , sender ) -> None : ...
18
+ smtp_code = ... # type: int
19
+ smtp_error = ... # type: bytes
20
+ sender = ... # type: str
21
+ args = ... # type: Tuple[int, bytes, str]
22
+ def __init__ (self , code : int , msg : bytes , sender : str ) -> None : ...
18
23
19
24
class SMTPRecipientsRefused (SMTPException ):
20
- recipients = ... # type: Any
21
- args = ... # type: Any
22
- def __init__ (self , recipients ) -> None : ...
25
+ recipients = ... # type: _SendErrs
26
+ args = ... # type: Tuple[_SendErrs]
27
+ def __init__ (self , recipients : _SendErrs ) -> None : ...
23
28
24
29
class SMTPDataError (SMTPResponseException ): ...
25
30
class SMTPConnectError (SMTPResponseException ): ...
@@ -30,49 +35,53 @@ def quoteaddr(addrstring): ...
30
35
def quotedata (data ): ...
31
36
32
37
class SMTP :
33
- debuglevel = ... # type: Any
38
+ debuglevel = ... # type: int
34
39
file = ... # type: Any
35
40
helo_resp = ... # type: Any
36
41
ehlo_msg = ... # type: Any
37
42
ehlo_resp = ... # type: Any
38
43
does_esmtp = ... # type: Any
39
44
default_port = ... # type: Any
40
- timeout = ... # type: Any
45
+ timeout = ... # type: float
41
46
esmtp_features = ... # type: Any
42
47
source_address = ... # type: Any
43
48
local_hostname = ... # type: Any
44
- def __init__ (self , host = ..., port = ..., local_hostname = ..., timeout = ...,
45
- source_address = ...): ...
49
+ def __init__ (self , host : str = ..., port : int = ...,
50
+ local_hostname : Optional [str ] = ..., timeout : float = ...,
51
+ source_address : Tuple [str , int ] = ...) -> None : ...
46
52
def __enter__ (self ): ...
47
53
def __exit__ (self , * args ): ...
48
- def set_debuglevel (self , debuglevel ) : ...
54
+ def set_debuglevel (self , debuglevel : int ) -> None : ...
49
55
sock = ... # type: Any
50
56
def connect (self , host = ..., port = ..., source_address = ...): ...
51
57
def send (self , s ): ...
52
58
def putcmd (self , cmd , args = ...): ...
53
- def getreply (self ): ...
59
+ def getreply (self ) -> _Reply : ...
54
60
def docmd (self , cmd , args = ...): ...
55
61
def helo (self , name = ...): ...
56
62
def ehlo (self , name = ...): ...
57
63
def has_extn (self , opt ): ...
58
64
def help (self , args = ...): ...
59
- def rset (self ): ...
60
- def noop (self ): ...
61
- def mail (self , sender , options = ...): ...
62
- def rcpt (self , recip , options = ...): ...
65
+ def rset (self ) -> _Reply : ...
66
+ def noop (self ) -> _Reply : ...
67
+ def mail (self , sender : str , options : Sequence [ str ] = ...) -> _Reply : ...
68
+ def rcpt (self , recip : str , options : Sequence [ str ] = ...) -> _Reply : ...
63
69
def data (self , msg ): ...
64
70
def verify (self , address ): ...
65
71
vrfy = ... # type: Any
66
72
def expn (self , address ): ...
67
73
def ehlo_or_helo_if_needed (self ): ...
68
74
def login (self , user , password ): ...
69
75
def starttls (self , keyfile = ..., certfile = ..., context = ...): ...
70
- def sendmail (self , from_addr , to_addrs , msg , mail_options = ...,
71
- rcpt_options = ...): ...
72
- def send_message (self , msg , from_addr = ..., to_addrs = ..., mail_options = ...,
73
- rcpt_options = ...): ...
76
+ def sendmail (self , from_addr : str , to_addrs : Union [str , Sequence [str ]],
77
+ msg : Union [bytes , str ], mail_options : Sequence [str ] = ...,
78
+ rcpt_options : List [str ] = ...) -> _SendErrs : ...
79
+ def send_message (self , msg : _Message , from_addr : Optional [str ] = ...,
80
+ to_addrs : Optional [Union [str , Sequence [str ]]] = ...,
81
+ mail_options : List [str ] = ...,
82
+ rcpt_options : Sequence [str ] = ...) -> _SendErrs : ...
74
83
def close (self ): ...
75
- def quit (self ): ...
84
+ def quit (self ) -> _Reply : ...
76
85
77
86
class SMTP_SSL (SMTP ):
78
87
default_port = ... # type: Any
@@ -84,7 +93,9 @@ class SMTP_SSL(SMTP):
84
93
85
94
class LMTP (SMTP ):
86
95
ehlo_msg = ... # type: Any
87
- def __init__ (self , host = ..., port = ..., local_hostname = ..., source_address = ...) -> None : ...
96
+ def __init__ (self , host : str = ..., port : int = ...,
97
+ local_hostname : Optional [str ] = ...,
98
+ source_address : Optional [Tuple [str , int ]] = ...) -> None : ...
88
99
sock = ... # type: Any
89
100
file = ... # type: Any
90
101
def connect (self , host = ..., port = ..., source_address = ...): ...
0 commit comments