Skip to content

Commit 5923e5c

Browse files
authored
add type hint for decorated function (via #533)
1 parent ed38912 commit 5923e5c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

allure-python-commons/src/_allure.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
from functools import wraps
2+
from typing import Any, Callable, TypeVar
23

34
from allure_commons._core import plugin_manager
45
from allure_commons.types import LabelType, LinkType
56
from allure_commons.utils import uuid4
67
from allure_commons.utils import func_parameters, represent
78

9+
_TFunc = TypeVar("_TFunc", bound=Callable[..., Any])
10+
811

912
def safely(result):
1013
if result:
@@ -159,7 +162,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
159162
plugin_manager.hook.stop_step(uuid=self.uuid, title=self.title, exc_type=exc_type, exc_val=exc_val,
160163
exc_tb=exc_tb)
161164

162-
def __call__(self, func):
165+
def __call__(self, func: _TFunc) -> _TFunc:
163166
@wraps(func)
164167
def impl(*a, **kw):
165168
__tracebackhide__ = True

0 commit comments

Comments
 (0)