Skip to content

Commit 4ede926

Browse files
authored
fix concat, update mypy, pyright (#890)
1 parent 7dd7b6a commit 4ede926

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

pandas-stubs/core/indexes/multi.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ class MultiIndex(Index[Any]):
128128
),
129129
) -> Self: ...
130130
@overload
131-
def __getitem__(self, key: int) -> tuple: ...
131+
def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride]
132+
self, key: int
133+
) -> tuple: ...
132134
def take(
133135
self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs
134136
): ...

pandas-stubs/core/reshape/concat.pyi

+44-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,48 @@ from pandas._typing import (
2323
HashableT4,
2424
)
2525

26+
@overload
27+
def concat(
28+
objs: Iterable[DataFrame] | Mapping[HashableT1, DataFrame],
29+
*,
30+
axis: Axis = ...,
31+
join: Literal["inner", "outer"] = ...,
32+
ignore_index: bool = ...,
33+
keys: Iterable[HashableT2] = ...,
34+
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
35+
names: list[HashableT4] = ...,
36+
verify_integrity: bool = ...,
37+
sort: bool = ...,
38+
copy: bool = ...,
39+
) -> DataFrame: ...
40+
@overload
41+
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
42+
objs: Iterable[Series] | Mapping[HashableT1, Series],
43+
*,
44+
axis: AxisIndex = ...,
45+
join: Literal["inner", "outer"] = ...,
46+
ignore_index: bool = ...,
47+
keys: Iterable[HashableT2] = ...,
48+
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
49+
names: list[HashableT4] = ...,
50+
verify_integrity: bool = ...,
51+
sort: bool = ...,
52+
copy: bool = ...,
53+
) -> Series: ...
54+
@overload
55+
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
56+
objs: Iterable[Series | DataFrame] | Mapping[HashableT1, Series | DataFrame],
57+
*,
58+
axis: Axis = ...,
59+
join: Literal["inner", "outer"] = ...,
60+
ignore_index: bool = ...,
61+
keys: Iterable[HashableT2] = ...,
62+
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
63+
names: list[HashableT4] = ...,
64+
verify_integrity: bool = ...,
65+
sort: bool = ...,
66+
copy: bool = ...,
67+
) -> DataFrame: ...
2668
@overload
2769
def concat(
2870
objs: Iterable[None] | Mapping[HashableT1, None],
@@ -38,7 +80,7 @@ def concat(
3880
copy: bool = ...,
3981
) -> Never: ...
4082
@overload
41-
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
83+
def concat( # type: ignore[overload-overlap]
4284
objs: Iterable[DataFrame | None] | Mapping[HashableT1, DataFrame | None],
4385
*,
4486
axis: Axis = ...,
@@ -52,7 +94,7 @@ def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappin
5294
copy: bool = ...,
5395
) -> DataFrame: ...
5496
@overload
55-
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
97+
def concat( # type: ignore[overload-overlap]
5698
objs: Iterable[Series | None] | Mapping[HashableT1, Series | None],
5799
*,
58100
axis: AxisIndex = ...,

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ types-pytz = ">= 2022.1.1"
3535
numpy = { version = ">=1.26.0", python = "<3.13" }
3636

3737
[tool.poetry.group.dev.dependencies]
38-
mypy = "1.8.0"
39-
pandas = "2.2.0"
38+
mypy = "1.9.0"
39+
pandas = "2.2.1"
4040
pyarrow = ">=10.0.1"
4141
pytest = ">=7.1.2"
42-
pyright = ">=1.1.350"
42+
pyright = ">=1.1.354"
4343
poethepoet = ">=0.16.5"
4444
loguru = ">=0.6.0"
4545
typing-extensions = ">=4.4.0"

tests/test_io.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,13 @@ def test_hdf_series():
430430
def test_spss():
431431
if PD_LTE_22:
432432
warning_class = FutureWarning
433-
message = "ChainedAssignmentError: behaviour will change"
433+
message = "Placeholder"
434434
else:
435435
warning_class = pd.errors.ChainedAssignmentError # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
436436
message = "A value is trying to be set on a copy of a DataFrame"
437437

438438
path = Path(CWD, "data", "labelled-num.sav")
439-
with pytest_warns_bounded(warning_class, message):
439+
with pytest_warns_bounded(warning_class, message, "2.3.0"):
440440
check(
441441
assert_type(read_spss(path, convert_categoricals=True), DataFrame),
442442
DataFrame,

0 commit comments

Comments
 (0)