[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 04:39:55 +00:00
commit b3ca10d04e
5 changed files with 9 additions and 7 deletions

View file

@ -561,7 +561,6 @@ def _hf_offline_if_unreachable():
force_ctx = None
try:
from utils.utils import force_hf_offline
force_ctx = force_hf_offline()
force_ctx.__enter__()
except Exception:

View file

@ -2368,7 +2368,6 @@ def run_training_process(*, event_queue: Any, stop_queue: Any, config: dict) ->
try:
from utils.transformers_version import hf_endpoint_unreachable
from utils.utils import hf_probe_disabled
if not hf_probe_disabled() and hf_endpoint_unreachable():
_result[0] = True
except Exception:

View file

@ -1163,7 +1163,9 @@ class TestLoadModelGuardIntegration(unittest.TestCase):
patch.object(self.route, "resolve_effective_chat_template_override", return_value = None),
patch.object(self.route, "get_inference_backend", return_value = inf),
patch.object(self.route, "get_llama_cpp_backend", return_value = llama),
patch.object(self.route, "_hf_offline_if_unreachable", lambda: contextlib.nullcontext()),
patch.object(
self.route, "_hf_offline_if_unreachable", lambda: contextlib.nullcontext()
),
patch.object(self.route.ModelConfig, "from_identifier", return_value = cfg),
_stub_guard_deps(training_active = True, decision = (False, info)),
):

View file

@ -977,7 +977,9 @@ class TestHfOfflineIfUnreachable:
assert did_set is False
assert "HF_HUB_OFFLINE" not in os.environ
def test_user_set_hf_hub_offline_is_preserved(self, dns, reachable, clean_offline_env, monkeypatch):
def test_user_set_hf_hub_offline_is_preserved(
self, dns, reachable, clean_offline_env, monkeypatch
):
# User explicitly set offline before launching Unsloth.
monkeypatch.setenv("HF_HUB_OFFLINE", "1")
dns.fail()
@ -987,7 +989,9 @@ class TestHfOfflineIfUnreachable:
# Helper must not pop a variable it did not set.
assert os.environ.get("HF_HUB_OFFLINE") == "1"
def test_user_set_transformers_offline_is_preserved(self, dns, reachable, clean_offline_env, monkeypatch):
def test_user_set_transformers_offline_is_preserved(
self, dns, reachable, clean_offline_env, monkeypatch
):
monkeypatch.setenv("TRANSFORMERS_OFFLINE", "1")
dns.fail()
with _hf_offline_if_unreachable():
@ -1021,7 +1025,6 @@ class TestHfUnreachableProbe:
def _patch_probe(self, monkeypatch, result, calls):
import utils.transformers_version as tv
def _probe(*_a, **_k):
calls.append(1)
if isinstance(result, Exception):

View file

@ -84,7 +84,6 @@ def hf_unreachable(timeout: int = 3) -> bool:
return cached[1]
try:
from utils.transformers_version import hf_endpoint_unreachable
unreachable = hf_endpoint_unreachable(timeout)
except Exception:
unreachable = False