1717
1818 import confuse
1919
20+ from beets .autotag .distance import Distance
2021 from beets .library .models import Item
2122 from beets .ui import ColorName
2223
@@ -47,7 +48,7 @@ def changed_prefix(self) -> str:
4748 return ui .colorize ("changed" , "\u2260 " )
4849
4950 @cached_property
50- def _indentation_config (self ) -> confuse .ConfigView :
51+ def _indentation_config (self ) -> confuse .Subview :
5152 return config ["ui" ]["import" ]["indentation" ]
5253
5354 @cached_property
@@ -196,7 +197,7 @@ def format_index(self, track_info: hooks.TrackInfo | Item) -> str:
196197 return str (index )
197198
198199 def make_track_numbers (
199- self , item , track_info : hooks .TrackInfo
200+ self , item : Item , track_info : hooks .TrackInfo
200201 ) -> tuple [str , str , bool ]:
201202 """Format colored track indices."""
202203 cur_track = self .format_index (item )
@@ -307,15 +308,15 @@ def make_line(
307308 }
308309 return (lhs , rhs )
309310
310- def print_tracklist (self , lines ) :
311+ def print_tracklist (self , lines : list [ tuple [ Side , Side ]]) -> None :
311312 """Calculates column widths for tracks stored as line tuples:
312313 (left, right). Then prints each line of tracklist.
313314 """
314315 if len (lines ) == 0 :
315316 # If no lines provided, e.g. details not required, do nothing.
316317 return
317318
318- def get_width (side ) :
319+ def get_width (side : Side ) -> int :
319320 """Return the width of left or right in uncolorized characters."""
320321 try :
321322 return len (
@@ -458,7 +459,7 @@ def show_item_change(item: Item, match: hooks.TrackMatch) -> None:
458459 change .show_match_details ()
459460
460461
461- def disambig_string (info ) :
462+ def disambig_string (info : hooks . Info ) -> str :
462463 """Generate a string for an AlbumInfo or TrackInfo object that
463464 provides context that helps disambiguate similar-looking albums and
464465 tracks.
@@ -524,7 +525,7 @@ def get_album_disambig_fields(info: hooks.AlbumInfo) -> Sequence[str]:
524525 return out
525526
526527
527- def dist_colorize (string , dist ) :
528+ def dist_colorize (string : str , dist : Distance ) -> str :
528529 """Formats a string as a colorized similarity string according to
529530 a distance.
530531 """
@@ -537,15 +538,15 @@ def dist_colorize(string, dist):
537538 return string
538539
539540
540- def dist_string (dist ) :
541+ def dist_string (dist : Distance ) -> str :
541542 """Formats a distance (a float) as a colorized similarity percentage
542543 string.
543544 """
544545 string = f"{ (1 - dist ) * 100 :.1f} %"
545546 return dist_colorize (string , dist )
546547
547548
548- def penalty_string (distance , limit = None ):
549+ def penalty_string (distance : Distance , limit : int | None = None ) -> str :
549550 """Returns a colorized string that indicates all the penalties
550551 applied to a distance object.
551552 """
@@ -561,3 +562,5 @@ def penalty_string(distance, limit=None):
561562 # Prefix penalty string with U+2260: Not Equal To
562563 penalty_string = f"\u2260 { ', ' .join (penalties )} "
563564 return ui .colorize ("changed" , penalty_string )
565+
566+ return ""
0 commit comments