Skip to content

Commit d5a070a

Browse files
committed
simplify
1 parent 4e633e5 commit d5a070a

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

pandas-stubs/_libs/tslibs/timestamps.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from pandas import (
2121
DatetimeIndex,
2222
TimedeltaIndex,
2323
)
24-
from pandas.core.indexes.base import UnknownIndex
24+
from pandas.core.indexes.base import Index
2525
from pandas.core.series import (
2626
Series,
2727
TimedeltaSeries,
@@ -236,15 +236,15 @@ class Timestamp(datetime, SupportsIndex):
236236
@overload
237237
def __eq__(self, other: TimestampSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
238238
@overload
239-
def __eq__(self, other: npt.NDArray[np.datetime64] | UnknownIndex) -> np_ndarray_bool: ... # type: ignore[overload-overlap]
239+
def __eq__(self, other: npt.NDArray[np.datetime64] | Index) -> np_ndarray_bool: ... # type: ignore[overload-overlap]
240240
@overload
241241
def __eq__(self, other: object) -> Literal[False]: ...
242242
@overload
243243
def __ne__(self, other: Timestamp | datetime | np.datetime64) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
244244
@overload
245245
def __ne__(self, other: TimestampSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
246246
@overload
247-
def __ne__(self, other: npt.NDArray[np.datetime64] | UnknownIndex) -> np_ndarray_bool: ... # type: ignore[overload-overlap]
247+
def __ne__(self, other: npt.NDArray[np.datetime64] | Index) -> np_ndarray_bool: ... # type: ignore[overload-overlap]
248248
@overload
249249
def __ne__(self, other: object) -> Literal[True]: ...
250250
def __hash__(self) -> int: ...

pandas-stubs/core/frame.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ from pandas.core.groupby.generic import DataFrameGroupBy
3131
from pandas.core.indexers import BaseIndexer
3232
from pandas.core.indexes.base import (
3333
Index,
34-
UnknownIndex,
3534
)
3635
from pandas.core.indexes.category import CategoricalIndex
3736
from pandas.core.indexes.datetimes import DatetimeIndex
@@ -1683,7 +1682,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16831682
@property
16841683
def iloc(self) -> _iLocIndexerFrame[Self]: ...
16851684
@property
1686-
def index(self) -> UnknownIndex: ...
1685+
def index(self) -> Index: ...
16871686
@index.setter
16881687
def index(self, idx: Index) -> None: ...
16891688
@property

pandas-stubs/core/indexes/base.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ from typing import (
1313
Any,
1414
ClassVar,
1515
Literal,
16-
TypeAlias,
1716
final,
1817
overload,
1918
)
@@ -475,8 +474,6 @@ class Index(IndexOpsMixin[S1]):
475474
),
476475
) -> Self: ...
477476

478-
UnknownIndex: TypeAlias = Index[Any]
479-
480477
def ensure_index_from_sequences(
481478
sequences: Sequence[Sequence[Dtype]], names: list[str] = ...
482479
) -> Index: ...

pandas-stubs/core/series.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ from pandas.core.indexes.accessors import (
5959
TimedeltaProperties,
6060
TimestampProperties,
6161
)
62-
from pandas.core.indexes.base import UnknownIndex
6362
from pandas.core.indexes.category import CategoricalIndex
6463
from pandas.core.indexes.datetimes import DatetimeIndex
6564
from pandas.core.indexes.interval import IntervalIndex
@@ -732,7 +731,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
732731
@overload
733732
def groupby(
734733
self,
735-
by: CategoricalIndex | UnknownIndex | UnknownSeries,
734+
by: CategoricalIndex | Index | UnknownSeries,
736735
axis: AxisIndex = ...,
737736
level: IndexLabel | None = ...,
738737
as_index: _bool = ...,

tests/test_scalars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ def test_timestamp_cmp() -> None:
12611261
c_np_dt64 = np.datetime64(1, "ns")
12621262
c_dt_datetime = dt.datetime(year=2000, month=1, day=1)
12631263
c_datetimeindex = pd.DatetimeIndex(["2000-1-1"])
1264-
# DatetimeIndex, but the type checker detects it to be UnknownIndex.
1264+
# DatetimeIndex, but the type checker detects it to be Index.
12651265
c_unknown_index = pd.DataFrame({"a": [1]}, index=c_datetimeindex).index
12661266
c_np_ndarray_dt64 = np_dt64_arr
12671267
c_series_dt64: TimestampSeries = pd.Series([1, 2, 3], dtype="datetime64[ns]")
@@ -1421,7 +1421,7 @@ def test_timestamp_eq_ne_rhs() -> None:
14211421
c_np_dt64 = np.datetime64(1, "ns")
14221422
c_dt_datetime = dt.datetime(year=2000, month=1, day=1)
14231423
c_datetimeindex = pd.DatetimeIndex(["2000-1-1"])
1424-
# DatetimeIndex, but the type checker detects it to be UnknownIndex.
1424+
# DatetimeIndex, but the type checker detects it to be Index.
14251425
c_unknown_index = pd.DataFrame({"a": [1]}, index=c_datetimeindex).index
14261426
c_np_ndarray_dt64 = np_dt64_arr
14271427
c_series_dt64: pd.Series[pd.Timestamp] = pd.Series(

0 commit comments

Comments
 (0)