本文整理汇总了Python中telegram.PhotoSize.de_json方法的典型用法代码示例。如果您正苦于以下问题:Python PhotoSize.de_json方法的具体用法?Python PhotoSize.de_json怎么用?Python PhotoSize.de_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类telegram.PhotoSize
的用法示例。
在下文中一共展示了PhotoSize.de_json方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(cls, data, bot):
if not data:
return None
data = super(Document, cls).de_json(data, bot)
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
return cls(bot=bot, **data)
示例2: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(cls, data, bot):
if not data:
return None
data = super(VideoNote, cls).de_json(data, bot)
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
return cls(**data)
示例3: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(cls, data, bot):
if not data:
return None
data = super(Sticker, cls).de_json(data, bot)
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
data['mask_position'] = MaskPosition.de_json(data.get('mask_position'), bot)
return cls(**data)
示例4: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
if 'photos' in data:
from telegram import PhotoSize
photos = []
for photo in data['photos']:
photos.append([PhotoSize.de_json(x) for x in photo])
else:
photos = None
return UserProfilePhotos(total_count=data.get('total_count', None),
photos=photos)
示例5: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
if 'thumb' in data:
from telegram import PhotoSize
thumb = PhotoSize.de_json(data['thumb'])
else:
thumb = None
return Sticker(file_id=data.get('file_id', None),
width=data.get('width', None),
height=data.get('height', None),
thumb=thumb,
file_size=data.get('file_size', None))
示例6: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
if 'thumb' in data:
from telegram import PhotoSize
thumb = PhotoSize.de_json(data['thumb'])
else:
thumb = None
return Document(file_id=data.get('file_id', None),
thumb=thumb,
file_name=data.get('file_name', None),
mime_type=data.get('mime_type', None),
file_size=data.get('file_size', None))
示例7: test_de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def test_de_json(self, bot, photo):
json_dict = {
'file_id': photo.file_id,
'width': self.width,
'height': self.height,
'file_size': self.file_size
}
json_photo = PhotoSize.de_json(json_dict, bot)
assert json_photo.file_id == photo.file_id
assert json_photo.width == self.width
assert json_photo.height == self.height
assert json_photo.file_size == self.file_size
示例8: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
if 'thumb' in data:
from telegram import PhotoSize
thumb = PhotoSize.de_json(data['thumb'])
else:
thumb = None
return Video(file_id=data.get('file_id', None),
width=data.get('width', None),
height=data.get('height', None),
duration=data.get('duration', None),
thumb=thumb,
mime_type=data.get('mime_type', None),
file_size=data.get('file_size', None))
示例9: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
"""
Args:
data (str):
Returns:
telegram.Document:
"""
if not data:
return None
data['thumb'] = PhotoSize.de_json(data.get('thumb'))
return Document(**data)
示例10: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
"""
Args:
data (str):
Returns:
telegram.Video:
"""
if not data:
return None
data["thumb"] = PhotoSize.de_json(data.get("thumb"))
return Video(**data)
示例11: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data):
"""
Args:
data (str):
Returns:
telegram.Sticker:
"""
if not data:
return None
data['thumb'] = PhotoSize.de_json(data.get('thumb'))
return Sticker(**data)
示例12: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data, bot):
"""
Args:
data (dict):
bot (telegram.Bot):
Returns:
telegram.Sticker:
"""
if not data:
return None
data["thumb"] = PhotoSize.de_json(data.get("thumb"), bot)
return Sticker(**data)
示例13: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data, bot):
"""
Args:
data (dict):
bot (telegram.Bot):
Returns:
telegram.Video:
"""
if not data:
return None
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
return Video(**data)
示例14: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data, bot):
"""
Args:
data (dict):
bot (telegram.Bot):
Returns:
telegram.Document:
"""
if not data:
return None
data = super(Document, Document).de_json(data, bot)
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
return Document(**data)
示例15: de_json
# 需要导入模块: from telegram import PhotoSize [as 别名]
# 或者: from telegram.PhotoSize import de_json [as 别名]
def de_json(data, bot):
"""
Args:
data (dict):
bot (telegram.Bot):
Returns:
telegram.Game:
"""
if not data:
return None
data = super(Animation, Animation).de_json(data, bot)
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
return Animation(**data)