ruff: Fix PLR1733 Unnecessary lookup of dictionary value by key.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-06-17 14:06:27 -07:00
committed by Tim Abbott
parent b924169d17
commit e8fdae8f7b
3 changed files with 5 additions and 5 deletions

View File

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