Skip to content

Commit 589b4f6

Browse files
Doc: Fix parameter inconsistencies
1 parent 2c6f2e7 commit 589b4f6

35 files changed

Lines changed: 571 additions & 230 deletions

docs/source/data-structures/words/to-string.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ Full API
3232
.. autoclass:: ToString
3333
:class-doc-from: init
3434
:members:
35+
:special-members: __call__

docs/source/data-structures/words/to-word.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ Full API
3232
.. autoclass:: ToWord
3333
:class-doc-from: init
3434
:members:
35+
:special-members: __call__

docs/source/main-algorithms/knuth-bendix/knuth-bendix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Full API
5454
:members:
5555
:exclude-members:
5656
options, run_for, run_until, run, finished, stopped, current_state, dead,
57-
internal_generating_pairs, kill, last_report, report, report_every,
57+
internal_generating_pairs, internal_presentation, kill, last_report, report, report_every,
5858
report_prefix, report_why_we_stopped, reset_last_report, reset_start_time,
5959
running, running_for, running_until, start_time, started, state,
6060
stopped_by_predicate, success, timed_out

etc/check-params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def warn(message):
1919
print(YELLOW + f"WARNING: {message}" + END_COLOUR)
2020

2121

22-
def extract_signature(func) -> tuple[dict[str, str], str]:
22+
def extract_signature(func, func_name) -> tuple[dict[str, str], str]:
2323
"""Extract the parameters and typehints from the signature of a function
2424
2525
This function interrogates the signature of a function and returns:
@@ -32,7 +32,7 @@ def extract_signature(func) -> tuple[dict[str, str], str]:
3232
for param in sig.find_all("em", class_="sig-param"):
3333
param_component = param.find_all("span", class_="n")
3434
if len(param_component) == 0 or len(param_component) > 2:
35-
warn("unexpected element in doc. Skipping . . .")
35+
warn(f"unexpected element in doc of {func_name}. Skipping . . .")
3636
elif len(param_component) == 1:
3737
param_to_typehint[param_component[0].get_text()] = ""
3838
else:
@@ -166,7 +166,7 @@ def process_file(filename):
166166
sig_block = sig_block.parent.find_parent("dl").find("dt")
167167
func_name = sig_block["id"]
168168

169-
sig_params, sig_return_typehint = extract_signature(func)
169+
sig_params, sig_return_typehint = extract_signature(func, func_name)
170170
doc_params, doc_return_typehint = extract_documented_signature(func, func_name)
171171

172172
compare_parameters(sig_params, doc_params, func_name)

src/action.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ Returns the number of generators.
221221
self.generators().cend());
222222
},
223223
R"pbdoc(
224-
:sig=(self: Action) -> Iterator[Element]:
224+
:sig=(self: Action) -> collections.abc.Iterator[Element]:
225225
226226
Returns an iterator yielding the generators.
227227
228228
:returns:
229229
An iterator yielding the generators.
230230
:rtype:
231-
Iterator[Element]
231+
collections.abc.Iterator[Element]
232232
233233
:complexity:
234234
Constant.
@@ -405,7 +405,7 @@ of the strongly connected component containing ``self[pos]``.
405405
},
406406
py::arg("x"),
407407
R"pbdoc(
408-
:sig=(self: Action, x: Element) -> Point:
408+
:sig=(self: Action, x: Point) -> Point:
409409
410410
Returns the root point of a strongly connected component containing an
411411
``Point``.
@@ -428,7 +428,7 @@ Returns the root point of a strongly connected component containing an
428428
[](Action_& self, index_type pos) { return self.root_of_scc(pos); },
429429
py::arg("pos"),
430430
R"pbdoc(
431-
:sig=(self: Action, pos: Point) -> Point:
431+
:sig=(self: Action, pos: int) -> Point:
432432
433433
Returns the root point of a strongly connected component.
434434

src/aho-corasick.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ This function returns the index of the child of the node with index
122122
&AhoCorasick::height,
123123
py::arg("i"),
124124
R"pbdoc(
125+
:sig=(self: AhoCorasick, i: int) -> int:
125126
Calculate the height of a node.
126127
127128
:param i: the index of the node whose height is sought
@@ -171,6 +172,8 @@ This function Returns the number of nodes in the trie.
171172
py::overload_cast<index_type>(&AhoCorasick::signature, py::const_),
172173
py::arg("i"),
173174
R"pbdoc(
175+
:sig=(self: AhoCorasick, i: int) -> list[int]:
176+
174177
Find the signature of a node
175178
176179
Return the the signature of the node with index *i*. Recall that the
@@ -190,6 +193,8 @@ the unique path from the root to :math:`n`.
190193
&AhoCorasick::suffix_link,
191194
py::arg("current"),
192195
R"pbdoc(
196+
:sig=(self: AhoCorasick, current: int) -> int:
197+
193198
Calculate the index of the suffix link of a node.
194199
195200
Calculate the index of a suffix link of a node. Recall that the *suffix link* of
@@ -215,6 +220,8 @@ the longest proper suffix of :math:`W` contained in the trie.
215220
py::arg("current"),
216221
py::arg("a"),
217222
R"pbdoc(
223+
:sig=(self: AhoCorasick, current: int, a: int) -> int:
224+
218225
Traverse the trie using suffix links where necessary.
219226
220227
This function traverses the trie using suffix links where necessary, behaving
@@ -244,6 +251,8 @@ trie.
244251
&AhoCorasick::throw_if_node_index_not_active,
245252
py::arg("i"),
246253
R"pbdoc(
254+
:sig=(self: AhoCorasick, i: int) -> None:
255+
247256
Check if an index corresponds to a node currently in the trie.
248257
249258
:param i: the index to validate
@@ -262,6 +271,8 @@ Check if an index corresponds to a node currently in the trie.
262271
&AhoCorasick::throw_if_node_index_out_of_range,
263272
py::arg("i"),
264273
R"pbdoc(
274+
:sig=(self: AhoCorasick, i: int) -> None:
275+
265276
Check if an index corresponds to a node.
266277
267278
This function checks if the given index *i* corresponds to the index of a
@@ -286,13 +297,18 @@ node; either active or inactive.
286297
},
287298
py::arg("i"),
288299
R"pbdoc(
300+
:sig=(self: AhoCorasick, i: int) -> bool:
301+
289302
Check if a node is terminal (by index).
290303
291304
This function checks if the node with index *i* is terminal or not.
292305
293306
:param i: the index.
294307
:type i: int
295308
309+
:returns: Whether or not the node is terminal
310+
:rtype: bool
311+
296312
:raises LibsemigroupsError:
297313
if *i* does not correspond to the index of a node; that is, if *i* is
298314
larger than the size of the container storing the indices of nodes.

src/bipart.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Copy a Blocks object.
7373
}),
7474
py::arg("blocks"),
7575
R"pbdoc(
76+
:sig=(self: Blocks, blocks: list[list[int]]) -> None:
77+
7678
Constructs a Blocks object from a list of lists of integers.
7779
7880
This function constructs a :any:`Blocks` object from a list of lists of
@@ -109,7 +111,7 @@ Return a const iterator yielding the indices of the blocks.
109111
:returns:
110112
An iterator yielding the indices of blocks.
111113
:rtype:
112-
Iterator[int]
114+
collections.abc.Iterator[int]
113115
114116
:complexity:
115117
Constant.
@@ -135,6 +137,8 @@ the ``blocks`` used to construct *self*.
135137
},
136138
py::arg("index"),
137139
R"pbdoc(
140+
:sig=(self: Blocks, index: int) -> bool:
141+
138142
Check if a block is a transverse block.
139143
140144
This function returns ``True`` if the block with index *index* is a transverse
@@ -283,6 +287,8 @@ Copy a Bipartition object.
283287
}),
284288
py::arg("blocks"),
285289
R"pbdoc(
290+
:sig=(self: Bipartition, blocks: list[list[int]]) -> None:
291+
286292
Construct a bipartition from a partition.
287293
288294
The items in *blocks* should be:
@@ -303,6 +309,8 @@ The items in *blocks* should be:
303309
}),
304310
py::arg("lookup"),
305311
R"pbdoc(
312+
:sig=(self: Bipartition, lookup: list[int]) -> None:
313+
306314
Construct a bipartition from a blocks lookup.
307315
308316
The parameter *lookup*:
@@ -335,7 +343,7 @@ Return an iterator yielding the indices of the blocks.
335343
:returns:
336344
An iterator yielding the indices of the blocks.
337345
:rtype:
338-
Iterator[int]
346+
collections.abc.Iterator[int]
339347
340348
:complexity:
341349
Constant.
@@ -359,6 +367,7 @@ A bipartition is of degree :math:`n` if it is a partition of
359367
&Bipartition::is_transverse_block,
360368
py::arg("index"),
361369
R"pbdoc(
370+
:sig=(self: Bipartition, index: int) -> bool:
362371
Check if a block is a transverse block.
363372
364373
A block of a biparition is *transverse* if it contains integers less than and
@@ -494,6 +503,8 @@ are referred to as the *transverse* blocks.
494503
&Bipartition::one,
495504
py::arg("n"),
496505
R"pbdoc(
506+
:sig=(self: Bipartition, n: int) -> Bipartition:
507+
497508
Return the identity bipartition of given degree.
498509
499510
Returns the identity bipartition of degree ``n``. The *identity bipartition* of

src/bmat8.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ There is no guarantee about the contents of the matrix constructed.
166166
thing.def(py::init<uint64_t>(),
167167
py::arg("val"),
168168
R"pbdoc(
169+
:sig=(self: BMat8, val: int) -> None:
170+
169171
Construct from ``int``.
170172
171173
This constructor initializes a :any:`BMat8` to have rows equal to the 8 chunks,
@@ -178,10 +180,12 @@ of 8 bits each, of the binary representation of ``mat``.
178180
thing.def(py::init<std::vector<std::vector<bool>> const&>(),
179181
py::arg("rows"),
180182
R"pbdoc(
183+
:sig=(self: BMat8, rows: list[list[bool]]) -> None:
184+
181185
Construct from list of rows.
182186
183187
This constructor initializes a matrix where the rows of the matrix are the
184-
lists in ``rows``.
188+
lists in *rows*.
185189
186190
:param rows: the list of rows of the matrix being constructed.
187191
:type rows: list[list[bool]]
@@ -191,7 +195,15 @@ lists in ``rows``.
191195
:raises LibsemigroupsError: if the rows of *rows* are not all of the same length.
192196
193197
:complexity: Constant.)pbdoc");
194-
thing.def("degree", [](BMat8 const& self) { return 8; });
198+
thing.def(
199+
"degree", [](BMat8 const& self) { return 8; }, R"pbdoc(
200+
Returns the degree of *self*.
201+
202+
This function always returns ``8``.
203+
204+
:returns: The degree of the matrisx, ``8``.
205+
:rtype: int
206+
)pbdoc");
195207

196208
thing.def(
197209
"copy",
@@ -459,7 +471,7 @@ Returns the size of the row space of a :any:`BMat8`.
459471
:param x: the matrix.
460472
:type x: BMat8
461473
462-
:returns: The size of the row space of ``x``.
474+
:returns: The size of the row space of *x*.
463475
:rtype: int
464476
465477
:complexity: :math:`O(n)` where :math:`n` is the return value of this function.
@@ -505,7 +517,7 @@ Returns the size of the column space of a :any:`BMat8`.
505517
:sig=(x: BMat8) -> int:
506518
Returns the minimum dimension of a :any:`BMat8`.
507519
508-
This function returns the maximal ``n`` such that row ``n`` or column ``n`` in
520+
This function returns the maximal *n* such that row *n* or column *n* in
509521
the boolean matrix *x* contains a ``1``. Equivalent to the maximum of
510522
:any:`number_of_rows` and :any:`number_of_cols`.
511523

src/cong-common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ instance *{var}*.
11211121
},
11221122
py::arg(extra_doc.var.data()),
11231123
make_doc(R"pbdoc(
1124-
:sig=({var}: {name}) -> Iterator[str | list[int]]:
1124+
:sig=({var}: {name}) -> collections.abc.Iterator[str | list[int]]:
11251125
{only_document_once}
11261126
11271127
Returns an iterator yielding normal forms.
@@ -1135,7 +1135,7 @@ the congruence represented by an instance of :any:`{name}`.
11351135
:type {var}: {name}
11361136
11371137
:returns: An iterator yielding normal forms.
1138-
:rtype: Iterator[str | list[int]]
1138+
:rtype: collections.abc.Iterator[str | list[int]]
11391139
11401140
{raises}
11411141

src/dot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ This function adds a node with name *name*.
231231
This function adds an edge from the node named *head* to the node named *tail*.
232232
233233
:param head: the name of the node at the head of the edge.
234-
:type name: str
234+
:type head: str
235235
:param tail: the name of the node at the tail of the edge.
236-
:type name: str
236+
:type tail: str
237237
238238
:returns: a newly created :any:`Dot.Edge` object.
239239
:rtype: Dot.Edge

0 commit comments

Comments
 (0)