about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-12-17 12:44:52 -0600
committerFrederick Muriuki Muriithi2025-12-17 12:44:52 -0600
commitecdc6dbd73cd7aeb83eeb866378ef42cd8979131 (patch)
tree484525345cd4ba11460aaac0ac43e4e99515d127
parentfd4fde868727a2779a11c38ef7cda300d4288030 (diff)
downloadgn-uploader-ecdc6dbd73cd7aeb83eeb866378ef42cd8979131.tar.gz
Fix linting problems.
-rw-r--r--scripts/cli/options.py2
-rw-r--r--scripts/run_qtlreaper.py15
-rw-r--r--uploader/background_jobs.py1
-rw-r--r--uploader/phenotypes/models.py2
-rw-r--r--uploader/phenotypes/views.py3
5 files changed, 11 insertions, 12 deletions
diff --git a/scripts/cli/options.py b/scripts/cli/options.py
index 67f35dc..70d2a27 100644
--- a/scripts/cli/options.py
+++ b/scripts/cli/options.py
@@ -13,7 +13,7 @@ def add_logging(parser: ArgumentParser) -> ArgumentParser:
         type=str,
         default="INFO",
         choices=loglevels,
-        help=(f"Controls the severity of events to log. Valid values are: " +
+        help=("Controls the severity of events to log. Valid values are: " +
               ", ".join(f"'{level}'" for level in loglevels)))
     return parser
 
diff --git a/scripts/run_qtlreaper.py b/scripts/run_qtlreaper.py
index ab58203..89cc3ec 100644
--- a/scripts/run_qtlreaper.py
+++ b/scripts/run_qtlreaper.py
@@ -4,7 +4,6 @@ import csv
 import time
 import secrets
 import logging
-import traceback
 import subprocess
 from pathlib import Path
 from typing import Union
@@ -86,8 +85,7 @@ def parse_tsv_file(results_file: Path) -> list[dict]:
         _dialect = csv.unix_dialect()
         _dialect.delimiter = "\t"
         reader = csv.DictReader(readptr, dialect=_dialect)
-        for row in reader:
-            yield row
+        yield from reader
 
 
 def __qtls_by_trait__(qtls, current):
@@ -99,6 +97,7 @@ def __qtls_by_trait__(qtls, current):
 
 
 def save_qtl_values_to_db(conn, qtls: dict):
+    """Save computed QTLs to the database."""
     with conn.cursor() as cursor:
         cursor.executemany(
             "UPDATE PublishXRef SET "
@@ -167,16 +166,16 @@ def dispatch(args: Namespace) -> int:
             _traitsfile.unlink()
             _qtlreaper_main_output.unlink()
             logger.info("Successfully computed p values for %s traits.", len(_traitsdata))
-            exitcode = 0
+            return 0
         except FileNotFoundError as fnf:
             logger.error(", ".join(fnf.args), exc_info=False)
         except AssertionError as aserr:
             logger.error(", ".join(aserr.args), exc_info=False)
-        except Exception as _exc:
+        except Exception as _exc:# pylint: disable=[broad-exception-caught]
             logger.debug("Type of exception: %s", type(_exc))
             logger.error("General exception!", exc_info=True)
-        finally:
-            return exitcode
+
+        return exitcode
 
 
 if __name__ == "__main__":
@@ -205,7 +204,7 @@ if __name__ == "__main__":
                   "in the population."))
         args = parser.parse_args()
         setup_logging(logger, args.log_level)
-        
+
         return dispatch(args)
 
     sys.exit(main())
diff --git a/uploader/background_jobs.py b/uploader/background_jobs.py
index fc59ec7..4aded1d 100644
--- a/uploader/background_jobs.py
+++ b/uploader/background_jobs.py
@@ -5,7 +5,6 @@ from typing import Callable
 from functools import partial
 
 from flask import (
-    request,
     redirect,
     Response,
     Blueprint,
diff --git a/uploader/phenotypes/models.py b/uploader/phenotypes/models.py
index af06376..e962e62 100644
--- a/uploader/phenotypes/models.py
+++ b/uploader/phenotypes/models.py
@@ -248,7 +248,7 @@ def phenotypes_data(conn: mdb.Connection,
         return tuple(dict(row) for row in cursor.fetchall())
 
 
-def phenotypes_vector_data(
+def phenotypes_vector_data(# pylint: disable=[too-many-arguments, too-many-positional-arguments]
         conn: mdb.Connection,
         species_id: int,
         population_id: int,
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 5b32fc0..ead43ab 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -428,7 +428,7 @@ def add_phenotypes(species: dict, population: dict, dataset: dict, **kwargs):# p
             return render_template(
                 sui_template("phenotypes/add-phenotypes-with-rqtl2-bundle.html"
                              if use_bundle
-                             else f"phenotypes/add-phenotypes-raw-files.html"),
+                             else "phenotypes/add-phenotypes-raw-files.html"),
                 species=species,
                 population=population,
                 dataset=dataset,
@@ -1078,6 +1078,7 @@ def recompute_means(# pylint: disable=[unused-argument]
 
 
 def return_to_dataset_view_handler(job, msg: str):
+    """Handler for background jobs: Returns to `View Dataset` page."""
     flash(msg, "alert alert-success")
     return redirect(url_for(
         "species.populations.phenotypes.view_dataset",