diff options
author | Julian Berman <Julian@GrayVines.com> | 2021-07-09 15:12:52 +0200 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2021-07-09 17:53:32 +0200 |
commit | 4398265201fe2375dfeba773fbe5c13fe33397ff (patch) | |
tree | a007d114944e9fd2e11d5a796ba881016f4adaa1 | |
parent | b58395bc5bb7083dc95516d2a71e2299d36fd0fd (diff) | |
download | jsonschema-4398265201fe2375dfeba773fbe5c13fe33397ff.tar.gz |
Fix the DeprecationWarning from importing abcs from collections.
-rw-r--r-- | jsonschema/_utils.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/jsonschema/_utils.py b/jsonschema/_utils.py index 6ff629f..f026c33 100644 --- a/jsonschema/_utils.py +++ b/jsonschema/_utils.py @@ -1,6 +1,5 @@ -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping, Sequence from urllib.parse import urlsplit -import collections import itertools import json import pkgutil @@ -193,18 +192,7 @@ def is_sequence(instance): """ Checks if an instance is a sequence but not a string """ - return isinstance( - instance, collections.Sequence - ) and not isinstance( - instance, str - ) - - -def is_mapping(instance): - """ - Checks if an instance is a mapping - """ - return isinstance(instance, collections.Mapping) + return isinstance(instance, Sequence) and not isinstance(instance, str) def equal(one, two): @@ -214,7 +202,7 @@ def equal(one, two): if is_sequence(one) and is_sequence(two): return list_equal(one, two) - if is_mapping(one) and is_mapping(two): + if isinstance(one, Mapping) and isinstance(two, Mapping): return dict_equal(one, two) return unbool(one) == unbool(two) |