From 32799a62b7e7d9dcc54bcd46f22e67b2d9bf6096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 6 Mar 2024 08:17:31 +0100 Subject: [PATCH] fix suggested details --- .../cluster_algebra_quiver/mutation_type.py | 14 +++++++------- src/sage/combinat/plane_partition.py | 8 +++++--- src/sage/combinat/tableau.py | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py index 5578e751b5d..ef8aaab5e54 100644 --- a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py +++ b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py @@ -149,7 +149,7 @@ def _triangles(dg): return trians -def _all_induced_cycles_iter( dg ): +def _all_induced_cycles_iter(dg): """ Return an iterator for all induced oriented cycles of length greater than or equal to 4 in the digraph ``dg``. @@ -356,9 +356,9 @@ def _connected_mutation_type(dg): for edge in edges: label = edge[2] if label not in [(1,-1),(2,-2),(1,-2),(2,-1),(4,-1),(1,-4)]: - # _false_return(i) is a simple function that simply returns 'unknown'. For debugging purposes, it - # can also output 'DEBUG: error i' if desired. - # this command is used many times in this code, something times without the argument i. + # _false_return(i) is a simple function that simply returns 'unknown'. For debugging purposes, it + # can also output 'DEBUG: error i' if desired. + # this command is used many times in this code, something times without the argument i. return _false_return(2) elif label == (2,-2): dg.set_edge_label( edge[0], edge[1], 1 ) @@ -1032,7 +1032,7 @@ def _connected_mutation_type_AAtildeD(dg, ret_conn_vert=False): test_triangles = [[tuple(trian) for trian in oriented_trians if edge in trian] for edge in multiple_trian_edges] - unique_triangle = set(test_triangles[0]).intersection( *test_triangles[1:] ) + unique_triangle = set.intersection(*map(set, test_triangles)) if len(unique_triangle) != 1: return _false_return(19) else: @@ -1299,7 +1299,7 @@ def load_data(n, user=True): return data -def _mutation_type_from_data( n, dig6, compute_if_necessary=True ): +def _mutation_type_from_data(n, dig6, compute_if_necessary=True): r""" Return the mutation type from the given dig6 data by looking into the precomputed mutation types @@ -1506,7 +1506,7 @@ def _random_tests(mt, k, mut_class=None, nr_mut=5): dg = dg_new -def _random_multi_tests( n, k, nr_mut=5 ): +def _random_multi_tests(n, k, nr_mut=5): """ Provide multiple random tests to find bugs in the mutation type methods. diff --git a/src/sage/combinat/plane_partition.py b/src/sage/combinat/plane_partition.py index bc523121623..8f4ded21d16 100644 --- a/src/sage/combinat/plane_partition.py +++ b/src/sage/combinat/plane_partition.py @@ -314,17 +314,19 @@ def x_tableau(self, tableau=True) -> Tableau: return Tableau(X) return X - def cells(self) -> list[list[int]]: + def cells(self) -> list[tuple[int, int, int]]: r""" Return the list of cells inside ``self``. + Each cell is a tuple. + EXAMPLES:: sage: PP = PlanePartition([[3,1],[2]]) sage: PP.cells() - [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [1, 0, 0], [1, 0, 1]] + [(0, 0, 0), (0, 0, 1), (0, 0, 2), (0, 1, 0), (1, 0, 0), (1, 0, 1)] """ - return [[r, c, h] + return [(r, c, h) for r in range(len(self)) for c in range(len(self[r])) for h in range(self[r][c])] diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 7613ef9a671..d5ebaee709c 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -2618,7 +2618,7 @@ def slide_multiply(self, other): l = len(self[0]) st = [(None,) * l + row for row in other] - st.extend(row for row in self) + st.extend(self) from sage.combinat.skew_tableau import SkewTableau return SkewTableau(st).rectify()