Skip to content

Commit 29e287b

Browse files
authored
TYP: Index._simple_new (pandas-dev#50534)
1 parent 32a261a commit 29e287b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pandas/core/indexes/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ def _dtype_to_subclass(cls, dtype: DtypeObj):
601601
# See each method's docstring.
602602

603603
@classmethod
604-
def _simple_new(cls: type[_IndexT], values, name: Hashable = None) -> _IndexT:
604+
def _simple_new(
605+
cls: type[_IndexT], values: ArrayLike, name: Hashable = None
606+
) -> _IndexT:
605607
"""
606608
We require that we have a dtype compat for the values. If we are passed
607609
a non-dtype compat, then coerce using the constructor.

pandas/core/indexes/range.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,13 @@ def from_range(
167167
cls._validate_dtype(dtype)
168168
return cls._simple_new(data, name=name)
169169

170+
# error: Argument 1 of "_simple_new" is incompatible with supertype "Index";
171+
# supertype defines the argument type as
172+
# "Union[ExtensionArray, ndarray[Any, Any]]" [override]
170173
@classmethod
171-
def _simple_new(cls, values: range, name: Hashable = None) -> RangeIndex:
174+
def _simple_new( # type: ignore[override]
175+
cls, values: range, name: Hashable = None
176+
) -> RangeIndex:
172177
result = object.__new__(cls)
173178

174179
assert isinstance(values, range)

0 commit comments

Comments
 (0)