Skip to content

GH128 Multiple removal of old stubs, unimplement methods using stubtest #1218

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

Merged
merged 2 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ from pandas.io.api import (
read_excel as read_excel,
read_feather as read_feather,
read_fwf as read_fwf,
read_gbq as read_gbq,
read_hdf as read_hdf,
read_html as read_html,
read_json as read_json,
Expand Down
8 changes: 0 additions & 8 deletions pandas-stubs/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ from typing import (
from dateutil.relativedelta import weekday as WeekdayClass
import numpy as np
from pandas import Timestamp
from pandas.core.indexes.datetimes import DatetimeIndex
from typing_extensions import Self

from pandas._libs.tslibs.timedeltas import Timedelta
from pandas._typing import npt

from pandas.tseries.holiday import AbstractHolidayCalendar
Expand Down Expand Up @@ -88,26 +86,20 @@ class BaseOffset:
def rule_code(self) -> str: ...
@property
def freqstr(self) -> str: ...
def apply_index(self, dtindex: DatetimeIndex) -> DatetimeIndex: ...
def rollback(self, dt: datetime) -> datetime: ...
def rollforward(self, dt: datetime) -> datetime: ...
def is_on_offset(self, dt: datetime) -> bool: ...
def __setstate__(self, state) -> None: ...
def __getstate__(self): ...
@property
def nanos(self) -> int: ...
def onOffset(self, dt: datetime) -> bool: ...
def isAnchored(self) -> bool: ...
def is_anchored(self) -> bool: ...

class SingleConstructorOffset(BaseOffset):
def __reduce__(self): ...

class Tick(SingleConstructorOffset):
def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
@property
def delta(self) -> Timedelta: ...
@property
def nanos(self) -> int: ...

def delta_to_tick(delta: timedelta) -> Tick: ...
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def info(
self,
verbose: bool | None = ...,
buf: WriteBuffer[str] = ...,
buf: WriteBuffer[str] | None = ...,
max_cols: int | None = ...,
memory_usage: bool | Literal["deep"] | None = ...,
show_counts: bool | None = ...,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
def info(
self,
verbose: bool | None = ...,
buf: WriteBuffer[str] = ...,
buf: WriteBuffer[str] | None = ...,
memory_usage: bool | Literal["deep"] | None = ...,
show_counts: bool | None = ...,
) -> None: ...
Expand Down
12 changes: 8 additions & 4 deletions pandas-stubs/io/excel/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def read_excel(
false_values: Iterable[Hashable] | None = ...,
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
nrows: int | None = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand All @@ -75,6 +75,7 @@ def read_excel(
skipfooter: int = ...,
storage_options: StorageOptions = ...,
dtype_backend: DtypeBackend | NoDefault = ...,
engine_kwargs: dict[str, Any] | None = ...,
) -> dict[IntStrT, DataFrame]: ...
@overload
def read_excel(
Expand All @@ -100,7 +101,7 @@ def read_excel(
false_values: Iterable[Hashable] | None = ...,
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
nrows: int | None = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand All @@ -117,6 +118,7 @@ def read_excel(
skipfooter: int = ...,
storage_options: StorageOptions = ...,
dtype_backend: DtypeBackend | NoDefault = ...,
engine_kwargs: dict[str, Any] | None = ...,
) -> dict[str, DataFrame]: ...
@overload
# mypy says this won't be matched
Expand All @@ -143,7 +145,7 @@ def read_excel( # type: ignore[overload-cannot-match]
false_values: Iterable[Hashable] | None = ...,
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
nrows: int | None = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand All @@ -160,6 +162,7 @@ def read_excel( # type: ignore[overload-cannot-match]
skipfooter: int = ...,
storage_options: StorageOptions = ...,
dtype_backend: DtypeBackend | NoDefault = ...,
engine_kwargs: dict[str, Any] | None = ...,
) -> dict[int | str, DataFrame]: ...
@overload
def read_excel(
Expand All @@ -185,7 +188,7 @@ def read_excel(
false_values: Iterable[Hashable] | None = ...,
skiprows: int | Sequence[int] | Callable[[object], bool] | None = ...,
nrows: int | None = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] = ...,
na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand All @@ -202,6 +205,7 @@ def read_excel(
skipfooter: int = ...,
storage_options: StorageOptions = ...,
dtype_backend: DtypeBackend | NoDefault = ...,
engine_kwargs: dict[str, Any] | None = ...,
) -> DataFrame: ...

class ExcelWriter:
Expand Down
12 changes: 4 additions & 8 deletions pandas-stubs/io/formats/style.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ from typing import (

from matplotlib.colors import Colormap
import numpy as np
from pandas import Index
from pandas.core.frame import DataFrame
from pandas.core.series import Series

Expand All @@ -26,6 +25,7 @@ from pandas._typing import (
Level,
QuantileInterpolation,
Scalar,
StorageOptions,
T,
WriteBuffer,
WriteExcelBuffer,
Expand Down Expand Up @@ -53,10 +53,6 @@ class _DataFrameFunc(Protocol):
) -> npt.NDArray | DataFrame: ...

class Styler(StylerRenderer):
@property
def columns(self) -> Index[Any]: ...
@property
def index(self) -> Index[Any]: ...
def __init__(
self,
data: DataFrame | Series,
Expand All @@ -79,6 +75,7 @@ class Styler(StylerRenderer):
ttips: DataFrame,
props: CSSProperties | None = ...,
css_class: str | None = ...,
as_title_attribute: bool = ...,
) -> Styler: ...
def to_excel(
self,
Expand All @@ -98,8 +95,7 @@ class Styler(StylerRenderer):
inf_rep: str = ...,
verbose: bool = ...,
freeze_panes: tuple[int, int] | None = ...,
# TODO: Listed in docs but not in function decl
# storage_options: StorageOptions = ...,
storage_options: StorageOptions | None = ...,
) -> None: ...
@overload
def to_latex(
Expand Down Expand Up @@ -314,7 +310,7 @@ class Styler(StylerRenderer):
axis: Axis | None = ...,
*,
color: str | list[str] | tuple[str, str] | None = ...,
cmap: str | Colormap = ...,
cmap: str | Colormap | None = ...,
width: float = ...,
height: float = ...,
align: (
Expand Down
4 changes: 4 additions & 0 deletions pandas-stubs/io/formats/style_render.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ class StylerRenderer:
axis: Axis = ...,
level: Level | list[Level] | None = ...,
) -> Self: ...
@property
def columns(self) -> Index[Any]: ...
@property
def index(self) -> Index[Any]: ...
23 changes: 0 additions & 23 deletions pandas-stubs/io/gbq.pyi

This file was deleted.

3 changes: 3 additions & 0 deletions pandas-stubs/io/orc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ def read_orc(
path: FilePath | ReadBuffer[bytes],
columns: list[HashableT] | None = ...,
dtype_backend: DtypeBackend | NoDefault = ...,
# TODO type with the correct pyarrow types
# filesystem: pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem
filesystem: Any | None = ...,
**kwargs: Any,
) -> DataFrame: ...
5 changes: 4 additions & 1 deletion pandas-stubs/io/sql.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from abc import abstractmethod
from collections.abc import (
Callable,
Generator,
Expand Down Expand Up @@ -143,7 +144,7 @@ def read_sql(
) -> DataFrame: ...

class PandasSQL:
def read_sql(self, *args, **kwargs): ...
@abstractmethod
def to_sql(
self,
frame: DataFrame,
Expand All @@ -159,6 +160,8 @@ class PandasSQL:
| Callable[[SQLTable, Any, list[str], Iterable], int | None]
| None
) = ...,
engine: str = ...,
**engine_kwargs,
) -> int | None: ...

class SQLTable:
Expand Down
5 changes: 2 additions & 3 deletions pandas-stubs/tseries/frequencies.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ from pandas.tseries.offsets import DateOffset

def get_period_alias(offset_str: str) -> str | None: ...
@overload
def to_offset(freq: None) -> None: ...
def to_offset(freq: None, is_period: bool = ...) -> None: ...
@overload
def to_offset(freq: Frequency) -> DateOffset: ...
def get_offset(name: str) -> DateOffset: ...
def to_offset(freq: Frequency, is_period: bool = ...) -> DateOffset: ...
def infer_freq(index: Series | DatetimeIndex | TimedeltaIndex) -> str | None: ...
2 changes: 1 addition & 1 deletion pandas-stubs/util/_tester.pyi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
def test(extra_args=...) -> None: ...
def test(extra_args: list[str] | None = None, run_doctests: bool = False) -> None: ...
5 changes: 3 additions & 2 deletions pandas-stubs/util/_validators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def validate_kwargs(fname, kwargs, compat_args) -> None: ...
def validate_args_and_kwargs(
fname, args, kwargs, max_fname_arg_count, compat_args
) -> None: ...
def validate_bool_kwarg(value, arg_name): ...
def validate_axis_style_args(data, args, kwargs, arg_name, method_name): ...
def validate_bool_kwarg(
value, arg_name: str, none_allowed: bool = True, int_allowed: bool = False
): ...
def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = ...): ...
def validate_percentile(q: float | Iterable[float]) -> np.ndarray: ...