Skip to content

Commit e8c6a89

Browse files
committed
wip
1 parent 5a6d866 commit e8c6a89

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

pandas-stubs/core/indexes/base.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -475,19 +475,15 @@ class Index(IndexOpsMixin[S1, A1_co, GenericT_co], ElementOpsMixin[S1]):
475475
@overload
476476
def where(
477477
self,
478-
cond: (
479-
Sequence[bool] | np_ndarray_bool | BooleanArray | IndexOpsMixin[bool, A1_co]
480-
),
481-
other: S1 | Series[S1, A1_co] | Self,
478+
cond: Sequence[bool] | np_ndarray_bool | BooleanArray | IndexOpsMixin[bool],
479+
other: S1 | Series[S1] | Self,
482480
) -> Self: ...
483481
@overload
484482
def where(
485483
self,
486-
cond: (
487-
Sequence[bool] | np_ndarray_bool | BooleanArray | IndexOpsMixin[bool, A1_co]
488-
),
484+
cond: Sequence[bool] | np_ndarray_bool | BooleanArray | IndexOpsMixin[bool],
489485
other: Scalar | AnyArrayLike | None = None,
490-
) -> Index[Any, A1_co]: ...
486+
) -> Index: ...
491487
def __contains__(self, key: Hashable) -> bool: ...
492488
@final
493489
def __setitem__(self, key, value) -> None: ...

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ from pandas import (
2020
TimedeltaIndex,
2121
Timestamp,
2222
)
23+
from pandas.core.arrays.datetimes import DatetimeArray
2324
from pandas.core.indexes.accessors import DatetimeIndexProperties
2425
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
2526
from pandas.core.series import Series
2627
from typing_extensions import Self
2728

2829
from pandas._typing import (
29-
A1_co,
3030
AxesData,
3131
DateAndDatetimeLike,
3232
Dtype,
@@ -44,7 +44,8 @@ from pandas.core.dtypes.dtypes import DatetimeTZDtype
4444
from pandas.tseries.offsets import BaseOffset
4545

4646
class DatetimeIndex(
47-
DatetimeTimedeltaMixin[Timestamp, A1_co, np.datetime64], DatetimeIndexProperties
47+
DatetimeTimedeltaMixin[Timestamp, DatetimeArray, np.datetime64],
48+
DatetimeIndexProperties,
4849
):
4950
def __new__(
5051
cls,

pandas-stubs/core/indexes/interval.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ from pandas._typing import (
2525
Frequency,
2626
IntervalClosedType,
2727
IntervalT,
28+
Just,
2829
Label,
2930
MaskType,
3031
np_1darray,
@@ -44,7 +45,7 @@ _EdgesInt: TypeAlias = (
4445
| Index[int]
4546
)
4647
_EdgesFloat: TypeAlias = (
47-
Sequence[float] | npt.NDArray[np.float64] | pd.Series[float] | Index[float]
48+
Sequence[Just[float]] | npt.NDArray[np.float64] | pd.Series[float] | Index[float]
4849
)
4950
_EdgesTimestamp: TypeAlias = (
5051
Sequence[DatetimeLike]
@@ -77,7 +78,7 @@ class IntervalIndex(
7778
) -> IntervalIndex[IntervalT]: ...
7879
@overload
7980
@classmethod
80-
def from_breaks( # pyright: ignore[reportOverlappingOverload]
81+
def from_breaks(
8182
cls,
8283
breaks: _EdgesInt,
8384
closed: IntervalClosedType = ...,
@@ -117,7 +118,7 @@ class IntervalIndex(
117118
) -> IntervalIndex[Interval[pd.Timedelta]]: ...
118119
@overload
119120
@classmethod
120-
def from_arrays( # pyright: ignore[reportOverlappingOverload]
121+
def from_arrays(
121122
cls,
122123
left: _EdgesInt,
123124
right: _EdgesInt,

pandas-stubs/core/indexes/timedeltas.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from typing import (
1111
)
1212

1313
import numpy as np
14+
from pandas.core.arrays.timedeltas import TimedeltaArray
1415
from pandas.core.indexes.accessors import TimedeltaIndexProperties
1516
from pandas.core.indexes.base import Index
1617
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
@@ -26,7 +27,6 @@ from pandas._libs import Timedelta
2627
from pandas._libs.tslibs import BaseOffset
2728
from pandas._libs.tslibs.period import Period
2829
from pandas._typing import (
29-
A1_co,
3030
AxesData,
3131
Frequency,
3232
Just,
@@ -53,7 +53,8 @@ _DT_FACTOR: TypeAlias = dt.timedelta | np.timedelta64 | Timedelta
5353
_DT_FACTOR_SEQ: TypeAlias = _DT_FACTOR | Sequence[_DT_FACTOR] | np_ndarray_td
5454

5555
class TimedeltaIndex(
56-
DatetimeTimedeltaMixin[Timedelta, A1_co, np.timedelta64], TimedeltaIndexProperties
56+
DatetimeTimedeltaMixin[Timedelta, TimedeltaArray, np.timedelta64],
57+
TimedeltaIndexProperties,
5758
):
5859
def __new__(
5960
cls,

tests/indexes/test_indexes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ def test_index_where() -> None:
15551555
val_idx = idx.where(mask, idx)
15561556
check(assert_type(val_idx, "pd.Index[int]"), pd.Index, int)
15571557

1558-
val_sr = idx.where(mask, (idx).to_series())
1558+
val_sr = idx.where(mask, idx.to_series())
15591559
check(assert_type(val_sr, "pd.Index[int]"), pd.Index, int)
15601560

15611561

0 commit comments

Comments
 (0)