Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/categories/algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Algebras(CategoryWithAxiom_over_base_ring):
_base_category_class_and_axiom = (AssociativeAlgebras, 'Unital')

# For backward compatibility?
def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Membership testing.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def _subcategory_hook_(self, category):
"""
return issubclass(category.parent_class, self.parent_class)

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Membership testing.
Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/category_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def _subcategory_hook_(self, C):
return C.base() in base_ring
return False

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Return whether ``x`` is an object of this category.

Expand Down Expand Up @@ -605,7 +605,7 @@ def ring(self):
"""
return self.ambient()

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
EXAMPLES::

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/commutative_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CommutativeAlgebras(CategoryWithAxiom_over_base_ring):
- coproduct ( = tensor product over base ring)
"""

def __contains__(self, A):
def __contains__(self, A) -> bool:
"""
EXAMPLES::

Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/examples/finite_coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(self, n=5):
Parent.__init__(self, category=FiniteCoxeterGroups())
self.n = n

def _repr_(self):
def _repr_(self) -> str:
r"""
EXAMPLES::

Expand All @@ -114,7 +114,7 @@ def _repr_(self):
"""
return "The %s-th dihedral group of order %s" % (self.n, 2 * self.n)

def __contains__(self, x):
def __contains__(self, x) -> bool:
r"""
Check if the element ``x`` is in the mathematical parent ``self``.

Expand Down
6 changes: 3 additions & 3 deletions src/sage/categories/examples/finite_enumerated_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self):
Parent.__init__(self, facade=IntegerRing(),
category=FiniteEnumeratedSets())

def _repr_(self):
def _repr_(self) -> str:
"""
TESTS::

Expand All @@ -90,7 +90,7 @@ def _repr_(self):
"""
return "An example of a finite enumerated set: {1,2,3}"

def __contains__(self, o):
def __contains__(self, o) -> bool:
"""
EXAMPLES::

Expand Down Expand Up @@ -182,7 +182,7 @@ def retract(self, x):
"""
return x ** 2

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Membership testing by checking whether the preimage by the
bijection is in the ambient space.
Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/examples/infinite_enumerated_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self):
"""
Parent.__init__(self, category=InfiniteEnumeratedSets())

def _repr_(self):
def _repr_(self) -> str:
"""
TESTS::

Expand All @@ -100,7 +100,7 @@ def _repr_(self):
"""
return "An example of an infinite enumerated set: the nonnegative integers"

def __contains__(self, elt):
def __contains__(self, elt) -> bool:
"""
EXAMPLES::

Expand Down
14 changes: 7 additions & 7 deletions src/sage/categories/examples/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def an_element(self):
sage: x.parent()
Integer Ring
"""
return self(47) # if speed is needed, call: self.element_class(47)
return self(47) # if speed is needed, call: self.element_class(47)

def __contains__(self, p):
def __contains__(self, p) -> bool:
"""
TESTS::

Expand Down Expand Up @@ -393,7 +393,7 @@ def __init__(self):
super().__init__()
self._populate_coercion_lists_(embedding=IntegerRing())

def __contains__(self, p):
def __contains__(self, p) -> bool:
"""
TESTS::

Expand Down Expand Up @@ -502,7 +502,7 @@ def __init__(self):
self.mor = Hom(self, IntegerRing())(lambda z: z.value)
self._populate_coercion_lists_(embedding=self.mor)

def _repr_(self):
def _repr_(self) -> str:
"""
TESTS::

Expand All @@ -511,7 +511,7 @@ def _repr_(self):
"""
return "Set of prime numbers (wrapper implementation)"

def __contains__(self, p):
def __contains__(self, p) -> bool:
"""
TESTS::

Expand Down Expand Up @@ -665,7 +665,7 @@ def __init__(self):
"""
Parent.__init__(self, facade=IntegerRing(), category=Sets())

def _repr_(self):
def _repr_(self) -> str:
"""
TESTS::

Expand All @@ -674,7 +674,7 @@ def _repr_(self):
"""
return "Set of prime numbers (facade implementation)"

def __contains__(self, p):
def __contains__(self, p) -> bool:
"""
TESTS::

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/facade_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def is_parent_of(self, element):
from sage.structure.element import parent
return parent(element) in parents

def __contains__(self, element):
def __contains__(self, element) -> bool:
"""
Membership testing.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def extra_super_categories(self):
"""
return [EuclideanDomains(), NoetherianRings()]

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
EXAMPLES::

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/finite_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"""
return [EnumeratedSets().Finite()]

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
EXAMPLES::

Expand Down Expand Up @@ -438,7 +438,7 @@
sage: k.<y> = S.quotient_ring(f)
sage: k in Fields()
True
sage: k(2).sqrt(algorithm="cipolla")^2 == k(2)

Check warning on line 441 in src/sage/categories/finite_fields.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.13, all)

Warning: slow doctest:

slow doctest:: Test ran for 13.59s cpu, 25.16s wall Check ran for 0.01s cpu, 0.00s wall

Check warning on line 441 in src/sage/categories/finite_fields.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Warning: slow doctest:

slow doctest:: Test ran for 10.23s cpu, 20.07s wall Check ran for 0.00s cpu, 0.00s wall
True

