diff --git a/compendium_v2/app.py b/compendium_v2/app.py index 868719e13e6f909dea83ee1ab8c311d5713d4269..acd1fab0d684e63453a3596a204430314cfefea1 100644 --- a/compendium_v2/app.py +++ b/compendium_v2/app.py @@ -8,5 +8,5 @@ environment.setup_logging() app = compendium_v2.create_app() -if __name__ == "__main__": - app.run(host="::", port="33333") +if __name__ == '__main__': + app.run(host='::', port='33333') diff --git a/compendium_v2/routes/api.py b/compendium_v2/routes/api.py index 3adc75f7c3eabcfd855a3f23e87316ba65f77330..3707e116df9f7754e16feb9f218b3113986c8fe8 100644 --- a/compendium_v2/routes/api.py +++ b/compendium_v2/routes/api.py @@ -19,7 +19,7 @@ from flask import Blueprint, jsonify from compendium_v2.routes import common -routes = Blueprint("compendium-v2-api", __name__) +routes = Blueprint('compendium-v2-api', __name__) THING_LIST_SCHEMA = { @@ -51,7 +51,7 @@ def after_request(resp): return common.after_request(resp) -@routes.route("/things", methods=['GET', 'POST']) +@routes.route('/things', methods=['GET', 'POST']) @common.require_accepts_json def things(): """ diff --git a/compendium_v2/routes/common.py b/compendium_v2/routes/common.py index 519b6f6bd188655fca9fd9d34f90af210d1a771b..e6de1a89c363c3d251ea04b0b96640a10cbcb1d0 100644 --- a/compendium_v2/routes/common.py +++ b/compendium_v2/routes/common.py @@ -23,9 +23,9 @@ def require_accepts_json(f): # TODO: use best_match to disallow */* ...? if not request.accept_mimetypes.accept_json: return Response( - response="response will be json", + response='response will be json', status=406, - mimetype="text/html") + mimetype='text/html') return f(*args, **kwargs) return decorated_function diff --git a/compendium_v2/routes/default.py b/compendium_v2/routes/default.py index 7211bb4e0571519c04d7b90dae93a35ff41cba32..8929292a1517c02377cc4458f7baf503392e405e 100644 --- a/compendium_v2/routes/default.py +++ b/compendium_v2/routes/default.py @@ -15,7 +15,7 @@ from flask import Blueprint, jsonify, render_template from compendium_v2.routes import common -routes = Blueprint("compendium-v2-default", __name__) +routes = Blueprint('compendium-v2-default', __name__) API_VERSION = '0.1' VERSION_SCHEMA = { @@ -42,12 +42,12 @@ def after_request(resp): return common.after_request(resp) -@routes.route("/", methods=['GET']) +@routes.route('/', methods=['GET']) def index(): return render_template('index.html') -@routes.route("/version", methods=['GET', 'POST']) +@routes.route('/version', methods=['GET', 'POST']) @common.require_accepts_json def version(): """ diff --git a/compendium_v2/routes/service_matrix.py b/compendium_v2/routes/service_matrix.py index 0f642c4a182670487455cb83c9ae132ddf2da627..798db6ec75cb2e914d75dd2162785a10915fc653 100644 --- a/compendium_v2/routes/service_matrix.py +++ b/compendium_v2/routes/service_matrix.py @@ -22,31 +22,31 @@ from compendium_v2.routes import common SERVICE_MATRIX_SCHEMA = { '$schema': 'http://json-schema.org/draft-07/schema#', - "type": "object", - "properties": { - "key": { - "type": "string" + 'type': 'object', + 'properties': { + 'key': { + 'type': 'string' }, - "nrens": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" + 'nrens': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { + 'type': 'string' }, - "nren_id": { - "type": "integer" + 'nren_id': { + 'type': 'integer' }, - "tags": { - "type": "array", - "items": {} + 'tags': { + 'type': 'array', + 'items': {} } }, - "required": [ - "name", - "nren_id", - "tags" + 'required': [ + 'name', + 'nren_id', + 'tags' ], 'additionalProperties': True } @@ -60,7 +60,7 @@ DUMMY_DATA_FILENAME = os.path.abspath(os.path.join( 'datasources', 'dummy-service-matrix.json' )) -routes = Blueprint("compendium-v2-service-matrix", __name__) +routes = Blueprint('compendium-v2-service-matrix', __name__) logger = logging.getLogger(__name__) file_name = open(DUMMY_DATA_FILENAME) @@ -68,7 +68,7 @@ file_name = open(DUMMY_DATA_FILENAME) service_matrix_response = json.loads(file_name.read()) -@routes.route("", methods=['GET']) +@routes.route('', methods=['GET']) @common.require_accepts_json def get_service_matrix(): """ diff --git a/docs/source/conf.py b/docs/source/conf.py index 2b3e62339fcd4d9a2304c2eca53bde80042feb7c..812d976fe14bd48ddd9d762e399d819ba5fd2bbd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -99,5 +99,5 @@ html_static_path = ['_static'] # Both the class’ and the __init__ method’s docstring # are concatenated and inserted. -autoclass_content = "both" -autodoc_typehints = "none" +autoclass_content = 'both' +autodoc_typehints = 'none' diff --git a/requirements-dev.in b/requirements-dev.in index f95df6683efd4be5424e52e4ab24267a6085530e..baff2d973aa687a84d49b152c83ddb39e6fd7b50 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -1,4 +1,6 @@ -r requirements.txt +flake8==5.0.4 +flake8-quotes==3.3.1 isort==5.10.1 pip-tools==6.10.0 mypy==0.991 diff --git a/requirements-dev.txt b/requirements-dev.txt index 16acee83eae56bf0a84640deb392cd9b74493100..27fc2c5d55f5bed64f4f15f8c200cbebc40bd643 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -47,6 +47,12 @@ filelock==3.8.0 # via # tox # 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 # via # -r requirements.txt @@ -95,6 +101,8 @@ markupsafe==2.1.1 # -r requirements.txt # jinja2 # werkzeug +mccabe==0.7.0 + # via flake8 mypy==0.991 # via -r requirements-dev.in mypy-extensions==0.4.3 @@ -119,6 +127,10 @@ pluggy==1.0.0 # tox py==1.11.0 # via tox +pycodestyle==2.9.1 + # via flake8 +pyflakes==2.5.0 + # via flake8 pygments==2.13.0 # via # -r requirements.txt diff --git a/setup.py b/setup.py index cd9291bcc87a7440329d768f2fc4a8ccb95c5932..071adf39721a84fdd9e28e4648ba959a64fe6f5d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='compendium-v2', - version="0.2", + version='0.2', author='GEANT', author_email='swd@geant.org', description='Flask and React project for displaying ' diff --git a/tox.ini b/tox.ini index a870b92a3ac52d23802de1598d7324e5683caf30..b89bcccf54871b1c6d9711add5f6e52d9ca162a0 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ exclude = ./.tox,./webapp deps = coverage flake8 + flake8-quotes isort -r requirements.txt