From 3b725c7354b185cc748f1d8ebfac6bab5e17b4aa Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 30 Nov 2023 09:58:23 +0300 Subject: Fix errors caught by pylint and mypy. --- scripts/insert_data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/insert_data.py b/scripts/insert_data.py index 45b6dd5..4dbf27c 100644 --- a/scripts/insert_data.py +++ b/scripts/insert_data.py @@ -66,6 +66,7 @@ def strains_info( return {strain["Name"]: strain for strain in cursor.fetchall()} def read_datavalues(filepath, headings, strain_info): + """Read numerical, data values from the file.""" return { str(row["ProbeSetID"]): tuple({ "ProbeSetName": str(row["ProbeSetID"]), @@ -149,6 +150,7 @@ def insert_probesets(filepath: str, platform_id: int, headings: tuple[str, ...], session_rand_str: str) -> tuple[str, ...]: + """Save new ProbeSets into the database.""" probeset_query = ( "INSERT INTO ProbeSet(ChipId, Name) " "VALUES (%(ChipId)s, %(Name)s) ") @@ -157,7 +159,7 @@ def insert_probesets(filepath: str, "Name": f"{row['Name']}{session_rand_str}", "ChipId": platform_id } for row in read_probesets(filepath, headings)) - probeset_names = tuple() + probeset_names: tuple[str, ...] = tuple() with dbconn.cursor(cursorclass=DictCursor) as cursor: while True: probeset_params = tuple(take(the_probesets, 10000)) @@ -209,7 +211,8 @@ def insert_means(# pylint: disable=[too-many-locals, too-many-arguments] # which means that we cannot have 2 (or more) ProbeSets which share both # the name and chip_id (platform) at the same time. rand_str = f"::RAND_{random_string()}" - pset_ids = { + pset_ids = {# pylint: disable=[unnecessary-comprehension] + # Look into simply doing dict(probeset_ids(...)) name: pset_id for name, pset_id in probeset_ids( dbconn, -- cgit v1.2.3