diff --git a/src/doc/en/reference/calculus/index.rst b/src/doc/en/reference/calculus/index.rst index abbb408f6e9..c9a5158e522 100644 --- a/src/doc/en/reference/calculus/index.rst +++ b/src/doc/en/reference/calculus/index.rst @@ -53,7 +53,6 @@ Internal functionality supporting calculus - :doc:`sage/symbolic/function_factory` - :doc:`Internals of Callable Symbolic Expressions ` - :doc:`sage/symbolic/expression_conversions` -- :doc:`sage/symbolic/substitution_map` - :doc:`sage/symbolic/benchmark` - :doc:`sage/symbolic/random_tests` - :doc:`sage/symbolic/maxima_wrapper` @@ -95,7 +94,6 @@ Internal functionality supporting calculus sage/calculus/var sage/symbolic/maxima_wrapper sage/symbolic/operators - sage/symbolic/substitution_map sage/symbolic/benchmark sage/symbolic/random_tests diff --git a/src/sage/combinat/words/alphabet.py b/src/sage/combinat/words/alphabet.py index 5d1b0d5468a..3289ad5aa1a 100644 --- a/src/sage/combinat/words/alphabet.py +++ b/src/sage/combinat/words/alphabet.py @@ -32,15 +32,14 @@ # http://www.gnu.org/licenses/ # **************************************************************************** -from sage.categories.sets_cat import Sets +import collections.abc -from sage.sets.totally_ordered_finite_set import TotallyOrderedFiniteSet -from sage.sets.family import Family - -from sage.rings.integer import Integer +from sage.categories.sets_cat import Sets from sage.rings.infinity import Infinity - +from sage.rings.integer import Integer +from sage.sets.family import Family from sage.sets.non_negative_integers import NonNegativeIntegers +from sage.sets.totally_ordered_finite_set import TotallyOrderedFiniteSet set_of_letters = { @@ -222,7 +221,7 @@ def build_alphabet(data=None, names=None, name=None): return IntegerRange(Integer(data)) if isinstance(names, str): return TotallyOrderedFiniteSet([names + '%d' % i for i in range(data)]) - if len(names) == data: + if isinstance(names, collections.abc.Sequence) and len(names) == data: return TotallyOrderedFiniteSet(names) raise ValueError("invalid value for names") diff --git a/src/sage/symbolic/all.py b/src/sage/symbolic/all.py index 399ab56e78c..b5a0883d202 100644 --- a/src/sage/symbolic/all.py +++ b/src/sage/symbolic/all.py @@ -1,10 +1,3 @@ -from sage.misc.lazy_import import lazy_import - -lazy_import("sage.symbolic.constants", "I", deprecation=(18036, - "import I from sage.symbolic.constants for the imaginary unit viewed as an element of SR, or from sage.rings.imaginary_unit for the element of ZZ[i]")) -lazy_import("sage.symbolic.constants", "I", as_="i", deprecation=(18036, - "import I from sage.symbolic.constants for the imaginary unit viewed as an element of SR, or from sage.rings.imaginary_unit for the element of ZZ[i]")) - from .ring import SR from .constants import (pi, e, NaN, golden_ratio, log2, euler_gamma, catalan, khinchin, twinprime, mertens, glaisher) diff --git a/src/sage/symbolic/callable.py b/src/sage/symbolic/callable.py index dc093716a34..6db7f38745d 100644 --- a/src/sage/symbolic/callable.py +++ b/src/sage/symbolic/callable.py @@ -69,63 +69,6 @@ ###################################################################### # Callable functions ###################################################################### -def is_CallableSymbolicExpressionRing(x): - """ - Return ``True`` if ``x`` is a callable symbolic expression ring. - - INPUT: - - - ``x`` - object - - OUTPUT: bool - - EXAMPLES:: - - sage: from sage.symbolic.callable import is_CallableSymbolicExpressionRing - sage: is_CallableSymbolicExpressionRing(QQ) - doctest:warning... - DeprecationWarning: is_CallableSymbolicExpressionRing is deprecated; - use isinstance(..., sage.rings.abc.CallableSymbolicExpressionRing instead - See https://github.com/sagemath/sage/issues/32665 for details. - False - sage: var('x,y,z') - (x, y, z) - sage: is_CallableSymbolicExpressionRing(CallableSymbolicExpressionRing((x,y,z))) - True - """ - from sage.misc.superseded import deprecation - deprecation(32665, 'is_CallableSymbolicExpressionRing is deprecated; use isinstance(..., sage.rings.abc.CallableSymbolicExpressionRing instead') - return isinstance(x, CallableSymbolicExpressionRing_class) - - -def is_CallableSymbolicExpression(x): - r""" - Return ``True`` if ``x`` is a callable symbolic expression. - - EXAMPLES:: - - sage: from sage.symbolic.callable import is_CallableSymbolicExpression - sage: var('a x y z') - (a, x, y, z) - sage: f(x,y) = a + 2*x + 3*y + z - sage: is_CallableSymbolicExpression(f) - doctest:warning... - DeprecationWarning: is_CallableSymbolicExpression is deprecated; - use isinstance(..., Expression) and ....is_callable() instead - See https://github.com/sagemath/sage/issues/34215 for details. - True - sage: is_CallableSymbolicExpression(a+2*x) - False - sage: def foo(n): return n^2 - ... - sage: is_CallableSymbolicExpression(foo) - False - """ - from sage.misc.superseded import deprecation - deprecation(34215, 'is_CallableSymbolicExpression is deprecated; use isinstance(..., Expression) and ....is_callable() instead') - from sage.structure.element import Expression - return isinstance(x, Expression) and isinstance(x.parent(), CallableSymbolicExpressionRing_class) - class CallableSymbolicExpressionFunctor(ConstructionFunctor): def __init__(self, arguments): diff --git a/src/sage/symbolic/comparison.py b/src/sage/symbolic/comparison.py deleted file mode 100644 index 38c23b97d6c..00000000000 --- a/src/sage/symbolic/comparison.py +++ /dev/null @@ -1,13 +0,0 @@ -r""" -Comparison of Symbolic Expressions (deprecated module) - -This module consists only of deprecated lazy imports from -:mod:`sage.symbolic.expression`. -""" - - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', - ['print_order', '_print_key', 'print_sorted', '_math_key', - 'math_sorted', 'mixed_order', '_mixed_key', 'mixed_sorted'], - deprecation=32386) diff --git a/src/sage/symbolic/constant.py b/src/sage/symbolic/constant.py deleted file mode 100644 index 53571b8beb0..00000000000 --- a/src/sage/symbolic/constant.py +++ /dev/null @@ -1,10 +0,0 @@ -r""" -Symbolic constants (deprecated module) - -This module consists only of deprecated lazy imports from -:mod:`sage.symbolic.expression`. -""" - - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', 'PynacConstant', deprecation=32386) diff --git a/src/sage/symbolic/constants_c.py b/src/sage/symbolic/constants_c.py deleted file mode 100644 index b18d0d0eb2f..00000000000 --- a/src/sage/symbolic/constants_c.py +++ /dev/null @@ -1,10 +0,0 @@ -r""" -The constant `e` (deprecated module) - -This module consists only of deprecated lazy imports from -:mod:`sage.symbolic.expression`. -""" - - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', 'E', deprecation=32386) diff --git a/src/sage/symbolic/expression.pxd b/src/sage/symbolic/expression.pxd index 1fa578d43c3..33e352b7f3d 100644 --- a/src/sage/symbolic/expression.pxd +++ b/src/sage/symbolic/expression.pxd @@ -1,4 +1,3 @@ -cpdef bint is_Expression(x) cpdef _repr_Expression(x) cpdef _latex_Expression(x) cpdef new_Expression(parent, x) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 66f624141b3..20d7647d2e5 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -409,32 +409,6 @@ include "pynac_impl.pxi" from sage.symbolic.symbols import symbol_table, register_symbol # used to be defined in pynac_impl -cpdef bint is_Expression(x): - """ - Return True if ``x`` is a symbolic expression. - - This method is deprecated. Use :func:`isinstance` with - :class:`sage.structure.element.Expression` instead. - - EXAMPLES:: - - sage: from sage.symbolic.expression import is_Expression - sage: is_Expression(x) - doctest:warning... - DeprecationWarning: is_Expression is deprecated; - use isinstance(..., sage.structure.element.Expression) instead - See https://github.com/sagemath/sage/issues/32638 for details. - True - sage: is_Expression(2) - False - sage: is_Expression(SR(2)) - True - """ - from sage.misc.superseded import deprecation - deprecation(32638, 'is_Expression is deprecated; use isinstance(..., sage.structure.element.Expression) instead') - return isinstance(x, Expression) - - cpdef bint is_SymbolicEquation(x): """ Return True if *x* is a symbolic equation. @@ -6346,32 +6320,6 @@ cdef class Expression(Expression_abc): nops = number_of_operands - def __len__(self): - """ - Return the number of operands of this expression. - - This is deprecated; use :meth:`number_of_operands` instead. - - EXAMPLES:: - - sage: var('a,b,c,x,y') - (a, b, c, x, y) - sage: len(a) - doctest:warning... - DeprecationWarning: using len on a symbolic expression is deprecated; use method number_of_operands instead - See https://github.com/sagemath/sage/issues/29738 for details. - 0 - sage: len((a^2 + b^2 + (x+y)^2)) - 3 - sage: len((a^2)) - 2 - sage: len(a*b^2*c) - 3 - """ - from sage.misc.superseded import deprecation - deprecation(29738, "using len on a symbolic expression is deprecated; use method number_of_operands instead") - return self.number_of_operands() - def _unpack_operands(self): """ Unpack the operands of this expression converting each to a Python diff --git a/src/sage/symbolic/getitem.py b/src/sage/symbolic/getitem.py deleted file mode 100644 index 3ff5e400fba..00000000000 --- a/src/sage/symbolic/getitem.py +++ /dev/null @@ -1,12 +0,0 @@ -r""" -Operands (deprecated module) - -This module consists only of deprecated lazy imports from -:mod:`sage.symbolic.expression`. -""" - - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', - ['normalize_index_for_doctests', 'OperandsWrapper', 'restore_op_wrapper'], - deprecation=32386) diff --git a/src/sage/symbolic/pynac_constant.py b/src/sage/symbolic/pynac_constant.py deleted file mode 100644 index 080cc7637be..00000000000 --- a/src/sage/symbolic/pynac_constant.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -Wrapper around Pynac's constants -""" - -# **************************************************************************** -# Copyright (C) 2008 William Stein -# Copyright (C) 2008 Burcin Erocal -# Copyright (C) 2009 Mike Hansen -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# https://www.gnu.org/licenses/ -# **************************************************************************** - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', 'PynacConstant', deprecation=32386) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index d45b88e24de..822eaacd30b 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -1301,33 +1301,6 @@ def the_SymbolicRing(): return SR -def is_SymbolicExpressionRing(R): - """ - Return True if ``R`` is the symbolic expression ring. - - This function is deprecated. Instead, either use ``R is SR`` (to - test whether ``R`` is the unique symbolic ring ``SR``); or - ``isinstance`` with :class:`~sage.rings.abc.SymbolicRing` - (when also symbolic subrings and callable symbolic rings should - be accepted). - - EXAMPLES:: - - sage: from sage.symbolic.ring import is_SymbolicExpressionRing - sage: is_SymbolicExpressionRing(ZZ) - doctest:warning... - DeprecationWarning: is_SymbolicExpressionRing is deprecated; - use "... is SR" or isinstance(..., sage.rings.abc.SymbolicRing instead - See https://github.com/sagemath/sage/issues/32665 for details. - False - sage: is_SymbolicExpressionRing(SR) - True - """ - from sage.misc.superseded import deprecation - deprecation(32665, 'is_SymbolicExpressionRing is deprecated; use "... is SR" or isinstance(..., sage.rings.abc.SymbolicRing instead') - return R is SR - - def var(name, **kwds): """ EXAMPLES:: diff --git a/src/sage/symbolic/series.py b/src/sage/symbolic/series.py deleted file mode 100644 index 943631c52f2..00000000000 --- a/src/sage/symbolic/series.py +++ /dev/null @@ -1,10 +0,0 @@ -r""" -Symbolic Series - -This module consists only of deprecated lazy imports from -:mod:`sage.symbolic.expression`. -""" - - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', 'SymbolicSeries', deprecation=32386) diff --git a/src/sage/symbolic/substitution_map.py b/src/sage/symbolic/substitution_map.py deleted file mode 100644 index a883d3aecb0..00000000000 --- a/src/sage/symbolic/substitution_map.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Substitution Maps - -This object wraps Pynac ``exmap`` objects. These encode substitutions -of symbolic expressions. The main use of this module is to hook into -Pynac's ``subs()`` methods and pass a wrapper for the substitution map -back to Python. -""" - -# **************************************************************************** -# Copyright (C) 2013 Volker Braun -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# https://www.gnu.org/licenses/ -# **************************************************************************** - -from sage.misc.lazy_import import lazy_import -lazy_import('sage.symbolic.expression', ('SubstitutionMap', 'make_map'), deprecation=32386)