Skip to content

Commit 201cac4

Browse files
authored
STYLE: fix pylint simplifiable-if-expression warnings (#49339)
1 parent 2c77567 commit 201cac4

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133

134134
def _cat_compare_op(op):
135135
opname = f"__{op.__name__}__"
136-
fill_value = True if op is operator.ne else False
136+
fill_value = op is operator.ne
137137

138138
@unpack_zerodim_and_defer(opname)
139139
def func(self, other):

pandas/core/window/ewm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def mean(self, *args, update=None, update_times=None, **kwargs):
10021002
1 0.75 5.75
10031003
"""
10041004
result_kwargs = {}
1005-
is_frame = True if self._selected_obj.ndim == 2 else False
1005+
is_frame = self._selected_obj.ndim == 2
10061006
if update_times is not None:
10071007
raise NotImplementedError("update_times is not implemented.")
10081008
else:

pandas/io/formats/style.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,10 +2958,7 @@ def hide(
29582958
setattr(
29592959
self,
29602960
f"hide_{objs}_",
2961-
[
2962-
True if lev in levels_ else False
2963-
for lev in range(getattr(self, objs).nlevels)
2964-
],
2961+
[lev in levels_ for lev in range(getattr(self, objs).nlevels)],
29652962
)
29662963
else:
29672964
if axis == 0:

pandas/tests/copy_view/test_indexing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,9 @@ def test_subset_set_column_with_loc(using_copy_on_write, using_array_manager, dt
339339
with pd.option_context("chained_assignment", "warn"):
340340
# The (i)loc[:, col] inplace deprecation gets triggered here, ignore those
341341
# warnings and only assert the SettingWithCopyWarning
342-
raise_on_extra_warnings = False if using_array_manager else True
343342
with tm.assert_produces_warning(
344343
SettingWithCopyWarning,
345-
raise_on_extra_warnings=raise_on_extra_warnings,
344+
raise_on_extra_warnings=not using_array_manager,
346345
):
347346
subset.loc[:, "a"] = np.array([10, 11], dtype="int64")
348347

@@ -376,10 +375,9 @@ def test_subset_set_column_with_loc2(using_copy_on_write, using_array_manager):
376375
with pd.option_context("chained_assignment", "warn"):
377376
# The (i)loc[:, col] inplace deprecation gets triggered here, ignore those
378377
# warnings and only assert the SettingWithCopyWarning
379-
raise_on_extra_warnings = False if using_array_manager else True
380378
with tm.assert_produces_warning(
381379
SettingWithCopyWarning,
382-
raise_on_extra_warnings=raise_on_extra_warnings,
380+
raise_on_extra_warnings=not using_array_manager,
383381
):
384382
subset.loc[:, "a"] = 0
385383

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ disable = [
124124
"no-else-return",
125125
"no-self-use",
126126
"redefined-argument-from-local",
127-
"simplifiable-if-expression",
128127
"too-few-public-methods",
129128
"too-many-ancestors",
130129
"too-many-arguments",

0 commit comments

Comments
 (0)