Skip to content
Snippets Groups Projects
Commit 868b80cc authored by Ian Galpin's avatar Ian Galpin
Browse files

Added flake8-quotes checking and fixed flake8 double to single quote errors

parent 44360777
No related branches found
No related tags found
No related merge requests found
...@@ -8,5 +8,5 @@ environment.setup_logging() ...@@ -8,5 +8,5 @@ environment.setup_logging()
app = compendium_v2.create_app() app = compendium_v2.create_app()
if __name__ == "__main__": if __name__ == '__main__':
app.run(host="::", port="33333") app.run(host='::', port='33333')
...@@ -19,7 +19,7 @@ from flask import Blueprint, jsonify ...@@ -19,7 +19,7 @@ from flask import Blueprint, jsonify
from compendium_v2.routes import common from compendium_v2.routes import common
routes = Blueprint("compendium-v2-api", __name__) routes = Blueprint('compendium-v2-api', __name__)
THING_LIST_SCHEMA = { THING_LIST_SCHEMA = {
...@@ -51,7 +51,7 @@ def after_request(resp): ...@@ -51,7 +51,7 @@ def after_request(resp):
return common.after_request(resp) return common.after_request(resp)
@routes.route("/things", methods=['GET', 'POST']) @routes.route('/things', methods=['GET', 'POST'])
@common.require_accepts_json @common.require_accepts_json
def things(): def things():
""" """
......
...@@ -23,9 +23,9 @@ def require_accepts_json(f): ...@@ -23,9 +23,9 @@ def require_accepts_json(f):
# TODO: use best_match to disallow */* ...? # TODO: use best_match to disallow */* ...?
if not request.accept_mimetypes.accept_json: if not request.accept_mimetypes.accept_json:
return Response( return Response(
response="response will be json", response='response will be json',
status=406, status=406,
mimetype="text/html") mimetype='text/html')
return f(*args, **kwargs) return f(*args, **kwargs)
return decorated_function return decorated_function
......
...@@ -15,7 +15,7 @@ from flask import Blueprint, jsonify, render_template ...@@ -15,7 +15,7 @@ from flask import Blueprint, jsonify, render_template
from compendium_v2.routes import common from compendium_v2.routes import common
routes = Blueprint("compendium-v2-default", __name__) routes = Blueprint('compendium-v2-default', __name__)
API_VERSION = '0.1' API_VERSION = '0.1'
VERSION_SCHEMA = { VERSION_SCHEMA = {
...@@ -42,12 +42,12 @@ def after_request(resp): ...@@ -42,12 +42,12 @@ def after_request(resp):
return common.after_request(resp) return common.after_request(resp)
@routes.route("/", methods=['GET']) @routes.route('/', methods=['GET'])
def index(): def index():
return render_template('index.html') return render_template('index.html')
@routes.route("/version", methods=['GET', 'POST']) @routes.route('/version', methods=['GET', 'POST'])
@common.require_accepts_json @common.require_accepts_json
def version(): def version():
""" """
......
...@@ -22,31 +22,31 @@ from compendium_v2.routes import common ...@@ -22,31 +22,31 @@ from compendium_v2.routes import common
SERVICE_MATRIX_SCHEMA = { SERVICE_MATRIX_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#', '$schema': 'http://json-schema.org/draft-07/schema#',
"type": "object", 'type': 'object',
"properties": { 'properties': {
"key": { 'key': {
"type": "string" 'type': 'string'
}, },
"nrens": { 'nrens': {
"type": "array", 'type': 'array',
"items": { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"name": { 'name': {
"type": "string" 'type': 'string'
}, },
"nren_id": { 'nren_id': {
"type": "integer" 'type': 'integer'
}, },
"tags": { 'tags': {
"type": "array", 'type': 'array',
"items": {} 'items': {}
} }
}, },
"required": [ 'required': [
"name", 'name',
"nren_id", 'nren_id',
"tags" 'tags'
], ],
'additionalProperties': True 'additionalProperties': True
} }
...@@ -60,7 +60,7 @@ DUMMY_DATA_FILENAME = os.path.abspath(os.path.join( ...@@ -60,7 +60,7 @@ DUMMY_DATA_FILENAME = os.path.abspath(os.path.join(
'datasources', 'datasources',
'dummy-service-matrix.json' 'dummy-service-matrix.json'
)) ))
routes = Blueprint("compendium-v2-service-matrix", __name__) routes = Blueprint('compendium-v2-service-matrix', __name__)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
file_name = open(DUMMY_DATA_FILENAME) file_name = open(DUMMY_DATA_FILENAME)
...@@ -68,7 +68,7 @@ file_name = open(DUMMY_DATA_FILENAME) ...@@ -68,7 +68,7 @@ file_name = open(DUMMY_DATA_FILENAME)
service_matrix_response = json.loads(file_name.read()) service_matrix_response = json.loads(file_name.read())
@routes.route("", methods=['GET']) @routes.route('', methods=['GET'])
@common.require_accepts_json @common.require_accepts_json
def get_service_matrix(): def get_service_matrix():
""" """
......
...@@ -99,5 +99,5 @@ html_static_path = ['_static'] ...@@ -99,5 +99,5 @@ html_static_path = ['_static']
# Both the class’ and the __init__ method’s docstring # Both the class’ and the __init__ method’s docstring
# are concatenated and inserted. # are concatenated and inserted.
autoclass_content = "both" autoclass_content = 'both'
autodoc_typehints = "none" autodoc_typehints = 'none'
-r requirements.txt -r requirements.txt
flake8==5.0.4
flake8-quotes==3.3.1
isort==5.10.1 isort==5.10.1
pip-tools==6.10.0 pip-tools==6.10.0
mypy==0.991 mypy==0.991
......
...@@ -47,6 +47,12 @@ filelock==3.8.0 ...@@ -47,6 +47,12 @@ filelock==3.8.0
# via # via
# tox # tox
# virtualenv # virtualenv
flake8==5.0.4
# via
# -r requirements-dev.in
# flake8-quotes
flake8-quotes==3.3.1
# via -r requirements-dev.in
flask==2.2.2 flask==2.2.2
# via # via
# -r requirements.txt # -r requirements.txt
...@@ -95,6 +101,8 @@ markupsafe==2.1.1 ...@@ -95,6 +101,8 @@ markupsafe==2.1.1
# -r requirements.txt # -r requirements.txt
# jinja2 # jinja2
# werkzeug # werkzeug
mccabe==0.7.0
# via flake8
mypy==0.991 mypy==0.991
# via -r requirements-dev.in # via -r requirements-dev.in
mypy-extensions==0.4.3 mypy-extensions==0.4.3
...@@ -119,6 +127,10 @@ pluggy==1.0.0 ...@@ -119,6 +127,10 @@ pluggy==1.0.0
# tox # tox
py==1.11.0 py==1.11.0
# via tox # via tox
pycodestyle==2.9.1
# via flake8
pyflakes==2.5.0
# via flake8
pygments==2.13.0 pygments==2.13.0
# via # via
# -r requirements.txt # -r requirements.txt
......
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='compendium-v2', name='compendium-v2',
version="0.2", version='0.2',
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='Flask and React project for displaying ' description='Flask and React project for displaying '
......
...@@ -9,6 +9,7 @@ exclude = ./.tox,./webapp ...@@ -9,6 +9,7 @@ exclude = ./.tox,./webapp
deps = deps =
coverage coverage
flake8 flake8
flake8-quotes
isort isort
-r requirements.txt -r requirements.txt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment