Skip to content

Commit 9c301b3

Browse files
authored
remove 1.5 tests and types (#626)
* remove 1.5 tests and types * add back 2 tests deleted by mistake
1 parent 6819e32 commit 9c301b3

20 files changed

+216
-357
lines changed

pandas-stubs/__init__.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ from .core.api import (
2929
DatetimeTZDtype as DatetimeTZDtype,
3030
Float32Dtype as Float32Dtype,
3131
Float64Dtype as Float64Dtype,
32-
Float64Index as Float64Index,
3332
Grouper as Grouper,
3433
Index as Index,
3534
IndexSlice as IndexSlice,
3635
Int8Dtype as Int8Dtype,
3736
Int16Dtype as Int16Dtype,
3837
Int32Dtype as Int32Dtype,
3938
Int64Dtype as Int64Dtype,
40-
Int64Index as Int64Index,
4139
Interval as Interval,
4240
IntervalDtype as IntervalDtype,
4341
IntervalIndex as IntervalIndex,
@@ -57,7 +55,6 @@ from .core.api import (
5755
UInt16Dtype as UInt16Dtype,
5856
UInt32Dtype as UInt32Dtype,
5957
UInt64Dtype as UInt64Dtype,
60-
UInt64Index as UInt64Index,
6158
array as array,
6259
bdate_range as bdate_range,
6360
date_range as date_range,

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import numpy as np
1111
import pandas as pd
1212
from pandas import (
1313
DatetimeIndex,
14-
Float64Index,
15-
Int64Index,
1614
PeriodIndex,
1715
Series,
1816
TimedeltaIndex,
1917
)
18+
from pandas.core.indexes.base import (
19+
_FloatIndexType,
20+
_IntIndexType,
21+
)
2022
from pandas.core.series import (
2123
TimedeltaSeries,
2224
TimestampSeries,
@@ -243,7 +245,7 @@ class Timedelta(timedelta):
243245
@overload
244246
def __mul__(self, other: Series[float]) -> TimedeltaSeries: ...
245247
@overload
246-
def __mul__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
248+
def __mul__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
247249
@overload
248250
def __rmul__(self, other: float) -> Timedelta: ...
249251
@overload
@@ -253,7 +255,7 @@ class Timedelta(timedelta):
253255
@overload
254256
def __rmul__(self, other: Series[float]) -> TimedeltaSeries: ...
255257
@overload
256-
def __rmul__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
258+
def __rmul__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
257259
# Override due to more types supported than dt.timedelta
258260
# error: Signature of "__floordiv__" incompatible with supertype "timedelta"
259261
@overload # type: ignore[override]
@@ -269,7 +271,9 @@ class Timedelta(timedelta):
269271
self, other: npt.NDArray[np.timedelta64]
270272
) -> npt.NDArray[np.int_]: ...
271273
@overload
272-
def __floordiv__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
274+
def __floordiv__(
275+
self, other: _IntIndexType | _FloatIndexType
276+
) -> TimedeltaIndex: ...
273277
@overload
274278
def __floordiv__(self, other: Series[int]) -> TimedeltaSeries: ...
275279
@overload
@@ -302,7 +306,7 @@ class Timedelta(timedelta):
302306
@overload
303307
def __truediv__(self, other: Series[float]) -> TimedeltaSeries: ...
304308
@overload
305-
def __truediv__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
309+
def __truediv__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
306310
def __rtruediv__(self, other: timedelta | Timedelta | NaTType) -> float: ...
307311
# Override due to more types supported than dt.timedelta
308312
@overload
@@ -334,7 +338,7 @@ class Timedelta(timedelta):
334338
@overload
335339
def __mod__(self, other: Series[int] | Series[float]) -> TimedeltaSeries: ...
336340
@overload
337-
def __mod__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
341+
def __mod__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
338342
@overload
339343
def __mod__(
340344
self, other: npt.NDArray[np.integer] | npt.NDArray[np.floating]

pandas-stubs/core/api.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ from pandas.core.groupby import (
3030
from pandas.core.indexes.api import (
3131
CategoricalIndex as CategoricalIndex,
3232
DatetimeIndex as DatetimeIndex,
33-
Float64Index as Float64Index,
3433
Index as Index,
35-
Int64Index as Int64Index,
3634
IntervalIndex as IntervalIndex,
3735
MultiIndex as MultiIndex,
3836
PeriodIndex as PeriodIndex,
3937
RangeIndex as RangeIndex,
4038
TimedeltaIndex as TimedeltaIndex,
41-
UInt64Index as UInt64Index,
4239
)
4340
from pandas.core.indexes.datetimes import (
4441
bdate_range as bdate_range,

pandas-stubs/core/indexes/accessors.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ from pandas.core.base import (
2525
PandasObject,
2626
)
2727
from pandas.core.frame import DataFrame
28-
from pandas.core.indexes.numeric import NumericIndex
28+
from pandas.core.indexes.base import _IntIndexType
2929
from pandas.core.series import (
3030
PeriodSeries,
3131
Series,
@@ -43,14 +43,14 @@ from pandas._typing import (
4343
class Properties(PandasDelegate, PandasObject, NoNewAttributesMixin):
4444
def __init__(self, data: Series, orig) -> None: ...
4545

46-
_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], NumericIndex)
46+
_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], _IntIndexType)
4747

4848
class _DatetimeFieldOps(
4949
_DayLikeFieldOps[_DTFieldOpsReturnType], _MiniSeconds[_DTFieldOpsReturnType]
5050
): ...
5151
class PeriodIndexFieldOps(
52-
_DayLikeFieldOps[NumericIndex],
53-
_PeriodProperties[DatetimeIndex, NumericIndex, Index, DatetimeIndex, PeriodIndex],
52+
_DayLikeFieldOps[_IntIndexType],
53+
_PeriodProperties[DatetimeIndex, _IntIndexType, Index, DatetimeIndex, PeriodIndex],
5454
): ...
5555

5656
class _DayLikeFieldOps(Generic[_DTFieldOpsReturnType]):
@@ -306,7 +306,7 @@ class TimedeltaProperties(
306306
): ...
307307

308308
_PeriodDTReturnTypes = TypeVar("_PeriodDTReturnTypes", TimestampSeries, DatetimeIndex)
309-
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], NumericIndex)
309+
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], _IntIndexType)
310310
_PeriodStrReturnTypes = TypeVar("_PeriodStrReturnTypes", Series[str], Index)
311311
_PeriodDTAReturnTypes = TypeVar("_PeriodDTAReturnTypes", DatetimeArray, DatetimeIndex)
312312
_PeriodPAReturnTypes = TypeVar("_PeriodPAReturnTypes", PeriodArray, PeriodIndex)
@@ -382,7 +382,7 @@ class TimestampProperties(
382382
class DatetimeIndexProperties(
383383
Properties,
384384
_DatetimeNoTZProperties[
385-
NumericIndex,
385+
_IntIndexType,
386386
np_ndarray_bool,
387387
DatetimeIndex,
388388
np.ndarray,

pandas-stubs/core/indexes/api.pyi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ from pandas.core.indexes.category import CategoricalIndex as CategoricalIndex
33
from pandas.core.indexes.datetimes import DatetimeIndex as DatetimeIndex
44
from pandas.core.indexes.interval import IntervalIndex as IntervalIndex
55
from pandas.core.indexes.multi import MultiIndex as MultiIndex
6-
from pandas.core.indexes.numeric import (
7-
Float64Index as Float64Index,
8-
Int64Index as Int64Index,
9-
NumericIndex as NumericIndex,
10-
UInt64Index as UInt64Index,
11-
)
126
from pandas.core.indexes.period import PeriodIndex as PeriodIndex
137
from pandas.core.indexes.range import RangeIndex as RangeIndex
148
from pandas.core.indexes.timedeltas import TimedeltaIndex as TimedeltaIndex

pandas-stubs/core/indexes/base.pyi

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ from pandas.core.base import (
2323
IndexOpsMixin,
2424
PandasObject,
2525
)
26-
from pandas.core.indexes.numeric import NumericIndex
2726
from pandas.core.strings import StringMethods
2827
from typing_extensions import (
2928
Never,
@@ -74,12 +73,32 @@ class Index(IndexOpsMixin, PandasObject):
7473
def __new__(
7574
cls,
7675
data: Iterable,
77-
dtype: Literal["float", "int", "complex"] | type_t[complex] | type_t[np.number],
76+
dtype: Literal["int"] | type_t[int] | type_t[np.int_],
7877
copy: bool = ...,
7978
name=...,
8079
tupleize_cols: bool = ...,
8180
**kwargs,
82-
) -> NumericIndex: ...
81+
) -> _IntIndexType: ...
82+
@overload
83+
def __new__(
84+
cls,
85+
data: Iterable,
86+
dtype: Literal["float"] | type_t[float] | type_t[np.float_],
87+
copy: bool = ...,
88+
name=...,
89+
tupleize_cols: bool = ...,
90+
**kwargs,
91+
) -> _FloatIndexType: ...
92+
@overload
93+
def __new__(
94+
cls,
95+
data: Iterable,
96+
dtype: Literal["complex"] | type_t[complex],
97+
copy: bool = ...,
98+
name=...,
99+
tupleize_cols: bool = ...,
100+
**kwargs,
101+
) -> _ComplexIndexType: ...
83102
@overload
84103
def __new__(
85104
cls,
@@ -260,3 +279,19 @@ def ensure_index_from_sequences(
260279
) -> Index: ...
261280
def ensure_index(index_like: Sequence | Index, copy: bool = ...) -> Index: ...
262281
def maybe_extract_name(name, obj, cls) -> Label: ...
282+
283+
class _NumericIndexType(Index):
284+
def __add__(self, other: _NumericIndexType | complex) -> Self: ...
285+
def __radd__(self, other: _NumericIndexType | complex) -> Self: ...
286+
def __sub__(self, other: _NumericIndexType | complex) -> Self: ...
287+
def __rsub__(self, other: _NumericIndexType | complex) -> Self: ...
288+
def __mul__(self, other: _NumericIndexType | complex) -> Self: ...
289+
def __rmul__(self, other: _NumericIndexType | complex) -> Self: ...
290+
def __truediv__(self, other: _NumericIndexType | complex) -> Self: ...
291+
def __rtruediv__(self, other: _NumericIndexType | complex) -> Self: ...
292+
def __floordiv__(self, other: _NumericIndexType | complex) -> Self: ...
293+
def __rfloordiv__(self, other: _NumericIndexType | complex) -> Self: ...
294+
295+
class _FloatIndexType(_NumericIndexType): ...
296+
class _IntIndexType(_NumericIndexType): ...
297+
class _ComplexIndexType(_NumericIndexType): ...

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ from pandas import (
1616
Timestamp,
1717
)
1818
from pandas.core.indexes.accessors import DatetimeIndexProperties
19-
from pandas.core.indexes.api import Float64Index
20-
from pandas.core.indexes.base import _IndexGetitemMixin
19+
from pandas.core.indexes.base import (
20+
_FloatIndexType,
21+
_IndexGetitemMixin,
22+
)
2123
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
2224
from pandas.core.series import (
2325
TimedeltaSeries,
@@ -86,7 +88,7 @@ class DatetimeIndex( # type: ignore[misc]
8688
self, start_time, end_time, include_start: bool = ..., include_end: bool = ...
8789
): ...
8890
def to_perioddelta(self, freq) -> TimedeltaIndex: ...
89-
def to_julian_date(self) -> Float64Index: ...
91+
def to_julian_date(self) -> _FloatIndexType: ...
9092
def isocalendar(self) -> DataFrame: ...
9193
@property
9294
def tzinfo(self) -> tzinfo | None: ...

pandas-stubs/core/indexes/interval.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ from typing import (
1212
import numpy as np
1313
import pandas as pd
1414
from pandas import Index
15+
from pandas.core.indexes.base import (
16+
_FloatIndexType,
17+
_IntIndexType,
18+
)
1519
from pandas.core.indexes.extension import ExtensionIndex
1620
from pandas.core.series import (
1721
Series,
@@ -46,10 +50,10 @@ _EdgesInt: TypeAlias = (
4650
| npt.NDArray[np.int32]
4751
| npt.NDArray[np.intp]
4852
| pd.Series[int]
49-
| pd.Int64Index
53+
| _IntIndexType
5054
)
5155
_EdgesFloat: TypeAlias = (
52-
Sequence[float] | npt.NDArray[np.float64] | pd.Series[float] | pd.Float64Index
56+
Sequence[float] | npt.NDArray[np.float64] | pd.Series[float] | _FloatIndexType
5357
)
5458
_EdgesTimestamp: TypeAlias = (
5559
Sequence[DatetimeLike]

pandas-stubs/core/indexes/numeric.pyi

Lines changed: 0 additions & 42 deletions
This file was deleted.

pandas-stubs/core/indexes/range.pyi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ from typing import overload
33

44
import numpy as np
55
from pandas import Series
6-
from pandas.core.indexes.base import Index
7-
from pandas.core.indexes.numeric import Int64Index
6+
from pandas.core.indexes.base import (
7+
Index,
8+
_IntIndexType,
9+
)
810

911
from pandas._typing import (
1012
HashableT,
@@ -13,7 +15,7 @@ from pandas._typing import (
1315
npt,
1416
)
1517

16-
class RangeIndex(Int64Index):
18+
class RangeIndex(_IntIndexType):
1719
def __new__(
1820
cls,
1921
start: int | RangeIndex = ...,
@@ -81,7 +83,7 @@ class RangeIndex(Int64Index):
8183
def any(self) -> bool: ...
8284
def union(
8385
self, other: list[HashableT] | Index, sort=...
84-
) -> Index | Int64Index | RangeIndex: ...
86+
) -> Index | _IntIndexType | RangeIndex: ...
8587
@overload # type: ignore[override]
8688
def __getitem__(
8789
self,

0 commit comments

Comments
 (0)