Python formatting

This commit is contained in:
Mouse Reeve 2022-01-22 19:01:42 -08:00
parent e5c8500547
commit 191079a922
2 changed files with 10 additions and 8 deletions

View file

@ -47,7 +47,9 @@ urlpatterns = [
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
# polling updates
re_path("^api/updates/notifications/?$", views.get_notification_count),
re_path("^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string),
re_path(
"^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string
),
# authentication
re_path(r"^login/?$", views.Login.as_view(), name="login"),
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),

View file

@ -33,14 +33,14 @@ def get_unread_status_string(request, stream="home"):
allowed_status_types = request.user.feed_status_types
count = sum(c for (k, c) in counts_by_type if k in allowed_status_types)
# if "everything else" is allowed, add other types to the sum
count += sum(c for (k, c) in counts_by_type if k not in ["review", "comment", "quotation"])
count += sum(
c
for (k, c) in counts_by_type
if k not in ["review", "comment", "quotation"]
)
translation_string = lambda c: ngettext(
"Load %(count)d unread status",
"Load %(count)d unread statuses",
c
"Load %(count)d unread status", "Load %(count)d unread statuses", c
) % {"count": c}
return JsonResponse(
{"total": translation_string(count)}
)
return JsonResponse({"total": translation_string(count)})