Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Jul 15, 2023
1 parent 98c2869 commit 9869b96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions roop/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import ssl
import subprocess
from urllib import request
import urllib
from pathlib import Path
from typing import List, Optional
from tqdm import tqdm
Expand Down Expand Up @@ -131,10 +131,10 @@ def conditional_download(download_directory_path: str, urls: List[str]) -> None:
for url in urls:
download_file_path = os.path.join(download_directory_path, os.path.basename(url))
if not os.path.exists(download_file_path):
__request__ = request.urlopen(url)
total = int(__request__.headers.get('Content-Length', 0))
request = urllib.request.urlopen(url) # type: ignore[attr-defined]
total = int(request.headers.get('Content-Length', 0))
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
__request__.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
urllib.request.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size)) # type: ignore[attr-defined]


def resolve_relative_path(path: str) -> str:
Expand Down

0 comments on commit 9869b96

Please sign in to comment.