From 8dd513a4c938976e45dfbcc351714b347835c0b8 Mon Sep 17 00:00:00 2001 From: Loic Diridollou Date: Sat, 30 Nov 2024 19:59:16 -0500 Subject: [PATCH 1/4] GH1065 Timestamp freq argument removal --- pandas-stubs/__init__.pyi | 4 +++- pandas-stubs/_libs/tslibs/timestamps.pyi | 7 +------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pandas-stubs/__init__.pyi b/pandas-stubs/__init__.pyi index f164b0589..af9af0189 100644 --- a/pandas-stubs/__init__.pyi +++ b/pandas-stubs/__init__.pyi @@ -122,7 +122,9 @@ from pandas.io.api import ( read_xml as read_xml, to_pickle as to_pickle, ) -from pandas.io.json._normalize import json_normalize as json_normalize +from pandas.io.json import ( # pyright: ignore[reportUnusedImport] # noqa: F401 + _json_normalize as json_normalize, +) from pandas.tseries import offsets as offsets from pandas.tseries.api import infer_freq as infer_freq diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 9df14b3d4..cdb09bf30 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -59,9 +59,6 @@ class Timestamp(datetime): def __new__( cls, ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ..., - # Freq is deprecated but is left in to allow code like Timestamp(2000,1,1) - # Removing it would make the other arguments position only - freq: int | str | BaseOffset | None = ..., tz: str | _tzinfo | int | None = ..., unit: str | int | None = ..., year: int | None = ..., @@ -71,9 +68,9 @@ class Timestamp(datetime): minute: int | None = ..., second: int | None = ..., microsecond: int | None = ..., + *, nanosecond: int | None = ..., tzinfo: _tzinfo | None = ..., - *, fold: Literal[0, 1] | None = ..., ) -> Self: ... # GH 46171 @@ -119,8 +116,6 @@ class Timestamp(datetime): def fromordinal( cls, ordinal: int, - # freq produces a FutureWarning about being deprecated in a future version - freq: None = ..., tz: _tzinfo | str | None = ..., ) -> Self: ... @classmethod From 189f84096a34aec8dd0e4048667aa4c823e41889 Mon Sep 17 00:00:00 2001 From: Loic Diridollou Date: Sat, 30 Nov 2024 21:19:17 -0500 Subject: [PATCH 2/4] GH1065 Add details to type of other in mask --- pandas-stubs/core/frame.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 57f1671e9..7b5a80799 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -1955,7 +1955,7 @@ class DataFrame(NDFrame, OpsMixin): | Callable[[DataFrame], DataFrame] | Callable[[Any], _bool] ), - other=..., + other: Scalar | Series[S1] | DataFrame | Callable | NAType | None = ..., *, inplace: _bool = ..., axis: Axis | None = ..., From 8bd0ac6b4395754cfd9771ce4857e29d18ab1c99 Mon Sep 17 00:00:00 2001 From: Loic Diridollou Date: Sat, 30 Nov 2024 21:26:03 -0500 Subject: [PATCH 3/4] GH1065 Revert json --- pandas-stubs/__init__.pyi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandas-stubs/__init__.pyi b/pandas-stubs/__init__.pyi index af9af0189..f164b0589 100644 --- a/pandas-stubs/__init__.pyi +++ b/pandas-stubs/__init__.pyi @@ -122,9 +122,7 @@ from pandas.io.api import ( read_xml as read_xml, to_pickle as to_pickle, ) -from pandas.io.json import ( # pyright: ignore[reportUnusedImport] # noqa: F401 - _json_normalize as json_normalize, -) +from pandas.io.json._normalize import json_normalize as json_normalize from pandas.tseries import offsets as offsets from pandas.tseries.api import infer_freq as infer_freq From 9b24c32f9a07f9d77e06b538d637301787345417 Mon Sep 17 00:00:00 2001 From: Loic Diridollou Date: Sat, 30 Nov 2024 21:44:15 -0500 Subject: [PATCH 4/4] GH1065 Realign Timestamp args with pandas --- pandas-stubs/_libs/tslibs/timestamps.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index cdb09bf30..504b801cc 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -59,8 +59,6 @@ class Timestamp(datetime): def __new__( cls, ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ..., - tz: str | _tzinfo | int | None = ..., - unit: str | int | None = ..., year: int | None = ..., month: int | None = ..., day: int | None = ..., @@ -68,9 +66,11 @@ class Timestamp(datetime): minute: int | None = ..., second: int | None = ..., microsecond: int | None = ..., + tzinfo: _tzinfo | None = ..., *, nanosecond: int | None = ..., - tzinfo: _tzinfo | None = ..., + tz: str | _tzinfo | int | None = ..., + unit: str | int | None = ..., fold: Literal[0, 1] | None = ..., ) -> Self: ... # GH 46171