Fix the signature of decorator.contextmanager (#3330)

This commit is contained in:
Jukka Lehtosalo
2019-10-09 15:58:37 +01:00
committed by Sebastian Rittau
parent 824e94a933
commit 0914d50b49

View File

@@ -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]]: ...