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
6 changes: 3 additions & 3 deletions src/sage/combinat/regular_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
return iter(self[n] for n in count())

@cached_method
def is_degenerated(self):
def is_degenerated(self) -> bool:
r"""
Return whether this `k`-regular sequence is degenerated,
i.e., whether this `k`-regular sequence does not satisfy
Expand Down Expand Up @@ -363,7 +363,7 @@
False
"""
from sage.rings.integer_ring import ZZ
return (self.mu[ZZ(0)] * self.right) != self.right
return (self.mu[ZZ.zero()] * self.right) != self.right

def _error_if_degenerated_(self):
r"""
Expand Down Expand Up @@ -1280,7 +1280,7 @@
return result

@cached_method
def is_bounded(self):
def is_bounded(self) -> bool:
r"""
Return whether this `k`-regular sequence is bounded.

Expand Down Expand Up @@ -1484,7 +1484,7 @@

sage: from itertools import islice
sage: Seq2 = RegularSequenceRing(2, ZZ)
sage: TestSuite(Seq2).run( # long time

Check warning on line 1487 in src/sage/combinat/regular_sequence.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Warning: slow doctest:

slow doctest:: Test ran for 115.92s cpu, 117.63s wall Check ran for 0.01s cpu, 0.00s wall
....: elements=tuple(islice(Seq2.some_elements(), 4)))

.. SEEALSO::
Expand Down
12 changes: 6 additions & 6 deletions src/sage/combinat/regular_sequence_bounded.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_immutable(M):
raise RuntimeError('Phi too large.')


def is_integer_valued(matrices):
def is_integer_valued(matrices) -> bool:
r"""
Return whether every matrix in ``matrices`` is integer-valued.

Expand Down Expand Up @@ -203,7 +203,7 @@ def is_integer_valued(matrices):
return all(mat in M for mat in matrices)


def is_non_negative(matrices):
def is_non_negative(matrices) -> bool:
r"""
Return whether every matrix in ``matrices`` is non-negative.

Expand Down Expand Up @@ -234,10 +234,10 @@ def is_non_negative(matrices):
sage: is_non_negative(matrices)
True
"""
return all(min(mat.list()) >= 0 for mat in matrices)
return all(v >= 0 for mat in matrices for v in mat.list())


def is_bounded_via_mandel_simon_algorithm(matrices):
def is_bounded_via_mandel_simon_algorithm(matrices) -> bool:
r"""
Return whether the semigroup generated whether the semigroup of all
possible products of ``matrices`` is finite/bounded.
Expand Down Expand Up @@ -287,10 +287,10 @@ def is_bounded_via_mandel_simon_algorithm(matrices):
sage: is_bounded_via_mandel_simon_algorithm(N)
Traceback (most recent call last):
...
ValueError: Not all matrices are integer-valued.
ValueError: not all matrices are integer-valued
"""
if not is_integer_valued(matrices):
raise ValueError('Not all matrices are integer-valued.')
raise ValueError('not all matrices are integer-valued')

phi = construct_phi(matrices)
return not any(multiply_reduce(M, M) == M and not M**2 == M**3
Expand Down
32 changes: 16 additions & 16 deletions src/sage/geometry/convex_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ConvexSet_base(SageObject, Set_base):
Abstract base class for convex sets.
"""

def is_empty(self):
def is_empty(self) -> bool:
r"""
Test whether ``self`` is the empty set.

Expand All @@ -56,7 +56,7 @@ def is_empty(self):
"""
return self.dim() < 0

def is_finite(self):
def is_finite(self) -> bool:
r"""
Test whether ``self`` is a finite set.

Expand Down Expand Up @@ -106,7 +106,7 @@ def cardinality(self):
return ZZ(1)
return infinity

def is_universe(self):
def is_universe(self) -> bool:
r"""
Test whether ``self`` is the whole ambient space.

Expand Down Expand Up @@ -445,7 +445,7 @@ def codimension(self):

codim = codimension

def is_full_dimensional(self):
def is_full_dimensional(self) -> bool:
r"""
Return whether ``self`` is full dimensional.

Expand All @@ -465,7 +465,7 @@ def is_full_dimensional(self):
"""
return self.dim() == self.ambient_dim()

def is_open(self):
def is_open(self) -> bool:
r"""
Return whether ``self`` is open.

Expand All @@ -489,7 +489,7 @@ def is_open(self):
return True
raise NotImplementedError

def is_relatively_open(self):
def is_relatively_open(self) -> bool:
r"""
Return whether ``self`` is relatively open.

Expand All @@ -514,7 +514,7 @@ def is_relatively_open(self):
return True
raise NotImplementedError

def is_closed(self):
def is_closed(self) -> bool:
r"""
Return whether ``self`` is closed.

Expand All @@ -536,7 +536,7 @@ def is_closed(self):
return True
raise NotImplementedError

def is_compact(self):
def is_compact(self) -> bool:
r"""
Return whether ``self`` is compact.

Expand Down Expand Up @@ -969,7 +969,7 @@ class ConvexSet_closed(ConvexSet_base):
Abstract base class for closed convex sets.
"""

def is_closed(self):
def is_closed(self) -> bool:
r"""
Return whether ``self`` is closed.

Expand All @@ -983,7 +983,7 @@ def is_closed(self):
"""
return True

def is_open(self):
def is_open(self) -> bool:
r"""
Return whether ``self`` is open.

Expand All @@ -1007,7 +1007,7 @@ class ConvexSet_compact(ConvexSet_closed):
Abstract base class for compact convex sets.
"""

def is_universe(self):
def is_universe(self) -> bool:
r"""
Return whether ``self`` is the whole ambient space.

Expand All @@ -1025,7 +1025,7 @@ def is_universe(self):
"""
return self.ambient_dim() == 0 and not self.is_empty()

def is_compact(self):
def is_compact(self) -> bool:
r"""
Return whether ``self`` is compact.

Expand All @@ -1047,7 +1047,7 @@ class ConvexSet_relatively_open(ConvexSet_base):
Abstract base class for relatively open convex sets.
"""

def is_relatively_open(self):
def is_relatively_open(self) -> bool:
r"""
Return whether ``self`` is relatively open.

Expand All @@ -1062,7 +1062,7 @@ def is_relatively_open(self):
"""
return True

def is_open(self):
def is_open(self) -> bool:
r"""
Return whether ``self`` is open.

Expand All @@ -1083,7 +1083,7 @@ class ConvexSet_open(ConvexSet_relatively_open):
Abstract base class for open convex sets.
"""

def is_open(self):
def is_open(self) -> bool:
r"""
Return whether ``self`` is open.

Expand All @@ -1098,7 +1098,7 @@ def is_open(self):
"""
return True

def is_closed(self):
def is_closed(self) -> bool:
r"""
Return whether ``self`` is closed.

Expand Down
10 changes: 5 additions & 5 deletions src/sage/geometry/hyperbolic_space/hyperbolic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _element_constructor_(self, x, is_boundary=None, **graphics_options): # Abs
"""
return self.get_point(x, is_boundary, **graphics_options)

def name(self): # Abstract
def name(self) -> str: # Abstract
"""
Return the name of this model.

Expand All @@ -181,7 +181,7 @@ def name(self): # Abstract
"""
return self._name

def short_name(self):
def short_name(self) -> str:
"""
Return the short name of this model.

Expand All @@ -193,7 +193,7 @@ def short_name(self):
"""
return self._short_name

def is_bounded(self):
def is_bounded(self) -> bool:
"""
Return ``True`` if ``self`` is a bounded model.

Expand All @@ -210,7 +210,7 @@ def is_bounded(self):
"""
return self._bounded

def is_conformal(self):
def is_conformal(self) -> bool:
"""
Return ``True`` if ``self`` is a conformal model.

Expand All @@ -222,7 +222,7 @@ def is_conformal(self):
"""
return self._conformal

def is_isometry_group_projective(self):
def is_isometry_group_projective(self) -> bool:
"""
Return ``True`` if the isometry group of ``self`` is projective.

Expand Down
22 changes: 12 additions & 10 deletions src/sage/geometry/polyhedron/base0.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def change_ring(self, base_ring, backend=None):
new_parent = self.parent().change_ring(base_ring, backend)
return new_parent([vertices, rays, lines], None)

def is_mutable(self):
def is_mutable(self) -> bool:
r"""
Return ``True`` if the polyhedron is mutable, i.e. it can be modified in place.

Expand All @@ -458,7 +458,7 @@ def is_mutable(self):
"""
return False

def is_immutable(self):
def is_immutable(self) -> bool:
r"""
Return ``True`` if the polyhedron is immutable, i.e. it cannot be modified in place.

Expand Down Expand Up @@ -542,10 +542,11 @@ def n_vertices(self):
return len(self.vertices())

@cached_method
def n_rays(self):
def n_rays(self) -> int:
"""
Return the number of rays. The representation will
always be minimal.
Return the number of rays.

The representation will always be minimal.

EXAMPLES::

Expand All @@ -556,10 +557,11 @@ def n_rays(self):
return len(self.rays())

@cached_method
def n_lines(self):
def n_lines(self) -> int:
"""
Return the number of lines. The representation will
always be minimal.
Return the number of lines.

The representation will always be minimal.

EXAMPLES::

Expand All @@ -569,7 +571,7 @@ def n_lines(self):
"""
return len(self.lines())

def is_compact(self):
def is_compact(self) -> bool:
"""
Test for boundedness of the polytope.

Expand All @@ -582,7 +584,7 @@ def is_compact(self):
sage: p.is_compact()
False
"""
return self.n_rays() == 0 and self.n_lines() == 0
return self.n_rays() == 0 == self.n_lines()

def Hrepresentation(self, index=None):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/polyhedron/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def ambient_vector_space(self, base_field=None):
"""
return self.polyhedron().ambient_vector_space(base_field=base_field)

def is_relatively_open(self):
def is_relatively_open(self) -> bool:
r"""
Return whether ``self`` is relatively open.

Expand All @@ -699,7 +699,7 @@ def is_relatively_open(self):
"""
return self.as_polyhedron().is_relatively_open()

def is_compact(self):
def is_compact(self) -> bool:
r"""
Return whether ``self`` is compact.

Expand Down
Loading
Loading