diff --git a/.codespellrc b/.codespellrc index c3ca45da..81dd64e6 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,3 +1,3 @@ [codespell] skip = ./.git,./docs/_build/*,./gh-pages -ignore-words-list=nd,alph,falsy +ignore-words-list=nd,alph,falsy,toword diff --git a/Makefile b/Makefile index d5b5e424..7efe4438 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ check: pytest -vv tests/test_*.py lint: - pylint setup.py tests/*.py libsemigroups_pybind11/*.py + pylint --exit-zero setup.py tests/*.py libsemigroups_pybind11/*.py cpplint src/*.hpp src/*.cpp coverage: diff --git a/libsemigroups_pybind11/__init__.py b/libsemigroups_pybind11/__init__.py index fe95e980..47b15aca 100644 --- a/libsemigroups_pybind11/__init__.py +++ b/libsemigroups_pybind11/__init__.py @@ -17,8 +17,8 @@ from .tools import ld_library_path 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" + "(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)" ) @@ -55,7 +55,7 @@ except ModuleNotFoundError as e: raise ModuleNotFoundError( ( - f'{e.msg}, did you forget to run "pip install ." in the libsemigroups_pybind11' + f'{e.msg}, did you forget to run "pip install ." in the libsemigroups_pybind11 ' f"director? {DISCLAIMER}" ) ) from e diff --git a/libsemigroups_pybind11/knuth_bendix.py b/libsemigroups_pybind11/knuth_bendix.py index 39a4ea3f..1115b1c5 100644 --- a/libsemigroups_pybind11/knuth_bendix.py +++ b/libsemigroups_pybind11/knuth_bendix.py @@ -10,13 +10,12 @@ This package provides the user-facing python part of libsemigroups_pybind11 for the KnuthBendix class from libsemigroups. """ -from typing import Union as __Union from _libsemigroups_pybind11 import ( - KnuthBendixRewriteFromLeft as __KnuthBendixRewriteFromLeft, - KnuthBendixRewriteTrie as __KnuthBendixRewriteTrie, - PresentationStrings as __PresentationStrings, - PresentationWords as __PresentationWords, - congruence_kind as __congruence_kind, + KnuthBendixRewriteFromLeft as _KnuthBendixRewriteFromLeft, + KnuthBendixRewriteTrie as _KnuthBendixRewriteTrie, + PresentationStrings as _PresentationStrings, + PresentationWords as _PresentationWords, + congruence_kind as _congruence_kind, by_overlap_length, normal_forms, non_trivial_classes, @@ -26,8 +25,8 @@ ) -__Presentation = __Union[__PresentationStrings, __PresentationWords] -__KnuthBendix = __Union[__KnuthBendixRewriteFromLeft, __KnuthBendixRewriteTrie] +_Presentation = (_PresentationStrings, _PresentationWords) +_KnuthBendix = (_KnuthBendixRewriteFromLeft, _KnuthBendixRewriteTrie) def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name @@ -39,64 +38,62 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name f"KnuthBendix() takes either 1 or 2 positional arguments ({len(args)} given)" ) - if not isinstance(args[0], (__congruence_kind, __KnuthBendix)): + if not isinstance(args[0], (_congruence_kind, _KnuthBendix)): raise TypeError( ( - f"the first positional argument of KnuthBendix() must either be a congruence_kind" + f"the first positional argument of KnuthBendix() must either be a congruence_kind " f"or KnuthBendix instance ({type(args[0])} given)" ) ) - if isinstance(args[0], __KnuthBendix) and len(args) != 1: + if isinstance(args[0], _KnuthBendix) and len(args) != 1: raise TypeError( ( - f"when copying a KnuthBendix instance, KnuthBendix() must only have one positional" + f"when copying a KnuthBendix instance, KnuthBendix() must only have one positional " f"argument ({len(args)} given)" ) ) if ( - isinstance(args[0], __KnuthBendixRewriteFromLeft) + isinstance(args[0], _KnuthBendixRewriteFromLeft) and rewriter != "RewriteFromLeft" ): raise TypeError( ( - f"when copying a RewriteFromLeft KnuthBendix instance, the rewriter kwarg must be" + f"when copying a RewriteFromLeft KnuthBendix instance, the rewriter kwarg must be " f"RewriteFromLeft ({rewriter} given)" ) ) if ( - isinstance(args[0], __KnuthBendixRewriteTrie) + isinstance(args[0], _KnuthBendixRewriteTrie) and rewriter != "RewriteTrie" ): raise TypeError( ( - f"when copying a RewriteTrie KnuthBendix instance, the rewriter kwarg must be" + f"when copying a RewriteTrie KnuthBendix instance, the rewriter kwarg must be " f"RewriteTrie ({rewriter} given)" ) ) - if len(args) == 2 and not isinstance(args[1], __Presentation): + if len(args) == 2 and not isinstance(args[1], _Presentation): raise TypeError( ( - f"when KnuthBendix() is called with two positional arguments, the second positional" - f"argument must be a presentation ({type(args[1])} given)" + f"when KnuthBendix() is called with two positional arguments, the second " + f"positional argument must be a presentation ({type(args[1])} given)" ) ) - match rewriter: - case "RewriteFromLeft": - result = __KnuthBendixRewriteFromLeft(*args) - - case "RewriteTrie": - result = __KnuthBendixRewriteTrie(*args) - case _: - raise TypeError( - ( - f"KnuthBendix() expects the rewriter kwarg to be either RewriteTrie or" - f"RewriteFromLeft ({rewriter} given)" - ) + if rewriter == "RewriteFromLeft": + result = _KnuthBendixRewriteFromLeft(*args) + elif rewriter == "RewriteTrie": + result = _KnuthBendixRewriteTrie(*args) + else: + raise TypeError( + ( + f"KnuthBendix() expects the rewriter kwarg to be either RewriteTrie or " + f"RewriteFromLeft ({rewriter} given)" ) + ) return result diff --git a/libsemigroups_pybind11/tools.py b/libsemigroups_pybind11/tools.py index ffceca5b..2bd2a362 100644 --- a/libsemigroups_pybind11/tools.py +++ b/libsemigroups_pybind11/tools.py @@ -49,7 +49,7 @@ def compare_version_numbers(supplied, required): if "dev" in supplied: print( ( - "\033[93mWarning: You are using a development version of libsemigroups. This" + "\033[93mWarning: You are using a development version of libsemigroups. This " "may cause undocumented behaviour\033[0m" ) ) diff --git a/requirements.txt b/requirements.txt index 3363c104..3254f5b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ pyparsing==3.1.1 pytest==8.0.0 six==1.16.0 sphinx_rtd_theme==2.0.0 -sphinx==7.2.6 +sphinx==7.1.2 sphinx-copybutton==0.5.2 sphinxcontrib-bibtex==2.6.2 diff --git a/setup.cfg b/setup.cfg index 01508354..8be1ef2f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,3 @@ [pylint.similarities] ignore-imports=yes +notes=["TODO", "FIXME", "REVIEW"] diff --git a/src/CPPLINT.cfg b/src/CPPLINT.cfg index 57abc20e..4e22a7bb 100644 --- a/src/CPPLINT.cfg +++ b/src/CPPLINT.cfg @@ -1,4 +1,10 @@ -set noparent filter = -build / c++ 11, -build / include_subdir, - -runtime / indentation_namespace, -runtime / references, - -build / include, -readability / todo, - -runtime / printf linelength = 80 +set noparent +filter = -build/c++11, +filter = -build/c++15, +filter = -build/include_subdir, +filter = -runtime/indentation_namespace, +filter = -runtime/references, +filter = -build/include, +filter = -readability/todo, +filter = -runtime/printf +linelength = 80 diff --git a/src/bipart.cpp b/src/old/bipart.cpp similarity index 100% rename from src/bipart.cpp rename to src/old/bipart.cpp diff --git a/src/bmat8.cpp b/src/old/bmat8.cpp similarity index 100% rename from src/bmat8.cpp rename to src/old/bmat8.cpp diff --git a/src/cong-intf-doc.hpp b/src/old/cong-intf-doc.hpp similarity index 100% rename from src/cong-intf-doc.hpp rename to src/old/cong-intf-doc.hpp diff --git a/src/cong.cpp b/src/old/cong.cpp similarity index 100% rename from src/cong.cpp rename to src/old/cong.cpp diff --git a/src/fpsemi-examples.cpp b/src/old/fpsemi-examples.cpp similarity index 100% rename from src/fpsemi-examples.cpp rename to src/old/fpsemi-examples.cpp diff --git a/src/fpsemi.cpp b/src/old/fpsemi.cpp similarity index 100% rename from src/fpsemi.cpp rename to src/old/fpsemi.cpp diff --git a/src/froidure-pin.cpp b/src/old/froidure-pin.cpp similarity index 100% rename from src/froidure-pin.cpp rename to src/old/froidure-pin.cpp diff --git a/src/kambites.cpp b/src/old/kambites.cpp similarity index 100% rename from src/kambites.cpp rename to src/old/kambites.cpp diff --git a/src/konieczny.cpp b/src/old/konieczny.cpp similarity index 100% rename from src/konieczny.cpp rename to src/old/konieczny.cpp diff --git a/src/matrix.cpp b/src/old/matrix.cpp similarity index 100% rename from src/matrix.cpp rename to src/old/matrix.cpp diff --git a/src/pbr.cpp b/src/old/pbr.cpp similarity index 100% rename from src/pbr.cpp rename to src/old/pbr.cpp diff --git a/src/sims1.cpp b/src/old/sims.cpp similarity index 99% rename from src/sims1.cpp rename to src/old/sims.cpp index f2fc924e..858f0858 100644 --- a/src/sims1.cpp +++ b/src/old/sims.cpp @@ -34,7 +34,7 @@ // libsemigroups.... #include // for Presentation -#include // for Sims1 +#include // for Sims1 // pybind11.... #include // for class_, init, module diff --git a/src/stephen.cpp b/src/old/stephen.cpp similarity index 100% rename from src/stephen.cpp rename to src/old/stephen.cpp diff --git a/src/todd-coxeter.cpp b/src/old/todd-coxeter.cpp similarity index 100% rename from src/todd-coxeter.cpp rename to src/old/todd-coxeter.cpp diff --git a/src/ukkonen.cpp b/src/old/ukkonen.cpp similarity index 100% rename from src/ukkonen.cpp rename to src/old/ukkonen.cpp