Skip to content

Commit

Permalink
isort again plus minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LenaWil committed Sep 30, 2023
1 parent 50164b4 commit 79b6739
Show file tree
Hide file tree
Showing 79 changed files with 388 additions and 249 deletions.
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
max-line-length = 129
exclude =
.git,
__pycache__,
*/migrations,
venv
.venv
3 changes: 1 addition & 2 deletions achievements/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.contrib.contenttypes.fields import (GenericForeignKey,
GenericRelation)
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils import timezone
Expand Down
9 changes: 6 additions & 3 deletions achievements/tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.test import TestCase

from achievements.models import Achievement, Category
from core.tests.util import (TestAccountUser, TestPublicUser,
check_http_response,
check_http_response_with_login_redirect)
from core.tests.util import (
TestAccountUser,
TestPublicUser,
check_http_response,
check_http_response_with_login_redirect,
)


class TestCaseAchievementFrontEndViews(TestCase):
Expand Down
8 changes: 6 additions & 2 deletions achievements/tests/tests_model_helpers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from django.contrib.auth import get_user_model
from django.test import TestCase

from achievements.models import (Achievement, Category, Claimant,
get_achievement_image_upload_path)
from achievements.models import (
Achievement,
Category,
Claimant,
get_achievement_image_upload_path,
)

User = get_user_model()

Expand Down
9 changes: 6 additions & 3 deletions achievements/tests/tests_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
from django.test import TestCase

from achievements.models import Achievement, Category, Claimant
from achievements.serializers import (AchievementSerializer,
AchievementSortType, CategorySerializer,
ClaimantSerializer)
from achievements.serializers import (
AchievementSerializer,
AchievementSortType,
CategorySerializer,
ClaimantSerializer,
)


# Tests the Achievement-related serializers
Expand Down
20 changes: 15 additions & 5 deletions activity_calendar/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
from django.contrib import admin
from django.utils.timezone import localtime

from core.admin import (DisableModificationsAdminMixin, MarkdownImageInline,
URLLinkInlineAdminMixin)
from core.admin import (
DisableModificationsAdminMixin,
MarkdownImageInline,
URLLinkInlineAdminMixin,
)
from utils.forms import RequestUserToFormModelAdminMixin

from .forms import ActivityAdminForm, ActivityMomentAdminForm
from .models import (Activity, ActivityMoment, ActivitySlot, Calendar,
CalendarActivityLink, CoreActivityGrouping, OrganiserLink,
Participant)
from .models import (
Activity,
ActivityMoment,
ActivitySlot,
Calendar,
CalendarActivityLink,
CoreActivityGrouping,
OrganiserLink,
Participant,
)


class MarkdownImageInlineAdmin(RequestUserToFormModelAdminMixin, admin.ModelAdmin):
Expand Down
9 changes: 5 additions & 4 deletions activity_calendar/committee_pages/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from django.forms import ModelForm, ValidationError
from django.utils import timezone

from activity_calendar.committee_pages.utils import (create_meeting_activity,
get_meeting_activity)
from activity_calendar.constants import (ActivityStatus, ActivityType,
SlotCreationType)
from activity_calendar.committee_pages.utils import (
create_meeting_activity,
get_meeting_activity,
)
from activity_calendar.constants import ActivityStatus, ActivityType, SlotCreationType
from activity_calendar.forms import ActivityMomentFormMixin
from activity_calendar.models import Activity, ActivityMoment
from activity_calendar.widgets import BootstrapDateTimePickerInput
Expand Down
23 changes: 13 additions & 10 deletions activity_calendar/committee_pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
from django.utils import timezone
from django.views.generic import FormView, ListView

from activity_calendar.committee_pages.forms import (AddMeetingForm,
CancelMeetingForm,
CreateActivityMomentForm,
EditCancelledMeetingForm,
EditMeetingForm,
MeetingRecurrenceForm)
from activity_calendar.committee_pages.forms import (
AddMeetingForm,
CancelMeetingForm,
CreateActivityMomentForm,
EditCancelledMeetingForm,
EditMeetingForm,
MeetingRecurrenceForm,
)
from activity_calendar.committee_pages.utils import get_meeting_activity
from activity_calendar.constants import ActivityType
from activity_calendar.models import Activity, ActivityMoment
from activity_calendar.templatetags.activity_tags import \
get_next_activity_instances
from committees.mixins import (AssociationGroupMixin,
AssociationGroupPermissionRequiredMixin)
from activity_calendar.templatetags.activity_tags import get_next_activity_instances
from committees.mixins import (
AssociationGroupMixin,
AssociationGroupPermissionRequiredMixin,
)

