File tree 1 file changed +18
-9
lines changed
1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 4
4
import io
5
5
from itertools import starmap
6
6
from textwrap import dedent
7
- from typing import Callable , Dict
7
+ from typing import Any , Callable , Dict
8
8
9
9
# 3rd party
10
10
import pytest
13
13
# 3rd party
14
14
from emoji .unicode_codes .en import EMOJI_UNICODE_ENGLISH # type: ignore[import]
15
15
except ImportError :
16
- try :
17
- # 3rd party
18
- from emoji .unicode_codes import get_emoji_unicode_dict
19
- EMOJI_UNICODE_ENGLISH = get_emoji_unicode_dict ("en" )
20
- except ImportError :
21
- # 3rd party
22
- from emoji .unicode_codes import get_unicode_dict # type: ignore[attr-defined]
23
- EMOJI_UNICODE_ENGLISH = get_unicode_dict ("en" )
16
+ # 3rd party
17
+ from emoji .unicode_codes import EMOJI_DATA , LANGUAGES , STATUS
18
+
19
+ _EMOJI_UNICODE : Dict [str , Any ] = {lang : None for lang in LANGUAGES }
20
+
21
+ def get_emoji_unicode_dict (lang : str ) -> Dict :
22
+ if _EMOJI_UNICODE [lang ] is None :
23
+ _EMOJI_UNICODE [lang ] = {
24
+ data [lang ]: emj
25
+ for emj ,
26
+ data in EMOJI_DATA .items ()
27
+ if lang in data and data ["status" ] <= STATUS ["fully_qualified" ]
28
+ }
29
+
30
+ return _EMOJI_UNICODE [lang ]
31
+
32
+ EMOJI_UNICODE_ENGLISH = get_emoji_unicode_dict ("en" )
24
33
25
34
# this package
26
35
from emoji_strings import StreamReader , decode
You can’t perform that action at this time.
0 commit comments