Skip to content

Commit bb87341

Browse files
MAINT: apply ruff/Pycodestyle rule E712
E712 Avoid inequality comparisons to `True`; use `if not cond:` for false checks
1 parent 52bf3ca commit bb87341

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

numpy/_core/arrayprint.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ def _make_options_dict(precision=None, threshold=None, edgeitems=None,
6969
if sign not in [None, '-', '+', ' ']:
7070
raise ValueError("sign option must be one of ' ', '+', or '-'")
7171

72-
if legacy == False:
72+
if legacy is False:
73+
options['legacy'] = sys.maxsize
74+
elif legacy == False: # noqa: E712
75+
warnings.warn(
76+
f"Passing `legacy={legacy}` is deprecated.",
77+
FutureWarning, stacklevel=3
78+
)
7379
options['legacy'] = sys.maxsize
7480
elif legacy == '1.13':
7581
options['legacy'] = 113

numpy/_core/tests/test_array_api_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
def test_capabilities():
88
caps = info.capabilities()
9-
assert caps["boolean indexing"] == True
10-
assert caps["data-dependent shapes"] == True
9+
assert caps["boolean indexing"] is True
10+
assert caps["data-dependent shapes"] is True
1111

1212
# This will be added in the 2024.12 release of the array API standard.
1313

numpy/_core/tests/test_simd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def test_unary_invalid_fpexception(self, intrin_name):
587587
v = self.setall(d)
588588
clear_floatstatus()
589589
intrin(v)
590-
assert check_floatstatus(invalid=True) == False
590+
assert check_floatstatus(invalid=True) is False
591591

592592
@pytest.mark.parametrize('py_comp,np_comp', [
593593
(operator.lt, "cmplt"),

0 commit comments

Comments
 (0)