mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-12-28 12:32:59 +03:00
FastDepends v3 compatability.
This commit is contained in:
parent
5a1aef9203
commit
55d2488621
|
|
@ -77,6 +77,7 @@ with suppress(ImportError):
|
|||
MARKER_EXTRACTORS.append(extract_marker_from_fastapi)
|
||||
|
||||
with suppress(ImportError):
|
||||
# fast-depends v2.x
|
||||
from fast_depends.dependencies import Depends as FastDepends
|
||||
|
||||
def extract_marker_from_fast_depends(param: Any) -> Any:
|
||||
|
|
@ -86,6 +87,17 @@ with suppress(ImportError):
|
|||
|
||||
MARKER_EXTRACTORS.append(extract_marker_from_fast_depends)
|
||||
|
||||
with suppress(ImportError):
|
||||
# fast-depends v3.x (Depends() returns Dependant instances)
|
||||
from fast_depends.dependencies.model import Dependant as FastDependant
|
||||
|
||||
def extract_marker_from_fast_dependant(param: Any) -> Any:
|
||||
if isinstance(param, FastDependant):
|
||||
return param.dependency
|
||||
return None
|
||||
|
||||
MARKER_EXTRACTORS.append(extract_marker_from_fast_dependant)
|
||||
|
||||
|
||||
with suppress(ImportError):
|
||||
from starlette.requests import Request as StarletteRequest
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user