Skip to content

Commit

Permalink
sagemathgh-38125: Deprecate is_MutablePoset
Browse files Browse the repository at this point in the history
    
<!-- ^ 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#38125
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Jun 4, 2024
2 parents 77f2685 + b9fb9ec commit 42c4568
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sage/data_structures/mutable_poset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,15 @@ def is_MutablePoset(P):
sage: from sage.data_structures.mutable_poset import is_MutablePoset
sage: P = MP()
sage: is_MutablePoset(P)
doctest:warning...
DeprecationWarning: The function is_MutablePoset is deprecated; use 'isinstance(..., MutablePoset)' instead.
See https://github.com/sagemath/sage/issues/38125 for details.
True
"""
from sage.misc.superseded import deprecation
deprecation(38125,
"The function is_MutablePoset is deprecated; "
"use 'isinstance(..., MutablePoset)' instead.")
return isinstance(P, MutablePoset)


Expand Down Expand Up @@ -1402,7 +1409,7 @@ def __init__(self, data=None, key=None, merge=None, can_merge=None):
...
TypeError: 33 is not iterable; do not know what to do with it.
"""
if is_MutablePoset(data):
if isinstance(data, MutablePoset):
if key is not None:
raise TypeError('Cannot use key when data is a poset.')
self._copy_shells_(data, lambda e: e)
Expand Down

0 comments on commit 42c4568

Please sign in to comment.