️Improve caching of callable inspection result

This commit is contained in:
Martynov Maxim 2025-12-03 14:06:57 +03:00
parent c57ac7bdf3
commit 45c564895f
No known key found for this signature in database
GPG Key ID: 9C23E39F5BBC88CC
1 changed files with 8 additions and 13 deletions

View File

@ -594,22 +594,17 @@ async def solve_dependencies(
response.status_code = None # type: ignore
if dependency_cache is None:
dependency_cache = {}
dependency_overrides: Dict[Callable[..., Any], Callable[..., Any]] = getattr(
dependency_overrides_provider, "dependency_overrides", {}
)
for sub_dependant in dependant.dependencies:
sub_dependant.call = cast(Callable[..., Any], sub_dependant.call)
call = sub_dependant.call
call = cast(Callable[..., Any], sub_dependant.call)
use_sub_dependant = sub_dependant
if (
dependency_overrides_provider
and dependency_overrides_provider.dependency_overrides
):
original_call = sub_dependant.call
call = getattr(
dependency_overrides_provider, "dependency_overrides", {}
).get(original_call, original_call)
use_path: str = sub_dependant.path # type: ignore
if dependency_overrides and (overridden_call := dependency_overrides.get(call)):
call = overridden_call
use_sub_dependant = get_dependant(
path=use_path,
call=call,
path=cast(str, sub_dependant.path),
call=overridden_call,
name=sub_dependant.name,
parent_oauth_scopes=sub_dependant.oauth_scopes,
scope=sub_dependant.scope,