Skip to content

Commit

Permalink
variable renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 3, 2023
1 parent 295f06c commit 10a9557
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/models/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Doap(BaseModel):

target: DoapTarget
scope: PermissionScope
iri: str
doap_iri: str


class DoapTargetType(Enum):
Expand Down
4 changes: 2 additions & 2 deletions dsp_permissions_scripts/utils/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_doaps_of_groups(
print("Old DOAP:\n=========")
print(d.model_dump_json(indent=2))
new_doap = update_doap_scope(
doap_iri=d.iri,
doap_iri=d.doap_iri,
scope=scope,
host=host,
token=token,
Expand All @@ -101,7 +101,7 @@ def __get_doap(permission: dict[str, Any]) -> Doap:
property=permission["forProperty"],
),
scope=scope,
iri=permission["iri"],
doap_iri=permission["iri"],
)
return doap

Expand Down
14 changes: 7 additions & 7 deletions dsp_permissions_scripts/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def get_all_resource_iris_of_project(
token: str,
) -> list[str]:
all_resource_iris = []
resclasses = __get_all_resource_class_iris_of_project(
resclass_iris = __get_all_resource_class_iris_of_project(
project_iri=project_iri,
host=host,
token=token,
)
for resclass in resclasses:
for resclass_iri in resclass_iris:
resource_iris = __get_all_resource_iris_of_resclass(
host=host,
resclass=resclass,
resclass_iri=resclass_iri,
project_iri=project_iri,
token=token,
)
Expand Down Expand Up @@ -99,7 +99,7 @@ def __dereference_prefix(identifier: str, context: dict[str, str]) -> str:

def __get_all_resource_iris_of_resclass(
host: str,
resclass: str,
resclass_iri: str,
project_iri: str,
token: str,
) -> list[str]:
Expand All @@ -112,7 +112,7 @@ def __get_all_resource_iris_of_resclass(
more, iris = __get_next_page(
protocol=protocol,
host=host,
resclass=resclass,
resclass_iri=resclass_iri,
page=page,
headers=headers,
)
Expand All @@ -124,7 +124,7 @@ def __get_all_resource_iris_of_resclass(
def __get_next_page(
protocol: str,
host: str,
resclass: str,
resclass_iri: str,
page: int,
headers: dict[str, str],
) -> tuple[bool, list[str]]:
Expand All @@ -137,7 +137,7 @@ def __get_next_page(
and an empty response content with status code 200 if there are no resources remaining.
This means that the page must be incremented until the response contains 0 or 1 resource.
"""
url = f"{protocol}://{host}/v2/resources?resourceClass={quote_plus(resclass)}&page={page}"
url = f"{protocol}://{host}/v2/resources?resourceClass={quote_plus(resclass_iri)}&page={page}"
response = requests.get(url, headers=headers, timeout=5)
assert response.status_code == 200
result = response.json()
Expand Down

0 comments on commit 10a9557

Please sign in to comment.