Добавлены тайп-хинты для следующих классов: 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
|
|
|
|
|
Добавлены тайп-хинты для следующих классов: 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
|
|
|
|
|
|
|
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`): Валюта.
|
2019-07-05 02:21:54 +09:00
|
|
|
client (:obj:`yandex_music.Client`): Объект класса :class:`yandex_music.Client` представляющий клиент Yandex
|
2019-07-02 20:40:41 +09:00
|
|
|
Music.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
amount (:obj:`int`): Количество единиц.
|
|
|
|
currency (:obj:`str`): Валюта.
|
2019-07-05 02:21:54 +09:00
|
|
|
client (:obj:`yandex_music.Client`, optional): Объект класса :class:`yandex_music.Client` представляющий клиент
|
2019-07-03 21:28:54 +09:00
|
|
|
Yandex Music.
|
2019-07-02 20:40:41 +09:00
|
|
|
**kwargs: Произвольные ключевые аргументы полученные от API.
|
|
|
|
"""
|
|
|
|
|
2019-05-10 00:28:46 +09:00
|
|
|
def __init__(self,
|
Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
amount: int,
|
|
|
|
currency: str,
|
|
|
|
client: Optional['Client'] = None,
|
|
|
|
**kwargs) -> None:
|
2019-05-10 00:28:46 +09:00
|
|
|
self.amount = amount
|
|
|
|
self.currency = currency
|
|
|
|
|
|
|
|
self.client = client
|
Добавлены основные тесты для следующий классов: 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`): Поля и значения десериализуемого объекта.
|
2019-07-05 02:21:54 +09:00
|
|
|
client (:obj:`yandex_music.Client`): Объект класса :class:`yandex_music.Client` представляющий клиент Yandex
|
2019-07-02 20:40:41 +09:00
|
|
|
Music.
|
|
|
|
|
|
|
|
Returns:
|
2019-07-05 02:21:54 +09:00
|
|
|
:obj:`yandex_music.Price`: Объект класса :class:`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)
|