From f514e727300182eda06ed6a59fb971c7395312ec Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:29:03 -0700 Subject: [PATCH 01/10] sage.symbolic: Remove modules deprecated in #32386 (2021) --- src/sage/symbolic/comparison.py | 13 ------------- src/sage/symbolic/constant.py | 10 ---------- src/sage/symbolic/constants_c.py | 10 ---------- src/sage/symbolic/getitem.py | 12 ------------ src/sage/symbolic/pynac_constant.py | 18 ------------------ src/sage/symbolic/series.py | 10 ---------- src/sage/symbolic/substitution_map.py | 21 --------------------- 7 files changed, 94 deletions(-) delete mode 100644 src/sage/symbolic/comparison.py delete mode 100644 src/sage/symbolic/constant.py delete mode 100644 src/sage/symbolic/constants_c.py delete mode 100644 src/sage/symbolic/getitem.py delete mode 100644 src/sage/symbolic/pynac_constant.py delete mode 100644 src/sage/symbolic/series.py delete mode 100644 src/sage/symbolic/substitution_map.py 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/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/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) From 2a5bbce58d782e6962d44877d95bf8d50f3e61dc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:32:53 -0700 Subject: [PATCH 02/10] sage.symbolic.callable: Remove function deprecated in #32665 (2021) --- src/sage/symbolic/callable.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/sage/symbolic/callable.py b/src/sage/symbolic/callable.py index dc093716a34..ba3dd6aee75 100644 --- a/src/sage/symbolic/callable.py +++ b/src/sage/symbolic/callable.py @@ -69,34 +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""" From ff06d30599d988d4d5a97b4f93a1b2e5e73faea7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:33:31 -0700 Subject: [PATCH 03/10] sage.symbolic.callable: Remove function deprecated in #34215 (2022) --- src/sage/symbolic/callable.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/sage/symbolic/callable.py b/src/sage/symbolic/callable.py index ba3dd6aee75..6db7f38745d 100644 --- a/src/sage/symbolic/callable.py +++ b/src/sage/symbolic/callable.py @@ -70,35 +70,6 @@ # Callable functions ###################################################################### -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): """ From cdfbdca403062bcea2753a6114d295abfd7d7c47 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:35:30 -0700 Subject: [PATCH 04/10] sage.symbolic.expression: Remove function deprecated in #32638 (2021) --- src/sage/symbolic/expression.pyx | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 0f251ac4e5c..b02c17c7604 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. From 6078d3866b8757059f38889ab15aef7ac081e168 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:38:07 -0700 Subject: [PATCH 05/10] sage.symbolic.all: Remove import of sage.symbolic.constants.I, deprecated in #18036 (2020) --- src/sage/symbolic/all.py | 7 ------- 1 file changed, 7 deletions(-) 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) From 26007d5c25ae77e5b0dbf6a68a5f8e9b36476b0a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:39:22 -0700 Subject: [PATCH 06/10] sage.symbolic.ring: Remove function deprecated in #32665 (2021) --- src/sage/symbolic/ring.pyx | 27 --------------------------- 1 file changed, 27 deletions(-) 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:: From 764499d17917915bf776c34655518053bf4fe1f2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 16:42:01 -0700 Subject: [PATCH 07/10] sage.symbolic.expression: Remove method deprecated in #29738 (2021) --- src/sage/symbolic/expression.pyx | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index b02c17c7604..b0f7b22e09e 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -6320,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 From d0ab75c2ffa53ad0ed8146ba69f7e1e145456069 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 19 Sep 2023 18:00:28 -0700 Subject: [PATCH 08/10] src/sage/symbolic/expression.pxd: Update --- src/sage/symbolic/expression.pxd | 1 - 1 file changed, 1 deletion(-) 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) From 8632f17cd06cfe6c254b91cebda6e9d1fc8105ca Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Sep 2023 10:12:17 -0700 Subject: [PATCH 09/10] src/sage/combinat/words/alphabet.py: Check type before calling len --- src/sage/combinat/words/alphabet.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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") From bc242a2bd8d9f784076151b2a5e96ed666ea9758 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 11 Oct 2023 14:40:05 -0700 Subject: [PATCH 10/10] src/doc/en/reference/calculus/index.rst: Remove removed module --- src/doc/en/reference/calculus/index.rst | 2 -- 1 file changed, 2 deletions(-) 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