Skip to content

Commit 908e7e4

Browse files
DimitriPapadopoulosMaanasArora
authored andcommitted
STY: Partially apply ruff/pycodestyle rule E241
Multiple spaces after comma Do not apply this rule to tabular data, tables must remain aligned.
1 parent 1d796e2 commit 908e7e4

File tree

16 files changed

+51
-51
lines changed

16 files changed

+51
-51
lines changed

benchmarks/benchmarks/bench_ufunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def time_divide_scalar2_inplace(self, dtype):
432432

433433

434434
class CustomComparison(Benchmark):
435-
params = (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16,
435+
params = (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16,
436436
np.uint32, np.uint64, np.float32, np.float64, np.bool)
437437
param_names = ['dtype']
438438

benchmarks/benchmarks/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
TYPES1 = [
2121
'int16', 'float16',
2222
'int32', 'float32',
23-
'int64', 'float64', 'complex64',
23+
'int64', 'float64', 'complex64',
2424
'complex128',
2525
]
2626

2727
DLPACK_TYPES = [
2828
'int16', 'float16',
2929
'int32', 'float32',
30-
'int64', 'float64', 'complex64',
30+
'int64', 'float64', 'complex64',
3131
'complex128', 'bool',
3232
]
3333

numpy/_core/overrides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .._utils import set_module
66
from .._utils._inspect import getargspec
77
from numpy._core._multiarray_umath import (
8-
add_docstring, _get_implementing_args, _ArrayFunctionDispatcher)
8+
add_docstring, _get_implementing_args, _ArrayFunctionDispatcher)
99

1010

1111
ARRAY_FUNCTIONS = set()

numpy/_core/tests/test_arrayprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def test_structure_format_float(self):
320320
assert_equal(np.array2string(array_scalar), "(1., 2.12345679, 3.)")
321321

322322
def test_unstructured_void_repr(self):
323-
a = np.array([27, 91, 50, 75, 7, 65, 10, 8,
323+
a = np.array([27, 91, 50, 75, 7, 65, 10, 8,
324324
27, 91, 51, 49, 109, 82, 101, 100], dtype='u1').view('V8')
325325
assert_equal(repr(a[0]),
326326
r"np.void(b'\x1B\x5B\x32\x4B\x07\x41\x0A\x08')")

numpy/_core/tests/test_indexing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_boolean_shape_mismatch(self):
219219
def test_boolean_indexing_onedim(self):
220220
# Indexing a 2-dimensional array with
221221
# boolean array of length one
222-
a = np.array([[0., 0., 0.]])
222+
a = np.array([[0., 0., 0.]])
223223
b = np.array([True], dtype=bool)
224224
assert_equal(a[b], a)
225225
# boolean assignment
@@ -643,7 +643,7 @@ def test_prepend_not_one(self):
643643
a = np.zeros(5)
644644

645645
# Too large and not only ones.
646-
assert_raises(ValueError, assign, a, s_[...], np.ones((2, 1)))
646+
assert_raises(ValueError, assign, a, s_[...], np.ones((2, 1)))
647647
assert_raises(ValueError, assign, a, s_[[1, 2, 3],], np.ones((2, 1)))
648648
assert_raises(ValueError, assign, a, s_[[[1], [2]],], np.ones((2, 2, 1)))
649649

numpy/_core/tests/test_regression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_endian_where(self):
171171
net[2] = 0.605202
172172
max_net = net.max()
173173
test = np.where(net <= 0., max_net, net)
174-
correct = np.array([0.60520202, 0.00458849, 0.60520202])
174+
correct = np.array([0.60520202, 0.00458849, 0.60520202])
175175
assert_array_almost_equal(test, correct)
176176

177177
def test_endian_recarray(self):
@@ -2046,7 +2046,7 @@ def test_unique_stable(self):
20462046
# get consistent results
20472047
v = np.array(([0] * 5 + [1] * 6 + [2] * 6) * 4)
20482048
res = np.unique(v, return_index=True)
2049-
tgt = (np.array([0, 1, 2]), np.array([0, 5, 11]))
2049+
tgt = (np.array([0, 1, 2]), np.array([0, 5, 11]))
20502050
assert_equal(res, tgt)
20512051

20522052
def test_unicode_alloc_dealloc_match(self):

numpy/_core/tests/test_scalarmath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def test_blocked(self):
171171

172172
inp2[...] += np.arange(inp2.size, dtype=dt) + 1
173173
assert_almost_equal(np.square(inp2),
174-
np.multiply(inp2, inp2), err_msg=msg)
174+
np.multiply(inp2, inp2), err_msg=msg)
175175
# skip true divide for ints
176176
if dt != np.int32:
177177
assert_almost_equal(np.reciprocal(inp2),
178-
np.divide(1, inp2), err_msg=msg)
178+
np.divide(1, inp2), err_msg=msg)
179179

180180
inp1[...] = np.ones_like(inp1)
181181
np.add(inp1, 2, out=out)

numpy/lib/tests/test_function_base.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,7 +2413,7 @@ class TestCorrCoef:
24132413

