about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-24 10:17:18 -0500
committerFrederick Muriuki Muriithi2024-09-24 10:17:18 -0500
commitf74c89feb2bef25225cc8d534129480abdc3c594 (patch)
treef645ea60b6868dabce2ff7d31de1bbb634518d5a
parent016a4b6724ba30ba2dfd1168686f65164c540f89 (diff)
downloadgn-uploader-f74c89feb2bef25225cc8d534129480abdc3c594.tar.gz
Lint: Silence linter by fixing minor issues.
-rw-r--r--uploader/expression_data/views.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/uploader/expression_data/views.py b/uploader/expression_data/views.py
index c5a75e7..88c4528 100644
--- a/uploader/expression_data/views.py
+++ b/uploader/expression_data/views.py
@@ -105,15 +105,14 @@ def index():
         if not bool(request.args.get("species_id")):
             return render_template("expression-data/index.html",
                                    species=order_by_family(all_species(conn)),
-                                   activelink="genotypes")
+                                   activelink="expression-data")
         species = species_by_id(conn, request.args.get("species_id"))
         if not bool(species):
-            flash(f"Could not find species with ID '{request.args.get('species_id')}'!",
-                  "alert-danger")
+            flash("Could not find species selected!", "alert-danger")
             return redirect(url_for("species.populations.expression-data.index"))
-        return redirect(url_for("species.populations.expression-data.select_population",
-                                species_id=species["SpeciesId"]))
-    return render_template()
+        return redirect(url_for(
+            "species.populations.expression-data.select_population",
+            species_id=species["SpeciesId"]))
 
 
 @exprdatabp.route("<int:species_id>/populations/expression-data/select-population",
@@ -124,7 +123,7 @@ def select_population(species_id: int):
     with database_connection(app.config["SQL_URI"]) as conn:
         species = species_by_id(conn, species_id)
         if not bool(species):
-            flash("Invalid species provided!", "alert-danger")
+            flash("No such species!", "alert-danger")
             return redirect(url_for("species.populations.expression-data.index"))
 
         if not bool(request.args.get("population_id")):
@@ -133,12 +132,12 @@ def select_population(species_id: int):
                                    populations=order_by_family(
                                        populations_by_species(conn, species_id),
                                        order_key="FamilyOrder"),
-                                   activelink="genotypes")
+                                   activelink="expression-data")
 
         population = population_by_species_and_id(
             conn, species_id, request.args.get("population_id"))
         if not bool(population):
-            flash("Invalid population selected!", "alert-danger")
+            flash("No such population!", "alert-danger")
             return redirect(url_for(
                 "species.populations.expression-data.select_population",
                 species_id=species_id))
@@ -202,34 +201,34 @@ def data_review():
 @require_login
 def parse_file(species_id: int, population_id: int):
     """Trigger file parsing"""
-    errors = False
+    _errors = False
     filename = request.args.get("filename")
     filetype = request.args.get("filetype")
 
     species = with_db_connection(lambda con: species_by_id(con, species_id))
     if not bool(species):
         flash("No such species.", "alert-danger")
-        errors = True
+        _errors = True
 
     if filename is None:
         flash("No file provided", "alert-danger")
-        errors = True
+        _errors = True
 
     if filetype is None:
         flash("No filetype provided", "alert-danger")
-        errors = True
+        _errors = True
 
     if filetype not in ("average", "standard-error"):
         flash("Invalid filetype provided", "alert-danger")
-        errors = True
+        _errors = True
 
     if filename:
         filepath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
         if not os.path.exists(filepath):
             flash("Selected file does not exist (any longer)", "alert-danger")
-            errors = True
+            _errors = True
 
-    if errors:
+    if _errors:
         return redirect(url_for("species.populations.expression-data.upload_file"))
 
     redisurl = app.config["REDIS_URL"]
@@ -272,7 +271,7 @@ def parse_status(species_id: int, population_id: int, job_id: str):
     progress = float(job["percent"])
     status = job["status"]
     filename = job.get("filename", "uploaded file")
-    errors = jsonpickle.decode(
+    _errors = jsonpickle.decode(
         job.get("errors", jsonpickle.encode(tuple())))
     if status in ("success", "aborted"):
         return redirect(url_for("species.populations.expression-data.results",
@@ -293,7 +292,7 @@ def parse_status(species_id: int, population_id: int, job_id: str):
         progress = progress,
         message = job.get("message", ""),
         job_name = f"Parsing '{filename}'",
-        errors=errors,
+        errors=_errors,
         species=with_db_connection(
             lambda conn: species_by_id(conn, species_id)),
         population=with_db_connection(
@@ -313,13 +312,13 @@ def results(species_id: int, population_id: int, job_id: uuid.UUID):
 
     if job:
         filename = job["filename"]
-        errors = jsonpickle.decode(job.get("errors", jsonpickle.encode(tuple())))
+        _errors = jsonpickle.decode(job.get("errors", jsonpickle.encode(tuple())))
         app.jinja_env.globals.update(
             isinvalidvalue=isinvalidvalue,
             isduplicateheading=isduplicateheading)
         return render_template(
             "expression-data/parse-results.html",
-            errors=errors,
+            errors=_errors,
             job_name = f"Parsing '{filename}'",
             user_aborted = job.get("user_aborted"),
             job_id=job["jobid"],