Skip to content

Commit

Permalink
replaced tqdm.wrapattr with rich.progress.wrap_file as per review…
Browse files Browse the repository at this point in the history
… comment
  • Loading branch information
telamonian committed Aug 23, 2024
1 parent 7970655 commit f896d07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions comfy_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
import shutil
import subprocess
import sys
from typing import Optional

import requests
from rich import print
from tqdm.auto import tqdm
from rich import print, progress
import typer

from comfy_cli.constants import DEFAULT_COMFY_WORKSPACE, OS, PROC
Expand Down Expand Up @@ -112,7 +110,7 @@ def download_progress(url: str, fname: PathLike, cwd: PathLike = ".", allow_redi

desc = "(Unknown total file size)" if fsize == 0 else ""
response.raw.read = functools.partial(response.raw.read, decode_content=True) # Decompress if needed
with tqdm.wrapattr(response.raw, "read", total=fsize, desc=desc) as response_raw:
with progress.wrap_file(response.raw, total=fsize, description=desc) as response_raw:
with fpath.open("wb") as f:
shutil.copyfileobj(response_raw, f)

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies = [
"requests",
"rich",
"tomlkit",
"tqdm",
"typer>=0.9.0",
"typing-extensions>=4.7.0",
"uv",
Expand Down

0 comments on commit f896d07

Please sign in to comment.