2019-12-27 18:14:51 +09:00
|
|
|
from typing import TYPE_CHECKING, Optional
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
from yandex_music import Client
|
|
|
|
|
2019-05-11 17:37:47 +09:00
|
|
|
from yandex_music import YandexMusicObject
|
|
|
|
|
|
|
|
|
|
|
|
class Ratings(YandexMusicObject):
|
|
|
|
def __init__(self,
|
2019-12-28 22:25:09 +09:00
|
|
|
week: int,
|
|
|
|
month: int,
|
|
|
|
day: Optional[int] = None,
|
2019-12-27 18:14:51 +09:00
|
|
|
client: Optional['Client'] = None,
|
|
|
|
**kwargs) -> None:
|
2019-05-11 17:37:47 +09:00
|
|
|
self.week = week
|
|
|
|
self.month = month
|
2019-05-16 21:45:25 +09:00
|
|
|
|
2019-05-11 17:37:47 +09:00
|
|
|
self.day = day
|
|
|
|
|
|
|
|
self.client = client
|
2019-11-08 06:37:53 +09:00
|
|
|
self._id_attrs = (self.week, self.month)
|
2019-05-11 17:37:47 +09:00
|
|
|
|
|
|
|
@classmethod
|
Тайп хинты для Label, TrackPosition, Artist, ArtistAlbums, ArtistTracks, BriefInfo, Counts, Description, Link, Ratings, Vinyl, AlbumEvent, ArtistEvent, Day, Event, GeneratedPlaylist, TrackWithAds, Genre, Images, Title
2019-12-28 20:38:59 +09:00
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['Ratings']:
|
2019-05-11 17:37:47 +09:00
|
|
|
if not data:
|
|
|
|
return None
|
|
|
|
|
|
|
|
data = super(Ratings, cls).de_json(data, client)
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|