diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 8cc612667..d93c97ef2 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -7,6 +7,7 @@ from collections.abc import ( Hashable, Iterable, Mapping, + MutableMapping, Sequence, ) import datetime as dt @@ -162,12 +163,13 @@ class NDFrame(indexing.IndexingMixin): self, name: _str, con: str | sqlalchemy.engine.Connectable | sqlite3.Connection, - schema: _str | None = ..., - if_exists: Literal["fail", "replace", "append"] = "fail", + *, + schema: _str | None = None, + if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail", index: _bool = True, index_label: IndexLabel = None, - chunksize: int | None = ..., - dtype: DtypeArg | None = ..., + chunksize: int | None = None, + dtype: DtypeArg | None = None, method: ( Literal["multi"] | Callable[ @@ -175,7 +177,7 @@ class NDFrame(indexing.IndexingMixin): int | None, ] | None - ) = ..., + ) = None, ) -> int | None: ... @final def to_pickle( @@ -442,7 +444,7 @@ class NDFrame(indexing.IndexingMixin): @final def __copy__(self, deep: _bool = ...) -> Self: ... @final - def __deepcopy__(self, memo=...) -> Self: ... + def __deepcopy__(self, memo: MutableMapping[int, Any] | None = None) -> Self: ... @final def convert_dtypes( self, diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index bb51faef9..c4bf83138 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -3,6 +3,7 @@ from collections.abc import ( Callable, Hashable, Iterable, + MutableMapping, Sequence, ) from datetime import ( @@ -346,7 +347,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]): @final def __copy__(self, **kwargs: Any): ... @final - def __deepcopy__(self, memo=...): ... + def __deepcopy__(self, memo: MutableMapping[int, Any] | None = None) -> Self: ... def format( self, name: bool = ..., formatter: Callable | None = ..., na_rep: _str = ... ) -> list[_str]: ... diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index 7609cb4a3..a690957d4 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -1,5 +1,6 @@ from collections.abc import ( Callable, + MutableMapping, Sequence, ) from typing import ( @@ -224,7 +225,7 @@ class Styler(StylerRenderer): ) -> str: ... def set_td_classes(self, classes: DataFrame) -> Styler: ... def __copy__(self) -> Styler: ... - def __deepcopy__(self, memo) -> Styler: ... + def __deepcopy__(self, memo: MutableMapping[int, Any] | None) -> Styler: ... def clear(self) -> None: ... @overload def apply( diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 006620f78..a4e75c05d 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -19,6 +19,7 @@ from pandas.core.generic import NDFrame from typing_extensions import Self from pandas._typing import ( + BaseBuffer, FilePath, HashableT, HashableT1, @@ -101,7 +102,7 @@ def read_hdf( class HDFStore: def __init__( self, - path, + path: FilePath | BaseBuffer, mode: Literal["a", "w", "r", "r+"] = ..., complevel: int | None = ..., complib: HDFCompLib | None = ..., @@ -122,7 +123,7 @@ class HDFStore: exc_value: BaseException | None, traceback: TracebackType | None, ) -> None: ... - def keys(self, include="pandas") -> list[str]: ... + def keys(self, include: Literal["pandas", "native"] = "pandas") -> list[str]: ... def __iter__(self) -> Iterator[str]: ... def close(self) -> None: ... @property diff --git a/pandas-stubs/io/sas/sasreader.pyi b/pandas-stubs/io/sas/sasreader.pyi index 7865aaa64..9af416bc3 100644 --- a/pandas-stubs/io/sas/sasreader.pyi +++ b/pandas-stubs/io/sas/sasreader.pyi @@ -3,6 +3,7 @@ from abc import ( abstractmethod, ) from collections.abc import Hashable +from types import TracebackType from typing import ( Literal, overload, @@ -26,7 +27,12 @@ class ReaderBase(metaclass=ABCMeta): @abstractmethod def close(self) -> None: ... def __enter__(self) -> Self: ... - def __exit__(self, exc_type, exc_value, traceback) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: ... @overload def read_sas( diff --git a/pandas-stubs/io/sql.pyi b/pandas-stubs/io/sql.pyi index 5dadb15c7..a6b9629f8 100644 --- a/pandas-stubs/io/sql.pyi +++ b/pandas-stubs/io/sql.pyi @@ -22,6 +22,7 @@ from pandas._typing import ( DtypeArg, DtypeBackend, Scalar, + SequenceNotStr, npt, ) @@ -147,19 +148,19 @@ class PandasSQL: self, frame: DataFrame, name: str, - if_exists: Literal["fail", "replace", "append"] = ..., - index: bool = ..., - index_label=..., - schema: str | None = ..., - chunksize=..., - dtype: DtypeArg | None = ..., + if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail", + index: bool = True, + index_label: str | SequenceNotStr[str] | None = None, + schema: str | None = None, + chunksize: int | None = None, + dtype: DtypeArg | None = None, method: ( Literal["multi"] | Callable[[SQLTable, Any, list[str], Iterable], int | None] | None - ) = ..., - engine: str = ..., - **engine_kwargs: dict[str, Any] | None, + ) = None, + engine: str = "auto", + **engine_kwargs: Any, ) -> int | None: ... class SQLTable: @@ -169,7 +170,7 @@ class SQLTable: frame: DataFrame | None index: list[str] schema: str - if_exists: Literal["fail", "replace", "append"] + if_exists: Literal["fail", "replace", "append", "delete_rows"] keys: list[str] dtype: DtypeArg | None table: Any # sqlalchemy.Table @@ -177,14 +178,14 @@ class SQLTable: self, name: str, pandas_sql_engine: PandasSQL, - frame: DataFrame | None = ..., - index: bool | str | list[str] | None = ..., - if_exists: Literal["fail", "replace", "append"] = ..., - prefix: str = ..., - index_label: str | list[str] | None = ..., - schema: str | None = ..., - keys: str | list[str] | None = ..., - dtype: DtypeArg | None = ..., + frame: DataFrame | None = None, + index: bool | str | list[str] | None = True, + if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail", + prefix: str = "pandas", + index_label: str | list[str] | None = None, + schema: str | None = None, + keys: str | list[str] | None = None, + dtype: DtypeArg | None = None, ) -> None: ... def exists(self) -> bool: ... def sql_schema(self) -> str: ... diff --git a/pandas-stubs/plotting/_core.pyi b/pandas-stubs/plotting/_core.pyi index 87201cee1..1b610d958 100644 --- a/pandas-stubs/plotting/_core.pyi +++ b/pandas-stubs/plotting/_core.pyi @@ -17,8 +17,8 @@ from matplotlib.colors import Colormap from matplotlib.lines import Line2D import numpy as np import pandas as pd -from pandas import Series from pandas.core.frame import DataFrame +from pandas.core.series import Series from scipy.stats import gaussian_kde from pandas._typing import ( @@ -85,7 +85,7 @@ def boxplot( ) -> _BoxPlotT: ... class PlotAccessor: - def __init__(self, data) -> None: ... + def __init__(self, data: Series | DataFrame) -> None: ... @overload def __call__( self, diff --git a/pyproject.toml b/pyproject.toml index 3876f5c77..367d26b48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,14 +224,6 @@ ignore = [ # TODO: remove when computations are fully typed "ANN001", "ANN201", "ANN204", "ANN206", ] -"*plotting*" = [ - # TODO: remove when plottings are fully typed - "ANN001", "ANN201", "ANN204", "ANN206", -] -"*io*" = [ - # TODO: remove when io is fully typed - "ANN001", "ANN201", "ANN204", "ANN206", -] "*window*" = [ # TODO: remove when window is fully typed "ANN001", "ANN201", "ANN204", "ANN206",