content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
'''
Created on 2014-03-23
@author: Nich
'''
class SystemSet(object):
'''
classdocs
'''
| [
7061,
6,
198,
41972,
319,
1946,
12,
3070,
12,
1954,
198,
198,
31,
9800,
25,
12760,
198,
7061,
6,
198,
198,
4871,
4482,
7248,
7,
15252,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1398,
31628,
198,
220,
220,
220,
705,
7061,
628,
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
] | 1.736842 | 76 |
import argparse
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import tensorflow as tf
import os
from helper import AttackEvaluate
from helper import load_data, retrain
####for solving some specific problems, don't care
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.compat.v1.Session(config=config)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--model_name", default='lenet1', type=str)
parser.add_argument("--dataset", default='mnist', type=str)
parser.add_argument("--model_layer", default=8, type=int)
parser.add_argument("--order_number", default=1, type=int)
args = parser.parse_args()
model_name = args.model_name
model_layer = args.model_layer
dataset = args.dataset
order_number = args.order_number
l = [0, model_layer]
os.makedirs("attack_results", exist_ok=True)
x_train, y_train, x_test, y_test = load_data(dataset)
x_test_new = np.load('x_test_new.npy')
# ## load mine trained model
from keras.models import load_model
model = load_model('../data/' + dataset + '_data/model/' + model_name + '.h5')
model.summary()
T = 1
for i in range(T):
index = np.load('fuzzing/nc_index_{}.npy'.format(i), allow_pickle=True).item()
for y, x in index.items():
x_train = np.concatenate((x_train, np.expand_dims(x, axis=0)), axis=0)
y_train = np.concatenate((y_train, np.expand_dims(y_train[y], axis=0)), axis=0)
retrained_model = retrain(model, x_train, y_train, x_test, y_test, batch_size=32, epochs=5)
retrained_model.save('new_model/' + dataset +'/model_{}.h5'.format(T-1))
criteria = AttackEvaluate(retrained_model, x_test, y_test, x_test_new)
MR = criteria.misclassification_rate()
ACAC = criteria.avg_confidence_adv_class()
ACTC = criteria.avg_confidence_true_class()
ALP_L0, ALP_L2, ALP_Li = criteria.avg_lp_distortion()
ASS = criteria.avg_SSIM()
PSD = criteria.avg_PSD()
NTE = criteria.avg_noise_tolerance_estimation()
_, _, RGB = criteria.robust_gaussian_blur()
_, _, RIC = criteria.robust_image_compression(1)
with open("attack_results/attack_evaluate_result_{}.txt".format(T), "a") as f:
f.write("\n------------------------------------------------------------------------------\n")
f.write('the result of {} {} is: \n'.format(dataset, model_name))
f.write('MR: {} \n'.format(MR))
f.write('ACAC: {} \n'.format(ACAC))
f.write('ACTC: {} \n'.format(ACTC))
f.write('ALP_L0: {} \n'.format(ALP_L0))
f.write('ALP_L2: {} \n'.format(ALP_L2))
f.write('ALP_Li: {} \n'.format(ALP_Li))
f.write('ASS: {} \n'.format(ASS))
f.write('PSD: {} \n'.format(PSD))
f.write('NTE: {} \n'.format(NTE))
f.write('RGB: {} \n'.format(RGB))
f.write('RIC: {} \n'.format(RIC)) | [
11748,
1822,
29572,
198,
11748,
14601,
198,
198,
40539,
654,
13,
24455,
40539,
654,
7203,
46430,
4943,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
28686,
198,
6738,
31904,
1330,
8307,
36,
2100,
4985,
198,
6738,
31904,
1330,
3440,
62,
7890,
11,
1005,
3201,
198,
198,
4242,
1640,
18120,
617,
2176,
2761,
11,
836,
470,
1337,
198,
11250,
796,
48700,
13,
5589,
265,
13,
85,
16,
13,
16934,
2964,
1462,
3419,
198,
11250,
13,
46999,
62,
25811,
13,
12154,
62,
27922,
796,
6407,
198,
82,
408,
796,
48700,
13,
5589,
265,
13,
85,
16,
13,
36044,
7,
11250,
28,
11250,
8,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
19849,
62,
3672,
1600,
4277,
11639,
11925,
316,
16,
3256,
2099,
28,
2536,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
19608,
292,
316,
1600,
4277,
11639,
10295,
396,
3256,
2099,
28,
2536,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
19849,
62,
29289,
1600,
4277,
28,
23,
11,
2099,
28,
600,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
2875,
62,
17618,
1600,
4277,
28,
16,
11,
2099,
28,
600,
8,
628,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
220,
220,
220,
2746,
62,
3672,
796,
26498,
13,
19849,
62,
3672,
198,
220,
220,
220,
2746,
62,
29289,
796,
26498,
13,
19849,
62,
29289,
198,
220,
220,
220,
27039,
796,
26498,
13,
19608,
292,
316,
198,
220,
220,
220,
1502,
62,
17618,
796,
26498,
13,
2875,
62,
17618,
628,
220,
220,
220,
300,
796,
685,
15,
11,
2746,
62,
29289,
60,
628,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7203,
20358,
62,
43420,
1600,
2152,
62,
482,
28,
17821,
8,
628,
220,
220,
220,
2124,
62,
27432,
11,
331,
62,
27432,
11,
2124,
62,
9288,
11,
331,
62,
9288,
796,
3440,
62,
7890,
7,
19608,
292,
316,
8,
198,
220,
220,
220,
2124,
62,
9288,
62,
3605,
796,
45941,
13,
2220,
10786,
87,
62,
9288,
62,
3605,
13,
77,
9078,
11537,
628,
220,
220,
220,
1303,
22492,
3440,
6164,
8776,
2746,
198,
220,
220,
220,
422,
41927,
292,
13,
27530,
1330,
3440,
62,
19849,
628,
220,
220,
220,
2746,
796,
3440,
62,
19849,
10786,
40720,
7890,
14,
6,
1343,
27039,
1343,
705,
62,
7890,
14,
19849,
14,
6,
1343,
2746,
62,
3672,
1343,
45302,
71,
20,
11537,
198,
220,
220,
220,
2746,
13,
49736,
3419,
628,
220,
220,
220,
309,
796,
352,
628,
220,
220,
220,
329,
1312,
287,
2837,
7,
51,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
45941,
13,
2220,
10786,
69,
4715,
278,
14,
10782,
62,
9630,
23330,
27422,
77,
9078,
4458,
18982,
7,
72,
828,
1249,
62,
27729,
293,
28,
17821,
737,
9186,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
331,
11,
2124,
287,
6376,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
27432,
796,
45941,
13,
1102,
9246,
268,
378,
19510,
87,
62,
27432,
11,
45941,
13,
11201,
392,
62,
67,
12078,
7,
87,
11,
16488,
28,
15,
36911,
16488,
28,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
62,
27432,
796,
45941,
13,
1102,
9246,
268,
378,
19510,
88,
62,
27432,
11,
45941,
13,
11201,
392,
62,
67,
12078,
7,
88,
62,
27432,
58,
88,
4357,
16488,
28,
15,
36911,
16488,
28,
15,
8,
628,
220,
220,
220,
1005,
13363,
62,
19849,
796,
1005,
3201,
7,
19849,
11,
2124,
62,
27432,
11,
331,
62,
27432,
11,
2124,
62,
9288,
11,
331,
62,
9288,
11,
15458,
62,
7857,
28,
2624,
11,
36835,
82,
28,
20,
8,
198,
220,
220,
220,
1005,
13363,
62,
19849,
13,
21928,
10786,
3605,
62,
19849,
14,
6,
1343,
27039,
1343,
26488,
19849,
23330,
27422,
71,
20,
4458,
18982,
7,
51,
12,
16,
4008,
628,
220,
220,
220,
9987,
796,
8307,
36,
2100,
4985,
7,
1186,
13363,
62,
19849,
11,
2124,
62,
9288,
11,
331,
62,
9288,
11,
2124,
62,
9288,
62,
3605,
8,
628,
220,
220,
220,
17242,
796,
9987,
13,
25413,
4871,
2649,
62,
4873,
3419,
198,
220,
220,
220,
7125,
2246,
796,
9987,
13,
615,
70,
62,
39745,
62,
32225,
62,
4871,
3419,
198,
220,
220,
220,
11741,
34,
796,
9987,
13,
615,
70,
62,
39745,
62,
7942,
62,
4871,
3419,
198,
220,
220,
220,
42674,
62,
43,
15,
11,
42674,
62,
43,
17,
11,
42674,
62,
32304,
796,
9987,
13,
615,
70,
62,
34431,
62,
17080,
5817,
3419,
198,
220,
220,
220,
24994,
796,
9987,
13,
615,
70,
62,
5432,
3955,
3419,
198,
220,
220,
220,
6599,
35,
796,
9987,
13,
615,
70,
62,
3705,
35,
3419,
198,
220,
220,
220,
399,
9328,
796,
9987,
13,
615,
70,
62,
3919,
786,
62,
83,
37668,
62,
395,
18991,
3419,
198,
220,
220,
220,
4808,
11,
4808,
11,
25228,
796,
9987,
13,
22609,
436,
62,
4908,
31562,
62,
2436,
333,
3419,
198,
220,
220,
220,
4808,
11,
4808,
11,
371,
2149,
796,
9987,
13,
22609,
436,
62,
9060,
62,
5589,
2234,
7,
16,
8,
628,
220,
220,
220,
351,
1280,
7203,
20358,
62,
43420,
14,
20358,
62,
49786,
62,
20274,
23330,
27422,
14116,
1911,
18982,
7,
51,
828,
366,
64,
4943,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
7203,
59,
77,
10097,
26171,
59,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
1169,
1255,
286,
23884,
23884,
318,
25,
3467,
77,
4458,
18982,
7,
19608,
292,
316,
11,
2746,
62,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
13599,
25,
23884,
3467,
77,
4458,
18982,
7,
13599,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
2246,
2246,
25,
23884,
3467,
77,
4458,
18982,
7,
2246,
2246,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
2246,
4825,
25,
23884,
3467,
77,
4458,
18982,
7,
2246,
4825,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
1847,
47,
62,
43,
15,
25,
23884,
3467,
77,
4458,
18982,
7,
1847,
47,
62,
43,
15,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
1847,
47,
62,
43,
17,
25,
23884,
3467,
77,
4458,
18982,
7,
1847,
47,
62,
43,
17,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
1847,
47,
62,
32304,
25,
23884,
3467,
77,
4458,
18982,
7,
1847,
47,
62,
32304,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
10705,
25,
23884,
3467,
77,
4458,
18982,
7,
10705,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
3705,
35,
25,
23884,
3467,
77,
4458,
18982,
7,
3705,
35,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
45,
9328,
25,
23884,
3467,
77,
4458,
18982,
7,
45,
9328,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
36982,
25,
23884,
3467,
77,
4458,
18982,
7,
36982,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
41132,
25,
23884,
3467,
77,
4458,
18982,
7,
41132,
4008
] | 2.380567 | 1,235 |
# Generated by Django 3.0.4 on 2020-06-10 22:56
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
19,
319,
12131,
12,
3312,
12,
940,
2534,
25,
3980,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.766667 | 30 |
import pandas as pd
import os
path = r'C:\Users\Vangelis\Desktop\Courses & Projects\Data Analysis Projects\NBA Datasets Analysis\Data'
os.chdir(path)
#seasonList1 = ['1996_1997']
seasonList = ['1996_1997',
'1997_1998',
'1998_1999',
'1999_2000',
'2000_2001',
'2001_2002',
'2002_2003',
'2003_2004',
'2004_2005',
'2005_2006',
'2006_2007',
'2007_2008',
'2008_2009',
'2009_2010',
'2010_2011',
'2011_2012',
'2012_2013',
'2013_2014',
'2014_2015',
'2015_2016',
'2016_2017',
'2017_2018',
'2018_2019',
'2019_2020',
'2020_2021'
]
Nbadf = getStats(10)
NbaQ4df = getStats(4)
with pd.ExcelWriter('NbaStats.xlsx') as writer :
Nbadf.to_excel(writer, sheet_name = 'Full Games')
NbaQ4df.to_excel(writer, sheet_name = '4th Quarter')
print(Nbadf)
print(NbaQ4df)
| [
11748,
19798,
292,
355,
279,
67,
201,
198,
11748,
28686,
201,
198,
201,
198,
6978,
796,
374,
6,
34,
7479,
14490,
59,
53,
8368,
271,
59,
36881,
59,
34,
39975,
1222,
29898,
59,
6601,
14691,
29898,
59,
32470,
16092,
292,
1039,
14691,
59,
6601,
6,
201,
198,
418,
13,
354,
15908,
7,
6978,
8,
201,
198,
201,
198,
2,
6230,
8053,
16,
796,
37250,
22288,
62,
21498,
20520,
201,
198,
6230,
8053,
796,
37250,
22288,
62,
21498,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
21498,
62,
21113,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
21113,
62,
18946,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
18946,
62,
11024,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11024,
62,
14585,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14585,
62,
16942,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
16942,
62,
16088,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
16088,
62,
15724,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
15724,
62,
14315,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14315,
62,
13330,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
13330,
62,
12726,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
12726,
62,
11528,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11528,
62,
10531,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10531,
62,
10333,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10333,
62,
9804,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
9804,
62,
6999,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6999,
62,
6390,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6390,
62,
4967,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4967,
62,
4626,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4626,
62,
5304,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5304,
62,
5539,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5539,
62,
7908,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
7908,
62,
23344,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
23344,
62,
42334,
3256,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
42334,
62,
1238,
2481,
6,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2361,
201,
198,
201,
198,
45,
14774,
69,
796,
651,
29668,
7,
940,
8,
201,
198,
45,
7012,
48,
19,
7568,
796,
651,
29668,
7,
19,
8,
201,
198,
201,
198,
4480,
279,
67,
13,
3109,
5276,
34379,
10786,
45,
7012,
29668,
13,
87,
7278,
87,
11537,
355,
6260,
1058,
201,
198,
220,
220,
220,
399,
14774,
69,
13,
1462,
62,
1069,
5276,
7,
16002,
11,
9629,
62,
3672,
796,
705,
13295,
5776,
11537,
201,
198,
220,
220,
220,
399,
7012,
48,
19,
7568,
13,
1462,
62,
1069,
5276,
7,
16002,
11,
9629,
62,
3672,
796,
705,
19,
400,
17264,
11537,
201,
198,
4798,
7,
45,
14774,
69,
8,
201,
198,
4798,
7,
45,
7012,
48,
19,
7568,
8,
201,
198
] | 1.648921 | 695 |
import chess
board = chess.Bitboard()
board.push_san("e4")
board.push_san("e5")
board.push_san("Qh5")
board.push_san("Nc6")
board.push_san("Bc4")
board.push_san("Nf6")
board.push_san("Qxf7")
print "is_checkmate: " +str(board.is_checkmate())
print "is_stalemate: " +str(board.is_stalemate())
print "is_insufficient_material: " +str(board.is_insufficient_material())
print "board.is_game_over: " + str(board.is_game_over()) | [
11748,
19780,
198,
3526,
796,
19780,
13,
13128,
3526,
3419,
198,
3526,
13,
14689,
62,
12807,
7203,
68,
19,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
68,
20,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
48,
71,
20,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
45,
66,
21,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
33,
66,
19,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
45,
69,
21,
4943,
198,
3526,
13,
14689,
62,
12807,
7203,
48,
26152,
22,
4943,
198,
4798,
366,
271,
62,
9122,
9830,
25,
366,
1343,
2536,
7,
3526,
13,
271,
62,
9122,
9830,
28955,
198,
4798,
366,
271,
62,
7757,
47686,
25,
366,
1343,
2536,
7,
3526,
13,
271,
62,
7757,
47686,
28955,
198,
4798,
366,
271,
62,
1040,
15267,
62,
33665,
25,
366,
1343,
2536,
7,
3526,
13,
271,
62,
1040,
15267,
62,
33665,
28955,
198,
4798,
366,
3526,
13,
271,
62,
6057,
62,
2502,
25,
366,
1343,
965,
7,
3526,
13,
271,
62,
6057,
62,
2502,
28955
] | 2.491124 | 169 |
"""Given a string s, find the length of the longest substring without repeating characters.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Example 3:
Input: s = "pwwkew"
Output: 3
Explanation: The answer is "wke", with the length of 3.
Notice that the answer must be a substring, "pwke" is a subsequence and not a substring.
Example 4:
Input: s = ""
Output: 0
Constraints:
0 <= s.length <= 5 * 104
s consists of English letters, digits, symbols and spaces."""
| [
37811,
15056,
257,
4731,
264,
11,
1064,
262,
4129,
286,
262,
14069,
3293,
1806,
1231,
20394,
3435,
13,
198,
198,
16281,
352,
25,
198,
20560,
25,
264,
796,
366,
39305,
39305,
11848,
1,
198,
26410,
25,
513,
198,
3109,
11578,
341,
25,
383,
3280,
318,
366,
39305,
1600,
351,
262,
4129,
286,
513,
13,
198,
198,
16281,
362,
25,
198,
20560,
25,
264,
796,
366,
11848,
11848,
65,
1,
198,
26410,
25,
352,
198,
3109,
11578,
341,
25,
383,
3280,
318,
366,
65,
1600,
351,
262,
4129,
286,
352,
13,
198,
198,
16281,
513,
25,
198,
20560,
25,
264,
796,
366,
79,
1383,
365,
86,
1,
198,
26410,
25,
513,
198,
3109,
11578,
341,
25,
383,
3280,
318,
366,
86,
365,
1600,
351,
262,
4129,
286,
513,
13,
198,
26396,
326,
262,
3280,
1276,
307,
257,
3293,
1806,
11,
366,
79,
86,
365,
1,
318,
257,
6399,
594,
290,
407,
257,
3293,
1806,
13,
198,
198,
16281,
604,
25,
198,
20560,
25,
264,
796,
13538,
198,
26410,
25,
657,
198,
198,
3103,
2536,
6003,
25,
198,
198,
15,
19841,
264,
13,
13664,
19841,
642,
1635,
14436,
198,
82,
10874,
286,
3594,
7475,
11,
19561,
11,
14354,
290,
9029,
526,
15931,
628,
220,
220,
220,
220
] | 3.009756 | 205 |
# define string
# - method 1
first_name = 'kaveh'
# - method 2
last_name = "mehrbanian"
# - method 3(multi-line)
bio = '''this is
about me
'''
# - method 4(multi-line)
description = """some description
about kaveh mehrbanian
"""
# access characters in string
first_name[1] # 'a'
first_name[3] # 'e'
bio[-2] # 'm'
# edit string???!
# you cannot change string
# remove a character by index from string???!
# you ...
# get number of characters in string
len(bio)
# slice string
first_name[2:] # 'veh'
bio[:3] # 'thi'
description[2:5] # 'me '
# check substring in string
'about' in bio # True
'xi' in description # False
# concat strings
first_name + ' ' + last_name # 'kaveh mehrbanian'
# format strings
# - method 1
'hello %s' % first_name # 'hello kaveh'
# - method 2
'hello {}'.format(first_name) # 'hello kaveh'
# - method 3
f'hello {first_name}' # 'hello kaveh'
# string methods
hello_string = 'Hello wOrld'
# lower
hello_string.lower() # 'hello world'
# upper
hello_string.upper() # 'HELLO WORLD'
# capitalize
hello_string.capitalize() # 'Hello world'
# title
hello_string.title() # 'Hello World'
# swapcase
hello_string.swapcase() # 'hELLO WoRLD'
# count
hello_string.count('o') # 2
# encode
encoded_hello = hello_string.encode() # b'Hello wOrld'
# decode
encoded_hello.decode() # 'Hello wOrld'
# find
hello_string.find('wO') # 6
# startswith
hello_string.startswith('H') # True
hello_string.startswith('x') # False
# endswith
hello_string.endswith('ld') # True
hello_string.endswith('bye') # False
# join
'-'.join(['kaveh', 'mehrbanian']) # 'kaveh-mehrbanian'
# split
'keveh-mehrbanian'.split('-') # ['kaveh', 'mehrbanian']
# rsplit
'Recipient.V1.64.exe'.split('.') # ['Recipient', 'V1', '64', 'exe']
'Recipient.V1.64.exe'.rsplit('.', 1) # ['Recipient.V1.64', 'exe']
'Recipient.V1.64.exe'.rsplit('.', 2) # ['Recipient.V1', '64', 'exe']
# splitlines
'hello\nworld\nsalam'.splitlines() # ['hello', 'world', 'salam']
# strip
' hello '.strip() # 'hello'
# rstrip
' hello '.rstrip() # ' hello'
# lstrip
' hello '.lstrip() # 'hello '
# isdigit
'66565'.isdigit() # True
'hello'.isdigit() # False
# isdecimal
'66.6'.isdecimal() # False
'986'.isdecimal() # True
# isalpha
'xyzabc'.isalpha() # True
'$%abcxyz'.isalpha() # False
# islower
'Hello'.islower() # False
'hello'.islower() # True
| [
2,
8160,
4731,
198,
2,
532,
2446,
352,
198,
11085,
62,
3672,
796,
705,
74,
1015,
71,
6,
198,
198,
2,
532,
2446,
362,
198,
12957,
62,
3672,
796,
366,
1326,
11840,
3820,
666,
1,
198,
198,
2,
532,
2446,
513,
7,
41684,
12,
1370,
8,
198,
65,
952,
796,
705,
7061,
5661,
318,
198,
10755,
502,
198,
7061,
6,
198,
198,
2,
532,
2446,
604,
7,
41684,
12,
1370,
8,
198,
11213,
796,
37227,
11246,
6764,
198,
10755,
479,
1015,
71,
502,
11840,
3820,
666,
198,
37811,
628,
198,
2,
1895,
3435,
287,
4731,
198,
11085,
62,
3672,
58,
16,
60,
220,
220,
1303,
705,
64,
6,
198,
11085,
62,
3672,
58,
18,
60,
220,
220,
1303,
705,
68,
6,
198,
65,
952,
58,
12,
17,
60,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
76,
6,
628,
198,
2,
4370,
4731,
3548,
12248,
198,
220,
220,
220,
1303,
345,
2314,
1487,
4731,
628,
198,
2,
4781,
257,
2095,
416,
6376,
422,
4731,
3548,
12248,
198,
220,
220,
220,
1303,
345,
2644,
628,
198,
2,
651,
1271,
286,
3435,
287,
4731,
198,
11925,
7,
65,
952,
8,
628,
198,
2,
16416,
4731,
198,
11085,
62,
3672,
58,
17,
47715,
220,
220,
220,
220,
220,
1303,
705,
33892,
6,
198,
65,
952,
58,
25,
18,
60,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
400,
72,
6,
198,
11213,
58,
17,
25,
20,
60,
220,
220,
220,
1303,
705,
1326,
705,
628,
198,
2,
2198,
3293,
1806,
287,
4731,
198,
6,
10755,
6,
287,
13401,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
6,
29992,
6,
287,
6764,
220,
220,
220,
220,
1303,
10352,
628,
198,
2,
1673,
265,
13042,
198,
11085,
62,
3672,
1343,
705,
705,
1343,
938,
62,
3672,
220,
220,
220,
1303,
705,
74,
1015,
71,
502,
11840,
3820,
666,
6,
628,
198,
2,
5794,
13042,
198,
2,
532,
2446,
352,
198,
6,
31373,
4064,
82,
6,
4064,
717,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
31373,
479,
1015,
71,
6,
198,
2,
532,
2446,
362,
198,
6,
31373,
23884,
4458,
18982,
7,
11085,
62,
3672,
8,
220,
220,
1303,
705,
31373,
479,
1015,
71,
6,
198,
2,
532,
2446,
513,
198,
69,
6,
31373,
1391,
11085,
62,
3672,
92,
6,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
31373,
479,
1015,
71,
6,
628,
198,
2,
4731,
5050,
198,
31373,
62,
8841,
796,
705,
15496,
266,
5574,
335,
6,
198,
198,
2,
2793,
198,
31373,
62,
8841,
13,
21037,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
31373,
995,
6,
198,
2,
6727,
198,
31373,
62,
8841,
13,
45828,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
13909,
3069,
46,
29564,
6,
198,
2,
35160,
198,
31373,
62,
8841,
13,
27544,
1096,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
15496,
995,
6,
198,
2,
3670,
198,
31373,
62,
8841,
13,
7839,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
15496,
2159,
6,
198,
2,
16075,
7442,
198,
31373,
62,
8841,
13,
2032,
499,
7442,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
71,
23304,
46,
22173,
7836,
35,
6,
198,
2,
954,
198,
31373,
62,
8841,
13,
9127,
10786,
78,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
362,
198,
2,
37773,
198,
12685,
9043,
62,
31373,
796,
23748,
62,
8841,
13,
268,
8189,
3419,
220,
220,
1303,
275,
6,
15496,
266,
5574,
335,
6,
198,
2,
36899,
198,
12685,
9043,
62,
31373,
13,
12501,
1098,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
15496,
266,
5574,
335,
6,
198,
2,
1064,
198,
31373,
62,
8841,
13,
19796,
10786,
86,
46,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
718,
198,
2,
923,
2032,
342,
198,
31373,
62,
8841,
13,
9688,
2032,
342,
10786,
39,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
31373,
62,
8841,
13,
9688,
2032,
342,
10786,
87,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
2,
886,
2032,
342,
198,
31373,
62,
8841,
13,
437,
2032,
342,
10786,
335,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
31373,
62,
8841,
13,
437,
2032,
342,
10786,
16390,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
2,
4654,
198,
29001,
4458,
22179,
7,
17816,
74,
1015,
71,
3256,
705,
1326,
11840,
3820,
666,
6,
12962,
220,
220,
220,
220,
220,
220,
1303,
705,
74,
1015,
71,
12,
1326,
11840,
3820,
666,
6,
198,
2,
6626,
198,
6,
365,
33892,
12,
1326,
11840,
3820,
666,
4458,
35312,
10786,
12,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
37250,
74,
1015,
71,
3256,
705,
1326,
11840,
3820,
666,
20520,
198,
2,
374,
35312,
198,
6,
6690,
48137,
13,
53,
16,
13,
2414,
13,
13499,
4458,
35312,
10786,
2637,
8,
220,
220,
220,
220,
220,
220,
220,
1303,
37250,
6690,
48137,
3256,
705,
53,
16,
3256,
705,
2414,
3256,
705,
13499,
20520,
198,
6,
6690,
48137,
13,
53,
16,
13,
2414,
13,
13499,
4458,
3808,
489,
270,
10786,
2637,
11,
352,
8,
220,
220,
220,
1303,
37250,
6690,
48137,
13,
53,
16,
13,
2414,
3256,
705,
13499,
20520,
198,
6,
6690,
48137,
13,
53,
16,
13,
2414,
13,
13499,
4458,
3808,
489,
270,
10786,
2637,
11,
362,
8,
220,
220,
220,
1303,
37250,
6690,
48137,
13,
53,
16,
3256,
705,
2414,
3256,
705,
13499,
20520,
198,
2,
6626,
6615,
198,
6,
31373,
59,
77,
6894,
59,
5907,
44949,
4458,
35312,
6615,
3419,
220,
220,
220,
220,
220,
1303,
37250,
31373,
3256,
705,
6894,
3256,
705,
21680,
321,
20520,
198,
2,
10283,
198,
6,
220,
220,
23748,
220,
220,
45302,
36311,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
31373,
6,
198,
2,
374,
36311,
198,
6,
220,
220,
23748,
220,
220,
45302,
81,
36311,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
220,
220,
23748,
6,
198,
2,
300,
36311,
198,
6,
220,
220,
23748,
220,
220,
45302,
75,
36311,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
31373,
220,
220,
705,
198,
2,
318,
27003,
198,
6,
36879,
2996,
4458,
9409,
328,
270,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
6,
31373,
4458,
9409,
328,
270,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
2,
318,
12501,
4402,
198,
6,
2791,
13,
21,
4458,
9409,
721,
4402,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
6,
49087,
4458,
9409,
721,
4402,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
2,
318,
26591,
198,
6,
5431,
89,
39305,
4458,
271,
26591,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198,
6,
3,
4,
39305,
5431,
89,
4458,
271,
26591,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
2,
318,
21037,
198,
6,
15496,
4458,
3044,
789,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10352,
198,
6,
31373,
4458,
3044,
789,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6407,
198
] | 1.976323 | 1,436 |
# Code generated by `typeddictgen`. DO NOT EDIT.
"""V1NodeSystemInfoDict generated type."""
from typing import TypedDict
V1NodeSystemInfoDict = TypedDict(
"V1NodeSystemInfoDict",
{
"architecture": str,
"bootID": str,
"containerRuntimeVersion": str,
"kernelVersion": str,
"kubeProxyVersion": str,
"kubeletVersion": str,
"machineID": str,
"operatingSystem": str,
"osImage": str,
"systemUUID": str,
},
total=False,
)
| [
2,
6127,
7560,
416,
4600,
28004,
6048,
713,
5235,
44646,
8410,
5626,
48483,
13,
198,
37811,
53,
16,
19667,
11964,
12360,
35,
713,
7560,
2099,
526,
15931,
198,
6738,
19720,
1330,
17134,
276,
35,
713,
198,
198,
53,
16,
19667,
11964,
12360,
35,
713,
796,
17134,
276,
35,
713,
7,
198,
220,
220,
220,
366,
53,
16,
19667,
11964,
12360,
35,
713,
1600,
198,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
998,
5712,
495,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
18769,
2389,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
34924,
41006,
14815,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
33885,
14815,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
74,
3266,
44148,
14815,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
74,
3266,
1616,
14815,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
30243,
2389,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
3575,
803,
11964,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
418,
5159,
1298,
965,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
10057,
52,
27586,
1298,
965,
11,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
2472,
28,
25101,
11,
198,
8,
198
] | 2.202586 | 232 |
from django.test import TestCase
from openhub_django.models import (
InfographicDetail,
Organization)
| [
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
198,
6738,
1280,
40140,
62,
28241,
14208,
13,
27530,
1330,
357,
198,
220,
220,
220,
4806,
6826,
11242,
603,
11,
198,
220,
220,
220,
12275,
8,
628
] | 3.111111 | 36 |
import firebase_admin as fb
from firebase_admin import db
from json import load
from requests import get
from fb_folder import fb_exception
import logging
class Firebase(db.Reference):
"""Firebase object"""
def __init__(self, key_path, options=None):
"""a main contructor of firebase objects"""
self.__default_app = None
self.__listen_object = None
self.__connect_fb(key_path, options=options)
client = self.__my_reference(self.__default_app)
super().__init__(client=client, path='/')
@staticmethod
@staticmethod
def __key_checker(key_path):
"""
check whether the key is correct or not
:param key_path:
:return tuple
:raises
fb_exception.SecurityKeyError
TypeError
ValueError
KeyError
"""
if not isinstance(key_path, str):
raise TypeError("key_path parameter must be argument.")
if not key_path.endswith('.json'):
raise ValueError("key_path must be json file.")
with open(key_path, 'r') as key:
key_dict = load(key)
for foo in ['type', 'project_id', 'private_key_id', 'private_key', 'client_email', 'client_id',
'auth_uri', 'token_uri', 'auth_provider_x509_cert_url', 'client_x509_cert_url']:
if foo not in key_dict:
raise KeyError('firebase security key is not correct.')
link_for_checking = key_dict['client_x509_cert_url']
if not get(link_for_checking).ok:
raise fb_exception.SecurityKeyError("Firebase project does not exist.")
index = link_for_checking.find("%40") + 3
index2 = link_for_checking.rfind(".iam")
db_link = "https://{}.firebaseio.com/".format(link_for_checking[index: index2])
cred = fb.credentials.Certificate(key_path)
return db_link, cred
def __connect_fb(self, key_path, options=None):
"""
Connect to the firebase
:param key_path:
:return:
:raises
TypeError
KeyError
"""
db_link, cred = self.__key_checker(key_path)
if not options:
self.__default_app = fb.initialize_app(cred, {'databaseURL': db_link})
else:
if not isinstance(options, dict):
raise TypeError("options must be dict")
if "databaseURL" not in options:
raise KeyError("databaseURL not in")
self.__default_app = fb.initialize_app(cred, options=options)
def start_listen(self, _function):
"""
start to listen to the database
:param _function: function object
:return:
:raises
fb_exception.ListenError
TypeError
"""
if isinstance(self.__listen_object, db.ListenerRegistration):
raise fb_exception.ListenError("Listen is active")
if not callable(_function):
raise TypeError("_function must be function")
def __listen_function(event):
"""
If server changes data on database, listen function does not process the changes.
:param event:
:return:
"""
if event.data is None:
# if event.data is None, the data on database was deleted. So the server must delete the plc
changer_id = 'other'
elif event.event_type == 'put':
if event.path == '/':
changer_id = 'other'
else:
plc_uid = event.path.split('/')[1]
if not isinstance(event.data, dict):
changer_id = self.child(plc_uid).child("changer_id").get()
else:
try:
changer_id = event.data['changer_id']
except KeyError:
logging.error("Wrong data and the data is deleted")
self.delete_plc(plc_uid)
changer_id = None
else:
if event.path == '/':
# if event.path is '/', the data was changed via multi-location method
plc_uid = list(event.data.keys())[0].split('/')[0]
else:
# if event.path is not '/', the data was changed via single-location method
plc_uid = event.path.split('/')[1]
changer_id = self.child(plc_uid).child("changer_id").get()
if changer_id == "server":
my_server = True
elif changer_id is None:
my_server = None
else:
my_server = False
if my_server is None:
print("event_type: ", event.event_type)
print("path: ", event.path)
print("data: ", event.data)
raise TypeError("Something is wrong")
if not my_server:
_function(event)
self.__listen_object = self.listen(__listen_function)
def close_listen(self):
"""
Close to listen to the database
:return:
:raise fb_exception.ListenError
"""
if isinstance(self.__listen_object, db.ListenerRegistration) and \
not self.__listen_object.is_alive or self.__listen_object is None:
logging.warning("listen is closed")
return
self.__listen_object.close()
self.__listen_object = None
def update_plc_data(self, lst):
"""
update plc data
:param lst: a list contains tuple which a format is (path, value) and lst[0]=plc_uid
:return:
:raises
TypeError
fb_exception.ChildError
"""
if lst is None:
return
if not isinstance(lst, list):
raise TypeError("lst must be list")
"lst = [plc_uid, blabla"
"gelen data ('current/datablocks/DB{_num}/data', data)"
_data = {}
plc_uid = lst[0]
for foo in lst[1:]:
path = "{}/{}/{}/Value"
for key, value in foo[-1].items():
_data[path.format(plc_uid, foo[0], key)] = value
_data[plc_uid + '/permission/to_write'] = True
_data[plc_uid + '/changer_id'] = 'server'
self.update(_data)
def change_new(self, plc_uid):
"""
change new to current
:param plc_uid
:return:
:raises
TypeError
"""
if not isinstance(plc_uid, str):
raise TypeError("plc_uid must be string")
child_node = self.child(plc_uid + "/new")
data_ = child_node.get()
self.update({
plc_uid + "/new": None,
plc_uid + "/current": data_,
plc_uid + "/permission/to_write": True,
plc_uid + '/changer_id': 'server'
})
def delete_plc(self, plc_uid):
"""
Delete plc on database
:param plc_uid:
:return:
:raise: TypeError
"""
if not isinstance(plc_uid, str):
raise TypeError("plc_uid must be str")
self.child(plc_uid).delete()
@property
def does_listen(self):
"""
return listen situation
Return
:return: Boolean
"""
return self.__listen_object.is_alive
| [
11748,
2046,
8692,
62,
28482,
355,
277,
65,
198,
6738,
2046,
8692,
62,
28482,
1330,
20613,
198,
6738,
33918,
1330,
3440,
198,
6738,
7007,
1330,
651,
198,
6738,
277,
65,
62,
43551,
1330,
277,
65,
62,
1069,
4516,
198,
11748,
18931,
628,
198,
4871,
3764,
8692,
7,
9945,
13,
26687,
2599,
198,
220,
220,
220,
37227,
13543,
8692,
2134,
37811,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1994,
62,
6978,
11,
3689,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
64,
1388,
542,
1356,
273,
286,
2046,
8692,
5563,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
12286,
62,
1324,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
4868,
268,
62,
15252,
796,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
8443,
62,
21855,
7,
2539,
62,
6978,
11,
3689,
28,
25811,
8,
628,
220,
220,
220,
220,
220,
220,
220,
5456,
796,
2116,
13,
834,
1820,
62,
35790,
7,
944,
13,
834,
12286,
62,
1324,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
834,
15003,
834,
7,
16366,
28,
16366,
11,
3108,
11639,
14,
11537,
628,
220,
220,
220,
2488,
12708,
24396,
628,
220,
220,
220,
2488,
12708,
24396,
198,
220,
220,
220,
825,
11593,
2539,
62,
9122,
263,
7,
2539,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
1771,
262,
1994,
318,
3376,
393,
407,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1994,
62,
6978,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
46545,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
430,
2696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
65,
62,
1069,
4516,
13,
24074,
9218,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11052,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7383,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
2539,
62,
6978,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
2539,
62,
6978,
11507,
1276,
307,
4578,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
1994,
62,
6978,
13,
437,
2032,
342,
7,
4458,
17752,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7203,
2539,
62,
6978,
1276,
307,
33918,
2393,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
2539,
62,
6978,
11,
705,
81,
11537,
355,
1994,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1994,
62,
11600,
796,
3440,
7,
2539,
8,
628,
220,
220,
220,
220,
220,
220,
220,
329,
22944,
287,
37250,
4906,
3256,
705,
16302,
62,
312,
3256,
705,
19734,
62,
2539,
62,
312,
3256,
705,
19734,
62,
2539,
3256,
705,
16366,
62,
12888,
3256,
705,
16366,
62,
312,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
18439,
62,
9900,
3256,
705,
30001,
62,
9900,
3256,
705,
18439,
62,
15234,
1304,
62,
87,
29022,
62,
22583,
62,
6371,
3256,
705,
16366,
62,
87,
29022,
62,
22583,
62,
6371,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
22944,
407,
287,
1994,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7383,
12331,
10786,
6495,
8692,
2324,
1994,
318,
407,
3376,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2792,
62,
1640,
62,
41004,
796,
1994,
62,
11600,
17816,
16366,
62,
87,
29022,
62,
22583,
62,
6371,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
651,
7,
8726,
62,
1640,
62,
41004,
737,
482,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
277,
65,
62,
1069,
4516,
13,
24074,
9218,
12331,
7203,
13543,
8692,
1628,
857,
407,
2152,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
2792,
62,
1640,
62,
41004,
13,
19796,
7203,
4,
1821,
4943,
1343,
513,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
17,
796,
2792,
62,
1640,
62,
41004,
13,
81,
19796,
7,
1911,
1789,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
8726,
796,
366,
5450,
1378,
90,
27422,
6495,
8692,
952,
13,
785,
14,
1911,
18982,
7,
8726,
62,
1640,
62,
41004,
58,
9630,
25,
6376,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2600,
796,
277,
65,
13,
66,
445,
14817,
13,
37608,
22460,
7,
2539,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
20613,
62,
8726,
11,
2600,
628,
220,
220,
220,
825,
11593,
8443,
62,
21855,
7,
944,
11,
1994,
62,
6978,
11,
3689,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8113,
284,
262,
2046,
8692,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1994,
62,
6978,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
430,
2696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7383,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
8726,
11,
2600,
796,
2116,
13,
834,
2539,
62,
9122,
263,
7,
2539,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
12286,
62,
1324,
796,
277,
65,
13,
36733,
1096,
62,
1324,
7,
66,
445,
11,
1391,
6,
48806,
21886,
10354,
20613,
62,
8726,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
25811,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
25811,
1276,
307,
8633,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
366,
48806,
21886,
1,
407,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7383,
12331,
7203,
48806,
21886,
407,
287,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
12286,
62,
1324,
796,
277,
65,
13,
36733,
1096,
62,
1324,
7,
66,
445,
11,
3689,
28,
25811,
8,
628,
220,
220,
220,
825,
923,
62,
4868,
268,
7,
944,
11,
4808,
8818,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
923,
284,
6004,
284,
262,
6831,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4808,
8818,
25,
2163,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
430,
2696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
65,
62,
1069,
4516,
13,
23061,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
944,
13,
834,
4868,
268,
62,
15252,
11,
20613,
13,
33252,
47133,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
277,
65,
62,
1069,
4516,
13,
23061,
12331,
7203,
23061,
318,
4075,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
869,
540,
28264,
8818,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
62,
8818,
1276,
307,
2163,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
825,
11593,
4868,
268,
62,
8818,
7,
15596,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
4382,
2458,
1366,
319,
6831,
11,
6004,
2163,
857,
407,
1429,
262,
2458,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1785,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
7890,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
1785,
13,
7890,
318,
6045,
11,
262,
1366,
319,
6831,
373,
13140,
13,
1406,
262,
4382,
1276,
12233,
262,
458,
66,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1488,
263,
62,
312,
796,
705,
847,
6,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
15596,
62,
4906,
6624,
705,
1996,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
6978,
6624,
31051,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1488,
263,
62,
312,
796,
705,
847,
6,
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,
458,
66,
62,
27112,
796,
1785,
13,
6978,
13,
35312,
10786,
14,
11537,
58,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
15596,
13,
7890,
11,
8633,
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,
1488,
263,
62,
312,
796,
2116,
13,
9410,
7,
489,
66,
62,
27112,
737,
9410,
7203,
354,
2564,
62,
312,
11074,
1136,
3419,
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,
1949,
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,
1488,
263,
62,
312,
796,
1785,
13,
7890,
17816,
354,
2564,
62,
312,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
7383,
12331,
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,
18931,
13,
18224,
7203,
39213,
506,
1366,
290,
262,
1366,
318,
13140,
4943,
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,
2116,
13,
33678,
62,
489,
66,
7,
489,
66,
62,
27112,
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,
220,
220,
220,
220,
1488,
263,
62,
312,
796,
6045,
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,
611,
1785,
13,
6978,
6624,
31051,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
1785,
13,
6978,
318,
31051,
3256,
262,
1366,
373,
3421,
2884,
5021,
12,
24886,
2446,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
796,
1351,
7,
15596,
13,
7890,
13,
13083,
28955,
58,
15,
4083,
35312,
10786,
14,
11537,
58,
15,
60,
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,
1303,
611,
1785,
13,
6978,
318,
407,
31051,
3256,
262,
1366,
373,
3421,
2884,
2060,
12,
24886,
2446,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
796,
1785,
13,
6978,
13,
35312,
10786,
14,
11537,
58,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1488,
263,
62,
312,
796,
2116,
13,
9410,
7,
489,
66,
62,
27112,
737,
9410,
7203,
354,
2564,
62,
312,
11074,
1136,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1488,
263,
62,
312,
6624,
366,
15388,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
616,
62,
15388,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1488,
263,
62,
312,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
616,
62,
15388,
796,
6045,
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,
616,
62,
15388,
796,
10352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
616,
62,
15388,
318,
6045,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
15596,
62,
4906,
25,
33172,
1785,
13,
15596,
62,
4906,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
6978,
25,
33172,
1785,
13,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
7890,
25,
33172,
1785,
13,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
22210,
318,
2642,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
616,
62,
15388,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
8818,
7,
15596,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
4868,
268,
62,
15252,
796,
2116,
13,
4868,
268,
7,
834,
4868,
268,
62,
8818,
8,
628,
220,
220,
220,
825,
1969,
62,
4868,
268,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13872,
284,
6004,
284,
262,
6831,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
40225,
277,
65,
62,
1069,
4516,
13,
23061,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
944,
13,
834,
4868,
268,
62,
15252,
11,
20613,
13,
33252,
47133,
8,
290,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
407,
2116,
13,
834,
4868,
268,
62,
15252,
13,
271,
62,
282,
425,
393,
2116,
13,
834,
4868,
268,
62,
15252,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
43917,
7203,
4868,
268,
318,
4838,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
4868,
268,
62,
15252,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
4868,
268,
62,
15252,
796,
6045,
628,
220,
220,
220,
825,
4296,
62,
489,
66,
62,
7890,
7,
944,
11,
300,
301,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4296,
458,
66,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
300,
301,
25,
257,
1351,
4909,
46545,
543,
257,
5794,
318,
357,
6978,
11,
1988,
8,
290,
300,
301,
58,
15,
22241,
489,
66,
62,
27112,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
430,
2696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
65,
62,
1069,
4516,
13,
16424,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
300,
301,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
75,
301,
11,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
75,
301,
1276,
307,
1351,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
366,
75,
301,
796,
685,
489,
66,
62,
27112,
11,
698,
397,
5031,
1,
198,
220,
220,
220,
220,
220,
220,
220,
366,
25280,
268,
1366,
19203,
14421,
14,
19608,
23117,
3320,
14,
11012,
90,
62,
22510,
92,
14,
7890,
3256,
1366,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
7890,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
796,
300,
301,
58,
15,
60,
628,
220,
220,
220,
220,
220,
220,
220,
329,
22944,
287,
300,
301,
58,
16,
25,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3108,
796,
45144,
92,
14,
90,
92,
14,
90,
92,
14,
11395,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
11,
1988,
287,
22944,
58,
12,
16,
4083,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7890,
58,
6978,
13,
18982,
7,
489,
66,
62,
27112,
11,
22944,
58,
15,
4357,
1994,
15437,
796,
1988,
628,
220,
220,
220,
220,
220,
220,
220,
4808,
7890,
58,
489,
66,
62,
27112,
1343,
31051,
525,
3411,
14,
1462,
62,
13564,
20520,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
7890,
58,
489,
66,
62,
27112,
1343,
31051,
354,
2564,
62,
312,
20520,
796,
705,
15388,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19119,
28264,
7890,
8,
628,
220,
220,
220,
825,
1487,
62,
3605,
7,
944,
11,
458,
66,
62,
27112,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1487,
649,
284,
1459,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
458,
66,
62,
27112,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
430,
2696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
489,
66,
62,
27112,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
489,
66,
62,
27112,
1276,
307,
4731,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
17440,
796,
2116,
13,
9410,
7,
489,
66,
62,
27112,
1343,
12813,
3605,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
796,
1200,
62,
17440,
13,
1136,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19119,
15090,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
1343,
12813,
3605,
1298,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
1343,
12813,
14421,
1298,
1366,
62,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
1343,
12813,
525,
3411,
14,
1462,
62,
13564,
1298,
6407,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
66,
62,
27112,
1343,
31051,
354,
2564,
62,
312,
10354,
705,
15388,
6,
198,
220,
220,
220,
220,
220,
220,
220,
32092,
628,
220,
220,
220,
825,
12233,
62,
489,
66,
7,
944,
11,
458,
66,
62,
27112,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23520,
458,
66,
319,
6831,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
458,
66,
62,
27112,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
40225,
25,
5994,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
489,
66,
62,
27112,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7203,
489,
66,
62,
27112,
1276,
307,
965,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9410,
7,
489,
66,
62,
27112,
737,
33678,
3419,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
857,
62,
4868,
268,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6004,
3074,
198,
220,
220,
220,
220,
220,
220,
220,
8229,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
41146,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
834,
4868,
268,
62,
15252,
13,
271,
62,
282,
425,
198
] | 1.995465 | 3,749 |
from .base import Env
from .env_spec import EnvSpec
try:
from .servoing_env import ServoingEnv
from .panda3d_env import Panda3dEnv
from .car_panda3d_env import CarPanda3dEnv, StraightCarPanda3dEnv, SimpleGeometricCarPanda3dEnv, GeometricCarPanda3dEnv
from .quad_panda3d_env import SimpleQuadPanda3dEnv, Point3dSimpleQuadPanda3dEnv
except ImportError:
pass
try:
from .ros_env import RosEnv
from .pr2_env import Pr2Env
from .quad_ros_env import QuadRosEnv
from .transform_quad_ros_env import TransformQuadRosEnv
except ImportError:
pass
try:
from .rllab_env import RllabEnv
except ImportError:
pass
| [
6738,
764,
8692,
1330,
2039,
85,
198,
6738,
764,
24330,
62,
16684,
1330,
2039,
85,
22882,
198,
28311,
25,
198,
220,
220,
220,
422,
764,
3168,
40519,
62,
24330,
1330,
3116,
40519,
4834,
85,
198,
220,
220,
220,
422,
764,
79,
5282,
18,
67,
62,
24330,
1330,
41112,
18,
67,
4834,
85,
198,
220,
220,
220,
422,
764,
7718,
62,
79,
5282,
18,
67,
62,
24330,
1330,
1879,
47,
5282,
18,
67,
4834,
85,
11,
27680,
9914,
47,
5282,
18,
67,
4834,
85,
11,
17427,
10082,
16996,
9914,
47,
5282,
18,
67,
4834,
85,
11,
2269,
16996,
9914,
47,
5282,
18,
67,
4834,
85,
198,
220,
220,
220,
422,
764,
47003,
62,
79,
5282,
18,
67,
62,
24330,
1330,
17427,
4507,
324,
47,
5282,
18,
67,
4834,
85,
11,
6252,
18,
67,
26437,
4507,
324,
47,
5282,
18,
67,
4834,
85,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1208,
198,
28311,
25,
198,
220,
220,
220,
422,
764,
4951,
62,
24330,
1330,
10018,
4834,
85,
198,
220,
220,
220,
422,
764,
1050,
17,
62,
24330,
1330,
1736,
17,
4834,
85,
198,
220,
220,
220,
422,
764,
47003,
62,
4951,
62,
24330,
1330,
20648,
35740,
4834,
85,
198,
220,
220,
220,
422,
764,
35636,
62,
47003,
62,
4951,
62,
24330,
1330,
26981,
4507,
324,
35740,
4834,
85,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1208,
198,
28311,
25,
198,
220,
220,
220,
422,
764,
81,
297,
397,
62,
24330,
1330,
371,
297,
397,
4834,
85,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1208,
198
] | 2.490347 | 259 |
from app import launch_server
if __name__ == '__main__':
launch_server()
| [
6738,
598,
1330,
4219,
62,
15388,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
4219,
62,
15388,
3419,
198
] | 2.888889 | 27 |
from collections import Counter
from libraries import Digits
from math import factorial
| [
6738,
17268,
1330,
15034,
198,
6738,
12782,
1330,
7367,
896,
198,
6738,
10688,
1330,
1109,
5132,
628,
220,
220,
220,
220
] | 4.428571 | 21 |
import sys
from ..common import chdir, run
from ..common.run_status import RunStatus
from ..specs.spec_repos import get_spec_download_url, format_supported_course_list
from ..toolkit import global_vars
| [
11748,
25064,
198,
198,
6738,
11485,
11321,
1330,
442,
15908,
11,
1057,
198,
6738,
11485,
11321,
13,
5143,
62,
13376,
1330,
5660,
19580,
198,
6738,
11485,
4125,
6359,
13,
16684,
62,
260,
1930,
1330,
651,
62,
16684,
62,
15002,
62,
6371,
11,
5794,
62,
15999,
62,
17319,
62,
4868,
198,
6738,
11485,
25981,
15813,
1330,
3298,
62,
85,
945,
628,
198
] | 3.360656 | 61 |
import pandas as pd
import datetime
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))))
from ..model.connect import Query as sc
| [
11748,
19798,
292,
355,
279,
67,
198,
11748,
4818,
8079,
198,
11748,
25064,
198,
11748,
28686,
198,
17597,
13,
6978,
13,
33295,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
35514,
198,
17597,
13,
6978,
13,
33295,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
35514,
4008,
198,
6738,
11485,
19849,
13,
8443,
1330,
43301,
355,
629,
198
] | 2.614679 | 109 |
from __future__ import absolute_import, print_function
from .snake_env import SnakeEnv
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
3601,
62,
8818,
198,
198,
6738,
764,
16184,
539,
62,
24330,
1330,
16705,
4834,
85,
198
] | 3.52 | 25 |
"""
Contains all the logic for decoding inform text strings.
http://inform-fiction.org/zmachine/standards/z1point0/sect03.html describes the text
encoding scheme.
This package does not handle custom dictionaries, abbrevations, and v1 files as I
have not been able to find any while testing.
"""
"""
The base (a1 and a2) alphabet dictionary. Some special characters:
0 - space
1,2,3 - use an abbrevation stored at 32((1,2,3)-1) + next z-character. Not implemented.
4 - shift lock to uppercase the next character
5 - shift lock to use the shift dictionary for the next character
"""
ALPHABET_DICT = {0: " ", 1: "", 2: "", 3: "", 4: "", 5: "", 6: "a", 7: "b", 8: "c", 9: "d", 10: "e",
11: "f", 12: "g", 13: "h", 14: "i", 15: "j", 16: "k", 17: "l", 18: "m", 19: "n",
20: "o", 21: "p", 22: "q", 23: "r", 24: "s", 25: "t", 26: "u", 27: "v",
28: "w", 29: "x", 30: "y", 31: "z"}
"""
The shift (a3) alphabet dictionary. Some special characters:
0 - space
1,2,3 - use an abbrevation stored at 32((1,2,3)-1) + next z-character. Not implemented.
4 - shift lock to uppercase the next character
5 - shift lock to use the shift dictionary for the next character
6 - the next ten bits represent an ascii character code
7 - newline
"""
SHIFT_DICT = {0: " ", 1: "", 2: "", 3: "", 4: "", 5: "", 6: "", 7: "", 8: "0", 9: "1", 10: "2",
11: "3", 12: "4", 13: "5", 14: "6", 15: "7", 16: "8", 17: "9", 18: ".", 19: ",",
20: "!", 21: "?", 22: "_", 23: "#", 24: "'", 25: "\"", 26: "/", 27: "\\",
28: "-", 29: ":", 30: "(", 31: ")"}
def decode_z_bytes_into_z_chars(z_bytes):
"""
z bytes are grouped in 16 bit segments (words) that contain 3 z characters and 1 end of word
bit. Since a z string can have any amount of z characters, this function creates a stream of
each word's z characters.
"""
binary_representation = bin(int(z_bytes, 16))[2:].zfill(16)
is_end_byte = binary_representation[0]
return (is_end_byte, [binary_representation[1:6], binary_representation[6:11],
binary_representation[11:16]])
def decode_z_word(z_bytes):
"""Given an array of bytes, decode the z word."""
word = ""
is_end_byte = False
shift_code = 0
if len(z_bytes) % 2 != 0:
return word
# Loop through the byte stream and assemble all the character bits.
word_binary_stream = []
for i in range(0, len(z_bytes), 4):
(is_end_byte, temp_binary) = decode_z_bytes_into_z_chars(
z_bytes[i:i + 4])
word_binary_stream += temp_binary
if is_end_byte is True:
break
i = 0
# Loop through all the character bits and encode them according to the z-engine rules.
while i < len(word_binary_stream):
temp_code = int(word_binary_stream[i], 2)
if temp_code == 4 or temp_code == 5:
shift_code = temp_code
else:
if shift_code == 4:
word += ALPHABET_DICT[temp_code].upper()
elif shift_code == 5:
if temp_code == 6:
word += chr(int(word_binary_stream[i + 1] +
word_binary_stream[i + 2], 2))
i += 2
else:
word += SHIFT_DICT[temp_code]
else:
word += ALPHABET_DICT[temp_code]
shift_code = 0
i += 1
return word
def decode_ascii_bytes(ascii_bytes, amount):
"""Given an array of bytes and an amount, return the ascii representation of them."""
letters = ""
for i in range(0, amount * 2, 2):
letters += chr(int(ascii_bytes[i:i + 2], 16))
return letters
| [
37811,
198,
4264,
1299,
477,
262,
9156,
329,
39938,
4175,
2420,
13042,
13,
198,
198,
4023,
1378,
259,
687,
12,
24046,
13,
2398,
14,
89,
30243,
14,
1481,
1371,
14,
89,
16,
4122,
15,
14,
8831,
3070,
13,
6494,
8477,
262,
2420,
198,
12685,
7656,
7791,
13,
198,
198,
1212,
5301,
857,
407,
5412,
2183,
48589,
3166,
11,
28873,
85,
602,
11,
290,
410,
16,
3696,
355,
314,
198,
14150,
407,
587,
1498,
284,
1064,
597,
981,
4856,
13,
198,
37811,
198,
198,
37811,
198,
464,
2779,
357,
64,
16,
290,
257,
17,
8,
24830,
22155,
13,
2773,
2041,
3435,
25,
198,
15,
220,
220,
220,
220,
220,
220,
532,
220,
220,
2272,
198,
16,
11,
17,
11,
18,
220,
220,
532,
220,
220,
779,
281,
28873,
10473,
8574,
379,
3933,
19510,
16,
11,
17,
11,
18,
13219,
16,
8,
1343,
1306,
1976,
12,
22769,
13,
1892,
9177,
13,
198,
19,
220,
220,
220,
220,
220,
220,
532,
220,
220,
6482,
5793,
284,
334,
39921,
589,
262,
1306,
2095,
198,
20,
220,
220,
220,
220,
220,
220,
532,
220,
220,
6482,
5793,
284,
779,
262,
6482,
22155,
329,
262,
1306,
2095,
198,
37811,
198,
1847,
11909,
6242,
2767,
62,
35,
18379,
796,
1391,
15,
25,
366,
33172,
352,
25,
366,
1600,
362,
25,
366,
1600,
513,
25,
366,
1600,
604,
25,
366,
1600,
642,
25,
366,
1600,
718,
25,
366,
64,
1600,
767,
25,
366,
65,
1600,
807,
25,
366,
66,
1600,
860,
25,
366,
67,
1600,
838,
25,
366,
68,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1367,
25,
366,
69,
1600,
1105,
25,
366,
70,
1600,
1511,
25,
366,
71,
1600,
1478,
25,
366,
72,
1600,
1315,
25,
366,
73,
1600,
1467,
25,
366,
74,
1600,
1596,
25,
366,
75,
1600,
1248,
25,
366,
76,
1600,
678,
25,
366,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1160,
25,
366,
78,
1600,
2310,
25,
366,
79,
1600,
2534,
25,
366,
80,
1600,
2242,
25,
366,
81,
1600,
1987,
25,
366,
82,
1600,
1679,
25,
366,
83,
1600,
2608,
25,
366,
84,
1600,
2681,
25,
366,
85,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2579,
25,
366,
86,
1600,
2808,
25,
366,
87,
1600,
1542,
25,
366,
88,
1600,
3261,
25,
366,
89,
20662,
198,
198,
37811,
198,
464,
6482,
357,
64,
18,
8,
24830,
22155,
13,
2773,
2041,
3435,
25,
198,
15,
220,
220,
220,
220,
220,
220,
532,
220,
220,
2272,
198,
16,
11,
17,
11,
18,
220,
220,
532,
220,
220,
779,
281,
28873,
10473,
8574,
379,
3933,
19510,
16,
11,
17,
11,
18,
13219,
16,
8,
1343,
1306,
1976,
12,
22769,
13,
1892,
9177,
13,
198,
19,
220,
220,
220,
220,
220,
220,
532,
220,
220,
6482,
5793,
284,
334,
39921,
589,
262,
1306,
2095,
198,
20,
220,
220,
220,
220,
220,
220,
532,
220,
220,
6482,
5793,
284,
779,
262,
6482,
22155,
329,
262,
1306,
2095,
198,
21,
220,
220,
220,
220,
220,
220,
532,
220,
220,
262,
1306,
3478,
10340,
2380,
281,
355,
979,
72,
2095,
2438,
198,
22,
220,
220,
220,
220,
220,
220,
532,
220,
220,
649,
1370,
198,
37811,
198,
9693,
32297,
62,
35,
18379,
796,
1391,
15,
25,
366,
33172,
352,
25,
366,
1600,
362,
25,
366,
1600,
513,
25,
366,
1600,
604,
25,
366,
1600,
642,
25,
366,
1600,
718,
25,
366,
1600,
767,
25,
366,
1600,
807,
25,
366,
15,
1600,
860,
25,
366,
16,
1600,
838,
25,
366,
17,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1367,
25,
366,
18,
1600,
1105,
25,
366,
19,
1600,
1511,
25,
366,
20,
1600,
1478,
25,
366,
21,
1600,
1315,
25,
366,
22,
1600,
1467,
25,
366,
23,
1600,
1596,
25,
366,
24,
1600,
1248,
25,
366,
33283,
678,
25,
366,
553,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1160,
25,
366,
40754,
2310,
25,
366,
35379,
2534,
25,
45434,
1600,
2242,
25,
25113,
1600,
1987,
25,
24018,
1600,
1679,
25,
366,
7879,
1600,
2608,
25,
12813,
1600,
2681,
25,
366,
6852,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2579,
25,
27444,
1600,
2808,
25,
366,
25,
1600,
1542,
25,
30629,
1600,
3261,
25,
366,
16725,
92,
628,
198,
4299,
36899,
62,
89,
62,
33661,
62,
20424,
62,
89,
62,
354,
945,
7,
89,
62,
33661,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1976,
9881,
389,
32824,
287,
1467,
1643,
17894,
357,
10879,
8,
326,
3994,
513,
1976,
3435,
290,
352,
886,
286,
1573,
198,
220,
220,
220,
1643,
13,
4619,
257,
1976,
4731,
460,
423,
597,
2033,
286,
1976,
3435,
11,
428,
2163,
8075,
257,
4269,
286,
198,
220,
220,
220,
1123,
1573,
338,
1976,
3435,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13934,
62,
15603,
341,
796,
9874,
7,
600,
7,
89,
62,
33661,
11,
1467,
4008,
58,
17,
25,
4083,
89,
20797,
7,
1433,
8,
628,
220,
220,
220,
318,
62,
437,
62,
26327,
796,
13934,
62,
15603,
341,
58,
15,
60,
628,
220,
220,
220,
1441,
357,
271,
62,
437,
62,
26327,
11,
685,
39491,
62,
15603,
341,
58,
16,
25,
21,
4357,
13934,
62,
15603,
341,
58,
21,
25,
1157,
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,
13934,
62,
15603,
341,
58,
1157,
25,
1433,
11907,
8,
628,
198,
4299,
36899,
62,
89,
62,
4775,
7,
89,
62,
33661,
2599,
198,
220,
220,
220,
37227,
15056,
281,
7177,
286,
9881,
11,
36899,
262,
1976,
1573,
526,
15931,
198,
220,
220,
220,
1573,
796,
13538,
198,
220,
220,
220,
318,
62,
437,
62,
26327,
796,
10352,
198,
220,
220,
220,
6482,
62,
8189,
796,
657,
628,
220,
220,
220,
611,
18896,
7,
89,
62,
33661,
8,
4064,
362,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1573,
628,
220,
220,
220,
1303,
26304,
832,
262,
18022,
4269,
290,
25432,
477,
262,
2095,
10340,
13,
198,
220,
220,
220,
1573,
62,
39491,
62,
5532,
796,
17635,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
15,
11,
18896,
7,
89,
62,
33661,
828,
604,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
357,
271,
62,
437,
62,
26327,
11,
20218,
62,
39491,
8,
796,
36899,
62,
89,
62,
33661,
62,
20424,
62,
89,
62,
354,
945,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
33661,
58,
72,
25,
72,
1343,
604,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1573,
62,
39491,
62,
5532,
15853,
20218,
62,
39491,
628,
220,
220,
220,
220,
220,
220,
220,
611,
318,
62,
437,
62,
26327,
318,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
1312,
796,
657,
628,
220,
220,
220,
1303,
26304,
832,
477,
262,
2095,
10340,
290,
37773,
606,
1864,
284,
262,
1976,
12,
18392,
3173,
13,
198,
220,
220,
220,
981,
1312,
1279,
18896,
7,
4775,
62,
39491,
62,
5532,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
8189,
796,
493,
7,
4775,
62,
39491,
62,
5532,
58,
72,
4357,
362,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
20218,
62,
8189,
6624,
604,
393,
20218,
62,
8189,
6624,
642,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6482,
62,
8189,
796,
20218,
62,
8189,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6482,
62,
8189,
6624,
604,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1573,
15853,
8355,
11909,
6242,
2767,
62,
35,
18379,
58,
29510,
62,
8189,
4083,
45828,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
6482,
62,
8189,
6624,
642,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
20218,
62,
8189,
6624,
718,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1573,
15853,
442,
81,
7,
600,
7,
4775,
62,
39491,
62,
5532,
58,
72,
1343,
352,
60,
1343,
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,
1573,
62,
39491,
62,
5532,
58,
72,
1343,
362,
4357,
362,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
15853,
362,
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,
1573,
15853,
6006,
32297,
62,
35,
18379,
58,
29510,
62,
8189,
60,
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,
1573,
15853,
8355,
11909,
6242,
2767,
62,
35,
18379,
58,
29510,
62,
8189,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6482,
62,
8189,
796,
657,
628,
220,
220,
220,
220,
220,
220,
220,
1312,
15853,
352,
628,
220,
220,
220,
1441,
1573,
628,
198,
4299,
36899,
62,
292,
979,
72,
62,
33661,
7,
292,
979,
72,
62,
33661,
11,
2033,
2599,
198,
220,
220,
220,
37227,
15056,
281,
7177,
286,
9881,
290,
281,
2033,
11,
1441,
262,
355,
979,
72,
10552,
286,
606,
526,
15931,
198,
220,
220,
220,
7475,
796,
13538,
628,
220,
220,
220,
329,
1312,
287,
2837,
7,
15,
11,
2033,
1635,
362,
11,
362,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
7475,
15853,
442,
81,
7,
600,
7,
292,
979,
72,
62,
33661,
58,
72,
25,
72,
1343,
362,
4357,
1467,
4008,
628,
220,
220,
220,
1441,
7475,
198
] | 2.196532 | 1,730 |
""" Examples from
Paul Harrenstein, Marie-Louise Lackner, and Martin Lackner.
*A Mathematical Analysis of an Election System Proposed by
Gottlob Frege*. To appear in Erkenntnis. 2020.
Preprint: https://arxiv.org/abs/1907.03643
"""
from __future__ import print_function
from frege import frege, modfrege
import apportionment
print("************************************************")
print("Example 1 (Frege's original method)")
profile = [5, 3, 2]
k = 10
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:", frege(profile, k))
print("details (verbose=True):")
frege(profile, k, verbose=True)
print()
print("************************************************")
print("Example 2 (Frege's original method)")
profile = [1, 1, 1, 1, 1, 5]
k = 17
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:", frege(profile, k))
print("details (verbose=True):")
frege(profile, k, verbose=True)
print()
print("************************************************")
print("Example 3 (Frege's original method)")
print("Frege's original method with variable electorate")
print(" may not converge to quota")
profiles = []
k = 100
for i in range(k):
profiles.append([2**(i + 1), 2**i])
print("rounds: ", k)
print("representatives distribution:", frege(profiles))
print()
print("************************************************")
print("Example 4 (Frege's modified method)")
profile = [1, 1, 1, 1, 1, 5]
k = 10
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:", modfrege(profile, k))
print("details (verbose=True):")
modfrege(profile, k, verbose=True)
print()
print("************************************************")
print("Example 4 (Frege's modified method)")
print("Frege's modified method violates variable lower quota")
print(" for m=6")
profile = [1001, 1000, 161, 151, 146, 141]
k = 13
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:", modfrege(profile, k))
print("details (verbose=True):")
modfrege(profile, k, verbose=True, checkquota=True)
print()
print("************************************************")
print("Example 5 (Frege's modified method)")
print("Frege's modified method violates variable lower quota")
print(" for m=5")
profile = [1001, 1000, 300, 107, 92]
k = 15
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:", modfrege(profile, k))
print("details (verbose=True):")
modfrege(profile, k, verbose=True, checkquota=True)
print()
print("************************************************")
print("Example 5 (Frege's modified method)")
print("Frege's modified method violates variable lower quota")
print(" for m=4")
profile = [1001, 1000, 115, 26]
k = 30
print("input (fixed electorate): ", profile)
print("rounds: ", k)
print("representatives distribution:",
modfrege(profile, k, tiebreakingallowed=False))
print("details (verbose=True):")
modfrege(profile, k, verbose=True, checkquota=True)
print()
print("************************************************")
print("Example 8 (apportionment)")
print("all apportionment methods yield different results")
methods = ["quota", "largest_remainder", "dhondt",
"saintelague", "huntington", "adams", "modfrege"]
distribution = (79, 7, 6, 3, 2, 1)
seats = 20
print("vote distribution : ", distribution)
print("seats: ", k)
print("\nresults: ")
for method in methods:
if method == "frege":
rep = frege(
distribution, seats, modifiedfrege=False, verbose=False)
elif method == "modfrege":
rep = frege(
distribution, seats, modifiedfrege=True, verbose=False)
else:
rep = apportionment.compute(
method, distribution, seats, tiesallowed=False, verbose=False)
print(method, "." * (25 - len(method)), rep)
| [
37811,
21066,
422,
198,
12041,
2113,
918,
5714,
11,
20492,
12,
24016,
786,
38289,
1008,
11,
290,
5780,
38289,
1008,
13,
198,
9,
32,
30535,
605,
14691,
286,
281,
14219,
4482,
8772,
1335,
416,
198,
38,
1252,
75,
672,
4848,
469,
24620,
1675,
1656,
287,
5256,
3464,
429,
21361,
13,
12131,
13,
198,
6719,
4798,
25,
3740,
1378,
283,
87,
452,
13,
2398,
14,
8937,
14,
1129,
2998,
13,
3070,
41813,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
6738,
2030,
469,
1330,
2030,
469,
11,
953,
19503,
469,
198,
11748,
598,
5817,
434,
628,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
352,
357,
20366,
469,
338,
2656,
2446,
8,
4943,
198,
13317,
796,
685,
20,
11,
513,
11,
362,
60,
198,
74,
796,
838,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
2030,
469,
7,
13317,
11,
479,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
362,
357,
20366,
469,
338,
2656,
2446,
8,
4943,
198,
13317,
796,
685,
16,
11,
352,
11,
352,
11,
352,
11,
352,
11,
642,
60,
198,
74,
796,
1596,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
2030,
469,
7,
13317,
11,
479,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
513,
357,
20366,
469,
338,
2656,
2446,
8,
4943,
198,
4798,
7203,
20366,
469,
338,
2656,
2446,
351,
7885,
23879,
4943,
198,
4798,
7203,
220,
743,
407,
47873,
284,
32539,
4943,
198,
5577,
2915,
796,
17635,
198,
74,
796,
1802,
198,
1640,
1312,
287,
2837,
7,
74,
2599,
198,
220,
220,
220,
16545,
13,
33295,
26933,
17,
1174,
7,
72,
1343,
352,
828,
362,
1174,
72,
12962,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
2030,
469,
7,
5577,
2915,
4008,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
604,
357,
20366,
469,
338,
9518,
2446,
8,
4943,
198,
13317,
796,
685,
16,
11,
352,
11,
352,
11,
352,
11,
352,
11,
642,
60,
198,
74,
796,
838,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
953,
19503,
469,
7,
13317,
11,
479,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
4666,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
604,
357,
20366,
469,
338,
9518,
2446,
8,
4943,
198,
4798,
7203,
20366,
469,
338,
9518,
2446,
21806,
7885,
2793,
32539,
4943,
198,
4798,
7203,
329,
285,
28,
21,
4943,
198,
13317,
796,
685,
47705,
11,
8576,
11,
27829,
11,
25326,
11,
22986,
11,
25500,
60,
198,
74,
796,
1511,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
953,
19503,
469,
7,
13317,
11,
479,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
4666,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
11,
2198,
421,
4265,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
642,
357,
20366,
469,
338,
9518,
2446,
8,
4943,
198,
4798,
7203,
20366,
469,
338,
9518,
2446,
21806,
7885,
2793,
32539,
4943,
198,
4798,
7203,
329,
285,
28,
20,
4943,
198,
13317,
796,
685,
47705,
11,
8576,
11,
5867,
11,
16226,
11,
10190,
60,
198,
74,
796,
1315,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
953,
19503,
469,
7,
13317,
11,
479,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
4666,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
11,
2198,
421,
4265,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
642,
357,
20366,
469,
338,
9518,
2446,
8,
4943,
198,
4798,
7203,
20366,
469,
338,
9518,
2446,
21806,
7885,
2793,
32539,
4943,
198,
4798,
7203,
329,
285,
28,
19,
4943,
198,
13317,
796,
685,
47705,
11,
8576,
11,
12279,
11,
2608,
60,
198,
74,
796,
1542,
198,
4798,
7203,
15414,
357,
34021,
23879,
2599,
220,
220,
220,
33172,
7034,
8,
198,
4798,
7203,
744,
82,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
4798,
7203,
15603,
2929,
6082,
25,
1600,
198,
220,
220,
220,
220,
220,
953,
19503,
469,
7,
13317,
11,
479,
11,
9839,
13395,
40845,
28,
25101,
4008,
198,
4798,
7203,
36604,
357,
19011,
577,
28,
17821,
2599,
4943,
198,
4666,
19503,
469,
7,
13317,
11,
479,
11,
15942,
577,
28,
17821,
11,
2198,
421,
4265,
28,
17821,
8,
198,
4798,
3419,
198,
198,
4798,
7203,
17174,
8412,
4943,
198,
4798,
7203,
16281,
807,
357,
1324,
5817,
434,
8,
4943,
198,
4798,
7203,
439,
598,
5817,
434,
5050,
7800,
1180,
2482,
4943,
198,
198,
24396,
82,
796,
14631,
421,
4265,
1600,
366,
28209,
62,
2787,
391,
1082,
1600,
366,
34985,
623,
83,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
82,
2913,
417,
2064,
1600,
366,
20088,
889,
1122,
1600,
366,
324,
4105,
1600,
366,
4666,
19503,
469,
8973,
198,
17080,
3890,
796,
357,
3720,
11,
767,
11,
718,
11,
513,
11,
362,
11,
352,
8,
198,
325,
1381,
796,
1160,
198,
198,
4798,
7203,
27257,
6082,
1058,
220,
220,
220,
220,
33172,
6082,
8,
198,
4798,
7203,
325,
1381,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
479,
8,
198,
198,
4798,
7203,
59,
77,
43420,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
8,
198,
1640,
2446,
287,
5050,
25,
198,
220,
220,
220,
611,
2446,
6624,
366,
19503,
469,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
796,
2030,
469,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6082,
11,
8632,
11,
9518,
19503,
469,
28,
25101,
11,
15942,
577,
28,
25101,
8,
198,
220,
220,
220,
1288,
361,
2446,
6624,
366,
4666,
19503,
469,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
796,
2030,
469,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6082,
11,
8632,
11,
9518,
19503,
469,
28,
17821,
11,
15942,
577,
28,
25101,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
796,
598,
5817,
434,
13,
5589,
1133,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2446,
11,
6082,
11,
8632,
11,
8470,
40845,
28,
25101,
11,
15942,
577,
28,
25101,
8,
198,
220,
220,
220,
3601,
7,
24396,
11,
366,
526,
1635,
357,
1495,
532,
18896,
7,
24396,
36911,
1128,
8,
198
] | 2.885694 | 1,426 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
from django.db.models import Q, CharField, TextField
from django.apps import apps
from anaf.core.models import Object
params = []
for model in apps.get_models():
if issubclass(model, Object) and getattr(model, 'searcheable', True):
for field in model._meta.fields:
if isinstance(field, (CharField, TextField)) and 'password' not in field.name and \
'object_name' not in field.name and 'object_type' not in field.name \
and 'nuvius' not in field.name:
params.append('{0!s}__{1!s}'.format(model._meta.model_name, field.name))
def search(term):
"Use database backend for searching"
query = Q()
# query_dict = {}
attr = 'search'
if term and term[0] == '*':
attr = 'icontains'
term = term[1:]
for param in params:
kwargs = {'{0!s}__{1!s}'.format(param, attr): term}
# query_dict[param] = term
query = query | Q(**kwargs)
# from pprint import pprint
# pprint(query_dict)
return Object.objects.filter(query)
| [
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
1195,
11,
3178,
15878,
11,
8255,
15878,
198,
6738,
42625,
14208,
13,
18211,
1330,
6725,
198,
198,
6738,
281,
1878,
13,
7295,
13,
27530,
1330,
9515,
198,
198,
37266,
796,
17635,
198,
198,
1640,
2746,
287,
6725,
13,
1136,
62,
27530,
33529,
198,
220,
220,
220,
611,
1189,
549,
4871,
7,
19849,
11,
9515,
8,
290,
651,
35226,
7,
19849,
11,
705,
325,
283,
2395,
540,
3256,
6407,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2214,
287,
2746,
13557,
28961,
13,
25747,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
3245,
11,
357,
12441,
15878,
11,
8255,
15878,
4008,
290,
705,
28712,
6,
407,
287,
2214,
13,
3672,
290,
3467,
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,
705,
15252,
62,
3672,
6,
407,
287,
2214,
13,
3672,
290,
705,
15252,
62,
4906,
6,
407,
287,
2214,
13,
3672,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
290,
705,
77,
14795,
3754,
6,
407,
287,
2214,
13,
3672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42287,
13,
33295,
10786,
90,
15,
0,
82,
92,
834,
90,
16,
0,
82,
92,
4458,
18982,
7,
19849,
13557,
28961,
13,
19849,
62,
3672,
11,
2214,
13,
3672,
4008,
628,
198,
4299,
2989,
7,
4354,
2599,
198,
220,
220,
220,
366,
11041,
6831,
30203,
329,
10342,
1,
198,
220,
220,
220,
12405,
796,
1195,
3419,
198,
220,
220,
220,
1303,
12405,
62,
11600,
796,
23884,
198,
220,
220,
220,
708,
81,
796,
705,
12947,
6,
198,
220,
220,
220,
611,
3381,
290,
3381,
58,
15,
60,
6624,
705,
9,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
708,
81,
796,
705,
291,
756,
1299,
6,
198,
220,
220,
220,
220,
220,
220,
220,
3381,
796,
3381,
58,
16,
47715,
198,
220,
220,
220,
329,
5772,
287,
42287,
25,
198,
220,
220,
220,
220,
220,
220,
220,
479,
86,
22046,
796,
1391,
6,
90,
15,
0,
82,
92,
834,
90,
16,
0,
82,
92,
4458,
18982,
7,
17143,
11,
708,
81,
2599,
3381,
92,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
12405,
62,
11600,
58,
17143,
60,
796,
3381,
198,
220,
220,
220,
220,
220,
220,
220,
12405,
796,
12405,
930,
1195,
7,
1174,
46265,
22046,
8,
628,
220,
220,
220,
1303,
422,
279,
4798,
1330,
279,
4798,
198,
220,
220,
220,
1303,
279,
4798,
7,
22766,
62,
11600,
8,
628,
220,
220,
220,
1441,
9515,
13,
48205,
13,
24455,
7,
22766,
8,
198
] | 2.305376 | 465 |
import os
from typing import Generator
import pytest
from neo4j import Driver, GraphDatabase
from graphdatascience.graph_data_science import GraphDataScience
from graphdatascience.query_runner.neo4j_query_runner import Neo4jQueryRunner
URI = os.environ.get("NEO4J_URI", "bolt://localhost:7687")
AUTH = None
if os.environ.get("NEO4J_USER") is not None:
AUTH = (
os.environ.get("NEO4J_USER"),
os.environ.get("NEO4J_PASSWORD", "neo4j"),
)
@pytest.fixture(scope="package")
@pytest.fixture(scope="package")
@pytest.fixture(scope="package")
| [
11748,
28686,
198,
6738,
19720,
1330,
35986,
198,
198,
11748,
12972,
9288,
198,
6738,
19102,
19,
73,
1330,
12434,
11,
29681,
38105,
198,
198,
6738,
4823,
19608,
292,
4234,
13,
34960,
62,
7890,
62,
16801,
1330,
29681,
6601,
26959,
198,
6738,
4823,
19608,
292,
4234,
13,
22766,
62,
16737,
13,
710,
78,
19,
73,
62,
22766,
62,
16737,
1330,
21227,
19,
73,
20746,
49493,
198,
198,
47269,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
45,
4720,
19,
41,
62,
47269,
1600,
366,
25593,
1378,
36750,
25,
30610,
22,
4943,
198,
198,
32,
24318,
796,
6045,
198,
361,
28686,
13,
268,
2268,
13,
1136,
7203,
45,
4720,
19,
41,
62,
29904,
4943,
318,
407,
6045,
25,
198,
220,
220,
220,
37195,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
268,
2268,
13,
1136,
7203,
45,
4720,
19,
41,
62,
29904,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
268,
2268,
13,
1136,
7203,
45,
4720,
19,
41,
62,
47924,
54,
12532,
1600,
366,
710,
78,
19,
73,
12340,
198,
220,
220,
220,
1267,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
26495,
4943,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
26495,
4943,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
26495,
4943,
198
] | 2.586364 | 220 |
from api.manager import (
deploy_manager_contract,
get_proposals,
accept_proposal,
)
from api.contributor import (
propose_iteration,
)
from api.common import (
check_share_value,
check_balance,
check_total_supply,
check_total_value,
redeem_shares,
)
| [
6738,
40391,
13,
37153,
1330,
357,
198,
220,
220,
220,
6061,
62,
37153,
62,
28484,
11,
198,
220,
220,
220,
651,
62,
1676,
1930,
874,
11,
198,
220,
220,
220,
2453,
62,
1676,
40007,
11,
198,
8,
198,
198,
6738,
40391,
13,
3642,
2455,
273,
1330,
357,
198,
220,
220,
220,
18077,
62,
2676,
341,
11,
198,
8,
198,
198,
6738,
40391,
13,
11321,
1330,
357,
198,
220,
220,
220,
2198,
62,
20077,
62,
8367,
11,
198,
220,
220,
220,
2198,
62,
20427,
11,
198,
220,
220,
220,
2198,
62,
23350,
62,
18608,
306,
11,
198,
220,
220,
220,
2198,
62,
23350,
62,
8367,
11,
198,
220,
220,
220,
26509,
62,
1477,
3565,
11,
198,
8,
628
] | 2.478632 | 117 |
import pytest
from uteis.permutacoes import (
numero_de_permutacoes_caoticas,
numero_de_permutacoes_caoticas_com_elementos_fixos,
)
@pytest.mark.parametrize('inteiro, perms_esperadas',
[(6, 265),
(8, 14833),
(15, 481066515734)])
@pytest.mark.parametrize('els, fixos, perms_esperadas',
[(10, 4, 55650),
(10, 2, 667485), ])
| [
11748,
12972,
9288,
198,
6738,
220,
1133,
271,
13,
16321,
315,
330,
3028,
1330,
357,
198,
220,
220,
220,
997,
3529,
62,
2934,
62,
16321,
315,
330,
3028,
62,
6888,
6210,
292,
11,
198,
220,
220,
220,
997,
3529,
62,
2934,
62,
16321,
315,
330,
3028,
62,
6888,
6210,
292,
62,
785,
62,
30854,
418,
62,
13049,
418,
11,
198,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
600,
68,
7058,
11,
583,
907,
62,
274,
525,
38768,
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,
47527,
21,
11,
32090,
828,
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,
357,
23,
11,
22613,
2091,
828,
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,
357,
1314,
11,
4764,
940,
36879,
18458,
2682,
8,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
1424,
11,
4259,
418,
11,
583,
907,
62,
274,
525,
38768,
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,
47527,
940,
11,
604,
11,
642,
3980,
1120,
828,
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,
357,
940,
11,
362,
11,
718,
3134,
32642,
828,
33761,
198
] | 1.655914 | 279 |
# Copyright 2020 the v8App authors. All right reserved.
# Use of this source code is governed by the MIT license
# that can be found in the LICENSE file.
| [
2,
15069,
12131,
262,
410,
23,
4677,
7035,
13,
1439,
826,
10395,
13,
198,
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
262,
17168,
5964,
198,
2,
326,
460,
307,
1043,
287,
262,
38559,
24290,
2393,
13,
198
] | 3.948718 | 39 |
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='sceptre-resolver-aws-secrets-manager',
version="1.0.0",
py_modules=['aws_secrets_manager'],
entry_points={
'sceptre.resolvers': [
'aws_secrets_manager = aws_secrets_manager:AwsSecretsManager',
],
}
)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
11639,
82,
984,
260,
12,
411,
14375,
12,
8356,
12,
2363,
8004,
12,
37153,
3256,
198,
220,
220,
220,
2196,
2625,
16,
13,
15,
13,
15,
1600,
198,
220,
220,
220,
12972,
62,
18170,
28,
17816,
8356,
62,
2363,
8004,
62,
37153,
6,
4357,
198,
220,
220,
220,
5726,
62,
13033,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
705,
82,
984,
260,
13,
411,
349,
690,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8356,
62,
2363,
8004,
62,
37153,
796,
3253,
82,
62,
2363,
8004,
62,
37153,
25,
32,
18504,
6558,
8004,
13511,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
1782,
198,
8,
198
] | 2.1 | 150 |
from typing import List, Tuple
from .texture import StudioTexture
from ....source_shared.base import Base
from ....utilities.byte_io_mdl import ByteIO
| [
6738,
19720,
1330,
7343,
11,
309,
29291,
198,
198,
6738,
764,
41293,
1330,
11733,
32742,
198,
6738,
19424,
10459,
62,
28710,
13,
8692,
1330,
7308,
198,
6738,
19424,
315,
2410,
13,
26327,
62,
952,
62,
9132,
75,
1330,
30589,
9399,
628,
198
] | 3.666667 | 42 |
import json
import html
import string
import random
import requests
from utils import *
from create_invoicePDF import create_invoice
from flask import *
from sqlalchemy.sql.elements import *
from database import Database
from datetime import date
from dateutil.relativedelta import relativedelta
dashboard = Blueprint('dashboard', __name__, template_folder='views', static_folder='assets', static_url_path='/assets')
typeOfBees = {
0: "Comune",
1: "Preziosa",
2: "Minerale",
3: "Nether"
}
@dashboard.route('/', methods=['GET', 'POST'])
@login_required
@is_member
@dashboard.route('/view/<int:ids>')
@login_required
@is_member
@dashboard.route('/notMember')
@dashboard.route('/add/beehive', methods=['GET', 'POST'])
@login_required
@is_member
@dashboard.route('/add/apiary', methods=['GET', 'POST'])
@login_required
@is_member
@dashboard.route('/delete/beehive', methods=['GET', 'POST'])
@login_required
@is_member
@dashboard.route('/delete/apiary', methods=['GET', 'POST'])
@login_required
@is_member
@dashboard.route('/payInvoices')
@login_required
@is_member
@dashboard.route('/payInvoices/<int:id>')
@login_required
@is_member
@dashboard.route('/downloadInvoices/<int:id>')
@login_required
@is_member
| [
11748,
33918,
201,
198,
11748,
27711,
201,
198,
11748,
4731,
201,
198,
11748,
4738,
201,
198,
11748,
7007,
201,
198,
201,
198,
201,
198,
6738,
3384,
4487,
1330,
1635,
201,
198,
6738,
2251,
62,
16340,
2942,
20456,
1330,
2251,
62,
16340,
2942,
201,
198,
6738,
42903,
1330,
1635,
201,
198,
6738,
44161,
282,
26599,
13,
25410,
13,
68,
3639,
1330,
1635,
201,
198,
6738,
6831,
1330,
24047,
201,
198,
6738,
4818,
8079,
1330,
3128,
201,
198,
6738,
3128,
22602,
13,
2411,
265,
1572,
12514,
1330,
48993,
1572,
12514,
201,
198,
201,
198,
42460,
3526,
796,
39932,
10786,
42460,
3526,
3256,
11593,
3672,
834,
11,
11055,
62,
43551,
11639,
33571,
3256,
9037,
62,
43551,
11639,
19668,
3256,
9037,
62,
6371,
62,
6978,
11639,
14,
19668,
11537,
201,
198,
201,
198,
4906,
5189,
33,
2841,
796,
1391,
201,
198,
220,
220,
220,
657,
25,
366,
5377,
1726,
1600,
201,
198,
220,
220,
220,
352,
25,
366,
6719,
89,
4267,
64,
1600,
201,
198,
220,
220,
220,
362,
25,
366,
44,
7274,
1000,
1600,
201,
198,
220,
220,
220,
513,
25,
366,
45,
6750,
1,
201,
198,
92,
201,
198,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
1177,
14,
27,
600,
25,
2340,
29,
11537,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
1662,
27608,
11537,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
2860,
14,
1350,
17231,
425,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
2860,
14,
499,
8042,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
33678,
14,
1350,
17231,
425,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
33678,
14,
499,
8042,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
15577,
818,
13038,
1063,
11537,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
15577,
818,
13038,
1063,
14,
27,
600,
25,
312,
29,
11537,
220,
220,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201,
198,
201,
198,
201,
198,
31,
42460,
3526,
13,
38629,
10786,
14,
15002,
818,
13038,
1063,
14,
27,
600,
25,
312,
29,
11537,
201,
198,
31,
38235,
62,
35827,
201,
198,
31,
271,
62,
19522,
201
] | 2.501916 | 522 |
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# This file contains a set of utilities functions used by other Python-based
# scripts.
import commands
import os
import platform
import re
import shutil
import subprocess
import tempfile
import sys
# Try to guess the host operating system.
# Try to guess the host architecture.
# Try to guess the number of cpus on this machine.
# Try to guess Visual Studio location when buiding on Windows.
# Returns true if we're running under Windows.
# Reads a text file into an array of strings - one for each
# line. Strips comments in the process.
# Filters out all arguments until the next '--' argument
# occurs.
# Filters out all argument until the first non '-' or the
# '--' argument occurs.
# Mapping table between build mode and build configuration.
BUILD_MODES = {
'debug': 'Debug',
'release': 'Release',
}
# Mapping table between OS and build output location.
BUILD_ROOT = {
'win32': os.path.join('build'),
'linux': os.path.join('out'),
'freebsd': os.path.join('out'),
'macos': os.path.join('xcodebuild'),
}
ARCH_FAMILY = {
'ia32': 'ia32',
'x64': 'ia32',
'arm': 'arm',
'arm64': 'arm',
'mips': 'mips',
'simarm': 'ia32',
'simmips': 'ia32',
'simarm64': 'ia32',
}
ARCH_GUESS = GuessArchitecture()
BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..'))
DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..'))
def ParseGitInfoOutput(output):
"""Given a git log, determine the latest corresponding svn revision."""
for line in output.split('\n'):
tokens = line.split()
if len(tokens) > 0 and tokens[0] == 'git-svn-id:':
return tokens[1].split('@')[1]
return None
def Daemonize():
"""
Create a detached background process (daemon). Returns True for
the daemon, False for the parent process.
See: http://www.faqs.org/faqs/unix-faq/programmer/faq/
"1.7 How do I get my program to act like a daemon?"
"""
if os.fork() > 0:
return False
os.setsid()
if os.fork() > 0:
exit(0)
raise
return True
def PrintError(string):
"""Writes and flushes a string to stderr."""
sys.stderr.write(string)
sys.stderr.write('\n')
def CheckedUnlink(name):
"""Unlink a file without throwing an exception."""
try:
os.unlink(name)
except OSError, e:
PrintError("os.unlink() " + str(e))
class ToolError(Exception):
"""Deprecated exception, use Error instead."""
def ExecuteCommand(cmd):
"""Execute a command in a subprocess."""
print 'Executing: ' + ' '.join(cmd)
pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=IsWindows())
output = pipe.communicate()
if pipe.returncode != 0:
raise Exception('Execution failed: ' + str(output))
return pipe.returncode, output
if __name__ == "__main__":
import sys
Main()
| [
2,
15069,
357,
66,
8,
2321,
11,
262,
29032,
1628,
7035,
13,
220,
4222,
766,
262,
37195,
20673,
2393,
198,
2,
329,
3307,
13,
1439,
2489,
10395,
13,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
198,
2,
347,
10305,
12,
7635,
5964,
326,
460,
307,
1043,
287,
262,
38559,
24290,
2393,
13,
198,
198,
2,
770,
2393,
4909,
257,
900,
286,
20081,
5499,
973,
416,
584,
11361,
12,
3106,
198,
2,
14750,
13,
198,
198,
11748,
9729,
198,
11748,
28686,
198,
11748,
3859,
198,
11748,
302,
198,
11748,
4423,
346,
198,
11748,
850,
14681,
198,
11748,
20218,
7753,
198,
11748,
25064,
198,
198,
2,
9993,
284,
4724,
262,
2583,
5361,
1080,
13,
628,
198,
2,
9993,
284,
4724,
262,
2583,
10959,
13,
628,
198,
2,
9993,
284,
4724,
262,
1271,
286,
31396,
385,
319,
428,
4572,
13,
198,
198,
2,
9993,
284,
4724,
15612,
11733,
4067,
618,
809,
2530,
319,
3964,
13,
628,
198,
2,
16409,
2081,
611,
356,
821,
2491,
739,
3964,
13,
628,
198,
2,
4149,
82,
257,
2420,
2393,
656,
281,
7177,
286,
13042,
532,
530,
329,
1123,
198,
2,
1627,
13,
26137,
862,
3651,
287,
262,
1429,
13,
198,
198,
2,
7066,
1010,
503,
477,
7159,
1566,
262,
1306,
705,
438,
6,
4578,
198,
2,
8833,
13,
628,
198,
2,
7066,
1010,
503,
477,
4578,
1566,
262,
717,
1729,
705,
19355,
393,
262,
198,
2,
705,
438,
6,
4578,
8833,
13,
628,
198,
2,
337,
5912,
3084,
1022,
1382,
4235,
290,
1382,
8398,
13,
198,
19499,
26761,
62,
33365,
1546,
796,
1391,
198,
220,
705,
24442,
10354,
705,
27509,
3256,
198,
220,
705,
20979,
10354,
705,
26362,
3256,
198,
92,
628,
198,
2,
337,
5912,
3084,
1022,
7294,
290,
1382,
5072,
4067,
13,
198,
19499,
26761,
62,
13252,
2394,
796,
1391,
198,
220,
705,
5404,
2624,
10354,
28686,
13,
6978,
13,
22179,
10786,
11249,
33809,
198,
220,
705,
23289,
10354,
28686,
13,
6978,
13,
22179,
10786,
448,
33809,
198,
220,
705,
5787,
1443,
67,
10354,
28686,
13,
6978,
13,
22179,
10786,
448,
33809,
198,
220,
705,
20285,
418,
10354,
28686,
13,
6978,
13,
22179,
10786,
87,
8189,
11249,
33809,
198,
92,
198,
198,
31315,
62,
37,
2390,
33340,
796,
1391,
198,
220,
705,
544,
2624,
10354,
705,
544,
2624,
3256,
198,
220,
705,
87,
2414,
10354,
705,
544,
2624,
3256,
198,
220,
705,
1670,
10354,
705,
1670,
3256,
198,
220,
705,
1670,
2414,
10354,
705,
1670,
3256,
198,
220,
705,
76,
2419,
10354,
705,
76,
2419,
3256,
198,
220,
705,
14323,
1670,
10354,
705,
544,
2624,
3256,
198,
220,
705,
82,
8608,
2419,
10354,
705,
544,
2624,
3256,
198,
220,
705,
14323,
1670,
2414,
10354,
705,
544,
2624,
3256,
198,
92,
198,
198,
31315,
62,
38022,
7597,
796,
37571,
19895,
5712,
495,
3419,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
22179,
7,
418,
13,
66,
2799,
343,
11,
705,
492,
6,
4008,
198,
35,
7227,
62,
34720,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
22179,
7,
834,
7753,
834,
11,
705,
492,
3256,
705,
492,
6,
4008,
198,
198,
4299,
2547,
325,
38,
270,
12360,
26410,
7,
22915,
2599,
198,
220,
37227,
15056,
257,
17606,
2604,
11,
5004,
262,
3452,
11188,
38487,
77,
18440,
526,
15931,
198,
220,
329,
1627,
287,
5072,
13,
35312,
10786,
59,
77,
6,
2599,
198,
220,
220,
220,
16326,
796,
1627,
13,
35312,
3419,
198,
220,
220,
220,
611,
18896,
7,
83,
482,
641,
8,
1875,
657,
290,
16326,
58,
15,
60,
6624,
705,
18300,
12,
21370,
77,
12,
312,
25,
10354,
198,
220,
220,
220,
220,
220,
1441,
16326,
58,
16,
4083,
35312,
10786,
31,
11537,
58,
16,
60,
198,
220,
1441,
6045,
628,
628,
198,
198,
4299,
9637,
7966,
1096,
33529,
198,
220,
37227,
198,
220,
13610,
257,
30795,
4469,
1429,
357,
6814,
7966,
737,
16409,
6407,
329,
198,
220,
262,
33386,
11,
10352,
329,
262,
2560,
1429,
13,
198,
220,
4091,
25,
2638,
1378,
2503,
13,
13331,
48382,
13,
2398,
14,
13331,
48382,
14,
403,
844,
12,
13331,
80,
14,
23065,
647,
14,
13331,
80,
14,
198,
220,
366,
16,
13,
22,
1374,
466,
314,
651,
616,
1430,
284,
719,
588,
257,
33386,
1701,
198,
220,
37227,
198,
220,
611,
28686,
13,
32523,
3419,
1875,
657,
25,
198,
220,
220,
220,
1441,
10352,
198,
220,
28686,
13,
28709,
312,
3419,
198,
220,
611,
28686,
13,
32523,
3419,
1875,
657,
25,
198,
220,
220,
220,
8420,
7,
15,
8,
198,
220,
220,
220,
5298,
198,
220,
1441,
6407,
628,
198,
4299,
12578,
12331,
7,
8841,
2599,
198,
220,
37227,
20257,
274,
290,
781,
17237,
257,
4731,
284,
336,
1082,
81,
526,
15931,
198,
220,
25064,
13,
301,
1082,
81,
13,
13564,
7,
8841,
8,
198,
220,
25064,
13,
301,
1082,
81,
13,
13564,
10786,
59,
77,
11537,
628,
198,
4299,
6822,
276,
3118,
8726,
7,
3672,
2599,
198,
220,
37227,
3118,
8726,
257,
2393,
1231,
9644,
281,
6631,
526,
15931,
198,
220,
1949,
25,
198,
220,
220,
220,
28686,
13,
403,
8726,
7,
3672,
8,
198,
220,
2845,
440,
5188,
81,
1472,
11,
304,
25,
198,
220,
220,
220,
12578,
12331,
7203,
418,
13,
403,
8726,
3419,
366,
1343,
965,
7,
68,
4008,
628,
628,
198,
4871,
16984,
12331,
7,
16922,
2599,
198,
220,
37227,
12156,
31023,
6631,
11,
779,
13047,
2427,
526,
15931,
628,
628,
198,
198,
4299,
8393,
1133,
21575,
7,
28758,
2599,
198,
220,
37227,
23002,
1133,
257,
3141,
287,
257,
850,
14681,
526,
15931,
198,
220,
3601,
705,
23002,
15129,
25,
705,
1343,
705,
45302,
22179,
7,
28758,
8,
198,
220,
12656,
796,
850,
14681,
13,
47,
9654,
7,
28758,
11,
14367,
448,
28,
7266,
14681,
13,
47,
4061,
36,
11,
336,
1082,
81,
28,
7266,
14681,
13,
47,
4061,
36,
11,
198,
220,
220,
220,
220,
220,
7582,
28,
3792,
11209,
28955,
198,
220,
5072,
796,
12656,
13,
10709,
5344,
3419,
198,
220,
611,
12656,
13,
7783,
8189,
14512,
657,
25,
198,
220,
220,
220,
5298,
35528,
10786,
23002,
1009,
4054,
25,
705,
1343,
965,
7,
22915,
4008,
198,
220,
1441,
12656,
13,
7783,
8189,
11,
5072,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
1330,
25064,
198,
220,
8774,
3419,
198
] | 2.873563 | 1,044 |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 8 14:48:20 2021
@author: utilisateur
"""
import numpy as np
import heapq
import matplotlib.pyplot as plt
from PIL import Image
# Trouver la zone inexplorée la plus proche du robot
M = np.array([[0,0,1,1],
[0,1,0.5,1],
[0,0,1,1],
[1,0,0,0]])
#fonction utile pour le programme suivant
#Algorithme du plus court chemin
#On renvoit les consignes de Rotation/Déplacement pour le robot
# Driver code
main()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
2892,
5267,
220,
807,
1478,
25,
2780,
25,
1238,
33448,
198,
198,
31,
9800,
25,
7736,
271,
15093,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
24575,
80,
220,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
350,
4146,
1330,
7412,
220,
628,
198,
198,
2,
22141,
332,
8591,
6516,
33199,
273,
22161,
8591,
5556,
386,
2395,
7043,
9379,
198,
44,
796,
45941,
13,
18747,
26933,
58,
15,
11,
15,
11,
16,
11,
16,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
16,
11,
15,
13,
20,
11,
16,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
15,
11,
16,
11,
16,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
11,
15,
11,
15,
11,
15,
11907,
8,
628,
198,
2,
69,
261,
596,
3384,
576,
12797,
443,
11383,
424,
452,
415,
198,
198,
2,
2348,
7727,
1326,
7043,
5556,
2184,
1125,
1084,
198,
2,
2202,
8851,
13038,
270,
10287,
762,
570,
274,
390,
371,
14221,
14,
35,
2634,
489,
5592,
12797,
443,
9379,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
198,
2,
12434,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
12417,
3419,
628,
198,
220,
220,
220,
220,
198
] | 2.049618 | 262 |
#!/usr/bin/python
import time
import datetime
from Libs.Clock import Clock
from Libs.PiTFT import Display
from Libs.Weather import Weather
from Libs.Input import Button
from Libs.GStreamer import Speaker
from config import configuration
# The weather station
station_name = configuration.get('weather_station')
weather_station = Weather(station_name)
# Connect to the internal machine clock
clock = Clock()
# Connect to the LED display
display = Display()
# Connect to the speaker
speaker = Speaker()
# Play some music
# Wake us up at 8:30 in the morning
clock.atTime(8, 30, playMusic)
# Show the current weather
# What to do when you press a button
Button(24).whenPressed(switchWeatherStations)
# Show the current time
# What to do when the internal clock ticks
clock.onTick(showCurrentTime)
# Set the brightness (0 to 15, 15 is the brightest)
display.setBrightness(1)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
201,
198,
201,
198,
11748,
640,
201,
198,
11748,
4818,
8079,
201,
198,
6738,
7980,
82,
13,
44758,
1330,
21328,
201,
198,
6738,
7980,
82,
13,
38729,
51,
9792,
1330,
16531,
201,
198,
6738,
7980,
82,
13,
41865,
1330,
15615,
201,
198,
6738,
7980,
82,
13,
20560,
1330,
20969,
201,
198,
6738,
7980,
82,
13,
38,
28696,
1330,
14931,
201,
198,
6738,
4566,
1330,
8398,
201,
198,
201,
198,
2,
383,
6193,
4429,
201,
198,
17529,
62,
3672,
796,
8398,
13,
1136,
10786,
23563,
62,
17529,
11537,
201,
198,
23563,
62,
17529,
796,
15615,
7,
17529,
62,
3672,
8,
201,
198,
201,
198,
2,
8113,
284,
262,
5387,
4572,
8801,
201,
198,
15750,
796,
21328,
3419,
201,
198,
201,
198,
2,
8113,
284,
262,
12365,
3359,
201,
198,
13812,
796,
16531,
3419,
201,
198,
201,
198,
2,
8113,
284,
262,
10834,
201,
198,
4125,
3110,
796,
14931,
3419,
201,
198,
201,
198,
2,
3811,
617,
2647,
201,
198,
201,
198,
2,
20441,
514,
510,
379,
807,
25,
1270,
287,
262,
3329,
201,
198,
15750,
13,
265,
7575,
7,
23,
11,
1542,
11,
711,
22648,
8,
201,
198,
201,
198,
2,
5438,
262,
1459,
6193,
201,
198,
201,
198,
2,
1867,
284,
466,
618,
345,
1803,
257,
4936,
201,
198,
21864,
7,
1731,
737,
12518,
47,
2790,
7,
31943,
41865,
1273,
602,
8,
201,
198,
201,
198,
2,
5438,
262,
1459,
640,
201,
198,
201,
198,
2,
1867,
284,
466,
618,
262,
5387,
8801,
36066,
201,
198,
15750,
13,
261,
51,
624,
7,
12860,
11297,
7575,
8,
201,
198,
201,
198,
2,
5345,
262,
22204,
357,
15,
284,
1315,
11,
1315,
318,
262,
33871,
8,
201,
198,
13812,
13,
2617,
41267,
1108,
7,
16,
8,
201,
198
] | 3.150171 | 293 |
import unittest
from programy.clients.events.console.config import ConsoleConfiguration
from programy.config.brain.dynamic import BrainDynamicsConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.dynamic.dynamics import DynamicsCollection
from programy.dynamic.sets.numeric import IsNumeric
from programy.dynamic.maps.plural import PluralMap
from programy.dynamic.maps.singular import SingularMap
from programy.dynamic.maps.predecessor import PredecessorMap
from programy.dynamic.maps.successor import SuccessorMap
from programy.dynamic.variables.variable import DynamicSettableVariable
| [
11748,
555,
715,
395,
198,
198,
6738,
1430,
88,
13,
565,
2334,
13,
31534,
13,
41947,
13,
11250,
1330,
24371,
38149,
198,
6738,
1430,
88,
13,
11250,
13,
27825,
13,
67,
28995,
1330,
14842,
35,
4989,
873,
38149,
198,
6738,
1430,
88,
13,
11250,
13,
7753,
13,
88,
43695,
62,
7753,
1330,
14063,
75,
38149,
8979,
198,
6738,
1430,
88,
13,
67,
28995,
13,
67,
4989,
873,
1330,
33806,
36307,
198,
6738,
1430,
88,
13,
67,
28995,
13,
28709,
13,
77,
39223,
1330,
1148,
45,
39223,
198,
6738,
1430,
88,
13,
67,
28995,
13,
31803,
13,
489,
1523,
1330,
1345,
1523,
13912,
198,
6738,
1430,
88,
13,
67,
28995,
13,
31803,
13,
12215,
934,
1330,
5573,
934,
13912,
198,
6738,
1430,
88,
13,
67,
28995,
13,
31803,
13,
28764,
721,
5987,
1330,
14322,
721,
5987,
13912,
198,
6738,
1430,
88,
13,
67,
28995,
13,
31803,
13,
13138,
273,
1330,
16282,
273,
13912,
198,
6738,
1430,
88,
13,
67,
28995,
13,
25641,
2977,
13,
45286,
1330,
26977,
50,
3087,
540,
43015,
628,
628
] | 3.668605 | 172 |
#!/usr/bin/python3
#.py for test load data..
import sys
sys.path.append("../")
import insummer
from insummer.read_conf import config
import pickle
duc_conf = config('../../conf/question.conf')
if __name__ == "__main__":
test_question(duc_conf['duc_question'])
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
198,
2,
13,
9078,
329,
1332,
3440,
1366,
492,
198,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
33295,
7203,
40720,
4943,
198,
11748,
1035,
31647,
198,
6738,
1035,
31647,
13,
961,
62,
10414,
1330,
4566,
198,
198,
11748,
2298,
293,
198,
198,
6077,
62,
10414,
796,
4566,
10786,
40720,
40720,
10414,
14,
25652,
13,
10414,
11537,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1332,
62,
25652,
7,
6077,
62,
10414,
17816,
6077,
62,
25652,
6,
12962,
198
] | 2.802083 | 96 |
from json import load
from InquirerPy.utils import color_print
from InquirerPy import inquirer
from .loadouts_manager import Loadouts_Manager
from ..loadout_grid import Loadout_Grid
| [
6738,
33918,
1330,
3440,
198,
6738,
17193,
557,
81,
20519,
13,
26791,
1330,
3124,
62,
4798,
198,
6738,
17193,
557,
81,
20519,
1330,
38212,
81,
220,
198,
198,
6738,
764,
2220,
5269,
62,
37153,
1330,
8778,
5269,
62,
13511,
198,
6738,
11485,
2220,
448,
62,
25928,
1330,
8778,
448,
62,
41339,
198
] | 3.538462 | 52 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/bigtable/v1/bigtable_service.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from gcloud.bigtable._generated import annotations_pb2 as google_dot_api_dot_annotations__pb2
from gcloud.bigtable._generated import bigtable_data_pb2 as google_dot_bigtable_dot_v1_dot_bigtable__data__pb2
from gcloud.bigtable._generated import bigtable_service_messages_pb2 as google_dot_bigtable_dot_v1_dot_bigtable__service__messages__pb2
from gcloud.bigtable._generated import empty_pb2 as google_dot_protobuf_dot_empty__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='google/bigtable/v1/bigtable_service.proto',
package='google.bigtable.v1',
syntax='proto3',
serialized_pb=b'\n)google/bigtable/v1/bigtable_service.proto\x12\x12google.bigtable.v1\x1a\x1cgoogle/api/annotations.proto\x1a&google/bigtable/v1/bigtable_data.proto\x1a\x32google/bigtable/v1/bigtable_service_messages.proto\x1a\x1bgoogle/protobuf/empty.proto2\xb0\x07\n\x0f\x42igtableService\x12\xa5\x01\n\x08ReadRows\x12#.google.bigtable.v1.ReadRowsRequest\x1a$.google.bigtable.v1.ReadRowsResponse\"L\x82\xd3\xe4\x93\x02\x46\"A/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows:read:\x01*0\x01\x12\xb7\x01\n\rSampleRowKeys\x12(.google.bigtable.v1.SampleRowKeysRequest\x1a).google.bigtable.v1.SampleRowKeysResponse\"O\x82\xd3\xe4\x93\x02I\x12G/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows:sampleKeys0\x01\x12\xa3\x01\n\tMutateRow\x12$.google.bigtable.v1.MutateRowRequest\x1a\x16.google.protobuf.Empty\"X\x82\xd3\xe4\x93\x02R\"M/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:mutate:\x01*\x12\xd2\x01\n\x11\x43heckAndMutateRow\x12,.google.bigtable.v1.CheckAndMutateRowRequest\x1a-.google.bigtable.v1.CheckAndMutateRowResponse\"`\x82\xd3\xe4\x93\x02Z\"U/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:checkAndMutate:\x01*\x12\xbf\x01\n\x12ReadModifyWriteRow\x12-.google.bigtable.v1.ReadModifyWriteRowRequest\x1a\x17.google.bigtable.v1.Row\"a\x82\xd3\xe4\x93\x02[\"V/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:readModifyWrite:\x01*B4\n\x16\x63om.google.bigtable.v1B\x15\x42igtableServicesProtoP\x01\x88\x01\x01\x62\x06proto3'
,
dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_bigtable_dot_v1_dot_bigtable__data__pb2.DESCRIPTOR,google_dot_bigtable_dot_v1_dot_bigtable__service__messages__pb2.DESCRIPTOR,google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), b'\n\026com.google.bigtable.v1B\025BigtableServicesProtoP\001\210\001\001')
import abc
from grpc.beta import implementations as beta_implementations
from grpc.early_adopter import implementations as early_adopter_implementations
from grpc.framework.alpha import utilities as alpha_utilities
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
class EarlyAdopterBigtableServiceServicer(object):
"""<fill me in later!>"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
class EarlyAdopterBigtableServiceServer(object):
"""<fill me in later!>"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
@abc.abstractmethod
class EarlyAdopterBigtableServiceStub(object):
"""<fill me in later!>"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
ReadRows.async = None
@abc.abstractmethod
SampleRowKeys.async = None
@abc.abstractmethod
MutateRow.async = None
@abc.abstractmethod
CheckAndMutateRow.async = None
@abc.abstractmethod
ReadModifyWriteRow.async = None
class BetaBigtableServiceServicer(object):
"""<fill me in later!>"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
class BetaBigtableServiceStub(object):
"""The interface to which stubs will conform."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
MutateRow.future = None
@abc.abstractmethod
CheckAndMutateRow.future = None
@abc.abstractmethod
ReadModifyWriteRow.future = None
# @@protoc_insertion_point(module_scope)
| [
2,
2980,
515,
416,
262,
8435,
11876,
17050,
13,
220,
8410,
5626,
48483,
0,
198,
2,
2723,
25,
23645,
14,
14261,
11487,
14,
85,
16,
14,
14261,
11487,
62,
15271,
13,
1676,
1462,
198,
198,
6738,
23645,
13,
11235,
672,
3046,
1330,
43087,
355,
4808,
20147,
1968,
273,
198,
6738,
23645,
13,
11235,
672,
3046,
1330,
3275,
355,
4808,
20500,
198,
6738,
23645,
13,
11235,
672,
3046,
1330,
14580,
355,
4808,
5420,
1564,
198,
6738,
23645,
13,
11235,
672,
3046,
1330,
6194,
62,
48806,
355,
4808,
1837,
23650,
62,
48806,
198,
6738,
23645,
13,
11235,
672,
3046,
1330,
43087,
62,
40842,
17,
198,
2,
25248,
11235,
420,
62,
28463,
295,
62,
4122,
7,
320,
3742,
8,
198,
198,
62,
37047,
62,
9945,
796,
4808,
1837,
23650,
62,
48806,
13,
19463,
3419,
628,
198,
6738,
308,
17721,
13,
14261,
11487,
13557,
27568,
1330,
37647,
62,
40842,
17,
355,
23645,
62,
26518,
62,
15042,
62,
26518,
62,
34574,
602,
834,
40842,
17,
198,
6738,
308,
17721,
13,
14261,
11487,
13557,
27568,
1330,
1263,
11487,
62,
7890,
62,
40842,
17,
355,
23645,
62,
26518,
62,
14261,
11487,
62,
26518,
62,
85,
16,
62,
26518,
62,
14261,
11487,
834,
7890,
834,
40842,
17,
198,
6738,
308,
17721,
13,
14261,
11487,
13557,
27568,
1330,
1263,
11487,
62,
15271,
62,
37348,
1095,
62,
40842,
17,
355,
23645,
62,
26518,
62,
14261,
11487,
62,
26518,
62,
85,
16,
62,
26518,
62,
14261,
11487,
834,
15271,
834,
37348,
1095,
834,
40842,
17,
198,
6738,
308,
17721,
13,
14261,
11487,
13557,
27568,
1330,
6565,
62,
40842,
17,
355,
23645,
62,
26518,
62,
11235,
672,
3046,
62,
26518,
62,
28920,
834,
40842,
17,
628,
198,
30910,
36584,
32961,
796,
4808,
20147,
1968,
273,
13,
8979,
24564,
1968,
273,
7,
198,
220,
1438,
11639,
13297,
14,
14261,
11487,
14,
85,
16,
14,
14261,
11487,
62,
15271,
13,
1676,
1462,
3256,
198,
220,
5301,
11639,
13297,
13,
14261,
11487,
13,
85,
16,
3256,
198,
220,
15582,
11639,
1676,
1462,
18,
3256,
198,
220,
11389,
1143,
62,
40842,
28,
65,
6,
59,
77,
8,
13297,
14,
14261,
11487,
14,
85,
16,
14,
14261,
11487,
62,
15271,
13,
1676,
1462,
59,
87,
1065,
59,
87,
1065,
13297,
13,
14261,
11487,
13,
85,
16,
59,
87,
16,
64,
59,
87,
16,
66,
13297,
14,
15042,
14,
34574,
602,
13,
1676,
1462,
59,
87,
16,
64,
5,
13297,
14,
14261,
11487,
14,
85,
16,
14,
14261,
11487,
62,
7890,
13,
1676,
1462,
59,
87,
16,
64,
59,
87,
2624,
13297,
14,
14261,
11487,
14,
85,
16,
14,
14261,
11487,
62,
15271,
62,
37348,
1095,
13,
1676,
1462,
59,
87,
16,
64,
59,
87,
16,
65,
13297,
14,
11235,
672,
3046,
14,
28920,
13,
1676,
1462,
17,
59,
30894,
15,
59,
87,
2998,
59,
77,
59,
87,
15,
69,
59,
87,
3682,
328,
11487,
16177,
59,
87,
1065,
59,
27865,
20,
59,
87,
486,
59,
77,
59,
87,
2919,
5569,
49,
1666,
59,
87,
1065,
2,
13,
13297,
13,
14261,
11487,
13,
85,
16,
13,
5569,
49,
1666,
18453,
59,
87,
16,
64,
35307,
13297,
13,
14261,
11487,
13,
85,
16,
13,
5569,
49,
1666,
31077,
7879,
43,
59,
87,
6469,
59,
24954,
18,
59,
27705,
19,
59,
87,
6052,
59,
87,
2999,
59,
87,
3510,
7879,
32,
14,
85,
16,
14,
90,
11487,
62,
3672,
28,
42068,
15211,
14,
89,
1952,
15211,
14,
565,
13654,
15211,
14,
83,
2977,
15211,
92,
14,
8516,
25,
961,
7479,
87,
486,
9,
15,
59,
87,
486,
59,
87,
1065,
59,
30894,
22,
59,
87,
486,
59,
77,
59,
81,
36674,
25166,
40729,
59,
87,
1065,
7,
13,
13297,
13,
14261,
11487,
13,
85,
16,
13,
36674,
25166,
40729,
18453,
59,
87,
16,
64,
737,
13297,
13,
14261,
11487,
13,
85,
16,
13,
36674,
25166,
40729,
31077,
7879,
46,
59,
87,
6469,
59,
24954,
18,
59,
27705,
19,
59,
87,
6052,
59,
87,
2999,
40,
59,
87,
1065,
38,
14,
85,
16,
14,
90,
11487,
62,
3672,
28,
42068,
15211,
14,
89,
1952,
15211,
14,
565,
13654,
15211,
14,
83,
2977,
15211,
92,
14,
8516,
25,
39873,
40729,
15,
59,
87,
486,
59,
87,
1065,
59,
27865,
18,
59,
87,
486,
59,
77,
59,
83,
41603,
378,
25166,
59,
87,
1065,
35307,
13297,
13,
14261,
11487,
13,
85,
16,
13,
41603,
378,
25166,
18453,
59,
87,
16,
64,
59,
87,
1433,
13,
13297,
13,
11235,
672,
3046,
13,
40613,
7879,
55,
59,
87,
6469,
59,
24954,
18,
59,
27705,
19,
59,
87,
6052,
59,
87,
2999,
49,
7879,
44,
14,
85,
16,
14,
90,
11487,
62,
3672,
28,
42068,
15211,
14,
89,
1952,
15211,
14,
565,
13654,
15211,
14,
83,
2977,
15211,
92,
14,
8516,
14,
90,
808,
62,
2539,
38362,
21973,
378,
7479,
87,
486,
9,
59,
87,
1065,
59,
24954,
17,
59,
87,
486,
59,
77,
59,
87,
1157,
59,
87,
3559,
258,
694,
1870,
41603,
378,
25166,
59,
87,
1065,
38508,
13297,
13,
14261,
11487,
13,
85,
16,
13,
9787,
1870,
41603,
378,
25166,
18453,
59,
87,
16,
64,
34507,
13297,
13,
14261,
11487,
13,
85,
16,
13,
9787,
1870,
41603,
378,
25166,
31077,
7879,
63,
59,
87,
6469,
59,
24954,
18,
59,
27705,
19,
59,
87,
6052,
59,
87,
2999,
57,
7879,
52,
14,
85,
16,
14,
90,
11487,
62,
3672,
28,
42068,
15211,
14,
89,
1952,
15211,
14,
565,
13654,
15211,
14,
83,
2977,
15211,
92,
14,
8516,
14,
90,
808,
62,
2539,
38362,
9122,
1870,
41603,
378,
7479,
87,
486,
9,
59,
87,
1065,
59,
87,
19881,
59,
87,
486,
59,
77,
59,
87,
1065,
5569,
5841,
1958,
16594,
25166,
59,
87,
1065,
34507,
13297,
13,
14261,
11487,
13,
85,
16,
13,
5569,
5841,
1958,
16594,
25166,
18453,
59,
87,
16,
64,
59,
87,
1558,
13,
13297,
13,
14261,
11487,
13,
85,
16,
13,
25166,
7879,
64,
59,
87,
6469,
59,
24954,
18,
59,
27705,
19,
59,
87,
6052,
59,
87,
2999,
58,
7879,
53,
14,
85,
16,
14,
90,
11487,
62,
3672,
28,
42068,
15211,
14,
89,
1952,
15211,
14,
565,
13654,
15211,
14,
83,
2977,
15211,
92,
14,
8516,
14,
90,
808,
62,
2539,
38362,
961,
5841,
1958,
16594,
7479,
87,
486,
9,
33,
19,
59,
77,
59,
87,
1433,
59,
87,
5066,
296,
13,
13297,
13,
14261,
11487,
13,
85,
16,
33,
59,
87,
1314,
59,
87,
3682,
328,
11487,
31007,
2964,
1462,
47,
59,
87,
486,
59,
87,
3459,
59,
87,
486,
59,
87,
486,
59,
87,
5237,
59,
87,
3312,
1676,
1462,
18,
6,
198,
220,
837,
198,
220,
20086,
41888,
13297,
62,
26518,
62,
15042,
62,
26518,
62,
34574,
602,
834,
40842,
17,
13,
30910,
36584,
32961,
11,
13297,
62,
26518,
62,
14261,
11487,
62,
26518,
62,
85,
16,
62,
26518,
62,
14261,
11487,
834,
7890,
834,
40842,
17,
13,
30910,
36584,
32961,
11,
13297,
62,
26518,
62,
14261,
11487,
62,
26518,
62,
85,
16,
62,
26518,
62,
14261,
11487,
834,
15271,
834,
37348,
1095,
834,
40842,
17,
13,
30910,
36584,
32961,
11,
13297,
62,
26518,
62,
11235,
672,
3046,
62,
26518,
62,
28920,
834,
40842,
17,
13,
30910,
36584,
32961,
11,
12962,
198,
62,
37047,
62,
9945,
13,
38804,
8979,
24564,
1968,
273,
7,
30910,
36584,
32961,
8,
628,
628,
198,
198,
30910,
36584,
32961,
13,
10134,
62,
25811,
796,
6407,
198,
30910,
36584,
32961,
13557,
25811,
796,
4808,
20147,
1968,
273,
13557,
10044,
325,
29046,
7,
20147,
1968,
273,
62,
40842,
17,
13,
8979,
29046,
22784,
275,
6,
59,
77,
59,
45987,
785,
13,
13297,
13,
14261,
11487,
13,
85,
16,
33,
59,
36629,
12804,
11487,
31007,
2964,
1462,
47,
59,
8298,
59,
21536,
59,
8298,
59,
8298,
11537,
198,
11748,
450,
66,
198,
6738,
1036,
14751,
13,
31361,
1330,
25504,
355,
12159,
62,
320,
26908,
602,
198,
6738,
1036,
14751,
13,
11458,
62,
324,
32563,
1330,
25504,
355,
1903,
62,
324,
32563,
62,
320,
26908,
602,
198,
6738,
1036,
14751,
13,
30604,
13,
26591,
1330,
20081,
355,
17130,
62,
315,
2410,
198,
6738,
1036,
14751,
13,
30604,
13,
11321,
1330,
38691,
414,
198,
6738,
1036,
14751,
13,
30604,
13,
3849,
32186,
13,
2550,
1330,
20081,
355,
1986,
62,
315,
2410,
198,
4871,
12556,
2782,
32563,
12804,
11487,
16177,
11838,
16647,
7,
15252,
2599,
198,
220,
37227,
27,
20797,
502,
287,
1568,
0,
29,
37811,
198,
220,
11593,
4164,
330,
31172,
834,
796,
450,
66,
13,
24694,
48526,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
4871,
12556,
2782,
32563,
12804,
11487,
16177,
10697,
7,
15252,
2599,
198,
220,
37227,
27,
20797,
502,
287,
1568,
0,
29,
37811,
198,
220,
11593,
4164,
330,
31172,
834,
796,
450,
66,
13,
24694,
48526,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
4871,
12556,
2782,
32563,
12804,
11487,
16177,
1273,
549,
7,
15252,
2599,
198,
220,
37227,
27,
20797,
502,
287,
1568,
0,
29,
37811,
198,
220,
11593,
4164,
330,
31172,
834,
796,
450,
66,
13,
24694,
48526,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
4149,
49,
1666,
13,
292,
13361,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
27565,
25166,
40729,
13,
292,
13361,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
13859,
378,
25166,
13,
292,
13361,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
6822,
1870,
41603,
378,
25166,
13,
292,
13361,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
4149,
5841,
1958,
16594,
25166,
13,
292,
13361,
796,
6045,
198,
198,
4871,
17993,
12804,
11487,
16177,
11838,
16647,
7,
15252,
2599,
198,
220,
37227,
27,
20797,
502,
287,
1568,
0,
29,
37811,
198,
220,
11593,
4164,
330,
31172,
834,
796,
450,
66,
13,
24694,
48526,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
198,
4871,
17993,
12804,
11487,
16177,
1273,
549,
7,
15252,
2599,
198,
220,
37227,
464,
7071,
284,
543,
17071,
82,
481,
17216,
526,
15931,
198,
220,
11593,
4164,
330,
31172,
834,
796,
450,
66,
13,
24694,
48526,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
13859,
378,
25166,
13,
37443,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
6822,
1870,
41603,
378,
25166,
13,
37443,
796,
6045,
198,
220,
2488,
39305,
13,
397,
8709,
24396,
198,
220,
4149,
5841,
1958,
16594,
25166,
13,
37443,
796,
6045,
198,
2,
25248,
11235,
420,
62,
28463,
295,
62,
4122,
7,
21412,
62,
29982,
8,
198
] | 2.58804 | 1,806 |
# coding=utf-8
# Copyright Huawei Noah's Ark Lab.
""" Generates model predictions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import sys
import tensorflow as tf
from noahnmt.utils import data_utils
from noahnmt.utils import train_utils
from noahnmt.utils import trainer_lib
from noahnmt.configurable import _deep_merge_dict
from noahnmt.bin import train as nmt_train
from noahnmt.metrics import multi_bleu
from noahnmt.utils import registry
from noahnmt.utils import hook_utils
try:
LOCAL_CACHE_DIR = os.environ['DLS_LOCAL_CACHE_PATH']
import moxing as mox
except KeyError:
tf.logging.info("Local machine mode")
def find_all_checkpoints(model_dir, min_step=0, max_step=0, last_n=0):
""" find all checkpoints within [min_step, max_step]
Return:
list of tuple (step, path)
"""
path_prefix = model_dir
path_suffix = ".index"
if not path_prefix.endswith(os.sep) and tf.gfile.IsDirectory(path_prefix):
path_prefix += os.sep
pattern = path_prefix + "model.ckpt-[0-9]*" + path_suffix
try:
checkpoints = tf.gfile.Glob(pattern)
except tf.errors.NotFoundError:
checkpoints = tf.gfile.Glob(pattern)
if len(checkpoints) < 1:
raise ValueError("Do not find checkpoints!")
checkpoints = [name[:-len(path_suffix)] for name in checkpoints]
checkpoints = [c for c in checkpoints if checkpoint_exists(c)]
# sort according to steps
checkpoints = [(int(name.rsplit("-")[-1]), name) for name in checkpoints]
checkpoints = [(step, name) for step, name in checkpoints if step >= min_step]
if max_step > 0:
checkpoints = [(step, name) for step, name in checkpoints if step <= max_step]
if len(checkpoints) < 1:
raise ValueError("Do not find checkpoints!")
checkpoints = sorted(checkpoints, key=lambda x: x[0])
if last_n > 0 and len(checkpoints) > last_n:
checkpoints = checkpoints[-last_n:]
return checkpoints
| [
2,
19617,
28,
40477,
12,
23,
198,
2,
15069,
43208,
18394,
338,
9128,
3498,
13,
198,
198,
37811,
2980,
689,
2746,
16277,
13,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
28686,
198,
11748,
640,
198,
11748,
25064,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
645,
15386,
16762,
13,
26791,
1330,
1366,
62,
26791,
198,
6738,
645,
15386,
16762,
13,
26791,
1330,
4512,
62,
26791,
198,
6738,
645,
15386,
16762,
13,
26791,
1330,
21997,
62,
8019,
198,
6738,
645,
15386,
16762,
13,
11250,
11970,
1330,
4808,
22089,
62,
647,
469,
62,
11600,
198,
6738,
645,
15386,
16762,
13,
8800,
1330,
4512,
355,
299,
16762,
62,
27432,
198,
6738,
645,
15386,
16762,
13,
4164,
10466,
1330,
5021,
62,
903,
84,
198,
6738,
645,
15386,
16762,
13,
26791,
1330,
20478,
198,
6738,
645,
15386,
16762,
13,
26791,
1330,
8011,
62,
26791,
198,
198,
28311,
25,
198,
220,
37347,
1847,
62,
34,
2246,
13909,
62,
34720,
796,
28686,
13,
268,
2268,
17816,
35,
6561,
62,
29701,
1847,
62,
34,
2246,
13909,
62,
34219,
20520,
198,
220,
1330,
285,
1140,
278,
355,
285,
1140,
198,
16341,
7383,
12331,
25,
198,
220,
48700,
13,
6404,
2667,
13,
10951,
7203,
14565,
4572,
4235,
4943,
628,
198,
4299,
1064,
62,
439,
62,
9122,
13033,
7,
19849,
62,
15908,
11,
949,
62,
9662,
28,
15,
11,
3509,
62,
9662,
28,
15,
11,
938,
62,
77,
28,
15,
2599,
198,
220,
37227,
1064,
477,
36628,
1626,
685,
1084,
62,
9662,
11,
3509,
62,
9662,
60,
628,
220,
8229,
25,
198,
220,
220,
220,
1351,
286,
46545,
357,
9662,
11,
3108,
8,
198,
220,
37227,
198,
220,
3108,
62,
40290,
796,
2746,
62,
15908,
198,
220,
3108,
62,
37333,
844,
796,
27071,
9630,
1,
198,
220,
611,
407,
3108,
62,
40290,
13,
437,
2032,
342,
7,
418,
13,
325,
79,
8,
290,
48700,
13,
70,
7753,
13,
3792,
43055,
7,
6978,
62,
40290,
2599,
198,
220,
220,
220,
3108,
62,
40290,
15853,
28686,
13,
325,
79,
198,
220,
3912,
796,
3108,
62,
40290,
1343,
366,
19849,
13,
694,
457,
49146,
15,
12,
24,
60,
9,
1,
1343,
3108,
62,
37333,
844,
628,
220,
1949,
25,
198,
220,
220,
220,
36628,
796,
48700,
13,
70,
7753,
13,
9861,
672,
7,
33279,
8,
198,
220,
2845,
48700,
13,
48277,
13,
3673,
21077,
12331,
25,
198,
220,
220,
220,
36628,
796,
48700,
13,
70,
7753,
13,
9861,
672,
7,
33279,
8,
628,
220,
611,
18896,
7,
9122,
13033,
8,
1279,
352,
25,
198,
220,
220,
220,
5298,
11052,
12331,
7203,
5211,
407,
1064,
36628,
2474,
8,
628,
220,
36628,
796,
685,
3672,
58,
21912,
11925,
7,
6978,
62,
37333,
844,
15437,
329,
1438,
287,
36628,
60,
198,
220,
36628,
796,
685,
66,
329,
269,
287,
36628,
611,
26954,
62,
1069,
1023,
7,
66,
15437,
198,
220,
1303,
3297,
1864,
284,
4831,
198,
220,
36628,
796,
47527,
600,
7,
3672,
13,
3808,
489,
270,
7203,
12,
4943,
58,
12,
16,
46570,
1438,
8,
329,
1438,
287,
36628,
60,
198,
220,
36628,
796,
47527,
9662,
11,
1438,
8,
329,
2239,
11,
1438,
287,
36628,
611,
2239,
18189,
949,
62,
9662,
60,
198,
220,
611,
3509,
62,
9662,
1875,
657,
25,
198,
220,
220,
220,
36628,
796,
47527,
9662,
11,
1438,
8,
329,
2239,
11,
1438,
287,
36628,
611,
2239,
19841,
3509,
62,
9662,
60,
198,
220,
611,
18896,
7,
9122,
13033,
8,
1279,
352,
25,
198,
220,
220,
220,
5298,
11052,
12331,
7203,
5211,
407,
1064,
36628,
2474,
8,
628,
220,
36628,
796,
23243,
7,
9122,
13033,
11,
1994,
28,
50033,
2124,
25,
2124,
58,
15,
12962,
198,
220,
611,
938,
62,
77,
1875,
657,
290,
18896,
7,
9122,
13033,
8,
1875,
938,
62,
77,
25,
198,
220,
220,
220,
36628,
796,
36628,
58,
12,
12957,
62,
77,
47715,
628,
220,
1441,
36628,
628,
628,
198
] | 2.99848 | 658 |
from __future__ import absolute_import
import scipy.stats
import autograd.numpy as np
from autograd.numpy.numpy_vjps import unbroadcast_f
from autograd.extend import primitive, defvjp
pdf = primitive(scipy.stats.multivariate_normal.pdf)
logpdf = primitive(scipy.stats.multivariate_normal.logpdf)
entropy = primitive(scipy.stats.multivariate_normal.entropy)
# With thanks to Eric Bresch.
# Some formulas are from
# "An extended collection of matrix derivative results
# for forward and reverse mode algorithmic differentiation"
# by Mike Giles
# https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf
defvjp(logpdf,
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(x, lambda g: -np.expand_dims(g, 1) * solve(allow_singular)(cov, (x - mean).T).T),
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(mean, lambda g: np.expand_dims(g, 1) * solve(allow_singular)(cov, (x - mean).T).T),
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(cov, lambda g: np.reshape(g, np.shape(g) + (1, 1)) * covgrad(x, mean, cov, allow_singular)))
# Same as log pdf, but multiplied by the pdf (ans).
defvjp(pdf,
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(x, lambda g: -np.expand_dims(ans * g, 1) * solve(allow_singular)(cov, (x - mean).T).T),
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(mean, lambda g: np.expand_dims(ans * g, 1) * solve(allow_singular)(cov, (x - mean).T).T),
lambda ans, x, mean, cov, allow_singular=False:
unbroadcast_f(cov, lambda g: np.reshape(ans * g, np.shape(g) + (1, 1)) * covgrad(x, mean, cov, allow_singular)))
defvjp(entropy, None,
lambda ans, mean, cov:
unbroadcast_f(cov, lambda g: 0.5 * g * np.linalg.inv(cov).T))
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
11748,
629,
541,
88,
13,
34242,
198,
198,
11748,
1960,
519,
6335,
13,
77,
32152,
355,
45941,
198,
6738,
1960,
519,
6335,
13,
77,
32152,
13,
77,
32152,
62,
85,
73,
862,
1330,
22619,
6344,
2701,
62,
69,
198,
6738,
1960,
519,
6335,
13,
2302,
437,
1330,
20049,
11,
825,
85,
34523,
628,
198,
12315,
220,
220,
220,
796,
220,
20049,
7,
1416,
541,
88,
13,
34242,
13,
16680,
42524,
62,
11265,
13,
12315,
8,
198,
6404,
12315,
796,
220,
20049,
7,
1416,
541,
88,
13,
34242,
13,
16680,
42524,
62,
11265,
13,
6404,
12315,
8,
198,
298,
28338,
796,
20049,
7,
1416,
541,
88,
13,
34242,
13,
16680,
42524,
62,
11265,
13,
298,
28338,
8,
198,
198,
2,
2080,
5176,
284,
7651,
347,
411,
354,
13,
198,
2,
2773,
32126,
389,
422,
198,
2,
366,
2025,
7083,
4947,
286,
17593,
27255,
2482,
198,
2,
220,
329,
2651,
290,
9575,
4235,
8385,
9383,
32488,
1,
198,
2,
416,
4995,
37538,
198,
2,
3740,
1378,
15332,
13,
11018,
82,
13,
1140,
13,
330,
13,
2724,
14,
70,
2915,
76,
14,
16624,
14,
4535,
12,
2919,
12,
486,
13,
12315,
198,
198,
4299,
85,
34523,
7,
6404,
12315,
11,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
87,
11,
37456,
308,
25,
532,
37659,
13,
11201,
392,
62,
67,
12078,
7,
70,
11,
352,
8,
1635,
8494,
7,
12154,
62,
12215,
934,
5769,
66,
709,
11,
357,
87,
532,
1612,
737,
51,
737,
51,
828,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
32604,
11,
37456,
308,
25,
220,
45941,
13,
11201,
392,
62,
67,
12078,
7,
70,
11,
352,
8,
1635,
8494,
7,
12154,
62,
12215,
934,
5769,
66,
709,
11,
357,
87,
532,
1612,
737,
51,
737,
51,
828,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
66,
709,
11,
37456,
308,
25,
45941,
13,
3447,
1758,
7,
70,
11,
45941,
13,
43358,
7,
70,
8,
1343,
357,
16,
11,
352,
4008,
1635,
39849,
9744,
7,
87,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
22305,
198,
198,
2,
16766,
355,
2604,
37124,
11,
475,
33096,
416,
262,
37124,
357,
504,
737,
198,
4299,
85,
34523,
7,
12315,
11,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
87,
11,
37456,
308,
25,
532,
37659,
13,
11201,
392,
62,
67,
12078,
7,
504,
1635,
308,
11,
352,
8,
1635,
8494,
7,
12154,
62,
12215,
934,
5769,
66,
709,
11,
357,
87,
532,
1612,
737,
51,
737,
51,
828,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
32604,
11,
37456,
308,
25,
220,
45941,
13,
11201,
392,
62,
67,
12078,
7,
504,
1635,
308,
11,
352,
8,
1635,
8494,
7,
12154,
62,
12215,
934,
5769,
66,
709,
11,
357,
87,
532,
1612,
737,
51,
737,
51,
828,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
2124,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
28,
25101,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
66,
709,
11,
37456,
308,
25,
45941,
13,
3447,
1758,
7,
504,
1635,
308,
11,
45941,
13,
43358,
7,
70,
8,
1343,
357,
16,
11,
352,
4008,
1635,
39849,
9744,
7,
87,
11,
1612,
11,
39849,
11,
1249,
62,
12215,
934,
22305,
198,
198,
4299,
85,
34523,
7,
298,
28338,
11,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
37456,
9093,
11,
1612,
11,
39849,
25,
198,
220,
220,
220,
220,
220,
220,
22619,
6344,
2701,
62,
69,
7,
66,
709,
11,
37456,
308,
25,
657,
13,
20,
1635,
308,
1635,
45941,
13,
75,
1292,
70,
13,
16340,
7,
66,
709,
737,
51,
4008,
198
] | 2.420348 | 747 |
"""
============================
Author:柠檬班-木森
Time:2021/5/13 20:52
E-mail:[email protected]
Company:湖南零檬信息技术有限公司
=======
""" | [
37811,
198,
4770,
25609,
198,
13838,
25,
162,
253,
254,
162,
103,
105,
163,
237,
255,
12,
17312,
101,
162,
96,
106,
198,
7575,
25,
1238,
2481,
14,
20,
14,
1485,
1160,
25,
4309,
198,
36,
12,
4529,
25,
33916,
4869,
24991,
2078,
31,
38227,
13,
785,
198,
39154,
25,
162,
117,
244,
39355,
245,
37239,
35050,
103,
105,
46479,
94,
162,
223,
107,
162,
232,
222,
17312,
107,
17312,
231,
165,
247,
238,
17739,
105,
20998,
116,
198,
1421,
18604,
198,
37811
] | 1.506024 | 83 |
#Ask the user for a number and determine whether the number is prime or not.
# (For those who have forgotten, a prime number is a number that has no divisors.).
# You can (and should!) use your answer to Exercise 4 to help you. Take this
# opportunity to practice using functions, described below.
userNumber = int(input("Give me a number: "))
if howManyDivisors(userNumber) == 2:
print("{0} is prime!".format(userNumber))
else:
print("{0} is not prime!".format(userNumber)) | [
2,
25214,
262,
2836,
329,
257,
1271,
290,
5004,
1771,
262,
1271,
318,
6994,
393,
407,
13,
220,
198,
2,
357,
1890,
883,
508,
423,
11564,
11,
257,
6994,
1271,
318,
257,
1271,
326,
468,
645,
2659,
271,
669,
15729,
220,
198,
2,
921,
460,
357,
392,
815,
8133,
779,
534,
3280,
284,
32900,
604,
284,
1037,
345,
13,
7214,
428,
220,
198,
2,
3663,
284,
3357,
1262,
5499,
11,
3417,
2174,
13,
198,
198,
7220,
15057,
796,
493,
7,
15414,
7203,
23318,
502,
257,
1271,
25,
366,
4008,
198,
198,
361,
703,
7085,
24095,
271,
669,
7,
7220,
15057,
8,
6624,
362,
25,
198,
220,
220,
220,
3601,
7203,
90,
15,
92,
318,
6994,
48220,
18982,
7,
7220,
15057,
4008,
198,
17772,
25,
198,
220,
220,
220,
3601,
7203,
90,
15,
92,
318,
407,
6994,
48220,
18982,
7,
7220,
15057,
4008
] | 3.429577 | 142 |
# -*- coding: utf-8 -*-
from django import forms
from django.test import TestCase
from django.utils.encoding import force_text
from sortedm2m.forms import SortedMultipleChoiceField
from .models import Book, MessyStore, Shelf
# regression test
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
42625,
14208,
1330,
5107,
198,
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
42625,
14208,
13,
26791,
13,
12685,
7656,
1330,
2700,
62,
5239,
198,
6738,
23243,
76,
17,
76,
13,
23914,
1330,
311,
9741,
31217,
46770,
15878,
198,
198,
6738,
764,
27530,
1330,
4897,
11,
10626,
88,
22658,
11,
1375,
1652,
628,
628,
198,
220,
220,
220,
1303,
20683,
1332,
198
] | 3.189873 | 79 |
import fire
from __PACKAGE_NAME__ import ioc
from appdirs import user_config_dir
from pathlib import Path
if __name__ == "__main__":
test()
| [
11748,
2046,
198,
6738,
11593,
47,
8120,
11879,
62,
20608,
834,
1330,
1312,
420,
198,
6738,
598,
15908,
82,
1330,
2836,
62,
11250,
62,
15908,
198,
6738,
3108,
8019,
1330,
10644,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1332,
3419,
198
] | 2.901961 | 51 |
#!/usr/bin/env python3
from aoc_utils import get_input_path, print_elapsed_time
from math import ceil, floor
import re
from timeit import default_timer as timer
from typing import List
RE_LAST_NUMBER = re.compile(r"(\d+)(?!.*\d)")
RE_NUMBER = re.compile(r"\d+")
RE_PAIR = re.compile(r"\[\d+,\d+\]")
RE_NUMBER_GT_10 = re.compile(r"[\d]{2,}")
SnailfishNumber = str
def add_without_reduce(a: SnailfishNumber, b: SnailfishNumber) -> SnailfishNumber:
"""Add the two snailfish numbers` a and b without reducing them"""
return "[" + a + "," + b + "]"
def insert(s: str, startpos: int, endpos: int, value: str) -> str:
"""Insert `value` into string `s` at the specified position"""
return s[:startpos] + value + s[endpos:]
def explode(number: SnailfishNumber) -> SnailfishNumber:
"""Perform a single explode operation on the given snailfish `number`"""
level = 0
for idx, char in enumerate(number):
if char == "[":
level += 1
elif char == "]":
level -= 1
if level == 5:
pair_match = RE_PAIR.search(number, pos=idx)
assert pair_match != None
pair = [*map(int, pair_match.group()[1:-1].split(","))]
number = insert(number, pair_match.start(), pair_match.end(), "0")
left = RE_LAST_NUMBER.search(number, endpos=idx)
right = RE_NUMBER.search(number, pos=idx + 2)
if right != None:
updated_value = int(right.group()) + pair[1]
number = insert(number, right.start(), right.end(), str(updated_value))
if left != None:
updated_value = int(left.group()) + pair[0]
number = insert(number, left.start(), left.end(), str(updated_value))
# Updated the number, break out of the loop
break
return number
def split(number: SnailfishNumber) -> SnailfishNumber:
"""Perform a single split operation on the given snailfish `number`"""
big_value_match = RE_NUMBER_GT_10.search(number)
if big_value_match == None:
return number
value = int(big_value_match.group())
left = floor(value / 2)
right = ceil(value / 2)
new_pair = add_without_reduce(str(left), str(right))
return insert(number, big_value_match.start(), big_value_match.end(), new_pair)
def reduce(number: SnailfishNumber) -> SnailfishNumber:
"""Reduce (explode and split) the given snailfish `number`"""
while True:
updated_number = explode(number)
if updated_number != number:
number = updated_number
continue
updated_number = split(number)
if updated_number != number:
number = updated_number
continue
# Both explore and split did not change the number, so we're finished
return updated_number
def add_numbers(a: SnailfishNumber, b: SnailfishNumber) -> SnailfishNumber:
"""Add the two snailfish numbers `a` and `b`"""
unreduced = add_without_reduce(a, b)
return reduce(unreduced)
def calculate_magnitude(number: SnailfishNumber) -> int:
"""Calculate the magnitude of the given `number`"""
while (pair_match := RE_PAIR.search(number)) != None:
pair = [*map(int, pair_match.group()[1:-1].split(","))]
result = (3 * pair[0]) + (2 * pair[1])
number = insert(number, pair_match.start(), pair_match.end(), str(result))
return int(number)
def calculate_largest_magnitude(numbers: List[SnailfishNumber]) -> int:
"""Calculate the largest magnitude of the sum of any two `numbers`"""
current_max: int = 0
for idx, a in enumerate(numbers):
for b in numbers[idx:]:
current_max = max(current_max, calculate_magnitude(add_numbers(a, b)))
current_max = max(current_max, calculate_magnitude(add_numbers(b, a)))
return current_max
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
6738,
257,
420,
62,
26791,
1330,
651,
62,
15414,
62,
6978,
11,
3601,
62,
417,
28361,
62,
2435,
198,
6738,
10688,
1330,
2906,
346,
11,
4314,
198,
11748,
302,
198,
6738,
640,
270,
1330,
4277,
62,
45016,
355,
19781,
198,
6738,
19720,
1330,
7343,
198,
198,
2200,
62,
43,
11262,
62,
41359,
13246,
796,
302,
13,
5589,
576,
7,
81,
18109,
59,
67,
10,
5769,
12248,
15885,
59,
67,
8,
4943,
198,
2200,
62,
41359,
13246,
796,
302,
13,
5589,
576,
7,
81,
1,
59,
67,
10,
4943,
198,
2200,
62,
4537,
4663,
796,
302,
13,
5589,
576,
7,
81,
1,
59,
58,
59,
67,
28200,
59,
67,
10,
59,
60,
4943,
198,
2200,
62,
41359,
13246,
62,
19555,
62,
940,
796,
302,
13,
5589,
576,
7,
81,
17912,
59,
67,
60,
90,
17,
11,
92,
4943,
198,
198,
16501,
603,
11084,
15057,
796,
965,
628,
198,
4299,
751,
62,
19419,
62,
445,
7234,
7,
64,
25,
5489,
603,
11084,
15057,
11,
275,
25,
5489,
603,
11084,
15057,
8,
4613,
5489,
603,
11084,
15057,
25,
198,
220,
220,
220,
37227,
4550,
262,
734,
47374,
11084,
3146,
63,
257,
290,
275,
1231,
8868,
606,
37811,
198,
220,
220,
220,
1441,
12878,
1,
1343,
257,
1343,
366,
553,
1343,
275,
1343,
366,
30866,
628,
198,
4299,
7550,
7,
82,
25,
965,
11,
923,
1930,
25,
493,
11,
886,
1930,
25,
493,
11,
1988,
25,
965,
8,
4613,
965,
25,
198,
220,
220,
220,
37227,
44402,
4600,
8367,
63,
656,
4731,
4600,
82,
63,
379,
262,
7368,
2292,
37811,
198,
220,
220,
220,
1441,
264,
58,
25,
9688,
1930,
60,
1343,
1988,
1343,
264,
58,
437,
1930,
47715,
628,
198,
4299,
22818,
7,
17618,
25,
5489,
603,
11084,
15057,
8,
4613,
5489,
603,
11084,
15057,
25,
198,
220,
220,
220,
37227,
5990,
687,
257,
2060,
22818,
4905,
319,
262,
1813,
47374,
11084,
4600,
17618,
63,
37811,
198,
220,
220,
220,
1241,
796,
657,
198,
220,
220,
220,
329,
4686,
87,
11,
1149,
287,
27056,
378,
7,
17618,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1149,
6624,
12878,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1149,
6624,
366,
60,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
48185,
352,
628,
220,
220,
220,
220,
220,
220,
220,
611,
1241,
6624,
642,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5166,
62,
15699,
796,
4526,
62,
4537,
4663,
13,
12947,
7,
17618,
11,
1426,
28,
312,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
5166,
62,
15699,
14512,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5166,
796,
30138,
8899,
7,
600,
11,
5166,
62,
15699,
13,
8094,
3419,
58,
16,
21912,
16,
4083,
35312,
7,
2430,
4008,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
7550,
7,
17618,
11,
5166,
62,
15699,
13,
9688,
22784,
5166,
62,
15699,
13,
437,
22784,
366,
15,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1364,
796,
4526,
62,
43,
11262,
62,
41359,
13246,
13,
12947,
7,
17618,
11,
886,
1930,
28,
312,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
826,
796,
4526,
62,
41359,
13246,
13,
12947,
7,
17618,
11,
1426,
28,
312,
87,
1343,
362,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
826,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6153,
62,
8367,
796,
493,
7,
3506,
13,
8094,
28955,
1343,
5166,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
7550,
7,
17618,
11,
826,
13,
9688,
22784,
826,
13,
437,
22784,
965,
7,
43162,
62,
8367,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1364,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6153,
62,
8367,
796,
493,
7,
9464,
13,
8094,
28955,
1343,
5166,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
7550,
7,
17618,
11,
1364,
13,
9688,
22784,
1364,
13,
437,
22784,
965,
7,
43162,
62,
8367,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
19433,
262,
1271,
11,
2270,
503,
286,
262,
9052,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
1441,
1271,
628,
198,
4299,
6626,
7,
17618,
25,
5489,
603,
11084,
15057,
8,
4613,
5489,
603,
11084,
15057,
25,
198,
220,
220,
220,
37227,
5990,
687,
257,
2060,
6626,
4905,
319,
262,
1813,
47374,
11084,
4600,
17618,
63,
37811,
198,
220,
220,
220,
1263,
62,
8367,
62,
15699,
796,
4526,
62,
41359,
13246,
62,
19555,
62,
940,
13,
12947,
7,
17618,
8,
198,
220,
220,
220,
611,
1263,
62,
8367,
62,
15699,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1271,
628,
220,
220,
220,
1988,
796,
493,
7,
14261,
62,
8367,
62,
15699,
13,
8094,
28955,
198,
220,
220,
220,
1364,
796,
4314,
7,
8367,
1220,
362,
8,
198,
220,
220,
220,
826,
796,
2906,
346,
7,
8367,
1220,
362,
8,
198,
220,
220,
220,
649,
62,
24874,
796,
751,
62,
19419,
62,
445,
7234,
7,
2536,
7,
9464,
828,
965,
7,
3506,
4008,
628,
220,
220,
220,
1441,
7550,
7,
17618,
11,
1263,
62,
8367,
62,
15699,
13,
9688,
22784,
1263,
62,
8367,
62,
15699,
13,
437,
22784,
649,
62,
24874,
8,
628,
198,
4299,
4646,
7,
17618,
25,
5489,
603,
11084,
15057,
8,
4613,
5489,
603,
11084,
15057,
25,
198,
220,
220,
220,
37227,
7738,
7234,
357,
20676,
1098,
290,
6626,
8,
262,
1813,
47374,
11084,
4600,
17618,
63,
37811,
198,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6153,
62,
17618,
796,
22818,
7,
17618,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6153,
62,
17618,
14512,
1271,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
6153,
62,
17618,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
6153,
62,
17618,
796,
6626,
7,
17618,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6153,
62,
17618,
14512,
1271,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
6153,
62,
17618,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
5747,
7301,
290,
6626,
750,
407,
1487,
262,
1271,
11,
523,
356,
821,
5201,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6153,
62,
17618,
628,
198,
4299,
751,
62,
77,
17024,
7,
64,
25,
5489,
603,
11084,
15057,
11,
275,
25,
5489,
603,
11084,
15057,
8,
4613,
5489,
603,
11084,
15057,
25,
198,
220,
220,
220,
37227,
4550,
262,
734,
47374,
11084,
3146,
4600,
64,
63,
290,
4600,
65,
63,
37811,
198,
220,
220,
220,
555,
445,
19513,
796,
751,
62,
19419,
62,
445,
7234,
7,
64,
11,
275,
8,
198,
220,
220,
220,
1441,
4646,
7,
403,
445,
19513,
8,
628,
198,
4299,
15284,
62,
76,
4660,
3984,
7,
17618,
25,
5489,
603,
11084,
15057,
8,
4613,
493,
25,
198,
220,
220,
220,
37227,
9771,
3129,
378,
262,
14735,
286,
262,
1813,
4600,
17618,
63,
37811,
198,
220,
220,
220,
981,
357,
24874,
62,
15699,
19039,
4526,
62,
4537,
4663,
13,
12947,
7,
17618,
4008,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5166,
796,
30138,
8899,
7,
600,
11,
5166,
62,
15699,
13,
8094,
3419,
58,
16,
21912,
16,
4083,
35312,
7,
2430,
4008,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
357,
18,
1635,
5166,
58,
15,
12962,
1343,
357,
17,
1635,
5166,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
7550,
7,
17618,
11,
5166,
62,
15699,
13,
9688,
22784,
5166,
62,
15699,
13,
437,
22784,
965,
7,
20274,
4008,
198,
220,
220,
220,
1441,
493,
7,
17618,
8,
628,
198,
4299,
15284,
62,
28209,
62,
76,
4660,
3984,
7,
77,
17024,
25,
7343,
58,
16501,
603,
11084,
15057,
12962,
4613,
493,
25,
198,
220,
220,
220,
37227,
9771,
3129,
378,
262,
4387,
14735,
286,
262,
2160,
286,
597,
734,
4600,
77,
17024,
63,
37811,
198,
220,
220,
220,
1459,
62,
9806,
25,
493,
796,
657,
198,
220,
220,
220,
329,
4686,
87,
11,
257,
287,
27056,
378,
7,
77,
17024,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
329,
275,
287,
3146,
58,
312,
87,
25,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
9806,
796,
3509,
7,
14421,
62,
9806,
11,
15284,
62,
76,
4660,
3984,
7,
2860,
62,
77,
17024,
7,
64,
11,
275,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
9806,
796,
3509,
7,
14421,
62,
9806,
11,
15284,
62,
76,
4660,
3984,
7,
2860,
62,
77,
17024,
7,
65,
11,
257,
22305,
198,
220,
220,
220,
1441,
1459,
62,
9806,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.441469 | 1,606 |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().system('pip install ibm_watson')
# In[2]:
from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
# In[3]:
apikey = '4R5OHrdqVaLXzVXrIVJkYOkUHOzIQb4-GhREAzsm8S5D'
url = 'https://api.au-syd.text-to-speech.watson.cloud.ibm.com/instances/30839c81-94d8-4d7b-900e-d1e51c7ac6c5'
# In[4]:
authenticator = IAMAuthenticator(apikey)
tts = TextToSpeechV1(authenticator=authenticator)
tts.set_service_url(url)
# In[ ]:
# In[18]:
with open('mario.txt', 'r') as f:
text = f.readlines()
# In[19]:
text = [line.replace('\n','') for line in text]
# In[20]:
text = ''.join(str(line) for line in text)
# In[21]:
with open('./marioB.mp3', 'wb') as audio_file:
res = tts.synthesize(mario, accept='audio/mp3', voice='pt-BR_IsabelaV3Voice').get_result()
audio_file.write(res.content)
# In[14]:
import json
voices = tts.list_voices().get_result()
print(json.dumps(voices, indent=2))
# In[24]:
mario = """MÁRIO BROTHERS: O PAI DOS JOGOS ANTIGOS. Mário, o encanador mais famoso do mundo dos games, e seu irmão Luigi, são certamente um dos maores fenômenos da história dos videogames. O objetivo básico do jogo é enfrentar as tartarugas e outras criaturas em inúmeras fases e níveis. A jogabilidade é horizontal e bastante simples."""
# In[25]:
with open('./MarioBRO.mp3', 'wb') as audio_file:
res = tts.synthesize(mario, accept='audio/mp3', voice='pt-BR_IsabelaV3Voice').get_result()
audio_file.write(res.content)
# In[ ]:
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
554,
58,
16,
5974,
628,
198,
1136,
62,
541,
7535,
22446,
10057,
10786,
79,
541,
2721,
24283,
76,
62,
86,
13506,
11537,
628,
198,
2,
554,
58,
17,
5974,
628,
198,
6738,
24283,
76,
62,
86,
13506,
1330,
8255,
2514,
5248,
3055,
53,
16,
198,
6738,
24283,
76,
62,
17721,
62,
21282,
74,
62,
7295,
13,
41299,
44549,
1330,
314,
2390,
47649,
26407,
628,
198,
2,
554,
58,
18,
5974,
628,
198,
499,
522,
88,
796,
705,
19,
49,
20,
12096,
4372,
80,
33906,
43,
55,
89,
53,
55,
81,
3824,
41,
74,
56,
18690,
52,
32298,
89,
33866,
65,
19,
12,
41126,
2200,
26903,
5796,
23,
50,
20,
35,
6,
198,
6371,
796,
705,
5450,
1378,
15042,
13,
559,
12,
1837,
67,
13,
5239,
12,
1462,
12,
45862,
13,
86,
13506,
13,
17721,
13,
571,
76,
13,
785,
14,
8625,
1817,
14,
21495,
2670,
66,
6659,
12,
5824,
67,
23,
12,
19,
67,
22,
65,
12,
12865,
68,
12,
67,
16,
68,
4349,
66,
22,
330,
21,
66,
20,
6,
628,
198,
2,
554,
58,
19,
5974,
628,
198,
41299,
26407,
796,
314,
2390,
47649,
26407,
7,
499,
522,
88,
8,
198,
83,
912,
796,
8255,
2514,
5248,
3055,
53,
16,
7,
41299,
26407,
28,
41299,
26407,
8,
198,
83,
912,
13,
2617,
62,
15271,
62,
6371,
7,
6371,
8,
628,
198,
2,
554,
58,
2361,
25,
628,
628,
198,
198,
2,
554,
58,
1507,
5974,
628,
198,
4480,
1280,
10786,
3876,
952,
13,
14116,
3256,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
2420,
796,
277,
13,
961,
6615,
3419,
628,
198,
2,
554,
58,
1129,
5974,
628,
198,
5239,
796,
685,
1370,
13,
33491,
10786,
59,
77,
3256,
7061,
8,
329,
1627,
287,
2420,
60,
628,
198,
2,
554,
58,
1238,
5974,
628,
198,
5239,
796,
705,
4458,
22179,
7,
2536,
7,
1370,
8,
329,
1627,
287,
2420,
8,
628,
198,
2,
554,
58,
2481,
5974,
628,
198,
4480,
1280,
7,
4458,
14,
3876,
952,
33,
13,
3149,
18,
3256,
705,
39346,
11537,
355,
6597,
62,
7753,
25,
198,
220,
220,
220,
581,
796,
256,
912,
13,
1837,
429,
956,
1096,
7,
3876,
952,
11,
2453,
11639,
24051,
14,
3149,
18,
3256,
3809,
11639,
457,
12,
11473,
62,
3792,
9608,
64,
53,
18,
35708,
27691,
1136,
62,
20274,
3419,
198,
220,
220,
220,
6597,
62,
7753,
13,
13564,
7,
411,
13,
11299,
8,
628,
198,
2,
554,
58,
1415,
5974,
628,
198,
11748,
33918,
198,
13038,
1063,
796,
256,
912,
13,
4868,
62,
13038,
1063,
22446,
1136,
62,
20274,
3419,
198,
4798,
7,
17752,
13,
67,
8142,
7,
13038,
1063,
11,
33793,
28,
17,
4008,
628,
198,
2,
554,
58,
1731,
5974,
628,
198,
3876,
952,
796,
37227,
44,
127,
223,
7112,
46,
11177,
26946,
4877,
25,
440,
8147,
40,
43036,
449,
7730,
2640,
3537,
51,
3528,
2640,
13,
337,
6557,
27250,
11,
267,
2207,
272,
7079,
285,
15152,
1145,
28213,
466,
27943,
78,
23430,
1830,
11,
304,
384,
84,
220,
2533,
28749,
39139,
11,
264,
28749,
5051,
3263,
68,
23781,
23430,
17266,
2850,
277,
268,
27083,
3653,
418,
12379,
1554,
10205,
7496,
23430,
36342,
1047,
13,
440,
26181,
316,
23593,
275,
40138,
3713,
466,
474,
24076,
38251,
551,
69,
1156,
283,
355,
35842,
283,
1018,
292,
304,
503,
8847,
269,
380,
2541,
292,
795,
287,
21356,
647,
292,
277,
1386,
304,
299,
8836,
303,
271,
13,
317,
48342,
14991,
312,
671,
38251,
16021,
304,
19918,
12427,
985,
2374,
526,
15931,
628,
198,
2,
554,
58,
1495,
5974,
628,
198,
4480,
1280,
7,
4458,
14,
42315,
11473,
46,
13,
3149,
18,
3256,
705,
39346,
11537,
355,
6597,
62,
7753,
25,
198,
220,
220,
220,
581,
796,
256,
912,
13,
1837,
429,
956,
1096,
7,
3876,
952,
11,
2453,
11639,
24051,
14,
3149,
18,
3256,
3809,
11639,
457,
12,
11473,
62,
3792,
9608,
64,
53,
18,
35708,
27691,
1136,
62,
20274,
3419,
198,
220,
220,
220,
6597,
62,
7753,
13,
13564,
7,
411,
13,
11299,
8,
628,
198,
2,
554,
58,
2361,
25,
628,
628,
198
] | 2.288824 | 689 |
from pyzil.zilliqa import chain
from flask import Flask, jsonify
import json
app = Flask(__name__)
app.config.from_object(__name__)
@app.route('/addressState/<address>, 'methods=['GET'])
if __name__ == '__main__':
# address = "fe001824823b12b58708bf24edd94d8b5e1cfcf7"
app.run()
| [
6738,
12972,
89,
346,
13,
89,
50173,
20402,
1330,
6333,
198,
6738,
42903,
1330,
46947,
11,
33918,
1958,
198,
11748,
33918,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
1324,
13,
11250,
13,
6738,
62,
15252,
7,
834,
3672,
834,
8,
198,
198,
31,
1324,
13,
38629,
10786,
14,
21975,
9012,
14,
27,
21975,
22330,
705,
24396,
82,
28,
17816,
18851,
6,
12962,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
197,
2,
2209,
796,
366,
5036,
405,
1507,
23045,
1954,
65,
1065,
65,
3365,
32583,
19881,
1731,
6048,
5824,
67,
23,
65,
20,
68,
16,
12993,
12993,
22,
1,
198,
220,
220,
220,
598,
13,
5143,
3419,
198
] | 2.461538 | 117 |
# voor nu: qt of wx
toolkit = 'qt'
| [
2,
410,
2675,
14364,
25,
10662,
83,
286,
266,
87,
198,
25981,
15813,
796,
705,
39568,
6,
198
] | 1.944444 | 18 |
# Generated by Django 3.1.13 on 2021-08-22 17:49
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
1485,
319,
33448,
12,
2919,
12,
1828,
1596,
25,
2920,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.875 | 32 |
"""
Solution to Numbers in Words
Based off this Algorithm: https://stackoverflow.com/a/3299672/7396801
"""
import math
zero_to_nineteen_map = [
'zero', 'one', 'two', 'three', 'four', 'five', 'six',
'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen',
'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'
]
tens_map = [
'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'
]
denom_map = [
'' ,'thousand', 'million', 'billion', 'trillion', 'quadrillion',
'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion',
'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion',
'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion',
]
if __name__ == '__main__':
while True:
number = input('Enter a number: ')
# type checking here
try:
number = int(number)
except ValueError:
number = -1
if number < 0: # corner case
print('Invalid Amount')
exit(0)
english_number = number_to_words(number)
print(english_number + '\n')
| [
37811,
201,
198,
220,
220,
220,
28186,
284,
27797,
287,
23087,
201,
198,
220,
220,
220,
13403,
572,
428,
978,
42289,
25,
3740,
1378,
25558,
2502,
11125,
13,
785,
14,
64,
14,
18,
22579,
43864,
14,
22,
2670,
3104,
486,
201,
198,
37811,
201,
198,
201,
198,
11748,
10688,
201,
198,
201,
198,
22570,
62,
1462,
62,
35073,
34026,
62,
8899,
796,
685,
201,
198,
220,
220,
220,
705,
22570,
3256,
705,
505,
3256,
705,
11545,
3256,
705,
15542,
3256,
705,
14337,
3256,
705,
13261,
3256,
705,
19412,
3256,
201,
198,
220,
220,
220,
705,
26548,
3256,
705,
26022,
3256,
705,
30888,
3256,
705,
1452,
3256,
705,
11129,
574,
3256,
705,
4246,
9954,
3256,
705,
400,
22530,
3256,
201,
198,
220,
220,
220,
705,
14337,
7821,
3256,
705,
32041,
7821,
3256,
705,
19412,
7821,
3256,
705,
325,
1151,
6429,
3256,
705,
26022,
6429,
3256,
705,
35073,
34026,
6,
201,
198,
60,
201,
198,
201,
198,
83,
641,
62,
8899,
796,
685,
201,
198,
220,
220,
220,
705,
4246,
3787,
3256,
705,
400,
5893,
3256,
705,
3319,
88,
3256,
705,
69,
24905,
3256,
705,
82,
19404,
3256,
705,
325,
1151,
88,
3256,
705,
68,
14400,
3256,
705,
35073,
2963,
6,
201,
198,
60,
201,
198,
201,
198,
6559,
296,
62,
8899,
796,
685,
201,
198,
220,
220,
220,
10148,
837,
6,
400,
29910,
3256,
705,
14100,
3256,
705,
24540,
3256,
705,
2213,
1131,
3256,
705,
421,
41909,
1131,
3256,
201,
198,
220,
220,
220,
705,
421,
600,
1131,
3256,
705,
325,
742,
1131,
3256,
705,
325,
457,
1131,
3256,
705,
38441,
1131,
3256,
705,
13159,
1131,
3256,
201,
198,
220,
220,
220,
705,
12501,
1131,
3256,
705,
917,
721,
1131,
3256,
705,
646,
375,
721,
1131,
3256,
705,
83,
445,
721,
1131,
3256,
705,
421,
1078,
84,
585,
721,
1131,
3256,
201,
198,
220,
220,
220,
705,
8044,
12501,
1131,
3256,
705,
325,
457,
437,
721,
1131,
3256,
705,
38441,
375,
721,
1131,
3256,
705,
77,
659,
9132,
721,
1131,
3256,
705,
85,
328,
600,
1131,
3256,
201,
198,
60,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
201,
198,
201,
198,
220,
220,
220,
981,
6407,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
5128,
10786,
17469,
257,
1271,
25,
705,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2099,
10627,
994,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
493,
7,
17618,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
11052,
12331,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
532,
16,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1271,
1279,
657,
25,
1303,
5228,
1339,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
44651,
26308,
11537,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8420,
7,
15,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
46932,
62,
17618,
796,
1271,
62,
1462,
62,
10879,
7,
17618,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
39126,
62,
17618,
1343,
705,
59,
77,
11537,
201,
198
] | 2.194296 | 561 |
"""
Copyright 2020 Expedia, 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
https://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 setuptools import setup, find_packages
import pathlib
import versioneer
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
setup(
name="map_maker",
version=versioneer.get_version(),
packages=find_packages(exclude=["data/", "scripts/"]),
author="Tim Renner",
install_requires=[
"click>=7.0",
"toolz>=0.9",
"bokeh>=1.1.0",
"Shapely>=1.6.4.post2",
"pyproj>=1.9.5.1,<2",
"folium>=0.10.0,<1",
],
entry_points={"console_scripts": ["map_maker=map_maker.cli:cli"]},
cmdclass=versioneer.get_cmdclass(),
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/ExpediaGroup/map-maker",
license="Apache 2.0",
classifiers=[
# From https://pypi.org/classifiers/
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)
| [
37811,
198,
15269,
12131,
5518,
5507,
11,
3457,
13,
198,
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,
628,
220,
220,
220,
3740,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
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,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
198,
11748,
3108,
8019,
198,
11748,
2196,
28153,
198,
198,
39,
9338,
796,
3108,
8019,
13,
15235,
7,
834,
7753,
834,
737,
8000,
198,
15675,
11682,
796,
357,
39,
9338,
1220,
366,
15675,
11682,
13,
9132,
11074,
961,
62,
5239,
3419,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
2625,
8899,
62,
10297,
1600,
198,
220,
220,
220,
2196,
28,
690,
7935,
263,
13,
1136,
62,
9641,
22784,
198,
220,
220,
220,
10392,
28,
19796,
62,
43789,
7,
1069,
9152,
28,
14692,
7890,
14,
1600,
366,
46521,
14,
8973,
828,
198,
220,
220,
220,
1772,
2625,
14967,
7152,
1008,
1600,
198,
220,
220,
220,
2721,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12976,
29,
28,
22,
13,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
25981,
89,
29,
28,
15,
13,
24,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
65,
2088,
71,
29,
28,
16,
13,
16,
13,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
33383,
306,
29,
28,
16,
13,
21,
13,
19,
13,
7353,
17,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9078,
1676,
73,
29,
28,
16,
13,
24,
13,
20,
13,
16,
11,
27,
17,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9062,
1505,
29,
28,
15,
13,
940,
13,
15,
11,
27,
16,
1600,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
5726,
62,
13033,
28,
4895,
41947,
62,
46521,
1298,
14631,
8899,
62,
10297,
28,
8899,
62,
10297,
13,
44506,
25,
44506,
8973,
5512,
198,
220,
220,
220,
23991,
4871,
28,
690,
7935,
263,
13,
1136,
62,
28758,
4871,
22784,
198,
220,
220,
220,
890,
62,
11213,
28,
15675,
11682,
11,
198,
220,
220,
220,
890,
62,
11213,
62,
11299,
62,
4906,
2625,
5239,
14,
4102,
2902,
1600,
198,
220,
220,
220,
19016,
2625,
5450,
1378,
12567,
13,
785,
14,
16870,
5507,
13247,
14,
8899,
12,
10297,
1600,
198,
220,
220,
220,
5964,
2625,
25189,
4891,
362,
13,
15,
1600,
198,
220,
220,
220,
1398,
13350,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3574,
3740,
1378,
79,
4464,
72,
13,
2398,
14,
4871,
13350,
14,
198,
220,
220,
220,
220,
220,
220,
220,
366,
41206,
12678,
7904,
604,
532,
17993,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
34156,
7904,
7294,
40,
20010,
1079,
7904,
24843,
10442,
13789,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
21,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
22,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
23,
1600,
198,
220,
220,
220,
16589,
198,
8,
198
] | 2.652244 | 624 |
""" Simple example set LCD
(c) 2016 EKM Metering.
"""
from ekmmeters import *
#set up port
my_port_name = "/dev/ttyO4"
my_meter_address = "000300001463"
# log to console
ekm_set_log(ekm_print_log)
# init port and create meter
port = SerialPort(my_port_name)
if (port.initPort() == True):
my_meter = V4Meter(my_meter_address)
my_meter.attachPort(port)
else:
print("Cannot open port")
exit()
# Method one: preferred
lcd_items = [LCDItems.RMS_Volts_Ln_1, LCDItems.Line_Freq]
if my_meter.setLCDCmd(lcd_items):
print("Meter should now show Line 1 Volts and Frequency.")
# Method two: parsing strings (use append normally)
lcd_items = [my_meter.lcdString("RMS_Volts_Ln_1"), my_meter.lcdString("Line_Freq")]
if my_meter.setLCDCmd(lcd_items):
print("Meter should now show Line 1 Volts and Frequency.")
port.closePort()
| [
37811,
17427,
1672,
900,
23598,
198,
7,
66,
8,
1584,
412,
42,
44,
3395,
1586,
13,
198,
37811,
198,
6738,
304,
74,
3020,
7307,
1330,
1635,
198,
198,
2,
2617,
510,
2493,
198,
1820,
62,
634,
62,
3672,
796,
12813,
7959,
14,
42852,
46,
19,
1,
198,
1820,
62,
27231,
62,
21975,
796,
366,
830,
18,
2388,
1415,
5066,
1,
198,
2,
2604,
284,
8624,
198,
988,
76,
62,
2617,
62,
6404,
7,
988,
76,
62,
4798,
62,
6404,
8,
198,
198,
2,
2315,
2493,
290,
2251,
16430,
198,
634,
796,
23283,
13924,
7,
1820,
62,
634,
62,
3672,
8,
198,
361,
357,
634,
13,
15003,
13924,
3419,
6624,
6407,
2599,
198,
220,
220,
220,
616,
62,
27231,
796,
569,
19,
44,
2357,
7,
1820,
62,
27231,
62,
21975,
8,
198,
220,
220,
220,
616,
62,
27231,
13,
47348,
13924,
7,
634,
8,
198,
17772,
25,
198,
220,
220,
220,
3601,
7203,
34,
34574,
1280,
2493,
4943,
198,
220,
220,
220,
8420,
3419,
198,
198,
2,
11789,
530,
25,
9871,
198,
75,
10210,
62,
23814,
796,
685,
5639,
35,
23022,
13,
49,
5653,
62,
16598,
912,
62,
43,
77,
62,
16,
11,
23598,
23022,
13,
13949,
62,
20366,
80,
60,
198,
361,
616,
62,
27231,
13,
2617,
5639,
9697,
9132,
7,
75,
10210,
62,
23814,
2599,
198,
220,
220,
220,
3601,
7203,
44,
2357,
815,
783,
905,
6910,
352,
4709,
912,
290,
31902,
19570,
198,
198,
2,
11789,
734,
25,
32096,
13042,
357,
1904,
24443,
7685,
8,
198,
75,
10210,
62,
23814,
796,
685,
1820,
62,
27231,
13,
75,
10210,
10100,
7203,
49,
5653,
62,
16598,
912,
62,
43,
77,
62,
16,
12340,
616,
62,
27231,
13,
75,
10210,
10100,
7203,
13949,
62,
20366,
80,
4943,
60,
198,
361,
616,
62,
27231,
13,
2617,
5639,
9697,
9132,
7,
75,
10210,
62,
23814,
2599,
198,
220,
220,
220,
3601,
7203,
44,
2357,
815,
783,
905,
6910,
352,
4709,
912,
290,
31902,
19570,
198,
198,
634,
13,
19836,
13924,
3419,
198
] | 2.553191 | 329 |
import numpy as np
import tensorflow as tf
from source.model import Model
from source.model_lidar import ModelLiDAR
import utils
from utils import get_normal_map
| [
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
6738,
2723,
13,
19849,
1330,
9104,
198,
6738,
2723,
13,
19849,
62,
75,
312,
283,
1330,
9104,
32304,
35,
1503,
198,
11748,
3384,
4487,
198,
6738,
3384,
4487,
1330,
651,
62,
11265,
62,
8899,
198
] | 3.375 | 48 |
import numpy as np
import gzip
import cPickle as pickle
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import scipy.ndimage.interpolation as scipint
import sys
sys.path.insert(0, '../mlp_test')
from data_utils import load_mnist
data_set = load_mnist()[0]
index_1 = 4
rotangle = 30
img_arr_1 = data_set[0][index_1].reshape((28, 28))
img_val_1 = data_set[1][index_1]
rotArr = scipint.rotate(img_arr_1, rotangle, order=0, reshape = False)
plt.subplot(1, 2, 1)
plt.title(str(img_val_1))
fig = plt.imshow(img_arr_1, cmap=cm.binary)
fig.axes.get_xaxis().set_ticks([])
fig.axes.get_yaxis().set_ticks([])
plt.subplot(1, 2, 2)
plt.title("Rotated scipy")
fig = plt.imshow(rotArr, cmap=cm.binary)
fig.axes.get_xaxis().set_ticks([])
fig.axes.get_yaxis().set_ticks([])
plt.show()
| [
11748,
299,
32152,
355,
45941,
198,
11748,
308,
13344,
198,
11748,
269,
31686,
293,
355,
2298,
293,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
2603,
29487,
8019,
13,
11215,
355,
12067,
198,
11748,
629,
541,
88,
13,
358,
9060,
13,
3849,
16104,
341,
355,
629,
541,
600,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
705,
40720,
4029,
79,
62,
9288,
11537,
198,
6738,
220,
1366,
62,
26791,
1330,
3440,
62,
10295,
396,
198,
198,
7890,
62,
2617,
796,
3440,
62,
10295,
396,
3419,
58,
15,
60,
628,
198,
9630,
62,
16,
796,
604,
198,
10599,
9248,
796,
1542,
198,
198,
9600,
62,
3258,
62,
16,
796,
1366,
62,
2617,
58,
15,
7131,
9630,
62,
16,
4083,
3447,
1758,
19510,
2078,
11,
2579,
4008,
198,
9600,
62,
2100,
62,
16,
796,
1366,
62,
2617,
58,
16,
7131,
9630,
62,
16,
60,
198,
198,
10599,
3163,
81,
796,
629,
541,
600,
13,
10599,
378,
7,
9600,
62,
3258,
62,
16,
11,
5724,
9248,
11,
1502,
28,
15,
11,
27179,
1758,
796,
10352,
8,
628,
198,
489,
83,
13,
7266,
29487,
7,
16,
11,
362,
11,
352,
8,
198,
489,
83,
13,
7839,
7,
2536,
7,
9600,
62,
2100,
62,
16,
4008,
198,
5647,
796,
458,
83,
13,
320,
12860,
7,
9600,
62,
3258,
62,
16,
11,
269,
8899,
28,
11215,
13,
39491,
8,
198,
5647,
13,
897,
274,
13,
1136,
62,
87,
22704,
22446,
2617,
62,
83,
3378,
26933,
12962,
198,
5647,
13,
897,
274,
13,
1136,
62,
88,
22704,
22446,
2617,
62,
83,
3378,
26933,
12962,
628,
198,
489,
83,
13,
7266,
29487,
7,
16,
11,
362,
11,
362,
8,
198,
489,
83,
13,
7839,
7203,
24864,
515,
629,
541,
88,
4943,
198,
5647,
796,
458,
83,
13,
320,
12860,
7,
10599,
3163,
81,
11,
269,
8899,
28,
11215,
13,
39491,
8,
198,
5647,
13,
897,
274,
13,
1136,
62,
87,
22704,
22446,
2617,
62,
83,
3378,
26933,
12962,
198,
5647,
13,
897,
274,
13,
1136,
62,
88,
22704,
22446,
2617,
62,
83,
3378,
26933,
12962,
198,
198,
489,
83,
13,
12860,
3419,
628
] | 2.234463 | 354 |
# Next Token Prediction with Transformers
# =======================================
# https://pytorch.org/tutorials/beginner/transformer_tutorial.html
#
# Purpose: Train the transformer model described in "Attention Is All You Need"
# (https://arxiv.org/pdf/1706.03762.pdf) on a language modeling task to predict
# the next token in a sequence.
#
# Model:
# - Embeddings are generated for each token in the a sequence
# - Positional encodings are added to the token embeddings
# - Square attention mask only allows tokens to see previous positions
# - Embeddings and attention mask are passed through Transformer encoder layers
# - Linear layer predicts the next token
# Modules
import math
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import TransformerEncoder, TransformerEncoderLayer
import torchtext
from torchtext.data.utils import get_tokenizer
# Parameters
batch_train = 20
batch_evaluate = 10
chunks = 35
dropout = 0.2
epochs = 3
token_embedding = 200
transformer_heads = 2
transformer_dimensions = 200
transformer_layers = 2
class TransformerModel(nn.Module):
"""Transformer model based on https://arxiv.org/pdf/1706.03762.pdf"""
def __init__(self, vocabulary, token_embedding, transformer_heads,
transformer_dimensions, transformer_layers, dropout=0.5):
"""Initialize transformer model
Arguments:
vocabulary {int} -- Size of the token vocabulary
token_embedding {int} -- Size of token embedding
transformer_heads {int} -- Number of transformer encoder attention heads
transformer_dimensions {int} -- Dimension of transformer encoder feedforward network
transformer_layers {int} -- Number of transformer encoder layers
Keyword Arguments:
dropout {float} -- Dropout rate (default: {0.5})
"""
super(TransformerModel, self).__init__()
self.token_embedding = token_embedding
# Embedding and positional encoding of tokens
self.embedder = nn.Embedding(vocabulary, token_embedding)
self.positional_encoder = PositionalEncoding(token_embedding, dropout)
# Transformer encoder layers
transformer_layer = TransformerEncoderLayer(token_embedding, transformer_heads,
transformer_dimensions, dropout)
self.transformer_encoder = TransformerEncoder(transformer_layer, transformer_layers)
# Linear layer for predicting next token
self.linear = nn.Linear(token_embedding, vocabulary)
# Initialize weights
self.init_weights()
class PositionalEncoding(nn.Module):
"""Add sinusoidal positional information about the tokens"""
def batch_text(text, batches):
"""Truncate text to a multiple of batches and reshape into batched tensor
Arguments:
text {generator} -- Text generator
batches {int} -- Token batch size
Returns:
tensor -- Text reshaped into rectangular tensor
"""
text = wiki_text.numericalize([text.examples[0].text])
text = text.narrow(0, 0, (text.size(0) // batches) * batches)
return text.view(batches, -1).t().contiguous()
def get_batch(text, batch):
"""Generate input and target sequence for batch
Arguments:
text {tensor} -- Text tensor
batch {[type]} -- Batch number to call
Returns:
tuple -- Data and target tensors
"""
length = min(chunks, len(text) - 1 - batch)
data = text[batch:batch+length]
target = text[batch+1:batch+1+length].view(-1)
return data, target
# Use GPU if available
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Import Wikitext-2 dataset
wiki_text = torchtext.data.Field(tokenize=get_tokenizer('basic_english'),
init_token='<sos>', eos_token='<eos>', lower=True)
train_txt, validation_txt, test_txt = torchtext.datasets.WikiText2.splits(wiki_text)
wiki_text.build_vocab(train_txt)
# Batch Wikitext-2 for training and evaluation
train_data = batch_text(train_txt, batch_train).to(device)
validation_data = batch_text(validation_txt, batch_evaluate).to(device)
test_data = batch_text(test_txt, batch_evaluate).to(device)
# Instantiate model
vocabulary = len(wiki_text.vocab.stoi)
model = TransformerModel(vocabulary, token_embedding, transformer_heads,
transformer_dimensions, transformer_layers, dropout).to(device)
# Set criterion and optimizer for learning
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.parameters(), lr=5.0)
# Adjust learning rate through epochs
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, 1.0, gamma=0.95)
def train():
"""Train model"""
model.train()
total_loss = 0.
start_time = time.time()
for batch, i in enumerate(range(0, train_data.size(0) - 1, chunks)):
data, targets = get_batch(train_data, i)
optimizer.zero_grad()
output = model(data)
loss = criterion(output.view(-1, vocabulary), targets)
loss.backward()
torch.nn.utils.clip_grad_norm_(model.parameters(), 0.5)
optimizer.step()
total_loss += loss.item()
log_interval = 200
if batch % log_interval == 0 and batch > 0:
cur_loss = total_loss / log_interval
elapsed_time = time.time() - start_time
print(f'| epoch {epoch:3d} | {batch:5d}/{len(train_data) // chunks:5d} batches | lr '
f'{scheduler.get_lr()[0]:02.2f} | {elapsed_time * 1000 / log_interval:5.2f}'
f' ms/batch | loss {cur_loss:5.2f} | ppl {math.exp(cur_loss):8.2f}')
total_loss = 0
start_time = time.time()
def evaluate(model, validation_data):
"""Evaluate model"""
model.eval()
total_loss = 0.
with torch.no_grad():
for i in range(0, validation_data.size(0) - 1, chunks):
data, targets = get_batch(validation_data, i)
output = model(data)
output_flat = output.view(-1, vocabulary)
total_loss += len(data) * criterion(output_flat, targets).item()
return total_loss / (len(validation_data) - 1)
# Train over multiple epochs
best_model = None
best_validation_loss = float('inf')
for epoch in range(1, epochs + 1):
epoch_start_time = time.time()
train()
val_loss = evaluate(model, validation_data)
print('-' * 89)
print(f'| end of epoch {epoch:3d} | time: {time.time() - epoch_start_time:5.2f}s | '
f'valid loss {val_loss:5.2f} | valid ppl {math.exp(val_loss):8.2f}')
print('-' * 89)
# Save model if best validation loss observed thus far
if val_loss < best_validation_loss:
best_validation_loss = val_loss
best_model = model
# Adjust learning rate
scheduler.step()
# Evaluate the model on the test dataset
test_loss = evaluate(best_model, test_data)
print('=' * 89)
print(f'| End of training | test loss {test_loss:5.2f} | test ppl {math.exp(test_loss):8.2f}')
print('=' * 89) | [
2,
7406,
29130,
46690,
351,
39185,
198,
2,
46111,
50155,
198,
2,
3740,
1378,
9078,
13165,
354,
13,
2398,
14,
83,
44917,
82,
14,
27471,
1008,
14,
7645,
16354,
62,
83,
44917,
13,
6494,
198,
2,
220,
198,
2,
32039,
25,
16835,
262,
47385,
2746,
3417,
287,
366,
8086,
1463,
1148,
1439,
921,
10664,
1,
198,
2,
357,
5450,
1378,
283,
87,
452,
13,
2398,
14,
12315,
14,
1558,
3312,
13,
15,
2718,
5237,
13,
12315,
8,
319,
257,
3303,
21128,
4876,
284,
4331,
198,
2,
262,
1306,
11241,
287,
257,
8379,
13,
198,
2,
198,
2,
9104,
25,
198,
2,
532,
13302,
6048,
654,
389,
7560,
329,
1123,
11241,
287,
262,
257,
8379,
198,
2,
532,
18574,
1859,
2207,
375,
654,
389,
2087,
284,
262,
11241,
11525,
67,
654,
198,
2,
532,
9276,
3241,
9335,
691,
3578,
16326,
284,
766,
2180,
6116,
198,
2,
532,
13302,
6048,
654,
290,
3241,
9335,
389,
3804,
832,
3602,
16354,
2207,
12342,
11685,
198,
2,
532,
44800,
7679,
26334,
262,
1306,
11241,
198,
198,
2,
3401,
5028,
198,
11748,
10688,
198,
11748,
640,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
6738,
28034,
13,
20471,
1330,
3602,
16354,
27195,
12342,
11,
3602,
16354,
27195,
12342,
49925,
198,
11748,
28034,
5239,
198,
6738,
28034,
5239,
13,
7890,
13,
26791,
1330,
651,
62,
30001,
7509,
198,
198,
2,
40117,
198,
43501,
62,
27432,
796,
1160,
198,
43501,
62,
49786,
796,
838,
198,
354,
14125,
796,
3439,
198,
14781,
448,
796,
657,
13,
17,
198,
538,
5374,
82,
796,
513,
198,
30001,
62,
20521,
12083,
796,
939,
198,
7645,
16354,
62,
16600,
796,
362,
198,
7645,
16354,
62,
27740,
5736,
796,
939,
198,
7645,
16354,
62,
75,
6962,
796,
362,
628,
198,
4871,
3602,
16354,
17633,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
8291,
16354,
2746,
1912,
319,
3740,
1378,
283,
87,
452,
13,
2398,
14,
12315,
14,
1558,
3312,
13,
15,
2718,
5237,
13,
12315,
37811,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
25818,
11,
11241,
62,
20521,
12083,
11,
47385,
62,
16600,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47385,
62,
27740,
5736,
11,
47385,
62,
75,
6962,
11,
4268,
448,
28,
15,
13,
20,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
47385,
2746,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25818,
1391,
600,
92,
1377,
12849,
286,
262,
11241,
25818,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11241,
62,
20521,
12083,
1391,
600,
92,
1377,
12849,
286,
11241,
11525,
12083,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47385,
62,
16600,
1391,
600,
92,
1377,
7913,
286,
47385,
2207,
12342,
3241,
6665,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47385,
62,
27740,
5736,
1391,
600,
92,
1377,
34024,
286,
47385,
2207,
12342,
3745,
11813,
3127,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47385,
62,
75,
6962,
1391,
600,
92,
1377,
7913,
286,
47385,
2207,
12342,
11685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
7383,
4775,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4268,
448,
1391,
22468,
92,
1377,
14258,
448,
2494,
357,
12286,
25,
1391,
15,
13,
20,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
8291,
16354,
17633,
11,
2116,
737,
834,
15003,
834,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
62,
20521,
12083,
796,
11241,
62,
20521,
12083,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13302,
6048,
278,
290,
45203,
21004,
286,
16326,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20521,
1082,
796,
299,
77,
13,
31567,
6048,
278,
7,
18893,
22528,
11,
11241,
62,
20521,
12083,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1930,
1859,
62,
12685,
12342,
796,
18574,
1859,
27195,
7656,
7,
30001,
62,
20521,
12083,
11,
4268,
448,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
3602,
16354,
2207,
12342,
11685,
198,
220,
220,
220,
220,
220,
220,
220,
47385,
62,
29289,
796,
3602,
16354,
27195,
12342,
49925,
7,
30001,
62,
20521,
12083,
11,
47385,
62,
16600,
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,
47385,
62,
27740,
5736,
11,
4268,
448,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7645,
16354,
62,
12685,
12342,
796,
3602,
16354,
27195,
12342,
7,
7645,
16354,
62,
29289,
11,
47385,
62,
75,
6962,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
44800,
7679,
329,
25539,
1306,
11241,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29127,
796,
299,
77,
13,
14993,
451,
7,
30001,
62,
20521,
12083,
11,
25818,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
20768,
1096,
19590,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15003,
62,
43775,
3419,
628,
198,
4871,
18574,
1859,
27195,
7656,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
4550,
7813,
385,
47502,
45203,
1321,
546,
262,
16326,
37811,
628,
198,
4299,
15458,
62,
5239,
7,
5239,
11,
37830,
2599,
198,
220,
220,
220,
37227,
2898,
19524,
378,
2420,
284,
257,
3294,
286,
37830,
290,
27179,
1758,
656,
7365,
1740,
11192,
273,
198,
220,
220,
220,
220,
198,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
1391,
8612,
1352,
92,
1377,
8255,
17301,
198,
220,
220,
220,
220,
220,
220,
220,
37830,
1391,
600,
92,
1377,
29130,
15458,
2546,
198,
220,
220,
220,
220,
198,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
11192,
273,
1377,
8255,
27179,
5813,
656,
36954,
11192,
273,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2420,
796,
22719,
62,
5239,
13,
77,
6975,
605,
1096,
26933,
5239,
13,
1069,
12629,
58,
15,
4083,
5239,
12962,
198,
220,
220,
220,
2420,
796,
2420,
13,
77,
6018,
7,
15,
11,
657,
11,
357,
5239,
13,
7857,
7,
15,
8,
3373,
37830,
8,
1635,
37830,
8,
198,
220,
220,
220,
1441,
2420,
13,
1177,
7,
8664,
2052,
11,
532,
16,
737,
83,
22446,
3642,
29709,
3419,
198,
198,
4299,
651,
62,
43501,
7,
5239,
11,
15458,
2599,
198,
220,
220,
220,
37227,
8645,
378,
5128,
290,
2496,
8379,
329,
15458,
198,
220,
220,
220,
220,
198,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
1391,
83,
22854,
92,
1377,
8255,
11192,
273,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
1391,
58,
4906,
48999,
1377,
347,
963,
1271,
284,
869,
198,
220,
220,
220,
220,
198,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
46545,
1377,
6060,
290,
2496,
11192,
669,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4129,
796,
949,
7,
354,
14125,
11,
18896,
7,
5239,
8,
532,
352,
532,
15458,
8,
198,
220,
220,
220,
1366,
796,
2420,
58,
43501,
25,
43501,
10,
13664,
60,
198,
220,
220,
220,
2496,
796,
2420,
58,
43501,
10,
16,
25,
43501,
10,
16,
10,
13664,
4083,
1177,
32590,
16,
8,
198,
220,
220,
220,
1441,
1366,
11,
2496,
198,
198,
2,
5765,
11362,
611,
1695,
198,
25202,
796,
28034,
13,
25202,
10786,
66,
15339,
6,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
3419,
2073,
705,
36166,
11537,
198,
198,
2,
17267,
11145,
578,
742,
12,
17,
27039,
198,
15466,
62,
5239,
796,
28034,
5239,
13,
7890,
13,
15878,
7,
30001,
1096,
28,
1136,
62,
30001,
7509,
10786,
35487,
62,
39126,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2315,
62,
30001,
11639,
27,
82,
418,
29,
3256,
304,
418,
62,
30001,
11639,
27,
68,
418,
29,
3256,
2793,
28,
17821,
8,
198,
27432,
62,
14116,
11,
21201,
62,
14116,
11,
1332,
62,
14116,
796,
28034,
5239,
13,
19608,
292,
1039,
13,
32603,
8206,
17,
13,
22018,
896,
7,
15466,
62,
5239,
8,
198,
15466,
62,
5239,
13,
11249,
62,
18893,
397,
7,
27432,
62,
14116,
8,
198,
198,
2,
347,
963,
11145,
578,
742,
12,
17,
329,
3047,
290,
12660,
198,
27432,
62,
7890,
796,
15458,
62,
5239,
7,
27432,
62,
14116,
11,
15458,
62,
27432,
737,
1462,
7,
25202,
8,
198,
12102,
341,
62,
7890,
796,
15458,
62,
5239,
7,
12102,
341,
62,
14116,
11,
15458,
62,
49786,
737,
1462,
7,
25202,
8,
198,
9288,
62,
7890,
796,
15458,
62,
5239,
7,
9288,
62,
14116,
11,
15458,
62,
49786,
737,
1462,
7,
25202,
8,
198,
198,
2,
24470,
9386,
2746,
198,
18893,
22528,
796,
18896,
7,
15466,
62,
5239,
13,
18893,
397,
13,
301,
23013,
8,
198,
19849,
796,
3602,
16354,
17633,
7,
18893,
22528,
11,
11241,
62,
20521,
12083,
11,
47385,
62,
16600,
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,
47385,
62,
27740,
5736,
11,
47385,
62,
75,
6962,
11,
4268,
448,
737,
1462,
7,
25202,
8,
198,
198,
2,
5345,
34054,
290,
6436,
7509,
329,
4673,
198,
22213,
28019,
796,
299,
77,
13,
21544,
14539,
28338,
43,
793,
3419,
198,
40085,
7509,
796,
28034,
13,
40085,
13,
38475,
35,
7,
19849,
13,
17143,
7307,
22784,
300,
81,
28,
20,
13,
15,
8,
198,
198,
2,
20292,
4673,
2494,
832,
36835,
82,
198,
1416,
704,
18173,
796,
28034,
13,
40085,
13,
14050,
62,
1416,
704,
18173,
13,
8600,
35972,
7,
40085,
7509,
11,
352,
13,
15,
11,
34236,
28,
15,
13,
3865,
8,
198,
198,
4299,
4512,
33529,
198,
220,
220,
220,
37227,
44077,
2746,
37811,
198,
220,
220,
220,
2746,
13,
27432,
3419,
198,
220,
220,
220,
2472,
62,
22462,
796,
657,
13,
198,
220,
220,
220,
923,
62,
2435,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
329,
15458,
11,
1312,
287,
27056,
378,
7,
9521,
7,
15,
11,
4512,
62,
7890,
13,
7857,
7,
15,
8,
532,
352,
11,
22716,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
11,
6670,
796,
651,
62,
43501,
7,
27432,
62,
7890,
11,
1312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6436,
7509,
13,
22570,
62,
9744,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
2746,
7,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2994,
796,
34054,
7,
22915,
13,
1177,
32590,
16,
11,
25818,
828,
6670,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2994,
13,
1891,
904,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
28034,
13,
20471,
13,
26791,
13,
15036,
62,
9744,
62,
27237,
41052,
19849,
13,
17143,
7307,
22784,
657,
13,
20,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6436,
7509,
13,
9662,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
22462,
15853,
2994,
13,
9186,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
62,
3849,
2100,
796,
939,
198,
220,
220,
220,
220,
220,
220,
220,
611,
15458,
4064,
2604,
62,
3849,
2100,
6624,
657,
290,
15458,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1090,
62,
22462,
796,
2472,
62,
22462,
1220,
2604,
62,
3849,
2100,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42118,
62,
2435,
796,
640,
13,
2435,
3419,
532,
923,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
91,
36835,
1391,
538,
5374,
25,
18,
67,
92,
930,
1391,
43501,
25,
20,
67,
92,
14,
90,
11925,
7,
27432,
62,
7890,
8,
3373,
22716,
25,
20,
67,
92,
37830,
930,
300,
81,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
90,
1416,
704,
18173,
13,
1136,
62,
14050,
3419,
58,
15,
5974,
2999,
13,
17,
69,
92,
930,
1391,
417,
28361,
62,
2435,
1635,
8576,
1220,
2604,
62,
3849,
2100,
25,
20,
13,
17,
69,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
13845,
14,
43501,
930,
2994,
1391,
22019,
62,
22462,
25,
20,
13,
17,
69,
92,
930,
279,
489,
1391,
11018,
13,
11201,
7,
22019,
62,
22462,
2599,
23,
13,
17,
69,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
22462,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
923,
62,
2435,
796,
640,
13,
2435,
3419,
198,
198,
4299,
13446,
7,
19849,
11,
21201,
62,
7890,
2599,
198,
220,
220,
220,
37227,
36,
2100,
4985,
2746,
37811,
198,
220,
220,
220,
2746,
13,
18206,
3419,
198,
220,
220,
220,
2472,
62,
22462,
796,
657,
13,
198,
220,
220,
220,
351,
28034,
13,
3919,
62,
9744,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
15,
11,
21201,
62,
7890,
13,
7857,
7,
15,
8,
532,
352,
11,
22716,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
11,
6670,
796,
651,
62,
43501,
7,
12102,
341,
62,
7890,
11,
1312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
2746,
7,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
62,
38568,
796,
5072,
13,
1177,
32590,
16,
11,
25818,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
22462,
15853,
18896,
7,
7890,
8,
1635,
34054,
7,
22915,
62,
38568,
11,
6670,
737,
9186,
3419,
198,
220,
220,
220,
1441,
2472,
62,
22462,
1220,
357,
11925,
7,
12102,
341,
62,
7890,
8,
532,
352,
8,
198,
198,
2,
16835,
625,
3294,
36835,
82,
198,
13466,
62,
19849,
796,
6045,
198,
13466,
62,
12102,
341,
62,
22462,
796,
12178,
10786,
10745,
11537,
198,
1640,
36835,
287,
2837,
7,
16,
11,
36835,
82,
1343,
352,
2599,
198,
220,
220,
220,
36835,
62,
9688,
62,
2435,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
4512,
3419,
198,
220,
220,
220,
1188,
62,
22462,
796,
13446,
7,
19849,
11,
21201,
62,
7890,
8,
198,
220,
220,
220,
3601,
10786,
19355,
1635,
9919,
8,
198,
220,
220,
220,
3601,
7,
69,
6,
91,
886,
286,
36835,
1391,
538,
5374,
25,
18,
67,
92,
930,
640,
25,
1391,
2435,
13,
2435,
3419,
532,
36835,
62,
9688,
62,
2435,
25,
20,
13,
17,
69,
92,
82,
930,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
12102,
2994,
1391,
2100,
62,
22462,
25,
20,
13,
17,
69,
92,
930,
4938,
279,
489,
1391,
11018,
13,
11201,
7,
2100,
62,
22462,
2599,
23,
13,
17,
69,
92,
11537,
198,
220,
220,
220,
3601,
10786,
19355,
1635,
9919,
8,
628,
220,
220,
220,
1303,
12793,
2746,
611,
1266,
21201,
2994,
6515,
4145,
1290,
198,
220,
220,
220,
611,
1188,
62,
22462,
1279,
1266,
62,
12102,
341,
62,
22462,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1266,
62,
12102,
341,
62,
22462,
796,
1188,
62,
22462,
198,
220,
220,
220,
220,
220,
220,
220,
1266,
62,
19849,
796,
2746,
628,
220,
220,
220,
1303,
20292,
4673,
2494,
198,
220,
220,
220,
6038,
18173,
13,
9662,
3419,
198,
198,
2,
26439,
4985,
262,
2746,
319,
262,
1332,
27039,
198,
9288,
62,
22462,
796,
13446,
7,
13466,
62,
19849,
11,
1332,
62,
7890,
8,
198,
4798,
10786,
11639,
1635,
9919,
8,
198,
4798,
7,
69,
6,
91,
5268,
286,
3047,
930,
1332,
2994,
1391,
9288,
62,
22462,
25,
20,
13,
17,
69,
92,
930,
1332,
279,
489,
1391,
11018,
13,
11201,
7,
9288,
62,
22462,
2599,
23,
13,
17,
69,
92,
11537,
198,
4798,
10786,
11639,
1635,
9919,
8
] | 2.573551 | 2,760 |
# Token
from Token import botToken, botUsername
# Public libraries
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types.message import ContentType
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
import numberize
from threading import Thread
import sys
from datetime import datetime
import time
import os
# Own libraries
import DBH
from NewPrint import Print, EnableLogging, DisableLogging, PrintMainInfo
from SkipUpdates import EnableUpdates, DisableUpdates, IsUpdate
from GetExchangeRates import SheduleUpdate, SheduleCryptoUpdate
from BlackList import IsUserInBlackList, LoadBlackList, RemoveFromBlackList, AddToBlackList
import Processing
from Processing import AnswerText, LoadCurrencies, LoadCrypto, LoadDictionaries, LoadFlags, SearchValuesAndCurrencies, SpecialSplit, TextToDigit, RemoveLinksAndWords
import TextHelper as CustomMarkup
from TextHelper import LoadTexts, GetText
import ListsCache
import StopDDoS
# Main variables
bot = Bot(token=botToken)
dp = Dispatcher(bot)
IsStartedCount = False
numberizerUA = numberize.Numberizer(lang='uk')
numberizerRU = numberize.Numberizer(lang='ru')
numberizerEN = numberize.Numberizer(lang='en')
# Public commands
@dp.message_handler(commands=['about']) # analog about and source
@dp.message_handler(commands=['help'])
@dp.message_handler(commands=['settings'])
@dp.message_handler(commands=['donate'])
@dp.message_handler(commands=['wrong'])
# Admin`s commands
@dp.message_handler(commands=['echo'])
@dp.message_handler(commands=['count']) # Analog of "count".
@dp.message_handler(commands=['newadmin'])
@dp.message_handler(commands=['stats'])
@dp.message_handler(commands=['fullstats'])
@dp.message_handler(commands=['backup']) # analog "backup", "logs" and "reports".
@dp.message_handler(commands=['unban'])
@dp.message_handler(commands=['ban'])
# Technical commands
@dp.message_handler(commands=['start'])
@dp.message_handler(content_types=ContentType.ANY)
@dp.callback_query_handler(lambda call: True)
if __name__ == '__main__':
LoadDataForBot()
if len(sys.argv) == 3:
if not CheckArgument(sys.argv[1], sys.argv[2]):
Print("Error arg.", "E")
sys.exit()
elif len(sys.argv) == 5 and sys.argv[1] != sys.argv[3]:
if not CheckArgument(sys.argv[1], sys.argv[2]):
Print("Error arg.", "E")
sys.exit()
elif not CheckArgument(sys.argv[3], sys.argv[4]):
Print("Error arg.", "E")
sys.exit()
elif len(sys.argv) == 7 and sys.argv[1] != sys.argv[3] and sys.argv[1] != sys.argv[2] and sys.argv[2] != sys.argv[3]:
if not CheckArgument(sys.argv[1], sys.argv[2]):
Print("Error arg.", "E")
sys.exit()
elif not CheckArgument(sys.argv[3], sys.argv[4]):
Print("Error arg.", "E")
sys.exit()
elif not CheckArgument(sys.argv[5], sys.argv[6]):
Print("Error arg.", "E")
sys.exit()
elif len(sys.argv) == 5 and not sys.argv[1] != sys.argv[3] or len(sys.argv) == 7 and not (sys.argv[1] != sys.argv[3] and sys.argv[1] != sys.argv[2] and sys.argv[2] != sys.argv[3]):
Print("Error. Duplicate argument.", "E")
sys.exit()
ThreadUpdateExchangeRates = Thread(target = SheduleUpdate)
ThreadUpdateExchangeRates.start()
ThreadUpdateCryptoRates = Thread(target = SheduleCryptoUpdate)
ThreadUpdateCryptoRates.start()
ThreadRegularBackup = Thread(target = RegularBackup)
ThreadRegularBackup.start()
ThreadRegularStats = Thread(target = RegularStats)
ThreadRegularStats.start()
executor.start_polling(dp, skip_updates = IsUpdate()) | [
2,
29130,
198,
6738,
29130,
1330,
10214,
30642,
11,
10214,
5842,
13292,
198,
198,
2,
5094,
12782,
198,
6738,
257,
72,
21857,
1330,
18579,
11,
3167,
8071,
2044,
11,
3121,
273,
11,
3858,
198,
6738,
257,
72,
21857,
13,
19199,
13,
20500,
1330,
14041,
6030,
198,
6738,
257,
72,
21857,
13,
19199,
13,
45145,
62,
2539,
3526,
1330,
554,
1370,
9218,
3526,
9704,
929,
11,
554,
1370,
9218,
3526,
21864,
198,
11748,
1271,
1096,
198,
6738,
4704,
278,
1330,
14122,
198,
11748,
25064,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
640,
198,
11748,
28686,
198,
198,
2,
11744,
12782,
198,
11748,
20137,
39,
198,
6738,
968,
18557,
1330,
12578,
11,
27882,
11187,
2667,
11,
31529,
11187,
2667,
11,
12578,
13383,
12360,
198,
6738,
32214,
4933,
19581,
1330,
27882,
4933,
19581,
11,
31529,
4933,
19581,
11,
1148,
10260,
198,
6738,
3497,
3109,
3803,
49,
689,
1330,
1375,
5950,
10260,
11,
1375,
5950,
23919,
78,
10260,
220,
198,
6738,
2619,
8053,
1330,
1148,
12982,
818,
9915,
8053,
11,
8778,
9915,
8053,
11,
17220,
4863,
9915,
8053,
11,
3060,
2514,
9915,
8053,
198,
11748,
28403,
198,
6738,
28403,
1330,
23998,
8206,
11,
8778,
26628,
14038,
11,
8778,
23919,
78,
11,
8778,
35,
2867,
3166,
11,
8778,
40053,
11,
11140,
40161,
1870,
26628,
14038,
11,
6093,
41205,
11,
8255,
2514,
19511,
270,
11,
17220,
31815,
1870,
37117,
198,
11748,
8255,
47429,
355,
8562,
9704,
929,
198,
6738,
8255,
47429,
1330,
8778,
8206,
82,
11,
3497,
8206,
198,
11748,
44968,
30562,
198,
11748,
13707,
35,
46498,
198,
198,
2,
8774,
9633,
198,
13645,
796,
18579,
7,
30001,
28,
13645,
30642,
8,
198,
26059,
796,
3167,
8071,
2044,
7,
13645,
8,
198,
3792,
10434,
276,
12332,
796,
10352,
198,
198,
17618,
7509,
34970,
796,
1271,
1096,
13,
15057,
7509,
7,
17204,
11639,
2724,
11537,
198,
17618,
7509,
49,
52,
796,
1271,
1096,
13,
15057,
7509,
7,
17204,
11639,
622,
11537,
198,
17618,
7509,
1677,
796,
1271,
1096,
13,
15057,
7509,
7,
17204,
11639,
268,
11537,
198,
198,
2,
5094,
9729,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
10755,
6,
12962,
220,
1303,
15075,
546,
290,
2723,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
16794,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
33692,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
9099,
378,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
36460,
6,
12962,
198,
198,
2,
32053,
63,
82,
9729,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
30328,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
9127,
6,
12962,
220,
1303,
50088,
286,
366,
9127,
1911,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
3605,
28482,
6,
12962,
220,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
34242,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
12853,
34242,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
1891,
929,
6,
12962,
1303,
15075,
366,
1891,
929,
1600,
366,
6404,
82,
1,
290,
366,
48922,
1911,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
403,
3820,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
3820,
6,
12962,
198,
198,
2,
20671,
9729,
198,
31,
26059,
13,
20500,
62,
30281,
7,
9503,
1746,
28,
17816,
9688,
6,
12962,
198,
198,
31,
26059,
13,
20500,
62,
30281,
7,
11299,
62,
19199,
28,
19746,
6030,
13,
31827,
8,
198,
198,
31,
26059,
13,
47423,
62,
22766,
62,
30281,
7,
50033,
869,
25,
6407,
8,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
8778,
6601,
1890,
20630,
3419,
628,
220,
220,
220,
611,
18896,
7,
17597,
13,
853,
85,
8,
6624,
513,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
16,
4357,
25064,
13,
853,
85,
58,
17,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
1288,
361,
18896,
7,
17597,
13,
853,
85,
8,
6624,
642,
290,
25064,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
18,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
16,
4357,
25064,
13,
853,
85,
58,
17,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
18,
4357,
25064,
13,
853,
85,
58,
19,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
1288,
361,
18896,
7,
17597,
13,
853,
85,
8,
6624,
767,
290,
25064,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
18,
60,
290,
25064,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
17,
60,
290,
25064,
13,
853,
85,
58,
17,
60,
14512,
25064,
13,
853,
85,
58,
18,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
16,
4357,
25064,
13,
853,
85,
58,
17,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
18,
4357,
25064,
13,
853,
85,
58,
19,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
407,
6822,
28100,
1713,
7,
17597,
13,
853,
85,
58,
20,
4357,
25064,
13,
853,
85,
58,
21,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
1822,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
198,
220,
220,
220,
1288,
361,
18896,
7,
17597,
13,
853,
85,
8,
6624,
642,
290,
407,
25064,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
18,
60,
393,
18896,
7,
17597,
13,
853,
85,
8,
6624,
767,
290,
407,
357,
17597,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
18,
60,
290,
25064,
13,
853,
85,
58,
16,
60,
14512,
25064,
13,
853,
85,
58,
17,
60,
290,
25064,
13,
853,
85,
58,
17,
60,
14512,
25064,
13,
853,
85,
58,
18,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
12578,
7203,
12331,
13,
49821,
5344,
4578,
33283,
366,
36,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
3419,
628,
220,
220,
220,
14122,
10260,
3109,
3803,
49,
689,
796,
14122,
7,
16793,
796,
1375,
5950,
10260,
8,
198,
220,
220,
220,
14122,
10260,
3109,
3803,
49,
689,
13,
9688,
3419,
198,
220,
220,
220,
14122,
10260,
23919,
78,
49,
689,
796,
14122,
7,
16793,
796,
1375,
5950,
23919,
78,
10260,
8,
198,
220,
220,
220,
14122,
10260,
23919,
78,
49,
689,
13,
9688,
3419,
198,
220,
220,
220,
14122,
40164,
7282,
929,
796,
14122,
7,
16793,
796,
23603,
7282,
929,
8,
198,
220,
220,
220,
14122,
40164,
7282,
929,
13,
9688,
3419,
198,
220,
220,
220,
14122,
40164,
29668,
796,
14122,
7,
16793,
796,
23603,
29668,
8,
198,
220,
220,
220,
14122,
40164,
29668,
13,
9688,
3419,
198,
220,
220,
220,
3121,
273,
13,
9688,
62,
30393,
278,
7,
26059,
11,
14267,
62,
929,
19581,
796,
1148,
10260,
28955
] | 2.59059 | 1,424 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
11,
15720,
602,
628
] | 2.891892 | 37 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
| [
2,
30396,
329,
257,
13934,
5509,
10139,
13,
198,
2,
1398,
12200,
19667,
7,
15252,
2599,
198,
2,
220,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2124,
2599,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2100,
796,
2124,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9464,
796,
6045,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3506,
796,
6045,
198
] | 2.207792 | 77 |
import os
import sys
import dataclasses
import openpyxl
from typing import Any, List
from PySide2.QtCore import (
Qt,
QModelIndex,
QAbstractTableModel
)
# For Sample
from PySide2 import QtWidgets, QtCore, QtGui
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
path, fname = os.path.split(__file__)
os.chdir(path)
@dataclasses.dataclass
# custom Data class
@dataclasses.dataclass
# setupUi
if __name__ == "__main__":
app = QApplication(sys.argv)
window = TestWindow()
window.show()
sys.exit(app.exec_()) | [
11748,
28686,
198,
11748,
25064,
198,
11748,
4818,
330,
28958,
198,
11748,
1280,
9078,
87,
75,
198,
198,
6738,
19720,
1330,
4377,
11,
7343,
198,
6738,
9485,
24819,
17,
13,
48,
83,
14055,
1330,
357,
198,
220,
220,
220,
33734,
11,
198,
220,
220,
220,
1195,
17633,
15732,
11,
198,
220,
220,
220,
1195,
23839,
10962,
17633,
198,
8,
198,
198,
2,
1114,
27565,
198,
6738,
9485,
24819,
17,
1330,
33734,
54,
312,
11407,
11,
33734,
14055,
11,
33734,
8205,
72,
198,
6738,
9485,
24819,
17,
13,
48,
83,
14055,
1330,
1635,
198,
6738,
9485,
24819,
17,
13,
48,
83,
8205,
72,
1330,
1635,
198,
6738,
9485,
24819,
17,
13,
48,
83,
54,
312,
11407,
1330,
1635,
198,
198,
6978,
11,
277,
3672,
796,
28686,
13,
6978,
13,
35312,
7,
834,
7753,
834,
8,
198,
418,
13,
354,
15908,
7,
6978,
8,
628,
198,
31,
19608,
330,
28958,
13,
19608,
330,
31172,
198,
220,
220,
220,
220,
198,
198,
2,
2183,
6060,
1398,
198,
31,
19608,
330,
28958,
13,
19608,
330,
31172,
628,
628,
628,
198,
220,
220,
220,
1303,
9058,
52,
72,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
598,
796,
1195,
23416,
7,
17597,
13,
853,
85,
8,
198,
220,
220,
220,
4324,
796,
6208,
27703,
3419,
198,
220,
220,
220,
4324,
13,
12860,
3419,
628,
220,
220,
220,
25064,
13,
37023,
7,
1324,
13,
18558,
62,
28955
] | 2.479167 | 240 |
import os
import json
main()
| [
11748,
28686,
198,
11748,
33918,
628,
628,
198,
12417,
3419,
198
] | 3 | 11 |
# Compute GradCam with predicted captions as input
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import sys
import json
import os.path as osp
import scipy
import numpy as np
import argparse
from im2txt import metrics
coco_dir = 'data/mscoco/'
dataType = 'val2014'
cocoImgDir = '{}/images/{}/'.format(coco_dir, dataType)
coco_masks = '{}/masks/{}/'.format(coco_dir, dataType)
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Generate bbox output from a Fast R-CNN network')
parser.add_argument('--checkpoint_path', dest='checkpoint_path', help='Model checkpoint file.', default='', type=str)
parser.add_argument('--vocab_file', dest='vocab_file', help='Text file containing the vocabulary.', default='', type=str)
parser.add_argument('--json_path', dest='json_path', help='JSON file with model predictions.', default='', type=str)
parser.add_argument('--img_path', dest='img_path', help='Text file containing image IDs', default='', type=str)
parser.add_argument('--save_path', dest='save_path', help='Path to the location where outputs are saved.', default='', type=str)
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
return args
if __name__ == "__main__":
args = parse_args()
count, acc = evaluate(args.checkpoint_path, args.vocab_file, args.json_path, args.img_path, args.save_path)
print("\ncount: %d instances" % (count))
print("pointing: %.5f" % acc)
| [
2,
3082,
1133,
17701,
21701,
351,
11001,
3144,
507,
355,
5128,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
28686,
198,
11748,
15095,
198,
11748,
25064,
198,
11748,
33918,
198,
11748,
28686,
13,
6978,
355,
267,
2777,
198,
11748,
629,
541,
88,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
1822,
29572,
198,
198,
6738,
545,
17,
14116,
1330,
20731,
198,
198,
66,
25634,
62,
15908,
796,
705,
7890,
14,
907,
66,
25634,
14,
6,
198,
7890,
6030,
796,
705,
2100,
4967,
6,
198,
66,
25634,
3546,
70,
35277,
796,
705,
90,
92,
14,
17566,
14,
90,
92,
14,
4458,
18982,
7,
66,
25634,
62,
15908,
11,
1366,
6030,
8,
198,
66,
25634,
62,
5356,
591,
796,
705,
90,
92,
14,
5356,
591,
14,
90,
92,
14,
4458,
18982,
7,
66,
25634,
62,
15908,
11,
1366,
6030,
8,
198,
198,
4299,
21136,
62,
22046,
33529,
198,
220,
37227,
198,
220,
2547,
325,
5128,
7159,
198,
220,
37227,
198,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
8645,
378,
275,
3524,
5072,
422,
257,
12549,
371,
12,
18474,
3127,
11537,
198,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
9122,
4122,
62,
6978,
3256,
2244,
11639,
9122,
4122,
62,
6978,
3256,
1037,
11639,
17633,
26954,
2393,
2637,
11,
4277,
11639,
3256,
2099,
28,
2536,
8,
198,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
18893,
397,
62,
7753,
3256,
2244,
11639,
18893,
397,
62,
7753,
3256,
1037,
11639,
8206,
2393,
7268,
262,
25818,
2637,
11,
4277,
11639,
3256,
2099,
28,
2536,
8,
198,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
17752,
62,
6978,
3256,
2244,
11639,
17752,
62,
6978,
3256,
1037,
11639,
40386,
2393,
351,
2746,
16277,
2637,
11,
4277,
11639,
3256,
2099,
28,
2536,
8,
198,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
9600,
62,
6978,
3256,
2244,
11639,
9600,
62,
6978,
3256,
1037,
11639,
8206,
2393,
7268,
2939,
32373,
3256,
4277,
11639,
3256,
2099,
28,
2536,
8,
198,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
21928,
62,
6978,
3256,
2244,
11639,
21928,
62,
6978,
3256,
1037,
11639,
15235,
284,
262,
4067,
810,
23862,
389,
7448,
2637,
11,
4277,
11639,
3256,
2099,
28,
2536,
8,
628,
220,
611,
18896,
7,
17597,
13,
853,
85,
8,
6624,
352,
25,
198,
220,
220,
220,
30751,
13,
4798,
62,
16794,
3419,
198,
220,
220,
220,
25064,
13,
37023,
7,
16,
8,
628,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
220,
1441,
26498,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
26498,
796,
21136,
62,
22046,
3419,
198,
220,
954,
11,
697,
796,
13446,
7,
22046,
13,
9122,
4122,
62,
6978,
11,
26498,
13,
18893,
397,
62,
7753,
11,
26498,
13,
17752,
62,
6978,
11,
26498,
13,
9600,
62,
6978,
11,
26498,
13,
21928,
62,
6978,
8,
198,
220,
3601,
7203,
59,
77,
9127,
25,
4064,
67,
10245,
1,
4064,
357,
9127,
4008,
198,
220,
3601,
7203,
4122,
278,
25,
4064,
13,
20,
69,
1,
4064,
697,
8,
628
] | 3.007663 | 522 |
'''
Created on Jan 31, 2021
@author: mballance
'''
from endpoint_mgr import EndpointMgr
| [
7061,
6,
198,
41972,
319,
2365,
3261,
11,
33448,
198,
198,
31,
9800,
25,
285,
1894,
590,
198,
7061,
6,
198,
6738,
36123,
62,
76,
2164,
1330,
5268,
4122,
44,
2164,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220
] | 2.295455 | 44 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Alexander Maul
#
# Author(s):
#
# Alexander Maul <[email protected]>
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
'''
Created on Sep 15, 2016
@author: amaul
'''
import logging
from .errors import BufrTableError
from .tables import Tables
from . import parse_bufrdc, parse_eccodes, parse_libdwd
parse_modules = {'bufrdc': parse_bufrdc, 'eccodes': parse_eccodes, 'libdwd': parse_libdwd}
logger = logging.getLogger("trollbufr")
def load_differ(tables,meta,tab_p, tab_f):
"""Load all tables referenced by the BUFR, if the versions differ from those already loaded."""
if tables is None or tables.differs(
meta['master'], meta['mver'], meta['lver'],
meta['center'], meta['subcenter']):
tables = load_all(
meta['master'], meta['center'], meta['subcenter'], meta['mver'],
meta['lver'], tab_p, tab_f
)
return tables
_text_tab_loaded = "Table loaded: '%s'"
def load_all(master, center, subcenter, master_vers, local_vers, base_path, tabf="eccodes"):
"""Load all given versions of tables"""
try:
tparse = parse_modules[tabf]
except:
raise BufrTableError("Unknown table parser '%s'!" % tabf)
tables = Tables(master, master_vers, local_vers, center, subcenter)
# Table A (centres)
try:
mp, _ = tparse.get_file("A", base_path, master, center, subcenter, master_vers, local_vers)
tparse.load_tab_a(tables, mp)
logger.info(_text_tab_loaded, mp)
except Exception as e:
logger.warning(e)
#
# Table B (elements)
try:
mp, lp = tparse.get_file("B", base_path, master, center, subcenter, master_vers, local_vers)
# International (master) table
tparse.load_tab_b(tables, mp)
logger.info(_text_tab_loaded, mp)
# Local table
if local_vers:
tparse.load_tab_b(tables, lp)
logger.info(_text_tab_loaded, lp)
except Exception as e:
logger.error(e)
raise e
#
# Table C (operators)
try:
mp, _ = tparse.get_file("C", base_path, master, center, subcenter, master_vers, local_vers)
tparse.load_tab_c(tables, mp)
logger.info(_text_tab_loaded, mp)
except Exception as e:
logger.warning(e)
#
# Table D (sequences)
try:
mp, lp = tparse.get_file("D", base_path, master, center, subcenter, master_vers, local_vers)
# International (master) table
tparse.load_tab_d(tables, mp)
logger.info(_text_tab_loaded, mp)
# Local table
if local_vers:
tparse.load_tab_d(tables, lp)
logger.info(_text_tab_loaded, lp)
except Exception as e:
logger.error(e)
raise e
#
# Table CF (code/flags)
try:
mp, lp = tparse.get_file("CF", base_path, master, center, subcenter, master_vers, local_vers)
# International (master) table
tparse.load_tab_cf(tables, mp)
logger.info(_text_tab_loaded, mp)
# Local table
if local_vers:
tparse.load_tab_cf(tables, lp)
logger.info(_text_tab_loaded, lp)
except Exception as er:
logger.warning(er)
return tables | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
201,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
2,
201,
198,
2,
15069,
357,
66,
8,
1584,
10009,
40580,
201,
198,
2,
201,
198,
2,
6434,
7,
82,
2599,
201,
198,
2,
201,
198,
2,
220,
220,
10009,
40580,
1279,
1000,
87,
4066,
13,
76,
2518,
31,
67,
16993,
13,
2934,
29,
201,
198,
2,
201,
198,
2,
770,
1430,
318,
1479,
3788,
25,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
201,
198,
2,
340,
739,
262,
2846,
286,
262,
22961,
3611,
5094,
13789,
355,
3199,
416,
201,
198,
2,
262,
3232,
10442,
5693,
11,
2035,
2196,
513,
286,
262,
13789,
11,
393,
201,
198,
2,
357,
265,
534,
3038,
8,
597,
1568,
2196,
13,
201,
198,
2,
201,
198,
2,
770,
1430,
318,
9387,
287,
262,
2911,
326,
340,
481,
307,
4465,
11,
201,
198,
2,
475,
42881,
15529,
34764,
56,
26,
1231,
772,
262,
17142,
18215,
286,
201,
198,
2,
34482,
3398,
1565,
5603,
25382,
393,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
13,
220,
4091,
262,
201,
198,
2,
22961,
3611,
5094,
13789,
329,
517,
3307,
13,
201,
198,
2,
201,
198,
2,
921,
815,
423,
2722,
257,
4866,
286,
262,
22961,
3611,
5094,
13789,
201,
198,
2,
1863,
351,
428,
1430,
13,
220,
1002,
407,
11,
766,
1279,
4023,
1378,
2503,
13,
41791,
13,
2398,
14,
677,
4541,
15913,
13,
201,
198,
7061,
6,
201,
198,
41972,
319,
8621,
1315,
11,
1584,
201,
198,
31,
9800,
25,
716,
2518,
201,
198,
7061,
6,
201,
198,
201,
198,
11748,
18931,
201,
198,
6738,
764,
48277,
1330,
347,
3046,
81,
10962,
12331,
201,
198,
6738,
764,
83,
2977,
1330,
33220,
201,
198,
201,
198,
6738,
764,
1330,
21136,
62,
29325,
4372,
66,
11,
21136,
62,
68,
535,
4147,
11,
21136,
62,
8019,
67,
16993,
201,
198,
201,
198,
29572,
62,
18170,
796,
1391,
6,
29325,
4372,
66,
10354,
21136,
62,
29325,
4372,
66,
11,
705,
68,
535,
4147,
10354,
21136,
62,
68,
535,
4147,
11,
705,
8019,
67,
16993,
10354,
21136,
62,
8019,
67,
16993,
92,
201,
198,
201,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7203,
83,
2487,
29325,
81,
4943,
201,
198,
201,
198,
201,
198,
4299,
3440,
62,
26069,
263,
7,
83,
2977,
11,
28961,
11,
8658,
62,
79,
11,
7400,
62,
69,
2599,
201,
198,
220,
220,
220,
37227,
8912,
477,
8893,
20717,
416,
262,
20571,
10913,
11,
611,
262,
6300,
13238,
422,
883,
1541,
9639,
526,
15931,
201,
198,
220,
220,
220,
611,
8893,
318,
6045,
393,
8893,
13,
26069,
364,
7,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13634,
17816,
9866,
6,
4357,
13634,
17816,
76,
332,
6,
4357,
13634,
17816,
75,
332,
6,
4357,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13634,
17816,
16159,
6,
4357,
13634,
17816,
7266,
16159,
20520,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
8893,
796,
3440,
62,
439,
7,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13634,
17816,
9866,
6,
4357,
13634,
17816,
16159,
6,
4357,
13634,
17816,
7266,
16159,
6,
4357,
13634,
17816,
76,
332,
6,
4357,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13634,
17816,
75,
332,
6,
4357,
7400,
62,
79,
11,
7400,
62,
69,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
201,
198,
220,
220,
220,
1441,
8893,
201,
198,
201,
198,
62,
5239,
62,
8658,
62,
14578,
796,
366,
10962,
9639,
25,
705,
4,
82,
29653,
201,
198,
4299,
3440,
62,
439,
7,
9866,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
11,
2779,
62,
6978,
11,
7400,
69,
2625,
68,
535,
4147,
1,
2599,
201,
198,
220,
220,
220,
37227,
8912,
477,
1813,
6300,
286,
8893,
37811,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
796,
21136,
62,
18170,
58,
8658,
69,
60,
201,
198,
220,
220,
220,
2845,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
347,
3046,
81,
10962,
12331,
7203,
20035,
3084,
30751,
705,
4,
82,
6,
2474,
4064,
7400,
69,
8,
201,
198,
220,
220,
220,
8893,
796,
33220,
7,
9866,
11,
4958,
62,
690,
11,
1957,
62,
690,
11,
3641,
11,
850,
16159,
8,
201,
198,
201,
198,
220,
220,
220,
1303,
8655,
317,
357,
1087,
411,
8,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
29034,
11,
4808,
796,
256,
29572,
13,
1136,
62,
7753,
7203,
32,
1600,
2779,
62,
6978,
11,
4958,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
64,
7,
83,
2977,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
29034,
8,
201,
198,
220,
220,
220,
2845,
35528,
355,
304,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
43917,
7,
68,
8,
201,
198,
220,
220,
220,
1303,
201,
198,
220,
220,
220,
1303,
8655,
347,
357,
68,
3639,
8,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
29034,
11,
300,
79,
796,
256,
29572,
13,
1136,
62,
7753,
7203,
33,
1600,
2779,
62,
6978,
11,
4958,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4037,
357,
9866,
8,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
65,
7,
83,
2977,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10714,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1957,
62,
690,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
65,
7,
83,
2977,
11,
300,
79,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
300,
79,
8,
201,
198,
220,
220,
220,
2845,
35528,
355,
304,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
68,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
304,
201,
198,
220,
220,
220,
1303,
201,
198,
220,
220,
220,
1303,
8655,
327,
357,
3575,
2024,
8,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
29034,
11,
4808,
796,
256,
29572,
13,
1136,
62,
7753,
7203,
34,
1600,
2779,
62,
6978,
11,
4958,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
66,
7,
83,
2977,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
29034,
8,
201,
198,
220,
220,
220,
2845,
35528,
355,
304,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
43917,
7,
68,
8,
201,
198,
220,
220,
220,
1303,
201,
198,
220,
220,
220,
1303,
8655,
360,
357,
3107,
3007,
8,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
29034,
11,
300,
79,
796,
256,
29572,
13,
1136,
62,
7753,
7203,
35,
1600,
2779,
62,
6978,
11,
4958,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4037,
357,
9866,
8,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
67,
7,
83,
2977,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10714,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1957,
62,
690,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
67,
7,
83,
2977,
11,
300,
79,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
300,
79,
8,
201,
198,
220,
220,
220,
2845,
35528,
355,
304,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
68,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
304,
201,
198,
220,
220,
220,
1303,
201,
198,
220,
220,
220,
1303,
8655,
18551,
357,
8189,
14,
33152,
8,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
29034,
11,
300,
79,
796,
256,
29572,
13,
1136,
62,
7753,
7203,
22495,
1600,
2779,
62,
6978,
11,
4958,
11,
3641,
11,
850,
16159,
11,
4958,
62,
690,
11,
1957,
62,
690,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4037,
357,
9866,
8,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
12993,
7,
83,
2977,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
29034,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10714,
3084,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1957,
62,
690,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
29572,
13,
2220,
62,
8658,
62,
12993,
7,
83,
2977,
11,
300,
79,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
28264,
5239,
62,
8658,
62,
14578,
11,
300,
79,
8,
201,
198,
220,
220,
220,
2845,
35528,
355,
1931,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
43917,
7,
263,
8,
201,
198,
201,
198,
220,
220,
220,
1441,
8893
] | 2.274532 | 1,763 |
from collections import OrderedDict
import csv
import json
import requests
import time
from collections import defaultdict
#print code_to_name
if __name__ =="__main__":
matrix, reversed_matrix, code_to_name = load_matrices()
f = open('code_to_name.json','w')
code_to_name["WSAHARA"]="Western Sahara",
f.write(json.dumps(code_to_name))
f.close()
print get_sorted_tuples(matrix,"MEX", code_to_name)
print get_sorted_tuples(reversed_matrix,"MEX",code_to_name)
| [
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
11748,
269,
21370,
198,
11748,
33918,
198,
11748,
7007,
198,
11748,
640,
198,
6738,
17268,
1330,
4277,
11600,
198,
198,
2,
4798,
2438,
62,
1462,
62,
3672,
628,
198,
198,
361,
11593,
3672,
834,
796,
2625,
834,
12417,
834,
1298,
198,
220,
220,
220,
17593,
11,
17687,
62,
6759,
8609,
11,
2438,
62,
1462,
62,
3672,
796,
3440,
62,
6759,
45977,
3419,
628,
198,
220,
220,
220,
277,
796,
1280,
10786,
8189,
62,
1462,
62,
3672,
13,
17752,
41707,
86,
11537,
628,
220,
220,
220,
2438,
62,
1462,
62,
3672,
14692,
54,
4090,
39,
24401,
8973,
2625,
24227,
46882,
1600,
628,
220,
220,
220,
277,
13,
13564,
7,
17752,
13,
67,
8142,
7,
8189,
62,
1462,
62,
3672,
4008,
198,
220,
220,
220,
277,
13,
19836,
3419,
198,
220,
220,
220,
3601,
651,
62,
82,
9741,
62,
28047,
2374,
7,
6759,
8609,
553,
44,
6369,
1600,
2438,
62,
1462,
62,
3672,
8,
198,
220,
220,
220,
3601,
651,
62,
82,
9741,
62,
28047,
2374,
7,
260,
690,
276,
62,
6759,
8609,
553,
44,
6369,
1600,
8189,
62,
1462,
62,
3672,
8,
628,
198
] | 2.591623 | 191 |
# -*- coding: utf-8 -*-
"""
reference:
https://www.kaggle.com/fizzbuzz/toxic-data-preprocessing/code
Created on Fri Jun 1 18:00:22 2018
@author: bwhe
"""
import pandas as pd
import copy
import re
RE_PATTERNS = {'party':['party']}
####################### train title ##########################
readfile = '../data/train_list_info.csv.gz'
savefile = '../data/pid2more_clean_name.pkl'
build_clean_title(readfile, savefile)
####################### test title ###########################
readfile = '../data/test_list_info.csv.gz'
savefile = '../data/test_pid2more_clean_name.pkl'
build_clean_title(readfile, savefile) | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
37811,
201,
198,
35790,
25,
201,
198,
220,
220,
220,
3740,
1378,
2503,
13,
74,
9460,
293,
13,
785,
14,
69,
6457,
65,
4715,
14,
83,
18047,
12,
7890,
12,
3866,
36948,
14,
8189,
201,
198,
201,
198,
41972,
319,
19480,
7653,
220,
352,
1248,
25,
405,
25,
1828,
2864,
201,
198,
201,
198,
31,
9800,
25,
275,
12491,
201,
198,
37811,
201,
198,
201,
198,
11748,
19798,
292,
355,
279,
67,
201,
198,
11748,
4866,
201,
198,
11748,
302,
201,
198,
201,
198,
201,
198,
2200,
62,
47,
1404,
5781,
8035,
796,
1391,
6,
10608,
10354,
17816,
10608,
20520,
92,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
14468,
4242,
21017,
4512,
3670,
1303,
14468,
7804,
2,
201,
198,
961,
7753,
796,
705,
40720,
7890,
14,
27432,
62,
4868,
62,
10951,
13,
40664,
13,
34586,
6,
201,
198,
21928,
7753,
796,
705,
40720,
7890,
14,
35317,
17,
3549,
62,
27773,
62,
3672,
13,
79,
41582,
6,
201,
198,
11249,
62,
27773,
62,
7839,
7,
961,
7753,
11,
3613,
7753,
8,
201,
198,
201,
198,
14468,
4242,
21017,
1332,
3670,
1303,
14468,
7804,
2235,
201,
198,
961,
7753,
796,
705,
40720,
7890,
14,
9288,
62,
4868,
62,
10951,
13,
40664,
13,
34586,
6,
201,
198,
21928,
7753,
796,
705,
40720,
7890,
14,
9288,
62,
35317,
17,
3549,
62,
27773,
62,
3672,
13,
79,
41582,
6,
201,
198,
11249,
62,
27773,
62,
7839,
7,
961,
7753,
11,
3613,
7753,
8
] | 2.492537 | 268 |
"""
Different Losses
"""
import torch.nn as nn
import torch
import torch.nn.functional as F
from typing import Optional, Union, List
import numpy as np
class LogSoftmaxCELoss(Loss):
""" log softmax + cross entropy loss
"""
def __call__(self, preds: torch.tensor, gts: torch.tensor):
""" calculate mean loss of the batch
:param preds: (batch_size, n_class, height, width)
:param gts: (batch_size, height, width)
"""
assert preds.shape[0] == gts.shape[0], f"loss input preds has different batchsize({preds.shape[0]}) "\
f"compared to that of gts({gts.shape[0]})"
self.loss = torch.zeros_like(self.loss)
batch_size = preds.shape[0]
preds = F.log_softmax(preds, dim=1)
gts = self.weighted_smoothed_one_hot(gts)
preds = preds.reshape(batch_size, self.n_class, -1)
# gts (batch_size, n_class, height * width)
# preds (batch_size, n_class, height * width)
self.loss = torch.sum(-gts * preds, dim=1)
return torch.mean(self.loss, dim=[0, 1])
class SigmoidDiceLoss(Loss):
""" sigmoid + dice loss
dice_loss = 1 - (2 * |X ∩ Y| + eps) / (|X| + |Y| + eps)
"""
def __call__(self, preds: torch.tensor, gts: torch.tensor):
""" calculate mean loss of the batch
:param preds: (batch_size, n_class, height, width)
:param gts: (batch_size, height, width)
"""
assert preds.shape[0] == gts.shape[0], f"loss input preds has different batchsize({preds.shape[0]}) " \
f"compared to that of gts({gts.shape[0]})"
self.loss = torch.zeros_like(self.loss)
batch_size = preds.shape[0]
preds = torch.sigmoid(preds)
gts = self.weighted_smoothed_one_hot(gts)
# preds: (batch_size, n_class, height, width)
# gts: (batch_size, n_class, height * width)
count = 0
for i in torch.arange(self.n_class):
if self.ignore_index is None or i not in self.ignore_index:
# take label = i as foreground, others as background
# gts_single, preds_single: (batch_size, height * width)
gts_single = gts[:, i]
preds_single = preds[:, i].view(batch_size, -1)
intersection = gts_single * preds_single
# intersection: (batch_size, height * width)
tem = (2 * intersection.sum(1) + self.eps) / (gts_single.sum(1) + preds_single.sum(1) + self.eps)
self.loss += (1 - tem).mean()
count += 1
return self.loss / count
class ComposedLoss(Loss):
""" LogSoftmaxCELoss + rate * SigmoidDiceLoss
"""
def __call__(self, preds: torch.tensor, gts: torch.tensor):
""" calculate mean loss of the batch
:param preds: (batch_size, n_class, height, width)
:param gts: (batch_size, height, width)
"""
# print("CELoss", self.CELoss(preds, gts))
# print("Dice", self.DiceLoss(preds, gts))
return self.CELoss(preds, gts) + self.rate * self.DiceLoss(preds, gts)
def to(self, device):
""" transfer criterion to device """
self.CELoss.to(device)
self.DiceLoss.to(device)
| [
37811,
198,
40341,
22014,
274,
198,
37811,
198,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
6738,
19720,
1330,
32233,
11,
4479,
11,
7343,
198,
11748,
299,
32152,
355,
45941,
628,
198,
198,
4871,
5972,
18380,
9806,
34,
3698,
793,
7,
43,
793,
2599,
198,
220,
220,
220,
37227,
2604,
2705,
9806,
1343,
3272,
40709,
2994,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
13345,
834,
7,
944,
11,
2747,
82,
25,
28034,
13,
83,
22854,
11,
308,
912,
25,
28034,
13,
83,
22854,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15284,
1612,
2994,
286,
262,
15458,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2747,
82,
25,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
308,
912,
25,
357,
43501,
62,
7857,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
2747,
82,
13,
43358,
58,
15,
60,
6624,
308,
912,
13,
43358,
58,
15,
4357,
277,
1,
22462,
5128,
2747,
82,
468,
1180,
15458,
7857,
15090,
28764,
82,
13,
43358,
58,
15,
60,
30072,
37082,
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,
277,
1,
5589,
1144,
284,
326,
286,
308,
912,
15090,
70,
912,
13,
43358,
58,
15,
48999,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22462,
796,
28034,
13,
9107,
418,
62,
2339,
7,
944,
13,
22462,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
7857,
796,
2747,
82,
13,
43358,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
82,
796,
376,
13,
6404,
62,
4215,
9806,
7,
28764,
82,
11,
5391,
28,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
308,
912,
796,
2116,
13,
6551,
276,
62,
5796,
1025,
704,
62,
505,
62,
8940,
7,
70,
912,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
82,
796,
2747,
82,
13,
3447,
1758,
7,
43501,
62,
7857,
11,
2116,
13,
77,
62,
4871,
11,
532,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
308,
912,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
1635,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2747,
82,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
1635,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22462,
796,
28034,
13,
16345,
32590,
70,
912,
1635,
2747,
82,
11,
5391,
28,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
28034,
13,
32604,
7,
944,
13,
22462,
11,
5391,
41888,
15,
11,
352,
12962,
628,
198,
4871,
311,
17225,
1868,
35,
501,
43,
793,
7,
43,
793,
2599,
198,
220,
220,
220,
37227,
264,
17225,
1868,
1343,
17963,
2994,
198,
220,
220,
220,
17963,
62,
22462,
796,
352,
532,
357,
17,
1635,
930,
55,
18872,
102,
575,
91,
1343,
304,
862,
8,
1220,
357,
91,
55,
91,
1343,
930,
56,
91,
1343,
304,
862,
8,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
13345,
834,
7,
944,
11,
2747,
82,
25,
28034,
13,
83,
22854,
11,
308,
912,
25,
28034,
13,
83,
22854,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15284,
1612,
2994,
286,
262,
15458,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2747,
82,
25,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
308,
912,
25,
357,
43501,
62,
7857,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
2747,
82,
13,
43358,
58,
15,
60,
6624,
308,
912,
13,
43358,
58,
15,
4357,
277,
1,
22462,
5128,
2747,
82,
468,
1180,
15458,
7857,
15090,
28764,
82,
13,
43358,
58,
15,
60,
30072,
366,
3467,
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,
277,
1,
5589,
1144,
284,
326,
286,
308,
912,
15090,
70,
912,
13,
43358,
58,
15,
48999,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22462,
796,
28034,
13,
9107,
418,
62,
2339,
7,
944,
13,
22462,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
7857,
796,
2747,
82,
13,
43358,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
82,
796,
28034,
13,
82,
17225,
1868,
7,
28764,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
308,
912,
796,
2116,
13,
6551,
276,
62,
5796,
1025,
704,
62,
505,
62,
8940,
7,
70,
912,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2747,
82,
25,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
308,
912,
25,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
1635,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
954,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
28034,
13,
283,
858,
7,
944,
13,
77,
62,
4871,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
46430,
62,
9630,
318,
6045,
393,
1312,
407,
287,
2116,
13,
46430,
62,
9630,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1011,
6167,
796,
1312,
355,
36282,
11,
1854,
355,
4469,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
308,
912,
62,
29762,
11,
2747,
82,
62,
29762,
25,
357,
43501,
62,
7857,
11,
6001,
1635,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
912,
62,
29762,
796,
308,
912,
58,
45299,
1312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2747,
82,
62,
29762,
796,
2747,
82,
58,
45299,
1312,
4083,
1177,
7,
43501,
62,
7857,
11,
532,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16246,
796,
308,
912,
62,
29762,
1635,
2747,
82,
62,
29762,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
16246,
25,
357,
43501,
62,
7857,
11,
6001,
1635,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2169,
796,
357,
17,
1635,
16246,
13,
16345,
7,
16,
8,
1343,
2116,
13,
25386,
8,
1220,
357,
70,
912,
62,
29762,
13,
16345,
7,
16,
8,
1343,
2747,
82,
62,
29762,
13,
16345,
7,
16,
8,
1343,
2116,
13,
25386,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22462,
15853,
357,
16,
532,
2169,
737,
32604,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
22462,
1220,
954,
628,
198,
4871,
3082,
1335,
43,
793,
7,
43,
793,
2599,
198,
220,
220,
220,
37227,
5972,
18380,
9806,
34,
3698,
793,
1343,
2494,
1635,
311,
17225,
1868,
35,
501,
43,
793,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
13345,
834,
7,
944,
11,
2747,
82,
25,
28034,
13,
83,
22854,
11,
308,
912,
25,
28034,
13,
83,
22854,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15284,
1612,
2994,
286,
262,
15458,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2747,
82,
25,
357,
43501,
62,
7857,
11,
299,
62,
4871,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
308,
912,
25,
357,
43501,
62,
7857,
11,
6001,
11,
9647,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3601,
7203,
34,
3698,
793,
1600,
2116,
13,
34,
3698,
793,
7,
28764,
82,
11,
308,
912,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3601,
7203,
35,
501,
1600,
2116,
13,
35,
501,
43,
793,
7,
28764,
82,
11,
308,
912,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
34,
3698,
793,
7,
28764,
82,
11,
308,
912,
8,
1343,
2116,
13,
4873,
1635,
2116,
13,
35,
501,
43,
793,
7,
28764,
82,
11,
308,
912,
8,
628,
220,
220,
220,
825,
284,
7,
944,
11,
3335,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4351,
34054,
284,
3335,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
34,
3698,
793,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
35,
501,
43,
793,
13,
1462,
7,
25202,
8,
198
] | 2.098027 | 1,571 |
# encoding: utf-8
##################################################
# This script shows how to visualise distribution from a single variable using matplotlib and seaborn
# Multiple tutorials inspired the current design but they mostly came from:
# https://seaborn.pydata.org/tutorial/distributions.html
# References for histograms using matplotlib https://matplotlib.org/stable/gallery/statistics/hist.html
# References for histograms using Seaborn https://seaborn.pydata.org/generated/seaborn.histplot.html
# Data uses the Open Data Barcelona API and especially the dataset
#
# Note: the project keeps updating every course almost yearly
##################################################
#
##################################################
# Author: Diego Pajarito
# Credits: [Institute for Advanced Architecture of Catalonia - IAAC, Advanced Architecture group]
# License: Apache License Version 2.0
# Version: 0.7.0
# Maintainer: Diego Pajarito
# Email: [email protected]
# Status: development
##################################################
# We need to import numpy and matplotlib library
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
plt.style.use('seaborn-pastel')
# default histogram
meteocat_2021 = pd.read_csv('../data/barcelona/2021_MeteoCat_Detall_Estacions.csv')
t_mean = meteocat_2021[meteocat_2021['ACRÒNIM'] == 'TM']
# challenge: to integrate historical data
# histogram
sns.histplot(data=t_mean, x="VALOR", bins=50, kde=True)
plt.show()
# histogram by station
sns.displot(data=t_mean, x="VALOR", hue="CODI_ESTACIO", kind="kde")
plt.show()
| [
2,
21004,
25,
3384,
69,
12,
23,
198,
198,
29113,
14468,
2235,
198,
2,
770,
4226,
2523,
703,
284,
5874,
786,
6082,
422,
257,
2060,
7885,
1262,
2603,
29487,
8019,
290,
384,
397,
1211,
198,
2,
20401,
27992,
7867,
262,
1459,
1486,
475,
484,
4632,
1625,
422,
25,
198,
2,
3740,
1378,
325,
397,
1211,
13,
79,
5173,
1045,
13,
2398,
14,
83,
44917,
14,
17080,
2455,
507,
13,
6494,
198,
2,
31458,
329,
1554,
26836,
1262,
2603,
29487,
8019,
3740,
1378,
6759,
29487,
8019,
13,
2398,
14,
31284,
14,
24460,
14,
14269,
3969,
14,
10034,
13,
6494,
198,
2,
31458,
329,
1554,
26836,
1262,
1001,
397,
1211,
3740,
1378,
325,
397,
1211,
13,
79,
5173,
1045,
13,
2398,
14,
27568,
14,
325,
397,
1211,
13,
10034,
29487,
13,
6494,
198,
2,
6060,
3544,
262,
4946,
6060,
15142,
7824,
290,
2592,
262,
27039,
198,
2,
198,
2,
5740,
25,
262,
1628,
7622,
19698,
790,
1781,
2048,
24169,
198,
29113,
14468,
2235,
198,
2,
198,
29113,
14468,
2235,
198,
2,
6434,
25,
9500,
350,
1228,
283,
10094,
198,
2,
29501,
25,
685,
6310,
3678,
329,
13435,
29778,
286,
33859,
532,
35229,
2246,
11,
13435,
29778,
1448,
60,
198,
2,
13789,
25,
220,
24843,
13789,
10628,
362,
13,
15,
198,
2,
10628,
25,
657,
13,
22,
13,
15,
198,
2,
337,
2913,
10613,
25,
9500,
350,
1228,
283,
10094,
198,
2,
9570,
25,
4656,
2188,
13,
79,
1228,
283,
10094,
31,
544,
330,
13,
3262,
198,
2,
12678,
25,
2478,
198,
29113,
14468,
2235,
198,
198,
2,
775,
761,
284,
1330,
299,
32152,
290,
2603,
29487,
8019,
5888,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
384,
397,
1211,
355,
3013,
82,
198,
11748,
19798,
292,
355,
279,
67,
198,
489,
83,
13,
7635,
13,
1904,
10786,
325,
397,
1211,
12,
30119,
417,
11537,
198,
198,
2,
4277,
1554,
21857,
198,
4164,
68,
420,
265,
62,
1238,
2481,
796,
279,
67,
13,
961,
62,
40664,
10786,
40720,
7890,
14,
5657,
14308,
14,
1238,
2481,
62,
9171,
68,
78,
21979,
62,
11242,
439,
62,
22362,
330,
507,
13,
40664,
11537,
198,
83,
62,
32604,
796,
47091,
420,
265,
62,
1238,
2481,
58,
4164,
68,
420,
265,
62,
1238,
2481,
17816,
2246,
49,
127,
240,
45,
3955,
20520,
6624,
705,
15972,
20520,
198,
2,
4427,
25,
284,
19386,
6754,
1366,
198,
198,
2,
1554,
21857,
198,
82,
5907,
13,
10034,
29487,
7,
7890,
28,
83,
62,
32604,
11,
2124,
2625,
23428,
1581,
1600,
41701,
28,
1120,
11,
479,
2934,
28,
17821,
8,
198,
489,
83,
13,
12860,
3419,
198,
198,
2,
1554,
21857,
416,
4429,
198,
82,
5907,
13,
6381,
29487,
7,
7890,
28,
83,
62,
32604,
11,
2124,
2625,
23428,
1581,
1600,
37409,
2625,
34,
3727,
40,
62,
6465,
2246,
9399,
1600,
1611,
2625,
74,
2934,
4943,
198,
489,
83,
13,
12860,
3419,
628
] | 3.362683 | 477 |
# Generated with ThrustCoefficientModel
#
from enum import Enum
from enum import auto
class ThrustCoefficientModel(Enum):
""""""
INTERNAL = auto()
FORWARD = auto()
SEPARATE = auto() | [
2,
2980,
515,
351,
49794,
34,
2577,
5632,
17633,
198,
2,
220,
198,
6738,
33829,
1330,
2039,
388,
198,
6738,
33829,
1330,
8295,
198,
198,
4871,
49794,
34,
2577,
5632,
17633,
7,
4834,
388,
2599,
198,
220,
220,
220,
13538,
15931,
15931,
198,
220,
220,
220,
23255,
45,
1847,
796,
8295,
3419,
198,
220,
220,
220,
7473,
39743,
796,
8295,
3419,
198,
220,
220,
220,
7946,
27082,
6158,
796,
8295,
3419
] | 2.802817 | 71 |
# This function is used to predict the rank using Linear Regression
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
| [
2,
770,
2163,
318,
973,
284,
4331,
262,
4279,
1262,
44800,
3310,
2234,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
35720,
13,
19849,
62,
49283,
1330,
4512,
62,
9288,
62,
35312,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
44800,
8081,
2234,
198
] | 3.907407 | 54 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-05-10 05:28
from __future__ import unicode_literals
import sys
from django.db import migrations
import debug # pyflakes:ignore
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
13,
1065,
319,
2864,
12,
2713,
12,
940,
8870,
25,
2078,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
25064,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
198,
198,
11748,
14257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
12972,
2704,
1124,
25,
46430,
198
] | 2.28125 | 96 |
#!/usr/bin/env python3
from time import sleep
from random import random
from retry import retry
@retry_when((Exception,))
touch()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
6738,
640,
1330,
3993,
198,
6738,
4738,
1330,
4738,
198,
6738,
1005,
563,
1330,
1005,
563,
628,
198,
31,
1186,
563,
62,
12518,
19510,
16922,
11,
4008,
198,
198,
29332,
3419,
628
] | 3.190476 | 42 |
from email import Email
from sms import SMS
from fbmsg import FBMsg
from phone import Phone
from bankwire import BankWire
from paypal import Paypal
from debitcard import DebitCard
from contactlesscard import ContactlessCard
from tube import Tube
from fbstatus import FBStatus
from tweet import Tweet
| [
6738,
3053,
1330,
9570,
198,
6738,
895,
82,
1330,
29287,
198,
6738,
277,
65,
19662,
1330,
13186,
50108,
198,
6738,
3072,
1330,
14484,
198,
6738,
3331,
21809,
1330,
5018,
29451,
198,
6738,
1414,
18596,
1330,
7119,
18596,
198,
6738,
30977,
9517,
1330,
1024,
2545,
16962,
198,
6738,
2800,
1203,
9517,
1330,
14039,
1203,
16962,
198,
6738,
12403,
1330,
34510,
198,
6738,
277,
65,
13376,
1330,
13186,
19580,
198,
6738,
6126,
1330,
18752,
198
] | 4.109589 | 73 |
import networkx as nx
from ..config.gameconfig import maps
| [
11748,
3127,
87,
355,
299,
87,
198,
198,
6738,
11485,
11250,
13,
6057,
11250,
1330,
8739,
628
] | 3.588235 | 17 |
import unittest
import evil_mystery_word
test_words = ['i', 'spoke', 'to', 'several', 'people', 'with', 'delayed', 'sleep', 'phase', 'a', 'condition', 'that', 'congressional']
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
11748,
6181,
62,
1820,
41991,
62,
4775,
198,
198,
9288,
62,
10879,
796,
37250,
72,
3256,
705,
2777,
2088,
3256,
705,
1462,
3256,
705,
28116,
282,
3256,
705,
15332,
3256,
705,
4480,
3256,
705,
12381,
16548,
3256,
705,
42832,
3256,
705,
40715,
3256,
705,
64,
3256,
705,
31448,
3256,
705,
5562,
3256,
705,
36801,
601,
1538,
20520,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.658824 | 85 |
from . import training, processing, models | [
6738,
764,
1330,
3047,
11,
7587,
11,
4981
] | 5.25 | 8 |
from .enums.direction import Direction
from .enums.event import Event
from . import blocks, computer, monitor
from .utils.chilog import chilog
| [
6738,
764,
268,
5700,
13,
37295,
1330,
41837,
198,
6738,
764,
268,
5700,
13,
15596,
1330,
8558,
198,
6738,
764,
1330,
7021,
11,
3644,
11,
5671,
198,
6738,
764,
26791,
13,
354,
346,
519,
1330,
442,
346,
519,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628
] | 2.875 | 56 |
# Generated by Django 3.0.8 on 2020-09-22 06:41
import json
import uuid
from django.db import migrations, models
def gen_default_lines():
"""gen_default_lines."""
template = {
"useCountingLine": True,
"countingLines": [
{
"id": "$UUID_PLACE_HOLDER",
"type": "Line",
"label": [{"x": 229, "y": 215}, {"x": 916, "y": 255}],
}
],
}
template["countingLines"][0]["id"] = str(uuid.uuid4())
return json.dumps(template)
def gen_default_zones():
"""gen_default_zones."""
template = {
"useDangerZone": True,
"dangerZones": [
{
"id": "$UUID_PLACE_HOLDER",
"type": "BBox",
"label": {"x1": 23, "y1": 58, "x2": 452, "y2": 502},
}
],
}
template["dangerZones"][0]["id"] = str(uuid.uuid4())
return json.dumps(template)
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
23,
319,
12131,
12,
2931,
12,
1828,
9130,
25,
3901,
198,
198,
11748,
33918,
198,
11748,
334,
27112,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628,
198,
4299,
2429,
62,
12286,
62,
6615,
33529,
198,
220,
220,
220,
37227,
5235,
62,
12286,
62,
6615,
526,
15931,
198,
220,
220,
220,
11055,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1904,
12332,
278,
13949,
1298,
6407,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9127,
278,
43,
1127,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
312,
1298,
17971,
52,
27586,
62,
6489,
11598,
62,
39,
3535,
14418,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
4906,
1298,
366,
13949,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18242,
1298,
685,
4895,
87,
1298,
31064,
11,
366,
88,
1298,
22951,
5512,
19779,
87,
1298,
860,
1433,
11,
366,
88,
1298,
14280,
92,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
11055,
14692,
9127,
278,
43,
1127,
1,
7131,
15,
7131,
1,
312,
8973,
796,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
220,
220,
220,
1441,
33918,
13,
67,
8142,
7,
28243,
8,
628,
198,
4299,
2429,
62,
12286,
62,
89,
1952,
33529,
198,
220,
220,
220,
37227,
5235,
62,
12286,
62,
89,
1952,
526,
15931,
198,
220,
220,
220,
11055,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1904,
35,
2564,
26961,
1298,
6407,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
38537,
57,
1952,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
312,
1298,
17971,
52,
27586,
62,
6489,
11598,
62,
39,
3535,
14418,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
4906,
1298,
366,
33,
14253,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18242,
1298,
19779,
87,
16,
1298,
2242,
11,
366,
88,
16,
1298,
7618,
11,
366,
87,
17,
1298,
4153,
17,
11,
366,
88,
17,
1298,
47233,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
11055,
14692,
38537,
57,
1952,
1,
7131,
15,
7131,
1,
312,
8973,
796,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
220,
220,
220,
1441,
33918,
13,
67,
8142,
7,
28243,
8,
628
] | 1.854043 | 507 |
from __future__ import absolute_import
import math
import threading
from time import sleep
import rospy
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion
import collisions
from .exceptions import MovementObstructed
from .odometry import Odometer
from time import time
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
11748,
10688,
198,
11748,
4704,
278,
198,
6738,
640,
1330,
3993,
198,
198,
11748,
686,
2777,
88,
198,
6738,
22939,
62,
907,
14542,
13,
19662,
1330,
44088,
198,
6738,
6812,
62,
907,
14542,
13,
19662,
1330,
10529,
15748,
198,
6738,
48700,
13,
35636,
602,
1330,
304,
18173,
62,
6738,
62,
421,
9205,
295,
198,
198,
11748,
31998,
198,
6738,
764,
1069,
11755,
1330,
15477,
5944,
16242,
198,
6738,
764,
375,
15748,
1330,
10529,
15635,
198,
198,
6738,
640,
1330,
640,
198
] | 3.822222 | 90 |
# ExampleHub = TechnicHub PrimeHub
from pybricks.hubs import ExampleHub
from pybricks.tools import wait
# Initialize the hub.
hub = ExampleHub()
while True:
# Read the tilt values.
pitch, roll = hub.imu.tilt()
# Print the result.
print(pitch, roll)
wait(200)
| [
2,
17934,
16066,
796,
5429,
291,
16066,
5537,
16066,
198,
6738,
12972,
65,
23706,
13,
71,
23161,
1330,
17934,
16066,
198,
6738,
12972,
65,
23706,
13,
31391,
1330,
4043,
198,
198,
2,
20768,
1096,
262,
12575,
13,
198,
40140,
796,
17934,
16066,
3419,
198,
198,
4514,
6407,
25,
198,
220,
220,
220,
1303,
4149,
262,
26500,
3815,
13,
198,
220,
220,
220,
7078,
11,
4836,
796,
12575,
13,
320,
84,
13,
83,
2326,
3419,
628,
220,
220,
220,
1303,
12578,
262,
1255,
13,
198,
220,
220,
220,
3601,
7,
79,
2007,
11,
4836,
8,
198,
220,
220,
220,
4043,
7,
2167,
8,
198
] | 2.737864 | 103 |
from celery import shared_task
from muonic.lib.app import App
from muonic.lib.consumers import BufferedConsumer
from muonic_django.consumer import Consumer as DjangoConsumer
from muonic.lib.analyzers import *
from django.conf import settings
@shared_task(bind=True) | [
6738,
18725,
1924,
1330,
4888,
62,
35943,
198,
6738,
38779,
9229,
13,
8019,
13,
1324,
1330,
2034,
198,
6738,
38779,
9229,
13,
8019,
13,
5936,
31260,
1330,
8792,
1068,
49106,
198,
6738,
38779,
9229,
62,
28241,
14208,
13,
49827,
1330,
18110,
355,
37770,
49106,
198,
6738,
38779,
9229,
13,
8019,
13,
38200,
47031,
1330,
1635,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
628,
198,
31,
28710,
62,
35943,
7,
21653,
28,
17821,
8
] | 3.608108 | 74 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from core.config import cfg
import nn as mynn
import utils.net as net_utils
import utils.boxes as box_utils
import numpy as np
# ---------------------------------------------------------------------------- #
# Box heads
# ---------------------------------------------------------------------------- #
class roi_2mlp_head(nn.Module):
"""Add a ReLU MLP with two hidden layers."""
class roi_Xconv1fc_head(nn.Module):
"""Add a X conv + 1fc head, as a reference if not using GroupNorm"""
class roi_Xconv1fc_gn_head(nn.Module):
"""Add a X conv + 1fc head, with GroupNorm"""
| [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28034,
13,
20471,
13,
15003,
355,
2315,
198,
6738,
28034,
13,
2306,
519,
6335,
1330,
35748,
198,
198,
6738,
4755,
13,
11250,
1330,
30218,
70,
198,
11748,
299,
77,
355,
616,
20471,
198,
11748,
3384,
4487,
13,
3262,
355,
2010,
62,
26791,
198,
11748,
3384,
4487,
13,
29305,
355,
3091,
62,
26791,
198,
198,
11748,
299,
32152,
355,
45941,
628,
198,
2,
16529,
10541,
1303,
198,
2,
8315,
6665,
198,
2,
16529,
10541,
1303,
198,
198,
4871,
686,
72,
62,
17,
4029,
79,
62,
2256,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
4550,
257,
797,
41596,
10373,
47,
351,
734,
7104,
11685,
526,
15931,
628,
198,
4871,
686,
72,
62,
55,
42946,
16,
16072,
62,
2256,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
4550,
257,
1395,
3063,
1343,
352,
16072,
1182,
11,
355,
257,
4941,
611,
407,
1262,
4912,
35393,
37811,
628,
198,
4871,
686,
72,
62,
55,
42946,
16,
16072,
62,
4593,
62,
2256,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
4550,
257,
1395,
3063,
1343,
352,
16072,
1182,
11,
351,
4912,
35393,
37811,
198
] | 3.5 | 206 |
"""
Created by Benjamin Bowes, 4-19-19
This script records depth and flood values at each swmm model time step and plots them.
"""
from pyswmm import Simulation, Nodes, Links, Subcatchments
import matplotlib.pyplot as plt
from smart_stormwater_rl.pyswmm_utils import save_out
control_time_step = 900 # control time step in seconds
swmm_inp = "RL_Class_S19/rl_project/simple_2_ctl_smt.inp" # swmm input file
St1_depth = []
St2_depth = []
J3_depth = []
St1_flooding = []
St2_flooding = []
J3_flooding = []
with Simulation(swmm_inp) as sim: # loop through all steps in the simulation
sim.step_advance(control_time_step)
node_object = Nodes(sim) # init node object
St1 = node_object["St1"]
St2 = node_object["St2"]
J3 = node_object["J3"]
St1.full_depth = 4
St2.full_depth = 4
link_object = Links(sim) # init link object
R1 = link_object["R1"]
R2 = link_object["R2"]
subcatchment_object = Subcatchments(sim)
S1 = subcatchment_object["S1"]
S2 = subcatchment_object["S2"]
for step in sim:
St1_depth.append(St1.depth)
St2_depth.append(St2.depth)
J3_depth.append(J3.depth)
St1_flooding.append(St1.flooding)
St2_flooding.append(St2.flooding)
J3_flooding.append(J3.flooding)
out_lists = [St1_depth, St2_depth, J3_depth, St1_flooding, St2_flooding, J3_flooding]
save_out(out_lists, "Uncontrolled_smallpond")
# plot results
plt.subplot(2, 2, 1)
plt.plot(St1_depth)
plt.title('St1_depth')
plt.ylabel("ft")
plt.xlabel("time step")
plt.subplot(2, 2, 2)
plt.plot(St2_depth)
plt.title('St2_depth')
plt.ylabel("ft")
plt.xlabel("time step")
plt.subplot(2, 2, 3)
plt.plot(J3_depth)
plt.title('J3_depth')
plt.ylabel("ft")
plt.xlabel("time step")
# bar graph for total flooding
plt.subplot(2, 2, 4)
plt.bar([0, 1, 2], [sum(St1_flooding), sum(St2_flooding), sum(J3_flooding)], tick_label=["ST1", "St2", "J3"])
plt.title('total_flooding')
plt.ylabel("10^3 cubic feet")
plt.tight_layout()
# plt.show()
plt.savefig("RL_Class_S19/rl_project/plots/baseline_model_results_smallpond.png", dpi=300)
plt.close()
| [
37811,
201,
198,
41972,
416,
14533,
9740,
274,
11,
604,
12,
1129,
12,
1129,
201,
198,
1212,
4226,
4406,
6795,
290,
6947,
3815,
379,
1123,
1509,
3020,
2746,
640,
2239,
290,
21528,
606,
13,
201,
198,
37811,
201,
198,
201,
198,
6738,
279,
893,
86,
3020,
1330,
41798,
11,
399,
4147,
11,
21691,
11,
3834,
40198,
902,
201,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
201,
198,
6738,
4451,
62,
12135,
7050,
62,
45895,
13,
79,
893,
86,
3020,
62,
26791,
1330,
3613,
62,
448,
201,
198,
201,
198,
13716,
62,
2435,
62,
9662,
796,
15897,
220,
1303,
1630,
640,
2239,
287,
4201,
201,
198,
2032,
3020,
62,
259,
79,
796,
366,
7836,
62,
9487,
62,
50,
1129,
14,
45895,
62,
16302,
14,
36439,
62,
17,
62,
34168,
62,
5796,
83,
13,
259,
79,
1,
220,
1303,
1509,
3020,
5128,
2393,
201,
198,
201,
198,
1273,
16,
62,
18053,
796,
17635,
201,
198,
1273,
17,
62,
18053,
796,
17635,
201,
198,
41,
18,
62,
18053,
796,
17635,
201,
198,
1273,
16,
62,
2704,
702,
278,
796,
17635,
201,
198,
1273,
17,
62,
2704,
702,
278,
796,
17635,
201,
198,
41,
18,
62,
2704,
702,
278,
796,
17635,
201,
198,
201,
198,
4480,
41798,
7,
2032,
3020,
62,
259,
79,
8,
355,
985,
25,
220,
1303,
9052,
832,
477,
4831,
287,
262,
18640,
201,
198,
220,
220,
220,
985,
13,
9662,
62,
324,
19259,
7,
13716,
62,
2435,
62,
9662,
8,
201,
198,
220,
220,
220,
10139,
62,
15252,
796,
399,
4147,
7,
14323,
8,
220,
1303,
2315,
10139,
2134,
201,
198,
220,
220,
220,
520,
16,
796,
10139,
62,
15252,
14692,
1273,
16,
8973,
201,
198,
220,
220,
220,
520,
17,
796,
10139,
62,
15252,
14692,
1273,
17,
8973,
201,
198,
220,
220,
220,
449,
18,
796,
10139,
62,
15252,
14692,
41,
18,
8973,
201,
198,
201,
198,
220,
220,
220,
520,
16,
13,
12853,
62,
18053,
796,
604,
201,
198,
220,
220,
220,
520,
17,
13,
12853,
62,
18053,
796,
604,
201,
198,
201,
198,
220,
220,
220,
2792,
62,
15252,
796,
21691,
7,
14323,
8,
220,
1303,
2315,
2792,
2134,
201,
198,
220,
220,
220,
371,
16,
796,
2792,
62,
15252,
14692,
49,
16,
8973,
201,
198,
220,
220,
220,
371,
17,
796,
2792,
62,
15252,
14692,
49,
17,
8973,
201,
198,
201,
198,
220,
220,
220,
850,
40198,
434,
62,
15252,
796,
3834,
40198,
902,
7,
14323,
8,
201,
198,
220,
220,
220,
311,
16,
796,
850,
40198,
434,
62,
15252,
14692,
50,
16,
8973,
201,
198,
220,
220,
220,
311,
17,
796,
850,
40198,
434,
62,
15252,
14692,
50,
17,
8973,
201,
198,
201,
198,
220,
220,
220,
329,
2239,
287,
985,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
520,
16,
62,
18053,
13,
33295,
7,
1273,
16,
13,
18053,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
520,
17,
62,
18053,
13,
33295,
7,
1273,
17,
13,
18053,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
449,
18,
62,
18053,
13,
33295,
7,
41,
18,
13,
18053,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
520,
16,
62,
2704,
702,
278,
13,
33295,
7,
1273,
16,
13,
2704,
702,
278,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
520,
17,
62,
2704,
702,
278,
13,
33295,
7,
1273,
17,
13,
2704,
702,
278,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
449,
18,
62,
2704,
702,
278,
13,
33295,
7,
41,
18,
13,
2704,
702,
278,
8,
201,
198,
201,
198,
448,
62,
20713,
796,
685,
1273,
16,
62,
18053,
11,
520,
17,
62,
18053,
11,
449,
18,
62,
18053,
11,
520,
16,
62,
2704,
702,
278,
11,
520,
17,
62,
2704,
702,
278,
11,
449,
18,
62,
2704,
702,
278,
60,
201,
198,
201,
198,
21928,
62,
448,
7,
448,
62,
20713,
11,
366,
3118,
14401,
62,
17470,
79,
623,
4943,
201,
198,
201,
198,
2,
7110,
2482,
201,
198,
489,
83,
13,
7266,
29487,
7,
17,
11,
362,
11,
352,
8,
201,
198,
489,
83,
13,
29487,
7,
1273,
16,
62,
18053,
8,
201,
198,
489,
83,
13,
7839,
10786,
1273,
16,
62,
18053,
11537,
201,
198,
489,
83,
13,
2645,
9608,
7203,
701,
4943,
201,
198,
489,
83,
13,
87,
18242,
7203,
2435,
2239,
4943,
201,
198,
201,
198,
489,
83,
13,
7266,
29487,
7,
17,
11,
362,
11,
362,
8,
201,
198,
489,
83,
13,
29487,
7,
1273,
17,
62,
18053,
8,
201,
198,
489,
83,
13,
7839,
10786,
1273,
17,
62,
18053,
11537,
201,
198,
489,
83,
13,
2645,
9608,
7203,
701,
4943,
201,
198,
489,
83,
13,
87,
18242,
7203,
2435,
2239,
4943,
201,
198,
201,
198,
489,
83,
13,
7266,
29487,
7,
17,
11,
362,
11,
513,
8,
201,
198,
489,
83,
13,
29487,
7,
41,
18,
62,
18053,
8,
201,
198,
489,
83,
13,
7839,
10786,
41,
18,
62,
18053,
11537,
201,
198,
489,
83,
13,
2645,
9608,
7203,
701,
4943,
201,
198,
489,
83,
13,
87,
18242,
7203,
2435,
2239,
4943,
201,
198,
201,
198,
2,
2318,
4823,
329,
2472,
17448,
201,
198,
489,
83,
13,
7266,
29487,
7,
17,
11,
362,
11,
604,
8,
201,
198,
489,
83,
13,
5657,
26933,
15,
11,
352,
11,
362,
4357,
685,
16345,
7,
1273,
16,
62,
2704,
702,
278,
828,
2160,
7,
1273,
17,
62,
2704,
702,
278,
828,
2160,
7,
41,
18,
62,
2704,
702,
278,
8,
4357,
4378,
62,
18242,
28,
14692,
2257,
16,
1600,
366,
1273,
17,
1600,
366,
41,
18,
8973,
8,
201,
198,
489,
83,
13,
7839,
10786,
23350,
62,
2704,
702,
278,
11537,
201,
198,
489,
83,
13,
2645,
9608,
7203,
940,
61,
18,
27216,
3625,
4943,
201,
198,
201,
198,
489,
83,
13,
33464,
62,
39786,
3419,
201,
198,
2,
458,
83,
13,
12860,
3419,
201,
198,
489,
83,
13,
21928,
5647,
7203,
7836,
62,
9487,
62,
50,
1129,
14,
45895,
62,
16302,
14,
489,
1747,
14,
12093,
4470,
62,
19849,
62,
43420,
62,
17470,
79,
623,
13,
11134,
1600,
288,
14415,
28,
6200,
8,
201,
198,
489,
83,
13,
19836,
3419,
201,
198
] | 2.138235 | 1,020 |
fn = Solution().shortestCompletingWord
print(fn(licensePlate="1s3 PSt", words=["step", "steps", "stripe", "stepple"]))
print(fn(licensePlate="1s3 456", words=["looks", "pest", "stew", "show"]))
| [
198,
198,
22184,
796,
28186,
22446,
19509,
395,
5377,
47130,
26449,
198,
198,
4798,
7,
22184,
7,
43085,
3646,
378,
2625,
16,
82,
18,
350,
1273,
1600,
2456,
28,
14692,
9662,
1600,
366,
20214,
1600,
366,
33565,
431,
1600,
366,
4169,
381,
293,
8973,
4008,
198,
4798,
7,
22184,
7,
43085,
3646,
378,
2625,
16,
82,
18,
604,
3980,
1600,
2456,
28,
14692,
5460,
82,
1600,
366,
79,
395,
1600,
366,
301,
413,
1600,
366,
12860,
8973,
4008,
198
] | 2.493671 | 79 |
from rest_framework import serializers
from authentication.models import User
from social.models import Followers, Request
from utils import paginator
| [
6738,
1334,
62,
30604,
1330,
11389,
11341,
198,
6738,
18239,
13,
27530,
1330,
11787,
198,
6738,
1919,
13,
27530,
1330,
7281,
364,
11,
19390,
198,
6738,
3384,
4487,
1330,
42208,
20900,
628
] | 4.75 | 32 |
import numpy as np
import cv2
import imutils
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
# Get text from a cropped image of a license plate
# Detect a license plate in a picture
| [
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
198,
11748,
545,
26791,
198,
11748,
12972,
83,
408,
263,
529,
198,
6738,
350,
4146,
1330,
7412,
198,
9078,
83,
408,
263,
529,
13,
9078,
83,
408,
263,
529,
13,
83,
408,
263,
529,
62,
28758,
796,
705,
34,
25,
6852,
15167,
13283,
6852,
51,
408,
263,
529,
12,
4503,
49,
6852,
83,
408,
263,
529,
13,
13499,
6,
198,
198,
2,
3497,
2420,
422,
257,
48998,
2939,
286,
257,
5964,
7480,
628,
198,
2,
35874,
257,
5964,
7480,
287,
257,
4286,
198,
220,
220,
220,
220,
628,
628
] | 2.787879 | 99 |
#!/usr/bin/env python
"""
CMakeModules.py
==================
This copies cmake/Modules into the installation directory
which is necessary to allow building against the release.
Usage Example
---------------
Note that the destination directory is deleted and populated on every run
::
[blyth@localhost ~]$ CMakeModules.py $(opticks-home) --dest $(opticks-dir)
"""
import sys, re, os, logging, argparse, shutil
log = logging.getLogger(__name__)
if __name__ == '__main__':
parser = argparse.ArgumentParser(__doc__)
parser.add_argument( "--home", default=os.path.expanduser("~/opticks"), help="Base opticks-home directory in which to look for cmake/Modules " )
parser.add_argument( "--dest", default="/tmp/test-CMakeModules-py", help="destination directory inside which a cmake/Modules directory will be removed if present, recreated and populated" )
parser.add_argument( "--level", default="info", help="logging level" )
args = parser.parse_args()
fmt = '[%(asctime)s] p%(process)s {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s'
logging.basicConfig(level=getattr(logging,args.level.upper()), format=fmt)
src = SourceTree(args.home, args.dest)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
34,
12050,
5841,
5028,
13,
9078,
198,
4770,
855,
198,
198,
1212,
9088,
12067,
539,
14,
5841,
5028,
656,
262,
9988,
8619,
220,
198,
4758,
318,
3306,
284,
1249,
2615,
1028,
262,
2650,
13,
220,
198,
198,
28350,
17934,
198,
24305,
198,
220,
198,
6425,
326,
262,
10965,
8619,
318,
13140,
290,
22331,
319,
790,
1057,
220,
198,
198,
3712,
628,
220,
220,
220,
685,
36874,
400,
31,
36750,
5299,
60,
3,
220,
327,
12050,
5841,
5028,
13,
9078,
29568,
8738,
3378,
12,
11195,
8,
1377,
16520,
29568,
8738,
3378,
12,
15908,
8,
628,
628,
198,
37811,
198,
11748,
25064,
11,
302,
11,
28686,
11,
18931,
11,
1822,
29572,
11,
4423,
346,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
834,
15390,
834,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7,
220,
220,
220,
220,
366,
438,
11195,
1600,
220,
4277,
28,
418,
13,
6978,
13,
11201,
392,
7220,
7203,
93,
14,
8738,
3378,
12340,
1037,
2625,
14881,
2172,
3378,
12,
11195,
8619,
287,
543,
284,
804,
329,
12067,
539,
14,
5841,
5028,
366,
1267,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7,
220,
220,
220,
220,
366,
438,
16520,
1600,
4277,
35922,
22065,
14,
9288,
12,
34,
12050,
5841,
5028,
12,
9078,
1600,
1037,
2625,
16520,
1883,
8619,
2641,
543,
257,
12067,
539,
14,
5841,
5028,
8619,
481,
307,
4615,
611,
1944,
11,
11027,
515,
290,
22331,
1,
1267,
220,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7,
220,
220,
220,
220,
366,
438,
5715,
1600,
4277,
2625,
10951,
1600,
1037,
2625,
6404,
2667,
1241,
1,
1267,
220,
198,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
220,
220,
220,
46996,
796,
44438,
4,
7,
292,
310,
524,
8,
82,
60,
279,
4,
7,
14681,
8,
82,
1391,
4,
7,
6978,
3672,
8,
82,
25,
4,
7,
2815,
23397,
8,
67,
92,
4064,
7,
5715,
3672,
8,
82,
532,
4064,
7,
20500,
8,
82,
6,
198,
220,
220,
220,
18931,
13,
35487,
16934,
7,
5715,
28,
1136,
35226,
7,
6404,
2667,
11,
22046,
13,
5715,
13,
45828,
3419,
828,
5794,
28,
69,
16762,
8,
628,
220,
220,
220,
12351,
796,
8090,
27660,
7,
22046,
13,
11195,
11,
26498,
13,
16520,
8,
628,
628
] | 2.880562 | 427 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 00:32:45 2020
@author: mam22
"""
from flask import Flask, render_template,request,jsonify,session
from get_anime_characters_from_database import get_anime_characters_for_quiz
import gc
app = Flask(__name__)
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'
@app.route('/')
@app.route('/about')
@app.route('/howto')
@app.route('/quiz')
@app.route('/get-characters')
if __name__ == "__main__":
app.run(debug=False) | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
2892,
2365,
1511,
3571,
25,
2624,
25,
2231,
12131,
198,
198,
31,
9800,
25,
285,
321,
1828,
198,
37811,
198,
198,
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
25927,
11,
17752,
1958,
11,
29891,
198,
6738,
651,
62,
272,
524,
62,
10641,
19858,
62,
6738,
62,
48806,
1330,
651,
62,
272,
524,
62,
10641,
19858,
62,
1640,
62,
421,
528,
198,
11748,
308,
66,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
1324,
13,
21078,
62,
2539,
796,
275,
6,
62,
20,
2,
88,
17,
43,
1,
37,
19,
48,
23,
89,
59,
77,
59,
87,
721,
60,
14,
6,
198,
198,
31,
1324,
13,
38629,
10786,
14,
11537,
198,
31,
1324,
13,
38629,
10786,
14,
10755,
11537,
198,
31,
1324,
13,
38629,
10786,
14,
4919,
1462,
11537,
198,
31,
1324,
13,
38629,
10786,
14,
421,
528,
11537,
198,
31,
1324,
13,
38629,
10786,
14,
1136,
12,
10641,
19858,
11537,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
598,
13,
5143,
7,
24442,
28,
25101,
8
] | 2.352041 | 196 |
from create_semi_supervised_train_set import filter_train_set
from constants import *
if __name__ == "__main__":
for i in [10, 100, 500, 1000]:
for task in LOCALIZATION_TASKS:
print("FILTERING TASK: ", task)
filter_train_set(task, i)
| [
6738,
2251,
62,
325,
11632,
62,
16668,
16149,
62,
27432,
62,
2617,
1330,
8106,
62,
27432,
62,
2617,
198,
6738,
38491,
1330,
1635,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
329,
1312,
287,
685,
940,
11,
1802,
11,
5323,
11,
8576,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
329,
4876,
287,
37347,
1847,
14887,
6234,
62,
51,
1921,
27015,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
46700,
5781,
2751,
309,
1921,
42,
25,
33172,
4876,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8106,
62,
27432,
62,
2617,
7,
35943,
11,
1312,
8,
198
] | 2.29661 | 118 |
import sys
import json
import time
import requests
from couchbase.bucket import Bucket
from couchbase.n1ql import N1QLQuery, N1QLError
from couchbase.exceptions import CouchbaseTransientError, CouchbaseNetworkError
from requests.exceptions import RequestException
from log.config import set_log_config, logging
logger = logging.getLogger("couchbase.connection")
| [
11748,
25064,
198,
11748,
33918,
198,
11748,
640,
198,
11748,
7007,
198,
198,
6738,
18507,
8692,
13,
27041,
316,
1330,
48353,
198,
6738,
18507,
8692,
13,
77,
16,
13976,
1330,
399,
16,
9711,
20746,
11,
399,
16,
48,
2538,
81,
1472,
198,
6738,
18507,
8692,
13,
1069,
11755,
1330,
48225,
8692,
8291,
1153,
12331,
11,
48225,
8692,
26245,
12331,
198,
198,
6738,
7007,
13,
1069,
11755,
1330,
19390,
16922,
198,
198,
6738,
2604,
13,
11250,
1330,
900,
62,
6404,
62,
11250,
11,
18931,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7203,
66,
7673,
8692,
13,
38659,
4943,
628
] | 3.66 | 100 |
import pytest
from lpipe.exceptions import InvalidTaxonomyURI
from lpipe.taxonomy import Brand, Company, Product, TaxonomyURI
| [
11748,
12972,
9288,
198,
198,
6738,
300,
34360,
13,
1069,
11755,
1330,
17665,
27017,
30565,
47269,
198,
6738,
300,
34360,
13,
19290,
30565,
1330,
13512,
11,
5834,
11,
8721,
11,
9241,
30565,
47269,
628,
628,
198
] | 3.638889 | 36 |
import numpy as np
from score_analysis.measure_clusterer import MeasureClusterer
from util.dirs import get_musicdata_scores, get_parts
if __name__ == '__main__':
for score in get_musicdata_scores(follow_parts=False):
print('Clustering {}...'.format(score.name))
dist_matrix_path = score / 'dist_matrix.npy'
if not dist_matrix_path.exists():
print('Skipping {}: no dist_matrix'.format(score.name))
continue
dist_matrix = np.load(dist_matrix_path)
if ((dist_matrix == 0).sum() - dist_matrix.shape[0]) > 0:
print('Skipping {}: incomplete dist_matrix'.format(score.name))
continue
measures_path = score / 'measures'
images_path = score / 'measure_images'
parts = get_parts(score)
if len(parts) > 0:
measures_path = [score / part.name / 'measures' for part in parts]
images_path = [score / part.name / 'measure_images' for part in parts]
cluster_images = score / 'cluster_images'
cluster_images.mkdir(exist_ok=True, parents=True)
clusterer = MeasureClusterer(measures_path, images_path, dist_matrix_path)
clusterer.load_measure_images()
clusterer.get_distance_matrix()
clusterer.cluster()
for i, c in enumerate(clusterer.clusters):
images = clusterer.visualize_cluster(c)
for j, image in enumerate(images):
image.save(cluster_images / 'cluster_{}.{}.png'.format(i, j))
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
4776,
62,
20930,
13,
1326,
5015,
62,
565,
436,
11882,
1330,
24291,
2601,
436,
11882,
198,
6738,
7736,
13,
15908,
82,
1330,
651,
62,
28965,
7890,
62,
1416,
2850,
11,
651,
62,
42632,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
329,
4776,
287,
651,
62,
28965,
7890,
62,
1416,
2850,
7,
27780,
62,
42632,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
2601,
436,
1586,
23884,
986,
4458,
18982,
7,
26675,
13,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1233,
62,
6759,
8609,
62,
6978,
796,
4776,
1220,
705,
17080,
62,
6759,
8609,
13,
77,
9078,
6,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
1233,
62,
6759,
8609,
62,
6978,
13,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
50,
4106,
2105,
23884,
25,
645,
1233,
62,
6759,
8609,
4458,
18982,
7,
26675,
13,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
1233,
62,
6759,
8609,
796,
45941,
13,
2220,
7,
17080,
62,
6759,
8609,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
14808,
17080,
62,
6759,
8609,
6624,
657,
737,
16345,
3419,
532,
1233,
62,
6759,
8609,
13,
43358,
58,
15,
12962,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
50,
4106,
2105,
23884,
25,
17503,
1233,
62,
6759,
8609,
4458,
18982,
7,
26675,
13,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
5260,
62,
6978,
796,
4776,
1220,
705,
47336,
6,
198,
220,
220,
220,
220,
220,
220,
220,
4263,
62,
6978,
796,
4776,
1220,
705,
1326,
5015,
62,
17566,
6,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
796,
651,
62,
42632,
7,
26675,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
42632,
8,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5260,
62,
6978,
796,
685,
26675,
1220,
636,
13,
3672,
1220,
705,
47336,
6,
329,
636,
287,
3354,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4263,
62,
6978,
796,
685,
26675,
1220,
636,
13,
3672,
1220,
705,
1326,
5015,
62,
17566,
6,
329,
636,
287,
3354,
60,
198,
220,
220,
220,
220,
220,
220,
220,
13946,
62,
17566,
796,
4776,
1220,
705,
565,
5819,
62,
17566,
6,
198,
220,
220,
220,
220,
220,
220,
220,
13946,
62,
17566,
13,
28015,
15908,
7,
38476,
62,
482,
28,
17821,
11,
3397,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32966,
11882,
796,
24291,
2601,
436,
11882,
7,
47336,
62,
6978,
11,
4263,
62,
6978,
11,
1233,
62,
6759,
8609,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32966,
11882,
13,
2220,
62,
1326,
5015,
62,
17566,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
32966,
11882,
13,
1136,
62,
30246,
62,
6759,
8609,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
32966,
11882,
13,
565,
5819,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
269,
287,
27056,
378,
7,
565,
436,
11882,
13,
565,
13654,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4263,
796,
32966,
11882,
13,
41464,
1096,
62,
565,
5819,
7,
66,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
11,
2939,
287,
27056,
378,
7,
17566,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2939,
13,
21928,
7,
565,
5819,
62,
17566,
1220,
705,
565,
5819,
23330,
27422,
90,
27422,
11134,
4458,
18982,
7,
72,
11,
474,
4008,
198
] | 2.298326 | 657 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import models, migrations
import jsonfield.fields
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
11,
15720,
602,
198,
11748,
33918,
3245,
13,
25747,
628
] | 3.269231 | 52 |
# Generated by Django 2.2.5 on 2019-09-29 21:17
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
20,
319,
13130,
12,
2931,
12,
1959,
2310,
25,
1558,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
from rest_framework import viewsets, permissions
from .serializers import PokemonSerializer
from .models import Pokemon
| [
6738,
1334,
62,
30604,
1330,
5009,
1039,
11,
21627,
198,
198,
6738,
764,
46911,
11341,
1330,
14878,
32634,
7509,
198,
6738,
764,
27530,
1330,
14878,
628
] | 4.692308 | 26 |
from typing import Callable
import torchvision.transforms as T
| [
6738,
19720,
1330,
4889,
540,
198,
198,
11748,
28034,
10178,
13,
7645,
23914,
355,
309,
628
] | 4.0625 | 16 |
"""
Cartesian grid for fold interpolator
"""
import logging
import numpy as np
logger = logging.getLogger(__name__)
class StructuredGrid:
"""
"""
def __init__(self,
origin=np.zeros(3),
nsteps=np.array([10, 10, 10]),
step_vector=np.ones(3),
):
"""
Parameters
----------
origin - 3d list or numpy array
nsteps - 3d list or numpy array of ints
step_vector - 3d list or numpy array of int
"""
self.nsteps = np.array(nsteps)
self.step_vector = np.array(step_vector)
self.origin = np.array(origin)
self.maximum = origin+self.nsteps*self.step_vector
# self.nsteps+=1
self.n_nodes = self.nsteps[0] * self.nsteps[1] * self.nsteps[2]
# self.nsteps-=1
self.dim = 3
self.nsteps_cells = self.nsteps - 1
self.n_cell_x = self.nsteps[0] - 1
self.n_cell_y = self.nsteps[1] - 1
self.n_cell_z = self.nsteps[2] - 1
self.properties = {}
self.n_elements = self.n_cell_x * self.n_cell_y * self.n_cell_z
# calculate the node positions using numpy (this should probably not
# be stored as it defeats
# the purpose of a structured grid
# self.barycentre = self.cell_centres(np.arange(self.n_elements))
self.regions = {}
self.regions['everywhere'] = np.ones(self.n_nodes).astype(bool)
@property
# @property
# def barycentre(self):
# return self.cell_centres(np.arange(self.n_elements))
def update_property(self, propertyname, values):
"""[summary]
[extended_summary]
Parameters
----------
propertyname : [type]
[description]
values : [type]
[description]
"""
if values.shape[0] == self.n_nodes:
self.properties[propertyname] = values
if values.shape[0] == self.n_elements:
self.cell_properties[propertyname] = values
def cell_centres(self, global_index):
"""[summary]
[extended_summary]
Parameters
----------
global_index : [type]
[description]
Returns
-------
[type]
[description]
"""
ix, iy, iz = self.global_index_to_cell_index(global_index)
x = self.origin[None, 0] + self.step_vector[None, 0] * .5 + \
self.step_vector[None, 0] * ix
y = self.origin[None, 1] + self.step_vector[None, 1] * .5 + \
self.step_vector[None, 1] * iy
z = self.origin[None, 2] + self.step_vector[None, 2] * .5 + \
self.step_vector[None, 2] * iz
return np.array([x, y, z]).T
def position_to_cell_index(self, pos):
"""[summary]
[extended_summary]
Parameters
----------
pos : [type]
[description]
Returns
-------
[type]
[description]
"""
pos = self.check_position(pos)
ix = pos[:, 0] - self.origin[None, 0]
iy = pos[:, 1] - self.origin[None, 1]
iz = pos[:, 2] - self.origin[None, 2]
ix = ix // self.step_vector[None, 0]
iy = iy // self.step_vector[None, 1]
iz = iz // self.step_vector[None, 2]
return ix.astype(int), iy.astype(int), iz.astype(int)
def check_position(self, pos):
"""[summary]
[extended_summary]
Parameters
----------
pos : [type]
[description]
Returns
-------
[type]
[description]
"""
if len(pos.shape) == 1:
pos = np.array([pos])
if len(pos.shape) != 2:
print("Position array needs to be a list of points or a point")
return False
return pos
def trilinear(self, x, y, z):
"""
returns the trilinear interpolation for the local coordinates
Parameters
----------
x - double, array of doubles
y - double, array of doubles
z - double, array of doubles
Returns
-------
array of interpolation coefficients
"""
return np.array([(1 - x) * (1 - y) * (1 - z),
x * (1 - y) * (1 - z),
(1 - x) * y * (1 - z),
(1 - x) * (1 - y) * z,
x * (1 - y) * z,
(1 - x) * y * z,
x * y * (1 - z),
x * y * z])
def position_to_local_coordinates(self, pos):
"""
Convert from global to local coordinates within a cel
Parameters
----------
pos - array of positions inside
Returns
-------
localx, localy, localz
"""
# TODO check if inside mesh
# calculate local coordinates for positions
local_x = ((pos[:, 0] - self.origin[None, 0]) % self.step_vector[
None, 0]) / self.step_vector[None, 0]
local_y = ((pos[:, 1] - self.origin[None, 1]) % self.step_vector[
None, 1]) / self.step_vector[None, 1]
local_z = ((pos[:, 2] - self.origin[None, 2]) % self.step_vector[
None, 2]) / self.step_vector[None, 2]
return local_x, local_y, local_z
def position_to_dof_coefs(self, pos):
"""
global posotion to interpolation coefficients
Parameters
----------
pos
Returns
-------
"""
x_local, y_local, local_z = self.position_to_local_coordinates(pos)
weights = self.trilinear(x_local, y_local, local_z)
return weights
def global_indicies(self, indexes):
"""
xi, yi, zi to global index
Parameters
----------
indexes
Returns
-------
"""
indexes = np.array(indexes).swapaxes(0, 2)
return indexes[:, :, 0] + self.nsteps[None, None, 0] * indexes[:, :,
1] + \
self.nsteps[None, None, 0] * self.nsteps[
None, None, 1] * indexes[:, :, 2]
def neighbour_global_indexes(self, mask = None, **kwargs):
"""
Get neighbour indexes
Parameters
----------
kwargs - indexes array specifying the cells to return neighbours
Returns
-------
"""
indexes = None
if "indexes" in kwargs:
indexes = kwargs['indexes']
if "indexes" not in kwargs:
ii = []
jj = []
kk = []
for i in range(1, self.nsteps[0] - 1):
for j in range(1, self.nsteps[1] - 1):
for k in range(1, self.nsteps[2] - 1):
kk.append(k)
ii.append(i)
jj.append(j)
indexes = np.array([ii, jj, kk])
# indexes = np.array(indexes).T
if indexes.ndim != 2:
print(indexes.ndim)
return
# determine which neighbours to return default is diagonals included.
if mask is None:
mask = np.array([
[-1, 0, 1, -1, 0, 1, -1, 0, 1,
-1, 0, 1, -1, 0, 1, -1, 0, 1,
-1, 0, 1, -1, 0, 1, -1, 0, 1],
[-1, -1, -1, 0, 0, 0, 1, 1, 1,
-1, -1, -1, 0, 0, 0, 1, 1, 1,
-1, -1, -1, 0, 0, 0, 1, 1, 1],
[-1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1]
])
neighbours = indexes[:, None, :] + mask[:, :, None]
return(neighbours[0, :, :] + self.nsteps[0, None, None] * neighbours[1,
:, :] + \
self.nsteps[0, None, None] * self.nsteps[
1, None, None] * neighbours[2, :, :]).astype(np.int64)
def cell_corner_indexes(self, x_cell_index, y_cell_index, z_cell_index):
"""
Returns the indexes of the corners of a cell given its location xi,
yi, zi
Parameters
----------
x_cell_index
y_cell_index
z_cell_index
Returns
-------
"""
xcorner = np.array([0, 1, 0, 0, 1, 0, 1, 1])
ycorner = np.array([0, 0, 1, 0, 0, 1, 1, 1])
zcorner = np.array([0, 0, 0, 1, 1, 1, 0, 1])
xcorners = x_cell_index[:, None] + xcorner[None, :]
ycorners = y_cell_index[:, None] + ycorner[None, :]
zcorners = z_cell_index[:, None] + zcorner[None, :]
return xcorners, ycorners, zcorners
def global_index_to_cell_index(self, global_index):
"""
Convert from global indexes to xi,yi,zi
Parameters
----------
global_index
Returns
-------
"""
# determine the ijk indices for the global index.
# remainder when dividing by nx = i
# remained when dividing modulus of nx by ny is j
x_index = global_index % self.nsteps_cells[0, None]
y_index = global_index // self.nsteps_cells[0, None] % \
self.nsteps_cells[1, None]
z_index = global_index // self.nsteps_cells[0, None] // \
self.nsteps_cells[1, None]
return x_index, y_index, z_index
def evaluate_value(self, evaluation_points, property_name):
"""
Evaluate the value of of the property at the locations.
Trilinear interpolation dot corner values
Parameters
----------
evaluation_points np array of locations
property_name string of property name
Returns
-------
"""
idc, inside = self.position_to_cell_corners(evaluation_points)
v = np.zeros(idc.shape)
v[:, :] = np.nan
v[inside, :] = self.position_to_dof_coefs(
evaluation_points[inside, :]).T
v[inside, :] *= self.properties[property_name][idc[inside, :]]
return np.sum(v, axis=1)
def calcul_T(self, pos):
"""
Calculates the gradient matrix at location pos
:param pos: numpy array of location Nx3
:return: Nx3x4 matrix
"""
# 6_ _ _ _ 8
# /| /|
# 4 /_| 5/ |
# | 2|_ _|_| 7
# | / | /
# |/_ _ _|/
# 0 1
#
# xindex, yindex, zindex = self.position_to_cell_index(pos)
# cellx, celly, cellz = self.cell_corner_indexes(xindex, yindex,zindex)
# x, y, z = self.node_indexes_to_position(cellx, celly, cellz)
T = np.zeros((pos.shape[0], 3, 8))
x, y, z = self.position_to_local_coordinates(pos)
# div = self.step_vector[0] * self.step_vector[1] * self.step_vector[2]
T[:, 0, 0] = -(1 - y) * (1 - z) # v000
T[:, 0, 1] = (1 - y) * (1 - z) # (y[:, 3] - pos[:, 1]) / div
T[:, 0, 2] = -y * (1 - z) # (pos[:, 1] - y[:, 0]) / div
T[:, 0, 3] = -(1 - y) * z # (pos[:, 1] - y[:, 1]) / div
T[:, 0, 4] = (1 - y) * z
T[:, 0, 5] = - y * z
T[:, 0, 6] = y * (1 - z)
T[:, 0, 7] = y * z
T[:, 1, 0] = - (1 - x) * (1 - z)
T[:, 1, 1] = - x * (1 - z)
T[:, 1, 2] = (1 - x) * (1 - z)
T[:, 1, 3] = -(1 - x) * z
T[:, 1, 4] = -x * z
T[:, 1, 5] = (1 - x) * z
T[:, 1, 6] = x * (1 - z)
T[:, 1, 7] = x * z
T[:, 2, 0] = -(1 - x) * (1 - y)
T[:, 2, 1] = - x * (1 - y)
T[:, 2, 2] = - (1 - x) * y
T[:, 2, 3] = (1 - x) * (1 - y)
T[:, 2, 4] = x * (1 - y)
T[:, 2, 5] = (1 - x) * y
T[:, 2, 6] = - x * y
T[:, 2, 7] = x * y
return T
| [
37811,
198,
43476,
35610,
10706,
329,
5591,
39555,
1352,
198,
198,
37811,
198,
11748,
18931,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
4871,
32112,
1522,
41339,
25,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8159,
28,
37659,
13,
9107,
418,
7,
18,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
20214,
28,
37659,
13,
18747,
26933,
940,
11,
838,
11,
838,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
62,
31364,
28,
37659,
13,
1952,
7,
18,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15179,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8159,
532,
513,
67,
1351,
393,
299,
32152,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
299,
20214,
532,
513,
67,
1351,
393,
299,
32152,
7177,
286,
493,
82,
198,
220,
220,
220,
220,
220,
220,
220,
2239,
62,
31364,
532,
513,
67,
1351,
393,
299,
32152,
7177,
286,
493,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
796,
45941,
13,
18747,
7,
77,
20214,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9662,
62,
31364,
796,
45941,
13,
18747,
7,
9662,
62,
31364,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47103,
796,
45941,
13,
18747,
7,
47103,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47033,
796,
8159,
10,
944,
13,
77,
20214,
9,
944,
13,
9662,
62,
31364,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
77,
20214,
47932,
16,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
62,
77,
4147,
796,
2116,
13,
77,
20214,
58,
15,
60,
1635,
2116,
13,
77,
20214,
58,
16,
60,
1635,
2116,
13,
77,
20214,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
77,
20214,
12,
28,
16,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
27740,
796,
513,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
62,
46342,
796,
2116,
13,
77,
20214,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
62,
3846,
62,
87,
796,
2116,
13,
77,
20214,
58,
15,
60,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
62,
3846,
62,
88,
796,
2116,
13,
77,
20214,
58,
16,
60,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
62,
3846,
62,
89,
796,
2116,
13,
77,
20214,
58,
17,
60,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
48310,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
62,
68,
3639,
796,
2116,
13,
77,
62,
3846,
62,
87,
1635,
2116,
13,
77,
62,
3846,
62,
88,
1635,
2116,
13,
77,
62,
3846,
62,
89,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
15284,
262,
10139,
6116,
1262,
299,
32152,
357,
5661,
815,
2192,
407,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
307,
8574,
355,
340,
29234,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
4007,
286,
257,
20793,
10706,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
65,
560,
1087,
260,
796,
2116,
13,
3846,
62,
1087,
411,
7,
37659,
13,
283,
858,
7,
944,
13,
77,
62,
68,
3639,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2301,
507,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2301,
507,
17816,
16833,
3003,
20520,
796,
45941,
13,
1952,
7,
944,
13,
77,
62,
77,
4147,
737,
459,
2981,
7,
30388,
8,
628,
198,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
1303,
2488,
26745,
198,
220,
220,
220,
1303,
825,
275,
560,
1087,
260,
7,
944,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1441,
2116,
13,
3846,
62,
1087,
411,
7,
37659,
13,
283,
858,
7,
944,
13,
77,
62,
68,
3639,
4008,
628,
220,
220,
220,
825,
4296,
62,
26745,
7,
944,
11,
3119,
3672,
11,
3815,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
13538,
17912,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
685,
2302,
1631,
62,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
3119,
3672,
1058,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
198,
220,
220,
220,
220,
220,
220,
220,
3815,
1058,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3815,
13,
43358,
58,
15,
60,
6624,
2116,
13,
77,
62,
77,
4147,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
48310,
58,
26745,
3672,
60,
796,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3815,
13,
43358,
58,
15,
60,
6624,
2116,
13,
77,
62,
68,
3639,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3846,
62,
48310,
58,
26745,
3672,
60,
796,
3815,
628,
220,
220,
220,
825,
2685,
62,
1087,
411,
7,
944,
11,
3298,
62,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
13538,
17912,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
685,
2302,
1631,
62,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
62,
9630,
1058,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
220,
844,
11,
1312,
88,
11,
220,
528,
796,
2116,
13,
20541,
62,
9630,
62,
1462,
62,
3846,
62,
9630,
7,
20541,
62,
9630,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2116,
13,
47103,
58,
14202,
11,
657,
60,
1343,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
657,
60,
1635,
764,
20,
1343,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
657,
60,
1635,
220,
844,
198,
220,
220,
220,
220,
220,
220,
220,
331,
796,
2116,
13,
47103,
58,
14202,
11,
352,
60,
1343,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
352,
60,
1635,
764,
20,
1343,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
352,
60,
1635,
1312,
88,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
796,
2116,
13,
47103,
58,
14202,
11,
362,
60,
1343,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
362,
60,
1635,
764,
20,
1343,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
362,
60,
1635,
220,
528,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
18747,
26933,
87,
11,
331,
11,
1976,
35944,
51,
628,
220,
220,
220,
825,
2292,
62,
1462,
62,
3846,
62,
9630,
7,
944,
11,
1426,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
13538,
17912,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
685,
2302,
1631,
62,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1426,
1058,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1426,
796,
2116,
13,
9122,
62,
9150,
7,
1930,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
844,
796,
1426,
58,
45299,
657,
60,
532,
2116,
13,
47103,
58,
14202,
11,
657,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
88,
796,
1426,
58,
45299,
352,
60,
532,
2116,
13,
47103,
58,
14202,
11,
352,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
528,
796,
1426,
58,
45299,
362,
60,
532,
2116,
13,
47103,
58,
14202,
11,
362,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
844,
796,
220,
844,
3373,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
657,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
88,
796,
1312,
88,
3373,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
352,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
528,
796,
220,
528,
3373,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
362,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
220,
844,
13,
459,
2981,
7,
600,
828,
1312,
88,
13,
459,
2981,
7,
600,
828,
220,
528,
13,
459,
2981,
7,
600,
8,
628,
220,
220,
220,
825,
2198,
62,
9150,
7,
944,
11,
1426,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
13538,
17912,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
685,
2302,
1631,
62,
49736,
60,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1426,
1058,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
685,
4906,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11213,
60,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
1930,
13,
43358,
8,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1426,
796,
45941,
13,
18747,
26933,
1930,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
1930,
13,
43358,
8,
14512,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
26545,
7177,
2476,
284,
307,
257,
1351,
286,
2173,
393,
257,
966,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1426,
628,
220,
220,
220,
825,
491,
346,
259,
451,
7,
944,
11,
2124,
11,
331,
11,
1976,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5860,
262,
491,
346,
259,
451,
39555,
341,
329,
262,
1957,
22715,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
532,
4274,
11,
7177,
286,
21938,
198,
220,
220,
220,
220,
220,
220,
220,
331,
532,
4274,
11,
7177,
286,
21938,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
532,
4274,
11,
7177,
286,
21938,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
7177,
286,
39555,
341,
44036,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
18747,
26933,
7,
16,
532,
2124,
8,
1635,
357,
16,
532,
331,
8,
1635,
357,
16,
532,
1976,
828,
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,
2124,
1635,
357,
16,
532,
331,
8,
1635,
357,
16,
532,
1976,
828,
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,
357,
16,
532,
2124,
8,
1635,
331,
1635,
357,
16,
532,
1976,
828,
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,
357,
16,
532,
2124,
8,
1635,
357,
16,
532,
331,
8,
1635,
1976,
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,
2124,
1635,
357,
16,
532,
331,
8,
1635,
1976,
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,
357,
16,
532,
2124,
8,
1635,
331,
1635,
1976,
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,
2124,
1635,
331,
1635,
357,
16,
532,
1976,
828,
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,
2124,
1635,
331,
1635,
1976,
12962,
628,
220,
220,
220,
825,
2292,
62,
1462,
62,
12001,
62,
37652,
17540,
7,
944,
11,
1426,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
38240,
422,
3298,
284,
1957,
22715,
1626,
257,
18725,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1426,
532,
7177,
286,
6116,
2641,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
87,
11,
1957,
88,
11,
1957,
89,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
2198,
611,
2641,
19609,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
15284,
1957,
22715,
329,
6116,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
62,
87,
796,
14808,
1930,
58,
45299,
657,
60,
532,
2116,
13,
47103,
58,
14202,
11,
657,
12962,
4064,
2116,
13,
9662,
62,
31364,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
657,
12962,
1220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
657,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
62,
88,
796,
14808,
1930,
58,
45299,
352,
60,
532,
2116,
13,
47103,
58,
14202,
11,
352,
12962,
4064,
2116,
13,
9662,
62,
31364,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
352,
12962,
1220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
352,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
62,
89,
796,
14808,
1930,
58,
45299,
362,
60,
532,
2116,
13,
47103,
58,
14202,
11,
362,
12962,
4064,
2116,
13,
9662,
62,
31364,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
362,
12962,
1220,
2116,
13,
9662,
62,
31364,
58,
14202,
11,
362,
60,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
1957,
62,
87,
11,
1957,
62,
88,
11,
1957,
62,
89,
628,
220,
220,
220,
825,
2292,
62,
1462,
62,
67,
1659,
62,
1073,
891,
82,
7,
944,
11,
1426,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
1426,
9650,
284,
39555,
341,
44036,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1426,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
12001,
11,
331,
62,
12001,
11,
1957,
62,
89,
796,
2116,
13,
9150,
62,
1462,
62,
12001,
62,
37652,
17540,
7,
1930,
8,
198,
220,
220,
220,
220,
220,
220,
220,
19590,
796,
2116,
13,
2213,
346,
259,
451,
7,
87,
62,
12001,
11,
331,
62,
12001,
11,
1957,
62,
89,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
19590,
628,
220,
220,
220,
825,
3298,
62,
521,
291,
444,
7,
944,
11,
39199,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
72,
11,
331,
72,
11,
1976,
72,
284,
3298,
6376,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
39199,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
39199,
796,
45941,
13,
18747,
7,
9630,
274,
737,
2032,
499,
897,
274,
7,
15,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
39199,
58,
45299,
1058,
11,
657,
60,
1343,
2116,
13,
77,
20214,
58,
14202,
11,
6045,
11,
657,
60,
1635,
39199,
58,
45299,
1058,
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,
352,
60,
1343,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
58,
14202,
11,
6045,
11,
657,
60,
1635,
2116,
13,
77,
20214,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
6045,
11,
352,
60,
1635,
39199,
58,
45299,
1058,
11,
362,
60,
628,
220,
220,
220,
825,
12250,
62,
20541,
62,
9630,
274,
7,
944,
11,
9335,
796,
6045,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3497,
12250,
39199,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
479,
86,
22046,
532,
39199,
7177,
31577,
262,
4778,
284,
1441,
23788,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
39199,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
611,
366,
9630,
274,
1,
287,
479,
86,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39199,
796,
479,
86,
22046,
17816,
9630,
274,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
611,
366,
9630,
274,
1,
407,
287,
479,
86,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21065,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
474,
73,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
74,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
16,
11,
2116,
13,
77,
20214,
58,
15,
60,
532,
352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
2837,
7,
16,
11,
2116,
13,
77,
20214,
58,
16,
60,
532,
352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
2837,
7,
16,
11,
2116,
13,
77,
20214,
58,
17,
60,
532,
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,
479,
74,
13,
33295,
7,
74,
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,
21065,
13,
33295,
7,
72,
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,
474,
73,
13,
33295,
7,
73,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39199,
796,
45941,
13,
18747,
26933,
4178,
11,
474,
73,
11,
479,
74,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
39199,
796,
45941,
13,
18747,
7,
9630,
274,
737,
51,
198,
220,
220,
220,
220,
220,
220,
220,
611,
39199,
13,
358,
320,
14512,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
9630,
274,
13,
358,
320,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5004,
543,
23788,
284,
1441,
4277,
318,
2566,
1840,
874,
3017,
13,
198,
220,
220,
220,
220,
220,
220,
220,
611,
9335,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9335,
796,
45941,
13,
18747,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25915,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
11,
532,
16,
11,
657,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25915,
16,
11,
532,
16,
11,
532,
16,
11,
657,
11,
657,
11,
657,
11,
352,
11,
352,
11,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
16,
11,
532,
16,
11,
532,
16,
11,
657,
11,
657,
11,
657,
11,
352,
11,
352,
11,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
16,
11,
532,
16,
11,
532,
16,
11,
657,
11,
657,
11,
657,
11,
352,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25915,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
532,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
352,
11,
352,
11,
352,
11,
352,
11,
352,
11,
352,
11,
352,
11,
352,
11,
352,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33761,
198,
220,
220,
220,
220,
220,
220,
220,
23788,
796,
39199,
58,
45299,
6045,
11,
1058,
60,
1343,
9335,
58,
45299,
1058,
11,
6045,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
710,
394,
65,
4662,
58,
15,
11,
1058,
11,
1058,
60,
1343,
2116,
13,
77,
20214,
58,
15,
11,
6045,
11,
6045,
60,
1635,
23788,
58,
16,
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,
220,
220,
1058,
11,
1058,
60,
1343,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
58,
15,
11,
6045,
11,
6045,
60,
1635,
2116,
13,
77,
20214,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
352,
11,
6045,
11,
6045,
60,
1635,
23788,
58,
17,
11,
1058,
11,
1058,
35944,
459,
2981,
7,
37659,
13,
600,
2414,
8,
628,
220,
220,
220,
825,
2685,
62,
10215,
1008,
62,
9630,
274,
7,
944,
11,
2124,
62,
3846,
62,
9630,
11,
331,
62,
3846,
62,
9630,
11,
1976,
62,
3846,
62,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
39199,
286,
262,
14371,
286,
257,
2685,
1813,
663,
4067,
2124,
72,
11,
198,
220,
220,
220,
220,
220,
220,
220,
331,
72,
11,
1976,
72,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
3846,
62,
9630,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
3846,
62,
9630,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
3846,
62,
9630,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
10215,
1008,
796,
45941,
13,
18747,
26933,
15,
11,
352,
11,
657,
11,
657,
11,
352,
11,
657,
11,
352,
11,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
331,
10215,
1008,
796,
45941,
13,
18747,
26933,
15,
11,
657,
11,
352,
11,
657,
11,
657,
11,
352,
11,
352,
11,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
10215,
1008,
796,
45941,
13,
18747,
26933,
15,
11,
657,
11,
657,
11,
352,
11,
352,
11,
352,
11,
657,
11,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
20772,
364,
796,
2124,
62,
3846,
62,
9630,
58,
45299,
6045,
60,
1343,
2124,
10215,
1008,
58,
14202,
11,
1058,
60,
198,
220,
220,
220,
220,
220,
220,
220,
331,
20772,
364,
796,
331,
62,
3846,
62,
9630,
58,
45299,
6045,
60,
1343,
331,
10215,
1008,
58,
14202,
11,
1058,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
20772,
364,
796,
1976,
62,
3846,
62,
9630,
58,
45299,
6045,
60,
1343,
1976,
10215,
1008,
58,
14202,
11,
1058,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
20772,
364,
11,
331,
20772,
364,
11,
1976,
20772,
364,
628,
220,
220,
220,
825,
3298,
62,
9630,
62,
1462,
62,
3846,
62,
9630,
7,
944,
11,
3298,
62,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
38240,
422,
3298,
39199,
284,
2124,
72,
11,
48111,
11,
17027,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
62,
9630,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5004,
262,
1312,
73,
74,
36525,
329,
262,
3298,
6376,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
17675,
618,
27241,
416,
299,
87,
796,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6150,
618,
27241,
953,
23515,
286,
299,
87,
416,
299,
88,
318,
474,
628,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
9630,
796,
3298,
62,
9630,
4064,
2116,
13,
77,
20214,
62,
46342,
58,
15,
11,
6045,
60,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
9630,
796,
3298,
62,
9630,
3373,
2116,
13,
77,
20214,
62,
46342,
58,
15,
11,
6045,
60,
4064,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
62,
46342,
58,
16,
11,
6045,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
9630,
796,
3298,
62,
9630,
3373,
2116,
13,
77,
20214,
62,
46342,
58,
15,
11,
6045,
60,
3373,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
20214,
62,
46342,
58,
16,
11,
6045,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
62,
9630,
11,
331,
62,
9630,
11,
1976,
62,
9630,
628,
220,
220,
220,
825,
13446,
62,
8367,
7,
944,
11,
12660,
62,
13033,
11,
3119,
62,
3672,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
26439,
4985,
262,
1988,
286,
286,
262,
3119,
379,
262,
7064,
13,
198,
220,
220,
220,
220,
220,
220,
220,
833,
346,
259,
451,
39555,
341,
16605,
5228,
3815,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
12660,
62,
13033,
45941,
7177,
286,
7064,
198,
220,
220,
220,
220,
220,
220,
220,
3119,
62,
3672,
4731,
286,
3119,
1438,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
66,
11,
2641,
796,
2116,
13,
9150,
62,
1462,
62,
3846,
62,
20772,
364,
7,
18206,
2288,
62,
13033,
8,
198,
220,
220,
220,
220,
220,
220,
220,
410,
796,
45941,
13,
9107,
418,
7,
312,
66,
13,
43358,
8,
198,
220,
220,
220,
220,
220,
220,
220,
410,
58,
45299,
1058,
60,
796,
45941,
13,
12647,
628,
220,
220,
220,
220,
220,
220,
220,
410,
58,
48787,
11,
1058,
60,
796,
2116,
13,
9150,
62,
1462,
62,
67,
1659,
62,
1073,
891,
82,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12660,
62,
13033,
58,
48787,
11,
1058,
35944,
51,
198,
220,
220,
220,
220,
220,
220,
220,
410,
58,
48787,
11,
1058,
60,
1635,
28,
2116,
13,
48310,
58,
26745,
62,
3672,
7131,
312,
66,
58,
48787,
11,
1058,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
16345,
7,
85,
11,
16488,
28,
16,
8,
628,
220,
220,
220,
825,
5204,
62,
51,
7,
944,
11,
1426,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
27131,
689,
262,
31312,
17593,
379,
4067,
1426,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1426,
25,
299,
32152,
7177,
286,
4067,
399,
87,
18,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
399,
87,
18,
87,
19,
17593,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
718,
62,
4808,
4808,
4808,
807,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
1220,
91,
220,
220,
220,
1220,
91,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
604,
1220,
62,
91,
220,
642,
14,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
930,
362,
91,
62,
4808,
91,
62,
91,
767,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
930,
1220,
220,
220,
220,
930,
1220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
930,
47835,
4808,
4808,
91,
14,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
657,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2124,
9630,
11,
331,
9630,
11,
1976,
9630,
796,
2116,
13,
9150,
62,
1462,
62,
3846,
62,
9630,
7,
1930,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2685,
87,
11,
2685,
88,
11,
2685,
89,
796,
2116,
13,
3846,
62,
10215,
1008,
62,
9630,
274,
7,
87,
9630,
11,
331,
9630,
11,
89,
9630,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2124,
11,
331,
11,
1976,
796,
2116,
13,
17440,
62,
9630,
274,
62,
1462,
62,
9150,
7,
3846,
87,
11,
2685,
88,
11,
2685,
89,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
796,
45941,
13,
9107,
418,
19510,
1930,
13,
43358,
58,
15,
4357,
513,
11,
807,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
11,
331,
11,
1976,
796,
2116,
13,
9150,
62,
1462,
62,
12001,
62,
37652,
17540,
7,
1930,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2659,
796,
2116,
13,
9662,
62,
31364,
58,
15,
60,
1635,
2116,
13,
9662,
62,
31364,
58,
16,
60,
1635,
2116,
13,
9662,
62,
31364,
58,
17,
60,
628,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
657,
60,
796,
532,
7,
16,
532,
331,
8,
1635,
357,
16,
532,
1976,
8,
220,
1303,
410,
830,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
352,
60,
796,
357,
16,
532,
331,
8,
1635,
357,
16,
532,
1976,
8,
220,
1303,
357,
88,
58,
45299,
513,
60,
532,
1426,
58,
45299,
352,
12962,
1220,
2659,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
362,
60,
796,
532,
88,
1635,
357,
16,
532,
1976,
8,
220,
1303,
357,
1930,
58,
45299,
352,
60,
532,
331,
58,
45299,
657,
12962,
1220,
2659,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
513,
60,
796,
532,
7,
16,
532,
331,
8,
1635,
1976,
220,
1303,
357,
1930,
58,
45299,
352,
60,
532,
331,
58,
45299,
352,
12962,
1220,
2659,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
604,
60,
796,
357,
16,
532,
331,
8,
1635,
1976,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
642,
60,
796,
532,
331,
1635,
1976,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
718,
60,
796,
331,
1635,
357,
16,
532,
1976,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
657,
11,
767,
60,
796,
331,
1635,
1976,
628,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
657,
60,
796,
532,
357,
16,
532,
2124,
8,
1635,
357,
16,
532,
1976,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
352,
60,
796,
532,
2124,
1635,
357,
16,
532,
1976,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
362,
60,
796,
357,
16,
532,
2124,
8,
1635,
357,
16,
532,
1976,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
513,
60,
796,
532,
7,
16,
532,
2124,
8,
1635,
1976,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
604,
60,
796,
532,
87,
1635,
1976,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
642,
60,
796,
357,
16,
532,
2124,
8,
1635,
1976,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
718,
60,
796,
2124,
1635,
357,
16,
532,
1976,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
352,
11,
767,
60,
796,
2124,
1635,
1976,
628,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
657,
60,
796,
532,
7,
16,
532,
2124,
8,
1635,
357,
16,
532,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
352,
60,
796,
532,
2124,
1635,
357,
16,
532,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
362,
60,
796,
532,
357,
16,
532,
2124,
8,
1635,
331,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
513,
60,
796,
357,
16,
532,
2124,
8,
1635,
357,
16,
532,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
604,
60,
796,
2124,
1635,
357,
16,
532,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
642,
60,
796,
357,
16,
532,
2124,
8,
1635,
331,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
718,
60,
796,
532,
2124,
1635,
331,
198,
220,
220,
220,
220,
220,
220,
220,
309,
58,
45299,
362,
11,
767,
60,
796,
2124,
1635,
331,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
309,
198
] | 1.869991 | 6,338 |
# -*- coding: utf-8 -*-
from behave import given, when, then
from selenium import webdriver
from should_dsl import should
@given(u'que o usuário abre o navegador')
@when(u'acessa a url "{url}"')
@then(u'o sistema exibe a pagina de login')
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
17438,
1330,
1813,
11,
618,
11,
788,
198,
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
815,
62,
67,
6649,
1330,
815,
628,
198,
31,
35569,
7,
84,
6,
4188,
267,
514,
84,
6557,
27250,
450,
260,
267,
299,
1015,
70,
7079,
11537,
628,
198,
31,
12518,
7,
84,
6,
330,
21411,
257,
19016,
45144,
6371,
36786,
11537,
628,
198,
31,
8524,
7,
84,
6,
78,
264,
396,
19687,
409,
32438,
257,
42208,
1437,
390,
17594,
11537,
198
] | 2.606383 | 94 |
"""
仓库服务的库存监控
"""
from alarm.page.ding_talk import DingTalk
from crontab.config import prod_filter_warehouse_ids, ROBOT_TOKEN
from crontab.model.mysql.order_goods import OrderGoods
from crontab.model.mysql.order_info import OrderInfo
from crontab.model.mysql.product import Product
if __name__ == '__main__':
StockMonitor().run()
| [
37811,
198,
20015,
241,
41753,
241,
17312,
235,
27950,
94,
21410,
41753,
241,
27764,
246,
33566,
239,
162,
236,
100,
198,
37811,
198,
6738,
10436,
13,
7700,
13,
12083,
62,
16620,
1330,
46980,
25685,
198,
6738,
1067,
756,
397,
13,
11250,
1330,
40426,
62,
24455,
62,
1574,
4803,
62,
2340,
11,
36449,
2394,
62,
10468,
43959,
198,
6738,
1067,
756,
397,
13,
19849,
13,
28744,
13976,
13,
2875,
62,
11274,
82,
1330,
8284,
10248,
82,
198,
6738,
1067,
756,
397,
13,
19849,
13,
28744,
13976,
13,
2875,
62,
10951,
1330,
8284,
12360,
198,
6738,
1067,
756,
397,
13,
19849,
13,
28744,
13976,
13,
11167,
1330,
8721,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
10500,
35479,
22446,
5143,
3419,
198
] | 2.612403 | 129 |
import tensorflow as tf
__all__ = ["batchify"]
| [
11748,
11192,
273,
11125,
355,
48700,
628,
198,
834,
439,
834,
796,
14631,
43501,
1958,
8973,
628
] | 2.941176 | 17 |
# shebang goes here
import argparse, shutil
parser = argparse.ArgumentParser(description='TODO')
parser.add_argument('destination', help='Destination to copy files')
parser.add_argument('-f',action='count',help='Force script to copy all files regardless of size')
args = parser.parse_args()
if __name__ == "__main__":
dest_path = args.destination
print("End")
| [
2,
673,
36668,
2925,
994,
198,
198,
11748,
1822,
29572,
11,
4423,
346,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
51,
3727,
46,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
16520,
1883,
3256,
1037,
11639,
24159,
1883,
284,
4866,
3696,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
69,
3256,
2673,
11639,
9127,
3256,
16794,
11639,
10292,
4226,
284,
4866,
477,
3696,
7692,
286,
2546,
11537,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
2244,
62,
6978,
796,
26498,
13,
16520,
1883,
628,
220,
220,
220,
3601,
7203,
12915,
4943,
198
] | 3.206897 | 116 |
#!/usr/bin/env python
from os.path import dirname, join
from setuptools import setup, find_packages
name = "ktop"
brand = "ripxl"
full_name = "Dead Pixel Collective"
with open(join(dirname(__file__), "src", name, "__init__.py")) as fp:
for i, line in enumerate(fp.readlines()):
if line.startswith("__version__ ="):
__version__ = line.split(" ")[2][1:-2]
setup(
name=name,
version=__version__,
url=f"https://github.com/{brand}/{name}",
author=full_name,
author_email=f"{brand}@googlegroups.com",
description="Use Notebooks and Kernels like Widgets",
packages=find_packages("src"),
package_dir={"": "src"},
install_requires=[
"ipywidgets >=7.0.0",
"jupyter_client >=5.2.1",
"nbformat >=4.4.0",
],
license="BSD-3-Clause",
include_package_data=True,
zip_safe=False,
keywords="jupyter notebook kernel widget ipywidgets traitlets ipynb",
)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
6738,
28686,
13,
6978,
1330,
26672,
3672,
11,
4654,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
198,
198,
3672,
796,
366,
16201,
1,
198,
17938,
796,
366,
5528,
87,
75,
1,
198,
12853,
62,
3672,
796,
366,
20489,
11349,
29128,
1,
198,
198,
4480,
1280,
7,
22179,
7,
15908,
3672,
7,
834,
7753,
834,
828,
366,
10677,
1600,
1438,
11,
366,
834,
15003,
834,
13,
9078,
48774,
355,
277,
79,
25,
198,
220,
220,
220,
329,
1312,
11,
1627,
287,
27056,
378,
7,
46428,
13,
961,
6615,
3419,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
13,
9688,
2032,
342,
7203,
834,
9641,
834,
796,
1,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11593,
9641,
834,
796,
1627,
13,
35312,
7203,
366,
38381,
17,
7131,
16,
21912,
17,
60,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
28,
3672,
11,
198,
220,
220,
220,
2196,
28,
834,
9641,
834,
11,
198,
220,
220,
220,
19016,
28,
69,
1,
5450,
1378,
12567,
13,
785,
14,
90,
17938,
92,
14,
90,
3672,
92,
1600,
198,
220,
220,
220,
1772,
28,
12853,
62,
3672,
11,
198,
220,
220,
220,
1772,
62,
12888,
28,
69,
1,
90,
17938,
92,
31,
2188,
519,
1455,
14459,
13,
785,
1600,
198,
220,
220,
220,
6764,
2625,
11041,
5740,
12106,
290,
509,
44930,
588,
24801,
11407,
1600,
198,
220,
220,
220,
10392,
28,
19796,
62,
43789,
7203,
10677,
12340,
198,
220,
220,
220,
5301,
62,
15908,
28,
4895,
1298,
366,
10677,
25719,
198,
220,
220,
220,
2721,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
541,
88,
28029,
11407,
18189,
22,
13,
15,
13,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
73,
929,
88,
353,
62,
16366,
18189,
20,
13,
17,
13,
16,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
46803,
18982,
18189,
19,
13,
19,
13,
15,
1600,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
5964,
2625,
21800,
12,
18,
12,
2601,
682,
1600,
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,
26286,
2625,
73,
929,
88,
353,
20922,
9720,
26295,
20966,
88,
28029,
11407,
1291,
2578,
912,
20966,
2047,
65,
1600,
198,
8,
198
] | 2.340796 | 402 |
#!/usr/bin/env python
"""
A python library for the Udacity Project Advanced Lane Lines
This library is designed to abstract away some useful functions, so that using this code
for images/video becomes almost like calling an API
"""
import numpy as np
import cv2
import glob
import pickle
from pprint import pprint
# The following globals are designed to make development/debug easier. In a more real world enviornment,
# Both of these would be turned off.
DEBUG = 1 # A switch for print statements. Turn off to make the script not print out anything
OUTPUT_STEPS = 1 # A switch for writing out files. Turn on to output images from each individual step.
# From the Udactiy Lessons, we have some helpful functions.
# I have left the comments in to help explain what is happening here | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
220,
198,
37811,
198,
32,
21015,
5888,
329,
262,
35774,
4355,
4935,
13435,
15016,
26299,
198,
198,
1212,
5888,
318,
3562,
284,
12531,
1497,
617,
4465,
5499,
11,
523,
326,
1262,
428,
2438,
198,
1640,
4263,
14,
15588,
4329,
2048,
588,
4585,
281,
7824,
198,
37811,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
198,
11748,
15095,
198,
11748,
2298,
293,
198,
6738,
279,
4798,
1330,
279,
4798,
198,
198,
2,
383,
1708,
15095,
874,
389,
3562,
284,
787,
2478,
14,
24442,
4577,
13,
220,
554,
257,
517,
1103,
995,
551,
8903,
1211,
434,
11,
198,
2,
5747,
286,
777,
561,
307,
2900,
572,
13,
198,
30531,
796,
352,
1303,
317,
5078,
329,
3601,
6299,
13,
220,
6756,
572,
284,
787,
262,
4226,
407,
3601,
503,
1997,
198,
2606,
7250,
3843,
62,
30516,
3705,
796,
352,
1303,
317,
5078,
329,
3597,
503,
3696,
13,
220,
6756,
319,
284,
5072,
4263,
422,
1123,
1981,
2239,
13,
198,
198,
2,
3574,
262,
35774,
529,
7745,
46885,
11,
356,
423,
617,
7613,
5499,
13,
198,
2,
314,
423,
1364,
262,
3651,
287,
284,
1037,
4727,
644,
318,
5836,
994
] | 4 | 197 |
#!/usr/bin/env python3
# Natural Language Processing example performing
# sentiment analysis and setting a Belleds light to
# a color matching sentiment.
#
# Example usage:
# echo "I hate you and I'm having a terrible day" | ./sample-sentiment.py
# => user is angry, light turns red
# echo "I love chocolate. So awesome!" | ./sample-sentiment.py
# => user is happy, light turns green
from belleds import Belleds
import json
import sys
import urllib.request, urllib.parse
# main code
b = Belleds()
b.connect('192.168.1.139')
lights = b.get_lights()
text = "".join(sys.stdin.readlines())
params = urllib.parse.urlencode({'text': text })
request = urllib.request.urlopen("http://text-processing.com/api/sentiment/", params.encode('utf-8'))
data = json.loads(request.read().decode('utf-8'))
print(data)
r = int(data.get('probability',{}).get('neg',1)*255)
g = int(data.get('probability',{}).get('pos',1)*255)
b = int(data.get('probability',{}).get('neutral',1)*255)
for light in lights:
light.color = (r, g, b)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
2,
12068,
15417,
28403,
1672,
9489,
198,
2,
15598,
3781,
290,
4634,
257,
7459,
5379,
1657,
284,
198,
2,
257,
3124,
12336,
15598,
13,
198,
2,
198,
2,
17934,
8748,
25,
198,
2,
9809,
366,
40,
5465,
345,
290,
314,
1101,
1719,
257,
7818,
1110,
1,
930,
24457,
39873,
12,
34086,
3681,
13,
9078,
198,
2,
5218,
2836,
318,
7954,
11,
1657,
4962,
2266,
198,
2,
9809,
366,
40,
1842,
11311,
13,
1406,
7427,
2474,
930,
24457,
39873,
12,
34086,
3681,
13,
9078,
198,
2,
5218,
2836,
318,
3772,
11,
1657,
4962,
4077,
198,
198,
6738,
307,
3353,
82,
1330,
7459,
5379,
198,
11748,
33918,
198,
11748,
25064,
198,
11748,
2956,
297,
571,
13,
25927,
11,
2956,
297,
571,
13,
29572,
198,
198,
2,
1388,
2438,
198,
198,
65,
796,
7459,
5379,
3419,
198,
65,
13,
8443,
10786,
17477,
13,
14656,
13,
16,
13,
20219,
11537,
198,
8091,
796,
275,
13,
1136,
62,
8091,
3419,
198,
198,
5239,
796,
366,
1911,
22179,
7,
17597,
13,
19282,
259,
13,
961,
6615,
28955,
198,
198,
37266,
796,
2956,
297,
571,
13,
29572,
13,
6371,
268,
8189,
15090,
6,
5239,
10354,
2420,
32092,
198,
25927,
796,
2956,
297,
571,
13,
25927,
13,
6371,
9654,
7203,
4023,
1378,
5239,
12,
36948,
13,
785,
14,
15042,
14,
34086,
3681,
14,
1600,
42287,
13,
268,
8189,
10786,
40477,
12,
23,
6,
4008,
198,
7890,
796,
33918,
13,
46030,
7,
25927,
13,
961,
22446,
12501,
1098,
10786,
40477,
12,
23,
6,
4008,
198,
4798,
7,
7890,
8,
198,
81,
796,
493,
7,
7890,
13,
1136,
10786,
1676,
65,
1799,
3256,
90,
92,
737,
1136,
10786,
12480,
3256,
16,
27493,
13381,
8,
198,
70,
796,
493,
7,
7890,
13,
1136,
10786,
1676,
65,
1799,
3256,
90,
92,
737,
1136,
10786,
1930,
3256,
16,
27493,
13381,
8,
198,
65,
796,
493,
7,
7890,
13,
1136,
10786,
1676,
65,
1799,
3256,
90,
92,
737,
1136,
10786,
29797,
3256,
16,
27493,
13381,
8,
198,
198,
1640,
1657,
287,
7588,
25,
198,
220,
1657,
13,
8043,
796,
357,
81,
11,
308,
11,
275,
8,
198
] | 2.870056 | 354 |
from dplaapi import models
| [
198,
6738,
288,
489,
64,
15042,
1330,
4981,
628,
198
] | 3 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.