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 SIM210 Use `bool(…)` instead of `True if … else False`.

Anders Kaseorge5d671bf2b86
diff --git a/zerver/data_import/rocketchat.py b/zerver/data_import/rocketchat.py
index 74cf83d2517..1d9e0b40352 100644
--- a/zerver/data_import/rocketchat.py
+++ b/zerver/data_import/rocketchat.py
@@ -669,7 +669,7 @@ def process_messages(
content=content,
date_sent=int(message["ts"].timestamp()),
reactions=reactions,
- has_link=True if message.get("urls") else False,
+ has_link=bool(message.get("urls")),
)
# Add recipient_id to message_dict
diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py
index 5e44d1e4fbd..8659e565bc5 100644
--- a/zerver/data_import/slack.py
+++ b/zerver/data_import/slack.py
@@ -1052,7 +1052,7 @@ def process_message_files(
# For attachments with Slack download link
has_attachment = True
has_link = True
- has_image = True if "image" in fileinfo["mimetype"] else False
+ has_image = "image" in fileinfo["mimetype"]
file_user = [
iterate_user for iterate_user in users if message["user"] == iterate_user["id"]
diff --git a/zerver/data_import/slack_message_conversion.py b/zerver/data_import/slack_message_conversion.py
index 1a7e4d2579a..ab49421f5d9 100644
--- a/zerver/data_import/slack_message_conversion.py
+++ b/zerver/data_import/slack_message_conversion.py
@@ -110,10 +110,7 @@ def convert_to_zulip_markdown(
# convert `<mailto:[email protected]>` to `mailto:[email protected]`
text, has_mailto_link = convert_mailto_format(text)
- if has_link is True or has_mailto_link is True:
- message_has_link = True
- else:
- message_has_link = False
+ message_has_link = has_link or has_mailto_link
return text, mentioned_users_id, message_has_link
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index 97781169cd4..d41a83478fc 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -1351,10 +1351,7 @@ def format_unread_message_details(
unread_data[str(message_id)] = message_details
for message_id, stream_message_details in raw_unread_data["stream_dict"].items():
- if message_id in raw_unread_data["unmuted_stream_msgs"]:
- unmuted_stream_msg = True
- else:
- unmuted_stream_msg = False
+ unmuted_stream_msg = message_id in raw_unread_data["unmuted_stream_msgs"]
message_details = MessageDetailsDict(
type="stream",
diff --git a/zerver/views/development/integrations.py b/zerver/views/development/integrations.py
index b154fb9c341..96dd7a5431c 100644
--- a/zerver/views/development/integrations.py
+++ b/zerver/views/development/integrations.py
@@ -148,10 +148,7 @@ def send_all_webhook_fixture_messages(
x = fixture.split(".")
fixture_name, fixture_format = "".join(_ for _ in x[:-1]), x[-1]
headers = get_fixture_http_headers(valid_integration_name, fixture_name)
- if fixture_format == "json":
- is_json = True
- else:
- is_json = False
+ is_json = fixture_format == "json"
response = send_webhook_fixture_message(url, content, is_json, headers)
responses.append(
{