Skip to content

Commit 7ccac76

Browse files
committed
refactor: tidy codes
Signed-off-by: Jack Cherng <[email protected]>
1 parent 0efd622 commit 7ccac76

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

plugin/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import sublime
66

7+
assert __package__
8+
79
PACKAGE_NAME = __package__.partition(".")[0]
810

911
DB_FILE_IN_PACKAGE = f"Packages/{PACKAGE_NAME}/data/emoji-test.txt"

plugin/emoji.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def from_dict(cls, db: dict[str, Any]) -> EmojiDatabase:
168168
def from_lines(cls, lines: Iterable[str]) -> EmojiDatabase:
169169
collection = cls()
170170
for line in lines:
171-
if e := Emoji.from_line(line):
172-
collection.emojis.append(e)
171+
if emoji := Emoji.from_line(line):
172+
collection.emojis.append(emoji)
173173
continue
174174
if m := cls._re_version.fullmatch(line):
175175
collection.version = m.group("version").strip()
@@ -179,11 +179,11 @@ def from_lines(cls, lines: Iterable[str]) -> EmojiDatabase:
179179
continue
180180
return collection
181181

182-
def to_json(self, *, pretty: bool = False) -> str:
182+
def to_json(self, *, pretty: bool = False, **kwargs: Any) -> str:
183183
if pretty:
184-
kwargs: dict[str, Any] = {"indent": "\t"}
184+
kwargs["indent"] = "\t"
185185
else:
186-
kwargs = {"separators": (",", ":")}
186+
kwargs["separators"] = (",", ":")
187187
return json.dumps(
188188
dict(asdict(self), generator_revision=DB_GENERATOR_REVISION),
189189
ensure_ascii=False,

0 commit comments

Comments
 (0)