Skip to content

Commit 5e05384

Browse files
MAINT: apply ruff/pyupgrade rule UP039
UP039 Unnecessary parentheses after class definition
1 parent 6155ebc commit 5e05384

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

numpy/_core/tests/test_array_coercion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def subclass(a):
3838

3939
yield subclass
4040

41-
class _SequenceLike():
41+
class _SequenceLike:
4242
# Older NumPy versions, sometimes cared whether a protocol array was
4343
# also _SequenceLike. This shouldn't matter, but keep it for now
4444
# for __array__ and not the others.

numpy/_core/tests/test_multiarray.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_readonly_flag_protocols(self, flag, flag_value, writeable):
234234
a = np.arange(10)
235235
setattr(a.flags, flag, flag_value)
236236

237-
class MyArr():
237+
class MyArr:
238238
__array_struct__ = a.__array_struct__
239239

240240
assert memoryview(a).readonly is not writeable
@@ -7247,7 +7247,7 @@ def test_matmul_empty(self):
72477247

72487248
def test_matmul_exception_multiply(self):
72497249
# test that matmul fails if `__mul__` is missing
7250-
class add_not_multiply():
7250+
class add_not_multiply:
72517251
def __add__(self, other):
72527252
return self
72537253
a = np.full((3,3), add_not_multiply())
@@ -7256,7 +7256,7 @@ def __add__(self, other):
72567256

72577257
def test_matmul_exception_add(self):
72587258
# test that matmul fails if `__add__` is missing
7259-
class multiply_not_add():
7259+
class multiply_not_add:
72607260
def __mul__(self, other):
72617261
return self
72627262
a = np.full((3,3), multiply_not_add())
@@ -8677,7 +8677,7 @@ def test_multiarray_flags_not_writable_attribute_deletion(self):
86778677
assert_raises(AttributeError, delattr, a, s)
86788678

86798679

8680-
class TestArrayInterface():
8680+
class TestArrayInterface:
86818681
class Foo:
86828682
def __init__(self, value):
86838683
self.value = value

numpy/_core/tests/test_overrides.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def __array_function__(self, func, types, args, kwargs):
540540

541541
class TestArrayLike:
542542
def setup_method(self):
543-
class MyArray():
543+
class MyArray:
544544
def __init__(self, function=None):
545545
self.function = function
546546

@@ -554,7 +554,7 @@ def __array_function__(self, func, types, args, kwargs):
554554

555555
self.MyArray = MyArray
556556

557-
class MyNoArrayFunctionArray():
557+
class MyNoArrayFunctionArray:
558558
def __init__(self, function=None):
559559
self.function = function
560560

numpy/f2py/tests/test_crackfortran.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_nowrap_private_proceedures(self, tmp_path):
6666
pyf = crackfortran.crack2fortran(mod)
6767
assert 'bar' not in pyf
6868

69-
class TestModuleProcedure():
69+
class TestModuleProcedure:
7070
def test_moduleOperators(self, tmp_path):
7171
fpath = util.getpath("tests", "src", "crackfortran", "operators.f90")
7272
mod = crackfortran.crackfortran([str(fpath)])
@@ -347,14 +347,14 @@ def test_end_if_comment(self):
347347
assert False, f"'crackfortran.crackfortran' raised an exception {exc}"
348348

349349

350-
class TestF77CommonBlockReader():
350+
class TestF77CommonBlockReader:
351351
def test_gh22648(self, tmp_path):
352352
fpath = util.getpath("tests", "src", "crackfortran", "gh22648.pyf")
353353
with contextlib.redirect_stdout(io.StringIO()) as stdout_f2py:
354354
mod = crackfortran.crackfortran([str(fpath)])
355355
assert "Mismatch" not in stdout_f2py.getvalue()
356356

357-
class TestParamEval():
357+
class TestParamEval:
358358
# issue gh-11612, array parameter parsing
359359
def test_param_eval_nested(self):
360360
v = '(/3.14, 4./)'

numpy/lib/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
__all__ = ['NumpyVersion']
1212

1313

14-
class NumpyVersion():
14+
class NumpyVersion:
1515
"""Parse and compare numpy version strings.
1616
1717
NumPy has the following versioning scheme (numbers given are examples; they

numpy/lib/tests/test_packbits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def test_unpackbits_large():
282282
assert_array_equal(np.packbits(np.unpackbits(d, axis=0), axis=0), d)
283283

284284

285-
class TestCount():
285+
class TestCount:
286286
x = np.array([
287287
[1, 0, 1, 0, 0, 1, 0],
288288
[0, 1, 1, 1, 0, 0, 0],

numpy/lib/tests/test_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_nansum_with_boolean(self):
215215
def test_py3_compat(self):
216216
# gh-2561
217217
# Test if the oldstyle class test is bypassed in python3
218-
class C():
218+
class C:
219219
"""Old-style class in python2, normal class in python3"""
220220
pass
221221

numpy/ma/tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def test_creation_with_list_of_maskedarrays_no_bool_cast(self):
251251

252252
# The above only failed due a long chain of oddity, try also with
253253
# an object array that cannot be converted to bool always:
254-
class NotBool():
254+
class NotBool:
255255
def __bool__(self):
256256
raise ValueError("not a bool!")
257257
masked_obj = np.ma.masked_array([NotBool(), 'b'], mask=[True, False])
@@ -4631,7 +4631,7 @@ def test_masked_invalid_pandas(self):
46314631
# getdata() used to be bad for pandas series due to its _data
46324632
# attribute. This test is a regression test mainly and may be
46334633
# removed if getdata() is adjusted.
4634-
class Series():
4634+
class Series:
46354635
_data = "nonsense"
46364636

46374637
def __array__(self, dtype=None, copy=None):

0 commit comments

Comments
 (0)