Skip to content

Commit

Permalink
sagemathgh-37896: Deprecate is_FreeAlgebra, is_QuaternionAlgebra,…
Browse files Browse the repository at this point in the history
… `is_SymmetricFunctionAlgebra`

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

- Fixes sagemath#32738

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [ ] 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 and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37896
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee, Travis Scrimshaw
  • Loading branch information
Release Manager committed May 11, 2024
2 parents f066a5b + 4a3ffbd commit 3450d9f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ def is_FreeAlgebra(x) -> bool:
sage: from sage.algebras.free_algebra import is_FreeAlgebra
sage: is_FreeAlgebra(5)
doctest:warning...
DeprecationWarning: the function is_FreeAlgebra is deprecated;
use 'isinstance(..., (FreeAlgebra_generic, FreeAlgebra_letterplace))' instead
See https://github.com/sagemath/sage/issues/37896 for details.
False
sage: is_FreeAlgebra(ZZ)
False
Expand All @@ -387,6 +391,8 @@ def is_FreeAlgebra(x) -> bool:
....: degrees=list(range(1,11))))
True
"""
from sage.misc.superseded import deprecation
deprecation(37896, "the function is_FreeAlgebra is deprecated; use 'isinstance(..., (FreeAlgebra_generic, FreeAlgebra_letterplace))' instead")
return isinstance(x, (FreeAlgebra_generic, FreeAlgebra_letterplace))


Expand Down Expand Up @@ -742,7 +748,7 @@ def _coerce_map_from_(self, R):
return True

# free algebras in the same variable over any base that coerces in:
if is_FreeAlgebra(R):
if isinstance(R, (FreeAlgebra_generic, FreeAlgebra_letterplace)):
if R.variable_names() == self.variable_names():
return self.base_ring().has_coerce_map_from(R.base_ring())
if isinstance(R, PBWBasisOfFreeAlgebra):
Expand Down
7 changes: 5 additions & 2 deletions src/sage/algebras/free_algebra_quotient.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.algebras.free_algebra import is_FreeAlgebra
from sage.algebras.free_algebra import FreeAlgebra_generic
from sage.algebras.free_algebra_quotient_element import FreeAlgebraQuotientElement
from sage.categories.algebras import Algebras
from sage.misc.lazy_import import lazy_import
from sage.modules.free_module import FreeModule
from sage.structure.unique_representation import UniqueRepresentation
from sage.structure.parent import Parent

lazy_import('sage.algebras.letterplace.free_algebra_letterplace', 'FreeAlgebra_letterplace')


class FreeAlgebraQuotient(UniqueRepresentation, Parent):
@staticmethod
Expand Down Expand Up @@ -153,7 +156,7 @@ def __init__(self, A, mons, mats, names):
sage: TestSuite(H2).run()
"""
if not is_FreeAlgebra(A):
if not isinstance(A, (FreeAlgebra_generic, FreeAlgebra_letterplace)):
raise TypeError("argument A must be a free algebra")
R = A.base_ring()
n = A.ngens()
Expand Down
6 changes: 6 additions & 0 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,16 @@ def is_QuaternionAlgebra(A):
EXAMPLES::
sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(QuaternionAlgebra(QQ,-1,-1))
doctest:warning...
DeprecationWarning: the function is_QuaternionAlgebra is deprecated;
use 'isinstance(..., QuaternionAlgebra_abstract)' instead
See https://github.com/sagemath/sage/issues/37896 for details.
True
sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(ZZ)
False
"""
from sage.misc.superseded import deprecation
deprecation(37896, "the function is_QuaternionAlgebra is deprecated; use 'isinstance(..., QuaternionAlgebra_abstract)' instead")
return isinstance(A, QuaternionAlgebra_abstract)


Expand Down
6 changes: 6 additions & 0 deletions src/sage/combinat/sf/sfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ def is_SymmetricFunctionAlgebra(x):
sage: from sage.combinat.sf.sfa import is_SymmetricFunctionAlgebra
sage: is_SymmetricFunctionAlgebra(5)
doctest:warning...
DeprecationWarning: the function is_SymmetricFunctionAlgebra is deprecated;
use 'isinstance(..., SymmetricFunctionAlgebra_generic)' instead
See https://github.com/sagemath/sage/issues/37896 for details.
False
sage: is_SymmetricFunctionAlgebra(ZZ)
False
Expand All @@ -258,6 +262,8 @@ def is_SymmetricFunctionAlgebra(x):
sage: is_SymmetricFunctionAlgebra(SymmetricFunctions(FractionField(QQ['q','t'])).macdonald().P())
True
"""
from sage.misc.superseded import deprecation
deprecation(37896, "the function is_SymmetricFunctionAlgebra is deprecated; use 'isinstance(..., SymmetricFunctionAlgebra_generic)' instead")
return isinstance(x, SymmetricFunctionAlgebra_generic)


Expand Down

0 comments on commit 3450d9f

Please sign in to comment.