Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(comment): #1282 (comment)
  • Loading branch information
cmp0xff committed Jul 19, 2025
commit 3844062b0df37d810c10744b226d2aa9641c4286
5 changes: 5 additions & 0 deletions pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ from typing import (
ClassVar,
Literal,
TypeAlias,
TypeVar,
final,
overload,
)
Expand Down Expand Up @@ -65,6 +66,8 @@ from pandas._typing import (
type_t,
)

_T_INDEX = TypeVar("_T_INDEX", bound=Index) # ty: ignore[unresolved-reference]

class InvalidIndexError(Exception): ...

class Index(IndexOpsMixin[S1]):
Expand Down Expand Up @@ -407,6 +410,8 @@ class Index(IndexOpsMixin[S1]):
@overload
def append(self, other: Index[S2] | Sequence[Index[S2]]) -> Index[S1 | S2]: ...
@overload
def append(self, other: Sequence[_T_INDEX]) -> Self | _T_INDEX: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we use Sequence[Index] here without the TypeVar ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea came from #1282 (comment). Removed in 67e6bde.

@overload
def append(self, other: Index | Sequence) -> Index: ...
def putmask(self, mask, value): ...
def equals(self, other) -> bool: ...
Expand Down
Loading