Merged
Show file tree
Hide file tree
Changes from 1 commit
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Next Next commit
STY: Apply ruff rule RUF017
RUF017 Avoid quadratic list summation
  • Loading branch information
@DimitriPapadopoulos
DimitriPapadopoulos committedOct 6, 2024
commit e01173d113ed0fa296c000283e5e1b10873000c5
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,7 @@ def get_nipype_gitversion():


def _list_union(iterable):
return list(set(sum(iterable, [])))
return list(set(x for sublist in iterable for x in sublist))


# Enable a handle to install all extra dependencies at once
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -483,7 +483,9 @@ class ExtractROI(FSLCommand):

def _format_arg(self, name, spec, value):
if name == "crop_list":
return " ".join(map(str, sum(list(map(list, value)), [])))
return " ".join(
map(str, (x for sublist in map(list, value) for x in sublist))
)
return super()._format_arg(name, spec, value)

def _list_outputs(self):
Expand Down