636ca9b5b655136fa12332654d73bc22c76108f6,interim_vision_patch.py,,,#,4
Before Change
with open(file_name, "r") as fr:
firstline = fr.readline()
if firstline != "from six.moves import urllib\n":
with open(dummy_file_name, "w") as fw:
fw.writelines(["from six.moves import urllib\n",
"opener = urllib.request.build_opener()\n",
"opener.addheaders = [("User-agent", "Mozilla/5.0")]\n",
"urllib.request.install_opener(opener)\n\n"])
fw.write(firstline)
for line in fr:
fw.write(line)
if os.path.exists(dummy_file_name):
os.remove(file_name)
os.rename(dummy_file_name, file_name)
After Change
file_name = mnist.__file__
dummy_file_name = os.path.join(os.path.dirname(file_name), "mnist_dummy.py")
with open(file_name, "r") as fr, open(dummy_file_name, "w") as fw:
origin_text = fr.read()
mnist_head = origin_text.find("class MNIST(")
reasource_head = origin_text.find("resources = [", mnist_head)
reasource_tail = origin_text.find("]\n", reasource_head)
top = origin_text[:reasource_head]
reasource = "resources = [("https://ossci-datasets.s3.amazonaws.com/mnist/train-images-idx3-ubyte.gz", "f68b3c2dcbeaaa9fbdd348bbdeb94873"),("https://ossci-datasets.s3.amazonaws.com/mnist/train-labels-idx1-ubyte.gz", "d53e105ee54ea40749a09fcbcd1e9432"),("https://ossci-datasets.s3.amazonaws.com/mnist/t10k-images-idx3-ubyte.gz", "9fb629c4189551a2d022fa330f9573f3"),("https://ossci-datasets.s3.amazonaws.com/mnist/t10k-labels-idx1-ubyte.gz", "ec29112dd5afa0611ce80d1b7f02629c")]\n"
bottom = origin_text[reasource_tail + 2:]
fw.write(top)
fw.write(reasource)
fw.write(bottom)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: microsoft/nni
Commit Name: 636ca9b5b655136fa12332654d73bc22c76108f6
Time: 2021-03-19
Author: 33053116+J-shang@users.noreply.github.com
File Name: interim_vision_patch.py
Class Name:
Method Name:
Project Name: OpenNMT/OpenNMT-py
Commit Name: bc1351d47d9fe83bc6c7830a8563ddb874953ed4
Time: 2019-01-09
Author: benzurdopeters@gmail.com
File Name: tools/extract_embeddings.py
Class Name:
Method Name: main
Project Name: microsoft/nni
Commit Name: 636ca9b5b655136fa12332654d73bc22c76108f6
Time: 2021-03-19
Author: 33053116+J-shang@users.noreply.github.com
File Name: interim_vision_patch.py
Class Name:
Method Name:
Project Name: tryolabs/luminoth
Commit Name: 35999e65a83c8b9f67b833623a5b9ce47af7cc71
Time: 2017-09-19
Author: javirey@gmail.com
File Name: luminoth/utils/training.py
Class Name:
Method Name: get_learning_rate