From 1a803aa05f2daa6198c46eb2f45c377e2a5c57ed Mon Sep 17 00:00:00 2001 From: JnyRoad Date: Wed, 26 Aug 2026 18:54:06 -0700 Subject: [PATCH] fix(backend): suppress E402 for intentionally-late MLX imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backend/backends/mlx_backend.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/backends/mlx_backend.py b/backend/backends/mlx_backend.py index 84b9b620..ad287bca 100644 --- a/backend/backends/mlx_backend.py +++ b/backend/backends/mlx_backend.py @@ -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: