Closed mimre25 closed 2 months ago
With this patch flake8 complains about the following construct in my code:
for key in my_dictionary:
my_dictionary[key] = True
which is safe to do, because it doesn't add or remove any keys. At least as far as I understand, please correct me if I am wrong.
Thanks for this. What's the plan, did you want to add this fix or do you have more plans for this PR?
I'd be happy to add the fix for
for key in my_dictionary:
my_dictionary[key] = True
at the time I opened the draft PR I wasn't 100% sure this is desired, but judging from the discussions in #467 and the :+1: on henzef comment it seems like this is something we want.
I'll hopefully get around to adding this later today.
This is ready now :slightly_smiling_face:
FYI: tested it with both black
and MONAI
and there were no false positives. Test were done with py38 and py312
No false positives (or true positives :D) in my codebase either. Thanks for the quick fix!
The false positives occurred when trying to edit a dictionary while iterating over a list of dictionaries: