2222from _libsemigroups_pybind11 import (
2323 KambitesMultiStringView as _KambitesMultiStringView ,
2424 KambitesWord as _KambitesWord ,
25+ KambitesString as _KambitesString ,
2526 PresentationStrings as _PresentationStrings ,
2627 PresentationWords as _PresentationWords ,
2728 congruence_kind as _congruence_kind ,
3334from .detail .decorators import (
3435 may_return_positive_infinity as _may_return_positive_infinity ,
3536 copydoc as _copydoc ,
37+ returns_self as _returns_self ,
3638)
3739
3840from .detail import cong_intf as _cong_intf
@@ -56,21 +58,48 @@ class Kambites(_CxxWrapper):
5658 def __init__ ( # pylint: disable=super-init-not-called
5759 self : Self , * args , ** kwargs
5860 ) -> None :
59- _cong_intf .raise_if_bad_args (* args , ** kwargs )
60- if len (args ) == 0 :
61- Word = kwargs ["Word" ]
61+ if (
62+ len (args ) == 1
63+ and len (kwargs ) == 0
64+ and isinstance (
65+ args [0 ],
66+ (_KambitesWord , _KambitesMultiStringView , _KambitesString ),
67+ )
68+ ):
69+ self ._cxx_obj = args [0 ]
6270 else :
63- assert len (args ) == 2
64- if isinstance (args [1 ], _PresentationStrings ):
65- Word = str
66- elif isinstance (args [1 ], _PresentationWords ):
67- Word = List [int ]
71+ _cong_intf .raise_if_bad_args (* args , ** kwargs )
72+ if len (args ) == 0 :
73+ Word = kwargs ["Word" ]
6874 else :
69- raise TypeError (
70- f"expected the 2nd argument to be Presentation, but found { type (args [1 ])} "
71- )
75+ assert len (args ) == 2
76+ if isinstance (args [1 ], _PresentationStrings ):
77+ Word = str
78+ elif isinstance (args [1 ], _PresentationWords ):
79+ Word = List [int ]
80+ else :
81+ raise TypeError (
82+ f"expected the 2nd argument to be Presentation, but found { type (args [1 ])} "
83+ )
84+ self ._cxx_obj = self ._py_to_cxx_type_dict [Word ](* args )
85+ if isinstance (self ._cxx_obj , _KambitesWord ):
86+ self .Word = List [int ]
87+ else :
88+ self .Word = str
89+
90+ @_copydoc (_KambitesWord .add_generating_pair )
91+ @_returns_self
92+ def add_generating_pair (self : Self , * args ) -> Self :
93+ return _to_cxx (self ).add_generating_pair (* args )
94+
95+ @_copydoc (_KambitesWord .copy )
96+ def copy (self : Self ) -> Self :
97+ return Kambites (_to_cxx (self ).copy ())
7298
73- self ._cxx_obj = self ._py_to_cxx_type_dict [Word ](* args )
99+ @_copydoc (_KambitesWord .init )
100+ @_returns_self
101+ def init (self : Self , * args ) -> Self :
102+ return _to_cxx (self ).init (* args )
74103
75104 @_copydoc (_KambitesWord ._number_of_classes )
76105 @_may_return_positive_infinity
0 commit comments