-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
from __future__ import annotations
from itertools import groupby
def ruff_b031_false_positive(values: list[int]) -> None:
for key, group in groupby(values):
if key:
list(group)
continue # or break or return
list(group)$ ruff check --isolated --select B031 testcase.py
testcase.py:10:14: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
Found 1 error.There have been fixes for when the generator is used in different branches of an if statements, see for example #4050, but the warning still triggers if you use continue, break, or return. Tested with Ruff version 0.3.2.
Reactions are currently unavailable