Skip to content

Commit d32e6c9

Browse files
committed
fixed type annotations
1 parent 51e8df2 commit d32e6c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

testing/test_helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from functools import wraps
2-
from typing import Callable
2+
from typing import Any, Callable, TypeVar, cast
33
from pluggy._hooks import varnames
44
from pluggy._manager import _formatdef
55

@@ -87,11 +87,13 @@ def function4(arg1, *args, **kwargs):
8787

8888

8989
def test_varnames_decorator() -> None:
90-
def my_decorator(func: Callable) -> Callable:
90+
F = TypeVar('F', bound=Callable[..., Any])
91+
92+
def my_decorator(func: F) -> F:
9193
@wraps(func)
9294
def wrapper(*args, **kwargs):
9395
return func(*args, **kwargs)
94-
return wrapper
96+
return cast(F, wrapper)
9597

9698
@my_decorator
9799
def example(a, b=123) -> None:

0 commit comments

Comments
 (0)