Skip to content

Commit

Permalink
sty: Ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jan 14, 2025
1 parent 298b404 commit b538e82
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
23 changes: 11 additions & 12 deletions src/fmripost_aroma/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -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)
6 changes: 3 additions & 3 deletions src/fmripost_aroma/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/fmripost_aroma/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion src/fmripost_aroma/tests/run_local_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}'
)


Expand Down
2 changes: 1 addition & 1 deletion src/fmripost_aroma/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}'
)


Expand Down
2 changes: 1 addition & 1 deletion src/fmripost_aroma/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions src/fmripost_aroma/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>'}. "
"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>"}. '
'All workflows require BOLD images. '
f'Please check your BIDS filters: {config.execution.bids_filters}.'
)

config.loggers.workflow.info(
Expand Down

0 comments on commit b538e82

Please sign in to comment.