From 6367560c0f6855f1e2e4a62bb18342d66aa7eed3 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 8 Apr 2024 14:17:45 +0100 Subject: [PATCH 01/13] rename sims --- src/{sims1.cpp => sims.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{sims1.cpp => sims.cpp} (100%) diff --git a/src/sims1.cpp b/src/sims.cpp similarity index 100% rename from src/sims1.cpp rename to src/sims.cpp From bfcfba1ac14bafd17531c9e4374f8623f57cb75b Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 8 Apr 2024 14:18:08 +0100 Subject: [PATCH 02/13] Fix error message spacing --- libsemigroups_pybind11/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" ) ) From e6896eae67ada1079528484cc9611d9be835274f Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 8 Apr 2024 14:21:31 +0100 Subject: [PATCH 03/13] Rename sims again --- src/sims.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sims.cpp b/src/sims.cpp index f2fc924e..858f0858 100644 --- a/src/sims.cpp +++ b/src/sims.cpp @@ -34,7 +34,7 @@ // libsemigroups.... #include // for Presentation -#include // for Sims1 +#include // for Sims1 // pybind11.... #include // for class_, init, module From 39d37ba92b2d418d644ea9a2b687e6fd54e861ea Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 8 Apr 2024 17:34:34 +0100 Subject: [PATCH 04/13] Make requirements work for python 3.8 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 57508c9de16a8a700f872d8866ba4cec5de5038f Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Mon, 8 Apr 2024 17:51:55 +0100 Subject: [PATCH 05/13] Remove match-case for backwards comp --- libsemigroups_pybind11/knuth_bendix.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libsemigroups_pybind11/knuth_bendix.py b/libsemigroups_pybind11/knuth_bendix.py index 39a4ea3f..f8386b0a 100644 --- a/libsemigroups_pybind11/knuth_bendix.py +++ b/libsemigroups_pybind11/knuth_bendix.py @@ -85,18 +85,16 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) ) - 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 From 0aa87f30c34673bd3a3f1ba3a94546e128218157 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 10:43:03 +0100 Subject: [PATCH 06/13] Move outdated cpp files to old folder --- src/{ => old}/bipart.cpp | 0 src/{ => old}/bmat8.cpp | 0 src/{ => old}/cong-intf-doc.hpp | 0 src/{ => old}/cong.cpp | 0 src/{ => old}/fpsemi-examples.cpp | 0 src/{ => old}/fpsemi.cpp | 0 src/{ => old}/froidure-pin.cpp | 0 src/{ => old}/kambites.cpp | 0 src/{ => old}/konieczny.cpp | 0 src/{ => old}/matrix.cpp | 0 src/{ => old}/pbr.cpp | 0 src/{ => old}/sims.cpp | 0 src/{ => old}/stephen.cpp | 0 src/{ => old}/todd-coxeter.cpp | 0 src/{ => old}/ukkonen.cpp | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => old}/bipart.cpp (100%) rename src/{ => old}/bmat8.cpp (100%) rename src/{ => old}/cong-intf-doc.hpp (100%) rename src/{ => old}/cong.cpp (100%) rename src/{ => old}/fpsemi-examples.cpp (100%) rename src/{ => old}/fpsemi.cpp (100%) rename src/{ => old}/froidure-pin.cpp (100%) rename src/{ => old}/kambites.cpp (100%) rename src/{ => old}/konieczny.cpp (100%) rename src/{ => old}/matrix.cpp (100%) rename src/{ => old}/pbr.cpp (100%) rename src/{ => old}/sims.cpp (100%) rename src/{ => old}/stephen.cpp (100%) rename src/{ => old}/todd-coxeter.cpp (100%) rename src/{ => old}/ukkonen.cpp (100%) 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/sims.cpp b/src/old/sims.cpp similarity index 100% rename from src/sims.cpp rename to src/old/sims.cpp 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 From baf686c40c038be51240f6673a34e0effdbd3194 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 10:56:43 +0100 Subject: [PATCH 07/13] pylint never returns error code --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From fd5d68ff9a79107f0055299371ceb00ceb5c4c3b Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 11:03:08 +0100 Subject: [PATCH 08/13] Fix formatting --- src/CPPLINT.cfg | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 From a0ef1a207053bf2edbe07a90f0100d61f276ef21 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 11:03:29 +0100 Subject: [PATCH 09/13] Accept TODOs in pylint --- setup.cfg | 1 + 1 file changed, 1 insertion(+) 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"] From 1d593d398aa655ecbefdb66d0e60d54d7b3ca3ac Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 12:21:17 +0100 Subject: [PATCH 10/13] Remove 3.10 dependencies --- libsemigroups_pybind11/knuth_bendix.py | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libsemigroups_pybind11/knuth_bendix.py b/libsemigroups_pybind11/knuth_bendix.py index f8386b0a..8f83d77b 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,7 +38,7 @@ 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" @@ -47,7 +46,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) ) - 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" @@ -56,7 +55,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) if ( - isinstance(args[0], __KnuthBendixRewriteFromLeft) + isinstance(args[0], _KnuthBendixRewriteFromLeft) and rewriter != "RewriteFromLeft" ): raise TypeError( @@ -67,7 +66,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) if ( - isinstance(args[0], __KnuthBendixRewriteTrie) + isinstance(args[0], _KnuthBendixRewriteTrie) and rewriter != "RewriteTrie" ): raise TypeError( @@ -77,7 +76,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) ) - 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" @@ -86,9 +85,9 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ) if rewriter == "RewriteFromLeft": - result = __KnuthBendixRewriteFromLeft(*args) + result = _KnuthBendixRewriteFromLeft(*args) elif rewriter == "RewriteTrie": - result = __KnuthBendixRewriteTrie(*args) + result = _KnuthBendixRewriteTrie(*args) else: raise TypeError( ( From 7008d165168c145c44fecb9e5c64cce17cfb04ef Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 12:39:51 +0100 Subject: [PATCH 11/13] Add spaces to EOL in multiline strings --- libsemigroups_pybind11/__init__.py | 6 +++--- libsemigroups_pybind11/knuth_bendix.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libsemigroups_pybind11/__init__.py b/libsemigroups_pybind11/__init__.py index fe95e980..519308ba 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 8f83d77b..1115b1c5 100644 --- a/libsemigroups_pybind11/knuth_bendix.py +++ b/libsemigroups_pybind11/knuth_bendix.py @@ -41,7 +41,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name 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)" ) ) @@ -49,7 +49,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name 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)" ) ) @@ -60,7 +60,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ): 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)" ) ) @@ -71,7 +71,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name ): 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)" ) ) @@ -79,8 +79,8 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name 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)" ) ) @@ -91,7 +91,7 @@ def KnuthBendix(*args, rewriter="RewriteTrie"): # pylint: disable=invalid-name else: raise TypeError( ( - f"KnuthBendix() expects the rewriter kwarg to be either RewriteTrie or" + f"KnuthBendix() expects the rewriter kwarg to be either RewriteTrie or " f"RewriteFromLeft ({rewriter} given)" ) ) From 5378b5e82a176a81e10f5e2a53448dc391617bf0 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 12:50:02 +0100 Subject: [PATCH 12/13] Add toword to codespell --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f5448761ee911f52271857c441e0e437e1596656 Mon Sep 17 00:00:00 2001 From: Joseph Edwards Date: Tue, 9 Apr 2024 14:35:10 +0100 Subject: [PATCH 13/13] Fix f strings --- libsemigroups_pybind11/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsemigroups_pybind11/__init__.py b/libsemigroups_pybind11/__init__.py index 519308ba..47b15aca 100644 --- a/libsemigroups_pybind11/__init__.py +++ b/libsemigroups_pybind11/__init__.py @@ -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