[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
6c8b0d146e
commit
7be5ec4fdd
1 changed files with 7 additions and 1 deletions
|
|
@ -140,10 +140,16 @@ def _locate_sd_cli(root: Path) -> Optional[Path]:
|
|||
return None
|
||||
|
||||
|
||||
def _download(url: str, dest: Path, *, timeout: float = 300.0) -> None:
|
||||
def _download(
|
||||
url: str,
|
||||
dest: Path,
|
||||
*,
|
||||
timeout: float = 300.0,
|
||||
) -> None:
|
||||
"""Stream ``url`` to ``dest`` with an explicit timeout. ``urlretrieve`` takes no
|
||||
timeout and can hang forever on a stalled socket."""
|
||||
import shutil
|
||||
|
||||
req = urllib.request.Request(url, headers = {"User-Agent": "unsloth-sd-cpp-installer"})
|
||||
with urllib.request.urlopen(req, timeout = timeout) as resp, open(dest, "wb") as f: # noqa: S310
|
||||
shutil.copyfileobj(resp, f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue