Skip to content

Commit

Permalink
TYP: Add overload for ser.rename_axis (#55412)
Browse files Browse the repository at this point in the history
* Add overload for rename_axis

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
caneff and pre-commit-ci[bot] authored Oct 6, 2023
1 parent e4635ac commit 2983464
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -5004,8 +5004,44 @@ def reindex( # type: ignore[override]
tolerance=tolerance,
)

@overload # type: ignore[override]
def rename_axis(
self,
mapper: IndexLabel | lib.NoDefault = ...,
*,
index=...,
axis: Axis = ...,
copy: bool = ...,
inplace: Literal[True],
) -> None:
...

@overload
def rename_axis(
self,
mapper: IndexLabel | lib.NoDefault = ...,
*,
index=...,
axis: Axis = ...,
copy: bool = ...,
inplace: Literal[False] = ...,
) -> Self:
...

@overload
def rename_axis(
self,
mapper: IndexLabel | lib.NoDefault = ...,
*,
index=...,
axis: Axis = ...,
copy: bool = ...,
inplace: bool = ...,
) -> Self | None:
...

@doc(NDFrame.rename_axis)
def rename_axis( # type: ignore[override]
def rename_axis(
self,
mapper: IndexLabel | lib.NoDefault = lib.no_default,
*,
Expand Down

0 comments on commit 2983464

Please sign in to comment.