Allow purging groups of messages

This commit is contained in:
Midgard 2024-12-17 22:55:09 +01:00
parent b165722c58
commit fedc6d213e
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -30,15 +30,15 @@ def walk_and_discard(obj, prefix):
result = {} result = {}
for k, v in obj.items(): for k, v in obj.items():
fqkey = f"{prefix}{k}" 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 result[k] = v
elif hasattr(v, "items"): elif hasattr(v, "items"):
result[k] = walk_and_discard(v, f"{prefix}{k}.") result[k] = walk_and_discard(v, f"{prefix}{k}.")
return result return result
path_langs = os.path.join(path_mc_repo, "langs") path_langs = os.path.join(path_mc_repo, "langs/layers")
json_files = [ json_files = [
f for f in os.listdir(path_langs) f for f in os.listdir(path_langs)
if os.path.isfile(os.path.join(path_langs, f)) and f.endswith(".json") if os.path.isfile(os.path.join(path_langs, f)) and f.endswith(".json")