ruff: Fix C416 Unnecessary `dict` comprehension.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-03-23 13:16:47 -07:00 committed by Tim Abbott
parent 869ea542fa
commit b719227b04
2 changed files with 4 additions and 11 deletions

View File

@ -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:

View File

@ -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)