aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-02-16 18:43:50 +0300
committerAlexander_Kabui2024-02-16 18:43:50 +0300
commite9c24ce3442682f099bf3ceb003fd6a5f3e377b7 (patch)
tree3c46b804024b31220774a1658f977c5197fb73f4
parentfba0da25d86caec697cf35efe54569a67283e9d3 (diff)
downloadgenenetwork2-e9c24ce3442682f099bf3ceb003fd6a5f3e377b7.tar.gz
pep8 formatting
-rw-r--r--gn2/wqflask/views.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index 854d2621..cc212980 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -265,28 +265,26 @@ def gsearchtable():
@app.route("/gnqna", methods=["POST", "GET"])
def gnqna():
-
-
if request.method == "POST":
try:
def __error__(resp):
return resp.json()
-
def error_page(error_msg):
- return render_template("gnqa_errors.html",error = error_msg)
+ return render_template("gnqa_errors.html", error=error_msg)
+
def __success__(resp):
- return render_template("gnqa_answer.html", **{"gn_server_url":GN3_LOCAL_URL,**(resp.json())})
- if user_logged_in():
+ return render_template("gnqa_answer.html", **{"gn_server_url": GN3_LOCAL_URL, **(resp.json())})
+ if not user_logged_in():
return error_page("Please Login/Register to Genenetwork to access this Service")
token = session_info()["user"]["token"].either(
- lambda err: err, lambda tok: tok["access_token"])
+ lambda err: err, lambda tok: tok["access_token"])
return monad_requests.post(
urljoin(GN3_LOCAL_URL,
"/api/llm/gnqna"),
json=dict(request.form),
headers={
- "Authorization":f"Bearer {token}"
+ "Authorization": f"Bearer {token}"
}
).then(
lambda resp: resp
@@ -299,7 +297,7 @@ def gnqna():
"/api/llm/get_hist_names")
).then(
lambda resp: resp
- ).either(lambda x: [], lambda x: x.json()["prev_queries"]))
+ ).either(lambda x: [], lambda x: x.json()["prev_queries"]))
return render_template("gnqa.html", prev_queries=prev_queries)
@@ -308,12 +306,9 @@ def gnqna():
def gnqna_hist(search_term):
# todo add token validation
- response = monad_requests.get(urljoin(GN3_LOCAL_URL,f"/api/llm/historys/{search_term}")).then(lambda resp :resp).either(
- lambda x: x.json(),lambda x : x.json())
- return render_template("gnqa_answer.html",**{"gn_server_url":GN3_LOCAL_URL,**response})
-
-
-
+ response = monad_requests.get(urljoin(GN3_LOCAL_URL, f"/api/llm/historys/{search_term}")).then(lambda resp: resp).either(
+ lambda x: x.json(), lambda x: x.json())
+ return render_template("gnqa_answer.html", **{"gn_server_url": GN3_LOCAL_URL, **response})
@app.route("/gsearch_updating", methods=('POST',))