Skip to content

Commit

Permalink
Do no check version/variant when the emoji was not found in the dict
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Oct 2, 2021
1 parent 41fc4ec commit 82be2e8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions emoji/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ def replace(match):
delimiters[1], _DEFAULT_DELIMITER
)
if use_aliases:
emj = unicode_codes.EMOJI_ALIAS_UNICODE_ENGLISH.get(mg, mg)
emj = unicode_codes.EMOJI_ALIAS_UNICODE_ENGLISH.get(mg)
else:
emj = EMOJI_UNICODE.get(mg, mg)
emj = EMOJI_UNICODE.get(mg)

if emj is None:
return mg

if version is not None:
if emj in unicode_codes.EMOJI_DATA and unicode_codes.EMOJI_DATA[emj]['E'] > version:
if callable(handle_version):
Expand All @@ -75,6 +79,7 @@ def replace(match):
return str(handle_version)
else:
return ''

if variant is None or 'variant' not in unicode_codes.EMOJI_DATA[emj]:
return emj

Expand Down Expand Up @@ -119,7 +124,7 @@ def demojize(

def replace(match):
emj = match.group(0)
val = codes_dict.get(emj, None)
val = codes_dict.get(emj)
if val is None:
return emj
if version is not None:
Expand Down

0 comments on commit 82be2e8

Please sign in to comment.