fixed ruff in backend

This commit is contained in:
nvrl committed 2026-05-02 11:14:02 +02:00
1 parent 173da217d6
commit 5da8ead2ff
6 files changed
+11 -20

No files matched your search

@@ -42,9 +42,7 @@ class Command(BaseCommand):
referenced_dirs: set[str] = set()
legacy_image_files: set[str] = set()
for flavor in Flavor.objects.all().only(
"local_image_paths", "main_image_path", "image"
):
for flavor in Flavor.objects.all().only("local_image_paths", "main_image_path", "image"):
paths = list(flavor.local_image_paths or [])
if flavor.main_image_path:
paths.append(flavor.main_image_path)
@@ -86,7 +84,9 @@ class Command(BaseCommand):
entry.unlink()
verb = "Would delete" if dry_run else "Deleted"
self.stdout.write(self.style.SUCCESS(f"{verb}: {len(deleted_dirs)} dirs, {len(deleted_files)} files"))
self.stdout.write(
self.style.SUCCESS(f"{verb}: {len(deleted_dirs)} dirs, {len(deleted_files)} files")
)
for path in deleted_dirs:
self.stdout.write(f" dir {path}")
for path in deleted_files:
@@ -71,7 +71,9 @@ class Command(BaseCommand):
results: dict[int, str] = {}
with ThreadPoolExecutor(max_workers=_DOWNLOAD_WORKERS) as ex:
futures = {ex.submit(self.download_image_to_path, url, rel): i for i, url, rel in targets}
futures = {
ex.submit(self.download_image_to_path, url, rel): i for i, url, rel in targets
}
for fut, i in futures.items():
saved = fut.result()
if saved:
+1 -3
View File
@@ -32,9 +32,7 @@ class User(AbstractUser):
]
theme = models.CharField(max_length=20, choices=THEME_CHOICES, default="holy_light")
language = models.CharField(max_length=2, choices=LANGUAGE_CHOICES, default="en")
drawer_anchor = models.CharField(
max_length=5, choices=DRAWER_ANCHOR_CHOICES, default="left"
)
drawer_anchor = models.CharField(max_length=5, choices=DRAWER_ANCHOR_CHOICES, default="left")
avatar = models.ImageField(upload_to="avatars/", blank=True, null=True)
pending_email = models.EmailField(max_length=254, blank=True, null=True)
email_confirmation_code = models.CharField(max_length=6, blank=True, null=True)
+2 -6
View File
@@ -56,9 +56,5 @@ class JWTAuthTests(APITestCase):
response = self.client.post(reverse("auth_logout"), format="json")
self.assertEqual(response.status_code, status.HTTP_200_OK)
# set-cookie should be present with empty/expired value to clear them.
self.assertEqual(
response.cookies[settings.JWT_AUTH_COOKIE_ACCESS].value, ""
)
self.assertEqual(
response.cookies[settings.JWT_AUTH_COOKIE_REFRESH].value, ""
)
self.assertEqual(response.cookies[settings.JWT_AUTH_COOKIE_ACCESS].value, "")
self.assertEqual(response.cookies[settings.JWT_AUTH_COOKIE_REFRESH].value, "")
-2
View File
@@ -35,8 +35,6 @@ class CookieJWTScheme(OpenApiAuthenticationExtension):
}
def set_jwt_cookies(response, access: str | None, refresh: str | None) -> None:
"""Attach access/refresh tokens to the response as httpOnly cookies."""
from datetime import timedelta
+1 -4
View File
@@ -160,10 +160,7 @@ class AdminViewSet(viewsets.ViewSet):
try:
send_mail(
"Holy Flavors Admin Test Email",
(
f"This is a test email sent to {me.email} from the "
f"Holy Flavors Admin Interface."
),
(f"This is a test email sent to {me.email} from the Holy Flavors Admin Interface."),
settings.DEFAULT_FROM_EMAIL,
[me.email],
fail_silently=False,