Skip to content

Commit 113c54f

Browse files
author
Release Manager
committed
sagemathgh-37897: Deprecate `is_Monoid`, `is_FreeMonoid`, `is_FreeAbelianMonoid` <!-- ^ 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". --> ### 📝 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. - [ ] 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#37897 Reported by: Matthias Köppe Reviewer(s): Travis Scrimshaw
2 parents 3450d9f + 9fe3e99 commit 113c54f

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/sage/monoids/free_abelian_monoid.py

+6
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def is_FreeAbelianMonoid(x):
169169
170170
sage: from sage.monoids.free_abelian_monoid import is_FreeAbelianMonoid
171171
sage: is_FreeAbelianMonoid(5)
172+
doctest:warning...
173+
DeprecationWarning: the function is_FreeAbelianMonoid is deprecated;
174+
use 'isinstance(..., FreeAbelianMonoid_class)' instead
175+
See https://github.com/sagemath/sage/issues/37897 for details.
172176
False
173177
sage: is_FreeAbelianMonoid(FreeAbelianMonoid(7,'a'))
174178
True
@@ -177,6 +181,8 @@ def is_FreeAbelianMonoid(x):
177181
sage: is_FreeAbelianMonoid(FreeMonoid(0,''))
178182
False
179183
"""
184+
from sage.misc.superseded import deprecation
185+
deprecation(37897, "the function is_FreeAbelianMonoid is deprecated; use 'isinstance(..., FreeAbelianMonoid_class)' instead")
180186
return isinstance(x, FreeAbelianMonoid_class)
181187

182188

src/sage/monoids/free_monoid.py

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def is_FreeMonoid(x):
4444
4545
sage: from sage.monoids.free_monoid import is_FreeMonoid
4646
sage: is_FreeMonoid(5)
47+
doctest:warning...
48+
DeprecationWarning: the function is_FreeMonoid is deprecated;
49+
use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead
50+
See https://github.com/sagemath/sage/issues/37897 for details.
4751
False
4852
sage: is_FreeMonoid(FreeMonoid(7,'a'))
4953
True
@@ -56,6 +60,8 @@ def is_FreeMonoid(x):
5660
sage: is_FreeMonoid(FreeAbelianMonoid(index_set=ZZ))
5761
False
5862
"""
63+
from sage.misc.superseded import deprecation
64+
deprecation(37897, "the function is_FreeMonoid is deprecated; use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead")
5965
if isinstance(x, FreeMonoid):
6066
return True
6167
from sage.monoids.indexed_free_monoid import IndexedFreeMonoid

src/sage/monoids/monoid.py

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def is_Monoid(x) -> bool:
1414
1515
sage: from sage.monoids.monoid import is_Monoid
1616
sage: is_Monoid(0)
17+
doctest:warning...
18+
DeprecationWarning: the function is_Monoid is deprecated;
19+
use 'isinstance(..., Monoid_class)' instead
20+
See https://github.com/sagemath/sage/issues/37897 for details.
1721
False
1822
sage: is_Monoid(ZZ) # The technical math meaning of monoid has
1923
....: # no bearing whatsoever on the result: it's
@@ -26,6 +30,8 @@ def is_Monoid(x) -> bool:
2630
sage: is_Monoid(F)
2731
True
2832
"""
33+
from sage.misc.superseded import deprecation
34+
deprecation(37897, "the function is_Monoid is deprecated; use 'isinstance(..., Monoid_class)' instead")
2935
return isinstance(x, Monoid_class)
3036

3137

0 commit comments

Comments
 (0)