diff options
-rw-r--r-- | uploader/datautils.py | 4 | ||||
-rw-r--r-- | uploader/expression_data/views.py | 5 | ||||
-rw-r--r-- | uploader/genotypes/models.py | 4 | ||||
-rw-r--r-- | uploader/platforms/models.py | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/uploader/datautils.py b/uploader/datautils.py index 2ee079d..46a55c4 100644 --- a/uploader/datautils.py +++ b/uploader/datautils.py @@ -1,7 +1,7 @@ """Generic data utilities: Rename module.""" import math -from typing import Sequence from functools import reduce +from typing import Union, Sequence def enumerate_sequence(seq: Sequence[dict], start:int = 1) -> Sequence[dict]: """Enumerate sequence beginning at 1""" @@ -28,7 +28,7 @@ def order_by_family(items: tuple[dict, ...], key=lambda item: item[0][0]) -def safe_int(val: str) -> int: +def safe_int(val: Union[str, int, float]) -> int: """ Convert val into an integer: if val cannot be converted, return a zero. """ diff --git a/uploader/expression_data/views.py b/uploader/expression_data/views.py index 88c4528..bbe6538 100644 --- a/uploader/expression_data/views.py +++ b/uploader/expression_data/views.py @@ -168,7 +168,8 @@ def upload_file(species_id: int, population_id: int): flash(error, "alert-danger error-expr-data") return redirect(url_for("species.populations.expression-data.upload_file")) - filename = secure_filename(request.files["qc_text_file"].filename) + filename = secure_filename( + request.files["qc_text_file"].filename)# type: ignore[arg-type] if not os.path.exists(upload_dir): os.mkdir(upload_dir) @@ -236,7 +237,7 @@ def parse_file(species_id: int, population_id: int): job = jobs.launch_job( jobs.build_file_verification_job( rconn, app.config["SQL_URI"], redisurl, - species_id, filepath, filetype, + species_id, filepath, filetype,# type: ignore[arg-type] app.config["JOBS_TTL_SECONDS"]), redisurl, f"{app.config['UPLOAD_FOLDER']}/job_errors") diff --git a/uploader/genotypes/models.py b/uploader/genotypes/models.py index 1fe5929..db8cc3e 100644 --- a/uploader/genotypes/models.py +++ b/uploader/genotypes/models.py @@ -32,7 +32,7 @@ def genotype_markers( ) -> tuple[dict, ...]: """Retrieve markers from the database.""" _query = "SELECT * FROM Geno WHERE SpeciesId=%s" - if bool(limit) and limit > 0: + if bool(limit) and limit > 0:# type: ignore[operator] _query = _query + f" LIMIT {limit} OFFSET {offset}" with conn.cursor(cursorclass=DictCursor) as cursor: @@ -59,7 +59,7 @@ def genotype_dataset( _params = (species_id, population_id) if bool(dataset_id): _query = _query + " AND gf.Id=%s" - _params = _params + (dataset_id,) + _params = _params + (dataset_id,)# type: ignore[assignment] with conn.cursor(cursorclass=DictCursor) as cursor: cursor.execute(_query, _params) diff --git a/uploader/platforms/models.py b/uploader/platforms/models.py index adad0b2..4b690bb 100644 --- a/uploader/platforms/models.py +++ b/uploader/platforms/models.py @@ -13,7 +13,7 @@ def platforms_by_species( """Retrieve platforms by the species""" _query = ("SELECT * FROM GeneChip WHERE SpeciesId=%s " "ORDER BY GeneChipName ASC") - if bool(limit) and limit > 0: + if bool(limit) and limit > 0:# type: ignore[operator] _query = f"{_query} LIMIT {limit} OFFSET {offset}" with conn.cursor(cursorclass=DictCursor) as cursor: cursor.execute(_query, (speciesid,)) |