def inject(
func: Optional[Callable[P, T]] = None,
*,
cast: bool = True,
extra_dependencies: Sequence[model.Depends] = (),
pydantic_config: Optional[ConfigDict] = None,
dependency_overrides_provider: Optional[Any] = dependency_provider,
wrap_model: Callable[[CallModel[P, T]], CallModel[P, T]] = lambda x: x,
) -> Union[
Callable[P, T],
_InjectWrapper[P, T],
]:
decorator = _wrap_inject(
dependency_overrides_provider=dependency_overrides_provider,
wrap_model=wrap_model,
extra_dependencies=extra_dependencies,
cast=cast,
pydantic_config=pydantic_config,
)
if func is None:
return decorator
else:
return decorator(func)