ruff: Fix N812 lowercase imported as non-lowercase.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-11-15 21:24:11 -08:00 committed by Tim Abbott
parent 0258fba345
commit 8f17093be2
1 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ from django.contrib.auth import get_backends
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from django.utils.translation import override as override_language
from lxml.html import builder as E
from lxml.html import builder as e
from confirmation.models import one_click_unsubscribe_link
from zerver.decorator import statsd_increment
@ -85,7 +85,7 @@ def relative_to_full_url(fragment: lxml.html.HtmlElement, base_url: str) -> None
title_attr = {} if image_title is None else {"title": image_title}
inner.clear()
inner.tag = "p"
inner.append(E.A(image_link, href=image_link, target="_blank", **title_attr))
inner.append(e.A(image_link, href=image_link, target="_blank", **title_attr))
else:
# Inline images can't be displayed in the emails as the request
# from the mail server can't be authenticated because it has no
@ -111,7 +111,7 @@ def fix_emojis(fragment: lxml.html.HtmlElement, base_url: str, emojiset: str) ->
emoji_name = emoji_span_elem.get("title")
alt_code = emoji_span_elem.text
image_url = base_url + f"/static/generated/emoji/images-{emojiset}-64/{emoji_code}.png"
img_elem = E.IMG(alt=alt_code, src=image_url, title=emoji_name, style="height: 20px;")
img_elem = e.IMG(alt=alt_code, src=image_url, title=emoji_name, style="height: 20px;")
img_elem.tail = emoji_span_elem.tail
return img_elem
@ -135,13 +135,13 @@ def fix_spoilers_in_html(fragment: lxml.html.HtmlElement, language: str) -> None
header_content = header.find("p")
if header_content is None:
# Create a new element to append the spoiler to)
header_content = E.P()
header_content = e.P()
header.append(header_content)
else:
# Add a space.
rear = header_content[-1] if len(header_content) else header_content
rear.tail = (rear.tail or "") + " "
span_elem = E.SPAN(f"({spoiler_title})", **E.CLASS("spoiler-title"), title=spoiler_title)
span_elem = e.SPAN(f"({spoiler_title})", **e.CLASS("spoiler-title"), title=spoiler_title)
header_content.append(span_elem)
header.drop_tag()
spoiler_content.drop_tree()