Complete singledispatch stub (#9201)

This commit is contained in:
Nikita Sobolev
2022-11-15 19:09:45 +03:00
committed by GitHub
parent 72d1597de2
commit 64bb9ef8b3
3 changed files with 9 additions and 2 deletions

View File

@@ -1 +1,2 @@
singledispatch.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable
# Internal utils, we are not interested in them:
singledispatch.helpers

View File

@@ -1 +1,4 @@
version = "3.7.*"
[tool.stubtest]
ignore_missing_stub = false

View File

@@ -2,6 +2,7 @@ from collections.abc import Callable, Mapping
from typing import Any, Generic, TypeVar, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
class _SingleDispatchCallable(Generic[_T]):
registry: Mapping[Any, Callable[..., _T]]
@@ -19,10 +20,12 @@ class singledispatchmethod(Generic[_T]):
dispatcher: _SingleDispatchCallable[_T]
func: Callable[..., _T]
def __init__(self, func: Callable[..., _T]) -> None: ...
@property
def __isabstractmethod__(self) -> bool: ...
@overload
def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ...
@overload
def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _S, cls: type[_S] | None = ...) -> Callable[..., _T]: ...