Skip to content

Commit 08c5cc4

Browse files
authored
Merge pull request #313 from cvzi/branch-2.14.1
2 parents 3209717 + 75c263b commit 08c5cc4

19 files changed

+1273
-1251
lines changed

β€ŽCHANGES.mdβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
emoji
22
=====
33

4+
v2.14.1 (2025-01-10)
5+
-----
6+
* Use `importlib.resources` to load json files #311
7+
* Update translations to Unicode release-46-1
8+
49
v2.14.0 (2024-10-02)
510
-----
611
* Update to Unicode 16.0

β€ŽLICENSE.txtβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
New BSD License
22

3-
Copyright (c) 2014-2024, Taehoon Kim, Kevin Wurster
3+
Copyright (c) 2014-2025, Taehoon Kim, Kevin Wurster
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

β€Žemoji/__init__.pyβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
'LANGUAGES',
2222
]
2323

24-
__version__ = '2.14.0'
24+
__version__ = '2.14.1'
2525
__author__ = 'Taehoon Kim, Kevin Wurster'
2626
__email__ = '[email protected]'
2727
2828
__source__ = 'https://github.com/carpedm20/emoji/'
2929
__license__ = """
3030
New BSD License
3131
32-
Copyright (c) 2014-2024, Taehoon Kim, Kevin Wurster
32+
Copyright (c) 2014-2025, Taehoon Kim, Kevin Wurster
3333
All rights reserved.
3434
3535
Redistribution and use in source and binary forms, with or without

β€Žemoji/unicode_codes/__init__.pyβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import sys
2+
import importlib.resources
13
import json
24
from functools import lru_cache
3-
from pathlib import Path
45
from warnings import warn
56

6-
from typing import Optional, Dict, List, Any
7+
from typing import Any, BinaryIO, Dict, List, Optional
78

89
from emoji.unicode_codes.data_dict import STATUS, LANGUAGES
910

@@ -75,12 +76,18 @@ def __missing__(self, key: str) -> str:
7576
EMOJI_DATA: Dict[str, Dict[str, Any]]
7677

7778

79+
def _open_file(name: str) -> BinaryIO:
80+
if sys.version_info >= (3, 9):
81+
return importlib.resources.files('emoji.unicode_codes').joinpath(name).open('rb')
82+
else:
83+
return importlib.resources.open_binary('emoji.unicode_codes', name)
84+
85+
7886
def _load_default_from_json():
7987
global EMOJI_DATA
8088
global _loaded_keys
8189

82-
file = Path(__file__).with_name('emoji.json')
83-
with open(file, 'rb') as f:
90+
with _open_file('emoji.json') as f:
8491
EMOJI_DATA = dict(json.load(f, object_pairs_hook=EmojiDataDict)) # type: ignore
8592
_loaded_keys = list(_DEFAULT_KEYS)
8693

@@ -94,8 +101,7 @@ def load_from_json(key: str):
94101
if key not in LANGUAGES:
95102
raise NotImplementedError('Language not supported', key)
96103

97-
file = Path(__file__).with_name(f'emoji_{key}.json')
98-
with open(file, 'rb') as f:
104+
with _open_file(f'emoji_{key}.json') as f:
99105
for emj, value in json.load(f).items():
100106
EMOJI_DATA[emj][key] = value # type: ignore
101107

β€Žemoji/unicode_codes/emoji.jsonβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,8 @@
16751675
"πŸ‡¨πŸ‡Ά": {
16761676
"en": ":Sark:",
16771677
"status": 2,
1678-
"E": 16
1678+
"E": 16,
1679+
"alias": [":flag_for_Sark:"]
16791680
},
16801681
"πŸ‡ΈπŸ‡¦": {
16811682
"en": ":Saudi_Arabia:",

β€Žemoji/unicode_codes/emoji_ar.jsonβ€Ž

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

β€Žemoji/unicode_codes/emoji_de.jsonβ€Ž

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

β€Žemoji/unicode_codes/emoji_es.jsonβ€Ž

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

β€Žemoji/unicode_codes/emoji_fa.jsonβ€Ž

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

β€Žemoji/unicode_codes/emoji_fr.jsonβ€Ž

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
Β (0)