From c4e8b63d6c2295518be8adb3f1d1c631cf02f2cc Mon Sep 17 00:00:00 2001
From: Daniel Hornung <d.hornung@indiscale.com>
Date: Fri, 22 Mar 2024 13:30:02 +0100
Subject: [PATCH] STY: Enhanced styling

---
 Makefile                                      |  4 +--
 .../table_json_conversion/fill_xlsx.py        |  2 +-
 .../table_json_conversion/table_generator.py  |  7 +++--
 .../test_table_template_generator.py          | 28 +++++++++----------
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index d9b182cb..e49e7b86 100644
--- a/Makefile
+++ b/Makefile
@@ -36,8 +36,8 @@ unittest:
 	pytest-3 unittests
 
 style:
-	pycodestyle --count src unittests --exclude=swagger_client
-	autopep8 -ar --diff --exit-code --exclude swagger_client .
+	pycodestyle --count --exclude=swagger_client src unittests
+	autopep8 -ar --diff --exit-code --exclude swagger_client src unittests
 .PHONY: style
 
 lint:
diff --git a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py
index 8e93767e..20d0016b 100644
--- a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py
+++ b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py
@@ -314,7 +314,7 @@ out: union[dict, None]
             else:
                 value = content[0]
                 if isinstance(value, str):
-                    value =  ILLEGAL_CHARACTERS_RE.sub("", value)
+                    value = ILLEGAL_CHARACTERS_RE.sub("", value)
             path_str = p2s(path)
             assert path_str not in insertables
             insertables[path_str] = value
diff --git a/src/caosadvancedtools/table_json_conversion/table_generator.py b/src/caosadvancedtools/table_json_conversion/table_generator.py
index 1f1267f3..21bcc7ae 100644
--- a/src/caosadvancedtools/table_json_conversion/table_generator.py
+++ b/src/caosadvancedtools/table_json_conversion/table_generator.py
@@ -208,13 +208,14 @@ class TableTemplateGenerator(ABC):
                         foreigns = self._get_foreign_keys(foreign_keys, array_path)
                         if isinstance(foreigns, str):
                             raise ValueError("Foreign keys must be a list of strings, but a single "
-                                            "string was given:\n"
-                                            f"{array_path} -> {foreigns}")
+                                             "string was given:\n"
+                                             f"{array_path} -> {foreigns}")
                         for foreign in foreigns:
                             internal_key = p2s(array_path + [foreign])
                             if internal_key in sheets[sheetname]:
                                 raise ValueError("The schema would lead to two columns with the same "
-                                                f"name, which is forbidden:\n{foreign} -> {internal_key}")
+                                                 "name, which is forbidden:\n"
+                                                 f"{foreign} -> {internal_key}")
                             ref_sheet = p2s(array_path)
                             sheets[sheetname][internal_key] = (
                                 ColumnType.FOREIGN, f"see sheet '{ref_sheet}'", array_path + [foreign])
diff --git a/unittests/table_json_conversion/test_table_template_generator.py b/unittests/table_json_conversion/test_table_template_generator.py
index 5acf67ca..8fc7b216 100644
--- a/unittests/table_json_conversion/test_table_template_generator.py
+++ b/unittests/table_json_conversion/test_table_template_generator.py
@@ -216,21 +216,21 @@ def test_template_generator():
         with open(rp) as sfi:
             schema = json.load(sfi)
         fk_path = os.path.join(di, "foreign_keys"+fi[len('schema'):])
-        path =os.path.join(di, "template"+fi[len('schema'):-4]+"xlsx")
-        allreadydone = [
-"Präventionsmaßnahmen" ,
-"Beratungsstellen" ,
-"Schutzeinrichtungen",
-"Einzelfallversorgung" ,
-"Strategiedokumente" ,
-"Kooperationsvereinbarungen" ,
-"Gremien" ,
-"Verwaltungsvorschriften" ,
-"Gewaltschutzkonzepte und -maßnahmen",
-"Polizeilicher Opferschutz",
-"Feedback",
+        path = os.path.join(di, "template"+fi[len('schema'):-4]+"xlsx")
+        alreadydone = [
+            "Präventionsmaßnahmen",
+            "Beratungsstellen",
+            "Schutzeinrichtungen",
+            "Einzelfallversorgung",
+            "Strategiedokumente",
+            "Kooperationsvereinbarungen",
+            "Gremien",
+            "Verwaltungsvorschriften",
+            "Gewaltschutzkonzepte und -maßnahmen",
+            "Polizeilicher Opferschutz",
+            "Feedback",
         ]
-        if any([path.startswith("template_"+k) for k in allreadydone]):
+        if any([path.startswith("template_"+k) for k in alreadydone]):
             continue
 
         if not os.path.exists(fk_path):
-- 
GitLab