max_stars_repo_path
stringlengths 4
237
| max_stars_repo_name
stringlengths 6
117
| max_stars_count
int64 0
95.2k
| id
stringlengths 1
7
| content
stringlengths 12
593k
| input_ids
sequencelengths 7
549k
|
---|---|---|---|---|---|
src/role_filter.py | kjkszpj/mifans | 0 | 36789 | <gh_stars>0
import pickle
data = pickle.load(open('../data/record.pk', 'rb'))
namedict = pickle.load(open('../data/namedict.pk', 'rb'))
rndict = {v:k for k, v in namedict.items()}
pickle.dump(rndict, open('../data/rndict.pk', 'wb'))
cnt_name = {v:[0, 0, 0] for v in namedict.values()}
for record in data:
for a in record[2]:
cnt_name[a][0] += 1
cnt_name[a][1] += 1
for a in record[4]:
cnt_name[a][0] += 1
cnt_name[a][2] += 1
for a in record[6]:
cnt_name[a][0] += 1
cnt_name[a][2] += 1
for a in record[8]:
cnt_name[a][0] += 1
cnt_name[a][2] += 1
a = [[v[2], k] for k, v in cnt_name.items()]
a.sort(reverse=True)
good_list = []
for cnt, id in a:
name = rndict[id]
ok = True
if name.find('@') != -1: ok = False
if name.upper().find('HACKINGTEAM') != -1: ok = True
if ok: good_list.append(id)
temp = []
for id in good_list:
if (cnt_name[id][1] >= 3 and cnt_name[id][2] >= 5):
print(cnt_name[id], id, rndict[id])
temp.append(id)
# print(len(temp))
# print(len(good_list))
# inf = open('../data/list.txt', 'r')
# lines = inf.readlines()
# print(len(lines))
# cnt = 0
# for line in lines:
# [idf, idt, time] = line.split(' ')
# idf = int(idf)
# idt = int(idt)
# time = int(time)
# if idf in temp and idt in temp:
# cnt += 1
# print(cnt)
# 3d display for initial list
tempf1 = open('../data/temp1.txt', 'w')
tempf2 = open('../data/temp2.txt', 'w')
tempf3 = open('../data/temp3.txt', 'w')
for k, v in cnt_name.items():
if k in temp:
tempf1.write('%d %d %d\n' % (v[0], v[1], v[2]))
elif k in good_list:
tempf3.write('%d %d %d\n' % (v[0], v[1], v[2]))
else:
tempf2.write('%d %d %d\n' % (v[0], v[1], v[2]))
print([rndict[k]] + v)
print(len(temp)) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
5839,
280,
13,
13,
1272,
353,
5839,
280,
29889,
1359,
29898,
3150,
877,
6995,
1272,
29914,
11651,
29889,
20571,
742,
525,
6050,
8785,
13,
17514,
919,
353,
5839,
280,
29889,
1359,
29898,
3150,
877,
6995,
1272,
29914,
17514,
919,
29889,
20571,
742,
525,
6050,
8785,
13,
29878,
299,
919,
353,
426,
29894,
29901,
29895,
363,
413,
29892,
325,
297,
4257,
919,
29889,
7076,
28296,
13,
23945,
280,
29889,
15070,
29898,
29878,
299,
919,
29892,
1722,
877,
6995,
1272,
29914,
29878,
299,
919,
29889,
20571,
742,
525,
29893,
29890,
8785,
13,
20047,
29918,
978,
353,
426,
29894,
10834,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
363,
325,
297,
4257,
919,
29889,
5975,
28296,
13,
1454,
2407,
297,
848,
29901,
13,
1678,
363,
263,
297,
2407,
29961,
29906,
5387,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29900,
29962,
4619,
29871,
29896,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29896,
29962,
4619,
29871,
29896,
13,
1678,
363,
263,
297,
2407,
29961,
29946,
5387,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29900,
29962,
4619,
29871,
29896,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29906,
29962,
4619,
29871,
29896,
13,
1678,
363,
263,
297,
2407,
29961,
29953,
5387,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29900,
29962,
4619,
29871,
29896,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29906,
29962,
4619,
29871,
29896,
13,
1678,
363,
263,
297,
2407,
29961,
29947,
5387,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29900,
29962,
4619,
29871,
29896,
13,
4706,
274,
593,
29918,
978,
29961,
29874,
3816,
29906,
29962,
4619,
29871,
29896,
13,
13,
29874,
353,
5519,
29894,
29961,
29906,
1402,
413,
29962,
363,
413,
29892,
325,
297,
274,
593,
29918,
978,
29889,
7076,
580,
29962,
13,
29874,
29889,
6605,
29898,
24244,
29922,
5574,
29897,
13,
16773,
29918,
1761,
353,
5159,
13,
1454,
274,
593,
29892,
1178,
297,
263,
29901,
13,
1678,
1024,
353,
364,
299,
919,
29961,
333,
29962,
13,
1678,
3431,
353,
5852,
13,
1678,
565,
1024,
29889,
2886,
877,
29992,
1495,
2804,
448,
29896,
29901,
3431,
353,
7700,
13,
1678,
565,
1024,
29889,
21064,
2141,
2886,
877,
29950,
11375,
4214,
4330,
5194,
1495,
2804,
448,
29896,
29901,
3431,
353,
5852,
13,
1678,
565,
3431,
29901,
1781,
29918,
1761,
29889,
4397,
29898,
333,
29897,
13,
7382,
353,
5159,
13,
1454,
1178,
297,
1781,
29918,
1761,
29901,
13,
1678,
565,
313,
20047,
29918,
978,
29961,
333,
3816,
29896,
29962,
6736,
29871,
29941,
322,
274,
593,
29918,
978,
29961,
333,
3816,
29906,
29962,
6736,
29871,
29945,
1125,
13,
4706,
1596,
29898,
20047,
29918,
978,
29961,
333,
1402,
1178,
29892,
364,
299,
919,
29961,
333,
2314,
13,
4706,
5694,
29889,
4397,
29898,
333,
29897,
13,
29937,
1596,
29898,
2435,
29898,
7382,
876,
13,
29937,
1596,
29898,
2435,
29898,
16773,
29918,
1761,
876,
13,
13,
29937,
3041,
353,
1722,
877,
6995,
1272,
29914,
1761,
29889,
3945,
742,
525,
29878,
1495,
13,
29937,
3454,
353,
3041,
29889,
949,
9012,
580,
13,
29937,
1596,
29898,
2435,
29898,
9012,
876,
13,
29937,
274,
593,
353,
29871,
29900,
13,
29937,
363,
1196,
297,
3454,
29901,
13,
29937,
268,
518,
333,
29888,
29892,
1178,
29873,
29892,
931,
29962,
353,
1196,
29889,
5451,
877,
25710,
13,
29937,
268,
1178,
29888,
353,
938,
29898,
333,
29888,
29897,
13,
29937,
268,
1178,
29873,
353,
938,
29898,
333,
29873,
29897,
13,
29937,
268,
931,
353,
938,
29898,
2230,
29897,
13,
29937,
268,
565,
1178,
29888,
297,
5694,
322,
1178,
29873,
297,
5694,
29901,
13,
29937,
308,
274,
593,
4619,
29871,
29896,
13,
29937,
1596,
29898,
20047,
29897,
13,
13,
13,
29937,
12,
29941,
29881,
2479,
363,
2847,
1051,
13,
7382,
29888,
29896,
353,
1722,
877,
6995,
1272,
29914,
7382,
29896,
29889,
3945,
742,
525,
29893,
1495,
13,
7382,
29888,
29906,
353,
1722,
877,
6995,
1272,
29914,
7382,
29906,
29889,
3945,
742,
525,
29893,
1495,
13,
7382,
29888,
29941,
353,
1722,
877,
6995,
1272,
29914,
7382,
29941,
29889,
3945,
742,
525,
29893,
1495,
13,
1454,
413,
29892,
325,
297,
274,
593,
29918,
978,
29889,
7076,
7295,
13,
1678,
565,
413,
297,
5694,
29901,
13,
4706,
5694,
29888,
29896,
29889,
3539,
877,
29995,
29881,
1273,
29881,
1273,
29881,
29905,
29876,
29915,
1273,
313,
29894,
29961,
29900,
1402,
325,
29961,
29896,
1402,
325,
29961,
29906,
12622,
13,
1678,
25342,
413,
297,
1781,
29918,
1761,
29901,
13,
4706,
5694,
29888,
29941,
29889,
3539,
877,
29995,
29881,
1273,
29881,
1273,
29881,
29905,
29876,
29915,
1273,
313,
29894,
29961,
29900,
1402,
325,
29961,
29896,
1402,
325,
29961,
29906,
12622,
13,
1678,
1683,
29901,
13,
4706,
5694,
29888,
29906,
29889,
3539,
877,
29995,
29881,
1273,
29881,
1273,
29881,
29905,
29876,
29915,
1273,
313,
29894,
29961,
29900,
1402,
325,
29961,
29896,
1402,
325,
29961,
29906,
12622,
13,
4706,
1596,
4197,
29878,
299,
919,
29961,
29895,
5262,
718,
325,
29897,
13,
2158,
29898,
2435,
29898,
7382,
876,
2
] |
spotify_sort_by_release/__init__.py | mcieno/spotify-sort-by-release | 2 | 1613700 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from .spotify_sort_by_release import *
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29947,
448,
29930,
29899,
13,
3166,
869,
17500,
1598,
29918,
6605,
29918,
1609,
29918,
14096,
1053,
334,
13,
2
] |
Python/run_lfca_example.py | subond/lfca | 9 | 77941 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 16 17:58:52 2018
@author: Zhaoyi.Shen
"""
import sys
sys.path.append('/home/z1s/py/lib/')
from signal_processing import lfca
import numpy as np
import scipy as sp
from scipy import io
from matplotlib import pyplot as plt
filename = '/home/z1s/research/climate/LFCA_example/ERSST_1900_2016.mat'
mat = io.loadmat(filename)
lat_axis = mat['LAT_AXIS']
lon_axis = mat['LON_AXIS']
sst = mat['SST']
nlon = sst.shape[0]
nlat = sst.shape[1]
ntime = sst.shape[2]
time = np.arange(1900,2016.99,1/12.)
cutoff = 120
truncation = 30
#%%
mean_seasonal_cycle = np.zeros((nlon,nlat,12))
sst_anomalies = np.zeros((nlon,nlat,ntime))
for i in range(12):
mean_seasonal_cycle[...,i] = np.nanmean(sst[...,i:ntime:12],-1)
sst_anomalies[...,i:ntime:12] = sst[...,i:ntime:12] - mean_seasonal_cycle[...,i][...,np.newaxis]
#%%
s = sst_anomalies.shape
y, x = np.meshgrid(lat_axis,lon_axis)
area = np.cos(y*np.pi/180.)
area[np.where(np.isnan(np.mean(sst_anomalies,-1)))] = 0
#%%
domain = np.ones(area.shape)
domain[np.where(x<100)] = 0
domain[np.where((x<103) & (y<5))] = 0
domain[np.where((x<105) & (y<2))] = 0
domain[np.where((x<111) & (y<-6))] = 0
domain[np.where((x<114) & (y<-7))] = 0
domain[np.where((x<127) & (y<-8))] = 0
domain[np.where((x<147) & (y<-18))] = 0
domain[np.where(y>70)] = 0
domain[np.where((y>65) & ((x<175) | (x>200)))] = 0
domain[np.where(y<-45)] = 0
domain[np.where((x>260) & (y>17))] = 0
domain[np.where((x>270) & (y<=17) & (y>14))] = 0
domain[np.where((x>276) & (y<=14) & (y>9))] = 0
domain[np.where((x>290) & (y<=9))] = 0
#%%
order = 'C'
x = np.transpose(np.reshape(sst_anomalies,(s[0]*s[1],s[2]),order=order))
area_weights = np.transpose(np.reshape(area,(s[0]*s[1],1),order=order))
domain = np.transpose(np.reshape(domain,(s[0]*s[1],1),order=order))
icol_ret = np.where((area_weights!=0) & (domain!=0))
icol_disc = np.where((area_weights==0) | (domain==0))
x = x[:,icol_ret[1]]
area_weights = area_weights[:,icol_ret[1]]
normvec = np.transpose(area_weights)/np.sum(area_weights)
scale = np.sqrt(normvec)
#%%
lfcs, lfps, weights, r, pvar, pcs, eofs, ntr, pvar_slow, pvar_lfc, r_eofs, pvar_slow_eofs = \
lfca(x, cutoff, truncation, scale)
#%%
nins = np.size(icol_disc[1])
nrows = lfps.shape[0]
lfps_aug = np.zeros((nrows,lfps.shape[1]+nins))
lfps_aug[:] = np.nan
lfps_aug[:,icol_ret[1]] = lfps
nrows = eofs.shape[0]
eofs_aug = np.zeros((nrows,eofs.shape[1]+nins))
eofs_aug[:] = np.nan
eofs_aug[:,icol_ret[1]] = eofs
#%%
s1 = np.size(lon_axis)
s2 = np.size(lat_axis)
i = 0
pattern = np.reshape(lfps_aug[i,...],(s1,s2),order=order)
pattern[np.where(np.abs(pattern)>1.e5)] = np.nan
plt.figure()
plt.contourf(np.squeeze(lon_axis),np.squeeze(lat_axis),np.transpose(pattern),\
np.arange(-1,1.1,0.1),cmap=plt.cm.RdYlBu_r)
plt.figure()
plt.plot(lfcs[:,i]) | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29906,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
8991,
3826,
29871,
29896,
29953,
29871,
29896,
29955,
29901,
29945,
29947,
29901,
29945,
29906,
29871,
29906,
29900,
29896,
29947,
13,
13,
29992,
8921,
29901,
796,
2350,
12602,
29875,
29889,
2713,
264,
13,
15945,
29908,
13,
13,
5215,
10876,
13,
9675,
29889,
2084,
29889,
4397,
11219,
5184,
29914,
29920,
29896,
29879,
29914,
2272,
29914,
1982,
29914,
1495,
13,
3166,
7182,
29918,
19170,
1053,
301,
29888,
1113,
13,
5215,
12655,
408,
7442,
13,
5215,
4560,
2272,
408,
805,
13,
3166,
4560,
2272,
1053,
12013,
13,
3166,
22889,
1053,
11451,
5317,
408,
14770,
13,
13,
9507,
353,
8207,
5184,
29914,
29920,
29896,
29879,
29914,
690,
2842,
29914,
695,
6490,
29914,
29931,
29943,
5454,
29918,
4773,
29914,
23598,
1254,
29918,
29896,
29929,
29900,
29900,
29918,
29906,
29900,
29896,
29953,
29889,
2922,
29915,
13,
2922,
353,
12013,
29889,
1359,
2922,
29898,
9507,
29897,
13,
13,
5066,
29918,
8990,
353,
1775,
1839,
29931,
1299,
29918,
6604,
3235,
2033,
13,
12957,
29918,
8990,
353,
1775,
1839,
29931,
1164,
29918,
6604,
3235,
2033,
13,
29879,
303,
353,
1775,
1839,
29903,
1254,
2033,
13,
12938,
265,
353,
269,
303,
29889,
12181,
29961,
29900,
29962,
13,
29876,
5066,
353,
269,
303,
29889,
12181,
29961,
29896,
29962,
13,
593,
603,
353,
269,
303,
29889,
12181,
29961,
29906,
29962,
13,
2230,
353,
7442,
29889,
279,
927,
29898,
29896,
29929,
29900,
29900,
29892,
29906,
29900,
29896,
29953,
29889,
29929,
29929,
29892,
29896,
29914,
29896,
29906,
1846,
13,
13,
7582,
2696,
353,
29871,
29896,
29906,
29900,
13,
509,
4661,
362,
353,
29871,
29941,
29900,
13,
29937,
7686,
13,
12676,
29918,
25682,
284,
29918,
23090,
353,
7442,
29889,
3298,
359,
3552,
12938,
265,
29892,
29876,
5066,
29892,
29896,
29906,
876,
13,
29879,
303,
29918,
273,
290,
284,
583,
353,
7442,
29889,
3298,
359,
3552,
12938,
265,
29892,
29876,
5066,
29892,
593,
603,
876,
13,
1454,
474,
297,
3464,
29898,
29896,
29906,
1125,
13,
1678,
2099,
29918,
25682,
284,
29918,
23090,
29961,
16361,
29875,
29962,
353,
7442,
29889,
13707,
12676,
29898,
29879,
303,
29961,
16361,
29875,
29901,
593,
603,
29901,
29896,
29906,
1402,
29899,
29896,
29897,
13,
1678,
269,
303,
29918,
273,
290,
284,
583,
29961,
16361,
29875,
29901,
593,
603,
29901,
29896,
29906,
29962,
353,
269,
303,
29961,
16361,
29875,
29901,
593,
603,
29901,
29896,
29906,
29962,
448,
2099,
29918,
25682,
284,
29918,
23090,
29961,
16361,
29875,
3816,
16361,
9302,
29889,
1482,
8990,
29962,
13,
29937,
7686,
13,
29879,
353,
269,
303,
29918,
273,
290,
284,
583,
29889,
12181,
13,
29891,
29892,
921,
353,
7442,
29889,
4467,
29882,
7720,
29898,
5066,
29918,
8990,
29892,
12957,
29918,
8990,
29897,
13,
6203,
353,
7442,
29889,
3944,
29898,
29891,
29930,
9302,
29889,
1631,
29914,
29896,
29947,
29900,
1846,
13,
6203,
29961,
9302,
29889,
3062,
29898,
9302,
29889,
275,
13707,
29898,
9302,
29889,
12676,
29898,
29879,
303,
29918,
273,
290,
284,
583,
6653,
29896,
876,
4638,
353,
29871,
29900,
13,
29937,
7686,
13,
7247,
353,
7442,
29889,
2873,
29898,
6203,
29889,
12181,
29897,
13,
7247,
29961,
9302,
29889,
3062,
29898,
29916,
29966,
29896,
29900,
29900,
4638,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29900,
29941,
29897,
669,
313,
29891,
29966,
29945,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29900,
29945,
29897,
669,
313,
29891,
29966,
29906,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29896,
29896,
29897,
669,
313,
29891,
16406,
29953,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29896,
29946,
29897,
669,
313,
29891,
16406,
29955,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29906,
29955,
29897,
669,
313,
29891,
16406,
29947,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29966,
29896,
29946,
29955,
29897,
669,
313,
29891,
16406,
29896,
29947,
28166,
353,
29871,
29900,
539,
13,
7247,
29961,
9302,
29889,
3062,
29898,
29891,
29958,
29955,
29900,
4638,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29891,
29958,
29953,
29945,
29897,
669,
5135,
29916,
29966,
29896,
29955,
29945,
29897,
891,
313,
29916,
29958,
29906,
29900,
29900,
876,
4638,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
29898,
29891,
16406,
29946,
29945,
4638,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29958,
29906,
29953,
29900,
29897,
669,
313,
29891,
29958,
29896,
29955,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29958,
29906,
29955,
29900,
29897,
669,
313,
29891,
14065,
29896,
29955,
29897,
669,
313,
29891,
29958,
29896,
29946,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29958,
29906,
29955,
29953,
29897,
669,
313,
29891,
14065,
29896,
29946,
29897,
669,
313,
29891,
29958,
29929,
28166,
353,
29871,
29900,
13,
7247,
29961,
9302,
29889,
3062,
3552,
29916,
29958,
29906,
29929,
29900,
29897,
669,
313,
29891,
14065,
29929,
28166,
353,
29871,
29900,
13,
29937,
7686,
13,
2098,
353,
525,
29907,
29915,
13,
29916,
353,
7442,
29889,
3286,
4220,
29898,
9302,
29889,
690,
14443,
29898,
29879,
303,
29918,
273,
290,
284,
583,
22657,
29879,
29961,
29900,
14178,
29879,
29961,
29896,
1402,
29879,
29961,
29906,
11724,
2098,
29922,
2098,
876,
13,
6203,
29918,
705,
5861,
353,
7442,
29889,
3286,
4220,
29898,
9302,
29889,
690,
14443,
29898,
6203,
22657,
29879,
29961,
29900,
14178,
29879,
29961,
29896,
1402,
29896,
511,
2098,
29922,
2098,
876,
13,
7247,
353,
7442,
29889,
3286,
4220,
29898,
9302,
29889,
690,
14443,
29898,
7247,
22657,
29879,
29961,
29900,
14178,
29879,
29961,
29896,
1402,
29896,
511,
2098,
29922,
2098,
876,
13,
5283,
29918,
2267,
353,
7442,
29889,
3062,
3552,
6203,
29918,
705,
5861,
19216,
29900,
29897,
669,
313,
7247,
19216,
29900,
876,
13,
5283,
29918,
2218,
29883,
353,
7442,
29889,
3062,
3552,
6203,
29918,
705,
5861,
1360,
29900,
29897,
891,
313,
7247,
1360,
29900,
876,
13,
29916,
353,
921,
7503,
29892,
5283,
29918,
2267,
29961,
29896,
5262,
13,
6203,
29918,
705,
5861,
353,
4038,
29918,
705,
5861,
7503,
29892,
5283,
29918,
2267,
29961,
29896,
5262,
13,
12324,
2003,
353,
7442,
29889,
3286,
4220,
29898,
6203,
29918,
705,
5861,
6802,
9302,
29889,
2083,
29898,
6203,
29918,
705,
5861,
29897,
13,
7052,
353,
7442,
29889,
3676,
29898,
12324,
2003,
29897,
13,
29937,
7686,
13,
29880,
29888,
2395,
29892,
301,
29888,
567,
29892,
18177,
29892,
364,
29892,
282,
1707,
29892,
282,
2395,
29892,
321,
974,
29879,
29892,
302,
509,
29892,
282,
1707,
29918,
28544,
29892,
282,
1707,
29918,
29880,
13801,
29892,
364,
29918,
29872,
974,
29879,
29892,
282,
1707,
29918,
28544,
29918,
29872,
974,
29879,
353,
320,
13,
29880,
29888,
1113,
29898,
29916,
29892,
5700,
2696,
29892,
21022,
362,
29892,
6287,
29897,
13,
29937,
7686,
13,
29876,
1144,
353,
7442,
29889,
2311,
29898,
5283,
29918,
2218,
29883,
29961,
29896,
2314,
13,
29876,
5727,
353,
301,
29888,
567,
29889,
12181,
29961,
29900,
29962,
13,
29880,
29888,
567,
29918,
2987,
353,
7442,
29889,
3298,
359,
3552,
29876,
5727,
29892,
29880,
29888,
567,
29889,
12181,
29961,
29896,
10062,
29876,
1144,
876,
13,
29880,
29888,
567,
29918,
2987,
7503,
29962,
353,
7442,
29889,
13707,
13,
29880,
29888,
567,
29918,
2987,
7503,
29892,
5283,
29918,
2267,
29961,
29896,
5262,
353,
301,
29888,
567,
13,
29876,
5727,
353,
321,
974,
29879,
29889,
12181,
29961,
29900,
29962,
13,
29872,
974,
29879,
29918,
2987,
353,
7442,
29889,
3298,
359,
3552,
29876,
5727,
29892,
29872,
974,
29879,
29889,
12181,
29961,
29896,
10062,
29876,
1144,
876,
13,
29872,
974,
29879,
29918,
2987,
7503,
29962,
353,
7442,
29889,
13707,
13,
29872,
974,
29879,
29918,
2987,
7503,
29892,
5283,
29918,
2267,
29961,
29896,
5262,
353,
321,
974,
29879,
13,
29937,
7686,
13,
29879,
29896,
353,
7442,
29889,
2311,
29898,
12957,
29918,
8990,
29897,
13,
29879,
29906,
353,
7442,
29889,
2311,
29898,
5066,
29918,
8990,
29897,
13,
29875,
353,
29871,
29900,
13,
11037,
353,
7442,
29889,
690,
14443,
29898,
29880,
29888,
567,
29918,
2987,
29961,
29875,
29892,
856,
1402,
29898,
29879,
29896,
29892,
29879,
29906,
511,
2098,
29922,
2098,
29897,
13,
11037,
29961,
9302,
29889,
3062,
29898,
9302,
29889,
6897,
29898,
11037,
15410,
29896,
29889,
29872,
29945,
4638,
353,
7442,
29889,
13707,
13,
572,
29873,
29889,
4532,
580,
13,
572,
29873,
29889,
1285,
473,
29888,
29898,
9302,
29889,
29879,
802,
29872,
911,
29898,
12957,
29918,
8990,
511,
9302,
29889,
29879,
802,
29872,
911,
29898,
5066,
29918,
8990,
511,
9302,
29889,
3286,
4220,
29898,
11037,
20481,
13,
632,
7442,
29889,
279,
927,
6278,
29896,
29892,
29896,
29889,
29896,
29892,
29900,
29889,
29896,
511,
29883,
1958,
29922,
572,
29873,
29889,
4912,
29889,
29934,
29881,
29979,
29880,
3727,
29918,
29878,
29897,
13,
572,
29873,
29889,
4532,
580,
13,
572,
29873,
29889,
5317,
29898,
29880,
29888,
2395,
7503,
29892,
29875,
2314,
2
] |
sound.py | Artemia76/discord-audio-pipe | 0 | 47104 | import numpy as np
import sounddevice as sd
MME = 0
sd.default.channels = 2
sd.default.dtype = 'int16'
sd.default.latency = 'low'
sd.default.samplerate = 48000
class PCMStream:
def __init__(self):
self.stream = None
def read(self, num_bytes):
# frame is 4 bytes
frames = int(num_bytes / 4)
data = self.stream.read(frames)[0]
# convert to pcm format
return data.tobytes()
def change_device(self, num):
if (self.stream is not None):
self.stream.stop()
self.stream.close()
self.stream = sd.InputStream(device=num)
self.stream.start()
def query_devices():
index = 0
options = {}
for item in sd.query_devices():
# pip version only supports MME api
if (item.get('max_input_channels') > 0 and item.get('hostapi') == MME):
options[item.get('name')] = index
index += 1
return options
| [
1,
1053,
12655,
408,
7442,
30004,
13,
5215,
6047,
10141,
408,
28972,
30004,
13,
30004,
13,
29924,
2303,
353,
29871,
29900,
30004,
13,
4928,
29889,
4381,
29889,
305,
12629,
353,
29871,
29906,
30004,
13,
4928,
29889,
4381,
29889,
29881,
1853,
353,
525,
524,
29896,
29953,
29915,
30004,
13,
4928,
29889,
4381,
29889,
29880,
2579,
1270,
353,
525,
677,
29915,
30004,
13,
4928,
29889,
4381,
29889,
13445,
20069,
403,
353,
29871,
29946,
29947,
29900,
29900,
29900,
30004,
13,
30004,
13,
1990,
9609,
29924,
3835,
29901,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
30004,
13,
4706,
1583,
29889,
5461,
353,
6213,
30004,
13,
4706,
6756,
13,
1678,
822,
1303,
29898,
1311,
29892,
954,
29918,
13193,
1125,
30004,
13,
4706,
396,
3515,
338,
29871,
29946,
6262,
30004,
13,
4706,
16608,
353,
938,
29898,
1949,
29918,
13193,
847,
29871,
29946,
8443,
13,
4706,
848,
353,
1583,
29889,
5461,
29889,
949,
29898,
19935,
9601,
29900,
29962,
30004,
13,
30004,
13,
4706,
396,
3588,
304,
282,
4912,
3402,
30004,
13,
4706,
736,
848,
29889,
517,
13193,
26471,
13,
30004,
13,
1678,
822,
1735,
29918,
10141,
29898,
1311,
29892,
954,
1125,
30004,
13,
4706,
565,
313,
1311,
29889,
5461,
338,
451,
6213,
1125,
30004,
13,
9651,
1583,
29889,
5461,
29889,
9847,
26471,
13,
9651,
1583,
29889,
5461,
29889,
5358,
26471,
13,
30004,
13,
4706,
1583,
29889,
5461,
353,
28972,
29889,
13828,
29898,
10141,
29922,
1949,
8443,
13,
4706,
1583,
29889,
5461,
29889,
2962,
26471,
13,
30004,
13,
1753,
2346,
29918,
3359,
1575,
7295,
30004,
13,
1678,
2380,
353,
29871,
29900,
30004,
13,
1678,
3987,
353,
6571,
30004,
13,
30004,
13,
1678,
363,
2944,
297,
28972,
29889,
1972,
29918,
3359,
1575,
7295,
30004,
13,
4706,
396,
8450,
1873,
871,
11286,
341,
2303,
7882,
30004,
13,
4706,
565,
313,
667,
29889,
657,
877,
3317,
29918,
2080,
29918,
305,
12629,
1495,
1405,
29871,
29900,
322,
2944,
29889,
657,
877,
3069,
2754,
1495,
1275,
341,
2303,
1125,
30004,
13,
9651,
3987,
29961,
667,
29889,
657,
877,
978,
1495,
29962,
353,
2380,
30004,
13,
30004,
13,
4706,
2380,
4619,
29871,
29896,
30004,
13,
30004,
13,
1678,
736,
3987,
30004,
13,
2
] |
ppg-bp/file_2.py | hao203/journal-file | 0 | 85421 | import pathlib
import random
import tensorflow as tf
data_root = pathlib.Path(r'C:\Users\<NAME>\Documents\data')
all_images_paths = list(data_root.glob('*/*'))
all_images_paths = [str(path) for path in all_images_paths]
random.shuffle(all_images_paths)
label_names = sorted(item.name for item in data_root.glob('*/') if item.is_dir())
label_to_index = dict((name,index) for index,name in enumerate(label_names))
all_images_labels = [label_to_index[pathlib.Path(path).parent.name] for path in all_images_paths]
def preprocess_img(image):
image = tf.image.decode_jpeg(image,channels=3)
image = tf.image.resize(image,(28,28))
image /= 255.0
return image
def load_and_preprocess_image(path):
image = tf.io.read_file(path)
return preprocess_img(image)
AUTOTUNE = tf.data.experimental.AUTOTUNE
Batch_size = 15
size = int(len(all_images_paths) * 0.1)
path_ds_train = tf.data.Dataset.from_tensor_slices(all_images_paths[:-size])
image_ds_train = path_ds_train.map(load_and_preprocess_image, num_parallel_calls=AUTOTUNE)
label_ds_train = tf.data.Dataset.from_tensor_slices(tf.cast(all_images_labels[:-size],tf.int64))
ds_train = tf.data.Dataset.zip((image_ds_train,label_ds_train))
ds_train = ds_train.batch(Batch_size)
ds_train = ds_train.prefetch(buffer_size=AUTOTUNE)
path_ds_test = tf.data.Dataset.from_tensor_slices(all_images_paths[-size:])
image_ds_test = path_ds_test.map(load_and_preprocess_image, num_parallel_calls=AUTOTUNE)
label_ds_test = tf.data.Dataset.from_tensor_slices(tf.cast(all_images_labels[-size:],tf.int64))
ds_test = tf.data.Dataset.zip((image_ds_test,label_ds_test))
ds_test = ds_test.batch(Batch_size)
ds_test = ds_test.prefetch(buffer_size=AUTOTUNE)
model = tf.keras.Sequential()
model.add(tf.keras.layers.Conv2D(64, (3, 3), padding='same', strides=(1, 1), activation='relu'))
model.add(tf.keras.layers.MaxPooling2D((2, 2), padding='same', strides=(2, 2)))
model.add(tf.keras.layers.Conv2D(128, (5, 5), padding='same', strides=(1, 1), activation='relu'))
model.add(tf.keras.layers.MaxPooling2D((2, 2), padding='same', strides=(2, 2)))
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(256, activation='relu'))
model.add(tf.keras.layers.Dense(128, activation='relu'))
model.add(tf.keras.layers.Dropout(0.2))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])
model.fit(ds_train, epochs=10)
loss, acc = model.evaluate(ds_test)
| [
1,
1053,
2224,
1982,
13,
5215,
4036,
13,
5215,
26110,
408,
15886,
13,
13,
1272,
29918,
4632,
353,
2224,
1982,
29889,
2605,
29898,
29878,
29915,
29907,
3583,
5959,
4488,
5813,
14247,
20128,
29905,
1272,
1495,
13,
497,
29918,
8346,
29918,
24772,
353,
1051,
29898,
1272,
29918,
4632,
29889,
23705,
877,
3877,
29930,
8785,
13,
13,
497,
29918,
8346,
29918,
24772,
353,
518,
710,
29898,
2084,
29897,
363,
2224,
297,
599,
29918,
8346,
29918,
24772,
29962,
13,
8172,
29889,
845,
21897,
29898,
497,
29918,
8346,
29918,
24772,
29897,
13,
13,
1643,
29918,
7039,
353,
12705,
29898,
667,
29889,
978,
363,
2944,
297,
848,
29918,
4632,
29889,
23705,
877,
3877,
1495,
565,
2944,
29889,
275,
29918,
3972,
3101,
13,
1643,
29918,
517,
29918,
2248,
353,
9657,
3552,
978,
29892,
2248,
29897,
363,
2380,
29892,
978,
297,
26985,
29898,
1643,
29918,
7039,
876,
13,
497,
29918,
8346,
29918,
21134,
353,
518,
1643,
29918,
517,
29918,
2248,
29961,
2084,
1982,
29889,
2605,
29898,
2084,
467,
3560,
29889,
978,
29962,
363,
2224,
297,
599,
29918,
8346,
29918,
24772,
29962,
13,
13,
1753,
758,
5014,
29918,
2492,
29898,
3027,
1125,
13,
1678,
1967,
353,
15886,
29889,
3027,
29889,
13808,
29918,
26568,
29898,
3027,
29892,
305,
12629,
29922,
29941,
29897,
13,
1678,
1967,
353,
15886,
29889,
3027,
29889,
21476,
29898,
3027,
22657,
29906,
29947,
29892,
29906,
29947,
876,
13,
1678,
1967,
847,
29922,
29871,
29906,
29945,
29945,
29889,
29900,
13,
1678,
736,
1967,
13,
13,
1753,
2254,
29918,
392,
29918,
1457,
5014,
29918,
3027,
29898,
2084,
1125,
13,
1678,
1967,
353,
15886,
29889,
601,
29889,
949,
29918,
1445,
29898,
2084,
29897,
13,
1678,
736,
758,
5014,
29918,
2492,
29898,
3027,
29897,
13,
13,
20656,
2891,
3904,
29923,
353,
15886,
29889,
1272,
29889,
735,
27910,
29889,
20656,
2891,
3904,
29923,
13,
23145,
29918,
2311,
353,
29871,
29896,
29945,
13,
13,
2311,
353,
938,
29898,
2435,
29898,
497,
29918,
8346,
29918,
24772,
29897,
334,
29871,
29900,
29889,
29896,
29897,
13,
13,
2084,
29918,
6289,
29918,
14968,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
3166,
29918,
20158,
29918,
29879,
29399,
29898,
497,
29918,
8346,
29918,
24772,
7503,
29899,
2311,
2314,
13,
3027,
29918,
6289,
29918,
14968,
353,
2224,
29918,
6289,
29918,
14968,
29889,
1958,
29898,
1359,
29918,
392,
29918,
1457,
5014,
29918,
3027,
29892,
954,
29918,
23482,
29918,
29883,
4293,
29922,
20656,
2891,
3904,
29923,
29897,
13,
1643,
29918,
6289,
29918,
14968,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
3166,
29918,
20158,
29918,
29879,
29399,
29898,
13264,
29889,
4384,
29898,
497,
29918,
8346,
29918,
21134,
7503,
29899,
2311,
1402,
13264,
29889,
524,
29953,
29946,
876,
13,
6289,
29918,
14968,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
7554,
3552,
3027,
29918,
6289,
29918,
14968,
29892,
1643,
29918,
6289,
29918,
14968,
876,
13,
13,
6289,
29918,
14968,
353,
18031,
29918,
14968,
29889,
16175,
29898,
23145,
29918,
2311,
29897,
13,
6289,
29918,
14968,
353,
18031,
29918,
14968,
29889,
29886,
999,
3486,
29898,
9040,
29918,
2311,
29922,
20656,
2891,
3904,
29923,
29897,
13,
13,
2084,
29918,
6289,
29918,
1688,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
3166,
29918,
20158,
29918,
29879,
29399,
29898,
497,
29918,
8346,
29918,
24772,
14352,
2311,
29901,
2314,
13,
3027,
29918,
6289,
29918,
1688,
353,
2224,
29918,
6289,
29918,
1688,
29889,
1958,
29898,
1359,
29918,
392,
29918,
1457,
5014,
29918,
3027,
29892,
954,
29918,
23482,
29918,
29883,
4293,
29922,
20656,
2891,
3904,
29923,
29897,
13,
1643,
29918,
6289,
29918,
1688,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
3166,
29918,
20158,
29918,
29879,
29399,
29898,
13264,
29889,
4384,
29898,
497,
29918,
8346,
29918,
21134,
14352,
2311,
29901,
1402,
13264,
29889,
524,
29953,
29946,
876,
13,
6289,
29918,
1688,
353,
15886,
29889,
1272,
29889,
16390,
24541,
29889,
7554,
3552,
3027,
29918,
6289,
29918,
1688,
29892,
1643,
29918,
6289,
29918,
1688,
876,
13,
13,
6289,
29918,
1688,
353,
18031,
29918,
1688,
29889,
16175,
29898,
23145,
29918,
2311,
29897,
13,
6289,
29918,
1688,
353,
18031,
29918,
1688,
29889,
29886,
999,
3486,
29898,
9040,
29918,
2311,
29922,
20656,
2891,
3904,
29923,
29897,
13,
13,
4299,
353,
15886,
29889,
3946,
294,
29889,
16941,
2556,
580,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
1168,
29894,
29906,
29928,
29898,
29953,
29946,
29892,
313,
29941,
29892,
29871,
29941,
511,
7164,
2433,
17642,
742,
851,
2247,
7607,
29896,
29892,
29871,
29896,
511,
26229,
2433,
2674,
29884,
8785,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
7976,
11426,
292,
29906,
29928,
3552,
29906,
29892,
29871,
29906,
511,
7164,
2433,
17642,
742,
851,
2247,
7607,
29906,
29892,
29871,
29906,
4961,
13,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
1168,
29894,
29906,
29928,
29898,
29896,
29906,
29947,
29892,
313,
29945,
29892,
29871,
29945,
511,
7164,
2433,
17642,
742,
851,
2247,
7607,
29896,
29892,
29871,
29896,
511,
26229,
2433,
2674,
29884,
8785,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
7976,
11426,
292,
29906,
29928,
3552,
29906,
29892,
29871,
29906,
511,
7164,
2433,
17642,
742,
851,
2247,
7607,
29906,
29892,
29871,
29906,
4961,
13,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
29943,
5066,
841,
3101,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
29906,
29945,
29953,
29892,
26229,
2433,
2674,
29884,
8785,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
29896,
29906,
29947,
29892,
26229,
2433,
2674,
29884,
8785,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
15063,
449,
29898,
29900,
29889,
29906,
876,
13,
4299,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
29896,
29892,
26229,
2433,
18816,
29885,
3398,
8785,
13,
13,
4299,
29889,
12198,
29898,
20640,
3950,
2433,
328,
314,
742,
13,
632,
6410,
2433,
19541,
29918,
19128,
296,
14441,
742,
13,
632,
21556,
29922,
1839,
562,
2764,
4135,
11287,
13,
13,
4299,
29889,
9202,
29898,
6289,
29918,
14968,
29892,
21502,
12168,
29922,
29896,
29900,
29897,
13,
6758,
29892,
1035,
353,
1904,
29889,
24219,
403,
29898,
6289,
29918,
1688,
29897,
13,
2
] |
src/model/exception/emote_fetch_error.py | konrad2508/kokomi-discord-bot | 2 | 6540 | class EmoteFetchError(Exception):
'''Exception stating that there was a problem while fetching emotes from a source.'''
| [
1,
770,
2812,
866,
20927,
2392,
29898,
2451,
1125,
13,
1678,
14550,
2451,
23659,
393,
727,
471,
263,
1108,
1550,
6699,
292,
953,
4769,
515,
263,
2752,
29889,
12008,
13,
2
] |
013-Flareon 6 Reloadered/resolve.py | schommi/low-tech | 0 | 37362 | import itertools
secret = [
0x7A, 0x17, 0x08, 0x34, 0x17, 0x31, 0x3B, 0x25, 0x5B, 0x18, 0x2E, 0x3A, 0x15, 0x56, 0x0E, 0x11,
0x3E, 0x0D, 0x11, 0x3B, 0x24, 0x21, 0x31, 0x06, 0x3C, 0x26, 0x7C, 0x3C, 0x0D, 0x24, 0x16, 0x3A,
0x14, 0x79, 0x01, 0x3A, 0x18, 0x5A, 0x58, 0x73, 0x2E, 0x09, 0x00, 0x16, 0x00, 0x49, 0x22, 0x01,
0x40, 0x08, 0x0A, 0x14 ]
key = [0 for x in range(13)]
def decrypt():
result = ""
key_index = 0
for index in range(len(secret)):
result += chr(key [key_index] ^ secret[index])
key_index = (key_index + 1) % len (key)
return result
key[0] = ord ("@") ^ secret[-13]
key[1] = ord ("f") ^ secret[-12]
key[2] = ord ("l") ^ secret[-11]
key[3] = ord ("a") ^ secret[-10]
key[4] = ord ("r") ^ secret[-9]
key[5] = ord ("e") ^ secret[-8]
key[6] = ord ("-") ^ secret[-7]
key[7] = ord ("o") ^ secret[-6]
key[8] = ord ("n") ^ secret[-5]
key[9] = ord (".") ^ secret[-4]
key[10] = ord ("c") ^ secret[-3]
key[11] = ord ("o") ^ secret[-2]
key[12] = ord ("m") ^ secret[-1]
dbg = decrypt()
print(dbg)
| [
1,
1053,
4256,
8504,
13,
13,
19024,
353,
518,
13,
259,
29900,
29916,
29955,
29909,
29892,
29871,
29900,
29916,
29896,
29955,
29892,
29871,
29900,
29916,
29900,
29947,
29892,
29871,
29900,
29916,
29941,
29946,
29892,
29871,
29900,
29916,
29896,
29955,
29892,
29871,
29900,
29916,
29941,
29896,
29892,
29871,
29900,
29916,
29941,
29933,
29892,
29871,
29900,
29916,
29906,
29945,
29892,
29871,
29900,
29916,
29945,
29933,
29892,
29871,
29900,
29916,
29896,
29947,
29892,
29871,
29900,
29916,
29906,
29923,
29892,
29871,
29900,
29916,
29941,
29909,
29892,
29871,
29900,
29916,
29896,
29945,
29892,
29871,
29900,
29916,
29945,
29953,
29892,
29871,
29900,
29916,
29900,
29923,
29892,
29871,
29900,
29916,
29896,
29896,
29892,
13,
259,
29900,
29916,
29941,
29923,
29892,
29871,
29900,
29916,
29900,
29928,
29892,
29871,
29900,
29916,
29896,
29896,
29892,
29871,
29900,
29916,
29941,
29933,
29892,
29871,
29900,
29916,
29906,
29946,
29892,
29871,
29900,
29916,
29906,
29896,
29892,
29871,
29900,
29916,
29941,
29896,
29892,
29871,
29900,
29916,
29900,
29953,
29892,
12,
29900,
29916,
29941,
29907,
29892,
29871,
29900,
29916,
29906,
29953,
29892,
29871,
29900,
29916,
29955,
29907,
29892,
29871,
29900,
29916,
29941,
29907,
29892,
29871,
29900,
29916,
29900,
29928,
29892,
29871,
29900,
29916,
29906,
29946,
29892,
29871,
29900,
29916,
29896,
29953,
29892,
29871,
29900,
29916,
29941,
29909,
29892,
13,
259,
29900,
29916,
29896,
29946,
29892,
29871,
29900,
29916,
29955,
29929,
29892,
29871,
29900,
29916,
29900,
29896,
29892,
29871,
29900,
29916,
29941,
29909,
29892,
12,
29900,
29916,
29896,
29947,
29892,
29871,
29900,
29916,
29945,
29909,
29892,
29871,
29900,
29916,
29945,
29947,
29892,
29871,
29900,
29916,
29955,
29941,
29892,
29871,
29900,
29916,
29906,
29923,
29892,
29871,
29900,
29916,
29900,
29929,
29892,
29871,
29900,
29916,
29900,
29900,
29892,
29871,
29900,
29916,
29896,
29953,
29892,
29871,
29900,
29916,
29900,
29900,
29892,
29871,
29900,
29916,
29946,
29929,
29892,
29871,
29900,
29916,
29906,
29906,
29892,
29871,
29900,
29916,
29900,
29896,
29892,
13,
259,
29900,
29916,
29946,
29900,
29892,
29871,
29900,
29916,
29900,
29947,
29892,
29871,
29900,
29916,
29900,
29909,
29892,
29871,
29900,
29916,
29896,
29946,
4514,
13,
13,
1989,
353,
518,
29900,
363,
921,
297,
3464,
29898,
29896,
29941,
4638,
13,
13,
1753,
1602,
4641,
7295,
13,
29871,
1121,
353,
5124,
13,
29871,
1820,
29918,
2248,
353,
29871,
29900,
13,
29871,
363,
2380,
297,
3464,
29898,
2435,
29898,
19024,
22164,
13,
1678,
1121,
4619,
18460,
29898,
1989,
518,
1989,
29918,
2248,
29962,
6228,
7035,
29961,
2248,
2314,
13,
1678,
1820,
29918,
2248,
353,
313,
1989,
29918,
2248,
718,
29871,
29896,
29897,
1273,
7431,
313,
1989,
29897,
13,
13,
29871,
736,
1121,
13,
13,
1989,
29961,
29900,
29962,
353,
4356,
4852,
29992,
1159,
6228,
7035,
14352,
29896,
29941,
29962,
13,
1989,
29961,
29896,
29962,
353,
4356,
4852,
29888,
1159,
6228,
7035,
14352,
29896,
29906,
29962,
13,
1989,
29961,
29906,
29962,
353,
4356,
4852,
29880,
1159,
6228,
7035,
14352,
29896,
29896,
29962,
13,
1989,
29961,
29941,
29962,
353,
4356,
4852,
29874,
1159,
6228,
7035,
14352,
29896,
29900,
29962,
13,
1989,
29961,
29946,
29962,
353,
4356,
4852,
29878,
1159,
6228,
7035,
14352,
29929,
29962,
13,
1989,
29961,
29945,
29962,
353,
4356,
4852,
29872,
1159,
6228,
7035,
14352,
29947,
29962,
13,
1989,
29961,
29953,
29962,
353,
4356,
4852,
29899,
1159,
6228,
7035,
14352,
29955,
29962,
13,
1989,
29961,
29955,
29962,
353,
4356,
4852,
29877,
1159,
6228,
7035,
14352,
29953,
29962,
13,
1989,
29961,
29947,
29962,
353,
4356,
4852,
29876,
1159,
6228,
7035,
14352,
29945,
29962,
13,
1989,
29961,
29929,
29962,
353,
4356,
313,
1642,
1159,
6228,
7035,
14352,
29946,
29962,
13,
1989,
29961,
29896,
29900,
29962,
353,
4356,
4852,
29883,
1159,
6228,
7035,
14352,
29941,
29962,
13,
1989,
29961,
29896,
29896,
29962,
353,
4356,
4852,
29877,
1159,
6228,
7035,
14352,
29906,
29962,
13,
1989,
29961,
29896,
29906,
29962,
353,
4356,
4852,
29885,
1159,
6228,
7035,
14352,
29896,
29962,
13,
13,
2585,
29887,
353,
1602,
4641,
580,
13,
2158,
29898,
2585,
29887,
29897,
13,
13,
2
] |
src/utils/common_imaging.py | dovedevic/fullyautomatednutcracker | 5 | 1602110 | <filename>src/utils/common_imaging.py
import io
import requests
import random
from PIL import Image, ImageDraw, ImageFont
def resize(im, size):
bands = im.split()
bands = [b.resize(size, Image.LINEAR) for b in bands]
return Image.merge('RGBA', bands)
def resize_to_nearest(image, square_size):
bands = image.split()
width_diff = abs(image.width - square_size)
height_diff = abs(image.height - square_size)
if height_diff > width_diff:
size = (square_size, image.height * square_size // image.width)
else:
size = (image.width * square_size // image.height, square_size)
bands = [b.resize(size, Image.LINEAR) for b in bands]
return Image.merge('RGBA', bands)
def image_from_url(url, content_type):
try:
response = requests.get(url)
img = Image.open(io.BytesIO(response.content))
if content_type != 'image/gif':
img = img.convert('RGBA')
return img
except Exception as ex:
return None
def text_outline(pos: tuple, content: str, draw: ImageDraw, font: ImageFont, base_color: str, outline_color: str="black", outline_width: int=1):
draw.text((pos[0] - outline_width, pos[1] - outline_width), content, outline_color, font=font)
draw.text((pos[0], pos[1] - outline_width), content, outline_color, font=font)
draw.text((pos[0] + outline_width, pos[1] - outline_width), content, outline_color, font=font)
draw.text((pos[0] + outline_width, pos[1]), content, outline_color, font=font)
draw.text((pos[0] + outline_width, pos[1] + outline_width), content, outline_color, font=font)
draw.text((pos[0], pos[1] + outline_width), content, outline_color, font=font)
draw.text((pos[0] - outline_width, pos[1] + outline_width), content, outline_color, font=font)
draw.text((pos[0] - outline_width, pos[1]), content, outline_color, font=font)
draw.text(pos, content, base_color, font=font)
def hex_to_rgb(value):
value = value.lstrip('#')
lv = len(value)
return tuple(int(value[i:i+lv//3], 16) for i in range(0, lv, lv//3))
def hex_string_from_color_name(color_name: str):
return hex_colors[color_name.lower()] if color_name.lower() in hex_colors else None
def random_hex_color():
return random.choice(list(hex_colors.values()))
hex_colors = {
"amaranth": "E52B50",
"amber": "FFBF00",
"amethyst": "9966CC",
"apricot": "FBCEB1",
"aquamarine": "7FFFD4",
"azure": "007FFF",
"babyblue": "89CFF0",
"beige": "F5F5DC",
"brick": "CB4154",
"black": "000000",
"blue": "0000FF",
"bluegreen": "0095B6",
"blueviolet": "8A2BE2",
"blush": "DE5D83",
"bronze": "CD7F32",
"brown": "964B00",
"burgundy": "800020",
"byzantium": "702963",
"barmine": "960018",
"berise": "DE3163",
"cerulean": "007BA7",
"champagne": "F7E7CE",
"chartreuse": "7FFF00",
"chocolate": "7B3F00",
"cobalt": "0047AB",
"coffee": "6F4E37",
"copper": "B87333",
"coral": "FF7F50",
"crimson": "DC143C",
"cyan": "00FFFF",
"desert": "EDC9Af",
"electric": "7DF9FF",
"emerald": "50C878",
"erin": "00FF3F",
"gold": "FFD700",
"gray": "808080",
"grey": "808080",
"green": "008000",
"harlequin": "3FFF00",
"indigo": "4B0082",
"ivory": "FFFFF0",
"jade": "00A86B",
"jungle": "29AB87",
"lavender": "B57EDC",
"lemon": "FFF700",
"lilac": "C8A2C8",
"lime": "BFFF00",
"magenta": "FF00FF",
"rose": "FF00AF",
"maroon": "800000",
"mauve": "E0B0FF",
"navy": "000080",
"ochre": "CC7722",
"olive": "808000",
"orange": "FF6600",
"orangered": "FF4500",
"orchid": "DA70D6",
"peach": "FFE5B4",
"pear": "D1E231",
"periwinkle": "CCCCFF",
"persian": "1C39BB",
"pink": "FD6C9E",
"plum": "8E4585",
"prussian": "003153",
"puce": "CC8899",
"purple": "800080",
"raspberry": "E30B5C",
"red": "FF0000",
"redviolet": "C71585",
"ruby": "E0115F",
"salmon": "FA8072",
"sangria": "92000A",
"sapphire": "0F52BA",
"scarlet": "FF2400",
"silver": "C0C0C0",
"slate": "708090",
"spring": "A7FC00",
"tan": "D2B48C",
"taupe": "483C32",
"teal": "008080",
"turquoise": "40E0D0",
"ultramarine": "3F00FF",
"violet": "7F00FF",
"viridian": "40826D",
"white": "FFFFFF",
"yellow": "FFFF00",
}
| [
1,
529,
9507,
29958,
4351,
29914,
13239,
29914,
9435,
29918,
326,
6751,
29889,
2272,
13,
5215,
12013,
13,
5215,
7274,
13,
5215,
4036,
13,
13,
3166,
349,
6227,
1053,
7084,
29892,
7084,
8537,
29892,
7084,
9824,
13,
13,
13,
1753,
19490,
29898,
326,
29892,
2159,
1125,
13,
1678,
22706,
353,
527,
29889,
5451,
580,
13,
1678,
22706,
353,
518,
29890,
29889,
21476,
29898,
2311,
29892,
7084,
29889,
18521,
1718,
29897,
363,
289,
297,
22706,
29962,
13,
1678,
736,
7084,
29889,
14634,
877,
29934,
29954,
5688,
742,
22706,
29897,
13,
13,
13,
1753,
19490,
29918,
517,
29918,
28502,
342,
29898,
3027,
29892,
6862,
29918,
2311,
1125,
13,
1678,
22706,
353,
1967,
29889,
5451,
580,
13,
1678,
2920,
29918,
12765,
353,
6425,
29898,
3027,
29889,
2103,
448,
6862,
29918,
2311,
29897,
13,
1678,
3171,
29918,
12765,
353,
6425,
29898,
3027,
29889,
3545,
448,
6862,
29918,
2311,
29897,
13,
1678,
565,
3171,
29918,
12765,
1405,
2920,
29918,
12765,
29901,
13,
4706,
2159,
353,
313,
17619,
29918,
2311,
29892,
1967,
29889,
3545,
334,
6862,
29918,
2311,
849,
1967,
29889,
2103,
29897,
13,
1678,
1683,
29901,
13,
4706,
2159,
353,
313,
3027,
29889,
2103,
334,
6862,
29918,
2311,
849,
1967,
29889,
3545,
29892,
6862,
29918,
2311,
29897,
13,
1678,
22706,
353,
518,
29890,
29889,
21476,
29898,
2311,
29892,
7084,
29889,
18521,
1718,
29897,
363,
289,
297,
22706,
29962,
13,
1678,
736,
7084,
29889,
14634,
877,
29934,
29954,
5688,
742,
22706,
29897,
13,
13,
13,
1753,
1967,
29918,
3166,
29918,
2271,
29898,
2271,
29892,
2793,
29918,
1853,
1125,
13,
1678,
1018,
29901,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29897,
13,
4706,
10153,
353,
7084,
29889,
3150,
29898,
601,
29889,
11207,
5971,
29898,
5327,
29889,
3051,
876,
13,
4706,
565,
2793,
29918,
1853,
2804,
525,
3027,
29914,
18660,
2396,
13,
9651,
10153,
353,
10153,
29889,
13441,
877,
29934,
29954,
5688,
1495,
13,
4706,
736,
10153,
13,
1678,
5174,
8960,
408,
429,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
1426,
29918,
449,
1220,
29898,
1066,
29901,
18761,
29892,
2793,
29901,
851,
29892,
4216,
29901,
7084,
8537,
29892,
4079,
29901,
7084,
9824,
29892,
2967,
29918,
2780,
29901,
851,
29892,
27887,
29918,
2780,
29901,
851,
543,
8517,
613,
27887,
29918,
2103,
29901,
938,
29922,
29896,
1125,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
448,
27887,
29918,
2103,
29892,
926,
29961,
29896,
29962,
448,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
1402,
926,
29961,
29896,
29962,
448,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
718,
27887,
29918,
2103,
29892,
926,
29961,
29896,
29962,
448,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
718,
27887,
29918,
2103,
29892,
926,
29961,
29896,
11724,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
718,
27887,
29918,
2103,
29892,
926,
29961,
29896,
29962,
718,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
1402,
926,
29961,
29896,
29962,
718,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
448,
27887,
29918,
2103,
29892,
926,
29961,
29896,
29962,
718,
27887,
29918,
2103,
511,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
3552,
1066,
29961,
29900,
29962,
448,
27887,
29918,
2103,
29892,
926,
29961,
29896,
11724,
2793,
29892,
27887,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
1678,
4216,
29889,
726,
29898,
1066,
29892,
2793,
29892,
2967,
29918,
2780,
29892,
4079,
29922,
5657,
29897,
13,
13,
13,
1753,
15090,
29918,
517,
29918,
23973,
29898,
1767,
1125,
13,
1678,
995,
353,
995,
29889,
29880,
17010,
14237,
1495,
13,
1678,
301,
29894,
353,
7431,
29898,
1767,
29897,
13,
1678,
736,
18761,
29898,
524,
29898,
1767,
29961,
29875,
29901,
29875,
29974,
28463,
458,
29941,
1402,
29871,
29896,
29953,
29897,
363,
474,
297,
3464,
29898,
29900,
29892,
301,
29894,
29892,
301,
29894,
458,
29941,
876,
13,
13,
13,
1753,
15090,
29918,
1807,
29918,
3166,
29918,
2780,
29918,
978,
29898,
2780,
29918,
978,
29901,
851,
1125,
13,
1678,
736,
15090,
29918,
27703,
29961,
2780,
29918,
978,
29889,
13609,
580,
29962,
565,
2927,
29918,
978,
29889,
13609,
580,
297,
15090,
29918,
27703,
1683,
6213,
13,
13,
13,
1753,
4036,
29918,
20970,
29918,
2780,
7295,
13,
1678,
736,
4036,
29889,
16957,
29898,
1761,
29898,
20970,
29918,
27703,
29889,
5975,
22130,
13,
13,
13,
20970,
29918,
27703,
353,
426,
13,
1678,
376,
8715,
9716,
1115,
376,
29923,
29945,
29906,
29933,
29945,
29900,
613,
13,
1678,
376,
314,
495,
1115,
376,
4198,
28062,
29900,
29900,
613,
13,
1678,
376,
314,
621,
858,
1115,
376,
29929,
29929,
29953,
29953,
4174,
613,
13,
1678,
376,
481,
2200,
327,
1115,
376,
18426,
4741,
29933,
29896,
613,
13,
1678,
376,
18463,
8715,
457,
1115,
376,
29955,
4198,
26453,
29946,
613,
13,
1678,
376,
17688,
1115,
376,
29900,
29900,
29955,
4198,
29943,
613,
13,
1678,
376,
29890,
10798,
9539,
1115,
376,
29947,
29929,
29907,
4198,
29900,
613,
13,
1678,
376,
915,
2231,
1115,
376,
29943,
29945,
29943,
29945,
12696,
613,
13,
1678,
376,
1182,
860,
1115,
376,
21685,
29946,
29896,
29945,
29946,
613,
13,
1678,
376,
8517,
1115,
376,
29900,
29900,
29900,
29900,
29900,
29900,
613,
13,
1678,
376,
9539,
1115,
376,
29900,
29900,
29900,
29900,
4198,
613,
13,
1678,
376,
2204,
29884,
387,
2733,
1115,
376,
29900,
29900,
29929,
29945,
29933,
29953,
613,
13,
1678,
376,
9539,
29894,
601,
1026,
1115,
376,
29947,
29909,
29906,
15349,
29906,
613,
13,
1678,
376,
2204,
1878,
1115,
376,
2287,
29945,
29928,
29947,
29941,
613,
13,
1678,
376,
1182,
265,
911,
1115,
376,
6530,
29955,
29943,
29941,
29906,
613,
13,
1678,
376,
29890,
4708,
1115,
376,
29929,
29953,
29946,
29933,
29900,
29900,
613,
13,
1678,
376,
3074,
870,
29891,
1115,
376,
29947,
29900,
29900,
29900,
29906,
29900,
613,
13,
1678,
376,
1609,
29920,
424,
1974,
1115,
376,
29955,
29900,
29906,
29929,
29953,
29941,
613,
13,
1678,
376,
1646,
24669,
1115,
376,
29929,
29953,
29900,
29900,
29896,
29947,
613,
13,
1678,
376,
495,
895,
1115,
376,
2287,
29941,
29896,
29953,
29941,
613,
13,
1678,
376,
2265,
1297,
273,
1115,
376,
29900,
29900,
29955,
5688,
29955,
613,
13,
1678,
376,
305,
1160,
5889,
1115,
376,
29943,
29955,
29923,
29955,
4741,
613,
13,
1678,
376,
15425,
276,
1509,
1115,
376,
29955,
4198,
29943,
29900,
29900,
613,
13,
1678,
376,
305,
542,
23167,
1115,
376,
29955,
29933,
29941,
29943,
29900,
29900,
613,
13,
1678,
376,
29883,
711,
1997,
1115,
376,
29900,
29900,
29946,
29955,
2882,
613,
13,
1678,
376,
1111,
600,
3905,
1115,
376,
29953,
29943,
29946,
29923,
29941,
29955,
613,
13,
1678,
376,
1111,
2496,
1115,
376,
29933,
29947,
29955,
29941,
29941,
29941,
613,
13,
1678,
376,
2616,
284,
1115,
376,
4198,
29955,
29943,
29945,
29900,
613,
13,
1678,
376,
29883,
5632,
1100,
1115,
376,
12696,
29896,
29946,
29941,
29907,
613,
13,
1678,
376,
1270,
273,
1115,
376,
29900,
29900,
22098,
613,
13,
1678,
376,
2783,
814,
1115,
376,
3352,
29907,
29929,
29909,
29888,
613,
13,
1678,
376,
15436,
2200,
1115,
376,
29955,
4037,
29929,
4198,
613,
13,
1678,
376,
25154,
2741,
1115,
376,
29945,
29900,
29907,
29947,
29955,
29947,
613,
13,
1678,
376,
261,
262,
1115,
376,
29900,
29900,
4198,
29941,
29943,
613,
13,
1678,
376,
29887,
1025,
1115,
376,
4198,
29928,
29955,
29900,
29900,
613,
13,
1678,
376,
21012,
1115,
376,
29947,
29900,
29947,
29900,
29947,
29900,
613,
13,
1678,
376,
7979,
29891,
1115,
376,
29947,
29900,
29947,
29900,
29947,
29900,
613,
13,
1678,
376,
12692,
1115,
376,
29900,
29900,
29947,
29900,
29900,
29900,
613,
13,
1678,
376,
8222,
280,
24150,
1115,
376,
29941,
4198,
29943,
29900,
29900,
613,
13,
1678,
376,
513,
5973,
1115,
376,
29946,
29933,
29900,
29900,
29947,
29906,
613,
13,
1678,
376,
440,
706,
1115,
376,
22098,
29943,
29900,
613,
13,
1678,
376,
1764,
311,
1115,
376,
29900,
29900,
29909,
29947,
29953,
29933,
613,
13,
1678,
376,
29926,
686,
280,
1115,
376,
29906,
29929,
2882,
29947,
29955,
613,
13,
1678,
376,
4112,
1581,
1115,
376,
29933,
29945,
29955,
3352,
29907,
613,
13,
1678,
376,
2409,
265,
1115,
376,
4198,
29943,
29955,
29900,
29900,
613,
13,
1678,
376,
29880,
309,
562,
1115,
376,
29907,
29947,
29909,
29906,
29907,
29947,
613,
13,
1678,
376,
28046,
1115,
376,
29933,
4198,
29943,
29900,
29900,
613,
13,
1678,
376,
11082,
6381,
1115,
376,
4198,
29900,
29900,
4198,
613,
13,
1678,
376,
17811,
1115,
376,
4198,
29900,
29900,
5098,
613,
13,
1678,
376,
3034,
6150,
1115,
376,
29947,
29900,
29900,
29900,
29900,
29900,
613,
13,
1678,
376,
29885,
585,
345,
1115,
376,
29923,
29900,
29933,
29900,
4198,
613,
13,
1678,
376,
29876,
5301,
1115,
376,
29900,
29900,
29900,
29900,
29947,
29900,
613,
13,
1678,
376,
2878,
276,
1115,
376,
4174,
29955,
29955,
29906,
29906,
613,
13,
1678,
376,
324,
573,
1115,
376,
29947,
29900,
29947,
29900,
29900,
29900,
613,
13,
1678,
376,
272,
927,
1115,
376,
4198,
29953,
29953,
29900,
29900,
613,
13,
1678,
376,
272,
4600,
287,
1115,
376,
4198,
29946,
29945,
29900,
29900,
613,
13,
1678,
376,
25350,
333,
1115,
376,
7698,
29955,
29900,
29928,
29953,
613,
13,
1678,
376,
412,
496,
1115,
376,
4198,
29923,
29945,
29933,
29946,
613,
13,
1678,
376,
412,
279,
1115,
376,
29928,
29896,
29923,
29906,
29941,
29896,
613,
13,
1678,
376,
546,
9429,
682,
280,
1115,
376,
4174,
4174,
4198,
613,
13,
1678,
376,
6774,
713,
1115,
376,
29896,
29907,
29941,
29929,
14388,
613,
13,
1678,
376,
29886,
682,
1115,
376,
26453,
29953,
29907,
29929,
29923,
613,
13,
1678,
376,
572,
398,
1115,
376,
29947,
29923,
29946,
29945,
29947,
29945,
613,
13,
1678,
376,
558,
1558,
713,
1115,
376,
29900,
29900,
29941,
29896,
29945,
29941,
613,
13,
1678,
376,
3746,
346,
1115,
376,
4174,
29947,
29947,
29929,
29929,
613,
13,
1678,
376,
15503,
552,
1115,
376,
29947,
29900,
29900,
29900,
29947,
29900,
613,
13,
1678,
376,
3417,
29886,
16344,
1115,
376,
29923,
29941,
29900,
29933,
29945,
29907,
613,
13,
1678,
376,
1127,
1115,
376,
4198,
29900,
29900,
29900,
29900,
613,
13,
1678,
376,
1127,
29894,
601,
1026,
1115,
376,
29907,
29955,
29896,
29945,
29947,
29945,
613,
13,
1678,
376,
9754,
1115,
376,
29923,
29900,
29896,
29896,
29945,
29943,
613,
13,
1678,
376,
19585,
3712,
1115,
376,
4519,
29947,
29900,
29955,
29906,
613,
13,
1678,
376,
29879,
574,
2849,
1115,
376,
29929,
29906,
29900,
29900,
29900,
29909,
613,
13,
1678,
376,
29879,
932,
14812,
1115,
376,
29900,
29943,
29945,
29906,
5688,
613,
13,
1678,
376,
14494,
1026,
1115,
376,
4198,
29906,
29946,
29900,
29900,
613,
13,
1678,
376,
25590,
369,
1115,
376,
29907,
29900,
29907,
29900,
29907,
29900,
613,
13,
1678,
376,
2536,
403,
1115,
376,
29955,
29900,
29947,
29900,
29929,
29900,
613,
13,
1678,
376,
4278,
1115,
376,
29909,
29955,
8610,
29900,
29900,
613,
13,
1678,
376,
13161,
1115,
376,
29928,
29906,
29933,
29946,
29947,
29907,
613,
13,
1678,
376,
4722,
412,
1115,
376,
29946,
29947,
29941,
29907,
29941,
29906,
613,
13,
1678,
376,
371,
284,
1115,
376,
29900,
29900,
29947,
29900,
29947,
29900,
613,
13,
1678,
376,
29873,
332,
339,
29877,
895,
1115,
376,
29946,
29900,
29923,
29900,
29928,
29900,
613,
13,
1678,
376,
499,
2572,
279,
457,
1115,
376,
29941,
29943,
29900,
29900,
4198,
613,
13,
1678,
376,
29894,
601,
1026,
1115,
376,
29955,
29943,
29900,
29900,
4198,
613,
13,
1678,
376,
2405,
333,
713,
1115,
376,
29946,
29900,
29947,
29906,
29953,
29928,
613,
13,
1678,
376,
10921,
1115,
376,
22098,
4198,
613,
13,
1678,
376,
29136,
1115,
376,
22098,
29900,
29900,
613,
13,
29913,
13,
2
] |
lib/metrics.py | jarobyte91/post_ocr_correction | 3 | 104623 | <reponame>jarobyte91/post_ocr_correction<gh_stars>1-10
import pandas as pd
from Levenshtein import distance
import re
from tqdm.notebook import tqdm
def levenshtein(reference, hypothesis, progress_bar = False):
assert len(reference) == len(hypothesis)
text = zip(reference, hypothesis)
if progress_bar:
text = tqdm(text, total = len(reference))
d = [distance(r, h) for r, h in text]
output = pd.DataFrame({"reference":reference, "hypothesis":hypothesis})\
.assign(distance = lambda df: d)\
.assign(cer = lambda df: df.apply(lambda r: 100 * r["distance"] / max(len(r["reference"]), 1), axis = 1))
return output
| [
1,
529,
276,
1112,
420,
29958,
4758,
18711,
371,
29929,
29896,
29914,
2490,
29918,
8415,
29918,
2616,
276,
428,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
11701,
408,
10518,
13,
3166,
951,
9852,
29882,
371,
262,
1053,
5418,
13,
5215,
337,
13,
3166,
260,
29939,
18933,
29889,
1333,
19273,
1053,
260,
29939,
18933,
13,
4706,
13,
1753,
454,
9852,
29882,
371,
262,
29898,
5679,
29892,
20051,
29892,
6728,
29918,
1646,
353,
7700,
1125,
13,
1678,
4974,
7431,
29898,
5679,
29897,
1275,
7431,
29898,
29882,
1478,
720,
6656,
29897,
13,
1678,
1426,
353,
14319,
29898,
5679,
29892,
20051,
29897,
13,
1678,
565,
6728,
29918,
1646,
29901,
13,
4706,
1426,
353,
260,
29939,
18933,
29898,
726,
29892,
3001,
353,
7431,
29898,
5679,
876,
13,
1678,
270,
353,
518,
19244,
29898,
29878,
29892,
298,
29897,
363,
364,
29892,
298,
297,
1426,
29962,
13,
1678,
1962,
353,
10518,
29889,
17271,
3319,
29908,
5679,
1115,
5679,
29892,
376,
29882,
1478,
720,
6656,
1115,
29882,
1478,
720,
6656,
11606,
13,
1678,
869,
16645,
29898,
19244,
353,
14013,
4489,
29901,
270,
2144,
13,
1678,
869,
16645,
29898,
2265,
353,
14013,
4489,
29901,
4489,
29889,
7302,
29898,
2892,
364,
29901,
29871,
29896,
29900,
29900,
334,
364,
3366,
19244,
3108,
847,
4236,
29898,
2435,
29898,
29878,
3366,
5679,
3108,
511,
29871,
29896,
511,
9685,
353,
29871,
29896,
876,
13,
1678,
736,
1962,
13,
2
] |
trove/guestagent/datastore/experimental/postgresql/service/process.py | cp16net/trove | 0 | 102940 | # Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from trove.common import cfg
from trove.common import utils
from trove.guestagent.common import operating_system
from trove.guestagent.datastore.experimental.postgresql.service.status import (
PgSqlAppStatus)
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
PGSQL_SERVICE_CANDIDATES = ("postgresql",)
class PgSqlProcess(object):
"""Mixin that manages the PgSql process."""
def start_db(self, context):
self._enable_pgsql_on_boot()
"""Start the PgSql service."""
cmd = operating_system.service_discovery(PGSQL_SERVICE_CANDIDATES)
LOG.info(
_("{guest_id}: Starting database engine with command ({command}).")
.format(
guest_id=CONF.guest_id,
command=cmd['cmd_start'],
)
)
utils.execute_with_timeout(
*cmd['cmd_start'].split(),
timeout=30
)
def _enable_pgsql_on_boot(self):
try:
pgsql_service = operating_system.service_discovery(
PGSQL_SERVICE_CANDIDATES)
utils.execute_with_timeout(pgsql_service['cmd_enable'],
shell=True)
except KeyError:
LOG.exception(_("Error enabling PostgreSQL start on boot."))
raise RuntimeError("Service is not discovered.")
def _disable_pgsql_on_boot(self):
try:
pgsql_service = operating_system.service_discovery(
PGSQL_SERVICE_CANDIDATES)
utils.execute_with_timeout(pgsql_service['cmd_disable'],
shell=True)
except KeyError:
LOG.exception(_("Error disabling PostgreSQL start on boot."))
raise RuntimeError("Service is not discovered.")
def stop_db(self, context, do_not_start_on_reboot=False):
"""Stop the PgSql service."""
if do_not_start_on_reboot:
self._disable_pgsql_on_boot()
cmd = operating_system.service_discovery(PGSQL_SERVICE_CANDIDATES)
LOG.info(
_("{guest_id}: Stopping database engine with command ({command}).")
.format(
guest_id=CONF.guest_id,
command=cmd['cmd_stop'],
)
)
utils.execute_with_timeout(
*cmd['cmd_stop'].split(),
timeout=30
)
def restart(self, context):
"""Restart the PgSql service."""
LOG.info(
_("{guest_id}: Restarting database engine.").format(
guest_id=CONF.guest_id,
)
)
try:
PgSqlAppStatus.get().begin_restart()
self.stop_db(context)
self.start_db(context)
finally:
PgSqlAppStatus.get().end_install_or_restart()
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29941,
4673,
7264,
10606,
13,
29937,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
1678,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
1678,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
1678,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
308,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
1678,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
1678,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
1678,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
1678,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1678,
1090,
278,
19245,
29889,
13,
13,
3166,
2897,
417,
29918,
1188,
1053,
1480,
408,
12183,
13,
13,
3166,
3147,
345,
29889,
9435,
1053,
274,
16434,
13,
3166,
3147,
345,
29889,
9435,
1053,
3667,
29879,
13,
3166,
3147,
345,
29889,
2543,
342,
14748,
29889,
9435,
1053,
13598,
29918,
5205,
13,
3166,
3147,
345,
29889,
2543,
342,
14748,
29889,
4130,
579,
487,
29889,
735,
27910,
29889,
29272,
29889,
5509,
29889,
4882,
1053,
313,
13,
1678,
349,
29887,
10520,
2052,
5709,
29897,
13,
13,
14480,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
6007,
29943,
353,
274,
16434,
29889,
6007,
29943,
13,
13,
16903,
4176,
29918,
6304,
19059,
29918,
29907,
9468,
1367,
1299,
2890,
353,
4852,
29272,
613,
29897,
13,
13,
13,
1990,
349,
29887,
10520,
7032,
29898,
3318,
1125,
13,
1678,
9995,
29924,
861,
262,
393,
767,
1179,
278,
349,
29887,
10520,
1889,
1213,
15945,
13,
13,
1678,
822,
1369,
29918,
2585,
29898,
1311,
29892,
3030,
1125,
13,
4706,
1583,
3032,
12007,
29918,
4061,
2850,
29918,
265,
29918,
4777,
580,
13,
4706,
9995,
4763,
278,
349,
29887,
10520,
2669,
1213,
15945,
13,
4706,
9920,
353,
13598,
29918,
5205,
29889,
5509,
29918,
2218,
11911,
29891,
29898,
16903,
4176,
29918,
6304,
19059,
29918,
29907,
9468,
1367,
1299,
2890,
29897,
13,
4706,
25401,
29889,
3888,
29898,
13,
9651,
903,
703,
29912,
2543,
342,
29918,
333,
6177,
23748,
2566,
6012,
411,
1899,
21313,
6519,
7690,
1159,
13,
9651,
869,
4830,
29898,
13,
18884,
17838,
29918,
333,
29922,
6007,
29943,
29889,
2543,
342,
29918,
333,
29892,
13,
18884,
1899,
29922,
9006,
1839,
9006,
29918,
2962,
7464,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
3667,
29879,
29889,
7978,
29918,
2541,
29918,
15619,
29898,
13,
9651,
334,
9006,
1839,
9006,
29918,
2962,
13359,
5451,
3285,
13,
9651,
11815,
29922,
29941,
29900,
13,
4706,
1723,
13,
13,
1678,
822,
903,
12007,
29918,
4061,
2850,
29918,
265,
29918,
4777,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
23822,
2850,
29918,
5509,
353,
13598,
29918,
5205,
29889,
5509,
29918,
2218,
11911,
29891,
29898,
13,
18884,
349,
29954,
4176,
29918,
6304,
19059,
29918,
29907,
9468,
1367,
1299,
2890,
29897,
13,
9651,
3667,
29879,
29889,
7978,
29918,
2541,
29918,
15619,
29898,
4061,
2850,
29918,
5509,
1839,
9006,
29918,
12007,
7464,
13,
462,
462,
539,
6473,
29922,
5574,
29897,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
25401,
29889,
11739,
7373,
703,
2392,
427,
17961,
4918,
7979,
4176,
1369,
373,
6579,
1213,
876,
13,
9651,
12020,
24875,
2392,
703,
3170,
338,
451,
10943,
23157,
13,
13,
1678,
822,
903,
20472,
29918,
4061,
2850,
29918,
265,
29918,
4777,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
23822,
2850,
29918,
5509,
353,
13598,
29918,
5205,
29889,
5509,
29918,
2218,
11911,
29891,
29898,
13,
18884,
349,
29954,
4176,
29918,
6304,
19059,
29918,
29907,
9468,
1367,
1299,
2890,
29897,
13,
9651,
3667,
29879,
29889,
7978,
29918,
2541,
29918,
15619,
29898,
4061,
2850,
29918,
5509,
1839,
9006,
29918,
20472,
7464,
13,
462,
462,
539,
6473,
29922,
5574,
29897,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
25401,
29889,
11739,
7373,
703,
2392,
766,
17961,
4918,
7979,
4176,
1369,
373,
6579,
1213,
876,
13,
9651,
12020,
24875,
2392,
703,
3170,
338,
451,
10943,
23157,
13,
13,
1678,
822,
5040,
29918,
2585,
29898,
1311,
29892,
3030,
29892,
437,
29918,
1333,
29918,
2962,
29918,
265,
29918,
276,
4777,
29922,
8824,
1125,
13,
4706,
9995,
16329,
278,
349,
29887,
10520,
2669,
1213,
15945,
13,
4706,
565,
437,
29918,
1333,
29918,
2962,
29918,
265,
29918,
276,
4777,
29901,
13,
9651,
1583,
3032,
20472,
29918,
4061,
2850,
29918,
265,
29918,
4777,
580,
13,
4706,
9920,
353,
13598,
29918,
5205,
29889,
5509,
29918,
2218,
11911,
29891,
29898,
16903,
4176,
29918,
6304,
19059,
29918,
29907,
9468,
1367,
1299,
2890,
29897,
13,
4706,
25401,
29889,
3888,
29898,
13,
9651,
903,
703,
29912,
2543,
342,
29918,
333,
6177,
6639,
3262,
2566,
6012,
411,
1899,
21313,
6519,
7690,
1159,
13,
9651,
869,
4830,
29898,
13,
18884,
17838,
29918,
333,
29922,
6007,
29943,
29889,
2543,
342,
29918,
333,
29892,
13,
18884,
1899,
29922,
9006,
1839,
9006,
29918,
9847,
7464,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
3667,
29879,
29889,
7978,
29918,
2541,
29918,
15619,
29898,
13,
9651,
334,
9006,
1839,
9006,
29918,
9847,
13359,
5451,
3285,
13,
9651,
11815,
29922,
29941,
29900,
13,
4706,
1723,
13,
13,
1678,
822,
10715,
29898,
1311,
29892,
3030,
1125,
13,
4706,
9995,
15078,
442,
278,
349,
29887,
10520,
2669,
1213,
15945,
13,
4706,
25401,
29889,
3888,
29898,
13,
9651,
903,
703,
29912,
2543,
342,
29918,
333,
6177,
11654,
442,
292,
2566,
6012,
1213,
467,
4830,
29898,
13,
18884,
17838,
29918,
333,
29922,
6007,
29943,
29889,
2543,
342,
29918,
333,
29892,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
1018,
29901,
13,
9651,
349,
29887,
10520,
2052,
5709,
29889,
657,
2141,
463,
29918,
5060,
442,
580,
13,
9651,
1583,
29889,
9847,
29918,
2585,
29898,
4703,
29897,
13,
9651,
1583,
29889,
2962,
29918,
2585,
29898,
4703,
29897,
13,
4706,
7146,
29901,
13,
9651,
349,
29887,
10520,
2052,
5709,
29889,
657,
2141,
355,
29918,
6252,
29918,
272,
29918,
5060,
442,
580,
13,
2
] |
tests/dialogs/wfDialComs.py | cefect/myCanFlood | 15 | 1604128 | <reponame>cefect/myCanFlood
'''
Created on Nov. 27, 2021
@author: cefect
commons for dialog workflow
'''
#==============================================================================
# imports---------------------------
#==============================================================================
#python standards
import os, logging, datetime, time, sys, traceback, unittest
from qgis.core import QgsCoordinateReferenceSystem, QgsVectorLayer, QgsProject
from PyQt5.QtWidgets import QApplication, QMainWindow
from wFlow.scripts import WorkFlow, Session
from hlpr.exceptions import Error
from hlpr.plug import plugLogger
from unittest import TestLoader
#===============================================================================
# #add a special hook tot he exception
#===============================================================================
def excepthook(exc_type, exc_value, exc_tb):
tb = "".join(traceback.format_exception(exc_type, exc_value, exc_tb))
print("error message:\n", tb)
QApplication.quit()
#===============================================================================
# logger
#===============================================================================
from hlpr.plug import plugLogger
from hlpr.logr import basic_logger
mod_logger = basic_logger()
class devPlugLogger(plugLogger):
"""wrapper to overwriting Qspecific methods with python logging"""
def getChild(self, new_childnm):
log_nm = '%s.%s'%(self.log_nm, new_childnm)
#build a new logger
child_log = devPlugLogger(self.parent,log_nm=log_nm)
return child_log
def _loghlp(self, #helper function for generalized logging
msg_raw, qlevel,
push=False, #treat as a push message on Qgis' bar
status=False, #whether to send to the status widget
):
#=======================================================================
# send message based on qlevel
#=======================================================================
msgDebug = '%s %s: %s'%(datetime.datetime.now().strftime('%d-%H.%M.%S'), self.log_nm, msg_raw)
if qlevel < 0: #file logger only
mod_logger.debug('D_%s'%msgDebug)
push, status = False, False #should never trip
else:#console logger
msg = '%s: %s'%(self.log_nm, msg_raw)
mod_logger.info(msg)
#Qgis bar
if push:
print('PUSH: ' +msg_raw)
class DSession(Session):
#placeholders expected on teh session by some dialogs
finv_vlay=None
iface = None
def __init__(self,
logger=None,
tag='devDial',
**kwargs
):
#add the exception hook
sys.excepthook = excepthook
if logger is None:
"""unlike the wflow session, plugin loggers use special methods for interfacing with QGIS"""
logger= devPlugLogger(self, log_nm='L')
super().__init__(logger=logger,tag=tag, **kwargs)
self.logger.info('finished DSession.init')
def run_suite(self,
workflow_l,
build_pickels = False,
get_tests=False,
**kwargs):
#=======================================================================
# defaults
#=======================================================================
log = self.logger.getChild('run_suite')
#=======================================================================
# user check
#=======================================================================
if build_pickels:
assert input('\n rebuild pickels on %i workflows? (y/n)'%len(workflow_l))=='y'
#=======================================================================
# loop and execute each workflow
#=======================================================================
first = True
for WorkFlow in workflow_l:
#===================================================================
# crs
#===================================================================
if not WorkFlow.crsid == self.crsid:
log.debug('crsid mismatch... switching to crs of workflow')
self.set_crs(WorkFlow.crsid, logger=log)
#=======================================================================
# #collect pars
#=======================================================================
"""similar to _get_wrkr().. but less flexible"""
for k in list(self.com_hndls) + self.flow_hndls:
kwargs[k] = getattr(self, k)
#init
kstr = ''.join(['\n %s: %s'%(k,v) for k,v in kwargs.items()]) #plot string
log.debug('building w/ %s'%kstr)
#===================================================================
# launch the flow
#===================================================================
with WorkFlow(logger=self.logger, session=self, **kwargs) as wflow:
wflow.pre()
wflow.D.launch()
wflow.post()
if build_pickels:
if first:
pick_d = dict()
pick_d[wflow.name] = wflow.write_pick()
if get_tests:
wflow.load_pick()
if first:
suite = unittest.TestSuite() #start the suite container
for tMethodName in TestLoader().getTestCaseNames(wflow.Test):
"""inits TestU only 1 test method per TeestU for now"""
suite.addTest(wflow.Test(tMethodName, runr=wflow))
#===================================================================
# wrap this workerse loop
#===================================================================
first=False
log.info('finished \'%s\''%WorkFlow.name)
#=======================================================================
# wrap
#=======================================================================
#attach results
if build_pickels:
self.pick_d = pick_d
log.info('wrote %i pickles'%len(pick_d))
if get_tests:
self.suite=suite
return self.out_dir
def run_wflow(self,
WorkFlow,
**kwargs):
#=======================================================================
# defaults
#=======================================================================
log = self.logger.getChild('run_wflow')
#===================================================================
# crs
#===================================================================
if not WorkFlow.crsid == self.crsid:
log.debug('crsid mismatch... switching to crs of workflow')
self.set_crs(WorkFlow.crsid, logger=log)
#=======================================================================
# #collect pars
#=======================================================================
"""similar to _get_wrkr().. but less flexible"""
for k in list(self.com_hndls) + self.flow_hndls:
kwargs[k] = getattr(self, k)
#init
kstr = ''.join(['\n %s: %s'%(k,v) for k,v in kwargs.items()]) #plot string
log.debug('building w/ %s'%kstr)
#===================================================================
# launch the flow
#===================================================================
with WorkFlow(logger=self.logger, session=self, **kwargs) as wflow:
log.info('\n PRE\n')
wflow.pre()
log.info('\n LAUNCH\n')
wflow.D.launch()
wflow.post()
sys.exit(self.qap.exec_()) #wrap
log.info('finished')
class DialWF(WorkFlow): #workflow to run on your dialog
name='DialWF'
pars_d = {}
DialogClass=None #replace with the dialog class you want to test on
crs = QgsCoordinateReferenceSystem('EPSG:4326')
def __init__(self,
DialogClass=None,
**kwargs):
super().__init__(**kwargs)
#=======================================================================
# setup the dialog
#=======================================================================
if DialogClass is None: DialogClass=self.DialogClass
self.D = DialogClass(None, session=self.session, plogger=self.logger)
self.res_d=dict()
def pre(self): #pre launch
pass #subclass to make your own
def post(self):
pass #subclass to create your own
def run_set(workflow_l,
**kwargs):
with DSession(**kwargs) as ses:
ses.run_suite(workflow_l)
out_dir = ses.out_dir
return out_dir
def open_dial(Workflow, #just open a dialog
**kwargs):
with DSession(**kwargs) as ses:
ses.run_wflow(Workflow)
out_dir = ses.out_dir
return out_dir
| [
1,
529,
276,
1112,
420,
29958,
346,
3647,
29914,
1357,
6028,
29943,
417,
397,
13,
12008,
13,
20399,
373,
2864,
29889,
29871,
29906,
29955,
29892,
29871,
29906,
29900,
29906,
29896,
13,
13,
29992,
8921,
29901,
274,
1389,
522,
13,
13,
22382,
363,
7928,
27321,
13,
12008,
13,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
29937,
24802,
2683,
1378,
5634,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
29937,
4691,
20801,
13,
5215,
2897,
29892,
12183,
29892,
12865,
29892,
931,
29892,
10876,
29892,
9637,
1627,
29892,
443,
27958,
13,
3166,
3855,
29887,
275,
29889,
3221,
1053,
660,
3174,
7967,
16065,
7422,
3924,
29892,
660,
3174,
12877,
14420,
29892,
660,
3174,
7653,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
4873,
29892,
660,
6330,
5907,
29871,
13,
13,
13,
3166,
281,
17907,
29889,
16713,
1053,
5244,
17907,
29892,
16441,
13,
13,
3166,
298,
29880,
558,
29889,
11739,
29879,
1053,
4829,
13,
13,
3166,
298,
29880,
558,
29889,
572,
688,
1053,
18665,
16363,
13,
13,
13,
3166,
443,
27958,
1053,
4321,
10036,
13,
13,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
25512,
13,
29937,
396,
1202,
263,
4266,
12422,
2025,
540,
3682,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
25512,
13,
1753,
429,
13300,
386,
2550,
29898,
735,
29883,
29918,
1853,
29892,
5566,
29918,
1767,
29892,
5566,
29918,
22625,
1125,
13,
1678,
260,
29890,
353,
376,
1642,
7122,
29898,
15003,
1627,
29889,
4830,
29918,
11739,
29898,
735,
29883,
29918,
1853,
29892,
5566,
29918,
1767,
29892,
5566,
29918,
22625,
876,
13,
1678,
1596,
703,
2704,
2643,
3583,
29876,
613,
260,
29890,
29897,
13,
1678,
660,
4873,
29889,
28358,
580,
13,
13,
13,
13,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
25512,
13,
29937,
17927,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
25512,
13,
3166,
298,
29880,
558,
29889,
572,
688,
1053,
18665,
16363,
13,
3166,
298,
29880,
558,
29889,
417,
629,
1053,
6996,
29918,
21707,
13,
1545,
29918,
21707,
353,
6996,
29918,
21707,
580,
13,
13,
1990,
2906,
3247,
688,
16363,
29898,
572,
688,
16363,
1125,
13,
1678,
9995,
17699,
304,
975,
16554,
660,
14940,
3519,
411,
3017,
12183,
15945,
29908,
13,
268,
13,
1678,
822,
679,
5938,
29898,
1311,
29892,
716,
29918,
5145,
22882,
1125,
13,
308,
13,
29871,
13,
4706,
1480,
29918,
22882,
353,
14210,
29879,
29889,
29995,
29879,
29915,
29995,
29898,
1311,
29889,
1188,
29918,
22882,
29892,
716,
29918,
5145,
22882,
29897,
13,
308,
13,
4706,
396,
4282,
263,
716,
17927,
13,
4706,
2278,
29918,
1188,
353,
2906,
3247,
688,
16363,
29898,
1311,
29889,
3560,
29892,
1188,
29918,
22882,
29922,
1188,
29918,
22882,
29897,
13,
308,
13,
13,
308,
13,
4706,
736,
2278,
29918,
1188,
13,
308,
13,
965,
13,
268,
13,
1678,
822,
903,
1188,
4415,
29886,
29898,
1311,
29892,
396,
20907,
740,
363,
28803,
12183,
13,
18884,
10191,
29918,
1610,
29892,
3855,
5563,
29892,
29871,
13,
18884,
5503,
29922,
8824,
29892,
396,
2484,
271,
408,
263,
5503,
2643,
373,
660,
29887,
275,
29915,
2594,
13,
18884,
4660,
29922,
8824,
29892,
396,
1332,
1979,
304,
3638,
304,
278,
4660,
11109,
13,
462,
1125,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
3638,
2643,
2729,
373,
3855,
5563,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
10191,
11862,
353,
14210,
29879,
1678,
1273,
29879,
29901,
1273,
29879,
29915,
29995,
29898,
12673,
29889,
12673,
29889,
3707,
2141,
710,
615,
603,
877,
29995,
29881,
19222,
29950,
29889,
29995,
29924,
29889,
29995,
29903,
5477,
1583,
29889,
1188,
29918,
22882,
29892,
29871,
10191,
29918,
1610,
29897,
13,
4706,
565,
3855,
5563,
529,
29871,
29900,
29901,
396,
1445,
17927,
871,
13,
632,
13,
9651,
878,
29918,
21707,
29889,
8382,
877,
29928,
29918,
29995,
29879,
29915,
29995,
7645,
11862,
29897,
13,
9651,
5503,
29892,
4660,
353,
7700,
29892,
7700,
396,
9344,
2360,
17487,
13,
4706,
1683,
21968,
11058,
17927,
13,
9651,
10191,
353,
14210,
29879,
29901,
259,
1273,
29879,
29915,
29995,
29898,
1311,
29889,
1188,
29918,
22882,
29892,
10191,
29918,
1610,
29897,
13,
9651,
878,
29918,
21707,
29889,
3888,
29898,
7645,
29897,
13,
29871,
13,
308,
13,
4706,
396,
29984,
29887,
275,
2594,
13,
4706,
565,
5503,
29901,
13,
9651,
1596,
877,
29925,
3308,
29950,
29901,
525,
718,
7645,
29918,
1610,
29897,
13,
13,
13,
13,
308,
13,
308,
13,
29871,
13,
268,
13,
1990,
360,
7317,
29898,
7317,
1125,
13,
268,
13,
268,
13,
268,
13,
1678,
396,
6689,
8948,
414,
3806,
373,
734,
29882,
4867,
491,
777,
7928,
29879,
13,
1678,
1436,
29894,
29918,
29894,
8387,
29922,
8516,
13,
1678,
565,
815,
353,
6213,
13,
29871,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
17927,
29922,
8516,
29892,
29871,
13,
462,
4055,
2433,
3359,
29928,
616,
742,
13,
462,
3579,
19290,
13,
462,
29871,
1125,
13,
308,
13,
4706,
396,
1202,
278,
3682,
12422,
13,
4706,
10876,
29889,
735,
13300,
386,
2550,
353,
429,
13300,
386,
2550,
13,
308,
13,
308,
13,
4706,
565,
17927,
338,
6213,
29901,
13,
9651,
9995,
348,
4561,
278,
281,
1731,
4867,
29892,
7079,
1480,
5743,
671,
4266,
3519,
363,
1006,
29888,
9390,
411,
660,
29954,
3235,
15945,
29908,
13,
13,
9651,
17927,
29922,
2906,
3247,
688,
16363,
29898,
1311,
29892,
1480,
29918,
22882,
2433,
29931,
1495,
13,
308,
13,
308,
13,
4706,
2428,
2141,
1649,
2344,
12035,
21707,
29922,
21707,
29892,
4039,
29922,
4039,
29892,
3579,
19290,
29897,
29871,
13,
308,
13,
4706,
1583,
29889,
21707,
29889,
3888,
877,
4951,
3276,
360,
7317,
29889,
2344,
1495,
13,
308,
13,
1678,
822,
1065,
29918,
13495,
29898,
1311,
29892,
13,
462,
29871,
27321,
29918,
29880,
29892,
13,
462,
29871,
2048,
29918,
23945,
1379,
353,
7700,
29892,
13,
462,
29871,
679,
29918,
21150,
29922,
8824,
29892,
13,
462,
29871,
3579,
19290,
1125,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
21274,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
1480,
353,
1583,
29889,
21707,
29889,
657,
5938,
877,
3389,
29918,
13495,
1495,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
1404,
1423,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
565,
2048,
29918,
23945,
1379,
29901,
13,
9651,
4974,
1881,
28909,
29876,
1678,
337,
4282,
5839,
1379,
373,
1273,
29875,
27321,
29879,
29973,
313,
29891,
29914,
29876,
16029,
29995,
2435,
29898,
1287,
1731,
29918,
29880,
876,
1360,
29915,
29891,
29915,
13,
308,
13,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
2425,
322,
6222,
1269,
27321,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
937,
353,
5852,
13,
4706,
363,
5244,
17907,
297,
27321,
29918,
29880,
29901,
13,
632,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
9651,
396,
2181,
29879,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
9651,
565,
451,
5244,
17907,
29889,
29883,
2288,
333,
1275,
1583,
29889,
29883,
2288,
333,
29901,
13,
18884,
1480,
29889,
8382,
877,
29883,
2288,
333,
29635,
856,
21293,
304,
2181,
29879,
310,
27321,
1495,
13,
18884,
1583,
29889,
842,
29918,
29883,
2288,
29898,
5531,
17907,
29889,
29883,
2288,
333,
29892,
17927,
29922,
1188,
29897,
13,
462,
13,
462,
13,
9651,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
9651,
396,
396,
15914,
610,
29879,
13,
9651,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
9651,
9995,
29764,
304,
903,
657,
29918,
15866,
12748,
2141,
29889,
541,
3109,
25706,
15945,
29908,
13,
9651,
363,
413,
297,
1051,
29898,
1311,
29889,
510,
29918,
29882,
299,
3137,
29897,
718,
1583,
29889,
1731,
29918,
29882,
299,
3137,
29901,
13,
18884,
9049,
5085,
29961,
29895,
29962,
353,
679,
5552,
29898,
1311,
29892,
413,
29897,
13,
268,
13,
9651,
396,
2344,
13,
9651,
413,
710,
353,
525,
4286,
7122,
18959,
29905,
29876,
1678,
1273,
29879,
29901,
1273,
29879,
29915,
29995,
29898,
29895,
29892,
29894,
29897,
363,
413,
29892,
29894,
297,
9049,
5085,
29889,
7076,
580,
2314,
396,
5317,
1347,
13,
9651,
1480,
29889,
8382,
877,
25237,
281,
29914,
1273,
29879,
29915,
29995,
29895,
710,
29897,
13,
632,
13,
632,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
9651,
396,
6826,
278,
4972,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
632,
13,
29871,
13,
9651,
411,
5244,
17907,
29898,
21707,
29922,
1311,
29889,
21707,
29892,
4867,
29922,
1311,
29892,
3579,
19290,
29897,
408,
281,
1731,
29901,
13,
462,
13,
18884,
281,
1731,
29889,
1457,
580,
13,
462,
13,
18884,
281,
1731,
29889,
29928,
29889,
15343,
580,
13,
462,
13,
18884,
281,
1731,
29889,
2490,
580,
13,
462,
13,
18884,
565,
2048,
29918,
23945,
1379,
29901,
13,
462,
1678,
565,
937,
29901,
13,
462,
4706,
5839,
29918,
29881,
353,
9657,
580,
13,
462,
1678,
5839,
29918,
29881,
29961,
29893,
1731,
29889,
978,
29962,
353,
281,
1731,
29889,
3539,
29918,
23945,
580,
13,
462,
268,
13,
18884,
565,
679,
29918,
21150,
29901,
13,
462,
1678,
281,
1731,
29889,
1359,
29918,
23945,
580,
13,
462,
1678,
565,
937,
29901,
13,
462,
4706,
9460,
353,
443,
27958,
29889,
3057,
5091,
568,
580,
396,
2962,
278,
9460,
5639,
13,
462,
308,
13,
462,
1678,
363,
260,
4062,
1170,
297,
4321,
10036,
2141,
657,
3057,
8259,
8659,
29898,
29893,
1731,
29889,
3057,
1125,
13,
462,
4706,
9995,
262,
1169,
4321,
29965,
871,
29871,
29896,
1243,
1158,
639,
1920,
342,
29965,
363,
1286,
15945,
29908,
13,
462,
4706,
9460,
29889,
1202,
3057,
29898,
29893,
1731,
29889,
3057,
29898,
29873,
4062,
1170,
29892,
1065,
29878,
29922,
29893,
1731,
876,
13,
462,
268,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
9651,
396,
12244,
445,
15645,
344,
2425,
268,
13,
9651,
396,
9166,
9166,
9166,
9166,
25512,
13,
9651,
937,
29922,
8824,
13,
462,
268,
13,
462,
13,
9651,
1480,
29889,
3888,
877,
4951,
3276,
320,
29915,
29995,
29879,
29905,
4907,
29995,
5531,
17907,
29889,
978,
29897,
13,
632,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
12244,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
14930,
2582,
13,
4706,
565,
2048,
29918,
23945,
1379,
29901,
13,
9651,
1583,
29889,
23945,
29918,
29881,
353,
5839,
29918,
29881,
13,
9651,
1480,
29889,
3888,
877,
29893,
4859,
1273,
29875,
5839,
793,
29915,
29995,
2435,
29898,
23945,
29918,
29881,
876,
13,
4706,
565,
679,
29918,
21150,
29901,
13,
9651,
1583,
29889,
13495,
29922,
13495,
13,
632,
13,
4706,
736,
1583,
29889,
449,
29918,
3972,
13,
268,
13,
1678,
822,
1065,
29918,
29893,
1731,
29898,
1311,
29892,
13,
462,
29871,
5244,
17907,
29892,
13,
462,
29871,
3579,
19290,
1125,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
21274,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
1480,
353,
1583,
29889,
21707,
29889,
657,
5938,
877,
3389,
29918,
29893,
1731,
1495,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
25512,
13,
4706,
396,
2181,
29879,
13,
4706,
396,
9166,
9166,
9166,
9166,
25512,
13,
4706,
565,
451,
5244,
17907,
29889,
29883,
2288,
333,
1275,
1583,
29889,
29883,
2288,
333,
29901,
13,
9651,
1480,
29889,
8382,
877,
29883,
2288,
333,
29635,
856,
21293,
304,
2181,
29879,
310,
27321,
1495,
13,
9651,
1583,
29889,
842,
29918,
29883,
2288,
29898,
5531,
17907,
29889,
29883,
2288,
333,
29892,
17927,
29922,
1188,
29897,
13,
632,
13,
632,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
396,
15914,
610,
29879,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
9995,
29764,
304,
903,
657,
29918,
15866,
12748,
2141,
29889,
541,
3109,
25706,
15945,
29908,
13,
4706,
363,
413,
297,
1051,
29898,
1311,
29889,
510,
29918,
29882,
299,
3137,
29897,
718,
1583,
29889,
1731,
29918,
29882,
299,
3137,
29901,
13,
9651,
9049,
5085,
29961,
29895,
29962,
353,
679,
5552,
29898,
1311,
29892,
413,
29897,
13,
308,
13,
4706,
396,
2344,
13,
4706,
413,
710,
353,
525,
4286,
7122,
18959,
29905,
29876,
1678,
1273,
29879,
29901,
1273,
29879,
29915,
29995,
29898,
29895,
29892,
29894,
29897,
363,
413,
29892,
29894,
297,
9049,
5085,
29889,
7076,
580,
2314,
396,
5317,
1347,
13,
4706,
1480,
29889,
8382,
877,
25237,
281,
29914,
1273,
29879,
29915,
29995,
29895,
710,
29897,
13,
308,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
25512,
13,
4706,
396,
6826,
278,
4972,
13,
4706,
396,
9166,
9166,
9166,
9166,
25512,
13,
4706,
411,
5244,
17907,
29898,
21707,
29922,
1311,
29889,
21707,
29892,
4867,
29922,
1311,
29892,
3579,
19290,
29897,
408,
281,
1731,
29901,
13,
9651,
1480,
29889,
3888,
28909,
29876,
1678,
349,
1525,
29905,
29876,
1495,
13,
9651,
281,
1731,
29889,
1457,
580,
13,
9651,
1480,
29889,
3888,
28909,
29876,
1678,
17900,
3904,
3210,
29905,
29876,
1495,
13,
9651,
281,
1731,
29889,
29928,
29889,
15343,
580,
13,
632,
13,
9651,
281,
1731,
29889,
2490,
580,
13,
632,
13,
9651,
10876,
29889,
13322,
29898,
1311,
29889,
29939,
481,
29889,
4258,
29918,
3101,
396,
6312,
13,
632,
13,
632,
13,
4706,
1480,
29889,
3888,
877,
4951,
3276,
1495,
13,
308,
13,
632,
13,
268,
13,
268,
13,
1990,
360,
616,
29686,
29898,
5531,
17907,
1125,
396,
1287,
1731,
304,
1065,
373,
596,
7928,
13,
1678,
1024,
2433,
29928,
616,
29686,
29915,
13,
1678,
610,
29879,
29918,
29881,
353,
6571,
13,
1678,
18878,
2385,
29922,
8516,
396,
6506,
411,
278,
7928,
770,
366,
864,
304,
1243,
373,
13,
268,
13,
1678,
2181,
29879,
353,
660,
3174,
7967,
16065,
7422,
3924,
877,
29923,
7024,
29954,
29901,
29946,
29941,
29906,
29953,
1495,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
18878,
2385,
29922,
8516,
29892,
13,
462,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
1068,
19290,
29897,
13,
308,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
396,
6230,
278,
7928,
13,
4706,
396,
9166,
9166,
9166,
9166,
2751,
25512,
13,
4706,
565,
18878,
2385,
338,
6213,
29901,
18878,
2385,
29922,
1311,
29889,
7647,
2385,
13,
4706,
1583,
29889,
29928,
353,
18878,
2385,
29898,
8516,
29892,
4867,
29922,
1311,
29889,
7924,
29892,
282,
21707,
29922,
1311,
29889,
21707,
29897,
13,
4706,
1583,
29889,
690,
29918,
29881,
29922,
8977,
580,
259,
13,
268,
13,
1678,
822,
758,
29898,
1311,
1125,
396,
1457,
6826,
13,
4706,
1209,
396,
1491,
1990,
304,
1207,
596,
1914,
13,
268,
13,
1678,
822,
1400,
29898,
1311,
1125,
13,
4706,
1209,
396,
1491,
1990,
304,
1653,
596,
1914,
13,
268,
13,
268,
13,
13,
1753,
1065,
29918,
842,
29898,
1287,
1731,
29918,
29880,
29892,
13,
965,
3579,
19290,
1125,
13,
268,
13,
1678,
411,
360,
7317,
29898,
1068,
19290,
29897,
408,
3999,
29901,
13,
308,
13,
4706,
3999,
29889,
3389,
29918,
13495,
29898,
1287,
1731,
29918,
29880,
29897,
13,
308,
13,
4706,
714,
29918,
3972,
353,
3999,
29889,
449,
29918,
3972,
13,
308,
13,
1678,
736,
714,
29918,
3972,
13,
13,
1753,
1722,
29918,
29881,
616,
29898,
5531,
1731,
29892,
396,
5143,
1722,
263,
7928,
13,
795,
3579,
19290,
1125,
13,
268,
13,
1678,
411,
360,
7317,
29898,
1068,
19290,
29897,
408,
3999,
29901,
13,
308,
13,
4706,
3999,
29889,
3389,
29918,
29893,
1731,
29898,
5531,
1731,
29897,
13,
308,
13,
4706,
714,
29918,
3972,
353,
3999,
29889,
449,
29918,
3972,
13,
308,
13,
1678,
736,
714,
29918,
3972,
13,
268,
13,
268,
13,
268,
13,
308,
13,
308,
13,
2
] |
tests/management/commands/test_create_command.py | kaozdl/django-extensions | 0 | 17322 | # -*- coding: utf-8 -*-
import os
import shutil
from django.conf import settings
from django.core.management import call_command
from django.test import TestCase
from six import StringIO
try:
from unittest.mock import patch
except ImportError:
from mock import patch
class CreateCommandTests(TestCase):
"""Tests for create_command command."""
def setUp(self): # noqa
self.management_command_path = os.path.join(
settings.BASE_DIR, 'tests/testapp/management')
self.command_template_path = os.path.join(
settings.BASE_DIR, 'django_extensions/conf/command_template')
self.files = [
'__init__.py',
'commands/__init__.py',
'commands/sample.py',
]
def tearDown(self): # noqa
shutil.rmtree(self.management_command_path,
ignore_errors=True)
shutil.rmtree(os.path.join(self.command_template_path, '.hidden'),
ignore_errors=True)
test_pyc_path = os.path.join(self.command_template_path, 'test.pyc')
if os.path.isfile(test_pyc_path):
os.remove(test_pyc_path)
def _create_management_command_with_empty_files(self):
os.mkdir(self.management_command_path)
os.mkdir(os.path.join(self.management_command_path, 'commands'))
for f in self.files:
os.mknod(os.path.join(self.management_command_path, f))
def _create__pycache__in_command_template_directory(self):
os.mknod(os.path.join(self.command_template_path, 'test.pyc'))
def _create_hidden_directory_in_command_template_directory(self):
os.mkdir(os.path.join(self.command_template_path, '.hidden'))
@patch('sys.stdout', new_callable=StringIO)
def test_should_print_management_command_files_only_on_dry_run(self, m_stdout): # noqa
call_command('create_command', 'testapp', '--dry-run', verbosity=2)
for f in self.files:
filepath = os.path.join(self.management_command_path, f)
self.assertIn(filepath, m_stdout.getvalue())
self.assertFalse(os.path.isfile(filepath))
@patch('sys.stdout', new_callable=StringIO)
def test_should_create_management_command_files_and_print_filepaths(self, m_stdout): # noqa
call_command('create_command', 'testapp', verbosity=2)
for f in self.files:
filepath = os.path.join(self.management_command_path, f)
self.assertIn(filepath, m_stdout.getvalue())
self.assertTrue(os.path.isfile(filepath))
@patch('sys.stdout', new_callable=StringIO)
def test_should_print_that_filepaths_already_exists(self, m_stdout): # noqa
self._create_management_command_with_empty_files()
call_command('create_command', 'testapp', verbosity=2)
for f in self.files:
filepath = os.path.join(self.management_command_path, f)
self.assertIn(
'{} already exists'.format(filepath), m_stdout.getvalue())
self.assertTrue(os.path.isfile(filepath))
self.assertEqual(os.path.getsize(filepath), 0)
@patch('sys.stderr', new_callable=StringIO)
@patch('django_extensions.management.commands.create_command._make_writeable') # noqa
def test_should_print_error_on_OSError_exception(self, m__make_writeable, m_stderr): # noqa
m__make_writeable.side_effect = OSError
self._create__pycache__in_command_template_directory()
self._create_hidden_directory_in_command_template_directory()
call_command('create_command', 'testapp')
for f in self.files:
filepath = os.path.join(self.management_command_path, f)
self.assertIn("Notice: Couldn't set permission bits on {}. You're probably using an uncommon filesystem setup. No problem.\n".format(filepath), # noqa
m_stderr.getvalue())
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
3221,
29889,
21895,
1053,
1246,
29918,
6519,
13,
3166,
9557,
29889,
1688,
1053,
4321,
8259,
13,
3166,
4832,
1053,
1714,
5971,
13,
13,
2202,
29901,
13,
1678,
515,
443,
27958,
29889,
17640,
1053,
13261,
13,
19499,
16032,
2392,
29901,
13,
1678,
515,
11187,
1053,
13261,
13,
13,
13,
1990,
6204,
6255,
24376,
29898,
3057,
8259,
1125,
13,
1678,
9995,
24376,
363,
1653,
29918,
6519,
1899,
1213,
15945,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
29871,
396,
694,
25621,
13,
4706,
1583,
29889,
21895,
29918,
6519,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
6055,
29889,
25416,
29918,
9464,
29892,
525,
21150,
29914,
1688,
932,
29914,
21895,
1495,
13,
4706,
1583,
29889,
6519,
29918,
6886,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
6055,
29889,
25416,
29918,
9464,
29892,
525,
14095,
29918,
24299,
29914,
5527,
29914,
6519,
29918,
6886,
1495,
13,
13,
4706,
1583,
29889,
5325,
353,
518,
13,
9651,
525,
1649,
2344,
26914,
2272,
742,
13,
9651,
525,
26381,
29914,
1649,
2344,
26914,
2272,
742,
13,
9651,
525,
26381,
29914,
11249,
29889,
2272,
742,
13,
4706,
4514,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
29871,
396,
694,
25621,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
13,
462,
418,
11455,
29918,
12523,
29922,
5574,
29897,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
6519,
29918,
6886,
29918,
2084,
29892,
15300,
10892,
5477,
13,
462,
418,
11455,
29918,
12523,
29922,
5574,
29897,
13,
4706,
1243,
29918,
2272,
29883,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
6519,
29918,
6886,
29918,
2084,
29892,
525,
1688,
29889,
2272,
29883,
1495,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
1688,
29918,
2272,
29883,
29918,
2084,
1125,
13,
9651,
2897,
29889,
5992,
29898,
1688,
29918,
2272,
29883,
29918,
2084,
29897,
13,
13,
1678,
822,
903,
3258,
29918,
21895,
29918,
6519,
29918,
2541,
29918,
6310,
29918,
5325,
29898,
1311,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29897,
13,
4706,
2897,
29889,
11256,
3972,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
525,
26381,
8785,
13,
4706,
363,
285,
297,
1583,
29889,
5325,
29901,
13,
9651,
2897,
29889,
29885,
3959,
397,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
285,
876,
13,
13,
1678,
822,
903,
3258,
1649,
2272,
8173,
1649,
262,
29918,
6519,
29918,
6886,
29918,
12322,
29898,
1311,
1125,
13,
4706,
2897,
29889,
29885,
3959,
397,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
6519,
29918,
6886,
29918,
2084,
29892,
525,
1688,
29889,
2272,
29883,
8785,
13,
13,
1678,
822,
903,
3258,
29918,
10892,
29918,
12322,
29918,
262,
29918,
6519,
29918,
6886,
29918,
12322,
29898,
1311,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
6519,
29918,
6886,
29918,
2084,
29892,
15300,
10892,
8785,
13,
13,
1678,
732,
5041,
877,
9675,
29889,
25393,
742,
716,
29918,
4804,
519,
29922,
1231,
5971,
29897,
13,
1678,
822,
1243,
29918,
9344,
29918,
2158,
29918,
21895,
29918,
6519,
29918,
5325,
29918,
6194,
29918,
265,
29918,
29881,
719,
29918,
3389,
29898,
1311,
29892,
286,
29918,
25393,
1125,
29871,
396,
694,
25621,
13,
4706,
1246,
29918,
6519,
877,
3258,
29918,
6519,
742,
525,
1688,
932,
742,
525,
489,
29881,
719,
29899,
3389,
742,
9750,
359,
537,
29922,
29906,
29897,
13,
13,
4706,
363,
285,
297,
1583,
29889,
5325,
29901,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
285,
29897,
13,
9651,
1583,
29889,
9294,
797,
29898,
1445,
2084,
29892,
286,
29918,
25393,
29889,
657,
1767,
3101,
13,
9651,
1583,
29889,
9294,
8824,
29898,
359,
29889,
2084,
29889,
275,
1445,
29898,
1445,
2084,
876,
13,
13,
1678,
732,
5041,
877,
9675,
29889,
25393,
742,
716,
29918,
4804,
519,
29922,
1231,
5971,
29897,
13,
1678,
822,
1243,
29918,
9344,
29918,
3258,
29918,
21895,
29918,
6519,
29918,
5325,
29918,
392,
29918,
2158,
29918,
1445,
24772,
29898,
1311,
29892,
286,
29918,
25393,
1125,
29871,
396,
694,
25621,
13,
4706,
1246,
29918,
6519,
877,
3258,
29918,
6519,
742,
525,
1688,
932,
742,
9750,
359,
537,
29922,
29906,
29897,
13,
13,
4706,
363,
285,
297,
1583,
29889,
5325,
29901,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
285,
29897,
13,
9651,
1583,
29889,
9294,
797,
29898,
1445,
2084,
29892,
286,
29918,
25393,
29889,
657,
1767,
3101,
13,
9651,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
275,
1445,
29898,
1445,
2084,
876,
13,
13,
1678,
732,
5041,
877,
9675,
29889,
25393,
742,
716,
29918,
4804,
519,
29922,
1231,
5971,
29897,
13,
1678,
822,
1243,
29918,
9344,
29918,
2158,
29918,
5747,
29918,
1445,
24772,
29918,
284,
2040,
29918,
9933,
29898,
1311,
29892,
286,
29918,
25393,
1125,
29871,
396,
694,
25621,
13,
4706,
1583,
3032,
3258,
29918,
21895,
29918,
6519,
29918,
2541,
29918,
6310,
29918,
5325,
580,
13,
13,
4706,
1246,
29918,
6519,
877,
3258,
29918,
6519,
742,
525,
1688,
932,
742,
9750,
359,
537,
29922,
29906,
29897,
13,
13,
4706,
363,
285,
297,
1583,
29889,
5325,
29901,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
285,
29897,
13,
9651,
1583,
29889,
9294,
797,
29898,
13,
18884,
525,
8875,
2307,
4864,
4286,
4830,
29898,
1445,
2084,
511,
286,
29918,
25393,
29889,
657,
1767,
3101,
13,
9651,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
275,
1445,
29898,
1445,
2084,
876,
13,
9651,
1583,
29889,
9294,
9843,
29898,
359,
29889,
2084,
29889,
657,
2311,
29898,
1445,
2084,
511,
29871,
29900,
29897,
13,
13,
1678,
732,
5041,
877,
9675,
29889,
303,
20405,
742,
716,
29918,
4804,
519,
29922,
1231,
5971,
29897,
13,
1678,
732,
5041,
877,
14095,
29918,
24299,
29889,
21895,
29889,
26381,
29889,
3258,
29918,
6519,
3032,
5675,
29918,
3539,
519,
1495,
29871,
396,
694,
25621,
13,
1678,
822,
1243,
29918,
9344,
29918,
2158,
29918,
2704,
29918,
265,
29918,
29949,
29173,
29918,
11739,
29898,
1311,
29892,
286,
1649,
5675,
29918,
3539,
519,
29892,
286,
29918,
303,
20405,
1125,
29871,
396,
694,
25621,
13,
4706,
286,
1649,
5675,
29918,
3539,
519,
29889,
2975,
29918,
15987,
353,
438,
29173,
13,
4706,
1583,
3032,
3258,
1649,
2272,
8173,
1649,
262,
29918,
6519,
29918,
6886,
29918,
12322,
580,
13,
4706,
1583,
3032,
3258,
29918,
10892,
29918,
12322,
29918,
262,
29918,
6519,
29918,
6886,
29918,
12322,
580,
13,
13,
4706,
1246,
29918,
6519,
877,
3258,
29918,
6519,
742,
525,
1688,
932,
1495,
13,
4706,
363,
285,
297,
1583,
29889,
5325,
29901,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
21895,
29918,
6519,
29918,
2084,
29892,
285,
29897,
13,
9651,
1583,
29889,
9294,
797,
703,
3664,
625,
29901,
6527,
29876,
29915,
29873,
731,
10751,
9978,
373,
426,
1836,
887,
29915,
276,
3117,
773,
385,
443,
9435,
22101,
6230,
29889,
1939,
1108,
7790,
29876,
1642,
4830,
29898,
1445,
2084,
511,
29871,
396,
694,
25621,
13,
462,
3986,
286,
29918,
303,
20405,
29889,
657,
1767,
3101,
13,
2
] |
commit_data.py | iwangjian/ByteCup2018 | 80 | 45700 | <filename>commit_data.py
import os
import argparse
def process_decoded(args):
if not os.path.exists(args.result_dir):
os.mkdir(args.result_dir)
punct = ["/", "`", "+", "-", ";", "-lrb-", "-rrb-", "``", "|", "~", """]
for file in os.listdir(args.decode_dir):
file_path = os.path.join(args.decode_dir, file)
file_id = int(str(file).split('.')[0]) + 1
res_file = str(file_id) + '.txt'
res_path = os.path.join(args.result_dir, res_file)
temp = []
with open(file_path, 'r') as fr:
text = fr.read().strip()
data = text.split(" ")
for word in data:
if not word in punct:
temp.append(word)
with open(res_path, 'w', encoding='utf-8') as fw:
fw.write(" ".join(temp))
fw.write('\n')
print("Finished: %s" % args.result_dir)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert decoded files to commit files')
parser.add_argument('--decode_dir', action='store', required=True,
help='directory of decoded summaries')
parser.add_argument('--result_dir', action='store', required=True,
help='directory of submission')
args = parser.parse_args()
process_decoded(args)
| [
1,
529,
9507,
29958,
15060,
29918,
1272,
29889,
2272,
13,
5215,
2897,
13,
5215,
1852,
5510,
13,
13,
13,
1753,
1889,
29918,
7099,
6797,
29898,
5085,
1125,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
5085,
29889,
2914,
29918,
3972,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
5085,
29889,
2914,
29918,
3972,
29897,
13,
13,
1678,
6035,
312,
353,
6796,
29914,
613,
29724,
613,
15691,
613,
11663,
613,
12159,
613,
11663,
29880,
6050,
29899,
613,
11663,
29878,
6050,
29899,
613,
376,
16159,
613,
376,
29989,
613,
376,
30022,
613,
376,
29987,
23083,
3108,
13,
1678,
363,
934,
297,
2897,
29889,
1761,
3972,
29898,
5085,
29889,
13808,
29918,
3972,
1125,
13,
4706,
934,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
13808,
29918,
3972,
29892,
934,
29897,
13,
13,
4706,
934,
29918,
333,
353,
938,
29898,
710,
29898,
1445,
467,
5451,
12839,
29861,
29900,
2314,
718,
29871,
29896,
13,
13,
4706,
620,
29918,
1445,
353,
851,
29898,
1445,
29918,
333,
29897,
718,
15300,
3945,
29915,
13,
4706,
620,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
2914,
29918,
3972,
29892,
620,
29918,
1445,
29897,
13,
4706,
5694,
353,
5159,
13,
4706,
411,
1722,
29898,
1445,
29918,
2084,
29892,
525,
29878,
1495,
408,
1424,
29901,
13,
9651,
1426,
353,
1424,
29889,
949,
2141,
17010,
580,
13,
9651,
848,
353,
1426,
29889,
5451,
703,
16521,
13,
9651,
363,
1734,
297,
848,
29901,
13,
18884,
565,
451,
1734,
297,
6035,
312,
29901,
13,
462,
1678,
5694,
29889,
4397,
29898,
1742,
29897,
13,
9651,
411,
1722,
29898,
690,
29918,
2084,
29892,
525,
29893,
742,
8025,
2433,
9420,
29899,
29947,
1495,
408,
285,
29893,
29901,
13,
18884,
285,
29893,
29889,
3539,
703,
11393,
7122,
29898,
7382,
876,
13,
18884,
285,
29893,
29889,
3539,
28909,
29876,
1495,
13,
1678,
1596,
703,
12881,
3276,
29901,
1273,
29879,
29908,
1273,
6389,
29889,
2914,
29918,
3972,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
18455,
1602,
6797,
2066,
304,
9063,
2066,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
13808,
29918,
3972,
742,
3158,
2433,
8899,
742,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
12322,
310,
1602,
6797,
19138,
583,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2914,
29918,
3972,
742,
3158,
2433,
8899,
742,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
12322,
310,
29240,
1495,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
1889,
29918,
7099,
6797,
29898,
5085,
29897,
13,
2
] |
adminmgr/media/code/A3/task1/BD_1348_1576_1597_gO6b0h8.py | IamMayankThakur/test-bigdata | 9 | 179443 | import findspark
findspark.init()
import time
from pyspark.sql import SparkSession
from pyspark.streaming import StreamingContext
from pyspark.sql.types import StructType, StructField, StringType
from pyspark.sql import Row,SQLContext
from pyspark.sql.functions import explode, split
import sys
import requests
def get_schema():
"""get instance usage schema."""
# Initialize columns for all string fields
columns = ["tweetid", "lang", "date",
"source", "len", "likes", "rts", "hashtags",
"usermentionnames", "usermentionid",
"name",
"place", "followers",
"friends"]
columns_struct_fields = [StructField(field_name, StringType(), True)
for field_name in columns]
schema = StructType(columns_struct_fields)
return schema
def aggregate_tweets_count(new_values, total_sum):
return sum(new_values) + (total_sum or 0)
def get_sql_context_instance(spark_context):
if ('sqlContextSingletonInstance' not in globals()):
globals()['sqlContextSingletonInstance'] = SQLContext(spark_context)
return globals()['sqlContextSingletonInstance']
def process_rdd(time, rdd):
try:
sql_context = get_sql_context_instance(rdd.context)
row_rdd = rdd.map(lambda w: Row(tweetid=w[0], hashtags=w[7]))
print(row_rdd)
hashtags_df = sql_context.createDataFrame(row_rdd)
hashtags_df.registerTempTable("allhashtags")
hashtag_counts_df = sql_context.sql("select tweetid, hashtags from allhashtags")
hashtag_counts_df.show()
except:
e = sys.exc_info()[0]
print("Error: %s" % e)
def tmp(x):
return (x.split(';')[0],1)
spark = SparkSession \
.builder \
.appName("BigData") \
.getOrCreate()
userSchema = get_schema()
csvDF = spark \
.readStream \
.option("sep", ";") \
.schema(userSchema) \
.csv("/stream")
csvDF1 = csvDF.select(explode(split(csvDF.hashtags, ",")).alias("Hashtags"))
csvDF1.createOrReplaceTempView("split")
csvSqlDF = spark.sql("select Hashtags, count(*) as count from split group by Hashtags order by count desc limit 5")
query = csvSqlDF.writeStream.format("console").outputMode("complete").start()
query.awaitTermination(100)
ssc = spark.sparkContext
ssc.stop()
| [
1,
1053,
1284,
12597,
13,
2886,
12597,
29889,
2344,
580,
13,
13,
5215,
931,
13,
3166,
282,
952,
6378,
29889,
2850,
1053,
20814,
7317,
13,
3166,
282,
952,
6378,
29889,
5461,
292,
1053,
13763,
292,
2677,
13,
3166,
282,
952,
6378,
29889,
2850,
29889,
8768,
1053,
28771,
1542,
29892,
28771,
3073,
29892,
1714,
1542,
13,
3166,
282,
952,
6378,
29889,
2850,
1053,
11438,
29892,
4176,
2677,
13,
3166,
282,
952,
6378,
29889,
2850,
29889,
12171,
1053,
3902,
356,
29892,
6219,
13,
5215,
10876,
13,
5215,
7274,
13,
13,
13,
13,
13,
1753,
679,
29918,
11010,
7295,
13,
4706,
9995,
657,
2777,
8744,
10938,
1213,
15945,
13,
13,
4706,
396,
25455,
4341,
363,
599,
1347,
4235,
13,
4706,
4341,
353,
6796,
29873,
16668,
333,
613,
376,
3893,
613,
376,
1256,
613,
13,
462,
259,
376,
4993,
613,
376,
2435,
613,
376,
5081,
267,
613,
376,
29878,
1372,
613,
376,
5349,
400,
810,
613,
13,
462,
259,
376,
1792,
358,
291,
7039,
613,
376,
1792,
358,
291,
333,
613,
13,
462,
259,
376,
978,
613,
13,
462,
259,
376,
6689,
613,
376,
23031,
414,
613,
13,
462,
259,
376,
7932,
1975,
3108,
13,
13,
4706,
4341,
29918,
4984,
29918,
9621,
353,
518,
19560,
3073,
29898,
2671,
29918,
978,
29892,
1714,
1542,
3285,
5852,
29897,
13,
462,
462,
363,
1746,
29918,
978,
297,
4341,
29962,
13,
13,
4706,
10938,
353,
28771,
1542,
29898,
13099,
29918,
4984,
29918,
9621,
29897,
13,
13,
4706,
736,
10938,
13,
13,
1753,
20431,
29918,
29873,
705,
1691,
29918,
2798,
29898,
1482,
29918,
5975,
29892,
3001,
29918,
2083,
1125,
13,
12,
2457,
2533,
29898,
1482,
29918,
5975,
29897,
718,
313,
7827,
29918,
2083,
470,
29871,
29900,
29897,
13,
13,
1753,
679,
29918,
2850,
29918,
4703,
29918,
8758,
29898,
12597,
29918,
4703,
1125,
13,
12,
361,
6702,
2850,
2677,
10873,
11285,
4998,
29915,
451,
297,
13149,
1338,
580,
1125,
13,
12,
12,
23705,
1338,
580,
1839,
2850,
2677,
10873,
11285,
4998,
2033,
353,
3758,
2677,
29898,
12597,
29918,
4703,
29897,
13,
12,
2457,
13149,
1338,
580,
1839,
2850,
2677,
10873,
11285,
4998,
2033,
13,
13,
1753,
1889,
29918,
29878,
1289,
29898,
2230,
29892,
364,
1289,
1125,
13,
12,
12,
2202,
29901,
13,
12,
12,
12,
2850,
29918,
4703,
353,
679,
29918,
2850,
29918,
4703,
29918,
8758,
29898,
29878,
1289,
29889,
4703,
29897,
13,
12,
12,
12,
798,
29918,
29878,
1289,
353,
364,
1289,
29889,
1958,
29898,
2892,
281,
29901,
11438,
29898,
29873,
16668,
333,
29922,
29893,
29961,
29900,
1402,
756,
400,
810,
29922,
29893,
29961,
29955,
12622,
13,
12,
12,
12,
2158,
29898,
798,
29918,
29878,
1289,
29897,
13,
12,
12,
12,
5349,
400,
810,
29918,
2176,
353,
4576,
29918,
4703,
29889,
3258,
17271,
29898,
798,
29918,
29878,
1289,
29897,
13,
12,
12,
12,
5349,
400,
810,
29918,
2176,
29889,
9573,
15637,
3562,
703,
497,
5349,
400,
810,
1159,
13,
12,
12,
12,
5349,
400,
351,
29918,
2798,
29879,
29918,
2176,
353,
4576,
29918,
4703,
29889,
2850,
703,
2622,
7780,
300,
333,
29892,
756,
400,
810,
515,
599,
5349,
400,
810,
1159,
13,
12,
12,
12,
5349,
400,
351,
29918,
2798,
29879,
29918,
2176,
29889,
4294,
580,
13,
12,
12,
19499,
29901,
13,
12,
12,
12,
29872,
353,
10876,
29889,
735,
29883,
29918,
3888,
580,
29961,
29900,
29962,
13,
12,
12,
12,
2158,
703,
2392,
29901,
1273,
29879,
29908,
1273,
321,
29897,
13,
13,
1753,
13128,
29898,
29916,
1125,
13,
12,
2457,
313,
29916,
29889,
5451,
877,
29936,
29861,
29900,
1402,
29896,
29897,
13,
13,
12597,
353,
20814,
7317,
320,
13,
1678,
869,
16409,
320,
13,
1678,
869,
932,
1170,
703,
6970,
1469,
1159,
320,
13,
1678,
869,
657,
2816,
4391,
580,
13,
13,
1792,
12763,
353,
679,
29918,
11010,
580,
13,
13,
7638,
4037,
353,
16267,
320,
13,
1678,
869,
949,
3835,
320,
13,
1678,
869,
3385,
703,
19570,
613,
12159,
1159,
320,
13,
1678,
869,
11010,
29898,
1792,
12763,
29897,
320,
13,
1678,
869,
7638,
11974,
5461,
1159,
13,
13,
13,
7638,
4037,
29896,
353,
11799,
4037,
29889,
2622,
29898,
24516,
356,
29898,
5451,
29898,
7638,
4037,
29889,
5349,
400,
810,
29892,
9162,
1159,
467,
19973,
703,
14510,
400,
810,
5783,
13,
7638,
4037,
29896,
29889,
3258,
2816,
20083,
15637,
1043,
703,
5451,
1159,
13,
7638,
10520,
4037,
353,
16267,
29889,
2850,
703,
2622,
11699,
400,
810,
29892,
2302,
22798,
408,
2302,
515,
6219,
2318,
491,
11699,
400,
810,
1797,
491,
2302,
5153,
4046,
29871,
29945,
1159,
13,
13,
1972,
353,
11799,
10520,
4037,
29889,
3539,
3835,
29889,
4830,
703,
11058,
2564,
4905,
6818,
703,
8835,
2564,
2962,
580,
13,
1972,
29889,
20675,
14343,
3381,
29898,
29896,
29900,
29900,
29897,
13,
13,
893,
29883,
353,
16267,
29889,
12597,
2677,
13,
893,
29883,
29889,
9847,
580,
13,
13,
2
] |
latihan1.py | mprwgt/labpy03 | 0 | 155669 | <filename>latihan1.py
print("masukan nilai N: 5 ")
import random
j= 5
a= 0
for i in range(j):
i = random.uniform(.0,.5)
a +=1
print("data ke :", a, "==>", i)
print("selesai") | [
1,
529,
9507,
29958,
29880,
2219,
5403,
29896,
29889,
2272,
13,
2158,
703,
8247,
2679,
273,
4263,
1794,
405,
29901,
29871,
29945,
16521,
13,
5215,
4036,
13,
13,
29926,
29922,
29871,
29945,
13,
29874,
29922,
29871,
29900,
13,
1454,
474,
297,
3464,
29898,
29926,
1125,
13,
1678,
474,
353,
4036,
29889,
29590,
11891,
29900,
7671,
29945,
29897,
13,
1678,
263,
4619,
29896,
13,
1678,
1596,
703,
1272,
1589,
584,
613,
263,
29892,
376,
1360,
28341,
474,
29897,
13,
2158,
703,
2838,
267,
1794,
1159,
2
] |
test/programytest/config/sections/brain/test_dynamic.py | ItsPhant/program-y | 0 | 137825 | import unittest
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.config.sections.brain.dynamic import BrainDynamicsConfiguration
from programy.config.sections.client.console import ConsoleConfiguration
class BrainDynamicsConfigurationTests(unittest.TestCase):
def test_with_data(self):
yaml = YamlConfigurationFile()
self.assertIsNotNone(yaml)
yaml.load_from_text("""
brain:
dynamic:
variables:
gettime: programy.dynamic.variables.datetime.GetTime
sets:
number: programy.dynamic.sets.numeric.IsNumeric
roman: programy.dynamic.sets.roman.IsRomanNumeral
maps:
romantodec: programy.dynamic.maps.roman.MapRomanToDecimal
dectoroman: programy.dynamic.maps.roman.MapDecimalToRoman
""", ConsoleConfiguration(), ".")
brain_config = yaml.get_section("brain")
dynamic_config = BrainDynamicsConfiguration()
dynamic_config.load_config_section(yaml, brain_config, ".")
def test_without_data(self):
yaml = YamlConfigurationFile()
self.assertIsNotNone(yaml)
yaml.load_from_text("""
brain:
dynamic:
""", ConsoleConfiguration(), ".")
brain_config = yaml.get_section("brain")
dynamic_config = BrainDynamicsConfiguration()
dynamic_config.load_config_section(yaml, brain_config, ".")
def test_with_no_data(self):
yaml = YamlConfigurationFile()
self.assertIsNotNone(yaml)
yaml.load_from_text("""
brain:
""", ConsoleConfiguration(), ".")
brain_config = yaml.get_section("brain")
dynamic_config = BrainDynamicsConfiguration()
dynamic_config.load_config_section(yaml, brain_config, ".")
| [
1,
1053,
443,
27958,
13,
13,
3166,
1824,
29891,
29889,
2917,
29889,
1445,
29889,
25162,
29918,
1445,
1053,
612,
8807,
8614,
2283,
13,
3166,
1824,
29891,
29889,
2917,
29889,
27117,
29889,
2634,
262,
29889,
16626,
1053,
5032,
262,
29928,
2926,
1199,
8614,
13,
3166,
1824,
29891,
29889,
2917,
29889,
27117,
29889,
4645,
29889,
11058,
1053,
9405,
8614,
13,
13,
1990,
5032,
262,
29928,
2926,
1199,
8614,
24376,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
2541,
29918,
1272,
29898,
1311,
1125,
13,
4706,
343,
8807,
353,
612,
8807,
8614,
2283,
580,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
25162,
29897,
13,
4706,
343,
8807,
29889,
1359,
29918,
3166,
29918,
726,
703,
15945,
13,
4706,
17294,
29901,
13,
9651,
7343,
29901,
13,
18884,
3651,
29901,
13,
462,
1678,
679,
2230,
29901,
1824,
29891,
29889,
16626,
29889,
20897,
29889,
12673,
29889,
2577,
2481,
13,
18884,
6166,
29901,
13,
462,
1678,
1353,
29901,
1824,
29891,
29889,
16626,
29889,
7224,
29889,
21574,
29889,
3624,
29940,
25099,
13,
462,
1678,
9728,
29901,
259,
1824,
29891,
29889,
16626,
29889,
7224,
29889,
456,
273,
29889,
3624,
29934,
2480,
29940,
4680,
284,
13,
18884,
11053,
29901,
13,
462,
1678,
6017,
424,
356,
29883,
29901,
1824,
29891,
29889,
16626,
29889,
10339,
29889,
456,
273,
29889,
3388,
29934,
2480,
1762,
23307,
13,
462,
1678,
316,
2801,
2480,
29901,
1824,
29891,
29889,
16626,
29889,
10339,
29889,
456,
273,
29889,
3388,
23307,
1762,
29934,
2480,
13,
4706,
5124,
613,
9405,
8614,
3285,
11393,
1159,
13,
13,
4706,
17294,
29918,
2917,
353,
343,
8807,
29889,
657,
29918,
2042,
703,
2634,
262,
1159,
13,
13,
4706,
7343,
29918,
2917,
353,
5032,
262,
29928,
2926,
1199,
8614,
580,
13,
4706,
7343,
29918,
2917,
29889,
1359,
29918,
2917,
29918,
2042,
29898,
25162,
29892,
17294,
29918,
2917,
29892,
11393,
1159,
13,
13,
13,
1678,
822,
1243,
29918,
14037,
29918,
1272,
29898,
1311,
1125,
13,
4706,
343,
8807,
353,
612,
8807,
8614,
2283,
580,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
25162,
29897,
13,
4706,
343,
8807,
29889,
1359,
29918,
3166,
29918,
726,
703,
15945,
13,
4706,
17294,
29901,
13,
9651,
7343,
29901,
13,
4706,
5124,
613,
9405,
8614,
3285,
11393,
1159,
13,
13,
4706,
17294,
29918,
2917,
353,
343,
8807,
29889,
657,
29918,
2042,
703,
2634,
262,
1159,
13,
13,
4706,
7343,
29918,
2917,
353,
5032,
262,
29928,
2926,
1199,
8614,
580,
13,
4706,
7343,
29918,
2917,
29889,
1359,
29918,
2917,
29918,
2042,
29898,
25162,
29892,
17294,
29918,
2917,
29892,
11393,
1159,
13,
13,
13,
1678,
822,
1243,
29918,
2541,
29918,
1217,
29918,
1272,
29898,
1311,
1125,
13,
4706,
343,
8807,
353,
612,
8807,
8614,
2283,
580,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
25162,
29897,
13,
4706,
343,
8807,
29889,
1359,
29918,
3166,
29918,
726,
703,
15945,
13,
4706,
17294,
29901,
13,
4706,
5124,
613,
9405,
8614,
3285,
11393,
1159,
13,
13,
4706,
17294,
29918,
2917,
353,
343,
8807,
29889,
657,
29918,
2042,
703,
2634,
262,
1159,
13,
13,
4706,
7343,
29918,
2917,
353,
5032,
262,
29928,
2926,
1199,
8614,
580,
13,
4706,
7343,
29918,
2917,
29889,
1359,
29918,
2917,
29918,
2042,
29898,
25162,
29892,
17294,
29918,
2917,
29892,
11393,
1159,
13,
13,
13,
2
] |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/dark_lang/views.py | osoco/better-ways-of-thinking-about-software | 3 | 21903 | """
Views file for the Darklang Django App
"""
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.utils.decorators import method_decorator
from django.utils.translation import LANGUAGE_SESSION_KEY
from django.utils.translation import ugettext as _
from web_fragments.fragment import Fragment
from openedx.core.djangoapps.dark_lang import DARK_LANGUAGE_KEY
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
from openedx.core.djangoapps.user_api.preferences.api import delete_user_preference, set_user_preference
from openedx.core.djangoapps.util.user_messages import PageLevelMessages
LANGUAGE_INPUT_FIELD = 'preview_language'
class PreviewLanguageFragmentView(EdxFragmentView):
"""
View used when a user is attempting to change the preview language using Darklang.
Expected Behavior:
GET - returns a form for setting/resetting the user's dark language
POST - updates or clears the setting to the given dark language
"""
def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Renders the language preview view as a fragment.
"""
html = render_to_string('dark_lang/preview-language-fragment.html', {})
return Fragment(html)
def create_base_standalone_context(self, request, fragment, **kwargs):
"""
Creates the base context for rendering a fragment as a standalone page.
"""
return {
'uses_bootstrap': True,
}
def standalone_page_title(self, request, fragment, **kwargs):
"""
Returns the page title for the standalone update page.
"""
return _('Preview Language Administration')
@method_decorator(login_required)
def get(self, request, *args, **kwargs):
"""
Renders the fragment to control the preview language.
"""
if not self._user_can_preview_languages(request.user):
raise Http404
return super().get(request, *args, **kwargs)
@method_decorator(login_required)
def post(self, request, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Accept requests to update the preview language.
"""
if not self._user_can_preview_languages(request.user):
raise Http404
action = request.POST.get('action', None)
if action == 'set_preview_language':
self._set_preview_language(request)
elif action == 'reset_preview_language':
self._clear_preview_language(request)
return redirect(request.path)
def _user_can_preview_languages(self, user):
"""
Returns true if the specified user can preview languages.
"""
if not DarkLangConfig.current().enabled:
return False
return user and not user.is_anonymous
def _set_preview_language(self, request):
"""
Sets the preview language for the current user.
"""
preview_language = request.POST.get(LANGUAGE_INPUT_FIELD, '')
if not preview_language.strip():
PageLevelMessages.register_error_message(request, _('Language not provided'))
return
set_user_preference(request.user, DARK_LANGUAGE_KEY, preview_language)
PageLevelMessages.register_success_message(
request,
_('Language set to {preview_language}').format(
preview_language=preview_language
)
)
def _clear_preview_language(self, request):
"""
Clears the preview language for the current user.
"""
delete_user_preference(request.user, DARK_LANGUAGE_KEY)
if LANGUAGE_SESSION_KEY in request.session:
del request.session[LANGUAGE_SESSION_KEY]
PageLevelMessages.register_success_message(
request,
_('Language reset to the default')
)
| [
1,
9995,
13,
23825,
934,
363,
278,
15317,
3893,
15337,
2401,
13,
15945,
29908,
13,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
13,
3166,
9557,
29889,
1124,
1053,
9056,
29946,
29900,
29946,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
6684,
13,
3166,
9557,
29889,
6886,
29889,
12657,
1053,
4050,
29918,
517,
29918,
1807,
13,
3166,
9557,
29889,
13239,
29889,
19557,
4097,
1053,
1158,
29918,
19557,
1061,
13,
3166,
9557,
29889,
13239,
29889,
3286,
18411,
1053,
365,
19453,
29965,
10461,
29918,
17493,
29918,
10818,
13,
3166,
9557,
29889,
13239,
29889,
3286,
18411,
1053,
318,
657,
726,
408,
903,
13,
3166,
1856,
29918,
29888,
1431,
1860,
29889,
20777,
1053,
19063,
13,
13,
3166,
6496,
29916,
29889,
3221,
29889,
14095,
13371,
29889,
26031,
29918,
3893,
1053,
360,
1718,
29968,
29918,
29931,
19453,
29965,
10461,
29918,
10818,
13,
3166,
6496,
29916,
29889,
3221,
29889,
14095,
13371,
29889,
26031,
29918,
3893,
29889,
9794,
1053,
15317,
29931,
574,
3991,
13,
3166,
6496,
29916,
29889,
3221,
29889,
14095,
13371,
29889,
8582,
29918,
2754,
29889,
7406,
1053,
2155,
29916,
8752,
1043,
13,
3166,
6496,
29916,
29889,
3221,
29889,
14095,
13371,
29889,
1792,
29918,
2754,
29889,
1457,
10662,
29889,
2754,
1053,
5217,
29918,
1792,
29918,
1457,
1659,
29892,
731,
29918,
1792,
29918,
1457,
1659,
13,
3166,
6496,
29916,
29889,
3221,
29889,
14095,
13371,
29889,
4422,
29889,
1792,
29918,
19158,
1053,
9305,
10108,
25510,
13,
13,
29931,
19453,
29965,
10461,
29918,
1177,
12336,
29918,
3738,
27286,
353,
525,
25347,
29918,
11675,
29915,
13,
13,
13,
1990,
4721,
1493,
21233,
8752,
1043,
29898,
3853,
29916,
8752,
1043,
1125,
13,
1678,
9995,
13,
1678,
4533,
1304,
746,
263,
1404,
338,
15661,
304,
1735,
278,
25267,
4086,
773,
15317,
3893,
29889,
13,
13,
1678,
1222,
6021,
1522,
16300,
29901,
13,
1678,
12354,
448,
3639,
263,
883,
363,
4444,
29914,
12071,
1259,
278,
1404,
29915,
29879,
6501,
4086,
13,
1678,
11971,
448,
11217,
470,
4531,
1503,
278,
4444,
304,
278,
2183,
6501,
4086,
13,
1678,
9995,
13,
13,
1678,
822,
4050,
29918,
517,
29918,
20777,
29898,
1311,
29892,
2009,
29892,
3236,
29918,
333,
29922,
8516,
29892,
3579,
19290,
1125,
29871,
396,
301,
524,
29899,
314,
29876,
14596,
29892,
282,
2904,
524,
29901,
11262,
29922,
25699,
29899,
29881,
8349,
29892,
443,
3880,
29899,
23516,
13,
4706,
9995,
13,
4706,
390,
21043,
278,
4086,
25267,
1776,
408,
263,
9376,
29889,
13,
4706,
9995,
13,
4706,
3472,
353,
4050,
29918,
517,
29918,
1807,
877,
26031,
29918,
3893,
29914,
25347,
29899,
11675,
29899,
20777,
29889,
1420,
742,
426,
1800,
13,
4706,
736,
19063,
29898,
1420,
29897,
13,
13,
1678,
822,
1653,
29918,
3188,
29918,
1689,
18785,
29918,
4703,
29898,
1311,
29892,
2009,
29892,
9376,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
6760,
1078,
278,
2967,
3030,
363,
15061,
263,
9376,
408,
263,
2317,
18785,
1813,
29889,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
525,
6394,
29918,
8704,
2396,
5852,
29892,
13,
4706,
500,
13,
13,
1678,
822,
2317,
18785,
29918,
3488,
29918,
3257,
29898,
1311,
29892,
2009,
29892,
9376,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
16969,
278,
1813,
3611,
363,
278,
2317,
18785,
2767,
1813,
29889,
13,
4706,
9995,
13,
4706,
736,
903,
877,
6572,
1493,
17088,
23303,
1495,
13,
13,
1678,
732,
5696,
29918,
19557,
1061,
29898,
7507,
29918,
12403,
29897,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
390,
21043,
278,
9376,
304,
2761,
278,
25267,
4086,
29889,
13,
4706,
9995,
13,
4706,
565,
451,
1583,
3032,
1792,
29918,
3068,
29918,
25347,
29918,
29880,
8737,
29898,
3827,
29889,
1792,
1125,
13,
9651,
12020,
9056,
29946,
29900,
29946,
13,
4706,
736,
2428,
2141,
657,
29898,
3827,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
732,
5696,
29918,
19557,
1061,
29898,
7507,
29918,
12403,
29897,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
29892,
3579,
19290,
1125,
29871,
396,
301,
524,
29899,
314,
29876,
14596,
29892,
282,
2904,
524,
29901,
11262,
29922,
348,
3880,
29899,
23516,
13,
4706,
9995,
13,
4706,
29848,
7274,
304,
2767,
278,
25267,
4086,
29889,
13,
4706,
9995,
13,
4706,
565,
451,
1583,
3032,
1792,
29918,
3068,
29918,
25347,
29918,
29880,
8737,
29898,
3827,
29889,
1792,
1125,
13,
9651,
12020,
9056,
29946,
29900,
29946,
13,
4706,
3158,
353,
2009,
29889,
5438,
29889,
657,
877,
2467,
742,
6213,
29897,
13,
4706,
565,
3158,
1275,
525,
842,
29918,
25347,
29918,
11675,
2396,
13,
9651,
1583,
3032,
842,
29918,
25347,
29918,
11675,
29898,
3827,
29897,
13,
4706,
25342,
3158,
1275,
525,
12071,
29918,
25347,
29918,
11675,
2396,
13,
9651,
1583,
3032,
8551,
29918,
25347,
29918,
11675,
29898,
3827,
29897,
13,
4706,
736,
6684,
29898,
3827,
29889,
2084,
29897,
13,
13,
1678,
822,
903,
1792,
29918,
3068,
29918,
25347,
29918,
29880,
8737,
29898,
1311,
29892,
1404,
1125,
13,
4706,
9995,
13,
4706,
16969,
1565,
565,
278,
6790,
1404,
508,
25267,
10276,
29889,
13,
4706,
9995,
13,
4706,
565,
451,
15317,
29931,
574,
3991,
29889,
3784,
2141,
17590,
29901,
13,
9651,
736,
7700,
13,
4706,
736,
1404,
322,
451,
1404,
29889,
275,
29918,
25772,
13,
13,
1678,
822,
903,
842,
29918,
25347,
29918,
11675,
29898,
1311,
29892,
2009,
1125,
13,
4706,
9995,
13,
4706,
317,
1691,
278,
25267,
4086,
363,
278,
1857,
1404,
29889,
13,
4706,
9995,
13,
4706,
25267,
29918,
11675,
353,
2009,
29889,
5438,
29889,
657,
29898,
29931,
19453,
29965,
10461,
29918,
1177,
12336,
29918,
3738,
27286,
29892,
27255,
13,
4706,
565,
451,
25267,
29918,
11675,
29889,
17010,
7295,
13,
9651,
9305,
10108,
25510,
29889,
9573,
29918,
2704,
29918,
4906,
29898,
3827,
29892,
903,
877,
21233,
451,
4944,
8785,
13,
9651,
736,
13,
13,
4706,
731,
29918,
1792,
29918,
1457,
1659,
29898,
3827,
29889,
1792,
29892,
360,
1718,
29968,
29918,
29931,
19453,
29965,
10461,
29918,
10818,
29892,
25267,
29918,
11675,
29897,
13,
4706,
9305,
10108,
25510,
29889,
9573,
29918,
8698,
29918,
4906,
29898,
13,
9651,
2009,
29892,
13,
9651,
903,
877,
21233,
731,
304,
426,
25347,
29918,
11675,
29913,
2824,
4830,
29898,
13,
18884,
25267,
29918,
11675,
29922,
25347,
29918,
11675,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
903,
8551,
29918,
25347,
29918,
11675,
29898,
1311,
29892,
2009,
1125,
13,
4706,
9995,
13,
4706,
21386,
1503,
278,
25267,
4086,
363,
278,
1857,
1404,
29889,
13,
4706,
9995,
13,
4706,
5217,
29918,
1792,
29918,
1457,
1659,
29898,
3827,
29889,
1792,
29892,
360,
1718,
29968,
29918,
29931,
19453,
29965,
10461,
29918,
10818,
29897,
13,
4706,
565,
365,
19453,
29965,
10461,
29918,
17493,
29918,
10818,
297,
2009,
29889,
7924,
29901,
13,
9651,
628,
2009,
29889,
7924,
29961,
29931,
19453,
29965,
10461,
29918,
17493,
29918,
10818,
29962,
13,
4706,
9305,
10108,
25510,
29889,
9573,
29918,
8698,
29918,
4906,
29898,
13,
9651,
2009,
29892,
13,
9651,
903,
877,
21233,
10092,
304,
278,
2322,
1495,
13,
4706,
1723,
13,
2
] |
Image2CAD/Core/Math/Constants.py | Elstargo00/image2cad-macos | 21 | 1606413 | <reponame>Elstargo00/image2cad-macos
# -*- coding: utf-8 -*-
"""
@author: <NAME>
Copyright (C) 2016, <NAME>.
Licensed under the Apache License 2.0. See LICENSE file in the project root for full license information.
"""
class Constants:
PI = 3.14159265358979
PRECISION = 0.000001
PIXEL_PRECISION = 1
| [
1,
529,
276,
1112,
420,
29958,
6489,
303,
7921,
29900,
29900,
29914,
3027,
29906,
29883,
328,
29899,
8628,
359,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29992,
8921,
29901,
529,
5813,
29958,
13,
13,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29953,
29892,
529,
5813,
15513,
13,
13,
10413,
21144,
1090,
278,
13380,
19245,
29871,
29906,
29889,
29900,
29889,
2823,
365,
2965,
1430,
1660,
934,
297,
278,
2060,
3876,
363,
2989,
19405,
2472,
29889,
13,
15945,
29908,
13,
13,
1990,
5798,
1934,
29901,
13,
1678,
349,
29902,
353,
29871,
29941,
29889,
29896,
29946,
29896,
29945,
29929,
29906,
29953,
29945,
29941,
29945,
29947,
29929,
29955,
29929,
13,
1678,
349,
1525,
29907,
3235,
2725,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
13,
1678,
349,
6415,
6670,
29918,
15094,
29907,
3235,
2725,
353,
29871,
29896,
13,
268,
2
] |
src/cscli/views/__init__.py | ryohare/python-cscli | 0 | 95844 | <filename>src/cscli/views/__init__.py
from .hosts import HostsView
__all__ = [
"HostsView"
]
| [
1,
529,
9507,
29958,
4351,
29914,
29883,
1557,
492,
29914,
7406,
29914,
1649,
2344,
26914,
2272,
13,
3166,
869,
23525,
1053,
16956,
29879,
1043,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
376,
8514,
29879,
1043,
29908,
13,
29962,
13,
2
] |
containerchaos/main.py | containerchaos/containerchaos | 0 | 105797 | <filename>containerchaos/main.py
import subprocess
import time
import measure_response_time
import utils
URL = "http://localhost/"
def _run(cmd: str):
print("Running cmd: {}".format(cmd))
print(subprocess.run(cmd, shell=True, capture_output=True, cwd="../docker-nginx-flask-redis-postgres/"))
def _sleep(t: int = 5):
print("Sleeping {}s".format(t))
time.sleep(t)
def _cleanup():
print("Cleaning up old containers if they exist")
_run("docker stack rm webapp")
_run("docker-compose down")
def _setup():
print("Setting up swarm")
_run("docker-compose up -d")
_run("docker-compose down")
_run("docker swarm init")
def _deploy():
print("Deploying to swarm")
_run("docker stack deploy --compose-file docker-compose.yml webapp")
def main():
_cleanup()
_setup()
_deploy()
for i in range(100):
measure_response_time.measure_response_time(URL, "Baseline")
_cleanup()
_deploy()
print("Redo baseline, but dont save to csv") # To establish some API use
for i in range(100):
measure_response_time.measure_response_time(URL, "Baseline", write=False)
print("By CPU Usage")
containers = utils.get_containers("flaskapp")
c = utils.find_most_cpu(containers)
print("Stopping container {}".format(c))
utils.stop_container(c)
for i in range(100):
measure_response_time.measure_response_time(URL, "CPU Usage")
_cleanup()
if __name__ == '__main__':
main() | [
1,
529,
9507,
29958,
7611,
5815,
359,
29914,
3396,
29889,
2272,
13,
5215,
1014,
5014,
13,
5215,
931,
13,
5215,
5645,
29918,
5327,
29918,
2230,
13,
5215,
3667,
29879,
13,
13,
4219,
353,
376,
1124,
597,
7640,
12975,
13,
13,
1753,
903,
3389,
29898,
9006,
29901,
851,
1125,
13,
1678,
1596,
703,
27795,
9920,
29901,
6571,
1642,
4830,
29898,
9006,
876,
13,
1678,
1596,
29898,
1491,
5014,
29889,
3389,
29898,
9006,
29892,
6473,
29922,
5574,
29892,
10446,
29918,
4905,
29922,
5574,
29892,
274,
9970,
543,
6995,
14695,
29899,
23257,
29899,
1579,
1278,
29899,
1127,
275,
29899,
2490,
7201,
29914,
5783,
13,
13,
1753,
903,
17059,
29898,
29873,
29901,
938,
353,
29871,
29945,
1125,
13,
1678,
1596,
703,
29903,
5436,
292,
6571,
29879,
1642,
4830,
29898,
29873,
876,
13,
1678,
931,
29889,
17059,
29898,
29873,
29897,
13,
13,
1753,
903,
14941,
786,
7295,
13,
1678,
1596,
703,
29907,
14044,
292,
701,
2030,
22637,
565,
896,
1863,
1159,
13,
1678,
903,
3389,
703,
14695,
5096,
20241,
1856,
932,
1159,
13,
1678,
903,
3389,
703,
14695,
29899,
19438,
1623,
1159,
13,
13,
1753,
903,
14669,
7295,
13,
1678,
1596,
703,
29020,
701,
2381,
2817,
1159,
13,
1678,
903,
3389,
703,
14695,
29899,
19438,
701,
448,
29881,
1159,
13,
1678,
903,
3389,
703,
14695,
29899,
19438,
1623,
1159,
13,
1678,
903,
3389,
703,
14695,
2381,
2817,
2069,
1159,
13,
13,
1753,
903,
16519,
7295,
13,
1678,
1596,
703,
8498,
2376,
292,
304,
2381,
2817,
1159,
13,
1678,
903,
3389,
703,
14695,
5096,
7246,
1192,
19438,
29899,
1445,
10346,
29899,
19438,
29889,
21053,
1856,
932,
1159,
13,
13,
1753,
1667,
7295,
13,
1678,
903,
14941,
786,
580,
13,
1678,
903,
14669,
580,
13,
13,
1678,
903,
16519,
580,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
5645,
29918,
5327,
29918,
2230,
29889,
26658,
29918,
5327,
29918,
2230,
29898,
4219,
29892,
376,
9496,
5570,
1159,
13,
1678,
903,
14941,
786,
580,
13,
13,
1678,
903,
16519,
580,
13,
1678,
1596,
703,
9039,
29877,
2362,
5570,
29892,
541,
4555,
4078,
304,
11799,
1159,
396,
1763,
10127,
777,
3450,
671,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
5645,
29918,
5327,
29918,
2230,
29889,
26658,
29918,
5327,
29918,
2230,
29898,
4219,
29892,
376,
9496,
5570,
613,
2436,
29922,
8824,
29897,
13,
1678,
1596,
703,
2059,
10808,
10783,
482,
1159,
13,
1678,
22637,
353,
3667,
29879,
29889,
657,
29918,
1285,
475,
414,
703,
1579,
1278,
932,
1159,
13,
1678,
274,
353,
3667,
29879,
29889,
2886,
29918,
3242,
29918,
21970,
29898,
1285,
475,
414,
29897,
13,
1678,
1596,
703,
20754,
3262,
5639,
6571,
1642,
4830,
29898,
29883,
876,
13,
1678,
3667,
29879,
29889,
9847,
29918,
7611,
29898,
29883,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
5645,
29918,
5327,
29918,
2230,
29889,
26658,
29918,
5327,
29918,
2230,
29898,
4219,
29892,
376,
6271,
29965,
10783,
482,
1159,
13,
1678,
903,
14941,
786,
580,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
2
] |
ooobuild/cssdyn/drawing/framework/__init__.py | Amourspirit/ooo_uno_tmpl | 0 | 85289 | <filename>ooobuild/cssdyn/drawing/framework/__init__.py
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from ....dyn.drawing.framework.anchor_binding_mode import AnchorBindingMode as AnchorBindingMode
from ....dyn.drawing.framework.basic_pane_factory import BasicPaneFactory as BasicPaneFactory
from ....dyn.drawing.framework.basic_tool_bar_factory import BasicToolBarFactory as BasicToolBarFactory
from ....dyn.drawing.framework.basic_view_factory import BasicViewFactory as BasicViewFactory
from ....dyn.drawing.framework.border_type import BorderType as BorderType
from ....dyn.drawing.framework.configuration import Configuration as Configuration
from ....dyn.drawing.framework.configuration_change_event import ConfigurationChangeEvent as ConfigurationChangeEvent
from ....dyn.drawing.framework.configuration_controller import ConfigurationController as ConfigurationController
from ....dyn.drawing.framework.module_controller import ModuleController as ModuleController
from ....dyn.drawing.framework.resource_activation_mode import ResourceActivationMode as ResourceActivationMode
from ....dyn.drawing.framework.resource_id import ResourceId as ResourceId
from ....dyn.drawing.framework.tab_bar_button import TabBarButton as TabBarButton
from ....dyn.drawing.framework.x_configuration import XConfiguration as XConfiguration
from ....dyn.drawing.framework.x_configuration_change_listener import XConfigurationChangeListener as XConfigurationChangeListener
from ....dyn.drawing.framework.x_configuration_change_request import XConfigurationChangeRequest as XConfigurationChangeRequest
from ....dyn.drawing.framework.x_configuration_controller import XConfigurationController as XConfigurationController
from ....dyn.drawing.framework.x_configuration_controller_broadcaster import XConfigurationControllerBroadcaster as XConfigurationControllerBroadcaster
from ....dyn.drawing.framework.x_configuration_controller_request_queue import XConfigurationControllerRequestQueue as XConfigurationControllerRequestQueue
from ....dyn.drawing.framework.x_controller_manager import XControllerManager as XControllerManager
from ....dyn.drawing.framework.x_module_controller import XModuleController as XModuleController
from ....dyn.drawing.framework.x_pane import XPane as XPane
from ....dyn.drawing.framework.x_pane2 import XPane2 as XPane2
from ....dyn.drawing.framework.x_pane_border_painter import XPaneBorderPainter as XPaneBorderPainter
from ....dyn.drawing.framework.x_relocatable_resource import XRelocatableResource as XRelocatableResource
from ....dyn.drawing.framework.x_resource import XResource as XResource
from ....dyn.drawing.framework.x_resource_factory import XResourceFactory as XResourceFactory
from ....dyn.drawing.framework.x_resource_factory_manager import XResourceFactoryManager as XResourceFactoryManager
from ....dyn.drawing.framework.x_resource_id import XResourceId as XResourceId
from ....dyn.drawing.framework.x_tab_bar import XTabBar as XTabBar
from ....dyn.drawing.framework.x_tool_bar import XToolBar as XToolBar
from ....dyn.drawing.framework.x_view import XView as XView
| [
1,
529,
9507,
29958,
3634,
711,
29884,
789,
29914,
4268,
29881,
948,
29914,
4012,
292,
29914,
4468,
29914,
1649,
2344,
26914,
2272,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29906,
584,
4297,
719,
29899,
1349,
18902,
29899,
18275,
29901,
341,
2209,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1159,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
29901,
849,
7821,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
29937,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
25367,
29918,
19672,
29918,
8513,
1053,
530,
8420,
9270,
6818,
408,
530,
8420,
9270,
6818,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
16121,
29918,
29886,
1662,
29918,
14399,
1053,
19219,
13683,
5126,
408,
19219,
13683,
5126,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
16121,
29918,
10154,
29918,
1646,
29918,
14399,
1053,
19219,
12229,
4297,
5126,
408,
19219,
12229,
4297,
5126,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
16121,
29918,
1493,
29918,
14399,
1053,
19219,
1043,
5126,
408,
19219,
1043,
5126,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
11466,
29918,
1853,
1053,
20830,
1542,
408,
20830,
1542,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
13305,
1053,
20999,
408,
20999,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
13305,
29918,
3167,
29918,
3696,
1053,
20999,
7277,
2624,
408,
20999,
7277,
2624,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
13305,
29918,
8299,
1053,
20999,
2956,
408,
20999,
2956,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
5453,
29918,
8299,
1053,
15591,
2956,
408,
15591,
2956,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
10314,
29918,
11236,
362,
29918,
8513,
1053,
18981,
21786,
362,
6818,
408,
18981,
21786,
362,
6818,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
10314,
29918,
333,
1053,
18981,
1204,
408,
18981,
1204,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
3891,
29918,
1646,
29918,
3092,
1053,
11090,
4297,
3125,
408,
11090,
4297,
3125,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
1053,
1060,
8614,
408,
1060,
8614,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
29918,
3167,
29918,
25894,
1053,
1060,
8614,
7277,
3962,
408,
1060,
8614,
7277,
3962,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
29918,
3167,
29918,
3827,
1053,
1060,
8614,
7277,
3089,
408,
1060,
8614,
7277,
3089,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
29918,
8299,
1053,
1060,
8614,
2956,
408,
1060,
8614,
2956,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
29918,
8299,
29918,
6729,
328,
29883,
1901,
1053,
1060,
8614,
2956,
29933,
9972,
29883,
1901,
408,
1060,
8614,
2956,
29933,
9972,
29883,
1901,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
13305,
29918,
8299,
29918,
3827,
29918,
9990,
1053,
1060,
8614,
2956,
3089,
10620,
408,
1060,
8614,
2956,
3089,
10620,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
8299,
29918,
12847,
1053,
1060,
2956,
3260,
408,
1060,
2956,
3260,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
5453,
29918,
8299,
1053,
1060,
7355,
2956,
408,
1060,
7355,
2956,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
29886,
1662,
1053,
1060,
13683,
408,
1060,
13683,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
29886,
1662,
29906,
1053,
1060,
13683,
29906,
408,
1060,
13683,
29906,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
29886,
1662,
29918,
11466,
29918,
29886,
475,
357,
1053,
1060,
13683,
17025,
29925,
475,
357,
408,
1060,
13683,
17025,
29925,
475,
357,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
276,
2029,
17219,
29918,
10314,
1053,
1060,
9662,
542,
17219,
6848,
408,
1060,
9662,
542,
17219,
6848,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
10314,
1053,
1060,
6848,
408,
1060,
6848,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
10314,
29918,
14399,
1053,
1060,
6848,
5126,
408,
1060,
6848,
5126,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
10314,
29918,
14399,
29918,
12847,
1053,
1060,
6848,
5126,
3260,
408,
1060,
6848,
5126,
3260,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
10314,
29918,
333,
1053,
1060,
6848,
1204,
408,
1060,
6848,
1204,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
3891,
29918,
1646,
1053,
1060,
8863,
4297,
408,
1060,
8863,
4297,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
10154,
29918,
1646,
1053,
1060,
12229,
4297,
408,
1060,
12229,
4297,
13,
3166,
13035,
29881,
948,
29889,
4012,
292,
29889,
4468,
29889,
29916,
29918,
1493,
1053,
1060,
1043,
408,
1060,
1043,
13,
2
] |
nldrp/feature_extraction/pipeline/utterance_feature_loader.py | etzinis/nldrp | 6 | 56337 | <gh_stars>1-10
"""!
\brief Utterance level feature loader pipeline for loading the
extracted features in appropriate format for utterance calssification
from scikit models and kfold--leave one out pipeline.
@author <NAME> {<EMAIL>}
@copyright National Technical University of Athens
"""
import argparse
import numpy as np
import os
import sys
from sklearn.externals import joblib
nldrp_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'../../../')
sys.path.insert(0, nldrp_dir)
import nldrp.config
def get_args():
"""! Command line parser for Utterance level feature loader
pipeline"""
parser = argparse.ArgumentParser(
description='Utterance level feature loader pipeline' )
parser.add_argument("--dataset", type=str,
help="""The name of the dataset""",
required=True,
choices=['SAVEE'])
parser.add_argument("-i", "--save_dir", type=str,
help="""Where the corresponding binary file full of
data that will contain the dictionary for each speaker is
stored.
Another subdic for all the sentences with their ids
and a 1d numpy matrix for each one of them.
""",
default=nldrp.config.EXTRACTED_FEATURES_PATH )
parser.add_argument("--features_fusion_method", type=str,
help="""Linear or RQA nonlinear features or
their early
fusion by concatenation""",
default='rqa',
choices=['rqa', 'linear','fusion'])
parser.add_argument("-tau", type=int,
help="""Time Delay Ad-hoc""",
default=1)
parser.add_argument("--tau_est_method", type=str,
help="""How to estimate Time Delay (Using
an adhoc value as set or estimate AMI per
frame?)""",
default='ad_hoc',
choices=['ad_hoc', 'ami'])
parser.add_argument("-norm", type=str,
help="""Norm for computing in RPs""",
default='euclidean',
choices=["manhattan", "euclidean", "supremum"])
parser.add_argument("--thresh_method", type=str,
help="""How to threshold RPs""",
default='threshold',
choices=["threshold",
"threshold_std",
"recurrence_rate"])
parser.add_argument("-thresh", type=float,
help="""Value of threshold in (0,1)""",
default=0.1)
parser.add_argument("-fs", type=float,
help="""Sampling frequency Hz""",
default=44100)
parser.add_argument("--frame_duration", type=float,
help="""Frame duration in seconds""",
default=0.02)
args = parser.parse_args()
return args
def load(config):
exper_dat_name = ('{}-rqa-{}-tau-{}-{}-{}-{}-dur-{}-fs-{}'
'.dat'.format(
config['dataset'],
config['phase_space_method'],
config['time_lag'],
config['norm'],
config['thresh_method'],
config['thresh'],
config['frame_duration'],
config['fs']
))
utterance_save_dir = os.path.join(config['save_dir'], 'utterance/')
save_p = os.path.join(utterance_save_dir, exper_dat_name)
return joblib.load(save_p)
def convert_2_numpy_per_utterance(dataset_dic):
converted_dic = {}
for spkr in dataset_dic:
x_list = []
y_list = []
converted_dic[spkr] = {}
for id, el_dic in dataset_dic[spkr].items():
label = el_dic['y']
feat_vec = el_dic['x']
x_list.append(feat_vec)
y_list.append(label)
this_utt_array = np.array(x_list)
converted_dic[spkr]['x']=this_utt_array
converted_dic[spkr]['y']=y_list
return converted_dic
def load_and_convert(method,
config):
"""!
\brief Loads the dictionary form the specified folder and
converts it to a dic like the following
converted_dic = {
'speaker_1':{
'x':2d numpy array (n_utterances, n_features)
'y':list of strings corresponding to labels
}
...
'speaker_n':....
}
According to the specified method the 2d numpy matrix corresponds
to either linear | non-linear | concatenation of both feature sets
"""
if method == 'rqa':
loaded_dic = load(config)
else:
raise NotImplementedError('Fusion method: {} is not yet '
'implemented.'.format(method))
converted_dic = convert_2_numpy_per_utterance(loaded_dic)
return converted_dic
if __name__ == "__main__":
"""!brief Example of usage"""
args = get_args()
config = {
'dataset':args.dataset,
'save_dir':args.save_dir,
'phase_space_method':args.tau_est_method,
'time_lag':args.tau,
'embedding_dimension':3,
'norm':args.norm,
'thresh_method':args.thresh_method,
'thresh':args.thresh,
'l_min':2,
'v_min':2,
'w_min':1,
'frame_duration':args.frame_duration,
'frame_stride':args.frame_duration / 2.0,
'fs':args.fs
}
converted_feats_dic = load_and_convert(args.features_fusion_method,
config)
print converted_feats_dic.values() | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
29991,
13,
29905,
1182,
2575,
14950,
357,
749,
3233,
4682,
23466,
16439,
363,
8363,
278,
13,
21111,
287,
5680,
297,
8210,
3402,
363,
14401,
749,
1208,
893,
2450,
13,
3166,
4560,
7354,
4733,
322,
413,
8771,
489,
280,
1351,
697,
714,
16439,
29889,
13,
13,
29992,
8921,
529,
5813,
29958,
426,
29966,
26862,
6227,
29958,
29913,
13,
29992,
8552,
1266,
3086,
8364,
936,
3014,
310,
9193,
575,
13,
15945,
29908,
13,
13,
5215,
1852,
5510,
13,
5215,
12655,
408,
7442,
13,
5215,
2897,
13,
5215,
10876,
13,
3166,
2071,
19668,
29889,
735,
725,
1338,
1053,
4982,
1982,
13,
13,
29876,
430,
19080,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
1678,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
8243,
13,
1678,
525,
21546,
6995,
1495,
13,
9675,
29889,
2084,
29889,
7851,
29898,
29900,
29892,
302,
430,
19080,
29918,
3972,
29897,
13,
5215,
302,
430,
19080,
29889,
2917,
13,
13,
13,
1753,
679,
29918,
5085,
7295,
13,
1678,
9995,
29991,
10516,
1196,
13812,
363,
14950,
357,
749,
3233,
4682,
23466,
13,
1678,
16439,
15945,
29908,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
2433,
29965,
29873,
357,
749,
3233,
4682,
23466,
16439,
29915,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
24713,
613,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
13776,
29908,
1576,
1024,
310,
278,
8783,
15945,
613,
13,
462,
4706,
3734,
29922,
5574,
29892,
13,
462,
4706,
19995,
29922,
1839,
29903,
7520,
17896,
11287,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
29899,
29875,
613,
376,
489,
7620,
29918,
3972,
613,
1134,
29922,
710,
29892,
13,
4706,
1371,
13776,
29908,
11921,
278,
6590,
7581,
934,
2989,
310,
29871,
13,
4706,
848,
393,
674,
1712,
278,
8600,
363,
1269,
25657,
338,
29871,
13,
4706,
6087,
29889,
29871,
13,
4706,
7280,
1014,
27774,
363,
599,
278,
25260,
411,
1009,
18999,
259,
13,
4706,
322,
263,
29871,
29896,
29881,
12655,
4636,
363,
1269,
697,
310,
963,
29889,
13,
4706,
5124,
613,
13,
4706,
2322,
29922,
29876,
430,
19080,
29889,
2917,
29889,
12194,
4717,
1783,
3352,
29918,
16359,
1299,
11499,
29903,
29918,
10145,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
22100,
29918,
29888,
3958,
29918,
5696,
613,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
13776,
29908,
12697,
470,
390,
29984,
29909,
1661,
10660,
5680,
470,
29871,
13,
462,
4706,
1009,
4688,
29871,
13,
462,
4706,
21736,
491,
16125,
362,
15945,
613,
13,
462,
4706,
2322,
2433,
29878,
25621,
742,
13,
462,
4706,
19995,
29922,
1839,
29878,
25621,
742,
525,
10660,
3788,
29888,
3958,
11287,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
29899,
4722,
613,
1134,
29922,
524,
29892,
13,
462,
4706,
1371,
13776,
29908,
2481,
5556,
388,
2087,
29899,
29882,
542,
15945,
613,
13,
462,
4706,
2322,
29922,
29896,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
4722,
29918,
342,
29918,
5696,
613,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
13776,
29908,
5328,
304,
12678,
5974,
5556,
388,
313,
15156,
29871,
13,
462,
4706,
385,
594,
29882,
542,
995,
408,
731,
470,
12678,
319,
10403,
639,
29871,
13,
462,
4706,
3515,
29973,
5513,
29908,
613,
13,
462,
4706,
2322,
2433,
328,
29918,
29882,
542,
742,
13,
462,
4706,
19995,
29922,
1839,
328,
29918,
29882,
542,
742,
525,
4479,
11287,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
29899,
12324,
613,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
13776,
29908,
29940,
555,
363,
20602,
297,
390,
29925,
29879,
15945,
613,
13,
462,
4706,
2322,
2433,
29872,
27511,
742,
13,
462,
4706,
19995,
29922,
3366,
1171,
29882,
23586,
613,
376,
29872,
27511,
613,
376,
12587,
1745,
398,
20068,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
386,
3781,
29918,
5696,
613,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
13776,
29908,
5328,
304,
16897,
390,
29925,
29879,
15945,
613,
13,
462,
4706,
2322,
2433,
386,
12268,
742,
13,
462,
4706,
19995,
29922,
3366,
386,
12268,
613,
13,
462,
18884,
376,
386,
12268,
29918,
4172,
613,
13,
462,
18884,
376,
3757,
26841,
29918,
10492,
20068,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
29899,
386,
3781,
613,
1134,
29922,
7411,
29892,
13,
462,
4706,
1371,
13776,
29908,
1917,
310,
16897,
297,
313,
29900,
29892,
29896,
5513,
29908,
613,
13,
462,
4706,
2322,
29922,
29900,
29889,
29896,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
29899,
5847,
613,
1134,
29922,
7411,
29892,
13,
462,
4706,
1371,
13776,
29908,
22966,
10335,
10868,
379,
29920,
15945,
613,
13,
462,
4706,
2322,
29922,
29946,
29946,
29896,
29900,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
2557,
29918,
19708,
613,
1134,
29922,
7411,
29892,
13,
462,
4706,
1371,
13776,
29908,
4308,
14385,
297,
6923,
15945,
613,
13,
462,
4706,
2322,
29922,
29900,
29889,
29900,
29906,
29897,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
736,
6389,
13,
13,
13,
1753,
2254,
29898,
2917,
1125,
13,
1678,
2902,
29918,
4130,
29918,
978,
353,
6702,
29912,
7402,
29878,
25621,
29899,
29912,
7402,
4722,
29899,
29912,
7402,
29912,
7402,
29912,
7402,
29912,
7402,
29881,
332,
29899,
29912,
7402,
5847,
29899,
8875,
29915,
13,
462,
418,
15300,
4130,
4286,
4830,
29898,
13,
4706,
2295,
1839,
24713,
7464,
13,
4706,
2295,
1839,
21646,
29918,
3493,
29918,
5696,
7464,
13,
4706,
2295,
1839,
2230,
29918,
3110,
7464,
13,
4706,
2295,
1839,
12324,
7464,
13,
4706,
2295,
1839,
386,
3781,
29918,
5696,
7464,
13,
4706,
2295,
1839,
386,
3781,
7464,
13,
4706,
2295,
1839,
2557,
29918,
19708,
7464,
13,
4706,
2295,
1839,
5847,
2033,
13,
268,
876,
13,
13,
1678,
14401,
749,
29918,
7620,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
1839,
7620,
29918,
3972,
7464,
525,
6463,
749,
29914,
1495,
13,
1678,
4078,
29918,
29886,
353,
2897,
29889,
2084,
29889,
7122,
29898,
6463,
749,
29918,
7620,
29918,
3972,
29892,
2902,
29918,
4130,
29918,
978,
29897,
13,
13,
1678,
736,
4982,
1982,
29889,
1359,
29898,
7620,
29918,
29886,
29897,
13,
13,
13,
1753,
3588,
29918,
29906,
29918,
23749,
29918,
546,
29918,
6463,
749,
29898,
24713,
29918,
27774,
1125,
13,
1678,
11543,
29918,
27774,
353,
6571,
13,
1678,
363,
805,
12748,
297,
8783,
29918,
27774,
29901,
13,
4706,
921,
29918,
1761,
353,
5159,
13,
4706,
343,
29918,
1761,
353,
5159,
13,
4706,
11543,
29918,
27774,
29961,
1028,
12748,
29962,
353,
6571,
13,
4706,
363,
1178,
29892,
560,
29918,
27774,
297,
8783,
29918,
27774,
29961,
1028,
12748,
1822,
7076,
7295,
13,
9651,
3858,
353,
560,
29918,
27774,
1839,
29891,
2033,
13,
9651,
1238,
271,
29918,
2003,
353,
560,
29918,
27774,
1839,
29916,
2033,
13,
9651,
921,
29918,
1761,
29889,
4397,
29898,
1725,
271,
29918,
2003,
29897,
13,
9651,
343,
29918,
1761,
29889,
4397,
29898,
1643,
29897,
13,
13,
4706,
445,
29918,
4774,
29918,
2378,
353,
7442,
29889,
2378,
29898,
29916,
29918,
1761,
29897,
13,
4706,
11543,
29918,
27774,
29961,
1028,
12748,
22322,
29916,
2033,
29922,
1366,
29918,
4774,
29918,
2378,
13,
4706,
11543,
29918,
27774,
29961,
1028,
12748,
22322,
29891,
2033,
29922,
29891,
29918,
1761,
13,
13,
1678,
736,
11543,
29918,
27774,
13,
13,
13,
1753,
2254,
29918,
392,
29918,
13441,
29898,
5696,
29892,
13,
462,
268,
2295,
1125,
13,
1678,
9995,
29991,
13,
1678,
320,
1182,
2575,
4309,
7925,
278,
8600,
883,
278,
6790,
4138,
322,
13,
1678,
29436,
372,
304,
263,
12124,
763,
278,
1494,
13,
1678,
11543,
29918,
27774,
353,
426,
13,
4706,
525,
5965,
5790,
29918,
29896,
2396,
29912,
13,
9651,
525,
29916,
2396,
29906,
29881,
12655,
1409,
313,
29876,
29918,
6463,
2925,
29892,
302,
29918,
22100,
29897,
13,
9651,
525,
29891,
2396,
1761,
310,
6031,
6590,
304,
11073,
13,
4706,
500,
13,
4706,
2023,
13,
4706,
525,
5965,
5790,
29918,
29876,
2396,
3045,
13,
1678,
500,
13,
13,
1678,
7579,
304,
278,
6790,
1158,
278,
29871,
29906,
29881,
12655,
4636,
16161,
13,
1678,
304,
2845,
5608,
891,
1661,
29899,
10660,
891,
16125,
362,
310,
1716,
4682,
6166,
13,
1678,
9995,
13,
13,
1678,
565,
1158,
1275,
525,
29878,
25621,
2396,
13,
4706,
7500,
29918,
27774,
353,
2254,
29898,
2917,
29897,
13,
1678,
1683,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
877,
29943,
3958,
1158,
29901,
6571,
338,
451,
3447,
525,
13,
462,
462,
29871,
525,
326,
2037,
287,
29889,
4286,
4830,
29898,
5696,
876,
13,
13,
1678,
11543,
29918,
27774,
353,
3588,
29918,
29906,
29918,
23749,
29918,
546,
29918,
6463,
749,
29898,
15638,
29918,
27774,
29897,
13,
1678,
736,
11543,
29918,
27774,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
9995,
29991,
1182,
2575,
8741,
310,
8744,
15945,
29908,
13,
1678,
6389,
353,
679,
29918,
5085,
580,
13,
1678,
2295,
353,
426,
13,
4706,
525,
24713,
2396,
5085,
29889,
24713,
29892,
13,
4706,
525,
7620,
29918,
3972,
2396,
5085,
29889,
7620,
29918,
3972,
29892,
13,
4706,
525,
21646,
29918,
3493,
29918,
5696,
2396,
5085,
29889,
4722,
29918,
342,
29918,
5696,
29892,
13,
4706,
525,
2230,
29918,
3110,
2396,
5085,
29889,
4722,
29892,
13,
4706,
525,
17987,
8497,
29918,
6229,
2673,
2396,
29941,
29892,
13,
4706,
525,
12324,
2396,
5085,
29889,
12324,
29892,
13,
4706,
525,
386,
3781,
29918,
5696,
2396,
5085,
29889,
386,
3781,
29918,
5696,
29892,
13,
4706,
525,
386,
3781,
2396,
5085,
29889,
386,
3781,
29892,
13,
4706,
525,
29880,
29918,
1195,
2396,
29906,
29892,
13,
4706,
525,
29894,
29918,
1195,
2396,
29906,
29892,
13,
4706,
525,
29893,
29918,
1195,
2396,
29896,
29892,
13,
4706,
525,
2557,
29918,
19708,
2396,
5085,
29889,
2557,
29918,
19708,
29892,
13,
4706,
525,
2557,
29918,
303,
2426,
2396,
5085,
29889,
2557,
29918,
19708,
847,
29871,
29906,
29889,
29900,
29892,
13,
4706,
525,
5847,
2396,
5085,
29889,
5847,
13,
1678,
500,
13,
1678,
11543,
29918,
1725,
1446,
29918,
27774,
353,
2254,
29918,
392,
29918,
13441,
29898,
5085,
29889,
22100,
29918,
29888,
3958,
29918,
5696,
29892,
13,
462,
462,
965,
2295,
29897,
13,
13,
1678,
1596,
11543,
29918,
1725,
1446,
29918,
27774,
29889,
5975,
580,
2
] |
gaphor/RAAML/stpa/connectors.py | Texopolis/gaphor | 867 | 15054 | <filename>gaphor/RAAML/stpa/connectors.py<gh_stars>100-1000
from gaphor.diagram.connectors import Connector
from gaphor.diagram.presentation import Classified
from gaphor.RAAML.raaml import RelevantTo
from gaphor.RAAML.stpa import RelevantToItem
from gaphor.SysML.requirements.connectors import DirectedRelationshipPropertyPathConnect
@Connector.register(Classified, RelevantToItem)
class RelevantToConnect(DirectedRelationshipPropertyPathConnect):
relation_type = RelevantTo
| [
1,
529,
9507,
29958,
29887,
481,
2015,
29914,
4717,
23956,
29914,
303,
3274,
29914,
6915,
943,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
3166,
17261,
2015,
29889,
6051,
14442,
29889,
6915,
943,
1053,
1281,
484,
2801,
13,
3166,
17261,
2015,
29889,
6051,
14442,
29889,
26081,
1053,
4134,
2164,
13,
3166,
17261,
2015,
29889,
4717,
23956,
29889,
336,
8807,
1053,
830,
6591,
1762,
13,
3166,
17261,
2015,
29889,
4717,
23956,
29889,
303,
3274,
1053,
830,
6591,
1762,
2001,
13,
3166,
17261,
2015,
29889,
29903,
952,
1988,
29889,
12277,
1860,
29889,
6915,
943,
1053,
8797,
287,
9662,
800,
4034,
4854,
2605,
17918,
13,
13,
13,
29992,
20971,
2801,
29889,
9573,
29898,
2385,
2164,
29892,
830,
6591,
1762,
2001,
29897,
13,
1990,
830,
6591,
1762,
17918,
29898,
17392,
287,
9662,
800,
4034,
4854,
2605,
17918,
1125,
13,
13,
1678,
8220,
29918,
1853,
353,
830,
6591,
1762,
13,
2
] |
213. House Robber II.py | minyoungan/coding-interview | 1 | 96837 | <filename>213. House Robber II.py
class Solution:
def rob(self, nums: List[int]) -> int:
def recur(arr):
memo = {}
def dfs(i):
if i in memo:
return memo[i]
if i >= len(arr):
return 0
cur = max(arr[i] + dfs(i + 2), dfs(i + 1))
memo[i] = cur
return cur
return dfs(0)
return max(nums[0], recur(nums[0:-1]), recur(nums[1:]))
class Solution:
def rob(self, nums: List[int]) -> int:
skip_first = self._helper(nums[1:])
skp_last = self._helper(nums[:-1])
return max(nums[0], skip_first, skp_last)
def _helper(self, nums: List[int]) -> int:
one = 0
two = 0
for n in nums:
tmp = two
two = max(one + n, two)
one = tmp
return two
| [
1,
529,
9507,
29958,
29906,
29896,
29941,
29889,
5619,
6417,
495,
1944,
29889,
2272,
13,
1990,
24380,
29901,
13,
1678,
822,
10832,
29898,
1311,
29892,
954,
29879,
29901,
2391,
29961,
524,
2314,
1599,
938,
29901,
13,
308,
13,
308,
13,
4706,
822,
1162,
332,
29898,
2749,
1125,
13,
9651,
2626,
29877,
353,
6571,
13,
632,
13,
9651,
822,
4489,
29879,
29898,
29875,
1125,
13,
18884,
565,
474,
297,
2626,
29877,
29901,
13,
462,
1678,
736,
2626,
29877,
29961,
29875,
29962,
13,
462,
13,
18884,
565,
474,
6736,
7431,
29898,
2749,
1125,
13,
462,
1678,
736,
29871,
29900,
13,
462,
13,
18884,
3151,
353,
4236,
29898,
2749,
29961,
29875,
29962,
718,
4489,
29879,
29898,
29875,
718,
29871,
29906,
511,
4489,
29879,
29898,
29875,
718,
29871,
29896,
876,
13,
462,
13,
18884,
2626,
29877,
29961,
29875,
29962,
353,
3151,
13,
462,
13,
18884,
736,
3151,
13,
632,
13,
9651,
736,
4489,
29879,
29898,
29900,
29897,
13,
13,
4706,
736,
4236,
29898,
1949,
29879,
29961,
29900,
1402,
1162,
332,
29898,
1949,
29879,
29961,
29900,
13018,
29896,
11724,
1162,
332,
29898,
1949,
29879,
29961,
29896,
29901,
12622,
13,
268,
13,
268,
13,
1990,
24380,
29901,
13,
1678,
822,
10832,
29898,
1311,
29892,
954,
29879,
29901,
2391,
29961,
524,
2314,
1599,
938,
29901,
13,
4706,
14383,
29918,
4102,
353,
1583,
3032,
20907,
29898,
1949,
29879,
29961,
29896,
29901,
2314,
13,
4706,
2071,
29886,
29918,
4230,
353,
1583,
3032,
20907,
29898,
1949,
29879,
7503,
29899,
29896,
2314,
13,
13,
4706,
736,
4236,
29898,
1949,
29879,
29961,
29900,
1402,
14383,
29918,
4102,
29892,
2071,
29886,
29918,
4230,
29897,
13,
308,
13,
308,
13,
1678,
822,
903,
20907,
29898,
1311,
29892,
954,
29879,
29901,
2391,
29961,
524,
2314,
1599,
938,
29901,
13,
4706,
697,
353,
29871,
29900,
13,
4706,
1023,
353,
29871,
29900,
13,
308,
13,
4706,
363,
302,
297,
954,
29879,
29901,
13,
9651,
13128,
353,
1023,
13,
9651,
1023,
353,
4236,
29898,
650,
718,
302,
29892,
1023,
29897,
13,
9651,
697,
353,
13128,
13,
632,
13,
4706,
736,
1023,
13,
2
] |
project_euler_20.py | andrazm123/Project-Euler | 0 | 127525 | def fakulteta(n):
if n == 0:
return 1
else:
return n * fakulteta(n - 1)
def vsota_stevk_fakultete(n):
seznam = [int(d) for d in str(fakulteta(n))]
vsota = 0
for i in range(0, len(seznam)):
vsota = vsota + seznam[i]
return(vsota)
print(vsota_stevk_fakultete(100)) | [
1,
822,
285,
26189,
1187,
29898,
29876,
1125,
13,
1678,
565,
302,
1275,
29871,
29900,
29901,
13,
4706,
736,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
736,
302,
334,
285,
26189,
1187,
29898,
29876,
448,
29871,
29896,
29897,
13,
13,
1753,
7186,
4616,
29918,
1655,
29894,
29895,
29918,
29888,
26189,
2650,
29898,
29876,
1125,
13,
1678,
409,
17706,
353,
518,
524,
29898,
29881,
29897,
363,
270,
297,
851,
29898,
29888,
26189,
1187,
29898,
29876,
28166,
259,
13,
1678,
7186,
4616,
353,
29871,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
344,
17706,
22164,
13,
9651,
7186,
4616,
353,
7186,
4616,
718,
409,
17706,
29961,
29875,
29962,
13,
1678,
736,
29898,
4270,
4616,
29897,
13,
13,
2158,
29898,
4270,
4616,
29918,
1655,
29894,
29895,
29918,
29888,
26189,
2650,
29898,
29896,
29900,
29900,
876,
2
] |
baselines/deepq/assembly/data/plot_result.py | DengYuelin/baselines-assembly | 1 | 28392 | # -*- coding: utf-8 -*-
"""
# @Time : 24/10/18 2:40 PM
# @Author : <NAME>
# @FileName: plot_result.py
# @Software: PyCharm
# @Github : https://github.com/hzm2016
"""
import collections
import matplotlib.pyplot as plt
import numpy as np
import pickle
import copy as cp
from baselines.deepq.assembly.src.value_functions import *
"""=================================Plot result====================================="""
# YLABEL = ['$F_x(N)$', '$F_y(N)$', '$F_z(N)$', '$M_x(Nm)$', '$M_y(Nm)$', '$M_z(Nm)$']
YLABEL = ['$F_x$(N)', '$F_y$(N)', '$F_z$(N)', '$M_x$(Nm)', '$M_y$(Nm)', '$M_z$(Nm)']
Title = ["X axis force", "Y axis force", "Z axis force",
"X axis moment", "Y axis moment", "Z axis moment"]
High = np.array([40, 40, 0, 5, 5, 5, 542, -36, 188, 5, 5, 5])
Low = np.array([-40, -40, -40, -5, -5, -5, 538, -42, 192, -5, -5, -5])
scale = np.array([40, 40, 40, 5, 5, 5])
"""================================================================================="""
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
def plot(result_path):
plt.figure(figsize=(15, 15), dpi=100)
plt.title('Search Result')
prediction_result = np.load(result_path)
for i in range(len(prediction_result)):
for j in range(6):
line = prediction_result[:, j]
# plt.subplot(2, 3, j+1)
plt.plot(line)
plt.ylabel(YLABEL[j])
plt.xlabel('steps')
plt.legend(YLABEL)
plt.show()
def plot_force_and_moment(path_2, path_3):
V_force = np.load(path_2)
V_state = np.load(path_3)
plt.figure(figsize=(15, 10), dpi=100)
plt.title("Search Result of Force", fontsize=20)
plt.plot(V_force[:100])
plt.xlabel("Steps", fontsize=20)
plt.ylabel("F(N)", fontsize=20)
plt.legend(labels=['Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'], loc='best', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
plt.figure(figsize=(15, 10), dpi=100)
plt.title("Search Result of State", fontsize=20)
plt.plot(V_state[:100] - [539.88427, -38.68679, 190.03184, 179.88444, 1.30539, 0.21414])
plt.xlabel("Steps", fontsize=20)
plt.ylabel("Coordinate", fontsize=20)
plt.legend(labels=['x', 'y', 'z', 'rx', 'ry', 'rz'], loc='best', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
plt.show()
def plot_reward(reward_path):
reward = np.load(reward_path)
print(reward[0])
plt.figure(figsize=(15, 15), dpi=100)
plt.title('Episode Reward')
plt.plot(np.arange(len(reward) - 1), np.array(reward[1:]))
plt.ylabel('Episode Reward')
plt.xlabel('Episodes')
plt.show()
def plot_raw_data(path_1):
data = np.load(path_1)
force_m = np.zeros((len(data), 12))
plt.figure(figsize=(20, 20), dpi=100)
plt.tight_layout(pad=3, w_pad=0.5, h_pad=1.0)
plt.subplots_adjust(left=0.065, bottom=0.1, right=0.995, top=0.9, wspace=0.2, hspace=0.2)
plt.title("True Data")
for j in range(len(data)):
force_m[j] = data[j, 0]
k = -1
for i in range(len(data)):
if data[i, 1] == 0:
print("===========================================")
line = force_m[k+1:i+1]
print(line)
k = i
for j in range(6):
plt.subplot(2, 3, j + 1)
plt.plot(line[:, j])
# plt.plot(line[:, 0])
if j == 1:
plt.ylabel(YLABEL[j], fontsize=17.5)
plt.xlabel('steps', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
else:
plt.ylabel(YLABEL[j], fontsize=20)
plt.xlabel('steps', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
i += 1
def plot_continuous_data(path):
raw_data = np.load(path)
plt.figure(figsize=(20, 15))
plt.title('Episode Reward')
plt.tight_layout(pad=3, w_pad=0.5, h_pad=1.0)
plt.subplots_adjust(left=0.1, bottom=0.15, right=0.98, top=0.9, wspace=0.23, hspace=0.22)
# plt.subplots_adjust(left=0.065, bottom=0.1, right=0.995, top=0.9, wspace=0.2, hspace=0.2)
data = np.zeros((len(raw_data), 12))
for j in range(len(raw_data)):
data[j] = raw_data[j, 0]
for j in range(6):
plt.subplot(2, 3, j + 1)
plt.plot(data[:, j]*scale[j], linewidth=2.5)
# plt.ylabel(YLABEL[j], fontsize=18)
if j>2:
plt.xlabel('steps', fontsize=30)
plt.title(YLABEL[j], fontsize=30)
plt.xticks(fontsize=25)
plt.yticks(fontsize=25)
# plt.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.4, hspace=0.2)
plt.savefig('raw_data.pdf')
plt.show()
def compute_true_return(path):
raw_data = np.load(path)
# print(raw_data)
clock = 0
G = 0.
past_gammas = []
past_cumulants = []
all_G = []
for i in range(len(raw_data)):
observation, action, done, action_probability = raw_data[i]
if done == False:
gamma = 0.99
else:
gamma = 0.
past_gammas.append(gamma)
past_cumulants.append(1)
if done == False:
clock += 1
G = 0
all_G.append(cp.deepcopy(G))
else:
print('clock', clock)
for j in reversed(range(0, clock + 1)):
G *= past_gammas[j]
G += past_cumulants[j]
all_G.append(cp.deepcopy(G))
clock = 0
past_cumulants = []
past_gammas = []
print(len(raw_data))
plt.figure(figsize=(20, 15))
plt.plot(all_G[300:400])
plt.show()
return all_G
# Plot the true prediction and true value
def plot_different_gamma_data(path):
f = open(path, 'rb')
titles = ['$\gamma = 0.4$', '$\gamma = 0.8$', '$\gamma = 0.96$', '$\gamma =1.0$']
# true_data = compute_true_return('prediction_result_different_gamma.npy')
# f = open('../data/learning_result_policy', 'rb')
# plot_value_functions = ['Move down Fy', 'Move down Fx', 'Move down Fz', 'Move down Mx', 'Move down My', 'Move down Mz']
plot_value_functions = ['Move down step', 'Move down step 2', 'Move down step 3', 'Move down step 4']
# plot_value_functions = ['Move down Fx', 'Move down Fx 1', 'Move down Fx 2', 'Move down Fx 3']
raw_data = pickle.load(f)
plt.figure(figsize=(20, 15))
plt.tight_layout(pad=3, w_pad=1., h_pad=0.5)
plt.subplots_adjust(left=0.1, bottom=0.15, right=0.98, top=0.9, wspace=0.23, hspace=0.23)
# legend = sorted([key for key in plot_value_functions.keys()])
# print(legend)
# print(value_functions.keys())
for j, key in enumerate(plot_value_functions):
plt.subplot(2, 2, j + 1)
# print(list(raw_data[('GTD(1)', 'Hindsight Error')][key]))
# plt.plot(np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[:], linewidth=2.5)
# plt.plot(true_data[300:])
plt.plot(np.array(raw_data[('GTD(0)', 'UDE')][key])[600:], linewidth=2.75)
# print('true value', np.array(raw_data[('GTD(0)', 'UDE')][key])[300:400])
# plt.plot(np.array(raw_data[('GTD(0)', 'TD Error')][key])[600:], linewidth=2.5)
# print('old prediction', np.array(raw_data[('GTD(0)', 'TD Error')][key])[300:400])
plt.plot(np.array(raw_data[('GTD(0)', 'Prediction')][key])[600:], linewidth=2.75)
# plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[300:] - np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[300:], linewidth=2.5)
# plt.legend('True value', 'Prediction value')
plt.title(titles[j], fontsize=30)
if j > 1:
plt.xlabel('steps', fontsize=30)
plt.ylabel('Number of steps', fontsize=30)
plt.xticks(fontsize=25)
plt.yticks(fontsize=25)
# plt.savefig('different_gamma.pdf')
plt.show()
# Plot the true prediction and true value
def chinese_plot_different_gamma_data(path):
f = open(path, 'rb')
titles = ['$\gamma = 0.4$', '$\gamma = 0.8$', '$\gamma = 0.96$', '$\gamma =1.0$']
# true_data = compute_true_return('prediction_result_different_gamma.npy')
# f = open('../data/learning_result_policy', 'rb')
# plot_value_functions = ['Move down Fy', 'Move down Fx', 'Move down Fz', 'Move down Mx', 'Move down My', 'Move down Mz']
plot_value_functions = ['Move down step', 'Move down step 2', 'Move down step 3', 'Move down step 4']
# plot_value_functions = ['Move down Fx', 'Move down Fx 1', 'Move down Fx 2', 'Move down Fx 3']
raw_data = pickle.load(f)
plt.figure(figsize=(20, 12), dpi=1000)
plt.tight_layout(pad=3, w_pad=1., h_pad=0.5)
plt.subplots_adjust(left=0.08, bottom=0.12, right=0.98, top=0.95, wspace=0.23, hspace=0.33)
# legend = sorted([key for key in plot_value_functions.keys()])
# print(legend)
# print(value_functions.keys())
for j, key in enumerate(plot_value_functions):
plt.subplot(2, 2, j + 1)
# print(list(raw_data[('GTD(1)', 'Hindsight Error')][key]))
# plt.plot(np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[:], linewidth=2.5)
# plt.plot(true_data[300:])
plt.plot(np.array(raw_data[('GTD(0)', 'UDE')][key])[600:], linewidth=2.75)
# print('true value', np.array(raw_data[('GTD(0)', 'UDE')][key])[300:400])
# plt.plot(np.array(raw_data[('GTD(0)', 'TD Error')][key])[600:], linewidth=2.5)
# print('old prediction', np.array(raw_data[('GTD(0)', 'TD Error')][key])[300:400])
plt.plot(np.array(raw_data[('GTD(0)', 'Prediction')][key])[600:], linewidth=2.75)
# plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[300:] - np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[300:], linewidth=2.5)
# plt.legend('True value', 'Prediction value')
plt.title(titles[j], fontsize=36)
if j > 1:
plt.xlabel('搜索步数', fontsize=36)
plt.ylabel('预测周期', fontsize=36)
plt.xticks([0, 50, 100, 150, 200], fontsize=36)
plt.yticks(fontsize=36)
plt.savefig('./figure/pdf/chinese_different_gamma.pdf')
# plt.show()
def chinese_plot_compare_raw_data(path1, path2):
raw_data = np.load(path1)
raw_data_1 = np.load(path2)
plt.figure(figsize=(20, 12), dpi=1000)
plt.title('Episode Reward')
plt.tight_layout(pad=3, w_pad=0.5, h_pad=1.0)
plt.subplots_adjust(left=0.08, bottom=0.08, right=0.98, top=0.95, wspace=0.33, hspace=0.15)
data = np.zeros((len(raw_data), 12))
for j in range(len(raw_data)):
data[j] = raw_data[j, 0]
data_1 = np.zeros((len(raw_data_1), 12))
for j in range(len(raw_data_1)):
data_1[j] = raw_data_1[j, 0]
for j in range(6):
plt.subplot(2, 3, j + 1)
plt.plot(data[:100, j], linewidth=2.5, color='r', linestyle='--')
plt.plot(data_1[:100, j], linewidth=2.5, color='b')
# plt.ylabel(YLABEL[j], fontsize=18)
if j>2:
plt.xlabel('搜索步数', fontsize=38)
plt.title(YLABEL[j], fontsize=38)
plt.xticks(fontsize=38)
plt.yticks(fontsize=38)
# plt.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=0.4, hspace=0.2)
plt.savefig('./figure/pdf/chinese_raw_data.pdf')
# plt.show()
# Plot the true prediction and true value
def chinese_plot_different_policy_data(path, name):
f = open(path, 'rb')
# true_data = compute_true_return('prediction_result_different_gamma.npy')
# f = open('../data/learning_result_policy', 'rb')
plot_value_functions = ['Move down Fx', 'Move down Fy', 'Move down Fz', 'Move down Mx', 'Move down My', 'Move down Mz']
# plot_value_functions = ['Move down step', 'Move down step 2', 'Move down step 3', 'Move down step 4']
# plot_value_functions = ['Move down Fx', 'Move down Fx 1', 'Move down Fx 2', 'Move down Fx 3']
raw_data = pickle.load(f)
plt.figure(figsize=(20, 12), dpi=1000)
plt.title('Episode Reward')
plt.tight_layout(pad=3, w_pad=0.5, h_pad=1.0)
plt.subplots_adjust(left=0.1, bottom=0.1, right=0.98, top=0.95, wspace=0.33, hspace=0.25)
# plt.subplots_adjust(left=0.1, bottom=0.12, right=0.98, top=0.94, wspace=0.23, hspace=0.33)
# legend = sorted([key for key in plot_value_functions.keys()])
# print(legend)
# print(value_functions.keys())
for j, key in enumerate(plot_value_functions):
plt.subplot(2, 3, j + 1)
# print(list(raw_data[('GTD(1)', 'Hindsight Error')][key]))
# plt.plot(np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[400:]*scale[j], linewidth=2.5)
# plt.plot(true_data[300:])
plt.plot(np.array(raw_data[('GTD(1)', 'UDE')][key])[1000:]*scale[j], linewidth=2.5)
# print('true value', np.array(raw_data[('GTD(0)', 'UDE')][key])[300:400])
# plt.plot(np.array(raw_data[('GTD(0)', 'TD Error')][key])[600:], linewidth=2.5, color='r')
# print('old prediction', np.array(raw_data[('GTD(0)', 'TD Error')][key])[300:400])
plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[1000:]*scale[j], linewidth=2.5)
# plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[300:] - np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[300:], linewidth=2.5)
# plt.legend('True value', 'Prediction value')
plt.title(YLABEL[j], fontsize=38)
if j > 2:
plt.xlabel('搜索步数', fontsize=38)
plt.xticks([0, 50, 100, 150, 200], fontsize=38)
plt.yticks(fontsize=38)
plt.savefig('./figure/pdf/chinese_' + name +'.pdf')
# plt.show()
# Plot the true prediction and true value
def plot_different_policy_data(path):
f = open(path, 'rb')
# true_data = compute_true_return('prediction_result_different_gamma.npy')
# f = open('../data/learning_result_policy', 'rb')
plot_value_functions = ['Move down Fx', 'Move down Fy', 'Move down Fz', 'Move down Mx', 'Move down My', 'Move down Mz']
# plot_value_functions = ['Move down step', 'Move down step 2', 'Move down step 3', 'Move down step 4']
# plot_value_functions = ['Move down Fx', 'Move down Fx 1', 'Move down Fx 2', 'Move down Fx 3']
raw_data = pickle.load(f)
plt.figure(figsize=(20, 12), dpi=1000)
plt.title('Episode Reward')
plt.tight_layout(pad=3, w_pad=1.0, h_pad=1.0)
plt.subplots_adjust(left=0.1, bottom=0.15, right=0.98, top=0.9, wspace=0.23, hspace=0.23)
# legend = sorted([key for key in plot_value_functions.keys()])
# print(legend)
# print(value_functions.keys())
for j, key in enumerate(plot_value_functions):
plt.subplot(2, 3, j + 1)
# print(list(raw_data[('GTD(1)', 'Hindsight Error')][key]))
# plt.plot(np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[400:]*scale[j], linewidth=2.5)
# plt.plot(true_data[300:])
plt.plot(np.array(raw_data[('GTD(1)', 'UDE')][key])[1000:]*scale[j], linewidth=2.5)
# print('true value', np.array(raw_data[('GTD(0)', 'UDE')][key])[300:400])
# plt.plot(np.array(raw_data[('GTD(0)', 'TD Error')][key])[600:], linewidth=2.5, color='r')
# print('old prediction', np.array(raw_data[('GTD(0)', 'TD Error')][key])[300:400])
plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[1000:]*scale[j], linewidth=2.5)
# plt.plot(np.array(raw_data[('GTD(1)', 'Prediction')][key])[300:] - np.array(raw_data[('GTD(1)', 'Hindsight Error')][key])[300:], linewidth=2.5)
# plt.legend('True value', 'Prediction value')
plt.title(YLABEL[j], fontsize=30)
if j > 2:
plt.xlabel('steps', fontsize=30)
plt.xticks([0, 50, 100, 150, 200], fontsize=25)
plt.yticks(fontsize=25)
plt.savefig('./figure/pdf/chinese_different_policies_b.pdf')
# plt.show()
if __name__ == "__main__":
# force = np.load('./search_force.npy')
# state = np.load('./search_state.npy')
# print(np.max(force, axis=0))
# print(np.min(force, axis=0))
# print(np.max(state, axis=0))
# print(np.min(state, axis=0))
# plot('./search_state.npy')
# plot('./search_force.npy')
# plot_reward('./episode_rewards.npy')
# data = np.load('prediction_result.npy')
# print(data[:, 2])
# plot_continuous_data('prediction_result_different_gamma_six_force.npy')
# f = open('../data/learning_result', 'rb')
# y = pickle.load(f)
# data = y[('GTD(1)', 'Hindsight Error')]['Move down Fz']
# print(data)
# plt.figure(figsize=(15, 15), dpi=100)
# plt.title('Search Result')
#
# plt.plot(data)
# plt.ylabel(YLABEL[0])
# plt.xlabel('steps')
# plt.legend(YLABEL)
# plt.show()
# compute_true_return('prediction_result_different_gamma.npy')
# plot_true_data('learning_result_six_force_gamma_0.9')
# plot_true_data('learning_result_different_gamma')
# plot_different_gamma_data('learning_result_different_policy')
"""=============================== plot different policy ===================================== """
# plot_different_policy_data('learning_result_six_force_gamma_0.9')
# chinese_plot_different_policy_data('learning_result_six_force_gamma_0.9')
# plot_different_policy_data('learning_result_different_policy_new_3')
chinese_plot_different_policy_data('learning_result_different_policy_new_3', 'off_policy_3')
# chinese_plot_different_policy_data('learning_result_different_policy')
# chinese_plot_different_policy_data('learning_result_different_policy')
"""=============================== plot different gamma ======================================== """
# plot_different_gamma_data('learning_result_different_gamma_new')
# chinese_plot_different_gamma_data('learning_result_different_gamma_new') | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29937,
732,
2481,
1678,
584,
29871,
29906,
29946,
29914,
29896,
29900,
29914,
29896,
29947,
29871,
29906,
29901,
29946,
29900,
11278,
13,
29937,
732,
13720,
29871,
584,
529,
5813,
29958,
13,
29937,
732,
17020,
29901,
6492,
29918,
2914,
29889,
2272,
13,
29937,
732,
6295,
14093,
29901,
10772,
1451,
2817,
13,
29937,
732,
29954,
2985,
268,
30383,
2045,
597,
3292,
29889,
510,
29914,
29882,
14018,
29906,
29900,
29896,
29953,
13,
15945,
29908,
13,
5215,
16250,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
5215,
5839,
280,
13,
5215,
3509,
408,
21447,
13,
3166,
2362,
24210,
29889,
24535,
29939,
29889,
26936,
29889,
4351,
29889,
1767,
29918,
12171,
1053,
334,
13,
13,
15945,
29908,
9166,
9166,
29922,
20867,
1121,
9166,
9166,
2751,
13776,
29908,
13,
29937,
612,
24461,
6670,
353,
6024,
29938,
29943,
29918,
29916,
29898,
29940,
1262,
742,
14180,
29943,
29918,
29891,
29898,
29940,
1262,
742,
14180,
29943,
29918,
29920,
29898,
29940,
1262,
742,
14180,
29924,
29918,
29916,
29898,
29940,
29885,
1262,
742,
14180,
29924,
29918,
29891,
29898,
29940,
29885,
1262,
742,
14180,
29924,
29918,
29920,
29898,
29940,
29885,
1262,
2033,
13,
29979,
24461,
6670,
353,
6024,
29938,
29943,
29918,
29916,
12330,
29940,
29897,
742,
14180,
29943,
29918,
29891,
12330,
29940,
29897,
742,
14180,
29943,
29918,
29920,
12330,
29940,
29897,
742,
14180,
29924,
29918,
29916,
12330,
29940,
29885,
29897,
742,
14180,
29924,
29918,
29891,
12330,
29940,
29885,
29897,
742,
14180,
29924,
29918,
29920,
12330,
29940,
29885,
29897,
2033,
13,
7030,
353,
6796,
29990,
9685,
4889,
613,
376,
29979,
9685,
4889,
613,
376,
29999,
9685,
4889,
613,
13,
308,
376,
29990,
9685,
3256,
613,
376,
29979,
9685,
3256,
613,
376,
29999,
9685,
3256,
3108,
13,
16382,
353,
7442,
29889,
2378,
4197,
29946,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29945,
29892,
29871,
29945,
29892,
29871,
29945,
29946,
29906,
29892,
448,
29941,
29953,
29892,
29871,
29896,
29947,
29947,
29892,
29871,
29945,
29892,
29871,
29945,
29892,
29871,
29945,
2314,
13,
29931,
340,
353,
7442,
29889,
2378,
4197,
29899,
29946,
29900,
29892,
448,
29946,
29900,
29892,
448,
29946,
29900,
29892,
448,
29945,
29892,
448,
29945,
29892,
448,
29945,
29892,
29871,
29945,
29941,
29947,
29892,
448,
29946,
29906,
29892,
29871,
29896,
29929,
29906,
29892,
448,
29945,
29892,
448,
29945,
29892,
448,
29945,
2314,
13,
7052,
353,
7442,
29889,
2378,
4197,
29946,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29945,
29892,
29871,
29945,
29892,
29871,
29945,
2314,
13,
15945,
29908,
9166,
9166,
9166,
9166,
9166,
13776,
29908,
13,
572,
29873,
29889,
2214,
9629,
1839,
5657,
29889,
29879,
550,
29899,
643,
361,
2033,
29922,
1839,
8942,
3868,
29875,
2033,
13,
572,
29873,
29889,
2214,
9629,
1839,
1165,
267,
29889,
2523,
356,
29918,
12254,
2033,
29922,
8824,
13,
13,
13,
1753,
6492,
29898,
2914,
29918,
2084,
1125,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29945,
29892,
29871,
29896,
29945,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
877,
7974,
7867,
1495,
13,
1678,
18988,
29918,
2914,
353,
7442,
29889,
1359,
29898,
2914,
29918,
2084,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
11965,
2463,
29918,
2914,
22164,
13,
4706,
363,
432,
297,
3464,
29898,
29953,
1125,
13,
9651,
1196,
353,
18988,
29918,
2914,
7503,
29892,
432,
29962,
13,
9651,
396,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
29974,
29896,
29897,
13,
9651,
14770,
29889,
5317,
29898,
1220,
29897,
13,
9651,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29926,
2314,
13,
9651,
14770,
29889,
29916,
1643,
877,
24530,
1495,
13,
9651,
14770,
29889,
26172,
29898,
29979,
24461,
6670,
29897,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
10118,
29918,
392,
29918,
29885,
2932,
29898,
2084,
29918,
29906,
29892,
2224,
29918,
29941,
1125,
13,
13,
1678,
478,
29918,
10118,
353,
7442,
29889,
1359,
29898,
2084,
29918,
29906,
29897,
13,
1678,
478,
29918,
3859,
353,
7442,
29889,
1359,
29898,
2084,
29918,
29941,
29897,
13,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29945,
29892,
29871,
29896,
29900,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
703,
7974,
7867,
310,
11004,
613,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
5317,
29898,
29963,
29918,
10118,
7503,
29896,
29900,
29900,
2314,
13,
1678,
14770,
29889,
29916,
1643,
703,
7789,
567,
613,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
29891,
1643,
703,
29943,
29898,
29940,
19123,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
26172,
29898,
21134,
29922,
1839,
29943,
29916,
742,
525,
29943,
29891,
742,
525,
29943,
29920,
742,
525,
29924,
29916,
742,
525,
3421,
742,
525,
29924,
29920,
7464,
1180,
2433,
13318,
742,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
1678,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29945,
29892,
29871,
29896,
29900,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
703,
7974,
7867,
310,
4306,
613,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
5317,
29898,
29963,
29918,
3859,
7503,
29896,
29900,
29900,
29962,
448,
518,
29945,
29941,
29929,
29889,
29947,
29947,
29946,
29906,
29955,
29892,
448,
29941,
29947,
29889,
29953,
29947,
29953,
29955,
29929,
29892,
29871,
29896,
29929,
29900,
29889,
29900,
29941,
29896,
29947,
29946,
29892,
29871,
29896,
29955,
29929,
29889,
29947,
29947,
29946,
29946,
29946,
29892,
29871,
29896,
29889,
29941,
29900,
29945,
29941,
29929,
29892,
29871,
29900,
29889,
29906,
29896,
29946,
29896,
29946,
2314,
13,
1678,
14770,
29889,
29916,
1643,
703,
7789,
567,
613,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
29891,
1643,
703,
7967,
16065,
613,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
26172,
29898,
21134,
29922,
1839,
29916,
742,
525,
29891,
742,
525,
29920,
742,
525,
17697,
742,
525,
719,
742,
525,
11987,
7464,
1180,
2433,
13318,
742,
4079,
2311,
29922,
29906,
29900,
29897,
13,
1678,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
1678,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
276,
1328,
29898,
276,
1328,
29918,
2084,
1125,
13,
1678,
20751,
353,
7442,
29889,
1359,
29898,
276,
1328,
29918,
2084,
29897,
13,
1678,
1596,
29898,
276,
1328,
29961,
29900,
2314,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29945,
29892,
29871,
29896,
29945,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
5317,
29898,
9302,
29889,
279,
927,
29898,
2435,
29898,
276,
1328,
29897,
448,
29871,
29896,
511,
7442,
29889,
2378,
29898,
276,
1328,
29961,
29896,
29901,
12622,
13,
1678,
14770,
29889,
29891,
1643,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
29916,
1643,
877,
29923,
3334,
2631,
1495,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
1610,
29918,
1272,
29898,
2084,
29918,
29896,
1125,
13,
1678,
848,
353,
7442,
29889,
1359,
29898,
2084,
29918,
29896,
29897,
13,
1678,
4889,
29918,
29885,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
1272,
511,
29871,
29896,
29906,
876,
13,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29906,
29900,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29900,
29889,
29945,
29892,
298,
29918,
8305,
29922,
29896,
29889,
29900,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29900,
29953,
29945,
29892,
5970,
29922,
29900,
29889,
29896,
29892,
1492,
29922,
29900,
29889,
29929,
29929,
29945,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29897,
13,
1678,
14770,
29889,
3257,
703,
5574,
3630,
1159,
13,
1678,
363,
432,
297,
3464,
29898,
2435,
29898,
1272,
22164,
13,
4706,
4889,
29918,
29885,
29961,
29926,
29962,
353,
848,
29961,
29926,
29892,
29871,
29900,
29962,
13,
1678,
413,
353,
448,
29896,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
1272,
22164,
13,
4706,
565,
848,
29961,
29875,
29892,
29871,
29896,
29962,
1275,
29871,
29900,
29901,
13,
9651,
1596,
703,
9166,
9166,
4936,
1360,
543,
29897,
13,
9651,
1196,
353,
4889,
29918,
29885,
29961,
29895,
29974,
29896,
29901,
29875,
29974,
29896,
29962,
13,
9651,
1596,
29898,
1220,
29897,
13,
9651,
413,
353,
474,
13,
9651,
363,
432,
297,
3464,
29898,
29953,
1125,
13,
18884,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
718,
29871,
29896,
29897,
13,
18884,
14770,
29889,
5317,
29898,
1220,
7503,
29892,
432,
2314,
13,
18884,
396,
14770,
29889,
5317,
29898,
1220,
7503,
29892,
29871,
29900,
2314,
13,
13,
18884,
565,
432,
1275,
29871,
29896,
29901,
13,
462,
1678,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29896,
29955,
29889,
29945,
29897,
13,
462,
1678,
14770,
29889,
29916,
1643,
877,
24530,
742,
4079,
2311,
29922,
29906,
29900,
29897,
13,
462,
1678,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
462,
1678,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29906,
29900,
29897,
13,
462,
1678,
14770,
29889,
29916,
1643,
877,
24530,
742,
4079,
2311,
29922,
29906,
29900,
29897,
13,
462,
1678,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
462,
1678,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29896,
29945,
29897,
13,
4706,
474,
4619,
29871,
29896,
13,
13,
13,
1753,
6492,
29918,
20621,
681,
29918,
1272,
29898,
2084,
1125,
13,
1678,
10650,
29918,
1272,
353,
7442,
29889,
1359,
29898,
2084,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29945,
876,
13,
1678,
14770,
29889,
3257,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29900,
29889,
29945,
29892,
298,
29918,
8305,
29922,
29896,
29889,
29900,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29945,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29906,
29897,
13,
1678,
396,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29900,
29953,
29945,
29892,
5970,
29922,
29900,
29889,
29896,
29892,
1492,
29922,
29900,
29889,
29929,
29929,
29945,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29897,
13,
1678,
848,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
1610,
29918,
1272,
511,
29871,
29896,
29906,
876,
13,
1678,
363,
432,
297,
3464,
29898,
2435,
29898,
1610,
29918,
1272,
22164,
13,
4706,
848,
29961,
29926,
29962,
353,
10650,
29918,
1272,
29961,
29926,
29892,
29871,
29900,
29962,
13,
1678,
363,
432,
297,
3464,
29898,
29953,
1125,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
14770,
29889,
5317,
29898,
1272,
7503,
29892,
432,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29896,
29947,
29897,
13,
4706,
565,
432,
29958,
29906,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
24530,
742,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
14770,
29889,
3257,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29906,
29945,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29906,
29945,
29897,
13,
1678,
396,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29892,
1492,
29922,
29900,
29889,
29929,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29946,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29897,
13,
1678,
14770,
29889,
7620,
1003,
877,
1610,
29918,
1272,
29889,
5140,
1495,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
10272,
29918,
3009,
29918,
2457,
29898,
2084,
1125,
13,
1678,
10650,
29918,
1272,
353,
7442,
29889,
1359,
29898,
2084,
29897,
13,
1678,
396,
1596,
29898,
1610,
29918,
1272,
29897,
13,
1678,
12006,
353,
29871,
29900,
13,
1678,
402,
353,
29871,
29900,
29889,
13,
1678,
4940,
29918,
29887,
4850,
294,
353,
5159,
13,
1678,
4940,
29918,
29883,
398,
352,
1934,
353,
5159,
13,
1678,
599,
29918,
29954,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
1610,
29918,
1272,
22164,
13,
4706,
15500,
29892,
3158,
29892,
2309,
29892,
3158,
29918,
22795,
3097,
353,
10650,
29918,
1272,
29961,
29875,
29962,
13,
13,
4706,
565,
2309,
1275,
7700,
29901,
13,
9651,
330,
2735,
353,
29871,
29900,
29889,
29929,
29929,
13,
4706,
1683,
29901,
13,
9651,
330,
2735,
353,
29871,
29900,
29889,
13,
13,
4706,
4940,
29918,
29887,
4850,
294,
29889,
4397,
29898,
4283,
29897,
13,
4706,
4940,
29918,
29883,
398,
352,
1934,
29889,
4397,
29898,
29896,
29897,
13,
13,
4706,
565,
2309,
1275,
7700,
29901,
13,
9651,
12006,
4619,
29871,
29896,
13,
9651,
402,
353,
29871,
29900,
13,
9651,
599,
29918,
29954,
29889,
4397,
29898,
6814,
29889,
24535,
8552,
29898,
29954,
876,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
13058,
742,
12006,
29897,
13,
9651,
363,
432,
297,
18764,
287,
29898,
3881,
29898,
29900,
29892,
12006,
718,
29871,
29896,
22164,
13,
18884,
402,
334,
29922,
4940,
29918,
29887,
4850,
294,
29961,
29926,
29962,
13,
18884,
402,
4619,
4940,
29918,
29883,
398,
352,
1934,
29961,
29926,
29962,
13,
9651,
599,
29918,
29954,
29889,
4397,
29898,
6814,
29889,
24535,
8552,
29898,
29954,
876,
13,
9651,
12006,
353,
29871,
29900,
13,
9651,
4940,
29918,
29883,
398,
352,
1934,
353,
5159,
13,
9651,
4940,
29918,
29887,
4850,
294,
353,
5159,
13,
13,
1678,
1596,
29898,
2435,
29898,
1610,
29918,
1272,
876,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29945,
876,
13,
1678,
14770,
29889,
5317,
29898,
497,
29918,
29954,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
1678,
14770,
29889,
4294,
580,
13,
1678,
736,
599,
29918,
29954,
13,
13,
13,
29937,
18399,
278,
1565,
18988,
322,
1565,
995,
13,
1753,
6492,
29918,
29881,
15622,
29918,
4283,
29918,
1272,
29898,
2084,
1125,
13,
1678,
285,
353,
1722,
29898,
2084,
29892,
525,
6050,
1495,
13,
1678,
17735,
353,
6024,
4535,
4283,
353,
29871,
29900,
29889,
29946,
29938,
742,
525,
4535,
4283,
353,
29871,
29900,
29889,
29947,
29938,
742,
525,
4535,
4283,
353,
29871,
29900,
29889,
29929,
29953,
29938,
742,
525,
4535,
4283,
353,
29896,
29889,
29900,
29938,
2033,
13,
1678,
396,
1565,
29918,
1272,
353,
10272,
29918,
3009,
29918,
2457,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29889,
29876,
2272,
1495,
13,
1678,
396,
285,
353,
1722,
877,
6995,
1272,
29914,
21891,
29918,
2914,
29918,
22197,
742,
525,
6050,
1495,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29891,
742,
525,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29920,
742,
525,
16619,
1623,
341,
29916,
742,
525,
16619,
1623,
1619,
742,
525,
16619,
1623,
341,
29920,
2033,
13,
1678,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
4331,
742,
525,
16619,
1623,
4331,
29871,
29906,
742,
525,
16619,
1623,
4331,
29871,
29941,
742,
525,
16619,
1623,
4331,
29871,
29946,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29916,
29871,
29896,
742,
525,
16619,
1623,
383,
29916,
29871,
29906,
742,
525,
16619,
1623,
383,
29916,
29871,
29941,
2033,
13,
1678,
10650,
29918,
1272,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29945,
876,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29896,
1696,
298,
29918,
8305,
29922,
29900,
29889,
29945,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29945,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29941,
29897,
13,
1678,
396,
15983,
353,
12705,
4197,
1989,
363,
1820,
297,
6492,
29918,
1767,
29918,
12171,
29889,
8149,
580,
2314,
13,
1678,
396,
1596,
29898,
26172,
29897,
13,
1678,
396,
1596,
29898,
1767,
29918,
12171,
29889,
8149,
3101,
13,
1678,
363,
432,
29892,
1820,
297,
26985,
29898,
5317,
29918,
1767,
29918,
12171,
1125,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29906,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
396,
1596,
29898,
1761,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
12622,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
7503,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
3009,
29918,
1272,
29961,
29941,
29900,
29900,
29901,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29955,
29945,
29897,
13,
4706,
396,
1596,
877,
3009,
995,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
1596,
877,
1025,
18988,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29955,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
17531,
448,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
26172,
877,
5574,
995,
742,
525,
23084,
2463,
995,
1495,
13,
4706,
14770,
29889,
3257,
29898,
23545,
793,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
565,
432,
1405,
29871,
29896,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
24530,
742,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
14770,
29889,
29891,
1643,
877,
4557,
310,
6576,
742,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29906,
29945,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29906,
29945,
29897,
13,
1678,
396,
14770,
29889,
7620,
1003,
877,
29881,
15622,
29918,
4283,
29889,
5140,
1495,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
29937,
18399,
278,
1565,
18988,
322,
1565,
995,
13,
1753,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
4283,
29918,
1272,
29898,
2084,
1125,
13,
1678,
285,
353,
1722,
29898,
2084,
29892,
525,
6050,
1495,
13,
1678,
17735,
353,
6024,
4535,
4283,
353,
29871,
29900,
29889,
29946,
29938,
742,
525,
4535,
4283,
353,
29871,
29900,
29889,
29947,
29938,
742,
525,
4535,
4283,
353,
29871,
29900,
29889,
29929,
29953,
29938,
742,
525,
4535,
4283,
353,
29896,
29889,
29900,
29938,
2033,
13,
1678,
396,
1565,
29918,
1272,
353,
10272,
29918,
3009,
29918,
2457,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29889,
29876,
2272,
1495,
13,
1678,
396,
285,
353,
1722,
877,
6995,
1272,
29914,
21891,
29918,
2914,
29918,
22197,
742,
525,
6050,
1495,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29891,
742,
525,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29920,
742,
525,
16619,
1623,
341,
29916,
742,
525,
16619,
1623,
1619,
742,
525,
16619,
1623,
341,
29920,
2033,
13,
1678,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
4331,
742,
525,
16619,
1623,
4331,
29871,
29906,
742,
525,
16619,
1623,
4331,
29871,
29941,
742,
525,
16619,
1623,
4331,
29871,
29946,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29916,
29871,
29896,
742,
525,
16619,
1623,
383,
29916,
29871,
29906,
742,
525,
16619,
1623,
383,
29916,
29871,
29941,
2033,
13,
1678,
10650,
29918,
1272,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29906,
511,
270,
1631,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29896,
1696,
298,
29918,
8305,
29922,
29900,
29889,
29945,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29900,
29947,
29892,
5970,
29922,
29900,
29889,
29896,
29906,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29945,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29941,
29941,
29897,
13,
1678,
396,
15983,
353,
12705,
4197,
1989,
363,
1820,
297,
6492,
29918,
1767,
29918,
12171,
29889,
8149,
580,
2314,
13,
1678,
396,
1596,
29898,
26172,
29897,
13,
1678,
396,
1596,
29898,
1767,
29918,
12171,
29889,
8149,
3101,
13,
13,
1678,
363,
432,
29892,
1820,
297,
26985,
29898,
5317,
29918,
1767,
29918,
12171,
1125,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29906,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
396,
1596,
29898,
1761,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
12622,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
7503,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
3009,
29918,
1272,
29961,
29941,
29900,
29900,
29901,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29955,
29945,
29897,
13,
4706,
396,
1596,
877,
3009,
995,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
1596,
877,
1025,
18988,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29955,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
17531,
448,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
26172,
877,
5574,
995,
742,
525,
23084,
2463,
995,
1495,
13,
13,
4706,
14770,
29889,
3257,
29898,
23545,
793,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29953,
29897,
13,
13,
4706,
565,
432,
1405,
29871,
29896,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
233,
147,
159,
31836,
233,
176,
168,
30354,
742,
4079,
2311,
29922,
29941,
29953,
29897,
13,
4706,
14770,
29889,
29891,
1643,
877,
236,
165,
135,
31851,
31109,
31117,
742,
4079,
2311,
29922,
29941,
29953,
29897,
13,
4706,
14770,
29889,
486,
7358,
4197,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29906,
29900,
29900,
1402,
4079,
2311,
29922,
29941,
29953,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29941,
29953,
29897,
13,
13,
1678,
14770,
29889,
7620,
1003,
877,
6904,
4532,
29914,
5140,
29914,
305,
8233,
29918,
29881,
15622,
29918,
4283,
29889,
5140,
1495,
13,
1678,
396,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
521,
8233,
29918,
5317,
29918,
18307,
29918,
1610,
29918,
1272,
29898,
2084,
29896,
29892,
2224,
29906,
1125,
13,
1678,
10650,
29918,
1272,
353,
7442,
29889,
1359,
29898,
2084,
29896,
29897,
13,
1678,
10650,
29918,
1272,
29918,
29896,
353,
7442,
29889,
1359,
29898,
2084,
29906,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29906,
511,
270,
1631,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29900,
29889,
29945,
29892,
298,
29918,
8305,
29922,
29896,
29889,
29900,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29900,
29947,
29892,
5970,
29922,
29900,
29889,
29900,
29947,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29945,
29892,
281,
3493,
29922,
29900,
29889,
29941,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29896,
29945,
29897,
13,
1678,
848,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
1610,
29918,
1272,
511,
29871,
29896,
29906,
876,
13,
1678,
363,
432,
297,
3464,
29898,
2435,
29898,
1610,
29918,
1272,
22164,
13,
4706,
848,
29961,
29926,
29962,
353,
10650,
29918,
1272,
29961,
29926,
29892,
29871,
29900,
29962,
13,
13,
1678,
848,
29918,
29896,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
1610,
29918,
1272,
29918,
29896,
511,
29871,
29896,
29906,
876,
13,
1678,
363,
432,
297,
3464,
29898,
2435,
29898,
1610,
29918,
1272,
29918,
29896,
22164,
13,
4706,
848,
29918,
29896,
29961,
29926,
29962,
353,
10650,
29918,
1272,
29918,
29896,
29961,
29926,
29892,
29871,
29900,
29962,
13,
13,
1678,
363,
432,
297,
3464,
29898,
29953,
1125,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
14770,
29889,
5317,
29898,
1272,
7503,
29896,
29900,
29900,
29892,
432,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29892,
2927,
2433,
29878,
742,
6276,
342,
1508,
2433,
489,
1495,
13,
4706,
14770,
29889,
5317,
29898,
1272,
29918,
29896,
7503,
29896,
29900,
29900,
29892,
432,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29892,
2927,
2433,
29890,
1495,
13,
4706,
396,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29896,
29947,
29897,
13,
4706,
565,
432,
29958,
29906,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
233,
147,
159,
31836,
233,
176,
168,
30354,
742,
4079,
2311,
29922,
29941,
29947,
29897,
13,
4706,
14770,
29889,
3257,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29947,
29897,
13,
4706,
14770,
29889,
486,
7358,
29898,
5657,
2311,
29922,
29941,
29947,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29941,
29947,
29897,
13,
13,
1678,
396,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29892,
1492,
29922,
29900,
29889,
29929,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29946,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29897,
13,
1678,
14770,
29889,
7620,
1003,
877,
6904,
4532,
29914,
5140,
29914,
305,
8233,
29918,
1610,
29918,
1272,
29889,
5140,
1495,
13,
1678,
396,
14770,
29889,
4294,
580,
13,
13,
13,
29937,
18399,
278,
1565,
18988,
322,
1565,
995,
13,
1753,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
29898,
2084,
29892,
1024,
1125,
13,
13,
1678,
285,
353,
1722,
29898,
2084,
29892,
525,
6050,
1495,
13,
1678,
396,
1565,
29918,
1272,
353,
10272,
29918,
3009,
29918,
2457,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29889,
29876,
2272,
1495,
13,
1678,
396,
285,
353,
1722,
877,
6995,
1272,
29914,
21891,
29918,
2914,
29918,
22197,
742,
525,
6050,
1495,
13,
1678,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29891,
742,
525,
16619,
1623,
383,
29920,
742,
525,
16619,
1623,
341,
29916,
742,
525,
16619,
1623,
1619,
742,
525,
16619,
1623,
341,
29920,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
4331,
742,
525,
16619,
1623,
4331,
29871,
29906,
742,
525,
16619,
1623,
4331,
29871,
29941,
742,
525,
16619,
1623,
4331,
29871,
29946,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29916,
29871,
29896,
742,
525,
16619,
1623,
383,
29916,
29871,
29906,
742,
525,
16619,
1623,
383,
29916,
29871,
29941,
2033,
13,
1678,
10650,
29918,
1272,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29906,
511,
270,
1631,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29900,
29889,
29945,
29892,
298,
29918,
8305,
29922,
29896,
29889,
29900,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29945,
29892,
281,
3493,
29922,
29900,
29889,
29941,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29945,
29897,
13,
1678,
396,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29906,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29946,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29941,
29941,
29897,
13,
1678,
396,
15983,
353,
12705,
4197,
1989,
363,
1820,
297,
6492,
29918,
1767,
29918,
12171,
29889,
8149,
580,
2314,
13,
1678,
396,
1596,
29898,
26172,
29897,
13,
1678,
396,
1596,
29898,
1767,
29918,
12171,
29889,
8149,
3101,
13,
1678,
363,
432,
29892,
1820,
297,
26985,
29898,
5317,
29918,
1767,
29918,
12171,
1125,
13,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
396,
1596,
29898,
1761,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
12622,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29946,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
3009,
29918,
1272,
29961,
29941,
29900,
29900,
29901,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29896,
29900,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
1596,
877,
3009,
995,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29892,
2927,
2433,
29878,
1495,
13,
4706,
396,
1596,
877,
1025,
18988,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29896,
29900,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
17531,
448,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
26172,
877,
5574,
995,
742,
525,
23084,
2463,
995,
1495,
13,
4706,
14770,
29889,
3257,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29947,
29897,
13,
4706,
565,
432,
1405,
29871,
29906,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
233,
147,
159,
31836,
233,
176,
168,
30354,
742,
4079,
2311,
29922,
29941,
29947,
29897,
13,
4706,
14770,
29889,
486,
7358,
4197,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29906,
29900,
29900,
1402,
4079,
2311,
29922,
29941,
29947,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29941,
29947,
29897,
13,
13,
1678,
14770,
29889,
7620,
1003,
877,
6904,
4532,
29914,
5140,
29914,
305,
8233,
29918,
29915,
718,
1024,
718,
4286,
5140,
1495,
13,
1678,
396,
14770,
29889,
4294,
580,
13,
13,
13,
29937,
18399,
278,
1565,
18988,
322,
1565,
995,
13,
1753,
6492,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
29898,
2084,
1125,
13,
1678,
285,
353,
1722,
29898,
2084,
29892,
525,
6050,
1495,
13,
1678,
396,
1565,
29918,
1272,
353,
10272,
29918,
3009,
29918,
2457,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29889,
29876,
2272,
1495,
13,
1678,
396,
285,
353,
1722,
877,
6995,
1272,
29914,
21891,
29918,
2914,
29918,
22197,
742,
525,
6050,
1495,
13,
1678,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29891,
742,
525,
16619,
1623,
383,
29920,
742,
525,
16619,
1623,
341,
29916,
742,
525,
16619,
1623,
1619,
742,
525,
16619,
1623,
341,
29920,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
4331,
742,
525,
16619,
1623,
4331,
29871,
29906,
742,
525,
16619,
1623,
4331,
29871,
29941,
742,
525,
16619,
1623,
4331,
29871,
29946,
2033,
13,
1678,
396,
6492,
29918,
1767,
29918,
12171,
353,
6024,
16619,
1623,
383,
29916,
742,
525,
16619,
1623,
383,
29916,
29871,
29896,
742,
525,
16619,
1623,
383,
29916,
29871,
29906,
742,
525,
16619,
1623,
383,
29916,
29871,
29941,
2033,
13,
1678,
10650,
29918,
1272,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29906,
511,
270,
1631,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
14770,
29889,
3257,
877,
29923,
12907,
390,
809,
538,
1495,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29941,
29892,
281,
29918,
8305,
29922,
29896,
29889,
29900,
29892,
298,
29918,
8305,
29922,
29896,
29889,
29900,
29897,
13,
1678,
14770,
29889,
1491,
26762,
29918,
328,
5143,
29898,
1563,
29922,
29900,
29889,
29896,
29892,
5970,
29922,
29900,
29889,
29896,
29945,
29892,
1492,
29922,
29900,
29889,
29929,
29947,
29892,
2246,
29922,
29900,
29889,
29929,
29892,
281,
3493,
29922,
29900,
29889,
29906,
29941,
29892,
298,
3493,
29922,
29900,
29889,
29906,
29941,
29897,
13,
1678,
396,
15983,
353,
12705,
4197,
1989,
363,
1820,
297,
6492,
29918,
1767,
29918,
12171,
29889,
8149,
580,
2314,
13,
1678,
396,
1596,
29898,
26172,
29897,
13,
1678,
396,
1596,
29898,
1767,
29918,
12171,
29889,
8149,
3101,
13,
1678,
363,
432,
29892,
1820,
297,
26985,
29898,
5317,
29918,
1767,
29918,
12171,
1125,
13,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29941,
29892,
432,
718,
29871,
29896,
29897,
13,
4706,
396,
1596,
29898,
1761,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
12622,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29946,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
3009,
29918,
1272,
29961,
29941,
29900,
29900,
29901,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29896,
29900,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
1596,
877,
3009,
995,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
29965,
2287,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29953,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29892,
2927,
2433,
29878,
1495,
13,
4706,
396,
1596,
877,
1025,
18988,
742,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29900,
29897,
742,
525,
24495,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
29946,
29900,
29900,
2314,
13,
4706,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29896,
29900,
29900,
29900,
29901,
14178,
7052,
29961,
29926,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
5317,
29898,
9302,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
23084,
2463,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
17531,
448,
7442,
29889,
2378,
29898,
1610,
29918,
1272,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
3816,
1989,
2314,
29961,
29941,
29900,
29900,
29901,
1402,
1196,
2103,
29922,
29906,
29889,
29945,
29897,
13,
4706,
396,
14770,
29889,
26172,
877,
5574,
995,
742,
525,
23084,
2463,
995,
1495,
13,
13,
4706,
14770,
29889,
3257,
29898,
29979,
24461,
6670,
29961,
29926,
1402,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
565,
432,
1405,
29871,
29906,
29901,
13,
9651,
14770,
29889,
29916,
1643,
877,
24530,
742,
4079,
2311,
29922,
29941,
29900,
29897,
13,
4706,
14770,
29889,
486,
7358,
4197,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29906,
29900,
29900,
1402,
4079,
2311,
29922,
29906,
29945,
29897,
13,
4706,
14770,
29889,
3637,
7358,
29898,
5657,
2311,
29922,
29906,
29945,
29897,
13,
13,
1678,
14770,
29889,
7620,
1003,
877,
6904,
4532,
29914,
5140,
29914,
305,
8233,
29918,
29881,
15622,
29918,
3733,
293,
583,
29918,
29890,
29889,
5140,
1495,
13,
1678,
396,
14770,
29889,
4294,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
4889,
353,
7442,
29889,
1359,
877,
6904,
4478,
29918,
10118,
29889,
29876,
2272,
1495,
13,
1678,
396,
2106,
353,
7442,
29889,
1359,
877,
6904,
4478,
29918,
3859,
29889,
29876,
2272,
1495,
13,
1678,
396,
1596,
29898,
9302,
29889,
3317,
29898,
10118,
29892,
9685,
29922,
29900,
876,
13,
1678,
396,
1596,
29898,
9302,
29889,
1195,
29898,
10118,
29892,
9685,
29922,
29900,
876,
13,
1678,
396,
1596,
29898,
9302,
29889,
3317,
29898,
3859,
29892,
9685,
29922,
29900,
876,
13,
1678,
396,
1596,
29898,
9302,
29889,
1195,
29898,
3859,
29892,
9685,
29922,
29900,
876,
13,
1678,
396,
6492,
877,
6904,
4478,
29918,
3859,
29889,
29876,
2272,
1495,
13,
1678,
396,
6492,
877,
6904,
4478,
29918,
10118,
29889,
29876,
2272,
1495,
13,
1678,
396,
6492,
29918,
276,
1328,
877,
6904,
1022,
275,
356,
29918,
276,
2935,
29889,
29876,
2272,
1495,
13,
13,
1678,
396,
848,
353,
7442,
29889,
1359,
877,
11965,
2463,
29918,
2914,
29889,
29876,
2272,
1495,
13,
1678,
396,
1596,
29898,
1272,
7503,
29892,
29871,
29906,
2314,
13,
1678,
396,
6492,
29918,
20621,
681,
29918,
1272,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29918,
28319,
29918,
10118,
29889,
29876,
2272,
1495,
13,
13,
1678,
396,
285,
353,
1722,
877,
6995,
1272,
29914,
21891,
29918,
2914,
742,
525,
6050,
1495,
13,
1678,
396,
343,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1678,
396,
848,
353,
343,
29961,
877,
23799,
29928,
29898,
29896,
29897,
742,
525,
29950,
12772,
523,
4829,
1495,
22322,
16619,
1623,
383,
29920,
2033,
13,
1678,
396,
1596,
29898,
1272,
29897,
13,
1678,
396,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29945,
29892,
29871,
29896,
29945,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
396,
14770,
29889,
3257,
877,
7974,
7867,
1495,
13,
1678,
396,
13,
1678,
396,
14770,
29889,
5317,
29898,
1272,
29897,
13,
1678,
396,
14770,
29889,
29891,
1643,
29898,
29979,
24461,
6670,
29961,
29900,
2314,
13,
1678,
396,
14770,
29889,
29916,
1643,
877,
24530,
1495,
13,
1678,
396,
14770,
29889,
26172,
29898,
29979,
24461,
6670,
29897,
13,
1678,
396,
14770,
29889,
4294,
580,
13,
13,
1678,
396,
10272,
29918,
3009,
29918,
2457,
877,
11965,
2463,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29889,
29876,
2272,
1495,
13,
1678,
396,
6492,
29918,
3009,
29918,
1272,
877,
21891,
29918,
2914,
29918,
28319,
29918,
10118,
29918,
4283,
29918,
29900,
29889,
29929,
1495,
13,
1678,
396,
6492,
29918,
3009,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
1495,
13,
1678,
396,
6492,
29918,
29881,
15622,
29918,
4283,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
22197,
1495,
13,
13,
1678,
9995,
9166,
4936,
2751,
25512,
6492,
1422,
8898,
1275,
9166,
9166,
25512,
9995,
13,
1678,
396,
6492,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
28319,
29918,
10118,
29918,
4283,
29918,
29900,
29889,
29929,
1495,
13,
1678,
396,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
28319,
29918,
10118,
29918,
4283,
29918,
29900,
29889,
29929,
1495,
13,
1678,
396,
6492,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
22197,
29918,
1482,
29918,
29941,
1495,
13,
1678,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
22197,
29918,
1482,
29918,
29941,
742,
525,
2696,
29918,
22197,
29918,
29941,
1495,
13,
1678,
396,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
22197,
1495,
13,
1678,
396,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
22197,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
22197,
1495,
13,
13,
1678,
9995,
9166,
4936,
2751,
25512,
6492,
1422,
330,
2735,
1275,
9166,
9166,
2751,
1360,
9995,
13,
1678,
396,
6492,
29918,
29881,
15622,
29918,
4283,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29918,
1482,
1495,
13,
1678,
396,
521,
8233,
29918,
5317,
29918,
29881,
15622,
29918,
4283,
29918,
1272,
877,
21891,
29918,
2914,
29918,
29881,
15622,
29918,
4283,
29918,
1482,
1495,
2
] |
samcnet/simple.py | binarybana/samcnet | 12 | 98816 | <gh_stars>10-100
import numpy as np
import scipy.stats as st
class Simple():
def __init__(self, truemu=2.0, sigma=1.0, N=20, mu0=0.0, tau=5.0):
self.x = 0.0
self.old_x = 0.0
self.truemu = truemu
self.sigma = sigma
self.N = N
self.mu0 = mu0
self.tau = tau
self.data = st.norm.rvs(loc=self.truemu, scale=self.sigma, size=self.N)
self.postmode = (self.mu0/self.tau**2 + self.data.mean()/self.sigma**2) \
/ (1/self.tau**2 + 1/self.sigma**2)
print "Postmode: %f" % self.postmode
def propose(self):
self.old_x = self.x
self.x += np.random.normal(scale=3.0)
def copy(self):
return self.x
def save_to_db(self):
return self.x
def reject(self):
self.x = self.old_x
def energy(self):
sum = 0.0
# prior
sum -= st.norm.logpdf(self.x, loc=self.mu0, scale=self.tau)
# likelihood
sum -= st.norm.logpdf(self.data, loc=self.x, scale=self.sigma).sum()
return sum
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
12655,
408,
7442,
13,
5215,
4560,
2272,
29889,
16202,
408,
380,
13,
13,
1990,
12545,
7295,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
534,
29884,
24425,
29922,
29906,
29889,
29900,
29892,
269,
2934,
29922,
29896,
29889,
29900,
29892,
405,
29922,
29906,
29900,
29892,
3887,
29900,
29922,
29900,
29889,
29900,
29892,
260,
585,
29922,
29945,
29889,
29900,
1125,
13,
4706,
1583,
29889,
29916,
353,
29871,
29900,
29889,
29900,
13,
4706,
1583,
29889,
1025,
29918,
29916,
353,
29871,
29900,
29889,
29900,
13,
13,
4706,
1583,
29889,
509,
29884,
24425,
353,
534,
29884,
24425,
13,
4706,
1583,
29889,
3754,
353,
269,
2934,
13,
4706,
1583,
29889,
29940,
353,
405,
13,
13,
4706,
1583,
29889,
2589,
29900,
353,
3887,
29900,
13,
4706,
1583,
29889,
4722,
353,
260,
585,
13,
13,
4706,
1583,
29889,
1272,
353,
380,
29889,
12324,
29889,
29878,
4270,
29898,
2029,
29922,
1311,
29889,
509,
29884,
24425,
29892,
6287,
29922,
1311,
29889,
3754,
29892,
2159,
29922,
1311,
29889,
29940,
29897,
13,
13,
4706,
1583,
29889,
2490,
8513,
353,
313,
1311,
29889,
2589,
29900,
29914,
1311,
29889,
4722,
1068,
29906,
718,
1583,
29889,
1272,
29889,
12676,
580,
29914,
1311,
29889,
3754,
1068,
29906,
29897,
320,
13,
18884,
847,
313,
29896,
29914,
1311,
29889,
4722,
1068,
29906,
718,
29871,
29896,
29914,
1311,
29889,
3754,
1068,
29906,
29897,
13,
632,
13,
4706,
1596,
376,
6747,
8513,
29901,
1273,
29888,
29908,
1273,
1583,
29889,
2490,
8513,
13,
13,
1678,
822,
16193,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1025,
29918,
29916,
353,
1583,
29889,
29916,
13,
4706,
1583,
29889,
29916,
4619,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29941,
29889,
29900,
29897,
13,
13,
1678,
822,
3509,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29916,
13,
13,
1678,
822,
4078,
29918,
517,
29918,
2585,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29916,
13,
13,
1678,
822,
12560,
29898,
1311,
1125,
13,
4706,
1583,
29889,
29916,
353,
1583,
29889,
1025,
29918,
29916,
13,
13,
1678,
822,
5864,
29898,
1311,
1125,
13,
4706,
2533,
353,
29871,
29900,
29889,
29900,
13,
4706,
396,
7536,
13,
4706,
2533,
22361,
380,
29889,
12324,
29889,
1188,
5140,
29898,
1311,
29889,
29916,
29892,
1180,
29922,
1311,
29889,
2589,
29900,
29892,
6287,
29922,
1311,
29889,
4722,
29897,
13,
13,
4706,
396,
4188,
22342,
13,
4706,
2533,
22361,
380,
29889,
12324,
29889,
1188,
5140,
29898,
1311,
29889,
1272,
29892,
1180,
29922,
1311,
29889,
29916,
29892,
6287,
29922,
1311,
29889,
3754,
467,
2083,
580,
13,
4706,
736,
2533,
13,
2
] |
management/forms.py | packmas13/registration | 1 | 166191 | <reponame>packmas13/registration
from django import forms
from django.utils.translation import gettext_lazy as _
class SendSupportEmailForm(forms.Form):
SUBJECT_CHOICES = [
"",
_("Participant management"),
_("Feedback / Suggestion"),
_("Bug report"),
_("Other"),
]
sender = forms.CharField(label=_("Sender"), disabled=True)
subject = forms.ChoiceField(
label=_("Subject"), choices=zip(SUBJECT_CHOICES, SUBJECT_CHOICES)
)
message = forms.CharField(
label=_("Message"), widget=forms.Textarea(attrs={"cols": 32, "rows": 4})
)
def __init__(self, user, *args, **kwargs):
super().__init__(*args, **kwargs)
if not self.initial:
self.initial["sender"] = "{} {} <{}>".format(
user.first_name, user.last_name, user.email
)
| [
1,
529,
276,
1112,
420,
29958,
4058,
8247,
29896,
29941,
29914,
1727,
8306,
13,
3166,
9557,
1053,
7190,
13,
3166,
9557,
29889,
13239,
29889,
3286,
18411,
1053,
679,
726,
29918,
433,
1537,
408,
903,
13,
13,
13,
1990,
15076,
14039,
9823,
2500,
29898,
9514,
29889,
2500,
1125,
13,
1678,
27092,
17637,
29918,
3210,
29949,
2965,
2890,
353,
518,
13,
4706,
12633,
13,
4706,
903,
703,
7439,
12654,
424,
10643,
4968,
13,
4706,
903,
703,
29737,
1627,
847,
317,
12981,
602,
4968,
13,
4706,
903,
703,
29933,
688,
3461,
4968,
13,
4706,
903,
703,
16107,
4968,
13,
1678,
4514,
13,
13,
1678,
10004,
353,
7190,
29889,
27890,
29898,
1643,
29922,
29918,
703,
29615,
4968,
12708,
29922,
5574,
29897,
13,
1678,
4967,
353,
7190,
29889,
29620,
3073,
29898,
13,
4706,
3858,
29922,
29918,
703,
20622,
4968,
19995,
29922,
7554,
29898,
20633,
17637,
29918,
3210,
29949,
2965,
2890,
29892,
27092,
17637,
29918,
3210,
29949,
2965,
2890,
29897,
13,
1678,
1723,
13,
1678,
2643,
353,
7190,
29889,
27890,
29898,
13,
4706,
3858,
29922,
29918,
703,
3728,
4968,
11109,
29922,
9514,
29889,
1626,
6203,
29898,
5552,
29879,
3790,
29908,
22724,
1115,
29871,
29941,
29906,
29892,
376,
5727,
1115,
29871,
29946,
1800,
13,
1678,
1723,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1404,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
565,
451,
1583,
29889,
11228,
29901,
13,
9651,
1583,
29889,
11228,
3366,
15452,
3108,
353,
376,
8875,
6571,
529,
8875,
29958,
1642,
4830,
29898,
13,
18884,
1404,
29889,
4102,
29918,
978,
29892,
1404,
29889,
4230,
29918,
978,
29892,
1404,
29889,
5269,
13,
9651,
1723,
13,
2
] |
exec.py | developerHaneum/listBug | 2 | 24096 | <filename>exec.py
from clint.textui import *
def Write():
i = 0
while True:
i += 1
text = input(colored.cyan("%d: "%i))
if text == "q":
sys.exit(0)
def Print():
print(colored.cyan("-- Bug list --"))
print(colored.cyan("-- ") + colored.red("<q:quit>") + colored.cyan(" --"))
Write()
Print()
| [
1,
529,
9507,
29958,
4258,
29889,
2272,
13,
3166,
1067,
524,
29889,
726,
1481,
1053,
334,
13,
13,
1753,
14350,
7295,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
1550,
5852,
29901,
13,
4706,
474,
4619,
29871,
29896,
13,
4706,
1426,
353,
1881,
29898,
2780,
287,
29889,
1270,
273,
11702,
29881,
29901,
11860,
29875,
876,
13,
4706,
565,
1426,
1275,
376,
29939,
1115,
13,
632,
10876,
29889,
13322,
29898,
29900,
29897,
13,
1753,
13905,
7295,
13,
1678,
1596,
29898,
2780,
287,
29889,
1270,
273,
703,
489,
28209,
1051,
1192,
5783,
13,
1678,
1596,
29898,
2780,
287,
29889,
1270,
273,
703,
489,
16521,
718,
28684,
29889,
1127,
28945,
29939,
29901,
28358,
29958,
1159,
718,
28684,
29889,
1270,
273,
703,
1192,
5783,
13,
1678,
14350,
580,
13,
11816,
580,
13,
2
] |
buildutil/main.py | TediCreations/buildutils | 0 | 4573 | #!/usr/bin/env python3
import os
import argparse
import subprocess
if __name__ == '__main__':
from version import __version__
from configParser import ConfigParser
else:
from .version import __version__
from .configParser import ConfigParser
def command(cmd):
"""Run a shell command"""
subprocess.call(cmd, shell=True)
"""
cmd_split = cmd.split()
process = subprocess.Popen(cmd_split,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True)
stdout, stderr = process.communicate()
return stdout, stderr
"""
def main():
absFilePath = os.path.dirname(os.path.abspath(__file__))
cwdPath = os.path.abspath(os.getcwd())
parser = argparse.ArgumentParser(
prog="buildutil",
description="Assembly/C/C++ utility to build embedded systems",
epilog="Author: <NAME>",
fromfile_prefix_chars='@')
# parser.add_argument('-v', '--verbose',
# action='store_true',
# help='an optional argument')
"""
parser.add_argument('Path',
metavar='path',
type=str,
default=cwdPath,
help='the config filepath')
"""
parser.add_argument(
'-d', '--directory',
type=str,
default=cwdPath,
help='the config filepath')
parser.add_argument(
'-v', '--version',
action='store_true',
help='get the version of the build system')
# parser.add_argument(
# '-f',
# '--file',
# help='A readable file',
# metavar='FILE',
# type=argparse.FileType('r'),
# default=None)
cmd_parser = parser.add_subparsers(dest='cmd', description="")
parser_build = cmd_parser.add_parser(
'build',
help="build the project")
parser_get_version = cmd_parser.add_parser(
'get_version',
help="try to get the version from git")
# parser_get_version.add_argument(
# '-a', '--alpha',
# dest='alpha',
# help='try to get the version')
# Execute parse_args()
args = parser.parse_args()
subcommand = parser.parse_args().cmd
if args.version is True:
print(f"version: {__version__}")
exit(0)
# if subcommand is None or subcommand == "build":
if subcommand == "build":
makefilePath = os.path.join(absFilePath, "conf/make/Makefile")
command(f"make -f {makefilePath}")
elif subcommand == "get_version":
print("version")
else:
ConfigParser()
print("fuck")
return
# Working directory
wd = os.path.abspath(args.directory)
print(f"File: {absFilePath}")
print(F"CWD: {cwdPath}")
print(F"Working directory: {wd}")
print(F"makefile path: {makefilePath}")
print()
command(f"make -f {makefilePath}")
if __name__ == '__main__':
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
2897,
13,
5215,
1852,
5510,
13,
5215,
1014,
5014,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
12,
3166,
1873,
1053,
4770,
3259,
1649,
13,
12,
3166,
2295,
11726,
1053,
12782,
11726,
13,
2870,
29901,
13,
12,
3166,
869,
3259,
1053,
4770,
3259,
1649,
13,
12,
3166,
869,
2917,
11726,
1053,
12782,
11726,
13,
13,
13,
1753,
1899,
29898,
9006,
1125,
13,
12,
15945,
29908,
6558,
263,
6473,
1899,
15945,
29908,
13,
13,
12,
1491,
5014,
29889,
4804,
29898,
9006,
29892,
6473,
29922,
5574,
29897,
13,
13,
12,
15945,
29908,
13,
12,
9006,
29918,
5451,
353,
9920,
29889,
5451,
580,
13,
13,
12,
5014,
353,
1014,
5014,
29889,
29925,
3150,
29898,
9006,
29918,
5451,
29892,
13,
12,
12,
15903,
29922,
5574,
29892,
13,
12,
12,
25393,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
12,
12,
303,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
12,
14540,
284,
29918,
1482,
9012,
29922,
5574,
29897,
13,
12,
25393,
29892,
380,
20405,
353,
1889,
29889,
27820,
403,
580,
13,
13,
12,
2457,
27591,
29892,
380,
20405,
13,
12,
15945,
29908,
13,
13,
13,
1753,
1667,
7295,
13,
13,
12,
6897,
2283,
2605,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
876,
13,
12,
29883,
9970,
2605,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
657,
29883,
9970,
3101,
13,
13,
12,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
12,
12,
29097,
543,
4282,
4422,
613,
13,
12,
12,
8216,
543,
22400,
29914,
29907,
29914,
29907,
1817,
19725,
304,
2048,
15685,
6757,
613,
13,
12,
12,
1022,
26140,
543,
13720,
29901,
529,
5813,
28341,
13,
12,
12,
3166,
1445,
29918,
13506,
29918,
305,
1503,
2433,
29992,
1495,
13,
13,
12,
29937,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29894,
742,
525,
489,
369,
15828,
742,
13,
12,
29937,
462,
539,
3158,
2433,
8899,
29918,
3009,
742,
13,
12,
29937,
462,
539,
1371,
2433,
273,
13136,
2980,
1495,
13,
13,
12,
15945,
29908,
13,
12,
16680,
29889,
1202,
29918,
23516,
877,
2605,
742,
13,
12,
2527,
485,
279,
2433,
2084,
742,
13,
12,
1853,
29922,
710,
29892,
13,
12,
4381,
29922,
29883,
9970,
2605,
29892,
13,
12,
8477,
2433,
1552,
2295,
934,
2084,
1495,
13,
12,
15945,
29908,
13,
13,
12,
16680,
29889,
1202,
29918,
23516,
29898,
13,
12,
12,
28560,
29881,
742,
525,
489,
12322,
742,
13,
12,
12,
1853,
29922,
710,
29892,
13,
12,
12,
4381,
29922,
29883,
9970,
2605,
29892,
13,
12,
12,
8477,
2433,
1552,
2295,
934,
2084,
1495,
13,
13,
12,
16680,
29889,
1202,
29918,
23516,
29898,
13,
12,
12,
28560,
29894,
742,
525,
489,
3259,
742,
13,
12,
12,
2467,
2433,
8899,
29918,
3009,
742,
13,
12,
12,
8477,
2433,
657,
278,
1873,
310,
278,
2048,
1788,
1495,
13,
13,
12,
29937,
13812,
29889,
1202,
29918,
23516,
29898,
13,
12,
29937,
29871,
12,
28560,
29888,
742,
13,
12,
29937,
29871,
12,
29915,
489,
1445,
742,
13,
12,
29937,
29871,
12,
8477,
2433,
29909,
19909,
934,
742,
13,
12,
29937,
29871,
12,
2527,
485,
279,
2433,
7724,
742,
13,
12,
29937,
29871,
12,
1853,
29922,
1191,
5510,
29889,
2283,
1542,
877,
29878,
5477,
13,
12,
29937,
29871,
12,
4381,
29922,
8516,
29897,
13,
13,
12,
9006,
29918,
16680,
353,
13812,
29889,
1202,
29918,
1491,
862,
4253,
29898,
7854,
2433,
9006,
742,
6139,
543,
1159,
13,
13,
12,
16680,
29918,
4282,
353,
9920,
29918,
16680,
29889,
1202,
29918,
16680,
29898,
13,
12,
12,
29915,
4282,
742,
13,
12,
12,
8477,
543,
4282,
278,
2060,
1159,
13,
12,
16680,
29918,
657,
29918,
3259,
353,
9920,
29918,
16680,
29889,
1202,
29918,
16680,
29898,
13,
12,
12,
29915,
657,
29918,
3259,
742,
13,
12,
12,
8477,
543,
2202,
304,
679,
278,
1873,
515,
6315,
1159,
13,
12,
29937,
13812,
29918,
657,
29918,
3259,
29889,
1202,
29918,
23516,
29898,
13,
12,
29937,
29871,
12,
28560,
29874,
742,
525,
489,
2312,
742,
13,
12,
29937,
29871,
12,
7854,
2433,
2312,
742,
13,
12,
29937,
29871,
12,
8477,
2433,
2202,
304,
679,
278,
1873,
1495,
13,
13,
12,
29937,
11080,
1082,
6088,
29918,
5085,
580,
13,
12,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
12,
1491,
6519,
353,
13812,
29889,
5510,
29918,
5085,
2141,
9006,
13,
13,
12,
361,
6389,
29889,
3259,
338,
5852,
29901,
13,
12,
12,
2158,
29898,
29888,
29908,
3259,
29901,
426,
1649,
3259,
1649,
27195,
13,
12,
12,
13322,
29898,
29900,
29897,
13,
13,
12,
29937,
565,
1014,
6519,
338,
6213,
470,
1014,
6519,
1275,
376,
4282,
1115,
13,
12,
361,
1014,
6519,
1275,
376,
4282,
1115,
13,
12,
12,
5675,
1445,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
6897,
2283,
2605,
29892,
376,
5527,
29914,
5675,
29914,
9984,
1445,
1159,
13,
12,
12,
6519,
29898,
29888,
29908,
5675,
448,
29888,
426,
5675,
1445,
2605,
27195,
13,
12,
23681,
1014,
6519,
1275,
376,
657,
29918,
3259,
1115,
13,
12,
12,
2158,
703,
3259,
1159,
13,
12,
2870,
29901,
13,
12,
12,
3991,
11726,
580,
13,
12,
12,
2158,
703,
29888,
2707,
1159,
13,
13,
12,
2457,
13,
13,
12,
29937,
24176,
3884,
13,
12,
9970,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
5085,
29889,
12322,
29897,
13,
13,
12,
2158,
29898,
29888,
29908,
2283,
29901,
795,
426,
6897,
2283,
2605,
27195,
13,
12,
2158,
29898,
29943,
29908,
29907,
24668,
29901,
1669,
426,
29883,
9970,
2605,
27195,
13,
12,
2158,
29898,
29943,
29908,
5531,
292,
3884,
29901,
426,
9970,
27195,
13,
12,
2158,
29898,
29943,
29908,
5675,
1445,
2224,
29901,
268,
426,
5675,
1445,
2605,
27195,
13,
12,
2158,
580,
13,
13,
12,
6519,
29898,
29888,
29908,
5675,
448,
29888,
426,
5675,
1445,
2605,
27195,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
12,
3396,
580,
13,
2
] |
tests/unit/test_categories.py | aeskincbr/kesher-backend | 1 | 177437 | <reponame>aeskincbr/kesher-backend
import json
from pytest_mock import MockerFixture
from service import report_category_handler
def test_get_report_categories_list(mocker: MockerFixture):
response = report_category_handler.get_report_categories_list(mocker.MagicMock(), mocker.MagicMock())
body = json.loads(response["body"])
assert body is not None | [
1,
529,
276,
1112,
420,
29958,
29874,
8488,
3742,
1182,
29914,
10794,
2276,
29899,
27852,
13,
5215,
4390,
13,
3166,
11451,
1688,
29918,
17640,
1053,
341,
8658,
18800,
15546,
13,
3166,
2669,
1053,
3461,
29918,
7320,
29918,
13789,
13,
13,
1753,
1243,
29918,
657,
29918,
12276,
29918,
20683,
29918,
1761,
29898,
29885,
8658,
29901,
341,
8658,
18800,
15546,
1125,
13,
1678,
2933,
353,
3461,
29918,
7320,
29918,
13789,
29889,
657,
29918,
12276,
29918,
20683,
29918,
1761,
29898,
29885,
8658,
29889,
19095,
293,
18680,
3285,
286,
8658,
29889,
19095,
293,
18680,
3101,
13,
13,
1678,
3573,
353,
4390,
29889,
18132,
29898,
5327,
3366,
2587,
20068,
13,
1678,
4974,
3573,
338,
451,
6213,
2
] |
tests/testConverters.py | ttm/musicLegacy | 2 | 90994 | <filename>tests/testConverters.py
import musicLegacy as m
import importlib
#from IPython.lib.deepreload import reload as dreload
importlib.reload(m.converters)
importlib.reload(m)
#dreload(m,exclude="pytz")
co=m.BasicConverter()
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
1168,
369,
2153,
29889,
2272,
13,
5215,
4696,
22988,
4135,
408,
286,
13,
5215,
29871,
1053,
1982,
13,
29937,
3166,
5641,
1656,
29889,
1982,
29889,
24535,
28120,
1053,
19763,
408,
14724,
1359,
13,
5215,
1982,
29889,
28120,
29898,
29885,
29889,
535,
369,
2153,
29897,
13,
5215,
1982,
29889,
28120,
29898,
29885,
29897,
13,
29937,
29881,
28120,
29898,
29885,
29892,
735,
2325,
543,
2272,
17559,
1159,
13,
13,
13,
1111,
29922,
29885,
29889,
16616,
18545,
580,
13,
2
] |
radssh/shell.py | Eli-Tarrago/radssh | 39 | 57028 | #
# Copyright (c) 2014, 2016, 2018, 2020 LexisNexis Risk Data Management Inc.
#
# This file is part of the RadSSH software package.
#
# RadSSH is free software, released under the Revised BSD License.
# You are permitted to use, modify, and redsitribute this software
# according to the Revised BSD License, a copy of which should be
# included with the distribution as file LICENSE.txt
#
'''
Python wrapper for parallel execution shell
===========================================
*** This module should be run, not imported ***
Usage: ```python -m radssh.shell host [...]```
Will read settings from /etc/radssh_config, and supplement with ~/.radssh_config.
Settings may also be provided on the command line, using the form --keyword=value.
'''
import sys
import os
import time
import socket
import pprint
import readline
import atexit
import logging
from . import ssh
from . import config
from .console import RadSSHConsole, monochrome
try:
from . import star_commands as star
import radssh.plugins
except ImportError:
class NullStarCommands(object):
'''Use stub if plugins or star_commands can not be loaded'''
@classmethod
def call(*args, **kwargs):
print('Plugins directory not found - *commands disabled')
star_help = call
star_info = call
commands = {'*help': star_help}
star = NullStarCommands()
# Try using colorama when running on Windows
if sys.platform.startswith('win'):
try:
import colorama
colorama.initialise.init()
except Exception as e:
print('Unable to support ANSI escape sequences via colorama module')
print(e)
sys.exit(1)
# Ensure ~/.ssh directory exists, with sensible permissions
try:
os.mkdir(os.path.expanduser('~/.ssh'), 0o700)
except OSError:
pass
################################################################################
command_listeners = []
def shell(cluster, logdir=None, playbackfile=None, defaults=None):
'''Very basic interactive shell'''
if not defaults:
defaults = config.load_default_settings()
while True:
try:
if playbackfile:
try:
cmd = next(playbackfile)
print('%s %s' % (defaults['shell.prompt'], cmd.strip()))
except StopIteration:
return
else:
try:
cmd = input('%s ' % defaults['shell.prompt'])
except KeyboardInterrupt:
print('\n<Ctrl-C> during input\nUse EOF (<Ctrl-D>) or *exit to exit shell\n')
continue
# Feed command line to any registered listeners from plugins
for feed in command_listeners:
feed_result = feed(cmd)
if feed_result:
if defaults['show_altered_commands'] == 'on':
cluster.console.message('Command modified from "%s" to "%s"' % (cmd, feed_result))
cmd = str(feed_result)
if logdir:
with open(os.path.join(logdir, 'session.commands'), 'a') as f:
f.write('%s\n' % cmd)
args = cmd.split()
if len(args) > 0:
if os.path.basename(args[0]) == 'sudo' and len(args) > 1:
initial_command = os.path.basename(args[1])
else:
initial_command = os.path.basename(args[0])
if initial_command in defaults['commands.forbidden'].split(','):
print('You really don\'t want to run %s without a TTY, do you?' % initial_command)
continue
if initial_command in defaults['commands.restricted'].split(','):
print('STOP! "%s" is listed as a restricted command (Potentially dangerous)' % initial_command)
print('and requires explicit confirmation before running.')
print('Please double check all parameters, just to be sure...')
print(' >>>', cmd)
confirm = input('Enter \'100%\' if completely sure: ')
if confirm != '100%':
continue
if args[0].startswith('#'):
# Comment
continue
if args[0].startswith('*'):
ret = star.call(cluster, logdir, cmd)
cluster.console.join()
if isinstance(ret, ssh.Cluster):
cluster.console.message('Switched cluster from %r to %r' % (cluster, ret))
cluster = ret
continue
r = cluster.run_command(cmd)
if logdir:
cluster.log_result(logdir, encoding=defaults['character_encoding'])
# Quick summary report, if jobs failed
failures = {}
completions = []
completion_time = 0.0
for k, job in r.items():
v = job.result
if job.completed:
if v.return_code == 0:
completions.append(str(k))
completion_time += job.end_time - job.start_time
else:
failures.setdefault(v.return_code, []).append(str(k))
else:
failures.setdefault(None, []).append(str(k))
if failures:
print('\nSummary of return codes:')
for k, v in [(0, completions)] + list(failures.items()):
if len(v) > 5:
print(k, '\t- (%d hosts)' % len(v))
else:
print(k, '\t-', sorted(v))
if completions:
print('Average completion time for %d hosts: %fs' % (len(completions), (completion_time / len(completions))))
except KeyboardInterrupt:
print('Ctrl-C during command preparation - command aborted.')
except EOFError as e:
print(e)
break
print('Shell exiting')
cluster.close_connections()
################################################################################
# Readline/libedit command completion
# Supports *commands, executables (LOCAL), and path (REMOTE) completion
class radssh_tab_handler(object):
'''Class wrapper for readline TAB key completion'''
def __init__(self, cluster, star):
# Need access to the cluster object to get SFTP service
# for remote path completion, and the star command dictionary
# to know what *commands are available.
self.cluster = cluster
self.star = star
try:
self.using_libedit = ('libedit' in readline.__doc__)
except TypeError:
# pyreadline (windows) readline.__doc__ is None (not iterable)
self.using_libedit = False
self.completion_choices = []
readline.set_completer()
readline.set_completer(self.complete)
readline.set_completer_delims(' \t\n/*')
if self.using_libedit:
readline.parse_and_bind('bind ^I rl_complete')
else:
readline.parse_and_bind('tab: complete')
def complete_star_command(self, lead_in, text, state):
if state == 0:
# Rebuild cached list of choices that match
# Reset list to empty (choices = [] would reference local, not persistent list)
del self.completion_choices[:]
for choice in self.star.commands.keys():
if choice.startswith(lead_in):
self.completion_choices.append(choice + ' ')
# Discrepancy with readline/libedit and handling of leading *
if self.using_libedit:
return self.completion_choices[state]
else:
return self.completion_choices[state][1:]
def complete_executable(self, lead_in, text, state):
if state == 0:
del self.completion_choices[:]
for path_dir in os.environ['PATH'].split(os.path.pathsep):
try:
for f in os.listdir(path_dir):
try:
if os.path.isdir(os.path.join(path_dir, f)):
continue
st = os.stat(os.path.join(path_dir, f))
if (st.st_mode & 0o111) and f.startswith(text):
self.completion_choices.append(f + ' ')
except OSError:
continue
except OSError:
continue
self.completion_choices.append(None)
return self.completion_choices[state]
def complete_remote_path(self, lead_in, text, state):
if state == 0:
del self.completion_choices[:]
for t in self.cluster.connections.values():
if t.is_authenticated():
break
else:
print('No authenticated connections')
raise RuntimeError('Tab Completion unavailable')
s = t.open_sftp_client()
parent = os.path.dirname(lead_in)
partial = os.path.basename(lead_in)
if not parent:
parent = './'
for x in s.listdir(parent):
if x.startswith(partial):
full_path = os.path.join(parent, x)
try:
# See if target is a directory, and append '/' if it is
s.chdir(full_path)
x += '/'
full_path += '/'
except Exception:
pass
if self.using_libedit:
self.completion_choices.append(full_path)
else:
self.completion_choices.append(x)
self.completion_choices.append(None)
return self.completion_choices[state]
def complete_local_path(self, lead_in, text, state):
if state == 0:
del self.completion_choices[:]
parent = os.path.dirname(lead_in)
partial = os.path.basename(lead_in)
if not parent:
parent = './'
for x in os.listdir(parent):
if x.startswith(partial):
full_path = os.path.join(parent, x)
if os.path.isdir(full_path):
# See if target is a directory, and append '/' if it is
x += '/'
full_path += '/'
if self.using_libedit:
self.completion_choices.append(full_path)
else:
self.completion_choices.append(x)
self.completion_choices.append(None)
return self.completion_choices[state]
def complete(self, text, state):
buffer = readline.get_line_buffer()
lead_in = buffer[:readline.get_endidx()].split()[-1]
try:
if buffer.startswith('*') and ' ' in buffer:
# See if *command has custom tab completion
star_command = self.star.commands.get(buffer.split()[0], None)
if star_command and star_command.tab_completion:
return star_command.tab_completion(self, buffer, lead_in, text, state)
if lead_in.startswith('*'):
# User needs help completing *command...
return self.complete_star_command(lead_in, text, state)
else:
# Default behavior - remote file path completion
return self.complete_remote_path(lead_in, text, state)
except Exception:
raise
################################################################################
# Workaround for https://github.com/radssh/radssh/issues/32
# Newer GNU Readline library raise false errno value that the Python
# wrapper reraises as IOError. https://bugs.python.org/issue10350 not
# being backported to Python 2.7, so handle it with more code...
def safe_write_history_file(filename):
# To avoid false negative, use stat() to test the file modification times
try:
readline.write_history_file(filename)
except IOError as e:
# Ignore this exception if we wrote out the history file recently
try:
post = os.stat(filename).st_mtime
if post > time.time() - 3:
logging.debug('Ignoring "%s" writing history file', str(e))
except Exception:
raise e
################################################################################
def radssh_shell_main():
args = sys.argv[1:]
defaults = config.load_settings()
# Keep command line options separately, for reuse in sshconfig defaults
cmdline_options = config.command_line_settings(args, defaults.get('user.settings'))
defaults.update(cmdline_options)
if 'socket.timeout' in defaults:
socket.setdefaulttimeout(float(defaults['socket.timeout']))
# Setup Logging
logformat = '%(asctime)s %(levelname)-8s [%(name)s:%(thread)08X] %(message)s'
logdir = os.path.expanduser(time.strftime(defaults.get('logdir', '')))
if logdir:
if not os.path.exists(logdir):
os.mkdir(logdir)
logging.basicConfig(filename=os.path.join(logdir, 'radssh.log'),
format=logformat)
else:
logging.basicConfig(format=logformat)
pass
try:
logging.getLogger().setLevel(getattr(logging, defaults['loglevel'].upper()))
except AttributeError:
raise RuntimeError('RadSSH setting "loglevel" should be set to one of [CRITICAL,ERROR,WARNING,INFO,DEBUG] instead of "%s"', defaults['loglevel'])
logger = logging.getLogger('radssh')
# Make an AuthManager to handle user authentication
a = ssh.AuthManager(defaults['username'],
auth_file=os.path.expanduser(defaults['authfile']),
try_auth_none=(defaults['try_auth_none'] == 'on'))
# Load Plugins to aid in host lookups and add *commands dynamically
loaded_plugins = {}
exe_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
system_plugin_dir = os.path.join(exe_dir, 'plugins')
disable_plugins = defaults['disable_plugins'].split(',')
plugin_dirs = [x for x in defaults['plugins'].split(';') if x]
plugin_dirs.append(system_plugin_dir)
for x in plugin_dirs:
plugin_dir = os.path.abspath(os.path.expanduser(x))
if not os.path.exists(plugin_dir):
continue
for module in sorted(os.listdir(plugin_dir)):
if module.endswith('.py') and not module.startswith('__'):
plugin = module[:-3]
# Skip modules found in more that 1 location, and ones explicitly disabled
if plugin in loaded_plugins or plugin in disable_plugins:
continue
try:
logger.info('Loading plugin module: %s', plugin)
this_plugin = radssh.plugins.load_plugin(os.path.join(plugin_dir, module))
if hasattr(this_plugin, 'settings'):
prefix = 'plugin.%s.' % plugin
user_settings = {}
user_settings = dict([(k[len(prefix):], v) for k, v in defaults.items() if k.startswith(prefix)])
logger.info('Updating settings for plugin %s with: %s', plugin, user_settings)
this_plugin.settings.update(user_settings)
if hasattr(this_plugin, 'init'):
logger.debug('Calling init method for plugin: %s', plugin)
this_plugin.init(defaults=defaults, auth=a, plugins=loaded_plugins, star_commands=star.commands, shell=shell)
if hasattr(this_plugin, 'star_commands'):
logger.debug('Registering *commands for plugin: %s %s', plugin, this_plugin.star_commands.keys())
star.commands.update(this_plugin.star_commands)
if hasattr(this_plugin, 'command_listener'):
command_listeners.append(this_plugin.command_listener)
loaded_plugins[plugin] = this_plugin
except Exception as e:
logger.error('Failed to load plugin (%s): %s', plugin, repr(e))
# Use command line args as connect list, or give user option to supply list now
if not args:
print('No command line arguments given.')
print('You can connect to a number of hosts by hostname or IP')
if loaded_plugins:
print('You can also give symbolic names that can be translated by')
print('the following loaded plugins:')
for module, plugin in loaded_plugins.items():
try:
lookup_doc = plugin.lookup.__doc__
print(module, plugin.__doc__)
print('\t%s' % lookup_doc)
try:
plugin.banner()
except AttributeError:
pass
except AttributeError:
pass
connect_list = input('Enter a list of connection destinations: ').split()
else:
connect_list = args
if not connect_list:
sys.exit(0)
# Do the connections if needed, offer names to plugin lookup() functions
hosts = []
for arg in connect_list:
for helper, resolver in loaded_plugins.items():
if hasattr(resolver, 'lookup'):
try:
cluster = resolver.lookup(arg)
if cluster:
logger.debug('%s expanded by %s', arg, helper)
for label, host, conn in cluster:
if conn:
hosts.append((label, conn))
else:
hosts.append((label, host))
break
except Exception as e:
logger.error('Exception looking up %s via %s: %r', arg, helper, e)
cluster = None
else:
hosts.append((arg, None))
# Almost done with all the preliminary setup steps...
if defaults['loglevel'] not in ('CRITICAL', 'ERROR'):
print('*** Parallel Shell ***')
print('Using AuthManager:', a)
print('Logging to %s' % logdir)
pprint.pprint(defaults, indent=4)
print()
star.star_help()
# Create a RadSSHConsole instance for screen output
job_buffer = int(defaults['stalled_job_buffer'])
console_name = defaults['shell.console']
console = None
if '.' in console_name:
# Try finding formatter as module.function from loaded plugins
logger.info('Attempting to load custom console formatter: %s', console_name)
module_name, function_name = console_name.split('.', 1)
try:
custom_formatter = getattr(loaded_plugins[module_name], function_name)
console = RadSSHConsole(formatter=custom_formatter, retain_recent=job_buffer)
except KeyError:
logger.error('Plugin not loaded for shell.console formatter %s', console_name)
except AttributeError:
logger.error('Plugin formatter not found for shell.console formatter %s', console_name)
except Exception as e:
logger.error('Exception on console formatter %s: %r', console_name, e)
# Fallback to a standard console if plugin provided one did not load
if console is None:
if not sys.stdout.isatty() or console_name == 'monochrome':
console = RadSSHConsole(formatter=monochrome, retain_recent=job_buffer)
else:
console = RadSSHConsole(retain_recent=job_buffer)
# Finally, we are able to create the Cluster
print('Connecting to %d hosts...' % len(hosts))
cluster = ssh.Cluster(hosts, auth=a, console=console, defaults=defaults)
ready, disabled, failed_auth, failed_connect, dropped = cluster.connection_summary()
if defaults['loglevel'] not in ('CRITICAL', 'ERROR'):
star.star_info(cluster, logdir, '', [])
else:
# If cluster is not 100% connected, let user know even if loglevel is not low enough
if any((failed_auth, failed_connect, dropped)):
print('There were problems connecting to some nodes:')
if failed_connect:
print(' %d nodes failed to connect' % failed_connect)
if failed_auth:
print(' %d nodes failed authentication' % failed_auth)
if dropped:
print(' %d dropped connections' % dropped)
print(' Use "*info" for connection details.')
if ready == 1 and disabled + failed_auth + failed_connect + dropped == 0:
# Cluster size of one - check if auto_tty is set
if defaults['auto_tty'] == 'on' and 'star_tty' in loaded_plugins:
print('Auto-invoking *tty for a cluster size of 1')
loaded_plugins['star_tty'].settings['prompt_delay'] = "0.0"
star.call(cluster, logdir, '*tty')
# cluster.console.join()
cluster.close_connections()
raise SystemExit("Session complete")
# Command line history support
if defaults.get('historyfile'):
histfile = os.path.expanduser(defaults['historyfile'])
try:
readline.read_history_file(histfile)
except IOError:
pass
readline.set_history_length(int(os.environ.get('HISTSIZE', 1000)))
if sys.version_info.major == 2:
# Workaround #32 - fix not backported to Python 2.X
atexit.register(safe_write_history_file, histfile)
else:
atexit.register(readline.write_history_file, histfile)
# Add TAB completion for *commands and remote file paths
tab_completion = radssh_tab_handler(cluster, star)
# With the cluster object, start interactive session
shell(cluster=cluster, logdir=logdir, defaults=defaults)
if __name__ == '__main__':
radssh_shell_main()
| [
1,
396,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29946,
29892,
29871,
29906,
29900,
29896,
29953,
29892,
29871,
29906,
29900,
29896,
29947,
29892,
29871,
29906,
29900,
29906,
29900,
15045,
275,
29940,
735,
275,
390,
3873,
3630,
15057,
9266,
29889,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
278,
4957,
1799,
29950,
7047,
3577,
29889,
13,
29937,
13,
29937,
4957,
1799,
29950,
338,
3889,
7047,
29892,
5492,
1090,
278,
830,
11292,
350,
7230,
19245,
29889,
13,
29937,
887,
526,
21905,
304,
671,
29892,
6623,
29892,
322,
2654,
29879,
277,
2666,
445,
7047,
13,
29937,
5034,
304,
278,
830,
11292,
350,
7230,
19245,
29892,
263,
3509,
310,
607,
881,
367,
13,
29937,
5134,
411,
278,
4978,
408,
934,
365,
2965,
1430,
1660,
29889,
3945,
13,
29937,
13,
13,
12008,
13,
11980,
14476,
363,
8943,
8225,
6473,
13,
9166,
9166,
4936,
25512,
13,
13,
17435,
910,
3883,
881,
367,
1065,
29892,
451,
19673,
18610,
13,
13,
27573,
29901,
7521,
4691,
448,
29885,
2971,
15269,
29889,
15903,
3495,
518,
856,
7961,
16159,
13,
13,
12984,
1303,
6055,
515,
847,
7070,
29914,
3665,
15269,
29918,
2917,
29892,
322,
1462,
944,
411,
3695,
6294,
3665,
15269,
29918,
2917,
29889,
13,
9585,
1122,
884,
367,
4944,
373,
278,
1899,
1196,
29892,
773,
278,
883,
1192,
26766,
29922,
1767,
29889,
13,
12008,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
931,
13,
5215,
9909,
13,
5215,
282,
2158,
13,
5215,
1303,
1220,
13,
5215,
263,
4776,
277,
13,
5215,
12183,
13,
13,
3166,
869,
1053,
13927,
13,
3166,
869,
1053,
2295,
13,
3166,
869,
11058,
1053,
4957,
1799,
29950,
20008,
29892,
1601,
2878,
4871,
13,
2202,
29901,
13,
1678,
515,
869,
1053,
5810,
29918,
26381,
408,
5810,
13,
1678,
1053,
2971,
15269,
29889,
12800,
13,
19499,
16032,
2392,
29901,
13,
1678,
770,
19014,
16213,
5261,
4167,
29898,
3318,
1125,
13,
4706,
14550,
11403,
19281,
565,
18224,
470,
5810,
29918,
26381,
508,
451,
367,
7500,
12008,
13,
4706,
732,
1990,
5696,
13,
4706,
822,
1246,
10456,
5085,
29892,
3579,
19290,
1125,
13,
9651,
1596,
877,
3247,
8385,
3884,
451,
1476,
448,
334,
26381,
12708,
1495,
13,
4706,
5810,
29918,
8477,
353,
1246,
13,
4706,
5810,
29918,
3888,
353,
1246,
13,
4706,
8260,
353,
11117,
29930,
8477,
2396,
5810,
29918,
8477,
29913,
13,
13,
1678,
5810,
353,
19014,
16213,
5261,
4167,
580,
13,
13,
13,
29937,
3967,
773,
2927,
3304,
746,
2734,
373,
3852,
13,
361,
10876,
29889,
12120,
29889,
27382,
2541,
877,
5080,
29374,
13,
1678,
1018,
29901,
13,
4706,
1053,
2927,
3304,
13,
4706,
2927,
3304,
29889,
11228,
895,
29889,
2344,
580,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
877,
2525,
519,
304,
2304,
319,
3059,
29902,
10169,
15602,
3025,
2927,
3304,
3883,
1495,
13,
4706,
1596,
29898,
29872,
29897,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
29937,
22521,
545,
3695,
6294,
15269,
3884,
4864,
29892,
411,
25182,
11239,
13,
2202,
29901,
13,
1678,
2897,
29889,
11256,
3972,
29898,
359,
29889,
2084,
29889,
18837,
1792,
877,
30022,
6294,
15269,
5477,
29871,
29900,
29877,
29955,
29900,
29900,
29897,
13,
19499,
438,
29173,
29901,
13,
1678,
1209,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
6519,
29918,
20631,
414,
353,
5159,
13,
13,
13,
1753,
6473,
29898,
19594,
29892,
1480,
3972,
29922,
8516,
29892,
1708,
1627,
1445,
29922,
8516,
29892,
21274,
29922,
8516,
1125,
13,
1678,
14550,
29963,
708,
6996,
28923,
6473,
12008,
13,
1678,
565,
451,
21274,
29901,
13,
4706,
21274,
353,
2295,
29889,
1359,
29918,
4381,
29918,
11027,
580,
13,
1678,
1550,
5852,
29901,
13,
4706,
1018,
29901,
13,
9651,
565,
1708,
1627,
1445,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
9920,
353,
2446,
29898,
1456,
1627,
1445,
29897,
13,
462,
1678,
1596,
877,
29995,
29879,
1273,
29879,
29915,
1273,
313,
4381,
29879,
1839,
15903,
29889,
14032,
415,
7464,
9920,
29889,
17010,
22130,
13,
18884,
5174,
22303,
13463,
362,
29901,
13,
462,
1678,
736,
13,
9651,
1683,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
9920,
353,
1881,
877,
29995,
29879,
525,
1273,
21274,
1839,
15903,
29889,
14032,
415,
11287,
13,
18884,
5174,
7670,
3377,
4074,
6685,
29901,
13,
462,
1678,
1596,
28909,
29876,
29966,
18069,
29899,
29907,
29958,
2645,
1881,
29905,
29876,
11403,
382,
9800,
313,
29966,
18069,
29899,
29928,
12948,
470,
334,
13322,
304,
6876,
6473,
29905,
29876,
1495,
13,
462,
1678,
6773,
13,
18884,
396,
5169,
287,
1899,
1196,
304,
738,
15443,
11621,
414,
515,
18224,
13,
18884,
363,
8343,
297,
1899,
29918,
20631,
414,
29901,
13,
462,
1678,
8343,
29918,
2914,
353,
8343,
29898,
9006,
29897,
13,
462,
1678,
565,
8343,
29918,
2914,
29901,
13,
462,
4706,
565,
21274,
1839,
4294,
29918,
13794,
287,
29918,
26381,
2033,
1275,
525,
265,
2396,
13,
462,
9651,
9867,
29889,
11058,
29889,
4906,
877,
6255,
9120,
515,
11860,
29879,
29908,
304,
11860,
29879,
29908,
29915,
1273,
313,
9006,
29892,
8343,
29918,
2914,
876,
13,
462,
4706,
9920,
353,
851,
29898,
18798,
29918,
2914,
29897,
13,
18884,
565,
1480,
3972,
29901,
13,
462,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1188,
3972,
29892,
525,
7924,
29889,
26381,
5477,
525,
29874,
1495,
408,
285,
29901,
13,
462,
4706,
285,
29889,
3539,
877,
29995,
29879,
29905,
29876,
29915,
1273,
9920,
29897,
13,
9651,
6389,
353,
9920,
29889,
5451,
580,
13,
9651,
565,
7431,
29898,
5085,
29897,
1405,
29871,
29900,
29901,
13,
18884,
565,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
5085,
29961,
29900,
2314,
1275,
525,
15360,
29915,
322,
7431,
29898,
5085,
29897,
1405,
29871,
29896,
29901,
13,
462,
1678,
2847,
29918,
6519,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
5085,
29961,
29896,
2314,
13,
18884,
1683,
29901,
13,
462,
1678,
2847,
29918,
6519,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
5085,
29961,
29900,
2314,
13,
18884,
565,
2847,
29918,
6519,
297,
21274,
1839,
26381,
29889,
1454,
29890,
4215,
13359,
5451,
29898,
3788,
1125,
13,
462,
1678,
1596,
877,
3492,
2289,
1016,
20333,
29873,
864,
304,
1065,
1273,
29879,
1728,
263,
323,
15631,
29892,
437,
366,
17901,
1273,
2847,
29918,
6519,
29897,
13,
462,
1678,
6773,
13,
18884,
565,
2847,
29918,
6519,
297,
21274,
1839,
26381,
29889,
5060,
4146,
287,
13359,
5451,
29898,
3788,
1125,
13,
462,
1678,
1596,
877,
1254,
4590,
29991,
11860,
29879,
29908,
338,
9904,
408,
263,
22078,
1899,
313,
29925,
327,
9247,
18215,
16029,
1273,
2847,
29918,
6519,
29897,
13,
462,
1678,
1596,
877,
392,
6858,
6261,
9659,
362,
1434,
2734,
29889,
1495,
13,
462,
1678,
1596,
877,
12148,
3765,
1423,
599,
4128,
29892,
925,
304,
367,
1854,
856,
1495,
13,
462,
1678,
1596,
877,
259,
8653,
742,
9920,
29897,
13,
462,
1678,
9659,
353,
1881,
877,
10399,
320,
29915,
29896,
29900,
29900,
29995,
20333,
565,
6446,
1854,
29901,
25710,
13,
462,
1678,
565,
9659,
2804,
525,
29896,
29900,
29900,
29995,
2396,
13,
462,
4706,
6773,
13,
18884,
565,
6389,
29961,
29900,
1822,
27382,
2541,
14237,
29374,
13,
462,
1678,
396,
461,
13,
462,
1678,
6773,
13,
18884,
565,
6389,
29961,
29900,
1822,
27382,
2541,
877,
29930,
29374,
13,
462,
1678,
3240,
353,
5810,
29889,
4804,
29898,
19594,
29892,
1480,
3972,
29892,
9920,
29897,
13,
462,
1678,
9867,
29889,
11058,
29889,
7122,
580,
13,
462,
1678,
565,
338,
8758,
29898,
2267,
29892,
13927,
29889,
6821,
5402,
1125,
13,
462,
4706,
9867,
29889,
11058,
29889,
4906,
877,
24995,
287,
9867,
515,
1273,
29878,
304,
1273,
29878,
29915,
1273,
313,
19594,
29892,
3240,
876,
13,
462,
4706,
9867,
353,
3240,
13,
462,
1678,
6773,
13,
18884,
364,
353,
9867,
29889,
3389,
29918,
6519,
29898,
9006,
29897,
13,
18884,
565,
1480,
3972,
29901,
13,
462,
1678,
9867,
29889,
1188,
29918,
2914,
29898,
1188,
3972,
29892,
8025,
29922,
4381,
29879,
1839,
18609,
29918,
22331,
11287,
13,
18884,
396,
26141,
15837,
3461,
29892,
565,
17643,
5229,
13,
18884,
4418,
1973,
353,
6571,
13,
18884,
3315,
1080,
353,
5159,
13,
18884,
13285,
29918,
2230,
353,
29871,
29900,
29889,
29900,
13,
18884,
363,
413,
29892,
4982,
297,
364,
29889,
7076,
7295,
13,
462,
1678,
325,
353,
4982,
29889,
2914,
13,
462,
1678,
565,
4982,
29889,
5729,
9446,
29901,
13,
462,
4706,
565,
325,
29889,
2457,
29918,
401,
1275,
29871,
29900,
29901,
13,
462,
9651,
3315,
1080,
29889,
4397,
29898,
710,
29898,
29895,
876,
13,
462,
9651,
13285,
29918,
2230,
4619,
4982,
29889,
355,
29918,
2230,
448,
4982,
29889,
2962,
29918,
2230,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
4418,
1973,
29889,
842,
4381,
29898,
29894,
29889,
2457,
29918,
401,
29892,
5159,
467,
4397,
29898,
710,
29898,
29895,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
4418,
1973,
29889,
842,
4381,
29898,
8516,
29892,
5159,
467,
4397,
29898,
710,
29898,
29895,
876,
13,
18884,
565,
4418,
1973,
29901,
13,
462,
1678,
1596,
28909,
29876,
26289,
310,
736,
11561,
29901,
1495,
13,
462,
1678,
363,
413,
29892,
325,
297,
17288,
29900,
29892,
3315,
1080,
4638,
718,
1051,
29898,
14057,
1973,
29889,
7076,
580,
1125,
13,
462,
4706,
565,
7431,
29898,
29894,
29897,
1405,
29871,
29945,
29901,
13,
462,
9651,
1596,
29898,
29895,
29892,
11297,
29873,
29899,
313,
29995,
29881,
18982,
16029,
1273,
7431,
29898,
29894,
876,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
1596,
29898,
29895,
29892,
11297,
29873,
29899,
742,
12705,
29898,
29894,
876,
13,
18884,
565,
3315,
1080,
29901,
13,
462,
1678,
1596,
877,
29909,
19698,
13285,
931,
363,
1273,
29881,
18982,
29901,
1273,
5847,
29915,
1273,
313,
2435,
29898,
5729,
29873,
1080,
511,
313,
5729,
12757,
29918,
2230,
847,
7431,
29898,
5729,
29873,
1080,
13697,
13,
4706,
5174,
7670,
3377,
4074,
6685,
29901,
13,
9651,
1596,
877,
18069,
29899,
29907,
2645,
1899,
10223,
362,
448,
1899,
633,
18054,
29889,
1495,
13,
4706,
5174,
382,
9800,
2392,
408,
321,
29901,
13,
9651,
1596,
29898,
29872,
29897,
13,
9651,
2867,
13,
1678,
1596,
877,
16037,
6876,
292,
1495,
13,
1678,
9867,
29889,
5358,
29918,
11958,
1953,
580,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
29937,
7523,
1220,
29914,
1982,
5628,
1899,
13285,
13,
29937,
18601,
29879,
334,
26381,
29892,
6704,
1849,
313,
16652,
1964,
511,
322,
2224,
313,
1525,
29924,
2891,
29923,
29897,
13285,
13,
13,
13,
1990,
2971,
15269,
29918,
3891,
29918,
13789,
29898,
3318,
1125,
13,
1678,
14550,
2385,
14476,
363,
1303,
1220,
323,
2882,
1820,
13285,
12008,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9867,
29892,
5810,
1125,
13,
4706,
396,
20768,
2130,
304,
278,
9867,
1203,
304,
679,
28768,
3557,
2669,
13,
4706,
396,
363,
7592,
2224,
13285,
29892,
322,
278,
5810,
1899,
8600,
13,
4706,
396,
304,
1073,
825,
334,
26381,
526,
3625,
29889,
13,
4706,
1583,
29889,
19594,
353,
9867,
13,
4706,
1583,
29889,
8508,
353,
5810,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
4746,
29918,
1982,
5628,
353,
6702,
1982,
5628,
29915,
297,
1303,
1220,
17255,
1514,
1649,
29897,
13,
4706,
5174,
20948,
29901,
13,
9651,
396,
11451,
949,
1220,
313,
10499,
29897,
1303,
1220,
17255,
1514,
1649,
338,
6213,
313,
1333,
4256,
519,
29897,
13,
9651,
1583,
29889,
4746,
29918,
1982,
5628,
353,
7700,
13,
4706,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
353,
5159,
13,
4706,
1303,
1220,
29889,
842,
29918,
5729,
357,
580,
13,
4706,
1303,
1220,
29889,
842,
29918,
5729,
357,
29898,
1311,
29889,
8835,
29897,
13,
4706,
1303,
1220,
29889,
842,
29918,
5729,
357,
29918,
6144,
9893,
877,
320,
29873,
29905,
29876,
5515,
1495,
13,
4706,
565,
1583,
29889,
4746,
29918,
1982,
5628,
29901,
13,
9651,
1303,
1220,
29889,
5510,
29918,
392,
29918,
5355,
877,
5355,
6228,
29902,
364,
29880,
29918,
8835,
1495,
13,
4706,
1683,
29901,
13,
9651,
1303,
1220,
29889,
5510,
29918,
392,
29918,
5355,
877,
3891,
29901,
4866,
1495,
13,
13,
1678,
822,
4866,
29918,
8508,
29918,
6519,
29898,
1311,
29892,
3275,
29918,
262,
29892,
1426,
29892,
2106,
1125,
13,
4706,
565,
2106,
1275,
29871,
29900,
29901,
13,
9651,
396,
12936,
29884,
789,
22152,
1051,
310,
19995,
393,
1993,
13,
9651,
396,
2538,
300,
1051,
304,
4069,
313,
1859,
1575,
353,
5159,
723,
3407,
1887,
29892,
451,
28152,
1051,
29897,
13,
9651,
628,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
7503,
29962,
13,
9651,
363,
7348,
297,
1583,
29889,
8508,
29889,
26381,
29889,
8149,
7295,
13,
18884,
565,
7348,
29889,
27382,
2541,
29898,
280,
328,
29918,
262,
1125,
13,
462,
1678,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
16957,
718,
525,
25710,
13,
4706,
396,
3295,
1037,
29886,
6906,
411,
1303,
1220,
29914,
1982,
5628,
322,
11415,
310,
8236,
334,
13,
4706,
565,
1583,
29889,
4746,
29918,
1982,
5628,
29901,
13,
9651,
736,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29961,
3859,
29962,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29961,
3859,
3816,
29896,
17531,
13,
13,
1678,
822,
4866,
29918,
4258,
9246,
29898,
1311,
29892,
3275,
29918,
262,
29892,
1426,
29892,
2106,
1125,
13,
4706,
565,
2106,
1275,
29871,
29900,
29901,
13,
9651,
628,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
7503,
29962,
13,
9651,
363,
2224,
29918,
3972,
297,
2897,
29889,
21813,
1839,
10145,
13359,
5451,
29898,
359,
29889,
2084,
29889,
2084,
19570,
1125,
13,
18884,
1018,
29901,
13,
462,
1678,
363,
285,
297,
2897,
29889,
1761,
3972,
29898,
2084,
29918,
3972,
1125,
13,
462,
4706,
1018,
29901,
13,
462,
9651,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2084,
29918,
3972,
29892,
285,
22164,
13,
462,
18884,
6773,
13,
462,
9651,
380,
353,
2897,
29889,
6112,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2084,
29918,
3972,
29892,
285,
876,
13,
462,
9651,
565,
313,
303,
29889,
303,
29918,
8513,
669,
29871,
29900,
29877,
29896,
29896,
29896,
29897,
322,
285,
29889,
27382,
2541,
29898,
726,
1125,
13,
462,
18884,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
29888,
718,
525,
25710,
13,
462,
4706,
5174,
438,
29173,
29901,
13,
462,
9651,
6773,
13,
18884,
5174,
438,
29173,
29901,
13,
462,
1678,
6773,
13,
9651,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
8516,
29897,
13,
4706,
736,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29961,
3859,
29962,
13,
13,
1678,
822,
4866,
29918,
16674,
29918,
2084,
29898,
1311,
29892,
3275,
29918,
262,
29892,
1426,
29892,
2106,
1125,
13,
4706,
565,
2106,
1275,
29871,
29900,
29901,
13,
9651,
628,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
7503,
29962,
13,
9651,
363,
260,
297,
1583,
29889,
19594,
29889,
11958,
1953,
29889,
5975,
7295,
13,
18884,
565,
260,
29889,
275,
29918,
27218,
630,
7295,
13,
462,
1678,
2867,
13,
9651,
1683,
29901,
13,
18884,
1596,
877,
3782,
15585,
630,
12368,
1495,
13,
18884,
12020,
24875,
2392,
877,
8863,
15642,
12757,
443,
16515,
1495,
13,
9651,
269,
353,
260,
29889,
3150,
29918,
29879,
23102,
29918,
4645,
580,
13,
9651,
3847,
353,
2897,
29889,
2084,
29889,
25721,
29898,
280,
328,
29918,
262,
29897,
13,
9651,
7687,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
280,
328,
29918,
262,
29897,
13,
9651,
565,
451,
3847,
29901,
13,
18884,
3847,
353,
19283,
29915,
13,
9651,
363,
921,
297,
269,
29889,
1761,
3972,
29898,
3560,
1125,
13,
18884,
565,
921,
29889,
27382,
2541,
29898,
3846,
1125,
13,
462,
1678,
2989,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3560,
29892,
921,
29897,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
396,
2823,
565,
3646,
338,
263,
3884,
29892,
322,
9773,
8207,
29915,
565,
372,
338,
13,
462,
4706,
269,
29889,
305,
3972,
29898,
8159,
29918,
2084,
29897,
13,
462,
4706,
921,
4619,
8207,
29915,
13,
462,
4706,
2989,
29918,
2084,
4619,
8207,
29915,
13,
462,
1678,
5174,
8960,
29901,
13,
462,
4706,
1209,
13,
462,
1678,
565,
1583,
29889,
4746,
29918,
1982,
5628,
29901,
13,
462,
4706,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
8159,
29918,
2084,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
29916,
29897,
13,
9651,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
8516,
29897,
13,
4706,
736,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29961,
3859,
29962,
13,
13,
1678,
822,
4866,
29918,
2997,
29918,
2084,
29898,
1311,
29892,
3275,
29918,
262,
29892,
1426,
29892,
2106,
1125,
13,
4706,
565,
2106,
1275,
29871,
29900,
29901,
13,
9651,
628,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
7503,
29962,
13,
9651,
3847,
353,
2897,
29889,
2084,
29889,
25721,
29898,
280,
328,
29918,
262,
29897,
13,
9651,
7687,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
280,
328,
29918,
262,
29897,
13,
9651,
565,
451,
3847,
29901,
13,
18884,
3847,
353,
19283,
29915,
13,
9651,
363,
921,
297,
2897,
29889,
1761,
3972,
29898,
3560,
1125,
13,
18884,
565,
921,
29889,
27382,
2541,
29898,
3846,
1125,
13,
462,
1678,
2989,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3560,
29892,
921,
29897,
13,
462,
1678,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
8159,
29918,
2084,
1125,
13,
462,
4706,
396,
2823,
565,
3646,
338,
263,
3884,
29892,
322,
9773,
8207,
29915,
565,
372,
338,
13,
462,
4706,
921,
4619,
8207,
29915,
13,
462,
4706,
2989,
29918,
2084,
4619,
8207,
29915,
13,
462,
1678,
565,
1583,
29889,
4746,
29918,
1982,
5628,
29901,
13,
462,
4706,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
8159,
29918,
2084,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
29916,
29897,
13,
9651,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29889,
4397,
29898,
8516,
29897,
13,
4706,
736,
1583,
29889,
5729,
12757,
29918,
1859,
1575,
29961,
3859,
29962,
13,
13,
1678,
822,
4866,
29898,
1311,
29892,
1426,
29892,
2106,
1125,
13,
4706,
6835,
353,
1303,
1220,
29889,
657,
29918,
1220,
29918,
9040,
580,
13,
4706,
3275,
29918,
262,
353,
6835,
7503,
949,
1220,
29889,
657,
29918,
355,
13140,
580,
1822,
5451,
580,
14352,
29896,
29962,
13,
4706,
1018,
29901,
13,
9651,
565,
6835,
29889,
27382,
2541,
877,
29930,
1495,
322,
525,
525,
297,
6835,
29901,
13,
18884,
396,
2823,
565,
334,
6519,
756,
2888,
4434,
13285,
13,
18884,
5810,
29918,
6519,
353,
1583,
29889,
8508,
29889,
26381,
29889,
657,
29898,
9040,
29889,
5451,
580,
29961,
29900,
1402,
6213,
29897,
13,
18884,
565,
5810,
29918,
6519,
322,
5810,
29918,
6519,
29889,
3891,
29918,
5729,
12757,
29901,
13,
462,
1678,
736,
5810,
29918,
6519,
29889,
3891,
29918,
5729,
12757,
29898,
1311,
29892,
6835,
29892,
3275,
29918,
262,
29892,
1426,
29892,
2106,
29897,
13,
9651,
565,
3275,
29918,
262,
29889,
27382,
2541,
877,
29930,
29374,
13,
18884,
396,
4911,
4225,
1371,
1614,
1259,
334,
6519,
856,
13,
18884,
736,
1583,
29889,
8835,
29918,
8508,
29918,
6519,
29898,
280,
328,
29918,
262,
29892,
1426,
29892,
2106,
29897,
13,
9651,
1683,
29901,
13,
18884,
396,
13109,
6030,
448,
7592,
934,
2224,
13285,
13,
18884,
736,
1583,
29889,
8835,
29918,
16674,
29918,
2084,
29898,
280,
328,
29918,
262,
29892,
1426,
29892,
2106,
29897,
13,
4706,
5174,
8960,
29901,
13,
9651,
12020,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
29937,
5244,
11316,
363,
2045,
597,
3292,
29889,
510,
29914,
3665,
15269,
29914,
3665,
15269,
29914,
12175,
29914,
29941,
29906,
13,
29937,
2448,
556,
15143,
7523,
1220,
3489,
12020,
2089,
4589,
1217,
995,
393,
278,
5132,
13,
29937,
14476,
364,
1572,
4637,
408,
10663,
2392,
29889,
2045,
597,
6152,
29879,
29889,
4691,
29889,
990,
29914,
15118,
29896,
29900,
29941,
29945,
29900,
451,
13,
29937,
1641,
1250,
637,
287,
304,
5132,
29871,
29906,
29889,
29955,
29892,
577,
4386,
372,
411,
901,
775,
856,
13,
1753,
9109,
29918,
3539,
29918,
18434,
29918,
1445,
29898,
9507,
1125,
13,
1678,
396,
1763,
4772,
2089,
8178,
29892,
671,
1002,
580,
304,
1243,
278,
934,
21733,
3064,
13,
1678,
1018,
29901,
13,
4706,
1303,
1220,
29889,
3539,
29918,
18434,
29918,
1445,
29898,
9507,
29897,
13,
1678,
5174,
10663,
2392,
408,
321,
29901,
13,
4706,
396,
18076,
487,
445,
3682,
565,
591,
5456,
714,
278,
4955,
934,
10325,
13,
4706,
1018,
29901,
13,
9651,
1400,
353,
2897,
29889,
6112,
29898,
9507,
467,
303,
29918,
29885,
2230,
13,
9651,
565,
1400,
1405,
931,
29889,
2230,
580,
448,
29871,
29941,
29901,
13,
18884,
12183,
29889,
8382,
877,
17273,
8253,
11860,
29879,
29908,
5007,
4955,
934,
742,
851,
29898,
29872,
876,
13,
4706,
5174,
8960,
29901,
13,
9651,
12020,
321,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
1753,
2971,
15269,
29918,
15903,
29918,
3396,
7295,
13,
1678,
6389,
353,
10876,
29889,
19218,
29961,
29896,
17531,
13,
1678,
21274,
353,
2295,
29889,
1359,
29918,
11027,
580,
13,
1678,
396,
19152,
1899,
1196,
3987,
16949,
29892,
363,
24270,
297,
13927,
2917,
21274,
13,
1678,
9920,
1220,
29918,
6768,
353,
2295,
29889,
6519,
29918,
1220,
29918,
11027,
29898,
5085,
29892,
21274,
29889,
657,
877,
1792,
29889,
11027,
8785,
13,
1678,
21274,
29889,
5504,
29898,
9006,
1220,
29918,
6768,
29897,
13,
13,
1678,
565,
525,
11514,
29889,
15619,
29915,
297,
21274,
29901,
13,
4706,
9909,
29889,
842,
4381,
15619,
29898,
7411,
29898,
4381,
29879,
1839,
11514,
29889,
15619,
25901,
13,
13,
1678,
396,
3789,
786,
4522,
3460,
13,
1678,
1480,
4830,
353,
14210,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
5563,
978,
6817,
29947,
29879,
518,
29995,
29898,
978,
29897,
29879,
16664,
29898,
7097,
29897,
29900,
29947,
29990,
29962,
1273,
29898,
4906,
29897,
29879,
29915,
13,
1678,
1480,
3972,
353,
2897,
29889,
2084,
29889,
18837,
1792,
29898,
2230,
29889,
710,
615,
603,
29898,
4381,
29879,
29889,
657,
877,
1188,
3972,
742,
6629,
4961,
13,
1678,
565,
1480,
3972,
29901,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
1188,
3972,
1125,
13,
9651,
2897,
29889,
11256,
3972,
29898,
1188,
3972,
29897,
13,
4706,
12183,
29889,
16121,
3991,
29898,
9507,
29922,
359,
29889,
2084,
29889,
7122,
29898,
1188,
3972,
29892,
525,
3665,
15269,
29889,
1188,
5477,
13,
462,
9651,
3402,
29922,
1188,
4830,
29897,
13,
1678,
1683,
29901,
13,
4706,
12183,
29889,
16121,
3991,
29898,
4830,
29922,
1188,
4830,
29897,
13,
4706,
1209,
13,
1678,
1018,
29901,
13,
4706,
12183,
29889,
657,
16363,
2141,
842,
10108,
29898,
657,
5552,
29898,
21027,
29892,
21274,
1839,
1188,
5563,
13359,
21064,
22130,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
12020,
24875,
2392,
877,
9908,
1799,
29950,
4444,
376,
1188,
5563,
29908,
881,
367,
731,
304,
697,
310,
518,
11341,
1806,
2965,
1964,
29892,
11432,
29892,
29956,
25614,
29892,
11690,
29892,
18525,
29962,
2012,
310,
11860,
29879,
29908,
742,
21274,
1839,
1188,
5563,
11287,
13,
1678,
17927,
353,
12183,
29889,
657,
16363,
877,
3665,
15269,
1495,
13,
13,
1678,
396,
8561,
385,
13189,
3260,
304,
4386,
1404,
10760,
13,
1678,
263,
353,
13927,
29889,
6444,
3260,
29898,
4381,
29879,
1839,
6786,
7464,
13,
462,
4706,
4817,
29918,
1445,
29922,
359,
29889,
2084,
29889,
18837,
1792,
29898,
4381,
29879,
1839,
5150,
1445,
2033,
511,
13,
462,
4706,
1018,
29918,
5150,
29918,
9290,
7607,
4381,
29879,
1839,
2202,
29918,
5150,
29918,
9290,
2033,
1275,
525,
265,
8785,
13,
13,
1678,
396,
16012,
1858,
8385,
304,
16226,
297,
3495,
1106,
14340,
322,
788,
334,
26381,
11200,
13,
1678,
7500,
29918,
12800,
353,
6571,
13,
1678,
429,
29872,
29918,
3972,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
29898,
9675,
29889,
19218,
29961,
29900,
12622,
13,
1678,
1788,
29918,
8582,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8097,
29918,
3972,
29892,
525,
12800,
1495,
13,
1678,
11262,
29918,
12800,
353,
21274,
1839,
20472,
29918,
12800,
13359,
5451,
29317,
1495,
13,
1678,
7079,
29918,
3972,
29879,
353,
518,
29916,
363,
921,
297,
21274,
1839,
12800,
13359,
5451,
877,
29936,
1495,
565,
921,
29962,
13,
1678,
7079,
29918,
3972,
29879,
29889,
4397,
29898,
5205,
29918,
8582,
29918,
3972,
29897,
13,
13,
1678,
363,
921,
297,
7079,
29918,
3972,
29879,
29901,
13,
4706,
7079,
29918,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
18837,
1792,
29898,
29916,
876,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
8582,
29918,
3972,
1125,
13,
9651,
6773,
13,
4706,
363,
3883,
297,
12705,
29898,
359,
29889,
1761,
3972,
29898,
8582,
29918,
3972,
22164,
13,
9651,
565,
3883,
29889,
1975,
2541,
12839,
2272,
1495,
322,
451,
3883,
29889,
27382,
2541,
877,
1649,
29374,
13,
18884,
7079,
353,
3883,
7503,
29899,
29941,
29962,
13,
18884,
396,
4971,
666,
10585,
1476,
297,
901,
393,
29871,
29896,
4423,
29892,
322,
6743,
9479,
12708,
13,
18884,
565,
7079,
297,
7500,
29918,
12800,
470,
7079,
297,
11262,
29918,
12800,
29901,
13,
462,
1678,
6773,
13,
18884,
1018,
29901,
13,
462,
1678,
17927,
29889,
3888,
877,
23456,
7079,
3883,
29901,
1273,
29879,
742,
7079,
29897,
13,
462,
1678,
445,
29918,
8582,
353,
2971,
15269,
29889,
12800,
29889,
1359,
29918,
8582,
29898,
359,
29889,
2084,
29889,
7122,
29898,
8582,
29918,
3972,
29892,
3883,
876,
13,
462,
1678,
565,
756,
5552,
29898,
1366,
29918,
8582,
29892,
525,
11027,
29374,
13,
462,
4706,
10944,
353,
525,
8582,
29889,
29995,
29879,
6169,
1273,
7079,
13,
462,
4706,
1404,
29918,
11027,
353,
6571,
13,
462,
4706,
1404,
29918,
11027,
353,
9657,
4197,
29898,
29895,
29961,
2435,
29898,
13506,
1125,
1402,
325,
29897,
363,
413,
29892,
325,
297,
21274,
29889,
7076,
580,
565,
413,
29889,
27382,
2541,
29898,
13506,
29897,
2314,
13,
462,
4706,
17927,
29889,
3888,
877,
3373,
26747,
6055,
363,
7079,
1273,
29879,
411,
29901,
1273,
29879,
742,
7079,
29892,
1404,
29918,
11027,
29897,
13,
462,
4706,
445,
29918,
8582,
29889,
11027,
29889,
5504,
29898,
1792,
29918,
11027,
29897,
13,
462,
1678,
565,
756,
5552,
29898,
1366,
29918,
8582,
29892,
525,
2344,
29374,
13,
462,
4706,
17927,
29889,
8382,
877,
5594,
292,
2069,
1158,
363,
7079,
29901,
1273,
29879,
742,
7079,
29897,
13,
462,
4706,
445,
29918,
8582,
29889,
2344,
29898,
4381,
29879,
29922,
4381,
29879,
29892,
4817,
29922,
29874,
29892,
18224,
29922,
15638,
29918,
12800,
29892,
5810,
29918,
26381,
29922,
8508,
29889,
26381,
29892,
6473,
29922,
15903,
29897,
13,
462,
1678,
565,
756,
5552,
29898,
1366,
29918,
8582,
29892,
525,
8508,
29918,
26381,
29374,
13,
462,
4706,
17927,
29889,
8382,
877,
15213,
292,
334,
26381,
363,
7079,
29901,
1273,
29879,
1273,
29879,
742,
7079,
29892,
445,
29918,
8582,
29889,
8508,
29918,
26381,
29889,
8149,
3101,
13,
462,
4706,
5810,
29889,
26381,
29889,
5504,
29898,
1366,
29918,
8582,
29889,
8508,
29918,
26381,
29897,
13,
462,
1678,
565,
756,
5552,
29898,
1366,
29918,
8582,
29892,
525,
6519,
29918,
25894,
29374,
13,
462,
4706,
1899,
29918,
20631,
414,
29889,
4397,
29898,
1366,
29918,
8582,
29889,
6519,
29918,
25894,
29897,
13,
462,
1678,
7500,
29918,
12800,
29961,
8582,
29962,
353,
445,
29918,
8582,
13,
13,
18884,
5174,
8960,
408,
321,
29901,
13,
462,
1678,
17927,
29889,
2704,
877,
17776,
304,
2254,
7079,
313,
29995,
29879,
1125,
1273,
29879,
742,
7079,
29892,
2062,
29898,
29872,
876,
13,
13,
1678,
396,
4803,
1899,
1196,
6389,
408,
4511,
1051,
29892,
470,
2367,
1404,
2984,
304,
11421,
1051,
1286,
13,
1678,
565,
451,
6389,
29901,
13,
4706,
1596,
877,
3782,
1899,
1196,
6273,
2183,
29889,
1495,
13,
4706,
1596,
877,
3492,
508,
4511,
304,
263,
1353,
310,
18982,
491,
3495,
978,
470,
5641,
1495,
13,
4706,
565,
7500,
29918,
12800,
29901,
13,
9651,
1596,
877,
3492,
508,
884,
2367,
5829,
293,
2983,
393,
508,
367,
20512,
491,
1495,
13,
9651,
1596,
877,
1552,
1494,
7500,
18224,
29901,
1495,
13,
9651,
363,
3883,
29892,
7079,
297,
7500,
29918,
12800,
29889,
7076,
7295,
13,
18884,
1018,
29901,
13,
462,
1678,
16280,
29918,
1514,
353,
7079,
29889,
20401,
17255,
1514,
1649,
13,
462,
1678,
1596,
29898,
5453,
29892,
7079,
17255,
1514,
1649,
29897,
13,
462,
1678,
1596,
28909,
29873,
29995,
29879,
29915,
1273,
16280,
29918,
1514,
29897,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
7079,
29889,
29890,
7310,
580,
13,
462,
1678,
5174,
23833,
2392,
29901,
13,
462,
4706,
1209,
13,
18884,
5174,
23833,
2392,
29901,
13,
462,
1678,
1209,
13,
4706,
4511,
29918,
1761,
353,
1881,
877,
10399,
263,
1051,
310,
3957,
15422,
800,
29901,
525,
467,
5451,
580,
13,
1678,
1683,
29901,
13,
4706,
4511,
29918,
1761,
353,
6389,
13,
13,
1678,
565,
451,
4511,
29918,
1761,
29901,
13,
4706,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
1678,
396,
1938,
278,
12368,
565,
4312,
29892,
5957,
2983,
304,
7079,
16280,
580,
3168,
13,
1678,
18982,
353,
5159,
13,
1678,
363,
1852,
297,
4511,
29918,
1761,
29901,
13,
4706,
363,
16876,
29892,
3770,
369,
297,
7500,
29918,
12800,
29889,
7076,
7295,
13,
9651,
565,
756,
5552,
29898,
9778,
369,
29892,
525,
20401,
29374,
13,
18884,
1018,
29901,
13,
462,
1678,
9867,
353,
3770,
369,
29889,
20401,
29898,
1191,
29897,
13,
462,
1678,
565,
9867,
29901,
13,
462,
4706,
17927,
29889,
8382,
877,
29995,
29879,
17832,
491,
1273,
29879,
742,
1852,
29892,
16876,
29897,
13,
462,
4706,
363,
3858,
29892,
3495,
29892,
11009,
297,
9867,
29901,
13,
462,
9651,
565,
11009,
29901,
13,
462,
18884,
18982,
29889,
4397,
3552,
1643,
29892,
11009,
876,
13,
462,
9651,
1683,
29901,
13,
462,
18884,
18982,
29889,
4397,
3552,
1643,
29892,
3495,
876,
13,
462,
4706,
2867,
13,
18884,
5174,
8960,
408,
321,
29901,
13,
462,
1678,
17927,
29889,
2704,
877,
2451,
3063,
701,
1273,
29879,
3025,
1273,
29879,
29901,
1273,
29878,
742,
1852,
29892,
16876,
29892,
321,
29897,
13,
462,
1678,
9867,
353,
6213,
13,
4706,
1683,
29901,
13,
9651,
18982,
29889,
4397,
3552,
1191,
29892,
6213,
876,
13,
13,
1678,
396,
838,
3242,
2309,
411,
599,
278,
758,
2576,
3821,
6230,
6576,
856,
13,
1678,
565,
21274,
1839,
1188,
5563,
2033,
451,
297,
6702,
11341,
1806,
2965,
1964,
742,
525,
11432,
29374,
13,
4706,
1596,
877,
17435,
1459,
6553,
1383,
514,
18610,
1495,
13,
4706,
1596,
877,
15156,
13189,
3260,
29901,
742,
263,
29897,
13,
4706,
1596,
877,
3403,
3460,
304,
1273,
29879,
29915,
1273,
1480,
3972,
29897,
13,
4706,
282,
2158,
29889,
407,
29878,
524,
29898,
4381,
29879,
29892,
29536,
29922,
29946,
29897,
13,
4706,
1596,
580,
13,
4706,
5810,
29889,
8508,
29918,
8477,
580,
13,
13,
1678,
396,
6204,
263,
4957,
1799,
29950,
20008,
2777,
363,
4315,
1962,
13,
1678,
4982,
29918,
9040,
353,
938,
29898,
4381,
29879,
1839,
303,
4212,
29918,
9057,
29918,
9040,
11287,
13,
1678,
2991,
29918,
978,
353,
21274,
1839,
15903,
29889,
11058,
2033,
13,
1678,
2991,
353,
6213,
13,
1678,
565,
525,
6169,
297,
2991,
29918,
978,
29901,
13,
4706,
396,
3967,
9138,
883,
2620,
408,
3883,
29889,
2220,
515,
7500,
18224,
13,
4706,
17927,
29889,
3888,
877,
4165,
3456,
292,
304,
2254,
2888,
2991,
883,
2620,
29901,
1273,
29879,
742,
2991,
29918,
978,
29897,
13,
4706,
3883,
29918,
978,
29892,
740,
29918,
978,
353,
2991,
29918,
978,
29889,
5451,
12839,
742,
29871,
29896,
29897,
13,
4706,
1018,
29901,
13,
9651,
2888,
29918,
689,
2620,
353,
679,
5552,
29898,
15638,
29918,
12800,
29961,
5453,
29918,
978,
1402,
740,
29918,
978,
29897,
13,
9651,
2991,
353,
4957,
1799,
29950,
20008,
29898,
689,
2620,
29922,
6341,
29918,
689,
2620,
29892,
11551,
29918,
276,
1760,
29922,
9057,
29918,
9040,
29897,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
17927,
29889,
2704,
877,
16288,
451,
7500,
363,
6473,
29889,
11058,
883,
2620,
1273,
29879,
742,
2991,
29918,
978,
29897,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
17927,
29889,
2704,
877,
16288,
883,
2620,
451,
1476,
363,
6473,
29889,
11058,
883,
2620,
1273,
29879,
742,
2991,
29918,
978,
29897,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
17927,
29889,
2704,
877,
2451,
373,
2991,
883,
2620,
1273,
29879,
29901,
1273,
29878,
742,
2991,
29918,
978,
29892,
321,
29897,
13,
1678,
396,
14053,
1627,
304,
263,
3918,
2991,
565,
7079,
4944,
697,
1258,
451,
2254,
13,
1678,
565,
2991,
338,
6213,
29901,
13,
4706,
565,
451,
10876,
29889,
25393,
29889,
24766,
1017,
580,
470,
2991,
29918,
978,
1275,
525,
3712,
2878,
4871,
2396,
13,
9651,
2991,
353,
4957,
1799,
29950,
20008,
29898,
689,
2620,
29922,
3712,
2878,
4871,
29892,
11551,
29918,
276,
1760,
29922,
9057,
29918,
9040,
29897,
13,
4706,
1683,
29901,
13,
9651,
2991,
353,
4957,
1799,
29950,
20008,
29898,
2267,
475,
29918,
276,
1760,
29922,
9057,
29918,
9040,
29897,
13,
13,
1678,
396,
9788,
29892,
591,
526,
2221,
304,
1653,
278,
2233,
5402,
13,
1678,
1596,
877,
17918,
292,
304,
1273,
29881,
18982,
856,
29915,
1273,
7431,
29898,
23525,
876,
13,
1678,
9867,
353,
13927,
29889,
6821,
5402,
29898,
23525,
29892,
4817,
29922,
29874,
29892,
2991,
29922,
11058,
29892,
21274,
29922,
4381,
29879,
29897,
13,
13,
1678,
7960,
29892,
12708,
29892,
5229,
29918,
5150,
29892,
5229,
29918,
6915,
29892,
13700,
353,
9867,
29889,
9965,
29918,
7727,
580,
13,
1678,
565,
21274,
1839,
1188,
5563,
2033,
451,
297,
6702,
11341,
1806,
2965,
1964,
742,
525,
11432,
29374,
13,
4706,
5810,
29889,
8508,
29918,
3888,
29898,
19594,
29892,
1480,
3972,
29892,
15516,
518,
2314,
13,
1678,
1683,
29901,
13,
4706,
396,
960,
9867,
338,
451,
29871,
29896,
29900,
29900,
29995,
6631,
29892,
1235,
1404,
1073,
1584,
565,
1480,
5563,
338,
451,
4482,
3307,
13,
4706,
565,
738,
3552,
26061,
29918,
5150,
29892,
5229,
29918,
6915,
29892,
13700,
22164,
13,
9651,
1596,
877,
8439,
892,
4828,
16791,
304,
777,
7573,
29901,
1495,
13,
9651,
565,
5229,
29918,
6915,
29901,
13,
18884,
1596,
877,
1678,
1273,
29881,
7573,
5229,
304,
4511,
29915,
1273,
5229,
29918,
6915,
29897,
13,
9651,
565,
5229,
29918,
5150,
29901,
13,
18884,
1596,
877,
1678,
1273,
29881,
7573,
5229,
10760,
29915,
1273,
5229,
29918,
5150,
29897,
13,
9651,
565,
13700,
29901,
13,
18884,
1596,
877,
1678,
1273,
29881,
13700,
12368,
29915,
1273,
13700,
29897,
13,
9651,
1596,
877,
1678,
4803,
26345,
3888,
29908,
363,
3957,
4902,
29889,
1495,
13,
13,
1678,
565,
7960,
1275,
29871,
29896,
322,
12708,
718,
5229,
29918,
5150,
718,
5229,
29918,
6915,
718,
13700,
1275,
29871,
29900,
29901,
13,
4706,
396,
2233,
5402,
2159,
310,
697,
448,
1423,
565,
4469,
29918,
4349,
338,
731,
13,
4706,
565,
21274,
1839,
6921,
29918,
4349,
2033,
1275,
525,
265,
29915,
322,
525,
8508,
29918,
4349,
29915,
297,
7500,
29918,
12800,
29901,
13,
9651,
1596,
877,
12300,
29899,
11569,
17223,
334,
4349,
363,
263,
9867,
2159,
310,
29871,
29896,
1495,
13,
9651,
7500,
29918,
12800,
1839,
8508,
29918,
4349,
13359,
11027,
1839,
14032,
415,
29918,
18829,
2033,
353,
376,
29900,
29889,
29900,
29908,
13,
9651,
5810,
29889,
4804,
29898,
19594,
29892,
1480,
3972,
29892,
525,
29930,
4349,
1495,
13,
9651,
396,
9867,
29889,
11058,
29889,
7122,
580,
13,
9651,
9867,
29889,
5358,
29918,
11958,
1953,
580,
13,
9651,
12020,
2184,
24365,
703,
7317,
4866,
1159,
13,
13,
1678,
396,
10516,
1196,
4955,
2304,
13,
1678,
565,
21274,
29889,
657,
877,
18434,
1445,
29374,
13,
4706,
9825,
1445,
353,
2897,
29889,
2084,
29889,
18837,
1792,
29898,
4381,
29879,
1839,
18434,
1445,
11287,
13,
4706,
1018,
29901,
13,
9651,
1303,
1220,
29889,
949,
29918,
18434,
29918,
1445,
29898,
29882,
391,
1445,
29897,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
1209,
13,
4706,
1303,
1220,
29889,
842,
29918,
18434,
29918,
2848,
29898,
524,
29898,
359,
29889,
21813,
29889,
657,
877,
29950,
9047,
14226,
742,
29871,
29896,
29900,
29900,
29900,
4961,
13,
4706,
565,
10876,
29889,
3259,
29918,
3888,
29889,
21355,
1275,
29871,
29906,
29901,
13,
9651,
396,
5244,
11316,
396,
29941,
29906,
448,
2329,
451,
1250,
637,
287,
304,
5132,
29871,
29906,
29889,
29990,
13,
9651,
263,
4776,
277,
29889,
9573,
29898,
11177,
29918,
3539,
29918,
18434,
29918,
1445,
29892,
9825,
1445,
29897,
13,
4706,
1683,
29901,
13,
9651,
263,
4776,
277,
29889,
9573,
29898,
949,
1220,
29889,
3539,
29918,
18434,
29918,
1445,
29892,
9825,
1445,
29897,
13,
13,
1678,
396,
3462,
323,
2882,
13285,
363,
334,
26381,
322,
7592,
934,
10898,
13,
1678,
4434,
29918,
5729,
12757,
353,
2971,
15269,
29918,
3891,
29918,
13789,
29898,
19594,
29892,
5810,
29897,
13,
13,
1678,
396,
2973,
278,
9867,
1203,
29892,
1369,
28923,
4867,
13,
1678,
6473,
29898,
19594,
29922,
19594,
29892,
1480,
3972,
29922,
1188,
3972,
29892,
21274,
29922,
4381,
29879,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
2971,
15269,
29918,
15903,
29918,
3396,
580,
13,
2
] |
toontown/hood/GenericAnimatedBuilding.py | TheFamiliarScoot/open-toontown | 99 | 196320 | <reponame>TheFamiliarScoot/open-toontown<gh_stars>10-100
from toontown.hood import GenericAnimatedProp
class GenericAnimatedBuilding(GenericAnimatedProp.GenericAnimatedProp):
def __init__(self, node):
GenericAnimatedProp.GenericAnimatedProp.__init__(self, node)
def enter(self):
if base.config.GetBool('buildings-animate', False):
GenericAnimatedProp.GenericAnimatedProp.enter(self)
| [
1,
529,
276,
1112,
420,
29958,
1576,
22555,
4447,
29903,
1111,
327,
29914,
3150,
29899,
517,
609,
776,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
3166,
304,
609,
776,
29889,
6614,
1053,
3251,
293,
21645,
630,
20420,
13,
13,
1990,
3251,
293,
21645,
630,
8893,
292,
29898,
15809,
21645,
630,
20420,
29889,
15809,
21645,
630,
20420,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2943,
1125,
13,
4706,
3251,
293,
21645,
630,
20420,
29889,
15809,
21645,
630,
20420,
17255,
2344,
12035,
1311,
29892,
2943,
29897,
13,
13,
1678,
822,
3896,
29898,
1311,
1125,
13,
4706,
565,
2967,
29889,
2917,
29889,
2577,
24693,
877,
4282,
886,
29899,
20131,
742,
7700,
1125,
13,
9651,
3251,
293,
21645,
630,
20420,
29889,
15809,
21645,
630,
20420,
29889,
5893,
29898,
1311,
29897,
13,
2
] |
Plots/Bar/NCL_bar_2.py | learn2free/GeoCAT-examples | 1 | 22387 | """
NCL_bar_2.py
===============
This script illustrates the following concepts:
- Drawing bars instead of curves in an XY plot
- Changing the aspect ratio of a bar plot
- Drawing filled bars up or down based on a Y reference value
- Setting the minimum/maximum value of the Y axis in a bar plot
- Using named colors to indicate a fill color
- Creating array of dates to use as x-axis tick labels
- Creating a main title
See following URLs to see the reproduced NCL plot & script:
- Original NCL script: https://www.ncl.ucar.edu/Applications/Scripts/bar_2.ncl
- Original NCL plot: https://www.ncl.ucar.edu/Applications/Images/bar_2_lg.png
"""
import geocat.datafiles as gdf
import matplotlib.pyplot as plt
###############################################################################
# Import packages:
import numpy as np
import xarray as xr
from geocat.viz import util as gvutil
###############################################################################
# Read in data:
# Open a netCDF data file using xarray default engine and load the data into xarrays
ds = xr.open_dataset(gdf.get("netcdf_files/soi.nc"))
dsoik = ds.DSOI_KET
date = ds.date
num_months = np.shape(date)[0]
# Dates in the file are represented by year and month (YYYYMM)
# representing them fractionally will make ploting the data easier
# This produces the same results as NCL's yyyymm_to_yyyyfrac() function
date_frac = np.empty_like(date)
for n in np.arange(0, num_months, 1):
yyyy = int(date[n] / 100)
mon = (date[n] / 100 - yyyy) * 100
date_frac[n] = yyyy + (mon - 1) / 12
###############################################################################
# Plot
# Generate figure (set its size (width, height) in inches) and axes
plt.figure(figsize=(12, 6))
ax = plt.axes()
# Create a list of colors based on the color bar values
colors = ['red' if (value > 0) else 'blue' for value in dsoik[::8]]
plt.bar(date_frac[::8],
dsoik[::8],
align='edge',
edgecolor='black',
color=colors,
width=8 / 12,
linewidth=.6)
# Use geocat.viz.util convenience function to add minor and major tick lines
gvutil.add_major_minor_ticks(ax,
x_minor_per_major=4,
y_minor_per_major=5,
labelsize=20)
# Use geocat.viz.util convenience function to set axes parameters
gvutil.set_axes_limits_and_ticks(ax,
ylim=(-3, 3),
yticks=np.linspace(-3, 3, 7),
yticklabels=np.linspace(-3, 3, 7),
xlim=(date_frac[40], date_frac[-16]),
xticks=np.linspace(1900, 1980, 5))
# Use geocat.viz.util convenience function to set titles and labels
gvutil.set_titles_and_labels(ax,
maintitle="Darwin Southern Oscillation Index",
ylabel='Anomalies',
maintitlefontsize=28,
labelfontsize=20)
plt.show()
| [
1,
9995,
13,
29940,
6154,
29918,
1646,
29918,
29906,
29889,
2272,
13,
4936,
2751,
25512,
13,
4013,
2471,
8632,
1078,
278,
1494,
22001,
29901,
13,
259,
448,
18492,
292,
22306,
2012,
310,
19684,
297,
385,
1060,
29979,
6492,
13,
259,
448,
678,
9776,
278,
9565,
11959,
310,
263,
2594,
6492,
13,
259,
448,
18492,
292,
10423,
22306,
701,
470,
1623,
2729,
373,
263,
612,
3407,
995,
13,
259,
448,
21605,
278,
9212,
29914,
27525,
398,
995,
310,
278,
612,
9685,
297,
263,
2594,
6492,
13,
259,
448,
5293,
4257,
11955,
304,
12266,
263,
5445,
2927,
13,
259,
448,
26221,
1409,
310,
10116,
304,
671,
408,
921,
29899,
8990,
16892,
11073,
13,
259,
448,
26221,
263,
1667,
3611,
13,
13,
13393,
1494,
24295,
304,
1074,
278,
9483,
1133,
405,
6154,
6492,
669,
2471,
29901,
13,
1678,
448,
8533,
405,
6154,
2471,
29901,
2045,
597,
1636,
29889,
29876,
695,
29889,
1682,
279,
29889,
6085,
29914,
2052,
5795,
29914,
4081,
29879,
29914,
1646,
29918,
29906,
29889,
29876,
695,
13,
1678,
448,
8533,
405,
6154,
6492,
29901,
2045,
597,
1636,
29889,
29876,
695,
29889,
1682,
279,
29889,
6085,
29914,
2052,
5795,
29914,
20163,
29914,
1646,
29918,
29906,
29918,
19920,
29889,
2732,
13,
15945,
29908,
13,
13,
5215,
1737,
542,
271,
29889,
1272,
5325,
408,
330,
2176,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
29937,
16032,
9741,
29901,
13,
5215,
12655,
408,
7442,
13,
5215,
921,
2378,
408,
921,
29878,
13,
3166,
1737,
542,
271,
29889,
29894,
466,
1053,
3667,
408,
330,
29894,
4422,
13,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
29937,
7523,
297,
848,
29901,
13,
13,
29937,
4673,
263,
7787,
29907,
4037,
848,
934,
773,
921,
2378,
2322,
6012,
322,
2254,
278,
848,
964,
921,
2378,
29879,
13,
6289,
353,
921,
29878,
29889,
3150,
29918,
24713,
29898,
29887,
2176,
29889,
657,
703,
1212,
29883,
2176,
29918,
5325,
29914,
578,
29875,
29889,
17608,
5783,
13,
29881,
578,
638,
353,
18031,
29889,
29928,
6156,
29902,
29918,
29968,
2544,
13,
1256,
353,
18031,
29889,
1256,
13,
1949,
29918,
10874,
29879,
353,
7442,
29889,
12181,
29898,
1256,
9601,
29900,
29962,
13,
13,
29937,
360,
1078,
297,
278,
934,
526,
9875,
491,
1629,
322,
4098,
313,
14995,
14995,
7428,
29897,
13,
29937,
15783,
963,
15958,
635,
674,
1207,
6492,
292,
278,
848,
6775,
13,
29937,
910,
13880,
278,
1021,
2582,
408,
405,
6154,
29915,
29879,
343,
8071,
962,
29885,
29918,
517,
29918,
18855,
1154,
580,
740,
13,
1256,
29918,
1154,
353,
7442,
29889,
6310,
29918,
4561,
29898,
1256,
29897,
13,
1454,
302,
297,
7442,
29889,
279,
927,
29898,
29900,
29892,
954,
29918,
10874,
29879,
29892,
29871,
29896,
1125,
13,
1678,
343,
8071,
29891,
353,
938,
29898,
1256,
29961,
29876,
29962,
847,
29871,
29896,
29900,
29900,
29897,
13,
1678,
1601,
353,
313,
1256,
29961,
29876,
29962,
847,
29871,
29896,
29900,
29900,
448,
343,
8071,
29891,
29897,
334,
29871,
29896,
29900,
29900,
13,
1678,
2635,
29918,
1154,
29961,
29876,
29962,
353,
343,
8071,
29891,
718,
313,
3712,
448,
29871,
29896,
29897,
847,
29871,
29896,
29906,
13,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
29937,
18399,
13,
13,
29937,
3251,
403,
4377,
313,
842,
967,
2159,
313,
2103,
29892,
3171,
29897,
297,
22831,
29897,
322,
27815,
13,
572,
29873,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29906,
29892,
29871,
29953,
876,
13,
1165,
353,
14770,
29889,
1165,
267,
580,
13,
13,
29937,
6204,
263,
1051,
310,
11955,
2729,
373,
278,
2927,
2594,
1819,
13,
27703,
353,
6024,
1127,
29915,
565,
313,
1767,
1405,
29871,
29900,
29897,
1683,
525,
9539,
29915,
363,
995,
297,
270,
578,
638,
29961,
1057,
29947,
5262,
13,
572,
29873,
29889,
1646,
29898,
1256,
29918,
1154,
29961,
1057,
29947,
1402,
13,
4706,
270,
578,
638,
29961,
1057,
29947,
1402,
13,
4706,
7595,
2433,
12864,
742,
13,
4706,
7636,
2780,
2433,
8517,
742,
13,
4706,
2927,
29922,
27703,
29892,
13,
4706,
2920,
29922,
29947,
847,
29871,
29896,
29906,
29892,
13,
4706,
1196,
2103,
21098,
29953,
29897,
13,
13,
29937,
4803,
1737,
542,
271,
29889,
29894,
466,
29889,
4422,
29703,
740,
304,
788,
9461,
322,
4655,
16892,
3454,
13,
29887,
29894,
4422,
29889,
1202,
29918,
21355,
29918,
1195,
272,
29918,
29873,
7358,
29898,
1165,
29892,
13,
462,
632,
921,
29918,
1195,
272,
29918,
546,
29918,
21355,
29922,
29946,
29892,
13,
462,
632,
343,
29918,
1195,
272,
29918,
546,
29918,
21355,
29922,
29945,
29892,
13,
462,
632,
3858,
2311,
29922,
29906,
29900,
29897,
13,
13,
29937,
4803,
1737,
542,
271,
29889,
29894,
466,
29889,
4422,
29703,
740,
304,
731,
27815,
4128,
13,
29887,
29894,
4422,
29889,
842,
29918,
1165,
267,
29918,
12514,
29918,
392,
29918,
29873,
7358,
29898,
1165,
29892,
13,
462,
462,
343,
2576,
29922,
6278,
29941,
29892,
29871,
29941,
511,
13,
462,
462,
343,
29873,
7358,
29922,
9302,
29889,
1915,
3493,
6278,
29941,
29892,
29871,
29941,
29892,
29871,
29955,
511,
13,
462,
462,
343,
24667,
21134,
29922,
9302,
29889,
1915,
3493,
6278,
29941,
29892,
29871,
29941,
29892,
29871,
29955,
511,
13,
462,
462,
921,
2576,
7607,
1256,
29918,
1154,
29961,
29946,
29900,
1402,
2635,
29918,
1154,
14352,
29896,
29953,
11724,
13,
462,
462,
29871,
486,
7358,
29922,
9302,
29889,
1915,
3493,
29898,
29896,
29929,
29900,
29900,
29892,
29871,
29896,
29929,
29947,
29900,
29892,
29871,
29945,
876,
13,
13,
29937,
4803,
1737,
542,
271,
29889,
29894,
466,
29889,
4422,
29703,
740,
304,
731,
17735,
322,
11073,
13,
29887,
29894,
4422,
29889,
842,
29918,
23545,
793,
29918,
392,
29918,
21134,
29898,
1165,
29892,
13,
462,
632,
1667,
3257,
543,
29928,
279,
5080,
14234,
438,
1557,
453,
362,
11374,
613,
13,
462,
632,
343,
1643,
2433,
2744,
290,
284,
583,
742,
13,
462,
632,
1667,
3257,
5657,
2311,
29922,
29906,
29947,
29892,
13,
462,
632,
9775,
761,
609,
2311,
29922,
29906,
29900,
29897,
13,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
scheduler/views.py | saketbairoliya2/salescheduler | 0 | 46239 | from django.contrib.auth import login, authenticate
from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_GET, require_POST
from .forms import AppointmentSlotsForm, DemoScheduleForm, CalendarAttachForm
from .models import DemoAppointment
from oauth2client.contrib import xsrfutil
import httplib2
from oauth2client.client import OAuth2WebServerFlow
from googleapiclient.discovery import build
from django.conf import settings
import datetime
FLOW=OAuth2WebServerFlow(
client_id=settings.G_CLIENT_ID,
client_secret=settings.G_CLIENT_SECRET,
scope=['https://www.googleapis.com/auth/calendar'],
redirect_uri=settings.G_REDIRECT_URI
)
@login_required
def index(request):
if request.method == 'POST':
form = AppointmentSlotsForm(request.POST)
if form.is_valid():
form.save(request.user)
return render(request, 'scheduler/slot_booked.html')
else:
form = AppointmentSlotsForm()
calendar_attached = False
if request.user.caleder.first() != None:
calendar_attached = True
return render(request, 'scheduler/landing.html',
{'form':form, 'attach_calender':calendar_attached})
def signup(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
raw_password = form.cleaned_data.get('password1')
user = authenticate(username=username, password=<PASSWORD>)
login(request, user)
return redirect('scheduler:index')
else:
form = UserCreationForm()
return render(request, 'registration/signup.html', {'form': form})
def available_slots(request, year=None, month=None, day=None):
if year == None or month == None or day == None:
return render(request, 'scheduler/schedule_demo.html')
if request.method == 'GET':
form = DemoScheduleForm(year=int(year),month=int(month), day=int(day))
return render(request, 'scheduler/schedule_demo.html', {'form':form})
if request.method == 'POST':
form = DemoScheduleForm(request.POST, year=int(year),month=int(month), day=int(day))
if form.is_valid():
form.save()
appointments = DemoAppointment.objects.all()
return render(request, 'scheduler/request_calls.html', {'appointments':appointments})
return render(request, 'scheduler/schedule_demo.html')
def google_calender_permission(request):
FLOW.params['state'] = xsrfutil.generate_token(settings.SECRET_KEY,
request.user)
FLOW.params['access_type'] = 'offline'
authorize_url = FLOW.step1_get_authorize_url()
return HttpResponseRedirect(authorize_url)
def google_auth_return(request):
if not xsrfutil.validate_token(settings.SECRET_KEY, request.GET.get('state').encode("utf-8"),request.user):
return HttpResponseBadRequest()
credential = FLOW.step2_exchange(request.GET)
#print(credential.to_json())
http = httplib2.Http()
http = credential.authorize(http)
service = build("calendar", "v3", http=http)
calendar_data = service.calendarList().list().execute()
for calendar in calendar_data['items']:
if 'primary' in calendar and calendar['primary'] == True:
form = CalendarAttachForm({'calender_id':calendar['id'], 'refresh_token':credential.refresh_token})
print('here')
if form.is_valid():
print('here')
form.save(request.user)
print(form.errors)
return redirect('scheduler:index')
return redirect('scheduler:index')
| [
1,
515,
9557,
29889,
21570,
29889,
5150,
1053,
6464,
29892,
15585,
403,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9514,
1053,
4911,
9832,
362,
2500,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29892,
6684,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
29892,
9056,
5103,
24735,
29892,
9056,
5103,
22050,
3089,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
13,
3166,
9557,
29889,
7406,
29889,
19557,
4097,
29889,
1124,
1053,
1996,
29918,
7194,
29892,
1996,
29918,
5438,
13,
3166,
869,
9514,
1053,
2401,
2461,
358,
16973,
1862,
2500,
29892,
27819,
4504,
11272,
2500,
29892,
26431,
4165,
496,
2500,
13,
3166,
869,
9794,
1053,
27819,
2052,
2461,
358,
13,
3166,
288,
5150,
29906,
4645,
29889,
21570,
1053,
14492,
9600,
4422,
13,
5215,
1732,
1982,
29906,
13,
3166,
288,
5150,
29906,
4645,
29889,
4645,
1053,
438,
6444,
29906,
3609,
6004,
17907,
13,
3166,
5386,
481,
293,
1593,
29889,
2218,
11911,
29891,
1053,
2048,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
5215,
12865,
13,
13,
13,
29943,
27998,
29922,
29949,
6444,
29906,
3609,
6004,
17907,
29898,
13,
12,
12,
4645,
29918,
333,
29922,
11027,
29889,
29954,
29918,
27205,
3919,
29918,
1367,
29892,
13,
12,
12,
4645,
29918,
19024,
29922,
11027,
29889,
29954,
29918,
27205,
3919,
29918,
1660,
22245,
29911,
29892,
13,
12,
12,
6078,
29922,
1839,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
23392,
7464,
13,
12,
12,
17886,
29918,
5338,
29922,
11027,
29889,
29954,
29918,
1525,
4571,
26282,
29918,
15551,
13,
12,
12,
29897,
13,
13,
29992,
7507,
29918,
12403,
13,
1753,
2380,
29898,
3827,
1125,
13,
12,
361,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
12,
1678,
883,
353,
2401,
2461,
358,
16973,
1862,
2500,
29898,
3827,
29889,
5438,
29897,
13,
12,
1678,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
12,
4706,
883,
29889,
7620,
29898,
3827,
29889,
1792,
29897,
13,
12,
4706,
736,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
2536,
327,
29918,
2909,
287,
29889,
1420,
1495,
13,
12,
2870,
29901,
13,
12,
12,
689,
353,
2401,
2461,
358,
16973,
1862,
2500,
580,
13,
12,
23392,
29918,
1131,
3791,
353,
7700,
13,
12,
361,
2009,
29889,
1792,
29889,
29883,
744,
672,
29889,
4102,
580,
2804,
6213,
29901,
13,
12,
12,
23392,
29918,
1131,
3791,
353,
5852,
13,
12,
2457,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
1049,
292,
29889,
1420,
742,
13,
12,
12,
12,
12,
29871,
11117,
689,
2396,
689,
29892,
525,
14930,
29918,
1052,
1581,
2396,
23392,
29918,
1131,
3791,
1800,
13,
13,
1753,
1804,
786,
29898,
3827,
1125,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
883,
353,
4911,
9832,
362,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
883,
29889,
7620,
580,
13,
9651,
8952,
353,
883,
29889,
14941,
287,
29918,
1272,
29889,
657,
877,
6786,
1495,
13,
9651,
10650,
29918,
5630,
353,
883,
29889,
14941,
287,
29918,
1272,
29889,
657,
877,
5630,
29896,
1495,
13,
9651,
1404,
353,
15585,
403,
29898,
6786,
29922,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
12948,
13,
9651,
6464,
29898,
3827,
29892,
1404,
29897,
13,
9651,
736,
6684,
877,
816,
14952,
29901,
2248,
1495,
13,
1678,
1683,
29901,
13,
4706,
883,
353,
4911,
9832,
362,
2500,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1727,
8306,
29914,
4530,
786,
29889,
1420,
742,
11117,
689,
2396,
883,
1800,
13,
13,
13,
1753,
3625,
29918,
2536,
1862,
29898,
3827,
29892,
1629,
29922,
8516,
29892,
4098,
29922,
8516,
29892,
2462,
29922,
8516,
1125,
13,
12,
361,
1629,
1275,
6213,
470,
4098,
1275,
6213,
470,
2462,
1275,
6213,
29901,
13,
12,
12,
2457,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
816,
11272,
29918,
17482,
29889,
1420,
1495,
13,
12,
361,
2009,
29889,
5696,
1275,
525,
7194,
2396,
13,
12,
12,
689,
353,
27819,
4504,
11272,
2500,
29898,
6360,
29922,
524,
29898,
6360,
511,
10874,
29922,
524,
29898,
10874,
511,
2462,
29922,
524,
29898,
3250,
876,
13,
12,
12,
2457,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
816,
11272,
29918,
17482,
29889,
1420,
742,
11117,
689,
2396,
689,
1800,
13,
12,
361,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
12,
12,
689,
353,
27819,
4504,
11272,
2500,
29898,
3827,
29889,
5438,
29892,
1629,
29922,
524,
29898,
6360,
511,
10874,
29922,
524,
29898,
10874,
511,
2462,
29922,
524,
29898,
3250,
876,
13,
12,
12,
361,
883,
29889,
275,
29918,
3084,
7295,
13,
12,
12,
12,
689,
29889,
7620,
580,
13,
12,
12,
12,
932,
2461,
1860,
353,
27819,
2052,
2461,
358,
29889,
12650,
29889,
497,
580,
13,
12,
12,
12,
2457,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
3827,
29918,
29883,
4293,
29889,
1420,
742,
11117,
932,
2461,
1860,
2396,
932,
2461,
1860,
1800,
13,
12,
2457,
4050,
29898,
3827,
29892,
525,
816,
14952,
29914,
816,
11272,
29918,
17482,
29889,
1420,
1495,
13,
13,
13,
1753,
5386,
29918,
1052,
1581,
29918,
16074,
29898,
3827,
1125,
13,
12,
29943,
27998,
29889,
7529,
1839,
3859,
2033,
353,
14492,
9600,
4422,
29889,
17158,
29918,
6979,
29898,
11027,
29889,
1660,
22245,
29911,
29918,
10818,
29892,
13,
12,
12,
12,
12,
12,
12,
12,
12,
12,
12,
12,
12,
259,
2009,
29889,
1792,
29897,
13,
12,
29943,
27998,
29889,
7529,
1839,
5943,
29918,
1853,
2033,
353,
525,
2696,
1220,
29915,
29871,
13,
12,
8921,
675,
29918,
2271,
353,
383,
27998,
29889,
10568,
29896,
29918,
657,
29918,
8921,
675,
29918,
2271,
580,
13,
12,
2457,
9056,
5103,
24735,
29898,
8921,
675,
29918,
2271,
29897,
13,
13,
13,
1753,
5386,
29918,
5150,
29918,
2457,
29898,
3827,
1125,
13,
12,
361,
451,
14492,
9600,
4422,
29889,
15480,
29918,
6979,
29898,
11027,
29889,
1660,
22245,
29911,
29918,
10818,
29892,
2009,
29889,
7194,
29889,
657,
877,
3859,
2824,
12508,
703,
9420,
29899,
29947,
4968,
3827,
29889,
1792,
1125,
13,
12,
12,
2457,
9056,
5103,
22050,
3089,
580,
13,
12,
11944,
2556,
353,
383,
27998,
29889,
10568,
29906,
29918,
6543,
29898,
3827,
29889,
7194,
29897,
13,
12,
29937,
2158,
29898,
11944,
2556,
29889,
517,
29918,
3126,
3101,
13,
12,
1124,
353,
1732,
1982,
29906,
29889,
5506,
580,
13,
12,
1124,
353,
6625,
2556,
29889,
8921,
675,
29898,
1124,
29897,
13,
12,
5509,
353,
2048,
703,
23392,
613,
376,
29894,
29941,
613,
1732,
29922,
1124,
29897,
13,
12,
23392,
29918,
1272,
353,
2669,
29889,
23392,
1293,
2141,
1761,
2141,
7978,
580,
13,
12,
1454,
17684,
297,
17684,
29918,
1272,
1839,
7076,
2033,
29901,
13,
12,
12,
361,
525,
16072,
29915,
297,
17684,
322,
17684,
1839,
16072,
2033,
1275,
5852,
29901,
13,
12,
12,
12,
689,
353,
26431,
4165,
496,
2500,
3319,
29915,
1052,
1581,
29918,
333,
2396,
23392,
1839,
333,
7464,
525,
22379,
29918,
6979,
2396,
11944,
2556,
29889,
22379,
29918,
6979,
1800,
13,
12,
12,
12,
2158,
877,
4150,
1495,
13,
12,
12,
12,
361,
883,
29889,
275,
29918,
3084,
7295,
13,
12,
12,
12,
12,
2158,
877,
4150,
1495,
13,
12,
12,
12,
12,
689,
29889,
7620,
29898,
3827,
29889,
1792,
29897,
13,
12,
12,
12,
2158,
29898,
689,
29889,
12523,
29897,
13,
12,
12,
12,
2457,
6684,
877,
816,
14952,
29901,
2248,
1495,
13,
12,
2457,
6684,
877,
816,
14952,
29901,
2248,
1495,
13,
2
] |
src/__init__.py | smkell/pyfbl | 0 | 51303 | from flags import Flags
class PositionElgibility(Flags):
""" Bitwise enum for marking a player's egibility.abs
"""
catcher = ()
first_base = ()
second_base = ()
third_base = ()
short_stop = ()
outfield = ()
left_field = ()
center_field = ()
right_field = ()
designated_hitter = ()
pitcher = ()
starting_pitcher = ()
relief_pitcher = () | [
1,
515,
13449,
1053,
2379,
810,
13,
13,
1990,
20627,
6489,
29887,
4127,
29898,
15675,
1125,
13,
1678,
9995,
18531,
3538,
14115,
363,
2791,
292,
263,
4847,
29915,
29879,
8087,
4127,
29889,
6897,
13,
1678,
9995,
13,
13,
1678,
4380,
261,
353,
3861,
13,
1678,
937,
29918,
3188,
353,
3861,
13,
1678,
1473,
29918,
3188,
353,
3861,
13,
1678,
4654,
29918,
3188,
353,
3861,
13,
1678,
3273,
29918,
9847,
353,
3861,
13,
1678,
714,
2671,
353,
3861,
13,
1678,
2175,
29918,
2671,
353,
3861,
13,
1678,
4818,
29918,
2671,
353,
3861,
13,
1678,
1492,
29918,
2671,
353,
3861,
13,
1678,
25373,
29918,
29882,
5171,
353,
3861,
13,
1678,
15905,
261,
353,
3861,
13,
1678,
6257,
29918,
29886,
2335,
261,
353,
3861,
13,
1678,
18892,
29918,
29886,
2335,
261,
353,
3861,
2
] |
api/files/api/app/google_billing.py | trackit/trackit-legacy | 2 | 116840 | import json
from app import app
from app.msol_util import checksum, day_allocations
from app.gcloud.buckets import get_billing_files, download_billing_file
from models import db, User, GoogleCloudIdentity
from datetime import datetime, time
from time import strptime, mktime
import oauth2client
import httplib2
import msol_util
import apiclient
import flask
import json
import re
class GoogleCloudException(Exception):
pass
class GoogleCloudBillingException(GoogleCloudException):
pass
class GoogleCloudBillingValueException(GoogleCloudBillingException):
pass
class GoogleCloudBillingFormatException(GoogleCloudBillingException):
pass
def parse_billing_json(json_billing_data):
try:
if type(json_billing_data) == str:
return json.loads(json_billing_data)
elif type(json_billing_data) == file:
return json.load(json_billing_data)
except ValueError:
raise GoogleCloudBillingFormatException('Failed to parse JSON data.')
def get_billing_record_raw(billing_file, billing_data):
if type(billing_data) == list:
for record in billing_data:
yield record
else:
raise GoogleCloudBillingFormatException('Billing data is not a list.')
def get_all_line_items(identity, billing_bucket, since=None):
first_month_string = since.strftime('%Y-%m') if since else ''
for raw_file in get_billing_files(identity, billing_bucket):
match = re.search(r'\d{4}-\d{2}-\d{2}', raw_file['name'])
file_month_string = datetime.strptime(match.group(), '%Y-%m-%d').strftime('%Y-%m')
if file_month_string < first_month_string:
continue
print raw_file['name']
response, billing_data = download_billing_file(identity, raw_file)
billing_json = parse_billing_json(billing_data)
for record in get_billing_record_raw(raw_file, billing_json):
yield record
class ResourceByDayAccumulator(object):
def __init__(self):
self._resource_by_day = {}
self._time_cache = CachedTimeParse()
def __call__(self, line_item):
rid = line_item['lineItemId']
description = line_item['description']
account = line_item['accountId']
project_number = line_item['projectNumber']
project_name = project_number if not 'projectName' in line_item else line_item['projectName']
usage_start = self._time_cache[line_item['startTime']]
usage_end = self._time_cache[line_item['endTime']]
cost = parse_float(line_item['cost']['amount'])
credits = 0
if 'credits' in line_item:
for credit in line_item['credits']:
credits += parse_float(credit['amount'])
day = usage_end.date()
key = (day, rid, project_number)
if key not in self._resource_by_day:
self._resource_by_day[key] = dict(description=description,
project_name=project_name,
product=rid.rsplit('/', 1)[0],
date=day,
cost=cost + credits,
account=account,
rid=rid,
id=checksum(account, *map(str, key)))
else:
self._resource_by_day[key]['cost'] += cost
self._resource_by_day[key]['cost'] += credits
def results(self):
for by_day in self._resource_by_day.itervalues():
by_day = dict(by_day)
yield by_day
def nonempty_parse(parser):
def parse(val):
if val:
return parser(val)
return parse
parse_json = nonempty_parse(lambda v: json.loads(v))
parse_time = nonempty_parse(lambda v: datetime.fromtimestamp(mktime(strptime(v.rsplit('-', 1)[0], '%Y-%m-%dT%H:%M:%S'))))
parse_float = nonempty_parse(float)
parse_str = nonempty_parse(lambda v: v)
class CachedTimeParse(dict):
def __missing__(self, time_str):
parsed = parse_time(time_str)
self[time_str] = parsed
return parsed
| [
1,
1053,
4390,
13,
3166,
623,
1053,
623,
13,
3166,
623,
29889,
1516,
324,
29918,
4422,
1053,
1423,
2083,
29892,
2462,
29918,
15956,
800,
13,
3166,
623,
29889,
29887,
9274,
29889,
2423,
9737,
1053,
679,
29918,
29890,
8873,
29918,
5325,
29892,
5142,
29918,
29890,
8873,
29918,
1445,
13,
3166,
4733,
1053,
4833,
29892,
4911,
29892,
5087,
20442,
18415,
13,
3166,
12865,
1053,
12865,
29892,
931,
13,
3166,
931,
1053,
851,
415,
603,
29892,
286,
1193,
603,
13,
5215,
288,
5150,
29906,
4645,
13,
5215,
1732,
1982,
29906,
13,
5215,
286,
2929,
29918,
4422,
13,
5215,
3095,
293,
1593,
13,
5215,
29784,
13,
5215,
4390,
13,
5215,
337,
13,
13,
1990,
5087,
20442,
2451,
29898,
2451,
1125,
13,
1678,
1209,
13,
13,
1990,
5087,
20442,
29933,
8873,
2451,
29898,
14207,
20442,
2451,
1125,
13,
1678,
1209,
13,
13,
1990,
5087,
20442,
29933,
8873,
1917,
2451,
29898,
14207,
20442,
29933,
8873,
2451,
1125,
13,
1678,
1209,
13,
13,
1990,
5087,
20442,
29933,
8873,
5809,
2451,
29898,
14207,
20442,
29933,
8873,
2451,
1125,
13,
1678,
1209,
13,
13,
1753,
6088,
29918,
29890,
8873,
29918,
3126,
29898,
3126,
29918,
29890,
8873,
29918,
1272,
1125,
13,
1678,
1018,
29901,
13,
4706,
565,
1134,
29898,
3126,
29918,
29890,
8873,
29918,
1272,
29897,
1275,
851,
29901,
13,
9651,
736,
4390,
29889,
18132,
29898,
3126,
29918,
29890,
8873,
29918,
1272,
29897,
13,
4706,
25342,
1134,
29898,
3126,
29918,
29890,
8873,
29918,
1272,
29897,
1275,
934,
29901,
13,
9651,
736,
4390,
29889,
1359,
29898,
3126,
29918,
29890,
8873,
29918,
1272,
29897,
13,
1678,
5174,
7865,
2392,
29901,
13,
4706,
12020,
5087,
20442,
29933,
8873,
5809,
2451,
877,
17776,
304,
6088,
4663,
848,
29889,
1495,
13,
13,
1753,
679,
29918,
29890,
8873,
29918,
11651,
29918,
1610,
29898,
29890,
8873,
29918,
1445,
29892,
289,
8873,
29918,
1272,
1125,
13,
1678,
565,
1134,
29898,
29890,
8873,
29918,
1272,
29897,
1275,
1051,
29901,
13,
4706,
363,
2407,
297,
289,
8873,
29918,
1272,
29901,
13,
9651,
7709,
2407,
13,
1678,
1683,
29901,
13,
4706,
12020,
5087,
20442,
29933,
8873,
5809,
2451,
877,
29933,
8873,
848,
338,
451,
263,
1051,
29889,
1495,
13,
13,
1753,
679,
29918,
497,
29918,
1220,
29918,
7076,
29898,
22350,
29892,
289,
8873,
29918,
21454,
29892,
1951,
29922,
8516,
1125,
13,
1678,
937,
29918,
10874,
29918,
1807,
353,
1951,
29889,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
1495,
565,
1951,
1683,
6629,
13,
1678,
363,
10650,
29918,
1445,
297,
679,
29918,
29890,
8873,
29918,
5325,
29898,
22350,
29892,
289,
8873,
29918,
21454,
1125,
13,
4706,
1993,
353,
337,
29889,
4478,
29898,
29878,
12764,
29881,
29912,
29946,
12775,
29881,
29912,
29906,
12775,
29881,
29912,
29906,
29913,
742,
10650,
29918,
1445,
1839,
978,
11287,
13,
4706,
934,
29918,
10874,
29918,
1807,
353,
12865,
29889,
710,
415,
603,
29898,
4352,
29889,
2972,
3285,
14210,
29979,
19222,
29885,
19222,
29881,
2824,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
1495,
13,
4706,
565,
934,
29918,
10874,
29918,
1807,
529,
937,
29918,
10874,
29918,
1807,
29901,
13,
9651,
6773,
13,
4706,
1596,
10650,
29918,
1445,
1839,
978,
2033,
13,
4706,
2933,
29892,
289,
8873,
29918,
1272,
353,
5142,
29918,
29890,
8873,
29918,
1445,
29898,
22350,
29892,
10650,
29918,
1445,
29897,
13,
4706,
289,
8873,
29918,
3126,
353,
6088,
29918,
29890,
8873,
29918,
3126,
29898,
29890,
8873,
29918,
1272,
29897,
13,
4706,
363,
2407,
297,
679,
29918,
29890,
8873,
29918,
11651,
29918,
1610,
29898,
1610,
29918,
1445,
29892,
289,
8873,
29918,
3126,
1125,
13,
9651,
7709,
2407,
13,
13,
1990,
18981,
2059,
12742,
7504,
398,
9183,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
353,
6571,
13,
4706,
1583,
3032,
2230,
29918,
8173,
353,
315,
3791,
2481,
12914,
580,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
1196,
29918,
667,
1125,
13,
4706,
8177,
353,
1196,
29918,
667,
1839,
1220,
2001,
1204,
2033,
13,
4706,
6139,
353,
1196,
29918,
667,
1839,
8216,
2033,
13,
4706,
3633,
353,
1196,
29918,
667,
1839,
10149,
1204,
2033,
13,
4706,
2060,
29918,
4537,
353,
1196,
29918,
667,
1839,
4836,
4557,
2033,
13,
4706,
2060,
29918,
978,
353,
2060,
29918,
4537,
565,
451,
525,
4836,
1170,
29915,
297,
1196,
29918,
667,
1683,
1196,
29918,
667,
1839,
4836,
1170,
2033,
13,
4706,
8744,
29918,
2962,
353,
1583,
3032,
2230,
29918,
8173,
29961,
1220,
29918,
667,
1839,
2962,
2481,
2033,
29962,
13,
4706,
8744,
29918,
355,
353,
1583,
3032,
2230,
29918,
8173,
29961,
1220,
29918,
667,
1839,
355,
2481,
2033,
29962,
13,
4706,
3438,
353,
6088,
29918,
7411,
29898,
1220,
29918,
667,
1839,
18253,
16215,
14506,
11287,
13,
13,
4706,
6625,
1169,
353,
29871,
29900,
13,
4706,
565,
525,
11944,
1169,
29915,
297,
1196,
29918,
667,
29901,
13,
9651,
363,
16200,
297,
1196,
29918,
667,
1839,
11944,
1169,
2033,
29901,
13,
18884,
6625,
1169,
4619,
6088,
29918,
7411,
29898,
11944,
277,
1839,
14506,
11287,
13,
13,
4706,
2462,
353,
8744,
29918,
355,
29889,
1256,
580,
13,
4706,
1820,
353,
313,
3250,
29892,
8177,
29892,
2060,
29918,
4537,
29897,
13,
4706,
565,
1820,
451,
297,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
29901,
13,
9651,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
29961,
1989,
29962,
353,
9657,
29898,
8216,
29922,
8216,
29892,
13,
462,
462,
795,
2060,
29918,
978,
29922,
4836,
29918,
978,
29892,
13,
462,
462,
795,
3234,
29922,
2429,
29889,
2288,
2830,
11219,
742,
29871,
29896,
9601,
29900,
1402,
13,
462,
462,
795,
2635,
29922,
3250,
29892,
13,
462,
462,
795,
3438,
29922,
18253,
718,
6625,
1169,
29892,
13,
462,
462,
795,
3633,
29922,
10149,
29892,
13,
462,
462,
795,
8177,
29922,
2429,
29892,
13,
462,
462,
795,
1178,
29922,
3198,
2083,
29898,
10149,
29892,
334,
1958,
29898,
710,
29892,
1820,
4961,
13,
4706,
1683,
29901,
13,
9651,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
29961,
1989,
22322,
18253,
2033,
4619,
3438,
13,
9651,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
29961,
1989,
22322,
18253,
2033,
4619,
6625,
1169,
13,
13,
1678,
822,
2582,
29898,
1311,
1125,
13,
4706,
363,
491,
29918,
3250,
297,
1583,
3032,
10314,
29918,
1609,
29918,
3250,
29889,
1524,
5975,
7295,
13,
9651,
491,
29918,
3250,
353,
9657,
29898,
1609,
29918,
3250,
29897,
13,
9651,
7709,
491,
29918,
3250,
13,
13,
1753,
1661,
6310,
29918,
5510,
29898,
16680,
1125,
13,
1678,
822,
6088,
29898,
791,
1125,
13,
4706,
565,
659,
29901,
13,
9651,
736,
13812,
29898,
791,
29897,
13,
1678,
736,
6088,
13,
13,
5510,
29918,
3126,
353,
1661,
6310,
29918,
5510,
29898,
2892,
325,
29901,
4390,
29889,
18132,
29898,
29894,
876,
13,
13,
5510,
29918,
2230,
353,
1661,
6310,
29918,
5510,
29898,
2892,
325,
29901,
12865,
29889,
3166,
16394,
29898,
29885,
1193,
603,
29898,
710,
415,
603,
29898,
29894,
29889,
2288,
2830,
877,
29899,
742,
29871,
29896,
9601,
29900,
1402,
14210,
29979,
19222,
29885,
19222,
29881,
29911,
29995,
29950,
16664,
29924,
16664,
29903,
8785,
876,
13,
13,
5510,
29918,
7411,
353,
1661,
6310,
29918,
5510,
29898,
7411,
29897,
13,
13,
5510,
29918,
710,
353,
1661,
6310,
29918,
5510,
29898,
2892,
325,
29901,
325,
29897,
13,
13,
1990,
315,
3791,
2481,
12914,
29898,
8977,
1125,
13,
1678,
822,
4770,
27259,
12035,
1311,
29892,
931,
29918,
710,
1125,
13,
4706,
21213,
353,
6088,
29918,
2230,
29898,
2230,
29918,
710,
29897,
13,
4706,
1583,
29961,
2230,
29918,
710,
29962,
353,
21213,
13,
4706,
736,
21213,
13,
2
] |
renderer.py | shrionit/MyGameEngine | 0 | 96328 | import cv2
from glfw.GLFW import *
from OpenGL.GL import *
from PIL import Image
from model.loader import *
from model.model import *
from shader import *
from tool.gui import *
from tool.mmath import *
from tool.color import *
shaderProp = {
'renderprop': DProp({
'isvisible': True,
'img': 0,
'gamma': 1.0
}),
'lightprop': DProp({
'isvisible': True,
'mode': ['blinn', 'phong'],
'shininess': 16.0,
'specDamp': 5.0,
'lightcolor': Color3(1.0, 1.0, 1.0),
'ambientcolor': Color3(1.0, 1.0, 1.0)
}),
'kernelprop': DProp({
'isvisible': True,
'row': [[0.0]*3]*3
})
}
data = [
1.0, 1.0, 1.0, # 0 Bottom Left
1.0, -1.0, 1.0, # 1 Top Left
-1.0, -1.0, 1.0, # 2 Top Right
-1.0, 1.0, 1.0 # 3 Bottom Right
]
# data = [e/2.0 for e in data]
indices = [
0, 1, 2,
2, 0, 3
]
texcord = [
1.0, 1.0, # 0
1.0, 0.0, # 1
0.0, 0.0, # 2
0.0, 1.0, # 3
]
data = np.array(data, dtype=np.float32)
indices = np.array(indices, dtype=np.int32)
texcord = np.array(texcord, dtype=np.float32)
loader = Loader()
cv = cv2.VideoCapture(0)
class Renderer:
def __init__(self, camera, window, impl):
self.camera = camera
self.projection = camera.createProjectionMatrix()
self.window = window
self.window_width, self.window_height = glfwGetWindowSize(self.window)
self.entities = 0
self.shader = 0
self.hasIndex = False
self.framebuffer = glGenFramebuffers(1)
self.renderbuffer = glGenRenderbuffers(1)
self.framebuffer_attachment = glGenTextures(1)
self.initFrameBuffer()
self.viewer = impl
self.viewer.gengui(shaderProp)
def initFrameBuffer(self):
# binding frame buffer
glBindFramebuffer(GL_FRAMEBUFFER, self.framebuffer)
# binding attachment texture
glBindTexture(GL_TEXTURE_2D, self.framebuffer_attachment)
# binding render buffer (a direct rendered frame storage without conversion to img format)
glBindRenderbuffer(GL_RENDERBUFFER, self.renderbuffer)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self.window_width, self.window_height,
0, GL_RGB, GL_UNSIGNED_BYTE, None)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
# glTexImage2D(
# GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, self.window_width, self.window_height, 0,
# GL_DEPTH_STENCIL, GL_UNSIGNED_INT, None
# )
glBindTexture(GL_TEXTURE_2D, 0)
glFramebufferTexture2D(
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self.framebuffer_attachment, 0)
glRenderbufferStorage(
GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, self.window_width, self.window_height)
glBindRenderbuffer(GL_RENDERBUFFER, 0)
glFramebufferRenderbuffer(
GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, self.renderbuffer)
if glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE:
print("ERROR: Frame Buffer is Not complete")
glBindFramebuffer(GL_FRAMEBUFFER, 0)
def process(self, entities: Entity, shader: Shader, hasIndex=False, bgcolor=glm.vec4(0.1, 0.1, 0.1, 1.0)):
self.scene_shader = Shader('scene_frag', 'scene_vert')
self.scene_shader.attach()
print('Program LOG: \n', glGetProgramInfoLog(
self.scene_shader.shaderProgram))
self.scene = loader.loadRaw(
data, indices, texture=self.framebuffer_attachment, texcoord=texcord, vert_size=3)
self.scene_shader.detach()
self.entities = entities
self.shader = shader
self.hasIndex = hasIndex
self.shader.attach()
self.shader.loadProjectionMatrix(self.projection)
self.bgcolor = bgcolor
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable(GL_DEPTH_TEST)
glEnable(GL_BLEND)
glCullFace(GL_BACK)
print(
f'frame_shader => {self.scene_shader.shaderProgram}, scene_shader => {self.shader.shaderProgram}')
self.viewer.giveshader(
DProp({
'frame_shader': self.scene_shader,
'scene_shader': self.shader
})
)
print('framebf = > ', self.framebuffer_attachment)
self.viewer.newframe(self.framebuffer_attachment)
def assignCamToTex(self, texid):
ret, frame = cv.read()
img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
newimage = Image.fromarray(img)
newimg_data = newimage.transpose(
Image.FLIP_TOP_BOTTOM).convert('RGBA').tobytes()
glBindTexture(GL_TEXTURE_2D, texid)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newimage.width,
newimage.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, newimg_data)
def processinput(self):
if glfwGetKey(self.window, eval('GLFW_KEY_UP')) == GLFW_PRESS:
shaderProp['lightprop'].specDamp += 1
self.shader.putSingleValueAt(
'damp', shaderProp['lightprop'].specDamp)
if glfwGetKey(self.window, GLFW_KEY_DOWN) == GLFW_PRESS:
shaderProp['lightprop'].specDamp -= 1
self.shader.putSingleValueAt(
'damp', shaderProp['lightprop'].specDamp)
def renderframe(self):
glEnable(GL_CULL_FACE)
self.shader.attach()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
self.projection = self.camera.createProjectionMatrix()
self.shader.loadProjectionMatrix(self.projection)
glClearColor(*self.bgcolor)
self.processinput()
for entity in self.entities:
self.shader.putDataInUniformLocation('time', glfwGetTime())
view = self.camera.createViewMatrix()
self.shader.loadViewMatrix(glm.value_ptr(view))
self.camera.movement()
trans = entity.updatemat(createTransformationMatrix)
self.shader.loadTransformationMatrix(glm.value_ptr(
trans
))
if self.shader._default_frag != entity.entity_shader:
self.shader.updateShader(entity.entity_shader)
entity.bind()
if entity.id == 'dummy':
entity.setrotation(glm.vec3(0.0, 0.2*glfwGetTime(), 0.0))
entity.updateTex(self.framebuffer_attachment)
mode = entity.getmode()
if mode == 'WIRE':
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
mode = GL_TRIANGLES
elif mode == 'VERT':
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
glPointSize(3.0)
mode = GL_POINTS
else:
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
mode = GL_TRIANGLES
if not self.hasIndex:
glDrawArrays(
mode, 0, entity.getmodel().v_count()
)
else:
glDrawElements(
mode, entity.getmodel().i_count(),
GL_UNSIGNED_INT, None
)
entity.unbind()
def renderscene(self):
glEnable(GL_FRAMEBUFFER_SRGB)
glDisable(GL_CULL_FACE)
self.scene_shader.attach()
self.scene.bind()
glDisable(GL_DEPTH_TEST)
glDrawElements(
GL_TRIANGLES, self.scene.i_count(),
GL_UNSIGNED_INT, None
)
self.viewer.show()
self.scene.unbind()
glEnable(GL_DEPTH_TEST)
def dispose(self):
self.scene_shader.stop()
self.shader.stop()
| [
1,
1053,
13850,
29906,
13,
3166,
3144,
25051,
29889,
7239,
29943,
29956,
1053,
334,
13,
3166,
29508,
29889,
7239,
1053,
334,
13,
3166,
349,
6227,
1053,
7084,
13,
13,
3166,
1904,
29889,
12657,
1053,
334,
13,
3166,
1904,
29889,
4299,
1053,
334,
13,
3166,
528,
1664,
1053,
334,
13,
3166,
5780,
29889,
23569,
1053,
334,
13,
3166,
5780,
29889,
29885,
755,
1053,
334,
13,
3166,
5780,
29889,
2780,
1053,
334,
13,
13,
845,
1664,
20420,
353,
426,
13,
1678,
525,
9482,
7728,
2396,
360,
20420,
3319,
13,
4706,
525,
275,
12872,
2396,
5852,
29892,
13,
4706,
525,
2492,
2396,
29871,
29900,
29892,
13,
4706,
525,
4283,
2396,
29871,
29896,
29889,
29900,
13,
1678,
500,
511,
13,
1678,
525,
4366,
7728,
2396,
360,
20420,
3319,
13,
4706,
525,
275,
12872,
2396,
5852,
29892,
13,
4706,
525,
8513,
2396,
6024,
29890,
1915,
29876,
742,
525,
561,
549,
7464,
13,
4706,
525,
845,
262,
3335,
2396,
29871,
29896,
29953,
29889,
29900,
29892,
13,
4706,
525,
6550,
29928,
1160,
2396,
29871,
29945,
29889,
29900,
29892,
13,
4706,
525,
4366,
2780,
2396,
9159,
29941,
29898,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
511,
13,
4706,
525,
1117,
993,
2780,
2396,
9159,
29941,
29898,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29897,
13,
1678,
500,
511,
13,
1678,
525,
17460,
7728,
2396,
360,
20420,
3319,
13,
4706,
525,
275,
12872,
2396,
5852,
29892,
13,
4706,
525,
798,
2396,
5519,
29900,
29889,
29900,
14178,
29941,
14178,
29941,
13,
1678,
5615,
13,
29913,
13,
13,
1272,
353,
518,
13,
268,
29896,
29889,
29900,
29892,
259,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
396,
29871,
29900,
350,
3570,
19941,
13,
268,
29896,
29889,
29900,
29892,
448,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
396,
29871,
29896,
7488,
19941,
13,
1678,
448,
29896,
29889,
29900,
29892,
448,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
396,
29871,
29906,
7488,
10428,
13,
1678,
448,
29896,
29889,
29900,
29892,
259,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29871,
396,
29871,
29941,
350,
3570,
10428,
13,
29962,
13,
13,
29937,
848,
353,
518,
29872,
29914,
29906,
29889,
29900,
363,
321,
297,
848,
29962,
13,
13,
513,
1575,
353,
518,
13,
268,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
13,
268,
29906,
29892,
29871,
29900,
29892,
29871,
29941,
13,
29962,
13,
13,
4776,
16090,
353,
518,
13,
268,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
396,
29871,
29900,
13,
268,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
396,
29871,
29896,
13,
268,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
396,
29871,
29906,
13,
268,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
396,
29871,
29941,
13,
29962,
13,
13,
1272,
353,
7442,
29889,
2378,
29898,
1272,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
513,
1575,
353,
7442,
29889,
2378,
29898,
513,
1575,
29892,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
4776,
16090,
353,
7442,
29889,
2378,
29898,
4776,
16090,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
12657,
353,
4309,
1664,
580,
13,
11023,
353,
13850,
29906,
29889,
15167,
21133,
545,
29898,
29900,
29897,
13,
13,
13,
1990,
26000,
261,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10656,
29892,
3474,
29892,
13374,
1125,
13,
4706,
1583,
29889,
26065,
353,
10656,
13,
4706,
1583,
29889,
771,
6929,
353,
10656,
29889,
3258,
1184,
6929,
14609,
580,
13,
4706,
1583,
29889,
7165,
353,
3474,
13,
4706,
1583,
29889,
7165,
29918,
2103,
29892,
1583,
29889,
7165,
29918,
3545,
353,
3144,
25051,
2577,
5907,
3505,
29898,
1311,
29889,
7165,
29897,
13,
4706,
1583,
29889,
296,
1907,
353,
29871,
29900,
13,
4706,
1583,
29889,
845,
1664,
353,
29871,
29900,
13,
4706,
1583,
29889,
5349,
3220,
353,
7700,
13,
4706,
1583,
29889,
2557,
9040,
353,
3144,
15462,
4308,
28040,
414,
29898,
29896,
29897,
13,
4706,
1583,
29889,
9482,
9040,
353,
3144,
15462,
10716,
28040,
414,
29898,
29896,
29897,
13,
4706,
1583,
29889,
2557,
9040,
29918,
14930,
358,
353,
3144,
15462,
1626,
1973,
29898,
29896,
29897,
13,
4706,
1583,
29889,
2344,
4308,
7701,
580,
13,
4706,
1583,
29889,
29894,
15580,
353,
13374,
13,
4706,
1583,
29889,
29894,
15580,
29889,
29887,
996,
1481,
29898,
845,
1664,
20420,
29897,
13,
13,
1678,
822,
2069,
4308,
7701,
29898,
1311,
1125,
13,
4706,
396,
9956,
3515,
6835,
13,
4706,
3144,
15708,
4308,
9040,
29898,
7239,
29918,
29943,
4717,
2303,
7838,
28483,
29892,
1583,
29889,
2557,
9040,
29897,
13,
4706,
396,
9956,
26305,
18459,
13,
4706,
3144,
15708,
21898,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
1583,
29889,
2557,
9040,
29918,
14930,
358,
29897,
13,
4706,
396,
9956,
4050,
6835,
313,
29874,
1513,
13751,
3515,
8635,
1728,
11301,
304,
10153,
3402,
29897,
13,
4706,
3144,
15708,
10716,
9040,
29898,
7239,
29918,
29934,
1430,
8032,
7838,
28483,
29892,
1583,
29889,
9482,
9040,
29897,
13,
13,
4706,
3144,
26887,
2940,
29906,
29928,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
29871,
29900,
29892,
12729,
29918,
28212,
29892,
1583,
29889,
7165,
29918,
2103,
29892,
1583,
29889,
7165,
29918,
3545,
29892,
13,
462,
418,
29900,
29892,
12729,
29918,
28212,
29892,
12729,
29918,
29965,
3059,
17298,
3352,
29918,
22716,
4330,
29892,
6213,
29897,
13,
4706,
3144,
26887,
9329,
29875,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
12729,
29918,
16975,
11499,
29918,
16173,
29918,
3738,
29931,
4945,
29892,
12729,
29918,
18521,
1718,
29897,
13,
4706,
3144,
26887,
9329,
29875,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
12729,
29918,
16975,
11499,
29918,
1529,
29954,
29918,
3738,
29931,
4945,
29892,
12729,
29918,
18521,
1718,
29897,
13,
4706,
396,
3144,
26887,
2940,
29906,
29928,
29898,
13,
4706,
396,
268,
12729,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
29871,
29900,
29892,
12729,
29918,
2287,
29925,
4690,
29906,
29946,
29918,
1254,
1430,
29907,
6227,
29947,
29892,
1583,
29889,
7165,
29918,
2103,
29892,
1583,
29889,
7165,
29918,
3545,
29892,
29871,
29900,
29892,
13,
4706,
396,
268,
12729,
29918,
2287,
29925,
4690,
29918,
1254,
1430,
29907,
6227,
29892,
12729,
29918,
29965,
3059,
17298,
3352,
29918,
10192,
29892,
6213,
13,
4706,
396,
1723,
13,
4706,
3144,
15708,
21898,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
29871,
29900,
29897,
13,
4706,
3144,
4308,
9040,
21898,
29906,
29928,
29898,
13,
9651,
12729,
29918,
29943,
4717,
2303,
7838,
28483,
29892,
12729,
29918,
15032,
1955,
29918,
1299,
8687,
29950,
13780,
29900,
29892,
12729,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
1583,
29889,
2557,
9040,
29918,
14930,
358,
29892,
29871,
29900,
29897,
13,
13,
4706,
3144,
10716,
9040,
10486,
29898,
13,
9651,
12729,
29918,
29934,
1430,
8032,
7838,
28483,
29892,
12729,
29918,
2287,
29925,
4690,
29906,
29946,
29918,
1254,
1430,
29907,
6227,
29947,
29892,
1583,
29889,
7165,
29918,
2103,
29892,
1583,
29889,
7165,
29918,
3545,
29897,
13,
13,
4706,
3144,
15708,
10716,
9040,
29898,
7239,
29918,
29934,
1430,
8032,
7838,
28483,
29892,
29871,
29900,
29897,
13,
13,
4706,
3144,
4308,
9040,
10716,
9040,
29898,
13,
9651,
12729,
29918,
29943,
4717,
2303,
7838,
28483,
29892,
12729,
29918,
2287,
29925,
4690,
29918,
1254,
1430,
29907,
6227,
29918,
1299,
8687,
29950,
13780,
29892,
12729,
29918,
29934,
1430,
8032,
7838,
28483,
29892,
1583,
29889,
9482,
9040,
29897,
13,
13,
4706,
565,
3144,
5596,
4308,
9040,
5709,
29898,
7239,
29918,
29943,
4717,
2303,
7838,
28483,
29897,
2804,
12729,
29918,
29943,
4717,
2303,
7838,
28483,
29918,
21514,
18476,
29901,
13,
9651,
1596,
703,
11432,
29901,
12218,
16534,
338,
2216,
4866,
1159,
13,
13,
4706,
3144,
15708,
4308,
9040,
29898,
7239,
29918,
29943,
4717,
2303,
7838,
28483,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
1889,
29898,
1311,
29892,
16212,
29901,
14945,
29892,
528,
1664,
29901,
1383,
1664,
29892,
756,
3220,
29922,
8824,
29892,
25989,
2780,
29922,
3820,
29885,
29889,
2003,
29946,
29898,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29896,
29889,
29900,
22164,
13,
4706,
1583,
29889,
24645,
29918,
845,
1664,
353,
1383,
1664,
877,
24645,
29918,
29888,
1431,
742,
525,
24645,
29918,
1765,
1495,
13,
4706,
1583,
29889,
24645,
29918,
845,
1664,
29889,
14930,
580,
13,
4706,
1596,
877,
9283,
25401,
29901,
320,
29876,
742,
3144,
2577,
9283,
3401,
3403,
29898,
13,
9651,
1583,
29889,
24645,
29918,
845,
1664,
29889,
845,
1664,
9283,
876,
13,
4706,
1583,
29889,
24645,
353,
23466,
29889,
1359,
22131,
29898,
13,
9651,
848,
29892,
16285,
29892,
18459,
29922,
1311,
29889,
2557,
9040,
29918,
14930,
358,
29892,
19696,
1111,
536,
29922,
4776,
16090,
29892,
4837,
29918,
2311,
29922,
29941,
29897,
13,
4706,
1583,
29889,
24645,
29918,
845,
1664,
29889,
4801,
496,
580,
13,
4706,
1583,
29889,
296,
1907,
353,
16212,
13,
4706,
1583,
29889,
845,
1664,
353,
528,
1664,
13,
4706,
1583,
29889,
5349,
3220,
353,
756,
3220,
13,
4706,
1583,
29889,
845,
1664,
29889,
14930,
580,
13,
4706,
1583,
29889,
845,
1664,
29889,
1359,
1184,
6929,
14609,
29898,
1311,
29889,
771,
6929,
29897,
13,
4706,
1583,
29889,
16264,
2780,
353,
25989,
2780,
13,
4706,
3144,
10358,
355,
14400,
29898,
7239,
29918,
29903,
10363,
29918,
1964,
29925,
15715,
29892,
12729,
29918,
12413,
29918,
16173,
3308,
29918,
29903,
10363,
29918,
1964,
29925,
15715,
29897,
13,
4706,
3144,
20701,
29898,
7239,
29918,
2287,
29925,
4690,
29918,
18267,
29897,
13,
4706,
3144,
20701,
29898,
7239,
29918,
29933,
1307,
2797,
29897,
13,
4706,
3144,
29907,
913,
23360,
29898,
7239,
29918,
29933,
11375,
29897,
13,
4706,
1596,
29898,
13,
9651,
285,
29915,
2557,
29918,
845,
1664,
1149,
426,
1311,
29889,
24645,
29918,
845,
1664,
29889,
845,
1664,
9283,
1118,
9088,
29918,
845,
1664,
1149,
426,
1311,
29889,
845,
1664,
29889,
845,
1664,
9283,
29913,
1495,
13,
4706,
1583,
29889,
29894,
15580,
29889,
29887,
3145,
29882,
1664,
29898,
13,
9651,
360,
20420,
3319,
13,
18884,
525,
2557,
29918,
845,
1664,
2396,
1583,
29889,
24645,
29918,
845,
1664,
29892,
13,
18884,
525,
24645,
29918,
845,
1664,
2396,
1583,
29889,
845,
1664,
13,
9651,
5615,
13,
4706,
1723,
13,
4706,
1596,
877,
2557,
1635,
353,
1405,
13420,
1583,
29889,
2557,
9040,
29918,
14930,
358,
29897,
13,
4706,
1583,
29889,
29894,
15580,
29889,
1482,
2557,
29898,
1311,
29889,
2557,
9040,
29918,
14930,
358,
29897,
13,
13,
1678,
822,
3566,
14353,
1762,
26887,
29898,
1311,
29892,
19696,
333,
1125,
13,
4706,
3240,
29892,
3515,
353,
13850,
29889,
949,
580,
13,
4706,
10153,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
2557,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29934,
29954,
5688,
29897,
13,
4706,
716,
3027,
353,
7084,
29889,
3166,
2378,
29898,
2492,
29897,
13,
4706,
716,
2492,
29918,
1272,
353,
716,
3027,
29889,
3286,
4220,
29898,
13,
9651,
7084,
29889,
29943,
5265,
29925,
29918,
29911,
4590,
29918,
29933,
2891,
4986,
29924,
467,
13441,
877,
29934,
29954,
5688,
2824,
517,
13193,
580,
13,
4706,
3144,
15708,
21898,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
19696,
333,
29897,
13,
4706,
3144,
26887,
2940,
29906,
29928,
29898,
7239,
29918,
16975,
11499,
29918,
29906,
29928,
29892,
29871,
29900,
29892,
12729,
29918,
29934,
29954,
5688,
29892,
716,
3027,
29889,
2103,
29892,
13,
462,
268,
716,
3027,
29889,
3545,
29892,
29871,
29900,
29892,
12729,
29918,
29934,
29954,
5688,
29892,
12729,
29918,
29965,
3059,
17298,
3352,
29918,
22716,
4330,
29892,
716,
2492,
29918,
1272,
29897,
13,
13,
1678,
822,
1889,
2080,
29898,
1311,
1125,
13,
4706,
565,
3144,
25051,
2577,
2558,
29898,
1311,
29889,
7165,
29892,
19745,
877,
7239,
29943,
29956,
29918,
10818,
29918,
4897,
8785,
1275,
12729,
29943,
29956,
29918,
15094,
1799,
29901,
13,
9651,
528,
1664,
20420,
1839,
4366,
7728,
13359,
6550,
29928,
1160,
4619,
29871,
29896,
13,
9651,
1583,
29889,
845,
1664,
29889,
649,
15771,
1917,
4178,
29898,
13,
18884,
525,
29881,
1160,
742,
528,
1664,
20420,
1839,
4366,
7728,
13359,
6550,
29928,
1160,
29897,
13,
4706,
565,
3144,
25051,
2577,
2558,
29898,
1311,
29889,
7165,
29892,
12729,
29943,
29956,
29918,
10818,
29918,
3970,
16048,
29897,
1275,
12729,
29943,
29956,
29918,
15094,
1799,
29901,
13,
9651,
528,
1664,
20420,
1839,
4366,
7728,
13359,
6550,
29928,
1160,
22361,
29871,
29896,
13,
9651,
1583,
29889,
845,
1664,
29889,
649,
15771,
1917,
4178,
29898,
13,
18884,
525,
29881,
1160,
742,
528,
1664,
20420,
1839,
4366,
7728,
13359,
6550,
29928,
1160,
29897,
13,
13,
1678,
822,
4050,
2557,
29898,
1311,
1125,
13,
4706,
3144,
20701,
29898,
7239,
29918,
29907,
3299,
29918,
29943,
11538,
29897,
13,
4706,
1583,
29889,
845,
1664,
29889,
14930,
580,
13,
4706,
3144,
18759,
29898,
7239,
29918,
15032,
1955,
29918,
7838,
28483,
29918,
22698,
891,
12729,
29918,
2287,
29925,
4690,
29918,
7838,
28483,
29918,
22698,
29897,
13,
4706,
1583,
29889,
771,
6929,
353,
1583,
29889,
26065,
29889,
3258,
1184,
6929,
14609,
580,
13,
4706,
1583,
29889,
845,
1664,
29889,
1359,
1184,
6929,
14609,
29898,
1311,
29889,
771,
6929,
29897,
13,
4706,
3144,
18759,
3306,
10456,
1311,
29889,
16264,
2780,
29897,
13,
4706,
1583,
29889,
5014,
2080,
580,
13,
4706,
363,
7855,
297,
1583,
29889,
296,
1907,
29901,
13,
9651,
1583,
29889,
845,
1664,
29889,
649,
1469,
797,
2525,
5560,
6508,
877,
2230,
742,
3144,
25051,
2577,
2481,
3101,
13,
9651,
1776,
353,
1583,
29889,
26065,
29889,
3258,
1043,
14609,
580,
13,
9651,
1583,
29889,
845,
1664,
29889,
1359,
1043,
14609,
29898,
3820,
29885,
29889,
1767,
29918,
7414,
29898,
1493,
876,
13,
9651,
1583,
29889,
26065,
29889,
13529,
882,
580,
13,
9651,
1301,
353,
7855,
29889,
786,
4130,
4579,
29898,
3258,
4300,
5404,
14609,
29897,
13,
9651,
1583,
29889,
845,
1664,
29889,
1359,
4300,
5404,
14609,
29898,
3820,
29885,
29889,
1767,
29918,
7414,
29898,
13,
18884,
1301,
13,
632,
876,
13,
9651,
565,
1583,
29889,
845,
1664,
3032,
4381,
29918,
29888,
1431,
2804,
7855,
29889,
10041,
29918,
845,
1664,
29901,
13,
18884,
1583,
29889,
845,
1664,
29889,
5504,
2713,
1664,
29898,
10041,
29889,
10041,
29918,
845,
1664,
29897,
13,
9651,
7855,
29889,
5355,
580,
13,
9651,
565,
7855,
29889,
333,
1275,
525,
29881,
11770,
2396,
13,
18884,
7855,
29889,
842,
5450,
362,
29898,
3820,
29885,
29889,
2003,
29941,
29898,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29906,
29930,
3820,
25051,
2577,
2481,
3285,
29871,
29900,
29889,
29900,
876,
13,
18884,
7855,
29889,
5504,
26887,
29898,
1311,
29889,
2557,
9040,
29918,
14930,
358,
29897,
13,
9651,
4464,
353,
7855,
29889,
657,
8513,
580,
13,
9651,
565,
4464,
1275,
525,
22119,
1525,
2396,
13,
18884,
3144,
7713,
17125,
6818,
29898,
7239,
29918,
15860,
1164,
29911,
29918,
9468,
29918,
29933,
11375,
29892,
12729,
29918,
18521,
29897,
13,
18884,
4464,
353,
12729,
29918,
29911,
3960,
19453,
17101,
13,
9651,
25342,
4464,
1275,
525,
5348,
29911,
2396,
13,
18884,
3144,
7713,
17125,
6818,
29898,
7239,
29918,
15860,
1164,
29911,
29918,
9468,
29918,
29933,
11375,
29892,
12729,
29918,
3738,
2208,
29897,
13,
18884,
3144,
5228,
3505,
29898,
29941,
29889,
29900,
29897,
13,
18884,
4464,
353,
12729,
29918,
29925,
6992,
9375,
13,
9651,
1683,
29901,
13,
18884,
3144,
7713,
17125,
6818,
29898,
7239,
29918,
15860,
1164,
29911,
29918,
9468,
29918,
29933,
11375,
29892,
12729,
29918,
3738,
2208,
29897,
13,
18884,
4464,
353,
12729,
29918,
29911,
3960,
19453,
17101,
13,
13,
9651,
565,
451,
1583,
29889,
5349,
3220,
29901,
13,
18884,
3144,
8537,
2588,
29879,
29898,
13,
462,
1678,
4464,
29892,
29871,
29900,
29892,
7855,
29889,
657,
4299,
2141,
29894,
29918,
2798,
580,
13,
18884,
1723,
13,
9651,
1683,
29901,
13,
18884,
3144,
8537,
18868,
29898,
13,
462,
1678,
4464,
29892,
7855,
29889,
657,
4299,
2141,
29875,
29918,
2798,
3285,
13,
462,
1678,
12729,
29918,
29965,
3059,
17298,
3352,
29918,
10192,
29892,
6213,
13,
18884,
1723,
13,
9651,
7855,
29889,
348,
5355,
580,
13,
13,
1678,
822,
7697,
414,
29883,
1600,
29898,
1311,
1125,
13,
4706,
3144,
20701,
29898,
7239,
29918,
29943,
4717,
2303,
7838,
28483,
29918,
14098,
7210,
29897,
13,
4706,
3144,
4205,
519,
29898,
7239,
29918,
29907,
3299,
29918,
29943,
11538,
29897,
13,
4706,
1583,
29889,
24645,
29918,
845,
1664,
29889,
14930,
580,
13,
4706,
1583,
29889,
24645,
29889,
5355,
580,
13,
4706,
3144,
4205,
519,
29898,
7239,
29918,
2287,
29925,
4690,
29918,
18267,
29897,
13,
4706,
3144,
8537,
18868,
29898,
13,
9651,
12729,
29918,
29911,
3960,
19453,
17101,
29892,
1583,
29889,
24645,
29889,
29875,
29918,
2798,
3285,
13,
9651,
12729,
29918,
29965,
3059,
17298,
3352,
29918,
10192,
29892,
6213,
13,
4706,
1723,
13,
4706,
1583,
29889,
29894,
15580,
29889,
4294,
580,
13,
4706,
1583,
29889,
24645,
29889,
348,
5355,
580,
13,
4706,
3144,
20701,
29898,
7239,
29918,
2287,
29925,
4690,
29918,
18267,
29897,
13,
13,
1678,
822,
27905,
29898,
1311,
1125,
13,
4706,
1583,
29889,
24645,
29918,
845,
1664,
29889,
9847,
580,
13,
4706,
1583,
29889,
845,
1664,
29889,
9847,
580,
13,
2
] |
devilry/project/common/devilry_test_runner.py | devilry/devilry-django | 29 | 160005 | <reponame>devilry/devilry-django
import warnings
from django.test.runner import DiscoverRunner
#from django.utils.deprecation import RemovedInDjango20Warning
class DevilryTestRunner(DiscoverRunner):
def setup_test_environment(self, **kwargs):
# warnings.filterwarnings('ignore', category=RemovedInDjango)
super(DevilryTestRunner, self).setup_test_environment(**kwargs)
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=ResourceWarning)
| [
1,
529,
276,
1112,
420,
29958,
3359,
309,
719,
29914,
3359,
309,
719,
29899,
14095,
13,
5215,
18116,
13,
13,
3166,
9557,
29889,
1688,
29889,
27492,
1053,
8565,
957,
16802,
13,
29937,
3166,
9557,
29889,
13239,
29889,
311,
1457,
9252,
1053,
5240,
8238,
797,
29928,
5364,
29906,
29900,
22709,
13,
13,
13,
1990,
9481,
309,
719,
3057,
16802,
29898,
4205,
11911,
16802,
1125,
13,
1678,
822,
6230,
29918,
1688,
29918,
20944,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
396,
18116,
29889,
4572,
25442,
886,
877,
17281,
742,
7663,
29922,
7301,
8238,
797,
29928,
5364,
29897,
13,
4706,
2428,
29898,
16618,
309,
719,
3057,
16802,
29892,
1583,
467,
14669,
29918,
1688,
29918,
20944,
29898,
1068,
19290,
29897,
13,
4706,
18116,
29889,
4572,
25442,
886,
877,
17281,
742,
7663,
29922,
8498,
3757,
362,
22709,
29897,
13,
4706,
18116,
29889,
4572,
25442,
886,
877,
17281,
742,
7663,
29922,
6848,
22709,
29897,
13,
2
] |
agent/python/lib/agentdb.py | herry13/nuri | 0 | 111420 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2014, Herry <<EMAIL>>
#
# This file is part of Nuri
#
# Nuri is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Nuri 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 Lesser General Public
# License along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import sys
import json
import urlparse
import sqlite3 as sqlite
# table "agents":
# - name VARCHAR
# - address VARCHAR
# - port INT
#
class AgentDB(object):
tablename = 'agents'
def __init__(self, config):
self.db_file = config['db_file']
self.conn = sqlite.connect(config['db_file'])
self.logger = config['logger']
# check table existence
with self.conn:
if not self.__table_exists():
self.conn.cursor().execute("CREATE TABLE " + self.tablename + "(name VARCHAR, address VARCHAR, port INT)")
self.conn.commit()
if not self.__table_exists():
raise Exception('cannot create table ' + self.tablename)
def __table_exists(self):
return (len(self.__query("SELECT name FROM sqlite_master WHERE type='table' AND name='" + self.tablename + "'")) > 0)
def __query(self, sql):
with self.conn:
return self.conn.cursor().execute(sql).fetchall()
def __get(self, where=''):
sql = 'SELECT name,address,port FROM ' + self.tablename
sql += ' WHERE ' + where if len(where) > 0 else ''
agents = {}
for row in self.__query(sql):
agents[row[0]] = {'sfpAddress': row[1], 'sfpPort': row[2]}
return agents
# Add agents
def add(self, agents):
with self.conn:
c = self.conn.cursor()
for key in agents:
address = str(agents[key]['sfpAddress'])
port = str(int(agents[key]['sfpPort']))
c.execute('INSERT INTO ' + self.tablename + " VALUES ('" + key + "','" + address + "'," + port + ")")
self.conn.commit()
# return return by name
def get_by_name(self, name):
where = "name='" + name + "'"
return self.__get(where)
# Return all agents
def get_all(self):
return self.__get()
# delete all agents
def delete_all(self):
with self.conn:
c = self.conn.cursor()
c.execute("DELETE FROM " + self.tablename)
self.conn.commit()
# delete agent by name
def delete_by_name(self, name):
c = self.conn.cursor()
c.execute("DELETE FROM " + self.tablename + " WHERE name='" + name + "'")
self.conn.commit()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29946,
29892,
2439,
719,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
405,
5338,
13,
29937,
13,
29937,
405,
5338,
338,
3889,
7047,
29901,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
29937,
372,
1090,
278,
4958,
310,
278,
15143,
365,
16136,
4593,
5236,
19245,
408,
13,
29937,
6369,
491,
278,
12362,
18540,
10606,
29892,
2845,
1873,
29871,
29941,
310,
13,
29937,
278,
19245,
29892,
470,
313,
271,
596,
2984,
29897,
738,
2678,
1873,
29889,
13,
29937,
13,
29937,
405,
5338,
338,
13235,
297,
278,
4966,
393,
372,
674,
367,
5407,
29892,
13,
29937,
541,
399,
1806,
8187,
2692,
13764,
29979,
399,
1718,
29934,
13566,
29979,
29936,
1728,
1584,
278,
2411,
2957,
1370,
21867,
29891,
310,
13,
29937,
341,
1001,
3210,
13566,
2882,
6227,
11937,
470,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
29871,
2823,
278,
13,
29937,
15143,
4593,
5236,
19245,
363,
901,
4902,
29889,
13,
29937,
13,
29937,
887,
881,
505,
4520,
263,
3509,
310,
278,
15143,
365,
16136,
4593,
5236,
13,
29937,
19245,
3412,
411,
530,
1687,
29889,
960,
451,
29892,
1074,
529,
1124,
597,
1636,
29889,
18713,
29889,
990,
29914,
506,
11259,
3779,
29889,
13,
13,
5215,
10876,
13,
5215,
4390,
13,
5215,
3142,
5510,
13,
5215,
21120,
29941,
408,
21120,
13,
13,
29937,
1591,
376,
351,
1237,
1115,
13,
29937,
448,
1024,
21748,
13,
29937,
448,
3211,
21748,
13,
29937,
448,
2011,
19578,
13,
29937,
13,
1990,
28330,
4051,
29898,
3318,
1125,
13,
12,
3891,
2435,
420,
353,
525,
351,
1237,
29915,
13,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
2295,
1125,
13,
12,
12,
1311,
29889,
2585,
29918,
1445,
353,
2295,
1839,
2585,
29918,
1445,
2033,
13,
12,
12,
1311,
29889,
13082,
353,
21120,
29889,
6915,
29898,
2917,
1839,
2585,
29918,
1445,
11287,
13,
13,
12,
12,
1311,
29889,
21707,
353,
2295,
1839,
21707,
2033,
13,
13,
12,
12,
29937,
1423,
1591,
10379,
13,
12,
12,
2541,
1583,
29889,
13082,
29901,
13,
12,
12,
12,
361,
451,
1583,
17255,
2371,
29918,
9933,
7295,
13,
12,
12,
12,
12,
1311,
29889,
13082,
29889,
18127,
2141,
7978,
703,
27045,
10911,
376,
718,
1583,
29889,
3891,
2435,
420,
718,
18227,
978,
21748,
29892,
3211,
21748,
29892,
2011,
19578,
25760,
13,
12,
12,
12,
12,
1311,
29889,
13082,
29889,
15060,
580,
13,
12,
12,
12,
361,
451,
1583,
17255,
2371,
29918,
9933,
7295,
13,
12,
12,
12,
12,
22692,
8960,
877,
29883,
6735,
1653,
1591,
525,
718,
1583,
29889,
3891,
2435,
420,
29897,
13,
13,
12,
1753,
4770,
2371,
29918,
9933,
29898,
1311,
1125,
13,
12,
12,
2457,
313,
2435,
29898,
1311,
17255,
1972,
703,
6404,
1024,
3895,
21120,
29918,
6207,
5754,
1134,
2433,
2371,
29915,
5300,
1024,
2433,
29908,
718,
1583,
29889,
3891,
2435,
420,
718,
13577,
5783,
1405,
29871,
29900,
29897,
13,
13,
12,
1753,
4770,
1972,
29898,
1311,
29892,
4576,
1125,
13,
12,
12,
2541,
1583,
29889,
13082,
29901,
13,
12,
12,
12,
2457,
1583,
29889,
13082,
29889,
18127,
2141,
7978,
29898,
2850,
467,
9155,
497,
580,
13,
13,
12,
1753,
4770,
657,
29898,
1311,
29892,
988,
2433,
29374,
13,
12,
12,
2850,
353,
525,
6404,
1024,
29892,
7328,
29892,
637,
3895,
525,
718,
1583,
29889,
3891,
2435,
420,
13,
12,
12,
2850,
4619,
525,
5754,
525,
718,
988,
565,
7431,
29898,
3062,
29897,
1405,
29871,
29900,
1683,
6629,
13,
12,
12,
351,
1237,
353,
6571,
13,
12,
12,
1454,
1948,
297,
1583,
17255,
1972,
29898,
2850,
1125,
13,
12,
12,
12,
351,
1237,
29961,
798,
29961,
29900,
5262,
353,
11117,
4668,
29886,
7061,
2396,
1948,
29961,
29896,
1402,
525,
4668,
29886,
2290,
2396,
1948,
29961,
29906,
12258,
13,
12,
12,
2457,
19518,
13,
13,
12,
29937,
3462,
19518,
13,
12,
1753,
788,
29898,
1311,
29892,
19518,
1125,
13,
12,
12,
2541,
1583,
29889,
13082,
29901,
13,
12,
12,
12,
29883,
353,
1583,
29889,
13082,
29889,
18127,
580,
13,
12,
12,
12,
1454,
1820,
297,
19518,
29901,
13,
12,
12,
12,
12,
7328,
353,
851,
29898,
351,
1237,
29961,
1989,
22322,
4668,
29886,
7061,
11287,
13,
12,
12,
12,
12,
637,
353,
851,
29898,
524,
29898,
351,
1237,
29961,
1989,
22322,
4668,
29886,
2290,
25901,
13,
12,
12,
12,
12,
29883,
29889,
7978,
877,
19460,
11646,
525,
718,
1583,
29889,
3891,
2435,
420,
718,
376,
15673,
6702,
29908,
718,
1820,
718,
376,
3788,
29908,
718,
3211,
718,
376,
742,
29908,
718,
2011,
718,
16521,
1159,
13,
12,
12,
12,
1311,
29889,
13082,
29889,
15060,
580,
13,
13,
12,
29937,
736,
736,
491,
1024,
13,
12,
1753,
679,
29918,
1609,
29918,
978,
29898,
1311,
29892,
1024,
1125,
13,
12,
12,
3062,
353,
376,
978,
2433,
29908,
718,
1024,
718,
376,
11838,
13,
12,
12,
2457,
1583,
17255,
657,
29898,
3062,
29897,
13,
13,
12,
29937,
7106,
599,
19518,
13,
12,
1753,
679,
29918,
497,
29898,
1311,
1125,
13,
12,
12,
2457,
1583,
17255,
657,
580,
13,
13,
12,
29937,
5217,
599,
19518,
13,
12,
1753,
5217,
29918,
497,
29898,
1311,
1125,
13,
12,
12,
2541,
1583,
29889,
13082,
29901,
13,
12,
12,
12,
29883,
353,
1583,
29889,
13082,
29889,
18127,
580,
13,
12,
12,
12,
29883,
29889,
7978,
703,
2287,
18476,
3895,
376,
718,
1583,
29889,
3891,
2435,
420,
29897,
13,
12,
12,
12,
1311,
29889,
13082,
29889,
15060,
580,
13,
13,
12,
29937,
5217,
10823,
491,
1024,
13,
12,
1753,
5217,
29918,
1609,
29918,
978,
29898,
1311,
29892,
1024,
1125,
13,
12,
12,
29883,
353,
1583,
29889,
13082,
29889,
18127,
580,
13,
12,
12,
29883,
29889,
7978,
703,
2287,
18476,
3895,
376,
718,
1583,
29889,
3891,
2435,
420,
718,
376,
5754,
1024,
2433,
29908,
718,
1024,
718,
13577,
1159,
13,
12,
12,
1311,
29889,
13082,
29889,
15060,
580,
13,
2
] |
illud/ansi/escape_codes/control.py | AustinScola/illud | 1 | 117352 | """ANSI escape code prefixes for control escape codes."""
ESCAPE = '\x1b'
CONTROL_SEQUENCE_INTRODUCER = ESCAPE + '['
| [
1,
9995,
2190,
5425,
10169,
775,
10944,
267,
363,
2761,
10169,
11561,
1213,
15945,
13,
2890,
29907,
3301,
29923,
353,
11297,
29916,
29896,
29890,
29915,
13,
22412,
1672,
29931,
29918,
1660,
13356,
1430,
4741,
29918,
10192,
1672,
14849,
29907,
1001,
353,
382,
7187,
3301,
29923,
718,
525,
1839,
13,
2
] |
agc/agc007/agc007a.py | c-yan/atcoder | 1 | 19495 | H, W = map(int, input().split())
A = [input() for _ in range(H)]
if H + W - 1 == sum(a.count('#') for a in A):
print('Possible')
else:
print('Impossible')
| [
1,
379,
29892,
399,
353,
2910,
29898,
524,
29892,
1881,
2141,
5451,
3101,
13,
29909,
353,
518,
2080,
580,
363,
903,
297,
3464,
29898,
29950,
4638,
13,
13,
361,
379,
718,
399,
448,
29871,
29896,
1275,
2533,
29898,
29874,
29889,
2798,
14237,
1495,
363,
263,
297,
319,
1125,
13,
1678,
1596,
877,
9135,
1687,
1495,
13,
2870,
29901,
13,
1678,
1596,
877,
1888,
27338,
1495,
13,
2
] |
libs/clustermatch/settings.py | miltondp/clustermatch-gene-expr | 0 | 1613851 | """
General settings. This file is intended to be modified by the user. Each entry
also provides an alternative way to specify its value using an environment
variable.
"""
# Instead of changing this file, you can also use the environment variable name
# specified for each entry (environment variables supersede these settings).
# Specifies the main directory where all data and results generated are stored.
# When setting up the environment for the first time, input data will be
# automatically downloaded into a subfolder of ROOT_DIR.
#
# Default: if not specified (None), it defaults to the 'cm_gene_expr' subfolder
# in the temporary directory of the operating system (i.e. '/tmp/cm_gene_expr'
# in Unix systems).
# Environment variable: CM_ROOT_DIR
ROOT_DIR = None
# Specifies the directory where the manuscript git repository was
# cloned/downloaded. If None, manuscript figures and other related files will
# not be generated.
#
# Default: None
# Environment variable: CM_MANUSCRIPT_DIR
MANUSCRIPT_DIR = None
#
# CPU usage
#
# Amount of cores to use for general usage.
#
# Default: half of available cores.
# Environment variable: CM_N_JOBS
N_JOBS = None
# Number of cores to use for low-computational tasks (IO, etc). This number
# can be greater than N_JOBS.
#
# Default: same as N_JOBS.
# Environment variable: CM_N_JOBS_LOW
N_JOBS_LOW = None
| [
1,
9995,
13,
15263,
6055,
29889,
910,
934,
338,
9146,
304,
367,
9120,
491,
278,
1404,
29889,
7806,
6251,
13,
15189,
8128,
385,
8671,
982,
304,
6084,
967,
995,
773,
385,
5177,
13,
11918,
29889,
13,
15945,
29908,
13,
13,
29937,
8669,
310,
6480,
445,
934,
29892,
366,
508,
884,
671,
278,
5177,
2286,
1024,
13,
29937,
6790,
363,
1269,
6251,
313,
20944,
3651,
480,
6774,
2742,
1438,
6055,
467,
13,
13,
29937,
12048,
11057,
278,
1667,
3884,
988,
599,
848,
322,
2582,
5759,
526,
6087,
29889,
13,
29937,
1932,
4444,
701,
278,
5177,
363,
278,
937,
931,
29892,
1881,
848,
674,
367,
13,
29937,
6336,
16532,
964,
263,
1014,
12083,
310,
16641,
2891,
29918,
9464,
29889,
13,
29937,
13,
29937,
13109,
29901,
565,
451,
6790,
313,
8516,
511,
372,
21274,
304,
278,
525,
4912,
29918,
29887,
1600,
29918,
13338,
29915,
1014,
12083,
13,
29937,
297,
278,
13201,
3884,
310,
278,
13598,
1788,
313,
29875,
29889,
29872,
29889,
8207,
7050,
29914,
4912,
29918,
29887,
1600,
29918,
13338,
29915,
13,
29937,
297,
26663,
6757,
467,
13,
29937,
16738,
2286,
29901,
315,
29924,
29918,
21289,
29918,
9464,
13,
21289,
29918,
9464,
353,
6213,
13,
13,
29937,
12048,
11057,
278,
3884,
988,
278,
27593,
6315,
9810,
471,
13,
29937,
1067,
22367,
29914,
10382,
287,
29889,
960,
6213,
29892,
27593,
13994,
322,
916,
4475,
2066,
674,
13,
29937,
451,
367,
5759,
29889,
13,
29937,
13,
29937,
13109,
29901,
6213,
13,
29937,
16738,
2286,
29901,
315,
29924,
29918,
27616,
3308,
29907,
24290,
29918,
9464,
13,
27616,
3308,
29907,
24290,
29918,
9464,
353,
6213,
13,
13,
13,
29937,
13,
29937,
10808,
8744,
13,
29937,
13,
13,
29937,
1913,
792,
310,
28337,
304,
671,
363,
2498,
8744,
29889,
13,
29937,
13,
29937,
13109,
29901,
4203,
310,
3625,
28337,
29889,
13,
29937,
16738,
2286,
29901,
315,
29924,
29918,
29940,
29918,
29967,
29949,
9851,
13,
29940,
29918,
29967,
29949,
9851,
353,
6213,
13,
13,
29937,
9681,
310,
28337,
304,
671,
363,
4482,
29899,
12097,
1288,
9595,
313,
5971,
29892,
2992,
467,
910,
1353,
13,
29937,
508,
367,
7621,
1135,
405,
29918,
29967,
29949,
9851,
29889,
13,
29937,
13,
29937,
13109,
29901,
1021,
408,
405,
29918,
29967,
29949,
9851,
29889,
13,
29937,
16738,
2286,
29901,
315,
29924,
29918,
29940,
29918,
29967,
29949,
9851,
29918,
27998,
13,
29940,
29918,
29967,
29949,
9851,
29918,
27998,
353,
6213,
13,
2
] |
genesis/__main__.py | gjolly/genesis | 1 | 181855 | <reponame>gjolly/genesis<gh_stars>1-10
import genesis.build
if __name__ == '__main__':
genesis.build.main()
| [
1,
529,
276,
1112,
420,
29958,
29887,
29926,
18368,
29914,
1885,
6656,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
2531,
6656,
29889,
4282,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
2531,
6656,
29889,
4282,
29889,
3396,
580,
13,
2
] |
bcs-ui/backend/helm/toolkit/deployer.py | jamesgetx/bk-bcs | 0 | 193054 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import contextlib
import logging
import tempfile
from pathlib import Path
from typing import Dict, List, NewType, Optional, Union
import attr
from celery import shared_task
from django.utils.crypto import get_random_string
from backend.helm.helm import models
from backend.helm.helm.providers.constants import PUBLIC_REPO_URL
from backend.helm.toolkit.kubehelm.helm import KubeHelmClient
from backend.helm.toolkit.kubehelm.options import RawFlag
from backend.packages.blue_krill.data_types.enum import StructuredEnum
from backend.utils import client as bcs_client
from backend.utils.error_codes import error_codes
logger = logging.getLogger(__name__)
ArgsDict = NewType('ArgsDict', Dict[str, Union[str, List[RawFlag]]])
VALUESFILE_KEY = '--valuesfile'
class HelmOperation(str, StructuredEnum):
INSTALL = 'install'
UPGRADE = 'upgrade'
UNINSTALL = 'uninstall'
ROLLBACK = 'rollback'
@attr.s(auto_attribs=True)
class ReleaseArgs:
"""HelmDeployer 的执行参数.
options 有序示例 [
{"--valuesfile": {"file_name": "", "file_content": ""}},
{"--set": "a=1"},
{"--valuesfile": {"file_name": "", "file_content": ""}}
{"--post-renderer": {"bcs_inject_data": ""}}
]
其他参考官方 options https://helm.sh/docs/helm/helm_install/#options
"""
project_id: str
cluster_id: str
# release name
name: str
namespace: str
operator: str
chart_url: str
options: List[RawFlag] = attr.field(factory=list)
@classmethod
def from_dict(cls, init_data: Dict) -> 'ReleaseArgs':
field_names = [f.name for f in attr.fields(cls)]
return cls(**{k: v for k, v in init_data.items() if k in field_names})
class HelmDeployer:
"""
only for helm3 use absolute url as chart args
"""
def __init__(self, access_token: str, helm_args: ReleaseArgs):
self.access_token = access_token
self.helm_args = helm_args
def install(self):
self.run_with_helm(HelmOperation.INSTALL)
def upgrade(self):
self.run_with_helm(HelmOperation.UPGRADE)
def uninstall(self):
self.run_with_helm(HelmOperation.UNINSTALL)
def run_with_helm(self, op: str):
"""执行 Helm 命令
:param op: helm 操作, 如 install, upgrade 等
"""
err_msg = ''
with bcs_client.make_helm_client(
project_id=self.helm_args.project_id,
cluster_id=self.helm_args.cluster_id,
access_token=self.access_token,
) as (client, err):
if err is not None:
err_msg = f'make helm client failed for cluster({self.helm_args.cluster_id}): {err}'
if not err_msg:
try:
self._run_with_helm(client, op)
except Exception as e:
err_msg = f'helm {op} failed in cluster({self.helm_args.cluster_id}): {e}'
if err_msg:
raise error_codes.ComponentError(err_msg)
def _run_with_helm(self, helm_client: KubeHelmClient, op: str):
self._inject_auth_options()
with self._reconfigure_values_and_post_renderer():
if op == HelmOperation.UNINSTALL:
helm_client.uninstall(self.helm_args.name, self.helm_args.namespace)
elif op in [HelmOperation.INSTALL, HelmOperation.UPGRADE]:
helm_client.do_install_or_upgrade(
op,
self.helm_args.name,
self.helm_args.namespace,
self.helm_args.chart_url,
self.helm_args.options,
)
else:
raise NotImplementedError(f'unsupported op {op}')
def _inject_auth_options(self):
"""注入用户凭证"""
# chart_url 如 'http://repo.example.com/bcs-public-project/helm-public-repo/charts/xxx-operator-0.5.0.tgz'
chart_url = self.helm_args.chart_url
repo_url = chart_url.partition('/charts/')[0]
if repo_url == PUBLIC_REPO_URL: # 平台公共仓库不需要auth信息
return
repository = models.Repository.objects.filter(
url__startswith=repo_url, project_id=self.helm_args.project_id
).first()
if not repository: # 非平台chart repo url,由用户决定--username xxx --password xxx
return
credentials = models.RepositoryAuth.objects.get(repo=repository).credentials_decoded
self.helm_args.options.extend(
[{'--username': credentials['username']}, {'--password': credentials['password']}]
)
@contextlib.contextmanager
def _reconfigure_values_and_post_renderer(self):
"""整理 values, 增加 post-renderer
TODO 增加 ytt 的 post-renderer 支持
"""
idx_list = self._find_valuesfile()
if not idx_list:
yield
else:
# 如果 options 包含 --valuesfile, 需要生成临时 values 文件
with tempfile.TemporaryDirectory() as temp_dir:
# 为了保留原始 options 的顺序,通过找到索引重新赋值
for idx in idx_list:
# --valuesfile 非 helm 官方 flag, 需要转换成 --values
self.helm_args.options[idx] = {
'--values': self._write_values(temp_dir, self.helm_args.options[idx][VALUESFILE_KEY])
}
yield
def _find_valuesfile(self) -> List[int]:
"""查找 options 中 --valuesfile 的配置位置"""
idx_list = []
for idx, flag in enumerate(self.helm_args.options):
if isinstance(flag, dict) and VALUESFILE_KEY in flag.keys():
idx_list.append(idx)
return idx_list
def _write_values(self, temp_dir: str, valuesfile: Dict[str, str]) -> str:
"""将 valuesfile 中的内容写入文件
:param valuesfile: {'file_name': '', 'file_content': ''}
:return 写入的文件位置
"""
path = Path(temp_dir) / valuesfile['file_name']
path.write_text(valuesfile['file_content'])
return str(path.resolve())
def make_valuesfile_flag(values: str, file_name: Optional[str] = None) -> RawFlag:
return RawFlag(
{VALUESFILE_KEY: {'file_content': values, 'file_name': file_name or f'{get_random_string(12)}.yaml'}}
)
@shared_task
def helm_install(access_token: str, release_args: ArgsDict) -> Optional[str]:
try:
deployer = HelmDeployer(access_token=access_token, helm_args=ReleaseArgs.from_dict(release_args))
deployer.install()
except Exception as e:
return _generate_err_msg(HelmOperation.INSTALL, release_args, e)
@shared_task
def helm_upgrade(access_token: str, release_args: ArgsDict) -> Optional[str]:
try:
deployer = HelmDeployer(access_token=access_token, helm_args=ReleaseArgs.from_dict(release_args))
deployer.upgrade()
except Exception as e:
return _generate_err_msg(HelmOperation.UPGRADE, release_args, e)
@shared_task
def helm_uninstall(access_token: str, release_args: ArgsDict) -> Optional[str]:
try:
deployer = HelmDeployer(access_token=access_token, helm_args=ReleaseArgs.from_dict(release_args))
deployer.uninstall()
except Exception as e:
err_msg = _generate_err_msg(HelmOperation.UNINSTALL, release_args, e)
# 忽略 release: not found 的错误
if 'release: not found' in err_msg:
return
return err_msg
def _generate_err_msg(op: str, release_args: ArgsDict, e: Exception) -> str:
err_msg = (
f"helm {op} {release_args['name']} -n {release_args['namespace']} failed "
f"in cluster({release_args['cluster_id']}): {e}"
)
logger.error(err_msg)
return err_msg
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29911,
264,
1760,
338,
22301,
304,
2304,
278,
1722,
2752,
7881,
491,
3907,
29871,
235,
150,
160,
236,
181,
187,
31676,
31784,
29925,
7340,
29903,
30606,
31037,
30564,
30467,
30845,
313,
21319,
29968,
292,
2621,
29874,
29903,
19184,
13,
3853,
654,
29897,
3625,
29889,
13,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29955,
29899,
29906,
29900,
29906,
29896,
3446,
29931,
319,
29906,
29929,
28873,
29892,
263,
12444,
1760,
5001,
29889,
2178,
10462,
21676,
29889,
13,
29931,
293,
21144,
1090,
278,
341,
1806,
19245,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
3492,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
1678,
1732,
597,
22156,
1167,
29889,
990,
29914,
506,
11259,
29914,
26349,
13,
13,
2525,
2222,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13235,
1090,
278,
19245,
338,
13235,
373,
13,
273,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
19245,
363,
278,
13,
14940,
4086,
14765,
1076,
11239,
322,
27028,
1090,
278,
19245,
29889,
13,
15945,
29908,
13,
5215,
3030,
1982,
13,
5215,
12183,
13,
5215,
5694,
1445,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
360,
919,
29892,
2391,
29892,
1570,
1542,
29892,
28379,
29892,
7761,
13,
13,
5215,
12421,
13,
3166,
6432,
708,
1053,
7258,
29918,
7662,
13,
3166,
9557,
29889,
13239,
29889,
29883,
17929,
1053,
679,
29918,
8172,
29918,
1807,
13,
13,
3166,
14998,
29889,
9421,
29889,
9421,
1053,
4733,
13,
3166,
14998,
29889,
9421,
29889,
9421,
29889,
771,
29454,
29889,
3075,
1934,
1053,
349,
7466,
27888,
29918,
1525,
13152,
29918,
4219,
13,
3166,
14998,
29889,
9421,
29889,
10154,
7354,
29889,
29895,
4003,
9421,
29889,
9421,
1053,
476,
4003,
7658,
29885,
4032,
13,
3166,
14998,
29889,
9421,
29889,
10154,
7354,
29889,
29895,
4003,
9421,
29889,
6768,
1053,
22038,
21979,
13,
3166,
14998,
29889,
8318,
29889,
9539,
29918,
12748,
453,
29889,
1272,
29918,
8768,
29889,
18605,
1053,
28771,
2955,
16854,
13,
3166,
14998,
29889,
13239,
1053,
3132,
408,
289,
2395,
29918,
4645,
13,
3166,
14998,
29889,
13239,
29889,
2704,
29918,
18137,
1053,
1059,
29918,
18137,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
7883,
21533,
353,
1570,
1542,
877,
7883,
21533,
742,
360,
919,
29961,
710,
29892,
7761,
29961,
710,
29892,
2391,
29961,
22131,
21979,
5262,
2314,
13,
13,
8932,
12996,
7724,
29918,
10818,
353,
525,
489,
5975,
1445,
29915,
13,
13,
13,
1990,
6162,
29885,
10925,
29898,
710,
29892,
28771,
2955,
16854,
1125,
13,
1678,
2672,
1254,
9818,
353,
525,
6252,
29915,
13,
1678,
11901,
29954,
4717,
2287,
353,
525,
786,
8228,
29915,
13,
1678,
8291,
25580,
9818,
353,
525,
348,
6252,
29915,
13,
1678,
16641,
2208,
29933,
11375,
353,
525,
1245,
1627,
29915,
13,
13,
13,
29992,
5552,
29889,
29879,
29898,
6921,
29918,
1131,
1091,
29879,
29922,
5574,
29897,
13,
1990,
23708,
7883,
29901,
13,
1678,
9995,
7658,
29885,
8498,
2376,
261,
29871,
30210,
233,
140,
170,
30448,
31125,
30354,
29889,
13,
13,
1678,
3987,
29871,
30417,
31463,
30858,
31507,
518,
13,
1678,
8853,
489,
5975,
1445,
1115,
8853,
1445,
29918,
978,
1115,
12633,
376,
1445,
29918,
3051,
1115,
5124,
11656,
13,
1678,
8853,
489,
842,
1115,
376,
29874,
29922,
29896,
10758,
13,
1678,
8853,
489,
5975,
1445,
1115,
8853,
1445,
29918,
978,
1115,
12633,
376,
1445,
29918,
3051,
1115,
5124,
930,
13,
1678,
8853,
489,
2490,
29899,
9482,
261,
1115,
8853,
29890,
2395,
29918,
21920,
29918,
1272,
1115,
5124,
930,
13,
1678,
4514,
13,
268,
31149,
31221,
31125,
235,
131,
134,
31694,
30525,
3987,
2045,
597,
9421,
29889,
845,
29914,
2640,
29914,
9421,
29914,
9421,
29918,
6252,
8484,
6768,
13,
1678,
9995,
13,
13,
1678,
2060,
29918,
333,
29901,
851,
13,
1678,
9867,
29918,
333,
29901,
851,
13,
1678,
396,
6507,
1024,
13,
1678,
1024,
29901,
851,
13,
1678,
7397,
29901,
851,
13,
1678,
5455,
29901,
851,
13,
1678,
8727,
29918,
2271,
29901,
851,
13,
1678,
3987,
29901,
2391,
29961,
22131,
21979,
29962,
353,
12421,
29889,
2671,
29898,
14399,
29922,
1761,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
8977,
29898,
25932,
29892,
2069,
29918,
1272,
29901,
360,
919,
29897,
1599,
525,
19729,
7883,
2396,
13,
4706,
1746,
29918,
7039,
353,
518,
29888,
29889,
978,
363,
285,
297,
12421,
29889,
9621,
29898,
25932,
4638,
13,
4706,
736,
1067,
29879,
29898,
1068,
29912,
29895,
29901,
325,
363,
413,
29892,
325,
297,
2069,
29918,
1272,
29889,
7076,
580,
565,
413,
297,
1746,
29918,
7039,
1800,
13,
13,
13,
1990,
6162,
29885,
8498,
2376,
261,
29901,
13,
1678,
9995,
13,
1678,
871,
363,
1081,
29885,
29941,
671,
8380,
3142,
408,
8727,
6389,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2130,
29918,
6979,
29901,
851,
29892,
1081,
29885,
29918,
5085,
29901,
23708,
7883,
1125,
13,
4706,
1583,
29889,
5943,
29918,
6979,
353,
2130,
29918,
6979,
13,
4706,
1583,
29889,
9421,
29918,
5085,
353,
1081,
29885,
29918,
5085,
13,
13,
1678,
822,
2601,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3389,
29918,
2541,
29918,
9421,
29898,
7658,
29885,
10925,
29889,
25580,
9818,
29897,
13,
13,
1678,
822,
14955,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3389,
29918,
2541,
29918,
9421,
29898,
7658,
29885,
10925,
29889,
4897,
29954,
4717,
2287,
29897,
13,
13,
1678,
822,
27608,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3389,
29918,
2541,
29918,
9421,
29898,
7658,
29885,
10925,
29889,
3904,
25580,
9818,
29897,
13,
13,
1678,
822,
1065,
29918,
2541,
29918,
9421,
29898,
1311,
29892,
1015,
29901,
851,
1125,
13,
4706,
9995,
233,
140,
170,
30448,
6162,
29885,
29871,
31237,
31650,
13,
13,
4706,
584,
3207,
1015,
29901,
1081,
29885,
29871,
31904,
30732,
29892,
29871,
30847,
2601,
29892,
14955,
29871,
31184,
13,
4706,
9995,
13,
4706,
4589,
29918,
7645,
353,
6629,
13,
13,
4706,
411,
289,
2395,
29918,
4645,
29889,
5675,
29918,
9421,
29918,
4645,
29898,
13,
9651,
2060,
29918,
333,
29922,
1311,
29889,
9421,
29918,
5085,
29889,
4836,
29918,
333,
29892,
13,
9651,
9867,
29918,
333,
29922,
1311,
29889,
9421,
29918,
5085,
29889,
19594,
29918,
333,
29892,
13,
9651,
2130,
29918,
6979,
29922,
1311,
29889,
5943,
29918,
6979,
29892,
13,
4706,
1723,
408,
313,
4645,
29892,
4589,
1125,
13,
9651,
565,
4589,
338,
451,
6213,
29901,
13,
18884,
4589,
29918,
7645,
353,
285,
29915,
5675,
1081,
29885,
3132,
5229,
363,
9867,
3319,
1311,
29889,
9421,
29918,
5085,
29889,
19594,
29918,
333,
29913,
1125,
426,
3127,
10162,
13,
13,
9651,
565,
451,
4589,
29918,
7645,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
1583,
3032,
3389,
29918,
2541,
29918,
9421,
29898,
4645,
29892,
1015,
29897,
13,
18884,
5174,
8960,
408,
321,
29901,
13,
462,
1678,
4589,
29918,
7645,
353,
285,
29915,
9421,
426,
459,
29913,
5229,
297,
9867,
3319,
1311,
29889,
9421,
29918,
5085,
29889,
19594,
29918,
333,
29913,
1125,
426,
29872,
10162,
13,
13,
4706,
565,
4589,
29918,
7645,
29901,
13,
9651,
12020,
1059,
29918,
18137,
29889,
5308,
2392,
29898,
3127,
29918,
7645,
29897,
13,
13,
1678,
822,
903,
3389,
29918,
2541,
29918,
9421,
29898,
1311,
29892,
1081,
29885,
29918,
4645,
29901,
476,
4003,
7658,
29885,
4032,
29892,
1015,
29901,
851,
1125,
13,
4706,
1583,
3032,
21920,
29918,
5150,
29918,
6768,
580,
13,
4706,
411,
1583,
3032,
276,
17591,
29918,
5975,
29918,
392,
29918,
2490,
29918,
9482,
261,
7295,
13,
9651,
565,
1015,
1275,
6162,
29885,
10925,
29889,
3904,
25580,
9818,
29901,
13,
18884,
1081,
29885,
29918,
4645,
29889,
348,
6252,
29898,
1311,
29889,
9421,
29918,
5085,
29889,
978,
29892,
1583,
29889,
9421,
29918,
5085,
29889,
22377,
29897,
13,
9651,
25342,
1015,
297,
518,
7658,
29885,
10925,
29889,
25580,
9818,
29892,
6162,
29885,
10925,
29889,
4897,
29954,
4717,
2287,
5387,
13,
18884,
1081,
29885,
29918,
4645,
29889,
1867,
29918,
6252,
29918,
272,
29918,
786,
8228,
29898,
13,
462,
1678,
1015,
29892,
13,
462,
1678,
1583,
29889,
9421,
29918,
5085,
29889,
978,
29892,
13,
462,
1678,
1583,
29889,
9421,
29918,
5085,
29889,
22377,
29892,
13,
462,
1678,
1583,
29889,
9421,
29918,
5085,
29889,
15425,
29918,
2271,
29892,
13,
462,
1678,
1583,
29889,
9421,
29918,
5085,
29889,
6768,
29892,
13,
18884,
1723,
13,
9651,
1683,
29901,
13,
18884,
12020,
2216,
1888,
2037,
287,
2392,
29898,
29888,
29915,
348,
23765,
1015,
426,
459,
29913,
1495,
13,
13,
1678,
822,
903,
21920,
29918,
5150,
29918,
6768,
29898,
1311,
1125,
13,
4706,
9995,
31368,
30752,
30406,
31229,
232,
138,
176,
235,
178,
132,
15945,
29908,
13,
13,
4706,
396,
8727,
29918,
2271,
29871,
30847,
525,
1124,
597,
20095,
29889,
4773,
29889,
510,
29914,
29890,
2395,
29899,
3597,
29899,
4836,
29914,
9421,
29899,
3597,
29899,
20095,
29914,
18366,
29914,
12353,
29899,
6891,
29899,
29900,
29889,
29945,
29889,
29900,
29889,
29873,
18828,
29915,
13,
4706,
8727,
29918,
2271,
353,
1583,
29889,
9421,
29918,
5085,
29889,
15425,
29918,
2271,
13,
4706,
13761,
29918,
2271,
353,
8727,
29918,
2271,
29889,
16707,
11219,
18366,
29914,
29861,
29900,
29962,
13,
4706,
565,
13761,
29918,
2271,
1275,
349,
7466,
27888,
29918,
1525,
13152,
29918,
4219,
29901,
29871,
396,
29871,
30606,
31037,
30539,
31611,
231,
190,
150,
31700,
30413,
31383,
30698,
5150,
30689,
31021,
13,
9651,
736,
13,
13,
4706,
9810,
353,
4733,
29889,
11481,
29889,
12650,
29889,
4572,
29898,
13,
9651,
3142,
1649,
27382,
2541,
29922,
20095,
29918,
2271,
29892,
2060,
29918,
333,
29922,
1311,
29889,
9421,
29918,
5085,
29889,
4836,
29918,
333,
13,
4706,
13742,
4102,
580,
13,
4706,
565,
451,
9810,
29901,
29871,
396,
29871,
31838,
30606,
31037,
15425,
13761,
3142,
30214,
31272,
30406,
31229,
232,
137,
182,
30495,
489,
6786,
921,
4419,
1192,
5630,
921,
4419,
13,
9651,
736,
13,
13,
4706,
16140,
353,
4733,
29889,
11481,
6444,
29889,
12650,
29889,
657,
29898,
20095,
29922,
19033,
467,
11944,
9409,
29918,
7099,
6797,
13,
4706,
1583,
29889,
9421,
29918,
5085,
29889,
6768,
29889,
21843,
29898,
13,
9651,
518,
10998,
489,
6786,
2396,
16140,
1839,
6786,
2033,
1118,
11117,
489,
5630,
2396,
16140,
1839,
5630,
2033,
6525,
13,
4706,
1723,
13,
13,
1678,
732,
4703,
1982,
29889,
4703,
12847,
13,
1678,
822,
903,
276,
17591,
29918,
5975,
29918,
392,
29918,
2490,
29918,
9482,
261,
29898,
1311,
1125,
13,
4706,
9995,
233,
152,
183,
30687,
1819,
29892,
29871,
232,
165,
161,
30666,
1400,
29899,
9482,
261,
13,
13,
4706,
14402,
29871,
232,
165,
161,
30666,
343,
698,
29871,
30210,
1400,
29899,
9482,
261,
29871,
31541,
31695,
13,
4706,
9995,
13,
4706,
22645,
29918,
1761,
353,
1583,
3032,
2886,
29918,
5975,
1445,
580,
13,
4706,
565,
451,
22645,
29918,
1761,
29901,
13,
9651,
7709,
13,
4706,
1683,
29901,
13,
9651,
396,
29871,
30847,
30801,
3987,
29871,
31473,
232,
147,
174,
1192,
5975,
1445,
29892,
29871,
31383,
30698,
30486,
30494,
231,
187,
183,
30594,
1819,
29871,
30333,
30631,
13,
9651,
411,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
408,
5694,
29918,
3972,
29901,
13,
18884,
396,
29871,
30573,
30743,
30982,
234,
152,
156,
30667,
31020,
3987,
29871,
30210,
236,
164,
189,
31463,
30214,
30768,
31138,
233,
140,
193,
30780,
31836,
31674,
30908,
30374,
235,
184,
142,
30959,
13,
18884,
363,
22645,
297,
22645,
29918,
1761,
29901,
13,
462,
1678,
396,
1192,
5975,
1445,
29871,
31838,
1081,
29885,
29871,
31694,
30525,
7353,
29892,
29871,
31383,
30698,
31415,
31640,
30494,
1192,
5975,
13,
462,
1678,
1583,
29889,
9421,
29918,
5085,
29889,
6768,
29961,
13140,
29962,
353,
426,
13,
462,
4706,
525,
489,
5975,
2396,
1583,
3032,
3539,
29918,
5975,
29898,
7382,
29918,
3972,
29892,
1583,
29889,
9421,
29918,
5085,
29889,
6768,
29961,
13140,
3816,
8932,
12996,
7724,
29918,
10818,
2314,
13,
462,
1678,
500,
13,
18884,
7709,
13,
13,
1678,
822,
903,
2886,
29918,
5975,
1445,
29898,
1311,
29897,
1599,
2391,
29961,
524,
5387,
13,
4706,
9995,
31213,
233,
140,
193,
3987,
29871,
30275,
1192,
5975,
1445,
29871,
30210,
31361,
30669,
30956,
30669,
15945,
29908,
13,
4706,
22645,
29918,
1761,
353,
5159,
13,
4706,
363,
22645,
29892,
7353,
297,
26985,
29898,
1311,
29889,
9421,
29918,
5085,
29889,
6768,
1125,
13,
9651,
565,
338,
8758,
29898,
15581,
29892,
9657,
29897,
322,
15673,
7724,
29918,
10818,
297,
7353,
29889,
8149,
7295,
13,
18884,
22645,
29918,
1761,
29889,
4397,
29898,
13140,
29897,
13,
4706,
736,
22645,
29918,
1761,
13,
13,
1678,
822,
903,
3539,
29918,
5975,
29898,
1311,
29892,
5694,
29918,
3972,
29901,
851,
29892,
1819,
1445,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
851,
29901,
13,
4706,
9995,
30998,
1819,
1445,
29871,
30275,
30210,
30728,
31294,
31479,
30752,
30333,
30631,
13,
13,
4706,
584,
3207,
1819,
1445,
29901,
11117,
1445,
29918,
978,
2396,
15516,
525,
1445,
29918,
3051,
2396,
6629,
29913,
13,
4706,
584,
2457,
29871,
31479,
30752,
30210,
30333,
30631,
30956,
30669,
13,
4706,
9995,
13,
4706,
2224,
353,
10802,
29898,
7382,
29918,
3972,
29897,
847,
1819,
1445,
1839,
1445,
29918,
978,
2033,
13,
4706,
2224,
29889,
3539,
29918,
726,
29898,
5975,
1445,
1839,
1445,
29918,
3051,
11287,
13,
4706,
736,
851,
29898,
2084,
29889,
17863,
3101,
13,
13,
13,
1753,
1207,
29918,
5975,
1445,
29918,
15581,
29898,
5975,
29901,
851,
29892,
934,
29918,
978,
29901,
28379,
29961,
710,
29962,
353,
6213,
29897,
1599,
22038,
21979,
29901,
13,
1678,
736,
22038,
21979,
29898,
13,
4706,
426,
8932,
12996,
7724,
29918,
10818,
29901,
11117,
1445,
29918,
3051,
2396,
1819,
29892,
525,
1445,
29918,
978,
2396,
934,
29918,
978,
470,
285,
29915,
29912,
657,
29918,
8172,
29918,
1807,
29898,
29896,
29906,
29512,
25162,
29915,
930,
13,
1678,
1723,
13,
13,
13,
29992,
12366,
29918,
7662,
13,
1753,
1081,
29885,
29918,
6252,
29898,
5943,
29918,
6979,
29901,
851,
29892,
6507,
29918,
5085,
29901,
826,
3174,
21533,
29897,
1599,
28379,
29961,
710,
5387,
13,
1678,
1018,
29901,
13,
4706,
7246,
261,
353,
6162,
29885,
8498,
2376,
261,
29898,
5943,
29918,
6979,
29922,
5943,
29918,
6979,
29892,
1081,
29885,
29918,
5085,
29922,
19729,
7883,
29889,
3166,
29918,
8977,
29898,
14096,
29918,
5085,
876,
13,
4706,
7246,
261,
29889,
6252,
580,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
736,
903,
17158,
29918,
3127,
29918,
7645,
29898,
7658,
29885,
10925,
29889,
25580,
9818,
29892,
6507,
29918,
5085,
29892,
321,
29897,
13,
13,
13,
29992,
12366,
29918,
7662,
13,
1753,
1081,
29885,
29918,
786,
8228,
29898,
5943,
29918,
6979,
29901,
851,
29892,
6507,
29918,
5085,
29901,
826,
3174,
21533,
29897,
1599,
28379,
29961,
710,
5387,
13,
1678,
1018,
29901,
13,
4706,
7246,
261,
353,
6162,
29885,
8498,
2376,
261,
29898,
5943,
29918,
6979,
29922,
5943,
29918,
6979,
29892,
1081,
29885,
29918,
5085,
29922,
19729,
7883,
29889,
3166,
29918,
8977,
29898,
14096,
29918,
5085,
876,
13,
4706,
7246,
261,
29889,
786,
8228,
580,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
736,
903,
17158,
29918,
3127,
29918,
7645,
29898,
7658,
29885,
10925,
29889,
4897,
29954,
4717,
2287,
29892,
6507,
29918,
5085,
29892,
321,
29897,
13,
13,
13,
29992,
12366,
29918,
7662,
13,
1753,
1081,
29885,
29918,
348,
6252,
29898,
5943,
29918,
6979,
29901,
851,
29892,
6507,
29918,
5085,
29901,
826,
3174,
21533,
29897,
1599,
28379,
29961,
710,
5387,
13,
1678,
1018,
29901,
13,
4706,
7246,
261,
353,
6162,
29885,
8498,
2376,
261,
29898,
5943,
29918,
6979,
29922,
5943,
29918,
6979,
29892,
1081,
29885,
29918,
5085,
29922,
19729,
7883,
29889,
3166,
29918,
8977,
29898,
14096,
29918,
5085,
876,
13,
4706,
7246,
261,
29889,
348,
6252,
580,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
4589,
29918,
7645,
353,
903,
17158,
29918,
3127,
29918,
7645,
29898,
7658,
29885,
10925,
29889,
3904,
25580,
9818,
29892,
6507,
29918,
5085,
29892,
321,
29897,
13,
4706,
396,
29871,
232,
194,
192,
234,
152,
168,
6507,
29901,
451,
1476,
29871,
30210,
31745,
235,
178,
178,
13,
4706,
565,
525,
14096,
29901,
451,
1476,
29915,
297,
4589,
29918,
7645,
29901,
13,
9651,
736,
13,
4706,
736,
4589,
29918,
7645,
13,
13,
13,
1753,
903,
17158,
29918,
3127,
29918,
7645,
29898,
459,
29901,
851,
29892,
6507,
29918,
5085,
29901,
826,
3174,
21533,
29892,
321,
29901,
8960,
29897,
1599,
851,
29901,
13,
1678,
4589,
29918,
7645,
353,
313,
13,
4706,
285,
29908,
9421,
426,
459,
29913,
426,
14096,
29918,
5085,
1839,
978,
2033,
29913,
448,
29876,
426,
14096,
29918,
5085,
1839,
22377,
2033,
29913,
5229,
376,
13,
4706,
285,
29908,
262,
9867,
3319,
14096,
29918,
5085,
1839,
19594,
29918,
333,
2033,
29913,
1125,
426,
29872,
5038,
13,
1678,
1723,
13,
1678,
17927,
29889,
2704,
29898,
3127,
29918,
7645,
29897,
13,
1678,
736,
4589,
29918,
7645,
13,
2
] |
hw1/deco.py | Tymeade/otus-python | 0 | 35253 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import update_wrapper, wraps
def disable(func):
"""
Disable a decorator by re-assigning the decorator's name
to this function. For example, to turn off memoization:
>>> memo = disable
"""
return func
def decorator(decorator_func):
"""
Decorate a decorator so that it inherits the docstrings
and stuff from the function it's decorating.
"""
return update_wrapper(decorator_func, 1)
def countcalls(func):
"""Decorator that counts calls made to the function decorated."""
@wraps(func)
def wrapped(*args, **kwargs):
wrapped.calls += 1
return func(*args, **kwargs)
wrapped.calls = 0
return wrapped
def memo(func):
"""
Memoize a function so that it caches all return values for
faster future lookups.
"""
memory = {}
@wraps(func)
def decorated(*args):
if args in memory:
return memory[args]
answer = func(*args)
memory[args] = answer
return answer
return decorated
def n_ary(func):
"""
Given binary function f(x, y), return an n_ary function such
that f(x, y, z) = f(x, f(y,z)), etc. Also allow f(x) = x.
"""
@wraps(func)
def wrapped(*args):
if len(args) == 1:
return args[0]
if len(args) == 2:
return func(*args)
return func(args[0], wrapped(*args[1:]))
return wrapped
def trace(ident):
"""Trace calls made to function decorated.
@trace("____")
def fib(n):
....
>>> fib(3)
--> fib(3)
____ --> fib(2)
________ --> fib(1)
________ <-- fib(1) == 1
________ --> fib(0)
________ <-- fib(0) == 1
____ <-- fib(2) == 2
____ --> fib(1)
____ <-- fib(1) == 1
<-- fib(3) == 3
"""
def deco(func):
@wraps(func)
def wrapped(*args, **kwargs):
arguments = [str(a) for a in args] + ["%s=%s" % (key, value) for key, value in kwargs.iteritems()]
argument_string = ",".join(arguments)
func_name = "%s(%s)" % (func.__name__, argument_string)
wrapped.call_level += 1
print ident * wrapped.call_level, "-->", func_name
answer = func(*args, **kwargs)
print ident * wrapped.call_level, "<--", func_name, "==", answer
wrapped.call_level -= 1
return answer
wrapped.call_level = 0
return wrapped
return deco
@memo
@countcalls
@n_ary
def foo(a, b):
return a + b
@countcalls
@memo
@n_ary
def bar(a, b):
return a * b
@countcalls
@trace("####")
@memo
def fib(n):
"""Some doc"""
return 1 if n <= 1 else fib(n-1) + fib(n-2)
def main():
print foo(4, 3)
print foo(4, 3, 2)
print foo(4, 3)
print "foo was called", foo.calls, "times"
print bar(4, 3)
print bar(4, 3, 2)
print bar(4, 3, 2, 1)
print "bar was called", bar.calls, "times"
print fib.__doc__
fib(3)
print fib.calls, 'calls made'
if __name__ == '__main__':
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
3166,
2090,
312,
8789,
1053,
2767,
29918,
17699,
29892,
11463,
567,
13,
13,
13,
1753,
11262,
29898,
9891,
1125,
13,
1678,
9995,
13,
1678,
3295,
519,
263,
10200,
1061,
491,
337,
29899,
16645,
292,
278,
10200,
1061,
29915,
29879,
1024,
13,
1678,
304,
445,
740,
29889,
1152,
1342,
29892,
304,
2507,
1283,
2626,
29877,
2133,
29901,
13,
13,
1678,
8653,
2626,
29877,
353,
11262,
13,
13,
1678,
9995,
13,
1678,
736,
3653,
13,
13,
13,
1753,
10200,
1061,
29898,
19557,
1061,
29918,
9891,
1125,
13,
1678,
9995,
13,
1678,
3826,
272,
403,
263,
10200,
1061,
577,
393,
372,
7846,
1169,
278,
1574,
19651,
13,
1678,
322,
6433,
515,
278,
740,
372,
29915,
29879,
10200,
1218,
29889,
13,
1678,
9995,
13,
1678,
736,
2767,
29918,
17699,
29898,
19557,
1061,
29918,
9891,
29892,
29871,
29896,
29897,
13,
13,
13,
1753,
2302,
29883,
4293,
29898,
9891,
1125,
13,
1678,
9995,
6185,
272,
1061,
393,
18139,
5717,
1754,
304,
278,
740,
10200,
630,
1213,
15945,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
21021,
29889,
29883,
4293,
4619,
29871,
29896,
13,
4706,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
21021,
29889,
29883,
4293,
353,
29871,
29900,
13,
1678,
736,
21021,
13,
13,
13,
1753,
2626,
29877,
29898,
9891,
1125,
13,
1678,
9995,
13,
1678,
8133,
29877,
675,
263,
740,
577,
393,
372,
274,
14520,
599,
736,
1819,
363,
13,
1678,
8473,
5434,
1106,
14340,
29889,
13,
1678,
9995,
13,
1678,
3370,
353,
6571,
13,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
10200,
630,
10456,
5085,
1125,
13,
4706,
565,
6389,
297,
3370,
29901,
13,
9651,
736,
3370,
29961,
5085,
29962,
13,
13,
4706,
1234,
353,
3653,
10456,
5085,
29897,
13,
4706,
3370,
29961,
5085,
29962,
353,
1234,
13,
13,
4706,
736,
1234,
13,
13,
1678,
736,
10200,
630,
13,
13,
13,
1753,
302,
29918,
653,
29898,
9891,
1125,
13,
1678,
9995,
13,
1678,
11221,
7581,
740,
285,
29898,
29916,
29892,
343,
511,
736,
385,
302,
29918,
653,
740,
1316,
13,
1678,
393,
285,
29898,
29916,
29892,
343,
29892,
503,
29897,
353,
285,
29898,
29916,
29892,
285,
29898,
29891,
29892,
29920,
8243,
2992,
29889,
3115,
2758,
285,
29898,
29916,
29897,
353,
921,
29889,
13,
1678,
9995,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
1125,
13,
4706,
565,
7431,
29898,
5085,
29897,
1275,
29871,
29896,
29901,
13,
9651,
736,
6389,
29961,
29900,
29962,
13,
4706,
565,
7431,
29898,
5085,
29897,
1275,
29871,
29906,
29901,
13,
9651,
736,
3653,
10456,
5085,
29897,
13,
4706,
736,
3653,
29898,
5085,
29961,
29900,
1402,
21021,
10456,
5085,
29961,
29896,
29901,
12622,
13,
1678,
736,
21021,
13,
13,
13,
1753,
9637,
29898,
1693,
1125,
13,
1678,
9995,
11591,
5717,
1754,
304,
740,
10200,
630,
29889,
13,
13,
1678,
732,
15003,
703,
7652,
1159,
13,
1678,
822,
18755,
29898,
29876,
1125,
13,
4706,
13035,
13,
13,
1678,
8653,
18755,
29898,
29941,
29897,
13,
268,
6660,
18755,
29898,
29941,
29897,
13,
1678,
903,
22359,
6660,
18755,
29898,
29906,
29897,
13,
1678,
903,
7652,
22359,
6660,
18755,
29898,
29896,
29897,
13,
1678,
903,
7652,
22359,
529,
489,
18755,
29898,
29896,
29897,
1275,
29871,
29896,
13,
1678,
903,
7652,
22359,
6660,
18755,
29898,
29900,
29897,
13,
1678,
903,
7652,
22359,
529,
489,
18755,
29898,
29900,
29897,
1275,
29871,
29896,
13,
1678,
903,
22359,
529,
489,
18755,
29898,
29906,
29897,
1275,
29871,
29906,
13,
1678,
903,
22359,
6660,
18755,
29898,
29896,
29897,
13,
1678,
903,
22359,
529,
489,
18755,
29898,
29896,
29897,
1275,
29871,
29896,
13,
268,
529,
489,
18755,
29898,
29941,
29897,
1275,
29871,
29941,
13,
13,
1678,
9995,
13,
1678,
822,
316,
1111,
29898,
9891,
1125,
13,
13,
4706,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
4706,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
9651,
6273,
353,
518,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
29962,
718,
6796,
29995,
29879,
16328,
29879,
29908,
1273,
313,
1989,
29892,
995,
29897,
363,
1820,
29892,
995,
297,
9049,
5085,
29889,
1524,
7076,
580,
29962,
13,
9651,
2980,
29918,
1807,
353,
9162,
1642,
7122,
29898,
25699,
29897,
13,
9651,
3653,
29918,
978,
353,
11860,
29879,
29414,
29879,
5513,
1273,
313,
9891,
17255,
978,
1649,
29892,
2980,
29918,
1807,
29897,
13,
9651,
21021,
29889,
4804,
29918,
5563,
4619,
29871,
29896,
13,
9651,
1596,
2893,
334,
21021,
29889,
4804,
29918,
5563,
29892,
376,
15110,
613,
3653,
29918,
978,
13,
9651,
1234,
353,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
9651,
1596,
2893,
334,
21021,
29889,
4804,
29918,
5563,
29892,
9872,
489,
613,
3653,
29918,
978,
29892,
376,
26359,
29892,
1234,
13,
9651,
21021,
29889,
4804,
29918,
5563,
22361,
29871,
29896,
13,
9651,
736,
1234,
13,
13,
4706,
21021,
29889,
4804,
29918,
5563,
353,
29871,
29900,
13,
4706,
736,
21021,
13,
13,
1678,
736,
316,
1111,
13,
13,
13,
29992,
6954,
29877,
13,
29992,
2798,
29883,
4293,
13,
29992,
29876,
29918,
653,
13,
1753,
7953,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
718,
289,
13,
13,
13,
29992,
2798,
29883,
4293,
13,
29992,
6954,
29877,
13,
29992,
29876,
29918,
653,
13,
1753,
2594,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
334,
289,
13,
13,
13,
29992,
2798,
29883,
4293,
13,
29992,
15003,
703,
4136,
1159,
13,
29992,
6954,
29877,
13,
1753,
18755,
29898,
29876,
1125,
13,
1678,
9995,
9526,
1574,
15945,
29908,
13,
1678,
736,
29871,
29896,
565,
302,
5277,
29871,
29896,
1683,
18755,
29898,
29876,
29899,
29896,
29897,
718,
18755,
29898,
29876,
29899,
29906,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1596,
7953,
29898,
29946,
29892,
29871,
29941,
29897,
13,
1678,
1596,
7953,
29898,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29897,
13,
1678,
1596,
7953,
29898,
29946,
29892,
29871,
29941,
29897,
13,
1678,
1596,
376,
5431,
471,
2000,
613,
7953,
29889,
29883,
4293,
29892,
376,
3706,
29908,
13,
13,
1678,
1596,
2594,
29898,
29946,
29892,
29871,
29941,
29897,
13,
1678,
1596,
2594,
29898,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29897,
13,
1678,
1596,
2594,
29898,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
29897,
13,
1678,
1596,
376,
1646,
471,
2000,
613,
2594,
29889,
29883,
4293,
29892,
376,
3706,
29908,
13,
13,
1678,
1596,
18755,
17255,
1514,
1649,
13,
1678,
18755,
29898,
29941,
29897,
13,
1678,
1596,
18755,
29889,
29883,
4293,
29892,
525,
29883,
4293,
1754,
29915,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
mitzasql/db/connection.py | vladbalmos/mitzasql | 69 | 165577 | # Copyright (c) 2021 <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
# See LICENSE file
import time
from datetime import datetime
import copy
import urwid
import mysql.connector
from mysql.connector import (errorcode, errors)
from ..logger import (LoggerMixin, logger)
class Connection(LoggerMixin):
SIGNAL_EXCEPTION = 'exception'
QUERY_LOG = []
def __init__(self, connection_data, session_name=None):
self.set_log_prefix('Connection')
self.is_tcp = False
self.database = None
self._retry_count = 0
self.con = self._create_mysql_connection(connection_data)
self._connection_data = connection_data
try:
self.session_name = connection_data['name']
except KeyError:
self.session_name = session_name
urwid.register_signal(self.__class__, [self.SIGNAL_EXCEPTION])
def _create_mysql_connection(self, connection_data):
kwargs = {
'user': connection_data['username'],
'password': connection_data['password'],
'connection_timeout': 5,
'autocommit': True
}
protocol, host = self._extract_host(connection_data['host'])
if protocol == 'tcp':
kwargs['host'] = host
kwargs['port'] = connection_data['port']
self.is_tcp = True
else:
kwargs['unix_socket'] = host
if 'database' in connection_data and len(connection_data['database']) > 0:
kwargs['database'] = connection_data['database']
self.database = connection_data['database']
kwargs['get_warnings'] = True
con = mysql.connector.connect(**kwargs)
self._retry_count = 0
return con
@property
def fresh(self):
con_data = copy.deepcopy(self._connection_data)
if self.database:
con_data['database'] = self.database
elif 'database' in con_data:
del con_data['database']
con = self.__class__(con_data, self.session_name)
return con
def _retry_connection(self):
self.log_info("Disconnected. Retrying mysql connection...")
if self._retry_count >= 5:
return False
try:
self.con = self._create_mysql_connection(self._connection_data)
if self.database:
self.change_db(self.database)
return True
except errors.OperationalError as e:
self._retry_count += 1
time.sleep(1)
return self._retry_connection()
def _extract_host(self, host):
if host.startswith('unix://'):
protocol = 'unix'
hostname = host[7:]
else:
protocol = 'tcp'
hostname = host[6:]
return (protocol, hostname)
@property
def host(self):
protocol, host = self._extract_host(self._connection_data['host'])
return host
@property
def port(self):
return self._connection_data['port']
def close(self):
return self.con.close()
@property
def cursor(self):
return self.con.cursor(buffered=True)
@property
def dict_cursor(self):
return self.con.cursor(buffered=True, dictionary=True)
def query(self, query, params=None, dictionary=False, multi=False):
start = time.time()
self.log_debug('Query: %s. Params: %s', str(query), str(params))
try:
if dictionary is False:
cursor = self.cursor
else:
cursor = self.dict_cursor
result = cursor.execute(query, params=params, multi=multi)
if multi == True:
return result
return cursor
except errors.OperationalError as e:
# Retry connection if exception is "MySQL Connection not available"
self.log_exception('Query exception: %s', e)
if self._retry_connection():
return self.query(query, params=params, dictionary=dictionary, multi=multi)
raise e
except errors.Error as e:
self.log_exception('Query exception: %s', e)
raise e
finally:
now = time.time()
duration = now - start
Connection.QUERY_LOG.append((datetime.now(), query, params, duration))
def change_db(self, name):
self.database = name
query = 'USE `{0}`'.format(name);
self.query(query);
def is_fatal_error(self, error):
if isinstance(error, errors.OperationalError):
return True
if isinstance(error, errors.InterfaceError):
if error.msg == 'Use cmd_query_iter for statements with multiple queries.':
return False
if error.msg == 'Use multi=True when executing multiple statements':
return False
return True
if isinstance(errors, errors.NotSupportedError):
return True
return False
@classmethod
def factory(cls, connection_data, session_name=None):
try:
instance = cls(connection_data, session_name)
except mysql.connector.Error as err:
logger.exception('Connection exception %s', err)
return (None, err)
return (instance, None)
@classmethod
def test(cls, connection_data):
connection, err = cls.factory(connection_data)
if connection is None:
return (False, str(err))
connection.close()
return (True, None)
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29896,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
2823,
365,
2965,
1430,
1660,
934,
13,
13,
5215,
931,
13,
3166,
12865,
1053,
12865,
13,
5215,
3509,
13,
13,
5215,
5065,
9163,
13,
5215,
5749,
29889,
11958,
2801,
13,
3166,
5749,
29889,
11958,
2801,
1053,
313,
2704,
401,
29892,
4436,
29897,
13,
13,
3166,
6317,
21707,
1053,
313,
16363,
29924,
861,
262,
29892,
17927,
29897,
13,
13,
1990,
15160,
29898,
16363,
29924,
861,
262,
1125,
13,
1678,
317,
17298,
1964,
29918,
5746,
4741,
7982,
2725,
353,
525,
11739,
29915,
13,
1678,
660,
29965,
24422,
29918,
14480,
353,
5159,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3957,
29918,
1272,
29892,
4867,
29918,
978,
29922,
8516,
1125,
13,
4706,
1583,
29889,
842,
29918,
1188,
29918,
13506,
877,
5350,
1495,
13,
4706,
1583,
29889,
275,
29918,
23981,
353,
7700,
13,
4706,
1583,
29889,
9803,
353,
6213,
13,
4706,
1583,
3032,
276,
2202,
29918,
2798,
353,
29871,
29900,
13,
4706,
1583,
29889,
535,
353,
1583,
3032,
3258,
29918,
7938,
29918,
9965,
29898,
9965,
29918,
1272,
29897,
13,
4706,
1583,
3032,
9965,
29918,
1272,
353,
3957,
29918,
1272,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
7924,
29918,
978,
353,
3957,
29918,
1272,
1839,
978,
2033,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
1583,
29889,
7924,
29918,
978,
353,
4867,
29918,
978,
13,
4706,
5065,
9163,
29889,
9573,
29918,
25436,
29898,
1311,
17255,
1990,
1649,
29892,
518,
1311,
29889,
5425,
20728,
1964,
29918,
5746,
4741,
7982,
2725,
2314,
13,
13,
1678,
822,
903,
3258,
29918,
7938,
29918,
9965,
29898,
1311,
29892,
3957,
29918,
1272,
1125,
13,
4706,
9049,
5085,
353,
426,
13,
18884,
525,
1792,
2396,
3957,
29918,
1272,
1839,
6786,
7464,
13,
18884,
525,
5630,
2396,
3957,
29918,
1272,
1839,
5630,
7464,
13,
18884,
525,
9965,
29918,
15619,
2396,
29871,
29945,
29892,
13,
18884,
525,
6921,
15060,
2396,
5852,
13,
18884,
500,
13,
13,
4706,
9608,
29892,
3495,
353,
1583,
3032,
21111,
29918,
3069,
29898,
9965,
29918,
1272,
1839,
3069,
11287,
13,
4706,
565,
9608,
1275,
525,
23981,
2396,
13,
9651,
9049,
5085,
1839,
3069,
2033,
353,
3495,
13,
9651,
9049,
5085,
1839,
637,
2033,
353,
3957,
29918,
1272,
1839,
637,
2033,
13,
9651,
1583,
29889,
275,
29918,
23981,
353,
5852,
13,
4706,
1683,
29901,
13,
9651,
9049,
5085,
1839,
24538,
29918,
11514,
2033,
353,
3495,
13,
13,
4706,
565,
525,
9803,
29915,
297,
3957,
29918,
1272,
322,
7431,
29898,
9965,
29918,
1272,
1839,
9803,
11287,
1405,
29871,
29900,
29901,
13,
9651,
9049,
5085,
1839,
9803,
2033,
353,
3957,
29918,
1272,
1839,
9803,
2033,
13,
9651,
1583,
29889,
9803,
353,
3957,
29918,
1272,
1839,
9803,
2033,
13,
13,
4706,
9049,
5085,
1839,
657,
29918,
25442,
886,
2033,
353,
5852,
13,
13,
4706,
378,
353,
5749,
29889,
11958,
2801,
29889,
6915,
29898,
1068,
19290,
29897,
13,
4706,
1583,
3032,
276,
2202,
29918,
2798,
353,
29871,
29900,
13,
4706,
736,
378,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10849,
29898,
1311,
1125,
13,
4706,
378,
29918,
1272,
353,
3509,
29889,
24535,
8552,
29898,
1311,
3032,
9965,
29918,
1272,
29897,
13,
4706,
565,
1583,
29889,
9803,
29901,
13,
9651,
378,
29918,
1272,
1839,
9803,
2033,
353,
1583,
29889,
9803,
13,
4706,
25342,
525,
9803,
29915,
297,
378,
29918,
1272,
29901,
13,
9651,
628,
378,
29918,
1272,
1839,
9803,
2033,
13,
4706,
378,
353,
1583,
17255,
1990,
12035,
535,
29918,
1272,
29892,
1583,
29889,
7924,
29918,
978,
29897,
13,
4706,
736,
378,
13,
13,
1678,
822,
903,
276,
2202,
29918,
9965,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1188,
29918,
3888,
703,
4205,
18045,
29889,
4649,
719,
292,
5749,
3957,
856,
1159,
13,
4706,
565,
1583,
3032,
276,
2202,
29918,
2798,
6736,
29871,
29945,
29901,
13,
9651,
736,
7700,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
535,
353,
1583,
3032,
3258,
29918,
7938,
29918,
9965,
29898,
1311,
3032,
9965,
29918,
1272,
29897,
13,
9651,
565,
1583,
29889,
9803,
29901,
13,
18884,
1583,
29889,
3167,
29918,
2585,
29898,
1311,
29889,
9803,
29897,
13,
9651,
736,
5852,
13,
4706,
5174,
4436,
29889,
7094,
1288,
2392,
408,
321,
29901,
13,
9651,
1583,
3032,
276,
2202,
29918,
2798,
4619,
29871,
29896,
13,
9651,
931,
29889,
17059,
29898,
29896,
29897,
13,
9651,
736,
1583,
3032,
276,
2202,
29918,
9965,
580,
13,
13,
1678,
822,
903,
21111,
29918,
3069,
29898,
1311,
29892,
3495,
1125,
13,
4706,
565,
3495,
29889,
27382,
2541,
877,
24538,
597,
29374,
13,
9651,
9608,
353,
525,
24538,
29915,
13,
9651,
3495,
978,
353,
3495,
29961,
29955,
17531,
13,
4706,
1683,
29901,
13,
9651,
9608,
353,
525,
23981,
29915,
13,
9651,
3495,
978,
353,
3495,
29961,
29953,
17531,
13,
13,
4706,
736,
313,
20464,
29892,
3495,
978,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3495,
29898,
1311,
1125,
13,
4706,
9608,
29892,
3495,
353,
1583,
3032,
21111,
29918,
3069,
29898,
1311,
3032,
9965,
29918,
1272,
1839,
3069,
11287,
13,
4706,
736,
3495,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2011,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
9965,
29918,
1272,
1839,
637,
2033,
13,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
535,
29889,
5358,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10677,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
535,
29889,
18127,
29898,
9040,
287,
29922,
5574,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
9657,
29918,
18127,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
535,
29889,
18127,
29898,
9040,
287,
29922,
5574,
29892,
8600,
29922,
5574,
29897,
13,
13,
1678,
822,
2346,
29898,
1311,
29892,
2346,
29892,
8636,
29922,
8516,
29892,
8600,
29922,
8824,
29892,
2473,
29922,
8824,
1125,
13,
4706,
1369,
353,
931,
29889,
2230,
580,
13,
4706,
1583,
29889,
1188,
29918,
8382,
877,
3010,
29901,
1273,
29879,
29889,
1459,
2232,
29901,
1273,
29879,
742,
851,
29898,
1972,
511,
851,
29898,
7529,
876,
13,
4706,
1018,
29901,
13,
9651,
565,
8600,
338,
7700,
29901,
13,
18884,
10677,
353,
1583,
29889,
18127,
13,
9651,
1683,
29901,
13,
18884,
10677,
353,
1583,
29889,
8977,
29918,
18127,
13,
9651,
1121,
353,
10677,
29889,
7978,
29898,
1972,
29892,
8636,
29922,
7529,
29892,
2473,
29922,
9910,
29897,
13,
13,
9651,
565,
2473,
1275,
5852,
29901,
13,
18884,
736,
1121,
13,
13,
9651,
736,
10677,
13,
4706,
5174,
4436,
29889,
7094,
1288,
2392,
408,
321,
29901,
13,
9651,
396,
4649,
719,
3957,
565,
3682,
338,
376,
3421,
4176,
15160,
451,
3625,
29908,
13,
9651,
1583,
29889,
1188,
29918,
11739,
877,
3010,
3682,
29901,
1273,
29879,
742,
321,
29897,
13,
9651,
565,
1583,
3032,
276,
2202,
29918,
9965,
7295,
13,
18884,
736,
1583,
29889,
1972,
29898,
1972,
29892,
8636,
29922,
7529,
29892,
8600,
29922,
27126,
29892,
2473,
29922,
9910,
29897,
13,
9651,
12020,
321,
13,
4706,
5174,
4436,
29889,
2392,
408,
321,
29901,
13,
9651,
1583,
29889,
1188,
29918,
11739,
877,
3010,
3682,
29901,
1273,
29879,
742,
321,
29897,
13,
9651,
12020,
321,
13,
4706,
7146,
29901,
13,
9651,
1286,
353,
931,
29889,
2230,
580,
13,
9651,
14385,
353,
1286,
448,
1369,
13,
9651,
15160,
29889,
13356,
24422,
29918,
14480,
29889,
4397,
3552,
12673,
29889,
3707,
3285,
2346,
29892,
8636,
29892,
14385,
876,
13,
13,
1678,
822,
1735,
29918,
2585,
29898,
1311,
29892,
1024,
1125,
13,
4706,
1583,
29889,
9803,
353,
1024,
13,
4706,
2346,
353,
525,
17171,
23230,
29900,
10114,
4286,
4830,
29898,
978,
416,
13,
4706,
1583,
29889,
1972,
29898,
1972,
416,
13,
13,
1678,
822,
338,
29918,
29888,
2075,
29918,
2704,
29898,
1311,
29892,
1059,
1125,
13,
4706,
565,
338,
8758,
29898,
2704,
29892,
4436,
29889,
7094,
1288,
2392,
1125,
13,
9651,
736,
5852,
13,
13,
4706,
565,
338,
8758,
29898,
2704,
29892,
4436,
29889,
10448,
2392,
1125,
13,
9651,
565,
1059,
29889,
7645,
1275,
525,
11403,
9920,
29918,
1972,
29918,
1524,
363,
9506,
411,
2999,
9365,
29889,
2396,
13,
18884,
736,
7700,
13,
9651,
565,
1059,
29889,
7645,
1275,
525,
11403,
2473,
29922,
5574,
746,
14012,
2999,
9506,
2396,
13,
18884,
736,
7700,
13,
9651,
736,
5852,
13,
13,
4706,
565,
338,
8758,
29898,
12523,
29892,
4436,
29889,
3664,
14039,
287,
2392,
1125,
13,
9651,
736,
5852,
13,
13,
4706,
736,
7700,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
12529,
29898,
25932,
29892,
3957,
29918,
1272,
29892,
4867,
29918,
978,
29922,
8516,
1125,
13,
4706,
1018,
29901,
13,
9651,
2777,
353,
1067,
29879,
29898,
9965,
29918,
1272,
29892,
4867,
29918,
978,
29897,
13,
4706,
5174,
5749,
29889,
11958,
2801,
29889,
2392,
408,
4589,
29901,
13,
9651,
17927,
29889,
11739,
877,
5350,
3682,
1273,
29879,
742,
4589,
29897,
13,
9651,
736,
313,
8516,
29892,
4589,
29897,
13,
4706,
736,
313,
8758,
29892,
6213,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1243,
29898,
25932,
29892,
3957,
29918,
1272,
1125,
13,
4706,
3957,
29892,
4589,
353,
1067,
29879,
29889,
14399,
29898,
9965,
29918,
1272,
29897,
13,
4706,
565,
3957,
338,
6213,
29901,
13,
9651,
736,
313,
8824,
29892,
851,
29898,
3127,
876,
13,
4706,
3957,
29889,
5358,
580,
13,
4706,
736,
313,
5574,
29892,
6213,
29897,
13,
2
] |
main.py | iandaamerican/ItsSpresDiscordBot | 0 | 98513 | import os
import requests
import json
import discord
from discord.ext import commands
client = commands.Bot(command_prefix=commands.when_mentioned_or("d/","D/"),help_command=None)
#api key references
my_secret = os.environ['TOKEN']
apiSecret = os.environ['apexApi']
#notify me when bot has come online
@client.event
async def on_ready():
print('bot is now online!!!!')
@client.event
async def on_message(message):
msg_content = message.content.lower()
#bot command
atCommandMap = ["!map"]
if any(word in msg_content for word in atCommandMap):
r = requests.get(f"https://api.mozambiquehe.re/maprotation?version=2&auth={apiSecret}")
if r is None:
print("api is not working")
else:
j=r.json()
#battleRoyale Maps
currentMapName = j["battle_royale"]["current"]["map"]
nextMapName = j["battle_royale"]["next"]["map"]
timeRemaining = j["battle_royale"]["current"]["remainingMins"]
await message.channel.send(f"Current Map: {currentMapName}\nNext Map: {nextMapName}\nTime Remaining: {timeRemaining}")
client.run(my_secret)
| [
1,
1053,
2897,
13,
5215,
7274,
13,
5215,
4390,
13,
5215,
2313,
536,
13,
3166,
2313,
536,
29889,
1062,
1053,
8260,
13,
13,
13,
4645,
353,
8260,
29889,
29933,
327,
29898,
6519,
29918,
13506,
29922,
26381,
29889,
8256,
29918,
358,
28487,
29918,
272,
703,
29881,
29914,
3284,
29928,
29914,
4968,
8477,
29918,
6519,
29922,
8516,
29897,
13,
13,
29937,
2754,
1820,
9282,
29871,
13,
1357,
29918,
19024,
353,
2897,
29889,
21813,
1839,
4986,
29968,
1430,
2033,
13,
2754,
28459,
353,
2897,
29889,
21813,
1839,
4085,
29916,
11713,
2033,
13,
13,
29937,
25140,
592,
746,
9225,
756,
2041,
7395,
13,
29992,
4645,
29889,
3696,
13,
12674,
822,
373,
29918,
2040,
7295,
13,
29871,
1596,
877,
7451,
338,
1286,
7395,
6824,
6824,
1495,
13,
13,
13,
29992,
4645,
29889,
3696,
29871,
13,
12674,
822,
373,
29918,
4906,
29898,
4906,
1125,
13,
29871,
10191,
29918,
3051,
353,
2643,
29889,
3051,
29889,
13609,
580,
13,
13,
13,
29871,
396,
7451,
1899,
13,
29871,
472,
6255,
3388,
353,
6796,
29991,
1958,
3108,
13,
13,
13,
29871,
565,
738,
29898,
1742,
297,
10191,
29918,
3051,
363,
1734,
297,
472,
6255,
3388,
1125,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
29888,
29908,
991,
597,
2754,
29889,
9781,
1117,
1387,
354,
29889,
276,
29914,
1958,
5450,
362,
29973,
3259,
29922,
29906,
29987,
5150,
3790,
2754,
28459,
27195,
13,
13,
1678,
565,
364,
338,
6213,
29901,
29871,
13,
418,
1596,
703,
2754,
338,
451,
1985,
1159,
13,
1678,
1683,
29901,
13,
418,
432,
29922,
29878,
29889,
3126,
580,
13,
13,
418,
396,
29890,
5315,
9588,
29891,
744,
25846,
13,
418,
1857,
3388,
1170,
353,
432,
3366,
29890,
5315,
29918,
4727,
744,
3108,
3366,
3784,
3108,
3366,
1958,
3108,
13,
418,
2446,
3388,
1170,
353,
432,
3366,
29890,
5315,
29918,
4727,
744,
3108,
3366,
4622,
3108,
3366,
1958,
3108,
13,
418,
931,
7301,
17225,
353,
432,
3366,
29890,
5315,
29918,
4727,
744,
3108,
3366,
3784,
3108,
3366,
1745,
17225,
29924,
1144,
3108,
13,
13,
13,
418,
7272,
2643,
29889,
12719,
29889,
6717,
29898,
29888,
29908,
7583,
7315,
29901,
426,
3784,
3388,
1170,
1012,
29876,
9190,
7315,
29901,
426,
4622,
3388,
1170,
1012,
29876,
2481,
5240,
17225,
29901,
426,
2230,
7301,
17225,
27195,
13,
13,
4645,
29889,
3389,
29898,
1357,
29918,
19024,
29897,
13,
13,
13,
2
] |
migration/lib/metadata_view.py | HumanCellAtlas/migration-service | 0 | 140636 | <gh_stars>0
import json
from .schema_reference import SchemaReference
class MetadataView(dict):
"""
A view representing the data that exists in a metadata file. The contents are stored as a dictionary with a
specific pointer to the metadata schema that was responsible for generating the view of the data as it is currently.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
@staticmethod
def from_file(path_to_metadata_json_file: str):
with open(path_to_metadata_json_file, 'r') as metadata_file:
metadata_dict = json.load(metadata_file)
return MetadataView(**metadata_dict)
@property
def schema_reference(self) -> SchemaReference:
return SchemaReference(self['describedBy'])
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
4390,
13,
13,
3166,
869,
11010,
29918,
5679,
1053,
1102,
2603,
7422,
13,
13,
13,
1990,
4737,
7221,
1043,
29898,
8977,
1125,
13,
1678,
9995,
13,
1678,
319,
1776,
15783,
278,
848,
393,
4864,
297,
263,
15562,
934,
29889,
450,
8118,
526,
6087,
408,
263,
8600,
411,
263,
13,
1678,
2702,
4879,
304,
278,
15562,
10938,
393,
471,
14040,
363,
14655,
278,
1776,
310,
278,
848,
408,
372,
338,
5279,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
1068,
19290,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
515,
29918,
1445,
29898,
2084,
29918,
517,
29918,
19635,
29918,
3126,
29918,
1445,
29901,
851,
1125,
13,
4706,
411,
1722,
29898,
2084,
29918,
517,
29918,
19635,
29918,
3126,
29918,
1445,
29892,
525,
29878,
1495,
408,
15562,
29918,
1445,
29901,
13,
9651,
15562,
29918,
8977,
353,
4390,
29889,
1359,
29898,
19635,
29918,
1445,
29897,
13,
4706,
736,
4737,
7221,
1043,
29898,
1068,
19635,
29918,
8977,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10938,
29918,
5679,
29898,
1311,
29897,
1599,
1102,
2603,
7422,
29901,
13,
4706,
736,
1102,
2603,
7422,
29898,
1311,
1839,
2783,
23059,
2059,
11287,
13,
2
] |
13.py | jakerella/advent2020 | 0 | 171386 | import sys
from helpers import read_data_file
print('\n************* Day 13 *************\n')
lines = read_data_file(sys.argv[1])
delay = int(lines[0])
bus_ids = list(map(lambda x:int(x) if x.isdigit() else x, lines[1].split(',')))
print(delay, bus_ids)
def part1():
next_bus = None
wait_time = 0
timestamp = delay
while next_bus is None:
for bus_id in filter(lambda x: type(x) is int, bus_ids):
if timestamp % bus_id == 0:
next_bus = bus_id
wait_time = timestamp - delay
timestamp += 1
print('bus', next_bus, 'will be here in', wait_time, ':', next_bus * wait_time)
def part2():
def get_bus(b):
if b == 'x':
return None
return (b, bus_ids.index(b))
bus_schedule = list(filter(lambda x: x != None, list(map(get_bus, bus_ids))))
# print(bus_schedule)
min_interval = bus_schedule[0][0]
timestamp = 0
for bus, index in bus_schedule[1:]:
while True:
if (timestamp + index) % bus == 0:
min_interval = bus * min_interval
break
timestamp += min_interval
print('start timestamp', timestamp)
part1()
part2()
| [
1,
1053,
10876,
13,
3166,
1371,
414,
1053,
1303,
29918,
1272,
29918,
1445,
13,
13,
2158,
28909,
29876,
4189,
2328,
29930,
8373,
29871,
29896,
29941,
334,
4189,
2328,
29905,
29876,
1495,
13,
13,
9012,
353,
1303,
29918,
1272,
29918,
1445,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
13,
18829,
353,
938,
29898,
9012,
29961,
29900,
2314,
13,
8262,
29918,
4841,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
524,
29898,
29916,
29897,
565,
921,
29889,
275,
26204,
580,
1683,
921,
29892,
3454,
29961,
29896,
1822,
5451,
29898,
3788,
4961,
13,
2158,
29898,
18829,
29892,
3593,
29918,
4841,
29897,
13,
13,
13,
1753,
760,
29896,
7295,
13,
1678,
2446,
29918,
8262,
353,
6213,
13,
1678,
4480,
29918,
2230,
353,
29871,
29900,
13,
1678,
14334,
353,
9055,
13,
1678,
1550,
2446,
29918,
8262,
338,
6213,
29901,
13,
4706,
363,
3593,
29918,
333,
297,
4175,
29898,
2892,
921,
29901,
1134,
29898,
29916,
29897,
338,
938,
29892,
3593,
29918,
4841,
1125,
13,
9651,
565,
14334,
1273,
3593,
29918,
333,
1275,
29871,
29900,
29901,
13,
18884,
2446,
29918,
8262,
353,
3593,
29918,
333,
13,
18884,
4480,
29918,
2230,
353,
14334,
448,
9055,
13,
4706,
14334,
4619,
29871,
29896,
13,
1678,
1596,
877,
8262,
742,
2446,
29918,
8262,
29892,
525,
14043,
367,
1244,
297,
742,
4480,
29918,
2230,
29892,
525,
29901,
742,
2446,
29918,
8262,
334,
4480,
29918,
2230,
29897,
13,
13,
13,
1753,
760,
29906,
7295,
13,
1678,
822,
679,
29918,
8262,
29898,
29890,
1125,
13,
4706,
565,
289,
1275,
525,
29916,
2396,
13,
9651,
736,
6213,
13,
4706,
736,
313,
29890,
29892,
3593,
29918,
4841,
29889,
2248,
29898,
29890,
876,
13,
1678,
3593,
29918,
816,
11272,
353,
1051,
29898,
4572,
29898,
2892,
921,
29901,
921,
2804,
6213,
29892,
1051,
29898,
1958,
29898,
657,
29918,
8262,
29892,
3593,
29918,
4841,
13697,
13,
1678,
396,
1596,
29898,
8262,
29918,
816,
11272,
29897,
13,
13,
1678,
1375,
29918,
19207,
353,
3593,
29918,
816,
11272,
29961,
29900,
3816,
29900,
29962,
13,
1678,
14334,
353,
29871,
29900,
13,
13,
1678,
363,
3593,
29892,
2380,
297,
3593,
29918,
816,
11272,
29961,
29896,
29901,
5387,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
313,
16394,
718,
2380,
29897,
1273,
3593,
1275,
29871,
29900,
29901,
13,
18884,
1375,
29918,
19207,
353,
3593,
334,
1375,
29918,
19207,
13,
18884,
2867,
13,
9651,
14334,
4619,
1375,
29918,
19207,
13,
13,
1678,
1596,
877,
2962,
14334,
742,
14334,
29897,
13,
13,
13,
1595,
29896,
580,
13,
1595,
29906,
580,
13,
2
] |
bronzeDataBuilder.py | lucaspettit/GifTheRipper | 0 | 62557 | import giphypop
import requests
from os import path, makedirs
from PIL import Image, ImagePalette
import io
import argparse
import json
import time
from Utils import init_dirs
limit = 100
giphy = giphypop.Giphy(api_key='')
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--src', type=str, required=True, help='Path to .JSON file with search terms')
parser.add_argument('--dest', type=str, required=True, help='Destination directory')
parser.add_argument('--limit', type=int, default=100, help='Limit the number of GIFs for each search')
parser.add_argument('--api-key', type=str, required=True, help='GIPHY API key')
args = parser.parse_args()
# verify limit value
if args.limit <= 0:
raise ValueError('parse_args: Invalid number for \'limit\'. Must be >= 1.')
# unpack api
if path.isfile(args.api_key):
ext = path.splitext(args.api_key)[-1]
if ext == '.json':
j = json.load(args.api_key)
if 'api' not in j:
raise ValueError('parse_args: Cannot find API. JSON file does not contain key \'api\'.')
args.api_key = j['api']
elif ext == '.txt':
with open(args.api_key) as f:
args.api_key = f.readline().strip('\n').strip()
else:
raise ValueError('parse_args: Cannot find API. Unrecognized file extension')
return parser.parse_args()
# function takes a GIF and returns a list of images
def gif2jpg(gifbytes):
try:
img = Image.open(io.BytesIO(gifbytes))
except IOError:
return []
i = 0
palette = img.getpalette()
images = []
try:
while True:
img.putpalette(palette)
next_image = Image.new("RGBA", img.size)
next_image.paste(img)
images.append(next_image.copy())
i += 1
img.seek(i)
except EOFError:
pass
return images
# load and validate arguments
args = parse_args()
dirnames = init_dirs()
logdir = dirnames['log']
resdir = dirnames['res']
configdir = dirnames['config']
if not path.isdir(args.dest):
makedirs(args.dest)
rootdir = args.dest
setname = path.basename(path.splitext(args.dest)[0])
logfilename = path.join(logdir, '%s-Log.txt' % setname)
configfilename = path.join(configdir, '%s-Config.json' % setname)
# load search words (type = list)
with open(args.src) as f:
categories = json.load(f)
if not isinstance(categories, dict):
raise ValueError('Cannot infer .json format')
# load config file
if path.isfile(configfilename):
with open(configfilename) as f:
config = json.load(f)
# mesh them together
config_titles = list(config.keys())
for config_tile in config_titles:
for category_title in categories.keys():
if category_title not in config:
config[category_title] = 0
else:
idx = config_titles.index(category_title)
del config_titles[idx]
for title in config_titles:
del config[title]
# create new config file
else:
config = {
title: {
term: 0 for term in terms
} for title, terms in categories.items()
}
with open(configfilename, 'w') as f:
json.dump(config, f)
categories = config
if not path.isfile(logfilename):
open(logfilename, 'w').close()
for category, terms in categories.items():
# create new directory if needed
outdir = path.join(rootdir, category)
if not path.isdir(outdir):
makedirs(outdir)
# write log file
logstr = 'category: %s\n' % category
with open(logfilename, 'a+') as f:
f.write(logstr)
print(logstr[:-1])
for term, start_index in terms.items():
logstr = ' term : %s\n' % term
logstr += ' start index: %d\n' % start_index
with open(logfilename, 'a+') as f:
f.write(logstr)
print(logstr[:-1])
# query for each term
start_t = time.time()
success = 0
num_url_failed = 0
num_save_failed = 0
for i, gif in enumerate(giphy.search(term, limit=limit)):
if (i + 1) % 10 == 0:
end_t = time.time()
logstr = ' ------------------------\n'
logstr += ' current index : %d\n' % (i + start_index)
logstr += ' gifs downloaded: %d\n' % success
logstr += ' url fails : %d\n' % num_url_failed
logstr += ' save fails : %d\n' % num_save_failed
logstr += ' time : %.2f\n' % (end_t - start_t)
with open(logfilename, 'a+') as f:
f.write(logstr)
print(logstr[:-1])
success = 0
num_url_failed = 0
num_save_failed = 0
# save config
config[category][term] = i + start_index
with open(configfilename, 'w') as f:
json.dump(config, f, indent=2)
start_t = time.time()
try:
url = gif.media_url
try:
r = requests.get(url)
data = r.content
filename = '%s_%d.gif' % (term, i)
open(path.join(outdir, filename), "wb+").write(data)
success += 1
except Exception as e:
num_save_failed += 1
except Exception as e:
num_url_failed += 1
print('done')
| [
1,
1053,
4005,
561,
1478,
459,
13,
5215,
7274,
13,
3166,
2897,
1053,
2224,
29892,
2136,
287,
12935,
13,
3166,
349,
6227,
1053,
7084,
29892,
7084,
29925,
26456,
13,
5215,
12013,
13,
5215,
1852,
5510,
13,
5215,
4390,
13,
5215,
931,
13,
13,
3166,
22310,
29879,
1053,
2069,
29918,
3972,
29879,
13,
13,
13400,
353,
29871,
29896,
29900,
29900,
13,
3146,
11461,
353,
4005,
561,
1478,
459,
29889,
26074,
11461,
29898,
2754,
29918,
1989,
2433,
1495,
13,
13,
13,
1753,
6088,
29918,
5085,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
4351,
742,
1134,
29922,
710,
29892,
3734,
29922,
5574,
29892,
1371,
2433,
2605,
304,
869,
7249,
934,
411,
2740,
4958,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
7854,
742,
1134,
29922,
710,
29892,
3734,
29922,
5574,
29892,
1371,
2433,
14994,
3381,
3884,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
13400,
742,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29900,
29900,
29892,
1371,
2433,
24445,
278,
1353,
310,
402,
6545,
29879,
363,
1269,
2740,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2754,
29899,
1989,
742,
1134,
29922,
710,
29892,
3734,
29922,
5574,
29892,
1371,
2433,
29954,
5690,
29950,
29979,
3450,
1820,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
396,
11539,
4046,
995,
13,
1678,
565,
6389,
29889,
13400,
5277,
29871,
29900,
29901,
13,
4706,
12020,
7865,
2392,
877,
5510,
29918,
5085,
29901,
21403,
1353,
363,
320,
29915,
13400,
29905,
4286,
19928,
367,
6736,
29871,
29896,
29889,
1495,
13,
13,
1678,
396,
443,
4058,
7882,
13,
1678,
565,
2224,
29889,
275,
1445,
29898,
5085,
29889,
2754,
29918,
1989,
1125,
13,
4706,
1294,
353,
2224,
29889,
23579,
568,
486,
29898,
5085,
29889,
2754,
29918,
1989,
9601,
29899,
29896,
29962,
13,
4706,
565,
1294,
1275,
15300,
3126,
2396,
13,
9651,
432,
353,
4390,
29889,
1359,
29898,
5085,
29889,
2754,
29918,
1989,
29897,
13,
9651,
565,
525,
2754,
29915,
451,
297,
432,
29901,
13,
18884,
12020,
7865,
2392,
877,
5510,
29918,
5085,
29901,
15808,
1284,
3450,
29889,
4663,
934,
947,
451,
1712,
1820,
320,
29915,
2754,
29905,
4286,
1495,
13,
9651,
6389,
29889,
2754,
29918,
1989,
353,
432,
1839,
2754,
2033,
13,
4706,
25342,
1294,
1275,
15300,
3945,
2396,
13,
9651,
411,
1722,
29898,
5085,
29889,
2754,
29918,
1989,
29897,
408,
285,
29901,
13,
18884,
6389,
29889,
2754,
29918,
1989,
353,
285,
29889,
949,
1220,
2141,
17010,
28909,
29876,
2824,
17010,
580,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
877,
5510,
29918,
5085,
29901,
15808,
1284,
3450,
29889,
853,
29423,
1891,
934,
6081,
1495,
13,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13,
29937,
740,
4893,
263,
402,
6545,
322,
3639,
263,
1051,
310,
4558,
13,
1753,
330,
361,
29906,
6173,
29898,
18660,
13193,
1125,
13,
1678,
1018,
29901,
13,
4706,
10153,
353,
7084,
29889,
3150,
29898,
601,
29889,
11207,
5971,
29898,
18660,
13193,
876,
13,
1678,
5174,
10663,
2392,
29901,
13,
4706,
736,
5159,
13,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
282,
26456,
353,
10153,
29889,
657,
29886,
26456,
580,
13,
1678,
4558,
353,
5159,
13,
13,
1678,
1018,
29901,
13,
4706,
1550,
5852,
29901,
13,
9651,
10153,
29889,
649,
29886,
26456,
29898,
29886,
26456,
29897,
13,
9651,
2446,
29918,
3027,
353,
7084,
29889,
1482,
703,
29934,
29954,
5688,
613,
10153,
29889,
2311,
29897,
13,
9651,
2446,
29918,
3027,
29889,
16179,
29898,
2492,
29897,
13,
9651,
4558,
29889,
4397,
29898,
4622,
29918,
3027,
29889,
8552,
3101,
13,
9651,
474,
4619,
29871,
29896,
13,
9651,
10153,
29889,
344,
1416,
29898,
29875,
29897,
13,
1678,
5174,
382,
9800,
2392,
29901,
13,
4706,
1209,
13,
13,
1678,
736,
4558,
13,
13,
13,
29937,
2254,
322,
12725,
6273,
13,
5085,
353,
6088,
29918,
5085,
580,
13,
3972,
7039,
353,
2069,
29918,
3972,
29879,
580,
13,
1188,
3972,
353,
4516,
7039,
1839,
1188,
2033,
13,
690,
3972,
353,
4516,
7039,
1839,
690,
2033,
13,
2917,
3972,
353,
4516,
7039,
1839,
2917,
2033,
13,
13,
361,
451,
2224,
29889,
275,
3972,
29898,
5085,
29889,
7854,
1125,
13,
1678,
2136,
287,
12935,
29898,
5085,
29889,
7854,
29897,
13,
13,
4632,
3972,
353,
6389,
29889,
7854,
13,
842,
978,
353,
2224,
29889,
6500,
3871,
29898,
2084,
29889,
23579,
568,
486,
29898,
5085,
29889,
7854,
9601,
29900,
2314,
13,
1188,
9507,
353,
2224,
29889,
7122,
29898,
1188,
3972,
29892,
14210,
29879,
29899,
3403,
29889,
3945,
29915,
1273,
731,
978,
29897,
13,
2917,
9507,
353,
2224,
29889,
7122,
29898,
2917,
3972,
29892,
14210,
29879,
29899,
3991,
29889,
3126,
29915,
1273,
731,
978,
29897,
13,
13,
29937,
2254,
2740,
3838,
313,
1853,
353,
1051,
29897,
13,
2541,
1722,
29898,
5085,
29889,
4351,
29897,
408,
285,
29901,
13,
1678,
13997,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
13,
361,
451,
338,
8758,
29898,
20683,
29892,
9657,
1125,
13,
1678,
12020,
7865,
2392,
877,
29089,
10115,
869,
3126,
3402,
1495,
13,
13,
29937,
2254,
2295,
934,
13,
361,
2224,
29889,
275,
1445,
29898,
2917,
9507,
1125,
13,
1678,
411,
1722,
29898,
2917,
9507,
29897,
408,
285,
29901,
13,
4706,
2295,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
13,
1678,
396,
27716,
963,
4208,
13,
1678,
2295,
29918,
23545,
793,
353,
1051,
29898,
2917,
29889,
8149,
3101,
13,
1678,
363,
2295,
29918,
29873,
488,
297,
2295,
29918,
23545,
793,
29901,
13,
4706,
363,
7663,
29918,
3257,
297,
13997,
29889,
8149,
7295,
13,
9651,
565,
7663,
29918,
3257,
451,
297,
2295,
29901,
13,
18884,
2295,
29961,
7320,
29918,
3257,
29962,
353,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
22645,
353,
2295,
29918,
23545,
793,
29889,
2248,
29898,
7320,
29918,
3257,
29897,
13,
18884,
628,
2295,
29918,
23545,
793,
29961,
13140,
29962,
13,
1678,
363,
3611,
297,
2295,
29918,
23545,
793,
29901,
13,
4706,
628,
2295,
29961,
3257,
29962,
13,
13,
29937,
1653,
716,
2295,
934,
13,
2870,
29901,
13,
1678,
2295,
353,
426,
13,
4706,
3611,
29901,
426,
13,
9651,
1840,
29901,
29871,
29900,
363,
1840,
297,
4958,
13,
4706,
500,
363,
3611,
29892,
4958,
297,
13997,
29889,
7076,
580,
13,
1678,
500,
13,
1678,
411,
1722,
29898,
2917,
9507,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
4390,
29889,
15070,
29898,
2917,
29892,
285,
29897,
13,
20683,
353,
2295,
13,
13,
361,
451,
2224,
29889,
275,
1445,
29898,
1188,
9507,
1125,
13,
1678,
1722,
29898,
1188,
9507,
29892,
525,
29893,
2824,
5358,
580,
13,
13,
13,
1454,
7663,
29892,
4958,
297,
13997,
29889,
7076,
7295,
13,
13,
1678,
396,
1653,
716,
3884,
565,
4312,
13,
1678,
714,
3972,
353,
2224,
29889,
7122,
29898,
4632,
3972,
29892,
7663,
29897,
13,
1678,
565,
451,
2224,
29889,
275,
3972,
29898,
449,
3972,
1125,
13,
4706,
2136,
287,
12935,
29898,
449,
3972,
29897,
13,
13,
1678,
396,
2436,
1480,
934,
13,
1678,
1480,
710,
353,
525,
7320,
29901,
1273,
29879,
29905,
29876,
29915,
1273,
7663,
13,
1678,
411,
1722,
29898,
1188,
9507,
29892,
525,
29874,
29974,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
29898,
1188,
710,
29897,
13,
1678,
1596,
29898,
1188,
710,
7503,
29899,
29896,
2314,
13,
13,
1678,
363,
1840,
29892,
1369,
29918,
2248,
297,
4958,
29889,
7076,
7295,
13,
4706,
1480,
710,
353,
525,
29871,
1840,
539,
584,
1273,
29879,
29905,
29876,
29915,
1273,
1840,
13,
4706,
1480,
710,
4619,
525,
29871,
1369,
2380,
29901,
1273,
29881,
29905,
29876,
29915,
1273,
1369,
29918,
2248,
13,
4706,
411,
1722,
29898,
1188,
9507,
29892,
525,
29874,
29974,
1495,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
1188,
710,
29897,
13,
4706,
1596,
29898,
1188,
710,
7503,
29899,
29896,
2314,
13,
13,
4706,
396,
2346,
363,
1269,
1840,
13,
4706,
1369,
29918,
29873,
353,
931,
29889,
2230,
580,
13,
4706,
2551,
353,
29871,
29900,
13,
4706,
954,
29918,
2271,
29918,
26061,
353,
29871,
29900,
13,
4706,
954,
29918,
7620,
29918,
26061,
353,
29871,
29900,
13,
4706,
363,
474,
29892,
330,
361,
297,
26985,
29898,
3146,
11461,
29889,
4478,
29898,
8489,
29892,
4046,
29922,
13400,
22164,
13,
9651,
565,
313,
29875,
718,
29871,
29896,
29897,
1273,
29871,
29896,
29900,
1275,
29871,
29900,
29901,
13,
18884,
1095,
29918,
29873,
353,
931,
29889,
2230,
580,
13,
18884,
1480,
710,
353,
525,
1678,
448,
2683,
22158,
2612,
29876,
29915,
13,
18884,
1480,
710,
4619,
525,
1678,
1857,
2380,
29871,
584,
1273,
29881,
29905,
29876,
29915,
1273,
313,
29875,
718,
1369,
29918,
2248,
29897,
13,
18884,
1480,
710,
4619,
525,
1678,
330,
10270,
16532,
29901,
1273,
29881,
29905,
29876,
29915,
1273,
2551,
13,
18884,
1480,
710,
4619,
525,
1678,
3142,
8465,
418,
584,
1273,
29881,
29905,
29876,
29915,
1273,
954,
29918,
2271,
29918,
26061,
13,
18884,
1480,
710,
4619,
525,
1678,
4078,
8465,
268,
584,
1273,
29881,
29905,
29876,
29915,
1273,
954,
29918,
7620,
29918,
26061,
13,
18884,
1480,
710,
4619,
525,
1678,
931,
965,
584,
18695,
29906,
29888,
29905,
29876,
29915,
1273,
313,
355,
29918,
29873,
448,
1369,
29918,
29873,
29897,
13,
18884,
411,
1722,
29898,
1188,
9507,
29892,
525,
29874,
29974,
1495,
408,
285,
29901,
13,
462,
1678,
285,
29889,
3539,
29898,
1188,
710,
29897,
13,
18884,
1596,
29898,
1188,
710,
7503,
29899,
29896,
2314,
13,
13,
18884,
2551,
353,
29871,
29900,
13,
18884,
954,
29918,
2271,
29918,
26061,
353,
29871,
29900,
13,
18884,
954,
29918,
7620,
29918,
26061,
353,
29871,
29900,
13,
13,
18884,
396,
4078,
2295,
13,
18884,
2295,
29961,
7320,
3816,
8489,
29962,
353,
474,
718,
1369,
29918,
2248,
13,
18884,
411,
1722,
29898,
2917,
9507,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
462,
1678,
4390,
29889,
15070,
29898,
2917,
29892,
285,
29892,
29536,
29922,
29906,
29897,
13,
18884,
1369,
29918,
29873,
353,
931,
29889,
2230,
580,
13,
13,
9651,
1018,
29901,
13,
18884,
3142,
353,
330,
361,
29889,
9799,
29918,
2271,
13,
13,
18884,
1018,
29901,
13,
462,
1678,
364,
353,
7274,
29889,
657,
29898,
2271,
29897,
13,
462,
1678,
848,
353,
364,
29889,
3051,
13,
462,
1678,
10422,
353,
14210,
29879,
29918,
29995,
29881,
29889,
18660,
29915,
1273,
313,
8489,
29892,
474,
29897,
13,
13,
462,
1678,
1722,
29898,
2084,
29889,
7122,
29898,
449,
3972,
29892,
10422,
511,
376,
29893,
29890,
29974,
2564,
3539,
29898,
1272,
29897,
13,
13,
462,
1678,
2551,
4619,
29871,
29896,
13,
13,
18884,
5174,
8960,
408,
321,
29901,
13,
462,
1678,
954,
29918,
7620,
29918,
26061,
4619,
29871,
29896,
13,
9651,
5174,
8960,
408,
321,
29901,
13,
18884,
954,
29918,
2271,
29918,
26061,
4619,
29871,
29896,
13,
13,
13,
2158,
877,
15091,
1495,
13,
2
] |
Guitar Training Remote/music_theory/mode.py | keremkoseoglu/Python-Library | 3 | 31316 | import random
from music_theory.note import Note
class Mode:
def __init__(self):
self._modes = [
# Major oriented
"Ionian",
"Dorian",
"Phrygian",
"Lydian",
"Mixo",
"Aeolian",
"Locrian",
# Melodic minor oriented
"Jazz minor",
"Dorian b2",
"Lydian aug",
"Lydian dom",
"Mixo b6",
"Half dim",
"Altered"
]
def get_mode_list(self) -> []:
return self._modes
def get_random_mode(self) -> str:
random_note = Note().get_random_note()
random_mode = self.get_random_mode_type()
return random_note + " " + random_mode
def get_random_mode_type(self) -> str:
i = random.randint(0, len(self._modes) - 1)
return self._modes[i]
def get_random_modes(self, count: int, with_note=True) -> []:
output = []
note_obj = Note()
for c in range(count):
if with_note:
random_note = note_obj.get_random_note() + " "
else:
random_note = ""
random_mode = self.get_random_mode_type()
random_result = random_note + random_mode
output.append(random_result)
return output
| [
1,
1053,
4036,
13,
3166,
4696,
29918,
14138,
29889,
6812,
1053,
3940,
13,
13,
13,
1990,
21864,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
1545,
267,
353,
518,
13,
9651,
396,
11019,
7769,
287,
13,
9651,
376,
29902,
25813,
613,
13,
9651,
376,
29928,
272,
713,
613,
13,
9651,
376,
4819,
719,
29887,
713,
613,
13,
9651,
376,
29931,
2941,
713,
613,
13,
9651,
376,
29924,
861,
29877,
613,
13,
9651,
376,
29909,
29872,
324,
713,
613,
13,
9651,
376,
3524,
6392,
613,
13,
13,
9651,
396,
6286,
397,
293,
9461,
7769,
287,
13,
9651,
376,
29967,
7511,
9461,
613,
13,
9651,
376,
29928,
272,
713,
289,
29906,
613,
13,
9651,
376,
29931,
2941,
713,
11307,
613,
13,
9651,
376,
29931,
2941,
713,
2432,
613,
13,
9651,
376,
29924,
861,
29877,
289,
29953,
613,
13,
9651,
376,
29950,
3131,
3964,
613,
13,
9651,
376,
2499,
25396,
29908,
13,
4706,
4514,
13,
13,
1678,
822,
679,
29918,
8513,
29918,
1761,
29898,
1311,
29897,
1599,
5159,
29901,
13,
4706,
736,
1583,
3032,
1545,
267,
13,
13,
1678,
822,
679,
29918,
8172,
29918,
8513,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
4036,
29918,
6812,
353,
3940,
2141,
657,
29918,
8172,
29918,
6812,
580,
13,
4706,
4036,
29918,
8513,
353,
1583,
29889,
657,
29918,
8172,
29918,
8513,
29918,
1853,
580,
13,
4706,
736,
4036,
29918,
6812,
718,
376,
376,
718,
4036,
29918,
8513,
13,
13,
1678,
822,
679,
29918,
8172,
29918,
8513,
29918,
1853,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
474,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1311,
3032,
1545,
267,
29897,
448,
29871,
29896,
29897,
13,
4706,
736,
1583,
3032,
1545,
267,
29961,
29875,
29962,
13,
13,
1678,
822,
679,
29918,
8172,
29918,
1545,
267,
29898,
1311,
29892,
2302,
29901,
938,
29892,
411,
29918,
6812,
29922,
5574,
29897,
1599,
5159,
29901,
13,
13,
4706,
1962,
353,
5159,
13,
4706,
4443,
29918,
5415,
353,
3940,
580,
13,
13,
4706,
363,
274,
297,
3464,
29898,
2798,
1125,
13,
9651,
565,
411,
29918,
6812,
29901,
13,
18884,
4036,
29918,
6812,
353,
4443,
29918,
5415,
29889,
657,
29918,
8172,
29918,
6812,
580,
718,
376,
376,
13,
9651,
1683,
29901,
13,
18884,
4036,
29918,
6812,
353,
5124,
13,
9651,
4036,
29918,
8513,
353,
1583,
29889,
657,
29918,
8172,
29918,
8513,
29918,
1853,
580,
13,
9651,
4036,
29918,
2914,
353,
4036,
29918,
6812,
718,
4036,
29918,
8513,
13,
9651,
1962,
29889,
4397,
29898,
8172,
29918,
2914,
29897,
13,
13,
4706,
736,
1962,
13,
2
] |
magma/uniquification.py | leonardt/magma | 167 | 183523 | from dataclasses import dataclass
from enum import Enum, auto
from magma.is_definition import isdefinition
from magma.logging import root_logger
from magma.passes import DefinitionPass
_logger = root_logger()
class MultipleDefinitionException(Exception):
pass
class UniquificationMode(Enum):
WARN = auto()
ERROR = auto()
UNIQUIFY = auto()
@dataclass(frozen=True)
class _HashStruct:
defn_repr: str
is_verilog: bool
verilog_str: bool
inline_verilog: tuple
def _make_hash_struct(definition):
repr_ = repr(definition)
inline_verilog = tuple()
for inline_str, connect_references in definition.inline_verilog_strs:
connect_references = tuple(connect_references.items())
inline_verilog += (inline_str, connect_references)
if hasattr(definition, "verilogFile") and definition.verilogFile:
return _HashStruct(repr_, True, definition.verilogFile, inline_verilog)
return _HashStruct(repr_, False, "", inline_verilog)
def _hash(definition):
hash_struct = _make_hash_struct(definition)
return hash(hash_struct)
class UniquificationPass(DefinitionPass):
def __init__(self, main, mode):
super().__init__(main)
self.mode = mode
self.seen = {}
self.original_names = {}
def _rename(self, ckt, new_name):
assert ckt not in self.original_names
self.original_names[ckt] = ckt.name
type(ckt).rename(ckt, new_name)
def __call__(self, definition):
for module in definition.bind_modules:
self._run(module)
name = definition.name
key = _hash(definition)
seen = self.seen.setdefault(name, {})
if key not in seen:
if self.mode is UniquificationMode.UNIQUIFY and len(seen) > 0:
suffix = "_unq" + str(len(seen))
new_name = name + suffix
self._rename(definition, new_name)
seen[key] = [definition]
else:
if self.mode is not UniquificationMode.UNIQUIFY:
assert seen[key][0].name == name
elif name != seen[key][0].name:
new_name = seen[key][0].name
self._rename(definition, new_name)
seen[key].append(definition)
def run(self):
super().run()
duplicated = []
for name, definitions in self.seen.items():
if len(definitions) > 1:
duplicated.append((name, definitions))
UniquificationPass.handle(duplicated, self.mode)
@staticmethod
def handle(duplicated, mode):
if len(duplicated):
msg = f"Multiple definitions: {[name for name, _ in duplicated]}"
if mode is UniquificationMode.ERROR:
error(msg)
raise MultipleDefinitionException([name for name, _ in duplicated])
elif mode is UniquificationMode.WARN:
warning(msg)
def _get_mode(mode_or_str):
if isinstance(mode_or_str, str):
try:
return UniquificationMode[mode_or_str]
except KeyError as e:
modes = [k for k in UniquificationMode.__members__]
raise ValueError(f"Valid uniq. modes are {modes}")
if isinstance(mode_or_str, UniquificationMode):
return mode_or_str
raise NotImplementedError(f"Unsupported type: {type(mode_or_str)}")
def reset_names(original_names):
for ckt, original_name in original_names.items():
type(ckt).rename(ckt, original_name)
# This pass runs uniquification according to @mode and returns a dictionary
# mapping any renamed circuits to their original names. If @mode is ERROR or
# WARN the returned dictionary should be empty.
def uniquification_pass(circuit, mode_or_str):
mode = _get_mode(mode_or_str)
pass_ = UniquificationPass(circuit, mode)
pass_.run()
return pass_.original_names
| [
1,
515,
848,
13203,
1053,
848,
1990,
13,
3166,
14115,
1053,
1174,
398,
29892,
4469,
13,
13,
3166,
2320,
655,
29889,
275,
29918,
16553,
1053,
338,
16553,
13,
3166,
2320,
655,
29889,
21027,
1053,
3876,
29918,
21707,
13,
3166,
2320,
655,
29889,
3364,
267,
1053,
21940,
7129,
13,
13,
13,
29918,
21707,
353,
3876,
29918,
21707,
580,
13,
13,
13,
1990,
26905,
14683,
2451,
29898,
2451,
1125,
13,
1678,
1209,
13,
13,
13,
1990,
853,
8105,
2450,
6818,
29898,
16854,
1125,
13,
1678,
399,
15249,
353,
4469,
580,
13,
1678,
14431,
353,
4469,
580,
13,
1678,
8291,
29902,
29984,
3120,
29943,
29979,
353,
4469,
580,
13,
13,
13,
29992,
1272,
1990,
29898,
29888,
307,
2256,
29922,
5574,
29897,
13,
1990,
903,
10438,
19560,
29901,
13,
1678,
822,
29876,
29918,
276,
558,
29901,
851,
13,
1678,
338,
29918,
369,
26140,
29901,
6120,
13,
1678,
1147,
26140,
29918,
710,
29901,
6120,
13,
1678,
10583,
29918,
369,
26140,
29901,
18761,
13,
13,
13,
1753,
903,
5675,
29918,
8568,
29918,
4984,
29898,
16553,
1125,
13,
1678,
2062,
29918,
353,
2062,
29898,
16553,
29897,
13,
1678,
10583,
29918,
369,
26140,
353,
18761,
580,
13,
1678,
363,
10583,
29918,
710,
29892,
4511,
29918,
276,
10662,
297,
5023,
29889,
14764,
29918,
369,
26140,
29918,
710,
29879,
29901,
13,
4706,
4511,
29918,
276,
10662,
353,
18761,
29898,
6915,
29918,
276,
10662,
29889,
7076,
3101,
13,
4706,
10583,
29918,
369,
26140,
4619,
313,
14764,
29918,
710,
29892,
4511,
29918,
276,
10662,
29897,
13,
1678,
565,
756,
5552,
29898,
16553,
29892,
376,
369,
26140,
2283,
1159,
322,
5023,
29889,
369,
26140,
2283,
29901,
13,
4706,
736,
903,
10438,
19560,
29898,
276,
558,
3383,
5852,
29892,
5023,
29889,
369,
26140,
2283,
29892,
10583,
29918,
369,
26140,
29897,
13,
1678,
736,
903,
10438,
19560,
29898,
276,
558,
3383,
7700,
29892,
12633,
10583,
29918,
369,
26140,
29897,
13,
13,
13,
1753,
903,
8568,
29898,
16553,
1125,
13,
1678,
6608,
29918,
4984,
353,
903,
5675,
29918,
8568,
29918,
4984,
29898,
16553,
29897,
13,
1678,
736,
6608,
29898,
8568,
29918,
4984,
29897,
13,
13,
13,
1990,
853,
8105,
2450,
7129,
29898,
14683,
7129,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1667,
29892,
4464,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
3396,
29897,
13,
4706,
1583,
29889,
8513,
353,
4464,
13,
4706,
1583,
29889,
28026,
353,
6571,
13,
4706,
1583,
29889,
13492,
29918,
7039,
353,
6571,
13,
13,
1678,
822,
903,
1267,
420,
29898,
1311,
29892,
274,
1193,
29892,
716,
29918,
978,
1125,
13,
4706,
4974,
274,
1193,
451,
297,
1583,
29889,
13492,
29918,
7039,
13,
4706,
1583,
29889,
13492,
29918,
7039,
29961,
384,
29873,
29962,
353,
274,
1193,
29889,
978,
13,
4706,
1134,
29898,
384,
29873,
467,
1267,
420,
29898,
384,
29873,
29892,
716,
29918,
978,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
5023,
1125,
13,
4706,
363,
3883,
297,
5023,
29889,
5355,
29918,
7576,
29901,
13,
9651,
1583,
3032,
3389,
29898,
5453,
29897,
13,
4706,
1024,
353,
5023,
29889,
978,
13,
4706,
1820,
353,
903,
8568,
29898,
16553,
29897,
13,
13,
4706,
3595,
353,
1583,
29889,
28026,
29889,
842,
4381,
29898,
978,
29892,
426,
1800,
13,
4706,
565,
1820,
451,
297,
3595,
29901,
13,
9651,
565,
1583,
29889,
8513,
338,
853,
8105,
2450,
6818,
29889,
3904,
29902,
29984,
3120,
29943,
29979,
322,
7431,
29898,
28026,
29897,
1405,
29871,
29900,
29901,
13,
18884,
25557,
353,
11119,
348,
29939,
29908,
718,
851,
29898,
2435,
29898,
28026,
876,
13,
18884,
716,
29918,
978,
353,
1024,
718,
25557,
13,
18884,
1583,
3032,
1267,
420,
29898,
16553,
29892,
716,
29918,
978,
29897,
13,
9651,
3595,
29961,
1989,
29962,
353,
518,
16553,
29962,
13,
4706,
1683,
29901,
13,
9651,
565,
1583,
29889,
8513,
338,
451,
853,
8105,
2450,
6818,
29889,
3904,
29902,
29984,
3120,
29943,
29979,
29901,
13,
18884,
4974,
3595,
29961,
1989,
3816,
29900,
1822,
978,
1275,
1024,
13,
9651,
25342,
1024,
2804,
3595,
29961,
1989,
3816,
29900,
1822,
978,
29901,
13,
18884,
716,
29918,
978,
353,
3595,
29961,
1989,
3816,
29900,
1822,
978,
13,
18884,
1583,
3032,
1267,
420,
29898,
16553,
29892,
716,
29918,
978,
29897,
13,
9651,
3595,
29961,
1989,
1822,
4397,
29898,
16553,
29897,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
2428,
2141,
3389,
580,
13,
4706,
5141,
9169,
353,
5159,
13,
4706,
363,
1024,
29892,
15848,
297,
1583,
29889,
28026,
29889,
7076,
7295,
13,
9651,
565,
7431,
29898,
25476,
2187,
29897,
1405,
29871,
29896,
29901,
13,
18884,
5141,
9169,
29889,
4397,
3552,
978,
29892,
15848,
876,
13,
4706,
853,
8105,
2450,
7129,
29889,
8411,
29898,
20908,
9169,
29892,
1583,
29889,
8513,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4386,
29898,
20908,
9169,
29892,
4464,
1125,
13,
4706,
565,
7431,
29898,
20908,
9169,
1125,
13,
9651,
10191,
353,
285,
29908,
15329,
552,
15848,
29901,
426,
29961,
978,
363,
1024,
29892,
903,
297,
5141,
9169,
29962,
5038,
13,
9651,
565,
4464,
338,
853,
8105,
2450,
6818,
29889,
11432,
29901,
13,
18884,
1059,
29898,
7645,
29897,
13,
18884,
12020,
26905,
14683,
2451,
4197,
978,
363,
1024,
29892,
903,
297,
5141,
9169,
2314,
13,
9651,
25342,
4464,
338,
853,
8105,
2450,
6818,
29889,
29956,
15249,
29901,
13,
18884,
9177,
29898,
7645,
29897,
13,
13,
13,
1753,
903,
657,
29918,
8513,
29898,
8513,
29918,
272,
29918,
710,
1125,
13,
1678,
565,
338,
8758,
29898,
8513,
29918,
272,
29918,
710,
29892,
851,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
853,
8105,
2450,
6818,
29961,
8513,
29918,
272,
29918,
710,
29962,
13,
4706,
5174,
7670,
2392,
408,
321,
29901,
13,
9651,
18893,
353,
518,
29895,
363,
413,
297,
853,
8105,
2450,
6818,
17255,
28109,
1649,
29962,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
7211,
443,
29875,
29939,
29889,
18893,
526,
426,
1545,
267,
27195,
13,
1678,
565,
338,
8758,
29898,
8513,
29918,
272,
29918,
710,
29892,
853,
8105,
2450,
6818,
1125,
13,
4706,
736,
4464,
29918,
272,
29918,
710,
13,
1678,
12020,
2216,
1888,
2037,
287,
2392,
29898,
29888,
29908,
25807,
29884,
3016,
287,
1134,
29901,
426,
1853,
29898,
8513,
29918,
272,
29918,
710,
2915,
1159,
13,
13,
13,
1753,
10092,
29918,
7039,
29898,
13492,
29918,
7039,
1125,
13,
1678,
363,
274,
1193,
29892,
2441,
29918,
978,
297,
2441,
29918,
7039,
29889,
7076,
7295,
13,
4706,
1134,
29898,
384,
29873,
467,
1267,
420,
29898,
384,
29873,
29892,
2441,
29918,
978,
29897,
13,
13,
13,
29937,
910,
1209,
6057,
20498,
2450,
5034,
304,
732,
8513,
322,
3639,
263,
8600,
13,
29937,
10417,
738,
19533,
3449,
19544,
304,
1009,
2441,
2983,
29889,
960,
732,
8513,
338,
14431,
470,
13,
29937,
399,
15249,
278,
4133,
8600,
881,
367,
4069,
29889,
13,
1753,
20498,
2450,
29918,
3364,
29898,
6034,
3121,
29892,
4464,
29918,
272,
29918,
710,
1125,
13,
1678,
4464,
353,
903,
657,
29918,
8513,
29898,
8513,
29918,
272,
29918,
710,
29897,
13,
1678,
1209,
29918,
353,
853,
8105,
2450,
7129,
29898,
6034,
3121,
29892,
4464,
29897,
13,
1678,
1209,
5396,
3389,
580,
13,
1678,
736,
1209,
5396,
13492,
29918,
7039,
13,
2
] |
lib/PyAMF-0.7.2/pyamf/tests/remoting/__init__.py | MiCHiLU/google_appengine_sdk | 790 | 141857 | # Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Remoting tests.
@since: 0.1.0
"""
| [
1,
396,
14187,
1266,
313,
29883,
29897,
450,
10772,
5194,
29943,
8010,
29889,
13,
29937,
2823,
365,
2965,
1430,
1660,
29889,
3945,
363,
4902,
29889,
13,
13,
15945,
29908,
13,
7301,
11427,
6987,
29889,
13,
13,
29992,
16076,
29901,
29871,
29900,
29889,
29896,
29889,
29900,
13,
15945,
29908,
13,
2
] |
fable/fable_sources/fable/test/tst_show_calls.py | hickerson/bbn | 4 | 112983 | from __future__ import division
def run(args):
assert len(args) == 0
import libtbx.load_env
from cStringIO import StringIO
import os
op = os.path
t_dir = libtbx.env.under_dist(
module_name="fable", path="test/valid", test=op.isdir)
excluded_file_names = set("""\
blockdata_unnamed.f
""".splitlines())
from fable.command_line import show_calls
for file_name in os.listdir(t_dir):
if (not file_name.endswith(".f")): continue
if (file_name in excluded_file_names): continue
sys.stdout = StringIO()
show_calls.run(args=[op.join(t_dir, file_name)])
sys.stdout = sys.__stdout__
print "OK"
if (__name__ == "__main__"):
import sys
run(args=sys.argv[1:])
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
8542,
13,
1753,
1065,
29898,
5085,
1125,
13,
29871,
4974,
7431,
29898,
5085,
29897,
1275,
29871,
29900,
13,
29871,
1053,
619,
3116,
29890,
29916,
29889,
1359,
29918,
6272,
13,
29871,
515,
274,
1231,
5971,
1053,
1714,
5971,
13,
29871,
1053,
2897,
13,
29871,
1015,
353,
2897,
29889,
2084,
13,
29871,
260,
29918,
3972,
353,
619,
3116,
29890,
29916,
29889,
6272,
29889,
5062,
29918,
5721,
29898,
13,
1678,
3883,
29918,
978,
543,
29888,
519,
613,
2224,
543,
1688,
29914,
3084,
613,
1243,
29922,
459,
29889,
275,
3972,
29897,
13,
29871,
429,
13347,
29918,
1445,
29918,
7039,
353,
731,
703,
15945,
29905,
13,
1271,
1272,
29918,
5963,
2795,
29889,
29888,
13,
15945,
1642,
5451,
9012,
3101,
13,
29871,
515,
285,
519,
29889,
6519,
29918,
1220,
1053,
1510,
29918,
29883,
4293,
13,
29871,
363,
934,
29918,
978,
297,
2897,
29889,
1761,
3972,
29898,
29873,
29918,
3972,
1125,
13,
1678,
565,
313,
1333,
934,
29918,
978,
29889,
1975,
2541,
17350,
29888,
5783,
29901,
6773,
13,
1678,
565,
313,
1445,
29918,
978,
297,
429,
13347,
29918,
1445,
29918,
7039,
1125,
6773,
13,
1678,
10876,
29889,
25393,
353,
1714,
5971,
580,
13,
1678,
1510,
29918,
29883,
4293,
29889,
3389,
29898,
5085,
11759,
459,
29889,
7122,
29898,
29873,
29918,
3972,
29892,
934,
29918,
978,
29897,
2314,
13,
1678,
10876,
29889,
25393,
353,
10876,
17255,
25393,
1649,
13,
29871,
1596,
376,
8949,
29908,
13,
13,
361,
313,
1649,
978,
1649,
1275,
376,
1649,
3396,
1649,
29908,
1125,
13,
29871,
1053,
10876,
13,
29871,
1065,
29898,
5085,
29922,
9675,
29889,
19218,
29961,
29896,
29901,
2314,
13,
2
] |
pytorch_toolkit/face_recognition/model/common.py | AnastasiaaSenina/openvino_training_extensions | 1 | 2316 | <reponame>AnastasiaaSenina/openvino_training_extensions
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from abc import abstractmethod
from functools import partial
import torch.nn as nn
class ModelInterface(nn.Module):
"""Abstract class for models"""
@abstractmethod
def set_dropout_ratio(self, ratio):
"""Sets dropout ratio of the model"""
@abstractmethod
def get_input_res(self):
"""Returns input resolution"""
from .rmnet_angular import RMNetAngular
from .mobilefacenet import MobileFaceNet
from .landnet import LandmarksNet
from .se_resnet_angular import SEResNetAngular
from .shufflenet_v2_angular import ShuffleNetV2Angular
from .backbones.se_resnet import se_resnet50, se_resnet101, se_resnet152
from .backbones.resnet import resnet50
from .backbones.se_resnext import se_resnext50, se_resnext101, se_resnext152
models_backbones = {'rmnet': RMNetAngular,
'mobilenetv2': MobileFaceNet,
'mobilenetv2_2x': partial(MobileFaceNet, width_multiplier=2.0),
'mobilenetv2_1_5x': partial(MobileFaceNet, width_multiplier=1.5),
'resnet50': partial(SEResNetAngular, base=resnet50),
'se_resnet50': partial(SEResNetAngular, base=se_resnet50),
'se_resnet101': partial(SEResNetAngular, base=se_resnet101),
'se_resnet152': partial(SEResNetAngular, base=se_resnet152),
'se_resnext50': partial(SEResNetAngular, base=se_resnext50),
'se_resnext101': partial(SEResNetAngular, base=se_resnext101),
'se_resnext152': partial(SEResNetAngular, base=se_resnext152),
'shufflenetv2': ShuffleNetV2Angular}
models_landmarks = {'landnet': LandmarksNet}
| [
1,
529,
276,
1112,
420,
29958,
2744,
579,
26252,
29874,
29903,
264,
1099,
29914,
3150,
29894,
1789,
29918,
26495,
29918,
24299,
13,
15945,
29908,
13,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29947,
18555,
15025,
13,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
27028,
1090,
278,
19245,
29889,
13,
15945,
29908,
13,
3166,
25638,
1053,
9846,
5696,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
13,
13,
1990,
8125,
10448,
29898,
15755,
29889,
7355,
1125,
13,
1678,
9995,
9118,
770,
363,
4733,
15945,
29908,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
731,
29918,
8865,
449,
29918,
3605,
601,
29898,
1311,
29892,
11959,
1125,
13,
4706,
9995,
29903,
1691,
5768,
449,
11959,
310,
278,
1904,
15945,
29908,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
679,
29918,
2080,
29918,
690,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
1881,
10104,
15945,
29908,
13,
13,
13,
3166,
869,
1758,
1212,
29918,
6825,
1053,
390,
29924,
6779,
9928,
1070,
13,
3166,
869,
16769,
17470,
264,
300,
1053,
21600,
23360,
6779,
13,
3166,
869,
1049,
1212,
1053,
3172,
22848,
6779,
13,
3166,
869,
344,
29918,
690,
1212,
29918,
6825,
1053,
26996,
267,
6779,
9928,
1070,
13,
3166,
869,
845,
3096,
2435,
300,
29918,
29894,
29906,
29918,
6825,
1053,
1383,
21897,
6779,
29963,
29906,
9928,
1070,
13,
3166,
869,
1627,
29890,
2873,
29889,
344,
29918,
690,
1212,
1053,
409,
29918,
690,
1212,
29945,
29900,
29892,
409,
29918,
690,
1212,
29896,
29900,
29896,
29892,
409,
29918,
690,
1212,
29896,
29945,
29906,
13,
3166,
869,
1627,
29890,
2873,
29889,
690,
1212,
1053,
620,
1212,
29945,
29900,
13,
3166,
869,
1627,
29890,
2873,
29889,
344,
29918,
690,
4622,
1053,
409,
29918,
690,
4622,
29945,
29900,
29892,
409,
29918,
690,
4622,
29896,
29900,
29896,
29892,
409,
29918,
690,
4622,
29896,
29945,
29906,
13,
13,
13,
9794,
29918,
1627,
29890,
2873,
353,
11117,
1758,
1212,
2396,
390,
29924,
6779,
9928,
1070,
29892,
13,
462,
1678,
525,
29885,
12213,
264,
300,
29894,
29906,
2396,
21600,
23360,
6779,
29892,
13,
462,
1678,
525,
29885,
12213,
264,
300,
29894,
29906,
29918,
29906,
29916,
2396,
7687,
29898,
29295,
23360,
6779,
29892,
2920,
29918,
18056,
4926,
29922,
29906,
29889,
29900,
511,
13,
462,
1678,
525,
29885,
12213,
264,
300,
29894,
29906,
29918,
29896,
29918,
29945,
29916,
2396,
7687,
29898,
29295,
23360,
6779,
29892,
2920,
29918,
18056,
4926,
29922,
29896,
29889,
29945,
511,
13,
462,
1678,
525,
690,
1212,
29945,
29900,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
690,
1212,
29945,
29900,
511,
13,
462,
1678,
525,
344,
29918,
690,
1212,
29945,
29900,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
1212,
29945,
29900,
511,
13,
462,
1678,
525,
344,
29918,
690,
1212,
29896,
29900,
29896,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
1212,
29896,
29900,
29896,
511,
13,
462,
1678,
525,
344,
29918,
690,
1212,
29896,
29945,
29906,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
1212,
29896,
29945,
29906,
511,
13,
462,
1678,
525,
344,
29918,
690,
4622,
29945,
29900,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
4622,
29945,
29900,
511,
13,
462,
1678,
525,
344,
29918,
690,
4622,
29896,
29900,
29896,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
4622,
29896,
29900,
29896,
511,
13,
462,
1678,
525,
344,
29918,
690,
4622,
29896,
29945,
29906,
2396,
7687,
29898,
6304,
267,
6779,
9928,
1070,
29892,
2967,
29922,
344,
29918,
690,
4622,
29896,
29945,
29906,
511,
13,
462,
1678,
525,
845,
3096,
2435,
300,
29894,
29906,
2396,
1383,
21897,
6779,
29963,
29906,
9928,
1070,
29913,
13,
13,
9794,
29918,
1049,
22848,
353,
11117,
1049,
1212,
2396,
3172,
22848,
6779,
29913,
13,
2
] |
benchmark/bench_asynckafka.py | askuratovsky/asynckafka | 31 | 24075 | <gh_stars>10-100
import asyncio
from asynckafka import Producer, Consumer
import config
import utils
loop = asyncio.get_event_loop()
async def fill_topic_with_messages():
producer = Producer(
brokers=config.KAFKA_URL,
rdk_producer_config=config.RDK_PRODUCER_CONFIG,
rdk_topic_config=config.RDK_TOPIC_CONFIG,
)
producer.start()
messages_consumed = 0
print(f"Preparing benchmark. Filling topic {config.TOPIC} with "
f"{config.MESSAGE_NUMBER} messages of {config.MESSAGE_BYTES} bytes "
f"each one.")
await asyncio.sleep(0.1)
with utils.Timer() as timer:
for _ in range(config.MESSAGE_NUMBER):
messages_consumed += 1
await producer.produce(config.TOPIC, config.MESSAGE)
producer.stop()
print(f"The producer time to send the messages is {timer.interval} "
f"seconds.")
utils.print_statistics(timer.interval)
async def consume_the_messages_stream_consumer():
stream_consumer = Consumer(
brokers=config.KAFKA_URL,
topics=[config.TOPIC],
rdk_consumer_config=config.RDK_CONSUMER_CONFIG,
rdk_topic_config=config.RDK_TOPIC_CONFIG
)
stream_consumer.start()
messages_consumed = 0
print("Starting to consume the messages.")
with utils.Timer() as timer:
async for message in stream_consumer:
messages_consumed += 1
if messages_consumed == config.MESSAGE_NUMBER:
stream_consumer.stop()
print(f"The time used to consume the messages is {timer.interval} "
f"seconds.")
utils.print_statistics(timer.interval)
async def main_coro():
await fill_topic_with_messages()
await consume_the_messages_stream_consumer()
if __name__ == "__main__":
loop.run_until_complete(main_coro())
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
408,
948,
3934,
13,
13,
3166,
408,
948,
384,
20817,
1053,
7138,
2265,
29892,
2138,
4680,
13,
13,
5215,
2295,
13,
5215,
3667,
29879,
13,
13,
7888,
353,
408,
948,
3934,
29889,
657,
29918,
3696,
29918,
7888,
580,
13,
13,
13,
12674,
822,
5445,
29918,
13010,
29918,
2541,
29918,
19158,
7295,
13,
1678,
14297,
353,
7138,
2265,
29898,
13,
4706,
2545,
29895,
414,
29922,
2917,
29889,
29968,
5098,
29968,
29909,
29918,
4219,
29892,
13,
4706,
364,
8181,
29918,
5498,
2265,
29918,
2917,
29922,
2917,
29889,
29934,
17359,
29918,
8618,
14849,
29907,
1001,
29918,
25903,
29892,
13,
4706,
364,
8181,
29918,
13010,
29918,
2917,
29922,
2917,
29889,
29934,
17359,
29918,
4986,
2227,
29907,
29918,
25903,
29892,
13,
1678,
1723,
13,
1678,
14297,
29889,
2962,
580,
13,
13,
1678,
7191,
29918,
25978,
287,
353,
29871,
29900,
13,
13,
1678,
1596,
29898,
29888,
29908,
6572,
862,
292,
23513,
29889,
383,
8873,
11261,
29871,
426,
2917,
29889,
4986,
2227,
29907,
29913,
411,
376,
13,
3986,
285,
29908,
29912,
2917,
29889,
2303,
1799,
10461,
29918,
23207,
29913,
7191,
310,
426,
2917,
29889,
2303,
1799,
10461,
29918,
22716,
29911,
2890,
29913,
6262,
376,
13,
3986,
285,
29908,
4204,
697,
23157,
13,
1678,
7272,
408,
948,
3934,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
13,
1678,
411,
3667,
29879,
29889,
14745,
580,
408,
12237,
29901,
13,
4706,
363,
903,
297,
3464,
29898,
2917,
29889,
2303,
1799,
10461,
29918,
23207,
1125,
13,
9651,
7191,
29918,
25978,
287,
4619,
29871,
29896,
13,
9651,
7272,
14297,
29889,
5498,
346,
29898,
2917,
29889,
4986,
2227,
29907,
29892,
2295,
29889,
2303,
1799,
10461,
29897,
13,
4706,
14297,
29889,
9847,
580,
13,
1678,
1596,
29898,
29888,
29908,
1576,
14297,
931,
304,
3638,
278,
7191,
338,
426,
20404,
29889,
19207,
29913,
376,
13,
3986,
285,
29908,
23128,
23157,
13,
1678,
3667,
29879,
29889,
2158,
29918,
6112,
6765,
29898,
20404,
29889,
19207,
29897,
13,
13,
13,
12674,
822,
29151,
29918,
1552,
29918,
19158,
29918,
5461,
29918,
25978,
261,
7295,
13,
1678,
4840,
29918,
25978,
261,
353,
2138,
4680,
29898,
13,
4706,
2545,
29895,
414,
29922,
2917,
29889,
29968,
5098,
29968,
29909,
29918,
4219,
29892,
13,
4706,
23820,
11759,
2917,
29889,
4986,
2227,
29907,
1402,
13,
4706,
364,
8181,
29918,
25978,
261,
29918,
2917,
29922,
2917,
29889,
29934,
17359,
29918,
6007,
25021,
1001,
29918,
25903,
29892,
13,
4706,
364,
8181,
29918,
13010,
29918,
2917,
29922,
2917,
29889,
29934,
17359,
29918,
4986,
2227,
29907,
29918,
25903,
13,
1678,
1723,
13,
1678,
4840,
29918,
25978,
261,
29889,
2962,
580,
13,
13,
1678,
7191,
29918,
25978,
287,
353,
29871,
29900,
13,
13,
1678,
1596,
703,
4763,
292,
304,
29151,
278,
7191,
23157,
13,
1678,
411,
3667,
29879,
29889,
14745,
580,
408,
12237,
29901,
13,
4706,
7465,
363,
2643,
297,
4840,
29918,
25978,
261,
29901,
13,
9651,
7191,
29918,
25978,
287,
4619,
29871,
29896,
13,
9651,
565,
7191,
29918,
25978,
287,
1275,
2295,
29889,
2303,
1799,
10461,
29918,
23207,
29901,
13,
18884,
4840,
29918,
25978,
261,
29889,
9847,
580,
13,
1678,
1596,
29898,
29888,
29908,
1576,
931,
1304,
304,
29151,
278,
7191,
338,
426,
20404,
29889,
19207,
29913,
376,
13,
3986,
285,
29908,
23128,
23157,
13,
1678,
3667,
29879,
29889,
2158,
29918,
6112,
6765,
29898,
20404,
29889,
19207,
29897,
13,
13,
13,
12674,
822,
1667,
29918,
2616,
29877,
7295,
13,
1678,
7272,
5445,
29918,
13010,
29918,
2541,
29918,
19158,
580,
13,
1678,
7272,
29151,
29918,
1552,
29918,
19158,
29918,
5461,
29918,
25978,
261,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
2425,
29889,
3389,
29918,
29305,
29918,
8835,
29898,
3396,
29918,
2616,
29877,
3101,
13,
2
] |
core/storage/job/gae_models_test.py | aman-roy/oppia | 2 | 147275 | <filename>core/storage/job/gae_models_test.py
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for Oppia job models."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
from core.platform import models
from core.tests import test_utils
(base_models, job_models) = models.Registry.import_models(
[models.NAMES.base_model, models.NAMES.job])
class JobModelTest(test_utils.GenericTestBase):
"""Tests for Oppia job models."""
def test_get_deletion_policy(self):
self.assertEqual(
job_models.JobModel.get_deletion_policy(),
base_models.DELETION_POLICY.NOT_APPLICABLE)
def test_is_cancelable(self):
"""The job is cancelable if its status is either queued or started."""
job = job_models.JobModel(
id='MyJobId', status_code=job_models.STATUS_CODE_NEW)
self.assertFalse(job.is_cancelable)
job.status_code = job_models.STATUS_CODE_QUEUED
self.assertTrue(job.is_cancelable)
job.status_code = job_models.STATUS_CODE_STARTED
self.assertTrue(job.is_cancelable)
job.status_code = job_models.STATUS_CODE_FAILED
self.assertFalse(job.is_cancelable)
job.status_code = job_models.STATUS_CODE_CANCELED
self.assertFalse(job.is_cancelable)
class JobModelSetUpJobsTest(test_utils.GenericTestBase):
"""Tests for Oppia job models with setUp."""
def setUp(self):
super(JobModelSetUpJobsTest, self).setUp()
job_models.JobModel(
id='MyJobId1', job_type='JobType1',
status_code=job_models.STATUS_CODE_FAILED).put()
job_models.JobModel(
id='MyJobId2', job_type='JobType2',
status_code=job_models.STATUS_CODE_STARTED).put()
job_models.JobModel(
id='MyJobId3', job_type='JobType2',
status_code=job_models.STATUS_CODE_COMPLETED).put()
def test_get_all_unfinished_jobs(self):
self.assertEqual(
job_models.JobModel.get_all_unfinished_jobs(3),
[job_models.JobModel.get_by_id('MyJobId2')])
def test_get_unfinished_jobs(self):
self.assertEqual(
job_models.JobModel.get_unfinished_jobs('JobType1').fetch(1), [])
self.assertEqual(
job_models.JobModel.get_unfinished_jobs('JobType2').fetch(1),
[job_models.JobModel.get_by_id('MyJobId2')])
def test_do_unfinished_jobs_exist(self):
self.assertFalse(job_models.JobModel.do_unfinished_jobs_exist(
'JobType1'))
self.assertTrue(job_models.JobModel.do_unfinished_jobs_exist(
'JobType2'))
job2 = job_models.JobModel.get('MyJobId2', strict=True)
job2.status_code = job_models.STATUS_CODE_COMPLETED
job2.put()
self.assertFalse(job_models.JobModel.do_unfinished_jobs_exist(
'JobType2'))
class ContinuousComputationModelTest(test_utils.GenericTestBase):
"""Tests for Oppia continuous computation models."""
def test_get_deletion_policy(self):
self.assertEqual(
job_models.ContinuousComputationModel.get_deletion_policy(),
base_models.DELETION_POLICY.NOT_APPLICABLE)
| [
1,
529,
9507,
29958,
3221,
29914,
12925,
29914,
9057,
29914,
3249,
29872,
29918,
9794,
29918,
1688,
29889,
2272,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
450,
438,
407,
423,
13189,
943,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
29899,
3235,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
15945,
29908,
24376,
363,
438,
407,
423,
4982,
4733,
1213,
15945,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
5215,
29899,
6194,
29899,
7576,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
5215,
29899,
6194,
29899,
7576,
13,
13,
3166,
7136,
29889,
12120,
1053,
4733,
13,
3166,
7136,
29889,
21150,
1053,
1243,
29918,
13239,
13,
13,
29898,
3188,
29918,
9794,
29892,
4982,
29918,
9794,
29897,
353,
4733,
29889,
22579,
29889,
5215,
29918,
9794,
29898,
13,
1678,
518,
9794,
29889,
5813,
29903,
29889,
3188,
29918,
4299,
29892,
4733,
29889,
5813,
29903,
29889,
9057,
2314,
13,
13,
13,
1990,
17163,
3195,
3057,
29898,
1688,
29918,
13239,
29889,
15809,
3057,
5160,
1125,
13,
1678,
9995,
24376,
363,
438,
407,
423,
4982,
4733,
1213,
15945,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
311,
1026,
291,
29918,
22197,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
4982,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
311,
1026,
291,
29918,
22197,
3285,
13,
9651,
2967,
29918,
9794,
29889,
2287,
1307,
29911,
2725,
29918,
29925,
5607,
2965,
29979,
29889,
12256,
29918,
3301,
7390,
2965,
6181,
29897,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
20713,
519,
29898,
1311,
1125,
13,
4706,
9995,
1576,
4982,
338,
12611,
519,
565,
967,
4660,
338,
2845,
712,
6742,
470,
4687,
1213,
15945,
13,
4706,
4982,
353,
4982,
29918,
9794,
29889,
11947,
3195,
29898,
13,
9651,
1178,
2433,
3421,
11947,
1204,
742,
4660,
29918,
401,
29922,
9057,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
28577,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
9057,
29889,
275,
29918,
20713,
519,
29897,
13,
4706,
4982,
29889,
4882,
29918,
401,
353,
4982,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
11144,
29965,
3352,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9057,
29889,
275,
29918,
20713,
519,
29897,
13,
4706,
4982,
29889,
4882,
29918,
401,
353,
4982,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
25826,
3352,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9057,
29889,
275,
29918,
20713,
519,
29897,
13,
4706,
4982,
29889,
4882,
29918,
401,
353,
4982,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
4519,
29902,
20566,
13,
4706,
1583,
29889,
9294,
8824,
29898,
9057,
29889,
275,
29918,
20713,
519,
29897,
13,
4706,
4982,
29889,
4882,
29918,
401,
353,
4982,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
29907,
23219,
20566,
13,
4706,
1583,
29889,
9294,
8824,
29898,
9057,
29889,
275,
29918,
20713,
519,
29897,
13,
13,
13,
1990,
17163,
3195,
2697,
3373,
11947,
29879,
3057,
29898,
1688,
29918,
13239,
29889,
15809,
3057,
5160,
1125,
13,
1678,
9995,
24376,
363,
438,
407,
423,
4982,
4733,
411,
731,
3373,
1213,
15945,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
2428,
29898,
11947,
3195,
2697,
3373,
11947,
29879,
3057,
29892,
1583,
467,
842,
3373,
580,
13,
4706,
4982,
29918,
9794,
29889,
11947,
3195,
29898,
13,
9651,
1178,
2433,
3421,
11947,
1204,
29896,
742,
4982,
29918,
1853,
2433,
11947,
1542,
29896,
742,
13,
9651,
4660,
29918,
401,
29922,
9057,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
4519,
29902,
20566,
467,
649,
580,
13,
4706,
4982,
29918,
9794,
29889,
11947,
3195,
29898,
13,
9651,
1178,
2433,
3421,
11947,
1204,
29906,
742,
4982,
29918,
1853,
2433,
11947,
1542,
29906,
742,
13,
9651,
4660,
29918,
401,
29922,
9057,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
25826,
3352,
467,
649,
580,
13,
4706,
4982,
29918,
9794,
29889,
11947,
3195,
29898,
13,
9651,
1178,
2433,
3421,
11947,
1204,
29941,
742,
4982,
29918,
1853,
2433,
11947,
1542,
29906,
742,
13,
9651,
4660,
29918,
401,
29922,
9057,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
21514,
1307,
29911,
3352,
467,
649,
580,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
497,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
4982,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
497,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29898,
29941,
511,
13,
9651,
518,
9057,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
1609,
29918,
333,
877,
3421,
11947,
1204,
29906,
1495,
2314,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
4982,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
348,
4951,
3276,
29918,
9057,
29879,
877,
11947,
1542,
29896,
2824,
9155,
29898,
29896,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
4982,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
348,
4951,
3276,
29918,
9057,
29879,
877,
11947,
1542,
29906,
2824,
9155,
29898,
29896,
511,
13,
9651,
518,
9057,
29918,
9794,
29889,
11947,
3195,
29889,
657,
29918,
1609,
29918,
333,
877,
3421,
11947,
1204,
29906,
1495,
2314,
13,
13,
1678,
822,
1243,
29918,
1867,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29918,
28997,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
9057,
29918,
9794,
29889,
11947,
3195,
29889,
1867,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29918,
28997,
29898,
13,
9651,
525,
11947,
1542,
29896,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9057,
29918,
9794,
29889,
11947,
3195,
29889,
1867,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29918,
28997,
29898,
13,
9651,
525,
11947,
1542,
29906,
8785,
13,
4706,
4982,
29906,
353,
4982,
29918,
9794,
29889,
11947,
3195,
29889,
657,
877,
3421,
11947,
1204,
29906,
742,
9406,
29922,
5574,
29897,
13,
4706,
4982,
29906,
29889,
4882,
29918,
401,
353,
4982,
29918,
9794,
29889,
27047,
29918,
16524,
29918,
21514,
1307,
29911,
3352,
13,
4706,
4982,
29906,
29889,
649,
580,
13,
4706,
1583,
29889,
9294,
8824,
29898,
9057,
29918,
9794,
29889,
11947,
3195,
29889,
1867,
29918,
348,
4951,
3276,
29918,
9057,
29879,
29918,
28997,
29898,
13,
9651,
525,
11947,
1542,
29906,
8785,
13,
13,
13,
1990,
2866,
8675,
681,
1523,
14584,
3195,
3057,
29898,
1688,
29918,
13239,
29889,
15809,
3057,
5160,
1125,
13,
1678,
9995,
24376,
363,
438,
407,
423,
9126,
16287,
4733,
1213,
15945,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
311,
1026,
291,
29918,
22197,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
4982,
29918,
9794,
29889,
1323,
8675,
681,
1523,
14584,
3195,
29889,
657,
29918,
311,
1026,
291,
29918,
22197,
3285,
13,
9651,
2967,
29918,
9794,
29889,
2287,
1307,
29911,
2725,
29918,
29925,
5607,
2965,
29979,
29889,
12256,
29918,
3301,
7390,
2965,
6181,
29897,
13,
2
] |
tests/potential/EamPotential/Al__born_exp_fs/test____init__.py | eragasa/pypospack | 4 | 12330 | import pytest
from pypospack.potential import EamPotential
symbols = ['Al']
func_pair_name = "bornmayer"
func_density_name = "eam_dens_exp"
func_embedding_name = "fs"
expected_parameter_names_pair_potential = []
expected_parameter_names_density_function = []
expected_parameter_names_embedding_function = []
expected_parameter_names = [
'p_AlAl_phi0', 'p_AlAl_gamma', 'p_AlAl_r0',
'd_Al_rho0', 'd_Al_beta', 'd_Al_r0',
'e_Al_F0', 'e_Al_p', 'e_Al_q', 'e_Al_F1', 'e_Al_rho0']
print(80*'-')
print("func_pair_name={}".format(func_pair_name))
print("func_density_name={}".format(func_density_name))
print("func_embedding_name={}".format(func_density_name))
print(80*'-')
def test____init__():
obj_pot = EamPotential(
symbols=symbols,
func_pair=func_pair_name,
func_density=func_density_name,
func_embedding=func_embedding_name)
assert type(obj_pot) is EamPotential
assert obj_pot.potential_type == 'eam'
assert type(obj_pot.symbols) is list
assert len(obj_pot.symbols) == len(symbols)
for i,v in enumerate(symbols):
obj_pot.symbols[i] = v
assert obj_pot.is_charge is False
assert type(obj_pot.parameter_names) is list
assert len(obj_pot.parameter_names) == len(expected_parameter_names)
for i,v in enumerate(expected_parameter_names):
obj_pot.parameter_names = v
if __name__ == "__main__":
# CONSTRUCTOR TEST
pot = EamPotential(symbols=symbols,
func_pair=func_pair_name,
func_density=func_density_name,
func_embedding=func_embedding_name)
print('pot.potential_type == {}'.format(\
pot.potential_type))
print('pot.symbols == {}'.format(\
pot.symbols))
print('pot.parameter_names == {}'.format(\
pot.parameter_names))
print('pot.is_charge == {}'.format(\
pot.is_charge))
| [
1,
1053,
11451,
1688,
13,
3166,
11451,
1066,
4058,
29889,
17765,
2556,
1053,
382,
314,
29925,
327,
2556,
13,
13,
18098,
29879,
353,
6024,
2499,
2033,
13,
9891,
29918,
18784,
29918,
978,
353,
376,
4939,
29885,
2747,
29908,
13,
9891,
29918,
21518,
537,
29918,
978,
353,
376,
29872,
314,
29918,
21518,
29918,
4548,
29908,
13,
9891,
29918,
17987,
8497,
29918,
978,
353,
376,
5847,
29908,
13,
13,
9684,
29918,
15501,
29918,
7039,
29918,
18784,
29918,
17765,
2556,
353,
5159,
13,
9684,
29918,
15501,
29918,
7039,
29918,
21518,
537,
29918,
2220,
353,
5159,
13,
9684,
29918,
15501,
29918,
7039,
29918,
17987,
8497,
29918,
2220,
353,
5159,
13,
13,
9684,
29918,
15501,
29918,
7039,
353,
518,
13,
4706,
525,
29886,
29918,
2499,
2499,
29918,
2876,
29900,
742,
525,
29886,
29918,
2499,
2499,
29918,
4283,
742,
525,
29886,
29918,
2499,
2499,
29918,
29878,
29900,
742,
29871,
13,
4706,
525,
29881,
29918,
2499,
29918,
4650,
29900,
742,
525,
29881,
29918,
2499,
29918,
3571,
742,
525,
29881,
29918,
2499,
29918,
29878,
29900,
742,
29871,
13,
4706,
525,
29872,
29918,
2499,
29918,
29943,
29900,
742,
525,
29872,
29918,
2499,
29918,
29886,
742,
525,
29872,
29918,
2499,
29918,
29939,
742,
525,
29872,
29918,
2499,
29918,
29943,
29896,
742,
525,
29872,
29918,
2499,
29918,
4650,
29900,
2033,
13,
13,
13,
2158,
29898,
29947,
29900,
29930,
28560,
1495,
13,
2158,
703,
9891,
29918,
18784,
29918,
978,
3790,
29913,
1642,
4830,
29898,
9891,
29918,
18784,
29918,
978,
876,
13,
2158,
703,
9891,
29918,
21518,
537,
29918,
978,
3790,
29913,
1642,
4830,
29898,
9891,
29918,
21518,
537,
29918,
978,
876,
13,
2158,
703,
9891,
29918,
17987,
8497,
29918,
978,
3790,
29913,
1642,
4830,
29898,
9891,
29918,
21518,
537,
29918,
978,
876,
13,
2158,
29898,
29947,
29900,
29930,
28560,
1495,
13,
13,
1753,
1243,
7652,
2344,
1649,
7295,
13,
1678,
5446,
29918,
17765,
353,
382,
314,
29925,
327,
2556,
29898,
13,
9651,
15072,
29922,
18098,
29879,
29892,
13,
9651,
3653,
29918,
18784,
29922,
9891,
29918,
18784,
29918,
978,
29892,
13,
9651,
3653,
29918,
21518,
537,
29922,
9891,
29918,
21518,
537,
29918,
978,
29892,
13,
9651,
3653,
29918,
17987,
8497,
29922,
9891,
29918,
17987,
8497,
29918,
978,
29897,
13,
13,
1678,
4974,
1134,
29898,
5415,
29918,
17765,
29897,
338,
382,
314,
29925,
327,
2556,
13,
1678,
4974,
5446,
29918,
17765,
29889,
17765,
2556,
29918,
1853,
1275,
525,
29872,
314,
29915,
29871,
13,
1678,
4974,
1134,
29898,
5415,
29918,
17765,
29889,
18098,
29879,
29897,
338,
1051,
13,
1678,
4974,
7431,
29898,
5415,
29918,
17765,
29889,
18098,
29879,
29897,
1275,
7431,
29898,
18098,
29879,
29897,
13,
1678,
363,
474,
29892,
29894,
297,
26985,
29898,
18098,
29879,
1125,
13,
4706,
5446,
29918,
17765,
29889,
18098,
29879,
29961,
29875,
29962,
353,
325,
13,
13,
1678,
4974,
5446,
29918,
17765,
29889,
275,
29918,
23367,
338,
7700,
13,
1678,
4974,
1134,
29898,
5415,
29918,
17765,
29889,
15501,
29918,
7039,
29897,
338,
1051,
13,
1678,
4974,
7431,
29898,
5415,
29918,
17765,
29889,
15501,
29918,
7039,
29897,
1275,
7431,
29898,
9684,
29918,
15501,
29918,
7039,
29897,
13,
1678,
363,
474,
29892,
29894,
297,
26985,
29898,
9684,
29918,
15501,
29918,
7039,
1125,
13,
4706,
5446,
29918,
17765,
29889,
15501,
29918,
7039,
353,
325,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
8707,
10810,
29965,
1783,
1955,
17067,
1254,
13,
13,
1678,
3104,
353,
382,
314,
29925,
327,
2556,
29898,
18098,
29879,
29922,
18098,
29879,
29892,
13,
965,
3653,
29918,
18784,
29922,
9891,
29918,
18784,
29918,
978,
29892,
29871,
13,
965,
3653,
29918,
21518,
537,
29922,
9891,
29918,
21518,
537,
29918,
978,
29892,
13,
965,
3653,
29918,
17987,
8497,
29922,
9891,
29918,
17987,
8497,
29918,
978,
29897,
13,
13,
1678,
1596,
877,
17765,
29889,
17765,
2556,
29918,
1853,
1275,
6571,
4286,
4830,
1194,
13,
9651,
3104,
29889,
17765,
2556,
29918,
1853,
876,
13,
1678,
1596,
877,
17765,
29889,
18098,
29879,
1275,
6571,
4286,
4830,
1194,
13,
9651,
3104,
29889,
18098,
29879,
876,
13,
1678,
1596,
877,
17765,
29889,
15501,
29918,
7039,
1275,
6571,
4286,
4830,
1194,
13,
9651,
3104,
29889,
15501,
29918,
7039,
876,
13,
1678,
1596,
877,
17765,
29889,
275,
29918,
23367,
1275,
6571,
4286,
4830,
1194,
13,
9651,
3104,
29889,
275,
29918,
23367,
876,
13,
2
] |
videoanalyst/evaluation/got_benchmark/datasets/lasot.py | TragedyN/SiamFCpp | 737 | 1616108 | from __future__ import absolute_import, print_function
import glob
import json
import os
import pickle
from typing import Dict
import numpy as np
from loguru import logger
from tqdm import tqdm
_VALID_SUBSETS = ['train', 'test']
class LaSOT(object):
r"""`LaSOT <https://cis.temple.edu/lasot/>`_ Datasets.
Publication:
``LaSOT: A High-quality Benchmark for Large-scale Single Object Tracking``,
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, and <NAME>., CVPR 2019.
Args:
root_dir (string): Root directory of dataset where sequence
folders exist.
subset (string, optional): Specify ``train`` or ``test``
subset of LaSOT.
"""
data_dict = {subset: dict() for subset in _VALID_SUBSETS}
def __init__(self,
root_dir,
subset='test',
return_meta=False,
check_integrity=True,
cache_path=None,
ignore_cache=False):
super(LaSOT, self).__init__()
subset = subset.split('_')
assert set(subset).issubset({'train', 'test'}), 'Unknown subset.'
self.root_dir = root_dir
self.subset = subset
self.return_meta = return_meta
# check seems useless, disabled
# if check_integrity:
# self._check_integrity(root_dir)
self.cache_path = cache_path
self.ignore_cache = ignore_cache
self.anno_files = sorted(
glob.glob(os.path.join(root_dir, '*/*/groundtruth.txt')))
self.seq_dirs = [
os.path.join(os.path.dirname(f), 'img') for f in self.anno_files
]
self.seq_names = [
os.path.basename(os.path.dirname(f)) for f in self.anno_files
]
# load subset sequence names
split_file = os.path.join(os.path.dirname(__file__), 'lasot.json')
with open(split_file, 'r') as f:
splits = json.load(f)
self.splits = splits
self.seq_names = []
for s in subset:
self.seq_names.extend(splits[s])
# Former seq_dirs/anno_files have been replaced by caching mechanism.
# See _ensure_cache for detail.
# image and annotation paths
# self.seq_dirs = [os.path.join(
# root_dir, n[:n.rfind('-')], n, 'img')
# for n in self.seq_names]
# self.anno_files = [os.path.join(
# os.path.dirname(d), 'groundtruth.txt')
# for d in self.seq_dirs]
self._ensure_cache()
self.seq_names = [
k for subset in self.subset
for k, _ in LaSOT.data_dict[subset].items()
]
self.seq_names = sorted(self.seq_names)
self.seq_datas = {
k: v
for subset in self.subset
for k, v in LaSOT.data_dict[subset].items()
}
def __getitem__(self, index):
r"""
Args:
index (integer or string): Index or name of a sequence.
Returns:
tuple: (img_files, anno) if ``return_meta`` is False, otherwise
(img_files, anno, meta), where ``img_files`` is a list of
file names, ``anno`` is a N x 4 (rectangles) numpy array, while
``meta`` is a dict contains meta information about the sequence.
"""
# if isinstance(index, six.string_types):
# if not index in self.seq_names:
# raise Exception('Sequence {} not found.'.format(index))
# index = self.seq_names.index(index)
if isinstance(index, int):
index = self.seq_names[index]
seq_data = self.seq_datas[index]
img_files = seq_data["img_files"]
anno = seq_data["anno"]
meta = seq_data["meta"]
# img_files = sorted(glob.glob(os.path.join(
# self.seq_dirs[index], '*.jpg')))
# anno = np.loadtxt(self.anno_files[index], delimiter=',')
if self.return_meta:
meta = self._fetch_meta(self.seq_dirs[index])
return img_files, anno, meta
else:
return img_files, anno
def __len__(self):
return len(self.seq_names)
def _check_integrity(self, root_dir):
seq_names = os.listdir(root_dir)
seq_names = [n for n in seq_names if not n[0] == '.']
if os.path.isdir(root_dir) and len(seq_names) > 0:
# check each sequence folder
for seq_name in seq_names:
seq_dir = os.path.join(root_dir, seq_name)
if not os.path.isdir(seq_dir):
print('Warning: sequence %s not exists.' % seq_name)
else:
# dataset not exists
raise Exception('Dataset not found or corrupted.')
def _fetch_meta(self, seq_dir):
seq_dir = os.path.dirname(seq_dir)
meta = {}
# attributes
for att in ['full_occlusion', 'out_of_view']:
att_file = os.path.join(seq_dir, att + '.txt')
meta[att] = np.loadtxt(att_file, delimiter=',')
# nlp
nlp_file = os.path.join(seq_dir, 'nlp.txt')
with open(nlp_file, 'r') as f:
meta['nlp'] = f.read().strip()
return meta
def _ensure_cache(self):
"""Perform all overheads related to cache (building/loading/check)
"""
# check if subset cache already exists in LaSOT.data_dict and is valid w.r.t. list.txt
if self._check_cache_for_current_subset():
return
# load subset cache into LaSOT.data_dict
cache_path = self._get_cache_path(cache_path=self.cache_path)
self.cache_path = cache_path
if all([os.path.isfile(p)
for p in self.cache_path.values()]) and not self.ignore_cache:
logger.info("{}: cache file exists: {} ".format(
LaSOT.__name__, cache_path))
self._load_cache_for_current_subset(cache_path)
if self._check_cache_for_current_subset():
logger.info(
"{}: record check has been processed and validity is confirmed for cache file: {} "
.format(LaSOT.__name__, cache_path))
return
else:
logger.info(
"{}: cache file {} not valid, rebuilding cache...".format(
LaSOT.__name__, cache_path))
# build subset cache in LaSOT.data_dict and cache to storage
self._build_cache_for_current_subset()
logger.info("{}: current cache file: {} ".format(
LaSOT.__name__, self.cache_path))
logger.info(
"{}: need to clean this cache file if you move dataset directory".
format(LaSOT.__name__))
logger.info(
"{}: consider cleaning this cache file in case of erros such as FileNotFoundError or IOError"
.format(LaSOT.__name__))
def _get_cache_path(self, cache_path: Dict[str, str] = None):
r"""Ensure cache_path.
If cache_path does not exist, turn to default set: root_dir/subset.pkl.
"""
if (cache_path is None) or any(
[not os.path.isfile(cache_path) for p in cache_path.values()]):
logger.info(
"{}: passed cache file {} invalid, change to default cache path"
.format(LaSOT.__name__, cache_path))
cache_path = {
subset: os.path.join(self.root_dir, subset + ".pkl")
for subset in self.subset
}
return cache_path
def _check_cache_for_current_subset(self) -> bool:
r""" check if LaSOT.data_dict[subset] exists and contains all record in seq_names
"""
is_valid_data_dict = all([subset in LaSOT.data_dict for subset in self.subset]) and \
(set([seq_name for subset in self.subset for seq_name in LaSOT.data_dict[subset].keys()]) == set(self.seq_names))
return is_valid_data_dict
def _build_cache_for_current_subset(self):
r"""Build cache for current subset (self.subset)
"""
root_dir = self.root_dir
subset = self.subset
for s in subset:
logger.info("{}: start loading {}".format(LaSOT.__name__, s))
seq_names = self.splits[s]
for seq_name in tqdm(seq_names):
seq_dir = os.path.join(root_dir, seq_name[:seq_name.rfind('-')],
seq_name)
img_files, anno, meta = self.load_single_sequence(seq_dir)
LaSOT.data_dict[s][seq_name] = dict(img_files=img_files,
anno=anno,
meta=meta)
with open(self.cache_path[s], "wb") as f:
pickle.dump(LaSOT.data_dict[s], f)
logger.info("{}: dump cache file to {}".format(
LaSOT.__name__, self.cache_path[s]))
def _load_cache_for_current_subset(self, cache_path: Dict[str, str]):
for subset in self.subset:
assert os.path.exists(
cache_path[subset]
), "cache_path does not exist: %s " % cache_path[subset]
with open(cache_path[subset], "rb") as f:
LaSOT.data_dict[subset] = pickle.load(f)
logger.info("{}: loaded cache file {}".format(
LaSOT.__name__, cache_path[subset]))
def load_single_sequence(self, seq_dir):
img_files = sorted(glob.glob(os.path.join(seq_dir, 'img/*.jpg')))
anno = np.loadtxt(os.path.join(seq_dir, "groundtruth.txt"),
delimiter=',')
assert len(img_files) == len(anno)
if self.return_meta:
meta = self._fetch_meta(seq_dir)
return img_files, anno, meta
else:
return img_files, anno, None
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
1596,
29918,
2220,
13,
13,
5215,
13149,
13,
5215,
4390,
13,
5215,
2897,
13,
5215,
5839,
280,
13,
3166,
19229,
1053,
360,
919,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
1480,
20144,
1053,
17927,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
13,
29918,
26707,
29918,
20633,
1660,
9375,
353,
6024,
14968,
742,
525,
1688,
2033,
13,
13,
13,
1990,
997,
29903,
2891,
29898,
3318,
1125,
13,
1678,
364,
15945,
6937,
5661,
29903,
2891,
529,
991,
597,
3476,
29889,
1356,
552,
29889,
6085,
29914,
3333,
327,
3779,
29952,
29918,
13373,
294,
1691,
29889,
13,
13,
1678,
5236,
362,
29901,
13,
4706,
4954,
5661,
29903,
2891,
29901,
319,
5057,
29899,
29567,
4111,
16580,
363,
8218,
479,
29899,
7052,
16740,
4669,
17026,
292,
29952,
1673,
13,
4706,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
13,
4706,
529,
5813,
10202,
529,
5813,
10202,
322,
529,
5813,
29958,
1696,
25778,
10593,
29871,
29906,
29900,
29896,
29929,
29889,
13,
268,
13,
1678,
826,
3174,
29901,
13,
4706,
3876,
29918,
3972,
313,
1807,
1125,
28272,
3884,
310,
8783,
988,
5665,
13,
9651,
16495,
1863,
29889,
13,
4706,
11306,
313,
1807,
29892,
13136,
1125,
12048,
1598,
4954,
14968,
16159,
470,
4954,
1688,
16159,
13,
9651,
11306,
310,
997,
29903,
2891,
29889,
13,
1678,
9995,
13,
1678,
848,
29918,
8977,
353,
426,
6484,
29901,
9657,
580,
363,
11306,
297,
903,
26707,
29918,
20633,
1660,
9375,
29913,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
3876,
29918,
3972,
29892,
13,
462,
11306,
2433,
1688,
742,
13,
462,
736,
29918,
7299,
29922,
8824,
29892,
13,
462,
1423,
29918,
14146,
537,
29922,
5574,
29892,
13,
462,
7090,
29918,
2084,
29922,
8516,
29892,
13,
462,
11455,
29918,
8173,
29922,
8824,
1125,
13,
4706,
2428,
29898,
5661,
29903,
2891,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
11306,
353,
11306,
29889,
5451,
877,
29918,
1495,
13,
4706,
4974,
731,
29898,
6484,
467,
790,
431,
842,
3319,
29915,
14968,
742,
525,
1688,
29915,
9594,
525,
14148,
11306,
6169,
13,
13,
4706,
1583,
29889,
4632,
29918,
3972,
353,
3876,
29918,
3972,
13,
4706,
1583,
29889,
6484,
353,
11306,
13,
4706,
1583,
29889,
2457,
29918,
7299,
353,
736,
29918,
7299,
13,
4706,
396,
1423,
2444,
19315,
29892,
12708,
13,
4706,
396,
565,
1423,
29918,
14146,
537,
29901,
13,
4706,
396,
268,
1583,
3032,
3198,
29918,
14146,
537,
29898,
4632,
29918,
3972,
29897,
13,
4706,
1583,
29889,
8173,
29918,
2084,
353,
7090,
29918,
2084,
13,
4706,
1583,
29889,
17281,
29918,
8173,
353,
11455,
29918,
8173,
13,
13,
4706,
1583,
29889,
7665,
29918,
5325,
353,
12705,
29898,
13,
9651,
13149,
29889,
23705,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4632,
29918,
3972,
29892,
525,
3877,
3877,
2057,
509,
2806,
29889,
3945,
29915,
4961,
13,
4706,
1583,
29889,
11762,
29918,
3972,
29879,
353,
518,
13,
9651,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
29898,
29888,
511,
525,
2492,
1495,
363,
285,
297,
1583,
29889,
7665,
29918,
5325,
13,
4706,
4514,
13,
4706,
1583,
29889,
11762,
29918,
7039,
353,
518,
13,
9651,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
359,
29889,
2084,
29889,
25721,
29898,
29888,
876,
363,
285,
297,
1583,
29889,
7665,
29918,
5325,
13,
4706,
4514,
13,
13,
4706,
396,
2254,
11306,
5665,
2983,
13,
4706,
6219,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
3333,
327,
29889,
3126,
1495,
13,
4706,
411,
1722,
29898,
5451,
29918,
1445,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
9651,
8536,
1169,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
4706,
1583,
29889,
23579,
1169,
353,
8536,
1169,
13,
4706,
1583,
29889,
11762,
29918,
7039,
353,
5159,
13,
4706,
363,
269,
297,
11306,
29901,
13,
9651,
1583,
29889,
11762,
29918,
7039,
29889,
21843,
29898,
23579,
1169,
29961,
29879,
2314,
13,
13,
4706,
396,
3812,
261,
19359,
29918,
3972,
29879,
29914,
7665,
29918,
5325,
505,
1063,
8611,
491,
22488,
13336,
29889,
13,
4706,
396,
2823,
903,
7469,
29918,
8173,
363,
9493,
29889,
13,
4706,
396,
1967,
322,
17195,
10898,
13,
4706,
396,
1583,
29889,
11762,
29918,
3972,
29879,
353,
518,
359,
29889,
2084,
29889,
7122,
29898,
13,
4706,
396,
268,
3876,
29918,
3972,
29892,
302,
7503,
29876,
29889,
29878,
2886,
877,
29899,
1495,
1402,
302,
29892,
525,
2492,
1495,
13,
4706,
396,
268,
363,
302,
297,
1583,
29889,
11762,
29918,
7039,
29962,
13,
4706,
396,
1583,
29889,
7665,
29918,
5325,
353,
518,
359,
29889,
2084,
29889,
7122,
29898,
13,
4706,
396,
268,
2897,
29889,
2084,
29889,
25721,
29898,
29881,
511,
525,
2057,
509,
2806,
29889,
3945,
1495,
13,
4706,
396,
268,
363,
270,
297,
1583,
29889,
11762,
29918,
3972,
29879,
29962,
13,
4706,
1583,
3032,
7469,
29918,
8173,
580,
13,
4706,
1583,
29889,
11762,
29918,
7039,
353,
518,
13,
9651,
413,
363,
11306,
297,
1583,
29889,
6484,
13,
9651,
363,
413,
29892,
903,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
6484,
1822,
7076,
580,
13,
4706,
4514,
13,
4706,
1583,
29889,
11762,
29918,
7039,
353,
12705,
29898,
1311,
29889,
11762,
29918,
7039,
29897,
13,
4706,
1583,
29889,
11762,
29918,
14538,
353,
426,
13,
9651,
413,
29901,
325,
13,
9651,
363,
11306,
297,
1583,
29889,
6484,
13,
9651,
363,
413,
29892,
325,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
6484,
1822,
7076,
580,
13,
4706,
500,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
364,
15945,
29908,
308,
13,
4706,
826,
3174,
29901,
13,
9651,
2380,
313,
16031,
470,
1347,
1125,
11374,
470,
1024,
310,
263,
5665,
29889,
13,
308,
13,
4706,
16969,
29901,
13,
9651,
18761,
29901,
313,
2492,
29918,
5325,
29892,
12327,
29897,
565,
4954,
2457,
29918,
7299,
16159,
338,
7700,
29892,
6467,
13,
18884,
313,
2492,
29918,
5325,
29892,
12327,
29892,
12700,
511,
988,
4954,
2492,
29918,
5325,
16159,
338,
263,
1051,
310,
13,
18884,
934,
2983,
29892,
4954,
7665,
16159,
338,
263,
405,
921,
29871,
29946,
313,
1621,
19536,
29897,
12655,
1409,
29892,
1550,
13,
18884,
4954,
7299,
16159,
338,
263,
9657,
3743,
12700,
2472,
1048,
278,
5665,
29889,
13,
4706,
9995,
13,
4706,
396,
565,
338,
8758,
29898,
2248,
29892,
4832,
29889,
1807,
29918,
8768,
1125,
13,
4706,
396,
268,
565,
451,
2380,
297,
1583,
29889,
11762,
29918,
7039,
29901,
13,
4706,
396,
308,
12020,
8960,
877,
20529,
6571,
451,
1476,
29889,
4286,
4830,
29898,
2248,
876,
13,
4706,
396,
268,
2380,
353,
1583,
29889,
11762,
29918,
7039,
29889,
2248,
29898,
2248,
29897,
13,
4706,
565,
338,
8758,
29898,
2248,
29892,
938,
1125,
13,
9651,
2380,
353,
1583,
29889,
11762,
29918,
7039,
29961,
2248,
29962,
13,
13,
4706,
19359,
29918,
1272,
353,
1583,
29889,
11762,
29918,
14538,
29961,
2248,
29962,
13,
4706,
10153,
29918,
5325,
353,
19359,
29918,
1272,
3366,
2492,
29918,
5325,
3108,
13,
4706,
12327,
353,
19359,
29918,
1272,
3366,
7665,
3108,
13,
4706,
12700,
353,
19359,
29918,
1272,
3366,
7299,
3108,
13,
13,
4706,
396,
10153,
29918,
5325,
353,
12705,
29898,
23705,
29889,
23705,
29898,
359,
29889,
2084,
29889,
7122,
29898,
13,
4706,
396,
268,
1583,
29889,
11762,
29918,
3972,
29879,
29961,
2248,
1402,
525,
10521,
6173,
29915,
4961,
13,
4706,
396,
12327,
353,
7442,
29889,
1359,
3945,
29898,
1311,
29889,
7665,
29918,
5325,
29961,
2248,
1402,
28552,
29922,
742,
1495,
13,
13,
4706,
565,
1583,
29889,
2457,
29918,
7299,
29901,
13,
9651,
12700,
353,
1583,
3032,
9155,
29918,
7299,
29898,
1311,
29889,
11762,
29918,
3972,
29879,
29961,
2248,
2314,
13,
9651,
736,
10153,
29918,
5325,
29892,
12327,
29892,
12700,
13,
4706,
1683,
29901,
13,
9651,
736,
10153,
29918,
5325,
29892,
12327,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
11762,
29918,
7039,
29897,
13,
13,
1678,
822,
903,
3198,
29918,
14146,
537,
29898,
1311,
29892,
3876,
29918,
3972,
1125,
13,
4706,
19359,
29918,
7039,
353,
2897,
29889,
1761,
3972,
29898,
4632,
29918,
3972,
29897,
13,
4706,
19359,
29918,
7039,
353,
518,
29876,
363,
302,
297,
19359,
29918,
7039,
565,
451,
302,
29961,
29900,
29962,
1275,
15300,
2033,
13,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
4632,
29918,
3972,
29897,
322,
7431,
29898,
11762,
29918,
7039,
29897,
1405,
29871,
29900,
29901,
13,
9651,
396,
1423,
1269,
5665,
4138,
13,
9651,
363,
19359,
29918,
978,
297,
19359,
29918,
7039,
29901,
13,
18884,
19359,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4632,
29918,
3972,
29892,
19359,
29918,
978,
29897,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
11762,
29918,
3972,
1125,
13,
462,
1678,
1596,
877,
22709,
29901,
5665,
1273,
29879,
451,
4864,
6169,
1273,
19359,
29918,
978,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
8783,
451,
4864,
13,
9651,
12020,
8960,
877,
16390,
24541,
451,
1476,
470,
1034,
14214,
29889,
1495,
13,
13,
1678,
822,
903,
9155,
29918,
7299,
29898,
1311,
29892,
19359,
29918,
3972,
1125,
13,
4706,
19359,
29918,
3972,
353,
2897,
29889,
2084,
29889,
25721,
29898,
11762,
29918,
3972,
29897,
13,
4706,
12700,
353,
6571,
13,
13,
4706,
396,
8393,
13,
4706,
363,
1098,
297,
6024,
8159,
29918,
542,
10085,
742,
525,
449,
29918,
974,
29918,
1493,
2033,
29901,
13,
9651,
1098,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
11762,
29918,
3972,
29892,
1098,
718,
15300,
3945,
1495,
13,
9651,
12700,
29961,
1131,
29962,
353,
7442,
29889,
1359,
3945,
29898,
1131,
29918,
1445,
29892,
28552,
29922,
742,
1495,
13,
13,
4706,
396,
302,
22833,
13,
4706,
302,
22833,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
11762,
29918,
3972,
29892,
525,
12938,
29886,
29889,
3945,
1495,
13,
4706,
411,
1722,
29898,
12938,
29886,
29918,
1445,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
9651,
12700,
1839,
12938,
29886,
2033,
353,
285,
29889,
949,
2141,
17010,
580,
13,
13,
4706,
736,
12700,
13,
13,
1678,
822,
903,
7469,
29918,
8173,
29898,
1311,
1125,
13,
4706,
9995,
5894,
689,
599,
18702,
29879,
4475,
304,
7090,
313,
25237,
29914,
13234,
29914,
3198,
29897,
13,
4706,
9995,
13,
4706,
396,
1423,
565,
11306,
7090,
2307,
4864,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
322,
338,
2854,
281,
29889,
29878,
29889,
29873,
29889,
1051,
29889,
3945,
13,
4706,
565,
1583,
3032,
3198,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
7295,
13,
9651,
736,
13,
13,
4706,
396,
2254,
11306,
7090,
964,
997,
29903,
2891,
29889,
1272,
29918,
8977,
13,
4706,
7090,
29918,
2084,
353,
1583,
3032,
657,
29918,
8173,
29918,
2084,
29898,
8173,
29918,
2084,
29922,
1311,
29889,
8173,
29918,
2084,
29897,
13,
4706,
1583,
29889,
8173,
29918,
2084,
353,
7090,
29918,
2084,
13,
4706,
565,
599,
4197,
359,
29889,
2084,
29889,
275,
1445,
29898,
29886,
29897,
13,
18884,
363,
282,
297,
1583,
29889,
8173,
29918,
2084,
29889,
5975,
580,
2314,
322,
451,
1583,
29889,
17281,
29918,
8173,
29901,
13,
9651,
17927,
29889,
3888,
703,
29912,
6177,
7090,
934,
4864,
29901,
6571,
11393,
4830,
29898,
13,
18884,
997,
29903,
2891,
17255,
978,
1649,
29892,
7090,
29918,
2084,
876,
13,
9651,
1583,
3032,
1359,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
29898,
8173,
29918,
2084,
29897,
13,
9651,
565,
1583,
3032,
3198,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
7295,
13,
18884,
17927,
29889,
3888,
29898,
13,
462,
1678,
29850,
6177,
2407,
1423,
756,
1063,
19356,
322,
2854,
537,
338,
16725,
363,
7090,
934,
29901,
6571,
376,
13,
462,
1678,
869,
4830,
29898,
5661,
29903,
2891,
17255,
978,
1649,
29892,
7090,
29918,
2084,
876,
13,
18884,
736,
13,
9651,
1683,
29901,
13,
18884,
17927,
29889,
3888,
29898,
13,
462,
1678,
29850,
6177,
7090,
934,
6571,
451,
2854,
29892,
337,
25237,
7090,
856,
1642,
4830,
29898,
13,
462,
4706,
997,
29903,
2891,
17255,
978,
1649,
29892,
7090,
29918,
2084,
876,
13,
4706,
396,
2048,
11306,
7090,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
322,
7090,
304,
8635,
13,
4706,
1583,
3032,
4282,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
580,
13,
4706,
17927,
29889,
3888,
703,
29912,
6177,
1857,
7090,
934,
29901,
6571,
11393,
4830,
29898,
13,
9651,
997,
29903,
2891,
17255,
978,
1649,
29892,
1583,
29889,
8173,
29918,
2084,
876,
13,
4706,
17927,
29889,
3888,
29898,
13,
9651,
29850,
6177,
817,
304,
5941,
445,
7090,
934,
565,
366,
4337,
8783,
3884,
1642,
13,
9651,
3402,
29898,
5661,
29903,
2891,
17255,
978,
1649,
876,
13,
4706,
17927,
29889,
3888,
29898,
13,
9651,
29850,
6177,
2050,
5941,
292,
445,
7090,
934,
297,
1206,
310,
604,
1883,
1316,
408,
3497,
17413,
2392,
470,
10663,
2392,
29908,
13,
9651,
869,
4830,
29898,
5661,
29903,
2891,
17255,
978,
1649,
876,
13,
13,
1678,
822,
903,
657,
29918,
8173,
29918,
2084,
29898,
1311,
29892,
7090,
29918,
2084,
29901,
360,
919,
29961,
710,
29892,
851,
29962,
353,
6213,
1125,
13,
4706,
364,
15945,
29908,
29923,
1983,
545,
7090,
29918,
2084,
29889,
13,
9651,
960,
7090,
29918,
2084,
947,
451,
1863,
29892,
2507,
304,
2322,
731,
29901,
3876,
29918,
3972,
29914,
6484,
29889,
29886,
6321,
29889,
13,
4706,
9995,
13,
4706,
565,
313,
8173,
29918,
2084,
338,
6213,
29897,
470,
738,
29898,
13,
9651,
518,
1333,
2897,
29889,
2084,
29889,
275,
1445,
29898,
8173,
29918,
2084,
29897,
363,
282,
297,
7090,
29918,
2084,
29889,
5975,
580,
29962,
1125,
13,
9651,
17927,
29889,
3888,
29898,
13,
18884,
29850,
6177,
4502,
7090,
934,
6571,
8340,
29892,
1735,
304,
2322,
7090,
2224,
29908,
13,
18884,
869,
4830,
29898,
5661,
29903,
2891,
17255,
978,
1649,
29892,
7090,
29918,
2084,
876,
13,
9651,
7090,
29918,
2084,
353,
426,
13,
18884,
11306,
29901,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
4632,
29918,
3972,
29892,
11306,
718,
11393,
29886,
6321,
1159,
13,
18884,
363,
11306,
297,
1583,
29889,
6484,
13,
9651,
500,
13,
4706,
736,
7090,
29918,
2084,
13,
13,
1678,
822,
903,
3198,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
364,
15945,
29908,
1423,
565,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
6484,
29962,
4864,
322,
3743,
599,
2407,
297,
19359,
29918,
7039,
13,
4706,
9995,
13,
4706,
338,
29918,
3084,
29918,
1272,
29918,
8977,
353,
599,
4197,
6484,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
363,
11306,
297,
1583,
29889,
6484,
2314,
322,
320,
13,
462,
632,
313,
842,
4197,
11762,
29918,
978,
363,
11306,
297,
1583,
29889,
6484,
363,
19359,
29918,
978,
297,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
6484,
1822,
8149,
580,
2314,
1275,
731,
29898,
1311,
29889,
11762,
29918,
7039,
876,
13,
4706,
736,
338,
29918,
3084,
29918,
1272,
29918,
8977,
13,
13,
1678,
822,
903,
4282,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
29898,
1311,
1125,
13,
4706,
364,
15945,
29908,
8893,
7090,
363,
1857,
11306,
313,
1311,
29889,
6484,
29897,
13,
4706,
9995,
13,
4706,
3876,
29918,
3972,
353,
1583,
29889,
4632,
29918,
3972,
13,
4706,
11306,
353,
1583,
29889,
6484,
13,
4706,
363,
269,
297,
11306,
29901,
13,
9651,
17927,
29889,
3888,
703,
29912,
6177,
1369,
8363,
6571,
1642,
4830,
29898,
5661,
29903,
2891,
17255,
978,
1649,
29892,
269,
876,
13,
9651,
19359,
29918,
7039,
353,
1583,
29889,
23579,
1169,
29961,
29879,
29962,
13,
9651,
363,
19359,
29918,
978,
297,
260,
29939,
18933,
29898,
11762,
29918,
7039,
1125,
13,
18884,
19359,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4632,
29918,
3972,
29892,
19359,
29918,
978,
7503,
11762,
29918,
978,
29889,
29878,
2886,
877,
29899,
1495,
1402,
13,
462,
462,
539,
19359,
29918,
978,
29897,
13,
18884,
10153,
29918,
5325,
29892,
12327,
29892,
12700,
353,
1583,
29889,
1359,
29918,
14369,
29918,
16506,
29898,
11762,
29918,
3972,
29897,
13,
18884,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
29879,
3816,
11762,
29918,
978,
29962,
353,
9657,
29898,
2492,
29918,
5325,
29922,
2492,
29918,
5325,
29892,
13,
462,
462,
462,
1678,
12327,
29922,
7665,
29892,
13,
462,
462,
462,
1678,
12700,
29922,
7299,
29897,
13,
9651,
411,
1722,
29898,
1311,
29889,
8173,
29918,
2084,
29961,
29879,
1402,
376,
29893,
29890,
1159,
408,
285,
29901,
13,
18884,
5839,
280,
29889,
15070,
29898,
5661,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
29879,
1402,
285,
29897,
13,
9651,
17927,
29889,
3888,
703,
29912,
6177,
16766,
7090,
934,
304,
6571,
1642,
4830,
29898,
13,
18884,
997,
29903,
2891,
17255,
978,
1649,
29892,
1583,
29889,
8173,
29918,
2084,
29961,
29879,
12622,
13,
13,
1678,
822,
903,
1359,
29918,
8173,
29918,
1454,
29918,
3784,
29918,
6484,
29898,
1311,
29892,
7090,
29918,
2084,
29901,
360,
919,
29961,
710,
29892,
851,
29962,
1125,
13,
4706,
363,
11306,
297,
1583,
29889,
6484,
29901,
13,
9651,
4974,
2897,
29889,
2084,
29889,
9933,
29898,
13,
18884,
7090,
29918,
2084,
29961,
6484,
29962,
13,
9651,
10353,
376,
8173,
29918,
2084,
947,
451,
1863,
29901,
1273,
29879,
376,
1273,
7090,
29918,
2084,
29961,
6484,
29962,
13,
9651,
411,
1722,
29898,
8173,
29918,
2084,
29961,
6484,
1402,
376,
6050,
1159,
408,
285,
29901,
13,
18884,
997,
29903,
2891,
29889,
1272,
29918,
8977,
29961,
6484,
29962,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
9651,
17927,
29889,
3888,
703,
29912,
6177,
7500,
7090,
934,
6571,
1642,
4830,
29898,
13,
18884,
997,
29903,
2891,
17255,
978,
1649,
29892,
7090,
29918,
2084,
29961,
6484,
12622,
13,
13,
1678,
822,
2254,
29918,
14369,
29918,
16506,
29898,
1311,
29892,
19359,
29918,
3972,
1125,
13,
4706,
10153,
29918,
5325,
353,
12705,
29898,
23705,
29889,
23705,
29898,
359,
29889,
2084,
29889,
7122,
29898,
11762,
29918,
3972,
29892,
525,
2492,
5515,
29889,
6173,
29915,
4961,
13,
4706,
12327,
353,
7442,
29889,
1359,
3945,
29898,
359,
29889,
2084,
29889,
7122,
29898,
11762,
29918,
3972,
29892,
376,
2057,
509,
2806,
29889,
3945,
4968,
13,
462,
3986,
28552,
29922,
742,
1495,
13,
13,
4706,
4974,
7431,
29898,
2492,
29918,
5325,
29897,
1275,
7431,
29898,
7665,
29897,
13,
13,
4706,
565,
1583,
29889,
2457,
29918,
7299,
29901,
13,
9651,
12700,
353,
1583,
3032,
9155,
29918,
7299,
29898,
11762,
29918,
3972,
29897,
13,
9651,
736,
10153,
29918,
5325,
29892,
12327,
29892,
12700,
13,
4706,
1683,
29901,
13,
9651,
736,
10153,
29918,
5325,
29892,
12327,
29892,
6213,
13,
2
] |
subscriptions/urls.py | praekeltfoundation/seed-stage-based-messaging | 1 | 144523 | <reponame>praekeltfoundation/seed-stage-based-messaging
from django.conf.urls import include, url
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r"subscriptions", views.SubscriptionViewSet)
router.register(r"failed-tasks", views.FailedTaskViewSet)
router.register(r"behind-subscriptions", views.BehindSubscriptionViewSet)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browseable API.
urlpatterns = [
url(r"^api/v1/", include(router.urls)),
url(
r"^api/v1/subscriptions/(?P<subscription_id>.+)/send$",
views.SubscriptionSend.as_view(),
name="subscription-send",
),
url(
r"^api/v1/subscriptions/(?P<subscription_id>.+)/resend$",
views.SubscriptionResend.as_view(),
),
url(r"^api/v1/subscriptions/request$", views.SubscriptionRequest.as_view()),
url(r"^api/v1/user/token/$", views.UserView.as_view(), name="create-user-token"),
url(r"^api/v1/runsendestimate$", views.DailyEstimateRun.as_view()),
]
| [
1,
529,
276,
1112,
420,
29958,
29886,
336,
1416,
2152,
11940,
362,
29914,
26776,
29899,
19190,
29899,
6707,
29899,
12062,
6751,
13,
3166,
9557,
29889,
5527,
29889,
26045,
1053,
3160,
29892,
3142,
13,
3166,
1791,
29918,
4468,
1053,
16053,
2153,
13,
13,
3166,
869,
1053,
8386,
13,
13,
15140,
353,
16053,
2153,
29889,
4592,
23971,
580,
13,
15140,
29889,
9573,
29898,
29878,
29908,
1491,
7588,
1980,
613,
8386,
29889,
4035,
22371,
1043,
2697,
29897,
13,
15140,
29889,
9573,
29898,
29878,
29908,
26061,
29899,
20673,
613,
8386,
29889,
17776,
5398,
1043,
2697,
29897,
13,
15140,
29889,
9573,
29898,
29878,
29908,
915,
16887,
29899,
1491,
7588,
1980,
613,
8386,
29889,
3629,
16887,
4035,
22371,
1043,
2697,
29897,
13,
13,
29937,
399,
533,
701,
1749,
3450,
773,
18428,
3988,
21398,
29889,
13,
29937,
19814,
29892,
591,
3160,
6464,
24295,
363,
278,
3347,
344,
519,
3450,
29889,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
3142,
29898,
29878,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
613,
3160,
29898,
15140,
29889,
26045,
8243,
13,
1678,
3142,
29898,
13,
4706,
364,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
1491,
7588,
1980,
29914,
10780,
29925,
29966,
1491,
22371,
29918,
333,
15513,
29974,
6802,
6717,
29938,
613,
13,
4706,
8386,
29889,
4035,
22371,
12600,
29889,
294,
29918,
1493,
3285,
13,
4706,
1024,
543,
1491,
22371,
29899,
6717,
613,
13,
1678,
10353,
13,
1678,
3142,
29898,
13,
4706,
364,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
1491,
7588,
1980,
29914,
10780,
29925,
29966,
1491,
22371,
29918,
333,
15513,
29974,
6802,
690,
355,
29938,
613,
13,
4706,
8386,
29889,
4035,
22371,
1666,
355,
29889,
294,
29918,
1493,
3285,
13,
1678,
10353,
13,
1678,
3142,
29898,
29878,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
1491,
7588,
1980,
29914,
3827,
29938,
613,
8386,
29889,
4035,
22371,
3089,
29889,
294,
29918,
1493,
25739,
13,
1678,
3142,
29898,
29878,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
1792,
29914,
6979,
13346,
613,
8386,
29889,
2659,
1043,
29889,
294,
29918,
1493,
3285,
1024,
543,
3258,
29899,
1792,
29899,
6979,
4968,
13,
1678,
3142,
29898,
29878,
29908,
29985,
2754,
29914,
29894,
29896,
29914,
3389,
6717,
342,
6490,
29938,
613,
8386,
29889,
29928,
8683,
12787,
6490,
6558,
29889,
294,
29918,
1493,
25739,
13,
29962,
13,
2
] |
cdk/consoleme_ecs_service/nested_stacks/vpc_stack.py | avishayil/consoleme-ecs-service | 2 | 23622 | """
VPC stack for running ConsoleMe on ECS
"""
import urllib.request
from aws_cdk import (
aws_ec2 as ec2,
core as cdk
)
class VPCStack(cdk.NestedStack):
"""
VPC stack for running ConsoleMe on ECS
"""
def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# VPC and security groups
vpc = ec2.Vpc(
self, 'Vpc',
max_azs=2
)
consoleme_sg = ec2.SecurityGroup(
self,
'LBSG',
vpc=vpc,
description='Consoleme ECS service load balancer security group',
allow_all_outbound=True
)
# Open ingress to the deploying computer public IP
my_ip_cidr = urllib.request.urlopen(
'http://checkip.amazonaws.com').read().decode('utf-8').strip() + '/32'
consoleme_sg.add_ingress_rule(
peer=ec2.Peer.ipv4(cidr_ip=my_ip_cidr),
connection=ec2.Port.tcp(port=443),
description='Allow HTTPS traffic'
)
redis_sg = ec2.SecurityGroup(
self,
'ECSG',
vpc=vpc,
description='Consoleme Redis security group',
allow_all_outbound=True
)
redis_sg.connections.allow_from(consoleme_sg, port_range=ec2.Port.tcp(
port=6379), description='Allow ingress from ConsoleMe containers')
self.vpc = vpc
self.redis_sg = redis_sg
self.consoleme_sg = consoleme_sg
| [
1,
9995,
13,
29963,
9026,
5096,
363,
2734,
9405,
6816,
373,
382,
9295,
13,
15945,
29908,
13,
13,
5215,
3142,
1982,
29889,
3827,
13,
13,
3166,
25879,
29918,
2252,
29895,
1053,
313,
13,
1678,
25879,
29918,
687,
29906,
408,
21226,
29906,
29892,
13,
1678,
7136,
408,
274,
8181,
13,
29897,
13,
13,
13,
1990,
478,
9026,
7264,
29898,
2252,
29895,
29889,
29940,
2868,
7264,
1125,
13,
1678,
9995,
13,
1678,
478,
9026,
5096,
363,
2734,
9405,
6816,
373,
382,
9295,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6874,
29901,
274,
8181,
29889,
1168,
4984,
29892,
1178,
29901,
851,
29892,
3579,
19290,
29897,
1599,
6213,
29901,
13,
4706,
2428,
2141,
1649,
2344,
12035,
6078,
29892,
1178,
29892,
3579,
19290,
29897,
13,
13,
4706,
396,
478,
9026,
322,
6993,
6471,
13,
13,
4706,
325,
6739,
353,
21226,
29906,
29889,
29963,
6739,
29898,
13,
9651,
1583,
29892,
525,
29963,
6739,
742,
13,
9651,
4236,
29918,
834,
29879,
29922,
29906,
13,
4706,
1723,
13,
13,
4706,
2991,
1004,
29918,
5311,
353,
21226,
29906,
29889,
13228,
4782,
29898,
13,
9651,
1583,
29892,
13,
9651,
525,
29931,
9851,
29954,
742,
13,
9651,
325,
6739,
29922,
29894,
6739,
29892,
13,
9651,
6139,
2433,
20008,
1004,
382,
9295,
2669,
2254,
6411,
25856,
6993,
2318,
742,
13,
9651,
2758,
29918,
497,
29918,
449,
9917,
29922,
5574,
13,
4706,
1723,
13,
13,
4706,
396,
4673,
2348,
1253,
304,
278,
7246,
292,
6601,
970,
5641,
13,
13,
4706,
590,
29918,
666,
29918,
25232,
29878,
353,
3142,
1982,
29889,
3827,
29889,
332,
417,
2238,
29898,
13,
9651,
525,
1124,
597,
3198,
666,
29889,
17260,
10467,
29889,
510,
2824,
949,
2141,
13808,
877,
9420,
29899,
29947,
2824,
17010,
580,
718,
8207,
29941,
29906,
29915,
13,
13,
4706,
2991,
1004,
29918,
5311,
29889,
1202,
29918,
292,
1253,
29918,
7491,
29898,
13,
9651,
23533,
29922,
687,
29906,
29889,
15666,
261,
29889,
666,
29894,
29946,
29898,
25232,
29878,
29918,
666,
29922,
1357,
29918,
666,
29918,
25232,
29878,
511,
13,
9651,
3957,
29922,
687,
29906,
29889,
2290,
29889,
23981,
29898,
637,
29922,
29946,
29946,
29941,
511,
13,
9651,
6139,
2433,
15930,
7331,
29903,
12469,
29915,
13,
4706,
1723,
13,
13,
4706,
29825,
29918,
5311,
353,
21226,
29906,
29889,
13228,
4782,
29898,
13,
9651,
1583,
29892,
13,
9651,
525,
29923,
9295,
29954,
742,
13,
9651,
325,
6739,
29922,
29894,
6739,
29892,
13,
9651,
6139,
2433,
20008,
1004,
4367,
275,
6993,
2318,
742,
13,
9651,
2758,
29918,
497,
29918,
449,
9917,
29922,
5574,
13,
4706,
1723,
13,
13,
4706,
29825,
29918,
5311,
29889,
11958,
1953,
29889,
9536,
29918,
3166,
29898,
11058,
1004,
29918,
5311,
29892,
2011,
29918,
3881,
29922,
687,
29906,
29889,
2290,
29889,
23981,
29898,
13,
9651,
2011,
29922,
29953,
29941,
29955,
29929,
511,
6139,
2433,
15930,
2348,
1253,
515,
9405,
6816,
22637,
1495,
13,
13,
4706,
1583,
29889,
29894,
6739,
353,
325,
6739,
13,
4706,
1583,
29889,
1127,
275,
29918,
5311,
353,
29825,
29918,
5311,
13,
4706,
1583,
29889,
11058,
1004,
29918,
5311,
353,
2991,
1004,
29918,
5311,
13,
2
] |
model_vc.py | casperwang/autovc | 2 | 166832 | import torch
import pdb
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pdb
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)
torch.nn.init.xavier_uniform_(
self.linear_layer.weight,
gain=torch.nn.init.calculate_gain(w_init_gain))
def forward(self, x):
return self.linear_layer(x)
class ConvNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=None, dilation=1, bias=True, w_init_gain='linear'):
super(ConvNorm, self).__init__()
if padding is None:
assert(kernel_size % 2 == 1)
padding = int(dilation * (kernel_size - 1) / 2)
self.conv = torch.nn.Conv1d(in_channels, out_channels,
kernel_size=kernel_size, stride=stride,
padding=padding, dilation=dilation,
bias=bias)
torch.nn.init.xavier_uniform_(
self.conv.weight, gain=torch.nn.init.calculate_gain(w_init_gain))
def forward(self, signal):
conv_signal = self.conv(signal)
return conv_signal
class Encoder(nn.Module):
"""Encoder module:
"""
def __init__(self, dim_neck, dim_emb, freq): #Set up 5x1 ConvNorm * 3 and BLSTM * 2
# What is dim_emb ?
super(Encoder, self).__init__()
self.dim_neck = dim_neck #What is dim_neck? #irene: 這個參數用在61行,那個位置代表lstm的hidden size
self.freq = freq #What is freq? #irene: 參考paper 4.2,freq是downsampling/upsampling留下的取timestamp的frequency
convolutions = []
for i in range(3):
conv_layer = nn.Sequential(
ConvNorm(80+dim_emb if i==0 else 512,
512,
kernel_size=5, stride=1,
padding=2,
dilation=1, w_init_gain='relu'),
nn.BatchNorm1d(512)) #Not so sure about what this is
#irene: 針對這次要訓練的batch做normalization,network中要加batchnorm的目的主要是要讓
# 該batch的每一筆feature有一樣的scaling,如果feature因為scale差很多,對output的影響
# 不一樣,做backpropagation時算得的gradient會不同,造成訓練困難
# 詳細可以參考李宏毅老師的課程影片 https://www.youtube.com/watch?v=BZh1ltr5Rkg
# OK 已了解!
convolutions.append(conv_layer)
self.convolutions = nn.ModuleList(convolutions) #Turns the list of Models into one big model I think
#irene: yes, 按照list裡的順序合成一個module
self.lstm = nn.LSTM(512, dim_neck, 2, batch_first=True, bidirectional=True) #Adds BLSTM * 2
def forward(self, x, c_org):
#what is x and c_org?
#irene: 呼叫Encoder時,執行forward的input,encoder的input 要trace code找一下這兩個個別是什麼
# 可是Encoder.forward()感覺是我們要在train.py自己呼叫的function?
#What is the preprocessing on the 3 lines below for?
#irene: 前兩行基本上是把它變成吃進model的 dimension, pytorch是 BxCxHxW
# (B: batch size, C: channel, H: height, W: weight)
# 第三行是把這兩個input concatenate,變成真的input
#pdb.set_trace()
x = x.squeeze(1).transpose(2,1)
c_org = c_org.unsqueeze(-1).expand(-1, -1, x.size(-1))
x = torch.cat((x, c_org), dim=1)
for conv in self.convolutions: #Apply the convolutions to x
x = F.relu(conv(x)) #F: is from python.nn functional #irene: should be torch.nn.functional
x = x.transpose(1, 2) #why transpose? #irene: I guess transpose back to the original format, there is a transpose in line 77
self.lstm.flatten_parameters()
outputs, _ = self.lstm(x) #What is _?
#irene: self.lstm will return 2 values, but you don't need the second one,
# so you can use _ to represent immaterial variable
out_forward = outputs[:, :, :self.dim_neck]
out_backward = outputs[:, :, self.dim_neck:]
codes = []
for i in range(0, outputs.size(1), self.freq):
codes.append(torch.cat((out_forward[:,i+self.freq-1,:],out_backward[:,i,:]), dim=-1)) #???
# I think it is to combine the forward output and backward output of LSTM
return codes
class Decoder(nn.Module):
"""Decoder module:
"""
def __init__(self, dim_neck, dim_emb, dim_pre): #dim_neck seems to be Down1 and Down2? dim_emb seems to be E_S, dim_neck looks to be E_C
#There should be Up1, Up2 and Copy (from the paper)
super(Decoder, self).__init__()
self.lstm1 = nn.LSTM(dim_neck*2+dim_emb, dim_pre, 1, batch_first=True) #Why is there an extra LSTM?
#irene: 對應decoder裡面的第一個lstm,what do you mean extra?
convolutions = []
for i in range(3): # 5x1 ConvNorm * 3
conv_layer = nn.Sequential(
ConvNorm(dim_pre,
dim_pre,
kernel_size=5, stride=1,
padding=2,
dilation=1, w_init_gain='relu'),
nn.BatchNorm1d(dim_pre))
convolutions.append(conv_layer)
self.convolutions = nn.ModuleList(convolutions)
self.lstm2 = nn.LSTM(dim_pre, 1024, 2, batch_first=True) #only 2 LSTMs?
#The paper mentions a 1x1 Conv of size 80, four 5x1 ConvNorms with size 512, and a 5x1 ConvNorm with size 80. Where did they go :(
#irene: postnet
self.linear_projection = LinearNorm(1024, 80) #I assume this is the 5x1 ConvNorm? Or does this encompass the whole architecture mentioned on line 108?
#irene: yes
def forward(self, x): #I think it's run with input x, but there are supposed to be 3 inputs to the decoder, are they already concatenated beforehand?
#irene: yes, they are already concatenated before fed to decoder. line 215
#self.lstm1.flatten_parameters()
x, _ = self.lstm1(x)
x = x.transpose(1, 2)
for conv in self.convolutions:
x = F.relu(conv(x))
x = x.transpose(1, 2)
outputs, _ = self.lstm2(x)
decoder_output = self.linear_projection(outputs)
return decoder_output
class Postnet(nn.Module):
"""Postnet
- Five 1-d convolution with 512 channels and kernel size 5
"""
def __init__(self):
super(Postnet, self).__init__()
self.convolutions = nn.ModuleList()
self.convolutions.append(
nn.Sequential(
ConvNorm(80, 512,
kernel_size=5, stride=1,
padding=2,
dilation=1, w_init_gain='tanh'),
nn.BatchNorm1d(512))
)
for i in range(1, 5 - 1):
self.convolutions.append(
nn.Sequential(
ConvNorm(512,
512,
kernel_size=5, stride=1,
padding=2,
dilation=1, w_init_gain='tanh'),
nn.BatchNorm1d(512))
)
self.convolutions.append(
nn.Sequential(
ConvNorm(512, 80,
kernel_size=5, stride=1,
padding=2,
dilation=1, w_init_gain='linear'),
nn.BatchNorm1d(80))
)
def forward(self, x):
for i in range(len(self.convolutions) - 1):
x = torch.tanh(self.convolutions[i](x))
x = self.convolutions[-1](x)
return x
class Generator(nn.Module):
"""Generator network."""
def __init__(self, dim_neck, dim_emb, dim_pre, freq): #Meanings of parameters still unclear :(
#irene: the parameters for encoder and decoder, explained above
super(Generator, self).__init__()
self.encoder = Encoder(dim_neck, dim_emb, freq)
self.decoder = Decoder(dim_neck, dim_emb, dim_pre)
self.postnet = Postnet()
def forward(self, x, c_org, c_trg):
#c_org = style original?
#c_trg = style
codes = self.encoder(x, c_org)
if c_trg is None:
return torch.cat(codes, dim=-1)
tmp = []
for code in codes:
tmp.append(code.unsqueeze(1).expand(-1,int(x.size(1)/len(codes)),-1))
code_exp = torch.cat(tmp, dim=1)
#pdb.set_trace()
encoder_outputs = torch.cat((code_exp, c_trg.unsqueeze(1).expand(-1,x.size(1),-1)), dim=-1)
mel_outputs = self.decoder(encoder_outputs)
mel_outputs_postnet = self.postnet(mel_outputs.transpose(2,1))
mel_outputs_postnet = mel_outputs + mel_outputs_postnet.transpose(2,1)
#pdb.set_trace()
#print("About to print")
#mel_outputs = mel_outputs.unsqueeze(1) #Channel (I think?)
#mel_outputs_postnet = mel_outputs_postnet.unsqueeze(1) #Same as above
#print("Currently in last line of model")
#pdb.set_trace()
return mel_outputs, mel_outputs_postnet, torch.cat(codes, dim=-1)
| [
1,
1053,
4842,
305,
13,
5215,
282,
2585,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
5215,
12655,
408,
7442,
13,
5215,
282,
2585,
13,
13,
1990,
22985,
29940,
555,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
297,
29918,
6229,
29892,
714,
29918,
6229,
29892,
24003,
29922,
5574,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
10660,
29374,
13,
4706,
2428,
29898,
12697,
29940,
555,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
10660,
29918,
13148,
353,
4842,
305,
29889,
15755,
29889,
12697,
29898,
262,
29918,
6229,
29892,
714,
29918,
6229,
29892,
24003,
29922,
29890,
3173,
29897,
13,
13,
4706,
4842,
305,
29889,
15755,
29889,
2344,
29889,
29916,
18852,
29918,
29590,
23538,
13,
9651,
1583,
29889,
10660,
29918,
13148,
29889,
7915,
29892,
13,
9651,
11581,
29922,
7345,
305,
29889,
15755,
29889,
2344,
29889,
15807,
403,
29918,
29887,
475,
29898,
29893,
29918,
2344,
29918,
29887,
475,
876,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
13,
4706,
736,
1583,
29889,
10660,
29918,
13148,
29898,
29916,
29897,
13,
13,
1990,
1281,
29894,
29940,
555,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
297,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
7164,
29922,
8516,
29892,
270,
8634,
29922,
29896,
29892,
24003,
29922,
5574,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
10660,
29374,
13,
4706,
2428,
29898,
1168,
29894,
29940,
555,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
565,
7164,
338,
6213,
29901,
13,
9651,
4974,
29898,
17460,
29918,
2311,
1273,
29871,
29906,
1275,
29871,
29896,
29897,
13,
9651,
7164,
353,
938,
29898,
29881,
8634,
334,
313,
17460,
29918,
2311,
448,
29871,
29896,
29897,
847,
29871,
29906,
29897,
13,
13,
4706,
1583,
29889,
20580,
353,
4842,
305,
29889,
15755,
29889,
1168,
29894,
29896,
29881,
29898,
262,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29892,
13,
462,
462,
1678,
8466,
29918,
2311,
29922,
17460,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
13,
462,
462,
1678,
7164,
29922,
12791,
29892,
270,
8634,
29922,
29881,
8634,
29892,
13,
462,
462,
1678,
24003,
29922,
29890,
3173,
29897,
13,
13,
4706,
4842,
305,
29889,
15755,
29889,
2344,
29889,
29916,
18852,
29918,
29590,
23538,
13,
9651,
1583,
29889,
20580,
29889,
7915,
29892,
11581,
29922,
7345,
305,
29889,
15755,
29889,
2344,
29889,
15807,
403,
29918,
29887,
475,
29898,
29893,
29918,
2344,
29918,
29887,
475,
876,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
7182,
1125,
13,
4706,
7602,
29918,
25436,
353,
1583,
29889,
20580,
29898,
25436,
29897,
13,
4706,
736,
7602,
29918,
25436,
13,
13,
1990,
11346,
6119,
29898,
15755,
29889,
7355,
1125,
13,
1678,
9995,
8566,
6119,
3883,
29901,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29918,
484,
384,
29892,
3964,
29918,
1590,
29892,
3005,
29939,
1125,
396,
2697,
701,
29871,
29945,
29916,
29896,
1281,
29894,
29940,
555,
334,
29871,
29941,
322,
350,
29931,
1254,
29924,
334,
29871,
29906,
13,
12,
12,
29937,
4706,
1724,
338,
3964,
29918,
1590,
1577,
13,
4706,
2428,
29898,
8566,
6119,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
6229,
29918,
484,
384,
353,
3964,
29918,
484,
384,
396,
5618,
338,
3964,
29918,
484,
384,
29973,
396,
381,
1600,
29901,
29871,
236,
131,
156,
232,
131,
142,
232,
146,
134,
233,
152,
187,
30406,
30505,
29953,
29896,
30448,
30214,
31356,
232,
131,
142,
30956,
30669,
30690,
30746,
20155,
29885,
30210,
10892,
2159,
13,
4706,
1583,
29889,
29888,
7971,
353,
3005,
29939,
396,
5618,
338,
3005,
29939,
29973,
396,
381,
1600,
29901,
29871,
232,
146,
134,
235,
131,
134,
19773,
29871,
29946,
29889,
29906,
30214,
29888,
7971,
30392,
3204,
13445,
10335,
29914,
14340,
314,
10335,
234,
152,
156,
30557,
30210,
30683,
16394,
30210,
10745,
23860,
13,
308,
13,
4706,
26851,
29879,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
9651,
7602,
29918,
13148,
353,
302,
29876,
29889,
16941,
2556,
29898,
13,
18884,
1281,
29894,
29940,
555,
29898,
29947,
29900,
29974,
6229,
29918,
1590,
565,
474,
1360,
29900,
1683,
29871,
29945,
29896,
29906,
29892,
13,
462,
3986,
29945,
29896,
29906,
29892,
13,
462,
308,
8466,
29918,
2311,
29922,
29945,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
308,
7164,
29922,
29906,
29892,
13,
462,
308,
270,
8634,
29922,
29896,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
2674,
29884,
5477,
13,
18884,
302,
29876,
29889,
23145,
29940,
555,
29896,
29881,
29898,
29945,
29896,
29906,
876,
396,
3664,
577,
1854,
1048,
825,
445,
338,
13,
12,
12,
29937,
381,
1600,
29901,
29871,
236,
138,
160,
232,
179,
144,
236,
131,
156,
30936,
30698,
235,
171,
150,
234,
186,
183,
30210,
16175,
232,
132,
157,
8945,
2133,
30214,
11618,
30275,
30698,
30666,
16175,
12324,
30210,
30895,
30210,
30888,
30698,
30392,
30698,
235,
177,
150,
13,
12,
12,
29937,
4706,
235,
172,
181,
16175,
30210,
31951,
30287,
234,
176,
137,
14394,
30417,
30287,
233,
171,
166,
30210,
19529,
292,
30214,
30847,
30801,
14394,
31570,
234,
133,
189,
7052,
232,
186,
177,
232,
193,
139,
30923,
30214,
232,
179,
144,
4905,
30210,
31619,
236,
162,
194,
13,
12,
12,
29937,
4706,
30413,
30287,
233,
171,
166,
30214,
232,
132,
157,
1627,
7728,
351,
362,
30974,
31565,
31050,
30210,
24970,
31411,
30413,
30980,
30214,
31420,
30494,
235,
171,
150,
234,
186,
183,
232,
158,
179,
236,
158,
166,
13,
12,
12,
29937,
4706,
235,
172,
182,
234,
183,
179,
30682,
30651,
232,
146,
134,
235,
131,
134,
30864,
232,
177,
146,
233,
178,
136,
31506,
31549,
30210,
235,
173,
181,
31101,
31619,
31122,
2045,
597,
1636,
29889,
19567,
29889,
510,
29914,
12344,
29973,
29894,
29922,
29933,
29999,
29882,
29896,
29880,
509,
29945,
29934,
9415,
13,
12,
12,
29937,
9280,
29871,
31290,
30743,
31201,
29991,
13,
12,
12,
13,
12,
12,
13,
9651,
26851,
29879,
29889,
4397,
29898,
20580,
29918,
13148,
29897,
13,
4706,
1583,
29889,
535,
4068,
29879,
353,
302,
29876,
29889,
7355,
1293,
29898,
535,
4068,
29879,
29897,
396,
27407,
29879,
278,
1051,
310,
3382,
1379,
964,
697,
4802,
1904,
306,
1348,
29871,
13,
12,
29937,
381,
1600,
29901,
4874,
29892,
29871,
31590,
234,
136,
170,
1761,
235,
166,
164,
30210,
236,
163,
137,
31463,
30733,
30494,
30287,
232,
131,
142,
5453,
13,
308,
13,
4706,
1583,
29889,
20155,
29885,
353,
302,
29876,
29889,
29931,
1254,
29924,
29898,
29945,
29896,
29906,
29892,
3964,
29918,
484,
384,
29892,
29871,
29906,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
21000,
8684,
284,
29922,
5574,
29897,
396,
2528,
29879,
350,
29931,
1254,
29924,
334,
29871,
29906,
29871,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
274,
29918,
990,
1125,
29871,
13,
12,
12,
29937,
5816,
338,
921,
322,
274,
29918,
990,
29973,
13,
12,
12,
29937,
381,
1600,
29901,
29871,
232,
148,
191,
232,
146,
174,
8566,
6119,
30974,
30214,
232,
162,
186,
30448,
11333,
30210,
2080,
30214,
3977,
6119,
30210,
2080,
29871,
30698,
15003,
775,
233,
140,
193,
30287,
30557,
236,
131,
156,
232,
136,
172,
232,
131,
142,
232,
131,
142,
31661,
30392,
231,
190,
131,
236,
189,
191,
13,
12,
12,
29937,
29871,
30682,
30392,
8566,
6119,
29889,
11333,
580,
233,
135,
162,
235,
169,
189,
30392,
30672,
232,
131,
148,
30698,
30505,
14968,
29889,
2272,
30688,
232,
186,
180,
232,
148,
191,
232,
146,
174,
30210,
2220,
29973,
13,
12,
12,
29937,
5618,
338,
278,
758,
19170,
373,
278,
29871,
29941,
3454,
2400,
363,
29973,
13,
12,
12,
29937,
381,
1600,
29901,
29871,
30658,
232,
136,
172,
30448,
31359,
30346,
30429,
30392,
233,
141,
141,
232,
177,
134,
235,
177,
141,
30494,
232,
147,
134,
31965,
4299,
30210,
9927,
29892,
282,
3637,
25350,
30392,
350,
29916,
29907,
29916,
29950,
29916,
29956,
29871,
13,
12,
12,
29937,
539,
313,
29933,
29901,
9853,
2159,
29892,
315,
29901,
8242,
29892,
379,
29901,
3171,
29892,
399,
29901,
7688,
29897,
13,
12,
12,
29937,
4706,
30622,
30457,
30448,
30392,
233,
141,
141,
236,
131,
156,
232,
136,
172,
232,
131,
142,
2080,
16125,
403,
30214,
235,
177,
141,
30494,
30848,
30210,
2080,
13,
4706,
396,
29886,
2585,
29889,
842,
29918,
15003,
580,
13,
4706,
921,
353,
921,
29889,
29879,
802,
29872,
911,
29898,
29896,
467,
3286,
4220,
29898,
29906,
29892,
29896,
29897,
13,
4706,
274,
29918,
990,
353,
274,
29918,
990,
29889,
6948,
802,
29872,
911,
6278,
29896,
467,
18837,
6278,
29896,
29892,
448,
29896,
29892,
921,
29889,
2311,
6278,
29896,
876,
13,
4706,
921,
353,
4842,
305,
29889,
4117,
3552,
29916,
29892,
274,
29918,
990,
511,
3964,
29922,
29896,
29897,
13,
308,
13,
4706,
363,
7602,
297,
1583,
29889,
535,
4068,
29879,
29901,
396,
2052,
368,
278,
26851,
29879,
304,
921,
13,
9651,
921,
353,
383,
29889,
2674,
29884,
29898,
20580,
29898,
29916,
876,
396,
29943,
29901,
338,
515,
3017,
29889,
15755,
13303,
396,
381,
1600,
29901,
881,
367,
4842,
305,
29889,
15755,
29889,
2220,
284,
13,
4706,
921,
353,
921,
29889,
3286,
4220,
29898,
29896,
29892,
29871,
29906,
29897,
396,
14606,
1301,
4220,
29973,
396,
381,
1600,
29901,
306,
4140,
1301,
4220,
1250,
304,
278,
2441,
3402,
29892,
727,
338,
263,
1301,
4220,
297,
1196,
29871,
29955,
29955,
13,
308,
13,
4706,
1583,
29889,
20155,
29885,
29889,
1579,
8606,
29918,
16744,
580,
13,
4706,
14391,
29892,
903,
353,
1583,
29889,
20155,
29885,
29898,
29916,
29897,
396,
5618,
338,
903,
29973,
29871,
13,
12,
29937,
381,
1600,
29901,
1583,
29889,
20155,
29885,
674,
736,
29871,
29906,
1819,
29892,
541,
366,
1016,
29915,
29873,
817,
278,
1473,
697,
29892,
29871,
13,
12,
29937,
577,
366,
508,
671,
903,
304,
2755,
5198,
3795,
2286,
13,
4706,
714,
29918,
11333,
353,
14391,
7503,
29892,
584,
29892,
584,
1311,
29889,
6229,
29918,
484,
384,
29962,
13,
4706,
714,
29918,
1627,
1328,
353,
14391,
7503,
29892,
584,
29892,
1583,
29889,
6229,
29918,
484,
384,
17531,
13,
308,
13,
4706,
11561,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
14391,
29889,
2311,
29898,
29896,
511,
1583,
29889,
29888,
7971,
1125,
13,
9651,
11561,
29889,
4397,
29898,
7345,
305,
29889,
4117,
3552,
449,
29918,
11333,
7503,
29892,
29875,
29974,
1311,
29889,
29888,
7971,
29899,
29896,
29892,
29901,
1402,
449,
29918,
1627,
1328,
7503,
29892,
29875,
29892,
29901,
11724,
3964,
10457,
29896,
876,
396,
28772,
13,
12,
1678,
396,
306,
1348,
372,
338,
304,
14405,
278,
6375,
1962,
322,
1250,
1328,
1962,
310,
365,
1254,
29924,
13,
13,
4706,
736,
11561,
13,
308,
13,
1990,
3826,
6119,
29898,
15755,
29889,
7355,
1125,
13,
1678,
9995,
6185,
6119,
3883,
29901,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29918,
484,
384,
29892,
3964,
29918,
1590,
29892,
3964,
29918,
1457,
1125,
396,
6229,
29918,
484,
384,
2444,
304,
367,
9943,
29896,
322,
9943,
29906,
29973,
3964,
29918,
1590,
2444,
304,
367,
382,
29918,
29903,
29892,
3964,
29918,
484,
384,
3430,
304,
367,
382,
29918,
29907,
13,
12,
12,
29937,
8439,
881,
367,
5020,
29896,
29892,
5020,
29906,
322,
14187,
313,
3166,
278,
5650,
29897,
13,
4706,
2428,
29898,
6185,
6119,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
308,
13,
4706,
1583,
29889,
20155,
29885,
29896,
353,
302,
29876,
29889,
29931,
1254,
29924,
29898,
6229,
29918,
484,
384,
29930,
29906,
29974,
6229,
29918,
1590,
29892,
3964,
29918,
1457,
29892,
29871,
29896,
29892,
9853,
29918,
4102,
29922,
5574,
29897,
396,
11008,
338,
727,
385,
4805,
365,
1254,
29924,
29973,
13,
12,
29937,
381,
1600,
29901,
29871,
232,
179,
144,
233,
138,
140,
7099,
6119,
235,
166,
164,
30806,
30210,
30622,
30287,
232,
131,
142,
20155,
29885,
30214,
5816,
437,
366,
2099,
4805,
29973,
13,
308,
13,
4706,
26851,
29879,
353,
5159,
29871,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
396,
29871,
29945,
29916,
29896,
1281,
29894,
29940,
555,
334,
29871,
29941,
13,
9651,
7602,
29918,
13148,
353,
302,
29876,
29889,
16941,
2556,
29898,
13,
18884,
1281,
29894,
29940,
555,
29898,
6229,
29918,
1457,
29892,
13,
462,
308,
3964,
29918,
1457,
29892,
13,
462,
308,
8466,
29918,
2311,
29922,
29945,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
308,
7164,
29922,
29906,
29892,
13,
462,
308,
270,
8634,
29922,
29896,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
2674,
29884,
5477,
13,
18884,
302,
29876,
29889,
23145,
29940,
555,
29896,
29881,
29898,
6229,
29918,
1457,
876,
13,
9651,
26851,
29879,
29889,
4397,
29898,
20580,
29918,
13148,
29897,
13,
4706,
1583,
29889,
535,
4068,
29879,
353,
302,
29876,
29889,
7355,
1293,
29898,
535,
4068,
29879,
29897,
13,
308,
13,
4706,
1583,
29889,
20155,
29885,
29906,
353,
302,
29876,
29889,
29931,
1254,
29924,
29898,
6229,
29918,
1457,
29892,
29871,
29896,
29900,
29906,
29946,
29892,
29871,
29906,
29892,
9853,
29918,
4102,
29922,
5574,
29897,
396,
6194,
29871,
29906,
365,
1254,
29924,
29879,
29973,
13,
12,
12,
29937,
1576,
5650,
26649,
263,
29871,
29896,
29916,
29896,
1281,
29894,
310,
2159,
29871,
29947,
29900,
29892,
3023,
29871,
29945,
29916,
29896,
1281,
29894,
29940,
555,
29879,
411,
2159,
29871,
29945,
29896,
29906,
29892,
322,
263,
29871,
29945,
29916,
29896,
1281,
29894,
29940,
555,
411,
2159,
29871,
29947,
29900,
29889,
6804,
1258,
896,
748,
16824,
13,
308,
12,
29937,
381,
1600,
29901,
1400,
1212,
13,
4706,
1583,
29889,
10660,
29918,
771,
6929,
353,
22985,
29940,
555,
29898,
29896,
29900,
29906,
29946,
29892,
29871,
29947,
29900,
29897,
396,
29902,
5251,
445,
338,
278,
29871,
29945,
29916,
29896,
1281,
29894,
29940,
555,
29973,
1394,
947,
445,
427,
2388,
465,
278,
3353,
11258,
5276,
373,
1196,
29871,
29896,
29900,
29947,
29973,
13,
12,
12,
29937,
381,
1600,
29901,
4874,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
396,
29902,
1348,
372,
29915,
29879,
1065,
411,
1881,
921,
29892,
541,
727,
526,
7424,
304,
367,
29871,
29941,
10970,
304,
278,
1602,
6119,
29892,
526,
896,
2307,
16125,
630,
1434,
3179,
29973,
13,
4706,
396,
381,
1600,
29901,
4874,
29892,
896,
526,
2307,
16125,
630,
1434,
21242,
304,
1602,
6119,
29889,
1196,
29871,
29906,
29896,
29945,
13,
4706,
396,
1311,
29889,
20155,
29885,
29896,
29889,
1579,
8606,
29918,
16744,
580,
13,
4706,
921,
29892,
903,
353,
1583,
29889,
20155,
29885,
29896,
29898,
29916,
29897,
13,
4706,
921,
353,
921,
29889,
3286,
4220,
29898,
29896,
29892,
29871,
29906,
29897,
13,
308,
13,
4706,
363,
7602,
297,
1583,
29889,
535,
4068,
29879,
29901,
13,
9651,
921,
353,
383,
29889,
2674,
29884,
29898,
20580,
29898,
29916,
876,
13,
4706,
921,
353,
921,
29889,
3286,
4220,
29898,
29896,
29892,
29871,
29906,
29897,
13,
308,
13,
4706,
14391,
29892,
903,
353,
1583,
29889,
20155,
29885,
29906,
29898,
29916,
29897,
13,
308,
13,
4706,
1602,
6119,
29918,
4905,
353,
1583,
29889,
10660,
29918,
771,
6929,
29898,
4905,
29879,
29897,
13,
13,
4706,
736,
1602,
6119,
29918,
4905,
1678,
13,
268,
13,
268,
13,
1990,
4918,
1212,
29898,
15755,
29889,
7355,
1125,
13,
1678,
9995,
6747,
1212,
13,
4706,
448,
22853,
29871,
29896,
29899,
29881,
26851,
411,
29871,
29945,
29896,
29906,
18196,
322,
8466,
2159,
29871,
29945,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
6747,
1212,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
535,
4068,
29879,
353,
302,
29876,
29889,
7355,
1293,
580,
13,
13,
4706,
1583,
29889,
535,
4068,
29879,
29889,
4397,
29898,
13,
9651,
302,
29876,
29889,
16941,
2556,
29898,
13,
18884,
1281,
29894,
29940,
555,
29898,
29947,
29900,
29892,
29871,
29945,
29896,
29906,
29892,
13,
462,
308,
8466,
29918,
2311,
29922,
29945,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
308,
7164,
29922,
29906,
29892,
13,
462,
308,
270,
8634,
29922,
29896,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
13161,
29882,
5477,
13,
18884,
302,
29876,
29889,
23145,
29940,
555,
29896,
29881,
29898,
29945,
29896,
29906,
876,
13,
4706,
1723,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
29871,
29945,
448,
29871,
29896,
1125,
13,
9651,
1583,
29889,
535,
4068,
29879,
29889,
4397,
29898,
13,
18884,
302,
29876,
29889,
16941,
2556,
29898,
13,
462,
1678,
1281,
29894,
29940,
555,
29898,
29945,
29896,
29906,
29892,
13,
462,
795,
29945,
29896,
29906,
29892,
13,
462,
632,
8466,
29918,
2311,
29922,
29945,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
632,
7164,
29922,
29906,
29892,
13,
462,
632,
270,
8634,
29922,
29896,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
13161,
29882,
5477,
13,
462,
1678,
302,
29876,
29889,
23145,
29940,
555,
29896,
29881,
29898,
29945,
29896,
29906,
876,
13,
9651,
1723,
13,
13,
4706,
1583,
29889,
535,
4068,
29879,
29889,
4397,
29898,
13,
9651,
302,
29876,
29889,
16941,
2556,
29898,
13,
18884,
1281,
29894,
29940,
555,
29898,
29945,
29896,
29906,
29892,
29871,
29947,
29900,
29892,
13,
462,
308,
8466,
29918,
2311,
29922,
29945,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
308,
7164,
29922,
29906,
29892,
13,
462,
308,
270,
8634,
29922,
29896,
29892,
281,
29918,
2344,
29918,
29887,
475,
2433,
10660,
5477,
13,
18884,
302,
29876,
29889,
23145,
29940,
555,
29896,
29881,
29898,
29947,
29900,
876,
13,
9651,
1723,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
1311,
29889,
535,
4068,
29879,
29897,
448,
29871,
29896,
1125,
13,
9651,
921,
353,
4842,
305,
29889,
13161,
29882,
29898,
1311,
29889,
535,
4068,
29879,
29961,
29875,
850,
29916,
876,
13,
13,
4706,
921,
353,
1583,
29889,
535,
4068,
29879,
14352,
29896,
850,
29916,
29897,
13,
13,
4706,
736,
921,
268,
13,
268,
13,
13,
1990,
3251,
1061,
29898,
15755,
29889,
7355,
1125,
13,
1678,
9995,
21575,
3564,
1213,
15945,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29918,
484,
384,
29892,
3964,
29918,
1590,
29892,
3964,
29918,
1457,
29892,
3005,
29939,
1125,
396,
6816,
273,
886,
310,
4128,
1603,
20871,
16824,
13,
12,
29937,
381,
1600,
29901,
278,
4128,
363,
2094,
6119,
322,
1602,
6119,
29892,
10824,
2038,
13,
4706,
2428,
29898,
21575,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
308,
13,
4706,
1583,
29889,
3977,
6119,
353,
11346,
6119,
29898,
6229,
29918,
484,
384,
29892,
3964,
29918,
1590,
29892,
3005,
29939,
29897,
13,
4706,
1583,
29889,
7099,
6119,
353,
3826,
6119,
29898,
6229,
29918,
484,
384,
29892,
3964,
29918,
1590,
29892,
3964,
29918,
1457,
29897,
13,
4706,
1583,
29889,
2490,
1212,
353,
4918,
1212,
580,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
274,
29918,
990,
29892,
274,
29918,
509,
29887,
1125,
13,
268,
12,
29937,
29883,
29918,
990,
353,
3114,
2441,
29973,
259,
13,
12,
12,
29937,
29883,
29918,
509,
29887,
353,
3114,
13,
4706,
11561,
353,
1583,
29889,
3977,
6119,
29898,
29916,
29892,
274,
29918,
990,
29897,
13,
4706,
565,
274,
29918,
509,
29887,
338,
6213,
29901,
13,
9651,
736,
4842,
305,
29889,
4117,
29898,
18137,
29892,
3964,
10457,
29896,
29897,
13,
308,
13,
4706,
13128,
353,
5159,
13,
4706,
363,
775,
297,
11561,
29901,
13,
9651,
13128,
29889,
4397,
29898,
401,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
6278,
29896,
29892,
524,
29898,
29916,
29889,
2311,
29898,
29896,
6802,
2435,
29898,
18137,
8243,
29899,
29896,
876,
13,
4706,
775,
29918,
4548,
353,
4842,
305,
29889,
4117,
29898,
7050,
29892,
3964,
29922,
29896,
29897,
13,
308,
13,
4706,
396,
29886,
2585,
29889,
842,
29918,
15003,
580,
13,
4706,
2094,
6119,
29918,
4905,
29879,
353,
4842,
305,
29889,
4117,
3552,
401,
29918,
4548,
29892,
274,
29918,
509,
29887,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
6278,
29896,
29892,
29916,
29889,
2311,
29898,
29896,
511,
29899,
29896,
8243,
3964,
10457,
29896,
29897,
13,
13,
308,
13,
4706,
9232,
29918,
4905,
29879,
353,
1583,
29889,
7099,
6119,
29898,
3977,
6119,
29918,
4905,
29879,
29897,
13,
462,
13,
4706,
9232,
29918,
4905,
29879,
29918,
2490,
1212,
353,
1583,
29889,
2490,
1212,
29898,
12873,
29918,
4905,
29879,
29889,
3286,
4220,
29898,
29906,
29892,
29896,
876,
13,
4706,
9232,
29918,
4905,
29879,
29918,
2490,
1212,
353,
9232,
29918,
4905,
29879,
718,
9232,
29918,
4905,
29879,
29918,
2490,
1212,
29889,
3286,
4220,
29898,
29906,
29892,
29896,
29897,
13,
4706,
396,
29886,
2585,
29889,
842,
29918,
15003,
580,
13,
4706,
396,
2158,
703,
28173,
304,
1596,
1159,
13,
4706,
396,
12873,
29918,
4905,
29879,
353,
9232,
29918,
4905,
29879,
29889,
6948,
802,
29872,
911,
29898,
29896,
29897,
396,
13599,
313,
29902,
1348,
7897,
13,
4706,
396,
12873,
29918,
4905,
29879,
29918,
2490,
1212,
353,
9232,
29918,
4905,
29879,
29918,
2490,
1212,
29889,
6948,
802,
29872,
911,
29898,
29896,
29897,
396,
29903,
420,
408,
2038,
29871,
13,
4706,
396,
2158,
703,
7583,
368,
297,
1833,
1196,
310,
1904,
1159,
13,
4706,
396,
29886,
2585,
29889,
842,
29918,
15003,
580,
13,
4706,
736,
9232,
29918,
4905,
29879,
29892,
9232,
29918,
4905,
29879,
29918,
2490,
1212,
29892,
4842,
305,
29889,
4117,
29898,
18137,
29892,
3964,
10457,
29896,
29897,
13,
2
] |
q_learning/backup_output_net1_discount_0_batch_400_random_mines/qnetwork.py | jakejhansen/minesweeper_solver | 32 | 161044 | <gh_stars>10-100
"""
This module contains a function to update another neural network by copying
all trainable variables and a class for a deep Q network.
"""
import os
import numpy as np
import tensorflow as tf
# Based on
# https://github.com/tomrunia/DeepReinforcementLearning-Atari
def update_target_network(sess, network_name_train, network_name_target):
"""This helper method copies all the trainable weights and biases from
one DeepQNetwork to another. This method is used for synchronisation
of the train and target Q-networks
Parameters
----------
sess: tensorflow session.
The current session in tensorflow.
network_name_train: str
Name of Q-Network for training.s
network_name_target: str
Name of Q-Network for predicting target Q-values
Returns
-------
None
"""
# Retrieve current variable scope and set reuse flag to True
tf.get_variable_scope().reuse_variables()
# Get list of values in "network_name_train" in the collection
# GraphKeys.TRAINABLE_VARIABLES
vars_source = tf.get_collection(
tf.GraphKeys.TRAINABLE_VARIABLES, scope=network_name_train
)
copy_ops = [] # Where we copy the variables to
check_ops = [] # Contains a list of booleans determining if variables are equal
for v in vars_source:
# Note the [0:-2] to cut of the device placement
v_source = tf.get_variable(v.name[0:-2])
# Remove variable prefix (network name)
var_name = v.name[v.name.find("/"):]
v_target = tf.get_variable(network_name_target + var_name[0:-2])
copy_ops.append(v_target.assign(v_source))
check_ops.append(tf.equal(v_target, v_source))
# Actual copying all the variables, check if the values are equal
sess.run(copy_ops)
check_res = sess.run(check_ops)
for res in check_res:
if not np.all(res): # Failed to copy variables
raise ValueError("Verification of tf.equal(var_train, var_target) failed.")
class DeepQNetwork:
"""A class for replay memories used during training of deep Q-networks.
Parameters
----------
replay_capacity : int
The maximum number of samples in replay memory
batch_size : Bool
The number of frames to return.
Attributes:
network_name : str
The name of the network.
trainable : bool
If this network is supposed to be trained.
True for the Q-network we train and False for the targer Q-network.
model_file : str
The name of the file containing the trained model parameters.
output_dir : str
The name of the output directory.
input_size : int
The size of the screen input.
input_depth : int
The input depth, this is the number of frames used, expects 4.
filter_sizes: :obj: 'list' of :obj: 'int'
A list containing the filter sizes in conv layers.
filter_strides: :obj: 'list' of :obj: 'int'
A list containing the filter strides in conv layers.
num_filters: :obj: 'list' of :obj: 'int'
A list containing the number of filters in conv layers.
num_hidden: :obj: 'list' of :obj: 'int'
A list containing the number of hidden units in feedforward layers.
num_actions: int
The number of actions available.
dueling_type: str
The type of dueling.
batch_size: int
Size of the training batch.
learning_rate_base: float
The start learning rate.
learning_rate_decay: float
The decay rate of the learning rate.
We decay every larning_rate_iteration.
learning_rate_step: int
The number of iterations to anneal the learning rate.
learning_rate_min: float
The minimum learning rate.
clip_delta: bool
If True use error clipping.
batch_accumulator: str
Either "mean" or "sum", determines if we reduce sum or mean of
delta_square
"""
def __init__(self, params, num_actions, network_name, trainable):
self.params = params
# Network information
self.network_name = network_name
self.trainable = trainable
# Paths and models
self.model_file = params.model_file
self.output_dir = params.output_dir
# Input to the Q-network
self.input_height = params.input_height # 84
self.input_width = params.input_width # 84
self.env_type = params.env
if self.env_type == 'minesweeper':
self.input_depth = params.nchannels # 4
else:
self.input_depth = params.history_length # 4
self.network_type = params.network_type
# CNN layer architecture
self.filter_sizes = params.filter_sizes # 8, 4, 3
self.filter_strides = params.filter_strides # 4, 2, 1
self.num_filters = params.num_filters # 32, 64, 64
self.num_hidden = params.num_hidden # 512
self.num_actions = num_actions # depends on game
self.dueling_type = params.dueling_type
# Training Parameters
self.batch_size = params.batch_size # 32
self.learning_rate_base = params.learning_rate # 0.0025
self.learning_rate_decay = params.learning_rate_decay # 0.96
self.learning_rate_step = params.learning_rate_step # 450000
self.learning_rate_min = params.learning_rate_minimum # 0.00025
self.discount = params.discount # 0.99
self.network_update_rate = params.network_update_rate # 10000
self.clip_delta = params.clip_delta # 1.0
self.batch_accumulator = params.batch_accumulator # mean or sum
# Init TensorFlow graph
self._init_graph()
def _init_graph(self):
"""Initializes the computational graph in Tensorflow and builds the
neural network.
If trainable is True, we also build the loss part of the graph.
Returns
-------
None
"""
# Initialize operation for creating/writing summary to disk
self.train_summary_op = None
self.eval_summary_op = None
self.train_summary_writer = None
with tf.variable_scope(self.network_name):
self.global_iteration = tf.Variable(0, name='global_iteration',
trainable=False)
# Placeholders
self.pl_screens = tf.placeholder(tf.float32,
shape=[None,
self.input_height,
self.input_width,
self.input_depth],
name="screens")
# For feedforward networks
self.pl_flat = tf.placeholder(tf.float32,
shape=[None,
self.input_height*self.input_width*self.input_depth],
name="flat")
# Contain q-targest for all batches per action, None for batches
self.pl_qtargets = tf.placeholder(tf.float32, shape=[None, self.num_actions],
name="qtargets")
self.pl_actions = tf.placeholder(tf.int64, shape=[None],
name="actions")
self.pl_actions_target = tf.placeholder(tf.int64, shape=[None], # Actions from train-network used to select q-values in target network
name="actions_target")
self.pl_rewards = tf.placeholder(tf.float32, shape=[None],
name="rewards")
self.pl_dones = tf.placeholder(tf.float32, shape=[None],
name="dones")
# Convert strings to lists
self.filter_sizes = list(map(int, self.filter_sizes.split(",")))
self.filter_strides = list(map(int, self.filter_strides.split(",")))
self.num_filters = list(map(int, self.num_filters.split(",")))
self.qvalues = self._build_cnn()
# Initialize the loss function if we have the trainable Q-network.
# Otherwise all parameters are copied.
if self.trainable:
self._build_loss()
# Learning rate decay
# When training a model, it is often recommended to lower the
# learning rate as the training progresses.
# This function applies an exponential decay function to a
# provided initial learning rate.
# Uses global_iteration to compute the decayed learning rate.
self.learning_rate = tf.train.exponential_decay(
self.learning_rate_base, self.global_iteration,
self.learning_rate_step, self.learning_rate_decay,
staircase=True
)
self.learning_rate = tf.maximum(self.learning_rate,
self.learning_rate_min)
# Adam Optimizer
self.optimizer = tf.train.AdamOptimizer(
learning_rate=self.learning_rate,
epsilon=1.5e-4) # From Rainbow paper
self.train_op_optimizer = self.optimizer.minimize(
self.loss,
global_step=self.global_iteration # Steps refer to something else in reinforcement, so we call iteration
)
# Keep track of running average of the loss when minimizing
# the loss
# tf.control_dependencies means that
# self.train_op = tf.group(self.loss_moving_avg_op)
# is only run after self.loss_moving_avg_op has been executed
with tf.control_dependencies([self.train_op_optimizer]):
self.train_op = tf.group(self.loss_moving_avg_op)
def _build_cnn(self):
"""Builds a convolutional network. When we add new layers, it is
important to set trainable=self.trainable since these parameters needs
to be copied to the target nework and it uses the set of trianable.
Returns
-------
:obj: 'ndarray' of :obj: 'float'
The q-values in the output as a list, corresponding to each possible
action.
"""
with tf.variable_scope("Network"):
if self.network_type == 1:
conv1 = tf.layers.conv2d(
inputs=self.pl_screens,
filters=18,
kernel_size=[5, 5],
strides=(1, 1),
activation=tf.nn.relu,
padding="same", # Same as in keras
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="conv1"
)
conv2 = tf.layers.conv2d(
inputs=conv1,
filters=36,
kernel_size=[3, 3],
strides=(1,1),
activation=tf.nn.relu,
padding="same", # Same as in keras
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="conv2"
)
elif self.network_type == 2:
conv1 = tf.layers.conv2d(
inputs=self.pl_screens,
filters=16,
kernel_size=[4, 4],
strides=(1, 1),
activation=tf.nn.relu,
padding="valid", # Same as in keras
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="conv1"
)
conv2 = tf.layers.conv2d(
inputs=conv1,
filters=32,
kernel_size=[3, 3],
strides=(1,1),
activation=tf.nn.relu,
padding="same", # Same as in keras
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="conv2"
)
conv3 = tf.layers.conv2d(
inputs=conv2,
filters=32,
kernel_size=[2, 2],
strides=(1,1),
activation=tf.nn.relu,
padding="valid", # Same as in keras
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="conv3"
)
# To implement dueling, see https://github.com/dbobrenko/reinforceflow/blob/master/reinforceflow/nets/dueling.py
if self.dueling_type is None:
if self.network_type == 1:
conv_flatten = tf.contrib.layers.flatten(
inputs=conv2
)
fc1 = tf.layers.dense(
inputs=conv_flatten,
units=288,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="fc1"
)
fc2 = tf.layers.dense(
inputs=fc1,
units=220,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="fc2"
)
fc3 = tf.layers.dense(
inputs=fc2,
units=220,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="fc3"
)
qvalues = tf.layers.dense(
inputs=fc3,
units=self.num_actions,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable
)
if self.network_type == 2:
conv_flatten = tf.contrib.layers.flatten(
inputs=conv3
)
fc1 = tf.layers.dense(
inputs=conv_flatten,
units=512,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="fc1"
)
qvalues = tf.layers.dense(
inputs=fc1,
units=self.num_actions,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable
)
# Dueling is enabled
else:
#We take the output from the final convolutional layer and
# split it into separate advantage and value streams.
if self.network_type == 1:
streamAC, streamVC = tf.split(conv2,2,3)
elif self.network_type == 2:
streamAC, streamVC = tf.split(conv3,2,3)
streamA = tf.contrib.layers.flatten(streamAC)
streamV = tf.contrib.layers.flatten(streamVC)
qvalues = self._add_dueling(streamA, streamV)
return qvalues
def _add_dueling(self, streamA, streamV):
"""Adds dueling to a network.
See:
https://github.com/devsisters/DQN-tensorflow/blob/master/dqn/agent.py
https://github.com/dbobrenko/reinforceflow/blob/master/reinforceflow/nets/dueling.py
https://github.com/devsisters/DQN-tensorflow/blob/master/dqn/agent.py
https://github.com/gokhanettin/dddqn-tf/blob/master/dddqn.py
https://github.com/awjuliani/DeepRL-Agents/blob/master/Double-Dueling-DQN.ipynb
And the original paper
https://arxiv.org/pdf/1511.06581.pdf
Parameters
----------
streamA :obj: 'ndarray' of :obj: 'float'
The input to the advantage part.
streamV :obj: 'ndarray' of :obj: 'float'
The input to value part.
(Deprecated)
net_input :obj: 'ndarray' of :obj: 'float'
The input to the part of the network implementing dueling
Returns
-------
:obj: 'ndarray' of :obj: 'float'
The q-values in the output as a list, corresponding to each possible
action.
"""
adv_in = tf.layers.dense(
inputs=streamA,
units=512,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="adv_in")
adv_out = tf.layers.dense(
inputs=adv_in,
units=self.num_actions,
activation=None,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="adv_out")
value_in = tf.layers.dense(
inputs = streamV,
units=512,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="value_in")
value_out = tf.layers.dense(
inputs=value_in,
units=1,
activation=tf.nn.relu,
kernel_initializer=tf.contrib.layers.xavier_initializer(seed=self.params.seed),
bias_initializer= tf.constant_initializer(self.params.bias_init),
trainable=self.trainable,
name="value_out")
# caculate the Q(s,a;theta)
# dueling_type == 'avg'
# Q(s,a;theta) = V(s;theta) + (A(s,a;theta)-Avg_a(A(s,a;theta)))
# dueling_type == 'max'
# Q(s,a;theta) = V(s;theta) + (A(s,a;theta)-max_a(A(s,a;theta)))
# dueling_type == 'naive'
# Q(s,a;theta) = V(s;theta) + A(s,a;theta)
if self.dueling_type == 'naive':
qvalues = value_out + adv_out
# Mean is what is suggested in the paper
elif self.dueling_type == 'mean':
qvalues = tf.add(value_out,
tf.subtract(adv_out,
tf.reduce_mean(adv_out, 1, keep_dims=True)))
elif self.dueling_type == 'max':
qvalues = tf.add(value_out,
tf.subtract(adv_out,
tf.reduce_max(adv_out, 1, keep_dims=True)))
else:
raise ValueError("Unknown dueling type '%s'. Available: 'naive', \
'mean', 'max'." % self.dueling_type)
return qvalues
def _build_loss(self):
"""Build the loss function for the neural network.
"""
with tf.variable_scope("loss"):
# Compute y_j = r_j + discount*max_qvalue
self.tf_discount = tf.constant(self.discount)
#self.pl_qtargets = tf.reduce_max(self.pl_qtargets, reduction_indices=[1])
# self.pl_actions_train
#self.pl_qtargets = self.pl_qtargets[range(self.batch_size), self.pl_actions_target]
# Get Q-values for the argmax actions from actions train
# For this, we use the one-hot encoding
self.actions_one_hot_target = tf.one_hot(
self.pl_actions_target, self.num_actions, 1.0, 0.0
)
# Finally, we compute the q-vaue of the target network
# for the actions which maximixed the
self.qtarget = tf.reduce_sum(
tf.multiply(
self.pl_qtargets,
self.actions_one_hot_target),
reduction_indices=1
)
if self.env_type == 'atari':
# In atari, done is bad since the games should last as long as possible
# for mine-sweeper, done is ambigious, and we represent loss by a strong negative
# reward, and win is simply progressing by a certain number of steps
self.qtarget = tf.add(
self.pl_rewards,
tf.multiply(1.0-self.pl_dones,
tf.multiply(self.tf_discount, self.qtarget))
)
elif self.env_type == 'minesweeper':
self.qtarget = tf.add(
self.pl_rewards,
tf.multiply(self.tf_discount, self.qtarget)
)
# Select Q-values for given actions
# The actions are a 1D array, we one-hot encode with the number of actions
# last two are on-value, off-value
# Then we just have a matrix with 1s where an action was performed
self.actions_one_hot = tf.one_hot(
self.pl_actions, self.num_actions, 1.0, 0.0
)
# Below we obtain the loss by taking the sum of squares difference
# between the target and prediction Q values.
# Compute finally sum along all rows by summing column elements
self.qvalue_pred = tf.reduce_sum(
tf.multiply(
self.qvalues,
self.actions_one_hot),
reduction_indices=1
)
# Difference between target (true) and predicted Q-network output
self.delta = tf.subtract(self.qtarget, self.qvalue_pred)
if self.clip_delta:
# Perform clipping of the error term,
# default clipping is to (-1, +1) range
self.delta_square = tf.losses.huber_loss(self.qtarget, self.qvalue_pred)
else:
# No error clipping
# td-error
self.delta_square = tf.square(self.delta)
# Actual loss
if self.batch_accumulator == "sum":
self.loss = tf.reduce_sum(self.delta_square)
else:
self.loss = tf.reduce_mean(self.delta_square)
# Running average of the loss for TensorBoard
self.loss_moving_avg = tf.train.ExponentialMovingAverage(decay=0.999)
self.loss_moving_avg_op = self.loss_moving_avg.apply([self.loss])
def build_summary_writer(self, sess):
"""Build summary writer of the progress.
"""
# Compute the average Q-value
avg_qvalues_train = tf.reduce_mean(self.qvalues)
avg_qvalues_target = tf.reduce_mean(tf.reduce_mean(self.pl_qtargets))
avg_reward_batch = tf.reduce_mean(tf.reduce_mean(self.pl_rewards))
# Summaries for training
training_summaries = [
tf.summary.scalar("train/qvalues_train_avg", avg_qvalues_train),
tf.summary.scalar("train/qvalues_target_avg", avg_qvalues_target),
tf.summary.scalar("train/avg_reward_batch", avg_reward_batch),
tf.summary.scalar("train/loss", self.loss),
tf.summary.scalar("train/loss_average", self.loss_moving_avg.average(self.loss)),
tf.summary.scalar("train/learning_rate", self.learning_rate),
tf.summary.histogram("train/delta", self.delta)
]
training_summaries_merged = tf.summary.merge(training_summaries)
# Environment related summaries
with tf.variable_scope("environment"):
self.avg_reward_per_game = tf.Variable(0.0, trainable=False, name="avg_reward_per_game")
self.max_reward_per_game = tf.Variable(0.0, trainable=False, name="max_reward_per_game")
self.avg_moves_per_game = tf.Variable(0.0, trainable=False, name="avg_moves_per_game")
self.num_games_played = tf.Variable(0.0, trainable=False, name="num_games_played")
self.moves = tf.Variable(0.0, trainable=False, name="num_moves_played")
self.total_reward_replay = tf.Variable(0.0, trainable=False, name="reward_in_replay_memory")
self.actions_random = tf.Variable(0.0, trainable=False, name="num_actions_random")
self.actions_greedy = tf.Variable(0.0, trainable=False, name="num_actions_greedy")
environment_summaries = [
tf.summary.scalar("environment/avg_reward_per_game", self.avg_reward_per_game),
tf.summary.scalar("environment/max_reward_per_game", self.max_reward_per_game),
tf.summary.scalar("environment/num_games_played", self.num_games_played),
tf.summary.scalar("environment/moves", self.moves),
tf.summary.scalar("environment/avg_moves_per_game", self.avg_moves_per_game),
tf.summary.scalar("environment/reward_in_replay_memory", self.total_reward_replay),
tf.summary.scalar("actions/num_actions_random", self.actions_random),
tf.summary.scalar("actions/num_actions_greedy", self.actions_greedy),
#tf.summary.image("screens", self.pl_screens, max_outputs=10) # This only works with atari for some reason
]
environment_summaries_merged = tf.summary.merge(environment_summaries)
# Environment related summaries
with tf.variable_scope("evaluation"):
self.eval_rewards = tf.Variable(0.0, trainable=False, name="total_reward")
self.eval_win_rate = tf.Variable(0.0, trainable=False, name="win_rate")
self.eval_num_rewards = tf.Variable(0.0, trainable=False, name="num_rewards")
self.eval_max_reward = tf.Variable(0.0, trainable=False, name="max_reward")
self.eval_num_episodes = tf.Variable(0.0, trainable=False, name="num_episodes")
self.eval_actions = tf.Variable(np.zeros(self.num_actions), trainable=False, name="actions")
evaluation_summaries = [
tf.summary.scalar("evaluation/total_reward", self.eval_rewards),
tf.summary.scalar("evaluation/win_rate", self.eval_win_rate),
tf.summary.scalar("evaluation/num_rewards", self.eval_num_rewards),
tf.summary.scalar("evaluation/max_reward", self.eval_max_reward),
tf.summary.scalar("evaluation/num_episodes", self.eval_num_episodes),
tf.summary.histogram("evaluation/actions", self.eval_actions)
]
# Evaluation Summaries for TensorBoard
self.eval_summary_op = tf.summary.merge(evaluation_summaries)
# Training summaries for TensorBoard
self.train_summary_op = tf.summary.merge([training_summaries_merged,
environment_summaries_merged])
train_summary_dir = os.path.join(self.output_dir, "summaries_" + self.params.game)
self.train_summary_writer = tf.summary.FileWriter(train_summary_dir, sess.graph)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
15945,
19451,
13,
4013,
3883,
3743,
263,
740,
304,
2767,
1790,
19677,
3564,
491,
17596,
30004,
13,
497,
7945,
519,
3651,
322,
263,
770,
363,
263,
6483,
660,
3564,
22993,
13,
15945,
19451,
13,
30004,
13,
5215,
2897,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
26110,
408,
15886,
30004,
13,
30004,
13,
29937,
16564,
373,
30004,
13,
29937,
2045,
597,
3292,
29889,
510,
29914,
15135,
3389,
423,
29914,
2772,
1022,
1123,
262,
1454,
13561,
29931,
799,
1076,
29899,
4178,
1306,
30004,
13,
30004,
13,
1753,
2767,
29918,
5182,
29918,
11618,
29898,
29879,
404,
29892,
3564,
29918,
978,
29918,
14968,
29892,
3564,
29918,
978,
29918,
5182,
1125,
30004,
13,
1678,
9995,
4013,
16876,
1158,
14591,
599,
278,
7945,
519,
18177,
322,
4768,
2129,
515,
30004,
13,
1678,
697,
21784,
29984,
13724,
304,
1790,
29889,
910,
1158,
338,
1304,
363,
12231,
4371,
30004,
13,
1678,
310,
278,
7945,
322,
3646,
660,
29899,
11618,
29879,
30004,
13,
30004,
13,
1678,
12662,
2699,
30004,
13,
1678,
448,
1378,
29899,
30004,
13,
1678,
27937,
29901,
26110,
4867,
22993,
13,
4706,
450,
1857,
4867,
297,
26110,
22993,
13,
1678,
3564,
29918,
978,
29918,
14968,
29901,
851,
30004,
13,
4706,
4408,
310,
660,
29899,
13724,
363,
6694,
29889,
29879,
30004,
13,
1678,
3564,
29918,
978,
29918,
5182,
29901,
851,
30004,
13,
4706,
4408,
310,
660,
29899,
13724,
363,
8500,
292,
3646,
660,
29899,
5975,
30004,
13,
30004,
13,
1678,
16969,
30004,
13,
1678,
448,
22158,
30004,
13,
1678,
6213,
30004,
13,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
4649,
29878,
2418,
1857,
2286,
6874,
322,
731,
24270,
7353,
304,
5852,
30004,
13,
1678,
15886,
29889,
657,
29918,
11918,
29918,
6078,
2141,
276,
1509,
29918,
20897,
26471,
13,
30004,
13,
1678,
396,
3617,
1051,
310,
1819,
297,
376,
11618,
29918,
978,
29918,
14968,
29908,
297,
278,
4333,
30004,
13,
1678,
396,
12367,
15506,
29889,
29911,
4717,
1177,
6181,
29918,
26865,
29902,
6181,
29903,
30004,
13,
1678,
24987,
29918,
4993,
353,
15886,
29889,
657,
29918,
10855,
29898,
30004,
13,
4706,
15886,
29889,
9527,
15506,
29889,
29911,
4717,
1177,
6181,
29918,
26865,
29902,
6181,
29903,
29892,
6874,
29922,
11618,
29918,
978,
29918,
14968,
30004,
13,
1678,
1723,
30004,
13,
30004,
13,
1678,
3509,
29918,
3554,
29871,
353,
5159,
396,
6804,
591,
3509,
278,
3651,
304,
30004,
13,
1678,
1423,
29918,
3554,
353,
5159,
396,
2866,
2708,
263,
1051,
310,
1045,
1772,
550,
3683,
2827,
565,
3651,
526,
5186,
30004,
13,
30004,
13,
1678,
363,
325,
297,
24987,
29918,
4993,
29901,
30004,
13,
4706,
396,
3940,
278,
518,
29900,
13018,
29906,
29962,
304,
5700,
310,
278,
4742,
2174,
13561,
30004,
13,
4706,
325,
29918,
4993,
353,
15886,
29889,
657,
29918,
11918,
29898,
29894,
29889,
978,
29961,
29900,
13018,
29906,
2314,
30004,
13,
30004,
13,
4706,
396,
15154,
2286,
10944,
313,
11618,
1024,
8443,
13,
4706,
722,
29918,
978,
353,
325,
29889,
978,
29961,
29894,
29889,
978,
29889,
2886,
11974,
29908,
1125,
29962,
30004,
13,
4706,
325,
29918,
5182,
353,
15886,
29889,
657,
29918,
11918,
29898,
11618,
29918,
978,
29918,
5182,
718,
722,
29918,
978,
29961,
29900,
13018,
29906,
2314,
30004,
13,
30004,
13,
4706,
3509,
29918,
3554,
29889,
4397,
29898,
29894,
29918,
5182,
29889,
16645,
29898,
29894,
29918,
4993,
876,
30004,
13,
4706,
1423,
29918,
3554,
29889,
4397,
29898,
13264,
29889,
11745,
29898,
29894,
29918,
5182,
29892,
325,
29918,
4993,
876,
30004,
13,
30004,
13,
1678,
396,
3185,
950,
17596,
599,
278,
3651,
29892,
1423,
565,
278,
1819,
526,
5186,
30004,
13,
1678,
27937,
29889,
3389,
29898,
8552,
29918,
3554,
8443,
13,
1678,
1423,
29918,
690,
353,
27937,
29889,
3389,
29898,
3198,
29918,
3554,
8443,
13,
1678,
363,
620,
297,
1423,
29918,
690,
29901,
30004,
13,
4706,
565,
451,
7442,
29889,
497,
29898,
690,
1125,
396,
18390,
304,
3509,
3651,
30004,
13,
9651,
12020,
7865,
2392,
703,
6565,
2450,
310,
15886,
29889,
11745,
29898,
1707,
29918,
14968,
29892,
722,
29918,
5182,
29897,
5229,
23157,
30004,
13,
30004,
13,
30004,
13,
1990,
21784,
29984,
13724,
29901,
30004,
13,
1678,
9995,
29909,
770,
363,
337,
1456,
2626,
3842,
1304,
2645,
6694,
310,
6483,
660,
29899,
11618,
29879,
22993,
13,
30004,
13,
1678,
12662,
2699,
30004,
13,
1678,
448,
1378,
29899,
30004,
13,
1678,
337,
1456,
29918,
5030,
5946,
584,
938,
30004,
13,
4706,
450,
7472,
1353,
310,
11916,
297,
337,
1456,
3370,
30004,
13,
1678,
9853,
29918,
2311,
584,
18912,
30004,
13,
4706,
450,
1353,
310,
16608,
304,
736,
22993,
13,
30004,
13,
1678,
6212,
5026,
29901,
30004,
13,
4706,
3564,
29918,
978,
584,
851,
30004,
13,
9651,
450,
1024,
310,
278,
29871,
3564,
22993,
13,
4706,
7945,
519,
584,
6120,
30004,
13,
9651,
960,
445,
3564,
338,
7424,
304,
367,
16370,
22993,
13,
9651,
5852,
363,
278,
660,
29899,
11618,
591,
7945,
322,
7700,
363,
278,
9913,
914,
660,
29899,
11618,
22993,
13,
4706,
1904,
29918,
1445,
584,
851,
30004,
13,
9651,
450,
1024,
310,
278,
934,
6943,
278,
16370,
1904,
4128,
22993,
13,
4706,
1962,
29918,
3972,
584,
851,
30004,
13,
9651,
450,
1024,
310,
278,
1962,
3884,
22993,
13,
4706,
1881,
29918,
2311,
584,
938,
30004,
13,
9651,
450,
2159,
310,
278,
4315,
1881,
22993,
13,
4706,
1881,
29918,
19488,
584,
938,
30004,
13,
9651,
450,
1881,
10809,
29892,
445,
338,
278,
1353,
310,
16608,
1304,
29892,
23347,
29871,
29946,
22993,
13,
4706,
4175,
29918,
29879,
7093,
29901,
584,
5415,
29901,
525,
1761,
29915,
310,
584,
5415,
29901,
525,
524,
29915,
30004,
13,
9651,
319,
1051,
6943,
278,
4175,
15786,
297,
7602,
15359,
22993,
13,
4706,
4175,
29918,
710,
2247,
29901,
584,
5415,
29901,
525,
1761,
29915,
310,
584,
5415,
29901,
525,
524,
29915,
30004,
13,
9651,
319,
1051,
6943,
278,
4175,
851,
2247,
297,
7602,
15359,
22993,
13,
4706,
954,
29918,
26705,
29901,
584,
5415,
29901,
525,
1761,
29915,
310,
584,
5415,
29901,
525,
524,
29915,
30004,
13,
9651,
319,
1051,
6943,
278,
1353,
310,
18094,
297,
7602,
15359,
22993,
13,
4706,
954,
29918,
10892,
29901,
584,
5415,
29901,
525,
1761,
29915,
310,
584,
5415,
29901,
525,
524,
29915,
30004,
13,
9651,
319,
1051,
6943,
278,
1353,
310,
7934,
10340,
297,
8343,
11333,
15359,
22993,
13,
4706,
954,
29918,
7387,
29901,
938,
30004,
13,
9651,
450,
1353,
310,
8820,
3625,
22993,
13,
4706,
868,
14067,
29918,
1853,
29901,
851,
30004,
13,
9651,
450,
1134,
310,
868,
14067,
22993,
13,
4706,
9853,
29918,
2311,
29901,
938,
30004,
13,
9651,
21179,
310,
278,
6694,
9853,
22993,
13,
4706,
6509,
29918,
10492,
29918,
3188,
29901,
5785,
30004,
13,
9651,
450,
1369,
6509,
6554,
22993,
13,
4706,
6509,
29918,
10492,
29918,
7099,
388,
29901,
5785,
30004,
13,
9651,
450,
20228,
6554,
310,
278,
6509,
6554,
29889,
6756,
13,
9651,
1334,
20228,
1432,
2203,
1076,
29918,
10492,
29918,
1524,
362,
22993,
13,
4706,
6509,
29918,
10492,
29918,
10568,
29901,
938,
30004,
13,
9651,
450,
1353,
310,
24372,
304,
385,
484,
284,
278,
6509,
6554,
22993,
13,
4706,
6509,
29918,
10492,
29918,
1195,
29901,
5785,
30004,
13,
9651,
450,
9212,
6509,
6554,
22993,
13,
4706,
20102,
29918,
4181,
29901,
6120,
30004,
13,
9651,
960,
5852,
671,
1059,
9335,
3262,
22993,
13,
4706,
9853,
29918,
5753,
398,
9183,
29901,
851,
30004,
13,
9651,
20370,
376,
12676,
29908,
470,
376,
2083,
613,
3683,
1475,
565,
591,
10032,
2533,
470,
2099,
310,
30004,
13,
9651,
19471,
29918,
17619,
30004,
13,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8636,
29892,
954,
29918,
7387,
29892,
3564,
29918,
978,
29892,
7945,
519,
1125,
30004,
13,
30004,
13,
4706,
1583,
29889,
7529,
353,
8636,
30004,
13,
30004,
13,
4706,
396,
8527,
2472,
30004,
13,
4706,
1583,
29889,
11618,
29918,
978,
4706,
353,
3564,
29918,
978,
30004,
13,
4706,
1583,
29889,
14968,
519,
965,
353,
7945,
519,
30004,
13,
30004,
13,
4706,
396,
10802,
29879,
322,
4733,
30004,
13,
4706,
1583,
29889,
4299,
29918,
1445,
3986,
353,
8636,
29889,
4299,
29918,
1445,
30004,
13,
4706,
1583,
29889,
4905,
29918,
3972,
3986,
353,
8636,
29889,
4905,
29918,
3972,
30004,
13,
30004,
13,
4706,
396,
10567,
304,
278,
660,
29899,
11618,
30004,
13,
4706,
1583,
29889,
2080,
29918,
3545,
308,
353,
8636,
29889,
2080,
29918,
3545,
418,
396,
29871,
29947,
29946,
30004,
13,
4706,
1583,
29889,
2080,
29918,
2103,
3986,
353,
8636,
29889,
2080,
29918,
2103,
418,
396,
29871,
29947,
29946,
30004,
13,
30004,
13,
4706,
1583,
29889,
6272,
29918,
1853,
353,
8636,
29889,
6272,
30004,
13,
30004,
13,
4706,
565,
1583,
29889,
6272,
29918,
1853,
1275,
525,
1195,
267,
705,
11356,
2396,
30004,
13,
9651,
1583,
29889,
2080,
29918,
19488,
3986,
353,
8636,
29889,
29876,
305,
12629,
29871,
396,
29871,
29946,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
1583,
29889,
2080,
29918,
19488,
3986,
353,
8636,
29889,
18434,
29918,
2848,
29871,
396,
29871,
29946,
30004,
13,
30004,
13,
30004,
13,
4706,
1583,
29889,
11618,
29918,
1853,
353,
8636,
29889,
11618,
29918,
1853,
30004,
13,
30004,
13,
4706,
396,
29696,
7546,
11258,
30004,
13,
4706,
1583,
29889,
4572,
29918,
29879,
7093,
4706,
353,
8636,
29889,
4572,
29918,
29879,
7093,
1678,
396,
29871,
29947,
29892,
29871,
29946,
29892,
29871,
29941,
30004,
13,
4706,
1583,
29889,
4572,
29918,
710,
2247,
418,
353,
8636,
29889,
4572,
29918,
710,
2247,
29871,
396,
29871,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
30004,
13,
4706,
1583,
29889,
1949,
29918,
26705,
308,
353,
8636,
29889,
1949,
29918,
26705,
268,
396,
29871,
29941,
29906,
29892,
29871,
29953,
29946,
29892,
29871,
29953,
29946,
30004,
13,
4706,
1583,
29889,
1949,
29918,
10892,
3986,
353,
8636,
29889,
1949,
29918,
10892,
418,
396,
29871,
29945,
29896,
29906,
30004,
13,
4706,
1583,
29889,
1949,
29918,
7387,
308,
353,
954,
29918,
7387,
9651,
396,
7111,
373,
3748,
30004,
13,
4706,
1583,
29889,
700,
14067,
29918,
1853,
4706,
353,
8636,
29889,
700,
14067,
29918,
1853,
30004,
13,
30004,
13,
4706,
396,
26101,
12662,
2699,
30004,
13,
4706,
1583,
29889,
16175,
29918,
2311,
3986,
353,
8636,
29889,
16175,
29918,
2311,
632,
396,
29871,
29941,
29906,
30004,
13,
4706,
1583,
29889,
21891,
29918,
10492,
29918,
3188,
29871,
353,
8636,
29889,
21891,
29918,
10492,
3986,
396,
29871,
29900,
29889,
29900,
29900,
29906,
29945,
30004,
13,
4706,
1583,
29889,
21891,
29918,
10492,
29918,
7099,
388,
353,
8636,
29889,
21891,
29918,
10492,
29918,
7099,
388,
1678,
396,
29871,
29900,
29889,
29929,
29953,
30004,
13,
4706,
1583,
29889,
21891,
29918,
10492,
29918,
10568,
29871,
353,
8636,
29889,
21891,
29918,
10492,
29918,
10568,
268,
396,
29871,
29946,
29945,
29900,
29900,
29900,
29900,
30004,
13,
4706,
1583,
29889,
21891,
29918,
10492,
29918,
1195,
259,
353,
8636,
29889,
21891,
29918,
10492,
29918,
1195,
12539,
29871,
396,
29871,
29900,
29889,
29900,
29900,
29900,
29906,
29945,
30004,
13,
4706,
1583,
29889,
2218,
2798,
9651,
353,
8636,
29889,
2218,
2798,
1669,
396,
29871,
29900,
29889,
29929,
29929,
30004,
13,
4706,
1583,
29889,
11618,
29918,
5504,
29918,
10492,
353,
8636,
29889,
11618,
29918,
5504,
29918,
10492,
1678,
396,
29871,
29896,
29900,
29900,
29900,
29900,
30004,
13,
4706,
1583,
29889,
24049,
29918,
4181,
3986,
353,
8636,
29889,
24049,
29918,
4181,
632,
396,
29871,
29896,
29889,
29900,
30004,
13,
4706,
1583,
29889,
16175,
29918,
5753,
398,
9183,
259,
353,
8636,
29889,
16175,
29918,
5753,
398,
9183,
418,
396,
2099,
470,
2533,
30004,
13,
30004,
13,
4706,
396,
10886,
323,
6073,
17907,
3983,
30004,
13,
4706,
1583,
3032,
2344,
29918,
4262,
26471,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
4262,
29898,
1311,
1125,
30004,
13,
4706,
9995,
15514,
7093,
278,
26845,
3983,
297,
323,
6073,
1731,
322,
23315,
278,
30004,
13,
4706,
19677,
3564,
22993,
13,
4706,
960,
7945,
519,
338,
5852,
29892,
591,
884,
2048,
278,
6410,
760,
310,
278,
3983,
22993,
13,
30004,
13,
4706,
16969,
30004,
13,
4706,
448,
22158,
30004,
13,
4706,
6213,
30004,
13,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
396,
25455,
5858,
363,
4969,
29914,
16554,
15837,
304,
8086,
30004,
13,
4706,
1583,
29889,
14968,
29918,
7727,
29918,
459,
268,
353,
6213,
30004,
13,
4706,
1583,
29889,
14513,
29918,
7727,
29918,
459,
418,
353,
6213,
30004,
13,
4706,
1583,
29889,
14968,
29918,
7727,
29918,
13236,
353,
6213,
30004,
13,
30004,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
29898,
1311,
29889,
11618,
29918,
978,
1125,
30004,
13,
30004,
13,
9651,
1583,
29889,
10945,
29918,
1524,
362,
1678,
353,
15886,
29889,
16174,
29898,
29900,
29892,
1024,
2433,
10945,
29918,
1524,
362,
742,
6756,
13,
462,
462,
1678,
7945,
519,
29922,
8824,
8443,
13,
30004,
13,
9651,
396,
15484,
8948,
414,
30004,
13,
9651,
1583,
29889,
572,
29918,
29879,
24546,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
6756,
13,
462,
462,
1678,
8267,
11759,
8516,
29892,
6756,
13,
462,
462,
9651,
1583,
29889,
2080,
29918,
3545,
29892,
6756,
13,
462,
462,
9651,
1583,
29889,
2080,
29918,
2103,
29892,
6756,
13,
462,
462,
9651,
1583,
29889,
2080,
29918,
19488,
1402,
6756,
13,
462,
462,
9651,
1024,
543,
29879,
24546,
1159,
30004,
13,
30004,
13,
9651,
396,
1152,
8343,
11333,
14379,
30004,
13,
9651,
1583,
29889,
572,
29918,
20620,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
6756,
13,
462,
462,
1678,
8267,
11759,
8516,
29892,
6756,
13,
462,
462,
9651,
1583,
29889,
2080,
29918,
3545,
29930,
1311,
29889,
2080,
29918,
2103,
29930,
1311,
29889,
2080,
29918,
19488,
1402,
6756,
13,
462,
462,
9651,
1024,
543,
20620,
1159,
30004,
13,
30004,
13,
30004,
13,
9651,
396,
2866,
475,
3855,
29899,
29873,
1191,
342,
363,
599,
9853,
267,
639,
3158,
29892,
6213,
363,
9853,
267,
30004,
13,
9651,
1583,
29889,
572,
29918,
29939,
5182,
29879,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
11759,
8516,
29892,
1583,
29889,
1949,
29918,
7387,
1402,
6756,
13,
462,
462,
1678,
1024,
543,
29939,
5182,
29879,
1159,
30004,
13,
30004,
13,
9651,
1583,
29889,
572,
29918,
7387,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29953,
29946,
29892,
8267,
11759,
8516,
1402,
6756,
13,
462,
462,
1678,
1024,
543,
7387,
1159,
30004,
13,
30004,
13,
9651,
1583,
29889,
572,
29918,
7387,
29918,
5182,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29953,
29946,
29892,
8267,
11759,
8516,
1402,
29871,
396,
319,
1953,
515,
7945,
29899,
11618,
1304,
304,
1831,
3855,
29899,
5975,
297,
3646,
3564,
30004,
13,
462,
462,
1678,
1024,
543,
7387,
29918,
5182,
1159,
30004,
13,
30004,
13,
9651,
1583,
29889,
572,
29918,
276,
2935,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
11759,
8516,
1402,
6756,
13,
462,
462,
1678,
1024,
543,
276,
2935,
1159,
30004,
13,
30004,
13,
9651,
1583,
29889,
572,
29918,
29881,
2873,
259,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
11759,
8516,
1402,
6756,
13,
462,
462,
1678,
1024,
543,
29881,
2873,
1159,
30004,
13,
30004,
13,
9651,
396,
14806,
6031,
304,
8857,
30004,
13,
9651,
1583,
29889,
4572,
29918,
29879,
7093,
259,
353,
1051,
29898,
1958,
29898,
524,
29892,
1583,
29889,
4572,
29918,
29879,
7093,
29889,
5451,
29898,
3284,
4961,
30004,
13,
9651,
1583,
29889,
4572,
29918,
710,
2247,
353,
1051,
29898,
1958,
29898,
524,
29892,
1583,
29889,
4572,
29918,
710,
2247,
29889,
5451,
29898,
3284,
4961,
30004,
13,
9651,
1583,
29889,
1949,
29918,
26705,
1678,
353,
1051,
29898,
1958,
29898,
524,
29892,
1583,
29889,
1949,
29918,
26705,
29889,
5451,
29898,
3284,
4961,
30004,
13,
30004,
13,
9651,
1583,
29889,
29939,
5975,
353,
1583,
3032,
4282,
29918,
29883,
15755,
26471,
13,
30004,
13,
9651,
396,
25455,
278,
6410,
740,
565,
591,
505,
278,
7945,
519,
660,
29899,
11618,
22993,
13,
9651,
396,
13466,
599,
4128,
526,
13746,
22993,
13,
9651,
565,
1583,
29889,
14968,
519,
29901,
30004,
13,
30004,
13,
18884,
1583,
3032,
4282,
29918,
6758,
26471,
13,
30004,
13,
18884,
396,
29257,
6554,
20228,
30004,
13,
18884,
396,
1932,
6694,
263,
1904,
29892,
372,
338,
4049,
13622,
304,
5224,
278,
6756,
13,
18884,
396,
6509,
6554,
408,
278,
6694,
6728,
267,
29889,
6756,
13,
18884,
396,
910,
740,
16058,
385,
25658,
20228,
740,
304,
263,
6756,
13,
18884,
396,
4944,
2847,
6509,
6554,
22993,
13,
18884,
396,
10783,
267,
5534,
29918,
1524,
362,
304,
10272,
278,
20228,
287,
6509,
6554,
22993,
13,
18884,
1583,
29889,
21891,
29918,
10492,
259,
353,
15886,
29889,
14968,
29889,
735,
1112,
2556,
29918,
7099,
388,
29898,
30004,
13,
462,
1678,
1583,
29889,
21891,
29918,
10492,
29918,
3188,
29892,
1583,
29889,
10945,
29918,
1524,
362,
11167,
13,
462,
1678,
1583,
29889,
21891,
29918,
10492,
29918,
10568,
29892,
1583,
29889,
21891,
29918,
10492,
29918,
7099,
388,
11167,
13,
462,
1678,
380,
1466,
4878,
29922,
5574,
30004,
13,
18884,
1723,
30004,
13,
30004,
13,
18884,
1583,
29889,
21891,
29918,
10492,
353,
15886,
29889,
27525,
398,
29898,
1311,
29889,
21891,
29918,
10492,
29892,
6756,
13,
462,
462,
4706,
1583,
29889,
21891,
29918,
10492,
29918,
1195,
8443,
13,
30004,
13,
18884,
396,
11783,
20693,
326,
3950,
30004,
13,
18884,
1583,
29889,
20640,
3950,
353,
15886,
29889,
14968,
29889,
3253,
314,
20624,
326,
3950,
29898,
30004,
13,
462,
462,
1678,
6509,
29918,
10492,
29922,
1311,
29889,
21891,
29918,
10492,
11167,
13,
462,
462,
1678,
321,
3232,
29922,
29896,
29889,
29945,
29872,
29899,
29946,
29897,
396,
3645,
21431,
17729,
5650,
30004,
13,
30004,
13,
18884,
1583,
29889,
14968,
29918,
459,
29918,
20640,
3950,
353,
1583,
29889,
20640,
3950,
29889,
1195,
326,
675,
29898,
30004,
13,
462,
462,
9651,
1583,
29889,
6758,
29892,
6756,
13,
462,
462,
9651,
5534,
29918,
10568,
29922,
1311,
29889,
10945,
29918,
1524,
362,
396,
2443,
567,
2737,
304,
1554,
1683,
297,
15561,
1454,
13561,
29892,
577,
591,
1246,
12541,
30004,
13,
462,
462,
4706,
1723,
30004,
13,
30004,
13,
18884,
396,
19152,
5702,
310,
2734,
6588,
310,
278,
6410,
746,
6260,
5281,
6756,
13,
18884,
396,
278,
6410,
30004,
13,
18884,
396,
15886,
29889,
6451,
29918,
22594,
2794,
393,
6756,
13,
18884,
396,
1583,
29889,
14968,
29918,
459,
353,
15886,
29889,
2972,
29898,
1311,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29918,
459,
8443,
13,
18884,
396,
338,
871,
1065,
1156,
1583,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29918,
459,
756,
1063,
8283,
30004,
13,
18884,
411,
15886,
29889,
6451,
29918,
22594,
4197,
1311,
29889,
14968,
29918,
459,
29918,
20640,
3950,
29962,
1125,
30004,
13,
462,
1678,
1583,
29889,
14968,
29918,
459,
353,
15886,
29889,
2972,
29898,
1311,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29918,
459,
8443,
13,
30004,
13,
1678,
822,
903,
4282,
29918,
29883,
15755,
29898,
1311,
1125,
30004,
13,
4706,
9995,
8893,
29879,
263,
26851,
284,
3564,
29889,
1932,
591,
788,
716,
15359,
29892,
372,
338,
30004,
13,
4706,
4100,
304,
731,
7945,
519,
29922,
1311,
29889,
14968,
519,
1951,
1438,
4128,
4225,
30004,
13,
4706,
304,
367,
13746,
304,
278,
3646,
716,
548,
322,
372,
3913,
278,
731,
310,
3367,
273,
519,
22993,
13,
30004,
13,
4706,
16969,
30004,
13,
4706,
448,
22158,
30004,
13,
4706,
584,
5415,
29901,
525,
299,
2378,
29915,
310,
584,
5415,
29901,
525,
7411,
29915,
30004,
13,
9651,
450,
3855,
29899,
5975,
297,
278,
1962,
408,
263,
1051,
29892,
6590,
304,
1269,
1950,
30004,
13,
9651,
3158,
22993,
13,
30004,
13,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
703,
13724,
29908,
1125,
30004,
13,
30004,
13,
9651,
565,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29896,
29901,
30004,
13,
30004,
13,
18884,
7602,
29896,
353,
15886,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
30004,
13,
462,
1678,
10970,
29922,
1311,
29889,
572,
29918,
29879,
24546,
29892,
6756,
13,
462,
1678,
18094,
29922,
29896,
29947,
29892,
6756,
13,
462,
1678,
8466,
29918,
2311,
11759,
29945,
29892,
29871,
29945,
1402,
30004,
13,
462,
1678,
851,
2247,
7607,
29896,
29892,
29871,
29896,
511,
30004,
13,
462,
1678,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
11167,
13,
462,
1678,
7164,
543,
17642,
613,
29871,
396,
19491,
408,
297,
13023,
294,
30004,
13,
462,
1678,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
1678,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
1678,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
1678,
1024,
543,
20580,
29896,
19451,
13,
462,
1678,
1723,
30004,
13,
30004,
13,
18884,
7602,
29906,
353,
15886,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
30004,
13,
462,
1678,
10970,
29922,
20580,
29896,
29892,
6756,
13,
462,
1678,
18094,
29922,
29941,
29953,
29892,
6756,
13,
462,
1678,
8466,
29918,
2311,
11759,
29941,
29892,
29871,
29941,
1402,
30004,
13,
462,
1678,
851,
2247,
7607,
29896,
29892,
29896,
511,
30004,
13,
462,
1678,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
11167,
13,
462,
1678,
7164,
543,
17642,
613,
29871,
396,
19491,
408,
297,
13023,
294,
30004,
13,
462,
1678,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
1678,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
1678,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
1678,
1024,
543,
20580,
29906,
19451,
13,
462,
1678,
1723,
30004,
13,
30004,
13,
9651,
25342,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29906,
29901,
30004,
13,
30004,
13,
18884,
7602,
29896,
353,
15886,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
30004,
13,
462,
1678,
10970,
29922,
1311,
29889,
572,
29918,
29879,
24546,
29892,
6756,
13,
462,
1678,
18094,
29922,
29896,
29953,
29892,
6756,
13,
462,
1678,
8466,
29918,
2311,
11759,
29946,
29892,
29871,
29946,
1402,
30004,
13,
462,
1678,
851,
2247,
7607,
29896,
29892,
29871,
29896,
511,
30004,
13,
462,
1678,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
11167,
13,
462,
1678,
7164,
543,
3084,
613,
29871,
396,
19491,
408,
297,
13023,
294,
30004,
13,
462,
1678,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
1678,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
1678,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
1678,
1024,
543,
20580,
29896,
19451,
13,
462,
1678,
1723,
30004,
13,
30004,
13,
18884,
7602,
29906,
353,
15886,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
30004,
13,
462,
1678,
10970,
29922,
20580,
29896,
29892,
6756,
13,
462,
1678,
18094,
29922,
29941,
29906,
29892,
6756,
13,
462,
1678,
8466,
29918,
2311,
11759,
29941,
29892,
29871,
29941,
1402,
30004,
13,
462,
1678,
851,
2247,
7607,
29896,
29892,
29896,
511,
30004,
13,
462,
1678,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
11167,
13,
462,
1678,
7164,
543,
17642,
613,
29871,
396,
19491,
408,
297,
13023,
294,
30004,
13,
462,
1678,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
1678,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
1678,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
1678,
1024,
543,
20580,
29906,
19451,
13,
462,
1678,
1723,
30004,
13,
30004,
13,
18884,
7602,
29941,
353,
15886,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
30004,
13,
462,
1678,
10970,
29922,
20580,
29906,
29892,
6756,
13,
462,
1678,
18094,
29922,
29941,
29906,
29892,
6756,
13,
462,
1678,
8466,
29918,
2311,
11759,
29906,
29892,
29871,
29906,
1402,
30004,
13,
462,
1678,
851,
2247,
7607,
29896,
29892,
29896,
511,
30004,
13,
462,
1678,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
11167,
13,
462,
1678,
7164,
543,
3084,
613,
29871,
396,
19491,
408,
297,
13023,
294,
30004,
13,
462,
1678,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
1678,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
1678,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
1678,
1024,
543,
20580,
29941,
19451,
13,
462,
1678,
1723,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
9651,
396,
1763,
2334,
868,
14067,
29892,
1074,
2045,
597,
3292,
29889,
510,
29914,
2585,
711,
1267,
2901,
29914,
276,
262,
10118,
1731,
29914,
10054,
29914,
6207,
29914,
276,
262,
10118,
1731,
29914,
1212,
29879,
29914,
700,
14067,
29889,
2272,
30004,
13,
30004,
13,
9651,
565,
1583,
29889,
700,
14067,
29918,
1853,
338,
6213,
29901,
30004,
13,
30004,
13,
18884,
565,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29896,
29901,
30004,
13,
30004,
13,
462,
1678,
7602,
29918,
1579,
8606,
353,
15886,
29889,
21570,
29889,
29277,
29889,
1579,
8606,
29898,
30004,
13,
462,
4706,
10970,
29922,
20580,
29906,
30004,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
462,
1678,
285,
29883,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
9651,
10970,
29922,
20580,
29918,
1579,
8606,
29892,
6756,
13,
462,
9651,
10340,
29922,
29906,
29947,
29947,
29892,
6756,
13,
462,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
462,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
9651,
1024,
543,
13801,
29896,
19451,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
462,
1678,
285,
29883,
29906,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
9651,
10970,
29922,
13801,
29896,
29892,
6756,
13,
462,
9651,
10340,
29922,
29906,
29906,
29900,
29892,
6756,
13,
462,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
462,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
9651,
1024,
543,
13801,
29906,
19451,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
30004,
13,
462,
1678,
285,
29883,
29941,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
9651,
10970,
29922,
13801,
29906,
29892,
6756,
13,
462,
9651,
10340,
29922,
29906,
29906,
29900,
29892,
6756,
13,
462,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
462,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
9651,
1024,
543,
13801,
29941,
19451,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
30004,
13,
462,
1678,
3855,
5975,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
18884,
10970,
29922,
13801,
29941,
29892,
6756,
13,
462,
18884,
10340,
29922,
1311,
29889,
1949,
29918,
7387,
29892,
6756,
13,
462,
18884,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
18884,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
18884,
7945,
519,
29922,
1311,
29889,
14968,
519,
30004,
13,
462,
9651,
1723,
30004,
13,
30004,
13,
18884,
565,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29906,
29901,
30004,
13,
30004,
13,
30004,
13,
462,
1678,
7602,
29918,
1579,
8606,
353,
15886,
29889,
21570,
29889,
29277,
29889,
1579,
8606,
29898,
30004,
13,
462,
4706,
10970,
29922,
20580,
29941,
30004,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
462,
1678,
285,
29883,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
9651,
10970,
29922,
20580,
29918,
1579,
8606,
29892,
6756,
13,
462,
9651,
10340,
29922,
29945,
29896,
29906,
29892,
6756,
13,
462,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
462,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
462,
9651,
1024,
543,
13801,
29896,
19451,
13,
462,
4706,
1723,
30004,
13,
30004,
13,
462,
1678,
3855,
5975,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
462,
18884,
10970,
29922,
13801,
29896,
29892,
6756,
13,
462,
18884,
10340,
29922,
1311,
29889,
1949,
29918,
7387,
29892,
6756,
13,
462,
18884,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
462,
18884,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
462,
18884,
7945,
519,
29922,
1311,
29889,
14968,
519,
30004,
13,
462,
9651,
1723,
30004,
13,
30004,
13,
9651,
396,
360,
2491,
292,
338,
9615,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
396,
4806,
2125,
278,
1962,
515,
278,
2186,
26851,
284,
7546,
322,
6756,
13,
18884,
396,
6219,
372,
964,
5004,
10631,
322,
995,
20873,
22993,
13,
30004,
13,
18884,
565,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29896,
29901,
30004,
13,
30004,
13,
462,
1678,
4840,
2477,
29892,
4840,
8257,
353,
15886,
29889,
5451,
29898,
20580,
29906,
29892,
29906,
29892,
29941,
8443,
13,
30004,
13,
18884,
25342,
1583,
29889,
11618,
29918,
1853,
1275,
29871,
29906,
29901,
30004,
13,
30004,
13,
462,
1678,
4840,
2477,
29892,
4840,
8257,
353,
15886,
29889,
5451,
29898,
20580,
29941,
29892,
29906,
29892,
29941,
8443,
13,
30004,
13,
18884,
4840,
29909,
353,
15886,
29889,
21570,
29889,
29277,
29889,
1579,
8606,
29898,
5461,
2477,
8443,
13,
18884,
4840,
29963,
353,
15886,
29889,
21570,
29889,
29277,
29889,
1579,
8606,
29898,
5461,
8257,
8443,
13,
30004,
13,
18884,
3855,
5975,
353,
1583,
3032,
1202,
29918,
700,
14067,
29898,
5461,
29909,
29892,
4840,
29963,
8443,
13,
30004,
13,
4706,
736,
3855,
5975,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
903,
1202,
29918,
700,
14067,
29898,
1311,
29892,
4840,
29909,
29892,
4840,
29963,
1125,
30004,
13,
4706,
9995,
2528,
29879,
868,
14067,
304,
263,
3564,
22993,
13,
4706,
2823,
29901,
30004,
13,
4706,
2045,
597,
3292,
29889,
510,
29914,
3359,
29879,
1531,
29879,
29914,
29928,
29984,
29940,
29899,
29056,
29914,
10054,
29914,
6207,
29914,
29881,
29939,
29876,
29914,
14748,
29889,
2272,
30004,
13,
4706,
2045,
597,
3292,
29889,
510,
29914,
2585,
711,
1267,
2901,
29914,
276,
262,
10118,
1731,
29914,
10054,
29914,
6207,
29914,
276,
262,
10118,
1731,
29914,
1212,
29879,
29914,
700,
14067,
29889,
2272,
30004,
13,
4706,
2045,
597,
3292,
29889,
510,
29914,
3359,
29879,
1531,
29879,
29914,
29928,
29984,
29940,
29899,
29056,
29914,
10054,
29914,
6207,
29914,
29881,
29939,
29876,
29914,
14748,
29889,
2272,
30004,
13,
4706,
2045,
597,
3292,
29889,
510,
29914,
29887,
554,
5403,
1803,
262,
29914,
1289,
29881,
29939,
29876,
29899,
13264,
29914,
10054,
29914,
6207,
29914,
1289,
29881,
29939,
29876,
29889,
2272,
30004,
13,
4706,
2045,
597,
3292,
29889,
510,
29914,
1450,
29926,
352,
11727,
29914,
2772,
1022,
2241,
29899,
14769,
1237,
29914,
10054,
29914,
6207,
29914,
11843,
29899,
29928,
2491,
292,
29899,
29928,
29984,
29940,
29889,
666,
948,
29890,
30004,
13,
30004,
13,
4706,
1126,
278,
2441,
5650,
30004,
13,
4706,
2045,
597,
279,
26560,
29889,
990,
29914,
5140,
29914,
29896,
29945,
29896,
29896,
29889,
29900,
29953,
29945,
29947,
29896,
29889,
5140,
30004,
13,
30004,
13,
4706,
12662,
2699,
30004,
13,
4706,
448,
1378,
29899,
30004,
13,
4706,
4840,
29909,
584,
5415,
29901,
525,
299,
2378,
29915,
310,
584,
5415,
29901,
525,
7411,
29915,
30004,
13,
462,
1678,
450,
1881,
304,
278,
10631,
760,
22993,
13,
4706,
4840,
29963,
584,
5415,
29901,
525,
299,
2378,
29915,
310,
584,
5415,
29901,
525,
7411,
29915,
30004,
13,
462,
1678,
450,
1881,
304,
995,
760,
22993,
13,
30004,
13,
4706,
313,
8498,
3757,
630,
8443,
13,
4706,
7787,
29918,
2080,
584,
5415,
29901,
525,
299,
2378,
29915,
310,
584,
5415,
29901,
525,
7411,
29915,
30004,
13,
9651,
450,
1881,
304,
278,
760,
310,
278,
3564,
16049,
868,
14067,
30004,
13,
30004,
13,
4706,
16969,
30004,
13,
4706,
448,
22158,
30004,
13,
4706,
584,
5415,
29901,
525,
299,
2378,
29915,
310,
584,
5415,
29901,
525,
7411,
29915,
30004,
13,
9651,
450,
3855,
29899,
5975,
297,
278,
1962,
408,
263,
1051,
29892,
6590,
304,
1269,
1950,
30004,
13,
9651,
3158,
22993,
13,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
3061,
29918,
262,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
9651,
10970,
29922,
5461,
29909,
29892,
6756,
13,
9651,
10340,
29922,
29945,
29896,
29906,
29892,
6756,
13,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
9651,
1024,
543,
17263,
29918,
262,
1159,
30004,
13,
30004,
13,
4706,
3061,
29918,
449,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
9651,
10970,
29922,
17263,
29918,
262,
29892,
6756,
13,
9651,
10340,
29922,
1311,
29889,
1949,
29918,
7387,
29892,
6756,
13,
9651,
26229,
29922,
8516,
29892,
6756,
13,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
9651,
1024,
543,
17263,
29918,
449,
1159,
30004,
13,
30004,
13,
4706,
995,
29918,
262,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
9651,
10970,
353,
4840,
29963,
11167,
13,
9651,
10340,
29922,
29945,
29896,
29906,
29892,
6756,
13,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
9651,
1024,
543,
1767,
29918,
262,
1159,
30004,
13,
30004,
13,
4706,
995,
29918,
449,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
30004,
13,
9651,
10970,
29922,
1767,
29918,
262,
29892,
6756,
13,
9651,
10340,
29922,
29896,
29892,
6756,
13,
9651,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29892,
6756,
13,
9651,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
21570,
29889,
29277,
29889,
29916,
18852,
29918,
11228,
3950,
29898,
26776,
29922,
1311,
29889,
7529,
29889,
26776,
511,
30004,
13,
9651,
24003,
29918,
11228,
3950,
29922,
15886,
29889,
23362,
29918,
11228,
3950,
29898,
1311,
29889,
7529,
29889,
29890,
3173,
29918,
2344,
511,
30004,
13,
9651,
7945,
519,
29922,
1311,
29889,
14968,
519,
11167,
13,
9651,
1024,
543,
1767,
29918,
449,
1159,
30004,
13,
30004,
13,
30004,
13,
4706,
396,
274,
562,
5987,
278,
660,
29898,
29879,
29892,
29874,
29936,
3416,
8443,
13,
4706,
396,
868,
14067,
29918,
1853,
1275,
525,
485,
29887,
29915,
30004,
13,
4706,
396,
660,
29898,
29879,
29892,
29874,
29936,
3416,
29897,
353,
478,
29898,
29879,
29936,
3416,
29897,
718,
313,
29909,
29898,
29879,
29892,
29874,
29936,
3416,
6817,
12810,
29887,
29918,
29874,
29898,
29909,
29898,
29879,
29892,
29874,
29936,
3416,
4961,
30004,
13,
4706,
396,
868,
14067,
29918,
1853,
1275,
525,
3317,
29915,
30004,
13,
4706,
396,
660,
29898,
29879,
29892,
29874,
29936,
3416,
29897,
353,
478,
29898,
29879,
29936,
3416,
29897,
718,
313,
29909,
29898,
29879,
29892,
29874,
29936,
3416,
6817,
3317,
29918,
29874,
29898,
29909,
29898,
29879,
29892,
29874,
29936,
3416,
4961,
30004,
13,
4706,
396,
868,
14067,
29918,
1853,
1275,
525,
1056,
573,
29915,
30004,
13,
4706,
396,
660,
29898,
29879,
29892,
29874,
29936,
3416,
29897,
353,
478,
29898,
29879,
29936,
3416,
29897,
718,
319,
29898,
29879,
29892,
29874,
29936,
3416,
8443,
13,
30004,
13,
4706,
565,
1583,
29889,
700,
14067,
29918,
1853,
1275,
525,
1056,
573,
2396,
30004,
13,
30004,
13,
9651,
3855,
5975,
353,
995,
29918,
449,
718,
3061,
29918,
449,
30004,
13,
30004,
13,
4706,
396,
16316,
338,
825,
338,
7829,
297,
278,
5650,
30004,
13,
4706,
25342,
1583,
29889,
700,
14067,
29918,
1853,
1275,
525,
12676,
2396,
30004,
13,
30004,
13,
9651,
3855,
5975,
353,
15886,
29889,
1202,
29898,
1767,
29918,
449,
29892,
6756,
13,
462,
4706,
15886,
29889,
1491,
29873,
1461,
29898,
17263,
29918,
449,
29892,
6756,
13,
462,
9651,
15886,
29889,
17469,
29918,
12676,
29898,
17263,
29918,
449,
29892,
29871,
29896,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
4961,
30004,
13,
30004,
13,
4706,
25342,
1583,
29889,
700,
14067,
29918,
1853,
1275,
525,
3317,
2396,
30004,
13,
30004,
13,
9651,
3855,
5975,
353,
15886,
29889,
1202,
29898,
1767,
29918,
449,
29892,
6756,
13,
462,
4706,
15886,
29889,
1491,
29873,
1461,
29898,
17263,
29918,
449,
29892,
6756,
13,
462,
9651,
15886,
29889,
17469,
29918,
3317,
29898,
17263,
29918,
449,
29892,
29871,
29896,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
4961,
30004,
13,
30004,
13,
4706,
1683,
29901,
30004,
13,
30004,
13,
9651,
12020,
7865,
2392,
703,
14148,
868,
14067,
1134,
14210,
29879,
4286,
7740,
3106,
29901,
525,
1056,
573,
742,
320,
30004,
13,
462,
4706,
525,
12676,
742,
525,
3317,
29915,
1213,
1273,
1583,
29889,
700,
14067,
29918,
1853,
8443,
13,
30004,
13,
4706,
736,
3855,
5975,
30004,
13,
30004,
13,
1678,
822,
903,
4282,
29918,
6758,
29898,
1311,
1125,
30004,
13,
4706,
9995,
8893,
278,
6410,
740,
363,
278,
19677,
3564,
22993,
13,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
703,
6758,
29908,
1125,
30004,
13,
30004,
13,
9651,
396,
11796,
29872,
343,
29918,
29926,
353,
364,
29918,
29926,
718,
2313,
792,
29930,
3317,
29918,
29939,
1767,
30004,
13,
9651,
1583,
29889,
13264,
29918,
2218,
2798,
353,
15886,
29889,
23362,
29898,
1311,
29889,
2218,
2798,
8443,
13,
9651,
396,
1311,
29889,
572,
29918,
29939,
5182,
29879,
353,
15886,
29889,
17469,
29918,
3317,
29898,
1311,
29889,
572,
29918,
29939,
5182,
29879,
29892,
20376,
29918,
513,
1575,
11759,
29896,
2314,
30004,
13,
30004,
13,
30004,
13,
9651,
396,
1583,
29889,
572,
29918,
7387,
29918,
14968,
30004,
13,
9651,
396,
1311,
29889,
572,
29918,
29939,
5182,
29879,
353,
1583,
29889,
572,
29918,
29939,
5182,
29879,
29961,
3881,
29898,
1311,
29889,
16175,
29918,
2311,
511,
1583,
29889,
572,
29918,
7387,
29918,
5182,
29962,
30004,
13,
30004,
13,
9651,
396,
3617,
660,
29899,
5975,
363,
278,
1852,
3317,
8820,
515,
8820,
7945,
30004,
13,
9651,
396,
1152,
445,
29892,
591,
671,
278,
697,
29899,
8711,
8025,
30004,
13,
9651,
1583,
29889,
7387,
29918,
650,
29918,
8711,
29918,
5182,
353,
15886,
29889,
650,
29918,
8711,
29898,
30004,
13,
462,
462,
1678,
1583,
29889,
572,
29918,
7387,
29918,
5182,
29892,
1583,
29889,
1949,
29918,
7387,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
30004,
13,
462,
462,
1678,
1723,
30004,
13,
30004,
13,
9651,
396,
9788,
29892,
591,
10272,
278,
3855,
29899,
1564,
434,
310,
278,
3646,
3564,
30004,
13,
9651,
396,
363,
278,
8820,
607,
5256,
11925,
278,
6756,
13,
9651,
1583,
29889,
29939,
5182,
353,
15886,
29889,
17469,
29918,
2083,
29898,
30004,
13,
462,
462,
1678,
15886,
29889,
18056,
368,
29898,
30004,
13,
462,
462,
4706,
1583,
29889,
572,
29918,
29939,
5182,
29879,
29892,
6756,
13,
462,
462,
4706,
1583,
29889,
7387,
29918,
650,
29918,
8711,
29918,
5182,
511,
6756,
13,
462,
462,
4706,
20376,
29918,
513,
1575,
29922,
29896,
30004,
13,
462,
18884,
1723,
30004,
13,
30004,
13,
9651,
565,
1583,
29889,
6272,
29918,
1853,
1275,
525,
271,
1306,
2396,
30004,
13,
30004,
13,
18884,
396,
512,
472,
1306,
29892,
2309,
338,
4319,
1951,
278,
8090,
881,
1833,
408,
1472,
408,
1950,
30004,
13,
18884,
396,
363,
7903,
29899,
29879,
705,
11356,
29892,
2309,
338,
3181,
335,
2738,
29892,
322,
591,
2755,
6410,
491,
263,
4549,
8178,
30004,
13,
18884,
396,
20751,
29892,
322,
5401,
338,
3763,
6728,
292,
491,
263,
3058,
1353,
310,
6576,
30004,
13,
18884,
1583,
29889,
29939,
5182,
353,
15886,
29889,
1202,
29898,
30004,
13,
462,
462,
1678,
1583,
29889,
572,
29918,
276,
2935,
29892,
6756,
13,
462,
462,
1678,
15886,
29889,
18056,
368,
29898,
29896,
29889,
29900,
29899,
1311,
29889,
572,
29918,
29881,
2873,
29892,
6756,
13,
462,
462,
4706,
15886,
29889,
18056,
368,
29898,
1311,
29889,
13264,
29918,
2218,
2798,
29892,
1583,
29889,
29939,
5182,
876,
30004,
13,
462,
18884,
1723,
30004,
13,
30004,
13,
9651,
25342,
1583,
29889,
6272,
29918,
1853,
1275,
525,
1195,
267,
705,
11356,
2396,
30004,
13,
30004,
13,
18884,
1583,
29889,
29939,
5182,
353,
15886,
29889,
1202,
29898,
30004,
13,
462,
462,
4706,
1583,
29889,
572,
29918,
276,
2935,
29892,
6756,
13,
462,
462,
4706,
15886,
29889,
18056,
368,
29898,
1311,
29889,
13264,
29918,
2218,
2798,
29892,
1583,
29889,
29939,
5182,
8443,
13,
462,
462,
1678,
1723,
30004,
13,
30004,
13,
9651,
396,
7605,
660,
29899,
5975,
363,
2183,
8820,
30004,
13,
9651,
396,
450,
8820,
526,
263,
29871,
29896,
29928,
1409,
29892,
591,
697,
29899,
8711,
19750,
411,
278,
1353,
310,
8820,
30004,
13,
9651,
396,
1833,
1023,
526,
373,
29899,
1767,
29892,
1283,
29899,
1767,
30004,
13,
9651,
396,
1987,
591,
925,
505,
263,
4636,
411,
29871,
29896,
29879,
988,
385,
3158,
471,
8560,
30004,
13,
9651,
1583,
29889,
7387,
29918,
650,
29918,
8711,
353,
15886,
29889,
650,
29918,
8711,
29898,
30004,
13,
462,
462,
1678,
1583,
29889,
572,
29918,
7387,
29892,
1583,
29889,
1949,
29918,
7387,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
30004,
13,
462,
462,
1678,
1723,
30004,
13,
30004,
13,
30004,
13,
9651,
396,
13866,
591,
4017,
278,
6410,
491,
5622,
278,
2533,
310,
25256,
4328,
6756,
13,
9651,
396,
1546,
278,
3646,
322,
18988,
660,
1819,
22993,
13,
9651,
396,
11796,
29872,
7146,
2533,
3412,
599,
4206,
491,
2533,
4056,
1897,
3161,
30004,
13,
9651,
1583,
29889,
29939,
1767,
29918,
11965,
353,
15886,
29889,
17469,
29918,
2083,
29898,
30004,
13,
462,
462,
1678,
15886,
29889,
18056,
368,
29898,
30004,
13,
462,
462,
4706,
1583,
29889,
29939,
5975,
29892,
6756,
13,
462,
462,
4706,
1583,
29889,
7387,
29918,
650,
29918,
8711,
511,
6756,
13,
462,
462,
4706,
20376,
29918,
513,
1575,
29922,
29896,
30004,
13,
462,
18884,
1723,
30004,
13,
9651,
6756,
13,
9651,
396,
360,
17678,
1546,
3646,
313,
3009,
29897,
322,
25383,
660,
29899,
11618,
1962,
30004,
13,
9651,
1583,
29889,
4181,
353,
15886,
29889,
1491,
29873,
1461,
29898,
1311,
29889,
29939,
5182,
29892,
1583,
29889,
29939,
1767,
29918,
11965,
8443,
13,
30004,
13,
9651,
565,
1583,
29889,
24049,
29918,
4181,
29901,
30004,
13,
18884,
396,
27313,
9335,
3262,
310,
278,
1059,
1840,
29892,
6756,
13,
18884,
396,
2322,
9335,
3262,
338,
304,
8521,
29896,
29892,
718,
29896,
29897,
3464,
30004,
13,
18884,
1583,
29889,
4181,
29918,
17619,
353,
15886,
29889,
6758,
267,
29889,
29882,
11234,
29918,
6758,
29898,
1311,
29889,
29939,
5182,
29892,
1583,
29889,
29939,
1767,
29918,
11965,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
396,
1939,
1059,
9335,
3262,
30004,
13,
18884,
396,
22599,
29899,
2704,
30004,
13,
18884,
1583,
29889,
4181,
29918,
17619,
29871,
353,
15886,
29889,
17619,
29898,
1311,
29889,
4181,
8443,
13,
30004,
13,
4706,
396,
3185,
950,
6410,
30004,
13,
4706,
565,
1583,
29889,
16175,
29918,
5753,
398,
9183,
1275,
376,
2083,
1115,
30004,
13,
965,
1583,
29889,
6758,
353,
15886,
29889,
17469,
29918,
2083,
29898,
1311,
29889,
4181,
29918,
17619,
8443,
13,
4706,
1683,
29901,
30004,
13,
965,
1583,
29889,
6758,
353,
15886,
29889,
17469,
29918,
12676,
29898,
1311,
29889,
4181,
29918,
17619,
8443,
13,
30004,
13,
30004,
13,
4706,
396,
19509,
6588,
310,
278,
6410,
363,
323,
6073,
28397,
30004,
13,
4706,
1583,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
1678,
353,
15886,
29889,
14968,
29889,
1252,
1112,
2556,
29924,
21081,
29909,
19698,
29898,
7099,
388,
29922,
29900,
29889,
29929,
29929,
29929,
8443,
13,
4706,
1583,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29918,
459,
353,
1583,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29889,
7302,
4197,
1311,
29889,
6758,
2314,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
2048,
29918,
7727,
29918,
13236,
29898,
1311,
29892,
27937,
1125,
30004,
13,
4706,
9995,
8893,
15837,
9227,
310,
278,
6728,
22993,
13,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
396,
11796,
29872,
278,
6588,
660,
29899,
1767,
30004,
13,
4706,
1029,
29887,
29918,
29939,
5975,
29918,
14968,
29871,
353,
15886,
29889,
17469,
29918,
12676,
29898,
1311,
29889,
29939,
5975,
8443,
13,
4706,
1029,
29887,
29918,
29939,
5975,
29918,
5182,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
17469,
29918,
12676,
29898,
1311,
29889,
572,
29918,
29939,
5182,
29879,
876,
30004,
13,
4706,
1029,
29887,
29918,
276,
1328,
29918,
16175,
259,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
17469,
29918,
12676,
29898,
1311,
29889,
572,
29918,
276,
2935,
876,
30004,
13,
30004,
13,
4706,
396,
6991,
3034,
583,
363,
6694,
30004,
13,
4706,
6694,
29918,
2083,
3034,
583,
353,
518,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
29939,
5975,
29918,
14968,
29918,
485,
29887,
613,
1029,
29887,
29918,
29939,
5975,
29918,
14968,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
29939,
5975,
29918,
5182,
29918,
485,
29887,
613,
1029,
29887,
29918,
29939,
5975,
29918,
5182,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
485,
29887,
29918,
276,
1328,
29918,
16175,
613,
1029,
29887,
29918,
276,
1328,
29918,
16175,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
6758,
613,
1583,
29889,
6758,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
6758,
29918,
12483,
482,
613,
1583,
29889,
6758,
29918,
13529,
292,
29918,
485,
29887,
29889,
12483,
482,
29898,
1311,
29889,
6758,
8243,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
14968,
29914,
21891,
29918,
10492,
613,
1583,
29889,
21891,
29918,
10492,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
29882,
391,
13342,
703,
14968,
29914,
4181,
613,
1583,
29889,
4181,
8443,
13,
4706,
4514,
30004,
13,
4706,
6694,
29918,
2083,
3034,
583,
29918,
1050,
3192,
353,
15886,
29889,
7727,
29889,
14634,
29898,
26495,
29918,
2083,
3034,
583,
8443,
13,
30004,
13,
4706,
396,
16738,
4475,
19138,
583,
30004,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
703,
20944,
29908,
1125,
30004,
13,
9651,
1583,
29889,
485,
29887,
29918,
276,
1328,
29918,
546,
29918,
11802,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
485,
29887,
29918,
276,
1328,
29918,
546,
29918,
11802,
1159,
30004,
13,
9651,
1583,
29889,
3317,
29918,
276,
1328,
29918,
546,
29918,
11802,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
3317,
29918,
276,
1328,
29918,
546,
29918,
11802,
1159,
30004,
13,
9651,
1583,
29889,
485,
29887,
29918,
13529,
267,
29918,
546,
29918,
11802,
29871,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
485,
29887,
29918,
13529,
267,
29918,
546,
29918,
11802,
1159,
30004,
13,
9651,
1583,
29889,
1949,
29918,
29887,
1280,
29918,
1456,
287,
1678,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
29887,
1280,
29918,
1456,
287,
1159,
30004,
13,
9651,
1583,
29889,
13529,
267,
1669,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
13529,
267,
29918,
1456,
287,
1159,
30004,
13,
9651,
1583,
29889,
7827,
29918,
276,
1328,
29918,
276,
1456,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
276,
1328,
29918,
262,
29918,
276,
1456,
29918,
14834,
1159,
30004,
13,
9651,
1583,
29889,
7387,
29918,
8172,
418,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
7387,
29918,
8172,
1159,
30004,
13,
9651,
1583,
29889,
7387,
29918,
7979,
7584,
418,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
7387,
29918,
7979,
7584,
1159,
30004,
13,
30004,
13,
4706,
5177,
29918,
2083,
3034,
583,
353,
518,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
485,
29887,
29918,
276,
1328,
29918,
546,
29918,
11802,
613,
1583,
29889,
485,
29887,
29918,
276,
1328,
29918,
546,
29918,
11802,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
3317,
29918,
276,
1328,
29918,
546,
29918,
11802,
613,
1583,
29889,
3317,
29918,
276,
1328,
29918,
546,
29918,
11802,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
1949,
29918,
29887,
1280,
29918,
1456,
287,
613,
1583,
29889,
1949,
29918,
29887,
1280,
29918,
1456,
287,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
13529,
267,
613,
1583,
29889,
13529,
267,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
485,
29887,
29918,
13529,
267,
29918,
546,
29918,
11802,
613,
1583,
29889,
485,
29887,
29918,
13529,
267,
29918,
546,
29918,
11802,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
20944,
29914,
276,
1328,
29918,
262,
29918,
276,
1456,
29918,
14834,
613,
1583,
29889,
7827,
29918,
276,
1328,
29918,
276,
1456,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
7387,
29914,
1949,
29918,
7387,
29918,
8172,
613,
1583,
29889,
7387,
29918,
8172,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
7387,
29914,
1949,
29918,
7387,
29918,
7979,
7584,
613,
1583,
29889,
7387,
29918,
7979,
7584,
511,
30004,
13,
9651,
396,
13264,
29889,
7727,
29889,
3027,
703,
29879,
24546,
613,
1583,
29889,
572,
29918,
29879,
24546,
29892,
4236,
29918,
4905,
29879,
29922,
29896,
29900,
29897,
396,
910,
871,
1736,
411,
472,
1306,
363,
777,
2769,
30004,
13,
4706,
4514,
30004,
13,
4706,
5177,
29918,
2083,
3034,
583,
29918,
1050,
3192,
353,
15886,
29889,
7727,
29889,
14634,
29898,
20944,
29918,
2083,
3034,
583,
8443,
13,
30004,
13,
4706,
396,
16738,
4475,
19138,
583,
30004,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
703,
24219,
362,
29908,
1125,
30004,
13,
9651,
1583,
29889,
14513,
29918,
276,
2935,
418,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
7827,
29918,
276,
1328,
1159,
30004,
13,
9651,
1583,
29889,
14513,
29918,
5080,
29918,
10492,
268,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
5080,
29918,
10492,
1159,
30004,
13,
9651,
1583,
29889,
14513,
29918,
1949,
29918,
276,
2935,
29871,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
276,
2935,
1159,
30004,
13,
9651,
1583,
29889,
14513,
29918,
3317,
29918,
276,
1328,
259,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
3317,
29918,
276,
1328,
1159,
30004,
13,
9651,
1583,
29889,
14513,
29918,
1949,
29918,
1022,
275,
2631,
353,
15886,
29889,
16174,
29898,
29900,
29889,
29900,
29892,
7945,
519,
29922,
8824,
29892,
1024,
543,
1949,
29918,
1022,
275,
2631,
1159,
30004,
13,
9651,
1583,
29889,
14513,
29918,
7387,
418,
353,
15886,
29889,
16174,
29898,
9302,
29889,
3298,
359,
29898,
1311,
29889,
1949,
29918,
7387,
511,
7945,
519,
29922,
8824,
29892,
1024,
543,
7387,
1159,
30004,
13,
30004,
13,
30004,
13,
4706,
17983,
29918,
2083,
3034,
583,
353,
518,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
24219,
362,
29914,
7827,
29918,
276,
1328,
613,
1583,
29889,
14513,
29918,
276,
2935,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
24219,
362,
29914,
5080,
29918,
10492,
613,
1583,
29889,
14513,
29918,
5080,
29918,
10492,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
24219,
362,
29914,
1949,
29918,
276,
2935,
613,
1583,
29889,
14513,
29918,
1949,
29918,
276,
2935,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
24219,
362,
29914,
3317,
29918,
276,
1328,
613,
1583,
29889,
14513,
29918,
3317,
29918,
276,
1328,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
19529,
279,
703,
24219,
362,
29914,
1949,
29918,
1022,
275,
2631,
613,
1583,
29889,
14513,
29918,
1949,
29918,
1022,
275,
2631,
511,
30004,
13,
9651,
15886,
29889,
7727,
29889,
29882,
391,
13342,
703,
24219,
362,
29914,
7387,
613,
1583,
29889,
14513,
29918,
7387,
8443,
13,
4706,
4514,
30004,
13,
30004,
13,
4706,
396,
382,
4387,
362,
6991,
3034,
583,
363,
323,
6073,
28397,
30004,
13,
4706,
1583,
29889,
14513,
29918,
7727,
29918,
459,
353,
15886,
29889,
7727,
29889,
14634,
29898,
24219,
362,
29918,
2083,
3034,
583,
8443,
13,
30004,
13,
4706,
396,
26101,
19138,
583,
363,
323,
6073,
28397,
30004,
13,
4706,
1583,
29889,
14968,
29918,
7727,
29918,
459,
353,
15886,
29889,
7727,
29889,
14634,
4197,
26495,
29918,
2083,
3034,
583,
29918,
1050,
3192,
11167,
13,
462,
462,
462,
29871,
5177,
29918,
2083,
3034,
583,
29918,
1050,
3192,
2314,
30004,
13,
30004,
13,
4706,
7945,
29918,
7727,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
4905,
29918,
3972,
29892,
376,
2083,
3034,
583,
27508,
718,
29871,
1583,
29889,
7529,
29889,
11802,
8443,
13,
4706,
1583,
29889,
14968,
29918,
7727,
29918,
13236,
353,
15886,
29889,
7727,
29889,
2283,
10507,
29898,
14968,
29918,
7727,
29918,
3972,
29892,
27937,
29889,
4262,
8443,
13,
30004,
13,
30004,
13,
2
] |
obs_movieconverter.py | zackees/productivity_cmds | 0 | 90120 | <filename>obs_movieconverter.py<gh_stars>0
""" Converts obs movies to a format usable by imovie """
import os
import sys
from shutil import copyfile
files = sorted([f for f in os.listdir('.') if '.mp4' in f and '2020' in f])
out_files = ['new_' + f + '.mov' for f in files]
rtn_codes = []
for count, f in enumerate(files):
input = f
out = out_files[count]
cmd = 'ffmpeg -i ' + input + ' -c:a aac -c:v libx264 -crf 20 -preset fast -f mov ' + out
#cmd = 'handbrakecli -i ' + input + ' -o ' + out + ' -e x264 -q 20 -B 160 --aencoder mp3'
print(cmd)
rtn = os.system(cmd)
rtn = 0
rtn_codes.append(rtn)
any_failed = False
for count, rtn in enumerate(rtn_codes):
if rtn != 0:
print('Exited because of error code ' + str(rtn) + ' in file ' + files[count])
if any_failed:
print('One or more files failed, aborting file replacement')
sys.exit(0)
for count, f in enumerate(files):
copyfile(out_files[count], f)
#os.system('handbrakecli -i 2020-11-24_18-12-06.mp4 -o movie.mp4 -e x264 -q 20 -B 160') | [
1,
529,
9507,
29958,
26290,
29918,
27362,
535,
13549,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
1281,
369,
1372,
20881,
2351,
583,
304,
263,
3402,
502,
519,
491,
527,
5672,
9995,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
3166,
528,
4422,
1053,
3509,
1445,
13,
13,
5325,
353,
12705,
4197,
29888,
363,
285,
297,
2897,
29889,
1761,
3972,
12839,
1495,
565,
15300,
1526,
29946,
29915,
297,
285,
322,
525,
29906,
29900,
29906,
29900,
29915,
297,
285,
2314,
13,
449,
29918,
5325,
353,
6024,
1482,
29918,
29915,
718,
285,
718,
15300,
13529,
29915,
363,
285,
297,
2066,
29962,
13,
2273,
29876,
29918,
18137,
353,
5159,
13,
13,
1454,
2302,
29892,
285,
297,
26985,
29898,
5325,
1125,
13,
29871,
1881,
353,
285,
13,
29871,
714,
353,
714,
29918,
5325,
29961,
2798,
29962,
13,
29871,
9920,
353,
525,
600,
20856,
448,
29875,
525,
718,
1881,
718,
525,
448,
29883,
29901,
29874,
263,
562,
448,
29883,
29901,
29894,
4303,
29916,
29906,
29953,
29946,
448,
7283,
29888,
29871,
29906,
29900,
448,
4569,
300,
5172,
448,
29888,
2351,
525,
718,
714,
13,
29871,
396,
9006,
353,
525,
3179,
2634,
446,
11303,
448,
29875,
525,
718,
1881,
718,
525,
448,
29877,
525,
718,
714,
718,
525,
448,
29872,
921,
29906,
29953,
29946,
448,
29939,
29871,
29906,
29900,
448,
29933,
29871,
29896,
29953,
29900,
1192,
29874,
3977,
6119,
22326,
29941,
29915,
13,
29871,
1596,
29898,
9006,
29897,
13,
29871,
364,
6277,
353,
2897,
29889,
5205,
29898,
9006,
29897,
13,
29871,
364,
6277,
353,
29871,
29900,
13,
29871,
364,
6277,
29918,
18137,
29889,
4397,
29898,
2273,
29876,
29897,
13,
13,
1384,
29918,
26061,
353,
7700,
13,
13,
1454,
2302,
29892,
364,
6277,
297,
26985,
29898,
2273,
29876,
29918,
18137,
1125,
13,
29871,
565,
364,
6277,
2804,
29871,
29900,
29901,
13,
259,
12,
2158,
877,
1252,
1573,
1363,
310,
1059,
775,
525,
718,
851,
29898,
2273,
29876,
29897,
718,
525,
297,
934,
525,
718,
2066,
29961,
2798,
2314,
13,
259,
12,
13,
361,
738,
29918,
26061,
29901,
13,
29871,
1596,
877,
6716,
470,
901,
2066,
5229,
29892,
27450,
292,
934,
16920,
1495,
13,
29871,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
1454,
2302,
29892,
285,
297,
26985,
29898,
5325,
1125,
13,
29871,
3509,
1445,
29898,
449,
29918,
5325,
29961,
2798,
1402,
285,
29897,
13,
13,
13,
29937,
359,
29889,
5205,
877,
3179,
2634,
446,
11303,
448,
29875,
29871,
29906,
29900,
29906,
29900,
29899,
29896,
29896,
29899,
29906,
29946,
29918,
29896,
29947,
29899,
29896,
29906,
29899,
29900,
29953,
29889,
1526,
29946,
448,
29877,
14064,
29889,
1526,
29946,
448,
29872,
921,
29906,
29953,
29946,
448,
29939,
29871,
29906,
29900,
448,
29933,
29871,
29896,
29953,
29900,
1495,
2
] |
english/data_processing/lessons/code/graphplot.py | hrutkabence/tutorials | 0 | 1606876 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Draw time series from csv files or lists
Data series come from the columns of the csv files multi columns can be used from
the same file. One column for x values (it can be numerical or date/time data) and
more columns for y1, y2, .., yn. Alternatively lists can be given with the values.
As many charts will be drawn as many y columns given.
If more input files are given multiple lines will be drawn in the same subfigure.
It is poissible to define different number of y columns for the input csv files.
The input csv files may have different number of rows and columns. column indeces are
zero based.
The data series are given by a list with maximum 6 elementst
1st the name of the csv file separated by ';' and
list of column ordinal numbers first is for x, the followings are for y values
(0 base index), the same column can be repeated
x column can be numerical or date/time, y columns are numerical
or complex list [ x1, [y11, y12], x2, [y21 y22]]
2nd list of multipliers for the columns, default 1 for each column
3rd list of offsets for the columns, default 0 for each column
4th list of simple format specifiers for y values, default is matplotlib defaults
5th list of legend labels for y values, default filename:column
Here is a simple example with three input files and two subplots
first.csv:
1;0.34;2.56
2;0.58;1.43
3;1.02;1.1
second.csv:
A;1.2;0.86;0.55;6.54
B;1.9;1.7;0.72;5.78
C;2.4;1.45;0.4;1.34
D;2.8;0.86;.88;5.12
third.csv
1;0.75;1.8
2;2.1;2.5
3;1.8;3.1
titles = ["line1", "line2", "points"]
units = ["m", "mm", "degree"]
data_series = [[['first.csv', [0, 1, 2]], [1, 1, 0.56], [0, 0, 0], ['g--', 'r'], ['l1', 'l2']],
[['second.csv', [1, 3, 2]], [1, 1, 1], [0, 0, 0], ['', ''], ['b1', 'b2']],
[['third.csv', [0, 2]], [1, 0.75], [0, -0.3], ['b+']]]
g = GraphPlot(titles, units, data_series)
g.draw()
"""
import csv
import os.path
import re
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
class GraphPlot:
""" class to plot a graph
:param titles: list of titles for subplots
:param units: units for aces
:param data_series: list of list of titles, units and for each data file, filename column numbers, scales, offsets, formats, labels; scales, offset, formats and labels are optional
"""
SEPARATOR = ";" # update for your input
def __init__(self, titles, units, data_series):
""" initialize instance """
self.titles = titles
self.units = units
self.x = []
self.y = []
self.fmts = []
self.labels = []
for serie in data_series:
scales = [1] * len(serie[0][1]) # default scales
if len(serie) > 1:
scales = serie[1]
offsets = [0] * len(serie[0][1]) # default offsets
if len(serie) > 2:
offsets = serie[2]
if isinstance(serie[0][0], str):
act_x, act_y = self.load(serie[0][0], serie[0][1], scales, offsets)
else:
act_x = serie[0][0]
act_y = serie[0][1]
self.x.append(act_x)
self.y.append(act_y)
fmt = [''] * len(serie[0][1]) # default formats
if len(serie) > 3:
fmt = serie[3]
if isinstance(serie[0][0], str):
label = ["{}:{}".format(serie[0][0], str(col))
for col in serie[0][1][1:]]
else:
label = [str(col+1) for col in range(len(serie[1][1:]))]
if len(serie) > 4:
label = serie[4]
self.labels.append(label)
self.fmts.append(fmt)
try:
self.main_title, _ = os.path.splitext(os.path.basename(data_series[0][0]))
except Exception:
self.main_title, _ = os.path.splitext(os.path.basename(__file__))
def draw(self):
""" draw multi graph """
rows = max([len(yi) for yi in self.y])
fig = plt.figure()
fig.canvas.set_window_title(self.main_title)
for ind in range(rows):
ax = plt.subplot(rows, 1, ind+1)
for i in range(len(self.x)):
if len(self.y[i]) > ind:
if isinstance(self.x[i][0], datetime):
plt.plot_date(self.x[i], self.y[i][ind], self.fmts[i][ind],
label=self.labels[i][ind])
else:
plt.plot(self.x[i], self.y[i][ind], self.fmts[i][ind],
label=self.labels[i][ind])
plt.xticks(rotation=45)
plt.xlabel(self.units[0])
plt.ylabel(self.units[ind+1])
plt.grid()
plt.legend()
ax.set_title(self.titles[ind])
fig.tight_layout()
plt.show()
fig.savefig(self.main_title + '.png')
@staticmethod
def load(fname, cols, scales, offsets):
""" load input data
:param fname: name of csv input file
:param cols: ordinal column numbers to use
:param scales: multipliers for columns
:param offsets: offsets for columns
:returns tuple x and y values (multiple y series as list)
"""
data = []
with open(fname, newline='') as f:
reader = csv.reader(f, delimiter=GraphPlot.SEPARATOR)
for row in reader:
data.append(row)
if re.match("[0-9]{4}-[0-9]{2}-[0-9]{2}", data[0][cols[0]]):
x = [datetime.strptime(row[cols[0]], '%Y-%m-%d %H:%M:%S.%f')
for row in data]
else:
x = [float(row[cols[0]]) * scales[0] + offsets[0] for row in data]
y = []
for i in range(1, len(cols)):
y.append([float(row[cols[i]]) * scales[i] + offsets[i] for row in data])
return (x, y)
if __name__ == "__main__":
from sys import argv
from math import (sin, cos, pi)
DEMO_ID = 1
if len(argv) > 1:
DEMO_ID = int(argv[1])
if DEMO_ID == 1:
TITLES = ["line1", "line2", "points"]
UNITS = ["m", "mm", "degree", "m"]
X1 = [1, 2, 3, 4, 5, 6]
Y11 = [0.34, 0.58, 1.02, 1.21, 1.52, 1.61]
Y12 = [2.56, 1.43, 1.1, 0.8, 0.48, 0.67]
X2 = [1.2, 1.9, 2.4, 2.8, 3.5, 5.8]
Y21 = [0.86, 1.7, 1.45, 0.86, 1.2, 3.0]
Y22 = [0.55, 0.72, 0.4, 0.88, 0.99, 2.0]
# x3 == x1
Y31 = [1.8, 2.5, 3.1, 2.6, 2.3, 2.8]
DATA_SERIES = [[[X1, [Y11, Y12, Y12]],
[1, 1, 0.56, 1], [0, 0, 0, 1],
['g--', 'r', 'ro'], ['l1', 'l2', 'l2']],
[[X2, [Y22, Y21, Y22]],
[1, 1, 1, 0.75], [0, 0, 0, -0.5],
['', '', 'yx'], ['b1', 'b2', 'b1']],
[[X1, [Y31]], [1, 0.75], [0, -0.3], ['b+']]]
G = GraphPlot(TITLES, UNITS, DATA_SERIES)
G.draw()
elif DEMO_ID == 2:
TITLES = ["trigonometry"]
UNITS = ["fok", "-", "-"]
DATA_SERIES = [[['test/sin_cos.csv', [0, 2]], [1, 1], [0, 0],
[''], ['sin']],
[['test/sin_cos.csv', [0, 3]], [1, 1], [0, 0],
[''], ['cos']]]
G = GraphPlot(TITLES, UNITS, DATA_SERIES)
G.draw()
elif DEMO_ID == 3:
TITLES = ["trigonometry"]
UNITS = ["fok", "-", "-"]
X = list(range(0, 370, 10))
Y1 = [sin(xi / 180 * pi) for xi in range(0, 370, 10)]
Y2 = [cos(xi / 180 * pi) for xi in range(0, 370, 10)]
DATA_SERIES = [[[X, [Y1]], [0, 2], [1, 1], [0, 0],
[''], ['sin']],
[[X, [Y2]], [0, 3], [1, 1], [0, 0],
[''], ['cos']]]
G = GraphPlot(TITLES, UNITS, DATA_SERIES)
G.draw()
| [
1,
396,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
1678,
18492,
931,
3652,
515,
11799,
2066,
470,
8857,
13,
13,
1678,
3630,
3652,
2041,
515,
278,
4341,
310,
278,
11799,
2066,
2473,
4341,
508,
367,
1304,
515,
13,
1678,
278,
1021,
934,
29889,
3118,
1897,
363,
921,
1819,
313,
277,
508,
367,
16259,
470,
2635,
29914,
2230,
848,
29897,
322,
13,
1678,
901,
4341,
363,
343,
29896,
29892,
343,
29906,
29892,
6317,
29892,
343,
29876,
29889,
20360,
8857,
508,
367,
2183,
411,
278,
1819,
29889,
13,
1678,
1094,
1784,
24469,
674,
367,
12061,
408,
1784,
343,
4341,
2183,
29889,
13,
1678,
960,
901,
1881,
2066,
526,
2183,
2999,
3454,
674,
367,
12061,
297,
278,
1021,
1014,
4532,
29889,
13,
1678,
739,
338,
772,
790,
1821,
304,
4529,
1422,
1353,
310,
343,
4341,
363,
278,
1881,
11799,
2066,
29889,
13,
1678,
450,
1881,
11799,
2066,
1122,
505,
1422,
1353,
310,
4206,
322,
4341,
29889,
1897,
5704,
778,
526,
13,
1678,
5225,
2729,
29889,
13,
1678,
450,
848,
3652,
526,
2183,
491,
263,
1051,
411,
7472,
29871,
29953,
1543,
303,
13,
268,
29896,
303,
278,
1024,
310,
278,
11799,
934,
13055,
491,
21921,
29915,
322,
13,
4706,
1051,
310,
1897,
4356,
979,
3694,
937,
338,
363,
921,
29892,
278,
1101,
886,
526,
363,
343,
1819,
13,
4706,
313,
29900,
2967,
2380,
511,
278,
1021,
1897,
508,
367,
10324,
13,
4706,
921,
1897,
508,
367,
16259,
470,
2635,
29914,
2230,
29892,
343,
4341,
526,
16259,
13,
4706,
470,
4280,
1051,
518,
921,
29896,
29892,
518,
29891,
29896,
29896,
29892,
343,
29896,
29906,
1402,
921,
29906,
29892,
518,
29891,
29906,
29896,
343,
29906,
29906,
5262,
13,
268,
29906,
299,
1051,
310,
6674,
27801,
363,
278,
4341,
29892,
2322,
29871,
29896,
363,
1269,
1897,
13,
268,
29941,
5499,
1051,
310,
1283,
7224,
363,
278,
4341,
29892,
2322,
29871,
29900,
363,
1269,
1897,
13,
268,
29946,
386,
1051,
310,
2560,
3402,
1580,
14903,
363,
343,
1819,
29892,
2322,
338,
22889,
21274,
13,
268,
29945,
386,
1051,
310,
15983,
11073,
363,
343,
1819,
29892,
2322,
10422,
29901,
4914,
13,
13,
1678,
2266,
338,
263,
2560,
1342,
411,
2211,
1881,
2066,
322,
1023,
1014,
26762,
13,
13,
1678,
937,
29889,
7638,
29901,
13,
268,
29896,
29936,
29900,
29889,
29941,
29946,
29936,
29906,
29889,
29945,
29953,
13,
268,
29906,
29936,
29900,
29889,
29945,
29947,
29936,
29896,
29889,
29946,
29941,
13,
268,
29941,
29936,
29896,
29889,
29900,
29906,
29936,
29896,
29889,
29896,
13,
13,
1678,
1473,
29889,
7638,
29901,
13,
1678,
319,
29936,
29896,
29889,
29906,
29936,
29900,
29889,
29947,
29953,
29936,
29900,
29889,
29945,
29945,
29936,
29953,
29889,
29945,
29946,
13,
1678,
350,
29936,
29896,
29889,
29929,
29936,
29896,
29889,
29955,
29936,
29900,
29889,
29955,
29906,
29936,
29945,
29889,
29955,
29947,
13,
1678,
315,
29936,
29906,
29889,
29946,
29936,
29896,
29889,
29946,
29945,
29936,
29900,
29889,
29946,
29936,
29896,
29889,
29941,
29946,
13,
1678,
360,
29936,
29906,
29889,
29947,
29936,
29900,
29889,
29947,
29953,
29936,
29889,
29947,
29947,
29936,
29945,
29889,
29896,
29906,
13,
13,
1678,
4654,
29889,
7638,
13,
268,
29896,
29936,
29900,
29889,
29955,
29945,
29936,
29896,
29889,
29947,
13,
268,
29906,
29936,
29906,
29889,
29896,
29936,
29906,
29889,
29945,
13,
268,
29941,
29936,
29896,
29889,
29947,
29936,
29941,
29889,
29896,
13,
13,
1678,
17735,
353,
6796,
1220,
29896,
613,
376,
1220,
29906,
613,
376,
9748,
3108,
13,
1678,
10340,
353,
6796,
29885,
613,
376,
4317,
613,
376,
12163,
929,
3108,
13,
1678,
848,
29918,
13757,
353,
5519,
1839,
4102,
29889,
7638,
742,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
20526,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29945,
29953,
1402,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
6024,
29887,
489,
742,
525,
29878,
7464,
6024,
29880,
29896,
742,
525,
29880,
29906,
2033,
1402,
13,
462,
259,
518,
1839,
7496,
29889,
7638,
742,
518,
29896,
29892,
29871,
29941,
29892,
29871,
29906,
20526,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
6024,
742,
6629,
1402,
6024,
29890,
29896,
742,
525,
29890,
29906,
2033,
1402,
13,
462,
259,
518,
1839,
22585,
29889,
7638,
742,
518,
29900,
29892,
29871,
29906,
20526,
518,
29896,
29892,
29871,
29900,
29889,
29955,
29945,
1402,
518,
29900,
29892,
448,
29900,
29889,
29941,
1402,
6024,
29890,
29974,
2033,
5262,
13,
1678,
330,
353,
12367,
20867,
29898,
23545,
793,
29892,
10340,
29892,
848,
29918,
13757,
29897,
13,
1678,
330,
29889,
4012,
580,
13,
13,
15945,
29908,
13,
5215,
11799,
13,
5215,
2897,
29889,
2084,
13,
5215,
337,
13,
3166,
12865,
1053,
12865,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
13,
1990,
12367,
20867,
29901,
13,
1678,
9995,
770,
304,
6492,
263,
3983,
13,
13,
4706,
584,
3207,
17735,
29901,
1051,
310,
17735,
363,
1014,
26762,
13,
4706,
584,
3207,
10340,
29901,
10340,
363,
263,
778,
13,
4706,
584,
3207,
848,
29918,
13757,
29901,
1051,
310,
1051,
310,
17735,
29892,
10340,
322,
363,
1269,
848,
934,
29892,
10422,
29871,
1897,
3694,
29892,
23431,
29892,
1283,
7224,
29892,
21971,
29892,
11073,
29936,
23431,
29892,
9210,
29892,
21971,
322,
11073,
526,
13136,
13,
1678,
9995,
13,
1678,
3725,
16320,
1299,
1955,
353,
12159,
29908,
396,
2767,
363,
596,
1881,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
17735,
29892,
10340,
29892,
848,
29918,
13757,
1125,
13,
4706,
9995,
11905,
2777,
9995,
13,
4706,
1583,
29889,
23545,
793,
353,
17735,
13,
4706,
1583,
29889,
348,
1169,
353,
10340,
13,
4706,
1583,
29889,
29916,
353,
5159,
13,
4706,
1583,
29889,
29891,
353,
5159,
13,
4706,
1583,
29889,
24826,
1372,
353,
5159,
13,
4706,
1583,
29889,
21134,
353,
5159,
13,
4706,
363,
7080,
297,
848,
29918,
13757,
29901,
13,
9651,
23431,
353,
518,
29896,
29962,
334,
7431,
29898,
15596,
29961,
29900,
3816,
29896,
2314,
1678,
396,
2322,
23431,
13,
9651,
565,
7431,
29898,
15596,
29897,
1405,
29871,
29896,
29901,
13,
18884,
23431,
353,
7080,
29961,
29896,
29962,
13,
9651,
1283,
7224,
353,
518,
29900,
29962,
334,
7431,
29898,
15596,
29961,
29900,
3816,
29896,
2314,
259,
396,
2322,
1283,
7224,
13,
9651,
565,
7431,
29898,
15596,
29897,
1405,
29871,
29906,
29901,
13,
18884,
1283,
7224,
353,
7080,
29961,
29906,
29962,
13,
9651,
565,
338,
8758,
29898,
15596,
29961,
29900,
3816,
29900,
1402,
851,
1125,
13,
18884,
1044,
29918,
29916,
29892,
1044,
29918,
29891,
353,
1583,
29889,
1359,
29898,
15596,
29961,
29900,
3816,
29900,
1402,
7080,
29961,
29900,
3816,
29896,
1402,
23431,
29892,
1283,
7224,
29897,
13,
9651,
1683,
29901,
13,
18884,
1044,
29918,
29916,
353,
7080,
29961,
29900,
3816,
29900,
29962,
13,
18884,
1044,
29918,
29891,
353,
7080,
29961,
29900,
3816,
29896,
29962,
13,
9651,
1583,
29889,
29916,
29889,
4397,
29898,
627,
29918,
29916,
29897,
13,
9651,
1583,
29889,
29891,
29889,
4397,
29898,
627,
29918,
29891,
29897,
13,
9651,
19200,
353,
6024,
2033,
334,
7431,
29898,
15596,
29961,
29900,
3816,
29896,
2314,
418,
396,
2322,
21971,
13,
9651,
565,
7431,
29898,
15596,
29897,
1405,
29871,
29941,
29901,
13,
18884,
19200,
353,
7080,
29961,
29941,
29962,
13,
9651,
565,
338,
8758,
29898,
15596,
29961,
29900,
3816,
29900,
1402,
851,
1125,
13,
18884,
3858,
353,
6796,
29912,
6177,
8875,
1642,
4830,
29898,
15596,
29961,
29900,
3816,
29900,
1402,
851,
29898,
1054,
876,
13,
462,
308,
363,
784,
297,
7080,
29961,
29900,
3816,
29896,
3816,
29896,
29901,
5262,
13,
9651,
1683,
29901,
13,
18884,
3858,
353,
518,
710,
29898,
1054,
29974,
29896,
29897,
363,
784,
297,
3464,
29898,
2435,
29898,
15596,
29961,
29896,
3816,
29896,
29901,
12622,
29962,
13,
9651,
565,
7431,
29898,
15596,
29897,
1405,
29871,
29946,
29901,
13,
18884,
3858,
353,
7080,
29961,
29946,
29962,
13,
9651,
1583,
29889,
21134,
29889,
4397,
29898,
1643,
29897,
13,
9651,
1583,
29889,
24826,
1372,
29889,
4397,
29898,
23479,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3396,
29918,
3257,
29892,
903,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
359,
29889,
2084,
29889,
6500,
3871,
29898,
1272,
29918,
13757,
29961,
29900,
3816,
29900,
12622,
13,
4706,
5174,
8960,
29901,
13,
9651,
1583,
29889,
3396,
29918,
3257,
29892,
903,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
359,
29889,
2084,
29889,
6500,
3871,
22168,
1445,
1649,
876,
13,
13,
1678,
822,
4216,
29898,
1311,
1125,
13,
4706,
9995,
4216,
2473,
3983,
9995,
13,
4706,
4206,
353,
4236,
4197,
2435,
29898,
25675,
29897,
363,
343,
29875,
297,
1583,
29889,
29891,
2314,
13,
4706,
2537,
353,
14770,
29889,
4532,
580,
13,
4706,
2537,
29889,
15257,
29889,
842,
29918,
7165,
29918,
3257,
29898,
1311,
29889,
3396,
29918,
3257,
29897,
13,
4706,
363,
1399,
297,
3464,
29898,
5727,
1125,
13,
9651,
4853,
353,
14770,
29889,
1491,
5317,
29898,
5727,
29892,
29871,
29896,
29892,
1399,
29974,
29896,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
2435,
29898,
1311,
29889,
29916,
22164,
13,
18884,
565,
7431,
29898,
1311,
29889,
29891,
29961,
29875,
2314,
1405,
1399,
29901,
13,
462,
1678,
565,
338,
8758,
29898,
1311,
29889,
29916,
29961,
29875,
3816,
29900,
1402,
12865,
1125,
13,
462,
4706,
14770,
29889,
5317,
29918,
1256,
29898,
1311,
29889,
29916,
29961,
29875,
1402,
1583,
29889,
29891,
29961,
29875,
3816,
513,
1402,
1583,
29889,
24826,
1372,
29961,
29875,
3816,
513,
1402,
13,
462,
462,
418,
3858,
29922,
1311,
29889,
21134,
29961,
29875,
3816,
513,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
14770,
29889,
5317,
29898,
1311,
29889,
29916,
29961,
29875,
1402,
1583,
29889,
29891,
29961,
29875,
3816,
513,
1402,
1583,
29889,
24826,
1372,
29961,
29875,
3816,
513,
1402,
13,
462,
462,
3858,
29922,
1311,
29889,
21134,
29961,
29875,
3816,
513,
2314,
13,
9651,
14770,
29889,
486,
7358,
29898,
5450,
362,
29922,
29946,
29945,
29897,
13,
9651,
14770,
29889,
29916,
1643,
29898,
1311,
29889,
348,
1169,
29961,
29900,
2314,
13,
9651,
14770,
29889,
29891,
1643,
29898,
1311,
29889,
348,
1169,
29961,
513,
29974,
29896,
2314,
13,
9651,
14770,
29889,
7720,
580,
13,
9651,
14770,
29889,
26172,
580,
13,
9651,
4853,
29889,
842,
29918,
3257,
29898,
1311,
29889,
23545,
793,
29961,
513,
2314,
13,
4706,
2537,
29889,
29873,
523,
29918,
2680,
580,
13,
4706,
14770,
29889,
4294,
580,
13,
4706,
2537,
29889,
7620,
1003,
29898,
1311,
29889,
3396,
29918,
3257,
718,
15300,
2732,
1495,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2254,
29898,
29888,
978,
29892,
28730,
29892,
23431,
29892,
1283,
7224,
1125,
13,
4706,
9995,
2254,
1881,
848,
13,
13,
9651,
584,
3207,
285,
978,
29901,
1024,
310,
11799,
1881,
934,
13,
9651,
584,
3207,
28730,
29901,
4356,
979,
1897,
3694,
304,
671,
13,
9651,
584,
3207,
23431,
29901,
6674,
27801,
363,
4341,
13,
9651,
584,
3207,
1283,
7224,
29901,
1283,
7224,
363,
4341,
13,
9651,
584,
18280,
18761,
921,
322,
343,
1819,
313,
20787,
343,
3652,
408,
1051,
29897,
13,
4706,
9995,
13,
4706,
848,
353,
5159,
13,
4706,
411,
1722,
29898,
29888,
978,
29892,
25899,
2433,
1495,
408,
285,
29901,
13,
9651,
9591,
353,
11799,
29889,
16950,
29898,
29888,
29892,
28552,
29922,
9527,
20867,
29889,
1660,
16320,
1299,
1955,
29897,
13,
9651,
363,
1948,
297,
9591,
29901,
13,
18884,
848,
29889,
4397,
29898,
798,
29897,
13,
4706,
565,
337,
29889,
4352,
703,
29961,
29900,
29899,
29929,
3199,
29946,
7402,
29961,
29900,
29899,
29929,
3199,
29906,
7402,
29961,
29900,
29899,
29929,
3199,
29906,
17671,
848,
29961,
29900,
3816,
22724,
29961,
29900,
5262,
1125,
13,
9651,
921,
353,
518,
12673,
29889,
710,
415,
603,
29898,
798,
29961,
22724,
29961,
29900,
20526,
14210,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
29889,
29995,
29888,
1495,
13,
462,
363,
1948,
297,
848,
29962,
13,
4706,
1683,
29901,
13,
9651,
921,
353,
518,
7411,
29898,
798,
29961,
22724,
29961,
29900,
24960,
334,
23431,
29961,
29900,
29962,
718,
1283,
7224,
29961,
29900,
29962,
363,
1948,
297,
848,
29962,
13,
4706,
343,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
22724,
22164,
13,
9651,
343,
29889,
4397,
4197,
7411,
29898,
798,
29961,
22724,
29961,
29875,
24960,
334,
23431,
29961,
29875,
29962,
718,
1283,
7224,
29961,
29875,
29962,
363,
1948,
297,
848,
2314,
13,
4706,
736,
313,
29916,
29892,
343,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
515,
10876,
1053,
1852,
29894,
13,
1678,
515,
5844,
1053,
313,
5223,
29892,
6776,
29892,
2930,
29897,
13,
13,
1678,
5012,
6720,
29918,
1367,
353,
29871,
29896,
13,
1678,
565,
7431,
29898,
19218,
29897,
1405,
29871,
29896,
29901,
13,
4706,
5012,
6720,
29918,
1367,
353,
938,
29898,
19218,
29961,
29896,
2314,
13,
1678,
565,
5012,
6720,
29918,
1367,
1275,
29871,
29896,
29901,
13,
4706,
323,
1806,
17101,
353,
6796,
1220,
29896,
613,
376,
1220,
29906,
613,
376,
9748,
3108,
13,
4706,
8291,
1806,
29903,
353,
6796,
29885,
613,
376,
4317,
613,
376,
12163,
929,
613,
376,
29885,
3108,
13,
4706,
1060,
29896,
353,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29962,
13,
4706,
612,
29896,
29896,
353,
518,
29900,
29889,
29941,
29946,
29892,
29871,
29900,
29889,
29945,
29947,
29892,
29871,
29896,
29889,
29900,
29906,
29892,
29871,
29896,
29889,
29906,
29896,
29892,
29871,
29896,
29889,
29945,
29906,
29892,
29871,
29896,
29889,
29953,
29896,
29962,
13,
4706,
612,
29896,
29906,
353,
518,
29906,
29889,
29945,
29953,
29892,
29871,
29896,
29889,
29946,
29941,
29892,
29871,
29896,
29889,
29896,
29892,
29871,
29900,
29889,
29947,
29892,
29871,
29900,
29889,
29946,
29947,
29892,
29871,
29900,
29889,
29953,
29955,
29962,
13,
4706,
1060,
29906,
353,
518,
29896,
29889,
29906,
29892,
29871,
29896,
29889,
29929,
29892,
29871,
29906,
29889,
29946,
29892,
29871,
29906,
29889,
29947,
29892,
29871,
29941,
29889,
29945,
29892,
29871,
29945,
29889,
29947,
29962,
13,
4706,
612,
29906,
29896,
353,
518,
29900,
29889,
29947,
29953,
29892,
29871,
29896,
29889,
29955,
29892,
29871,
29896,
29889,
29946,
29945,
29892,
29871,
29900,
29889,
29947,
29953,
29892,
29871,
29896,
29889,
29906,
29892,
29871,
29941,
29889,
29900,
29962,
13,
4706,
612,
29906,
29906,
353,
518,
29900,
29889,
29945,
29945,
29892,
29871,
29900,
29889,
29955,
29906,
29892,
29871,
29900,
29889,
29946,
29892,
29871,
29900,
29889,
29947,
29947,
29892,
29871,
29900,
29889,
29929,
29929,
29892,
29871,
29906,
29889,
29900,
29962,
13,
4706,
396,
921,
29941,
1275,
921,
29896,
13,
4706,
612,
29941,
29896,
353,
518,
29896,
29889,
29947,
29892,
29871,
29906,
29889,
29945,
29892,
29871,
29941,
29889,
29896,
29892,
29871,
29906,
29889,
29953,
29892,
29871,
29906,
29889,
29941,
29892,
29871,
29906,
29889,
29947,
29962,
13,
4706,
360,
8254,
29918,
6304,
29059,
353,
5519,
29961,
29990,
29896,
29892,
518,
29979,
29896,
29896,
29892,
612,
29896,
29906,
29892,
612,
29896,
29906,
20526,
13,
462,
4706,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29945,
29953,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
462,
4706,
6024,
29887,
489,
742,
525,
29878,
742,
525,
307,
7464,
6024,
29880,
29896,
742,
525,
29880,
29906,
742,
525,
29880,
29906,
2033,
1402,
13,
462,
539,
5519,
29990,
29906,
29892,
518,
29979,
29906,
29906,
29892,
612,
29906,
29896,
29892,
612,
29906,
29906,
20526,
13,
462,
4706,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29955,
29945,
1402,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
448,
29900,
29889,
29945,
1402,
13,
462,
4706,
6024,
742,
15516,
525,
29891,
29916,
7464,
6024,
29890,
29896,
742,
525,
29890,
29906,
742,
525,
29890,
29896,
2033,
1402,
13,
462,
539,
5519,
29990,
29896,
29892,
518,
29979,
29941,
29896,
20526,
518,
29896,
29892,
29871,
29900,
29889,
29955,
29945,
1402,
518,
29900,
29892,
448,
29900,
29889,
29941,
1402,
6024,
29890,
29974,
2033,
5262,
13,
4706,
402,
353,
12367,
20867,
29898,
29911,
1806,
17101,
29892,
8291,
1806,
29903,
29892,
360,
8254,
29918,
6304,
29059,
29897,
13,
4706,
402,
29889,
4012,
580,
13,
1678,
25342,
5012,
6720,
29918,
1367,
1275,
29871,
29906,
29901,
13,
4706,
323,
1806,
17101,
353,
6796,
509,
335,
265,
7843,
3108,
13,
4706,
8291,
1806,
29903,
353,
6796,
29888,
554,
613,
11663,
613,
11663,
3108,
13,
4706,
360,
8254,
29918,
6304,
29059,
353,
5519,
1839,
1688,
29914,
5223,
29918,
3944,
29889,
7638,
742,
518,
29900,
29892,
29871,
29906,
20526,
518,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
518,
4907,
1402,
6024,
5223,
2033,
1402,
13,
462,
539,
518,
1839,
1688,
29914,
5223,
29918,
3944,
29889,
7638,
742,
518,
29900,
29892,
29871,
29941,
20526,
518,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
518,
4907,
1402,
6024,
3944,
2033,
5262,
13,
4706,
402,
353,
12367,
20867,
29898,
29911,
1806,
17101,
29892,
8291,
1806,
29903,
29892,
360,
8254,
29918,
6304,
29059,
29897,
13,
4706,
402,
29889,
4012,
580,
13,
1678,
25342,
5012,
6720,
29918,
1367,
1275,
29871,
29941,
29901,
13,
4706,
323,
1806,
17101,
353,
6796,
509,
335,
265,
7843,
3108,
13,
4706,
8291,
1806,
29903,
353,
6796,
29888,
554,
613,
11663,
613,
11663,
3108,
13,
4706,
1060,
353,
1051,
29898,
3881,
29898,
29900,
29892,
29871,
29941,
29955,
29900,
29892,
29871,
29896,
29900,
876,
13,
4706,
612,
29896,
353,
518,
5223,
29898,
5389,
847,
29871,
29896,
29947,
29900,
334,
2930,
29897,
363,
921,
29875,
297,
3464,
29898,
29900,
29892,
29871,
29941,
29955,
29900,
29892,
29871,
29896,
29900,
4638,
13,
4706,
612,
29906,
353,
518,
3944,
29898,
5389,
847,
29871,
29896,
29947,
29900,
334,
2930,
29897,
363,
921,
29875,
297,
3464,
29898,
29900,
29892,
29871,
29941,
29955,
29900,
29892,
29871,
29896,
29900,
4638,
13,
4706,
360,
8254,
29918,
6304,
29059,
353,
5519,
29961,
29990,
29892,
518,
29979,
29896,
20526,
518,
29900,
29892,
29871,
29906,
1402,
518,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
518,
4907,
1402,
6024,
5223,
2033,
1402,
13,
462,
539,
5519,
29990,
29892,
518,
29979,
29906,
20526,
518,
29900,
29892,
29871,
29941,
1402,
518,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
518,
4907,
1402,
6024,
3944,
2033,
5262,
13,
4706,
402,
353,
12367,
20867,
29898,
29911,
1806,
17101,
29892,
8291,
1806,
29903,
29892,
360,
8254,
29918,
6304,
29059,
29897,
13,
4706,
402,
29889,
4012,
580,
13,
2
] |
65-Spam-filter/main.py | PawelZabinski/ocr-code-challenges-files | 0 | 30962 | # Spam filter
# Take a list of dishes from a menu and add “spam” to them. See https://en.wikipedia.org/wiki/Spam_(Monty_Python).
def main():
try:
dishCount = int(input('Enter number of dishes in menu > '))
dishes = [input(f'Enter Dish No.{i + 1} > ') for i in range(dishCount)]
dishes = [f'{dish} spam' for dish in dishes]
for dish in dishes:
print(dish)
except:
print('Invalid dish count. Please enter a positive integer')
if __name__ == '__main__':
main() | [
1,
396,
1706,
314,
4175,
13,
13,
29937,
11190,
263,
1051,
310,
270,
17006,
515,
263,
6143,
322,
788,
1346,
1028,
314,
30024,
304,
963,
29889,
2823,
2045,
597,
264,
29889,
6011,
29889,
990,
29914,
4594,
29914,
5592,
314,
23538,
24665,
29891,
29918,
11980,
467,
13,
13,
1753,
1667,
7295,
13,
29871,
1018,
29901,
13,
1678,
270,
728,
3981,
353,
938,
29898,
2080,
877,
10399,
1353,
310,
270,
17006,
297,
6143,
1405,
525,
876,
13,
13,
1678,
270,
17006,
353,
518,
2080,
29898,
29888,
29915,
10399,
360,
728,
1939,
29889,
29912,
29875,
718,
29871,
29896,
29913,
1405,
25710,
363,
474,
297,
3464,
29898,
29881,
728,
3981,
4638,
13,
1678,
270,
17006,
353,
518,
29888,
29915,
29912,
29881,
728,
29913,
805,
314,
29915,
363,
270,
728,
297,
270,
17006,
29962,
13,
13,
1678,
363,
270,
728,
297,
270,
17006,
29901,
13,
418,
1596,
29898,
29881,
728,
29897,
13,
29871,
5174,
29901,
13,
1678,
1596,
877,
13919,
270,
728,
2302,
29889,
3529,
3896,
263,
6374,
6043,
1495,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29871,
1667,
580,
2
] |
arpym/tools/forward_selection.py | dpopadic/arpmRes | 6 | 178733 | <filename>arpym/tools/forward_selection.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
def forward_selection(g, n_, k_=None):
"""For details, see here.
Parameters
----------
g : function
n_ : int
k_ : int, optional
Returns
-------
s_star_fwd : list, shape(k_, 1:k_)
"""
if k_ is None:
k_ = n_
# Step 0: Initialize
j = np.arange(1, n_ + 1)
s_star_forward = np.array([], dtype='int')
for k in range(k_):
# Step 1: Determine the best element in j
n_star = np.argmax([g(np.append(s_star_forward, n))
for n in j])
# Step 2: Append the best element in j to the selection and remove it from j
s_star_forward = np.append(s_star_forward, j[n_star])
j = np.delete(j, n_star)
return [s_star_forward[:k] for k in range(1, k_ + 1)]
| [
1,
529,
9507,
29958,
6834,
962,
29914,
8504,
29914,
11333,
29918,
21731,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1753,
6375,
29918,
21731,
29898,
29887,
29892,
302,
3383,
413,
29918,
29922,
8516,
1125,
13,
1678,
9995,
2831,
4902,
29892,
1074,
1244,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
4706,
330,
584,
740,
13,
4706,
302,
29918,
584,
938,
13,
4706,
413,
29918,
584,
938,
29892,
13136,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
4706,
269,
29918,
8508,
29918,
29888,
9970,
584,
1051,
29892,
8267,
29898,
29895,
3383,
29871,
29896,
29901,
29895,
19925,
13,
13,
1678,
9995,
13,
1678,
565,
413,
29918,
338,
6213,
29901,
13,
4706,
413,
29918,
353,
302,
29918,
13,
13,
1678,
396,
16696,
29871,
29900,
29901,
25455,
13,
1678,
432,
353,
7442,
29889,
279,
927,
29898,
29896,
29892,
302,
29918,
718,
29871,
29896,
29897,
13,
1678,
269,
29918,
8508,
29918,
11333,
353,
7442,
29889,
2378,
4197,
1402,
26688,
2433,
524,
1495,
13,
1678,
363,
413,
297,
3464,
29898,
29895,
29918,
1125,
13,
4706,
396,
16696,
29871,
29896,
29901,
5953,
837,
457,
278,
1900,
1543,
297,
432,
13,
4706,
302,
29918,
8508,
353,
7442,
29889,
1191,
3317,
4197,
29887,
29898,
9302,
29889,
4397,
29898,
29879,
29918,
8508,
29918,
11333,
29892,
302,
876,
13,
462,
9651,
363,
302,
297,
432,
2314,
13,
13,
4706,
396,
16696,
29871,
29906,
29901,
22871,
278,
1900,
1543,
297,
432,
304,
278,
9262,
322,
3349,
372,
515,
432,
13,
4706,
269,
29918,
8508,
29918,
11333,
353,
7442,
29889,
4397,
29898,
29879,
29918,
8508,
29918,
11333,
29892,
432,
29961,
29876,
29918,
8508,
2314,
13,
4706,
432,
353,
7442,
29889,
8143,
29898,
29926,
29892,
302,
29918,
8508,
29897,
13,
13,
1678,
736,
518,
29879,
29918,
8508,
29918,
11333,
7503,
29895,
29962,
363,
413,
297,
3464,
29898,
29896,
29892,
413,
29918,
718,
29871,
29896,
4638,
13,
2
] |
asset_manager/assets/Asset.py | miquel-vv/asset_manager | 0 | 1605739 | from .errors import OutOfRangeError
from .PriceCleaner import PriceCleaner
from ..mappers.PriceMapper import PriceMapper
from ..mappers.OrderMapper import OrderMapper
from ..connectors import KrakenConnector
import pandas as pd
import datetime
class Asset:
def __init__(self, asset_id):
self.asset_id = asset_id
self.price_mapper = PriceMapper()
self.order_mapper = OrderMapper()
self.prices=None
self.span=None
self.order_book=None
def get_last_price_date(self):
last_date = self.price_mapper.get_last_saved_date(self.asset_id)
if self.prices is not None:
last_date_prices = self.prices.index[-1]
if last_date_prices >= last_date:
last_date = last_date_prices
else:
self.prices = None
if last_date is None:
return datetime.datetime(2020, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
return last_date
def get_first_price_date(self):
first_date = self.price_mapper.get_first_saved_date(self.asset_id)
if first_date is None:
OutOfRangeError("No prices have been saved yet for asset: {0}".format(self.asset_id))
return first_date
def in_range(self, start_date=None, end_date=None):
first_date = self.get_first_price_date()
last_date = self.get_last_price_date()
start_date=first_date if start_date is None else start_date
end_date=last_date if end_date is None else end_date
if start_date<first_date or start_date>last_date:
return False
if end_date<first_date or end_date>last_date:
return False
return True
def load_prices(self, start_date, end_date):
self.prices = self.price_mapper.get_prices(self.asset_id)
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
return self.asset_id == other.asset_id
def __hash__(self):
return self.asset_id.__hash__()
def clean_prices(self):
if self.span is None:
raise AttributeError("Span must be set before cleaning the prices.")
self.prices.sort_index(inplace=True)
price_cleaner = PriceCleaner(self.prices, datetime.timedelta(minutes=self.span))
self.prices = price_cleaner.get_cleaned_prices()
| [
1,
515,
869,
12523,
1053,
4451,
2776,
6069,
2392,
13,
3166,
869,
13026,
29907,
14044,
261,
1053,
20743,
29907,
14044,
261,
13,
3166,
6317,
655,
22437,
29889,
13026,
19968,
1053,
20743,
19968,
13,
3166,
6317,
655,
22437,
29889,
7514,
19968,
1053,
8170,
19968,
13,
3166,
6317,
6915,
943,
1053,
19387,
1717,
20971,
2801,
13,
5215,
11701,
408,
10518,
13,
5215,
12865,
13,
13,
1990,
1094,
842,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
24342,
29918,
333,
1125,
13,
4706,
1583,
29889,
24129,
29918,
333,
353,
24342,
29918,
333,
13,
4706,
1583,
29889,
9175,
29918,
655,
2496,
353,
20743,
19968,
580,
13,
4706,
1583,
29889,
2098,
29918,
655,
2496,
353,
8170,
19968,
580,
13,
4706,
1583,
29889,
558,
1575,
29922,
8516,
13,
4706,
1583,
29889,
9653,
29922,
8516,
13,
4706,
1583,
29889,
2098,
29918,
2909,
29922,
8516,
13,
13,
1678,
822,
679,
29918,
4230,
29918,
9175,
29918,
1256,
29898,
1311,
1125,
13,
4706,
1833,
29918,
1256,
353,
1583,
29889,
9175,
29918,
655,
2496,
29889,
657,
29918,
4230,
29918,
17314,
29918,
1256,
29898,
1311,
29889,
24129,
29918,
333,
29897,
13,
4706,
565,
1583,
29889,
558,
1575,
338,
451,
6213,
29901,
13,
9651,
1833,
29918,
1256,
29918,
558,
1575,
353,
1583,
29889,
558,
1575,
29889,
2248,
14352,
29896,
29962,
13,
9651,
565,
1833,
29918,
1256,
29918,
558,
1575,
6736,
1833,
29918,
1256,
29901,
13,
18884,
1833,
29918,
1256,
353,
1833,
29918,
1256,
29918,
558,
1575,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
558,
1575,
353,
6213,
13,
13,
4706,
565,
1833,
29918,
1256,
338,
6213,
29901,
29871,
13,
9651,
736,
12865,
29889,
12673,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
260,
29920,
3888,
29922,
12673,
29889,
2230,
8028,
29889,
329,
29883,
29897,
13,
4706,
736,
1833,
29918,
1256,
13,
268,
13,
1678,
822,
679,
29918,
4102,
29918,
9175,
29918,
1256,
29898,
1311,
1125,
13,
4706,
937,
29918,
1256,
353,
1583,
29889,
9175,
29918,
655,
2496,
29889,
657,
29918,
4102,
29918,
17314,
29918,
1256,
29898,
1311,
29889,
24129,
29918,
333,
29897,
29871,
13,
308,
13,
4706,
565,
937,
29918,
1256,
338,
6213,
29901,
13,
9651,
4451,
2776,
6069,
2392,
703,
3782,
26094,
505,
1063,
7160,
3447,
363,
24342,
29901,
426,
29900,
29913,
1642,
4830,
29898,
1311,
29889,
24129,
29918,
333,
876,
13,
308,
13,
4706,
736,
937,
29918,
1256,
13,
13,
1678,
822,
297,
29918,
3881,
29898,
1311,
29892,
1369,
29918,
1256,
29922,
8516,
29892,
1095,
29918,
1256,
29922,
8516,
1125,
13,
4706,
937,
29918,
1256,
353,
1583,
29889,
657,
29918,
4102,
29918,
9175,
29918,
1256,
580,
13,
4706,
1833,
29918,
1256,
353,
1583,
29889,
657,
29918,
4230,
29918,
9175,
29918,
1256,
580,
13,
308,
13,
4706,
1369,
29918,
1256,
29922,
4102,
29918,
1256,
565,
1369,
29918,
1256,
338,
6213,
1683,
1369,
29918,
1256,
13,
4706,
1095,
29918,
1256,
29922,
4230,
29918,
1256,
565,
1095,
29918,
1256,
338,
6213,
1683,
1095,
29918,
1256,
13,
13,
4706,
565,
1369,
29918,
1256,
29966,
4102,
29918,
1256,
470,
1369,
29918,
1256,
29958,
4230,
29918,
1256,
29901,
13,
9651,
736,
7700,
13,
308,
13,
4706,
565,
1095,
29918,
1256,
29966,
4102,
29918,
1256,
470,
1095,
29918,
1256,
29958,
4230,
29918,
1256,
29901,
13,
9651,
736,
7700,
13,
308,
13,
4706,
736,
5852,
13,
13,
1678,
822,
2254,
29918,
558,
1575,
29898,
1311,
29892,
1369,
29918,
1256,
29892,
1095,
29918,
1256,
1125,
13,
4706,
1583,
29889,
558,
1575,
353,
1583,
29889,
9175,
29918,
655,
2496,
29889,
657,
29918,
558,
1575,
29898,
1311,
29889,
24129,
29918,
333,
29897,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
1228,
29892,
1583,
17255,
1990,
1649,
1125,
13,
9651,
736,
7700,
13,
4706,
736,
1583,
29889,
24129,
29918,
333,
1275,
916,
29889,
24129,
29918,
333,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
24129,
29918,
333,
17255,
8568,
1649,
580,
13,
268,
13,
1678,
822,
5941,
29918,
558,
1575,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
9653,
338,
6213,
29901,
13,
9651,
12020,
23833,
2392,
703,
15495,
1818,
367,
731,
1434,
5941,
292,
278,
26094,
23157,
13,
13,
4706,
1583,
29889,
558,
1575,
29889,
6605,
29918,
2248,
29898,
262,
6689,
29922,
5574,
29897,
13,
4706,
8666,
29918,
14941,
261,
353,
20743,
29907,
14044,
261,
29898,
1311,
29889,
558,
1575,
29892,
12865,
29889,
9346,
287,
2554,
29898,
1195,
2667,
29922,
1311,
29889,
9653,
876,
13,
4706,
1583,
29889,
558,
1575,
353,
8666,
29918,
14941,
261,
29889,
657,
29918,
14941,
287,
29918,
558,
1575,
580,
13,
2
] |
ukbot/rules/image.py | danmichaelo/UKBot | 2 | 175098 | <gh_stars>1-10
# encoding=utf-8
# vim: fenc=utf-8 et sw=4 ts=4 sts=4 ai
import re
from mwclient.errors import InvalidPageTitle
import urllib
import logging
from ..common import _
from ..contributions import UserContribution
from .rule import Rule
from .decorators import family
logger = logging.getLogger(__name__)
class ImageRule(Rule):
rule_name = 'image'
def __init__(self, sites, template, trans=None):
Rule.__init__(self, sites, template, trans)
# Points for added images that are also uploaded by the same user, but not marked as 'own work'.
self.points_own = self.get_param('own', datatype=float)
# Points for added images that are also uploaded by the same user, and also marked as 'own work'.
self.points_ownwork = self.get_param('ownwork', datatype=float)
# Max number of images already present in the article. Set this to 0 to only give points
# for addition of images to articles that do not have images from before.
self.maxinitialcount = self.get_param('maxinitialcount', datatype=int)
# Find localized File: prefixes for all sites
self.file_prefixes = set([prefix for site in self.sites.sites.values() for prefix in site.file_prefixes])
# Keep a statistic for total number of images added
self.total = 0
# Compile regexps for match images
prefixes = r'(?:%s)' % '|'.join(['%s:' % x for x in self.file_prefixes])
suffixes = r'\.(?:svg|png|jpe?g|gif|tiff)'
imagematcher = r"""
(?:
(?:=|\||^)%(prefixes)s? # "=File:", "=", "|File:", "|", ...
| %(prefixes)s
)
( # start capture
[^\}\]\[=\|$\n]*?
%(suffixes)s
) # end capture
""" % {'prefixes': prefixes, 'suffixes': suffixes}
logger.debug('ImageRule regexp: %s', imagematcher)
self.imagematcher = re.compile(imagematcher, flags=re.IGNORECASE | re.MULTILINE | re.VERBOSE)
self.extlinkmatcher = re.compile(r'https?://[^ \n]*?' + suffixes, flags=re.IGNORECASE)
def get_images(self, txt):
txt = self.extlinkmatcher.sub('', txt) # remove external links to images
# return len(re.findall(imagematcher, txt, flags=re.IGNORECASE))
for img in self.imagematcher.finditer(txt):
yield img.group(1).strip()
@staticmethod
def get_image_uploader(rev, filename):
try:
image = rev.article().site().images[filename]
except InvalidPageTitle:
logger.error('Image filename "%s" is invalid, ignoring this file', filename)
return
imageinfo = image.imageinfo
if len(imageinfo) > 0: # seems like image.exists only checks locally
try:
uploader = imageinfo['user']
except KeyError:
logger.error("Could not locate user for file '%s' in rev. %s ",
filename, rev.revid)
return
logger.debug("File '%s' uploaded by '%s', revision made by '%s'",
filename, uploader, rev.username)
return uploader
@staticmethod
def get_image_credit(rev, filename):
credit = ''
extrainfo = rev.article().site().api('query', prop='imageinfo', titles=u'File:{}'.format(filename),
iiprop='extmetadata')
try:
for pageid, page in extrainfo['query']['pages'].items():
credit = page['imageinfo'][0]['extmetadata']['Credit']['value']
except KeyError:
logger.debug("Could not read credit info for file '%s'", filename)
return credit
@family('wikipedia.org', 'wikibooks.org')
def test(self, rev):
imgs_before = list(self.get_images(rev.parenttext))
imgs_after = list(self.get_images(rev.text))
added = set(imgs_after).difference(set(imgs_before))
if len(added) == 0:
return
counters = {'ownwork': [], 'own': [], 'other': []}
for filename in added:
filename = urllib.parse.unquote(filename)
uploader = self.get_image_uploader(rev, filename)
if uploader is None:
logger.warning("File '%s' does not exist or is invalid", filename)
continue
if uploader == rev.username:
credit = self.get_image_credit(rev, filename)
if 'int-own-work' in credit or 'Itse otettu valokuva' in credit:
logger.debug("File '%s' identified as own work.", filename)
counters['ownwork'].append(filename)
else:
logger.debug("File '%s' identified as own upload, but not own work.", filename)
counters['own'].append(filename)
else:
logger.debug("File '%s' not identified as own upload or own work.", filename)
counters['other'].append(filename)
# Update statistic
self.total += len(counters['own']) + len(counters['ownwork']) + len(counters['other'])
# If maxinitialcount is 0, only the first image counts.
# If an user adds both an own image and an image by someone else,
# we should make sure to credit the own image, not the other.
# We therefore process the own images first.
points = 0
for n, img in enumerate(added):
if self.maxinitialcount is None or len(imgs_before) + n <= self.maxinitialcount:
if img in counters['ownwork']:
points += self.points_ownwork or self.points_own or self.points
elif img in counters['own']:
points += self.points_own or self.points
else:
points += self.points
yield UserContribution(rev=rev, rule=self, points=points,
description=_('images') % {'images': len(added)})
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
8025,
29922,
9420,
29899,
29947,
13,
29937,
325,
326,
29901,
285,
3977,
29922,
9420,
29899,
29947,
634,
2381,
29922,
29946,
18696,
29922,
29946,
380,
29879,
29922,
29946,
7468,
13,
5215,
337,
13,
3166,
286,
29893,
4645,
29889,
12523,
1053,
21403,
5074,
7030,
13,
5215,
3142,
1982,
13,
5215,
12183,
13,
3166,
6317,
9435,
1053,
903,
13,
3166,
6317,
1285,
3224,
29879,
1053,
4911,
1323,
3224,
13,
3166,
869,
7491,
1053,
27308,
13,
3166,
869,
19557,
4097,
1053,
3942,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
7084,
10740,
29898,
10740,
1125,
13,
13,
1678,
5751,
29918,
978,
353,
525,
3027,
29915,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
11840,
29892,
4472,
29892,
1301,
29922,
8516,
1125,
13,
4706,
27308,
17255,
2344,
12035,
1311,
29892,
11840,
29892,
4472,
29892,
1301,
29897,
13,
13,
4706,
396,
8984,
29879,
363,
2715,
4558,
393,
526,
884,
20373,
491,
278,
1021,
1404,
29892,
541,
451,
10902,
408,
525,
776,
664,
4286,
13,
4706,
1583,
29889,
9748,
29918,
776,
353,
1583,
29889,
657,
29918,
3207,
877,
776,
742,
1418,
23179,
29922,
7411,
29897,
13,
13,
4706,
396,
8984,
29879,
363,
2715,
4558,
393,
526,
884,
20373,
491,
278,
1021,
1404,
29892,
322,
884,
10902,
408,
525,
776,
664,
4286,
13,
4706,
1583,
29889,
9748,
29918,
776,
1287,
353,
1583,
29889,
657,
29918,
3207,
877,
776,
1287,
742,
1418,
23179,
29922,
7411,
29897,
13,
13,
4706,
396,
5918,
1353,
310,
4558,
2307,
2198,
297,
278,
4274,
29889,
3789,
445,
304,
29871,
29900,
304,
871,
2367,
3291,
13,
4706,
396,
363,
6124,
310,
4558,
304,
7456,
393,
437,
451,
505,
4558,
515,
1434,
29889,
13,
4706,
1583,
29889,
3317,
11228,
2798,
353,
1583,
29889,
657,
29918,
3207,
877,
3317,
11228,
2798,
742,
1418,
23179,
29922,
524,
29897,
13,
13,
4706,
396,
10987,
1887,
1891,
3497,
29901,
10944,
267,
363,
599,
11840,
13,
4706,
1583,
29889,
1445,
29918,
13506,
267,
353,
731,
4197,
13506,
363,
3268,
297,
1583,
29889,
16315,
29889,
16315,
29889,
5975,
580,
363,
10944,
297,
3268,
29889,
1445,
29918,
13506,
267,
2314,
13,
13,
4706,
396,
19152,
263,
1002,
4695,
363,
3001,
1353,
310,
4558,
2715,
13,
4706,
1583,
29889,
7827,
353,
29871,
29900,
13,
13,
4706,
396,
3831,
488,
6528,
567,
363,
1993,
4558,
13,
4706,
10944,
267,
353,
364,
29915,
10780,
16664,
29879,
16029,
1273,
525,
29989,
4286,
7122,
18959,
29995,
29879,
11283,
1273,
921,
363,
921,
297,
1583,
29889,
1445,
29918,
13506,
267,
2314,
13,
4706,
25557,
267,
353,
364,
12764,
29889,
10780,
29901,
15120,
29989,
2732,
29989,
29926,
412,
29973,
29887,
29989,
18660,
29989,
29873,
2593,
16029,
13,
4706,
6382,
331,
905,
261,
353,
364,
15945,
29908,
13,
9651,
22308,
29901,
13,
18884,
22308,
9361,
4295,
8876,
29985,
29897,
29995,
29898,
13506,
267,
29897,
29879,
29973,
259,
396,
376,
29922,
2283,
29901,
613,
376,
543,
29892,
376,
29989,
2283,
29901,
613,
376,
29989,
613,
2023,
13,
18884,
891,
1273,
29898,
13506,
267,
29897,
29879,
13,
9651,
1723,
13,
9651,
313,
29871,
396,
1369,
10446,
13,
18884,
518,
3823,
1012,
10725,
29961,
2013,
29989,
4535,
29876,
14178,
29973,
13,
18884,
1273,
29898,
2146,
600,
861,
267,
29897,
29879,
13,
9651,
1723,
29871,
396,
1095,
10446,
13,
4706,
9995,
1273,
11117,
13506,
267,
2396,
10944,
267,
29892,
525,
2146,
600,
861,
267,
2396,
25557,
267,
29913,
13,
4706,
17927,
29889,
8382,
877,
2940,
10740,
6528,
29886,
29901,
1273,
29879,
742,
6382,
331,
905,
261,
29897,
13,
4706,
1583,
29889,
326,
13904,
905,
261,
353,
337,
29889,
12198,
29898,
326,
13904,
905,
261,
29892,
13449,
29922,
276,
29889,
6259,
6632,
1525,
23487,
891,
337,
29889,
29924,
8647,
6227,
8895,
891,
337,
29889,
5348,
8456,
1660,
29897,
13,
4706,
1583,
29889,
1062,
2324,
4352,
261,
353,
337,
29889,
12198,
29898,
29878,
29915,
991,
29973,
597,
22896,
320,
29876,
14178,
17901,
718,
25557,
267,
29892,
13449,
29922,
276,
29889,
6259,
6632,
1525,
23487,
29897,
13,
13,
1678,
822,
679,
29918,
8346,
29898,
1311,
29892,
13872,
1125,
13,
4706,
13872,
353,
1583,
29889,
1062,
2324,
4352,
261,
29889,
1491,
877,
742,
13872,
29897,
29871,
396,
3349,
7029,
2988,
304,
4558,
13,
4706,
396,
736,
7431,
29898,
276,
29889,
2886,
497,
29898,
326,
13904,
905,
261,
29892,
13872,
29892,
13449,
29922,
276,
29889,
6259,
6632,
1525,
23487,
876,
13,
4706,
363,
10153,
297,
1583,
29889,
326,
13904,
905,
261,
29889,
2886,
1524,
29898,
3945,
1125,
13,
9651,
7709,
10153,
29889,
2972,
29898,
29896,
467,
17010,
580,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
3027,
29918,
9009,
261,
29898,
13478,
29892,
10422,
1125,
13,
4706,
1018,
29901,
13,
9651,
1967,
353,
6664,
29889,
7914,
2141,
2746,
2141,
8346,
29961,
9507,
29962,
13,
4706,
5174,
21403,
5074,
7030,
29901,
13,
9651,
17927,
29889,
2704,
877,
2940,
10422,
11860,
29879,
29908,
338,
8340,
29892,
5330,
8253,
445,
934,
742,
10422,
29897,
13,
9651,
736,
13,
4706,
1967,
3888,
353,
1967,
29889,
3027,
3888,
13,
4706,
565,
7431,
29898,
3027,
3888,
29897,
1405,
29871,
29900,
29901,
29871,
396,
2444,
763,
1967,
29889,
9933,
871,
12747,
12430,
13,
9651,
1018,
29901,
13,
18884,
6441,
261,
353,
1967,
3888,
1839,
1792,
2033,
13,
9651,
5174,
7670,
2392,
29901,
13,
18884,
17927,
29889,
2704,
703,
23323,
451,
26694,
1404,
363,
934,
14210,
29879,
29915,
297,
6664,
29889,
1273,
29879,
9162,
13,
462,
632,
10422,
29892,
6664,
29889,
276,
8590,
29897,
13,
18884,
736,
13,
13,
9651,
17927,
29889,
8382,
703,
2283,
14210,
29879,
29915,
20373,
491,
14210,
29879,
742,
26554,
1754,
491,
14210,
29879,
29915,
613,
13,
462,
308,
10422,
29892,
6441,
261,
29892,
6664,
29889,
6786,
29897,
13,
9651,
736,
6441,
261,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
3027,
29918,
11944,
277,
29898,
13478,
29892,
10422,
1125,
13,
4706,
16200,
353,
6629,
13,
4706,
4805,
3888,
353,
6664,
29889,
7914,
2141,
2746,
2141,
2754,
877,
1972,
742,
3107,
2433,
3027,
3888,
742,
17735,
29922,
29884,
29915,
2283,
29901,
8875,
4286,
4830,
29898,
9507,
511,
13,
462,
462,
632,
474,
666,
1336,
2433,
1062,
19635,
1495,
13,
4706,
1018,
29901,
13,
9651,
363,
1813,
333,
29892,
1813,
297,
4805,
3888,
1839,
1972,
16215,
12292,
13359,
7076,
7295,
13,
18884,
16200,
353,
1813,
1839,
3027,
3888,
2033,
29961,
29900,
22322,
1062,
19635,
16215,
15507,
277,
16215,
1767,
2033,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
17927,
29889,
8382,
703,
23323,
451,
1303,
16200,
5235,
363,
934,
14210,
29879,
29915,
613,
10422,
29897,
13,
13,
4706,
736,
16200,
13,
13,
1678,
732,
11922,
877,
6011,
29889,
990,
742,
525,
2851,
747,
2550,
29879,
29889,
990,
1495,
13,
1678,
822,
1243,
29898,
1311,
29892,
6664,
1125,
13,
4706,
527,
3174,
29918,
11083,
353,
1051,
29898,
1311,
29889,
657,
29918,
8346,
29898,
13478,
29889,
3560,
726,
876,
13,
4706,
527,
3174,
29918,
7045,
353,
1051,
29898,
1311,
29889,
657,
29918,
8346,
29898,
13478,
29889,
726,
876,
13,
4706,
2715,
353,
731,
29898,
2492,
29879,
29918,
7045,
467,
29881,
17678,
29898,
842,
29898,
2492,
29879,
29918,
11083,
876,
13,
13,
4706,
565,
7431,
29898,
23959,
29897,
1275,
29871,
29900,
29901,
13,
9651,
736,
13,
13,
4706,
2613,
2153,
353,
11117,
776,
1287,
2396,
19997,
525,
776,
2396,
19997,
525,
1228,
2396,
5159,
29913,
13,
4706,
363,
10422,
297,
2715,
29901,
13,
9651,
10422,
353,
3142,
1982,
29889,
5510,
29889,
348,
1396,
29898,
9507,
29897,
13,
9651,
6441,
261,
353,
1583,
29889,
657,
29918,
3027,
29918,
9009,
261,
29898,
13478,
29892,
10422,
29897,
13,
9651,
565,
6441,
261,
338,
6213,
29901,
13,
18884,
17927,
29889,
27392,
703,
2283,
14210,
29879,
29915,
947,
451,
1863,
470,
338,
8340,
613,
10422,
29897,
13,
18884,
6773,
13,
13,
9651,
565,
6441,
261,
1275,
6664,
29889,
6786,
29901,
13,
18884,
16200,
353,
1583,
29889,
657,
29918,
3027,
29918,
11944,
277,
29898,
13478,
29892,
10422,
29897,
13,
13,
18884,
565,
525,
524,
29899,
776,
29899,
1287,
29915,
297,
16200,
470,
525,
3112,
344,
4932,
1803,
29884,
659,
9154,
1564,
29915,
297,
16200,
29901,
13,
462,
1678,
17927,
29889,
8382,
703,
2283,
14210,
29879,
29915,
15659,
408,
1914,
664,
19602,
10422,
29897,
13,
462,
1678,
2613,
2153,
1839,
776,
1287,
13359,
4397,
29898,
9507,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
17927,
29889,
8382,
703,
2283,
14210,
29879,
29915,
15659,
408,
1914,
6441,
29892,
541,
451,
1914,
664,
19602,
10422,
29897,
13,
462,
1678,
2613,
2153,
1839,
776,
13359,
4397,
29898,
9507,
29897,
13,
9651,
1683,
29901,
13,
18884,
17927,
29889,
8382,
703,
2283,
14210,
29879,
29915,
451,
15659,
408,
1914,
6441,
470,
1914,
664,
19602,
10422,
29897,
13,
18884,
2613,
2153,
1839,
1228,
13359,
4397,
29898,
9507,
29897,
13,
13,
4706,
396,
10318,
1002,
4695,
13,
4706,
1583,
29889,
7827,
4619,
7431,
29898,
29883,
1309,
2153,
1839,
776,
11287,
718,
7431,
29898,
29883,
1309,
2153,
1839,
776,
1287,
11287,
718,
7431,
29898,
29883,
1309,
2153,
1839,
1228,
11287,
13,
13,
4706,
396,
960,
4236,
11228,
2798,
338,
29871,
29900,
29892,
871,
278,
937,
1967,
18139,
29889,
13,
4706,
396,
960,
385,
1404,
12778,
1716,
385,
1914,
1967,
322,
385,
1967,
491,
4856,
1683,
29892,
13,
4706,
396,
591,
881,
1207,
1854,
304,
16200,
278,
1914,
1967,
29892,
451,
278,
916,
29889,
13,
4706,
396,
1334,
5480,
1889,
278,
1914,
4558,
937,
29889,
13,
4706,
3291,
353,
29871,
29900,
13,
4706,
363,
302,
29892,
10153,
297,
26985,
29898,
23959,
1125,
13,
9651,
565,
1583,
29889,
3317,
11228,
2798,
338,
6213,
470,
7431,
29898,
2492,
29879,
29918,
11083,
29897,
718,
302,
5277,
1583,
29889,
3317,
11228,
2798,
29901,
13,
18884,
565,
10153,
297,
2613,
2153,
1839,
776,
1287,
2033,
29901,
13,
462,
1678,
3291,
4619,
1583,
29889,
9748,
29918,
776,
1287,
470,
1583,
29889,
9748,
29918,
776,
470,
1583,
29889,
9748,
13,
18884,
25342,
10153,
297,
2613,
2153,
1839,
776,
2033,
29901,
13,
462,
1678,
3291,
4619,
1583,
29889,
9748,
29918,
776,
470,
1583,
29889,
9748,
13,
18884,
1683,
29901,
13,
462,
1678,
3291,
4619,
1583,
29889,
9748,
13,
13,
4706,
7709,
4911,
1323,
3224,
29898,
13478,
29922,
13478,
29892,
5751,
29922,
1311,
29892,
3291,
29922,
9748,
29892,
13,
462,
1669,
6139,
29922,
29918,
877,
8346,
1495,
1273,
11117,
8346,
2396,
7431,
29898,
23959,
26972,
13,
2
] |
run_exp.py | louisfaury/gnn-es | 3 | 172141 |
from distributions.distribution_factory import create_distribution
from objectives.objective_factory import create_objective
from samplers.sampler_factory import create_sampler
from algorithms.algo_factory import create_algorithm
import os
import argparse
import pprint as pp
import json
import tensorflow as tf
import numpy as np
def run_experiments(config):
seeds = config["seeds"]
dimension = config["dimensions"]
max_eval_per_run = config["max_eval_per_run"]
outputs_dict = dict()
outputs_config_dict = dict()
outputs_config_dict["objective"] = config["objective"]
outputs_config_dict["distribution"] = config["distribution"]
outputs_config_dict["algo"] = config["algo"]
outputs_config_dict["sampler"] = config["sampler"]
outputs_dict["config"] = outputs_config_dict
output_results_dict = dict()
for seed in seeds:
results = run_one_experiment(config, dimension, seed, max_eval_per_run)
output_results_dict[seed] = results
outputs_dict["results"] = output_results_dict
return outputs_dict
def run_one_experiment(config, output_size, seed, max_evals):
np.random.seed(seed)
tf.reset_default_graph()
tf.set_random_seed(seed)
session = tf.Session()
with session.as_default():
distribution_config = config["distribution"]
distribution = create_distribution(distribution_config, output_size)
sampler_config = config["sampler"]
sampler = create_sampler(sampler_config, distribution)
algo_config = config["algo"]
algo = create_algorithm(algo_config, distribution)
objective_config = config["objective"]
objective = create_objective(objective_config, output_size)
session.run(tf.global_variables_initializer())
results = dict()
evals = 0
iters = 0
while evals<max_evals:
samples = dict()
queries, new_evals = sampler.sample()
evals += new_evals
scores = objective.f(queries)
samples["data"] = queries
samples["cost"] = scores
diagnostic = algo.fit(samples)
diagnostic["evals"] = evals
print_diagnostics(iters, diagnostic)
iters += 1
results[evals] = diagnostic
return results
def print_diagnostics(iteration, diagnostics):
print("Iteration %i" % iteration)
print("=================")
for key in diagnostics.keys():
print(key,":", diagnostics[key])
print("=================")
print("\n")
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='ES with Invertible Networks')
parser.add_argument('--config_name',
help='Name for the configuration file',
type=str)
parser.add_argument('--output_name',
help='Name for the result file',
type=str)
args = vars(parser.parse_args())
pp.pprint(args)
config_file_dir = 'config'
if not os.path.isdir(config_file_dir):
os.makedirs(config_file_dir)
output_file_dir = 'logs'
if not os.path.isdir(output_file_dir):
os.makedirs(output_file_dir)
config_file_name = args["config_name"]
config_file = os.path.join(config_file_dir, config_file_name)
with open(config_file, 'r') as f:
config = json.load(f)
results = run_experiments(config)
output_file_name = args["output_name"]
output_file = os.path.join(output_file_dir, output_file_name)
with open(output_file, 'w') as f:
json.dump(results, f)
| [
1,
29871,
13,
3166,
18822,
29889,
27691,
29918,
14399,
1053,
1653,
29918,
27691,
13,
3166,
1203,
3145,
29889,
3318,
573,
29918,
14399,
1053,
1653,
29918,
3318,
573,
13,
3166,
3514,
572,
414,
29889,
13445,
20069,
29918,
14399,
1053,
1653,
29918,
13445,
20069,
13,
3166,
14009,
29889,
284,
1484,
29918,
14399,
1053,
1653,
29918,
20567,
13,
5215,
2897,
13,
5215,
1852,
5510,
13,
5215,
282,
2158,
408,
6499,
13,
5215,
4390,
13,
5215,
26110,
408,
15886,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1753,
1065,
29918,
735,
546,
7862,
29898,
2917,
1125,
13,
1678,
409,
5779,
353,
2295,
3366,
344,
5779,
3108,
13,
1678,
9927,
353,
2295,
3366,
6229,
5580,
3108,
13,
1678,
4236,
29918,
14513,
29918,
546,
29918,
3389,
353,
2295,
3366,
3317,
29918,
14513,
29918,
546,
29918,
3389,
3108,
13,
13,
1678,
14391,
29918,
8977,
353,
9657,
580,
13,
1678,
14391,
29918,
2917,
29918,
8977,
353,
9657,
580,
13,
1678,
14391,
29918,
2917,
29918,
8977,
3366,
3318,
573,
3108,
353,
2295,
3366,
3318,
573,
3108,
13,
1678,
14391,
29918,
2917,
29918,
8977,
3366,
27691,
3108,
353,
2295,
3366,
27691,
3108,
13,
1678,
14391,
29918,
2917,
29918,
8977,
3366,
284,
1484,
3108,
353,
2295,
3366,
284,
1484,
3108,
13,
1678,
14391,
29918,
2917,
29918,
8977,
3366,
13445,
20069,
3108,
353,
2295,
3366,
13445,
20069,
3108,
13,
1678,
14391,
29918,
8977,
3366,
2917,
3108,
353,
14391,
29918,
2917,
29918,
8977,
13,
13,
1678,
1962,
29918,
9902,
29918,
8977,
353,
9657,
580,
13,
1678,
363,
16717,
297,
409,
5779,
29901,
13,
4706,
2582,
353,
1065,
29918,
650,
29918,
735,
15362,
29898,
2917,
29892,
9927,
29892,
16717,
29892,
4236,
29918,
14513,
29918,
546,
29918,
3389,
29897,
13,
4706,
1962,
29918,
9902,
29918,
8977,
29961,
26776,
29962,
353,
2582,
13,
1678,
14391,
29918,
8977,
3366,
9902,
3108,
353,
1962,
29918,
9902,
29918,
8977,
13,
13,
1678,
736,
14391,
29918,
8977,
13,
13,
13,
1753,
1065,
29918,
650,
29918,
735,
15362,
29898,
2917,
29892,
1962,
29918,
2311,
29892,
16717,
29892,
4236,
29918,
14513,
29879,
1125,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
26776,
29897,
13,
1678,
15886,
29889,
12071,
29918,
4381,
29918,
4262,
580,
13,
1678,
15886,
29889,
842,
29918,
8172,
29918,
26776,
29898,
26776,
29897,
13,
1678,
4867,
353,
15886,
29889,
7317,
580,
13,
13,
1678,
411,
4867,
29889,
294,
29918,
4381,
7295,
13,
4706,
4978,
29918,
2917,
353,
2295,
3366,
27691,
3108,
13,
4706,
4978,
353,
1653,
29918,
27691,
29898,
27691,
29918,
2917,
29892,
1962,
29918,
2311,
29897,
13,
13,
4706,
3514,
20069,
29918,
2917,
353,
2295,
3366,
13445,
20069,
3108,
13,
4706,
3514,
20069,
353,
1653,
29918,
13445,
20069,
29898,
13445,
20069,
29918,
2917,
29892,
4978,
29897,
13,
268,
13,
4706,
24673,
29918,
2917,
353,
2295,
3366,
284,
1484,
3108,
13,
4706,
24673,
353,
1653,
29918,
20567,
29898,
284,
1484,
29918,
2917,
29892,
4978,
29897,
13,
13,
4706,
12091,
29918,
2917,
353,
2295,
3366,
3318,
573,
3108,
13,
4706,
12091,
353,
1653,
29918,
3318,
573,
29898,
3318,
573,
29918,
2917,
29892,
1962,
29918,
2311,
29897,
13,
13,
4706,
4867,
29889,
3389,
29898,
13264,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
3101,
13,
4706,
2582,
353,
9657,
580,
13,
4706,
19745,
29879,
353,
29871,
29900,
13,
4706,
372,
414,
353,
29871,
29900,
13,
4706,
1550,
19745,
29879,
29966,
3317,
29918,
14513,
29879,
29901,
13,
9651,
11916,
353,
9657,
580,
13,
9651,
9365,
29892,
716,
29918,
14513,
29879,
353,
3514,
20069,
29889,
11249,
580,
13,
9651,
19745,
29879,
4619,
716,
29918,
14513,
29879,
13,
9651,
19435,
353,
12091,
29889,
29888,
29898,
339,
6358,
29897,
13,
9651,
11916,
3366,
1272,
3108,
353,
9365,
13,
9651,
11916,
3366,
18253,
3108,
353,
19435,
13,
13,
9651,
652,
21780,
353,
24673,
29889,
9202,
29898,
27736,
29897,
13,
9651,
652,
21780,
3366,
14513,
29879,
3108,
353,
19745,
29879,
13,
9651,
1596,
29918,
6051,
20921,
29898,
277,
414,
29892,
652,
21780,
29897,
13,
9651,
372,
414,
4619,
29871,
29896,
13,
9651,
2582,
29961,
14513,
29879,
29962,
353,
652,
21780,
13,
1678,
736,
2582,
13,
13,
13,
1753,
1596,
29918,
6051,
20921,
29898,
1524,
362,
29892,
652,
20921,
1125,
13,
1678,
1596,
703,
13463,
362,
1273,
29875,
29908,
1273,
12541,
29897,
13,
1678,
1596,
703,
9166,
543,
29897,
13,
1678,
363,
1820,
297,
652,
20921,
29889,
8149,
7295,
13,
4706,
1596,
29898,
1989,
29892,
1115,
613,
652,
20921,
29961,
1989,
2314,
13,
1678,
1596,
703,
9166,
543,
29897,
13,
1678,
1596,
14182,
29876,
1159,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
2890,
411,
512,
1765,
1821,
8527,
29879,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2917,
29918,
978,
742,
13,
462,
4706,
1371,
2433,
1170,
363,
278,
5285,
934,
742,
13,
462,
4706,
1134,
29922,
710,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
4905,
29918,
978,
742,
13,
462,
4706,
1371,
2433,
1170,
363,
278,
1121,
934,
742,
13,
462,
4706,
1134,
29922,
710,
29897,
13,
1678,
6389,
353,
24987,
29898,
16680,
29889,
5510,
29918,
5085,
3101,
13,
1678,
6499,
29889,
407,
29878,
524,
29898,
5085,
29897,
13,
13,
1678,
2295,
29918,
1445,
29918,
3972,
353,
525,
2917,
29915,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2917,
29918,
1445,
29918,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
2917,
29918,
1445,
29918,
3972,
29897,
13,
1678,
1962,
29918,
1445,
29918,
3972,
353,
525,
20756,
29915,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
4905,
29918,
1445,
29918,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
4905,
29918,
1445,
29918,
3972,
29897,
13,
13,
1678,
2295,
29918,
1445,
29918,
978,
353,
6389,
3366,
2917,
29918,
978,
3108,
13,
1678,
2295,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
29918,
1445,
29918,
3972,
29892,
2295,
29918,
1445,
29918,
978,
29897,
13,
1678,
411,
1722,
29898,
2917,
29918,
1445,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
4706,
2295,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
1678,
2582,
353,
1065,
29918,
735,
546,
7862,
29898,
2917,
29897,
13,
13,
1678,
1962,
29918,
1445,
29918,
978,
353,
6389,
3366,
4905,
29918,
978,
3108,
13,
1678,
1962,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
1445,
29918,
3972,
29892,
1962,
29918,
1445,
29918,
978,
29897,
13,
1678,
411,
1722,
29898,
4905,
29918,
1445,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
4390,
29889,
15070,
29898,
9902,
29892,
285,
29897,
13,
13,
13,
2
] |
4 kyu/Memoized Log Cutting.py | mwk0408/codewars_solutions | 6 | 113055 | <reponame>mwk0408/codewars_solutions<gh_stars>1-10
def cut_log(p, n):
maximum=[0]
for j in range(1, n+1):
comp=-float("inf")
for i in range(1, j+1): # Two nested loops = Θ(n^2)
comp=max(p[i-1+1]+maximum[j-i], comp)
maximum.append(comp)
return maximum[-1] | [
1,
529,
276,
1112,
420,
29958,
29885,
29893,
29895,
29900,
29946,
29900,
29947,
29914,
401,
29893,
1503,
29918,
2929,
17925,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
1753,
5700,
29918,
1188,
29898,
29886,
29892,
302,
1125,
13,
1678,
7472,
11759,
29900,
29962,
13,
1678,
363,
432,
297,
3464,
29898,
29896,
29892,
302,
29974,
29896,
1125,
13,
4706,
752,
10457,
7411,
703,
7192,
1159,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
432,
29974,
29896,
1125,
396,
7803,
9322,
12104,
353,
29871,
30546,
29898,
29876,
29985,
29906,
29897,
13,
9651,
752,
29922,
3317,
29898,
29886,
29961,
29875,
29899,
29896,
29974,
29896,
10062,
27525,
398,
29961,
29926,
29899,
29875,
1402,
752,
29897,
13,
4706,
7472,
29889,
4397,
29898,
2388,
29897,
13,
1678,
736,
7472,
14352,
29896,
29962,
2
] |
src/npi/visualization/training.py | NancyFulda/towards-neural-programming-interfaces | 0 | 137110 | from matplotlib import pyplot as plt
def make_training_plots(
title: str, save_file_path: str, epoch_data, test_data, test_data_generated=None
):
"""
Make plots for training progress of NPI network
Arguments:
epoch_losses -- List of tuples: (epoch, avg_epoch_loss)
test_losses -- List of tuples: (epoch, avg_test_loss)
"""
# Get epochs for tests into a list.
test_epochs = list(map(lambda x: x[0], test_data))
test_values = list(map(lambda x: x[1], test_data))
fig1, ax1 = plt.subplots()
ax1.plot(list(map(lambda x: x[0], epoch_data)), label="train")
ax1.plot(test_epochs, test_values, label="test")
if test_data_generated:
ax1.plot(test_epochs, list(map(lambda x: x[0], test_data_generated)), label="generated test")
ax1.set_xlabel("Epoch")
ax1.set_ylabel("Average")
ax1.set_title(title)
plt.legend()
plt.draw()
fig1.savefig(f"{save_file_path}visualization_{title.replace(' ', '_')}.png")
| [
1,
515,
22889,
1053,
11451,
5317,
408,
14770,
13,
13,
13,
1753,
1207,
29918,
26495,
29918,
26762,
29898,
13,
1678,
3611,
29901,
851,
29892,
4078,
29918,
1445,
29918,
2084,
29901,
851,
29892,
21502,
305,
29918,
1272,
29892,
1243,
29918,
1272,
29892,
1243,
29918,
1272,
29918,
13525,
29922,
8516,
13,
1125,
13,
1678,
9995,
13,
1678,
8561,
24580,
363,
6694,
6728,
310,
405,
2227,
3564,
13,
13,
1678,
11842,
9331,
29901,
13,
1678,
21502,
305,
29918,
6758,
267,
1192,
2391,
310,
5291,
2701,
29901,
313,
1022,
2878,
29892,
1029,
29887,
29918,
1022,
2878,
29918,
6758,
29897,
13,
1678,
1243,
29918,
6758,
267,
1192,
2391,
310,
5291,
2701,
29901,
313,
1022,
2878,
29892,
1029,
29887,
29918,
1688,
29918,
6758,
29897,
13,
1678,
9995,
13,
1678,
396,
3617,
21502,
12168,
363,
6987,
964,
263,
1051,
29889,
13,
1678,
1243,
29918,
1022,
2878,
29879,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29900,
1402,
1243,
29918,
1272,
876,
13,
1678,
1243,
29918,
5975,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29896,
1402,
1243,
29918,
1272,
876,
13,
13,
1678,
2537,
29896,
29892,
4853,
29896,
353,
14770,
29889,
1491,
26762,
580,
13,
1678,
4853,
29896,
29889,
5317,
29898,
1761,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29900,
1402,
21502,
305,
29918,
1272,
8243,
3858,
543,
14968,
1159,
13,
1678,
4853,
29896,
29889,
5317,
29898,
1688,
29918,
1022,
2878,
29879,
29892,
1243,
29918,
5975,
29892,
3858,
543,
1688,
1159,
13,
1678,
565,
1243,
29918,
1272,
29918,
13525,
29901,
13,
4706,
4853,
29896,
29889,
5317,
29898,
1688,
29918,
1022,
2878,
29879,
29892,
1051,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29900,
1402,
1243,
29918,
1272,
29918,
13525,
8243,
3858,
543,
13525,
1243,
1159,
13,
1678,
4853,
29896,
29889,
842,
29918,
29916,
1643,
703,
29923,
1129,
305,
1159,
13,
1678,
4853,
29896,
29889,
842,
29918,
29891,
1643,
703,
29909,
19698,
1159,
13,
1678,
4853,
29896,
29889,
842,
29918,
3257,
29898,
3257,
29897,
13,
1678,
14770,
29889,
26172,
580,
13,
1678,
14770,
29889,
4012,
580,
13,
1678,
2537,
29896,
29889,
7620,
1003,
29898,
29888,
29908,
29912,
7620,
29918,
1445,
29918,
2084,
29913,
20119,
2133,
648,
3257,
29889,
6506,
877,
13420,
22868,
1495,
1836,
2732,
1159,
13,
2
] |
bundle/completor.vim/pythonx/completers/cpp.py | wonwooddo/vim_setup | 0 | 102644 | # -*- coding: utf-8 -*-
import re
import os
from completor import Completor
from completor.compat import to_bytes
word_patten = re.compile('\w+$')
trigger = re.compile('(\.|->|#|::)\s*(\w*)$')
def sanitize(menu):
if not menu:
return menu
# type
menu = menu.replace(b'[#', b'').replace(b'#]', b' ')
# argument
menu = menu.replace(b'<#', b'').replace(b'#>', b'')
return menu
class Clang(Completor):
filetype = 'cpp'
args_file = '.clang_complete'
def format_cmd(self):
row, col = self.cursor
tempfile = self.tempname
match = trigger.search(self.input_data)
if match:
start, _ = match.span()
sign, _ = match.groups()
col = start + (2 if sign in ('->', '::') else 1)
elif not word_patten.search(self.input_data):
return []
args = [
self.get_option('clang_binary') or 'clang',
'-fsyntax-only',
'-I',
self.current_directory,
]
args.extend(self.parse_config(self.args_file))
complatfile = tempfile
if os.getenv('MSYSTEM') is not None:
cmd = 'cygpath -a -w {}'.format(complatfile)
complatfile = os.popen(cmd).read()
complatfile = complatfile.strip().replace('\\', '\\\\')
args.extend([
'-Xclang',
'-code-completion-macros',
'-Xclang',
'-code-completion-at={}:{}:{}'.format(complatfile, row, col + 1),
tempfile
])
return args
# items: list of bytes
def parse(self, items):
match = trigger.search(self.input_data)
if match:
_, prefix = match.groups()
else:
match = word_patten.search(self.input_data)
if not match:
return []
prefix = match.group()
prefix = to_bytes(prefix)
res = []
for item in items:
if not item.startswith(b'COMPLETION:'):
continue
parts = [e.strip() for e in item.split(b':')]
if len(parts) < 2 or not parts[1].startswith(prefix):
continue
data = {'word': parts[1], 'dup': 1, 'menu': ''}
if len(parts) > 2:
if parts[1] == b'Pattern':
subparts = parts[2].split(b' ', 1)
data['word'] = subparts[0]
if len(subparts) > 1:
data['menu'] = subparts[1]
else:
data['menu'] = b':'.join(parts[2:])
func_sig = sanitize(data['menu'])
data['menu'] = func_sig
# Show function signature in the preview window
data['info'] = func_sig
res.append(data)
return res
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
337,
13,
5215,
2897,
13,
3166,
3315,
272,
1053,
15642,
7345,
13,
3166,
3315,
272,
29889,
12667,
1053,
304,
29918,
13193,
13,
13,
13,
1742,
29918,
5031,
841,
353,
337,
29889,
12198,
28909,
29893,
24035,
1495,
13,
21001,
353,
337,
29889,
12198,
877,
1194,
29889,
29989,
976,
29989,
29937,
29989,
1057,
2144,
29879,
29930,
1194,
29893,
29930,
1262,
1495,
13,
13,
13,
1753,
9753,
277,
675,
29898,
6510,
1125,
13,
1678,
565,
451,
6143,
29901,
13,
4706,
736,
6143,
13,
13,
1678,
396,
1134,
13,
1678,
6143,
353,
6143,
29889,
6506,
29898,
29890,
29915,
29961,
29937,
742,
289,
29915,
2824,
6506,
29898,
29890,
29915,
29937,
29962,
742,
289,
29915,
25710,
13,
1678,
396,
2980,
13,
1678,
6143,
353,
6143,
29889,
6506,
29898,
29890,
29915,
29966,
29937,
742,
289,
29915,
2824,
6506,
29898,
29890,
29915,
29937,
29958,
742,
289,
29915,
1495,
13,
1678,
736,
6143,
13,
13,
13,
1990,
2233,
574,
29898,
8909,
7345,
1125,
13,
1678,
934,
1853,
353,
525,
8223,
29915,
13,
13,
1678,
6389,
29918,
1445,
353,
15300,
695,
574,
29918,
8835,
29915,
13,
13,
1678,
822,
3402,
29918,
9006,
29898,
1311,
1125,
13,
4706,
1948,
29892,
784,
353,
1583,
29889,
18127,
13,
4706,
5694,
1445,
353,
1583,
29889,
7382,
978,
13,
13,
4706,
1993,
353,
7135,
29889,
4478,
29898,
1311,
29889,
2080,
29918,
1272,
29897,
13,
4706,
565,
1993,
29901,
13,
9651,
1369,
29892,
903,
353,
1993,
29889,
9653,
580,
13,
9651,
1804,
29892,
903,
353,
1993,
29889,
13155,
580,
13,
9651,
784,
353,
1369,
718,
313,
29906,
565,
1804,
297,
6702,
976,
742,
525,
1057,
1495,
1683,
29871,
29896,
29897,
13,
4706,
25342,
451,
1734,
29918,
5031,
841,
29889,
4478,
29898,
1311,
29889,
2080,
29918,
1272,
1125,
13,
9651,
736,
5159,
13,
13,
4706,
6389,
353,
518,
13,
9651,
1583,
29889,
657,
29918,
3385,
877,
695,
574,
29918,
19541,
1495,
470,
525,
695,
574,
742,
13,
9651,
17411,
5847,
4217,
29899,
6194,
742,
13,
9651,
17411,
29902,
742,
13,
9651,
1583,
29889,
3784,
29918,
12322,
29892,
13,
4706,
4514,
13,
4706,
6389,
29889,
21843,
29898,
1311,
29889,
5510,
29918,
2917,
29898,
1311,
29889,
5085,
29918,
1445,
876,
13,
4706,
13162,
271,
1445,
353,
5694,
1445,
13,
4706,
565,
2897,
29889,
657,
6272,
877,
4345,
29979,
1254,
12665,
1495,
338,
451,
6213,
29901,
13,
9651,
9920,
353,
525,
1270,
29887,
2084,
448,
29874,
448,
29893,
6571,
4286,
4830,
29898,
510,
572,
271,
1445,
29897,
13,
9651,
13162,
271,
1445,
353,
2897,
29889,
29886,
3150,
29898,
9006,
467,
949,
580,
13,
9651,
13162,
271,
1445,
353,
13162,
271,
1445,
29889,
17010,
2141,
6506,
877,
1966,
742,
525,
1966,
1966,
1495,
13,
4706,
6389,
29889,
21843,
4197,
13,
9651,
17411,
29990,
695,
574,
742,
13,
9651,
17411,
401,
29899,
5729,
12757,
29899,
8628,
1883,
742,
13,
9651,
17411,
29990,
695,
574,
742,
13,
9651,
17411,
401,
29899,
5729,
12757,
29899,
271,
3790,
6177,
29912,
6177,
8875,
4286,
4830,
29898,
510,
572,
271,
1445,
29892,
1948,
29892,
784,
718,
29871,
29896,
511,
13,
9651,
5694,
1445,
13,
308,
2314,
13,
4706,
736,
6389,
13,
13,
1678,
396,
4452,
29901,
1051,
310,
6262,
13,
1678,
822,
6088,
29898,
1311,
29892,
4452,
1125,
13,
4706,
1993,
353,
7135,
29889,
4478,
29898,
1311,
29889,
2080,
29918,
1272,
29897,
13,
4706,
565,
1993,
29901,
13,
9651,
17117,
10944,
353,
1993,
29889,
13155,
580,
13,
4706,
1683,
29901,
13,
9651,
1993,
353,
1734,
29918,
5031,
841,
29889,
4478,
29898,
1311,
29889,
2080,
29918,
1272,
29897,
13,
9651,
565,
451,
1993,
29901,
13,
18884,
736,
5159,
13,
9651,
10944,
353,
1993,
29889,
2972,
580,
13,
4706,
10944,
353,
304,
29918,
13193,
29898,
13506,
29897,
13,
13,
4706,
620,
353,
5159,
13,
4706,
363,
2944,
297,
4452,
29901,
13,
9651,
565,
451,
2944,
29889,
27382,
2541,
29898,
29890,
29915,
21514,
1307,
29911,
2725,
11283,
1125,
13,
18884,
6773,
13,
13,
9651,
5633,
353,
518,
29872,
29889,
17010,
580,
363,
321,
297,
2944,
29889,
5451,
29898,
29890,
2396,
1495,
29962,
13,
9651,
565,
7431,
29898,
20895,
29897,
529,
29871,
29906,
470,
451,
5633,
29961,
29896,
1822,
27382,
2541,
29898,
13506,
1125,
13,
18884,
6773,
13,
13,
9651,
848,
353,
11117,
1742,
2396,
5633,
29961,
29896,
1402,
525,
20908,
2396,
29871,
29896,
29892,
525,
6510,
2396,
6629,
29913,
13,
9651,
565,
7431,
29898,
20895,
29897,
1405,
29871,
29906,
29901,
13,
18884,
565,
5633,
29961,
29896,
29962,
1275,
289,
29915,
17144,
2396,
13,
462,
1678,
1014,
20895,
353,
5633,
29961,
29906,
1822,
5451,
29898,
29890,
29915,
13420,
29871,
29896,
29897,
13,
462,
1678,
848,
1839,
1742,
2033,
353,
1014,
20895,
29961,
29900,
29962,
13,
462,
1678,
565,
7431,
29898,
1491,
20895,
29897,
1405,
29871,
29896,
29901,
13,
462,
4706,
848,
1839,
6510,
2033,
353,
1014,
20895,
29961,
29896,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
848,
1839,
6510,
2033,
353,
289,
2396,
4286,
7122,
29898,
20895,
29961,
29906,
29901,
2314,
13,
9651,
3653,
29918,
18816,
353,
9753,
277,
675,
29898,
1272,
1839,
6510,
11287,
13,
9651,
848,
1839,
6510,
2033,
353,
3653,
29918,
18816,
13,
13,
9651,
396,
7704,
740,
12608,
297,
278,
25267,
3474,
13,
9651,
848,
1839,
3888,
2033,
353,
3653,
29918,
18816,
13,
13,
9651,
620,
29889,
4397,
29898,
1272,
29897,
13,
4706,
736,
620,
13,
2
] |
ui/notice.py | cfpb/regulations-xml-parser | 4 | 190977 | <reponame>cfpb/regulations-xml-parser<gh_stars>1-10
from dateutil import parser as date_parser
from lxml import etree
from inflect import engine
from operator import itemgetter
class Notice:
def __init__(self, filename):
self.filename = filename
self.terms = []
self.modified = False
self.effective_date = None
with open(filename, 'r') as f:
reg_xml = f.read()
parser = etree.XMLParser(huge_tree=True)
self.tree = etree.fromstring(reg_xml, parser)
reg = self.tree.find('{eregs}preamble')
if reg is not None:
self.document_number = reg.find('{eregs}documentNumber').text
else:
changeset = self.tree.find('{eregs}changeset')
if changeset:
self.document_number = changeset.get('rightDocumentNumber')
else:
raise ValueError('Not a RegML file!')
eff_date = self.tree.find('.//{eregs}effectiveDate').text
self.effective_date = date_parser.parse(eff_date)
def __str__(self):
return '<Notice: {}>'.format(self.document_number)
def extract_terms(self):
definitions = self.tree.findall('.//{eregs}def')
self.terms = []
inf = engine()
for defn in definitions:
defined_in = defn.find('../..').get('label')
term = defn.get('term')
plural = inf.plural(term)
self.terms.append((term, defined_in, self.document_number))
self.terms.append((plural, defined_in, self.document_number))
self.terms.sort(key=itemgetter(0))
@property
def defined_terms(self):
if not self.terms:
self.extract_terms()
return self.terms
def replace_node(self, label, new_element):
current_element = self.tree.find('.//{}[@label="{}"]'.format(new_element.tag, label))
if not current_element:
current_element = self.tree.find('.//{{eregs}}{}[@label="{}"]'.format(new_element.tag, label))
if not current_element:
raise ValueError('Element {} not found!'.format(new_element.tag))
current_element_parent = current_element.find('..')
current_element_parent.replace(current_element, new_element)
self.modified = True
def save(self):
with open(self.filename, 'w') as f:
f.write(etree.tostring(self.tree, pretty_print=True, encoding='UTF-8'))
self.modified = False | [
1,
529,
276,
1112,
420,
29958,
6854,
24381,
29914,
1727,
8250,
29899,
3134,
29899,
16680,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
2635,
4422,
1053,
13812,
408,
2635,
29918,
16680,
13,
13,
3166,
301,
3134,
1053,
634,
929,
13,
13,
3166,
3041,
781,
1053,
6012,
13,
13,
3166,
5455,
1053,
2944,
657,
357,
13,
13,
13,
1990,
16393,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10422,
1125,
13,
13,
4706,
1583,
29889,
9507,
353,
10422,
13,
4706,
1583,
29889,
357,
1516,
353,
5159,
13,
4706,
1583,
29889,
1545,
2164,
353,
7700,
13,
4706,
1583,
29889,
15987,
573,
29918,
1256,
353,
6213,
13,
13,
4706,
411,
1722,
29898,
9507,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
9651,
1072,
29918,
3134,
353,
285,
29889,
949,
580,
13,
9651,
13812,
353,
634,
929,
29889,
9165,
11726,
29898,
29882,
5710,
29918,
8336,
29922,
5574,
29897,
13,
9651,
1583,
29889,
8336,
353,
634,
929,
29889,
3166,
1807,
29898,
1727,
29918,
3134,
29892,
13812,
29897,
13,
9651,
1072,
353,
1583,
29889,
8336,
29889,
2886,
877,
29912,
261,
387,
29879,
29913,
1457,
314,
569,
1495,
13,
9651,
565,
1072,
338,
451,
6213,
29901,
13,
18884,
1583,
29889,
3225,
29918,
4537,
353,
1072,
29889,
2886,
877,
29912,
261,
387,
29879,
29913,
3225,
4557,
2824,
726,
13,
9651,
1683,
29901,
13,
18884,
3620,
300,
353,
1583,
29889,
8336,
29889,
2886,
877,
29912,
261,
387,
29879,
29913,
25990,
300,
1495,
13,
18884,
565,
3620,
300,
29901,
13,
462,
1678,
1583,
29889,
3225,
29918,
4537,
353,
3620,
300,
29889,
657,
877,
1266,
6268,
4557,
1495,
13,
18884,
1683,
29901,
13,
462,
1678,
12020,
7865,
2392,
877,
3664,
263,
2169,
1988,
934,
29991,
1495,
13,
9651,
1801,
29918,
1256,
353,
1583,
29889,
8336,
29889,
2886,
12839,
458,
29912,
261,
387,
29879,
29913,
15987,
573,
2539,
2824,
726,
13,
9651,
1583,
29889,
15987,
573,
29918,
1256,
353,
2635,
29918,
16680,
29889,
5510,
29898,
12352,
29918,
1256,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
13,
4706,
736,
12801,
3664,
625,
29901,
6571,
29958,
4286,
4830,
29898,
1311,
29889,
3225,
29918,
4537,
29897,
13,
13,
1678,
822,
6597,
29918,
357,
1516,
29898,
1311,
1125,
13,
13,
4706,
15848,
353,
1583,
29889,
8336,
29889,
2886,
497,
12839,
458,
29912,
261,
387,
29879,
29913,
1753,
1495,
13,
4706,
1583,
29889,
357,
1516,
353,
5159,
13,
4706,
3041,
353,
6012,
580,
13,
13,
4706,
363,
822,
29876,
297,
15848,
29901,
13,
9651,
3342,
29918,
262,
353,
822,
29876,
29889,
2886,
877,
6995,
636,
2824,
657,
877,
1643,
1495,
13,
9651,
1840,
353,
822,
29876,
29889,
657,
877,
8489,
1495,
13,
9651,
715,
3631,
353,
3041,
29889,
572,
3631,
29898,
8489,
29897,
13,
9651,
1583,
29889,
357,
1516,
29889,
4397,
3552,
8489,
29892,
3342,
29918,
262,
29892,
1583,
29889,
3225,
29918,
4537,
876,
13,
9651,
1583,
29889,
357,
1516,
29889,
4397,
3552,
572,
3631,
29892,
3342,
29918,
262,
29892,
1583,
29889,
3225,
29918,
4537,
876,
13,
13,
4706,
1583,
29889,
357,
1516,
29889,
6605,
29898,
1989,
29922,
667,
657,
357,
29898,
29900,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3342,
29918,
357,
1516,
29898,
1311,
1125,
13,
13,
4706,
565,
451,
1583,
29889,
357,
1516,
29901,
13,
9651,
1583,
29889,
21111,
29918,
357,
1516,
580,
13,
13,
4706,
736,
1583,
29889,
357,
1516,
13,
13,
1678,
822,
5191,
29918,
3177,
29898,
1311,
29892,
3858,
29892,
716,
29918,
5029,
1125,
13,
13,
4706,
1857,
29918,
5029,
353,
1583,
29889,
8336,
29889,
2886,
12839,
458,
29912,
4400,
29992,
1643,
543,
8875,
3108,
4286,
4830,
29898,
1482,
29918,
5029,
29889,
4039,
29892,
3858,
876,
13,
4706,
565,
451,
1857,
29918,
5029,
29901,
13,
9651,
1857,
29918,
5029,
353,
1583,
29889,
8336,
29889,
2886,
12839,
458,
6224,
261,
387,
29879,
7585,
4400,
29992,
1643,
543,
8875,
3108,
4286,
4830,
29898,
1482,
29918,
5029,
29889,
4039,
29892,
3858,
876,
13,
4706,
565,
451,
1857,
29918,
5029,
29901,
13,
9651,
12020,
7865,
2392,
877,
2642,
6571,
451,
1476,
29991,
4286,
4830,
29898,
1482,
29918,
5029,
29889,
4039,
876,
13,
13,
4706,
1857,
29918,
5029,
29918,
3560,
353,
1857,
29918,
5029,
29889,
2886,
877,
636,
1495,
13,
4706,
1857,
29918,
5029,
29918,
3560,
29889,
6506,
29898,
3784,
29918,
5029,
29892,
716,
29918,
5029,
29897,
13,
4706,
1583,
29889,
1545,
2164,
353,
5852,
13,
13,
1678,
822,
4078,
29898,
1311,
1125,
13,
13,
4706,
411,
1722,
29898,
1311,
29889,
9507,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
300,
929,
29889,
517,
1807,
29898,
1311,
29889,
8336,
29892,
5051,
29918,
2158,
29922,
5574,
29892,
8025,
2433,
10496,
29899,
29947,
8785,
13,
13,
4706,
1583,
29889,
1545,
2164,
353,
7700,
2
] |
tests/test_hopfield_net.py | lantunes/cellpylib | 124 | 162762 | import unittest
import cellpylib as cpl
import numpy as np
import os
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class TestHopfieldNet(unittest.TestCase):
def test_hopfield_net(self):
np.random.seed(0)
# patterns for training
zero = [
0, 1, 1, 1, 0,
1, 0, 0, 0, 1,
1, 0, 0, 0, 1,
1, 0, 0, 0, 1,
1, 0, 0, 0, 1,
0, 1, 1, 1, 0,
0, 0, 0, 0, 0]
one = [
0, 1, 1, 0, 0,
0, 0, 1, 0, 0,
0, 0, 1, 0, 0,
0, 0, 1, 0, 0,
0, 0, 1, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 0, 0]
two = [
1, 1, 1, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 1, 0,
0, 1, 1, 0, 0,
1, 0, 0, 0, 0,
1, 1, 1, 1, 1,
0, 0, 0, 0, 0]
# replace the zeroes with -1 to make these vectors bipolar instead of binary
one = [-1 if x == 0 else x for x in one]
two = [-1 if x == 0 else x for x in two]
zero = [-1 if x == 0 else x for x in zero]
P = [zero, one, two]
hopfield_net = cpl.HopfieldNet(num_cells=35)
hopfield_net.train(P)
expected_weights = self._convert_to_ndarray("hopfield_net_weights.txt")
np.testing.assert_equal(expected_weights, hopfield_net.W)
expected_activities = self._convert_to_ndarray("hopfield_net.ca")
half_two = [
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 1, 1, 0, 0,
1, 0, 0, 0, 0,
1, 1, 1, 1, 1,
0, 0, 0, 0, 0]
half_two = [-1 if x == 0 else x for x in half_two]
cellular_automaton = np.array([half_two])
cellular_automaton = cpl.evolve(cellular_automaton, timesteps=155,
apply_rule=hopfield_net.apply_rule, r=hopfield_net.r)
np.testing.assert_equal(expected_activities, cellular_automaton)
def _convert_to_ndarray(self, filename, dtype=int):
with open(os.path.join(THIS_DIR, 'resources', filename), 'r') as content_file:
content = content_file.read()
content = content.replace('[[', '')
content = content.replace(']]', '')
content = content.replace('[', '')
content = content.replace('],', ';')
content = [[dtype(i) for i in x.split(',')] for x in content.split(';')]
return np.array(content) | [
1,
1053,
443,
27958,
13,
5215,
3038,
2272,
1982,
408,
274,
572,
13,
5215,
12655,
408,
7442,
13,
5215,
2897,
13,
13,
4690,
3235,
29918,
9464,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
876,
13,
13,
13,
1990,
4321,
29950,
459,
2671,
6779,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
29882,
459,
2671,
29918,
1212,
29898,
1311,
1125,
13,
4706,
7442,
29889,
8172,
29889,
26776,
29898,
29900,
29897,
13,
13,
4706,
396,
15038,
363,
6694,
13,
4706,
5225,
353,
518,
13,
632,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
13,
632,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
697,
353,
518,
13,
632,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
1023,
353,
518,
13,
632,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
396,
5191,
278,
5225,
267,
411,
448,
29896,
304,
1207,
1438,
12047,
289,
666,
10170,
2012,
310,
7581,
13,
4706,
697,
353,
21069,
29896,
565,
921,
1275,
29871,
29900,
1683,
921,
363,
921,
297,
697,
29962,
13,
4706,
1023,
353,
21069,
29896,
565,
921,
1275,
29871,
29900,
1683,
921,
363,
921,
297,
1023,
29962,
13,
4706,
5225,
353,
21069,
29896,
565,
921,
1275,
29871,
29900,
1683,
921,
363,
921,
297,
5225,
29962,
13,
4706,
349,
353,
518,
9171,
29892,
697,
29892,
1023,
29962,
13,
13,
4706,
8171,
2671,
29918,
1212,
353,
274,
572,
29889,
29950,
459,
2671,
6779,
29898,
1949,
29918,
3729,
29879,
29922,
29941,
29945,
29897,
13,
4706,
8171,
2671,
29918,
1212,
29889,
14968,
29898,
29925,
29897,
13,
13,
4706,
3806,
29918,
705,
5861,
353,
1583,
3032,
13441,
29918,
517,
29918,
299,
2378,
703,
29882,
459,
2671,
29918,
1212,
29918,
705,
5861,
29889,
3945,
1159,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
11745,
29898,
9684,
29918,
705,
5861,
29892,
8171,
2671,
29918,
1212,
29889,
29956,
29897,
13,
13,
4706,
3806,
29918,
11236,
1907,
353,
1583,
3032,
13441,
29918,
517,
29918,
299,
2378,
703,
29882,
459,
2671,
29918,
1212,
29889,
1113,
1159,
13,
13,
4706,
4203,
29918,
10184,
353,
518,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
632,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
13,
632,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
4203,
29918,
10184,
353,
21069,
29896,
565,
921,
1275,
29871,
29900,
1683,
921,
363,
921,
297,
4203,
29918,
10184,
29962,
13,
13,
4706,
3038,
1070,
29918,
17405,
14114,
353,
7442,
29889,
2378,
4197,
24498,
29918,
10184,
2314,
13,
13,
4706,
3038,
1070,
29918,
17405,
14114,
353,
274,
572,
29889,
29872,
1555,
345,
29898,
3729,
1070,
29918,
17405,
14114,
29892,
5335,
4196,
567,
29922,
29896,
29945,
29945,
29892,
13,
462,
462,
4706,
3394,
29918,
7491,
29922,
29882,
459,
2671,
29918,
1212,
29889,
7302,
29918,
7491,
29892,
364,
29922,
29882,
459,
2671,
29918,
1212,
29889,
29878,
29897,
13,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
11745,
29898,
9684,
29918,
11236,
1907,
29892,
3038,
1070,
29918,
17405,
14114,
29897,
13,
13,
1678,
822,
903,
13441,
29918,
517,
29918,
299,
2378,
29898,
1311,
29892,
10422,
29892,
26688,
29922,
524,
1125,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4690,
3235,
29918,
9464,
29892,
525,
13237,
742,
10422,
511,
525,
29878,
1495,
408,
2793,
29918,
1445,
29901,
13,
9651,
2793,
353,
2793,
29918,
1445,
29889,
949,
580,
13,
4706,
2793,
353,
2793,
29889,
6506,
877,
8999,
742,
27255,
13,
4706,
2793,
353,
2793,
29889,
6506,
877,
5262,
742,
27255,
13,
4706,
2793,
353,
2793,
29889,
6506,
877,
29961,
742,
27255,
13,
4706,
2793,
353,
2793,
29889,
6506,
877,
1402,
742,
21921,
1495,
13,
4706,
2793,
353,
5519,
29881,
1853,
29898,
29875,
29897,
363,
474,
297,
921,
29889,
5451,
29317,
1495,
29962,
363,
921,
297,
2793,
29889,
5451,
877,
29936,
1495,
29962,
13,
4706,
736,
7442,
29889,
2378,
29898,
3051,
29897,
2
] |
NatualLangageProcessing/solution/2_1.py | vavalm/AI-Frameworks | 0 | 77058 | <reponame>vavalm/AI-Frameworks
ir = 0
print("Liste des tokens racinisé de la première ligne : " + train_array[0])
rw = data_train_OHE.getrow(ir)
pd.DataFrame([(v, vocabulary[v], k) for k,v in zip(rw.data,rw.indices)], columns=["indices","token","weight"]) | [
1,
529,
276,
1112,
420,
29958,
29894,
7712,
29885,
29914,
23869,
29899,
4308,
13129,
13,
381,
353,
29871,
29900,
13,
2158,
703,
29931,
2488,
553,
18897,
11021,
262,
11728,
316,
425,
8861,
7330,
584,
376,
718,
7945,
29918,
2378,
29961,
29900,
2314,
13,
13975,
353,
848,
29918,
14968,
29918,
29949,
9606,
29889,
657,
798,
29898,
381,
29897,
13,
15926,
29889,
17271,
4197,
29898,
29894,
29892,
7931,
370,
352,
653,
29961,
29894,
1402,
413,
29897,
29871,
363,
413,
29892,
29894,
297,
14319,
29898,
13975,
29889,
1272,
29892,
13975,
29889,
513,
1575,
29897,
1402,
4341,
29922,
3366,
513,
1575,
3284,
6979,
3284,
7915,
20068,
2
] |
battlesim.py | Shashwat986/BattleSim | 0 | 178563 | <filename>battlesim.py
import random
from collections import defaultdict
matching = defaultdict(int,{
('P','K'):3,
('K','G'):3,
('G','L'):3,
('L','P'):3,
('K','P'):-3,
('G','K'):-3,
('L','G'):-3,
('P','L'):-3
})
def dieroll(n):
return sum([random.randrange(6) + 1 for i in range(n)])
class Player(object):
def __init__(self,tough,sta,stre,coun):
self.t = tough
self.stam = sta
self.stre = stre
self.coun = coun
self.HP = tough * 6 * 4
self.maxHP = self.HP
self.degree = 1
def move(self):
s = random.randrange(5 + 10*self.degree + 1)
d = 5 + 10*self.degree - s
t = random.choice(['P','K','L','G'])
return s,d,t
def status(self):
if self.HP > self.t * 6 * 3: return 0
if self.HP > self.t * 6 * 2: return 2
if self.HP > self.t * 6 * 1: return 4
if self.HP > self.t * 6 * 0: return 6
class Fight(object):
def __init__(self, p1,p2):
self.underdog = (p1.t + p2.t + p1.stam + p2.stam) * 6
self.p1 = p1
self.p2 = p2
def calcdmg(self,p1,p2):
atk_ = dieroll(p1.stre) + s1 + matching[(t1,t2)]
def_ = dieroll(p2.coun) + s2
if atk_ > def_ :
p2.HP -= d1
#def dmg(pa,pd,sa,da,ta,sd,dd,td)
def fight(self):
ctr = 1
p1 = self.p1
p2 = self.p2
while (p1.HP > 0 and p2.HP > 0):
s1,d1,t1 = p1.move()
s2,d2,t2 = p2.move()
# 1's attack
atk_ = dieroll(p1.stre) + s1 + matching[(t1,t2)]
def_ = dieroll(p2.coun) + s2
if atk_ > def_ :
p2.HP -= d1 + dieroll(p1.stre)
else:
print "Counter 1!"
# 2's attack
atk_ = dieroll(p2.stre) + s2 + matching[(t2,t1)]
def_ = dieroll(p1.coun) + s1
if atk_ > def_ :
p1.HP -= d2 + dieroll(p2.stre)
else:
print "Counter 2!"
# Recovery
p1.HP += dieroll(p1.stam)
if p1.HP > p1.maxHP: p1.HP = p1.maxHP
p2.HP += dieroll(p2.stam)
if p2.HP > p2.maxHP: p2.HP = p2.maxHP
# Degree
a = dieroll(1)
if a > 4:
if dieroll(1) > p1.status():
p1.degree += 1
if a == 1:
if dieroll(1) > 3:
p1.degree -= 1
else:
p1.degree -= 2
a = dieroll(1)
if a > 4:
if dieroll(1) > p2.status():
p2.degree += 1
if a == 1:
if dieroll(1) > 3:
p2.degree -= 1
else:
p2.degree -= 2
if p1.degree < 0: p1.degree = 0
if p2.degree < 0: p2.degree = 0
if p1.degree > 5: p1.degree = 5
if p2.degree > 5: p2.degree = 5
#print "h"
if p1.HP - p2.HP > self.underdog:
print "Underdog"
p2.degree = 5
if p2.HP - p1.HP > self.underdog:
print "Underdog"
p1.degree = 5
print "Turn {}: P1 sd = {}/{}; P2 sd = {}/{}".format(ctr,s1,d1, s2,d2)
print "Turn {}: P1 HP = {}; P2 HP = {}".format(ctr,p1.HP, p2.HP)
print "Turn {}: P1 dg = {}; P2 dg = {}".format(ctr,p1.degree, p2.degree)
print
ctr += 1
print "Player {} Wins!".format(1 if p1.HP > p2.HP else 2)
return 1 if p1.HP > p2.HP else 2, ctr
ctr = 0
ctrc = 0
N = 100
for i in range(N):
p1 = Player(4,2,2,2)
p2 = Player(2,3,2,3)
print "Starting conditions: P1 = {}, {} ; P2 = {}, {}".format(p1.HP,p1.degree,p2.HP,p2.degree)
f=Fight(p1,p2)
print "Underdog:",f.underdog
print
p,c = f.fight()
ctr += p
ctrc += c
print ctr * 1.0/N
print ctrc * 1.0/N
| [
1,
529,
9507,
29958,
29890,
1131,
793,
326,
29889,
2272,
13,
5215,
4036,
30004,
13,
3166,
16250,
1053,
2322,
8977,
30004,
13,
30004,
13,
4352,
292,
353,
2322,
8977,
29898,
524,
29892,
14626,
13,
12,
877,
29925,
3788,
29968,
29374,
29941,
11167,
13,
12,
877,
29968,
3788,
29954,
29374,
29941,
11167,
13,
12,
877,
29954,
3788,
29931,
29374,
29941,
11167,
13,
12,
877,
29931,
3788,
29925,
29374,
29941,
11167,
13,
12,
877,
29968,
3788,
29925,
29374,
29899,
29941,
11167,
13,
12,
877,
29954,
3788,
29968,
29374,
29899,
29941,
11167,
13,
12,
877,
29931,
3788,
29954,
29374,
29899,
29941,
11167,
13,
12,
877,
29925,
3788,
29931,
29374,
29899,
29941,
30004,
13,
1800,
30004,
13,
30004,
13,
1753,
270,
631,
3028,
29898,
29876,
1125,
30004,
13,
12,
2457,
2533,
4197,
8172,
29889,
9502,
3881,
29898,
29953,
29897,
718,
29871,
29896,
363,
474,
297,
3464,
29898,
29876,
29897,
2314,
30004,
13,
30004,
13,
1990,
14574,
29898,
3318,
1125,
30004,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
29873,
820,
29892,
5173,
29892,
13045,
29892,
29883,
1309,
1125,
30004,
13,
12,
12,
1311,
29889,
29873,
353,
260,
820,
30004,
13,
12,
12,
1311,
29889,
303,
314,
353,
9523,
30004,
13,
12,
12,
1311,
29889,
13045,
353,
12243,
30004,
13,
12,
12,
1311,
29889,
29883,
1309,
353,
2613,
30004,
13,
12,
12,
1311,
29889,
3954,
353,
260,
820,
334,
29871,
29953,
334,
29871,
29946,
30004,
13,
12,
12,
1311,
29889,
3317,
3954,
353,
1583,
29889,
3954,
30004,
13,
12,
12,
1311,
29889,
12163,
929,
353,
29871,
29896,
30004,
13,
12,
30004,
13,
12,
1753,
4337,
29898,
1311,
1125,
30004,
13,
12,
12,
29879,
353,
4036,
29889,
9502,
3881,
29898,
29945,
718,
29871,
29896,
29900,
29930,
1311,
29889,
12163,
929,
718,
29871,
29896,
8443,
13,
12,
12,
29881,
353,
29871,
29945,
718,
29871,
29896,
29900,
29930,
1311,
29889,
12163,
929,
448,
269,
30004,
13,
12,
12,
29873,
353,
4036,
29889,
16957,
18959,
29925,
3788,
29968,
3788,
29931,
3788,
29954,
2033,
8443,
13,
12,
12,
2457,
269,
29892,
29881,
29892,
29873,
30004,
13,
12,
30004,
13,
12,
1753,
4660,
29898,
1311,
1125,
30004,
13,
12,
12,
361,
1583,
29889,
3954,
1405,
1583,
29889,
29873,
334,
29871,
29953,
334,
29871,
29941,
29901,
736,
29871,
29900,
30004,
13,
12,
12,
361,
1583,
29889,
3954,
1405,
1583,
29889,
29873,
334,
29871,
29953,
334,
29871,
29906,
29901,
736,
29871,
29906,
30004,
13,
12,
12,
361,
1583,
29889,
3954,
1405,
1583,
29889,
29873,
334,
29871,
29953,
334,
29871,
29896,
29901,
736,
29871,
29946,
30004,
13,
12,
12,
361,
1583,
29889,
3954,
1405,
1583,
29889,
29873,
334,
29871,
29953,
334,
29871,
29900,
29901,
736,
29871,
29953,
30004,
13,
30004,
13,
1990,
26650,
29898,
3318,
1125,
30004,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
282,
29896,
29892,
29886,
29906,
1125,
30004,
13,
12,
12,
1311,
29889,
870,
2018,
468,
353,
313,
29886,
29896,
29889,
29873,
718,
282,
29906,
29889,
29873,
718,
282,
29896,
29889,
303,
314,
718,
282,
29906,
29889,
303,
314,
29897,
334,
29871,
29953,
30004,
13,
12,
12,
1311,
29889,
29886,
29896,
353,
282,
29896,
30004,
13,
12,
12,
1311,
29889,
29886,
29906,
353,
282,
29906,
30004,
13,
12,
1753,
1208,
2252,
29885,
29887,
29898,
1311,
29892,
29886,
29896,
29892,
29886,
29906,
1125,
30004,
13,
12,
12,
271,
29895,
29918,
353,
270,
631,
3028,
29898,
29886,
29896,
29889,
13045,
29897,
718,
269,
29896,
718,
9686,
15625,
29873,
29896,
29892,
29873,
29906,
4638,
30004,
13,
12,
12,
1753,
29918,
353,
270,
631,
3028,
29898,
29886,
29906,
29889,
29883,
1309,
29897,
718,
269,
29906,
30004,
13,
12,
12,
30004,
13,
12,
12,
361,
472,
29895,
29918,
1405,
822,
29918,
584,
30004,
13,
12,
12,
12,
29886,
29906,
29889,
3954,
22361,
270,
29896,
30004,
13,
30004,
13,
12,
29937,
1753,
270,
29885,
29887,
29898,
3274,
29892,
15926,
29892,
4977,
29892,
1388,
29892,
941,
29892,
4928,
29892,
1289,
29892,
1594,
8443,
13,
12,
1753,
8589,
29898,
1311,
1125,
30004,
13,
12,
12,
9988,
353,
29871,
29896,
30004,
13,
12,
12,
29886,
29896,
353,
1583,
29889,
29886,
29896,
30004,
13,
12,
12,
29886,
29906,
353,
1583,
29889,
29886,
29906,
30004,
13,
12,
12,
8000,
313,
29886,
29896,
29889,
3954,
1405,
29871,
29900,
322,
282,
29906,
29889,
3954,
1405,
29871,
29900,
1125,
30004,
13,
12,
12,
12,
29879,
29896,
29892,
29881,
29896,
29892,
29873,
29896,
353,
282,
29896,
29889,
11631,
26471,
13,
12,
12,
12,
29879,
29906,
29892,
29881,
29906,
29892,
29873,
29906,
353,
282,
29906,
29889,
11631,
26471,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
29937,
29871,
29896,
29915,
29879,
5337,
30004,
13,
12,
12,
12,
271,
29895,
29918,
353,
270,
631,
3028,
29898,
29886,
29896,
29889,
13045,
29897,
718,
269,
29896,
718,
9686,
15625,
29873,
29896,
29892,
29873,
29906,
4638,
30004,
13,
12,
12,
12,
1753,
29918,
353,
270,
631,
3028,
29898,
29886,
29906,
29889,
29883,
1309,
29897,
718,
269,
29906,
30004,
13,
12,
12,
12,
361,
472,
29895,
29918,
1405,
822,
29918,
584,
30004,
13,
12,
12,
12,
12,
29886,
29906,
29889,
3954,
22361,
270,
29896,
718,
270,
631,
3028,
29898,
29886,
29896,
29889,
13045,
8443,
13,
12,
12,
12,
2870,
29901,
30004,
13,
12,
12,
12,
12,
2158,
376,
17779,
29871,
29896,
3850,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
29937,
29871,
29906,
29915,
29879,
5337,
30004,
13,
12,
12,
12,
271,
29895,
29918,
353,
270,
631,
3028,
29898,
29886,
29906,
29889,
13045,
29897,
718,
269,
29906,
718,
9686,
15625,
29873,
29906,
29892,
29873,
29896,
4638,
30004,
13,
12,
12,
12,
1753,
29918,
353,
270,
631,
3028,
29898,
29886,
29896,
29889,
29883,
1309,
29897,
718,
269,
29896,
30004,
13,
12,
12,
12,
361,
472,
29895,
29918,
1405,
822,
29918,
584,
30004,
13,
12,
12,
12,
12,
29886,
29896,
29889,
3954,
22361,
270,
29906,
718,
270,
631,
3028,
29898,
29886,
29906,
29889,
13045,
8443,
13,
12,
12,
12,
2870,
29901,
30004,
13,
12,
12,
12,
12,
2158,
376,
17779,
29871,
29906,
3850,
30004,
13,
30004,
13,
12,
12,
12,
29937,
3599,
22205,
30004,
13,
12,
12,
12,
29886,
29896,
29889,
3954,
4619,
270,
631,
3028,
29898,
29886,
29896,
29889,
303,
314,
8443,
13,
12,
12,
12,
361,
282,
29896,
29889,
3954,
1405,
282,
29896,
29889,
3317,
3954,
29901,
282,
29896,
29889,
3954,
353,
282,
29896,
29889,
3317,
3954,
30004,
13,
30004,
13,
12,
12,
12,
29886,
29906,
29889,
3954,
4619,
270,
631,
3028,
29898,
29886,
29906,
29889,
303,
314,
8443,
13,
12,
12,
12,
361,
282,
29906,
29889,
3954,
1405,
282,
29906,
29889,
3317,
3954,
29901,
282,
29906,
29889,
3954,
353,
282,
29906,
29889,
3317,
3954,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
29937,
360,
387,
929,
30004,
13,
12,
12,
12,
29874,
353,
270,
631,
3028,
29898,
29896,
8443,
13,
12,
12,
12,
361,
263,
1405,
29871,
29946,
29901,
30004,
13,
12,
12,
12,
12,
361,
270,
631,
3028,
29898,
29896,
29897,
1405,
282,
29896,
29889,
4882,
7295,
30004,
13,
12,
12,
12,
12,
12,
29886,
29896,
29889,
12163,
929,
4619,
29871,
29896,
30004,
13,
12,
12,
12,
361,
263,
1275,
29871,
29896,
29901,
30004,
13,
12,
12,
12,
12,
361,
270,
631,
3028,
29898,
29896,
29897,
1405,
29871,
29941,
29901,
30004,
13,
12,
12,
12,
12,
12,
29886,
29896,
29889,
12163,
929,
22361,
29871,
29896,
30004,
13,
12,
12,
12,
12,
2870,
29901,
30004,
13,
12,
12,
12,
12,
12,
29886,
29896,
29889,
12163,
929,
22361,
29871,
29906,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
29874,
353,
270,
631,
3028,
29898,
29896,
8443,
13,
12,
12,
12,
361,
263,
1405,
29871,
29946,
29901,
30004,
13,
12,
12,
12,
12,
361,
270,
631,
3028,
29898,
29896,
29897,
1405,
282,
29906,
29889,
4882,
7295,
30004,
13,
12,
12,
12,
12,
12,
29886,
29906,
29889,
12163,
929,
4619,
29871,
29896,
30004,
13,
12,
12,
12,
361,
263,
1275,
29871,
29896,
29901,
30004,
13,
12,
12,
12,
12,
361,
270,
631,
3028,
29898,
29896,
29897,
1405,
29871,
29941,
29901,
30004,
13,
12,
12,
12,
12,
12,
29886,
29906,
29889,
12163,
929,
22361,
29871,
29896,
30004,
13,
12,
12,
12,
12,
2870,
29901,
30004,
13,
12,
12,
12,
12,
12,
29886,
29906,
29889,
12163,
929,
22361,
29871,
29906,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
361,
282,
29896,
29889,
12163,
929,
529,
29871,
29900,
29901,
282,
29896,
29889,
12163,
929,
353,
29871,
29900,
30004,
13,
12,
12,
12,
361,
282,
29906,
29889,
12163,
929,
529,
29871,
29900,
29901,
282,
29906,
29889,
12163,
929,
353,
29871,
29900,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
361,
282,
29896,
29889,
12163,
929,
1405,
29871,
29945,
29901,
282,
29896,
29889,
12163,
929,
353,
29871,
29945,
30004,
13,
12,
12,
12,
361,
282,
29906,
29889,
12163,
929,
1405,
29871,
29945,
29901,
282,
29906,
29889,
12163,
929,
353,
29871,
29945,
30004,
13,
30004,
13,
12,
12,
12,
29937,
2158,
376,
29882,
19451,
13,
12,
12,
12,
361,
282,
29896,
29889,
3954,
448,
282,
29906,
29889,
3954,
1405,
1583,
29889,
870,
2018,
468,
29901,
30004,
13,
12,
12,
12,
12,
2158,
376,
25263,
2018,
468,
19451,
13,
12,
12,
12,
12,
29886,
29906,
29889,
12163,
929,
353,
29871,
29945,
30004,
13,
12,
12,
12,
361,
282,
29906,
29889,
3954,
448,
282,
29896,
29889,
3954,
1405,
1583,
29889,
870,
2018,
468,
29901,
30004,
13,
12,
12,
12,
12,
2158,
376,
25263,
2018,
468,
19451,
13,
12,
12,
12,
12,
29886,
29896,
29889,
12163,
929,
353,
29871,
29945,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
30004,
13,
12,
12,
12,
2158,
376,
27407,
426,
6177,
349,
29896,
28972,
353,
6571,
19248,
3400,
349,
29906,
28972,
353,
6571,
29914,
8875,
1642,
4830,
29898,
9988,
29892,
29879,
29896,
29892,
29881,
29896,
29892,
269,
29906,
29892,
29881,
29906,
8443,
13,
12,
12,
12,
2158,
376,
27407,
426,
6177,
349,
29896,
379,
29925,
353,
15739,
349,
29906,
379,
29925,
353,
6571,
1642,
4830,
29898,
9988,
29892,
29886,
29896,
29889,
3954,
29892,
282,
29906,
29889,
3954,
8443,
13,
12,
12,
12,
2158,
376,
27407,
426,
6177,
349,
29896,
270,
29887,
353,
15739,
349,
29906,
270,
29887,
353,
6571,
1642,
4830,
29898,
9988,
29892,
29886,
29896,
29889,
12163,
929,
29892,
282,
29906,
29889,
12163,
929,
8443,
13,
12,
12,
12,
2158,
30004,
13,
12,
12,
12,
9988,
4619,
29871,
29896,
30004,
13,
12,
12,
2158,
376,
9075,
6571,
399,
1144,
29991,
1642,
4830,
29898,
29896,
565,
282,
29896,
29889,
3954,
1405,
282,
29906,
29889,
3954,
1683,
29871,
29906,
8443,
13,
12,
12,
2457,
29871,
29896,
565,
282,
29896,
29889,
3954,
1405,
282,
29906,
29889,
3954,
1683,
29871,
29906,
29892,
274,
509,
30004,
13,
30004,
13,
9988,
353,
29871,
29900,
30004,
13,
312,
2214,
353,
29871,
29900,
30004,
13,
29940,
353,
29871,
29896,
29900,
29900,
30004,
13,
1454,
474,
297,
3464,
29898,
29940,
1125,
30004,
13,
12,
29886,
29896,
353,
14574,
29898,
29946,
29892,
29906,
29892,
29906,
29892,
29906,
8443,
13,
12,
29886,
29906,
353,
14574,
29898,
29906,
29892,
29941,
29892,
29906,
29892,
29941,
8443,
13,
12,
30004,
13,
12,
2158,
376,
4763,
292,
5855,
29901,
349,
29896,
353,
24335,
6571,
2056,
349,
29906,
353,
24335,
6571,
1642,
4830,
29898,
29886,
29896,
29889,
3954,
29892,
29886,
29896,
29889,
12163,
929,
29892,
29886,
29906,
29889,
3954,
29892,
29886,
29906,
29889,
12163,
929,
8443,
13,
30004,
13,
12,
29888,
29922,
29943,
523,
29898,
29886,
29896,
29892,
29886,
29906,
8443,
13,
12,
2158,
376,
25263,
2018,
468,
29901,
613,
29888,
29889,
870,
2018,
468,
30004,
13,
12,
2158,
30004,
13,
12,
29886,
29892,
29883,
353,
285,
29889,
29888,
523,
26471,
13,
12,
9988,
4619,
282,
30004,
13,
12,
312,
2214,
4619,
274,
30004,
13,
30004,
13,
2158,
274,
509,
334,
29871,
29896,
29889,
29900,
29914,
29940,
30004,
13,
2158,
274,
509,
29883,
334,
29871,
29896,
29889,
29900,
29914,
29940,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
2
] |
devopsipy/decorators.py | kharnam/devopsipy | 0 | 3109 | """
Module to contain Pywork decorators
"""
__author__ = '<NAME>'
import re
import time
import itertools
import logging
log = logging.getLogger(__name__)
| [
1,
9995,
13,
7355,
304,
1712,
10772,
1287,
10200,
4097,
13,
15945,
29908,
13,
13,
1649,
8921,
1649,
353,
12801,
5813,
16299,
13,
13,
5215,
337,
13,
5215,
931,
13,
5215,
4256,
8504,
13,
13,
5215,
12183,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
2
] |
setup.py | microsoft/ATAC | 9 | 159161 | from distutils.core import setup
setup(
name='ATAC',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
package_dir={'':'src'},
packages=['atac'],
url='https://github.com/chinganc/atac',
license='MIT LICENSE',
description='ATAC code',
long_description=open('README.md').read(),
install_requires=[
"garage==2021.3.0",
"gym==0.17.2",],
extras_require={
'mujoco200': ["mujoco_py==2.0.2.8", "d4rl @ git+https://github.com/chinganc/d4rl@master#egg=d4rl"],
'mujoco210': ["d4rl @ git+https://github.com/rail-berkeley/d4rl@master#egg=d4rl"]}
)
| [
1,
515,
1320,
13239,
29889,
3221,
1053,
6230,
13,
13,
14669,
29898,
13,
1678,
1024,
2433,
1299,
2477,
742,
13,
1678,
1873,
2433,
29900,
29889,
29896,
29889,
29900,
742,
13,
1678,
4148,
2433,
29966,
5813,
29958,
742,
13,
1678,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
1678,
3577,
29918,
3972,
3790,
29915,
22099,
4351,
16675,
13,
1678,
9741,
29922,
1839,
532,
29883,
7464,
13,
1678,
3142,
2433,
991,
597,
3292,
29889,
510,
29914,
305,
292,
4564,
29914,
532,
29883,
742,
13,
1678,
19405,
2433,
26349,
365,
2965,
1430,
1660,
742,
13,
1678,
6139,
2433,
1299,
2477,
775,
742,
13,
1678,
1472,
29918,
8216,
29922,
3150,
877,
16310,
2303,
29889,
3487,
2824,
949,
3285,
13,
1678,
2601,
29918,
276,
339,
2658,
11759,
13,
4706,
376,
5397,
482,
1360,
29906,
29900,
29906,
29896,
29889,
29941,
29889,
29900,
613,
13,
4706,
376,
29887,
962,
1360,
29900,
29889,
29896,
29955,
29889,
29906,
613,
1402,
13,
1678,
429,
10678,
29918,
12277,
3790,
13,
4706,
525,
2589,
29926,
6235,
29906,
29900,
29900,
2396,
6796,
2589,
29926,
6235,
29918,
2272,
1360,
29906,
29889,
29900,
29889,
29906,
29889,
29947,
613,
29871,
376,
29881,
29946,
2096,
732,
6315,
29974,
991,
597,
3292,
29889,
510,
29914,
305,
292,
4564,
29914,
29881,
29946,
2096,
29992,
6207,
29937,
387,
29887,
29922,
29881,
29946,
2096,
12436,
13,
4706,
525,
2589,
29926,
6235,
29906,
29896,
29900,
2396,
6796,
29881,
29946,
2096,
732,
6315,
29974,
991,
597,
3292,
29889,
510,
29914,
336,
309,
29899,
495,
27279,
29914,
29881,
29946,
2096,
29992,
6207,
29937,
387,
29887,
29922,
29881,
29946,
2096,
3108,
29913,
13,
29897,
13,
2
] |
hwtLib/tests/types/union_test.py | optical-o/hwtLib | 24 | 79620 | <filename>hwtLib/tests/types/union_test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.struct import HStruct
from hwt.hdl.types.union import HUnion
from hwtLib.types.ctypes import uint8_t, uint16_t, int8_t, uint32_t
from pyMathBitPrecise.bit_utils import mask
class UnionTC(unittest.TestCase):
def test_assertMembersSameSize(self):
t = HUnion(
(uint8_t, "a"),
(uint8_t, "b"),
(uint8_t, "c"),
(uint8_t, "d"),
)
self.assertEqual(t.bit_length(), 8)
with self.assertRaises(TypeError):
HUnion(
(uint16_t, "a"),
(uint8_t, "b"),
)
def test_assertNoPadding(self):
with self.assertRaises(AssertionError):
HUnion(
(uint8_t, None),
(uint8_t, "b"),
)
def test_value_simple(self):
t = HUnion(
(uint8_t, "unsigned"),
(int8_t, "signed"),
)
v = t.from_py(None)
v.unsigned = mask(8)
self.assertEqual(int(v.signed), -1)
v.signed = 0
self.assertEqual(int(v.unsigned), 0)
def test_value_struct_and_bits(self):
t = HUnion(
(uint16_t, "bits"),
(HStruct(
(uint8_t, "lower"),
(uint8_t, "upper"),
), "struct"),
)
v = t.from_py(None)
v.struct.upper = 1
self.assertEqual(v.bits.val, 1 << 8)
self.assertEqual(v.bits.vld_mask, mask(8) << 8)
v.struct.lower = 1
self.assertEqual(v.bits.val, (1 << 8) | 1)
self.assertEqual(v.bits.vld_mask, mask(16))
v.bits = 2
self.assertEqual(int(v.struct.lower), 2)
self.assertEqual(int(v.struct.upper), 0)
def test_value_array_and_bits(self):
t = HUnion(
(uint32_t, "bits"),
(uint8_t[4], "arr"),
)
v = t.from_py(None)
b = (4 << (3 * 8)) | (3 << (2 * 8)) | (2 << 8) | 1
v.bits = b
for i, item in enumerate(v.arr):
self.assertEqual(int(item), i + 1)
self.assertEqual(int(v.bits), b)
def test_value_array_toArray(self):
t = HUnion(
(uint16_t[2], "arr16b"),
(int8_t[4], "arr8b"),
)
v = t.from_py(None)
for i in range(len(v.arr16b)):
v.arr16b[i] = i + 1
for i, item in enumerate(v.arr8b):
if (i + 1) % 2 == 0:
v = 0
else:
v = i // 2 + 1
self.assertEqual(int(item), v)
def test_value_array_of_struct_to_bits(self):
t = HUnion(
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr"),
(Bits(24 * 3), "bits")
)
v = t.from_py(None)
for i in range(len(v.arr)):
v.arr[i] = {"a": i + 1,
"b": (i + 1) * 3
}
self.assertEqual(int(v.bits),
1
| 3 << 16
| 2 << 24
| 6 << (24 + 16)
| 3 << (2 * 24)
| 9 << (2 * 24 + 16))
def test_hunion_type_eq(self):
t0 = HUnion(
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr"),
(Bits(24 * 3), "bits")
)
t1 = HUnion(
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr"),
(Bits(24 * 3), "bits")
)
self.assertEqual(t0, t1)
self.assertEqual(t1, t0)
t1 = HUnion(
(Bits(24 * 3), "bits"),
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr")
)
self.assertEqual(t0, t1)
self.assertEqual(t1, t0)
t1 = HUnion(
(uint32_t, "bits"),
(uint8_t[4], "arr"),
)
self.assertNotEqual(t0, t1)
self.assertNotEqual(t1, t0)
t1 = HUnion(
(Bits(24 * 3), "bbits"),
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr")
)
self.assertNotEqual(t0, t1)
self.assertNotEqual(t1, t0)
t1 = Bits(24 * 3)
self.assertNotEqual(t0, t1)
self.assertNotEqual(t1, t0)
t1 = HUnion(
(Bits(24 * 3, signed=False), "bits"),
(HStruct(
(uint16_t, "a"),
(uint8_t, "b"),
)[3], "arr")
)
self.assertNotEqual(t0, t1)
self.assertNotEqual(t1, t0)
if __name__ == '__main__':
suite = unittest.TestSuite()
# suite.addTest(UnionTC('testValue'))
suite.addTest(unittest.makeSuite(UnionTC))
runner = unittest.TextTestRunner(verbosity=3)
runner.run(suite)
| [
1,
529,
9507,
29958,
29882,
14554,
14868,
29914,
21150,
29914,
8768,
29914,
13094,
29918,
1688,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
443,
27958,
13,
13,
3166,
298,
14554,
29889,
29882,
11671,
29889,
8768,
29889,
14836,
1053,
350,
1169,
13,
3166,
298,
14554,
29889,
29882,
11671,
29889,
8768,
29889,
4984,
1053,
379,
19560,
13,
3166,
298,
14554,
29889,
29882,
11671,
29889,
8768,
29889,
13094,
1053,
379,
19986,
13,
3166,
298,
14554,
14868,
29889,
8768,
29889,
312,
7384,
1053,
13122,
29947,
29918,
29873,
29892,
13122,
29896,
29953,
29918,
29873,
29892,
938,
29947,
29918,
29873,
29892,
13122,
29941,
29906,
29918,
29873,
13,
3166,
11451,
11309,
21591,
29925,
3757,
895,
29889,
2966,
29918,
13239,
1053,
11105,
13,
13,
13,
1990,
7761,
9472,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
9294,
29924,
13415,
29903,
420,
3505,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
9651,
313,
13470,
29947,
29918,
29873,
29892,
376,
29874,
4968,
13,
9651,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
9651,
313,
13470,
29947,
29918,
29873,
29892,
376,
29883,
4968,
13,
9651,
313,
13470,
29947,
29918,
29873,
29892,
376,
29881,
4968,
13,
9651,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29873,
29889,
2966,
29918,
2848,
3285,
29871,
29947,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1542,
2392,
1125,
13,
9651,
379,
19986,
29898,
13,
18884,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
18884,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
9651,
1723,
13,
13,
1678,
822,
1243,
29918,
9294,
3782,
29925,
4676,
29898,
1311,
1125,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
14697,
291,
2392,
1125,
13,
9651,
379,
19986,
29898,
13,
18884,
313,
13470,
29947,
29918,
29873,
29892,
6213,
511,
13,
18884,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
9651,
1723,
13,
13,
1678,
822,
1243,
29918,
1767,
29918,
12857,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
18884,
313,
13470,
29947,
29918,
29873,
29892,
376,
15395,
4968,
13,
18884,
313,
524,
29947,
29918,
29873,
29892,
376,
7433,
4968,
13,
9651,
1723,
13,
4706,
325,
353,
260,
29889,
3166,
29918,
2272,
29898,
8516,
29897,
13,
13,
4706,
325,
29889,
15395,
353,
11105,
29898,
29947,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
7433,
511,
448,
29896,
29897,
13,
13,
4706,
325,
29889,
7433,
353,
29871,
29900,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
15395,
511,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
1767,
29918,
4984,
29918,
392,
29918,
14836,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
18884,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
14836,
4968,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
29871,
313,
13470,
29947,
29918,
29873,
29892,
376,
13609,
4968,
13,
462,
29871,
313,
13470,
29947,
29918,
29873,
29892,
376,
21064,
4968,
13,
462,
10353,
376,
4984,
4968,
13,
9651,
1723,
13,
13,
4706,
325,
353,
260,
29889,
3166,
29918,
2272,
29898,
8516,
29897,
13,
13,
4706,
325,
29889,
4984,
29889,
21064,
353,
29871,
29896,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29894,
29889,
14836,
29889,
791,
29892,
29871,
29896,
3532,
29871,
29947,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29894,
29889,
14836,
29889,
29894,
430,
29918,
13168,
29892,
11105,
29898,
29947,
29897,
3532,
29871,
29947,
29897,
13,
13,
4706,
325,
29889,
4984,
29889,
13609,
353,
29871,
29896,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29894,
29889,
14836,
29889,
791,
29892,
313,
29896,
3532,
29871,
29947,
29897,
891,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29894,
29889,
14836,
29889,
29894,
430,
29918,
13168,
29892,
11105,
29898,
29896,
29953,
876,
13,
13,
4706,
325,
29889,
14836,
353,
29871,
29906,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
4984,
29889,
13609,
511,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
4984,
29889,
21064,
511,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
1767,
29918,
2378,
29918,
392,
29918,
14836,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
18884,
313,
13470,
29941,
29906,
29918,
29873,
29892,
376,
14836,
4968,
13,
18884,
313,
13470,
29947,
29918,
29873,
29961,
29946,
1402,
376,
2749,
4968,
13,
9651,
1723,
13,
13,
4706,
325,
353,
260,
29889,
3166,
29918,
2272,
29898,
8516,
29897,
13,
13,
4706,
289,
353,
313,
29946,
3532,
313,
29941,
334,
29871,
29947,
876,
891,
313,
29941,
3532,
313,
29906,
334,
29871,
29947,
876,
891,
313,
29906,
3532,
29871,
29947,
29897,
891,
29871,
29896,
13,
4706,
325,
29889,
14836,
353,
289,
13,
13,
4706,
363,
474,
29892,
2944,
297,
26985,
29898,
29894,
29889,
2749,
1125,
13,
9651,
1583,
29889,
9294,
9843,
29898,
524,
29898,
667,
511,
474,
718,
29871,
29896,
29897,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
14836,
511,
289,
29897,
13,
13,
1678,
822,
1243,
29918,
1767,
29918,
2378,
29918,
517,
2588,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
18884,
313,
13470,
29896,
29953,
29918,
29873,
29961,
29906,
1402,
376,
2749,
29896,
29953,
29890,
4968,
13,
18884,
313,
524,
29947,
29918,
29873,
29961,
29946,
1402,
376,
2749,
29947,
29890,
4968,
13,
9651,
1723,
13,
13,
4706,
325,
353,
260,
29889,
3166,
29918,
2272,
29898,
8516,
29897,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
29894,
29889,
2749,
29896,
29953,
29890,
22164,
13,
9651,
325,
29889,
2749,
29896,
29953,
29890,
29961,
29875,
29962,
353,
474,
718,
29871,
29896,
13,
13,
4706,
363,
474,
29892,
2944,
297,
26985,
29898,
29894,
29889,
2749,
29947,
29890,
1125,
13,
9651,
565,
313,
29875,
718,
29871,
29896,
29897,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
13,
18884,
325,
353,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
325,
353,
474,
849,
29871,
29906,
718,
29871,
29896,
13,
9651,
1583,
29889,
9294,
9843,
29898,
524,
29898,
667,
511,
325,
29897,
13,
13,
1678,
822,
1243,
29918,
1767,
29918,
2378,
29918,
974,
29918,
4984,
29918,
517,
29918,
14836,
29898,
1311,
1125,
13,
4706,
260,
353,
379,
19986,
29898,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
4968,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
511,
376,
14836,
1159,
13,
9651,
1723,
13,
13,
4706,
325,
353,
260,
29889,
3166,
29918,
2272,
29898,
8516,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
29894,
29889,
2749,
22164,
13,
9651,
325,
29889,
2749,
29961,
29875,
29962,
353,
8853,
29874,
1115,
474,
718,
29871,
29896,
29892,
13,
462,
4706,
376,
29890,
1115,
313,
29875,
718,
29871,
29896,
29897,
334,
29871,
29941,
13,
462,
4706,
500,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
524,
29898,
29894,
29889,
14836,
511,
13,
462,
3986,
29896,
13,
462,
308,
891,
29871,
29941,
3532,
29871,
29896,
29953,
13,
462,
308,
891,
29871,
29906,
3532,
29871,
29906,
29946,
13,
462,
308,
891,
29871,
29953,
3532,
313,
29906,
29946,
718,
29871,
29896,
29953,
29897,
13,
462,
308,
891,
29871,
29941,
3532,
313,
29906,
334,
29871,
29906,
29946,
29897,
13,
462,
308,
891,
29871,
29929,
3532,
313,
29906,
334,
29871,
29906,
29946,
718,
29871,
29896,
29953,
876,
13,
13,
1678,
822,
1243,
29918,
29882,
13094,
29918,
1853,
29918,
1837,
29898,
1311,
1125,
13,
4706,
260,
29900,
353,
379,
19986,
29898,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
4968,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
511,
376,
14836,
1159,
13,
9651,
1723,
13,
4706,
260,
29896,
353,
379,
19986,
29898,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
4968,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
511,
376,
14836,
1159,
13,
9651,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
4706,
260,
29896,
353,
379,
19986,
29898,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
511,
376,
14836,
4968,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
1159,
13,
9651,
1723,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
4706,
260,
29896,
353,
379,
19986,
29898,
13,
18884,
313,
13470,
29941,
29906,
29918,
29873,
29892,
376,
14836,
4968,
13,
18884,
313,
13470,
29947,
29918,
29873,
29961,
29946,
1402,
376,
2749,
4968,
13,
9651,
1723,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
4706,
260,
29896,
353,
379,
19986,
29898,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
511,
376,
1327,
1169,
4968,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
1159,
13,
9651,
1723,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
4706,
260,
29896,
353,
350,
1169,
29898,
29906,
29946,
334,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
4706,
260,
29896,
353,
379,
19986,
29898,
13,
18884,
313,
29933,
1169,
29898,
29906,
29946,
334,
29871,
29941,
29892,
8794,
29922,
8824,
511,
376,
14836,
4968,
13,
18884,
313,
29950,
19560,
29898,
13,
462,
1678,
313,
13470,
29896,
29953,
29918,
29873,
29892,
376,
29874,
4968,
13,
462,
1678,
313,
13470,
29947,
29918,
29873,
29892,
376,
29890,
4968,
13,
462,
1678,
1723,
29961,
29941,
1402,
376,
2749,
1159,
13,
9651,
1723,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29900,
29892,
260,
29896,
29897,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
29873,
29896,
29892,
260,
29900,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
9460,
353,
443,
27958,
29889,
3057,
5091,
568,
580,
13,
1678,
396,
9460,
29889,
1202,
3057,
29898,
19986,
9472,
877,
1688,
1917,
8785,
13,
1678,
9460,
29889,
1202,
3057,
29898,
348,
27958,
29889,
5675,
5091,
568,
29898,
19986,
9472,
876,
13,
1678,
28877,
353,
443,
27958,
29889,
1626,
3057,
16802,
29898,
18248,
359,
537,
29922,
29941,
29897,
13,
1678,
28877,
29889,
3389,
29898,
13495,
29897,
13,
2
] |
python_scripts/write_BCR_html.py | cregan727/ubiquitous-rotary-phone | 0 | 67729 | import altair as alt
import pandas as pd
import numpy as np
import sys
TRUSTTSV = sys.argv[1]
CELLNUM = sys.argv[2]
BCRTEMP = """
<div style="width: 100%; height: 700px; position: relative; clear:both;overflow: hidden; white-space:nowrap; padding-top: 10px;clear:both;">
<div style="width: 110%, position: absolute; clear:both;">
<p style="text-align: left; color: #094D92; font-size: 30px"> BCR STATS: </p>
</div>
FREQHIST
<div style="width: 50%; float: right; padding-top: 50px;">
TABLE
</div>
DotPLOT
</div>
"""
# colnames for chain 1 and 2 - for B cells, the heavy chain is chain 1, and light chain is chain 2
TRUST_columns = ["V_gene",
"D_gene",
"J_gene",
"C_gene",
"cdr3_nt",
"cdr3_aa",
"read_cnt",
"consensus_id",
"CDR3_germline_similarity",
"consensus_full_length"]
TRUSTaligned = pd.read_csv(TRUSTTSV,
delimiter='\t',
index_col='#barcode')
Bcells = TRUSTaligned[TRUSTaligned['cell_type'] == 'B']
print(CELLNUM)
CELLNUM = int(CELLNUM)
print(type(CELLNUM))
# Calculate the percentages of heavy, light, and paired chains found in the B cells
No_BCR = CELLNUM - len(Bcells.index)
L_only = len(Bcells[(Bcells['chain1'] == "*") & (Bcells['chain2'] != "*")])
H_only = len(Bcells[(Bcells['chain2'] == "*") & (Bcells['chain1'] != "*")])
paired = len(Bcells[(Bcells['chain1'] != "*") & (Bcells['chain2'] != "*")])
BCR_stats = pd.DataFrame([No_BCR, L_only, H_only, paired, CELLNUM],
index=['No BCR',
"Light Chain Only",
"Heavy Chain Only",
"Paired Chains",
"Total"],
columns=['Number of Cells'])
BCR_stats['Percent of Cells'] = (BCR_stats['Number of Cells']*100/CELLNUM)
BCR_stats['Percent of Cells'] = round(BCR_stats['Percent of Cells'],
2).astype("str")+"%"
BCRSTATSTABLE = BCR_stats.to_html()
BCRSTATSTABLE = BCRSTATSTABLE.replace(
""" border="1" """, " ").replace(
"text-align: right", "text-align: left")
# split the heavy and light chain info out of its csv form
Bcells = Bcells.join(pd.DataFrame(Bcells.chain1.str.split(",").tolist(),
columns=['H_'+x for x in TRUST_columns],
index=Bcells.index))
Bcells = Bcells.join(pd.DataFrame(Bcells.chain2.str.split(",").tolist(),
columns=['L_'+x for x in TRUST_columns],
index=Bcells.index))
Bcells = Bcells.drop(columns=['chain1',
'chain2',
'secondary_chain1',
'secondary_chain2'])
# calculate frequencies for freq histogram
lightchainaa = pd.DataFrame(Bcells.groupby(
'L_cdr3_aa').size(), columns=['freq'])
lightchainaa['chain'] = 'light'
heavychainaa = pd.DataFrame(Bcells.groupby(
'H_cdr3_aa').size(), columns=['freq'])
heavychainaa['chain'] = 'heavy'
aa_freq = pd.concat([lightchainaa, heavychainaa])
freqhist = alt.Chart(aa_freq).mark_bar(
color='reds').encode(
alt.X('freq',
bin=alt.Bin(step=.9999),
title='Number of Cells the CDR3 Amino Acid Sequence is Observed in'),
y=alt.Y('count()',
title="Number of CDR3 AA sequences"),
color=alt.Color('chain',
scale=alt.Scale(scheme='viridis'))).properties(
width='container',
height=200,
title='Frequency Histogram')
# create the dataframe with the dotplot data
pair_B = Bcells[(Bcells['H_V_gene'] != "*") & (Bcells['L_V_gene'] != "*")]
dotplot_data = pair_B[['H_C_gene', 'L_C_gene']]
dotplot_data = pd.DataFrame(dotplot_data.groupby(
["H_C_gene", "L_C_gene"]).size())
dotplot_data = dotplot_data.unstack()
NaN = np.nan
dotplot_data.loc['IGHG3'] = [NaN] * len(dotplot_data.columns)
dotplot_data.loc['IGHG4'] = [NaN] * len(dotplot_data.columns)
dotplot_data.loc['IGHA'] = [NaN] * len(dotplot_data.columns)
dotplot_data.loc['IGHD'] = [NaN] * len(dotplot_data.columns)
dotplot_data.loc['IGHE'] = [NaN] * len(dotplot_data.columns)
# Heavy/Light dotplot
source = dotplot_data.melt(ignore_index=False, col_level='L_C_gene')
print(source)
source["H_C_gene"] = source.index
source['Light Chain'] = np.where(["IGK" in x for x in source['L_C_gene']],
"Kappa", "Lambda")
print(source.index.tolist())
dotplot_BCR = alt.Chart(source).mark_circle().encode(
x=alt.X('H_C_gene',
scale=alt.Scale(
domain=np.sort(source.index.tolist())),
title='Heavy Chain'),
y=alt.Y('L_C_gene',
title='Light Chain'),
size='value',
color=alt.Color('Light Chain', scale=alt.Scale(scheme='viridis')),
tooltip=['value', 'Light Chain']
).properties(
width='container',
height=200,
title="Heavy and Light Chain usage for cells with Paired Data",
).interactive()
bcr_dp_html = dotplot_BCR.to_html()
print(bcr_dp_html)
bcr_dp_html = bcr_dp_html[bcr_dp_html.find("<div id"):bcr_dp_html.find("</body>")]
print(bcr_dp_html)
bcr_dp_html = bcr_dp_html.replace("vis", "vis_dp_b")
bcr_dp_html = bcr_dp_html.replace(
"""<div id="vis_dp_b"></div>""",
"""<div id="vis_dp_b" style="width: 100%; position: absolute; clear:both; overflow: hidden; white-space:nowrap; padding-top: 300px; padding-bottom: 20px"></div>""")
freq_hist_html = freqhist.to_html()
freq_hist_html = freq_hist_html[freq_hist_html.find("<div id"):freq_hist_html.find("</body>")]
freq_hist_html = freq_hist_html.replace("vis", "vis_fq_b")
freq_hist_html = freq_hist_html.replace(
"""<div id="vis_fq_b"></div>""",
"""<div id="vis_fq_b" style="width: 50%; height: 50%; float: left; position: absolute; clear:both; overflow: hidden; white-space:nowrap"></div>""")
BCRTEMP = BCRTEMP.replace("FREQHIST", freq_hist_html)
BCRTEMP = BCRTEMP.replace("TABLE", BCRSTATSTABLE)
BCRTEMP = BCRTEMP.replace("DotPLOT", bcr_dp_html)
# final output
f = open("summary.html", "r")
htmlfile = f.read()
f.close()
htmlfile = htmlfile.replace('ADD_BCR_INFO', BCRTEMP)
f = open("summary.html", 'w')
f.write(htmlfile)
f.close()
print(np.sort(source.index.tolist()))
print("Done adding to html")
print(htmlfile)
| [
1,
1053,
21352,
381,
408,
5272,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
5215,
10876,
13,
13,
5659,
17321,
29911,
7597,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
4741,
2208,
13967,
353,
10876,
29889,
19218,
29961,
29906,
29962,
13,
13,
13,
5371,
29934,
4330,
3580,
353,
9995,
13,
29966,
4563,
3114,
543,
2103,
29901,
29871,
29896,
29900,
29900,
8874,
3171,
29901,
29871,
29955,
29900,
29900,
1756,
29936,
2602,
29901,
6198,
29936,
2821,
29901,
20313,
29936,
2262,
29901,
7934,
29936,
4796,
29899,
3493,
29901,
3707,
2390,
29936,
7164,
29899,
3332,
29901,
29871,
29896,
29900,
1756,
29936,
8551,
29901,
20313,
12334,
29871,
13,
29966,
4563,
3114,
543,
2103,
29901,
29871,
29896,
29896,
29900,
13667,
2602,
29901,
8380,
29936,
2821,
29901,
20313,
12334,
29871,
13,
418,
529,
29886,
3114,
543,
726,
29899,
2520,
29901,
2175,
29936,
2927,
29901,
396,
29900,
29929,
29946,
29928,
29929,
29906,
29936,
4079,
29899,
2311,
29901,
29871,
29941,
29900,
1756,
1013,
350,
11341,
6850,
1299,
29903,
29901,
1533,
29886,
29958,
13,
418,
1533,
4563,
29958,
13,
29943,
1525,
29984,
29950,
9047,
13,
1678,
529,
4563,
3114,
543,
2103,
29901,
29871,
29945,
29900,
8874,
5785,
29901,
1492,
29936,
7164,
29899,
3332,
29901,
29871,
29945,
29900,
1756,
12334,
29871,
13,
418,
10911,
13,
418,
1533,
4563,
29958,
13,
29928,
327,
7390,
2891,
13,
13,
829,
4563,
29958,
13,
15945,
29908,
13,
13,
29937,
784,
7039,
363,
9704,
29871,
29896,
322,
29871,
29906,
448,
363,
350,
9101,
29892,
278,
9416,
9704,
338,
9704,
29871,
29896,
29892,
322,
3578,
9704,
338,
9704,
29871,
29906,
13,
5659,
17321,
29918,
13099,
353,
6796,
29963,
29918,
29887,
1600,
613,
13,
462,
376,
29928,
29918,
29887,
1600,
613,
13,
462,
376,
29967,
29918,
29887,
1600,
613,
13,
462,
376,
29907,
29918,
29887,
1600,
613,
13,
462,
376,
2252,
29878,
29941,
29918,
593,
613,
13,
462,
376,
2252,
29878,
29941,
29918,
7340,
613,
13,
462,
376,
949,
29918,
20047,
613,
13,
462,
376,
3200,
8841,
29918,
333,
613,
13,
462,
376,
6530,
29934,
29941,
29918,
914,
828,
457,
29918,
29764,
537,
613,
13,
462,
376,
3200,
8841,
29918,
8159,
29918,
2848,
3108,
13,
13,
5659,
17321,
13671,
353,
10518,
29889,
949,
29918,
7638,
29898,
5659,
17321,
29911,
7597,
29892,
13,
1678,
28552,
2433,
29905,
29873,
742,
13,
1678,
2380,
29918,
1054,
2433,
29937,
1646,
401,
1495,
13,
29933,
3729,
29879,
353,
10014,
17321,
13671,
29961,
5659,
17321,
13671,
1839,
3729,
29918,
1853,
2033,
1275,
525,
29933,
2033,
13,
13,
2158,
29898,
4741,
2208,
13967,
29897,
13,
4741,
2208,
13967,
353,
938,
29898,
4741,
2208,
13967,
29897,
13,
2158,
29898,
1853,
29898,
4741,
2208,
13967,
876,
13,
13,
29937,
20535,
403,
278,
10151,
1179,
310,
9416,
29892,
3578,
29892,
322,
3300,
2859,
521,
2708,
1476,
297,
278,
350,
9101,
13,
3782,
29918,
5371,
29934,
353,
14645,
2208,
13967,
448,
7431,
29898,
29933,
3729,
29879,
29889,
2248,
29897,
13,
29931,
29918,
6194,
353,
7431,
29898,
29933,
3729,
29879,
15625,
29933,
3729,
29879,
1839,
14153,
29896,
2033,
1275,
26345,
1159,
669,
313,
29933,
3729,
29879,
1839,
14153,
29906,
2033,
2804,
26345,
1159,
2314,
13,
29950,
29918,
6194,
353,
7431,
29898,
29933,
3729,
29879,
15625,
29933,
3729,
29879,
1839,
14153,
29906,
2033,
1275,
26345,
1159,
669,
313,
29933,
3729,
29879,
1839,
14153,
29896,
2033,
2804,
26345,
1159,
2314,
13,
3274,
2859,
353,
7431,
29898,
29933,
3729,
29879,
15625,
29933,
3729,
29879,
1839,
14153,
29896,
2033,
2804,
26345,
1159,
669,
313,
29933,
3729,
29879,
1839,
14153,
29906,
2033,
2804,
26345,
1159,
2314,
13,
5371,
29934,
29918,
16202,
353,
10518,
29889,
17271,
4197,
3782,
29918,
5371,
29934,
29892,
365,
29918,
6194,
29892,
379,
29918,
6194,
29892,
3300,
2859,
29892,
14645,
2208,
13967,
1402,
13,
462,
308,
2380,
29922,
1839,
3782,
350,
11341,
742,
13,
462,
18884,
376,
20769,
678,
475,
9333,
613,
13,
462,
18884,
376,
3868,
5301,
678,
475,
9333,
613,
13,
462,
18884,
376,
11868,
2859,
678,
2708,
613,
13,
462,
18884,
376,
11536,
12436,
13,
462,
308,
4341,
29922,
1839,
4557,
310,
315,
10071,
11287,
13,
5371,
29934,
29918,
16202,
1839,
27933,
310,
315,
10071,
2033,
353,
313,
5371,
29934,
29918,
16202,
1839,
4557,
310,
315,
10071,
2033,
29930,
29896,
29900,
29900,
29914,
4741,
2208,
13967,
29897,
13,
5371,
29934,
29918,
16202,
1839,
27933,
310,
315,
10071,
2033,
353,
4513,
29898,
5371,
29934,
29918,
16202,
1839,
27933,
310,
315,
10071,
7464,
13,
462,
462,
539,
29906,
467,
579,
668,
703,
710,
1159,
13578,
23577,
13,
5371,
29934,
17816,
1254,
6181,
353,
350,
11341,
29918,
16202,
29889,
517,
29918,
1420,
580,
13,
13,
5371,
29934,
17816,
1254,
6181,
353,
350,
11341,
17816,
1254,
6181,
29889,
6506,
29898,
13,
1678,
9995,
5139,
543,
29896,
29908,
5124,
613,
376,
376,
467,
6506,
29898,
13,
1678,
376,
726,
29899,
2520,
29901,
1492,
613,
376,
726,
29899,
2520,
29901,
2175,
1159,
13,
13,
29937,
6219,
278,
9416,
322,
3578,
9704,
5235,
714,
310,
967,
11799,
883,
13,
29933,
3729,
29879,
353,
350,
3729,
29879,
29889,
7122,
29898,
15926,
29889,
17271,
29898,
29933,
3729,
29879,
29889,
14153,
29896,
29889,
710,
29889,
5451,
28165,
2564,
25027,
391,
3285,
13,
462,
462,
29871,
4341,
29922,
1839,
29950,
29918,
18717,
29916,
363,
921,
297,
10014,
17321,
29918,
13099,
1402,
13,
462,
462,
29871,
2380,
29922,
29933,
3729,
29879,
29889,
2248,
876,
13,
29933,
3729,
29879,
353,
350,
3729,
29879,
29889,
7122,
29898,
15926,
29889,
17271,
29898,
29933,
3729,
29879,
29889,
14153,
29906,
29889,
710,
29889,
5451,
28165,
2564,
25027,
391,
3285,
13,
462,
462,
29871,
4341,
29922,
1839,
29931,
29918,
18717,
29916,
363,
921,
297,
10014,
17321,
29918,
13099,
1402,
13,
462,
462,
29871,
2380,
29922,
29933,
3729,
29879,
29889,
2248,
876,
13,
13,
29933,
3729,
29879,
353,
350,
3729,
29879,
29889,
8865,
29898,
13099,
29922,
1839,
14153,
29896,
742,
13,
462,
795,
525,
14153,
29906,
742,
13,
462,
795,
525,
7496,
653,
29918,
14153,
29896,
742,
13,
462,
795,
525,
7496,
653,
29918,
14153,
29906,
11287,
13,
13,
29937,
8147,
29511,
363,
3005,
29939,
9825,
13342,
13,
4366,
14153,
7340,
353,
10518,
29889,
17271,
29898,
29933,
3729,
29879,
29889,
27789,
29898,
13,
1678,
525,
29931,
29918,
2252,
29878,
29941,
29918,
7340,
2824,
2311,
3285,
4341,
29922,
1839,
29888,
7971,
11287,
13,
4366,
14153,
7340,
1839,
14153,
2033,
353,
525,
4366,
29915,
13,
354,
485,
3376,
475,
7340,
353,
10518,
29889,
17271,
29898,
29933,
3729,
29879,
29889,
27789,
29898,
13,
1678,
525,
29950,
29918,
2252,
29878,
29941,
29918,
7340,
2824,
2311,
3285,
4341,
29922,
1839,
29888,
7971,
11287,
13,
354,
485,
3376,
475,
7340,
1839,
14153,
2033,
353,
525,
354,
5301,
29915,
13,
7340,
29918,
29888,
7971,
353,
10518,
29889,
17685,
4197,
4366,
14153,
7340,
29892,
14200,
3376,
475,
7340,
2314,
13,
13,
29888,
7971,
29882,
391,
353,
5272,
29889,
14732,
29898,
7340,
29918,
29888,
7971,
467,
3502,
29918,
1646,
29898,
13,
1678,
2927,
2433,
1127,
29879,
2824,
12508,
29898,
13,
1678,
5272,
29889,
29990,
877,
29888,
7971,
742,
13,
3986,
9016,
29922,
1997,
29889,
29933,
262,
29898,
10568,
21098,
29929,
29929,
29929,
29929,
511,
13,
3986,
3611,
2433,
4557,
310,
315,
10071,
278,
7307,
29934,
29941,
319,
1195,
29877,
7255,
333,
922,
3910,
338,
4250,
643,
1490,
297,
5477,
13,
1678,
343,
29922,
1997,
29889,
29979,
877,
2798,
580,
742,
13,
9651,
3611,
543,
4557,
310,
7307,
29934,
29941,
22704,
15602,
4968,
13,
1678,
2927,
29922,
1997,
29889,
3306,
877,
14153,
742,
13,
462,
1678,
6287,
29922,
1997,
29889,
17185,
29898,
816,
2004,
2433,
2405,
333,
275,
8785,
467,
11330,
29898,
13,
1678,
2920,
2433,
7611,
742,
13,
1678,
3171,
29922,
29906,
29900,
29900,
29892,
13,
1678,
3611,
2433,
23923,
23860,
15179,
13342,
1495,
13,
13,
29937,
1653,
278,
12205,
411,
278,
8329,
5317,
848,
13,
18784,
29918,
29933,
353,
350,
3729,
29879,
15625,
29933,
3729,
29879,
1839,
29950,
29918,
29963,
29918,
29887,
1600,
2033,
2804,
26345,
1159,
669,
313,
29933,
3729,
29879,
1839,
29931,
29918,
29963,
29918,
29887,
1600,
2033,
2804,
26345,
13531,
13,
6333,
5317,
29918,
1272,
353,
5101,
29918,
29933,
29961,
1839,
29950,
29918,
29907,
29918,
29887,
1600,
742,
525,
29931,
29918,
29907,
29918,
29887,
1600,
2033,
29962,
13,
6333,
5317,
29918,
1272,
353,
10518,
29889,
17271,
29898,
6333,
5317,
29918,
1272,
29889,
27789,
29898,
13,
1678,
6796,
29950,
29918,
29907,
29918,
29887,
1600,
613,
376,
29931,
29918,
29907,
29918,
29887,
1600,
3108,
467,
2311,
3101,
13,
6333,
5317,
29918,
1272,
353,
8329,
5317,
29918,
1272,
29889,
348,
1429,
580,
13,
19377,
353,
7442,
29889,
13707,
13,
6333,
5317,
29918,
1272,
29889,
2029,
1839,
6259,
29950,
29954,
29941,
2033,
353,
518,
19377,
29962,
334,
7431,
29898,
6333,
5317,
29918,
1272,
29889,
13099,
29897,
13,
6333,
5317,
29918,
1272,
29889,
2029,
1839,
6259,
29950,
29954,
29946,
2033,
353,
518,
19377,
29962,
334,
7431,
29898,
6333,
5317,
29918,
1272,
29889,
13099,
29897,
13,
6333,
5317,
29918,
1272,
29889,
2029,
1839,
6259,
15715,
2033,
353,
518,
19377,
29962,
334,
7431,
29898,
6333,
5317,
29918,
1272,
29889,
13099,
29897,
13,
6333,
5317,
29918,
1272,
29889,
2029,
1839,
6259,
26124,
2033,
353,
518,
19377,
29962,
334,
7431,
29898,
6333,
5317,
29918,
1272,
29889,
13099,
29897,
13,
6333,
5317,
29918,
1272,
29889,
2029,
1839,
6259,
9606,
2033,
353,
518,
19377,
29962,
334,
7431,
29898,
6333,
5317,
29918,
1272,
29889,
13099,
29897,
13,
13,
29937,
940,
5301,
29914,
20769,
8329,
5317,
13,
4993,
353,
8329,
5317,
29918,
1272,
29889,
29885,
2152,
29898,
17281,
29918,
2248,
29922,
8824,
29892,
784,
29918,
5563,
2433,
29931,
29918,
29907,
29918,
29887,
1600,
1495,
13,
2158,
29898,
4993,
29897,
13,
4993,
3366,
29950,
29918,
29907,
29918,
29887,
1600,
3108,
353,
2752,
29889,
2248,
13,
4993,
1839,
20769,
678,
475,
2033,
353,
7442,
29889,
3062,
29898,
3366,
6259,
29968,
29908,
297,
921,
363,
921,
297,
2752,
1839,
29931,
29918,
29907,
29918,
29887,
1600,
2033,
1402,
13,
462,
462,
376,
29968,
8055,
613,
376,
9099,
1159,
13,
13,
2158,
29898,
4993,
29889,
2248,
29889,
25027,
391,
3101,
13,
6333,
5317,
29918,
5371,
29934,
353,
5272,
29889,
14732,
29898,
4993,
467,
3502,
29918,
16622,
2141,
12508,
29898,
13,
1678,
921,
29922,
1997,
29889,
29990,
877,
29950,
29918,
29907,
29918,
29887,
1600,
742,
13,
9651,
6287,
29922,
1997,
29889,
17185,
29898,
13,
18884,
5354,
29922,
9302,
29889,
6605,
29898,
4993,
29889,
2248,
29889,
25027,
391,
3101,
511,
13,
9651,
3611,
2433,
3868,
5301,
678,
475,
5477,
13,
1678,
343,
29922,
1997,
29889,
29979,
877,
29931,
29918,
29907,
29918,
29887,
1600,
742,
13,
9651,
3611,
2433,
20769,
678,
475,
5477,
13,
1678,
2159,
2433,
1767,
742,
13,
1678,
2927,
29922,
1997,
29889,
3306,
877,
20769,
678,
475,
742,
6287,
29922,
1997,
29889,
17185,
29898,
816,
2004,
2433,
2405,
333,
275,
1495,
511,
13,
1678,
5780,
12632,
29922,
1839,
1767,
742,
525,
20769,
678,
475,
2033,
13,
467,
11330,
29898,
13,
1678,
2920,
2433,
7611,
742,
13,
1678,
3171,
29922,
29906,
29900,
29900,
29892,
13,
1678,
3611,
543,
3868,
5301,
322,
12790,
678,
475,
8744,
363,
9101,
411,
2621,
2859,
3630,
613,
13,
467,
1639,
4925,
580,
13,
13,
29890,
7283,
29918,
6099,
29918,
1420,
353,
8329,
5317,
29918,
5371,
29934,
29889,
517,
29918,
1420,
580,
13,
2158,
29898,
29890,
7283,
29918,
6099,
29918,
1420,
29897,
13,
29890,
7283,
29918,
6099,
29918,
1420,
353,
289,
7283,
29918,
6099,
29918,
1420,
29961,
29890,
7283,
29918,
6099,
29918,
1420,
29889,
2886,
28945,
4563,
1178,
29908,
1125,
29890,
7283,
29918,
6099,
29918,
1420,
29889,
2886,
703,
829,
2587,
29958,
13531,
13,
2158,
29898,
29890,
7283,
29918,
6099,
29918,
1420,
29897,
13,
29890,
7283,
29918,
6099,
29918,
1420,
353,
289,
7283,
29918,
6099,
29918,
1420,
29889,
6506,
703,
1730,
613,
376,
1730,
29918,
6099,
29918,
29890,
1159,
13,
29890,
7283,
29918,
6099,
29918,
1420,
353,
289,
7283,
29918,
6099,
29918,
1420,
29889,
6506,
29898,
13,
1678,
9995,
29966,
4563,
1178,
543,
1730,
29918,
6099,
29918,
29890,
5319,
4563,
11903,
29908,
613,
13,
1678,
9995,
29966,
4563,
1178,
543,
1730,
29918,
6099,
29918,
29890,
29908,
3114,
543,
2103,
29901,
29871,
29896,
29900,
29900,
8874,
2602,
29901,
8380,
29936,
2821,
29901,
20313,
29936,
11969,
29901,
7934,
29936,
4796,
29899,
3493,
29901,
3707,
2390,
29936,
7164,
29899,
3332,
29901,
29871,
29941,
29900,
29900,
1756,
29936,
7164,
29899,
8968,
29901,
29871,
29906,
29900,
1756,
5319,
4563,
11903,
29908,
1159,
13,
13,
29888,
7971,
29918,
29882,
391,
29918,
1420,
353,
3005,
29939,
29882,
391,
29889,
517,
29918,
1420,
580,
13,
29888,
7971,
29918,
29882,
391,
29918,
1420,
353,
3005,
29939,
29918,
29882,
391,
29918,
1420,
29961,
29888,
7971,
29918,
29882,
391,
29918,
1420,
29889,
2886,
28945,
4563,
1178,
29908,
1125,
29888,
7971,
29918,
29882,
391,
29918,
1420,
29889,
2886,
703,
829,
2587,
29958,
13531,
13,
29888,
7971,
29918,
29882,
391,
29918,
1420,
353,
3005,
29939,
29918,
29882,
391,
29918,
1420,
29889,
6506,
703,
1730,
613,
376,
1730,
29918,
29888,
29939,
29918,
29890,
1159,
13,
29888,
7971,
29918,
29882,
391,
29918,
1420,
353,
3005,
29939,
29918,
29882,
391,
29918,
1420,
29889,
6506,
29898,
13,
1678,
9995,
29966,
4563,
1178,
543,
1730,
29918,
29888,
29939,
29918,
29890,
5319,
4563,
11903,
29908,
613,
13,
1678,
9995,
29966,
4563,
1178,
543,
1730,
29918,
29888,
29939,
29918,
29890,
29908,
3114,
543,
2103,
29901,
29871,
29945,
29900,
8874,
3171,
29901,
29871,
29945,
29900,
8874,
5785,
29901,
2175,
29936,
2602,
29901,
8380,
29936,
2821,
29901,
20313,
29936,
11969,
29901,
7934,
29936,
4796,
29899,
3493,
29901,
3707,
2390,
5319,
4563,
11903,
29908,
1159,
13,
13,
5371,
29934,
4330,
3580,
353,
350,
11341,
4330,
3580,
29889,
6506,
703,
29943,
1525,
29984,
29950,
9047,
613,
3005,
29939,
29918,
29882,
391,
29918,
1420,
29897,
13,
5371,
29934,
4330,
3580,
353,
350,
11341,
4330,
3580,
29889,
6506,
703,
21009,
613,
350,
11341,
17816,
1254,
6181,
29897,
13,
5371,
29934,
4330,
3580,
353,
350,
11341,
4330,
3580,
29889,
6506,
703,
29928,
327,
7390,
2891,
613,
289,
7283,
29918,
6099,
29918,
1420,
29897,
13,
13,
29937,
2186,
1962,
13,
29888,
353,
1722,
703,
7727,
29889,
1420,
613,
376,
29878,
1159,
13,
1420,
1445,
353,
285,
29889,
949,
580,
13,
29888,
29889,
5358,
580,
13,
1420,
1445,
353,
3472,
1445,
29889,
6506,
877,
17744,
29918,
5371,
29934,
29918,
11690,
742,
350,
11341,
4330,
3580,
29897,
13,
29888,
353,
1722,
703,
7727,
29889,
1420,
613,
525,
29893,
1495,
13,
29888,
29889,
3539,
29898,
1420,
1445,
29897,
13,
29888,
29889,
5358,
580,
13,
2158,
29898,
9302,
29889,
6605,
29898,
4993,
29889,
2248,
29889,
25027,
391,
22130,
13,
2158,
703,
25632,
4417,
304,
3472,
1159,
13,
2158,
29898,
1420,
1445,
29897,
13,
13,
2
] |
src/tasks/__init__.py | luke-james/setup-config | 0 | 87252 | <reponame>luke-james/setup-config<gh_stars>0
from . import setup_tasks | [
1,
529,
276,
1112,
420,
29958,
6092,
446,
29899,
29926,
1280,
29914,
14669,
29899,
2917,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
869,
1053,
6230,
29918,
20673,
2
] |
cogs/utils/classes/LohiEmbed.py | Sendouc/lohi-python | 0 | 45735 | # https://discordapp.com/developers/docs/resources/channel#embed-limits
import discord
from ..lists import (
weapons_english_internal,
abilities_short_to_emoji,
top_500_emoji,
weapons_to_emoji,
)
# Cheers to Lean
class LohiEmbed:
def __init__(
self,
title="\uFEFF",
description="\uFEFF",
color=0x60DD8E,
url=None,
footer="\uFEFF",
):
self.title = title
self.description = description
self.color = color
self.url = url
self.fields = []
self.footer = footer
def add_field(self, name="\uFEFF", value="\uFEFF", inline=True):
self.fields.append((name, value, inline))
def add_weapon_build_fields(self, builds):
for build in builds:
title = build["title"]
discord_tag = f"{build['discord_user']['username']}#{build['discord_user']['discriminator']}"
if title:
title = f"{title} by {discord_tag}"
else:
title = f"{discord_tag}"
ability_arrs = [build["headgear"], build["clothing"], build["shoes"]]
ability_str = ""
for arr in ability_arrs:
for count, ability in enumerate(arr):
ability_str += abilities_short_to_emoji[ability]
if count == 0:
ability_str += "|"
ability_str += "\n"
self.add_field(title, ability_str, False)
if len(self.fields) == 0:
self.add_field(value="No builds found!")
def get_embeds(self):
title = self.title[: 256 - 8]
desc = self.description[:2048]
used_up = len(title) + len(desc)
embed = discord.Embed(
title=title, description=desc, color=self.color, url=self.url
)
embed.set_footer(text=self.footer)
returned_embeds = []
for i in range(len(self.fields)):
name, value, inline = self.fields[i]
name = name[:256]
value = value[:1024]
additional = len(name) + len(value)
if i % 25 == 24 or used_up + additional > 6000:
returned_embeds.append(embed)
title = self.title + " (cont.)"
embed = discord.Embed(
title=title, description=desc, color=self.color, url=self.url
)
embed.set_footer(text=self.footer)
used_up = len(title) + len(desc)
used_up += additional
embed.add_field(name=name, value=value, inline=inline)
returned_embeds.append(embed)
return returned_embeds
| [
1,
396,
2045,
597,
2218,
16090,
932,
29889,
510,
29914,
17426,
29914,
2640,
29914,
13237,
29914,
12719,
29937,
17987,
29899,
12514,
13,
13,
5215,
2313,
536,
13,
13,
3166,
6317,
21513,
1053,
313,
13,
1678,
25340,
29918,
996,
1674,
29918,
7564,
29892,
13,
1678,
633,
9770,
29918,
12759,
29918,
517,
29918,
15810,
2397,
29892,
13,
1678,
2246,
29918,
29945,
29900,
29900,
29918,
15810,
2397,
29892,
13,
1678,
25340,
29918,
517,
29918,
15810,
2397,
29892,
13,
29897,
13,
13,
29937,
29534,
304,
951,
273,
13,
1990,
365,
1148,
29875,
6026,
2580,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
3611,
543,
29905,
29884,
16359,
4198,
613,
13,
4706,
6139,
543,
29905,
29884,
16359,
4198,
613,
13,
4706,
2927,
29922,
29900,
29916,
29953,
29900,
7858,
29947,
29923,
29892,
13,
4706,
3142,
29922,
8516,
29892,
13,
4706,
24166,
543,
29905,
29884,
16359,
4198,
613,
13,
268,
1125,
13,
4706,
1583,
29889,
3257,
353,
3611,
13,
4706,
1583,
29889,
8216,
353,
6139,
13,
4706,
1583,
29889,
2780,
353,
2927,
13,
4706,
1583,
29889,
2271,
353,
3142,
13,
4706,
1583,
29889,
9621,
353,
5159,
13,
4706,
1583,
29889,
21720,
353,
24166,
13,
13,
1678,
822,
788,
29918,
2671,
29898,
1311,
29892,
1024,
543,
29905,
29884,
16359,
4198,
613,
995,
543,
29905,
29884,
16359,
4198,
613,
10583,
29922,
5574,
1125,
13,
4706,
1583,
29889,
9621,
29889,
4397,
3552,
978,
29892,
995,
29892,
10583,
876,
13,
13,
1678,
822,
788,
29918,
705,
481,
265,
29918,
4282,
29918,
9621,
29898,
1311,
29892,
23315,
1125,
13,
4706,
363,
2048,
297,
23315,
29901,
13,
9651,
3611,
353,
2048,
3366,
3257,
3108,
13,
9651,
2313,
536,
29918,
4039,
353,
285,
29908,
29912,
4282,
1839,
2218,
16090,
29918,
1792,
16215,
6786,
2033,
29913,
26660,
4282,
1839,
2218,
16090,
29918,
1792,
16215,
2218,
29883,
20386,
1061,
2033,
5038,
13,
9651,
565,
3611,
29901,
13,
18884,
3611,
353,
285,
29908,
29912,
3257,
29913,
491,
426,
2218,
16090,
29918,
4039,
5038,
13,
9651,
1683,
29901,
13,
18884,
3611,
353,
285,
29908,
29912,
2218,
16090,
29918,
4039,
5038,
13,
9651,
11509,
29918,
279,
2288,
353,
518,
4282,
3366,
2813,
479,
279,
12436,
2048,
3366,
695,
6046,
12436,
2048,
3366,
845,
29877,
267,
3108,
29962,
13,
9651,
11509,
29918,
710,
353,
5124,
13,
9651,
363,
3948,
297,
11509,
29918,
279,
2288,
29901,
13,
18884,
363,
2302,
29892,
11509,
297,
26985,
29898,
2749,
1125,
13,
462,
1678,
11509,
29918,
710,
4619,
633,
9770,
29918,
12759,
29918,
517,
29918,
15810,
2397,
29961,
3097,
29962,
13,
462,
1678,
565,
2302,
1275,
29871,
29900,
29901,
13,
462,
4706,
11509,
29918,
710,
4619,
376,
29989,
29908,
13,
18884,
11509,
29918,
710,
4619,
6634,
29876,
29908,
13,
9651,
1583,
29889,
1202,
29918,
2671,
29898,
3257,
29892,
11509,
29918,
710,
29892,
7700,
29897,
13,
13,
4706,
565,
7431,
29898,
1311,
29889,
9621,
29897,
1275,
29871,
29900,
29901,
13,
9651,
1583,
29889,
1202,
29918,
2671,
29898,
1767,
543,
3782,
23315,
1476,
29991,
1159,
13,
13,
1678,
822,
679,
29918,
1590,
5779,
29898,
1311,
1125,
13,
4706,
3611,
353,
1583,
29889,
3257,
7503,
29871,
29906,
29945,
29953,
448,
29871,
29947,
29962,
13,
4706,
5153,
353,
1583,
29889,
8216,
7503,
29906,
29900,
29946,
29947,
29962,
13,
13,
4706,
1304,
29918,
786,
353,
7431,
29898,
3257,
29897,
718,
7431,
29898,
14273,
29897,
13,
4706,
8297,
353,
2313,
536,
29889,
6026,
2580,
29898,
13,
9651,
3611,
29922,
3257,
29892,
6139,
29922,
14273,
29892,
2927,
29922,
1311,
29889,
2780,
29892,
3142,
29922,
1311,
29889,
2271,
13,
4706,
1723,
13,
4706,
8297,
29889,
842,
29918,
21720,
29898,
726,
29922,
1311,
29889,
21720,
29897,
13,
13,
4706,
4133,
29918,
1590,
5779,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
1311,
29889,
9621,
22164,
13,
9651,
1024,
29892,
995,
29892,
10583,
353,
1583,
29889,
9621,
29961,
29875,
29962,
13,
9651,
1024,
353,
1024,
7503,
29906,
29945,
29953,
29962,
13,
9651,
995,
353,
995,
7503,
29896,
29900,
29906,
29946,
29962,
13,
9651,
5684,
353,
7431,
29898,
978,
29897,
718,
7431,
29898,
1767,
29897,
13,
9651,
565,
474,
1273,
29871,
29906,
29945,
1275,
29871,
29906,
29946,
470,
1304,
29918,
786,
718,
5684,
1405,
29871,
29953,
29900,
29900,
29900,
29901,
13,
18884,
4133,
29918,
1590,
5779,
29889,
4397,
29898,
17987,
29897,
13,
18884,
3611,
353,
1583,
29889,
3257,
718,
376,
313,
1285,
1846,
29908,
13,
18884,
8297,
353,
2313,
536,
29889,
6026,
2580,
29898,
13,
462,
1678,
3611,
29922,
3257,
29892,
6139,
29922,
14273,
29892,
2927,
29922,
1311,
29889,
2780,
29892,
3142,
29922,
1311,
29889,
2271,
13,
18884,
1723,
13,
18884,
8297,
29889,
842,
29918,
21720,
29898,
726,
29922,
1311,
29889,
21720,
29897,
13,
18884,
1304,
29918,
786,
353,
7431,
29898,
3257,
29897,
718,
7431,
29898,
14273,
29897,
13,
13,
9651,
1304,
29918,
786,
4619,
5684,
13,
9651,
8297,
29889,
1202,
29918,
2671,
29898,
978,
29922,
978,
29892,
995,
29922,
1767,
29892,
10583,
29922,
14764,
29897,
13,
13,
4706,
4133,
29918,
1590,
5779,
29889,
4397,
29898,
17987,
29897,
13,
4706,
736,
4133,
29918,
1590,
5779,
13,
2
] |
main_pro_window.py | Great-special/Trade_Copier | 0 | 154058 | <filename>main_pro_window.py
import tkinter as tk
from Slave_copier import *
from tkinter import ttk
# Creating the Copier User InterFace program
_window = tk.Tk()
_window.title('Trade Copier beta - Client')
_window.minsize(450,600)
_window.maxsize(450,600)
upper_frame = tk.Frame(_window, height=200, bg='red')
upper_frame.pack(fill=tk.X, pady=5)
middle_frame = tk.Frame(_window, height=200, bg='blue')
middle_frame.pack(fill=tk.X)
lower_frame = tk.Frame(_window, height=200, bg='green')
lower_frame.pack(fill=tk.X, pady=5)
# Connecting login to interFace
def connect_account():
startMT5(Account.get(), TradeServer.get(), Password.get())
# Account number or Login
global Account
Account = tk.IntVar()
acc_details_label = tk.Label(upper_frame, text='Account Details', font=('bold', 12), pady=5).grid(row=0, column=1, columnspan=2, pady=10)
account_label = tk.Label(upper_frame, text='Login:', font=('bold', 13), padx=10)
account_label.grid(row=1, column=0, sticky=tk.W, pady=5, padx=10)
account_entry = tk.Entry(upper_frame, textvariable=Account, width=30)
account_entry.grid(row=1, column=1, sticky=tk.W, pady=5)
account_entry.focus()
# Trade Server or Account Server
global TradeServer
TradeServer = tk.StringVar()
tradeserver_label = tk.Label(upper_frame, text='Server:', font=('bold', 13), padx=15)
tradeserver_label.grid(row=2, column=0, sticky=tk.W, padx=10)
tradeserver_entry = tk.Entry(upper_frame, textvariable=TradeServer, width=30)
tradeserver_entry.grid(row=2, column=1, sticky=tk.W)
# Password
global Password
Password = tk.StringVar()
pword_label = tk.Label(upper_frame, text='Password:', font=('bold', 13), padx=10)
pword_label.grid(row=3, column=0, sticky=tk.W, pady=10, padx=10)
pword_entry = tk.Entry(upper_frame, textvariable=Password, width=30)
pword_entry.grid(row=3, column=1, sticky=tk.W, pady=10)
# Connect Button
start_MT5_btn = tk.Button(upper_frame, text='Connect Account', width=20, command=connect_account)
start_MT5_btn.grid(row=4, column=1, pady=5, padx=15, columnspan=2)
#open positions
pos_details_label = tk.Label(middle_frame, text='Position Details', font=('bold', 12), pady=5).grid(row=0, column=1, columnspan=3, pady=5, padx=150)
pos_list = tk.Listbox(middle_frame, height=10, width=70,border=0)
pos_list.grid(row=1, column=1, columnspan=2, padx=10, pady=10)
#General info
gen_info = tk.Label(lower_frame, text='General Info', font=('bold', 12), pady=5).grid(row=0, column=1, columnspan=2, padx=70, pady=10)
conn_server_btn = tk.Button(lower_frame, text='Connect Server', width=15, command=startServer, padx=10)
conn_server_btn.grid(row=1, column=0, columnspan=2, padx=10, pady=5, sticky=tk.W)
# close_pos_btn = tk.Button(lower_frame, text='Close Position', width=13, command=closeOpenPosition, padx=10)
# close_pos_btn.grid(row=1, column=3, sticky=tk.E, padx=10)
info_bar_label = tk.Label(lower_frame, text='Info Bar', font=('bold', 12), pady=5).grid(row=2, column=0, sticky=tk.W, padx=10)
info_bar_box = tk.Listbox(lower_frame, height=3, width=30).grid(row=2, column=1, padx=5, pady=10)
print('[STARTING] Program Window')
_window.mainloop()
| [
1,
529,
9507,
29958,
3396,
29918,
771,
29918,
7165,
29889,
2272,
13,
5215,
18883,
1639,
408,
18883,
30004,
13,
3166,
317,
18398,
29918,
9708,
631,
1053,
334,
30004,
13,
3166,
18883,
1639,
1053,
260,
11178,
30004,
13,
30004,
13,
29937,
26221,
278,
10061,
631,
4911,
4124,
23360,
1824,
30004,
13,
29918,
7165,
353,
18883,
29889,
29911,
29895,
26471,
13,
29918,
7165,
29889,
3257,
877,
5323,
311,
10061,
631,
21762,
448,
12477,
1495,
30004,
13,
29918,
7165,
29889,
29885,
1144,
675,
29898,
29946,
29945,
29900,
29892,
29953,
29900,
29900,
8443,
13,
29918,
7165,
29889,
3317,
2311,
29898,
29946,
29945,
29900,
29892,
29953,
29900,
29900,
8443,
13,
30004,
13,
30004,
13,
21064,
29918,
2557,
353,
18883,
29889,
4308,
7373,
7165,
29892,
3171,
29922,
29906,
29900,
29900,
29892,
25989,
2433,
1127,
1495,
30004,
13,
21064,
29918,
2557,
29889,
4058,
29898,
5589,
29922,
11178,
29889,
29990,
29892,
282,
3714,
29922,
29945,
8443,
13,
17662,
29918,
2557,
353,
18883,
29889,
4308,
7373,
7165,
29892,
3171,
29922,
29906,
29900,
29900,
29892,
25989,
2433,
9539,
1495,
30004,
13,
17662,
29918,
2557,
29889,
4058,
29898,
5589,
29922,
11178,
29889,
29990,
8443,
13,
13609,
29918,
2557,
353,
18883,
29889,
4308,
7373,
7165,
29892,
3171,
29922,
29906,
29900,
29900,
29892,
25989,
2433,
12692,
1495,
30004,
13,
13609,
29918,
2557,
29889,
4058,
29898,
5589,
29922,
11178,
29889,
29990,
29892,
282,
3714,
29922,
29945,
8443,
13,
30004,
13,
29937,
14971,
292,
6464,
304,
1006,
23360,
30004,
13,
1753,
4511,
29918,
10149,
7295,
30004,
13,
1678,
1369,
11490,
29945,
29898,
10601,
29889,
657,
3285,
27226,
6004,
29889,
657,
3285,
25280,
29889,
657,
3101,
30004,
13,
30004,
13,
29937,
16535,
1353,
470,
19130,
30004,
13,
10945,
16535,
30004,
13,
10601,
353,
18883,
29889,
2928,
9037,
26471,
13,
5753,
29918,
14144,
29918,
1643,
353,
18883,
29889,
4775,
29898,
21064,
29918,
2557,
29892,
1426,
2433,
10601,
25577,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29906,
511,
282,
3714,
29922,
29945,
467,
7720,
29898,
798,
29922,
29900,
29892,
1897,
29922,
29896,
29892,
1897,
9653,
29922,
29906,
29892,
282,
3714,
29922,
29896,
29900,
8443,
13,
10149,
29918,
1643,
353,
18883,
29889,
4775,
29898,
21064,
29918,
2557,
29892,
1426,
2433,
11049,
29901,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29941,
511,
17132,
29916,
29922,
29896,
29900,
8443,
13,
10149,
29918,
1643,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29900,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
282,
3714,
29922,
29945,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
10149,
29918,
8269,
353,
18883,
29889,
9634,
29898,
21064,
29918,
2557,
29892,
1426,
11918,
29922,
10601,
29892,
2920,
29922,
29941,
29900,
8443,
13,
10149,
29918,
8269,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29896,
29892,
29871,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
282,
3714,
29922,
29945,
8443,
13,
10149,
29918,
8269,
29889,
18037,
26471,
13,
30004,
13,
29937,
27226,
5656,
470,
16535,
5656,
30004,
13,
10945,
27226,
6004,
30004,
13,
5323,
311,
6004,
353,
18883,
29889,
1231,
9037,
26471,
13,
509,
3076,
261,
369,
29918,
1643,
353,
18883,
29889,
4775,
29898,
21064,
29918,
2557,
29892,
1426,
2433,
6004,
29901,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29941,
511,
17132,
29916,
29922,
29896,
29945,
8443,
13,
509,
3076,
261,
369,
29918,
1643,
29889,
7720,
29898,
798,
29922,
29906,
29892,
1897,
29922,
29900,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
509,
3076,
261,
369,
29918,
8269,
353,
18883,
29889,
9634,
29898,
21064,
29918,
2557,
29892,
1426,
11918,
29922,
5323,
311,
6004,
29892,
2920,
29922,
29941,
29900,
8443,
13,
509,
3076,
261,
369,
29918,
8269,
29889,
7720,
29898,
798,
29922,
29906,
29892,
1897,
29922,
29896,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
8443,
13,
30004,
13,
29937,
25280,
30004,
13,
10945,
25280,
30004,
13,
10048,
353,
18883,
29889,
1231,
9037,
26471,
13,
29886,
1742,
29918,
1643,
353,
18883,
29889,
4775,
29898,
21064,
29918,
2557,
29892,
1426,
2433,
10048,
29901,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29941,
511,
17132,
29916,
29922,
29896,
29900,
8443,
13,
29886,
1742,
29918,
1643,
29889,
7720,
29898,
798,
29922,
29941,
29892,
1897,
29922,
29900,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
282,
3714,
29922,
29896,
29900,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
29886,
1742,
29918,
8269,
353,
18883,
29889,
9634,
29898,
21064,
29918,
2557,
29892,
1426,
11918,
29922,
10048,
29892,
2920,
29922,
29941,
29900,
8443,
13,
29886,
1742,
29918,
8269,
29889,
7720,
29898,
798,
29922,
29941,
29892,
1897,
29922,
29896,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
282,
3714,
29922,
29896,
29900,
8443,
13,
30004,
13,
29937,
14971,
11025,
30004,
13,
2962,
29918,
11490,
29945,
29918,
7290,
353,
18883,
29889,
3125,
29898,
21064,
29918,
2557,
29892,
1426,
2433,
17918,
16535,
742,
2920,
29922,
29906,
29900,
29892,
1899,
29922,
6915,
29918,
10149,
8443,
13,
2962,
29918,
11490,
29945,
29918,
7290,
29889,
7720,
29898,
798,
29922,
29946,
29892,
1897,
29922,
29896,
29892,
282,
3714,
29922,
29945,
29892,
17132,
29916,
29922,
29896,
29945,
29892,
1897,
9653,
29922,
29906,
8443,
13,
30004,
13,
29937,
3150,
11909,
30004,
13,
1066,
29918,
14144,
29918,
1643,
353,
18883,
29889,
4775,
29898,
17662,
29918,
2557,
29892,
1426,
2433,
8003,
25577,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29906,
511,
282,
3714,
29922,
29945,
467,
7720,
29898,
798,
29922,
29900,
29892,
1897,
29922,
29896,
29892,
1897,
9653,
29922,
29941,
29892,
282,
3714,
29922,
29945,
29892,
17132,
29916,
29922,
29896,
29945,
29900,
8443,
13,
1066,
29918,
1761,
353,
18883,
29889,
1293,
1884,
29898,
17662,
29918,
2557,
29892,
3171,
29922,
29896,
29900,
29892,
2920,
29922,
29955,
29900,
29892,
11466,
29922,
29900,
8443,
13,
1066,
29918,
1761,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29896,
29892,
1897,
9653,
29922,
29906,
29892,
17132,
29916,
29922,
29896,
29900,
29892,
282,
3714,
29922,
29896,
29900,
8443,
13,
30004,
13,
29937,
15263,
5235,
30004,
13,
1885,
29918,
3888,
353,
18883,
29889,
4775,
29898,
13609,
29918,
2557,
29892,
1426,
2433,
15263,
22140,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29906,
511,
282,
3714,
29922,
29945,
467,
7720,
29898,
798,
29922,
29900,
29892,
1897,
29922,
29896,
29892,
1897,
9653,
29922,
29906,
29892,
17132,
29916,
29922,
29955,
29900,
29892,
282,
3714,
29922,
29896,
29900,
8443,
13,
13082,
29918,
2974,
29918,
7290,
353,
18883,
29889,
3125,
29898,
13609,
29918,
2557,
29892,
1426,
2433,
17918,
5656,
742,
2920,
29922,
29896,
29945,
29892,
1899,
29922,
2962,
6004,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
13082,
29918,
2974,
29918,
7290,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29900,
29892,
1897,
9653,
29922,
29906,
29892,
17132,
29916,
29922,
29896,
29900,
29892,
282,
3714,
29922,
29945,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
8443,
13,
30004,
13,
29937,
3802,
29918,
1066,
29918,
7290,
353,
18883,
29889,
3125,
29898,
13609,
29918,
2557,
29892,
1426,
2433,
11123,
20627,
742,
2920,
29922,
29896,
29941,
29892,
1899,
29922,
5358,
6585,
8003,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
29937,
3802,
29918,
1066,
29918,
7290,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29941,
29892,
12070,
29891,
29922,
11178,
29889,
29923,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
30004,
13,
3888,
29918,
1646,
29918,
1643,
353,
18883,
29889,
4775,
29898,
13609,
29918,
2557,
29892,
1426,
2433,
3401,
2261,
742,
4079,
29922,
877,
8934,
742,
29871,
29896,
29906,
511,
282,
3714,
29922,
29945,
467,
7720,
29898,
798,
29922,
29906,
29892,
1897,
29922,
29900,
29892,
12070,
29891,
29922,
11178,
29889,
29956,
29892,
17132,
29916,
29922,
29896,
29900,
8443,
13,
3888,
29918,
1646,
29918,
1884,
353,
18883,
29889,
1293,
1884,
29898,
13609,
29918,
2557,
29892,
3171,
29922,
29941,
29892,
2920,
29922,
29941,
29900,
467,
7720,
29898,
798,
29922,
29906,
29892,
1897,
29922,
29896,
29892,
17132,
29916,
29922,
29945,
29892,
282,
3714,
29922,
29896,
29900,
8443,
13,
30004,
13,
2158,
877,
29961,
25826,
4214,
29962,
7835,
18379,
1495,
30004,
13,
29918,
7165,
29889,
3396,
7888,
26471,
13,
2
] |
2019_Challenges/Week 03-21/JimPriorWordSearch.py | cohpy/DoJo-Challenges | 2 | 75472 | """
<NAME>'s solution to the DoJo problem of March 21,2019.
"""
from itertools import chain
def is_word_in_array(word, array):
left_to_right_strings = (''.join(row) for row in array)
top_to_bottom_strings = (''.join(column) for column in zip(*array))
all_strings = chain(left_to_right_strings, top_to_bottom_strings)
return any (word in candidate for candidate in all_strings)
def is_word_in_array2(word, array):
rows = map(lambda row: ''.join(row), array)
columns = map(lambda column: ''.join(column), zip(*array))
return (
any(map(lambda row: word in row, rows))
or
any(map(lambda column: word in column, columns))
)
def is_word_in_array3(word, array):
return any (
word in s
for s in [
''.join(row) for row in array
] + [
''.join(column) for column in zip(*array)
]
)
if __name__ == '__main__':
matrix = [
['F', 'A', 'C', 'I', ],
['O', 'B', 'O', 'P', ],
['A', 'N', 'O', 'B', ],
['M', 'A', 'S', 'S', ],
]
print(is_word_in_array('FOAM', matrix))
print(is_word_in_array('MASS', matrix))
print(is_word_in_array2('FOAM', matrix))
print(is_word_in_array2('MASS', matrix))
print(is_word_in_array3('FOAM', matrix))
print(is_word_in_array3('MASS', matrix))
| [
1,
9995,
13,
29966,
5813,
16299,
29879,
1650,
304,
278,
1938,
10844,
1108,
310,
4779,
29871,
29906,
29896,
29892,
29906,
29900,
29896,
29929,
29889,
13,
15945,
29908,
13,
13,
3166,
4256,
8504,
1053,
9704,
13,
13,
1753,
338,
29918,
1742,
29918,
262,
29918,
2378,
29898,
1742,
29892,
1409,
1125,
13,
1678,
2175,
29918,
517,
29918,
1266,
29918,
19651,
353,
6702,
4286,
7122,
29898,
798,
29897,
363,
1948,
297,
1409,
29897,
13,
1678,
2246,
29918,
517,
29918,
8968,
29918,
19651,
353,
6702,
4286,
7122,
29898,
4914,
29897,
363,
1897,
297,
14319,
10456,
2378,
876,
13,
1678,
599,
29918,
19651,
353,
9704,
29898,
1563,
29918,
517,
29918,
1266,
29918,
19651,
29892,
2246,
29918,
517,
29918,
8968,
29918,
19651,
29897,
13,
1678,
736,
738,
313,
1742,
297,
14020,
363,
14020,
297,
599,
29918,
19651,
29897,
13,
13,
1753,
338,
29918,
1742,
29918,
262,
29918,
2378,
29906,
29898,
1742,
29892,
1409,
1125,
13,
1678,
4206,
353,
2910,
29898,
2892,
29871,
1948,
29901,
525,
4286,
7122,
29898,
798,
511,
1409,
29897,
13,
1678,
4341,
353,
2910,
29898,
2892,
1897,
29901,
525,
4286,
7122,
29898,
4914,
511,
14319,
10456,
2378,
876,
13,
1678,
736,
313,
13,
4706,
738,
29898,
1958,
29898,
2892,
1948,
29901,
1734,
297,
1948,
29892,
4206,
876,
13,
4706,
470,
13,
4706,
738,
29898,
1958,
29898,
2892,
1897,
29901,
1734,
297,
1897,
29892,
4341,
876,
13,
1678,
1723,
13,
13,
13,
1753,
338,
29918,
1742,
29918,
262,
29918,
2378,
29941,
29898,
1742,
29892,
1409,
1125,
13,
1678,
736,
738,
313,
13,
4706,
1734,
297,
269,
13,
4706,
363,
269,
297,
518,
13,
9651,
525,
4286,
7122,
29898,
798,
29897,
363,
1948,
297,
1409,
13,
4706,
4514,
718,
518,
13,
9651,
525,
4286,
7122,
29898,
4914,
29897,
363,
1897,
297,
14319,
10456,
2378,
29897,
13,
4706,
4514,
13,
1678,
1723,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4636,
353,
518,
13,
4706,
6024,
29943,
742,
525,
29909,
742,
525,
29907,
742,
525,
29902,
742,
21251,
13,
4706,
6024,
29949,
742,
525,
29933,
742,
525,
29949,
742,
525,
29925,
742,
21251,
13,
4706,
6024,
29909,
742,
525,
29940,
742,
525,
29949,
742,
525,
29933,
742,
21251,
13,
4706,
6024,
29924,
742,
525,
29909,
742,
525,
29903,
742,
525,
29903,
742,
21251,
13,
1678,
4514,
13,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
877,
5800,
5194,
742,
4636,
876,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
877,
1529,
1799,
742,
4636,
876,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
29906,
877,
5800,
5194,
742,
4636,
876,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
29906,
877,
1529,
1799,
742,
4636,
876,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
29941,
877,
5800,
5194,
742,
4636,
876,
13,
1678,
1596,
29898,
275,
29918,
1742,
29918,
262,
29918,
2378,
29941,
877,
1529,
1799,
742,
4636,
876,
13,
2
] |
mumblr/templatetags/mumblr_tags.py | hmarr/django-mumblr | 35 | 28461 | <reponame>hmarr/django-mumblr
from django.template import Library, Node, TemplateSyntaxError
import re
from mumblr.entrytypes import EntryType
register = Library()
class LatestEntriesNode(Node):
def __init__(self, num, var_name):
self.num = int(num or 10)
self.var_name = var_name
def render(self, context):
context[self.var_name] = list(EntryType.live_entries()[:self.num])
return ''
@register.tag
def get_latest_entries(parser, token):
# Usage:
# {% get_latest_entries as entries %} (default 10 entries)
# (or {% get_latest_entries 7 as entries %} for 7 entries)
# {% for entry in entries %}
# <li>{{ entry.title }}</li>
# {% endfor %}
tag_name, contents = token.contents.split(None, 1)
match = re.search(r'(\d+\s+)?as\s+([A-z_][A-z0-9_]+)', contents)
if not match:
raise TemplateSyntaxError("%r tag syntax error" % tag_name)
num, var_name = match.groups()
return LatestEntriesNode(num, var_name)
| [
1,
529,
276,
1112,
420,
29958,
7184,
2749,
29914,
14095,
29899,
29885,
398,
2204,
29878,
13,
3166,
9557,
29889,
6886,
1053,
9538,
29892,
9071,
29892,
25663,
16676,
2392,
13,
13,
5215,
337,
13,
13,
3166,
286,
398,
2204,
29878,
29889,
8269,
8768,
1053,
28236,
1542,
13,
13,
9573,
353,
9538,
580,
13,
13,
13,
1990,
7053,
342,
5292,
2722,
4247,
29898,
4247,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
954,
29892,
722,
29918,
978,
1125,
13,
4706,
1583,
29889,
1949,
353,
938,
29898,
1949,
470,
29871,
29896,
29900,
29897,
13,
4706,
1583,
29889,
1707,
29918,
978,
353,
722,
29918,
978,
13,
13,
1678,
822,
4050,
29898,
1311,
29892,
3030,
1125,
13,
4706,
3030,
29961,
1311,
29889,
1707,
29918,
978,
29962,
353,
1051,
29898,
9634,
1542,
29889,
9258,
29918,
26586,
580,
7503,
1311,
29889,
1949,
2314,
13,
4706,
736,
6629,
13,
13,
13,
29992,
9573,
29889,
4039,
13,
1753,
679,
29918,
12333,
29918,
26586,
29898,
16680,
29892,
5993,
1125,
13,
1678,
396,
10783,
482,
29901,
13,
1678,
396,
259,
18674,
679,
29918,
12333,
29918,
26586,
408,
9976,
15493,
313,
4381,
29871,
29896,
29900,
9976,
29897,
13,
1678,
396,
259,
313,
272,
18674,
679,
29918,
12333,
29918,
26586,
29871,
29955,
408,
9976,
15493,
363,
29871,
29955,
9976,
29897,
13,
1678,
396,
259,
18674,
363,
6251,
297,
9976,
15493,
13,
1678,
396,
539,
529,
492,
29958,
6224,
6251,
29889,
3257,
9156,
829,
492,
29958,
13,
1678,
396,
259,
18674,
1095,
1454,
15493,
13,
1678,
4055,
29918,
978,
29892,
8118,
353,
5993,
29889,
10853,
29889,
5451,
29898,
8516,
29892,
29871,
29896,
29897,
13,
1678,
1993,
353,
337,
29889,
4478,
29898,
29878,
29915,
1194,
29881,
3124,
29879,
29974,
6877,
294,
29905,
29879,
29974,
4197,
29909,
29899,
29920,
29918,
3816,
29909,
29899,
29920,
29900,
29899,
29929,
29918,
10062,
29897,
742,
8118,
29897,
13,
1678,
565,
451,
1993,
29901,
13,
4706,
12020,
25663,
16676,
2392,
11702,
29878,
4055,
5877,
1059,
29908,
1273,
4055,
29918,
978,
29897,
13,
13,
1678,
954,
29892,
722,
29918,
978,
353,
1993,
29889,
13155,
580,
13,
1678,
736,
7053,
342,
5292,
2722,
4247,
29898,
1949,
29892,
722,
29918,
978,
29897,
13,
2
] |
source/lib/waflibv2.py | subanishaik27/aws-waf | 678 | 70171 | ######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance #
# with the License. A copy of the License is located at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES #
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions #
# and limitations under the License. #
######################################################################################################################
# import boto3
# from botocore.config import Config
from botocore.exceptions import ClientError
from ipaddress import ip_address
from backoff import on_exception, expo, full_jitter
from lib.boto3_util import create_client
API_CALL_NUM_RETRIES = 5
MAX_TIME = 20
client = create_client('wafv2')
class WAFLIBv2(object):
def __init__(self):
return
# Parse arn into ip_set_id
def arn_to_id(self, arn):
if arn == None:
return None
tmp = arn.split('/')
return tmp.pop()
# Determine network version for source_ip
def which_ip_version(self, log, source_ip):
if source_ip == None:
return None
try:
source_ip = source_ip.strip()
ip_type = "IPV%s"%ip_address(source_ip).version
return ip_type
except Exception as e:
log.error("Source ip %s is not IPV4 or IPV6.", str(source_ip))
log.error(str(e))
return None
# Append correct cidr to source_ip
def set_ip_cidr(self, log, source_ip):
if source_ip == None:
return None
try:
source_ip = source_ip.strip()
ip_type = "IPV%s"%ip_address(source_ip).version
except Exception as e:
log.error("Source ip %s is not IPV4 or IPV6.", str(source_ip))
log.error(str(e))
return None
ip_class = "32" if ip_type == "IPV4" else "128"
return str(source_ip)+"/"+str(ip_class)
# Retrieve IPSet given an ip_set_id
def get_ip_set_by_id(self, log, scope, name, ip_set_id):
try:
log.debug("[waflib:get_ip_set_by_id] Start")
response = client.get_ip_set(
Scope=scope,
Name=name,
Id=ip_set_id
)
log.debug("[waflib:get_ip_set_by_id] got ip set: \n{}.".format(response))
log.debug("[waflib:get_ip_set_by_id] End")
return response
except Exception as e:
log.error("[waflib:get_ip_set_by_id] Failed to get IPSet %s", str(ip_set_id))
log.error(str(e))
return None
# Retrieve IPSet given an ip set arn
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def get_ip_set(self, log, scope, name, arn):
try:
log.info("[waflib:get_ip_set] Start")
ip_set_id = self.arn_to_id(arn)
response = client.get_ip_set(
Scope=scope,
Name=name,
Id=ip_set_id
)
log.info("[waflib:get_ip_set] End")
return response
except Exception as e:
log.error("Failed to get IPSet %s", str(ip_set_id))
log.error(str(e))
return None
# Retrieve addresses based on ip_set_id
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def get_addresses(self, log, scope, name, arn):
try:
response = self.get_ip_set(log, scope, name, arn)
addresses = response["IPSet"]["Addresses"]
return addresses
except Exception as e:
log.error("Failed to get addresses for ARN %s", str(arn))
log.error(str(e))
return None
# Update addresses in an IPSet using ip set id
@on_exception(expo, client.exceptions.WAFOptimisticLockException,
max_time=MAX_TIME,
jitter=full_jitter,
max_tries=API_CALL_NUM_RETRIES)
def update_ip_set_by_id(self, log, scope, name, ip_set_id, addresses, lock_token, description):
log.debug("[waflib:update_ip_set_by_id] Start")
try:
response = client.update_ip_set(
Scope=scope,
Name=name,
Id=ip_set_id,
Addresses=addresses,
LockToken=lock_token,
Description=description
)
log.debug("[waflib:update_ip_set_by_id] update ip set response: \n{}.".format(response))
log.debug("[waflib:update_ip_set_by_id] End")
return response
# Get the latest ip set and retry updating api call when OptimisticLockException occurs
except ClientError as ex:
exception_type = ex.response['Error']['Code']
if exception_type in ['OptimisticLockException']:
log.info("[waflib:update_ip_set_by_id] OptimisticLockException detected. Get the latest ip set and retry updating ip set.")
ip_set = self.get_ip_set_by_id(log, scope, name, ip_set_id)
lock_token = ip_set['LockToken']
response = client.update_ip_set(
Scope=scope,
Name=name,
Id=ip_set_id,
Addresses=addresses,
LockToken=lock_token,
Description=description
)
log.debug("[waflib:update_ip_set_id] End")
return response
except Exception as e:
log.error(e)
log.error("[waflib:update_ip_set_by_id] Failed to update IPSet: %s", str(ip_set_id))
return None
# Update addresses in an IPSet using ip set arn
@on_exception(expo, client.exceptions.WAFOptimisticLockException,
max_time=MAX_TIME,
jitter=full_jitter,
max_tries=API_CALL_NUM_RETRIES)
def update_ip_set(self, log, scope, name, ip_set_arn, addresses):
log.info("[waflib:update_ip_set] Start")
if (ip_set_arn is None or name is None):
log.error("No IPSet found for: %s ", str(ip_set_arn))
return None
try:
# convert from arn to ip_set_id
ip_set_id = self.arn_to_id(ip_set_arn)
# retrieve the ipset to get a locktoken
ip_set = self.get_ip_set(log, scope, name, ip_set_arn)
lock_token = ip_set['LockToken']
description = ip_set['IPSet']['Description']
log.info("Updating IPSet with description: %s, lock token: %s", str(description), str(lock_token))
response = client.update_ip_set(
Scope=scope,
Name=name,
Description=description,
Id=ip_set_id,
Addresses=addresses,
LockToken=lock_token
)
new_ip_set = self.get_ip_set(log, scope, name, ip_set_id)
log.debug("[waflib:update_ip_set] update ip set response:\n{}".format(response))
log.info("[waflib:update_ip_set] End")
return new_ip_set
except Exception as e:
log.error(e)
log.error("Failed to update IPSet: %s", str(ip_set_id))
return None
# Put Log Configuration for webacl
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def put_logging_configuration(self, log, web_acl_arn, delivery_stream_arn):
try:
response = client.put_logging_configuration(
LoggingConfiguration={
'ResourceArn': web_acl_arn,
'LogDestinationConfigs': [delivery_stream_arn]
}
)
return response
except Exception as e:
log.error("Failed to configure log for WebAcl: %s", str(web_acl_arn))
log.error(str(e))
return None
# Delete Log Configuration for webacl
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def delete_logging_configuration(self, log, web_acl_arn):
try:
response = client.delete_logging_configuration(
ResourceArn=web_acl_arn
)
return response
except Exception as e:
log.error("Failed to delete log for WebAcl: %s", str(web_acl_arn))
log.error(str(e))
return None
# List webacls
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def list_web_acls(self, log, scope):
try:
response = client.list_web_acls(
Scope=scope
)
return response
except Exception as e:
log.error("Failed to list WebAcld in scope: %s", str(scope))
log.error(str(e))
return None
# log when retry is stopped
# def give_up_retry(self, log, e):
# log.error("Giving up retry after %s times.",str(API_CALL_NUM_RETRIES))
# log.error(e)
#################################################################
# Following functions only used for testing, not in WAF Solution
#################################################################
@on_exception(expo,
(client.exceptions.WAFInternalErrorException,
client.exceptions.WAFOptimisticLockException,
client.exceptions.WAFLimitsExceededException),
max_time=MAX_TIME)
def create_ip_set(self, log, scope, name, description, version, addresses):
try:
response = client.create_ip_set(
Scope=scope,
Name=name,
Description=description,
IPAddressVersion=version,
Addresses=addresses
)
return response
except Exception as e:
log.error("Failed to create IPSet: %s", str(name))
log.error(str(e))
return None
@on_exception(expo,
(client.exceptions.WAFInternalErrorException,
client.exceptions.WAFOptimisticLockException,
client.exceptions.WAFAssociatedItemException),
max_time=MAX_TIME)
def delete_ip_set(self, log, scope, name, ip_set_id):
try:
response = self.get_ip_set(log, scope, name, ip_set_id)
if response is not None:
lock_token = response['LockToken']
response = client.delete_ip_set(
Scope=scope,
Name=name,
LockToken=lock_token,
Id=ip_set_id
)
return response
except Exception as e:
log.error("Failed to delete IPSet: %s", str(name))
log.error(str(e))
return None
@on_exception(expo, client.exceptions.WAFInternalErrorException, max_time=MAX_TIME)
def list_ip_sets(self, log, scope, marker=None):
try:
response = None
if marker == None:
response = client.list_ip_sets(
Scope=scope,
Limit=50
)
else:
response = client.list_ip_sets(
Scope=scope,
NextMarker=marker,
Limit=50
)
return response
except Exception as e:
log.error("Failed to list IPSets in scope: %s", str(scope))
log.error(str(e))
return None | [
1,
835,
13383,
13383,
13383,
13383,
13383,
13383,
13383,
2277,
29937,
13,
29937,
29871,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
16631,
29889,
510,
29892,
9266,
29889,
470,
967,
23736,
1078,
29889,
2178,
26863,
2538,
9841,
29889,
462,
462,
965,
396,
13,
29937,
462,
462,
462,
462,
462,
462,
462,
1678,
396,
13,
29937,
29871,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
2564,
887,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
1678,
396,
13,
29937,
29871,
411,
278,
19245,
29889,
319,
3509,
310,
278,
19245,
338,
5982,
472,
462,
462,
462,
632,
396,
13,
29937,
462,
462,
462,
462,
462,
462,
462,
1678,
396,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
462,
462,
462,
462,
1678,
396,
13,
29937,
462,
462,
462,
462,
462,
462,
462,
1678,
396,
13,
29937,
29871,
470,
297,
278,
376,
506,
1947,
29908,
934,
10259,
1384,
292,
445,
934,
29889,
910,
934,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
396,
13,
29937,
29871,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
4653,
470,
2411,
2957,
29889,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
1678,
396,
13,
29937,
29871,
322,
27028,
1090,
278,
19245,
29889,
462,
462,
462,
462,
18884,
396,
13,
13383,
13383,
13383,
13383,
13383,
13383,
13383,
4136,
2277,
13,
29937,
1053,
289,
3747,
29941,
13,
29937,
515,
9225,
542,
487,
29889,
2917,
1053,
12782,
13,
3166,
9225,
542,
487,
29889,
11739,
29879,
1053,
12477,
2392,
13,
3166,
10377,
7328,
1053,
10377,
29918,
7328,
13,
3166,
1250,
2696,
1053,
373,
29918,
11739,
29892,
429,
1129,
29892,
2989,
29918,
29926,
5171,
13,
3166,
4303,
29889,
29890,
3747,
29941,
29918,
4422,
1053,
1653,
29918,
4645,
13,
13,
8787,
29918,
29907,
9818,
29918,
13967,
29918,
1525,
29911,
3960,
2890,
353,
29871,
29945,
13,
12648,
29918,
15307,
353,
29871,
29906,
29900,
13,
13,
4645,
353,
1653,
29918,
4645,
877,
29893,
2142,
29894,
29906,
1495,
13,
13,
1990,
399,
5098,
5265,
29933,
29894,
29906,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
736,
13,
13,
1678,
396,
20969,
564,
29876,
964,
10377,
29918,
842,
29918,
333,
13,
1678,
822,
564,
29876,
29918,
517,
29918,
333,
29898,
1311,
29892,
564,
29876,
1125,
13,
4706,
565,
564,
29876,
1275,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
13128,
353,
564,
29876,
29889,
5451,
11219,
1495,
13,
4706,
736,
13128,
29889,
7323,
580,
13,
268,
13,
1678,
396,
5953,
837,
457,
3564,
1873,
363,
2752,
29918,
666,
13,
1678,
822,
607,
29918,
666,
29918,
3259,
29898,
1311,
29892,
1480,
29892,
2752,
29918,
666,
1125,
13,
4706,
565,
2752,
29918,
666,
1275,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
1018,
29901,
13,
9651,
2752,
29918,
666,
353,
2752,
29918,
666,
29889,
17010,
580,
13,
9651,
10377,
29918,
1853,
353,
376,
5690,
29963,
29995,
29879,
29908,
29995,
666,
29918,
7328,
29898,
4993,
29918,
666,
467,
3259,
13,
9651,
736,
10377,
29918,
1853,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
4435,
10377,
1273,
29879,
338,
451,
5641,
29963,
29946,
470,
5641,
29963,
29953,
19602,
851,
29898,
4993,
29918,
666,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
268,
13,
1678,
396,
22871,
1959,
274,
333,
29878,
304,
2752,
29918,
666,
13,
1678,
822,
731,
29918,
666,
29918,
25232,
29878,
29898,
1311,
29892,
1480,
29892,
2752,
29918,
666,
1125,
13,
4706,
565,
2752,
29918,
666,
1275,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
1018,
29901,
13,
9651,
2752,
29918,
666,
353,
2752,
29918,
666,
29889,
17010,
580,
13,
9651,
10377,
29918,
1853,
353,
376,
5690,
29963,
29995,
29879,
29908,
29995,
666,
29918,
7328,
29898,
4993,
29918,
666,
467,
3259,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
4435,
10377,
1273,
29879,
338,
451,
5641,
29963,
29946,
470,
5641,
29963,
29953,
19602,
851,
29898,
4993,
29918,
666,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
308,
13,
4706,
10377,
29918,
1990,
353,
376,
29941,
29906,
29908,
565,
10377,
29918,
1853,
1275,
376,
5690,
29963,
29946,
29908,
1683,
376,
29896,
29906,
29947,
29908,
13,
4706,
736,
851,
29898,
4993,
29918,
666,
7240,
29908,
12975,
29974,
710,
29898,
666,
29918,
1990,
29897,
13,
13,
1678,
396,
4649,
29878,
2418,
5641,
2697,
2183,
385,
10377,
29918,
842,
29918,
333,
13,
1678,
822,
679,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
1125,
13,
4706,
1018,
29901,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
7370,
1159,
13,
9651,
2933,
353,
3132,
29889,
657,
29918,
666,
29918,
842,
29898,
13,
18884,
317,
4338,
29922,
6078,
29892,
13,
18884,
4408,
29922,
978,
29892,
13,
18884,
5163,
29922,
666,
29918,
842,
29918,
333,
13,
9651,
1723,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
2355,
10377,
731,
29901,
320,
29876,
8875,
1213,
29889,
4830,
29898,
5327,
876,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
2796,
1159,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
18390,
304,
679,
5641,
2697,
1273,
29879,
613,
851,
29898,
666,
29918,
842,
29918,
333,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
632,
13,
1678,
396,
4649,
29878,
2418,
5641,
2697,
2183,
385,
10377,
731,
564,
29876,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
679,
29918,
666,
29918,
842,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
564,
29876,
1125,
13,
4706,
1018,
29901,
13,
9651,
1480,
29889,
3888,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29962,
7370,
1159,
13,
9651,
10377,
29918,
842,
29918,
333,
353,
1583,
29889,
2753,
29918,
517,
29918,
333,
29898,
2753,
29897,
13,
9651,
2933,
353,
3132,
29889,
657,
29918,
666,
29918,
842,
29898,
13,
18884,
317,
4338,
29922,
6078,
29892,
13,
18884,
4408,
29922,
978,
29892,
13,
18884,
5163,
29922,
666,
29918,
842,
29918,
333,
13,
9651,
1723,
13,
9651,
1480,
29889,
3888,
703,
29961,
29893,
2142,
1982,
29901,
657,
29918,
666,
29918,
842,
29962,
2796,
1159,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
679,
5641,
2697,
1273,
29879,
613,
851,
29898,
666,
29918,
842,
29918,
333,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
396,
4649,
29878,
2418,
14157,
2729,
373,
10377,
29918,
842,
29918,
333,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
679,
29918,
7328,
267,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
564,
29876,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
1583,
29889,
657,
29918,
666,
29918,
842,
29898,
1188,
29892,
6874,
29892,
1024,
29892,
564,
29876,
29897,
13,
9651,
14157,
353,
2933,
3366,
5690,
2697,
3108,
3366,
7061,
267,
3108,
13,
9651,
736,
14157,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
679,
14157,
363,
9033,
29940,
1273,
29879,
613,
851,
29898,
2753,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
396,
10318,
14157,
297,
385,
5641,
2697,
773,
10377,
731,
1178,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
20624,
326,
4695,
16542,
2451,
29892,
13,
795,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29892,
13,
795,
432,
5171,
29922,
8159,
29918,
29926,
5171,
29892,
13,
795,
4236,
29918,
29873,
2722,
29922,
8787,
29918,
29907,
9818,
29918,
13967,
29918,
1525,
29911,
3960,
2890,
29897,
13,
1678,
822,
2767,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
29892,
14157,
29892,
7714,
29918,
6979,
29892,
6139,
1125,
13,
4706,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
7370,
1159,
13,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
3132,
29889,
5504,
29918,
666,
29918,
842,
29898,
13,
18884,
317,
4338,
29922,
6078,
29892,
13,
18884,
4408,
29922,
978,
29892,
13,
18884,
5163,
29922,
666,
29918,
842,
29918,
333,
29892,
13,
18884,
16428,
267,
29922,
7328,
267,
29892,
13,
18884,
18199,
6066,
29922,
908,
29918,
6979,
29892,
13,
18884,
12953,
29922,
8216,
13,
9651,
1723,
13,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
2767,
10377,
731,
2933,
29901,
320,
29876,
8875,
1213,
29889,
4830,
29898,
5327,
876,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
2796,
1159,
13,
9651,
736,
2933,
13,
4706,
396,
3617,
278,
9281,
10377,
731,
322,
337,
2202,
13271,
7882,
1246,
746,
20693,
326,
4695,
16542,
2451,
10008,
13,
4706,
5174,
12477,
2392,
408,
429,
29901,
13,
9651,
3682,
29918,
1853,
353,
429,
29889,
5327,
1839,
2392,
16215,
3399,
2033,
13,
9651,
565,
3682,
29918,
1853,
297,
6024,
20624,
326,
4695,
16542,
2451,
2033,
29901,
13,
18884,
1480,
29889,
3888,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
20693,
326,
4695,
16542,
2451,
17809,
29889,
3617,
278,
9281,
10377,
731,
322,
337,
2202,
13271,
10377,
731,
23157,
13,
18884,
10377,
29918,
842,
353,
1583,
29889,
657,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29898,
1188,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
29897,
13,
18884,
7714,
29918,
6979,
353,
10377,
29918,
842,
1839,
16542,
6066,
2033,
13,
13,
18884,
2933,
353,
3132,
29889,
5504,
29918,
666,
29918,
842,
29898,
13,
462,
1678,
317,
4338,
29922,
6078,
29892,
13,
462,
1678,
4408,
29922,
978,
29892,
13,
462,
1678,
5163,
29922,
666,
29918,
842,
29918,
333,
29892,
13,
462,
1678,
16428,
267,
29922,
7328,
267,
29892,
13,
462,
1678,
18199,
6066,
29922,
908,
29918,
6979,
29892,
13,
462,
1678,
12953,
29922,
8216,
13,
18884,
1723,
13,
18884,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
333,
29962,
2796,
1159,
13,
18884,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
29898,
29872,
29897,
13,
9651,
1480,
29889,
2704,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29918,
1609,
29918,
333,
29962,
18390,
304,
2767,
5641,
2697,
29901,
1273,
29879,
613,
851,
29898,
666,
29918,
842,
29918,
333,
876,
13,
9651,
736,
6213,
13,
13,
632,
13,
1678,
396,
10318,
14157,
297,
385,
5641,
2697,
773,
10377,
731,
564,
29876,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
20624,
326,
4695,
16542,
2451,
29892,
13,
9651,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29892,
13,
9651,
432,
5171,
29922,
8159,
29918,
29926,
5171,
29892,
13,
9651,
4236,
29918,
29873,
2722,
29922,
8787,
29918,
29907,
9818,
29918,
13967,
29918,
1525,
29911,
3960,
2890,
29897,
13,
1678,
822,
2767,
29918,
666,
29918,
842,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
2753,
29892,
14157,
1125,
13,
4706,
1480,
29889,
3888,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29962,
7370,
1159,
13,
4706,
565,
313,
666,
29918,
842,
29918,
2753,
338,
6213,
470,
1024,
338,
6213,
1125,
13,
9651,
1480,
29889,
2704,
703,
3782,
5641,
2697,
1476,
363,
29901,
1273,
29879,
9162,
851,
29898,
666,
29918,
842,
29918,
2753,
876,
13,
9651,
736,
6213,
13,
13,
4706,
1018,
29901,
13,
9651,
396,
3588,
515,
564,
29876,
304,
10377,
29918,
842,
29918,
333,
13,
9651,
10377,
29918,
842,
29918,
333,
353,
1583,
29889,
2753,
29918,
517,
29918,
333,
29898,
666,
29918,
842,
29918,
2753,
29897,
13,
13,
9651,
396,
10563,
278,
474,
567,
300,
304,
679,
263,
7714,
6979,
13,
9651,
10377,
29918,
842,
353,
1583,
29889,
657,
29918,
666,
29918,
842,
29898,
1188,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
2753,
29897,
13,
9651,
7714,
29918,
6979,
353,
10377,
29918,
842,
1839,
16542,
6066,
2033,
13,
9651,
6139,
353,
10377,
29918,
842,
1839,
5690,
2697,
16215,
9868,
2033,
13,
9651,
1480,
29889,
3888,
703,
3373,
26747,
5641,
2697,
411,
6139,
29901,
1273,
29879,
29892,
7714,
5993,
29901,
1273,
29879,
613,
851,
29898,
8216,
511,
851,
29898,
908,
29918,
6979,
876,
13,
13,
9651,
2933,
353,
3132,
29889,
5504,
29918,
666,
29918,
842,
29898,
13,
18884,
317,
4338,
29922,
6078,
29892,
13,
18884,
4408,
29922,
978,
29892,
13,
18884,
12953,
29922,
8216,
29892,
13,
18884,
5163,
29922,
666,
29918,
842,
29918,
333,
29892,
13,
18884,
16428,
267,
29922,
7328,
267,
29892,
13,
18884,
18199,
6066,
29922,
908,
29918,
6979,
13,
9651,
1723,
13,
13,
9651,
716,
29918,
666,
29918,
842,
353,
1583,
29889,
657,
29918,
666,
29918,
842,
29898,
1188,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
29897,
13,
13,
9651,
1480,
29889,
8382,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29962,
2767,
10377,
731,
2933,
3583,
29876,
8875,
1642,
4830,
29898,
5327,
876,
13,
9651,
1480,
29889,
3888,
703,
29961,
29893,
2142,
1982,
29901,
5504,
29918,
666,
29918,
842,
29962,
2796,
1159,
13,
9651,
736,
716,
29918,
666,
29918,
842,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
29898,
29872,
29897,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
2767,
5641,
2697,
29901,
1273,
29879,
613,
851,
29898,
666,
29918,
842,
29918,
333,
876,
13,
9651,
736,
6213,
13,
632,
13,
268,
13,
1678,
396,
12065,
4522,
20999,
363,
1856,
562,
29880,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
1925,
29918,
21027,
29918,
13305,
29898,
1311,
29892,
1480,
29892,
1856,
29918,
562,
29880,
29918,
2753,
29892,
28289,
29918,
5461,
29918,
2753,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
3132,
29889,
649,
29918,
21027,
29918,
13305,
29898,
13,
18884,
4522,
3460,
8614,
3790,
13,
462,
1678,
525,
6848,
1433,
29876,
2396,
1856,
29918,
562,
29880,
29918,
2753,
29892,
13,
462,
1678,
525,
3403,
14994,
3381,
3991,
29879,
2396,
518,
29881,
27657,
29918,
5461,
29918,
2753,
29962,
13,
18884,
500,
13,
9651,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
10822,
1480,
363,
2563,
29909,
695,
29901,
1273,
29879,
613,
851,
29898,
2676,
29918,
562,
29880,
29918,
2753,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
396,
21267,
4522,
20999,
363,
1856,
562,
29880,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
5217,
29918,
21027,
29918,
13305,
29898,
1311,
29892,
1480,
29892,
1856,
29918,
562,
29880,
29918,
2753,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
3132,
29889,
8143,
29918,
21027,
29918,
13305,
29898,
13,
18884,
18981,
1433,
29876,
29922,
2676,
29918,
562,
29880,
29918,
2753,
13,
9651,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
5217,
1480,
363,
2563,
29909,
695,
29901,
1273,
29879,
613,
851,
29898,
2676,
29918,
562,
29880,
29918,
2753,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
396,
2391,
1856,
562,
3137,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
1051,
29918,
2676,
29918,
562,
3137,
29898,
1311,
29892,
1480,
29892,
6874,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
3132,
29889,
1761,
29918,
2676,
29918,
562,
3137,
29898,
13,
18884,
317,
4338,
29922,
6078,
13,
9651,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
1051,
2563,
10644,
430,
297,
6874,
29901,
1273,
29879,
613,
851,
29898,
6078,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
632,
13,
1678,
396,
1480,
746,
337,
2202,
338,
11084,
13,
1678,
396,
822,
2367,
29918,
786,
29918,
276,
2202,
29898,
1311,
29892,
1480,
29892,
321,
1125,
13,
1678,
396,
268,
1480,
29889,
2704,
703,
29954,
4357,
701,
337,
2202,
1156,
1273,
29879,
3064,
19602,
710,
29898,
8787,
29918,
29907,
9818,
29918,
13967,
29918,
1525,
29911,
3960,
2890,
876,
13,
1678,
396,
268,
1480,
29889,
2704,
29898,
29872,
29897,
13,
308,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
1678,
396,
12206,
3168,
871,
1304,
363,
6724,
29892,
451,
297,
399,
5098,
24380,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
13,
462,
29871,
313,
4645,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
13,
462,
259,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
20624,
326,
4695,
16542,
2451,
29892,
13,
462,
259,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
29931,
326,
1169,
1252,
3947,
287,
2451,
511,
13,
462,
29871,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
1653,
29918,
666,
29918,
842,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
6139,
29892,
1873,
29892,
14157,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
3132,
29889,
3258,
29918,
666,
29918,
842,
29898,
13,
18884,
317,
4338,
29922,
6078,
29892,
13,
18884,
4408,
29922,
978,
29892,
13,
18884,
12953,
29922,
8216,
29892,
13,
18884,
5641,
7061,
6594,
29922,
3259,
29892,
13,
18884,
16428,
267,
29922,
7328,
267,
13,
9651,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
1653,
5641,
2697,
29901,
1273,
29879,
613,
851,
29898,
978,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
13,
462,
29871,
313,
4645,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
13,
462,
259,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
20624,
326,
4695,
16542,
2451,
29892,
13,
462,
259,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
29254,
630,
2001,
2451,
511,
13,
462,
29871,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
5217,
29918,
666,
29918,
842,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
1583,
29889,
657,
29918,
666,
29918,
842,
29898,
1188,
29892,
6874,
29892,
1024,
29892,
10377,
29918,
842,
29918,
333,
29897,
965,
13,
9651,
565,
2933,
338,
451,
6213,
29901,
13,
18884,
7714,
29918,
6979,
353,
2933,
1839,
16542,
6066,
2033,
13,
18884,
2933,
353,
3132,
29889,
8143,
29918,
666,
29918,
842,
29898,
13,
462,
1678,
317,
4338,
29922,
6078,
29892,
13,
462,
1678,
4408,
29922,
978,
29892,
13,
462,
1678,
18199,
6066,
29922,
908,
29918,
6979,
29892,
13,
462,
1678,
5163,
29922,
666,
29918,
842,
29918,
333,
13,
18884,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
5217,
5641,
2697,
29901,
1273,
29879,
613,
851,
29898,
978,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
13,
13,
1678,
732,
265,
29918,
11739,
29898,
735,
1129,
29892,
3132,
29889,
11739,
29879,
29889,
29956,
5098,
16491,
2392,
2451,
29892,
4236,
29918,
2230,
29922,
12648,
29918,
15307,
29897,
13,
1678,
822,
1051,
29918,
666,
29918,
7224,
29898,
1311,
29892,
1480,
29892,
6874,
29892,
17456,
29922,
8516,
1125,
13,
4706,
1018,
29901,
13,
9651,
2933,
353,
6213,
13,
9651,
565,
17456,
1275,
6213,
29901,
13,
18884,
2933,
353,
3132,
29889,
1761,
29918,
666,
29918,
7224,
29898,
13,
462,
1678,
317,
4338,
29922,
6078,
29892,
13,
462,
1678,
9628,
277,
29922,
29945,
29900,
13,
18884,
1723,
13,
9651,
1683,
29901,
13,
18884,
2933,
353,
3132,
29889,
1761,
29918,
666,
29918,
7224,
29898,
13,
462,
1678,
317,
4338,
29922,
6078,
29892,
13,
462,
1678,
8084,
24619,
29922,
22976,
29892,
13,
462,
1678,
9628,
277,
29922,
29945,
29900,
13,
18884,
1723,
13,
9651,
736,
2933,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
2704,
703,
17776,
304,
1051,
5641,
29903,
1691,
297,
6874,
29901,
1273,
29879,
613,
851,
29898,
6078,
876,
13,
9651,
1480,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
9651,
736,
6213,
2
] |
learner2/pupil/migrations/0012_sessiondata.py | Arunkumar99/learners | 3 | 28049 | <reponame>Arunkumar99/learners
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pupil', '0011_questions_set_id'),
]
operations = [
migrations.CreateModel(
name='SessionData',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('user_id', models.IntegerField(default=0)),
('session_count', models.IntegerField(default=0)),
('result', models.CharField(max_length=10)),
('level', models.IntegerField(default=0)),
('performance1', models.ImageField(upload_to=b'')),
('performance2', models.ImageField(upload_to=b'')),
('performance3', models.ImageField(upload_to=b'')),
('csv_file', models.FileField(upload_to=b'')),
],
),
]
| [
1,
529,
276,
1112,
420,
29958,
1433,
2960,
24540,
29929,
29929,
29914,
1945,
8397,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
29886,
786,
309,
742,
525,
29900,
29900,
29896,
29896,
29918,
2619,
29918,
842,
29918,
333,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
7317,
1469,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
12300,
3073,
29898,
369,
15828,
29918,
978,
2433,
1367,
742,
28755,
29922,
8824,
29892,
4469,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
8243,
13,
18884,
6702,
1792,
29918,
333,
742,
4733,
29889,
7798,
3073,
29898,
4381,
29922,
29900,
8243,
13,
18884,
6702,
7924,
29918,
2798,
742,
4733,
29889,
7798,
3073,
29898,
4381,
29922,
29900,
8243,
13,
18884,
6702,
2914,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
8243,
13,
18884,
6702,
5563,
742,
4733,
29889,
7798,
3073,
29898,
4381,
29922,
29900,
8243,
13,
18884,
6702,
546,
13390,
29896,
742,
4733,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
29890,
29915,
1495,
511,
13,
18884,
6702,
546,
13390,
29906,
742,
4733,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
29890,
29915,
1495,
511,
13,
18884,
6702,
546,
13390,
29941,
742,
4733,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
29890,
29915,
1495,
511,
13,
18884,
6702,
7638,
29918,
1445,
742,
4733,
29889,
2283,
3073,
29898,
9009,
29918,
517,
29922,
29890,
29915,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
testproject/users/serializers.py | joshua-hashimoto/django-channels-jwt-auth-middleware | 9 | 161776 | <filename>testproject/users/serializers.py
from django.contrib.auth import get_user_model
from dj_rest_auth.serializers import UserDetailsSerializer
from rest_framework.serializers import ModelSerializer, SerializerMethodField
User = get_user_model()
class UserSerializer(ModelSerializer):
profile_image = SerializerMethodField()
class Meta:
model = User
fields = (
'id',
'profile_image',
'username',
'email',
)
def get_profile_image(self, obj):
if (profile_image := obj.profile_image):
return profile_image.url
else:
return None
class CustomUserDetailSerializer(UserDetailsSerializer):
class Meta(UserDetailsSerializer.Meta):
fields = (
'id',
'profile_image',
'username',
'email',
)
def update(self, instance, validated_data):
"""
Note:
change this method if you want to update user model.
in the case of this application this is not needed because
it already uses CustomUser. However it is worth keeping memo.
"""
return super().update(instance, validated_data)
| [
1,
529,
9507,
29958,
1688,
4836,
29914,
7193,
29914,
15550,
19427,
29889,
2272,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
679,
29918,
1792,
29918,
4299,
13,
3166,
270,
29926,
29918,
5060,
29918,
5150,
29889,
15550,
19427,
1053,
4911,
10602,
17679,
13,
3166,
1791,
29918,
4468,
29889,
15550,
19427,
1053,
8125,
17679,
29892,
18896,
3950,
4062,
3073,
13,
13,
13,
2659,
353,
679,
29918,
1792,
29918,
4299,
580,
13,
13,
13,
1990,
4911,
17679,
29898,
3195,
17679,
1125,
13,
1678,
8722,
29918,
3027,
353,
18896,
3950,
4062,
3073,
580,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4911,
13,
4706,
4235,
353,
313,
13,
9651,
525,
333,
742,
13,
9651,
525,
10185,
29918,
3027,
742,
13,
9651,
525,
6786,
742,
13,
9651,
525,
5269,
742,
13,
4706,
1723,
13,
13,
1678,
822,
679,
29918,
10185,
29918,
3027,
29898,
1311,
29892,
5446,
1125,
13,
4706,
565,
313,
10185,
29918,
3027,
3490,
5446,
29889,
10185,
29918,
3027,
1125,
13,
9651,
736,
8722,
29918,
3027,
29889,
2271,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
13,
13,
1990,
8701,
2659,
16570,
17679,
29898,
2659,
10602,
17679,
1125,
13,
13,
1678,
770,
20553,
29898,
2659,
10602,
17679,
29889,
19346,
1125,
13,
4706,
4235,
353,
313,
13,
9651,
525,
333,
742,
13,
9651,
525,
10185,
29918,
3027,
742,
13,
9651,
525,
6786,
742,
13,
9651,
525,
5269,
742,
13,
4706,
1723,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
2777,
29892,
2854,
630,
29918,
1272,
1125,
13,
4706,
9995,
13,
4706,
3940,
29901,
13,
9651,
1735,
445,
1158,
565,
366,
864,
304,
2767,
1404,
1904,
29889,
13,
9651,
297,
278,
1206,
310,
445,
2280,
445,
338,
451,
4312,
1363,
13,
9651,
372,
2307,
3913,
8701,
2659,
29889,
2398,
372,
338,
7088,
12515,
2626,
29877,
29889,
13,
4706,
9995,
13,
4706,
736,
2428,
2141,
5504,
29898,
8758,
29892,
2854,
630,
29918,
1272,
29897,
13,
2
] |
custom_components/hacs/operational/setup_actions/sensor.py | sob/hass-conf | 27 | 1610939 | <gh_stars>10-100
""""Starting setup task: Sensor"."""
from homeassistant.helpers import discovery
from custom_components.hacs.const import DOMAIN
from custom_components.hacs.share import get_hacs
from ...enums import HacsSetupTask
async def async_add_sensor():
"""Async wrapper for add sensor"""
hacs = get_hacs()
hacs.log.info("Setup task %s", HacsSetupTask.SENSOR)
if hacs.configuration.config_type == "yaml":
hacs.hass.async_create_task(
discovery.async_load_platform(
hacs.hass, "sensor", DOMAIN, {}, hacs.configuration.config
)
)
else:
hacs.hass.async_add_job(
hacs.hass.config_entries.async_forward_entry_setup(
hacs.configuration.config_entry, "sensor"
)
)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
15945,
15945,
4763,
292,
6230,
3414,
29901,
317,
6073,
29908,
1213,
15945,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
1053,
20699,
13,
13,
3166,
2888,
29918,
14036,
29889,
29882,
16815,
29889,
3075,
1053,
11662,
29032,
13,
3166,
2888,
29918,
14036,
29889,
29882,
16815,
29889,
13653,
1053,
679,
29918,
29882,
16815,
13,
13,
3166,
2023,
264,
6762,
1053,
379,
16815,
26947,
5398,
13,
13,
13,
12674,
822,
7465,
29918,
1202,
29918,
29879,
6073,
7295,
13,
1678,
9995,
8123,
14476,
363,
788,
23530,
15945,
29908,
13,
1678,
447,
2395,
353,
679,
29918,
29882,
16815,
580,
13,
1678,
447,
2395,
29889,
1188,
29889,
3888,
703,
26947,
3414,
1273,
29879,
613,
379,
16815,
26947,
5398,
29889,
29903,
1430,
29903,
1955,
29897,
13,
1678,
565,
447,
2395,
29889,
13305,
29889,
2917,
29918,
1853,
1275,
376,
25162,
1115,
13,
4706,
447,
2395,
29889,
29882,
465,
29889,
12674,
29918,
3258,
29918,
7662,
29898,
13,
9651,
20699,
29889,
12674,
29918,
1359,
29918,
12120,
29898,
13,
18884,
447,
2395,
29889,
29882,
465,
29892,
376,
29879,
6073,
613,
11662,
29032,
29892,
24335,
447,
2395,
29889,
13305,
29889,
2917,
13,
9651,
1723,
13,
4706,
1723,
13,
1678,
1683,
29901,
13,
4706,
447,
2395,
29889,
29882,
465,
29889,
12674,
29918,
1202,
29918,
9057,
29898,
13,
9651,
447,
2395,
29889,
29882,
465,
29889,
2917,
29918,
26586,
29889,
12674,
29918,
11333,
29918,
8269,
29918,
14669,
29898,
13,
18884,
447,
2395,
29889,
13305,
29889,
2917,
29918,
8269,
29892,
376,
29879,
6073,
29908,
13,
9651,
1723,
13,
4706,
1723,
13,
2
] |
firebase-gist.py | darwin/firebase-gist | 1 | 1575 | from firebase import firebase
import os
import datetime
import json
import logging
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from github3 import login
firebase_url = os.environ['FIREBASE_DB']
firebase_secret = os.environ['FIREBASE_SECRET']
firebase_path = os.environ['FIREBASE_PATH']
firebase_username = os.environ['FIREBASE_USERNAME'] # not checked ATM
gh_token = os.environ['GH_TOKEN']
gh_gist = os.environ['GH_GIST']
gh_fname = os.environ['GH_FNAME']
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def connect_firebase():
f = firebase.FirebaseApplication(firebase_url, None)
f.authentication = firebase.FirebaseAuthentication(firebase_secret, firebase_username, admin=True)
return f
logger.info('==================================')
logger.info('Fetching firebase data')
f = connect_firebase()
data = f.get(firebase_path, None)
new_content = json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True)
logger.info('Reading existing gist')
gh = login(token=gh_token)
gist = gh.gist(gh_gist)
old_content = ""
for f in gist.iter_files():
if f.filename == gh_fname:
old_content = f.content
break
if old_content == new_content:
logger.info('No changes detected')
else:
logger.info('Updating gist with new content')
gist.edit(files={
gh_fname: {
"content": new_content
}
})
logger.info('Done.') | [
1,
515,
16119,
1053,
16119,
13,
5215,
2897,
13,
5215,
12865,
13,
5215,
4390,
13,
5215,
12183,
13,
3166,
289,
3747,
29889,
29879,
29941,
29889,
9965,
1053,
317,
29941,
5350,
13,
3166,
289,
3747,
29889,
29879,
29941,
29889,
1989,
1053,
7670,
13,
3166,
18546,
29941,
1053,
6464,
13,
13,
17445,
29918,
2271,
353,
2897,
29889,
21813,
1839,
3738,
1525,
25416,
29918,
4051,
2033,
13,
17445,
29918,
19024,
353,
2897,
29889,
21813,
1839,
3738,
1525,
25416,
29918,
1660,
22245,
29911,
2033,
13,
17445,
29918,
2084,
353,
2897,
29889,
21813,
1839,
3738,
1525,
25416,
29918,
10145,
2033,
13,
17445,
29918,
6786,
353,
2897,
29889,
21813,
1839,
3738,
1525,
25416,
29918,
11889,
5813,
2033,
396,
451,
7120,
15531,
29924,
13,
13,
12443,
29918,
6979,
353,
2897,
29889,
21813,
1839,
29954,
29950,
29918,
4986,
29968,
1430,
2033,
13,
12443,
29918,
29887,
391,
353,
2897,
29889,
21813,
1839,
29954,
29950,
29918,
29954,
9047,
2033,
13,
12443,
29918,
29888,
978,
353,
2897,
29889,
21813,
1839,
29954,
29950,
29918,
29943,
5813,
2033,
13,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
29897,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
1753,
4511,
29918,
17445,
7295,
13,
29871,
285,
353,
16119,
29889,
18654,
3188,
4873,
29898,
17445,
29918,
2271,
29892,
6213,
29897,
13,
29871,
285,
29889,
23055,
353,
16119,
29889,
18654,
3188,
16746,
29898,
17445,
29918,
19024,
29892,
16119,
29918,
6786,
29892,
4113,
29922,
5574,
29897,
13,
29871,
736,
285,
13,
13,
21707,
29889,
3888,
877,
9166,
9166,
1360,
1495,
13,
21707,
29889,
3888,
877,
20927,
292,
16119,
848,
1495,
13,
29888,
353,
4511,
29918,
17445,
580,
13,
1272,
353,
285,
29889,
657,
29898,
17445,
29918,
2084,
29892,
6213,
29897,
13,
1482,
29918,
3051,
353,
4390,
29889,
29881,
17204,
29898,
1272,
29892,
9801,
29918,
294,
18869,
29922,
8824,
29892,
29536,
29922,
29906,
29892,
2656,
29918,
8149,
29922,
5574,
29897,
13,
13,
21707,
29889,
3888,
877,
6359,
292,
5923,
330,
391,
1495,
13,
12443,
353,
6464,
29898,
6979,
29922,
12443,
29918,
6979,
29897,
13,
13,
29887,
391,
353,
24170,
29889,
29887,
391,
29898,
12443,
29918,
29887,
391,
29897,
13,
13,
1025,
29918,
3051,
353,
5124,
13,
1454,
285,
297,
330,
391,
29889,
1524,
29918,
5325,
7295,
13,
29871,
565,
285,
29889,
9507,
1275,
24170,
29918,
29888,
978,
29901,
13,
1678,
2030,
29918,
3051,
353,
285,
29889,
3051,
13,
1678,
2867,
13,
13,
361,
2030,
29918,
3051,
1275,
716,
29918,
3051,
29901,
13,
29871,
17927,
29889,
3888,
877,
3782,
3620,
17809,
1495,
13,
2870,
29901,
13,
29871,
17927,
29889,
3888,
877,
3373,
26747,
330,
391,
411,
716,
2793,
1495,
13,
29871,
330,
391,
29889,
5628,
29898,
5325,
3790,
13,
1678,
24170,
29918,
29888,
978,
29901,
426,
13,
418,
376,
3051,
1115,
716,
29918,
3051,
13,
1678,
500,
13,
29871,
5615,
13,
13,
21707,
29889,
3888,
877,
25632,
29889,
1495,
2
] |
notebooks/main.py | Reasmey/adsi_beer_app | 0 | 189027 | <gh_stars>0
from fastapi import FastAPI
from starlette.responses import JSONResponse
from joblib import load
import pandas as pd
from fastapi.encoders import jsonable_encoder
#from pydantic import BaseModel
from torch.utils.data import DataLoader
from model import format_features, apply_scaler, single_tensor, ClassificationEmbdNN, get_model, predict
app = FastAPI()
@app.get("/")
def read_root():
return {"Displaying a brief description of the project objectives, list of endpoints, expected input parameters and output format of the model, link to the Github repo related to this project"}
@app.get('/health', status_code=200)
def healthcheck():
return 'GMM Clustering is all ready to go!'
@app.post("/beer/type/")
async def predict_beer_style(brewery_name: int, review_aroma: int, review_appearance: int, review_palate: int, review_taste: int):
features = format_features(brewery_name,review_aroma, review_appearance, review_palate, review_taste)
obs = pd.DataFrame(features)
# scale num cols
obs = apply_scaler(obs)
#transform to embed object
obs_tensor = single_tensor(obs)
#predict on embed obj
model = get_model()
#return predictions as text string
answer = predict(obs_tensor, model, single=True)
return answer
@app.post("/beers/type/")
async def predict_beer_style_multi(brewery_name: int, review_aroma: int, review_appearance: int, review_palate: int, review_taste: int):
features = format_features(brewery_name,review_aroma, review_appearance, review_palate, review_taste)
obs = pd.DataFrame(features)
# scale num cols
obs = apply_scaler(obs)
#transform to embed object
obs_tensor = single_tensor(obs)
#predict on embed obj
model = get_model()
#return predictions as text string
answer = predict(obs_tensor, model)
return answer
@app.get("/model/architecture/")
async def print_model():
model = get_model()
return model
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
5172,
2754,
1053,
23786,
8787,
13,
3166,
5810,
20200,
29889,
26679,
267,
1053,
4663,
5103,
13,
3166,
4982,
1982,
1053,
2254,
13,
5215,
11701,
408,
10518,
13,
3166,
5172,
2754,
29889,
3977,
397,
414,
1053,
4390,
519,
29918,
3977,
6119,
13,
29937,
3166,
282,
2941,
7716,
1053,
7399,
3195,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
13,
13,
3166,
1904,
1053,
3402,
29918,
22100,
29892,
3394,
29918,
19529,
261,
29892,
2323,
29918,
20158,
29892,
23236,
6026,
6448,
10262,
29892,
679,
29918,
4299,
29892,
8500,
13,
13,
932,
353,
23786,
8787,
580,
13,
13,
13,
13,
29992,
932,
29889,
657,
11974,
1159,
13,
1753,
1303,
29918,
4632,
7295,
13,
1678,
736,
8853,
9323,
292,
263,
11473,
6139,
310,
278,
2060,
1203,
3145,
29892,
1051,
310,
1095,
9748,
29892,
3806,
1881,
4128,
322,
1962,
3402,
310,
278,
1904,
29892,
1544,
304,
278,
402,
2985,
13761,
259,
4475,
304,
445,
2060,
9092,
13,
13,
13,
29992,
932,
29889,
657,
11219,
354,
4298,
742,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
1753,
9045,
3198,
7295,
13,
1678,
736,
525,
29954,
7428,
2233,
504,
3241,
338,
599,
7960,
304,
748,
20714,
13,
13,
13,
29992,
932,
29889,
2490,
11974,
915,
261,
29914,
1853,
29914,
1159,
13,
12674,
822,
8500,
29918,
915,
261,
29918,
3293,
29898,
1030,
556,
29891,
29918,
978,
29901,
938,
29892,
9076,
29918,
279,
4125,
29901,
938,
29892,
9076,
29918,
932,
21711,
29901,
938,
29892,
9076,
29918,
7830,
403,
29901,
938,
29892,
9076,
29918,
29873,
4350,
29901,
938,
1125,
13,
268,
13,
1678,
5680,
353,
3402,
29918,
22100,
29898,
1030,
556,
29891,
29918,
978,
29892,
27828,
29918,
279,
4125,
29892,
9076,
29918,
932,
21711,
29892,
9076,
29918,
7830,
403,
29892,
9076,
29918,
29873,
4350,
29897,
13,
1678,
20881,
353,
10518,
29889,
17271,
29898,
22100,
29897,
13,
1678,
396,
6287,
954,
28730,
13,
1678,
20881,
353,
3394,
29918,
19529,
261,
29898,
26290,
29897,
13,
268,
13,
1678,
396,
9067,
304,
8297,
1203,
13,
1678,
20881,
29918,
20158,
353,
2323,
29918,
20158,
29898,
26290,
29897,
13,
268,
13,
1678,
396,
27711,
373,
8297,
5446,
13,
1678,
1904,
353,
679,
29918,
4299,
580,
13,
268,
13,
1678,
396,
2457,
27303,
408,
1426,
1347,
13,
1678,
1234,
353,
8500,
29898,
26290,
29918,
20158,
29892,
1904,
29892,
2323,
29922,
5574,
29897,
13,
268,
13,
268,
13,
1678,
736,
1234,
13,
13,
29992,
932,
29889,
2490,
11974,
915,
414,
29914,
1853,
29914,
1159,
13,
12674,
822,
8500,
29918,
915,
261,
29918,
3293,
29918,
9910,
29898,
1030,
556,
29891,
29918,
978,
29901,
938,
29892,
9076,
29918,
279,
4125,
29901,
938,
29892,
9076,
29918,
932,
21711,
29901,
938,
29892,
9076,
29918,
7830,
403,
29901,
938,
29892,
9076,
29918,
29873,
4350,
29901,
938,
1125,
13,
268,
13,
1678,
5680,
353,
3402,
29918,
22100,
29898,
1030,
556,
29891,
29918,
978,
29892,
27828,
29918,
279,
4125,
29892,
9076,
29918,
932,
21711,
29892,
9076,
29918,
7830,
403,
29892,
9076,
29918,
29873,
4350,
29897,
13,
1678,
20881,
353,
10518,
29889,
17271,
29898,
22100,
29897,
13,
1678,
396,
6287,
954,
28730,
13,
1678,
20881,
353,
3394,
29918,
19529,
261,
29898,
26290,
29897,
13,
268,
13,
1678,
396,
9067,
304,
8297,
1203,
13,
1678,
20881,
29918,
20158,
353,
2323,
29918,
20158,
29898,
26290,
29897,
13,
268,
13,
1678,
396,
27711,
373,
8297,
5446,
13,
1678,
1904,
353,
679,
29918,
4299,
580,
13,
268,
13,
1678,
396,
2457,
27303,
408,
1426,
1347,
13,
1678,
1234,
353,
8500,
29898,
26290,
29918,
20158,
29892,
1904,
29897,
13,
268,
13,
268,
13,
1678,
736,
1234,
13,
13,
13,
29992,
932,
29889,
657,
11974,
4299,
29914,
25428,
29914,
1159,
13,
12674,
822,
1596,
29918,
4299,
7295,
13,
268,
13,
1678,
1904,
353,
679,
29918,
4299,
580,
13,
1678,
736,
1904,
13,
13,
2
] |
RegonAPI/converters.py | damianwasik98/RegonAPI | 10 | 39684 | <reponame>damianwasik98/RegonAPI
"""
Converters of codes
"""
from string import digits
from .exceptions import RegonConvertionError
from . import validators
REGON9_WEIGHTS = [8, 9, 2, 3, 4, 5, 6, 7]
REGON14_WEIGHTS = [2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8]
def regon8_to_9(regon8):
"""Convert REGON8 to REGON9
Parameters
----------
regon8 : str
REGON8
Returns
-------
str
REGON9
Raises
------
RegonConvertionError
If regon8 is not valid
"""
if not validators.is_valid_regon8(regon8):
raise RegonConvertionError(regon8)
a, b = list(regon8), REGON9_WEIGHTS
a = list(map(lambda x: int(x), a))
last_digit = sum(list(map(lambda x: x[0] * x[1], zip(a, b)))) % 11
regon9 = "{regon8}{last_digit}".format(regon8=regon8, last_digit=last_digit)
return regon9
def regon13_to_14(regon13):
"""Convert REGON13 to REGON14
Parameters
----------
regon13 : str
REGON13
Returns
-------
str
REGON14
Raises
------
RegonConvertionError
If regon13 is not valid
"""
if not validators.is_valid_regon13(regon13):
raise RegonConvertionError(regon13)
a, b = list(regon13), REGON14_WEIGHTS
a = list(map(lambda x: int(x), a))
last_digit = sum(list(map(lambda x: x[0] * x[1], zip(a, b)))) % 11
regon14 = "{regon13}{last_digit}".format(regon13=regon13, last_digit=last_digit)
return regon14
| [
1,
529,
276,
1112,
420,
29958,
16846,
713,
11102,
638,
29929,
29947,
29914,
4597,
265,
8787,
13,
15945,
29908,
13,
1678,
1281,
369,
2153,
310,
11561,
13,
15945,
29908,
13,
13,
3166,
1347,
1053,
13340,
13,
13,
3166,
869,
11739,
29879,
1053,
2169,
265,
18455,
291,
2392,
13,
3166,
869,
1053,
2854,
4097,
13,
13,
13,
18166,
1164,
29929,
29918,
8851,
22530,
29903,
353,
518,
29947,
29892,
29871,
29929,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29955,
29962,
13,
18166,
1164,
29896,
29946,
29918,
8851,
22530,
29903,
353,
518,
29906,
29892,
29871,
29946,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29900,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29941,
29892,
29871,
29953,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
29892,
29871,
29947,
29962,
13,
13,
13,
1753,
1072,
265,
29947,
29918,
517,
29918,
29929,
29898,
22627,
29947,
1125,
13,
1678,
9995,
18455,
5195,
29954,
1164,
29947,
304,
5195,
29954,
1164,
29929,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
1072,
265,
29947,
584,
851,
13,
4706,
5195,
29954,
1164,
29947,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
851,
13,
4706,
5195,
29954,
1164,
29929,
13,
13,
1678,
390,
1759,
267,
13,
1678,
448,
23648,
13,
1678,
2169,
265,
18455,
291,
2392,
13,
4706,
960,
1072,
265,
29947,
338,
451,
2854,
13,
1678,
9995,
13,
1678,
565,
451,
2854,
4097,
29889,
275,
29918,
3084,
29918,
22627,
29947,
29898,
22627,
29947,
1125,
13,
4706,
12020,
2169,
265,
18455,
291,
2392,
29898,
22627,
29947,
29897,
13,
1678,
263,
29892,
289,
353,
1051,
29898,
22627,
29947,
511,
5195,
29954,
1164,
29929,
29918,
8851,
22530,
29903,
13,
1678,
263,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
938,
29898,
29916,
511,
263,
876,
13,
1678,
1833,
29918,
26204,
353,
2533,
29898,
1761,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29900,
29962,
334,
921,
29961,
29896,
1402,
14319,
29898,
29874,
29892,
289,
13697,
1273,
29871,
29896,
29896,
13,
1678,
1072,
265,
29929,
353,
29850,
22627,
29947,
1157,
4230,
29918,
26204,
29913,
1642,
4830,
29898,
22627,
29947,
29922,
22627,
29947,
29892,
1833,
29918,
26204,
29922,
4230,
29918,
26204,
29897,
13,
1678,
736,
1072,
265,
29929,
13,
13,
13,
1753,
1072,
265,
29896,
29941,
29918,
517,
29918,
29896,
29946,
29898,
22627,
29896,
29941,
1125,
13,
1678,
9995,
18455,
5195,
29954,
1164,
29896,
29941,
304,
5195,
29954,
1164,
29896,
29946,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
1072,
265,
29896,
29941,
584,
851,
13,
4706,
5195,
29954,
1164,
29896,
29941,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
851,
13,
4706,
5195,
29954,
1164,
29896,
29946,
13,
13,
1678,
390,
1759,
267,
13,
1678,
448,
23648,
13,
1678,
2169,
265,
18455,
291,
2392,
13,
4706,
960,
1072,
265,
29896,
29941,
338,
451,
2854,
13,
1678,
9995,
13,
1678,
565,
451,
2854,
4097,
29889,
275,
29918,
3084,
29918,
22627,
29896,
29941,
29898,
22627,
29896,
29941,
1125,
13,
4706,
12020,
2169,
265,
18455,
291,
2392,
29898,
22627,
29896,
29941,
29897,
13,
1678,
263,
29892,
289,
353,
1051,
29898,
22627,
29896,
29941,
511,
5195,
29954,
1164,
29896,
29946,
29918,
8851,
22530,
29903,
13,
1678,
263,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
938,
29898,
29916,
511,
263,
876,
13,
1678,
1833,
29918,
26204,
353,
2533,
29898,
1761,
29898,
1958,
29898,
2892,
921,
29901,
921,
29961,
29900,
29962,
334,
921,
29961,
29896,
1402,
14319,
29898,
29874,
29892,
289,
13697,
1273,
29871,
29896,
29896,
13,
1678,
1072,
265,
29896,
29946,
353,
29850,
22627,
29896,
29941,
1157,
4230,
29918,
26204,
29913,
1642,
4830,
29898,
22627,
29896,
29941,
29922,
22627,
29896,
29941,
29892,
1833,
29918,
26204,
29922,
4230,
29918,
26204,
29897,
13,
1678,
736,
1072,
265,
29896,
29946,
13,
2
] |
qrand/caches/cache.py | LaurentAjdnik/qrand | 18 | 16435 | <filename>qrand/caches/cache.py<gh_stars>10-100
## _____ _____
## | __ \| __ \ AUTHOR: <NAME>
## | |__) | |__) | ---------------------------------
## | ___/| _ / DATE: May 18, 2021
## | | | | \ \ ---------------------------------
## |_| |_| \_\ https://github.com/pedrorrivero
##
## Copyright 2021 <NAME>
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
from abc import ABC, abstractmethod
###############################################################################
## BIT CACHE INTERFACE
###############################################################################
class BitCache(ABC):
"""
BitCache FIFO (first in, first out) data structure.
Attributes
----------
size: int
The number of bits currently stored in the BitCache.
Methods
-------
dump() -> str
Outputs all the contents in the cache without erasing.
flush() -> None:
Erases the cache.
pop(n: int) -> str:
Returns a size `n` bitstring removing it from the top of the cache.
push(bitstring: str) -> None:
Inserts bitstring at the end of the cache.
"""
############################### PUBLIC API ###############################
@property
@abstractmethod
def size(self) -> int:
"""
The number of bits currently stored in the BitCache.
"""
pass
@abstractmethod
def dump(self) -> str:
"""
Outputs all the contents in the cache without erasing.
Returns
-------
out: str
Cache contents.
"""
pass
@abstractmethod
def flush(self) -> None:
"""
Erases the cache.
"""
pass
@abstractmethod
def pop(self, num_bits: int) -> str:
"""
Returns a size `n` bitstring removing it from the top of the cache.
Parameters
----------
num_bits: int
Number of bits to retrieve.
Returns
-------
out: str
Size `n` bitstring.
Raises
------
TypeError
If input is not int.
ValueError
If input is less than one.
RuntimeError
If input is greater than cache size.
"""
pass
@abstractmethod
def push(self, bitstring: str) -> None:
"""
Inserts bitstring at the end of the cache.
Parameters
----------
bitstring: str
The bitstring to insert.
Raises
------
TypeError
If input bitstring is not str.
ValueError
If input bitstring is not a valid bitstring.
"""
pass
| [
1,
529,
9507,
29958,
29939,
9502,
29914,
29883,
14520,
29914,
8173,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
2277,
1678,
903,
7652,
29871,
903,
7652,
13,
2277,
259,
891,
29871,
4770,
12926,
29871,
4770,
320,
1678,
26524,
29950,
1955,
29901,
529,
5813,
29958,
13,
2277,
259,
891,
891,
1649,
29897,
891,
891,
1649,
29897,
891,
259,
448,
2683,
2683,
13,
2277,
259,
891,
29871,
903,
1649,
29914,
29989,
29871,
903,
29871,
847,
1678,
20231,
29901,
2610,
29871,
29896,
29947,
29892,
29871,
29906,
29900,
29906,
29896,
13,
2277,
259,
891,
891,
1678,
891,
891,
320,
320,
1678,
448,
2683,
2683,
13,
2277,
259,
891,
29918,
29989,
1678,
891,
29918,
29989,
29871,
320,
3187,
259,
2045,
597,
3292,
29889,
510,
29914,
9795,
729,
3511,
29877,
13,
2277,
13,
13,
2277,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
529,
5813,
29958,
13,
2277,
13,
2277,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
2277,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
2277,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
2277,
13,
2277,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
2277,
13,
2277,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
2277,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
2277,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
2277,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
2277,
27028,
1090,
278,
19245,
29889,
13,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
13,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
2277,
350,
1806,
315,
2477,
9606,
2672,
4945,
29943,
11538,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
1990,
18531,
10408,
29898,
19658,
1125,
13,
1678,
9995,
13,
1678,
18531,
10408,
9338,
5800,
313,
4102,
297,
29892,
937,
714,
29897,
848,
3829,
29889,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
1378,
29899,
13,
1678,
2159,
29901,
938,
13,
4706,
450,
1353,
310,
9978,
5279,
6087,
297,
278,
18531,
10408,
29889,
13,
13,
1678,
8108,
29879,
13,
1678,
448,
22158,
13,
1678,
16766,
580,
1599,
851,
13,
4706,
10604,
29879,
599,
278,
8118,
297,
278,
7090,
1728,
604,
5832,
29889,
13,
1678,
28371,
580,
1599,
6213,
29901,
13,
4706,
1425,
2129,
278,
7090,
29889,
13,
1678,
1835,
29898,
29876,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
16969,
263,
2159,
421,
29876,
29952,
2586,
1807,
11077,
372,
515,
278,
2246,
310,
278,
7090,
29889,
13,
1678,
5503,
29898,
2966,
1807,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
512,
643,
1372,
2586,
1807,
472,
278,
1095,
310,
278,
7090,
29889,
13,
1678,
9995,
13,
13,
1678,
835,
13383,
7346,
4136,
349,
7466,
27888,
3450,
835,
13383,
7346,
4136,
13,
1678,
732,
6799,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2159,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
13,
4706,
450,
1353,
310,
9978,
5279,
6087,
297,
278,
18531,
10408,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
16766,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
10604,
29879,
599,
278,
8118,
297,
278,
7090,
1728,
604,
5832,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
714,
29901,
851,
13,
9651,
28540,
8118,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
28371,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
1425,
2129,
278,
7090,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
1835,
29898,
1311,
29892,
954,
29918,
14836,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
16969,
263,
2159,
421,
29876,
29952,
2586,
1807,
11077,
372,
515,
278,
2246,
310,
278,
7090,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
954,
29918,
14836,
29901,
938,
13,
9651,
9681,
310,
9978,
304,
10563,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
714,
29901,
851,
13,
9651,
21179,
421,
29876,
29952,
2586,
1807,
29889,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
20948,
13,
9651,
960,
1881,
338,
451,
938,
29889,
13,
4706,
7865,
2392,
13,
9651,
960,
1881,
338,
3109,
1135,
697,
29889,
13,
4706,
24875,
2392,
13,
9651,
960,
1881,
338,
7621,
1135,
7090,
2159,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
5503,
29898,
1311,
29892,
2586,
1807,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
512,
643,
1372,
2586,
1807,
472,
278,
1095,
310,
278,
7090,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2586,
1807,
29901,
851,
13,
9651,
450,
2586,
1807,
304,
4635,
29889,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
20948,
13,
9651,
960,
1881,
2586,
1807,
338,
451,
851,
29889,
13,
4706,
7865,
2392,
13,
9651,
960,
1881,
2586,
1807,
338,
451,
263,
2854,
2586,
1807,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
2
] |
saleor/core/__init__.py | X10project/rob_photography | 3 | 164256 | <reponame>X10project/rob_photography
TOKEN_PATTERN = ('(?P<token>[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}'
'-[0-9a-z]{12})')
| [
1,
529,
276,
1112,
420,
29958,
29990,
29896,
29900,
4836,
29914,
13716,
29918,
561,
327,
5275,
13,
13,
4986,
29968,
1430,
29918,
29925,
1299,
4945,
29940,
353,
6702,
10780,
29925,
29966,
6979,
24566,
29900,
29899,
29929,
29874,
29899,
29920,
3199,
29947,
7402,
29961,
29900,
29899,
29929,
29874,
29899,
29920,
3199,
29946,
7402,
29961,
29900,
29899,
29929,
29874,
29899,
29920,
3199,
29946,
7402,
29961,
29900,
29899,
29929,
29874,
29899,
29920,
3199,
29946,
10162,
13,
462,
17411,
29961,
29900,
29899,
29929,
29874,
29899,
29920,
3199,
29896,
29906,
1800,
1495,
13,
2
] |
Raspberry_Pi_Animated_Gif_Player/code.py | albinger/Adafruit_Learning_System_Guides | 0 | 31062 | # SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import usb_cdc
import rotaryio
import board
import digitalio
serial = usb_cdc.data
encoder = rotaryio.IncrementalEncoder(board.ROTA, board.ROTB)
button = digitalio.DigitalInOut(board.SWITCH)
button.switch_to_input(pull=digitalio.Pull.UP)
last_position = None
button_state = False
while True:
position = encoder.position
if last_position is None or position != last_position:
serial.write(bytes(str(position) + ",", "utf-8"))
last_position = position
print(button.value)
if not button.value and not button_state:
button_state = True
if button.value and button_state:
serial.write(bytes("click,", "utf-8"))
button_state = False
| [
1,
396,
10937,
29928,
29990,
29899,
2283,
11882,
1266,
1626,
29901,
29871,
29906,
29900,
29906,
29896,
529,
5813,
29958,
363,
23255,
29888,
9216,
12157,
2722,
13,
29937,
13,
29937,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
341,
1806,
13,
13,
5215,
502,
29890,
29918,
2252,
29883,
13,
5215,
5731,
653,
601,
13,
5215,
7613,
13,
5215,
13436,
601,
13,
13,
15550,
353,
502,
29890,
29918,
2252,
29883,
29889,
1272,
13,
3977,
6119,
353,
5731,
653,
601,
29889,
797,
17053,
284,
8566,
6119,
29898,
3377,
29889,
1672,
6040,
29892,
7613,
29889,
1672,
24895,
29897,
13,
3092,
353,
13436,
601,
29889,
27103,
797,
3744,
29898,
3377,
29889,
23066,
1806,
3210,
29897,
13,
3092,
29889,
15123,
29918,
517,
29918,
2080,
29898,
26746,
29922,
7501,
2410,
601,
29889,
29925,
913,
29889,
4897,
29897,
13,
13,
4230,
29918,
3283,
353,
6213,
13,
3092,
29918,
3859,
353,
7700,
13,
13,
8000,
5852,
29901,
13,
1678,
2602,
353,
2094,
6119,
29889,
3283,
13,
1678,
565,
1833,
29918,
3283,
338,
6213,
470,
2602,
2804,
1833,
29918,
3283,
29901,
13,
4706,
7797,
29889,
3539,
29898,
13193,
29898,
710,
29898,
3283,
29897,
718,
9162,
613,
376,
9420,
29899,
29947,
5783,
13,
1678,
1833,
29918,
3283,
353,
2602,
13,
1678,
1596,
29898,
3092,
29889,
1767,
29897,
13,
1678,
565,
451,
2826,
29889,
1767,
322,
451,
2826,
29918,
3859,
29901,
13,
4706,
2826,
29918,
3859,
353,
5852,
13,
1678,
565,
2826,
29889,
1767,
322,
2826,
29918,
3859,
29901,
13,
4706,
7797,
29889,
3539,
29898,
13193,
703,
3808,
29892,
613,
376,
9420,
29899,
29947,
5783,
13,
4706,
2826,
29918,
3859,
353,
7700,
13,
2
] |
Modulo 3/Lista11/17.py | BelfortJoao/Programacao-1 | 2 | 173999 | <gh_stars>1-10
# “é múltiplo de 3” ou “não é múltiplo de 3”.
Num1 = int(input("Escreva um Numero: "))
if Num1 % 3 > 0:
print("não é múltiplo de 3")
else:
print("é múltiplo de 3") | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
1346,
29948,
286,
28961,
666,
417,
316,
29871,
29941,
30024,
2123,
1346,
29876,
1368,
904,
286,
28961,
666,
417,
316,
29871,
29941,
8643,
13,
8009,
29896,
353,
938,
29898,
2080,
703,
14190,
1037,
1564,
1922,
11848,
1489,
29901,
376,
876,
13,
361,
11848,
29896,
1273,
29871,
29941,
1405,
29871,
29900,
29901,
13,
1678,
1596,
703,
29876,
1368,
904,
286,
28961,
666,
417,
316,
29871,
29941,
1159,
13,
2870,
29901,
13,
1678,
1596,
703,
29948,
286,
28961,
666,
417,
316,
29871,
29941,
1159,
2
] |
main/util/dto.py | emhayusa/4d_api | 0 | 54539 | from flask_restplus import Namespace, fields
class StatusDto:
api = Namespace('status', description='status related operations')
schema = api.model('status', {
'id': fields.Integer(dump_only=True),
'status_name': fields.String(required=True, description='status name')
})
entry = api.model('status_entry', {
'status_name': fields.String(required=True, description='status name')
})
class TypeDto:
api = Namespace('type', description='type related operations')
schema = api.model('type', {
'id': fields.Integer(dump_only=True),
'type_name': fields.String(required=True, description='type name')
})
entry = api.model('type_entry', {
'type_name': fields.String(required=True, description='type name')
})
class AreaDto:
api = Namespace('area', description='area related operations')
schema = api.model('area', {
'id': fields.Integer(dump_only=True),
'area_name': fields.String(required=True, description='area_name')
})
entry = api.model('area_entry', {
'area_name': fields.String(required=True, description='area_name')
})
class UserDto:
api = Namespace('user', description='user related operations')
schema = api.model('user', {
'email': fields.String(required=True, description='user email address'),
'username': fields.String(required=True, description='user username'),
'public_id': fields.String(description='user Identifier'),
'type' : fields.Nested(TypeDto().schema, required=True),
'area' : fields.Nested(AreaDto().schema, required=True)
})
user = api.model('user', {
'type_id' : fields.Integer(required=True, description='type id'),
'area_id' : fields.Integer(required=True, description='area id'),
'email': fields.String(required=True, description='user email address'),
'username': fields.String(required=True, description='user username'),
'password': fields.String(required=True, description='user password')
})
class AuthDto:
api = Namespace('auth', description='authentication related operations')
user_auth = api.model('auth_details', {
'username': fields.String(required=True, description='The username'),
'password': fields.String(required=True, description='The user password ')
})
class GmlDto:
api = Namespace('gml', description='gml related operations')
schema = api.model('gml', {
'id': fields.Integer(dump_only=True),
#'contributor' : fields.Nested(UserDto().schema, required=True),
'contributor': fields.String(required=True, description='contributor username'),
'building_name': fields.String(required=True, description='building name'),
'city_gml_file': fields.String(required=True, description='city gml file name'),
'uploaded_on': fields.DateTime(required=True, description='uploaded time'),
'verified_on': fields.DateTime(required=True, description='verified time'),
'validator': fields.String(required=True, description='validator username'),
#'validator' : fields.Nested(UserDto().schema, required=True),
'reason': fields.String(required=True, description='reason'),
'area' : fields.Nested(AreaDto().schema, required=True),
'status' : fields.Nested(StatusDto().schema, required=True)
})
entry = api.model('gml_entry', {
'contributor': fields.String(required=True, description='contributor username'),
'building_name': fields.String(required=True, description='building name'),
'city_gml_file': fields.String(required=True, description='city gml file name'),
'area_id': fields.Integer(required=True, description='area id')
})
verify = api.model('gml_verify', {
'id': fields.Integer(required=True, description='id'),
'validator': fields.String(required=True, description='validator username'),
'status_id': fields.Integer(required=True, description='status id'),
'reason': fields.String(required=False, description='reason')
})
class CityGmlDto:
api = Namespace('city_gml', description='city gml related operations')
schema = api.model('city_gml', {
'id': fields.Integer(dump_only=True),
'contributor': fields.String(required=True, description='contributor username'),
'city_gml_file': fields.String(required=True, description='city gml file name'),
'uploaded_on': fields.DateTime(required=True, description='uploaded time'),
'verified_on': fields.DateTime(required=True, description='verified time'),
'validator': fields.String(required=True, description='validator username'),
'reason': fields.String(required=True, description='reason'),
'area' : fields.Nested(AreaDto().schema, required=True),
'status' : fields.Nested(StatusDto().schema, required=True)
})
entry = api.model('city_gml_entry', {
'contributor': fields.String(required=True, description='contributor username'),
'city_gml_file': fields.String(required=True, description='city gml file name'),
'area_id': fields.Integer(required=True, description='area id')
})
verify = api.model('city_gml_verify', {
'id': fields.Integer(required=True, description='id'),
'validator': fields.String(required=True, description='validator username'),
'status_id': fields.Integer(required=True, description='status id'),
'reason': fields.String(required=False, description='reason')
})
class BuildingsDto:
api = Namespace('buildings', description='buildings related operations')
schema = api.model('buildings', {
'id': fields.Integer(dump_only=True),
'gml_id': fields.String(required=True, description='gml_id'),
'city_gml' : fields.Nested(CityGmlDto().schema, required=True),
})
entry = api.model('buildings_entry', {
'list_gml_id': fields.List(fields.String(required=True, description='gml id')),
'city_gml_id': fields.Integer(required=True, description='city gml id')
})
class MonitoringAttributeDto:
api = Namespace('monitoring', description='monitoring attribute related operations')
schema = api.model('monitoring_attribute', {
'id': fields.Integer(dump_only=True),
'timestamp': fields.DateTime(required=True, description='timestamp'),
'name': fields.String(required=True, description='name'),
'function': fields.String(required=True, description='function'),
'height': fields.Float(required=True, description='height'),
'buildings' : fields.Nested(BuildingsDto().schema, required=True),
'contributor': fields.String(required=True, description='contributor username'),
'verified_on': fields.DateTime(required=True, description='verified time'),
'validator': fields.String(required=True, description='validator username'),
'reason': fields.String(required=True, description='reason'),
'status' : fields.Nested(StatusDto().schema, required=True)
})
entry = api.model('monitoring_attribute_entry', {
'name': fields.String(required=True, description='name'),
'function': fields.String(required=True, description='function'),
'height': fields.Float(required=True, description='height'),
'user_id' : fields.String(required=True, description='user public id'),
'gml_id' : fields.String(required=True, description='building gml id')
})
verify = api.model('monitoring_attribute_verify', {
'id': fields.Integer(required=True, description='id'),
'validator': fields.String(required=True, description='validator username'),
'status_id': fields.Integer(required=True, description='status id'),
'reason': fields.String(required=False, description='reason')
})
class MonitoringPhotoDto:
api = Namespace('monitoring', description='monitoring photo related operations')
schema = api.model('monitoring_photo', {
'id': fields.Integer(dump_only=True),
'timestamp': fields.DateTime(required=True, description='timestamp'),
'photo_file': fields.String(required=True, description='photo_file'),
'buildings' : fields.Nested(BuildingsDto().schema, required=True),
'contributor': fields.String(required=True, description='contributor username'),
'verified_on': fields.DateTime(required=True, description='verified time'),
'validator': fields.String(required=True, description='validator username'),
'reason': fields.String(required=True, description='reason'),
'status' : fields.Nested(StatusDto().schema, required=True)
})
entry = api.model('monitoring_photo_entry', {
'photo_file': fields.String(required=True, description='photo_file'),
'user_id' : fields.String(required=True, description='user public id'),
'gml_id' : fields.String(required=True, description='building gml id')
})
verify = api.model('monitoring_photo_verify', {
'id': fields.Integer(required=True, description='id'),
'validator': fields.String(required=True, description='validator username'),
'status_id': fields.Integer(required=True, description='status id'),
'reason': fields.String(required=False, description='reason')
})
class MonitoringVideoDto:
api = Namespace('monitoring', description='monitoring video related operations')
schema = api.model('monitoring_video', {
'id': fields.Integer(dump_only=True),
'timestamp': fields.DateTime(required=True, description='timestamp'),
'video_file': fields.String(required=True, description='video_file'),
'buildings' : fields.Nested(BuildingsDto().schema, required=True),
'contributor': fields.String(required=True, description='contributor username'),
'verified_on': fields.DateTime(required=True, description='verified time'),
'validator': fields.String(required=True, description='validator username'),
'reason': fields.String(required=True, description='reason'),
'status' : fields.Nested(StatusDto().schema, required=True)
})
entry = api.model('monitoring_video_entry', {
'video_file': fields.String(required=True, description='video_file'),
'user_id' : fields.String(required=True, description='user public id'),
'gml_id' : fields.String(required=True, description='building gml id')
})
verify = api.model('monitoring_video_verify', {
'id': fields.Integer(required=True, description='id'),
'validator': fields.String(required=True, description='validator username'),
'status_id': fields.Integer(required=True, description='status id'),
'reason': fields.String(required=False, description='reason')
})
class CityObjectDto:
api = Namespace('cityobject', description='city object related operations') | [
1,
515,
29784,
29918,
5060,
11242,
1053,
14706,
3535,
29892,
4235,
13,
13,
12,
13,
1990,
16034,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
4882,
742,
6139,
2433,
4882,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
4882,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
4882,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1024,
1495,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
4882,
29918,
8269,
742,
426,
13,
4706,
525,
4882,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1024,
1495,
13,
1678,
5615,
13,
13,
12,
13,
1990,
5167,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
1853,
742,
6139,
2433,
1853,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
1853,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
1853,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1853,
1024,
1495,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
1853,
29918,
8269,
742,
426,
13,
4706,
525,
1853,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1853,
1024,
1495,
13,
1678,
5615,
13,
13,
1990,
18320,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
6203,
742,
6139,
2433,
6203,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
6203,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
6203,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
6203,
29918,
978,
1495,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
6203,
29918,
8269,
742,
426,
13,
4706,
525,
6203,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
6203,
29918,
978,
1495,
13,
1678,
5615,
13,
12,
13,
1990,
4911,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
1792,
742,
6139,
2433,
1792,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
1792,
742,
426,
13,
4706,
525,
5269,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
4876,
3211,
5477,
13,
4706,
525,
6786,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
8952,
5477,
13,
4706,
525,
3597,
29918,
333,
2396,
4235,
29889,
1231,
29898,
8216,
2433,
1792,
20286,
5477,
13,
4706,
525,
1853,
29915,
584,
4235,
29889,
29940,
2868,
29898,
1542,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
4706,
525,
6203,
29915,
584,
4235,
29889,
29940,
2868,
29898,
13799,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
1678,
1404,
353,
7882,
29889,
4299,
877,
1792,
742,
426,
13,
12,
12,
29915,
1853,
29918,
333,
29915,
584,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1853,
1178,
5477,
13,
12,
12,
29915,
6203,
29918,
333,
29915,
584,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
6203,
1178,
5477,
13,
4706,
525,
5269,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
4876,
3211,
5477,
13,
4706,
525,
6786,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
8952,
5477,
13,
4706,
525,
5630,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
4800,
1495,
13,
1678,
5615,
13,
13,
13,
1990,
13189,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
5150,
742,
6139,
2433,
23055,
4475,
6931,
1495,
13,
1678,
1404,
29918,
5150,
353,
7882,
29889,
4299,
877,
5150,
29918,
14144,
742,
426,
13,
4706,
525,
6786,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1576,
8952,
5477,
13,
4706,
525,
5630,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1576,
1404,
4800,
25710,
13,
1678,
5615,
13,
13,
13,
13,
1990,
402,
828,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
29887,
828,
742,
6139,
2433,
29887,
828,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
29887,
828,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
396,
29915,
21570,
3406,
29915,
584,
4235,
29889,
29940,
2868,
29898,
2659,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
4706,
525,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
25237,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
25237,
1024,
5477,
13,
4706,
525,
12690,
29918,
29887,
828,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
12690,
330,
828,
934,
1024,
5477,
13,
4706,
525,
9009,
287,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
9009,
287,
931,
5477,
13,
4706,
525,
369,
2164,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
369,
2164,
931,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
396,
29915,
3084,
1061,
29915,
584,
4235,
29889,
29940,
2868,
29898,
2659,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
23147,
5477,
13,
4706,
525,
6203,
29915,
584,
4235,
29889,
29940,
2868,
29898,
13799,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
4706,
525,
4882,
29915,
584,
4235,
29889,
29940,
2868,
29898,
5709,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
29887,
828,
29918,
8269,
742,
426,
13,
4706,
525,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
25237,
29918,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
25237,
1024,
5477,
13,
4706,
525,
12690,
29918,
29887,
828,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
12690,
330,
828,
934,
1024,
5477,
13,
4706,
525,
6203,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
6203,
1178,
1495,
13,
1678,
5615,
13,
1678,
11539,
353,
7882,
29889,
4299,
877,
29887,
828,
29918,
27902,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
333,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
4882,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1178,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
8824,
29892,
6139,
2433,
23147,
1495,
13,
1678,
5615,
13,
12,
13,
1990,
4412,
29954,
828,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
12690,
29918,
29887,
828,
742,
6139,
2433,
12690,
330,
828,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
12690,
29918,
29887,
828,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
12690,
29918,
29887,
828,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
12690,
330,
828,
934,
1024,
5477,
13,
4706,
525,
9009,
287,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
9009,
287,
931,
5477,
13,
4706,
525,
369,
2164,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
369,
2164,
931,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
23147,
5477,
13,
4706,
525,
6203,
29915,
584,
4235,
29889,
29940,
2868,
29898,
13799,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
4706,
525,
4882,
29915,
584,
4235,
29889,
29940,
2868,
29898,
5709,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
12690,
29918,
29887,
828,
29918,
8269,
742,
426,
13,
4706,
525,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
12690,
29918,
29887,
828,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
12690,
330,
828,
934,
1024,
5477,
13,
4706,
525,
6203,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
6203,
1178,
1495,
13,
1678,
5615,
13,
1678,
11539,
353,
7882,
29889,
4299,
877,
12690,
29918,
29887,
828,
29918,
27902,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
333,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
4882,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1178,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
8824,
29892,
6139,
2433,
23147,
1495,
13,
1678,
5615,
13,
12,
13,
1990,
8878,
886,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
4282,
886,
742,
6139,
2433,
4282,
886,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
4282,
886,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
29887,
828,
29918,
333,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
29887,
828,
29918,
333,
5477,
13,
4706,
525,
12690,
29918,
29887,
828,
29915,
584,
4235,
29889,
29940,
2868,
29898,
16885,
29954,
828,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
4282,
886,
29918,
8269,
742,
426,
13,
4706,
525,
1761,
29918,
29887,
828,
29918,
333,
2396,
4235,
29889,
1293,
29898,
9621,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
29887,
828,
1178,
1495,
511,
13,
4706,
525,
12690,
29918,
29887,
828,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
12690,
330,
828,
1178,
1495,
13,
1678,
5615,
13,
12,
13,
1990,
2598,
2105,
292,
6708,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
3712,
2105,
292,
742,
6139,
2433,
3712,
2105,
292,
5352,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
12715,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
16394,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
16394,
5477,
13,
4706,
525,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
978,
5477,
13,
4706,
525,
2220,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
2220,
5477,
13,
4706,
525,
3545,
2396,
4235,
29889,
11031,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3545,
5477,
13,
4706,
525,
4282,
886,
29915,
584,
4235,
29889,
29940,
2868,
29898,
8893,
886,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
12,
12,
29915,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
369,
2164,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
369,
2164,
931,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
23147,
5477,
13,
4706,
525,
4882,
29915,
584,
4235,
29889,
29940,
2868,
29898,
5709,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
12,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
12715,
29918,
8269,
742,
426,
13,
4706,
525,
978,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
978,
5477,
13,
4706,
525,
2220,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
2220,
5477,
13,
4706,
525,
3545,
2396,
4235,
29889,
11031,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3545,
5477,
13,
4706,
525,
1792,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
970,
1178,
5477,
13,
4706,
525,
29887,
828,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
25237,
330,
828,
1178,
1495,
13,
1678,
5615,
13,
1678,
11539,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
12715,
29918,
27902,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
333,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
4882,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1178,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
8824,
29892,
6139,
2433,
23147,
1495,
13,
1678,
5615,
13,
13,
1990,
2598,
2105,
292,
25971,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
3712,
2105,
292,
742,
6139,
2433,
3712,
2105,
292,
15373,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
21596,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
16394,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
16394,
5477,
13,
4706,
525,
21596,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21596,
29918,
1445,
5477,
13,
4706,
525,
4282,
886,
29915,
584,
4235,
29889,
29940,
2868,
29898,
8893,
886,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
12,
12,
29915,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
369,
2164,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
369,
2164,
931,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
23147,
5477,
13,
4706,
525,
4882,
29915,
584,
4235,
29889,
29940,
2868,
29898,
5709,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
21596,
29918,
8269,
742,
426,
13,
4706,
525,
21596,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21596,
29918,
1445,
5477,
13,
4706,
525,
1792,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
970,
1178,
5477,
13,
4706,
525,
29887,
828,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
25237,
330,
828,
1178,
1495,
13,
1678,
5615,
13,
1678,
11539,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
21596,
29918,
27902,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
333,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
4882,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1178,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
8824,
29892,
6139,
2433,
23147,
1495,
13,
1678,
5615,
13,
13,
13,
1990,
2598,
2105,
292,
15167,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
3712,
2105,
292,
742,
6139,
2433,
3712,
2105,
292,
4863,
4475,
6931,
1495,
13,
1678,
10938,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
9641,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
15070,
29918,
6194,
29922,
5574,
511,
13,
4706,
525,
16394,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
16394,
5477,
13,
4706,
525,
9641,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
9641,
29918,
1445,
5477,
13,
4706,
525,
4282,
886,
29915,
584,
4235,
29889,
29940,
2868,
29898,
8893,
886,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
511,
13,
12,
12,
29915,
21570,
3406,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
21570,
3406,
8952,
5477,
13,
4706,
525,
369,
2164,
29918,
265,
2396,
4235,
29889,
11384,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
369,
2164,
931,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
23147,
5477,
13,
4706,
525,
4882,
29915,
584,
4235,
29889,
29940,
2868,
29898,
5709,
29928,
517,
2141,
11010,
29892,
3734,
29922,
5574,
29897,
13,
1678,
5615,
13,
1678,
6251,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
9641,
29918,
8269,
742,
426,
13,
4706,
525,
9641,
29918,
1445,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
9641,
29918,
1445,
5477,
13,
4706,
525,
1792,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
1792,
970,
1178,
5477,
13,
4706,
525,
29887,
828,
29918,
333,
29915,
584,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
25237,
330,
828,
1178,
1495,
13,
1678,
5615,
13,
1678,
11539,
353,
7882,
29889,
4299,
877,
3712,
2105,
292,
29918,
9641,
29918,
27902,
742,
426,
13,
4706,
525,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
333,
5477,
13,
4706,
525,
3084,
1061,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
3084,
1061,
8952,
5477,
13,
4706,
525,
4882,
29918,
333,
2396,
4235,
29889,
7798,
29898,
12403,
29922,
5574,
29892,
6139,
2433,
4882,
1178,
5477,
13,
4706,
525,
23147,
2396,
4235,
29889,
1231,
29898,
12403,
29922,
8824,
29892,
6139,
2433,
23147,
1495,
13,
1678,
5615,
13,
13,
1990,
4412,
2061,
29928,
517,
29901,
13,
1678,
7882,
353,
14706,
3535,
877,
12690,
3318,
742,
6139,
2433,
12690,
1203,
4475,
6931,
1495,
2
] |
Subsets and Splits