Фикс type hints для python 3.9
This commit is contained in:
parent
3f7e90778c
commit
c7e121b3e5
3 changed files with 4 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "yandex-music-downloader"
|
name = "yandex-music-downloader"
|
||||||
version = "3.0.0b0"
|
version = "3.0.0b1"
|
||||||
description = "Загрузчик музыки с сервиса Яндекс.Музыка"
|
description = "Загрузчик музыки с сервиса Яндекс.Музыка"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import time
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Generator, Iterable
|
from collections.abc import Generator, Iterable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional, Union
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from yandex_music import Album, Client, Playlist, Track
|
from yandex_music import Album, Client, Playlist, Track
|
||||||
|
|
@ -151,7 +151,7 @@ def main():
|
||||||
client = Client(args.token).init()
|
client = Client(args.token).init()
|
||||||
result_tracks: Iterable[Track] = []
|
result_tracks: Iterable[Track] = []
|
||||||
|
|
||||||
def album_tracks_gen(album_ids: Iterable[int | str]) -> Generator[Track]:
|
def album_tracks_gen(album_ids: Iterable[Union[int, str]]) -> Generator[Track]:
|
||||||
for album_id in album_ids:
|
for album_id in album_ids:
|
||||||
if full_album := client.albums_with_tracks(album_id):
|
if full_album := client.albums_with_tracks(album_id):
|
||||||
if volumes := full_album.volumes:
|
if volumes := full_album.volumes:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ DEFAULT_PATH_PATTERN = Path("#album-artist", "#album", "#number - #title")
|
||||||
DEFAULT_COVER_RESOLUTION = 400
|
DEFAULT_COVER_RESOLUTION = 400
|
||||||
|
|
||||||
|
|
||||||
def full_title(obj: YandexMusicObject) -> str | None:
|
def full_title(obj: YandexMusicObject) -> Optional[str]:
|
||||||
result = obj["title"]
|
result = obj["title"]
|
||||||
if result is None:
|
if result is None:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue