From 9f042574ef95285933774dbc3af4d588b9c032f8 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 16 Jun 2025 19:31:30 +0100 Subject: [PATCH 1/4] Matrix: remove leading underscore --- src/libsemigroups_pybind11/__init__.py | 2 +- src/libsemigroups_pybind11/matrix.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsemigroups_pybind11/__init__.py b/src/libsemigroups_pybind11/__init__.py index d948d2270..c80366013 100644 --- a/src/libsemigroups_pybind11/__init__.py +++ b/src/libsemigroups_pybind11/__init__.py @@ -22,7 +22,7 @@ from .kambites import Kambites from .knuth_bendix import KnuthBendix from .konieczny import Konieczny -from .matrix import _Matrix as Matrix, MatrixKind +from .matrix import Matrix, MatrixKind from .presentation import Presentation, InversePresentation from .schreier_sims import SchreierSims from .sims import ( diff --git a/src/libsemigroups_pybind11/matrix.py b/src/libsemigroups_pybind11/matrix.py index 3fd2d76d9..ea9e45b74 100644 --- a/src/libsemigroups_pybind11/matrix.py +++ b/src/libsemigroups_pybind11/matrix.py @@ -110,7 +110,7 @@ class MatrixKind(_Enum): ######################################################################## -class _Matrix(_CxxWrapper): +class Matrix(_CxxWrapper): __doc__ = _BMat.__doc__ _py_template_params_to_cxx_type = { @@ -208,7 +208,7 @@ def __hash__(self: _Self) -> int: return _to_cxx(self).__hash__() -_copy_cxx_mem_fns(_NTPMat, _Matrix) +_copy_cxx_mem_fns(_NTPMat, Matrix) ######################################################################## # Helper functions From 9e441603430e8a5b137795c5daace1e0a4545eed Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 16 Jun 2025 19:32:22 +0100 Subject: [PATCH 2/4] Doc: Consistent constructor format --- .../_ext/libsemigroups_pybind11_extensions.py | 14 ++++++++++++++ docs/source/conf.py | 4 +--- .../data-structures/adapters/imageleftaction.rst | 3 +-- .../data-structures/adapters/imagerightaction.rst | 3 +-- docs/source/data-structures/adapters/index.rst | 2 +- .../data-structures/elements/bipart/class.rst | 4 +--- .../data-structures/elements/blocks/class.rst | 4 +--- .../data-structures/elements/matrix/bmat8.rst | 3 +-- .../elements/matrix/matrix-helpers.rst | 1 + .../data-structures/elements/matrix/matrix.rst | 3 --- docs/source/data-structures/elements/pbr/class.rst | 4 +--- .../elements/transformations/perm.rst | 4 +--- .../elements/transformations/pperm.rst | 3 --- .../elements/transformations/transf.rst | 3 --- docs/source/data-structures/misc/reporter.rst | 3 +-- docs/source/data-structures/misc/runner.rst | 3 +-- .../presentations/inverse-present.rst | 3 +-- .../data-structures/presentations/present.rst | 3 +-- docs/source/data-structures/suffix-trees/class.rst | 5 +++-- docs/source/data-structures/tries/class.rst | 3 +-- .../data-structures/visualisation/dot.edge.rst | 3 +-- .../data-structures/visualisation/dot.kind.rst | 2 +- .../data-structures/visualisation/dot.node.rst | 2 +- docs/source/data-structures/visualisation/dot.rst | 3 +-- docs/source/data-structures/word-graph/forest.rst | 4 +--- docs/source/data-structures/word-graph/gabow.rst | 3 +-- docs/source/data-structures/word-graph/joiner.rst | 3 +-- docs/source/data-structures/word-graph/meeter.rst | 3 +-- docs/source/data-structures/word-graph/paths.rst | 3 +-- .../data-structures/word-graph/word-graph.rst | 3 +-- docs/source/data-structures/words/string-range.rst | 3 +-- docs/source/data-structures/words/to-string.rst | 3 +-- docs/source/data-structures/words/to-word.rst | 3 +-- docs/source/data-structures/words/word-range.rst | 3 +-- docs/source/main-algorithms/action/action.rst | 3 +-- docs/source/main-algorithms/action/leftaction.rst | 3 +-- docs/source/main-algorithms/action/rightaction.rst | 3 +-- docs/source/main-algorithms/congruence/class.rst | 1 - docs/source/main-algorithms/froidure-pin/class.rst | 3 +-- docs/source/main-algorithms/kambites/class.rst | 3 +-- .../main-algorithms/knuth-bendix/class/index.rst | 2 -- docs/source/main-algorithms/konieczny/class.rst | 1 - .../low-index/classes/minimalreporc.rst | 2 -- .../main-algorithms/low-index/classes/reporc.rst | 2 -- .../main-algorithms/low-index/classes/sims1.rst | 2 -- .../main-algorithms/low-index/classes/sims2.rst | 2 -- .../low-index/classes/simsrefinerfaithful.rst | 2 -- .../low-index/classes/simsrefinerideals.rst | 2 -- .../low-index/classes/simsstats.rst | 2 -- .../source/main-algorithms/schreier-sims/class.rst | 3 +-- docs/source/main-algorithms/stephen/class.rst | 1 - .../main-algorithms/todd-coxeter/class/index.rst | 1 - 52 files changed, 52 insertions(+), 102 deletions(-) diff --git a/docs/source/_ext/libsemigroups_pybind11_extensions.py b/docs/source/_ext/libsemigroups_pybind11_extensions.py index 5814efea7..a596d6071 100644 --- a/docs/source/_ext/libsemigroups_pybind11_extensions.py +++ b/docs/source/_ext/libsemigroups_pybind11_extensions.py @@ -201,6 +201,9 @@ def change_sig( return_annotation=None, ): """Make type replacement in function signatures""" + if what == "class": + return None, None + signature, return_annotation = sig_alternative( obj.__doc__, signature, return_annotation ) @@ -437,11 +440,22 @@ def check_string_replacements(app, env): logger.info(f"Please correct this in {__file__}") +def document_class(app, what, name, obj, options, lines): + if what != "class": + return + try: + if options["class-doc-from"] == "init": + lines[:] = [f".. autofunction:: {name}.__init__\n"] + except KeyError: + return + + def setup(app): """Add custom behaviour to the build process""" app.add_directive("autoclass", ExtendedAutodocDirective, override=True) app.add_directive("autofunction", ExtendedAutodocDirective, override=True) app.add_directive("automodule", ExtendedAutodocDirective, override=True) + app.connect("autodoc-process-docstring", document_class) app.connect("autodoc-process-docstring", only_doc_once) app.connect("autodoc-process-docstring", fix_overloads) app.connect("autodoc-process-signature", change_sig) diff --git a/docs/source/conf.py b/docs/source/conf.py index e6d7453d3..83b9ef3e1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -72,9 +72,7 @@ "numpy": ("https://numpy.org/doc/stable/", None), } -autodoc_default_options = {"show-inheritence": True} - -autoclass_content = "both" +autoclass_content = "class" doctest_global_setup = """from libsemigroups_pybind11 import ReportGuard ReportGuard(False)""" diff --git a/docs/source/data-structures/adapters/imageleftaction.rst b/docs/source/data-structures/adapters/imageleftaction.rst index 4904a85d9..2050dc212 100644 --- a/docs/source/data-structures/adapters/imageleftaction.rst +++ b/docs/source/data-structures/adapters/imageleftaction.rst @@ -12,7 +12,6 @@ The ImageLeftAction class .. autoclass:: ImageLeftAction :doc-only: - :class-doc-from: class Contents -------- @@ -27,6 +26,6 @@ Full API -------- .. autoclass:: ImageLeftAction - :members: :class-doc-from: init :special-members: __call__ + :members: diff --git a/docs/source/data-structures/adapters/imagerightaction.rst b/docs/source/data-structures/adapters/imagerightaction.rst index 2ef9e4aaa..539a96d2d 100644 --- a/docs/source/data-structures/adapters/imagerightaction.rst +++ b/docs/source/data-structures/adapters/imagerightaction.rst @@ -12,7 +12,6 @@ The ImageRightAction class .. autoclass:: ImageRightAction :doc-only: - :class-doc-from: class Contents -------- @@ -27,6 +26,6 @@ Full API -------- .. autoclass:: ImageRightAction - :members: :class-doc-from: init :special-members: __call__ + :members: diff --git a/docs/source/data-structures/adapters/index.rst b/docs/source/data-structures/adapters/index.rst index 467038ae8..f9d1e33ed 100644 --- a/docs/source/data-structures/adapters/index.rst +++ b/docs/source/data-structures/adapters/index.rst @@ -18,5 +18,5 @@ types. .. toctree:: :maxdepth: 1 - imagerightaction imageleftaction + imagerightaction diff --git a/docs/source/data-structures/elements/bipart/class.rst b/docs/source/data-structures/elements/bipart/class.rst index 2b57233bd..a68d5a56b 100644 --- a/docs/source/data-structures/elements/bipart/class.rst +++ b/docs/source/data-structures/elements/bipart/class.rst @@ -12,7 +12,6 @@ The Bipartition class .. autoclass:: Bipartition :doc-only: - :class-doc-from: class Contents -------- @@ -38,6 +37,5 @@ Full API -------- .. autoclass:: Bipartition - :members: :class-doc-from: init - :inherited-members: + :members: diff --git a/docs/source/data-structures/elements/blocks/class.rst b/docs/source/data-structures/elements/blocks/class.rst index f38b966b8..c5d942992 100644 --- a/docs/source/data-structures/elements/blocks/class.rst +++ b/docs/source/data-structures/elements/blocks/class.rst @@ -12,7 +12,6 @@ The Blocks class .. autoclass:: Blocks :doc-only: - :class-doc-from: class Contents -------- @@ -33,6 +32,5 @@ Full API -------- .. autoclass:: Blocks - :members: :class-doc-from: init - :inherited-members: + :members: diff --git a/docs/source/data-structures/elements/matrix/bmat8.rst b/docs/source/data-structures/elements/matrix/bmat8.rst index 7abe12f23..5cc3ae228 100644 --- a/docs/source/data-structures/elements/matrix/bmat8.rst +++ b/docs/source/data-structures/elements/matrix/bmat8.rst @@ -12,7 +12,6 @@ The BMat8 class .. autoclass:: BMat8 :doc-only: - :class-doc-from: class Contents -------- @@ -30,5 +29,5 @@ Full API -------- .. autoclass:: BMat8 - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/elements/matrix/matrix-helpers.rst b/docs/source/data-structures/elements/matrix/matrix-helpers.rst index 745526a73..f59be9cd9 100644 --- a/docs/source/data-structures/elements/matrix/matrix-helpers.rst +++ b/docs/source/data-structures/elements/matrix/matrix-helpers.rst @@ -31,3 +31,4 @@ Full API .. automodule:: libsemigroups_pybind11.matrix :members: :imported-members: + :exclude-members: Matrix, MatrixKind diff --git a/docs/source/data-structures/elements/matrix/matrix.rst b/docs/source/data-structures/elements/matrix/matrix.rst index 812cf5bb7..cfe9f3a3b 100644 --- a/docs/source/data-structures/elements/matrix/matrix.rst +++ b/docs/source/data-structures/elements/matrix/matrix.rst @@ -12,7 +12,6 @@ The Matrix class .. autoclass:: Matrix :doc-only: - :class-doc-from: class MatrixKind ---------- @@ -48,5 +47,3 @@ Full API .. autoclass:: Matrix :class-doc-from: init :members: - :inherited-members: - :exclude-members: py_template_params_from_cxx_obj, init_cxx_obj diff --git a/docs/source/data-structures/elements/pbr/class.rst b/docs/source/data-structures/elements/pbr/class.rst index 010791016..9f3b84e7f 100644 --- a/docs/source/data-structures/elements/pbr/class.rst +++ b/docs/source/data-structures/elements/pbr/class.rst @@ -12,7 +12,6 @@ The PBR class .. autoclass:: PBR :doc-only: - :class-doc-from: class Contents -------- @@ -30,6 +29,5 @@ Full API -------- .. autoclass:: PBR - :members: :class-doc-from: init - :inherited-members: + :members: diff --git a/docs/source/data-structures/elements/transformations/perm.rst b/docs/source/data-structures/elements/transformations/perm.rst index d595095ee..f6463e26b 100644 --- a/docs/source/data-structures/elements/transformations/perm.rst +++ b/docs/source/data-structures/elements/transformations/perm.rst @@ -19,7 +19,6 @@ The Perm class .. autoclass:: Perm :doc-only: - :class-doc-from: class Contents -------- @@ -29,6 +28,7 @@ Contents ~Perm Perm.copy + Perm.degree Perm.images Perm.increase_degree_by Perm.one @@ -42,5 +42,3 @@ Full API .. autoclass:: Perm :class-doc-from: init :members: - :inherited-members: - :exclude-members: init_cxx_obj, py_template_params_from_cxx_obj diff --git a/docs/source/data-structures/elements/transformations/pperm.rst b/docs/source/data-structures/elements/transformations/pperm.rst index c2167557f..b36bac663 100644 --- a/docs/source/data-structures/elements/transformations/pperm.rst +++ b/docs/source/data-structures/elements/transformations/pperm.rst @@ -12,7 +12,6 @@ The PPerm class .. autoclass:: PPerm :doc-only: - :class-doc-from: class Contents -------- @@ -35,5 +34,3 @@ Full API .. autoclass:: PPerm :class-doc-from: init :members: - :inherited-members: - :exclude-members: init_cxx_obj, py_template_params_from_cxx_obj diff --git a/docs/source/data-structures/elements/transformations/transf.rst b/docs/source/data-structures/elements/transformations/transf.rst index 0364f3ddc..97d07f784 100644 --- a/docs/source/data-structures/elements/transformations/transf.rst +++ b/docs/source/data-structures/elements/transformations/transf.rst @@ -12,7 +12,6 @@ The Transf class .. autoclass:: Transf :doc-only: - :class-doc-from: class Contents -------- @@ -35,5 +34,3 @@ Full API .. autoclass:: Transf :class-doc-from: init :members: - :inherited-members: - :exclude-members: init_cxx_obj, py_template_params_from_cxx_obj diff --git a/docs/source/data-structures/misc/reporter.rst b/docs/source/data-structures/misc/reporter.rst index 4de72d90f..a776ffb3c 100644 --- a/docs/source/data-structures/misc/reporter.rst +++ b/docs/source/data-structures/misc/reporter.rst @@ -12,7 +12,6 @@ The Reporter class .. autoclass:: Reporter :doc-only: - :class-doc-from: class Contents -------- @@ -35,5 +34,5 @@ Full API -------- .. autoclass:: Reporter - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/misc/runner.rst b/docs/source/data-structures/misc/runner.rst index 5fc79a081..d92ed05db 100644 --- a/docs/source/data-structures/misc/runner.rst +++ b/docs/source/data-structures/misc/runner.rst @@ -12,7 +12,6 @@ The Runner class .. autoclass:: Runner :doc-only: - :class-doc-from: class Contents -------- @@ -44,5 +43,5 @@ Full API -------- .. autoclass:: Runner - :no-doc: + :class-doc-from: init :members: diff --git a/docs/source/data-structures/presentations/inverse-present.rst b/docs/source/data-structures/presentations/inverse-present.rst index acbfe9553..6a6cb76eb 100644 --- a/docs/source/data-structures/presentations/inverse-present.rst +++ b/docs/source/data-structures/presentations/inverse-present.rst @@ -12,7 +12,6 @@ The InversePresentation class .. autoclass:: InversePresentation :doc-only: - :class-doc-from: class .. _pseudo_letter_type_inv_class: @@ -46,5 +45,5 @@ Full API .. currentmodule:: libsemigroups_pybind11 .. autoclass:: InversePresentation + :class-doc-from: init :members: - :no-doc: diff --git a/docs/source/data-structures/presentations/present.rst b/docs/source/data-structures/presentations/present.rst index f178dc2ba..4fdbc8229 100644 --- a/docs/source/data-structures/presentations/present.rst +++ b/docs/source/data-structures/presentations/present.rst @@ -12,7 +12,6 @@ The Presentation class .. autoclass:: Presentation :doc-only: - :class-doc-from: class .. _pseudo_letter_type_class: @@ -56,5 +55,5 @@ Full API -------- .. autoclass:: Presentation - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/suffix-trees/class.rst b/docs/source/data-structures/suffix-trees/class.rst index b0baae970..91033fc67 100644 --- a/docs/source/data-structures/suffix-trees/class.rst +++ b/docs/source/data-structures/suffix-trees/class.rst @@ -12,7 +12,6 @@ The Ukkonen class .. autoclass:: Ukkonen :doc-only: - :class-doc-from: class Contents -------- @@ -57,12 +56,14 @@ Full API -------- .. autoclass:: libsemigroups_pybind11::Ukkonen.State + :class-doc-from: init :members: .. autoclass:: libsemigroups_pybind11::Ukkonen.Node + :class-doc-from: init :members: .. autoclass:: Ukkonen - :members: :class-doc-from: init + :members: :exclude-members: State, Node diff --git a/docs/source/data-structures/tries/class.rst b/docs/source/data-structures/tries/class.rst index 94bac4ca2..b13de725c 100644 --- a/docs/source/data-structures/tries/class.rst +++ b/docs/source/data-structures/tries/class.rst @@ -12,7 +12,6 @@ The AhoCorasick class .. autoclass:: AhoCorasick :doc-only: - :class-doc-from: class Contents -------- @@ -37,5 +36,5 @@ Full API -------- .. autoclass:: AhoCorasick - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/visualisation/dot.edge.rst b/docs/source/data-structures/visualisation/dot.edge.rst index 0e508e5d0..1b6d3de7f 100644 --- a/docs/source/data-structures/visualisation/dot.edge.rst +++ b/docs/source/data-structures/visualisation/dot.edge.rst @@ -9,6 +9,5 @@ The Dot.Edge class ================== .. autoclass:: libsemigroups_pybind11.Dot.Edge - :members: :class-doc-from: class - :exclude-members: name + :members: diff --git a/docs/source/data-structures/visualisation/dot.kind.rst b/docs/source/data-structures/visualisation/dot.kind.rst index 94bb27f1f..9ae4b3ae0 100644 --- a/docs/source/data-structures/visualisation/dot.kind.rst +++ b/docs/source/data-structures/visualisation/dot.kind.rst @@ -9,6 +9,6 @@ The Dot.Kind class ================== .. autoclass:: libsemigroups_pybind11.Dot.Kind - :members: :class-doc-from: class + :members: :exclude-members: name diff --git a/docs/source/data-structures/visualisation/dot.node.rst b/docs/source/data-structures/visualisation/dot.node.rst index 4bf67fcea..1c5fbff25 100644 --- a/docs/source/data-structures/visualisation/dot.node.rst +++ b/docs/source/data-structures/visualisation/dot.node.rst @@ -9,5 +9,5 @@ The Dot.Node class ================== .. autoclass:: libsemigroups_pybind11.Dot.Node - :members: :class-doc-from: class + :members: diff --git a/docs/source/data-structures/visualisation/dot.rst b/docs/source/data-structures/visualisation/dot.rst index 35928068f..df5ddb8fc 100644 --- a/docs/source/data-structures/visualisation/dot.rst +++ b/docs/source/data-structures/visualisation/dot.rst @@ -12,7 +12,6 @@ The Dot class .. autoclass:: Dot :doc-only: - :class-doc-from: class Contents -------- @@ -41,6 +40,6 @@ Full API -------- .. autoclass:: Dot - :members: :class-doc-from: init + :members: :exclude-members: Kind, Node, Edge diff --git a/docs/source/data-structures/word-graph/forest.rst b/docs/source/data-structures/word-graph/forest.rst index be8b68b77..5b08960e9 100644 --- a/docs/source/data-structures/word-graph/forest.rst +++ b/docs/source/data-structures/word-graph/forest.rst @@ -12,7 +12,6 @@ The Forest class .. autoclass:: Forest :doc-only: - :class-doc-from: class Contents -------- @@ -37,6 +36,5 @@ Full API -------- .. autoclass:: Forest - :members: - :show-inheritance: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/word-graph/gabow.rst b/docs/source/data-structures/word-graph/gabow.rst index 3e7ee7434..24d075d02 100644 --- a/docs/source/data-structures/word-graph/gabow.rst +++ b/docs/source/data-structures/word-graph/gabow.rst @@ -12,7 +12,6 @@ The Gabow class .. autoclass:: Gabow :doc-only: - :class-doc-from: class Contents -------- @@ -39,5 +38,5 @@ Full API -------- .. autoclass:: Gabow - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/word-graph/joiner.rst b/docs/source/data-structures/word-graph/joiner.rst index 2b05185e9..3f634bfca 100644 --- a/docs/source/data-structures/word-graph/joiner.rst +++ b/docs/source/data-structures/word-graph/joiner.rst @@ -12,7 +12,6 @@ The Joiner class .. autoclass:: Joiner :doc-only: - :class-doc-from: class Contents -------- @@ -29,6 +28,6 @@ Full API -------- .. autoclass:: Joiner + :class-doc-from: init :members: :special-members: __call__ - :class-doc-from: init diff --git a/docs/source/data-structures/word-graph/meeter.rst b/docs/source/data-structures/word-graph/meeter.rst index ce2b0c335..3c37bf4aa 100644 --- a/docs/source/data-structures/word-graph/meeter.rst +++ b/docs/source/data-structures/word-graph/meeter.rst @@ -12,7 +12,6 @@ The Meeter class .. autoclass:: Meeter :doc-only: - :class-doc-from: class Contents -------- @@ -29,6 +28,6 @@ Full API -------- .. autoclass:: Meeter + :class-doc-from: init :members: :special-members: __call__ - :class-doc-from: init diff --git a/docs/source/data-structures/word-graph/paths.rst b/docs/source/data-structures/word-graph/paths.rst index 4466e94c2..07a495109 100644 --- a/docs/source/data-structures/word-graph/paths.rst +++ b/docs/source/data-structures/word-graph/paths.rst @@ -12,7 +12,6 @@ The Paths class .. autoclass:: Paths :doc-only: - :class-doc-from: class Contents -------- @@ -39,5 +38,5 @@ Full API -------- .. autoclass:: Paths - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/word-graph/word-graph.rst b/docs/source/data-structures/word-graph/word-graph.rst index dd406a916..b70947c30 100644 --- a/docs/source/data-structures/word-graph/word-graph.rst +++ b/docs/source/data-structures/word-graph/word-graph.rst @@ -12,7 +12,6 @@ The WordGraph class .. autoclass:: WordGraph :doc-only: - :class-doc-from: class Contents -------- @@ -46,5 +45,5 @@ Full API -------- .. autoclass:: WordGraph - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/words/string-range.rst b/docs/source/data-structures/words/string-range.rst index 0eb009034..0384fc6f4 100644 --- a/docs/source/data-structures/words/string-range.rst +++ b/docs/source/data-structures/words/string-range.rst @@ -12,7 +12,6 @@ The StringRange class .. autoclass:: StringRange :doc-only: - :class-doc-from: class Contents -------- @@ -40,5 +39,5 @@ Full API -------- .. autoclass:: StringRange - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/words/to-string.rst b/docs/source/data-structures/words/to-string.rst index 98b5c7b43..cd789417f 100644 --- a/docs/source/data-structures/words/to-string.rst +++ b/docs/source/data-structures/words/to-string.rst @@ -12,7 +12,6 @@ The ToString class .. autoclass:: ToString :doc-only: - :class-doc-from: class Contents -------- @@ -31,5 +30,5 @@ Full API -------- .. autoclass:: ToString - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/words/to-word.rst b/docs/source/data-structures/words/to-word.rst index 0d413328b..0b61071ac 100644 --- a/docs/source/data-structures/words/to-word.rst +++ b/docs/source/data-structures/words/to-word.rst @@ -12,7 +12,6 @@ The ToWord class .. autoclass:: ToWord :doc-only: - :class-doc-from: class Contents -------- @@ -31,5 +30,5 @@ Full API -------- .. autoclass:: ToWord - :members: :class-doc-from: init + :members: diff --git a/docs/source/data-structures/words/word-range.rst b/docs/source/data-structures/words/word-range.rst index 54d05c34d..4ed8eedd0 100644 --- a/docs/source/data-structures/words/word-range.rst +++ b/docs/source/data-structures/words/word-range.rst @@ -12,7 +12,6 @@ The WordRange class .. autoclass:: WordRange :doc-only: - :class-doc-from: class Contents -------- @@ -41,5 +40,5 @@ Full API -------- .. autoclass:: WordRange - :members: :class-doc-from: init + :members: diff --git a/docs/source/main-algorithms/action/action.rst b/docs/source/main-algorithms/action/action.rst index bca594dac..bc839a13e 100644 --- a/docs/source/main-algorithms/action/action.rst +++ b/docs/source/main-algorithms/action/action.rst @@ -12,7 +12,6 @@ The Action class .. autoclass:: Action :doc-only: - :class-doc-from: class Contents -------- @@ -44,8 +43,8 @@ Full API -------- .. autoclass:: Action - :members: :class-doc-from: init + :members: :exclude-members: current_state, dead, finished, kill, last_report, report, report_every, report_prefix, report_why_we_stopped, reset_last_report, diff --git a/docs/source/main-algorithms/action/leftaction.rst b/docs/source/main-algorithms/action/leftaction.rst index a3744b9c4..61dd1f249 100644 --- a/docs/source/main-algorithms/action/leftaction.rst +++ b/docs/source/main-algorithms/action/leftaction.rst @@ -12,12 +12,11 @@ The LeftAction class .. autoclass:: LeftAction :doc-only: - :class-doc-from: class Full API -------- .. autoclass:: LeftAction + :class-doc-from: init :members: :show-inheritance: - :class-doc-from: init diff --git a/docs/source/main-algorithms/action/rightaction.rst b/docs/source/main-algorithms/action/rightaction.rst index 25f33bbef..4344bb181 100644 --- a/docs/source/main-algorithms/action/rightaction.rst +++ b/docs/source/main-algorithms/action/rightaction.rst @@ -12,12 +12,11 @@ The RightAction class .. autoclass:: RightAction :doc-only: - :class-doc-from: class Full API -------- .. autoclass:: RightAction + :class-doc-from: init :members: :show-inheritance: - :class-doc-from: init diff --git a/docs/source/main-algorithms/congruence/class.rst b/docs/source/main-algorithms/congruence/class.rst index fa43d2a6f..7ba2ea419 100644 --- a/docs/source/main-algorithms/congruence/class.rst +++ b/docs/source/main-algorithms/congruence/class.rst @@ -12,7 +12,6 @@ The Congruence class .. autoclass:: Congruence :doc-only: - :class-doc-from: class Contents -------- diff --git a/docs/source/main-algorithms/froidure-pin/class.rst b/docs/source/main-algorithms/froidure-pin/class.rst index 5cbf0093a..d9cb1b1f1 100644 --- a/docs/source/main-algorithms/froidure-pin/class.rst +++ b/docs/source/main-algorithms/froidure-pin/class.rst @@ -12,7 +12,6 @@ The FroidurePin class .. autoclass:: FroidurePin :doc-only: - :class-doc-from: class Contents -------- @@ -71,8 +70,8 @@ Full API -------- .. autoclass:: FroidurePin - :members: :class-doc-from: init + :members: :exclude-members: current_state, dead, finished, kill, last_report, report, report_every, report_prefix, report_why_we_stopped, reset_last_report, reset_start_time, diff --git a/docs/source/main-algorithms/kambites/class.rst b/docs/source/main-algorithms/kambites/class.rst index 070b8b7d1..992fa488b 100644 --- a/docs/source/main-algorithms/kambites/class.rst +++ b/docs/source/main-algorithms/kambites/class.rst @@ -12,7 +12,6 @@ The Kambites class .. autoclass:: Kambites :doc-only: - :class-doc-from: class Contents -------- @@ -40,8 +39,8 @@ Full API -------- .. autoclass:: Kambites - :members: :class-doc-from: init + :members: :exclude-members: current_state, dead, finished, internal_generating_pairs, kill, last_report, report, report_every, report_prefix, diff --git a/docs/source/main-algorithms/knuth-bendix/class/index.rst b/docs/source/main-algorithms/knuth-bendix/class/index.rst index 7373c10b2..a1457ac0d 100644 --- a/docs/source/main-algorithms/knuth-bendix/class/index.rst +++ b/docs/source/main-algorithms/knuth-bendix/class/index.rst @@ -12,7 +12,6 @@ The KnuthBendix class .. autoclass:: KnuthBendix :doc-only: - :class-doc-from: class .. toctree:: :maxdepth: 1 @@ -58,7 +57,6 @@ Full API .. autoclass:: KnuthBendix :class-doc-from: init :members: - :inherited-members: :exclude-members: options, run_for, run_until, run, finished, stopped, current_state, dead, internal_generating_pairs, kill, last_report, report, report_every, diff --git a/docs/source/main-algorithms/konieczny/class.rst b/docs/source/main-algorithms/konieczny/class.rst index b9b506e73..8a33b7287 100644 --- a/docs/source/main-algorithms/konieczny/class.rst +++ b/docs/source/main-algorithms/konieczny/class.rst @@ -12,7 +12,6 @@ The Konieczny class .. autoclass:: Konieczny :doc-only: - :class-doc-from: class Contents -------- diff --git a/docs/source/main-algorithms/low-index/classes/minimalreporc.rst b/docs/source/main-algorithms/low-index/classes/minimalreporc.rst index e0765dc4b..0def2cf6e 100644 --- a/docs/source/main-algorithms/low-index/classes/minimalreporc.rst +++ b/docs/source/main-algorithms/low-index/classes/minimalreporc.rst @@ -12,7 +12,6 @@ The MinimalRepOrc class .. autoclass:: MinimalRepOrc :doc-only: - :class-doc-from: class Contents -------- @@ -49,4 +48,3 @@ Full API .. autoclass:: MinimalRepOrc :class-doc-from: init :members: - :inherited-members: diff --git a/docs/source/main-algorithms/low-index/classes/reporc.rst b/docs/source/main-algorithms/low-index/classes/reporc.rst index 3c82aaff7..fa0bc4a84 100644 --- a/docs/source/main-algorithms/low-index/classes/reporc.rst +++ b/docs/source/main-algorithms/low-index/classes/reporc.rst @@ -12,7 +12,6 @@ The RepOrc class .. autoclass:: RepOrc :doc-only: - :class-doc-from: class Contents -------- @@ -51,4 +50,3 @@ Full API .. autoclass:: RepOrc :class-doc-from: init :members: - :inherited-members: diff --git a/docs/source/main-algorithms/low-index/classes/sims1.rst b/docs/source/main-algorithms/low-index/classes/sims1.rst index 3f8130d4a..c7c4edd59 100644 --- a/docs/source/main-algorithms/low-index/classes/sims1.rst +++ b/docs/source/main-algorithms/low-index/classes/sims1.rst @@ -12,7 +12,6 @@ The Sims1 class .. autoclass:: Sims1 :doc-only: - :class-doc-from: class Contents -------- @@ -52,4 +51,3 @@ Full API .. autoclass:: Sims1 :class-doc-from: init :members: - :inherited-members: diff --git a/docs/source/main-algorithms/low-index/classes/sims2.rst b/docs/source/main-algorithms/low-index/classes/sims2.rst index fd15e78b0..2c6f413da 100644 --- a/docs/source/main-algorithms/low-index/classes/sims2.rst +++ b/docs/source/main-algorithms/low-index/classes/sims2.rst @@ -12,7 +12,6 @@ The Sims2 class .. autoclass:: Sims2 :doc-only: - :class-doc-from: class Contents -------- @@ -52,4 +51,3 @@ Full API .. autoclass:: Sims2 :class-doc-from: init :members: - :inherited-members: diff --git a/docs/source/main-algorithms/low-index/classes/simsrefinerfaithful.rst b/docs/source/main-algorithms/low-index/classes/simsrefinerfaithful.rst index ab838a6a0..7e283dc92 100644 --- a/docs/source/main-algorithms/low-index/classes/simsrefinerfaithful.rst +++ b/docs/source/main-algorithms/low-index/classes/simsrefinerfaithful.rst @@ -12,7 +12,6 @@ The SimsRefinerFaithful class .. autoclass:: SimsRefinerFaithful :doc-only: - :class-doc-from: class Contents -------- @@ -31,5 +30,4 @@ Full API .. autoclass:: SimsRefinerFaithful :class-doc-from: init :members: - :inherited-members: :special-members: __call__ diff --git a/docs/source/main-algorithms/low-index/classes/simsrefinerideals.rst b/docs/source/main-algorithms/low-index/classes/simsrefinerideals.rst index 4a603aaf4..b0ca44935 100644 --- a/docs/source/main-algorithms/low-index/classes/simsrefinerideals.rst +++ b/docs/source/main-algorithms/low-index/classes/simsrefinerideals.rst @@ -12,7 +12,6 @@ The SimsRefinerIdeals class .. autoclass:: SimsRefinerIdeals :doc-only: - :class-doc-from: class Contents -------- @@ -31,5 +30,4 @@ Full API .. autoclass:: SimsRefinerIdeals :class-doc-from: init :members: - :inherited-members: :special-members: __call__ diff --git a/docs/source/main-algorithms/low-index/classes/simsstats.rst b/docs/source/main-algorithms/low-index/classes/simsstats.rst index 6f5bb05b7..b4bc78d7e 100644 --- a/docs/source/main-algorithms/low-index/classes/simsstats.rst +++ b/docs/source/main-algorithms/low-index/classes/simsstats.rst @@ -12,7 +12,6 @@ The SimsStats class .. autoclass:: SimsStats :doc-only: - :class-doc-from: class Contents -------- @@ -37,4 +36,3 @@ Full API .. autoclass:: SimsStats :class-doc-from: init :members: - :inherited-members: diff --git a/docs/source/main-algorithms/schreier-sims/class.rst b/docs/source/main-algorithms/schreier-sims/class.rst index 37c39d366..db37f6082 100644 --- a/docs/source/main-algorithms/schreier-sims/class.rst +++ b/docs/source/main-algorithms/schreier-sims/class.rst @@ -12,7 +12,6 @@ The Schreier-Sims class .. autoclass:: SchreierSims :doc-only: - :class-doc-from: class Contents -------- @@ -49,8 +48,8 @@ Full API -------- .. autoclass:: SchreierSims - :members: :class-doc-from: init + :members: :exclude-members: current_state, dead, finished, internal_generating_pairs, kill, last_report, report, report_every, report_prefix, diff --git a/docs/source/main-algorithms/stephen/class.rst b/docs/source/main-algorithms/stephen/class.rst index 29cb2519f..5d90bf47a 100644 --- a/docs/source/main-algorithms/stephen/class.rst +++ b/docs/source/main-algorithms/stephen/class.rst @@ -12,7 +12,6 @@ The Stephen class .. autoclass:: Stephen :doc-only: - :class-doc-from: class Contents -------- diff --git a/docs/source/main-algorithms/todd-coxeter/class/index.rst b/docs/source/main-algorithms/todd-coxeter/class/index.rst index 221088e11..b6b2da450 100644 --- a/docs/source/main-algorithms/todd-coxeter/class/index.rst +++ b/docs/source/main-algorithms/todd-coxeter/class/index.rst @@ -12,7 +12,6 @@ The ToddCoxeter class .. autoclass:: ToddCoxeter :doc-only: - :class-doc-from: class .. toctree:: :maxdepth: 1 From 41113ef3a2f804f902bb0efc8ddf70ba9888c0f2 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 16 Jun 2025 20:03:07 +0100 Subject: [PATCH 3/4] Doc: Add constructor entries to TOC --- docs/source/data-structures/elements/matrix/matrix.rst | 2 +- docs/source/data-structures/visualisation/dot.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/data-structures/elements/matrix/matrix.rst b/docs/source/data-structures/elements/matrix/matrix.rst index cfe9f3a3b..c4ff7df5a 100644 --- a/docs/source/data-structures/elements/matrix/matrix.rst +++ b/docs/source/data-structures/elements/matrix/matrix.rst @@ -27,7 +27,7 @@ Contents .. autosummary:: :signatures: short - Matrix.__init__ + ~Matrix Matrix.copy Matrix.degree Matrix.number_of_cols diff --git a/docs/source/data-structures/visualisation/dot.rst b/docs/source/data-structures/visualisation/dot.rst index df5ddb8fc..20695d2ea 100644 --- a/docs/source/data-structures/visualisation/dot.rst +++ b/docs/source/data-structures/visualisation/dot.rst @@ -19,6 +19,7 @@ Contents .. autosummary:: :signatures: short + ~Dot Dot.add_attr Dot.add_edge Dot.add_node From f72ecefb1b7c52a929bdbd21822f663d982bd36d Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 16 Jun 2025 20:24:06 +0100 Subject: [PATCH 4/4] Format: Add docstrings --- docs/source/_ext/libsemigroups_pybind11_extensions.py | 6 ++++++ src/libsemigroups_pybind11/matrix.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/_ext/libsemigroups_pybind11_extensions.py b/docs/source/_ext/libsemigroups_pybind11_extensions.py index a596d6071..c975ceb14 100644 --- a/docs/source/_ext/libsemigroups_pybind11_extensions.py +++ b/docs/source/_ext/libsemigroups_pybind11_extensions.py @@ -441,6 +441,12 @@ def check_string_replacements(app, env): def document_class(app, what, name, obj, options, lines): + """Document a class using its __init__ function + + This function sets the docstring of a class to be the __init__ function + (including the signature), rather than just the docstring of the __init__ + function. + """ if what != "class": return try: diff --git a/src/libsemigroups_pybind11/matrix.py b/src/libsemigroups_pybind11/matrix.py index ea9e45b74..a94f40da9 100644 --- a/src/libsemigroups_pybind11/matrix.py +++ b/src/libsemigroups_pybind11/matrix.py @@ -110,7 +110,7 @@ class MatrixKind(_Enum): ######################################################################## -class Matrix(_CxxWrapper): +class Matrix(_CxxWrapper): # pylint: disable=missing-class-docstring __doc__ = _BMat.__doc__ _py_template_params_to_cxx_type = {