Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix injection with cache wrapper against pydantic object #61

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kink/inject.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import functools
import sys
from abc import ABC
from functools import wraps
Expand Down Expand Up @@ -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 = {}

Expand Down