From b9fb9ec9e6e9970b0633390f103e87f33358b618 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 31 May 2024 21:18:05 -0700 Subject: [PATCH] Deprecate is_MutablePoset --- src/sage/data_structures/mutable_poset.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sage/data_structures/mutable_poset.py b/src/sage/data_structures/mutable_poset.py index 72ec82d3bb4..03b29517227 100644 --- a/src/sage/data_structures/mutable_poset.py +++ b/src/sage/data_structures/mutable_poset.py @@ -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) @@ -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)