1e94a451d3ce0d205dff8940facab2805a60dfb0,kur/utils/network.py,,do_download,#Any#Any#,47

Before Change


	
	response = requests.get(url, stream=True)
	with open(target, "wb") as fh:
		for chunk in tqdm.tqdm(
			response.iter_content(),
			total=int(response.headers["content-length"]),
			unit="bytes",
			unit_scale=True,
			desc="Downloading"
		):
			fh.write(chunk)

	logger.info("File downloaded: %s", target)

After Change


	
	response = urllib.request.urlopen(url)
	with open(target, "wb") as fh:
		with tqdm.tqdm(
			total=int(response.info().get("Content-Length")),
			unit="bytes",
			unit_scale=True,
			desc="Downloading"
		) as pbar:
			while True:
				chunk = response.read(8192)
				if not chunk:
					break
				fh.write(chunk)
				pbar.update(len(chunk))

	logger.info("File downloaded: %s", target)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
def download_file(url, sha256=None, target_dir=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: deepgram/kur
Commit Name: 1e94a451d3ce0d205dff8940facab2805a60dfb0
Time: 2017-01-09
Author: ajsyp@syptech.net
File Name: kur/utils/network.py
Class Name:
Method Name: do_download


Project Name: chartbeat-labs/textacy
Commit Name: f574b32a85ab89a3302a58287681b9aec2c484a0
Time: 2019-04-22
Author: burtdewilde@gmail.com
File Name: textacy/io/http.py
Class Name:
Method Name: write_http_stream


Project Name: theislab/scanpy
Commit Name: 37ef2c69f22a6e2d1232782dd3e192a003731a75
Time: 2020-11-25
Author: michal.klein@protonmail.com
File Name: scanpy/readwrite.py
Class Name:
Method Name: _download