Skip to content

Commit 25e9cc7

Browse files
to: protect imports
1 parent 2bf4bb6 commit 25e9cc7

File tree

1 file changed

+70
-65
lines changed
  • libsemigroups_pybind11

1 file changed

+70
-65
lines changed

libsemigroups_pybind11/to.py

Lines changed: 70 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,42 @@
1212
from _libsemigroups_pybind11 import (
1313
to_congruence_string as _to_congruence_string,
1414
to_congruence_word as _to_congruence_word,
15-
to_froidure_pin,
16-
to_inverse_presentation_string,
17-
to_inverse_presentation_word,
18-
to_inverse_presentation,
19-
to_knuth_bendix_RewriteFromLeft,
20-
to_knuth_bendix_RewriteTrie,
21-
to_knuth_bendix_string_RewriteFromLeft,
22-
to_knuth_bendix_string_RewriteTrie,
23-
to_knuth_bendix_word_RewriteFromLeft,
24-
to_knuth_bendix_word_RewriteTrie,
25-
to_knuth_bendix,
26-
to_presentation_string,
27-
to_presentation_word,
28-
to_presentation,
29-
to_todd_coxeter_string,
30-
to_todd_coxeter_word,
31-
to_todd_coxeter,
15+
to_froidure_pin as _to_froidure_pin,
16+
to_inverse_presentation_string as _to_inverse_presentation_string,
17+
to_inverse_presentation_word as _to_inverse_presentation_word,
18+
to_inverse_presentation as _to_inverse_presentation,
19+
to_knuth_bendix_RewriteFromLeft as _to_knuth_bendix_RewriteFromLeft,
20+
to_knuth_bendix_RewriteTrie as _to_knuth_bendix_RewriteTrie,
21+
to_knuth_bendix_string_RewriteFromLeft as _to_knuth_bendix_string_RewriteFromLeft,
22+
to_knuth_bendix_string_RewriteTrie as _to_knuth_bendix_string_RewriteTrie,
23+
to_knuth_bendix_word_RewriteFromLeft as _to_knuth_bendix_word_RewriteFromLeft,
24+
to_knuth_bendix_word_RewriteTrie as _to_knuth_bendix_word_RewriteTrie,
25+
to_knuth_bendix as _to_knuth_bendix,
26+
to_presentation_string as _to_presentation_string,
27+
to_presentation_word as _to_presentation_word,
28+
to_presentation as _to_presentation,
29+
to_todd_coxeter_string as _to_todd_coxeter_string,
30+
to_todd_coxeter_word as _to_todd_coxeter_word,
31+
to_todd_coxeter as _to_todd_coxeter,
3232
)
3333

34-
from .congruence import Congruence
35-
from .froidure_pin import FroidurePin
36-
from .knuth_bendix import KnuthBendix
37-
from .presentation import Presentation, InversePresentation
38-
from .todd_coxeter import ToddCoxeter
39-
from .detail.cxx_wrapper import to_cxx
34+
from .congruence import Congruence as _Congruence
35+
from .froidure_pin import FroidurePin as _FroidurePin
36+
from .knuth_bendix import KnuthBendix as _KnuthBendix
37+
from .presentation import (
38+
Presentation as _Presentation,
39+
InversePresentation as _InversePresentation,
40+
)
41+
from .todd_coxeter import ToddCoxeter as _ToddCoxeter
42+
from .detail.cxx_wrapper import to_cxx as _to_cxx
4043

4144

4245
def __to_congruence_word(*args):
43-
return Congruence(_to_congruence_word(*args))
46+
return _Congruence(_to_congruence_word(*args))
4447

4548

4649
def __to_congruence_string(*args):
47-
return Congruence(_to_congruence_string(*args))
50+
return _Congruence(_to_congruence_string(*args))
4851

4952

5053
def _nice_name(type_list):
@@ -83,26 +86,26 @@ def to(*args, Return):
8386
8487
>>> from libsemigroups_pybind11 import (
8588
... congruence_kind,
86-
... FroidurePin,
87-
... KnuthBendix,
88-
... Presentation,
89+
... _FroidurePin,
90+
... _KnuthBendix,
91+
... _Presentation,
8992
... presentation,
9093
... to,
9194
... )
9295
93-
>>> p = Presentation([0, 1])
96+
>>> p = _Presentation([0, 1])
9497
>>> presentation.add_rule(p, [0, 1], [1, 0])
9598
>>> presentation.add_rule(p, [0, 0], [0])
9699
>>> presentation.add_rule(p, [1, 1], [1])
97-
>>> kb = KnuthBendix(congruence_kind.twosided, p)
100+
>>> kb = _KnuthBendix(congruence_kind.twosided, p)
98101
99-
>>> fp = to(kb, Return=FroidurePin)
102+
>>> fp = to(kb, Return=_FroidurePin)
100103
>>> fp
101-
<partially enumerated FroidurePin with 2 generators, 2 elements, Cayley graph ⌀ 1, & 0 rules>
104+
<partially enumerated _FroidurePin with 2 generators, 2 elements, Cayley graph ⌀ 1, & 0 rules>
102105
103106
>>> fp.run()
104107
>>> fp
105-
<fully enumerated FroidurePin with 2 generators, 3 elements, Cayley graph ⌀ 2, & 3 rules>
108+
<fully enumerated _FroidurePin with 2 generators, 3 elements, Cayley graph ⌀ 2, & 3 rules>
106109
107110
.. seealso::
108111
@@ -117,56 +120,58 @@ def to(*args, Return):
117120
* :doc:`/main-algorithms/todd-coxeter/to-todd-coxeter`.
118121
119122
"""
120-
cxx_args = [to_cxx(arg) for arg in args]
123+
cxx_args = [_to_cxx(arg) for arg in args]
121124
return_type_to_converter_function = {
122-
(Congruence, str): __to_congruence_string,
123-
(Congruence, List[int]): __to_congruence_word,
124-
FroidurePin: lambda *x: FroidurePin(to_froidure_pin(*x)),
125-
InversePresentation: lambda *x: InversePresentation(
126-
to_inverse_presentation(*x)
125+
(_Congruence, str): __to_congruence_string,
126+
(_Congruence, List[int]): __to_congruence_word,
127+
_FroidurePin: lambda *x: _FroidurePin(_to_froidure_pin(*x)),
128+
_InversePresentation: lambda *x: _InversePresentation(
129+
_to_inverse_presentation(*x)
127130
),
128-
(InversePresentation, List[int]): lambda *x: InversePresentation(
129-
to_inverse_presentation_word(*x)
131+
(_InversePresentation, List[int]): lambda *x: _InversePresentation(
132+
_to_inverse_presentation_word(*x)
130133
),
131-
(InversePresentation, str): lambda *x: InversePresentation(
132-
to_inverse_presentation_string(*x)
134+
(_InversePresentation, str): lambda *x: _InversePresentation(
135+
_to_inverse_presentation_string(*x)
133136
),
134-
KnuthBendix: lambda *x: KnuthBendix(to_knuth_bendix(*x)),
135-
(KnuthBendix, "RewriteTrie"): lambda *x: KnuthBendix(
136-
to_knuth_bendix_RewriteTrie(*x)
137+
_KnuthBendix: lambda *x: _KnuthBendix(_to_knuth_bendix(*x)),
138+
(_KnuthBendix, "RewriteTrie"): lambda *x: _KnuthBendix(
139+
_to_knuth_bendix_RewriteTrie(*x)
137140
),
138-
(KnuthBendix, "RewriteFromLeft"): lambda *x: KnuthBendix(
139-
to_knuth_bendix_RewriteFromLeft(*x)
141+
(_KnuthBendix, "RewriteFromLeft"): lambda *x: _KnuthBendix(
142+
_to_knuth_bendix_RewriteFromLeft(*x)
140143
),
141144
(
142-
KnuthBendix,
145+
_KnuthBendix,
143146
List[int],
144147
"RewriteFromLeft",
145-
): lambda *x: KnuthBendix(to_knuth_bendix_word_RewriteFromLeft(*x)),
148+
): lambda *x: _KnuthBendix(_to_knuth_bendix_word_RewriteFromLeft(*x)),
146149
(
147-
KnuthBendix,
150+
_KnuthBendix,
148151
List[int],
149152
"RewriteTrie",
150-
): lambda *x: KnuthBendix(to_knuth_bendix_word_RewriteTrie(*x)),
153+
): lambda *x: _KnuthBendix(_to_knuth_bendix_word_RewriteTrie(*x)),
151154
(
152-
KnuthBendix,
155+
_KnuthBendix,
153156
str,
154157
"RewriteFromLeft",
155-
): lambda *x: KnuthBendix(to_knuth_bendix_string_RewriteFromLeft(*x)),
156-
(KnuthBendix, str, "RewriteTrie"): lambda *x: KnuthBendix(
157-
to_knuth_bendix_string_RewriteTrie(*x)
158+
): lambda *x: _KnuthBendix(_to_knuth_bendix_string_RewriteFromLeft(*x)),
159+
(_KnuthBendix, str, "RewriteTrie"): lambda *x: _KnuthBendix(
160+
_to_knuth_bendix_string_RewriteTrie(*x)
161+
),
162+
_Presentation: lambda *x: _Presentation(_to_presentation(*x)),
163+
(_Presentation, str): lambda *x: _Presentation(
164+
_to_presentation_string(*x)
158165
),
159-
Presentation: lambda *x: Presentation(to_presentation(*x)),
160-
(Presentation, str): lambda *x: Presentation(
161-
to_presentation_string(*x)
166+
(_Presentation, List[int]): lambda *x: _Presentation(
167+
_to_presentation_word(*x)
162168
),
163-
(Presentation, List[int]): lambda *x: Presentation(
164-
to_presentation_word(*x)
169+
_ToddCoxeter: lambda *x: _ToddCoxeter(_to_todd_coxeter(*x)),
170+
(_ToddCoxeter, str): lambda *x: _ToddCoxeter(
171+
_to_todd_coxeter_string(*x)
165172
),
166-
ToddCoxeter: lambda *x: ToddCoxeter(to_todd_coxeter(*x)),
167-
(ToddCoxeter, str): lambda *x: ToddCoxeter(to_todd_coxeter_string(*x)),
168-
(ToddCoxeter, List[int]): lambda *x: ToddCoxeter(
169-
to_todd_coxeter_word(*x)
173+
(_ToddCoxeter, List[int]): lambda *x: _ToddCoxeter(
174+
_to_todd_coxeter_word(*x)
170175
),
171176
}
172177

0 commit comments

Comments
 (0)