You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ flake8 example.py
example.py:8:8: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage. Save the result to a list, if the result is needed multiple times.
flake8: 6.0.0, flake8-bugbear: 23.2.13
Perhaps we can have a better inspection so the error is not raised in such cases?
The text was updated successfully, but these errors were encountered:
I guess it's not that common and I was "lucky" enough 😅... funny thing is, I wanted a non-generator variant of groupby (that also doesn't require a sorted input) so created one for my project, and then CI errored out on flake8 and hence reported this issue...
Recent B031 addition: #347
A code that defines a
groupby
function (notitertools.groupby
) will still raise B031 error.Example:
Then:
flake8: 6.0.0, flake8-bugbear: 23.2.13
Perhaps we can have a better inspection so the error is not raised in such cases?
The text was updated successfully, but these errors were encountered: