typing: type and refactor duplicates plugin - #6947
Open
snejus wants to merge 2 commits into
Open
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. |
Contributor
There was a problem hiding this comment.
Pull request overview
grug see PR make beetsplug/duplicates.py more typed, and refactor so album + item modes share one main flow. goal look like: fewer branches, clearer types, still same user behavior.
Changes:
- add typing across duplicates plugin, incl.
AlbumOrItem+ clearer helper signatures - refactor command path so both album + item go through new
_run_command() - replace old generic merge dispatch with explicit
merge_funcpassed into_duplicates()
Suppressed comments (1)
beetsplug/duplicates.py:287
- grug see log line still say "on item" but var now
model(and can be album). log text should say "model" so debug not lie.
self._log.debug(
"key {} on item {.filepath} cached:not computing checksum",
key,
model,
)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+197
to
+200
| if checksum: | ||
| for i in items: | ||
| k, _ = self._checksum(i, checksum) | ||
| keys = [k] |
| fmt: str, | ||
| remove: bool, | ||
| ) -> None: | ||
| """Process Item `item`.""" |
Comment on lines
258
to
261
| """Run external `prog` on file path associated with `item`, cache | ||
| output as flexattr on a key that is the name of the program, and | ||
| return the key, checksum tuple. | ||
| """ |
Comment on lines
268
to
272
| self._log.debug( | ||
| "key {} on item {.filepath} not cached:computing checksum", | ||
| key, | ||
| item, | ||
| model, | ||
| ) |
Comment on lines
+146
to
+150
| if self.config["album"].get(bool): | ||
| self._run_command( | ||
| lib.albums(args), | ||
| keys or ["mb_albumid"], | ||
| "$albumartist - $album", |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## type-mpdstats-thumbnails-plugins #6947 +/- ##
====================================================================
+ Coverage 76.02% 76.07% +0.04%
====================================================================
Files 164 164
Lines 21615 21599 -16
Branches 3342 3338 -4
====================================================================
- Hits 16433 16431 -2
+ Misses 4386 4374 -12
+ Partials 796 794 -2
🚀 New features to boost your workflow:
|
snejus
force-pushed
the
type-mpdstats-thumbnails-plugins
branch
from
August 23, 2026 17:03
aa2190d to
3741bd1
Compare
snejus
force-pushed
the
type-duplicates-plugin
branch
from
August 24, 2026 06:54
1b58420 to
a8d11d5
Compare
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.
Part of #6924.
What changed
beetsplug/duplicates.py.beetsplug/duplicates.pyso album and item commands now share one execution path through_run_command()._merge()dispatch with an explicitmerge_funcpassed into_duplicates(), so album and item merge behavior stays separate but simpler.Album,Item,AlbumOrItem, andLibModelannotations in the main helper methods.Why it matters
'albums'vs'items', and the shared duplicate-processing flow handles the rest.