Skip to content

Commit 89ef548

Browse files
committed
Remove more deprecations
1 parent 6e002f8 commit 89ef548

File tree

8 files changed

+37
-40
lines changed

8 files changed

+37
-40
lines changed

pandas-stubs/_testing/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def assert_series_equal(
6060
check_dtype: bool = ...,
6161
check_index_type: bool | str = ...,
6262
check_series_type: bool = ...,
63-
check_less_precise: bool | int = ...,
6463
check_names: bool = ...,
6564
check_exact: bool = ...,
6665
check_datetimelike_compat: bool = ...,

pandas-stubs/core/frame.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,9 +1428,7 @@ class DataFrame(NDFrame, OpsMixin):
14281428
ignore_na: _bool = ...,
14291429
axis: AxisType = ...,
14301430
) -> DataFrame: ...
1431-
def expanding(
1432-
self, min_periods: int = ..., center: _bool = ..., axis: AxisType = ...
1433-
): ... # for now
1431+
def expanding(self, min_periods: int = ..., axis: AxisType = ...): ... # for now
14341432
@overload
14351433
def ffill(
14361434
self,

pandas-stubs/core/series.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,30 +525,31 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
525525
@overload
526526
def sort_values(
527527
self,
528+
*,
528529
axis: AxisType = ...,
529530
ascending: _bool | Sequence[_bool] = ...,
530531
kind: SortKind = ...,
531532
na_position: NaPosition = ...,
532533
ignore_index: _bool = ...,
533-
*,
534534
inplace: Literal[True],
535535
key: Callable | None = ...,
536536
) -> None: ...
537537
@overload
538538
def sort_values(
539539
self,
540+
*,
540541
axis: AxisType = ...,
541542
ascending: _bool | Sequence[_bool] = ...,
542543
kind: SortKind = ...,
543544
na_position: NaPosition = ...,
544545
ignore_index: _bool = ...,
545-
*,
546546
inplace: Literal[False] = ...,
547547
key: Callable | None = ...,
548548
) -> Series[S1]: ...
549549
@overload
550550
def sort_values(
551551
self,
552+
*,
552553
axis: AxisType = ...,
553554
ascending: _bool | Sequence[_bool] = ...,
554555
inplace: _bool | None = ...,
@@ -1325,7 +1326,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
13251326
axis: SeriesAxisType = ...,
13261327
) -> ExponentialMovingWindow: ...
13271328
def expanding(
1328-
self, min_periods: int = ..., center: _bool = ..., axis: SeriesAxisType = ...
1329+
self, min_periods: int = ..., axis: SeriesAxisType = ...
13291330
) -> DataFrame: ...
13301331
def floordiv(
13311332
self,

pandas-stubs/io/parsers.pyi

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ def read_csv(
4646
names=...,
4747
index_col=...,
4848
usecols: ListLike | Callable | None = ...,
49-
squeeze: bool | None = ...,
50-
prefix: str | None = ...,
5149
mangle_dupe_cols: bool = ...,
5250
dtype: DtypeArg | None = ...,
5351
engine: CSVEngine | None = ...,
@@ -104,8 +102,6 @@ def read_csv(
104102
names=...,
105103
index_col=...,
106104
usecols: ListLike | Callable | None = ...,
107-
squeeze: bool | None = ...,
108-
prefix: str | None = ...,
109105
mangle_dupe_cols: bool = ...,
110106
dtype: DtypeArg | None = ...,
111107
engine: CSVEngine | None = ...,
@@ -162,8 +158,6 @@ def read_csv(
162158
names=...,
163159
index_col=...,
164160
usecols: ListLike | Callable | None = ...,
165-
squeeze: bool | None = ...,
166-
prefix: str | None = ...,
167161
mangle_dupe_cols: bool = ...,
168162
dtype: DtypeArg | None = ...,
169163
engine: CSVEngine | None = ...,
@@ -220,8 +214,6 @@ def read_csv(
220214
names=...,
221215
index_col=...,
222216
usecols: ListLike | Callable | None = ...,
223-
squeeze: bool | None = ...,
224-
prefix: str | None = ...,
225217
mangle_dupe_cols: bool = ...,
226218
dtype: DtypeArg | None = ...,
227219
engine: CSVEngine | None = ...,
@@ -278,8 +270,6 @@ def read_table(
278270
names=...,
279271
index_col=...,
280272
usecols=...,
281-
squeeze: bool | None = ...,
282-
prefix: str | None = ...,
283273
mangle_dupe_cols: bool = ...,
284274
dtype: DtypeArg | None = ...,
285275
engine: CSVEngine | None = ...,
@@ -336,8 +326,6 @@ def read_table(
336326
names=...,
337327
index_col=...,
338328
usecols=...,
339-
squeeze: bool | None = ...,
340-
prefix: str | None = ...,
341329
mangle_dupe_cols: bool = ...,
342330
dtype: DtypeArg | None = ...,
343331
engine: CSVEngine | None = ...,
@@ -394,8 +382,6 @@ def read_table(
394382
names=...,
395383
index_col=...,
396384
usecols=...,
397-
squeeze: bool | None = ...,
398-
prefix: str | None = ...,
399385
mangle_dupe_cols: bool = ...,
400386
dtype: DtypeArg | None = ...,
401387
engine: CSVEngine | None = ...,
@@ -452,8 +438,6 @@ def read_table(
452438
names=...,
453439
index_col=...,
454440
usecols=...,
455-
squeeze: bool | None = ...,
456-
prefix: str | None = ...,
457441
mangle_dupe_cols: bool = ...,
458442
dtype: DtypeArg | None = ...,
459443
engine: CSVEngine | None = ...,

tests/test_frame.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
from pandas._typing import Scalar
3535

36-
from tests import check
36+
from tests import (
37+
TYPE_CHECKING_INVALID_USAGE,
38+
check,
39+
)
3740

3841
from pandas.io.parsers import TextFileReader
3942

@@ -714,8 +717,9 @@ def test_types_plot() -> None:
714717
def test_types_window() -> None:
715718
df = pd.DataFrame(data={"col1": [1, 1, 2], "col2": [3, 4, 5]})
716719
df.expanding()
717-
with pytest.warns(FutureWarning, match="The `center` argument on"):
718-
df.expanding(axis=1, center=True)
720+
df.expanding(axis=1)
721+
if TYPE_CHECKING_INVALID_USAGE:
722+
df.expanding(axis=1, center=True) # type: ignore[call-arg]
719723

720724
df.rolling(2)
721725
df.rolling(2, axis=1, center=True)

tests/test_pandas.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import pandas as pd
1111
from pandas._testing import ensure_clean
1212
from pandas.api.extensions import ExtensionArray
13-
import pytest
1413
from typing_extensions import assert_type
1514

16-
from tests import check
15+
from tests import (
16+
TYPE_CHECKING_INVALID_USAGE,
17+
check,
18+
)
1719

1820
from pandas.io.parsers import TextFileReader
1921

@@ -122,10 +124,11 @@ def test_types_read_csv() -> None:
122124
with ensure_clean() as path:
123125
df.to_csv(path)
124126
df2: pd.DataFrame = pd.read_csv(path)
125-
with pytest.warns(FutureWarning, match="The squeeze argument"):
126-
df3: pd.DataFrame = pd.read_csv(path, sep="a", squeeze=False)
127-
with pytest.warns(FutureWarning, match="The prefix argument has been"):
128-
df4: pd.DataFrame = pd.read_csv(
127+
if TYPE_CHECKING_INVALID_USAGE:
128+
df3: pd.DataFrame = pd.read_csv( # type: ignore[call-overload]
129+
path, sep="a", squeeze=False
130+
)
131+
df4: pd.DataFrame = pd.read_csv( # type: ignore[call-overload]
129132
path,
130133
header=None,
131134
prefix="b",

tests/test_series.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ def test_types_sort_index_with_key() -> None:
227227
def test_types_sort_values() -> None:
228228
s = pd.Series([4, 2, 1, 3])
229229
check(assert_type(s.sort_values(), pd.Series), pd.Series)
230-
with pytest.warns(FutureWarning, match="In a future version of pandas"):
231-
check(assert_type(s.sort_values(0), pd.Series), pd.Series)
230+
if TYPE_CHECKING_INVALID_USAGE:
231+
check(assert_type(s.sort_values(0), pd.Series), pd.Series) # type: ignore[assert-type,call-overload]
232+
check(assert_type(s.sort_values(axis=0), pd.Series), pd.Series)
232233
check(assert_type(s.sort_values(ascending=False), pd.Series), pd.Series)
233234
assert assert_type(s.sort_values(inplace=True, kind="quicksort"), None) is None
234235
check(assert_type(s.sort_values(na_position="last"), pd.Series), pd.Series)
@@ -491,8 +492,9 @@ def test_types_plot() -> None:
491492
def test_types_window() -> None:
492493
s = pd.Series([0, 1, 1, 0, 5, 1, -10])
493494
s.expanding()
494-
with pytest.warns(FutureWarning, match="The `center` argument"):
495-
s.expanding(axis=0, center=True)
495+
s.expanding(axis=0)
496+
if TYPE_CHECKING_INVALID_USAGE:
497+
s.expanding(axis=0, center=True) # type: ignore[call-arg]
496498

497499
s.rolling(2)
498500
s.rolling(2, axis=0, center=True)

tests/test_testing.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
assert_frame_equal,
99
assert_series_equal,
1010
)
11-
import pytest
1211
from typing_extensions import assert_type
1312

14-
from tests import check
13+
from tests import (
14+
TYPE_CHECKING_INVALID_USAGE,
15+
check,
16+
)
1517

1618

1719
def test_types_assert_series_equal() -> None:
@@ -26,9 +28,13 @@ def test_types_assert_series_equal() -> None:
2628
check_flags=True,
2729
check_datetimelike_compat=True,
2830
)
29-
with pytest.warns(FutureWarning, match="The 'check_less_precise'"):
31+
if TYPE_CHECKING_INVALID_USAGE:
3032
assert_series_equal(
31-
s1, s2, check_dtype=True, check_less_precise=True, check_names=True
33+
s1,
34+
s2,
35+
check_dtype=True,
36+
check_less_precise=True, # type: ignore[call-arg]
37+
check_names=True,
3238
)
3339

3440

0 commit comments

Comments
 (0)