diff --git a/funkwhale_cli/utils.py b/funkwhale_cli/utils.py index 9fda4d3215e88874adc02503579a6d7a0840cd89..4dd1f875f57bfeaaa547d3321d22320c00f12086 100644 --- a/funkwhale_cli/utils.py +++ b/funkwhale_cli/utils.py @@ -1,9 +1,13 @@ -import collections import json +import sys import urllib.parse import pathvalidate +if sys.version_info >= (3, 10): + from collections.abc import MutableMapping +else: + from collections import MutableMapping def recursive_getattr(obj, key, permissive=False): """ @@ -92,7 +96,7 @@ def flatten(d, parent_key="", sep="_"): items = [] for k, v in d.items(): new_key = parent_key + sep + k if parent_key else k - if isinstance(v, collections.MutableMapping): + if isinstance(v, MutableMapping): items.extend(flatten(v, new_key, sep=sep).items()) else: items.append((new_key, v))