diff --git a/dsp_permissions_scripts/doap/__init__.py b/dsp_permissions_scripts/doap/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dsp_permissions_scripts/utils/doap_get.py b/dsp_permissions_scripts/doap/doap_get.py similarity index 97% rename from dsp_permissions_scripts/utils/doap_get.py rename to dsp_permissions_scripts/doap/doap_get.py index 97c629f9..b770c240 100644 --- a/dsp_permissions_scripts/utils/doap_get.py +++ b/dsp_permissions_scripts/doap/doap_get.py @@ -3,7 +3,7 @@ import requests -from dsp_permissions_scripts.models.doap import Doap, DoapTarget, DoapTargetType +from dsp_permissions_scripts.doap.doap_model import Doap, DoapTarget, DoapTargetType from dsp_permissions_scripts.utils.authentication import get_protocol from dsp_permissions_scripts.utils.get_logger import get_logger from dsp_permissions_scripts.utils.project import get_project_iri_by_shortcode diff --git a/dsp_permissions_scripts/models/doap.py b/dsp_permissions_scripts/doap/doap_model.py similarity index 100% rename from dsp_permissions_scripts/models/doap.py rename to dsp_permissions_scripts/doap/doap_model.py diff --git a/dsp_permissions_scripts/utils/doap_serialize.py b/dsp_permissions_scripts/doap/doap_serialize.py similarity index 95% rename from dsp_permissions_scripts/utils/doap_serialize.py rename to dsp_permissions_scripts/doap/doap_serialize.py index e1b44f3d..d7eadc0b 100644 --- a/dsp_permissions_scripts/utils/doap_serialize.py +++ b/dsp_permissions_scripts/doap/doap_serialize.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Literal -from dsp_permissions_scripts.models.doap import Doap, DoapTargetType +from dsp_permissions_scripts.doap.doap_model import Doap, DoapTargetType def _get_file_path( diff --git a/dsp_permissions_scripts/utils/doap_set.py b/dsp_permissions_scripts/doap/doap_set.py similarity index 94% rename from dsp_permissions_scripts/utils/doap_set.py rename to dsp_permissions_scripts/doap/doap_set.py index 6dcf668b..0c68df3e 100644 --- a/dsp_permissions_scripts/utils/doap_set.py +++ b/dsp_permissions_scripts/doap/doap_set.py @@ -4,10 +4,10 @@ import requests -from dsp_permissions_scripts.models.doap import Doap +from dsp_permissions_scripts.doap.doap_model import Doap from dsp_permissions_scripts.models.scope import PermissionScope from dsp_permissions_scripts.utils.authentication import get_protocol -from dsp_permissions_scripts.utils.doap_get import create_doap_from_admin_route_response +from dsp_permissions_scripts.doap.doap_get import create_doap_from_admin_route_response from dsp_permissions_scripts.utils.get_logger import get_logger, get_timestamp from dsp_permissions_scripts.utils.scope_serialization import ( create_admin_route_object_from_scope, diff --git a/dsp_permissions_scripts/oap/__init__.py b/dsp_permissions_scripts/oap/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dsp_permissions_scripts/utils/oap.py b/dsp_permissions_scripts/oap/oap_get_set.py similarity index 98% rename from dsp_permissions_scripts/utils/oap.py rename to dsp_permissions_scripts/oap/oap_get_set.py index fe4a6822..86d765b2 100644 --- a/dsp_permissions_scripts/utils/oap.py +++ b/dsp_permissions_scripts/oap/oap_get_set.py @@ -1,3 +1,5 @@ +# pylint: disable=too-many-arguments + import json import warnings from typing import Any @@ -5,9 +7,9 @@ import requests -from dsp_permissions_scripts.models.oap import Oap from dsp_permissions_scripts.models.scope import PermissionScope from dsp_permissions_scripts.models.value import ValueUpdate +from dsp_permissions_scripts.oap.oap_model import Oap from dsp_permissions_scripts.utils.authentication import get_protocol from dsp_permissions_scripts.utils.get_logger import get_logger, get_timestamp from dsp_permissions_scripts.utils.scope_serialization import create_string_from_scope diff --git a/dsp_permissions_scripts/models/oap.py b/dsp_permissions_scripts/oap/oap_model.py similarity index 100% rename from dsp_permissions_scripts/models/oap.py rename to dsp_permissions_scripts/oap/oap_model.py diff --git a/dsp_permissions_scripts/utils/oap_serialize.py b/dsp_permissions_scripts/oap/oap_serialize.py similarity index 95% rename from dsp_permissions_scripts/utils/oap_serialize.py rename to dsp_permissions_scripts/oap/oap_serialize.py index e6d2d344..f30ceb1e 100644 --- a/dsp_permissions_scripts/utils/oap_serialize.py +++ b/dsp_permissions_scripts/oap/oap_serialize.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Literal -from dsp_permissions_scripts.models.oap import Oap +from dsp_permissions_scripts.oap.oap_model import Oap def _get_project_data_path( diff --git a/dsp_permissions_scripts/template.py b/dsp_permissions_scripts/template.py index 7893b6c7..6e2dd067 100644 --- a/dsp_permissions_scripts/template.py +++ b/dsp_permissions_scripts/template.py @@ -1,11 +1,16 @@ from dotenv import load_dotenv +from dsp_permissions_scripts.doap.doap_get import get_doaps_of_project +from dsp_permissions_scripts.doap.doap_model import Doap +from dsp_permissions_scripts.doap.doap_serialize import serialize_doaps_of_project +from dsp_permissions_scripts.doap.doap_set import apply_updated_doaps_on_server from dsp_permissions_scripts.models import builtin_groups from dsp_permissions_scripts.models.ap import Ap, ApValue -from dsp_permissions_scripts.models.doap import Doap from dsp_permissions_scripts.models.host import Hosts -from dsp_permissions_scripts.models.oap import Oap from dsp_permissions_scripts.models.scope import PUBLIC +from dsp_permissions_scripts.oap.oap_get_set import apply_updated_oaps_on_server +from dsp_permissions_scripts.oap.oap_model import Oap +from dsp_permissions_scripts.oap.oap_serialize import serialize_resource_oaps from dsp_permissions_scripts.utils.ap.ap_get import get_aps_of_project from dsp_permissions_scripts.utils.ap.ap_serialize import serialize_aps_of_project from dsp_permissions_scripts.utils.ap.ap_set import ( @@ -13,11 +18,6 @@ delete_ap, ) from dsp_permissions_scripts.utils.authentication import login -from dsp_permissions_scripts.utils.doap_get import get_doaps_of_project -from dsp_permissions_scripts.utils.doap_serialize import serialize_doaps_of_project -from dsp_permissions_scripts.utils.doap_set import apply_updated_doaps_on_server -from dsp_permissions_scripts.utils.oap import apply_updated_oaps_on_server -from dsp_permissions_scripts.utils.oap_serialize import serialize_resource_oaps from dsp_permissions_scripts.utils.project import get_all_resource_oaps_of_project diff --git a/dsp_permissions_scripts/utils/project.py b/dsp_permissions_scripts/utils/project.py index c6e3e9fd..2c3f7ac9 100644 --- a/dsp_permissions_scripts/utils/project.py +++ b/dsp_permissions_scripts/utils/project.py @@ -2,7 +2,7 @@ import requests -from dsp_permissions_scripts.models.oap import Oap +from dsp_permissions_scripts.oap.oap_model import Oap from dsp_permissions_scripts.utils.authentication import get_protocol from dsp_permissions_scripts.utils.get_logger import get_logger, get_timestamp from dsp_permissions_scripts.utils.helpers import dereference_prefix diff --git a/tests/test_doap_serialization.py b/tests/test_doap_serialization.py index bab79fe0..28433552 100644 --- a/tests/test_doap_serialization.py +++ b/tests/test_doap_serialization.py @@ -3,9 +3,9 @@ from pathlib import Path from dsp_permissions_scripts.models import builtin_groups -from dsp_permissions_scripts.models.doap import Doap, DoapTarget +from dsp_permissions_scripts.doap.doap_model import Doap, DoapTarget from dsp_permissions_scripts.models.scope import PermissionScope -from dsp_permissions_scripts.utils.doap_serialize import ( +from dsp_permissions_scripts.doap.doap_serialize import ( deserialize_doaps_of_project, serialize_doaps_of_project, ) diff --git a/tests/test_oap_serialization.py b/tests/test_oap_serialization.py index fa87b019..c1c00ecd 100644 --- a/tests/test_oap_serialization.py +++ b/tests/test_oap_serialization.py @@ -3,9 +3,9 @@ from pathlib import Path from dsp_permissions_scripts.models import builtin_groups -from dsp_permissions_scripts.models.oap import Oap +from dsp_permissions_scripts.oap.oap_model import Oap from dsp_permissions_scripts.models.scope import PermissionScope -from dsp_permissions_scripts.utils.oap_serialize import ( +from dsp_permissions_scripts.oap.oap_serialize import ( deserialize_resource_oaps, serialize_resource_oaps, )