Clearer variable names in get_input_entity (#738)

This commit is contained in:
Tanuj 2018-04-03 12:05:01 +01:00 committed by Lonami
parent cb226e7f45
commit a1448f3da8

View File

@ -196,14 +196,15 @@ class MemorySession(Session):
result = self.get_entity_rows_by_name(key) result = self.get_entity_rows_by_name(key)
if result: if result:
i, h = result # unpack resulting tuple entity_id, entity_hash = result # unpack resulting tuple
i, k = utils.resolve_id(i) # removes the mark and returns kind entity_id, kind = utils.resolve_id(entity_id)
if k == PeerUser: # removes the mark and returns type of entity
return InputPeerUser(i, h) if kind == PeerUser:
elif k == PeerChat: return InputPeerUser(entity_id, entity_hash)
return InputPeerChat(i) elif kind == PeerChat:
elif k == PeerChannel: return InputPeerChat(entity_id)
return InputPeerChannel(i, h) elif kind == PeerChannel:
return InputPeerChannel(entity_id, entity_hash)
else: else:
raise ValueError('Could not find input entity with key ', key) raise ValueError('Could not find input entity with key ', key)