Skip to content

Commit 4b88c39

Browse files
STY: Apply ruff/flake8-simplify rule SIM113
SIM113 Use `enumerate()` for index variable in `for` loop
1 parent 01c3e76 commit 4b88c39

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

nipype/pipeline/engine/utils.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1709,13 +1709,11 @@ def topological_sort(graph, depth_first=False):
17091709
logger.debug("Performing depth first search")
17101710
nodes = []
17111711
groups = []
1712-
group = 0
17131712
G = nx.Graph()
17141713
G.add_nodes_from(graph.nodes())
17151714
G.add_edges_from(graph.edges())
17161715
components = nx.connected_components(G)
1717-
for desc in components:
1718-
group += 1
1716+
for group, desc in enumerate(components, start=1):
17191717
indices = [nodesort.index(node) for node in desc]
17201718
nodes.extend(
17211719
np.array(nodesort)[np.array(indices)[np.argsort(indices)]].tolist()

0 commit comments

Comments
 (0)