From fa9c85ce81d90e2aa6c9a9e4a8a634a96d63b88b Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Tue, 9 Mar 2021 09:58:01 +0100
Subject: [PATCH] Reformat and fix linter

---
 aleksis/apps/alsijil/actions.py |  3 ++-
 aleksis/apps/alsijil/forms.py   |  4 +---
 aleksis/apps/alsijil/tables.py  | 15 ++++++++++-----
 aleksis/apps/alsijil/views.py   | 12 ++++--------
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/aleksis/apps/alsijil/actions.py b/aleksis/apps/alsijil/actions.py
index 6025f4a2e..ee7cf0e79 100644
--- a/aleksis/apps/alsijil/actions.py
+++ b/aleksis/apps/alsijil/actions.py
@@ -22,4 +22,5 @@ def mark_as_excuse_type_generator(excuse_type) -> Callable:
 def delete_personal_note(modeladmin, request, queryset):
     queryset.delete()
 
-delete_personal_note.short_description = _("Delete")
\ No newline at end of file
+
+delete_personal_note.short_description = _("Delete")
diff --git a/aleksis/apps/alsijil/forms.py b/aleksis/apps/alsijil/forms.py
index 4482d663d..9da0b4677 100644
--- a/aleksis/apps/alsijil/forms.py
+++ b/aleksis/apps/alsijil/forms.py
@@ -16,6 +16,7 @@ from aleksis.core.models import Group, Person
 from aleksis.core.util.core_helpers import get_site_preferences
 from aleksis.core.util.predicates import check_global_permission
 
+from .actions import delete_personal_note, mark_as_excuse_type_generator, mark_as_excused
 from .models import (
     ExcuseType,
     ExtraMark,
@@ -24,8 +25,6 @@ from .models import (
     LessonDocumentation,
     PersonalNote,
 )
-from .actions import *
-from .models import ExcuseType, ExtraMark, LessonDocumentation, PersonalNote
 
 
 class LessonDocumentationForm(forms.ModelForm):
@@ -264,4 +263,3 @@ class GroupRoleAssignmentEditForm(forms.ModelForm):
     class Meta:
         model = GroupRoleAssignment
         fields = ["date_start", "date_end"]
-
diff --git a/aleksis/apps/alsijil/tables.py b/aleksis/apps/alsijil/tables.py
index 47bd409ac..7cc76996c 100644
--- a/aleksis/apps/alsijil/tables.py
+++ b/aleksis/apps/alsijil/tables.py
@@ -1,13 +1,12 @@
 from django.template.loader import render_to_string
-from django.urls import reverse
 from django.utils.safestring import mark_safe
 from django.utils.translation import gettext_lazy as _
 
 import django_tables2 as tables
 from django_tables2.utils import A
 
-from aleksis.core.tables import MaterializeCheckboxColumn
 from aleksis.apps.chronos.models import Event, LessonPeriod
+from aleksis.core.tables import MaterializeCheckboxColumn
 
 from .models import PersonalNote
 
@@ -85,6 +84,8 @@ class GroupRoleTable(tables.Table):
             self.columns.hide("edit")
         if not request.user.has_perm("alsijil.delete_grouprole"):
             self.columns.hide("delete")
+
+
 class PersonalNoteTable(tables.Table):
     selected = MaterializeCheckboxColumn(
         attrs={"input": {"name": "selected_objects"}}, accessor=A("pk")
@@ -119,7 +120,9 @@ class PersonalNoteTable(tables.Table):
             return value
 
     def render_absent(self, value):
-        return render_to_string("components/materialize-chips.html", dict(content="Absent", classes="red white-text"))
+        return render_to_string(
+            "components/materialize-chips.html", dict(content="Absent", classes="red white-text")
+        )
 
     def render_excused(self, value, record):
         if record.absent:
@@ -145,8 +148,10 @@ class PersonalNoteTable(tables.Table):
             badges = ""
             for extra_mark in value:
                 content = extra_mark.name
-                badges += render_to_string("components/materialize-chips.html", context=dict(content=content))
-            return mark_safe(badges)
+                badges += render_to_string(
+                    "components/materialize-chips.html", context=dict(content=content)
+                )
+            return mark_safe(badges)  # noqa
         else:
             return "–"
 
diff --git a/aleksis/apps/alsijil/views.py b/aleksis/apps/alsijil/views.py
index 19c0f19de..3891bfcb0 100644
--- a/aleksis/apps/alsijil/views.py
+++ b/aleksis/apps/alsijil/views.py
@@ -1,6 +1,5 @@
 from contextlib import nullcontext
 from copy import deepcopy
-from contextlib import suppress
 from datetime import date, datetime, timedelta
 from typing import Any, Dict, Optional
 
@@ -19,7 +18,7 @@ from django.views.generic import DetailView
 
 import reversion
 from calendarweek import CalendarWeek
-from django_tables2 import SingleTableView, RequestConfig
+from django_tables2 import RequestConfig, SingleTableView
 from reversion.views import RevisionMixin
 from rules.contrib.views import PermissionRequiredMixin, permission_required
 
@@ -45,9 +44,9 @@ from .forms import (
     GroupRoleForm,
     LessonDocumentationForm,
     PersonalNoteFormSet,
+    PersonOverviewForm,
     RegisterAbsenceForm,
     SelectForm,
-    PersonOverviewForm,
 )
 from .models import (
     ExcuseType,
@@ -57,16 +56,13 @@ from .models import (
     LessonDocumentation,
     PersonalNote,
 )
-from .tables import ExcuseTypeTable, ExtraMarkTable, GroupRoleTable
+from .tables import ExcuseTypeTable, ExtraMarkTable, GroupRoleTable, PersonalNoteTable
 from .util.alsijil_helpers import (
     annotate_documentations,
     get_register_object_by_pk,
     get_timetable_instance_by_pk,
     register_objects_sorter,
 )
-from .models import ExcuseType, ExtraMark, LessonDocumentation, PersonalNote
-from .tables import ExcuseTypeTable, ExtraMarkTable, PersonalNoteTable
-from .util.alsijil_helpers import get_lesson_period_by_pk, get_timetable_instance_by_pk
 
 
 @permission_required("alsijil.view_register_object", fn=get_register_object_by_pk)  # FIXME
@@ -799,7 +795,7 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp
     table = PersonalNoteTable(personal_notes)
     RequestConfig(request, paginate={"per_page": 20}).configure(table)
     context["personal_notes_table"] = table
-    print(table.columns, table.rows, sep="\n"*3)
+    print(table.columns, table.rows, sep="\n" * 3)
 
     extra_marks = ExtraMark.objects.all()
     excuse_types = ExcuseType.objects.all()
-- 
GitLab