From 217a187e7b63df78d88189781bd9f654f3ba28ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 2 Apr 2023 08:48:51 +0200 Subject: [PATCH 1/5] fix the broken linters --- src/sage/combinat/crystals/key_crystals.py | 547 --------------------- src/sage/schemes/elliptic_curves/cm.py | 4 +- 2 files changed, 2 insertions(+), 549 deletions(-) delete mode 100644 src/sage/combinat/crystals/key_crystals.py diff --git a/src/sage/combinat/crystals/key_crystals.py b/src/sage/combinat/crystals/key_crystals.py deleted file mode 100644 index 6d3eac4740d..00000000000 --- a/src/sage/combinat/crystals/key_crystals.py +++ /dev/null @@ -1,547 +0,0 @@ -r""" -Crystals of Key Tableaux - -AUTHORS: - -- Travis Scrimshaw: Initial version -""" - -# **************************************************************************** -# Copyright (C) 2023 Travis Scrimshaw -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# https://www.gnu.org/licenses/ -# **************************************************************************** - -from sage.combinat.root_system.cartan_type import CartanType -from sage.combinat.crystals.tensor_product import CrystalOfTableaux -from sage.categories.highest_weight_crystals import HighestWeightCrystals -from sage.structure.parent import Parent -from sage.structure.unique_representation import UniqueRepresentation -from sage.structure.list_clone import ClonableArray -from sage.rings.integer_ring import ZZ - -from sage.misc.lazy_attribute import lazy_attribute -from sage.misc.cachefunc import cached_method -from collections.abc import Sequence - -class KeyTableau(ClonableArray): - r""" - A key tableau. - - For more information, see - :class:`~sage.combinat.crystals.key_crystals.KeyTableaux`. - """ - def __init__(self, parent, data, check=True): - r""" - EXAMPLES:: - - sage: Y = crystals.infinity.GeneralizedYoungWalls(2) - sage: mg = Y.module_generators[0] - sage: TestSuite(mg).run() - """ - if check: - data = [tuple(row) for row in data] - ClonableArray.__init__(self, parent, data, check=check) - - def check(self): - if list(self) not in self.parent(): - raise ValueError("not a key tableau") - - def _repr_(self): - r""" - EXAMPLES:: - """ - return repr([list(row) for row in self]) - - def _repr_diagram(self): - r""" - Return a string representation of the diagram of ``self``. - - EXAMPLES:: - """ - if not self: - return '0' - ret = "" - width = max(len(repr(val)) for row in self for val in row) - base = f"{{:^{width}}}" - return "\n".join("|" + " ".join(base.format(val) for val in row) - for row in reversed(self)) - - def _latex_(self): - r""" - Return a latex representation of ``self``. - """ - if not self: - return "{\\emptyset}" - from sage.combinat.output import tex_from_array - return tex_from_array(self) - - def _ascii_art_(self): - r""" - Return an ascii art representation of ``self``. - - EXAMPLES:: - """ - from sage.typeset.ascii_art import AsciiArt - return AsciiArt(self._repr_diagram().splitlines()) - - def _unicode_art_(self): - """ - Return a unicode art representation of ``self``. - """ - from sage.typeset.unicode_art import UnicodeArt - if not self.data: - return UnicodeArt(["0"]) - - from sage.combinat.output import ascii_art_table - import unicodedata - v = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL') - vl = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL AND LEFT') - table = [[None]*(self.cols-len(row)) + row for row in reversed(self)] - ret = [] - for i,row in enumerate(ascii_art_table(table, use_unicode=True).splitlines()): - if row[-1] == " ": - if i % 2 == 0: - ret.append(row[:-1] + vl) - else: - ret.append(row[:-1] + v) - else: - ret.append(row) - return UnicodeArt(ret) - - def pp(self): - r""" - Pretty print ``self``. - """ - print(self._repr_diagram()) - - def _signature_data(self, i): - """ - Return data for the signature rule. - - We cancel `-+` pairs (in that order) to compute the ``i``-signature - and return the relevant data. We replace `i` with `+` and - `i + 1` with a `-`. - - OUTPUT: - - A tuple consisting of the following: - - - the column of the rightmost unpaired `+` (``None`` if does not exist) - - the column of the leftmost unpaired `-` (``None`` if does not exist) - - the number of unpaired `+` - - the number of unpaired `-` - """ - P = self.parent() - num_plus = 0 - pos_plus = [] - num_minus = 0 - pos_minus = None - for width in range(P._width): - for ind, row in enumerate(self): - if len(row) <= width: - continue - if row[width] == i: - pos_plus.append((ind, width)) - elif row[width] == i + 1: - if pos_plus: - pos_plus.pop() - else: - num_minus += 1 - pos_minus = (ind, width) - num_plus = len(pos_plus) - if pos_plus: - pos_plus = pos_plus[0] - else: - pos_plus = None - return (pos_plus, pos_minus, num_plus, num_minus) - - def e(self, i, by_tableau=False): - r""" - Return the application of the Kashiwara raising operator - `e_i` on ``self``. - - EXAMPLES:: - """ - P = self.parent() - n = P._cartan_type.rank() - if by_tableau: - ret = self.to_tableau().f(n+1-i) - if ret is None: - return None - return P.from_tableau(ret) - - pm = self._signature_data(i)[1] - if pm is None: - return None - data = [list(row) for row in self] - P = self.parent() - ind = pm[0] # the row index containing the unpaired i+1 - row = data[ind] - upper = data[ind+1:] - for j in range(pm[1], len(row)): - if row[j] != i + 1: - break - row[j] = i - for r2 in upper: - if len(r2) > j and r2[j] == i: - r2[j] = i + 1 - data = tuple(map(tuple, data)) - return P.element_class(P, data, check=False) - -# e_1 -# 211 -# 3322 - -# 211 -# 3322 -# `\phi`:: -# 1144 -# 455 -# f_4 -# 1144 -# 555 - -# 111 -# 3322 - -# 111 -# 3322 - -# 122 -# 3311 - - def f(self, i, by_tableau=False): - r""" - Return the application of the Kashiwara lowering operator - `f_i` on ``self``. - - EXAMPLES:: - """ - P = self.parent() - n = P._cartan_type.rank() - if by_tableau: - ret = self.to_tableau().e(n+1-i) - if ret is None: - return None - return P.from_tableau(ret) - - pp = self._signature_data(i)[0] - if pp is None: - return None - data = [list(row) for row in self] - P = self.parent() - ind = pp[0] # the row index containing the unpaired i - row = data[ind] - upper = data[ind+1:] - for j in range(pp[1], -1, -1): - if row[j] != i: - break - row[j] = i + 1 - for r2 in upper: - if len(r2) > j and r2[j] == i + 1: - r2[j] = i - if not P._check_content(data): - return None - data = tuple(map(tuple, data)) - return P.element_class(P, data, check=False) - - -# f_1 -# 1 -# 55511 -# 422 - -# 1 -# 422 -# 55511 -# Applying `\phi`:: -# 11155 -# 244 -# 5 -# e_4 -# 11145 -# 244 -# 5 - -# 1 -# 422 -# 55521 - -# 1 -# 55521 -# 422 - - def weight(self, root_lattice=False): - r""" - Return the weight of ``self``. - - INPUT: - - - ``root_lattice`` -- boolean determining whether weight should appear - in root lattice or not in extended affine weight lattice. - - EXAMPLES:: - - sage: x = crystals.infinity.GeneralizedYoungWalls(3)([[],[1,0,3,2],[2,1],[3,2,1,0,3,2],[],[],[2]]) - sage: x.weight() - 2*Lambda[0] + Lambda[1] - 4*Lambda[2] + Lambda[3] - 2*delta - sage: x.weight(root_lattice=True) - -2*alpha[0] - 3*alpha[1] - 5*alpha[2] - 3*alpha[3] - """ - P = self.parent().weight_lattice_realization() - wt = [P.base_ring().zero()] * len(L.basis()) - for row in self: - for val in row: - wt[val-1] += 1 - return L.from_vector(wt, coerce=False) - - def epsilon(self, i): - r""" - Return the number of `i`-colored arrows in the `i`-string above - ``self`` in the crystal graph. - - EXAMPLES:: - - sage: y = crystals.infinity.GeneralizedYoungWalls(3)([[],[1,0,3,2],[2,1],[3,2,1,0,3,2],[],[],[2]]) - sage: y.epsilon(1) - 0 - sage: y.epsilon(2) - 3 - sage: y.epsilon(0) - 0 - """ - n = self.parent()._cartan_type.rank() - return self.to_tableau().phi(n+1-i) - return ZZ(self._signature_data(i)[3]) # number of -'s - - def phi(self, i): - r""" - Return the value `\varepsilon_i(Y) + \langle h_i, - \mathrm{wt}(Y)\rangle`, where `h_i` is the `i`-th simple - coroot and `Y` is ``self``. - - EXAMPLES:: - - sage: y = crystals.infinity.GeneralizedYoungWalls(3)([[0],[1,0,3,2],[2,1],[3,2,1,0,3,2],[0],[],[2]]) - sage: y.phi(1) - 3 - sage: y.phi(2) - -1 - """ - n = self.parent()._cartan_type.rank() - return self.to_tableau().epsilon(n+1-i) - return ZZ(self._signature_data(i)[2]) # number of +'s - - def to_tableau(self): - """ - Return ``self`` as an element of the crystal of semistandard - Young tableaux of type `A_n`. - """ - P = self.parent() - C = P._ssyt - n = P._cartan_type.rank() - ret = sum((sorted((n + 2 - row[i] for row in self if len(row) > i), reverse=True) - for i in range(P._width)), []) - return C(list=ret) - - -class KeyTableaux(UniqueRepresentation, Parent): - r""" - Key tableaux - """ - @staticmethod - def __classcall_private__(cls, shape, n=None, category=None): - r""" - Normalize input to ensure a unique representation. - - INPUT: - - - ``shape`` -- the shape - - ``n`` -- (optional) type `A_n` - - EXAMPLES:: - - sage: Yinf = crystals.infinity.GeneralizedYoungWalls(3) - sage: Yinf2 = crystals.infinity.GeneralizedYoungWalls(int(3)) - sage: Yinf is Yinf2 - True - """ - shape = list(shape) - if n is None: - n = len(shape) - 1 - while shape and not shape[-1]: # standardize by removing trailing 0's - shape.pop() - shape = tuple(shape) - if n < len(shape) - 1: - raise ValueError(f"the rank must be at least {len(shape)-1}") - return super().__classcall__(cls, shape, n, category) - - def __init__(self, shape, n, category): - r""" - EXAMPLES:: - - sage: Yinf = crystals.infinity.GeneralizedYoungWalls(3) - sage: TestSuite(Yinf).run() - """ - self._cartan_type = CartanType(['A', n]) - self._shape = shape - self._width = max(shape, default=0) - self._ssyt = CrystalOfTableaux(self._cartan_type, shape=sorted(shape, reverse=True)) - category = HighestWeightCrystals().Finite().or_subcategory(category) - Parent.__init__(self, category=category) - - Element = KeyTableau - - @lazy_attribute - def module_generators(self): - r""" - Return the highest weight element of ``self``. - - Note that this is not the generator of the corresponding module - of ``self`` as `U_q(\mathfrak{gl}_n)^+`-module (which is instead - :meth:`extremal_module_generator()`). This is for implementation - details in the category of - :class:`~sage.categories.highest_weight_crystals.HighestWeightCrystals` - assuming the ``module_generators`` contains all of the highest weight - elements and those generate ``self`` under `f_i`. - """ - gen = self.extremal_module_generator() - return (gen.to_highest_weight()[0],) - - @cached_method - def extremal_module_generator(self): - """ - Return the generator of ``self``, considered as an extremal weight - module. - """ - data = tuple([(i,)*ell for i, ell in enumerate(self._shape, start=1)]) - return self.element_class(self, data, check=False) - - def _element_constructor_(self, data, check=True): - r""" - Construct an element of ``self`` from ``data``. - - INPUT: - - - ``data`` -- a multilist - - EXAMPLES:: - - sage: GYW = crystals.infinity.GeneralizedYoungWalls(2) - sage: y = GYW([[],[1,0],[2,1]]) # indirect doctest - sage: y - [[], [1, 0], [2, 1]] - """ - return self.element_class(self, data, check=check) - - def _repr_(self): - r""" - EXAMPLES:: - - sage: Y = crystals.infinity.GeneralizedYoungWalls(4) - sage: Y - Crystal of generalized Young walls of type ['A', 4, 1] - """ - return "Crystal of key tableaux of type {} and shape {}".format(self._cartan_type, self._shape) - - def __contains__(self, data): - """ - Check if ``data`` is an element of ``self``. - """ - if isinstance(data, self.element_class): - return data.parent() is self - - # Check the shape agrees - if not isinstance(data, Sequence): - return False - if len(self._shape) != len(data): - return False - if any((not isinstance(row, Sequence)) or len(row) != ell - for row, ell in zip(data, self._shape)): - return False - - # Check entries in each column are distinct - for i in range(self._width): - col = [row[i] for row in data if len(row) > i] - if len(col) != len(set(col)): - return False - - # Check the other nontrivial content conditions - return self._check_content(data) - - def _check_content(self, data): - """ - Check the content of ``data`` is an element of ``self``, where - we assume that ``data`` is a filling of ``self._shape`` with - with distinct entries in the columns. - """ - # Check rows are weakly decreasing - for row in data: - if any(row[i] < row[i+1] for i in range(len(row)-1)): - return False - - # Check the other condition - for ind, row in enumerate(data): - for ri, k in enumerate(row): - i = max((row[ri] for row in data[ind+1:] if len(row) > ri and row[ri] < k), default=None) - if i is None: - continue - if ri == len(row) - 1 or i >= row[ri+1]: - return False - - # Check the semistandard condition - return all(not row or row[0] <= i for i, row in enumerate(data, start=1)) - - def from_tableau(self, T): - """ - Return the element of ``self`` corresponding to ``T`` if the result - is in ``self`` and ``None`` otherwise. - """ - if isinstance(T, self._ssyt.element_class): - T = T.to_tableau() - - # Special case of the empty tableau - if not T: - if T not in self: - return None - return self.element_class(self, [], check=False) - - data = [[None] * ell for ell in self._shape] - n = self._cartan_type.rank() + 2 - T = ([n - val for val in col] for col in reversed(T.conjugate())) - - for j in range(self._width-1,-1,-1): - col = next(T) - for ind, row in enumerate(data): - if len(row) <= j: - continue - - if len(row) == j + 1: # rightmost entry in the row - row[j] = col.pop() - else: - # Necessarily there is an entry to the right - for i in range(len(col)-1,-1,-1): - if col[i] >= row[j+1]: - row[j] = col.pop(i) - break - - # Check the semistandard condition - if row[j] > ind + 1: - return None - if not col: - break - - assert data in self - data = tuple(map(tuple, data)) - return self.element_class(self, data, check=False) - - def shape(self): - """ - Return the shape of ``self``. - """ - return self._shape \ No newline at end of file diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 94b922a0365..d24c09a72bb 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -248,7 +248,7 @@ def is_HCP(f, check_monic_irreducible=True): # Guarantees 4*p > |D| for fundamental D under GRH p = pmin-1 n = 0 - from sage.arith.all import next_prime + from sage.arith.misc import next_prime while True: p = next_prime(p) n += 1 @@ -315,7 +315,7 @@ def OrderClassNumber(D0,h0,f): return h0 ps = f.prime_divisors() from sage.misc.misc_c import prod - from sage.arith.all import kronecker_symbol + from sage.arith.misc import kronecker as kronecker_symbol n = (f // prod(ps)) * prod(p-kronecker_symbol(D0,p) for p in ps) if D0 == -3: #assert h0 == 1 and n%3==0 From 69effdd3f278cbf62e9ed66243871f247287db6d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 23:28:37 -0700 Subject: [PATCH 2/5] .relint.yml, src/sage/misc/replace_dot_all.py: Flag/replace .all imports from more packages --- src/.relint.yml | 2 +- src/sage/misc/replace_dot_all.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/.relint.yml b/src/.relint.yml index e0b275296aa..67211bc7414 100644 --- a/src/.relint.yml +++ b/src/.relint.yml @@ -49,7 +49,7 @@ Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, Hint: or use 'sage --fiximports' to fix automatically in the source file. # Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py - pattern: 'from\s+sage(|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings(|[.]finite_rings)|sets))[.]all\s+import' + pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import' # imports from .all are allowed in all.py; also allow in some modules that need sage.all filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$' diff --git a/src/sage/misc/replace_dot_all.py b/src/sage/misc/replace_dot_all.py index 320a5a15c06..8b48118aef6 100644 --- a/src/sage/misc/replace_dot_all.py +++ b/src/sage/misc/replace_dot_all.py @@ -72,7 +72,7 @@ # Keep in sync with SAGE_ROOT/src/.relint.yml (namespace_pkg_all_import) default_package_regex = (r"sage(" - r"|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings|sets)" + r"|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs" r")[.]all") @@ -438,7 +438,9 @@ def walkdir_replace_dot_all(dir, file_regex=r'.*[.](py|pyx|pxi)$', package_regex package_regex = None # Execute the main function based on the specified location and verbosity if not args.location: - args.location = [os.path.join(sage.env.SAGE_SRC, 'sage')] + from sage.env import SAGE_SRC + + args.location = [os.path.join(SAGE_SRC, 'sage')] try: for location in args.location: if not (location.endswith('.py') or location.endswith('.pxi')): From d85750e048693000b35c7947f07e91b3ef31e26c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 13:07:00 -0700 Subject: [PATCH 3/5] Run './sage -fiximports' --- .../letterplace/free_algebra_element_letterplace.pyx | 2 +- src/sage/algebras/letterplace/free_algebra_letterplace.pyx | 2 +- src/sage/categories/finite_complex_reflection_groups.py | 3 ++- src/sage/coding/ag_code_decoders.pyx | 2 +- src/sage/coding/linear_code.py | 2 +- src/sage/combinat/root_system/reflection_group_complex.py | 4 ++-- src/sage/combinat/species/characteristic_species.py | 2 +- src/sage/combinat/species/cycle_species.py | 5 +++-- src/sage/combinat/species/linear_order_species.py | 2 +- src/sage/combinat/species/misc.py | 5 ++++- src/sage/combinat/species/partition_species.py | 2 +- src/sage/combinat/species/permutation_species.py | 3 ++- src/sage/combinat/species/product_species.py | 3 ++- src/sage/combinat/species/set_species.py | 2 +- src/sage/combinat/species/subset_species.py | 3 ++- src/sage/combinat/words/word_generators.py | 2 +- src/sage/doctest/parsing.py | 2 +- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 2 +- src/sage/geometry/hyperplane_arrangement/arrangement.py | 2 +- src/sage/graphs/graph_coloring.pyx | 2 +- src/sage/groups/affine_gps/affine_group.py | 2 +- src/sage/interfaces/chomp.py | 3 ++- src/sage/interfaces/macaulay2.py | 2 +- src/sage/libs/singular/function.pyx | 2 +- src/sage/matrix/matrix_symbolic_dense.pyx | 2 +- src/sage/matroids/catalog.py | 2 +- src/sage/misc/cachefunc.pyx | 4 ++-- src/sage/modular/arithgroup/congroup_generic.py | 2 +- src/sage/modular/local_comp/type_space.py | 2 +- src/sage/modular/modform/numerical.py | 2 +- src/sage/modules/free_quadratic_module_integer_symmetric.py | 2 +- src/sage/numerical/interactive_simplex_method.py | 3 ++- src/sage/quadratic_forms/genera/genus.py | 3 ++- src/sage/quadratic_forms/quadratic_form__automorphisms.py | 2 +- src/sage/rings/finite_rings/finite_field_base.pyx | 2 +- src/sage/rings/finite_rings/integer_mod.pyx | 2 +- src/sage/rings/multi_power_series_ring.py | 2 +- src/sage/rings/number_field/number_field.py | 2 +- src/sage/rings/number_field/splitting_field.py | 4 ++-- src/sage/rings/padics/padic_capped_relative_element.pyx | 2 +- src/sage/rings/polynomial/plural.pyx | 2 +- src/sage/rings/polynomial/polynomial_rational_flint.pyx | 4 +++- src/sage/rings/polynomial/real_roots.pyx | 3 ++- src/sage/rings/qqbar.py | 2 +- src/sage/rings/valuation/valuation_space.py | 2 +- src/sage/schemes/curves/constructor.py | 4 ++-- src/sage/schemes/cyclic_covers/cycliccover_generic.py | 2 +- src/sage/schemes/elliptic_curves/cm.py | 2 +- src/sage/schemes/elliptic_curves/ell_curve_isogeny.py | 2 +- src/sage/schemes/elliptic_curves/heegner.py | 6 +++--- src/sage/schemes/elliptic_curves/isogeny_small_degree.py | 2 +- src/sage/schemes/elliptic_curves/kraus.py | 2 +- src/sage/schemes/elliptic_curves/saturation.py | 4 ++-- .../schemes/hyperelliptic_curves/hyperelliptic_generic.py | 2 +- .../hyperelliptic_curves/hyperelliptic_rational_field.py | 2 +- src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py | 2 +- src/sage/schemes/toric/morphism.py | 2 +- src/sage/schemes/toric/sheaf/klyachko.py | 4 ++-- src/sage/schemes/toric/weierstrass.py | 2 +- src/sage/topology/cell_complex.py | 2 +- 60 files changed, 83 insertions(+), 69 deletions(-) diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx index 80ac48b202c..3ccb1f951ed 100644 --- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx @@ -17,7 +17,7 @@ AUTHOR: # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.groups.perm_gps.all import CyclicPermutationGroup +from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup from sage.libs.singular.function import lib, singular_function from sage.misc.repr import repr_lincomb from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx index 0e1e47efc11..add09456f0b 100644 --- a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx @@ -684,7 +684,7 @@ cdef class FreeAlgebra_letterplace(Algebra): ngens = self.__ngens degbound = self._degbound cdef list G = [C(x._poly) for x in g] - from sage.groups.perm_gps.all import CyclicPermutationGroup + from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup CG = CyclicPermutationGroup(C.ngens()) for y in G: out.extend([y] + [y * CG[ngens * (n + 1)] diff --git a/src/sage/categories/finite_complex_reflection_groups.py b/src/sage/categories/finite_complex_reflection_groups.py index 13e682a0033..8648f89dbc4 100644 --- a/src/sage/categories/finite_complex_reflection_groups.py +++ b/src/sage/categories/finite_complex_reflection_groups.py @@ -854,7 +854,8 @@ def noncrossing_partition_lattice(self, c=None, L=None, sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice(W.from_reduced_word([2])) ) # optional - gap3 [[], [2]] """ - from sage.combinat.posets.all import Poset, LatticePoset + from sage.combinat.posets.posets import Poset + from sage.combinat.posets.lattices import LatticePoset R = self.reflections() if L is None: diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index 54e3c1d8810..1ff9a5ed47b 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -61,7 +61,7 @@ AUTHORS: cimport cython from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.rings.function_field.all import FunctionField +from sage.rings.function_field.constructor import FunctionField from sage.modules.free_module_element import vector from sage.matrix.constructor import matrix diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index 12468fe6959..b03ef5116ba 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -217,7 +217,7 @@ class should inherit from this class. Also ``AbstractLinearCode`` should never from sage.combinat.subset import Subsets from sage.cpython.string import bytes_to_str from sage.features.gap import GapPackage -from sage.groups.all import SymmetricGroup +from sage.groups.perm_gps.permgroup_named import SymmetricGroup from sage.groups.perm_gps.permgroup import PermutationGroup from sage.interfaces.gap import gap from sage.matrix.matrix_space import MatrixSpace diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index 68159babb11..346cb59061b 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -764,7 +764,7 @@ def discriminant(self): sage: W.discriminant() # optional - gap3 x0^6*x1^2 - 6*x0^5*x1^3 + 13*x0^4*x1^4 - 12*x0^3*x1^5 + 4*x0^2*x1^6 """ - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing n = self.rank() P = PolynomialRing(QQ, 'x', n) x = P.gens() @@ -1416,7 +1416,7 @@ def fundamental_invariants(self): (x0^3 + x1^3, x0^3*x1^3) """ import re - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if not self.is_irreducible(): return sum([W.fundamental_invariants() for W in self.irreducible_components() ],tuple()) diff --git a/src/sage/combinat/species/characteristic_species.py b/src/sage/combinat/species/characteristic_species.py index 910ce3e96fc..2110920cb93 100644 --- a/src/sage/combinat/species/characteristic_species.py +++ b/src/sage/combinat/species/characteristic_species.py @@ -88,7 +88,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 3! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(len(self._labels)) diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index 20d89a770db..335223143ed 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -54,7 +54,7 @@ def permutation_group_element(self): sage: a.permutation_group_element() (1,2,3) """ - from sage.groups.all import PermutationGroupElement + from sage.groups.perm_gps.constructor import PermutationGroupElement return PermutationGroupElement(tuple(self._list)) def transport(self, perm): @@ -96,7 +96,8 @@ def automorphism_group(self): sage: [a.transport(perm) for perm in a.automorphism_group()] [(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens()) diff --git a/src/sage/combinat/species/linear_order_species.py b/src/sage/combinat/species/linear_order_species.py index 3f8690da3c2..a62fde28fb5 100644 --- a/src/sage/combinat/species/linear_order_species.py +++ b/src/sage/combinat/species/linear_order_species.py @@ -63,7 +63,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 1! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(1) diff --git a/src/sage/combinat/species/misc.py b/src/sage/combinat/species/misc.py index f31a0939477..7296c77e54d 100644 --- a/src/sage/combinat/species/misc.py +++ b/src/sage/combinat/species/misc.py @@ -16,7 +16,10 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.groups.all import PermutationGroup, PermutationGroup_generic, PermutationGroupElement, SymmetricGroup +from sage.groups.perm_gps.permgroup import PermutationGroup +from sage.groups.perm_gps.permgroup import PermutationGroup_generic +from sage.groups.perm_gps.constructor import PermutationGroupElement +from sage.groups.perm_gps.permgroup_named import SymmetricGroup from sage.misc.misc_c import prod from functools import wraps diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index 7ddd9812ba1..c9b08f1b4bb 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -102,7 +102,7 @@ def automorphism_group(self): sage: a.automorphism_group() Permutation Group with generators [(1,2)] """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return reduce(lambda a,b: a.direct_product(b, maps=False), [SymmetricGroup(block._list) for block in self._list]) diff --git a/src/sage/combinat/species/permutation_species.py b/src/sage/combinat/species/permutation_species.py index 9c34eeb9c98..aeb7ad3ca3b 100644 --- a/src/sage/combinat/species/permutation_species.py +++ b/src/sage/combinat/species/permutation_species.py @@ -97,7 +97,8 @@ def automorphism_group(self): ['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd']] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens()) diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index 74004849b79..0989d2a8f8c 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -176,7 +176,8 @@ def automorphism_group(self): sage: [a.transport(g) for g in a.automorphism_group()] [{2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}] """ - from sage.groups.all import PermutationGroupElement, PermutationGroup + from sage.groups.perm_gps.constructor import PermutationGroupElement + from sage.groups.perm_gps.permgroup import PermutationGroup from sage.combinat.species.misc import change_support left, right = self._list diff --git a/src/sage/combinat/species/set_species.py b/src/sage/combinat/species/set_species.py index 4bc94c220f8..c4942dc653d 100644 --- a/src/sage/combinat/species/set_species.py +++ b/src/sage/combinat/species/set_species.py @@ -77,7 +77,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 3! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(max(1,len(self._labels))) diff --git a/src/sage/combinat/species/subset_species.py b/src/sage/combinat/species/subset_species.py index 25f4862f4be..2bd89885533 100644 --- a/src/sage/combinat/species/subset_species.py +++ b/src/sage/combinat/species/subset_species.py @@ -102,7 +102,8 @@ def automorphism_group(self): sage: [a.transport(g) for g in a.automorphism_group()] [{1, 3}, {1, 3}, {1, 3}, {1, 3}] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup a = SymmetricGroup(self._list) b = SymmetricGroup(self.complement()._list) return PermutationGroup(a.gens() + b.gens()) diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 66c5f25eda7..5cf9625d21f 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -1496,7 +1496,7 @@ def _fibonacci_tile(self, n, q_0=None, q_1=3): [BmBGL09]_ """ - from sage.combinat.words.all import WordMorphism + from sage.combinat.words.morphism import WordMorphism W = FiniteWords([0,1,2,3]) bar = WordMorphism({0:0,1:3,3:1,2:2},codomain=W) if n==0: diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index 26d793b96bf..2e39bee5704 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -63,7 +63,7 @@ def RIFtol(*args): if _RIFtol is None: try: # We need to import from sage.all to avoid circular imports. - from sage.all import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField except ImportError: from warnings import warn warn("RealIntervalField not available, ignoring all tolerance specifications in doctests") diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 4dd109036d4..e9eb515efaf 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -99,7 +99,7 @@ class initialization directly. from sage.rings.polynomial.flatten import FlatteningMorphism, UnflatteningMorphism from sage.rings.morphism import RingHomomorphism_im_gens from sage.rings.number_field.number_field_ideal import NumberFieldFractionalIdeal -from sage.rings.padics.all import Qp +from sage.rings.padics.factory import Qp from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import is_PolynomialRing diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index 2874eb57409..41115fd0452 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -1726,7 +1726,7 @@ def vertices(self, exclude_sandwiched=False): ((0, 0), (0, 8), (8, 0), (8, 8)) """ import itertools - from sage.matroids.all import Matroid + from sage.matroids.constructor import Matroid R = self.parent().base_ring() parallels = self._parallel_hyperplanes() A_list = [parallel[0][1] for parallel in parallels] diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index a154942b92c..844969f8b94 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -1643,7 +1643,7 @@ def _vizing_edge_coloring(g): e_colors[frozenset((fan_center, fan[-1]))] = d matchings = dict() - for edge, c in e_colors.items(): + for edge, c in e_colors.items(): matchings[c] = matchings.get(c, []) + [tuple(edge)] classes = list(matchings.values()) diff --git a/src/sage/groups/affine_gps/affine_group.py b/src/sage/groups/affine_gps/affine_group.py index 44d6bf94900..04f7838bc47 100644 --- a/src/sage/groups/affine_gps/affine_group.py +++ b/src/sage/groups/affine_gps/affine_group.py @@ -22,7 +22,7 @@ from sage.groups.matrix_gps.linear import GL from sage.categories.rings import Rings from sage.matrix.matrix_space import MatrixSpace -from sage.modules.all import FreeModule +from sage.modules.free_module import FreeModule from sage.structure.unique_representation import UniqueRepresentation from sage.misc.cachefunc import cached_method diff --git a/src/sage/interfaces/chomp.py b/src/sage/interfaces/chomp.py index b499f2a33b5..9e1b92d7709 100644 --- a/src/sage/interfaces/chomp.py +++ b/src/sage/interfaces/chomp.py @@ -151,7 +151,8 @@ def __call__(self, program, complex, subcomplex=None, **kwds): from subprocess import Popen, PIPE from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ - from sage.modules.all import VectorSpace, vector + from sage.modules.free_module import VectorSpace + from sage.modules.free_module_element import free_module_element as vector from sage.combinat.free_module import CombinatorialFreeModule deprecation(33777, "the CHomP interface is deprecated") diff --git a/src/sage/interfaces/macaulay2.py b/src/sage/interfaces/macaulay2.py index 09d17c4f2a4..58ec79a48ee 100644 --- a/src/sage/interfaces/macaulay2.py +++ b/src/sage/interfaces/macaulay2.py @@ -1618,7 +1618,7 @@ def _sage_(self): elif cls_str == "String": return str(repr_str) elif cls_str == "Module": - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule if self.isFreeModule()._sage_(): ring = self.ring()._sage_() rank = self.rank()._sage_() diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx index 906f1e6c860..229f6695e09 100644 --- a/src/sage/libs/singular/function.pyx +++ b/src/sage/libs/singular/function.pyx @@ -1299,7 +1299,7 @@ cdef class SingularFunction(SageObject): ring = self.common_ring(args, ring) if ring is None: if dummy_ring is None: - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import QQ dummy_ring = PolynomialRing(QQ, "dummy", implementation="singular") # seems a reasonable default ring = dummy_ring diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx index 8774848f2d7..19ca5c85cb2 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pyx +++ b/src/sage/matrix/matrix_symbolic_dense.pyx @@ -154,7 +154,7 @@ Check that :trac:`12778` is fixed:: Full MatrixSpace of 3 by 4 dense matrices over Symbolic Ring """ -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.element cimport ModuleElement, RingElement, Element from sage.structure.factorization import Factorization diff --git a/src/sage/matroids/catalog.py b/src/sage/matroids/catalog.py index 61071b0c757..769ef123923 100644 --- a/src/sage/matroids/catalog.py +++ b/src/sage/matroids/catalog.py @@ -40,7 +40,7 @@ from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.finite_field_constructor import GF -from sage.schemes.all import ProjectiveSpace +from sage.schemes.projective.projective_space import ProjectiveSpace import sage.matroids.matroid import sage.matroids.basis_exchange_matroid diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx index bae02139bc2..9715726659b 100644 --- a/src/sage/misc/cachefunc.pyx +++ b/src/sage/misc/cachefunc.pyx @@ -107,9 +107,9 @@ By :trac:`11115`, even if a parent does not allow attribute assignment, it can inherit a cached method from the parent class of a category (previously, the cache would have been broken):: - sage: cython_code = ["from sage.misc.cachefunc import cached_method", + sage: cython_code = ["from sage.misc.cachefunc import cached_method", ....: "from sage.misc.cachefunc import cached_in_parent_method", - ....: "from sage.categories.category import Category", + ....: "from sage.categories.category import Category", ....: "from sage.categories.objects import Objects", ....: "class MyCategory(Category):", ....: " @cached_method", diff --git a/src/sage/modular/arithgroup/congroup_generic.py b/src/sage/modular/arithgroup/congroup_generic.py index 99dbc5036fb..75605b1c3dc 100644 --- a/src/sage/modular/arithgroup/congroup_generic.py +++ b/src/sage/modular/arithgroup/congroup_generic.py @@ -22,7 +22,7 @@ ################################################################################ from sage.arith.misc import gcd -from sage.groups.matrix_gps.all import MatrixGroup +from sage.groups.matrix_gps.finitely_generated import MatrixGroup from sage.matrix.matrix_space import MatrixSpace from sage.misc.misc_c import prod from sage.rings.finite_rings.integer_mod_ring import Zmod diff --git a/src/sage/modular/local_comp/type_space.py b/src/sage/modular/local_comp/type_space.py index 2549e5519b0..3b57a2652ae 100644 --- a/src/sage/modular/local_comp/type_space.py +++ b/src/sage/modular/local_comp/type_space.py @@ -497,7 +497,7 @@ def _rho_unramified(self, g): True """ f = self.prime() ** self.u() - from sage.groups.matrix_gps.all import SL + from sage.groups.matrix_gps.linear import SL G = SL(2, Zmod(f)) gg = G(g) s = G([1,1,0,1]) diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index ad52403f471..32ef1fc657c 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -19,7 +19,7 @@ from sage.misc.prandom import randint from sage.modular.arithgroup.all import Gamma0 from sage.modular.modsym.all import ModularSymbols -from sage.modules.all import vector +from sage.modules.free_module_element import free_module_element as vector from sage.rings.complex_double import CDF from sage.rings.integer import Integer from sage.rings.rational_field import QQ diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py index 0902a272f39..7d7c87db87f 100644 --- a/src/sage/modules/free_quadratic_module_integer_symmetric.py +++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py @@ -61,7 +61,7 @@ from sage.arith.misc import gcd from sage.combinat.root_system.cartan_matrix import CartanMatrix from sage.misc.cachefunc import cached_method -from sage.quadratic_forms.all import QuadraticForm +from sage.quadratic_forms.quadratic_form import QuadraticForm ############################################################################### # diff --git a/src/sage/numerical/interactive_simplex_method.py b/src/sage/numerical/interactive_simplex_method.py index b2c7e304e08..26e332cd8d9 100644 --- a/src/sage/numerical/interactive_simplex_method.py +++ b/src/sage/numerical/interactive_simplex_method.py @@ -192,7 +192,8 @@ from sage.misc.prandom import randint, random from sage.misc.html import HtmlFragment from sage.misc.misc import get_main_globals -from sage.modules.all import random_vector, vector +from sage.modules.free_module_element import random_vector +from sage.modules.free_module_element import free_module_element as vector from sage.misc.lazy_import import lazy_import lazy_import("sage.plot.all", ["Graphics", "arrow", "line", "point", "rainbow", "text"]) from sage.rings.infinity import Infinity diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index 788e7be30c9..4ee20120e1c 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -2940,7 +2940,8 @@ def rational_representative(self): [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 2] """ - from sage.quadratic_forms.all import QuadraticForm, quadratic_form_from_invariants + from sage.quadratic_forms.quadratic_form import QuadraticForm + from sage.quadratic_forms.quadratic_form import quadratic_form_from_invariants sminus = self.signature_pair_of_matrix()[1] det = self.determinant() m = self.rank() diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py index 48a473f44c4..4e6453b34d3 100644 --- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py +++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py @@ -12,7 +12,7 @@ from sage.matrix.constructor import Matrix from sage.rings.integer_ring import ZZ -from sage.modules.all import FreeModule +from sage.modules.free_module import FreeModule from sage.modules.free_module_element import vector from sage.arith.misc import GCD diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 06e57a04952..03966d60ced 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1230,7 +1230,7 @@ cdef class FiniteField(Field): sage: all(to_V(h(c) * e) == c * to_V(e) for e in E for c in F) True """ - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace from sage.categories.morphism import is_Morphism if subfield is not None: if base is not None: diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 8e723be71b7..ec3268dc84e 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -1523,7 +1523,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): return [K(a.lift()*p**(pval // n) + p**(k - (pval - pval//n)) * b) for a in mod(upart, p**(k-pval)).nth_root(n, all=True, algorithm=algorithm) for b in range(p**(pval - pval//n))] else: return K(p**(pval // n) * mod(upart, p**(k-pval)).nth_root(n, algorithm=algorithm).lift()) - from sage.rings.padics.all import ZpFM + from sage.rings.padics.factory import ZpFM R = ZpFM(p,k) self_orig = self if p == 2: diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index 7f0d5d1bfb8..0f7aa3b2d43 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -205,7 +205,7 @@ from sage.rings.ring import CommutativeRing -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import is_PolynomialRing from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing from sage.rings.polynomial.term_order import TermOrder diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 7a1b08d02ed..b696759489f 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -12153,7 +12153,7 @@ def hilbert_class_polynomial(self, name='x'): if D > 0: raise NotImplementedError("Hilbert class polynomial is not implemented for real quadratic fields.") - from sage.schemes.elliptic_curves.all import hilbert_class_polynomial as HCP + from sage.schemes.elliptic_curves.cm import hilbert_class_polynomial as HCP return QQ[name](HCP(D)) def number_of_roots_of_unity(self): diff --git a/src/sage/rings/number_field/splitting_field.py b/src/sage/rings/number_field/splitting_field.py index 14871fecc05..933660d629a 100644 --- a/src/sage/rings/number_field/splitting_field.py +++ b/src/sage/rings/number_field/splitting_field.py @@ -20,8 +20,8 @@ from sage.rings.integer import Integer from sage.arith.misc import factorial -from sage.rings.number_field.all import NumberField -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.number_field.number_field import NumberField +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import RationalField, is_RationalField from sage.libs.pari.all import pari, PariError diff --git a/src/sage/rings/padics/padic_capped_relative_element.pyx b/src/sage/rings/padics/padic_capped_relative_element.pyx index b5843d467a7..d393708979d 100644 --- a/src/sage/rings/padics/padic_capped_relative_element.pyx +++ b/src/sage/rings/padics/padic_capped_relative_element.pyx @@ -604,7 +604,7 @@ def base_p_list(Integer n, bint pos, PowComputer_class prime_pow): raise ValueError("n must be nonnegative") cdef expansion_mode mode = simple_mode if pos else smallest_mode # We need a p-adic element to feed to ExpansionIter before resetting its curvalue - from sage.rings.padics.all import Zp + from sage.rings.padics.factory import Zp p = prime_pow.prime dummy = Zp(p)(0) cdef ExpansionIter expansion = ExpansionIter(dummy, n.exact_log(p) + 2, mode) diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index 8839fb92502..423b0a2aba8 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -657,7 +657,7 @@ cdef class NCPolynomialRing_plural(Ring): Ambient free module of rank 3 over Noncommutative Multivariate Polynomial Ring in x, y, z over Rational Field, nc-relations: {y*x: -x*y} """ - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule return FreeModule(self, n) def term_order(self): diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index 0e6970217ab..d85ad4af690 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -2163,7 +2163,9 @@ cdef class Polynomial_rational_flint(Polynomial): sage: (zeta^2 + zeta + 1).galois_group(pari_group=True) PARI group [2, -1, 1, "S2"] of degree 2 """ - from sage.groups.all import PariGroup, PermutationGroup, TransitiveGroup + from sage.groups.pari_group import PariGroup + from sage.groups.perm_gps.permgroup import PermutationGroup + from sage.groups.perm_gps.permgroup_named import TransitiveGroup if not self.is_irreducible(): raise ValueError("The polynomial must be irreducible") diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index b939908ef92..94fa0b84d40 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -143,7 +143,8 @@ from sage.rings.real_mpfi import RealIntervalField, RIF from sage.rings.real_mpfr import RR, RealField from sage.arith.misc import binomial, factorial from sage.misc.randstate import randstate -from sage.modules.all import vector, FreeModule +from sage.modules.free_module_element import free_module_element as vector +from sage.modules.free_module import FreeModule from sage.matrix.matrix_space import MatrixSpace from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import polygen diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index da8b8d71b91..d70b2cd2bc3 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -572,7 +572,7 @@ from sage.rings.cif import CIF from sage.rings.complex_interval_field import ComplexIntervalField from sage.rings.complex_interval import is_ComplexIntervalFieldElement -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ diff --git a/src/sage/rings/valuation/valuation_space.py b/src/sage/rings/valuation/valuation_space.py index ffb13d82917..415a1197ed9 100644 --- a/src/sage/rings/valuation/valuation_space.py +++ b/src/sage/rings/valuation/valuation_space.py @@ -540,7 +540,7 @@ def residue_field(self): return ret from sage.rings.polynomial.polynomial_ring import is_PolynomialRing if is_PolynomialRing(ret): - from sage.rings.function_field.all import FunctionField + from sage.rings.function_field.constructor import FunctionField return FunctionField(ret.base_ring().fraction_field(), names=(ret.variable_name(),)) return ret.fraction_field() diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 88f9b95701f..95f37415126 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -49,9 +49,9 @@ from sage.schemes.generic.algebraic_scheme import is_AlgebraicScheme from sage.schemes.projective.projective_space import is_ProjectiveSpace -from sage.schemes.affine.all import AffineSpace +from sage.schemes.affine.affine_space import AffineSpace -from sage.schemes.projective.all import ProjectiveSpace +from sage.schemes.projective.projective_space import ProjectiveSpace from .projective_curve import (ProjectiveCurve, diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index 7531d933c0b..a1df7badef8 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -39,7 +39,7 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.category_object import normalize_names from sage.arith.misc import GCD from sage.schemes.curves.affine_curve import AffinePlaneCurve diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index d24c09a72bb..908aedcac81 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -43,7 +43,6 @@ from sage.rings.number_field.number_field import is_fundamental_discriminant from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.schemes.elliptic_curves.all import EllipticCurve from sage.misc.cachefunc import cached_function from sage.rings.number_field.number_field_element_base import NumberFieldElement_base @@ -997,6 +996,7 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): # Construct an elliptic curve with j-invariant j, with # integral model: + from sage.schemes.elliptic_curves.constructor import EllipticCurve E = EllipticCurve(j=j).integral_model() D = E.discriminant() prime_bound = 1000 # test primes of degree 1 up to this norm diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 213ac83d73b..2aaccb5c1de 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -89,7 +89,7 @@ from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.fraction_field import FractionField -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve from sage.schemes.elliptic_curves.weierstrass_morphism \ diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index e4e19cf154b..86ccab0546f 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -115,8 +115,8 @@ from sage.rings.number_field.number_field import QuadraticField from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField -from sage.quadratic_forms.all import (BinaryQF, - BinaryQF_reduced_representatives) +from sage.quadratic_forms.binary_qf import BinaryQF +from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives from sage.rings.number_field.number_field_element_base import NumberFieldElement_base from sage.structure.sage_object import SageObject from sage.structure.richcmp import (richcmp_method, richcmp, @@ -7179,7 +7179,7 @@ def _heegner_forms_list(self, D, beta=None, expected_count=None): beta = Integers(4*N)(D).sqrt(extend=False) else: assert beta**2 == Integers(4*N)(D) - from sage.quadratic_forms.all import BinaryQF + from sage.quadratic_forms.binary_qf import BinaryQF b = ZZ(beta) % (2*N) all = [] seen = [] diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 8f740751da4..a6166fe50ac 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -34,7 +34,7 @@ from sage.rings.polynomial.polynomial_ring import polygen from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.misc.cachefunc import cached_function diff --git a/src/sage/schemes/elliptic_curves/kraus.py b/src/sage/schemes/elliptic_curves/kraus.py index 98ec70ecb5a..79b7afa9c2c 100644 --- a/src/sage/schemes/elliptic_curves/kraus.py +++ b/src/sage/schemes/elliptic_curves/kraus.py @@ -52,7 +52,7 @@ # https://www.gnu.org/licenses/ ############################################################################## -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve def c4c6_nonsingular(c4, c6): diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 57367c515d4..fc213840120 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -123,7 +123,7 @@ def __init__(self, E, verbose=False): self._field = K = E.base_field() if K.absolute_degree() == 1: from sage.rings.rational_field import QQ - from sage.rings.polynomial.all import polygen + from sage.rings.polynomial.polynomial_ring import polygen self._Kpol = polygen(QQ) else: self._Kpol = K.defining_polynomial() @@ -200,7 +200,7 @@ def add_reductions(self, q): self._reductions[q] = redmodq = dict() if q.divides(self._N) or q.divides(self._D): return - from sage.schemes.elliptic_curves.all import EllipticCurve + from sage.schemes.elliptic_curves.constructor import EllipticCurve for amodq in sorted(self._Kpol.roots(GF(q), multiplicities=False)): Eq = EllipticCurve([reduce_mod_q(ai, amodq) for ai in self._curve.ainvs()]) nq = Eq.cardinality() diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index ad3b7d59a53..bf843ba1ecd 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -32,7 +32,7 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.big_oh import O from sage.rings.power_series_ring import PowerSeriesRing from sage.rings.laurent_series_ring import LaurentSeriesRing diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py index 5eab9f7237a..a55a93dd996 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py @@ -9,7 +9,7 @@ import sage.rings.abc -from sage.rings.padics.all import pAdicField +from sage.rings.padics.factory import Qp as pAdicField from sage.schemes.curves.projective_curve import ProjectivePlaneCurve_field diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 0020c79393b..ece985101c8 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -70,7 +70,7 @@ from sage.rings.ring import IntegralDomain from sage.rings.infinity import Infinity from sage.rings.laurent_series_ring import is_LaurentSeriesRing -from sage.rings.padics.all import pAdicField +from sage.rings.padics.factory import Qp as pAdicField from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.ring import CommutativeAlgebra from sage.schemes.elliptic_curves.constructor import EllipticCurve diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index d41c35c5a7b..71c355d20f8 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -1056,7 +1056,7 @@ def factor(self): [z2 : z1 : z0 : z0] """ phi_i, phi_b, phi_s = self.fan_morphism().factor() - from sage.schemes.toric.all import ToricVariety + from sage.schemes.toric.variety import ToricVariety X = self.domain() X_s = ToricVariety(phi_s.codomain_fan()) X_i = ToricVariety(phi_i.domain_fan()) diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 77fae4b7545..44b62b2d89d 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -227,7 +227,7 @@ def fiber(self): sage: T_P2.fiber() Vector space of dimension 2 over Rational Field """ - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace return VectorSpace(self.base_ring(), self.rank()) def rank(self): @@ -702,7 +702,7 @@ def cohomology(self, degree=None, weight=None, dim=False): H^*i(P^2, TP^2)_M(1, -1) = (1, 0, 0) H^*i(P^2, TP^2)_M(1, 0) = (1, 0, 0) """ - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule if weight is None: raise NotImplementedError('sum over weights is not implemented') else: diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index 552a91093d6..0488c9e50d2 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -141,7 +141,7 @@ from sage.rings.infinity import Infinity from sage.modules.free_module_element import vector from sage.geometry.polyhedron.ppl_lattice_polytope import LatticePolytope_PPL -from sage.rings.invariants.all import invariant_theory +from sage.rings.invariants.invariant_theory import invariant_theory ###################################################################### diff --git a/src/sage/topology/cell_complex.py b/src/sage/topology/cell_complex.py index 6c18440b90e..24379a7ca7b 100644 --- a/src/sage/topology/cell_complex.py +++ b/src/sage/topology/cell_complex.py @@ -544,7 +544,7 @@ def homology(self, dim=None, base_ring=ZZ, subcomplex=None, """ from sage.topology.cubical_complex import CubicalComplex from sage.topology.simplicial_complex import SimplicialComplex - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace from sage.homology.homology_group import HomologyGroup if dim is not None: From 3305e3511ccbb369712242fa62b66f425276a970 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 13:08:47 -0700 Subject: [PATCH 4/5] src/.relint.yml: Remove repetition of 'Hint:', no longer needed with current relint --- src/.relint.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/.relint.yml b/src/.relint.yml index 67211bc7414..acf727359fa 100644 --- a/src/.relint.yml +++ b/src/.relint.yml @@ -6,8 +6,8 @@ - name: 'python3: Python3 incompatible code' hint: | # ifilter, imap, izip # __metaclass__ - Hint: # update raise statements # except Exception, var - Hint: # six is no longer allowed + # update raise statements # except Exception, var + # six is no longer allowed pattern: '(import.*[, ]ifilter|import.*[, ]imap|import.*[, ]izip|^\s*raise\s*[A-Za-z]*Error\s*,|__metaclass__|except\s*[A-Za-z]\s*,|import six|from six import)' filePattern: .*[.](py|pyx|rst) @@ -20,9 +20,9 @@ - name: 'blocks: wrong syntax for blocks (INPUT, OUTPUT, EXAMPLES, NOTE, etc.)' hint: | # the correct syntax is .. SEEALSO:: - Hint: # TESTS and EXAMPLES should be plural, NOTE singular - Hint: # no :: after INPUT, OUTPUT, REFERENCE blocks - Hint: # no " :" at the end of lines + # TESTS and EXAMPLES should be plural, NOTE singular + # no :: after INPUT, OUTPUT, REFERENCE blocks + # no " :" at the end of lines pattern: '(\.\.SEE|SEE ALSO|SEEALSO:($|[^:])|^\s*TEST:|^\s*EXAMPLE:|^\s*NOTES:|^\s*[A-Z]*PUT::|^\s*REFERENCES?::$)' - name: 'trac_links: bad trac link' @@ -46,8 +46,8 @@ - name: 'namespace_pkg_all_import: import from .all of a namespace package' hint: | Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit - Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, - Hint: or use 'sage --fiximports' to fix automatically in the source file. + namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, + or use 'sage --fiximports' to fix automatically in the source file. # Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import' # imports from .all are allowed in all.py; also allow in some modules that need sage.all From 0234b304d87201d976dce2a74727290d41f7b970 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 17:12:44 -0700 Subject: [PATCH 5/5] src/sage/schemes/elliptic_curves/cm.py: Add missing import --- src/sage/schemes/elliptic_curves/cm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 908aedcac81..e836c900b91 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -248,6 +248,8 @@ def is_HCP(f, check_monic_irreducible=True): p = pmin-1 n = 0 from sage.arith.misc import next_prime + from sage.schemes.elliptic_curves.constructor import EllipticCurve + while True: p = next_prime(p) n += 1