Add missing async keywords in SQLiteSession

This commit is contained in:
Lonami Exo 2022-05-30 13:39:08 +02:00
parent 441fe9d076
commit 0f5eeb29e7

View File

@ -304,11 +304,11 @@ class SQLiteSession(MemorySession):
finally: finally:
c.close() c.close()
def get_entity_rows_by_phone(self, phone): async def get_entity_rows_by_phone(self, phone):
return self._execute( return self._execute(
'select id, hash from entities where phone = ?', phone) 'select id, hash from entities where phone = ?', phone)
def get_entity_rows_by_username(self, username): async def get_entity_rows_by_username(self, username):
c = self._cursor() c = self._cursor()
try: try:
results = c.execute( results = c.execute(
@ -329,7 +329,7 @@ class SQLiteSession(MemorySession):
finally: finally:
c.close() c.close()
def get_entity_rows_by_name(self, name): async def get_entity_rows_by_name(self, name):
return self._execute( return self._execute(
'select id, hash from entities where name = ?', name) 'select id, hash from entities where name = ?', name)
@ -347,7 +347,7 @@ class SQLiteSession(MemorySession):
# File processing # File processing
def get_file(self, md5_digest, file_size, cls): async def get_file(self, md5_digest, file_size, cls):
row = self._execute( row = self._execute(
'select id, hash from sent_files ' 'select id, hash from sent_files '
'where md5_digest = ? and file_size = ? and type = ?', 'where md5_digest = ? and file_size = ? and type = ?',
@ -357,7 +357,7 @@ class SQLiteSession(MemorySession):
# Both allowed classes have (id, access_hash) as parameters # Both allowed classes have (id, access_hash) as parameters
return cls(row[0], row[1]) return cls(row[0], row[1])
def cache_file(self, md5_digest, file_size, instance): async def cache_file(self, md5_digest, file_size, instance):
if not isinstance(instance, (InputDocument, InputPhoto)): if not isinstance(instance, (InputDocument, InputPhoto)):
raise TypeError('Cannot cache %s instance' % type(instance)) raise TypeError('Cannot cache %s instance' % type(instance))