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
12 changes: 7 additions & 5 deletions src/sage/combinat/crystals/tensor_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,9 @@ def __classcall_private__(cls, cartan_type, shapes=None, shape=None):
raise ValueError("shapes should all be partitions")
S = CrystalOfSpins(cartan_type)
B = CrystalOfTableaux(cartan_type, shapes=shapes)
T = TensorProductOfCrystals(S, B, generators=[[S.module_generators[0],x] for x in B.module_generators])
T.rename("The crystal of tableaux of type %s and shape(s) %s" % (cartan_type, list(list(shape) for shape in spin_shapes)))
T = TensorProductOfCrystals(S, B, generators=[[S.module_generators[0], x] for x in B.module_generators])
T.rename("The crystal of tableaux of type %s and shape(s) %s" %
(cartan_type, [list(shape) for shape in spin_shapes]))
T.shapes = spin_shapes
return T

Expand All @@ -987,13 +988,14 @@ def __init__(self, cartan_type, shapes):
sage: T = crystals.Tableaux(['A',3], shape = [2,2])
sage: TestSuite(T).run()
"""
# super().__init__(category = FiniteEnumeratedSets())
# super().__init__(category = FiniteEnumeratedSets())
Parent.__init__(self, category=ClassicalCrystals())
self.letters = CrystalOfLetters(cartan_type)
self.shapes = shapes
self.module_generators = tuple(self.module_generator(la) for la in shapes)
self.module_generators = tuple(self.module_generator(la)
for la in shapes)
self.rename("The crystal of tableaux of type %s and shape(s) %s"
% (cartan_type, list(list(shape) for shape in shapes)))
% (cartan_type, [list(shape) for shape in shapes]))

def cartan_type(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/recognizable_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1842,8 +1842,8 @@ def _an_element_(self):
z = self.coefficient_ring().zero()
o = self.coefficient_ring().one()
e = self.coefficient_ring().an_element()
return self(list(Matrix([[o, z], [i * o, o]])
for i, _ in enumerate(self.alphabet())),
return self([Matrix([[o, z], [i * o, o]])
for i, _ in enumerate(self.alphabet())],
vector([z, e]), right=vector([e, z]))

def some_elements(self, **kwds):
Expand Down
8 changes: 4 additions & 4 deletions src/sage/combinat/regular_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,10 +1100,10 @@
Z = zero_matrix(C[0].dimensions()[0])

def blocks(r):
upper = list([C[s], D[s], Z]
for s in reversed(srange(max(0, r-2), r+1)))
lower = list([Z, C[s], D[s]]
for s in reversed(srange(k-3+len(upper), k)))
upper = [[C[s], D[s], Z]
for s in reversed(srange(max(0, r-2), r+1))]
lower = [[Z, C[s], D[s]]
for s in reversed(srange(k-3+len(upper), k))]
return upper + lower

return {r: Matrix.block(blocks(r)) for r in P.alphabet()}
Expand Down Expand Up @@ -1484,7 +1484,7 @@

sage: from itertools import islice
sage: Seq2 = RegularSequenceRing(2, ZZ)
sage: TestSuite(Seq2).run( # long time

Check warning on line 1487 in src/sage/combinat/regular_sequence.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Warning: slow doctest:

slow doctest:: Test ran for 108.39s cpu, 108.52s wall Check ran for 0.00s cpu, 0.00s wall
....: elements=tuple(islice(Seq2.some_elements(), 4)))

.. SEEALSO::
Expand Down
11 changes: 5 additions & 6 deletions src/sage/combinat/regular_sequence_bounded.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,11 @@ def make_positive(matrices) -> list:
def do(mat):
if is_non_negative(mat):
return mat
elif is_non_negative(-mat):
if is_non_negative(-mat):
return -mat
else:
raise ValueError('There is a matrix which is neither non-negative nor non-positive.')
raise ValueError('There is a matrix which is neither non-negative nor non-positive.')

return list(do(mat) for mat in matrices)
return [do(mat) for mat in matrices]


def regular_sequence_is_bounded(S):
Expand Down Expand Up @@ -521,8 +520,8 @@ def regular_sequence_is_bounded(S):
if not has_bounded_matrix_powers(matrices):
return False

matricesProd = list(ell * em for ell in matrices for em in matrices
if ell != em)
matricesProd = [ell * em for ell in matrices for em in matrices
if ell != em]
if not has_bounded_matrix_powers(matricesProd):
return False

Expand Down
3 changes: 1 addition & 2 deletions src/sage/combinat/skew_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ def __eq__(self, other):
"""
if isinstance(other, (Tableau, SkewTableau)):
return list(self) == list(other)
else:
return list(self) == other or list(list(row) for row in self) == other
return list(self) == other or [list(row) for row in self] == other

def __ne__(self, other):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,6 @@ def sage_data_paths(name: str = '') -> set[str]:
for path in site_data_dir("sagemath", multipath=True).split(os.pathsep) + site_data_dir(multipath=True).split(os.pathsep):
paths.add(path)
else:
paths = {path for path in SAGE_DATA_PATH.split(os.pathsep)}
paths = set(SAGE_DATA_PATH.split(os.pathsep))

