From b538e8272e367b00285ac88bf9534ba2f05009b3 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 14 Jan 2025 15:38:13 -0500 Subject: [PATCH] sty: Ruff format --- src/fmripost_aroma/cli/parser.py | 23 ++++++++++----------- src/fmripost_aroma/cli/workflow.py | 6 +++--- src/fmripost_aroma/config.py | 2 +- src/fmripost_aroma/tests/run_local_tests.py | 2 +- src/fmripost_aroma/tests/utils.py | 2 +- src/fmripost_aroma/utils/utils.py | 2 +- src/fmripost_aroma/workflows/base.py | 8 +++---- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/fmripost_aroma/cli/parser.py b/src/fmripost_aroma/cli/parser.py index 33f395b..04fde11 100644 --- a/src/fmripost_aroma/cli/parser.py +++ b/src/fmripost_aroma/cli/parser.py @@ -216,11 +216,11 @@ def _bids_filter(value, parser): type=BIDSFilter, metavar='FILE', help=( - "A JSON file describing custom BIDS input filters using PyBIDS. " - "For further details, please check out " - "https://fmriprep.readthedocs.io/en/" - f"{currentv.base_version if is_release else 'latest'}/faq.html#" - "how-do-I-select-only-certain-files-to-be-input-to-fMRIPrep" + 'A JSON file describing custom BIDS input filters using PyBIDS. ' + 'For further details, please check out ' + 'https://fmriprep.readthedocs.io/en/' + f'{currentv.base_version if is_release else "latest"}/faq.html#' + 'how-do-I-select-only-certain-files-to-be-input-to-fMRIPrep' ), ) g_bids.add_argument( @@ -561,9 +561,9 @@ def parse_args(args=None, namespace=None): # Ensure input and output folders are not the same if output_dir == bids_dir: parser.error( - "The selected output folder is the same as the input BIDS folder. " - "Please modify the output path " - f"(suggestion: {bids_dir / 'derivatives' / 'fmripost_aroma-' + version.split('+')[0]}." + 'The selected output folder is the same as the input BIDS folder. ' + 'Please modify the output path ' + f'(suggestion: {bids_dir / "derivatives" / "fmripost_aroma-" + version.split("+")[0]}.' ) if bids_dir in work_dir.parents: @@ -577,8 +577,7 @@ def parse_args(args=None, namespace=None): from fmripost_aroma.utils.bids import validate_input_dir build_log.info( - 'Making sure the input data is BIDS compliant ' - '(warnings can be ignored in most cases).' + 'Making sure the input data is BIDS compliant (warnings can be ignored in most cases).' ) validate_input_dir(config.environment.exec_env, opts.bids_dir, opts.participant_label) @@ -598,8 +597,8 @@ def parse_args(args=None, namespace=None): missing_subjects = participant_label - set(all_subjects) if missing_subjects: parser.error( - "One or more participant labels were not found in the BIDS directory: " - f"{', '.join(missing_subjects)}." + 'One or more participant labels were not found in the BIDS directory: ' + f'{", ".join(missing_subjects)}.' ) config.execution.participant_label = sorted(participant_label) diff --git a/src/fmripost_aroma/cli/workflow.py b/src/fmripost_aroma/cli/workflow.py index 386d020..4e3e735 100644 --- a/src/fmripost_aroma/cli/workflow.py +++ b/src/fmripost_aroma/cli/workflow.py @@ -58,11 +58,11 @@ def build_workflow(config_file, retval): notice_path = Path(pkgrf('fmripost_aroma', 'data/NOTICE')) if notice_path.exists(): banner[0] += '\n' - banner += [f"License NOTICE {'#' * 50}"] + banner += [f'License NOTICE {"#" * 50}'] banner += [f'fMRIPost-AROMA {version}'] banner += notice_path.read_text().splitlines(keepends=False)[1:] banner += ['#' * len(banner[1])] - build_log.log(25, f"\n{' ' * 9}".join(banner)) + build_log.log(25, f'\n{" " * 9}'.join(banner)) # warn if older results exist: check for dataset_description.json in output folder msg = check_pipeline_version( @@ -110,7 +110,7 @@ def build_workflow(config_file, retval): if config.execution.derivatives: init_msg += [f'Searching for derivatives: {config.execution.derivatives}.'] - build_log.log(25, f"\n{' ' * 11}* ".join(init_msg)) + build_log.log(25, f'\n{" " * 11}* '.join(init_msg)) retval['workflow'] = init_fmripost_aroma_wf() diff --git a/src/fmripost_aroma/config.py b/src/fmripost_aroma/config.py index 098a9cd..cb6ce11 100644 --- a/src/fmripost_aroma/config.py +++ b/src/fmripost_aroma/config.py @@ -430,7 +430,7 @@ class execution(_Config): the command line) as spatial references for outputs.""" reports_only = False """Only build the reports, based on the reportlets found in a cached working directory.""" - run_uuid = f"{strftime('%Y%m%d-%H%M%S')}_{uuid4()}" + run_uuid = f'{strftime("%Y%m%d-%H%M%S")}_{uuid4()}' """Unique identifier of this particular run.""" participant_label = None """List of participant identifiers that are to be preprocessed.""" diff --git a/src/fmripost_aroma/tests/run_local_tests.py b/src/fmripost_aroma/tests/run_local_tests.py index 6805219..0f1a417 100755 --- a/src/fmripost_aroma/tests/run_local_tests.py +++ b/src/fmripost_aroma/tests/run_local_tests.py @@ -62,7 +62,7 @@ def run_command(command, env=None): if process.returncode != 0: raise RuntimeError( - f'Non zero return code: {process.returncode}\n' f'{command}\n\n{process.stdout.read()}' + f'Non zero return code: {process.returncode}\n{command}\n\n{process.stdout.read()}' ) diff --git a/src/fmripost_aroma/tests/utils.py b/src/fmripost_aroma/tests/utils.py index 8ddf37d..345bbb1 100644 --- a/src/fmripost_aroma/tests/utils.py +++ b/src/fmripost_aroma/tests/utils.py @@ -115,7 +115,7 @@ def run_command(command, env=None): if process.returncode != 0: raise Exception( - f'Non zero return code: {process.returncode}\n' f'{command}\n\n{process.stdout.read()}' + f'Non zero return code: {process.returncode}\n{command}\n\n{process.stdout.read()}' ) diff --git a/src/fmripost_aroma/utils/utils.py b/src/fmripost_aroma/utils/utils.py index 906d12a..41240d0 100644 --- a/src/fmripost_aroma/utils/utils.py +++ b/src/fmripost_aroma/utils/utils.py @@ -440,7 +440,7 @@ def _get_wf_name(bold_fname, prefix): fname = split_filename(bold_fname)[1] fname_nosub = '_'.join(fname.split('_')[1:-1]) - return f"{prefix}_{fname_nosub.replace('-', '_')}_wf" + return f'{prefix}_{fname_nosub.replace("-", "_")}_wf' def update_dict(orig_dict, new_dict): diff --git a/src/fmripost_aroma/workflows/base.py b/src/fmripost_aroma/workflows/base.py index c60a29f..480db47 100644 --- a/src/fmripost_aroma/workflows/base.py +++ b/src/fmripost_aroma/workflows/base.py @@ -206,10 +206,10 @@ def init_single_subject_wf(subject_id: str): if not subject_data['bold']: task_id = config.execution.task_id raise RuntimeError( - f"No BOLD images found for participant {subject_id} and " - f"task {task_id if task_id else ''}. " - "All workflows require BOLD images. " - f"Please check your BIDS filters: {config.execution.bids_filters}." + f'No BOLD images found for participant {subject_id} and ' + f'task {task_id if task_id else ""}. ' + 'All workflows require BOLD images. ' + f'Please check your BIDS filters: {config.execution.bids_filters}.' ) config.loggers.workflow.info(