diff --git a/plugin/constants.py b/plugin/constants.py index dc40b08..9374db5 100644 --- a/plugin/constants.py +++ b/plugin/constants.py @@ -4,6 +4,8 @@ import sublime +assert __package__ + PACKAGE_NAME = __package__.partition(".")[0] DB_FILE_IN_PACKAGE = f"Packages/{PACKAGE_NAME}/data/emoji-test.txt" diff --git a/plugin/emoji.py b/plugin/emoji.py index b3818fb..649f283 100644 --- a/plugin/emoji.py +++ b/plugin/emoji.py @@ -168,8 +168,8 @@ def from_dict(cls, db: dict[str, Any]) -> EmojiDatabase: def from_lines(cls, lines: Iterable[str]) -> EmojiDatabase: collection = cls() for line in lines: - if e := Emoji.from_line(line): - collection.emojis.append(e) + if emoji := Emoji.from_line(line): + collection.emojis.append(emoji) continue if m := cls._re_version.fullmatch(line): collection.version = m.group("version").strip() @@ -179,11 +179,12 @@ def from_lines(cls, lines: Iterable[str]) -> EmojiDatabase: continue return collection - def to_json(self, *, pretty: bool = False) -> str: + def to_json(self, *, pretty: bool = False, **kwargs: Any) -> str: + kwargs = kwargs.copy() if pretty: - kwargs: dict[str, Any] = {"indent": "\t"} + kwargs["indent"] = "\t" else: - kwargs = {"separators": (",", ":")} + kwargs["separators"] = (",", ":") return json.dumps( dict(asdict(self), generator_revision=DB_GENERATOR_REVISION), ensure_ascii=False,