Studio: tidy redirect handler signature and align test import (PR #5886)

This commit is contained in:
Daniel Han 2026-05-31 07:36:02 +00:00
commit bbec4f6deb
2 changed files with 5 additions and 2 deletions

View file

@ -1150,7 +1150,8 @@ def _resolve_latest_release_tag_via_redirect(repo: str) -> str | None:
"""
class _NoFollowRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, *args, **kwargs): # type: ignore[override]
def redirect_request(self, req, fp, code, msg, headers, newurl):
# Never follow the redirect; read the tag from the 3xx Location.
return None
url = f"https://github.com/{repo}/releases/latest"

View file

@ -16,9 +16,11 @@ STUDIO_DIR = ROOT / "studio"
if str(STUDIO_DIR) not in sys.path:
sys.path.insert(0, str(STUDIO_DIR))
import install_llama_prebuilt as MOD # noqa: E402
import install_llama_prebuilt as INSTALL_LLAMA_PREBUILT # noqa: E402
from install_llama_prebuilt import HostInfo # noqa: E402
MOD = INSTALL_LLAMA_PREBUILT
def _host(**overrides) -> HostInfo:
base = dict(