Skip to content

Commit 9e2d10a

Browse files
author
Release Manager
committed
gh-37896: Deprecate `is_FreeAlgebra`, `is_QuaternionAlgebra`, `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 #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 #12345". --> - Fixes #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, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #37896 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Travis Scrimshaw
2 parents cbb4306 + 4a3ffbd commit 9e2d10a

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

src/sage/algebras/free_algebra.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ def is_FreeAlgebra(x) -> bool:
376376
377377
sage: from sage.algebras.free_algebra import is_FreeAlgebra
378378
sage: is_FreeAlgebra(5)
379+
doctest:warning...
380+
DeprecationWarning: the function is_FreeAlgebra is deprecated;
381+
use 'isinstance(..., (FreeAlgebra_generic, FreeAlgebra_letterplace))' instead
382+
See https://github.com/sagemath/sage/issues/37896 for details.
379383
False
380384
sage: is_FreeAlgebra(ZZ)
381385
False
@@ -387,6 +391,8 @@ def is_FreeAlgebra(x) -> bool:
387391
....: degrees=list(range(1,11))))
388392
True
389393
"""
394+
from sage.misc.superseded import deprecation
395+
deprecation(37896, "the function is_FreeAlgebra is deprecated; use 'isinstance(..., (FreeAlgebra_generic, FreeAlgebra_letterplace))' instead")
390396
return isinstance(x, (FreeAlgebra_generic, FreeAlgebra_letterplace))
391397

392398

@@ -742,7 +748,7 @@ def _coerce_map_from_(self, R):
742748
return True
743749

744750
# free algebras in the same variable over any base that coerces in:
745-
if is_FreeAlgebra(R):
751+
if isinstance(R, (FreeAlgebra_generic, FreeAlgebra_letterplace)):
746752
if R.variable_names() == self.variable_names():
747753
return self.base_ring().has_coerce_map_from(R.base_ring())
748754
if isinstance(R, PBWBasisOfFreeAlgebra):

src/sage/algebras/free_algebra_quotient.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@
6060
# https://www.gnu.org/licenses/
6161
# ****************************************************************************
6262

63-
from sage.algebras.free_algebra import is_FreeAlgebra
63+
from sage.algebras.free_algebra import FreeAlgebra_generic
6464
from sage.algebras.free_algebra_quotient_element import FreeAlgebraQuotientElement
6565
from sage.categories.algebras import Algebras
66+
from sage.misc.lazy_import import lazy_import
6667
from sage.modules.free_module import FreeModule
6768
from sage.structure.unique_representation import UniqueRepresentation
6869
from sage.structure.parent import Parent
6970

71+
lazy_import('sage.algebras.letterplace.free_algebra_letterplace', 'FreeAlgebra_letterplace')
72+
7073

7174
class FreeAlgebraQuotient(UniqueRepresentation, Parent):
7275
@staticmethod
@@ -153,7 +156,7 @@ def __init__(self, A, mons, mats, names):
153156
154157
sage: TestSuite(H2).run()
155158
"""
156-
if not is_FreeAlgebra(A):
159+
if not isinstance(A, (FreeAlgebra_generic, FreeAlgebra_letterplace)):
157160
raise TypeError("argument A must be a free algebra")
158161
R = A.base_ring()
159162
n = A.ngens()

src/sage/algebras/quatalg/quaternion_algebra.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,16 @@ def is_QuaternionAlgebra(A):
307307
EXAMPLES::
308308
309309
sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(QuaternionAlgebra(QQ,-1,-1))
310+
doctest:warning...
311+
DeprecationWarning: the function is_QuaternionAlgebra is deprecated;
312+
use 'isinstance(..., QuaternionAlgebra_abstract)' instead
313+
See https://github.com/sagemath/sage/issues/37896 for details.
310314
True
311315
sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(ZZ)
312316
False
313317
"""
318+
from sage.misc.superseded import deprecation
319+
deprecation(37896, "the function is_QuaternionAlgebra is deprecated; use 'isinstance(..., QuaternionAlgebra_abstract)' instead")
314320
return isinstance(A, QuaternionAlgebra_abstract)
315321

316322

src/sage/combinat/sf/sfa.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ def is_SymmetricFunctionAlgebra(x):
246246
247247
sage: from sage.combinat.sf.sfa import is_SymmetricFunctionAlgebra
248248
sage: is_SymmetricFunctionAlgebra(5)
249+
doctest:warning...
250+
DeprecationWarning: the function is_SymmetricFunctionAlgebra is deprecated;
251+
use 'isinstance(..., SymmetricFunctionAlgebra_generic)' instead
252+
See https://github.com/sagemath/sage/issues/37896 for details.
249253
False
250254
sage: is_SymmetricFunctionAlgebra(ZZ)
251255
False
@@ -258,6 +262,8 @@ def is_SymmetricFunctionAlgebra(x):
258262
sage: is_SymmetricFunctionAlgebra(SymmetricFunctions(FractionField(QQ['q','t'])).macdonald().P())
259263
True
260264
"""
265+
from sage.misc.superseded import deprecation
266+
deprecation(37896, "the function is_SymmetricFunctionAlgebra is deprecated; use 'isinstance(..., SymmetricFunctionAlgebra_generic)' instead")
261267
return isinstance(x, SymmetricFunctionAlgebra_generic)
262268

263269

0 commit comments

Comments
 (0)