Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 21, 2023
1 parent 9ea7fd8 commit 0b5276a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scripts/running_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def run_clustering_con(g, inputf, outputf, k, costf):
if "---" in line:
lines = True
elif lines:
k = [int(s) for s in line.split() if s.isdigit()][0]
k = next(int(s) for s in line.split() if s.isdigit())

nodes_by_color[k].append(counter)
color_by_node[counter] = k
Expand All @@ -85,7 +85,7 @@ def run_clustering_con(g, inputf, outputf, k, costf):

for n in range(len(list(g.nodes))):
if len(list(g.neighbors(n))) == 1:
g.nodes[n]["c"] = g.nodes[list(g.neighbors(n))[0]]["c"]
g.nodes[n]["c"] = g.nodes[next(iter(g.neighbors(n)))]["c"]

new_col_by_node = []
for i in g.nodes(data=True):
Expand Down Expand Up @@ -166,7 +166,7 @@ def run_clustering_all(g, inputf, outputf, k, costf):
if "---" in line:
lines = True
elif lines:
k = [int(s) for s in line.split() if s.isdigit()][0]
k = next(int(s) for s in line.split() if s.isdigit())

nodes_by_color[k].append(counter)
color_by_node[counter] = k
Expand All @@ -180,7 +180,7 @@ def run_clustering_all(g, inputf, outputf, k, costf):
# We don't need to fix terminal edges anymore, but we know it's a split qubit in that case, better not messing up
for n in range(len(list(g.nodes))):
if len(list(g.neighbors(n))) == 1:
g.nodes[n]["c"] = g.nodes[list(g.neighbors(n))[0]]["c"]
g.nodes[n]["c"] = g.nodes[next(iter(g.neighbors(n)))]["c"]

new_col_by_node = []
for i in g.nodes(data=True):
Expand Down

0 comments on commit 0b5276a

Please sign in to comment.