From f92d8599bfba4189c7312115d52ff9b2352c3416 Mon Sep 17 00:00:00 2001 From: Raoul Khouri Date: Thu, 16 Aug 2018 15:23:30 -0400 Subject: [PATCH] Making python 3.7 + compatible Python warning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working --- lib3/yaml/constructor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib3/yaml/constructor.py b/lib3/yaml/constructor.py index 981543ae..e0dc1987 100644 --- a/lib3/yaml/constructor.py +++ b/lib3/yaml/constructor.py @@ -5,7 +5,8 @@ from .error import * from .nodes import * -import collections, datetime, base64, binascii, re, sys, types +import datetime, base64, binascii, re, sys, types +from collections import abc class ConstructorError(MarkedYAMLError): pass @@ -123,7 +124,7 @@ def construct_mapping(self, node, deep=False): mapping = {} for key_node, value_node in node.value: key = self.construct_object(key_node, deep=deep) - if not isinstance(key, collections.Hashable): + if not isinstance(key, abc.Hashable): raise ConstructorError("while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark) value = self.construct_object(value_node, deep=deep)