From a5f2b04e034ccad1026a273706e20cd6f97335cd Mon Sep 17 00:00:00 2001 From: Nadja Geisler <ngeisler@fachschaft.informatik.tu-darmstadt.de> Date: Mon, 3 Mar 2025 20:33:52 +0100 Subject: [PATCH] make linter happy :) --- AKModel/models.py | 11 ++++++----- AKSubmission/tests.py | 6 ++++-- AKSubmission/views.py | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/AKModel/models.py b/AKModel/models.py index aca3ee91..54f6c163 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -32,7 +32,8 @@ class Event(models.Model): interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True, help_text= - _('Opening time for expression of interest. When left blank, no interest indication will be possible.')) + _('Opening time for expression of interest. When left blank, no interest ' + 'indication will be possible.')) interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True, help_text=_('Closing time for expression of interest.')) @@ -244,8 +245,8 @@ class AKCategory(models.Model): description = models.TextField(blank=True, verbose_name=_("Description"), help_text=_("Short description of this AK Category")) present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"), - help_text=_("Present AKs of this category by default " - "if AK owner did not specify whether this AK should be presented?")) + help_text=_("Present AKs of this category by default if AK owner did not " + "specify whether this AK should be presented?")) event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'), help_text=_('Associated event')) @@ -511,7 +512,7 @@ class AK(models.Model): # Tell Django that we have updated the link field if update_fields is not None: update_fields = {"link"}.union(update_fields) - super().save(force_insert, force_update, using, update_fields) + super().save(force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields) class Room(models.Model): @@ -642,7 +643,7 @@ class AKSlot(models.Model): event_duration = self.event.end - self.event.start event_duration_hours = event_duration.days * 24 + event_duration.seconds // 3600 self.duration = min(self.duration, event_duration_hours) - super().save(force_insert, force_update, using, update_fields) + super().save(force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields) class AKOrgaMessage(models.Model): diff --git a/AKSubmission/tests.py b/AKSubmission/tests.py index 0dd33925..b275da78 100644 --- a/AKSubmission/tests.py +++ b/AKSubmission/tests.py @@ -146,7 +146,8 @@ class ModelViewTests(BasicViewTests, TestCase): add_redirect_url = reverse_lazy(f"{self.APP_NAME}:submit_ak", kwargs={'event_slug': 'kif42', 'owner_slug': 'a'}) response = self.client.post(select_url, {'owner_id': 1}) self.assertRedirects(response, add_redirect_url, status_code=302, target_status_code=200, - msg_prefix=f"Dispatch redirect to ak submission page failed (should go to {add_redirect_url})") + msg_prefix=f"Dispatch redirect to ak submission page failed " + "(should go to {add_redirect_url})") def test_orga_message_submission(self): """ @@ -200,7 +201,8 @@ class ModelViewTests(BasicViewTests, TestCase): # Test indication outside of indication window -> HTTP 403, counter not increased response = self.client.post(interest_api_url) self.assertEqual(response.status_code, 403, - "API end point still reachable even though interest indication window ended ({interest_api_url})") + "API end point still reachable even though interest indication window ended " + "({interest_api_url})") self.assertEqual(AK.objects.get(pk=1).interest_counter, ak_interest_counter + 1, "Counter was increased even though interest indication window ended") diff --git a/AKSubmission/views.py b/AKSubmission/views.py index 171baed8..3bbffa1f 100644 --- a/AKSubmission/views.py +++ b/AKSubmission/views.py @@ -185,8 +185,9 @@ class AKListByCategoryView(AKOverviewView): def dispatch(self, request, *args, **kwargs): # Override dispatching # Needed to handle the checking whether the category exists - self.category = get_object_or_404(AKCategory, pk=kwargs[ - 'category_pk']) # pylint: disable=attribute-defined-outside-init,line-too-long + # noinspection PyAttributeOutsideInit + # pylint: disable=attribute-defined-outside-init + self.category = get_object_or_404(AKCategory, pk=kwargs['category_pk']) return super().dispatch(request, *args, **kwargs) def get_active_category_name(self, context): -- GitLab