From 8eb423f456f5c6ff3dee0407fff7c25067816538 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Tue, 22 Nov 2022 18:01:08 -0500 Subject: [PATCH 001/140] src/sage/modular/quasimodform/element.py: refactor weight, homogeneous_components and is_homogeneous --- src/sage/modular/quasimodform/element.py | 65 +++++++++++++++++++----- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index 340d8b0320e..a218e0b52a7 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -23,6 +23,7 @@ from sage.structure.richcmp import richcmp, op_NE, op_EQ from sage.rings.polynomial.polynomial_element import Polynomial +from sage.rings.integer_ring import ZZ class QuasiModularFormsElement(ModuleElement): r""" @@ -391,7 +392,7 @@ def weights_list(self): sage: QM(1/2).weights_list() [0] """ - return sorted(list(self.to_polynomial().homogeneous_components())) + return sorted(list(self.homogeneous_components().keys())) def is_homogeneous(self): r""" @@ -402,18 +403,31 @@ def is_homogeneous(self): EXAMPLES:: sage: QM = QuasiModularForms(1) - sage: (QM.0).is_homogeneous() + sage: E2, E4, E6 = QM.gens() + sage: (E2).is_homogeneous() True - sage: (QM.0 + QM.1).is_homogeneous() + sage: (E2 + E4).is_homogeneous() False - sage: (QM.0 * QM.1 + QM.2).is_homogeneous() + sage: (E2 * E4 + E6).is_homogeneous() True sage: QM(1).is_homogeneous() True - sage: (1 + QM.0).is_homogeneous() + sage: (1 + E2).is_homogeneous() False + sage: F = E6^3 + E4^4*E2 + (E4^2*E6)*E2^2 + (E4^3 + E6^2)*E2^3 + sage: F.is_homogeneous() + True """ - return len(self.weights_list()) == 1 + k = None + for i, c in enumerate(self._polynomial.coefficients(sparse=False)): + if c: + if not c.is_homogeneous(): + return False + if k is None: + k = c.weight() + 2*i + if c.weight() + 2*i != k: + return False + return True def weight(self): r""" @@ -436,9 +450,11 @@ def weight(self): ValueError: the given graded quasiform is not an homogeneous element """ if self.is_homogeneous(): - return self.to_polynomial().degree() + return (self._polynomial.leading_coefficient().weight() + + 2*self._polynomial.degree()) else: - raise ValueError("the given graded quasiform is not an homogeneous element") + raise ValueError("the given graded quasiform is not an homogeneous \ + element") def homogeneous_components(self): r""" @@ -452,15 +468,38 @@ def homogeneous_components(self): {2: 1 - 24*q - 72*q^2 - 96*q^3 - 168*q^4 - 144*q^5 + O(q^6)} sage: (QM.0 + QM.1 + QM.2).homogeneous_components() {2: 1 - 24*q - 72*q^2 - 96*q^3 - 168*q^4 - 144*q^5 + O(q^6), - 4: 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6), - 6: 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6)} + 4: 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6), + 6: 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6)} sage: (1 + QM.0).homogeneous_components() {0: 1, 2: 1 - 24*q - 72*q^2 - 96*q^3 - 168*q^4 - 144*q^5 + O(q^6)} + sage: QM5 = QuasiModularForms(Gamma1(3)) + sage: F = QM.1 + QM.1*QM.2 + QM.1*QM.0 + (QM.1 + QM.2^2)*QM.0^3 + sage: F.homogeneous_components() + {4: 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6), + 6: 1 + 216*q - 3672*q^2 - 62496*q^3 - 322488*q^4 - 1121904*q^5 + O(q^6), + 10: 2 - 168*q - 159624*q^2 - 3756192*q^3 - 103979976*q^4 - 315731952*q^5 + O(q^6), + 18: 1 - 1080*q + 294840*q^2 - 902880*q^3 - 452402280*q^4 + 105456816*q^5 + O(q^6)} + sage: F = QM.zero() + sage: F.homogeneous_components() + {0: 0} + sage: F = QM(42/13) + sage: F.homogeneous_components() + {0: 42/13} """ QM = self.parent() - poly_self = self.to_polynomial() - pol_hom_comp = poly_self.homogeneous_components() - return {k: QM.from_polynomial(pol) for k, pol in pol_hom_comp.items()} + if self.is_zero(): + return {ZZ(0): self} + components = {} + E2 = self.parent().weight_2_eisenstein_series() + for i, c in enumerate(self._polynomial.coefficients(sparse=False)): + if c: + forms = c._forms_dictionary + for k in forms.keys(): + try: + components[ZZ(k + 2*i)] += QM(forms[k]*(E2**(2*i))) + except KeyError: + components[ZZ(k + 2*i)] = QM(forms[k]*(E2**i)) + return components def serre_derivative(self): r""" From 99b851896820f351b2e21a8a1819b5efb04ba81d Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Tue, 22 Nov 2022 18:34:19 -0500 Subject: [PATCH 002/140] src/sage/modular/quasimodform/element.py: fix small mistake --- src/sage/modular/quasimodform/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index a218e0b52a7..cf0e8c39ee6 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -496,7 +496,7 @@ def homogeneous_components(self): forms = c._forms_dictionary for k in forms.keys(): try: - components[ZZ(k + 2*i)] += QM(forms[k]*(E2**(2*i))) + components[ZZ(k + 2*i)] += QM(forms[k]*(E2**i)) except KeyError: components[ZZ(k + 2*i)] = QM(forms[k]*(E2**i)) return components From da7e59874b0a61d9c45a6af71d61d1cf56a1a9d5 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Tue, 22 Nov 2022 18:36:56 -0500 Subject: [PATCH 003/140] src/sage/modular/quasimodform/element.py: fix doctest --- src/sage/modular/quasimodform/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index cf0e8c39ee6..e4d5ea75769 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -477,7 +477,7 @@ def homogeneous_components(self): sage: F.homogeneous_components() {4: 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6), 6: 1 + 216*q - 3672*q^2 - 62496*q^3 - 322488*q^4 - 1121904*q^5 + O(q^6), - 10: 2 - 168*q - 159624*q^2 - 3756192*q^3 - 103979976*q^4 - 315731952*q^5 + O(q^6), + 10: 2 - 96*q - 149040*q^2 - 4986240*q^3 - 67535952*q^4 - 538187328*q^5 + O(q^6), 18: 1 - 1080*q + 294840*q^2 - 902880*q^3 - 452402280*q^4 + 105456816*q^5 + O(q^6)} sage: F = QM.zero() sage: F.homogeneous_components() From d5c79a74eca01a18b348fe8b7264d52077cd0d33 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Sat, 26 Nov 2022 08:56:04 -0500 Subject: [PATCH 004/140] src/sage/modular/quasimodform/element.py: add continue statement in is_homogeneous --- src/sage/modular/quasimodform/element.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index e4d5ea75769..1a005a31ba7 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -425,6 +425,7 @@ def is_homogeneous(self): return False if k is None: k = c.weight() + 2*i + continue if c.weight() + 2*i != k: return False return True From 271d87dc934fc4af9d4125478e9b06bac3e1e993 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Sat, 26 Nov 2022 08:58:29 -0500 Subject: [PATCH 005/140] src/sage/modular/quasimodform/element.py: apply suggestion --- src/sage/modular/quasimodform/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index 1a005a31ba7..e144d475e9e 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -392,7 +392,7 @@ def weights_list(self): sage: QM(1/2).weights_list() [0] """ - return sorted(list(self.homogeneous_components().keys())) + return sorted(self.homogeneous_components().keys()) def is_homogeneous(self): r""" From 3723f2d699daa6641c58b196ed10a195fa920ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 Jan 2023 14:23:46 +0100 Subject: [PATCH 006/140] changing some Cannot to cannot in error messages --- src/sage/combinat/alternating_sign_matrix.py | 2 +- src/sage/combinat/decorated_permutation.py | 2 +- src/sage/combinat/derangements.py | 2 +- src/sage/combinat/posets/posets.py | 2 +- src/sage/cpython/wrapperdescr.pxd | 2 +- .../bounded_integer_sequences.pyx | 6 ++--- src/sage/geometry/lattice_polytope.py | 5 ++-- src/sage/geometry/polyhedron/parent.py | 2 +- src/sage/graphs/generic_graph.py | 2 +- src/sage/libs/giac/giac.pyx | 8 +++--- src/sage/libs/pari/convert_sage.pyx | 2 +- src/sage/libs/singular/function.pyx | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 2 +- src/sage/modules/free_module_element.pyx | 2 +- src/sage/modules/vector_rational_dense.pyx | 4 +-- src/sage/numerical/linear_functions.pyx | 4 +-- src/sage/rings/asymptotic/asymptotic_ring.py | 4 +-- src/sage/rings/complex_arb.pyx | 2 +- src/sage/rings/integer.pyx | 4 +-- src/sage/rings/number_field/number_field.py | 8 +++--- .../polynomial/multi_polynomial_ideal.py | 2 +- src/sage/rings/real_arb.pyx | 2 +- src/sage/rings/real_double.pyx | 2 +- src/sage/rings/real_mpfi.pyx | 4 +-- src/sage/rings/real_mpfr.pyx | 26 +++++++++---------- src/sage/schemes/generic/ambient_space.py | 2 +- src/sage/structure/coerce_maps.pyx | 2 +- src/sage/structure/element.pyx | 2 +- src/sage/symbolic/expression.pyx | 14 +++++----- src/sage/symbolic/ring.pyx | 2 +- src/sage/symbolic/series_impl.pxi | 4 +-- src/sage/symbolic/subring.py | 16 ++++++------ src/sage/symbolic/units.py | 10 +++---- 33 files changed, 78 insertions(+), 77 deletions(-) diff --git a/src/sage/combinat/alternating_sign_matrix.py b/src/sage/combinat/alternating_sign_matrix.py index c7c7317811c..2f708bdb791 100644 --- a/src/sage/combinat/alternating_sign_matrix.py +++ b/src/sage/combinat/alternating_sign_matrix.py @@ -1196,7 +1196,7 @@ def _element_constructor_(self, asm, check=True): if isinstance(asm, AlternatingSignMatrix): if asm.parent() is self: return asm - raise ValueError("Cannot convert between alternating sign matrices of different sizes") + raise ValueError("cannot convert between alternating sign matrices of different sizes") try: m = self._matrix_space(asm) except (TypeError, ValueError): diff --git a/src/sage/combinat/decorated_permutation.py b/src/sage/combinat/decorated_permutation.py index 44ebba094b4..98f2079b482 100644 --- a/src/sage/combinat/decorated_permutation.py +++ b/src/sage/combinat/decorated_permutation.py @@ -212,7 +212,7 @@ def _element_constructor_(self, pi, check=True): if isinstance(pi, DecoratedPermutation): if pi.parent() is self: return pi - raise ValueError("Cannot convert between decorated permutations of different sizes") + raise ValueError("cannot convert between decorated permutations of different sizes") pi = tuple(pi) if check and pi not in self: diff --git a/src/sage/combinat/derangements.py b/src/sage/combinat/derangements.py index 00bdeca728c..d64f42bb064 100644 --- a/src/sage/combinat/derangements.py +++ b/src/sage/combinat/derangements.py @@ -198,7 +198,7 @@ def _element_constructor_(self, der): if isinstance(der, Derangement): if der.parent() is self: return der - raise ValueError("Cannot convert %s to an element of %s" % (der, self)) + raise ValueError("cannot convert %s to an element of %s" % (der, self)) return self.element_class(self, der) Element = Derangement diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 2836d59d960..e751015c891 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -1603,7 +1603,7 @@ def linear_extensions(self, facade=False): sage: L([1, 2, 3, 4, 6, 12]) Traceback (most recent call last): ... - TypeError: Cannot convert list to sage.structure.element.Element + TypeError: cannot convert list to sage.structure.element.Element EXAMPLES:: diff --git a/src/sage/cpython/wrapperdescr.pxd b/src/sage/cpython/wrapperdescr.pxd index fe0a0618a17..cda45bd46d7 100644 --- a/src/sage/cpython/wrapperdescr.pxd +++ b/src/sage/cpython/wrapperdescr.pxd @@ -59,6 +59,6 @@ cdef inline wrapperbase* get_slotdef(wrapper_descriptor slotwrapper) except NULL sage: py_get_slotdef(X.__eq__) Traceback (most recent call last): ... - TypeError: Cannot convert ... to wrapper_descriptor + TypeError: cannot convert ... to wrapper_descriptor """ return slotwrapper.d_base diff --git a/src/sage/data_structures/bounded_integer_sequences.pyx b/src/sage/data_structures/bounded_integer_sequences.pyx index 724f296eae2..6ebfcad7dbc 100644 --- a/src/sage/data_structures/bounded_integer_sequences.pyx +++ b/src/sage/data_structures/bounded_integer_sequences.pyx @@ -1208,11 +1208,11 @@ cdef class BoundedIntegerSequence: sage: T+list(S) Traceback (most recent call last): ... - TypeError: Cannot convert list to sage.data_structures.bounded_integer_sequences.BoundedIntegerSequence + TypeError: cannot convert list to sage.data_structures.bounded_integer_sequences.BoundedIntegerSequence sage: T+None Traceback (most recent call last): ... - TypeError: Cannot concatenate bounded integer sequence and None + TypeError: cannot concatenate bounded integer sequence and None TESTS: @@ -1228,7 +1228,7 @@ cdef class BoundedIntegerSequence: """ cdef BoundedIntegerSequence myself, right, out if other is None or self is None: - raise TypeError('Cannot concatenate bounded integer sequence and None') + raise TypeError('cannot concatenate bounded integer sequence and None') myself = self # may result in a type error right = other # --"-- if right.data.itembitsize != myself.data.itembitsize: diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index 0b30f206cbe..ac2db45cda8 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -5251,8 +5251,8 @@ def from_palp_index(i): elif o in range(65, 91): i = o - 28 else: - raise ValueError('Cannot convert PALP index ' - + i + ' to number.') + raise ValueError('cannot convert PALP index ' + + i + ' to number') return i n = len(permutation) domain = [from_palp_index(i) for i in permutation] @@ -5261,6 +5261,7 @@ def from_palp_index(i): S = SymmetricGroup(n) return make_permgroup_element(S, domain) + def _read_nef_x_partitions(data): r""" Read all nef-partitions for one polytope from a string or an open diff --git a/src/sage/geometry/polyhedron/parent.py b/src/sage/geometry/polyhedron/parent.py index 2b87a343b41..47642cbd4ca 100644 --- a/src/sage/geometry/polyhedron/parent.py +++ b/src/sage/geometry/polyhedron/parent.py @@ -697,7 +697,7 @@ def convert_base_ring_Hrep(lstlst): return self._element_constructor_polyhedron(polyhedron, mutable=mutable, **kwds) if nargs == 1 and args[0] == 0: return self.zero() - raise ValueError('Cannot convert to polyhedron object.') + raise ValueError('cannot convert to polyhedron object') def _element_constructor_polyhedron(self, polyhedron, **kwds): """ diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index fa48183ecc4..f12e15aea86 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2414,7 +2414,7 @@ def weighted_adjacency_matrix(self, sparse=True, vertices=None, sage: G.weighted_adjacency_matrix() Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.structure.parent.Parent + TypeError: cannot convert NoneType to sage.structure.parent.Parent """ if self.has_multiple_edges(): raise NotImplementedError("don't know how to represent weights for a multigraph") diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx index 4e451dba5e7..bafe99983af 100644 --- a/src/sage/libs/giac/giac.pyx +++ b/src/sage/libs/giac/giac.pyx @@ -1409,7 +1409,7 @@ cdef class Pygen(GiacMethods_base): return result else: - raise TypeError("Cannot convert non giac integers to Integer") + raise TypeError("cannot convert non giac integers to Integer") def _rational_(self,Z=None): @@ -1434,7 +1434,7 @@ cdef class Pygen(GiacMethods_base): # giac _RAT_ return ZZ(self.numer()) / ZZ(self.denom()) else: - raise TypeError("Cannot convert non giac _FRAC_ to QQ") + raise TypeError("cannot convert non giac _FRAC_ to QQ") def sage(self): @@ -1736,7 +1736,7 @@ cdef class Pygen(GiacMethods_base): sig_off() return result else: - raise TypeError("Cannot convert non _INT_ giac gen") + raise TypeError("cannot convert non _INT_ giac gen") property _double: # immediate double (type _DOUBLE_) @@ -1750,7 +1750,7 @@ cdef class Pygen(GiacMethods_base): sig_off() return result else: - raise TypeError("Cannot convert non _DOUBLE_ giac gen") + raise TypeError("cannot convert non _DOUBLE_ giac gen") property help: def __get__(self): diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx index 62fe5185cfb..96bce94ad5f 100644 --- a/src/sage/libs/pari/convert_sage.pyx +++ b/src/sage/libs/pari/convert_sage.pyx @@ -352,7 +352,7 @@ cpdef set_integer_from_gen(Integer self, Gen x): break elif paritype == t_PADIC: if x._valp() < 0: - raise TypeError("Cannot convert p-adic with negative valuation to an integer") + raise TypeError("cannot convert p-adic with negative valuation to an integer") # Lifting a PADIC yields an integer x = x.lift() break diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx index 8c4536f298a..03e330c013a 100644 --- a/src/sage/libs/singular/function.pyx +++ b/src/sage/libs/singular/function.pyx @@ -1304,7 +1304,7 @@ cdef class SingularFunction(SageObject): dummy_ring = PolynomialRing(QQ, "dummy", implementation="singular") # seems a reasonable default ring = dummy_ring if not (isinstance(ring, MPolynomialRing_libsingular) or isinstance(ring, NCPolynomialRing_plural)): - raise TypeError("Cannot call Singular function '%s' with ring parameter of type '%s'"%(self._name,type(ring))) + raise TypeError("cannot call Singular function '%s' with ring parameter of type '%s'" % (self._name,type(ring))) return call_function(self, args, ring, interruptible, attributes) def _instancedoc_(self): diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index a87ed8d6234..66bdaed3b67 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -948,7 +948,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sage: None^M Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.matrix.matrix_integer_dense.Matrix_integer_dense + TypeError: cannot convert NoneType to sage.matrix.matrix_integer_dense.Matrix_integer_dense sage: M^M Traceback (most recent call last): ... diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 54783c509bb..89e5395a2ac 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2570,7 +2570,7 @@ cdef class FreeModuleElement(Vector): # abstract base class sage: v.dot_product('junk') Traceback (most recent call last): ... - TypeError: Cannot convert str to sage.modules.free_module_element.FreeModuleElement + TypeError: cannot convert str to sage.modules.free_module_element.FreeModuleElement The degrees of the arguments must match. :: diff --git a/src/sage/modules/vector_rational_dense.pyx b/src/sage/modules/vector_rational_dense.pyx index ff1b4914295..1987e881151 100644 --- a/src/sage/modules/vector_rational_dense.pyx +++ b/src/sage/modules/vector_rational_dense.pyx @@ -326,7 +326,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_set_z(a.value, (left).value) else: # should not happen - raise TypeError("Cannot convert %s to %s" % (type(left).__name__, Rational.__name__)) + raise TypeError("cannot convert %s to %s" % (type(left).__name__, Rational.__name__)) z = self._new_c() cdef Py_ssize_t i for i in range(self._degree): @@ -343,7 +343,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_set_z(a.value, (right).value) else: # should not happen - raise TypeError("Cannot convert %s to %s" % (type(right).__name__, Rational.__name__)) + raise TypeError("cannot convert %s to %s" % (type(right).__name__, Rational.__name__)) z = self._new_c() cdef Py_ssize_t i for i in range(self._degree): diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index a5c0c0336d0..9c34b41bd63 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -1212,7 +1212,7 @@ cdef class LinearConstraintsParent_class(Parent): sage: LinearConstraintsParent_class.__new__(LinearConstraintsParent_class, None) Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class + TypeError: cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class """ self._LF = linear_functions_parent # Do not use coercion framework for __richcmp__ @@ -1236,7 +1236,7 @@ cdef class LinearConstraintsParent_class(Parent): sage: LinearConstraintsParent(None) Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class + TypeError: cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class """ Parent.__init__(self) diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index 4c5deb5ce21..c5cdd5fecbb 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -4158,9 +4158,9 @@ def _element_constructor_(self, data, simplify=True, convert=True): elif is_PowerSeriesRing(P): raise NotImplementedError( - 'Cannot convert %s from the %s to an asymptotic expansion ' + 'cannot convert %s from the %s to an asymptotic expansion ' 'in %s, since growths at other points than +oo are not yet ' - 'supported.' % (data, P, self)) + 'supported' % (data, P, self)) # Delete lines above as soon as we can deal with growths # other than the that at going to +oo. from sage.rings.infinity import PlusInfinity diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 797f5122d40..78cbb61e304 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -947,7 +947,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): sage: CBF._sum_of_products([["a"]]) Traceback (most recent call last): ... - TypeError: Cannot convert str to sage.rings.complex_arb.ComplexBall + TypeError: cannot convert str to sage.rings.complex_arb.ComplexBall """ cdef ComplexBall res = ComplexBall.__new__(ComplexBall) cdef ComplexBall factor diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 7cac3687e87..3e8a1f50b9d 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -571,7 +571,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: ZZ(pari(Qp(11)(11^-7))) Traceback (most recent call last): ... - TypeError: Cannot convert p-adic with negative valuation to an integer + TypeError: cannot convert p-adic with negative valuation to an integer Test converting a list with a very large base:: @@ -640,7 +640,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): if n == x: mpz_set_pylong(self.value, n) else: - raise TypeError("Cannot convert non-integral float to integer") + raise TypeError("cannot convert non-integral float to integer") elif isinstance(x, pari_gen): global set_integer_from_gen diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index fbdd43dfabb..282938490ee 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -8062,7 +8062,7 @@ def _coerce_from_other_number_field(self, x): sage: L(a) Traceback (most recent call last): ... - ValueError: Cannot convert a to Number Field in b with defining polynomial x^3 - 4*x + 1 with b = 1.860805853111704? (using the specified embeddings) + ValueError: cannot convert a to Number Field in b with defining polynomial x^3 - 4*x + 1 with b = 1.860805853111704? (using the specified embeddings) Subfields automatically come with an embedding:: @@ -8155,7 +8155,7 @@ def _coerce_from_other_number_field(self, x): f = x.minpoly() ys = f.roots(ring=K, multiplicities=False) if not ys: - raise ValueError("Cannot convert %s to %s (regardless of embeddings)" % (x, K)) + raise ValueError("cannot convert %s to %s (regardless of embeddings)" % (x, K)) # Define a function are_roots_equal to determine whether two # roots of f are equal. A simple a == b does not suffice for @@ -8212,7 +8212,7 @@ def _coerce_from_other_number_field(self, x): emb_y = y.polynomial()(Kgen) if are_roots_equal(emb_x, emb_y): return y - raise ValueError("Cannot convert %s to %s (using the specified embeddings)" % (x, K)) + raise ValueError("cannot convert %s to %s (using the specified embeddings)" % (x, K)) def _coerce_map_from_(self, R): """ @@ -11219,7 +11219,7 @@ def _coerce_from_other_cyclotomic_field(self, x, only_canonical=False): if z == x: return self.zeta(m)**(r+1) z *= y - raise TypeError("Cannot coerce %s into %s" % (x, self)) + raise TypeError("cannot coerce %s into %s" % (x, self)) return self._element_class(self, x) def _coerce_from_gap(self, x): diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 7dc058a22f0..b91125541b0 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -2187,7 +2187,7 @@ def transformed_basis(self, algorithm="gwalk", other_ring=None, singular=singula return PolynomialSequence(nR, sorted([nR(f) for f in nIs],reverse=True), immutable=True) else: - raise TypeError("Cannot convert basis with given algorithm") + raise TypeError("cannot convert basis with given algorithm") @handle_AA_and_QQbar def elimination_ideal(self, variables, algorithm=None, *args, **kwds): diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 23a41c2bf6a..4521c3a0bb2 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -704,7 +704,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): sage: RBF._sum_of_products([["a"]]) Traceback (most recent call last): ... - TypeError: Cannot convert str to sage.rings.real_arb.RealBall + TypeError: cannot convert str to sage.rings.real_arb.RealBall """ cdef RealBall res = RealBall.__new__(RealBall) cdef RealBall factor diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index fa121ddf547..d5e753152f9 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -947,7 +947,7 @@ cdef class RealDoubleElement(FieldElement): sage: ZZ(RDF(-2345.67)) Traceback (most recent call last): ... - TypeError: Cannot convert non-integral float to integer + TypeError: cannot convert non-integral float to integer """ return Integer(self._value) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 5f1494000f7..ae0bf813b0f 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1177,11 +1177,11 @@ cdef class RealIntervalFieldElement(RingElement): sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, None) Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.rings.real_mpfi.RealIntervalField_class + TypeError: cannot convert NoneType to sage.rings.real_mpfi.RealIntervalField_class sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, ZZ) Traceback (most recent call last): ... - TypeError: Cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfi.RealIntervalField_class + TypeError: cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfi.RealIntervalField_class sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, RIF) [.. NaN ..] diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 096cba738c6..5efe4b1d948 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1337,11 +1337,11 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RealNumber.__new__(RealNumber, None) Traceback (most recent call last): ... - TypeError: Cannot convert NoneType to sage.rings.real_mpfr.RealField_class + TypeError: cannot convert NoneType to sage.rings.real_mpfr.RealField_class sage: RealNumber.__new__(RealNumber, ZZ) Traceback (most recent call last): ... - TypeError: Cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfr.RealField_class + TypeError: cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfr.RealField_class sage: RealNumber.__new__(RealNumber, RR) NaN """ @@ -2247,7 +2247,7 @@ cdef class RealNumber(sage.structure.element.RingElement): 100000000000000000 """ if not mpfr_number_p(self.value): - raise ValueError('Cannot convert infinity or NaN to Sage Integer') + raise ValueError('cannot convert infinity or NaN to Sage Integer') cdef Integer z = Integer() mpfr_get_z(z.value, self.value, MPFR_RNDZ) @@ -3236,7 +3236,7 @@ cdef class RealNumber(sage.structure.element.RingElement): <... 'int'> """ if not mpfr_number_p(self.value): - raise ValueError('Cannot convert infinity or NaN to Python int') + raise ValueError('cannot convert infinity or NaN to Python int') cdef Integer z = Integer() mpfr_get_z(z.value, self.value, MPFR_RNDZ) @@ -3352,7 +3352,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # as subject-to-change. if mpfr_nan_p(self.value) or mpfr_inf_p(self.value): - raise ValueError('Cannot convert NaN or infinity to Pari float') + raise ValueError('cannot convert NaN or infinity to Pari float') # wordsize for PARI cdef unsigned long wordsize = sizeof(long)*8 @@ -3678,14 +3678,14 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RR('nan').simplest_rational() Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number sage: RR('-infinity').simplest_rational() Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number """ if not mpfr_number_p(self.value): - raise ValueError('Cannot convert NaN or infinity to rational number') + raise ValueError('cannot convert NaN or infinity to rational number') if mpfr_zero_p(self.value): return Rational(0) @@ -3784,23 +3784,23 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RR('nan').nearby_rational(max_denominator=1000) Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number sage: RR('nan').nearby_rational(max_error=0.01) Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number sage: RR(oo).nearby_rational(max_denominator=1000) Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number sage: RR(oo).nearby_rational(max_error=0.01) Traceback (most recent call last): ... - ValueError: Cannot convert NaN or infinity to rational number + ValueError: cannot convert NaN or infinity to rational number """ if not mpfr_number_p(self.value): - raise ValueError('Cannot convert NaN or infinity to rational number') + raise ValueError('cannot convert NaN or infinity to rational number') if ((max_error is None and max_denominator is None) or (max_error is not None and max_denominator is not None)): diff --git a/src/sage/schemes/generic/ambient_space.py b/src/sage/schemes/generic/ambient_space.py index aa4645d4e88..0f9b9b55240 100644 --- a/src/sage/schemes/generic/ambient_space.py +++ b/src/sage/schemes/generic/ambient_space.py @@ -379,7 +379,7 @@ def dimension_absolute(self): base = self.base_scheme() if base.is_noetherian(): return self.dimension_relative() + base.dimension() - raise NotImplementedError("Cannot compute the dimension of this scheme.") + raise NotImplementedError("cannot compute the dimension of this scheme") dimension = dimension_absolute diff --git a/src/sage/structure/coerce_maps.pyx b/src/sage/structure/coerce_maps.pyx index 884ca57cabb..3128d149ad8 100644 --- a/src/sage/structure/coerce_maps.pyx +++ b/src/sage/structure/coerce_maps.pyx @@ -282,7 +282,7 @@ cdef class NamedConvertMap(Map): print(type(x), x) print(type(C), C) print(self.method_name) - raise TypeError("Cannot coerce {} to {}".format(x, C)) + raise TypeError(f"cannot coerce {x} to {C}") cdef Map m cdef Element e = method(C) if e is None: diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index e9430f0b086..8804637dc94 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -424,7 +424,7 @@ cdef class Element(SageObject): sage: q._set_parent(float) Traceback (most recent call last): ... - TypeError: Cannot convert type to sage.structure.parent.Parent + TypeError: cannot convert type to sage.structure.parent.Parent """ self._parent = parent diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 0e924c009d7..71c6d7a3a6a 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -1603,7 +1603,7 @@ cdef class Expression(Expression_abc): sage: x._eval_self(CC) Traceback (most recent call last): ... - TypeError: Cannot evaluate symbolic expression to a numeric value. + TypeError: cannot evaluate symbolic expression to a numeric value Check if we can compute a real evaluation even if the expression contains complex coefficients:: @@ -1644,7 +1644,7 @@ cdef class Expression(Expression_abc): ans = ans.real return R(ans) else: - raise TypeError("Cannot evaluate symbolic expression to a numeric value.") + raise TypeError("cannot evaluate symbolic expression to a numeric value") cpdef _convert(self, kwds): """ @@ -7064,7 +7064,7 @@ cdef class Expression(Expression_abc): sage: p.coefficients(x, sparse=False) Traceback (most recent call last): ... - ValueError: Cannot return dense coefficient list with noninteger exponents. + ValueError: cannot return dense coefficient list with noninteger exponents Series coefficients are now handled correctly (:trac:`17399`):: @@ -7126,12 +7126,12 @@ cdef class Expression(Expression_abc): else: from sage.rings.integer_ring import ZZ if any(not c[1] in ZZ for c in l): - raise ValueError("Cannot return dense coefficient list with noninteger exponents.") + raise ValueError("cannot return dense coefficient list with noninteger exponents") if not l: l = [[0, 0]] val = l[0][1] if val < 0: - raise ValueError("Cannot return dense coefficient list with negative valuation.") + raise ValueError("cannot return dense coefficient list with negative valuation") deg = l[-1][1] ret = [ZZ(0)] * int(deg+1) for c in l: @@ -8258,7 +8258,7 @@ cdef class Expression(Expression_abc): sage: (x^(1/3)).horner(x) Traceback (most recent call last): ... - ValueError: Cannot return dense coefficient list with noninteger exponents. + ValueError: cannot return dense coefficient list with noninteger exponents """ coef = self.coefficients(x, sparse=False) res = coef[-1] @@ -12092,7 +12092,7 @@ cdef class Expression(Expression_abc): sage: wrong.convert() Traceback (most recent call last): ... - ValueError: Cannot convert + ValueError: cannot convert """ from . import units return units.convert(self, target) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index 2036a7331d4..9ac88d7d375 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -1140,7 +1140,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): :doc:`subring` """ if self is not SR: - raise NotImplementedError('Cannot create subring of %s.' % (self,)) + raise NotImplementedError('cannot create subring of %s' % (self,)) from .subring import SymbolicSubring return SymbolicSubring(*args, **kwds) diff --git a/src/sage/symbolic/series_impl.pxi b/src/sage/symbolic/series_impl.pxi index 18c017066f6..4ddea0ffc6f 100644 --- a/src/sage/symbolic/series_impl.pxi +++ b/src/sage/symbolic/series_impl.pxi @@ -246,10 +246,10 @@ cdef class SymbolicSeries(Expression): else: from sage.rings.integer_ring import ZZ if any(not c[1] in ZZ for c in l): - raise ValueError("Cannot return dense coefficient list with noninteger exponents.") + raise ValueError("cannot return dense coefficient list with noninteger exponents") val = l[0][1] if val < 0: - raise ValueError("Cannot return dense coefficient list with negative valuation.") + raise ValueError("cannot return dense coefficient list with negative valuation") deg = l[-1][1] ret = [ZZ(0)] * int(deg+1) for c in l: diff --git a/src/sage/symbolic/subring.py b/src/sage/symbolic/subring.py index e30e29a16cf..05ec90861fd 100644 --- a/src/sage/symbolic/subring.py +++ b/src/sage/symbolic/subring.py @@ -181,33 +181,33 @@ def create_key_and_extra_args( sage: SymbolicSubring.create_key_and_extra_args() Traceback (most recent call last): ... - ValueError: Cannot create a symbolic subring since nothing is specified. + ValueError: cannot create a symbolic subring since nothing is specified sage: SymbolicSubring.create_key_and_extra_args( ....: accepting_variables=('a',), rejecting_variables=('r',)) Traceback (most recent call last): ... - ValueError: Cannot create a symbolic subring since input is ambiguous. + ValueError: cannot create a symbolic subring since input is ambiguous sage: SymbolicSubring.create_key_and_extra_args( ....: accepting_variables=('a',), no_variables=True) Traceback (most recent call last): ... - ValueError: Cannot create a symbolic subring since input is ambiguous. + ValueError: cannot create a symbolic subring since input is ambiguous sage: SymbolicSubring.create_key_and_extra_args( ....: rejecting_variables=('r',), no_variables=True) Traceback (most recent call last): ... - ValueError: Cannot create a symbolic subring since input is ambiguous. + ValueError: cannot create a symbolic subring since input is ambiguous """ if accepting_variables is None and \ rejecting_variables is None and \ not no_variables: - raise ValueError('Cannot create a symbolic subring ' - 'since nothing is specified.') + raise ValueError('cannot create a symbolic subring ' + 'since nothing is specified') if accepting_variables is not None and rejecting_variables is not None or \ rejecting_variables is not None and no_variables or \ no_variables and accepting_variables is not None: - raise ValueError('Cannot create a symbolic subring ' - 'since input is ambiguous.') + raise ValueError('cannot create a symbolic subring ' + 'since input is ambiguous') if accepting_variables is not None: vars = tuple(accepting_variables) diff --git a/src/sage/symbolic/units.py b/src/sage/symbolic/units.py index 9b5407786e1..5732f11ded3 100644 --- a/src/sage/symbolic/units.py +++ b/src/sage/symbolic/units.py @@ -61,7 +61,7 @@ sage: wrong.convert() Traceback (most recent call last): ... - ValueError: Cannot convert + ValueError: cannot convert TESTS: @@ -1434,12 +1434,12 @@ def convert_temperature(expr, target): sage: t.convert(units.length.foot) Traceback (most recent call last): ... - ValueError: Cannot convert + ValueError: cannot convert sage: wrong = units.length.meter*units.temperature.fahrenheit sage: wrong.convert() Traceback (most recent call last): ... - ValueError: Cannot convert + ValueError: cannot convert We directly call the convert_temperature function:: @@ -1449,7 +1449,7 @@ def convert_temperature(expr, target): 98.6000000000000 """ if len(expr.variables()) != 1: - raise ValueError("Cannot convert") + raise ValueError("cannot convert") elif target is None or unit_to_type[str(target)] == 'temperature': from sage.misc.sage_eval import sage_eval expr_temp = expr.variables()[0] @@ -1467,4 +1467,4 @@ def convert_temperature(expr, target): elif target_temp == units.temperature.rankine: return a[3]*target_temp else: - raise ValueError("Cannot convert") + raise ValueError("cannot convert") From d7af60d05d3ec88a6b8cf5c39d7273c51f9e6cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 Jan 2023 17:58:11 +0100 Subject: [PATCH 007/140] some fixes --- src/sage/combinat/posets/posets.py | 2 +- src/sage/cpython/wrapperdescr.pxd | 2 +- src/sage/data_structures/bounded_integer_sequences.pyx | 2 +- src/sage/graphs/generic_graph.py | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 2 +- src/sage/modules/free_module_element.pyx | 2 +- src/sage/numerical/linear_functions.pyx | 4 ++-- src/sage/rings/complex_arb.pyx | 2 +- src/sage/rings/polynomial/polynomial_element.pyx | 4 ++-- src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx | 4 ++-- src/sage/rings/real_arb.pyx | 2 +- src/sage/rings/real_mpfi.pyx | 2 +- src/sage/rings/real_mpfr.pyx | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index e751015c891..2836d59d960 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -1603,7 +1603,7 @@ def linear_extensions(self, facade=False): sage: L([1, 2, 3, 4, 6, 12]) Traceback (most recent call last): ... - TypeError: cannot convert list to sage.structure.element.Element + TypeError: Cannot convert list to sage.structure.element.Element EXAMPLES:: diff --git a/src/sage/cpython/wrapperdescr.pxd b/src/sage/cpython/wrapperdescr.pxd index cda45bd46d7..fe0a0618a17 100644 --- a/src/sage/cpython/wrapperdescr.pxd +++ b/src/sage/cpython/wrapperdescr.pxd @@ -59,6 +59,6 @@ cdef inline wrapperbase* get_slotdef(wrapper_descriptor slotwrapper) except NULL sage: py_get_slotdef(X.__eq__) Traceback (most recent call last): ... - TypeError: cannot convert ... to wrapper_descriptor + TypeError: Cannot convert ... to wrapper_descriptor """ return slotwrapper.d_base diff --git a/src/sage/data_structures/bounded_integer_sequences.pyx b/src/sage/data_structures/bounded_integer_sequences.pyx index 6ebfcad7dbc..d431c71f663 100644 --- a/src/sage/data_structures/bounded_integer_sequences.pyx +++ b/src/sage/data_structures/bounded_integer_sequences.pyx @@ -1208,7 +1208,7 @@ cdef class BoundedIntegerSequence: sage: T+list(S) Traceback (most recent call last): ... - TypeError: cannot convert list to sage.data_structures.bounded_integer_sequences.BoundedIntegerSequence + TypeError: Cannot convert list to sage.data_structures.bounded_integer_sequences.BoundedIntegerSequence sage: T+None Traceback (most recent call last): ... diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index f12e15aea86..fa48183ecc4 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2414,7 +2414,7 @@ def weighted_adjacency_matrix(self, sparse=True, vertices=None, sage: G.weighted_adjacency_matrix() Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.structure.parent.Parent + TypeError: Cannot convert NoneType to sage.structure.parent.Parent """ if self.has_multiple_edges(): raise NotImplementedError("don't know how to represent weights for a multigraph") diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 66bdaed3b67..a87ed8d6234 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -948,7 +948,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sage: None^M Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.matrix.matrix_integer_dense.Matrix_integer_dense + TypeError: Cannot convert NoneType to sage.matrix.matrix_integer_dense.Matrix_integer_dense sage: M^M Traceback (most recent call last): ... diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 89e5395a2ac..54783c509bb 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2570,7 +2570,7 @@ cdef class FreeModuleElement(Vector): # abstract base class sage: v.dot_product('junk') Traceback (most recent call last): ... - TypeError: cannot convert str to sage.modules.free_module_element.FreeModuleElement + TypeError: Cannot convert str to sage.modules.free_module_element.FreeModuleElement The degrees of the arguments must match. :: diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index 9c34b41bd63..a5c0c0336d0 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -1212,7 +1212,7 @@ cdef class LinearConstraintsParent_class(Parent): sage: LinearConstraintsParent_class.__new__(LinearConstraintsParent_class, None) Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class + TypeError: Cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class """ self._LF = linear_functions_parent # Do not use coercion framework for __richcmp__ @@ -1236,7 +1236,7 @@ cdef class LinearConstraintsParent_class(Parent): sage: LinearConstraintsParent(None) Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class + TypeError: Cannot convert NoneType to sage.numerical.linear_functions.LinearFunctionsParent_class """ Parent.__init__(self) diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 78cbb61e304..797f5122d40 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -947,7 +947,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): sage: CBF._sum_of_products([["a"]]) Traceback (most recent call last): ... - TypeError: cannot convert str to sage.rings.complex_arb.ComplexBall + TypeError: Cannot convert str to sage.rings.complex_arb.ComplexBall """ cdef ComplexBall res = ComplexBall.__new__(ComplexBall) cdef ComplexBall factor diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index d2649163d48..7d32957f571 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -8027,11 +8027,11 @@ cdef class Polynomial(CommutativeAlgebraElement): sage: f.roots(RR) Traceback (most recent call last): ... - TypeError: Cannot evaluate symbolic expression to a numeric value. + TypeError: cannot evaluate symbolic expression to a numeric value sage: f.roots(CC) Traceback (most recent call last): ... - TypeError: Cannot evaluate symbolic expression to a numeric value. + TypeError: cannot evaluate symbolic expression to a numeric value We can find roots of polynomials defined over `\ZZ` or `\QQ` over the `p`-adics, see :trac:`15422`:: diff --git a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx index 8fa744ff668..c13372dcd25 100644 --- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx @@ -85,12 +85,12 @@ cdef class PolynomialRealDense(Polynomial): sage: PolynomialRealDense(RR['x'], [1,a]) Traceback (most recent call last): ... - TypeError: Cannot evaluate symbolic expression to a numeric value. + TypeError: cannot evaluate symbolic expression to a numeric value sage: R. = SR[] sage: (x-a).change_ring(RR) Traceback (most recent call last): ... - TypeError: Cannot evaluate symbolic expression to a numeric value. + TypeError: cannot evaluate symbolic expression to a numeric value sage: sig_on_count() 0 diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 4521c3a0bb2..23a41c2bf6a 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -704,7 +704,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): sage: RBF._sum_of_products([["a"]]) Traceback (most recent call last): ... - TypeError: cannot convert str to sage.rings.real_arb.RealBall + TypeError: Cannot convert str to sage.rings.real_arb.RealBall """ cdef RealBall res = RealBall.__new__(RealBall) cdef RealBall factor diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index ae0bf813b0f..d67d817ce6e 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1177,7 +1177,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, None) Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.rings.real_mpfi.RealIntervalField_class + TypeError: Cannot convert NoneType to sage.rings.real_mpfi.RealIntervalField_class sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, ZZ) Traceback (most recent call last): ... diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 5efe4b1d948..7de872a7bfa 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1337,7 +1337,7 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RealNumber.__new__(RealNumber, None) Traceback (most recent call last): ... - TypeError: cannot convert NoneType to sage.rings.real_mpfr.RealField_class + TypeError: Cannot convert NoneType to sage.rings.real_mpfr.RealField_class sage: RealNumber.__new__(RealNumber, ZZ) Traceback (most recent call last): ... From 4a5a470798e5688060a07a0d5057922633d9a917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 Jan 2023 21:21:01 +0100 Subject: [PATCH 008/140] more fixes --- src/sage/rings/real_mpfi.pyx | 6 ++++-- src/sage/rings/real_mpfr.pyx | 4 ++-- src/sage/rings/universal_cyclotomic_field.py | 2 +- src/sage/structure/element.pyx | 12 ++++++------ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index d67d817ce6e..c2cb10a1061 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1181,7 +1181,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, ZZ) Traceback (most recent call last): ... - TypeError: cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfi.RealIntervalField_class + TypeError: Cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfi.RealIntervalField_class sage: RealIntervalFieldElement.__new__(RealIntervalFieldElement, RIF) [.. NaN ..] @@ -5356,7 +5356,8 @@ def __create__RealIntervalField_version0(prec, sci_not): """ return RealIntervalField(prec, sci_not) -## Keep all old versions!!! + +# Keep all old versions!!! def __create__RealIntervalFieldElement_version0(parent, x, base=10): """ For pickling. @@ -5368,6 +5369,7 @@ def __create__RealIntervalFieldElement_version0(parent, x, base=10): """ return RealIntervalFieldElement(parent, x, base=base) + def __create__RealIntervalFieldElement_version1(parent, lower, upper): """ For pickling. diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 7de872a7bfa..8911d4e0035 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1341,7 +1341,7 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RealNumber.__new__(RealNumber, ZZ) Traceback (most recent call last): ... - TypeError: cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfr.RealField_class + TypeError: Cannot convert sage.rings.integer_ring.IntegerRing_class to sage.rings.real_mpfr.RealField_class sage: RealNumber.__new__(RealNumber, RR) NaN """ @@ -6105,7 +6105,7 @@ def create_RealField(*args, **kwds): See http://trac.sagemath.org/24511 for details. Real Field with 53 bits of precision """ - #deprecation has already been imported in this file + # deprecation has already been imported in this file deprecation(24511, "Please import create_RealField from sage.rings.real_field") from sage.rings.real_field import create_RealField as cr return cr(*args, **kwds) diff --git a/src/sage/rings/universal_cyclotomic_field.py b/src/sage/rings/universal_cyclotomic_field.py index d238bce3450..0ef56bfd2d0 100644 --- a/src/sage/rings/universal_cyclotomic_field.py +++ b/src/sage/rings/universal_cyclotomic_field.py @@ -561,7 +561,7 @@ def to_cyclotomic_field(self, R=None): sage: CF(E(5)) # indirect doctest Traceback (most recent call last): ... - TypeError: Cannot coerce zeta5 into Cyclotomic Field of order 7 and + TypeError: cannot coerce zeta5 into Cyclotomic Field of order 7 and degree 6 sage: CF = CyclotomicField(10) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 8804637dc94..39a5791c48e 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -424,7 +424,7 @@ cdef class Element(SageObject): sage: q._set_parent(float) Traceback (most recent call last): ... - TypeError: cannot convert type to sage.structure.parent.Parent + TypeError: Cannot convert type to sage.structure.parent.Parent """ self._parent = parent @@ -4432,11 +4432,11 @@ def coerce_binop(method): Another real example:: - sage: R1=QQ['x,y'] - sage: R2=QQ['x,y,z'] - sage: f=R1(1) - sage: g=R1(2) - sage: h=R2(1) + sage: R1 = QQ['x,y'] + sage: R2 = QQ['x,y,z'] + sage: f = R1(1) + sage: g = R1(2) + sage: h = R2(1) sage: f.gcd(g) 1 sage: f.gcd(g,algorithm='modular') From a14d662aec9b9340385f0a92e7de92939e53c10c Mon Sep 17 00:00:00 2001 From: Alex Chandler Date: Sun, 29 Jan 2023 11:11:04 -0800 Subject: [PATCH 009/140] sage -fiximports src/sage/{categories,matrix,structure} --- src/sage/categories/bialgebras.py | 3 +- src/sage/categories/chain_complexes.py | 4 +- src/sage/categories/coalgebras.py | 2 +- src/sage/categories/coalgebras_with_basis.py | 4 +- .../examples/algebras_with_basis.py | 2 +- .../examples/commutative_additive_monoids.py | 2 +- .../commutative_additive_semigroups.py | 2 +- .../examples/finite_coxeter_groups.py | 2 +- .../finite_dimensional_algebras_with_basis.py | 2 +- ...ite_dimensional_lie_algebras_with_basis.py | 2 +- .../categories/examples/finite_monoids.py | 2 +- .../categories/examples/finite_weyl_groups.py | 2 +- .../examples/hopf_algebras_with_basis.py | 4 +- src/sage/categories/examples/lie_algebras.py | 2 +- src/sage/categories/examples/magmas.py | 2 +- src/sage/categories/examples/monoids.py | 2 +- src/sage/categories/examples/posets.py | 2 +- src/sage/categories/examples/semigroups.py | 2 +- .../categories/examples/semigroups_cython.pyx | 3 +- src/sage/categories/examples/sets_cat.py | 2 +- .../categories/examples/with_realizations.py | 4 +- .../finite_complex_reflection_groups.py | 4 +- ...inite_dimensional_bialgebras_with_basis.py | 2 +- ...inite_dimensional_coalgebras_with_basis.py | 2 +- src/sage/categories/graded_bialgebras.py | 2 +- .../graded_bialgebras_with_basis.py | 2 +- src/sage/categories/graded_hopf_algebras.py | 2 +- src/sage/categories/map.pyx | 2 +- src/sage/categories/monoid_algebras.py | 2 +- src/sage/categories/schemes.py | 2 +- src/sage/matrix/matrix2.pyx | 5 ++- src/sage/matrix/matrix_cdv.pyx | 2 +- src/sage/matrix/matrix_complex_ball_dense.pyx | 4 +- src/sage/matrix/matrix_cyclo_dense.pyx | 3 +- src/sage/matrix/matrix_integer_dense.pyx | 2 +- src/sage/matrix/matrix_integer_dense_hnf.py | 3 +- .../matrix/matrix_integer_dense_saturation.py | 3 +- .../matrix/matrix_modn_dense_template.pxi | 2 +- src/sage/matrix/matrix_modn_sparse.pyx | 2 +- src/sage/matrix/matrix_polynomial_dense.pyx | 44 +++++++++---------- src/sage/matrix/matrix_rational_dense.pyx | 2 +- src/sage/matrix/matrix_space.py | 3 +- src/sage/matrix/misc.pyx | 3 +- src/sage/structure/element.pyx | 4 +- src/sage/structure/set_factories_example.py | 2 +- 45 files changed, 85 insertions(+), 71 deletions(-) diff --git a/src/sage/categories/bialgebras.py b/src/sage/categories/bialgebras.py index e70914295af..441d924c964 100644 --- a/src/sage/categories/bialgebras.py +++ b/src/sage/categories/bialgebras.py @@ -10,7 +10,8 @@ # ***************************************************************************** from sage.categories.category_types import Category_over_base_ring -from sage.categories.all import Algebras, Coalgebras +from sage.categories.algebras import Algebras +from sage.categories.coalgebras import Coalgebras from sage.categories.super_modules import SuperModulesCategory from sage.misc.lazy_import import LazyImport diff --git a/src/sage/categories/chain_complexes.py b/src/sage/categories/chain_complexes.py index 531fc48e4cd..b1d8c578e60 100644 --- a/src/sage/categories/chain_complexes.py +++ b/src/sage/categories/chain_complexes.py @@ -46,7 +46,9 @@ def super_categories(self): [Category of modules over Ring of integers modulo 9] """ - from sage.categories.all import Fields, Modules, VectorSpaces + from sage.categories.fields import Fields + from sage.categories.modules import Modules + from sage.categories.vector_spaces import VectorSpaces base_ring = self.base_ring() if base_ring in Fields(): return [VectorSpaces(base_ring)] diff --git a/src/sage/categories/coalgebras.py b/src/sage/categories/coalgebras.py index 22a385d5f0d..3a7f8c6213a 100644 --- a/src/sage/categories/coalgebras.py +++ b/src/sage/categories/coalgebras.py @@ -10,7 +10,7 @@ # ***************************************************************************** from .category_types import Category_over_base_ring -from sage.categories.all import Modules +from sage.categories.modules import Modules from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring from sage.categories.tensor import TensorProductsCategory from sage.categories.dual import DualObjectsCategory diff --git a/src/sage/categories/coalgebras_with_basis.py b/src/sage/categories/coalgebras_with_basis.py index b672c37dd27..5518804d649 100644 --- a/src/sage/categories/coalgebras_with_basis.py +++ b/src/sage/categories/coalgebras_with_basis.py @@ -13,7 +13,9 @@ from sage.misc.lazy_attribute import lazy_attribute from sage.misc.lazy_import import LazyImport from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring -from sage.categories.all import ModulesWithBasis, tensor, Hom +from sage.categories.modules_with_basis import ModulesWithBasis +from sage.categories.tensor import tensor +from sage.categories.homset import Hom from sage.categories.super_modules import SuperModulesCategory from sage.categories.filtered_modules import FilteredModulesCategory diff --git a/src/sage/categories/examples/algebras_with_basis.py b/src/sage/categories/examples/algebras_with_basis.py index 7ad85cb82ed..f1d05839e2a 100644 --- a/src/sage/categories/examples/algebras_with_basis.py +++ b/src/sage/categories/examples/algebras_with_basis.py @@ -10,7 +10,7 @@ from sage.misc.cachefunc import cached_method from sage.sets.family import Family -from sage.categories.all import AlgebrasWithBasis +from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.combinat.free_module import CombinatorialFreeModule from sage.combinat.words.words import Words diff --git a/src/sage/categories/examples/commutative_additive_monoids.py b/src/sage/categories/examples/commutative_additive_monoids.py index 945826c22a5..7422604e8e9 100644 --- a/src/sage/categories/examples/commutative_additive_monoids.py +++ b/src/sage/categories/examples/commutative_additive_monoids.py @@ -10,7 +10,7 @@ from sage.misc.cachefunc import cached_method from sage.structure.parent import Parent -from sage.categories.all import CommutativeAdditiveMonoids +from sage.categories.commutative_additive_monoids import CommutativeAdditiveMonoids from .commutative_additive_semigroups import FreeCommutativeAdditiveSemigroup class FreeCommutativeAdditiveMonoid(FreeCommutativeAdditiveSemigroup): diff --git a/src/sage/categories/examples/commutative_additive_semigroups.py b/src/sage/categories/examples/commutative_additive_semigroups.py index ea2fde99bb4..fdda759869a 100644 --- a/src/sage/categories/examples/commutative_additive_semigroups.py +++ b/src/sage/categories/examples/commutative_additive_semigroups.py @@ -12,7 +12,7 @@ from sage.structure.parent import Parent from sage.structure.element_wrapper import ElementWrapper from sage.structure.unique_representation import UniqueRepresentation -from sage.categories.all import CommutativeAdditiveSemigroups +from sage.categories.commutative_additive_semigroups import CommutativeAdditiveSemigroups from sage.sets.family import Family class FreeCommutativeAdditiveSemigroup(UniqueRepresentation, Parent): diff --git a/src/sage/categories/examples/finite_coxeter_groups.py b/src/sage/categories/examples/finite_coxeter_groups.py index 71ca54c8a5b..c7937688ef8 100644 --- a/src/sage/categories/examples/finite_coxeter_groups.py +++ b/src/sage/categories/examples/finite_coxeter_groups.py @@ -11,7 +11,7 @@ from sage.misc.cachefunc import cached_method from sage.structure.parent import Parent from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import FiniteCoxeterGroups +from sage.categories.finite_coxeter_groups import FiniteCoxeterGroups from sage.structure.unique_representation import UniqueRepresentation from sage.misc.functional import is_odd, is_even from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix diff --git a/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py index a3721f106b7..f51b66c49dd 100644 --- a/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py @@ -9,7 +9,7 @@ #***************************************************************************** from sage.misc.cachefunc import cached_method -from sage.categories.all import FiniteDimensionalAlgebrasWithBasis +from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis from sage.combinat.free_module import CombinatorialFreeModule diff --git a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py index 306e0091e12..a975d902e14 100644 --- a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py @@ -10,7 +10,7 @@ from sage.misc.cachefunc import cached_method from sage.sets.family import Family -from sage.categories.all import LieAlgebras +from sage.categories.lie_algebras import LieAlgebras from sage.modules.free_module import FreeModule from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation diff --git a/src/sage/categories/examples/finite_monoids.py b/src/sage/categories/examples/finite_monoids.py index f61c28a4032..4d3e8fa7029 100644 --- a/src/sage/categories/examples/finite_monoids.py +++ b/src/sage/categories/examples/finite_monoids.py @@ -13,7 +13,7 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import Monoids +from sage.categories.monoids import Monoids from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ diff --git a/src/sage/categories/examples/finite_weyl_groups.py b/src/sage/categories/examples/finite_weyl_groups.py index a17a48c142e..535d5101101 100644 --- a/src/sage/categories/examples/finite_weyl_groups.py +++ b/src/sage/categories/examples/finite_weyl_groups.py @@ -11,7 +11,7 @@ from sage.misc.cachefunc import cached_method from sage.structure.parent import Parent from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import FiniteWeylGroups +from sage.categories.finite_weyl_groups import FiniteWeylGroups from sage.structure.unique_representation import UniqueRepresentation class SymmetricGroup(UniqueRepresentation, Parent): diff --git a/src/sage/categories/examples/hopf_algebras_with_basis.py b/src/sage/categories/examples/hopf_algebras_with_basis.py index 16bd866c9c6..35b61f3c085 100644 --- a/src/sage/categories/examples/hopf_algebras_with_basis.py +++ b/src/sage/categories/examples/hopf_algebras_with_basis.py @@ -10,9 +10,9 @@ from sage.misc.cachefunc import cached_method from sage.sets.family import Family -from sage.categories.all import HopfAlgebrasWithBasis +from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis from sage.combinat.free_module import CombinatorialFreeModule -from sage.categories.all import tensor +from sage.categories.tensor import tensor class MyGroupAlgebra(CombinatorialFreeModule): r""" diff --git a/src/sage/categories/examples/lie_algebras.py b/src/sage/categories/examples/lie_algebras.py index 3eafe0787f3..135a665cfa3 100644 --- a/src/sage/categories/examples/lie_algebras.py +++ b/src/sage/categories/examples/lie_algebras.py @@ -10,7 +10,7 @@ #from sage.misc.cachefunc import cached_method from sage.sets.family import Family -from sage.categories.all import LieAlgebras +from sage.categories.lie_algebras import LieAlgebras from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.structure.element_wrapper import ElementWrapper diff --git a/src/sage/categories/examples/magmas.py b/src/sage/categories/examples/magmas.py index 5139041cef0..a4858bc2606 100644 --- a/src/sage/categories/examples/magmas.py +++ b/src/sage/categories/examples/magmas.py @@ -15,7 +15,7 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import Magmas +from sage.categories.magmas import Magmas from sage.sets.family import Family diff --git a/src/sage/categories/examples/monoids.py b/src/sage/categories/examples/monoids.py index c2919a8cc28..7336c680bdf 100644 --- a/src/sage/categories/examples/monoids.py +++ b/src/sage/categories/examples/monoids.py @@ -11,7 +11,7 @@ from sage.misc.cachefunc import cached_method from sage.structure.parent import Parent from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import Monoids +from sage.categories.monoids import Monoids from .semigroups import FreeSemigroup from sage.sets.family import Family diff --git a/src/sage/categories/examples/posets.py b/src/sage/categories/examples/posets.py index 5041df19835..20f461860c9 100644 --- a/src/sage/categories/examples/posets.py +++ b/src/sage/categories/examples/posets.py @@ -10,7 +10,7 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from sage.categories.all import Posets +from sage.categories.posets import Posets from sage.structure.element_wrapper import ElementWrapper from sage.sets.set import Set, Set_object_enumerated from sage.sets.positive_integers import PositiveIntegers diff --git a/src/sage/categories/examples/semigroups.py b/src/sage/categories/examples/semigroups.py index 4c4d9a1f4df..5502215ef8a 100644 --- a/src/sage/categories/examples/semigroups.py +++ b/src/sage/categories/examples/semigroups.py @@ -12,7 +12,7 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.structure.element_wrapper import ElementWrapper -from sage.categories.all import Semigroups +from sage.categories.semigroups import Semigroups from sage.sets.family import Family class LeftZeroSemigroup(UniqueRepresentation, Parent): diff --git a/src/sage/categories/examples/semigroups_cython.pyx b/src/sage/categories/examples/semigroups_cython.pyx index ee7a03ddc82..b456c2868f8 100644 --- a/src/sage/categories/examples/semigroups_cython.pyx +++ b/src/sage/categories/examples/semigroups_cython.pyx @@ -4,7 +4,8 @@ Examples of semigroups in cython from sage.structure.parent cimport Parent from sage.structure.element cimport Element -from sage.categories.all import Category, Semigroups +from sage.categories.category import Category +from sage.categories.semigroups import Semigroups from sage.categories.examples.semigroups import LeftZeroSemigroup as LeftZeroSemigroupPython from cpython.object cimport PyObject_RichCompare diff --git a/src/sage/categories/examples/sets_cat.py b/src/sage/categories/examples/sets_cat.py index 93cc264580d..c4df13b1357 100644 --- a/src/sage/categories/examples/sets_cat.py +++ b/src/sage/categories/examples/sets_cat.py @@ -13,7 +13,7 @@ from sage.categories.sets_cat import Sets from sage.rings.integer import Integer, IntegerWrapper from sage.rings.integer_ring import IntegerRing -from sage.arith.all import is_prime +from sage.arith.misc import is_prime from sage.structure.unique_representation import UniqueRepresentation diff --git a/src/sage/categories/examples/with_realizations.py b/src/sage/categories/examples/with_realizations.py index 06e060f8925..2b75946b1d2 100644 --- a/src/sage/categories/examples/with_realizations.py +++ b/src/sage/categories/examples/with_realizations.py @@ -10,7 +10,9 @@ from sage.misc.cachefunc import cached_method from sage.misc.bindable_class import BindableClass -from sage.categories.all import Rings, Algebras, AlgebrasWithBasis +from sage.categories.rings import Rings +from sage.categories.algebras import Algebras +from sage.categories.algebras_with_basis import AlgebrasWithBasis from sage.categories.realizations import Category_realization_of_parent from sage.structure.unique_representation import UniqueRepresentation from sage.structure.parent import Parent diff --git a/src/sage/categories/finite_complex_reflection_groups.py b/src/sage/categories/finite_complex_reflection_groups.py index bb3df827890..e528f758dab 100644 --- a/src/sage/categories/finite_complex_reflection_groups.py +++ b/src/sage/categories/finite_complex_reflection_groups.py @@ -523,7 +523,7 @@ def base_change_matrix(self): [ 1 0] [E(4) 1] """ - from sage.matrix.all import Matrix + from sage.matrix.constructor import Matrix return Matrix(list(self.independent_roots())).inverse() class ElementMethods: @@ -1187,7 +1187,7 @@ def rational_catalan_number(self, p, polynomial=False): sage: W.rational_catalan_number(3, polynomial=True) q^6 + q^4 + q^3 + q^2 + 1 """ - from sage.arith.all import gcd + from sage.arith.misc import GCD as gcd from sage.combinat.q_analogues import q_int h = self.coxeter_number() diff --git a/src/sage/categories/finite_dimensional_bialgebras_with_basis.py b/src/sage/categories/finite_dimensional_bialgebras_with_basis.py index 086892237e6..02f1005e0de 100644 --- a/src/sage/categories/finite_dimensional_bialgebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_bialgebras_with_basis.py @@ -27,5 +27,5 @@ def FiniteDimensionalBialgebrasWithBasis(base_ring): sage: TestSuite(C).run() """ - from sage.categories.all import BialgebrasWithBasis + from sage.categories.bialgebras_with_basis import BialgebrasWithBasis return BialgebrasWithBasis(base_ring).FiniteDimensional() diff --git a/src/sage/categories/finite_dimensional_coalgebras_with_basis.py b/src/sage/categories/finite_dimensional_coalgebras_with_basis.py index 9d1eecf556d..60b135080da 100644 --- a/src/sage/categories/finite_dimensional_coalgebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_coalgebras_with_basis.py @@ -27,5 +27,5 @@ def FiniteDimensionalCoalgebrasWithBasis(base_ring): sage: TestSuite(C).run() """ - from sage.categories.all import CoalgebrasWithBasis + from sage.categories.coalgebras_with_basis import CoalgebrasWithBasis return CoalgebrasWithBasis(base_ring).FiniteDimensional() diff --git a/src/sage/categories/graded_bialgebras.py b/src/sage/categories/graded_bialgebras.py index 6c751db558b..eff325b320e 100644 --- a/src/sage/categories/graded_bialgebras.py +++ b/src/sage/categories/graded_bialgebras.py @@ -26,5 +26,5 @@ def GradedBialgebras(base_ring): sage: TestSuite(C).run() """ - from sage.categories.all import Bialgebras + from sage.categories.bialgebras import Bialgebras return Bialgebras(base_ring).Graded() diff --git a/src/sage/categories/graded_bialgebras_with_basis.py b/src/sage/categories/graded_bialgebras_with_basis.py index 326e32b735d..d1727c0f40c 100644 --- a/src/sage/categories/graded_bialgebras_with_basis.py +++ b/src/sage/categories/graded_bialgebras_with_basis.py @@ -26,5 +26,5 @@ def GradedBialgebrasWithBasis(base_ring): sage: TestSuite(C).run() """ - from sage.categories.all import BialgebrasWithBasis + from sage.categories.bialgebras_with_basis import BialgebrasWithBasis return BialgebrasWithBasis(base_ring).Graded() diff --git a/src/sage/categories/graded_hopf_algebras.py b/src/sage/categories/graded_hopf_algebras.py index ad350212725..c4d5a24e3fe 100644 --- a/src/sage/categories/graded_hopf_algebras.py +++ b/src/sage/categories/graded_hopf_algebras.py @@ -35,5 +35,5 @@ def GradedHopfAlgebras(base_ring): :class:`super Hopf algebras `. """ - from sage.categories.all import HopfAlgebras + from sage.categories.hopf_algebras import HopfAlgebras return HopfAlgebras(base_ring).Graded() diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 1bb34eabf3b..e9fb8e45709 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -1330,7 +1330,7 @@ cdef class Section(Map): To: Multivariate Polynomial Ring in x, y over Rational Field """ from sage.categories.homset import Hom - from sage.categories.all import SetsWithPartialMaps + from sage.categories.sets_with_partial_maps import SetsWithPartialMaps Map.__init__(self, Hom(map.codomain(), map.domain(), SetsWithPartialMaps())) self._inverse = map # TODO: Use this attribute somewhere! diff --git a/src/sage/categories/monoid_algebras.py b/src/sage/categories/monoid_algebras.py index f51a8d01ce1..a387d7f74f4 100644 --- a/src/sage/categories/monoid_algebras.py +++ b/src/sage/categories/monoid_algebras.py @@ -33,5 +33,5 @@ def MonoidAlgebras(base_ring): sage: TestSuite(MonoidAlgebras(ZZ)).run() """ - from sage.categories.all import Monoids + from sage.categories.monoids import Monoids return Monoids().Algebras(base_ring) diff --git a/src/sage/categories/schemes.py b/src/sage/categories/schemes.py index df2ec0603cf..aad5a48b7e9 100644 --- a/src/sage/categories/schemes.py +++ b/src/sage/categories/schemes.py @@ -140,7 +140,7 @@ def _call_(self, x): from sage.categories.commutative_rings import CommutativeRings from sage.schemes.generic.spec import Spec from sage.categories.map import Map - from sage.categories.all import Rings + from sage.categories.rings import Rings if x in CommutativeRings(): return Spec(x) elif isinstance(x, Map) and x.category_for().is_subcategory(Rings()): diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 4de83f9c2b1..a94ebc9170b 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -86,7 +86,8 @@ from sage.structure.coerce cimport coercion_model from sage.structure.element import is_Vector from sage.structure.element cimport have_same_parent from sage.misc.verbose import verbose, get_verbose -from sage.categories.all import Fields, IntegralDomains +from sage.categories.fields import Fields +from sage.categories.integral_domains import IntegralDomains from sage.rings.ring import is_Ring from sage.rings.number_field.number_field_base import is_NumberField from sage.rings.integer_ring import ZZ, is_IntegerRing @@ -16821,7 +16822,7 @@ cdef class Matrix(Matrix1): ... ValueError: 'subdivide' keyword must be True or False, not garbage """ - from sage.arith.all import gcd + from sage.arith.misc import GCD as gcd import sage.rings.polynomial.polynomial_ring_constructor from sage.matrix.constructor import (block_diagonal_matrix, companion_matrix) diff --git a/src/sage/matrix/matrix_cdv.pyx b/src/sage/matrix/matrix_cdv.pyx index a964b242c0f..43421c74cb9 100644 --- a/src/sage/matrix/matrix_cdv.pyx +++ b/src/sage/matrix/matrix_cdv.pyx @@ -30,7 +30,7 @@ cpdef hessenbergize_cdvf(Matrix_generic_dense H): a complete discrete valuation field. The pivot on each column is always chosen - with maximal relative precision, which ensures + with maximal relative precision, which ensures the numerical stability of the algorithm. TESTS:: diff --git a/src/sage/matrix/matrix_complex_ball_dense.pyx b/src/sage/matrix/matrix_complex_ball_dense.pyx index 2269af40b05..e2ccc0eaa32 100644 --- a/src/sage/matrix/matrix_complex_ball_dense.pyx +++ b/src/sage/matrix/matrix_complex_ball_dense.pyx @@ -776,7 +776,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): EXAMPLES:: sage: from sage.matrix.benchmark import hilbert_matrix - sage: mat = hilbert_matrix(3).change_ring(CBF) + sage: mat = hilbert_matrix(3).change_ring(CBF) sage: eigval, eigvec, _ = mat.eigenvectors_right_approx()[0] doctest:...: FutureWarning: This class/method/function is marked as experimental. ... @@ -834,7 +834,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): EXAMPLES:: sage: from sage.matrix.benchmark import hilbert_matrix - sage: mat = hilbert_matrix(3).change_ring(CBF) + sage: mat = hilbert_matrix(3).change_ring(CBF) sage: eigval, eigvec, _ = mat.eigenvectors_right()[0] doctest:...: FutureWarning: This class/method/function is marked as experimental. ... diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index 55e1b7d739e..ddbeb4360b7 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -67,7 +67,8 @@ from .misc import matrix_integer_dense_rational_reconstruction from sage.rings.rational_field import QQ from sage.rings.integer_ring import ZZ -from sage.arith.all import previous_prime, binomial +from sage.arith.misc import previous_prime +from sage.arith.misc import binomial from sage.rings.real_mpfr import create_RealNumber as RealNumber from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index a87ed8d6234..a55a974e0e6 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -78,7 +78,7 @@ from sage.modules.vector_integer_dense cimport Vector_integer_dense from sage.misc.misc import cputime from sage.misc.verbose import verbose, get_verbose -from sage.arith.all import previous_prime +from sage.arith.misc import previous_prime from sage.arith.long cimport integer_check_long_py from sage.arith.power cimport generic_power from sage.structure.element cimport Element diff --git a/src/sage/matrix/matrix_integer_dense_hnf.py b/src/sage/matrix/matrix_integer_dense_hnf.py index acdb0f09cc4..1eacb6e5648 100644 --- a/src/sage/matrix/matrix_integer_dense_hnf.py +++ b/src/sage/matrix/matrix_integer_dense_hnf.py @@ -15,7 +15,8 @@ from sage.rings.integer_ring import ZZ from sage.rings.real_mpfr import RR from sage.rings.integer import Integer -from sage.arith.all import previous_prime, CRT_list +from sage.arith.misc import previous_prime +from sage.arith.misc import CRT_list def max_det_prime(n): diff --git a/src/sage/matrix/matrix_integer_dense_saturation.py b/src/sage/matrix/matrix_integer_dense_saturation.py index a7ce81fc86a..63233d247b5 100644 --- a/src/sage/matrix/matrix_integer_dense_saturation.py +++ b/src/sage/matrix/matrix_integer_dense_saturation.py @@ -4,7 +4,8 @@ from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF -from sage.arith.all import binomial, gcd +from sage.arith.misc import binomial +from sage.arith.misc import GCD as gcd from sage.matrix.constructor import identity_matrix, random_matrix from sage.misc.verbose import verbose from sage.misc.randstate import current_randstate diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index b80dcb7da3a..ba2a8af3e8d 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -109,7 +109,7 @@ from libc.stdio cimport snprintf from sage.modules.vector_modn_dense cimport Vector_modn_dense -from sage.arith.all import is_prime +from sage.arith.misc import is_prime from sage.structure.element cimport (Element, Vector, Matrix, ModuleElement, RingElement) from sage.matrix.matrix_dense cimport Matrix_dense diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index 24f2f207f33..f585563886b 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -113,7 +113,7 @@ from sage.misc.verbose import verbose, get_verbose from sage.matrix.matrix2 import Matrix as Matrix2 from .args cimport SparseEntry, MatrixArgs_init -from sage.arith.all import is_prime +from sage.arith.misc import is_prime from sage.structure.element import is_Vector diff --git a/src/sage/matrix/matrix_polynomial_dense.pyx b/src/sage/matrix/matrix_polynomial_dense.pyx index 92502d9632b..cc44242131f 100644 --- a/src/sage/matrix/matrix_polynomial_dense.pyx +++ b/src/sage/matrix/matrix_polynomial_dense.pyx @@ -224,7 +224,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): return self.apply_map(lambda x: x.degree()) from sage.matrix.constructor import matrix zero_degree = min(shifts) - 1 - if row_wise: + if row_wise: return matrix( ZZ, [[ self[i,j].degree() + shifts[j] if self[i,j] != 0 else zero_degree for j in range(self.ncols()) ] for i in range(self.nrows())] ) @@ -1116,7 +1116,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): The row degrees of an empty matrix (`0\times n` or `m\times 0`) is not defined:: - + sage: M = Matrix( pR, 0, 3 ) sage: M.row_degrees() Traceback (most recent call last): @@ -1215,7 +1215,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): n}`. Working row-wise and without shifts, its leading matrix is the matrix in `\Bold{K}^{m \times n}` formed by the leading coefficients of the entries of `M` which reach the degree of the corresponding row. - + More precisely, if working row-wise, let `s_1,\ldots,s_n \in \ZZ` be a shift, and let `(d_1,\ldots,d_m)` denote the shifted row degrees of `M`. Then, the shifted leading matrix of `M` is the matrix in @@ -1239,7 +1239,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): OUTPUT: a matrix over the base field. REFERENCES: - + [Wol1974]_ (Section 2.5, without shifts) and [VBB1992]_ (Section 3). EXAMPLES:: @@ -1335,7 +1335,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): False .. SEEALSO:: - + :meth:`is_popov` . """ if include_zero_vectors: @@ -1385,7 +1385,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): OUTPUT: a boolean value. REFERENCES: - + [Wol1974]_ (Section 2.5, without shifts) and [VBB1992]_ (Section 3). EXAMPLES:: @@ -1441,7 +1441,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): this vector is the index `j` of the rightmost nonzero entry `p_j` such that `\deg(p_j) + s_j` is equal to the shifted row degree of the vector. Then the pivot degree of the vector is the degree `\deg(p_j)`. - + For the zero row, both the leading positions and degree are `-1`. For a `m \times n` polynomial matrix, the leading positions and pivot degrees are the two lists containing the leading positions and the @@ -1465,7 +1465,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): of integers otherwise. REFERENCES: - + [Kai1980]_ (Section 6.7.2, without shifts). EXAMPLES:: @@ -1541,7 +1541,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): self[i,pivot_index[i]].degree()) for i in range(self.nrows()) ] return (pivot_index,pivot_degree) if return_degree else pivot_index - + # now in the column-wise case column_degrees = self.column_degrees(shifts) if shifts is None: @@ -1595,7 +1595,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): OUTPUT: a boolean. REFERENCES: - + [Kai1980]_ (Section 6.7.2, square case without shifts), [MS2003]_ (without shifts), [BLV1999]_ . @@ -1646,7 +1646,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): sage: M = Matrix([ ....: [ 6*x+4, 0, 5*x+1, 0], ....: [ 2, 5*x + 1, 6*x^2+3*x+1, 0], - ....: [2*x^2+5*x+5, 1, 2*x^3+4*x^2+6*x+4, 0] + ....: [2*x^2+5*x+5, 1, 2*x^3+4*x^2+6*x+4, 0] ....: ]) sage: M.is_weak_popov(shifts=[2,1,0], row_wise=False, ordered=True) True @@ -1724,7 +1724,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): OUTPUT: a boolean. REFERENCES: - + For the square case, without shifts: [Pop1972]_ and [Kai1980]_ (Section 6.7.2). For the general case: [BLV2006]_ . @@ -1908,7 +1908,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): False .. SEEALSO:: - + :meth:`hermite_form` . """ # shift for lower echelon @@ -2564,7 +2564,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): - the Hermite normal form `H` of this matrix `A` . - (optional) transformation matrix `U` such that `UA = H` . - + EXAMPLES:: sage: M. = GF(7)[] @@ -2594,7 +2594,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): True .. SEEALSO:: - + :meth:`is_hermite` , :meth:`popov_form` . """ @@ -2923,7 +2923,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): return (self.parent().zero().__copy__(), self) # Step 1: reverse input matrices # Brev = B(1/x) diag(x^(cdeg[i])) - # Arev = A(1/x) diag(x^(d+cdeg[i]-1)) + # Arev = A(1/x) diag(x^(d+cdeg[i]-1)) Brev = B.reverse(degree=cdeg, row_wise=False) Arev = self.reverse(degree=[d+c-1 for c in cdeg], row_wise=False) # Step 2: compute quotient @@ -2953,7 +2953,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): and such a quotient and remainder is returned by the method. Or this matrix equation has no solution and this method fails: this raises ``ValueError``; however this is not a proof that there is no valid - division with remainder (see the last example below). + division with remainder (see the last example below). EXAMPLES:: @@ -3245,12 +3245,12 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return ``True`` if and only if this matrix is an approximant basis in ``shifts``-ordered weak Popov form for the polynomial matrix ``pmat`` at order ``order``. - + If ``normal_form`` is ``True``, then the polynomial matrix must furthermore be in ``shifts``-Popov form. An error is raised if the input dimensions are not sound. If a single integer is provided for ``order``, then it is interpreted as a list of repeated integers with - this value. (See :meth:`minimal_approximant_basis` for definitions and + this value. (See :meth:`minimal_approximant_basis` for definitions and more details.) INPUT: @@ -3327,14 +3327,14 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): sage: appbas.is_minimal_approximant_basis(pmat, [8,8], shifts) Traceback (most recent call last): ... - ValueError: order length should be the column dimension + ValueError: order length should be the column dimension of the input matrix sage: appbas.is_minimal_approximant_basis(pmat, \ order, shifts, row_wise=False) Traceback (most recent call last): ... - ValueError: shifts length should be the column dimension + ValueError: shifts length should be the column dimension of the input matrix sage: Matrix(pR, [x^8]).is_minimal_approximant_basis(pmat, 8) @@ -3612,7 +3612,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): def _approximant_basis_iterative(self, order, shifts): r""" Return a ``shifts``-ordered weak Popov approximant basis for this - polynomial matrix at order ``order`` + polynomial matrix at order ``order`` (see :meth:`minimal_approximant_basis` for definitions). The output basis is considered row-wise, that is, its rows are diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 93efb95781f..10fd2dcabcc 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -111,7 +111,7 @@ from sage.rings.integer_ring import ZZ, is_IntegerRing from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF import sage.rings.abc from sage.rings.rational_field import QQ -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from .matrix2 import decomp_seq from .matrix0 import Matrix as Matrix_base diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py index e889cee7905..497f7ad2673 100644 --- a/src/sage/matrix/matrix_space.py +++ b/src/sage/matrix/matrix_space.py @@ -679,7 +679,8 @@ def __init__(self, base_ring, nrows, ncols, sparse, implementation): self.__ncols = ncols self.__is_sparse = sparse - from sage.categories.all import Modules, Algebras + from sage.categories.modules import Modules + from sage.categories.algebras import Algebras if nrows == ncols: category = Algebras(base_ring.category()) else: diff --git a/src/sage/matrix/misc.pyx b/src/sage/matrix/misc.pyx index 220f8866b0e..3ac3d26efd2 100644 --- a/src/sage/matrix/misc.pyx +++ b/src/sage/matrix/misc.pyx @@ -38,7 +38,8 @@ from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.integer cimport Integer -from sage.arith.all import previous_prime, CRT_basis +from sage.arith.misc import previous_prime +from sage.arith.misc import CRT_basis cimport sage.rings.abc from sage.rings.real_mpfr cimport RealNumber diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index e9430f0b086..e4220056f58 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -4047,7 +4047,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): right = py_scalar_to_element(right) if not isinstance(right, Element): right = right.sage() - if not ((right)._parent is self._parent): + from sage.arith.misc import GCD as gcd from sage.arith.all import gcd return coercion_model.bin_op(self, right, gcd) return self._gcd(right) @@ -4081,7 +4081,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): right = py_scalar_to_element(right) if not isinstance(right, Element): right = right.sage() - if not ((right)._parent is self._parent): + from sage.arith.functions import lcm from sage.arith.all import lcm return coercion_model.bin_op(self, right, lcm) return self._lcm(right) diff --git a/src/sage/structure/set_factories_example.py b/src/sage/structure/set_factories_example.py index 44763fda11b..5414edea03d 100644 --- a/src/sage/structure/set_factories_example.py +++ b/src/sage/structure/set_factories_example.py @@ -37,7 +37,7 @@ from sage.structure.element_wrapper import ElementWrapper from sage.structure.set_factories import ( SetFactory, ParentWithSetFactory, TopMostParentPolicy) -from sage.sets.all import DisjointUnionEnumeratedSets +from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets from sage.sets.family import LazyFamily from sage.categories.enumerated_sets import EnumeratedSets from sage.rings.integer import Integer From 9911481804b7b9fac03695d9d74126a0410c7317 Mon Sep 17 00:00:00 2001 From: Alex Chandler Date: Sun, 29 Jan 2023 11:17:25 -0800 Subject: [PATCH 010/140] src/sage/{categories,matrix,structure}: Manual fixes to imports --- src/sage/categories/category.py | 4 ++-- src/sage/structure/element.pyx | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index f70455cf1a0..0db7aa21a65 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -153,7 +153,7 @@ class Category(UniqueRepresentation, SageObject): This is achieved as follows:: - sage: from sage.categories.all import Category + sage: from sage.categories.category import Category sage: class EuclideanDomains(Category): ....: # operations on the category itself ....: def super_categories(self): @@ -201,7 +201,7 @@ class inheritance from ``C.parent_class``. :: - sage: from sage.categories.all import Category + sage: from sage.categories.category import Category sage: from sage.misc.lazy_attribute import lazy_attribute sage: class As (Category): ....: def super_categories(self): diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index e4220056f58..92e83bd88ff 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -2226,7 +2226,10 @@ cdef class ElementWithCachedMethod(Element): ....: "cdef class MyParent(Parent):", ....: " Element = MyElement"] sage: cython('\n'.join(cython_code)) # optional - sage.misc.cython - sage: cython_code = ["from sage.all import cached_method, cached_in_parent_method, Category, Objects", + 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.objects import Objects", ....: "class MyCategory(Category):", ....: " @cached_method", ....: " def super_categories(self):", @@ -2325,7 +2328,10 @@ cdef class ElementWithCachedMethod(Element): ....: from sage.structure.parent cimport Parent ....: cdef class MyParent(Parent): ....: Element = MyElement - ....: from sage.all import cached_method, lazy_attribute, Category, Objects + ....: 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.objects import Objects ....: class MyCategory(Category): ....: @cached_method ....: def super_categories(self): @@ -4048,7 +4054,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): if not isinstance(right, Element): right = right.sage() from sage.arith.misc import GCD as gcd - from sage.arith.all import gcd + from sage.arith.misc import GCD as gcd return coercion_model.bin_op(self, right, gcd) return self._gcd(right) @@ -4082,7 +4088,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): if not isinstance(right, Element): right = right.sage() from sage.arith.functions import lcm - from sage.arith.all import lcm + from sage.arith.functions import lcm return coercion_model.bin_op(self, right, lcm) return self._lcm(right) From 01cded97cb2a4cdbfef84f369a6217d8917edc8f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 29 Jan 2023 16:36:31 -0800 Subject: [PATCH 011/140] src/sage/structure/element.pyx: Fix up --- src/sage/structure/element.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 92e83bd88ff..15d60b32383 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -4053,7 +4053,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): right = py_scalar_to_element(right) if not isinstance(right, Element): right = right.sage() - from sage.arith.misc import GCD as gcd + if not ((right)._parent is self._parent): from sage.arith.misc import GCD as gcd return coercion_model.bin_op(self, right, gcd) return self._gcd(right) @@ -4087,7 +4087,7 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): right = py_scalar_to_element(right) if not isinstance(right, Element): right = right.sage() - from sage.arith.functions import lcm + if not ((right)._parent is self._parent): from sage.arith.functions import lcm return coercion_model.bin_op(self, right, lcm) return self._lcm(right) From 62032020ad6f73df11cdce1dbeec51aee35ed7cc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 29 Jan 2023 18:33:04 -0800 Subject: [PATCH 012/140] sage.matrix: Consolidate imports from the same module --- src/sage/matrix/matrix_cyclo_dense.pyx | 3 +- src/sage/matrix/matrix_integer_dense_hnf.py | 9 ++--- .../matrix/matrix_integer_dense_saturation.py | 15 ++++---- src/sage/matrix/misc.pyx | 37 ++++++++----------- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index ddbeb4360b7..29456daabfe 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -65,10 +65,9 @@ from .matrix_integer_dense cimport _lift_crt from sage.structure.element cimport Matrix as baseMatrix from .misc import matrix_integer_dense_rational_reconstruction +from sage.arith.misc import binomial, previous_prime from sage.rings.rational_field import QQ from sage.rings.integer_ring import ZZ -from sage.arith.misc import previous_prime -from sage.arith.misc import binomial from sage.rings.real_mpfr import create_RealNumber as RealNumber from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational diff --git a/src/sage/matrix/matrix_integer_dense_hnf.py b/src/sage/matrix/matrix_integer_dense_hnf.py index 1eacb6e5648..21415aecad1 100644 --- a/src/sage/matrix/matrix_integer_dense_hnf.py +++ b/src/sage/matrix/matrix_integer_dense_hnf.py @@ -8,15 +8,14 @@ from copy import copy +from sage.arith.misc import CRT_list, previous_prime from sage.misc.misc import cputime from sage.misc.verbose import verbose -from sage.matrix.constructor import (random_matrix, matrix, identity_matrix) - +from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.real_mpfr import RR -from sage.rings.integer import Integer -from sage.arith.misc import previous_prime -from sage.arith.misc import CRT_list + +from .constructor import identity_matrix, matrix, random_matrix def max_det_prime(n): diff --git a/src/sage/matrix/matrix_integer_dense_saturation.py b/src/sage/matrix/matrix_integer_dense_saturation.py index 63233d247b5..37cf7cf8a69 100644 --- a/src/sage/matrix/matrix_integer_dense_saturation.py +++ b/src/sage/matrix/matrix_integer_dense_saturation.py @@ -2,15 +2,16 @@ Saturation over ZZ """ -from sage.rings.integer_ring import ZZ -from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF -from sage.arith.misc import binomial -from sage.arith.misc import GCD as gcd -from sage.matrix.constructor import identity_matrix, random_matrix -from sage.misc.verbose import verbose +from copy import copy + +from sage.arith.misc import binomial, GCD as gcd from sage.misc.randstate import current_randstate +from sage.misc.verbose import verbose +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.integer_ring import ZZ + from . import matrix_integer_dense_hnf -from copy import copy +from .constructor import identity_matrix, random_matrix def p_saturation(A, p, proof=True): diff --git a/src/sage/matrix/misc.pyx b/src/sage/matrix/misc.pyx index 3ac3d26efd2..25cffdeef0a 100644 --- a/src/sage/matrix/misc.pyx +++ b/src/sage/matrix/misc.pyx @@ -12,21 +12,26 @@ relevant classes and this file deleted. from cysignals.signals cimport sig_check -from sage.ext.mod_int cimport * -from sage.libs.gmp.mpz cimport * -from sage.libs.gmp.mpq cimport * -from sage.libs.mpfr cimport * - -from sage.libs.flint.fmpz cimport fmpz_set_mpz, fmpz_one -from sage.libs.flint.fmpq cimport fmpq_set_mpq, fmpq_canonicalise -from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry_num, fmpq_mat_entry_den, fmpq_mat_entry +cimport sage.rings.abc +from sage.arith.misc import CRT_basis, previous_prime from sage.arith.rational_reconstruction cimport mpq_rational_reconstruction - from sage.data_structures.binary_search cimport * +from sage.ext.mod_int cimport * +from sage.libs.flint.fmpq cimport fmpq_set_mpq, fmpq_canonicalise +from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry_num, fmpq_mat_entry_den, fmpq_mat_entry +from sage.libs.flint.fmpz cimport fmpz_set_mpz, fmpz_one +from sage.libs.gmp.mpq cimport * +from sage.libs.gmp.mpz cimport * +from sage.libs.mpfr cimport * +from sage.misc.verbose import get_verbose, verbose from sage.modules.vector_integer_sparse cimport * -from sage.modules.vector_rational_sparse cimport * from sage.modules.vector_modn_sparse cimport * +from sage.modules.vector_rational_sparse cimport * +from sage.rings.integer cimport Integer +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ +from sage.rings.real_mpfr cimport RealNumber from .matrix0 cimport Matrix from .matrix_integer_dense cimport Matrix_integer_dense @@ -34,18 +39,6 @@ from .matrix_integer_sparse cimport Matrix_integer_sparse from .matrix_rational_dense cimport Matrix_rational_dense from .matrix_rational_sparse cimport Matrix_rational_sparse -from sage.rings.integer_ring import ZZ -from sage.rings.rational_field import QQ - -from sage.rings.integer cimport Integer -from sage.arith.misc import previous_prime -from sage.arith.misc import CRT_basis - -cimport sage.rings.abc -from sage.rings.real_mpfr cimport RealNumber - - -from sage.misc.verbose import verbose, get_verbose def matrix_integer_dense_rational_reconstruction(Matrix_integer_dense A, Integer N): """ From a80f14a77a162a286a3cc1cb832b80dab826a24c Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 6 Feb 2023 16:49:21 +0900 Subject: [PATCH 013/140] Improve camera positioning for threejs --- src/sage/ext_data/threejs/threejs_template.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sage/ext_data/threejs/threejs_template.html b/src/sage/ext_data/threejs/threejs_template.html index 38800560c47..172d0cec4aa 100644 --- a/src/sage/ext_data/threejs/threejs_template.html +++ b/src/sage/ext_data/threejs/threejs_template.html @@ -214,7 +214,17 @@ camera.up.set( 0, 0, 1 ); camera.position.set( a[0]*xMid, a[1]*yMid, a[2]*zMid ); - var offset = new THREE.Vector3( a[0]*xRange, a[1]*yRange, a[2]*zRange ); + // camera is positioned so that the line from the camera to the center + // of the bounding sphere of the objects makes an angle of 60 degrees with x-axis + // and an angle of 30 degrees with z-axis and the field of view of the camera looking + // at the center has an angle of 45 degrees. + const sin8 = Math.sin(Math.PI / 8); + const sin5 = Math.sin(Math.PI / 5); + const cos5 = Math.cos(Math.PI / 5); + const sin3 = Math.sin(Math.PI / 3); + const cos3 = Math.cos(Math.PI / 3); + var r = midToCorner / sin8; + var offset = new THREE.Vector3( r * sin3 * cos5, r * sin3 * sin5, r * cos3 ); if ( options.viewpoint ) { @@ -569,7 +579,7 @@ setTimeout( function() { m.style.display = 'none'; }, 2000 ); } - +