diff --git a/src/sage/modular/modform_hecketriangle/abstract_space.py b/src/sage/modular/modform_hecketriangle/abstract_space.py index 79a3fb10a04..89c86ca41c2 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_space.py +++ b/src/sage/modular/modform_hecketriangle/abstract_space.py @@ -22,15 +22,16 @@ from sage.rings.infinity import infinity from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ -from sage.rings.laurent_series_ring import is_LaurentSeriesRing +from sage.rings.laurent_series_ring import LaurentSeriesRing from sage.rings.polynomial.polynomial_ring import PolynomialRing_general -from sage.rings.power_series_ring import is_PowerSeriesRing +from sage.rings.power_series_ring import PowerSeriesRing_generic from sage.rings.rational_field import QQ from sage.structure.element import parent from .abstract_ring import FormsRing_abstract lazy_import('sage.rings.imaginary_unit', 'I') +lazy_import('sage.rings.lazy_series_ring', ('LazyLaurentSeriesRing', 'LazyPowerSeriesRing')) lazy_import('sage.rings.qqbar', 'QQbar') @@ -254,8 +255,9 @@ def _element_constructor_(self, el): # can be changed in construct_form # resp. construct_quasi_form)) P = parent(el) - if is_LaurentSeriesRing(P) or is_PowerSeriesRing(P): - if (self.is_modular()): + if isinstance(P, (LaurentSeriesRing, PowerSeriesRing_generic, + LazyLaurentSeriesRing, LazyPowerSeriesRing)): + if self.is_modular(): return self.construct_form(el) else: return self.construct_quasi_form(el) diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index 6af7b1a325d..48caffa1b6a 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -414,15 +414,24 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** +import sage.rings.abc + +from sage.categories.pushout import ConstructionFunctor +from sage.misc.defaults import series_precision +from sage.misc.lazy_import import lazy_import +from sage.rings.real_mpfi import RIF from sage.structure.element import CommutativeAlgebraElement from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation -from sage.misc.defaults import series_precision -from sage.categories.pushout import ConstructionFunctor -import sage.rings.abc -from sage.rings.real_mpfi import RIF + from .misc import WithLocals +lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') +lazy_import('sage.rings.polynomial.multi_polynomial_ring_base', 'MPolynomialRing_base') +lazy_import('sage.rings.polynomial.polynomial_ring', 'PolynomialRing_general') +lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic') +lazy_import('sage.symbolic.ring', 'SymbolicRing') + class NoConvergenceError(RuntimeError): r""" @@ -3988,10 +3997,6 @@ def _element_constructor_(self, data, simplify=True, convert=True): return self.create_summand('exact', data) from .misc import combine_exceptions - from sage.symbolic.ring import SymbolicRing - from sage.rings.polynomial.polynomial_ring import PolynomialRing_general - from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base - from sage.rings.power_series_ring import is_PowerSeriesRing if isinstance(P, SymbolicRing): from sage.symbolic.operators import add_vararg @@ -4028,7 +4033,7 @@ def _element_constructor_(self, data, simplify=True, convert=True): raise combine_exceptions( ValueError('Polynomial %s is not in %s' % (data, self)), e) - elif is_PowerSeriesRing(P): + elif isinstance(P, (PowerSeriesRing_generic, LazyPowerSeriesRing)): raise NotImplementedError( 'cannot convert %s from the %s to an asymptotic expansion ' 'in %s, since growths at other points than +oo are not yet ' diff --git a/src/sage/rings/asymptotic/misc.py b/src/sage/rings/asymptotic/misc.py index 827a9ded81c..e3d7a013285 100644 --- a/src/sage/rings/asymptotic/misc.py +++ b/src/sage/rings/asymptotic/misc.py @@ -28,8 +28,15 @@ # **************************************************************************** from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import lazy_import from sage.structure.sage_object import SageObject +lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') +lazy_import('sage.rings.multi_power_series_ring', 'MPowerSeriesRing_generic') +lazy_import('sage.rings.polynomial.multi_polynomial_ring_base', 'MPolynomialRing_base') +lazy_import('sage.rings.polynomial.polynomial_ring', 'PolynomialRing_general') +lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic') + def repr_short_to_parent(s): r""" @@ -145,9 +152,6 @@ def parent_to_repr_short(P): from sage.rings.real_mpfi import RIF from sage.rings.real_mpfr import RR from sage.symbolic.ring import SR - from sage.rings.polynomial.polynomial_ring import PolynomialRing_general - from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base - from sage.rings.power_series_ring import is_PowerSeriesRing def abbreviate(P): try: @@ -164,10 +168,8 @@ def abbreviate(P): pass raise ValueError('Cannot abbreviate %s.' % (P,)) - poly = isinstance(P, PolynomialRing_general) or isinstance(P, MPolynomialRing_base) - from sage.rings import multi_power_series_ring - power = is_PowerSeriesRing(P) or \ - multi_power_series_ring.is_MPowerSeriesRing(P) + poly = isinstance(P, (PolynomialRing_general, MPolynomialRing_base)) + power = isinstance(P, (PowerSeriesRing_generic, MPowerSeriesRing_generic, LazyPowerSeriesRing)) if poly or power: if poly: diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index ed2e4a9c3cf..2142f717460 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -38,6 +38,7 @@ from sage.categories.integral_domains import IntegralDomains from sage.categories.rings import Rings from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import lazy_import from sage.rings.infinity import infinity from sage.rings.integer_ring import ZZ from sage.rings.laurent_series_ring_element import LaurentSeries @@ -49,6 +50,11 @@ except ImportError: pari_gen = () +lazy_import('sage.rings.polynomial.laurent_polynomial_ring_base', 'LaurentPolynomialRing_generic') +lazy_import('sage.rings.lazy_series_ring', ('LazyPowerSeriesRing', 'LazyLaurentSeriesRing')) +lazy_import('sage.rings.polynomial.polynomial_ring', 'PolynomialRing_general') +lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic') + def is_LaurentSeriesRing(x): """ @@ -62,12 +68,19 @@ def is_LaurentSeriesRing(x): sage: from sage.rings.laurent_series_ring import is_LaurentSeriesRing sage: K. = LaurentSeriesRing(QQ) sage: is_LaurentSeriesRing(K) + doctest:warning... + DeprecationWarning: The function is_LaurentSeriesRing is deprecated; + use 'isinstance(..., (LaurentSeriesRing, LazyLaurentSeriesRing))' instead. + See https://github.com/sagemath/sage/issues/38290 for details. True sage: L. = LazyLaurentSeriesRing(QQ) sage: is_LaurentSeriesRing(L) True """ - from sage.rings.lazy_series_ring import LazyLaurentSeriesRing + from sage.misc.superseded import deprecation + deprecation(38290, + "The function is_LaurentSeriesRing is deprecated; " + "use 'isinstance(..., (LaurentSeriesRing, LazyLaurentSeriesRing))' instead.") return isinstance(x, (LaurentSeriesRing, LazyLaurentSeriesRing)) @@ -207,9 +220,9 @@ def __classcall__(cls, *args, **kwds): sage: L.variable_name() 'q' """ - from .power_series_ring import PowerSeriesRing, is_PowerSeriesRing + from .power_series_ring import PowerSeriesRing - if not kwds and len(args) == 1 and is_PowerSeriesRing(args[0]): + if not kwds and len(args) == 1 and isinstance(args[0], (PowerSeriesRing_generic, LazyPowerSeriesRing)): power_series = args[0] else: power_series = PowerSeriesRing(*args, **kwds) @@ -675,18 +688,12 @@ def _coerce_map_from_(self, P): True """ A = self.base_ring() - from sage.rings.polynomial.laurent_polynomial_ring_base import ( - LaurentPolynomialRing_generic, - ) - from sage.rings.polynomial.polynomial_ring import PolynomialRing_general - from sage.rings.power_series_ring import is_PowerSeriesRing - - if ((is_LaurentSeriesRing(P) or - isinstance(P, LaurentPolynomialRing_generic) or - is_PowerSeriesRing(P) or - isinstance(P, PolynomialRing_general)) - and P.variable_name() == self.variable_name() - and A.has_coerce_map_from(P.base_ring())): + if (isinstance(P, (LaurentSeriesRing, LazyLaurentSeriesRing, + LaurentPolynomialRing_generic, + PowerSeriesRing_generic, LazyPowerSeriesRing, + PolynomialRing_general)) + and P.variable_name() == self.variable_name() + and A.has_coerce_map_from(P.base_ring())): return True def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): @@ -721,7 +728,7 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): if base_map is None and not codomain.has_coerce_map_from(self.base_ring()): return False # Note that 0 is not a *ring* homomorphism, and you cannot map to a power series ring - if is_LaurentSeriesRing(codomain): + if isinstance(codomain, (LaurentSeriesRing, LazyLaurentSeriesRing)): return im_gens[0].valuation() > 0 and im_gens[0].is_unit() return False diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index b59f3c88972..89fa8548f5d 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -205,13 +205,14 @@ import sage.misc.latex as latex +from sage.misc.lazy_import import lazy_import from sage.rings.infinity import infinity from sage.rings.multi_power_series_ring_element import MPowerSeries from sage.rings.polynomial.polynomial_ring import PolynomialRing_general from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.multi_polynomial_ring import MPolynomialRing_base from sage.rings.polynomial.term_order import TermOrder -from sage.rings.power_series_ring import PowerSeriesRing, PowerSeriesRing_generic, is_PowerSeriesRing +from sage.rings.power_series_ring import PowerSeriesRing, PowerSeriesRing_generic from sage.rings.ring import CommutativeRing from sage.structure.nonexact import Nonexact @@ -226,6 +227,8 @@ except ImportError: LaurentSeriesRing = () +lazy_import('sage.rings.lazy_series_ring', ('LazyPowerSeriesRing', 'LazyLaurentSeriesRing')) + def is_MPowerSeriesRing(x): """ @@ -237,8 +240,16 @@ def is_MPowerSeriesRing(x): sage: from sage.rings.multi_power_series_ring import is_MPowerSeriesRing sage: M = PowerSeriesRing(ZZ, 4, 'v') sage: is_PowerSeriesRing(M) + doctest:warning... + DeprecationWarning: The function is_PowerSeriesRing is deprecated; + use 'isinstance(..., (PowerSeriesRing_generic, LazyPowerSeriesRing) and ....ngens() == 1)' instead. + See https://github.com/sagemath/sage/issues/38290 for details. False sage: is_MPowerSeriesRing(M) + doctest:warning... + DeprecationWarning: The function is_MPowerSeriesRing is deprecated; + use 'isinstance(..., (MPowerSeriesRing_generic, LazyPowerSeriesRing))' instead. + See https://github.com/sagemath/sage/issues/38290 for details. True sage: T = PowerSeriesRing(RR, 'v') sage: is_PowerSeriesRing(T) @@ -252,7 +263,10 @@ def is_MPowerSeriesRing(x): sage: is_MPowerSeriesRing(L) True """ - from sage.rings.lazy_series_ring import LazyPowerSeriesRing + from sage.misc.superseded import deprecation + deprecation(38290, + "The function is_MPowerSeriesRing is deprecated; " + "use 'isinstance(..., (MPowerSeriesRing_generic, LazyPowerSeriesRing))' instead.") return isinstance(x, (MPowerSeriesRing_generic, LazyPowerSeriesRing)) @@ -659,8 +673,9 @@ def _coerce_impl(self, f): True """ P = f.parent() - if isinstance(P, MPolynomialRing_base) or is_MPowerSeriesRing(P) \ - or isinstance(P, PolynomialRing_general) or is_PowerSeriesRing(P): + if isinstance(P, (PolynomialRing_general, MPolynomialRing_base, + PowerSeriesRing_generic, MPowerSeriesRing_generic, + LazyPowerSeriesRing)): if set(P.variable_names()).issubset(set(self.variable_names())): if self.has_coerce_map_from(P.base_ring()): return self(f) @@ -738,7 +753,8 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): if all(v == 0 for v in im_gens): return True - if is_MPowerSeriesRing(codomain) or is_PowerSeriesRing(codomain) or isinstance(codomain, LaurentSeriesRing): + if isinstance(codomain, (PowerSeriesRing_generic, MPowerSeriesRing_generic, LazyPowerSeriesRing, + LaurentSeriesRing, LazyLaurentSeriesRing)): try: B = all(v.valuation() > 0 or v.is_nilpotent() for v in im_gens) except NotImplementedError: @@ -823,8 +839,8 @@ def _coerce_map_from_(self, P): sage: R.has_coerce_map_from(L) True """ - if isinstance(P, MPolynomialRing_base) or is_MPowerSeriesRing(P) \ - or isinstance(P, PolynomialRing_general) or is_PowerSeriesRing(P): + if isinstance(P, (MPolynomialRing_base, MPowerSeriesRing_generic, LazyPowerSeriesRing, + PolynomialRing_general, PowerSeriesRing_generic)): if set(P.variable_names()).issubset(set(self.variable_names())): if self.has_coerce_map_from(P.base_ring()): return True diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 6d893db5ebb..b7731d59f74 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -154,14 +154,17 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.structure.richcmp import richcmp - +from sage.misc.lazy_import import lazy_import from sage.rings.finite_rings.integer_mod_ring import Zmod from sage.rings.infinity import infinity, InfinityElement from sage.rings.integer import Integer from sage.rings.polynomial.polynomial_ring import PolynomialRing_general -from sage.rings.power_series_ring import is_PowerSeriesRing from sage.rings.power_series_ring_element import PowerSeries +from sage.structure.richcmp import richcmp + +lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') +lazy_import('sage.rings.multi_power_series_ring', 'MPowerSeriesRing_generic') +lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic') def is_MPowerSeries(f): @@ -375,8 +378,7 @@ def __init__(self, parent, x=0, prec=infinity, is_gen=False, check=False): # test whether x coerces to background univariate # power series ring of parent - from sage.rings.multi_power_series_ring import is_MPowerSeriesRing - if is_PowerSeriesRing(xparent) or is_MPowerSeriesRing(xparent): + if isinstance(xparent, (PowerSeriesRing_generic, MPowerSeriesRing_generic, LazyPowerSeriesRing)): # x is either a multivariate or univariate power series # # test whether x coerces directly to designated parent diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index f349f5eacfd..4f20542237f 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -7945,13 +7945,16 @@ cdef class Polynomial(CommutativePolynomial): 4 + 4*T + O(T^2) """ # Late import to avoid cyclic dependencies: - from sage.rings.power_series_ring import is_PowerSeriesRing + from sage.rings.power_series_ring import PowerSeriesRing_generic + try: + from sage.rings.lazy_series_ring import LazyPowerSeriesRing + except ImportError: + LazyPowerSeriesRing = () if self.is_zero(): return self # return 0 n = self.degree() base_ring = self._parent.base_ring() - if (isinstance(base_ring, MPolynomialRing_base) or - is_PowerSeriesRing(base_ring)): + if isinstance(base_ring, (MPolynomialRing_base, PowerSeriesRing_generic, LazyPowerSeriesRing)): # It is often cheaper to compute discriminant of simple # multivariate polynomial and substitute the real # coefficients into that result (see #16014). diff --git a/src/sage/rings/power_series_ring.py b/src/sage/rings/power_series_ring.py index b9dc542b4dd..3ebcf680801 100644 --- a/src/sage/rings/power_series_ring.py +++ b/src/sage/rings/power_series_ring.py @@ -175,6 +175,8 @@ LaurentSeriesRing = () LaurentSeries = () +lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') + def PowerSeriesRing(base_ring, name=None, arg2=None, names=None, sparse=False, default_prec=None, order='negdeglex', @@ -466,6 +468,10 @@ def is_PowerSeriesRing(R): sage: from sage.rings.power_series_ring import is_PowerSeriesRing sage: is_PowerSeriesRing(10) + doctest:warning... + DeprecationWarning: The function is_PowerSeriesRing is deprecated; + use 'isinstance(..., (PowerSeriesRing_generic, LazyPowerSeriesRing) and ....ngens() == 1)' instead. + See https://github.com/sagemath/sage/issues/38290 for details. False sage: is_PowerSeriesRing(QQ[['x']]) True @@ -474,7 +480,10 @@ def is_PowerSeriesRing(R): sage: is_PowerSeriesRing(LazyPowerSeriesRing(QQ, 'x, y')) False """ - from sage.rings.lazy_series_ring import LazyPowerSeriesRing + from sage.misc.superseded import deprecation + deprecation(38290, + "The function is_PowerSeriesRing is deprecated; " + "use 'isinstance(..., (PowerSeriesRing_generic, LazyPowerSeriesRing) and ....ngens() == 1)' instead.") if isinstance(R, (PowerSeriesRing_generic, LazyPowerSeriesRing)): return R.ngens() == 1 else: @@ -706,8 +715,9 @@ def _coerce_map_from_(self, S): """ if self.base_ring().has_coerce_map_from(S): return True - if (isinstance(S, PolynomialRing_general) or is_PowerSeriesRing(S)) and self.base_ring().has_coerce_map_from(S.base_ring()) \ - and self.variable_names() == S.variable_names(): + if (isinstance(S, (PolynomialRing_general, PowerSeriesRing_generic, LazyPowerSeriesRing)) + and self.base_ring().has_coerce_map_from(S.base_ring()) + and self.variable_names() == S.variable_names()): return True def _element_constructor_(self, f, prec=infinity, check=True): @@ -938,7 +948,7 @@ def _coerce_impl(self, x): """ try: P = x.parent() - if is_PowerSeriesRing(P): + if isinstance(P, (PowerSeriesRing_generic, LazyPowerSeriesRing)): if P.variable_name() == self.variable_name(): if self.has_coerce_map_from(P.base_ring()): return self(x) @@ -977,7 +987,7 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): if base_map is None and not codomain.has_coerce_map_from(self.base_ring()): return False v = im_gens[0] - if is_PowerSeriesRing(codomain) or isinstance(codomain, LaurentSeriesRing): + if isinstance(codomain, (PowerSeriesRing_generic, LazyPowerSeriesRing, LaurentSeriesRing)): try: return v.valuation() > 0 or v.is_nilpotent() except NotImplementedError: diff --git a/src/sage/rings/puiseux_series_ring.py b/src/sage/rings/puiseux_series_ring.py index 60843720884..06b752f92df 100644 --- a/src/sage/rings/puiseux_series_ring.py +++ b/src/sage/rings/puiseux_series_ring.py @@ -27,16 +27,19 @@ from sage.categories.fields import Fields from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import lazy_import from sage.rings.infinity import infinity from sage.rings.laurent_series_ring import LaurentSeriesRing from sage.rings.laurent_series_ring_element import LaurentSeries -from sage.rings.power_series_ring import is_PowerSeriesRing from sage.rings.power_series_ring_element import PowerSeries from sage.rings.puiseux_series_ring_element import PuiseuxSeries from sage.structure.element import parent from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation +lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') +lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic') + class PuiseuxSeriesRing(UniqueRepresentation, Parent): """ @@ -379,10 +382,10 @@ def _coerce_map_from_(self, P): # Laurent series rings, power series rings, and polynomial rings with # the same variable name and the base rings are coercible - if ((isinstance(P, PuiseuxSeriesRing) or isinstance(P, LaurentSeriesRing) or - is_PowerSeriesRing(P)) and - P.variable_name() == self.variable_name() and - A.has_coerce_map_from(P.base_ring())): + if (isinstance(P, (PuiseuxSeriesRing, LaurentSeriesRing, + PowerSeriesRing_generic, LazyPowerSeriesRing)) + and P.variable_name() == self.variable_name() + and A.has_coerce_map_from(P.base_ring())): return True # # other Puiseux series rings with the same variable name and diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 7e9b3bcb7a6..8e6e3df0d3c 100755 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -45,32 +45,29 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.misc import integer_ceil as ceil from sage.arith.misc import binomial +from sage.arith.misc import integer_ceil as ceil from sage.categories.algebras import Algebras +from sage.categories.integral_domains import IntegralDomains from sage.matrix.constructor import matrix from sage.misc.cachefunc import cached_method from sage.misc.lazy_import import lazy_import from sage.misc.misc import newton_method_sizes from sage.misc.profiler import Profiler from sage.misc.repr import repr_lincomb -from sage.modules.free_module_element import vector from sage.modules.free_module import FreeModule -from sage.modules.free_module_element import FreeModuleElement +from sage.modules.free_module_element import FreeModuleElement, vector from sage.modules.module import Module from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers +from sage.rings.infinity import Infinity from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ +from sage.rings.laurent_series_ring import LaurentSeriesRing +from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.power_series_ring import PowerSeriesRing -from sage.rings.rational_field import RationalField as Rationals from sage.rings.rational import Rational -from sage.rings.laurent_series_ring import LaurentSeriesRing -from sage.rings.rational_field import QQ -from sage.rings.integer_ring import ZZ -from sage.categories.integral_domains import IntegralDomains -from sage.rings.infinity import Infinity -from sage.rings.laurent_series_ring import is_LaurentSeriesRing -from sage.rings.polynomial.polynomial_element import Polynomial +from sage.rings.rational_field import QQ, RationalField as Rationals from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.schemes.elliptic_curves.ell_generic import EllipticCurve_generic from sage.schemes.hyperelliptic_curves.constructor import HyperellipticCurve @@ -81,6 +78,7 @@ from sage.structure.unique_representation import UniqueRepresentation lazy_import('sage.functions.log', 'log') +lazy_import('sage.rings.lazy_series_ring', 'LazyLaurentSeriesRing') lazy_import('sage.rings.padics.factory', 'Qp', as_='pAdicField') @@ -2450,7 +2448,7 @@ def _repr_(self) -> str: sage: x.parent() # indirect doctest SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) over Rational Field """ - y_inverse = ",y^-1" if is_LaurentSeriesRing(self._series_ring) else "" + y_inverse = ",y^-1" if isinstance(self._series_ring, (LaurentSeriesRing, LazyLaurentSeriesRing)) else "" return "SpecialHyperellipticQuotientRing K[x,y%s] / (y^2 = %s) over %s" % (y_inverse, self._Q, self.base_ring()) def base_extend(self, R): @@ -2488,7 +2486,7 @@ def change_ring(self, R): over Integer Ring """ return SpecialHyperellipticQuotientRing(self._Q.change_ring(R), R, - is_LaurentSeriesRing(self._series_ring)) + isinstance(self._series_ring, (LaurentSeriesRing, LazyLaurentSeriesRing))) def _element_constructor_(self, val, offset=0, check=True): r"""