diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-07-28 23:53:41 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-07-28 23:53:41 +0200 |
commit | f9b50b606fe3f12b09dd36cb999238bf440d0cd1 (patch) | |
tree | 04a14e70240d7677ac84d95cd38f3cded4729091 /constructor.py | |
parent | 9f9266b31445296439cbcc9c0e3f01b4fb15ed8a (diff) | |
download | ruamel.yaml-f9b50b606fe3f12b09dd36cb999238bf440d0cd1.tar.gz |
Resolving issue #210 deprecation warning in python 3.7
*When this change indeed resolves your problem, please **Close** this issue*.
*(You can do so usingthe WorkFlow pull-down (close to the top right of this page)*
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) |