From b35a7f9192c9d420f7ac94d237b56a89fe9fb55b Mon Sep 17 00:00:00 2001 From: Savvas Dalkitsis Date: Wed, 27 Nov 2024 19:25:52 +0000 Subject: [PATCH] Fixing lint warnings --- api/directory_watcher.py | 4 +--- api/models/photo.py | 12 +++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/directory_watcher.py b/api/directory_watcher.py index ac4321f392..aa59093877 100644 --- a/api/directory_watcher.py +++ b/api/directory_watcher.py @@ -198,9 +198,7 @@ def handle_new_image(user, path, job_id, photo=None): photo._get_blurhash() elapsed = (datetime.datetime.now() - start).total_seconds() util.logger.info( - "job {}: get blurhash: {}, elapsed: {}".format( - job_id, path, elapsed - ) + "job {}: get blurhash: {}, elapsed: {}".format(job_id, path, elapsed) ) photo._recreate_search_captions() elapsed = (datetime.datetime.now() - start).total_seconds() diff --git a/api/models/photo.py b/api/models/photo.py index 86bc571c71..e1589f7bca 100644 --- a/api/models/photo.py +++ b/api/models/photo.py @@ -4,10 +4,10 @@ from fractions import Fraction from io import BytesIO +import blurhash import numpy as np import PIL import requests -import blurhash from django.contrib.postgres.fields import ArrayField from django.core.files.base import ContentFile from django.db import models @@ -843,7 +843,9 @@ def _get_blurhash(self, palette_size=16): if self.blurhash: return try: - hash = blurhash.encode(self.square_thumbnail_small.path, x_components=4, y_components=4) + hash = blurhash.encode( + self.square_thumbnail_small.path, x_components=4, y_components=4 + ) self.blurhash = hash self.save() except Exception: @@ -886,7 +888,7 @@ def _set_embedded_media(self, obj): return obj.main_file.embedded_media def __str__(self): - main_file_path = self.main_file.path if self.main_file is not None else "No main file" - return ( - "{} - {} - {}".format(self.image_hash, self.owner, main_file_path) + main_file_path = ( + self.main_file.path if self.main_file is not None else "No main file" ) + return "{} - {} - {}".format(self.image_hash, self.owner, main_file_path)