From 601eedf8d67cbf54b665d7a83e46a431833c59bb Mon Sep 17 00:00:00 2001
From: anikaweinmann <weinmann@mundialis.de>
Date: Thu, 12 Dec 2024 09:19:10 +0100
Subject: [PATCH] further ruff

---
 src/actinia_example_plugin/__init__.py        |  2 +-
 src/actinia_example_plugin/api/helloworld.py  | 14 ++++----
 .../api/project_helloworld.py                 | 14 ++++----
 .../apidocs/helloworld.py                     |  6 ++--
 .../apidocs/project_helloworld.py             |  6 ++--
 src/actinia_example_plugin/core/example.py    |  9 +++--
 src/actinia_example_plugin/endpoints.py       |  8 ++---
 .../model/response_models.py                  |  4 +--
 src/actinia_example_plugin/wsgi.py            |  2 +-
 tests/conftest.py                             |  2 +-
 tests/integrationtests/test_helloworld.py     | 35 +++++++++----------
 tests/testsuite.py                            |  2 +-
 tests/unittests/test_transformation.py        |  2 +-
 13 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/src/actinia_example_plugin/__init__.py b/src/actinia_example_plugin/__init__.py
index 1b44714..370ce74 100644
--- a/src/actinia_example_plugin/__init__.py
+++ b/src/actinia_example_plugin/__init__.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-"""Copyright (c) 2018-present mundialis GmbH & Co. KG
+"""Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/src/actinia_example_plugin/api/helloworld.py b/src/actinia_example_plugin/api/helloworld.py
index 22097f5..5f31d2b 100644
--- a/src/actinia_example_plugin/api/helloworld.py
+++ b/src/actinia_example_plugin/api/helloworld.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -25,22 +25,21 @@
 __maintainer__ = "mundialis GmbH & Co. KG"
 
 
-from flask import request, make_response
-from flask_restful_swagger_2 import swagger
-from flask_restful_swagger_2 import Resource
+from flask import make_response, request
+from flask_restful_swagger_2 import Resource, swagger
 
 from actinia_example_plugin.apidocs import helloworld
+from actinia_example_plugin.core.example import transform_input
 from actinia_example_plugin.model.response_models import (
     SimpleStatusCodeResponseModel,
 )
-from actinia_example_plugin.core.example import transform_input
 
 
 class HelloWorld(Resource):
-    """Returns 'Hello world!'"""
+    """Returns 'Hello world!'."""
 
     def __init__(self) -> None:
-        """Hello world class initialisation"""
+        """Hello world class initialisation."""
         self.msg = "Hello world!"
 
     @swagger.doc(helloworld.describeHelloWorld_get_docs)
@@ -51,7 +50,6 @@ def get(self) -> SimpleStatusCodeResponseModel:
     @swagger.doc(helloworld.describeHelloWorld_post_docs)
     def post(self) -> SimpleStatusCodeResponseModel:
         """Hello World post method with name from postbody."""
-
         req_data = request.get_json(force=True)
         if isinstance(req_data, dict) is False or "name" not in req_data:
             return make_response("Missing name in JSON content", 400)
diff --git a/src/actinia_example_plugin/api/project_helloworld.py b/src/actinia_example_plugin/api/project_helloworld.py
index 6fae489..be101b0 100644
--- a/src/actinia_example_plugin/api/project_helloworld.py
+++ b/src/actinia_example_plugin/api/project_helloworld.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -25,9 +25,8 @@
 __maintainer__ = "mundialis GmbH & Co. KG"
 
 
