diff --git a/pyproject.toml b/pyproject.toml index d68f317f..f25aba8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,10 +136,9 @@ line-length = 100 [tool.ruff.lint] ignore = [ - "E111", # indentation-with-invalid-multiple - "E114", # indentation-with-invalid-multiple-comment - "E117", # over-indented - "F401", # unused-import + "E111", # indentation-with-invalid-multiple + "E114", # indentation-with-invalid-multiple-comment + "E117", # over-indented "SIM108", # use-ternary-operator ] select = [ @@ -156,12 +155,14 @@ select = [ "setup.py" = [ "E402", # module-import-not-at-top-of-file ] +"src/libsemigroups_pybind11/__init__.py" = ["F403"] "src/libsemigroups_pybind11/presentation/examples.py" = [ "E501", # line-too-long ] "tests/test_constants.py" = ["SIM"] [tool.ruff.lint.isort] +classes = ["PBR"] # This tells ruff PBR is a class, not a constant combine-as-imports = true known-first-party = ["_libsemigroups_pybind11"] split-on-trailing-comma = false diff --git a/src/libsemigroups_pybind11/__init__.py b/src/libsemigroups_pybind11/__init__.py index 25bd333f..132396e2 100644 --- a/src/libsemigroups_pybind11/__init__.py +++ b/src/libsemigroups_pybind11/__init__.py @@ -6,32 +6,43 @@ """This package provides the user-facing python part of libsemigroups_pybind11""" -import libsemigroups_pybind11.aho_corasick -import libsemigroups_pybind11.bipartition -import libsemigroups_pybind11.blocks -import libsemigroups_pybind11.bmat8 -import libsemigroups_pybind11.congruence -import libsemigroups_pybind11.forest -import libsemigroups_pybind11.froidure_pin -import libsemigroups_pybind11.hpcombi -import libsemigroups_pybind11.kambites -import libsemigroups_pybind11.knuth_bendix -import libsemigroups_pybind11.matrix -import libsemigroups_pybind11.paths -import libsemigroups_pybind11.pbr -import libsemigroups_pybind11.sims -import libsemigroups_pybind11.stephen -import libsemigroups_pybind11.todd_coxeter -import libsemigroups_pybind11.ukkonen -import libsemigroups_pybind11.word_graph -import libsemigroups_pybind11.words - -from ._version import version as __version__ +from . import ( + action, + adapters, + aho_corasick, + bipartition, + blocks, + bmat8, + congruence, + forest, + froidure_pin, + hpcombi, + kambites, + knuth_bendix, + konieczny, + matrix, + paths, + pbr, + presentation, + schreier_sims, + sims, + stephen, + todd_coxeter, + transf, + ukkonen, + word_graph, + words, +) +from ._version import __version__ from .action import Action, LeftAction, RightAction from .adapters import ImageLeftAction, ImageRightAction +from .bipartition import Bipartition +from .blocks import Blocks from .congruence import Congruence -from .detail.dot import _Dot as Dot +from .detail.dot import Dot +from .forest import PathsFromRoots, PathsToRoots from .froidure_pin import FroidurePin +from .hpcombi import LIBSEMIGROUPS_HPCOMBI_ENABLED from .is_obviously_infinite import is_obviously_infinite from .kambites import Kambites from .knuth_bendix import KnuthBendix @@ -45,7 +56,11 @@ from .todd_coxeter import ToddCoxeter from .transf import Perm, PPerm, Transf -DISCLAIMER = ( +if LIBSEMIGROUPS_HPCOMBI_ENABLED: + from .hpcombi import Perm16, PPerm16, PTransf16, Transf16, Vect16 + + +_DISCLAIMER = ( "(You should not see this message unless you are installing libsemigroups_pybind11 from its " "sources. If you are not installing from the sources, please raise an issue at " "https://github.com/libsemigroups/libsemigroups_pybind11)" @@ -54,17 +69,12 @@ try: from _libsemigroups_pybind11 import ( LIBSEMIGROUPS_EIGEN_ENABLED, - LIBSEMIGROUPS_HPCOMBI_ENABLED, LIMIT_MAX, NEGATIVE_INFINITY, - PBR, POSITIVE_INFINITY, UNDEFINED, AhoCorasick, - Bipartition, - Blocks, BMat8, - Dot, Forest, Gabow, Joiner, @@ -74,6 +84,7 @@ NegativeInfinity, Order, Paths, + PBR, PositiveInfinity, Reporter, ReportGuard, @@ -103,12 +114,120 @@ except ModuleNotFoundError as e: raise ModuleNotFoundError( f'{e.msg}, did you forget to run "pip install ." in the libsemigroups_pybind11 ' - f"directory? {DISCLAIMER}" + f"directory? {_DISCLAIMER}" ) from e -# The following fools sphinx into thinking that MatrixKind + Matrix are not -# aliases. -Matrix.__module__ = __name__ -Matrix.__name__ = "Matrix" -MatrixKind.__module__ = __name__ -MatrixKind.__name__ = "MatrixKind" + +__all__ = [ + "__version__", + # Constants from _libsemigruops_pybind11 + "LIBSEMIGROUPS_EIGEN_ENABLED", + "LIMIT_MAX", + "NEGATIVE_INFINITY", + "POSITIVE_INFINITY", + "UNDEFINED", + # Classes from _libsemigroups_pybind11 + "AhoCorasick", + "BMat8", + "Forest", + "Gabow", + "Joiner", + "LibsemigroupsError", + "LimitMax", + "Meeter", + "NegativeInfinity", + "Order", + "Paths", + "PBR", + "PositiveInfinity", + "Reporter", + "ReportGuard", + "Runner", + "SimsStats", + "StringRange", + "ToString", + "ToWord", + "Ukkonen", + "Undefined", + "WordGraph", + "WordRange", + # Free functions from _libsemigroups_pybind11 + "congruence_kind", + "delta", + "error_message_with_prefix", + "freeband_equal_to", + "lexicographical_compare", + "number_of_words", + "random_string", + "random_strings", + "random_word", + "recursive_path_compare", + "shortlex_compare", + "side", + "tril", + # Submodules + "action", + "adapters", + "aho_corasick", + "bipartition", + "blocks", + "bmat8", + "congruence", + "forest", + "froidure_pin", + "hpcombi", + "kambites", + "knuth_bendix", + "konieczny", + "matrix", + "paths", + "pbr", + "presentation", + "schreier_sims", + "sims", + "stephen", + "todd_coxeter", + "transf", + "ukkonen", + "word_graph", + "words", + # Classes defined in submodules + "Action", + "Bipartition", + "Blocks", + "Congruence", + "Dot", + "FroidurePin", + "ImageLeftAction", + "ImageRightAction", + "InversePresentation", + "Kambites", + "KnuthBendix", + "Konieczny", + "LeftAction", + "LIBSEMIGROUPS_HPCOMBI_ENABLED", + "Matrix", + "MatrixKind", + "MinimalRepOrc", + "PathsFromRoots", + "PathsToRoots", + "Perm", + "PPerm", + "Presentation", + "RepOrc", + "RightAction", + "SchreierSims", + "Sims1", + "Sims2", + "SimsRefinerFaithful", + "SimsRefinerIdeals", + "Stephen", + "ToddCoxeter", + "Transf", + # Free functions from submodules + "to", + "is_obviously_infinite", +] + +if LIBSEMIGROUPS_HPCOMBI_ENABLED: + __all__ += ["Perm16", "PPerm16", "PTransf16", "Transf16", "Vect16"] diff --git a/src/libsemigroups_pybind11/action.py b/src/libsemigroups_pybind11/action.py index 4287daa5..238d5359 100644 --- a/src/libsemigroups_pybind11/action.py +++ b/src/libsemigroups_pybind11/action.py @@ -50,7 +50,6 @@ to_py as _to_py, ) from .detail.decorators import copydoc as _copydoc -from .transf import PPerm as _PPerm, Transf as _Transf ######################################################################## # Action python class @@ -267,3 +266,6 @@ def __init__(self: _Self, *args, generators=None, seeds=None) -> None: .. include:: ../../_static/runner_non_inherit.rst """ super().__init__(generators=generators, seeds=seeds, side=_side.left, func=_ImageLeftAction) + + +__all__ = ["Action", "LeftAction", "RightAction"] diff --git a/src/libsemigroups_pybind11/adapters.py b/src/libsemigroups_pybind11/adapters.py index fe094c1e..203b8d24 100644 --- a/src/libsemigroups_pybind11/adapters.py +++ b/src/libsemigroups_pybind11/adapters.py @@ -141,3 +141,6 @@ class ImageLeftAction(_ImageAction): @_copydoc(_ImageLeftActionPPerm1PPerm1.__call__) def __call__(self: _Self, pt: Point, x: Element) -> Point: return _to_py(_to_cxx(self)(_to_cxx(pt), _to_cxx(x))) + + +__all__ = ["ImageLeftAction", "ImageRightAction"] diff --git a/src/libsemigroups_pybind11/aho_corasick.py b/src/libsemigroups_pybind11/aho_corasick.py index 3a932b7b..906ac6da 100644 --- a/src/libsemigroups_pybind11/aho_corasick.py +++ b/src/libsemigroups_pybind11/aho_corasick.py @@ -11,9 +11,11 @@ as free functions instead. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import +from _libsemigroups_pybind11 import ( aho_corasick_add_word as add_word, aho_corasick_dot as dot, aho_corasick_rm_word as rm_word, aho_corasick_traverse_word as traverse_word, ) + +__all__ = ["add_word", "dot", "rm_word", "traverse_word"] diff --git a/src/libsemigroups_pybind11/bipartition.py b/src/libsemigroups_pybind11/bipartition.py index c66b10a9..9aa2ee40 100644 --- a/src/libsemigroups_pybind11/bipartition.py +++ b/src/libsemigroups_pybind11/bipartition.py @@ -8,10 +8,12 @@ contains helper functions for the :any:`Bipartition` class. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import +from _libsemigroups_pybind11 import ( Bipartition, bipartition_one as one, bipartition_random as random, bipartition_underlying_partition as underlying_partition, bipartition_uniform_random as uniform_random, ) + +__all__ = ["Bipartition", "one", "random", "underlying_partition", "uniform_random"] diff --git a/src/libsemigroups_pybind11/blocks.py b/src/libsemigroups_pybind11/blocks.py index f4342d48..b065fa1f 100644 --- a/src/libsemigroups_pybind11/blocks.py +++ b/src/libsemigroups_pybind11/blocks.py @@ -8,7 +8,6 @@ contains helper functions for the :any:`Blocks` class. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import - Blocks, - blocks_underlying_partition as underlying_partition, -) +from _libsemigroups_pybind11 import Blocks, blocks_underlying_partition as underlying_partition + +__all__ = ["Blocks", "underlying_partition"] diff --git a/src/libsemigroups_pybind11/bmat8.py b/src/libsemigroups_pybind11/bmat8.py index 782270a9..9cc82e77 100644 --- a/src/libsemigroups_pybind11/bmat8.py +++ b/src/libsemigroups_pybind11/bmat8.py @@ -8,7 +8,7 @@ ``libsemigroups_pybind11.bmat8``. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import +from _libsemigroups_pybind11 import ( bmat8_col_space_basis as col_space_basis, bmat8_col_space_size as col_space_size, bmat8_is_regular_element as is_regular_element, @@ -22,3 +22,18 @@ bmat8_rows as rows, bmat8_transpose as transpose, ) + +__all__ = [ + "col_space_basis", + "col_space_size", + "is_regular_element", + "minimum_dim", + "number_of_cols", + "number_of_rows", + "one", + "random", + "row_space_basis", + "row_space_size", + "rows", + "transpose", +] diff --git a/src/libsemigroups_pybind11/congruence.py b/src/libsemigroups_pybind11/congruence.py index d2d66bc0..d9300f58 100644 --- a/src/libsemigroups_pybind11/congruence.py +++ b/src/libsemigroups_pybind11/congruence.py @@ -128,3 +128,5 @@ def has(self: _Self, t: type) -> bool: partition = _wrap_cxx_free_fn(_congruence_partition) non_trivial_classes = _wrap_cxx_free_fn(_congruence_non_trivial_classes) + +__all__ = ["Congruence", "partition", "non_trivial_classes"] diff --git a/src/libsemigroups_pybind11/detail/congruence_common.py b/src/libsemigroups_pybind11/detail/congruence_common.py index 0db45479..20213262 100644 --- a/src/libsemigroups_pybind11/detail/congruence_common.py +++ b/src/libsemigroups_pybind11/detail/congruence_common.py @@ -11,7 +11,6 @@ from typing_extensions import Self from _libsemigroups_pybind11 import congruence_kind as _congruence_kind -from libsemigroups_pybind11.presentation import Presentation as _Presentation from .cxx_wrapper import CxxWrapper as _CxxWrapper, to_cxx as _to_cxx diff --git a/src/libsemigroups_pybind11/detail/dot.py b/src/libsemigroups_pybind11/detail/dot.py index e584805a..a763a9f0 100644 --- a/src/libsemigroups_pybind11/detail/dot.py +++ b/src/libsemigroups_pybind11/detail/dot.py @@ -11,7 +11,7 @@ from graphviz import Source as _Source -from _libsemigroups_pybind11 import Dot as _Dot +from _libsemigroups_pybind11 import Dot def _view( # pylint: disable=too-many-arguments, too-many-positional-arguments @@ -39,4 +39,4 @@ def _view( # pylint: disable=too-many-arguments, too-many-positional-arguments s.view() -_Dot.view = _view +Dot.view = _view diff --git a/src/libsemigroups_pybind11/forest.py b/src/libsemigroups_pybind11/forest.py index e77b8b8a..e12d7ecc 100644 --- a/src/libsemigroups_pybind11/forest.py +++ b/src/libsemigroups_pybind11/forest.py @@ -9,9 +9,7 @@ contained in the submodule ``forest``. """ -from typing_extensions import Self as _Self - -from _libsemigroups_pybind11 import ( # pylint: disable= unused-import +from _libsemigroups_pybind11 import ( forest_depth as depth, forest_dot as dot, forest_is_root as is_root, @@ -23,8 +21,19 @@ ) # The following fools sphinx into thinking that PathsToRoots is not an -# aliases. +# alias. PathsFromRoots.__module__ = __name__ PathsFromRoots.__name__ = "PathsFromRoots" PathsToRoots.__module__ = __name__ PathsToRoots.__name__ = "PathsToRoots" + +__all__ = [ + "PathsFromRoots", + "PathsToRoots", + "depth", + "dot", + "is_root", + "max_label", + "path_from_root", + "path_to_root", +] diff --git a/src/libsemigroups_pybind11/froidure_pin.py b/src/libsemigroups_pybind11/froidure_pin.py index b77740ba..dd88ba11 100644 --- a/src/libsemigroups_pybind11/froidure_pin.py +++ b/src/libsemigroups_pybind11/froidure_pin.py @@ -19,7 +19,6 @@ from _libsemigroups_pybind11 import ( LIBSEMIGROUPS_HPCOMBI_ENABLED as _LIBSEMIGROUPS_HPCOMBI_ENABLED, - PBR as _PBR, Bipartition as _Bipartition, BMat as _BMat, BMat8 as _BMat8, @@ -61,6 +60,7 @@ MinPlusMat as _MinPlusMat, MinPlusTruncMat as _MinPlusTruncMat, NTPMat as _NTPMat, + PBR as _PBR, Perm1 as _Perm1, Perm2 as _Perm2, Perm4 as _Perm4, @@ -273,3 +273,19 @@ def sorted_elements( # pylint: disable=missing-function-docstring product_by_reduction = _wrap_cxx_free_fn(_froidure_pin_product_by_reduction) rules = _wrap_cxx_free_fn(_froidure_pin_rules) to_element = _wrap_cxx_free_fn(_froidure_pin_to_element) + +__all__ = [ + "FroidurePin", + "current_minimal_factorisation", + "current_normal_forms", + "current_position", + "current_rules", + "equal_to", + "factorisation", + "minimal_factorisation", + "normal_forms", + "position", + "product_by_reduction", + "rules", + "to_element", +] diff --git a/src/libsemigroups_pybind11/hpcombi.py b/src/libsemigroups_pybind11/hpcombi.py index 990d18b5..8793ad9c 100644 --- a/src/libsemigroups_pybind11/hpcombi.py +++ b/src/libsemigroups_pybind11/hpcombi.py @@ -10,6 +10,8 @@ from _libsemigroups_pybind11 import LIBSEMIGROUPS_HPCOMBI_ENABLED +__all__ = ["LIBSEMIGROUPS_HPCOMBI_ENABLED"] + if LIBSEMIGROUPS_HPCOMBI_ENABLED: from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module hpcombi_Perm16 as Perm16, @@ -32,3 +34,5 @@ Transf16.__name__ = "Transf16" Vect16.__module__ = __name__ Vect16.__name__ = "Vect16" + + __all__ += ["Perm16", "PPerm16", "PTransf16", "Transf16", "Vect16"] diff --git a/src/libsemigroups_pybind11/is_obviously_infinite.py b/src/libsemigroups_pybind11/is_obviously_infinite.py index fde937cc..75d765b2 100644 --- a/src/libsemigroups_pybind11/is_obviously_infinite.py +++ b/src/libsemigroups_pybind11/is_obviously_infinite.py @@ -14,3 +14,5 @@ from .detail.cxx_wrapper import wrap_cxx_free_fn as _wrap_cxx_free_fn is_obviously_infinite = _wrap_cxx_free_fn(_is_obviously_infinite) + +__all__ = ["is_obviously_infinite"] diff --git a/src/libsemigroups_pybind11/kambites.py b/src/libsemigroups_pybind11/kambites.py index 47d07da1..2855befc 100644 --- a/src/libsemigroups_pybind11/kambites.py +++ b/src/libsemigroups_pybind11/kambites.py @@ -14,7 +14,6 @@ KambitesMultiViewString as _KambitesMultiViewString, KambitesString as _KambitesString, KambitesWord as _KambitesWord, - congruence_kind as _congruence_kind, kambites_non_trivial_classes as _kambites_non_trivial_classes, kambites_normal_forms as _kambites_normal_forms, kambites_partition as _kambites_partition, @@ -70,6 +69,8 @@ def __init__(self: _Self, *args, **kwargs) -> None: _register_cxx_wrapped_type(_KambitesMultiViewString, Kambites) _register_cxx_wrapped_type(_KambitesString, Kambites) -partition = _wrap_cxx_free_fn(_kambites_partition) non_trivial_classes = _wrap_cxx_free_fn(_kambites_non_trivial_classes) normal_forms = _wrap_cxx_free_fn(_kambites_normal_forms) +partition = _wrap_cxx_free_fn(_kambites_partition) + +__all__ = ["Kambites", "non_trivial_classes", "normal_forms", "partition"] diff --git a/src/libsemigroups_pybind11/knuth_bendix.py b/src/libsemigroups_pybind11/knuth_bendix.py index 3cd5e7a8..ac2410d4 100644 --- a/src/libsemigroups_pybind11/knuth_bendix.py +++ b/src/libsemigroups_pybind11/knuth_bendix.py @@ -14,7 +14,6 @@ KnuthBendixStringRewriteTrie as _KnuthBendixStringRewriteTrie, KnuthBendixWordRewriteFromLeft as _KnuthBendixWordRewriteFromLeft, KnuthBendixWordRewriteTrie as _KnuthBendixWordRewriteTrie, - congruence_kind as _congruence_kind, knuth_bendix_by_overlap_length as _knuth_bendix_by_overlap_length, knuth_bendix_is_reduced as _knuth_bendix_is_reduced, knuth_bendix_non_trivial_classes as _knuth_bendix_non_trivial_classes, @@ -110,3 +109,13 @@ def __init__(self, *args, rewriter="RewriteTrie", **kwargs) -> None: normal_forms = _wrap_cxx_free_fn(_knuth_bendix_normal_forms) partition = _wrap_cxx_free_fn(_knuth_bendix_partition) redundant_rule = _wrap_cxx_free_fn(_knuth_bendix_redundant_rule) + +__all__ = [ + "KnuthBendix", + "by_overlap_length", + "is_reduced", + "non_trivial_classes", + "normal_forms", + "partition", + "redundant_rule", +] diff --git a/src/libsemigroups_pybind11/konieczny.py b/src/libsemigroups_pybind11/konieczny.py index 19960730..8321659f 100644 --- a/src/libsemigroups_pybind11/konieczny.py +++ b/src/libsemigroups_pybind11/konieczny.py @@ -212,3 +212,5 @@ def D_classes(self: _Self) -> _Iterator[DClass]: Konieczny.DClass._py_template_params_to_cxx_type.values() # pylint: disable=protected-access ): _register_cxx_wrapped_type(_type, Konieczny.DClass) + +__all__ = ["Konieczny"] diff --git a/src/libsemigroups_pybind11/matrix.py b/src/libsemigroups_pybind11/matrix.py index 6f681aa6..717ae5a9 100644 --- a/src/libsemigroups_pybind11/matrix.py +++ b/src/libsemigroups_pybind11/matrix.py @@ -184,13 +184,22 @@ def __hash__(self: _Self) -> int: return _to_cxx(self).__hash__() +# The following fools sphinx into thinking that MatrixKind + Matrix are not +# aliases. +Matrix.__module__ = __name__ +Matrix.__name__ = "Matrix" +MatrixKind.__module__ = __name__ +MatrixKind.__name__ = "MatrixKind" + _copy_cxx_mem_fns(_NTPMat, Matrix) ######################################################################## # Helper functions ######################################################################## -row_space_size = _wrap_cxx_free_fn(_row_space_size) period = _wrap_cxx_free_fn(_period) row_basis = _wrap_cxx_free_fn(_row_basis) +row_space_size = _wrap_cxx_free_fn(_row_space_size) threshold = _wrap_cxx_free_fn(_threshold) + +__all__ = ["MatrixKind", "Matrix", "period", "row_basis", "row_space_size", "threshold"] diff --git a/src/libsemigroups_pybind11/paths.py b/src/libsemigroups_pybind11/paths.py index a4e9230a..20dc4178 100644 --- a/src/libsemigroups_pybind11/paths.py +++ b/src/libsemigroups_pybind11/paths.py @@ -8,7 +8,7 @@ contains helper functions for the :any:`Paths` class. """ -from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import +from _libsemigroups_pybind11 import ( paths_algorithm as algorithm, paths_number_of_paths as number_of_paths, paths_number_of_paths_algorithm as number_of_paths_algorithm, @@ -18,3 +18,5 @@ # alias. algorithm.__module__ = __name__ algorithm.__name__ = "algorithm" + +__all__ = ["algorithm", "number_of_paths", "number_of_paths_algorithm"] diff --git a/src/libsemigroups_pybind11/pbr.py b/src/libsemigroups_pybind11/pbr.py index 292e8d90..df5e3598 100644 --- a/src/libsemigroups_pybind11/pbr.py +++ b/src/libsemigroups_pybind11/pbr.py @@ -8,4 +8,6 @@ contains helper functions for the :any:`PBR` class. """ -from _libsemigroups_pybind11 import pbr_one as one # pylint: disable=unused-import +from _libsemigroups_pybind11 import pbr_one as one + +__all__ = ["one"] diff --git a/src/libsemigroups_pybind11/presentation/__init__.py b/src/libsemigroups_pybind11/presentation/__init__.py index 78232d8d..ab3cac38 100644 --- a/src/libsemigroups_pybind11/presentation/__init__.py +++ b/src/libsemigroups_pybind11/presentation/__init__.py @@ -56,14 +56,16 @@ presentation_to_gap_string as _to_gap_string, presentation_try_detect_inverses as _try_detect_inverses, ) -from libsemigroups_pybind11.detail.cxx_wrapper import ( + +from ..detail.cxx_wrapper import ( CxxWrapper as _CxxWrapper, copy_cxx_mem_fns as _copy_cxx_mem_fns, register_cxx_wrapped_type as _register_cxx_wrapped_type, to_cxx as _to_cxx, wrap_cxx_free_fn as _wrap_cxx_free_fn, ) -from libsemigroups_pybind11.detail.decorators import copydoc as _copydoc +from ..detail.decorators import copydoc as _copydoc +from . import examples ######################################################################## # Presentation @@ -271,3 +273,51 @@ def __init__(self: _Self, *args, **kwargs) -> None: is_normalized = _wrap_cxx_free_fn(_is_normalized) is_rule = _wrap_cxx_free_fn(_is_rule) try_detect_inverses = _wrap_cxx_free_fn(_try_detect_inverses) + +__all__ = [ + "Presentation", + "InversePresentation", + "add_commutator_rule", + "add_identity_rules", + "add_inverse_rules", + "add_rule", + "add_rules", + "add_zero_rules", + "are_rules_sorted", + "change_alphabet", + "commutator", + "contains_rule", + "first_unused_letter", + "greedy_reduce_length", + "greedy_reduce_length_and_number_of_gens", + "is_strongly_compressible", + "length", + "longest_rule", + "longest_rule_length", + "longest_subword_reducing_length", + "make_semigroup", + "normalize_alphabet", + "reduce_complements", + "reduce_to_2_generators", + "remove_duplicate_rules", + "remove_redundant_generators", + "remove_trivial_rules", + "replace_subword", + "replace_word", + "replace_word_with_new_generator", + "reverse", + "shortest_rule", + "shortest_rule_length", + "sort_each_rule", + "sort_rules", + "strongly_compress", + "throw_if_bad_inverses", + "to_gap_string", + "balance", + "add_cyclic_conjugates", + "index_rule", + "is_normalized", + "is_rule", + "try_detect_inverses", + "examples", +] diff --git a/src/libsemigroups_pybind11/presentation/examples.py b/src/libsemigroups_pybind11/presentation/examples.py index 9f7ca960..f7863553 100644 --- a/src/libsemigroups_pybind11/presentation/examples.py +++ b/src/libsemigroups_pybind11/presentation/examples.py @@ -191,3 +191,89 @@ uniform_block_bijection_monoid_Fit03 = _wrap_cxx_free_fn(_uniform_block_bijection_monoid_Fit03) zero_rook_monoid = _wrap_cxx_free_fn(_zero_rook_monoid) zero_rook_monoid_Gay18 = _wrap_cxx_free_fn(_zero_rook_monoid_Gay18) + +__all__ = [ + "abacus_jones_monoid", + "abacus_jones_monoid_AJP25", + "alternating_group", + "alternating_group_Moo97", + "brauer_monoid", + "braid_group", + "brauer_monoid_KM07", + "chinese_monoid", + "chinese_monoid_CEKNH01", + "cyclic_inverse_monoid", + "cyclic_inverse_monoid_Fer22_a", + "cyclic_inverse_monoid_Fer22_b", + "dual_symmetric_inverse_monoid", + "dual_symmetric_inverse_monoid_EEF07", + "fibonacci_semigroup", + "fibonacci_semigroup_CRRT94", + "full_transformation_monoid", + "full_transformation_monoid_Aiz58", + "full_transformation_monoid_II74", + "full_transformation_monoid_MW24_a", + "full_transformation_monoid_MW24_b", + "hypo_plactic_monoid", + "hypo_plactic_monoid_Nov00", + "monogenic_semigroup", + "motzkin_monoid", + "motzkin_monoid_PHL13", + "not_renner_type_B_monoid", + "not_renner_type_B_monoid_Gay18", + "not_renner_type_D_monoid", + "not_renner_type_D_monoid_God09", + "not_symmetric_group", + "not_symmetric_group_GKKL08", + "order_preserving_cyclic_inverse_monoid", + "order_preserving_cyclic_inverse_monoid_Fer22", + "order_preserving_monoid", + "order_preserving_monoid_AR00", + "orientation_preserving_monoid", + "orientation_preserving_monoid_AR00", + "orientation_preserving_reversing_monoid", + "orientation_preserving_reversing_monoid_AR00", + "partial_brauer_monoid", + "partial_brauer_monoid_KM07", + "partial_isometries_cycle_graph_monoid", + "partial_isometries_cycle_graph_monoid_FP22", + "partial_transformation_monoid", + "partial_transformation_monoid_MW24", + "partial_transformation_monoid_Shu60", + "partition_monoid", + "partition_monoid_Eas11", + "partition_monoid_HR05", + "plactic_monoid", + "plactic_monoid_Knu70", + "rectangular_band", + "rectangular_band_ACOR00", + "renner_type_B_monoid", + "renner_type_B_monoid_Gay18", + "renner_type_D_monoid", + "renner_type_D_monoid_Gay18", + "sigma_plactic_monoid", + "sigma_plactic_monoid_AHMNT24", + "singular_brauer_monoid", + "singular_brauer_monoid_MM07", + "special_linear_group_2", + "special_linear_group_2_CR80", + "stellar_monoid", + "stellar_monoid_GH19", + "stylic_monoid", + "stylic_monoid_AR22", + "symmetric_group", + "symmetric_group_Bur12", + "symmetric_group_Car56", + "symmetric_group_Moo97_a", + "symmetric_group_Moo97_b", + "symmetric_inverse_monoid", + "symmetric_inverse_monoid_Sol04", + "symmetric_inverse_monoid_MW24", + "symmetric_inverse_monoid_Shu60", + "temperley_lieb_monoid", + "temperley_lieb_monoid_Eas21", + "uniform_block_bijection_monoid", + "uniform_block_bijection_monoid_Fit03", + "zero_rook_monoid", + "zero_rook_monoid_Gay18", +] diff --git a/src/libsemigroups_pybind11/schreier_sims.py b/src/libsemigroups_pybind11/schreier_sims.py index dd10de6c..907b3462 100644 --- a/src/libsemigroups_pybind11/schreier_sims.py +++ b/src/libsemigroups_pybind11/schreier_sims.py @@ -108,3 +108,5 @@ def __init__(self: _Self, *args) -> None: intersection = _wrap_cxx_free_fn(_schreier_sims_intersection) + +__all__ = ["SchreierSims", "intersection"] diff --git a/src/libsemigroups_pybind11/sims.py b/src/libsemigroups_pybind11/sims.py index 37a811eb..acc722d2 100644 --- a/src/libsemigroups_pybind11/sims.py +++ b/src/libsemigroups_pybind11/sims.py @@ -286,10 +286,26 @@ def __call__(self: _Self, *args, **kwargs) -> bool: # Helper functions ######################################################################## -right_generating_pairs = _wrap_cxx_free_fn(_right_generating_pairs) -two_sided_generating_pairs = _wrap_cxx_free_fn(_two_sided_generating_pairs) +is_maximal_right_congruence = _wrap_cxx_free_fn(_is_maximal_right_congruence) is_right_congruence = _wrap_cxx_free_fn(_is_right_congruence) is_right_congruence_of_dual = _wrap_cxx_free_fn(_is_right_congruence_of_dual) is_two_sided_congruence = _wrap_cxx_free_fn(_is_two_sided_congruence) -is_maximal_right_congruence = _wrap_cxx_free_fn(_is_maximal_right_congruence) poset = _wrap_cxx_free_fn(_poset) +right_generating_pairs = _wrap_cxx_free_fn(_right_generating_pairs) +two_sided_generating_pairs = _wrap_cxx_free_fn(_two_sided_generating_pairs) + +__all__ = [ + "MinimalRepOrc", + "RepOrc", + "Sims1", + "Sims2", + "SimsRefinerFaithful", + "SimsRefinerIdeals", + "is_maximal_right_congruence", + "is_right_congruence_of_dual", + "is_right_congruence", + "is_two_sided_congruence", + "poset", + "right_generating_pairs", + "two_sided_generating_pairs", +] diff --git a/src/libsemigroups_pybind11/stephen.py b/src/libsemigroups_pybind11/stephen.py index 592db98e..5598cce4 100644 --- a/src/libsemigroups_pybind11/stephen.py +++ b/src/libsemigroups_pybind11/stephen.py @@ -103,3 +103,14 @@ def __imul__(self: _Self, other: _Self) -> _Self: number_of_left_factors = _wrap_cxx_free_fn(_stephen_number_of_left_factors) number_of_words_accepted = _wrap_cxx_free_fn(_stephen_number_of_words_accepted) words_accepted = _wrap_cxx_free_fn(_stephen_words_accepted) + +__all__ = [ + "Stephen", + "accepts", + "dot", + "is_left_factor", + "left_factors", + "number_of_left_factors", + "number_of_words_accepted", + "words_accepted", +] diff --git a/src/libsemigroups_pybind11/to.py b/src/libsemigroups_pybind11/to.py index 5fcbf96e..b60915d5 100644 --- a/src/libsemigroups_pybind11/to.py +++ b/src/libsemigroups_pybind11/to.py @@ -147,3 +147,6 @@ def to(*args, rtype: tuple): ) constructor = rtype[0] return constructor(_RETURN_TYPE_TO_CONVERTER_FUNCTION[rtype](*cxx_args)) + + +__all__ = ["to"] diff --git a/src/libsemigroups_pybind11/todd_coxeter.py b/src/libsemigroups_pybind11/todd_coxeter.py index 110c86b8..7eb2c55f 100644 --- a/src/libsemigroups_pybind11/todd_coxeter.py +++ b/src/libsemigroups_pybind11/todd_coxeter.py @@ -88,6 +88,18 @@ def __init__(self: _Self, *args, **kwargs) -> None: perform_lookbehind = _wrap_cxx_free_fn(_todd_coxeter_perform_lookbehind) redundant_rule = _wrap_cxx_free_fn(_todd_coxeter_redundant_rule) +__all__ = [ + "ToddCoxeter", + "class_by_index", + "class_of", + "is_non_trivial", + "non_trivial_classes", + "normal_forms", + "partition", + "perform_lookbehind", + "redundant_rule", +] + ######################################################################## # Helper functions ######################################################################## diff --git a/src/libsemigroups_pybind11/transf.py b/src/libsemigroups_pybind11/transf.py index 80075ebd..e0d68202 100644 --- a/src/libsemigroups_pybind11/transf.py +++ b/src/libsemigroups_pybind11/transf.py @@ -10,7 +10,6 @@ """ import abc -from typing import Any as _Any from typing_extensions import Self @@ -352,9 +351,11 @@ def one(n: int) -> Self: # Helper functions ######################################################################## -one = _wrap_cxx_free_fn(_transf_one) +domain = _wrap_cxx_free_fn(_transf_domain) +image = _wrap_cxx_free_fn(_transf_image) inverse = _wrap_cxx_free_fn(_transf_inverse) -right_one = _wrap_cxx_free_fn(_transf_right_one) left_one = _wrap_cxx_free_fn(_transf_left_one) -image = _wrap_cxx_free_fn(_transf_image) -domain = _wrap_cxx_free_fn(_transf_domain) +one = _wrap_cxx_free_fn(_transf_one) +right_one = _wrap_cxx_free_fn(_transf_right_one) + +__all__ = ["Perm", "PPerm", "Transf", "domain", "image", "inverse", "left_one", "one", "right_one"] diff --git a/src/libsemigroups_pybind11/ukkonen.py b/src/libsemigroups_pybind11/ukkonen.py index 1312bc42..70b67419 100644 --- a/src/libsemigroups_pybind11/ukkonen.py +++ b/src/libsemigroups_pybind11/ukkonen.py @@ -8,7 +8,7 @@ contains helper functions for the :any:`Ukkonen` class. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import +from _libsemigroups_pybind11 import ( ukkonen_add_word as add_word, ukkonen_add_words as add_words, ukkonen_dot as dot, @@ -24,3 +24,20 @@ ukkonen_pieces as pieces, ukkonen_traverse as traverse, ) + +__all__ = [ + "add_word", + "add_words", + "dot", + "is_piece", + "is_subword", + "is_suffix", + "length_maximal_piece_prefix", + "length_maximal_piece_suffix", + "maximal_piece_prefix", + "maximal_piece_suffix", + "number_of_distinct_subwords", + "number_of_pieces", + "pieces", + "traverse", +] diff --git a/src/libsemigroups_pybind11/word_graph.py b/src/libsemigroups_pybind11/word_graph.py index d6d42770..a94a6020 100644 --- a/src/libsemigroups_pybind11/word_graph.py +++ b/src/libsemigroups_pybind11/word_graph.py @@ -10,7 +10,7 @@ are contained in the subpackage ``word_graph``. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import +from _libsemigroups_pybind11 import ( word_graph_add_cycle as add_cycle, word_graph_adjacency_matrix as adjacency_matrix, word_graph_dot as dot, @@ -30,3 +30,24 @@ word_graph_standardize as standardize, word_graph_topological_sort as topological_sort, ) + +__all__ = [ + "add_cycle", + "adjacency_matrix", + "dot", + "equal_to", + "follow_path", + "is_acyclic", + "is_compatible", + "is_complete", + "is_connected", + "is_reachable", + "is_strictly_cyclic", + "last_node_on_path", + "nodes_reachable_from", + "number_of_nodes_reachable_from", + "random_acyclic", + "spanning_tree", + "standardize", + "topological_sort", +] diff --git a/src/libsemigroups_pybind11/words.py b/src/libsemigroups_pybind11/words.py index 1c0f126f..4b3f0893 100644 --- a/src/libsemigroups_pybind11/words.py +++ b/src/libsemigroups_pybind11/words.py @@ -9,10 +9,12 @@ contains helper functions related to words. """ -from _libsemigroups_pybind11 import ( # pylint: disable=unused-import,redefined-builtin +from _libsemigroups_pybind11 import ( # pylint: disable=redefined-builtin words_human_readable_index as human_readable_index, words_human_readable_letter as human_readable_letter, words_parse_relations as parse_relations, words_pow as pow, words_prod as prod, ) + +__all__ = ["human_readable_index", "human_readable_letter", "parse_relations", "pow", "prod"] diff --git a/tests/test_froidure_pin.py b/tests/test_froidure_pin.py index eea7d86f..5c751ada 100644 --- a/tests/test_froidure_pin.py +++ b/tests/test_froidure_pin.py @@ -14,7 +14,6 @@ import pytest from libsemigroups_pybind11 import ( - PBR, UNDEFINED, Bipartition, BMat8, @@ -23,6 +22,7 @@ LibsemigroupsError, Matrix, MatrixKind, + PBR, Perm, PPerm, Presentation,