diff --git a/pandas/core/arrays/arrow/extension_types.py b/pandas/core/arrays/arrow/extension_types.py index c9badb2bd305b..25f597af5e3cf 100644 --- a/pandas/core/arrays/arrow/extension_types.py +++ b/pandas/core/arrays/arrow/extension_types.py @@ -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)) @@ -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)) diff --git a/pandas/io/formats/style_render.py b/pandas/io/formats/style_render.py index 0f93027f3f775..9244a8c5e672d 100644 --- a/pandas/io/formats/style_render.py +++ b/pandas/io/formats/style_render.py @@ -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) diff --git a/pandas/tests/arrays/interval/test_interval.py b/pandas/tests/arrays/interval/test_interval.py index 2a6bea3255342..28b5f441d3cd5 100644 --- a/pandas/tests/arrays/interval/test_interval.py +++ b/pandas/tests/arrays/interval/test_interval.py @@ -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 diff --git a/pandas/tests/arrays/period/test_arrow_compat.py b/pandas/tests/arrays/period/test_arrow_compat.py index 03fd146572405..61670f74f78fb 100644 --- a/pandas/tests/arrays/period/test_arrow_compat.py +++ b/pandas/tests/arrays/period/test_arrow_compat.py @@ -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( diff --git a/pandas/tests/indexes/multi/test_indexing.py b/pandas/tests/indexes/multi/test_indexing.py index fce3da6dd6aee..9b0e74f050b62 100644 --- a/pandas/tests/indexes/multi/test_indexing.py +++ b/pandas/tests/indexes/multi/test_indexing.py @@ -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(): diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index 72ee89a4b5108..1c3868bc85fd5 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -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 diff --git a/pandas/tests/scalar/timestamp/test_comparisons.py b/pandas/tests/scalar/timestamp/test_comparisons.py index ad629604d1bc9..c3e0f6df9c7d5 100644 --- a/pandas/tests/scalar/timestamp/test_comparisons.py +++ b/pandas/tests/scalar/timestamp/test_comparisons.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 397f74ddab71a..223e31dfbb3cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",