Replace type(...) == ... with isinstance() checks

This commit is contained in:
Lonami Exo 2017-08-23 01:45:49 +02:00
parent 65d5ab685f
commit c0bae1d608

View File

@ -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)
)