Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit c4403f2

Browse files
TheKevJamesashwoods
authored andcommitted
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.
1 parent 97b7d56 commit c4403f2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

‎raven/breadcrumbs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
from __future__ import absolute_import
22

3-
import collections
43
import os
54
import logging
65

6+
try:
7+
from collections.abc import Mapping
8+
except ImportError:
9+
# Python < 3.3
10+
from collections import Mapping
711
from time import time
812
from types import FunctionType
913

@@ -140,7 +144,7 @@ def processor(data):
140144
data_value = kwargs
141145
data_value.update(extra)
142146

143-
if args and len(args) == 1 and isinstance(args[0], collections.Mapping) and args[0]:
147+
if args and len(args) == 1 and isinstance(args[0], Mapping) and args[0]:
144148
format_args = args[0]
145149
data_value.update(format_args)
146150

‎raven/context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"""
88
from __future__ import absolute_import
99

10-
from collections import Mapping, Iterable
10+
try:
11+
from collections.abc import Mapping, Iterable
12+
except ImportError:
13+
# Python < 3.3
14+
from collections import Mapping, Iterable
1115
from threading import local
1216
from weakref import ref as weakref
1317

0 commit comments

Comments
 (0)