From 51c00aca9c1fe342c45c7822891f48eb4137a35b Mon Sep 17 00:00:00 2001 From: JasonGrace2282 Date: Wed, 2 Oct 2024 16:38:46 -0400 Subject: [PATCH] chore: fix linting errors --- intranet/apps/announcements/views.py | 9 +++++-- intranet/apps/eighth/forms/activities.py | 6 ++--- .../apps/eighth/forms/admin/activities.py | 25 +++++++++---------- intranet/apps/eighth/views/activities.py | 2 +- intranet/apps/users/models.py | 2 +- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/intranet/apps/announcements/views.py b/intranet/apps/announcements/views.py index 48989c5813b..dfb7419cb69 100644 --- a/intranet/apps/announcements/views.py +++ b/intranet/apps/announcements/views.py @@ -15,8 +15,13 @@ from ..groups.models import Group from .forms import AnnouncementAdminForm, AnnouncementEditForm, AnnouncementForm, AnnouncementRequestForm, ClubAnnouncementForm from .models import Announcement, AnnouncementRequest -from .notifications import (admin_request_announcement_email, announcement_approved_email, announcement_posted_email, announcement_posted_twitter, - request_announcement_email) +from .notifications import ( + admin_request_announcement_email, + announcement_approved_email, + announcement_posted_email, + announcement_posted_twitter, + request_announcement_email, +) logger = logging.getLogger(__name__) diff --git a/intranet/apps/eighth/forms/activities.py b/intranet/apps/eighth/forms/activities.py index 631f37dc6e6..91b9928ac78 100644 --- a/intranet/apps/eighth/forms/activities.py +++ b/intranet/apps/eighth/forms/activities.py @@ -15,9 +15,9 @@ def __init__(self, *args, **kwargs): self.fields["subscriptions_enabled"].label = "Enable club announcements" self.fields["subscriptions_enabled"].help_text = "Allow students to subscribe to receive announcements for this activity through Ion." self.fields["club_sponsors"].label = "Teacher moderators" - self.fields["club_sponsors"].help_text = ( - "Teacher moderators can post and manage this club's announcements. You should include club sponsors here." - ) + self.fields[ + "club_sponsors" + ].help_text = "Teacher moderators can post and manage this club's announcements. You should include club sponsors here." self.fields["officers"].label = "Student officers" self.fields["officers"].help_text = "Student officers can send club announcements to subscribers." diff --git a/intranet/apps/eighth/forms/admin/activities.py b/intranet/apps/eighth/forms/admin/activities.py index 3d0a6a71edc..b2f82769357 100644 --- a/intranet/apps/eighth/forms/admin/activities.py +++ b/intranet/apps/eighth/forms/admin/activities.py @@ -1,5 +1,6 @@ +from __future__ import annotations + import logging -from typing import List # noqa from django import forms, http from django.contrib.auth import get_user_model @@ -11,7 +12,7 @@ class ActivityDisplayField(forms.ModelChoiceField): - cancelled_acts = None # type: List[EighthActivity] + cancelled_acts: list[EighthActivity] | None = None def __init__(self, *args, **kwargs): if "block" in kwargs: @@ -144,9 +145,9 @@ def __init__(self, *args, **kwargs): self.fields["subscriptions_enabled"].label = "Enable club announcements" self.fields["subscriptions_enabled"].help_text = "Allow students to subscribe to receive announcements for this activity through Ion." self.fields["officers"].help_text = "Student officers can send club announcements to subscribers." - self.fields["club_sponsors"].help_text = ( - "Club sponsors can manage this club's announcements. May be different from the activity's scheduled sponsors." - ) + self.fields[ + "club_sponsors" + ].help_text = "Club sponsors can manage this club's announcements. May be different from the activity's scheduled sponsors." self.fields["subscribers"].help_text = "Students who subscribe to this activity will receive club announcements." # These fields are rendered on the right of the page on the edit activity page. @@ -161,14 +162,12 @@ def __init__(self, *args, **kwargs): "seniors_allowed", } - self.club_announcements_fields = set( - [ - "subscriptions_enabled", - "club_sponsors", - "officers", - "subscribers", - ] - ) + self.club_announcements_fields = { + "subscriptions_enabled", + "club_sponsors", + "officers", + "subscribers", + } class Meta: model = EighthActivity diff --git a/intranet/apps/eighth/views/activities.py b/intranet/apps/eighth/views/activities.py index 0e8d5d8f712..402ffba9f94 100644 --- a/intranet/apps/eighth/views/activities.py +++ b/intranet/apps/eighth/views/activities.py @@ -78,7 +78,7 @@ def settings_view(request, activity_id=None): def chunks(items, n): for i in range(0, len(items), n): - yield items[i: i + n] + yield items[i : i + n] def current_school_year(): diff --git a/intranet/apps/users/models.py b/intranet/apps/users/models.py index 040a9506d7e..4ff84fe0bde 100644 --- a/intranet/apps/users/models.py +++ b/intranet/apps/users/models.py @@ -1272,7 +1272,7 @@ def attribute_is_public(self, permission: str) -> bool: PERMISSIONS_NAMES = { - prefix: [name[len(prefix) + 1:] for name in dir(UserProperties) if name.startswith(prefix + "_")] for prefix in ["self", "parent"] + prefix: [name[len(prefix) + 1 :] for name in dir(UserProperties) if name.startswith(prefix + "_")] for prefix in ["self", "parent"] }