diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 916906029..339e3826c 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -14,7 +14,9 @@ """Facilities for automatically determining files' correct metadata. """ +from typing import Mapping +from beets.library import Item from beets import logging from beets import config @@ -71,7 +73,7 @@ SPECIAL_FIELDS = { # Additional utilities for the main interface. -def apply_item_metadata(item, track_info): +def apply_item_metadata(item: Item, track_info: TrackInfo): """Set an item's metadata from its matched TrackInfo object. """ item.artist = track_info.artist @@ -95,7 +97,7 @@ def apply_item_metadata(item, track_info): # and track number). Perhaps these should be emptied? -def apply_metadata(album_info, mapping): +def apply_metadata(album_info: AlbumInfo, mapping: Mapping[Item, TrackInfo]): """Set the items' metadata to match an AlbumInfo object using a mapping from Items to TrackInfo objects. """ diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index c09e4d321..a1cd49d19 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -55,7 +55,7 @@ class AttrDict(dict): def __setattr__(self, key, value): self.__setitem__(key, value) - def __hash__(self): + def __hash__(self) -> int: return id(self)