async def tick( *, i: int, local_id: uuid.UUID = Depends(get_id), remote_id: uuid.UUID = Depends(get_remote_id), cpu_time: int = Depends(cpu_bound), ) -> Tuple[int, uuid.UUID, uuid.UUID, int]: return (i, local_id, remote_id, cpu_time)
def test_repr(self) -> None: def get_user() -> None: pass # pragma: no cover assert repr(Depends()) == "Depends(NoneType, use_cache=False)" assert repr(Depends(get_user)) == "Depends(get_user, use_cache=False)" assert repr(Depends(use_cache=True)) == "Depends(NoneType, use_cache=True)" assert repr(Depends(get_user)) == "Depends(get_user, use_cache=False)"
async def collect(words: Iterator[str] = Depends(gen)) -> List[str]: actual = [] for w in words: actual.append(w) return actual
def cached(r: float = Depends(_random), x: float = Depends(_random, use_cache=True)) -> float: return r is x
def single_cached(r: float = Depends(_random, use_cache=True)) -> float: return r
async def async_char(c: str = Depends(char)) -> str: raise Exception
async def async_char(c: C = Depends()) -> str: return c.value
async def async_char(c: str = Depends(char)) -> str: return c
async def foo(c: float = Depends(C())) -> float: return c
def char(c: str = Depends(dot)) -> str: return c
async def main_with_depends( *, _id: uuid.UUID = Depends(some_service), other_id: uuid.UUID = Depends(some_service), ) -> Tuple[uuid.UUID, uuid.UUID]: return (_id, other_id)
async def main(*, choice: int = Depends(random)) -> None: print(choice)