Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix PLR1733 Unnecessary lookup of dictionary value by key.
Anders Kaseorge8fdae8f7b4e
diff --git a/analytics/views/stats.py b/analytics/views/stats.pyindex 0df1cfe10cd..715fb346f49 100644--- a/analytics/views/stats.py+++ b/analytics/views/stats.py@@ -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_arraysdiff --git a/tools/setup/emoji/generate_emoji_names b/tools/setup/emoji/generate_emoji_namesindex e72f1f7608b..e389ac40420 100755--- a/tools/setup/emoji/generate_emoji_names+++ b/tools/setup/emoji/generate_emoji_names@@ -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:diff --git a/zerver/lib/subscription_info.py b/zerver/lib/subscription_info.pyindex b7dce876c23..301c20c91e1 100644--- a/zerver/lib/subscription_info.py+++ b/zerver/lib/subscription_info.py@@ -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_subscribersfor lst in [subscribed, unsubscribed]: