Closed cclauss closed 2 months ago
Are you talking about #2773 or something else?
I'm talking about this fail: https://github.com/pygame-community/pygame-ce/actions/runs/8425378679/job/23088593026
This PR now has merge conflicts.
Git conflicts fixed.
%
pipx install ruff
%ruff check --select=C4,PERF --statistics
%
ruff check --select=C4,PERF --fix --unsafe-fixes
%
ruff rule C408
unnecessary-collection-call (C408)
Derived from the flake8-comprehensions linter.
Fix is always available.
What it does
Checks for unnecessary
dict
,list
ortuple
calls that can be rewritten as empty literals.Why is this bad?
It's unnecessary to call, e.g.,
dict()
as opposed to using an empty literal ({}
). The former is slower because the namedict
must be looked up in the global scope in case it has been rebound.Examples
Use instead:
Fix safety
This rule's fix is marked as unsafe, as it may occasionally drop comments when rewriting the call. In most cases, though, comments will be preserved.
Options
lint.flake8-comprehensions.allow-dict-calls-with-keyword-arguments