-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
MAINT: Enforce ruff E501 #29068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAINT: Enforce ruff E501 #29068
Conversation
@@ -384,9 +384,6 @@ | |||
('z', 'u1')] | |||
|
|||
NbufferT = [ | |||
# x Info color info y z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: same information is in the array Ndescr
above
@@ -554,18 +554,18 @@ def test_outlier(self): | |||
assert_equal(len(a), numbins) | |||
|
|||
def test_scott_vs_stone(self): | |||
"""Verify that Scott's rule and Stone's rule converges for normally distributed data""" | |||
"""Verify that Scott's rule and Stone's rule converges for normally distributed data""" # noqa: E501 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could turn this into a #
comment over two lines.
numpy/_typing/_dtype_like.py
Outdated
@@ -55,7 +55,7 @@ def dtype(self) -> _DTypeT_co: ... | |||
|
|||
|
|||
# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic` | |||
_DTypeLike: TypeAlias = type[_ScalarT] | np.dtype[_ScalarT] | _SupportsDType[np.dtype[_ScalarT]] | |||
_DTypeLike: TypeAlias = type[_ScalarT] | np.dtype[_ScalarT] | _SupportsDType[np.dtype[_ScalarT]] # noqa: E501 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to skip _typing
, it is its own world.
numpy/_core/tests/test_indexing.py
Outdated
@@ -1352,7 +1352,7 @@ def test_boolean_indexing_fast_path(self): | |||
"size of axis is 3 but size of corresponding boolean axis is 1", | |||
lambda: a[idx1]) | |||
|
|||
# This used to incorrectly give a ValueError: operands could not be broadcast together | |||
# This used to incorrectly give a ValueError: operands could not be broadcast together # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this a two line comment.
I agree with @charris: We follow the python typing spec, which in its stub style guide says:
But this isn't possible to configure in ruff yet, see astral-sh/ruff#16057 and astral-sh/ruff#7696. And even though |
@@ -166,7 +166,7 @@ def check_may_share_memory_exact(a, b): | |||
err_msg = "" | |||
if got != exact: | |||
err_msg = " " + "\n ".join([ | |||
f"base_a - base_b = {a.__array_interface__['data'][0] - b.__array_interface__['data'][0]!r}", | |||
f"base_a - base_b = {a.__array_interface__['data'][0] - b.__array_interface__['data'][0]!r}", # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd break out the computation on a separate line. Putting a lot of computation into a { ... }
is hard to read.
@@ -402,7 +402,7 @@ def check(A, U, exists=None): | |||
exists = (X is not None) | |||
|
|||
if X is not None: | |||
assert_(sum(a * x for a, x in zip(A, X)) == sum(a * u // 2 for a, u in zip(A, U))) | |||
assert_(sum(a * x for a, x in zip(A, X)) == sum(a * u // 2 for a, u in zip(A, U))) # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd break this into two computations before the assert_
. Now that we are using pytest, you can also use assert
instead of the assert_
function.
Thanks @eendebakpt . |
See #28947