Enforce ruff/flake8-comprehensions rules (C4)
Summary of changes
Pull Request Checklist
- [ ] Changes have tests
- [ ] News fragment added in
newsfragments/. (See documentation for details)
⚠️ The sha of the head commit of this PR conflicts with #4386. Mergify cannot evaluate rules on this PR. ⚠️
⚠️ The sha of the head commit of this PR conflicts with #4386. Mergify cannot evaluate rules on this PR. ⚠️
I think you'll want to enable allow-dict-calls-with-keyword-arguments I'd have to find it back, but I believe that's a stylistic decision @jaraco has previously weighed in.
After adding allow-dict-calls-with-keyword-arguments, most occurrences of C408 have disappeared. A few instances of dict() → {} have been left behind. Should I discard them as well and disable C408?
I personally think those make sense, it's mainly changing generators of tuples into dict comprehensions.
Rebased.
- The Python 3.14 CI errors might be related to https://github.com/python/cpython/issues/133653.
- Not sure about the PyPy 3.10 CI error, but it seems unrelated to this PR as well.
I'm not sure your rebase is correct. I see refurb related changes and the change dict(foo=bar) --> {"foo": bar} which was previously mentioned as unwanted.
PyPy tests have also been flaky: https://github.com/pypa/setuptools/issues/4940
I had to rerun C401 and C408 because rebasing was impossible. I guess I somehow got the options wrong. Will try again.
Reapplied C408 after making sure allow-dict-calls-with-keyword-arguments is true.