From 4f065cea5444902f01d05e66f54d976cac495e2f Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Fri, 31 Oct 2025 19:17:15 +0400 Subject: [PATCH] [Deprecated] Update to ~=1.3.1 (#14954) --- stubs/Deprecated/METADATA.toml | 2 +- stubs/Deprecated/deprecated/__init__.pyi | 11 ++++++++--- stubs/Deprecated/deprecated/params.pyi | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 stubs/Deprecated/deprecated/params.pyi diff --git a/stubs/Deprecated/METADATA.toml b/stubs/Deprecated/METADATA.toml index 3a8731212..d56539265 100644 --- a/stubs/Deprecated/METADATA.toml +++ b/stubs/Deprecated/METADATA.toml @@ -1,3 +1,3 @@ -version = "~=1.2.15" +version = "~=1.3.1" upstream_repository = "https://github.com/tantale/deprecated" requires = [] diff --git a/stubs/Deprecated/deprecated/__init__.pyi b/stubs/Deprecated/deprecated/__init__.pyi index c7b200a4e..3d4b2bfd8 100644 --- a/stubs/Deprecated/deprecated/__init__.pyi +++ b/stubs/Deprecated/deprecated/__init__.pyi @@ -1,4 +1,9 @@ -from .classic import deprecated as deprecated +from typing import Final -__credits__: str -__date__: str +from .classic import deprecated as deprecated +from .params import deprecated_params as deprecated_params + +__version__: Final[str] +__author__: Final[str] +__date__: Final[str] +__credits__: Final[str] diff --git a/stubs/Deprecated/deprecated/params.pyi b/stubs/Deprecated/deprecated/params.pyi new file mode 100644 index 000000000..b1955646d --- /dev/null +++ b/stubs/Deprecated/deprecated/params.pyi @@ -0,0 +1,20 @@ +from collections.abc import Callable, Iterable +from inspect import Signature +from typing import Any, TypeVar +from typing_extensions import ParamSpec + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +class DeprecatedParams: + messages: dict[str, str] + category: type[Warning] + def __init__(self, param: str | dict[str, str], reason: str = "", category: type[Warning] = ...) -> None: ... + def populate_messages(self, param: str | dict[str, str], reason: str = "") -> None: ... + def check_params( + self, signature: Signature, *args: Any, **kwargs: Any # args and kwargs passing to Signature.bind method + ) -> list[str]: ... + def warn_messages(self, messages: Iterable[str]) -> None: ... + def __call__(self, f: Callable[_P, _R]) -> Callable[_P, _R]: ... + +deprecated_params = DeprecatedParams