8000 chore: Bump minimum Python, rerun auto style fixes by effigies · Pull Request #93 · nipreps/fmripost-aroma · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: Bump minimum Python, rerun auto style fixes #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump 8000 to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fmripost-aroma"
description = 'Run ICA-AROMA on fMRIPrep derivatives'
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
license = {file = "LICENSE"}
keywords = []
authors = [{name = "The NiPreps Developers", email = "nipreps@gmail.com"}]
Expand Down
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 @@
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}']

Check warning on line 61 in src/fmripost_aroma/cli/workflow.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/cli/workflow.py#L61

Added line #L61 was not covered by tests
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))

Check warning on line 65 in src/fmripost_aroma/cli/workflow.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/cli/workflow.py#L65

Added line #L65 was not covered by tests

# 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 @@
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))

Check warning on line 113 in src/fmripost_aroma/cli/workflow.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/cli/workflow.py#L113

Added line #L113 was not covered by tests

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/test_utils_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def check_expected(subject_data, expected):
elif isinstance(value, list):
assert subject_data[key] is not None, f'Key {key} is None.'
assert len(subject_data[key]) == len(value)
for item, expected_item in zip(subject_data[key], value):
for item, expected_item in zip(subject_data[key], value, strict=False):
assert os.path.basename(item) == expected_item
else:
assert subject_data[key] is value
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
6 changes: 5 additions & 1 deletion src/fmripost_aroma/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ def collect_derivatives(
derivs_cache['anat2outputspaces_xfm'] = anat2outputspaces_xfm
else:
missing_spaces = ', '.join(
[s.space for s, found in zip(spaces.references, spaces_found) if not found]
[
s.space
for s, found in zip(spaces.references, spaces_found, strict=False)
if not found
]
)
raise ValueError(
f'Transforms to the following requested spaces not found: {missing_spaces}.'
Expand Down
4 changes: 2 additions & 2 deletions src/fmripost_aroma/utils/resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import asyncio
import os
from collections.abc import Callable
from functools import partial
from pathlib import Path
from typing import Callable, TypeVar
from typing import Annotated, TypeVar

import h5py
import nibabel as nb
Expand All @@ -21,7 +22,6 @@
from sdcflows.transform import grid_bspline_weights
from sdcflows.utils.tools import ensure_positive_cosines
from templateflow import api as tf
from typing_extensions import Annotated

R = TypeVar('R')

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
Loading
0