Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
from typing import TYPE_CHECKING, Optional
|
|
|
|
|
2020-01-26 21:19:22 +09:00
|
|
|
from yandex_music import YandexMusicObject
|
2021-09-19 22:47:19 +09:00
|
|
|
from yandex_music.utils import model
|
2020-01-26 21:19:22 +09:00
|
|
|
|
Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
from yandex_music import Client
|
|
|
|
|
2019-05-10 00:28:46 +09:00
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
@model
|
2019-05-10 00:28:46 +09:00
|
|
|
class Price(YandexMusicObject):
|
2020-01-26 03:09:03 +09:00
|
|
|
"""Класс, представляющий цену.
|
2019-07-02 20:40:41 +09:00
|
|
|
|
|
|
|
Attributes:
|
|
|
|
amount (:obj:`int`): Количество единиц.
|
|
|
|
currency (:obj:`str`): Валюта.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2019-07-02 20:40:41 +09:00
|
|
|
"""
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
amount: int
|
|
|
|
currency: str
|
|
|
|
client: Optional['Client'] = None
|
2019-05-10 00:28:46 +09:00
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
def __post_init__(self):
|
Добавлены основные тесты для следующий классов: DiscreteScale, Icon, Id, Images, Label, Pager, PlayCounter, Plus, Price, TrackId, TrackShortOld, Value.
Исправлены фикстуры и сравнения для вышеперечисленных классов.
2019-11-08 05:36:41 +09:00
|
|
|
self._id_attrs = (self.amount, self.currency)
|
2019-05-10 00:28:46 +09:00
|
|
|
|
|
|
|
@classmethod
|
Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['Price']:
|
2019-07-02 20:40:41 +09:00
|
|
|
"""Десериализация объекта.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
data (:obj:`dict`): Поля и значения десериализуемого объекта.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2019-07-02 20:40:41 +09:00
|
|
|
|
|
|
|
Returns:
|
Изменения описания de_json и de_list под новый стиль документации (#247).
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
2020-03-22 05:06:19 +09:00
|
|
|
:obj:`yandex_music.Price`: Цена.
|
2019-07-02 20:40:41 +09:00
|
|
|
"""
|
2019-05-10 00:28:46 +09:00
|
|
|
if not data:
|
|
|
|
return None
|
|
|
|
|
|
|
|
data = super(Price, cls).de_json(data, client)
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|