You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-40660: remove a deprecated class in structure
as deprecated in #26879
### 📝 Checklist
- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
URL: #40660
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
@@ -49,26 +49,7 @@ cdef class DefaultConvertMap(Map):
49
49
False
50
50
sage: QQ[['x']].coerce_map_from(QQ)._is_coercion
51
51
True
52
-
53
-
This class is deprecated when used directly::
54
-
55
-
sage: from sage.structure.coerce_maps import DefaultConvertMap
56
-
sage: DefaultConvertMap(ZZ, ZZ)
57
-
doctest:...: DeprecationWarning: DefaultConvertMap is deprecated, use DefaultConvertMap_unique instead.
58
-
This probably means that _element_constructor_ should be a method and not some other kind of callable
59
-
See https://github.com/sagemath/sage/issues/26879 for details.
60
-
Conversion map:
61
-
From: Integer Ring
62
-
To: Integer Ring
63
52
"""
64
-
# The base class DefaultConvertMap is deprecated, only the
65
-
# derived class DefaultConvertMap_unique should be used.
66
-
# When removing this deprecation, this class should be merged
67
-
# into DefaultConvertMap_unique.
68
-
ifnotisinstance(self, DefaultConvertMap_unique):
69
-
from sage.misc.superseded import deprecation_cython as deprecation
70
-
deprecation(26879, "DefaultConvertMap is deprecated, use DefaultConvertMap_unique instead. This probably means that _element_constructor_ should be a method and not some other kind of callable")
71
-
72
53
if not isinstance(domain, Parent):
73
54
domain = Set_PythonType(domain)
74
55
if category is None:
@@ -78,9 +59,9 @@ cdef class DefaultConvertMap(Map):
78
59
Map.__init__(self, parent)
79
60
self._coerce_cost = 100
80
61
if (<Parent>codomain)._element_constructor is None:
81
-
raiseRuntimeError("BUG in coercion model, no element constructor for {}".format(type(codomain)))
62
+
raise RuntimeError(f"BUG in coercion model, no element constructor for {type(codomain)}")
82
63
83
-
def_repr_type(self):
64
+
def _repr_type(self) -> str:
84
65
r"""
85
66
Return a printable typefor this morphism.
86
67
@@ -104,7 +85,7 @@ cdef class DefaultConvertMap(Map):
104
85
"""
105
86
cdef Parent C = self._codomain
106
87
try:
107
-
return C._element_constructor(C, x)
88
+
return C._element_constructor(x)
108
89
except Exception:
109
90
if print_warnings:
110
91
print(type(C), C)
@@ -121,49 +102,6 @@ cdef class DefaultConvertMap(Map):
121
102
sage: f(2/3, 4)
122
103
2/3+ O(x^4)
123
104
"""
124
-
cdef Parent C =self._codomain
125
-
try:
126
-
iflen(args) ==0:
127
-
iflen(kwds) ==0:
128
-
# This line is apparently never used in any tests (hivert, 2009-04-28)
0 commit comments