diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 604bdd90545..927db88e1ed 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,3 +1,3 @@ tarball=configure-VERSION.tar.gz -sha1=7e1e01d82e171303935202d5876e0c109d431f8b -sha256=eec0d494a20c6eff61a1ccc679cca149efd78cb191f88ade0446468b45abee00 +sha1=246264ebcb0a28d278f7bb85ffca3c7e916c0cb2 +sha256=4a7cc9cfaa8a174a5ad17da30747bc76d245d980f86b4b0eda1f75b5fb1cfd51 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 8e28acc48d1..64d8e23ccdb 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -19bd20218effcdb6b242bfb18b113ff85c6d8497 +ca2d413dcd311b14304c7adb9a270a8dfa4d6081 diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index 23848497247..1b98e358511 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -1409,7 +1409,7 @@ def __mul__(self, other): """ if isinstance(other, IdentityConstructionFunctor): return self - if isinstance(other, self.__class__): # + if isinstance(other, self.__class__): INT = set(self._gens).intersection(other._gens) if INT: # if there is overlap of generators, it must only be at the ends, so that diff --git a/src/sage/combinat/integer_vector_weighted.py b/src/sage/combinat/integer_vector_weighted.py index 9a28d632c85..f3675d83e0f 100644 --- a/src/sage/combinat/integer_vector_weighted.py +++ b/src/sage/combinat/integer_vector_weighted.py @@ -184,10 +184,10 @@ def __contains__(self, x): if len(self._weights) != len(x): return False s = 0 - for i, val in enumerate(x): - if (not isinstance(val, (int, Integer))) and (val not in ZZ): + for i, xi in enumerate(x): + if not isinstance(xi, (int, Integer)) and xi not in ZZ: return False - s += x[i] * self._weights[i] + s += xi * self._weights[i] return s == self._n def _recfun(self, n, l): diff --git a/src/sage/geometry/pseudolines.py b/src/sage/geometry/pseudolines.py index cc52979b577..38283fae8f8 100644 --- a/src/sage/geometry/pseudolines.py +++ b/src/sage/geometry/pseudolines.py @@ -275,7 +275,7 @@ def __init__(self, seq, encoding="auto"): i = 0 while crossings > 0: - if (seq[i] != [] and + if (seq[i] and (seq[i][0] == 0 and seq[i+1][0] == 1)): @@ -290,7 +290,7 @@ def __init__(self, seq, encoding="auto"): seq[i].pop(0) seq[i+1].pop(0) - if i > 0 and seq[i-1] is not []: + if i > 0 and seq[i - 1]: i -= 1 else: i += 1 diff --git a/src/sage/graphs/generators/random.py b/src/sage/graphs/generators/random.py index 6faf8e2c838..767dc2a1496 100644 --- a/src/sage/graphs/generators/random.py +++ b/src/sage/graphs/generators/random.py @@ -2355,17 +2355,17 @@ def RandomBicubicPlanar(n, seed=None): Z3 = Zmod(3) colour = Z3.zero() not_touched = [i for i, v in enumerate(w) if v[0] in ['x', 'xb']] - for i, v in enumerate(w): + for i, wi in enumerate(w): # internal edges - if v[0] == 'i': + if wi[0] == 'i': colour += 1 if w[i + 1][0] == 'n': - G.add_edge((w[i], w[i + 1], colour)) - elif v[0] == 'n': + G.add_edge((wi, w[i + 1], colour)) + elif wi[0] == 'n': colour += 2 - elif v[0] == 'x': + elif wi[0] == 'x': pile.append(i) - elif v[0] == 'xb' and i in not_touched: + elif wi[0] == 'xb' and i in not_touched: if pile: j = pile.pop() G.add_edge((w[i + 1], w[j - 1], colour)) diff --git a/src/sage/graphs/graph_latex.py b/src/sage/graphs/graph_latex.py index 42cc1b369ab..64f8474c465 100644 --- a/src/sage/graphs/graph_latex.py +++ b/src/sage/graphs/graph_latex.py @@ -1714,34 +1714,34 @@ def translate(p): vl_color = {} vl_placement = {} for u in vertex_list: - # + c = dvc if u in vertex_colors: c = cc.to_rgb(vertex_colors[u]) v_color[u] = c - # + c = dvfc if u in vertex_fill_colors: c = cc.to_rgb(vertex_fill_colors[u]) vf_color[u] = c - # + sh = dsh if u in vertex_shapes: sh = vertex_shapes[u] v_shape[u] = sh - # + vs = dvs if u in vertex_sizes: vs = vertex_sizes[u] v_size[u] = vs - # + if vertex_labels: - # + c = dvlc if u in vertex_label_colors: c = cc.to_rgb(vertex_label_colors[u]) vl_color[u] = c - # + vlp = dvlp if u in vertex_label_placements: vlp = vertex_label_placements[u] @@ -1766,14 +1766,14 @@ def translate(p): # We collect options for edges, default values and for-some-edges # information. These are combined into dictionaries on a per-edge # basis, for all edges - # + # Defaults - # + dec = cc.to_rgb(self.get_option('edge_color')) if edge_fills: defc = cc.to_rgb(self.get_option('edge_fill_color')) det = self.get_option('edge_thickness') - # + if edge_labels: edge_labels_math = self.get_option('edge_labels_math') delc = cc.to_rgb(self.get_option('edge_label_color')) @@ -1796,7 +1796,7 @@ def translate(p): # an undirected graph in the "wrong" order, so we use a "reverse" to # test for this case. Everything formed here conforms to the order # used in the graph. - # + e_color = {} if edge_fills: ef_color = {} @@ -1809,7 +1809,7 @@ def translate(p): for e in self._graph.edges(sort=False): edge = (e[0], e[1]) reverse = (e[1], e[0]) - # + c = dec if edge in edge_colors or (not is_directed and reverse in edge_colors): if edge in edge_colors: @@ -1817,7 +1817,7 @@ def translate(p): else: c = cc.to_rgb(edge_colors[reverse]) e_color[edge] = c - # + if edge_fills: c = defc if edge in edge_fill_colors or (not is_directed and reverse in edge_fill_colors): @@ -1826,7 +1826,7 @@ def translate(p): else: c = cc.to_rgb(edge_fill_colors[reverse]) ef_color[edge] = c - # + et = det if edge in edge_thicknesses or (not is_directed and reverse in edge_thicknesses): if edge in edge_thicknesses: @@ -1834,7 +1834,7 @@ def translate(p): else: et = edge_thicknesses[reverse] e_thick[edge] = et - # + if edge_labels: c = delc if edge in edge_label_colors or (not is_directed and reverse in edge_label_colors): @@ -1843,7 +1843,7 @@ def translate(p): else: c = cc.to_rgb(edge_label_colors[reverse]) el_color[edge] = c - # + els = dels if edge in edge_label_slopes or (not is_directed and reverse in edge_label_slopes): if edge in edge_label_slopes: @@ -1851,7 +1851,7 @@ def translate(p): else: els = edge_label_slopes[reverse] el_slope[edge] = els - # + elp = delp if edge in edge_label_placements or (not is_directed and reverse in edge_label_placements): if edge in edge_label_placements: diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py index 6f357c91b58..257b400f1c7 100644 --- a/src/sage/groups/cubic_braid.py +++ b/src/sage/groups/cubic_braid.py @@ -1557,7 +1557,7 @@ def as_matrix_group(self, root_bur=None, domain=None, characteristic=None, var=' if unitary: from sage.rings.finite_rings.finite_field_base import FiniteField from sage.groups.matrix_gps.unitary import GU - d, d = herm_form.dimensions() + _, d = herm_form.dimensions() if isinstance(domain, FiniteField): base_group = GU(d, domain, var=domain.gen(), invariant_form=herm_form) else: @@ -1568,7 +1568,7 @@ def as_matrix_group(self, root_bur=None, domain=None, characteristic=None, var=' from sage.groups.matrix_gps.finitely_generated import MatrixGroup matrix_group = MatrixGroup(gen_list, category=self.category()) - # ------------------------------------------------------------------------------- + # -------------------------------------------------------------------- # check if there is a well defined group homomorphism to matrix_group # Register map from ``self`` to matrix_group. # Since GAP' check is very expansive (on time and memory), the check is performed diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index 7470d8c2837..d95b4271a35 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -1833,7 +1833,7 @@ def genus(self): t = [Link(B(si)).number_of_components() for si in s] for i, j in enumerate(s): if not j: - s[i].append(-2) + j.append(-2) for i in s: q2 = max(abs(k) + 1 for k in i) q.append(q2) diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py index d8e4051b0f4..acb88bf241a 100644 --- a/src/sage/manifolds/chart.py +++ b/src/sage/manifolds/chart.py @@ -401,7 +401,7 @@ def __init__(self, domain, coordinates, calc_method=None, periods=None, # Initialization of the set of charts which the current chart is a # restriction of: self._supercharts = set([self]) - # + self._dom_restrict = {} # dict. of the restrictions of self to # subsets of self._domain, with the # subsets as keys diff --git a/src/sage/manifolds/differentiable/characteristic_cohomology_class.py b/src/sage/manifolds/differentiable/characteristic_cohomology_class.py index 819b4ef7263..86ba9eb3c6b 100644 --- a/src/sage/manifolds/differentiable/characteristic_cohomology_class.py +++ b/src/sage/manifolds/differentiable/characteristic_cohomology_class.py @@ -905,7 +905,7 @@ def _build_element(self, *args, **kwargs): name = 'c' class_type = 'multiplicative' val = 1 + x - if val == 'Pontryagin': + elif val == 'Pontryagin': if vbundle._field_type != 'real': raise ValueError(f'total Pontryagin class not defined on {vbundle}') if name is None: @@ -966,7 +966,7 @@ def _build_element(self, *args, **kwargs): class_type = 'Pfaffian' val = x else: - ValueError(f'predefined class "{val}" unknown') + raise ValueError(f'predefined class "{val}" unknown') # turn symbolic expression into a polynomial via Taylor expansion if isinstance(val, Expression): @@ -978,7 +978,7 @@ def _build_element(self, *args, **kwargs): elif vbundle._field_type == 'complex': pow_range = dim // 2 else: - ValueError(f'field type of {vbundle} must be real or complex') + raise ValueError(f'field type of {vbundle} must be real or complex') val = P(val.taylor(x, 0, pow_range)) @@ -1004,7 +1004,7 @@ def _build_element(self, *args, **kwargs): val = P([(-1) ** k * val[2 * k + 1] for k in range(n + 1)]) sym = multiplicative_sequence(val, n) else: - AttributeError('unkown class type') + raise AttributeError('unkown class type') d = {} w_vec = self._weighted_vectors diff --git a/src/sage/manifolds/differentiable/diff_map.py b/src/sage/manifolds/differentiable/diff_map.py index 5e24f678fe3..d684d064827 100644 --- a/src/sage/manifolds/differentiable/diff_map.py +++ b/src/sage/manifolds/differentiable/diff_map.py @@ -1281,7 +1281,7 @@ def pushforward(self, tensor): "the {} by the {}".format(tensor, self)) # Vector field module for the result: fmodule2 = dom1.vector_field_module(dest_map=self) - # + frame2 = fmodule2.basis(from_frame=chart2.frame()) si1 = dom1.start_index() si2 = fmodule2._sindex diff --git a/src/sage/manifolds/differentiable/examples/euclidean.py b/src/sage/manifolds/differentiable/examples/euclidean.py index ce98e4bc643..6a4b0bd2899 100644 --- a/src/sage/manifolds/differentiable/examples/euclidean.py +++ b/src/sage/manifolds/differentiable/examples/euclidean.py @@ -1728,7 +1728,7 @@ def __init__(self, name=None, latex_name=None, coordinates='Cartesian', symbols = 'r ph:\\phi z' self._spherical_chart = None # to be constructed later if necessary self._spherical_frame = None # orthonormal frame - self._cylindrical_chart = None # + self._cylindrical_chart = None self._cylindrical_frame = None # orthonormal frame init_coord_methods = {'Cartesian': self._init_cartesian, 'spherical': self._init_spherical, diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py index 4f60c415293..b5bb4be4d6f 100644 --- a/src/sage/manifolds/differentiable/manifold.py +++ b/src/sage/manifolds/differentiable/manifold.py @@ -3193,7 +3193,7 @@ def vector_frame(self, *args, **kwargs) -> VectorFrame: latex_indices = kwargs.pop('latex_indices', None) symbol_dual = kwargs.pop('symbol_dual', None) latex_symbol_dual = kwargs.pop('latex_symbol_dual', None) - # + if vector_fields: dest_map0 = vector_fields[0].parent().destination_map() if dest_map and dest_map is not dest_map0: diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py index 1c19fedbd52..d5c3bc83e6a 100644 --- a/src/sage/manifolds/differentiable/vectorfield_module.py +++ b/src/sage/manifolds/differentiable/vectorfield_module.py @@ -2300,10 +2300,10 @@ def tensor_from_comp(self, tensor_type, comp, name=None, if isinstance(comp, CompWithSym): resu._sym = comp._sym resu._antisym = comp._antisym - # + # 2/ Tensor components set to comp: resu._components[comp._frame] = comp - # + return resu def sym_bilinear_form(self, name=None, latex_name=None): diff --git a/src/sage/manifolds/differentiable/vectorframe.py b/src/sage/manifolds/differentiable/vectorframe.py index 959c0bd7a24..63c293a3e56 100644 --- a/src/sage/manifolds/differentiable/vectorframe.py +++ b/src/sage/manifolds/differentiable/vectorframe.py @@ -744,11 +744,11 @@ def __init__(self, vector_field_module, symbol, latex_symbol=None, if dest_map is self._domain.identity_map(): # The frame is added to the list of the domain's covering frames: self._domain._set_covering_frame(self) - # + # Dual coframe self._coframe = self.dual_basis() # self._coframe = a shortcut for # self._dual_basis - # + # Derived quantities: # Initialization of the set of frames that are restrictions of the # current frame to subdomains of the frame domain: @@ -756,7 +756,7 @@ def __init__(self, vector_field_module, symbol, latex_symbol=None, # Initialization of the set of frames which the current frame is a # restriction of: self._superframes = set([self]) - # + self._restrictions = {} # dict. of the restrictions of self to # subdomains of self._domain, with the # subdomains as keys diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py index 6729e51b4d1..616eab15786 100644 --- a/src/sage/manifolds/manifold.py +++ b/src/sage/manifolds/manifold.py @@ -582,11 +582,11 @@ def __init__(self, n, name, field, structure, base_manifold=None, category=category) self._is_open = True self._open_covers.append([self]) # list of open covers of self - # + if not isinstance(start_index, (int, Integer)): raise TypeError("the starting index must be an integer") self._sindex = start_index - # + self._atlas = [] # list of charts defined on subsets of self self._top_charts = [] # list of charts defined on subsets of self # that are not subcharts of charts on larger subsets diff --git a/src/sage/manifolds/scalarfield.py b/src/sage/manifolds/scalarfield.py index 59bf04d8139..6c1ea6e2f14 100644 --- a/src/sage/manifolds/scalarfield.py +++ b/src/sage/manifolds/scalarfield.py @@ -2200,7 +2200,7 @@ def _display_expression(self, chart, result): else: field_name = str(field) field_latex_name = latex(field) - # + result = FormattedExpansion() if self._name is None: symbol = "" diff --git a/src/sage/manifolds/vector_bundle.py b/src/sage/manifolds/vector_bundle.py index 15c92173a04..e122cdf1125 100644 --- a/src/sage/manifolds/vector_bundle.py +++ b/src/sage/manifolds/vector_bundle.py @@ -807,7 +807,7 @@ def local_frame(self, *args, **kwargs): symbol_dual = kwargs.pop('symbol_dual', None) latex_symbol_dual = kwargs.pop('latex_symbol_dual', None) domain = kwargs.pop('domain', None) - # + sec_module = self.section_module(domain=domain, force_free=True) resu = LocalFrame(sec_module, symbol=symbol, latex_symbol=latex_symbol, indices=indices, latex_indices=latex_indices, diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py index f657e1d369e..b583be32317 100644 --- a/src/sage/plot/multigraphics.py +++ b/src/sage/plot/multigraphics.py @@ -139,11 +139,10 @@ def __init__(self, graphics_list): sage: G = MultiGraphics([c, (c, (0.7, 0.6, 0.2, 0.2))]) sage: print(G) Multigraphics with 2 elements - """ self._glist = [] self._positions = [] - # + for ins in graphics_list: if isinstance(ins, Graphics): self.append(ins) # default position diff --git a/src/sage/tensor/modules/finite_rank_free_module.py b/src/sage/tensor/modules/finite_rank_free_module.py index e0ca00e0771..3525745f331 100644 --- a/src/sage/tensor/modules/finite_rank_free_module.py +++ b/src/sage/tensor/modules/finite_rank_free_module.py @@ -2324,10 +2324,10 @@ def tensor_from_comp(self, tensor_type, comp, name=None, latex_name=None): if isinstance(comp, CompWithSym): resu._sym = comp._sym resu._antisym = comp._antisym - # + # 2/ Tensor components set to comp: resu._components[comp._frame] = comp - # + return resu def alternating_contravariant_tensor(self, degree, name=None, diff --git a/src/sage/tensor/modules/free_module_basis.py b/src/sage/tensor/modules/free_module_basis.py index 39bc99b947d..1f67d8b2e81 100644 --- a/src/sage/tensor/modules/free_module_basis.py +++ b/src/sage/tensor/modules/free_module_basis.py @@ -1083,5 +1083,5 @@ def new_basis(self, change_of_basis, symbol, latex_symbol=None, # of changes of bases: fmodule._basis_changes[(self, the_new_basis)] = transf fmodule._basis_changes[(the_new_basis, self)] = inv_transf - # + return the_new_basis diff --git a/src/tox.ini b/src/tox.ini index c270270ff52..85a033166bb 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -315,7 +315,7 @@ passenv = RUFF_OUTPUT_FORMAT # 1 F402 [ ] Import `factor` from line 259 shadowed by loop variable # 1 PLC0208 [*] Use a sequence type instead of a `set` when iterating over values # -commands = ruff check --ignore PLR2004,I001,F401,E741,F821,PLR0912,PLR0913,E402,PLR0915,PLW2901,PLR5501,PLR0911,E731,F405,PLR1714,F403,PLR0402,PLW0603,F841,E713,PLW0602,PLR1711,E714,PLR1701,PLW3301,PLW1510,E721,PLW0120,F811,PLC0414,E743,PLE0101,PLR0124,PLW0127,F541,PLW1508,PLC3002,E742,PLE0302,PLW0129,F402,PLC0208 {posargs:{toxinidir}/sage/} +commands = ruff check --ignore PLR2004,I001,F401,E741,F821,PLR0912,PLR0913,E402,PLR0915,PLW2901,PLR5501,PLR0911,E731,F405,PLR1714,PLR1736,F403,PLR0402,PLW0603,F841,E713,PLW0602,PLR1711,E714,PLR1701,PLR1704,PLW3301,PLW1510,E721,PLW0120,F811,PLC2401,PLC0414,E743,PLE0101,PLR0124,PLW0127,F541,PLW1508,PLC3002,E742,PLE0302,PLW0129,F402,PLC0208 {posargs:{toxinidir}/sage/} [flake8] rst-roles =