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 C416 Unnecessary `dict` comprehension.

Anders Kaseorgb719227b0420
diff --git a/zerver/lib/onboarding.py b/zerver/lib/onboarding.py
index 642579d4f77..d099f67808c 100644
--- a/zerver/lib/onboarding.py
+++ b/zerver/lib/onboarding.py
@@ -23,14 +23,10 @@ def missing_any_realm_internal_bots() -> bool:
bot["email_template"] % (settings.INTERNAL_BOT_DOMAIN,)
for bot in settings.REALM_INTERNAL_BOTS
]
- bot_counts = {
- email: count
- for email, count in UserProfile.objects.filter(email__in=bot_emails)
- .values_list("email")
- .annotate(Count("id"))
- }
realm_count = Realm.objects.count()
- return any(bot_counts.get(email, 0) < realm_count for email in bot_emails)
+ return UserProfile.objects.filter(email__in=bot_emails).values("email").annotate(
+ count=Count("id")
+ ).filter(count=realm_count).count() != len(bot_emails)
def create_if_missing_realm_internal_bots() -> None:
diff --git a/zerver/management/commands/makemessages.py b/zerver/management/commands/makemessages.py
index b9c4e70dcd6..58872010e9a 100644
--- a/zerver/management/commands/makemessages.py
+++ b/zerver/management/commands/makemessages.py
@@ -277,9 +277,6 @@ class Command(makemessages.Command):
except (OSError, ValueError):
old_strings = {}
- new_strings = {
- k: v
- for k, v in self.get_new_strings(old_strings, translation_strings, locale).items()
- }
+ new_strings = self.get_new_strings(old_strings, translation_strings, locale)
with open(output_path, "w") as writer:
json.dump(new_strings, writer, indent=2, sort_keys=True)