aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorBonfaceKilz2021-03-15 15:15:28 +0300
committerBonfaceKilz2021-03-15 15:15:28 +0300
commitf464a4bee6ce3b4e79870b3b14fce07d360b7386 (patch)
tree3cc50a84c23c6919bd9f3a2276019e85a02cf9bc /gn3
parent9ab0e87ab7f016cea5b12f9dd96af00b561a8493 (diff)
downloadgenenetwork3-f464a4bee6ce3b4e79870b3b14fce07d360b7386.tar.gz
Apply pep-8 formatting
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/correlation.py36
1 files changed, 6 insertions, 30 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py
index 4e3e07e..217b7ce 100644
--- a/gn3/api/correlation.py
+++ b/gn3/api/correlation.py
@@ -1,23 +1,17 @@
"""Endpoints for computing correlation"""
-import pickle
import time
from flask import Blueprint
from flask import jsonify
from flask import request
from flask import g
-from flask import after_this_request
-from default_settings import SQL_URI
-
-# import pymysql
-
from sqlalchemy import create_engine
-from gn3.correlation.correlation_computations import compute_correlation
+from default_settings import SQL_URI
+from gn3.correlation.correlation_computations import compute_correlation
correlation = Blueprint("correlation", __name__)
-
# xtodo implement neat db setup
@correlation.before_request
def connect_db():
@@ -31,38 +25,20 @@ def connect_db():
g.initial_time = time.time()
-@correlation.after_request
-def after_request_func(response):
- final_time = time.time() - g.initial_time
- print(f"This request for Correlation took {final_time} Seconds")
-
- g.initial_time = None
-
- return response
-
-
-
-
@correlation.route("/corr_compute", methods=["POST"])
def corr_compute_page():
"""api for doing correlation"""
- # todo accepts both form and json data
-
correlation_input = request.json
if correlation_input is None:
- return jsonify({"error": str("Bad request")}),400
-
+ return jsonify({"error": str("Bad request")}), 400
-
try:
- corr_results = compute_correlation(correlation_input_data=correlation_input)
+ corr_results = compute_correlation(
+ correlation_input_data=correlation_input)
-
except Exception as error: # pylint: disable=broad-except
return jsonify({"error": str(error)})
- return {
- "correlation_results":corr_results
- } \ No newline at end of file
+ return {"correlation_results": corr_results}