Skip to content

Commit

Permalink
sagemathgh-36304: sage.symbolics: Remove code deprecated in sagemat…
Browse files Browse the repository at this point in the history
…h#18036, sagemath#29738, sagemath#32386, sagemath#32638, sagemath#32665, sagemath#34215

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36304
Reported by: Matthias Köppe
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed Oct 16, 2023
2 parents d4f239a + bc242a2 commit 52011ee
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 247 deletions.
2 changes: 0 additions & 2 deletions src/doc/en/reference/calculus/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Internal functionality supporting calculus
- :doc:`sage/symbolic/function_factory`
- :doc:`Internals of Callable Symbolic Expressions <sage/symbolic/callable>`
- :doc:`sage/symbolic/expression_conversions`
- :doc:`sage/symbolic/substitution_map`
- :doc:`sage/symbolic/benchmark`
- :doc:`sage/symbolic/random_tests`
- :doc:`sage/symbolic/maxima_wrapper`
Expand Down Expand Up @@ -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

Expand Down
13 changes: 6 additions & 7 deletions src/sage/combinat/words/alphabet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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")

Expand Down
7 changes: 0 additions & 7 deletions src/sage/symbolic/all.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
57 changes: 0 additions & 57 deletions src/sage/symbolic/callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 0 additions & 13 deletions src/sage/symbolic/comparison.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/sage/symbolic/constant.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/sage/symbolic/constants_c.py

This file was deleted.

1 change: 0 additions & 1 deletion src/sage/symbolic/expression.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cpdef bint is_Expression(x)
cpdef _repr_Expression(x)
cpdef _latex_Expression(x)
cpdef new_Expression(parent, x)
Expand Down
52 changes: 0 additions & 52 deletions src/sage/symbolic/expression.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions src/sage/symbolic/getitem.py

This file was deleted.

18 changes: 0 additions & 18 deletions src/sage/symbolic/pynac_constant.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/sage/symbolic/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
10 changes: 0 additions & 10 deletions src/sage/symbolic/series.py

This file was deleted.

21 changes: 0 additions & 21 deletions src/sage/symbolic/substitution_map.py

This file was deleted.

0 comments on commit 52011ee

Please sign in to comment.