mirror of https://github.com/zulip/zulip.git
ruff: Fix C416 Unnecessary `dict` comprehension.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
869ea542fa
commit
b719227b04
|
@ -23,14 +23,10 @@ def missing_any_realm_internal_bots() -> bool:
|
||||||
bot["email_template"] % (settings.INTERNAL_BOT_DOMAIN,)
|
bot["email_template"] % (settings.INTERNAL_BOT_DOMAIN,)
|
||||||
for bot in settings.REALM_INTERNAL_BOTS
|
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()
|
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:
|
def create_if_missing_realm_internal_bots() -> None:
|
||||||
|
|
|
@ -277,9 +277,6 @@ class Command(makemessages.Command):
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
old_strings = {}
|
old_strings = {}
|
||||||
|
|
||||||
new_strings = {
|
new_strings = self.get_new_strings(old_strings, translation_strings, locale)
|
||||||
k: v
|
|
||||||
for k, v in self.get_new_strings(old_strings, translation_strings, locale).items()
|
|
||||||
}
|
|
||||||
with open(output_path, "w") as writer:
|
with open(output_path, "w") as writer:
|
||||||
json.dump(new_strings, writer, indent=2, sort_keys=True)
|
json.dump(new_strings, writer, indent=2, sort_keys=True)
|
||||||
|
|
Loading…
Reference in New Issue