From 08f5718a893b55e0c1e2d5d6acc2930833e0b38e Mon Sep 17 00:00:00 2001 From: vincent porte Date: Tue, 28 May 2024 18:03:00 +0200 Subject: [PATCH] quality --- lacommunaute/notification/utils.py | 8 +++++--- lacommunaute/utils/templatetags/str_filters.py | 1 + lacommunaute/utils/templatetags/theme_inclusion.py | 1 + lacommunaute/utils/testing.py | 8 +++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lacommunaute/notification/utils.py b/lacommunaute/notification/utils.py index cc94708f3..0c4aea3a8 100644 --- a/lacommunaute/notification/utils.py +++ b/lacommunaute/notification/utils.py @@ -30,9 +30,11 @@ def collect_following_replies(): topic.get_absolute_url(with_fqdn=True), topic.subject, topic.mails_to_notify(), - f"{topic.new_replies} nouvelle réponse" - if topic.new_replies == 1 - else f"{topic.new_replies} nouvelles réponses", + ( + f"{topic.new_replies} nouvelle réponse" + if topic.new_replies == 1 + else f"{topic.new_replies} nouvelles réponses" + ), ) for topic in Topic.objects.with_following_replies(last_notification(kind=EmailSentTrackKind.FOLLOWING_REPLIES)) ] diff --git a/lacommunaute/utils/templatetags/str_filters.py b/lacommunaute/utils/templatetags/str_filters.py index 4867de399..88569955b 100644 --- a/lacommunaute/utils/templatetags/str_filters.py +++ b/lacommunaute/utils/templatetags/str_filters.py @@ -1,6 +1,7 @@ """ https://docs.djangoproject.com/en/dev/howto/custom-template-tags/ """ + from django import template from django.template.defaultfilters import stringfilter from django.urls import reverse diff --git a/lacommunaute/utils/templatetags/theme_inclusion.py b/lacommunaute/utils/templatetags/theme_inclusion.py index 9a23553f0..59a9036fe 100644 --- a/lacommunaute/utils/templatetags/theme_inclusion.py +++ b/lacommunaute/utils/templatetags/theme_inclusion.py @@ -1,6 +1,7 @@ """ https://docs.djangoproject.com/en/dev/howto/custom-template-tags/ """ + from django import template from django.templatetags.static import static from django.utils.safestring import mark_safe diff --git a/lacommunaute/utils/testing.py b/lacommunaute/utils/testing.py index 2a6cb749c..9db8b1c0b 100644 --- a/lacommunaute/utils/testing.py +++ b/lacommunaute/utils/testing.py @@ -35,9 +35,11 @@ def parse_response_to_soup(response, selector=None, no_html_body=False, replace_ csp_nonce_script["nonce"] = "NORMALIZED_CSP_NONCE" if replace_in_href: replacements = [ - replacement - if isinstance(replacement, tuple) - else (str(replacement.pk), f"[PK of {type(replacement).__name__}]") + ( + replacement + if isinstance(replacement, tuple) + else (str(replacement.pk), f"[PK of {type(replacement).__name__}]") + ) for replacement in replace_in_href ] for links in soup.find_all(attrs={"href": True}):