From 4aedef45472647e05c33d24b779a50f9adf10307 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 27 Sep 2023 14:27:52 +0000 Subject: [PATCH] Fixup. Format code with Black --- pod/main/settings.py | 54 +++++++++++++-------------- pod/main/views.py | 11 +++++- pod/progressive_web_app/utils.py | 2 +- pod/urls.py | 4 +- pod/video_encode_transcript/encode.py | 5 ++- pod/video_encode_transcript/utils.py | 7 +++- 6 files changed, 50 insertions(+), 33 deletions(-) diff --git a/pod/main/settings.py b/pod/main/settings.py index c99af8917b..b69eb76206 100644 --- a/pod/main/settings.py +++ b/pod/main/settings.py @@ -310,55 +310,55 @@ # PWA -PWA_APP_NAME = 'Pod' +PWA_APP_NAME = "Pod" PWA_APP_DESCRIPTION = _( "Pod is aimed at users of our institutions, by allowing the publication of " "videos in the fields of research (promotion of platforms, etc.), training " "(tutorials, distance training, student reports, etc.), institutional life (video " "of events), offering several days of content." ) -PWA_APP_THEME_COLOR = '#0A0302' -PWA_APP_BACKGROUND_COLOR = '#ffffff' -PWA_APP_DISPLAY = 'standalone' -PWA_APP_SCOPE = '/' -PWA_APP_ORIENTATION = 'any' -PWA_APP_START_URL = '/' -PWA_APP_STATUS_BAR_COLOR = 'default' +PWA_APP_THEME_COLOR = "#0A0302" +PWA_APP_BACKGROUND_COLOR = "#ffffff" +PWA_APP_DISPLAY = "standalone" +PWA_APP_SCOPE = "/" +PWA_APP_ORIENTATION = "any" +PWA_APP_START_URL = "/" +PWA_APP_STATUS_BAR_COLOR = "default" PWA_APP_ICONS = [ { - 'src': f'/static/img/icon_x{size}.png', - 'sizes': f"{size}x{size}", - 'purpose': "any maskable", + "src": f"/static/img/icon_x{size}.png", + "sizes": f"{size}x{size}", + "purpose": "any maskable", } for size in (1024, 512, 384, 192, 128, 96, 72, 48) ] PWA_APP_ICONS_APPLE = [ { - 'src': f'/static/img/icon_x{size}.png', - 'sizes': f"{size}x{size}", + "src": f"/static/img/icon_x{size}.png", + "sizes": f"{size}x{size}", } for size in (1024, 512, 384, 192, 128, 96, 72, 48) ] PWA_APP_SPLASH_SCREEN = [ { - 'src': '/static/img/splash-512.png', - 'media': ( - '(device-width: 320px) ' - 'and (device-height: 568px) ' - 'and (-webkit-device-pixel-ratio: 2)' - ) + "src": "/static/img/splash-512.png", + "media": ( + "(device-width: 320px) " + "and (device-height: 568px) " + "and (-webkit-device-pixel-ratio: 2)" + ), } ] -PWA_APP_DIR = 'ltr' -PWA_APP_LANG = 'fr-FR' +PWA_APP_DIR = "ltr" +PWA_APP_LANG = "fr-FR" PWA_APP_SCREENSHOTS = [ - { - 'src': '/static/img/esup-pod.svg', - 'sizes': '750x1334', - "type": "image/png" - } + {"src": "/static/img/esup-pod.svg", "sizes": "750x1334", "type": "image/png"} ] PWA_SERVICE_WORKER_PATH = os.path.join( - BASE_DIR, "progressive_web_app", "static", "js", "serviceworker.js", + BASE_DIR, + "progressive_web_app", + "static", + "js", + "serviceworker.js", ) PWA_APP_DEBUG_MODE = locals().get("DEBUG", False) diff --git a/pod/main/views.py b/pod/main/views.py index 3c61ba5073..e7f8c58c0c 100644 --- a/pod/main/views.py +++ b/pod/main/views.py @@ -404,10 +404,17 @@ def set_notifications(request): setNotificationForm = SetNotificationForm(instance=request.user.owner) if request.method == "POST": - setNotificationForm = SetNotificationForm(request.POST, instance=request.user.owner) + setNotificationForm = SetNotificationForm( + request.POST, instance=request.user.owner + ) if setNotificationForm.is_valid(): setNotificationForm.save() - return JsonResponse({"success": True, "user_accepts_notifications": request.user.owner.accepts_notifications}) + return JsonResponse( + { + "success": True, + "user_accepts_notifications": request.user.owner.accepts_notifications, + } + ) else: messages.add_message( request, diff --git a/pod/progressive_web_app/utils.py b/pod/progressive_web_app/utils.py index 470586cc47..6747376280 100644 --- a/pod/progressive_web_app/utils.py +++ b/pod/progressive_web_app/utils.py @@ -2,7 +2,7 @@ from django.templatetags.static import static -DEFAULT_ICON = static('img/icon_x1024.png') +DEFAULT_ICON = static("img/icon_x1024.png") def notify_user(user, title, message, url=None, icon=None): diff --git a/pod/urls.py b/pod/urls.py index 6722f3166b..e0a19b68dc 100644 --- a/pod/urls.py +++ b/pod/urls.py @@ -101,7 +101,9 @@ # PWA urlpatterns += [ - path("pwa/", include("pod.progressive_web_app.urls", namespace="progressive_web_app")), + path( + "pwa/", include("pod.progressive_web_app.urls", namespace="progressive_web_app") + ), ] # BBB: TODO REPLACE BBB BY MEETING diff --git a/pod/video_encode_transcript/encode.py b/pod/video_encode_transcript/encode.py index 86d2bb1e73..0a0ab61e59 100644 --- a/pod/video_encode_transcript/encode.py +++ b/pod/video_encode_transcript/encode.py @@ -172,7 +172,10 @@ def get_encoding_video(video_to_encode): def end_of_encoding(video): """Send mail at the end of encoding, call transcription.""" - if video.owner.owner.accepts_notifications and PushInformation.objects.filter(user=video.owner).exists(): + if ( + video.owner.owner.accepts_notifications + and PushInformation.objects.filter(user=video.owner).exists() + ): send_notification_encoding(video) elif EMAIL_ON_ENCODING_COMPLETION: send_email_encoding(video) diff --git a/pod/video_encode_transcript/utils.py b/pod/video_encode_transcript/utils.py index b6a46dace1..1528805c57 100644 --- a/pod/video_encode_transcript/utils.py +++ b/pod/video_encode_transcript/utils.py @@ -260,7 +260,12 @@ def send_notification(video_to_encode, subject_prefix): "site_title": __TITLE_SITE__, } - notify_user(video_to_encode.owner, subject, message, url=reverse("video:video", args=(video_to_encode.slug,))) + notify_user( + video_to_encode.owner, + subject, + message, + url=reverse("video:video", args=(video_to_encode.slug,)), + ) def time_to_seconds(a_time):