Apply black to codes

This commit is contained in:
Griatch 2024-04-01 17:51:05 +02:00
parent 870c0f5f75
commit c5a4a34bac
180 changed files with 495 additions and 288 deletions

View file

@ -1,6 +1,7 @@
"""
This defines how to edit help entries in Admin.
"""
from django import forms
from django.contrib import admin

View file

@ -3,7 +3,6 @@ Tag admin
"""
import traceback
from datetime import datetime

View file

@ -4,6 +4,7 @@ Rerouting admin frontpage to evennia version.
These patterns are all under the admin/* namespace.
"""
from django.conf import settings
from django.contrib import admin
from django.urls import include, path

View file

@ -7,6 +7,7 @@ documentation specifically regarding DRF integration.
https://django-filter.readthedocs.io/en/latest/guide/rest_framework.html
"""
from typing import Union
from django.db.models import Q
@ -138,7 +139,6 @@ class ScriptDBFilterSet(BaseTypeclassFilterSet):
class HelpFilterSet(FilterSet):
"""
Filter for help entries

View file

@ -3,7 +3,6 @@ Sets up an api-access permission check using the in-game permission hierarchy.
"""
from django.conf import settings
from rest_framework import permissions

View file

@ -2,6 +2,7 @@
Tests for the REST API.
"""
from collections import namedtuple
from django.core.exceptions import ObjectDoesNotExist

View file

@ -4,6 +4,7 @@ Rest Framework provides collections called 'ViewSets', which can generate a
number of views for the common CRUD operations.
"""
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import status
from rest_framework.decorators import action

View file

@ -7,10 +7,10 @@ TEMPLATES["OPTIONS"]["context_processors"] list.
"""
import os
from django.conf import settings
from evennia.utils.utils import get_evennia_version
# Setup lists of the most relevant apps so

View file

@ -2,6 +2,7 @@
This structures the (simple) structure of the webpage 'application'.
"""
from django.urls import path
from . import views

View file

@ -2,6 +2,7 @@
This redirects to website sub-pages.
"""
from django.conf import settings
from django.contrib import admin
from django.urls import include, path

View file

@ -3,7 +3,6 @@ Views for managing accounts.
"""
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect

View file

@ -14,12 +14,17 @@ from django.utils.encoding import iri_to_uri
from django.utils.http import url_has_allowed_host_and_scheme
from django.views.generic import ListView
from django.views.generic.base import RedirectView
from evennia.utils import class_from_module
from evennia.web.website import forms
from .mixins import TypeclassMixin
from .objects import (ObjectCreateView, ObjectDeleteView, ObjectDetailView,
ObjectUpdateView)
from .objects import (
ObjectCreateView,
ObjectDeleteView,
ObjectDetailView,
ObjectUpdateView,
)
class CharacterMixin(TypeclassMixin):
@ -124,9 +129,11 @@ class CharacterPuppetView(LoginRequiredMixin, CharacterMixin, RedirectView, Obje
# since next_page is untrusted input from the user, we need to check it's safe to
next_page = iri_to_uri(next_page)
if not url_has_allowed_host_and_scheme(url=next_page,
allowed_hosts={self.request.get_host()},
require_https=self.request.is_secure()):
if not url_has_allowed_host_and_scheme(
url=next_page,
allowed_hosts={self.request.get_host()},
require_https=self.request.is_secure(),
):
next_page = self.success_url
if char:
@ -140,7 +147,6 @@ class CharacterPuppetView(LoginRequiredMixin, CharacterMixin, RedirectView, Obje
self.request.session["puppet"] = None
messages.error(self.request, "You cannot become '%s'." % char)
return next_page

View file

@ -4,6 +4,7 @@ Views to manipulate help entries.
Multi entry object type supported added by DaveWithTheNiceHat 2021
Pull Request #2429
"""
from django.conf import settings
from django.http import HttpResponseBadRequest
from django.utils.text import slugify

View file

@ -2,6 +2,7 @@
These are mixins for class-based views, granting functionality.
"""
from django.views.generic import DetailView
from django.views.generic.edit import CreateView, DeleteView, UpdateView