From 639ebc6a5b97f9e476bacad489268f8dbfdd34d0 Mon Sep 17 00:00:00 2001 From: JuniorJPDJ <git@juniorjpdj.pl> Date: Thu, 21 Jul 2022 10:23:19 +0200 Subject: [PATCH] fix: python 3.10 compatibility --- funkwhale_cli/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/funkwhale_cli/utils.py b/funkwhale_cli/utils.py index 9fda4d3..4dd1f87 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)) -- GitLab