Skip to content

Commit beac80e

Browse files
author
Matthias Koeppe
committed
src/sage/rings/morphism.pyx: Remove class and function deprecated in #23204 (2017)
1 parent bdedb4b commit beac80e

File tree

1 file changed

+0
-137
lines changed

1 file changed

+0
-137
lines changed

src/sage/rings/morphism.pyx

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -413,29 +413,6 @@ from sage.structure.richcmp cimport (richcmp, rich_to_bool)
413413
from sage.misc.cachefunc import cached_method
414414

415415

416-
def is_RingHomomorphism(phi):
417-
"""
418-
Return ``True`` if ``phi`` is of type :class:`RingHomomorphism`.
419-
420-
EXAMPLES::
421-
422-
sage: f = Zmod(8).cover()
423-
sage: sage.rings.morphism.is_RingHomomorphism(f)
424-
doctest:warning
425-
...
426-
DeprecationWarning: is_RingHomomorphism() should not be used anymore. Check whether the category_for() your morphism is a subcategory of Rings() instead.
427-
See https://github.com/sagemath/sage/issues/23204 for details.
428-
True
429-
sage: sage.rings.morphism.is_RingHomomorphism(2/3)
430-
False
431-
"""
432-
sage.misc.superseded.deprecation(23204, "is_RingHomomorphism() should not be used anymore. Check whether the category_for() your morphism is a subcategory of Rings() instead.")
433-
# We use the category framework to determine whether something is a ring homomorphism.
434-
from sage.categories.map import Map
435-
from sage.categories.rings import Rings
436-
return isinstance(phi, Map) and phi.category_for().is_subcategory(Rings())
437-
438-
439416
cdef class RingMap(Morphism):
440417
"""
441418
Set-theoretic map between rings.
@@ -1682,120 +1659,6 @@ cdef class RingHomomorphism(RingMap):
16821659
return self.is_injective() and self.is_surjective()
16831660

16841661

1685-
cdef class RingHomomorphism_coercion(RingHomomorphism):
1686-
r"""
1687-
A ring homomorphism that is a coercion.
1688-
1689-
.. WARNING::
1690-
1691-
This class is obsolete. Set the category of your morphism to a
1692-
subcategory of ``Rings`` instead.
1693-
1694-
TESTS:
1695-
1696-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1697-
sage: parent = Hom(ZZ,ZZ)
1698-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1699-
doctest:warning
1700-
...
1701-
DeprecationWarning: Set the category of your morphism to a subcategory of Rings instead.
1702-
See https://github.com/sagemath/sage/issues/23204 for details.
1703-
sage: TestSuite(f).run()
1704-
1705-
"""
1706-
def __init__(self, parent, check=True):
1707-
r"""
1708-
TESTS:
1709-
1710-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1711-
sage: parent = Hom(ZZ,ZZ)
1712-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1713-
doctest:warning
1714-
...
1715-
DeprecationWarning: Set the category of your morphism to a subcategory of Rings instead.
1716-
See https://github.com/sagemath/sage/issues/23204 for details.
1717-
sage: isinstance(f, RingHomomorphism_coercion)
1718-
True
1719-
1720-
"""
1721-
sage.misc.superseded.deprecation(23204, "Set the category of your morphism to a subcategory of Rings instead.")
1722-
1723-
RingHomomorphism.__init__(self, parent)
1724-
# putting in check allows us to define subclasses of RingHomomorphism_coercion that implement _coerce_map_from
1725-
if check and not self.codomain().has_coerce_map_from(self.domain()):
1726-
raise TypeError("Natural coercion morphism from %s to %s not defined."%(self.domain(), self.codomain()))
1727-
1728-
def _repr_type(self):
1729-
"""
1730-
Used internally when printing this.
1731-
1732-
EXAMPLES::
1733-
1734-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1735-
sage: parent = Hom(ZZ,ZZ)
1736-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1737-
sage: f._repr_type()
1738-
'Ring Coercion'
1739-
1740-
"""
1741-
return "Ring Coercion"
1742-
1743-
cpdef _richcmp_(self, other, int op):
1744-
"""
1745-
Compare a ring coercion morphism ``self`` to ``other``.
1746-
1747-
Ring coercion morphisms never compare equal to any other data type. If
1748-
other is a ring coercion morphism, the parents of ``self`` and
1749-
``other`` are compared.
1750-
1751-
EXAMPLES::
1752-
1753-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1754-
sage: parent = Hom(ZZ,ZZ)
1755-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1756-
sage: f == f
1757-
True
1758-
sage: f != f
1759-
False
1760-
"""
1761-
if not isinstance(other, RingHomomorphism_coercion):
1762-
# Generic comparison
1763-
return RingMap._richcmp_(self, other, op)
1764-
# Two coercion maps with the same parent must be equal
1765-
return rich_to_bool(op, 0)
1766-
1767-
def __hash__(self):
1768-
"""
1769-
Return the hash of this morphism.
1770-
1771-
TESTS::
1772-
1773-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1774-
sage: parent = Hom(ZZ,ZZ)
1775-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1776-
sage: g = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1777-
sage: hash(f) == hash(g)
1778-
True
1779-
1780-
"""
1781-
return hash((self.domain(), self.codomain()))
1782-
1783-
cpdef Element _call_(self, x):
1784-
"""
1785-
Evaluate this coercion morphism at ``x``.
1786-
1787-
EXAMPLES::
1788-
1789-
sage: from sage.rings.morphism import RingHomomorphism_coercion
1790-
sage: parent = Hom(ZZ,ZZ)
1791-
sage: f = parent.__make_element_class__(RingHomomorphism_coercion)(parent)
1792-
sage: f(0)
1793-
0
1794-
1795-
"""
1796-
return self.codomain().coerce(x)
1797-
1798-
17991662
cdef class RingHomomorphism_im_gens(RingHomomorphism):
18001663
"""
18011664
A ring homomorphism determined by the images of generators.

0 commit comments

Comments
 (0)