You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using dependency_provider.dependency_overrides, the override seems to overwrite the function in the dependency, but still passes the new function the resolved dependencies of the old function. I would expect the old functions dependencies to be ignored in the overridden context.
fromfast_dependsimportDepends, dependency_provider, injectdefget_parent_dep():
return1defget_dep(parent_dep=Depends(get_parent_dep)):
returnparent_dep+1@injectdefmy_func(dep=Depends(get_dep)):
print(dep+1)
my_func() # Normal, as expecteddependency_provider.dependency_overrides[get_dep] =lambda: 100my_func() # Error as my override lambda is being passed a dependency from the old get_dep function
(.venv) $ python test.py
3
Traceback (most recent call last):
File "main.py", line 21, in <module>
my_func()
File "/.venv/lib/python3.9/site-packages/fast_depends/use.py", line 169, in injected_wrapper
r = real_model.solve(
File ".venv/lib/python3.9/site-packages/fast_depends/core/model.py", line 370, in solve
dep.solve(
File ".venv/lib/python3.9/site-packages/fast_depends/core/model.py", line 416, in solve
response = call(*final_args, **final_kwargs)
TypeError: <lambda>() got an unexpected keyword argument 'parent_dep'
Using version 2.4.11
The text was updated successfully, but these errors were encountered:
When using
dependency_provider.dependency_overrides
, the override seems to overwrite the function in the dependency, but still passes the new function the resolved dependencies of the old function. I would expect the old functions dependencies to be ignored in the overridden context.Using version
2.4.11
The text was updated successfully, but these errors were encountered: