Skip to content

TYP: tighten return type in function any #46638

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 9 commits into from
May 7, 2022
36 changes: 36 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -8988,6 +8988,42 @@ def aggregate(self, func=None, axis: Axis = 0, *args, **kwargs):

agg = aggregate

@overload
def any(
self: DataFrame,
*,
axis: Axis = ...,
bool_only: bool | None = ...,
skipna: bool = ...,
level: None = ...,
**kwargs,
) -> Series:
...

@overload
def any(
self: DataFrame,
*,
axis: Axis = ...,
bool_only: bool | None = ...,
skipna: bool = ...,
level: Level,
**kwargs,
) -> DataFrame | Series:
...

@doc(NDFrame.any, **_shared_doc_kwargs)
def any(
self: DataFrame,
*,
axis: Axis = 0,
bool_only: bool | None = None,
skipna: bool = True,
level: Level | None = None,
**kwargs,
) -> DataFrame | Series:
...

@doc(
_shared_docs["transform"],
klass=_shared_doc_kwargs["klass"],
Expand Down
36 changes: 36 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4397,6 +4397,42 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):

agg = aggregate

@overload
def any(
self: Series,
*,
axis: Axis = ...,
bool_only: bool | None = ...,
skipna: bool = ...,
level: None = ...,
**kwargs,
) -> bool:
...

@overload
def any(
self: Series,
*,
axis: Axis = ...,
bool_only: bool | None = ...,
skipna: bool = ...,
level: Level,
**kwargs,
) -> Series | bool:
...

@doc(NDFrame.any, **_shared_doc_kwargs)
def any(
self: Series,
*,
axis: Axis = 0,
bool_only: bool | None = None,
skipna: bool = True,
level: Level | None = None,
**kwargs,
) -> Series | bool:
...

@doc(
_shared_docs["transform"],
klass=_shared_doc_kwargs["klass"],
Expand Down