Fix typing

This commit is contained in:
henryruhs 2023-07-15 17:02:08 +02:00
parent 98c28697b2
commit 9869b960c3

View File

@ -5,7 +5,7 @@ import platform
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: