Skip to content
Snippets Groups Projects
Commit d639fa9f authored by vlorentz's avatar vlorentz
Browse files

Make @remote_api_endpoint preserve typing information for mypy.

Before this commit, decorating with @remote_api_endpoint made
mypy completely unable to detect the type of the decorated function.
parent 1ec4df82
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ from typing import (
Optional,
Tuple,
Type,
TypeVar,
Union,
)
......@@ -124,9 +125,12 @@ class RemoteException(Exception):
return super().__str__()
def remote_api_endpoint(path):
def dec(f):
f._endpoint_path = path
F = TypeVar("F", bound=Callable)
def remote_api_endpoint(path) -> Callable[[F], F]:
def dec(f: F) -> F:
f._endpoint_path = path # type: ignore
return f
return dec
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment