8000 Merge pull request #28754 from DimitriPapadopoulos/PLE · numpy/numpy@0c33694 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c33694

Browse files
authored
Merge pull request #28754 from DimitriPapadopoulos/PLE
MNT: Enforce ruff/Pylint Error rules (PLE)
2 parents 6ff905a + 009beb2 commit 0c33694

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

numpy/_core/tests/test_array_coercion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class _SequenceLike:
4646
def __len__(self):
4747
raise TypeError
4848

49-
def __getitem__(self):
49+
def __getitem__(self, _, /):
5050
raise TypeError
5151

5252
# Array-interface
@@ -636,7 +636,7 @@ def __len__(self):
636636
obj[0][0] = 2 # replace with a different list.
637637
raise ValueError("not actually a sequence!")
638638

639-
def __getitem__(self):
639+
def __getitem__(self, _, /):
640640
pass
641641

642642
# Runs into a corner case in the new code, the `array(2)` is cached
@@ -758,7 +758,7 @@ class BadSequence:
758758
def __len__(self):
759759
raise error
760760

761-
def __getitem__(self):
761+
def __getitem__(self, _, /):
762762
# must have getitem to be a Sequence
763763
return 1
764764

numpy/_core/tests/test_multiarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def test_stringlike_empty_list(self):
638638
b = np.array([b'done'])
639639

640640
class bad_sequence:
641-
def __getitem__(self): pass
641+
def __getitem__(self, _, /): pass
642642
def __len__(self): raise RuntimeError
643643

644644
assert_raises(ValueError, operator.setitem, u, 0, [])

numpy/fft/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
from ._pocketfft import *
208208
from ._helper import *
209209

210-
__all__ = _pocketfft.__all__.copy()
210+
__all__ = _pocketfft.__all__.copy() # noqa: PLE0605
211211
__all__ += _helper.__all__
212212

213213
from numpy._pytesttester import PytestTester

numpy/linalg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
from . import _linalg
8989
from ._linalg import *
9090

91-
__all__ = _linalg.__all__.copy()
91+
__all__ = _linalg.__all__.copy() # noqa: PLE0605
9292

9393
from numpy._pytesttester import PytestTester
9494
test = PytestTester(__name__)

numpy/ma/testutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'assert_raises'
3636
]
3737

38-
__all__ = __all__masked + __some__from_testing
38+
__all__ = __all__masked + __some__from_testing # noqa: PLE0605
3939

4040

4141
def approx(a, b, fill_value=True, rtol=1e-5, atol=1e-8):

numpy/matlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
__version__ = np.__version__
2020

21-
__all__ = np.__all__[:] # copy numpy namespace
22-
__all__ += ['rand', 'randn', 'repmat']
21+
__all__ = ['rand', 'randn', 'repmat']
22+
__all__ += np.__all__
2323

2424
def empty(shape, dtype=None, order='C'):
2525
"""Return a new matrix of given shape and type, without initializing entries.

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extend-select = [
2020
"E",
2121
"W",
2222
"PGH",
23+
"PLE",
2324
]
2425
ignore = [
2526
"F", # TODO: enable Pyflakes rules

0 commit comments

Comments
 (0)
0