Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 1a09f38

Browse files
[emoji] v3
1 parent 28d94a0 commit 1a09f38

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

emoji/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import re
66
import threading
77
import urllib.request
8-
from itertools import product
8+
import builtins
99
from locale import getdefaultlocale
1010
from pathlib import Path
1111

1212
from albert import *
1313

14-
md_iid = '2.3'
15-
md_version = "2.2"
14+
md_iid = "3.0"
15+
md_version = "3.0"
1616
md_name = "Emoji"
1717
md_description = "Find and copy emojis by name"
1818
md_license = "MIT"
@@ -24,7 +24,7 @@ class Plugin(PluginInstance, IndexQueryHandler):
2424

2525
def __init__(self):
2626
PluginInstance.__init__(self)
27-
IndexQueryHandler.__init__(self, self.id, self.name, self.description, defaultTrigger=':')
27+
IndexQueryHandler.__init__(self)
2828
self.thread = None
2929

3030
self._use_derived = self.readConfig('use_derived', bool)
@@ -35,6 +35,9 @@ def __del__(self):
3535
if self.thread and self.thread.is_alive():
3636
self.thread.join()
3737

38+
def defaultTrigger(self):
39+
return ':'
40+
3841
@property
3942
def use_derived(self):
4043
return self._use_derived
@@ -69,7 +72,7 @@ def download_file(url: str, path: Path):
6972
with urllib.request.urlopen(request, timeout=3) as response:
7073
if response.getcode() == 200:
7174
debug(f"Success. Storing to {path}.")
72-
with open(path, 'wb') as file:
75+
with builtins.open(path, 'wb') as file:
7376
file.write(response.read())
7477
else:
7578
raise RuntimeError(f"Failed to download {url}. Status code: {response.getcode()}")
@@ -157,8 +160,8 @@ def get_annotations(cache_path: Path, use_derived: bool) -> dict:
157160
json_derived = json.load(file_derived)['annotationsDerived']['annotations']
158161
return json_full | json_derived
159162

160-
emojis = get_fully_qualified_emojis(self.cacheLocation)
161-
annotations = get_annotations(self.cacheLocation, self.use_derived)
163+
emojis = get_fully_qualified_emojis(self.cacheLocation())
164+
annotations = get_annotations(self.cacheLocation(), self.use_derived)
162165

163166
def remove_redundancy(sentences):
164167
sets_of_words = [set(sentence.lower().split()) for sentence in sentences]
@@ -181,7 +184,7 @@ def remove_redundancy(sentences):
181184
non_rgi_emoji = emoji.replace('\uFE0F', '')
182185
ann = annotations[non_rgi_emoji]
183186
except KeyError as e:
184-
# debug(f"Found no translation for {e}. Emoji will not be available.")
187+
debug(f"Found no translation for {e}. Emoji will not be available.")
185188
continue
186189

187190
title = ann['tts'][0]

0 commit comments

Comments
 (0)