Skip to content

Commit 2abe178

Browse files
MAINT: apply ruff/Pycodestyle rule F821
F821 Undefined name I have left out *.pyi files and some special cases.
1 parent 5c9179b commit 2abe178

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

numpy/_core/tests/test_ufunc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ def test_signature_dtype_type(self):
486486
np.add(3, 4, signature=(float_dtype, float_dtype, None))
487487

488488
@pytest.mark.parametrize("get_kwarg", [
489-
lambda dt: dict(dtype=x),
490-
lambda dt: dict(signature=(x, None, None))])
489+
lambda dt: dict(dtype=dt),
490+
lambda dt: dict(signature=(dt, None, None))])
491491
def test_signature_dtype_instances_allowed(self, get_kwarg):
492492
# We allow certain dtype instances when there is a clear singleton
493493
# and the given one is equivalent; mainly for backcompat.

numpy/_core/tests/test_umath.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,11 @@ def test_floor_division_corner_cases(self, dtype):
693693
with suppress_warnings() as sup:
694694
sup.filter(RuntimeWarning, "invalid value encountered in floor_divide")
695695
div = np.floor_divide(fnan, fone)
696-
assert(np.isnan(div)), "dt: %s, div: %s" % (dt, div)
696+
assert(np.isnan(div)), "div: %s" % div
697697
div = np.floor_divide(fone, fnan)
698-
assert(np.isnan(div)), "dt: %s, div: %s" % (dt, div)
698+
assert(np.isnan(div)), "div: %s" % div
699699
div = np.floor_divide(fnan, fzer)
700-
assert(np.isnan(div)), "dt: %s, div: %s" % (dt, div)
700+
assert(np.isnan(div)), "div: %s" % div
701701
# verify 1.0//0.0 computations return inf
702702
with np.errstate(divide='ignore'):
703703
z = np.floor_divide(y, x)

numpy/f2py/_src_pyf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import re
23

34
# START OF CODE VENDORED FROM `numpy.distutils.from_template`

numpy/linalg/_linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
array, asarray, zeros, empty, empty_like, intc, single, double,
2727
csingle, cdouble, inexact, complexfloating, newaxis, all, inf, dot,
2828
add, multiply, sqrt, sum, isfinite, finfo, errstate, moveaxis, amin,
29-
amax, prod, abs, atleast_2d, intp, asanyarray, object_, matmul,
29+
amax, prod, abs, atleast_2d, intp, asanyarray, object_,
3030
swapaxes, divide, count_nonzero, isnan, sign, argsort, sort,
3131
reciprocal, overrides, diagonal as _core_diagonal, trace as _core_trace,
3232
cross as _core_cross, outer as _core_outer, tensordot as _core_tensordot,

numpy/linalg/lapack_lite/clapack_scrub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def scrubSource(source, nsteps=None, verbose=False):
305305
else:
306306
nsteps = None
307307

308-
source = scrub_source(source, nsteps, verbose=True)
308+
source = scrubSource(source, nsteps, verbose=True)
309309

310310
with open(outfilename, 'w') as writefo:
311311
writefo.write(source)

numpy/testing/overrides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def allows_array_ufunc_override(func):
4444
will work correctly for ufuncs defined outside of Numpy.
4545
4646
"""
47-
return isinstance(func, np.ufunc)
47+
return isinstance(func, _ufunc)
4848

4949

5050
def get_overridable_numpy_array_functions():

0 commit comments

Comments
 (0)