Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

build_emoji: Guard mutable default with read-only type.

Anders Kaseorg51d1ccb064f3
diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji
index 01eb83055c5..88d30a6251d 100755
--- a/tools/setup/emoji/build_emoji
+++ b/tools/setup/emoji/build_emoji
@@ -5,7 +5,7 @@
import os
import shutil
import sys
-from typing import Any, Dict, Iterator, List, Optional
+from typing import Any, Dict, Iterator, List, Optional, Sequence
import orjson
@@ -127,13 +127,13 @@ def percent(f: float) -> str:
return f"{f * 100:0.3f}%"
-def get_square_size(emoji_data: List[Dict[str, Any]]) -> int:
+def get_square_size(emoji_data: Sequence[Dict[str, Any]]) -> int:
"""
Spritesheets are usually NxN squares, and we have to
infer N from the sheet_x/sheet_y values of emojis.
"""
- def get_offsets(emoji_data: List[Dict[str, Any]]) -> Iterator[int]:
+ def get_offsets(emoji_data: Sequence[Dict[str, Any]]) -> Iterator[int]:
for emoji_dict in emoji_data:
yield emoji_dict["sheet_x"]
yield emoji_dict["sheet_y"]
@@ -151,7 +151,7 @@ def generate_sprite_css_files(
emoji_data: List[Dict[str, Any]],
emojiset: str,
alt_name: str,
- fallback_emoji_data: List[Dict[str, Any]],
+ fallback_emoji_data: Sequence[Dict[str, Any]],
) -> None:
"""
Spritesheets are usually NxN squares.
@@ -281,7 +281,7 @@ def setup_emoji_farms(cache_path: str, emoji_data: List[Dict[str, Any]]) -> None
emojiset: str,
emoji_data: List[Dict[str, Any]],
alt_name: Optional[str] = None,
- fallback_emoji_data: List[Dict[str, Any]] = list(),
+ fallback_emoji_data: Sequence[Dict[str, Any]] = [],
) -> None:
# `alt_name` is an optional parameter that we use to avoid duplicating below
# code. It is only used while setting up google-blob emoji set as it is just