Skip to content

Commit 88193cd

Browse files
authored
seaborn: mark simple deprecations (#11130)
1 parent d373050 commit 88193cd

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

stubs/seaborn/seaborn/algorithms.pyi

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@ from numpy.typing import ArrayLike, NDArray
55

66
from .utils import _Seed
77

8+
# TODO: This crashes stubtest. Uncomment when mypy 1.8 is released with the fix https://github.com/python/mypy/pull/16457
9+
# @overload
10+
# def bootstrap(
11+
# *args: ArrayLike,
12+
# n_boot: int = 10000,
13+
# func: str | Callable[..., Any] = "mean",
14+
# axis: int | None = None,
15+
# units: ArrayLike | None = None,
16+
# seed: _Seed | None = None,
17+
# ) -> NDArray[Any]: ...
18+
# @overload
19+
# @deprecated("Parameter `random_seed` is deprecated in favor of `seed`")
820
def bootstrap(
921
*args: ArrayLike,
1022
n_boot: int = 10000,
1123
func: str | Callable[..., Any] = "mean",
1224
axis: int | None = None,
1325
units: ArrayLike | None = None,
1426
seed: _Seed | None = None,
15-
random_seed: _Seed | None = None, # deprecated
27+
random_seed: _Seed | None = None,
1628
) -> NDArray[Any]: ...

stubs/seaborn/seaborn/axisgrid.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import os
22
from _typeshed import Incomplete
33
from collections.abc import Callable, Generator, Iterable, Mapping
44
from typing import IO, Any, TypeVar
5-
from typing_extensions import Concatenate, Literal, ParamSpec, Self, TypeAlias
5+
from typing_extensions import Concatenate, Literal, ParamSpec, Self, TypeAlias, deprecated
66

77
import numpy as np
88
from matplotlib.artist import Artist
@@ -92,6 +92,7 @@ class _BaseGrid:
9292
**kwargs: Any,
9393
) -> Self: ...
9494
@property
95+
@deprecated("Attribute `fig` is deprecated in favor of `figure`")
9596
def fig(self) -> Figure: ...
9697
@property
9798
def figure(self) -> Figure: ...

stubs/seaborn/seaborn/distributions.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Incomplete
22
from collections.abc import Iterable
33
from typing import Any
4-
from typing_extensions import Literal
4+
from typing_extensions import Literal, deprecated
55

66
from matplotlib.axes import Axes
77
from matplotlib.colors import Colormap
@@ -139,7 +139,8 @@ def displot(
139139
facet_kws: dict[str, Any] | None = None,
140140
**kwargs: Any,
141141
) -> FacetGrid: ...
142-
def distplot( # deprecated
142+
@deprecated("Function `distplot` is deprecated and will be removed in seaborn v0.14.0")
143+
def distplot(
143144
a: Incomplete | None = None,
144145
bins: Incomplete | None = None,
145146
hist: bool = True,

stubs/seaborn/seaborn/rcmod.pyi

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Unused
22
from collections.abc import Callable, Sequence
33
from typing import Any, TypeVar
4-
from typing_extensions import Literal
4+
from typing_extensions import Literal, deprecated
55

66
from matplotlib.typing import ColorType
77

@@ -30,10 +30,16 @@ def set_theme(
3030
color_codes: bool = True,
3131
rc: dict[str, Any] | None = None,
3232
) -> None: ...
33-
34-
# def set(*args, **kwargs) -> None: ... # deprecated alias for set_theme
35-
set = set_theme
36-
33+
@deprecated("Function `set` is deprecated in favor of `set_theme`")
34+
def set(
35+
context: Literal["paper", "notebook", "talk", "poster"] | dict[str, Any] = "notebook",
36+
style: Literal["white", "dark", "whitegrid", "darkgrid", "ticks"] | dict[str, Any] = "darkgrid",
37+
palette: str | Sequence[ColorType] | None = "deep",
38+
font: str = "sans-serif",
39+
font_scale: float = 1,
40+
color_codes: bool = True,
41+
rc: dict[str, Any] | None = None,
42+
) -> None: ...
3743
def reset_defaults() -> None: ...
3844
def reset_orig() -> None: ...
3945
def axes_style(

stubs/seaborn/seaborn/utils.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import datetime as dt
22
from _typeshed import Incomplete, SupportsGetItem
33
from collections.abc import Callable, Iterable, Mapping, Sequence
44
from typing import Any, TypeVar, overload
5-
from typing_extensions import Literal, SupportsIndex, TypeAlias
5+
from typing_extensions import Literal, SupportsIndex, TypeAlias, deprecated
66

77
import numpy as np
88
import pandas as pd
@@ -75,7 +75,8 @@ def saturate(color: ColorType) -> tuple[float, float, float]: ...
7575
def set_hls_values(
7676
color: ColorType, h: float | None = None, l: float | None = None, s: float | None = None
7777
) -> tuple[float, float, float]: ...
78-
def axlabel(xlabel: str, ylabel: str, **kwargs: Any) -> None: ... # deprecated
78+
@deprecated("Function `axlabel` is deprecated and will be removed in a future version")
79+
def axlabel(xlabel: str, ylabel: str, **kwargs: Any) -> None: ...
7980
def remove_na(vector: _VectorT) -> _VectorT: ...
8081
def get_color_cycle() -> list[str]: ...
8182

0 commit comments

Comments
 (0)