diff --git a/src/sage/structure/element.pxd b/src/sage/structure/element.pxd index cc1bf225710..934427c8564 100644 --- a/src/sage/structure/element.pxd +++ b/src/sage/structure/element.pxd @@ -151,7 +151,6 @@ cdef bin_op_exception(op, x, y) cdef class Element(SageObject): cdef Parent _parent cpdef _richcmp_(left, right, int op) - cpdef int _cmp_(left, right) except -2 cpdef base_extend(self, R) cdef getattr_from_category(self, name) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 3b386c31d6f..eec32c260af 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -1159,13 +1159,6 @@ cdef class Element(SageObject): return True return NotImplemented - cpdef int _cmp_(left, right) except -2: - """ - This was the old comparison framework. Now deprecated. Do not use. - """ - deprecation(30130, "please use _richcmp_ for comparison methods") - raise NotImplementedError("__cmp__ and _cmp_ are deprecated") - ################################################## # Arithmetic using the coercion model ################################################## diff --git a/src/sage/structure/global_options.py b/src/sage/structure/global_options.py index d27bda16658..5e3a58a5bc4 100644 --- a/src/sage/structure/global_options.py +++ b/src/sage/structure/global_options.py @@ -632,7 +632,7 @@ def __bool__(self) -> bool: """ return bool(self._options[self._name]) - def __call__(self, *args, **kwds): + def __call__(self, *args): r""" Get or set value of the option ``self``. @@ -662,38 +662,20 @@ def __call__(self, *args, **kwds): True sage: config._reset() - Check the deprecation:: + Check the input:: - sage: config.size(value=None) - doctest:...: DeprecationWarning: keyword argument "value" should be replaced by positional argument - See https://github.com/sagemath/sage/issues/30763 for details. - sage: config.size() is None - True sage: config.size(1, 2) Traceback (most recent call last): ... - TypeError: option takes at most one argument "value" - sage: config.size(unknown=3) - Traceback (most recent call last): - ... - TypeError: option takes at most one argument "value" - sage: config.size(4, value=5) - Traceback (most recent call last): - ... - TypeError: option takes at most one argument "value" + TypeError: option takes at most one argument """ - if not args and not kwds: + if not args: return self._options[self._name] - if 'value' in kwds: - from sage.misc.superseded import deprecation - deprecation(30763, 'keyword argument "value" should be replaced ' - 'by positional argument') - args += (kwds.pop('value'),) - if len(args) > 1 or kwds: - raise TypeError('option takes at most one argument "value"') + if len(args) > 1: + raise TypeError('option takes at most one argument') self._options[self._name] = args[0] - def __eq__(self, other): + def __eq__(self, other) -> bool: r""" Equality testing for an option in based on the value of the attribute. @@ -708,7 +690,7 @@ def __eq__(self, other): """ return self._options[self._name] == other - def __ne__(self, other): + def __ne__(self, other) -> bool: r""" Inequality testing for an option in based on the value of the attribute. @@ -724,7 +706,7 @@ def __ne__(self, other): """ return self._options[self._name] != other - def __hash__(self): + def __hash__(self) -> int: r""" Return the hash of ``self``, which is the hash of the corresponding value. @@ -736,7 +718,7 @@ def __hash__(self): """ return hash(self._options[self._name]) - def __str__(self): + def __str__(self) -> str: r""" Return the string representation of ``self``, which is the string of the corresponding value. diff --git a/src/sage/structure/support_view.py b/src/sage/structure/support_view.py index 5daf8c2e496..b7b7bd47306 100644 --- a/src/sage/structure/support_view.py +++ b/src/sage/structure/support_view.py @@ -2,11 +2,8 @@ r""" Iterable of the keys of a Mapping associated with nonzero values """ - from collections.abc import MappingView, Sequence, Set -from sage.misc.superseded import deprecation - class SupportView(MappingView, Sequence, Set): r""" @@ -49,7 +46,7 @@ class SupportView(MappingView, Sequence, Set): 3 """ - def __init__(self, mapping, *, zero=None): + def __init__(self, mapping, *, zero=None) -> None: r""" TESTS:: @@ -61,7 +58,7 @@ def __init__(self, mapping, *, zero=None): self._mapping = mapping self._zero = zero - def __len__(self): + def __len__(self) -> int: r""" TESTS:: @@ -120,7 +117,7 @@ def __iter__(self): if value != zero: yield key - def __contains__(self, key): + def __contains__(self, key) -> bool: r""" TESTS:: @@ -149,14 +146,8 @@ def __eq__(self, other): sage: supp = SupportView(d); supp SupportView({1: 17, 2: 0}) sage: supp == [1] - doctest:warning... - DeprecationWarning: comparing a SupportView with a list is deprecated - See https://github.com/sagemath/sage/issues/34509 for details. - True + False """ - if isinstance(other, list): - deprecation(34509, 'comparing a SupportView with a list is deprecated') - return list(self) == other return NotImplemented def __ne__(self, other): @@ -168,12 +159,6 @@ def __ne__(self, other): sage: supp = SupportView(d); supp SupportView({1: 17, 2: 0}) sage: supp != [1] - doctest:warning... - DeprecationWarning: comparing a SupportView with a list is deprecated - See https://github.com/sagemath/sage/issues/34509 for details. - False + True """ - if isinstance(other, list): - deprecation(34509, 'comparing a SupportView with a list is deprecated') - return list(self) != other return NotImplemented