mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-17 11:32:21 +03:00
fixup! Add support for async generator injections
This commit is contained in:
parent
e55d11e6ab
commit
c8a40d97f1
|
@ -38,8 +38,8 @@ cdef class DependencyResolver:
|
||||||
self.injections = injections
|
self.injections = injections
|
||||||
self.closings = closings
|
self.closings = closings
|
||||||
|
|
||||||
async def _await_injection(self, p: KWPair, /) -> None:
|
async def _await_injection(self, kw_pair: KWPair, /) -> None:
|
||||||
self.to_inject[p.name] = await p.value
|
self.to_inject[kw_pair.name] = await kw_pair.value
|
||||||
|
|
||||||
cdef object _await_injections(self, to_await: list):
|
cdef object _await_injections(self, to_await: list):
|
||||||
return gather(*map(self._await_injection, to_await))
|
return gather(*map(self._await_injection, to_await))
|
||||||
|
|
|
@ -1054,7 +1054,6 @@ def _get_async_patched(fn: F, patched: PatchedCallable) -> F:
|
||||||
return cast(F, _patched)
|
return cast(F, _patched)
|
||||||
|
|
||||||
|
|
||||||
# Async generators too...
|
|
||||||
def _get_async_gen_patched(fn: F, patched: PatchedCallable) -> F:
|
def _get_async_gen_patched(fn: F, patched: PatchedCallable) -> F:
|
||||||
@functools.wraps(fn)
|
@functools.wraps(fn)
|
||||||
async def _patched(*args: Any, **raw_kwargs: Any) -> AsyncIterator[Any]:
|
async def _patched(*args: Any, **raw_kwargs: Any) -> AsyncIterator[Any]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user