massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / decorator / decorator.pyi
1 import sys
2 from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar
3
4 _C = TypeVar("_C", bound=Callable[..., Any])
5 _Func = TypeVar("_Func", bound=Callable[..., Any])
6 _T = TypeVar("_T")
7
8 def get_init(cls: type) -> None: ...
9
10 if sys.version_info >= (3,):
11     from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
12 else:
13     class FullArgSpec(NamedTuple):
14         args: list[str]
15         varargs: str | None
16         varkw: str | None
17         defaults: Tuple[Any, ...]
18         kwonlyargs: list[str]
19         kwonlydefaults: dict[str, Any]
20         annotations: dict[str, Any]
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 _dict = dict  # conflicts with attribute name
32
33 class FunctionMaker(object):
34     args: list[Text]
35     varargs: Text | None
36     varkw: Text | None
37     defaults: Tuple[Any, ...]
38     kwonlyargs: list[Text]
39     kwonlydefaults: Text | None
40     shortsignature: Text | None
41     name: Text
42     doc: Text | None
43     module: Text | None
44     annotations: _dict[Text, Any]
45     signature: Text
46     dict: _dict[Text, Any]
47     def __init__(
48         self,
49         func: Callable[..., Any] | None = ...,
50         name: Text | None = ...,
51         signature: Text | None = ...,
52         defaults: Tuple[Any, ...] | None = ...,
53         doc: Text | None = ...,
54         module: Text | None = ...,
55         funcdict: _dict[Text, Any] | None = ...,
56     ) -> None: ...
57     def update(self, func: Any, **kw: Any) -> None: ...
58     def make(
59         self, src_templ: Text, evaldict: _dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any
60     ) -> Callable[..., Any]: ...
61     @classmethod
62     def create(
63         cls,
64         obj: Any,
65         body: Text,
66         evaldict: _dict[Text, Any],
67         defaults: Tuple[Any, ...] | None = ...,
68         doc: Text | None = ...,
69         module: Text | None = ...,
70         addsource: bool = ...,
71         **attrs: Any,
72     ) -> Callable[..., Any]: ...
73
74 def decorate(func: _Func, caller: Callable[..., Any], extras: Any = ...) -> _Func: ...
75 def decorator(
76     caller: Callable[..., Any], _func: Callable[..., Any] | None = ...
77 ) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...
78
79 class ContextManager(_GeneratorContextManager[_T]):
80     def __call__(self, func: _C) -> _C: ...
81
82 def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
83 def dispatch_on(*dispatch_args: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...