|
1 | 1 | import inspect
|
2 | 2 | from builtins import dict as _dict # alias to avoid conflicts with attribute name
|
3 |
| -from collections.abc import Callable, Iterator |
| 3 | +from collections.abc import Callable, Generator, Iterator |
4 | 4 | from contextlib import _GeneratorContextManager
|
5 | 5 | from inspect import Signature, getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
|
6 | 6 | from re import Pattern
|
7 |
| -from typing import Any, Literal, TypeVar |
| 7 | +from typing import Any, Final, Literal, TypeVar |
8 | 8 | from typing_extensions import ParamSpec
|
9 | 9 |
|
10 | 10 | _C = TypeVar("_C", bound=Callable[..., Any])
|
11 | 11 | _Func = TypeVar("_Func", bound=Callable[..., Any])
|
12 | 12 | _T = TypeVar("_T")
|
13 | 13 | _P = ParamSpec("_P")
|
14 | 14 |
|
15 |
| -def get_init(cls: type) -> None: ... |
16 |
| - |
17 |
| -DEF: Pattern[str] |
18 |
| -POS: Literal[inspect._ParameterKind.POSITIONAL_OR_KEYWORD] |
| 15 | +DEF: Final[Pattern[str]] |
| 16 | +POS: Final[Literal[inspect._ParameterKind.POSITIONAL_OR_KEYWORD]] |
| 17 | +EMPTY: Final[type[inspect._empty]] |
19 | 18 |
|
20 | 19 | class FunctionMaker:
|
21 | 20 | args: list[str]
|
@@ -59,13 +58,14 @@ class FunctionMaker:
|
59 | 58 | ) -> Callable[..., Any]: ...
|
60 | 59 |
|
61 | 60 | def fix(args: tuple[Any, ...], kwargs: dict[str, Any], sig: Signature) -> tuple[tuple[Any, ...], dict[str, Any]]: ...
|
62 |
| -def decorate(func: _Func, caller: Callable[..., Any], extras: Any = ...) -> _Func: ... |
| 61 | +def decorate(func: _Func, caller: Callable[..., Any], extras: tuple[Any, ...] = ..., kwsyntax: bool = False) -> _Func: ... |
63 | 62 | def decoratorx(caller: Callable[..., Any]) -> Callable[..., Any]: ...
|
64 | 63 | def decorator(
|
65 |
| - caller: Callable[..., Any], _func: Callable[..., Any] | None = ... |
| 64 | + caller: Callable[..., Any], _func: Callable[..., Any] | None = None, kwsyntax: bool = False |
66 | 65 | ) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...
|
67 | 66 |
|
68 | 67 | class ContextManager(_GeneratorContextManager[_T]):
|
| 68 | + def __init__(self, g: Callable[..., Generator[_T]], *a: Any, **k: Any) -> None: ... |
69 | 69 | def __call__(self, func: _C) -> _C: ...
|
70 | 70 |
|
71 | 71 | def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, ContextManager[_T]]: ...
|
|
0 commit comments