From 183145ca66d1c7d72ffdd03e1a1f6190c7d3e7b7 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum Date: Mon, 2 Oct 2023 17:59:16 +0200 Subject: [PATCH] improve naming --- dsp_permissions_scripts/main.py | 6 +++--- dsp_permissions_scripts/utils/project.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dsp_permissions_scripts/main.py b/dsp_permissions_scripts/main.py index ee194806..37c50f21 100644 --- a/dsp_permissions_scripts/main.py +++ b/dsp_permissions_scripts/main.py @@ -11,7 +11,7 @@ update_permissions_for_resources_and_values, ) from dsp_permissions_scripts.utils.project import ( - get_all_resources_of_project, + get_all_resource_oaps_of_project, get_project_iri_by_shortcode, ) @@ -49,13 +49,13 @@ def main() -> None: shortcode=shortcode, token=token, ) - resource_oaps = get_all_resources_of_project( + resource_oaps = get_all_resource_oaps_of_project( project_iri=project_iri, host=host, token=token, ) update_permissions_for_resources_and_values( - resource_iris=resource_iris, + resource_iris=resource_oaps_updated, scope=new_scope, host=host, token=token, diff --git a/dsp_permissions_scripts/utils/project.py b/dsp_permissions_scripts/utils/project.py index 385f6c38..ebd6ec29 100644 --- a/dsp_permissions_scripts/utils/project.py +++ b/dsp_permissions_scripts/utils/project.py @@ -19,29 +19,29 @@ def get_project_iri_by_shortcode(shortcode: str, host: str) -> str: return iri -def get_all_resources_of_project( +def get_all_resource_oaps_of_project( project_iri: str, host: str, token: str, ) -> list[Oap]: - all_resources = [] - resclasses = __get_all_resource_classes_of_project( + all_resource_oaps = [] + resclass_iris = __get_all_resource_class_iris_of_project( project_iri=project_iri, host=host, token=token, ) - for resclass in resclasses: - resources = __get_all_resources_of_resclass( + for resclass_iri in resclass_iris: + resource_oaps = __get_all_resource_oaps_of_resclass( host=host, - resclass=resclass, + resclass_iri=resclass_iri, project_iri=project_iri, token=token, ) - all_resources.extend(resources) - return all_resources + all_resource_oaps.extend(resource_oaps) + return all_resource_oaps -def __get_all_resource_classes_of_project( +def __get_all_resource_class_iris_of_project( project_iri: str, host: str, token: str, @@ -99,9 +99,9 @@ def __dereference_prefix(identifier: str, context: dict[str, str]) -> str: return context[prefix] + actual_id -def __get_all_resources_of_resclass( +def __get_all_resource_oaps_of_resclass( host: str, - resclass: str, + resclass_iri: str, project_iri: str, token: str, ) -> list[Oap]: @@ -114,7 +114,7 @@ def __get_all_resources_of_resclass( more, iris = __get_next_page( protocol=protocol, host=host, - resclass=resclass, + resclass=resclass_iri, page=page, headers=headers, )