Filter seemingly empty messages from random messages
This commit is contained in:
8
lib/utils.py
Normal file
8
lib/utils.py
Normal file
@@ -0,0 +1,8 @@
|
||||
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
|
||||
Reference in New Issue
Block a user