24142414
def test_non_array(self):
24152415
assert_almost_equal(np.corrcoef([0, 1, 0], [1, 0, 1]),
2416-
[[1., -1.], [-1., 1.]])
2416+
[[1., -1.], [-1., 1.]])
24172417

24182418
def test_simple(self):
24192419
tgt1 = corrcoef(self.A)
@@ -3401,10 +3401,10 @@ def test_scalar_q(self):
34013401
x = np.arange(12).reshape(3, 4)
34023402
assert_equal(np.percentile(x, 50), 5.5)
34033403
assert_(np.isscalar(np.percentile(x, 50)))
3404-
r0 = np.array([4., 5., 6., 7.])
3404+
r0 = np.array([4., 5., 6., 7.])
34053405
assert_equal(np.percentile(x, 50, axis=0), r0)
34063406
assert_equal(np.percentile(x, 50, axis=0).shape, r0.shape)
3407-
r1 = np.array([1.5, 5.5, 9.5])
3407+
r1 = np.array([1.5, 5.5, 9.5])
34083408
assert_almost_equal(np.percentile(x, 50, axis=1), r1)
34093409
assert_equal(np.percentile(x, 50, axis=1).shape, r1.shape)
34103410

@@ -3422,11 +3422,11 @@ def test_scalar_q(self):
34223422
x = np.arange(12).reshape(3, 4)
34233423
assert_equal(np.percentile(x, 50, method='lower'), 5.)
34243424
assert_(np.isscalar(np.percentile(x, 50)))
3425-
r0 = np.array([4., 5., 6., 7.])
3425+
r0 = np.array([4., 5., 6., 7.])
34263426
c0 = np.percentile(x, 50, method='lower', axis=0)
34273427
assert_equal(c0, r0)
34283428
assert_equal(c0.shape, r0.shape)
3429-
r1 = np.array([1., 5., 9.])
3429+
r1 = np.array([1., 5., 9.])
34303430
c1 = np.percentile(x, 50, method='lower', axis=1)
34313431
assert_almost_equal(c1, r1)
34323432
assert_equal(c1.shape, r1.shape)
@@ -3496,18 +3496,18 @@ def test_percentile_out(self, percentile, with_weights):
34963496
percentile(x, (25, 50), axis=0, out=out, weights=weights), r0
34973497
)
34983498
assert_equal(out, r0)
3499-
r1 = np.array([[0.75, 4.75, 8.75], [1.5, 5.5, 9.5]])
3499+
r1 = np.array([[0.75, 4.75, 8.75], [1.5, 5.5, 9.5]])
35003500
out = np.empty((2, 3))
35013501
assert_equal(np.percentile(x, (25, 50), axis=1, out=out), r1)
35023502
assert_equal(out, r1)
35033503

35043504
# q.dim > 1, int
3505-
r0 = np.array([[0, 1, 2, 3], [4, 5, 6, 7]])
3505+
r0 = np.array([[0, 1, 2, 3], [4, 5, 6, 7]])
35063506
out = np.empty((2, 4), dtype=x.dtype)
35073507
c = np.percentile(x, (25, 50), method='lower', axis=0, out=out)
35083508
assert_equal(c, r0)
35093509
assert_equal(out, r0)
3510-
r1 = np.array([[0, 4, 8], [1, 5, 9]])
3510+
r1 = np.array([[0, 4, 8], [1, 5, 9]])
35113511
out = np.empty((2, 3), dtype=x.dtype)
35123512
c = np.percentile(x, (25, 50), method='lower', axis=1, out=out)
35133513
assert_equal(c, r1)
@@ -3583,7 +3583,7 @@ def test_extended_axis(self):
35833583

