2c00aa18540df4ab4c3afeacd44b556b3ce90782,python/magent/utility.py,,download_file,#,208

Before Change


    //file = urllib2.urlopen(url)
    //with open(filename, "wb") as fout:
    //    fout.write(file.read())
    if platform.system() == "Darwin":
        os.system("curl -O %s "%s"" % (filename, url))
    else:
        os.system("wget -O %s "%s"" % (filename, url))

    print("download done!")


def download_model(url):

After Change


    import urllib2
    print("Download %s from %s..." % (filename, url))

    ret = os.system("wget -O %s "%s"" % (filename, url))

    if ret != 0:
        print("wget fails. Retry with python function. It may takes several miniuts...")
        raw = urllib2.urlopen(url)
        with open(filename, "wb") as fout:
            fout.write(raw.read())
    else:
        print("download done!")


def download_model(url):
    name = url.split("/")[-1]
    name = os.path.join("data", name)
    download_file(name, url)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: geek-ai/MAgent
Commit Name: 2c00aa18540df4ab4c3afeacd44b556b3ce90782
Time: 2017-12-01
Author: zhenglianmin96@163.com
File Name: python/magent/utility.py
Class Name:
Method Name: download_file


Project Name: Microsoft/MMdnn
Commit Name: fdeeaff5e452e257bf3a3dd76e25c81304cc4c98
Time: 2020-03-15
Author: linmajia@users.noreply.github.com
File Name: mmdnn/conversion/examples/tensorflow/vis_meta.py
Class Name:
Method Name: _main


Project Name: ultralytics/yolov3
Commit Name: 0bc1db58d82c2482bfac1e32a3a43cfd5a533da2
Time: 2021-01-10
Author: glenn.jocher@ultralytics.com
File Name: utils/google_utils.py
Class Name:
Method Name: attempt_download