Repository navigation
Commit 523290c
Remove unused imports before sorting in pydabs-codegen (#7375)
## Why
`./task pydabs-codegen` fixes the generated code with a single `ruff
check --fix`. In that run the unused-import removal (F401) and the
import sort (I001) overlap, and ruff defers whichever comes second to
the next iteration. Which one runs first depends on the neighbouring
statements: a whole-statement deletion swallows its newline, so the fix
for the statement right after it waits a round, and by then the sort
runs first. A long import sorted while it still carries its unused names
is wrapped with a trailing comma. The trim keeps the comma, and isort's
`split-on-trailing-comma` plus the formatter's magic trailing comma then
keep it multi-line for good.
The output is deterministic for a given input, but not local: adding one
import to a package can rewrap unrelated imports in the same file. #7366
shows the effect, with `depends_on` imports flipping between one line
and multi-line across packages for reasons unrelated to that change.
## Changes
- `pydabs-codegen` runs `ruff check --fix --select F401` on its own
before the existing full fix and format steps, so wrapping depends only
on the final line.
- Regenerated models: 32 files collapse imports that were wrapped this
way. No other line changes.
## Tests
- Running the task a second time produces no further changes.
- `./task lint-python`, `ruff format --check`, the pydabs test suite
(530 tests) and pyright pass locally.
This pull request and its description were written by Isaac.
Co-authored-by: Isaac <no-reply@databricks.com>1 parent 7adc80d commit 523290c
33 files changed
Lines changed: 44 additions & 144 deletions
File tree
- python
- databricks/bundles
- alerts/_models
- apps/_models
- catalogs/_models
- clusters/_models
- dashboards/_models
- experiments/_models
- features/_models
- genie_spaces/_models
- jobs/_models
- mcp_services/_models
- model_serving_endpoints/_models
- models/_models
- pipelines/_models
- schemas/_models
- secret_scopes/_models
- secrets/_models
- volumes/_models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments