- Collapse _try_resolve_annotated signature to one line (ruff format)
- Add pragma: no cover to dep() stubs that are never called during tests
Made-with: Cursor
When `from __future__ import annotations` is active, annotations become
strings. If a type referenced inside `Annotated[T, Depends(...)]` is
defined after the route decorator, `T` is not yet available at decoration
time and the full `Annotated` string cannot be resolved. FastAPI then
loses the `Depends` metadata and incorrectly treats the parameter as a
query parameter.
The fix introduces a lenient evaluation strategy: when strict evaluation
of the annotation string fails, a `_LenientDict` namespace is used where
undefined names resolve to `Any`. This preserves the `Annotated`
structure and allows FastAPI to extract `Depends` metadata. The lenient
result is only accepted when it contains `Depends` metadata — for other
metadata types (Query, Body, etc.) the actual type is needed, so the
existing fallback behaviour is kept.
Fixes#13056
Made-with: Cursor