Skip to content

Commit 0db8a00

Browse files
committed
create TypeVar for the mixin
1 parent 01fd50a commit 0db8a00

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pandas-stubs/core/indexes/base.pyi

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ from typing import (
99
ClassVar,
1010
Generic,
1111
Literal,
12+
TypeVar,
1213
overload,
1314
)
1415

@@ -50,19 +51,20 @@ class InvalidIndexError(Exception): ...
5051

5152
_str = str
5253

54+
_IndexGetitemMixinT = TypeVar("_IndexGetitemMixinT", bound=_IndexGetitemMixin)
55+
5356
class _IndexGetitemMixin(Generic[S1]):
54-
# type ignore needed because it doesn't like the type of self
5557
@overload
56-
def __getitem__( # type: ignore[misc]
57-
self: IndexT,
58+
def __getitem__(
59+
self: _IndexGetitemMixinT,
5860
idx: slice
5961
| np_ndarray_anyint
6062
| Sequence[int]
6163
| Index
6264
| Series[bool]
6365
| Sequence[bool]
6466
| np_ndarray_bool,
65-
) -> IndexT: ...
67+
) -> _IndexGetitemMixinT: ...
6668
@overload
6769
def __getitem__(self, idx: int) -> S1: ...
6870

0 commit comments

Comments
 (0)