MCPcopy Index your code
hub / github.com/ekalinin/nodeenv / _download_node_file

Function _download_node_file

nodeenv.py:597–610  ·  view source on GitHub ↗

Do multiple attempts to avoid incomplete data in case of unstable network

(node_url, n_attempt=3)

Source from the content-addressed store, hash-verified

595
596
597def _download_node_file(node_url, n_attempt=3):
598 """Do multiple attempts to avoid incomplete data in case
599 of unstable network"""
600 while n_attempt > 0:
601 try:
602 return io.BytesIO(urlopen(node_url).read())
603 except IncompleteRead as e:
604 logger.warning(
605 'Incomplete read while reading '
606 'from {} - {}'.format(node_url, e)
607 )
608 n_attempt -= 1
609 if n_attempt == 0:
610 raise e
611
612
613def download_node_src(node_url, src_dir, args):

Callers 1

download_node_srcFunction · 0.85

Calls 1

urlopenFunction · 0.85

Tested by

no test coverage detected