Skip to content

Commit

Permalink
STYLE: fix pylint no-else-continue warnings (#49464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moisan authored Nov 2, 2022
1 parent 4c0f3f6 commit f43d3a7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

if fname == "index.rst" and os.path.abspath(dirname) == source_path:
continue
elif pattern == "-api" and reldir.startswith("reference"):
if pattern == "-api" and reldir.startswith("reference"):
exclude_patterns.append(fname)
elif (
pattern == "whatsnew"
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3049,10 +3049,10 @@ def maybe_mi_droplevels(indexer, levels):
):
# everything
continue
else:
# e.g. test_xs_IndexSlice_argument_not_implemented
k_index = np.zeros(len(self), dtype=bool)
k_index[loc_level] = True

# e.g. test_xs_IndexSlice_argument_not_implemented
k_index = np.zeros(len(self), dtype=bool)
k_index[loc_level] = True

else:
k_index = loc_level
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ def _maybe_coerce_merge_keys(self) -> None:
continue

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

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

# let's infer and see if we are ok
elif lib.infer_dtype(lk, skipna=False) == lib.infer_dtype(
if lib.infer_dtype(lk, skipna=False) == lib.infer_dtype(
rk, skipna=False
):
continue
Expand Down
10 changes: 5 additions & 5 deletions pandas/io/formats/style_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ def _translate_header(self, sparsify_cols: bool, max_cols: int):
for r, hide in enumerate(self.hide_columns_):
if hide or not clabels:
continue
else:
header_row = self._generate_col_header_row(
(r, clabels), max_cols, col_lengths
)
head.append(header_row)

header_row = self._generate_col_header_row(
(r, clabels), max_cols, col_lengths
)
head.append(header_row)

# 2) index names
if (
Expand Down
6 changes: 3 additions & 3 deletions pandas/io/json/_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def nested_to_record(
v = new_d.pop(k)
new_d[newkey] = v
continue
else:
v = new_d.pop(k)
new_d.update(nested_to_record(v, newkey, sep, level + 1, max_level))

v = new_d.pop(k)
new_d.update(nested_to_record(v, newkey, sep, level + 1, max_level))
new_ds.append(new_d)

if singleton:
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/parser/common/test_common_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ def test_read_table_same_signature_as_read_csv(all_parsers):
assert table_param.annotation == csv_param.annotation
assert table_param.kind == csv_param.kind
continue
else:
assert table_param == csv_param

assert table_param == csv_param


def test_read_table_equivalency_to_read_csv(all_parsers):
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ disable = [
"cyclic-import",
"duplicate-code",
"inconsistent-return-statements",
"no-else-continue",
"no-else-raise",
"no-else-return",
"redefined-argument-from-local",
Expand Down

0 comments on commit f43d3a7

Please sign in to comment.