add flake8

This commit is contained in:
weeman 2021-06-15 18:08:57 +02:00
parent 375f618e0d
commit b0950e58cc
Signed by untrusted user: weeman
GPG Key ID: 34F0524D4DA694A1
8 changed files with 60 additions and 22 deletions

5
.flake8 Normal file
View File

@ -0,0 +1,5 @@
[flake8]
max-line-length = 120
exclude =
.git,
migrations

15
Pipfile
View File

@ -4,15 +4,16 @@ verify_ssl = true
name = "pypi"
[packages]
flask = "*"
python-dotenv = "*"
flask-migrate = "*"
flask-sqlalchemy = "*"
sqlalchemy = "*"
waitress = "*"
pyyaml = "*"
flask = "~=2.0.1"
python-dotenv = "~=0.17.1"
flask-migrate = "~=3.0.1"
flask-sqlalchemy = "~=2.5.1"
sqlalchemy = "~=1.4.18"
waitress = "~=2.0.0"
pyyaml = "~=5.4.1"
[dev-packages]
flake8 = "~=3.9.2"
[requires]
python_version = "3.8"

36
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "5cf841925fa45f6b1c8fd6b5bd3829f5b02b81413815d3fa4755acb6c4132e2e"
"sha256": "439b60cb87b0180f0b78c531085f9bbeef7685ef038256f80b0a8123e7d144e6"
},
"pipfile-spec": 6,
"requires": {
@ -297,5 +297,37 @@
"version": "==2.0.1"
}
},
"develop": {}
"develop": {
"flake8": {
"hashes": [
"sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b",
"sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"
],
"index": "pypi",
"version": "==3.9.2"
},
"mccabe": {
"hashes": [
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
],
"version": "==0.6.1"
},
"pycodestyle": {
"hashes": [
"sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068",
"sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.7.0"
},
"pyflakes": {
"hashes": [
"sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3",
"sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.3.1"
}
}
}

2
app.py
View File

@ -15,4 +15,4 @@ app.config["KI_AUTH"] = os.getenv("KI_AUTH")
db = SQLAlchemy(app)
migrate = Migrate(app, db)
from ki import module
from ki import module # noqa

View File

@ -1 +1 @@
from ki import models, commands, routes
from ki import models, commands, routes # noqa

View File

@ -46,8 +46,8 @@ def handle_completion_request(model, key):
query = query.filter(model.name.startswith(request.args.get("search")))
results = query.order_by(model.name) \
.limit(10) \
.all()
.limit(10) \
.all()
api_results = models_to_list(results)
response_data = {}

View File

@ -20,13 +20,15 @@ class TestSkillsEndpoint(unittest.TestCase):
def test_get_skills1(self):
response = self.client.get("/skills?search=p")
self.assertEqual(response.status_code, 200)
self.assertEqual( \
{"skills": [ \
{"id": 1, "name": "PHP"}, \
{"id": 3, "name": "Python"}
]}, \
response.json \
)
self.assertEqual(
{
"skills": [
{"id": 1, "name": "PHP"},
{"id": 3, "name": "Python"}
]
},
response.json
)
if __name__ == "main":

View File

@ -1,2 +0,0 @@