Skip to content

Commit 48b563a

Browse files
committed
fix style.ipynb, ignore some pylint
1 parent 0b54f79 commit 48b563a

File tree

8 files changed

+395
-313
lines changed

8 files changed

+395
-313
lines changed

doc/source/user_guide/style.ipynb

Lines changed: 383 additions & 294 deletions
Large diffs are not rendered by default.

pandas/core/_numba/kernels/min_max_.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ def grouped_min_max(
112112
continue
113113

114114
if is_max:
115-
if val > output[lab]:
116-
output[lab] = val
115+
output[lab] = max(val, output[lab])
117116
else:
118-
if val < output[lab]:
119-
output[lab] = val
117+
output[lab] = min(val, output[lab])
120118

121119
# Set labels that don't satisfy min_periods as np.nan
122120
for lab, count in enumerate(nobs):

pandas/core/arrays/string_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def __eq__(self, other: object) -> bool:
190190
# cannot be checked with normal `==`
191191
if isinstance(other, str):
192192
# TODO should dtype == "string" work for the NaN variant?
193-
if other == "string" or other == self.name: # noqa: PLR1714
193+
if other == "string" or other == self.name:
194194
return True
195195
try:
196196
other = self.construct_from_string(other)

pandas/core/dtypes/cast.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,7 @@ def _maybe_promote(dtype: np.dtype, fill_value=np.nan):
683683

684684
elif dtype.kind == "f":
685685
mst = np.min_scalar_type(fill_value)
686-
if mst > dtype:
687-
# e.g. mst is np.float64 and dtype is np.float32
688-
dtype = mst
686+
dtype = max(mst, dtype)
689687

690688
elif dtype.kind == "c":
691689
mst = np.min_scalar_type(fill_value)
@@ -718,9 +716,7 @@ def _maybe_promote(dtype: np.dtype, fill_value=np.nan):
718716

719717
elif dtype.kind == "c":
720718
mst = np.min_scalar_type(fill_value)
721-
if mst > dtype:
722-
# e.g. mst is np.complex128 and dtype is np.complex64
723-
dtype = mst
719+
dtype = max(mst, dtype)
724720

725721
else:
726722
dtype = np.dtype(np.object_)

pandas/io/excel/_odfreader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ def get_sheet_data(
142142
empty_cells = 0
143143
table_row.extend([value] * column_repeat)
144144

145-
if max_row_len < len(table_row):
146-
max_row_len = len(table_row)
145+
max_row_len = max(max_row_len, len(table_row))
147146

148147
row_repeat = self._get_row_repeat(sheet_row)
149148
if len(table_row) == 0:

pandas/tests/arithmetic/test_numeric.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,7 @@ def test_numeric_arr_rdiv_tdscalar(self, three_days, numeric_idx, box_with_array
274274
expected = TimedeltaIndex(["3 Days", "36 Hours"])
275275
if isinstance(three_days, np.timedelta64):
276276
dtype = three_days.dtype
277-
if dtype < np.dtype("m8[s]"):
278-
# i.e. resolution is lower -> use lowest supported resolution
279-
dtype = np.dtype("m8[s]")
277+
dtype = max(dtype, np.dtype("m8[s]"))
280278
expected = expected.astype(dtype)
281279
elif type(three_days) is timedelta:
282280
expected = expected.astype("m8[us]")

pandas/tests/indexes/test_old_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def test_insert_out_of_bounds(self, index, using_infer_string):
455455
msg = "slice indices must be integers or None or have an __index__ method"
456456

457457
if using_infer_string and (
458-
index.dtype == "string" or index.dtype == "category" # noqa: PLR1714
458+
index.dtype == "string" or index.dtype == "category"
459459
):
460460
msg = "loc must be an integer between"
461461

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ ignore = [
341341
"RUF012",
342342
# type-comparison
343343
"E721",
344-
345-
# Additional pylint rules
344+
# repeated-equality-comparison
345+
"PLR1714",
346+
# self-or-cls-assignment
347+
"PLW0642",
346348
# literal-membership
347349
"PLR6201", # 847 errors
348350
# Method could be a function, class method, or static method

0 commit comments

Comments
 (0)