From 90328555a377d772a5613ef70b5361ef629478db Mon Sep 17 00:00:00 2001 From: Gensollen Date: Fri, 22 Nov 2024 10:05:57 +0100 Subject: [PATCH] [FIX] Fix type mismatch in `clinica.iotools.bids_utils` (#1376) * look for 'flutemeta' in file name * fix --- clinica/iotools/bids_utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/clinica/iotools/bids_utils.py b/clinica/iotools/bids_utils.py index e4eb8cedf..962d4ef1e 100644 --- a/clinica/iotools/bids_utils.py +++ b/clinica/iotools/bids_utils.py @@ -576,12 +576,9 @@ def create_scans_dict( # Some flutemeta lines contain a non-coded string value at the second-to-last position. This value # contains a comma which adds an extra column and shifts the remaining values to the right. In this # case, we just remove the erroneous content and replace it with -4 which AIBL uses as n/a value. - on_bad_lines = ( # noqa: E731 - lambda bad_line: bad_line[:-3] + [-4, bad_line[-1]] - if "flutemeta" in file_path and study_name == StudyName.AIBL - else "error" - ) - + on_bad_lines = lambda x: "error" # noqa + if "flutemeta" in file_path.name and study_name == StudyName.AIBL: + on_bad_lines = lambda bad_line: bad_line[:-3] + [-4, bad_line[-1]] # noqa file_to_read = pd.read_csv( file_path, sep=",",