Skip to content
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

STYLE: fix pylint unneeded-not warnings #49382

Merged
merged 4 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/core/arrays/arrow/extension_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __eq__(self, other):
else:
return NotImplemented

def __ne__(self, other) -> bool:
return not self == other

def __hash__(self) -> int:
return hash((str(self), self.freq))

Expand Down Expand Up @@ -91,6 +94,9 @@ def __eq__(self, other):
else:
return NotImplemented

def __ne__(self, other) -> bool:
return not self == other

def __hash__(self) -> int:
return hash((str(self), str(self.subtype), self.closed))

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/style_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(
self.data: DataFrame = data
self.index: Index = data.index
self.columns: Index = data.columns
if not isinstance(uuid_len, int) or not uuid_len >= 0:
if not isinstance(uuid_len, int) or uuid_len < 0:
raise TypeError("``uuid_len`` must be an integer in range [0, 32].")
self.uuid = uuid or uuid4().hex[: min(32, uuid_len)]
self.uuid_len = len(self.uuid)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/arrays/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ def test_arrow_extension_type():

assert p1.closed == "left"
assert p1 == p2
assert not p1 == p3
assert p1 != p3
assert hash(p1) == hash(p2)
assert not hash(p1) == hash(p3)
assert hash(p1) != hash(p3)


@pyarrow_skip
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/arrays/period/test_arrow_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def test_arrow_extension_type():

assert p1.freq == "D"
assert p1 == p2
assert not p1 == p3
assert p1 != p3
assert hash(p1) == hash(p2)
assert not hash(p1) == hash(p3)
assert hash(p1) != hash(p3)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def test_contains_td64_level(self):
def test_large_mi_contains(self):
# GH#10645
result = MultiIndex.from_arrays([range(10**6), range(10**6)])
assert not (10**6, 0) in result
assert (10**6, 0) not in result


def test_timestamp_multiindex_indexer():
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/scalar/timedelta/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,5 +1114,5 @@ def test_ops_error_str():
with pytest.raises(TypeError, match=msg):
left > right

assert not left == right
assert not left == right # pylint: disable=unneeded-not
assert left != right
2 changes: 1 addition & 1 deletion pandas/tests/scalar/timestamp/test_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,5 @@ def __eq__(self, other) -> bool:
for left, right in [(inf, timestamp), (timestamp, inf)]:
assert left > right or left < right
assert left >= right or left <= right
assert not left == right
assert not left == right # pylint: disable=unneeded-not
assert left != right
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ disable = [
"unidiomatic-typecheck",
"unnecessary-dunder-call",
"unnecessary-lambda-assignment",
"unneeded-not",
"use-implicit-booleaness-not-comparison",
"use-implicit-booleaness-not-len",
"use-sequence-for-iteration",
Expand Down