Skip to content

Commit a9068d9

Browse files
STY: Apply ruff/refurb rule FURB148
FURB148 `enumerate` index is unused, use `for x in y` instead
1 parent 50e5320 commit a9068d9

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

nipype/algorithms/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def remove_identical_paths(in_files):
531531
commonprefix = op.commonprefix(in_files)
532532
lastslash = commonprefix.rfind("/")
533533
commonpath = commonprefix[0 : (lastslash + 1)]
534-
for fileidx, in_file in enumerate(in_files):
534+
for in_file in in_files:
535535
path, name, ext = split_filename(in_file)
536536
in_file = op.join(path, name)
537537
name = in_file.replace(commonpath, "")

nipype/interfaces/cmtk/nx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def average_networks(in_files, ntwk_res_file, group_id):
124124
ntwk = remove_all_edges(ntwk_res_file)
125125
counting_ntwk = ntwk.copy()
126126
# Sums all the relevant variables
127-
for index, subject in enumerate(in_files):
127+
for subject in in_files:
128128
tmp = _read_pickle(subject)
129129
iflogger.info("File %s has %i edges", subject, tmp.number_of_edges())
130130
edges = list(tmp.edges())

nipype/interfaces/cmtk/tests/test_nbs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def creating_graphs(tmpdir):
1717
graphlist = []
1818
graphnames = ["name" + str(i) for i in range(6)]
19-
for idx, name in enumerate(graphnames):
19+
for idx in range(len(graphnames)):
2020
graph = np.random.rand(10, 10)
2121
G = nx.from_numpy_array(graph)
2222
out_file = tmpdir.strpath + graphnames[idx] + ".pck"

nipype/interfaces/io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ def _list_outputs(self):
975975
if self.inputs.sort_filelist:
976976
filelist = human_order_sorted(filelist)
977977
outputs[key] = simplify_list(filelist)
978-
for argnum, arglist in enumerate(args):
978+
for arglist in args:
979979
maxlen = 1
980980
for arg in arglist:
981981
if isinstance(arg, (str, bytes)) and hasattr(self.inputs, arg):
@@ -1250,7 +1250,7 @@ def _list_outputs(self):
12501250
if self.inputs.sort_filelist:
12511251
filelist = human_order_sorted(filelist)
12521252
outputs[key] = simplify_list(filelist)
1253-
for argnum, arglist in enumerate(args):
1253+
for arglist in args:
12541254
maxlen = 1
12551255
for arg in arglist:
12561256
if isinstance(arg, (str, bytes)) and hasattr(self.inputs, arg):
@@ -1995,7 +1995,7 @@ def _list_outputs(self):
19951995
if file_object.exists()
19961996
]
19971997
)
1998-
for argnum, arglist in enumerate(args):
1998+
for arglist in args:
19991999
maxlen = 1
20002000
for arg in arglist:
20012001
if isinstance(arg, (str, bytes)) and hasattr(self.inputs, arg):
@@ -2609,7 +2609,7 @@ def _list_outputs(self):
26092609
if not args:
26102610
outputs[key] = self._get_files_over_ssh(template)
26112611

2612-
for argnum, arglist in enumerate(args):
2612+
for arglist in args:
26132613
maxlen = 1
26142614
for arg in arglist:
26152615
if isinstance(arg, (str, bytes)) and hasattr(self.inputs, arg):

nipype/interfaces/nipy/preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _run_interface(self, runtime):
203203
# nipy does not encode euler angles. return in original form of
204204
# translation followed by rotation vector see:
205205
# http://en.wikipedia.org/wiki/Rodrigues'_rotation_formula
206-
for i, mo in enumerate(motion):
206+
for mo in motion:
207207
params = [
208208
"%.10f" % item for item in np.hstack((mo.translation, mo.rotation))
209209
]

nipype/pipeline/engine/workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def export(
528528
lines.append(wfdef)
529529
if include_config:
530530
lines.append(f"{self.name}.config = {self.config}")
531-
for idx, node in enumerate(nodes):
531+
for node in nodes:
532532
nodename = node.fullname.replace(".", "_")
533533
# write nodes
534534
nodelines = format_node(

nipype/pipeline/plugins/somaflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, plugin_args=None):
2424
def _submit_graph(self, pyfiles, dependencies, nodes):
2525
jobs = []
2626
soma_deps = []
27-
for idx, fname in enumerate(pyfiles):
27+
for fname in pyfiles:
2828
name = os.path.splitext(os.path.split(fname)[1])[0]
2929
jobs.append(Job(command=[sys.executable, fname], name=name))
3030
for key, values in list(dependencies.items()):

0 commit comments

Comments
 (0)