Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@classmethod
def de_json(cls, json_string):
obj = cls.check_json(json_string)
title = obj['title']
description = obj['description']
photo = Game.parse_photo(obj['photo'])
text = obj.get('text')
text_entities = None
if 'text_entities' in obj:
text_entities = Game.parse_entities(obj['text_entities'])
animation = None
if 'animation' in obj:
animation = Animation.de_json(obj['animation'])
return cls(title, description, photo, text, text_entities, animation)
opts['author_signature'] = obj.get('author_signature')
if 'text' in obj:
opts['text'] = obj['text']
content_type = 'text'
if 'entities' in obj:
opts['entities'] = Message.parse_entities(obj['entities'])
if 'caption_entities' in obj:
opts['caption_entities'] = Message.parse_entities(obj['caption_entities'])
if 'audio' in obj:
opts['audio'] = Audio.de_json(obj['audio'])
content_type = 'audio'
if 'document' in obj:
opts['document'] = Document.de_json(obj['document'])
content_type = 'document'
if 'game' in obj:
opts['game'] = Game.de_json(obj['game'])
content_type = 'game'
if 'photo' in obj:
opts['photo'] = Message.parse_photo(obj['photo'])
content_type = 'photo'
if 'sticker' in obj:
opts['sticker'] = Sticker.de_json(obj['sticker'])
content_type = 'sticker'
if 'video' in obj:
opts['video'] = Video.de_json(obj['video'])
content_type = 'video'
if 'video_note' in obj:
opts['video_note'] = VideoNote.de_json(obj['video_note'])
content_type = 'video_note'
if 'voice' in obj:
opts['voice'] = Audio.de_json(obj['voice'])
content_type = 'voice'
@classmethod
def de_json(cls, json_string):
obj = cls.check_json(json_string)
title = obj['title']
description = obj['description']
photo = Game.parse_photo(obj['photo'])
text = obj.get('text')
text_entities = None
if 'text_entities' in obj:
text_entities = Game.parse_entities(obj['text_entities'])
animation = None
if 'animation' in obj:
animation = Animation.de_json(obj['animation'])
return cls(title, description, photo, text, text_entities, animation)