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 28247e5

Browse filesBrowse files
authored
MAINT: Enable linting with ruff E501 for numpy._core (#28954)
1 parent e4f0cd3 commit 28247e5
Copy full SHA for 28247e5

File tree

4 files changed

+11
-8
lines changed
Filter options

4 files changed

+11
-8
lines changed

‎numpy/__init__.py

Copy file name to clipboardExpand all lines: numpy/__init__.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,18 +470,19 @@ def _mac_os_check():
470470
from . import exceptions
471471
with warnings.catch_warnings(record=True) as w:
472472
_mac_os_check()
473-
# Throw runtime error, if the test failed Check for warning and error_message
473+
# Throw runtime error, if the test failed
474+
# Check for warning and report the error_message
474475
if len(w) > 0:
475476
for _wn in w:
476477
if _wn.category is exceptions.RankWarning:
477-
# Ignore other warnings, they may not be relevant (see gh-25433).
478+
# Ignore other warnings, they may not be relevant (see gh-25433)
478479
error_message = (
479480
f"{_wn.category.__name__}: {_wn.message}"
480481
)
481482
msg = (
482483
"Polyfit sanity test emitted a warning, most likely due "
483484
"to using a buggy Accelerate backend."
484-
"\nIf you compiled yourself, more information is available at:"
485+
"\nIf you compiled yourself, more information is available at:" # noqa: E501
485486
"\nhttps://numpy.org/devdocs/building/index.html"
486487
"\nOtherwise report this to the vendor "
487488
f"that provided NumPy.\n\n{error_message}\n")

‎numpy/_core/code_generators/generate_numpy_api.py

Copy file name to clipboardExpand all lines: numpy/_core/code_generators/generate_numpy_api.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
#endif
193193
194194
#endif
195-
"""
195+
""" # noqa: E501
196196

197197

198198
c_template = r"""

‎numpy/_core/memmap.py

Copy file name to clipboardExpand all lines: numpy/_core/memmap.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def __new__(subtype, filename, dtype=uint8, mode='r+', offset=0,
256256
except TypeError:
257257
pass
258258
shape = tuple(shape)
259-
size = np.intp(1) # avoid default choice of np.int_, which might overflow
259+
size = np.intp(1) # avoid overflows
260260
for k in shape:
261261
size *= k
262262

‎ruff.toml

Copy file name to clipboardExpand all lines: ruff.toml
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ ignore = [
5353

5454
[lint.per-file-ignores]
5555
"test*.py" = ["E201", "E714"]
56+
5657
"benchmarks/*py" = ["E501"]
5758
"numpy/_build_utils/*py" = ["E501"]
58-
"numpy/__init__.py" = ["E501"]
59-
"numpy/_core/**" = ["E501"]
60-
"numpy/core/**" = ["E501"]
59+
"numpy/_core/tests/**" = ["E501"]
60+
"numpy/_core/_add_newdocs.py" = ["E501"]
61+
"numpy/_core/_add_newdocs_scalars.py" = ["E501"]
62+
"numpy/_core/code_generators/generate_umath.py" = ["E501"]
6163
"numpy/_typing/*py" = ["E501"]
6264
"numpy/lib/*py" = ["E501"]
6365
"numpy/linalg/*py" = ["E501"]

0 commit comments

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