From 4475efeabe9ee1b3e556286afe3cf631eacdea4e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 8 Sep 2023 15:15:50 -0700 Subject: [PATCH 1/4] Replace relative cimports --- .../quatalg/quaternion_algebra_cython.pyx | 2 +- src/sage/arith/power.pyx | 2 +- src/sage/categories/action.pxd | 6 +++--- src/sage/categories/action.pyx | 6 +++--- src/sage/categories/morphism.pxd | 2 +- src/sage/cpython/debug.pyx | 2 +- src/sage/cpython/getattr.pyx | 2 +- src/sage/data_structures/bitset.pxd | 2 +- src/sage/data_structures/bitset.pyx | 2 +- src/sage/misc/cachefunc.pxd | 2 +- src/sage/modular/modsym/heilbronn.pyx | 2 +- src/sage/rings/abc.pxd | 2 +- src/sage/rings/complex_conversion.pyx | 4 ++-- src/sage/rings/complex_double.pyx | 4 ++-- src/sage/rings/complex_interval.pxd | 2 +- src/sage/rings/complex_interval.pyx | 6 +++--- src/sage/rings/complex_mpc.pyx | 6 +++--- src/sage/rings/complex_mpfr.pxd | 2 +- src/sage/rings/complex_mpfr.pyx | 6 +++--- src/sage/rings/convert/mpfi.pyx | 16 ++++++++-------- src/sage/rings/finite_rings/element_givaro.pyx | 2 +- .../rings/finite_rings/element_pari_ffelt.pyx | 2 +- .../finite_rings/hom_finite_field_givaro.pyx | 12 ++++++------ .../finite_rings/hom_prime_finite_field.pxd | 2 +- .../finite_rings/hom_prime_finite_field.pyx | 6 +++--- src/sage/rings/integer_ring.pxd | 4 ++-- src/sage/rings/laurent_series_ring_element.pyx | 2 +- .../number_field_element_quadratic.pxd | 2 +- src/sage/rings/polynomial/evaluation.pxd | 4 ++-- src/sage/rings/polynomial/multi_polynomial.pxd | 2 +- src/sage/rings/polynomial/polynomial_element.pxd | 4 ++-- src/sage/rings/polynomial/polynomial_element.pyx | 2 +- .../polynomial/polynomial_real_mpfr_dense.pyx | 2 +- src/sage/rings/power_series_mpoly.pxd | 2 +- src/sage/rings/power_series_mpoly.pyx | 2 +- src/sage/rings/power_series_pari.pxd | 2 +- src/sage/rings/power_series_poly.pxd | 2 +- src/sage/rings/power_series_poly.pyx | 2 +- src/sage/rings/rational.pyx | 2 +- src/sage/rings/real_double_element_gsl.pxd | 2 +- src/sage/rings/real_mpfi.pxd | 4 ++-- src/sage/rings/real_mpfi.pyx | 6 +++--- src/sage/rings/real_mpfr.pyx | 6 +++--- 43 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_cython.pyx b/src/sage/algebras/quatalg/quaternion_algebra_cython.pyx index 983e2515c04..130c9f5d43a 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_cython.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_cython.pyx @@ -35,7 +35,7 @@ from sage.matrix.matrix_space import MatrixSpace from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense -from .quaternion_algebra_element cimport QuaternionAlgebraElement_rational_field +from sage.algebras.quatalg.quaternion_algebra_element cimport QuaternionAlgebraElement_rational_field from sage.libs.gmp.mpz cimport mpz_t, mpz_lcm, mpz_init, mpz_set, mpz_clear, mpz_init_set, mpz_mul, mpz_fdiv_q, mpz_cmp_si diff --git a/src/sage/arith/power.pyx b/src/sage/arith/power.pyx index 65090f23c23..2b4cbd099d1 100644 --- a/src/sage/arith/power.pyx +++ b/src/sage/arith/power.pyx @@ -17,7 +17,7 @@ square-and-multiply algorithm. from cysignals.signals cimport sig_check -from .long cimport integer_check_long +from sage.arith.long cimport integer_check_long cpdef generic_power(a, n) noexcept: diff --git a/src/sage/categories/action.pxd b/src/sage/categories/action.pxd index 444fcc1f38f..a22a37cc22a 100644 --- a/src/sage/categories/action.pxd +++ b/src/sage/categories/action.pxd @@ -1,7 +1,7 @@ from sage.structure.element cimport Element -from .morphism cimport Morphism -from .map cimport Map -from .functor cimport Functor +from sage.categories.morphism cimport Morphism +from sage.categories.map cimport Map +from sage.categories.functor cimport Functor cdef class Action(Functor): cdef readonly G diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 46effeecc42..86711311133 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -56,9 +56,9 @@ AUTHOR: from cpython.tuple cimport PyTuple_GET_ITEM -from .functor cimport Functor -from .morphism cimport Morphism -from .map cimport Map +from sage.categories.functor cimport Functor +from sage.categories.morphism cimport Morphism +from sage.categories.map cimport Map from sage.structure.element cimport parent from sage.structure.parent cimport Parent diff --git a/src/sage/categories/morphism.pxd b/src/sage/categories/morphism.pxd index 1a941b62b33..e5befc8207e 100644 --- a/src/sage/categories/morphism.pxd +++ b/src/sage/categories/morphism.pxd @@ -1,5 +1,5 @@ from sage.structure.element cimport Element -from .map cimport Map +from sage.categories.map cimport Map cdef class Morphism(Map): diff --git a/src/sage/cpython/debug.pyx b/src/sage/cpython/debug.pyx index cdaca3a4854..0cfc1fc2388 100644 --- a/src/sage/cpython/debug.pyx +++ b/src/sage/cpython/debug.pyx @@ -21,7 +21,7 @@ cdef extern from "Python.h": cdef extern from "sage/cpython/debugimpl.c": void _type_debug(PyTypeObject*) -from .getattr cimport AttributeErrorMessage +from sage.cpython.getattr cimport AttributeErrorMessage # Determine subtype_traverse, subtype_clear, subtype_dealloc functions diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx index 3a06167ea99..e4982020879 100644 --- a/src/sage/cpython/getattr.pyx +++ b/src/sage/cpython/getattr.pyx @@ -4,7 +4,7 @@ Variants of getattr() from cpython.object cimport PyObject, PyTypeObject, Py_TYPE, descrgetfunc -from .string cimport bytes_to_str +from sage.cpython.string cimport bytes_to_str cdef extern from "Python.h": r""" diff --git a/src/sage/data_structures/bitset.pxd b/src/sage/data_structures/bitset.pxd index d8122c05165..0d72f7eb6ed 100644 --- a/src/sage/data_structures/bitset.pxd +++ b/src/sage/data_structures/bitset.pxd @@ -7,7 +7,7 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from .bitset_base cimport bitset_t +from sage.data_structures.bitset_base cimport bitset_t # Python layer over bitset_t cdef class FrozenBitset: diff --git a/src/sage/data_structures/bitset.pyx b/src/sage/data_structures/bitset.pyx index 0e3f6e3d640..5c341c8a003 100644 --- a/src/sage/data_structures/bitset.pyx +++ b/src/sage/data_structures/bitset.pyx @@ -31,7 +31,7 @@ linear in ``capacity``. # http://www.gnu.org/licenses/ #***************************************************************************** -from .bitset_base cimport * +from sage.data_structures.bitset_base cimport * from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE diff --git a/src/sage/misc/cachefunc.pxd b/src/sage/misc/cachefunc.pxd index 747e9b60df0..5590c41f4d3 100644 --- a/src/sage/misc/cachefunc.pxd +++ b/src/sage/misc/cachefunc.pxd @@ -1,4 +1,4 @@ -from .function_mangling cimport ArgumentFixer +from sage.misc.function_mangling cimport ArgumentFixer cpdef dict_key(o) noexcept cpdef cache_key(o) noexcept diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index ba42d70aa9e..36134d94d14 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -38,7 +38,7 @@ from . import p1list cdef p1list.export export export = p1list.export() -from .apply cimport Apply +from sage.modular.modsym.apply cimport Apply cdef Apply PolyApply= Apply() from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense diff --git a/src/sage/rings/abc.pxd b/src/sage/rings/abc.pxd index a53b512d62f..a2d2e3f0ce4 100644 --- a/src/sage/rings/abc.pxd +++ b/src/sage/rings/abc.pxd @@ -1,4 +1,4 @@ -from .ring cimport CommutativeRing, Field +from sage.rings.ring cimport CommutativeRing, Field cdef class RealField(Field): diff --git a/src/sage/rings/complex_conversion.pyx b/src/sage/rings/complex_conversion.pyx index e7e53724f9c..39c8b63eb55 100644 --- a/src/sage/rings/complex_conversion.pyx +++ b/src/sage/rings/complex_conversion.pyx @@ -1,5 +1,5 @@ -from .complex_double cimport ComplexDoubleElement -from .complex_mpfr cimport ComplexNumber +from sage.rings.complex_double cimport ComplexDoubleElement +from sage.rings.complex_mpfr cimport ComplexNumber from sage.libs.mpfr cimport mpfr_get_d, MPFR_RNDN from sage.libs.gsl.complex cimport GSL_SET_COMPLEX diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 8f1e8205817..12deffcc9b2 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -105,9 +105,9 @@ complex_double_element_gamma = None complex_double_element_gamma_inc = None complex_double_element_zeta = None -from .complex_conversion cimport CCtoCDF +from sage.rings.complex_conversion cimport CCtoCDF -from .real_double cimport RealDoubleElement, double_repr +from sage.rings.real_double cimport RealDoubleElement, double_repr from .real_double import RDF from sage.rings.integer_ring import ZZ from sage.structure.richcmp cimport rich_to_bool diff --git a/src/sage/rings/complex_interval.pxd b/src/sage/rings/complex_interval.pxd index 56513b65747..60d8c010cd8 100644 --- a/src/sage/rings/complex_interval.pxd +++ b/src/sage/rings/complex_interval.pxd @@ -2,7 +2,7 @@ from sage.libs.mpfr.types cimport mpfr_prec_t from sage.libs.mpfi.types cimport mpfi_t cimport sage.structure.element -from .real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class +from sage.rings.real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index c38261d136d..b35d4d6db1a 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -66,11 +66,11 @@ from sage.arith.constants cimport LOG_TEN_TWO_PLUS_EPSILON from sage.structure.element cimport FieldElement from sage.structure.parent cimport Parent -from .complex_mpfr cimport ComplexNumber +from sage.rings.complex_mpfr cimport ComplexNumber from sage.rings.integer cimport Integer cimport sage.rings.real_mpfi as real_mpfi -from .real_mpfr cimport RealNumber -from .convert.mpfi cimport mpfi_set_sage +from sage.rings.real_mpfr cimport RealNumber +from sage.rings.convert.mpfi cimport mpfi_set_sage from .infinity import infinity diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index 562286db44e..3a5667b5f58 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -74,12 +74,12 @@ from sage.structure.richcmp cimport rich_to_bool from sage.categories.map cimport Map from sage.libs.pari.all import pari -from .integer cimport Integer -from .complex_mpfr cimport ComplexNumber +from sage.rings.integer cimport Integer +from sage.rings.complex_mpfr cimport ComplexNumber from .complex_mpfr import ComplexField_class from sage.misc.randstate cimport randstate, current_randstate -from .real_mpfr cimport RealField_class, RealNumber +from sage.rings.real_mpfr cimport RealField_class, RealNumber from .real_mpfr import mpfr_prec_min, mpfr_prec_max from sage.structure.richcmp cimport rich_to_bool, richcmp from sage.categories.fields import Fields diff --git a/src/sage/rings/complex_mpfr.pxd b/src/sage/rings/complex_mpfr.pxd index 4aa6de62a69..95972c52bb5 100644 --- a/src/sage/rings/complex_mpfr.pxd +++ b/src/sage/rings/complex_mpfr.pxd @@ -1,7 +1,7 @@ from sage.libs.mpfr.types cimport mpfr_t, mpfr_prec_t cimport sage.structure.element -from .real_mpfr cimport RealNumber +from sage.rings.real_mpfr cimport RealNumber cdef class ComplexNumber(sage.structure.element.FieldElement): cdef mpfr_t __re diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index d6f92bb2fee..fc93ba366dd 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -47,10 +47,10 @@ from sage.misc.sage_eval import sage_eval import sage.rings.abc from sage.arith.constants cimport LOG_TEN_TWO_PLUS_EPSILON from . import infinity -from .integer cimport Integer +from sage.rings.integer cimport Integer -from .complex_double cimport ComplexDoubleElement -from .real_mpfr cimport RealNumber +from sage.rings.complex_double cimport ComplexDoubleElement +from sage.rings.real_mpfr cimport RealNumber from sage.libs.gsl.complex cimport * from sage.libs.mpmath.utils cimport mpfr_to_mpfval diff --git a/src/sage/rings/convert/mpfi.pyx b/src/sage/rings/convert/mpfi.pyx index abef4963bcf..0d42927740a 100644 --- a/src/sage/rings/convert/mpfi.pyx +++ b/src/sage/rings/convert/mpfi.pyx @@ -23,14 +23,14 @@ from sage.cpython.string cimport bytes_to_str from sage.structure.element cimport Element import sage.rings.abc -from ..integer cimport Integer -from ..rational cimport Rational -from ..real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class -from ..real_mpfr cimport RealNumber -from ..real_double cimport RealDoubleElement -from ..complex_mpfr cimport ComplexNumber -from ..complex_interval cimport ComplexIntervalFieldElement -from ..complex_double cimport ComplexDoubleElement +from sage.rings.integer cimport Integer +from sage.rings.rational cimport Rational +from sage.rings.real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class +from sage.rings.real_mpfr cimport RealNumber +from sage.rings.real_double cimport RealDoubleElement +from sage.rings.complex_mpfr cimport ComplexNumber +from sage.rings.complex_interval cimport ComplexIntervalFieldElement +from sage.rings.complex_double cimport ComplexDoubleElement from cypari2.gen cimport Gen diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index 0483b4949e7..7619ec7185f 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -57,7 +57,7 @@ from cysignals.signals cimport sig_on, sig_off from cypari2.paridecl cimport * from sage.misc.randstate cimport current_randstate -from .element_pari_ffelt cimport FiniteFieldElement_pari_ffelt +from sage.rings.finite_rings.element_pari_ffelt cimport FiniteFieldElement_pari_ffelt from sage.structure.richcmp cimport richcmp import sage.arith.all diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 9beb505cae3..e5bf41429e0 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -24,7 +24,7 @@ from sage.libs.pari.convert_gmp cimport _new_GEN_from_mpz_t from cypari2.stack cimport new_gen, new_gen_noclear, clear_stack from cypari2.gen cimport Gen as pari_gen, objtogen -from .element_base cimport FinitePolyExtElement +from sage.rings.finite_rings.element_base cimport FinitePolyExtElement from .integer_mod import IntegerMod_abstract import sage.rings.integer diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx index 21036266df1..bc685731610 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx @@ -33,21 +33,21 @@ AUTHOR: from sage.rings.finite_rings.finite_field_constructor import FiniteField -from .hom_finite_field cimport SectionFiniteFieldHomomorphism_generic -from .hom_finite_field cimport FiniteFieldHomomorphism_generic -from .hom_finite_field cimport FrobeniusEndomorphism_finite_field +from sage.rings.finite_rings.hom_finite_field cimport SectionFiniteFieldHomomorphism_generic +from sage.rings.finite_rings.hom_finite_field cimport FiniteFieldHomomorphism_generic +from sage.rings.finite_rings.hom_finite_field cimport FrobeniusEndomorphism_finite_field -from .hom_prime_finite_field cimport FiniteFieldHomomorphism_prime +from sage.rings.finite_rings.hom_prime_finite_field cimport FiniteFieldHomomorphism_prime from sage.categories.homset import Hom from sage.structure.element cimport Element from sage.rings.finite_rings.finite_field_givaro import FiniteField_givaro -from .element_givaro cimport FiniteField_givaroElement +from sage.rings.finite_rings.element_givaro cimport FiniteField_givaroElement #from element_givaro cimport make_FiniteField_givaroElement from sage.structure.parent cimport Parent -from .element_givaro cimport Cache_givaro +from sage.rings.finite_rings.element_givaro cimport Cache_givaro cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_generic): diff --git a/src/sage/rings/finite_rings/hom_prime_finite_field.pxd b/src/sage/rings/finite_rings/hom_prime_finite_field.pxd index c0da361fb42..b146b0c9169 100644 --- a/src/sage/rings/finite_rings/hom_prime_finite_field.pxd +++ b/src/sage/rings/finite_rings/hom_prime_finite_field.pxd @@ -1,4 +1,4 @@ -from .hom_finite_field cimport (SectionFiniteFieldHomomorphism_generic, +from sage.rings.finite_rings.hom_finite_field cimport (SectionFiniteFieldHomomorphism_generic, FiniteFieldHomomorphism_generic, FrobeniusEndomorphism_finite_field) diff --git a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx index 6bc38546612..2ff550aa1b1 100644 --- a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx @@ -27,9 +27,9 @@ AUTHOR: from sage.categories.homset import Hom from sage.structure.element cimport Element -from .hom_finite_field cimport SectionFiniteFieldHomomorphism_generic -from .hom_finite_field cimport FiniteFieldHomomorphism_generic -from .hom_finite_field cimport FrobeniusEndomorphism_finite_field +from sage.rings.finite_rings.hom_finite_field cimport SectionFiniteFieldHomomorphism_generic +from sage.rings.finite_rings.hom_finite_field cimport FiniteFieldHomomorphism_generic +from sage.rings.finite_rings.hom_finite_field cimport FrobeniusEndomorphism_finite_field from sage.rings.finite_rings.finite_field_base import FiniteField diff --git a/src/sage/rings/integer_ring.pxd b/src/sage/rings/integer_ring.pxd index 41afccaa514..d0af1bc068f 100644 --- a/src/sage/rings/integer_ring.pxd +++ b/src/sage/rings/integer_ring.pxd @@ -1,5 +1,5 @@ -from .ring cimport PrincipalIdealDomain -from .integer cimport Integer +from sage.rings.ring cimport PrincipalIdealDomain +from sage.rings.integer cimport Integer from sage.libs.gmp.types cimport mpz_t cdef class IntegerRing_class(PrincipalIdealDomain): diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index b15e6cbdcf0..58f65513270 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -71,7 +71,7 @@ from .infinity import infinity from sage.rings.rational_field import QQ import sage.misc.latex from sage.rings.polynomial.laurent_polynomial import LaurentPolynomial_univariate -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element, AlgebraElement from sage.structure.richcmp cimport richcmp_not_equal, rich_to_bool from sage.misc.derivative import multi_derivative diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pxd b/src/sage/rings/number_field/number_field_element_quadratic.pxd index 76661971848..b9fbb294a54 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pxd +++ b/src/sage/rings/number_field/number_field_element_quadratic.pxd @@ -2,7 +2,7 @@ from sage.libs.gmp.types cimport mpz_t from sage.libs.arb.types cimport arb_t from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational -from .number_field_element cimport NumberFieldElement, NumberFieldElement_absolute +from sage.rings.number_field.number_field_element cimport NumberFieldElement, NumberFieldElement_absolute cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): diff --git a/src/sage/rings/polynomial/evaluation.pxd b/src/sage/rings/polynomial/evaluation.pxd index 4978e83a831..bbd1ba97b4b 100644 --- a/src/sage/rings/polynomial/evaluation.pxd +++ b/src/sage/rings/polynomial/evaluation.pxd @@ -1,2 +1,2 @@ -from .evaluation_flint cimport * -from .evaluation_ntl cimport * +from sage.rings.polynomial.evaluation_flint cimport * +from sage.rings.polynomial.evaluation_ntl cimport * diff --git a/src/sage/rings/polynomial/multi_polynomial.pxd b/src/sage/rings/polynomial/multi_polynomial.pxd index 73bde26ab51..3f4fe16888c 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pxd +++ b/src/sage/rings/polynomial/multi_polynomial.pxd @@ -1,4 +1,4 @@ -from .commutative_polynomial cimport CommutativePolynomial +from sage.rings.polynomial.commutative_polynomial cimport CommutativePolynomial cdef class MPolynomial(CommutativePolynomial): diff --git a/src/sage/rings/polynomial/polynomial_element.pxd b/src/sage/rings/polynomial/polynomial_element.pxd index b337919a807..9b8bf41fa06 100644 --- a/src/sage/rings/polynomial/polynomial_element.pxd +++ b/src/sage/rings/polynomial/polynomial_element.pxd @@ -2,8 +2,8 @@ from sage.structure.element import Element from sage.structure.element cimport Element, CommutativeAlgebraElement, ModuleElement from sage.structure.parent cimport Parent from sage.rings.integer cimport Integer -from .commutative_polynomial cimport CommutativePolynomial -from .polynomial_compiled cimport CompiledPolynomialFunction +from sage.rings.polynomial.commutative_polynomial cimport CommutativePolynomial +from sage.rings.polynomial.polynomial_compiled cimport CompiledPolynomialFunction cdef class Polynomial(CommutativePolynomial): diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 8e9c4822a7b..44c86cb84cb 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -182,7 +182,7 @@ cpdef is_Polynomial(f) noexcept: return isinstance(f, Polynomial) -from .polynomial_compiled cimport CompiledPolynomialFunction +from sage.rings.polynomial.polynomial_compiled cimport CompiledPolynomialFunction from sage.rings.polynomial.polydict cimport ETuple diff --git a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx index 15c65081cd9..8bd5bd00a67 100644 --- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx @@ -30,7 +30,7 @@ from cpython.long cimport PyLong_AsLong from cpython.float cimport PyFloat_AS_DOUBLE from sage.structure.parent cimport Parent -from .polynomial_element cimport Polynomial, _dict_to_list +from sage.rings.polynomial.polynomial_element cimport Polynomial, _dict_to_list from sage.rings.real_mpfr cimport RealField_class, RealNumber from sage.rings.integer cimport Integer, smallInteger from sage.rings.rational cimport Rational diff --git a/src/sage/rings/power_series_mpoly.pxd b/src/sage/rings/power_series_mpoly.pxd index d358ada1356..d8816e694b7 100644 --- a/src/sage/rings/power_series_mpoly.pxd +++ b/src/sage/rings/power_series_mpoly.pxd @@ -1,5 +1,5 @@ from sage.structure.element cimport ModuleElement -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries cdef class PowerSeries_mpoly(PowerSeries): cdef ModuleElement __f diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx index fa62a7ef6d6..b65bda0dc81 100644 --- a/src/sage/rings/power_series_mpoly.pyx +++ b/src/sage/rings/power_series_mpoly.pyx @@ -1,6 +1,6 @@ # NOT ready to be used -- possibly should be deleted. -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element from .infinity import infinity from .polynomial.multi_polynomial_ring_base import is_MPolynomialRing diff --git a/src/sage/rings/power_series_pari.pxd b/src/sage/rings/power_series_pari.pxd index fadf7f0fd08..35b37929c33 100644 --- a/src/sage/rings/power_series_pari.pxd +++ b/src/sage/rings/power_series_pari.pxd @@ -1,5 +1,5 @@ from cypari2.gen cimport Gen as pari_gen -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries cdef class PowerSeries_pari(PowerSeries): cdef pari_gen g diff --git a/src/sage/rings/power_series_poly.pxd b/src/sage/rings/power_series_poly.pxd index 80c441798a1..e37e1fb26cf 100644 --- a/src/sage/rings/power_series_poly.pxd +++ b/src/sage/rings/power_series_poly.pxd @@ -1,4 +1,4 @@ -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries from sage.rings.polynomial.polynomial_element cimport Polynomial from sage.categories.action cimport Action diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 519e13c1226..894d05c787b 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -4,7 +4,7 @@ Power Series Methods The class ``PowerSeries_poly`` provides additional methods for univariate power series. """ -from .power_series_ring_element cimport PowerSeries +from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element from .infinity import infinity from sage.libs.pari.all import pari_gen, PariError diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 0b398428006..09ff7be6a29 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -72,7 +72,7 @@ from sage.structure.richcmp cimport rich_to_bool_sgn import sage.rings.rational_field cimport sage.rings.integer as integer -from .integer cimport Integer +from sage.rings.integer cimport Integer from .integer_ring import ZZ diff --git a/src/sage/rings/real_double_element_gsl.pxd b/src/sage/rings/real_double_element_gsl.pxd index 39c36999ec4..1762c5f944b 100644 --- a/src/sage/rings/real_double_element_gsl.pxd +++ b/src/sage/rings/real_double_element_gsl.pxd @@ -1,4 +1,4 @@ -from .real_double cimport RealDoubleElement +from sage.rings.real_double cimport RealDoubleElement cdef class RealDoubleElement_gsl(RealDoubleElement): diff --git a/src/sage/rings/real_mpfi.pxd b/src/sage/rings/real_mpfi.pxd index 32332d81e3e..f9fc7a1969c 100644 --- a/src/sage/rings/real_mpfi.pxd +++ b/src/sage/rings/real_mpfi.pxd @@ -5,8 +5,8 @@ from sage.rings.ring cimport Field cimport sage.rings.abc from sage.structure.element cimport RingElement -from .rational cimport Rational -from .real_mpfr cimport RealField_class +from sage.rings.rational cimport Rational +from sage.rings.real_mpfr cimport RealField_class cdef class RealIntervalFieldElement(RingElement) # forward decl diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 6e389b53ac2..d0ab92e3f8d 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -269,9 +269,9 @@ from sage.structure.element cimport have_same_parent from sage.structure.parent cimport Parent from sage.structure.richcmp cimport richcmp -from .convert.mpfi cimport mpfi_set_sage -from .real_mpfr cimport RealField_class, RealNumber, RealField -from .integer cimport Integer +from sage.rings.convert.mpfi cimport mpfi_set_sage +from sage.rings.real_mpfr cimport RealField_class, RealNumber, RealField +from sage.rings.integer cimport Integer from .integer_ring import ZZ from .rational_field import QQ diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 4a091fd9191..9117dfcd4ce 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -148,12 +148,12 @@ from cypari2.stack cimport new_gen from sage.libs.mpmath.utils cimport mpfr_to_mpfval -from .integer cimport Integer -from .rational cimport Rational +from sage.rings.integer cimport Integer +from sage.rings.rational cimport Rational from sage.categories.map cimport Map -from .real_double cimport RealDoubleElement +from sage.rings.real_double cimport RealDoubleElement import sage.rings.rational_field From e8821c2bd69ee60099accf6fbd22ce765cbe7149 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Sep 2023 20:25:37 -0700 Subject: [PATCH 2/4] Replace relative imports in Cython files --- src/sage/categories/action.pyx | 4 +-- src/sage/categories/functor.pyx | 2 +- src/sage/categories/map.pyx | 2 +- src/sage/categories/morphism.pyx | 2 +- src/sage/cpython/wrapperdescr.pyx | 2 +- src/sage/misc/lazy_import.pyx | 6 ++-- src/sage/misc/persist.pyx | 6 ++-- src/sage/misc/sage_timeit_class.pyx | 2 +- src/sage/modular/modsym/heilbronn.pyx | 2 +- src/sage/modular/pollack_stevens/dist.pyx | 2 +- src/sage/rings/complex_double.pyx | 34 +++++++++---------- src/sage/rings/complex_interval.pyx | 6 ++-- src/sage/rings/complex_mpc.pyx | 10 +++--- src/sage/rings/complex_mpfr.pyx | 10 +++--- .../rings/finite_rings/element_ntl_gf2e.pyx | 4 +-- .../rings/finite_rings/element_pari_ffelt.pyx | 2 +- .../rings/finite_rings/finite_field_base.pyx | 12 +++---- .../rings/finite_rings/hom_finite_field.pyx | 2 +- src/sage/rings/finite_rings/integer_mod.pyx | 14 ++++---- src/sage/rings/finite_rings/residue_field.pyx | 12 +++---- src/sage/rings/fraction_field_element.pyx | 2 +- src/sage/rings/function_field/element.pyx | 2 +- .../rings/function_field/element_polymod.pyx | 2 +- .../rings/function_field/element_rational.pyx | 2 +- src/sage/rings/integer.pyx | 6 ++-- src/sage/rings/integer_ring.pyx | 2 +- .../rings/laurent_series_ring_element.pyx | 2 +- src/sage/rings/morphism.pyx | 34 +++++++++---------- .../number_field/number_field_element.pyx | 20 +++++------ .../number_field_element_quadratic.pyx | 6 ++-- .../number_field/number_field_morphisms.pyx | 2 +- .../rings/number_field/totallyreal_data.pyx | 2 +- src/sage/rings/padics/morphism.pyx | 2 +- src/sage/rings/padics/padic_printing.pyx | 2 +- src/sage/rings/padics/pow_computer.pyx | 8 ++--- src/sage/rings/padics/pow_computer_flint.pyx | 8 ++--- .../multi_polynomial_libsingular.pyx | 2 +- .../polynomial/multi_polynomial_ring_base.pyx | 24 ++++++------- .../rings/polynomial/polynomial_element.pyx | 2 +- .../polynomial/polynomial_number_field.pyx | 2 +- src/sage/rings/power_series_mpoly.pyx | 6 ++-- src/sage/rings/power_series_poly.pyx | 2 +- src/sage/rings/power_series_ring_element.pyx | 6 ++-- src/sage/rings/rational.pyx | 10 +++--- src/sage/rings/real_double.pyx | 14 ++++---- src/sage/rings/real_double_element_gsl.pyx | 4 +-- src/sage/rings/real_mpfi.pyx | 4 +-- src/sage/rings/real_mpfr.pyx | 22 ++++++------ src/sage/rings/ring.pyx | 2 +- src/sage/rings/sum_of_squares.pyx | 2 +- src/sage/sat/solvers/satsolver.pyx | 8 ++--- src/sage/structure/parent.pyx | 2 +- src/sage/symbolic/expression.pyx | 8 ++--- src/sage/symbolic/function.pyx | 10 +++--- src/sage/symbolic/pynac_impl.pxi | 12 +++---- src/sage/symbolic/ring.pyx | 4 +-- 56 files changed, 192 insertions(+), 192 deletions(-) diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 86711311133..0e54ceffa27 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -62,7 +62,7 @@ from sage.categories.map cimport Map from sage.structure.element cimport parent from sage.structure.parent cimport Parent -from . import homset +from sage.categories import homset from weakref import ref @@ -91,7 +91,7 @@ cdef class Action(Functor): :class:`Action` itself, but other classes may use it """ def __init__(self, G, S, is_left=True, op=None): - from .groupoid import Groupoid + from sage.categories.groupoid import Groupoid Functor.__init__(self, Groupoid(G), category(S)) self.G = G self.US = ref(S) diff --git a/src/sage/categories/functor.pyx b/src/sage/categories/functor.pyx index c25e99f2164..32bd079fc73 100644 --- a/src/sage/categories/functor.pyx +++ b/src/sage/categories/functor.pyx @@ -33,7 +33,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import category +from sage.categories import category def _Functor_unpickle(Cl, D, domain, codomain): diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 8f09e3aa00d..fadd066d7f4 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -21,7 +21,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import homset +from sage.categories import homset import weakref from sage.ext.stdsage cimport HAS_DICTIONARY from sage.arith.power cimport generic_power diff --git a/src/sage/categories/morphism.pyx b/src/sage/categories/morphism.pyx index 32fcd565e34..a30cf52e5c9 100644 --- a/src/sage/categories/morphism.pyx +++ b/src/sage/categories/morphism.pyx @@ -467,7 +467,7 @@ cdef class CallMorphism(Morphism): cdef class IdentityMorphism(Morphism): def __init__(self, parent): - from .homset import Homset, Hom + from sage.categories.homset import Homset, Hom if not isinstance(parent, Homset): parent = Hom(parent, parent) Morphism.__init__(self, parent) diff --git a/src/sage/cpython/wrapperdescr.pyx b/src/sage/cpython/wrapperdescr.pyx index 108ca690b8d..5738a87af46 100644 --- a/src/sage/cpython/wrapperdescr.pyx +++ b/src/sage/cpython/wrapperdescr.pyx @@ -30,7 +30,7 @@ Pure Python classes have normal methods, not slot wrappers:: # https://www.gnu.org/licenses/ # **************************************************************************** -from .string import bytes_to_str +from sage.cpython.string import bytes_to_str def wrapperdescr_call(slotwrapper, self, *args, **kwds): diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index 0ac9fb03d95..c9b09dc1ef5 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -66,7 +66,7 @@ import os import pickle from warnings import warn import inspect -from . import sageinspect +from sage.misc import sageinspect # LazyImport.__repr__ uses try... except FeatureNotPresentError. @@ -1137,7 +1137,7 @@ def save_cache_file(): sage: sage.misc.lazy_import.save_cache_file() """ from sage.misc.temporary_file import atomic_write - from .lazy_import_cache import get_cache_file + from sage.misc.lazy_import_cache import get_cache_file global star_imports if star_imports is None: @@ -1180,7 +1180,7 @@ def get_star_imports(module_name): """ global star_imports if star_imports is None: - from .lazy_import_cache import get_cache_file + from sage.misc.lazy_import_cache import get_cache_file star_imports = {} try: with open(get_cache_file(), "rb") as cache_file: diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx index 670a9a6ac17..5bbc32a239a 100644 --- a/src/sage/misc/persist.pyx +++ b/src/sage/misc/persist.pyx @@ -42,7 +42,7 @@ import bz2 comp = zlib comp_other = bz2 -from .sage_unittest import TestSuite +from sage.misc.sage_unittest import TestSuite # We define two global dictionaries `already_pickled` and @@ -1237,7 +1237,7 @@ def db(name): The database directory is ``$HOME/.sage/db``. """ - from .misc import SAGE_DB + from sage.misc.misc import SAGE_DB return load('%s/%s'%(SAGE_DB,name)) @@ -1250,5 +1250,5 @@ def db_save(x, name=None): try: x.db(name) except AttributeError: - from .misc import SAGE_DB + from sage.misc.misc import SAGE_DB save(x, '%s/%s'%(SAGE_DB,name)) diff --git a/src/sage/misc/sage_timeit_class.pyx b/src/sage/misc/sage_timeit_class.pyx index 5537148e358..f568886574f 100644 --- a/src/sage/misc/sage_timeit_class.pyx +++ b/src/sage/misc/sage_timeit_class.pyx @@ -6,7 +6,7 @@ The ``timeit`` command This uses the function :func:`~sage.misc.sage_timeit.sage_timeit`. """ -from . import sage_timeit +from sage.misc import sage_timeit class SageTimeit: diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 36134d94d14..7fc8ed28055 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -34,7 +34,7 @@ cdef extern from "": float roundf(float x) cimport sage.modular.modsym.p1list as p1list -from . import p1list +from sage.modular.modsym import p1list cdef p1list.export export export = p1list.export() diff --git a/src/sage/modular/pollack_stevens/dist.pyx b/src/sage/modular/pollack_stevens/dist.pyx index fe1f5583cd5..3f67bbf8ecb 100644 --- a/src/sage/modular/pollack_stevens/dist.pyx +++ b/src/sage/modular/pollack_stevens/dist.pyx @@ -44,7 +44,7 @@ from sage.rings.infinity import Infinity #from sage.libs.flint.ulong_extras cimport * -from .sigma0 import Sigma0 +from sage.modular.pollack_stevens.sigma0 import Sigma0 cdef long overflow = 1 << (4 * sizeof(long) - 1) cdef long underflow = -overflow diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 12deffcc9b2..f101960aab8 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -108,7 +108,7 @@ complex_double_element_zeta = None from sage.rings.complex_conversion cimport CCtoCDF from sage.rings.real_double cimport RealDoubleElement, double_repr -from .real_double import RDF +from sage.rings.real_double import RDF from sage.rings.integer_ring import ZZ from sage.structure.richcmp cimport rich_to_bool @@ -213,7 +213,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): sage: CDF.characteristic() 0 """ - from .integer import Integer + from sage.rings.integer import Integer return Integer(0) def random_element(self, double xmin=-1, double xmax=1, double ymin=-1, double ymax=1): @@ -351,7 +351,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): sage: CDF((1,2)) # indirect doctest 1.0 + 2.0*I """ - from . import complex_mpfr + from sage.rings import complex_mpfr if isinstance(x, ComplexDoubleElement): return x elif isinstance(x, tuple): @@ -417,10 +417,10 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): """ if S is int or S is float: return FloatToCDF(S) - from .rational_field import QQ - from .real_lazy import RLF - from .real_mpfr import RR - from .cc import CC + from sage.rings.rational_field import QQ + from sage.rings.real_lazy import RLF + from sage.rings.real_mpfr import RR + from sage.rings.cc import CC if S is ZZ or S is QQ or S is RDF or S is RLF: return FloatToCDF(S) @@ -502,7 +502,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): if prec == 53: return self else: - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField(prec) @@ -621,7 +621,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): ... ValueError: n must be a positive integer """ - from .integer import Integer + from sage.rings.integer import Integer try: n = Integer(n) except TypeError: @@ -968,7 +968,7 @@ cdef class ComplexDoubleElement(FieldElement): True """ # Sending to another computer algebra system is slow anyway, right? - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._interface_init_(I) def _mathematica_init_(self): @@ -980,7 +980,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: mathematica(CDF(1e-25, 1e25)) # optional - mathematica 1.*^-25 + 1.*^25*I """ - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._mathematica_init_() def _maxima_init_(self, I=None): @@ -995,7 +995,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF(.5 + I)._maxima_init_() # needs sage.symbolic '0.50000000000000000 + 1.0000000000000000*%i' """ - from .complex_mpfr import ComplexField + from sage.rings.complex_mpfr import ComplexField return ComplexField()(self)._maxima_init_(I) def _sympy_(self): @@ -1097,7 +1097,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: format(CDF(0, 0), '+#.4') '+0.000' """ - from .complex_mpfr import _format_complex_number + from sage.rings.complex_mpfr import _format_complex_number return _format_complex_number(GSL_REAL(self._complex), GSL_IMAG(self._complex), format_spec) @@ -2382,12 +2382,12 @@ cdef class ComplexDoubleElement(FieldElement): """ if not GSL_IMAG(self._complex): if GSL_REAL(self._complex) == 0: - from .infinity import unsigned_infinity + from sage.rings.infinity import unsigned_infinity return unsigned_infinity try: - from .integer import Integer + from sage.rings.integer import Integer if Integer(GSL_REAL(self._complex)) < 0: - from .cc import CC + from sage.rings.cc import CC return CC(self).gamma() except TypeError: pass @@ -2429,7 +2429,7 @@ cdef class ComplexDoubleElement(FieldElement): Infinity """ if GSL_REAL(self._complex) == 1 and GSL_IMAG(self._complex) == 0: - from .infinity import unsigned_infinity + from sage.rings.infinity import unsigned_infinity return unsigned_infinity global complex_double_element_zeta diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index b35d4d6db1a..e804964f501 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -71,7 +71,7 @@ from sage.rings.integer cimport Integer cimport sage.rings.real_mpfi as real_mpfi from sage.rings.real_mpfr cimport RealNumber from sage.rings.convert.mpfi cimport mpfi_set_sage -from .infinity import infinity +from sage.rings.infinity import infinity def is_ComplexIntervalFieldElement(x): @@ -1914,7 +1914,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): 0.500000000000000? + 3.39927010637040?*I """ if not self: - from .real_mpfi import RIF + from sage.rings.real_mpfi import RIF return RIF(0).log() re = abs(self).log() im = self.argument() @@ -2291,6 +2291,6 @@ def create_ComplexIntervalFieldElement(s_real, s_imag=None, int pad=0, min_prec= #else: # bits = max(int(math.log(base,2)*len(s_imag)),int(math.log(base,2)*len(s_imag))) - from .complex_interval_field import ComplexIntervalField + from sage.rings.complex_interval_field import ComplexIntervalField C = ComplexIntervalField(prec=max(bits+pad, min_prec)) return ComplexIntervalFieldElement(C, s_real, s_imag) diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index 3a5667b5f58..6f727bb4c59 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -59,7 +59,7 @@ EXAMPLES:: # **************************************************************************** import re -from . import real_mpfr +from sage.rings import real_mpfr import weakref from cpython.object cimport Py_NE @@ -76,11 +76,11 @@ from sage.libs.pari.all import pari from sage.rings.integer cimport Integer from sage.rings.complex_mpfr cimport ComplexNumber -from .complex_mpfr import ComplexField_class +from sage.rings.complex_mpfr import ComplexField_class from sage.misc.randstate cimport randstate, current_randstate from sage.rings.real_mpfr cimport RealField_class, RealNumber -from .real_mpfr import mpfr_prec_min, mpfr_prec_max +from sage.rings.real_mpfr import mpfr_prec_min, mpfr_prec_max from sage.structure.richcmp cimport rich_to_bool, richcmp from sage.categories.fields import Fields @@ -105,8 +105,8 @@ def late_import(): import sage.rings.qqbar AA = sage.rings.qqbar.AA QQbar = sage.rings.qqbar.QQbar - from .real_lazy import CLF, RLF - from .complex_double import CDF + from sage.rings.real_lazy import CLF, RLF + from sage.rings.complex_double import CDF _mpfr_rounding_modes = ['RNDN', 'RNDZ', 'RNDU', 'RNDD'] diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index fc93ba366dd..40fe9debdb5 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -46,7 +46,7 @@ from sage.misc.sage_eval import sage_eval import sage.rings.abc from sage.arith.constants cimport LOG_TEN_TWO_PLUS_EPSILON -from . import infinity +from sage.rings import infinity from sage.rings.integer cimport Integer from sage.rings.complex_double cimport ComplexDoubleElement @@ -97,8 +97,8 @@ def late_import(): QQbar = sage.rings.qqbar.QQbar import sage.symbolic.ring SR = sage.symbolic.ring.SR - from .real_lazy import CLF, RLF - from .complex_double import CDF + from sage.rings.real_lazy import CLF, RLF + from sage.rings.complex_double import CDF cdef object numpy_complex_interface = {'typestr': '=c16'} cdef object numpy_object_interface = {'typestr': '|O'} @@ -367,7 +367,7 @@ class ComplexField_class(sage.rings.abc.ComplexField): try: return self.__real_field except AttributeError: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField self.__real_field = RealField(self._prec) return self.__real_field @@ -2926,7 +2926,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): if base is None: return ComplexNumber(self._parent, rho.log(), theta) else: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField return ComplexNumber(self._parent, rho.log()/RealNumber(RealField(self.prec()),base).log(), theta/RealNumber(RealField(self.prec()),base).log()) def additive_order(self): diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 61e7b05048c..60d275ea5ae 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -44,8 +44,8 @@ from sage.libs.pari.all import pari from cypari2.gen cimport Gen from cypari2.stack cimport clear_stack -from .element_pari_ffelt import FiniteFieldElement_pari_ffelt -from .finite_field_ntl_gf2e import FiniteField_ntl_gf2e +from sage.rings.finite_rings.element_pari_ffelt import FiniteFieldElement_pari_ffelt +from sage.rings.finite_rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2e from sage.interfaces.abc import GapElement diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index e5bf41429e0..ca262f6f668 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -25,7 +25,7 @@ from cypari2.stack cimport new_gen, new_gen_noclear, clear_stack from cypari2.gen cimport Gen as pari_gen, objtogen from sage.rings.finite_rings.element_base cimport FinitePolyExtElement -from .integer_mod import IntegerMod_abstract +from sage.rings.finite_rings.integer_mod import IntegerMod_abstract import sage.rings.integer from sage.rings.integer cimport Integer diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index cc2d1b65dd0..dd79b0d90b9 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1045,7 +1045,7 @@ cdef class FiniteField(Field): pass from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF R = PolynomialRing(GF(self.characteristic()), 'x') self._modulus = R((-1,1)) # Polynomial x - 1 return self._modulus @@ -1288,7 +1288,7 @@ cdef class FiniteField(Field): inclusion_map = self.coerce_map_from(base) from sage.matrix.constructor import matrix - from .maps_finite_field import ( + from sage.rings.finite_rings.maps_finite_field import ( MorphismVectorSpaceToFiniteField, MorphismFiniteFieldToVectorSpace) E = self @@ -1379,7 +1379,7 @@ cdef class FiniteField(Field): if isinstance(R, FiniteField): if R is self: return True - from .residue_field import ResidueField_generic + from sage.rings.finite_rings.residue_field import ResidueField_generic if isinstance(R, ResidueField_generic): return False if R.characteristic() == self.characteristic(): @@ -1543,7 +1543,7 @@ cdef class FiniteField(Field): sage: L(u).minpoly() == u.minpoly() True """ - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.integer import Integer if name is None and names is not None: @@ -1719,7 +1719,7 @@ cdef class FiniteField(Field): sage: GF(3^8, 'a').subfield(4) Finite Field in a4 of size 3^4 """ - from .finite_field_constructor import GF + from sage.rings.finite_rings.finite_field_constructor import GF p = self.characteristic() n = self.degree() if not n % degree == 0: @@ -1926,7 +1926,7 @@ cdef class FiniteField(Field): sage: GF(next_prime(2^16, 2), 'a').is_conway() False """ - from .conway_polynomials import conway_polynomial, exists_conway_polynomial + from sage.rings.finite_rings.conway_polynomials import conway_polynomial, exists_conway_polynomial p = self.characteristic() n = self.degree() return (exists_conway_polynomial(p, n) diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 5f54c04dd36..85dadd6fb2c 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -763,7 +763,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): """ if self._degree_fixed == 1: k = FiniteField(self.domain().characteristic()) - from .hom_prime_finite_field import FiniteFieldHomomorphism_prime + from sage.rings.finite_rings.hom_prime_finite_field import FiniteFieldHomomorphism_prime f = FiniteFieldHomomorphism_prime(Hom(k, self.domain())) else: k = FiniteField(self.domain().characteristic()**self._degree_fixed, diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index d715cec1493..d687c4bf50c 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -153,7 +153,7 @@ def Mod(n, m, parent=None): # m is non-zero, so return n mod m if parent is None: - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing parent = IntegerModRing(m) return IntegerMod(parent, n) @@ -493,7 +493,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): if not isinstance(self, IntegerMod_abstract): # something % Mod(x,y) makes no sense return NotImplemented - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing R = IntegerModRing(modulus) if (self)._parent._IntegerModRing_generic__order % R.order(): raise ArithmeticError(f"reduction modulo {modulus!r} not defined") @@ -1227,7 +1227,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): R = self.parent()['x'] modulus = R.gen()**2 - R(self) if self._parent.is_field(): - from .finite_field_constructor import FiniteField + from sage.rings.finite_rings.finite_field_constructor import FiniteField Q = FiniteField(self._modulus.sageInteger**2, y, modulus) else: R = self.parent()['x'] @@ -1437,7 +1437,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): ....: if (y^41).nth_root(41*r)**(41*r) != y^41: raise RuntimeError ....: if (y^307).nth_root(307*r)**(307*r) != y^307: raise RuntimeError - sage: for t in range(200): # needs sage.libs.pari + sage: for t in range(200): # needs sage.libs.pari sage.rings.padics ....: n = randint(1,2^63) ....: K = Integers(n) ....: b = K.random_element() @@ -2137,7 +2137,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): modulus = self._modulus.sageInteger other_modulus = other._modulus.sageInteger - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_gmp(IntegerModRing(modulus*other_modulus)) try: if mpz_cmp(self.value, other.value) > 0: @@ -2541,7 +2541,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef IntegerMod_int lift cdef int_fast32_t x - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_int(IntegerModRing(self._modulus.int32 * other._modulus.int32)) try: @@ -3377,7 +3377,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cdef IntegerMod_int64 lift cdef int_fast64_t x - from .integer_mod_ring import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing lift = IntegerMod_int64(IntegerModRing(self._modulus.int64 * other._modulus.int64)) try: diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index 9845266870a..e84b303769a 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -386,7 +386,7 @@ class ResidueFieldFactory(UniqueFactory): q = characteristic**(f.degree()) if q < zech_log_bound and (impl is None or impl == 'givaro'): try: - from .residue_field_givaro import ResidueFiniteField_givaro + from sage.rings.finite_rings.residue_field_givaro import ResidueFiniteField_givaro except ImportError: if impl is not None: raise @@ -394,7 +394,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_givaro(p, q, names, f, None, None, None) if q % 2 == 0 and (impl is None or impl == 'ntl'): try: - from .residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e + from sage.rings.finite_rings.residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e except ImportError: if impl is not None: raise @@ -402,7 +402,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_ntl_gf2e(q, names, f, "poly", p, None, None, None) if impl is None or impl == 'pari': try: - from .residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt + from sage.rings.finite_rings.residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt except ImportError: if impl is not None: raise @@ -462,7 +462,7 @@ class ResidueFieldFactory(UniqueFactory): q = characteristic**(f.degree()) if q < zech_log_bound and (impl is None or impl == 'givaro'): try: - from .residue_field_givaro import ResidueFiniteField_givaro + from sage.rings.finite_rings.residue_field_givaro import ResidueFiniteField_givaro except ImportError: if impl is not None: raise @@ -470,7 +470,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_givaro(p, q, names, f, to_vs, to_order, PB) elif q % 2 == 0 and (impl is None or impl == 'ntl'): try: - from .residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e + from sage.rings.finite_rings.residue_field_ntl_gf2e import ResidueFiniteField_ntl_gf2e except ImportError: if impl is not None: raise @@ -478,7 +478,7 @@ class ResidueFieldFactory(UniqueFactory): return ResidueFiniteField_ntl_gf2e(q, names, f, "poly", p, to_vs, to_order, PB) if impl is None or impl == 'pari': try: - from .residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt + from sage.rings.finite_rings.residue_field_pari_ffelt import ResidueFiniteField_pari_ffelt except ImportError: if impl is not None: raise diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index cb0bbce912f..5b6cfa2e29f 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -22,7 +22,7 @@ AUTHORS: from sage.structure.element cimport FieldElement, parent from sage.structure.richcmp cimport richcmp -from .rational_field import QQ +from sage.rings.rational_field import QQ import sage.misc.latex as latex diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index dceaa85fd2e..93a0333a14c 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -83,7 +83,7 @@ def is_FunctionFieldElement(x): """ if isinstance(x, FunctionFieldElement): return True - from .function_field import is_FunctionField + from sage.rings.function_field.function_field import is_FunctionField return is_FunctionField(x.parent()) def make_FunctionFieldElement(parent, element_class, representing_element): diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index 5e748b22a6f..c6fdea83b09 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -385,7 +385,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): if deg == 1: return self._parent(self._x[0].nth_root(self._parent.characteristic())) - from .function_field_rational import RationalFunctionField + from sage.rings.function_field.function_field_rational import RationalFunctionField if not isinstance(self.base_ring(), RationalFunctionField): raise NotImplementedError("only implemented for simple extensions of function fields") # compute a representation of the generator y of the field in terms of powers of y^p diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index 0b36c50f5f7..986a46300b8 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -302,7 +302,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: (1/x^2).valuation(p) # needs sage.libs.pari -2 """ - from .place import FunctionFieldPlace + from sage.rings.function_field.place import FunctionFieldPlace if not isinstance(place, FunctionFieldPlace): # place is an irreducible polynomial diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 3ecd0bd986d..4cf42b666a1 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -183,7 +183,7 @@ from sage.structure.element import coerce_binop from sage.structure.richcmp cimport rich_to_bool_sgn -from . import integer_ring +from sage.rings import integer_ring cimport gmpy2 gmpy2.import_gmpy2() @@ -2536,7 +2536,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): cdef int pow_2 cdef size_t upper,lower,middle - from .real_mpfi import RIF as R + from sage.rings.real_mpfi import RIF as R rif_self = R(self) @@ -2723,7 +2723,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): # (suggested by David Harvey and Carl Witty) # "for randomly distributed integers, the chance of this # interval-based comparison failing is absurdly low" - from .real_mpfi import RIF + from sage.rings.real_mpfi import RIF approx_compare = RIF(m)**guess if self > approx_compare: guess_filled = 1 diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index b510c4ba992..1ee45b99a59 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -69,7 +69,7 @@ from sage.misc.randstate cimport randstate, current_randstate, SAGE_RAND_MAX cimport sage.rings.integer as integer -from . import ring +from sage.rings import ring arith = None cdef void late_import() noexcept: diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 58f65513270..cac7acd812c 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -66,7 +66,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from .infinity import infinity +from sage.rings.infinity import infinity from sage.rings.rational_field import QQ import sage.misc.latex diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 9901eff95a3..a9cb8eda29e 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -406,7 +406,7 @@ compare equal:: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import ideal +from sage.rings import ideal import sage.structure.all from sage.structure.richcmp cimport (richcmp, rich_to_bool) from sage.misc.cachefunc import cached_method @@ -650,7 +650,7 @@ cdef class RingHomomorphism(RingMap): True """ - from .homset import RingHomset_generic + from sage.rings.homset import RingHomset_generic if not isinstance(parent, RingHomset_generic): raise TypeError("parent must be a ring homset") RingMap.__init__(self, parent) @@ -1038,10 +1038,10 @@ cdef class RingHomomorphism(RingMap): sage: f.kernel() # needs sage.libs.singular Ideal (0) of Multivariate Polynomial Ring in t, u over Rational Field """ - from .polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing - from .quotient_ring import is_QuotientRing - from .polynomial.multi_polynomial_ring import is_MPolynomialRing - from .polynomial.polynomial_ring import is_PolynomialRing + from sage.rings.polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing + from sage.rings.quotient_ring import is_QuotientRing + from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing + from sage.rings.polynomial.polynomial_ring import is_PolynomialRing B = self.codomain() graph, from_B, to_A = self._graph_ideal() Q = graph.ring() @@ -1287,8 +1287,8 @@ cdef class RingHomomorphism(RingMap): ... NotImplementedError: rings are not commutative """ - from .quotient_ring import is_QuotientRing - from .ideal import Ideal_generic + from sage.rings.quotient_ring import is_QuotientRing + from sage.rings.ideal import Ideal_generic A = self.domain() B = self.codomain() if not (A.is_commutative() and B.is_commutative()): @@ -2882,7 +2882,7 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 """ - from .ring import CommutativeRing + from sage.rings.ring import CommutativeRing from sage.categories.homset import Hom if not isinstance(domain, CommutativeRing): raise TypeError("The base ring must be a commutative ring") @@ -3135,14 +3135,14 @@ def _tensor_product_ring(B, A): ... ValueError: term ordering must be global """ - from .finite_rings.finite_field_base import FiniteField - from .number_field.number_field_base import NumberField - from .polynomial.multi_polynomial_ring import is_MPolynomialRing - from .polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing - from .polynomial.polynomial_ring import is_PolynomialRing - from .polynomial.polynomial_ring_constructor import PolynomialRing - from .polynomial.term_order import TermOrder - from .quotient_ring import is_QuotientRing + from sage.rings.finite_rings.finite_field_base import FiniteField + from sage.rings.number_field.number_field_base import NumberField + from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing + from sage.rings.polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing + from sage.rings.polynomial.polynomial_ring import is_PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.term_order import TermOrder + from sage.rings.quotient_ring import is_QuotientRing if set(B.variable_names()).isdisjoint(A.variable_names()): names = B.variable_names() + A.variable_names() diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index a0553fc31d9..a21d22e43a4 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -353,7 +353,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): quadratic field elements) """ if check: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(self.number_field(), NumberField_cyclotomic) \ or not isinstance(new_parent, NumberField_cyclotomic): raise TypeError("The field and the new parent field must both be cyclotomic fields.") @@ -523,7 +523,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): return str(self) p = self.polynomial() P = self.parent() - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if isinstance(P, NumberField_cyclotomic): n = P._n() if n != 2 and n % 4 == 2: @@ -564,7 +564,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): ....: t = K.random_element() ....: assert K(libgap(t)) == t, "n = {} t = {}".format(n,t) """ - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic P = self.parent() if not isinstance(P, NumberField_cyclotomic): raise NotImplementedError("libgap conversion is only implemented for cyclotomic fields") @@ -1991,7 +1991,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): raise ArithmeticError("factorization of 0 is not defined") K = self.parent() - from .order import is_NumberFieldOrder + from sage.rings.number_field.order import is_NumberFieldOrder if is_NumberFieldOrder(K): K = K.number_field() fac = K.ideal(self).factor() @@ -2097,7 +2097,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): if R.is_field(): return R.one() - from .order import is_NumberFieldOrder + from sage.rings.number_field.order import is_NumberFieldOrder if not is_NumberFieldOrder(R) or not R.is_maximal(): raise NotImplementedError("gcd() for %r is not implemented" % R) @@ -2886,7 +2886,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): raise ValueError("need a real or complex embedding to convert " "a non rational element of a number field " "into an algebraic number") - from .number_field import refine_embedding + from sage.rings.number_field.number_field import refine_embedding emb = refine_embedding(emb, infinity) return parent(emb(self)) @@ -2999,7 +2999,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): if embedding is None: raise TypeError("an embedding into RR or CC must be specified") - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if isinstance(K, NumberField_cyclotomic): # solution by radicals may be difficult, but we have a closed form from sage.functions.log import exp @@ -3011,7 +3011,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): gen_image = exp(k*two_pi_i/K._n()) return self.polynomial()(gen_image) else: - from .number_field import refine_embedding + from sage.rings.number_field.number_field import refine_embedding # Convert the embedding to an embedding into AA or QQbar embedding = refine_embedding(embedding, infinity) a = embedding(self).radical_expression() @@ -3365,7 +3365,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): True """ if self.__multiplicative_order is None: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if self.is_rational(): if self.is_one(): self.__multiplicative_order = ZZ.one() @@ -3923,7 +3923,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): ... ValueError: P must be prime """ - from .number_field_ideal import is_NumberFieldIdeal + from sage.rings.number_field.number_field_ideal import is_NumberFieldIdeal if not is_NumberFieldIdeal(P): if isinstance(P, NumberFieldElement): P = self.number_field().fractional_ideal(P) diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pyx b/src/sage/rings/number_field/number_field_element_quadratic.pyx index 3cdaabb3140..88118848cc8 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -520,7 +520,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): - Craig Citro (reworked for quadratic elements) """ if check: - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(self.number_field(), NumberField_cyclotomic) \ or not isinstance(new_parent, NumberField_cyclotomic): raise TypeError("The field and the new parent field must both be cyclotomic fields.") @@ -1918,10 +1918,10 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): else: # avoid circular import if self._parent._embedding is None: - from .number_field import NumberField + from sage.rings.number_field.number_field import NumberField K = NumberField(QQ['x'].gen()**2 - negD, 'sqrt%s' % negD) else: - from .number_field import QuadraticField + from sage.rings.number_field.number_field import QuadraticField K = QuadraticField(negD, 'sqrt%s' % negD) q = ( K._zero_element)._new() mpz_set(q.denom, self.denom) diff --git a/src/sage/rings/number_field/number_field_morphisms.pyx b/src/sage/rings/number_field/number_field_morphisms.pyx index 1f6e12ce2c5..38a8dfd3726 100644 --- a/src/sage/rings/number_field/number_field_morphisms.pyx +++ b/src/sage/rings/number_field/number_field_morphisms.pyx @@ -616,7 +616,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): -1 """ Morphism.__init__(self, K, L) - from .number_field import NumberField_cyclotomic + from sage.rings.number_field.number_field import NumberField_cyclotomic if not isinstance(K, NumberField_cyclotomic) or not isinstance(L, NumberField_cyclotomic): raise TypeError("CyclotomicFieldEmbedding only valid for cyclotomic fields.") Kn = K._n() diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index e504fb6b45f..9bce936b362 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -440,7 +440,7 @@ def easy_is_irreducible_py(f): cdef double eps_global eps_global = 10.**(-4) -from .totallyreal_phc import __lagrange_bounds_phc +from sage.rings.number_field.totallyreal_phc import __lagrange_bounds_phc cdef class tr_data: r""" diff --git a/src/sage/rings/padics/morphism.pyx b/src/sage/rings/padics/morphism.pyx index 3dbae06bc51..a50c92a06f9 100644 --- a/src/sage/rings/padics/morphism.pyx +++ b/src/sage/rings/padics/morphism.pyx @@ -21,7 +21,7 @@ from sage.structure.richcmp cimport (richcmp, rich_to_bool, richcmp_not_equal) from sage.rings.morphism cimport RingHomomorphism -from .padic_generic import pAdicGeneric +from sage.rings.padics.padic_generic import pAdicGeneric cdef class FrobeniusEndomorphism_padics(RingHomomorphism): diff --git a/src/sage/rings/padics/padic_printing.pyx b/src/sage/rings/padics/padic_printing.pyx index caf19c7bdf9..f92afb51529 100644 --- a/src/sage/rings/padics/padic_printing.pyx +++ b/src/sage/rings/padics/padic_printing.pyx @@ -464,7 +464,7 @@ cdef class pAdicPrinter_class(SageObject): raise ValueError("max_terse_terms must be positive and fit in a long") else: self.max_terse_terms = _printer_defaults._max_terse_terms - from .factory import _canonicalize_show_prec + from sage.rings.padics.factory import _canonicalize_show_prec self.show_prec = _canonicalize_show_prec(self.ring._prec_type(), mode, show_prec) # Incompatibilities diff --git a/src/sage/rings/padics/pow_computer.pyx b/src/sage/rings/padics/pow_computer.pyx index 83aa163d36b..942b2a6323e 100644 --- a/src/sage/rings/padics/pow_computer.pyx +++ b/src/sage/rings/padics/pow_computer.pyx @@ -624,13 +624,13 @@ cdef PowComputer_base PowComputer_c(Integer m, Integer cache_limit, Integer prec if PC is not None: return PC if prec_type == 'capped-rel': - from .padic_capped_relative_element import PowComputer_ as PC_class + from sage.rings.padics.padic_capped_relative_element import PowComputer_ as PC_class elif prec_type == 'capped-abs': - from .padic_capped_absolute_element import PowComputer_ as PC_class + from sage.rings.padics.padic_capped_absolute_element import PowComputer_ as PC_class elif prec_type == 'fixed-mod': - from .padic_fixed_mod_element import PowComputer_ as PC_class + from sage.rings.padics.padic_fixed_mod_element import PowComputer_ as PC_class elif prec_type == 'floating-point': - from .padic_floating_point_element import PowComputer_ as PC_class + from sage.rings.padics.padic_floating_point_element import PowComputer_ as PC_class else: PC_class = PowComputer_base PC = PC_class(m, mpz_get_ui(cache_limit.value), mpz_get_ui(prec_cap.value), mpz_get_ui(prec_cap.value), in_field) diff --git a/src/sage/rings/padics/pow_computer_flint.pyx b/src/sage/rings/padics/pow_computer_flint.pyx index 6d0837f7ee5..2ef7ff9e879 100644 --- a/src/sage/rings/padics/pow_computer_flint.pyx +++ b/src/sage/rings/padics/pow_computer_flint.pyx @@ -641,13 +641,13 @@ def PowComputer_flint_maker(prime, cache_limit, prec_cap, ram_prec_cap, in_field """ if prec_type == 'capped-rel': - from .qadic_flint_CR import PowComputer_ + from sage.rings.padics.qadic_flint_CR import PowComputer_ elif prec_type == 'capped-abs': - from .qadic_flint_CA import PowComputer_ + from sage.rings.padics.qadic_flint_CA import PowComputer_ elif prec_type == 'fixed-mod': - from .qadic_flint_FM import PowComputer_ + from sage.rings.padics.qadic_flint_FM import PowComputer_ elif prec_type == 'floating-point': - from .qadic_flint_FP import PowComputer_ + from sage.rings.padics.qadic_flint_FP import PowComputer_ else: raise ValueError("unknown prec_type `%s`" % prec_type) return PowComputer_(prime, cache_limit, prec_cap, ram_prec_cap, in_field, poly) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index e9787a2e0f7..561136bac6d 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -253,7 +253,7 @@ from sage.misc.sage_eval import sage_eval import sage.rings.polynomial.polynomial_singular_interface cimport cypari2.gen -from . import polynomial_element +from sage.rings.polynomial import polynomial_element permstore=[] cdef class MPolynomialRing_libsingular(MPolynomialRing_base): diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index 66ade555385..44946845b83 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -22,9 +22,9 @@ from sage.arith.misc import binomial from sage.rings.integer_ring import ZZ -from . import polynomial_ring -from .term_order import TermOrder -from .polynomial_ring_constructor import (PolynomialRing, +from sage.rings.polynomial import polynomial_ring +from sage.rings.polynomial.term_order import TermOrder +from sage.rings.polynomial.polynomial_ring_constructor import (PolynomialRing, polynomial_default_category) @@ -135,7 +135,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): """ base = self.base_ring() if is_MPolynomialRing(base) or polynomial_ring.is_PolynomialRing(base): - from .flatten import FlatteningMorphism + from sage.rings.polynomial.flatten import FlatteningMorphism return FlatteningMorphism(self) else: return IdentityMorphism(self) @@ -157,7 +157,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): False """ - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.categories.pushout import MultiPolynomialFunctor return MultiPolynomialFunctor(self.variable_names(), self.term_order()), self.base_ring() @@ -323,7 +323,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): vars.remove(str(v)) if len(vars) == 0: return self.base_ring() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if order is None: try: return PolynomialRing(self.base_ring(), vars, @@ -614,7 +614,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): a dict with respect to ``self.variable_names()``. """ # This is probably horribly inefficient - from .polydict import ETuple + from sage.rings.polynomial.polydict import ETuple other_vars = list(x.parent().variable_names()) name_mapping = [(other_vars.index(var) if var in other_vars else -1) for var in self.variable_names()] K = self.base_ring() @@ -705,7 +705,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): return "%s[%s]" % (sage.misc.latex.latex(self.base_ring()), vars) def _ideal_class_(self, n=0): - from .multi_polynomial_ideal import MPolynomialIdeal + from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal return MPolynomialIdeal def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): @@ -915,7 +915,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): elif not set(my_vars).issubset(set(vars)): while my_vars[-1] in vars: my_vars.pop() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(self.base_ring(), my_vars) else: try: @@ -1357,7 +1357,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): if order is None: order = self.term_order() - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, self.ngens(), names, order=order) def monomial(self, *exponents): @@ -1786,11 +1786,11 @@ cdef class BooleanPolynomialRing_base(MPolynomialRing_base): # Leave *all* old versions! def unpickle_MPolynomialRing_generic_v1(base_ring, n, names, order): - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, n, names=names, order=order) def unpickle_MPolynomialRing_generic(base_ring, n, names, order): - from .polynomial_ring_constructor import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing return PolynomialRing(base_ring, n, names=names, order=order) diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 44c86cb84cb..ede464edddf 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -118,7 +118,7 @@ from sage.misc.derivative import multi_derivative from sage.arith.misc import sort_complex_numbers_for_display, power_mod, is_prime from sage.arith.functions import lcm -from . import polynomial_fateman +from sage.rings.polynomial import polynomial_fateman from sage.rings.ideal import is_Ideal from sage.rings.polynomial.polynomial_ring import is_PolynomialRing diff --git a/src/sage/rings/polynomial/polynomial_number_field.pyx b/src/sage/rings/polynomial/polynomial_number_field.pyx index 96f1c002e99..5bd458e5d12 100644 --- a/src/sage/rings/polynomial/polynomial_number_field.pyx +++ b/src/sage/rings/polynomial/polynomial_number_field.pyx @@ -72,7 +72,7 @@ We can also construct polynomials over relative number fields:: # http://www.gnu.org/licenses/ #***************************************************************************** -from .polynomial_element_generic import Polynomial_generic_dense_field +from sage.rings.polynomial.polynomial_element_generic import Polynomial_generic_dense_field from sage.rings.rational_field import QQ from sage.structure.element import coerce_binop from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx index b65bda0dc81..d11eec97269 100644 --- a/src/sage/rings/power_series_mpoly.pyx +++ b/src/sage/rings/power_series_mpoly.pyx @@ -2,9 +2,9 @@ from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element -from .infinity import infinity -from .polynomial.multi_polynomial_ring_base import is_MPolynomialRing -from . import power_series_poly +from sage.rings.infinity import infinity +from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing +from sage.rings import power_series_poly cdef class PowerSeries_mpoly(PowerSeries): diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 894d05c787b..c651fe03d02 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -6,7 +6,7 @@ The class ``PowerSeries_poly`` provides additional methods for univariate power """ from sage.rings.power_series_ring_element cimport PowerSeries from sage.structure.element cimport Element -from .infinity import infinity +from sage.rings.infinity import infinity from sage.libs.pari.all import pari_gen, PariError diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index b2ce51e09b3..31206e347f9 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -96,7 +96,7 @@ With power series the behavior is the same. # **************************************************************************** from cpython.object cimport Py_EQ, Py_NE -from .infinity import infinity, is_Infinite +from sage.rings.infinity import infinity, is_Infinite from sage.rings.rational_field import QQ @@ -104,7 +104,7 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing import sage.misc.misc import sage.arith.all as arith import sage.misc.latex -from .integer import Integer +from sage.rings.integer import Integer from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.categories.fields import Fields @@ -2957,7 +2957,7 @@ def _solve_linear_de(R, N, L, a, b, f0): def make_powerseries_poly_v0(parent, f, prec, is_gen): # This is only used to unpickle old pickles. The new pickling # works differently! - from . import power_series_poly + from sage.rings import power_series_poly return power_series_poly.PowerSeries_poly(parent, f, prec, 0, is_gen) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 09ff7be6a29..150e4a523bd 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -74,7 +74,7 @@ import sage.rings.rational_field cimport sage.rings.integer as integer from sage.rings.integer cimport Integer -from .integer_ring import ZZ +from sage.rings.integer_ring import ZZ from sage.structure.coerce cimport is_numpy_type @@ -1749,7 +1749,7 @@ cdef class Rational(sage.structure.element.FieldElement): return (self > 0) ## Check that p is prime - from .integer_ring import ZZ + from sage.rings.integer_ring import ZZ p = ZZ(p) if check and not p.is_prime(): raise ValueError('p must be "infinity" or a positive prime number.') @@ -4094,8 +4094,8 @@ cdef class Z_to_Q(Morphism): From: Integer Ring To: Rational Field """ - from . import integer_ring - from . import rational_field + from sage.rings import integer_ring + from sage.rings import rational_field import sage.categories.homset Morphism.__init__(self, sage.categories.homset.Hom(integer_ring.ZZ, rational_field.QQ)) @@ -4215,7 +4215,7 @@ cdef class int_to_Q(Morphism): From: Set of Python objects of class 'int' To: Rational Field """ - from . import rational_field + from sage.rings import rational_field import sage.categories.homset from sage.sets.pythonclass import Set_PythonType Morphism.__init__(self, sage.categories.homset.Hom( diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index f1e5eb0a2c8..19c9501bcf8 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -327,9 +327,9 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): if S is int or S is float: return ToRDF(S) - from .rational_field import QQ + from sage.rings.rational_field import QQ try: - from .real_lazy import RLF + from sage.rings.real_lazy import RLF except ImportError: RLF = None @@ -349,7 +349,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): return None try: - from .real_mpfr import RR + from sage.rings.real_mpfr import RR except ImportError: pass else: @@ -431,7 +431,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): if prec == 53: return self else: - from .real_mpfr import RealField + from sage.rings.real_mpfr import RealField return RealField(prec) @@ -979,7 +979,7 @@ cdef class RealDoubleElement(FieldElement): sage: mathematica(RDF(1e-25)) # optional - mathematica 1.*^-25 """ - from .real_mpfr import RR + from sage.rings.real_mpfr import RR return RR(self._value)._mathematica_init_() def _sage_input_(self, sib, coerced): @@ -2069,7 +2069,7 @@ def is_RealDoubleElement(x): cdef RealDoubleElement global_dummy_element try: - from .real_double_element_gsl import RealDoubleElement_gsl + from sage.rings.real_double_element_gsl import RealDoubleElement_gsl except ImportError: global_dummy_element = RealDoubleElement(0) else: @@ -2175,7 +2175,7 @@ cdef void fast_tp_dealloc(PyObject* o) noexcept: from sage.misc.allocator cimport hook_tp_functions, hook_tp_functions_type hook_tp_functions(global_dummy_element, (&fast_tp_new), (&fast_tp_dealloc), False) try: - from .real_double_element_gsl import RealDoubleElement_gsl + from sage.rings.real_double_element_gsl import RealDoubleElement_gsl except Exception: pass else: diff --git a/src/sage/rings/real_double_element_gsl.pyx b/src/sage/rings/real_double_element_gsl.pyx index 3ebb703b367..05346073d08 100644 --- a/src/sage/rings/real_double_element_gsl.pyx +++ b/src/sage/rings/real_double_element_gsl.pyx @@ -216,10 +216,10 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): cdef _log_base(self, double log_of_base) noexcept: if self._value == 0: - from .real_double import RDF + from sage.rings.real_double import RDF return RDF(-1)/RDF(0) elif self._value < 0: - from .real_double import RDF + from sage.rings.real_double import RDF return RDF.NaN() sig_on() a = self._new_c(gsl_sf_log(self._value) / log_of_base) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index d0ab92e3f8d..58e3d8de737 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -272,8 +272,8 @@ from sage.structure.richcmp cimport richcmp from sage.rings.convert.mpfi cimport mpfi_set_sage from sage.rings.real_mpfr cimport RealField_class, RealNumber, RealField from sage.rings.integer cimport Integer -from .integer_ring import ZZ -from .rational_field import QQ +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ cimport sage.rings.abc diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 9117dfcd4ce..e3152522fbd 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -725,9 +725,9 @@ cdef class RealField_class(sage.rings.abc.RealField): sage: R.get_action(ZZ) Right scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Real Field with 53 bits of precision """ - from .integer_ring import ZZ - from .rational_field import QQ - from .real_double import RDF + from sage.rings.integer_ring import ZZ + from sage.rings.rational_field import QQ + from sage.rings.real_double import RDF if S is ZZ: return ZZtoRR(ZZ, self) @@ -1875,7 +1875,7 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RealField(100)(2).imag() 0 """ - from .integer_ring import ZZ + from sage.rings.integer_ring import ZZ return ZZ(0) @@ -2389,7 +2389,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._add_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2413,7 +2413,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._sub_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2437,7 +2437,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._mul_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -2461,7 +2461,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if have_same_parent(left, right): return ( left)._div_(right) try: - from .real_mpfi import RealIntervalFieldElement + from sage.rings.real_mpfi import RealIntervalFieldElement except ImportError: RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: @@ -3714,7 +3714,7 @@ cdef class RealNumber(sage.structure.element.RingElement): if mpfr_zero_p(self.value): return Rational(0) - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField cdef mpfr_rnd_t rnd = (self._parent).rnd cdef mpfr_prec_t prec = (self._parent)._prec @@ -3834,7 +3834,7 @@ cdef class RealNumber(sage.structure.element.RingElement): raise ValueError('Must specify exactly one of max_error or max_denominator in nearby_rational()') if max_error is not None: - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField intv_field = RealIntervalField(self.prec()) intv = intv_field(self - max_error, self + max_error) @@ -5661,7 +5661,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # If we got here, then we're not a perfect power of a boundary # point, so it's safe to use the interval arithmetic technique. - from .real_mpfi import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField cdef mpfr_prec_t prec = fld._prec + 10 diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 75f58656385..71e72f4f45c 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -1447,7 +1447,7 @@ cdef class CommutativeRing(Ring): sage: f(1+u) 1 + u^25 """ - from .morphism import FrobeniusEndomorphism_generic + from sage.rings.morphism import FrobeniusEndomorphism_generic return FrobeniusEndomorphism_generic(self, n) def derivation_module(self, codomain=None, twist=None): diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index e6ec62dc7f1..04be29e0fdc 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -22,7 +22,7 @@ from libc.math cimport sqrt from cysignals.signals cimport sig_on, sig_off cimport sage.rings.integer as integer -from . import integer +from sage.rings import integer cdef int two_squares_c(uint_fast32_t n, uint_fast32_t res[2]) noexcept: r""" diff --git a/src/sage/sat/solvers/satsolver.pyx b/src/sage/sat/solvers/satsolver.pyx index 1c4ac400cb6..c13a101c37a 100644 --- a/src/sage/sat/solvers/satsolver.pyx +++ b/src/sage/sat/solvers/satsolver.pyx @@ -390,16 +390,16 @@ def SAT(solver=None, *args, **kwds): from sage.sat.solvers.picosat import PicoSAT return PicoSAT(*args, **kwds) elif solver == "LP": - from .sat_lp import SatLP + from sage.sat.solvers.sat_lp import SatLP return SatLP() elif solver == 'glucose': - from .dimacs import Glucose + from sage.sat.solvers.dimacs import Glucose return Glucose(*args, **kwds) elif solver == 'glucose-syrup': - from .dimacs import GlucoseSyrup + from sage.sat.solvers.dimacs import GlucoseSyrup return GlucoseSyrup(*args, **kwds) elif solver == 'kissat': - from .dimacs import Kissat + from sage.sat.solvers.dimacs import Kissat return Kissat(*args, **kwds) else: raise ValueError("Solver '{}' is not available".format(solver)) diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index 9a0cbd66b9a..6ac939db3c8 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -2672,7 +2672,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): _register_pair(self, S, "action") # avoid possible infinite loops # detect actions defined by _rmul_, _lmul_, _act_on_, and _acted_upon_ methods - from .coerce_actions import detect_element_action + from sage.structure.coerce_actions import detect_element_action action = detect_element_action(self, S, self_on_left, self_el, S_el) if action is not None: return action diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 0b80c017a0b..9d86a81b24b 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -922,7 +922,7 @@ cdef class Expression(Expression_abc): if state[0] != 0 or len(state) != 3: raise ValueError("unknown state information") # set parent - from .ring import SR + from sage.symbolic.ring import SR self._parent = SR # get variables cdef GExList sym_lst @@ -966,7 +966,7 @@ cdef class Expression(Expression_abc): True """ - from .ring import SR + from sage.symbolic.ring import SR SR.cleanup_var(self) return False @@ -3250,7 +3250,7 @@ cdef class Expression(Expression_abc): sage: x.is_trivially_equal(QQbar(1/2)) True """ - from .ring import SR + from sage.symbolic.ring import SR cdef Expression _other = (SR(other)) sig_on() try: @@ -12130,7 +12130,7 @@ cdef class Expression(Expression_abc): ... ValueError: cannot convert """ - from . import units + from sage.symbolic import units return units.convert(self, target) ################################################################### diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx index 589c500d00d..e1c6b19f659 100644 --- a/src/sage/symbolic/function.pyx +++ b/src/sage/symbolic/function.pyx @@ -148,10 +148,10 @@ from sage.structure.richcmp cimport richcmp from sage.misc.fpickle import pickle_function, unpickle_function -from .symbols import symbol_table, register_symbol +from sage.symbolic.symbols import symbol_table, register_symbol try: - from .expression import ( + from sage.symbolic.expression import ( call_registered_function, find_registered_function, register_or_update_function, get_sfunction_from_hash, get_sfunction_from_serial as get_sfunction_from_serial ) @@ -528,7 +528,7 @@ cdef class Function(SageObject): # to a numeric type at the end symbolic_input = any(isinstance(arg, Expression) for arg in args) - from .ring import SR + from sage.symbolic.ring import SR if coerce: try: @@ -606,7 +606,7 @@ cdef class Function(SageObject): sage: sin.default_variable() # needs sage.symbolic x """ - from .ring import SR + from sage.symbolic.ring import SR return SR.var('x') def _is_numerical(self, x): @@ -1052,7 +1052,7 @@ cdef class BuiltinFunction(Function): if (self._preserved_arg and isinstance(args[self._preserved_arg-1], Element)): arg_parent = parent(args[self._preserved_arg-1]) - from .ring import SR + from sage.symbolic.ring import SR if arg_parent is SR: return res from sage.rings.polynomial.polynomial_ring import PolynomialRing_commutative diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi index 88436ee2705..b2091522c49 100644 --- a/src/sage/symbolic/pynac_impl.pxi +++ b/src/sage/symbolic/pynac_impl.pxi @@ -70,7 +70,7 @@ cdef ex_to_pyExpression(GEx juice) noexcept: cdef Expression nex nex = Expression.__new__(Expression) nex._gobj = GEx(juice) - from .ring import SR + from sage.symbolic.ring import SR nex._parent = SR return nex @@ -189,7 +189,7 @@ cdef GEx pyExpression_to_ex(res) except *: """ if res is None: raise TypeError("function returned None, expected return value of type sage.symbolic.expression.Expression") - from .ring import SR + from sage.symbolic.ring import SR try: t = SR.coerce(res) except TypeError as err: @@ -1156,7 +1156,7 @@ cdef bint py_is_integer(x) noexcept: if not isinstance(x, Element): return False P = (x)._parent - from .ring import SymbolicRing + from sage.symbolic.ring import SymbolicRing return (isinstance(P, SymbolicRing) or P.is_exact()) and x in ZZ @@ -1246,7 +1246,7 @@ cdef bint py_is_exact(x) noexcept: if not isinstance(x, Element): return False P = (x)._parent - from .ring import SymbolicRing + from sage.symbolic.ring import SymbolicRing return isinstance(P, SymbolicRing) or P.is_exact() @@ -1553,7 +1553,7 @@ cdef py_step(n) noexcept: """ Return step function of n. """ - from .ring import SR + from sage.symbolic.ring import SR if n < 0: return SR(0) elif n > 0: @@ -2466,7 +2466,7 @@ def init_pynac_I(): from sage.rings.number_field.number_field import GaussianField pynac_I = GaussianField().gen() ginac_pyinit_I(pynac_I) - from .ring import SR + from sage.symbolic.ring import SR return new_Expression_from_GEx(SR, g_I) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index f3f32b9c922..a74db5807d5 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -213,7 +213,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): from sage.rings.real_lazy import RLF, CLF from sage.rings.finite_rings.finite_field_base import FiniteField - from .subring import GenericSymbolicSubring + from sage.symbolic.subring import GenericSymbolicSubring if R._is_numerical(): # Almost anything with a coercion into any precision of CC @@ -1133,7 +1133,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): """ if self is not SR: raise NotImplementedError('cannot create subring of %s' % (self,)) - from .subring import SymbolicSubring + from sage.symbolic.subring import SymbolicSubring return SymbolicSubring(*args, **kwds) def _fricas_init_(self): From 900517111e2496c3295520309047232b29ba7076 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Sep 2023 17:07:03 -0700 Subject: [PATCH 3/4] sage.misc.package_dir.cython_namespace_package_support: Do not patch Cython 3 --- src/sage/misc/package_dir.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/sage/misc/package_dir.py b/src/sage/misc/package_dir.py index 9f075b16c31..1b57d30790a 100644 --- a/src/sage/misc/package_dir.py +++ b/src/sage/misc/package_dir.py @@ -203,15 +203,19 @@ def cython_namespace_package_support(): See https://github.com/cython/cython/issues/2918#issuecomment-991799049 """ - import Cython.Build.Dependencies - import Cython.Build.Cythonize - import Cython.Utils - orig_is_package_dir = Cython.Utils.is_package_dir - Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = Cython.Utils.cached_function(is_package_or_sage_namespace_package_dir) - try: + from Cython import __version__ + if __version__[0] >= '3': yield - finally: - Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = orig_is_package_dir + else: + import Cython.Build.Dependencies + import Cython.Build.Cythonize + import Cython.Utils + orig_is_package_dir = Cython.Utils.is_package_dir + Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = Cython.Utils.cached_function(is_package_or_sage_namespace_package_dir) + try: + yield + finally: + Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = orig_is_package_dir def walk_packages(path=None, prefix='', onerror=None): From ed9b3b4d4aed1c653200b311223bf5fa3dc06fea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Nov 2023 14:56:42 -0800 Subject: [PATCH 4/4] Fix remaining relative cimports --- src/sage/matrix/matrix_mod2_dense.pxd | 2 +- src/sage/matrix/matrix_sparse.pxd | 2 +- src/sage/modules/vector_mod2_dense.pxd | 2 +- src/sage/rings/finite_rings/hom_finite_field_givaro.pxd | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sage/matrix/matrix_mod2_dense.pxd b/src/sage/matrix/matrix_mod2_dense.pxd index 82df8116a5c..2665aa5d0fe 100644 --- a/src/sage/matrix/matrix_mod2_dense.pxd +++ b/src/sage/matrix/matrix_mod2_dense.pxd @@ -1,4 +1,4 @@ -from .matrix_dense cimport Matrix_dense +from sage.matrix.matrix_dense cimport Matrix_dense from sage.libs.m4ri cimport * cdef class Matrix_mod2_dense(Matrix_dense): diff --git a/src/sage/matrix/matrix_sparse.pxd b/src/sage/matrix/matrix_sparse.pxd index 7546645a6c9..7d8878ea4d8 100644 --- a/src/sage/matrix/matrix_sparse.pxd +++ b/src/sage/matrix/matrix_sparse.pxd @@ -1,4 +1,4 @@ -from .matrix cimport Matrix +from sage.matrix.matrix cimport Matrix cdef class Matrix_sparse(Matrix): pass diff --git a/src/sage/modules/vector_mod2_dense.pxd b/src/sage/modules/vector_mod2_dense.pxd index 98a77624019..1292762a76e 100644 --- a/src/sage/modules/vector_mod2_dense.pxd +++ b/src/sage/modules/vector_mod2_dense.pxd @@ -1,4 +1,4 @@ -from .free_module_element cimport FreeModuleElement +from sage.modules.free_module_element cimport FreeModuleElement from sage.libs.m4ri cimport mzd_t diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd b/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd index 62898386212..123f91c602d 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd @@ -1,8 +1,7 @@ -from .hom_finite_field cimport (SectionFiniteFieldHomomorphism_generic, +from sage.rings.finite_rings.element_givaro cimport Cache_givaro +from sage.rings.finite_rings.hom_finite_field cimport (SectionFiniteFieldHomomorphism_generic, FiniteFieldHomomorphism_generic, FrobeniusEndomorphism_finite_field) - from sage.structure.element cimport Element -from .element_givaro cimport Cache_givaro cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_generic):