1010The full API for :any:`Presentation` helper functions is given below.
1111"""
1212
13- from typing import Any as _Any , Union
14- from typing_extensions import Self
13+ from typing import Union as _Union
14+ from typing_extensions import Self as _Self
1515
1616from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
1717 InversePresentationString as _InversePresentationString ,
@@ -85,13 +85,37 @@ class Presentation(_CxxWrapper): # pylint: disable=missing-class-docstring
8585
8686 _all_wrapped_cxx_types = {* _py_template_params_to_cxx_type .values ()}
8787
88- def __eq__ (self : Self , other : Self ):
88+ def __eq__ (self : _Self , other : _Self ):
8989 return _to_cxx (self ) == _to_cxx (other )
9090
91- # TODO this isn't correct, need to also doc passing the alphabet
92- # TODO ditto for InversePresentation
93- @_copydoc (_PresentationWord .__init__ )
94- def __init__ (self : Self , * args , ** kwargs ) -> None :
91+ def __init__ (self : _Self , * args , ** kwargs ) -> None :
92+ """__init__(*args, **kwargs)
93+ Overloaded function.
94+
95+ 1. __init__(self: Presentation, word: type) -> None
96+
97+ Default constructor.
98+
99+ This function default constructs an uninitialised :any:`Presentation`
100+ instance.
101+
102+ :Keyword Arguments:
103+ * **word** (*type*) -- the type of words to use. Must be either
104+ ``str`` or ``list[int]``.
105+
106+ 2. __init__(self: Presentation, alphabet: str | list[int]) -> None
107+
108+ Construct a presentation from an alphabet.
109+
110+ This function constructs a :any:`Presentation` instance with the
111+ alphabet specified by *alphabet*.
112+
113+ :param alphabet: the alphabet of the presentation.
114+ :type alphabet: str | list[int]
115+
116+ :raises LibsemigroupsError: if there are duplicate letters in
117+ *alphabet*.
118+ """
95119 # super().__init__ checks if there are unexpected kwargs,
96120 # and sets _cxx_obj if the unique argument is a cxx_obj of type in _all_wrapped_cxx_types
97121 super ().__init__ (* args , optional_kwargs = "word" )
@@ -138,12 +162,12 @@ def __init__(self: Self, *args, **kwargs) -> None:
138162
139163 @_copydoc (_PresentationWord .rules )
140164 @property
141- def rules (self : Self ) -> list [Union [list [int ], str ]]:
165+ def rules (self : _Self ) -> list [_Union [list [int ], str ]]:
142166 # pylint: disable=missing-function-docstring
143167 return _to_cxx (self ).rules
144168
145169 @rules .setter
146- def rules (self : Self , val : list [Union [list [int ], str ]]) -> None :
170+ def rules (self : _Self , val : list [_Union [list [int ], str ]]) -> None :
147171 _to_cxx (self ).rules = val
148172
149173
@@ -163,7 +187,7 @@ class InversePresentation(Presentation):
163187 _py_template_params_to_cxx_type = {
164188 (list [int ],): _InversePresentationWord ,
165189 (str ,): _InversePresentationString ,
166- (Presentation ,): Union [_InversePresentationWord , _InversePresentationString ],
190+ (Presentation ,): _Union [_InversePresentationWord , _InversePresentationString ],
167191 }
168192
169193 _cxx_type_to_py_template_params = dict (
@@ -175,7 +199,16 @@ class InversePresentation(Presentation):
175199
176200 _all_wrapped_cxx_types = {* _py_template_params_to_cxx_type .values ()}
177201
178- def __init__ (self : Self , * args , ** kwargs ) -> None :
202+ @_copydoc (Presentation .__init__ )
203+ def __init__ (self : _Self , * args , ** kwargs ) -> None :
204+ """__init__(self: InversePresentation, p: Presentation) -> None
205+
206+ Construct an :any:`InversePresentation`, initially with empty inverses,
207+ from a :any:`Presentation`.
208+
209+ :param p: the :any:`Presentation` to construct from.
210+ :type p: Presentation
211+ """
179212 super ().__init__ (* args , * kwargs )
180213 if _to_cxx (self ) is not None :
181214 return
0 commit comments