Skip to content

Commit

Permalink
STYLE: fix pylint simplifiable-if-expression warnings (#49339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moisan authored Oct 26, 2022
1 parent 2c77567 commit 201cac4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

def _cat_compare_op(op):
opname = f"__{op.__name__}__"
fill_value = True if op is operator.ne else False
fill_value = op is operator.ne

@unpack_zerodim_and_defer(opname)
def func(self, other):
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/window/ewm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ def mean(self, *args, update=None, update_times=None, **kwargs):
1 0.75 5.75
"""
result_kwargs = {}
is_frame = True if self._selected_obj.ndim == 2 else False
is_frame = self._selected_obj.ndim == 2
if update_times is not None:
raise NotImplementedError("update_times is not implemented.")
else:
Expand Down
5 changes: 1 addition & 4 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2958,10 +2958,7 @@ def hide(
setattr(
self,
f"hide_{objs}_",
[
True if lev in levels_ else False
for lev in range(getattr(self, objs).nlevels)
],
[lev in levels_ for lev in range(getattr(self, objs).nlevels)],
)
else:
if axis == 0:
Expand Down
6 changes: 2 additions & 4 deletions pandas/tests/copy_view/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,9 @@ def test_subset_set_column_with_loc(using_copy_on_write, using_array_manager, dt
with pd.option_context("chained_assignment", "warn"):
# The (i)loc[:, col] inplace deprecation gets triggered here, ignore those
# warnings and only assert the SettingWithCopyWarning
raise_on_extra_warnings = False if using_array_manager else True
with tm.assert_produces_warning(
SettingWithCopyWarning,
raise_on_extra_warnings=raise_on_extra_warnings,
raise_on_extra_warnings=not using_array_manager,
):
subset.loc[:, "a"] = np.array([10, 11], dtype="int64")

Expand Down Expand Up @@ -376,10 +375,9 @@ def test_subset_set_column_with_loc2(using_copy_on_write, using_array_manager):
with pd.option_context("chained_assignment", "warn"):
# The (i)loc[:, col] inplace deprecation gets triggered here, ignore those
# warnings and only assert the SettingWithCopyWarning
raise_on_extra_warnings = False if using_array_manager else True
with tm.assert_produces_warning(
SettingWithCopyWarning,
raise_on_extra_warnings=raise_on_extra_warnings,
raise_on_extra_warnings=not using_array_manager,
):
subset.loc[:, "a"] = 0

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ disable = [
"no-else-return",
"no-self-use",
"redefined-argument-from-local",
"simplifiable-if-expression",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
Expand Down

0 comments on commit 201cac4

Please sign in to comment.