From 26d205b9102c85256d60a8e3e09a402c34dcc46f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2026 06:47:19 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/llama_cpp.py | 1 - studio/backend/core/training/worker.py | 1 - studio/backend/tests/test_offline_gguf_cache_fallback.py | 5 +---- studio/backend/utils/utils.py | 2 -- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py index c9df5a4599..611184655e 100644 --- a/studio/backend/core/inference/llama_cpp.py +++ b/studio/backend/core/inference/llama_cpp.py @@ -589,7 +589,6 @@ def _hf_offline_if_unreachable_for(model_name): """ try: from utils.paths import is_local_path - if isinstance(model_name, str) and is_local_path(model_name): return contextlib.nullcontext() except Exception: diff --git a/studio/backend/core/training/worker.py b/studio/backend/core/training/worker.py index adca92d0cc..ac27750373 100644 --- a/studio/backend/core/training/worker.py +++ b/studio/backend/core/training/worker.py @@ -2358,7 +2358,6 @@ def run_training_process(*, event_queue: Any, stop_queue: Any, config: dict) -> # last the whole job, so only a connection failure counts: a momentary # 502/503 must not block every download for the rest of the run. from utils.transformers_version import hf_endpoint_unreachable - _offline = hf_endpoint_unreachable(gateway_errors_offline = False) except Exception: _offline = False diff --git a/studio/backend/tests/test_offline_gguf_cache_fallback.py b/studio/backend/tests/test_offline_gguf_cache_fallback.py index 80bcf82377..c2f8b3840e 100644 --- a/studio/backend/tests/test_offline_gguf_cache_fallback.py +++ b/studio/backend/tests/test_offline_gguf_cache_fallback.py @@ -1095,16 +1095,13 @@ class TestGuardSkipsLocalPaths: from core.inference.llama_cpp import _hf_offline_if_unreachable_for called: list = [] - monkeypatch.setattr( - "utils.utils.hf_unreachable", lambda *a, **k: called.append(1) or True - ) + monkeypatch.setattr("utils.utils.hf_unreachable", lambda *a, **k: called.append(1) or True) with _hf_offline_if_unreachable_for(str(tmp_path / "model.gguf")) as engaged: assert engaged is None # nullcontext yields None assert called == [], "probed the hub for a local path" def test_remote_id_still_guarded(self, monkeypatch, clean_offline_env): import core.inference.llama_cpp as lc - monkeypatch.setattr(lc, "_hf_unreachable", lambda: True) with lc._hf_offline_if_unreachable_for("unsloth/Qwen3.5-4B-GGUF") as engaged: assert engaged is True diff --git a/studio/backend/utils/utils.py b/studio/backend/utils/utils.py index 7e91307a02..db9bace997 100644 --- a/studio/backend/utils/utils.py +++ b/studio/backend/utils/utils.py @@ -47,7 +47,6 @@ def hf_endpoint_host() -> str: """Host of the configured endpoint; probing huggingface.co would misjudge a mirror.""" try: from urllib.parse import urlparse - return urlparse(hf_endpoint_url()).hostname or "huggingface.co" except Exception: return "huggingface.co" @@ -86,7 +85,6 @@ def dns_host_dead(host: str, timeout: float = 2.0) -> bool: def _probe() -> None: import socket as _socket - try: _socket.gethostbyname(host) result[0] = False