Skip to content

Commit 46e40ec

Browse files
Use Union not |
1 parent e0135bf commit 46e40ec

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

etc/replace-strings-in-doc.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
def dict_sub(replacements, string):
88
"""replacements has the form {"regex1": "replacement", "regex2": "replacement2", ...}"""
9-
global_expression = re.compile(
10-
"|".join("(" + x + ")" for x in replacements)
11-
)
9+
global_expression = re.compile("|".join("(" + x + ")" for x in replacements))
1210
replacements_by_group = {}
1311
group = 1
1412
for expr, replacement in replacements.items():
@@ -42,7 +40,7 @@ def dive(path):
4240
"PresentationStrings": "Presentation",
4341
r"_libsemigroups_pybind11.": "",
4442
"libsemigroups::Presentation<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >": "Presentation",
45-
"RightActionPPerm16List": "Action",
43+
"RightActionPPerm1List": "Action",
4644
"libsemigroups::BMat8": "BMat8",
4745
"libsemigroups_pybind11.bmat8": "bmat8",
4846
"libsemigroups_pybind11.knuth_bendix": "knuth_bendix",

libsemigroups_pybind11/knuth_bendix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
the KnuthBendix class from libsemigroups.
1515
"""
1616

17-
from typing import List, Iterator
17+
from typing import List, Iterator, Union
1818

1919
from _libsemigroups_pybind11 import (
2020
KnuthBendixRewriteFromLeft as _KnuthBendixRewriteFromLeft,
@@ -99,7 +99,7 @@ def non_trivial_classes(
9999
kb1: KnuthBendix,
100100
kb2: KnuthBendix,
101101
**kwargs, # pylint: disable=unused-argument
102-
) -> List[List[str | List[int]]]:
102+
) -> List[List[Union[str, List[int]]]]:
103103
r"""
104104
Find the non-trivial classes of the quotient of one KnuthBendix instance in
105105
another.
@@ -176,7 +176,7 @@ def non_trivial_classes(
176176
List[int]: _knuth_bendix_word_normal_forms,
177177
}
178178
)
179-
def normal_forms(kb: KnuthBendix, **kwargs) -> Iterator[str | List[int]]: # pylint: disable=unused-argument
179+
def normal_forms(kb: KnuthBendix, **kwargs) -> Iterator[Union[str, List[int]]]: # pylint: disable=unused-argument
180180
r"""
181181
Returns an iterator yielding normal forms.
182182

libsemigroups_pybind11/todd_coxeter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def noop():
125125
@_template_params_as_kwargs(
126126
Word={str: _str_normal_forms, List[int]: _word_normal_forms}
127127
)
128-
def normal_forms(kb: ToddCoxeter, **kwargs) -> Iterator[str | List[int]]: # pylint: disable=unused-argument
128+
def normal_forms(kb: ToddCoxeter, **kwargs) -> Iterator[Union[str, List[int]]]: # pylint: disable=unused-argument
129129
r"""
130130
Returns an iterator yielding normal forms.
131131
@@ -156,7 +156,7 @@ def normal_forms(kb: ToddCoxeter, **kwargs) -> Iterator[str | List[int]]: # pyl
156156
@_template_params_as_kwargs(
157157
Word={str: _str_class_by_index, List[int]: _word_class_by_index}
158158
)
159-
def class_by_index(kb: ToddCoxeter, **kwargs) -> Iterator[str | List[int]]: # pylint: disable=unused-argument
159+
def class_by_index(kb: ToddCoxeter, **kwargs) -> Iterator[Union[str, List[int]]]: # pylint: disable=unused-argument
160160
"""
161161
Returns an iterator yielding every word ``List[int]`` or ``str`` in the
162162
congruence class with given index.

0 commit comments

Comments
 (0)