From 246e679fbdfff832fd3f87a0655d9abcb105d7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 7 Nov 2025 20:28:49 +0100 Subject: [PATCH] add some typing in modular,modules,plot,schemes,symbolic,topology --- src/sage/modular/abvar/finite_subgroup.py | 9 +++--- .../modular/arithgroup/arithgroup_generic.py | 4 +-- src/sage/modular/arithgroup/farey_symbol.pyx | 6 ++-- src/sage/modules/fg_pid/fgp_module.py | 20 ++++++------- .../modules/with_basis/indexed_element.pyx | 6 ++-- src/sage/plot/colors.py | 28 +++++++++---------- .../schemes/elliptic_curves/ell_generic.py | 8 +++--- src/sage/schemes/elliptic_curves/height.py | 12 ++++---- .../schemes/elliptic_curves/isogeny_class.py | 17 +++++------ .../elliptic_curves/period_lattice_region.pyx | 6 ++-- src/sage/topology/simplicial_complex.py | 24 ++++++++-------- src/sage/topology/simplicial_set.py | 28 +++++++++---------- 12 files changed, 85 insertions(+), 83 deletions(-) diff --git a/src/sage/modular/abvar/finite_subgroup.py b/src/sage/modular/abvar/finite_subgroup.py index dda6f39e397..70e4247b0bf 100644 --- a/src/sage/modular/abvar/finite_subgroup.py +++ b/src/sage/modular/abvar/finite_subgroup.py @@ -143,7 +143,7 @@ class FiniteSubgroup(Module): Element = TorsionPoint - def __init__(self, abvar, field_of_definition=QQ): + def __init__(self, abvar, field_of_definition=QQ) -> None: """ Initialize ``self``. @@ -215,7 +215,7 @@ def _relative_basis_matrix(self): return M # General functionality - def __richcmp__(self, other, op): + def __richcmp__(self, other, op) -> bool: """ Compare ``self`` to ``other``. @@ -693,7 +693,7 @@ def _element_constructor_(self, x, check=True): x = self.lattice()(x, check=check) return self.element_class(self, x, check=False) - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return ``True`` if ``x`` is contained in this finite subgroup. @@ -837,7 +837,8 @@ def invariants(self): class FiniteSubgroup_lattice(FiniteSubgroup): - def __init__(self, abvar, lattice, field_of_definition=None, check=True): + def __init__(self, abvar, lattice, + field_of_definition=None, check=True) -> None: """ A finite subgroup of a modular abelian variety that is defined by a given lattice. diff --git a/src/sage/modular/arithgroup/arithgroup_generic.py b/src/sage/modular/arithgroup/arithgroup_generic.py index 687d668e94a..649a410b6d1 100644 --- a/src/sage/modular/arithgroup/arithgroup_generic.py +++ b/src/sage/modular/arithgroup/arithgroup_generic.py @@ -145,7 +145,7 @@ def _element_constructor_(self, x, check=True): return x raise TypeError("matrix %s is not an element of %s" % (x, self)) - def __contains__(self, x): + def __contains__(self, x) -> bool: r""" Test if x is an element of this group. @@ -200,7 +200,7 @@ def _contains_sl2(self, a, b, c, d): """ raise NotImplementedError("Please implement _contains_sl2 for %s" % self.__class__) - def __hash__(self): + def __hash__(self) -> int: r""" Return a hash of ``self``. diff --git a/src/sage/modular/arithgroup/farey_symbol.pyx b/src/sage/modular/arithgroup/farey_symbol.pyx index 2866b9de6e8..0107b9b2005 100644 --- a/src/sage/modular/arithgroup/farey_symbol.pyx +++ b/src/sage/modular/arithgroup/farey_symbol.pyx @@ -511,7 +511,7 @@ cdef class Farey: else: # output == 'gens' return tuple((gens[a-1], len(list(g))) if a > 0 else (gens[-a-1], -len(list(g))) for a, g in groupby(tietze)) - def __contains__(self, M): + def __contains__(self, M) -> bool: r""" Test if element is in the arithmetic group of the Farey symbol via LLT algorithm. @@ -533,7 +533,7 @@ cdef class Farey: sig_off() return result - def __richcmp__(self, other, op): + def __richcmp__(self, other, op) -> bool: r""" Compare ``self`` to ``other``. @@ -569,7 +569,7 @@ cdef class Farey: """ return Farey, (self.group, self.this_ptr.dumps()) - def __repr__(self): + def __repr__(self) -> str: r""" Return the string representation of ``self``. diff --git a/src/sage/modules/fg_pid/fgp_module.py b/src/sage/modules/fg_pid/fgp_module.py index 105a0808b5d..59cf2c36d97 100644 --- a/src/sage/modules/fg_pid/fgp_module.py +++ b/src/sage/modules/fg_pid/fgp_module.py @@ -336,7 +336,7 @@ class FGP_Module_class(Module): # module. Should be overridden in derived classes. Element = FGP_Element - def __init__(self, V, W, check=True): + def __init__(self, V, W, check=True) -> None: """ INPUT: @@ -470,7 +470,7 @@ def _mul_(self, other, switch_sides=False): raise ValueError("Scalar multiplication of a module is only " + "defined for an element of the base ring.") - def _repr_(self): + def _repr_(self) -> str: """ Return string representation of this module. @@ -507,9 +507,9 @@ def __truediv__(self, other): raise TypeError("other must be an FGP module") if not other.is_submodule(self): raise ValueError("other must be a submodule of self") - return self._module_constructor(self._V, other._V+self._W) + return self._module_constructor(self._V, other._V + self._W) - def __eq__(self, other): + def __eq__(self, other) -> bool: """ EXAMPLES:: @@ -529,7 +529,7 @@ def __eq__(self, other): return False return self._V == other._V and self._W == other._W - def __ne__(self, other): + def __ne__(self, other) -> bool: """ Return ``True`` iff ``self`` is not equal to ``other``. @@ -569,7 +569,7 @@ def __ne__(self, other): # __le__ is a synonym for `is_submodule`: see below - def __lt__(self, other): + def __lt__(self, other) -> bool: """ Return ``True`` iff ``self`` is a proper submodule of ``other``. @@ -587,7 +587,7 @@ def __lt__(self, other): """ return self <= other and not self == other - def __gt__(self, other): + def __gt__(self, other) -> bool: """ Return ``True`` iff ``other`` is a proper submodule of ``self``. @@ -605,7 +605,7 @@ def __gt__(self, other): """ return self >= other and not self == other - def __ge__(self, other): + def __ge__(self, other) -> bool: """ Return ``True`` iff ``other`` is a submodule of ``self``. @@ -675,7 +675,7 @@ def linear_combination_of_smith_form_gens(self, x): raise TypeError(msg) return self.element_class(self, self._V(x)) - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return true if ``x`` is contained in ``self``. @@ -1940,7 +1940,7 @@ def ngens(self): """ return len(self.gens()) - def __hash__(self): + def __hash__(self) -> int: r""" Calculate a hash for ``self``. diff --git a/src/sage/modules/with_basis/indexed_element.pyx b/src/sage/modules/with_basis/indexed_element.pyx index ff2579c583c..88656cd1a58 100644 --- a/src/sage/modules/with_basis/indexed_element.pyx +++ b/src/sage/modules/with_basis/indexed_element.pyx @@ -47,7 +47,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): sage: isinstance(f, collections.abc.Collection) # known bug - will be fixed by removing __contains__ False """ - def __init__(self, M, x): + def __init__(self, M, x) -> None: """ Create a combinatorial module element. @@ -84,7 +84,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): """ return iter(self._monomial_coefficients.items()) - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return whether or not a combinatorial object ``x`` indexing a basis element is in the support of ``self``. @@ -113,7 +113,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): deprecation(34509, "using 'index in vector' is deprecated; use 'index in vector.support()' instead") return x in self.support() - def __hash__(self): + def __hash__(self) -> int: """ Return the hash value for ``self``. diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py index bbb192c937b..4d7d5da146e 100644 --- a/src/sage/plot/colors.py +++ b/src/sage/plot/colors.py @@ -353,7 +353,7 @@ def rgbcolor(c, space='rgb'): class Color: - def __init__(self, r='#0000ff', g=None, b=None, space='rgb'): + def __init__(self, r='#0000ff', g=None, b=None, space='rgb') -> None: """ A Red-Green-Blue (RGB) color model color object. For most consumer-grade devices (e.g., CRTs, LCDs, and printers), as @@ -400,7 +400,7 @@ def __init__(self, r='#0000ff', g=None, b=None, space='rgb'): else: self._rgb = rgbcolor((r, g, b), space=space) - def __repr__(self): + def __repr__(self) -> str: """ Return a string representation of this color. @@ -415,7 +415,7 @@ def __repr__(self): """ return f"RGB color {self._rgb}" - def __lt__(self, right): + def __lt__(self, right) -> bool: """ Check whether a :class:`Color` object is less than some other object. This doesn't make sense, and so we conclude that it is @@ -438,7 +438,7 @@ def __lt__(self, right): """ return False - def __le__(self, right): + def __le__(self, right) -> bool: """ Check whether a :class:`Color` object is less than or equal to some other object. It wouldn't make sense for it to be less than @@ -462,7 +462,7 @@ def __le__(self, right): """ return self == right - def __eq__(self, right): + def __eq__(self, right) -> bool: """ Compare two :class:`Color` objects to determine whether they refer to the same color. @@ -489,7 +489,7 @@ def __eq__(self, right): return self._rgb == right._rgb return False - def __ne__(self, right): + def __ne__(self, right) -> bool: """ Compare two :class:`Color` objects to determine whether they refer to different colors. @@ -516,7 +516,7 @@ def __ne__(self, right): """ return not (self == right) - def __gt__(self, right): + def __gt__(self, right) -> bool: """ Check whether a :class:`Color` object is greater than some other object. This doesn't make sense, and so we conclude that it is @@ -539,7 +539,7 @@ def __gt__(self, right): """ return False - def __ge__(self, right): + def __ge__(self, right) -> bool: """ Check whether a :class:`Color` object is greater than or equal to some other object. It wouldn't make sense for it to be @@ -563,7 +563,7 @@ def __ge__(self, right): """ return self == right - def __hash__(self): + def __hash__(self) -> int: """ Return the hash value of a color. Equal colors return equal hash values. @@ -1004,7 +1004,7 @@ class ColorsDict(dict): sage: sorted(colors) ['aliceblue', 'antiquewhite', 'aqua', 'aquamarine', ...] """ - def __init__(self): + def __init__(self) -> None: """ Construct a dict-like collection of colors. The keys are the color names (i.e., strings) and the values are RGB 3-tuples of @@ -1364,7 +1364,7 @@ class Colormaps(MutableMapping): sage: sorted(colormaps) ['Accent', ...] """ - def __init__(self): + def __init__(self) -> None: """ Construct an empty mutable collection of color maps. @@ -1418,7 +1418,7 @@ def __dir__(self): '__setitem__', '__delitem__'] return dir(super()) + methods + sorted(self) - def __len__(self): + def __len__(self) -> int: """ Return the number of color maps. @@ -1452,7 +1452,7 @@ def __iter__(self): self.load_maps() return iter(self.maps) - def __contains__(self, name): + def __contains__(self, name) -> bool: """ Return whether a map is in the color maps collection. @@ -1536,7 +1536,7 @@ def __getattr__(self, name): except KeyError: raise AttributeError("'{}' has no attribute or colormap {}".format(type(self).__name__, name)) - def __repr__(self): + def __repr__(self) -> str: """ Return a string representation of the color map collection. diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index ba825196a04..c7e329c24e1 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -124,7 +124,7 @@ class EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve): sage: -5*P (179051/80089 : -91814227/22665187 : 1) """ - def __init__(self, K, ainvs, category=None): + def __init__(self, K, ainvs, category=None) -> None: r""" Construct an elliptic curve from Weierstrass `a`-coefficients. @@ -465,7 +465,7 @@ def _symbolic_(self, SR): x, y = SR.var('x, y') return y**2 + a[0]*x*y + a[2]*y == x**3 + a[1]*x**2 + a[3]*x + a[4] - def __contains__(self, P): + def __contains__(self, P) -> bool: """ Return ``True`` if and only if P is a point on the elliptic curve. @@ -1049,7 +1049,7 @@ def __getitem__(self, n): """ raise NotImplementedError("not implemented.") - def __is_over_RationalField(self): + def __is_over_RationalField(self) -> bool: r""" Internal function. Return true iff the base ring of this elliptic curve is the field of rational numbers. @@ -1065,7 +1065,7 @@ def __is_over_RationalField(self): """ return isinstance(self.base_ring(), RationalField) - def is_on_curve(self, x, y): + def is_on_curve(self, x, y) -> bool: r""" Return ``True`` if `(x,y)` is an affine point on this curve. diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 2cb478eb23a..22409a15386 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -76,7 +76,7 @@ class UnionOfIntervals: Unify :class:`UnionOfIntervals` with the class ``RealSet`` introduced by :issue:`13125`; see :issue:`16063`. """ - def __init__(self, endpoints): + def __init__(self, endpoints) -> None: r""" An union of intervals is initialized by giving an increasing list of endpoints, the first of which may be `-\infty` and the last of @@ -419,7 +419,7 @@ def __and__(left, right): """ return left.intersection([left, right]) - def __contains__(self, x): + def __contains__(self, x) -> bool: r""" Return ``True`` if ``x`` is in the UnionOfIntervals. @@ -443,7 +443,7 @@ def __contains__(self, x): """ return x in self._endpoints or bisect.bisect_left(self._endpoints, x) % 2 == 1 - def __str__(self): + def __str__(self) -> str: r""" Return the string representation of this UnionOfIntervals. @@ -456,7 +456,7 @@ def __str__(self): """ return repr(self) - def __repr__(self): + def __repr__(self) -> str: r""" Return the string representation of this UnionOfIntervals. @@ -766,7 +766,7 @@ class EllipticCurveCanonicalHeight: Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field """ - def __init__(self, E): + def __init__(self, E) -> None: r""" Initialize the class with an elliptic curve. @@ -815,7 +815,7 @@ def __init__(self, E): else: raise ValueError("EllipticCurveCanonicalHeight class can only be created from an elliptic curve") - def __repr__(self): + def __repr__(self) -> str: r""" Return the string representation. diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index a630af24d07..28043f56b95 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -49,7 +49,7 @@ class in the isogeny class. Over `\QQ` this is a unique reduced model chosen may change in future. """ - def __init__(self, E, label=None, empty=False): + def __init__(self, E, label=None, empty=False) -> None: r""" Over `\QQ` we use curves since minimal models exist and there is a canonical choice of one. @@ -71,7 +71,7 @@ def __init__(self, E, label=None, empty=False): if not empty: self._compute() - def __len__(self): + def __len__(self) -> int: """ The number of curves in the class. @@ -135,9 +135,9 @@ def index(self, C): for i, E in enumerate(self.curves): if C.is_isomorphic(E): return i - raise ValueError("%s is not in isogeny class %s" % (C,self)) + raise ValueError("%s is not in isogeny class %s" % (C, self)) - def __richcmp__(self, other, op): + def __richcmp__(self, other, op) -> bool: """ Compare ``self`` and ``other``. @@ -160,7 +160,7 @@ def __richcmp__(self, other, op): sorted(f.a_invariants() for f in other.curves), op) return NotImplemented - def __hash__(self): + def __hash__(self) -> int: """ Hash is based on the a-invariants of the sorted list of minimal models. @@ -231,7 +231,7 @@ def _repr_(self): else: return "Isogeny class of %r" % (self.E) - def __contains__(self, x): + def __contains__(self, x) -> bool: """ INPUT: @@ -593,7 +593,8 @@ class IsogenyClass_EC_NumberField(IsogenyClass_EC): """ Isogeny classes for elliptic curves over number fields. """ - def __init__(self, E, reducible_primes=None, algorithm='Billerey', minimal_models=True): + def __init__(self, E, reducible_primes=None, + algorithm='Billerey', minimal_models=True) -> None: r""" INPUT: @@ -1003,7 +1004,7 @@ class IsogenyClass_EC_Rational(IsogenyClass_EC_NumberField): r""" Isogeny classes for elliptic curves over `\QQ`. """ - def __init__(self, E, algorithm='sage', label=None, empty=False): + def __init__(self, E, algorithm='sage', label=None, empty=False) -> None: r""" INPUT: diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx index 0640bf5585a..a8ceb5d5e73 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx +++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx @@ -48,7 +48,7 @@ cdef class PeriodicRegion: # the center). cdef readonly bint full - def __init__(self, w1, w2, data, full=True): + def __init__(self, w1, w2, data, full=True) -> None: """ EXAMPLES:: @@ -312,7 +312,7 @@ cdef class PeriodicRegion: """ return ~(~self).expand(corners) - def __contains__(self, z): + def __contains__(self, z) -> bool: """ Return whether this region contains the given point. @@ -518,7 +518,7 @@ cdef class PeriodicRegion: right._ensure_full() return PeriodicRegion(left.w1, left.w2, left.data ^ right.data, left.full) - def __richcmp__(left, right, op): + def __richcmp__(left, right, op) -> bool: """ Compare two regions. diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index cc3253ec937..3340eea9c77 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -375,7 +375,7 @@ class Simplex(SageObject): TypeError: unhashable type: 'list' """ - def __init__(self, X): + def __init__(self, X) -> None: """ Define a simplex. See :class:`Simplex` for full documentation. @@ -446,7 +446,7 @@ def is_face(self, other) -> bool: """ return self.__set.issubset(other.__set) - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return ``True`` iff ``x`` is a vertex of this simplex. @@ -693,10 +693,10 @@ def alexander_whitney(self, dim): sage: s.alexander_whitney(2) [(1, (0, 1, 3), (3, 4))] """ - return [(ZZ.one(), Simplex(self.tuple()[:dim+1]), + return [(ZZ.one(), Simplex(self.tuple()[:dim + 1]), Simplex(self.tuple()[dim:]))] - def __eq__(self, other): + def __eq__(self, other) -> bool: """ Return ``True`` iff this simplex is the same as ``other``: that is, if the vertices of the two are the same, even with a @@ -721,7 +721,7 @@ def __eq__(self, other): return False return set(self) == set(other) - def __ne__(self, other): + def __ne__(self, other) -> bool: """ Return ``True`` iff this simplex is not equal to ``other``. @@ -738,7 +738,7 @@ def __ne__(self, other): """ return not self == other - def __lt__(self, other): + def __lt__(self, other) -> bool: """ Return ``True`` iff the sorted tuple for this simplex is less than that for ``other``. @@ -786,7 +786,7 @@ def __lt__(self, other): except TypeError: return sorted(map(str, self)) < sorted(map(str, other)) - def __hash__(self): + def __hash__(self) -> int: """ Hash value for this simplex. This computes the hash value of the Python frozenset of the underlying tuple, since this is @@ -962,7 +962,7 @@ def __init__(self, name_check=False, is_mutable=True, is_immutable=False, - category=None): + category=None) -> None: """ Define a simplicial complex. See ``SimplicialComplex`` for more documentation. @@ -1146,7 +1146,7 @@ def __init__(self, # bigraded_betti_numbers(base_ring=base_ring) self._bbn_all_computed = set() - def __hash__(self): + def __hash__(self) -> int: """ Compute the hash value of ``self``. @@ -1173,7 +1173,7 @@ def __hash__(self): raise ValueError("this simplicial complex must be immutable; call set_immutable()") return hash(frozenset(self._facets)) - def __eq__(self, right): + def __eq__(self, right) -> bool: """ Two simplicial complexes are equal iff their vertex sets are equal and their sets of facets are equal. @@ -1189,7 +1189,7 @@ def __eq__(self, right): """ return isinstance(right, SimplicialComplex) and set(self._facets) == set(right._facets) - def __ne__(self, right): + def __ne__(self, right) -> bool: """ Return ``True`` if ``self`` and ``right`` are not equal. @@ -1256,7 +1256,7 @@ def _an_element_(self): except TypeError: return self.facets()[0] - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return ``True`` if ``x`` is a simplex which is contained in this complex. diff --git a/src/sage/topology/simplicial_set.py b/src/sage/topology/simplicial_set.py index 7387dde2f94..a106ff67404 100644 --- a/src/sage/topology/simplicial_set.py +++ b/src/sage/topology/simplicial_set.py @@ -296,7 +296,7 @@ class AbstractSimplex_class(SageObject): """ def __init__(self, dim, degeneracies=(), underlying=None, name=None, - latex_name=None): + latex_name=None) -> None: """ A simplex of dimension ``dim``. @@ -400,7 +400,7 @@ def __init__(self, dim, degeneracies=(), underlying=None, name=None, self.rename(name) self._latex_name = latex_name - def __hash__(self): + def __hash__(self) -> int: """ If nondegenerate: return the id of this simplex. @@ -424,7 +424,7 @@ def __hash__(self): return id(self) return hash(self.nondegenerate()) ^ hash(self._degens) - def __eq__(self, other): + def __eq__(self, other) -> bool: """ Two nondegenerate simplices are equal if they are identical. Two degenerate simplices are equal if their underlying @@ -453,7 +453,7 @@ def __eq__(self, other): return (self._degens == other._degens and self.nondegenerate() is other.nondegenerate()) - def __ne__(self, other): + def __ne__(self, other) -> bool: """ This returns the negation of ``__eq__``. @@ -471,7 +471,7 @@ def __ne__(self, other): """ return not self == other - def __lt__(self, other): + def __lt__(self, other) -> bool: """ We implement sorting in the hopes that sorted lists of simplices, for example as defining data for a simplicial set, will be @@ -580,7 +580,7 @@ def __lt__(self, other): return False return id(self) < id(other) - def __gt__(self, other): + def __gt__(self, other) -> bool: """ See :meth:`__lt__` for more doctests. @@ -594,7 +594,7 @@ def __gt__(self, other): """ return not (self < other or self == other) - def __le__(self, other): + def __le__(self, other) -> bool: """ See :meth:`__lt__` for more doctests. @@ -608,7 +608,7 @@ def __le__(self, other): """ return self < other or self == other - def __ge__(self, other): + def __ge__(self, other) -> bool: """ See :meth:`__lt__` for more doctests. @@ -916,7 +916,7 @@ def _latex_(self): # __ge__, __le__. Inheriting from AbstractSimplex_class first seems to # be slightly faster. class NonDegenerateSimplex(AbstractSimplex_class, WithEqualityById): - def __init__(self, dim, name=None, latex_name=None): + def __init__(self, dim, name=None, latex_name=None) -> None: """ A nondegenerate simplex. @@ -1225,7 +1225,7 @@ def face(self, simplex, i): return self.faces(simplex)[i] return None - def __contains__(self, x): + def __contains__(self, x) -> bool: """ Return ``True`` if ``x`` is a simplex which is contained in this complex. @@ -3204,7 +3204,7 @@ class SimplicialSet_finite(SimplicialSet_arbitrary, GenericCellComplex): """ def __init__(self, data, base_point=None, name=None, check=True, - category=None, latex_name=None): + category=None, latex_name=None) -> None: r""" TESTS:: @@ -3379,7 +3379,7 @@ def face(sigma, i): self.rename(name) self._latex_name = latex_name - def __eq__(self, other): + def __eq__(self, other) -> bool: """ Return ``True`` if ``self`` and ``other`` are equal as simplicial sets. @@ -3413,7 +3413,7 @@ def __eq__(self, other): and not other.is_pointed() and sorted(self._data) == sorted(other._data)) - def __ne__(self, other): + def __ne__(self, other) -> bool: """ Return ``True`` if ``self`` and ``other`` are not equal as simplicial sets. @@ -3439,7 +3439,7 @@ def __ne__(self, other): # computes their hash. If the tuple self._data is long, this can # take a long time. @cached_method - def __hash__(self): + def __hash__(self) -> int: """ The hash is formed from that of the tuple ``self._data``.