Skip to content

Commit 4f92357

Browse files
5j9gsnedders
authored andcommitted
Try to import MutableMapping from collections.abc (#403)
Note that collections.abc has been added in Python 3.3. Fixes #402
1 parent 0ba6628 commit 4f92357

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

html5lib/_trie/_base.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3-
from collections import Mapping
3+
try:
4+
from collections.abc import Mapping
5+
except ImportError: # Python 2.7
6+
from collections import Mapping
47

58

69
class Trie(Mapping):

html5lib/treebuilders/dom.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from __future__ import absolute_import, division, unicode_literals
22

33

4-
from collections import MutableMapping
4+
try:
5+
from collections.abc import MutableMapping
6+
except ImportError: # Python 2.7
7+
from collections import MutableMapping
58
from xml.dom import minidom, Node
69
import weakref
710

0 commit comments

Comments
 (0)