build_emoji: Close open file objects after reading.

This commit is contained in:
Harshit Bansal 2017-06-29 21:22:29 +00:00 committed by Tim Abbott
parent 4cb8ac100a
commit a876ebb52a
1 changed files with 7 additions and 2 deletions

View File

@ -202,9 +202,14 @@ def dump_emojis(cache_path):
# type: (str) -> None
subprocess.call('ttx -v -z extfile -d {} NotoColorEmoji.ttf'.format(EMOJI_DUMP_DIR_PATH), shell=True)
emoji_map = ujson.load(open('emoji_map.json'))
with open('emoji_map.json') as emoji_map_file:
emoji_map = ujson.load(emoji_map_file)
code_point_to_fname_map = code_point_to_file_name_map(EMOJI_DUMP_PATH("NotoColorEmoji.ttx"))
emoji_data = ujson.load(open(os.path.join(EMOJI_DATA_PATH, 'emoji.json')))
EMOJI_DATA_FILE_PATH = os.path.join(EMOJI_DATA_PATH, 'emoji.json')
with open(EMOJI_DATA_FILE_PATH) as emoji_data_file:
emoji_data = ujson.load(emoji_data_file)
emoji_catalog = generate_emoji_catalog(emoji_data)
UNIFIED_REACTIONS_PATH = os.path.join(ZULIP_PATH, 'zerver', 'management', 'data', 'unified_reactions.json')