[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-07-29 06:47:19 +00:00
commit 26d205b910
4 changed files with 1 additions and 8 deletions

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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