def de_json(cls, data, client): """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`): Объект класса :class:`yandex_music.Client`, представляющий клиент Yandex Music. Returns: :obj:`yandex_music.Station`: Объект класса :class:`yandex_music.Station`. """ if not data: return None data = super(Station, cls).de_json(data, client) from yandex_music import Id, Icon, Restrictions data['id_'] = Id.de_json(data.get('id_'), client) data['parent_id'] = Id.de_json(data.get('parent_id'), client) data['icon'] = Icon.de_json(data.get('icon'), client) data['mts_icon'] = Icon.de_json(data.get('mts_icon'), client) data['geocell_icon'] = Icon.de_json(data.get('geocell_icon'), client) data['restrictions'] = Restrictions.de_json(data.get('restrictions'), client) data['restrictions2'] = Restrictions.de_json(data.get('restrictions2'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['Station']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.Station`: Станция. """ if not data: return None data = super(Station, cls).de_json(data, client) from yandex_music import Id, Icon, Restrictions data['id_'] = Id.de_json(data.get('id_'), client) data['parent_id'] = Id.de_json(data.get('parent_id'), client) data['icon'] = Icon.de_json(data.get('icon'), client) data['mts_icon'] = Icon.de_json(data.get('mts_icon'), client) data['geocell_icon'] = Icon.de_json(data.get('geocell_icon'), client) data['restrictions'] = Restrictions.de_json(data.get('restrictions'), client) data['restrictions2'] = Restrictions.de_json(data.get('restrictions2'), client) return cls(client=client, **data)
def de_json(cls, data, client): if not data: return None data = super(Station, cls).de_json(data, client) from yandex_music import Id, Icon, Restrictions data['id'] = Id.de_json(data.get('id'), client) data['parent_id'] = Id.de_json(data.get('parent_id'), client) data['icon'] = Icon.de_json(data.get('icon'), client) data['mts_icon'] = Icon.de_json(data.get('mts_icon'), client) data['geocell_icon'] = Icon.de_json(data.get('geocell_icon'), client) data['restrictions'] = Restrictions.de_json(data.get('restrictions'), client) data['restrictions2'] = Restrictions.de_json(data.get('restrictions2'), client) return cls(client=client, **data)
def de_json(cls, data, client) -> Optional['StationTracksResult']: if not data: return None data = super(StationTracksResult, cls).de_json(data, client) from yandex_music import Id, Sequence data['id_'] = Id.de_json(data.get('id_'), client) data['sequence'] = Sequence.de_list(data.get('sequence'), client) return cls(client=client, **data)
def de_json(cls, data, client) -> Optional['StationTracksResult']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.StationTracksResult`: Последовательность треков станции. """ if not data: return None data = super(StationTracksResult, cls).de_json(data, client) from yandex_music import Id, Sequence data['id_'] = Id.de_json(data.get('id_'), client) data['sequence'] = Sequence.de_list(data.get('sequence'), client) return cls(client=client, **data)
def de_json(cls, data, client): """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`): Объект класса :class:`yandex_music.Client`, представляющий клиент Yandex Music. Returns: :obj:`yandex_music.StationTracksResult`: Объект класса :class:`yandex_music.StationTracksResult`. """ if not data: return None data = super(StationTracksResult, cls).de_json(data, client) from yandex_music import Id, Sequence data['id_'] = Id.de_json(data.get('id_'), client) data['sequence'] = Sequence.de_list(data.get('sequence'), client) return cls(client=client, **data)
def test_de_json_all(self, client): json_dict = {'type': self.type, 'tag': self.tag} id = Id.de_json(json_dict, client) assert id.type == self.type assert id.tag == self.tag
def test_de_json_required(self, client): json_dict = {'type_': self.type, 'tag': self.tag} id_ = Id.de_json(json_dict, client) assert id_.type == self.type assert id_.tag == self.tag
def test_de_json_none(self, client): assert Id.de_json({}, client) is None