Skip to content
Open
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
2 changes: 1 addition & 1 deletion dev/dev_malik/fast_jones_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def condense_term(monomial, poly, A, B, R, gd):
matching_label = label
break
if found_matching_pair:
matched_indices = [i for (i, pair) in enumerate(var_labels) if matching_label in pair]
matched_indices = [i for i, pair in enumerate(var_labels) if matching_label in pair]
p1, p2 = var_labels[matched_indices[0]], var_labels[matched_indices[1]]
v1, v2 = variables[matched_indices[0]], variables[matched_indices[1]]
l1 = p1[ 1 - p1.index(matching_label) ]
Expand Down
4 changes: 2 additions & 2 deletions dev/orthogonal/orthogonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ class OrthogonalRep(Digraph):
"""
def __init__(self, horizonal_pairs=[], vertical_pairs=[]):
Digraph.__init__(self)
for (a,b) in horizonal_pairs:
for a, b in horizonal_pairs:
self.add_edge(a, b, 'horizontal')
for (a,b) in vertical_pairs:
for a, b in vertical_pairs:
self.add_edge(a, b, 'vertical')

self._build_faces()
Expand Down
6 changes: 3 additions & 3 deletions spherogram_src/links/links_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def _crossings_from_PD_code(self, code):
else:
gluings[x] = [(c, i)]

if {len(v) for v in gluings.values()} != {2}:
if any(len(v) != 2 for v in gluings.values()):
raise ValueError("PD code isn't consistent")

component_starts = self._component_starts_from_PD(
Expand All @@ -602,7 +602,7 @@ def _crossings_from_PD_code(self, code):
crossings[c][i] = crossings[d][j]

component_starts = [crossings[c].crossing_strands()[i]
for (c, i) in component_starts]
for c, i in component_starts]
return crossings, component_starts

def _component_starts_from_PD(self, code, labels, gluings):
Expand Down Expand Up @@ -755,7 +755,7 @@ def _check_crossing_orientations(self):
assert C.directions == {(0, 2), (1, 3)}
else:
assert False
for (a, b) in C.directions:
for a, b in C.directions:
D, d = C.adjacent[b]
assert d in {x for x, y in D.directions}
D, d = C.adjacent[a]
Expand Down
4 changes: 2 additions & 2 deletions spherogram_src/links/orthogonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ class OrthogonalRep(Digraph):

def __init__(self, horizonal_pairs=[], vertical_pairs=[]):
Digraph.__init__(self)
for (a, b) in horizonal_pairs:
for a, b in horizonal_pairs:
self.add_edge(a, b, 'horizontal')
for (a, b) in vertical_pairs:
for a, b in vertical_pairs:
self.add_edge(a, b, 'vertical')

self._build_faces()
Expand Down
2 changes: 1 addition & 1 deletion spherogram_src/links/simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def pickup_strand(link, dual_graph, kind, strand):
dest = edges_crossed[-1][0]

nx.set_edge_attributes(G, 1, 'weight')
for (f0, f1) in edges_crossed:
for f0, f1 in edges_crossed:
G[f0][f1]['weight'] = 0

path = nx.shortest_path(G, source, dest, weight='weight')
Expand Down
4 changes: 2 additions & 2 deletions spherogram_src/links/twist.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, crossing):
self.cs = crossing
else:
assert is_end_of_twist_region(crossing)
neighbors = CyclicList(C for (C, i) in crossing.adjacent)
neighbors = CyclicList(C for C, i in crossing.adjacent)
for i in range(4):
if neighbors[i] == neighbors[i + 1]:
self.cs = CrossingStrand(crossing, i)
Expand Down Expand Up @@ -69,7 +69,7 @@ def __len__(self):


def is_end_of_twist_region(crossing) -> bool:
return len({C for (C, i) in crossing.adjacent}) == 3
return len({C for C, i in crossing.adjacent}) == 3


def make_twist_regions_consistent(link):
Expand Down
Loading