email.mime: add policy arguments (#3827)

This commit is contained in:
Shantanu
2020-03-08 11:06:55 -04:00
committed by GitHub
parent 60c59a560e
commit d8b081130d
10 changed files with 107 additions and 29 deletions

View File

@@ -1,11 +1,28 @@
# Stubs for email.mime.application (Python 3.4)
from typing import Callable, Optional, Tuple, Union
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy
from typing import Callable, Optional, Tuple, Union
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEApplication(MIMENonMultipart):
def __init__(self, _data: Union[str, bytes], _subtype: str = ...,
_encoder: Callable[[MIMEApplication], None] = ...,
**_params: _ParamsType) -> None: ...
if sys.version_info >= (3, 6):
def __init__(
self,
_data: Union[str, bytes],
_subtype: str = ...,
_encoder: Callable[[MIMEApplication], None] = ...,
*,
policy: Optional[Policy] = ...,
**_params: _ParamsType,
) -> None: ...
else:
def __init__(
self,
_data: Union[str, bytes],
_subtype: str = ...,
_encoder: Callable[[MIMEApplication], None] = ...,
**_params: _ParamsType,
) -> None: ...

View File

@@ -1,11 +1,28 @@
# Stubs for email.mime.audio (Python 3.4)
from typing import Callable, Optional, Tuple, Union
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy
from typing import Callable, Optional, Tuple, Union
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata: Union[str, bytes], _subtype: Optional[str] = ...,
_encoder: Callable[[MIMEAudio], None] = ...,
**_params: _ParamsType) -> None: ...
if sys.version_info >= (3, 6):
def __init__(
self,
_audiodata: Union[str, bytes],
_subtype: Optional[str] = ...,
_encoder: Callable[[MIMEAudio], None] = ...,
*,
policy: Optional[Policy] = ...,
**_params: _ParamsType,
) -> None: ...
else:
def __init__(
self,
_audiodata: Union[str, bytes],
_subtype: Optional[str] = ...,
_encoder: Callable[[MIMEAudio], None] = ...,
**_params: _ParamsType,
) -> None: ...

View File

@@ -1,10 +1,14 @@
# Stubs for email.mime.base (Python 3.4)
from typing import Optional, Tuple, Union
import email.message
import sys
from email.policy import Policy
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,
**_params: _ParamsType) -> None: ...
if sys.version_info >= (3, 6):
def __init__(self, _maintype: str, _subtype: str, *, policy: Optional[Policy] = ..., **_params: _ParamsType) -> None: ...
else:
def __init__(self, _maintype: str, _subtype: str, **_params: _ParamsType) -> None: ...

View File

@@ -1,11 +1,28 @@
# Stubs for email.mime.image (Python 3.4)
from typing import Callable, Optional, Tuple, Union
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy
from typing import Callable, Optional, Tuple, Union
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata: Union[str, bytes], _subtype: Optional[str] = ...,
_encoder: Callable[[MIMEImage], None] = ...,
**_params: _ParamsType) -> None: ...
if sys.version_info >= (3, 6):
def __init__(
self,
_imagedata: Union[str, bytes],
_subtype: Optional[str] = ...,
_encoder: Callable[[MIMEImage], None] = ...,
*,
policy: Optional[Policy] = ...,
**_params: _ParamsType,
) -> None: ...
else:
def __init__(
self,
_imagedata: Union[str, bytes],
_subtype: Optional[str] = ...,
_encoder: Callable[[MIMEImage], None] = ...,
**_params: _ParamsType,
) -> None: ...

View File

@@ -1,7 +1,13 @@
# Stubs for email.mime.message (Python 3.4)
import sys
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 = ...) -> None: ...
if sys.version_info >= (3, 6):
def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Optional[Policy] = ...) -> None: ...
else:
def __init__(self, _msg: Message, _subtype: str = ...) -> None: ...

View File

@@ -1,12 +1,29 @@
# Stubs for email.mime.multipart (Python 3.4)
from typing import Optional, Sequence, Tuple, Union
import sys
from email.message import Message
from email.mime.base import MIMEBase
from email.policy import Policy
from typing import Optional, Sequence, Tuple, Union
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEMultipart(MIMEBase):
def __init__(self, _subtype: str = ..., boundary: Optional[str] = ...,
_subparts: Optional[Sequence[Message]] = ...,
**_params: _ParamsType) -> None: ...
if sys.version_info >= (3, 6):
def __init__(
self,
_subtype: str = ...,
boundary: Optional[str] = ...,
_subparts: Optional[Sequence[Message]] = ...,
*,
policy: Optional[Policy] = ...,
**_params: _ParamsType,
) -> None: ...
else:
def __init__(
self,
_subtype: str = ...,
boundary: Optional[str] = ...,
_subparts: Optional[Sequence[Message]] = ...,
**_params: _ParamsType,
) -> None: ...

View File

@@ -1,8 +1,14 @@
# Stubs for email.mime.text (Python 3.4)
from typing import Optional
import sys
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] = ...) -> None: ...
if sys.version_info >= (3, 6):
def __init__(
self, _text: str, _subtype: str = ..., _charset: Optional[str] = ..., *, policy: Optional[Policy] = ...
) -> None: ...
else:
def __init__(self, _text: str, _subtype: str = ..., _charset: Optional[str] = ...) -> None: ...