From 42b743a5ef07d3c75524df3e58acd65e9f85456f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 24 Oct 2024 16:05:08 -0500 Subject: Fix linting and typing errors. --- r_qtl/r_qtl2.py | 2 +- scripts/rqtl2/phenotypes_qc.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index 5b926d1..c6307f5 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -566,7 +566,7 @@ def read_text_file(filepath: Union[str, Path]) -> Iterator[str]: def read_csv_file(filepath: Union[str, Path], separator: str = ",", - comment_char: str = "#") -> Iterator[str]: + comment_char: str = "#") -> Iterator[tuple[str, ...]]: """Read a file as a csv file.""" for line in read_text_file(filepath): if line.startswith(comment_char): diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py index 4191df9..3448790 100644 --- a/scripts/rqtl2/phenotypes_qc.py +++ b/scripts/rqtl2/phenotypes_qc.py @@ -169,7 +169,7 @@ def merge_dicts(*dicts): return reduce(lambda merged, dct: {**merged, **dct}, dicts, {}) -def decimal_points_error( +def decimal_points_error(# pylint: disable=[too-many-arguments] filename: str, rowtitle: str, coltitle: str, @@ -178,7 +178,7 @@ def decimal_points_error( decimal_places: int = 1 ) -> Optional[InvalidValue]: """Returns an error if the value does not meet the checks.""" - if not bool(decimal_places_pattern(1).match(cellvalue)): + if not bool(decimal_places_pattern(decimal_places).match(cellvalue)): return InvalidValue(filename, rowtitle, coltitle, cellvalue, message) return None @@ -188,8 +188,7 @@ def integer_error( rowtitle: str, coltitle: str, cellvalue: str, - message: str, - decimal_places: int = 1 + message: str ) -> Optional[InvalidValue]: """Returns an error if the value does not meet the checks.""" try: @@ -201,7 +200,7 @@ def integer_error( return InvalidValue(filename, rowtitle, coltitle, cellvalue, message) -def qc_pheno_file( +def qc_pheno_file(# pylint: disable=[too-many-arguments] filepath: Path, samples: tuple[str, ...], phenonames: tuple[str, ...], @@ -281,7 +280,7 @@ def run_qc(# pylint: disable=[too-many-arguments] logger.error("We found the following errors:\n%s", "\n".join(f" - {error}" for error in errors)) return 1 - # TODO: Run QC on actual values + # Run QC on actual values # Steps: # - Extract file to specific directory extractiondir, *_bundlefiles = extract_bundle(phenobundle, workingdir) -- cgit v1.2.3