Skip to content

Commit 8607315

Browse files
GH128 Multiple removal of old stubs, unimplement methods using stubtest (pandas-dev#1218)
* GH128 Multiple removal of old stubs, unimplement methods using stubtest * GH128 PR feedback
1 parent 366caf9 commit 8607315

File tree

13 files changed

+26
-61
lines changed

13 files changed

+26
-61
lines changed

pandas-stubs/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ from pandas.io.api import (
105105
read_excel as read_excel,
106106
read_feather as read_feather,
107107
read_fwf as read_fwf,
108-
read_gbq as read_gbq,
109108
read_hdf as read_hdf,
110109
read_html as read_html,
111110
read_json as read_json,

pandas-stubs/_libs/tslibs/offsets.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ from typing import (
1515
from dateutil.relativedelta import weekday as WeekdayClass
1616
import numpy as np
1717
from pandas import Timestamp
18-
from pandas.core.indexes.datetimes import DatetimeIndex
1918
from typing_extensions import Self
2019

21-
from pandas._libs.tslibs.timedeltas import Timedelta
2220
from pandas._typing import npt
2321

2422
from pandas.tseries.holiday import AbstractHolidayCalendar
@@ -86,7 +84,6 @@ class BaseOffset:
8684
def rule_code(self) -> str: ...
8785
@property
8886
def freqstr(self) -> str: ...
89-
def apply_index(self, dtindex: DatetimeIndex) -> DatetimeIndex: ...
9087
def rollback(self, dt: datetime) -> datetime: ...
9188
def rollforward(self, dt: datetime) -> datetime: ...
9289
def is_on_offset(self, dt: datetime) -> bool: ...
@@ -101,8 +98,6 @@ class SingleConstructorOffset(BaseOffset):
10198
class Tick(SingleConstructorOffset):
10299
def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
103100
@property
104-
def delta(self) -> Timedelta: ...
105-
@property
106101
def nanos(self) -> int: ...
107102

108103
class Day(Tick): ...

pandas-stubs/core/frame.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
683683
def info(
684684
self,
685685
verbose: bool | None = ...,
686-
buf: WriteBuffer[str] = ...,
686+
buf: WriteBuffer[str] | None = ...,
687687
max_cols: int | None = ...,
688688
memory_usage: bool | Literal["deep"] | None = ...,
689689
show_counts: bool | None = ...,

pandas-stubs/core/series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
11281128
def info(
11291129
self,
11301130
verbose: bool | None = ...,
1131-
buf: WriteBuffer[str] = ...,
1131+
buf: WriteBuffer[str] | None = ...,
11321132
memory_usage: bool | Literal["deep"] | None = ...,
11331133
show_counts: bool | None = ...,
11341134
) -> None: ...

pandas-stubs/io/excel/_base.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def read_excel(
5858
false_values: Iterable[Hashable] | None = ...,
5959
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
6060
nrows: int | None = ...,
61-
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
61+
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
6262
keep_default_na: bool = ...,
6363
na_filter: bool = ...,
6464
verbose: bool = ...,
@@ -75,6 +75,7 @@ def read_excel(
7575
skipfooter: int = ...,
7676
storage_options: StorageOptions = ...,
7777
dtype_backend: DtypeBackend | NoDefault = ...,
78+
engine_kwargs: dict[str, Any] | None = ...,
7879
) -> dict[IntStrT, DataFrame]: ...
7980
@overload
8081
def read_excel(
@@ -100,7 +101,7 @@ def read_excel(
100101
false_values: Iterable[Hashable] | None = ...,
101102
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
102103
nrows: int | None = ...,
103-
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
104+
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
104105
keep_default_na: bool = ...,
105106
na_filter: bool = ...,
106107
verbose: bool = ...,
@@ -117,6 +118,7 @@ def read_excel(
117118
skipfooter: int = ...,
118119
storage_options: StorageOptions = ...,
119120
dtype_backend: DtypeBackend | NoDefault = ...,
121+
engine_kwargs: dict[str, Any] | None = ...,
120122
) -> dict[str, DataFrame]: ...
121123
@overload
122124
# mypy says this won't be matched
@@ -143,7 +145,7 @@ def read_excel( # type: ignore[overload-cannot-match]
143145
false_values: Iterable[Hashable] | None = ...,
144146
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
145147
nrows: int | None = ...,
146-
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
148+
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
147149
keep_default_na: bool = ...,
148150
na_filter: bool = ...,
149151
verbose: bool = ...,
@@ -160,6 +162,7 @@ def read_excel( # type: ignore[overload-cannot-match]
160162
skipfooter: int = ...,
161163
storage_options: StorageOptions = ...,
162164
dtype_backend: DtypeBackend | NoDefault = ...,
165+
engine_kwargs: dict[str, Any] | None = ...,
163166
) -> dict[int | str, DataFrame]: ...
164167
@overload
165168
def read_excel(
@@ -185,7 +188,7 @@ def read_excel(
185188
false_values: Iterable[Hashable] | None = ...,
186189
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
187190
nrows: int | None = ...,
188-
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
191+
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
189192
keep_default_na: bool = ...,
190193
na_filter: bool = ...,
191194
verbose: bool = ...,
@@ -202,6 +205,7 @@ def read_excel(
202205
skipfooter: int = ...,
203206
storage_options: StorageOptions = ...,
204207
dtype_backend: DtypeBackend | NoDefault = ...,
208+
engine_kwargs: dict[str, Any] | None = ...,
205209
) -> DataFrame: ...
206210

207211
class ExcelWriter:

pandas-stubs/io/formats/style.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ from typing import (
1111

1212
from matplotlib.colors import Colormap
1313
import numpy as np
14-
from pandas import Index
1514
from pandas.core.frame import DataFrame
1615
from pandas.core.series import Series
1716

@@ -26,6 +25,7 @@ from pandas._typing import (
2625
Level,
2726
QuantileInterpolation,
2827
Scalar,
28+
StorageOptions,
2929
T,
3030
WriteBuffer,
3131
WriteExcelBuffer,
@@ -53,10 +53,6 @@ class _DataFrameFunc(Protocol):
5353
) -> npt.NDArray | DataFrame: ...
5454

5555
class Styler(StylerRenderer):
56-
@property
57-
def columns(self) -> Index[Any]: ...
58-
@property
59-
def index(self) -> Index[Any]: ...
6056
def __init__(
6157
self,
6258
data: DataFrame | Series,
@@ -79,6 +75,7 @@ class Styler(StylerRenderer):
7975
ttips: DataFrame,
8076
props: CSSProperties | None = ...,
8177
css_class: str | None = ...,
78+
as_title_attribute: bool = ...,
8279
) -> Styler: ...
8380
def to_excel(
8481
self,
@@ -98,8 +95,7 @@ class Styler(StylerRenderer):
9895
inf_rep: str = ...,
9996
verbose: bool = ...,
10097
freeze_panes: tuple[int, int] | None = ...,
101-
# TODO: Listed in docs but not in function decl
102-
# storage_options: StorageOptions = ...,
98+
storage_options: StorageOptions | None = ...,
10399
) -> None: ...
104100
@overload
105101
def to_latex(
@@ -314,7 +310,7 @@ class Styler(StylerRenderer):
314310
axis: Axis | None = ...,
315311
*,
316312
color: str | list[str] | tuple[str, str] | None = ...,
317-
cmap: str | Colormap = ...,
313+
cmap: str | Colormap | None = ...,
318314
width: float = ...,
319315
height: float = ...,
320316
align: (

pandas-stubs/io/formats/style_render.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ class StylerRenderer:
8181
axis: Axis = ...,
8282
level: Level | list[Level] | None = ...,
8383
) -> Self: ...
84+
@property
85+
def columns(self) -> Index[Any]: ...
86+
@property
87+
def index(self) -> Index[Any]: ...

pandas-stubs/io/gbq.pyi

Lines changed: 0 additions & 23 deletions
This file was deleted.

pandas-stubs/io/orc.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ def read_orc(
1414
path: FilePath | ReadBuffer[bytes],
1515
columns: list[HashableT] | None = ...,
1616
dtype_backend: DtypeBackend | NoDefault = ...,
17+
# TODO type with the correct pyarrow types
18+
# filesystem: pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem
19+
filesystem: Any | None = ...,
1720
**kwargs: Any,
1821
) -> DataFrame: ...

pandas-stubs/io/sql.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ def read_sql(
143143
) -> DataFrame: ...
144144

145145
class PandasSQL:
146-
def read_sql(self, *args, **kwargs): ...
147146
def to_sql(
148147
self,
149148
frame: DataFrame,
@@ -159,6 +158,8 @@ class PandasSQL:
159158
| Callable[[SQLTable, Any, list[str], Iterable], int | None]
160159
| None
161160
) = ...,
161+
engine: str = ...,
162+
**engine_kwargs: dict[str, Any] | None,
162163
) -> int | None: ...
163164

164165
class SQLTable:

pandas-stubs/tseries/frequencies.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ from pandas.tseries.offsets import DateOffset
1212

1313
def get_period_alias(offset_str: str) -> str | None: ...
1414
@overload
15-
def to_offset(freq: None) -> None: ...
15+
def to_offset(freq: None, is_period: bool = ...) -> None: ...
1616
@overload
17-
def to_offset(freq: Frequency) -> DateOffset: ...
18-
def get_offset(name: str) -> DateOffset: ...
17+
def to_offset(freq: Frequency, is_period: bool = ...) -> DateOffset: ...
1918
def infer_freq(index: Series | DatetimeIndex | TimedeltaIndex) -> str | None: ...

pandas-stubs/util/_tester.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
def test(extra_args=...) -> None: ...
1+
def test(extra_args: list[str] | None = ..., run_doctests: bool = ...) -> None: ...

pandas-stubs/util/_validators.pyi

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)