File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed
Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change 1- from asyncio import FIRST_COMPLETED , Event , ensure_future , wait
2- from typing import (
3- AsyncIterator ,
4- Awaitable ,
5- Callable ,
6- TypeVar ,
7- cast ,
8- )
9-
101from fishjam .errors import MissingFishjamIdError
112
123
@@ -18,21 +9,3 @@ def get_fishjam_url(fishjam_id: str | None, fishjam_url: str | None) -> str:
189 return fishjam_url
1910
2011 return f"https://fishjam.io/api/v1/connect/{ fishjam_id } "
21-
22-
23- _T = TypeVar ("_T" )
24-
25-
26- async def repeat_until (
27- coro_fun : Callable [[], Awaitable [_T ]],
28- end_event : Event ,
29- ) -> AsyncIterator [_T ]:
30- while not end_event .is_set ():
31- end_fut = ensure_future (end_event .wait ())
32- done , _ = await wait (
33- (ensure_future (coro_fun ()), end_fut ), return_when = FIRST_COMPLETED
34- )
35- for task in done :
36- if task is end_fut :
37- return
38- yield cast (_T , await task )
You can’t perform that action at this time.
0 commit comments