Skip to content

Commit f15265e

Browse files
authored
Add overloads to sphinx.pyi for better type hints
1 parent d3889ed commit f15265e

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

stubs/Deprecated/deprecated/sphinx.pyi

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Callable
2-
from typing import Any, Literal, TypeVar
2+
from typing import Any, Literal, TypeVar, overload
33

44
from .classic import ClassicAdapter, _Actions
55

@@ -17,11 +17,26 @@ class SphinxAdapter(ClassicAdapter):
1717
reason: str = "",
1818
version: str = "",
1919
action: _Actions | None = None,
20-
category: type[Warning] = ...,
20+
category: type[Warning] = DeprecationWarning,
2121
extra_stacklevel: int = 0,
2222
line_length: int = 70,
2323
) -> None: ...
24+
@overload
25+
def __call__(self, wrapped: _F) -> _F: ...
26+
27+
@overload
2428
def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ...
29+
"""
30+
:param wrapped: Wrapped class or function.
31+
32+
:return: the decorated class or function.
33+
"""
34+
def get_deprecated_msg(self, wrapped: _F, instance: Any) -> str: ...
35+
"""
36+
:param wrapped: Wrapped class or function.
37+
38+
:param instance: The object to which the wrapped function was bound when it was called.
39+
"""
2540

2641
def versionadded(reason: str = "", version: str = "", line_length: int = 70) -> Callable[[_F], _F]: ...
2742
def versionchanged(reason: str = "", version: str = "", line_length: int = 70) -> Callable[[_F], _F]: ...

0 commit comments

Comments
 (0)