Fix #922: allow DependencyCallable type to be generators

This commit is contained in:
François Voron
2022-02-18 11:04:56 +01:00
parent ac0b16f8d7
commit e79b34ed35

View File

@ -1,7 +1,13 @@
from typing import Callable, Coroutine, TypeVar, Union from typing import AsyncGenerator, Callable, Coroutine, Generator, TypeVar, Union
RETURN_TYPE = TypeVar("RETURN_TYPE") RETURN_TYPE = TypeVar("RETURN_TYPE")
DependencyCallable = Callable[ DependencyCallable = Callable[
..., Union[RETURN_TYPE, Coroutine[None, None, RETURN_TYPE]] ...,
Union[
RETURN_TYPE,
Coroutine[None, None, RETURN_TYPE],
AsyncGenerator[RETURN_TYPE, None],
Generator[RETURN_TYPE, None, None],
],
] ]