10000 STY: Apply ruff/flake8-pie rules (PIE) by DimitriPapadopoulos · Pull Request #3678 · nipy/nipype · GitHub
[go: up one dir, main page]

Skip to content

STY: Apply ruff/flake8-pie rules (PIE) #3678

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 5 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
STY: Apply ruff/flake8-pie rule PIE810
PIE810 Call `endswith` once with a `tuple`
  • Loading branch information
DimitriPapadopoulos committed Oct 5, 2024
commit 56b8c9347d3e96806d50ee0a948ffb6629ad00a3
7 changes: 2 additions & 5 deletions nipype/interfaces/dcm2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,7 @@ def _parse_files(self, filenames):
# search for relevant files, and sort accordingly
for fl in search_files(filename, outtypes, self.inputs.crop):
if (
fl.endswith(".nii")
or fl.endswith(".gz")
or fl.endswith(".nrrd")
or fl.endswith(".nhdr")
fl.endswith((".nii", ".gz", ".nrrd", ".nhdr"))
):
outfiles.append(fl)
elif fl.endswith(".bval"):
Expand All @@ -484,7 +481,7 @@ def _parse_files(self, filenames):
bvecs.append(fl)
elif fl.endswith(".mvec"):
mvecs.append(fl)
elif fl.endswith(".json") or fl.endswith(".txt"):
elif fl.endswith((".json", ".txt")):
bids.append(fl)

# in siemens mosaic conversion nipype misread dcm2niix output and generate a duplicate list of results
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/freesurfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,7 @@ def _format_arg(self, name, spec, value):
suffix = basename.split(".")[1]
return spec.argstr % suffix
elif name == "in_orig":
if value.endswith("lh.orig") or value.endswith("rh.orig"):
if value.endswith(("lh.orig", "rh.orig")):
# {lh,rh}.orig inputs are not specified on command line
return
else:
Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def load_json(filename):


def loadcrash(infile, *args):
if infile.endswith("pkl") or infile.endswith("pklz"):
if infile.endswith(("pkl", "pklz")):
return loadpkl(infile)
else:
raise ValueError("Only pickled crashfiles are supported")
Expand Down
0