Remove mark from peer_id

This commit is contained in:
Lonami Exo
2021-09-18 16:29:45 +02:00
parent 9f3bb52e4e
commit 431a9309e3
9 changed files with 45 additions and 89 deletions

View File

@@ -165,17 +165,8 @@ class MemorySession(Session):
def get_entity_rows_by_id(self, id, exact=True):
try:
if exact:
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id == id)
else:
ids = (
utils.get_peer_id(_tl.PeerUser(id)),
utils.get_peer_id(_tl.PeerChat(id)),
utils.get_peer_id(_tl.PeerChannel(id))
)
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id in ids)
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id == id)
except StopIteration:
pass

View File

@@ -316,16 +316,8 @@ class SQLiteSession(MemorySession):
'select id, hash from entities where name = ?', name)
def get_entity_rows_by_id(self, id, exact=True):
if exact:
return self._execute(
'select id, hash from entities where id = ?', id)
else:
return self._execute(
'select id, hash from entities where id in (?,?,?)',
utils.get_peer_id(_tl.PeerUser(id)),
utils.get_peer_id(_tl.PeerChat(id)),
utils.get_peer_id(_tl.PeerChannel(id))
)
return self._execute(
'select id, hash from entities where id = ?', id)
# File processing