|
4 | 4 |
|
5 | 5 | from .conversion import unified_to_char |
6 | 6 | from .emoji_char import EmojiChar |
7 | | -from .replacement import replace_colons |
| 7 | +from .replacement import replace_colons, get_emoji_regex |
8 | 8 | from .search import all_doublebyte, find_by_shortname, find_by_name |
9 | 9 |
|
10 | 10 | # Read json data on module load to be cached |
11 | 11 | with open(path.join(path.dirname(__file__), 'data/emoji.json'), 'r') as full_data: |
12 | 12 | # Load and parse emoji data from json into EmojiChar objects |
13 | 13 | emoji_data = [EmojiChar(data_blob) for data_blob in json.loads(full_data.read())] # type: List[EmojiChar] |
14 | 14 |
|
15 | | - # Build a cached dictionary of short names for quicker access, short code keys are normalized with underscores |
16 | | - emoji_short_names = { |
17 | | - emoji.short_name.replace('-', '_'): emoji for emoji in emoji_data |
18 | | - } # type: Dict[str, EmojiChar] |
| 15 | +# Build a cached dictionary of short names for quicker access, short code keys are normalized with underscores |
| 16 | +emoji_short_names = { |
| 17 | + emoji.short_name.replace('-', '_'): emoji for emoji in emoji_data |
| 18 | +} # type: Dict[str, EmojiChar] |
19 | 19 |
|
20 | | - # Add other short names if they are not already used as a primary short name for an other emoji |
21 | | - for emoji in emoji_data: |
22 | | - for short_name in emoji.short_names: |
23 | | - if short_name not in emoji_short_names: |
24 | | - emoji_short_names[short_name] = emoji |
| 20 | +# Add other short names if they are not already used as a primary short name for an other emoji |
| 21 | +for emoji in emoji_data: |
| 22 | + for short_name in emoji.short_names: |
| 23 | + if short_name not in emoji_short_names: |
| 24 | + emoji_short_names[short_name] = emoji |
25 | 25 |
|
26 | 26 |
|
27 | | -__all__ = ['unified_to_char', 'EmojiChar', 'replace_colons', 'all_doublebyte', 'find_by_shortname', 'find_by_name', 'emoji_data', 'emoji_short_names'] |
| 27 | +__all__ = ['unified_to_char', 'EmojiChar', 'replace_colons', 'get_emoji_regex', |
| 28 | + 'all_doublebyte', 'find_by_shortname', 'find_by_name', 'emoji_data', 'emoji_short_names'] |
0 commit comments