Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
|
@JOJ0 this one for you to have a look at! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6442 +/- ##
==========================================
+ Coverage 69.69% 69.73% +0.03%
==========================================
Files 145 145
Lines 18541 18534 -7
Branches 3028 3023 -5
==========================================
+ Hits 12923 12924 +1
+ Misses 4982 4976 -6
+ Partials 636 634 -2
🚀 New features to boost your workflow:
|
7bda104 to
fb3ff75
Compare
There was a problem hiding this comment.
Pull request overview
Refactors import-match layout rendering by replacing TypedDict Side with an immutable NamedTuple, simplifying split_into_lines from a 3-width tuple to two args, and centralizing layout selection logic in beets.util.layout.
Changes:
- Converted
SidefromTypedDicttoNamedTuplewith derived helper properties (rendered,prefix_width, etc.) and simplifiedsplit_into_linessignature. - Added
get_layout_lines()and cachedget_layout_method()inbeets.util.layout, removing duplicate layout-selection logic fromShowChange. - Rewrote
ShowChangetests as snapshot-style assertions for both layout modes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| beets/util/layout.py | Core refactor: Side → NamedTuple, simplified split_into_lines, added get_layout_lines/get_layout_method |
| beets/ui/commands/import_/display.py | Simplified to use Side constructors and get_layout_lines directly |
| test/util/test_layout.py | Updated split_into_lines calls to new 2-arg signature |
| test/ui/commands/test_import.py | Replaced granular tests with snapshot assertions for both layouts |
You can also share your feedback on Copilot code review. Take the survey.
4d44c33 to
d65f70f
Compare
d65f70f to
34288b9
Compare
|
@JOJ0 added a commit to document |
c5f1135 to
cfc7ffb
Compare
Replace multiple small tests with two comprehensive snapshot tests covering the same edge cases and newline and column layouts. Use BeetsTestCase to ensure that the local dev config is ignored.
cfc7ffb to
a3e94ec
Compare
Summary
This PR refactors import-match layout rendering by centralizing layout selection and line generation in
beets.util.layout, simplifying theShowChangedisplay path, and tightening the layoutdata model.
What Changed
get_layout_lines()andget_layout_method()inbeets.util.layoutso layout selection (columnvsnewline) is handled in one place.Sidefrom a mutableTypedDictwith an immutableNamedTuplethat exposes derived helpers (rendered, prefix/suffix widths, and rendered width).split_into_lines()from a 3-width tuple API to(first_width, width)and removed legacy last-line empty-string handling.beets.ui.commands.import_/display.pyShowChangeto callget_layout_lines()directly and removed duplicate per-class layout-selection logic.Sidehelpers and explicit width assignment via_replace(width=...).ShowChangetests into snapshot-style assertions for bothnewlineandcolumnlayouts, and updated util layout tests to the newsplit_into_lines()signature.Why