mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Complete singledispatch stub (#9201)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
version = "3.7.*"
|
||||
|
||||
[tool.stubtest]
|
||||
ignore_missing_stub = false
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
Reference in New Issue
Block a user