Skip to content

Commit 9494a19

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Add overload definitions for transfunction decorator
1 parent d27729d commit 9494a19

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

transfunctions/decorators/transfunction.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
from inspect import currentframe
22
from types import FrameType
3-
from typing import Union, cast
3+
from typing import Union, cast, overload
44

55
from transfunctions.transformer import FunctionTransformer
66
from transfunctions.typing import Callable, FunctionParams, ReturnType
77

88

9+
@overload
10+
def transfunction(function: Callable[FunctionParams, ReturnType]) -> FunctionTransformer[FunctionParams, ReturnType]: ...
11+
12+
13+
@overload
914
def transfunction(
15+
*, check_decorators: bool = True,
16+
) -> Callable[[Callable[FunctionParams, ReturnType]], FunctionTransformer[FunctionParams, ReturnType]]: ...
17+
18+
19+
def transfunction( # type: ignore[misc]
1020
*args: Callable[FunctionParams, ReturnType], check_decorators: bool = True,
1121
) -> Union[Callable[[Callable[FunctionParams, ReturnType]], FunctionTransformer[FunctionParams, ReturnType]], FunctionTransformer[FunctionParams, ReturnType]]:
1222
frame = currentframe()

0 commit comments

Comments
 (0)