Skip to content

Commit

Permalink
sagemathgh-37897: Deprecate is_Monoid, is_FreeMonoid, `is_FreeAbe…
Browse files Browse the repository at this point in the history
…lianMonoid`

    
<!-- ^ 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
  • Loading branch information
Release Manager committed May 11, 2024
2 parents 3450d9f + 9fe3e99 commit 113c54f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sage/monoids/free_abelian_monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def is_FreeAbelianMonoid(x):
sage: from sage.monoids.free_abelian_monoid import is_FreeAbelianMonoid
sage: is_FreeAbelianMonoid(5)
doctest:warning...
DeprecationWarning: the function is_FreeAbelianMonoid is deprecated;
use 'isinstance(..., FreeAbelianMonoid_class)' instead
See https://github.com/sagemath/sage/issues/37897 for details.
False
sage: is_FreeAbelianMonoid(FreeAbelianMonoid(7,'a'))
True
Expand All @@ -177,6 +181,8 @@ def is_FreeAbelianMonoid(x):
sage: is_FreeAbelianMonoid(FreeMonoid(0,''))
False
"""
from sage.misc.superseded import deprecation
deprecation(37897, "the function is_FreeAbelianMonoid is deprecated; use 'isinstance(..., FreeAbelianMonoid_class)' instead")
return isinstance(x, FreeAbelianMonoid_class)


Expand Down
6 changes: 6 additions & 0 deletions src/sage/monoids/free_monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def is_FreeMonoid(x):
sage: from sage.monoids.free_monoid import is_FreeMonoid
sage: is_FreeMonoid(5)
doctest:warning...
DeprecationWarning: the function is_FreeMonoid is deprecated;
use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead
See https://github.com/sagemath/sage/issues/37897 for details.
False
sage: is_FreeMonoid(FreeMonoid(7,'a'))
True
Expand All @@ -56,6 +60,8 @@ def is_FreeMonoid(x):
sage: is_FreeMonoid(FreeAbelianMonoid(index_set=ZZ))
False
"""
from sage.misc.superseded import deprecation
deprecation(37897, "the function is_FreeMonoid is deprecated; use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead")
if isinstance(x, FreeMonoid):
return True
from sage.monoids.indexed_free_monoid import IndexedFreeMonoid
Expand Down
6 changes: 6 additions & 0 deletions src/sage/monoids/monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def is_Monoid(x) -> bool:
sage: from sage.monoids.monoid import is_Monoid
sage: is_Monoid(0)
doctest:warning...
DeprecationWarning: the function is_Monoid is deprecated;
use 'isinstance(..., Monoid_class)' instead
See https://github.com/sagemath/sage/issues/37897 for details.
False
sage: is_Monoid(ZZ) # The technical math meaning of monoid has
....: # no bearing whatsoever on the result: it's
Expand All @@ -26,6 +30,8 @@ def is_Monoid(x) -> bool:
sage: is_Monoid(F)
True
"""
from sage.misc.superseded import deprecation
deprecation(37897, "the function is_Monoid is deprecated; use 'isinstance(..., Monoid_class)' instead")
return isinstance(x, Monoid_class)


Expand Down

0 comments on commit 113c54f

Please sign in to comment.