Skip to content

Commit

Permalink
MNT: Add flake8-logging-format (G) rules to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed May 4, 2024
1 parent 3cbf147 commit a7cdac8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fmriprep/_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _warn(message, category=None, stacklevel=1, source=None):
category = type(category).__name__
category = category.replace('type', 'WARNING')

logging.getLogger('py.warnings').warning(f"{category or 'WARNING'}: {message}")
logging.getLogger('py.warnings').warning("%s: %s", category or 'WARNING', message)


def _showwarning(message, category, filename, lineno, file=None, line=None):
Expand Down
5 changes: 3 additions & 2 deletions fmriprep/interfaces/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ def get_world_pedir(ornt, pe_direction):
if flip[not inv].startswith(axcode):
return '-'.join(flip)
LOGGER.warning(
'Cannot determine world direction of phase encoding. '
f'Orientation: {ornt}; PE dir: {pe_direction}'
'Cannot determine world direction of phase encoding. Orientation: %s; PE dir: %s',
ornt,
pe_direction,
)
return 'Could not be determined - assuming Anterior-Posterior'
2 changes: 1 addition & 1 deletion fmriprep/workflows/bold/stc.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def init_bold_stc_wf(
inputnode = pe.Node(niu.IdentityInterface(fields=['bold_file', 'skip_vols']), name='inputnode')
outputnode = pe.Node(niu.IdentityInterface(fields=['stc_file']), name='outputnode')

LOGGER.log(25, f'BOLD series will be slice-timing corrected to an offset of {tzero:.3g}s.')
LOGGER.log(25, 'BOLD series will be slice-timing corrected to an offset of %.3gs.', tzero)

# It would be good to fingerprint memory use of afni.TShift
slice_timing_correction = pe.Node(
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ extend-select = [
# "EM",
"EXE",
"FA",
"G",
"ISC",
"ICN",
"PT",
Expand Down

0 comments on commit a7cdac8

Please sign in to comment.