Add some typings

This commit is contained in:
Serene-Arc 2023-01-20 13:20:15 +10:00
parent 1950a98da8
commit 7f5a28348c
2 changed files with 5 additions and 3 deletions

View file

@ -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.
"""

View file

@ -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)