Skip to content

Commit 36ea021

Browse files
authored
1 parent 81f700c commit 36ea021

File tree

8 files changed

+43
-39
lines changed

8 files changed

+43
-39
lines changed

pandas-stubs/core/generic.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from collections.abc import (
77
Hashable,
88
Iterable,
99
Mapping,
10+
MutableMapping,
1011
Sequence,
1112
)
1213
import datetime as dt
@@ -162,20 +163,21 @@ class NDFrame(indexing.IndexingMixin):
162163
self,
163164
name: _str,
164165
con: str | sqlalchemy.engine.Connectable | sqlite3.Connection,
165-
schema: _str | None = ...,
166-
if_exists: Literal["fail", "replace", "append"] = "fail",
166+
*,
167+
schema: _str | None = None,
168+
if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail",
167169
index: _bool = True,
168170
index_label: IndexLabel = None,
169-
chunksize: int | None = ...,
170-
dtype: DtypeArg | None = ...,
171+
chunksize: int | None = None,
172+
dtype: DtypeArg | None = None,
171173
method: (
172174
Literal["multi"]
173175
| Callable[
174176
[SQLTable, Any, list[str], Iterable[tuple[Any, ...]]],
175177
int | None,
176178
]
177179
| None
178-
) = ...,
180+
) = None,
179181
) -> int | None: ...
180182
@final
181183
def to_pickle(
@@ -442,7 +444,7 @@ class NDFrame(indexing.IndexingMixin):
442444
@final
443445
def __copy__(self, deep: _bool = ...) -> Self: ...
444446
@final
445-
def __deepcopy__(self, memo=...) -> Self: ...
447+
def __deepcopy__(self, memo: MutableMapping[int, Any] | None = None) -> Self: ...
446448
@final
447449
def convert_dtypes(
448450
self,

pandas-stubs/core/indexes/base.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from collections.abc import (
33
Callable,
44
Hashable,
55
Iterable,
6+
MutableMapping,
67
Sequence,
78
)
89
from datetime import (
@@ -346,7 +347,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
346347
@final
347348
def __copy__(self, **kwargs: Any): ...
348349
@final
349-
def __deepcopy__(self, memo=...): ...
350+
def __deepcopy__(self, memo: MutableMapping[int, Any] | None = None) -> Self: ...
350351
def format(
351352
self, name: bool = ..., formatter: Callable | None = ..., na_rep: _str = ...
352353
) -> list[_str]: ...

pandas-stubs/io/formats/style.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import (
22
Callable,
3+
MutableMapping,
34
Sequence,
45
)
56
from typing import (
@@ -224,7 +225,7 @@ class Styler(StylerRenderer):
224225
) -> str: ...
225226
def set_td_classes(self, classes: DataFrame) -> Styler: ...
226227
def __copy__(self) -> Styler: ...
227-
def __deepcopy__(self, memo) -> Styler: ...
228+
def __deepcopy__(self, memo: MutableMapping[int, Any] | None) -> Styler: ...
228229
def clear(self) -> None: ...
229230
@overload
230231
def apply(

pandas-stubs/io/pytables.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ from pandas.core.generic import NDFrame
1919
from typing_extensions import Self
2020

2121
from pandas._typing import (
22+
BaseBuffer,
2223
FilePath,
2324
HashableT,
2425
HashableT1,
@@ -101,7 +102,7 @@ def read_hdf(
101102
class HDFStore:
102103
def __init__(
103104
self,
104-
path,
105+
path: FilePath | BaseBuffer,
105106
mode: Literal["a", "w", "r", "r+"] = ...,
106107
complevel: int | None = ...,
107108
complib: HDFCompLib | None = ...,
@@ -122,7 +123,7 @@ class HDFStore:
122123
exc_value: BaseException | None,
123124
traceback: TracebackType | None,
124125
) -> None: ...
125-
def keys(self, include="pandas") -> list[str]: ...
126+
def keys(self, include: Literal["pandas", "native"] = "pandas") -> list[str]: ...
126127
def __iter__(self) -> Iterator[str]: ...
127128
def close(self) -> None: ...
128129
@property

pandas-stubs/io/sas/sasreader.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from abc import (
33
abstractmethod,
44
)
55
from collections.abc import Hashable
6+
from types import TracebackType
67
from typing import (
78
Literal,
89
overload,
@@ -26,7 +27,12 @@ class ReaderBase(metaclass=ABCMeta):
2627
@abstractmethod
2728
def close(self) -> None: ...
2829
def __enter__(self) -> Self: ...
29-
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
30+
def __exit__(
31+
self,
32+
exc_type: type[BaseException] | None,
33+
exc_value: BaseException | None,
34+
traceback: TracebackType | None,
35+
) -> None: ...
3036

3137
@overload
3238
def read_sas(

pandas-stubs/io/sql.pyi

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ from pandas._typing import (
2222
DtypeArg,
2323
DtypeBackend,
2424
Scalar,
25+
SequenceNotStr,
2526
npt,
2627
)
2728

@@ -147,19 +148,19 @@ class PandasSQL:
147148
self,
148149
frame: DataFrame,
149150
name: str,
150-
if_exists: Literal["fail", "replace", "append"] = ...,
151-
index: bool = ...,
152-
index_label=...,
153-
schema: str | None = ...,
154-
chunksize=...,
155-
dtype: DtypeArg | None = ...,
151+
if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail",
152+
index: bool = True,
153+
index_label: str | SequenceNotStr[str] | None = None,
154+
schema: str | None = None,
155+
chunksize: int | None = None,
156+
dtype: DtypeArg | None = None,
156157
method: (
157158
Literal["multi"]
158159
| Callable[[SQLTable, Any, list[str], Iterable], int | None]
159160
| None
160-
) = ...,
161-
engine: str = ...,
162-
**engine_kwargs: dict[str, Any] | None,
161+
) = None,
162+
engine: str = "auto",
163+
**engine_kwargs: Any,
163164
) -> int | None: ...
164165

165166
class SQLTable:
@@ -169,22 +170,22 @@ class SQLTable:
169170
frame: DataFrame | None
170171
index: list[str]
171172
schema: str
172-
if_exists: Literal["fail", "replace", "append"]
173+
if_exists: Literal["fail", "replace", "append", "delete_rows"]
173174
keys: list[str]
174175
dtype: DtypeArg | None
175176
table: Any # sqlalchemy.Table
176177
def __init__(
177178
self,
178179
name: str,
179180
pandas_sql_engine: PandasSQL,
180-
frame: DataFrame | None = ...,
181-
index: bool | str | list[str] | None = ...,
182-
if_exists: Literal["fail", "replace", "append"] = ...,
183-
prefix: str = ...,
184-
index_label: str | list[str] | None = ...,
185-
schema: str | None = ...,
186-
keys: str | list[str] | None = ...,
187-
dtype: DtypeArg | None = ...,
181+
frame: DataFrame | None = None,
182+
index: bool | str | list[str] | None = True,
183+
if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail",
184+
prefix: str = "pandas",
185+
index_label: str | list[str] | None = None,
186+
schema: str | None = None,
187+
keys: str | list[str] | None = None,
188+
dtype: DtypeArg | None = None,
188189
) -> None: ...
189190
def exists(self) -> bool: ...
190191
def sql_schema(self) -> str: ...

pandas-stubs/plotting/_core.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ from matplotlib.colors import Colormap
1717
from matplotlib.lines import Line2D
1818
import numpy as np
1919
import pandas as pd
20-
from pandas import Series
2120
from pandas.core.frame import DataFrame
21+
from pandas.core.series import Series
2222
from scipy.stats import gaussian_kde
2323

2424
from pandas._typing import (
@@ -85,7 +85,7 @@ def boxplot(
8585
) -> _BoxPlotT: ...
8686

8787
class PlotAccessor:
88-
def __init__(self, data) -> None: ...
88+
def __init__(self, data: Series | DataFrame) -> None: ...
8989
@overload
9090
def __call__(
9191
self,

pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,6 @@ ignore = [
224224
# TODO: remove when computations are fully typed
225225
"ANN001", "ANN201", "ANN204", "ANN206",
226226
]
227-
"*plotting*" = [
228-
# TODO: remove when plottings are fully typed
229-
"ANN001", "ANN201", "ANN204", "ANN206",
230-
]
231-
"*io*" = [
232-
# TODO: remove when io is fully typed
233-
"ANN001", "ANN201", "ANN204", "ANN206",
234-
]
235227
"*window*" = [
236228
# TODO: remove when window is fully typed
237229
"ANN001", "ANN201", "ANN204", "ANN206",

0 commit comments

Comments
 (0)