Skip to content

Commit 3ec6097

Browse files
Rename Strings -> String + Words -> Word
1 parent 40cd34e commit 3ec6097

7 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/libsemigroups_pybind11/presentation/__init__.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
1717
# TODO(0) balance?
18-
InversePresentationStrings as _InversePresentationStrings,
19-
InversePresentationWords as _InversePresentationWords,
20-
PresentationStrings as _PresentationStrings,
21-
PresentationWords as _PresentationWords,
18+
InversePresentationString as _InversePresentationString,
19+
InversePresentationWord as _InversePresentationWord,
20+
PresentationString as _PresentationString,
21+
PresentationWord as _PresentationWord,
2222
add_identity_rules as _add_identity_rules,
2323
add_inverse_rules as _add_inverse_rules,
2424
add_rule as _add_rule,
@@ -70,11 +70,11 @@
7070

7171

7272
class Presentation(_CxxWrapper): # pylint: disable=missing-class-docstring
73-
__doc__ = _PresentationStrings.__doc__
73+
__doc__ = _PresentationString.__doc__
7474

7575
_py_template_params_to_cxx_type = {
76-
(list[int],): _PresentationWords,
77-
(str,): _PresentationStrings,
76+
(list[int],): _PresentationWord,
77+
(str,): _PresentationString,
7878
}
7979