return {os.path.join(path, name) for path in paths if os.path.exists(path)}
4 changes: 2 additions & 2 deletions src/sage/geometry/polyhedron/base5.py
Original file line number Diff line number Diff line change
Expand Up @@ -1907,11 +1907,11 @@ def linear_transformation(self, linear_transf,
new_lines = ()

if self.is_compact() and self.n_vertices() and self.n_inequalities():
homogeneous_basis = matrix(R, ( [1] + list(v) for v in self.an_affine_basis() )).transpose()
homogeneous_basis = matrix(R, ([1] + list(v) for v in self.an_affine_basis())).transpose()

# To convert first to a list and then to a matrix seems to be necessary to obtain a meaningful error,
# in case the number of columns doesn't match the dimension.
new_homogeneous_basis = matrix(list( [1] + list(linear_transf*vector(R, v)) for v in self.an_affine_basis()) ).transpose()
new_homogeneous_basis = matrix([[1] + list(linear_transf*vector(R, v)) for v in self.an_affine_basis()]).transpose()

if self.dim() + 1 == new_homogeneous_basis.rank():
# The transformation is injective on the polytope.
Expand Down
10 changes: 5 additions & 5 deletions src/sage/geometry/polyhedron/generating_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def key(t):
return (-sum(abs(d) for d in D), D)
terms = sorted(terms, key=key, reverse=True)
return Factorization([(numerator, 1)] +
list((1-t, -1) for t in terms),
[(1 - t, -1) for t in terms],
sort=Factorization_sort,
simplify=Factorization_simplify)

Expand Down Expand Up @@ -1178,8 +1178,8 @@ def _transform_(self):
inequalities_extra.append(tuple(coeffs))
T = matrix(ZZ, dim, dim, D)

self.inequalities = (list(tuple(T*vector(ieq))
for ieq in inequalities_filtered)
self.inequalities = ([tuple(T * vector(ieq))
for ieq in inequalities_filtered]
+ inequalities_extra)

rules_pre = ((y, B({tuple(row[1:]): 1}))
Expand Down Expand Up @@ -1465,8 +1465,8 @@ def _transform_(self):
self.factor = next(rules_pre)[1]
self.rules = dict(rules_pre)

self.inequalities = list(tuple(vector(e)*T) for e in self.inequalities)
self.equations = list(tuple(vector(e)*T) for e in self.equations)
self.inequalities = [tuple(vector(e) * T) for e in self.inequalities]
self.equations = [tuple(vector(e) * T) for e in self.equations]

@staticmethod
def generate_mods(equations):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/toric_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,9 @@ def label_list(label, n, math_mode, index_set=None):
index_set = range(n)
if math_mode:
label = label.strip("$")
return list("$%s_{%d}$" % (label, i) for i in index_set)
return ["$%s_{%d}$" % (label, i) for i in index_set]
else:
return list("%s_%d" % (label, i) for i in index_set)
return ["%s_%d" % (label, i) for i in index_set]


def options(option=None, **kwds):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/generators/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -3131,7 +3131,7 @@ def next_step(triangle_list):
resu += [(a, ab, ac), (ab, b, bc), (ac, bc, c)]
return resu

tri_list = [list(vector(QQ, u) for u in [(0, 0), (0, 1), (1, 0)])]
tri_list = [[vector(QQ, u) for u in [(0, 0), (0, 1), (1, 0)]]]
for k in range(n - 1):
tri_list = next_step(tri_list)
dg = Graph()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/generators/generators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_shortened_000_111_extended_binary_Golay_code_graph():
from sage.coding import codes_catalog
from sage.coding.linear_code import LinearCode
from sage.graphs.generators.distance_regular import (
shortened_000_111_extended_binary_Golay_code_graph
shortened_000_111_extended_binary_Golay_code_graph
)
from sage.matrix.constructor import matrix
from sage.rings.finite_rings.finite_field_constructor import FiniteField
Expand All @@ -23,7 +23,7 @@ def test_shortened_000_111_extended_binary_Golay_code_graph():
v = C_basis[0] + C_basis[1] + C_basis[2] # v has 111 at the start
C_basis = C_basis[3:]
C_basis.append(v)
C_basis = list(map(lambda x: x[3:], C_basis))
C_basis = [x[3:] for x in C_basis]

code = LinearCode(matrix(FiniteField(2), C_basis))
G = code.cosetGraph()
Expand Down
3 changes: 2 additions & 1 deletion src/sage/interfaces/maxima_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@ def sr_to_max(expr):
elif (op in special_sage_to_max):
return EclObject(special_sage_to_max[op](*[sr_to_max(o) for o in expr.operands()]))
elif op == tuple:
return EclObject(([mlist], list(sr_to_max(op) for op in expr.operands())))
return EclObject(([mlist],
[sr_to_max(op) for op in expr.operands()]))
elif op not in sage_op_dict:
# Maxima does some simplifications automatically by default
# so calling maxima(expr) can change the structure of expr
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/regina.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _start(self):
for e in AlgorithmExt:
d[e.name] = e
# set up the globals
D = {k: v for k, v in d.items()}
D = dict(d)
D[self._namespace.__name__] = self._namespace
D[self.name()] = regina
self._regina_globals = D
Expand Down
2 changes: 1 addition & 1 deletion src/sage/knots/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ def _khovanov_homology_cached(self, height, implementation, ring=ZZ, **kwds):
if not data:
return [(0, HomologyGroup(0, ring))]

torsion = set([k[1] for k in data])
torsion = {k[1] for k in data}
invfac = {}
for d in [k[0] for k in data]:
invfac[d] = []
Expand Down
Loading