duplicates: write type annotations#6307
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. |
There was a problem hiding this comment.
Pull request overview
This pull request adds type annotations to the beetsplug/duplicates.py plugin to improve type safety and code documentation.
Changes:
- Added
from __future__ import annotationsand imported typing utilities (TYPE_CHECKING,Any,DefaultDict,Iterator,Tuple,TypeAlias,cast) - Added type aliases
TiebreakandKeyValuesto document complex types used throughout the code - Added type annotations to method signatures including
_dup,_process_item,_checksum,_group_by,_order,_merge_albums, and_duplicates - Added type annotations to local variables in the
_dupfunction with# type: ignorecomments - Fixed variable shadowing issue in
_duplicatesmethod by renaming loop variable fromobjstogrouped_objs
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return sorted(objs, key=key, reverse=True) | ||
| return sorted(objs, key=key, reverse=True) # type: ignore | ||
|
|
||
| def _merge_items(self, objs): |
There was a problem hiding this comment.
Missing type annotations for the objs parameter and return type. Based on the implementation and similar method _merge_albums, the signature should be def _merge_items(self, objs: list[Item]) -> list[Item]:.
| def _merge_items(self, objs): | |
| def _merge_items(self, objs: list[Item]) -> list[Item]: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6307 +/- ##
==========================================
- Coverage 68.76% 68.75% -0.01%
==========================================
Files 140 140
Lines 18610 18617 +7
Branches 3051 3052 +1
==========================================
+ Hits 12797 12801 +4
- Misses 5165 5168 +3
Partials 648 648
🚀 New features to boost your workflow:
|
ff64e10 to
993cba2
Compare
This adds type annotations to `beetsplug.duplicates`.
993cba2 to
bc2a94c
Compare
Description
This adds type annotations to
beetsplug.duplicates.To Do
Documentation. (If you've added a new command-line flag, for example, find the appropriate page underdocs/to describe it.)Changelog. (Add an entry todocs/changelog.rstto the bottom of one of the lists near the top of the document.)Tests. (Very much encouraged but not strictly required.)