-from flask import request, make_response
-from flask_restful_swagger_2 import swagger
-from flask_restful_swagger_2 import Resource
+from flask import make_response, request
+from flask_restful_swagger_2 import Resource, swagger
 
 from actinia_example_plugin.apidocs import project_helloworld
 from actinia_example_plugin.model.response_models import (
@@ -37,22 +36,21 @@
 
 
 class ProjectHelloWorld(Resource):
-    """Returns 'Hello world with project/location!'"""
+    """Returns 'Hello world with project/location!'."""
 
     def __init__(self) -> None:
-        """Project hello world class initialisation"""
+        """Project hello world class initialisation."""
         self.msg = "Project: Hello world!"
 
     @swagger.doc(project_helloworld.describeProjectHelloWorld_get_docs)
     def get(self, project_name) -> SimpleStatusCodeResponseModel:
         """Get 'Hello world!' as answer string."""
-        msg += f"{self.msg} {project_name}"
+        msg = f"{self.msg} {project_name}"
         return SimpleStatusCodeResponseModel(status=200, message=msg)
 
     @swagger.doc(project_helloworld.describeProjectHelloWorld_post_docs)
     def post(self, project_name) -> SimpleStatusCodeResponseModel:
         """Hello World post method with name from postbody."""
-
         req_data = request.get_json(force=True)
         if isinstance(req_data, dict) is False or "name" not in req_data:
             return make_response("Missing name in JSON content", 400)
diff --git a/src/actinia_example_plugin/apidocs/helloworld.py b/src/actinia_example_plugin/apidocs/helloworld.py
index 354300d..fe9a465 100644
--- a/src/actinia_example_plugin/apidocs/helloworld.py
+++ b/src/actinia_example_plugin/apidocs/helloworld.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@
         "200": {
             "description": "This response returns the string 'Hello World!'",
             "schema": SimpleStatusCodeResponseModel,
-        }
+        },
     },
 }
 
@@ -61,7 +61,7 @@
                         "type": "string",
                         "description": "detailed message",
                         "example": "Missing name in JSON content",
-                    }
+                    },
                 },
             },
         },
diff --git a/src/actinia_example_plugin/apidocs/project_helloworld.py b/src/actinia_example_plugin/apidocs/project_helloworld.py
index 4bb4998..199ee17 100644
--- a/src/actinia_example_plugin/apidocs/project_helloworld.py
+++ b/src/actinia_example_plugin/apidocs/project_helloworld.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@
         "200": {
             "description": "This response returns the string 'Hello World!'",
             "schema": SimpleStatusCodeResponseModel,
-        }
+        },
     },
 }
 
@@ -83,7 +83,7 @@
                         "type": "string",
                         "description": "detailed message",
                         "example": "Missing name in JSON content",
-                    }
+                    },
                 },
             },
         },
diff --git a/src/actinia_example_plugin/core/example.py b/src/actinia_example_plugin/core/example.py
index e431caa..337524d 100644
--- a/src/actinia_example_plugin/core/example.py
+++ b/src/actinia_example_plugin/core/example.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@
 __maintainer__ = "mundialis GmbH & Co. KG"
 
 
-def transform_input(inp):
-    """Example core function"""
-    out = f"Hello world {inp.upper()}!"
-    return out
+def transform_input(inp) -> str:
+    """Example core function."""
+    return f"Hello world {inp.upper()}!"
diff --git a/src/actinia_example_plugin/endpoints.py b/src/actinia_example_plugin/endpoints.py
index 071fd09..0b18da1 100644
--- a/src/actinia_example_plugin/endpoints.py
+++ b/src/actinia_example_plugin/endpoints.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
 from actinia_example_plugin.api.project_helloworld import ProjectHelloWorld
 
 
