From 1eb3825048bf92a3258a071c650f97865424ed40 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Thu, 9 Aug 2018 19:27:23 +0000 Subject: [PATCH] emoji: Remove now-unnecessary `get_remapped_emojis_map()`. --- tools/setup/emoji/build_emoji | 10 +++------- tools/setup/emoji/emoji_setup_utils.py | 5 +---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index 526a388348..930b99d6ec 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -10,8 +10,8 @@ import ujson from typing import Any, Dict, List from emoji_setup_utils import generate_emoji_catalog, generate_codepoint_to_name_map, \ - get_emoji_code, generate_name_to_codepoint_map, get_remapped_emojis_map, \ - emoji_names_for_picker, EMOJISETS, EMOTICON_CONVERSIONS + get_emoji_code, generate_name_to_codepoint_map, emoji_names_for_picker, \ + EMOJISETS, EMOTICON_CONVERSIONS, REMAPPED_EMOJIS from emoji_names import EMOJI_NAME_MAPS ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../') @@ -184,12 +184,8 @@ def setup_old_emoji_farm(cache_path: str, unicode_symlink_path = os.path.join(unicode_emoji_cache_path, 'zulip.png') os.symlink(image_file_path, unicode_symlink_path) - # `remapped_emojis` is a mapping which helps in mapping `emoji_map` - # codepoints to corresponding images in new emoji farm. - remapped_emojis = get_remapped_emojis_map(emoji_data) - for name, codepoint in emoji_map.items(): - mapped_codepoint = remapped_emojis.get(codepoint, codepoint) + mapped_codepoint = REMAPPED_EMOJIS.get(codepoint, codepoint) image_file_path = os.path.join(google_emoji_cache_path, '{}.png'.format(mapped_codepoint)) symlink_path = os.path.join(emoji_cache_path, '{}.png'.format(name)) os.symlink(image_file_path, symlink_path) diff --git a/tools/setup/emoji/emoji_setup_utils.py b/tools/setup/emoji/emoji_setup_utils.py index 1090c922a7..759c53cd1a 100644 --- a/tools/setup/emoji/emoji_setup_utils.py +++ b/tools/setup/emoji/emoji_setup_utils.py @@ -11,7 +11,7 @@ EMOJISETS = ['apple', 'emojione', 'google', 'twitter'] # Some image files in the old emoji farm had a different name than in the new emoji # farm. `remapped_emojis` is a map that contains a mapping of their name in the old # emoji farm to their name in the new emoji farm. -remapped_emojis = { +REMAPPED_EMOJIS = { "0023": "0023-20e3", # Hash "0030": "0030-20e3", # Zero "0031": "0031-20e3", # One @@ -112,6 +112,3 @@ def generate_name_to_codepoint_map(emoji_name_maps: Dict[str, Dict[str, Any]]) - for alias in aliases: name_to_codepoint[alias] = emoji_code return name_to_codepoint - -def get_remapped_emojis_map(emoji_data: List[Dict[str, Any]]) -> Dict[str, str]: - return remapped_emojis