From 1a2346a30189956b0eb9e8f48a8fcee202afca73 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 11:42:46 +0200 Subject: [PATCH] autopep8 action fixes (#155) Co-authored-by: chicco785 --- .../anubis/middleware/operations.py | 3 ++- .../anubis/middleware/routers.py | 21 +++++++++++-------- .../anubis/middleware/schemas.py | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/anubis-management-api/anubis/middleware/operations.py b/anubis-management-api/anubis/middleware/operations.py index f9c8570..aa85231 100644 --- a/anubis-management-api/anubis/middleware/operations.py +++ b/anubis-management-api/anubis/middleware/operations.py @@ -5,7 +5,8 @@ from ..tenants import models as tm -# TODO it would be good to have also the list of owners, but query needs to be defined +# TODO it would be good to have also the list of owners, but query needs +# to be defined def get_resources( db: Session, tenant: str = None, diff --git a/anubis-management-api/anubis/middleware/routers.py b/anubis-management-api/anubis/middleware/routers.py index 61131d0..72f7345 100644 --- a/anubis-management-api/anubis/middleware/routers.py +++ b/anubis-management-api/anubis/middleware/routers.py @@ -130,7 +130,8 @@ def read_policy( db_service_path = ot.get_db_service_path( db, fiware_service, fiware_servicepath) db_policy = op.get_policy(db, policy_id=policy_id) - if not db_policy or (db_service_path and db_service_path[0].id != db_policy.service_path_id): + if not db_policy or ( + db_service_path and db_service_path[0].id != db_policy.service_path_id): raise HTTPException(status_code=404, detail="Policy not found") return rp.serialize_policy(db_policy) @@ -164,19 +165,21 @@ def create_policy( # a corresponding registered resource in the database and use # the resource service and service path. if not we use `Default` service else: - resources = operations.get_resources(db, - tenant=None, - service_path=None, - resource=policy.access_to, - resource_type=policy.resource_type, - owner=owner) + resources = operations.get_resources( + db, + tenant=None, + service_path=None, + resource=policy.access_to, + resource_type=policy.resource_type, + owner=owner) if resources and hasattr(resources, "__len__") and len(resources) > 0: db_service_path = ot.get_db_service_path( db, resources[0].name, resources[0].path) db_service_path_id = list(map(ot.compute_id, db_service_path)) if len(resources) != 1: - logging.warning("While looking for a resource we found multiple instances in different tenants. " - "We pick only the first one.") + logging.warning( + "While looking for a resource we found multiple instances in different tenants. " + "We pick only the first one.") else: db_service_path = ot.get_db_service_path(db, 'Default', '/') if not db_service_path: diff --git a/anubis-management-api/anubis/middleware/schemas.py b/anubis-management-api/anubis/middleware/schemas.py index 01b0816..eabdd87 100644 --- a/anubis-management-api/anubis/middleware/schemas.py +++ b/anubis-management-api/anubis/middleware/schemas.py @@ -1,7 +1,8 @@ from pydantic import BaseModel -# TODO it would be good to have also the list of owners, but query needs to be defined +# TODO it would be good to have also the list of owners, but query needs +# to be defined class ResourceBase(BaseModel): id: str type: str