From 14f70b34235dbf43d68ad72ea74a2020af890072 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 14 Dec 2021 13:46:40 +0300 Subject: mypy: ignore some imports and errors * Ignore some missing library stubs * Ignore some typing errors * Fix obvious typing errors --- gn3/computations/partial_correlations.py | 9 +++++---- gn3/db/correlations.py | 2 +- mypy.ini | 12 ++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 95eb5e9..91e953a 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -259,8 +259,9 @@ def partial_correlations_fast(# pylint: disable=[R0913, R0914] ## `correlation_type` parameter return len(all_correlations), tuple( corr + ( - (fetched_correlations[corr[0]],) if correlation_type == "literature" - else fetched_correlations[corr[0]][0:2]) + (fetched_correlations[corr[0]],) # type: ignore[index] + if correlation_type == "literature" + else fetched_correlations[corr[0]][0:2]) # type: ignore[index] for idx, corr in enumerate(all_correlations)) def build_data_frame( @@ -372,7 +373,7 @@ def partial_correlations_normal(# pylint: disable=R0913 return tuple(item) + (trait_database[1], trait_database[2]) return item - target_trait_names, target_trait_vals = reduce( + target_trait_names, target_trait_vals = reduce(# type: ignore[var-annotated] lambda acc, item: (acc[0]+(item[0],), acc[1]+(item[data_start_pos:],)), trait_database, (tuple(), tuple())) @@ -425,7 +426,7 @@ def partial_corrs(# pylint: disable=[R0913] data_start_pos, dataset, method) def literature_correlation_by_list( - conn: Any, species: str, trait_list: Tuple[dict]) -> Tuple[dict]: + conn: Any, species: str, trait_list: Tuple[dict]) -> Tuple[dict, ...]: """ This is a migration of the `web.webqtl.correlation.CorrelationPage.getLiteratureCorrelationByList` diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 268cfdd..338c0f2 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -422,7 +422,7 @@ def fetch_sample_ids( def build_query_sgo_lit_corr( db_type: str, temp_table: str, sample_id_columns: str, - joins: Tuple[str, ...]) -> str: + joins: Tuple[str, ...]) -> Tuple[str, int]: """ Build query for `SGO Literature Correlation` data, when querying the given `temp_table` temporary table. diff --git a/mypy.ini b/mypy.ini index b0c48df..ef93008 100644 --- a/mypy.ini +++ b/mypy.ini @@ -19,4 +19,16 @@ ignore_missing_imports = True ignore_missing_imports = True [mypy-requests.*] +ignore_missing_imports = True + +[mypy-flask.*] +ignore_missing_imports = True + +[mypy-werkzeug.*] +ignore_missing_imports = True + +[mypy-SPARQLWrapper.*] +ignore_missing_imports = True + +[mypy-pandas.*] ignore_missing_imports = True \ No newline at end of file -- cgit v1.2.3