diff --git a/.gitignore b/.gitignore index 67963ef2..7e714d61 100644 --- a/.gitignore +++ b/.gitignore @@ -58,9 +58,9 @@ docs/_build/ ~* *~ *.pyc - /.idea/ - .idea - .idea/ +/.idea/ +.idea +.idea/ #updated ontology files Climate_Mind_Digraph_Test_Ont.json diff --git a/app/__init__.py b/app/__init__.py index 285d4f83..4c33583c 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -4,7 +4,7 @@ from sentry_sdk.integrations.flask import FlaskIntegration from app import models -from app.extensions import db, migrate, login, cache, auto, jwt, limiter +from app.extensions import db, migrate, login, cache, jwt, limiter from config import DevelopmentConfig @@ -17,7 +17,6 @@ def create_app(config_class=DevelopmentConfig): migrate.init_app(app, db) login.init_app(app) cache.init_app(app) - auto.init_app(app) jwt.init_app(app) limiter.init_app(app) @@ -88,10 +87,6 @@ def create_app(config_class=DevelopmentConfig): app.register_blueprint(personal_values_bp) - from app.documentation import bp as documentation_bp - - app.register_blueprint(documentation_bp) - from app.post_code import bp as post_code_bp app.register_blueprint(post_code_bp) diff --git a/app/account/routes.py b/app/account/routes.py index 4df871c5..116e863d 100644 --- a/app/account/routes.py +++ b/app/account/routes.py @@ -7,7 +7,7 @@ from flask_jwt_extended import jwt_required from sqlalchemy.exc import SQLAlchemyError -from app import auto, db, limiter +from app import db, limiter from app.account import bp from app.account.schemas import ( UserChangePasswordSchema, @@ -30,7 +30,6 @@ @bp.route("/quizId", methods=["GET"]) @cross_origin() @jwt_required() -@auto.doc() def current_quizId(): """ Returns the current quizId of a logged in user or standard JWT errors if token not available or expired. @@ -44,7 +43,6 @@ def current_quizId(): @bp.route("/email", methods=["GET"]) @cross_origin() @jwt_required() -@auto.doc() def current_email(): """ Returns the current email address of a logged in user or standard JWT errors if token not available or expired. @@ -58,7 +56,6 @@ def current_email(): @bp.route("/email", methods=["PUT"]) @cross_origin() @jwt_required() -@auto.doc() def update_email(): """ # FIXME: move to /user-account PUT diff --git a/app/alignment/routes.py b/app/alignment/routes.py index a2a0204d..a803bd77 100644 --- a/app/alignment/routes.py +++ b/app/alignment/routes.py @@ -4,7 +4,6 @@ from flask_cors import cross_origin from flask import jsonify -from app import auto from app.alignment import bp from app.common.uuid import validate_uuid, uuidType, check_uuid_in_db from app.user_b.analytics_logging import log_user_b_event, eventType @@ -16,7 +15,6 @@ @bp.route("/alignment", methods=["POST"]) @cross_origin() -@auto.doc() def post_alignment_uuid(): """ Post alignment. After user b has taken the quiz, their results are compared to user a and their @@ -104,7 +102,6 @@ def get_alignment(alignment_scores_uuid): @bp.route("/alignment//shared-impacts", methods=["GET"]) @cross_origin() -@auto.doc() def get_shared_impacts(alignment_scores_uuid): """ Get a list of the shared impacts generated by comparing user A's and user B's quiz scores. @@ -140,7 +137,6 @@ def get_shared_impacts(alignment_scores_uuid): @bp.route("/alignment//shared-solutions", methods=["GET"]) @cross_origin() -@auto.doc() def get_shared_solutions(alignment_scores_uuid): """ Get a list of the shared solutions generated by comparing user A's and user B's quiz scores. @@ -177,7 +173,6 @@ def get_shared_solutions(alignment_scores_uuid): @bp.route("/alignment//shared-impacts", methods=["POST"]) @cross_origin() -@auto.doc() def post_shared_impact_selection(alignment_scores_uuid): """ Records the shared impact that user b has selected to discuss with user a. @@ -227,7 +222,6 @@ def post_shared_impact_selection(alignment_scores_uuid): @bp.route("/alignment//shared-solutions", methods=["POST"]) @cross_origin() -@auto.doc() def post_shared_solution_selection(alignment_scores_uuid): """ Records the shared solutions that user b has selected to discuss with user a. @@ -276,7 +270,6 @@ def post_shared_solution_selection(alignment_scores_uuid): @bp.route("/alignment/shared-impact/", methods=["GET"]) @cross_origin() -@auto.doc() def get_shared_impact_details(impact_iri): """ Gets the details for a shared impact when the user clicks Learn More on the card in their feed. @@ -300,7 +293,6 @@ def get_shared_impact_details(impact_iri): @bp.route("/alignment/shared-solution/", methods=["GET"]) @cross_origin() -@auto.doc() def get_shared_solution_details(solution_iri): """ Gets the details for a shared solution when the user clicks Learn More on the card in their feed. @@ -324,7 +316,6 @@ def get_shared_solution_details(solution_iri): @bp.route("/alignment//summary", methods=["GET"]) @cross_origin() -@auto.doc() def get_alignment_summary(alignment_scores_uuid): """ Gets the alignment summary for user B to see before confirming their consent to share with user A. diff --git a/app/auth/routes.py b/app/auth/routes.py index 378022fb..9a2e3f85 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -24,7 +24,7 @@ from app.models import Users from app.sendgrid.utils import send_welcome_email -from app import db, auto +from app import db from app import limiter import uuid @@ -46,7 +46,6 @@ def ip_whitelist(): @bp.route("/login", methods=["POST"]) -@auto.doc() @limiter.limit("100/day;50/hour;10/minute;5/second") def login(): """ diff --git a/app/documentation/__init__.py b/app/documentation/__init__.py deleted file mode 100644 index 35b093d4..00000000 --- a/app/documentation/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from flask import Blueprint - -bp = Blueprint("documentation", __name__) - -from app.documentation import routes diff --git a/app/documentation/routes.py b/app/documentation/routes.py deleted file mode 100644 index 72794aad..00000000 --- a/app/documentation/routes.py +++ /dev/null @@ -1,17 +0,0 @@ -from app.documentation import bp - -from app import auto -from flask_cors import cross_origin - -""" - -Returns auto-generated API documentation based on the docstrings contained in each -API endpoint. - -""" - - -@bp.route("/documentation") -@cross_origin() -def documentation(): - return auto.html() diff --git a/app/extensions.py b/app/extensions.py index 1b3c3439..21af4fa7 100644 --- a/app/extensions.py +++ b/app/extensions.py @@ -4,7 +4,6 @@ from flask_limiter.util import get_remote_address from flask_login import LoginManager from flask_migrate import Migrate -from flask_selfdoc import Autodoc from flask_sqlalchemy import SQLAlchemy from sqlalchemy import MetaData @@ -24,7 +23,6 @@ login.login_view = "auth.login" login.login_message = "Please log in to access this page." cache = Cache() -auto = Autodoc() jwt = JWTManager() limiter = Limiter( key_func=get_remote_address, default_limits=["1000 per day", "200 per hour"] diff --git a/app/feed/routes.py b/app/feed/routes.py index 35371e38..ee1f7a0c 100644 --- a/app/feed/routes.py +++ b/app/feed/routes.py @@ -9,12 +9,11 @@ from app.models import Scores from flask_cors import cross_origin -from app import db, auto, cache +from app import db, cache @bp.route("/feed", methods=["GET"]) @cross_origin() -@auto.doc() def get_feed(): """ The front-end needs to request personalized climate change effects that are most diff --git a/app/myths/routes.py b/app/myths/routes.py index ccc243cf..c2e75fa4 100644 --- a/app/myths/routes.py +++ b/app/myths/routes.py @@ -6,12 +6,9 @@ MYTH_PROCESSOR = process_myths() -from app import auto - @bp.route("/myths", methods=["GET"]) @cross_origin() -@auto.doc() def get_general_myths(): """ The front-end needs a general myths list and information to serve to user when diff --git a/app/personal_values/routes.py b/app/personal_values/routes.py index 0bd12464..01ef4f3d 100644 --- a/app/personal_values/routes.py +++ b/app/personal_values/routes.py @@ -6,7 +6,6 @@ from app.personal_values import bp from app.models import Scores from app.common.uuid import validate_uuid, uuidType, check_uuid_in_db -from app import auto from app.personal_values.normalize import normalize_scores from flask_cors import cross_origin @@ -16,7 +15,6 @@ @bp.route("/personal_values", methods=["GET"]) @cross_origin() -@auto.doc() def get_personal_values(): """ Users want to know their personal values based on their Schwartz questionnaire diff --git a/app/post_code/routes.py b/app/post_code/routes.py index 79b5f91c..786290e4 100644 --- a/app/post_code/routes.py +++ b/app/post_code/routes.py @@ -6,12 +6,9 @@ from app.errors.errors import InvalidUsageError from flask_cors import cross_origin -from app import auto - @bp.route("/post-code", methods=["POST"]) @cross_origin() -@auto.doc() def post_code(): """ diff --git a/app/questions/routes.py b/app/questions/routes.py index e7ba7e59..07aa032e 100644 --- a/app/questions/routes.py +++ b/app/questions/routes.py @@ -3,14 +3,12 @@ from flask import Response from flask_cors import cross_origin -from app import auto from app.questions import bp from app.questions.utils import get_schwartz_questions_file_data @bp.route("/questions", methods=["GET"]) @cross_origin() -@auto.doc() def get_questions(): """ Returns the list of available schwartz personal value questions that can be diff --git a/app/scoring/routes.py b/app/scoring/routes.py index 7e9219bf..f5c1fb32 100644 --- a/app/scoring/routes.py +++ b/app/scoring/routes.py @@ -12,13 +12,10 @@ from flask_jwt_extended import jwt_required from flask_jwt_extended import current_user -from app import auto - @bp.route("/scores", methods=["POST"]) @cross_origin() @jwt_required(optional=True) -@auto.doc() def user_scores(): """ User scores are used to determine which solutions are best to serve diff --git a/app/session/routes.py b/app/session/routes.py index 31d14897..325ce85a 100644 --- a/app/session/routes.py +++ b/app/session/routes.py @@ -7,7 +7,6 @@ from flask_jwt_extended import current_user from flask_jwt_extended import jwt_required -from app import auto from app.session import bp from app.session.session_helpers import get_ip_address, store_session @@ -15,7 +14,6 @@ @bp.route("/session", methods=["POST"]) @cross_origin() @jwt_required(optional=True) -@auto.doc() def post_session(): session_uuid = uuid.uuid4() session_created_timestamp = datetime.datetime.now(timezone.utc) diff --git a/app/solutions/routes.py b/app/solutions/routes.py index 8db0057c..c43394d4 100644 --- a/app/solutions/routes.py +++ b/app/solutions/routes.py @@ -9,14 +9,11 @@ import numpy as np import pickle -from app import auto - SOLUTION_PROCESSOR = process_solutions(4, 0.5) @bp.route("/get_actions", methods=["GET"]) @cross_origin() -@auto.doc() def get_actions(): """ The front-end needs to request actions to take against climate change @@ -35,7 +32,6 @@ def get_actions(): @bp.route("/solutions", methods=["GET"]) @cross_origin() -@auto.doc() def get_general_solutions(): """ The front-end needs general solutions list and information to serve to user when diff --git a/app/subscribe/routes.py b/app/subscribe/routes.py index d9387b19..60834039 100644 --- a/app/subscribe/routes.py +++ b/app/subscribe/routes.py @@ -7,12 +7,9 @@ from flask_cors import cross_origin from flask import request -from app import auto - @bp.route("/subscribe", methods=["POST"]) @cross_origin() -@auto.doc() def subscribe(): r = request.get_json(force=True, silent=True) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 6539c7b7..1f92b365 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -29,7 +29,6 @@ Flask-Login==0.5.0 flask-marshmallow==0.14.0 Flask-Migrate==2.5.3 Flask-SQLAlchemy==2.4.4 -Flask-Selfdoc==1.2.3 Flask-Limiter==1.4 limits==1.5.1 future==0.18.2