diff --git a/third_party/2and3/decorator.pyi b/third_party/2and3/decorator.pyi index 18c919f87..ee090a6b9 100644 --- a/third_party/2and3/decorator.pyi +++ b/third_party/2and3/decorator.pyi @@ -1,8 +1,9 @@ import sys -from typing import Any, Callable, Dict, List, NamedTuple, Optional, Pattern, Text, Tuple, TypeVar +from typing import Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Pattern, Text, Tuple, TypeVar _C = TypeVar("_C", bound=Callable[..., Any]) _Func = TypeVar("_Func", bound=Callable[..., Any]) +_T = TypeVar("_T") def get_init(cls): ... @@ -76,8 +77,8 @@ class FunctionMaker(object): def decorate(func: _Func, caller: Callable[..., Any], extras: Any = ...) -> _Func: ... def decorator(caller: Callable[..., Any], _func: Optional[Callable[..., Any]] = ...) -> Callable[[_C], _C]: ... -class ContextManager(_GeneratorContextManager[Any]): +class ContextManager(_GeneratorContextManager[_T]): def __call__(self, func: _C) -> _C: ... -def contextmanager(func: _C) -> _C: ... +def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ... def dispatch_on(*dispatch_args: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...