Skip to content

Commit b9288cb

Browse files
committed
unsupported overloads
1 parent eb16bc3 commit b9288cb

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

pandas/core/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,7 @@ def hasnans(self) -> bool:
769769
770770
Enables various performance speedups.
771771
"""
772-
# error: Item "bool" of "Union[bool, ndarray[Any, dtype[bool_]], NDFrame]"
773-
# has no attribute "any"
774-
return bool(isna(self).any()) # type: ignore[union-attr]
772+
return bool(isna(self).any())
775773

776774
def isna(self):
777775
return isna(self._values)

pandas/core/dtypes/missing.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from functools import partial
88
from typing import (
99
TYPE_CHECKING,
10+
Literal,
1011
overload,
1112
)
1213

@@ -66,7 +67,7 @@
6667
npt,
6768
)
6869

69-
from pandas.core.indexes.base import Index
70+
from pandas.core.base import IndexOpsMixin
7071

7172

7273
isposinf_scalar = libmissing.isposinf_scalar
@@ -79,24 +80,27 @@
7980

8081

8182
@overload
82-
def isna(obj: Scalar) -> bool:
83+
def isna(obj: Scalar) -> bool: # type: ignore[misc]
8384
...
8485

8586

8687
@overload
87-
def isna(
88-
obj: ArrayLike | Index | list,
89-
) -> npt.NDArray[np.bool_]:
88+
def isna(obj: ArrayLike | list) -> npt.NDArray[np.bool_]: # type: ignore[misc]
9089
...
9190

9291

9392
@overload
94-
def isna(obj: NDFrameT) -> NDFrameT:
93+
def isna(obj: NDFrameT) -> NDFrameT: # type: ignore[misc]
9594
...
9695

9796

9897
@overload
99-
def isna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame:
98+
def isna(obj: IndexOpsMixin) -> npt.NDArray[np.bool_]: # type: ignore[misc]
99+
...
100+
101+
102+
@overload
103+
def isna(obj: object) -> Literal[False]:
100104
...
101105

102106

@@ -322,24 +326,27 @@ def _isna_string_dtype(values: np.ndarray, inf_as_na: bool) -> npt.NDArray[np.bo
322326

323327

324328
@overload
325-
def notna(obj: Scalar) -> bool:
329+
def notna(obj: Scalar) -> bool: # type: ignore[misc]
326330
...
327331

328332

329333
@overload
330-
def notna(
331-
obj: ArrayLike | Index | list,
332-
) -> npt.NDArray[np.bool_]:
334+
def notna(obj: ArrayLike | list) -> npt.NDArray[np.bool_]: # type: ignore[misc]
333335
...
334336

335337

336338
@overload
337-
def notna(obj: NDFrameT) -> NDFrameT:
339+
def notna(obj: NDFrameT) -> NDFrameT: # type: ignore[misc]
338340
...
339341

340342

341343
@overload
342-
def notna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame:
344+
def notna(obj: IndexOpsMixin) -> npt.NDArray[np.bool_]: # type: ignore[misc]
345+
...
346+
347+
348+
@overload
349+
def notna(obj: object) -> Literal[False]:
343350
...
344351

345352

pandas/core/window/ewm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,8 @@ def __init__(
391391
raise ValueError(
392392
"halflife must be a string or datetime.timedelta object"
393393
)
394-
# error: Item "bool" of "Union[bool, ndarray[Any, dtype[bool_]], NDFrame]"
395-
# has no attribute "any"
396-
if isna(self.times).any(): # type: ignore[union-attr]
394+
# error: "Literal[False]" has no attribute "any"
395+
if isna(self.times).any(): # type: ignore[attr-defined]
397396
raise ValueError("Cannot convert NaT values to integer")
398397
self._deltas = _calculate_deltas(self.times, self.halflife)
399398
# Halflife is no longer applicable when calculating COM

0 commit comments

Comments
 (0)