From c0bae1d608571bd8766c74338408c2b9759ab20b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 23 Aug 2017 01:45:49 +0200 Subject: [PATCH] Replace type(...) == ... with isinstance() checks --- telethon/telegram_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 5b9644fb..67f29b2f 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -724,11 +724,11 @@ class TelegramClient(TelegramBareClient): if os.path.isdir(file) or not file: for attr in document.attributes: - if type(attr) == DocumentAttributeFilename: + if isinstance(attr, DocumentAttributeFilename): file = os.path.join(file, attr.file_name) break # This attribute has higher preference - elif type(attr) == DocumentAttributeAudio: + elif isinstance(attr, DocumentAttributeAudio): file = os.path.join( file, '{} - {}'.format(attr.performer, attr.title) )