Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 src/sage/algebras/fusion_rings/f_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ def _fix_gauge(self, algorithm=""):
adding equation... fx18 - 1
adding equation... fx21 - 1
"""
while not all(v for v in self._solved):
while not all(self._solved):
# Get a variable that has not been fixed
# In ascending index order, for consistent results
for i, var in enumerate(self._poly_ring.gens()):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def T(self, n=1):
a, m = self.index()
coef = self._monomial_coefficients[(a, m)]
if (a, m + n) in p._indices:
return coef * prod(j for j in range(m + 1, m + n + 1))\
return coef * prod(range(m + 1, m + n + 1))\
* p.monomial((a, m + n))
else:
return p.zero()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __bool__(self) -> bool:
sage: [bool(m) for m in M.additive_semigroup_generators()]
[True, True, True, True]
"""
return any(x for x in self.value.values())
return any(self.value.values())


Example = FreeCommutativeAdditiveMonoid
2 changes: 1 addition & 1 deletion src/sage/categories/group_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def central_form(self):
the coercion system (see :trac:`28544`)::

sage: QG = GroupAlgebras(QQ).example(PermutationGroup([[(1,2,3),(4,5)],[(3,4)]]))
sage: s = sum(i for i in QG.basis())
sage: s = sum(QG.basis())
sage: s.central_form() # not tested
B[()] + B[(4,5)] + B[(3,4,5)] + B[(2,3)(4,5)] + B[(2,3,4,5)] + B[(1,2)(3,4,5)] + B[(1,2,3,4,5)]

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/monoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def is_central(self):
False
sage: A = GroupAlgebras(QQ).example(); A
Algebra of Dihedral group of order 8 as a permutation group over Rational Field
sage: sum(i for i in A.basis()).is_central()
sage: sum(A.basis()).is_central()
True
"""
return all(i * self == self * i
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/crystals/generalized_young_walls.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ def weight(self, root_lattice=False):
for i in r:
W.append(-1*alpha[i])
if not root_lattice:
return E(sum(w for w in W))
return L(sum(w for w in W))
return E(sum(W))
return L(sum(W))

def epsilon(self, i):
r"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/crystals/littelmann_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ def e(self, i, power=1, length_only=False):
return ret
WLR = self.parent().weight_lattice_realization()
value = list(ret.value)
endpoint = sum(p for p in value)
endpoint = sum(value)
rho = WLR.rho()
h = WLR.simple_coroots()

Expand Down Expand Up @@ -1385,7 +1385,7 @@ def f(self, i, power=1, length_only=False):
ret = dual_path.dualize()
WLR = self.parent().weight_lattice_realization()
value = list(ret.value)
endpoint = sum(p for p in value)
endpoint = sum(value)
rho = WLR.rho()
h = WLR.simple_coroots()

Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/derangements.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def cardinality(self):
sL = set(self._set)
A = [self._set.count(i) for i in sL]
R = PolynomialRing(QQ, 'x', len(A))
S = sum(i for i in R.gens())
S = sum(R.gens())
e = prod((S - x)**y for (x, y) in zip(R.gens(), A))
return Integer(e.coefficient(dict([(x, y) for (x, y) in zip(R.gens(), A)])))
return self._count_der(len(self._set))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/incidence_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ def coloring(self, k=None, solver=None, verbose=0,
raise RuntimeError("No coloring can be defined "
"when there is a set of size 1")
elif k == 1:
if any(x for x in self._blocks):
if any(self._blocks):
raise ValueError("This hypergraph contains a set. "
"It is not 1-chromatic")
return [self.ground_set()]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/parallelogram_polyomino.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,7 @@ def area(self):
sage: pp.area()
0
"""
return sum(h for h in self.heights())
return sum(self.heights())

def _repr_(self) -> str:
r"""
Expand Down
6 changes: 3 additions & 3 deletions src/sage/combinat/plane_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def number_of_boxes(self) -> Integer:
sage: PP.number_of_boxes()
6
"""
return sum(sum(k for k in row) for row in self)
return sum(sum(row) for row in self)