ALGORITHM:
Expand Down
6 changes: 3 additions & 3 deletions src/sage/categories/homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def element_class_set_morphism(self):
"""
return self.__make_element_class__(morphism.SetMorphism)

def __eq__(self, other):
def __eq__(self, other) -> bool:
"""
For two homsets, it is tested whether the domain, the codomain and
the category coincide.
Expand All @@ -1094,7 +1094,7 @@ def __eq__(self, other):
and self._codomain == other._codomain
and self.__category == other.__category)

def __ne__(self, other):
def __ne__(self, other) -> bool:
"""
Check for not-equality of ``self`` and ``other``.
Expand All @@ -1113,7 +1113,7 @@ def __ne__(self, other):
"""
return not (self == other)

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Test whether the parent of the argument is ``self``.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/integral_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class IntegralDomains(CategoryWithAxiom):
"""
_base_category_class_and_axiom = (Domains, "Commutative")

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
EXAMPLES::

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/number_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def super_categories(self):
"""
return [Fields().Infinite()]

def __contains__(self, x):
def __contains__(self, x) -> bool:
r"""
Return ``True`` if ``x`` is a number field.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def super_categories(self):
"""
return []

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Anything is in the category of objects.

Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ def is_parent_of(self, element):
return parent(element) == self

@abstract_method
def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Test whether the set ``self`` contains the object ``x``.

Expand Down Expand Up @@ -3116,7 +3116,7 @@ def _an_element_(self):
return self.a_realization().an_element()

# TODO: maybe this could be taken care of by Sets.Facade()?
def __contains__(self, x):
def __contains__(self, x) -> bool:
r"""
Test whether ``x`` is in ``self``, that is if it is an
element of some realization of ``self``.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/unique_factorization_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def additional_structure(self):
"""
return None

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
EXAMPLES::

Expand Down
6 changes: 3 additions & 3 deletions src/sage/geometry/cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ def _PPL_cone(self):
self._PPL_C_Polyhedron = C_Polyhedron(gs)
return self._PPL_C_Polyhedron

def __contains__(self, point):
def __contains__(self, point) -> bool:
r"""
Check if ``point`` is contained in ``self``.

Expand Down Expand Up @@ -1599,7 +1599,7 @@ def __getstate__(self):
False
"""
state = copy(self.__dict__)
state.pop("_PPL_C_Polyhedron", None) # PPL is not picklable.
state.pop("_PPL_C_Polyhedron", None) # PPL is not picklable.

# TODO: do we want to keep the face lattice in the pickle?
# Currently there is an unpickling loop if do:
Expand All @@ -1611,7 +1611,7 @@ def __getstate__(self):
state.pop("_face_lattice", None)
return state

def _contains(self, point, region='whole cone'):
def _contains(self, point, region='whole cone') -> bool:
r"""
Check if ``point`` is contained in ``self``.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ def __richcmp__(self, right, op):
else:
return NotImplemented

def __contains__(self, cone):
def __contains__(self, cone) -> bool:
r"""
Check if ``cone`` is equivalent to a cone of the fan.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def __lt__(self, other):
return False
return self <= other

def __contains__(self, q):
def __contains__(self, q) -> bool:
r"""
Test whether the point ``q`` is in the affine space.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/hyperplane_arrangement/hyperplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def _normal_pivot(self):
max_value = values[i]
return max_pos

def __contains__(self, q):
def __contains__(self, q) -> bool:
r"""
Test whether the point ``q`` is in the hyperplane.

Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/relative_interior.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, polyhedron):
if hasattr(polyhedron, "_add_dependent_object"):
polyhedron._add_dependent_object(self)

def __hash__(self):
def __hash__(self) -> int:
r"""
TESTS::

Expand All @@ -67,7 +67,7 @@ def __hash__(self):
"""
return hash(self._polyhedron) ^ 1789

def __contains__(self, point):
def __contains__(self, point) -> bool:
r"""
Return whether ``self`` contains ``point``.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/toric_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _coerce_map_from_(self, other):
return None
return super()._convert_map_from_(other)

def __contains__(self, point):
def __contains__(self, point) -> bool:
r"""
Check if ``point`` is an element of ``self``.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/abelian_gps/abelian_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ def __init__(self, ambient, gens, names='f', category=None):
category = Groups().Commutative().Subobjects()
AbelianGroup_class.__init__(self, invs, names, category=category)

def __contains__(self, x):
def __contains__(self, x) -> bool:
"""
Test whether ``x`` is an element of this subgroup.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/abelian_gps/dual_abelian_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def invariants(self):
# TODO: deprecate
return self.group().gens_orders()

def __contains__(self, X):
def __contains__(self, X) -> bool:
"""
Implement "in".

Expand Down
4 changes: 2 additions & 2 deletions src/sage/groups/conjugacy_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __ne__(self, other):
"""
return not (self == other)

def __contains__(self, element):
def __contains__(self, element) -> bool:
r"""
Check if ``element`` belongs to the conjugacy class ``self``.

Expand Down Expand Up @@ -440,7 +440,7 @@ def cardinality(self):
"""
return self._gap_().Size().sage()

def __contains__(self, g):
def __contains__(self, g) -> bool:
r"""
Containment test.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/libgap_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class GroupMixinLibGAP:
def __contains__(self, elt):
def __contains__(self, elt) -> bool:
r"""
TESTS::

Expand Down
Loading
Loading