diff options
Diffstat (limited to 'constructor.py')
-rw-r--r-- | constructor.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/constructor.py b/constructor.py index e5126f4..c752b73 100644 --- a/constructor.py +++ b/constructor.py @@ -2,7 +2,6 @@ from __future__ import print_function, absolute_import, division -import collections import datetime import base64 import binascii @@ -16,7 +15,7 @@ from ruamel.yaml.error import (MarkedYAMLError, MarkedYAMLFutureWarning, from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.nodes import (SequenceNode, MappingNode, ScalarNode) from ruamel.yaml.compat import (utf8, builtins_module, to_str, PY2, PY3, # NOQA - ordereddict, text_type, nprint, version_tnf) + ordereddict, text_type, nprint, version_tnf, Hashable) from ruamel.yaml.comments import * # NOQA from ruamel.yaml.comments import (CommentedMap, CommentedOrderedMap, CommentedSet, CommentedKeySeq, CommentedSeq, TaggedScalar) @@ -217,7 +216,7 @@ class BaseConstructor(object): # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): if isinstance(key, list): key = tuple(key) if PY2: @@ -229,7 +228,7 @@ class BaseConstructor(object): "found unacceptable key (%s)" % exc, key_node.start_mark) else: - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark) @@ -1240,7 +1239,7 @@ class RoundTripConstructor(SafeConstructor): # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): if isinstance(key, list): key_a = CommentedKeySeq(key) if key_node.flow_style is True: @@ -1258,7 +1257,7 @@ class RoundTripConstructor(SafeConstructor): "found unacceptable key (%s)" % exc, key_node.start_mark) else: - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark) @@ -1307,7 +1306,7 @@ class RoundTripConstructor(SafeConstructor): # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): if isinstance(key, list): key = tuple(key) if PY2: @@ -1319,7 +1318,7 @@ class RoundTripConstructor(SafeConstructor): "found unacceptable key (%s)" % exc, key_node.start_mark) else: - if not isinstance(key, collections.Hashable): + if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark) |