Fix misc typing bugs.

This commit is contained in:
nathom 2021-05-01 18:38:55 -07:00
parent a06336c48a
commit cfa6b35eb0
3 changed files with 18 additions and 7 deletions

View file

@ -656,6 +656,14 @@ class Video:
return False # so that it is not tagged return False # so that it is not tagged
def tag(self, *args, **kwargs):
"""Dummy method.
:param args:
:param kwargs:
"""
return False
@classmethod @classmethod
def from_album_meta(cls, track: dict, client: Client): def from_album_meta(cls, track: dict, client: Client):
"""Given an video response dict from an album, return a new """Given an video response dict from an album, return a new
@ -787,7 +795,7 @@ class Tracklist(list):
if self._download_item(item, **kwargs): if self._download_item(item, **kwargs):
item.convert(**kwargs["conversion"]) item.convert(**kwargs["conversion"])
def _download_item(item, **kwargs): def _download_item(item, *args: Any, **kwargs: Any) -> bool:
"""Abstract method. """Abstract method.
:param item: :param item:

View file

@ -62,7 +62,7 @@ class TrackMetadata:
self.title: str self.title: str
self.album: str self.album: str
self.albumartist: str self.albumartist: str
self.composer: str self.composer: Optional[str] = None
self.comment: Optional[str] = None self.comment: Optional[str] = None
self.description: Optional[str] = None self.description: Optional[str] = None
self.purchase_date: Optional[str] = None self.purchase_date: Optional[str] = None

View file

@ -9,7 +9,7 @@ import logging
import os import os
import re import re
from tempfile import gettempdir from tempfile import gettempdir
from typing import Dict, Generator, Iterable, Union from typing import Dict, Generator, Iterable, Union, Optional
import click import click
from pathvalidate import sanitize_filename from pathvalidate import sanitize_filename
@ -54,8 +54,11 @@ class Album(Tracklist):
self.sampling_rate = None self.sampling_rate = None
self.bit_depth = None self.bit_depth = None
self.container = None self.container: Optional[str] = None
self.disctotal: int
self.tracktotal: int
self.albumartist: str
# usually an unpacked TrackMetadata.asdict() # usually an unpacked TrackMetadata.asdict()
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
@ -148,7 +151,7 @@ class Album(Tracklist):
for item in self.booklets: for item in self.booklets:
Booklet(item).download(parent_folder=self.folder) Booklet(item).download(parent_folder=self.folder)
def _download_item( def _download_item( # type: ignore
self, self,
track: Union[Track, Video], track: Union[Track, Video],
quality: int = 3, quality: int = 3,
@ -411,7 +414,7 @@ class Playlist(Tracklist):
self.__download_index = 1 # used for tracknumbers self.__download_index = 1 # used for tracknumbers
self.download_message() self.download_message()
def _download_item(self, item: Track, **kwargs): def _download_item(self, item: Track, **kwargs) -> bool: # type: ignore
kwargs["parent_folder"] = self.folder kwargs["parent_folder"] = self.folder
if self.client.source == "soundcloud": if self.client.source == "soundcloud":
item.load_meta() item.load_meta()
@ -578,7 +581,7 @@ class Artist(Tracklist):
self.download_message() self.download_message()
return final return final
def _download_item( def _download_item( # type: ignore
self, self,
item, item,
parent_folder: str = "StreamripDownloads", parent_folder: str = "StreamripDownloads",