Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e7139d

Browse filesBrowse files
authored
Merge pull request #28945 from eendebakpt/ruff_e501
MAINT: Enable linting with ruff E501
2 parents c458e69 + 49f31e7 commit 0e7139d
Copy full SHA for 0e7139d

File tree

Expand file treeCollapse file tree

9 files changed

+28
-10
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+28
-10
lines changed

‎.spin/cmds.py

Copy file name to clipboardExpand all lines: .spin/cmds.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ def notes(version_override):
615615
)
616616

617617
try:
618-
test_notes = _get_numpy_tools(pathlib.Path('ci', 'test_all_newsfragments_used.py'))
618+
cmd = pathlib.Path('ci', 'test_all_newsfragments_used.py')
619+
test_notes = _get_numpy_tools(cmd)
619620
except ModuleNotFoundError as e:
620621
raise click.ClickException(
621622
f"{e.msg}. Install the missing packages to use this command."

‎doc/source/conf.py

Copy file name to clipboardExpand all lines: doc/source/conf.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def replace_scalar_type_names():
2020
""" Rename numpy types to use the canonical names to make sphinx behave """
2121
import ctypes
2222

23-
Py_ssize_t = ctypes.c_int64 if ctypes.sizeof(ctypes.c_void_p) == 8 else ctypes.c_int32
23+
sizeof_void_p = ctypes.sizeof(ctypes.c_void_p)
24+
Py_ssize_t = ctypes.c_int64 if sizeof_void_p == 8 else ctypes.c_int32
2425

2526
class PyObject(ctypes.Structure):
2627
pass

‎doc/source/reference/random/performance.py

Copy file name to clipboardExpand all lines: doc/source/reference/random/performance.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
print(rel.to_csv(float_format='%0d'))
7575

7676
# Cross-platform table
77-
rows = ['32-bit Unsigned Ints', '64-bit Unsigned Ints', 'Uniforms', 'Normals', 'Exponentials']
77+
rows = ['32-bit Unsigned Ints', '64-bit Unsigned Ints', 'Uniforms',
78+
'Normals', 'Exponentials']
7879
xplat = rel.reindex(rows, axis=0)
7980
xplat = 100 * (xplat / xplat.MT19937.values[:, None])
8081
overall = np.exp(np.log(xplat).mean(0))

‎numpy/ctypeslib/_ctypeslib.py

Copy file name to clipboardExpand all lines: numpy/ctypeslib/_ctypeslib.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def _ctype_from_dtype_structured(dtype):
409409
# ctypes doesn't care about field order
410410
field_data = sorted(field_data, key=lambda f: f[0])
411411

412-
if len(field_data) > 1 and all(offset == 0 for offset, name, ctype in field_data):
412+
if len(field_data) > 1 and all(offset == 0 for offset, _, _ in field_data):
413413
# union, if multiple fields all at address 0
414414
size = 0
415415
_fields_ = []

‎numpy/exceptions.py

Copy file name to clipboardExpand all lines: numpy/exceptions.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,5 @@ class DTypePromotionError(TypeError):
243243
DTypePromotionError: field names `('field1', 'field2')` and `('field1',)`
244244
mismatch.
245245
246-
"""
246+
""" # noqa: E501
247247
pass

‎numpy/fft/_pocketfft.py

Copy file name to clipboardExpand all lines: numpy/fft/_pocketfft.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ def fft(a, n=None, axis=-1, norm=None, out=None):
198198
>>> t = np.arange(256)
199199
>>> sp = np.fft.fft(np.sin(t))
200200
>>> freq = np.fft.fftfreq(t.shape[-1])
201-
>>> plt.plot(freq, sp.real, freq, sp.imag)
202-
[<matplotlib.lines.Line2D object at 0x...>, <matplotlib.lines.Line2D object at 0x...>]
201+
>>> _ = plt.plot(freq, sp.real, freq, sp.imag)
203202
>>> plt.show()
204203
205204
"""

‎numpy/fft/tests/test_helper.py

Copy file name to clipboardExpand all lines: numpy/fft/tests/test_helper.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_uneven_dims(self):
8484
assert_array_almost_equal(fft.ifftshift(shift_dim_both), freqs)
8585

8686
def test_equal_to_original(self):
87-
""" Test that the new (>=v1.15) implementation (see #10073) is equal to the original (<=v1.14) """
87+
""" Test the new (>=v1.15) and old implementations are equal (see #10073) """
8888
from numpy._core import asarray, concatenate, arange, take
8989

9090
def original_fftshift(x, axes=None):

‎numpy/testing/_private/extbuild.py

Copy file name to clipboardExpand all lines: numpy/testing/_private/extbuild.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ def build(cfile, outputfilename, compile_extra, link_extra,
233233
cwd=build_dir,
234234
)
235235
else:
236-
subprocess.check_call(["meson", "setup", "--vsenv", "..", f'--native-file={os.fspath(native_file_name)}'],
236+
subprocess.check_call(["meson", "setup", "--vsenv",
237+
"..", f'--native-file={os.fspath(native_file_name)}'],
237238
cwd=build_dir
238239
)
239240

‎ruff.toml

Copy file name to clipboardExpand all lines: ruff.toml
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ extend-exclude = [
1414
"numpy/_core/src/common/pythoncapi-compat",
1515
]
1616

17+
line-length = 88
18+
1719
[lint]
1820
preview = true
1921
extend-select = [
@@ -38,7 +40,6 @@ ignore = [
3840
"E266", # Too many leading `#` before block comment
3941
"E302", # TODO: Expected 2 blank lines, found 1
4042
"E402", # Module level import not at top of file
41-
"E501", # TODO: Line too long
4243
"E712", # Avoid equality comparisons to `True` or `False`
4344
"E721", # TODO: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance check
4445
"E731", # Do not assign a `lambda` expression, use a `def`
@@ -49,3 +50,17 @@ ignore = [
4950

5051
[lint.per-file-ignores]
5152
"test*.py" = ["E201", "E714"]
53+
"benchmarks/*py" = ["E501"]
54+
"numpy/_build_utils/*py" = ["E501"]
55+
"numpy/__init__.py" = ["E501"]
56+
"numpy/_core/**" = ["E501"]
57+
"numpy/core/**" = ["E501"]
58+
"numpy/_typing/*py" = ["E501"]
59+
"numpy/lib/*py" = ["E501"]
60+
"numpy/linalg/*py" = ["E501"]
61+
"numpy/ma/*py" = ["E501"]
62+
"numpy/polynomial/*py" = ["E501"]
63+
"numpy/tests/*py" = ["E501"]
64+
"numpy/random/*py" = ["E501"]
65+
"numpy*pyi" = ["E501"]
66+
"numpy/f2py/*py" = ["E501"]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.