diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index afd67772c..d0c573fb3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/myint/autoflake - rev: v2.1.1 + rev: v2.2.1 hooks: - id: autoflake args: @@ -12,11 +12,11 @@ repos: - --ignore-init-module-imports - --expand-star-imports - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 + rev: 24.1.0 hooks: - id: black - repo: https://github.com/rtts/djhtml diff --git a/ephios/extra/colors.py b/ephios/extra/colors.py index c7c183273..76d0cfb06 100644 --- a/ephios/extra/colors.py +++ b/ephios/extra/colors.py @@ -9,9 +9,11 @@ def calculate_luminance(rgb: tuple): r, g, b = map( - lambda channel: channel / 255 / 12.92 - if channel / 255 <= 0.03928 - else ((channel / 255 + 0.055) / 1.055) ** 2.4, + lambda channel: ( + channel / 255 / 12.92 + if channel / 255 <= 0.03928 + else ((channel / 255 + 0.055) / 1.055) ** 2.4 + ), rgb, ) return 0.2126 * r + 0.7152 * g + 0.0722 * b diff --git a/ephios/plugins/basesignup/signup/common.py b/ephios/plugins/basesignup/signup/common.py index 104e9ef07..04bac5430 100644 --- a/ephios/plugins/basesignup/signup/common.py +++ b/ephios/plugins/basesignup/signup/common.py @@ -141,18 +141,20 @@ class ConfigurationForm(super().configuration_form_class): widget=Select2MultipleWidget, required=False, initial=[], - help_text=_( - "Participants also need to have the qualifications {qualifications} to participate in {eventtype}" - ).format( - qualifications=",".join( - self.event.type.preferences.get("general_required_qualifications") - .all() - .values_list("title", flat=True) - ), - eventtype=self.event.type, - ) - if self.event.type.preferences.get("general_required_qualifications").exists() - else None, + help_text=( + _( + "Participants also need to have the qualifications {qualifications} to participate in {eventtype}" + ).format( + qualifications=",".join( + self.event.type.preferences.get("general_required_qualifications") + .all() + .values_list("title", flat=True) + ), + eventtype=self.event.type, + ) + if self.event.type.preferences.get("general_required_qualifications").exists() + else None + ), ) @staticmethod diff --git a/ephios/urls.py b/ephios/urls.py index aabdecaa7..d35ed4e23 100644 --- a/ephios/urls.py +++ b/ephios/urls.py @@ -1,18 +1,3 @@ -"""ephios URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/3.0/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.conf import settings from django.contrib import admin from django.urls import include, path diff --git a/tests/core/test_signup_methods.py b/tests/core/test_signup_methods.py index a3b997c37..74f2a86ee 100644 --- a/tests/core/test_signup_methods.py +++ b/tests/core/test_signup_methods.py @@ -68,9 +68,8 @@ def test_partially_conflicting_shift_results_in_invalid_signup_form( user=volunteer, ).form.submit(name="signup_choice", value="sign_up") assert "You are already confirmed for other shifts at this time" in response - response.form[ - "individual_start_time_1" - ] = "19:42" # move start to after the conflicting event ended + # move start to after the conflicting event ended + response.form["individual_start_time_1"] = "19:42" assert ( "successfully requested a participation" in response.form.submit(name="signup_choice", value="sign_up").follow() diff --git a/tests/plugins/qualification_management/test_import.py b/tests/plugins/qualification_management/test_import.py index c8b83de78..2e22c48b6 100644 --- a/tests/plugins/qualification_management/test_import.py +++ b/tests/plugins/qualification_management/test_import.py @@ -26,35 +26,35 @@ def test_repo_fetch(): preferences = global_preferences_registry.manager() - preferences[ - "general__qualification_management_repos" - ] = "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/test.json" + preferences["general__qualification_management_repos"] = ( + "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/test.json" + ) assert list(fetch_deserialized_qualifications_from_repo()) def test_not_a_list_repo(): preferences = global_preferences_registry.manager() - preferences[ - "general__qualification_management_repos" - ] = "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/not-a-list.json" + preferences["general__qualification_management_repos"] = ( + "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/not-a-list.json" + ) with pytest.raises(RepoError): list(fetch_deserialized_qualifications_from_repo()) def test_missing_key_repo(): preferences = global_preferences_registry.manager() - preferences[ - "general__qualification_management_repos" - ] = "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/key-missing.json" + preferences["general__qualification_management_repos"] = ( + "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/key-missing.json" + ) with pytest.raises(RepoError): list(fetch_deserialized_qualifications_from_repo()) def test_import_view(django_app, superuser): preferences = global_preferences_registry.manager() - preferences[ - "general__qualification_management_repos" - ] = "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/test.json" + preferences["general__qualification_management_repos"] = ( + "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/test.json" + ) form = django_app.get( reverse("qualification_management:settings_qualification_import"), user=superuser, @@ -73,9 +73,9 @@ def test_import_view(django_app, superuser): def test_import_view_with_broken_repo(django_app, superuser): preferences = global_preferences_registry.manager() - preferences[ - "general__qualification_management_repos" - ] = "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/key-missing.json" + preferences["general__qualification_management_repos"] = ( + "https://github.com/ephios-dev/ephios-qualification-fixtures/raw/main/test/key-missing.json" + ) request = django_app.get( reverse("qualification_management:settings_qualification_import"), user=superuser,