Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Mar 26, 2024
1 parent 77242b6 commit f938ca5
Showing 1 changed file with 9 additions and 43 deletions.
52 changes: 9 additions & 43 deletions dsp_permissions_scripts/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ def modify_oaps(oaps: list[Oap]) -> list[Oap]:
return modified_oaps


def update_aps(
host: str,
shortcode: str,
dsp_client: DspClient,
) -> None:
def update_aps(host: str, shortcode: str, dsp_client: DspClient) -> None:
"""Sample function to modify the Administrative Permissions of a project."""
project_aps = get_aps_of_project(shortcode, dsp_client)
serialize_aps_of_project(
Expand All @@ -75,11 +71,7 @@ def update_aps(
dsp_client=dsp_client,
)
modified_aps = modify_aps(remaining_aps)
apply_updated_aps_on_server(
aps=modified_aps,
host=host,
dsp_client=dsp_client,
)
apply_updated_aps_on_server(modified_aps, host, dsp_client)
project_aps_updated = get_aps_of_project(shortcode, dsp_client)
serialize_aps_of_project(
project_aps=project_aps_updated,
Expand All @@ -89,32 +81,18 @@ def update_aps(
)


def update_doaps(
host: str,
shortcode: str,
dsp_client: DspClient,
) -> None:
def update_doaps(host: str, shortcode: str, dsp_client: DspClient) -> None:
"""Sample function to modify the Default Object Access Permissions of a project."""
project_doaps = get_doaps_of_project(
shortcode=shortcode,
dsp_client=dsp_client,
)
project_doaps = get_doaps_of_project(shortcode, dsp_client)
serialize_doaps_of_project(
project_doaps=project_doaps,
shortcode=shortcode,
mode="original",
host=host,
)
project_doaps_modified = modify_doaps(doaps=project_doaps)
apply_updated_doaps_on_server(
doaps=project_doaps_modified,
host=host,
dsp_client=dsp_client,
)
project_doaps_updated = get_doaps_of_project(
shortcode=shortcode,
dsp_client=dsp_client,
)
apply_updated_doaps_on_server(project_doaps_modified, host, dsp_client)
project_doaps_updated = get_doaps_of_project(shortcode, dsp_client)
serialize_doaps_of_project(
project_doaps=project_doaps_updated,
shortcode=shortcode,
Expand All @@ -123,18 +101,10 @@ def update_doaps(
)


def update_oaps(
host: str,
shortcode: str,
dsp_client: DspClient,
) -> None:
def update_oaps(host: str, shortcode: str, dsp_client: DspClient) -> None:
"""Sample function to modify the Object Access Permissions of a project."""
resource_oaps = get_all_resource_oaps_of_project(shortcode, dsp_client)
serialize_resource_oaps(
resource_oaps=resource_oaps,
shortcode=shortcode,
mode="original",
)
serialize_resource_oaps(resource_oaps, shortcode, mode="original")
resource_oaps_modified = modify_oaps(oaps=resource_oaps)
apply_updated_oaps_on_server(
resource_oaps=resource_oaps_modified,
Expand All @@ -144,11 +114,7 @@ def update_oaps(
nthreads=4,
)
resource_oaps_updated = get_all_resource_oaps_of_project(shortcode, dsp_client)
serialize_resource_oaps(
resource_oaps=resource_oaps_updated,
shortcode=shortcode,
mode="modified",
)
serialize_resource_oaps(resource_oaps_updated, shortcode, mode="modified")


def main() -> None:
Expand Down

0 comments on commit f938ca5

Please sign in to comment.