From 949ea71eb721a3f5bdff3ba10f7dd7c70899d560 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 5 Feb 2024 12:11:43 +0300 Subject: Fix linting and type errors. --- r_qtl/r_qtl2_qc.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'r_qtl') diff --git a/r_qtl/r_qtl2_qc.py b/r_qtl/r_qtl2_qc.py index 261d300..853c34b 100644 --- a/r_qtl/r_qtl2_qc.py +++ b/r_qtl/r_qtl2_qc.py @@ -7,23 +7,23 @@ from r_qtl import errors as rqe from r_qtl import r_qtl2 as rqtl2 from r_qtl.r_qtl2 import __FILE_TYPES__ -def bundle_files_list(zfile, cdata: dict) -> tuple[str]: +def bundle_files_list(cdata: dict) -> tuple[str, ...]: """Retrieve files listed in control file.""" def __merge__(alist: tuple[str, ...], member: Union[str, Sequence[str]]) -> tuple[str, ...]: if isinstance(cdata[member], str): return alist + (cdata[member],) return alist + tuple(cdata[member]) - fileslist = tuple() - fileslist = reduce(__merge__, - (key for key in cdata.keys() if key in __FILE_TYPES__), - tuple()) + fileslist: tuple[str, ...] = reduce( + __merge__, + (key for key in cdata.keys() if key in __FILE_TYPES__), + tuple()) if "file" in cdata.get("sex", {}): sexfile = cdata["sex"]["file"] fileslist = fileslist + ( (sexfile,) if isinstance(sexfile, str) else tuple(sexfile)) - + if "file" in cdata.get("cross_info", {}): crossinfofile = cdata["cross_info"]["file"] fileslist = fileslist + ( @@ -32,7 +32,7 @@ def bundle_files_list(zfile, cdata: dict) -> tuple[str]: return fileslist -def missing_files(zfile: ZipFile) -> tuple[str]: +def missing_files(zfile: ZipFile) -> tuple[str, ...]: """ Retrieve a list of files listed in the control file that do not exist in the bundle. @@ -45,7 +45,7 @@ def missing_files(zfile: ZipFile) -> tuple[str]: return True return tuple(filter(__missing_p__, - bundle_files_list(zfile, rqtl2.control_data(zfile)))) + bundle_files_list(rqtl2.control_data(zfile)))) def validate_bundle(zfile: ZipFile): """Ensure the R/qtl2 bundle is valid.""" -- cgit v1.2.3