Skip to content

Commit

Permalink
Merge pull request #914 from DimitriPapadopoulos/PIE
Browse files Browse the repository at this point in the history
STY: Apply ruff/flake8-pie rules (PIE)
  • Loading branch information
effigies authored Dec 22, 2024
2 parents d6d726e + 03cb3ed commit 565e021
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion niworkflows/interfaces/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def _check_and_expand_derivative(expr, variables, data):
6th only."""
if re.search(r'^dd[0-9]+', expr):
order = re.compile(r'^dd([0-9]+)').findall(expr)
order = range(0, int(*order) + 1)
order = range(int(*order) + 1)
(variables, data) = temporal_derivatives(order, variables, data)
elif re.search(r'^d[0-9]+[\-]?[0-9]*', expr):
order = re.compile(r'^d([0-9]+[\-]?[0-9]*)').findall(expr)
Expand Down
2 changes: 1 addition & 1 deletion niworkflows/interfaces/tests/test_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def test_DerivativesDataSink_build_path(
for out, exp in zip(output, expectation):
assert Path(out).relative_to(base_directory) == Path(base) / exp
# Regression - some images were given nan scale factors
if out.endswith('.nii') or out.endswith('.nii.gz'):
if out.endswith(('.nii', '.nii.gz')):
img = nb.load(out)
if isinstance(img, nb.Nifti1Image):
with nb.openers.ImageOpener(out) as fobj:
Expand Down
4 changes: 2 additions & 2 deletions niworkflows/viz/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def spikesplot(
# Handle X axis
last = ntsteps - 1
ax.set_xlim(0, last)
xticks = list(range(0, last)[::20]) + [last] if not hide_x else []
xticks = list(range(last)[::20]) + [last] if not hide_x else []
ax.set_xticks(xticks)

if not hide_x:
Expand Down Expand Up @@ -564,7 +564,7 @@ def confoundplot(

# Set 10 frame markers in X axis
interval = max((ntsteps // 10, ntsteps // 5, 1))
xticks = list(range(0, ntsteps)[::interval])
xticks = list(range(ntsteps)[::interval])
ax_ts.set_xticks(xticks)

if not hide_x:
Expand Down

0 comments on commit 565e021

Please sign in to comment.