diff --git a/dev/dev_malik/fast_jones_patch.py b/dev/dev_malik/fast_jones_patch.py index fb1d5a8..7bf69d6 100644 --- a/dev/dev_malik/fast_jones_patch.py +++ b/dev/dev_malik/fast_jones_patch.py @@ -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) ] diff --git a/dev/orthogonal/orthogonal.py b/dev/orthogonal/orthogonal.py index 202b9c8..01e6052 100644 --- a/dev/orthogonal/orthogonal.py +++ b/dev/orthogonal/orthogonal.py @@ -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() diff --git a/spherogram_src/links/links_base.py b/spherogram_src/links/links_base.py index 9fe9339..b439d39 100644 --- a/spherogram_src/links/links_base.py +++ b/spherogram_src/links/links_base.py @@ -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( @@ -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): @@ -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] diff --git a/spherogram_src/links/orthogonal.py b/spherogram_src/links/orthogonal.py index 6dcb880..943bb4a 100644 --- a/spherogram_src/links/orthogonal.py +++ b/spherogram_src/links/orthogonal.py @@ -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() diff --git a/spherogram_src/links/simplify.py b/spherogram_src/links/simplify.py index f1da16c..6e3f800 100644 --- a/spherogram_src/links/simplify.py +++ b/spherogram_src/links/simplify.py @@ -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') diff --git a/spherogram_src/links/twist.py b/spherogram_src/links/twist.py index 1504415..f02cdda 100644 --- a/spherogram_src/links/twist.py +++ b/spherogram_src/links/twist.py @@ -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) @@ -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):