mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	build_emoji: Guard mutable default with read-only type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							4316f47f8d
						
					
				
				
					commit
					51d1ccb064
				
			@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user