mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Python 3.8 (prep): Import Mapping etc. from collections.abc
Python 3.3 moved various collections abstract base classes from `collections` to `collections.abc`, but also kept them available in `collections` for compatibility with Python 2. Python 3.8 will allow importing only from `collections.abc`. (`collections.abc` hasn't yet been added to six.moves; see https://github.com/benjaminp/six/issues/155.)
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import uuid
|
||||
from collections import Mapping
|
||||
from email.utils import quote as rfc822_quote
|
||||
import warnings
|
||||
from email.utils import quote as rfc822_quote
|
||||
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
from .base_requests import AnymailRequestsBackend, RequestsPayload
|
||||
from ..exceptions import AnymailConfigurationError, AnymailRequestsAPIError, AnymailWarning
|
||||
from ..message import AnymailRecipientStatus
|
||||
from ..utils import BASIC_NUMERIC_TYPES, get_anymail_setting, timestamp, update_deep
|
||||
from ..utils import BASIC_NUMERIC_TYPES, Mapping, get_anymail_setting, timestamp, update_deep
|
||||
|
||||
|
||||
class EmailBackend(AnymailRequestsBackend):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import base64
|
||||
import mimetypes
|
||||
from base64 import b64encode
|
||||
from collections import Mapping, MutableMapping
|
||||
from datetime import datetime
|
||||
from email.mime.base import MIMEBase
|
||||
from email.utils import formatdate, getaddresses, unquote
|
||||
@@ -15,6 +14,11 @@ from django.utils.functional import Promise
|
||||
from django.utils.timezone import utc, get_fixed_timezone
|
||||
from six.moves.urllib.parse import urlsplit, urlunsplit
|
||||
|
||||
try:
|
||||
from collections.abc import Mapping, MutableMapping # Python 3.3+
|
||||
except ImportError:
|
||||
from collections import Mapping, MutableMapping
|
||||
|
||||
from .exceptions import AnymailConfigurationError, AnymailInvalidAddress
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user