emoji: Import modules relative to ZULIP_PATH.

Newer mypy is less confused this way.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-12-04 01:59:47 -08:00 committed by Tim Abbott
parent 84bdd6371d
commit c850a006d9
4 changed files with 18 additions and 15 deletions

View File

@ -3,7 +3,7 @@ line-length = 100
target-version = ["py38"]
[tool.isort]
src_paths = [".", "tools", "tools/setup/emoji"]
src_paths = [".", "tools"]
known_third_party = "zulip"
profile = "black"
line_length = 100
@ -127,7 +127,7 @@ ignore = [
"N806", # Variable in function should be lowercase
]
line-length = 100
src = [".", "tools", "tools/setup/emoji"]
src = [".", "tools"]
target-version = "py38"
[tool.ruff.isort]

View File

@ -9,8 +9,12 @@ from typing import Any, Dict, Iterator, List, Optional, Sequence
import orjson
from emoji_names import EMOJI_NAME_MAPS
from emoji_setup_utils import (
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../")
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_tools import generate_sha1sum_emoji, run_as_root
from tools.setup.emoji.emoji_names import EMOJI_NAME_MAPS
from tools.setup.emoji.emoji_setup_utils import (
EMOTICON_CONVERSIONS,
REMAPPED_EMOJIS,
emoji_names_for_picker,
@ -21,11 +25,6 @@ from emoji_setup_utils import (
get_emoji_code,
)
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../")
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_tools import generate_sha1sum_emoji, run_as_root
TARGET_EMOJI_DUMP = os.path.join(ZULIP_PATH, "static", "generated", "emoji")
TARGET_EMOJI_STYLES = os.path.join(ZULIP_PATH, "static", "generated", "emoji-styles")
EMOJI_CACHE_PATH = "/srv/zulip-emoji-cache"

View File

@ -6,11 +6,12 @@ from collections import defaultdict
import orjson
from custom_emoji_names import CUSTOM_EMOJI_NAME_MAPS
from emoji_setup_utils import get_emoji_code
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../")
sys.path.append(ZULIP_PATH)
from tools.setup.emoji.custom_emoji_names import CUSTOM_EMOJI_NAME_MAPS
from tools.setup.emoji.emoji_setup_utils import get_emoji_code
CLDR_DATA_FILE = os.path.join(
ZULIP_PATH, "node_modules", "cldr-annotations-modern", "annotations", "en", "annotations.json"
)

View File

@ -6,15 +6,18 @@
# sources' decisions about what names to provide to each Unicode
# codepoint.
import os
import sys
from typing import Any, Dict, List
import orjson
from emoji_names import EMOJI_NAME_MAPS
from emoji_setup_utils import EMOJISETS, emoji_is_universal, get_emoji_code
TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ZULIP_PATH = os.path.dirname(TOOLS_DIR)
sys.path.append(ZULIP_PATH)
from tools.setup.emoji.emoji_names import EMOJI_NAME_MAPS
from tools.setup.emoji.emoji_setup_utils import EMOJISETS, emoji_is_universal, get_emoji_code
UNIFIED_REACTIONS_FILE = os.path.join(
ZULIP_PATH, "zerver", "management", "data", "unified_reactions.json"
)