本文整理汇总了Python中telegram.PhotoSize类的典型用法代码示例。如果您正苦于以下问题:Python PhotoSize类的具体用法?Python PhotoSize怎么用?Python PhotoSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhotoSize类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: de_json
def de_json(data):
"""
Args:
data (dict):
Returns:
telegram.Message:
"""
if not data:
return None
data['from_user'] = User.de_json(data.get('from'))
data['date'] = datetime.fromtimestamp(data['date'])
data['chat'] = Chat.de_json(data.get('chat'))
data['entities'] = MessageEntity.de_list(data.get('entities'))
data['forward_from'] = User.de_json(data.get('forward_from'))
data['forward_date'] = Message._fromtimestamp(data.get('forward_date'))
data['reply_to_message'] = \
Message.de_json(data.get('reply_to_message'))
data['audio'] = Audio.de_json(data.get('audio'))
data['document'] = Document.de_json(data.get('document'))
data['photo'] = PhotoSize.de_list(data.get('photo'))
data['sticker'] = Sticker.de_json(data.get('sticker'))
data['video'] = Video.de_json(data.get('video'))
data['voice'] = Voice.de_json(data.get('voice'))
data['contact'] = Contact.de_json(data.get('contact'))
data['location'] = Location.de_json(data.get('location'))
data['venue'] = Venue.de_json(data.get('venue'))
data['new_chat_member'] = User.de_json(data.get('new_chat_member'))
data['left_chat_member'] = User.de_json(data.get('left_chat_member'))
data['new_chat_photo'] = PhotoSize.de_list(data.get('new_chat_photo'))
data['pinned_message'] = Message.de_json(data.get('pinned_message'))
return Message(**data)
开发者ID:AlexR1712,项目名称:python-telegram-bot,代码行数:34,代码来源:message.py
示例2: de_json
def de_json(cls, data, bot):
if not data:
return None
data = super(Message, cls).de_json(data, bot)
data['from_user'] = User.de_json(data.get('from'), bot)
data['date'] = from_timestamp(data['date'])
data['chat'] = Chat.de_json(data.get('chat'), bot)
data['entities'] = MessageEntity.de_list(data.get('entities'), bot)
data['forward_from'] = User.de_json(data.get('forward_from'), bot)
data['forward_from_chat'] = Chat.de_json(data.get('forward_from_chat'), bot)
data['forward_date'] = from_timestamp(data.get('forward_date'))
data['reply_to_message'] = Message.de_json(data.get('reply_to_message'), bot)
data['edit_date'] = from_timestamp(data.get('edit_date'))
data['audio'] = Audio.de_json(data.get('audio'), bot)
data['document'] = Document.de_json(data.get('document'), bot)
data['game'] = Game.de_json(data.get('game'), bot)
data['photo'] = PhotoSize.de_list(data.get('photo'), bot)
data['sticker'] = Sticker.de_json(data.get('sticker'), bot)
data['video'] = Video.de_json(data.get('video'), bot)
data['voice'] = Voice.de_json(data.get('voice'), bot)
data['video_note'] = VideoNote.de_json(data.get('video_note'), bot)
data['contact'] = Contact.de_json(data.get('contact'), bot)
data['location'] = Location.de_json(data.get('location'), bot)
data['venue'] = Venue.de_json(data.get('venue'), bot)
data['new_chat_member'] = User.de_json(data.get('new_chat_member'), bot)
data['new_chat_members'] = User.de_list(data.get('new_chat_members'), bot)
data['left_chat_member'] = User.de_json(data.get('left_chat_member'), bot)
data['new_chat_photo'] = PhotoSize.de_list(data.get('new_chat_photo'), bot)
data['pinned_message'] = Message.de_json(data.get('pinned_message'), bot)
data['invoice'] = Invoice.de_json(data.get('invoice'), bot)
data['successful_payment'] = SuccessfulPayment.de_json(data.get('successful_payment'), bot)
return cls(bot=bot, **data)
开发者ID:noam09,项目名称:deluge-telegramer,代码行数:35,代码来源:message.py
示例3: de_json
def de_json(data):
"""
Args:
data (str):
Returns:
telegram.Message:
"""
if not data:
return None
data['from_user'] = User.de_json(data.get('from'))
data['date'] = datetime.fromtimestamp(data['date'])
if 'first_name' in data.get('chat', ''):
data['chat'] = User.de_json(data.get('chat'))
elif 'title' in data.get('chat', ''):
data['chat'] = GroupChat.de_json(data.get('chat'))
data['forward_from'] = \
User.de_json(data.get('forward_from'))
data['forward_date'] = \
Message._fromtimestamp(data.get('forward_date'))
data['reply_to_message'] = \
Message.de_json(data.get('reply_to_message'))
data['audio'] = \
Audio.de_json(data.get('audio'))
data['document'] = \
Document.de_json(data.get('document'))
data['photo'] = \
PhotoSize.de_list(data.get('photo'))
data['sticker'] = \
Sticker.de_json(data.get('sticker'))
data['video'] = \
Video.de_json(data.get('video'))
data['voice'] = \
Voice.de_json(data.get('voice'))
data['contact'] = \
Contact.de_json(data.get('contact'))
data['location'] = \
Location.de_json(data.get('location'))
data['new_chat_participant'] = \
User.de_json(data.get('new_chat_participant'))
data['left_chat_participant'] = \
User.de_json(data.get('left_chat_participant'))
data['new_chat_photo'] = \
PhotoSize.de_list(data.get('new_chat_photo'))
return Message(**data)
开发者ID:SalamiArmy,项目名称:hitagibot,代码行数:47,代码来源:message.py
示例4: de_json
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)
开发者ID:technoekat,项目名称:prodeda1,代码行数:9,代码来源:document.py
示例5: de_json
def de_json(cls, data, bot):
if not data:
return None
data = super(UserProfilePhotos, cls).de_json(data, bot)
data['photos'] = [PhotoSize.de_list(photo, bot) for photo in data['photos']]
return cls(**data)
开发者ID:hobbit19,项目名称:python-telegram-bot,代码行数:9,代码来源:userprofilephotos.py
示例6: de_json
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)
开发者ID:noam09,项目名称:deluge-telegramer,代码行数:9,代码来源:videonote.py
示例7: de_json
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)
开发者ID:noam09,项目名称:deluge-telegramer,代码行数:10,代码来源:sticker.py
示例8: de_json
def de_json(cls, data, bot):
if not data:
return None
data = super(Game, cls).de_json(data, bot)
data['photo'] = PhotoSize.de_list(data.get('photo'), bot)
data['text_entities'] = MessageEntity.de_list(data.get('text_entities'), bot)
data['animation'] = Animation.de_json(data.get('animation'), bot)
return cls(**data)
开发者ID:hobbit19,项目名称:python-telegram-bot,代码行数:11,代码来源:game.py
示例9: de_json
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)
开发者ID:JASON0916,项目名称:python-telegram-bot,代码行数:11,代码来源:userprofilephotos.py
示例10: de_json
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))
开发者ID:FablabTorino,项目名称:AUG-Torino,代码行数:12,代码来源:sticker.py
示例11: de_json
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))
开发者ID:o0khoiclub0o,项目名称:thimbot,代码行数:12,代码来源:document.py
示例12: test_de_json
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
开发者ID:ferisystem,项目名称:python-telegram-bot,代码行数:13,代码来源:test_photo.py
示例13: de_json
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)
开发者ID:jgrondier,项目名称:python-telegram-bot,代码行数:14,代码来源:video.py
示例14: de_json
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)
开发者ID:Mozta,项目名称:portal_xelhaWin,代码行数:14,代码来源:sticker.py
示例15: de_json
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)
开发者ID:Mozta,项目名称:portal_xelhaWin,代码行数:14,代码来源:document.py
示例16: de_json
def de_json(data):
"""
Args:
data (str):
Returns:
telegram.UserProfilePhotos:
"""
if not data:
return None
data['photos'] = [PhotoSize.de_list(photo) for photo in data['photos']]
return UserProfilePhotos(**data)
开发者ID:AlexR1712,项目名称:python-telegram-bot,代码行数:14,代码来源:userprofilephotos.py
示例17: de_json
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))
开发者ID:o0khoiclub0o,项目名称:thimbot,代码行数:14,代码来源:video.py
示例18: de_json
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)
开发者ID:matibarriento,项目名称:python-telegram-bot,代码行数:15,代码来源:sticker.py
示例19: de_json
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)
开发者ID:python-telegram-bot,项目名称:python-telegram-bot,代码行数:15,代码来源:video.py
示例20: de_json
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)
开发者ID:KenOokamiHoro,项目名称:python-telegram-bot,代码行数:17,代码来源:animation.py
注:本文中的telegram.PhotoSize类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论