-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[perflint] Allow list function calls to be replaced with a comprehension (PERF401)
#17519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PERF401 | 14 | 7 | 7 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+7 -7 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)
apache/superset (+7 -7 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- tests/integration_tests/charts/api_tests.py:350:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/charts/api_tests.py:350:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/charts/api_tests.py:464:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/charts/api_tests.py:464:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/charts/api_tests.py:515:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/charts/api_tests.py:515:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/dashboards/api_tests.py:1280:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/dashboards/api_tests.py:1280:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/dashboards/api_tests.py:1307:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/dashboards/api_tests.py:1307:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/dashboards/api_tests.py:1441:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/dashboards/api_tests.py:1441:13: PERF401 Use a list comprehension to create a transformed list - tests/integration_tests/dashboards/api_tests.py:1506:13: PERF401 Use `list.extend` to create a transformed list + tests/integration_tests/dashboards/api_tests.py:1506:13: PERF401 Use a list comprehension to create a transformed list
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PERF401 | 14 | 7 | 7 | 0 | 0 |
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow-up and for the test cases! I don't think this needs to be in preview, as it's just a straightforward extension of the [] case to list().
* main: (37 commits) [red-knot] Add list of failing/slow ecosystem projects (#17474) [red-knot] mypy_primer: extend ecosystem checks (#17544) [red-knot] Move `InstanceType` to its own submodule (#17525) [red-knot] mypy_primer: capture backtraces (#17543) [red-knot] mypy_primer: Use upstream repo (#17500) [red-knot] `typing.dataclass_transform` (#17445) Update dependency react-resizable-panels to v2.1.8 (#17513) Update dependency smol-toml to v1.3.3 (#17505) Update dependency uuid to v11.1.0 (#17517) Update actions/setup-node action to v4.4.0 (#17514) [red-knot] Fix variable name (#17532) [red-knot] Add basic subtyping between class literal and callable (#17469) [`pyupgrade`] Add fix safety section to docs (`UP030`) (#17443) [`perflint`] Allow list function calls to be replaced with a comprehension (`PERF401`) (#17519) Update pre-commit dependencies (#17506) [red-knot] Simplify visibility constraint handling for `*`-import definitions (#17486) [red-knot] Detect (some) invalid protocols (#17488) [red-knot] Correctly identify protocol classes (#17487) Update dependency ruff to v0.11.6 (#17516) Update Rust crate shellexpand to v3.1.1 (#17512) ...
This is an implementation of the discussion from #16719.
This change will allow list function calls to be replaced with comprehensions:
I added a new test to
PERF401.pyto verify that this fix will now work forlist().