MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / http_get

Function http_get

bing_bert/pytorch_pretrained_bert/file_utils.py:153–162  ·  view source on GitHub ↗
(url: str, temp_file: IO)

Source from the content-addressed store, hash-verified

151
152
153def http_get(url: str, temp_file: IO) -> None:
154 req = requests.get(url, stream=True)
155 content_length = req.headers.get('Content-Length')
156 total = int(content_length) if content_length is not None else None
157 progress = tqdm(unit="B", total=total)
158 for chunk in req.iter_content(chunk_size=1024):
159 if chunk: # filter out keep-alive new chunks
160 progress.update(len(chunk))
161 temp_file.write(chunk)
162 progress.close()
163
164
165def get_from_cache(url: str, cache_dir: Union[str, Path] = None) -> str:

Callers 1

get_from_cacheFunction · 0.70

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected