Skip to content

Commit

Permalink
improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 2, 2023
1 parent b5b8568 commit 183145c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions dsp_permissions_scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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,
Expand Down
24 changes: 12 additions & 12 deletions dsp_permissions_scripts/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]:
Expand All @@ -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,
)
Expand Down

0 comments on commit 183145c

Please sign in to comment.