Skip to content

Commit ddadd18

Browse files
DimitriPapadopoulosMaanasArora
authored andcommitted
STY: Partially apply ruff/pycodestyle rule E251
Unexpected spaces around keyword / parameter equals For now, do not modify large and consistent code blocks that use spaces on purpose, mostly when the default values are arrays.
1 parent 908e7e4 commit ddadd18

File tree

13 files changed

+29
-29
lines changed

13 files changed

+29
-29
lines changed

benchmarks/benchmarks/bench_ufunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def time_ufunc_small_array(self, ufuncname):
342342
self.f(self.array_5)
343343

344344
def time_ufunc_small_array_inplace(self, ufuncname):
345-
self.f(self.array_5, out = self.array_5)
345+
self.f(self.array_5, out=self.array_5)
346346

347347
def time_ufunc_small_int_array(self, ufuncname):
348348
self.f(self.array_int_3)

numpy/_core/code_generators/generate_umath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ def make_ufuncs(funcdict):
15701570
typenum=f"NPY_{english_upper(chartoname[c])}",
15711571
count=uf.nin + uf.nout,
15721572
name=name,
1573-
funcname = f"{english_upper(chartoname[c])}_{name}_indexed",
1573+
funcname=f"{english_upper(chartoname[c])}_{name}_indexed",
15741574
))
15751575

15761576
mlist.append(r"""PyDict_SetItemString(dictionary, "%s", f);""" % name)

numpy/_core/tests/test_ufunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,7 @@ def __rmul__(self, other):
21042104
def test_array_wrap_array_priority(self):
21052105
class ArrayPriorityBase(np.ndarray):
21062106
@classmethod
2107-
def __array_wrap__(cls, array, context=None, return_scalar = False):
2107+
def __array_wrap__(cls, array, context=None, return_scalar=False):
21082108
return cls
21092109

21102110
class ArrayPriorityMinus0(ArrayPriorityBase):

numpy/_core/tests/test_umath_accuracy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_validate_transcendentals(self):
7575
assert_array_max_ulp(npfunc(inval), outval, maxulperr)
7676

7777
@pytest.mark.skipif(IS_AVX512FP16,
78-
reason = "SVML FP16 have slightly higher ULP errors")
78+
reason="SVML FP16 have slightly higher ULP errors")
7979
@pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS)
8080
def test_validate_fp16_transcendentals(self, ufunc):
8181
with np.errstate(all='ignore'):

numpy/f2py/auxfuncs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ def getuseblocks(pymod):
923923
all_uses.extend([x for x in modblock.get("use").keys() if "__" not in x])
924924
return all_uses
925925

926-
def process_f2cmap_dict(f2cmap_all, new_map, c2py_map, verbose = False):
926+
def process_f2cmap_dict(f2cmap_all, new_map, c2py_map, verbose=False):
927927
"""
928928
Update the Fortran-to-C type mapping dictionary with new mappings and
929929
return a list of successfully mapped C types.

numpy/f2py/tests/test_array_from_pyobj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setup_module():
3333
src = [
3434
get_testdir() / "wrapmodule.c",
3535
]
36-
wrap = util.build_meson(src, module_name = "test_array_from_pyobj_ext")
36+
wrap = util.build_meson(src, module_name="test_array_from_pyobj_ext")
3737

3838

3939
def flags_info(arr):

numpy/f2py/tests/test_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def ubound(xl, xh):
5353
return xh - xl + 1
5454
rval = self.module.foo(is_=xlow, ie_=xhigh,
5555
arr=xvec[:ubound(xlow, xhigh)])
56-
expval = np.arange(11, dtype = np.float32)
56+
expval = np.arange(11, dtype=np.float32)
5757
assert np.allclose(rval, expval)
5858

5959

numpy/lib/tests/test_function_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ def f(x):
19621962

19631963
def test_bad_input(self):
19641964
with assert_raises(TypeError):
1965-
A = np.vectorize(pyfunc = 3)
1965+
A = np.vectorize(pyfunc=3)
19661966

19671967
def test_no_keywords(self):
19681968
with assert_raises(TypeError):
@@ -3887,7 +3887,7 @@ def test_quantile_preserve_int_type(self, dtype):
38873887
def test_q_zero_one(self, method):
38883888
# gh-24710
38893889
arr = [10, 11, 12]
3890-
quantile = np.quantile(arr, q = [0, 1], method=method)
3890+
quantile = np.quantile(arr, q=[0, 1], method=method)
38913891
assert_equal(quantile, np.array([10, 12]))
38923892

38933893
@pytest.mark.parametrize("method", quantile_methods)
@@ -4163,10 +4163,10 @@ class TestLerp:
41634163
min_value=0, max_value=1),
41644164
t1=st.floats(allow_nan=False, allow_infinity=False,
41654165
min_value=0, max_value=1),
4166-
a = st.floats(allow_nan=False, allow_infinity=False,
4167-
min_value=-1e300, max_value=1e300),
4168-
b = st.floats(allow_nan=False, allow_infinity=False,
4169-
min_value=-1e300, max_value=1e300))
4166+
a=st.floats(allow_nan=False, allow_infinity=False,
4167+
min_value=-1e300, max_value=1e300),
4168+
b=st.floats(allow_nan=False, allow_infinity=False,
4169+
min_value=-1e300, max_value=1e300))
41704170
def test_linear_interpolation_formula_monotonic(self, t0, t1, a, b):
41714171
l0 = nfb._lerp(a, b, t0)
41724172
l1 = nfb._lerp(a, b, t1)

numpy/lib/tests/test_histograms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def test_simple_range(self):
588588
x3 = np.linspace(-100, -50, testlen)
589589
x = np.hstack((x1, x2, x3))
590590
for estimator, numbins in expectedResults.items():
591-
a, b = np.histogram(x, estimator, range = (-20, 20))
591+
a, b = np.histogram(x, estimator, range=(-20, 20))
592592
msg = f"For the {estimator} estimator"
593593
msg += f" with datasize of {testlen}"
594594
assert_equal(len(a), numbins, err_msg=msg)

numpy/ma/extras.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ __all__ = [
5656
]
5757

5858
def count_masked(arr, axis=...): ...
59-
def masked_all(shape, dtype = ...): ...
59+
def masked_all(shape, dtype=...): ...
6060
def masked_all_like(arr): ...
6161

6262
class _fromnxfunction:
@@ -96,8 +96,8 @@ def compress_nd(x, axis=...): ...
9696
def compress_rowcols(x, axis=...): ...
9797
def compress_rows(a): ...
9898
def compress_cols(a): ...
99-
def mask_rows(a, axis = ...): ...
100-
def mask_cols(a, axis = ...): ...
99+
def mask_rows(a, axis=...): ...
100+
def mask_cols(a, axis=...): ...
101101
def ediff1d(arr, to_end=..., to_begin=...): ...
102102
def unique(ar1, return_index=..., return_inverse=...): ...
103103
def intersect1d(ar1, ar2, assume_unique=...): ...
@@ -107,7 +107,7 @@ def isin(element, test_elements, assume_unique=..., invert=...): ...
107107
def union1d(ar1, ar2): ...
108108
def setdiff1d(ar1, ar2, assume_unique=...): ...
109109
def cov(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ...
110-
def corrcoef(x, y=..., rowvar=..., bias = ..., allow_masked=..., ddof = ...): ...
110+
def corrcoef(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ...
111111

112112
class MAxisConcatenator(AxisConcatenator):
113113
@staticmethod

0 commit comments

Comments
 (0)