Skip to content

Commit e9554dd

Browse files
Fix pylint disables
1 parent 1bff29b commit e9554dd

36 files changed

+332
-282
lines changed

libsemigroups_pybind11/__init__.py

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,42 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module, wrong-import-position, unused-import,
10-
# pylint: disable=import-error
11-
129
"""
1310
This package provides the user-facing python part of libsemigroups_pybind11
1411
"""
1512

1613
import pkgconfig
1714

15+
from .detail.dot import _Dot as Dot
16+
17+
from .action import Action, RightAction, LeftAction
18+
from .adapters import ImageRightAction, ImageLeftAction
19+
from .congruence import Congruence
20+
from .froidure_pin import FroidurePin
21+
from .is_obviously_infinite import is_obviously_infinite
22+
from .kambites import Kambites
23+
from .knuth_bendix import KnuthBendix
24+
from .konieczny import Konieczny
25+
from .matrix import _Matrix as Matrix, _MatrixKind as MatrixKind
26+
from .presentation import Presentation, InversePresentation
27+
from .schreier_sims import SchreierSims
28+
from .sims import (
29+
MinimalRepOrc,
30+
RepOrc,
31+
Sims1,
32+
Sims2,
33+
SimsRefinerFaithful,
34+
SimsRefinerIdeals,
35+
)
36+
from .stephen import Stephen
37+
from .to import to
38+
from .todd_coxeter import ToddCoxeter
39+
from .transf import (
40+
PPerm,
41+
Perm,
42+
Transf,
43+
)
44+
1845
DISCLAIMER = (
1946
"(You should not see this message unless you are installing libsemigroups_pybind11 from its "
2047
"sources. If you are not installing from the sources, please raise an issue at "
@@ -24,7 +51,7 @@
2451
assert pkgconfig.exists("libsemigroups")
2552

2653
try:
27-
from _libsemigroups_pybind11 import (
54+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
2855
AhoCorasick,
2956
BMat8,
3057
Bipartition,
@@ -70,43 +97,7 @@
7097
)
7198
) from e
7299

73-
from .detail.dot import _Dot as Dot
74-
75-
from .action import Action, RightAction, LeftAction
76-
from .adapters import ImageRightAction, ImageLeftAction
77-
78-
from .congruence import Congruence
79-
from .is_obviously_infinite import is_obviously_infinite
80-
from .kambites import Kambites
81-
82-
from .knuth_bendix import KnuthBendix
83-
from .matrix import _Matrix as Matrix, _MatrixKind as MatrixKind
84-
from .presentation import Presentation, InversePresentation
85-
from .transf import (
86-
PPerm,
87-
Transf,
88-
Perm,
89-
)
90-
91-
from .todd_coxeter import ToddCoxeter
92100

93101
# The following fools sphinx into thinking that MatrixKind is not an alias.
94102
MatrixKind.__module__ = __name__
95103
MatrixKind.__name__ = "MatrixKind"
96-
97-
from .froidure_pin import FroidurePin
98-
from .schreier_sims import SchreierSims
99-
100-
from .stephen import Stephen
101-
102-
from .to import to
103-
from .konieczny import Konieczny
104-
105-
from .sims import (
106-
Sims1,
107-
Sims2,
108-
RepOrc,
109-
MinimalRepOrc,
110-
SimsRefinerFaithful,
111-
SimsRefinerIdeals,
112-
)

libsemigroups_pybind11/action.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint:disable=no-name-in-module, unused-import,
10-
# pylint:disable=missing-function-docstring,
11-
129
"""
1310
This package provides the user-facing python part of libsemigroups_pybind11 for
1411
the Action class from libsemigroups.
1512
"""
1613

17-
from typing import Any, Union, Iterator, TypeVar as _TypeVar
14+
from typing import Iterator, TypeVar as _TypeVar
1815
from typing_extensions import Self as _Self
1916

20-
from _libsemigroups_pybind11 import (
17+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
2118
BMat8 as _BMat8,
2219
LeftActionBMat8BMat8 as _LeftActionBMat8BMat8,
2320
LeftActionPPerm1List as _LeftActionPPerm1List,
@@ -265,6 +262,7 @@ def __contains__(self: _Self, pt: Point) -> bool:
265262

266263
@_copydoc(_RightActionPPerm1PPerm1.generators)
267264
def generators(self: _Self) -> Iterator[Element]:
265+
# pylint: disable=missing-function-docstring
268266
return map(
269267
_to_py,
270268
_to_cxx(self).generators(),

libsemigroups_pybind11/adapters.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint:disable=no-name-in-module, unused-import
10-
119
"""
1210
This package provides the user-facing python part of libsemigroups_pybind11 for
1311
various adapters from libsemigroups.
1412
"""
1513

16-
from typing import Any, Union, Iterator, TypeVar as _TypeVar, List
17-
14+
from typing import TypeVar as _TypeVar
1815
from typing_extensions import Self as _Self
1916

20-
from _libsemigroups_pybind11 import (
17+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
2118
# TODO Transf
2219
# TODO other pperms
2320
BMat8 as _BMat8,
@@ -72,7 +69,9 @@ def __init__(self: _Self, *args, point=None, element=None) -> None:
7269
if _to_cxx(self) is not None:
7370
return
7471
if len(args) != 0:
75-
raise ValueError(f"expected 0 positional arguments, but found {len(args)}")
72+
raise ValueError(
73+
f"expected 0 positional arguments, but found {len(args)}"
74+
)
7675
self.py_template_params = (
7776
type(_to_cxx(element)),
7877
type(_to_cxx(point)),
@@ -120,7 +119,11 @@ def __call__(self: _Self, pt: Point, x: Element) -> Point:
120119

121120
_copy_cxx_mem_fns(_ImageRightActionPPerm1PPerm1, ImageRightAction)
122121

123-
for _type in ImageRightAction._py_template_params_to_cxx_type.values(): # pylint:disable=protected-access
122+
for (
123+
_type
124+
) in (
125+
ImageRightAction._py_template_params_to_cxx_type.values()
126+
): # pylint:disable=protected-access
124127
_register_cxx_wrapped_type(_type, ImageRightAction)
125128

126129

libsemigroups_pybind11/aho_corasick.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
# Distributed under the terms of the GPL license version 3.
66
#
77
# The full license is in the file LICENSE, distributed with this software.
8-
# pylint:disable=no-name-in-module, unused-import
8+
99
"""
1010
This module contains various helper functions for the class :any:`AhoCorasick`.
1111
These functions could be functions of :any:`AhoCorasick` but they only use
1212
public member functions of :any:`AhoCorasick`, and so they are declared
1313
as free functions instead.
1414
"""
15-
from _libsemigroups_pybind11 import (
15+
16+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
1617
aho_corasick_add_word as add_word,
1718
rm_word,
1819
traverse_word,

libsemigroups_pybind11/bipartition.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module, invalid-name, unused-import, fixme
10-
119
"""
1210
This package provides the user-facing python part of libsemigroups_pybind11 for
1311
the libsemigroups::bipartition namespace from libsemigroups.
1412
"""
1513

16-
from _libsemigroups_pybind11 import (
14+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
1715
bipartition_underlying_partition as underlying_partition,
1816
bipartition_one as one,
1917
Bipartition,

libsemigroups_pybind11/blocks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module, invalid-name, unused-import, fixme
10-
119
"""
1210
This package provides the user-facing python part of ``libsemigroups_pybind11`` for
1311
the ``libsemigroups::blocks`` namespace from ``libsemigroups``.
1412
"""
1513

16-
from _libsemigroups_pybind11 import (
14+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
1715
blocks_underlying_partition as underlying_partition,
1816
Blocks,
1917
)

libsemigroups_pybind11/bmat8.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint:disable=no-name-in-module, unused-import
10-
119
"""
1210
This module contains the helper functions from ``libsemigroups_pybind11.bmat8``.
1311
"""
1412

15-
from _libsemigroups_pybind11 import (
13+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
1614
bmat8_one as one,
1715
random,
1816
transpose,

libsemigroups_pybind11/congruence.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module, invalid-name, unused-import, fixme
10-
# pylint: disable=protected-access, missing-function-docstring
11-
# pylint: disable=missing-class-docstring
12-
139
"""
1410
This page contains the documentation for various helper functions for
1511
manipulating :any:`Congruence` objects. All such functions are contained in
1612
the submodule ``congruence``.
1713
"""
1814

19-
from typing import List, Iterator, Union
20-
from typing_extensions import Self
15+
from typing import List, Union
16+
from typing_extensions import Self as _Self
2117

22-
from _libsemigroups_pybind11 import (
18+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module,unused-import
2319
CongruenceString as _CongruenceString,
2420
CongruenceWord as _CongruenceWord,
2521
congruence_non_trivial_classes as _congruence_non_trivial_classes,
@@ -43,7 +39,7 @@
4339
)
4440

4541

46-
class Congruence(_CongruenceCommon):
42+
class Congruence(_CongruenceCommon): # pylint: disable=missing-class-docstring
4743
__doc__ = _CongruenceWord.__doc__
4844

4945
_py_template_params_to_cxx_type = {
@@ -61,7 +57,7 @@ class Congruence(_CongruenceCommon):
6157
_all_wrapped_cxx_types = {*_py_template_params_to_cxx_type.values()}
6258

6359
@_copydoc(_CongruenceWord.__init__)
64-
def __init__(self: Self, *args, **kwargs) -> None:
60+
def __init__(self: _Self, *args, **kwargs) -> None:
6561
super().__init__(*args, **kwargs)
6662
if _to_cxx(self) is not None:
6763
return
@@ -75,7 +71,9 @@ def __init__(self: Self, *args, **kwargs) -> None:
7571
)
7672
self.init_cxx_obj(*args)
7773

78-
def get(self: Self, t: type) -> Union[_Kambites, _KnuthBendix, _ToddCoxeter]:
74+
def get(
75+
self: _Self, t: type
76+
) -> Union[_Kambites, _KnuthBendix, _ToddCoxeter]:
7977
"""
8078
:sig=(self: Congruence, t: type) -> Kambites | KnuthBendix | ToddCoxeter:
8179
Returns the *t* instance used to compute the congruence (if any).
@@ -105,7 +103,7 @@ def get(self: Self, t: type) -> Union[_Kambites, _KnuthBendix, _ToddCoxeter]:
105103
f", but found {t}"
106104
)
107105

108-
def has(self: Self, t: type) -> bool:
106+
def has(self: _Self, t: type) -> bool:
109107
"""
110108
:sig=(self: Congruence, t: type) -> bool:
111109

libsemigroups_pybind11/detail/congruence_common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module
10-
# BECAUSE: pylint can't find any imports from _libsemigroups_pybind11
11-
129
"""
1310
This submodule collects some common aspects of the classes Congruence,
1411
Kambites, KnuthBendix, and ToddCoxeter.
@@ -17,7 +14,9 @@
1714
from typing import List
1815
from typing_extensions import Self
1916

20-
from _libsemigroups_pybind11 import congruence_kind as _congruence_kind
17+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
18+
congruence_kind as _congruence_kind,
19+
)
2120

2221
from libsemigroups_pybind11.presentation import Presentation as _Presentation
2322

libsemigroups_pybind11/detail/cxx_wrapper.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#
77
# The full license is in the file LICENSE, distributed with this software.
88

9-
# pylint: disable=no-name-in-module
10-
# BECAUSE: pylint can't find any imports from _libsemigroups_pybind11
11-
129
"""
1310
This package provides some functions and a class CxxWrapper to help wrap
1411
multiple C++ types into a single python type. I.e. to wrap a C++ class template
@@ -23,7 +20,9 @@
2320
from typing import Any, Callable
2421
from typing_extensions import Self
2522

26-
from _libsemigroups_pybind11 import UNDEFINED as _UNDEFINED
23+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
24+
UNDEFINED as _UNDEFINED,
25+
)
2726

2827
pybind11_type = type(_UNDEFINED)
2928

@@ -122,7 +121,9 @@ def __getattr__(self: Self, name: str):
122121
def cxx_fn_wrapper(*args) -> Any:
123122
if len(args) == 1 and isinstance(args[0], list):
124123
args = args[0]
125-
return getattr(self._cxx_obj, name)([to_cxx(x) for x in args])
124+
return getattr(self._cxx_obj, name)(
125+
[to_cxx(x) for x in args]
126+
)
126127
return getattr(self._cxx_obj, name)(*(to_cxx(x) for x in args))
127128

128129
return cxx_fn_wrapper
@@ -167,9 +168,9 @@ def init_cxx_obj(self: Self, *args) -> None:
167168
defined.
168169
"""
169170
assert self.py_template_params is not None
170-
self._cxx_obj = self._py_template_params_to_cxx_type[self.py_template_params](
171-
*(to_cxx(x) for x in args)
172-
)
171+
self._cxx_obj = self._py_template_params_to_cxx_type[
172+
self.py_template_params
173+
](*(to_cxx(x) for x in args))
173174

174175

175176
# TODO proper annotations
@@ -185,7 +186,9 @@ def cxx_mem_fn_wrapper(self, *args):
185186
# TODO move the first if-clause into to_cxx?
186187
if len(args) == 1 and isinstance(args[0], list):
187188
args = [[to_cxx(x) for x in args[0]]]
188-
result = getattr(to_cxx(self), cxx_mem_fn.__name__)(*(to_cxx(x) for x in args))
189+
result = getattr(to_cxx(self), cxx_mem_fn.__name__)(
190+
*(to_cxx(x) for x in args)
191+
)
189192
if result is to_cxx(self):
190193
return self
191194
if type(result) in _CXX_WRAPPED_TYPE_TO_PY_TYPE:
@@ -227,7 +230,9 @@ def copy_cxx_mem_fns(cxx_class: pybind11_type, py_class: CxxWrapper) -> None:
227230
that call the cxx member function on the _cxx_obj.
228231
"""
229232
for py_meth_name in dir(cxx_class):
230-
if (not py_meth_name.startswith("_")) and py_meth_name not in dir(py_class):
233+
if (not py_meth_name.startswith("_")) and py_meth_name not in dir(
234+
py_class
235+
):
231236
setattr(
232237
py_class,
233238
py_meth_name,

0 commit comments

Comments
 (0)