mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
fixed ruff in backend
This commit is contained in:
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()
|
referenced_dirs: set[str] = set()
|
||||||
legacy_image_files: set[str] = set()
|
legacy_image_files: set[str] = set()
|
||||||
|
|
||||||
for flavor in Flavor.objects.all().only(
|
for flavor in Flavor.objects.all().only("local_image_paths", "main_image_path", "image"):
|
||||||
"local_image_paths", "main_image_path", "image"
|
|
||||||
):
|
|
||||||
paths = list(flavor.local_image_paths or [])
|
paths = list(flavor.local_image_paths or [])
|
||||||
if flavor.main_image_path:
|
if flavor.main_image_path:
|
||||||
paths.append(flavor.main_image_path)
|
paths.append(flavor.main_image_path)
|
||||||
@@ -86,7 +84,9 @@ class Command(BaseCommand):
|
|||||||
entry.unlink()
|
entry.unlink()
|
||||||
|
|
||||||
verb = "Would delete" if dry_run else "Deleted"
|
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:
|
for path in deleted_dirs:
|
||||||
self.stdout.write(f" dir {path}")
|
self.stdout.write(f" dir {path}")
|
||||||
for path in deleted_files:
|
for path in deleted_files:
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
results: dict[int, str] = {}
|
results: dict[int, str] = {}
|
||||||
with ThreadPoolExecutor(max_workers=_DOWNLOAD_WORKERS) as ex:
|
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():
|
for fut, i in futures.items():
|
||||||
saved = fut.result()
|
saved = fut.result()
|
||||||
if saved:
|
if saved:
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ class User(AbstractUser):
|
|||||||
]
|
]
|
||||||
theme = models.CharField(max_length=20, choices=THEME_CHOICES, default="holy_light")
|
theme = models.CharField(max_length=20, choices=THEME_CHOICES, default="holy_light")
|
||||||
language = models.CharField(max_length=2, choices=LANGUAGE_CHOICES, default="en")
|
language = models.CharField(max_length=2, choices=LANGUAGE_CHOICES, default="en")
|
||||||
drawer_anchor = models.CharField(
|
drawer_anchor = models.CharField(max_length=5, choices=DRAWER_ANCHOR_CHOICES, default="left")
|
||||||
max_length=5, choices=DRAWER_ANCHOR_CHOICES, default="left"
|
|
||||||
)
|
|
||||||
avatar = models.ImageField(upload_to="avatars/", blank=True, null=True)
|
avatar = models.ImageField(upload_to="avatars/", blank=True, null=True)
|
||||||
pending_email = models.EmailField(max_length=254, 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)
|
email_confirmation_code = models.CharField(max_length=6, blank=True, null=True)
|
||||||
|
|||||||
@@ -56,9 +56,5 @@ class JWTAuthTests(APITestCase):
|
|||||||
response = self.client.post(reverse("auth_logout"), format="json")
|
response = self.client.post(reverse("auth_logout"), format="json")
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
# set-cookie should be present with empty/expired value to clear them.
|
# set-cookie should be present with empty/expired value to clear them.
|
||||||
self.assertEqual(
|
self.assertEqual(response.cookies[settings.JWT_AUTH_COOKIE_ACCESS].value, "")
|
||||||
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_REFRESH].value, ""
|
|
||||||
)
|
|
||||||
@@ -35,8 +35,6 @@ class CookieJWTScheme(OpenApiAuthenticationExtension):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_jwt_cookies(response, access: str | None, refresh: str | None) -> None:
|
def set_jwt_cookies(response, access: str | None, refresh: str | None) -> None:
|
||||||
"""Attach access/refresh tokens to the response as httpOnly cookies."""
|
"""Attach access/refresh tokens to the response as httpOnly cookies."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|||||||
@@ -160,10 +160,7 @@ class AdminViewSet(viewsets.ViewSet):
|
|||||||
try:
|
try:
|
||||||
send_mail(
|
send_mail(
|
||||||
"Holy Flavors Admin Test Email",
|
"Holy Flavors Admin Test Email",
|
||||||
(
|
(f"This is a test email sent to {me.email} from the Holy Flavors Admin Interface."),
|
||||||
f"This is a test email sent to {me.email} from the "
|
|
||||||
f"Holy Flavors Admin Interface."
|
|
||||||
),
|
|
||||||
settings.DEFAULT_FROM_EMAIL,
|
settings.DEFAULT_FROM_EMAIL,
|
||||||
[me.email],
|
[me.email],
|
||||||
fail_silently=False,
|
fail_silently=False,
|
||||||
|
|||||||
Reference in new issue
Block a user