mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-09 14:04:36 +00:00
re-apply ruff TCH rules
This commit is contained in:
+4
-1
@@ -13,7 +13,7 @@
|
||||
#
|
||||
#
|
||||
import mimetypes
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
from urllib.parse import quote, urljoin
|
||||
|
||||
# This file contains all the views that concern the page model
|
||||
@@ -48,6 +48,9 @@ from core.views.widgets.ajax_select import (
|
||||
)
|
||||
from counter.utils import is_logged_in_counter
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def send_raw_file(path: Path) -> HttpResponse:
|
||||
"""Send a file located in the MEDIA_ROOT
|
||||
|
||||
+4
-1
@@ -22,8 +22,8 @@
|
||||
#
|
||||
import re
|
||||
from copy import copy
|
||||
from datetime import date, datetime
|
||||
from io import BytesIO
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from captcha.fields import CaptchaField
|
||||
from django import forms
|
||||
@@ -59,6 +59,9 @@ from core.views.widgets.ajax_select import (
|
||||
)
|
||||
from core.views.widgets.markdown import MarkdownInput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from datetime import date, datetime
|
||||
|
||||
# Widgets
|
||||
|
||||
|
||||
|
||||
+6
-2
@@ -22,11 +22,11 @@
|
||||
#
|
||||
#
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.db.models import F
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.views.generic import ListView, TemplateView
|
||||
|
||||
@@ -34,6 +34,10 @@ from club.models import Club
|
||||
from core.models import Notification, User
|
||||
from core.schemas import UserFilterSchema
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http import HttpRequest
|
||||
|
||||
|
||||
class NotificationList(LoginRequiredMixin, ListView):
|
||||
model = Notification
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import copy
|
||||
import inspect
|
||||
from typing import Any, ClassVar, LiteralString, Protocol, Unpack
|
||||
from typing import TYPE_CHECKING, Any, ClassVar, LiteralString, Protocol, Unpack
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.safestring import SafeString
|
||||
from django.views import View
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.safestring import SafeString
|
||||
|
||||
|
||||
class TabedViewMixin(View):
|
||||
"""Basic functions for displaying tabs in the template."""
|
||||
|
||||
+4
-1
@@ -27,6 +27,7 @@ from datetime import timedelta
|
||||
# This file contains all the views that concern the user model
|
||||
from operator import itemgetter
|
||||
from smtplib import SMTPException
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import login, views
|
||||
@@ -43,7 +44,6 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.safestring import SafeString
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators.http import require_POST
|
||||
from django.views.generic import (
|
||||
@@ -73,6 +73,9 @@ from counter.models import Refilling, Selling
|
||||
from eboutic.models import Invoice
|
||||
from trombi.views import UserTrombiForm
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.utils.safestring import SafeString
|
||||
|
||||
|
||||
class SithLoginView(views.LoginView):
|
||||
"""The login View."""
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
from collections.abc import Collection
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
from django.db.models import Model, QuerySet
|
||||
from django.forms import Select, SelectMultiple
|
||||
from ninja import ModelSchema
|
||||
from pydantic import TypeAdapter
|
||||
|
||||
from core.models import Group, SithFile, User
|
||||
from core.schemas import GroupSchema, SithFileSchema, UserProfileSchema
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Collection
|
||||
|
||||
from django.db.models import Model, QuerySet
|
||||
from ninja import ModelSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectMixin:
|
||||
component_name = "autocomplete-select"
|
||||
|
||||
Reference in New Issue
Block a user