Skip to content

STYLE enable pylint: fix use-implicit-booleaness-not-comparison warnings #49831

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

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions pandas/_testing/asserters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,10 @@ def assert_equal(left, right, **kwargs) -> None:
elif isinstance(left, np.ndarray):
assert_numpy_array_equal(left, right, **kwargs)
elif isinstance(left, str):
assert kwargs == {}
assert not kwargs
assert left == right
else:
assert kwargs == {}
assert not kwargs
assert_almost_equal(left, right)


Expand Down
4 changes: 1 addition & 3 deletions pandas/io/sas/sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,7 @@ def _process_page_meta(self) -> bool:
is_data_page = self._current_page_type == const.page_data_type
is_mix_page = self._current_page_type == const.page_mix_type
return bool(
is_data_page
or is_mix_page
or self._current_page_data_subheader_pointers != []
is_data_page or is_mix_page or self._current_page_data_subheader_pointers
)

def _read_page_header(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _iterparse_nodes(self, iterparse: Callable) -> list[dict[str, str | None]]:
):
del elem.getparent()[0]

if dicts == []:
if not dicts:
raise ParserError("No result from selected items in iterparse.")

keys = list(dict.fromkeys([k for d in dicts for k in d.keys()]))
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/apply/test_frame_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_apply_with_reduce_empty():
tm.assert_series_equal(result, expected)

# Ensure that x.append hasn't been called
assert x == []
assert not x


@pytest.mark.parametrize("func", ["sum", "prod", "any", "all"])
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ async def test_tab_complete_warning(self, ip, frame_or_series):

def test_attrs(self):
df = DataFrame({"A": [2, 3]})
assert df.attrs == {}
assert not df.attrs
df.attrs["version"] = 1

result = df.rename(columns=str)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/pytables/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_iter_empty(setup_path):

with ensure_clean_store(setup_path) as store:
# GH 12221
assert list(store) == []
assert not list(store)


def test_repr(setup_path):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def test_value_labels_old_format(self, datapath):
# predates supporting value labels.
dpath = datapath("io", "data", "stata", "S4_EDUC1.dta")
with StataReader(dpath) as reader:
assert reader.value_labels() == {}
assert not reader.value_labels()

def test_date_export_formats(self):
columns = ["tc", "td", "tw", "tm", "tq", "th", "ty"]
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_integer_series_size(self, dtype):

def test_attrs(self):
s = Series([0, 1], name="abc")
assert s.attrs == {}
assert not s.attrs
s.attrs["version"] = 1
result = s + 1
assert result.attrs == {"version": 1}
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ disable = [
"unidiomatic-typecheck",
"unnecessary-dunder-call",
"unnecessary-lambda-assignment",
"use-implicit-booleaness-not-comparison",
"use-implicit-booleaness-not-len",
"wrong-import-order",
"wrong-import-position",
Expand Down