Skip to content

Commit 531109a

Browse files
lint
1 parent bc86af9 commit 531109a

File tree

13 files changed

+58
-111
lines changed

13 files changed

+58
-111
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ check: doctest
2525
pytest -vv tests/test_*.py
2626

2727
lint:
28-
ruff check --exit-zero setup.py tests/*.py libsemigroups_pybind11/**/*.py docs/source/**/*.py
29-
pylint --exit-zero setup.py tests/*.py libsemigroups_pybind11/**/*.py docs/source/**/*.py
28+
ruff check --exit-zero setup.py tests/*.py libsemigroups_pybind11/*.py docs/source/*.py
29+
pylint --exit-zero setup.py tests/*.py libsemigroups_pybind11/*.py libsemigroups_pybind11/**/*.py
3030
cpplint src/*.hpp src/*.cpp
3131

3232
coverage:

docs/source/conf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
This provides configuration for the generation of the docs
55
"""
6+
# pylint: disable=invalid-name
67

78
import importlib.metadata
89
import sys
@@ -31,9 +32,7 @@
3132
source_suffix = ".rst"
3233
master_doc = "index"
3334
project = "libsemigroups_pybind11"
34-
copyright = (
35-
"2021-2025, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
36-
)
35+
copyright = "2021-2025, Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte" # pylint: disable=redefined-builtin
3736
author = "Joseph Edwards, James Mitchell, Maria Tsalakou, Murray Whyte"
3837
# Use the version number of the installed project
3938
version = release = importlib.metadata.version(project)

libsemigroups_pybind11/action.py

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

9-
# pylint:disable=no-name-in-module, unused-import, protected-access,
10-
# pylint:disable=missing-function-docstring
9+
# pylint:disable=no-name-in-module, unused-import,
10+
# pylint:disable=missing-function-docstring,
1111

1212
"""
1313
This package provides the user-facing python part of libsemigroups_pybind11 for
@@ -177,6 +177,7 @@ class Action(_CxxWrapper): # pylint: disable=missing-class-docstring
177177
# Special methods
178178
########################################################################
179179

180+
# pylint: disable=redefined-outer-name
180181
def __init__(
181182
self: _Self, *args, generators=None, seeds=None, func=None, side=None
182183
) -> None:
@@ -211,9 +212,7 @@ def __init__(
211212
if _to_cxx(self) is not None:
212213
return
213214
if len(args) != 0:
214-
raise ValueError(
215-
f"expected 0 positional arguments, but found {len(args)}"
216-
)
215+
raise ValueError(f"expected 0 positional arguments, but found {len(args)}")
217216
if not isinstance(generators, list):
218217
raise TypeError(
219218
"expected the keyword argument 'generators' to be "
@@ -276,7 +275,7 @@ def generators(self: _Self) -> Iterator[Element]:
276275

277276
_copy_cxx_mem_fns(_RightActionPPerm1PPerm1, Action)
278277

279-
for _type in Action._py_template_params_to_cxx_type.values():
278+
for _type in Action._py_template_params_to_cxx_type.values(): # pylint: disable=protected-access
280279
_register_cxx_wrapped_type(_type, Action)
281280

282281
########################################################################
@@ -293,7 +292,7 @@ class RightAction(Action):
293292
:any:`ImageRightAction` and *side* given by :py:class:`side.right`.
294293
"""
295294

296-
def __init__(self: _Self, *args, generators=[], seeds=[]) -> None:
295+
def __init__(self: _Self, *args, generators=None, seeds=None) -> None:
297296
"""
298297
:sig=(self: Action, generators=None, seeds=None, func=None, side=None) -> None:
299298
@@ -335,7 +334,7 @@ class LeftAction(Action):
335334
:any:`ImageLeftAction` and *side* given by :py:class:`side.left`.
336335
"""
337336

338-
def __init__(self: _Self, *args, generators=[], seeds=[]) -> None:
337+
def __init__(self: _Self, *args, generators=None, seeds=None) -> None:
339338
"""
340339
:sig=(self: Action, generators=None, seeds=None, func=None, side=None) -> None:
341340

libsemigroups_pybind11/adapters.py

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ class _ImageAction(_CxxWrapper):
5353
"""
5454

5555
def __init__(self: _Self, *args, point=None, element=None) -> None:
56+
"""
57+
Construct from sample element and sample point.
58+
59+
:Keyword Arguments:
60+
* **element** (*Element*) -- a sample element.
61+
* **point** (*Point*) -- a sample point.
62+
63+
:raises KeyError:
64+
if the action defined by the arguments is not defined.
65+
"""
5666
super().__init__(
5767
*args,
5868
required_kwargs=("element", "point"),
@@ -62,9 +72,7 @@ def __init__(self: _Self, *args, point=None, element=None) -> None:
6272
if _to_cxx(self) is not None:
6373
return
6474
if len(args) != 0:
65-
raise ValueError(
66-
f"expected 0 positional arguments, but found {len(args)}"
67-
)
75+
raise ValueError(f"expected 0 positional arguments, but found {len(args)}")
6876
self.py_template_params = (
6977
type(_to_cxx(element)),
7078
type(_to_cxx(point)),
@@ -80,7 +88,7 @@ def __call__(self: _Self, *args):
8088
########################################################################
8189

8290

83-
class ImageRightAction(_ImageAction):
91+
class ImageRightAction(_ImageAction): # pylint: disable=missing-class-docstring
8492
Element = _TypeVar("Element")
8593
Point = _TypeVar("Point")
8694

@@ -101,21 +109,6 @@ class ImageRightAction(_ImageAction):
101109

102110
_all_wrapped_cxx_types = {*_py_template_params_to_cxx_type.values()}
103111

104-
def __init__(self: _Self, *args, point=None, element=None):
105-
"""
106-
:sig=(self: ImageRightAction, element=None, point=None):
107-
108-
Construct from sample element and sample point.
109-
110-
:Keyword Arguments:
111-
* **element** (*Element*) -- a sample element.
112-
* **point** (*Point*) -- a sample point.
113-
114-
:raises KeyError:
115-
if the action defined by the arguments is not defined.
116-
"""
117-
super().__init__(*args, point=point, element=element)
118-
119112
@_copydoc(_ImageRightActionPPerm1PPerm1.__call__)
120113
def __call__(self: _Self, pt: Point, x: Element) -> Point:
121114
return _to_py(_to_cxx(self)(_to_cxx(pt), _to_cxx(x)))
@@ -127,7 +120,7 @@ def __call__(self: _Self, pt: Point, x: Element) -> Point:
127120

128121
_copy_cxx_mem_fns(_ImageRightActionPPerm1PPerm1, ImageRightAction)
129122

130-
for _type in ImageRightAction._py_template_params_to_cxx_type.values():
123+
for _type in ImageRightAction._py_template_params_to_cxx_type.values(): # pylint:disable=protected-access
131124
_register_cxx_wrapped_type(_type, ImageRightAction)
132125

133126

@@ -136,7 +129,7 @@ def __call__(self: _Self, pt: Point, x: Element) -> Point:
136129
########################################################################
137130

138131

139-
class ImageLeftAction(_ImageAction):
132+
class ImageLeftAction(_ImageAction): # pylint: disable=missing-class-docstring
140133
Element = _TypeVar("Element")
141134
Point = _TypeVar("Point")
142135

@@ -156,21 +149,6 @@ class ImageLeftAction(_ImageAction):
156149

157150
_all_wrapped_cxx_types = {*_py_template_params_to_cxx_type.values()}
158151

159-
def __init__(self: _Self, *args, point=None, element=None):
160-
"""
161-
:sig=(self: ImageLeftAction, element=None, point=None):
162-
163-
Construct from sample element and sample point.
164-
165-
:Keyword Arguments:
166-
* **element** (*Element*) -- a sample element.
167-
* **point** (*Point*) -- a sample point.
168-
169-
:raises KeyError:
170-
if the action defined by the arguments is not defined.
171-
"""
172-
super().__init__(*args, point=point, element=element)
173-
174152
@_copydoc(_ImageLeftActionPPerm1PPerm1.__call__)
175153
def __call__(self: _Self, pt: Point, x: Element) -> Point:
176154
return _to_py(_to_cxx(self)(_to_cxx(pt), _to_cxx(x)))

libsemigroups_pybind11/froidure_pin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def sorted_elements(self: Self) -> Iterator:
214214

215215
_copy_cxx_mem_fns(_FroidurePinBMat, FroidurePin)
216216

217-
for _fp_type in FroidurePin._py_template_params_to_cxx_type.values():
217+
for _fp_type in FroidurePin._py_template_params_to_cxx_type.values(): # pylint:disable=protected-access
218218
_register_cxx_wrapped_type(_fp_type, FroidurePin)
219219

220220

libsemigroups_pybind11/is_obviously_infinite.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
# The module doc string is what appears at the top of the helper function
1010
# doc page, and so is omitted.
1111

12-
# pylint: disable=no-name-in-module
13-
# BECAUSE: pylint can't find any imports from _libsemigroups_pybind11
12+
"""Subpackage for importing is_obviously_infinite, and wrapping it."""
1413

15-
16-
from _libsemigroups_pybind11 import (
14+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
1715
is_obviously_infinite as _is_obviously_infinite,
1816
)
1917

libsemigroups_pybind11/konieczny.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
:any:`Konieczny`.
1616
"""
1717

18-
from copy import copy
19-
from functools import wraps
2018
from typing import TypeVar as _TypeVar, Iterator
2119
from typing_extensions import Self
2220

libsemigroups_pybind11/sims.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
5656
f"expected 0 or 1 positional arguments but found {len(args)}"
5757
)
5858
if len(kwargs) != 0:
59-
raise TypeError(
60-
f"expected 0 keyword arguments, but found {len(kwargs)}"
61-
)
59+
raise TypeError(f"expected 0 keyword arguments, but found {len(kwargs)}")
6260

6361
if len(args) == 0:
6462
# self.Word = kwargs["Word"]
@@ -78,7 +76,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
7876
########################################################################
7977

8078

81-
class Sims1(_SimsBase):
79+
class Sims1(_SimsBase): # pylint: disable=missing-class-docstring
8280
__doc__ = _Sims1.__doc__
8381

8482
_py_template_params_to_cxx_type = {
@@ -107,7 +105,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
107105
########################################################################
108106

109107

110-
class Sims2(_SimsBase):
108+
class Sims2(_SimsBase): # pylint: disable=missing-class-docstring
111109
__doc__ = _Sims2.__doc__
112110

113111
_py_template_params_to_cxx_type = {
@@ -136,7 +134,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
136134
########################################################################
137135

138136

139-
class RepOrc(_SimsBase):
137+
class RepOrc(_SimsBase): # pylint: disable=missing-class-docstring
140138
__doc__ = _RepOrc.__doc__
141139

142140
_py_template_params_to_cxx_type = {
@@ -165,7 +163,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
165163
########################################################################
166164

167165

168-
class MinimalRepOrc(_SimsBase):
166+
class MinimalRepOrc(_SimsBase): # pylint: disable=missing-class-docstring
169167
__doc__ = _MinimalRepOrc.__doc__
170168

171169
_py_template_params_to_cxx_type = {
@@ -195,7 +193,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
195193
########################################################################
196194

197195

198-
class SimsRefinerIdeals(_SimsBase):
196+
class SimsRefinerIdeals(_SimsBase): # pylint: disable=missing-class-docstring
199197
__doc__ = _SimsRefinerIdeals.__doc__
200198

201199
_py_template_params_to_cxx_type = {
@@ -224,7 +222,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
224222
########################################################################
225223

226224

227-
class SimsRefinerFaithful(_CxxWrapper):
225+
class SimsRefinerFaithful(_CxxWrapper): # pylint: disable=missing-class-docstring
228226
__doc__ = _SimsRefinerFaithful.__doc__
229227

230228
_py_template_params_to_cxx_type = {
@@ -258,9 +256,7 @@ def __init__(self: Self, *args, **kwargs) -> None:
258256
):
259257
self.py_template_params = (List[int],)
260258
else:
261-
raise TypeError(
262-
"expected the 1st argument to be a List[List[int]]"
263-
)
259+
raise TypeError("expected the 1st argument to be a List[List[int]]")
264260
self.init_cxx_obj(*args)
265261

266262

libsemigroups_pybind11/stephen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
words_accepted as _words_accepted,
3232
)
3333

34-
from libsemigroups_pybind11 import (
34+
from .presentation import (
3535
Presentation as _Presentation,
3636
InversePresentation as _InversePresentation,
3737
)
@@ -51,7 +51,7 @@
5151

5252

5353
# TODO(2): Make this work with string presentations once it works
54-
class Stephen(_CxxWrapper):
54+
class Stephen(_CxxWrapper): # pylint: disable=missing-class-docstring
5555
__doc__ = _StephenPresentationWords.__doc__
5656

5757
_py_template_params_to_cxx_type = {

libsemigroups_pybind11/transf.py

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

9-
# pylint: disable=no-name-in-module
9+
# pylint: disable=invalid-name
1010

1111
"""
1212
This package provides a the user-facing python part of libsemigroups_pybind11
@@ -15,10 +15,10 @@
1515

1616
import abc
1717

18-
from typing import Any as _Any, Union, List
18+
from typing import Any as _Any, List
1919
from typing_extensions import Self
2020

21-
from _libsemigroups_pybind11 import (
21+
from _libsemigroups_pybind11 import ( # pylint: disable=no-name-in-module
2222
PPerm1 as _PPerm1,
2323
PPerm2 as _PPerm2,
2424
PPerm4 as _PPerm4,
@@ -72,7 +72,7 @@ def __repr__(self: Self) -> str:
7272
def _py_template_params_from_degree(N: int) -> tuple[int]:
7373
if N < 2**8:
7474
return (2**8,)
75-
elif N < 2**16:
75+
if N < 2**16:
7676
return (2**16,)
7777
assert N <= 2**32
7878
return (2**32,)
@@ -134,7 +134,7 @@ def __mul__(self: Self, other: Self):
134134

135135
@staticmethod
136136
@abc.abstractmethod
137-
def one(N: int) -> Self:
137+
def one(N: int) -> Self: # pylint: disable=missing-function-docstring
138138
pass # pragma: no cover
139139

140140
def increase_degree_by( # pylint: disable=missing-function-docstring

0 commit comments

Comments
 (0)