From 90b2f227da5af02400236473e1f65d54241a143c Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Fri, 22 Aug 2025 11:56:53 +0100 Subject: [PATCH 1/2] remove non-existent `kwargs` from `Index.__new__` --- pandas-stubs/core/indexes/base.pyi | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index 313c3bde..95cb272b 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -89,7 +89,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[int]: ... @overload def __new__( @@ -100,7 +99,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[int]: ... @overload def __new__( @@ -111,7 +109,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[float]: ... @overload def __new__( @@ -122,7 +119,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[float]: ... @overload def __new__( @@ -137,7 +133,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[complex]: ... @overload def __new__( @@ -148,7 +143,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Index[complex]: ... # special overloads with dedicated Index-subclasses @overload @@ -160,7 +154,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> DatetimeIndex: ... @overload def __new__( @@ -171,7 +164,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> DatetimeIndex: ... @overload def __new__( @@ -182,7 +174,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> PeriodIndex: ... @overload def __new__( @@ -193,7 +184,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> PeriodIndex: ... @overload def __new__( @@ -204,7 +194,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> TimedeltaIndex: ... @overload def __new__( @@ -215,7 +204,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> TimedeltaIndex: ... @overload def __new__( @@ -226,7 +214,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> IntervalIndex[Interval[_OrderableT]]: ... @overload def __new__( @@ -237,7 +224,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> IntervalIndex[Interval[Any]]: ... # generic overloads @overload @@ -249,7 +235,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Self: ... @overload def __new__( @@ -260,7 +245,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Self: ... # fallback overload @overload @@ -272,7 +256,6 @@ class Index(IndexOpsMixin[S1]): copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ..., - **kwargs, ) -> Self: ... @property def str( From 85d6656d701d23568848c6a5bf04a2580ae17783 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:02:17 +0100 Subject: [PATCH 2/2] type `dtype` too --- pandas-stubs/core/indexes/base.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index 95cb272b..b7bb8a48 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -50,6 +50,7 @@ from pandas._typing import ( ArrayLike, AxesData, DropKeep, + Dtype, DtypeArg, DTypeLike, DtypeObj, @@ -252,7 +253,7 @@ class Index(IndexOpsMixin[S1]): cls, data: AxesData, *, - dtype=..., + dtype: Dtype = ..., copy: bool = ..., name: Hashable = ..., tupleize_cols: bool = ...,