Skip to content

Commit 2777788

Browse files
committed
Merge remote-tracking branch 'upstream/main' into setitem-fix
2 parents fdd7cfb + 7c90b93 commit 2777788

File tree

20 files changed

+91
-68
lines changed

20 files changed

+91
-68
lines changed

pandas-stubs/_libs/tslibs/offsets.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ class _CustomBusinessMonth(SingleConstructorOffset):
205205
n: int = ...,
206206
normalize: bool = ...,
207207
offset: timedelta = ...,
208-
holidays: list | None = ...,
208+
holidays: list[Any] | None = ...,
209209
) -> None: ...
210210

211211
class CustomBusinessDay(BusinessDay):
212212
def __init__(
213213
self,
214214
n: int = ...,
215215
normalize: bool = ...,
216-
holidays: list = ...,
216+
holidays: list[Any] = ...,
217217
calendar: AbstractHolidayCalendar | np.busdaycalendar = ...,
218218
) -> None: ...
219219

@@ -225,7 +225,7 @@ class CustomBusinessHour(BusinessHour):
225225
start: str | time | Collection[str | time] = ...,
226226
end: str | time | Collection[str | time] = ...,
227227
offset: timedelta = ...,
228-
holidays: list | None = ...,
228+
holidays: list[Any] | None = ...,
229229
) -> None: ...
230230

231231
class CustomBusinessMonthEnd(_CustomBusinessMonth): ...

pandas-stubs/_typing.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Level: TypeAlias = Hashable
182182
Shape: TypeAlias = tuple[int, ...]
183183
Suffixes: TypeAlias = tuple[str | None, str | None] | list[str | None]
184184
Ordered: TypeAlias = bool | None
185-
JSONSerializable: TypeAlias = PythonScalar | list | dict
185+
JSONSerializable: TypeAlias = PythonScalar | list[Any] | dict
186186
Frequency: TypeAlias = str | BaseOffset
187187
PeriodFrequency: TypeAlias = (
188188
str
@@ -966,7 +966,7 @@ ListLikeT = TypeVar("ListLikeT", bound=ListLike)
966966
ListLikeExceptSeriesAndStr: TypeAlias = (
967967
MutableSequence[Any] | np_1darray | tuple[Any, ...] | Index
968968
)
969-
ListLikeU: TypeAlias = Sequence | np_1darray | Series | Index
969+
ListLikeU: TypeAlias = Sequence[Any] | np_1darray | Series | Index
970970
ListLikeHashable: TypeAlias = (
971971
MutableSequence[HashableT] | np_1darray | tuple[HashableT, ...] | range
972972
)

pandas-stubs/core/frame.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,15 +552,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
552552
*,
553553
into: MutableMapping | type[MutableMapping],
554554
index: bool = ...,
555-
) -> MutableMapping[str, list]: ...
555+
) -> MutableMapping[str, list[Any]]: ...
556556
@overload
557557
def to_dict(
558558
self,
559559
orient: Literal["split", "tight"],
560560
*,
561561
into: type[dict] = ...,
562562
index: bool = ...,
563-
) -> dict[str, list]: ...
563+
) -> dict[str, list[Any]]: ...
564564
@classmethod
565565
def from_records(
566566
cls,
@@ -1256,7 +1256,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
12561256
keep: NsmallestNlargestKeep = "first",
12571257
) -> Self: ...
12581258
def swaplevel(self, i: Level = ..., j: Level = ..., axis: Axis = 0) -> Self: ...
1259-
def reorder_levels(self, order: list, axis: Axis = 0) -> Self: ...
1259+
def reorder_levels(self, order: list[int] | list[str], axis: Axis = 0) -> Self: ...
12601260
def compare(
12611261
self,
12621262
other: DataFrame,
@@ -1796,7 +1796,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
17961796
def hist(
17971797
self,
17981798
by: _str | ListLike | None = None,
1799-
bins: int | list = 10,
1799+
bins: int | Sequence[int] = 10,
18001800
*,
18011801
grid: _bool = True,
18021802
xlabelsize: float | str | None = None,

pandas-stubs/core/groupby/generic.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,17 @@ _TT = TypeVar("_TT", bound=Literal[True, False])
219219
class DFCallable1(Protocol[P]): # ty: ignore[invalid-argument-type]
220220
def __call__(
221221
self, df: DataFrame, /, *args: P.args, **kwargs: P.kwargs
222-
) -> Scalar | list | dict: ...
222+
) -> Scalar | list[Any] | dict: ...
223223

224224
class DFCallable2(Protocol[P]): # ty: ignore[invalid-argument-type]
225225
def __call__(
226226
self, df: DataFrame, /, *args: P.args, **kwargs: P.kwargs
227227
) -> DataFrame | Series: ...
228228

229229
class DFCallable3(Protocol[P]): # ty: ignore[invalid-argument-type]
230-
def __call__(self, df: Iterable, /, *args: P.args, **kwargs: P.kwargs) -> float: ...
230+
def __call__(
231+
self, df: Iterable[Any], /, *args: P.args, **kwargs: P.kwargs
232+
) -> float: ...
231233

232234
class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
233235
# error: Overload 3 for "apply" will never be used because its parameters overlap overload 1

pandas-stubs/core/groupby/groupby.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class GroupBy(BaseGroupBy[NDFrameT]):
334334
n: int | None = None,
335335
frac: float | None = None,
336336
replace: bool = False,
337-
weights: Sequence | Series | None = ...,
337+
weights: Sequence[float] | Series | None = ...,
338338
random_state: RandomState | None = ...,
339339
) -> NDFrameT: ...
340340

