diff --git a/etc/check_params_doc.py b/etc/check_params_doc.py new file mode 100755 index 000000000..afd2bd288 --- /dev/null +++ b/etc/check_params_doc.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import re +import os +from os import listdir +from os.path import isfile, splitext + +begin_warn_col = "\033[93m" +end_warn_col = "\033[0m" + + +def all_cpp_files(start): + files = set() + + def dive(path): + for entry in listdir(path): + candidate = os.path.join(path, entry) + if isfile(candidate) and splitext(entry)[1] == ".cpp": + files.add(candidate) + elif not isfile(candidate): + dive(candidate) + + dive(start) + return files + + +src_path = "src" +files = all_cpp_files(src_path) + +param_pattern = re.compile(r":param (\w+):") + +print("Checking docstring indentation in .cpp files . . .") +for file in files: + with open(file, "r") as f: + line_is_doc = False + for line_no, line in enumerate(f): + if line_is_doc and ")pbdoc" in line: + line_is_doc = False + if not line_is_doc and "pbdoc(" in line: + params = [] + line_is_doc = True + if not line_is_doc: + continue + match = param_pattern.match(line) + if match: + params.append(match.group(1)) + for param in params: + if f"``{param}``" in line: + print( + f"{begin_warn_col}Warning: found ``{param}`` " + f"in {file}:{line_no + 1}{end_warn_col}" + ) diff --git a/src/action.cpp b/src/action.cpp index a9c49bb63..22b51f5b9 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -121,7 +121,7 @@ In this documentation we refer to: Copy an :any:`Action`. -:returns: A copy of the ``self``. +:returns: A copy of the *self*. :rtype: Action )pbdoc"); @@ -133,7 +133,7 @@ Copy an :any:`Action`. Re-initialize an existing object. This function puts an action object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: Action )pbdoc"); thing.def("reserve", @@ -147,12 +147,12 @@ Increase the capacity to a value that is greater or equal to *val*. :param val: new capacity of an action instance. :type val: int -:raises MemoryError: if ``val`` is too large. +:raises MemoryError: if *val* is too large. :complexity: At most linear in the :any:`size()` of the :py:class:`Action`. -:returns: ``self``. +:returns: *self*. :rtype: Action )pbdoc"); thing.def("add_seed", @@ -172,7 +172,7 @@ generators of the action. :complexity: Constant. -:returns: ``self`` +:returns: *self* :rtype: Action )pbdoc"); thing.def("add_generator", @@ -191,7 +191,7 @@ generated by the elements added via this member function. :complexity: Constant. -:returns: ``self``. +:returns: *self*. :rtype: Action )pbdoc"); thing.def("number_of_generators", @@ -245,7 +245,7 @@ Returns the position of a point in the so far discovered points. :complexity: Constant. -:returns: The index of *pt* in ``self`` or :any:`UNDEFINED`. +:returns: The index of *pt* in *self* or :any:`UNDEFINED`. :rtype: int | Undefined )pbdoc"); thing.def("empty", @@ -340,7 +340,7 @@ cached, and not recomputed every time one of these functions is called. :complexity: Constant. -:returns: ``self``. +:returns: *self*. :rtype: Action )pbdoc"); thing.def("multiplier_from_scc_root", diff --git a/src/aho-corasick.cpp b/src/aho-corasick.cpp index 45e0dc465..593cc9f4c 100644 --- a/src/aho-corasick.cpp +++ b/src/aho-corasick.cpp @@ -149,7 +149,7 @@ if it had been newly default constructed. :complexity: Linear in the number of nodes in the trie -:returns: ``self``. +:returns: *self*. :rtype: AhoCorasick )pbdoc"); diff --git a/src/bipart.cpp b/src/bipart.cpp index 86290a88a..4cecc8264 100644 --- a/src/bipart.cpp +++ b/src/bipart.cpp @@ -83,7 +83,7 @@ transverse and those consisting of positive values are not. :type blocks: list :raises LibsemigroupsError: - if the set consisting of the absolute values of the entries in ``blocks`` is + if the set consisting of the absolute values of the entries in *blocks* is not :math:`\{1, \ldots, n\}` where :math:`n` is the maximum such value. :raises LibsemigroupsError: if ``0`` is an item in any block. @@ -120,7 +120,7 @@ Return a const iterator yielding the indices of the blocks. R"pbdoc( Return the degree of a blocks object. The *degree* of a :any:`Blocks` object is the size of the set of which it is a partition, or the size of -the ``blocks`` used to construct ``self``. +the ``blocks`` used to construct *self*. :returns: The degree of a :any:`Blocks` object. @@ -197,7 +197,7 @@ of ``True`` values in :any:`lookup()`. At most linear in the number of blocks. :returns: - The number of signed (transverse) blocks in ``self``. + The number of signed (transverse) blocks in *self*. :rtype: int )pbdoc"); @@ -534,7 +534,7 @@ Return the identity bipartition with the same degree as the given bipartition. The *identity bipartition* of degree :math:`n` has blocks :math:`\{i, -i\}` for all :math:`i\in \{0, \ldots, n - 1\}`. This function returns a new identity -bipartition of degree equal to the degree of ``self``. +bipartition of degree equal to the degree of *self*. :param f: a bipartition :type f: Bipartition diff --git a/src/cong-common.cpp b/src/cong-common.cpp index 83b72a50e..5d0517b02 100644 --- a/src/cong-common.cpp +++ b/src/cong-common.cpp @@ -158,7 +158,7 @@ have been in if it had just been newly default constructed. {detail} :returns: - ``self``. + *self*. :rtype: {name})pbdoc", name, @@ -304,7 +304,7 @@ had been newly constructed from *knd* and *p*. :param p: the presentation. :type p: Presentation -:returns: ``self``. +:returns: *self*. :rtype: {name} :raises LibsemigroupsError: if *p* is not valid. @@ -489,7 +489,7 @@ This function adds a generating pair to the congruence represented by a :param v: the second item in the pair. :type v: list[int] | str -:returns: ``self``. +:returns: *self*. :rtype: {name} :raises LibsemigroupsError: @@ -1169,7 +1169,7 @@ the congruence represented by an instance of :any:`{name}`. The kind of the congruence (1- or 2-sided). -This function returns the kind of the congruence represented by ``self``. See +This function returns the kind of the congruence represented by *self*. See :any:`congruence_kind` for details. :complexity: diff --git a/src/cong.cpp b/src/cong.cpp index 9054e4847..060d553f3 100644 --- a/src/cong.cpp +++ b/src/cong.cpp @@ -117,7 +117,7 @@ Set the maximum number of threads. :param val: the number of threads. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: Congruence )pbdoc"); diff --git a/src/dot.cpp b/src/dot.cpp index 96daa1d2a..885ad27e2 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -89,7 +89,7 @@ attribute of a :any:`Dot.Node`. :param val: the value of the attribute. :type val: str -:returns: ``self`` +:returns: *self* :rtype: Dot.Node )pbdoc", py::return_value_policy::reference); @@ -136,7 +136,7 @@ attribute of an :any:`Edge`. :param val: the value of the attribute. :type val: str -:returns: ``self`` +:returns: *self* :rtype: Dot.Edge )pbdoc"); @@ -257,7 +257,7 @@ This function adds an edge from the node named *head* to the node named *tail*. // last edge reference is collected. py::arg("subgraph"), R"pbdoc( -This functions adds the :any:`Dot` object *subgraph* as a subgraph of ``self``. +This functions adds the :any:`Dot` object *subgraph* as a subgraph of *self*. The following transformations are performed * the ``label`` attribute of the added subgraph is the :any:`Dot.name` of @@ -275,7 +275,7 @@ The following transformations are performed :param subgraph: the :any:`Dot` object to use as a subgraph. :type subgraph: Dot -:returns: ``self``. +:returns: *self*. :rtype: Dot )pbdoc"); @@ -348,7 +348,7 @@ Set the kind of the represented graph. Dot.Kind :returns: - ``self``. + *self*. :rtype: Dot )pbdoc"); @@ -391,7 +391,7 @@ Set the name of the represented graph. str :returns: - ``self``. + *self*. :rtype: Dot )pbdoc"); @@ -472,7 +472,7 @@ representation of the graph in the `DOT `_. :returns: - The string representation of ``self``. + The string representation of *self*. :rtype: str )pbdoc"); @@ -491,7 +491,7 @@ attribute of an :any:`Dot`. :param val: the value of the attribute. :type val: str -:returns: ``self`` +:returns: *self* :rtype: Dot )pbdoc", py::return_value_policy::reference); @@ -507,7 +507,7 @@ attribute of an :any:`Dot`. :param key: the name of the attribute. :type key: str -:returns: ``self`` +:returns: *self* :rtype: Dot )pbdoc", py::return_value_policy::reference); diff --git a/src/forest.cpp b/src/forest.cpp index 011df21d8..ac176f7eb 100644 --- a/src/forest.cpp +++ b/src/forest.cpp @@ -140,7 +140,7 @@ the same state as if it had just be constructed as ``Forest(n)``. :param n: the number of nodes, defaults to ``0``. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: Forest )pbdoc"); @@ -194,9 +194,9 @@ Returns the label of the edge from a node to its parent. :sig=(self: Forest) -> list[int | Undefined]: Returns a copy of the list of edge labels in the :any:`Forest`. The value -in position ``i`` of this list is the label of the edge from the -parent of node ``i`` to ``i``. If the parent equals :any:`UNDEFINED`, -then node ``i`` is a root node. +in position *i* of this list is the label of the edge from the +parent of node *i* to *i*. If the parent equals :any:`UNDEFINED`, +then node *i* is a root node. :returns: The edge labels of the forest. @@ -323,7 +323,7 @@ Set the parent and edge label for a node. This function sets the parent of :param gen: the label of the edge from parent to node. :type gen: int -:returns: ``self`` +:returns: *self* :rtype: Forest :raises LibsemigroupsError: diff --git a/src/froidure-pin-base.cpp b/src/froidure-pin-base.cpp index e309edce7..df12a0dde 100644 --- a/src/froidure-pin-base.cpp +++ b/src/froidure-pin-base.cpp @@ -72,7 +72,7 @@ enumerating the semigroup.The default value of the batch size is ``8192``. :param val: the new value for the batch size. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin :complexity: Constant. @@ -253,7 +253,7 @@ final letter of the element. :rtype: int :raises LibsemigroupsError: - if ``pos`` is greater than or equal to :any:`current_size`. + if *pos* is greater than or equal to :any:`current_size`. :complexity: Constant. )pbdoc"); @@ -298,7 +298,7 @@ Check if the categorical multiplicative identity is an element. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented - by ``self``, and :math:`n` is the return value of + by *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc"); @@ -316,7 +316,7 @@ Check if the categorical multiplicative identity is an element. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented - by ``self``, and :math:`n` is the return value of + by *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc"); @@ -337,7 +337,7 @@ graph of the semigroup represented by a :any:`FroidurePin` instance. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented - by ``self``, and :math:`n` is the return value of + by *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc", py::return_value_policy::reference_internal); @@ -429,7 +429,7 @@ This function triggers a full enumeration of the semigroup. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented by - ``self``, and :math:`n` is the return value of + *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc"); @@ -470,7 +470,7 @@ Returns the fully enumerated right Cayley graph. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented - by ``self``, and :math:`n` is the return value of + by *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc", @@ -490,7 +490,7 @@ Returns the size of the semigroup represented by a :any:`FroidurePin` instance. :complexity: At worst :math:`O(|S|n)` where :math:`S` is the semigroup represented - by ``self``, and :math:`n` is the return value of + by *self*, and :math:`n` is the return value of :any:`FroidurePin.number_of_generators`. )pbdoc"); @@ -561,7 +561,7 @@ path in the left Cayley graph from *j* labelled by int :raises LibsemigroupsError: - if ``i`` or ``j`` is greater than or equal to + if *i* or *j* is greater than or equal to :any:`FroidurePin.current_size`. :complexity: diff --git a/src/froidure-pin.cpp b/src/froidure-pin.cpp index d0962cfa1..0df0cf0b5 100644 --- a/src/froidure-pin.cpp +++ b/src/froidure-pin.cpp @@ -172,7 +172,7 @@ elements than before (whether it is fully enumerating or not). :param x: the generator to add. :type x: Element -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin :raises LibsemigroupsError: @@ -200,7 +200,7 @@ See :any:`add_generator` for a detailed description. :param gens: the list of generators. :type gens: list[Element] -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin :raises TypeError: @@ -335,7 +335,7 @@ or number of idempotents, for example. :param gens: the list of generators. :type gens: list[Element] -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin :raises LibsemigroupsError: @@ -455,7 +455,7 @@ This function either: whichever is better. -For example, if the complexity of the multiplication is linear and ``self`` is +For example, if the complexity of the multiplication is linear and *self* is a semigroup of transformations of degree 20, and the shortest paths in the left and right Cayley graphs from *i* to *j* are of length 100 and 1131, then it is better to just multiply the transformations together. @@ -512,7 +512,7 @@ Reinitialize a :any:`FroidurePin` object. This function re-initializes a :any:`FroidurePin` object so that it is in the same state as if it had just been default constructed. -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin )pbdoc"); @@ -536,7 +536,7 @@ in the same state as if it had just been constructed from *gens*. :param gens: the generators. :type gens: list[Element] -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin :raises LibsemigroupsError: @@ -550,7 +550,7 @@ in the same state as if it had just been constructed from *gens*. Check finiteness. -This function returns :any:`tril.true` if the semigroup represented by ``self`` +This function returns :any:`tril.true` if the semigroup represented by *self* is finite, :any:`tril.false` if it is infinite, and :any:`tril.unknown` if it is not known. For some types of elements, such as matrices over the integers, for example, it is undecidable, in general, if the semigroup generated by these @@ -655,7 +655,7 @@ the :any:`Runner.run` function, and consequently every other function too. :param val: the number of elements to reserve space for. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: FroidurePin )pbdoc"); diff --git a/src/gabow.cpp b/src/gabow.cpp index 17f59627c..61fc4df1a 100644 --- a/src/gabow.cpp +++ b/src/gabow.cpp @@ -199,7 +199,7 @@ underlying graph of a :any:`Gabow` instance. This function re-initializes a :any:`Gabow` object so that it is in the same state as if it had just been constructed from *wg*. -:returns: ``self``. +:returns: *self*. :rtype: Gabow )pbdoc"); diff --git a/src/kambites.cpp b/src/kambites.cpp index a546904b6..d2b35161b 100644 --- a/src/kambites.cpp +++ b/src/kambites.cpp @@ -162,7 +162,7 @@ at least :math:`n`. :returns: The greatest positive integer :math:`n` such that the finitely - semigroup or monoid represented by ``self`` satisfies the condition + semigroup or monoid represented by *self* satisfies the condition :math:`C(n)` ; or :any:`POSITIVE_INFINITY` if no word occurring in a relation can be written as a product of pieces. :rtype: int | PositiveInfinity diff --git a/src/knuth-bendix-impl.cpp b/src/knuth-bendix-impl.cpp index e24d45320..4d241fc1e 100644 --- a/src/knuth-bendix-impl.cpp +++ b/src/knuth-bendix-impl.cpp @@ -151,7 +151,7 @@ to accumulate. :param val: The new value of the batch size. :type val: int -:return: ``self``. +:return: *self*. :rtype: KnuthBendix .. seealso:: :any:`Runner.run`. @@ -203,7 +203,7 @@ system is already confluent. :param val: The new value of the interval. :type val: int | LimitMax -:return: ``self``. +:return: *self*. :rtype: KnuthBendix )pbdoc"); @@ -248,7 +248,7 @@ If this value is less than the longest left hand side of a rule, then :param val: The new value of the maximum overlap length. :type val: int -:return: ``self``. +:return: *self*. :rtype: KnuthBendix .. seealso:: :any:`Runner.run`. @@ -298,7 +298,7 @@ By default this value is :any:`POSITIVE_INFINITY`. :param val: The maximum number of rules. :type val: int | PositiveInfinity -:return: ``self``. +:return: *self*. :rtype: KnuthBendix .. seealso:: :any:`Runner.run`. @@ -337,7 +337,7 @@ two words in the system is measured. :param val: The overlap policy. :type val: overlap -:return: ``self``. +:return: *self*. :rtype: KnuthBendix .. seealso:: :any:`overlap`. diff --git a/src/konieczny.cpp b/src/konieczny.cpp index ae826a40c..dbe1fb45c 100644 --- a/src/konieczny.cpp +++ b/src/konieczny.cpp @@ -112,7 +112,7 @@ times. :param x: the generator to add. :type x: Element -:returns: ``self``. +:returns: *self*. :rtype: Konieczny :raises LibsemigroupsError: @@ -138,7 +138,7 @@ See :any:`Konieczny.add_generator` for a detailed description. :param coll: the collection of generators to add. :type coll: list[Element] -:returns: ``self``. +:returns: *self*. :rtype: Konieczny :raises LibsemigroupsError: @@ -431,7 +431,7 @@ and ``False`` if it is not. :param x: a possible element. :type x: Element -:returns: Whether or not *x* belongs to ``self``. +:returns: Whether or not *x* belongs to *self*. :rtype: bool )pbdoc"); thing.def("number_of_D_classes", diff --git a/src/matrix.cpp b/src/matrix.cpp index fe33e7f90..bbcf8bfee 100644 --- a/src/matrix.cpp +++ b/src/matrix.cpp @@ -604,8 +604,8 @@ of rows. :type x: Matrix :complexity: - :math:`O(r ^ 2 c)` where :math:`r` is the number of rows in ``x`` - and :math:`c` is the number of columns in ``x``. + :math:`O(r ^ 2 c)` where :math:`r` is the number of rows in *x* + and :math:`c` is the number of columns in *x*. :returns: A basis for the row space of *x*. :rtype: list[list[int | PositiveInfinity | NegativeInfinity]] diff --git a/src/paths.cpp b/src/paths.cpp index 3e4f3a2f6..4590ac693 100644 --- a/src/paths.cpp +++ b/src/paths.cpp @@ -109,7 +109,7 @@ been newly constructs from the :any:`WordGraph` *wg*. :param wg: the word graph. :type wg: WordGraph -:returns: ``self`` +:returns: *self* :rtype: Paths )pbdoc"); @@ -230,7 +230,7 @@ contain paths of unbounded length (possibly infinitely many). :param val: the maximum path length. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: Paths )pbdoc"); thing1.def( @@ -268,7 +268,7 @@ contain paths starting with length ``0``. :param val: the minimum path length. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: Paths )pbdoc"); thing1.def( @@ -311,11 +311,11 @@ a :any:`Paths` object. The initial value is :any:`Order.shortlex`. :param val: the order of the paths in the range. :type val: Order -:returns: ``self``. +:returns: *self*. :rtype: Paths :raises LibsemigroupsError: - if ``val`` is not :any:`Order.shortlex` or :any:`Order.lex`. + if *val* is not :any:`Order.shortlex` or :any:`Order.lex`. )pbdoc"); thing1.def( "source", @@ -342,11 +342,11 @@ set the source node of all of the paths in the range. :param n: the source node. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: Paths :raises LibsemigroupsError: - if ``n`` is not a node in the underlying :any:`WordGraph` (:any:`word_graph`). + if *n* is not a node in the underlying :any:`WordGraph` (:any:`word_graph`). )pbdoc"); thing1.def( "target", @@ -378,7 +378,7 @@ node is set to :any:`UNDEFINED`, then the range will contain every path from :param n: the target node. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: Paths :raises LibsemigroupsError: diff --git a/src/pbr.cpp b/src/pbr.cpp index 07824ce4c..95525ad39 100644 --- a/src/pbr.cpp +++ b/src/pbr.cpp @@ -107,7 +107,7 @@ Compare for less. :param that: a PBR to compare with. :type that: PBR -:returns: ``True`` if ``self`` is less than ``that``, and ``False`` otherwise. +:returns: ``True`` if *self* is less than *that*, and ``False`` otherwise. :rtype: bool :complexity: At worst linear in :any:`PBR.degree`. @@ -120,7 +120,7 @@ Compare two PBRs for equality. :param that: a PBR to compare with. :type that: PBR -:returns: ``True`` if ``self`` equals ``that``, and ``False`` otherwise. +:returns: ``True`` if *self* equals *that*, and ``False`` otherwise. :rtype: bool :complexity: At worst linear in :any:`PBR.degree`. @@ -141,13 +141,13 @@ Compare two PBRs for equality. R"pbdoc( Multiply two PBRs. -Returns a newly constructed PBR equal to the product of ``self`` and +Returns a newly constructed PBR equal to the product of *self* and *that*. :param that: a PBR. type that: PBR -:returns: ``self`` * *that* +:returns: *self* * *that* :rtype: PBR :complexity: @@ -205,7 +205,7 @@ Returns the number of points of a :any:`PBR`. py::arg("y"), py::arg("thread_id") = 0, R"pbdoc( -Multiply two PBR objects and store the product in ``self``. +Multiply two PBR objects and store the product in *self*. The parameter *thread_id* is required since some temporary storage is required to find the product of *x* and *y*. Note that if different @@ -221,7 +221,7 @@ then bad things will happen. :raises LibsemigroupsError: if: * the :any:`PBR.degree` of *x* is not the same as the :any:`PBR.degree` of *y*; - * the :any:`PBR.degree` of ``self`` is not the same as the :any:`PBR.degree` of *x*; or + * the :any:`PBR.degree` of *self* is not the same as the :any:`PBR.degree` of *x*; or * either *x* or *y* is the same object as `self`. )pbdoc"); thing.def( diff --git a/src/present.cpp b/src/present.cpp index 1d06642a1..b52c861e9 100644 --- a/src/present.cpp +++ b/src/present.cpp @@ -125,10 +125,10 @@ order of letters to be a-zA-Z0-9. :param n: the size of the alphabet. :type n: int -:returns: ``self`` +:returns: *self* :rtype: Presentation -:raises LibsemigroupsError: if the value of ``n`` is greater than the +:raises LibsemigroupsError: if the value of *n* is greater than the maximum number of letters supported by :ref:`Letter`. .. seealso:: @@ -152,7 +152,7 @@ Sets the alphabet to be the letters in *lphbt*. :param lphbt: the alphabet. :type lphbt: :ref:`Word` -:returns: ``self`` +:returns: *self* :rtype: Presentation :raises LibsemigroupsError: if there are duplicate letters in *lphbt*. @@ -169,7 +169,7 @@ Sets the alphabet to be the letters in *lphbt*. Set the alphabet to be the letters in the rules. -:returns: ``self`` +:returns: *self* :rtype: Presentation :complexity: At most :math:`O(mn)` where :math:`m` is the number of rules, @@ -222,7 +222,7 @@ monoid, but is not given as a quotient of a free monoid. :param val: whether the presentation can contain the empty word. :type val: bool -:returns: ``self`` +:returns: *self* :rtype: Presentation :complexity: Constant @@ -276,7 +276,7 @@ Remove the alphabet and all rules. This function clears the alphabet and all rules from the presentation, putting it back into the state it would be in if it was newly constructed. -:returns: ``self``. +:returns: *self*. :rtype: Presentation )pbdoc"); thing.def("letter", @@ -338,7 +338,7 @@ Check if a letter belongs to the alphabet or not. :param c: the letter to check. :type c: :ref:`Letter` -:raises LibsemigroupsError: if ``c`` does not belong to the alphabet. +:raises LibsemigroupsError: if *c* does not belong to the alphabet. :complexity: Constant on average, worst case linear in the size of the alphabet.)pbdoc"); @@ -397,7 +397,7 @@ Add the letter *x* as a generator. :param x: the letter to add as a generator. :type x: :ref:`Letter` -:returns: ``self``. +:returns: *self*. :rtype: Presentation. :raises LibsemigroupsError: if *x* is in ``alphabet()``.)pbdoc"); @@ -414,7 +414,7 @@ Remove the letter *x* as a generator. :param x: the letter to remove as a generator. :type x: :ref:`Letter` -:returns: ``self``. +:returns: *self*. :rtype: Presentation. :raises LibsemigroupsError: if *x* is not in `p.alphabet()`. @@ -1247,14 +1247,14 @@ checks that :math:`v_i = x_j`, and therefore that :math:`(x_i^{-1})^{-1} = x`. :type vals: :ref:`Word` :raises LibsemigroupsError: - if the length of ``vals`` is not the same as the length of + if the length of *vals* is not the same as the length of ``p.alphabet()``. :raises LibsemigroupsError: - if ``vals`` contains letters not in the alphabet. + if *vals* contains letters not in the alphabet. :raises LibsemigroupsError: - if ``vals`` contains duplicate letters. + if *vals* contains duplicate letters. :raises LibsemigroupsError: - if the values in ``vals`` do not serve as semigroup inverses. + if the values in *vals* do not serve as semigroup inverses. )pbdoc"); } // bind_present @@ -1349,7 +1349,7 @@ Set the inverse of each letter in the alphabet. :param w: a word containing the inverses. :type w: :ref:`Word` -:returns: ``self``. +:returns: *self*. :rtype: InversePresentation :raises LibsemigroupsError: diff --git a/src/runner.cpp b/src/runner.cpp index 48178fb4c..a67c93c19 100644 --- a/src/runner.cpp +++ b/src/runner.cpp @@ -39,13 +39,13 @@ namespace libsemigroups { The time between the given point and now. :param t: - the time point + the time point. :type t: datetime.timedelta :returns: - The difference between the time point ``t`` and now. + The difference between the time point *t* and now. :rtype: datetime.timedelta @@ -94,7 +94,7 @@ Initialize an existing Reporter object. This function puts a :any:`Reporter` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: Reporter .. seealso:: :any:`Reporter()` @@ -132,7 +132,7 @@ return ``True`` again after at least time ``s + val`` has elapsed. :param val: the amount of time between reports. :type val: datetime.timedelta -:returns: ``self``. +:returns: *self*. :rtype: Reporter .. seealso:: :any:`report_every` @@ -169,7 +169,7 @@ which is also the time of construction of a :any:`Reporter` instance if R"pbdoc( Reset the start time (and last report) to now. -:returns: ``self``. +:returns: *self*. :rtype: Reporter )pbdoc"); thing.def("last_report", @@ -193,7 +193,7 @@ last report, as set by one of: R"pbdoc( Set the last report time point to now. -:returns: ``self``. +:returns: *self*. :rtype: Reporter @@ -214,7 +214,7 @@ being run at the outmost level. :param val: the new value of the report prefix. :type val: str -:returns: ``self``. +:returns: *self*. :rtype: Reporter )pbdoc"); thing.def( @@ -306,7 +306,7 @@ Initialize an existing Runner object. This function puts a :any:`Runner` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: Runner .. seealso:: :any:`Runner()` @@ -336,7 +336,7 @@ any derived class of :any:`Runner`. .. seealso:: :any:`run_for`)pbdoc"); thing.def("run_until", - (void(Runner::*)(std::function&)) & Runner::run_until, + (void (Runner::*)(std::function&)) &Runner::run_until, py::arg("func"), R"pbdoc( Run until a nullary predicate returns true or finished. @@ -455,9 +455,9 @@ other words, it checks if :any:`timed_out()`, :any:`finished()`, or &Runner::stopped_by_predicate, R"pbdoc( Check if the runner was stopped, or should stop, because of the argument -last passed to run_until. If ``self`` is running, then the nullary -predicate is called and its return value is returned. If ``self`` is not -running, then ``True`` is returned if and only if the last time ``self`` +last passed to run_until. If *self* is running, then the nullary +predicate is called and its return value is returned. If *self* is not +running, then ``True`` is returned if and only if the last time *self* was running it was stopped by a call to the nullary predicate passed to :any:`run_until()`. diff --git a/src/schreier-sims.cpp b/src/schreier-sims.cpp index 884ddc3fb..c95b38c38 100644 --- a/src/schreier-sims.cpp +++ b/src/schreier-sims.cpp @@ -127,7 +127,7 @@ not already an element of the group represented by the Schreier-Sims object. :rtype: bool :raises LibsemigroupsError: if the degree of *x* is not equal to :math:`255` - or :math:`511`, or if ``self`` already contains the maximum number of + or :math:`511`, or if *self* already contains the maximum number of elements. :complexity: Constant @@ -249,10 +249,10 @@ This function returns the generator with a given index. Reset to the trivial group. -This function removes all generators, and orbits, and resets ``self`` so that it -represents the trivial group, as if ``self`` had been newly constructed. +This function removes all generators, and orbits, and resets *self* so that it +represents the trivial group, as if *self* had been newly constructed. -:returns: ``self``. +:returns: *self*. :rtype: SchreierSims :complexity: Constant. @@ -351,7 +351,7 @@ Check if a point is in the orbit of a basepoint. :returns: ``True`` if the point *pt* is in the orbit of the base point of - ``self`` at depth *depth*, and ``False`` otherwise. + *self* at depth *depth*, and ``False`` otherwise. :rtype: bool :raises LibsemigroupsError: @@ -406,7 +406,7 @@ Sift an element through the stabiliser chain in-place. R"pbdoc( :sig=(self: SchreierSims) -> int: -Returns the size of the group represented by ``self``. +Returns the size of the group represented by *self*. :returns: the size of the group. :rtype: int diff --git a/src/sims.cpp b/src/sims.cpp index b400cf059..e16131dca 100644 --- a/src/sims.cpp +++ b/src/sims.cpp @@ -1559,8 +1559,8 @@ constructed from the presentation *p*. :returns: The first argument *self*. :rtype: SimsRefinerIdeals -:raises LibsemigroupsError: if ``p`` is not valid -:raises LibsemigroupsError: if ``p`` has 0-generators and 0-relations. +:raises LibsemigroupsError: if *p* is not valid +:raises LibsemigroupsError: if *p* has 0-generators and 0-relations. .. seealso:: :py:meth:`~Sims1.presentation` )pbdoc"); diff --git a/src/stephen.cpp b/src/stephen.cpp index 7bc2a3033..f669ae460 100644 --- a/src/stephen.cpp +++ b/src/stephen.cpp @@ -130,7 +130,7 @@ already), and then returns the accept state of the produced word graph. // This function puts a :any:`Stephen` object back into the same state as // if it had been newly constructed. If there are // - // :returns: ``self``. + // :returns: *self*. // :rtype: Stephen // )pbdoc"); thing.def( @@ -149,7 +149,7 @@ had been newly constructed from the presentation *p*. :param p: the presentation. :type p: Presentation | InversePresentation -:returns: ``self``. +:returns: *self*. :rtype: Stephen )pbdoc"); thing.def("is_word_set", @@ -185,7 +185,7 @@ scratch. :param other: the Stephen instance to append. :type other: Stephen -:returns: ``self``. +:returns: *self*. :rtype: Stephen :raises LibsemigroupsError: @@ -227,7 +227,7 @@ This function sets the word whose left factors, or equivalent words, are sought. :param word: the word to be set. :type word: list[int] -:returns: ``self``. +:returns: *self*. :rtype: Stephen :raises LibsemigroupsError: diff --git a/src/todd-coxeter-impl.cpp b/src/todd-coxeter-impl.cpp index 35d9afebd..337d1f564 100644 --- a/src/todd-coxeter-impl.cpp +++ b/src/todd-coxeter-impl.cpp @@ -349,7 +349,7 @@ that it would have been in if it had just been newly constructed from :param tc: the :any:`ToddCoxeter` instance. :type tc: ToddCoxeter -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: @@ -384,7 +384,7 @@ that it would have been in if it had just been newly constructed from :param wg: the word graph. :type wg: WordGraph -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); @@ -427,7 +427,7 @@ The default value of this setting is ``2000``. :param val: the maximum size of the definition stack. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -465,7 +465,7 @@ This function can be used to specify how to handle definitions. For details see :param val: the policy to use. :type val: options.def_policy -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); @@ -554,7 +554,7 @@ The default value of this setting is ``10 ** 5``. :param val: the value to use. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: if *val* is ``0``. @@ -615,7 +615,7 @@ The default value of this setting is ``2 * 10 ** 5``. :param val: the value to use. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: if *val* is ``0``. @@ -673,7 +673,7 @@ The default value of this setting is ``100000``. :param val: the value to use. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -710,7 +710,7 @@ default value of this setting is ``options.lookahead_extent.partial``. :param val: the extent. :type val: options.lookahead_extent -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -753,7 +753,7 @@ is of this setting is ``2.0``. :param val: the value indicating the lookahead growth factor. :type val: float -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: if *val* is less than ``1.0``. @@ -796,7 +796,7 @@ active nodes divided by :any:`lookahead_growth_threshold`, then the value of :param val: the value indicating the lookahead growth threshold. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -836,7 +836,7 @@ value for :any:`lookahead_next()`. The default value is ``10 ** 4``. :param val: value indicating the minimum value of lookahead_next. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -874,7 +874,7 @@ lookahead of style :any:`ToddCoxeter.lookahead_style` and extent :param val: value indicating the initial threshold. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -921,7 +921,7 @@ The default value is 1 second. :param val: the new value for the interval. :type val: datetime.timedelta -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -966,7 +966,7 @@ result in many nodes being killed). :param val: the proportion of active nodes. :type val: float -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: @@ -1007,7 +1007,7 @@ The default value of this setting is ``options.lookahead_style.hlt``. :param val: the style of lookahead to use. :type val: options.lookahead_style -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -1049,7 +1049,7 @@ nodes when there is no possibility of finding coincidences.The default value is :param val: value indicating the lower bound. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -1085,7 +1085,7 @@ is ``False``. :param val: value indicating whether or not to process deductions. :type val: bool -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -1119,7 +1119,7 @@ The default value is :any:`options.strategy`. :param val: value indicating which strategy to use. :type val: options.strategy -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); thing.def( @@ -1160,7 +1160,7 @@ specifies whether or not to do this.The default value of this setting is :param val: the boolean value. :type val: bool -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter )pbdoc"); diff --git a/src/todd-coxeter.cpp b/src/todd-coxeter.cpp index 80a760c5e..af4ddfee6 100644 --- a/src/todd-coxeter.cpp +++ b/src/todd-coxeter.cpp @@ -178,7 +178,7 @@ that it would have been in if it had just been newly constructed from :param tc: the :any:`ToddCoxeter` instance. :type tc: ToddCoxeter -:returns: ``self``. +:returns: *self*. :rtype: ToddCoxeter :raises LibsemigroupsError: diff --git a/src/transf.cpp b/src/transf.cpp index 9180be7fa..06d25f3f8 100644 --- a/src/transf.cpp +++ b/src/transf.cpp @@ -189,12 +189,12 @@ yielding these values. R"pbdoc( :sig=(self: {0}) -> {0}: -Increases the degree of ``self`` in-place, leaving existing values unaltered. +Increases the degree of *self* in-place, leaving existing values unaltered. :param m: the number of points to add. :type m: int -:returns: ``self`` +:returns: *self* :rtype: {0} :complexity: diff --git a/src/ukkonen.cpp b/src/ukkonen.cpp index bd308345a..a23875658 100644 --- a/src/ukkonen.cpp +++ b/src/ukkonen.cpp @@ -773,7 +773,7 @@ Initialize an existing Ukkonen object. This function puts an :any:`Ukkonen` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: Ukkonen .. seealso:: diff --git a/src/word-graph.cpp b/src/word-graph.cpp index 51924a5d9..9b5eb4f08 100644 --- a/src/word-graph.cpp +++ b/src/word-graph.cpp @@ -149,7 +149,7 @@ added. :param nr: the number of nodes to add. :type nr: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: Linear in ``(number_of_nodes() + nr) * out_degree()``.)pbdoc"); @@ -166,7 +166,7 @@ increased by *nr*. :param nr: the number of new out-edges for every node. :type nr: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: :math:`O(mn)` where ``m`` is the number of nodes, and ``n`` is @@ -237,11 +237,11 @@ disjoint union of itself and *that*. The node ``n`` of *that* is mapped to :param that: the word graph to unite. :type that: WordGraph -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :raises LibsemigroupsError: - if ``self`` and *that* do not have the same out-degree. + if *self* and *that* do not have the same out-degree. )pbdoc"); thing.def( @@ -263,7 +263,7 @@ subgraph induced by the range of nodes *first* to *last*. :param last: one more than the last node. :type last: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :raises LibsemigroupsError: if *first* or *last* is out of range. @@ -293,7 +293,7 @@ had just been newly constructed with the same parameters *m* and *n*. :param n: the out-degree of every node. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: @@ -356,7 +356,7 @@ equal to *a* that is incident to the node *s*. If ``target(s, b)`` equals :complexity: At worst :math:`O(n)` where :math:`n` equals :any:`out_degree()`. :raises LibsemigroupsError: - if *s* does not represent a node in ``self``. + if *s* does not represent a node in *self*. )pbdoc"); // TODO(1) should we check that `a` is valid in the previous? thing.def( @@ -429,7 +429,7 @@ in the word graph. Remove all of the edges in the word graph. Set every target of every source with every possible label to :any:`UNDEFINED`. -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: @@ -448,7 +448,7 @@ This reduces the out-degree by ``1``. :param a: the label to remove. :type a: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :raises LibsemigroupsError: if *a* is out of range. @@ -468,7 +468,7 @@ This function removes the edge with source node *s* labelled by *a*. :param a: the label of the edge from s. :type a: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: Constant. @@ -491,11 +491,12 @@ This function ensures that the word graph has capacity for *m* nodes and :param n: the out-degree. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph -:complexity: :math:`O(mn)` where ``m`` is the number of nodes and ``n`` is the - out-degree.)pbdoc"); +:complexity: + :math:`O(mn)` where *m* is the number of nodes and *n* is the + out-degree.)pbdoc"); thing.def("swap_targets", &WordGraph_::swap_targets, py::arg("m"), @@ -516,7 +517,7 @@ with the target of the edge from the node *n* labelled *a*. :param a: the label. :type a: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :complexity: Constant @@ -534,7 +535,7 @@ with the target of the edge from the node *n* labelled *a*. R"pbdoc( Add an edge from one node to another with a given label. -If *s* and *t* are nodes in ``self``, and *a* is in the range ``[0, +If *s* and *t* are nodes in *self*, and *a* is in the range ``[0, out_degree())``, then this function adds an edge from *a* to *b* labelled *a*. :param s: the source node. @@ -546,7 +547,7 @@ out_degree())``, then this function adds an edge from *a* to *b* labelled *a*. :param t: the range node. :type t: int -:returns: ``self``. +:returns: *self*. :rtype: WordGraph :raises LibsemigroupsError: if *s*, *a*, or *t* is not valid. @@ -1171,7 +1172,7 @@ reachable from *source*. :rtype: int :raises LibsemigroupsError: - if ``source`` is out of bounds (greater than or equal to + if *source* is out of bounds (greater than or equal to :any:`WordGraph.number_of_nodes`).)pbdoc"); m.def( diff --git a/src/word-range.cpp b/src/word-range.cpp index fb46049e9..bf1ae66ff 100644 --- a/src/word-range.cpp +++ b/src/word-range.cpp @@ -205,7 +205,7 @@ then the object will be empty. :param frst: the first word. :type frst: list[int] -:returns: ``self``. +:returns: *self*. :rtype: WordRange .. seealso:: :any:`WordRange.min` @@ -229,7 +229,7 @@ Initialize an existing :any:`WordRange` object. This function puts a :any:`WordRange` object back into the same state as if it had been newly default constructed, and returns that object. -:returns: ``self``. +:returns: *self*. :rtype: WordRange )pbdoc"); thing1.def( @@ -260,7 +260,7 @@ greater than :any:`WordRange.alphabet_size()`, then the :any:`WordRange` object :param lst: one past the last word. :type lst: list[int] -:returns: ``self``. +:returns: *self*. :rtype: WordRange .. seealso:: @@ -279,7 +279,7 @@ Sets one past the last word in a :any:`WordRange` object to be :param val: the exponent. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: WordRange )pbdoc"); thing1.def( @@ -290,12 +290,12 @@ Sets one past the last word in a :any:`WordRange` object to be Set the first word in the range by length. Sets the first word in a :any:`WordRange` object to be ``pow(0_w, val)`` -(the word consisting of ``val`` letters equal to ``0`` ). +(the word consisting of *val* letters equal to ``0`` ). :param val: the exponent. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: WordRange )pbdoc"); thing1.def("next", @@ -332,7 +332,7 @@ Sets the number of letters in a :any:`WordRange` object to *n*. :param n: the number of letters. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: WordRange )pbdoc"); thing1.def( @@ -360,7 +360,7 @@ Sets the order of the words in a :any:`WordRange` object to *val*. :param val: the order. :type val: Order -:returns: ``self``. +:returns: *self*. :rtype: WordRange :raises LibsemigroupsError: if val is not :any:`Order.shortlex` or :any:`Order.lex`. @@ -405,7 +405,7 @@ This setting is only used if :any:`WordRange.order()` is :any:`Order.lex`. :param n: the upper bound. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: WordRange )pbdoc"); thing1.def("valid", @@ -570,7 +570,7 @@ Sets the alphabet in a :any:`StringRange` object. :param x: the alphabet. :type x: str -:returns: ``self``. +:returns: *self*. :rtype: StringRange :raises LibsemigroupsError: if *x* contains repeated letters. @@ -645,7 +645,7 @@ Sets the first string in a :any:`StringRange` object to be *frst*. :param frst: the first string. :type frst: str -:returns: ``self``. +:returns: *self*. :rtype: StringRange .. seealso:: :any:`min` @@ -669,7 +669,7 @@ Initialize an existing :any:`StringRange` object. This function puts a :any:`StringRange` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: StringRange )pbdoc"); thing2.def( @@ -700,7 +700,7 @@ Sets one past the last string in a :any:`StringRange` object to be *lst*. :param lst: the first string. :type lst: str -:returns: ``self``. +:returns: *self*. :rtype: StringRange :raises LibsemigroupsError: if *lst* contains letters not belonging to :any:`StringRange.alphabet()`. @@ -725,7 +725,7 @@ corresponds to *val*. :param val: the exponent. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: StringRange )pbdoc"); thing2.def( @@ -745,7 +745,7 @@ corresponds to *val*. :param val: the exponent. :type val: int -:returns: ``self``. +:returns: *self*. :rtype: StringRange )pbdoc"); thing2.def("next", @@ -783,7 +783,7 @@ Sets the order of the strings in a :any:`StringRange` object to *val*. :param val: the order. :type val: Order -:returns: ``self``. +:returns: *self*. :rtype: StringRange :raises LibsemigroupsError: if *val* is not :any:`Order.shortlex` or :any:`Order.lex`. @@ -828,7 +828,7 @@ This setting is only used if :any:`StringRange.order()` is :any:`Order.lex`. :param n: the upper bound. :type n: int -:returns: ``self``. +:returns: *self*. :rtype: StringRange )pbdoc"); @@ -943,7 +943,7 @@ Initialize an existing ToWord object. This function puts a :any:`ToWord` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: ToWord .. seealso:: @@ -965,7 +965,7 @@ been newly constructed from *alphabet*. :param alphabet: the alphabet. :type alphabet: str -:returns: ``self``. +:returns: *self*. :rtype: ToWord :raises LibsemigroupsError: if there are repeated letters in *alphabet*. @@ -1105,7 +1105,7 @@ Initialize an existing ToString object. This function puts a :any:`ToString` object back into the same state as if it had been newly default constructed. -:returns: ``self``. +:returns: *self*. :rtype: ToString .. seealso:: @@ -1127,7 +1127,7 @@ had been newly constructed from *alphabet*. :param alphabet: the alphabet. :type alphabet: str -:returns: ``self``. +:returns: *self*. :rtype: ToString :raises LibsemigroupsError: if there are repeated letters in *alphabet*.