style: lint code

This commit is contained in:
Christian Groschupp 2025-03-27 11:49:36 +01:00
parent 19476c593f
commit 5b248cd46b

View File

@ -206,7 +206,8 @@ class MediaRepository:
def get_single_media(self, mxid: MediaID) -> File | None: def get_single_media(self, mxid: MediaID) -> File | None:
"""Retrieve a single media file by ID.""" """Retrieve a single media file by ID."""
cur = self._execute( cur = self._execute(
"SELECT media_id, creation_ts, base64hash, file_size_bytes from mediaapi_media_repository WHERE media_id = %s;", """SELECT media_id, creation_ts, base64hash, file_size_bytes
from mediaapi_media_repository WHERE media_id = %s;""",
(mxid,), (mxid,),
) )
row = cur.fetchone() row = cur.fetchone()
@ -222,7 +223,8 @@ class MediaRepository:
List of File objects List of File objects
""" """
cur = self._execute( cur = self._execute(
"SELECT media_id, creation_ts, base64hash, file_size_bytes FROM mediaapi_media_repository WHERE user_id = %s;", """SELECT media_id, creation_ts, base64hash, file_size_bytes
FROM mediaapi_media_repository WHERE user_id = %s;""",
(user_id,), (user_id,),
) )
return [File(self, row[0], row[1] // 1000, row[2], row[3]) for row in cur.fetchall()] return [File(self, row[0], row[1] // 1000, row[2], row[3]) for row in cur.fetchall()]
@ -267,7 +269,7 @@ class MediaRepository:
) )
if (row := cur.fetchone()) and (count := row[0]): if (row := cur.fetchone()) and (count := row[0]):
logging.error( logging.error(
"You have %d thumbnails in your db that do not refer to media. " "This needs fixing (we don't do that)!", "You have %d thumbnails in your db that do not refer to media. This needs fixing (we don't do that)!",
count, count,
) )