From f45864c7866e85874def23823e61a9886570cd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Mon, 4 Aug 2025 00:12:47 +0200 Subject: [PATCH] Fix random Mypy errors --- .vscode/settings.json | 1 + accounts/views.py | 2 +- config/asgi.py | 13 ------------- config/urls.py | 2 +- twitch/admin.py | 4 ++-- twitch/apps.py | 2 +- twitch/models.py | 2 +- 7 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 config/asgi.py diff --git a/.vscode/settings.json b/.vscode/settings.json index bbdd9cd..0710d93 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,6 +23,7 @@ "pydocstyle", "pyright", "pytest", + "Ravendawn", "regularuser", "runserver", "sendgrid", diff --git a/accounts/views.py b/accounts/views.py index 735db1d..1e52ca1 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -85,7 +85,7 @@ def profile_view(request: HttpRequest) -> HttpResponse: Returns: HttpResponse: Rendered profile template. """ - subscriptions = NotificationSubscription.objects.filter(user=request.user) + subscriptions = NotificationSubscription.objects.filter(user=request.user) # type: ignore[misc] return render( request, "accounts/profile.html", diff --git a/config/asgi.py b/config/asgi.py deleted file mode 100644 index ee676ef..0000000 --- a/config/asgi.py +++ /dev/null @@ -1,13 +0,0 @@ -from __future__ import annotations - -import os -from typing import TYPE_CHECKING - -from django.core.asgi import get_asgi_application - -if TYPE_CHECKING: - from django.core.handlers.asgi import ASGIHandler - -os.environ.setdefault(key="DJANGO_SETTINGS_MODULE", value="config.settings") - -application: ASGIHandler = get_asgi_application() diff --git a/config/urls.py b/config/urls.py index 0d8dde6..3219159 100644 --- a/config/urls.py +++ b/config/urls.py @@ -2,7 +2,7 @@ from __future__ import annotations from typing import TYPE_CHECKING -from debug_toolbar.toolbar import debug_toolbar_urls # pyright: ignore[reportMissingTypeStubs] +from debug_toolbar.toolbar import debug_toolbar_urls # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs] from django.conf import settings from django.contrib import admin from django.urls import include, path diff --git a/twitch/admin.py b/twitch/admin.py index b6e026d..4f2515b 100644 --- a/twitch/admin.py +++ b/twitch/admin.py @@ -35,7 +35,7 @@ class DropCampaignAdmin(admin.ModelAdmin): list_display = ("id", "name", "game", "owner", "start_at", "end_at", "is_active") list_filter = ("game", "owner") search_fields = ("id", "name", "description") - inlines = [TimeBasedDropInline] # noqa: RUF012 + inlines = [TimeBasedDropInline] readonly_fields = ("created_at", "updated_at") @@ -61,7 +61,7 @@ class TimeBasedDropAdmin(admin.ModelAdmin): ) list_filter = ("campaign__game", "campaign") search_fields = ("id", "name") - inlines = [DropBenefitEdgeInline] # noqa: RUF012 + inlines = [DropBenefitEdgeInline] @admin.register(DropBenefit) diff --git a/twitch/apps.py b/twitch/apps.py index c481710..a1cf1aa 100644 --- a/twitch/apps.py +++ b/twitch/apps.py @@ -6,5 +6,5 @@ from django.apps import AppConfig class TwitchConfig(AppConfig): """AppConfig subclass for the 'twitch' application.""" - default_auto_field: str = "django.db.models.BigAutoField" + default_auto_field = "django.db.models.BigAutoField" name = "twitch" diff --git a/twitch/models.py b/twitch/models.py index 404b63f..c918141 100644 --- a/twitch/models.py +++ b/twitch/models.py @@ -166,7 +166,7 @@ class TimeBasedDrop(models.Model): # Foreign keys campaign = models.ForeignKey(DropCampaign, on_delete=models.CASCADE, related_name="time_based_drops", db_index=True) - benefits = models.ManyToManyField(DropBenefit, through="DropBenefitEdge", related_name="drops") + benefits = models.ManyToManyField(DropBenefit, through="DropBenefitEdge", related_name="drops") # type: ignore[var-annotated] class Meta: indexes: ClassVar[list] = [