From f323bae055948fd72506043836d5c02fd1b3aae5 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum Date: Thu, 11 Apr 2024 17:48:42 +0200 Subject: [PATCH] renaming --- dsp_permissions_scripts/oap/oap_get.py | 8 ++++---- dsp_permissions_scripts/oap/oap_serialize.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dsp_permissions_scripts/oap/oap_get.py b/dsp_permissions_scripts/oap/oap_get.py index da53a7b2..de329716 100644 --- a/dsp_permissions_scripts/oap/oap_get.py +++ b/dsp_permissions_scripts/oap/oap_get.py @@ -141,10 +141,10 @@ def _get_all_oaps_of_project( shortcode: str, dsp_client: DspClient, excluded_class_iris: Iterable[str] = (), prefixed_prop: str | None = None ) -> list[Oap]: project_iri, onto_iris = get_project_iri_and_onto_iris_by_shortcode(shortcode, dsp_client) - all_resource_oaps = [] + all_oaps = [] resclass_iris = get_all_resource_class_iris_of_project(onto_iris, dsp_client) resclass_iris = [x for x in resclass_iris if x not in excluded_class_iris] for resclass_iri in resclass_iris: - resource_oaps = _get_all_oaps_of_resclass(resclass_iri, project_iri, dsp_client, prefixed_prop) - all_resource_oaps.extend(resource_oaps) - return all_resource_oaps + oaps = _get_all_oaps_of_resclass(resclass_iri, project_iri, dsp_client, prefixed_prop) + all_oaps.extend(oaps) + return all_oaps diff --git a/dsp_permissions_scripts/oap/oap_serialize.py b/dsp_permissions_scripts/oap/oap_serialize.py index 14cd22e0..bc9fca19 100644 --- a/dsp_permissions_scripts/oap/oap_serialize.py +++ b/dsp_permissions_scripts/oap/oap_serialize.py @@ -24,11 +24,11 @@ def serialize_oaps( folder = _get_project_data_path(shortcode, mode) folder.mkdir(parents=True, exist_ok=True) logger.info(f"Writing {len(oaps)} OAPs into {str(folder)}") - for res_oap in oaps: - filename = re.sub(r"http://rdfh\.ch/[^/]+/", "resource_", res_oap.object_iri) + for oap in oaps: + filename = re.sub(r"http://rdfh\.ch/[^/]+/", "resource_", oap.object_iri) filename = re.sub(r"/", "_", filename) with open(folder / f"{filename}.json", mode="w", encoding="utf-8") as f: - f.write(res_oap.model_dump_json(indent=2)) + f.write(oap.model_dump_json(indent=2)) logger.info(f"Successfully wrote {len(oaps)} OAPs into {str(folder)}")