From fdd8e819cc46a9bf6ebf050271b3522ab0111ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 27 Jan 2026 21:00:28 +0100 Subject: [PATCH 1/2] deprec after 38184 --- .../groups/perm_gps/permgroup_element.pyx | 22 ------ src/sage/modules/free_module_element.pyx | 20 ------ .../monoids/free_abelian_monoid_element.pyx | 20 ------ src/sage/numerical/linear_functions.pyx | 68 ------------------- src/sage/numerical/linear_tensor.py | 43 +----------- .../numerical/linear_tensor_constraints.py | 41 +---------- src/sage/plot/graphics.py | 23 ------- src/sage/probability/random_variable.py | 37 ---------- 8 files changed, 4 insertions(+), 270 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_element.pyx b/src/sage/groups/perm_gps/permgroup_element.pyx index c87d4bf1987..ca888487e4e 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pyx +++ b/src/sage/groups/perm_gps/permgroup_element.pyx @@ -202,28 +202,6 @@ def make_permgroup_element_v2(G, x, domain): return G.element_class(x, G, check=False) -def is_PermutationGroupElement(x): - r""" - Return ``True`` if ``x`` is a :class:`PermutationGroupElement`. - - EXAMPLES:: - - sage: p = PermutationGroupElement([(1,2),(3,4,5)]) - sage: from sage.groups.perm_gps.permgroup_element import is_PermutationGroupElement - sage: is_PermutationGroupElement(p) - doctest:warning... - DeprecationWarning: The function is_PermutationGroupElement is deprecated; - use 'isinstance(..., PermutationGroupElement)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - True - """ - from sage.misc.superseded import deprecation_cython - deprecation_cython(38184, - "The function is_PermutationGroupElement is deprecated; " - "use 'isinstance(..., PermutationGroupElement)' instead.") - return isinstance(x, PermutationGroupElement) - - cdef class PermutationGroupElement(MultiplicativeGroupElement): r""" An element of a permutation group. diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 5bd5b408417..ea1cfd8678d 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -135,26 +135,6 @@ __one__ = smallInteger(1) __two__ = smallInteger(2) -def is_FreeModuleElement(x): - """ - EXAMPLES:: - - sage: sage.modules.free_module_element.is_FreeModuleElement(0) - doctest:warning... - DeprecationWarning: The function is_FreeModuleElement is deprecated; - use 'isinstance(..., FreeModuleElement)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - False - sage: sage.modules.free_module_element.is_FreeModuleElement(vector([1,2,3])) - True - """ - from sage.misc.superseded import deprecation_cython - deprecation_cython(38184, - "The function is_FreeModuleElement is deprecated; " - "use 'isinstance(..., FreeModuleElement)' instead.") - return isinstance(x, FreeModuleElement) - - def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False): r""" Return a vector or free module element with specified entries. diff --git a/src/sage/monoids/free_abelian_monoid_element.pyx b/src/sage/monoids/free_abelian_monoid_element.pyx index 1cd087584cf..45e5430966d 100644 --- a/src/sage/monoids/free_abelian_monoid_element.pyx +++ b/src/sage/monoids/free_abelian_monoid_element.pyx @@ -41,26 +41,6 @@ from sage.rings.integer cimport Integer, _Integer_from_mpz from sage.libs.gmp.mpz cimport * -def is_FreeAbelianMonoidElement(x): - r""" - Queries whether ``x`` is an object of type ``FreeAbelianMonoidElement``. - - INPUT: - - - ``x`` -- an object - - OUTPUT: - - - ``True`` if ``x`` is an object of type ``FreeAbelianMonoidElement``; - ``False`` otherwise. - """ - from sage.misc.superseded import deprecation_cython - deprecation_cython(38184, - "The function is_FreeAbelianMonoidElement is deprecated; " - "use 'isinstance(..., FreeAbelianMonoidElement)' instead.") - return isinstance(x, FreeAbelianMonoidElement) - - cdef class FreeAbelianMonoidElement(MonoidElement): cdef int _init(self, Py_ssize_t n, Parent parent) except -1: """ diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index 96d1c878fca..0cc049ca037 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -109,74 +109,6 @@ from sage.structure.element cimport ModuleElement, Element from sage.misc.cachefunc import cached_function from sage.misc.superseded import deprecated_function_alias -#***************************************************************************** -# -# Utility functions to test that something is a linear function / constraint -# -#***************************************************************************** - -cpdef is_LinearFunction(x): - """ - Test whether ``x`` is a linear function. - - INPUT: - - - ``x`` -- anything - - OUTPUT: boolean - - EXAMPLES:: - - sage: p = MixedIntegerLinearProgram() - sage: x = p.new_variable() - sage: from sage.numerical.linear_functions import is_LinearFunction - sage: is_LinearFunction(x[0] - 2*x[2]) - doctest:warning... - DeprecationWarning: The function is_LinearFunction is deprecated; - use 'isinstance(..., LinearFunction)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - True - sage: is_LinearFunction('a string') - False - """ - from sage.misc.superseded import deprecation_cython - deprecation_cython(38184, - "The function is_LinearFunction is deprecated; " - "use 'isinstance(..., LinearFunction)' instead.") - return isinstance(x, LinearFunction) - - -def is_LinearConstraint(x): - """ - Test whether ``x`` is a linear constraint. - - INPUT: - - - ``x`` -- anything - - OUTPUT: boolean - - EXAMPLES:: - - sage: p = MixedIntegerLinearProgram() - sage: x = p.new_variable() - sage: ieq = (x[0] <= x[1]) - sage: from sage.numerical.linear_functions import is_LinearConstraint - sage: is_LinearConstraint(ieq) - doctest:warning... - DeprecationWarning: The function is_LinearConstraint is deprecated; - use 'isinstance(..., LinearConstraint)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - True - sage: is_LinearConstraint('a string') - False - """ - from sage.misc.superseded import deprecation_cython - deprecation_cython(38184, - "The function is_LinearConstraint is deprecated; " - "use 'isinstance(..., LinearConstraint)' instead.") - return isinstance(x, LinearConstraint) - # **************************************************************************** # diff --git a/src/sage/numerical/linear_tensor.py b/src/sage/numerical/linear_tensor.py index 1ad4f4dafb7..b460171998d 100644 --- a/src/sage/numerical/linear_tensor.py +++ b/src/sage/numerical/linear_tensor.py @@ -102,50 +102,11 @@ from sage.numerical.linear_functions import LinearFunction, LinearFunctionsParent_class from sage.numerical.linear_tensor_element import LinearTensor - -#***************************************************************************** -# -# Utility functions to test that something is a linear function / constraint -# -#***************************************************************************** - -def is_LinearTensor(x): - """ - Test whether ``x`` is a tensor product of linear functions with a - free module. - - INPUT: - - - ``x`` -- anything - - OUTPUT: boolean - - EXAMPLES:: - - sage: p = MixedIntegerLinearProgram() - sage: x = p.new_variable(nonnegative=False) - sage: from sage.numerical.linear_tensor import is_LinearTensor - sage: is_LinearTensor(x[0] - 2*x[2]) - doctest:warning... - DeprecationWarning: The function is_LinearTensor is deprecated; - use 'isinstance(..., LinearTensor)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - False - sage: is_LinearTensor('a string') - False - """ - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_LinearTensor is deprecated; " - "use 'isinstance(..., LinearTensor)' instead.") - return isinstance(x, LinearTensor) - - -#***************************************************************************** +# *************************************************************************** # # Factory functions for the parents to ensure uniqueness # -#***************************************************************************** +# *************************************************************************** @cached_function def LinearTensorParent(free_module_parent, linear_functions_parent): diff --git a/src/sage/numerical/linear_tensor_constraints.py b/src/sage/numerical/linear_tensor_constraints.py index 68aa1178d00..c53b97b9453 100644 --- a/src/sage/numerical/linear_tensor_constraints.py +++ b/src/sage/numerical/linear_tensor_constraints.py @@ -33,48 +33,11 @@ from sage.misc.cachefunc import cached_function -#***************************************************************************** -# -# Utility functions to test that something is a linear function / constraint -# -#***************************************************************************** - -def is_LinearTensorConstraint(x): - """ - Test whether ``x`` is a constraint on module-valued linear functions. - - INPUT: - - - ``x`` -- anything - - OUTPUT: boolean - - EXAMPLES:: - - sage: mip. = MixedIntegerLinearProgram() - sage: vector_ieq = (x[0] * vector([1,2]) <= x[1] * vector([2,3])) - sage: from sage.numerical.linear_tensor_constraints import is_LinearTensorConstraint - sage: is_LinearTensorConstraint(vector_ieq) - doctest:warning... - DeprecationWarning: The function is_LinearTensorConstraint is deprecated; - use 'isinstance(..., LinearTensorConstraint)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - True - sage: is_LinearTensorConstraint('a string') - False - """ - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_LinearTensorConstraint is deprecated; " - "use 'isinstance(..., LinearTensorConstraint)' instead.") - return isinstance(x, LinearTensorConstraint) - - -#***************************************************************************** +# *************************************************************************** # # Factory functions for the parents to ensure uniqueness # -#***************************************************************************** +# *************************************************************************** @cached_function def LinearTensorConstraintsParent(linear_functions_parent): diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py index 199fa6864cc..e4469317730 100644 --- a/src/sage/plot/graphics.py +++ b/src/sage/plot/graphics.py @@ -53,29 +53,6 @@ do_verify = True -def is_Graphics(x): - """ - Return ``True`` if `x` is a Graphics object. - - EXAMPLES:: - - sage: from sage.plot.graphics import is_Graphics - sage: is_Graphics(1) - doctest:warning... - DeprecationWarning: The function is_Graphics is deprecated; - use 'isinstance(..., Graphics)' instead. - See https://github.com/sagemath/sage/issues/38184 for details. - False - sage: is_Graphics(disk((0.0, 0.0), 1, (0, pi/2))) # needs sage.symbolic - True - """ - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_Graphics is deprecated; " - "use 'isinstance(..., Graphics)' instead.") - return isinstance(x, Graphics) - - def _parse_figsize(figsize): r""" Helper function to get a figure size in matplotlib format. diff --git a/src/sage/probability/random_variable.py b/src/sage/probability/random_variable.py index ce66f36bdb3..b5ee8cf647d 100644 --- a/src/sage/probability/random_variable.py +++ b/src/sage/probability/random_variable.py @@ -23,43 +23,6 @@ from sage.sets.set import Set from pprint import pformat -################################################################################ -################################################################################ - - -def is_ProbabilitySpace(S): - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_ProbabilitySpace is deprecated; " - "use 'isinstance(..., ProbabilitySpace_generic)' instead.") - return isinstance(S, ProbabilitySpace_generic) - - -def is_DiscreteProbabilitySpace(S): - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_DiscreteProbabilitySpace is deprecated; " - "use 'isinstance(..., DiscreteProbabilitySpace)' instead.") - return isinstance(S, DiscreteProbabilitySpace) - - -def is_RandomVariable(X): - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_RandomVariable is deprecated; " - "use 'isinstance(..., RandomVariable_generic)' instead.") - return isinstance(X, RandomVariable_generic) - - -def is_DiscreteRandomVariable(X): - from sage.misc.superseded import deprecation - deprecation(38184, - "The function is_DiscreteRandomVariable is deprecated; " - "use 'isinstance(..., DiscreteRandomVariable)' instead.") - return isinstance(X, DiscreteRandomVariable) - -################################################################################ -################################################################################ # We could inherit from a functions class here but use Parent From 2bc676963ac4d6485a90d4ca38b6cf426eba9e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 28 Jan 2026 08:03:02 +0100 Subject: [PATCH 2/2] fix one pxd file --- src/sage/numerical/linear_functions.pxd | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sage/numerical/linear_functions.pxd b/src/sage/numerical/linear_functions.pxd index 8b2bf1318f0..69e735466c1 100644 --- a/src/sage/numerical/linear_functions.pxd +++ b/src/sage/numerical/linear_functions.pxd @@ -1,8 +1,6 @@ from sage.structure.parent cimport Parent, Parent_richcmp_element_without_coercion from sage.structure.element cimport ModuleElement, RingElement, Element -cpdef is_LinearFunction(x) - cdef class LinearFunctionOrConstraint(ModuleElement): pass