MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / _downloadFile

Function _downloadFile

samples/python/downloader.py:87–100  ·  view source on GitHub ↗
(path, url)

Source from the content-addressed store, hash-verified

85 logger.info("Downloading data for %s", sample_data.sample)
86
87 def _downloadFile(path, url):
88 logger.info("Downloading %s from %s", path, url)
89 import requests
90
91 r = requests.get(url, stream=True, timeout=5)
92 size = int(r.headers.get("content-length", 0))
93 from tqdm import tqdm
94
95 progress_bar = tqdm(total=size, unit="iB", unit_scale=True)
96 with open(path, "wb") as fd:
97 for chunk in r.iter_content(chunk_size=1024):
98 progress_bar.update(len(chunk))
99 fd.write(chunk)
100 progress_bar.close()
101
102 allGood = True
103 for f in sample_data.files:

Callers 1

downloadFunction · 0.85

Calls 4

writeMethod · 0.80
infoMethod · 0.45
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected