From f15265eba3bd38e02442869a214c50e8e72be059 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Thu, 14 May 2026 00:34:12 +0330 Subject: [PATCH 1/6] Add overloads to sphinx.pyi for better type hints --- stubs/Deprecated/deprecated/sphinx.pyi | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index d5ae7e23fe24..133233a7a727 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable -from typing import Any, Literal, TypeVar +from typing import Any, Literal, TypeVar, overload from .classic import ClassicAdapter, _Actions @@ -17,11 +17,26 @@ class SphinxAdapter(ClassicAdapter): reason: str = "", version: str = "", action: _Actions | None = None, - category: type[Warning] = ..., + category: type[Warning] = DeprecationWarning, extra_stacklevel: int = 0, line_length: int = 70, ) -> None: ... + @overload + def __call__(self, wrapped: _F) -> _F: ... + + @overload def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... + """ + :param wrapped: Wrapped class or function. + + :return: the decorated class or function. + """ + def get_deprecated_msg(self, wrapped: _F, instance: Any) -> str: ... + """ + :param wrapped: Wrapped class or function. + + :param instance: The object to which the wrapped function was bound when it was called. + """ def versionadded(reason: str = "", version: str = "", line_length: int = 70) -> Callable[[_F], _F]: ... def versionchanged(reason: str = "", version: str = "", line_length: int = 70) -> Callable[[_F], _F]: ... From 9e44db166c8773638bea3ceb39de220c1e30fa71 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 21:08:39 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/Deprecated/deprecated/sphinx.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index 133233a7a727..79604a87f0fb 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -23,7 +23,6 @@ class SphinxAdapter(ClassicAdapter): ) -> None: ... @overload def __call__(self, wrapped: _F) -> _F: ... - @overload def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... """ @@ -34,7 +33,7 @@ class SphinxAdapter(ClassicAdapter): def get_deprecated_msg(self, wrapped: _F, instance: Any) -> str: ... """ :param wrapped: Wrapped class or function. - + :param instance: The object to which the wrapped function was bound when it was called. """ From 9b609295c947f48d0c3bde00995a8adda3bbf343 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Thu, 14 May 2026 00:52:05 +0330 Subject: [PATCH 3/6] Update type hint for get_deprecated_msg parameters --- stubs/Deprecated/deprecated/sphinx.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index 79604a87f0fb..7216606d2a28 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -30,7 +30,7 @@ class SphinxAdapter(ClassicAdapter): :return: the decorated class or function. """ - def get_deprecated_msg(self, wrapped: _F, instance: Any) -> str: ... + def get_deprecated_msg(self, wrapped:Any, instance: Any) -> str: ... """ :param wrapped: Wrapped class or function. From a0e6954c42009f151bf21a5a6908243832ea9019 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 21:24:01 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/Deprecated/deprecated/sphinx.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index 7216606d2a28..25a0ed1c95e2 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -30,7 +30,7 @@ class SphinxAdapter(ClassicAdapter): :return: the decorated class or function. """ - def get_deprecated_msg(self, wrapped:Any, instance: Any) -> str: ... + def get_deprecated_msg(self, wrapped: Any, instance: Any) -> str: ... """ :param wrapped: Wrapped class or function. From 38be5849fbec376e1c4f94f2e921f149b1e6f6f8 Mon Sep 17 00:00:00 2001 From: "Mr.Hoseini" Date: Thu, 14 May 2026 08:06:31 +0330 Subject: [PATCH 5/6] Remove overloads from __call__ method Removed overloads for the __call__ method in sphinx.pyi. --- stubs/Deprecated/deprecated/sphinx.pyi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index 25a0ed1c95e2..726608e27d7a 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -21,15 +21,7 @@ class SphinxAdapter(ClassicAdapter): extra_stacklevel: int = 0, line_length: int = 70, ) -> None: ... - @overload - def __call__(self, wrapped: _F) -> _F: ... - @overload def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... - """ - :param wrapped: Wrapped class or function. - - :return: the decorated class or function. - """ def get_deprecated_msg(self, wrapped: Any, instance: Any) -> str: ... """ :param wrapped: Wrapped class or function. From d86b28833463e0c9cdf8ed7a56dddc9b3bc5ffc1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 04:39:22 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/Deprecated/deprecated/sphinx.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index 726608e27d7a..e2bb94f4cdd7 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable -from typing import Any, Literal, TypeVar, overload +from typing import Any, Literal, TypeVar from .classic import ClassicAdapter, _Actions