mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
ruff: Fix PLR1733 Unnecessary lookup of dictionary value by key.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
b924169d17
commit
e8fdae8f7b
@@ -619,9 +619,9 @@ def rewrite_client_arrays(value_arrays: dict[str, list[int]]) -> dict[str, list[
|
||||
mapped_label = client_label_map(label)
|
||||
if mapped_label in mapped_arrays:
|
||||
for i in range(len(array)):
|
||||
mapped_arrays[mapped_label][i] += value_arrays[label][i]
|
||||
mapped_arrays[mapped_label][i] += array[i]
|
||||
else:
|
||||
mapped_arrays[mapped_label] = [value_arrays[label][i] for i in range(len(array))]
|
||||
mapped_arrays[mapped_label] = array.copy()
|
||||
return mapped_arrays
|
||||
|
||||
|
||||
|
@@ -188,7 +188,7 @@ def main() -> None:
|
||||
|
||||
# STEP 4: We keep non-ascii (non-"English") characters in some emoji names if that's the correct
|
||||
# way to spell that word, but always add an alias for an ascii-only version of the word.
|
||||
for emoji_code, emoji_names in all_emojis.items():
|
||||
for emoji_names in all_emojis.values():
|
||||
for name in [emoji_names["canonical_name"]] + emoji_names["aliases"]:
|
||||
# These are known names where we don't have an ascii-only version and there are ascii aliases
|
||||
# that a user can still enter instead to get the same emoji.
|
||||
@@ -200,7 +200,7 @@ def main() -> None:
|
||||
# Now no other emoji can use this alias.
|
||||
for code in alias_to_emoji_code[ascii_alias]:
|
||||
all_emojis[code]["aliases"].remove(ascii_alias)
|
||||
all_emojis[emoji_code]["aliases"].append(ascii_alias)
|
||||
emoji_names["aliases"].append(ascii_alias)
|
||||
|
||||
# STEP 5: Write final dictionary to `emoji_names.py`.
|
||||
with open(OUT_EMOJI_FILE, "w") as f:
|
||||
|
@@ -879,7 +879,7 @@ def gather_subscriptions_helper(
|
||||
)
|
||||
for stream_id, users in subscriber_map.items():
|
||||
partial_subscribers = [user_id for user_id in users if user_id in bot_users]
|
||||
if len(partial_subscribers) != len(subscriber_map[stream_id]):
|
||||
if len(partial_subscribers) != len(users):
|
||||
partial_subscriber_map[stream_id] = partial_subscribers
|
||||
|
||||
for lst in [subscribed, unsubscribed]:
|
||||
|
Reference in New Issue
Block a user