Closed MetRonnie closed 2 years ago
You are correct: The recommendation of flake8-simplify==0.14.5
is wrong. Thank you for reporting it!
I will work on this as soon as possible. This is a free-time project for me, so I'm uncertain when this will be the case.
As an intermediate fix, you can either ignore this line via:
if 'foo' in some_dict['a']: # noqa: SIM401
some_dict['b'] = some_dict['a']['foo']
else:
some_dict['a']['foo'] = some_dict['b']
Or you can deactivate that rule completely (e.g. via .flake8 / tox.ini / setup.cfg):
[flake8]
ignore = SIM401
This bug appears in Python 3.9.1
but not in Python 3.7.7
. I guess there might be two bugs: The one that causes the false-positive in Python 3.9 and one causing a false-negative in Python 3.7
Test was added here: https://github.com/MartinThoma/flake8-simplify/pull/85
Thank you very much for your help. The issue was fixed in flake8-simplify==0.14.6
flake8-simplify incorrectly tells us:
but that is not equivalent in this case