From c95a5d2f0cabaf98d795d6786ee617ef045282f6 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Tue, 12 Feb 2019 11:17:11 -0600 Subject: [PATCH] Address warning about importing from collections on Python 3 --- flex/constants.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flex/constants.py b/flex/constants.py index a2b55b1..f7f6c88 100644 --- a/flex/constants.py +++ b/flex/constants.py @@ -1,7 +1,10 @@ from __future__ import unicode_literals import numbers -import collections +try: + from collections.abc import Sequence, Mapping +except ImportError: # Python 2 + from collections import Sequence, Mapping import six @@ -32,8 +35,8 @@ INTEGER: six.integer_types, NUMBER: (numbers.Number,), STRING: (six.binary_type, six.text_type), - ARRAY: (collections.Sequence,), - OBJECT: (collections.Mapping,), + ARRAY: (Sequence,), + OBJECT: (Mapping,), } TRUE_VALUES = set(('true', 'True', '1'))