Skip to content

Commit 9bf0716

Browse files
Ensure that Iterator includes the type yielded
1 parent 481b800 commit 9bf0716

4 files changed

Lines changed: 13 additions & 14 deletions

File tree

src/bipart.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ Return a const iterator yielding the indices of the blocks.
105105
Constant.
106106
107107
:returns:
108-
A value of type :any:`Iterator`.
109-
108+
An iterator yielding the indices of blocks.
110109
:rtype:
111-
iterator
110+
Iterator[int]
112111
)pbdoc");
113112
thing.def("degree",
114113
&Blocks::degree,
@@ -318,9 +317,9 @@ Return an iterator yielding the indices of the blocks.
318317
Constant.
319318
320319
:returns:
321-
A value of type :any:`Iterator`.
320+
An iterator yielding the indices of the blocks.
322321
:rtype:
323-
Iterator
322+
Iterator[int]
324323
)pbdoc");
325324
thing.def("degree",
326325
&Bipartition::degree,

src/libsemigroups_pybind11/froidure_pin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __getitem__(self: _Self, i: int) -> Element:
176176
self._raise_if_element_not_implemented()
177177
return _to_py(_to_cxx(self)[i])
178178

179-
def __iter__(self: _Self) -> Iterator:
179+
def __iter__(self: _Self) -> Iterator[Element]:
180180
self._raise_if_element_not_implemented()
181181
return map(_to_py, iter(_to_cxx(self)))
182182

@@ -209,7 +209,7 @@ def idempotents( # pylint: disable=missing-function-docstring
209209
@_copydoc(_FroidurePinPBR.sorted_elements)
210210
def sorted_elements( # pylint: disable=missing-function-docstring
211211
self: _Self,
212-
) -> Iterator:
212+
) -> Iterator[Element]:
213213
self._raise_if_element_not_implemented()
214214
return map(
215215
_to_py,

src/libsemigroups_pybind11/konieczny.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ def generators(self: Self) -> Iterator[Element]:
156156
)
157157

158158
@_copydoc(_KoniecznyBMat.current_D_classes)
159-
def current_D_classes(self: Self) -> Iterator:
159+
def current_D_classes(self: Self) -> Iterator[DClass]:
160160
# pylint: disable=missing-function-docstring,invalid-name
161161
return map(
162162
_to_py,
163163
_to_cxx(self).current_D_classes(),
164164
)
165165

166166
@_copydoc(_KoniecznyBMat.D_classes)
167-
def D_classes(self: Self) -> Iterator:
167+
def D_classes(self: Self) -> Iterator[DClass]:
168168
# pylint: disable=missing-function-docstring,invalid-name
169169
return map(
170170
_to_py,

src/word-graph.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ This function returns an iterator yielding the nodes of
189189
the word graph.
190190
191191
:returns:
192-
An :any:`Iterator`.
192+
An iterator yielding the nodes.
193193
194194
:rtype:
195-
Iterator
195+
Iterator[int]
196196
197197
:complexity:
198198
Constant.)pbdoc");
@@ -221,8 +221,8 @@ to the source node *source*. This target might equal :any:`UNDEFINED`.
221221
:param source: the source node in the word graph.
222222
:type source: int
223223
224-
:returns: An :any:`Iterator`.
225-
:rtype: Iterator
224+
:returns: An iterator yielding the targets.
225+
:rtype: Iterator[int | Undefined]
226226
227227
:raises LibsemigroupsError:
228228
if *source* is out of range (i.e. greater than or equal to
@@ -331,7 +331,7 @@ targets of edges with source *source*.
331331
:type source: int
332332
333333
:returns: An iterator.
334-
:rtype: Iterator
334+
:rtype: Iterator[tuple[int, int | Undefined]]
335335
336336
:raises LibsemigroupsError: if *source* is out of bounds.)pbdoc");
337337
thing.def(

0 commit comments

Comments
 (0)