Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace relative imports by absolute ones in rings #36588

Merged
merged 7 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/rings/abc.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .ring cimport CommutativeRing, Field
from sage.rings.ring cimport CommutativeRing, Field

cdef class RealField(Field):

Expand Down
94 changes: 47 additions & 47 deletions src/sage/rings/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# ****************************************************************************
from sage.misc.lazy_import import lazy_import

from .all__sagemath_categories import *
from sage.rings.all__sagemath_categories import *

# Ring base classes
from .ring import (Ring, Field, CommutativeRing, IntegralDomain,
from sage.rings.ring import (Ring, Field, CommutativeRing, IntegralDomain,
DedekindDomain, PrincipalIdealDomain, EuclideanDomain)

# Ring element base classes
Expand All @@ -25,22 +25,22 @@
EuclideanDomainElement, FieldElement)

# Ideals
from .ideal import Ideal
from sage.rings.ideal import Ideal
ideal = Ideal

# Quotient
from .quotient_ring import QuotientRing
from sage.rings.quotient_ring import QuotientRing

# Infinities
from .infinity import infinity, Infinity, InfinityRing, unsigned_infinity, UnsignedInfinityRing
from sage.rings.infinity import infinity, Infinity, InfinityRing, unsigned_infinity, UnsignedInfinityRing

# Rational integers.
from .integer_ring import IntegerRing, ZZ, crt_basis
from .integer import Integer
from sage.rings.integer_ring import IntegerRing, ZZ, crt_basis
from sage.rings.integer import Integer

# Rational numbers
from .rational_field import RationalField, QQ
from .rational import Rational
from sage.rings.rational_field import RationalField, QQ
from sage.rings.rational import Rational
Rationals = RationalField

# Integers modulo n.
Expand All @@ -49,120 +49,120 @@
Integers = IntegerModRing

# Finite fields
from .finite_rings.all import *
from sage.rings.finite_rings.all import *

# Number field
from .number_field.all import *
from sage.rings.number_field.all import *

# Function field
from .function_field.all import *
from sage.rings.function_field.all import *

# Finite residue fields
from .finite_rings.residue_field import ResidueField
from sage.rings.finite_rings.residue_field import ResidueField

# p-adic field
from .padics.all import *
from .padics.padic_printing import _printer_defaults as padic_printing
from sage.rings.padics.all import *
from sage.rings.padics.padic_printing import _printer_defaults as padic_printing

# valuations
from .valuation.all import *
from sage.rings.valuation.all import *

# Semirings
from .semirings.all import *
from sage.rings.semirings.all import *