35843584
d = np.arange(3 * 5 * 7 * 11).reshape((3, 5, 7, 11))
35853585
np.random.shuffle(d.ravel())
3586-
assert_equal(np.percentile(d, 25, axis=(0, 1, 2))[0],
3586+
assert_equal(np.percentile(d, 25, axis=(0, 1, 2))[0],
35873587
np.percentile(d[:, :, :, 0].flatten(), 25))
35883588
assert_equal(np.percentile(d, [10, 90], axis=(0, 1, 3))[:, 1],
35893589
np.percentile(d[:, :, 1, :].flatten(), [10, 90]))
@@ -3888,7 +3888,7 @@ def test_q_zero_one(self, method):
38883888
# gh-24710
38893889
arr = [10, 11, 12]
38903890
quantile = np.quantile(arr, q = [0, 1], method=method)
3891-
assert_equal(quantile, np.array([10, 12]))
3891+
assert_equal(quantile, np.array([10, 12]))
38923892

38933893
@pytest.mark.parametrize("method", quantile_methods)
38943894
def test_quantile_monotonic(self, method):
@@ -4217,7 +4217,7 @@ def test_basic(self):
42174217
assert_equal(np.median(a0), 1)
42184218
assert_allclose(np.median(a1), 0.5)
42194219
assert_allclose(np.median(a2), 2.5)
4220-
assert_allclose(np.median(a2, axis=0), [1.5, 2.5, 3.5])
4220+
assert_allclose(np.median(a2, axis=0), [1.5, 2.5, 3.5])
42214221
assert_equal(np.median(a2, axis=1), [1, 4])
42224222
assert_allclose(np.median(a2, axis=None), 2.5)
42234223

@@ -4244,8 +4244,8 @@ def test_axis_keyword(self):
42444244
np.median(a, axis=ax)
42454245
assert_array_equal(a, orig)
42464246

4247-
assert_allclose(np.median(a3, axis=0), [3, 4])
4248-
assert_allclose(np.median(a3.T, axis=1), [3, 4])
4247+
assert_allclose(np.median(a3, axis=0), [3, 4])
4248+
assert_allclose(np.median(a3.T, axis=1), [3, 4])
42494249
assert_allclose(np.median(a3), 3.5)
42504250
assert_allclose(np.median(a3, axis=None), 3.5)
42514251
assert_allclose(np.median(a3.T), 3.5)
@@ -4261,16 +4261,16 @@ def test_overwrite_keyword(self):
42614261
assert_allclose(np.median(a0.copy(), overwrite_input=True), 1)
42624262
assert_allclose(np.median(a1.copy(), overwrite_input=True), 0.5)
42634263
assert_allclose(np.median(a2.copy(), overwrite_input=True), 2.5)
4264-
assert_allclose(np.median(a2.copy(), overwrite_input=True, axis=0),
4265-
[1.5, 2.5, 3.5])
4264+
assert_allclose(
4265+
np.median(a2.copy(), overwrite_input=True, axis=0), [1.5, 2.5, 3.5])
42664266
assert_allclose(
42674267
np.median(a2.copy(), overwrite_input=True, axis=1), [1, 4])
42684268
assert_allclose(
42694269
np.median(a2.copy(), overwrite_input=True, axis=None), 2.5)
42704270
assert_allclose(
4271-
np.median(a3.copy(), overwrite_input=True, axis=0), [3, 4])
4272-
assert_allclose(np.median(a3.T.copy(), overwrite_input=True, axis=1),
4273-
[3, 4])
4271+
np.median(a3.copy(), overwrite_input=True, axis=0), [3, 4])
4272+
assert_allclose(
4273+
np.median(a3.T.copy(), overwrite_input=True, axis=1), [3, 4])
42744274

42754275
a4 = np.arange(3 * 4 * 5, dtype=np.float32).reshape((3, 4, 5))
42764276
np.random.shuffle(a4.ravel())

numpy/linalg/lapack_lite/clapack_scrub.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ def endArgs(self, text):
7979
keep_ftnlen = (Str('ilaenv_') | Str('iparmq_') | Str('s_rnge')) + Str('(')
8080

8181
lexicon = Lexicon([
82-
(iofunctions, TEXT),
83-
(keep_ftnlen, beginArgs),
82+
(iofunctions, TEXT),
83+
(keep_ftnlen, beginArgs),
8484
State('args', [
8585
(Str(')'), endArgs),
8686
(Str('('), beginArgs),
8787
(AnyChar, TEXT),
8888
]),
89-
(cS + Re(r'[1-9][0-9]*L'), IGNORE),
90-
(cS + Str('ftnlen') + Opt(S + len_), IGNORE),
91-
(cS + sep_seq(['(', 'ftnlen', ')'], S) + S + digits, IGNORE),
92-
(Bol + Str('ftnlen ') + len_ + Str(';\n'), IGNORE),
93-
(cS + len_, TEXT),
94-
(AnyChar, TEXT),
89+
(cS + Re(r'[1-9][0-9]*L'), IGNORE),
90+
(cS + Str('ftnlen') + Opt(S + len_), IGNORE),
91+
(cS + sep_seq(['(', 'ftnlen', ')'], S) + S + digits, IGNORE),
92+
(Bol + Str('ftnlen ') + len_ + Str(';\n'), IGNORE),
93+
(cS + len_, TEXT),
94+
(AnyChar, TEXT),
9595
])
9696

9797
def scrubFtnlen(source):

numpy/linalg/tests/test_regression.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def test_eigh_build(self):
4040
# Ticket 662.
4141
rvals = [68.60568999, 89.57756725, 106.67185574]
4242

43-
cov = array([[77.70273908, 3.51489954, 15.64602427],
44-
[3.51489954, 88.97013878, -1.07431931],
45-
[15.64602427, -1.07431931, 98.18223512]])
43+
cov = array([[77.70273908, 3.51489954, 15.64602427],
44+
[ 3.51489954, 88.97013878, -1.07431931],
45+
[15.64602427, -1.07431931, 98.18223512]])
4646

4747
vals, vecs = linalg.eigh(cov)
4848
assert_array_almost_equal(vals, rvals)
@@ -64,8 +64,8 @@ def test_norm_vector_badarg(self):
6464

6565
def test_lapack_endian(self):
6666
# For bug #1482
67-
a = array([[5.7998084, -2.1825367],
68-
[-2.1825367, 9.85910595]], dtype='>f8')
67+
a = array([[ 5.7998084, -2.1825367],
68+
[-2.1825367, 9.85910595]], dtype='>f8')
6969
b = array(a, dtype='<f8')
7070

7171
ap = linalg.cholesky(a)

0 commit comments

Comments
 (0)