|
| 1 | +import sys |
| 2 | +from typing import Any, Callable, Dict, List, NamedTuple, Optional, Pattern, Text, Tuple, TypeVar |
| 3 | + |
| 4 | +_C = TypeVar("_C", bound=Callable[..., Any]) |
| 5 | +_Func = TypeVar("_Func", bound=Callable[..., Any]) |
| 6 | + |
| 7 | +def get_init(cls): ... |
| 8 | + |
| 9 | +if sys.version_info >= (3,): |
| 10 | + from inspect import iscoroutinefunction as iscoroutinefunction |
| 11 | + from inspect import getfullargspec as getfullargspec |
| 12 | +else: |
| 13 | + FullArgSpec = NamedTuple('FullArgSpec', [('args', List[str]), |
| 14 | + ('varargs', Optional[str]), |
| 15 | + ('varkw', Optional[str]), |
| 16 | + ('defaults', Tuple[Any, ...]), |
| 17 | + ('kwonlyargs', List[str]), |
| 18 | + ('kwonlydefaults', Dict[str, Any]), |
| 19 | + ('annotations', Dict[str, Any]), |
| 20 | + ]) |
| 21 | + def iscoroutinefunction(f: Callable[..., Any]) -> bool: ... |
| 22 | + def getfullargspec(func: Any) -> FullArgSpec: ... |
| 23 | + |
| 24 | +if sys.version_info >= (3, 2): |
| 25 | + from contextlib import _GeneratorContextManager |
| 26 | +else: |
| 27 | + from contextlib import GeneratorContextManager as _GeneratorContextManager |
| 28 | + |
| 29 | +DEF: Pattern[str] |
| 30 | + |
| 31 | +class FunctionMaker(object): |
| 32 | + args: List[Text] |
| 33 | + varargs: Optional[Text] |
| 34 | + varkw: Optional[Text] |
| 35 | + defaults: Tuple[Any, ...] |
| 36 | + kwonlyargs: List[Text] |
| 37 | + kwonlydefaults: Optional[Text] |
| 38 | + shortsignature: Optional[Text] |
| 39 | + name: Text |
| 40 | + doc: Optional[Text] |
| 41 | + module: Optional[Text] |
| 42 | + annotations: Dict[Text, Any] |
| 43 | + signature: Text |
| 44 | + dict: Dict[Text, Any] |
| 45 | + def __init__( |
| 46 | + self, |
| 47 | + func: Optional[Callable[..., Any]] = ..., |
| 48 | + name: Optional[Text] = ..., |
| 49 | + signature: Optional[Text] = ..., |
| 50 | + defaults: Optional[Tuple[Any, ...]] = ..., |
| 51 | + doc: Optional[Text] = ..., |
| 52 | + module: Optional[Text] = ..., |
| 53 | + funcdict: Optional[Dict[Text, Any]] = ... |
| 54 | + ) -> None: ... |
| 55 | + def update(self, func: Any, **kw: Any) -> None: ... |
| 56 | + def make( |
| 57 | + self, |
| 58 | + src_templ: Text, |
| 59 | + evaldict: Optional[Dict[Text, Any]] = ..., |
| 60 | + addsource: bool = ..., |
| 61 | + **attrs: Any |
| 62 | + ) -> Callable[..., Any]: ... |
| 63 | + @classmethod |
| 64 | + def create( |
| 65 | + cls, |
| 66 | + obj: Any, |
| 67 | + body: Text, |
| 68 | + evaldict: Dict[Text, Any], |
| 69 | + defaults: Optional[Tuple[Any, ...]] = ..., |
| 70 | + doc: Optional[Text] = ..., |
| 71 | + module: Optional[Text] = ..., |
| 72 | + addsource: bool = ..., |
| 73 | + **attrs: Any |
| 74 | + ) -> Callable[..., Any]: ... |
| 75 | + |
| 76 | +def decorate(func: _Func, caller: Callable[..., Any], extras: Any = ...) -> _Func: ... |
| 77 | +def decorator(caller: Callable[..., Any], _func: Optional[Callable[..., Any]] = ...) -> Callable[[_C], _C]: ... |
| 78 | + |
| 79 | +class ContextManager(_GeneratorContextManager[Any]): |
| 80 | + def __call__(self, func: _C) -> _C: ... |
| 81 | + |
| 82 | +def contextmanager(func: _C) -> _C: ... |
| 83 | +def dispatch_on(*dispatch_args: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ... |
0 commit comments