# Real numbers
from .real_mpfr import (RealField, RR,
from sage.rings.real_mpfr import (RealField, RR,
create_RealNumber as RealNumber) # this is used by the preparser to wrap real literals -- very important.
Reals = RealField

from .real_double import RealDoubleField, RDF, RealDoubleElement
from sage.rings.real_double import RealDoubleField, RDF, RealDoubleElement

from .real_lazy import RealLazyField, RLF, ComplexLazyField, CLF
from sage.rings.real_lazy import RealLazyField, RLF, ComplexLazyField, CLF

from sage.rings.real_arb import RealBallField, RBF

# Polynomial Rings and Polynomial Quotient Rings
from .polynomial.all import *
from sage.rings.polynomial.all import *


# Algebraic numbers
from .qqbar import (AlgebraicRealField, AA,
from sage.rings.qqbar import (AlgebraicRealField, AA,
AlgebraicReal,
AlgebraicField, QQbar,
AlgebraicNumber,
number_field_elements_from_algebraics)
from .universal_cyclotomic_field import UniversalCyclotomicField, E
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField, E

# Intervals
from .real_mpfi import (RealIntervalField,
from sage.rings.real_mpfi import (RealIntervalField,
RIF,
RealInterval)

# Complex numbers
from .complex_mpfr import ComplexField
from .complex_mpfr import create_ComplexNumber as ComplexNumber
from sage.rings.complex_mpfr import ComplexField
from sage.rings.complex_mpfr import create_ComplexNumber as ComplexNumber
Complexes = ComplexField
from .complex_interval_field import ComplexIntervalField
from .complex_interval import (create_ComplexIntervalFieldElement as ComplexIntervalFieldElement)
from sage.rings.complex_interval_field import ComplexIntervalField
from sage.rings.complex_interval import (create_ComplexIntervalFieldElement as ComplexIntervalFieldElement)

from .complex_double import ComplexDoubleField, ComplexDoubleElement, CDF
from sage.rings.complex_double import ComplexDoubleField, ComplexDoubleElement, CDF

from .complex_mpc import MPComplexField
from sage.rings.complex_mpc import MPComplexField

from sage.rings.complex_arb import ComplexBallField, CBF

lazy_import("sage.rings.imaginary_unit", "I")

# Power series rings
from .power_series_ring import PowerSeriesRing
from sage.rings.power_series_ring import PowerSeriesRing

# Laurent series ring in one variable
from .laurent_series_ring import LaurentSeriesRing
from sage.rings.laurent_series_ring import LaurentSeriesRing

# Lazy Laurent series ring
lazy_import('sage.rings.lazy_series_ring', ['LazyLaurentSeriesRing', 'LazyPowerSeriesRing',
'LazySymmetricFunctions', 'LazyDirichletSeriesRing'])

# Tate algebras
from .tate_algebra import TateAlgebra
from sage.rings.tate_algebra import TateAlgebra

# Puiseux series ring
from .puiseux_series_ring import PuiseuxSeriesRing
from sage.rings.puiseux_series_ring import PuiseuxSeriesRing

# Pseudo-ring of PARI objects.
from .pari_ring import PariRing, Pari
from sage.rings.pari_ring import PariRing, Pari

# Big-oh notation
from .big_oh import O
from sage.rings.big_oh import O

# Fraction field
from .fraction_field import FractionField
from sage.rings.fraction_field import FractionField
Frac = FractionField

# Localization
from .localization import Localization
from sage.rings.localization import Localization

# c-finite sequences
from .cfinite_sequence import CFiniteSequence, CFiniteSequences
from sage.rings.cfinite_sequence import CFiniteSequence, CFiniteSequences

from .bernoulli_mod_p import bernoulli_mod_p, bernoulli_mod_p_single
from sage.rings.bernoulli_mod_p import bernoulli_mod_p, bernoulli_mod_p_single

from .monomials import monomials
from sage.rings.monomials import monomials

from .cc import CC
from .cif import CIF
from sage.rings.cc import CC
from sage.rings.cif import CIF

# invariant theory
from .invariants.all import *
from sage.rings.invariants.all import *

from .fast_arith import prime_range
from sage.rings.fast_arith import prime_range

# continued fractions
from sage.rings.continued_fraction import (continued_fraction,
continued_fraction_list)

# asymptotic ring
from .asymptotic.all import *
from sage.rings.asymptotic.all import *

# Register classes in numbers abc
from . import numbers_abc
from sage.rings import numbers_abc
6 changes: 3 additions & 3 deletions src/sage/rings/all__sagemath_categories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ring base classes
from .ring import Ring

from sage.rings.ring import Ring
# Ideals
from .ideal import Ideal
from sage.rings.ideal import Ideal

ideal = Ideal
11 changes: 7 additions & 4 deletions src/sage/rings/big_oh.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from sage.arith.misc import factor
from sage.misc.lazy_import import lazy_import

lazy_import('sage.rings.padics.factory', ['Qp', 'Zp'])
lazy_import('sage.rings.padics.padic_generic_element', 'pAdicGenericElement')
from sage.rings.polynomial.polynomial_element import Polynomial
Expand All @@ -25,10 +26,12 @@
except ImportError:
PuiseuxSeries = ()

from . import power_series_ring_element
from . import integer
from . import rational
from . import multi_power_series_ring_element
from sage.rings import (
integer,
multi_power_series_ring_element,
power_series_ring_element,
rational,
)


def O(*x, **kwds):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/cc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .complex_mpfr import ComplexField
from sage.rings.complex_mpfr import ComplexField

CC = ComplexField()
2 changes: 1 addition & 1 deletion src/sage/rings/cif.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .complex_interval_field import ComplexIntervalField
from sage.rings.complex_interval_field import ComplexIntervalField

CIF = ComplexIntervalField()
4 changes: 2 additions & 2 deletions src/sage/rings/complex_conversion.pyx
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/complex_double.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ 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 .real_double import RDF
from sage.rings.real_double cimport RealDoubleElement, double_repr
from sage.rings.real_double import RDF
from sage.rings.integer_ring import ZZ
from sage.structure.richcmp cimport rich_to_bool

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/complex_interval.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/complex_interval.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ 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 .infinity import infinity
from sage.rings.real_mpfr cimport RealNumber
from sage.rings.convert.mpfi cimport mpfi_set_sage
from sage.rings.infinity import infinity


def is_ComplexIntervalFieldElement(x):
Expand Down
19 changes: 9 additions & 10 deletions src/sage/rings/complex_interval_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@
# ****************************************************************************


from sage.structure.parent import Parent
from .integer_ring import ZZ
from .rational_field import QQ
from .ring import Field
import sage.rings.abc
from . import integer
from . import complex_interval
import weakref
from .real_mpfi import RealIntervalField, RealIntervalField_class
from .complex_mpfr import ComplexField
from sage.misc.cachefunc import cached_method

import sage.rings.abc
from sage.misc.cachefunc import cached_method
from sage.rings import complex_interval, integer
from sage.rings.complex_mpfr import ComplexField
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_mpfi import RealIntervalField, RealIntervalField_class
from sage.rings.ring import Field
from sage.structure.parent import Parent

cache = {}
def ComplexIntervalField(prec=53, names=None):
Expand Down
12 changes: 6 additions & 6 deletions src/sage/rings/complex_mpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -74,13 +74,13 @@ 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 .complex_mpfr import ComplexField_class
from sage.rings.integer cimport Integer
from sage.rings.complex_mpfr cimport ComplexNumber
from sage.rings.complex_mpfr import ComplexField_class

from sage.misc.randstate cimport randstate, current_randstate
from .real_mpfr cimport RealField_class, RealNumber
from .real_mpfr import mpfr_prec_min, mpfr_prec_max
from sage.rings.real_mpfr cimport RealField_class, RealNumber
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

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/complex_mpfr.pxd
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/complex_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ 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 import infinity
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
Expand Down
Loading
Loading