Skip to content

Commit a922c78

Browse files
Moisanphofl
authored andcommitted
STYLE: fix pylint no-else-continue warnings (pandas-dev#49464)
1 parent 2fa6873 commit a922c78

File tree

7 files changed

+18
-19
lines changed

7 files changed

+18
-19
lines changed

doc/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
if fname == "index.rst" and os.path.abspath(dirname) == source_path:
107107
continue
108-
elif pattern == "-api" and reldir.startswith("reference"):
108+
if pattern == "-api" and reldir.startswith("reference"):
109109
exclude_patterns.append(fname)
110110
elif (
111111
pattern == "whatsnew"

pandas/core/indexes/multi.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3049,10 +3049,10 @@ def maybe_mi_droplevels(indexer, levels):
30493049
):
30503050
# everything
30513051
continue
3052-
else:
3053-
# e.g. test_xs_IndexSlice_argument_not_implemented
3054-
k_index = np.zeros(len(self), dtype=bool)
3055-
k_index[loc_level] = True
3052+
3053+
# e.g. test_xs_IndexSlice_argument_not_implemented
3054+
k_index = np.zeros(len(self), dtype=bool)
3055+
k_index[loc_level] = True
30563056

30573057
else:
30583058
k_index = loc_level

pandas/core/reshape/merge.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ def _maybe_coerce_merge_keys(self) -> None:
12901290
continue
12911291

12921292
# check whether ints and floats
1293-
elif is_integer_dtype(rk.dtype) and is_float_dtype(lk.dtype):
1293+
if is_integer_dtype(rk.dtype) and is_float_dtype(lk.dtype):
12941294
# GH 47391 numpy > 1.24 will raise a RuntimeError for nan -> int
12951295
with np.errstate(invalid="ignore"):
12961296
# error: Argument 1 to "astype" of "ndarray" has incompatible
@@ -1312,7 +1312,7 @@ def _maybe_coerce_merge_keys(self) -> None:
13121312
)
13131313
continue
13141314

1315-
elif is_float_dtype(rk.dtype) and is_integer_dtype(lk.dtype):
1315+
if is_float_dtype(rk.dtype) and is_integer_dtype(lk.dtype):
13161316
# GH 47391 numpy > 1.24 will raise a RuntimeError for nan -> int
13171317
with np.errstate(invalid="ignore"):
13181318
# error: Argument 1 to "astype" of "ndarray" has incompatible
@@ -1335,7 +1335,7 @@ def _maybe_coerce_merge_keys(self) -> None:
13351335
continue
13361336

13371337
# let's infer and see if we are ok
1338-
elif lib.infer_dtype(lk, skipna=False) == lib.infer_dtype(
1338+
if lib.infer_dtype(lk, skipna=False) == lib.infer_dtype(
13391339
rk, skipna=False
13401340
):
13411341
continue

pandas/io/formats/style_render.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ def _translate_header(self, sparsify_cols: bool, max_cols: int):
399399
for r, hide in enumerate(self.hide_columns_):
400400
if hide or not clabels:
401401
continue
402-
else:
403-
header_row = self._generate_col_header_row(
404-
(r, clabels), max_cols, col_lengths
405-
)
406-
head.append(header_row)
402+
403+
header_row = self._generate_col_header_row(
404+
(r, clabels), max_cols, col_lengths
405+
)
406+
head.append(header_row)
407407

408408
# 2) index names
409409
if (

pandas/io/json/_normalize.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def nested_to_record(
112112
v = new_d.pop(k)
113113
new_d[newkey] = v
114114
continue
115-
else:
116-
v = new_d.pop(k)
117-
new_d.update(nested_to_record(v, newkey, sep, level + 1, max_level))
115+
116+
v = new_d.pop(k)
117+
new_d.update(nested_to_record(v, newkey, sep, level + 1, max_level))
118118
new_ds.append(new_d)
119119

120120
if singleton:

pandas/tests/io/parser/common/test_common_basic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ def test_read_table_same_signature_as_read_csv(all_parsers):
661661
assert table_param.annotation == csv_param.annotation
662662
assert table_param.kind == csv_param.kind
663663
continue
664-
else:
665-
assert table_param == csv_param
664+
665+
assert table_param == csv_param
666666

667667

668668
def test_read_table_equivalency_to_read_csv(all_parsers):

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ disable = [
113113
"cyclic-import",
114114
"duplicate-code",
115115
"inconsistent-return-statements",
116-
"no-else-continue",
117116
"no-else-raise",
118117
"no-else-return",
119118
"redefined-argument-from-local",

0 commit comments

Comments
 (0)