Skip to content

Commit 4d9439e

Browse files
authored
TYP: tighten return type in function any (#46638)
1 parent 98a8829 commit 4d9439e

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

pandas/core/frame.py

+36
Original file line numberDiff line numberDiff line change
@@ -8988,6 +8988,42 @@ def aggregate(self, func=None, axis: Axis = 0, *args, **kwargs):
89888988

89898989
agg = aggregate
89908990

8991+
# error: Signature of "any" incompatible with supertype "NDFrame" [override]
8992+
@overload # type: ignore[override]
8993+
def any(
8994+
self,
8995+
*,
8996+
axis: Axis = ...,
8997+
bool_only: bool | None = ...,
8998+
skipna: bool = ...,
8999+
level: None = ...,
9000+
**kwargs,
9001+
) -> Series:
9002+
...
9003+
9004+
@overload
9005+
def any(
9006+
self,
9007+
*,
9008+
axis: Axis = ...,
9009+
bool_only: bool | None = ...,
9010+
skipna: bool = ...,
9011+
level: Level,
9012+
**kwargs,
9013+
) -> DataFrame | Series:
9014+
...
9015+
9016+
@doc(NDFrame.any, **_shared_doc_kwargs)
9017+
def any(
9018+
self,
9019+
axis: Axis = 0,
9020+
bool_only: bool | None = None,
9021+
skipna: bool = True,
9022+
level: Level | None = None,
9023+
**kwargs,
9024+
) -> DataFrame | Series:
9025+
...
9026+
89919027
@doc(
89929028
_shared_docs["transform"],
89939029
klass=_shared_doc_kwargs["klass"],

pandas/core/series.py

+36
Original file line numberDiff line numberDiff line change
@@ -4397,6 +4397,42 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):
43974397

43984398
agg = aggregate
43994399

4400+
# error: Signature of "any" incompatible with supertype "NDFrame" [override]
4401+
@overload # type: ignore[override]
4402+
def any(
4403+
self,
4404+
*,
4405+
axis: Axis = ...,
4406+
bool_only: bool | None = ...,
4407+
skipna: bool = ...,
4408+
level: None = ...,
4409+
**kwargs,
4410+
) -> bool:
4411+
...
4412+
4413+
@overload
4414+
def any(
4415+
self,
4416+
*,
4417+
axis: Axis = ...,
4418+
bool_only: bool | None = ...,
4419+
skipna: bool = ...,
4420+
level: Level,
4421+
**kwargs,
4422+
) -> Series | bool:
4423+
...
4424+
4425+
@doc(NDFrame.any, **_shared_doc_kwargs)
4426+
def any(
4427+
self,
4428+
axis: Axis = 0,
4429+
bool_only: bool | None = None,
4430+
skipna: bool = True,
4431+
level: Level | None = None,
4432+
**kwargs,
4433+
) -> Series | bool:
4434+
...
4435+
44004436
@doc(
44014437
_shared_docs["transform"],
44024438
klass=_shared_doc_kwargs["klass"],

0 commit comments

Comments
 (0)