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