mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
build: fix up type hints for #430
This commit is contained in:
@@ -142,7 +142,7 @@ def cache(
|
|||||||
# unintuitively, we have to await once here, so that caller
|
# unintuitively, we have to await once here, so that caller
|
||||||
# does not have to await twice. See
|
# does not have to await twice. See
|
||||||
# https://stackoverflow.com/a/59268198/532513
|
# https://stackoverflow.com/a/59268198/532513
|
||||||
return await func(*args, **kwargs)
|
return await func(*args, **kwargs) # type: ignore[no-any-return]
|
||||||
else:
|
else:
|
||||||
# sync, wrap in thread and return async
|
# sync, wrap in thread and return async
|
||||||
# see above why we have to await even although caller also awaits.
|
# see above why we have to await even although caller also awaits.
|
||||||
@@ -221,7 +221,7 @@ def cache(
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
result = cast(R, coder.decode_as_type(cached, type_=return_type))
|
result = cast(R, coder.decode_as_type(cached, type_=return_type))
|
||||||
if isinstance(result, Response):
|
if response and isinstance(result, Response):
|
||||||
result.headers.update(response.headers)
|
result.headers.update(response.headers)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user