content
stringlengths
1
1.04M
input_ids
sequencelengths
1
774k
ratio_char_token
float64
0.38
22.9
token_count
int64
1
774k
import sys central_line = [] #-----------------------# if len(sys.argv) < 3: error("Usage: python metro.py [read file] [write file]") f = open(sys.argv[2],'w') f.write("<html><head><style>@font-face { font-family: KeepCalm; src: url(http://ff.static.1001fonts.net/k/e/keep-calm.regular.ttf); } html { overflow-x: hidden; } body { padding: 0px; margin: 0px; } .all-lines { position:absolute; top:0px; width:100%; left: 0; margin-left:-50%; /* half of the width */ } .ruler { position: absolute; left:0px; top:0px; width:100%; z-index: 2; } .line { width: 418px; } .major-right-line { position: absolute; left: calc(50% + 12px); } .major-left-line { position: absolute; left: calc(50% - 418px - 12px); } .center { margin-left: auto; margin-right: auto; } .left { float: left; } .right { float: right; } .red { background: red; } .red-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), red); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), red); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), red); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), red); /*Standard*/ } .pink { background: pink; } .pink-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), pink); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), pink); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), pink); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), pink); /*Standard*/ } .orange { background: orange; } .orange-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), orange); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), orange); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), orange); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), orange); /*Standard*/ } .black { background: black; } .black-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), black); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), black); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), black); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), black); /*Standard*/ } .gray { background: gray; } .gray-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), gray); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), gray); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), gray); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), gray); /*Standard*/ } .blue { background: blue; } .blue-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), blue); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), blue); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), blue); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), blue); /*Standard*/ } .green { background: green; } .green-fade { background: -webkit-linear-gradient(left,rgba(255,255,255,0), green); /*Safari 5.1-6*/ background: -o-linear-gradient(right,rgba(255,255,255,0), green); /*Opera 11.1-12*/ background: -moz-linear-gradient(right,rgba(255,255,255,0), green); /*Fx 3.6-15*/ background: linear-gradient(to right, rgba(255,255,255,0), green); /*Standard*/ } .gray-red-fade { background: -webkit-linear-gradient(gray, red); /*Safari 5.1-6*/ background: -o-linear-gradient(gray, red); /*Opera 11.1-12*/ background: -moz-linear-gradient( gray, red); /*Fx 3.6-15*/ background: linear-gradient( gray, red); /*Standard*/ } .red-blue-fade { background: -webkit-linear-gradient( red, blue); /*Safari 5.1-6*/ background: -o-linear-gradient( red, blue); /*Opera 11.1-12*/ background: -moz-linear-gradient( red, blue); /*Fx 3.6-15*/ background: linear-gradient( red, blue); /*Standard*/ } .white { background: white; } .full-circle { width: 50px; height: 50px; -moz-border-radius: 25px; -webkit-border-radius: 25px; border-radius: 25px; } .mid-circle { width: 25px; height: 25px; -moz-border-radius: 12.5px; -webkit-border-radius: 12.5px; border-radius: 12.5px; } .vertical-center { position: relative; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } div{ position: relative; font-family: KeepCalm; font-size: 92.5%; } .ruler-rectangle { width: 100%; height: 2px; margin-bottom:100px; } .rectangle { width: 12.5px; height: calc(100% + 20px); -webkit-transform: translateY(-10px); -ms-transform: translateY(-10px); transform: translateY(-10px); position: absolute; margin-left: auto; margin-right: auto; left: 0; right: 0; top:0px; z-index: -1; } .dotted-rectangle { width: 0px; border-right: 12.5px dotted; height: calc(100% + 20px); -webkit-transform: translateY(-10px); -ms-transform: translateY(-10px); transform: translateY(-10px); position: absolute; margin-left: auto; margin-right: auto; left: 0; right: 0; top:0px; z-index: -1; } .right-line { left: 25px; } .left-line { right: 25px; } .text { padding: 5px; padding-left: 10px; } .ruler-rotated { -ms-transform: translateY(-5px) translateX(25px) rotate(45deg); -webkit-transform: translateY(-5px) translateX(25px) rotate(45deg); transform: translateY(-5px) translateX(25px) rotate(45deg); } .rotated { -ms-transform: translateY(95px) translateX(15px) rotate(45deg); -webkit-transform: translateY(95px) translateX(15px) rotate(45deg); transform: translateY(95px) translateX(15px) rotate(45deg); width: calc(50% + 40px); padding: 5px; } .rotated-up { -ms-transform: translateY(-95px) translateX(-210px) rotate(45deg); -webkit-transform: translateY(-95px) translateX(-210px) rotate(45deg); transform: translateY(-90px) translateX(-205px) rotate(45deg); padding-left: 0px; width: calc(50% + 40px); } .rotated-junction { -ms-transform: translateY(85px) translateX(20px) rotate(45deg); -webkit-transform: translateY(85px) translateX(20px) rotate(45deg); transform: translateY(85px) translateX(20px) rotate(45deg); width: calc(50% + 40px); } .rotated-left { -ms-transform: translateY(85px) translateX(-40%) rotate(-45deg); -webkit-transform: translateY(85px) translateX(-40%) rotate(-45deg); transform: translateY(85px) translateX(-40%) rotate(-45deg); height: 12.5px; width: calc(1.414 * 50%); z-index: -2; } .rotated-left-up-solid { -ms-transform: translateY(-100px) translateX(-40%) rotate(45deg); -webkit-transform: translateY(-100px) translateX(-40%) rotate(45deg); transform: translateY(-100px) translateX(-40%) rotate(45deg); height: 12.5px; width: calc(1.414 * 50%); z-index: -2; } .rotated-right { -ms-transform: translateY(85px) translateX(40%) rotate(45deg); -webkit-transform: translateY(85px) translateX(40%) rotate(45deg); transform: translateY(85px) translateX(40%) rotate(45deg); height: 12.5px; width: calc(1.414 * 50%); z-index: -2; } .rotated-left-up { -ms-transform: translateY(-65px) translateX(-39%) rotate(45deg); -webkit-transform: translateY(-65px) translateX(-39%) rotate(45deg); transform: translateY(-65px) translateX(-39%) rotate(45deg); height: 12.5px; width: calc(50%); z-index: -2; } .rotated-left-down { -ms-transform: translateY(50px) translateX(-39%) rotate(-45deg); -webkit-transform: translateY(50px) translateX(-39%) rotate(-45deg); transform: translateY(50px) translateX(-39%) rotate(-45deg); height: 12.5px; width: calc(50%); z-index: -2; } .rotated-right-up { -ms-transform: translateY(-115px) translateX(39%) rotate(135deg); -webkit-transform: translateY(-115px) translateX(39%) rotate(135deg); transform: translateY(-115px) translateX(39%) rotate(135deg); height: 12.5px; width: calc(50%); z-index: -2; } .rotated-right-down { -ms-transform: translateY(50px) translateX(39%) rotate(225deg); -webkit-transform: translateY(50px) translateX(39%) rotate(225deg); transform: translateY(50px) translateX(39%) rotate(225deg); height: 12.5px; width: calc(50%); z-index: -2; } </style></head><body><div class='body center'>") f.write("<div class='ruler'>") line_count = 0 for i in range(0,3): central_line.append("-") with open(sys.argv[1], 'r+') as r: lines = r.readlines() i = 0 while i<len(lines): line = lines[i] if line[0] == '#': line_count+=1 if line_count == 1: f.write("</div>") f.write("<div class='all-lines center content'><div class='left line major-left-line'>") elif line_count == 2: f.write("</div>") f.write("<div class='right line major-right-line'>") for j in range(0,3): central_line[j] = "-" elif line_count == 3: f.write("</div>") f.write("<div class='center line' id='central-line'>") for j in range(0,3): central_line[j] = "-" elif line[0] == '>' or line[0] == '<': drawJunction(line, f) elif line[0] == '\"': try: createDescription(line.split('\"')[1], lines[i+1][0]=='>' or lines[i+2][0]=='>' or lines[i+3][0]=='>' or lines[i+4][0]=='>', f) except: createDescription(line.split('\"')[1], 0, f) if lines[i+1][0] == '<' and len(lines[i+1].split(":")) > 2 and lines[i+1].split(":")[2] == 'up\n': drawJunction(lines[i+1], f) i+=1 createStation(line, f) else: if line_count == 0: try: createRuler(line, f) except: error("Syntax for timeline bounds - [Beginning Year]:[End Year (can be decimal)]") else: drawLine(line, f) i+=1 f.write("</div></div></div>") f.write("</body></html>") f.close() print "Done..."
[ 11748, 25064, 198, 198, 31463, 62, 1370, 796, 17635, 628, 198, 198, 2, 19351, 6329, 2, 198, 361, 18896, 7, 17597, 13, 853, 85, 8, 1279, 513, 25, 198, 220, 220, 220, 4049, 7203, 28350, 25, 21015, 24536, 13, 9078, 685, 961, 2393, 60, 685, 13564, 2393, 60, 4943, 198, 198, 69, 796, 1280, 7, 17597, 13, 853, 85, 58, 17, 60, 4032, 86, 11537, 198, 69, 13, 13564, 7203, 27, 6494, 6927, 2256, 6927, 7635, 29, 31, 10331, 12, 2550, 1391, 10369, 12, 17989, 25, 9175, 9771, 76, 26, 12351, 25, 19016, 7, 4023, 1378, 487, 13, 12708, 13, 47705, 10331, 82, 13, 3262, 14, 74, 14, 68, 14, 14894, 12, 9948, 76, 13, 16338, 13, 926, 69, 1776, 1782, 27711, 1391, 30343, 12, 87, 25, 7104, 26, 1782, 1767, 1391, 24511, 25, 657, 8416, 26, 10330, 25, 657, 8416, 26, 1782, 764, 439, 12, 6615, 1391, 2292, 25, 48546, 26, 1353, 25, 15, 8416, 26, 9647, 25, 3064, 26525, 1364, 25, 657, 26, 10330, 12, 9464, 21912, 1120, 26525, 11900, 2063, 286, 262, 9647, 9466, 1782, 764, 81, 18173, 1391, 2292, 25, 4112, 26, 1364, 25, 15, 8416, 26, 1353, 25, 15, 8416, 26, 9647, 25, 3064, 26525, 1976, 12, 9630, 25, 362, 26, 1782, 764, 1370, 1391, 9647, 25, 45959, 8416, 26, 1782, 764, 22478, 12, 3506, 12, 1370, 1391, 2292, 25, 4112, 26, 1364, 25, 42302, 7, 1120, 4, 1343, 1105, 8416, 1776, 1782, 764, 22478, 12, 9464, 12, 1370, 1391, 2292, 25, 4112, 26, 1364, 25, 42302, 7, 1120, 4, 532, 45959, 8416, 532, 1105, 8416, 1776, 1782, 764, 16159, 1391, 10330, 12, 9464, 25, 8295, 26, 10330, 12, 3506, 25, 8295, 26, 1782, 764, 9464, 1391, 12178, 25, 1364, 26, 1782, 764, 3506, 1391, 12178, 25, 826, 26, 1782, 764, 445, 1391, 4469, 25, 2266, 26, 1782, 764, 445, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2266, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2266, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2266, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2266, 1776, 11900, 23615, 16208, 1782, 764, 79, 676, 1391, 4469, 25, 11398, 26, 1782, 764, 79, 676, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 11398, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 11398, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 11398, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 11398, 1776, 11900, 23615, 16208, 1782, 764, 43745, 1391, 4469, 25, 10912, 26, 1782, 764, 43745, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 10912, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 10912, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 10912, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 10912, 1776, 11900, 23615, 16208, 1782, 764, 13424, 1391, 4469, 25, 2042, 26, 1782, 764, 13424, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2042, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2042, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2042, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 2042, 1776, 11900, 23615, 16208, 1782, 764, 44605, 1391, 4469, 25, 12768, 26, 1782, 764, 44605, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 12768, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 12768, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 12768, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 12768, 1776, 11900, 23615, 16208, 1782, 764, 17585, 1391, 4469, 25, 4171, 26, 1782, 764, 17585, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4171, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4171, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4171, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4171, 1776, 11900, 23615, 16208, 1782, 764, 14809, 1391, 4469, 25, 4077, 26, 1782, 764, 14809, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 9464, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4077, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4077, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 3506, 11, 41345, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4077, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 1462, 826, 11, 48670, 7012, 7, 13381, 11, 13381, 11, 13381, 11, 15, 828, 4077, 1776, 11900, 23615, 16208, 1782, 764, 44605, 12, 445, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 44605, 11, 2266, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 44605, 11, 2266, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 12768, 11, 2266, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 12768, 11, 2266, 1776, 11900, 23615, 16208, 1782, 764, 445, 12, 17585, 12, 69, 671, 1391, 4469, 25, 532, 43648, 12, 29127, 12, 49607, 7, 2266, 11, 4171, 1776, 11900, 50, 1878, 2743, 642, 13, 16, 12, 21, 16208, 4469, 25, 532, 78, 12, 29127, 12, 49607, 7, 2266, 11, 4171, 1776, 11900, 18843, 64, 1367, 13, 16, 12, 1065, 16208, 4469, 25, 532, 5908, 89, 12, 29127, 12, 49607, 7, 2266, 11, 4171, 1776, 11900, 37, 87, 513, 13, 21, 12, 1314, 16208, 4469, 25, 14174, 12, 49607, 7, 2266, 11, 4171, 1776, 11900, 23615, 16208, 1782, 764, 11186, 1391, 4469, 25, 2330, 26, 1782, 764, 12853, 12, 45597, 1391, 9647, 25, 2026, 8416, 26, 6001, 25, 2026, 8416, 26, 532, 5908, 89, 12, 20192, 12, 42172, 25, 1679, 8416, 26, 532, 43648, 12, 20192, 12, 42172, 25, 1679, 8416, 26, 4865, 12, 42172, 25, 1679, 8416, 26, 1782, 764, 13602, 12, 45597, 1391, 9647, 25, 1679, 8416, 26, 6001, 25, 1679, 8416, 26, 532, 5908, 89, 12, 20192, 12, 42172, 25, 1105, 13, 20, 8416, 26, 532, 43648, 12, 20192, 12, 42172, 25, 1105, 13, 20, 8416, 26, 4865, 12, 42172, 25, 1105, 13, 20, 8416, 26, 1782, 764, 1851, 605, 12, 16159, 1391, 2292, 25, 3585, 26, 1353, 25, 2026, 26525, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 1120, 49563, 532, 907, 12, 35636, 25, 15772, 56, 32590, 1120, 49563, 6121, 25, 15772, 56, 32590, 1120, 49563, 1782, 2659, 90, 2292, 25, 3585, 26, 10369, 12, 17989, 25, 9175, 9771, 76, 26, 10369, 12, 7857, 25, 10190, 13, 20, 26525, 1782, 764, 81, 18173, 12, 2554, 9248, 1391, 9647, 25, 1802, 26525, 6001, 25, 362, 8416, 26, 10330, 12, 22487, 25, 3064, 8416, 26, 1782, 764, 2554, 9248, 1391, 9647, 25, 1105, 13, 20, 8416, 26, 6001, 25, 42302, 7, 3064, 4, 1343, 1160, 8416, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 940, 8416, 1776, 532, 907, 12, 35636, 25, 15772, 56, 32590, 940, 8416, 1776, 6121, 25, 15772, 56, 32590, 940, 8416, 1776, 2292, 25, 4112, 26, 10330, 12, 9464, 25, 8295, 26, 10330, 12, 3506, 25, 8295, 26, 1364, 25, 657, 26, 826, 25, 657, 26, 1353, 25, 15, 8416, 26, 1976, 12, 9630, 25, 532, 16, 26, 1782, 764, 67, 8426, 12, 2554, 9248, 1391, 9647, 25, 657, 8416, 26, 4865, 12, 3506, 25, 1105, 13, 20, 8416, 38745, 26, 6001, 25, 42302, 7, 3064, 4, 1343, 1160, 8416, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 940, 8416, 1776, 532, 907, 12, 35636, 25, 15772, 56, 32590, 940, 8416, 1776, 6121, 25, 15772, 56, 32590, 940, 8416, 1776, 2292, 25, 4112, 26, 10330, 12, 9464, 25, 8295, 26, 10330, 12, 3506, 25, 8295, 26, 1364, 25, 657, 26, 826, 25, 657, 26, 1353, 25, 15, 8416, 26, 1976, 12, 9630, 25, 532, 16, 26, 1782, 764, 3506, 12, 1370, 1391, 1364, 25, 1679, 8416, 26, 1782, 764, 9464, 12, 1370, 1391, 826, 25, 1679, 8416, 26, 1782, 764, 5239, 1391, 24511, 25, 642, 8416, 26, 24511, 12, 9464, 25, 838, 8416, 26, 1782, 764, 81, 18173, 12, 10599, 515, 1391, 532, 907, 12, 35636, 25, 15772, 56, 32590, 20, 8416, 8, 15772, 55, 7, 1495, 8416, 8, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 20, 8416, 8, 15772, 55, 7, 1495, 8416, 8, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 32590, 20, 8416, 8, 15772, 55, 7, 1495, 8416, 8, 23064, 7, 2231, 13500, 1776, 1782, 764, 10599, 515, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 3865, 8416, 8, 15772, 55, 7, 1314, 8416, 8, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 3865, 8416, 8, 15772, 55, 7, 1314, 8416, 8, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 7, 3865, 8416, 8, 15772, 55, 7, 1314, 8416, 8, 23064, 7, 2231, 13500, 1776, 9647, 25, 42302, 7, 1120, 4, 1343, 2319, 8416, 1776, 24511, 25, 642, 8416, 26, 1782, 764, 10599, 515, 12, 929, 1391, 532, 907, 12, 35636, 25, 15772, 56, 32590, 3865, 8416, 8, 15772, 55, 32590, 21536, 8416, 8, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 3865, 8416, 8, 15772, 55, 32590, 21536, 8416, 8, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 32590, 3829, 8416, 8, 15772, 55, 32590, 21261, 8416, 8, 23064, 7, 2231, 13500, 1776, 24511, 12, 9464, 25, 657, 8416, 26, 9647, 25, 42302, 7, 1120, 4, 1343, 2319, 8416, 1776, 1782, 764, 10599, 515, 12, 73, 4575, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1238, 8416, 8, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1238, 8416, 8, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1238, 8416, 8, 23064, 7, 2231, 13500, 1776, 9647, 25, 42302, 7, 1120, 4, 1343, 2319, 8416, 1776, 1782, 764, 10599, 515, 12, 9464, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 32590, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 32590, 2231, 13500, 1776, 6121, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 32590, 2231, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 16, 13, 37309, 1635, 2026, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 9464, 12, 929, 12, 39390, 1391, 532, 907, 12, 35636, 25, 15772, 56, 32590, 3064, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 3064, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 32590, 3064, 8416, 8, 15772, 55, 32590, 1821, 4407, 23064, 7, 2231, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 16, 13, 37309, 1635, 2026, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 3506, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1821, 4407, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1821, 4407, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 7, 5332, 8416, 8, 15772, 55, 7, 1821, 4407, 23064, 7, 2231, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 16, 13, 37309, 1635, 2026, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 9464, 12, 929, 1391, 532, 907, 12, 35636, 25, 15772, 56, 32590, 2996, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 7, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 2996, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 7, 2231, 13500, 1776, 6121, 25, 15772, 56, 32590, 2996, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 7, 2231, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 1120, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 9464, 12, 2902, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 32590, 2231, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 32590, 2231, 13500, 1776, 6121, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 32590, 2670, 4407, 23064, 32590, 2231, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 1120, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 3506, 12, 929, 1391, 532, 907, 12, 35636, 25, 15772, 56, 32590, 15363, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 17059, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 32590, 15363, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 17059, 13500, 1776, 6121, 25, 15772, 56, 32590, 15363, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 17059, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 1120, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 764, 10599, 515, 12, 3506, 12, 2902, 1391, 532, 907, 12, 35636, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 18182, 13500, 1776, 532, 43648, 12, 35636, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 18182, 13500, 1776, 6121, 25, 15772, 56, 7, 1120, 8416, 8, 15772, 55, 7, 2670, 4407, 23064, 7, 18182, 13500, 1776, 6001, 25, 1105, 13, 20, 8416, 26, 9647, 25, 42302, 7, 1120, 49563, 1976, 12, 9630, 25, 532, 17, 26, 1782, 7359, 7635, 12240, 2256, 6927, 2618, 6927, 7146, 1398, 11639, 2618, 3641, 44167, 4943, 198, 69, 13, 13564, 7203, 27, 7146, 1398, 11639, 81, 18173, 44167, 4943, 198, 1370, 62, 9127, 796, 657, 198, 198, 1640, 1312, 287, 2837, 7, 15, 11, 18, 2599, 198, 220, 220, 220, 4318, 62, 1370, 13, 33295, 7203, 12, 4943, 198, 198, 4480, 1280, 7, 17597, 13, 853, 85, 58, 16, 4357, 705, 81, 10, 11537, 355, 374, 25, 198, 220, 220, 220, 3951, 796, 374, 13, 961, 6615, 3419, 198, 220, 220, 220, 1312, 796, 657, 198, 220, 220, 220, 981, 1312, 27, 11925, 7, 6615, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1627, 796, 3951, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1627, 58, 15, 60, 6624, 705, 2, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 62, 9127, 47932, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1627, 62, 9127, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 3556, 7146, 29, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 27, 7146, 1398, 11639, 439, 12, 6615, 3641, 2695, 6, 6927, 7146, 1398, 11639, 9464, 1627, 1688, 12, 9464, 12, 1370, 44167, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1627, 62, 9127, 6624, 362, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 3556, 7146, 29, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 27, 7146, 1398, 11639, 3506, 1627, 1688, 12, 3506, 12, 1370, 44167, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 2837, 7, 15, 11, 18, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4318, 62, 1370, 58, 73, 60, 796, 366, 21215, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1627, 62, 9127, 6624, 513, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 3556, 7146, 29, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 27, 7146, 1398, 11639, 16159, 1627, 6, 4686, 11639, 31463, 12, 1370, 44167, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 2837, 7, 15, 11, 18, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4318, 62, 1370, 58, 73, 60, 796, 366, 21215, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1627, 58, 15, 60, 6624, 705, 29, 6, 393, 1627, 58, 15, 60, 6624, 705, 27, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3197, 41, 4575, 7, 1370, 11, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1627, 58, 15, 60, 6624, 705, 7879, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2251, 11828, 7, 1370, 13, 35312, 10786, 7879, 11537, 58, 16, 4357, 3951, 58, 72, 10, 16, 7131, 15, 60, 855, 44167, 6, 393, 3951, 58, 72, 10, 17, 7131, 15, 60, 855, 44167, 6, 393, 3951, 58, 72, 10, 18, 7131, 15, 60, 855, 44167, 6, 393, 3951, 58, 72, 10, 19, 7131, 15, 60, 855, 44167, 3256, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2251, 11828, 7, 1370, 13, 35312, 10786, 7879, 11537, 58, 16, 4357, 657, 11, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 3951, 58, 72, 10, 16, 7131, 15, 60, 6624, 705, 27, 6, 290, 18896, 7, 6615, 58, 72, 10, 16, 4083, 35312, 7, 2404, 4008, 1875, 362, 290, 3951, 58, 72, 10, 16, 4083, 35312, 7, 2404, 38381, 17, 60, 6624, 705, 929, 59, 77, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3197, 41, 4575, 7, 6615, 58, 72, 10, 16, 4357, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1312, 47932, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2251, 12367, 7, 1370, 11, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1627, 62, 9127, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2251, 49, 18173, 7, 1370, 11, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 13940, 41641, 329, 15264, 22303, 532, 685, 45198, 6280, 5974, 58, 12915, 6280, 357, 5171, 307, 32465, 15437, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3197, 13949, 7, 1370, 11, 277, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1312, 47932, 16, 198, 198, 69, 13, 13564, 7203, 3556, 7146, 12240, 7146, 12240, 7146, 29, 4943, 198, 69, 13, 13564, 7203, 3556, 2618, 12240, 6494, 29, 4943, 198, 69, 13, 19836, 3419, 198, 4798, 366, 45677, 9313, 198 ]
2.539511
3,885
# Copyright (c) "Neo4j" # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. class Query: """ Create a new query. :param text: The query text. :type text: str :param metadata: metadata attached to the query. :type metadata: dict :param timeout: seconds. :type timeout: float or None """ def unit_of_work(metadata=None, timeout=None): """This function is a decorator for transaction functions that allows extra control over how the transaction is carried out. For example, a timeout may be applied:: @unit_of_work(timeout=100) def count_people_tx(tx): result = tx.run("MATCH (a:Person) RETURN count(a) AS persons") record = result.single() return record["persons"] :param metadata: a dictionary with metadata. Specified metadata will be attached to the executing transaction and visible in the output of ``dbms.listQueries`` and ``dbms.listTransactions`` procedures. It will also get logged to the ``query.log``. This functionality makes it easier to tag transactions and is equivalent to ``dbms.setTXMetaData`` procedure, see https://neo4j.com/docs/operations-manual/current/reference/procedures/ for procedure reference. :type metadata: dict :param timeout: the transaction timeout in seconds. Transactions that execute longer than the configured timeout will be terminated by the database. This functionality allows to limit query/transaction execution time. Specified timeout overrides the default timeout configured in the database using ``dbms.transaction.timeout`` setting. Value should not represent a negative duration. A zero duration will make the transaction execute indefinitely. None will use the default timeout configured in the database. :type timeout: float or None """ return wrapper
[ 2, 15069, 357, 66, 8, 366, 8199, 78, 19, 73, 1, 198, 2, 21227, 19, 73, 10710, 9564, 685, 4023, 1378, 710, 78, 19, 73, 13, 785, 60, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 21227, 19, 73, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 628, 198, 4871, 43301, 25, 198, 220, 220, 220, 37227, 13610, 257, 649, 12405, 13, 628, 220, 220, 220, 1058, 17143, 2420, 25, 383, 12405, 2420, 13, 198, 220, 220, 220, 1058, 4906, 2420, 25, 965, 198, 220, 220, 220, 1058, 17143, 20150, 25, 20150, 7223, 284, 262, 12405, 13, 198, 220, 220, 220, 1058, 4906, 20150, 25, 8633, 198, 220, 220, 220, 1058, 17143, 26827, 25, 4201, 13, 198, 220, 220, 220, 1058, 4906, 26827, 25, 12178, 393, 6045, 198, 220, 220, 220, 37227, 628, 198, 4299, 4326, 62, 1659, 62, 1818, 7, 38993, 28, 14202, 11, 26827, 28, 14202, 2599, 198, 220, 220, 220, 37227, 1212, 2163, 318, 257, 11705, 1352, 329, 8611, 5499, 326, 3578, 3131, 1630, 625, 703, 262, 8611, 318, 5281, 503, 13, 628, 220, 220, 220, 1114, 1672, 11, 257, 26827, 743, 307, 5625, 3712, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 20850, 62, 1659, 62, 1818, 7, 48678, 28, 3064, 8, 198, 220, 220, 220, 220, 220, 220, 220, 825, 954, 62, 15332, 62, 17602, 7, 17602, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1255, 796, 27765, 13, 5143, 7203, 44, 11417, 357, 64, 25, 15439, 8, 30826, 27064, 954, 7, 64, 8, 7054, 6506, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1700, 796, 1255, 13, 29762, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1700, 14692, 19276, 684, 8973, 628, 220, 220, 220, 1058, 17143, 20150, 25, 198, 220, 220, 220, 220, 220, 220, 220, 257, 22155, 351, 20150, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 1431, 20150, 481, 307, 7223, 284, 262, 23710, 8611, 290, 7424, 287, 262, 5072, 286, 7559, 9945, 907, 13, 4868, 4507, 10640, 15506, 290, 7559, 9945, 907, 13, 4868, 8291, 4658, 15506, 9021, 13, 198, 220, 220, 220, 220, 220, 220, 220, 632, 481, 635, 651, 18832, 284, 262, 7559, 22766, 13, 6404, 15506, 13, 198, 220, 220, 220, 220, 220, 220, 220, 770, 11244, 1838, 340, 4577, 284, 7621, 8945, 290, 318, 7548, 284, 7559, 9945, 907, 13, 2617, 29551, 48526, 6601, 15506, 8771, 11, 766, 3740, 1378, 710, 78, 19, 73, 13, 785, 14, 31628, 14, 3575, 602, 12, 805, 723, 14, 14421, 14, 35790, 14, 1676, 771, 942, 14, 329, 8771, 4941, 13, 198, 220, 220, 220, 1058, 4906, 20150, 25, 8633, 628, 220, 220, 220, 1058, 17143, 26827, 25, 198, 220, 220, 220, 220, 220, 220, 220, 262, 8611, 26827, 287, 4201, 13, 198, 220, 220, 220, 220, 220, 220, 220, 46192, 326, 12260, 2392, 621, 262, 17839, 26827, 481, 307, 23083, 416, 262, 6831, 13, 198, 220, 220, 220, 220, 220, 220, 220, 770, 11244, 3578, 284, 4179, 12405, 14, 7645, 2673, 9706, 640, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 1431, 26827, 23170, 1460, 262, 4277, 26827, 17839, 287, 262, 6831, 1262, 7559, 9945, 907, 13, 7645, 2673, 13, 48678, 15506, 4634, 13, 198, 220, 220, 220, 220, 220, 220, 220, 11052, 815, 407, 2380, 257, 4633, 9478, 13, 198, 220, 220, 220, 220, 220, 220, 220, 317, 6632, 9478, 481, 787, 262, 8611, 12260, 24391, 13, 198, 220, 220, 220, 220, 220, 220, 220, 6045, 481, 779, 262, 4277, 26827, 17839, 287, 262, 6831, 13, 198, 220, 220, 220, 1058, 4906, 26827, 25, 12178, 393, 6045, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 1441, 29908, 198 ]
3.269129
758
#!/usr/bin/env python # # NopSCADlib Copyright Chris Palmer 2018 # [email protected] # hydraraptor.blogspot.com # # This file is part of NopSCADlib. # # NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the # GNU General Public License as published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see <https://www.gnu.org/licenses/>. # # #! Sets the target configuration for multi-target projects that have variable configurations. # from __future__ import print_function source_dir = 'scad' import sys import os if __name__ == '__main__': args = len(sys.argv) if args == 2: set_config(sys.argv[1], usage) else: usage()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 198, 2, 399, 404, 6173, 2885, 8019, 15069, 5180, 18918, 2864, 198, 2, 299, 404, 13, 2256, 31, 14816, 13, 785, 198, 2, 2537, 7109, 283, 2373, 273, 13, 35217, 13, 785, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 399, 404, 6173, 2885, 8019, 13, 198, 2, 198, 2, 399, 404, 6173, 2885, 8019, 318, 1479, 3788, 25, 345, 460, 17678, 4163, 340, 290, 14, 273, 13096, 340, 739, 262, 2846, 286, 262, 198, 2, 22961, 3611, 5094, 13789, 355, 3199, 416, 262, 3232, 10442, 5693, 11, 2035, 2196, 513, 286, 198, 2, 262, 13789, 11, 393, 357, 265, 534, 3038, 8, 597, 1568, 2196, 13, 198, 2, 198, 2, 399, 404, 6173, 2885, 8019, 318, 9387, 287, 262, 2911, 326, 340, 481, 307, 4465, 11, 475, 42881, 15529, 34764, 56, 26, 198, 2, 1231, 772, 262, 17142, 18215, 286, 34482, 3398, 1565, 5603, 25382, 393, 376, 46144, 7473, 317, 16652, 2149, 37232, 33079, 48933, 13, 198, 2, 4091, 262, 22961, 3611, 5094, 13789, 329, 517, 3307, 13, 198, 2, 198, 2, 921, 815, 423, 2722, 257, 4866, 286, 262, 22961, 3611, 5094, 13789, 1863, 351, 399, 404, 6173, 2885, 8019, 13, 198, 2, 1002, 407, 11, 766, 1279, 5450, 1378, 2503, 13, 41791, 13, 2398, 14, 677, 4541, 15913, 13, 198, 2, 198, 198, 2, 198, 2, 0, 21394, 262, 2496, 8398, 329, 5021, 12, 16793, 4493, 326, 423, 7885, 25412, 13, 198, 2, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 198, 10459, 62, 15908, 796, 705, 1416, 324, 6, 198, 198, 11748, 25064, 198, 11748, 28686, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 26498, 796, 18896, 7, 17597, 13, 853, 85, 8, 198, 220, 220, 220, 611, 26498, 6624, 362, 25, 198, 220, 220, 220, 220, 220, 220, 900, 62, 11250, 7, 17597, 13, 853, 85, 58, 16, 4357, 8748, 8, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 8748, 3419, 198 ]
3.171014
345
# -*- coding: utf-8 -*- # @Time : 2021/03/13 17:31:29 # @Author : DannyDong # @File : RunTest.py # @Describe: 用例执行逻辑 from app.Utils import DataReceive # 测试执行类 # 处理前置条件 # 用例执行逻辑
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 7575, 220, 220, 220, 1058, 33448, 14, 3070, 14, 1485, 1596, 25, 3132, 25, 1959, 198, 2, 2488, 13838, 220, 1058, 15105, 35, 506, 198, 2, 2488, 8979, 220, 220, 220, 1058, 5660, 14402, 13, 9078, 198, 2, 2488, 24564, 4892, 25, 13328, 242, 101, 160, 122, 233, 33699, 100, 26193, 234, 34460, 119, 164, 122, 239, 198, 198, 6738, 598, 13, 18274, 4487, 1330, 6060, 3041, 15164, 628, 198, 2, 10545, 113, 233, 46237, 243, 33699, 100, 26193, 234, 163, 109, 119, 628, 220, 220, 220, 1303, 36469, 226, 49426, 228, 30298, 235, 163, 121, 106, 30266, 94, 20015, 114, 628, 220, 220, 220, 1303, 13328, 242, 101, 160, 122, 233, 33699, 100, 26193, 234, 34460, 119, 164, 122, 239, 198 ]
1.427536
138
from collections import OrderedDict __author__ = 'Joe'
[ 6738, 17268, 1330, 14230, 1068, 35, 713, 198, 198, 834, 9800, 834, 796, 705, 19585, 6, 628, 628, 198 ]
3.157895
19
with open('p081_matrix.txt') as f: content = f.readlines() print(content) clear_list = [] for i in range(0, len(content)): clear_list.append(content[i].strip().split(',')) for i in range(1,80): clear_list[0][i] = int(clear_list[0][i]) + int(clear_list[0][i-1]) for i in range(1,80): clear_list[i][0] = int(clear_list[i][0]) + int(clear_list[i-1][0]) for i in range(1, 80): for j in range(1, 80): if int(clear_list[i-1][j]) < int(clear_list[i][j-1]): clear_list[i][j] = int(clear_list[i][j]) + int(clear_list[i-1][j]) continue clear_list[i][j] = int(clear_list[i][j]) + int(clear_list[i][j-1]) print(clear_list[79][79])
[ 4480, 1280, 10786, 79, 2919, 16, 62, 6759, 8609, 13, 14116, 11537, 355, 277, 25, 198, 220, 220, 220, 2695, 796, 277, 13, 961, 6615, 3419, 198, 198, 4798, 7, 11299, 8, 198, 198, 20063, 62, 4868, 796, 17635, 198, 198, 1640, 1312, 287, 2837, 7, 15, 11, 18896, 7, 11299, 8, 2599, 198, 220, 220, 220, 1598, 62, 4868, 13, 33295, 7, 11299, 58, 72, 4083, 36311, 22446, 35312, 7, 41707, 4008, 198, 198, 1640, 1312, 287, 2837, 7, 16, 11, 1795, 2599, 198, 220, 220, 220, 1598, 62, 4868, 58, 15, 7131, 72, 60, 796, 493, 7, 20063, 62, 4868, 58, 15, 7131, 72, 12962, 1343, 493, 7, 20063, 62, 4868, 58, 15, 7131, 72, 12, 16, 12962, 198, 198, 1640, 1312, 287, 2837, 7, 16, 11, 1795, 2599, 198, 220, 220, 220, 1598, 62, 4868, 58, 72, 7131, 15, 60, 796, 493, 7, 20063, 62, 4868, 58, 72, 7131, 15, 12962, 1343, 493, 7, 20063, 62, 4868, 58, 72, 12, 16, 7131, 15, 12962, 198, 198, 1640, 1312, 287, 2837, 7, 16, 11, 4019, 2599, 198, 220, 220, 220, 329, 474, 287, 2837, 7, 16, 11, 4019, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 611, 493, 7, 20063, 62, 4868, 58, 72, 12, 16, 7131, 73, 12962, 1279, 493, 7, 20063, 62, 4868, 58, 72, 7131, 73, 12, 16, 60, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1598, 62, 4868, 58, 72, 7131, 73, 60, 796, 493, 7, 20063, 62, 4868, 58, 72, 7131, 73, 12962, 1343, 493, 7, 20063, 62, 4868, 58, 72, 12, 16, 7131, 73, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 1598, 62, 4868, 58, 72, 7131, 73, 60, 796, 493, 7, 20063, 62, 4868, 58, 72, 7131, 73, 12962, 1343, 493, 7, 20063, 62, 4868, 58, 72, 7131, 73, 12, 16, 12962, 198, 198, 4798, 7, 20063, 62, 4868, 58, 3720, 7131, 3720, 12962, 198 ]
2.041667
336
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import os from HTTPerror import HTTP404Error, HTTP302Error from server import static_setting import logging
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 628, 198, 11748, 33918, 198, 11748, 28686, 198, 6738, 7154, 51, 5990, 1472, 1330, 14626, 26429, 12331, 11, 14626, 22709, 12331, 198, 6738, 4382, 1330, 9037, 62, 33990, 198, 11748, 18931, 628, 628, 628, 198 ]
3.052632
57
from .label_smooth import LabelSmoothCrossEntropyLoss
[ 6738, 764, 18242, 62, 5796, 5226, 1330, 36052, 7556, 5226, 21544, 14539, 28338, 43, 793 ]
3.533333
15
from django.test import TestCase from views import translate_text # Create your tests here.
[ 6738, 42625, 14208, 13, 9288, 1330, 6208, 20448, 198, 6738, 5009, 1330, 15772, 62, 5239, 198, 198, 2, 13610, 534, 5254, 994, 13, 628, 628 ]
3.84
25
#!/usr/bin/env python # Copyright (C) 2014 Craig Phillips. All rights reserved. import unittest from libgsync.sync.file import SyncFile
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 15069, 357, 34, 8, 1946, 13854, 17630, 13, 220, 1439, 2489, 10395, 13, 198, 198, 11748, 555, 715, 395, 198, 6738, 9195, 70, 27261, 13, 27261, 13, 7753, 1330, 35908, 8979, 198 ]
3.232558
43
import json from datetime import timedelta from django.urls import reverse from django.utils import timezone from .. import test from ..models import Post, Thread from ..test import patch_category_acl from .test_threads_api import ThreadsApiTestCase
[ 11748, 33918, 198, 6738, 4818, 8079, 1330, 28805, 12514, 198, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 9575, 198, 6738, 42625, 14208, 13, 26791, 1330, 640, 11340, 198, 198, 6738, 11485, 1330, 1332, 198, 6738, 11485, 27530, 1330, 2947, 11, 14122, 198, 6738, 11485, 9288, 1330, 8529, 62, 22872, 62, 37779, 198, 6738, 764, 9288, 62, 16663, 82, 62, 15042, 1330, 14122, 82, 32, 14415, 14402, 20448, 628 ]
3.666667
69
import asyncio import json import logging import traceback from watchmen.collection.model.topic_event import TopicEvent from watchmen_boot.config.config import settings from watchmen.raw_data.service.import_raw_data import import_raw_topic_data log = logging.getLogger("app." + __name__) loop = asyncio.get_event_loop() kafka_topics = settings.KAFKA_TOPICS kafka_topics_list = kafka_topics.split(",")
[ 11748, 30351, 952, 198, 11748, 33918, 198, 11748, 18931, 198, 11748, 12854, 1891, 198, 198, 6738, 2342, 3653, 13, 43681, 13, 19849, 13, 26652, 62, 15596, 1330, 47373, 9237, 198, 6738, 2342, 3653, 62, 18769, 13, 11250, 13, 11250, 1330, 6460, 198, 6738, 2342, 3653, 13, 1831, 62, 7890, 13, 15271, 13, 11748, 62, 1831, 62, 7890, 1330, 1330, 62, 1831, 62, 26652, 62, 7890, 198, 198, 6404, 796, 18931, 13, 1136, 11187, 1362, 7203, 1324, 526, 1343, 11593, 3672, 834, 8, 198, 26268, 796, 30351, 952, 13, 1136, 62, 15596, 62, 26268, 3419, 198, 198, 74, 1878, 4914, 62, 4852, 873, 796, 6460, 13, 42, 8579, 25123, 62, 35222, 19505, 198, 74, 1878, 4914, 62, 4852, 873, 62, 4868, 796, 479, 1878, 4914, 62, 4852, 873, 13, 35312, 7, 2430, 8, 628 ]
3.045113
133
import random import sys """ This class represents a maze instance """ # Maze class itself # Represents single node in the maze
[ 11748, 4738, 198, 11748, 25064, 198, 198, 37811, 198, 1212, 1398, 6870, 257, 31237, 4554, 198, 37811, 628, 198, 2, 33412, 1398, 2346, 628, 198, 2, 1432, 6629, 2060, 10139, 287, 262, 31237, 198 ]
3.911765
34
from PyQt5.QtWidgets import QPushButton from hue import UnauthorizedUserError, GenericHueError
[ 6738, 9485, 48, 83, 20, 13, 48, 83, 54, 312, 11407, 1330, 1195, 49222, 21864, 198, 198, 6738, 37409, 1330, 791, 19721, 12982, 12331, 11, 42044, 39, 518, 12331, 198 ]
3.2
30
### RPGOnline ### A Synergy Studios Project import random # - GAME CLASSES - # class Game: """A class for a single game that stores all the other classes. For now, this refers to local-game only classes.""" class Shop: """A class to represent the shop, in which players can buy from.""" pass # - ENTITY CLASSES - # class Entity: """A class for every type of thing. Health: Health Left Moveset: Moves/Attacks to be used on other entites Seletced Attack: The selected Move/Attack you have Defence: Scale from 1 - 100, percentage of damage negated Agility: Speed of entity Effects Applied: Any effects on this entity """ def refresh_stats(self): """Refreshes the statistics (for save/load purposes)""" self.stats = [self.health, self.moveset, self.selected_attack, self.defence, self.agility, self.effects_applied] def defend_attack(self, entity_from, damage): """Defends an attack from another entity.""" print(f'Entity {entity_from.name} attacked!') defence = (self.defence / 100) total_damage = damage - (damage * defence) self.health = (self.health - total_damage) print(f'Lost {total_damage} hp!') class Hero(Entity): """A hero which is represented a character which has a skillset and is controlled by a player.""" def __init__(self, gametag, name, health, moveset, defence, agility, level) super().__init__(gametag, name, health, moveset, selected_attack, defence, agility, effects_applied) self.level = level def refresh_stats(self): """Refreshes the statistics (for save/load purposes)""" self.stats = [self.health, self.moveset, self.selected_attack, self.defence, self.agility, self.effects_applied, self.level] class Monster(Entity): """A monster which attacks heroes and has different moves.""" pass class NPC(Entity): """NPCs in which the players can interact with.""" def refresh_stats(self): """Refreshes the statistics (for save/load purposes)""" self.stats = [self.gametag, self.name, self.speech, self.stats] def play_speech(self): """Plays the speech of the NPC.""" pass # - MOVESET CLASSES - # class Move: """A move that an entity uses in a battle to affect other players.""" class Attack(Move): """A move which damages another entity. Name: The name of the attack Damage: Base damage points (HP) Crit Chance: 1/x chance that you get a boost Crit Boost: Damage boost applied when you get a crit Miss Chance: 1/x chance you miss """ def attack_entity(self, en, entity_from): """Attacks a particular entity.""" miss = random.randint(1, self.miss_chance) if miss < (self.miss_chance - 1): # If miss_chance = 5, chance = 1/5 crit = random.randint(1, self.crit_chance) if crit > (self.crit_chance - 1): # If crit_chance = 5, chance = 1/5 total_damage = self.damage + self.crit_buff print('Critical Hit!') else: total_damage = self.damage print('Hit!') en.defend_attack(entity_from, total_damage) # This entity defends it else: print('Missed Attack!') class Spell(Move): """A move that applies an effect to an entity.""" # - EFFECT CLASSES - # class Effect: """An effect which is applied onto an entity. Name: Name of effect """
[ 21017, 12909, 14439, 198, 21017, 317, 1632, 5877, 13799, 4935, 198, 198, 11748, 4738, 198, 198, 2, 532, 30517, 42715, 1546, 532, 1303, 198, 198, 4871, 3776, 25, 628, 220, 220, 220, 37227, 32, 1398, 329, 257, 2060, 983, 326, 7000, 477, 262, 584, 6097, 13, 198, 220, 220, 220, 220, 220, 220, 1114, 783, 11, 428, 10229, 284, 1957, 12, 6057, 691, 6097, 526, 15931, 198, 198, 4871, 13705, 25, 628, 220, 220, 220, 37227, 32, 1398, 284, 2380, 262, 6128, 11, 287, 543, 1938, 460, 2822, 422, 526, 15931, 628, 220, 220, 220, 1208, 198, 198, 2, 532, 47353, 9050, 42715, 1546, 532, 1303, 198, 198, 4871, 20885, 25, 628, 220, 220, 220, 37227, 32, 1398, 329, 790, 2099, 286, 1517, 13, 628, 220, 220, 220, 220, 220, 220, 3893, 25, 3893, 9578, 198, 220, 220, 220, 220, 220, 220, 38213, 316, 25, 38213, 14, 8086, 4595, 284, 307, 973, 319, 584, 920, 2737, 198, 220, 220, 220, 220, 220, 220, 1001, 1616, 771, 8307, 25, 383, 6163, 10028, 14, 27732, 345, 423, 198, 220, 220, 220, 220, 220, 220, 16721, 25, 21589, 422, 352, 532, 1802, 11, 5873, 286, 2465, 2469, 515, 198, 220, 220, 220, 220, 220, 220, 43406, 25, 8729, 286, 9312, 198, 220, 220, 220, 220, 220, 220, 17417, 27684, 25, 4377, 3048, 319, 428, 9312, 628, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 14976, 62, 34242, 7, 944, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 8134, 411, 956, 262, 7869, 357, 1640, 3613, 14, 2220, 4959, 8, 37811, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 34242, 796, 685, 944, 13, 13948, 11, 2116, 13, 76, 5241, 316, 11, 2116, 13, 34213, 62, 20358, 11, 2116, 13, 4299, 594, 11, 2116, 13, 363, 879, 11, 2116, 13, 34435, 62, 1324, 18511, 60, 628, 220, 220, 220, 825, 4404, 62, 20358, 7, 944, 11, 9312, 62, 6738, 11, 2465, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 7469, 2412, 281, 1368, 422, 1194, 9312, 526, 15931, 628, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 69, 6, 32398, 1391, 26858, 62, 6738, 13, 3672, 92, 7384, 0, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 9366, 796, 357, 944, 13, 4299, 594, 1220, 1802, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 28735, 796, 2465, 532, 357, 28735, 1635, 9366, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 13948, 796, 357, 944, 13, 13948, 532, 2472, 62, 28735, 8, 628, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 69, 6, 31042, 1391, 23350, 62, 28735, 92, 27673, 0, 11537, 198, 198, 4871, 8757, 7, 32398, 2599, 628, 220, 220, 220, 37227, 32, 4293, 543, 318, 7997, 257, 2095, 543, 468, 257, 4678, 316, 198, 220, 220, 220, 220, 220, 220, 290, 318, 6856, 416, 257, 2137, 526, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 9106, 316, 363, 11, 1438, 11, 1535, 11, 6100, 316, 11, 9366, 11, 33546, 11, 1241, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 28483, 316, 363, 11, 1438, 11, 1535, 11, 6100, 316, 11, 6163, 62, 20358, 11, 9366, 11, 33546, 11, 3048, 62, 1324, 18511, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 5715, 796, 1241, 628, 220, 220, 220, 825, 14976, 62, 34242, 7, 944, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 8134, 411, 956, 262, 7869, 357, 1640, 3613, 14, 2220, 4959, 8, 37811, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 34242, 796, 685, 944, 13, 13948, 11, 2116, 13, 76, 5241, 316, 11, 2116, 13, 34213, 62, 20358, 11, 2116, 13, 4299, 594, 11, 2116, 13, 363, 879, 11, 2116, 13, 34435, 62, 1324, 18511, 11, 2116, 13, 5715, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 4871, 12635, 7, 32398, 2599, 628, 220, 220, 220, 37227, 32, 9234, 543, 3434, 10281, 290, 468, 1180, 6100, 526, 15931, 628, 220, 220, 220, 1208, 628, 198, 4871, 15888, 7, 32398, 2599, 628, 220, 220, 220, 37227, 45, 5662, 82, 287, 543, 262, 1938, 460, 9427, 351, 526, 15931, 628, 220, 220, 220, 825, 14976, 62, 34242, 7, 944, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 8134, 411, 956, 262, 7869, 357, 1640, 3613, 14, 2220, 4959, 8, 37811, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 34242, 796, 685, 944, 13, 28483, 316, 363, 11, 2116, 13, 3672, 11, 2116, 13, 45862, 11, 2116, 13, 34242, 60, 628, 220, 220, 220, 825, 711, 62, 45862, 7, 944, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 3646, 592, 262, 4046, 286, 262, 15888, 526, 15931, 628, 220, 220, 220, 220, 220, 220, 220, 1208, 198, 198, 2, 532, 28184, 1546, 2767, 42715, 1546, 532, 1303, 198, 198, 4871, 10028, 25, 628, 220, 220, 220, 37227, 32, 1445, 326, 281, 9312, 3544, 287, 257, 3344, 284, 2689, 584, 1938, 526, 15931, 628, 198, 4871, 8307, 7, 21774, 2599, 628, 220, 220, 220, 37227, 32, 1445, 543, 12616, 1194, 9312, 13, 628, 220, 220, 220, 220, 220, 220, 6530, 25, 383, 1438, 286, 262, 1368, 198, 220, 220, 220, 220, 220, 220, 8995, 25, 7308, 2465, 2173, 357, 14082, 8, 198, 220, 220, 220, 220, 220, 220, 10056, 11809, 25, 352, 14, 87, 2863, 326, 345, 651, 257, 5750, 198, 220, 220, 220, 220, 220, 220, 10056, 19835, 25, 8995, 5750, 5625, 618, 345, 651, 257, 1955, 198, 220, 220, 220, 220, 220, 220, 4544, 11809, 25, 352, 14, 87, 2863, 345, 2051, 628, 220, 220, 220, 37227, 628, 198, 220, 220, 220, 825, 1368, 62, 26858, 7, 944, 11, 551, 11, 9312, 62, 6738, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 8086, 4595, 257, 1948, 9312, 526, 15931, 628, 220, 220, 220, 220, 220, 220, 220, 2051, 796, 4738, 13, 25192, 600, 7, 16, 11, 2116, 13, 3927, 62, 39486, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 2051, 1279, 357, 944, 13, 3927, 62, 39486, 532, 352, 2599, 1303, 1002, 2051, 62, 39486, 796, 642, 11, 2863, 796, 352, 14, 20, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1955, 796, 4738, 13, 25192, 600, 7, 16, 11, 2116, 13, 22213, 62, 39486, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1955, 1875, 357, 944, 13, 22213, 62, 39486, 532, 352, 2599, 1303, 1002, 1955, 62, 39486, 796, 642, 11, 2863, 796, 352, 14, 20, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 28735, 796, 2116, 13, 28735, 1343, 2116, 13, 22213, 62, 36873, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 41000, 7286, 0, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 28735, 796, 2116, 13, 28735, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 17889, 0, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 551, 13, 4299, 437, 62, 20358, 7, 26858, 62, 6738, 11, 2472, 62, 28735, 8, 1303, 770, 9312, 33446, 340, 628, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 17140, 276, 8307, 0, 11537, 198, 198, 4871, 11988, 7, 21774, 2599, 628, 220, 220, 220, 37227, 32, 1445, 326, 8991, 281, 1245, 284, 281, 9312, 526, 15931, 628, 628, 198, 2, 532, 33659, 9782, 42715, 1546, 532, 1303, 198, 198, 4871, 7896, 25, 628, 220, 220, 220, 37227, 2025, 1245, 543, 318, 5625, 4291, 281, 9312, 13, 628, 220, 220, 220, 220, 220, 220, 6530, 25, 6530, 286, 1245, 198, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 198 ]
2.643223
1,365
# home.py from .alarm import Alarm from .light import Light from .lock import Lock
[ 2, 1363, 13, 9078, 198, 198, 6738, 764, 282, 1670, 1330, 978, 1670, 198, 6738, 764, 2971, 1330, 4401, 198, 6738, 764, 5354, 1330, 13656 ]
3.32
25
from io import StringIO from typing import NamedTuple, List, Set, Tuple, Optional from sites import SELECTORS from preferences import URLS from selenium.webdriver import FirefoxProfile, FirefoxOptions, Firefox from selenium.common.exceptions import NoSuchElementException from notification import notify_about_home, notify_dev import re from helper import pipe import time import logging as log from preferences import SEEN_PATH, CRITERIA, make_field_transformers, SITES_TO_SCRAPE from hashlib import md5 from contextlib import contextmanager import sys class Home(NamedTuple): """ Store information about a home """ name: str area: int rooms: int rent: int address: str url: str def fingerprint(home: Home): """ Get 'unique' id for home Object :param home: defined Home object :return: md5 string """ return md5('{}{}{}{}{}{}'.format(home.name, home.area, home.rooms, home.rent, home.address, home.url) .encode('utf-8')).hexdigest() def show(name): """ Print out something in a pipeline without affecting the input """ return go class HomeSpider: """ Crawl home-search-engine websites """ def parse_page(self, page_results): """ Parse a home website :param page_results: list of page results :return: list of correctly parsed homes """ for result in page_results: fields = {} errors = [] try: for name, sel in self.selectors['fields'].items(): raw = self.extract(sel, result) if raw is None: errors.append('Failed to extract field "{}"'.format(name)) else: val = pipe(self.transformers[name], raw) if val is None: errors.append('Failed to transform field "{}" with input "{}"'.format(name, val)) else: fields[name] = val except Exception as e: errors.append('{}, {}'.format(type(e), e.args[0])) finally: if not errors: yield Home(**fields) else: fields, missing = self.fill_in_blank(fields) if missing: self.handle_parse_error(errors, result) else: yield Home(**fields) @contextmanager def get_and_wait(self, url, timeout=10): """ Get webpage and wait for it to load :param url: a url string :param timeout: timeout in seconds :return: None """ old_page = self.browser.page_source self.browser.get(url) for i in range(0, timeout): time.sleep(1) if self.browser.page_source != old_page: break if self.browser.page_source != old_page: yield else: log.error('Page Timeout', url) def crawl_next_page(self, next_url: Optional[str]) -> Tuple[List[Home], Optional[str]]: """ Crawl all urls :return: List of selfs """ if next_url: with self.get_and_wait(next_url): homes = list(self.parse_page(self.extract(self.selectors['results']))) next_url = self.extract(self.selectors['next-page']) return homes, next_url else: return [], None def extract(self, selector: str, web_el=None): """ Extract text or attribute content from html elements :param selector: css selector :param web_el: root html element or if none then the entire document is used :return: content string or list of content strings """ try: if not web_el: web_el = self.browser.find_element_by_tag_name('html') if '::' not in selector: return self.browser.find_elements_by_css_selector(selector) else: sub_sel, ext = selector.split('::') if ext == 'text': return web_el.find_element_by_css_selector(sub_sel).text elif ext == '*text': el_sel = web_el.find_elements_by_css_selector(sub_sel) fragments = filter(lambda x: x != '', map(lambda x: x.text.replace('\n',' ').strip(), el_sel)) return ' ** '.join(fragments) else: attr = re.search('attr\((.+)\)', ext) if attr: return web_el.find_element_by_css_selector(sub_sel).get_attribute(attr.group(1)) except NoSuchElementException: return None def fill_in_blank(self, fields): """ Fill in fields 'intelligently' :param fields: :return: filled in fields, missing fields """ _fields = fields.copy() missing = self.required - _fields.keys() # probably just a room for rent and not whole apartment if 'rooms' in missing and 'area' in fields and fields['area'] < 70: _fields['rooms'] = 1 if 'area' in missing and 'rooms' in fields and fields['rooms'] == 1: _fields['area'] = 30 missing = self.required - _fields.keys() return _fields, missing def handle_parse_error(self, errors, web_element): """ Log errors :param errors: list of error descriptions :param web_element: html element where error happened """ msg = '= PARSE ERROR =====\n' \ 'Site: {site}\n' \ 'Errors:\n\t - {errs}\n' \ '---- HTML ----\n' \ '{html}\n' \ '---- HTML END ----'.format( site=self.base_url, errs='\n\t - '.join(errors), html=web_element.get_attribute('innerHTML') ) log.error(msg + '\n') def main(): """ Run crawler """ logger = log.getLogger() logger.setLevel(log.INFO) logger.addHandler(log.StreamHandler(sys.stdout)) debugio = StringIO() logger.addHandler(log.StreamHandler(debugio)) with open(SEEN_PATH, 'r') as f: seen = set(f.read().splitlines()) # mutable! old_seen = seen.copy() for name in SITES_TO_SCRAPE: new_homes = crawl_website(name, seen) seen = seen.union(map(fingerprint, new_homes)) log.info('Found {} new homes'.format(len(new_homes))) for home in new_homes: if all(must(home) for must in CRITERIA): notify_about_home(home) with open(SEEN_PATH, 'a') as f: f.writelines(h + '\n' for h in (seen - old_seen)) logs = debugio.getvalue() if 'error' in logs.lower(): log.info('Informing developer about errors') notify_dev('Crawling Errors', logs) log.info('Bye!') if __name__ == '__main__': main()
[ 6738, 33245, 1330, 10903, 9399, 198, 6738, 19720, 1330, 34441, 51, 29291, 11, 7343, 11, 5345, 11, 309, 29291, 11, 32233, 198, 6738, 5043, 1330, 33493, 20673, 198, 6738, 15387, 1330, 37902, 6561, 198, 6738, 384, 11925, 1505, 13, 12384, 26230, 1330, 16802, 37046, 11, 16802, 29046, 11, 16802, 198, 6738, 384, 11925, 1505, 13, 11321, 13, 1069, 11755, 1330, 1400, 16678, 20180, 16922, 198, 6738, 14483, 1330, 19361, 62, 10755, 62, 11195, 11, 19361, 62, 7959, 198, 11748, 302, 198, 6738, 31904, 1330, 12656, 198, 11748, 640, 198, 11748, 18931, 355, 2604, 198, 6738, 15387, 1330, 7946, 1677, 62, 34219, 11, 8740, 2043, 1137, 3539, 11, 787, 62, 3245, 62, 35636, 364, 11, 311, 2043, 1546, 62, 10468, 62, 6173, 49, 45721, 198, 6738, 12234, 8019, 1330, 45243, 20, 198, 6738, 4732, 8019, 1330, 4732, 37153, 198, 11748, 25064, 628, 198, 4871, 5995, 7, 45, 2434, 51, 29291, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 9363, 1321, 546, 257, 1363, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1438, 25, 965, 198, 220, 220, 220, 1989, 25, 493, 198, 220, 220, 220, 9519, 25, 493, 198, 220, 220, 220, 5602, 25, 493, 198, 220, 220, 220, 2209, 25, 965, 198, 220, 220, 220, 19016, 25, 965, 628, 198, 4299, 25338, 7, 11195, 25, 5995, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 3497, 705, 34642, 6, 4686, 329, 1363, 9515, 198, 220, 220, 220, 1058, 17143, 1363, 25, 5447, 5995, 2134, 198, 220, 220, 220, 1058, 7783, 25, 45243, 20, 4731, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1441, 45243, 20, 10786, 90, 18477, 18477, 18477, 18477, 18477, 92, 4458, 18982, 7, 11195, 13, 3672, 11, 1363, 13, 20337, 11, 1363, 13, 9649, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1363, 13, 1156, 11, 1363, 13, 21975, 11, 1363, 13, 6371, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 268, 8189, 10786, 40477, 12, 23, 11537, 737, 33095, 12894, 395, 3419, 628, 198, 4299, 905, 7, 3672, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 12578, 503, 1223, 287, 257, 11523, 1231, 13891, 262, 5128, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1441, 467, 628, 198, 4871, 5995, 41294, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 327, 13132, 1363, 12, 12947, 12, 18392, 9293, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 21136, 62, 7700, 7, 944, 11, 2443, 62, 43420, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2547, 325, 257, 1363, 3052, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 2443, 62, 43420, 25, 1351, 286, 2443, 2482, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 1351, 286, 9380, 44267, 5682, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1255, 287, 2443, 62, 43420, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7032, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8563, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1438, 11, 384, 75, 287, 2116, 13, 19738, 669, 17816, 25747, 6, 4083, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8246, 796, 2116, 13, 2302, 974, 7, 741, 11, 1255, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 8246, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8563, 13, 33295, 10786, 37, 6255, 284, 7925, 2214, 45144, 36786, 4458, 18982, 7, 3672, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1188, 796, 12656, 7, 944, 13, 35636, 364, 58, 3672, 4357, 8246, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1188, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8563, 13, 33295, 10786, 37, 6255, 284, 6121, 2214, 45144, 36786, 351, 5128, 45144, 36786, 4458, 18982, 7, 3672, 11, 1188, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7032, 58, 3672, 60, 796, 1188, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2845, 35528, 355, 304, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8563, 13, 33295, 10786, 90, 5512, 23884, 4458, 18982, 7, 4906, 7, 68, 828, 304, 13, 22046, 58, 15, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3443, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 407, 8563, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7800, 5995, 7, 1174, 25747, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7032, 11, 4814, 796, 2116, 13, 20797, 62, 259, 62, 27190, 7, 25747, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 4814, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 28144, 62, 29572, 62, 18224, 7, 48277, 11, 1255, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7800, 5995, 7, 1174, 25747, 8, 628, 220, 220, 220, 2488, 22866, 37153, 198, 220, 220, 220, 825, 651, 62, 392, 62, 17077, 7, 944, 11, 19016, 11, 26827, 28, 940, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3497, 35699, 290, 4043, 329, 340, 284, 3440, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 19016, 25, 257, 19016, 4731, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 26827, 25, 26827, 287, 4201, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 6045, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1468, 62, 7700, 796, 2116, 13, 40259, 13, 7700, 62, 10459, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 40259, 13, 1136, 7, 6371, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 15, 11, 26827, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 640, 13, 42832, 7, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 40259, 13, 7700, 62, 10459, 14512, 1468, 62, 7700, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 628, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 40259, 13, 7700, 62, 10459, 14512, 1468, 62, 7700, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7800, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 9876, 3862, 448, 3256, 19016, 8, 628, 220, 220, 220, 825, 27318, 62, 19545, 62, 7700, 7, 944, 11, 1306, 62, 6371, 25, 32233, 58, 2536, 12962, 4613, 309, 29291, 58, 8053, 58, 16060, 4357, 32233, 58, 2536, 60, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 327, 13132, 477, 2956, 7278, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 7343, 286, 2116, 82, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1306, 62, 6371, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 2116, 13, 1136, 62, 392, 62, 17077, 7, 19545, 62, 6371, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5682, 796, 1351, 7, 944, 13, 29572, 62, 7700, 7, 944, 13, 2302, 974, 7, 944, 13, 19738, 669, 17816, 43420, 20520, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1306, 62, 6371, 796, 2116, 13, 2302, 974, 7, 944, 13, 19738, 669, 17816, 19545, 12, 7700, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 5682, 11, 1306, 62, 6371, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 685, 4357, 6045, 628, 220, 220, 220, 825, 7925, 7, 944, 11, 31870, 25, 965, 11, 3992, 62, 417, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29677, 2420, 393, 11688, 2695, 422, 27711, 4847, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 31870, 25, 269, 824, 31870, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 3992, 62, 417, 25, 6808, 27711, 5002, 393, 611, 4844, 788, 262, 2104, 3188, 318, 973, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 2695, 4731, 393, 1351, 286, 2695, 13042, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 407, 3992, 62, 417, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3992, 62, 417, 796, 2116, 13, 40259, 13, 19796, 62, 30854, 62, 1525, 62, 12985, 62, 3672, 10786, 6494, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 705, 3712, 6, 407, 287, 31870, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 40259, 13, 19796, 62, 68, 3639, 62, 1525, 62, 25471, 62, 19738, 273, 7, 19738, 273, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 850, 62, 741, 11, 1070, 796, 31870, 13, 35312, 10786, 3712, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1070, 6624, 705, 5239, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3992, 62, 417, 13, 19796, 62, 30854, 62, 1525, 62, 25471, 62, 19738, 273, 7, 7266, 62, 741, 737, 5239, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1070, 6624, 705, 9, 5239, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 62, 741, 796, 3992, 62, 417, 13, 19796, 62, 68, 3639, 62, 1525, 62, 25471, 62, 19738, 273, 7, 7266, 62, 741, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21441, 796, 8106, 7, 50033, 2124, 25, 2124, 14512, 705, 3256, 3975, 7, 50033, 2124, 25, 2124, 13, 5239, 13, 33491, 10786, 59, 77, 41707, 705, 737, 36311, 22784, 1288, 62, 741, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 705, 12429, 45302, 22179, 7, 8310, 363, 902, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 708, 81, 796, 302, 13, 12947, 10786, 35226, 59, 19510, 13, 10, 19415, 8, 3256, 1070, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 708, 81, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3992, 62, 417, 13, 19796, 62, 30854, 62, 1525, 62, 25471, 62, 19738, 273, 7, 7266, 62, 741, 737, 1136, 62, 42348, 7, 35226, 13, 8094, 7, 16, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 2845, 1400, 16678, 20180, 16922, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6045, 628, 220, 220, 220, 825, 6070, 62, 259, 62, 27190, 7, 944, 11, 7032, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 27845, 287, 7032, 705, 600, 2976, 1473, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 7032, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 5901, 287, 7032, 11, 4814, 7032, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 25747, 796, 7032, 13, 30073, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 4814, 796, 2116, 13, 35827, 532, 4808, 25747, 13, 13083, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 2192, 655, 257, 2119, 329, 5602, 290, 407, 2187, 7962, 198, 220, 220, 220, 220, 220, 220, 220, 611, 705, 9649, 6, 287, 4814, 290, 705, 20337, 6, 287, 7032, 290, 7032, 17816, 20337, 20520, 1279, 4317, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4808, 25747, 17816, 9649, 20520, 796, 352, 198, 220, 220, 220, 220, 220, 220, 220, 611, 705, 20337, 6, 287, 4814, 290, 705, 9649, 6, 287, 7032, 290, 7032, 17816, 9649, 20520, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4808, 25747, 17816, 20337, 20520, 796, 1542, 198, 220, 220, 220, 220, 220, 220, 220, 4814, 796, 2116, 13, 35827, 532, 4808, 25747, 13, 13083, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 25747, 11, 4814, 628, 220, 220, 220, 825, 5412, 62, 29572, 62, 18224, 7, 944, 11, 8563, 11, 3992, 62, 30854, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5972, 8563, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 8563, 25, 1351, 286, 4049, 16969, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 3992, 62, 30854, 25, 27711, 5002, 810, 4049, 3022, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 31456, 796, 705, 28, 29463, 5188, 33854, 29335, 59, 77, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 29123, 25, 1391, 15654, 32239, 77, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 9139, 5965, 7479, 77, 59, 83, 532, 1391, 263, 3808, 32239, 77, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 650, 11532, 13498, 59, 77, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 90, 6494, 32239, 77, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 650, 11532, 23578, 13498, 4458, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2524, 28, 944, 13, 8692, 62, 6371, 11, 1931, 3808, 11639, 59, 77, 59, 83, 532, 45302, 22179, 7, 48277, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 27711, 28, 12384, 62, 30854, 13, 1136, 62, 42348, 10786, 5083, 28656, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 628, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 7, 19662, 1343, 705, 59, 77, 11537, 628, 198, 198, 4299, 1388, 33529, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5660, 27784, 1754, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 49706, 796, 2604, 13, 1136, 11187, 1362, 3419, 198, 220, 220, 220, 49706, 13, 2617, 4971, 7, 6404, 13, 10778, 8, 198, 220, 220, 220, 49706, 13, 2860, 25060, 7, 6404, 13, 12124, 25060, 7, 17597, 13, 19282, 448, 4008, 198, 220, 220, 220, 14257, 952, 796, 10903, 9399, 3419, 198, 220, 220, 220, 49706, 13, 2860, 25060, 7, 6404, 13, 12124, 25060, 7, 24442, 952, 4008, 628, 220, 220, 220, 351, 1280, 7, 5188, 1677, 62, 34219, 11, 705, 81, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1775, 796, 900, 7, 69, 13, 961, 22446, 35312, 6615, 28955, 1303, 4517, 540, 0, 198, 220, 220, 220, 220, 220, 220, 220, 1468, 62, 15898, 796, 1775, 13, 30073, 3419, 628, 220, 220, 220, 329, 1438, 287, 311, 2043, 1546, 62, 10468, 62, 6173, 49, 45721, 25, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 71, 2586, 796, 27318, 62, 732, 12485, 7, 3672, 11, 1775, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1775, 796, 1775, 13, 24592, 7, 8899, 7, 35461, 4798, 11, 649, 62, 71, 2586, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 10951, 10786, 21077, 23884, 649, 5682, 4458, 18982, 7, 11925, 7, 3605, 62, 71, 2586, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1363, 287, 649, 62, 71, 2586, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 477, 7, 27238, 7, 11195, 8, 329, 1276, 287, 8740, 2043, 1137, 3539, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19361, 62, 10755, 62, 11195, 7, 11195, 8, 628, 220, 220, 220, 351, 1280, 7, 5188, 1677, 62, 34219, 11, 705, 64, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 277, 13, 8933, 20655, 7, 71, 1343, 705, 59, 77, 6, 329, 289, 287, 357, 15898, 532, 1468, 62, 15898, 4008, 628, 220, 220, 220, 17259, 796, 14257, 952, 13, 1136, 8367, 3419, 198, 220, 220, 220, 611, 705, 18224, 6, 287, 17259, 13, 21037, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 10951, 10786, 818, 15464, 8517, 546, 8563, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 19361, 62, 7959, 10786, 34, 18771, 44225, 3256, 17259, 8, 628, 220, 220, 220, 2604, 13, 10951, 10786, 3886, 68, 0, 11537, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 628, 198 ]
2.10095
3,368
import onnx import onnx.numpy_helper as numpy_helper import numpy as np # This function checks whether two onnx files (onnx_A and onnx_B) have the same underlying computational graph and operators.
[ 11748, 319, 77, 87, 198, 11748, 319, 77, 87, 13, 77, 32152, 62, 2978, 525, 355, 299, 32152, 62, 2978, 525, 198, 11748, 299, 32152, 355, 45941, 628, 198, 2, 770, 2163, 8794, 1771, 734, 319, 77, 87, 3696, 357, 261, 77, 87, 62, 32, 290, 319, 77, 87, 62, 33, 8, 423, 262, 976, 10238, 31350, 4823, 290, 12879, 13, 198 ]
3.225806
62
from model.contact import Contact testdata = [ Contact(firstname="qqqqqqqq", middlename="wwwwwww", nickname="eeefdeeee", title="vvvvvvvvvv", lastname="eeeeeeeee", company="xccccccccc", adress="ffcvcxvcvcxvxcvx", home="23144124214", mobile="45565656678", work="56678678678", fax="67867868686", email="[email protected]", email2="[email protected]", email3="[email protected]", homepage="http://wwwww.ru", byear="1985", ayear="2000", address2="sdfdsfsdfsdfsd", phone2="sdfsdfsdfsdfsdf", notes="sfsdfsdfdssdfsdfs"), Contact(firstname="f1", middlename="m1", nickname="n1", title="t1", lastname="l1", company="c1", adress="ffcvcxvcvcxvxcvx", home="23144124214", mobile="45565656678", work="56678678678", fax="67867868686", email="[email protected]", email2="[email protected]", email3="[email protected]", homepage="http://wwwww.ru", byear="1985", ayear="2000", address2="sdfdsfsdfsdfsd", phone2="sdfsdfsdfsdfsdf", notes="sfsdfsdfdssdfsdfs") ]
[ 6738, 2746, 13, 32057, 1330, 14039, 198, 198, 9288, 7890, 796, 685, 198, 220, 220, 220, 14039, 7, 11085, 3672, 2625, 38227, 38227, 38227, 38227, 1600, 285, 1638, 11925, 480, 2625, 1383, 1383, 2503, 1600, 21814, 2625, 1453, 891, 67, 41591, 1600, 3670, 2625, 25093, 25093, 25093, 25093, 25093, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 938, 3672, 2625, 41591, 41591, 68, 1600, 1664, 2625, 87, 535, 535, 535, 535, 66, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 512, 601, 2625, 487, 66, 28435, 87, 28435, 28435, 87, 85, 25306, 85, 87, 1600, 1363, 2625, 1954, 18444, 1065, 3682, 1415, 1600, 5175, 2625, 30505, 2996, 2996, 2791, 3695, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 670, 2625, 20, 2791, 3695, 30924, 30924, 1600, 35168, 2625, 30924, 30924, 3104, 33808, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3053, 2625, 86, 499, 31, 4529, 13, 622, 1600, 3053, 17, 2625, 83, 2118, 31, 4529, 13, 622, 1600, 3053, 18, 2625, 14261, 31, 4529, 13, 622, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34940, 2625, 4023, 1378, 1383, 2503, 13, 622, 1600, 416, 451, 2625, 29110, 1600, 257, 1941, 2625, 11024, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2209, 17, 2625, 82, 7568, 9310, 9501, 7568, 82, 7568, 21282, 1600, 3072, 17, 2625, 82, 7568, 82, 7568, 82, 7568, 82, 7568, 82, 7568, 1600, 4710, 2625, 82, 9501, 7568, 82, 7568, 67, 824, 7568, 82, 7568, 82, 12340, 198, 17829, 7, 11085, 3672, 2625, 69, 16, 1600, 285, 1638, 11925, 480, 2625, 76, 16, 1600, 21814, 2625, 77, 16, 1600, 3670, 2625, 83, 16, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 938, 3672, 2625, 75, 16, 1600, 1664, 2625, 66, 16, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 512, 601, 2625, 487, 66, 28435, 87, 28435, 28435, 87, 85, 25306, 85, 87, 1600, 1363, 2625, 1954, 18444, 1065, 3682, 1415, 1600, 5175, 2625, 30505, 2996, 2996, 2791, 3695, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 670, 2625, 20, 2791, 3695, 30924, 30924, 1600, 35168, 2625, 30924, 30924, 3104, 33808, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3053, 2625, 86, 499, 31, 4529, 13, 622, 1600, 3053, 17, 2625, 83, 2118, 31, 4529, 13, 622, 1600, 3053, 18, 2625, 14261, 31, 4529, 13, 622, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34940, 2625, 4023, 1378, 1383, 2503, 13, 622, 1600, 416, 451, 2625, 29110, 1600, 257, 1941, 2625, 11024, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2209, 17, 2625, 82, 7568, 9310, 9501, 7568, 82, 7568, 21282, 1600, 3072, 17, 2625, 82, 7568, 82, 7568, 82, 7568, 82, 7568, 82, 7568, 1600, 4710, 2625, 82, 9501, 7568, 82, 7568, 67, 824, 7568, 82, 7568, 82, 4943, 198, 60 ]
2.044574
516
#coding=utf-8 import sys import os from os.path import abspath, dirname sys.path.append(abspath(dirname(__file__))) import tkinter import tkinter.filedialog from tkinter import * import Fun ElementBGArray={} ElementBGArray_Resize={} ElementBGArray_IM={} from PyPDF2 import PdfFileReader, PdfFileWriter DirPath=""
[ 2, 66, 7656, 28, 40477, 12, 23, 198, 11748, 25064, 198, 11748, 28686, 198, 6738, 220, 220, 28686, 13, 6978, 1330, 2352, 6978, 11, 26672, 3672, 198, 17597, 13, 6978, 13, 33295, 7, 397, 2777, 776, 7, 15908, 3672, 7, 834, 7753, 834, 22305, 198, 11748, 256, 74, 3849, 198, 11748, 256, 74, 3849, 13, 69, 3902, 498, 519, 198, 6738, 220, 220, 256, 74, 3849, 1330, 1635, 198, 11748, 11138, 198, 20180, 40469, 19182, 34758, 92, 220, 220, 198, 20180, 40469, 19182, 62, 4965, 1096, 34758, 92, 220, 198, 20180, 40469, 19182, 62, 3955, 34758, 92, 220, 198, 6738, 9485, 20456, 17, 1330, 350, 7568, 8979, 33634, 11, 350, 7568, 8979, 34379, 198, 35277, 15235, 33151, 628 ]
2.728814
118
''' <실수 줄이기 메모> 소요 시간 30분(권장 20분 문제) 초기화 하는 과정(누산) 알고리즘을 잘 못 짜서 헤맸다. 쉬운 문제일수록, 집중해서 정확히 한번에 풀고 끝내자 ㅜㅜ! <답안 꿀팁> 1) python list.count(<<특정 값>>) 시간 복잡도 O(N) 근데 사실 내가 짠 코드가 한번 loop로 끝이니 더 빠르긴함. 다만 여유로우니 위 built-in 사용하면 코드가 깔끔함. 2) stages 1부터 차례로 실패율을 계산하면서, 전체 사람수를 줄여나감 fail = count / length length -= count 이렇게 하면 더 코드가 훨씬 간결하긴 함. 이런 걸 다음에는 바로 떠올려보자 ! <답안 메모> 문제 정의 따라 실수 없이 구현을 잘해주면 된다. 따라서 구현 문제로도 분류할 수 있지만, 문제 해결 과정에서 정렬 라이브러리가 효과적으로 사용되므로 정렬 문제로 분류함 전체 스테이지 개수가 200,000 이하이기 때문에, O(NlogN) 기본 정렬 라이브러리로 충분히 수행 가능함. ''' ''' <Answer> # 프로그래머스 실패율 def solution(N, stages): answer = [] length = len(stages) # 스테이지 번호를 1부터 N까지 증가시키며 for i in range(1, N+1): # 해당 스테이지에 머물러 있는 사람의 수 계산 count = stages.count() # 실패율 계산 if length == 0: fail = 0 else: fail = count / length # 리스트에 (스테이지 번호, 실패율) 원소 삽입 answer.append((i, fail)) length -= count # 실패율을 기준으로 각 스테이지를 내림차순 정렬 answer = sorted(answer, key=lambda t: t[1], reverse=True) # 정렬된 스테이지 번호 출력 answer = [i[0] for i in answer] return answer '''
[ 7061, 6, 198, 27, 168, 233, 97, 168, 230, 246, 23821, 97, 226, 35975, 112, 166, 116, 108, 31619, 102, 242, 167, 103, 101, 29, 198, 168, 228, 234, 168, 248, 242, 23821, 233, 250, 166, 108, 226, 1542, 167, 114, 226, 7, 166, 114, 234, 168, 252, 98, 1160, 167, 114, 226, 31619, 105, 116, 168, 254, 250, 8, 198, 198, 168, 112, 230, 166, 116, 108, 169, 247, 242, 220, 47991, 246, 167, 232, 242, 220, 166, 111, 120, 168, 254, 243, 7, 167, 230, 226, 168, 224, 108, 8, 23821, 243, 234, 166, 111, 254, 167, 99, 105, 168, 99, 246, 35975, 226, 23821, 252, 246, 31619, 103, 119, 23821, 100, 250, 168, 226, 250, 220, 169, 245, 97, 167, 100, 116, 46695, 97, 13, 198, 168, 231, 105, 168, 248, 112, 31619, 105, 116, 168, 254, 250, 35975, 120, 168, 230, 246, 167, 94, 251, 11, 23821, 100, 239, 168, 97, 239, 47991, 112, 168, 226, 250, 23821, 254, 243, 169, 247, 243, 169, 252, 230, 220, 47991, 250, 167, 110, 230, 168, 245, 238, 220, 169, 240, 222, 166, 111, 254, 31619, 223, 251, 167, 224, 112, 168, 252, 238, 220, 159, 227, 250, 159, 227, 250, 0, 198, 198, 27, 46695, 113, 168, 243, 230, 220, 166, 123, 222, 169, 234, 223, 29, 198, 16, 8, 21015, 1351, 13, 9127, 7, 16791, 169, 232, 117, 168, 254, 243, 220, 166, 108, 240, 4211, 8, 198, 168, 233, 250, 166, 108, 226, 31619, 111, 113, 168, 252, 94, 167, 237, 226, 440, 7, 45, 8, 198, 198, 166, 115, 120, 167, 235, 108, 23821, 8955, 168, 233, 97, 31619, 224, 112, 166, 108, 222, 23821, 100, 254, 23821, 121, 242, 167, 241, 250, 166, 108, 222, 220, 47991, 250, 167, 110, 230, 9052, 167, 94, 250, 31619, 223, 251, 35975, 112, 46695, 230, 31619, 235, 242, 31619, 117, 254, 167, 98, 112, 166, 116, 112, 47991, 101, 13, 198, 46695, 97, 167, 100, 234, 23821, 245, 105, 168, 250, 254, 167, 94, 250, 168, 248, 108, 46695, 230, 23821, 250, 226, 3170, 12, 259, 23821, 8955, 168, 248, 102, 47991, 246, 167, 102, 112, 23821, 121, 242, 167, 241, 250, 166, 108, 222, 220, 166, 117, 242, 167, 223, 242, 47991, 101, 13, 198, 198, 17, 8, 9539, 352, 167, 114, 222, 169, 226, 108, 23821, 108, 101, 167, 94, 222, 167, 94, 250, 23821, 233, 97, 169, 234, 101, 168, 250, 101, 35975, 226, 220, 166, 111, 226, 168, 224, 108, 47991, 246, 167, 102, 112, 168, 226, 250, 11, 23821, 254, 226, 168, 110, 112, 23821, 8955, 167, 252, 234, 168, 230, 246, 167, 98, 120, 23821, 97, 226, 168, 245, 105, 167, 224, 246, 166, 108, 238, 198, 32165, 796, 954, 1220, 4129, 198, 13664, 48185, 954, 198, 35975, 112, 167, 254, 229, 166, 110, 234, 220, 47991, 246, 167, 102, 112, 31619, 235, 242, 23821, 121, 242, 167, 241, 250, 166, 108, 222, 220, 169, 249, 101, 168, 242, 105, 220, 166, 108, 226, 166, 110, 108, 47991, 246, 166, 116, 112, 220, 47991, 101, 13, 198, 35975, 112, 167, 253, 108, 220, 166, 109, 116, 31619, 233, 97, 35975, 234, 168, 245, 238, 167, 232, 242, 31619, 108, 242, 167, 94, 250, 31619, 244, 254, 168, 246, 105, 167, 254, 97, 167, 111, 112, 168, 252, 238, 5145, 628, 198, 27, 46695, 113, 168, 243, 230, 31619, 102, 242, 167, 103, 101, 29, 198, 167, 105, 116, 168, 254, 250, 23821, 254, 243, 35975, 246, 31619, 242, 108, 167, 251, 120, 23821, 233, 97, 168, 230, 246, 23821, 245, 228, 35975, 112, 220, 166, 113, 105, 169, 246, 226, 35975, 226, 23821, 252, 246, 47991, 112, 168, 96, 120, 167, 102, 112, 31619, 238, 250, 46695, 97, 13, 198, 167, 242, 108, 167, 251, 120, 168, 226, 250, 220, 166, 113, 105, 169, 246, 226, 31619, 105, 116, 168, 254, 250, 167, 94, 250, 167, 237, 226, 31619, 114, 226, 167, 98, 246, 47991, 254, 23821, 230, 246, 23821, 252, 230, 168, 100, 222, 167, 100, 234, 11, 220, 198, 167, 105, 116, 168, 254, 250, 220, 47991, 112, 166, 110, 108, 220, 166, 111, 120, 168, 254, 243, 168, 245, 238, 168, 226, 250, 23821, 254, 243, 167, 254, 105, 31619, 251, 120, 35975, 112, 167, 116, 234, 167, 253, 105, 167, 99, 105, 166, 108, 222, 220, 169, 248, 101, 166, 111, 120, 168, 254, 223, 168, 250, 120, 167, 94, 250, 23821, 8955, 168, 248, 102, 167, 238, 246, 167, 107, 222, 167, 94, 250, 23821, 254, 243, 167, 254, 105, 31619, 105, 116, 168, 254, 250, 167, 94, 250, 31619, 114, 226, 167, 98, 246, 47991, 101, 198, 198, 168, 254, 226, 168, 110, 112, 23821, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 220, 166, 108, 250, 168, 230, 246, 166, 108, 222, 939, 11, 830, 23821, 251, 112, 47991, 246, 35975, 112, 166, 116, 108, 31619, 243, 234, 167, 105, 116, 168, 245, 238, 11, 198, 46, 7, 45, 6404, 45, 8, 220, 166, 116, 108, 167, 111, 116, 23821, 254, 243, 167, 254, 105, 31619, 251, 120, 35975, 112, 167, 116, 234, 167, 253, 105, 167, 99, 105, 167, 94, 250, 23821, 114, 102, 167, 114, 226, 169, 252, 230, 23821, 230, 246, 169, 244, 231, 220, 166, 108, 222, 167, 232, 98, 47991, 101, 13, 198, 7061, 6, 198, 198, 7061, 6, 198, 27, 33706, 29, 198, 2, 220, 169, 242, 226, 167, 94, 250, 166, 115, 116, 167, 252, 246, 167, 101, 116, 168, 232, 97, 23821, 233, 97, 169, 234, 101, 168, 250, 101, 198, 198, 4299, 4610, 7, 45, 11, 9539, 2599, 198, 220, 220, 220, 3280, 796, 17635, 198, 220, 220, 220, 4129, 796, 18896, 7, 301, 1095, 8, 628, 220, 220, 220, 1303, 23821, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 31619, 110, 230, 169, 246, 116, 167, 98, 120, 352, 167, 114, 222, 169, 226, 108, 399, 166, 117, 234, 168, 100, 222, 23821, 99, 251, 166, 108, 222, 168, 233, 250, 169, 224, 97, 167, 102, 108, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 16, 11, 399, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 220, 47991, 112, 46695, 117, 23821, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 168, 245, 238, 31619, 101, 116, 167, 45539, 167, 253, 105, 23821, 252, 230, 167, 232, 242, 23821, 8955, 167, 252, 234, 35975, 246, 23821, 230, 246, 220, 166, 111, 226, 168, 224, 108, 198, 220, 220, 220, 220, 220, 220, 220, 954, 796, 9539, 13, 9127, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 23821, 233, 97, 169, 234, 101, 168, 250, 101, 220, 166, 111, 226, 168, 224, 108, 198, 220, 220, 220, 220, 220, 220, 220, 611, 4129, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2038, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2038, 796, 954, 1220, 4129, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 31619, 99, 105, 168, 232, 97, 169, 232, 116, 168, 245, 238, 357, 168, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 31619, 110, 230, 169, 246, 116, 11, 23821, 233, 97, 169, 234, 101, 168, 250, 101, 8, 23821, 249, 238, 168, 228, 234, 23821, 224, 121, 168, 252, 227, 198, 220, 220, 220, 220, 220, 220, 220, 3280, 13, 33295, 19510, 72, 11, 2038, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 4129, 48185, 954, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 23821, 233, 97, 169, 234, 101, 168, 250, 101, 35975, 226, 220, 166, 116, 108, 168, 97, 222, 168, 250, 120, 167, 94, 250, 220, 166, 108, 223, 23821, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 167, 98, 120, 31619, 224, 112, 167, 99, 120, 168, 108, 101, 168, 230, 250, 23821, 254, 243, 167, 254, 105, 198, 220, 220, 220, 3280, 796, 23243, 7, 41484, 11, 1994, 28, 50033, 256, 25, 256, 58, 16, 4357, 9575, 28, 17821, 8, 628, 220, 220, 220, 1303, 23821, 254, 243, 167, 254, 105, 167, 238, 250, 23821, 232, 97, 169, 227, 234, 35975, 112, 168, 100, 222, 31619, 110, 230, 169, 246, 116, 23821, 114, 250, 167, 254, 98, 198, 220, 220, 220, 3280, 796, 685, 72, 58, 15, 60, 329, 1312, 287, 3280, 60, 198, 220, 220, 220, 1441, 3280, 198, 7061, 6 ]
0.791377
1,438
# -*- coding: utf-8 -*- import atexit import json import os import shlex import shutil import tempfile import unittest from .exceptions import CommandError from .utils import run_cmd_wait, run_cmd_wait_nofail, which, vramsteg_binary_location, DEFAULT_EXTENSION_PATH from .compat import STRING_TYPE class Vramsteg(object): """Manage a Vramsteg instance A temporary folder is used as data store of vramsteg. A vramsteg client should not be used after being destroyed. """ DEFAULT_VRAMSTEG = vramsteg_binary_location() def __init__(self, vramsteg=DEFAULT_VRAMSTEG): """Initialize a vramsteg (client). The program runs in a temporary folder. :arg vramsteg: Vramsteg binary to use as client (defaults: vramsteg in PATH) """ self.vramsteg = vramsteg # Used to specify what command to launch (and to inject faketime) self._command = [self.vramsteg] # Configuration of the isolated environment self._original_pwd = os.getcwd() self.datadir = tempfile.mkdtemp(prefix="vramsteg_") self.vramstegrc = os.path.join (self.datadir, 'vramstegrc') self._command.extend(['-f', self.vramstegrc]) # Ensure any instance is properly destroyed at session end atexit.register(lambda: self.destroy()) self.reset_env() def add_default_extension(self, filename): """Add default extension to current instance """ if not os.path.isdir(self.extdir): os.mkdir(self.extdir) extfile = os.path.join(self.extdir, filename) if os.path.isfile(extfile): raise "{} already exists".format(extfile) shutil.copy(os.path.join(DEFAULT_EXTENSION_PATH, filename), extfile) def __call__(self, *args, **kwargs): "aka t = Vramsteg() ; t() which is now an alias to t.runSuccess()" return self.runSuccess(*args, **kwargs) def reset_env(self): """Set a new environment derived from the one used to launch the test """ # Copy all env variables to avoid clashing subprocess environments self.env = os.environ.copy() def config(self, line): """Add 'line' to self.vramstegrc. """ with open(self.vramstegrc, "a") as f: f.write(line + "\n") @property def vramstegrc_content(self): """ Returns the contents of the vramstegrc file. """ with open(self.vramstegrc, "r") as f: return f.readlines() @staticmethod def _split_string_args_if_string(args): """Helper function to parse and split into arguments a single string argument. The string is literally the same as if written in the shell. """ # Enable nicer-looking calls by allowing plain strings if isinstance(args, STRING_TYPE): args = shlex.split(args) return args def runSuccess(self, args="", input=None, merge_streams=False, timeout=5): """Invoke vramsteg with given arguments and fail if exit code != 0 Use runError if you want exit_code to be tested automatically and *not* fail if program finishes abnormally. If you wish to pass instructions to vramsteg such as confirmations or other input via stdin, you can do so by providing a input string. Such as input="y\ny\n". If merge_streams=True stdout and stderr will be merged into stdout. timeout = number of seconds the test will wait for every vramsteg call. Defaults to 1 second if not specified. Unit is seconds. Returns (exit_code, stdout, stderr) if merge_streams=False (exit_code, output) if merge_streams=True """ # Create a copy of the command command = self._command[:] args = self._split_string_args_if_string(args) command.extend(args) output = run_cmd_wait_nofail(command, input, merge_streams=merge_streams, env=self.env, timeout=timeout) if output[0] != 0: raise CommandError(command, *output) return output def runError(self, args=(), input=None, merge_streams=False, timeout=5): """Invoke vramsteg with given arguments and fail if exit code == 0 Use runSuccess if you want exit_code to be tested automatically and *fail* if program finishes abnormally. If you wish to pass instructions to vramsteg such as confirmations or other input via stdin, you can do so by providing a input string. Such as input="y\ny\n". If merge_streams=True stdout and stderr will be merged into stdout. timeout = number of seconds the test will wait for every vramsteg call. Defaults to 1 second if not specified. Unit is seconds. Returns (exit_code, stdout, stderr) if merge_streams=False (exit_code, output) if merge_streams=True """ # Create a copy of the command command = self._command[:] args = self._split_string_args_if_string(args) command.extend(args) output = run_cmd_wait_nofail(command, input, merge_streams=merge_streams, env=self.env, timeout=timeout) # output[0] is the exit code if output[0] == 0 or output[0] is None: raise CommandError(command, *output) return output def destroy(self): """Cleanup the data folder and release server port for other instances """ try: shutil.rmtree(self.datadir) except OSError as e: if e.errno == 2: # Directory no longer exists pass else: raise # Prevent future reuse of this instance self.runSuccess = self.__destroyed self.runError = self.__destroyed # self.destroy will get called when the python session closes. # If self.destroy was already called, turn the action into a noop self.destroy = lambda: None def faketime(self, faketime=None): """Set a faketime using libfaketime that will affect the following command calls. If faketime is None, faketime settings will be disabled. """ cmd = which("faketime") if cmd is None: raise unittest.SkipTest("libfaketime/faketime is not installed") if self._command[0] == cmd: self._command = self._command[3:] if faketime is not None: # Use advanced time format self._command = [cmd, "-f", faketime] + self._command # vim: ai sts=4 et sw=4
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 379, 37023, 198, 11748, 33918, 198, 11748, 28686, 198, 11748, 427, 2588, 198, 11748, 4423, 346, 198, 11748, 20218, 7753, 198, 11748, 555, 715, 395, 198, 6738, 764, 1069, 11755, 1330, 9455, 12331, 198, 6738, 764, 26791, 1330, 1057, 62, 28758, 62, 17077, 11, 1057, 62, 28758, 62, 17077, 62, 77, 1659, 603, 11, 543, 11, 410, 859, 301, 1533, 62, 39491, 62, 24886, 11, 5550, 38865, 62, 13918, 16938, 2849, 62, 34219, 198, 6738, 764, 5589, 265, 1330, 19269, 2751, 62, 25216, 628, 198, 4871, 569, 859, 301, 1533, 7, 15252, 2599, 198, 220, 220, 220, 37227, 5124, 496, 257, 569, 859, 301, 1533, 4554, 628, 220, 220, 220, 317, 8584, 9483, 318, 973, 355, 1366, 3650, 286, 410, 859, 301, 1533, 13, 628, 220, 220, 220, 317, 410, 859, 301, 1533, 5456, 815, 407, 307, 973, 706, 852, 6572, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5550, 38865, 62, 13024, 2390, 2257, 7156, 796, 410, 859, 301, 1533, 62, 39491, 62, 24886, 3419, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 410, 859, 301, 1533, 28, 7206, 38865, 62, 13024, 2390, 2257, 7156, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 24243, 1096, 257, 410, 859, 301, 1533, 357, 16366, 737, 198, 220, 220, 220, 220, 220, 220, 220, 383, 1430, 4539, 287, 257, 8584, 9483, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 853, 410, 859, 301, 1533, 25, 569, 859, 301, 1533, 13934, 284, 779, 355, 5456, 357, 12286, 82, 25, 410, 859, 301, 1533, 287, 46490, 8, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 85, 859, 301, 1533, 796, 410, 859, 301, 1533, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 16718, 284, 11986, 644, 3141, 284, 4219, 357, 392, 284, 8677, 277, 461, 8079, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 21812, 796, 685, 944, 13, 85, 859, 301, 1533, 60, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 28373, 286, 262, 11557, 2858, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 14986, 62, 79, 16993, 796, 28686, 13, 1136, 66, 16993, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 19608, 324, 343, 796, 20218, 7753, 13, 28015, 67, 29510, 7, 40290, 2625, 85, 859, 301, 1533, 62, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 85, 859, 301, 1533, 6015, 796, 28686, 13, 6978, 13, 22179, 357, 944, 13, 19608, 324, 343, 11, 705, 85, 859, 301, 1533, 6015, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 21812, 13, 2302, 437, 7, 17816, 12, 69, 3256, 2116, 13, 85, 859, 301, 1533, 6015, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 48987, 597, 4554, 318, 6105, 6572, 379, 6246, 886, 198, 220, 220, 220, 220, 220, 220, 220, 379, 37023, 13, 30238, 7, 50033, 25, 2116, 13, 41659, 28955, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 42503, 62, 24330, 3419, 628, 220, 220, 220, 825, 751, 62, 12286, 62, 2302, 3004, 7, 944, 11, 29472, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 4550, 4277, 7552, 284, 1459, 4554, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 28686, 13, 6978, 13, 9409, 343, 7, 944, 13, 2302, 15908, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 28686, 13, 28015, 15908, 7, 944, 13, 2302, 15908, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1070, 7753, 796, 28686, 13, 6978, 13, 22179, 7, 944, 13, 2302, 15908, 11, 29472, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 28686, 13, 6978, 13, 4468, 576, 7, 2302, 7753, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 45144, 92, 1541, 7160, 1911, 18982, 7, 2302, 7753, 8, 628, 220, 220, 220, 220, 220, 220, 220, 4423, 346, 13, 30073, 7, 418, 13, 6978, 13, 22179, 7, 7206, 38865, 62, 13918, 16938, 2849, 62, 34219, 11, 29472, 828, 1070, 7753, 8, 628, 220, 220, 220, 825, 11593, 13345, 834, 7, 944, 11, 1635, 22046, 11, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 366, 8130, 256, 796, 569, 859, 301, 1533, 3419, 2162, 256, 3419, 543, 318, 783, 281, 16144, 284, 256, 13, 5143, 33244, 3419, 1, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 5143, 33244, 46491, 22046, 11, 12429, 46265, 22046, 8, 628, 220, 220, 220, 825, 13259, 62, 24330, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7248, 257, 649, 2858, 10944, 422, 262, 530, 973, 284, 4219, 262, 1332, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 17393, 477, 17365, 9633, 284, 3368, 537, 2140, 850, 14681, 12493, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 24330, 796, 28686, 13, 268, 2268, 13, 30073, 3419, 628, 220, 220, 220, 825, 4566, 7, 944, 11, 1627, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 4550, 705, 1370, 6, 284, 2116, 13, 85, 859, 301, 1533, 6015, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 944, 13, 85, 859, 301, 1533, 6015, 11, 366, 64, 4943, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7, 1370, 1343, 37082, 77, 4943, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 410, 859, 301, 1533, 6015, 62, 11299, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 262, 10154, 286, 262, 410, 859, 301, 1533, 6015, 2393, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 944, 13, 85, 859, 301, 1533, 6015, 11, 366, 81, 4943, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 277, 13, 961, 6615, 3419, 628, 220, 220, 220, 2488, 12708, 24396, 198, 220, 220, 220, 825, 4808, 35312, 62, 8841, 62, 22046, 62, 361, 62, 8841, 7, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 47429, 2163, 284, 21136, 290, 6626, 656, 7159, 257, 2060, 4731, 198, 220, 220, 220, 220, 220, 220, 220, 4578, 13, 383, 4731, 318, 7360, 262, 976, 355, 611, 3194, 287, 262, 7582, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 27882, 36597, 12, 11534, 3848, 416, 5086, 8631, 13042, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 22046, 11, 19269, 2751, 62, 25216, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26498, 796, 427, 2588, 13, 35312, 7, 22046, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 26498, 628, 220, 220, 220, 825, 1057, 33244, 7, 944, 11, 26498, 2625, 1600, 5128, 28, 14202, 11, 20121, 62, 5532, 82, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26827, 28, 20, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 19904, 2088, 410, 859, 301, 1533, 351, 1813, 7159, 290, 2038, 611, 8420, 2438, 14512, 657, 628, 220, 220, 220, 220, 220, 220, 220, 5765, 1057, 12331, 611, 345, 765, 8420, 62, 8189, 284, 307, 6789, 6338, 290, 198, 220, 220, 220, 220, 220, 220, 220, 1635, 1662, 9, 2038, 611, 1430, 20271, 42364, 453, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1002, 345, 4601, 284, 1208, 7729, 284, 410, 859, 301, 1533, 884, 355, 6216, 602, 393, 584, 198, 220, 220, 220, 220, 220, 220, 220, 5128, 2884, 14367, 259, 11, 345, 460, 466, 523, 416, 4955, 257, 5128, 4731, 13, 198, 220, 220, 220, 220, 220, 220, 220, 8013, 355, 5128, 2625, 88, 59, 3281, 59, 77, 1911, 628, 220, 220, 220, 220, 220, 220, 220, 1002, 20121, 62, 5532, 82, 28, 17821, 14367, 448, 290, 336, 1082, 81, 481, 307, 23791, 656, 14367, 448, 13, 628, 220, 220, 220, 220, 220, 220, 220, 26827, 796, 1271, 286, 4201, 262, 1332, 481, 4043, 329, 790, 410, 859, 301, 1533, 869, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2896, 13185, 284, 352, 1218, 611, 407, 7368, 13, 11801, 318, 4201, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 357, 37023, 62, 8189, 11, 14367, 448, 11, 336, 1082, 81, 8, 611, 20121, 62, 5532, 82, 28, 25101, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 37023, 62, 8189, 11, 5072, 8, 611, 20121, 62, 5532, 82, 28, 17821, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 13610, 257, 4866, 286, 262, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 3141, 796, 2116, 13557, 21812, 58, 47715, 628, 220, 220, 220, 220, 220, 220, 220, 26498, 796, 2116, 13557, 35312, 62, 8841, 62, 22046, 62, 361, 62, 8841, 7, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3141, 13, 2302, 437, 7, 22046, 8, 628, 220, 220, 220, 220, 220, 220, 220, 5072, 796, 1057, 62, 28758, 62, 17077, 62, 77, 1659, 603, 7, 21812, 11, 5128, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20121, 62, 5532, 82, 28, 647, 469, 62, 5532, 82, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17365, 28, 944, 13, 24330, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26827, 28, 48678, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 5072, 58, 15, 60, 14512, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 9455, 12331, 7, 21812, 11, 1635, 22915, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 5072, 628, 220, 220, 220, 825, 1057, 12331, 7, 944, 11, 26498, 16193, 828, 5128, 28, 14202, 11, 20121, 62, 5532, 82, 28, 25101, 11, 26827, 28, 20, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 19904, 2088, 410, 859, 301, 1533, 351, 1813, 7159, 290, 2038, 611, 8420, 2438, 6624, 657, 628, 220, 220, 220, 220, 220, 220, 220, 5765, 1057, 33244, 611, 345, 765, 8420, 62, 8189, 284, 307, 6789, 6338, 290, 198, 220, 220, 220, 220, 220, 220, 220, 1635, 32165, 9, 611, 1430, 20271, 42364, 453, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1002, 345, 4601, 284, 1208, 7729, 284, 410, 859, 301, 1533, 884, 355, 6216, 602, 393, 584, 198, 220, 220, 220, 220, 220, 220, 220, 5128, 2884, 14367, 259, 11, 345, 460, 466, 523, 416, 4955, 257, 5128, 4731, 13, 198, 220, 220, 220, 220, 220, 220, 220, 8013, 355, 5128, 2625, 88, 59, 3281, 59, 77, 1911, 628, 220, 220, 220, 220, 220, 220, 220, 1002, 20121, 62, 5532, 82, 28, 17821, 14367, 448, 290, 336, 1082, 81, 481, 307, 23791, 656, 14367, 448, 13, 628, 220, 220, 220, 220, 220, 220, 220, 26827, 796, 1271, 286, 4201, 262, 1332, 481, 4043, 329, 790, 410, 859, 301, 1533, 869, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2896, 13185, 284, 352, 1218, 611, 407, 7368, 13, 11801, 318, 4201, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 357, 37023, 62, 8189, 11, 14367, 448, 11, 336, 1082, 81, 8, 611, 20121, 62, 5532, 82, 28, 25101, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 37023, 62, 8189, 11, 5072, 8, 611, 20121, 62, 5532, 82, 28, 17821, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 13610, 257, 4866, 286, 262, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 3141, 796, 2116, 13557, 21812, 58, 47715, 628, 220, 220, 220, 220, 220, 220, 220, 26498, 796, 2116, 13557, 35312, 62, 8841, 62, 22046, 62, 361, 62, 8841, 7, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3141, 13, 2302, 437, 7, 22046, 8, 628, 220, 220, 220, 220, 220, 220, 220, 5072, 796, 1057, 62, 28758, 62, 17077, 62, 77, 1659, 603, 7, 21812, 11, 5128, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20121, 62, 5532, 82, 28, 647, 469, 62, 5532, 82, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17365, 28, 944, 13, 24330, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26827, 28, 48678, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 5072, 58, 15, 60, 318, 262, 8420, 2438, 198, 220, 220, 220, 220, 220, 220, 220, 611, 5072, 58, 15, 60, 6624, 657, 393, 5072, 58, 15, 60, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 9455, 12331, 7, 21812, 11, 1635, 22915, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 5072, 628, 220, 220, 220, 825, 4117, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 32657, 929, 262, 1366, 9483, 290, 2650, 4382, 2493, 329, 584, 10245, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4423, 346, 13, 81, 16762, 631, 7, 944, 13, 19608, 324, 343, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 440, 5188, 81, 1472, 355, 304, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 304, 13, 8056, 3919, 6624, 362, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 27387, 645, 2392, 7160, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1208, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 31572, 2003, 32349, 286, 428, 4554, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 5143, 33244, 796, 2116, 13, 834, 41659, 276, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 5143, 12331, 796, 2116, 13, 834, 41659, 276, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 2116, 13, 41659, 481, 651, 1444, 618, 262, 21015, 6246, 20612, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 1002, 2116, 13, 41659, 373, 1541, 1444, 11, 1210, 262, 2223, 656, 257, 645, 404, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 41659, 796, 37456, 25, 6045, 628, 220, 220, 220, 825, 277, 461, 8079, 7, 944, 11, 277, 461, 8079, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7248, 257, 277, 461, 8079, 1262, 9195, 69, 461, 8079, 326, 481, 2689, 262, 1708, 198, 220, 220, 220, 220, 220, 220, 220, 3141, 3848, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1002, 277, 461, 8079, 318, 6045, 11, 277, 461, 8079, 6460, 481, 307, 10058, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 23991, 796, 543, 7203, 69, 461, 8079, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 611, 23991, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 555, 715, 395, 13, 50232, 14402, 7203, 8019, 69, 461, 8079, 14, 69, 461, 8079, 318, 407, 6589, 4943, 628, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13557, 21812, 58, 15, 60, 6624, 23991, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 21812, 796, 2116, 13557, 21812, 58, 18, 47715, 628, 220, 220, 220, 220, 220, 220, 220, 611, 277, 461, 8079, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 5765, 6190, 640, 5794, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 21812, 796, 685, 28758, 11, 27444, 69, 1600, 277, 461, 8079, 60, 1343, 2116, 13557, 21812, 198, 198, 2, 43907, 25, 257, 72, 39747, 28, 19, 2123, 1509, 28, 19, 198 ]
2.334583
2,935
import unittest import cq_examples.Ex016_Using_Construction_Geometry as ex
[ 11748, 555, 715, 395, 198, 11748, 269, 80, 62, 1069, 12629, 13, 3109, 27037, 62, 12814, 62, 36687, 62, 10082, 15748, 355, 409, 198 ]
3.125
24
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import pytest from flexget.entry import Entry from flexget.plugins.list.imdb_list import ImdbEntrySet @pytest.mark.online
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 11, 7297, 11, 4112, 62, 11748, 198, 6738, 3170, 1040, 1330, 1635, 220, 1303, 279, 2645, 600, 25, 15560, 28, 403, 1484, 12, 11748, 11, 2266, 18156, 12, 18780, 259, 628, 198, 11748, 12972, 9288, 198, 198, 6738, 7059, 1136, 13, 13000, 1330, 21617, 198, 6738, 7059, 1136, 13, 37390, 13, 4868, 13, 320, 9945, 62, 4868, 1330, 1846, 9945, 30150, 7248, 628, 198, 31, 9078, 9288, 13, 4102, 13, 25119, 628 ]
3.292683
82
from onnx import TensorProto from onnx import helper as oh from finn.custom_op.registry import getCustomOp from finn.transformation import Transformation from finn.util.fpgadataflow import is_fpgadataflow_node class InsertDWC(Transformation): """Ensure that the graph is terminated with a TLastMarker node, inserting one if necessary."""
[ 6738, 319, 77, 87, 1330, 309, 22854, 2964, 1462, 198, 6738, 319, 77, 87, 1330, 31904, 355, 11752, 198, 198, 6738, 957, 77, 13, 23144, 62, 404, 13, 2301, 4592, 1330, 651, 15022, 18257, 198, 6738, 957, 77, 13, 7645, 1161, 1330, 49127, 198, 6738, 957, 77, 13, 22602, 13, 69, 6024, 14706, 11125, 1330, 318, 62, 69, 6024, 14706, 11125, 62, 17440, 628, 628, 198, 4871, 35835, 35, 27353, 7, 8291, 1161, 2599, 198, 220, 220, 220, 37227, 4834, 19532, 326, 262, 4823, 318, 23083, 351, 257, 309, 5956, 9704, 263, 10139, 11, 19319, 198, 220, 220, 220, 530, 611, 3306, 526, 15931, 198 ]
3.342857
105
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() from .models import User from .models import CoffeeShop
[ 6738, 42903, 62, 25410, 282, 26599, 1330, 16363, 2348, 26599, 198, 198, 9945, 796, 16363, 2348, 26599, 3419, 198, 198, 6738, 764, 27530, 1330, 11787, 198, 6738, 764, 27530, 1330, 19443, 29917, 198 ]
3.515152
33
import pygame from GameObj import GameObj import random # draws the segment, go_through by default is false # checks the boundary for the segment # goes through the boundary and comes through the other end
[ 11748, 12972, 6057, 198, 6738, 3776, 49201, 1330, 3776, 49201, 198, 11748, 4738, 628, 198, 220, 220, 220, 1303, 14293, 262, 10618, 11, 467, 62, 9579, 416, 4277, 318, 3991, 628, 220, 220, 220, 1303, 8794, 262, 18645, 329, 262, 10618, 198, 220, 220, 220, 1303, 2925, 832, 262, 18645, 290, 2058, 832, 262, 584, 886, 198 ]
3.877193
57
""" Copyright 2019 Software Reliability Lab, ETH Zurich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from PIL import Image, ImageDraw import json from pprint import pprint from random import randint import config
[ 37811, 198, 15269, 13130, 10442, 4718, 12455, 3498, 11, 35920, 43412, 198, 26656, 15385, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 5832, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 1639, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 28042, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 17080, 6169, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 54, 10554, 12425, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 6214, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2475, 20597, 739, 262, 13789, 13, 198, 37811, 198, 198, 6738, 350, 4146, 1330, 7412, 11, 7412, 25302, 198, 11748, 33918, 198, 6738, 279, 4798, 1330, 279, 4798, 198, 6738, 4738, 1330, 43720, 600, 198, 11748, 4566, 628 ]
4
174
# -*- coding: utf-8 -*- # Copyright 2016 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from __future__ import absolute_import from __future__ import unicode_literals from schematizer.models.database import session from schematizer.models.exceptions import EntityNotFoundError class BaseModel(object): """Base class of model classes which contains common simple operations (operations that only involve single model class only). These functions only work when they are inside the request context manager. See http://servicedocs/docs/yelp_conn/session.html. """ @classmethod @classmethod @classmethod def create(cls, session, **kwargs): """Create this entity in the database. Note this function will call `session.flush()`, so do not use this function if there are other operations that need to happen before the flush is called. Args: session (:class:yelp_conn.session.YelpConnScopedSession) global session manager used to provide sessions. kwargs (dict): pairs of model attributes and their values. Returns: :class:schematizer.models.[cls]: object that is newly created in the database. """ entity = cls(**kwargs) session.add(entity) session.flush() return entity
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 1584, 44628, 3457, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 198, 2, 3788, 9387, 739, 262, 13789, 318, 9387, 319, 281, 198, 2, 366, 1921, 3180, 1, 29809, 1797, 11, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 198, 2, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 220, 4091, 262, 13789, 329, 262, 198, 2, 2176, 3303, 15030, 21627, 290, 11247, 198, 2, 739, 262, 13789, 13, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 3897, 6759, 7509, 13, 27530, 13, 48806, 1330, 6246, 198, 6738, 3897, 6759, 7509, 13, 27530, 13, 1069, 11755, 1330, 20885, 3673, 21077, 12331, 628, 198, 4871, 7308, 17633, 7, 15252, 2599, 198, 220, 220, 220, 37227, 14881, 1398, 286, 2746, 6097, 543, 4909, 2219, 2829, 4560, 198, 220, 220, 220, 357, 3575, 602, 326, 691, 6211, 2060, 2746, 1398, 691, 737, 628, 220, 220, 220, 2312, 5499, 691, 670, 618, 484, 389, 2641, 262, 2581, 4732, 4706, 13, 198, 220, 220, 220, 4091, 2638, 1378, 3168, 3711, 420, 82, 14, 31628, 14, 88, 417, 79, 62, 37043, 14, 29891, 13, 6494, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 4871, 24396, 628, 220, 220, 220, 2488, 4871, 24396, 628, 220, 220, 220, 2488, 4871, 24396, 198, 220, 220, 220, 825, 2251, 7, 565, 82, 11, 6246, 11, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 16447, 428, 9312, 287, 262, 6831, 13, 220, 5740, 428, 2163, 481, 869, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 29891, 13, 25925, 3419, 47671, 523, 466, 407, 779, 428, 2163, 611, 612, 389, 584, 198, 220, 220, 220, 220, 220, 220, 220, 4560, 326, 761, 284, 1645, 878, 262, 24773, 318, 1444, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6246, 357, 25, 4871, 25, 88, 417, 79, 62, 37043, 13, 29891, 13, 56, 417, 79, 37321, 3351, 19458, 36044, 8, 3298, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6246, 4706, 973, 284, 2148, 10991, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 357, 11600, 2599, 14729, 286, 2746, 12608, 290, 511, 3815, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 4871, 25, 1416, 10024, 7509, 13, 27530, 3693, 565, 82, 5974, 2134, 326, 318, 8308, 2727, 287, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 262, 6831, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 9312, 796, 537, 82, 7, 1174, 46265, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6246, 13, 2860, 7, 26858, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6246, 13, 25925, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 9312, 198 ]
3.067434
608
import tushare as ts import pymongo import json stock_lists = ts.get_stock_basics() #获取所有股票列表 conn = pymongo.MongoClient('127.0.0.1', port=27017) conn.db.tickdata.insert_many(json.loads(stock_lists.to_json(orient='records'))) print(stock_lists)
[ 11748, 256, 1530, 533, 355, 40379, 198, 11748, 279, 4948, 25162, 198, 11748, 33918, 198, 13578, 62, 20713, 796, 40379, 13, 1136, 62, 13578, 62, 12093, 873, 3419, 1303, 164, 236, 115, 20998, 244, 33699, 222, 17312, 231, 164, 224, 94, 163, 98, 101, 26344, 245, 26193, 101, 198, 198, 37043, 796, 279, 4948, 25162, 13, 44, 25162, 11792, 10786, 16799, 13, 15, 13, 15, 13, 16, 3256, 2493, 28, 1983, 29326, 8, 198, 37043, 13, 9945, 13, 42298, 7890, 13, 28463, 62, 21834, 7, 17752, 13, 46030, 7, 13578, 62, 20713, 13, 1462, 62, 17752, 7, 13989, 11639, 8344, 3669, 6, 22305, 198, 4798, 7, 13578, 62, 20713, 8, 198 ]
2.216216
111
# Regression test based on the diffusion of a Gaussian # velocity field. Convergence of L1 norm of the error # in v is tested. Expected 1st order conv. for STS. # Modules # (needed for global variables modified in run_tests.py, even w/o athena.run(), etc.) import scripts.utils.athena as athena # noqa import scripts.tests.diffusion.viscous_diffusion as viscous_diffusion import logging viscous_diffusion.method = 'STS' viscous_diffusion.rate_tols = [-0.99] viscous_diffusion.logger = logging.getLogger('athena' + __name__[7:])
[ 2, 3310, 2234, 1332, 1912, 319, 262, 44258, 286, 257, 12822, 31562, 198, 2, 15432, 2214, 13, 220, 35602, 12745, 286, 406, 16, 2593, 286, 262, 4049, 198, 2, 287, 410, 318, 6789, 13, 220, 1475, 7254, 352, 301, 1502, 3063, 13, 329, 3563, 50, 13, 198, 198, 2, 3401, 5028, 198, 2, 357, 27938, 329, 3298, 9633, 9518, 287, 1057, 62, 41989, 13, 9078, 11, 772, 266, 14, 78, 379, 831, 64, 13, 5143, 22784, 3503, 2014, 198, 11748, 14750, 13, 26791, 13, 265, 831, 64, 355, 379, 831, 64, 220, 1303, 645, 20402, 198, 11748, 14750, 13, 41989, 13, 26069, 4241, 13, 85, 2304, 516, 62, 26069, 4241, 355, 31116, 516, 62, 26069, 4241, 198, 11748, 18931, 198, 198, 85, 2304, 516, 62, 26069, 4241, 13, 24396, 796, 705, 2257, 50, 6, 198, 85, 2304, 516, 62, 26069, 4241, 13, 4873, 62, 83, 10220, 796, 25915, 15, 13, 2079, 60, 198, 85, 2304, 516, 62, 26069, 4241, 13, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 10786, 265, 831, 64, 6, 1343, 11593, 3672, 834, 58, 22, 25, 12962, 628, 628 ]
2.928962
183
import unittest #import unittest module from credentials import User from credentials import Credentials class TestUser(unittest.TestCase): ''' Test class that defines test cases for the user class behaviours. Args: unittest.TestCase: TestCase class that helps in creating test cases ''' def setUp(self): ''' Set up method to run before each test case. ''' self.new_user = User("Audrey","Njiraini","audreynjiraini","12345678") # create contact object def test_init(self): ''' test_init test case to test if the object is initialized properly ''' self.assertEqual(self.new_user.first_name,"Audrey") self.assertEqual(self.new_user.last_name,"Njiraini") self.assertEqual(self.new_user.username,"audreynjiraini") self.assertEqual(self.new_user.password,"12345678") def test_save_user(self): ''' test_save_user test case to test if the user object is saved into the user list ''' self.new_user.save_user() # save the new contact self.assertEqual(len(User.user_list),1) class TestCredentials(unittest.TestCase): ''' Test class that defines test cases for the credentials class behaviours. Args: unittest.TestCase: TestCase class that helps in creating test cases ''' def setUp(self): ''' Set up method to run before each test case. ''' self.new_account = Credentials("audrey","Twitter","audreynjiraini","12345678") def tearDown(self): ''' tearDown method that does clean up after each test case has run. ''' Credentials.credentials_list = [] def test_init(self): ''' test_init test case to test if the object is initialized properly ''' self.assertEqual(self.new_account.account_name,"Twitter") self.assertEqual(self.new_account.username,"audreynjiraini") self.assertEqual(self.new_account.password,"12345678") def test_save_credentials(self): ''' test case to test if the credentials account object is saved into the credentials list ''' self.new_account.save_credentials() self.assertEqual(len(Credentials.credentials_list),1) def test_save_multiple_credentials(self): ''' test to check if we can save multiple credentials objects to credentials_list ''' self.new_account.save_credentials() test_account = Credentials("audrey","Instagram","audreynjiraini","123456789") #new credential test_account.save_credentials() self.assertEqual(len(Credentials.credentials_list),2) def test_display_credentials(self): ''' Test to check if the correct credentials are displayed ''' self.assertListEqual(Credentials.display_credentials("audrey"),Credentials.credentials_list) def test_find_credentials(self): ''' Test to check if we can find a credential by account_name ''' self.new_account.save_credentials() test_account = Credentials("audrey","Instagram","audrey","123456789") #new credential test_account.save_credentials() the_account = Credentials.find_credentials("Instagram") self.assertEqual(the_account.account_name,test_account.account_name) def test_delete_credentials(self): ''' test if we can remove a credential from credentials_list once we no longer need it ''' self.new_account.save_credentials() test_account = Credentials("audrey","Instagram","audrey","123456789") #new credential test_account.save_credentials() self.new_account.delete_credentials() #deleting a credential(account) object self.assertEqual(len(Credentials.credentials_list),1) if __name__ == '__main__': unittest.main()
[ 11748, 555, 715, 395, 1303, 11748, 555, 715, 395, 8265, 198, 6738, 18031, 1330, 11787, 198, 6738, 18031, 1330, 327, 445, 14817, 198, 198, 4871, 6208, 12982, 7, 403, 715, 395, 13, 14402, 20448, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 6208, 1398, 326, 15738, 1332, 2663, 329, 262, 2836, 1398, 38975, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 555, 715, 395, 13, 14402, 20448, 25, 6208, 20448, 1398, 326, 5419, 287, 4441, 1332, 2663, 198, 220, 220, 220, 705, 7061, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 825, 900, 4933, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 5345, 510, 2446, 284, 1057, 878, 1123, 1332, 1339, 13, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 7220, 796, 11787, 7203, 16353, 4364, 2430, 45, 73, 343, 391, 72, 2430, 3885, 260, 2047, 73, 343, 391, 72, 2430, 10163, 2231, 30924, 4943, 1303, 2251, 2800, 2134, 628, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 15003, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 15003, 1332, 1339, 284, 1332, 611, 262, 2134, 318, 23224, 6105, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 7220, 13, 11085, 62, 3672, 553, 16353, 4364, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 7220, 13, 12957, 62, 3672, 553, 45, 73, 343, 391, 72, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 7220, 13, 29460, 553, 3885, 260, 2047, 73, 343, 391, 72, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 7220, 13, 28712, 553, 10163, 2231, 30924, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 21928, 62, 7220, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 21928, 62, 7220, 1332, 1339, 284, 1332, 611, 262, 2836, 2134, 318, 7448, 656, 262, 2836, 1351, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 7220, 13, 21928, 62, 7220, 3419, 1303, 3613, 262, 649, 2800, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 11925, 7, 12982, 13, 7220, 62, 4868, 828, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 4871, 6208, 34, 445, 14817, 7, 403, 715, 395, 13, 14402, 20448, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 6208, 1398, 326, 15738, 1332, 2663, 329, 262, 18031, 1398, 38975, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 555, 715, 395, 13, 14402, 20448, 25, 6208, 20448, 1398, 326, 5419, 287, 4441, 1332, 2663, 198, 220, 220, 220, 705, 7061, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 825, 900, 4933, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 5345, 510, 2446, 284, 1057, 878, 1123, 1332, 1339, 13, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 796, 327, 445, 14817, 7203, 3885, 4364, 2430, 14254, 2430, 3885, 260, 2047, 73, 343, 391, 72, 2430, 10163, 2231, 30924, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 11626, 8048, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 11626, 8048, 2446, 326, 857, 3424, 510, 706, 1123, 1332, 1339, 468, 1057, 13, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 327, 445, 14817, 13, 66, 445, 14817, 62, 4868, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 15003, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 15003, 1332, 1339, 284, 1332, 611, 262, 2134, 318, 23224, 6105, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 23317, 13, 23317, 62, 3672, 553, 14254, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 23317, 13, 29460, 553, 3885, 260, 2047, 73, 343, 391, 72, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 944, 13, 3605, 62, 23317, 13, 28712, 553, 10163, 2231, 30924, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 21928, 62, 66, 445, 14817, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 1339, 284, 1332, 611, 262, 18031, 1848, 2134, 318, 7448, 656, 262, 18031, 1351, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 11925, 7, 34, 445, 14817, 13, 66, 445, 14817, 62, 4868, 828, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 21928, 62, 48101, 62, 66, 445, 14817, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 284, 2198, 611, 356, 460, 3613, 3294, 18031, 5563, 284, 18031, 62, 4868, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 796, 327, 445, 14817, 7203, 3885, 4364, 2430, 6310, 6713, 2430, 3885, 260, 2047, 73, 343, 391, 72, 2430, 10163, 2231, 3134, 4531, 4943, 1303, 3605, 49920, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 11925, 7, 34, 445, 14817, 13, 66, 445, 14817, 62, 4868, 828, 17, 8, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 13812, 62, 66, 445, 14817, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 6208, 284, 2198, 611, 262, 3376, 18031, 389, 9066, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 8053, 36, 13255, 7, 34, 445, 14817, 13, 13812, 62, 66, 445, 14817, 7203, 3885, 4364, 12340, 34, 445, 14817, 13, 66, 445, 14817, 62, 4868, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 19796, 62, 66, 445, 14817, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 6208, 284, 2198, 611, 356, 460, 1064, 257, 49920, 416, 1848, 62, 3672, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 796, 327, 445, 14817, 7203, 3885, 4364, 2430, 6310, 6713, 2430, 3885, 4364, 2430, 10163, 2231, 3134, 4531, 4943, 1303, 3605, 49920, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 262, 62, 23317, 796, 327, 445, 14817, 13, 19796, 62, 66, 445, 14817, 7203, 6310, 6713, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 1169, 62, 23317, 13, 23317, 62, 3672, 11, 9288, 62, 23317, 13, 23317, 62, 3672, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 825, 1332, 62, 33678, 62, 66, 445, 14817, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 611, 356, 460, 4781, 257, 49920, 422, 18031, 62, 4868, 1752, 356, 645, 2392, 761, 340, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 796, 327, 445, 14817, 7203, 3885, 4364, 2430, 6310, 6713, 2430, 3885, 4364, 2430, 10163, 2231, 3134, 4531, 4943, 1303, 3605, 49920, 198, 220, 220, 220, 220, 220, 220, 220, 1332, 62, 23317, 13, 21928, 62, 66, 445, 14817, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3605, 62, 23317, 13, 33678, 62, 66, 445, 14817, 3419, 1303, 2934, 293, 889, 257, 49920, 7, 23317, 8, 2134, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 11925, 7, 34, 445, 14817, 13, 66, 445, 14817, 62, 4868, 828, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419, 220, 220, 220, 220, 220 ]
2.268894
1,826
#!/usr/bin/env python3 import sys, random assert sys.version_info >= (3,7), "This script requires at least Python 3.7" print('Greetings!')#prints 'Greetings' in window colors = ['red','orange','yellow','green','blue','violet','purple']#list of colors play_again = ''#establishing empty variable best_count = sys.maxsize # the biggest number while (play_again != 'n' and play_again != 'no'):#if the player has not said no to playing again match_color = random.choice(colors)#selects a random string from the list of #colors to put in the variable match_color count = 0#makes variable count 0 color = ''#establishing empty variable while (color != match_color):#while the color entered doesn't =match_varible color = input("\nWhat is my favorite color? ") #\n is a special code that adds a new line color = color.lower().strip()#strips color of letter cases count += 1#adds 1 to count if (color == match_color):#if the color entered matches match_color print('Correct!')#prints 'Correct!' in window else: print('Sorry, try again. You have guessed {guesses} times.'.format(guesses=count)) #prints 'Sorry, try again. You have guessed (number in var. count) times.' in window print('\nYou guessed it in {} tries!'.format(count))#prints 'You guessed it in #(numberin var. count) tries!' on a new line' if (count < best_count):#if the count is lower than the best_count print('This was your best guess so far!')#prints 'This was your best guess so far!' #in window best_count = count#changes best_count to previous count play_again = input("\nWould you like to play again (yes or no)? ").lower().strip() #asks player if they want to play again and they would type 'yes' or 'no' in response print('Thanks for playing!')#prints 'Thanks for playing!' in window
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 11748, 25064, 11, 4738, 198, 198, 30493, 25064, 13, 9641, 62, 10951, 18189, 357, 18, 11, 22, 828, 366, 1212, 4226, 4433, 379, 1551, 11361, 513, 13, 22, 1, 628, 198, 4798, 10786, 38, 46648, 0, 11537, 2, 17190, 705, 38, 46648, 6, 287, 4324, 198, 4033, 669, 796, 37250, 445, 41707, 43745, 41707, 36022, 41707, 14809, 41707, 17585, 41707, 85, 19194, 41707, 14225, 1154, 20520, 2, 4868, 286, 7577, 198, 1759, 62, 17776, 796, 10148, 2, 40037, 278, 6565, 7885, 198, 13466, 62, 9127, 796, 25064, 13, 9806, 7857, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 262, 4094, 1271, 198, 198, 4514, 357, 1759, 62, 17776, 14512, 705, 77, 6, 290, 711, 62, 17776, 14512, 705, 3919, 6, 2599, 2, 361, 262, 2137, 468, 407, 531, 645, 284, 2712, 757, 198, 220, 220, 220, 2872, 62, 8043, 796, 4738, 13, 25541, 7, 4033, 669, 8, 2, 19738, 82, 257, 4738, 4731, 422, 262, 1351, 286, 198, 220, 220, 220, 1303, 4033, 669, 284, 1234, 287, 262, 7885, 2872, 62, 8043, 198, 220, 220, 220, 954, 796, 657, 2, 49123, 7885, 954, 657, 198, 220, 220, 220, 3124, 796, 10148, 2, 40037, 278, 6565, 7885, 198, 220, 220, 220, 981, 357, 8043, 14512, 2872, 62, 8043, 2599, 2, 4514, 262, 3124, 5982, 1595, 470, 796, 15699, 62, 7785, 856, 198, 220, 220, 220, 220, 220, 220, 220, 3124, 796, 5128, 7203, 59, 77, 2061, 318, 616, 4004, 3124, 30, 366, 8, 220, 1303, 59, 77, 318, 257, 2041, 2438, 326, 6673, 257, 649, 1627, 198, 220, 220, 220, 220, 220, 220, 220, 3124, 796, 3124, 13, 21037, 22446, 36311, 3419, 2, 33565, 862, 3124, 286, 3850, 2663, 198, 220, 220, 220, 220, 220, 220, 220, 954, 15853, 352, 2, 2860, 82, 352, 284, 954, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 8043, 6624, 2872, 62, 8043, 2599, 2, 361, 262, 3124, 5982, 7466, 2872, 62, 8043, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 42779, 0, 11537, 2, 17190, 705, 42779, 13679, 287, 4324, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 14385, 11, 1949, 757, 13, 921, 423, 25183, 1391, 5162, 44667, 92, 1661, 2637, 13, 18982, 7, 5162, 44667, 28, 9127, 4008, 198, 2, 17190, 705, 14385, 11, 1949, 757, 13, 921, 423, 25183, 357, 17618, 287, 1401, 13, 954, 8, 1661, 2637, 287, 4324, 198, 220, 220, 220, 3601, 10786, 59, 77, 1639, 25183, 340, 287, 23884, 8404, 0, 4458, 18982, 7, 9127, 4008, 2, 17190, 705, 1639, 25183, 340, 287, 198, 220, 220, 220, 1303, 7, 17618, 259, 1401, 13, 954, 8, 8404, 13679, 319, 257, 649, 1627, 6, 628, 220, 220, 220, 611, 357, 9127, 1279, 1266, 62, 9127, 2599, 2, 361, 262, 954, 318, 2793, 621, 262, 1266, 62, 9127, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 1212, 373, 534, 1266, 4724, 523, 1290, 0, 11537, 2, 17190, 705, 1212, 373, 534, 1266, 4724, 523, 1290, 13679, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 259, 4324, 198, 220, 220, 220, 220, 220, 220, 220, 1266, 62, 9127, 796, 954, 2, 36653, 1266, 62, 9127, 284, 2180, 954, 628, 220, 220, 220, 711, 62, 17776, 796, 5128, 7203, 59, 77, 17353, 345, 588, 284, 711, 757, 357, 8505, 393, 645, 19427, 366, 737, 21037, 22446, 36311, 3419, 198, 2, 6791, 2137, 611, 484, 765, 284, 711, 757, 290, 484, 561, 2099, 705, 8505, 6, 393, 705, 3919, 6, 287, 2882, 198, 4798, 10786, 9690, 329, 2712, 0, 11537, 2, 17190, 705, 9690, 329, 2712, 13679, 287, 4324, 198 ]
3.014331
628
import time import pytest from nucleus import BoxAnnotation from tests.helpers import ( TEST_BOX_ANNOTATIONS, TEST_MODEL_NAME, TEST_SLICE_NAME, get_uuid, ) from tests.modelci.helpers import create_box_annotations, create_predictions from tests.test_dataset import make_dataset_items @pytest.fixture(scope="module") def modelci_dataset(CLIENT): """SHOULD NOT BE MUTATED IN TESTS. This dataset lives for the whole test module scope.""" ds = CLIENT.create_dataset("[Test Model CI] Dataset", is_scene=False) yield ds CLIENT.delete_dataset(ds.id) @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.mark.usefixtures( "annotations" ) # Unit test needs to have annotations in the slice
[ 11748, 640, 198, 198, 11748, 12972, 9288, 198, 198, 6738, 29984, 1330, 8315, 2025, 38983, 198, 6738, 5254, 13, 16794, 364, 1330, 357, 198, 220, 220, 220, 43001, 62, 39758, 62, 1565, 11929, 18421, 11, 198, 220, 220, 220, 43001, 62, 33365, 3698, 62, 20608, 11, 198, 220, 220, 220, 43001, 62, 8634, 8476, 62, 20608, 11, 198, 220, 220, 220, 651, 62, 12303, 312, 11, 198, 8, 198, 6738, 5254, 13, 19849, 979, 13, 16794, 364, 1330, 2251, 62, 3524, 62, 34574, 602, 11, 2251, 62, 28764, 9278, 198, 6738, 5254, 13, 9288, 62, 19608, 292, 316, 1330, 787, 62, 19608, 292, 316, 62, 23814, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 198, 4299, 2746, 979, 62, 19608, 292, 316, 7, 5097, 28495, 2599, 198, 220, 220, 220, 37227, 9693, 24010, 5626, 9348, 337, 3843, 11617, 3268, 309, 1546, 4694, 13, 770, 27039, 3160, 329, 262, 2187, 1332, 8265, 8354, 526, 15931, 198, 220, 220, 220, 288, 82, 796, 45148, 13, 17953, 62, 19608, 292, 316, 7203, 58, 14402, 9104, 14514, 60, 16092, 292, 316, 1600, 318, 62, 29734, 28, 25101, 8, 198, 220, 220, 220, 7800, 288, 82, 628, 220, 220, 220, 45148, 13, 33678, 62, 19608, 292, 316, 7, 9310, 13, 312, 8, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 198, 31, 9078, 9288, 13, 4102, 13, 1904, 69, 25506, 7, 198, 220, 220, 220, 366, 34574, 602, 1, 198, 8, 220, 1303, 11801, 1332, 2476, 284, 423, 37647, 287, 262, 16416, 198 ]
2.723214
336
from setuptools import setup, find_packages long_description = open('README.rst').read() setup( name='prophy', version='1.2.4', author='Krzysztof Laskowski', author_email='[email protected]', maintainer='Krzysztof Laskowski', maintainer_email='[email protected]', license='MIT license', url='https://github.com/aurzenligl/prophy', description='prophy: fast serialization protocol', long_description=long_description, long_description_content_type='text/x-rst', packages=find_packages(), install_requires=['ply', 'renew>=0.4.8,<0.6'], keywords='idl codec binary data protocol compiler', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Telecommunications Industry', 'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator', 'Topic :: Software Development :: Code Generators', 'Topic :: Software Development :: Compilers', 'Topic :: Software Development :: Embedded Systems', 'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: C++', 'Operating System :: OS Independent', 'License :: OSI Approved :: MIT License', ], entry_points={ 'console_scripts': [ 'prophyc = prophyc.__main__:entry_main' ], }, )
[ 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 198, 198, 6511, 62, 11213, 796, 1280, 10786, 15675, 11682, 13, 81, 301, 27691, 961, 3419, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 11639, 1676, 6883, 3256, 198, 220, 220, 220, 2196, 11639, 16, 13, 17, 13, 19, 3256, 198, 220, 220, 220, 1772, 11639, 42, 81, 89, 893, 89, 1462, 69, 406, 2093, 12079, 3256, 198, 220, 220, 220, 1772, 62, 12888, 11639, 2899, 4801, 4604, 75, 31, 14816, 13, 785, 3256, 198, 220, 220, 220, 5529, 263, 11639, 42, 81, 89, 893, 89, 1462, 69, 406, 2093, 12079, 3256, 198, 220, 220, 220, 5529, 263, 62, 12888, 11639, 2899, 4801, 4604, 75, 31, 14816, 13, 785, 3256, 198, 220, 220, 220, 5964, 11639, 36393, 5964, 3256, 198, 220, 220, 220, 19016, 11639, 5450, 1378, 12567, 13, 785, 14, 2899, 4801, 4604, 75, 14, 1676, 6883, 3256, 198, 220, 220, 220, 6764, 11639, 1676, 6883, 25, 3049, 11389, 1634, 8435, 3256, 198, 220, 220, 220, 890, 62, 11213, 28, 6511, 62, 11213, 11, 198, 220, 220, 220, 890, 62, 11213, 62, 11299, 62, 4906, 11639, 5239, 14, 87, 12, 81, 301, 3256, 198, 220, 220, 220, 10392, 28, 19796, 62, 43789, 22784, 198, 220, 220, 220, 2721, 62, 47911, 28, 17816, 2145, 3256, 705, 918, 413, 29, 28, 15, 13, 19, 13, 23, 11, 27, 15, 13, 21, 6, 4357, 198, 220, 220, 220, 26286, 11639, 312, 75, 40481, 13934, 1366, 8435, 17050, 3256, 198, 220, 220, 220, 1398, 13350, 41888, 198, 220, 220, 220, 220, 220, 220, 220, 705, 41206, 12678, 7904, 642, 532, 19174, 14, 1273, 540, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 5317, 1631, 7591, 1240, 7904, 34152, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 5317, 1631, 7591, 1240, 7904, 48667, 17420, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 22060, 14, 13798, 1586, 7904, 26491, 7117, 14, 19703, 4668, 3602, 41880, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 6127, 2980, 2024, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 3082, 34393, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 13302, 47238, 11998, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 23983, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 46267, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 33221, 7904, 41086, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 362, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 362, 13, 22, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 513, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 513, 13, 19, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 513, 13, 20, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 513, 13, 21, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 46333, 7904, 16932, 7535, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 46333, 7904, 9485, 20519, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 327, 4880, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 18843, 803, 4482, 7904, 7294, 13362, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 34156, 7904, 7294, 40, 20010, 1079, 7904, 17168, 13789, 3256, 198, 220, 220, 220, 16589, 198, 220, 220, 220, 5726, 62, 13033, 34758, 198, 220, 220, 220, 220, 220, 220, 220, 705, 41947, 62, 46521, 10354, 685, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 1676, 6883, 66, 796, 386, 6883, 66, 13, 834, 12417, 834, 25, 13000, 62, 12417, 6, 198, 220, 220, 220, 220, 220, 220, 220, 16589, 198, 220, 220, 220, 8964, 198, 8, 198 ]
2.723849
717
from pathlib import Path from typing import List, Optional, Tuple, Union import numpy as np import pandas as pd class PemsBayIo: """A class that encapsulates i/o operations related to the PeMS-Bay dataset. Args: n_readings: The number of readings in the dataset (not to be confunded with the dataset length). n_previous_steps: The number of previous time steps to consider when building the predictor variable. n_future_steps: The number of next time steps to consdier when building the target variable. normalized_k: The threshold for constructing the adjacency matrix based on the thresholded Gaussian kernel. """ @property def min_t(self): """The minimum time step so that accessing the element of index min_t-n_previous_steps does not err.""" return abs(min(self.previous_offsets)) @property def max_t(self): """The maximum time step so that accessing the elemnt of index max_t+n_future_steps does not err""" return abs(self.n_readings - abs(max(self.future_offsets))) @property @property def get_pems_data(self, data_path: str) -> Tuple[np.ndarray, np.ndarray]: """ Load the PeMS-Bay data. The returned values X (features/predictors/previous steps) and Y (target/next steps) are of shapes: X(n_intervals, n_previous_steps, n_nodes=325, n_features=3) Y(n_intervals, n_next_steps, n_nodes=325, n_features=3) Args: data_path: The path where the readings data is stored. Returns: A tuple containing the X and Y tensors. The first feature is the average speed in the 5-minutes interval, while the second are the third are hour-of-day and day-of-week indices. """ data_df = pd.read_csv(filepath_or_buffer=data_path, index_col=0) _, n_nodes = data_df.shape # Range of values is 0-100, so half precision (float16) is ok. data = np.expand_dims(a=data_df.values, axis=-1).astype(np.float16) data = [data] # Range of values is 0-23, so half precision (short) is ok. hour_of_day = ((data_df.index.values.astype("datetime64") - data_df.index.values.astype("datetime64[D]")) / 3600)\ .astype(int) % 24 hour_of_day = np.tile(hour_of_day, [1, n_nodes, 1]).transpose( (2, 1, 0)).astype(np.short) data.append(hour_of_day) day_of_week = data_df.index.astype("datetime64[ns]").dayofweek day_of_week = np.tile(day_of_week, [1, n_nodes, 1]).transpose( (2, 1, 0)).astype(np.short) data.append(day_of_week) data = np.concatenate(data, axis=-1) x, y = [], [] indices_range = range(self.min_t, self.max_t) x = [data[t + self.previous_offsets, ...] for t in indices_range] y = [data[t + self.future_offsets, ...] for t in indices_range] x = np.stack(arrays=x, axis=0) y = np.stack(arrays=y, axis=0) return x, y def generate_adjacency_matrix( self, distances_path: Union[str, Path], sensor_ids_path: Union[str, Path]) -> np.ndarray: """ Generates the adjacency matrix of a distance graph using a thresholded Gaussian filter. https://github.com/liyaguang/DCRNN/blob/master/scripts/gen_adj_mx.py Args: distances_path: The path to the dataframe with real-road distances between sensors, of form (to, from, dist). sensor_ids_path: The path to the dataframe containing the IDs of all the sensors in the PeMS network. Returns: A numpy array, which is the adjacency matrix generated by appling a thresholded gaussian kernel filter. """ distances_df = pd.read_csv(filepath_or_buffer=distances_path) sensor_ids = self.read_sensor_ids(sensor_ids_path) n_nodes = len(sensor_ids) adjacency_matrix = np.full(shape=(n_nodes, n_nodes), fill_value=np.inf, dtype=np.float32) sensor_id_to_idx = {} for idx, sensor_id in enumerate(sensor_ids): sensor_id_to_idx[sensor_id] = idx for _, row in distances_df.iterrows(): src, dst = int(row[0]), int(row[1]) value = row[2] if src in sensor_id_to_idx and dst in sensor_id_to_idx: adjacency_matrix[sensor_id_to_idx[src], sensor_id_to_idx[dst]] = value distances = adjacency_matrix[~np.isinf(adjacency_matrix)].flatten() std = distances.std() adjacency_matrix = np.exp(-np.square(adjacency_matrix / std + 1e-5)) adjacency_matrix[adjacency_matrix < self.normalized_k] = 0. return adjacency_matrix @staticmethod def read_sensor_ids(path: Union[str, Path]) -> List[str]: """ Reads the sensor id's from a file containing a list of comma-separated integers. Args: param path: The path to the file. Returns: A list of IDs. """ with open(path, "r") as input_file: sensor_ids = input_file.read() return list(map(int, sensor_ids.split(",")))
[ 6738, 3108, 8019, 1330, 10644, 198, 6738, 19720, 1330, 7343, 11, 32233, 11, 309, 29291, 11, 4479, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 628, 198, 4871, 350, 5232, 15262, 40, 78, 25, 198, 220, 220, 220, 37227, 32, 1398, 326, 32652, 15968, 1312, 14, 78, 4560, 3519, 284, 262, 2631, 5653, 12, 15262, 27039, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 961, 654, 25, 383, 1271, 286, 24654, 287, 262, 27039, 357, 1662, 284, 307, 1013, 917, 276, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 262, 27039, 4129, 737, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 3866, 1442, 62, 20214, 25, 383, 1271, 286, 2180, 640, 4831, 284, 2074, 618, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2615, 262, 41568, 7885, 13, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 37443, 62, 20214, 25, 383, 1271, 286, 1306, 640, 4831, 284, 762, 67, 959, 618, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2615, 262, 2496, 7885, 13, 198, 220, 220, 220, 220, 220, 220, 220, 39279, 62, 74, 25, 220, 383, 11387, 329, 30580, 262, 9224, 330, 1387, 17593, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1912, 319, 262, 11387, 276, 12822, 31562, 9720, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 949, 62, 83, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 464, 5288, 640, 2239, 523, 326, 22534, 262, 5002, 286, 198, 220, 220, 220, 220, 220, 220, 220, 6376, 949, 62, 83, 12, 77, 62, 3866, 1442, 62, 20214, 857, 407, 11454, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 1084, 7, 944, 13, 3866, 1442, 62, 8210, 1039, 4008, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 3509, 62, 83, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 464, 5415, 640, 2239, 523, 326, 22534, 262, 9766, 76, 429, 286, 198, 220, 220, 220, 220, 220, 220, 220, 6376, 3509, 62, 83, 10, 77, 62, 37443, 62, 20214, 857, 407, 11454, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 944, 13, 77, 62, 961, 654, 532, 2352, 7, 9806, 7, 944, 13, 37443, 62, 8210, 1039, 22305, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 825, 651, 62, 79, 5232, 62, 7890, 7, 944, 11, 1366, 62, 6978, 25, 965, 8, 4613, 309, 29291, 58, 37659, 13, 358, 18747, 11, 45941, 13, 358, 18747, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 8778, 262, 2631, 5653, 12, 15262, 1366, 13, 628, 220, 220, 220, 220, 220, 220, 220, 383, 4504, 3815, 1395, 357, 40890, 14, 79, 17407, 669, 14, 3866, 1442, 4831, 8, 290, 198, 220, 220, 220, 220, 220, 220, 220, 575, 357, 16793, 14, 19545, 4831, 8, 389, 286, 15268, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 7, 77, 62, 3849, 12786, 11, 299, 62, 3866, 1442, 62, 20214, 11, 299, 62, 77, 4147, 28, 26582, 11, 299, 62, 40890, 28, 18, 8, 198, 220, 220, 220, 220, 220, 220, 220, 575, 7, 77, 62, 3849, 12786, 11, 299, 62, 19545, 62, 20214, 11, 299, 62, 77, 4147, 28, 26582, 11, 299, 62, 40890, 28, 18, 8, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 62, 6978, 25, 383, 3108, 810, 262, 24654, 1366, 318, 8574, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 317, 46545, 7268, 262, 1395, 290, 575, 11192, 669, 13, 383, 717, 3895, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 318, 262, 2811, 2866, 287, 262, 642, 12, 1084, 1769, 16654, 11, 981, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1218, 389, 262, 2368, 389, 1711, 12, 1659, 12, 820, 290, 1110, 12, 1659, 12, 10464, 36525, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1366, 62, 7568, 796, 279, 67, 13, 961, 62, 40664, 7, 7753, 6978, 62, 273, 62, 22252, 28, 7890, 62, 6978, 11, 6376, 62, 4033, 28, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 11, 299, 62, 77, 4147, 796, 1366, 62, 7568, 13, 43358, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 13667, 286, 3815, 318, 657, 12, 3064, 11, 523, 2063, 15440, 357, 22468, 1433, 8, 318, 12876, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 45941, 13, 11201, 392, 62, 67, 12078, 7, 64, 28, 7890, 62, 7568, 13, 27160, 11, 16488, 10779, 16, 737, 459, 2981, 7, 37659, 13, 22468, 1433, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 685, 7890, 60, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 13667, 286, 3815, 318, 657, 12, 1954, 11, 523, 2063, 15440, 357, 19509, 8, 318, 12876, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1711, 62, 1659, 62, 820, 796, 14808, 7890, 62, 7568, 13, 9630, 13, 27160, 13, 459, 2981, 7203, 19608, 8079, 2414, 4943, 532, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 62, 7568, 13, 9630, 13, 27160, 13, 459, 2981, 7203, 19608, 8079, 2414, 58, 35, 30866, 4008, 1220, 4570, 405, 19415, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 459, 2981, 7, 600, 8, 4064, 1987, 198, 220, 220, 220, 220, 220, 220, 220, 1711, 62, 1659, 62, 820, 796, 45941, 13, 40927, 7, 9769, 62, 1659, 62, 820, 11, 685, 16, 11, 299, 62, 77, 4147, 11, 352, 35944, 7645, 3455, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 17, 11, 352, 11, 657, 29720, 459, 2981, 7, 37659, 13, 19509, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1366, 13, 33295, 7, 9769, 62, 1659, 62, 820, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1110, 62, 1659, 62, 10464, 796, 1366, 62, 7568, 13, 9630, 13, 459, 2981, 7203, 19608, 8079, 2414, 58, 5907, 60, 11074, 820, 1659, 10464, 198, 220, 220, 220, 220, 220, 220, 220, 1110, 62, 1659, 62, 10464, 796, 45941, 13, 40927, 7, 820, 62, 1659, 62, 10464, 11, 685, 16, 11, 299, 62, 77, 4147, 11, 352, 35944, 7645, 3455, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 17, 11, 352, 11, 657, 29720, 459, 2981, 7, 37659, 13, 19509, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1366, 13, 33295, 7, 820, 62, 1659, 62, 10464, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 45941, 13, 1102, 9246, 268, 378, 7, 7890, 11, 16488, 10779, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 11, 331, 796, 685, 4357, 17635, 628, 220, 220, 220, 220, 220, 220, 220, 36525, 62, 9521, 796, 2837, 7, 944, 13, 1084, 62, 83, 11, 2116, 13, 9806, 62, 83, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 685, 7890, 58, 83, 1343, 2116, 13, 3866, 1442, 62, 8210, 1039, 11, 2644, 60, 329, 256, 287, 36525, 62, 9521, 60, 198, 220, 220, 220, 220, 220, 220, 220, 331, 796, 685, 7890, 58, 83, 1343, 2116, 13, 37443, 62, 8210, 1039, 11, 2644, 60, 329, 256, 287, 36525, 62, 9521, 60, 628, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 45941, 13, 25558, 7, 3258, 592, 28, 87, 11, 16488, 28, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 331, 796, 45941, 13, 25558, 7, 3258, 592, 28, 88, 11, 16488, 28, 15, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 2124, 11, 331, 628, 220, 220, 220, 825, 7716, 62, 324, 30482, 1387, 62, 6759, 8609, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 11, 18868, 62, 6978, 25, 4479, 58, 2536, 11, 10644, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 2340, 62, 6978, 25, 4479, 58, 2536, 11, 10644, 12962, 4613, 45941, 13, 358, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2980, 689, 262, 9224, 330, 1387, 17593, 286, 257, 5253, 4823, 1262, 257, 198, 220, 220, 220, 220, 220, 220, 220, 11387, 276, 12822, 31562, 8106, 13, 198, 220, 220, 220, 220, 220, 220, 220, 3740, 1378, 12567, 13, 785, 14, 4528, 88, 11433, 648, 14, 35, 9419, 6144, 14, 2436, 672, 14, 9866, 14, 46521, 14, 5235, 62, 41255, 62, 36802, 13, 9078, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 18868, 62, 6978, 25, 383, 3108, 284, 262, 1366, 14535, 351, 1103, 12, 6344, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 18868, 1022, 15736, 11, 286, 1296, 357, 1462, 11, 422, 11, 1233, 737, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 2340, 62, 6978, 25, 383, 3108, 284, 262, 1366, 14535, 7268, 262, 32373, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 286, 477, 262, 15736, 287, 262, 2631, 5653, 3127, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 317, 299, 32152, 7177, 11, 543, 318, 262, 9224, 330, 1387, 17593, 7560, 416, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 598, 1359, 257, 11387, 276, 31986, 31562, 9720, 8106, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 18868, 62, 7568, 796, 279, 67, 13, 961, 62, 40664, 7, 7753, 6978, 62, 273, 62, 22252, 28, 17080, 1817, 62, 6978, 8, 198, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 2340, 796, 2116, 13, 961, 62, 82, 22854, 62, 2340, 7, 82, 22854, 62, 2340, 62, 6978, 8, 628, 220, 220, 220, 220, 220, 220, 220, 299, 62, 77, 4147, 796, 18896, 7, 82, 22854, 62, 2340, 8, 628, 220, 220, 220, 220, 220, 220, 220, 9224, 330, 1387, 62, 6759, 8609, 796, 45941, 13, 12853, 7, 43358, 16193, 77, 62, 77, 4147, 11, 299, 62, 77, 4147, 828, 6070, 62, 8367, 28, 37659, 13, 10745, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 288, 4906, 28, 37659, 13, 22468, 2624, 8, 628, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 312, 62, 1462, 62, 312, 87, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 329, 4686, 87, 11, 12694, 62, 312, 287, 27056, 378, 7, 82, 22854, 62, 2340, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 312, 62, 1462, 62, 312, 87, 58, 82, 22854, 62, 312, 60, 796, 4686, 87, 628, 220, 220, 220, 220, 220, 220, 220, 329, 4808, 11, 5752, 287, 18868, 62, 7568, 13, 2676, 8516, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12351, 11, 29636, 796, 493, 7, 808, 58, 15, 46570, 493, 7, 808, 58, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1988, 796, 5752, 58, 17, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 12351, 287, 12694, 62, 312, 62, 1462, 62, 312, 87, 290, 29636, 287, 12694, 62, 312, 62, 1462, 62, 312, 87, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9224, 330, 1387, 62, 6759, 8609, 58, 82, 22854, 62, 312, 62, 1462, 62, 312, 87, 58, 10677, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 312, 62, 1462, 62, 312, 87, 58, 67, 301, 11907, 796, 1988, 628, 220, 220, 220, 220, 220, 220, 220, 18868, 796, 9224, 330, 1387, 62, 6759, 8609, 58, 93, 37659, 13, 271, 10745, 7, 324, 30482, 1387, 62, 6759, 8609, 25295, 2704, 41769, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 14367, 796, 18868, 13, 19282, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 9224, 330, 1387, 62, 6759, 8609, 796, 45941, 13, 11201, 32590, 37659, 13, 23415, 7, 324, 30482, 1387, 62, 6759, 8609, 1220, 14367, 1343, 352, 68, 12, 20, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 9224, 330, 1387, 62, 6759, 8609, 58, 324, 30482, 1387, 62, 6759, 8609, 1279, 2116, 13, 11265, 1143, 62, 74, 60, 796, 657, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 9224, 330, 1387, 62, 6759, 8609, 628, 220, 220, 220, 2488, 12708, 24396, 198, 220, 220, 220, 825, 1100, 62, 82, 22854, 62, 2340, 7, 6978, 25, 4479, 58, 2536, 11, 10644, 12962, 4613, 7343, 58, 2536, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 4149, 82, 262, 12694, 4686, 338, 422, 257, 2393, 7268, 257, 1351, 286, 198, 220, 220, 220, 220, 220, 220, 220, 39650, 12, 25512, 515, 37014, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5772, 3108, 25, 383, 3108, 284, 262, 2393, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 317, 1351, 286, 32373, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 6978, 11, 366, 81, 4943, 355, 5128, 62, 7753, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12694, 62, 2340, 796, 5128, 62, 7753, 13, 961, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1351, 7, 8899, 7, 600, 11, 12694, 62, 2340, 13, 35312, 7, 2430, 22305, 198 ]
2.193205
2,443
import os import sciluigi as sl
[ 11748, 28686, 198, 11748, 629, 346, 84, 25754, 355, 1017, 628 ]
3
11
# vim: set ts=8 sts=2 sw=2 tw=99 et: # # This file is part of AMBuild. # # AMBuild is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # AMBuild is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with AMBuild. If not, see <http://www.gnu.org/licenses/>. from ambuild2 import nodetypes
[ 2, 43907, 25, 900, 40379, 28, 23, 39747, 28, 17, 1509, 28, 17, 665, 28, 2079, 2123, 25, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 3001, 15580, 13, 198, 2, 198, 2, 3001, 15580, 318, 1479, 3788, 25, 345, 460, 17678, 4163, 340, 290, 14, 273, 13096, 198, 2, 340, 739, 262, 2846, 286, 262, 22961, 3611, 5094, 13789, 355, 3199, 416, 198, 2, 262, 3232, 10442, 5693, 11, 2035, 2196, 513, 286, 262, 13789, 11, 393, 198, 2, 357, 265, 534, 3038, 8, 597, 1568, 2196, 13, 198, 2, 198, 2, 3001, 15580, 318, 9387, 287, 262, 2911, 326, 340, 481, 307, 4465, 11, 198, 2, 475, 42881, 15529, 34764, 56, 26, 1231, 772, 262, 17142, 18215, 286, 198, 2, 34482, 3398, 1565, 5603, 25382, 393, 376, 46144, 7473, 317, 16652, 2149, 37232, 33079, 48933, 13, 4091, 262, 198, 2, 22961, 3611, 5094, 13789, 329, 517, 3307, 13, 198, 2, 198, 2, 921, 815, 423, 2722, 257, 4866, 286, 262, 22961, 3611, 5094, 13789, 198, 2, 1863, 351, 3001, 15580, 13, 1002, 407, 11, 766, 1279, 4023, 1378, 2503, 13, 41791, 13, 2398, 14, 677, 4541, 15913, 13, 198, 6738, 4915, 3547, 17, 1330, 18666, 2963, 12272, 198 ]
3.587065
201
import flask from flask import Flask, jsonify, render_template, url_for, request, redirect, jsonify, send_from_directory from werkzeug.utils import secure_filename import pixellib from pixellib.torchbackend.instance import instanceSegmentation import os app = Flask(__name__) upload_folder = "static" os.makedirs(upload_folder, exist_ok=True) app.config["upload_folder"] = upload_folder ins = instanceSegmentation() ins.load_model("pointrend_resnet50.pkl") @app.route("/") @app.route("/segmentapi", methods = ["GET", "POST"]) @app.route("/segmentfrontend", methods = ["GET", "POST"]) @app.route('/images/<filename>') if __name__ == "__main__": app.run(host = "0.0.0.0", port = 5000)
[ 11748, 42903, 198, 6738, 42903, 1330, 46947, 11, 33918, 1958, 11, 8543, 62, 28243, 11, 19016, 62, 1640, 11, 2581, 11, 18941, 11, 33918, 1958, 11, 3758, 62, 6738, 62, 34945, 198, 6738, 266, 9587, 2736, 1018, 13, 26791, 1330, 5713, 62, 34345, 198, 11748, 279, 844, 695, 571, 198, 6738, 279, 844, 695, 571, 13, 13165, 354, 1891, 437, 13, 39098, 1330, 4554, 41030, 14374, 198, 11748, 28686, 198, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 198, 198, 25850, 62, 43551, 796, 366, 12708, 1, 198, 418, 13, 76, 4335, 17062, 7, 25850, 62, 43551, 11, 2152, 62, 482, 28, 17821, 8, 198, 198, 1324, 13, 11250, 14692, 25850, 62, 43551, 8973, 796, 9516, 62, 43551, 220, 198, 198, 1040, 796, 4554, 41030, 14374, 3419, 198, 1040, 13, 2220, 62, 19849, 7203, 4122, 10920, 62, 411, 3262, 1120, 13, 79, 41582, 4943, 198, 198, 31, 1324, 13, 38629, 7203, 14, 4943, 628, 198, 31, 1324, 13, 38629, 7203, 14, 325, 5154, 15042, 1600, 5050, 796, 14631, 18851, 1600, 366, 32782, 8973, 8, 198, 198, 31, 1324, 13, 38629, 7203, 14, 325, 5154, 8534, 437, 1600, 5050, 796, 14631, 18851, 1600, 366, 32782, 8973, 8, 198, 220, 220, 220, 220, 198, 198, 31, 1324, 13, 38629, 10786, 14, 17566, 14, 27, 34345, 29, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 598, 13, 5143, 7, 4774, 796, 366, 15, 13, 15, 13, 15, 13, 15, 1600, 2493, 796, 23336, 8 ]
2.751938
258
#!/usr/bin/env python # encoding: utf-8 __author__ = 'hasee' import socket import json if __name__ == '__main__': pass
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 21004, 25, 3384, 69, 12, 23, 198, 198, 834, 9800, 834, 796, 705, 71, 589, 68, 6, 198, 198, 11748, 17802, 198, 11748, 33918, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1208, 628 ]
2.433962
53
import pvlib as pv from datetime import datetime import pandas.plotting from analytics.location.path import LinearPath from analytics.solar_qualities.position import get_solar_position_time_range_track from analytics.plots.plot_solar_position import plot_elevation_azimuth from analytics.plots.plot_path import plot_path, plot_path_gmap from loguru import logger import pytz if __name__ == "__main__": main()
[ 11748, 279, 85, 8019, 355, 279, 85, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 11748, 19798, 292, 13, 29487, 889, 198, 6738, 23696, 13, 24886, 13, 6978, 1330, 44800, 15235, 198, 6738, 23696, 13, 82, 6192, 62, 13255, 871, 13, 9150, 1330, 651, 62, 82, 6192, 62, 9150, 62, 2435, 62, 9521, 62, 11659, 198, 6738, 23696, 13, 489, 1747, 13, 29487, 62, 82, 6192, 62, 9150, 1330, 7110, 62, 68, 2768, 341, 62, 1031, 320, 1071, 198, 6738, 23696, 13, 489, 1747, 13, 29487, 62, 6978, 1330, 7110, 62, 6978, 11, 7110, 62, 6978, 62, 70, 8899, 198, 6738, 2604, 14717, 1330, 49706, 198, 11748, 12972, 22877, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1388, 3419 ]
3.259843
127
import sys import os import torch import matplotlib.pylab as plt import numpy as np from TorchProteinLibrary.FullAtomModel import Angles2Coords from TorchProteinLibrary.FullAtomModel import Coords2TypedCoords from TorchProteinLibrary.FullAtomModel import Coords2CenteredCoords from TorchProteinLibrary.Volume import TypedCoords2Volume import _Volume if __name__=='__main__': num_atoms = 10 atom_coords = [] atom_types = [] for i in range(0,num_atoms): atom_coords.append(1.0 + np.random.rand(3)*110.0) atom_types.append(np.random.randint(low=0, high=11)) num_atoms_of_type = torch.zeros(1,11, dtype=torch.int) offsets = torch.zeros(1,11, dtype=torch.int) coords = torch.zeros(1, 3*num_atoms, dtype=torch.double) potential = torch.zeros(1,11,120,120,120, dtype=torch.float, device='cuda') for i in range(0,120): potential[0,:,i,:,:] = float(i)/float(120.0) - 0.5 for atom_type in range(0,11): for i, atom in enumerate(atom_types): if atom == atom_type: num_atoms_of_type[0,atom_type]+=1 if atom_type>0: offsets[0, atom_type] = offsets[0, atom_type-1] + num_atoms_of_type[0, atom_type-1] current_num_atoms_of_type = [0 for i in range(11)] for i, r in enumerate(atom_coords): index = 3*offsets[0, atom_types[i]] + 3*current_num_atoms_of_type[atom_types[i]] coords[0, index + 0 ] = r[0] coords[0, index + 1 ] = r[1] coords[0, index + 2 ] = r[2] current_num_atoms_of_type[atom_types[i]] += 1 print('Test setting:') for i, atom_type in enumerate(atom_types): print('Type = ', atom_type, 'Coords = ', atom_coords[i][0], atom_coords[i][1], atom_coords[i][2]) for i in range(0,11): print('Type = ', i, 'Num atoms of type = ', num_atoms_of_type[0,i], 'Offset = ', offsets[0,i]) coords.requires_grad_() potential.requires_grad_() tc2v = TypedCoords2Volume() density = tc2v(coords.cuda(), num_atoms_of_type.cuda(), offsets.cuda()) E_0 = torch.sum(density*potential) E_0.backward() grad_an = torch.zeros(coords.grad.size(), dtype=torch.double, device='cpu').copy_(coords.grad.data) grad_num = [] x_1 = torch.zeros(1, 3*num_atoms, dtype=torch.double, device='cpu').requires_grad_() dx = 0.01 for i in range(0,3*num_atoms): x_1.data.copy_(coords.data) x_1.data[0,i] += dx density = tc2v(x_1.cuda(), num_atoms_of_type.cuda(), offsets.cuda()) E_1 = torch.sum(density*potential) grad_num.append( (E_1.data - E_0.data)/dx ) fig = plt.figure() plt.plot(grad_num, 'r.-', label = 'num grad') plt.plot(grad_an[0,:].numpy(),'bo', label = 'an grad') plt.legend() plt.savefig('TestFig/test_backward.png')
[ 11748, 25064, 198, 11748, 28686, 198, 11748, 28034, 198, 11748, 2603, 29487, 8019, 13, 79, 2645, 397, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 34868, 47, 35574, 23377, 13, 13295, 2953, 296, 17633, 1330, 2895, 829, 17, 7222, 3669, 198, 6738, 34868, 47, 35574, 23377, 13, 13295, 2953, 296, 17633, 1330, 1766, 3669, 17, 31467, 276, 7222, 3669, 198, 6738, 34868, 47, 35574, 23377, 13, 13295, 2953, 296, 17633, 1330, 1766, 3669, 17, 19085, 1068, 7222, 3669, 198, 6738, 34868, 47, 35574, 23377, 13, 31715, 1330, 17134, 276, 7222, 3669, 17, 31715, 198, 198, 11748, 4808, 31715, 198, 198, 361, 11593, 3672, 834, 855, 6, 834, 12417, 834, 10354, 628, 197, 22510, 62, 265, 3150, 796, 838, 198, 197, 37696, 62, 1073, 3669, 796, 17635, 198, 197, 37696, 62, 19199, 796, 17635, 198, 197, 1640, 1312, 287, 2837, 7, 15, 11, 22510, 62, 265, 3150, 2599, 198, 197, 197, 37696, 62, 1073, 3669, 13, 33295, 7, 16, 13, 15, 1343, 45941, 13, 25120, 13, 25192, 7, 18, 27493, 11442, 13, 15, 8, 198, 197, 197, 37696, 62, 19199, 13, 33295, 7, 37659, 13, 25120, 13, 25192, 600, 7, 9319, 28, 15, 11, 1029, 28, 1157, 4008, 198, 197, 220, 220, 198, 197, 22510, 62, 265, 3150, 62, 1659, 62, 4906, 796, 28034, 13, 9107, 418, 7, 16, 11, 1157, 11, 288, 4906, 28, 13165, 354, 13, 600, 8, 198, 197, 8210, 1039, 796, 28034, 13, 9107, 418, 7, 16, 11, 1157, 11, 288, 4906, 28, 13165, 354, 13, 600, 8, 198, 197, 1073, 3669, 796, 28034, 13, 9107, 418, 7, 16, 11, 513, 9, 22510, 62, 265, 3150, 11, 288, 4906, 28, 13165, 354, 13, 23352, 8, 198, 197, 13059, 1843, 796, 28034, 13, 9107, 418, 7, 16, 11, 1157, 11, 10232, 11, 10232, 11, 10232, 11, 288, 4906, 28, 13165, 354, 13, 22468, 11, 3335, 11639, 66, 15339, 11537, 198, 197, 1640, 1312, 287, 2837, 7, 15, 11, 10232, 2599, 198, 197, 197, 13059, 1843, 58, 15, 11, 45299, 72, 11, 45299, 47715, 796, 12178, 7, 72, 20679, 22468, 7, 10232, 13, 15, 8, 532, 657, 13, 20, 628, 197, 1640, 22037, 62, 4906, 287, 2837, 7, 15, 11, 1157, 2599, 198, 197, 197, 198, 197, 197, 1640, 1312, 11, 22037, 287, 27056, 378, 7, 37696, 62, 19199, 2599, 198, 197, 197, 197, 361, 22037, 6624, 22037, 62, 4906, 25, 198, 197, 197, 197, 197, 22510, 62, 265, 3150, 62, 1659, 62, 4906, 58, 15, 11, 37696, 62, 4906, 60, 47932, 16, 198, 197, 197, 198, 197, 197, 361, 22037, 62, 4906, 29, 15, 25, 198, 197, 197, 197, 8210, 1039, 58, 15, 11, 22037, 62, 4906, 60, 796, 49005, 58, 15, 11, 22037, 62, 4906, 12, 16, 60, 1343, 997, 62, 265, 3150, 62, 1659, 62, 4906, 58, 15, 11, 22037, 62, 4906, 12, 16, 60, 198, 197, 198, 197, 14421, 62, 22510, 62, 265, 3150, 62, 1659, 62, 4906, 796, 685, 15, 329, 1312, 287, 2837, 7, 1157, 15437, 198, 197, 1640, 1312, 11, 374, 287, 27056, 378, 7, 37696, 62, 1073, 3669, 2599, 198, 197, 197, 9630, 796, 513, 9, 8210, 1039, 58, 15, 11, 22037, 62, 19199, 58, 72, 11907, 1343, 513, 9, 14421, 62, 22510, 62, 265, 3150, 62, 1659, 62, 4906, 58, 37696, 62, 19199, 58, 72, 11907, 198, 197, 197, 1073, 3669, 58, 15, 11, 6376, 1343, 657, 2361, 796, 374, 58, 15, 60, 198, 197, 197, 1073, 3669, 58, 15, 11, 6376, 1343, 352, 2361, 796, 374, 58, 16, 60, 198, 197, 197, 1073, 3669, 58, 15, 11, 6376, 1343, 362, 2361, 796, 374, 58, 17, 60, 198, 197, 197, 14421, 62, 22510, 62, 265, 3150, 62, 1659, 62, 4906, 58, 37696, 62, 19199, 58, 72, 11907, 15853, 352, 628, 197, 4798, 10786, 14402, 4634, 25, 11537, 198, 197, 1640, 1312, 11, 22037, 62, 4906, 287, 27056, 378, 7, 37696, 62, 19199, 2599, 198, 197, 197, 4798, 10786, 6030, 796, 46083, 22037, 62, 4906, 11, 705, 7222, 3669, 796, 46083, 22037, 62, 1073, 3669, 58, 72, 7131, 15, 4357, 22037, 62, 1073, 3669, 58, 72, 7131, 16, 4357, 22037, 62, 1073, 3669, 58, 72, 7131, 17, 12962, 198, 197, 198, 197, 1640, 1312, 287, 2837, 7, 15, 11, 1157, 2599, 198, 197, 197, 4798, 10786, 6030, 796, 46083, 1312, 11, 705, 33111, 23235, 286, 2099, 796, 46083, 997, 62, 265, 3150, 62, 1659, 62, 4906, 58, 15, 11, 72, 4357, 705, 34519, 796, 46083, 49005, 58, 15, 11, 72, 12962, 628, 197, 1073, 3669, 13, 47911, 62, 9744, 62, 3419, 198, 197, 13059, 1843, 13, 47911, 62, 9744, 62, 3419, 198, 197, 198, 197, 23047, 17, 85, 796, 17134, 276, 7222, 3669, 17, 31715, 3419, 198, 197, 43337, 796, 37096, 17, 85, 7, 1073, 3669, 13, 66, 15339, 22784, 997, 62, 265, 3150, 62, 1659, 62, 4906, 13, 66, 15339, 22784, 49005, 13, 66, 15339, 28955, 198, 197, 36, 62, 15, 796, 28034, 13, 16345, 7, 43337, 9, 13059, 1843, 8, 198, 197, 36, 62, 15, 13, 1891, 904, 3419, 198, 197, 9744, 62, 272, 796, 28034, 13, 9107, 418, 7, 1073, 3669, 13, 9744, 13, 7857, 22784, 288, 4906, 28, 13165, 354, 13, 23352, 11, 3335, 11639, 36166, 27691, 30073, 41052, 1073, 3669, 13, 9744, 13, 7890, 8, 628, 197, 9744, 62, 22510, 796, 17635, 198, 197, 87, 62, 16, 796, 28034, 13, 9107, 418, 7, 16, 11, 513, 9, 22510, 62, 265, 3150, 11, 288, 4906, 28, 13165, 354, 13, 23352, 11, 3335, 11639, 36166, 27691, 47911, 62, 9744, 62, 3419, 198, 197, 34350, 796, 657, 13, 486, 198, 197, 1640, 1312, 287, 2837, 7, 15, 11, 18, 9, 22510, 62, 265, 3150, 2599, 198, 197, 197, 87, 62, 16, 13, 7890, 13, 30073, 41052, 1073, 3669, 13, 7890, 8, 198, 197, 197, 87, 62, 16, 13, 7890, 58, 15, 11, 72, 60, 15853, 44332, 198, 197, 197, 198, 197, 197, 43337, 796, 37096, 17, 85, 7, 87, 62, 16, 13, 66, 15339, 22784, 997, 62, 265, 3150, 62, 1659, 62, 4906, 13, 66, 15339, 22784, 49005, 13, 66, 15339, 28955, 198, 197, 197, 36, 62, 16, 796, 28034, 13, 16345, 7, 43337, 9, 13059, 1843, 8, 198, 197, 197, 9744, 62, 22510, 13, 33295, 7, 357, 36, 62, 16, 13, 7890, 532, 412, 62, 15, 13, 7890, 20679, 34350, 1267, 628, 198, 197, 5647, 796, 458, 83, 13, 26875, 3419, 198, 197, 489, 83, 13, 29487, 7, 9744, 62, 22510, 11, 705, 81, 7874, 3256, 6167, 796, 705, 22510, 3915, 11537, 198, 197, 489, 83, 13, 29487, 7, 9744, 62, 272, 58, 15, 11, 25, 4083, 77, 32152, 22784, 6, 2127, 3256, 6167, 796, 705, 272, 3915, 11537, 198, 197, 489, 83, 13, 1455, 437, 3419, 198, 197, 489, 83, 13, 21928, 5647, 10786, 14402, 14989, 14, 9288, 62, 1891, 904, 13, 11134, 11537, 198 ]
2.281802
1,132
""" Test various halo profile properties. """ from halomod.concentration import Bullock01Power from halomod import profiles as pf from halomod import TracerHaloModel import pytest import numpy as np bullock = Bullock01Power(ms=1e12) m = np.logspace(10, 15, 100) r = np.logspace(-2, 2, 20) class NFWnum(pf.Profile): """Test the numerical integration against analytical.""" class NFWnumInf(pf.ProfileInf): """Test the numerical integration against analytical.""" @pytest.fixture(scope="module") @pytest.fixture(scope="module") @pytest.mark.parametrize( "profile", ( pf.NFW, pf.NFWInf, pf.CoredNFW, pf.Einasto, pf.GeneralizedNFW, pf.GeneralizedNFWInf, pf.Hernquist, pf.Moore, pf.MooreInf, pf.PowerLawWithExpCut, ), ) @pytest.mark.parametrize( "profile", ( pf.NFW, pf.NFWInf, pf.CoredNFW, pf.Einasto, pf.GeneralizedNFW, pf.GeneralizedNFWInf, pf.Hernquist, pf.Moore, pf.MooreInf, pf.PowerLawWithExpCut, ), ) @pytest.mark.parametrize( "profile", ( pf.NFW, pf.NFWInf, pf.CoredNFW, pf.Einasto, pf.GeneralizedNFW, pf.GeneralizedNFWInf, pf.Hernquist, pf.Moore, pf.MooreInf, # pf.PowerLawWithExpCut, ), ) @pytest.mark.parametrize( "profile", ( pf.NFW, # pf.NFWInf, infinite profile can't be normalised by mass. pf.CoredNFW, pf.Einasto, pf.GeneralizedNFW, # pf.GeneralizedNFWInf, pf.Hernquist, pf.Moore, # pf.MooreInf, ), ) def test_ukm_low_k(profile): """Test that all fourier transforms, when normalised by mass, are 1 at low k""" k = np.array([1e-10]) m = np.logspace(10, 18, 100) prof = profile(bullock) assert np.allclose(prof.u(k, m, norm="m"), 1, rtol=1e-3)
[ 37811, 198, 14402, 2972, 289, 7335, 7034, 6608, 13, 198, 37811, 198, 6738, 10284, 296, 375, 13, 1102, 1087, 1358, 1330, 8266, 735, 486, 13434, 198, 6738, 10284, 296, 375, 1330, 16545, 355, 279, 69, 198, 6738, 10284, 296, 375, 1330, 833, 11736, 39, 7335, 17633, 198, 11748, 12972, 9288, 198, 11748, 299, 32152, 355, 45941, 198, 198, 16308, 735, 796, 8266, 735, 486, 13434, 7, 907, 28, 16, 68, 1065, 8, 198, 76, 796, 45941, 13, 6404, 13200, 7, 940, 11, 1315, 11, 1802, 8, 198, 81, 796, 45941, 13, 6404, 13200, 32590, 17, 11, 362, 11, 1160, 8, 628, 198, 4871, 399, 24160, 22510, 7, 79, 69, 13, 37046, 2599, 198, 220, 220, 220, 37227, 14402, 262, 29052, 11812, 1028, 30063, 526, 15931, 628, 198, 4871, 399, 24160, 22510, 18943, 7, 79, 69, 13, 37046, 18943, 2599, 198, 220, 220, 220, 37227, 14402, 262, 29052, 11812, 1028, 30063, 526, 15931, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 69, 9602, 7, 29982, 2625, 21412, 4943, 628, 198, 31, 9078, 9288, 13, 4102, 13, 17143, 316, 380, 2736, 7, 198, 220, 220, 220, 366, 13317, 1600, 198, 220, 220, 220, 357, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 34, 1850, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 36, 259, 459, 78, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 39, 1142, 30062, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 13434, 16966, 3152, 16870, 26254, 11, 198, 220, 220, 220, 10612, 198, 8, 628, 198, 31, 9078, 9288, 13, 4102, 13, 17143, 316, 380, 2736, 7, 198, 220, 220, 220, 366, 13317, 1600, 198, 220, 220, 220, 357, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 34, 1850, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 36, 259, 459, 78, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 39, 1142, 30062, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 13434, 16966, 3152, 16870, 26254, 11, 198, 220, 220, 220, 10612, 198, 8, 628, 198, 31, 9078, 9288, 13, 4102, 13, 17143, 316, 380, 2736, 7, 198, 220, 220, 220, 366, 13317, 1600, 198, 220, 220, 220, 357, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 34, 1850, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 36, 259, 459, 78, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 39, 1142, 30062, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 279, 69, 13, 13434, 16966, 3152, 16870, 26254, 11, 198, 220, 220, 220, 10612, 198, 8, 628, 198, 31, 9078, 9288, 13, 4102, 13, 17143, 316, 380, 2736, 7, 198, 220, 220, 220, 366, 13317, 1600, 198, 220, 220, 220, 357, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 21870, 54, 18943, 11, 220, 15541, 7034, 460, 470, 307, 3487, 1417, 416, 2347, 13, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 34, 1850, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 36, 259, 459, 78, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 12218, 1143, 21870, 54, 18943, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 39, 1142, 30062, 11, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 279, 69, 13, 40049, 18943, 11, 198, 220, 220, 220, 10612, 198, 8, 198, 4299, 1332, 62, 2724, 76, 62, 9319, 62, 74, 7, 13317, 2599, 198, 220, 220, 220, 37227, 14402, 326, 477, 46287, 5277, 31408, 11, 618, 3487, 1417, 416, 2347, 11, 389, 352, 379, 1877, 479, 37811, 198, 220, 220, 220, 479, 796, 45941, 13, 18747, 26933, 16, 68, 12, 940, 12962, 198, 220, 220, 220, 285, 796, 45941, 13, 6404, 13200, 7, 940, 11, 1248, 11, 1802, 8, 628, 220, 220, 220, 1534, 796, 7034, 7, 16308, 735, 8, 628, 220, 220, 220, 6818, 45941, 13, 439, 19836, 7, 5577, 13, 84, 7, 74, 11, 285, 11, 2593, 2625, 76, 12340, 352, 11, 374, 83, 349, 28, 16, 68, 12, 18, 8, 628, 628, 628, 198 ]
1.886148
1,054
# EXECUTION TIME: 4s # Python 3 ImportError import sys sys.path.append('.') import numpy as np import matplotlib.pyplot as plt import seaborn as sns import src as ya from sklearn import tree import graphviz # prettify plots plt.rcParams['font.family'] = 'Times New Roman' sns.set_style({"xtick.direction": "in", "ytick.direction": "in"}) b_sns, g_sns, r_sns, p_sns, y_sns, l_sns = sns.color_palette("muted") np.random.seed(0) # fetch data data_train, data_query = ya.data.getData('Toy_Spiral') N, D = data_train.shape ########################################################################### # Visualize Leaf Distributions ########################################################################### # Supervised Data X_train, y_train = data_train[:, :-1], data_train[:, -1] # Decision Tree Classifier Training clf = tree.DecisionTreeClassifier(criterion='entropy', max_depth=5, min_samples_split=5, min_impurity_decrease=0.05 ).fit(X_train, y_train) ########################################################################### # Grow a Tree - Visualize Leaf Distributions ########################################################################### # Leave Indexes leaves_idx = (clf.tree_.children_left == -1) & (clf.tree_.children_right == -1) # Number of samples at leaves leaves_values = np.squeeze(clf.tree_.value[leaves_idx], axis=1) # Leaves Distributions leaves_dist = np.apply_along_axis(lambda r: r/np.sum(r), 1, leaves_values) # num_leaves ncols = 4 nrows = 2 plt.rcParams['figure.figsize'] = [4.0 * ncols, 4.0 * nrows] num_leaves = nrows * ncols # check if leaves available for visualization assert(leaves_dist.shape[0] >= num_leaves) # matplotlib figure fig, axes = plt.subplots(nrows=nrows, ncols=ncols) # x-axis bins bins = np.unique(y_train).astype(int) # maximum y-axis value ymax = np.max(leaves_dist) # for_idx = np.random.choice(len(leaves_dist), num_leaves, False) for_idx = range(len(leaves_dist)) for j, ax in enumerate(axes.flatten()): ax.bar(bins, 100*leaves_dist[for_idx[j]], color=[b_sns, g_sns, r_sns]) ax.set_title('Class histogram of\n$\\mathbf{Leaf\\ %i}$' % (j+1)) ax.set_xlim([0.5, 3.5]) ax.set_ylim([0, ymax*105]) ax.set_xticks(bins) plt.tight_layout() fig.savefig('assets/1.3/leaf_cdist.pdf', format='pdf', dpi=300, transparent=True, bbox_inches='tight', pad_inches=0.01) ########################################################################### # Visualize Tree - Using `graphviz` ########################################################################### # dot graph dot_data = tree.export_graphviz(clf, out_file=None, feature_names=['X1', 'X2'], filled=True, rounded=True, special_characters=True) graph = graphviz.Source(dot_data) graph.render("assets/1.3/graph")
[ 2, 7788, 2943, 35354, 20460, 25, 604, 82, 198, 198, 2, 11361, 513, 17267, 12331, 198, 11748, 25064, 198, 17597, 13, 6978, 13, 33295, 10786, 2637, 8, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 384, 397, 1211, 355, 3013, 82, 198, 198, 11748, 12351, 355, 21349, 198, 6738, 1341, 35720, 1330, 5509, 198, 11748, 4823, 85, 528, 198, 198, 2, 46442, 1958, 21528, 198, 489, 83, 13, 6015, 10044, 4105, 17816, 10331, 13, 17989, 20520, 796, 705, 28595, 968, 7993, 6, 198, 82, 5907, 13, 2617, 62, 7635, 7, 4895, 742, 624, 13, 37295, 1298, 366, 259, 1600, 366, 20760, 624, 13, 37295, 1298, 366, 259, 20662, 8, 198, 198, 65, 62, 82, 5907, 11, 308, 62, 82, 5907, 11, 374, 62, 82, 5907, 11, 279, 62, 82, 5907, 11, 331, 62, 82, 5907, 11, 300, 62, 82, 5907, 796, 3013, 82, 13, 8043, 62, 18596, 5857, 7203, 76, 7241, 4943, 198, 198, 37659, 13, 25120, 13, 28826, 7, 15, 8, 198, 198, 2, 21207, 1366, 198, 7890, 62, 27432, 11, 1366, 62, 22766, 796, 21349, 13, 7890, 13, 1136, 6601, 10786, 48236, 62, 50, 4063, 282, 11537, 198, 45, 11, 360, 796, 1366, 62, 27432, 13, 43358, 198, 198, 29113, 29113, 7804, 21017, 198, 2, 15612, 1096, 14697, 46567, 507, 198, 29113, 29113, 7804, 21017, 198, 198, 2, 3115, 16149, 6060, 198, 55, 62, 27432, 11, 331, 62, 27432, 796, 1366, 62, 27432, 58, 45299, 1058, 12, 16, 4357, 1366, 62, 27432, 58, 45299, 532, 16, 60, 198, 198, 2, 26423, 12200, 5016, 7483, 13614, 198, 565, 69, 796, 5509, 13, 10707, 1166, 27660, 9487, 7483, 7, 22213, 28019, 11639, 298, 28338, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 18053, 28, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 949, 62, 82, 12629, 62, 35312, 28, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 949, 62, 11011, 1684, 62, 12501, 260, 589, 28, 15, 13, 2713, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6739, 11147, 7, 55, 62, 27432, 11, 331, 62, 27432, 8, 198, 198, 29113, 29113, 7804, 21017, 198, 2, 26936, 257, 12200, 532, 15612, 1096, 14697, 46567, 507, 198, 29113, 29113, 7804, 21017, 198, 198, 2, 17446, 12901, 274, 198, 293, 3080, 62, 312, 87, 796, 357, 565, 69, 13, 21048, 44807, 17197, 62, 9464, 6624, 532, 16, 8, 1222, 357, 565, 69, 13, 21048, 44807, 17197, 62, 3506, 6624, 532, 16, 8, 198, 198, 2, 7913, 286, 8405, 379, 5667, 198, 293, 3080, 62, 27160, 796, 45941, 13, 16485, 1453, 2736, 7, 565, 69, 13, 21048, 44807, 8367, 58, 293, 3080, 62, 312, 87, 4357, 16488, 28, 16, 8, 198, 198, 2, 46597, 46567, 507, 198, 293, 3080, 62, 17080, 796, 45941, 13, 39014, 62, 24176, 62, 22704, 7, 50033, 374, 25, 374, 14, 37659, 13, 16345, 7, 81, 828, 352, 11, 5667, 62, 27160, 8, 198, 198, 2, 997, 62, 293, 3080, 198, 77, 4033, 82, 796, 604, 198, 77, 8516, 796, 362, 198, 489, 83, 13, 6015, 10044, 4105, 17816, 26875, 13, 5647, 7857, 20520, 796, 685, 19, 13, 15, 1635, 299, 4033, 82, 11, 604, 13, 15, 1635, 299, 8516, 60, 198, 22510, 62, 293, 3080, 796, 299, 8516, 1635, 299, 4033, 82, 198, 2, 2198, 611, 5667, 1695, 329, 32704, 198, 30493, 7, 293, 3080, 62, 17080, 13, 43358, 58, 15, 60, 18189, 997, 62, 293, 3080, 8, 198, 198, 2, 2603, 29487, 8019, 3785, 198, 5647, 11, 34197, 796, 458, 83, 13, 7266, 489, 1747, 7, 77, 8516, 28, 77, 8516, 11, 299, 4033, 82, 28, 77, 4033, 82, 8, 198, 198, 2, 2124, 12, 22704, 41701, 198, 65, 1040, 796, 45941, 13, 34642, 7, 88, 62, 27432, 737, 459, 2981, 7, 600, 8, 198, 2, 5415, 331, 12, 22704, 1988, 198, 4948, 897, 796, 45941, 13, 9806, 7, 293, 3080, 62, 17080, 8, 198, 2, 329, 62, 312, 87, 796, 45941, 13, 25120, 13, 25541, 7, 11925, 7, 293, 3080, 62, 17080, 828, 997, 62, 293, 3080, 11, 10352, 8, 198, 1640, 62, 312, 87, 796, 2837, 7, 11925, 7, 293, 3080, 62, 17080, 4008, 198, 1640, 474, 11, 7877, 287, 27056, 378, 7, 897, 274, 13, 2704, 41769, 3419, 2599, 198, 220, 220, 220, 7877, 13, 5657, 7, 65, 1040, 11, 1802, 9, 293, 3080, 62, 17080, 58, 1640, 62, 312, 87, 58, 73, 60, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3124, 41888, 65, 62, 82, 5907, 11, 308, 62, 82, 5907, 11, 374, 62, 82, 5907, 12962, 198, 220, 220, 220, 7877, 13, 2617, 62, 7839, 10786, 9487, 1554, 21857, 286, 59, 77, 3, 6852, 11018, 19881, 90, 3123, 1878, 6852, 4064, 72, 92, 3, 6, 4064, 357, 73, 10, 16, 4008, 198, 220, 220, 220, 7877, 13, 2617, 62, 87, 2475, 26933, 15, 13, 20, 11, 513, 13, 20, 12962, 198, 220, 220, 220, 7877, 13, 2617, 62, 88, 2475, 26933, 15, 11, 331, 9806, 9, 13348, 12962, 198, 220, 220, 220, 7877, 13, 2617, 62, 742, 3378, 7, 65, 1040, 8, 198, 489, 83, 13, 33464, 62, 39786, 3419, 198, 198, 5647, 13, 21928, 5647, 10786, 19668, 14, 16, 13, 18, 14, 33201, 62, 10210, 396, 13, 12315, 3256, 5794, 11639, 12315, 3256, 288, 14415, 28, 6200, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13245, 28, 17821, 11, 275, 3524, 62, 45457, 11639, 33464, 3256, 14841, 62, 45457, 28, 15, 13, 486, 8, 198, 198, 29113, 29113, 7804, 21017, 198, 2, 15612, 1096, 12200, 532, 8554, 4600, 34960, 85, 528, 63, 198, 29113, 29113, 7804, 21017, 198, 198, 2, 16605, 4823, 198, 26518, 62, 7890, 796, 5509, 13, 39344, 62, 34960, 85, 528, 7, 565, 69, 11, 503, 62, 7753, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3895, 62, 14933, 28, 17816, 55, 16, 3256, 705, 55, 17, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5901, 28, 17821, 11, 19273, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2041, 62, 10641, 19858, 28, 17821, 8, 198, 34960, 796, 4823, 85, 528, 13, 7416, 7, 26518, 62, 7890, 8, 198, 34960, 13, 13287, 7203, 19668, 14, 16, 13, 18, 14, 34960, 4943, 198 ]
2.444988
1,227
from kombu import Connection
[ 6738, 479, 2381, 84, 1330, 26923 ]
4.666667
6
# translate.py # Author: Elias Rubin import requests from config import * def parse_body(body_text): """ param: body_text :: string """ try: split_text = body_text.rsplit(" ") source_lang = split_text[0] target_lang = split_text[1] query_string = " ".join(split_text[2:]) except Exception: query_string = """Message not well formed. Message should be of form: [source lang] [target lang] [query]""" source_lang = "la" target_lang = "en" return query_string, source_lang, target_lang def query_translate_api(query_string, source_lang=None, target_lang=None): """ param: query string :: string containing the text to translate param: source_lang :: string identifying the language to translate from english by default param: target_lang :: string indentifying the language to translate to spanish by default query the google translate API for a translation of the query string. returns a request.models.Response object """ if source_lang is None: source_lang = 'en' if target_lang is None: target_lang = 'es' try: source_lang = LANGUAGES[source_lang] except KeyError: print "using user input source language: {}".format(source_lang) pass try: target_lang = LANGUAGES[target_lang] except KeyError: print "using user input target language: {}".format(target_lang) pass payload = {'key': GOOGLE_TRANSLATE_SECRET_KEY, 'q': query_string, 'source': source_lang, 'target': target_lang} r = requests.get("https://www.googleapis.com/language/translate/v2?", params=payload) return r
[ 2, 15772, 13, 9078, 198, 2, 6434, 25, 41462, 34599, 198, 11748, 7007, 198, 6738, 4566, 1330, 1635, 628, 198, 4299, 21136, 62, 2618, 7, 2618, 62, 5239, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5772, 25, 1767, 62, 5239, 7904, 4731, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 6626, 62, 5239, 796, 1767, 62, 5239, 13, 3808, 489, 270, 7203, 366, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2723, 62, 17204, 796, 6626, 62, 5239, 58, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2496, 62, 17204, 796, 6626, 62, 5239, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 12405, 62, 8841, 796, 366, 27071, 22179, 7, 35312, 62, 5239, 58, 17, 25, 12962, 628, 220, 220, 220, 2845, 35528, 25, 198, 220, 220, 220, 220, 220, 220, 220, 12405, 62, 8841, 796, 37227, 12837, 407, 880, 7042, 13, 16000, 815, 307, 286, 1296, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 10459, 42392, 60, 685, 16793, 42392, 60, 685, 22766, 60, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 2723, 62, 17204, 796, 366, 5031, 1, 198, 220, 220, 220, 220, 220, 220, 220, 2496, 62, 17204, 796, 366, 268, 1, 628, 220, 220, 220, 1441, 12405, 62, 8841, 11, 2723, 62, 17204, 11, 2496, 62, 17204, 628, 198, 4299, 12405, 62, 7645, 17660, 62, 15042, 7, 22766, 62, 8841, 11, 2723, 62, 17204, 28, 14202, 11, 2496, 62, 17204, 28, 14202, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5772, 25, 12405, 4731, 7904, 4731, 7268, 262, 2420, 284, 15772, 198, 220, 220, 220, 220, 220, 220, 220, 5772, 25, 2723, 62, 17204, 7904, 4731, 13720, 262, 3303, 284, 15772, 422, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 46932, 416, 4277, 198, 220, 220, 220, 220, 220, 220, 220, 5772, 25, 2496, 62, 17204, 7904, 4731, 33793, 4035, 262, 3303, 284, 15772, 284, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 599, 7115, 416, 4277, 198, 220, 220, 220, 220, 220, 220, 220, 12405, 262, 23645, 15772, 7824, 329, 257, 11059, 286, 262, 12405, 4731, 13, 198, 220, 220, 220, 220, 220, 220, 220, 5860, 257, 2581, 13, 27530, 13, 31077, 2134, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 611, 2723, 62, 17204, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2723, 62, 17204, 796, 705, 268, 6, 198, 220, 220, 220, 611, 2496, 62, 17204, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2496, 62, 17204, 796, 705, 274, 6, 628, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2723, 62, 17204, 796, 406, 15567, 52, 25552, 58, 10459, 62, 17204, 60, 198, 220, 220, 220, 2845, 7383, 12331, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 366, 3500, 2836, 5128, 2723, 3303, 25, 23884, 1911, 18982, 7, 10459, 62, 17204, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1208, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2496, 62, 17204, 796, 406, 15567, 52, 25552, 58, 16793, 62, 17204, 60, 198, 220, 220, 220, 2845, 7383, 12331, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 366, 3500, 2836, 5128, 2496, 3303, 25, 23884, 1911, 18982, 7, 16793, 62, 17204, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1208, 628, 220, 220, 220, 21437, 796, 1391, 6, 2539, 10354, 402, 6684, 38, 2538, 62, 5446, 1565, 8634, 6158, 62, 23683, 26087, 62, 20373, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 80, 10354, 12405, 62, 8841, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 10459, 10354, 2723, 62, 17204, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 16793, 10354, 2496, 62, 17204, 92, 198, 220, 220, 220, 374, 796, 7007, 13, 1136, 7203, 5450, 1378, 2503, 13, 13297, 499, 271, 13, 785, 14, 16129, 14, 7645, 17660, 14, 85, 17, 35379, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42287, 28, 15577, 2220, 8, 198, 220, 220, 220, 1441, 374, 628 ]
2.385214
771
from django.core.management.base import BaseCommand from django.db import transaction from hours.models import Resource
[ 6738, 42625, 14208, 13, 7295, 13, 27604, 13, 8692, 1330, 7308, 21575, 198, 6738, 42625, 14208, 13, 9945, 1330, 8611, 198, 198, 6738, 2250, 13, 27530, 1330, 20857, 628 ]
4.206897
29
from z3 import * from ModelParser import ModelParser import argparse from configparser import ConfigParser import time from DeplGenerator import DeplGenerator # A = ['A1','A2','A3'] # D = [2,2,2] # C = [['A1','A2']] # S = [[['A1','A2'], ['A3']]] # H = {} # num_nodes = 3 HOSTCONF = '/usr/local/riaps/etc/riaps-hosts.conf' HWSPEC = '/home/riaps/workspace/ResilientDeploymentSolver/hardware-spec.conf' # Create a "matrix" (list of lists) of integer variables # Add range constraints if __name__ == '__main__': main()
[ 6738, 1976, 18, 1330, 1635, 198, 6738, 9104, 46677, 1330, 9104, 46677, 198, 11748, 1822, 29572, 198, 6738, 4566, 48610, 1330, 17056, 46677, 198, 11748, 640, 198, 6738, 1024, 489, 8645, 1352, 1330, 1024, 489, 8645, 1352, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 198, 2, 317, 796, 37250, 32, 16, 41707, 32, 17, 41707, 32, 18, 20520, 198, 2, 360, 796, 685, 17, 11, 17, 11, 17, 60, 198, 2, 327, 796, 16410, 6, 32, 16, 41707, 32, 17, 6, 11907, 198, 2, 311, 796, 16410, 17816, 32, 16, 41707, 32, 17, 6, 4357, 37250, 32, 18, 6, 11907, 60, 198, 2, 367, 796, 23884, 198, 198, 2, 997, 62, 77, 4147, 796, 513, 198, 198, 39, 10892, 10943, 37, 796, 31051, 14629, 14, 12001, 14, 380, 1686, 14, 14784, 14, 380, 1686, 12, 4774, 82, 13, 10414, 6, 198, 39, 54, 48451, 796, 31051, 11195, 14, 380, 1686, 14, 5225, 10223, 14, 4965, 346, 1153, 49322, 434, 50, 14375, 14, 10424, 1574, 12, 16684, 13, 10414, 6, 628, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 13610, 257, 366, 6759, 8609, 1, 357, 4868, 286, 8341, 8, 286, 18253, 9633, 198, 220, 220, 220, 1303, 3060, 2837, 17778, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 198 ]
2.281746
252
from fastapi import APIRouter from app.api.endpoints import user_controller, course_controller api_router = APIRouter() api_router.include_router(user_controller.router, prefix="/users", tags=["users"]) api_router.include_router(course_controller.router, prefix="/courses", tags=["courses"])
[ 6738, 3049, 15042, 1330, 3486, 4663, 39605, 198, 198, 6738, 598, 13, 15042, 13, 437, 13033, 1330, 2836, 62, 36500, 11, 1781, 62, 36500, 198, 198, 15042, 62, 472, 353, 796, 3486, 4663, 39605, 3419, 198, 15042, 62, 472, 353, 13, 17256, 62, 472, 353, 7, 7220, 62, 36500, 13, 472, 353, 11, 21231, 35922, 18417, 1600, 15940, 28, 14692, 18417, 8973, 8, 198, 15042, 62, 472, 353, 13, 17256, 62, 472, 353, 7, 17319, 62, 36500, 13, 472, 353, 11, 21231, 35922, 66, 39975, 1600, 15940, 28, 14692, 66, 39975, 8973, 8, 198 ]
3.12766
94
from backend import * print(search(year = "1918"))
[ 6738, 30203, 1330, 1635, 201, 198, 201, 198, 201, 198, 4798, 7, 12947, 7, 1941, 796, 366, 1129, 1507, 48774, 201, 198 ]
2.590909
22
# -*- coding: utf-8 -*- from django import views from spot_trend_grid.views import SpotTrendGridView, logger, BatchOrderDetailView, BatchOrderView
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 201, 198, 201, 198, 6738, 42625, 14208, 1330, 5009, 201, 198, 201, 198, 6738, 4136, 62, 83, 10920, 62, 25928, 13, 33571, 1330, 15899, 45461, 41339, 7680, 11, 49706, 11, 347, 963, 18743, 11242, 603, 7680, 11, 347, 963, 18743, 7680, 201, 198, 201, 198, 201, 198, 201 ]
2.606557
61
from __future__ import absolute_import from pyrevolve.sdfbuilder import Element from pyrevolve.sdfbuilder.util import number_format as nf class BasicBattery(Element): """ The rv:battery element, to be included in a robot's plugin """ TAG_NAME = 'rv:battery' def __init__(self, level): """ :param level: Initial battery level :type level: float :return: """ super(BasicBattery, self).__init__() self.level = level def render_elements(self): """ :return: """ elms = super(BasicBattery, self).render_elements() return elms + [Element(tag_name="rv:level", body=nf(self.level))]
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 198, 6738, 12972, 18218, 6442, 13, 82, 7568, 38272, 1330, 11703, 198, 6738, 12972, 18218, 6442, 13, 82, 7568, 38272, 13, 22602, 1330, 1271, 62, 18982, 355, 299, 69, 628, 198, 4871, 14392, 47006, 7, 20180, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 383, 374, 85, 25, 65, 16296, 5002, 11, 284, 307, 3017, 287, 257, 9379, 338, 13877, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 37801, 62, 20608, 796, 705, 81, 85, 25, 65, 16296, 6, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1241, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1241, 25, 20768, 6555, 1241, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 1241, 25, 12178, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 7, 26416, 47006, 11, 2116, 737, 834, 15003, 834, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 5715, 796, 1241, 628, 220, 220, 220, 825, 8543, 62, 68, 3639, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 907, 796, 2208, 7, 26416, 47006, 11, 2116, 737, 13287, 62, 68, 3639, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1288, 907, 1343, 685, 20180, 7, 12985, 62, 3672, 2625, 81, 85, 25, 5715, 1600, 1767, 28, 77, 69, 7, 944, 13, 5715, 4008, 60, 198 ]
2.400685
292
from .cmd import main, version __version__ = version
[ 6738, 764, 28758, 1330, 1388, 11, 2196, 198, 834, 9641, 834, 796, 2196, 198, 220, 220, 220, 220 ]
3.166667
18
#!/usr/bin/env python3 import functools import inspect import typing as ty from .exceptions import InvalidArgumentValueException def validate_range(parameter: str, minimum: ty.Union[int, float], maximum: ty.Union[int, float]) -> ty.Callable: """ Validate a parameter range. Args: parameter: Parameter to validate minimum: Minimum limit. maximum: Maximum limit. Returns: The function decorated. """ return decorator_
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 11748, 1257, 310, 10141, 198, 11748, 10104, 198, 11748, 19720, 355, 1259, 198, 198, 6738, 764, 1069, 11755, 1330, 17665, 28100, 1713, 11395, 16922, 628, 198, 4299, 26571, 62, 9521, 7, 17143, 2357, 25, 965, 11, 5288, 25, 1259, 13, 38176, 58, 600, 11, 12178, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5415, 25, 1259, 13, 38176, 58, 600, 11, 12178, 12962, 4613, 1259, 13, 14134, 540, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 3254, 20540, 257, 11507, 2837, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 11507, 25, 25139, 2357, 284, 26571, 198, 220, 220, 220, 220, 220, 220, 220, 5288, 25, 26265, 4179, 13, 198, 220, 220, 220, 220, 220, 220, 220, 5415, 25, 22246, 4179, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 383, 2163, 24789, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 1441, 11705, 1352, 62, 198 ]
2.686486
185
"""This sub command uploads the resource type to CloudFormation. Projects can be created via the 'init' sub command. """ import logging from .project import Project LOG = logging.getLogger(__name__)
[ 37811, 1212, 850, 3141, 9516, 82, 262, 8271, 2099, 284, 10130, 8479, 341, 13, 198, 198, 16775, 82, 460, 307, 2727, 2884, 262, 705, 15003, 6, 850, 3141, 13, 198, 37811, 198, 11748, 18931, 198, 198, 6738, 764, 16302, 1330, 4935, 198, 198, 25294, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198 ]
3.578947
57
import sys try: from StringIO import StringIO except ImportError: from io import StringIO
[ 198, 11748, 25064, 198, 28311, 25, 198, 220, 422, 10903, 9399, 1330, 10903, 9399, 198, 16341, 17267, 12331, 25, 198, 220, 422, 33245, 1330, 10903, 9399, 628, 628, 628, 628, 198, 220, 220, 198 ]
3.117647
34
from .iode import *
[ 6738, 764, 72, 1098, 1330, 1635 ]
3.166667
6
message = "Hello python world" print(message) message = "Hello python crash course world" print(message)
[ 20500, 796, 366, 15496, 21015, 995, 1, 198, 4798, 7, 20500, 8, 198, 198, 20500, 796, 366, 15496, 21015, 7014, 1781, 995, 1, 198, 4798, 7, 20500, 8 ]
3.75
28
from __future__ import with_statement # this is to work with python2.5 from pyps import workspace from os import remove import pypips filename="pragma" pypips.delete_workspace(filename) with workspace(filename+".c", parents=[], driver="sse", name=filename) as w: m=w[filename] m.suppress_dead_code() m.display()
[ 6738, 11593, 37443, 834, 1330, 351, 62, 26090, 1303, 428, 318, 284, 670, 351, 21015, 17, 13, 20, 198, 6738, 12972, 862, 1330, 44573, 198, 6738, 28686, 1330, 4781, 198, 11748, 279, 4464, 2419, 198, 198, 34345, 2625, 1050, 363, 2611, 1, 198, 79, 4464, 2419, 13, 33678, 62, 5225, 10223, 7, 34345, 8, 198, 4480, 44573, 7, 34345, 10, 1911, 66, 1600, 3397, 41888, 4357, 4639, 2625, 82, 325, 1600, 1438, 28, 34345, 8, 355, 266, 25, 198, 197, 76, 28, 86, 58, 34345, 60, 198, 197, 76, 13, 18608, 601, 62, 25124, 62, 8189, 3419, 198, 197, 76, 13, 13812, 3419, 628 ]
3.048077
104
#!/usr/bin/env python import argparse import sys import os import time # stackoverflow.com/questions/230751/how-to-flush-output-of-print-function # https://opensource.com/article/19/7/parse-arguments-python options = getOptions() print(options) img_small = options.local + "small.png" # if it is cached, let's quit if os.path.isfile(img_small): print("\n cached \n") quit() #https://stackoverflow.com/questions/53657215/running-selenium-with-headless-chrome-webdriver from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("user-agent=[Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5]") chrome_options.add_argument("--disable-extensions") chrome_options.add_argument("window-size=1920,10080") # very large so it won't crop my big image # driver.set_window_size(1920, 1080) chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--verbose") #chrome_options.add_argument("--no-sandbox") # linux only if options.open != "true": chrome_options.add_argument("--headless") # if headless, I need a window size ... # chrome_options.headless = True # also works # C:/python3/python.exe C:/_git_/__NIC__/run/php/projects/BLB/get.strongs.py --remote=https://www.blueletterbible.org/lang/Lexicon/Lexicon.cfm?strongs=H1234 --local=S:/project-BLB/2021-04/strongs/hebrew/1234/ --sleep=250 --open=true # downloaded from chromium.org, version 89 # chromedriver.chromium.org/downloads driver = webdriver.Chrome(options=chrome_options, executable_path='C:/chromedriver/chromedriver.exe') from selenium.common.exceptions import NoSuchElementException driver.get(options.remote) # print(driver.page_source.encode("utf-8")) time.sleep(options.sleep/1000) if check_exists_by_id('agree-button'): driver.find_element_by_id('agree-button').click() time.sleep(3*options.sleep/1000) print(driver.execute_script("return document.title;")) os.makedirs(options.local, exist_ok=True) # options.local is a path html_file = options.local + "page.html" html = str(driver.page_source.encode("utf-8")) f = open(html_file, 'w') f.write(html) f.close() img_small = options.local + "small.png" # stackoverflow.com/questions/17361742/download-image-with-selenium-python with open(img_small, 'wb') as file: file.write(driver.find_element_by_id('lexImage').screenshot_as_png) # file.write(driver.find_element_by_xpath('/html/body/div[1]/div[5]/div[2]/table[1]/tbody/tr/td[1]/a/div').screenshot_as_png) if check_exists_by_id('moreTG'): driver.find_element_by_id('moreTG').click() time.sleep(3*options.sleep/1000) img_full = options.local + "full.png" with open(img_full, 'wb') as file: file.write(driver.find_element_by_id('lexImage').screenshot_as_png) # lexPronunc # <div id="lexPronunc" data-pronunc="BA4BC936634F8B96EACD2BAB19093EF729C96BDE619B85D5DE79CB1C35C07E95B32332529F29E93D2869EDA61A23B204F8D14843783306"><img class="show-for-medium parse-speaker" id="pronunciationSpeaker" src="/assets/images/audio/speaker3_a.svg" width="31" height="25" /><span class="hide-for-medium">Listen</span></div> # https://www.blueletterbible.org/lang/lexicon/lexPronouncePlayer.cfm?skin=BA4BC936634F8B96EACD2BAB19093EF729C96BDE619B85D5DE79CB1C35C07E95B32332529F29E93D2869EDA61A23B204F8D14843783306 # SAVE AS MP3 driver.quit() quit() # https://selenium-python.readthedocs.io/ # https://medium.com/@erika_dike/how-to-download-100-pictures-from-a-site-with-selenium-e23b7ecacb85 # https://towardsdatascience.com/advanced-web-scraping-concepts-to-help-you-get-unstuck-17c0203de7ab # https://stackoverflow.com/questions/17361742/download-image-with-selenium-python # https://towardsdatascience.com/hierarchical-clustering-an-application-to-world-currencies-a24c12940a7e # https://stackoverflow.com/questions/17361742/download-image-with-selenium-python # https://webbot.readthedocs.io/en/latest/webbot.html#selenium.webdriver.Chrome.implicitly_wait from webbot import Browser web = Browser() web.go_to(options.remote) # web.implicitly_wait(options.remote/1000) time.sleep(options.remote/1000) print(web.get_title()) html = str(get_page_source()) f = open(options.local, 'w') f.write(html) f.close() quit() # https://stackoverflow.com/questions/64927909/failed-to-read-descriptor-from-node-connection-a-device-attached-to-the-system # https://stackoverflow.com/questions/65080685/usb-usb-device-handle-win-cc1020-failed-to-read-descriptor-from-node-connectio/65134639#65134639 # https://stackoverflow.com/questions/59515319/web-scraping-using-webbot # In Chrome I followed chrome://flags and enabled Enable new USB backend option, after that the log message disappeared – # https://www.toolsqa.com/selenium-webdriver/selenium-headless-browser-testing/ #https://docs.python.org/3.7/library/argparse.html import argparse # create parser parser = argparse.ArgumentParser() # https://opensource.com/article/19/7/parse-arguments-python # add arguments to the parser parser.add_argument("-r", "--remote") parser.add_argument("-l", "--local") parser.add_argument("-s", "--sleep") # parse the arguments args = parser.parse_args() # https://www.geeksforgeeks.org/print-lists-in-python-4-different-ways/ print(*args, sep = "\n") quit() from webbot import Browser web = Browser() web.go_to('google.com') get_title() # //https://github.com/segmentio/nightmare # // https://stackoverflow.com/questions/2910221/how-can-i-login-to-a-website-with-python/28628514#28628514 # python webbot # // https://github.com/ariya/phantomjs/issues/13923 # // https://stackoverflow.com/questions/36481481/casperjs-memory-exhausted # // var casper = require('casper').create(); # var casper = require('casper').create({ # verbose : true, # logLevel : "info", # pageSettings : { # loadImages : false, // do not load images # loadPlugins : false // do not load NPAPI plugins (Flash, Silverlight, ...) # } # }); # var fs = require('fs'); # var utils = require('utils'); # var x = require("casper").selectXPath; # // casper.userAgent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); # casper.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5'); # // http://docs.casperjs.org/en/latest/cli.html # // console.dir(casper.cli); # // utils.dump(casper.cli); # // casper.run(); # // casper.start('https://jcb.lunaimaging.com/luna/servlet/view/all', function() { # // this.echo(this.getTitle()); # // }); # var remote = casper.cli.raw.get('remote'); # console.log("\n\n" + remote + "\n\n"); # casper.start(remote, function() { # this.echo(this.getTitle()); # }); # var sleep = casper.cli.raw.get('sleep'); # console.log("\n\n" + sleep + "\n\n"); # casper.wait(sleep); # var local = casper.cli.raw.get('local'); # console.log("\n\n" + local + "\n\n"); # casper.then(function() { # // casper.capture("Image.png"); # var content = this.evaluate(function() { # return document; # }); # // this.echo(content.all[0].outerHTML); # page = content.all[0].outerHTML; # fs.write(local, page, "wb"); # }); # casper.run(); # // casperjs get.remote.html.js --remote=https://jcb.lunaimaging.com/luna/servlet/view/all?os=0 --local=Q:/project-MAPS/2021-04/jcb/pages/0001/index.html --sleep=250 # // "https://jcb.lunaimaging.com/media/Size2/JCBMAPS-3-NA/1065/JRB001.jpg" # // change to Size4 ... 1 to 4 works # // extra-large is ZIP ... JRB0017659538119963068053.zip # // no jp2? # // https://www.davidrumsey.com/rumsey/download.pl?image=/D5005/6388007.sid # // https://www.extensis.com/support/geoviewer-9 # // https://jcb.lunaimaging.com/luna/servlet/iiif/JCBMAPS~3~3~3593~101754/info.json # // C:\_git_\__NIC__\run\php\projects\MAPS>casperjs jcb.js --remote='https://jcb.lunaimaging.com/luna/servlet/view/all?os=0' --local='Q:/project-MAPS/2021-04/jcb/pages/0001/index.html' # // C:\_git_\__NIC__\run\php\projects\MAPS>casperjs jcb.js --remote=https://jcb.lunaimaging.com/luna/servlet/view/all?os=0 --local=Q:/project-MAPS/2021-04/jcb/pages/0001/index.html # // CNTRL-SHIFT F ... exportMedia # // http://docs.casperjs.org/en/latest/quickstart.html # // Run it (on windows): # // C:\casperjs\bin> casperjs.exe jcb.js # // ThumbnailViewContainer
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 1822, 29572, 198, 11748, 25064, 198, 11748, 28686, 198, 11748, 640, 628, 628, 198, 2, 8931, 2502, 11125, 13, 785, 14, 6138, 507, 14, 19214, 48365, 14, 4919, 12, 1462, 12, 25925, 12, 22915, 12, 1659, 12, 4798, 12, 8818, 198, 2, 3740, 1378, 44813, 1668, 13, 785, 14, 20205, 14, 1129, 14, 22, 14, 29572, 12, 853, 2886, 12, 29412, 198, 220, 220, 220, 220, 198, 25811, 796, 651, 29046, 3419, 220, 220, 220, 220, 198, 4798, 7, 25811, 8, 198, 198, 9600, 62, 17470, 796, 3689, 13, 12001, 1343, 366, 17470, 13, 11134, 1, 198, 198, 2, 611, 340, 318, 39986, 11, 1309, 338, 11238, 220, 198, 361, 28686, 13, 6978, 13, 4468, 576, 7, 9600, 62, 17470, 2599, 198, 220, 220, 220, 3601, 7203, 59, 77, 39986, 3467, 77, 4943, 198, 220, 220, 220, 11238, 3419, 198, 198, 2, 5450, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 44468, 3553, 23349, 14, 20270, 12, 741, 47477, 12, 4480, 12, 2256, 1203, 12, 46659, 12, 12384, 26230, 198, 6738, 384, 11925, 1505, 1330, 3992, 26230, 220, 198, 6738, 384, 11925, 1505, 13, 12384, 26230, 13, 46659, 13, 25811, 1330, 18634, 198, 46659, 62, 25811, 796, 18634, 3419, 198, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 7220, 12, 25781, 41888, 44, 8590, 5049, 14, 20, 13, 15, 357, 11209, 24563, 718, 13, 16, 26, 370, 3913, 2414, 8, 4196, 13908, 20827, 14, 44468, 13, 20, 357, 42, 28656, 11, 588, 2269, 37549, 8, 13282, 14, 1129, 13, 15, 13, 940, 5705, 13, 3980, 23298, 14, 44468, 13, 20, 60, 4943, 198, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 438, 40223, 12, 2302, 5736, 4943, 198, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 17497, 12, 7857, 28, 40454, 11, 3064, 1795, 4943, 220, 1303, 845, 1588, 523, 340, 1839, 470, 13833, 616, 1263, 2939, 220, 198, 2, 4639, 13, 2617, 62, 17497, 62, 7857, 7, 40454, 11, 17729, 8, 198, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 438, 40223, 12, 46999, 4943, 198, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 438, 19011, 577, 4943, 198, 2, 46659, 62, 25811, 13, 2860, 62, 49140, 7203, 438, 3919, 12, 38142, 3524, 4943, 1303, 32639, 691, 628, 198, 361, 3689, 13, 9654, 14512, 366, 7942, 1298, 198, 220, 220, 220, 32030, 62, 25811, 13, 2860, 62, 49140, 7203, 438, 2256, 1203, 4943, 1303, 611, 1182, 1203, 11, 314, 761, 257, 4324, 2546, 2644, 198, 220, 220, 220, 1303, 32030, 62, 25811, 13, 2256, 1203, 796, 6407, 1303, 635, 2499, 628, 198, 198, 2, 327, 14079, 29412, 18, 14, 29412, 13, 13499, 327, 14079, 62, 18300, 62, 14, 834, 45, 2149, 834, 14, 5143, 14, 10121, 14, 42068, 14, 9148, 33, 14, 1136, 13, 11576, 82, 13, 9078, 1377, 47960, 28, 5450, 1378, 2503, 13, 17585, 9291, 65, 856, 13, 2398, 14, 17204, 14, 45117, 4749, 14, 45117, 4749, 13, 12993, 76, 30, 11576, 82, 28, 39, 1065, 2682, 1377, 12001, 28, 50, 14079, 16302, 12, 9148, 33, 14, 1238, 2481, 12, 3023, 14, 11576, 82, 14, 258, 11269, 14, 1065, 2682, 14, 1377, 42832, 28, 9031, 1377, 9654, 28, 7942, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 198, 2, 15680, 422, 15358, 1505, 13, 2398, 11, 2196, 9919, 198, 2, 15358, 276, 38291, 13, 28663, 1505, 13, 2398, 14, 15002, 82, 198, 26230, 796, 3992, 26230, 13, 1925, 5998, 7, 25811, 28, 46659, 62, 25811, 11, 28883, 62, 6978, 11639, 34, 14079, 28663, 276, 38291, 14, 28663, 276, 38291, 13, 13499, 11537, 628, 198, 198, 6738, 384, 11925, 1505, 13, 11321, 13, 1069, 11755, 1330, 1400, 16678, 20180, 16922, 198, 198, 26230, 13, 1136, 7, 25811, 13, 47960, 8, 198, 2, 3601, 7, 26230, 13, 7700, 62, 10459, 13, 268, 8189, 7203, 40477, 12, 23, 48774, 198, 198, 2435, 13, 42832, 7, 25811, 13, 42832, 14, 12825, 8, 198, 198, 361, 2198, 62, 1069, 1023, 62, 1525, 62, 312, 10786, 49221, 12, 16539, 6, 2599, 198, 220, 220, 220, 4639, 13, 19796, 62, 30854, 62, 1525, 62, 312, 10786, 49221, 12, 16539, 27691, 12976, 3419, 198, 220, 220, 220, 220, 198, 2435, 13, 42832, 7, 18, 9, 25811, 13, 42832, 14, 12825, 8, 198, 198, 4798, 7, 26230, 13, 41049, 62, 12048, 7203, 7783, 3188, 13, 7839, 26033, 4008, 628, 198, 418, 13, 76, 4335, 17062, 7, 25811, 13, 12001, 11, 2152, 62, 482, 28, 17821, 8, 198, 198, 2, 3689, 13, 12001, 318, 257, 3108, 198, 6494, 62, 7753, 796, 3689, 13, 12001, 1343, 366, 7700, 13, 6494, 1, 198, 198, 6494, 796, 965, 7, 26230, 13, 7700, 62, 10459, 13, 268, 8189, 7203, 40477, 12, 23, 48774, 198, 198, 69, 796, 1280, 7, 6494, 62, 7753, 11, 705, 86, 11537, 198, 69, 13, 13564, 7, 6494, 8, 198, 69, 13, 19836, 3419, 198, 198, 9600, 62, 17470, 796, 3689, 13, 12001, 1343, 366, 17470, 13, 11134, 1, 198, 198, 2, 8931, 2502, 11125, 13, 785, 14, 6138, 507, 14, 1558, 2623, 1558, 3682, 14, 15002, 12, 9060, 12, 4480, 12, 741, 47477, 12, 29412, 198, 4480, 1280, 7, 9600, 62, 17470, 11, 705, 39346, 11537, 355, 2393, 25, 198, 220, 220, 220, 2393, 13, 13564, 7, 26230, 13, 19796, 62, 30854, 62, 1525, 62, 312, 10786, 2588, 5159, 27691, 1416, 26892, 62, 292, 62, 11134, 8, 198, 220, 220, 220, 220, 198, 2, 220, 220, 220, 2393, 13, 13564, 7, 26230, 13, 19796, 62, 30854, 62, 1525, 62, 87, 6978, 10786, 14, 6494, 14, 2618, 14, 7146, 58, 16, 60, 14, 7146, 58, 20, 60, 14, 7146, 58, 17, 60, 14, 11487, 58, 16, 60, 14, 83, 2618, 14, 2213, 14, 8671, 58, 16, 60, 14, 64, 14, 7146, 27691, 1416, 26892, 62, 292, 62, 11134, 8, 198, 220, 220, 220, 220, 628, 198, 198, 361, 2198, 62, 1069, 1023, 62, 1525, 62, 312, 10786, 3549, 35990, 6, 2599, 198, 220, 220, 220, 4639, 13, 19796, 62, 30854, 62, 1525, 62, 312, 10786, 3549, 35990, 27691, 12976, 3419, 198, 220, 220, 220, 640, 13, 42832, 7, 18, 9, 25811, 13, 42832, 14, 12825, 8, 198, 220, 220, 220, 33705, 62, 12853, 796, 3689, 13, 12001, 1343, 366, 12853, 13, 11134, 1, 198, 220, 220, 220, 351, 1280, 7, 9600, 62, 12853, 11, 705, 39346, 11537, 355, 2393, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2393, 13, 13564, 7, 26230, 13, 19796, 62, 30854, 62, 1525, 62, 312, 10786, 2588, 5159, 27691, 1416, 26892, 62, 292, 62, 11134, 8, 198, 220, 220, 220, 220, 198, 198, 2, 31191, 47, 1313, 19524, 198, 2, 1279, 7146, 4686, 2625, 2588, 47, 1313, 19524, 1, 1366, 12, 31186, 19524, 2625, 4339, 19, 2749, 24, 32459, 2682, 37, 23, 33, 4846, 36, 2246, 35, 17, 4339, 33, 1129, 2931, 18, 25425, 48555, 34, 4846, 33, 7206, 21, 1129, 33, 5332, 35, 20, 7206, 3720, 23199, 16, 34, 2327, 34, 2998, 36, 3865, 33, 18, 25429, 1495, 1959, 37, 1959, 36, 6052, 35, 2078, 3388, 1961, 32, 5333, 32, 1954, 33, 18638, 37, 23, 35, 1415, 5705, 2718, 5999, 20548, 22039, 9600, 1398, 2625, 12860, 12, 1640, 12, 24132, 21136, 12, 4125, 3110, 1, 4686, 2625, 31186, 24978, 5248, 3110, 1, 12351, 35922, 19668, 14, 17566, 14, 24051, 14, 4125, 3110, 18, 62, 64, 13, 21370, 70, 1, 9647, 2625, 3132, 1, 6001, 2625, 1495, 1, 1220, 6927, 12626, 1398, 2625, 24717, 12, 1640, 12, 24132, 5320, 23061, 3556, 12626, 12240, 7146, 29, 198, 2, 3740, 1378, 2503, 13, 17585, 9291, 65, 856, 13, 2398, 14, 17204, 14, 2588, 4749, 14, 2588, 47, 1313, 8652, 14140, 13, 12993, 76, 30, 20407, 28, 4339, 19, 2749, 24, 32459, 2682, 37, 23, 33, 4846, 36, 2246, 35, 17, 4339, 33, 1129, 2931, 18, 25425, 48555, 34, 4846, 33, 7206, 21, 1129, 33, 5332, 35, 20, 7206, 3720, 23199, 16, 34, 2327, 34, 2998, 36, 3865, 33, 18, 25429, 1495, 1959, 37, 1959, 36, 6052, 35, 2078, 3388, 1961, 32, 5333, 32, 1954, 33, 18638, 37, 23, 35, 1415, 5705, 2718, 5999, 20548, 198, 2, 14719, 6089, 7054, 4904, 18, 198, 198, 26230, 13, 47391, 3419, 198, 47391, 3419, 198, 198, 2, 3740, 1378, 741, 47477, 12, 29412, 13, 961, 83, 704, 420, 82, 13, 952, 14, 628, 628, 198, 2, 3740, 1378, 24132, 13, 785, 14, 31, 263, 9232, 62, 67, 522, 14, 4919, 12, 1462, 12, 15002, 12, 3064, 12, 18847, 942, 12, 6738, 12, 64, 12, 15654, 12, 4480, 12, 741, 47477, 12, 68, 1954, 65, 22, 721, 330, 65, 5332, 198, 2, 3740, 1378, 83, 322, 1371, 19608, 292, 4234, 13, 785, 14, 32225, 2903, 12, 12384, 12, 1416, 2416, 278, 12, 43169, 82, 12, 1462, 12, 16794, 12, 5832, 12, 1136, 12, 403, 301, 1347, 12, 1558, 66, 15, 22416, 2934, 22, 397, 628, 198, 2, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 1558, 2623, 1558, 3682, 14, 15002, 12, 9060, 12, 4480, 12, 741, 47477, 12, 29412, 198, 198, 2, 3740, 1378, 83, 322, 1371, 19608, 292, 4234, 13, 785, 14, 71, 959, 998, 605, 12, 565, 436, 1586, 12, 272, 12, 31438, 12, 1462, 12, 6894, 12, 22019, 14038, 12, 64, 1731, 66, 18741, 1821, 64, 22, 68, 628, 628, 628, 628, 198, 198, 2, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 1558, 2623, 1558, 3682, 14, 15002, 12, 9060, 12, 4480, 12, 741, 47477, 12, 29412, 628, 628, 628, 628, 628, 628, 198, 2, 3740, 1378, 732, 11848, 313, 13, 961, 83, 704, 420, 82, 13, 952, 14, 268, 14, 42861, 14, 732, 11848, 313, 13, 6494, 2, 741, 47477, 13, 12384, 26230, 13, 1925, 5998, 13, 23928, 3628, 306, 62, 17077, 198, 6738, 3992, 13645, 1330, 34270, 220, 198, 12384, 796, 34270, 3419, 198, 12384, 13, 2188, 62, 1462, 7, 25811, 13, 47960, 8, 198, 198, 2, 3992, 13, 23928, 3628, 306, 62, 17077, 7, 25811, 13, 47960, 14, 12825, 8, 198, 2435, 13, 42832, 7, 25811, 13, 47960, 14, 12825, 8, 198, 198, 4798, 7, 12384, 13, 1136, 62, 7839, 28955, 198, 6494, 796, 965, 7, 1136, 62, 7700, 62, 10459, 28955, 198, 198, 69, 796, 1280, 7, 25811, 13, 12001, 11, 705, 86, 11537, 198, 69, 13, 13564, 7, 6494, 8, 198, 69, 13, 19836, 3419, 198, 198, 47391, 3419, 198, 198, 2, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 33300, 26050, 2931, 14, 47904, 12, 1462, 12, 961, 12, 20147, 1968, 273, 12, 6738, 12, 17440, 12, 38659, 12, 64, 12, 25202, 12, 1078, 2317, 12, 1462, 12, 1169, 12, 10057, 198, 2, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 17544, 1795, 35978, 14, 43319, 12, 43319, 12, 25202, 12, 28144, 12, 5404, 12, 535, 940, 1238, 12, 47904, 12, 1462, 12, 961, 12, 20147, 1968, 273, 12, 6738, 12, 17440, 12, 8443, 952, 14, 2996, 1485, 3510, 2670, 2, 2996, 1485, 3510, 2670, 198, 198, 2, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 35124, 21395, 1129, 14, 12384, 12, 1416, 2416, 278, 12, 3500, 12, 732, 11848, 313, 628, 1303, 554, 13282, 314, 3940, 32030, 1378, 33152, 290, 9343, 27882, 649, 8450, 30203, 3038, 11, 706, 326, 262, 2604, 3275, 12120, 784, 198, 220, 198, 1303, 3740, 1378, 2503, 13, 31391, 20402, 13, 785, 14, 741, 47477, 12, 12384, 26230, 14, 741, 47477, 12, 2256, 1203, 12, 40259, 12, 33407, 14, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 198, 2, 5450, 1378, 31628, 13, 29412, 13, 2398, 14, 18, 13, 22, 14, 32016, 14, 853, 29572, 13, 6494, 220, 220, 220, 220, 198, 11748, 1822, 29572, 198, 2, 2251, 30751, 198, 48610, 796, 1822, 29572, 13, 28100, 1713, 46677, 3419, 198, 198, 2, 3740, 1378, 44813, 1668, 13, 785, 14, 20205, 14, 1129, 14, 22, 14, 29572, 12, 853, 2886, 12, 29412, 198, 2, 751, 7159, 284, 262, 30751, 198, 48610, 13, 2860, 62, 49140, 7203, 12, 81, 1600, 366, 438, 47960, 4943, 198, 48610, 13, 2860, 62, 49140, 7203, 12, 75, 1600, 366, 438, 12001, 4943, 198, 48610, 13, 2860, 62, 49140, 7203, 12, 82, 1600, 366, 438, 42832, 4943, 198, 220, 198, 2, 21136, 262, 7159, 198, 22046, 796, 30751, 13, 29572, 62, 22046, 3419, 198, 198, 2, 3740, 1378, 2503, 13, 469, 2573, 30293, 2573, 13, 2398, 14, 4798, 12, 20713, 12, 259, 12, 29412, 12, 19, 12, 39799, 12, 1322, 14, 198, 4798, 46491, 22046, 11, 41767, 796, 37082, 77, 4943, 198, 198, 47391, 3419, 198, 198, 6738, 3992, 13645, 1330, 34270, 220, 198, 12384, 796, 34270, 3419, 198, 198, 12384, 13, 2188, 62, 1462, 10786, 13297, 13, 785, 11537, 628, 198, 1136, 62, 7839, 3419, 628, 198, 2, 3373, 5450, 1378, 12567, 13, 785, 14, 325, 5154, 952, 14, 3847, 11449, 198, 2, 3373, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 1959, 940, 26115, 14, 4919, 12, 5171, 12, 72, 12, 38235, 12, 1462, 12, 64, 12, 732, 12485, 12, 4480, 12, 29412, 14, 27033, 26279, 1415, 2, 27033, 26279, 1415, 220, 1303, 21015, 3992, 13645, 198, 198, 2, 3373, 3740, 1378, 12567, 13, 785, 14, 2743, 3972, 14, 746, 11456, 8457, 14, 37165, 14, 20219, 1954, 198, 198, 2, 3373, 3740, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 26780, 23, 1415, 6659, 14, 66, 32981, 8457, 12, 31673, 12, 1069, 3099, 8459, 198, 2, 3373, 1401, 6124, 525, 796, 2421, 10786, 66, 32981, 27691, 17953, 9783, 198, 2, 1401, 6124, 525, 796, 2421, 10786, 66, 32981, 27691, 17953, 15090, 198, 2, 15942, 577, 1058, 2081, 11, 198, 2, 2604, 4971, 1058, 366, 10951, 1600, 198, 2, 2443, 26232, 1058, 1391, 198, 2, 3440, 29398, 1058, 3991, 11, 3373, 466, 407, 3440, 4263, 198, 2, 3440, 23257, 1040, 1058, 3991, 3373, 466, 407, 3440, 28498, 17614, 20652, 357, 30670, 11, 7698, 2971, 11, 2644, 8, 198, 2, 1782, 198, 2, 14980, 628, 198, 198, 2, 1401, 43458, 796, 2421, 10786, 9501, 24036, 198, 2, 1401, 3384, 4487, 796, 2421, 10786, 26791, 24036, 198, 198, 2, 1401, 2124, 796, 2421, 7203, 66, 32981, 11074, 19738, 55, 15235, 26, 198, 198, 2, 3373, 6124, 525, 13, 7220, 36772, 7203, 44, 8590, 5049, 14, 19, 13, 15, 357, 38532, 26, 6579, 10008, 718, 13, 15, 26, 3964, 24563, 642, 13, 16, 8, 15341, 198, 2, 6124, 525, 13, 7220, 36772, 10786, 44, 8590, 5049, 14, 20, 13, 15, 357, 11209, 24563, 718, 13, 16, 26, 370, 3913, 2414, 8, 4196, 13908, 20827, 14, 44468, 13, 20, 357, 42, 28656, 11, 588, 2269, 37549, 8, 13282, 14, 1129, 13, 15, 13, 940, 5705, 13, 3980, 23298, 14, 44468, 13, 20, 24036, 628, 628, 628, 198, 2, 3373, 2638, 1378, 31628, 13, 66, 32981, 8457, 13, 2398, 14, 268, 14, 42861, 14, 44506, 13, 6494, 198, 197, 2, 3373, 8624, 13, 15908, 7, 66, 32981, 13, 44506, 1776, 198, 197, 2, 3373, 3384, 4487, 13, 39455, 7, 66, 32981, 13, 44506, 1776, 198, 197, 198, 197, 2, 3373, 6124, 525, 13, 5143, 9783, 198, 198, 2, 3373, 6124, 525, 13, 9688, 10786, 5450, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 75, 9613, 14, 3168, 1616, 14, 1177, 14, 439, 3256, 2163, 3419, 1391, 198, 220, 220, 220, 1303, 3373, 428, 13, 30328, 7, 5661, 13, 1136, 19160, 35430, 198, 2, 3373, 14980, 198, 198, 2, 1401, 6569, 220, 197, 28, 6124, 525, 13, 44506, 13, 1831, 13, 1136, 10786, 47960, 24036, 198, 2, 8624, 13, 6404, 7203, 59, 77, 59, 77, 1, 1343, 6569, 1343, 37082, 77, 59, 77, 15341, 198, 198, 2, 6124, 525, 13, 9688, 7, 47960, 11, 2163, 3419, 1391, 198, 220, 220, 220, 1303, 428, 13, 30328, 7, 5661, 13, 1136, 19160, 35430, 198, 2, 14980, 198, 220, 198, 198, 2, 1401, 3993, 220, 197, 28, 6124, 525, 13, 44506, 13, 1831, 13, 1136, 10786, 42832, 24036, 220, 198, 2, 8624, 13, 6404, 7203, 59, 77, 59, 77, 1, 1343, 3993, 1343, 37082, 77, 59, 77, 15341, 198, 2, 6124, 525, 13, 17077, 7, 42832, 1776, 198, 198, 2, 1401, 1957, 220, 197, 28, 6124, 525, 13, 44506, 13, 1831, 13, 1136, 10786, 12001, 24036, 220, 198, 2, 8624, 13, 6404, 7203, 59, 77, 59, 77, 1, 1343, 1957, 1343, 37082, 77, 59, 77, 15341, 198, 198, 2, 6124, 525, 13, 8524, 7, 8818, 3419, 1391, 198, 197, 197, 2, 3373, 6124, 525, 13, 27144, 495, 7203, 5159, 13, 11134, 15341, 198, 197, 197, 2, 1401, 2695, 796, 428, 13, 49786, 7, 8818, 3419, 1391, 198, 197, 197, 197, 2, 1441, 3188, 26, 220, 198, 197, 197, 2, 14980, 198, 197, 197, 198, 197, 197, 2, 3373, 428, 13, 30328, 7, 11299, 13, 439, 58, 15, 4083, 39605, 28656, 1776, 220, 198, 197, 197, 2, 2443, 796, 2695, 13, 439, 58, 15, 4083, 39605, 28656, 26, 198, 197, 197, 2, 43458, 13, 13564, 7, 12001, 11, 2443, 11, 366, 39346, 15341, 198, 197, 197, 198, 197, 197, 198, 2, 14980, 198, 198, 2, 6124, 525, 13, 5143, 9783, 198, 198, 2, 3373, 6124, 525, 8457, 651, 13, 47960, 13, 6494, 13, 8457, 1377, 47960, 28, 5450, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 75, 9613, 14, 3168, 1616, 14, 1177, 14, 439, 30, 418, 28, 15, 1377, 12001, 28, 48, 14079, 16302, 12, 33767, 50, 14, 1238, 2481, 12, 3023, 14, 73, 21101, 14, 31126, 14, 18005, 14, 9630, 13, 6494, 1377, 42832, 28, 9031, 198, 198, 2, 3373, 366, 5450, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 11431, 14, 10699, 17, 14, 34382, 12261, 44580, 12, 18, 12, 4535, 14, 940, 2996, 14, 41, 27912, 8298, 13, 9479, 1, 220, 198, 2, 3373, 1487, 284, 12849, 19, 2644, 352, 284, 604, 2499, 198, 2, 3373, 3131, 12, 11664, 318, 42977, 2644, 449, 27912, 405, 1558, 2996, 3865, 2548, 16315, 4846, 20548, 1795, 4310, 13, 13344, 198, 2, 3373, 645, 474, 79, 17, 30, 198, 198, 2, 3373, 3740, 1378, 2503, 13, 67, 8490, 6582, 4397, 13, 785, 14, 6582, 4397, 14, 15002, 13, 489, 30, 9060, 33223, 35, 4059, 20, 14, 21, 2548, 7410, 22, 13, 30255, 198, 2, 3373, 3740, 1378, 2503, 13, 2302, 37834, 13, 785, 14, 11284, 14, 469, 709, 769, 263, 12, 24, 198, 198, 2, 3373, 3740, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 75, 9613, 14, 3168, 1616, 14, 4178, 361, 14, 34382, 12261, 44580, 93, 18, 93, 18, 93, 2327, 6052, 93, 8784, 41874, 14, 10951, 13, 17752, 628, 198, 2, 3373, 327, 7479, 62, 18300, 62, 59, 834, 45, 2149, 834, 59, 5143, 59, 10121, 59, 42068, 59, 33767, 50, 29, 66, 32981, 8457, 474, 21101, 13, 8457, 1377, 47960, 11639, 5450, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 75, 9613, 14, 3168, 1616, 14, 1177, 14, 439, 30, 418, 28, 15, 6, 1377, 12001, 11639, 48, 14079, 16302, 12, 33767, 50, 14, 1238, 2481, 12, 3023, 14, 73, 21101, 14, 31126, 14, 18005, 14, 9630, 13, 6494, 6, 628, 198, 2, 3373, 327, 7479, 62, 18300, 62, 59, 834, 45, 2149, 834, 59, 5143, 59, 10121, 59, 42068, 59, 33767, 50, 29, 66, 32981, 8457, 474, 21101, 13, 8457, 1377, 47960, 28, 5450, 1378, 73, 21101, 13, 75, 403, 1385, 3039, 13, 785, 14, 75, 9613, 14, 3168, 1616, 14, 1177, 14, 439, 30, 418, 28, 15, 1377, 12001, 28, 48, 14079, 16302, 12, 33767, 50, 14, 1238, 2481, 12, 3023, 14, 73, 21101, 14, 31126, 14, 18005, 14, 9630, 13, 6494, 198, 198, 2, 3373, 31171, 5446, 43, 12, 9693, 32297, 376, 2644, 10784, 13152, 628, 628, 198, 2, 3373, 2638, 1378, 31628, 13, 66, 32981, 8457, 13, 2398, 14, 268, 14, 42861, 14, 24209, 9688, 13, 6494, 198, 2, 3373, 5660, 340, 357, 261, 9168, 2599, 198, 2, 3373, 327, 7479, 66, 32981, 8457, 59, 8800, 29, 6124, 525, 8457, 13, 13499, 474, 21101, 13, 8457, 198, 198, 2, 3373, 536, 20566, 7680, 29869 ]
2.531596
3,339
# -*- coding: utf-8 -*- """ Created on Sat Dec 4 11:19:02 2021 @author: chris """ # part 1 with open('input.txt') as f: lines = f.read().splitlines() # doesn't read \n reportSum = [0] * len(lines[0]) gammaRateArray = [0] * len(lines[0]) epsilonRateArray = [0] * len(lines[0]) for line in lines: for i, bitStr in enumerate(line): bit = int(bitStr) reportSum[i] = reportSum[i] + ((bit ^ 0) - (bit ^ 1)) for i,bit in enumerate(reportSum): gammaRateArray[i] = (bit/abs(bit) + 1) / 2 epsilonRateArray[i] = (bit/abs(bit) * -1 + 1) / 2 gammaRateArray.reverse() epsilonRateArray.reverse() gammaRate = 0 epsilonRate = 0 for i in range(len(gammaRateArray)): gammaRate = gammaRate + gammaRateArray[i] * (2 ** i) epsilonRate = epsilonRate + epsilonRateArray[i] * (2 ** i) print(gammaRate * epsilonRate) # part 2 import pandas as pd df = pd.read_csv('input.txt', dtype = str)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 41972, 319, 7031, 4280, 220, 604, 1367, 25, 1129, 25, 2999, 33448, 198, 198, 31, 9800, 25, 442, 2442, 198, 37811, 628, 198, 2, 636, 352, 198, 198, 4480, 1280, 10786, 15414, 13, 14116, 11537, 355, 277, 25, 198, 220, 220, 220, 3951, 796, 277, 13, 961, 22446, 35312, 6615, 3419, 220, 1303, 1595, 470, 1100, 3467, 77, 198, 220, 220, 220, 220, 198, 220, 220, 220, 989, 13065, 796, 685, 15, 60, 1635, 18896, 7, 6615, 58, 15, 12962, 198, 220, 220, 220, 34236, 32184, 19182, 796, 685, 15, 60, 1635, 18896, 7, 6615, 58, 15, 12962, 198, 220, 220, 220, 304, 862, 33576, 32184, 19182, 796, 685, 15, 60, 1635, 18896, 7, 6615, 58, 15, 12962, 198, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1627, 287, 3951, 25, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 11, 1643, 13290, 287, 27056, 378, 7, 1370, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1643, 796, 493, 7, 2545, 13290, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 989, 13065, 58, 72, 60, 796, 989, 13065, 58, 72, 60, 1343, 14808, 2545, 10563, 657, 8, 532, 357, 2545, 10563, 352, 4008, 198, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 11, 2545, 287, 27056, 378, 7, 13116, 13065, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 34236, 32184, 19182, 58, 72, 60, 796, 357, 2545, 14, 8937, 7, 2545, 8, 1343, 352, 8, 1220, 362, 198, 220, 220, 220, 220, 220, 220, 220, 304, 862, 33576, 32184, 19182, 58, 72, 60, 796, 357, 2545, 14, 8937, 7, 2545, 8, 1635, 532, 16, 1343, 352, 8, 1220, 362, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 34236, 32184, 19182, 13, 50188, 3419, 198, 220, 220, 220, 304, 862, 33576, 32184, 19182, 13, 50188, 3419, 198, 220, 220, 220, 220, 198, 220, 220, 220, 34236, 32184, 796, 657, 198, 220, 220, 220, 304, 862, 33576, 32184, 796, 657, 198, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 11925, 7, 28483, 2611, 32184, 19182, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 34236, 32184, 796, 34236, 32184, 1343, 34236, 32184, 19182, 58, 72, 60, 1635, 357, 17, 12429, 1312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 304, 862, 33576, 32184, 796, 304, 862, 33576, 32184, 1343, 304, 862, 33576, 32184, 19182, 58, 72, 60, 1635, 357, 17, 12429, 1312, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 3601, 7, 28483, 2611, 32184, 1635, 304, 862, 33576, 32184, 8, 198, 220, 220, 220, 220, 198, 2, 636, 362, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 7568, 796, 279, 67, 13, 961, 62, 40664, 10786, 15414, 13, 14116, 3256, 288, 4906, 796, 965, 8, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198 ]
2.003752
533
"""Test call for testing web retrieve, don't call automatically, as it does a real http GET.""" import unittest from unittest import TestCase from src.utils import Rut from src import web class TestGetPage(TestCase): """Get a real page using dummy_rut.""" def test_client(self): """Simple get and parse the bank's page.""" raw_page = web.WebPageDownloader().retrieve(self.dummy_rut) web.Parser.parse(raw_page) if __name__ == '__main__': unittest.main()
[ 37811, 14402, 869, 329, 4856, 3992, 19818, 11, 836, 470, 869, 6338, 11, 355, 340, 857, 257, 198, 5305, 2638, 17151, 526, 15931, 198, 198, 11748, 555, 715, 395, 198, 6738, 555, 715, 395, 1330, 6208, 20448, 198, 198, 6738, 12351, 13, 26791, 1330, 21214, 198, 6738, 12351, 1330, 3992, 628, 198, 4871, 6208, 3855, 9876, 7, 14402, 20448, 2599, 198, 220, 220, 220, 37227, 3855, 257, 1103, 2443, 1262, 31548, 62, 81, 315, 526, 15931, 628, 220, 220, 220, 825, 1332, 62, 16366, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 26437, 651, 290, 21136, 262, 3331, 338, 2443, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 8246, 62, 7700, 796, 3992, 13, 13908, 9876, 10002, 263, 22446, 1186, 30227, 7, 944, 13, 67, 13513, 62, 81, 315, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3992, 13, 46677, 13, 29572, 7, 1831, 62, 7700, 8, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419, 198 ]
2.80226
177
from flask import Flask, render_template, request, make_response, redirect, url_for from blog import Config, User, Comment, Post app = Flask(__name__) @app.route("/", methods=["POST", "GET"]) @app.route("/admin", methods=["POST", "GET"]) if __name__ == "__main__": Config.setup() app.run(debug=True)
[ 6738, 42903, 1330, 46947, 11, 8543, 62, 28243, 11, 2581, 11, 787, 62, 26209, 11, 18941, 11, 19016, 62, 1640, 198, 198, 6738, 4130, 1330, 17056, 11, 11787, 11, 18957, 11, 2947, 198, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 198, 198, 31, 1324, 13, 38629, 7203, 14, 1600, 5050, 28, 14692, 32782, 1600, 366, 18851, 8973, 8, 198, 198, 31, 1324, 13, 38629, 7203, 14, 28482, 1600, 5050, 28, 14692, 32782, 1600, 366, 18851, 8973, 8, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 17056, 13, 40406, 3419, 198, 220, 220, 220, 598, 13, 5143, 7, 24442, 28, 17821, 8 ]
2.810811
111
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # All trademark and other rights reserved by their respective owners # Copyright 2008-2021 Neongecko.com Inc. # BSD-3 # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import json import os import sys import unittest sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from neon_api_proxy.alpha_vantage_api import AlphaVantageAPI VALID_COMPANY_NAME = "Alphabet" VALID_COMPANY_SYMBOL = "GOOGL" INVALID_COMPANY_NAME = "Neon Gecko" INVALID_COMPANY_SYMBOL = "NEONGECKO" if __name__ == '__main__': unittest.main()
[ 2, 10635, 1340, 9552, 357, 15972, 8, 47466, 11, 10442, 7712, 10897, 1222, 15678, 7712, 4482, 198, 2, 1439, 16028, 290, 584, 2489, 10395, 416, 511, 11756, 4393, 198, 2, 15069, 3648, 12, 1238, 2481, 3169, 14220, 37549, 13, 785, 3457, 13, 198, 2, 347, 10305, 12, 18, 198, 2, 2297, 396, 3890, 290, 779, 287, 2723, 290, 13934, 5107, 11, 351, 393, 1231, 198, 2, 17613, 11, 389, 10431, 2810, 326, 262, 1708, 3403, 389, 1138, 25, 198, 2, 352, 13, 2297, 396, 2455, 507, 286, 2723, 2438, 1276, 12377, 262, 2029, 6634, 4003, 11, 198, 2, 220, 220, 220, 428, 1351, 286, 3403, 290, 262, 1708, 37592, 13, 198, 2, 362, 13, 2297, 396, 2455, 507, 287, 13934, 1296, 1276, 22919, 262, 2029, 6634, 4003, 11, 198, 2, 220, 220, 220, 428, 1351, 286, 3403, 290, 262, 1708, 37592, 287, 262, 10314, 198, 2, 220, 220, 220, 290, 14, 273, 584, 5696, 2810, 351, 262, 6082, 13, 198, 2, 513, 13, 16126, 262, 1438, 286, 262, 6634, 15762, 4249, 262, 3891, 286, 663, 198, 2, 220, 220, 220, 20420, 743, 307, 973, 284, 11438, 393, 7719, 3186, 10944, 422, 428, 198, 2, 220, 220, 220, 3788, 1231, 2176, 3161, 3194, 7170, 13, 198, 2, 12680, 47466, 3180, 36592, 2389, 1961, 11050, 3336, 27975, 38162, 9947, 367, 15173, 4877, 5357, 27342, 9865, 3843, 20673, 366, 1921, 3180, 1, 198, 2, 5357, 15529, 7788, 32761, 6375, 8959, 49094, 34764, 11015, 11, 47783, 2751, 11, 21728, 5626, 40880, 5390, 11, 198, 2, 3336, 8959, 49094, 34764, 11015, 3963, 34482, 3398, 1565, 5603, 25382, 5357, 376, 46144, 7473, 317, 16652, 2149, 37232, 198, 2, 33079, 48933, 15986, 13954, 48778, 1961, 13, 3268, 8005, 49261, 50163, 3336, 27975, 38162, 9947, 49707, 14418, 6375, 198, 2, 27342, 9865, 3843, 20673, 220, 9348, 43031, 19146, 7473, 15529, 42242, 11, 3268, 17931, 23988, 11, 19387, 25256, 1847, 11, 38846, 11, 198, 2, 7788, 3620, 6489, 13153, 11, 6375, 7102, 5188, 10917, 3525, 12576, 29506, 25552, 357, 1268, 39149, 2751, 11, 21728, 5626, 40880, 5390, 11, 198, 2, 41755, 11335, 10979, 3963, 28932, 2257, 2043, 37780, 21090, 50, 6375, 49254, 26, 406, 18420, 3963, 23210, 11, 42865, 11, 198, 2, 6375, 4810, 19238, 29722, 26, 220, 6375, 43949, 44180, 23255, 49, 8577, 24131, 8, 29630, 36, 5959, 7257, 2937, 1961, 5357, 6177, 15529, 3336, 15513, 3963, 198, 2, 43031, 25382, 11, 7655, 2767, 16879, 3268, 27342, 10659, 11, 19269, 18379, 43031, 25382, 11, 6375, 309, 9863, 357, 1268, 39149, 2751, 198, 2, 399, 7156, 43, 3528, 18310, 6375, 25401, 54, 24352, 8, 5923, 1797, 2751, 3268, 15529, 34882, 16289, 3963, 3336, 23210, 3963, 12680, 198, 2, 47466, 11, 220, 45886, 16876, 5984, 29817, 1961, 3963, 3336, 28069, 11584, 25382, 3963, 13558, 3398, 29506, 11879, 13, 198, 198, 11748, 33918, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 555, 715, 395, 198, 198, 17597, 13, 6978, 13, 33295, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 5305, 6978, 7, 834, 7753, 834, 35514, 198, 6738, 25988, 62, 15042, 62, 36436, 13, 26591, 62, 38815, 62, 15042, 1330, 12995, 53, 36403, 17614, 628, 198, 23428, 2389, 62, 9858, 47, 31827, 62, 20608, 796, 366, 2348, 19557, 1, 198, 23428, 2389, 62, 9858, 47, 31827, 62, 23060, 10744, 3535, 796, 366, 38, 6684, 8763, 1, 198, 198, 1268, 23428, 2389, 62, 9858, 47, 31827, 62, 20608, 796, 366, 8199, 261, 2269, 37549, 1, 198, 1268, 23428, 2389, 62, 9858, 47, 31827, 62, 23060, 10744, 3535, 796, 366, 12161, 18494, 2943, 22328, 1, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419, 198 ]
3.345219
617
import FWCore.ParameterSet.Config as cms
[ 11748, 48849, 14055, 13, 36301, 7248, 13, 16934, 355, 269, 907, 198, 220, 220, 220, 220, 198 ]
2.705882
17
from functools import reduce from operator import mul from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F
[ 6738, 1257, 310, 10141, 1330, 4646, 198, 6738, 10088, 1330, 35971, 198, 6738, 19720, 1330, 309, 29291, 198, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 628, 628 ]
3.75
40
import setuptools from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md")) as f: long_description = f.read() with open(path.join(here, 'requirements.txt')) as f: install_requirements = f.read().splitlines() with open(path.join(here, 'test-requirements.txt')) as f: test_requirements = f.read().splitlines() setuptools.setup( name="plantuml-markdown", version="3.1.3", author="Michele Tessaro", author_email="[email protected]", description="A PlantUML plugin for Markdown", long_description=long_description, long_description_content_type="text/markdown", keywords=['Markdown', 'typesetting', 'include', 'plugin', 'extension'], url="https://github.com/mikitex70/plantuml-markdown", #packages=setuptools.find_packages(exclude=['test']), py_modules=['plantuml_markdown'], install_requires=install_requirements, tests_require=test_requirements, classifiers=[ "Programming Language :: Python", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 5 - Production/Stable", "Topic :: Software Development :: Documentation", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Filters", "Topic :: Text Processing :: Markup :: HTML" ], )
[ 11748, 900, 37623, 10141, 198, 6738, 28686, 1330, 3108, 628, 198, 1456, 796, 3108, 13, 397, 2777, 776, 7, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 4008, 198, 198, 4480, 1280, 7, 6978, 13, 22179, 7, 1456, 11, 366, 15675, 11682, 13, 9132, 48774, 355, 277, 25, 198, 220, 220, 220, 890, 62, 11213, 796, 277, 13, 961, 3419, 198, 198, 4480, 1280, 7, 6978, 13, 22179, 7, 1456, 11, 705, 8897, 18883, 13, 14116, 6, 4008, 355, 277, 25, 198, 220, 220, 220, 2721, 62, 8897, 18883, 796, 277, 13, 961, 22446, 35312, 6615, 3419, 198, 198, 4480, 1280, 7, 6978, 13, 22179, 7, 1456, 11, 705, 9288, 12, 8897, 18883, 13, 14116, 6, 4008, 355, 277, 25, 198, 220, 220, 220, 1332, 62, 8897, 18883, 796, 277, 13, 961, 22446, 35312, 6615, 3419, 198, 198, 2617, 37623, 10141, 13, 40406, 7, 198, 220, 220, 220, 1438, 2625, 15060, 388, 75, 12, 4102, 2902, 1600, 198, 220, 220, 220, 2196, 2625, 18, 13, 16, 13, 18, 1600, 198, 220, 220, 220, 1772, 2625, 44, 14234, 293, 39412, 12022, 1600, 198, 220, 220, 220, 1772, 62, 12888, 2625, 9383, 258, 293, 13, 83, 408, 12022, 31, 12888, 13, 270, 1600, 198, 220, 220, 220, 6764, 2625, 32, 16561, 52, 5805, 13877, 329, 2940, 2902, 1600, 198, 220, 220, 220, 890, 62, 11213, 28, 6511, 62, 11213, 11, 198, 220, 220, 220, 890, 62, 11213, 62, 11299, 62, 4906, 2625, 5239, 14, 4102, 2902, 1600, 198, 220, 220, 220, 26286, 28, 17816, 9704, 2902, 3256, 705, 19199, 35463, 3256, 705, 17256, 3256, 705, 33803, 3256, 705, 2302, 3004, 6, 4357, 198, 220, 220, 220, 19016, 2625, 5450, 1378, 12567, 13, 785, 14, 76, 1134, 578, 87, 2154, 14, 15060, 388, 75, 12, 4102, 2902, 1600, 198, 220, 220, 220, 1303, 43789, 28, 2617, 37623, 10141, 13, 19796, 62, 43789, 7, 1069, 9152, 28, 17816, 9288, 20520, 828, 198, 220, 220, 220, 12972, 62, 18170, 28, 17816, 15060, 388, 75, 62, 4102, 2902, 6, 4357, 198, 220, 220, 220, 2721, 62, 47911, 28, 17350, 62, 8897, 18883, 11, 198, 220, 220, 220, 5254, 62, 46115, 28, 9288, 62, 8897, 18883, 11, 198, 220, 220, 220, 1398, 13350, 41888, 198, 220, 220, 220, 220, 220, 220, 220, 366, 15167, 2229, 15417, 7904, 11361, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 34156, 7904, 7294, 40, 20010, 1079, 7904, 17168, 13789, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 18843, 803, 4482, 7904, 7294, 13362, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 41206, 12678, 7904, 642, 532, 19174, 14, 1273, 540, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 33221, 7904, 10442, 7712, 7904, 43925, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 33221, 7904, 10442, 7712, 7904, 46267, 7904, 11361, 3401, 5028, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 33221, 7904, 8255, 28403, 7904, 7066, 1010, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 33221, 7904, 8255, 28403, 7904, 2940, 929, 7904, 11532, 1, 198, 220, 220, 220, 16589, 198, 8, 198 ]
2.744186
516
import charlieplex from machine import Pin, I2C from time import sleep i2c = I2C(scl=Pin(22), sda=Pin(21)) display = charlieplex.Matrix(i2c) display.fill(0) x = 0 y = 0 while True: display.pixel(y, x, 255) x += 1 print(x, y) if( x > 7): x = 0 y += 1 if(y>7): display.fill(0) x = 0 y = 0 sleep(0.5)
[ 11748, 1149, 14485, 11141, 201, 198, 6738, 4572, 1330, 13727, 11, 314, 17, 34, 201, 198, 6738, 640, 1330, 3993, 201, 198, 72, 17, 66, 796, 314, 17, 34, 7, 38528, 28, 28348, 7, 1828, 828, 264, 6814, 28, 28348, 7, 2481, 4008, 201, 198, 13812, 796, 1149, 14485, 11141, 13, 46912, 7, 72, 17, 66, 8, 201, 198, 13812, 13, 20797, 7, 15, 8, 201, 198, 87, 796, 657, 201, 198, 88, 796, 657, 201, 198, 4514, 6407, 25, 201, 198, 220, 3359, 13, 32515, 7, 88, 11, 2124, 11, 14280, 8, 201, 198, 220, 2124, 15853, 352, 201, 198, 220, 3601, 7, 87, 11, 331, 8, 201, 198, 220, 611, 7, 2124, 1875, 767, 2599, 201, 198, 220, 220, 220, 2124, 796, 657, 201, 198, 220, 220, 220, 331, 15853, 352, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 611, 7, 88, 29, 22, 2599, 201, 198, 220, 220, 220, 220, 220, 3359, 13, 20797, 7, 15, 8, 201, 198, 220, 220, 220, 220, 220, 2124, 796, 657, 201, 198, 220, 220, 220, 220, 220, 331, 796, 657, 201, 198, 220, 3993, 7, 15, 13, 20, 8, 201, 198, 220, 220 ]
1.867347
196
import MeCab import mecabpy import mecabpy.ipa class TestNode: """mecabpy.ipa.Node のテスト """ INPUT_TEXT = '太郎はこの本を田中を見た女性に渡した。' def test_attr_surface(self): """NodeWrapper.surface のテスト """ surface = '見' node = mecabpy.ipa.Node(surface=surface, feature_obj=mecabpy.ipa.Feature(word_class0='動詞', word_class1='自立', word_class2=None, word_class3=None, group='一段', form='連用形', dict_form='見る', kana='ミ', phonetic_kana=None)) assert node.surface == surface def test_attr_feature(self): """NodeWrapper.feature のテスト """ feature = mecabpy.ipa.Feature(word_class0='動詞', word_class1='自立', word_class2=None, word_class3=None, group='一段', form='連用形', dict_form='見る', kana='ミ', phonetic_kana=None) node = mecabpy.ipa.Node(surface='見', feature_obj=feature) assert node.feature == feature class TestParseToNode: """mecabpy.ipa.parse_to_node のテスト """ INPUT_TEXT = '太郎はこの本を田中を見た女性に渡した。' OUTPUT_WORDS = ('太郎', 'は', 'この', '本', 'を', '田中', 'を', '見', 'た', '女性', 'に', '渡し', 'た', '。', '')
[ 11748, 2185, 34, 397, 198, 198, 11748, 502, 66, 397, 9078, 198, 11748, 502, 66, 397, 9078, 13, 541, 64, 628, 198, 4871, 6208, 19667, 25, 198, 220, 220, 220, 37227, 76, 721, 397, 9078, 13, 541, 64, 13, 19667, 220, 5641, 24336, 43302, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 3268, 30076, 62, 32541, 796, 705, 13783, 103, 32849, 236, 31676, 46036, 5641, 17312, 105, 31758, 35572, 40792, 31758, 17358, 233, 25224, 42637, 45250, 100, 28618, 162, 116, 94, 22180, 25224, 16764, 6, 628, 220, 220, 220, 825, 1332, 62, 35226, 62, 42029, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 19667, 36918, 2848, 13, 42029, 220, 5641, 24336, 43302, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 4417, 796, 705, 17358, 233, 6, 198, 220, 220, 220, 220, 220, 220, 220, 10139, 796, 502, 66, 397, 9078, 13, 541, 64, 13, 19667, 7, 42029, 28, 42029, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3895, 62, 26801, 28, 76, 721, 397, 9078, 13, 541, 64, 13, 38816, 7, 4775, 62, 4871, 15, 11639, 47947, 243, 164, 102, 252, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 16, 11639, 164, 229, 103, 44165, 233, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 17, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 18, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1448, 11639, 31660, 162, 106, 113, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1296, 11639, 34460, 96, 18796, 101, 37605, 95, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8633, 62, 687, 11639, 17358, 233, 25748, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 2271, 11639, 27542, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32896, 5139, 62, 74, 2271, 28, 14202, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 6818, 10139, 13, 42029, 6624, 4417, 628, 220, 220, 220, 825, 1332, 62, 35226, 62, 30053, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 19667, 36918, 2848, 13, 30053, 220, 5641, 24336, 43302, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3895, 796, 502, 66, 397, 9078, 13, 541, 64, 13, 38816, 7, 4775, 62, 4871, 15, 11639, 47947, 243, 164, 102, 252, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 16, 11639, 164, 229, 103, 44165, 233, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 17, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1573, 62, 4871, 18, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1448, 11639, 31660, 162, 106, 113, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1296, 11639, 34460, 96, 18796, 101, 37605, 95, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8633, 62, 687, 11639, 17358, 233, 25748, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 2271, 11639, 27542, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32896, 5139, 62, 74, 2271, 28, 14202, 8, 198, 220, 220, 220, 220, 220, 220, 220, 10139, 796, 502, 66, 397, 9078, 13, 541, 64, 13, 19667, 7, 42029, 11639, 17358, 233, 3256, 3895, 62, 26801, 28, 30053, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6818, 10139, 13, 30053, 6624, 3895, 628, 198, 4871, 6208, 10044, 325, 2514, 19667, 25, 198, 220, 220, 220, 37227, 76, 721, 397, 9078, 13, 541, 64, 13, 29572, 62, 1462, 62, 17440, 220, 5641, 24336, 43302, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 3268, 30076, 62, 32541, 796, 705, 13783, 103, 32849, 236, 31676, 46036, 5641, 17312, 105, 31758, 35572, 40792, 31758, 17358, 233, 25224, 42637, 45250, 100, 28618, 162, 116, 94, 22180, 25224, 16764, 6, 198, 220, 220, 220, 16289, 30076, 62, 45359, 5258, 796, 19203, 13783, 103, 32849, 236, 3256, 705, 31676, 3256, 705, 46036, 5641, 3256, 705, 17312, 105, 3256, 705, 31758, 3256, 705, 35572, 40792, 3256, 705, 31758, 3256, 705, 17358, 233, 3256, 705, 25224, 3256, 705, 42637, 45250, 100, 3256, 705, 28618, 3256, 705, 162, 116, 94, 22180, 3256, 705, 25224, 3256, 705, 16764, 3256, 10148, 8, 198 ]
1.352201
1,431
from bulls_n_cows import* TEST_GUESSES = [[1,2, 3, 4], [5, 2, 3, 4], [7, 6, 5, 4], [0, 9, 8, 5], [2, 4, 6, 8], [1, 3, 5, 7], [1, 2, 0, 9] ] TEST_SECRET = [[1,9,8, 7],[2,4,6, 7], [1,2,0, 9],[7,6,5, 4]] def test_count_bulls_and_cows(): ''' Function test_count_bulls_and_cows Input: None. Returns: Number of failing test conditions for cow/bull sequences Do: Test various cow/bull sequences to ensure those counters are working as expected. Key cases:0 cows, 0 bulls; 4 cows, 0 bulls; 4 bulls, 0 cows, 2 cows, 2 bulls ''' num_failed = 0 test_bulls, test_cows = count_bulls_and_cows([1, 2, 3, 4], [0, 5, 8, 9]) if test_bulls == 0 and test_cows == 0: print('SUCCESS! \n') else: print('FAIL \n') num_failed += 1 test_bulls, test_cows = count_bulls_and_cows([1, 2, 3, 4], [4, 3, 2, 1]) if test_bulls == 0 and test_cows == 4: print('SUCCESS! \n') else: print('FAIL \n') num_failed += 1 test_bulls, test_cows = count_bulls_and_cows([1, 2, 3, 4], [1, 2, 3, 4]) if test_bulls == 4 and test_cows == 0: print('SUCCESS! \n') else: print('FAIL \n') num_failed += 1 test_bulls, test_cows = count_bulls_and_cows([1, 2, 3, 4], [1, 2, 4, 3]) if test_bulls == 2 and test_cows == 2: print('SUCCESS! \n') else: print('FAIL \n') num_failed += 1 return num_failed def auto_play_game(secret_code, guess_book): ''' Function auto_play_game Input: secret_code (list of digits), guess_book (dictionary of guess history) Returns: True if auto-player a winner; False otherwise Do: Automate the playing of Bulls and Cows for regression testing. Instead of using interactive input from stdin, this function uses test data fed directly to the function to simulate an entire "systems test" and complete game flow Concept: instead of guess = input(...), now using guess = TEST_GUESSES[i] ''' count = 1 while count < 7: print("guess: " + str(count)) guess = TEST_GUESSES[count] num_bulls, num_cows = count_bulls_and_cows(secret_code, guess) guess_book = create_dictionary(num_bulls, num_cows, guess, count) count += 1 for key, value in guess_book.items(): print("Your guess history:\n", key, 'is', value) if num_bulls == len(guess): print("Auto-player is a winner") return True elif num_bulls != 4 and count == 7: print("Auto-player lost (this time human)") return False def test_regression_bull_cow(secret_code): ''' Function test_regression_bull_cow Input: secret_code: secret to test with (the one we're "cracking"). Returns: None Do: Automatically exercise and test the entire bulls n cows system by calling auto_play_game() multiple times with both "winning" and "losing" data. Printed output can then be "diff'd" and examined either manually or automatically via tool support Example: code is our test data, and autoplay instead of interactive secret_code = TEST_SECRET[0] guess_book = create_guessbook(7) result = auto_play_game(secret_code, guess_book) ''' for i in range(len(TEST_SECRET)): secret_code = TEST_SECRET[i] guess = TEST_GUESSES[0] num_bulls, num_cows = count_bulls_and_cows(secret_code, guess) count = 0 guess_book = create_dictionary(num_bulls, num_cows, guess, count) result = auto_play_game(secret_code, guess_book) main()
[ 6738, 40317, 62, 77, 62, 66, 1666, 1330, 9, 198, 51, 6465, 62, 38022, 7597, 1546, 796, 16410, 16, 11, 17, 11, 513, 11, 604, 4357, 685, 20, 11, 362, 11, 513, 11, 604, 4357, 685, 22, 11, 718, 11, 642, 11, 604, 4357, 685, 15, 11, 860, 11, 807, 11, 642, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 17, 11, 604, 11, 718, 11, 807, 4357, 685, 16, 11, 513, 11, 642, 11, 767, 4357, 685, 16, 11, 362, 11, 657, 11, 860, 60, 2361, 198, 198, 51, 6465, 62, 23683, 26087, 796, 16410, 16, 11, 24, 11, 23, 11, 767, 38430, 17, 11, 19, 11, 21, 11, 767, 4357, 685, 16, 11, 17, 11, 15, 11, 860, 38430, 22, 11, 21, 11, 20, 11, 604, 11907, 628, 198, 4299, 1332, 62, 9127, 62, 16308, 82, 62, 392, 62, 66, 1666, 33529, 198, 220, 220, 220, 705, 7061, 15553, 1332, 62, 9127, 62, 16308, 82, 62, 392, 62, 66, 1666, 198, 220, 220, 220, 220, 220, 220, 220, 23412, 25, 6045, 13, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 7913, 286, 9894, 1332, 3403, 329, 9875, 14, 16308, 16311, 198, 220, 220, 220, 220, 220, 220, 220, 2141, 25, 6208, 2972, 9875, 14, 16308, 16311, 284, 4155, 883, 21154, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 389, 1762, 355, 2938, 13, 7383, 2663, 25, 15, 22575, 11, 657, 40317, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 604, 22575, 11, 657, 40317, 26, 604, 40317, 11, 657, 22575, 11, 362, 22575, 11, 362, 40317, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 997, 62, 47904, 796, 657, 198, 220, 220, 220, 1332, 62, 16308, 82, 11, 1332, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 26933, 16, 11, 362, 11, 513, 11, 604, 4357, 685, 15, 11, 642, 11, 807, 11, 860, 12962, 198, 220, 220, 220, 611, 1332, 62, 16308, 82, 6624, 657, 290, 1332, 62, 66, 1666, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 12564, 4093, 7597, 0, 3467, 77, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 7708, 4146, 3467, 77, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 47904, 15853, 352, 198, 220, 220, 220, 1332, 62, 16308, 82, 11, 1332, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 26933, 16, 11, 362, 11, 513, 11, 604, 4357, 685, 19, 11, 513, 11, 362, 11, 352, 12962, 198, 220, 220, 220, 611, 1332, 62, 16308, 82, 6624, 657, 290, 1332, 62, 66, 1666, 6624, 604, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 12564, 4093, 7597, 0, 3467, 77, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 7708, 4146, 3467, 77, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 47904, 15853, 352, 198, 220, 220, 220, 1332, 62, 16308, 82, 11, 1332, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 26933, 16, 11, 362, 11, 513, 11, 604, 4357, 685, 16, 11, 362, 11, 513, 11, 604, 12962, 198, 220, 220, 220, 611, 1332, 62, 16308, 82, 6624, 604, 290, 1332, 62, 66, 1666, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 12564, 4093, 7597, 0, 3467, 77, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 7708, 4146, 3467, 77, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 47904, 15853, 352, 198, 220, 220, 220, 1332, 62, 16308, 82, 11, 1332, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 26933, 16, 11, 362, 11, 513, 11, 604, 4357, 685, 16, 11, 362, 11, 604, 11, 513, 12962, 198, 220, 220, 220, 611, 1332, 62, 16308, 82, 6624, 362, 290, 1332, 62, 66, 1666, 6624, 362, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 12564, 4093, 7597, 0, 3467, 77, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 7708, 4146, 3467, 77, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 47904, 15853, 352, 198, 220, 220, 220, 1441, 997, 62, 47904, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 4299, 8295, 62, 1759, 62, 6057, 7, 21078, 62, 8189, 11, 4724, 62, 2070, 2599, 198, 220, 220, 220, 705, 7061, 15553, 8295, 62, 1759, 62, 6057, 198, 220, 220, 220, 220, 220, 220, 220, 23412, 25, 220, 3200, 62, 8189, 357, 4868, 286, 19561, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4724, 62, 2070, 357, 67, 14188, 286, 4724, 2106, 8, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 6407, 611, 8295, 12, 7829, 257, 8464, 26, 10352, 4306, 198, 220, 220, 220, 220, 220, 220, 220, 2141, 25, 17406, 378, 262, 2712, 286, 18075, 290, 327, 1666, 329, 20683, 198, 220, 220, 220, 220, 220, 220, 220, 4856, 13, 5455, 286, 1262, 14333, 5128, 422, 14367, 259, 11, 428, 198, 220, 220, 220, 220, 220, 220, 220, 2163, 3544, 1332, 1366, 11672, 3264, 284, 262, 2163, 284, 29308, 198, 220, 220, 220, 220, 220, 220, 220, 281, 2104, 366, 10057, 82, 1332, 1, 290, 1844, 983, 5202, 198, 220, 220, 220, 220, 220, 220, 220, 26097, 25, 2427, 286, 4724, 796, 5128, 7, 986, 828, 783, 1262, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 796, 43001, 62, 38022, 7597, 1546, 58, 72, 60, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 954, 796, 352, 198, 220, 220, 220, 981, 954, 1279, 767, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 5162, 408, 25, 366, 1343, 965, 7, 9127, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 796, 43001, 62, 38022, 7597, 1546, 58, 9127, 60, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 16308, 82, 11, 997, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 7, 21078, 62, 8189, 11, 4724, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 62, 2070, 796, 2251, 62, 67, 14188, 7, 22510, 62, 16308, 82, 11, 997, 62, 66, 1666, 11, 4724, 11, 954, 8, 198, 220, 220, 220, 220, 220, 220, 220, 954, 15853, 352, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1994, 11, 1988, 287, 4724, 62, 2070, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 7120, 4724, 2106, 7479, 77, 1600, 1994, 11, 705, 271, 3256, 1988, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 997, 62, 16308, 82, 6624, 18896, 7, 5162, 408, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 27722, 12, 7829, 318, 257, 8464, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 997, 62, 16308, 82, 14512, 604, 290, 954, 6624, 767, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 27722, 12, 7829, 2626, 357, 5661, 640, 1692, 8, 4943, 198, 220, 220, 220, 1441, 10352, 198, 198, 4299, 1332, 62, 2301, 2234, 62, 16308, 62, 8232, 7, 21078, 62, 8189, 2599, 198, 220, 220, 220, 705, 7061, 15553, 1332, 62, 2301, 2234, 62, 16308, 62, 8232, 198, 220, 220, 220, 220, 220, 220, 220, 23412, 25, 3200, 62, 8189, 25, 3200, 284, 1332, 351, 357, 1169, 530, 356, 821, 366, 6098, 5430, 11074, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 6045, 198, 220, 220, 220, 220, 220, 220, 220, 2141, 25, 17406, 4142, 5517, 290, 1332, 262, 2104, 40317, 299, 22575, 1080, 198, 220, 220, 220, 220, 220, 220, 220, 416, 4585, 8295, 62, 1759, 62, 6057, 3419, 3294, 1661, 351, 1111, 366, 14463, 1, 290, 198, 220, 220, 220, 220, 220, 220, 220, 366, 75, 2752, 1, 1366, 13, 38482, 5072, 460, 788, 307, 366, 26069, 1549, 1, 290, 11068, 2035, 198, 220, 220, 220, 220, 220, 220, 220, 14500, 393, 6338, 2884, 2891, 1104, 628, 220, 220, 220, 220, 220, 220, 220, 17934, 25, 2438, 318, 674, 1332, 1366, 11, 290, 22320, 10724, 2427, 286, 14333, 198, 220, 220, 220, 220, 220, 220, 220, 3200, 62, 8189, 796, 43001, 62, 23683, 26087, 58, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 62, 2070, 796, 2251, 62, 5162, 408, 2070, 7, 22, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 796, 8295, 62, 1759, 62, 6057, 7, 21078, 62, 8189, 11, 4724, 62, 2070, 8, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 11925, 7, 51, 6465, 62, 23683, 26087, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3200, 62, 8189, 796, 43001, 62, 23683, 26087, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 796, 43001, 62, 38022, 7597, 1546, 58, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 16308, 82, 11, 997, 62, 66, 1666, 796, 954, 62, 16308, 82, 62, 392, 62, 66, 1666, 7, 21078, 62, 8189, 11, 4724, 8, 198, 220, 220, 220, 220, 220, 220, 220, 954, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 4724, 62, 2070, 796, 2251, 62, 67, 14188, 7, 22510, 62, 16308, 82, 11, 997, 62, 66, 1666, 11, 4724, 11, 954, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 796, 8295, 62, 1759, 62, 6057, 7, 21078, 62, 8189, 11, 4724, 62, 2070, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 198, 12417, 3419, 198 ]
2.22515
1,670
#!/usr/bin/env python3 import math import os import random import re import sys # Complete the maxSubsetSum function below. if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') n = int(input()) arr = list(map(int, input().rstrip().split())) res = maxSubsetSum(arr) fptr.write(str(res) + '\n') fptr.close()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 10688, 198, 11748, 28686, 198, 11748, 4738, 198, 11748, 302, 198, 11748, 25064, 198, 198, 2, 13248, 262, 3509, 7004, 2617, 13065, 2163, 2174, 13, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 277, 20692, 796, 1280, 7, 418, 13, 268, 2268, 17816, 2606, 7250, 3843, 62, 34219, 6, 4357, 705, 86, 11537, 198, 220, 220, 220, 299, 796, 493, 7, 15414, 28955, 198, 220, 220, 220, 5240, 796, 1351, 7, 8899, 7, 600, 11, 5128, 22446, 81, 36311, 22446, 35312, 3419, 4008, 198, 220, 220, 220, 581, 796, 3509, 7004, 2617, 13065, 7, 3258, 8, 198, 220, 220, 220, 277, 20692, 13, 13564, 7, 2536, 7, 411, 8, 1343, 705, 59, 77, 11537, 198, 220, 220, 220, 277, 20692, 13, 19836, 3419, 198 ]
2.4375
144
from datetime import datetime from ems.models.ambulances.ambulance import Ambulance
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 6738, 795, 82, 13, 27530, 13, 4131, 377, 1817, 13, 4131, 377, 590, 1330, 12457, 377, 590, 628 ]
3.307692
26
from django.apps import AppConfig
[ 6738, 42625, 14208, 13, 18211, 1330, 2034, 16934, 628 ]
3.888889
9
# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'sunnudagur', 1: 'mánadagur', 2: 'týsdagur', 3: 'mikudagur', 4: 'hósdagur', 5: 'fríggjadagur', 6: 'leygardagur' }, 'days_abbrev': { 0: 'sun', 1: 'mán', 2: 'týs', 3: 'mik', 4: 'hós', 5: 'frí', 6: 'ley' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'mars', 4: 'apríl', 5: 'mai', 6: 'juni', 7: 'juli', 8: 'august', 9: 'september', 10: 'oktober', 11: 'november', 12: 'desember', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'mai', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'des', }, # Units of time 'year': ['{count} ár', '{count} ár'], 'month': ['{count} mánaður', '{count} mánaðir'], 'week': ['{count} vika', '{count} vikur'], 'day': ['{count} dag', '{count} dagar'], 'hour': ['{count} tími', '{count} tímar'], 'minute': ['{count} minutt', '{count} minuttir'], 'second': ['{count} sekund', '{count} sekundir'], # Relative time 'ago': '{time} síðan', 'from_now': 'um {time}', 'after': '{time} aftaná', 'before': '{time} áðrenn', # Ordinals 'ordinal': '.', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D. MMMM, YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, }
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 7645, 49905, 796, 1391, 198, 220, 220, 220, 1303, 12579, 198, 220, 220, 220, 705, 12545, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 657, 25, 705, 19155, 77, 463, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 352, 25, 705, 76, 21162, 324, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 362, 25, 705, 83, 127, 121, 21282, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 513, 25, 705, 76, 1134, 463, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 604, 25, 705, 71, 10205, 21282, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 642, 25, 705, 8310, 8836, 1130, 38442, 363, 333, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 718, 25, 705, 1636, 19977, 363, 333, 6, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 705, 12545, 62, 397, 4679, 85, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 657, 25, 705, 19155, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 352, 25, 705, 76, 21162, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 362, 25, 705, 83, 127, 121, 82, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 513, 25, 705, 76, 1134, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 604, 25, 705, 71, 10205, 82, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 642, 25, 705, 8310, 8836, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 718, 25, 705, 1636, 6, 198, 220, 220, 220, 8964, 628, 220, 220, 220, 1303, 37461, 198, 220, 220, 220, 705, 41537, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 352, 25, 705, 13881, 84, 283, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 362, 25, 705, 69, 1765, 622, 283, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 513, 25, 705, 76, 945, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 604, 25, 705, 499, 81, 8836, 75, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 642, 25, 705, 76, 1872, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 718, 25, 705, 29741, 72, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 767, 25, 705, 73, 32176, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 807, 25, 705, 7493, 436, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 860, 25, 705, 325, 457, 1491, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 838, 25, 705, 482, 1462, 527, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1367, 25, 705, 77, 3239, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1105, 25, 705, 8906, 1491, 3256, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 705, 41537, 62, 397, 4679, 85, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 352, 25, 705, 13881, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 362, 25, 705, 69, 1765, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 513, 25, 705, 3876, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 604, 25, 705, 499, 81, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 642, 25, 705, 76, 1872, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 718, 25, 705, 29741, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 767, 25, 705, 73, 377, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 807, 25, 705, 7493, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 860, 25, 705, 325, 79, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 838, 25, 705, 482, 83, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1367, 25, 705, 37302, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1105, 25, 705, 8906, 3256, 198, 220, 220, 220, 8964, 628, 220, 220, 220, 1303, 27719, 286, 640, 198, 220, 220, 220, 705, 1941, 10354, 37250, 90, 9127, 92, 6184, 94, 81, 3256, 705, 90, 9127, 92, 6184, 94, 81, 6, 4357, 198, 220, 220, 220, 705, 8424, 10354, 37250, 90, 9127, 92, 285, 6557, 2616, 27214, 333, 3256, 705, 90, 9127, 92, 285, 6557, 2616, 27214, 343, 6, 4357, 198, 220, 220, 220, 705, 10464, 10354, 37250, 90, 9127, 92, 410, 9232, 3256, 705, 90, 9127, 92, 410, 1134, 333, 6, 4357, 198, 220, 220, 220, 705, 820, 10354, 37250, 90, 9127, 92, 48924, 3256, 705, 90, 9127, 92, 288, 32452, 6, 4357, 198, 220, 220, 220, 705, 9769, 10354, 37250, 90, 9127, 92, 256, 8836, 11632, 3256, 705, 90, 9127, 92, 256, 8836, 3876, 6, 4357, 198, 220, 220, 220, 705, 11374, 10354, 37250, 90, 9127, 92, 949, 15318, 3256, 705, 90, 9127, 92, 949, 15318, 343, 6, 4357, 198, 220, 220, 220, 705, 12227, 10354, 37250, 90, 9127, 92, 384, 74, 917, 3256, 705, 90, 9127, 92, 384, 74, 917, 343, 6, 4357, 628, 220, 220, 220, 1303, 45344, 640, 198, 220, 220, 220, 705, 3839, 10354, 705, 90, 2435, 92, 264, 8836, 27214, 272, 3256, 198, 220, 220, 220, 705, 6738, 62, 2197, 10354, 705, 388, 1391, 2435, 92, 3256, 198, 220, 220, 220, 705, 8499, 10354, 705, 90, 2435, 92, 46088, 272, 6557, 3256, 198, 220, 220, 220, 705, 19052, 10354, 705, 90, 2435, 92, 6184, 94, 27214, 918, 77, 3256, 628, 220, 220, 220, 1303, 14230, 6897, 198, 220, 220, 220, 705, 585, 1292, 10354, 705, 2637, 11, 628, 220, 220, 220, 1303, 7536, 17519, 198, 220, 220, 220, 705, 4475, 62, 687, 1381, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 43, 4694, 10354, 705, 16768, 25, 3020, 25, 824, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 27734, 10354, 705, 16768, 25, 3020, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 3069, 3069, 10354, 705, 1860, 1860, 360, 13, 337, 12038, 44, 11, 575, 26314, 56, 47138, 25, 3020, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 3069, 43, 10354, 705, 35, 337, 12038, 44, 575, 26314, 56, 47138, 25, 3020, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 3069, 10354, 705, 35, 337, 12038, 44, 575, 26314, 56, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 43, 10354, 705, 16458, 14, 12038, 14, 26314, 26314, 3256, 198, 220, 220, 220, 8964, 198, 92, 198 ]
1.610536
1,063
#!/usr/bin/env python """Databench command line executable. Run to create a server that serves the analyses pages and runs the python backend.""" import os import sys import signal import random import logging import argparse import werkzeug.serving from . import __version__ as DATABENCH_VERSION def main(): """Entry point to run databench.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--version', action='version', version='%(prog)s '+DATABENCH_VERSION) parser.add_argument('--log', dest='loglevel', default="NOTSET", help='set log level') parser.add_argument('--host', dest='host', default=os.environ.get('HOST', 'localhost'), help='set host for webserver') parser.add_argument('--port', dest='port', type=int, default=int(os.environ.get('PORT', 5000)), help='set port for webserver') parser.add_argument('--with-coverage', dest='with_coverage', default=False, action='store_true', help='create code coverage statistics') delimiter_args = parser.add_argument_group('delimiters') delimiter_args.add_argument('--variable_start_string', help='delimiter for variable start') delimiter_args.add_argument('--variable_end_string', help='delimiter for variable end') delimiter_args.add_argument('--block_start_string', help='delimiter for block start') delimiter_args.add_argument('--block_end_string', help='delimiter for block end') delimiter_args.add_argument('--comment_start_string', help='delimiter for comment start') delimiter_args.add_argument('--comment_end_string', help='delimiter for comment end') args = parser.parse_args() # coverage cov = None if args.with_coverage: import coverage cov = coverage.coverage( data_suffix=str(int(random.random()*999999.0)), source=['databench'], ) cov.start() # this is included here so that is included in coverage from .app import App # log if args.loglevel != 'NOTSET': print 'Setting loglevel to '+args.loglevel+'.' logging.basicConfig(level=getattr(logging, args.loglevel)) # delimiters delimiters = { 'variable_start_string': '[[', 'variable_end_string': ']]', } if args.variable_start_string: delimiters['variable_start_string'] = args.variable_start_string if args.variable_end_string: delimiters['variable_end_string'] = args.variable_end_string if args.block_start_string: delimiters['block_start_string'] = args.block_start_string if args.block_end_string: delimiters['block_end_string'] = args.block_end_string if args.comment_start_string: delimiters['comment_start_string'] = args.comment_start_string if args.comment_end_string: delimiters['comment_end_string'] = args.comment_end_string print '--- databench v'+DATABENCH_VERSION+' ---' logging.info('host='+str(args.host)+', port='+str(args.port)) logging.info('delimiters='+str(delimiters)) # handle external signal to terminate nicely (used in tests) signal.signal(signal.SIGTERM, sig_handler) # not supported on Windows: if hasattr(signal, 'SIGUSR1'): signal.signal(signal.SIGUSR1, sig_handler) @werkzeug.serving.run_with_reloader return reloader() if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 27354, 397, 24421, 3141, 1627, 28883, 13, 5660, 284, 2251, 257, 4382, 326, 9179, 198, 1169, 13523, 5468, 290, 4539, 262, 21015, 30203, 526, 15931, 628, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 6737, 198, 11748, 4738, 198, 11748, 18931, 198, 11748, 1822, 29572, 198, 11748, 266, 9587, 2736, 1018, 13, 31293, 198, 198, 6738, 764, 1330, 11593, 9641, 834, 355, 360, 1404, 6242, 1677, 3398, 62, 43717, 628, 198, 4299, 1388, 33529, 198, 220, 220, 220, 37227, 30150, 966, 284, 1057, 4818, 397, 24421, 526, 15931, 628, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 11213, 28, 834, 15390, 834, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 438, 9641, 3256, 2223, 11639, 9641, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2196, 11639, 4, 7, 1676, 70, 8, 82, 705, 10, 35, 1404, 6242, 1677, 3398, 62, 43717, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 438, 6404, 3256, 2244, 11639, 75, 2467, 626, 3256, 4277, 2625, 11929, 28480, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 2617, 2604, 1241, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 438, 4774, 3256, 2244, 11639, 4774, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 28, 418, 13, 268, 2268, 13, 1136, 10786, 39, 10892, 3256, 705, 36750, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 2617, 2583, 329, 2639, 18497, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 438, 634, 3256, 2244, 11639, 634, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 600, 11, 4277, 28, 600, 7, 418, 13, 268, 2268, 13, 1136, 10786, 15490, 3256, 23336, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 2617, 2493, 329, 2639, 18497, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 438, 4480, 12, 1073, 1857, 3256, 2244, 11639, 4480, 62, 1073, 1857, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 28, 25101, 11, 2223, 11639, 8095, 62, 7942, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 17953, 2438, 5197, 7869, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 796, 30751, 13, 2860, 62, 49140, 62, 8094, 10786, 12381, 320, 270, 364, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 45286, 62, 9688, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 7885, 923, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 45286, 62, 437, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 7885, 886, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 9967, 62, 9688, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 2512, 923, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 9967, 62, 437, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 2512, 886, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 23893, 62, 9688, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 2912, 923, 11537, 198, 220, 220, 220, 46728, 2676, 62, 22046, 13, 2860, 62, 49140, 10786, 438, 23893, 62, 437, 62, 8841, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 11639, 12381, 320, 2676, 329, 2912, 886, 11537, 198, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 220, 220, 220, 1303, 5197, 198, 220, 220, 220, 39849, 796, 6045, 198, 220, 220, 220, 611, 26498, 13, 4480, 62, 1073, 1857, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1330, 5197, 198, 220, 220, 220, 220, 220, 220, 220, 39849, 796, 5197, 13, 1073, 1857, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 62, 37333, 844, 28, 2536, 7, 600, 7, 25120, 13, 25120, 3419, 9, 24214, 2079, 13, 15, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2723, 28, 17816, 19608, 397, 24421, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 39849, 13, 9688, 3419, 628, 220, 220, 220, 1303, 428, 318, 3017, 994, 523, 326, 318, 3017, 287, 5197, 198, 220, 220, 220, 422, 764, 1324, 1330, 2034, 628, 220, 220, 220, 1303, 2604, 198, 220, 220, 220, 611, 26498, 13, 75, 2467, 626, 14512, 705, 11929, 28480, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 705, 34149, 300, 2467, 626, 284, 705, 10, 22046, 13, 75, 2467, 626, 10, 6, 2637, 198, 220, 220, 220, 220, 220, 220, 220, 18931, 13, 35487, 16934, 7, 5715, 28, 1136, 35226, 7, 6404, 2667, 11, 26498, 13, 75, 2467, 626, 4008, 628, 220, 220, 220, 1303, 46728, 270, 364, 198, 220, 220, 220, 46728, 270, 364, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 45286, 62, 9688, 62, 8841, 10354, 705, 30109, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 45286, 62, 437, 62, 8841, 10354, 705, 11907, 3256, 198, 220, 220, 220, 1782, 198, 220, 220, 220, 611, 26498, 13, 45286, 62, 9688, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 45286, 62, 9688, 62, 8841, 20520, 796, 26498, 13, 45286, 62, 9688, 62, 8841, 198, 220, 220, 220, 611, 26498, 13, 45286, 62, 437, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 45286, 62, 437, 62, 8841, 20520, 796, 26498, 13, 45286, 62, 437, 62, 8841, 198, 220, 220, 220, 611, 26498, 13, 9967, 62, 9688, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 9967, 62, 9688, 62, 8841, 20520, 796, 26498, 13, 9967, 62, 9688, 62, 8841, 198, 220, 220, 220, 611, 26498, 13, 9967, 62, 437, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 9967, 62, 437, 62, 8841, 20520, 796, 26498, 13, 9967, 62, 437, 62, 8841, 198, 220, 220, 220, 611, 26498, 13, 23893, 62, 9688, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 23893, 62, 9688, 62, 8841, 20520, 796, 26498, 13, 23893, 62, 9688, 62, 8841, 198, 220, 220, 220, 611, 26498, 13, 23893, 62, 437, 62, 8841, 25, 198, 220, 220, 220, 220, 220, 220, 220, 46728, 270, 364, 17816, 23893, 62, 437, 62, 8841, 20520, 796, 26498, 13, 23893, 62, 437, 62, 8841, 628, 220, 220, 220, 3601, 705, 6329, 4818, 397, 24421, 410, 6, 10, 35, 1404, 6242, 1677, 3398, 62, 43717, 10, 6, 11420, 6, 198, 220, 220, 220, 18931, 13, 10951, 10786, 4774, 11639, 10, 2536, 7, 22046, 13, 4774, 47762, 3256, 2493, 11639, 10, 2536, 7, 22046, 13, 634, 4008, 198, 220, 220, 220, 18931, 13, 10951, 10786, 12381, 320, 270, 364, 11639, 10, 2536, 7, 12381, 320, 270, 364, 4008, 628, 220, 220, 220, 1303, 5412, 7097, 6737, 284, 23654, 16576, 357, 1484, 287, 5254, 8, 198, 220, 220, 220, 6737, 13, 12683, 282, 7, 12683, 282, 13, 50, 3528, 5781, 44, 11, 43237, 62, 30281, 8, 198, 220, 220, 220, 1303, 407, 4855, 319, 3964, 25, 198, 220, 220, 220, 611, 468, 35226, 7, 12683, 282, 11, 705, 50, 3528, 2937, 49, 16, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 6737, 13, 12683, 282, 7, 12683, 282, 13, 50, 3528, 2937, 49, 16, 11, 43237, 62, 30281, 8, 628, 220, 220, 220, 2488, 86, 9587, 2736, 1018, 13, 31293, 13, 5143, 62, 4480, 62, 260, 29356, 198, 220, 220, 220, 1441, 18126, 263, 3419, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 198 ]
2.308405
1,618
from distutils.core import setup setup( name = 'Hexy', packages = ['hexy'], version = '1.4.4', license='MIT', description = 'A library that makes working with a hexagonal lattice easier.', author = 'Norbu Tsering', author_email = '[email protected]', url = 'https://github.com/redft/hexy', download_url = 'https://github.com/RedFT/Hexy/archive/1.4.3.tar.gz', keywords = ['hexy', 'coordinate', 'hexagon', 'hexagonal'], install_requires = ["numpy >= 1.15.0"], extras_require ={ 'tests': [ "atomicwrites==1.1.5", "attrs==18.1.0", "funcsigs==1.0.2", "more-itertools==4.3.0", "pluggy==0.7.1", "py==1.5.4", "pytest==3.7.0", "six==1.11.0", ] }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', ], )
[ 6738, 1233, 26791, 13, 7295, 1330, 9058, 198, 40406, 7, 198, 220, 1438, 796, 705, 39, 1069, 88, 3256, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 10392, 796, 37250, 258, 5431, 6, 4357, 220, 220, 220, 198, 220, 2196, 796, 705, 16, 13, 19, 13, 19, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 5964, 11639, 36393, 3256, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 6764, 796, 705, 32, 5888, 326, 1838, 1762, 351, 257, 17910, 27923, 47240, 501, 4577, 2637, 11, 220, 220, 220, 198, 220, 1772, 796, 705, 21991, 11110, 13146, 1586, 3256, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 1772, 62, 12888, 796, 705, 13099, 11110, 13, 912, 1586, 13, 6359, 31, 14816, 13, 785, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 19016, 796, 705, 5450, 1378, 12567, 13, 785, 14, 445, 701, 14, 258, 5431, 3256, 220, 220, 220, 198, 220, 4321, 62, 6371, 796, 705, 5450, 1378, 12567, 13, 785, 14, 7738, 9792, 14, 39, 1069, 88, 14, 17474, 14, 16, 13, 19, 13, 18, 13, 18870, 13, 34586, 3256, 198, 220, 26286, 796, 37250, 258, 5431, 3256, 705, 37652, 4559, 3256, 705, 33095, 1840, 3256, 705, 33095, 27923, 6, 4357, 198, 220, 2721, 62, 47911, 796, 14631, 77, 32152, 18189, 352, 13, 1314, 13, 15, 33116, 198, 220, 33849, 62, 46115, 796, 90, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 705, 41989, 10354, 685, 198, 220, 220, 220, 220, 220, 220, 220, 366, 47116, 8933, 274, 855, 16, 13, 16, 13, 20, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 1078, 3808, 855, 1507, 13, 16, 13, 15, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 12543, 6359, 9235, 855, 16, 13, 15, 13, 17, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 3549, 12, 270, 861, 10141, 855, 19, 13, 18, 13, 15, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 16875, 1360, 855, 15, 13, 22, 13, 16, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 9078, 855, 16, 13, 20, 13, 19, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 9078, 9288, 855, 18, 13, 22, 13, 15, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 19412, 855, 16, 13, 1157, 13, 15, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 2361, 198, 220, 220, 220, 220, 220, 8964, 198, 220, 1398, 13350, 41888, 198, 220, 220, 220, 705, 41206, 12678, 7904, 642, 532, 19174, 14, 1273, 540, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 705, 5317, 1631, 7591, 1240, 7904, 34152, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 705, 33221, 7904, 10442, 7712, 7904, 46267, 7904, 11361, 3401, 5028, 3256, 198, 220, 220, 220, 705, 34156, 7904, 7294, 40, 20010, 1079, 7904, 17168, 13789, 3256, 220, 220, 220, 198, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 362, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 705, 15167, 2229, 15417, 7904, 11361, 7904, 513, 3256, 220, 220, 220, 220, 220, 220, 198, 220, 16589, 198, 8, 198 ]
2.116364
550
# Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import copy import inspect import torch.optim from federatedml.nn.backend.pytorch.custom import optimizer as custom_optimizers from federatedml.util import LOGGER
[ 2, 220, 15069, 13130, 383, 376, 6158, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 220, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 220, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 220, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 220, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 220, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 220, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 220, 11247, 739, 262, 13789, 13, 198, 2, 198, 11748, 4866, 198, 11748, 10104, 198, 198, 11748, 28034, 13, 40085, 198, 6738, 28062, 515, 4029, 13, 20471, 13, 1891, 437, 13, 9078, 13165, 354, 13, 23144, 1330, 6436, 7509, 355, 2183, 62, 40085, 11341, 198, 198, 6738, 28062, 515, 4029, 13, 22602, 1330, 41605, 30373, 628, 628, 628 ]
3.62963
216
import json import re
[ 11748, 33918, 201, 198, 11748, 302, 201, 198, 201, 198, 201 ]
2.454545
11
from django.contrib.auth import authenticate, login, logout from django.http import HttpResponse from djoser.serializers import UserSerializer from rest_framework import viewsets, permissions, status from rest_framework.decorators import action from rest_framework.response import Response from djoser.views import SetPasswordView as JoserSetPasswordView from apps.user.models import User from .serializers import SessionSerializer, UserSessionSerializer
[ 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 1330, 8323, 5344, 11, 17594, 11, 2604, 448, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 198, 6738, 42625, 13416, 13, 46911, 11341, 1330, 11787, 32634, 7509, 198, 6738, 1334, 62, 30604, 1330, 5009, 1039, 11, 21627, 11, 3722, 198, 6738, 1334, 62, 30604, 13, 12501, 273, 2024, 1330, 2223, 198, 6738, 1334, 62, 30604, 13, 26209, 1330, 18261, 198, 6738, 42625, 13416, 13, 33571, 1330, 5345, 35215, 7680, 355, 449, 13416, 7248, 35215, 7680, 198, 198, 6738, 6725, 13, 7220, 13, 27530, 1330, 11787, 198, 6738, 764, 46911, 11341, 1330, 23575, 32634, 7509, 11, 11787, 36044, 32634, 7509, 628, 198 ]
4.126126
111
# This is your "setup.py" file. # See the following sites for general guide to Python packaging: # * `The Hitchhiker's Guide to Packaging <http://guide.python-distribute.org/>`_ # * `Python Project Howto <http://infinitemonkeycorps.net/docs/pph/>`_ from setuptools import setup, find_packages import sys, os #from Cython.Build import cythonize from setuptools.extension import Extension here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() NEWS = open(os.path.join(here, 'NEWS.rst')).read() version = '0.1' install_requires = [ # List your project dependencies here. # For more details, see: # http://packages.python.org/distribute/setuptools.html#declaring-dependencies # Packages with fixed versions # "<package1>==0.1", # "<package2>==0.3.0", # "nose", "coverage" # Put it here. ] tests_requires = [ # List your project testing dependencies here. ] dev_requires = [ # List your project development dependencies here.\ ] dependency_links = [ # Sources for some fixed versions packages #'https://github.com/<user1>/<package1>/archive/master.zip#egg=<package1>-0.1', #'https://github.com/<user2>/<package2>/archive/master.zip#egg=<package2>-0.3.0', ] #Cython extension #TOP_DIR="/home/eugeneai/Development/codes/NLP/workprog/tmp/link-grammar" #LG_DIR="link-grammar" #LG_LIB_DIR=os.path.join(TOP_DIR,LG_DIR,".libs") #LG_HEADERS=os.path.join(TOP_DIR) ext_modules=[ # Extension("icc.modelstudio.cython_module", # sources=["src/./icc.modelstudio/cython_module.pyx"], # libraries=["gdal"], # ) ] setup( name='icc.modelstudio', version=version, description="A GUI program for control of microbioma modeling.", long_description=README + '\n\n' + NEWS, # Get classifiers from http://pypi.python.org/pypi?%3Aaction=list_classifiers # classifiers=[c.strip() for c in """ # Development Status :: 4 - Beta # License :: OSI Approved :: MIT License # Operating System :: OS Independent # Programming Language :: Python :: 2.6 # Programming Language :: Python :: 2.7 # Programming Language :: Python :: 3 # Topic :: Software Development :: Libraries :: Python Modules # """.split('\n') if c.strip()], # ], keywords='GUI naturl modeling dataflow GTK+', author='Evgeny Cherkashin', author_email='[email protected]', url='https://github.com/NGS-ISC/model-studio', license='Apache-2.0', packages=find_packages("src"), package_dir = {'': "src"}, namespace_packages = ['icc'], include_package_data=True, zip_safe=False, install_requires=install_requires, dependency_links = dependency_links, extras_require={ 'tests': tests_requires, 'dev': dev_requires, }, test_suite='tests', entry_points={ 'console_scripts': ['icc.modelstudio=icc.modelstudio:main'] }, #ext_modules = cythonize(ext_modules), #test_suite = 'nose.collector', #setup_requires=['nose>=1.0','Cython','coverage'] )
[ 2, 770, 318, 534, 366, 40406, 13, 9078, 1, 2393, 13, 198, 2, 4091, 262, 1708, 5043, 329, 2276, 5698, 284, 11361, 16846, 25, 198, 2, 220, 220, 1635, 4600, 464, 36456, 71, 18320, 338, 10005, 284, 6400, 3039, 1279, 4023, 1378, 41311, 13, 29412, 12, 17080, 4163, 13, 2398, 15913, 63, 62, 198, 2, 220, 220, 1635, 4600, 37906, 4935, 1374, 1462, 1279, 4023, 1378, 10745, 15003, 7966, 2539, 10215, 862, 13, 3262, 14, 31628, 14, 381, 71, 15913, 63, 62, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 198, 11748, 25064, 11, 28686, 198, 2, 6738, 327, 7535, 13, 15580, 1330, 3075, 400, 261, 1096, 198, 6738, 900, 37623, 10141, 13, 2302, 3004, 1330, 27995, 198, 198, 1456, 796, 28686, 13, 6978, 13, 397, 2777, 776, 7, 418, 13, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 4008, 198, 15675, 11682, 796, 1280, 7, 418, 13, 6978, 13, 22179, 7, 1456, 11, 705, 15675, 11682, 13, 81, 301, 11537, 737, 961, 3419, 198, 49597, 796, 1280, 7, 418, 13, 6978, 13, 22179, 7, 1456, 11, 705, 49597, 13, 81, 301, 11537, 737, 961, 3419, 628, 198, 9641, 796, 705, 15, 13, 16, 6, 198, 198, 17350, 62, 47911, 796, 685, 198, 220, 220, 220, 1303, 7343, 534, 1628, 20086, 994, 13, 198, 220, 220, 220, 1303, 1114, 517, 3307, 11, 766, 25, 198, 220, 220, 220, 1303, 2638, 1378, 43789, 13, 29412, 13, 2398, 14, 17080, 4163, 14, 2617, 37623, 10141, 13, 6494, 2, 32446, 1723, 12, 45841, 3976, 198, 220, 220, 220, 1303, 6400, 1095, 351, 5969, 6300, 198, 220, 220, 220, 1303, 33490, 26495, 16, 29, 855, 15, 13, 16, 1600, 198, 220, 220, 220, 1303, 33490, 26495, 17, 29, 855, 15, 13, 18, 13, 15, 1600, 198, 220, 220, 220, 1303, 366, 77, 577, 1600, 366, 1073, 1857, 1, 220, 220, 1303, 5930, 340, 994, 13, 198, 60, 198, 198, 41989, 62, 47911, 796, 685, 198, 220, 220, 220, 1303, 7343, 534, 1628, 4856, 20086, 994, 13, 198, 60, 198, 198, 7959, 62, 47911, 796, 685, 198, 220, 220, 220, 1303, 7343, 534, 1628, 2478, 20086, 994, 13, 59, 198, 60, 198, 198, 45841, 1387, 62, 28751, 796, 685, 198, 220, 220, 220, 1303, 26406, 329, 617, 5969, 6300, 10392, 198, 220, 220, 220, 1303, 6, 5450, 1378, 12567, 13, 785, 14, 27, 7220, 16, 29, 14, 27, 26495, 16, 29, 14, 17474, 14, 9866, 13, 13344, 2, 33856, 28, 27, 26495, 16, 29, 12, 15, 13, 16, 3256, 198, 220, 220, 220, 1303, 6, 5450, 1378, 12567, 13, 785, 14, 27, 7220, 17, 29, 14, 27, 26495, 17, 29, 14, 17474, 14, 9866, 13, 13344, 2, 33856, 28, 27, 26495, 17, 29, 12, 15, 13, 18, 13, 15, 3256, 198, 60, 198, 198, 2, 34, 7535, 7552, 198, 198, 2, 35222, 62, 34720, 35922, 11195, 14, 68, 1018, 1734, 1872, 14, 41206, 14, 40148, 14, 45, 19930, 14, 1818, 1676, 70, 14, 22065, 14, 8726, 12, 4546, 3876, 1, 198, 2, 41257, 62, 34720, 2625, 8726, 12, 4546, 3876, 1, 198, 2, 41257, 62, 40347, 62, 34720, 28, 418, 13, 6978, 13, 22179, 7, 35222, 62, 34720, 11, 41257, 62, 34720, 553, 13, 8019, 82, 4943, 198, 2, 41257, 62, 37682, 4877, 28, 418, 13, 6978, 13, 22179, 7, 35222, 62, 34720, 8, 198, 198, 2302, 62, 18170, 41888, 198, 2, 220, 220, 220, 27995, 7203, 44240, 13, 19849, 19149, 952, 13, 948, 400, 261, 62, 21412, 1600, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4237, 28, 14692, 10677, 11757, 14, 44240, 13, 19849, 19149, 952, 14, 948, 400, 261, 62, 21412, 13, 9078, 87, 33116, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12782, 28, 14692, 21287, 282, 33116, 198, 2, 220, 220, 220, 1267, 198, 60, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 11639, 44240, 13, 19849, 19149, 952, 3256, 198, 220, 220, 220, 2196, 28, 9641, 11, 198, 220, 220, 220, 6764, 2625, 32, 25757, 1430, 329, 1630, 286, 24559, 6086, 21128, 33283, 198, 220, 220, 220, 890, 62, 11213, 28, 15675, 11682, 1343, 705, 59, 77, 59, 77, 6, 1343, 28840, 11, 198, 220, 220, 220, 1303, 3497, 1398, 13350, 422, 2638, 1378, 79, 4464, 72, 13, 29412, 13, 2398, 14, 79, 4464, 72, 30, 4, 18, 32, 2673, 28, 4868, 62, 4871, 13350, 198, 220, 220, 220, 1303, 1398, 13350, 41888, 66, 13, 36311, 3419, 329, 269, 287, 37227, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 7712, 12678, 7904, 604, 532, 17993, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 13789, 7904, 7294, 40, 20010, 1079, 7904, 17168, 13789, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 24850, 4482, 7904, 7294, 13362, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 30297, 15417, 7904, 11361, 7904, 362, 13, 21, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 30297, 15417, 7904, 11361, 7904, 362, 13, 22, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 30297, 15417, 7904, 11361, 7904, 513, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 47373, 7904, 10442, 7712, 7904, 46267, 7904, 11361, 3401, 5028, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 13538, 1911, 35312, 10786, 59, 77, 11537, 611, 269, 13, 36311, 3419, 4357, 198, 220, 220, 220, 1303, 16589, 198, 220, 220, 220, 26286, 11639, 40156, 299, 2541, 75, 21128, 1366, 11125, 7963, 42, 10, 3256, 198, 220, 220, 220, 1772, 11639, 15200, 5235, 88, 19305, 74, 1077, 259, 3256, 198, 220, 220, 220, 1772, 62, 12888, 11639, 68, 1018, 1734, 1872, 31, 343, 77, 482, 13, 3262, 3256, 198, 220, 220, 220, 19016, 11639, 5450, 1378, 12567, 13, 785, 14, 10503, 50, 12, 37719, 14, 19849, 12, 19149, 952, 3256, 198, 220, 220, 220, 5964, 11639, 25189, 4891, 12, 17, 13, 15, 3256, 198, 220, 220, 220, 10392, 28, 19796, 62, 43789, 7203, 10677, 12340, 198, 220, 220, 220, 5301, 62, 15908, 796, 1391, 7061, 25, 366, 10677, 25719, 198, 220, 220, 220, 25745, 62, 43789, 796, 37250, 44240, 6, 4357, 198, 220, 220, 220, 2291, 62, 26495, 62, 7890, 28, 17821, 11, 198, 220, 220, 220, 19974, 62, 21230, 28, 25101, 11, 198, 220, 220, 220, 2721, 62, 47911, 28, 17350, 62, 47911, 11, 198, 220, 220, 220, 20203, 62, 28751, 796, 20203, 62, 28751, 11, 198, 220, 220, 220, 33849, 62, 46115, 34758, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 41989, 10354, 5254, 62, 47911, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 7959, 10354, 1614, 62, 47911, 11, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1332, 62, 2385, 578, 11639, 41989, 3256, 198, 220, 220, 220, 5726, 62, 13033, 34758, 198, 220, 220, 220, 220, 220, 220, 220, 705, 41947, 62, 46521, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37250, 44240, 13, 19849, 19149, 952, 28, 44240, 13, 19849, 19149, 952, 25, 12417, 20520, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1303, 2302, 62, 18170, 796, 3075, 400, 261, 1096, 7, 2302, 62, 18170, 828, 198, 220, 220, 220, 1303, 9288, 62, 2385, 578, 796, 705, 77, 577, 13, 33327, 273, 3256, 198, 220, 220, 220, 1303, 40406, 62, 47911, 28, 17816, 77, 577, 29, 28, 16, 13, 15, 41707, 34, 7535, 41707, 1073, 1857, 20520, 198, 8, 198 ]
2.525081
1,236
import cairo import math
[ 11748, 1275, 7058, 198, 11748, 10688, 198 ]
3.571429
7
#import math import os w1 = [0]*64 s0 = [0]*64 s1 = [0]*64 for i in range (64): w1[i] = [0]*32 s0[i] = [0]*32 s1[i] = [0]*32 w1hex= [0x0000c020, 0x8e195e82, 0x5806a5ac, 0x9467a653, 0x00fe9de6, 0xf0c34b81, 0x6f230600, 0x00000000, 0x00000000, 0x364c0811, 0x8ea34017, 0xb68edc07, 0x9dd9e834, 0xfbf4ced0, 0x9f23a2b2, 0x8d6fda4a] eng = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P'] rus = ['а','б','в','г','д','е','ё','ж','з','и','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я'] for j in range(16): for i in range (32): w1[j][i] = str(eng[j])+str(rus[i]) save ('w', j, i, w1[j][i]) for i in range (0, 22): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)]+'^'+w1[j][shr3(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)]+'^'+w1[j][shr10(i)] for i in range (22, 29): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)]+'^'+w1[j][shr3(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)] for i in range (29, 32): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)] print('start') for j in range (16, 64): print('start '+ str(j)) for i in range (32): w1[j][i] = '{'+w1[j-16][i] +'+'+ s0[j-15][i] +'+'+ w1[j-7][i] +'+'+ s1[j-2][i]+'}'; save ('w', j, i, w1[j][i]) for i in range (0, 22): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)]+'^'+w1[j][shr3(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)]+'^'+w1[j][shr10(i)] for i in range (22, 29): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)]+'^'+w1[j][shr3(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)] for i in range (29, 32): s0[j][i] = w1[j][r7(i)]+'^'+w1[j][r18(i)] s1[j][i] = w1[j][r17(i)]+'^'+w1[j][r19(i)]
[ 2, 11748, 10688, 198, 11748, 28686, 198, 198, 86, 16, 796, 685, 15, 60, 9, 2414, 198, 82, 15, 796, 685, 15, 60, 9, 2414, 198, 82, 16, 796, 685, 15, 60, 9, 2414, 198, 198, 1640, 1312, 287, 2837, 357, 2414, 2599, 198, 220, 220, 220, 266, 16, 58, 72, 60, 796, 685, 15, 60, 9, 2624, 198, 220, 220, 220, 264, 15, 58, 72, 60, 796, 685, 15, 60, 9, 2624, 198, 220, 220, 220, 264, 16, 58, 72, 60, 796, 685, 15, 60, 9, 2624, 198, 198, 86, 16, 33095, 28, 685, 15, 87, 2388, 66, 33618, 11, 657, 87, 23, 68, 22186, 68, 6469, 11, 657, 87, 20, 37988, 64, 20, 330, 11, 657, 87, 5824, 3134, 64, 46435, 11, 657, 87, 405, 5036, 24, 2934, 21, 11, 657, 26152, 15, 66, 2682, 65, 6659, 11, 657, 87, 21, 69, 19214, 8054, 11, 657, 87, 8269, 11, 220, 198, 220, 220, 220, 220, 220, 220, 220, 657, 87, 8269, 11, 657, 87, 26780, 66, 2919, 1157, 11, 657, 87, 23, 18213, 2682, 29326, 11, 657, 30894, 3104, 276, 66, 2998, 11, 657, 87, 24, 1860, 24, 68, 23, 2682, 11, 657, 26152, 19881, 19, 771, 15, 11, 657, 87, 24, 69, 1954, 64, 17, 65, 17, 11, 657, 87, 23, 67, 21, 69, 6814, 19, 64, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 1516, 796, 37250, 32, 41707, 33, 41707, 34, 41707, 35, 41707, 36, 41707, 37, 41707, 38, 41707, 39, 41707, 40, 41707, 41, 41707, 42, 41707, 43, 41707, 44, 41707, 45, 41707, 46, 41707, 47, 20520, 198, 14932, 796, 37250, 16142, 41707, 140, 109, 41707, 38857, 41707, 140, 111, 41707, 43666, 41707, 16843, 41707, 141, 239, 41707, 140, 114, 41707, 140, 115, 41707, 18849, 41707, 31583, 41707, 30143, 41707, 43108, 41707, 22177, 41707, 15166, 41707, 140, 123, 41707, 21169, 41707, 21727, 41707, 20375, 41707, 35072, 41707, 141, 226, 41707, 141, 227, 41707, 141, 228, 41707, 141, 229, 41707, 141, 230, 41707, 141, 231, 41707, 141, 232, 41707, 45035, 41707, 45367, 41707, 141, 235, 41707, 141, 236, 41707, 40623, 20520, 628, 198, 1640, 474, 287, 2837, 7, 1433, 2599, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 2624, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 266, 16, 58, 73, 7131, 72, 60, 796, 965, 7, 1516, 58, 73, 12962, 10, 2536, 7, 14932, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 3613, 19203, 86, 3256, 474, 11, 1312, 11, 266, 16, 58, 73, 7131, 72, 12962, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 15, 11, 2534, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 18, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 940, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 1828, 11, 2808, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 18, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 1959, 11, 3933, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 4798, 10786, 9688, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 1640, 474, 287, 2837, 357, 1433, 11, 5598, 2599, 198, 220, 220, 220, 3601, 10786, 9688, 705, 10, 965, 7, 73, 4008, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 2624, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 266, 16, 58, 73, 7131, 72, 60, 796, 705, 90, 6, 10, 86, 16, 58, 73, 12, 1433, 7131, 72, 60, 1343, 6, 10, 6, 10, 264, 15, 58, 73, 12, 1314, 7131, 72, 60, 1343, 6, 10, 6, 10, 266, 16, 58, 73, 12, 22, 7131, 72, 60, 1343, 6, 10, 6, 10, 264, 16, 58, 73, 12, 17, 7131, 72, 48688, 6, 92, 17020, 198, 220, 220, 220, 220, 220, 220, 220, 3613, 19203, 86, 3256, 474, 11, 1312, 11, 266, 16, 58, 73, 7131, 72, 12962, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 15, 11, 2534, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 18, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 940, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 1828, 11, 2808, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 36007, 18, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 329, 1312, 287, 2837, 357, 1959, 11, 3933, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 264, 15, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 22, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1507, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 264, 16, 58, 73, 7131, 72, 60, 796, 266, 16, 58, 73, 7131, 81, 1558, 7, 72, 15437, 10, 6, 61, 6, 10, 86, 16, 58, 73, 7131, 81, 1129, 7, 72, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 628, 628, 628, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198 ]
1.449011
1,314
import csp rgb = ['R', 'G', 'B','O']#,'White','Gray','Y','Purple','Brown','seafoam','T','Kale'] d2 = { 'A' : rgb, 'B' : rgb, 'C' : ['R'], 'D' : rgb,} domains = { 'SW': ['G'], 'SE': rgb, 'L': rgb, 'EE': rgb, 'W': rgb, 'WM': rgb, 'EM': rgb, 'NW': rgb, 'YH': rgb, 'NE': rgb, 'S': rgb, } variables = domains.keys() neighbors = { 'SW': ['SE','WM','W'], 'SE': ['SW','L','EE','EM','WM'], 'L': ['SE','EE'], 'EE': ['SE','EM','L'], 'W': ['SW','WM','NW'], 'WM': ['SW','SE','W','EM','NW'], 'EM': ['WM','NW','YH','SE','EE'], 'NW': ['W','WM','S','NE','YH','EM'], 'YH': ['NW','EM','NE'], 'NE': ['S','NW','YH'], 'S': ['NE','NW'], } v2 = d2.keys() n2 = {'A' : ['B', 'C', 'D'], 'B' : ['A', 'C', 'D'], 'C' : ['A', 'B'], 'D' : ['A', 'B'],} c2 = csp.CSP(v2, d2, n2, constraints) c2.label = 'Really Lame' UK=csp.CSP(variables,domains,neighbors,constraints) UK.label = "Map of the Uk" myCSPs = [ { 'csp': UK, # 'select_unassigned_variable': csp.mrv, # 'order_domain_values': csp.lcv, # 'inference': csp.mac, # 'inference': csp.forward_checking, } , { 'csp' : UK, 'select_unassigned_variable': csp.mrv, # 'order_domain_values': csp.lcv, # 'inference': csp.mac, # 'inference': csp.forward_checking, }, { 'csp' : UK, # 'select_unassigned_variable': csp.mrv, 'order_domain_values': csp.lcv, # 'inference': csp.mac, # 'inference': csp.forward_checking, }, { 'csp' : UK, # 'select_unassigned_variable': csp.mrv, # 'order_domain_values': csp.lcv, 'inference': csp.mac, # 'inference': csp.forward_checking, }, { 'csp' : UK, # 'select_unassigned_variable': csp.mrv, # 'order_domain_values': csp.lcv, # 'inference': csp.mac, 'inference': csp.forward_checking, }, { 'csp' : UK, #'select_unassigned_variable': csp.mrv, #'order_domain_values': csp.lcv, #'inference': csp.mac, # 'inference': csp.forward_checking, } ]
[ 11748, 269, 2777, 198, 198, 81, 22296, 796, 37250, 49, 3256, 705, 38, 3256, 705, 33, 41707, 46, 20520, 2, 4032, 12256, 41707, 46130, 41707, 56, 41707, 30026, 1154, 41707, 20644, 41707, 325, 1878, 78, 321, 41707, 51, 41707, 42, 1000, 20520, 198, 198, 67, 17, 796, 1391, 705, 32, 6, 1058, 46140, 11, 705, 33, 6, 1058, 46140, 11, 705, 34, 6, 1058, 37250, 49, 6, 4357, 705, 35, 6, 1058, 46140, 11, 92, 198, 198, 3438, 1299, 796, 1391, 198, 220, 220, 220, 705, 17887, 10354, 37250, 38, 6, 4357, 198, 220, 220, 220, 705, 5188, 10354, 46140, 11, 198, 220, 220, 220, 220, 705, 43, 10354, 46140, 11, 198, 220, 220, 220, 705, 6500, 10354, 46140, 11, 198, 220, 220, 220, 220, 705, 54, 10354, 46140, 11, 198, 220, 220, 220, 705, 22117, 10354, 46140, 11, 198, 220, 220, 220, 705, 3620, 10354, 46140, 11, 198, 220, 220, 220, 705, 27605, 10354, 46140, 11, 198, 220, 220, 220, 705, 56, 39, 10354, 46140, 11, 198, 220, 220, 220, 705, 12161, 10354, 46140, 11, 198, 220, 220, 220, 705, 50, 10354, 46140, 11, 198, 198, 92, 198, 198, 25641, 2977, 796, 18209, 13, 13083, 3419, 198, 198, 710, 394, 32289, 796, 1391, 198, 220, 220, 220, 705, 17887, 10354, 37250, 5188, 41707, 22117, 41707, 54, 6, 4357, 198, 220, 220, 220, 705, 5188, 10354, 37250, 17887, 41707, 43, 41707, 6500, 41707, 3620, 41707, 22117, 6, 4357, 198, 220, 220, 220, 220, 705, 43, 10354, 37250, 5188, 41707, 6500, 6, 4357, 198, 220, 220, 220, 705, 6500, 10354, 37250, 5188, 41707, 3620, 41707, 43, 6, 4357, 198, 220, 220, 220, 220, 705, 54, 10354, 37250, 17887, 41707, 22117, 41707, 27605, 6, 4357, 198, 220, 220, 220, 705, 22117, 10354, 37250, 17887, 41707, 5188, 41707, 54, 41707, 3620, 41707, 27605, 6, 4357, 198, 220, 220, 220, 705, 3620, 10354, 37250, 22117, 41707, 27605, 41707, 56, 39, 41707, 5188, 41707, 6500, 6, 4357, 198, 220, 220, 220, 705, 27605, 10354, 37250, 54, 41707, 22117, 41707, 50, 41707, 12161, 41707, 56, 39, 41707, 3620, 6, 4357, 198, 220, 220, 220, 705, 56, 39, 10354, 37250, 27605, 41707, 3620, 41707, 12161, 6, 4357, 198, 220, 220, 220, 705, 12161, 10354, 37250, 50, 41707, 27605, 41707, 56, 39, 6, 4357, 198, 220, 220, 220, 705, 50, 10354, 220, 37250, 12161, 41707, 27605, 6, 4357, 198, 92, 628, 198, 85, 17, 796, 288, 17, 13, 13083, 3419, 198, 198, 77, 17, 796, 1391, 6, 32, 6, 1058, 37250, 33, 3256, 705, 34, 3256, 705, 35, 6, 4357, 198, 220, 220, 220, 220, 220, 705, 33, 6, 1058, 37250, 32, 3256, 705, 34, 3256, 705, 35, 6, 4357, 198, 220, 220, 220, 220, 220, 705, 34, 6, 1058, 37250, 32, 3256, 705, 33, 6, 4357, 198, 220, 220, 220, 220, 220, 705, 35, 6, 1058, 37250, 32, 3256, 705, 33, 6, 4357, 92, 198, 198, 66, 17, 796, 269, 2777, 13, 34, 4303, 7, 85, 17, 11, 288, 17, 11, 299, 17, 11, 17778, 8, 198, 66, 17, 13, 18242, 796, 705, 26392, 406, 480, 6, 198, 198, 15039, 28, 66, 2777, 13, 34, 4303, 7, 25641, 2977, 11, 3438, 1299, 11, 710, 394, 32289, 11, 1102, 2536, 6003, 8, 198, 15039, 13, 18242, 796, 366, 13912, 286, 262, 5065, 1, 198, 198, 1820, 34, 4303, 82, 796, 685, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 10354, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 1782, 198, 220, 220, 220, 837, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 6, 1058, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 6, 1058, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 6, 1058, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 6, 1058, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 66, 2777, 6, 1058, 3482, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 6, 19738, 62, 403, 562, 3916, 62, 45286, 10354, 269, 2777, 13, 43395, 85, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 6, 2875, 62, 27830, 62, 27160, 10354, 269, 2777, 13, 75, 33967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 6, 259, 4288, 10354, 269, 2777, 13, 20285, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 259, 4288, 10354, 269, 2777, 13, 11813, 62, 41004, 11, 198, 220, 220, 220, 1782, 198, 198, 60, 198 ]
1.814203
1,211
"""GUI for weather report api """ from tkinter import * import json import requests root = Tk() root.title("Temperature Finder") root.geometry('500x300') root.minsize(150, 150) root.maxsize(1200, 1200) city = Label(text = "Enter a city name to check Temperature: ") cityValue = StringVar() #type of data userEntry = Entry(root) #entered data userEntry.grid(row = 0, column = 1) city.grid(row = 0) Button(text = "submit", command = getTemperature).grid(column = 1) root.mainloop()
[ 37811, 40156, 329, 6193, 989, 40391, 37227, 198, 6738, 256, 74, 3849, 1330, 1635, 198, 11748, 33918, 198, 11748, 7007, 197, 198, 197, 628, 198, 15763, 796, 309, 74, 3419, 198, 15763, 13, 7839, 7203, 42492, 42500, 4943, 198, 15763, 13, 469, 15748, 10786, 4059, 87, 6200, 11537, 198, 15763, 13, 42951, 1096, 7, 8628, 11, 6640, 8, 198, 15763, 13, 9806, 7857, 7, 27550, 11, 24938, 8, 198, 19205, 796, 36052, 7, 5239, 796, 366, 17469, 257, 1748, 1438, 284, 2198, 34467, 25, 366, 8, 198, 19205, 11395, 796, 10903, 19852, 3419, 1303, 4906, 286, 1366, 220, 198, 7220, 30150, 796, 21617, 7, 15763, 8, 1303, 298, 1068, 1366, 220, 198, 198, 7220, 30150, 13, 25928, 7, 808, 796, 657, 11, 5721, 796, 352, 8, 198, 19205, 13, 25928, 7, 808, 796, 657, 8, 198, 21864, 7, 5239, 796, 366, 46002, 1600, 3141, 796, 651, 42492, 737, 25928, 7, 28665, 796, 352, 8, 628, 198, 15763, 13, 12417, 26268, 3419, 198 ]
3.024691
162
#!/usr/bin/env python """ Solution to Day 1 - Puzzle 2 of the Advent Of Code 2015 series of challenges. --- Day 1: Not Quite Lisp --- An opening parenthesis represents an increase in floor and a closing parenthesis represents a decrease in floor. After taking a 7000 character long input string of assorted parenthesis, determine the first time that Santa arrives at a specified floor. ----------------------------- Author: Luke "rookuu" Roberts """ inputData = raw_input("Puzzle Input: ") floor = 0 index = 0 floorRequired = int(raw_input("What floor are we looking for? ")) # Used to check the length of the input string. # print len(inputData) for char in inputData: if char == "(": floor += 1 elif char == ")": floor -= 1 index += 1 if floor == floorRequired: print "The first time Santa visits floor " + str(floorRequired) + " is on instruction number " + str(index) break
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 37811, 198, 46344, 284, 3596, 352, 532, 23966, 362, 286, 262, 33732, 3226, 6127, 1853, 2168, 286, 6459, 13, 198, 198, 6329, 3596, 352, 25, 1892, 29051, 38593, 11420, 198, 198, 2025, 4756, 2560, 8497, 6870, 281, 2620, 287, 4314, 290, 257, 9605, 2560, 8497, 6870, 257, 10070, 287, 4314, 13, 198, 3260, 2263, 257, 50205, 2095, 890, 5128, 4731, 286, 46603, 2560, 8497, 11, 5004, 262, 717, 640, 326, 8909, 14443, 198, 265, 257, 7368, 4314, 13, 198, 198, 1783, 32501, 198, 198, 13838, 25, 11336, 366, 305, 11601, 84, 1, 10918, 198, 37811, 198, 198, 15414, 6601, 796, 8246, 62, 15414, 7203, 47, 9625, 23412, 25, 366, 8, 198, 28300, 796, 657, 198, 9630, 796, 657, 198, 28300, 37374, 796, 493, 7, 1831, 62, 15414, 7203, 2061, 4314, 389, 356, 2045, 329, 30, 366, 4008, 198, 198, 2, 16718, 284, 2198, 262, 4129, 286, 262, 5128, 4731, 13, 198, 2, 3601, 18896, 7, 15414, 6601, 8, 198, 198, 1640, 1149, 287, 5128, 6601, 25, 198, 220, 220, 220, 611, 1149, 6624, 30629, 1298, 198, 220, 220, 220, 220, 220, 220, 220, 4314, 15853, 352, 198, 220, 220, 220, 1288, 361, 1149, 6624, 366, 8, 1298, 198, 220, 220, 220, 220, 220, 220, 220, 4314, 48185, 352, 628, 220, 220, 220, 6376, 15853, 352, 628, 220, 220, 220, 611, 4314, 6624, 4314, 37374, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 366, 464, 717, 640, 8909, 11864, 4314, 366, 1343, 965, 7, 28300, 37374, 8, 1343, 366, 318, 319, 12064, 1271, 366, 1343, 965, 7, 9630, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2270, 628 ]
3.346429
280
from ... import gvars from .parser import aead_reader from ..base.server import ProxyBase from ..shadowsocks.parser import addr_reader
[ 6738, 2644, 1330, 308, 85, 945, 198, 6738, 764, 48610, 1330, 257, 1329, 62, 46862, 198, 6738, 11485, 8692, 13, 15388, 1330, 38027, 14881, 198, 6738, 11485, 1477, 9797, 3320, 13, 48610, 1330, 37817, 62, 46862, 628 ]
3.675676
37
#!/bin/python3 import math import os import random import re import sys # NOTE: This only passes the first three test cases. if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') freq_count = int(input().strip()) freq = [] for _ in range(freq_count): freq_item = int(input().strip()) freq.append(freq_item) result = taskOfPairing(freq) fptr.write(str(result) + '\n') fptr.close()
[ 2, 48443, 8800, 14, 29412, 18, 198, 198, 11748, 10688, 198, 11748, 28686, 198, 11748, 4738, 198, 11748, 302, 198, 11748, 25064, 628, 198, 2, 24550, 25, 770, 691, 8318, 262, 717, 1115, 1332, 2663, 13, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 277, 20692, 796, 1280, 7, 418, 13, 268, 2268, 17816, 2606, 7250, 3843, 62, 34219, 6, 4357, 705, 86, 11537, 628, 220, 220, 220, 2030, 80, 62, 9127, 796, 493, 7, 15414, 22446, 36311, 28955, 628, 220, 220, 220, 2030, 80, 796, 17635, 628, 220, 220, 220, 329, 4808, 287, 2837, 7, 19503, 80, 62, 9127, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 2030, 80, 62, 9186, 796, 493, 7, 15414, 22446, 36311, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 2030, 80, 13, 33295, 7, 19503, 80, 62, 9186, 8, 628, 220, 220, 220, 1255, 796, 4876, 5189, 47, 958, 278, 7, 19503, 80, 8, 628, 220, 220, 220, 277, 20692, 13, 13564, 7, 2536, 7, 20274, 8, 1343, 705, 59, 77, 11537, 628, 220, 220, 220, 277, 20692, 13, 19836, 3419, 198 ]
2.391534
189
""" Bayesian Optimization experiment runner. Relies heavily on BoTorch. """ import os import logging import matplotlib.pyplot as plt import numpy as np import torch import sys # sys.path.append("../") import pickle as pkl from tqdm import tqdm import shutil from distutils.spawn import find_executable from utils.functionality import run_param_rollout_real, run_param_rollout from utils.functionality import push_github, modify_and_push_json from utils.sampling_functions import define_sample_fct from const import SIMULATION, GITHUB_BRANCH, DIFFICULTY_LEVEL, SAMPLE_FCT, NUM_INIT_SAMPLES, NUM_ROLLOUTS_PER_SAMPLE, NUM_ITERATIONS, NUM_ACQ_RESTARTS, ACQ_SAMPLES from const import SAMPLE_NEW, MODELS_TO_RUN from utils import normalization_tools logger = logging.getLogger(__file__) # Constants DIR_NAME = os.path.dirname(__file__) # NOT WORKING PROPERLY AT THE MOMENT #TORCH_DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") TORCH_DEVICE = torch.device("cpu") print(f"Using {TORCH_DEVICE}") # Tasks # Helpers class RRC_v1(object): """Sinc in a haystack task.""" # number of initial random points num_init_samples = NUM_INIT_SAMPLES #1#10 # number of BO updates num_iter = NUM_ITERATIONS #50 # number of restarts for optimizing the acquisition function num_acq_restarts = NUM_ACQ_RESTARTS#100 # number of index_set for used for optimizing the acquisition function num_acq_samples = ACQ_SAMPLES#500 plot_model = True # d_x should be dimension of x,.. d_x = 1 x_min = np.array([0.0]) x_max = np.array([0.02]) #TODO: identify meaning of y_opt, x_opt. Is this initial guess? y_opt = 0 x_opt = np.array([0.0]) param_normalizer = normalization_tools.UnitCubeProjector(x_min,x_max) @staticmethod EXPERIMENTS = { "rrc_v1" : RRC_v1, } if __name__ == "__main__": import argparse from datetime import datetime DATETIME = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") parser = argparse.ArgumentParser(description="Run Experiment") parser.add_argument("--experiment", help="Task to run", default="DefaultExp") parser.add_argument("--path", help="Path where results are to be stored", default="") parser.add_argument("-s", "--seed", type=int, help="Random seed", default=0) args = parser.parse_args() name = str(args.experiment) res_dir = make_results_folder(name, datetime=True, abs_path = args.path) configure_matplotlib() setup_logger(logger, res_dir) np.random.seed(args.seed) torch.manual_seed(args.seed) try: main(args, res_dir) except: logger.exception("Experiment failed:") raise plt.show()
[ 37811, 198, 15262, 35610, 30011, 1634, 6306, 17490, 13, 198, 198, 6892, 444, 7272, 319, 3248, 15884, 354, 13, 198, 37811, 198, 198, 11748, 28686, 198, 11748, 18931, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 198, 11748, 25064, 198, 2, 25064, 13, 6978, 13, 33295, 7203, 40720, 4943, 198, 11748, 2298, 293, 355, 279, 41582, 198, 198, 6738, 256, 80, 36020, 1330, 256, 80, 36020, 198, 198, 11748, 4423, 346, 198, 6738, 1233, 26791, 13, 48183, 1330, 1064, 62, 18558, 18187, 198, 198, 6738, 3384, 4487, 13, 8818, 1483, 1330, 1057, 62, 17143, 62, 2487, 448, 62, 5305, 11, 1057, 62, 17143, 62, 2487, 448, 198, 6738, 3384, 4487, 13, 8818, 1483, 1330, 4574, 62, 12567, 11, 13096, 62, 392, 62, 14689, 62, 17752, 198, 6738, 3384, 4487, 13, 37687, 11347, 62, 12543, 2733, 1330, 8160, 62, 39873, 62, 69, 310, 198, 198, 6738, 1500, 1330, 23749, 6239, 6234, 11, 402, 10554, 10526, 62, 11473, 1565, 3398, 11, 360, 29267, 2149, 6239, 9936, 62, 2538, 18697, 11, 28844, 16437, 62, 37, 4177, 11, 36871, 62, 1268, 2043, 62, 49302, 6489, 1546, 11, 36871, 62, 13252, 3069, 2606, 4694, 62, 18973, 62, 49302, 16437, 11, 36871, 62, 2043, 1137, 18421, 11, 36871, 62, 2246, 48, 62, 49, 6465, 1503, 4694, 11, 7125, 48, 62, 49302, 6489, 1546, 198, 6738, 1500, 1330, 28844, 16437, 62, 13965, 11, 19164, 37142, 62, 10468, 62, 49, 4944, 198, 6738, 3384, 4487, 1330, 3487, 1634, 62, 31391, 198, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 7753, 834, 8, 628, 198, 2, 4757, 1187, 198, 198, 34720, 62, 20608, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 8, 198, 2, 5626, 30936, 2751, 4810, 31054, 11319, 5161, 3336, 337, 2662, 3525, 198, 2, 32961, 3398, 62, 7206, 27389, 796, 28034, 13, 25202, 7203, 66, 15339, 25, 15, 1, 611, 28034, 13, 66, 15339, 13, 271, 62, 15182, 3419, 2073, 366, 36166, 4943, 198, 32961, 3398, 62, 7206, 27389, 796, 28034, 13, 25202, 7203, 36166, 4943, 198, 4798, 7, 69, 1, 12814, 1391, 32961, 3398, 62, 7206, 27389, 92, 4943, 628, 198, 2, 309, 6791, 198, 198, 2, 10478, 364, 628, 198, 198, 4871, 371, 7397, 62, 85, 16, 7, 15252, 2599, 198, 220, 220, 220, 37227, 50, 1939, 287, 257, 27678, 25558, 4876, 526, 15931, 198, 220, 220, 220, 1303, 1271, 286, 4238, 4738, 2173, 198, 220, 220, 220, 997, 62, 15003, 62, 82, 12629, 796, 36871, 62, 1268, 2043, 62, 49302, 6489, 1546, 1303, 16, 2, 940, 198, 220, 220, 220, 1303, 1271, 286, 16494, 5992, 198, 220, 220, 220, 997, 62, 2676, 796, 36871, 62, 2043, 1137, 18421, 1303, 1120, 198, 220, 220, 220, 1303, 1271, 286, 1334, 5889, 329, 45780, 262, 12673, 2163, 198, 220, 220, 220, 997, 62, 330, 80, 62, 2118, 5889, 796, 36871, 62, 2246, 48, 62, 49, 6465, 1503, 4694, 2, 3064, 198, 220, 220, 220, 1303, 1271, 286, 6376, 62, 2617, 329, 973, 329, 45780, 262, 12673, 2163, 198, 220, 220, 220, 997, 62, 330, 80, 62, 82, 12629, 796, 7125, 48, 62, 49302, 6489, 1546, 2, 4059, 628, 220, 220, 220, 7110, 62, 19849, 796, 6407, 198, 220, 220, 220, 1303, 288, 62, 87, 815, 307, 15793, 286, 2124, 11, 492, 198, 220, 220, 220, 288, 62, 87, 796, 352, 198, 220, 220, 220, 2124, 62, 1084, 796, 45941, 13, 18747, 26933, 15, 13, 15, 12962, 198, 220, 220, 220, 2124, 62, 9806, 796, 45941, 13, 18747, 26933, 15, 13, 2999, 12962, 198, 220, 220, 220, 1303, 51, 3727, 46, 25, 5911, 3616, 286, 331, 62, 8738, 11, 2124, 62, 8738, 13, 1148, 428, 4238, 4724, 30, 198, 220, 220, 220, 331, 62, 8738, 796, 657, 198, 220, 220, 220, 2124, 62, 8738, 796, 45941, 13, 18747, 26933, 15, 13, 15, 12962, 628, 220, 220, 220, 5772, 62, 11265, 7509, 796, 3487, 1634, 62, 31391, 13, 26453, 29071, 16775, 273, 7, 87, 62, 1084, 11, 87, 62, 9806, 8, 628, 220, 220, 220, 2488, 12708, 24396, 628, 628, 198, 198, 6369, 18973, 3955, 15365, 796, 1391, 198, 220, 220, 220, 366, 81, 6015, 62, 85, 16, 1, 220, 220, 220, 1058, 371, 7397, 62, 85, 16, 11, 198, 92, 628, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1330, 1822, 29572, 628, 220, 220, 220, 422, 4818, 8079, 1330, 4818, 8079, 628, 220, 220, 220, 360, 1404, 2767, 12789, 796, 4818, 8079, 13, 2197, 22446, 2536, 31387, 7203, 4, 56, 12, 4, 76, 12, 4, 67, 62, 4, 39, 12, 4, 44, 12, 4, 50, 4943, 628, 628, 628, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 11213, 2625, 10987, 29544, 4943, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 438, 23100, 3681, 1600, 1037, 2625, 25714, 284, 1057, 1600, 4277, 2625, 19463, 16870, 4943, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 438, 6978, 1600, 1037, 2625, 15235, 810, 2482, 389, 284, 307, 8574, 1600, 4277, 2625, 4943, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 82, 1600, 366, 438, 28826, 1600, 2099, 28, 600, 11, 1037, 2625, 29531, 9403, 1600, 4277, 28, 15, 8, 628, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 198, 220, 220, 220, 1438, 796, 965, 7, 22046, 13, 23100, 3681, 8, 198, 220, 220, 220, 581, 62, 15908, 796, 787, 62, 43420, 62, 43551, 7, 3672, 11, 4818, 8079, 28, 17821, 11, 2352, 62, 6978, 796, 26498, 13, 6978, 8, 628, 220, 220, 220, 17425, 62, 6759, 29487, 8019, 3419, 198, 220, 220, 220, 9058, 62, 6404, 1362, 7, 6404, 1362, 11, 581, 62, 15908, 8, 628, 220, 220, 220, 45941, 13, 25120, 13, 28826, 7, 22046, 13, 28826, 8, 198, 220, 220, 220, 28034, 13, 805, 723, 62, 28826, 7, 22046, 13, 28826, 8, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1388, 7, 22046, 11, 581, 62, 15908, 8, 198, 220, 220, 220, 2845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 49706, 13, 1069, 4516, 7203, 20468, 3681, 4054, 25, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 198, 220, 220, 220, 458, 83, 13, 12860, 3419, 198 ]
2.58365
1,052
import requests import json from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.shortcuts import render, redirect, get_object_or_404 from django.views import generic from django.views.generic.edit import DeleteView from django.core.urlresolvers import reverse_lazy from .models import Place, AlternativeName from .forms import PlaceForm, AlternativeNameForm @login_required @login_required @login_required @login_required
[ 11748, 7007, 198, 11748, 33918, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 12501, 273, 2024, 1330, 17594, 62, 35827, 198, 6738, 42625, 14208, 13, 26791, 13, 12501, 273, 2024, 1330, 2446, 62, 12501, 273, 1352, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 18941, 11, 651, 62, 15252, 62, 273, 62, 26429, 198, 6738, 42625, 14208, 13, 33571, 1330, 14276, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 13, 19312, 1330, 23520, 7680, 198, 6738, 42625, 14208, 13, 7295, 13, 6371, 411, 349, 690, 1330, 9575, 62, 75, 12582, 198, 198, 6738, 764, 27530, 1330, 8474, 11, 27182, 5376, 198, 6738, 764, 23914, 1330, 8474, 8479, 11, 27182, 5376, 8479, 628, 198, 31, 38235, 62, 35827, 628, 198, 198, 31, 38235, 62, 35827, 628, 198, 31, 38235, 62, 35827, 628, 628, 198, 31, 38235, 62, 35827, 628 ]
3.56338
142
""" # data_getter The data getter manages the initialization of different torch DataLoaders. A dataloader is essentially an Iterable that can be called in a for-loop. A typical training step could for example look like this: data_loaders = data_getter.get_data_loaders(...) for sample in data_loader['train']: image, label = sample[0], sample[1] prediction = model(image) loss = loss_function(prediction, label) ... A dataloader contains an object of class Dataset that handles the loading and augmentation process. 'ds_natural_images' gives an example for a custom dataset. 'get_data_loaders' expects a string 'dataset' that identifies which dataset is to be used (e.g., mnist, cifar-10, ...). 'batch_size' denotes how many samples (here mainly images) are combined to a mini-batch. A typical PyTorch minibatch tensor of images has the dimension: (batch_size, 3, height of image, width of image) 3 is the dimension of the three image channels red, green, and blue. In 'run_training.py', batch_size is defined by the argument 'bs'. 'num_workers' defines how many processes load data in parallel. Using more than one worker can, in specific cases, speed up the dataset loading process and , thus, the entire training. If you want to debug your code, num_workers needs to be set to 0. In 'run_training.py', num_workers is defined by the argument 'nw'. You can use kwargs (in 'run_training.py' the system argument 'ds_kwargs') to pass configuration values that are very specific to a dataset. kwargs is a dictionary of keyword-value pairs. EACH VALUE IS A LIST, even if it only contains a single element. Furthermore, you need to take care of each value's type. For example, split_index = int(kwargs['split_index'][0]) contains a list with a string. To get the actual number, you'll need to typecast it to an int. For more information, see DLBio's 'kwargs_translator'. To add a new dataset, you'll need to create a new file 'ds_[dataset_name].py' in the 'data' folder. You'll need to create a class that inherits Dataset and implements '__getitem__' and '__len__'. Furthermore, you'll need to define the function 'get_dataloader'. Finally, you'll need to append an elif case to this module's function 'get_data_loaders' that calls 'get_dataloader' and returns a dictionary containing the keys 'train', 'val', and 'test'. If there is no 'val' or 'test' dataloader available, set these values to None. 'ds_natural_images.py' is an example of how to write a custom dataset. """ from . import ds_natural_images from . import ds_cifar10 from . import ds_mnist
[ 37811, 198, 2, 1366, 62, 1136, 353, 198, 464, 1366, 651, 353, 15314, 262, 37588, 286, 1180, 28034, 6060, 8912, 364, 13, 198, 32, 4818, 282, 1170, 263, 318, 6986, 281, 40806, 540, 326, 460, 307, 1444, 287, 257, 329, 12, 26268, 13, 198, 198, 32, 7226, 3047, 2239, 714, 329, 1672, 804, 588, 428, 25, 198, 198, 7890, 62, 2220, 364, 796, 1366, 62, 1136, 353, 13, 1136, 62, 7890, 62, 2220, 364, 7, 23029, 198, 1640, 6291, 287, 1366, 62, 29356, 17816, 27432, 6, 5974, 198, 220, 220, 220, 2939, 11, 6167, 796, 6291, 58, 15, 4357, 6291, 58, 16, 60, 198, 220, 220, 220, 17724, 796, 2746, 7, 9060, 8, 198, 220, 220, 220, 2994, 796, 2994, 62, 8818, 7, 28764, 2867, 11, 6167, 8, 198, 220, 220, 220, 2644, 628, 198, 32, 4818, 282, 1170, 263, 4909, 281, 2134, 286, 1398, 16092, 292, 316, 326, 17105, 262, 11046, 290, 16339, 14374, 1429, 13, 705, 9310, 62, 11802, 62, 17566, 6, 3607, 281, 1672, 329, 257, 2183, 220, 198, 19608, 292, 316, 13, 198, 198, 6, 1136, 62, 7890, 62, 2220, 364, 6, 13423, 257, 4731, 705, 19608, 292, 316, 6, 326, 21079, 543, 27039, 318, 284, 307, 973, 357, 68, 13, 70, 1539, 285, 77, 396, 11, 269, 361, 283, 12, 940, 11, 2644, 737, 705, 43501, 62, 7857, 6, 43397, 703, 867, 198, 82, 12629, 357, 1456, 8384, 4263, 8, 389, 5929, 284, 257, 9927, 12, 43501, 13, 317, 7226, 9485, 15884, 354, 198, 1084, 571, 963, 11192, 273, 286, 4263, 468, 262, 15793, 25, 198, 7, 43501, 62, 7857, 11, 513, 11, 6001, 286, 2939, 11, 9647, 286, 2939, 8, 198, 18, 318, 262, 15793, 286, 262, 1115, 2939, 9619, 2266, 11, 4077, 11, 290, 4171, 13, 198, 818, 705, 5143, 62, 34409, 13, 9078, 3256, 15458, 62, 7857, 318, 5447, 416, 262, 4578, 705, 1443, 4458, 198, 198, 6, 22510, 62, 22896, 6, 15738, 703, 867, 7767, 3440, 1366, 287, 10730, 13, 8554, 517, 621, 220, 198, 505, 8383, 460, 11, 287, 2176, 2663, 11, 2866, 510, 262, 27039, 11046, 1429, 290, 220, 198, 11, 4145, 11, 262, 2104, 3047, 13, 1002, 345, 765, 284, 14257, 534, 2438, 11, 997, 62, 22896, 2476, 198, 1462, 307, 900, 284, 657, 13, 198, 818, 705, 5143, 62, 34409, 13, 9078, 3256, 997, 62, 22896, 318, 5447, 416, 262, 4578, 705, 47516, 4458, 198, 198, 1639, 460, 779, 479, 86, 22046, 357, 259, 705, 5143, 62, 34409, 13, 9078, 6, 262, 1080, 4578, 705, 9310, 62, 46265, 22046, 11537, 284, 198, 6603, 8398, 3815, 326, 389, 845, 2176, 284, 257, 27039, 13, 198, 46265, 22046, 318, 257, 22155, 286, 21179, 12, 8367, 14729, 13, 412, 16219, 26173, 8924, 3180, 317, 39498, 11, 772, 611, 340, 220, 198, 8807, 4909, 257, 2060, 5002, 13, 11399, 11, 345, 761, 284, 1011, 1337, 286, 1123, 220, 198, 8367, 338, 2099, 13, 1114, 1672, 11, 198, 198, 35312, 62, 9630, 796, 493, 7, 46265, 22046, 17816, 35312, 62, 9630, 6, 7131, 15, 12962, 198, 198, 3642, 1299, 257, 1351, 351, 257, 4731, 13, 1675, 651, 262, 4036, 1271, 11, 345, 1183, 761, 284, 2099, 2701, 198, 270, 284, 281, 493, 13, 198, 1890, 517, 1321, 11, 766, 23641, 42787, 338, 705, 46265, 22046, 62, 7645, 41880, 4458, 198, 198, 2514, 751, 257, 649, 27039, 11, 345, 1183, 761, 284, 2251, 257, 649, 2393, 705, 9310, 62, 58, 19608, 292, 316, 62, 3672, 4083, 9078, 6, 220, 198, 259, 262, 705, 7890, 6, 9483, 13, 921, 1183, 761, 284, 2251, 257, 1398, 326, 10639, 896, 16092, 292, 316, 290, 198, 320, 1154, 902, 705, 834, 1136, 9186, 834, 6, 290, 705, 834, 11925, 834, 4458, 11399, 11, 345, 1183, 761, 284, 8160, 262, 198, 8818, 705, 1136, 62, 67, 10254, 1170, 263, 4458, 9461, 11, 345, 1183, 761, 284, 24443, 281, 1288, 361, 1339, 284, 428, 198, 21412, 338, 2163, 705, 1136, 62, 7890, 62, 2220, 364, 6, 326, 3848, 705, 1136, 62, 67, 10254, 1170, 263, 6, 290, 5860, 198, 64, 22155, 7268, 262, 8251, 705, 27432, 3256, 705, 2100, 3256, 290, 705, 9288, 4458, 1002, 612, 318, 645, 198, 6, 2100, 6, 393, 705, 9288, 6, 4818, 282, 1170, 263, 1695, 11, 900, 777, 3815, 284, 6045, 13, 198, 1549, 82, 62, 11802, 62, 17566, 13, 9078, 6, 318, 281, 1672, 286, 703, 284, 3551, 257, 2183, 27039, 13, 198, 198, 37811, 198, 6738, 764, 1330, 288, 82, 62, 11802, 62, 17566, 198, 6738, 764, 1330, 288, 82, 62, 66, 361, 283, 940, 198, 6738, 764, 1330, 288, 82, 62, 10295, 396, 628 ]
3.384817
764
import pytest from _voronoi import recompute_segment_segment_segment_circle_event as bound from hypothesis import given from tests.integration_tests.hints import (BoundPortedCircleEventsPair, BoundPortedSiteEventsPair) from tests.integration_tests.utils import are_bound_ported_circle_events_equal from voronoi.events.computers import ( recompute_segment_segment_segment_circle_event as ported) from . import strategies @given(strategies.circle_events_pairs, strategies.site_events_pairs, strategies.site_events_pairs, strategies.site_events_pairs, strategies.booleans, strategies.booleans, strategies.booleans)
[ 11748, 12972, 9288, 198, 6738, 4808, 20867, 261, 23013, 1330, 48765, 1133, 62, 325, 5154, 62, 325, 5154, 62, 325, 5154, 62, 45597, 62, 15596, 355, 5421, 198, 6738, 14078, 1330, 1813, 198, 198, 6738, 5254, 13, 18908, 1358, 62, 41989, 13, 71, 29503, 1330, 357, 49646, 47, 9741, 31560, 293, 37103, 47, 958, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 30149, 47, 9741, 29123, 37103, 47, 958, 8, 198, 6738, 5254, 13, 18908, 1358, 62, 41989, 13, 26791, 1330, 389, 62, 7784, 62, 9213, 62, 45597, 62, 31534, 62, 40496, 198, 6738, 410, 273, 261, 23013, 13, 31534, 13, 785, 41510, 1330, 357, 198, 220, 220, 220, 48765, 1133, 62, 325, 5154, 62, 325, 5154, 62, 325, 5154, 62, 45597, 62, 15596, 355, 49702, 8, 198, 6738, 764, 1330, 10064, 628, 198, 31, 35569, 7, 2536, 2397, 444, 13, 45597, 62, 31534, 62, 79, 3468, 11, 10064, 13, 15654, 62, 31534, 62, 79, 3468, 11, 198, 220, 220, 220, 220, 220, 220, 10064, 13, 15654, 62, 31534, 62, 79, 3468, 11, 10064, 13, 15654, 62, 31534, 62, 79, 3468, 11, 198, 220, 220, 220, 220, 220, 220, 10064, 13, 2127, 2305, 504, 11, 10064, 13, 2127, 2305, 504, 11, 10064, 13, 2127, 2305, 504, 8, 198 ]
2.770492
244
#!/usr/bin/env python ''' This script reads in seismic noise data from March 2017 and earthquake data. It shifts the data by time for clustering It creates a list of earthquake times in March when the peak ground motion is greater than a certain amount. It clusters earthquake channels using kmeans and dbscan. It compares the clusters around the earthquake times to deterime effectiveness of clustering It plots the data as clustered by kmeans and dbscan ''' from __future__ import division from sklearn.cluster import KMeans from sklearn.cluster import DBSCAN from sklearn.cluster import AffinityPropagation from sklearn.cluster import MeanShift,estimate_bandwidth from sklearn.cluster import spectral_clustering from sklearn.cluster import AgglomerativeClustering from sklearn.cluster import Birch from sklearn import metrics from sklearn.preprocessing import StandardScaler import numpy as np from scipy.io import loadmat import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.pyplot import cm import scipy.signal from astropy.time import Time import collections plt.rc('text', usetex = True) plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('axes', labelsize = 20.0) plt.rc('axes', axisbelow = True) plt.rc('axes.formatter', limits=[-3,4]) plt.rc('legend', fontsize = 14.0) plt.rc('xtick', labelsize = 16.0) plt.rc('ytick', labelsize = 16.0) plt.rc('figure', dpi = 100) # colors for clusters colors = np.array(['r', 'g', 'b','y','c','m','darkgreen','plum', 'darkblue','pink','orangered','indigo']) cl = 6 # number of clusters for kmeans eps = 2 # min distance for density for DBscan min_samples = 15 # min samples for DBscan #read in data H1dat = loadmat('Data/' + 'H1_SeismicBLRMS.mat') edat = np.loadtxt('Data/H1_earthquakes.txt') # read in earthquake channels cols = [6,12,18,24,30,36,42,48] # NEED comment here vdat = np.array(H1dat['data'][0]) vchans = np.array(H1dat['chans'][0]) for i in cols: add = np.array(H1dat['data'][i]) vdat = np.vstack((vdat, add)) for i in cols: vchans = np.append(vchans,H1dat['chans'][i]) timetuples = vdat.T # shift the dat vdat2 = vdat vchans2 = vchans num = 10 t_shift = 30 # how many minutes to shift the data by for i in cols: add = np.array(H1dat['data'][i]) for j in range(1, t_shift+1): add_shift = add[j:] add_values = np.zeros((j,1)) add_shift = np.append(add_shift, add_values) vdat2 = np.vstack((vdat2, add_shift)) chan = 'Time_Shift_' + str(j) + '_Min_EQ_Band_' + str(i) vchans2 = np.append(vchans2, chan) print(np.shape(vdat2)) vdat2 = vdat[:,:43200-t_shift] print(np.shape(vdat2)) timetuples2 = vdat.T timetuples3 = vdat[0:num].T #convert time to gps time times = '2017-03-01 00:00:00' t = Time(times,format='iso',scale='utc') t_start = int(np.floor(t.gps/60)*60) dur_in_days = 30 dur_in_minutes = dur_in_days*24*60 dur = dur_in_minutes*60 t_end = t_start + dur # use peak ground motion to determine which earthquakes are bigger row, col = np.shape(edat) gdat = np.array([]) for i in range(row): point = edat[i][20] gdat = np.append(gdat,point) gdat = gdat.T glq = np.percentile(gdat,65) # use only earthquakes with signifigant ground motion row, col = np.shape(edat) etime = np.array([]) for i in range(row): if (edat[i][20] >= glq): point = edat[i][5] etime = np.append(etime,point) # use only earthqaukes that occur in March 2017 col = len(etime) etime_march = np.array([]) for i in range(col): if ((etime[i] >= t_start) and (etime[i] <= t_end)): point = etime[i] etime_march = np.append(etime_march,point) # kmeans clustering loop Nmin = 2 Nmax = Nmin + num for cl in range(Nmin, Nmax): kmeans = KMeans(n_clusters=cl, random_state=13).fit(timetuples) kpoints = np.array([]) xvals = np.arange(t_start, t_end, 60) dbpoints = np.array([]) for t in etime_march: #for each EQ: collect indices within 5 min of EQ tmin = int(t - 5*60) tmax = int(t + 5*60) for j in range(tmin, tmax): val = abs(xvals - j) aval = np.argmin(val) kpoints = np.append(kpoints, aval) kpoints = np.unique(kpoints) # make sure there are no repeating indices kclusters = np.array([]) for i in kpoints: #for each index find the corresponding cluster and store them in array kclusters = np.append(kclusters,kmeans.labels_[int(i)]) # kmeans score determined by ratio of points in # cluster/points near EQ to points in cluster/all points print(' ') print('Cl = ' + str(cl)) print('Number of points in each cluster that are near an EQ') print(collections.Counter(kclusters)) print('Number of points in each cluster') print(collections.Counter(kmeans.labels_)) k_count = collections.Counter(kclusters).most_common() ktot_count = collections.Counter(kmeans.labels_).most_common() k_list_cl = [x[0] for x in k_count] #cluster number k_list = [x[1] for x in k_count] #occurences of cluster ktot_list_cl = [x[0] for x in ktot_count] ktot_list = [x[1] for x in ktot_count] k_clusters = np.array([]) k_compare = np.array([]) k_list2 = np.array([]) ktot_list2 = np.array([]) # arrange so that k_clusters k_list2 and k_compare are in the same order for i in range(len(k_list_cl)): for j in range(len(ktot_list_cl)): if k_list_cl[i] == ktot_list_cl[j]: k_clusters = np.append(k_clusters,k_list_cl[i]) compare = k_list[i]/ktot_list[j] k_compare = np.append(k_compare, compare) k_list2 = np.append(k_list2, k_list[i]) ktot_list2 = np.append(ktot_list2, k_list[i]) print('List with the clusters in order (huh?)') print(k_clusters) print('Num_points around EQ divided by total Num_points in clusters') np.set_printoptions(precision=3) print(k_compare) k_cal_score = metrics.calinski_harabaz_score(timetuples, kmeans.labels_) print('K-means ' + str(cl) + ': C-H score = {:0.6g}'.format(k_cal_score)) # dbscan clustering loop ''' min_samples_list = [10,20,25,30] for min_samples in min_samples_list: db = DBSCAN(eps=eps,min_samples=min_samples).fit(timetuples) #print number of clusters print(' ') n_clusters_ = len(set(db.labels_)) - (1 if -1 in db.labels_ else 0) print('DBSCAN created ' +str(n_clusters_) + ' clusters') #add up number of clusters that appear next to each earthquake xvals = np.arange(t_start,t_end,60) dbpoints = np.array([]) for t in etime_march: #for each EQ: collect indices within 5 min of EQ tmin = int(t-5*60) tmax = int(t+5*60) for j in range(tmin,tmax): val = abs(xvals-j) aval = np.argmin(val) dbpoints = np.append(dbpoints, aval) dbpoints = np.unique(dbpoints) dbclusters = np.array([]) for i in dbpoints: dbclusters = np.append(dbclusters,db.labels_[int(i)]) #for each index find the corresponding cluster and store them in array #dbscan score determined by percent of points sorted into one cluster near EQ print('Number of points in each cluster that are near an EQ') print(collections.Counter(dbclusters)) print('Number of points in each cluster') print(collections.Counter(db.labels_)) db_count = collections.Counter(dbclusters).most_common() dbtot_count = collections.Counter(db.labels_).most_common() db_list_cl = [x[0] for x in db_count] db_list = [x[1] for x in db_count] dbtot_list_cl = [x[0] for x in dbtot_count] dbtot_list = [x[1] for x in dbtot_count] db_clusters = np.array([]) db_compare = np.array([]) db_list2 = np.array([]) dbtot_list2 = np.array([]) for i in range(len(db_list_cl)): for j in range(len(dbtot_list_cl)): if db_list_cl[i] == dbtot_list_cl[j]: db_clusters = np.append(db_clusters,db_list_cl[i]) compare = db_list[i]/dbtot_list[j] db_compare = np.append(db_compare, compare) db_list2 = np.append(db_list2, db_list[i]) dbtot_list2 = np.append(dbtot_list2, db_list[i]) print('List with the clusters in order') print(db_clusters) print('Number of points in clusters near EQ divided by total number of points in clusters') print(db_compare) d_cal_score = metrics.calinski_harabaz_score(timetuples, db.labels_) print('For dbscan the calinski harabaz score is ' + str(d_cal_score)) ''' # Plot #1: Plot graph of kmeans clustering for EQ kmeans = KMeans(n_clusters=cl, random_state=12).fit(timetuples) xvals = np.arange(t_start, t_end, 60) fig,axes = plt.subplots(len(vdat), figsize=(40, 4*len(vdat))) for ax, data, chan in zip(axes, vdat, vchans2): ax.scatter(xvals, data, c = colors[kmeans.labels_], edgecolor = '', s=4, alpha=0.8, label=r'$\mathrm{%s}$' % chan.replace('_','\_')) ax.set_yscale('log') ax.set_ylim(8, 11000) ax.set_xlabel('GPS Time') ax.grid(True, which='both') ax.legend() for e in range(len(etime_march)): ax.axvline(x=etime_march[e]) fig.tight_layout() fig.savefig('Figures/EQdata_Kmeans_' + str(cl) + '.png', rasterized=True) try: fig.savefig('/home/roxana.popescu/public_html/' + 'EQdata_Kmeans_'+str(cl)+'.png', rasterized=True) except: print(" ") # Plot #2:plot graph of dbscan clustering for EQ db = DBSCAN(eps=eps,min_samples=min_samples).fit(timetuples) xvals = np.arange(t_start, t_end, 60) # print number of clusters n_clusters_ = len(set(db.labels_)) - (1 if -1 in db.labels_ else 0) print('DBSCAN created ' +str(n_clusters_) + ' clusters') fig, axes = plt.subplots(len(vdat), figsize=(40,4*len(vdat))) for ax, data, chan in zip(axes, vdat, vchans2): ax.scatter(xvals, data, c=colors[db.labels_], edgecolor='', s=5, alpha=0.8, label=r'$\mathrm{%s}$' % chan.replace('_','\_')) ax.set_yscale('log') ax.set_ylim(8, 11000) ax.set_xlabel('GPS Time') ax.grid(True, which='both') ax.legend() for e in range(len(etime_march)): ax.axvline(x=etime_march[e]) fig.tight_layout() fig.savefig('Figures/dbscan_all.png', rasterized=True) try: fig.savefig('/home/roxana.popescu/public_html/' + 'dbscan_all_.png', rasterized=True) except: print(" ")
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 7061, 6, 198, 1212, 4226, 9743, 287, 37463, 7838, 1366, 422, 2805, 2177, 290, 16295, 1366, 13, 198, 1026, 15381, 262, 1366, 416, 640, 329, 32966, 1586, 198, 1026, 8075, 257, 1351, 286, 16295, 1661, 287, 2805, 618, 262, 9103, 2323, 6268, 318, 3744, 621, 257, 1728, 2033, 13, 198, 1026, 23163, 16295, 9619, 1262, 479, 1326, 504, 290, 20613, 35836, 13, 198, 1026, 23008, 262, 23163, 1088, 262, 16295, 1661, 284, 2206, 524, 13530, 286, 32966, 1586, 198, 1026, 21528, 262, 1366, 355, 49480, 416, 479, 1326, 504, 290, 20613, 35836, 198, 7061, 6, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 509, 5308, 504, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 360, 4462, 44565, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 6708, 6269, 24331, 363, 341, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 22728, 33377, 11, 395, 1920, 62, 3903, 10394, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 37410, 62, 565, 436, 1586, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 19015, 75, 12057, 876, 2601, 436, 1586, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 47631, 198, 6738, 1341, 35720, 1330, 20731, 198, 6738, 1341, 35720, 13, 3866, 36948, 1330, 8997, 3351, 36213, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 629, 541, 88, 13, 952, 1330, 3440, 6759, 198, 11748, 2603, 29487, 8019, 198, 6759, 29487, 8019, 13, 1904, 10786, 46384, 11537, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 2603, 29487, 8019, 13, 9078, 29487, 1330, 12067, 198, 11748, 629, 541, 88, 13, 12683, 282, 198, 6738, 6468, 28338, 13, 2435, 1330, 3862, 198, 11748, 17268, 198, 198, 489, 83, 13, 6015, 10786, 5239, 3256, 220, 220, 514, 316, 1069, 796, 6407, 8, 198, 489, 83, 13, 6015, 10786, 10331, 3256, 220, 220, 12429, 90, 6, 17989, 10354, 705, 2655, 361, 3256, 705, 2655, 361, 10354, 37250, 34556, 12495, 20520, 30072, 198, 489, 83, 13, 6015, 10786, 897, 274, 3256, 220, 220, 14722, 1096, 796, 1160, 13, 15, 8, 198, 489, 83, 13, 6015, 10786, 897, 274, 3256, 220, 220, 16488, 35993, 796, 6407, 8, 198, 489, 83, 13, 6015, 10786, 897, 274, 13, 687, 1436, 3256, 7095, 41888, 12, 18, 11, 19, 12962, 198, 489, 83, 13, 6015, 10786, 1455, 437, 3256, 10369, 7857, 220, 796, 1478, 13, 15, 8, 198, 489, 83, 13, 6015, 10786, 742, 624, 3256, 220, 14722, 1096, 796, 1467, 13, 15, 8, 198, 489, 83, 13, 6015, 10786, 20760, 624, 3256, 220, 14722, 1096, 796, 1467, 13, 15, 8, 198, 489, 83, 13, 6015, 10786, 26875, 3256, 288, 14415, 796, 1802, 8, 198, 198, 2, 7577, 329, 23163, 198, 4033, 669, 796, 45941, 13, 18747, 7, 17816, 81, 3256, 705, 70, 3256, 705, 65, 41707, 88, 41707, 66, 41707, 76, 41707, 21953, 14809, 41707, 489, 388, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 21953, 17585, 41707, 79, 676, 41707, 273, 19041, 41707, 521, 14031, 6, 12962, 628, 198, 565, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 718, 220, 220, 1303, 1271, 286, 23163, 329, 479, 1326, 504, 198, 25386, 220, 220, 220, 220, 220, 220, 220, 220, 796, 362, 220, 220, 1303, 949, 5253, 329, 12109, 329, 20137, 35836, 198, 1084, 62, 82, 12629, 796, 1315, 220, 1303, 949, 8405, 329, 20137, 35836, 198, 198, 2, 961, 287, 1366, 198, 39, 16, 19608, 796, 3440, 6759, 10786, 6601, 14, 6, 1343, 705, 39, 16, 62, 4653, 1042, 291, 9148, 49, 5653, 13, 6759, 11537, 198, 276, 265, 220, 796, 45941, 13, 2220, 14116, 10786, 6601, 14, 39, 16, 62, 16442, 421, 1124, 13, 14116, 11537, 198, 198, 2, 1100, 287, 16295, 9619, 198, 4033, 82, 220, 220, 796, 685, 21, 11, 1065, 11, 1507, 11, 1731, 11, 1270, 11, 2623, 11, 3682, 11, 2780, 60, 220, 220, 220, 220, 220, 1303, 36465, 2912, 994, 198, 85, 19608, 220, 220, 796, 45941, 13, 18747, 7, 39, 16, 19608, 17816, 7890, 6, 7131, 15, 12962, 198, 85, 354, 504, 796, 45941, 13, 18747, 7, 39, 16, 19608, 17816, 354, 504, 6, 7131, 15, 12962, 198, 1640, 1312, 287, 951, 82, 25, 198, 220, 220, 220, 751, 796, 45941, 13, 18747, 7, 39, 16, 19608, 17816, 7890, 6, 7131, 72, 12962, 198, 220, 220, 220, 410, 19608, 796, 45941, 13, 85, 25558, 19510, 85, 19608, 11, 751, 4008, 198, 1640, 1312, 287, 951, 82, 25, 198, 220, 220, 220, 410, 354, 504, 796, 45941, 13, 33295, 7, 85, 354, 504, 11, 39, 16, 19608, 17816, 354, 504, 6, 7131, 72, 12962, 198, 16514, 316, 84, 2374, 796, 410, 19608, 13, 51, 198, 198, 2, 6482, 262, 4818, 198, 85, 19608, 17, 220, 220, 796, 410, 19608, 198, 85, 354, 504, 17, 796, 410, 354, 504, 198, 22510, 220, 220, 220, 220, 796, 838, 198, 83, 62, 30846, 796, 1542, 1303, 703, 867, 2431, 284, 6482, 262, 1366, 416, 198, 1640, 1312, 287, 951, 82, 25, 198, 220, 220, 220, 751, 796, 45941, 13, 18747, 7, 39, 16, 19608, 17816, 7890, 6, 7131, 72, 12962, 198, 220, 220, 220, 329, 474, 287, 2837, 7, 16, 11, 256, 62, 30846, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 751, 62, 30846, 796, 751, 58, 73, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 751, 62, 27160, 796, 45941, 13, 9107, 418, 19510, 73, 11, 16, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 751, 62, 30846, 796, 45941, 13, 33295, 7, 2860, 62, 30846, 11, 751, 62, 27160, 8, 198, 220, 220, 220, 220, 220, 220, 220, 410, 19608, 17, 796, 45941, 13, 85, 25558, 19510, 85, 19608, 17, 11, 751, 62, 30846, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 442, 272, 796, 705, 7575, 62, 33377, 62, 6, 1343, 965, 7, 73, 8, 1343, 705, 62, 9452, 62, 36, 48, 62, 31407, 62, 6, 1343, 965, 7, 72, 8, 198, 220, 220, 220, 220, 220, 220, 220, 410, 354, 504, 17, 796, 45941, 13, 33295, 7, 85, 354, 504, 17, 11, 442, 272, 8, 198, 4798, 7, 37659, 13, 43358, 7, 85, 19608, 17, 4008, 198, 85, 19608, 17, 796, 410, 19608, 58, 45299, 25, 3559, 2167, 12, 83, 62, 30846, 60, 198, 4798, 7, 37659, 13, 43358, 7, 85, 19608, 17, 4008, 198, 16514, 316, 84, 2374, 17, 796, 410, 19608, 13, 51, 198, 16514, 316, 84, 2374, 18, 796, 410, 19608, 58, 15, 25, 22510, 4083, 51, 628, 1303, 1102, 1851, 640, 284, 308, 862, 640, 198, 22355, 220, 220, 220, 220, 220, 220, 796, 705, 5539, 12, 3070, 12, 486, 3571, 25, 405, 25, 405, 6, 198, 83, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 3862, 7, 22355, 11, 18982, 11639, 26786, 3256, 9888, 11639, 315, 66, 11537, 198, 83, 62, 9688, 220, 220, 220, 220, 796, 493, 7, 37659, 13, 28300, 7, 83, 13, 70, 862, 14, 1899, 27493, 1899, 8, 198, 67, 333, 62, 259, 62, 12545, 796, 1542, 198, 67, 333, 62, 259, 62, 1084, 1769, 796, 22365, 62, 259, 62, 12545, 9, 1731, 9, 1899, 198, 67, 333, 220, 220, 220, 220, 220, 220, 220, 220, 796, 22365, 62, 259, 62, 1084, 1769, 9, 1899, 198, 83, 62, 437, 220, 220, 220, 220, 220, 220, 796, 256, 62, 9688, 1343, 22365, 198, 198, 2, 779, 9103, 2323, 6268, 284, 5004, 543, 29781, 389, 5749, 198, 808, 11, 951, 796, 45941, 13, 43358, 7, 276, 265, 8, 198, 70, 19608, 796, 45941, 13, 18747, 26933, 12962, 198, 1640, 1312, 287, 2837, 7, 808, 2599, 198, 220, 220, 220, 966, 796, 1225, 265, 58, 72, 7131, 1238, 60, 198, 220, 220, 220, 308, 19608, 220, 796, 45941, 13, 33295, 7, 70, 19608, 11, 4122, 8, 198, 70, 19608, 796, 308, 19608, 13, 51, 198, 4743, 80, 220, 796, 45941, 13, 25067, 576, 7, 70, 19608, 11, 2996, 8, 198, 198, 2, 779, 691, 29781, 351, 1051, 361, 328, 415, 2323, 6268, 198, 808, 11, 951, 796, 45941, 13, 43358, 7, 276, 265, 8, 198, 8079, 220, 220, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 1640, 1312, 287, 2837, 7, 808, 2599, 198, 220, 220, 220, 611, 357, 276, 265, 58, 72, 7131, 1238, 60, 18189, 1278, 80, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 966, 796, 1225, 265, 58, 72, 7131, 20, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2123, 524, 796, 45941, 13, 33295, 7, 8079, 11, 4122, 8, 198, 198, 2, 779, 691, 4534, 80, 559, 5209, 326, 3051, 287, 2805, 2177, 198, 4033, 220, 220, 220, 220, 220, 220, 220, 220, 796, 18896, 7, 8079, 8, 198, 8079, 62, 76, 998, 796, 45941, 13, 18747, 26933, 12962, 198, 1640, 1312, 287, 2837, 7, 4033, 2599, 198, 220, 220, 220, 611, 14808, 8079, 58, 72, 60, 18189, 256, 62, 9688, 8, 290, 357, 8079, 58, 72, 60, 19841, 256, 62, 437, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 966, 796, 2123, 524, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2123, 524, 62, 76, 998, 796, 45941, 13, 33295, 7, 8079, 62, 76, 998, 11, 4122, 8, 198, 198, 2, 479, 1326, 504, 32966, 1586, 9052, 198, 45, 1084, 796, 362, 198, 45, 9806, 796, 399, 1084, 1343, 997, 198, 1640, 537, 287, 2837, 7, 45, 1084, 11, 399, 9806, 2599, 198, 220, 220, 220, 479, 1326, 504, 220, 220, 796, 509, 5308, 504, 7, 77, 62, 565, 13654, 28, 565, 11, 4738, 62, 5219, 28, 1485, 737, 11147, 7, 16514, 316, 84, 2374, 8, 198, 220, 220, 220, 479, 13033, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 2124, 12786, 220, 220, 220, 796, 45941, 13, 283, 858, 7, 83, 62, 9688, 11, 256, 62, 437, 11, 3126, 8, 198, 220, 220, 220, 20613, 13033, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 329, 256, 287, 2123, 524, 62, 76, 998, 25, 1303, 1640, 1123, 36529, 25, 2824, 36525, 1626, 642, 949, 286, 36529, 198, 220, 220, 220, 220, 220, 220, 220, 256, 1084, 796, 493, 7, 83, 532, 642, 9, 1899, 8, 198, 220, 220, 220, 220, 220, 220, 220, 256, 9806, 796, 493, 7, 83, 1343, 642, 9, 1899, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 220, 287, 2837, 7, 83, 1084, 11, 256, 9806, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1188, 220, 220, 220, 220, 796, 2352, 7, 87, 12786, 532, 474, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37441, 220, 220, 220, 796, 45941, 13, 853, 1084, 7, 2100, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 13033, 796, 45941, 13, 33295, 7, 74, 13033, 11, 37441, 8, 198, 220, 220, 220, 479, 13033, 220, 220, 796, 45941, 13, 34642, 7, 74, 13033, 8, 1303, 787, 1654, 612, 389, 645, 20394, 36525, 198, 220, 220, 220, 479, 565, 13654, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 329, 1312, 287, 479, 13033, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 1640, 1123, 6376, 1064, 262, 11188, 13946, 290, 3650, 606, 287, 7177, 198, 220, 220, 220, 220, 220, 220, 220, 479, 565, 13654, 796, 45941, 13, 33295, 7, 74, 565, 13654, 11, 74, 1326, 504, 13, 23912, 1424, 62, 58, 600, 7, 72, 8, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 479, 1326, 504, 4776, 5295, 416, 8064, 286, 2173, 287, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 13946, 14, 13033, 1474, 36529, 284, 220, 2173, 287, 13946, 14, 439, 2173, 198, 220, 220, 220, 3601, 10786, 220, 705, 8, 198, 220, 220, 220, 3601, 10786, 2601, 796, 705, 1343, 965, 7, 565, 4008, 198, 220, 220, 220, 3601, 10786, 15057, 286, 2173, 287, 1123, 13946, 326, 389, 1474, 281, 36529, 11537, 198, 220, 220, 220, 3601, 7, 4033, 26448, 13, 31694, 7, 74, 565, 13654, 4008, 198, 220, 220, 220, 3601, 10786, 15057, 286, 2173, 287, 1123, 13946, 11537, 198, 220, 220, 220, 3601, 7, 4033, 26448, 13, 31694, 7, 74, 1326, 504, 13, 23912, 1424, 62, 4008, 628, 220, 220, 220, 479, 62, 9127, 220, 220, 220, 220, 220, 796, 17268, 13, 31694, 7, 74, 565, 13654, 737, 1712, 62, 11321, 3419, 198, 220, 220, 220, 479, 83, 313, 62, 9127, 220, 220, 796, 17268, 13, 31694, 7, 74, 1326, 504, 13, 23912, 1424, 62, 737, 1712, 62, 11321, 3419, 198, 220, 220, 220, 479, 62, 4868, 62, 565, 220, 220, 220, 796, 685, 87, 58, 15, 60, 329, 2124, 287, 479, 62, 9127, 60, 1303, 565, 5819, 1271, 198, 220, 220, 220, 479, 62, 4868, 220, 220, 220, 220, 220, 220, 796, 685, 87, 58, 16, 60, 329, 2124, 287, 479, 62, 9127, 60, 1303, 13966, 495, 3179, 286, 13946, 198, 220, 220, 220, 479, 83, 313, 62, 4868, 62, 565, 796, 685, 87, 58, 15, 60, 329, 2124, 287, 479, 83, 313, 62, 9127, 60, 198, 220, 220, 220, 479, 83, 313, 62, 4868, 220, 220, 220, 796, 685, 87, 58, 16, 60, 329, 2124, 287, 479, 83, 313, 62, 9127, 60, 198, 220, 220, 220, 479, 62, 565, 13654, 220, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 479, 62, 5589, 533, 220, 220, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 479, 62, 4868, 17, 220, 220, 220, 220, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 479, 83, 313, 62, 4868, 17, 220, 220, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 1303, 21674, 523, 326, 479, 62, 565, 13654, 479, 62, 4868, 17, 290, 479, 62, 5589, 533, 389, 287, 262, 976, 1502, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 11925, 7, 74, 62, 4868, 62, 565, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 2837, 7, 11925, 7, 21841, 313, 62, 4868, 62, 565, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 479, 62, 4868, 62, 565, 58, 72, 60, 6624, 479, 83, 313, 62, 4868, 62, 565, 58, 73, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 62, 565, 13654, 796, 45941, 13, 33295, 7, 74, 62, 565, 13654, 11, 74, 62, 4868, 62, 565, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8996, 220, 220, 220, 796, 479, 62, 4868, 58, 72, 60, 14, 21841, 313, 62, 4868, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 62, 5589, 533, 220, 796, 45941, 13, 33295, 7, 74, 62, 5589, 533, 11, 8996, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 62, 4868, 17, 220, 220, 220, 796, 45941, 13, 33295, 7, 74, 62, 4868, 17, 11, 479, 62, 4868, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 83, 313, 62, 4868, 17, 796, 45941, 13, 33295, 7, 21841, 313, 62, 4868, 17, 11, 479, 62, 4868, 58, 72, 12962, 198, 220, 220, 220, 3601, 10786, 8053, 351, 262, 23163, 287, 1502, 357, 71, 7456, 10091, 11537, 198, 220, 220, 220, 3601, 7, 74, 62, 565, 13654, 8, 198, 220, 220, 220, 3601, 10786, 33111, 62, 13033, 1088, 36529, 9086, 416, 2472, 31835, 62, 13033, 287, 23163, 11537, 198, 220, 220, 220, 45941, 13, 2617, 62, 4798, 25811, 7, 3866, 16005, 28, 18, 8, 198, 220, 220, 220, 3601, 7, 74, 62, 5589, 533, 8, 198, 220, 220, 220, 479, 62, 9948, 62, 26675, 796, 20731, 13, 9948, 21141, 62, 9869, 397, 1031, 62, 26675, 7, 16514, 316, 84, 2374, 11, 479, 1326, 504, 13, 23912, 1424, 62, 8, 198, 220, 220, 220, 3601, 10786, 42, 12, 1326, 504, 705, 1343, 965, 7, 565, 8, 1343, 705, 25, 220, 327, 12, 39, 4776, 796, 46110, 15, 13, 21, 70, 92, 4458, 18982, 7, 74, 62, 9948, 62, 26675, 4008, 628, 198, 2, 20613, 35836, 32966, 1586, 9052, 198, 7061, 6, 198, 1084, 62, 82, 12629, 62, 4868, 796, 685, 940, 11, 1238, 11, 1495, 11, 1270, 60, 198, 1640, 949, 62, 82, 12629, 287, 949, 62, 82, 12629, 62, 4868, 25, 628, 220, 220, 220, 20613, 796, 360, 4462, 44565, 7, 25386, 28, 25386, 11, 1084, 62, 82, 12629, 28, 1084, 62, 82, 12629, 737, 11147, 7, 16514, 316, 84, 2374, 8, 628, 220, 220, 220, 1303, 4798, 1271, 286, 23163, 198, 220, 220, 220, 3601, 10786, 705, 8, 198, 220, 220, 220, 299, 62, 565, 13654, 62, 796, 18896, 7, 2617, 7, 9945, 13, 23912, 1424, 62, 4008, 532, 357, 16, 611, 532, 16, 287, 20613, 13, 23912, 1424, 62, 2073, 657, 8, 198, 220, 220, 220, 3601, 10786, 35, 4462, 44565, 2727, 705, 1343, 2536, 7, 77, 62, 565, 13654, 62, 8, 1343, 705, 23163, 11537, 628, 220, 220, 220, 1303, 2860, 510, 1271, 286, 23163, 326, 1656, 1306, 284, 1123, 16295, 198, 220, 220, 220, 2124, 12786, 796, 45941, 13, 283, 858, 7, 83, 62, 9688, 11, 83, 62, 437, 11, 1899, 8, 198, 220, 220, 220, 20613, 13033, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 329, 256, 287, 2123, 524, 62, 76, 998, 25, 1303, 1640, 1123, 36529, 25, 2824, 36525, 1626, 642, 949, 286, 36529, 198, 220, 220, 220, 220, 220, 220, 220, 256, 1084, 796, 493, 7, 83, 12, 20, 9, 1899, 8, 198, 220, 220, 220, 220, 220, 220, 220, 256, 9806, 796, 493, 7, 83, 10, 20, 9, 1899, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 220, 287, 2837, 7, 83, 1084, 11, 83, 9806, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1188, 796, 2352, 7, 87, 12786, 12, 73, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37441, 796, 45941, 13, 853, 1084, 7, 2100, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20613, 13033, 220, 796, 45941, 13, 33295, 7, 9945, 13033, 11, 37441, 8, 628, 220, 220, 220, 20613, 13033, 796, 45941, 13, 34642, 7, 9945, 13033, 8, 198, 220, 220, 220, 20613, 565, 13654, 796, 45941, 13, 18747, 26933, 12962, 628, 220, 220, 220, 329, 1312, 287, 20613, 13033, 25, 20613, 565, 13654, 796, 45941, 13, 33295, 7, 9945, 565, 13654, 11, 9945, 13, 23912, 1424, 62, 58, 600, 7, 72, 8, 12962, 1303, 1640, 1123, 6376, 1064, 262, 11188, 13946, 290, 3650, 606, 287, 7177, 628, 220, 220, 220, 1303, 9945, 35836, 4776, 5295, 416, 1411, 286, 2173, 23243, 656, 530, 13946, 1474, 36529, 198, 220, 220, 220, 3601, 10786, 15057, 286, 2173, 287, 1123, 13946, 326, 389, 1474, 281, 36529, 11537, 198, 220, 220, 220, 3601, 7, 4033, 26448, 13, 31694, 7, 9945, 565, 13654, 4008, 198, 220, 220, 220, 3601, 10786, 15057, 286, 2173, 287, 1123, 13946, 11537, 198, 220, 220, 220, 3601, 7, 4033, 26448, 13, 31694, 7, 9945, 13, 23912, 1424, 62, 4008, 198, 220, 220, 220, 20613, 62, 9127, 796, 17268, 13, 31694, 7, 9945, 565, 13654, 737, 1712, 62, 11321, 3419, 198, 220, 220, 220, 288, 18347, 313, 62, 9127, 796, 17268, 13, 31694, 7, 9945, 13, 23912, 1424, 62, 737, 1712, 62, 11321, 3419, 198, 220, 220, 220, 20613, 62, 4868, 62, 565, 796, 685, 87, 58, 15, 60, 329, 2124, 287, 20613, 62, 9127, 60, 198, 220, 220, 220, 20613, 62, 4868, 796, 685, 87, 58, 16, 60, 329, 2124, 287, 20613, 62, 9127, 60, 198, 220, 220, 220, 288, 18347, 313, 62, 4868, 62, 565, 796, 685, 87, 58, 15, 60, 329, 2124, 287, 288, 18347, 313, 62, 9127, 60, 198, 220, 220, 220, 288, 18347, 313, 62, 4868, 796, 685, 87, 58, 16, 60, 329, 2124, 287, 288, 18347, 313, 62, 9127, 60, 198, 220, 220, 220, 20613, 62, 565, 13654, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 20613, 62, 5589, 533, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 20613, 62, 4868, 17, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 288, 18347, 313, 62, 4868, 17, 796, 45941, 13, 18747, 26933, 12962, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 11925, 7, 9945, 62, 4868, 62, 565, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 2837, 7, 11925, 7, 9945, 83, 313, 62, 4868, 62, 565, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 20613, 62, 4868, 62, 565, 58, 72, 60, 6624, 288, 18347, 313, 62, 4868, 62, 565, 58, 73, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20613, 62, 565, 13654, 796, 45941, 13, 33295, 7, 9945, 62, 565, 13654, 11, 9945, 62, 4868, 62, 565, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8996, 796, 20613, 62, 4868, 58, 72, 60, 14, 9945, 83, 313, 62, 4868, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20613, 62, 5589, 533, 796, 45941, 13, 33295, 7, 9945, 62, 5589, 533, 11, 8996, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20613, 62, 4868, 17, 796, 45941, 13, 33295, 7, 9945, 62, 4868, 17, 11, 20613, 62, 4868, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 288, 18347, 313, 62, 4868, 17, 796, 45941, 13, 33295, 7, 9945, 83, 313, 62, 4868, 17, 11, 20613, 62, 4868, 58, 72, 12962, 198, 220, 220, 220, 3601, 10786, 8053, 351, 262, 23163, 287, 1502, 11537, 198, 220, 220, 220, 3601, 7, 9945, 62, 565, 13654, 8, 198, 220, 220, 220, 3601, 10786, 15057, 286, 2173, 287, 23163, 1474, 36529, 9086, 416, 2472, 1271, 286, 2173, 287, 23163, 11537, 198, 220, 220, 220, 3601, 7, 9945, 62, 5589, 533, 8, 198, 220, 220, 220, 288, 62, 9948, 62, 26675, 796, 20731, 13, 9948, 21141, 62, 9869, 397, 1031, 62, 26675, 7, 16514, 316, 84, 2374, 11, 20613, 13, 23912, 1424, 62, 8, 198, 220, 220, 220, 3601, 10786, 1890, 20613, 35836, 262, 2386, 21141, 3971, 397, 1031, 4776, 318, 705, 1343, 965, 7, 67, 62, 9948, 62, 26675, 4008, 198, 7061, 6, 198, 198, 2, 28114, 1303, 16, 25, 28114, 4823, 286, 479, 1326, 504, 32966, 1586, 329, 36529, 198, 74, 1326, 504, 796, 509, 5308, 504, 7, 77, 62, 565, 13654, 28, 565, 11, 4738, 62, 5219, 28, 1065, 737, 11147, 7, 16514, 316, 84, 2374, 8, 198, 198, 87, 12786, 796, 45941, 13, 283, 858, 7, 83, 62, 9688, 11, 256, 62, 437, 11, 3126, 8, 198, 5647, 11, 897, 274, 220, 796, 458, 83, 13, 7266, 489, 1747, 7, 11925, 7, 85, 19608, 828, 2336, 7857, 16193, 1821, 11, 604, 9, 11925, 7, 85, 19608, 22305, 198, 1640, 7877, 11, 1366, 11, 442, 272, 287, 19974, 7, 897, 274, 11, 410, 19608, 11, 410, 354, 504, 17, 2599, 198, 220, 220, 220, 7877, 13, 1416, 1436, 7, 87, 12786, 11, 1366, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 796, 7577, 58, 74, 1326, 504, 13, 23912, 1424, 62, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5743, 8043, 796, 705, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 28, 19, 11, 17130, 28, 15, 13, 23, 11, 6167, 28, 81, 6, 3, 59, 11018, 26224, 90, 4, 82, 92, 3, 6, 4064, 442, 272, 13, 33491, 10786, 62, 41707, 59, 62, 6, 4008, 198, 220, 220, 220, 7877, 13, 2617, 62, 28349, 1000, 10786, 6404, 11537, 198, 220, 220, 220, 7877, 13, 2617, 62, 88, 2475, 7, 23, 11, 1367, 830, 8, 198, 220, 220, 220, 7877, 13, 2617, 62, 87, 18242, 10786, 38, 3705, 3862, 11537, 198, 220, 220, 220, 7877, 13, 25928, 7, 17821, 11, 543, 11639, 16885, 11537, 198, 220, 220, 220, 7877, 13, 1455, 437, 3419, 198, 220, 220, 220, 329, 304, 287, 2837, 7, 11925, 7, 8079, 62, 76, 998, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 897, 85, 1370, 7, 87, 28, 8079, 62, 76, 998, 58, 68, 12962, 198, 5647, 13, 33464, 62, 39786, 3419, 198, 5647, 13, 21928, 5647, 10786, 14989, 942, 14, 36, 48, 7890, 62, 42, 1326, 504, 62, 6, 1343, 965, 7, 565, 8, 1343, 45302, 11134, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1603, 1143, 28, 17821, 8, 198, 28311, 25, 198, 220, 220, 220, 2336, 13, 21928, 5647, 10786, 14, 11195, 14, 13907, 2271, 13, 12924, 3798, 84, 14, 11377, 62, 6494, 14, 6, 1343, 705, 36, 48, 7890, 62, 42, 1326, 504, 62, 6, 10, 2536, 7, 565, 47762, 4458, 11134, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1603, 1143, 28, 17821, 8, 198, 16341, 25, 198, 220, 220, 220, 3601, 7203, 366, 8, 628, 198, 2, 28114, 1303, 17, 25, 29487, 4823, 286, 20613, 35836, 32966, 1586, 329, 36529, 198, 9945, 220, 220, 220, 796, 360, 4462, 44565, 7, 25386, 28, 25386, 11, 1084, 62, 82, 12629, 28, 1084, 62, 82, 12629, 737, 11147, 7, 16514, 316, 84, 2374, 8, 198, 87, 12786, 796, 45941, 13, 283, 858, 7, 83, 62, 9688, 11, 256, 62, 437, 11, 3126, 8, 198, 2, 3601, 1271, 286, 23163, 198, 77, 62, 565, 13654, 62, 796, 18896, 7, 2617, 7, 9945, 13, 23912, 1424, 62, 4008, 532, 357, 16, 611, 532, 16, 287, 20613, 13, 23912, 1424, 62, 2073, 657, 8, 198, 4798, 10786, 35, 4462, 44565, 2727, 705, 1343, 2536, 7, 77, 62, 565, 13654, 62, 8, 1343, 705, 23163, 11537, 198, 5647, 11, 34197, 796, 458, 83, 13, 7266, 489, 1747, 7, 11925, 7, 85, 19608, 828, 2336, 7857, 16193, 1821, 11, 19, 9, 11925, 7, 85, 19608, 22305, 198, 1640, 7877, 11, 1366, 11, 442, 272, 287, 19974, 7, 897, 274, 11, 410, 19608, 11, 410, 354, 504, 17, 2599, 198, 220, 220, 220, 7877, 13, 1416, 1436, 7, 87, 12786, 11, 1366, 11, 269, 28, 4033, 669, 58, 9945, 13, 23912, 1424, 62, 4357, 5743, 8043, 11639, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 28, 20, 11, 17130, 28, 15, 13, 23, 11, 6167, 28, 81, 6, 3, 59, 11018, 26224, 90, 4, 82, 92, 3, 6, 4064, 442, 272, 13, 33491, 10786, 62, 41707, 59, 62, 6, 4008, 198, 220, 220, 220, 7877, 13, 2617, 62, 28349, 1000, 10786, 6404, 11537, 198, 220, 220, 220, 7877, 13, 2617, 62, 88, 2475, 7, 23, 11, 1367, 830, 8, 198, 220, 220, 220, 7877, 13, 2617, 62, 87, 18242, 10786, 38, 3705, 3862, 11537, 198, 220, 220, 220, 7877, 13, 25928, 7, 17821, 11, 543, 11639, 16885, 11537, 198, 220, 220, 220, 7877, 13, 1455, 437, 3419, 198, 220, 220, 220, 329, 304, 287, 2837, 7, 11925, 7, 8079, 62, 76, 998, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 897, 85, 1370, 7, 87, 28, 8079, 62, 76, 998, 58, 68, 12962, 198, 5647, 13, 33464, 62, 39786, 3419, 198, 5647, 13, 21928, 5647, 10786, 14989, 942, 14, 9945, 35836, 62, 439, 13, 11134, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1603, 1143, 28, 17821, 8, 198, 28311, 25, 198, 220, 220, 220, 2336, 13, 21928, 5647, 10786, 14, 11195, 14, 13907, 2271, 13, 12924, 3798, 84, 14, 11377, 62, 6494, 14, 6, 1343, 705, 9945, 35836, 62, 439, 44807, 11134, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1603, 1143, 28, 17821, 8, 198, 16341, 25, 198, 220, 220, 220, 3601, 7203, 366, 8, 198 ]
2.238445
4,760
# Generated by Django 3.0 on 2019-12-13 16:34 from django.db import migrations, models import django.db.models.deletion
[ 2, 2980, 515, 416, 37770, 513, 13, 15, 319, 13130, 12, 1065, 12, 1485, 1467, 25, 2682, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 198, 11748, 42625, 14208, 13, 9945, 13, 27530, 13, 2934, 1616, 295, 628 ]
2.904762
42
import os import subprocess import time import easygui as g import re import requests from selenium import webdriver if __name__ == '__main__': filePath, packageName, lanuchableActivity = getPackagInfo() handle = uninstallApp(packageName) uninstallApp(handle) judgeRunning(handle) print('%s 卸载成功' % packageName) print('%s 开始安装,请稍后' % packageName) handle_install = installapp(filePath) print('安装日志为:', handle_install.stdout.read().decode().strip('\r\n')) os.remove('./packageInfo.txt') judgePackageExist(packageName) input()
[ 628, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 11748, 640, 198, 11748, 2562, 48317, 355, 308, 198, 11748, 302, 198, 11748, 7007, 198, 6738, 384, 11925, 1505, 1330, 3992, 26230, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 2393, 15235, 11, 5301, 5376, 11, 26992, 794, 540, 16516, 796, 651, 11869, 363, 12360, 3419, 198, 220, 220, 220, 5412, 796, 43194, 4677, 7, 26495, 5376, 8, 198, 220, 220, 220, 43194, 4677, 7, 28144, 8, 198, 220, 220, 220, 5052, 28768, 7, 28144, 8, 198, 220, 220, 220, 3601, 10786, 4, 82, 10263, 235, 116, 164, 121, 121, 22755, 238, 27950, 253, 6, 4064, 5301, 5376, 8, 628, 220, 220, 220, 3601, 10786, 4, 82, 10263, 120, 222, 34650, 233, 22522, 231, 35318, 171, 120, 234, 46237, 115, 163, 101, 235, 28938, 236, 6, 4064, 5301, 5376, 8, 198, 220, 220, 220, 5412, 62, 17350, 796, 2721, 1324, 7, 7753, 15235, 8, 628, 220, 220, 220, 3601, 10786, 22522, 231, 35318, 33768, 98, 33232, 245, 10310, 118, 171, 120, 248, 3256, 5412, 62, 17350, 13, 19282, 448, 13, 961, 22446, 12501, 1098, 22446, 36311, 10786, 59, 81, 59, 77, 6, 4008, 198, 220, 220, 220, 28686, 13, 28956, 7, 4458, 14, 26495, 12360, 13, 14116, 11537, 198, 220, 220, 220, 5052, 27813, 3109, 396, 7, 26495, 5376, 8, 628, 220, 220, 220, 5128, 3419 ]
2.465812
234
import os import re import math import random import sys import json import itertools from random import randint from string import ascii_letters from os import path, listdir from configparser import ConfigParser pathname = os.path.dirname(sys.argv[0]) config = ConfigParser() config.read( pathname + '/config.ini') #Function to basic clean and preprocess input string or text #Perturb the word by a certain percentage #Perturb the word by a certain percentage #Main function for the perturbation algorithm #Word perturbation main method #If you call the method with an input_file --> the program start perturbation to this file #If you call the method with string --> the program start perturbation the string text #If you set clean = 1 --> the program start to clean and preprocess the text before the perturbation #Default percentage for the perturbation = 10% #Function to export the perturbation result into a file txt # Functions test #input_string = "ciao come stai proviamo a fare un test con andrea guzzo che succede se aggiungo altre parole al ciclo uff" #result = word_perturbation(string=input_string,clean=0,words_percentage=10,string_percentage=10) #print(result)
[ 11748, 28686, 220, 198, 11748, 302, 220, 198, 11748, 10688, 220, 198, 11748, 4738, 220, 198, 11748, 25064, 198, 11748, 33918, 198, 11748, 340, 861, 10141, 198, 6738, 4738, 1330, 43720, 600, 220, 198, 6738, 4731, 1330, 355, 979, 72, 62, 15653, 220, 198, 6738, 28686, 1330, 3108, 11, 1351, 15908, 198, 6738, 4566, 48610, 1330, 17056, 46677, 198, 220, 198, 6978, 3672, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 17597, 13, 853, 85, 58, 15, 12962, 198, 11250, 796, 17056, 46677, 3419, 198, 11250, 13, 961, 7, 3108, 3672, 1343, 31051, 11250, 13, 5362, 11537, 198, 220, 198, 2, 22203, 284, 4096, 3424, 290, 662, 14681, 5128, 4731, 393, 2420, 220, 198, 198, 2, 47, 861, 5945, 262, 1573, 416, 257, 1728, 5873, 220, 198, 220, 198, 2, 47, 861, 5945, 262, 1573, 416, 257, 1728, 5873, 220, 198, 220, 220, 198, 2, 13383, 2163, 329, 262, 22146, 5945, 341, 11862, 220, 198, 220, 198, 220, 198, 2, 26449, 22146, 5945, 341, 1388, 2446, 220, 198, 2, 1532, 345, 869, 262, 2446, 351, 281, 5128, 62, 7753, 14610, 262, 1430, 923, 22146, 5945, 341, 284, 428, 2393, 220, 198, 2, 1532, 345, 869, 262, 2446, 351, 4731, 14610, 262, 1430, 923, 22146, 5945, 341, 262, 4731, 2420, 220, 198, 2, 1532, 345, 900, 3424, 796, 352, 14610, 262, 1430, 923, 284, 3424, 290, 662, 14681, 262, 2420, 878, 262, 22146, 5945, 341, 220, 198, 2, 19463, 5873, 329, 262, 22146, 5945, 341, 796, 838, 4, 220, 198, 220, 198, 2, 22203, 284, 10784, 262, 22146, 5945, 341, 1255, 656, 257, 2393, 256, 742, 220, 198, 220, 198, 220, 198, 2, 40480, 1332, 220, 198, 2, 15414, 62, 8841, 796, 366, 66, 13481, 1282, 336, 1872, 899, 1789, 78, 257, 14505, 555, 1332, 369, 290, 21468, 915, 47802, 1125, 17458, 18654, 384, 4194, 72, 2150, 78, 5988, 260, 25450, 435, 269, 291, 5439, 334, 487, 1, 220, 198, 2, 20274, 796, 1573, 62, 11766, 5945, 341, 7, 8841, 28, 15414, 62, 8841, 11, 27773, 28, 15, 11, 10879, 62, 25067, 496, 28, 940, 11, 8841, 62, 25067, 496, 28, 940, 8, 220, 198, 2, 4798, 7, 20274, 8 ]
3.387187
359
import numpy as np from scipy.stats import gmean from collections import namedtuple import threading import multiprocessing import configparser import timestreamquery as tsquery import os from timeit import default_timer as timer from query_execution_utils import executeQueryInstance, Query import sys, traceback import random, string import time Params = namedtuple('Params', 'dbname tablename region az cell silo microservicename instancetype osversion instancename processname jdkversion') QueryParams = namedtuple('QueryParams', 'repetitions paramlist') Header = 'Query type, Total Count, Successful Count, Avg. latency (in secs), Std dev latency (in secs), Median, 90th perc (in secs), 99th Perc (in secs), Geo Mean (in secs)' ### Create the query string using the list of parameters. ## For each query, convert them into row-count variants where the actual query is enclosed within a sub-query ## where the outer query counts the number of rows returned by the sub-query (i.e., the original query). ## Config constants. These define the strings used in the config files. configDefaultSection = 'default' configQueryDistributionSection = 'query_distribution' configQueryMode = 'query_mode' configRepetitions = 'repetitions' configRetries = 'retries' configQueryModeRowCount = 'row_count' configQueryModeRegular = 'regular' ## The main execution thread the reads in the config file and executes the queries per the parameters ## defined in the config file. ## Log a few summary statistics from the table. ## A multi-process executer that uses the RandomizedExecutionThread instances to execute queries ## using multiple processes. ## Obtain the query parameters by issuing a query to the database and table.
[ 11748, 299, 32152, 355, 45941, 198, 6738, 629, 541, 88, 13, 34242, 1330, 308, 32604, 198, 6738, 17268, 1330, 3706, 83, 29291, 198, 11748, 4704, 278, 198, 11748, 18540, 305, 919, 278, 198, 11748, 4566, 48610, 198, 11748, 4628, 395, 1476, 22766, 355, 256, 16485, 1924, 198, 11748, 28686, 198, 6738, 640, 270, 1330, 4277, 62, 45016, 355, 19781, 198, 6738, 12405, 62, 18558, 1009, 62, 26791, 1330, 12260, 20746, 33384, 11, 43301, 198, 11748, 25064, 11, 12854, 1891, 198, 11748, 4738, 11, 4731, 198, 11748, 640, 198, 198, 10044, 4105, 796, 3706, 83, 29291, 10786, 10044, 4105, 3256, 705, 9945, 3672, 7400, 11925, 480, 3814, 35560, 2685, 3313, 78, 4580, 3168, 291, 12453, 916, 1192, 2963, 431, 28686, 9641, 916, 1192, 12453, 1429, 3672, 474, 34388, 9641, 11537, 198, 20746, 10044, 4105, 796, 3706, 83, 29291, 10786, 20746, 10044, 4105, 3256, 705, 260, 6449, 1756, 5772, 4868, 11537, 198, 39681, 796, 705, 20746, 2099, 11, 7472, 2764, 11, 16282, 913, 2764, 11, 33455, 13, 24812, 357, 259, 792, 82, 828, 520, 67, 1614, 24812, 357, 259, 792, 82, 828, 26178, 11, 4101, 400, 583, 66, 357, 259, 792, 82, 828, 7388, 400, 2448, 66, 357, 259, 792, 82, 828, 32960, 22728, 357, 259, 792, 82, 33047, 198, 198, 21017, 13610, 262, 12405, 4731, 1262, 262, 1351, 286, 10007, 13, 198, 198, 2235, 1114, 1123, 12405, 11, 10385, 606, 656, 5752, 12, 9127, 17670, 810, 262, 4036, 12405, 318, 28543, 1626, 257, 850, 12, 22766, 198, 2235, 810, 262, 12076, 12405, 9853, 262, 1271, 286, 15274, 4504, 416, 262, 850, 12, 22766, 357, 72, 13, 68, 1539, 262, 2656, 12405, 737, 198, 198, 2235, 17056, 38491, 13, 2312, 8160, 262, 13042, 973, 287, 262, 4566, 3696, 13, 198, 11250, 19463, 16375, 796, 705, 12286, 6, 198, 11250, 20746, 20344, 3890, 16375, 796, 705, 22766, 62, 17080, 3890, 6, 198, 11250, 20746, 19076, 796, 705, 22766, 62, 14171, 6, 198, 11250, 6207, 316, 1756, 796, 705, 260, 6449, 1756, 6, 198, 11250, 9781, 1678, 796, 705, 1186, 1678, 6, 198, 198, 11250, 20746, 19076, 25166, 12332, 796, 705, 808, 62, 9127, 6, 198, 11250, 20746, 19076, 40164, 796, 705, 16338, 6, 198, 198, 2235, 383, 1388, 9706, 4704, 262, 9743, 287, 262, 4566, 2393, 290, 42985, 262, 20743, 583, 262, 10007, 198, 2235, 5447, 287, 262, 4566, 2393, 13, 628, 220, 220, 220, 22492, 5972, 257, 1178, 10638, 7869, 422, 262, 3084, 13, 198, 198, 2235, 317, 5021, 12, 14681, 3121, 263, 326, 3544, 262, 14534, 1143, 23002, 1009, 16818, 10245, 284, 12260, 20743, 198, 2235, 1262, 3294, 7767, 13, 198, 198, 2235, 1835, 3153, 262, 12405, 10007, 416, 19089, 257, 12405, 284, 262, 6831, 290, 3084, 13 ]
3.85906
447
""" @file @brief Implements a way to get close examples based on the output of a machine learned model. """ from ..mlmodel import model_featurizer from ..helpers.parameters import format_function_call from .search_engine_vectors import SearchEngineVectors class SearchEnginePredictions(SearchEngineVectors): """ Extends class @see cl SearchEngineVectors by looking for neighbors to a vector *X* by looking neighbors to *f(X)* and not *X*. *f* can be any function which converts a vector into another one or a machine learned model. In that case, *f* will be set to a default behavior. See function @see fn model_featurizer. """ def __init__(self, fct, fct_params=None, **knn): """ @param fct function *f* applied before looking for neighbors, it can also be a machine learned model @param fct_params parameters sent to function @see fn model_featurizer @param pknn list of parameters, see :epkg:`sklearn:neighborsNearestNeighbors` """ super().__init__(**knn) self._fct_params = fct_params self._fct_init = fct if (callable(fct) and not hasattr(fct, 'predict') and not hasattr(fct, 'forward')): self.fct = fct else: if fct_params is None: fct_params = {} self.fct = model_featurizer(fct, **fct_params) def __repr__(self): """ usual """ if self.pknn: pp = self.pknn.copy() else: pp = {} pp['fct'] = self._fct_init pp['fct_params'] = self._fct_params return format_function_call(self.__class__.__name__, pp) def fit(self, data=None, features=None, metadata=None): """ Every vector comes with a list of metadata. @param data a :epkg:`dataframe` or None if the the features and the metadata are specified with an array and a dictionary @param features features columns or an array @param metadata data """ iterate = self._is_iterable(data) if iterate: self._prepare_fit(data=data, features=features, metadata=metadata, transform=self.fct) else: self._prepare_fit(data=data, features=features, metadata=metadata) if isinstance(self.features_, list): raise TypeError( # pragma: no cover "features_ cannot be a list when training the model.") self.features_ = self.fct(self.features_, True) return self._fit_knn() def kneighbors(self, X, n_neighbors=None): """ Searches for neighbors close to *X*. @param X features @return score, ind, meta *score* is an array representing the lengths to points, *ind* contains the indices of the nearest points in the population matrix, *meta* is the metadata. """ xp = self.fct(X, False) if len(xp.shape) == 1: xp = xp.reshape((1, len(xp))) return super().kneighbors(xp, n_neighbors=n_neighbors)
[ 37811, 198, 31, 7753, 198, 31, 65, 3796, 1846, 1154, 902, 257, 835, 284, 651, 1969, 6096, 1912, 198, 261, 262, 5072, 286, 257, 4572, 4499, 2746, 13, 198, 37811, 198, 6738, 11485, 4029, 19849, 1330, 2746, 62, 5036, 2541, 7509, 198, 6738, 11485, 16794, 364, 13, 17143, 7307, 1330, 5794, 62, 8818, 62, 13345, 198, 6738, 764, 12947, 62, 18392, 62, 303, 5217, 1330, 11140, 13798, 53, 478, 669, 628, 198, 4871, 11140, 13798, 39156, 9278, 7, 18243, 13798, 53, 478, 669, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5683, 2412, 1398, 2488, 3826, 537, 11140, 13798, 53, 478, 669, 416, 198, 220, 220, 220, 2045, 329, 12020, 284, 257, 15879, 1635, 55, 9, 416, 198, 220, 220, 220, 2045, 12020, 284, 1635, 69, 7, 55, 27493, 290, 407, 1635, 55, 24620, 198, 220, 220, 220, 1635, 69, 9, 460, 307, 597, 2163, 543, 26161, 257, 15879, 198, 220, 220, 220, 656, 1194, 530, 393, 257, 4572, 4499, 2746, 13, 198, 220, 220, 220, 554, 326, 1339, 11, 1635, 69, 9, 481, 307, 900, 284, 257, 4277, 4069, 13, 198, 220, 220, 220, 4091, 2163, 2488, 3826, 24714, 2746, 62, 5036, 2541, 7509, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 277, 310, 11, 277, 310, 62, 37266, 28, 14202, 11, 12429, 15418, 77, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 277, 310, 220, 220, 220, 220, 220, 220, 220, 220, 2163, 1635, 69, 9, 5625, 878, 2045, 329, 12020, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 340, 460, 635, 307, 257, 4572, 4499, 2746, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 277, 310, 62, 37266, 220, 10007, 1908, 284, 2163, 2488, 3826, 24714, 2746, 62, 5036, 2541, 7509, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 279, 15418, 77, 220, 220, 220, 220, 220, 220, 220, 1351, 286, 10007, 11, 766, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 538, 10025, 25, 63, 8135, 35720, 25, 710, 394, 32289, 8199, 12423, 46445, 32289, 63, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 1174, 15418, 77, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 69, 310, 62, 37266, 796, 277, 310, 62, 37266, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 69, 310, 62, 15003, 796, 277, 310, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 13345, 540, 7, 69, 310, 8, 290, 407, 468, 35226, 7, 69, 310, 11, 705, 79, 17407, 11537, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 407, 468, 35226, 7, 69, 310, 11, 705, 11813, 11537, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 69, 310, 796, 277, 310, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 277, 310, 62, 37266, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 310, 62, 37266, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 69, 310, 796, 2746, 62, 5036, 2541, 7509, 7, 69, 310, 11, 12429, 69, 310, 62, 37266, 8, 628, 220, 220, 220, 825, 11593, 260, 1050, 834, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 6678, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 79, 15418, 77, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9788, 796, 2116, 13, 79, 15418, 77, 13, 30073, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9788, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 9788, 17816, 69, 310, 20520, 796, 2116, 13557, 69, 310, 62, 15003, 198, 220, 220, 220, 220, 220, 220, 220, 9788, 17816, 69, 310, 62, 37266, 20520, 796, 2116, 13557, 69, 310, 62, 37266, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 5794, 62, 8818, 62, 13345, 7, 944, 13, 834, 4871, 834, 13, 834, 3672, 834, 11, 9788, 8, 628, 220, 220, 220, 825, 4197, 7, 944, 11, 1366, 28, 14202, 11, 3033, 28, 14202, 11, 20150, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3887, 15879, 2058, 351, 257, 1351, 286, 20150, 13, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 1366, 220, 220, 220, 220, 220, 220, 220, 257, 1058, 538, 10025, 25, 63, 7890, 14535, 63, 393, 6045, 611, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 262, 3033, 290, 262, 20150, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 389, 7368, 351, 281, 7177, 290, 257, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 22155, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 3033, 220, 220, 220, 3033, 15180, 393, 281, 7177, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 20150, 220, 220, 220, 1366, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11629, 378, 796, 2116, 13557, 271, 62, 2676, 540, 7, 7890, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 11629, 378, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 46012, 533, 62, 11147, 7, 7890, 28, 7890, 11, 3033, 28, 40890, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20150, 28, 38993, 11, 6121, 28, 944, 13, 69, 310, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 46012, 533, 62, 11147, 7, 7890, 28, 7890, 11, 3033, 28, 40890, 11, 20150, 28, 38993, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 944, 13, 40890, 62, 11, 1351, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 5994, 12331, 7, 220, 1303, 23864, 2611, 25, 645, 3002, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 40890, 62, 2314, 307, 257, 1351, 618, 3047, 262, 2746, 19570, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 40890, 62, 796, 2116, 13, 69, 310, 7, 944, 13, 40890, 62, 11, 6407, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 11147, 62, 15418, 77, 3419, 628, 220, 220, 220, 825, 24813, 394, 32289, 7, 944, 11, 1395, 11, 299, 62, 710, 394, 32289, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 42016, 2052, 329, 12020, 1969, 284, 1635, 55, 24620, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 17143, 220, 220, 220, 220, 220, 1395, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3033, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 7783, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4776, 11, 773, 11, 13634, 628, 220, 220, 220, 220, 220, 220, 220, 1635, 26675, 9, 318, 281, 7177, 10200, 262, 20428, 284, 2173, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1635, 521, 9, 4909, 262, 36525, 286, 262, 16936, 2173, 287, 262, 3265, 17593, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1635, 28961, 9, 318, 262, 20150, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 36470, 796, 2116, 13, 69, 310, 7, 55, 11, 10352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 42372, 13, 43358, 8, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 36470, 796, 36470, 13, 3447, 1758, 19510, 16, 11, 18896, 7, 42372, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2208, 22446, 74, 710, 394, 32289, 7, 42372, 11, 299, 62, 710, 394, 32289, 28, 77, 62, 710, 394, 32289, 8, 198 ]
2.10875
1,600
import os import numpy as np import pandas as pd from collections import Counter sub_path = 'sub/' teamates = os.listdir(sub_path) data = pd.read_csv('./single/robertawmmlarge_result_mean.csv', encoding='utf-8').rename(columns={'negative': 'negative_1', 'key_entity': 'key_entity_1'}) index = 2 for member in teamates: member_files = sub_path + member + '/' member_sub_files = os.listdir(member_files) for file in member_sub_files: sub = pd.read_csv(member_files+file, encoding='utf-8').rename(columns={'negative': 'negative_' + str(index), 'key_entity': 'key_entity_' + str(index)}) data = data.merge(sub, on='id', how='left') index += 1 print(data) print(data[data['negative_1'] == 1].shape) print(data[data['negative_2'] == 1].shape) print(data[data['negative_3'] == 1].shape) print(data[data['negative_4'] == 1].shape) print(data[data['negative_5'] == 1].shape) # for row in data.itertuples: negatives = ['negative_' + str(index) for index in range(1, index, 1)] key_entitys = ['key_entity_' + str(index) for index in range(1, index, 1)] ids = [] voting_entitys = [] thresh = int(index / 2) # 3 # 阈值:保留词的最小出现次数 count = 0 for row in range(len(data)): negative = Counter() key_entity = Counter() for k in range(0, index-1, 1): negative[data.ix[row][negatives[k]]] += 1 # print(negative) if (len(negative) == 1) & (data.ix[row]['negative_1'] == 1): for k in range(0, index-1, 1): for entity in data.ix[row][key_entitys[k]].split(';'): key_entity[entity] += 1 # print(key_entity) entitys = [] words = list(key_entity.keys()) for word in words: if key_entity[word] >= thresh: entitys.append(word) if entitys == []: entitys.append(key_entity.most_common(1)[0][0]) entitys = list(set(entitys)) voting_entitys.append(';'.join(entitys)) ids.append(data.ix[row]['id']) count += 1 print(count) voted = pd.DataFrame({'id': ids, 'key_entity': voting_entitys}) print(voted) submit = data[['id', 'negative_1', 'key_entity_1']].rename(columns={'negative_1': 'negative'}) submit = submit.merge(voted, on='id', how='left') submit['key_entity'] = submit.apply(lambda index: index.key_entity_1 if index.key_entity is np.nan else index.key_entity, axis=1) print(submit) submit['key_entity_tag_sun']=submit['key_entity'].apply(lambda x:get_sun(x)) print(submit[submit['key_entity_tag_sun']==0]) """去?的子串函数'""" submit['key_entity']=list(map(lambda x, tag: delete_sun(x, tag), submit['key_entity'], submit['key_entity_tag_sun'])) print(submit[submit['key_entity_tag_sun']==0]) print(submit) submit[['id', 'negative', 'key_entity']].to_csv('five_models_voting_three_method.csv', index=None) print('thresh:', thresh) print('store done.')
[ 11748, 28686, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 17268, 1330, 15034, 198, 198, 7266, 62, 6978, 796, 705, 7266, 14, 6, 198, 15097, 689, 796, 28686, 13, 4868, 15908, 7, 7266, 62, 6978, 8, 198, 198, 7890, 796, 279, 67, 13, 961, 62, 40664, 7, 4458, 14, 29762, 14, 305, 4835, 707, 3020, 11664, 62, 20274, 62, 32604, 13, 40664, 3256, 21004, 11639, 40477, 12, 23, 27691, 918, 480, 7, 28665, 82, 34758, 6, 31591, 10354, 705, 31591, 62, 16, 3256, 705, 2539, 62, 26858, 10354, 705, 2539, 62, 26858, 62, 16, 6, 30072, 198, 198, 9630, 796, 362, 198, 1640, 2888, 287, 1074, 689, 25, 198, 197, 19522, 62, 16624, 796, 850, 62, 6978, 1343, 2888, 1343, 31051, 6, 198, 197, 19522, 62, 7266, 62, 16624, 796, 28686, 13, 4868, 15908, 7, 19522, 62, 16624, 8, 198, 197, 1640, 2393, 287, 2888, 62, 7266, 62, 16624, 25, 198, 197, 197, 7266, 796, 279, 67, 13, 961, 62, 40664, 7, 19522, 62, 16624, 10, 7753, 11, 21004, 11639, 40477, 12, 23, 27691, 918, 480, 7, 28665, 82, 34758, 6, 31591, 10354, 705, 31591, 62, 6, 1343, 965, 7, 9630, 828, 705, 2539, 62, 26858, 10354, 705, 2539, 62, 26858, 62, 6, 1343, 965, 7, 9630, 8, 30072, 198, 197, 197, 7890, 796, 1366, 13, 647, 469, 7, 7266, 11, 319, 11639, 312, 3256, 703, 11639, 9464, 11537, 198, 197, 197, 9630, 15853, 352, 198, 198, 4798, 7, 7890, 8, 198, 198, 4798, 7, 7890, 58, 7890, 17816, 31591, 62, 16, 20520, 6624, 352, 4083, 43358, 8, 198, 4798, 7, 7890, 58, 7890, 17816, 31591, 62, 17, 20520, 6624, 352, 4083, 43358, 8, 198, 4798, 7, 7890, 58, 7890, 17816, 31591, 62, 18, 20520, 6624, 352, 4083, 43358, 8, 198, 4798, 7, 7890, 58, 7890, 17816, 31591, 62, 19, 20520, 6624, 352, 4083, 43358, 8, 198, 4798, 7, 7890, 58, 7890, 17816, 31591, 62, 20, 20520, 6624, 352, 4083, 43358, 8, 198, 198, 2, 329, 5752, 287, 1366, 13, 270, 861, 84, 2374, 25, 198, 12480, 2929, 796, 37250, 31591, 62, 6, 1343, 965, 7, 9630, 8, 329, 6376, 287, 2837, 7, 16, 11, 6376, 11, 352, 15437, 198, 2539, 62, 26858, 82, 796, 37250, 2539, 62, 26858, 62, 6, 1343, 965, 7, 9630, 8, 329, 6376, 287, 2837, 7, 16, 11, 6376, 11, 352, 15437, 198, 198, 2340, 796, 17635, 198, 85, 10720, 62, 26858, 82, 796, 17635, 198, 198, 400, 3447, 796, 493, 7, 9630, 1220, 362, 8, 220, 1303, 513, 220, 220, 1303, 16268, 246, 230, 161, 222, 120, 171, 120, 248, 46479, 251, 45911, 247, 46237, 235, 21410, 17312, 222, 22887, 237, 49035, 118, 163, 236, 108, 162, 105, 94, 46763, 108, 198, 9127, 796, 657, 198, 198, 1640, 5752, 287, 2837, 7, 11925, 7, 7890, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 4633, 796, 15034, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1994, 62, 26858, 796, 15034, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 329, 479, 287, 2837, 7, 15, 11, 6376, 12, 16, 11, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4633, 58, 7890, 13, 844, 58, 808, 7131, 12480, 2929, 58, 74, 11907, 60, 15853, 352, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 3601, 7, 31591, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 11925, 7, 31591, 8, 6624, 352, 8, 1222, 357, 7890, 13, 844, 58, 808, 7131, 6, 31591, 62, 16, 20520, 6624, 352, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 479, 287, 2837, 7, 15, 11, 6376, 12, 16, 11, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 9312, 287, 1366, 13, 844, 58, 808, 7131, 2539, 62, 26858, 82, 58, 74, 60, 4083, 35312, 10786, 26, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1994, 62, 26858, 58, 26858, 60, 15853, 352, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3601, 7, 2539, 62, 26858, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9312, 82, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2456, 796, 1351, 7, 2539, 62, 26858, 13, 13083, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1573, 287, 2456, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1994, 62, 26858, 58, 4775, 60, 18189, 294, 3447, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9312, 82, 13, 33295, 7, 4775, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 9312, 82, 6624, 685, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9312, 82, 13, 33295, 7, 2539, 62, 26858, 13, 1712, 62, 11321, 7, 16, 38381, 15, 7131, 15, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9312, 82, 796, 1351, 7, 2617, 7, 26858, 82, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6709, 62, 26858, 82, 13, 33295, 10786, 26, 4458, 22179, 7, 26858, 82, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2340, 13, 33295, 7, 7890, 13, 844, 58, 808, 7131, 6, 312, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 954, 15853, 352, 628, 198, 4798, 7, 9127, 8, 198, 85, 5191, 796, 279, 67, 13, 6601, 19778, 15090, 6, 312, 10354, 220, 2340, 11, 705, 2539, 62, 26858, 10354, 6709, 62, 26858, 82, 30072, 198, 4798, 7, 85, 5191, 8, 198, 198, 46002, 796, 1366, 58, 17816, 312, 3256, 705, 31591, 62, 16, 3256, 705, 2539, 62, 26858, 62, 16, 20520, 4083, 918, 480, 7, 28665, 82, 34758, 6, 31591, 62, 16, 10354, 705, 31591, 6, 30072, 198, 46002, 796, 9199, 13, 647, 469, 7, 85, 5191, 11, 319, 11639, 312, 3256, 703, 11639, 9464, 11537, 198, 198, 46002, 17816, 2539, 62, 26858, 20520, 796, 9199, 13, 39014, 7, 50033, 6376, 25, 6376, 13, 2539, 62, 26858, 62, 16, 611, 6376, 13, 2539, 62, 26858, 318, 45941, 13, 12647, 2073, 6376, 13, 2539, 62, 26858, 11, 16488, 28, 16, 8, 198, 198, 4798, 7, 46002, 8, 198, 198, 46002, 17816, 2539, 62, 26858, 62, 12985, 62, 19155, 20520, 28, 46002, 17816, 2539, 62, 26858, 6, 4083, 39014, 7, 50033, 2124, 25, 1136, 62, 19155, 7, 87, 4008, 198, 4798, 7, 46002, 58, 46002, 17816, 2539, 62, 26858, 62, 12985, 62, 19155, 20520, 855, 15, 12962, 628, 198, 37811, 43889, 119, 30, 21410, 36310, 10310, 110, 49035, 121, 46763, 108, 6, 37811, 198, 198, 46002, 17816, 2539, 62, 26858, 20520, 28, 4868, 7, 8899, 7, 50033, 2124, 11, 7621, 25, 12233, 62, 19155, 7, 87, 11, 7621, 828, 9199, 17816, 2539, 62, 26858, 6, 4357, 9199, 17816, 2539, 62, 26858, 62, 12985, 62, 19155, 20520, 4008, 198, 4798, 7, 46002, 58, 46002, 17816, 2539, 62, 26858, 62, 12985, 62, 19155, 20520, 855, 15, 12962, 628, 198, 4798, 7, 46002, 8, 198, 46002, 58, 17816, 312, 3256, 705, 31591, 3256, 705, 2539, 62, 26858, 20520, 4083, 1462, 62, 40664, 10786, 13261, 62, 27530, 62, 85, 10720, 62, 15542, 62, 24396, 13, 40664, 3256, 6376, 28, 14202, 8, 198, 4798, 10786, 400, 3447, 25, 3256, 294, 3447, 8, 198, 4798, 10786, 8095, 1760, 2637, 8, 198 ]
2.182413
1,376
""" Module `chatette_qiu.adapters.factory`. Defines a factory method that allows to create an adapter from a string name. """ from chatette_qiu.adapters.jsonl import JsonListAdapter from chatette_qiu.adapters.rasa import RasaAdapter def create_adapter(adapter_name): """ Instantiate an adapter and returns it given the name of the adapter as a str. Names are: - 'rasa': RasaAdapter - 'jsonl': JsonListAdapter """ if adapter_name is None: return None adapter_name = adapter_name.lower() if adapter_name == 'rasa': return RasaAdapter() elif adapter_name == 'jsonl': return JsonListAdapter() raise ValueError("Unknown adapter was selected.")
[ 37811, 198, 26796, 4600, 17006, 5857, 62, 80, 16115, 13, 324, 12126, 13, 69, 9548, 44646, 198, 7469, 1127, 257, 8860, 2446, 326, 3578, 284, 2251, 281, 21302, 422, 257, 4731, 1438, 13, 198, 37811, 198, 198, 6738, 8537, 5857, 62, 80, 16115, 13, 324, 12126, 13, 17752, 75, 1330, 449, 1559, 8053, 47307, 198, 6738, 8537, 5857, 62, 80, 16115, 13, 324, 12126, 13, 8847, 64, 1330, 371, 15462, 47307, 628, 198, 4299, 2251, 62, 324, 3429, 7, 324, 3429, 62, 3672, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 24470, 9386, 281, 21302, 290, 5860, 340, 1813, 262, 1438, 286, 262, 21302, 355, 257, 965, 13, 198, 220, 220, 220, 28531, 389, 25, 198, 220, 220, 220, 220, 220, 220, 220, 532, 705, 8847, 64, 10354, 371, 15462, 47307, 198, 220, 220, 220, 220, 220, 220, 220, 532, 705, 17752, 75, 10354, 449, 1559, 8053, 47307, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 611, 21302, 62, 3672, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 6045, 198, 220, 220, 220, 21302, 62, 3672, 796, 21302, 62, 3672, 13, 21037, 3419, 198, 220, 220, 220, 611, 21302, 62, 3672, 6624, 705, 8847, 64, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 371, 15462, 47307, 3419, 198, 220, 220, 220, 1288, 361, 21302, 62, 3672, 6624, 705, 17752, 75, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 449, 1559, 8053, 47307, 3419, 198, 220, 220, 220, 5298, 11052, 12331, 7203, 20035, 21302, 373, 6163, 19570, 198 ]
2.782946
258
# Since our cli produces unicode output, but we want tests in python2 as well from __future__ import unicode_literals from datetime import datetime from click.testing import CliRunner import great_expectations.version from great_expectations.cli import cli import tempfile import pytest import json import os import shutil import logging import sys import re from ruamel.yaml import YAML yaml = YAML() yaml.default_flow_style = False try: from unittest import mock except ImportError: import mock from great_expectations.cli.init import scaffold_directories_and_notebooks # def test_cli_render(tmp_path_factory): # runner = CliRunner() # result = runner.invoke(cli, ["render"]) # print(result) # print(result.output) # assert False
[ 2, 4619, 674, 537, 72, 11073, 28000, 1098, 5072, 11, 475, 356, 765, 5254, 287, 21015, 17, 355, 880, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 3904, 13, 33407, 1330, 1012, 72, 49493, 198, 11748, 1049, 62, 1069, 806, 602, 13, 9641, 198, 6738, 1049, 62, 1069, 806, 602, 13, 44506, 1330, 537, 72, 198, 11748, 20218, 7753, 198, 11748, 12972, 9288, 198, 11748, 33918, 198, 11748, 28686, 198, 11748, 4423, 346, 198, 11748, 18931, 198, 11748, 25064, 198, 11748, 302, 198, 6738, 7422, 17983, 13, 88, 43695, 1330, 575, 2390, 43, 198, 88, 43695, 796, 575, 2390, 43, 3419, 198, 88, 43695, 13, 12286, 62, 11125, 62, 7635, 796, 10352, 198, 198, 28311, 25, 198, 220, 220, 220, 422, 555, 715, 395, 1330, 15290, 198, 16341, 17267, 12331, 25, 198, 220, 220, 220, 1330, 15290, 628, 198, 6738, 1049, 62, 1069, 806, 602, 13, 44506, 13, 15003, 1330, 41498, 727, 62, 12942, 1749, 62, 392, 62, 11295, 12106, 628, 628, 628, 628, 628, 198, 198, 2, 825, 1332, 62, 44506, 62, 13287, 7, 22065, 62, 6978, 62, 69, 9548, 2599, 198, 2, 220, 220, 220, 220, 17490, 796, 1012, 72, 49493, 3419, 198, 2, 220, 220, 220, 220, 1255, 796, 17490, 13, 37669, 7, 44506, 11, 14631, 13287, 8973, 8, 198, 198, 2, 220, 220, 220, 220, 3601, 7, 20274, 8, 198, 2, 220, 220, 220, 220, 3601, 7, 20274, 13, 22915, 8, 198, 2, 220, 220, 220, 220, 6818, 10352, 628, 628, 198 ]
3.011583
259