From c24eeb068a845ca0908486ccbf35646c610c9fd8 Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Mon, 2 Jan 2023 16:25:28 -0500 Subject: [PATCH 1/4] split Series[IntervalT] into separate __new__ --- pandas-stubs/core/series.pyi | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 79961bd3b..c56527bb6 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -70,6 +70,7 @@ from typing_extensions import ( ) import xarray as xr +from pandas._libs.interval import Interval from pandas._libs.missing import NAType from pandas._libs.tslibs import BaseOffset from pandas._typing import ( @@ -94,7 +95,6 @@ from pandas._typing import ( IgnoreRaise, IndexingInt, IntervalClosedType, - IntervalT, JoinHow, JsonSeriesOrient, Level, @@ -216,13 +216,43 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def __new__( cls, - data: IntervalIndex[IntervalT], + data: IntervalIndex[Interval[int]], index: Axes | None = ..., dtype=..., name: Hashable | None = ..., copy: bool = ..., fastpath: bool = ..., - ) -> Series[IntervalT]: ... + ) -> Series[Interval[int]]: ... + @overload + def __new__( + cls, + data: IntervalIndex[Interval[float]], + index: Axes | None = ..., + dtype=..., + name: Hashable | None = ..., + copy: bool = ..., + fastpath: bool = ..., + ) -> Series[Interval[float]]: ... + @overload + def __new__( + cls, + data: IntervalIndex[Interval[Timestamp]], + index: Axes | None = ..., + dtype=..., + name: Hashable | None = ..., + copy: bool = ..., + fastpath: bool = ..., + ) -> Series[Interval[Timestamp]]: ... + @overload + def __new__( + cls, + data: IntervalIndex[Interval[Timedelta]], + index: Axes | None = ..., + dtype=..., + name: Hashable | None = ..., + copy: bool = ..., + fastpath: bool = ..., + ) -> Series[Interval[Timedelta]]: ... @overload def __new__( cls, From a7bdb6c9b02f38100c984a542903a561be9fcd9c Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Tue, 3 Jan 2023 11:35:36 -0500 Subject: [PATCH 2/4] update poethepoet version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3d5d32d6c..ae8feee88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "0.991" pyarrow = ">=10.0.1" pytest = ">=7.1.2" pyright = ">=1.1.286" -poethepoet = "0.16.0" +poethepoet = ">=0.16.5" loguru = ">=0.6.0" pandas = "1.5.2" numpy = "<=1.23.5" From 8ad5130d46d5085e90779bc135e8634803353290 Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Tue, 3 Jan 2023 16:52:07 -0500 Subject: [PATCH 3/4] put back Series.__new__() sing IntervalT --- pandas-stubs/core/series.pyi | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index fdf5cd3e6..370290350 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -96,6 +96,7 @@ from pandas._typing import ( IgnoreRaise, IndexingInt, IntervalClosedType, + IntervalT, JoinHow, JsonSeriesOrient, Level, @@ -217,43 +218,13 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def __new__( cls, - data: IntervalIndex[Interval[int]], + data: IntervalIndex[IntervalT], index: Axes | None = ..., dtype=..., name: Hashable | None = ..., copy: bool = ..., fastpath: bool = ..., - ) -> Series[Interval[int]]: ... - @overload - def __new__( - cls, - data: IntervalIndex[Interval[float]], - index: Axes | None = ..., - dtype=..., - name: Hashable | None = ..., - copy: bool = ..., - fastpath: bool = ..., - ) -> Series[Interval[float]]: ... - @overload - def __new__( - cls, - data: IntervalIndex[Interval[Timestamp]], - index: Axes | None = ..., - dtype=..., - name: Hashable | None = ..., - copy: bool = ..., - fastpath: bool = ..., - ) -> Series[Interval[Timestamp]]: ... - @overload - def __new__( - cls, - data: IntervalIndex[Interval[Timedelta]], - index: Axes | None = ..., - dtype=..., - name: Hashable | None = ..., - copy: bool = ..., - fastpath: bool = ..., - ) -> Series[Interval[Timedelta]]: ... + ) -> Series[IntervalT]: ... @overload def __new__( cls, From bccff1e155d21e2eceeee069453839f6a4d41161 Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Tue, 3 Jan 2023 16:53:18 -0500 Subject: [PATCH 4/4] remove import of Interval --- pandas-stubs/core/series.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 370290350..573694191 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -71,7 +71,6 @@ from typing_extensions import ( ) import xarray as xr -from pandas._libs.interval import Interval from pandas._libs.missing import NAType from pandas._libs.tslibs import BaseOffset from pandas._typing import (