diff --git a/docs/source/data-structures/presentations/to-inverse-present.rst b/docs/source/data-structures/presentations/to-inverse-present.rst index 77bf5d854..6a81c712c 100644 --- a/docs/source/data-structures/presentations/to-inverse-present.rst +++ b/docs/source/data-structures/presentations/to-inverse-present.rst @@ -53,8 +53,7 @@ of the returned :any:`InversePresentation` will be :math:`\{0, 1, \dots, n-1, n, \dots, 2n-1\}`, where the inverse of letter :math:`i` is the letter :math:`i + n\, (\text{mod }2n)`. -This function throws a :any:`LibsemigroupsError` if -``p.throw_if_bad_alphabet_or_rules()`` throws. +This function raises an exception if ``p.throw_if_bad_alphabet_or_rules()`` does. .. seealso:: @@ -119,9 +118,9 @@ letter is of type ``str``, then the conversion from one type to another is of type ``list[int]``, then the conversion from one type to another is :math:`a_i \mapsto` ``human_readable_letter(a_i)``. -This function throws a :any:`LibsemigroupsError` if the type of words in *ip* is -not the same as that specified in *rtype* and -``p.throw_if_bad_alphabet_rules_or_inverses()`` throws. +This function raises a :any:`LibsemigroupsError` if the type of words in *ip* is +not the same as that specified in *rtype* or +``p.throw_if_bad_alphabet_rules_or_inverses()`` raises. .. seealso:: @@ -177,8 +176,8 @@ This function returns an :any:`InversePresentation` equivalent to the input parameter *f* specifies how to map the letters of one :any:`InversePresentation` to the other. -This function throws a :any:`LibsemigroupsError` if -``ip.throw_if_bad_alphabet_rules_or_inverses()`` throws, or if the function +This function raises a :any:`LibsemigroupsError` if +``ip.throw_if_bad_alphabet_rules_or_inverses()`` raises, or if the function specified by *f* does not map letters of the type used in *ip* to letters of the type of word specified in *rtype*. diff --git a/docs/source/data-structures/presentations/to-present.rst b/docs/source/data-structures/presentations/to-present.rst index 4401204bd..075b0dc92 100644 --- a/docs/source/data-structures/presentations/to-present.rst +++ b/docs/source/data-structures/presentations/to-present.rst @@ -72,9 +72,9 @@ letter is of type ``str``, then the conversion from one type to another is of type ``list[int]``, then the conversion from one type to another is :math:`a_i \mapsto` ``human_readable_letter(a_i)``. -This function throws a :any:`LibsemigroupsError` if the type of words in *p* is -not the same as that specified in *rtype*, and -``p.throw_if_bad_alphabet_or_rules()`` throws. +This function raises a :any:`LibsemigroupsError` if the type of words in *p* is +not the same as that specified in *rtype*, or +``p.throw_if_bad_alphabet_or_rules()`` raises. .. seealso:: @@ -128,8 +128,8 @@ example, can be used to convert from :any:`str` to :any:`int`). The second parameter *f* specifies how to map the letters of one :any:`Presentation` to the other. -This function throws a :any:`LibsemigroupsError` if -``p.throw_if_bad_alphabet_or_rules()`` throws, or if the function specified by +This function raises a :any:`LibsemigroupsError` if +``p.throw_if_bad_alphabet_or_rules()`` raises, or if the function specified by *f* does not map letters of the type used in *p* to letters of the type of word specified in *rtype*. diff --git a/docs/source/main-algorithms/froidure-pin/to-froidure-pin.rst b/docs/source/main-algorithms/froidure-pin/to-froidure-pin.rst index a4122eed6..287a5d09b 100644 --- a/docs/source/main-algorithms/froidure-pin/to-froidure-pin.rst +++ b/docs/source/main-algorithms/froidure-pin/to-froidure-pin.rst @@ -52,7 +52,7 @@ The :any:`FroidurePin` object returned is isomorphic to the quotient of the underlying semigroup or monoid of *cong* by the congruence represented by *cong*. -This function throws a :any:`LibsemigroupsError` if ``cong.kind`` is not +This function raises a :any:`LibsemigroupsError` if ``cong.kind`` is not ``congruence_kind.twosided``. .. doctest:: Python @@ -95,7 +95,7 @@ Additionally, specify the following for *rtype*: The :any:`FroidurePin` object returned is isomorphic to the quotient semigroup or monoid represented by *k*. -This function throws a :any:`LibsemigroupsError` if the +This function raises a :any:`LibsemigroupsError` if the :any:`Kambites.small_overlap_class` of *k* is not at least :math:`4`. .. warning:: @@ -145,7 +145,7 @@ Additionally, specify the following for *rtype*: The :any:`FroidurePin` object returned is isomorphic to the quotient semigroup or monoid represented by *kb*. -This function throws a :any:`LibsemigroupsError` if ``kb.kind()`` is not +This function raises a :any:`LibsemigroupsError` if ``kb.kind()`` is not ``congruence.twosided``. .. doctest:: Python @@ -189,7 +189,7 @@ Additionally, specify the following for *rtype*: The :any:`FroidurePin` object returned is isomorphic to the quotient semigroup or monoid represented by *tc*. -This function throws a :any:`LibsemigroupsError` if ``tc.kind()`` is not +This function raises a :any:`LibsemigroupsError` if ``tc.kind()`` is not ``congruence.twosided``. .. doctest:: Python @@ -257,8 +257,8 @@ satisfies :math:`\{a, \ldots, b - 1\}f \subseteq \{a, \ldots, b - 1\}`, then this function returns the :any:`FroidurePin` object corresponding to the semigroup or monoid generated by the set of all such transformations. -This function throws a :any:`LibsemigroupsError` if -``throw_if_image_value_out_of_range`` throws for any of the constructed +This function raises a :any:`LibsemigroupsError` if +``throw_if_image_value_out_of_range`` raises for any of the constructed generators. This can happen if, for example, the :any:`WordGraph` is not complete (i.e. there exists an edge label and node for which there is no edge with the given label and given source) or if there is an edge label such that diff --git a/src/aho-corasick.cpp b/src/aho-corasick.cpp index 7509621e5..822617f01 100644 --- a/src/aho-corasick.cpp +++ b/src/aho-corasick.cpp @@ -109,7 +109,8 @@ This function returns the index of the child of the node with index :returns: The index of the child. :rtype: int | Undefined -:raises LibsemigroupsError: if ``throw_if_node_index_not_active(parent)`` raises an exception. +:raises LibsemigroupsError: + if ``throw_if_node_index_not_active(parent)`` raises an exception. :complexity: Constant. @@ -129,7 +130,8 @@ Calculate the height of a node. :returns: The height. :rtype: int -:raises LibsemigroupsError: if ``throw_if_node_index_not_active(i)`` raises an exception. +:raises LibsemigroupsError: + if ``throw_if_node_index_not_active(i)`` raises an exception. :complexity: Linear in the return value which is, at worst, the maximum length @@ -205,7 +207,8 @@ the longest proper suffix of :math:`W` contained in the trie. :returns: The index of the suffix link. :rtype: int -:raises LibsemigroupsError: if ``throw_if_node_index_not_active(current)`` raises an exception. +:raises LibsemigroupsError: + if ``throw_if_node_index_not_active(current)`` raises an exception. :complexity: Linear in the height of the node. @@ -257,8 +260,8 @@ Check if an index corresponds to a node currently in the trie. :type i: int :raises LibsemigroupsError: - if ``throw_if_node_index_out_of_range(i)`` raises an exception, or if *i* is - not an active node. + if ``throw_if_node_index_out_of_range(i)`` raises an exception, or if *i* is + not an active node. :complexity: Constant diff --git a/src/forest.cpp b/src/forest.cpp index e8b0116e3..9ccbbd3f8 100644 --- a/src/forest.cpp +++ b/src/forest.cpp @@ -98,8 +98,8 @@ Construct a :any:`Forest` from lists of *parents* and *labels*. positions (these values indicate where the roots of the trees in the forest are located and so must coincide). :raises LibsemigroupsError: - if :any:`set_parent_and_label` throws for ``parents[i]`` and ``labels[i]`` - for any value of ``i``. + if :any:`set_parent_and_label` raises an exception for ``parents[i]`` and + ``labels[i]`` for any value of ``i``. )pbdoc"); thing.def("add_nodes", diff --git a/src/present.cpp b/src/present.cpp index d367baf17..a74f0b0a0 100644 --- a/src/present.cpp +++ b/src/present.cpp @@ -861,8 +861,8 @@ alphabet is already normalized, then no changes are made to the presentation. :type p: Presentation :raises LibsemigroupsError: - if :any:`Presentation.throw_if_bad_alphabet_or_rules` throws on the initial - presentation.)pbdoc"); + if :any:`Presentation.throw_if_bad_alphabet_or_rules` raises an exception on + the initial presentation.)pbdoc"); m.def("presentation_reduce_complements", &presentation::reduce_complements, py::arg("p"), @@ -1294,8 +1294,10 @@ an exception is thrown. :param p: the presentation. :type p: Presentation -:raises LibsemigroupsError: if :any:`throw_if_bad_alphabet_or_rules` throws. -:raises LibsemigroupsError: if conflicting inverses for any letter are detected.)pbdoc"); +:raises LibsemigroupsError: + if :any:`throw_if_bad_alphabet_or_rules` raises an exception. +:raises LibsemigroupsError: + if conflicting inverses for any letter are detected.)pbdoc"); m.def( "presentation_balance", @@ -1319,14 +1321,16 @@ parameter is defined to be ``p.alphabet()``. :param inverses: the inverses of the letters. :type inverses: :ref:`Word` -:raises LibsemigroupsError: if :any:`throw_if_bad_alphabet_or_rules` throws. +:raises LibsemigroupsError: + if :any:`throw_if_bad_alphabet_or_rules` raises an exception. :raises LibsemigroupsError: - if :any:`throw_if_bad_inverses` throws when called with ``p.alphabet()`` and - ``inverses``. This function does not check that the values in ``inverses`` - are actually inverses for the values in ``p.alphabet()``, and balances the - relations as described in :any:`balance` assuming that this is the - case.)pbdoc"); + if :any:`throw_if_bad_inverses` raises an exception when called with + ``p.alphabet()`` and ``inverses``. This function does not check that the + values in ``inverses`` are actually inverses for the values in + ``p.alphabet()``, and balances the relations as described in :any:`balance` + assuming that this is the case. +)pbdoc"); m.def( "presentation_balance", @@ -1360,12 +1364,13 @@ appended to the front of the right-hand side. :param inverses: the inverses of the letters. :type inverses: :ref:`Word` -:raises LibsemigroupsError: if :any:`throw_if_bad_alphabet_or_rules` throws. +:raises LibsemigroupsError: + if :any:`throw_if_bad_alphabet_or_rules` raises an exception. :raises LibsemigroupsError: - if :any:`throw_if_bad_inverses` throws when called with *letters* and - *inverses*. This does not check that the values in *inverses* are - actually inverses for the values in *letters*, and balances the relations + if :any:`throw_if_bad_inverses` raises an exception when called with + *letters* and *inverses*. This does not check that the values in *inverses* + are actually inverses for the values in *letters*, and balances the relations as described above. )pbdoc"); @@ -1428,7 +1433,8 @@ This function returns the minimum index ``i`` of *lhs* such that ``p.rules[i + :returns: The index of the rule or :any:`UNDEFINED`. :rtype: int | Undefined -:raises LibsemigroupsError: if ``p.throw_if_bad_alphabet_or_rules()`` throws. +:raises LibsemigroupsError: + if ``p.throw_if_bad_alphabet_or_rules()`` raises an exception. )pbdoc"); m.def( @@ -1479,7 +1485,7 @@ and *rhs* is the next item in ``p.rules``. :rtype: bool :raises LibsemigroupsError: - if :any:`Presentation.throw_if_bad_alphabet_or_rules` throws. + if :any:`Presentation.throw_if_bad_alphabet_or_rules` raises an exception. )pbdoc"); m.def( @@ -1513,7 +1519,7 @@ raised. :rtype: tuple[str | list[int], str | list[int]] :raises LibsemigroupsError: - if :any:`throw_if_bad_alphabet_or_rules` throws. + if :any:`throw_if_bad_alphabet_or_rules` raises an exception. :raises LibsemigroupsError: if conflicting inverses for any letter are detected.)pbdoc"); } // bind_present @@ -1583,7 +1589,8 @@ Returns the inverse of the letter *x*. :returns: The inverse of *x*. :rtype: :ref:`Letter` -:raises LibsemigroupsError: if no inverses have been set, or if ``index(x)`` throws. +:raises LibsemigroupsError: + if no inverses have been set, or if ``index(x)`` raises an exception. )pbdoc"); thing.def( "inverses", diff --git a/src/runner.cpp b/src/runner.cpp index dd4ec3c5f..c0cddddbc 100644 --- a/src/runner.cpp +++ b/src/runner.cpp @@ -444,7 +444,7 @@ The valid values are: Indicates that the Runner is not in any of the previous states and is not currently running. This can occur when, for example, :any:`Runner.run` - throws an exception. + raises an exception. .. py:attribute:: state.dead :value: diff --git a/src/sims.cpp b/src/sims.cpp index f68654a50..f203afcb3 100644 --- a/src/sims.cpp +++ b/src/sims.cpp @@ -110,7 +110,8 @@ it is this converted value that is used. :returns: The first argument *self*. :rtype: {0} -:raises LibsemigroupsError: if :any:`Presentation.throw_if_bad_alphabet_or_rules` throws. +:raises LibsemigroupsError: + if :any:`Presentation.throw_if_bad_alphabet_or_rules` raises an exception. :raises LibsemigroupsError: if *p* has 0-generators and 0-relations. )pbdoc", @@ -413,7 +414,9 @@ Add a pair that should be included in every congruence. :returns: The first argument *self*. :rtype: {0} -:raises LibsemigroupsError: if :any:`Presentation.throw_if_letter_not_in_alphabet` throws on *lhs* or *rhs*. +:raises LibsemigroupsError: + if :any:`Presentation.throw_if_letter_not_in_alphabet` raises an exception + on *lhs* or *rhs*. )pbdoc", doc_type) .c_str()); @@ -476,7 +479,9 @@ Add a pair that must be excluded from every congruence. :returns: The first argument *self*. :rtype: {0} -:raises LibsemigroupsError: if :any:`Presentation.throw_if_letter_not_in_alphabet` throws on *lhs* or *rhs*. +:raises LibsemigroupsError: + if :any:`Presentation.throw_if_letter_not_in_alphabet` raises + an exception on *lhs* or *rhs*. )pbdoc", doc_type) .c_str()); @@ -642,9 +647,11 @@ search conducted by an object of this type. :param p: the presentation to construct from. :type p: Presentation -:raises LibsemigroupsError: if :any:`Presentation.throw_if_bad_alphabet_or_rules` throws +:raises LibsemigroupsError: + if :any:`Presentation.throw_if_bad_alphabet_or_rules` raises an exception. -:raises LibsemigroupsError: if *p* has 0-generators and 0-relations. +:raises LibsemigroupsError: + if *p* has 0-generators and 0-relations. .. seealso:: :any:`{0}.presentation`, :any:`{0}.init` )pbdoc", @@ -684,7 +691,8 @@ constructed from the presentation *p*. :returns: The first argument *self*. :rtype: {0} -:raises LibsemigroupsError: if :any:`Presentation.throw_if_bad_alphabet_or_rules` throws +:raises LibsemigroupsError: + if :any:`Presentation.throw_if_bad_alphabet_or_rules` raises an exception. :raises LibsemigroupsError: if *p* has 0-generators and 0-relations. )pbdoc", diff --git a/src/ukkonen.cpp b/src/ukkonen.cpp index dc8036ae2..a58a5c5a8 100644 --- a/src/ukkonen.cpp +++ b/src/ukkonen.cpp @@ -61,7 +61,8 @@ suffix tree represents, then :any:`UNDEFINED` is returned. :returns: The index of *w*. :rtype: int | Undefined -:raises LibsemigroupsError: if ``throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. )pbdoc"); @@ -78,14 +79,15 @@ suffix tree represents, then :any:`UNDEFINED` is returned. Throw if the word *w* contains a letter equal to any of the unique letters added to the end of words in the suffix tree. -This function throws an exception if the word *w* contains a letter equal to any +This function raises an exception if the word *w* contains a letter equal to any of the unique letters added to the end of words in the suffix tree. :param w: the word to check. :type w: str | list[int] -:raises LibsemigroupsError: if *w* contains a letter equal to any - of the unique letters added to the end of words in the suffix tree. +:raises LibsemigroupsError: + if *w* contains a letter equal to any of the unique letters added to the + end of words in the suffix tree. :complexity: Linear in the length of *w*. )pbdoc"); @@ -117,7 +119,8 @@ If *w* is empty, then this function does nothing. :param w: the word to add. :type w: str | list[int] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -144,7 +147,9 @@ Add all words in a list to an :any:`Ukkonen` object. :param words: the list of words to add. :type words: list[str] | list[list[int]] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws for any ``w`` in *words*. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception + for any ``w`` in *words*. .. seealso:: @@ -176,7 +181,8 @@ then ``False`` is returned. :returns: Whether *w* is a piece. :rtype: bool -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -210,7 +216,8 @@ represented by the :any:`Ukkonen` instance *u*. :returns: Whether *w* is a subword of any word in *u*. :rtype: bool -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -244,7 +251,8 @@ suffix tree represented by the :any:`Ukkonen` instance *u*. :returns: Whether *w* is a suffix of any word in *u*. :rtype: bool -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -276,7 +284,8 @@ If no such prefix exists, then ``0`` is returned. :returns: The length of the maximal piece prefix. :rtype: int -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -312,7 +321,8 @@ If no such prefix exists, then ``0`` is returned. :returns: The length of the maximal piece suffix. :rtype: int -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -345,7 +355,8 @@ contained in *u*. If no such prefix exists, then an empty word is returned. :returns: The maximal piece prefix. :rtype: str | list[int] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -379,7 +390,8 @@ contained in *u*. If no such suffix exists, then an empty word is returned. :returns: The maximal piece suffix. :rtype: str | list[int] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -415,7 +427,8 @@ Recall that a *piece* is a word that occurs in two distinct positions :returns: The number of pieces. :rtype: int | PositiveInfinity -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -448,7 +461,8 @@ overlapping) of the words in the suffix tree *u*. :returns: The of pieces in the decomposition of *w*. :rtype: list[str] | list[list[int]] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -486,7 +500,8 @@ traversal is returned. :returns: A tuple containing the :any:`State` reached, and the word consumed. :rtype: tuple[Ukkonen.State, str | list[int]] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*. @@ -526,7 +541,8 @@ the portion of *w* that was consumed in the traversal. :returns: The portion of *w* that was consumed in the traversal. :rtype: str | list[int] -:raises LibsemigroupsError: if ``u.throw_if_contains_unique_letter(w)`` throws. +:raises LibsemigroupsError: + if ``u.throw_if_contains_unique_letter(w)`` raises an exception. :complexity: Linear in the length of *w*.