mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-11 10:22:29 +08:00
Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Literal, Protocol, TypeVar
|
||||
from typing import Any, Literal, Protocol, TypeVar, type_check_only
|
||||
from typing_extensions import TypeAlias, deprecated
|
||||
|
||||
from matplotlib.axes import Axes
|
||||
@@ -17,6 +17,7 @@ __all__ = ["displot", "histplot", "kdeplot", "ecdfplot", "rugplot", "distplot"]
|
||||
_T = TypeVar("_T")
|
||||
_OneOrPair: TypeAlias = _T | tuple[_T, _T]
|
||||
|
||||
@type_check_only
|
||||
class _Fit(Protocol):
|
||||
def fit(self, a: ArrayLike) -> tuple[ArrayLike, ...]: ...
|
||||
def pdf(self, x: ArrayLike, *params: ArrayLike) -> ArrayLike: ...
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Literal, Protocol
|
||||
from typing import Any, Literal, Protocol, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
import numpy as np
|
||||
@@ -9,6 +9,7 @@ __all__ = ["gaussian_kde"]
|
||||
|
||||
# define a "Gaussian KDE" protocol so that we can also pass `scipy.stats.gaussian_kde` to
|
||||
# functions that expect it without adding a dependency on scipy
|
||||
@type_check_only
|
||||
class _GaussianKDELike(Protocol):
|
||||
dataset: NDArray[np.float64]
|
||||
def __init__(self, dataset: ArrayLike, bw_method: Any | None = ..., weights: ArrayLike | None = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user