Browse Source
Improve parameter type inference for Depends and Security
pull/13922/head
Mdev
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
6 deletions
-
fastapi/param_functions.py
|
|
@ -2217,9 +2217,9 @@ def File( # noqa: N802 |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def Depends( # noqa: N802 |
|
|
|
def Depends[T]( # noqa: N802 |
|
|
|
dependency: Annotated[ |
|
|
|
Optional[Callable[..., Any]], |
|
|
|
Optional[Callable[..., T]], |
|
|
|
Doc( |
|
|
|
""" |
|
|
|
A "dependable" callable (like a function). |
|
|
@ -2244,7 +2244,7 @@ def Depends( # noqa: N802 |
|
|
|
""" |
|
|
|
), |
|
|
|
] = True, |
|
|
|
) -> Any: |
|
|
|
) -> T: |
|
|
|
""" |
|
|
|
Declare a FastAPI dependency. |
|
|
|
|
|
|
@ -2277,9 +2277,9 @@ def Depends( # noqa: N802 |
|
|
|
return params.Depends(dependency=dependency, use_cache=use_cache) |
|
|
|
|
|
|
|
|
|
|
|
def Security( # noqa: N802 |
|
|
|
def Security[T]( # noqa: N802 |
|
|
|
dependency: Annotated[ |
|
|
|
Optional[Callable[..., Any]], |
|
|
|
Optional[Callable[..., T]], |
|
|
|
Doc( |
|
|
|
""" |
|
|
|
A "dependable" callable (like a function). |
|
|
@ -2321,7 +2321,7 @@ def Security( # noqa: N802 |
|
|
|
""" |
|
|
|
), |
|
|
|
] = True, |
|
|
|
) -> Any: |
|
|
|
) -> T: |
|
|
|
""" |
|
|
|
Declare a FastAPI Security dependency. |
|
|
|
|
|
|
|