Fix typing

This commit is contained in:
henryruhs 2023-07-15 16:55:20 +02:00
parent 25b4b6eecd
commit 98c28697b2
3 changed files with 6 additions and 8 deletions

View File

@ -11,5 +11,4 @@ onnxruntime==1.15.0
tensorflow==2.13.0
opennsfw2==0.10.2
protobuf==4.23.4
tqdm==4.65.0
types-urllib3==1.26.25.13
tqdm==4.65.0

View File

@ -19,5 +19,4 @@ tensorflow==2.13.0
opennsfw2==0.10.2
protobuf==4.23.4
tqdm==4.65.0
gfpgan==1.3.8
types-urllib3==1.26.25.13
gfpgan==1.3.8

View File

@ -5,7 +5,7 @@ import platform
import shutil
import ssl
import subprocess
import urllib
from urllib import request
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 = urllib.request.urlopen(url)
total = int(request.headers.get('Content-Length', 0))
__request__ = request.urlopen(url)
total = int(__request__.headers.get('Content-Length', 0))
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
urllib.request.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
__request__.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
def resolve_relative_path(path: str) -> str: