-
-
Notifications
You must be signed in to change notification settings - Fork 244
Open
Description
I did my best to type a wrapt decorator in a way that the original signature of the decorated function is still visible, but I was not able to do it. Some error always occurred. To my understanding, this is caused by:
@wrapt.decorator
def pass_through(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)instead of
@wrapt.decorator
def pass_through(wrapped, instance, *args, **kwargs):
return wrapped(*args, **kwargs)According to ParamSpec and PEP612 the correct type information is
def with_request(f: Callable[Concatenate[Request, P], R]) -> Callable[P, R]:
def inner(*args: P.args, **kwargs: P.kwargs) -> R:
return f(Request(), *args, **kwargs)
return inneras an example. However, args: P.args raises an error. Does anyone have an idea/solution to this?
EDIT: Use better?! example.
Metadata
Metadata
Assignees
Labels
No labels