Fix typing hints

This commit is contained in:
Alpha 2021-10-24 13:45:52 -04:00
parent a3e27d4f2a
commit a0bb3c3843
3 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import os
from typing import Optional
from typing import Optional, Tuple
from librespot.audio.decoders import VorbisOnlyAudioQuality
from librespot.metadata import EpisodeId
@ -14,7 +14,7 @@ EPISODE_INFO_URL = 'https://api.spotify.com/v1/episodes'
SHOWS_URL = 'https://api.spotify.com/v1/shows'
def get_episode_info(episode_id_str) -> tuple[Optional[str], Optional[str]]:
def get_episode_info(episode_id_str) -> Tuple[Optional[str], Optional[str]]:
info = ZSpotify.invoke_url(f'{EPISODE_INFO_URL}/{episode_id_str}')
if ERROR in info:
return None, None

View File

@ -1,6 +1,6 @@
import os
import time
from typing import Any
from typing import Any, Tuple, List
from librespot.audio.decoders import AudioQuality
from librespot.metadata import TrackId
@ -31,7 +31,7 @@ def get_saved_tracks() -> list:
return songs
def get_song_info(song_id) -> tuple[list[str], str, str, Any, Any, Any, Any, Any, Any]:
def get_song_info(song_id) -> Tuple[List[str], str, str, Any, Any, Any, Any, Any, Any]:
""" Retrieves metadata for downloaded songs """
info = ZSpotify.invoke_url(f'{TRACKS_URL}?ids={song_id}&market=from_token')

View File

@ -3,6 +3,7 @@ import platform
import re
import time
from enum import Enum
from typing import List, Tuple
import music_tag
import requests
@ -27,7 +28,7 @@ def wait(seconds: int = 3) -> None:
time.sleep(1)
def split_input(selection) -> list[str]:
def split_input(selection) -> List[str]:
""" Returns a list of inputted strings """
inputs = []
if '-' in selection:
@ -91,7 +92,7 @@ def set_music_thumbnail(filename, image_url) -> None:
tags.save()
def regex_input_for_urls(search_input) -> tuple[str, str, str, str, str, str]:
def regex_input_for_urls(search_input) -> Tuple[str, str, str, str, str, str]:
""" Since many kinds of search may be passed at the command line, process them all here. """
track_uri_search = re.search(
r'^spotify:track:(?P<TrackID>[0-9a-zA-Z]{22})$', search_input)