fix: resolve mypy shape-type error in _frames_to_mono_i16#9
Merged
Conversation
numpy's shape-parameterized stubs rejected reassigning the 2-D reshape result back onto the 1-D int16 array. Use a separate variable for the multi-channel view so the mono array stays 1-D. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @munkhorgil's task in 1m 23s —— View job Code review complete
Code Review Summary
FindingsNone. The change in multi = arr.reshape(-1, f.num_channels)
arr = (multi.astype(np.int32).sum(axis=1) // f.num_channels).astype(np.int16)correctly resolves the mypy shape-rank conflict (numpy's shape-parameterized stubs treat Nice, surgical fix — appropriately scoped to just the mypy failure with no unrelated changes. |
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.
What
Fixes a mypy failure in
_recorder.pythat broke CI:numpy's shape-parameterized stubs track array rank in the type. In
_frames_to_mono_i16,arrstarts as a 1-Dint16array fromnp.frombuffer, so reassigning the 2-Dreshape(-1, num_channels)result back onto it is a rank conflict.Changes
multivariable soarrstays 1-D throughout. No runtime behavior change — still averages interleaved channels down to mono int16.Verification
uv run mypy src/roark_analytics_python_livekit→Success: no issues found in 6 source filesuv run ruff check .→ cleanuv run pytest→ 34 passed