diff --git a/roop/utilities.py b/roop/utilities.py index 7feb94eb6..875e9ca8b 100644 --- a/roop/utilities.py +++ b/roop/utilities.py @@ -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 @@ -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: