Skip to content

Commit d87f9df

Browse files
author
Release Manager
committed
gh-40848: type annotation for is_simple and is_smooth and a few other `-> bool` on the way ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40848 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 82925d2 + 316715c commit d87f9df

File tree

17 files changed

+58
-58
lines changed

17 files changed

+58
-58
lines changed

src/sage/algebras/lie_algebras/verma_module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def _dominant_data(self):
552552
wt, w = (self._weight + P.rho()).to_dominant_chamber(reduced_word=True)
553553
return (wt - P.rho(), w)
554554

555-
def is_singular(self):
555+
def is_singular(self) -> bool:
556556
r"""
557557
Return if ``self`` is a singular Verma module.
558558
@@ -582,7 +582,7 @@ def is_singular(self):
582582
"""
583583
return not self._dominant_data[0].is_dominant()
584584

585-
def is_simple(self):
585+
def is_simple(self) -> bool:
586586
r"""
587587
Return if ``self`` is a simple module.
588588
@@ -1083,7 +1083,7 @@ def _composition_(self, right, homset):
10831083
return homset.element_class(homset, right._scalar * self._scalar)
10841084
return super()._composition_(right, homset)
10851085

1086-
def is_injective(self):
1086+
def is_injective(self) -> bool:
10871087
r"""
10881088
Return if ``self`` is injective or not.
10891089
@@ -1112,7 +1112,7 @@ def is_injective(self):
11121112
return False
11131113
return bool(self._scalar)
11141114

1115-
def is_surjective(self):
1115+
def is_surjective(self) -> bool:
11161116
r"""
11171117
Return if ``self`` is surjective or not.
11181118

src/sage/dynamics/arithmetic_dynamics/wehlerK3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ def degenerate_primes(self, check=True):
10031003
bad_primes.remove(p)
10041004
return bad_primes
10051005

1006-
def is_smooth(self):
1006+
def is_smooth(self) -> bool:
10071007
r"""
10081008
Function will return the status of the smoothness of the surface.
10091009

src/sage/geometry/cone.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,7 +3240,7 @@ def is_isomorphic(self, other):
32403240
raise NotImplementedError("isomorphism check for not strictly convex "
32413241
"cones is not implemented")
32423242

3243-
def is_simplicial(self):
3243+
def is_simplicial(self) -> bool:
32443244
r"""
32453245
Check if ``self`` is simplicial.
32463246
@@ -3262,7 +3262,7 @@ def is_simplicial(self):
32623262
return self.nrays() == self.dim()
32633263

32643264
@cached_method
3265-
def is_smooth(self):
3265+
def is_smooth(self) -> bool:
32663266
r"""
32673267
Check if ``self`` is smooth.
32683268
@@ -3310,7 +3310,7 @@ def is_empty(self):
33103310
"""
33113311
return False
33123312

3313-
def is_trivial(self):
3313+
def is_trivial(self) -> bool:
33143314
"""
33153315
Check if the cone has no rays.
33163316
@@ -3328,7 +3328,7 @@ def is_trivial(self):
33283328

33293329
is_compact = is_trivial
33303330

3331-
def is_strictly_convex(self):
3331+
def is_strictly_convex(self) -> bool:
33323332
r"""
33333333
Check if ``self`` is strictly convex.
33343334

src/sage/geometry/hyperplane_arrangement/arrangement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ def center(self):
16121612
return self.is_central(certificate=True)[1]
16131613

16141614
@cached_method
1615-
def is_simplicial(self):
1615+
def is_simplicial(self) -> bool:
16161616
r"""
16171617
Test whether the arrangement is simplicial.
16181618

src/sage/geometry/polyhedron/base3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def a_maximal_chain(self):
11001100
for face in comb_chain] + \
11011101
[universe]
11021102

1103-
def is_simplex(self):
1103+
def is_simplex(self) -> bool:
11041104
r"""
11051105
Return whether the polyhedron is a simplex.
11061106
@@ -1152,7 +1152,7 @@ def simplicity(self):
11521152
raise NotImplementedError("this function is implemented for polytopes only")
11531153
return self.combinatorial_polyhedron().simplicity()
11541154

1155-
def is_simple(self):
1155+
def is_simple(self) -> bool:
11561156
"""
11571157
Test for simplicity of a polytope.
11581158
@@ -1203,7 +1203,7 @@ def simpliciality(self):
12031203
raise NotImplementedError("this function is implemented for polytopes only")
12041204
return self.combinatorial_polyhedron().simpliciality()
12051205

1206-
def is_simplicial(self):
1206+
def is_simplicial(self) -> bool:
12071207
"""
12081208
Test if the polytope is simplicial.
12091209

src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ cdef class CombinatorialPolyhedron(SageObject):
21282128
return smallInteger(simpliciality)
21292129
21302130
@cached_method
2131-
def is_simple(self):
2131+
def is_simple(self) -> bool:
21322132
r"""
21332133
Test whether the polytope is simple.
21342134

@@ -2239,7 +2239,7 @@ cdef class CombinatorialPolyhedron(SageObject):
22392239
return smallInteger(simplicity)
22402240
22412241
@cached_method
2242-
def is_lawrence_polytope(self):
2242+
def is_lawrence_polytope(self) -> bool:
22432243
r"""
22442244
Return ``True`` if ``self`` is a Lawrence polytope.
22452245

@@ -2338,7 +2338,7 @@ cdef class CombinatorialPolyhedron(SageObject):
23382338
return not any(vertices)
23392339
23402340
@cached_method
2341-
def is_pyramid(self, certificate=False):
2341+
def is_pyramid(self, certificate=False) -> bool:
23422342
r"""
23432343
Test whether the polytope is a pyramid over one of its facets.
23442344

src/sage/groups/libgap_mixin.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __contains__(self, elt):
5353
return False
5454
return elt == elt2
5555

56-
def is_abelian(self):
56+
def is_abelian(self) -> bool:
5757
r"""
5858
Return whether the group is Abelian.
5959
@@ -75,7 +75,7 @@ def is_abelian(self):
7575
"""
7676
return self.gap().IsAbelian().sage()
7777

78-
def is_nilpotent(self):
78+
def is_nilpotent(self) -> bool:
7979
r"""
8080
Return whether this group is nilpotent.
8181
@@ -89,7 +89,7 @@ def is_nilpotent(self):
8989
"""
9090
return self.gap().IsNilpotentGroup().sage()
9191

92-
def is_solvable(self):
92+
def is_solvable(self) -> bool:
9393
r"""
9494
Return whether this group is solvable.
9595
@@ -103,7 +103,7 @@ def is_solvable(self):
103103
"""
104104
return self.gap().IsSolvableGroup().sage()
105105

106-
def is_supersolvable(self):
106+
def is_supersolvable(self) -> bool:
107107
r"""
108108
Return whether this group is supersolvable.
109109
@@ -117,7 +117,7 @@ def is_supersolvable(self):
117117
"""
118118
return self.gap().IsSupersolvableGroup().sage()
119119

120-
def is_polycyclic(self):
120+
def is_polycyclic(self) -> bool:
121121
r"""
122122
Return whether this group is polycyclic.
123123
@@ -131,7 +131,7 @@ def is_polycyclic(self):
131131
"""
132132
return self.gap().IsPolycyclicGroup().sage()
133133

134-
def is_perfect(self):
134+
def is_perfect(self) -> bool:
135135
r"""
136136
Return whether this group is perfect.
137137
@@ -148,7 +148,7 @@ def is_perfect(self):
148148
"""
149149
return self.gap().IsPerfectGroup().sage()
150150

151-
def is_p_group(self):
151+
def is_p_group(self) -> bool:
152152
r"""
153153
Return whether this group is a p-group.
154154
@@ -162,7 +162,7 @@ def is_p_group(self):
162162
"""
163163
return self.gap().IsPGroup().sage()
164164

165-
def is_simple(self):
165+
def is_simple(self) -> bool:
166166
r"""
167167
Return whether this group is simple.
168168
@@ -179,7 +179,7 @@ def is_simple(self):
179179
"""
180180
return self.gap().IsSimpleGroup().sage()
181181

182-
def is_finite(self):
182+
def is_finite(self) -> bool:
183183
"""
184184
Test whether the matrix group is finite.
185185

src/sage/groups/perm_gps/permgroup.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ def ngens(self):
13491349
"""
13501350
return len(self.gens())
13511351

1352-
def is_trivial(self):
1352+
def is_trivial(self) -> bool:
13531353
r"""
13541354
Return ``True`` if this group is the trivial group.
13551355
@@ -4215,7 +4215,7 @@ def maximal_normal_subgroups(self):
42154215

42164216
# ##################### Boolean tests #####################
42174217

4218-
def is_abelian(self):
4218+
def is_abelian(self) -> bool:
42194219
"""
42204220
Return ``True`` if this group is abelian.
42214221
@@ -4230,7 +4230,7 @@ def is_abelian(self):
42304230
"""
42314231
return bool(self._libgap_().IsAbelian())
42324232

4233-
def is_commutative(self):
4233+
def is_commutative(self) -> bool:
42344234
"""
42354235
Return ``True`` if this group is commutative.
42364236
@@ -4245,7 +4245,7 @@ def is_commutative(self):
42454245
"""
42464246
return self.is_abelian()
42474247

4248-
def is_cyclic(self):
4248+
def is_cyclic(self) -> bool:
42494249
"""
42504250
Return ``True`` if this group is cyclic.
42514251
@@ -4357,7 +4357,7 @@ def is_isomorphic(self, right):
43574357
iso = self._libgap_().IsomorphismGroups(right)
43584358
return str(iso) != 'fail'
43594359

