Skip to content

enable pylint:useless-return #49400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pandas/core/arrays/_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ def _fill_mask_inplace(
# (for now) when self.ndim == 2, we assume axis=0
func = missing.get_fill_func(method, ndim=self.ndim)
func(self._ndarray.T, limit=limit, mask=mask.T)
return

@doc(ExtensionArray.fillna)
def fillna(
Expand Down
1 change: 0 additions & 1 deletion pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,6 @@ def _fill_mask_inplace(
func(npvalues, limit=limit, mask=mask.copy())
new_values = self._from_sequence(npvalues, dtype=self.dtype)
self[mask] = new_values[mask]
return

def _rank(
self,
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def interpolate_array_2d(
fill_value=fill_value,
**kwargs,
)
return


def _interpolate_2d_with_fill(
Expand Down Expand Up @@ -341,7 +340,6 @@ def func(yvalues: np.ndarray) -> None:
# Sequence[Sequence[Sequence[_SupportsArray[dtype[<nothing>]]]]],
# Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[<nothing>]]]]]]]]"
np.apply_along_axis(func, axis, data) # type: ignore[arg-type]
return


def _index_to_interp_indices(index: Index, method: str) -> np.ndarray:
Expand Down Expand Up @@ -762,8 +760,6 @@ def _interpolate_with_limit_area(

values[invalid] = np.nan

return


def interpolate_2d(
values: np.ndarray,
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def f_scalar(group):
names.append(group.name)
return 0

def f_none(group):
def f_none(group): # pylint: disable= "useless-return"
# GH10519, GH12155, GH21417
names.append(group.name)
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this one be removed as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions above and below this function have the same functionality and differ only by return type. To make the code more readable I left return None.

Should I remove it too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think that's better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I removed it too and added fixup commit to the PR.

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ disable = [
"unnecessary-list-index-lookup",
"use-a-generator",
"useless-option-value",
"useless-return",

# pylint type "W": warning, for python specific problems
"abstract-method",
Expand Down