From a0a569d09b72e0493d1862073e52a30ef7b90278 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum Date: Mon, 8 Apr 2024 08:54:50 +0200 Subject: [PATCH] chore: isort force single line --- dsp_permissions_scripts/ap/ap_get.py | 3 ++- dsp_permissions_scripts/ap/ap_serialize.py | 3 ++- dsp_permissions_scripts/ap/ap_set.py | 6 ++---- dsp_permissions_scripts/doap/doap_get.py | 4 +++- dsp_permissions_scripts/doap/doap_model.py | 3 ++- .../doap/doap_serialize.py | 6 ++++-- dsp_permissions_scripts/models/group.py | 4 +++- dsp_permissions_scripts/models/scope.py | 21 ++++++++++--------- dsp_permissions_scripts/oap/oap_get.py | 5 +++-- dsp_permissions_scripts/oap/oap_set.py | 6 ++++-- dsp_permissions_scripts/template.py | 3 ++- dsp_permissions_scripts/utils/dsp_client.py | 20 ++++++++++++------ dsp_permissions_scripts/utils/try_request.py | 3 ++- pyproject.toml | 1 + tests/test_ap.py | 3 ++- tests/test_ap_serialization.py | 9 ++++---- tests/test_doap_serialization.py | 9 ++++---- tests/test_oap_serialization.py | 6 ++---- tests/test_scope_serialization.py | 6 ++++-- 19 files changed, 71 insertions(+), 50 deletions(-) diff --git a/dsp_permissions_scripts/ap/ap_get.py b/dsp_permissions_scripts/ap/ap_get.py index 60cabb7d..6c5ac18c 100644 --- a/dsp_permissions_scripts/ap/ap_get.py +++ b/dsp_permissions_scripts/ap/ap_get.py @@ -1,7 +1,8 @@ from typing import Any from urllib.parse import quote_plus -from dsp_permissions_scripts.ap.ap_model import Ap, ApValue +from dsp_permissions_scripts.ap.ap_model import Ap +from dsp_permissions_scripts.ap.ap_model import ApValue from dsp_permissions_scripts.models.errors import ApiError from dsp_permissions_scripts.utils.dsp_client import DspClient from dsp_permissions_scripts.utils.get_logger import get_logger diff --git a/dsp_permissions_scripts/ap/ap_serialize.py b/dsp_permissions_scripts/ap/ap_serialize.py index 8dfcb104..df863f28 100644 --- a/dsp_permissions_scripts/ap/ap_serialize.py +++ b/dsp_permissions_scripts/ap/ap_serialize.py @@ -3,7 +3,8 @@ from typing import Literal from dsp_permissions_scripts.ap.ap_model import Ap -from dsp_permissions_scripts.utils.get_logger import get_logger, get_timestamp +from dsp_permissions_scripts.utils.get_logger import get_logger +from dsp_permissions_scripts.utils.get_logger import get_timestamp logger = get_logger(__name__) diff --git a/dsp_permissions_scripts/ap/ap_set.py b/dsp_permissions_scripts/ap/ap_set.py index 2ca6ae89..ed24c9e3 100644 --- a/dsp_permissions_scripts/ap/ap_set.py +++ b/dsp_permissions_scripts/ap/ap_set.py @@ -1,10 +1,8 @@ from typing import Any from urllib.parse import quote_plus -from dsp_permissions_scripts.ap.ap_get import ( - create_admin_route_object_from_ap, - create_ap_from_admin_route_object, -) +from dsp_permissions_scripts.ap.ap_get import create_admin_route_object_from_ap +from dsp_permissions_scripts.ap.ap_get import create_ap_from_admin_route_object from dsp_permissions_scripts.ap.ap_model import Ap from dsp_permissions_scripts.models.errors import ApiError from dsp_permissions_scripts.utils.dsp_client import DspClient diff --git a/dsp_permissions_scripts/doap/doap_get.py b/dsp_permissions_scripts/doap/doap_get.py index 76949354..ae4beec4 100644 --- a/dsp_permissions_scripts/doap/doap_get.py +++ b/dsp_permissions_scripts/doap/doap_get.py @@ -1,7 +1,9 @@ from typing import Any from urllib.parse import quote_plus -from dsp_permissions_scripts.doap.doap_model import Doap, DoapTarget, DoapTargetType +from dsp_permissions_scripts.doap.doap_model import Doap +from dsp_permissions_scripts.doap.doap_model import DoapTarget +from dsp_permissions_scripts.doap.doap_model import DoapTargetType from dsp_permissions_scripts.models.errors import ApiError from dsp_permissions_scripts.utils.dsp_client import DspClient from dsp_permissions_scripts.utils.get_logger import get_logger diff --git a/dsp_permissions_scripts/doap/doap_model.py b/dsp_permissions_scripts/doap/doap_model.py index cb3ddc37..e69576c6 100644 --- a/dsp_permissions_scripts/doap/doap_model.py +++ b/dsp_permissions_scripts/doap/doap_model.py @@ -3,7 +3,8 @@ from enum import Enum from typing import Self -from pydantic import BaseModel, model_validator +from pydantic import BaseModel +from pydantic import model_validator from dsp_permissions_scripts.models.group import Group from dsp_permissions_scripts.models.scope import PermissionScope diff --git a/dsp_permissions_scripts/doap/doap_serialize.py b/dsp_permissions_scripts/doap/doap_serialize.py index 22179f23..ff09cdbd 100644 --- a/dsp_permissions_scripts/doap/doap_serialize.py +++ b/dsp_permissions_scripts/doap/doap_serialize.py @@ -2,8 +2,10 @@ from pathlib import Path from typing import Literal -from dsp_permissions_scripts.doap.doap_model import Doap, DoapTargetType -from dsp_permissions_scripts.utils.get_logger import get_logger, get_timestamp +from dsp_permissions_scripts.doap.doap_model import Doap +from dsp_permissions_scripts.doap.doap_model import DoapTargetType +from dsp_permissions_scripts.utils.get_logger import get_logger +from dsp_permissions_scripts.utils.get_logger import get_timestamp logger = get_logger(__name__) diff --git a/dsp_permissions_scripts/models/group.py b/dsp_permissions_scripts/models/group.py index 7b28661b..f08103d0 100644 --- a/dsp_permissions_scripts/models/group.py +++ b/dsp_permissions_scripts/models/group.py @@ -2,7 +2,9 @@ import re -from pydantic import BaseModel, ConfigDict, model_validator +from pydantic import BaseModel +from pydantic import ConfigDict +from pydantic import model_validator class Group(BaseModel): diff --git a/dsp_permissions_scripts/models/scope.py b/dsp_permissions_scripts/models/scope.py index 259c248d..5450ec9b 100644 --- a/dsp_permissions_scripts/models/scope.py +++ b/dsp_permissions_scripts/models/scope.py @@ -1,17 +1,18 @@ from __future__ import annotations -from typing import Iterable, Literal +from typing import Iterable +from typing import Literal -from pydantic import BaseModel, ConfigDict, model_validator +from pydantic import BaseModel +from pydantic import ConfigDict +from pydantic import model_validator -from dsp_permissions_scripts.models.group import ( - CREATOR, - KNOWN_USER, - PROJECT_ADMIN, - PROJECT_MEMBER, - UNKNOWN_USER, - Group, -) +from dsp_permissions_scripts.models.group import CREATOR +from dsp_permissions_scripts.models.group import KNOWN_USER +from dsp_permissions_scripts.models.group import PROJECT_ADMIN +from dsp_permissions_scripts.models.group import PROJECT_MEMBER +from dsp_permissions_scripts.models.group import UNKNOWN_USER +from dsp_permissions_scripts.models.group import Group class PermissionScope(BaseModel): diff --git a/dsp_permissions_scripts/oap/oap_get.py b/dsp_permissions_scripts/oap/oap_get.py index 3523d4f6..bb3ef616 100644 --- a/dsp_permissions_scripts/oap/oap_get.py +++ b/dsp_permissions_scripts/oap/oap_get.py @@ -1,12 +1,13 @@ -from typing import Any, Iterable +from typing import Any +from typing import Iterable from urllib.parse import quote_plus from dsp_permissions_scripts.models.errors import ApiError from dsp_permissions_scripts.oap.oap_model import Oap from dsp_permissions_scripts.utils.dsp_client import DspClient from dsp_permissions_scripts.utils.get_logger import get_logger +from dsp_permissions_scripts.utils.project import get_all_resource_class_iris_of_project from dsp_permissions_scripts.utils.project import ( - get_all_resource_class_iris_of_project, get_project_iri_and_onto_iris_by_shortcode, ) from dsp_permissions_scripts.utils.scope_serialization import create_scope_from_string diff --git a/dsp_permissions_scripts/oap/oap_set.py b/dsp_permissions_scripts/oap/oap_set.py index 46475981..11b5be2c 100644 --- a/dsp_permissions_scripts/oap/oap_set.py +++ b/dsp_permissions_scripts/oap/oap_set.py @@ -1,10 +1,12 @@ # pylint: disable=too-many-arguments -from concurrent.futures import ThreadPoolExecutor, as_completed +from concurrent.futures import ThreadPoolExecutor +from concurrent.futures import as_completed from datetime import datetime from typing import Any -from dsp_permissions_scripts.models.errors import ApiError, PermissionsAlreadyUpToDate +from dsp_permissions_scripts.models.errors import ApiError +from dsp_permissions_scripts.models.errors import PermissionsAlreadyUpToDate from dsp_permissions_scripts.models.scope import PermissionScope from dsp_permissions_scripts.models.value import ValueUpdate from dsp_permissions_scripts.oap.oap_get import get_resource diff --git a/dsp_permissions_scripts/template.py b/dsp_permissions_scripts/template.py index 39d8428d..93e07564 100644 --- a/dsp_permissions_scripts/template.py +++ b/dsp_permissions_scripts/template.py @@ -1,6 +1,7 @@ from dsp_permissions_scripts.ap.ap_delete import delete_ap_of_group_on_server from dsp_permissions_scripts.ap.ap_get import get_aps_of_project -from dsp_permissions_scripts.ap.ap_model import Ap, ApValue +from dsp_permissions_scripts.ap.ap_model import Ap +from dsp_permissions_scripts.ap.ap_model import ApValue from dsp_permissions_scripts.ap.ap_serialize import serialize_aps_of_project from dsp_permissions_scripts.ap.ap_set import apply_updated_aps_on_server from dsp_permissions_scripts.doap.doap_get import get_doaps_of_project diff --git a/dsp_permissions_scripts/utils/dsp_client.py b/dsp_permissions_scripts/utils/dsp_client.py index 8619787a..6d38f280 100644 --- a/dsp_permissions_scripts/utils/dsp_client.py +++ b/dsp_permissions_scripts/utils/dsp_client.py @@ -1,14 +1,22 @@ import json import re import time -from dataclasses import dataclass, field +from dataclasses import dataclass +from dataclasses import field from functools import partial from importlib.metadata import version -from typing import Any, Literal, Optional, cast - -from requests import ReadTimeout, RequestException, Response, Session - -from dsp_permissions_scripts.models.errors import ApiError, PermissionsAlreadyUpToDate +from typing import Any +from typing import Literal +from typing import Optional +from typing import cast + +from requests import ReadTimeout +from requests import RequestException +from requests import Response +from requests import Session + +from dsp_permissions_scripts.models.errors import ApiError +from dsp_permissions_scripts.models.errors import PermissionsAlreadyUpToDate from dsp_permissions_scripts.utils.get_logger import get_logger logger = get_logger(__name__) diff --git a/dsp_permissions_scripts/utils/try_request.py b/dsp_permissions_scripts/utils/try_request.py index e60b2109..b1eb78e5 100644 --- a/dsp_permissions_scripts/utils/try_request.py +++ b/dsp_permissions_scripts/utils/try_request.py @@ -2,7 +2,8 @@ from typing import Callable import requests -from requests import ReadTimeout, RequestException +from requests import ReadTimeout +from requests import RequestException from urllib3.exceptions import ReadTimeoutError from dsp_permissions_scripts.utils.get_logger import get_logger diff --git a/pyproject.toml b/pyproject.toml index 7ed271cb..e3b3a00b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ line-length = 120 [tool.isort] profile = "black" +force_single_line = true [tool.mypy] ignore_missing_imports = false diff --git a/tests/test_ap.py b/tests/test_ap.py index cbbd9cfd..6d69e120 100644 --- a/tests/test_ap.py +++ b/tests/test_ap.py @@ -1,6 +1,7 @@ import unittest -from dsp_permissions_scripts.ap.ap_model import Ap, ApValue +from dsp_permissions_scripts.ap.ap_model import Ap +from dsp_permissions_scripts.ap.ap_model import ApValue from dsp_permissions_scripts.models import group diff --git a/tests/test_ap_serialization.py b/tests/test_ap_serialization.py index ca5cdfe4..8942c75b 100644 --- a/tests/test_ap_serialization.py +++ b/tests/test_ap_serialization.py @@ -3,11 +3,10 @@ import unittest from pathlib import Path -from dsp_permissions_scripts.ap.ap_model import Ap, ApValue -from dsp_permissions_scripts.ap.ap_serialize import ( - deserialize_aps_of_project, - serialize_aps_of_project, -) +from dsp_permissions_scripts.ap.ap_model import Ap +from dsp_permissions_scripts.ap.ap_model import ApValue +from dsp_permissions_scripts.ap.ap_serialize import deserialize_aps_of_project +from dsp_permissions_scripts.ap.ap_serialize import serialize_aps_of_project from dsp_permissions_scripts.models import group from dsp_permissions_scripts.models.host import Hosts diff --git a/tests/test_doap_serialization.py b/tests/test_doap_serialization.py index 52f106d8..955ef9bb 100644 --- a/tests/test_doap_serialization.py +++ b/tests/test_doap_serialization.py @@ -2,11 +2,10 @@ import unittest from pathlib import Path -from dsp_permissions_scripts.doap.doap_model import Doap, DoapTarget -from dsp_permissions_scripts.doap.doap_serialize import ( - deserialize_doaps_of_project, - serialize_doaps_of_project, -) +from dsp_permissions_scripts.doap.doap_model import Doap +from dsp_permissions_scripts.doap.doap_model import DoapTarget +from dsp_permissions_scripts.doap.doap_serialize import deserialize_doaps_of_project +from dsp_permissions_scripts.doap.doap_serialize import serialize_doaps_of_project from dsp_permissions_scripts.models import group from dsp_permissions_scripts.models.host import Hosts from dsp_permissions_scripts.models.scope import PermissionScope diff --git a/tests/test_oap_serialization.py b/tests/test_oap_serialization.py index 69269c37..d2ee1828 100644 --- a/tests/test_oap_serialization.py +++ b/tests/test_oap_serialization.py @@ -5,10 +5,8 @@ from dsp_permissions_scripts.models import group from dsp_permissions_scripts.models.scope import PermissionScope from dsp_permissions_scripts.oap.oap_model import Oap -from dsp_permissions_scripts.oap.oap_serialize import ( - deserialize_resource_oaps, - serialize_resource_oaps, -) +from dsp_permissions_scripts.oap.oap_serialize import deserialize_resource_oaps +from dsp_permissions_scripts.oap.oap_serialize import serialize_resource_oaps from tests.test_scope_serialization import compare_scopes diff --git a/tests/test_scope_serialization.py b/tests/test_scope_serialization.py index 6a688b33..9603c699 100644 --- a/tests/test_scope_serialization.py +++ b/tests/test_scope_serialization.py @@ -5,10 +5,12 @@ from dsp_permissions_scripts.models.scope import PermissionScope from dsp_permissions_scripts.utils.scope_serialization import ( create_admin_route_object_from_scope, +) +from dsp_permissions_scripts.utils.scope_serialization import ( create_scope_from_admin_route_object, - create_scope_from_string, - create_string_from_scope, ) +from dsp_permissions_scripts.utils.scope_serialization import create_scope_from_string +from dsp_permissions_scripts.utils.scope_serialization import create_string_from_scope def compare_scopes(