8080
_cxx_type_to_py_template_params = dict(
@@ -137,7 +137,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
137137
if len(args) == 1:
138138
self.alphabet(args[0])
139139

140-
@_copydoc(_PresentationWords.rules)
140+
@_copydoc(_PresentationWord.rules)
141141
@property
142142
def rules(self: Self) -> list[Union[list[int], str]]:
143143
# pylint: disable=missing-function-docstring
@@ -148,9 +148,9 @@ def rules(self: Self, val: list[Union[list[int], str]]) -> None:
148148
_to_cxx(self).rules = val
149149

150150

151-
_copy_cxx_mem_fns(_PresentationWords, Presentation)
152-
_register_cxx_wrapped_type(_PresentationWords, Presentation)
153-
_register_cxx_wrapped_type(_PresentationStrings, Presentation)
151+
_copy_cxx_mem_fns(_PresentationWord, Presentation)
152+
_register_cxx_wrapped_type(_PresentationWord, Presentation)
153+
_register_cxx_wrapped_type(_PresentationString, Presentation)
154154

155155
########################################################################
156156
# InversePresentation
@@ -159,12 +159,12 @@ def rules(self: Self, val: list[Union[list[int], str]]) -> None:
159159

160160
class InversePresentation(Presentation):
161161
# pylint: disable=missing-class-docstring
162-
__doc__ = _InversePresentationStrings.__doc__
162+
__doc__ = _InversePresentationString.__doc__
163163

164164
_py_template_params_to_cxx_type = {
165-
(list[int],): _InversePresentationWords,
166-
(str,): _InversePresentationStrings,
167-
(Presentation,): Union[_InversePresentationWords, _InversePresentationStrings],
165+
(list[int],): _InversePresentationWord,
166+
(str,): _InversePresentationString,
167+
(Presentation,): Union[_InversePresentationWord, _InversePresentationString],
168168
}
169169

170170
_cxx_type_to_py_template_params = dict(
@@ -188,9 +188,9 @@ def __init__(self: Self, *args, **kwargs) -> None:
188188
self.rules = args[0].rules
189189

190190

191-
_copy_cxx_mem_fns(_InversePresentationWords, InversePresentation)
192-
_register_cxx_wrapped_type(_InversePresentationWords, InversePresentation)
193-
_register_cxx_wrapped_type(_InversePresentationStrings, InversePresentation)
191+
_copy_cxx_mem_fns(_InversePresentationWord, InversePresentation)
192+
_register_cxx_wrapped_type(_InversePresentationWord, InversePresentation)
193+
_register_cxx_wrapped_type(_InversePresentationString, InversePresentation)
194194

195195
########################################################################
196196
# Helper functions

src/libsemigroups_pybind11/sims.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
1717
MinimalRepOrc as _MinimalRepOrc,
18-
PresentationWords as _PresentationWords,
18+
PresentationWord as _PresentationWord,
1919
RepOrc as _RepOrc,
2020
Sims1 as _Sims1,
2121
Sims2 as _Sims2,

src/libsemigroups_pybind11/stephen.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
from typing_extensions import Self as _Self
1717

1818
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
19-
PresentationWords as _PresentationWords,
20-
InversePresentationWords as _InversePresentationWords,
21-
StephenPresentationWords as _StephenPresentationWords,
22-
StephenInversePresentationWords as _StephenInversePresentationWords,
19+
PresentationWord as _PresentationWord,
20+
InversePresentationWord as _InversePresentationWord,
21+
StephenPresentationWord as _StephenPresentationWord,
22+
StephenInversePresentationWord as _StephenInversePresentationWord,
2323
stephen_accepts as _stephen_accepts,
2424
stephen_dot as _stephen_dot,
2525
stephen_is_left_factor as _stephen_is_left_factor,
@@ -50,11 +50,11 @@
5050

5151
# TODO(2): Make this work with string presentations once it works
5252
class Stephen(_CxxWrapper): # pylint: disable=missing-class-docstring
53-
__doc__ = _StephenPresentationWords.__doc__
53+
__doc__ = _StephenPresentationWord.__doc__
5454

5555
_py_template_params_to_cxx_type = {
56-
(_PresentationWords,): _StephenPresentationWords,
57-
(_InversePresentationWords,): _StephenInversePresentationWords,
56+
(_PresentationWord,): _StephenPresentationWord,
57+
(_InversePresentationWord,): _StephenInversePresentationWord,
5858
}
5959

6060
_cxx_type_to_py_template_params = dict(
@@ -66,7 +66,7 @@ class Stephen(_CxxWrapper): # pylint: disable=missing-class-docstring
6666

6767
_all_wrapped_cxx_types = {*_py_template_params_to_cxx_type.values()}
6868

69-
@_copydoc(_StephenPresentationWords.__init__)
69+
@_copydoc(_StephenPresentationWord.__init__)
7070
def __init__(self: _Self, *args, **kwargs) -> None:
7171
super().__init__(*args, **kwargs)
7272
if _to_cxx(self) is not None:
@@ -94,9 +94,9 @@ def __imul__(self: _Self, other: _Self) -> _Self:
9494
# Copy mem fns from sample C++ type and register types
9595
########################################################################
9696

97-
_copy_cxx_mem_fns(_StephenPresentationWords, Stephen)
98-
_register_cxx_wrapped_type(_StephenPresentationWords, Stephen)
99-
_register_cxx_wrapped_type(_StephenInversePresentationWords, Stephen)
97+
_copy_cxx_mem_fns(_StephenPresentationWord, Stephen)
98+
_register_cxx_wrapped_type(_StephenPresentationWord, Stephen)
99+
_register_cxx_wrapped_type(_StephenInversePresentationWord, Stephen)
100100

101101
########################################################################
102102
# Helpers

src/order.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The valid values are:
5656
.. py:attribute:: Order.shortlex
5757
:value: <Order.shortlex: 1>
5858
59-
The short-lex ordering. Words are first ordered by length, and then
59+
The short-lex ordering. Word are first ordered by length, and then
6060
lexicographically.
6161
6262
.. py:attribute:: Order.lex

src/present.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,12 +1400,12 @@ defined in the alphabet, and that the inverses act as semigroup inverses.
14001400
} // namespace
14011401

14021402
void init_present(py::module& m) {
1403-
bind_present<word_type>(m, "PresentationWords");
1404-
bind_present<std::string>(m, "PresentationStrings");
1403+
bind_present<word_type>(m, "PresentationWord");
1404+
bind_present<std::string>(m, "PresentationString");
14051405
}
14061406

14071407
void init_inverse_present(py::module& m) {
1408-
bind_inverse_present<word_type>(m, "InversePresentationWords");
1409-
bind_inverse_present<std::string>(m, "InversePresentationStrings");
1408+
bind_inverse_present<word_type>(m, "InversePresentationWord");
1409+
bind_inverse_present<std::string>(m, "InversePresentationString");
14101410
}
14111411
} // namespace libsemigroups

src/stephen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ This function triggers the algorithm implemented in this class (if it hasn't bee
514514
void init_stephen(py::module& m) {
515515
// TODO(2): figure out how to handle std::string Stephens once that's
516516
// supported
517-
bind_stephen<Presentation<word_type>>(m, "StephenPresentationWords");
517+
bind_stephen<Presentation<word_type>>(m, "StephenPresentationWord");
518518
bind_stephen<InversePresentation<word_type>>(
519-
m, "StephenInversePresentationWords");
519+
m, "StephenInversePresentationWord");
520520
}
521521

522522
} // namespace libsemigroups

tests/test_to.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
FroidurePinKEString,
2020
FroidurePinKEWord,
2121
FroidurePinTCE,
22-
PresentationStrings,
23-
PresentationWords,
22+
PresentationString,
23+
PresentationWord,
2424
)
2525

2626
from libsemigroups_pybind11 import (
@@ -120,10 +120,10 @@ def check_knuth_bendix_to_pres(WordIn, WordOut, Rewriter):
120120
# This is because sample_pres is already confluent
121121
assert p == q
122122
elif WordOut is str:
123-
assert isinstance(to_cxx(q), PresentationStrings)
123+
assert isinstance(to_cxx(q), PresentationString)
124124
assert q.alphabet() == "ab"
125125
else:
126-
assert isinstance(to_cxx(q), PresentationWords)
126+
assert isinstance(to_cxx(q), PresentationWord)
127127
assert q.alphabet() == [0, 1]
128128

129129

0 commit comments

Comments
 (0)