pandas-stubs/core/indexes/accessors.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ class TimedeltaIndexProperties(
444444
@type_check_only
445445
class DtDescriptor:
446446
@overload
447-
def __get__(self, instance: Series[Never], owner: type[Series]) -> Properties: ...
447+
def __get__(
448+
self, instance: Series[Never], owner: type[Series]
449+
) -> CombinedDatetimelikeProperties: ...
448450
@overload
449451
def __get__(
450452
self, instance: Series[Timestamp], owner: type[Series]

pandas-stubs/core/indexes/base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
477477
def intersection(
478478
self, other: list[S1] | Self, sort: bool | None = False
479479
) -> Self: ...
480-
def difference(self, other: list | Self, sort: bool | None = None) -> Self: ...
480+
def difference(self, other: list[Any] | Self, sort: bool | None = None) -> Self: ...
481481
def symmetric_difference(
482482
self,
483483
other: list[S1] | Self,

pandas-stubs/core/indexes/multi.pyi

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from collections.abc import (
2-
Callable,
32
Collection,
43
Hashable,
54
Iterable,
@@ -91,16 +90,6 @@ class MultiIndex(Index):
9190
def memory_usage(self, deep: bool = False) -> int: ...
9291
@property
9392
def nbytes(self) -> int: ...
94-
def format(
95-
self,
96-
name: bool | None = ...,
97-
formatter: Callable[..., Any] | None = ...,
98-
na_rep: str | None = ...,
99-
names: bool = ...,
100-
space: int = ...,
101-
sparsify: bool | None = ...,
102-
adjoin: bool = ...,
103-
) -> list: ...
10493
def __len__(self) -> int: ...
10594
@property
10695
def values(self): ...

pandas-stubs/core/reshape/pivot.pyi

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ from pandas._typing import (
2828
Label,
2929
Scalar,
3030
ScalarT,
31+
SequenceNotStr,
3132
np_ndarray,
3233
)
3334

@@ -61,6 +62,7 @@ _PivotTableColumnsTypes: TypeAlias = (
6162
_PivotTableValuesTypes: TypeAlias = Label | Sequence[HashableT3] | None
6263

6364
_ExtendedAnyArrayLike: TypeAlias = AnyArrayLike | ArrayLike
65+
_Values: TypeAlias = SequenceNotStr[Any] | _ExtendedAnyArrayLike
6466

6567
@overload
6668
def pivot_table(
@@ -123,9 +125,9 @@ def pivot(
123125
) -> DataFrame: ...
124126
@overload
125127
def crosstab(
126-
index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
127-
columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
128-
values: list | _ExtendedAnyArrayLike,
128+
index: _Values | list[_Values],
129+
columns: _Values | list[_Values],
130+
values: _Values,
129131
rownames: list[HashableT1] | None = ...,
130132
colnames: list[HashableT2] | None = ...,
131133
*,
@@ -137,8 +139,8 @@ def crosstab(
137139
) -> DataFrame: ...
138140
@overload
139141
def crosstab(
140-
index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
141-
columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
142+
index: _Values | list[_Values],
143+
columns: _Values | list[_Values],
142144
values: None = None,
143145
rownames: list[HashableT1] | None = ...,
144146
colnames: list[HashableT2] | None = ...,

pandas-stubs/core/series.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from collections.abc import (
1111
Mapping,
1212
MutableMapping,
1313
Sequence,
14+
Set as AbstractSet,
1415
ValuesView,
1516
)
1617
from datetime import (
@@ -564,8 +565,6 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
564565
def __array__( # ty: ignore[invalid-method-override]
565566
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
566567
) -> np_1darray: ...
567-
@property
568-
def axes(self) -> list: ...
569568
@final
570569
def __getattr__(self, name: _str) -> S1: ...
571570

@@ -1171,7 +1170,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
11711170
def apply(
11721171
self,
11731172
func: Callable[
1174-
..., Scalar | Sequence | set | Mapping | NAType | frozenset | None
1173+
..., Scalar | Sequence[Any] | AbstractSet[Any] | Mapping | NAType | None
11751174
],
11761175
convertDType: _bool = ...,
11771176
args: tuple[Any, ...] = ...,
@@ -1373,7 +1372,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
13731372
ylabelsize: float | _str | None = None,
13741373
yrot: float | None = None,
13751374
figsize: tuple[float, float] | None = None,
1376-
bins: int | Sequence = 10,
1375+
bins: int | Sequence[int] = 10,
13771376
backend: _str | None = None,
13781377
legend: _bool = False,
13791378
**kwargs: Any,

0 commit comments

Comments
 (0)