diff --git a/src/sage/topology/simplicial_complex_homset.py b/src/sage/topology/simplicial_complex_homset.py index 7b9aceb8b64..40b17a3c524 100644 --- a/src/sage/topology/simplicial_complex_homset.py +++ b/src/sage/topology/simplicial_complex_homset.py @@ -61,32 +61,6 @@ from .simplicial_complex_morphism import SimplicialComplexMorphism -def is_SimplicialComplexHomset(x) -> bool: - """ - Return ``True`` if and only if ``x`` is a simplicial complex homspace. - - EXAMPLES:: - - sage: S = SimplicialComplex(is_mutable=False) - sage: T = SimplicialComplex(is_mutable=False) - sage: H = Hom(S, T) - sage: H - Set of Morphisms from Simplicial complex with vertex set () and facets {()} - to Simplicial complex with vertex set () and facets {()} - in Category of finite simplicial complexes - sage: from sage.topology.simplicial_complex_homset import is_SimplicialComplexHomset - sage: is_SimplicialComplexHomset(H) - doctest:warning... - DeprecationWarning: the function is_SimplicialComplexHomset is deprecated; - use 'isinstance(..., SimplicialComplexHomset)' instead - See https://github.com/sagemath/sage/issues/37922 for details. - True - """ - from sage.misc.superseded import deprecation - deprecation(37922, "the function is_SimplicialComplexHomset is deprecated; use 'isinstance(..., SimplicialComplexHomset)' instead") - return isinstance(x, SimplicialComplexHomset) - - class SimplicialComplexHomset(sage.categories.homset.Homset): def __call__(self, f): """ diff --git a/src/sage/topology/simplicial_complex_morphism.py b/src/sage/topology/simplicial_complex_morphism.py index 044f794769b..cbaa6e167a4 100644 --- a/src/sage/topology/simplicial_complex_morphism.py +++ b/src/sage/topology/simplicial_complex_morphism.py @@ -114,36 +114,11 @@ lazy_import('sage.matrix.constructor', ['matrix', 'zero_matrix']) -def is_SimplicialComplexMorphism(x): - """ - Return ``True`` if and only if ``x`` is a morphism of simplicial complexes. - - EXAMPLES:: - - sage: from sage.topology.simplicial_complex_morphism import is_SimplicialComplexMorphism - sage: S = SimplicialComplex([[0,1],[3,4]], is_mutable=False) - sage: H = Hom(S,S) - sage: f = {0:0,1:1,3:3,4:4} - sage: x = H(f) - sage: is_SimplicialComplexMorphism(x) - doctest:warning... - DeprecationWarning: The function is_SimplicialComplexMorphism is deprecated; - use 'isinstance(..., SimplicialComplexMorphism)' instead. - See https://github.com/sagemath/sage/issues/38103 for details. - True - """ - from sage.misc.superseded import deprecation - deprecation(38103, - "The function is_SimplicialComplexMorphism is deprecated; " - "use 'isinstance(..., SimplicialComplexMorphism)' instead.") - return isinstance(x, SimplicialComplexMorphism) - - class SimplicialComplexMorphism(Morphism): """ An element of this class is a morphism of simplicial complexes. """ - def __init__(self, f, X, Y): + def __init__(self, f, X, Y) -> None: """ Input is a dictionary ``f``, the domain ``X``, and the codomain ``Y``. @@ -181,7 +156,7 @@ def __init__(self, f, X, Y): self._vertex_dictionary = f Morphism.__init__(self, Hom(X, Y, SimplicialComplexes())) - def __eq__(self, x): + def __eq__(self, x) -> bool: """ Return ``True`` if and only if ``self == x``. @@ -291,7 +266,7 @@ def __call__(self, x, orientation=False): else: return Simplex(set(fx)) - def _repr_type(self): + def _repr_type(self) -> str: """ EXAMPLES:: @@ -304,7 +279,7 @@ def _repr_type(self): """ return "Simplicial complex" - def _repr_defn(self): + def _repr_defn(self) -> str: """ If there are fewer than 5 vertices, print the image of each vertex on a separate line. Otherwise, print the map as a single line. @@ -502,7 +477,7 @@ def image(self): fa = [self(i) for i in self.domain().facets()] return SimplicialComplex(fa, maximality_check=True) - def is_surjective(self): + def is_surjective(self) -> bool: """ Return ``True`` if and only if ``self`` is surjective. @@ -529,7 +504,7 @@ def is_surjective(self): """ return self.codomain() == self.image() - def is_injective(self): + def is_injective(self) -> bool: """ Return ``True`` if and only if ``self`` is injective. @@ -550,7 +525,7 @@ def is_injective(self): True """ v = [self._vertex_dictionary[i[0]] for i in self.domain().faces()[0]] - return all(v.count(i) <= 1 for i in v) + return len(v) == len(set(v)) def is_identity(self) -> bool: """