Fix issue #398 with FastAPI request importing
This commit is contained in:
parent
6c06548019
commit
8cc2c1188b
|
@ -7,6 +7,12 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
Development version
|
||||
-------------------
|
||||
- Hotfix a bug with importing FastAPI ``Request``.
|
||||
See issue: `#398 <https://github.com/ets-labs/python-dependency-injector/issues/398>`_.
|
||||
Thanks to `@tapm <https://github.com/tapm>`_ for reporting the bug.
|
||||
|
||||
4.23.0
|
||||
------
|
||||
- Add support of aliases for ``Configuration`` provider.
|
||||
|
|
|
@ -345,8 +345,13 @@ def _unpatch(
|
|||
def _fetch_reference_injections(
|
||||
fn: Callable[..., Any],
|
||||
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
|
||||
# # Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
if GenericAlias and fn is GenericAlias:
|
||||
# Hotfix, see:
|
||||
# - https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
# - https://github.com/ets-labs/python-dependency-injector/issues/398
|
||||
if GenericAlias and any((
|
||||
fn is GenericAlias,
|
||||
getattr(fn, '__func__', None) is GenericAlias
|
||||
)):
|
||||
fn = fn.__init__
|
||||
|
||||
signature = inspect.signature(fn)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import sys
|
||||
|
||||
from fastapi import FastAPI, Depends
|
||||
from fastapi import Request # See: https://github.com/ets-labs/python-dependency-injector/issues/398
|
||||
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||||
from dependency_injector import containers, providers
|
||||
from dependency_injector.wiring import inject, Provide
|
||||
|
|
Loading…
Reference in New Issue