From 17fb72437ab3075f7a69c3422d7ab2f17ee963cc Mon Sep 17 00:00:00 2001 From: fheinze-tkb <147151550+fheinze-tkb@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:59:50 +0200 Subject: [PATCH] Added typehint for Callable[P, R] in the decorator --- fastapi_cache/decorator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index 4c7cf33..509bcad 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -90,7 +90,7 @@ def cache( key_builder: Optional[KeyBuilder] = None, namespace: str = "", injected_dependency_namespace: str = "__fastapi_cache", -) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[Union[R, Response]]]]: +) -> Callable[[Union[Callable[P, Awaitable[R]], Callable[P, R]]], Callable[P, Awaitable[Union[R, Response]]]]: """ cache all function :param namespace: @@ -113,7 +113,7 @@ def cache( ) def wrapper( - func: Callable[P, Awaitable[R]] + func: Union[Callable[P, Awaitable[R]], Callable[P, R]] ) -> Callable[P, Awaitable[Union[R, Response]]]: # get_typed_signature ensures that any forward references are resolved first wrapped_signature = get_typed_signature(func)