From 0f739125a97d4e771384a7e95d745b026d0df769 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:12:02 +0200 Subject: [PATCH] fix(deserialize OAPs): read only valid files (#53) --- dsp_permissions_scripts/oap/oap_serialize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsp_permissions_scripts/oap/oap_serialize.py b/dsp_permissions_scripts/oap/oap_serialize.py index 9ad1294d..b2885e80 100644 --- a/dsp_permissions_scripts/oap/oap_serialize.py +++ b/dsp_permissions_scripts/oap/oap_serialize.py @@ -30,7 +30,7 @@ def deserialize_resource_oaps( """Deserialize the resource OAPs from JSON files.""" folder = _get_project_data_path(shortcode, mode) resource_oaps = [] - for file in folder.iterdir(): + for file in [f for f in folder.iterdir() if f.suffix == ".json"]: with open(file, mode="r", encoding="utf-8") as f: resource_oaps.append(Oap.model_validate_json(f.read())) return resource_oaps