-def create_project_endpoints(apidoc, projects_url_part="projects"):
+def create_project_endpoints(apidoc, projects_url_part="projects") -> None:
     """
     Function to add resources with "project" inside the endpoint url.
 
@@ -49,8 +49,8 @@ def create_project_endpoints(apidoc, projects_url_part="projects"):
 
 
 # endpoints loaded if run as actinia-core plugin as well as standalone app
-def create_endpoints(flask_api):
-    """Create plugin endpoints"""
+def create_endpoints(flask_api) -> None:
+    """Create plugin endpoints."""
     apidoc = flask_api
 
     apidoc.add_resource(HelloWorld, "/helloworld")
diff --git a/src/actinia_example_plugin/model/response_models.py b/src/actinia_example_plugin/model/response_models.py
index 31e5326..868b429 100644
--- a/src/actinia_example_plugin/model/response_models.py
+++ b/src/actinia_example_plugin/model/response_models.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -46,6 +46,6 @@ class SimpleStatusCodeResponseModel(Schema):
 
 
 simpleResponseExample = SimpleStatusCodeResponseModel(
-    status=200, message="success"
+    status=200, message="success",
 )
 SimpleStatusCodeResponseModel.example = simpleResponseExample
diff --git a/src/actinia_example_plugin/wsgi.py b/src/actinia_example_plugin/wsgi.py
index 10242d9..1ed6344 100644
--- a/src/actinia_example_plugin/wsgi.py
+++ b/src/actinia_example_plugin/wsgi.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/tests/conftest.py b/tests/conftest.py
index 49933f1..e05828a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/tests/integrationtests/test_helloworld.py b/tests/integrationtests/test_helloworld.py
index 97b8fa6..b2c81a3 100644
--- a/tests/integrationtests/test_helloworld.py
+++ b/tests/integrationtests/test_helloworld.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -27,36 +27,35 @@
 
 import json
 import pytest
-from flask import Response
-
 from actinia_api import URL_PREFIX
+from flask import Response
 
-from ..testsuite import ActiniaTestCase
+from tests.testsuite import ActiniaTestCase
 
 
 class ActiniaHelloWorldTest(ActiniaTestCase):
-    """Actinia hello world test class for hello world endpoint"""
+    """Actinia hello world test class for hello world endpoint."""
 
     @pytest.mark.integrationtest
-    def test_get_helloworld(self):
-        """Test the get method of the /helloworld endpoint"""
+    def test_get_helloworld(self) -> None:
+        """Test the get method of the /helloworld endpoint."""
         resp = self.app.get(f"{URL_PREFIX}/helloworld")
 
         assert isinstance(
-            resp, Response
+            resp, Response,
         ), "The response is not of type Response"
         assert resp.status_code == 200, "The status code is not 200"
         assert hasattr(resp, "json"), "The response has no attribute 'json'"
         assert "message" in resp.json, (
-            "There is no 'message' inside the " "response"
+            "There is no 'message' inside the response"
         )
         assert resp.json["message"] == "Hello world!", (
-            "The response message" " is wrong"
+            "The response message is wrong"
         )
 
     @pytest.mark.integrationtest
-    def test_post_helloworld(self):
-        """Test the post method of the /helloworld endpoint"""
+    def test_post_helloworld(self) -> None:
+        """Test the post method of the /helloworld endpoint."""
         postbody = {"name": "test"}
         resp = self.app.post(
             f"{URL_PREFIX}/helloworld",
@@ -65,20 +64,20 @@ def test_post_helloworld(self):
             content_type="application/json",
         )
         assert isinstance(
-            resp, Response
+            resp, Response,
         ), "The response is not of type Response"
         assert resp.status_code == 200, "The status code is not 200"
         assert hasattr(resp, "json"), "The response has no attribute 'json'"
         assert "message" in resp.json, (
-            "There is no 'message' inside the " "response"
+            "There is no 'message' inside the response"
         )
         assert resp.json["message"] == "Hello world TEST!", (
-            "The response " "message is wrong"
+            "The response message is wrong"
         )
 
     @pytest.mark.integrationtest
-    def test_post_helloworld_error(self):
-        """Test the post method of the /helloworld endpoint"""
+    def test_post_helloworld_error(self) -> None:
+        """Test the post method of the /helloworld endpoint."""
         postbody = {"namee": "test"}
         resp = self.app.post(
             f"{URL_PREFIX}/helloworld",
@@ -87,7 +86,7 @@ def test_post_helloworld_error(self):
             content_type="application/json",
         )
         assert isinstance(
-            resp, Response
+            resp, Response,
         ), "The response is not of type Response"
         assert resp.status_code == 400, "The status code is not 400"
         assert resp.data == b"Missing name in JSON content"
diff --git a/tests/testsuite.py b/tests/testsuite.py
index 60112a9..06422d9 100644
--- a/tests/testsuite.py
+++ b/tests/testsuite.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/tests/unittests/test_transformation.py b/tests/unittests/test_transformation.py
index 7ab86d4..54f133e 100644
--- a/tests/unittests/test_transformation.py
+++ b/tests/unittests/test_transformation.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Copyright (c) 2018-present mundialis GmbH & Co. KG
+Copyright (c) 2018-present mundialis GmbH & Co. KG.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by