chore: ruff lint fixes and formatting across all source files#239
Draft
korbonits wants to merge 2 commits intoshiyu-coder:masterfrom
Draft
chore: ruff lint fixes and formatting across all source files#239korbonits wants to merge 2 commits intoshiyu-coder:masterfrom
korbonits wants to merge 2 commits intoshiyu-coder:masterfrom
Conversation
- sample_from_logits: guard top_k/top_p None comparisons before checking `> 0` / `< 1.0` (TypeError when one arg is None) - sample_from_logits: replace `top_k(probs, k=1)` with `torch.topk(probs, k=1)` — the parameter shadowed the function, making greedy decoding (sample_logits=False) uncallable - BinarySphericalQuantizer.get_codebook_entry / get_group_codebook_entry: `h, w = int(...)` raises TypeError because a scalar int is not iterable; fix to `h = w = int(...)` - FixedEmbedding: `w.require_grad = False` silently set a spurious attribute instead of disabling gradient tracking; fix to `w.requires_grad = False` Add 65 offline unit tests (tests/test_sampling.py, tests/test_bsq.py, tests/test_model_shapes.py) that cover all three bugs as regression guards, plus shape/behaviour tests for every major building block and both top-level models. Add pyproject.toml with uv project definition, ruff (lint + format), ty (type checker), and pytest config. Add uv.lock for reproducible installs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused imports and variables (F401, F841) - Sort and reformat import blocks (I001) - Strip trailing whitespace from blank lines (W293, W291) - Remove redundant UTF-8 coding declarations (UP009) - Convert f-strings without placeholders to plain strings (F541) - Replace explicit positional format indices with implicit ones (UP030) - Expand single-line compound statements (E701) - Reformat code style with ruff format (quotes, line length, indentation) - Add # noqa annotations for intentional availability-check imports and a ruff false-positive (F823 on a properly imported os) No behaviour changes; all 65 unit tests continue to pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Applies
ruff check --fixandruff formatto all source files. No logic changes — behaviour is identical tomaster(and to #238, which this is based on).Kept as a separate draft PR so reviewers can decide independently whether they want the formatting cleanup.
What changed
# noqa: F401)# -*- coding: utf-8 -*-declarations{0}→{}ruff formatTooling config (in
pyproject.tomlfrom #238)Test plan
All 65 unit tests from #238 continue to pass; the existing regression tests are unchanged.
🤖 Generated with Claude Code