sidechainnet/utils/load.py
def _download(url, file_name):
    """Download a file at a given URL to a specified local file_name with shutil."""
    # File length can only be approximated from the resulting GET, unfortunately
    r = requests.get(url, stream=True)
    if 'Content-Length' in r.headers:
        file_len = int(r.headers['Content-Length'])
    elif 'X-Original-Content-Length' in r.headers:
        file_len = int(r.headers['X-Original-Content-Length'])
    else:
        file_len = 0
    r.raw.decode_content = True
    with open(file_name, 'wb') as f:
        _copyfileobj(r.raw, f, chunks=(file_len / (64. * 1024)))
    r.close()

    return file_name
Download a file at a given URL to a specified local file_name with shutil.
Download a file at a given URL to a specified local file_name with shutil.
Download a file at a given URL to a specified local file_name with shutil .
def _download(url, file_name):
    r = requests.get(url, stream=True)
    if 'Content-Length' in r.headers:
        file_len = int(r.headers['Content-Length'])
    elif 'X-Original-Content-Length' in r.headers:
        file_len = int(r.headers['X-Original-Content-Length'])
    else:
        file_len = 0
    r.raw.decode_content = True
    with open(file_name, 'wb') as f:
        _copyfileobj(r.raw, f, chunks=(file_len / (64. * 1024)))
    r.close()
    return file_name
def _download ( url , file_name ) : r = requests . get ( url , stream = True ) if 'Content-Length' in r . headers : file_len = int ( r . headers [ 'Content-Length' ] ) elif 'X-Original-Content-Length' in r . headers : file_len = int ( r . headers [ 'X-Original-Content-Length' ] ) else : file_len = 0 r . raw . decode_content = True with open ( file_name , 'wb' ) as f : _copyfileobj ( r . raw , f , chunks = ( file_len / ( 64. * 1024 ) ) ) r . close ( ) return file_name
Download a file at a given URL to a specified local file_name with shutil.
Download a file at a given URL to a specified local file_name with shutil .
"""Download a file at a given URL to a specified local file_name with shutil.""" # File length can only be approximated from the resulting GET, unfortunately
url
file_name