9 lines
240 B
Python
9 lines
240 B
Python
from collections import AsyncIterable
|
|
from typing import Callable, AsyncGenerator
|
|
|
|
|
|
async def async_filter(fun: Callable, iterable: AsyncIterable) -> AsyncGenerator:
|
|
async for val in iterable:
|
|
if fun(val):
|
|
yield val
|