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
{{ message }}
Repository navigation
B909 has several false positives on black codebase #467
I've created #469 - the fix was rather easy and simple, just an oversight in the initial implementation 😬
I've ran it on the black code base with the only hit being ./black/src/blib2to3/pgen2/pgen.py:235:21, which is a true positive considering the comment in line 223 (for state in states: # NB states grows while we're iterating).
With Project-MONAI, I could also eliminate the cases pointed out, however, there is a discussion point (hence the PR only being a draft):
Should B909 allow altering an element via it's dictionary key? For example:
Activity
Pin to old flake8-bugbear
Pin to old flake8-bugbear (#4319)
KumoLiu commentedon Apr 22, 2024
Same issue here:
https://github.com/Project-MONAI/MONAI/actions/runs/8777993558/job/24083761562#step:2:2647
https://github.com/Project-MONAI/MONAI/blob/03a5fa695ad02fcb916d5495e84f8f01883806e2/monai/apps/auto3dseg/auto_runner.py#L774
Workaround for B909 in flake8-bugbear (#7691)
mimre25 commentedon Apr 23, 2024
Thanks for tagging me!
I'll take a look later this week and see if I can fix it right away, or if it blows up the scope (I doubt the latter one). 🙂
gothicVI commentedon Apr 25, 2024
Hi,
we're seeing complaints for code like
Is this related?
mimre25 commentedon Apr 25, 2024
Potentially. I'm actually working on it right now, so I'll also check this.
mimre25 commentedon Apr 25, 2024
I've created #469 - the fix was rather easy and simple, just an oversight in the initial implementation 😬
I've ran it on the black code base with the only hit being
./black/src/blib2to3/pgen2/pgen.py:235:21, which is a true positive considering the comment in line 223 (for state in states: # NB states grows while we're iterating).With Project-MONAI, I could also eliminate the cases pointed out, however, there is a discussion point (hence the PR only being a draft):
Should B909 allow altering an element via it's dictionary key? For example:
Should this fire B909 or not? What do you think?
cc @cooperlees
gothicVI commentedon Apr 25, 2024
I'd argue it should fire due to the
del.EDIT: The following is incorrect and shouldn't be considered - I leave it here for completeness as it was partially quoted:
However, I'd also argue it shouldn't in such a case:
JelleZijlstra commentedon Apr 25, 2024
That's not true in Python 3. Your code will throw
RuntimeError: dictionary changed size during iteration.