Фикс type hints для python 3.9

This commit is contained in:
Lev Plyusnin 2024-11-11 06:35:13 +07:00
parent 3f7e90778c
commit c7e121b3e5
No known key found for this signature in database
GPG key ID: 21C6C2C9C0A4460D
3 changed files with 4 additions and 4 deletions

View file

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

View file

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

View file

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