From 4aab69ffea6c4588291ba39d01f71cb4c45653b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E9=80=8A?= Date: Thu, 15 Aug 2024 21:07:34 +0800 Subject: [PATCH] Fix cache with pydantic issue --- kink/inject.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kink/inject.py b/kink/inject.py index 552671b..948e5b5 100644 --- a/kink/inject.py +++ b/kink/inject.py @@ -1,4 +1,5 @@ import asyncio +import functools import sys from abc import ABC from functools import wraps @@ -53,6 +54,9 @@ def __init__(self, name: str, type: Any = Any, default: Any = Undefined): def _inspect_function_arguments( function: Callable, ) -> Tuple[Tuple[str, ...], Dict[str, Parameter]]: + if isinstance(function, functools._lru_cache_wrapper): + function = function.__wrapped__ + parameters_name: Tuple[str, ...] = tuple(signature(function).parameters.keys()) parameters = {}