With async for loops and manual counters, sourcery wrongly recommends replacing them with enumerates.
Minimal reproducible example:
import asyncio
async def test():
for i in range(10):
yield f"-{i}-"
await asyncio.sleep(1)
async def main():
print('running')
i = 0
async for x in test():
i += 1
print(x, i)
print('finished')
asyncio.run(main())
Suggestion by sourcery:
Function main refactored with the following changes:
Issue description or question
With async for loops and manual counters, sourcery wrongly recommends replacing them with enumerates.
Minimal reproducible example:
Suggestion by sourcery:
Function main refactored with the following changes:
However, enumerate does not support async methods.
Sourcery Version
0.11.2
Code editor or IDE name and version
Pycharm
Build #PY-221.5080.212, built on April 12, 2022
OS name and version
Linux 5.14.17-051417-generic x86_64
/Ubuntu 21.10