Skip to content

Commit b5008fa

Browse files
committed
merge
2 parents fd5e503 + bf1221e commit b5008fa

File tree

18 files changed

+734
-19
lines changed

18 files changed

+734
-19
lines changed

pandas-stubs/_typing.pyi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,26 @@ S1 = TypeVar("S1", bound=SeriesDType, default=Any)
847847
S2 = TypeVar("S2", bound=SeriesDType)
848848
S3 = TypeVar("S3", bound=SeriesDType)
849849

850+
# Constraint, instead of bound
851+
C2 = TypeVar(
852+
"C2",
853+
str,
854+
bytes,
855+
datetime.date,
856+
datetime.time,
857+
bool,
858+
int,
859+
float,
860+
complex,
861+
Dtype,
862+
datetime.datetime, # includes pd.Timestamp
863+
datetime.timedelta, # includes pd.Timedelta
864+
Period,
865+
Interval,
866+
CategoricalDtype,
867+
BaseOffset,
868+
)
869+
850870
IndexingInt: TypeAlias = (
851871
int | np.int_ | np.integer | np.unsignedinteger | np.signedinteger | np.int8
852872
)

pandas-stubs/core/indexes/base.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ from pandas import (
3434
)
3535
from pandas.core.arrays import ExtensionArray
3636
from pandas.core.base import IndexOpsMixin
37-
from pandas.core.strings import StringMethods
37+
from pandas.core.strings.accessor import StringMethods
3838
from typing_extensions import (
3939
Never,
4040
Self,
4141
)
4242

4343
from pandas._libs.interval import _OrderableT
4444
from pandas._typing import (
45+
C2,
4546
S1,
4647
AnyAll,
4748
ArrayLike,
@@ -411,7 +412,12 @@ class Index(IndexOpsMixin[S1]):
411412
) -> Self: ...
412413
@overload
413414
def __getitem__(self, idx: int | tuple[np_ndarray_anyint, ...]) -> S1: ...
414-
def append(self, other): ...
415+
@overload
416+
def append(
417+
self: Index[C2], other: Index[C2] | Sequence[Index[C2]]
418+
) -> Index[C2]: ...
419+
@overload
420+
def append(self, other: Index | Sequence[Index]) -> Index: ...
415421
def putmask(self, mask, value): ...
416422
def equals(self, other) -> bool: ...
417423
@final

pandas-stubs/core/indexes/multi.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class MultiIndex(Index):
5757
@classmethod
5858
def from_product(
5959
cls,
60-
iterables: Sequence[SequenceNotStr[Hashable] | pd.Series | pd.Index],
60+
iterables: Sequence[SequenceNotStr[Hashable] | pd.Series | pd.Index | range],
6161
sortorder: int | None = ...,
6262
names: SequenceNotStr[Hashable] = ...,
6363
) -> Self: ...
@@ -132,7 +132,7 @@ class MultiIndex(Index):
132132
def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride]
133133
self, key: int
134134
) -> tuple: ...
135-
def append(self, other): ...
135+
def append(self, other): ... # pyrefly: ignore
136136
def argsort(self, *args, **kwargs): ...
137137
def repeat(self, repeats, axis=...): ...
138138
def drop(self, codes, level: Level | None = None, errors: str = "raise") -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]

0 commit comments

Comments
 (0)