Skip to content
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

STY: Apply ruff/flake8-comprehensions preview rules (C4) #3686

Merged
merged 1 commit into from
Oct 6, 2024
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 to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nipype/interfaces/freesurfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def _run_interface(self, runtime):
stem = self.inputs.screenshot_stem
stem_args = self.inputs.stem_template_args
if isdefined(stem_args):
args = tuple([getattr(self.inputs, arg) for arg in stem_args])
args = tuple(getattr(self.inputs, arg) for arg in stem_args)
stem = stem % args
# Check if the DISPLAY variable is set -- should avoid crashes (might not?)
if "DISPLAY" not in os.environ:
Expand Down Expand Up @@ -1094,7 +1094,7 @@ def _list_outputs(self):
stem = self.inputs.screenshot_stem
stem_args = self.inputs.stem_template_args
if isdefined(stem_args):
args = tuple([getattr(self.inputs, arg) for arg in stem_args])
args = tuple(getattr(self.inputs, arg) for arg in stem_args)
stem = stem % args
snapshots = ["%s-lat.tif", "%s-med.tif", "%s-dor.tif", "%s-ven.tif"]
if self.inputs.six_images:
Expand Down Expand Up @@ -1156,7 +1156,7 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
vox = tuple(vox.split(", "))
outputs.vox_sizes = vox
dim = self.info_regexp(info, "dimensions")
dim = tuple([int(d) for d in dim.split(" x ")])
dim = tuple(int(d) for d in dim.split(" x "))
outputs.dimensions = dim

outputs.orientation = self.info_regexp(info, "Orientation")
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/utility/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _get_outfields(self):
if self.inputs.header:
self._outfields = tuple(entry)
else:
self._outfields = tuple(["column_" + str(x) for x in range(len(entry))])
self._outfields = tuple("column_" + str(x) for x in range(len(entry)))
return self._outfields

def _run_interface(self, runtime):
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def export(
][0]
functions[args[1]] = funcname
args[1] = funcname
args = tuple([arg for arg in args if arg])
args = tuple(arg for arg in args if arg)
line_args = (
u.fullname.replace(".", "_"),
args,
Expand Down