4360-
def is_monomial(self):
4360+
def is_monomial(self) -> bool:
43614361
"""
43624362
Return ``True`` if the group is monomial. A finite group is monomial
43634363
if every irreducible complex character is induced from a linear
@@ -4371,7 +4371,7 @@ def is_monomial(self):
43714371
"""
43724372
return bool(self._libgap_().IsMonomialGroup())
43734373

4374-
def is_nilpotent(self):
4374+
def is_nilpotent(self) -> bool:
43754375
"""
43764376
Return ``True`` if this group is nilpotent.
43774377
@@ -4386,7 +4386,7 @@ def is_nilpotent(self):
43864386
"""
43874387
return bool(self._libgap_().IsNilpotent())
43884388

4389-
def is_normal(self, other):
4389+
def is_normal(self, other) -> bool:
43904390
"""
43914391
Return ``True`` if this group is a normal subgroup of ``other``.
43924392
@@ -4403,7 +4403,7 @@ def is_normal(self, other):
44034403
raise TypeError("%s must be a subgroup of %s" % (self, other))
44044404
return bool(other._libgap_().IsNormal(self))
44054405

4406-
def is_perfect(self):
4406+
def is_perfect(self) -> bool:
44074407
"""
44084408
Return ``True`` if this group is perfect. A group is perfect if it
44094409
equals its derived subgroup.
@@ -4419,7 +4419,7 @@ def is_perfect(self):
44194419
"""
44204420
return bool(self._libgap_().IsPerfectGroup())
44214421

4422-
def is_pgroup(self):
4422+
def is_pgroup(self) -> bools:
44234423
r"""
44244424
Return ``True`` if this group is a `p`-group.
44254425
@@ -4434,7 +4434,7 @@ def is_pgroup(self):
44344434
"""
44354435
return bool(self._libgap_().IsPGroup())
44364436

4437-
def is_polycyclic(self):
4437+
def is_polycyclic(self) -> bool:
44384438
r"""
44394439
Return ``True`` if this group is polycyclic. A group is polycyclic if
44404440
it has a subnormal series with cyclic factors. (For finite groups,
@@ -4452,7 +4452,7 @@ def is_polycyclic(self):
44524452
"""
44534453
return bool(self._libgap_().IsPolycyclicGroup())
44544454

4455-
def is_simple(self):
4455+
def is_simple(self) -> bool:
44564456
"""
44574457
Return ``True`` if the group is simple.
44584458

src/sage/rings/qqbar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,7 +3592,7 @@ class ANDescr(SageObject):
35923592
``ANDescr`` and all of its subclasses are for internal use, and should not
35933593
be used directly.
35943594
"""
3595-
def is_simple(self):
3595+
def is_simple(self) -> bool:
35963596
r"""
35973597
Check whether this descriptor represents a value with the same
35983598
algebraic degree as the number field associated with the descriptor.
@@ -4269,7 +4269,7 @@ def __bool__(self):
42694269
self.exactify()
42704270
return bool(self)
42714271

4272-
def is_square(self):
4272+
def is_square(self) -> bool:
42734273
"""
42744274
Return whether or not this number is square.
42754275
@@ -6735,7 +6735,7 @@ def exactify(self):
67356735
"""
67366736
return self
67376737

6738-
def is_simple(self):
6738+
def is_simple(self) -> bool:
67396739
"""
67406740
Check whether this descriptor represents a value with the same
67416741
algebraic degree as the number field associated with the descriptor.
@@ -7997,7 +7997,7 @@ def is_complex(self):
79977997
"""
79987998
return not self._exactly_real
79997999

8000-
def is_simple(self):
8000+
def is_simple(self) -> bool:
80018001
r"""
80028002
Check whether this descriptor represents a value with the same
80038003
algebraic degree as the number field associated with the descriptor.

src/sage/rings/semirings/tropical_variety.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def weight_vectors(self):
13541354
result[vertex] = vectors
13551355
return result
13561356

1357-
def is_smooth(self):
1357+
def is_smooth(self) -> bool:
13581358
r"""
13591359
Return ``True`` if ``self`` is smooth and ``False`` otherwise.
13601360
@@ -1377,7 +1377,7 @@ def is_smooth(self):
13771377
"""
13781378
return len(self.vertices()) == self._poly.degree() ** 2
13791379

1380-
def is_simple(self):
1380+
def is_simple(self) -> bool:
13811381
r"""
13821382
Return ``True`` if ``self`` is simple and ``False`` otherwise.
13831383

0 commit comments

Comments
 (0)