Skip to content

Commit 7057d8a

Browse files
Run ruff format
1 parent a94d7fe commit 7057d8a

File tree

11 files changed

+26
-29
lines changed

11 files changed

+26
-29
lines changed

.maint/update_authors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def get_git_lines(fname='line-contributors.txt'):
132132
def _namelast(inlist):
133133
retval = []
134134
for i in inlist:
135-
i['name'] = (f"{i.pop('name', '')} {i.pop('lastname', '')}").strip()
135+
i['name'] = (f'{i.pop("name", "")} {i.pop("lastname", "")}').strip()
136136
retval.append(i)
137137
return retval
138138

@@ -187,7 +187,7 @@ def zenodo(
187187
misses = set(miss_creators).intersection(miss_contributors)
188188
if misses:
189189
print(
190-
f"Some people made commits, but are missing in .maint/ files: {', '.join(misses)}",
190+
f'Some people made commits, but are missing in .maint/ files: {", ".join(misses)}',
191191
file=sys.stderr,
192192
)
193193

@@ -268,7 +268,7 @@ def _aslist(value):
268268

269269
if misses:
270270
print(
271-
f"Some people made commits, but are missing in .maint/ files: {', '.join(misses)}",
271+
f'Some people made commits, but are missing in .maint/ files: {", ".join(misses)}',
272272
file=sys.stderr,
273273
)
274274

.maint/update_zenodo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get_git_lines(fname='line-contributors.txt'):
7373
if cmd == [None]:
7474
cmd = [shutil.which('git-summary'), '--line']
7575
if not lines and cmd[0]:
76-
print(f"Running {' '.join(cmd)!r} on repo")
76+
print(f'Running {" ".join(cmd)!r} on repo')
7777
lines = sp.check_output(cmd).decode().splitlines()
7878
lines = [line for line in lines if 'Not Committed Yet' not in line]
7979
contrib_file.write_text('\n'.join(lines))

fmriprep/_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _warn(message, category=None, stacklevel=1, source=None):
3535
category = type(category).__name__
3636
category = category.replace('type', 'WARNING')
3737

38-
logging.getLogger('py.warnings').warning(f"{category or 'WARNING'}: {message}")
38+
logging.getLogger('py.warnings').warning(f'{category or "WARNING"}: {message}')
3939

4040

4141
def _showwarning(message, category, filename, lineno, file=None, line=None):

fmriprep/cli/parser.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class DeprecatedAction(Action):
5454
def __call__(self, parser, namespace, values, option_string=None):
5555
new_opt, rem_vers = deprecations.get(self.dest, (None, None))
5656
msg = (
57-
f"{self.option_strings} has been deprecated and will be removed in "
58-
f"{rem_vers or 'a later version'}."
57+
f'{self.option_strings} has been deprecated and will be removed in '
58+
f'{rem_vers or "a later version"}.'
5959
)
6060
if new_opt:
6161
msg += f' Please use `{new_opt}` instead.'
@@ -557,8 +557,7 @@ def _slice_time_ref(value, parser):
557557
action='store',
558558
default=0.5,
559559
type=float,
560-
help='Threshold for flagging a frame as an outlier on the basis of framewise '
561-
'displacement',
560+
help='Threshold for flagging a frame as an outlier on the basis of framewise displacement',
562561
)
563562
g_confounds.add_argument(
564563
'--dvars-spike-threshold',
@@ -900,8 +899,7 @@ def parse_args(args=None, namespace=None):
900899
from ..utils.bids import validate_input_dir
901900

902901
build_log.info(
903-
'Making sure the input data is BIDS compliant (warnings can be ignored in most '
904-
'cases).'
902+
'Making sure the input data is BIDS compliant (warnings can be ignored in most cases).'
905903
)
906904
validate_input_dir(
907905
config.environment.exec_env,

fmriprep/cli/workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def build_workflow(config_file, retval):
5858
notice_path = data.load.readable('NOTICE')
5959
if notice_path.exists():
6060
banner[0] += '\n'
61-
banner += [f"License NOTICE {'#' * 50}"]
61+
banner += [f'License NOTICE {"#" * 50}']
6262
banner += [f'fMRIPrep {version}']
6363
banner += notice_path.read_text().splitlines(keepends=False)[1:]
6464
banner += ['#' * len(banner[1])]
65-
build_log.log(25, f"\n{' ' * 9}".join(banner))
65+
build_log.log(25, f'\n{" " * 9}'.join(banner))
6666

6767
# warn if older results exist: check for dataset_description.json in output folder
6868
msg = check_pipeline_version('fMRIPrep', version, fmriprep_dir / 'dataset_description.json')
@@ -121,7 +121,7 @@ def build_workflow(config_file, retval):
121121
if config.execution.fs_subjects_dir:
122122
init_msg += [f"Pre-run FreeSurfer's SUBJECTS_DIR: {config.execution.fs_subjects_dir}."]
123123

124-
build_log.log(25, f"\n{' ' * 11}* ".join(init_msg))
124+
build_log.log(25, f'\n{" " * 11}* '.join(init_msg))
125125

126126
retval['workflow'] = init_fmriprep_wf()
127127

fmriprep/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ class execution(_Config):
432432
the command line) as spatial references for outputs."""
433433
reports_only = False
434434
"""Only build the reports, based on the reportlets found in a cached working directory."""
435-
run_uuid = f"{strftime('%Y%m%d-%H%M%S')}_{uuid4()}"
435+
run_uuid = f'{strftime("%Y%m%d-%H%M%S")}_{uuid4()}'
436436
"""Unique identifier of this particular run."""
437437
participant_label = None
438438
"""List of participant identifiers that are to be preprocessed."""

fmriprep/interfaces/workbench.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ class MetricDilateInputSpec(OpenMPTraitedSpec):
114114
argstr='-exponent %f ',
115115
position=9,
116116
default=6.0,
117-
desc='exponent n to use in (area / (distance ^ n)) as the '
118-
'weighting function (default 6)',
117+
desc='exponent n to use in (area / (distance ^ n)) as the weighting function (default 6)',
119118
)
120119

121120
corrected_areas = File(

fmriprep/reports/tests/test_reports.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ def mock_session_list(*args, **kwargs):
101101

102102
html_content = Path.read_text(tmp_path / expected_files[0])
103103
if boilerplate:
104-
assert (
105-
'The boilerplate text was automatically generated' in html_content
106-
), f'The file {expected_files[0]} did not contain the reported error.'
104+
assert 'The boilerplate text was automatically generated' in html_content, (
105+
f'The file {expected_files[0]} did not contain the reported error.'
106+
)
107107

108108
if error:
109-
assert (
110-
'One or more execution steps failed' in html_content
111-
), f'The file {expected_files[0]} did not contain the reported error.'
109+
assert 'One or more execution steps failed' in html_content, (
110+
f'The file {expected_files[0]} did not contain the reported error.'
111+
)

fmriprep/utils/bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def write_derivative_description(bids_dir, deriv_dir, dataset_links=None):
131131
if 'FMRIPREP_DOCKER_TAG' in os.environ:
132132
desc['GeneratedBy'][0]['Container'] = {
133133
'Type': 'docker',
134-
'Tag': f"nipreps/fmriprep:{os.environ['FMRIPREP_DOCKER_TAG']}",
134+
'Tag': f'nipreps/fmriprep:{os.environ["FMRIPREP_DOCKER_TAG"]}',
135135
}
136136
if 'FMRIPREP_SINGULARITY_URL' in os.environ:
137137
desc['GeneratedBy'][0]['Container'] = {

fmriprep/workflows/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ def init_single_subject_wf(subject_id: str):
232232

233233
if subject_data['roi']:
234234
warnings.warn(
235-
f"Lesion mask {subject_data['roi']} found. "
236-
"Future versions of fMRIPrep will use alternative conventions. "
237-
"Please refer to the documentation before upgrading.",
235+
f'Lesion mask {subject_data["roi"]} found. '
236+
'Future versions of fMRIPrep will use alternative conventions. '
237+
'Please refer to the documentation before upgrading.',
238238
FutureWarning,
239239
stacklevel=1,
240240
)
@@ -828,7 +828,7 @@ def map_fieldmap_estimation(
828828
for bold_file, estimator_key in all_estimators.items():
829829
if len(estimator_key) > 1:
830830
config.loggers.workflow.warning(
831-
f"Several fieldmaps <{', '.join(estimator_key)}> are "
831+
f'Several fieldmaps <{", ".join(estimator_key)}> are '
832832
f"'IntendedFor' <{bold_file}>, using {estimator_key[0]}"
833833
)
834834
estimator_key[1:] = []

fmriprep/workflows/bold/stc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def init_bold_stc_wf(
121121
slice_timing_correction = pe.Node(
122122
TShift(
123123
outputtype='NIFTI_GZ',
124-
tr=f"{metadata['RepetitionTime']}s",
124+
tr=f'{metadata["RepetitionTime"]}s',
125125
slice_timing=metadata['SliceTiming'],
126126
slice_encoding_direction=metadata.get('SliceEncodingDirection', 'k'),
127127
tzero=tzero,

0 commit comments

Comments
 (0)