mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-05 14:44:18 +08:00
Improve [Async]ContextDecorator type hinting (#13416)
Updated annotations allow access to `__wrapped__` on decorated callables without complaints from typecheckers.
This commit is contained in:
@@ -7,7 +7,6 @@ from re import Pattern
|
||||
from typing import Any, Literal, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
_Func = TypeVar("_Func", bound=Callable[..., Any])
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
@@ -65,8 +64,7 @@ def decorator(
|
||||
caller: Callable[..., Any], _func: Callable[..., Any] | None = ...
|
||||
) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...
|
||||
|
||||
class ContextManager(_GeneratorContextManager[_T]):
|
||||
def __call__(self, func: _C) -> _C: ...
|
||||
class ContextManager(_GeneratorContextManager[_T]): ...
|
||||
|
||||
def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, ContextManager[_T]]: ...
|
||||
def append(a: type, vancestors: list[type]) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user