From 1390dfa8e6e24e92373b126a12e7c5467e498504 Mon Sep 17 00:00:00 2001 From: Frank Lanitz Date: Mon, 21 Jun 2021 16:06:06 +0200 Subject: [PATCH 1/3] Add usage of yapf to README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7a38e97..f1f7af8 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,13 @@ python -m unittest discover ki flake8 ``` +### Formating + +Um ein einheitliches Quellcode-Erlebnis zu haben, kann der Code mit yapf neu formatiert werden: + +''' +yapf -i --recursive ki/ +''' ### Testbenutzer From 6d4f933585ba0ed5fd34fd6578b3f2cd4cc21e3e Mon Sep 17 00:00:00 2001 From: Frank Lanitz Date: Mon, 21 Jun 2021 16:06:30 +0200 Subject: [PATCH 2/3] Add yapf to Pipfile --- Pipfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Pipfile b/Pipfile index 23b1370..3fbc6e4 100644 --- a/Pipfile +++ b/Pipfile @@ -14,6 +14,7 @@ pyyaml = "~=5.4.1" [dev-packages] flake8 = "~=3.9.2" +yapf = "~=0.31.0" [requires] python_version = "3.8" From cbf3002b933d27ca1f09720ee141f0457042792c Mon Sep 17 00:00:00 2001 From: Frank Lanitz Date: Mon, 21 Jun 2021 16:06:58 +0200 Subject: [PATCH 3/3] Reformat source code --- README.md | 2 +- ki/module.py | 2 +- ki/test/test_skills_endpoint.py | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f1f7af8..f902575 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ python -m unittest discover ki flake8 ``` -### Formating +### Formatierung Um ein einheitliches Quellcode-Erlebnis zu haben, kann der Code mit yapf neu formatiert werden: diff --git a/ki/module.py b/ki/module.py index da8bc46..79eeb96 100644 --- a/ki/module.py +++ b/ki/module.py @@ -1 +1 @@ -from ki import models, commands, routes # noqa +from ki import models, commands, routes # noqa diff --git a/ki/test/test_skills_endpoint.py b/ki/test/test_skills_endpoint.py index 0603102..80cfae6 100644 --- a/ki/test/test_skills_endpoint.py +++ b/ki/test/test_skills_endpoint.py @@ -22,13 +22,14 @@ class TestSkillsEndpoint(unittest.TestCase): self.assertEqual(response.status_code, 200) self.assertEqual( { - "skills": [ - {"id": 1, "name": "PHP"}, - {"id": 3, "name": "Python"} - ] - }, - response.json - ) + "skills": [{ + "id": 1, + "name": "PHP" + }, { + "id": 3, + "name": "Python" + }] + }, response.json) if __name__ == "main":