Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ruff: Fix ISC003 Explicitly concatenated string.

Anders Kaseorg17300f196c6c
diff --git a/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py b/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py
index 9fc29e92fbc..64493634823 100644
--- a/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py
+++ b/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py
@@ -45,8 +45,10 @@ VNU_IGNORE = [
r"The first occurrence of ID “[^”]*” was here\.",
r"Attribute “markdown” not allowed on element “div” at this point\.",
r"No “p” element in scope but a “p” end tag seen\.",
- r"Element “div” not allowed as child of element “ul” in this context\. "
- + r"\(Suppressing further errors from this subtree\.\)",
+ (
+ r"Element “div” not allowed as child of element “ul” in this context\."
+ r" \(Suppressing further errors from this subtree\.\)"
+ ),
# Opinionated informational messages.
r"Self-closing tag syntax in text/html documents is widely discouraged; it’s unnecessary and interacts badly with other HTML features \(e\.g\., unquoted attribute values\)\. If you’re using a tool that injects self-closing tag syntax into all void elements, without any option to prevent it from doing so, then consider switching to a different tool\.",
]
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index 440d32588fc..52703840fcc 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -673,9 +673,7 @@ html_rules: List["Rule"] = [
{
"pattern": "style ?=",
"description": "Avoid using the `style=` attribute; we prefer styling in CSS files",
- "exclude_pattern": r'.*style ?=["'
- + "'"
- + "](display: ?none|background: {{|color: {{|background-color: {{).*",
+ "exclude_pattern": r""".*style ?=["'](display: ?none|background: {{|color: {{|background-color: {{).*""",
"exclude": {
# 5xx page doesn't have external CSS
"static/html/5xx.html",
diff --git a/zerver/forms.py b/zerver/forms.py
index cf72ea25aa3..ea3a8dfbfd6 100644
--- a/zerver/forms.py
+++ b/zerver/forms.py
@@ -52,15 +52,15 @@ if settings.BILLING_ENABLED:
# We don't mark this error for translation, because it's displayed
# only to MIT users.
MIT_VALIDATION_ERROR = (
- "That user does not exist at MIT or is a "
- + '<a href="https://ist.mit.edu/email-lists">mailing list</a>. '
- + "If you want to sign up an alias for Zulip, "
- + '<a href="mailto:[email protected]">contact us</a>.'
+ "That user does not exist at MIT or is a"
+ ' <a href="https://ist.mit.edu/email-lists">mailing list</a>.'
+ " If you want to sign up an alias for Zulip,"
+ ' <a href="mailto:[email protected]">contact us</a>.'
)
DEACTIVATED_ACCOUNT_ERROR = gettext_lazy(
- "Your account {username} has been deactivated. "
- + "Please contact your organization administrator to reactivate it."
+ "Your account {username} has been deactivated."
+ " Please contact your organization administrator to reactivate it."
)
PASSWORD_TOO_WEAK_ERROR = gettext_lazy("The password is too weak.")
@@ -451,9 +451,9 @@ class OurAuthenticationForm(AuthenticationForm):
assert e.secs_to_freedom is not None
secs_to_freedom = int(e.secs_to_freedom)
error_message = _(
- "You're making too many attempts to sign in. "
- + "Try again in {} seconds or contact your organization administrator "
- + "for help."
+ "You're making too many attempts to sign in."
+ " Try again in {} seconds or contact your organization administrator"
+ " for help."
)
raise ValidationError(error_message.format(secs_to_freedom))
diff --git a/zerver/lib/management.py b/zerver/lib/management.py
index 579fb177fe7..57e191d7a92 100644
--- a/zerver/lib/management.py
+++ b/zerver/lib/management.py
@@ -163,9 +163,8 @@ server via `ps -ef` or reading bash history. Prefer
return UserProfile.objects.select_related().get(delivery_email__iexact=email.strip())
except MultipleObjectsReturned:
raise CommandError(
- "This Zulip server contains multiple users with that email "
- + "(in different realms); please pass `--realm` "
- "to specify which one to modify."
+ "This Zulip server contains multiple users with that email (in different realms);"
+ " please pass `--realm` to specify which one to modify."
)
except UserProfile.DoesNotExist:
raise CommandError(f"This Zulip server does not contain a user with email '{email}'")
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
index 7938ad8c7f8..38bfe0503ed 100644
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -849,8 +849,8 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
schema_re = r"(?:https?://)"
host_re = r"(?:youtu\.be/|(?:\w+\.)?youtube(?:-nocookie)?\.com/)"
param_re = (
- r"(?:(?:(?:v|embed)/)|"
- + r"(?:(?:(?:watch|playlist)(?:_popup|_videos)?(?:\.php)?)?(?:\?|#!?)(?:.+&)?v(?:ideo_ids)?=))"
+ r"(?:(?:(?:v|embed)/)"
+ r"|(?:(?:(?:watch|playlist)(?:_popup|_videos)?(?:\.php)?)?(?:\?|#!?)(?:.+&)?v(?:ideo_ids)?=))"
)
id_re = r"([0-9A-Za-z_-]+)"
youtube_re = r"^({schema_re}?{host_re}{param_re}?)?{id_re}(?(1).+)?$"
@@ -883,8 +883,8 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
vimeo_re = (
r"^((http|https)?:\/\/(www\.)?vimeo.com\/"
- + r"(?:channels\/(?:\w+\/)?|groups\/"
- + r"([^\/]*)\/videos\/|)(\d+)(?:|\/\?))$"
+ r"(?:channels\/(?:\w+\/)?|groups\/"
+ r"([^\/]*)\/videos\/|)(\d+)(?:|\/\?))$"
)
match = re.match(vimeo_re, url)
if match is None:
diff --git a/zerver/lib/markdown/api_return_values_table_generator.py b/zerver/lib/markdown/api_return_values_table_generator.py
index bc09de8bcdf..7a825106c36 100644
--- a/zerver/lib/markdown/api_return_values_table_generator.py
+++ b/zerver/lib/markdown/api_return_values_table_generator.py
@@ -194,7 +194,7 @@ class APIReturnValuesTablePreprocessor(Preprocessor):
# Directly using `###` for subheading causes errors so use h3 with made up id.
argument_template = (
'<div class="api-argument"><p class="api-argument-name"><h3 id="{h3_id}">'
- + " {event_type} {op}</h3></p></div> \n{description}\n\n\n"
+ "{event_type} {op}</h3></p></div> \n{description}\n\n\n"
)
for events in events_dict["oneOf"]:
event_type: Dict[str, Any] = events["properties"]["type"]
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index 764c032b16b..a56135d4c36 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -570,10 +570,9 @@ class MessageDict:
if rendered_content is not None:
obj["rendered_content"] = rendered_content
else:
- obj["rendered_content"] = (
- "<p>[Zulip note: Sorry, we could not "
- + "understand the formatting of your message]</p>"
- )
+ obj[
+ "rendered_content"
+ ] = "<p>[Zulip note: Sorry, we could not understand the formatting of your message]</p>"
if rendered_content is not None:
obj["is_me_message"] = Message.is_status_message(content, rendered_content)
diff --git a/zerver/lib/onboarding.py b/zerver/lib/onboarding.py
index acc8b31df5d..2049759d647 100644
--- a/zerver/lib/onboarding.py
+++ b/zerver/lib/onboarding.py
@@ -74,7 +74,7 @@ def send_initial_pms(user: UserProfile) -> None:
_(
"If you are new to Zulip, check out our [Getting started guide]({getting_started_url})!"
),
- "{organization_setup_text}" + "\n\n",
+ "{organization_setup_text}\n\n",
"{demo_org_warning}",
_(
"I can also help you get set up! Just click anywhere on this message or press `r` to reply."
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index eaca443f08a..e47deff92ba 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -226,9 +226,9 @@ Output:
else:
# A web app request; use a browser User-Agent string.
default_user_agent = (
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
- + "AppleWebKit/537.36 (KHTML, like Gecko) "
- + "Chrome/79.0.3945.130 Safari/537.36"
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
+ " AppleWebKit/537.36 (KHTML, like Gecko)"
+ " Chrome/79.0.3945.130 Safari/537.36"
)
if skip_user_agent:
# Provide a way to disable setting User-Agent if desired.
diff --git a/zerver/openapi/markdown_extension.py b/zerver/openapi/markdown_extension.py
index 3cbdfb6ea15..a1d70b9530e 100644
--- a/zerver/openapi/markdown_extension.py
+++ b/zerver/openapi/markdown_extension.py
@@ -307,16 +307,14 @@ def generate_curl_example(
authentication_required = True
else:
raise AssertionError(
- "Unhandled global securityScheme."
- + " Please update the code to handle this scheme."
+ "Unhandled global securityScheme. Please update the code to handle this scheme."
)
elif operation_security == []:
if operation in insecure_operations:
authentication_required = False
else:
raise AssertionError(
- "Unknown operation without a securityScheme. "
- + "Please update insecure_operations."
+ "Unknown operation without a securityScheme. Please update insecure_operations."
)
else:
raise AssertionError(
diff --git a/zerver/openapi/openapi.py b/zerver/openapi/openapi.py
index 072053239cc..ca94bfd6730 100644
--- a/zerver/openapi/openapi.py
+++ b/zerver/openapi/openapi.py
@@ -496,8 +496,8 @@ def validate_schema(schema: Dict[str, Any]) -> None:
elif schema["type"] == "object":
if "additionalProperties" not in schema:
raise SchemaError(
- "additionalProperties needs to be defined for objects to make "
- + "sure they have no additional properties left to be documented."
+ "additionalProperties needs to be defined for objects to make sure they have no"
+ " additional properties left to be documented."
)
for property_schema in schema.get("properties", {}).values():
validate_schema(property_schema)
diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py
index ef03d356e24..b22af6ebbb1 100644
--- a/zerver/tests/test_auth_backends.py
+++ b/zerver/tests/test_auth_backends.py
@@ -2000,15 +2000,15 @@ class SAMLAuthBackendTest(SocialAuthBase):
extra_attrs = ""
for extra_attr_name, extra_attr_values in extra_attributes.items():
values = "".join(
- '<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" '
- + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">'
- + f"{value}</saml2:AttributeValue>"
+ '<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"'
+ ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">'
+ f"{value}</saml2:AttributeValue>"
for value in extra_attr_values
)
extra_attrs += (
- f'<saml2:Attribute Name="{extra_attr_name}" '
- + 'NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">'
- + f"{values}</saml2:Attribute>"
+ f'<saml2:Attribute Name="{extra_attr_name}"'
+ ' NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">'
+ f"{values}</saml2:Attribute>"
)
unencoded_saml_response = self.fixture_data("samlresponse.txt", type="saml").format(
@@ -2815,8 +2815,11 @@ class SAMLAuthBackendTest(SocialAuthBase):
m.output,
[
self.logger_output(
- "AuthFailed: Authentication failed: SAML user from IdP test_idp rejected due to "
- + "missing entitlement for subdomain ''. User entitlements: ['zephyr'].",
+ (
+ "AuthFailed: Authentication failed: SAML user from IdP test_idp"
+ " rejected due to missing entitlement for subdomain ''. User"
+ " entitlements: ['zephyr']."
+ ),
"info",
)
],
@@ -2839,8 +2842,11 @@ class SAMLAuthBackendTest(SocialAuthBase):
m.output,
[
self.logger_output(
- "AuthFailed: Authentication failed: SAML user from IdP test_idp rejected due to "
- + "missing entitlement for subdomain 'zulip'. User entitlements: ['zephyr', 'othersubdomain'].",
+ (
+ "AuthFailed: Authentication failed: SAML user from IdP test_idp rejected"
+ " due to missing entitlement for subdomain 'zulip'. User entitlements:"
+ " ['zephyr', 'othersubdomain']."
+ ),
"info",
)
],
@@ -2934,8 +2940,10 @@ class SAMLAuthBackendTest(SocialAuthBase):
m.output,
[
self.logger_output(
- "Exception while syncing custom profile fields for "
- + f"user {self.user_profile.id}: Custom profile field with name title not found.",
+ (
+ "Exception while syncing custom profile fields for user"
+ f" {self.user_profile.id}: Custom profile field with name title not found."
+ ),
"warning",
)
],
diff --git a/zerver/tests/test_bots.py b/zerver/tests/test_bots.py
index a06b0b79b06..88fcffcd96c 100644
--- a/zerver/tests/test_bots.py
+++ b/zerver/tests/test_bots.py
@@ -118,7 +118,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
error_message = (
"Can't create bots until FAKE_EMAIL_DOMAIN is correctly configured.\n"
- + "Please contact your server administrator."
+ "Please contact your server administrator."
)
self.assert_json_error(result, error_message)
self.assert_num_bots_equal(0)
diff --git a/zerver/tests/test_email_notifications.py b/zerver/tests/test_email_notifications.py
index 3b043bd4c13..9ea8bb645da 100644
--- a/zerver/tests/test_email_notifications.py
+++ b/zerver/tests/test_email_notifications.py
@@ -1451,7 +1451,7 @@ class TestMissedMessages(ZulipTestCase):
actual_output = convert(test_data)
expected_output = (
'<div><a href="http://example.com/user_uploads/{realm_id}/1f/some_random_value">'
- + "/user_uploads/{realm_id}/1f/some_random_value</a></div>"
+ "/user_uploads/{realm_id}/1f/some_random_value</a></div>"
)
expected_output = expected_output.format(realm_id=zephyr_realm.id)
self.assertEqual(actual_output, expected_output)
@@ -1465,27 +1465,31 @@ class TestMissedMessages(ZulipTestCase):
# A narrow URL which begins with a '#'.
test_data = (
'<p><a href="#narrow/stream/test/topic/test.20topic/near/142"'
- + 'title="#narrow/stream/test/topic/test.20topic/near/142">Conversation</a></p>'
+ ' title="#narrow/stream/test/topic/test.20topic/near/142">Conversation</a></p>'
)
actual_output = convert(test_data)
expected_output = (
- '<div><p><a href="http://example.com/#narrow/stream/test/topic/test.20topic/near/142" '
- + 'title="http://example.com/#narrow/stream/test/topic/test.20topic/near/142">Conversation</a></p></div>'
+ '<div><p><a href="http://example.com/#narrow/stream/test/topic/test.20topic/near/142"'
+ ' title="http://example.com/#narrow/stream/test/topic/test.20topic/near/142">Conversation</a></p></div>'
)
self.assertEqual(actual_output, expected_output)
# Scrub inline images.
test_data = (
- '<p>See this <a href="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg" target="_blank" '
- + 'title="avatar_103.jpeg">avatar_103.jpeg</a>.</p>'
- + '<div class="message_inline_image"><a href="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg" '
- + 'target="_blank" title="avatar_103.jpeg"><img src="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg"></a></div>'
+ "<p>See this <a"
+ ' href="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg"'
+ ' target="_blank" title="avatar_103.jpeg">avatar_103.jpeg</a>.</p>'
+ '<div class="message_inline_image"><a'
+ ' href="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg"'
+ ' target="_blank" title="avatar_103.jpeg"><img'
+ ' src="/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg"></a></div>'
)
test_data = test_data.format(realm_id=zulip_realm.id)
actual_output = convert(test_data)
expected_output = (
- '<div><p>See this <a href="http://example.com/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg" target="_blank" '
- + 'title="avatar_103.jpeg">avatar_103.jpeg</a>.</p></div>'
+ "<div><p>See this <a"
+ ' href="http://example.com/user_uploads/{realm_id}/52/fG7GM9e3afz_qsiUcSce2tl_/avatar_103.jpeg"'
+ ' target="_blank" title="avatar_103.jpeg">avatar_103.jpeg</a>.</p></div>'
)
expected_output = expected_output.format(realm_id=zulip_realm.id)
self.assertEqual(actual_output, expected_output)
@@ -1493,16 +1497,17 @@ class TestMissedMessages(ZulipTestCase):
# A message containing only an inline image URL preview, we do
# somewhat more extensive surgery.
test_data = (
- '<div class="message_inline_image"><a href="https://www.google.com/images/srpr/logo4w.png" '
- + 'target="_blank" title="https://www.google.com/images/srpr/logo4w.png">'
- + '<img data-src-fullsize="/thumbnail/https%3A//www.google.com/images/srpr/logo4w.png?size=0x0" '
- + 'src="/thumbnail/https%3A//www.google.com/images/srpr/logo4w.png?size=0x100"></a></div>'
+ '<div class="message_inline_image"><a'
+ ' href="https://www.google.com/images/srpr/logo4w.png"'
+ ' target="_blank" title="https://www.google.com/images/srpr/logo4w.png">'
+ '<img data-src-fullsize="/thumbnail/https%3A//www.google.com/images/srpr/logo4w.png?size=0x0"'
+ ' src="/thumbnail/https%3A//www.google.com/images/srpr/logo4w.png?size=0x100"></a></div>'
)
actual_output = convert(test_data)
expected_output = (
- '<div><p><a href="https://www.google.com/images/srpr/logo4w.png" '
- + 'target="_blank" title="https://www.google.com/images/srpr/logo4w.png">'
- + "https://www.google.com/images/srpr/logo4w.png</a></p></div>"
+ '<div><p><a href="https://www.google.com/images/srpr/logo4w.png"'
+ ' target="_blank" title="https://www.google.com/images/srpr/logo4w.png">'
+ "https://www.google.com/images/srpr/logo4w.png</a></p></div>"
)
self.assertEqual(actual_output, expected_output)
@@ -1548,15 +1553,17 @@ class TestMissedMessages(ZulipTestCase):
def test_fix_emoji(self) -> None:
# An emoji.
test_data = (
- '<p>See <span aria-label="cloud with lightning and rain" class="emoji emoji-26c8" role="img" title="cloud with lightning and rain">'
- + ":cloud_with_lightning_and_rain:</span>.</p>"
+ '<p>See <span aria-label="cloud with lightning and rain" class="emoji emoji-26c8"'
+ ' role="img" title="cloud with lightning and'
+ ' rain">:cloud_with_lightning_and_rain:</span>.</p>'
)
fragment = lxml.html.fromstring(test_data)
fix_emojis(fragment, "http://example.com", "google")
actual_output = lxml.html.tostring(fragment, encoding="unicode")
expected_output = (
- '<p>See <img alt=":cloud_with_lightning_and_rain:" src="http://example.com/static/generated/emoji/images-google-64/26c8.png" '
- + 'title="cloud with lightning and rain" style="height: 20px;">.</p>'
+ '<p>See <img alt=":cloud_with_lightning_and_rain:"'
+ ' src="http://example.com/static/generated/emoji/images-google-64/26c8.png"'
+ ' title="cloud with lightning and rain" style="height: 20px;">.</p>'
)
self.assertEqual(actual_output, expected_output)
diff --git a/zerver/tests/test_link_embed.py b/zerver/tests/test_link_embed.py
index 8c19e3d82fb..4b707e9cce0 100644
--- a/zerver/tests/test_link_embed.py
+++ b/zerver/tests/test_link_embed.py
@@ -589,9 +589,13 @@ class PreviewTestCase(ZulipTestCase):
msg = Message.objects.select_related("sender").get(id=msg_id)
with_preview = (
- '<p><a href="http://test.org/">http://test.org/</a></p>\n<div class="message_embed"><a class="message_embed_image" href="http://test.org/" style="background-image: url('
- + "http\\:\\/\\/ia\\.media-imdb\\.com\\/images\\/rock\\)\\.jpg"
- + ')"></a><div class="data-container"><div class="message_embed_title"><a href="http://test.org/" title="The Rock">The Rock</a></div><div class="message_embed_description">Description text</div></div></div>'
+ '<p><a href="http://test.org/">http://test.org/</a></p>\n'
+ '<div class="message_embed"><a class="message_embed_image" href="http://test.org/"'
+ ' style="background-image:'
+ ' url(http\\:\\/\\/ia\\.media-imdb\\.com\\/images\\/rock\\)\\.jpg)"></a><div'
+ ' class="data-container"><div class="message_embed_title"><a href="http://test.org/"'
+ ' title="The Rock">The Rock</a></div><div class="message_embed_description">Description'
+ " text</div></div></div>"
)
self.assertEqual(
with_preview,
diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py
index 66b5981733c..5903ea5e1cb 100644
--- a/zerver/tests/test_markdown.py
+++ b/zerver/tests/test_markdown.py
@@ -2894,13 +2894,15 @@ class MarkdownTest(ZulipTestCase):
def test_disabled_code_block_processor(self) -> None:
msg = (
"Hello,\n\n"
- + " I am writing this message to test something. I am writing this message to test something."
+ " I am writing this message to test something. I am writing this message to test"
+ " something."
)
converted = markdown_convert_wrapper(msg)
expected_output = (
"<p>Hello,</p>\n"
- + '<div class="codehilite"><pre><span></span><code>I am writing this message to test something. I am writing this message to test something.\n'
- + "</code></pre></div>"
+ '<div class="codehilite"><pre><span></span><code>I am writing this message to test'
+ " something. I am writing this message to test something.\n"
+ "</code></pre></div>"
)
self.assertEqual(converted, expected_output)
@@ -2911,7 +2913,8 @@ class MarkdownTest(ZulipTestCase):
rendering_result = markdown_convert(msg, message_realm=realm, email_gateway=True)
expected_output = (
"<p>Hello,</p>\n"
- + "<p>I am writing this message to test something. I am writing this message to test something.</p>"
+ "<p>I am writing this message to test something. I am writing this message to test"
+ " something.</p>"
)
self.assertEqual(rendering_result.rendered_content, expected_output)
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index c5bbc8aa64c..b03c777e7ed 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -2178,8 +2178,10 @@ class GetOldMessagesTest(ZulipTestCase):
self.assertEqual(meeting_message[MATCH_TOPIC], "meetings")
self.assertEqual(
meeting_message["match_content"],
- '<p>discuss <span class="highlight">lunch</span> after '
- + '<span class="highlight">lunch</span></p>',
+ (
+ '<p>discuss <span class="highlight">lunch</span> after <span'
+ ' class="highlight">lunch</span></p>'
+ ),
)
(lunch_message,) = (m for m in messages if m[TOPIC_NAME] == "lunch plans")
@@ -2224,7 +2226,7 @@ class GetOldMessagesTest(ZulipTestCase):
self.assertEqual(japanese_message[MATCH_TOPIC], '<span class="highlight">日本</span>')
self.assertEqual(
japanese_message["match_content"],
- '<p>昨日、<span class="highlight">日本</span>' + " のお菓子を送りました。</p>",
+ '<p>昨日、<span class="highlight">日本</span> のお菓子を送りました。</p>',
)
(english_message,) = (m for m in messages if m[TOPIC_NAME] == "english")
@@ -2372,7 +2374,7 @@ class GetOldMessagesTest(ZulipTestCase):
self.assertEqual(japanese_message[MATCH_TOPIC], '<span class="highlight">日本</span>語')
self.assertEqual(
japanese_message["match_content"],
- '<p>昨日、<span class="highlight">日本</span>の' + "お菓子を送りました。</p>",
+ '<p>昨日、<span class="highlight">日本</span>のお菓子を送りました。</p>',
)
english_message = [m for m in messages if m[TOPIC_NAME] == "english"][0]
diff --git a/zerver/tests/test_middleware.py b/zerver/tests/test_middleware.py
index 3440a514f1a..3140ac8d629 100644
--- a/zerver/tests/test_middleware.py
+++ b/zerver/tests/test_middleware.py
@@ -123,8 +123,8 @@ class OpenGraphTest(ZulipTestCase):
"Logging out | Zulip help center",
# Ideally we'd do something better here
[
- "Your feedback helps us make Zulip better for everyone! Please contact us "
- + "with questions, suggestions, and feature requests."
+ "Your feedback helps us make Zulip better for everyone! Please contact us with"
+ " questions, suggestions, and feature requests."
],
["Click on the gear"],
)
diff --git a/zerver/tests/test_new_users.py b/zerver/tests/test_new_users.py
index a601d192a24..ed7f9868482 100644
--- a/zerver/tests/test_new_users.py
+++ b/zerver/tests/test_new_users.py
@@ -132,14 +132,19 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase):
super().setUp()
self.user_agents = [
(
- "mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
- + "Chrome/54.0.2840.59 Safari/537.36",
+ (
+ "mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
+ " Chrome/54.0.2840.59 Safari/537.36"
+ ),
"Chrome",
"Linux",
),
(
- "mozilla/5.0 (windows nt 6.1; win64; x64) applewebkit/537.36 (khtml, like gecko) "
- + "chrome/56.0.2924.87 safari/537.36",
+ (
+ "mozilla/5.0 (windows nt 6.1; win64; x64) "
+ " applewebkit/537.36 (khtml, like gecko)"
+ " chrome/56.0.2924.87 safari/537.36"
+ ),
"Chrome",
"Windows",
),
@@ -159,36 +164,46 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase):
"Android",
),
(
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) "
- "AppleWebKit/602.1.50 (KHTML, like Gecko) "
- "CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1",
+ (
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X)"
+ " AppleWebKit/602.1.50 (KHTML, like Gecko)"
+ " CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1"
+ ),
"Chrome",
"iOS",
),
(
- "Mozilla/5.0 (iPad; CPU OS 6_1_3 like Mac OS X) "
- + "AppleWebKit/536.26 (KHTML, like Gecko) "
- + "Version/6.0 Mobile/10B329 Safari/8536.25",
+ (
+ "Mozilla/5.0 (iPad; CPU OS 6_1_3 like Mac OS X)"
+ " AppleWebKit/536.26 (KHTML, like Gecko)"
+ " Version/6.0 Mobile/10B329 Safari/8536.25"
+ ),
"Safari",
"iOS",
),
(
- "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X) "
- + "AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B350",
+ (
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X)"
+ " AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B350"
+ ),
None,
"iOS",
),
(
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) "
- + "AppleWebKit/537.36 (KHTML, like Gecko) "
- + "Chrome/56.0.2924.87 Safari/537.36",
+ (
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6)"
+ " AppleWebKit/537.36 (KHTML, like Gecko)"
+ " Chrome/56.0.2924.87 Safari/537.36"
+ ),
"Chrome",
"macOS",
),
(
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) "
- + "AppleWebKit/602.3.12 (KHTML, like Gecko) "
- + "Version/10.0.2 Safari/602.3.12",
+ (
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6)"
+ " AppleWebKit/602.3.12 (KHTML, like Gecko)"
+ " Version/10.0.2 Safari/602.3.12"
+ ),
"Safari",
"macOS",
),
@@ -196,37 +211,46 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase):
("ZulipMobile/1.0.12 (Android 7.1.1)", "Zulip", "Android"),
("ZulipMobile/0.7.1.1 (iOS 10.3.1)", "Zulip", "iOS"),
(
- "ZulipElectron/1.1.0-beta Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
- + "AppleWebKit/537.36 (KHTML, like Gecko) Zulip/1.1.0-beta "
- + "Chrome/56.0.2924.87 Electron/1.6.8 Safari/537.36",
+ (
+ "ZulipElectron/1.1.0-beta Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
+ " AppleWebKit/537.36 (KHTML, like Gecko) Zulip/1.1.0-beta"
+ " Chrome/56.0.2924.87 Electron/1.6.8 Safari/537.36"
+ ),
"Zulip",
"Windows",
),
(
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, "
- "like Gecko) Ubuntu/11.10 Chromium/16.0.912.77 "
- "Chrome/16.0.912.77 Safari/535.7",
+ (
+ "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko)"
+ " Ubuntu/11.10 Chromium/16.0.912.77 Chrome/16.0.912.77 Safari/535.7"
+ ),
"Chromium",
"Linux",
),
(
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 "
- "(KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 "
- "OPR/15.0.1147.100",
+ (
+ "Mozilla/5.0 (Windows NT 6.1; WOW64)"
+ " AppleWebKit/537.36 (KHTML, like Gecko)"
+ " Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100"
+ ),
"Opera",
"Windows",
),
(
- "Mozilla/5.0 (Windows NT 10.0; <64-bit tags>) AppleWebKit/"
- "<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Safari"
- "/<WebKit Rev> Edge/<EdgeHTML Rev>."
- "<Windows Build>",
+ (
+ "Mozilla/5.0 (Windows NT 10.0; <64-bit tags>)"
+ " AppleWebKit/<WebKit Rev> (KHTML, like Gecko)"
+ " Chrome/<Chrome Rev> Safari/<WebKit Rev>"
+ " Edge/<EdgeHTML Rev>.<Windows Build>"
+ ),
"Edge",
"Windows",
),
(
- "Mozilla/5.0 (X11; CrOS x86_64 10895.56.0) AppleWebKit/537.36 "
- "(KHTML, like Gecko) Chrome/69.0.3497.95 Safari/537.36",
+ (
+ "Mozilla/5.0 (X11; CrOS x86_64 10895.56.0) AppleWebKit/537.36"
+ " (KHTML, like Gecko) Chrome/69.0.3497.95 Safari/537.36"
+ ),
"Chrome",
"ChromeOS",
),
diff --git a/zerver/tests/test_retention.py b/zerver/tests/test_retention.py
index f1b7f61033d..e759be70985 100644
--- a/zerver/tests/test_retention.py
+++ b/zerver/tests/test_retention.py
@@ -189,9 +189,10 @@ class ArchiveMessagesTestingBase(RetentionTestingBase):
self.subscribe(user_profile, "Denmark")
body = (
- "Some files here ... [zulip.txt](http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/zulip.txt)"
- + " http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/temp_file.py.... Some more...."
- + " http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/abc.py"
+ "Some files here ..."
+ " [zulip.txt](http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/zulip.txt)"
+ " http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/temp_file.py.... Some"
+ " more.... http://{host}/user_uploads/{id}/31/4CBjtTLYZhk66pZrF8hnYGwc/abc.py"
).format(id=realm_id, host=host)
expired_message_id = self.send_stream_message(user_profile, "Denmark", body)
diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py
index 3bd0e44da11..54e276f3977 100644
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -1348,9 +1348,10 @@ class InviteUserTest(InviteUserBase):
result = self.invite(invitee_emails, ["Denmark"])
self.assert_json_error(
result,
- "Some of those addresses are already using Zulip,"
- + " so we didn't send them an invitation."
- + " We did send invitations to everyone else!",
+ (
+ "Some of those addresses are already using Zulip, so we didn't send them an"
+ " invitation. We did send invitations to everyone else!"
+ ),
)
def test_invite_mirror_dummy_user(self) -> None:
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index 26a89b38e83..00b99c55448 100644
--- a/zerver/tests/test_subs.py
+++ b/zerver/tests/test_subs.py
@@ -2082,7 +2082,7 @@ class StreamAdminTest(ZulipTestCase):
# Simulate that a stream by the same name has already been
# deactivated, just to exercise our renaming logic:
# Since we do not know the id of these simulated stream we prepend the name with a random hashed_stream_id
- ensure_stream(realm, "DB32B77" + "!DEACTIVATED:" + active_name, acting_user=None)
+ ensure_stream(realm, "DB32B77!DEACTIVATED:" + active_name, acting_user=None)
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events, expected_num_events=1):
diff --git a/zerver/webhooks/basecamp/view.py b/zerver/webhooks/basecamp/view.py
index 4626a25e60b..7c0845977ff 100644
--- a/zerver/webhooks/basecamp/view.py
+++ b/zerver/webhooks/basecamp/view.py
@@ -16,8 +16,8 @@ from .support_event import SUPPORT_EVENTS
DOCUMENT_TEMPLATE = "{user_name} {verb} the document [{title}]({url})"
QUESTION_TEMPLATE = "{user_name} {verb} the question [{title}]({url})"
QUESTIONS_ANSWER_TEMPLATE = (
- "{user_name} {verb} the [answer]({answer_url}) "
- + "of the question [{question_title}]({question_url})"
+ "{user_name} {verb} the [answer]({answer_url})"
+ " of the question [{question_title}]({question_url})"
)
COMMENT_TEMPLATE = (
"{user_name} {verb} the [comment]({answer_url}) of the task [{task_title}]({task_url})"
diff --git a/zerver/webhooks/stripe/tests.py b/zerver/webhooks/stripe/tests.py
index 10c0c2dded9..3be4d390384 100644
--- a/zerver/webhooks/stripe/tests.py
+++ b/zerver/webhooks/stripe/tests.py
@@ -158,7 +158,7 @@ Billing method: send invoice"""
expected_topic = "cus_00000000000000"
expected_message = (
"[Customer](https://dashboard.stripe.com/customers/cus_00000000000000) updated"
- + "\n* Account balance is now 100"
+ "\n* Account balance is now 100"
)
self.check_webhook(
"customer_updated__account_balance",
diff --git a/zerver/webhooks/taiga/tests.py b/zerver/webhooks/taiga/tests.py
index 79cb33c1fac..265cef910e9 100644
--- a/zerver/webhooks/taiga/tests.py
+++ b/zerver/webhooks/taiga/tests.py
@@ -81,8 +81,9 @@ class TaigaHookTests(WebhookTestCase):
def test_taiga_userstory_changed_due_date(self) -> None:
message = (
- "[Aditya Verma](https://tree.taiga.io/profile/orientor) changed due date of user story "
- + "[Nice Issue](https://tree.taiga.io/project/orientor-sd/us/54) from 2020-02-15 to 2020-02-22."
+ "[Aditya Verma](https://tree.taiga.io/profile/orientor) changed due date of user story"
+ " [Nice Issue](https://tree.taiga.io/project/orientor-sd/us/54) from 2020-02-15 to"
+ " 2020-02-22."
)
self.check_webhook("userstory_changed_due_date", self.TOPIC, message)
@@ -145,7 +146,8 @@ class TaigaHookTests(WebhookTestCase):
def test_taiga_task_changed_due_date(self) -> None:
message = (
"[Aditya Verma](https://tree.taiga.io/profile/orientor) changed due date of task"
- + " [nice task](https://tree.taiga.io/project/orientor-sd/task/56) from 2020-02-22 to 2020-02-15."
+ " [nice task](https://tree.taiga.io/project/orientor-sd/task/56) from 2020-02-22 to"
+ " 2020-02-15."
)
self.check_webhook("task_changed_due_date", self.TOPIC, message)
@@ -235,8 +237,9 @@ class TaigaHookTests(WebhookTestCase):
def test_taiga_issue_changed_due_date(self) -> None:
message = (
- "[Aditya Verma](https://tree.taiga.io/profile/orientor) changed due date of issue [Issues](https://tree.taiga.io/project/orientor-sd/issue/49) "
- + "from 2020-03-08 to 2020-02-22."
+ "[Aditya Verma](https://tree.taiga.io/profile/orientor) changed due date of issue"
+ " [Issues](https://tree.taiga.io/project/orientor-sd/issue/49) from 2020-03-08 to"
+ " 2020-02-22."
)
self.check_webhook("issue_changed_due_date", self.TOPIC, message)
@@ -302,8 +305,9 @@ class TaigaHookTests(WebhookTestCase):
def test_taiga_relateduserstory_created_link(self) -> None:
message = (
- "[Aditya Verma](https://tree.taiga.io/profile/orientor) added a related user story [Nice Issue](https://tree.taiga.io/project/orientor-sd/us/54) "
- + "to the epic [ASAS](https://tree.taiga.io/project/orientor-sd/epic/42)."
+ "[Aditya Verma](https://tree.taiga.io/profile/orientor) added a related user story"
+ " [Nice Issue](https://tree.taiga.io/project/orientor-sd/us/54) to the epic"
+ " [ASAS](https://tree.taiga.io/project/orientor-sd/epic/42)."
)
self.check_webhook("relateduserstory_created_link", self.TOPIC, message)
diff --git a/zerver/webhooks/taiga/view.py b/zerver/webhooks/taiga/view.py
index 69770595038..168779b73ac 100644
--- a/zerver/webhooks/taiga/view.py
+++ b/zerver/webhooks/taiga/view.py
@@ -59,12 +59,12 @@ templates = {
},
"relateduserstory": {
"create": (
- "[{user}]({user_link}) added a related user story "
- "{userstory_subject} to the epic {epic_subject}."
+ "[{user}]({user_link}) added a related user story"
+ " {userstory_subject} to the epic {epic_subject}."
),
"delete": (
- "[{user}]({user_link}) removed a related user story "
- + "{userstory_subject} from the epic {epic_subject}."
+ "[{user}]({user_link}) removed a related user story"
+ " {userstory_subject} from the epic {epic_subject}."
),
},
"userstory": {
diff --git a/zerver/webhooks/trello/view/card_actions.py b/zerver/webhooks/trello/view/card_actions.py
index 444951abe04..08d9acc881a 100644
--- a/zerver/webhooks/trello/view/card_actions.py
+++ b/zerver/webhooks/trello/view/card_actions.py
@@ -52,7 +52,7 @@ ACTIONS_TO_MESSAGE_MAPPER = {
SET_DESC: "set description for {card_url_template} to:\n~~~ quote\n{desc}\n~~~\n",
CHANGE_DESC: (
"changed description for {card_url_template} from\n"
- + "~~~ quote\n{old_desc}\n~~~\nto\n~~~ quote\n{desc}\n~~~\n"
+ "~~~ quote\n{old_desc}\n~~~\nto\n~~~ quote\n{desc}\n~~~\n"
),
REMOVE_DESC: "removed description from {card_url_template}.",
ARCHIVE: "archived {card_url_template}.",
diff --git a/zproject/backends.py b/zproject/backends.py
index 4b57b26e1b2..b19f9e92e89 100644
--- a/zproject/backends.py
+++ b/zproject/backends.py
@@ -2299,9 +2299,9 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
]
if idps_without_limit_to_subdomains:
self.logger.error(
- "SAML_REQUIRE_LIMIT_TO_SUBDOMAINS is enabled and the following "
- + "IdPs don't have limit_to_subdomains specified and will be ignored: "
- + f"{idps_without_limit_to_subdomains}"
+ "SAML_REQUIRE_LIMIT_TO_SUBDOMAINS is enabled and the following IdPs don't have"
+ " limit_to_subdomains specified and will be ignored:"
+ f" {idps_without_limit_to_subdomains}"
)
for idp_name in idps_without_limit_to_subdomains:
del settings.SOCIAL_AUTH_SAML_ENABLED_IDPS[idp_name]
@@ -2437,8 +2437,8 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
return
error_msg = (
- f"SAML user from IdP {idp.name} rejected due to missing entitlement "
- + f"for subdomain '{subdomain}'. User entitlements: {entitlements}."
+ f"SAML user from IdP {idp.name} rejected due to missing entitlement for subdomain"
+ f" '{subdomain}'. User entitlements: {entitlements}."
)
raise AuthFailed(self, error_msg)
@@ -2545,7 +2545,7 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
subdomain = self.choose_subdomain(relayed_params)
if subdomain is None:
error_msg = (
- "/complete/saml/: Can't figure out subdomain for this %s. " + "relayed_params: %s"
+ "/complete/saml/: Can't figure out subdomain for this %s. relayed_params: %s"
)
self.logger.info(error_msg, saml_document.document_type(), relayed_params)
return None
@@ -2560,8 +2560,8 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
idp_valid = self.validate_idp_for_subdomain(idp_name, subdomain)
if not idp_valid:
error_msg = (
- "/complete/saml/: Authentication request with IdP %s but this provider is not "
- + "enabled for this subdomain %s."
+ "/complete/saml/: Authentication request with IdP %s but this provider is not"
+ " enabled for this subdomain %s."
)
self.logger.info(error_msg, idp_name, subdomain)
return None