Following code gives an incorrect linting error:
from collections.abc import AsyncGenerator
async def test() -> None:
async def async_gen() -> AsyncGenerator[bool, None]:
yield True
assert all([v async for v in async_gen()]) # C419 Unnecessary list comprehension
Removing the list comprehension here is incorrect as all can not take an async generator.
Changing it into all(v async for v in async_gen()) gives: TypeError: 'async_generator' object is not iterable
Using Ruff version 0.5.7.
Following code gives an incorrect linting error:
Removing the list comprehension here is incorrect as
allcan not take an async generator.Changing it into
all(v async for v in async_gen())gives:TypeError: 'async_generator' object is not iterableUsing Ruff version
0.5.7.