Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix concat, update mypy, pyright #890

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ class MultiIndex(Index[Any]):
),
) -> Self: ...
@overload
def __getitem__(self, key: int) -> tuple: ...
def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride]
self, key: int
) -> tuple: ...
def take(
self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs
): ...
Expand Down
46 changes: 44 additions & 2 deletions pandas-stubs/core/reshape/concat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,48 @@ from pandas._typing import (
HashableT4,
)

@overload
def concat(
objs: Iterable[DataFrame] | Mapping[HashableT1, DataFrame],
*,
axis: Axis = ...,
join: Literal["inner", "outer"] = ...,
ignore_index: bool = ...,
keys: Iterable[HashableT2] = ...,
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
names: list[HashableT4] = ...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame: ...
@overload
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
objs: Iterable[Series] | Mapping[HashableT1, Series],
*,
axis: AxisIndex = ...,
join: Literal["inner", "outer"] = ...,
ignore_index: bool = ...,
keys: Iterable[HashableT2] = ...,
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
names: list[HashableT4] = ...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> Series: ...
@overload
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
objs: Iterable[Series | DataFrame] | Mapping[HashableT1, Series | DataFrame],
*,
axis: Axis = ...,
join: Literal["inner", "outer"] = ...,
ignore_index: bool = ...,
keys: Iterable[HashableT2] = ...,
levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] = ...,
names: list[HashableT4] = ...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame: ...
@overload
def concat(
objs: Iterable[None] | Mapping[HashableT1, None],
Expand All @@ -38,7 +80,7 @@ def concat(
copy: bool = ...,
) -> Never: ...
@overload
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
def concat( # type: ignore[overload-overlap]
objs: Iterable[DataFrame | None] | Mapping[HashableT1, DataFrame | None],
*,
axis: Axis = ...,
Expand All @@ -52,7 +94,7 @@ def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappin
copy: bool = ...,
) -> DataFrame: ...
@overload
def concat( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
def concat( # type: ignore[overload-overlap]
objs: Iterable[Series | None] | Mapping[HashableT1, Series | None],
*,
axis: AxisIndex = ...,
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ types-pytz = ">= 2022.1.1"
numpy = { version = ">=1.26.0", python = "<3.13" }

[tool.poetry.group.dev.dependencies]
mypy = "1.8.0"
pandas = "2.2.0"
mypy = "1.9.0"
pandas = "2.2.1"
pyarrow = ">=10.0.1"
pytest = ">=7.1.2"
pyright = ">=1.1.350"
pyright = ">=1.1.354"
poethepoet = ">=0.16.5"
loguru = ">=0.6.0"
typing-extensions = ">=4.4.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ def test_hdf_series():
def test_spss():
if PD_LTE_22:
warning_class = FutureWarning
message = "ChainedAssignmentError: behaviour will change"
message = "Placeholder"
else:
warning_class = pd.errors.ChainedAssignmentError # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
message = "A value is trying to be set on a copy of a DataFrame"

path = Path(CWD, "data", "labelled-num.sav")
with pytest_warns_bounded(warning_class, message):
with pytest_warns_bounded(warning_class, message, "2.3.0"):
check(
assert_type(read_spss(path, convert_categoricals=True), DataFrame),
DataFrame,
Expand Down
Loading