style: lint and format legacy top-level code - #6
Merged
Conversation
Brings the legacy top-level code (models/, preprocessing/, utils/, train.py, scripts/preprocess_logs.py) up to the ruff standard adopted in the CI/tooling alignment, and removes it from the pre-commit exclude so it stays enforced. - Auto-fixed + formatted with ruff (imports, whitespace, PEP 585/604 typing modernization, f-string conversions, comprehensions). - B904: chain re-raised exceptions with `from e` (8 sites). - B023: bind optuna/apply lambda loop variables as default args — these were false positives (the callables are consumed synchronously within the loop), now made explicit and warning-free. - F841: remove dead local assignments (unused timers, containers, node_map). - B905: add explicit `strict=` to zip() calls. - E402: drop duplicate mid-file pandas/pathlib imports (already at top). - RUF002: replace ambiguous MULTIPLICATION SIGN with 'x' in docstrings. - Assorted small ruff fixes (SIM, RUF, naming). Behavior is unchanged; the diff is dominated by deterministic ruff-format reflow of previously unformatted files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third and final follow-up after the ER evaluation merge. Brings the legacy top-level code (
models/,preprocessing/,utils/,train.py,scripts/preprocess_logs.py) up to the ruff standard adopted in #5, and removes it from the pre-commit exclude so it stays enforced going forward.What changed
The diff is large but behavior-preserving — it's dominated by deterministic
ruff-formatreflow of files that were never formatted before. The substantive fixes:B904from eB023applylambda loop vars as default args (false positives — callables consumed synchronously)F841B905strict=onzip()E402pandas/pathlibimportsRUF002×→xin docstringsVerification
ruff check .— all checks pass (whole repo).pre-commit run --all-files— all hooks pass.py_compiles cleanly.After this lands, the entire codebase (not just
src/) is linted by CI.