refactor(buzz): group video params into _VideoParams dataclass in FfmpegFrameReader#1543
Merged
Conversation
Decompose ModelDownloader.download_model (142 statements, > 50 limit) into four focused helpers: _prepare_resume_download - existing file validation & resume logic _check_range_support - server Range-request capability _stream_download - HTTP streaming with progress/cancel _verify_sha256 - post-download integrity check download_model now acts as a high-level orchestrator (~16 statements).
…many-statements (R0915)
…statements (R0915) Extraiu 7 métodos auxiliares e 3 funções modulares do método transcribe (166 statements, limite 50), reduzindo-o para ~30 statements. Métodos extraídos para WhisperCpp: - _convert_to_wav, _build_command, _run_whisper - _read_json_output, _parse_word_level_timings - _parse_segment_timings, _cleanup_files Funções extraídas para o módulo: - _make_offset_mapper, _flush_complete_chars, _append_word
…-attributes-buzz.ffmpeg_video_player
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1543 +/- ##
==========================================
+ Coverage 82.94% 82.95% +0.01%
==========================================
Files 108 108
Lines 11668 11675 +7
==========================================
+ Hits 9678 9685 +7
Misses 1990 1990
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Why this change is necessary
The
FfmpegFrameReaderclass had 12 instance attributes, exceeding Pylint's default limit of 7 (R0902). This code smell reduces readability and makes the class harder to maintain. The high number of attributes suggests the class has too many responsibilities that could be better organized.How it was tested
pylint --disable=all --enable=R0902 buzz/ffmpeg_video_player.py— no more warnings forFfmpegFrameReaderNotes for the reviewer
The refactoring groups 6 immutable configuration attributes (
_file_path,_width,_height,_fps,_frame_size,_start_ms) into a single_VideoParamsdataclass. All remaining instance attributes (_lock,_frames,_done,_stop_event,_proc,_thread) are runtime state that changes during the reader's lifecycle, making the separation between configuration and mutable state clearer.The
replaceAlloperation during the rename inadvertently affectedFfmpegVideoPlayer(which also hadself._file_path), but this was corrected before the final commit. Please double-check thatFfmpegVideoPlayerreferences are intact.