def _repr_diagram(self, show_box=False, use_unicode=False) -> str:
r"""
Expand Down Expand Up @@ -451,8 +451,8 @@ def add_leftside(i, j, k):
return u"βˆ…" if use_unicode else ""

if use_unicode:
return u'\n'.join(u"".join(s for s in row) for row in drawing)
return '\n'.join("".join(s for s in row) for row in drawing)
return u'\n'.join(u"".join(row) for row in drawing)
return '\n'.join("".join(row) for row in drawing)

def _ascii_art_(self):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/posets/poset_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ def tableaux_is_less_than(a, b):
return all(ix <= iy for x, y in zip(a, b) for ix, iy in zip(x, y))

if f is None:
f = sum(i for i in s)
f = sum(s)
E = SemistandardTableaux(s, max_entry=f)
return LatticePoset((E, tableaux_is_less_than))

Expand Down
10 changes: 5 additions & 5 deletions src/sage/combinat/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -4763,12 +4763,12 @@ def standard_descents(self):
[]
"""
descents = []
#whatpart gives the number for which self is a partition
whatpart = sum(i for i in self.shape())
#now find the descents
# whatpart gives the number for which self is a partition
whatpart = sum(self.shape())
# now find the descents
for i in range(1, whatpart):
#find out what row i and i+1 are in (we're using the
#standardness of self here)
# find out what row i and i+1 are in (we're using the
# standardness of self here)
for row in self:
if row.count(i + 1):
break
Expand Down
2 changes: 1 addition & 1 deletion src/sage/databases/findstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4187,7 +4187,7 @@ def __hash__(self):
EXAMPLES::

sage: from sage.databases.findstat import FindStatCollections
sage: set(c for c in FindStatCollections()) # optional -- internet
sage: set(FindStatCollections()) # optional -- internet
{Cc0001: Permutations,
Cc0002: Integer partitions,
...
Expand Down
2 changes: 1 addition & 1 deletion src/sage/functions/piecewise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ def _giac_init_(self, parameters, variable):
args = [(domain._giac_condition_(variable),
func._giac_init_())
for domain, func in parameters]
args = ",".join(a for a in flatten(args))
args = ",".join(flatten(args))
return f"piecewise({args})"


Expand Down
2 changes: 1 addition & 1 deletion src/sage/games/sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def to_latex(self):
nsquare = n*n
array = []
array.append('\\begin{array}{|*{%s}{*{%s}{r}|}}\\hline\n' % (n, n))
gen = (x for x in self.puzzle)
gen = iter(self.puzzle)
for row in range(nsquare):
for col in range(nsquare):
entry = next(gen)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/hyperplane_arrangement/arrangement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,9 +1833,9 @@ def regions(self):
sage: from itertools import product
sage: def zero_one(d):
....: for x in product([0,1], repeat=d):
....: if any(y for y in x):
....: if any(x):
....: yield [0] + list(x)
....:

sage: K.<x,y> = HyperplaneArrangements(QQ)
sage: A = K(*zero_one(2))
sage: len(A.regions())
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def combinatorial_face_to_polyhedral_face(polyhedron, combinatorial_face):
elif polyhedron.backend() in ('normaliz', 'cdd', 'field', 'number_field', 'polymake'):
# Equations after the inequalities in Hrep.
n_ieqs = polyhedron.n_inequalities()
H_indices = tuple(x for x in combinatorial_face.ambient_H_indices(add_equations=False))
H_indices = tuple(combinatorial_face.ambient_H_indices(add_equations=False))
H_indices += tuple(range(n_ieqs, n_ieqs + n_equations))
else:
raise NotImplementedError("unknown backend")
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/polyhedron/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def gale_transform_to_primal(vectors, base_ring=None, backend=None):
ker = Matrix(base_ring, vectors).left_kernel()
else:
ker = Matrix(vectors).left_kernel()
solutions = Polyhedron(lines=tuple(y for y in ker.basis_matrix()), base_ring=base_ring, backend=backend)
solutions = Polyhedron(lines=tuple(ker.basis_matrix()), base_ring=base_ring, backend=backend)

from sage.matrix.special import identity_matrix
pos_orthant = Polyhedron(rays=identity_matrix(len(vectors)), base_ring=base_ring, backend=backend)
Expand Down Expand Up @@ -2015,7 +2015,7 @@ def twenty_four_cell(self, backend=None):
q12 = QQ((1, 2))
verts = list(itertools.product([q12, -q12], repeat=4))
B4 = (ZZ**4).basis()
verts.extend(v for v in B4)
verts.extend(B4)
verts.extend(-v for v in B4)
return Polyhedron(vertices=verts, backend=backend)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/examples/euclidean.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def __classcall_private__(cls, n=None, name=None, latex_name=None,
if names[1] in ['p', 'ph', 'phi']:
names[1] = names[1] + ':\\phi'

symbols = ' '.join(x for x in names)
symbols = ' '.join(names)

# Technical bit for UniqueRepresentation
from sage.misc.prandom import getrandbits
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def _repr_(self):
for i in diffargs)

res = "d" + str(numargs) + "(" + str(funcname) + ")/d" + "d".join(
[i for i in occ.values()])
occ.values())

# str representation of the operator
s = self._parent._repr_element_(m[0])
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modules/fp_graded/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def connectivity(self):
# We must check that the generator(s) in the free generator module are
# not hit by relations, since we are not guaranteed that the
# presentation we have is minimal.
X = sorted(x for x in self.generator_degrees())
X = sorted(self.generator_degrees())

previous = None
for k in X:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ def asymptotics_smooth(self, p, alpha, N, asy_var, coordinate=None,
Uderivs = diff_prod(Hderivs, U, Hcheck, X,
range(1, k + 1), end, Uderivs, atP)
# Check for a nonzero U derivative.
if any(u for u in Uderivs.values()):
if any(Uderivs.values()):
all_zero = False
if all_zero:
# Then, using a proposition at the end of [RW2012], we can
Expand Down Expand Up @@ -2265,7 +2265,7 @@ def asymptotics_multiple(self, p, alpha, N, asy_var, coordinate=None,
Uderivs = diff_prod(Hprodderivs, U, Hcheck, X,
range(1, k + 1), end, Uderivs, atP)
# Check for a nonzero U derivative.
if any(u for u in Uderivs.values()):
if any(Uderivs.values()):
all_zero = False
if all_zero:
# Then all higher derivatives of U are zero.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ def __bool__(self):
if any(cache[a] for a in cache):
return True
else:
if any(a for a in self._coeff_stream._cache):
if any(self._coeff_stream._cache):
return True

v = self._coeff_stream._approximate_order
Expand Down
3 changes: 1 addition & 2 deletions src/sage/rings/lazy_series_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No
sage: def g(i):
....: if i < 0:
....: return 1
....: else:
....: return 1 + sum(k for k in range(i+1))
....: return 1 + sum(range(i + 1))
sage: e = L(g, valuation=-5); e
z^-5 + z^-4 + z^-3 + z^-2 + z^-1 + 1 + 2*z + O(z^2)
sage: f = e^-1; f
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/polydict.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ cdef class PolyDict:
return True
if len(self.__repn) > 1:
return False
return not any(e for e in self.__repn)
return not any(self.__repn)

def homogenize(self, size_t var):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def is_HCP(f, check_monic_irreducible=True):
sage: H = hilbert_class_polynomial(D)
sage: H.degree()
100
sage: max(c for c in H).ndigits()
sage: max(H).ndigits()
2774
sage: is_HCP(H)
-1856563
Expand Down
2 changes: 1 addition & 1 deletion src/sage/sets/totally_ordered_finite_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __classcall__(cls, iterable, facade=True):

sage: S1 = TotallyOrderedFiniteSet([1, 2, 3])
sage: S2 = TotallyOrderedFiniteSet((1, 2, 3))
sage: S3 = TotallyOrderedFiniteSet((x for x in range(1,4)))
sage: S3 = TotallyOrderedFiniteSet(range(1,4))
sage: S1 is S2
True
sage: S2 is S3
Expand Down