Skip to content

remove 1.5 tests and types #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ from .core.api import (
DatetimeTZDtype as DatetimeTZDtype,
Float32Dtype as Float32Dtype,
Float64Dtype as Float64Dtype,
Float64Index as Float64Index,
Grouper as Grouper,
Index as Index,
IndexSlice as IndexSlice,
Int8Dtype as Int8Dtype,
Int16Dtype as Int16Dtype,
Int32Dtype as Int32Dtype,
Int64Dtype as Int64Dtype,
Int64Index as Int64Index,
Interval as Interval,
IntervalDtype as IntervalDtype,
IntervalIndex as IntervalIndex,
Expand All @@ -57,7 +55,6 @@ from .core.api import (
UInt16Dtype as UInt16Dtype,
UInt32Dtype as UInt32Dtype,
UInt64Dtype as UInt64Dtype,
UInt64Index as UInt64Index,
array as array,
bdate_range as bdate_range,
date_range as date_range,
Expand Down
18 changes: 11 additions & 7 deletions pandas-stubs/_libs/tslibs/timedeltas.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import numpy as np
import pandas as pd
from pandas import (
DatetimeIndex,
Float64Index,
Int64Index,
PeriodIndex,
Series,
TimedeltaIndex,
)
from pandas.core.indexes.base import (
_FloatIndexType,
_IntIndexType,
)
from pandas.core.series import (
TimedeltaSeries,
TimestampSeries,
Expand Down Expand Up @@ -243,7 +245,7 @@ class Timedelta(timedelta):
@overload
def __mul__(self, other: Series[float]) -> TimedeltaSeries: ...
@overload
def __mul__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
def __mul__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
@overload
def __rmul__(self, other: float) -> Timedelta: ...
@overload
Expand All @@ -253,7 +255,7 @@ class Timedelta(timedelta):
@overload
def __rmul__(self, other: Series[float]) -> TimedeltaSeries: ...
@overload
def __rmul__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
def __rmul__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
# Override due to more types supported than dt.timedelta
# error: Signature of "__floordiv__" incompatible with supertype "timedelta"
@overload # type: ignore[override]
Expand All @@ -269,7 +271,9 @@ class Timedelta(timedelta):
self, other: npt.NDArray[np.timedelta64]
) -> npt.NDArray[np.int_]: ...
@overload
def __floordiv__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
def __floordiv__(
self, other: _IntIndexType | _FloatIndexType
) -> TimedeltaIndex: ...
@overload
def __floordiv__(self, other: Series[int]) -> TimedeltaSeries: ...
@overload
Expand Down Expand Up @@ -302,7 +306,7 @@ class Timedelta(timedelta):
@overload
def __truediv__(self, other: Series[float]) -> TimedeltaSeries: ...
@overload
def __truediv__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
def __truediv__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
def __rtruediv__(self, other: timedelta | Timedelta | NaTType) -> float: ...
# Override due to more types supported than dt.timedelta
@overload
Expand Down Expand Up @@ -334,7 +338,7 @@ class Timedelta(timedelta):
@overload
def __mod__(self, other: Series[int] | Series[float]) -> TimedeltaSeries: ...
@overload
def __mod__(self, other: Int64Index | Float64Index) -> TimedeltaIndex: ...
def __mod__(self, other: _IntIndexType | _FloatIndexType) -> TimedeltaIndex: ...
@overload
def __mod__(
self, other: npt.NDArray[np.integer] | npt.NDArray[np.floating]
Expand Down
3 changes: 0 additions & 3 deletions pandas-stubs/core/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ from pandas.core.groupby import (
from pandas.core.indexes.api import (
CategoricalIndex as CategoricalIndex,
DatetimeIndex as DatetimeIndex,
Float64Index as Float64Index,
Index as Index,
Int64Index as Int64Index,
IntervalIndex as IntervalIndex,
MultiIndex as MultiIndex,
PeriodIndex as PeriodIndex,
RangeIndex as RangeIndex,
TimedeltaIndex as TimedeltaIndex,
UInt64Index as UInt64Index,
)
from pandas.core.indexes.datetimes import (
bdate_range as bdate_range,
Expand Down
12 changes: 6 additions & 6 deletions pandas-stubs/core/indexes/accessors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ from pandas.core.base import (
PandasObject,
)
from pandas.core.frame import DataFrame
from pandas.core.indexes.numeric import NumericIndex
from pandas.core.indexes.base import _IntIndexType
from pandas.core.series import (
PeriodSeries,
Series,
Expand All @@ -43,14 +43,14 @@ from pandas._typing import (
class Properties(PandasDelegate, PandasObject, NoNewAttributesMixin):
def __init__(self, data: Series, orig) -> None: ...

_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], NumericIndex)
_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], _IntIndexType)

class _DatetimeFieldOps(
_DayLikeFieldOps[_DTFieldOpsReturnType], _MiniSeconds[_DTFieldOpsReturnType]
): ...
class PeriodIndexFieldOps(
_DayLikeFieldOps[NumericIndex],
_PeriodProperties[DatetimeIndex, NumericIndex, Index, DatetimeIndex, PeriodIndex],
_DayLikeFieldOps[_IntIndexType],
_PeriodProperties[DatetimeIndex, _IntIndexType, Index, DatetimeIndex, PeriodIndex],
): ...

class _DayLikeFieldOps(Generic[_DTFieldOpsReturnType]):
Expand Down Expand Up @@ -306,7 +306,7 @@ class TimedeltaProperties(
): ...

_PeriodDTReturnTypes = TypeVar("_PeriodDTReturnTypes", TimestampSeries, DatetimeIndex)
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], NumericIndex)
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], _IntIndexType)
_PeriodStrReturnTypes = TypeVar("_PeriodStrReturnTypes", Series[str], Index)
_PeriodDTAReturnTypes = TypeVar("_PeriodDTAReturnTypes", DatetimeArray, DatetimeIndex)
_PeriodPAReturnTypes = TypeVar("_PeriodPAReturnTypes", PeriodArray, PeriodIndex)
Expand Down Expand Up @@ -382,7 +382,7 @@ class TimestampProperties(
class DatetimeIndexProperties(
Properties,
_DatetimeNoTZProperties[
NumericIndex,
_IntIndexType,
np_ndarray_bool,
DatetimeIndex,
np.ndarray,
Expand Down
6 changes: 0 additions & 6 deletions pandas-stubs/core/indexes/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ from pandas.core.indexes.category import CategoricalIndex as CategoricalIndex
from pandas.core.indexes.datetimes import DatetimeIndex as DatetimeIndex
from pandas.core.indexes.interval import IntervalIndex as IntervalIndex
from pandas.core.indexes.multi import MultiIndex as MultiIndex
from pandas.core.indexes.numeric import (
Float64Index as Float64Index,
Int64Index as Int64Index,
NumericIndex as NumericIndex,
UInt64Index as UInt64Index,
)
from pandas.core.indexes.period import PeriodIndex as PeriodIndex
from pandas.core.indexes.range import RangeIndex as RangeIndex
from pandas.core.indexes.timedeltas import TimedeltaIndex as TimedeltaIndex
Expand Down
41 changes: 38 additions & 3 deletions pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ from pandas.core.base import (
IndexOpsMixin,
PandasObject,
)
from pandas.core.indexes.numeric import NumericIndex
from pandas.core.strings import StringMethods
from typing_extensions import (
Never,
Expand Down Expand Up @@ -74,12 +73,32 @@ class Index(IndexOpsMixin, PandasObject):
def __new__(
cls,
data: Iterable,
dtype: Literal["float", "int", "complex"] | type_t[complex] | type_t[np.number],
dtype: Literal["int"] | type_t[int] | type_t[np.int_],
copy: bool = ...,
name=...,
tupleize_cols: bool = ...,
**kwargs,
) -> NumericIndex: ...
) -> _IntIndexType: ...
@overload
def __new__(
cls,
data: Iterable,
dtype: Literal["float"] | type_t[float] | type_t[np.float_],
copy: bool = ...,
name=...,
tupleize_cols: bool = ...,
**kwargs,
) -> _FloatIndexType: ...
@overload
def __new__(
cls,
data: Iterable,
dtype: Literal["complex"] | type_t[complex],
copy: bool = ...,
name=...,
tupleize_cols: bool = ...,
**kwargs,
) -> _ComplexIndexType: ...
@overload
def __new__(
cls,
Expand Down Expand Up @@ -260,3 +279,19 @@ def ensure_index_from_sequences(
) -> Index: ...
def ensure_index(index_like: Sequence | Index, copy: bool = ...) -> Index: ...
def maybe_extract_name(name, obj, cls) -> Label: ...

class _NumericIndexType(Index):
def __add__(self, other: _NumericIndexType | complex) -> Self: ...
def __radd__(self, other: _NumericIndexType | complex) -> Self: ...
def __sub__(self, other: _NumericIndexType | complex) -> Self: ...
def __rsub__(self, other: _NumericIndexType | complex) -> Self: ...
def __mul__(self, other: _NumericIndexType | complex) -> Self: ...
def __rmul__(self, other: _NumericIndexType | complex) -> Self: ...
def __truediv__(self, other: _NumericIndexType | complex) -> Self: ...
def __rtruediv__(self, other: _NumericIndexType | complex) -> Self: ...
def __floordiv__(self, other: _NumericIndexType | complex) -> Self: ...
def __rfloordiv__(self, other: _NumericIndexType | complex) -> Self: ...

class _FloatIndexType(_NumericIndexType): ...
class _IntIndexType(_NumericIndexType): ...
class _ComplexIndexType(_NumericIndexType): ...
8 changes: 5 additions & 3 deletions pandas-stubs/core/indexes/datetimes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ from pandas import (
Timestamp,
)
from pandas.core.indexes.accessors import DatetimeIndexProperties
from pandas.core.indexes.api import Float64Index
from pandas.core.indexes.base import _IndexGetitemMixin
from pandas.core.indexes.base import (
_FloatIndexType,
_IndexGetitemMixin,
)
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
from pandas.core.series import (
TimedeltaSeries,
Expand Down Expand Up @@ -86,7 +88,7 @@ class DatetimeIndex( # type: ignore[misc]
self, start_time, end_time, include_start: bool = ..., include_end: bool = ...
): ...
def to_perioddelta(self, freq) -> TimedeltaIndex: ...
def to_julian_date(self) -> Float64Index: ...
def to_julian_date(self) -> _FloatIndexType: ...
def isocalendar(self) -> DataFrame: ...
@property
def tzinfo(self) -> tzinfo | None: ...
Expand Down
8 changes: 6 additions & 2 deletions pandas-stubs/core/indexes/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ from typing import (
import numpy as np
import pandas as pd
from pandas import Index
from pandas.core.indexes.base import (
_FloatIndexType,
_IntIndexType,
)
from pandas.core.indexes.extension import ExtensionIndex
from pandas.core.series import (
Series,
Expand Down Expand Up @@ -46,10 +50,10 @@ _EdgesInt: TypeAlias = (
| npt.NDArray[np.int32]
| npt.NDArray[np.intp]
| pd.Series[int]
| pd.Int64Index
| _IntIndexType
)
_EdgesFloat: TypeAlias = (
Sequence[float] | npt.NDArray[np.float64] | pd.Series[float] | pd.Float64Index
Sequence[float] | npt.NDArray[np.float64] | pd.Series[float] | _FloatIndexType
)
_EdgesTimestamp: TypeAlias = (
Sequence[DatetimeLike]
Expand Down
42 changes: 0 additions & 42 deletions pandas-stubs/core/indexes/numeric.pyi

This file was deleted.

10 changes: 6 additions & 4 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ from typing import overload

import numpy as np
from pandas import Series
from pandas.core.indexes.base import Index
from pandas.core.indexes.numeric import Int64Index
from pandas.core.indexes.base import (
Index,
_IntIndexType,
)

from pandas._typing import (
HashableT,
Expand All @@ -13,7 +15,7 @@ from pandas._typing import (
npt,
)

class RangeIndex(Int64Index):
class RangeIndex(_IntIndexType):
def __new__(
cls,
start: int | RangeIndex = ...,
Expand Down Expand Up @@ -81,7 +83,7 @@ class RangeIndex(Int64Index):
def any(self) -> bool: ...
def union(
self, other: list[HashableT] | Index, sort=...
) -> Index | Int64Index | RangeIndex: ...
) -> Index | _IntIndexType | RangeIndex: ...
@overload # type: ignore[override]
def __getitem__(
self,
Expand Down
Loading