aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-25 14:52:58 -0500
committerFrederick Muriuki Muriithi2024-07-25 14:52:58 -0500
commit023618f5560a63eab94927f1c361f587fd1b2873 (patch)
treebf072a1066208dff5e9bd008a9a78243bf6522cd
parent754e8f214b940e05298cb360ed829f5c685d55a5 (diff)
downloadgn-uploader-023618f5560a63eab94927f1c361f587fd1b2873.tar.gz
Fix typing and linting errors.
-rw-r--r--mypy.ini9
-rw-r--r--scripts/qc_on_rqtl2_bundle.py14
-rw-r--r--uploader/__init__.py2
3 files changed, 19 insertions, 6 deletions
diff --git a/mypy.ini b/mypy.ini
index 08e896e..79c9a9c 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -28,4 +28,13 @@ ignore_missing_imports = True
ignore_missing_imports = True
[mypy-yaml.*]
+ignore_missing_imports = True
+
+[mypy-pymonad.tools]
+ignore_missing_imports = True
+
+[mypy-pymonad.either]
+ignore_missing_imports = True
+
+[mypy-authlib.*]
ignore_missing_imports = True \ No newline at end of file
diff --git a/scripts/qc_on_rqtl2_bundle.py b/scripts/qc_on_rqtl2_bundle.py
index 150fbce..7784c06 100644
--- a/scripts/qc_on_rqtl2_bundle.py
+++ b/scripts/qc_on_rqtl2_bundle.py
@@ -133,7 +133,7 @@ def qc_geno_errors(rconn, fqjobid, _dburi, _speciesid, zfile, logger) -> bool:
def fetch_db_geno_samples(conn: mdb.Connection, speciesid: int) -> tuple[str, ...]:
"""Fetch samples/cases/individuals from the database."""
- samples = set()
+ samples = set()# type: ignore[var-annotated]
with conn.cursor() as cursor:
cursor.execute("SELECT Name, Name2 from Strain WHERE SpeciesId=%s",
(speciesid,))
@@ -191,12 +191,13 @@ def check_pheno_samples(
return allerrors
-def qc_pheno_errors(rconn, fqjobid, dburi, speciesid, zfile, logger) -> bool:
+def qc_pheno_errors(# pylint: disable=[too-many-arguments]
+ rconn, fqjobid, dburi, speciesid, zfile, logger) -> bool:
"""Check for errors in `pheno` file(s)."""
cdata = rqtl2.control_data(zfile)
if "pheno" in cdata:
logger.info("Checking for errors in the 'pheno' fileā€¦")
- perrs = tuple()
+ perrs = tuple()# type: ignore[var-annotated]
with database_connection(dburi) as dbconn:
perrs = check_pheno_samples(
dbconn, speciesid, zfile.filename, logger) + tuple(
@@ -216,7 +217,8 @@ def qc_pheno_errors(rconn, fqjobid, dburi, speciesid, zfile, logger) -> bool:
return False
-def qc_phenose_errors(rconn, fqjobid, dburi, speciesid, zfile, logger) -> bool:
+def qc_phenose_errors(# pylint: disable=[too-many-arguments]
+ rconn, fqjobid, _dburi, _speciesid, zfile, logger) -> bool:
"""Check for errors in `phenose` file(s)."""
cdata = rqtl2.control_data(zfile)
if "phenose" in cdata:
@@ -258,7 +260,9 @@ def run_qc(rconn: Redis,
if qc_missing_files(rconn, fqjobid, zfile, logger):
return 1
- def with_zipfile(rconn, fqjobid, dbconn, speciesid, filename, logger, func):
+ def with_zipfile(# pylint: disable=[too-many-arguments]
+ rconn, fqjobid, dbconn, speciesid, filename, logger, func
+ ):
with ZipFile(filename, "r") as zfile:
return func(rconn, fqjobid, dbconn, speciesid, zfile, logger)
diff --git a/uploader/__init__.py b/uploader/__init__.py
index 3ee8aa0..e9875cf 100644
--- a/uploader/__init__.py
+++ b/uploader/__init__.py
@@ -34,7 +34,7 @@ def create_app():
app.config.from_envvar("QCAPP_SECRETS")
# setup jinja2 symbols
- app.jinja_env.globals.update(request_url=lambda : request.url)
+ app.add_template_global(lambda : request.url, name="request_url")
# setup blueprints
app.register_blueprint(base, url_prefix="/")