diff options
Diffstat (limited to 'Lib/email')
| -rw-r--r-- | Lib/email/__init__.py | 2 | ||||
| -rw-r--r-- | Lib/email/charset.py | 3 | ||||
| -rw-r--r-- | Lib/email/header.py | 3 | ||||
| -rw-r--r-- | Lib/email/headerregistry.py | 6 | ||||
| -rw-r--r-- | Lib/email/message.py | 16 | ||||
| -rw-r--r-- | Lib/email/mime/text.py | 3 |
6 files changed, 8 insertions, 25 deletions
diff --git a/Lib/email/__init__.py b/Lib/email/__init__.py index ff16f6a..fae8724 100644 --- a/Lib/email/__init__.py +++ b/Lib/email/__init__.py @@ -4,8 +4,6 @@ """A package for parsing, handling, and generating email messages.""" -__version__ = '5.1.0' - __all__ = [ 'base64mime', 'charset', diff --git a/Lib/email/charset.py b/Lib/email/charset.py index e999472..ee56404 100644 --- a/Lib/email/charset.py +++ b/Lib/email/charset.py @@ -249,9 +249,6 @@ class Charset: def __eq__(self, other): return str(self) == str(other).lower() - def __ne__(self, other): - return not self.__eq__(other) - def get_body_encoding(self): """Return the content-transfer-encoding used for body encoding. diff --git a/Lib/email/header.py b/Lib/email/header.py index 9c89589..6820ea1 100644 --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -262,9 +262,6 @@ class Header: # args and do another comparison. return other == str(self) - def __ne__(self, other): - return not self == other - def append(self, s, charset=None, errors='strict'): """Append a string to the MIME header. diff --git a/Lib/email/headerregistry.py b/Lib/email/headerregistry.py index 911a2af..468ca9e 100644 --- a/Lib/email/headerregistry.py +++ b/Lib/email/headerregistry.py @@ -81,7 +81,8 @@ class Address: return lp def __repr__(self): - return "Address(display_name={!r}, username={!r}, domain={!r})".format( + return "{}(display_name={!r}, username={!r}, domain={!r})".format( + self.__class__.__name__, self.display_name, self.username, self.domain) def __str__(self): @@ -132,7 +133,8 @@ class Group: return self._addresses def __repr__(self): - return "Group(display_name={!r}, addresses={!r}".format( + return "{}(display_name={!r}, addresses={!r}".format( + self.__class__.__name__, self.display_name, self.addresses) def __str__(self): diff --git a/Lib/email/message.py b/Lib/email/message.py index 2f37dbb..3d3138f 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -930,17 +930,6 @@ class Message: # I.e. def walk(self): ... from email.iterators import walk -# XXX Support for temporary deprecation hack for is_attachment property. -class _IsAttachment: - def __init__(self, value): - self.value = value - def __call__(self): - return self.value - def __bool__(self): - warnings.warn("is_attachment will be a method, not a property, in 3.5", - DeprecationWarning, - stacklevel=3) - return self.value class MIMEPart(Message): @@ -950,12 +939,9 @@ class MIMEPart(Message): policy = default Message.__init__(self, policy) - @property def is_attachment(self): c_d = self.get('content-disposition') - result = False if c_d is None else c_d.content_disposition == 'attachment' - # XXX transitional hack to raise deprecation if not called. - return _IsAttachment(result) + return False if c_d is None else c_d.content_disposition == 'attachment' def _find_body(self, part, preferencelist): if part.is_attachment(): diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py index ec18b85..479928e 100644 --- a/Lib/email/mime/text.py +++ b/Lib/email/mime/text.py @@ -6,6 +6,7 @@ __all__ = ['MIMEText'] +from email.charset import Charset from email.mime.nonmultipart import MIMENonMultipart @@ -34,6 +35,8 @@ class MIMEText(MIMENonMultipart): _charset = 'us-ascii' except UnicodeEncodeError: _charset = 'utf-8' + if isinstance(_charset, Charset): + _charset = str(_charset) MIMENonMultipart.__init__(self, 'text', _subtype, **{'charset': _charset}) |
