summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin James <kevin@talkiq.com>2018-09-10 14:40:08 -0700
committerAshley Camba <ashwoods@gmail.com>2018-09-15 01:02:28 +0200
commitc4403f21973138cd20cf9c005da4fb934836d76e (patch)
tree74b231fcf7c9acbec88f240a33edd23c603e22ef
parent97b7d560275d1b822b2985ae1fc5e5533c2cfeee (diff)
downloadraven-c4403f21973138cd20cf9c005da4fb934836d76e.tar.gz
chore(deprecation): fix collections.abc imports
As of Python 3.7, importing ABCs directly from collections has been deprecated. > DeprecationWarning: Using or importing the ABCs from 'collections' > instead of from 'collections.abc' is deprecated, and in 3.8 it > will stop working.
-rw-r--r--raven/breadcrumbs.py8
-rw-r--r--raven/context.py6
2 files changed, 11 insertions, 3 deletions
diff --git a/raven/breadcrumbs.py b/raven/breadcrumbs.py
index fbf3026..99ff013 100644
--- a/raven/breadcrumbs.py
+++ b/raven/breadcrumbs.py
@@ -1,9 +1,13 @@
from __future__ import absolute_import
-import collections
import os
import logging
+try:
+ from collections.abc import Mapping
+except ImportError:
+ # Python < 3.3
+ from collections import Mapping
from time import time
from types import FunctionType
@@ -140,7 +144,7 @@ def _record_log_breadcrumb(logger, level, msg, *args, **kwargs):
data_value = kwargs
data_value.update(extra)
- if args and len(args) == 1 and isinstance(args[0], collections.Mapping) and args[0]:
+ if args and len(args) == 1 and isinstance(args[0], Mapping) and args[0]:
format_args = args[0]
data_value.update(format_args)
diff --git a/raven/context.py b/raven/context.py
index 272259a..072be93 100644
--- a/raven/context.py
+++ b/raven/context.py
@@ -7,7 +7,11 @@ raven.context
"""
from __future__ import absolute_import
-from collections import Mapping, Iterable
+try:
+ from collections.abc import Mapping, Iterable
+except ImportError:
+ # Python < 3.3
+ from collections import Mapping, Iterable
from threading import local
from weakref import ref as weakref