mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
Merge pull request #430 from fheinze-tkb/patch-1
fix #430: Added typehint for Callable[P, R] in the decorator
This commit is contained in:
@@ -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 injected_dependency_namespace:
|
||||
@@ -114,7 +114,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)
|
||||
|
||||
Reference in New Issue
Block a user