diff --git a/src/sage/rings/all.py b/src/sage/rings/all.py index 17dd9896212..1d7b89601f5 100644 --- a/src/sage/rings/all.py +++ b/src/sage/rings/all.py @@ -1,29 +1,5 @@ """ Rings - -Tests for deprecations of imports in global namespace from :trac:`33602`:: - - sage: PowerSeries - doctest:warning...: - DeprecationWarning: - Importing PowerSeries from here is deprecated; - please use "from sage.rings.power_series_ring_element import PowerSeries" instead. - See https://github.com/sagemath/sage/issues/33602 for details. - ... - sage: PuiseuxSeries - doctest:warning...: - DeprecationWarning: - Importing PuiseuxSeries from here is deprecated; - please use "from sage.rings.puiseux_series_ring_element import PuiseuxSeries" instead. - See https://github.com/sagemath/sage/issues/33602 for details. - ... - sage: LaurentSeries - doctest:warning...: - DeprecationWarning: - Importing LaurentSeries from here is deprecated; - please use "from sage.rings.laurent_series_ring_element import LaurentSeries" instead. - See https://github.com/sagemath/sage/issues/33602 for details. - ... """ # **************************************************************************** # Copyright (C) 2005 William Stein @@ -139,11 +115,9 @@ # Power series rings from .power_series_ring import PowerSeriesRing -lazy_import('sage.rings.power_series_ring_element', 'PowerSeries', deprecation=33602) # Laurent series ring in one variable from .laurent_series_ring import LaurentSeriesRing -lazy_import('sage.rings.laurent_series_ring_element', 'LaurentSeries', deprecation=33602) # Lazy Laurent series ring lazy_import('sage.rings.lazy_series_ring', ['LazyLaurentSeriesRing', 'LazyPowerSeriesRing', @@ -154,7 +128,6 @@ # Puiseux series ring from .puiseux_series_ring import PuiseuxSeriesRing -lazy_import('sage.rings.puiseux_series_ring_element', 'PuiseuxSeries', deprecation=33602) # Pseudo-ring of PARI objects. from .pari_ring import PariRing, Pari diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 198e5edb591..a22ce3c5e53 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -191,10 +191,10 @@ from sage.structure.unique_representation import UniqueRepresentation from sage.arith.long cimport is_small_python_int from sage.misc.lazy_string import lazy_string -from sage.misc.superseded import deprecated_function_alias from sage.rings.complex_interval_field import ComplexIntervalField, ComplexIntervalField_class from sage.rings.integer_ring import ZZ + cdef void ComplexIntervalFieldElement_to_acb( acb_t target, ComplexIntervalFieldElement source): @@ -4229,8 +4229,6 @@ cdef class ComplexBall(RingElement): if _do_sig(prec(self)): sig_off() return result - ei = deprecated_function_alias(32869, Ei) - def Si(self): """ Return the sine integral with argument ``self``. @@ -4255,8 +4253,6 @@ cdef class ComplexBall(RingElement): sin_integral = Si # as for the symbolic function - si = deprecated_function_alias(32869, Si) - def Ci(self): """ Return the cosine integral with argument ``self``. @@ -4281,8 +4277,6 @@ cdef class ComplexBall(RingElement): cos_integral = Ci # as for the symbolic function - ci = deprecated_function_alias(32869, Ci) - def Shi(self): """ Return the hyperbolic sine integral with argument ``self``. @@ -4307,8 +4301,6 @@ cdef class ComplexBall(RingElement): sinh_integral = Shi - shi = deprecated_function_alias(32869, Shi) - def Chi(self): """ Return the hyperbolic cosine integral with argument ``self``. @@ -4333,8 +4325,6 @@ cdef class ComplexBall(RingElement): cosh_integral = Chi - chi = deprecated_function_alias(32869, Chi) - def li(self, bint offset=False): """ Return the logarithmic integral with argument ``self``. diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index f2080959a54..8b9883d1279 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -116,30 +116,6 @@ cimport gmpy2 gmpy2.import_gmpy2() -def is_ComplexDoubleField(x): - """ - Return ``True`` if ``x`` is the complex double field. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.ComplexDoubleField` instead. - - EXAMPLES:: - - sage: from sage.rings.complex_double import is_ComplexDoubleField - sage: is_ComplexDoubleField(CDF) - doctest:warning... - DeprecationWarning: is_ComplexDoubleField is deprecated; - use isinstance(..., sage.rings.abc.ComplexDoubleField) instead - See https://github.com/sagemath/sage/issues/32610 for details. - True - sage: is_ComplexDoubleField(ComplexField(53)) - False - """ - from sage.misc.superseded import deprecation - deprecation(32610, 'is_ComplexDoubleField is deprecated; use isinstance(..., sage.rings.abc.ComplexDoubleField) instead') - return isinstance(x, ComplexDoubleField_class) - - cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): """ An approximation to the field of complex numbers using double diff --git a/src/sage/rings/complex_field.py b/src/sage/rings/complex_field.py deleted file mode 100644 index c410c069409..00000000000 --- a/src/sage/rings/complex_field.py +++ /dev/null @@ -1,17 +0,0 @@ -r""" -Deprecated in favor of :mod:`sage.rings.complex_mpfr` - -TESTS:: - - sage: from sage.rings.complex_field import ComplexField - doctest:warning - ... - DeprecationWarning: the complex_field module is deprecated, please use sage.rings.complex_mpfr - See https://github.com/sagemath/sage/issues/24483 for details. - sage: ComplexField() - Complex Field with 53 bits of precision -""" - -from sage.misc.superseded import deprecation -from sage.rings.complex_mpfr import * -deprecation(24483, "the complex_field module is deprecated, please use sage.rings.complex_mpfr") diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index 9fedd3f4476..5c5e6bbb906 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -49,27 +49,6 @@ from sage.misc.cachefunc import cached_method -def is_ComplexIntervalField(x): - """ - Check if ``x`` is a :class:`ComplexIntervalField`. - - EXAMPLES:: - - sage: from sage.rings.complex_interval_field import is_ComplexIntervalField as is_CIF - sage: is_CIF(CIF) - doctest:warning... - DeprecationWarning: is_ComplexIntervalField is deprecated; - use isinstance(..., sage.rings.abc.ComplexIntervalField) instead - See https://github.com/sagemath/sage/issues/32612 for details. - True - sage: is_CIF(CC) - False - """ - from sage.misc.superseded import deprecation - deprecation(32612, 'is_ComplexIntervalField is deprecated; use isinstance(..., sage.rings.abc.ComplexIntervalField) instead') - return isinstance(x, ComplexIntervalField_class) - - cache = {} def ComplexIntervalField(prec=53, names=None): """ diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index cbbe65d2014..ae2bd50c735 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -84,8 +84,6 @@ 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 -from sage.misc.superseded import deprecated_function_alias - cimport gmpy2 gmpy2.import_gmpy2() @@ -1949,8 +1947,6 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): """ return ~(self.tan()) - cotan = deprecated_function_alias(29412, cot) - ################################ # Other functions ################################ diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 416b8a9a847..1862cea7bbf 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -56,8 +56,6 @@ from sage.libs.gsl.complex cimport * from sage.libs.mpmath.utils cimport mpfr_to_mpfval from sage.rings.integer_ring import ZZ -from sage.misc.superseded import deprecated_function_alias - cimport gmpy2 gmpy2.import_gmpy2() @@ -157,32 +155,6 @@ def is_ComplexNumber(x): return isinstance(x, ComplexNumber) -def is_ComplexField(x): - """ - Check if ``x`` is a :class:`complex field `. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.ComplexField` instead. - - EXAMPLES:: - - sage: from sage.rings.complex_mpfr import is_ComplexField as is_CF - sage: is_CF(ComplexField()) - doctest:warning... - DeprecationWarning: is_ComplexField is deprecated; - use isinstance(..., sage.rings.abc.ComplexField) instead - See https://github.com/sagemath/sage/issues/32610 for details. - True - sage: is_CF(ComplexField(12)) - True - sage: is_CF(CC) - True - """ - from sage.misc.superseded import deprecation - deprecation(32610, 'is_ComplexField is deprecated; use isinstance(..., sage.rings.abc.ComplexField) instead') - return isinstance(x, ComplexField_class) - - cache = {} def ComplexField(prec=53, names=None): """ @@ -2267,8 +2239,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): """ return ~(self.tan()) - cotan = deprecated_function_alias(29412, cot) - def cos(self): """ Return the cosine of ``self``. diff --git a/src/sage/rings/complex_number.pyx b/src/sage/rings/complex_number.pyx deleted file mode 100644 index f2c91d5aaee..00000000000 --- a/src/sage/rings/complex_number.pyx +++ /dev/null @@ -1,14 +0,0 @@ -r""" -Deprecated in favor of :mod:`sage.rings.complex_mpfr` - -TESTS:: - - sage: from sage.rings.complex_number import ComplexNumber - doctest:warning - ... - DeprecationWarning: the complex_number module is deprecated, please use sage.rings.complex_mpfr - See https://github.com/sagemath/sage/issues/24483 for details. -""" -from sage.misc.superseded import deprecation -from sage.rings.complex_mpfr import * -deprecation(24483, "the complex_number module is deprecated, please use sage.rings.complex_mpfr") diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 7e2eed91153..319abba1b35 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1173,7 +1173,7 @@ cdef class FiniteField(Field): else: return PolynomialRing(GF(self.characteristic()), variable_name) - def free_module(self, base=None, basis=None, map=None, subfield=None): + def free_module(self, base=None, basis=None, map=True): """ Return the vector space over the subfield isomorphic to this finite field as a vector space, along with the isomorphisms. @@ -1253,15 +1253,6 @@ cdef class FiniteField(Field): sage: all(to_V(h(c) * e) == c * to_V(e) for e in E for c in F) True """ - if subfield is not None: - if base is not None: - raise ValueError - deprecation(28481, "The subfield keyword argument has been renamed to base") - base = subfield - if map is None: - deprecation(28481, "The default value for map will be changing to True. To keep the current behavior, explicitly pass map=False.") - map = False - if base is None and self.__vector_space is not None and not map: # A very common case: return as early as possible. return self.__vector_space diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 38dd4569c7f..046b737a833 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -629,7 +629,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): else: return sib(self.parent())(v) - def log(self, b=None, logarithm_exists=None): + def log(self, b=None): r""" Compute the discrete logarithm of this element to base `b`, that is, @@ -759,11 +759,6 @@ cdef class IntegerMod_abstract(FiniteRingElement): - Lorenz Panny (2021): speedups for composite moduli """ - - if logarithm_exists is not None: - from sage.misc.superseded import deprecation - deprecation(32375, 'The "logarithm_exists" argument to .log() is no longer necessary and will be removed at some point.') - if not self.is_unit(): raise ValueError(f"logarithm of {self} is not defined since it is not a unit modulo {self.modulus()}") diff --git a/src/sage/rings/finite_rings/integer_mod_ring.py b/src/sage/rings/finite_rings/integer_mod_ring.py index b615d3a8c1a..92b99d050ba 100644 --- a/src/sage/rings/finite_rings/integer_mod_ring.py +++ b/src/sage/rings/finite_rings/integer_mod_ring.py @@ -246,38 +246,6 @@ def create_object(self, version, order, **kwds): Zmod = Integers = IntegerModRing = IntegerModFactory("IntegerModRing") -def is_IntegerModRing(x): - """ - Return ``True`` if ``x`` is an integer modulo ring. - - This function is deprecated. Use :func:`isinstance` with - :class:`sage.rings.abc.IntegerModRing` instead. - - EXAMPLES:: - - sage: from sage.rings.finite_rings.integer_mod_ring import is_IntegerModRing - sage: R = IntegerModRing(17) - sage: is_IntegerModRing(R) - doctest:warning... - DeprecationWarning: the function is_IntegerModRing is deprecated. - Use isinstance(..., sage.rings.abc.IntegerModRing) instead. - See https://github.com/sagemath/sage/issues/32606 for details. - True - sage: is_IntegerModRing(GF(13)) - True - sage: is_IntegerModRing(GF(4, 'a')) # needs sage.rings.finite_rings - False - sage: is_IntegerModRing(10) - False - sage: is_IntegerModRing(ZZ) - False - """ - from sage.misc.superseded import deprecation - deprecation(32606, "the function is_IntegerModRing is deprecated. " - "Use isinstance(..., sage.rings.abc.IntegerModRing) instead.") - return isinstance(x, IntegerModRing_generic) - - from sage.categories.commutative_rings import CommutativeRings from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.categories.category import JoinCategory diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 797445e78eb..184efab78a5 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -413,29 +413,6 @@ from sage.structure.richcmp cimport (richcmp, rich_to_bool) from sage.misc.cachefunc import cached_method -def is_RingHomomorphism(phi): - """ - Return ``True`` if ``phi`` is of type :class:`RingHomomorphism`. - - EXAMPLES:: - - sage: f = Zmod(8).cover() - sage: sage.rings.morphism.is_RingHomomorphism(f) - doctest:warning - ... - DeprecationWarning: is_RingHomomorphism() should not be used anymore. Check whether the category_for() your morphism is a subcategory of Rings() instead. - See https://github.com/sagemath/sage/issues/23204 for details. - True - sage: sage.rings.morphism.is_RingHomomorphism(2/3) - False - """ - sage.misc.superseded.deprecation(23204, "is_RingHomomorphism() should not be used anymore. Check whether the category_for() your morphism is a subcategory of Rings() instead.") - # We use the category framework to determine whether something is a ring homomorphism. - from sage.categories.map import Map - from sage.categories.rings import Rings - return isinstance(phi, Map) and phi.category_for().is_subcategory(Rings()) - - cdef class RingMap(Morphism): """ Set-theoretic map between rings. @@ -1682,120 +1659,6 @@ cdef class RingHomomorphism(RingMap): return self.is_injective() and self.is_surjective() -cdef class RingHomomorphism_coercion(RingHomomorphism): - r""" - A ring homomorphism that is a coercion. - - .. WARNING:: - - This class is obsolete. Set the category of your morphism to a - subcategory of ``Rings`` instead. - - TESTS: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - doctest:warning - ... - DeprecationWarning: Set the category of your morphism to a subcategory of Rings instead. - See https://github.com/sagemath/sage/issues/23204 for details. - sage: TestSuite(f).run() - - """ - def __init__(self, parent, check=True): - r""" - TESTS: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - doctest:warning - ... - DeprecationWarning: Set the category of your morphism to a subcategory of Rings instead. - See https://github.com/sagemath/sage/issues/23204 for details. - sage: isinstance(f, RingHomomorphism_coercion) - True - - """ - sage.misc.superseded.deprecation(23204, "Set the category of your morphism to a subcategory of Rings instead.") - - RingHomomorphism.__init__(self, parent) - # putting in check allows us to define subclasses of RingHomomorphism_coercion that implement _coerce_map_from - if check and not self.codomain().has_coerce_map_from(self.domain()): - raise TypeError("Natural coercion morphism from %s to %s not defined."%(self.domain(), self.codomain())) - - def _repr_type(self): - """ - Used internally when printing this. - - EXAMPLES:: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - sage: f._repr_type() - 'Ring Coercion' - - """ - return "Ring Coercion" - - cpdef _richcmp_(self, other, int op): - """ - Compare a ring coercion morphism ``self`` to ``other``. - - Ring coercion morphisms never compare equal to any other data type. If - other is a ring coercion morphism, the parents of ``self`` and - ``other`` are compared. - - EXAMPLES:: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - sage: f == f - True - sage: f != f - False - """ - if not isinstance(other, RingHomomorphism_coercion): - # Generic comparison - return RingMap._richcmp_(self, other, op) - # Two coercion maps with the same parent must be equal - return rich_to_bool(op, 0) - - def __hash__(self): - """ - Return the hash of this morphism. - - TESTS:: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - sage: g = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - sage: hash(f) == hash(g) - True - - """ - return hash((self.domain(), self.codomain())) - - cpdef Element _call_(self, x): - """ - Evaluate this coercion morphism at ``x``. - - EXAMPLES:: - - sage: from sage.rings.morphism import RingHomomorphism_coercion - sage: parent = Hom(ZZ,ZZ) - sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent) - sage: f(0) - 0 - - """ - return self.codomain().coerce(x) - - cdef class RingHomomorphism_im_gens(RingHomomorphism): """ A ring homomorphism determined by the images of generators. diff --git a/src/sage/rings/number_field/homset.py b/src/sage/rings/number_field/homset.py index cb61df73344..ca5329668c5 100644 --- a/src/sage/rings/number_field/homset.py +++ b/src/sage/rings/number_field/homset.py @@ -14,8 +14,6 @@ # **************************************************************************** from sage.misc.cachefunc import cached_method -from sage.misc.superseded import deprecation - from sage.rings.homset import RingHomset_generic from sage.rings.number_field.morphism import (NumberFieldHomomorphism_im_gens, RelativeNumberFieldHomomorphism_from_abs, @@ -283,7 +281,7 @@ class RelativeNumberFieldHomset(NumberFieldHomset): Element = RelativeNumberFieldHomomorphism_from_abs - def _element_constructor_(self, x, base_map=None, base_hom=None, check=True): + def _element_constructor_(self, x, base_map=None, check=True): """ Construct an element of ``self`` from ``x``. @@ -377,9 +375,6 @@ def _element_constructor_(self, x, base_map=None, base_hom=None, check=True): sage: (x^2 + a).change_ring(phi) x^2 + 1/6*c^3 + 1/6*c """ - if base_hom is not None: - deprecation(26105, "Use base_map rather than base_hom") - base_map = base_hom if isinstance(x, NumberFieldHomomorphism_im_gens): # Then it must be a homomorphism from the corresponding # absolute number field diff --git a/src/sage/rings/number_field/morphism.py b/src/sage/rings/number_field/morphism.py index a979035a82a..14ad5772d3b 100644 --- a/src/sage/rings/number_field/morphism.py +++ b/src/sage/rings/number_field/morphism.py @@ -268,8 +268,3 @@ def _call_(self, x): class CyclotomicFieldHomomorphism_im_gens(NumberFieldHomomorphism_im_gens): pass - - -lazy_import('sage.rings.number_field.homset', - ('NumberFieldHomset', 'RelativeNumberFieldHomset', 'CyclotomicFieldHomset'), - deprecation=29010) diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index bc35e0ec0ed..7fe89197011 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -1056,39 +1056,6 @@ def is_AbsoluteNumberField(x): return isinstance(x, NumberField_absolute) -def is_QuadraticField(x) -> bool: - r""" - Return ``True`` if ``x`` is of the quadratic *number* field type. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.NumberField_quadratic` instead. - - EXAMPLES:: - - sage: from sage.rings.number_field.number_field import is_QuadraticField - sage: is_QuadraticField(QuadraticField(5,'a')) - doctest:warning... - DeprecationWarning: is_QuadraticField is deprecated; - use isinstance(..., sage.rings.abc.NumberField_quadratic instead - See https://github.com/sagemath/sage/issues/32660 for details. - True - sage: x = polygen(ZZ, 'x') - sage: is_QuadraticField(NumberField(x^2 - 5, 'b')) - True - sage: is_QuadraticField(NumberField(x^3 - 5, 'b')) - False - - A quadratic field specially refers to a number field, not a finite - field:: - - sage: is_QuadraticField(GF(9,'a')) - False - """ - from sage.misc.superseded import deprecation - deprecation(32660, 'is_QuadraticField is deprecated; use isinstance(..., sage.rings.abc.NumberField_quadratic instead') - return isinstance(x, NumberField_quadratic) - - class CyclotomicFieldFactory(UniqueFactory): r""" Return the `n`-th cyclotomic field, where n is a positive integer, @@ -1251,40 +1218,6 @@ def create_object(self, version, key, **extra_args): CyclotomicField = CyclotomicFieldFactory("sage.rings.number_field.number_field.CyclotomicField") -def is_CyclotomicField(x) -> bool: - """ - Return ``True`` if x is a cyclotomic field, i.e., of the special - cyclotomic field class. This function does not return ``True`` for a - number field that just happens to be isomorphic to a cyclotomic - field. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.NumberField_cyclotomic` instead. - - EXAMPLES:: - - sage: from sage.rings.number_field.number_field import is_CyclotomicField - sage: x = polygen(ZZ, 'x') - sage: is_CyclotomicField(NumberField(x^2 + 1,'zeta4')) - doctest:warning... - DeprecationWarning: is_CyclotomicField is deprecated; - use isinstance(..., sage.rings.abc.NumberField_cyclotomic instead - See https://github.com/sagemath/sage/issues/32660 for details. - False - sage: is_CyclotomicField(CyclotomicField(4)) - True - sage: is_CyclotomicField(CyclotomicField(1)) - True - sage: is_CyclotomicField(QQ) - False - sage: is_CyclotomicField(7) - False - """ - from sage.misc.superseded import deprecation - deprecation(32660, 'is_CyclotomicField is deprecated; use isinstance(..., sage.rings.abc.NumberField_cyclotomic instead') - return isinstance(x, NumberField_cyclotomic) - - from . import number_field_base @@ -3516,29 +3449,6 @@ def dirichlet_group(self): H.append(chi) return H - def latex_variable_name(self, name=None): - """ - Return the latex representation of the variable name for this - number field. - - EXAMPLES:: - - sage: x = polygen(QQ, 'x') - sage: NumberField(x^2 + 3, 'a').latex_variable_name() - doctest:...: DeprecationWarning: This method is replaced by ... - See https://github.com/sagemath/sage/issues/30372 for details. - 'a' - sage: NumberField(x^3 + 3, 'theta3').latex_variable_name() - '\\theta_{3}' - sage: CyclotomicField(5).latex_variable_name() - '\\zeta_{5}' - """ - deprecation(30372, 'This method is replaced by the method latex_variable_names') - if name is None: - return self._latex_names[0] - else: - self._latex_names = (name,) - def _repr_(self): """ Return string representation of this number field. @@ -5175,9 +5085,6 @@ def selmer_generators(self, S, m, proof=True, orders=False): else: return gens - # For backwards compatibility: - selmer_group = deprecated_function_alias(31345, selmer_generators) - def selmer_group_iterator(self, S, m, proof=True): r""" Return an iterator through elements of the finite group `K(S,m)`. diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index fb37690f280..749b10437f3 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -123,44 +123,6 @@ def is_NumberFieldElement(x): return isinstance(x, NumberFieldElement) -def __create__NumberFieldElement_version0(parent, poly): - """ - Used in unpickling elements of number fields pickled under very old Sage versions. - - TESTS:: - - sage: x = polygen(ZZ, 'x') - sage: k. = NumberField(x^3 - 2) - sage: R. = QQ[] - sage: sage.rings.number_field.number_field_element.__create__NumberFieldElement_version0(k, z^2 + z + 1) - doctest:...: DeprecationWarning: __create__NumberFieldElement_version0() is deprecated - See https://github.com/sagemath/sage/issues/25848 for details. - a^2 + a + 1 - """ - from sage.misc.superseded import deprecation_cython as deprecation - deprecation(25848, '__create__NumberFieldElement_version0() is deprecated') - return NumberFieldElement(parent, poly) - - -def __create__NumberFieldElement_version1(parent, cls, poly): - """ - Used in unpickling elements of number fields pickled under old Sage versions. - - TESTS:: - - sage: x = polygen(ZZ, 'x') - sage: k. = NumberField(x^3 - 2) - sage: R. = QQ[] - sage: sage.rings.number_field.number_field_element.__create__NumberFieldElement_version1(k, type(a), z^2 + z + 1) - doctest:...: DeprecationWarning: __create__NumberFieldElement_version1() is deprecated - See https://github.com/sagemath/sage/issues/25848 for details. - a^2 + a + 1 - """ - from sage.misc.superseded import deprecation_cython as deprecation - deprecation(25848, '__create__NumberFieldElement_version1() is deprecated') - return cls(parent, poly) - - def _inverse_mod_generic(elt, I): r""" Return an inverse of ``elt`` modulo the given ideal. This is a separate diff --git a/src/sage/rings/numbers_abc.py b/src/sage/rings/numbers_abc.py index a28021dd7db..18f794d66c5 100644 --- a/src/sage/rings/numbers_abc.py +++ b/src/sage/rings/numbers_abc.py @@ -2,6 +2,49 @@ Support Python's numbers abstract base class .. SEEALSO:: :pep:`3141` for more information about :class:`numbers`. + +TESTS:: + + sage: import numbers + sage: isinstance(5, numbers.Integral) + True + sage: isinstance(5, numbers.Number) + True + sage: isinstance(5/1, numbers.Integral) + False + sage: isinstance(22/7, numbers.Rational) + True + sage: isinstance(1.3, numbers.Real) + True + sage: isinstance(CC(1.3), numbers.Real) + False + sage: isinstance(CC(1.3 + I), numbers.Complex) + True + sage: isinstance(RDF(1.3), numbers.Real) + True + sage: isinstance(CDF(1.3, 4), numbers.Complex) + True + sage: isinstance(AA(sqrt(2)), numbers.Real) # needs sage.rings.number_field sage.symbolic + True + sage: isinstance(QQbar(I), numbers.Complex) # needs sage.rings.number_field + True + +This doesn't work with symbolic expressions at all:: + + sage: isinstance(pi, numbers.Real) # needs sage.symbolic + False + sage: isinstance(I, numbers.Complex) # needs sage.rings.number_field + False + sage: isinstance(sqrt(2), numbers.Real) # needs sage.rings.number_field sage.symbolic + False + +Because we do this, NumPy's ``isscalar()`` recognizes Sage types:: + + sage: from numpy import isscalar # needs numpy + sage: isscalar(3.141) # needs numpy + True + sage: isscalar(4/17) # needs numpy + True """ #***************************************************************************** @@ -13,55 +56,3 @@ # (at your option) any later version. # http://www.gnu.org/licenses/ #***************************************************************************** - - -def register_sage_classes(): - """ - Register all relevant Sage classes in the :class:`numbers` - hierarchy. - - EXAMPLES:: - - sage: import numbers - sage: isinstance(5, numbers.Integral) - True - sage: isinstance(5, numbers.Number) - True - sage: isinstance(5/1, numbers.Integral) - False - sage: isinstance(22/7, numbers.Rational) - True - sage: isinstance(1.3, numbers.Real) - True - sage: isinstance(CC(1.3), numbers.Real) - False - sage: isinstance(CC(1.3 + I), numbers.Complex) - True - sage: isinstance(RDF(1.3), numbers.Real) - True - sage: isinstance(CDF(1.3, 4), numbers.Complex) - True - sage: isinstance(AA(sqrt(2)), numbers.Real) # needs sage.rings.number_field sage.symbolic - True - sage: isinstance(QQbar(I), numbers.Complex) # needs sage.rings.number_field - True - - This doesn't work with symbolic expressions at all:: - - sage: isinstance(pi, numbers.Real) # needs sage.symbolic - False - sage: isinstance(I, numbers.Complex) # needs sage.rings.number_field - False - sage: isinstance(sqrt(2), numbers.Real) # needs sage.rings.number_field sage.symbolic - False - - Because we do this, NumPy's ``isscalar()`` recognizes Sage types:: - - sage: from numpy import isscalar # needs numpy - sage: isscalar(3.141) # needs numpy - True - sage: isscalar(4/17) # needs numpy - True - """ - from sage.misc.superseded import deprecation - deprecation(32641, "register_sage_classes is a deprecated no-op") diff --git a/src/sage/rings/padics/all.py b/src/sage/rings/padics/all.py index b90b7da1d8a..7014f5622d8 100644 --- a/src/sage/rings/padics/all.py +++ b/src/sage/rings/padics/all.py @@ -1,4 +1,3 @@ -from .generic_nodes import is_pAdicField, is_pAdicRing from .factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM, ZpFP, ZpLC, ZpLF, ZqCR, ZqCA, ZqFM, ZqFP, ZpER from .factory import Qp, Qq, Qp as pAdicField, QpCR, QpFP, QpLC, QpLF, QqCR, QqFP, QpER from .factory import pAdicExtension diff --git a/src/sage/rings/padics/generic_nodes.py b/src/sage/rings/padics/generic_nodes.py index 0832f317b4d..7047020edec 100644 --- a/src/sage/rings/padics/generic_nodes.py +++ b/src/sage/rings/padics/generic_nodes.py @@ -1180,26 +1180,6 @@ def teichmuller_system(self): return [ self.teichmuller(ZZ(i)) for i in R if i != 0 ] -def is_pAdicRing(R): - """ - Return ``True`` if and only if ``R`` is a `p`-adic ring (not a - field). - - EXAMPLES:: - - sage: is_pAdicRing(Zp(5)) - doctest:warning... - DeprecationWarning: is_pAdicRing is deprecated; use isinstance(..., sage.rings.abc.pAdicRing) instead - See https://github.com/sagemath/sage/issues/32750 for details. - True - sage: is_pAdicRing(RR) - False - """ - from sage.misc.superseded import deprecation - deprecation(32750, "is_pAdicRing is deprecated; use isinstance(..., sage.rings.abc.pAdicRing) instead") - return isinstance(R, pAdicRingGeneric) - - class pAdicRingGeneric(pAdicGeneric, sage.rings.abc.pAdicRing): def is_field(self, proof=True): """ @@ -1326,25 +1306,6 @@ def _gcd_univariate_polynomial(self, f, g): return self._xgcd_univariate_polynomial(f, g)[0] -def is_pAdicField(R): - """ - Return ``True`` if and only if ``R`` is a `p`-adic field. - - EXAMPLES:: - - sage: is_pAdicField(Zp(17)) - doctest:warning... - DeprecationWarning: is_pAdicField is deprecated; use isinstance(..., sage.rings.abc.pAdicField) instead - See https://github.com/sagemath/sage/issues/32750 for details. - False - sage: is_pAdicField(Qp(17)) - True - """ - from sage.misc.superseded import deprecation - deprecation(32750, "is_pAdicField is deprecated; use isinstance(..., sage.rings.abc.pAdicField) instead") - return isinstance(R, pAdicFieldGeneric) - - class pAdicFieldGeneric(pAdicGeneric, sage.rings.abc.pAdicField): pass diff --git a/src/sage/rings/polynomial/pbori/__init__.py b/src/sage/rings/polynomial/pbori/__init__.py index 8fe962e2275..325ed646516 100644 --- a/src/sage/rings/polynomial/pbori/__init__.py +++ b/src/sage/rings/polynomial/pbori/__init__.py @@ -41,75 +41,3 @@ from .blocks import HigherOrderBlock, AlternatingBlock, Block from .gbrefs import load_file from .specialsets import all_monomials_of_degree_d, power_set - -# Advertised reimports -# ... any from below? ... - -# Deprecated reimports - -lazy_import('sage.rings.polynomial.pbori.pbori', - ['BooleConstant', - 'BooleSet', - 'BooleSetIterator', - 'BooleanMonomial', - 'BooleanMonomialIterator', - 'BooleanMonomialMonoid', - 'BooleanMonomialVariableIterator', - 'BooleanMulAction', - 'BooleanPolynomial', - 'BooleanPolynomialEntry', - 'BooleanPolynomialIdeal', - 'BooleanPolynomialIterator', - 'BooleanPolynomialRing', - 'BooleanPolynomialVector', - 'BooleanPolynomialVectorIterator', - 'CCuddNavigator', - 'FGLMStrategy', - 'GroebnerStrategy', - 'MonomialConstruct', - 'MonomialFactory', - 'PolynomialConstruct', - 'PolynomialFactory', - 'ReductionStrategy', - 'TermOrder_from_pb_order', - 'VariableBlock', - 'VariableConstruct', - 'add_up_polynomials', - 'block_dlex', - 'block_dp_asc', - 'contained_vars', - 'dlex', - 'dp', - 'dp_asc', - 'easy_linear_factors', - 'gauss_on_polys', - 'get_var_mapping', - 'if_then_else', - 'interpolate', - 'interpolate_smallest_lex', - 'inv_order_dict', - 'll_red_nf_noredsb', - 'll_red_nf_noredsb_single_recursive_call', - 'll_red_nf_redsb', - 'lp', - 'map_every_x_to_x_plus_one', - 'mod_mon_set', - 'mod_var_set', - 'mult_fact_sim_C', - 'nf3', - 'order_dict', - 'order_mapping', - 'parallel_reduce', - 'random_set', - 'recursively_insert', - 'red_tail', - 'rings', - 'set_random_seed', - 'singular_default', - 'substitute_variables', - 'top_index', - 'unpickle_BooleanPolynomial', - 'unpickle_BooleanPolynomial0', - 'unpickle_BooleanPolynomialRing', - 'zeros'], - deprecation=30332) diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 2436db7af1d..8bfabb73701 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -442,8 +442,9 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: + sage: from sage.rings.power_series_ring_element import PowerSeries sage: R. = PowerSeriesRing(ZZ) - sage: PowerSeries.list(1+x^2) + sage: PowerSeries.list(1 + x^2) Traceback (most recent call last): ... NotImplementedError @@ -462,8 +463,9 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: + sage: from sage.rings.power_series_ring_element import PowerSeries sage: R. = PowerSeriesRing(ZZ) - sage: PowerSeries.polynomial(1+x^2) + sage: PowerSeries.polynomial(1 + x^2) Traceback (most recent call last): ... NotImplementedError diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index ed3b1071b04..9602d569984 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -2113,28 +2113,6 @@ def is_AlgebraicField(F): QQbar = AlgebraicField() -def is_AlgebraicField_common(F): - r""" - Check whether ``F`` is an :class:`~AlgebraicField_common` instance. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.AlgebraicField_common` instead. - - EXAMPLES:: - - sage: from sage.rings.qqbar import is_AlgebraicField_common - sage: [is_AlgebraicField_common(x) for x in [AA, QQbar, None, 0, "spam"]] - doctest:warning... - DeprecationWarning: is_AlgebraicField_common is deprecated; - use isinstance(..., sage.rings.abc.AlgebraicField_common) instead - See https://github.com/sagemath/sage/issues/32610 for details. - [True, True, False, False, False] - """ - from sage.misc.superseded import deprecation - deprecation(32610, 'is_AlgebraicField_common is deprecated; use isinstance(..., sage.rings.abc.AlgebraicField_common) instead') - return isinstance(F, AlgebraicField_common) - - def prec_seq(): r""" Return a generator object which iterates over an infinite increasing diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index bfa020f14b8..dea1633dd15 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -68,30 +68,6 @@ cimport gmpy2 new_gen_from_real_double_element = None -def is_RealDoubleField(x): - """ - Returns ``True`` if ``x`` is the field of real double precision numbers. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.RealDoubleField` instead. - - EXAMPLES:: - - sage: from sage.rings.real_double import is_RealDoubleField - sage: is_RealDoubleField(RDF) - doctest:warning... - DeprecationWarning: is_RealDoubleField is deprecated; - use isinstance(..., sage.rings.abc.RealDoubleField) instead - See https://github.com/sagemath/sage/issues/32610 for details. - True - sage: is_RealDoubleField(RealField(53)) # needs sage.rings.real_mpfr - False - """ - from sage.misc.superseded import deprecation - deprecation(32610, 'is_RealDoubleField is deprecated; use isinstance(..., sage.rings.abc.RealDoubleField) instead') - return isinstance(x, RealDoubleField_class) - - cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): """ An approximation to the field of real numbers using double diff --git a/src/sage/rings/real_interval_field.py b/src/sage/rings/real_interval_field.py deleted file mode 100644 index 7b707cbc1ad..00000000000 --- a/src/sage/rings/real_interval_field.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Field of Arbitrary Precision Real Number Intervals -""" - -from sage.misc.superseded import deprecation -deprecation(24371, "sage.rings.real_interval_field is deprecated") - -from sage.rings.real_mpfi import RealIntervalField_class, RealIntervalFieldElement - -def is_RealIntervalField(x): - """ - Check if ``x`` is a :class:`RealIntervalField_class`. - - EXAMPLES:: - - sage: from sage.rings.real_interval_field import is_RealIntervalField as is_RIF - doctest:...: DeprecationWarning: sage.rings.real_interval_field is deprecated - See https://github.com/sagemath/sage/issues/24371 for details. - sage: is_RIF(RIF) - True - """ - return isinstance(x, RealIntervalField_class) - -def is_RealIntervalFieldElement(x): - """ - Check if ``x`` is a :class:`RealIntervalFieldElement`. - - EXAMPLES:: - - sage: from sage.rings.real_interval_field import is_RealIntervalFieldElement as is_RIFE - sage: is_RIFE(RIF(2.5)) - True - """ - return isinstance(x, RealIntervalFieldElement) - -def __reduce__RealIntervalField(prec, sci_not): - """ - For pickling. - - EXAMPLES:: - - sage: from sage.rings.real_interval_field import __reduce__RealIntervalField - sage: R = RealIntervalField(sci_not=1, prec=200) - sage: __reduce__RealIntervalField(200, 1) == R - True - """ - return RealIntervalField_class(prec, sci_not) - -def __reduce__RealIntervalFieldElement(parent, x, base=10): - """ - For pickling. - - EXAMPLES:: - - sage: from sage.rings.real_interval_field import __reduce__RealIntervalFieldElement - sage: R = RealIntervalField(sci_not=1, prec=200) - sage: elt = R(2.5) - sage: __reduce__RealIntervalFieldElement(R, 2.5) == elt - True - """ - return RealIntervalFieldElement(parent, x, base=base) diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 8ca68e35474..a78680d0ee2 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -5912,29 +5912,6 @@ def create_RealNumber(s, int base=10, int pad=0, rnd="RNDN", int min_prec=53): return RealLiteral(R, s, base) -def is_RealField(x): - """ - Returns ``True`` if ``x`` is technically of a Python real field type. - - This function is deprecated. Use :func:`isinstance` with - :class:`~sage.rings.abc.RealField` instead. - - EXAMPLES:: - - sage: sage.rings.real_mpfr.is_RealField(RR) - doctest:warning... - DeprecationWarning: is_RealField is deprecated; - use isinstance(..., sage.rings.abc.RealField) instead - See https://github.com/sagemath/sage/issues/32610 for details. - True - sage: sage.rings.real_mpfr.is_RealField(CC) - False - """ - from sage.misc.superseded import deprecation - deprecation(32610, 'is_RealField is deprecated; use isinstance(..., sage.rings.abc.RealField) instead') - return isinstance(x, RealField_class) - - def is_RealNumber(x): """ Return ``True`` if ``x`` is of type :class:`RealNumber`, meaning that it @@ -6122,24 +6099,6 @@ cdef class int_toRR(Map): return y -def create_RealField(*args, **kwds): - r""" - Deprecated function moved to :mod:`sage.rings.real_field`. - - TESTS:: - - sage: from sage.rings.real_mpfr import create_RealField - sage: create_RealField() - doctest:...: DeprecationWarning: Please import create_RealField from sage.rings.real_field - See https://github.com/sagemath/sage/issues/24511 for details. - Real Field with 53 bits of precision - """ - # deprecation has already been imported in this file - deprecation(24511, "Please import create_RealField from sage.rings.real_field") - from sage.rings.real_field import create_RealField as cr - return cr(*args, **kwds) - - # Support Python's numbers abstract base class import numbers numbers.Real.register(RealNumber)