Skip to content

Commit

Permalink
blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 3, 2023
1 parent 171bef0 commit 348737d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions dsp_permissions_scripts/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_project_iri_by_shortcode(shortcode: str, host: str) -> str:


def get_all_resource_oaps_of_project(
project_iri: str,
project_iri: str,
host: str,
token: str,
) -> list[Oap]:
Expand All @@ -42,7 +42,7 @@ def get_all_resource_oaps_of_project(


def __get_all_resource_class_iris_of_project(
project_iri: str,
project_iri: str,
host: str,
token: str,
) -> list[str]:
Expand Down Expand Up @@ -100,7 +100,7 @@ def __dereference_prefix(identifier: str, context: dict[str, str]) -> str:


def __get_all_resource_oaps_of_resclass(
host: str,
host: str,
resclass_iri: str,
project_iri: str,
token: str,
Expand Down Expand Up @@ -147,13 +147,13 @@ def __get_next_page(
# result contains several resources: return them, then continue with next page
oaps = []
for r in result["@graph"]:
scope=create_scope_from_string(r["knora-api:hasPermissions"])
scope = create_scope_from_string(r["knora-api:hasPermissions"])
oaps.append(Oap(scope=scope, object_iri=r["@id"]))
return True, oaps
elif "@id" in result:
# result contains only 1 resource: return it, then stop (there will be no more resources)
scope=create_scope_from_string(result["knora-api:hasPermissions"])
return False, [Oap(scope=scope, object_iri=result["@id"]), ]
scope = create_scope_from_string(result["knora-api:hasPermissions"])
return False, [Oap(scope=scope, object_iri=result["@id"])]
else:
# there are no more resources
return False, []
3 changes: 2 additions & 1 deletion tests/test_scope_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ def _resolve_prefixes_of_admin_route_object(self, admin_route_object: list[dict[
"knora-admin:", "http://www.knora.org/ontology/knora-admin#"
)
return admin_route_object

def _resolve_prefixes_of_perm_string(self, perm_string: str) -> str:
return perm_string.replace("knora-admin:", "http://www.knora.org/ontology/knora-admin#")


if __name__ == "__main__":
unittest.main()

0 comments on commit 348737d

Please sign in to comment.