Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def read_emoji_sequences(emoji_data_map, file_path):
"""Reads the content of the file which contains emoji sequences. Creates EmojiData for each
line and puts into emoji_data_map."""
lines = read_emoji_lines(file_path)
# 1F1E6 1F1E8 ; Name ; [...]
for line in lines:
codepoints = [hex_str_to_int(x) for x in line.split(';')[0].strip().split(' ')]
codepoints = [x for x in codepoints if x != EMOJI_STYLE_VS]
key = codepoint_to_string(codepoints)
if not key in emoji_data_map:
emoji_data = _EmojiData(codepoints, False)
emoji_data_map[key] = emoji_data
for line in lines:
codepoints_range, emoji_property = codepoints_and_emoji_prop(line)
is_emoji_style = emoji_property == EMOJI_PRESENTATION_STR
codepoints = codepoints_for_emojirange(codepoints_range)
for codepoint in codepoints:
key = codepoint_to_string([codepoint])
codepoint_is_emoji_style = is_emoji_style or codepoint in emoji_style_exceptions
if key in emoji_data_map:
# since there are multiple definitions of emojis, only update when emoji style is
# True
if codepoint_is_emoji_style:
emoji_data_map[key].emoji_style = True
else:
emoji_data = _EmojiData([codepoint], codepoint_is_emoji_style)
emoji_data_map[key] = emoji_data