__all__ = [
"ActivityCalendarView",
Expand Down
9 changes: 4 additions & 5 deletions activity_calendar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
from recurrence.fields import RecurrenceField

import activity_calendar.util as util
from activity_calendar.constants import (ActivityStatus, ActivityType,
SlotCreationType)
from activity_calendar.constants import ActivityStatus, ActivityType, SlotCreationType
from activity_calendar.managers import MeetingManager
from committees.utils import user_in_association_group
from core.fields import MarkdownTextField
Expand Down Expand Up @@ -277,7 +276,7 @@ def get_next_activitymoment(self, dtstart=None, inc=False, exclude_removed=True,
if exclude_cancelled:
activity_moments = activity_moments.exclude(status=ActivityStatus.STATUS_CANCELLED)

### Check for activitymoments stored in the database ###
# Check for activitymoments stored in the database #
# Check activity_moment by recurrence id
next_activity_moment = (
activity_moments.filter(**{"recurrence_id__gt" + e_ext: dtstart})
Expand All @@ -296,7 +295,7 @@ def get_next_activitymoment(self, dtstart=None, inc=False, exclude_removed=True,
if next_activity_moment is None or local_activity_moment.start_date < next_activity_moment.start_date:
next_activity_moment = local_activity_moment

### Check for recurrence patterns ###
# Check for recurrence patterns #

# Get a list of activity_moments that are not allowed because they have been moved and will therefore
# already have been detected with the local_start_date search
Expand Down Expand Up @@ -550,7 +549,7 @@ def clean_fields(self, exclude=None):

# EXRULEs (RFC 2445) are deprecated (per RFC 5545)
if len(r.exrules) > 0:
recurrence_errors.append(f"Exclusion Rules are unsupported (Exclusion Dates can still be used)")
recurrence_errors.append("Exclusion Rules are unsupported (Exclusion Dates can still be used)")

if recurrence_errors:
errors.update({"recurrences": recurrence_errors})
Expand Down
6 changes: 4 additions & 2 deletions activity_calendar/tests/committee_pages/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
from django.contrib.auth.models import Group
from django.test import TestCase

from activity_calendar.committee_pages.utils import (create_meeting_activity,
get_meeting_activity)
from activity_calendar.committee_pages.utils import (
create_meeting_activity,
get_meeting_activity,
)
from activity_calendar.constants import ActivityType
from activity_calendar.models import Activity
from committees.models import AssociationGroup
Expand Down
9 changes: 7 additions & 2 deletions activity_calendar/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
from django.utils import timezone
from recurrence import deserialize as deserialize_recurrence_test

from activity_calendar.models import (Activity, ActivityMoment, ActivitySlot,
MemberCalendarSettings, Participant)
from activity_calendar.models import (
Activity,
ActivityMoment,
ActivitySlot,
MemberCalendarSettings,
Participant,
)
from core.models import PresetImage

from . import mock_now
Expand Down
4 changes: 3 additions & 1 deletion activity_calendar/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from activity_calendar.constants import ActivityStatus
from activity_calendar.models import Activity, ActivityMoment
from activity_calendar.templatetags.activity_tags import (
get_next_activity_instances, readable_activity_datetime)
get_next_activity_instances,
readable_activity_datetime,
)

from . import mock_now

Expand Down
22 changes: 12 additions & 10 deletions activity_calendar/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
from django.utils.translation import gettext_lazy as _
from django.views.generic import FormView, ListView, TemplateView

from activity_calendar.constants import (ActivityStatus, ActivityType,
SlotCreationType)
from activity_calendar.constants import ActivityStatus, ActivityType, SlotCreationType
from activity_calendar.forms import *
from activity_calendar.models import *
from activity_calendar.views import (ActivityMixin,
ActivityMomentCancelledView,
ActivityMomentNoSignupView,
ActivityMomentWithSlotsView,
ActivityOverview,
ActivitySimpleMomentView,
CancelActivityMomentView, CreateSlotView,
EditActivityMomentView)
from activity_calendar.views import (
ActivityMixin,
ActivityMomentCancelledView,
ActivityMomentNoSignupView,
ActivityMomentWithSlotsView,
ActivityOverview,
ActivitySimpleMomentView,
CancelActivityMomentView,
CreateSlotView,
EditActivityMomentView,
)
from core.tests.util import suppress_warnings
from utils.testing.view_test_utils import TestMixinMixin, ViewValidityMixin

Expand Down
11 changes: 7 additions & 4 deletions activity_calendar/tests/tests_icalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
from django.utils import dateparse, timezone

from activity_calendar.constants import ActivityStatus
from activity_calendar.feeds import (BirthdayCalendarFeed, CustomCalendarFeed,
PublicCalendarFeed, get_feed_id)
from activity_calendar.models import (Activity, ActivityMoment,
CalendarActivityLink)
from activity_calendar.feeds import (
BirthdayCalendarFeed,
CustomCalendarFeed,
PublicCalendarFeed,
get_feed_id,
)
from activity_calendar.models import Activity, ActivityMoment, CalendarActivityLink
from membership_file.models import Member


Expand Down
3 changes: 1 addition & 2 deletions activity_calendar/tests/tests_model_helpers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.contrib.auth import get_user_model
from django.test import TestCase

from activity_calendar.models import (Activity, ActivityMoment, ActivitySlot,
Participant)
from activity_calendar.models import Activity, ActivityMoment, ActivitySlot, Participant

User = get_user_model()

Expand Down
7 changes: 5 additions & 2 deletions activity_calendar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
from urllib.parse import quote, unquote

from django.contrib import messages
from django.contrib.auth.mixins import (AccessMixin, LoginRequiredMixin,
UserPassesTestMixin)
from django.contrib.auth.mixins import (
AccessMixin,
LoginRequiredMixin,
UserPassesTestMixin,
)
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
Expand Down
3 changes: 1 addition & 2 deletions committees/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from committees.models import AssociationGroup, GroupExternalUrl

from .models import AssociationGroupPanelControl
from .options import (AssociationGroupAdmin, GroupExternalURLAdmin,
GroupPanelAccessAdmin)
from .options import AssociationGroupAdmin, GroupExternalURLAdmin, GroupPanelAccessAdmin

admin.site.register(AssociationGroup, AssociationGroupAdmin)
admin.site.register(GroupExternalUrl, GroupExternalURLAdmin)
Expand Down
7 changes: 5 additions & 2 deletions committees/committee_pages/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
from committees.committee_pages.views import *
from committees.forms import AssociationGroupUpdateForm
from committees.models import AssociationGroup
from committees.options import (SettingsOptionBase, SimpleFormSettingsOption,
settings_options_registry)
from committees.options import (
SettingsOptionBase,
SimpleFormSettingsOption,
settings_options_registry,
)


class HomeScreenTextOptions(SimpleFormSettingsOption):
Expand Down
10 changes: 6 additions & 4 deletions committees/committee_pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from django.urls import reverse_lazy
from django.views.generic import FormView, TemplateView

from committees.forms import (AddOrUpdateExternalUrlForm,
AssociationGroupMembershipForm,
AssociationGroupUpdateForm,
DeleteGroupExternalUrlForm)
from committees.forms import (
AddOrUpdateExternalUrlForm,
AssociationGroupMembershipForm,
AssociationGroupUpdateForm,
DeleteGroupExternalUrlForm,
)
from committees.mixins import AssociationGroupMixin, GroupSettingsMixin
from utils.views import PostOnlyFormViewMixin

Expand Down
7 changes: 5 additions & 2 deletions committees/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
from django.forms import Form, IntegerField, ModelForm
from django.forms.widgets import HiddenInput

from committees.models import (AssociationGroup, AssociationGroupMembership,
GroupExternalUrl)
from committees.models import (
AssociationGroup,
AssociationGroupMembership,
GroupExternalUrl,
)
from core.forms import MarkdownForm


Expand Down
3 changes: 1 addition & 2 deletions committees/tests/admin/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from django.test import TestCase

from committees.admin.forms import (AssociationGroupsTabAccessForm,
ConfigTabSelectWidget)
from committees.admin.forms import AssociationGroupsTabAccessForm, ConfigTabSelectWidget
from committees.admin.models import AssociationGroupPanelControl
from committees.committee_pages.config import AssociationGroupHomeConfig
from utils.testing.form_test_util import FormValidityMixin
Expand Down
6 changes: 4 additions & 2 deletions committees/tests/committee_pages/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from django.test import TestCase

from committees.committee_pages.config import (AssociationGroupHomeConfig,
AssociationGroupSettingsConfig)
from committees.committee_pages.config import (
AssociationGroupHomeConfig,
AssociationGroupSettingsConfig,
)
from committees.committeecollective import CommitteeBaseConfig, registry
from utils.testing import return_boolean

Expand Down
8 changes: 5 additions & 3 deletions committees/tests/committee_pages/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

from committees.committee_pages.views import *
from committees.committeecollective import CommitteeBaseConfig, registry
from committees.forms import (AddOrUpdateExternalUrlForm,
AssociationGroupMembershipForm,
DeleteGroupExternalUrlForm)
from committees.forms import (
AddOrUpdateExternalUrlForm,
AssociationGroupMembershipForm,
DeleteGroupExternalUrlForm,
)
from committees.mixins import AssociationGroupMixin, GroupSettingsMixin
from committees.models import AssociationGroup, GroupExternalUrl
from committees.tests.committee_pages.utils import AssocationGroupTestingMixin
Expand Down
Loading

0 comments on commit 79b6739

Please sign in to comment.