fix(backend): suppress E402 for intentionally-late MLX imports

CodeRabbit flagged that the imports touched in the previous commit
(TTSBackend, .base, ..utils.cache) trigger Ruff's E402 check because
they must come after patch_huggingface_hub_offline() /
ensure_original_qwen_config_cached() run — reordering them would
defeat the offline-patch-before-import guarantee the comment above
describes. Add narrow `# noqa: E402` to the four import statements
that intentionally follow those calls, without touching unrelated
pre-existing lint findings in the file.
This commit is contained in:
JnyRoad
2026-10-04 00:25:53 +00:00
committed by capy-ai-staging[bot]
parent 19f8f51408
commit 1a803aa05f
+4 -4
View File
@@ -27,19 +27,19 @@ def _run_on_mlx_thread(func, *args):
# PATCH: Import and apply offline patch BEFORE any huggingface_hub usage
# This prevents mlx_audio from making network requests when models are cached
from ..utils.hf_offline_patch import patch_huggingface_hub_offline, ensure_original_qwen_config_cached
from ..utils.hf_offline_patch import patch_huggingface_hub_offline, ensure_original_qwen_config_cached # noqa: E402
patch_huggingface_hub_offline()
ensure_original_qwen_config_cached()
from . import TTSBackend, STTBackend, LANGUAGE_CODE_TO_NAME, WHISPER_HF_REPOS
from .base import (
from . import TTSBackend, STTBackend, LANGUAGE_CODE_TO_NAME, WHISPER_HF_REPOS # noqa: E402
from .base import ( # noqa: E402
is_model_cached,
combine_voice_prompts as _combine_voice_prompts,
model_load_progress,
empty_mlx_cache,
)
from ..utils.cache import get_cache_key, get_cached_voice_prompt, cache_voice_prompt
from ..utils.cache import get_cache_key, get_cached_voice_prompt, cache_voice_prompt # noqa: E402
class MLXTTSBackend: