Skip to content

Commit 46cc909

Browse files
committed
pandas-dev#25790 Added TypeVar to hint in core/indexes/base.py
1 parent a0b8c4c commit 46cc909

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/core/indexes/base.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import datetime, timedelta
22
import operator
33
from textwrap import dedent
4-
from typing import Union
4+
from typing import TypeVar, Union
55
import warnings
66

77
import numpy as np
@@ -164,6 +164,9 @@ def _new_Index(cls, d):
164164
return cls.__new__(cls, **d)
165165

166166

167+
INDEXTYPE = TypeVar('INDEXTYPE', bound='Index')
168+
169+
167170
class Index(IndexOpsMixin, PandasObject):
168171
"""
169172
Immutable ndarray implementing an ordered, sliceable set. The basic object
@@ -3632,7 +3635,7 @@ def values(self):
36323635
return self._data.view(np.ndarray)
36333636

36343637
@property
3635-
def _values(self) -> Union[ExtensionArray, Index, np.ndarray]:
3638+
def _values(self) -> Union[ExtensionArray, INDEXTYPE, np.ndarray]:
36363639
# TODO(EA): remove index types as they become extension arrays
36373640
"""
36383641
The best array representation.

0 commit comments

Comments
 (0)