From fedc6d213e3e6ab14dec0116f5d6651ac3203ef1 Mon Sep 17 00:00:00 2001 From: Midgard Date: Tue, 17 Dec 2024 22:55:09 +0100 Subject: [PATCH] Allow purging groups of messages --- purge.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/purge.py b/purge.py index b04bf94..4ffbc3a 100755 --- a/purge.py +++ b/purge.py @@ -30,15 +30,15 @@ def walk_and_discard(obj, prefix): result = {} for k, v in obj.items(): fqkey = f"{prefix}{k}" - if isinstance(v, str): - if fqkey not in to_discard: + if fqkey not in to_discard: + if isinstance(v, str): result[k] = v elif hasattr(v, "items"): result[k] = walk_and_discard(v, f"{prefix}{k}.") return result -path_langs = os.path.join(path_mc_repo, "langs") +path_langs = os.path.join(path_mc_repo, "langs/layers") json_files = [ f for f in os.listdir(path_langs) if os.path.isfile(os.path.join(path_langs, f)) and f.endswith(".json")