Skip to content

Commit c414d10

Browse files
authored
Fix warning about collections.abc deprecation (#782)
1 parent 41f0d20 commit c414d10

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pynamodb/attributes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
)
2020
from pynamodb.expressions.operand import Path
2121
from pynamodb._compat import getfullargspec
22-
import collections
22+
23+
try:
24+
from collections.abc import Mapping # noqa
25+
except ImportError:
26+
from collections import Mapping # noqa
2327

2428

2529
class Attribute(object):
@@ -786,7 +790,7 @@ def __setattr__(self, name, value):
786790
object.__setattr__(self, name, value)
787791

788792
def __set__(self, instance, value):
789-
if isinstance(value, collections.Mapping):
793+
if isinstance(value, Mapping):
790794
value = type(self)(**value)
791795
return super(MapAttribute, self).__set__(instance, value)
792796

0 commit comments

Comments
 (0)