-
-
Notifications
You must be signed in to change notification settings - Fork 11k
MAINT: Enable linting with ruff E501 #29250
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
base: main
Are you sure you want to change the base?
Conversation
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 picked some nits; hope you don't mind.
@pytest.mark.skipif(sys.maxsize < 2**32, | ||
reason="only problematic on 64bit platforms") |
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.
this looks a bit weird; so how about
@pytest.mark.skipif(sys.maxsize < 2**32, | |
reason="only problematic on 64bit platforms") | |
@pytest.mark.skipif( | |
sys.maxsize < 2**32, | |
reason="only problematic on 64bit platforms" | |
) |
or
@pytest.mark.skipif(sys.maxsize < 2**32, | |
reason="only problematic on 64bit platforms") | |
@pytest.mark.skipif(sys.maxsize < 2**32, | |
reason="only problematic on 64bit platforms") |
@pytest.mark.skipif(IS_PYPY, | ||
reason="PYPY handles sq_concat, nb_add differently than cpython") |
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.
@pytest.mark.skipif(IS_PYPY, | |
reason="PYPY handles sq_concat, nb_add differently than cpython") | |
@pytest.mark.skipif( | |
IS_PYPY, | |
reason="PYPY handles sq_concat, nb_add differently than cpython" | |
) |
or
@pytest.mark.skipif(IS_PYPY, | |
reason="PYPY handles sq_concat, nb_add differently than cpython") | |
@pytest.mark.skipif(IS_PYPY, | |
reason="PYPY handles sq_concat, nb_add differently than cpython") |
(if that even fits)
@@ -309,7 +310,7 @@ def test_basic(self): | |||
def test_order(self): | |||
# It turns out that people rely on np.copy() preserving order by | |||
# default; changing this broke scikit-learn: | |||
# github.com/scikit-learn/scikit-learn/commit/7842748cf777412c506a8c0ed28090711d3a3783 | |||
# github.com/scikit-learn/scikit-learn/commit/7842748cf777412c506a8c0ed28090711d3a3783 # 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.
this also works:
# github.com/scikit-learn/scikit-learn/commit/7842748cf777412c506a8c0ed28090711d3a3783 # noqa: E501 | |
# github.com/scikit-learn/scikit-learn/commit/7842748 |
assert_equal(np.interp(0.5, [-inf, +inf], sc([ 0, 10])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, 1], sc([-inf, +inf])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, 1], sc([+inf, -inf])), sc(nan)) |
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.
assert_equal(np.interp(0.5, [-inf, +inf], sc([ 0, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, 1], sc([-inf, +inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, 1], sc([+inf, -inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, +inf], sc([ 0, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, 1], sc([-inf, +inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, 1], sc([+inf, -inf])), sc(nan)) |
assert_equal(np.interp(0.5, [-inf, 1], sc([-inf, 10])), sc(nan)) | ||
assert_equal(np.interp(0.5, [-inf, 1], sc([+inf, 10])), sc(nan)) | ||
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, -inf])), sc(nan)) | ||
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, +inf])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, +inf], sc([-inf, 10])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, +inf], sc([+inf, 10])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, -inf])), sc(nan)) | ||
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, +inf])), sc(nan)) |
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.
assert_equal(np.interp(0.5, [-inf, 1], sc([-inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([+inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, -inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, +inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([-inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([+inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, -inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, +inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([-inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([+inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, -inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [-inf, 1], sc([ 0, +inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([-inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([+inf, 10])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, -inf])), sc(nan)) | |
assert_equal(np.interp(0.5, [ 0, +inf], sc([ 0, +inf])), sc(nan)) |
@@ -249,8 +254,8 @@ def test_complex(self): | |||
def test_integ_coeffs(self): | |||
p = np.poly1d([3, 2, 1]) | |||
p2 = p.integ(3, k=[9, 7, 6]) | |||
assert_( | |||
(p2.coeffs == [1 / 4. / 5., 1 / 3. / 4., 1 / 2. / 3., 9 / 1. / 2., 7, 6]).all()) | |||
expected = [1 / 4. / 5., 1 / 3. / 4., 1 / 2. / 3., 9 / 1. / 2., 7, 6] |
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 guess these python 2 remnants aren't needed anymore
expected = [1 / 4. / 5., 1 / 3. / 4., 1 / 2. / 3., 9 / 1. / 2., 7, 6] | |
expected = [1 / 4 / 5, 1 / 3 / 4, 1 / 2 / 3, 9 / 1 / 2, 7, 6] |
assert_( | ||
(p2.coeffs == [1 / 4. / 5., 1 / 3. / 4., 1 / 2. / 3., 9 / 1. / 2., 7, 6]).all()) | ||
expected = [1 / 4. / 5., 1 / 3. / 4., 1 / 2. / 3., 9 / 1. / 2., 7, 6] | ||
assert_( (p2.coeffs == expected).all()) |
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.
assert_( (p2.coeffs == expected).all()) | |
assert_((p2.coeffs == expected).all()) |
Part of #28947