diff options
author | Frederick Muriuki Muriithi | 2023-11-30 09:58:23 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-11-30 09:58:23 +0300 |
commit | 3b725c7354b185cc748f1d8ebfac6bab5e17b4aa (patch) | |
tree | 9154564b1ee696b1a954c1052a1e050bab7cd544 /scripts/insert_data.py | |
parent | c26b9acc8d51bb5efe4e50114a6c723552e27a5f (diff) | |
download | gn-uploader-3b725c7354b185cc748f1d8ebfac6bab5e17b4aa.tar.gz |
Fix errors caught by pylint and mypy.
Diffstat (limited to 'scripts/insert_data.py')
-rw-r--r-- | scripts/insert_data.py | 7 |
1 files changed, 5 insertions, 2 deletions
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, |