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
|
---|---|---|---|---|---|
basic/arithmetic.py | anuragarwalkar/basic-python | 0 | 118477 | <reponame>anuragarwalkar/basic-python
# Arithmetic Operators
import math
print(math.ceil(2.9)) # 3
print(math.floor(2.9)) # 2
print(10+3) # 13
print(10-3) # 7
print(10/3) # 3.3 Floating point number
print(10//3) # 3 Int
print(10%3) # 1
print(10*3) # 30
print(10**3) # 1000 10 to the power of 3
print(abs(-2.9)) # 2.9
x = 10
x += 3
print(x)
x = 10 + 3 * 2
print(x)
| [
1,
529,
276,
1112,
420,
29958,
273,
332,
28641,
20919,
279,
29914,
16121,
29899,
4691,
13,
29937,
826,
18542,
6607,
4097,
13,
5215,
5844,
13,
13,
2158,
29898,
755,
29889,
27696,
29898,
29906,
29889,
29929,
876,
396,
29871,
29941,
13,
13,
2158,
29898,
755,
29889,
14939,
29898,
29906,
29889,
29929,
876,
396,
29871,
29906,
13,
13,
2158,
29898,
29896,
29900,
29974,
29941,
29897,
396,
29871,
29896,
29941,
13,
2158,
29898,
29896,
29900,
29899,
29941,
29897,
396,
29871,
29955,
13,
2158,
29898,
29896,
29900,
29914,
29941,
29897,
396,
29871,
29941,
29889,
29941,
26043,
1218,
1298,
1353,
13,
2158,
29898,
29896,
29900,
458,
29941,
29897,
396,
29871,
29941,
3159,
13,
2158,
29898,
29896,
29900,
29995,
29941,
29897,
396,
29871,
29896,
13,
2158,
29898,
29896,
29900,
29930,
29941,
29897,
396,
29871,
29941,
29900,
13,
2158,
29898,
29896,
29900,
1068,
29941,
29897,
396,
29871,
29896,
29900,
29900,
29900,
29871,
29896,
29900,
304,
278,
3081,
310,
29871,
29941,
13,
13,
2158,
29898,
6897,
6278,
29906,
29889,
29929,
876,
396,
29871,
29906,
29889,
29929,
13,
13,
29916,
353,
29871,
29896,
29900,
13,
29916,
4619,
29871,
29941,
13,
2158,
29898,
29916,
29897,
13,
13,
29916,
353,
29871,
29896,
29900,
718,
29871,
29941,
334,
29871,
29906,
13,
13,
2158,
29898,
29916,
29897,
13,
2
] |
scripts/generate_ramachandran_statistics.py | leimao/Ramachandran | 2 | 131836 | <gh_stars>1-10
import ramachandran.statistics
ramachandran.statistics.count_torsion_angles_from_directory(dir_path="./pdbx_collections_resolution_1p0", save_file_path="./data/probability.npz", b_factor_threshold=30, resolution=90, num_processes=12)
ramachandran.statistics.compute_gaussian_kde_densities_from_directory(dir_path="./pdbx_collections_resolution_1p0", save_file_path="./data/gaussian_density.npz", b_factor_threshold=30, resolution=360, num_processes=12) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
13472,
496,
392,
661,
29889,
6112,
6765,
13,
13,
2572,
496,
392,
661,
29889,
6112,
6765,
29889,
2798,
29918,
29873,
943,
291,
29918,
19536,
29918,
3166,
29918,
12322,
29898,
3972,
29918,
2084,
543,
6904,
29886,
2585,
29916,
29918,
29027,
29918,
9778,
918,
29918,
29896,
29886,
29900,
613,
4078,
29918,
1445,
29918,
2084,
543,
6904,
1272,
29914,
22795,
3097,
29889,
9302,
29920,
613,
289,
29918,
19790,
29918,
386,
12268,
29922,
29941,
29900,
29892,
10104,
29922,
29929,
29900,
29892,
954,
29918,
5014,
267,
29922,
29896,
29906,
29897,
13,
13,
2572,
496,
392,
661,
29889,
6112,
6765,
29889,
26017,
29918,
29887,
17019,
29918,
29895,
311,
29918,
21518,
1907,
29918,
3166,
29918,
12322,
29898,
3972,
29918,
2084,
543,
6904,
29886,
2585,
29916,
29918,
29027,
29918,
9778,
918,
29918,
29896,
29886,
29900,
613,
4078,
29918,
1445,
29918,
2084,
543,
6904,
1272,
29914,
29887,
17019,
29918,
21518,
537,
29889,
9302,
29920,
613,
289,
29918,
19790,
29918,
386,
12268,
29922,
29941,
29900,
29892,
10104,
29922,
29941,
29953,
29900,
29892,
954,
29918,
5014,
267,
29922,
29896,
29906,
29897,
2
] |
calibrate.py | malcolmdimeglio/pow_alert | 0 | 183798 | <filename>calibrate.py
#! /usr/bin/env python
import os
import cv2
import numpy as np
from matplotlib import pyplot as plt
from dotenv import load_dotenv, find_dotenv
from logger import *
load_dotenv(find_dotenv())
curr_dir = os.path.dirname(os.path.realpath(__file__))
cypress_cal_img =f"{curr_dir}/templates/SnowStake_Cypress_night0.jpg"
cypress_top_template_img = f"{curr_dir}/templates/40.jpg"
cypress_base_template_img = f"{curr_dir}/templates/base.jpg"
# All the 6 methods for comparison
methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR',
'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', 'cv2.TM_SQDIFF_NORMED']
def cypress_img(debug_option=False):
log.debug("Calibrate Cypress webacam")
log.debug(f"Template images used to perform calibration: \n" \
f" - Webcam: {cypress_cal_img}\n" \
f" - Top ROI: {cypress_top_template_img}\n" \
f" - Bottom ROI: {cypress_base_template_img}")
# the following image will be used to calibrate the scale
img = cv2.imread(cypress_cal_img, 0)
img2 = img.copy()
template1 = cv2.imread(cypress_top_template_img, 0)
template2 = cv2.imread(cypress_base_template_img, 0)
log.debug("Resize templates by a 1:2 factor to accomodate Apple grab tool effect")
template1 = cv2.resize(template1, (0, 0), fx=0.5, fy=0.5)
template2 = cv2.resize(template2, (0, 0), fx=0.5, fy=0.5)
h1, w1 = template1.shape
h2, w2 = template2.shape
if debug_option:
# allows to pick which method works best
for meth in methods:
img = img2.copy()
method = eval(meth)
# Apply template Matching
res = cv2.matchTemplate(img, template1, method)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
# If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum
if method in [cv2.TM_SQDIFF, cv2.TM_SQDIFF_NORMED]:
top_left = min_loc
else:
top_left = max_loc
bottom_right = (top_left[0] + w1, top_left[1] + h1)
cv2.rectangle(img, top_left, bottom_right, 255, 2)
plt.subplot(111), plt.imshow(img, cmap='gray')
plt.title(meth), plt.xticks([]), plt.yticks([])
plt.show()
print("TM_CCOEFF_NORMED is best method (or equivalent to TM_CCORR_NORMED, TM_SQDIFF, TM_SQDIFF_NORMED)")
print("TM_CCORR is the worst")
debug.log("Use TM_CCOEFF_NORMED method to find template ROI images on calibration image")
method = eval('cv2.TM_CCOEFF_NORMED')
img = img2.copy()
res1 = cv2.matchTemplate(img, template1, method)
res2 = cv2.matchTemplate(img, template2, method)
debug.log("Extract the 4 coordinates for the whole ROI")
min_val1, max_val1, min_loc1, max_loc1 = cv2.minMaxLoc(res1)
min_val2, max_val2, min_loc2, max_loc2 = cv2.minMaxLoc(res2)
top_left1 = max_loc1
top_left2 = max_loc2
bottom_right1 = (top_left1[0] + w1, top_left1[1] + h1)
bottom_right2 = (top_left2[0] + w2, top_left2[1] + h2)
if debug_option:
roi_top_left = top_left1
roi_top_right = (top_left1[0] + w1, top_left1[1])
roi_bottom_right = bottom_right2
roi_bottom_left = (bottom_right2[0] - w2, bottom_right2[1])
cv2.rectangle(img, top_left1, bottom_right1, 255, 2)
cv2.rectangle(img, top_left2, bottom_right2, 255, 2)
points = [
list(roi_top_left),
list(roi_top_right),
list(roi_bottom_right),
list(roi_bottom_left)
]
# Now plot the ROI
pts = np.array(points, np.int32)
cv2.polylines(img, [pts], True, (255, 255, 255), thickness=5)
plt.subplot(111), plt.imshow(img, cmap='gray')
plt.title('ROI'), plt.xticks([]), plt.yticks([])
plt.show()
top_left_offset = (0, 0)
top_right_offset = (w1, 0)
bottom_left_offset = ((bottom_right2[0] - w2) - top_left1[0], bottom_right2[1] - top_left1[1])
bottom_right_offset = (bottom_right2[0] - top_left1[0], bottom_right2[1] - top_left1[1])
log.debug("Update .env file with the offset to apply to get the 4 corners of the ROI")
log.debug("TOP_LEFT_OFFSET=\""+str(top_left_offset)+"\"\n" \
"TOP_RIGHT_OFFSET=\"" + str(top_right_offset) + "\"\n" \
"BOTTOM_LEFT_OFFSET=\"" + str(bottom_left_offset) + "\"\n" \
"BOTTOM_RIGHT_OFFSET=\"" + str(bottom_right_offset) + "\"\n")
with open(".env", 'a') as env:
env.write("\n")
env.write("TOP_LEFT_OFFSET=\""+str(top_left_offset)+"\"\n")
env.write("TOP_RIGHT_OFFSET=\"" + str(top_right_offset) + "\"\n")
env.write("BOTTOM_LEFT_OFFSET=\"" + str(bottom_left_offset) + "\"\n")
env.write("BOTTOM_RIGHT_OFFSET=\"" + str(bottom_right_offset) + "\"\n")
| [
1,
529,
9507,
29958,
1052,
4626,
403,
29889,
2272,
13,
29937,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
2897,
13,
5215,
13850,
29906,
13,
5215,
12655,
408,
7442,
13,
3166,
22889,
1053,
11451,
5317,
408,
14770,
13,
3166,
8329,
6272,
1053,
2254,
29918,
6333,
6272,
29892,
1284,
29918,
6333,
6272,
13,
3166,
17927,
1053,
334,
13,
13,
13,
1359,
29918,
6333,
6272,
29898,
2886,
29918,
6333,
6272,
3101,
13,
21962,
29918,
3972,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
876,
13,
13,
1270,
2139,
29918,
1052,
29918,
2492,
353,
29888,
29908,
29912,
21962,
29918,
3972,
6822,
20943,
29914,
29903,
3707,
855,
1296,
29918,
29733,
2139,
29918,
11147,
29900,
29889,
6173,
29908,
13,
1270,
2139,
29918,
3332,
29918,
6886,
29918,
2492,
353,
285,
29908,
29912,
21962,
29918,
3972,
6822,
20943,
29914,
29946,
29900,
29889,
6173,
29908,
13,
1270,
2139,
29918,
3188,
29918,
6886,
29918,
2492,
353,
285,
29908,
29912,
21962,
29918,
3972,
6822,
20943,
29914,
3188,
29889,
6173,
29908,
13,
13,
13,
29937,
2178,
278,
29871,
29953,
3519,
363,
10230,
13,
23515,
353,
6024,
11023,
29906,
29889,
23081,
29918,
29907,
3217,
29923,
4198,
742,
525,
11023,
29906,
29889,
23081,
29918,
29907,
3217,
29923,
4198,
29918,
29940,
1955,
2303,
29928,
742,
525,
11023,
29906,
29889,
23081,
29918,
4174,
1955,
29934,
742,
13,
9651,
525,
11023,
29906,
29889,
23081,
29918,
4174,
1955,
29934,
29918,
29940,
1955,
2303,
29928,
742,
525,
11023,
29906,
29889,
23081,
29918,
29903,
29984,
4571,
4198,
742,
525,
11023,
29906,
29889,
23081,
29918,
29903,
29984,
4571,
4198,
29918,
29940,
1955,
2303,
29928,
2033,
13,
13,
13,
1753,
5094,
2139,
29918,
2492,
29898,
8382,
29918,
3385,
29922,
8824,
1125,
13,
1678,
1480,
29889,
8382,
703,
7856,
4626,
403,
8045,
2139,
1856,
562,
314,
1159,
13,
1678,
1480,
29889,
8382,
29898,
29888,
29908,
6733,
4558,
1304,
304,
2189,
1208,
26218,
29901,
320,
29876,
29908,
320,
13,
4706,
285,
29908,
448,
2563,
11108,
29901,
426,
1270,
2139,
29918,
1052,
29918,
2492,
1012,
29876,
29908,
320,
13,
4706,
285,
29908,
448,
7488,
16641,
29902,
29901,
426,
1270,
2139,
29918,
3332,
29918,
6886,
29918,
2492,
1012,
29876,
29908,
320,
13,
4706,
285,
29908,
448,
350,
3570,
16641,
29902,
29901,
426,
1270,
2139,
29918,
3188,
29918,
6886,
29918,
2492,
27195,
13,
13,
1678,
396,
278,
1494,
1967,
674,
367,
1304,
304,
1208,
4626,
403,
278,
6287,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
1270,
2139,
29918,
1052,
29918,
2492,
29892,
29871,
29900,
29897,
13,
1678,
10153,
29906,
353,
10153,
29889,
8552,
580,
13,
1678,
4472,
29896,
353,
13850,
29906,
29889,
326,
949,
29898,
1270,
2139,
29918,
3332,
29918,
6886,
29918,
2492,
29892,
29871,
29900,
29897,
13,
1678,
4472,
29906,
353,
13850,
29906,
29889,
326,
949,
29898,
1270,
2139,
29918,
3188,
29918,
6886,
29918,
2492,
29892,
29871,
29900,
29897,
13,
13,
1678,
1480,
29889,
8382,
703,
1666,
675,
17475,
491,
263,
29871,
29896,
29901,
29906,
7329,
304,
7954,
397,
403,
12113,
17229,
5780,
2779,
1159,
13,
1678,
4472,
29896,
353,
13850,
29906,
29889,
21476,
29898,
6886,
29896,
29892,
313,
29900,
29892,
29871,
29900,
511,
285,
29916,
29922,
29900,
29889,
29945,
29892,
285,
29891,
29922,
29900,
29889,
29945,
29897,
13,
1678,
4472,
29906,
353,
13850,
29906,
29889,
21476,
29898,
6886,
29906,
29892,
313,
29900,
29892,
29871,
29900,
511,
285,
29916,
29922,
29900,
29889,
29945,
29892,
285,
29891,
29922,
29900,
29889,
29945,
29897,
13,
1678,
298,
29896,
29892,
281,
29896,
353,
4472,
29896,
29889,
12181,
13,
1678,
298,
29906,
29892,
281,
29906,
353,
4472,
29906,
29889,
12181,
13,
13,
1678,
565,
4744,
29918,
3385,
29901,
13,
4706,
396,
6511,
304,
5839,
607,
1158,
1736,
1900,
13,
4706,
363,
286,
621,
297,
3519,
29901,
13,
9651,
10153,
353,
10153,
29906,
29889,
8552,
580,
13,
9651,
1158,
353,
19745,
29898,
29885,
621,
29897,
13,
13,
9651,
396,
2401,
368,
4472,
14514,
292,
13,
9651,
620,
353,
13850,
29906,
29889,
4352,
6733,
29898,
2492,
29892,
4472,
29896,
29892,
1158,
29897,
13,
9651,
1375,
29918,
791,
29892,
4236,
29918,
791,
29892,
1375,
29918,
2029,
29892,
4236,
29918,
2029,
353,
13850,
29906,
29889,
1195,
7976,
3524,
29898,
690,
29897,
13,
13,
9651,
396,
960,
278,
1158,
338,
323,
29924,
29918,
29903,
29984,
4571,
4198,
470,
323,
29924,
29918,
29903,
29984,
4571,
4198,
29918,
29940,
1955,
2303,
29928,
29892,
2125,
9212,
13,
9651,
565,
1158,
297,
518,
11023,
29906,
29889,
23081,
29918,
29903,
29984,
4571,
4198,
29892,
13850,
29906,
29889,
23081,
29918,
29903,
29984,
4571,
4198,
29918,
29940,
1955,
2303,
29928,
5387,
13,
18884,
2246,
29918,
1563,
353,
1375,
29918,
2029,
13,
9651,
1683,
29901,
13,
18884,
2246,
29918,
1563,
353,
4236,
29918,
2029,
13,
9651,
5970,
29918,
1266,
353,
313,
3332,
29918,
1563,
29961,
29900,
29962,
718,
281,
29896,
29892,
2246,
29918,
1563,
29961,
29896,
29962,
718,
298,
29896,
29897,
13,
13,
9651,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
2246,
29918,
1563,
29892,
5970,
29918,
1266,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29897,
13,
13,
9651,
14770,
29889,
1491,
5317,
29898,
29896,
29896,
29896,
511,
14770,
29889,
326,
4294,
29898,
2492,
29892,
274,
1958,
2433,
21012,
1495,
13,
9651,
14770,
29889,
3257,
29898,
29885,
621,
511,
14770,
29889,
486,
7358,
29898,
2636,
511,
14770,
29889,
3637,
7358,
4197,
2314,
13,
9651,
14770,
29889,
4294,
580,
13,
13,
4706,
1596,
703,
23081,
29918,
29907,
3217,
29923,
4198,
29918,
29940,
1955,
2303,
29928,
338,
1900,
1158,
313,
272,
7126,
304,
323,
29924,
29918,
4174,
1955,
29934,
29918,
29940,
1955,
2303,
29928,
29892,
323,
29924,
29918,
29903,
29984,
4571,
4198,
29892,
323,
29924,
29918,
29903,
29984,
4571,
4198,
29918,
29940,
1955,
2303,
29928,
25760,
13,
4706,
1596,
703,
23081,
29918,
4174,
1955,
29934,
338,
278,
17322,
1159,
13,
13,
1678,
4744,
29889,
1188,
703,
11403,
323,
29924,
29918,
29907,
3217,
29923,
4198,
29918,
29940,
1955,
2303,
29928,
1158,
304,
1284,
4472,
16641,
29902,
4558,
373,
1208,
26218,
1967,
1159,
13,
1678,
1158,
353,
19745,
877,
11023,
29906,
29889,
23081,
29918,
29907,
3217,
29923,
4198,
29918,
29940,
1955,
2303,
29928,
1495,
13,
1678,
10153,
353,
10153,
29906,
29889,
8552,
580,
13,
1678,
620,
29896,
353,
13850,
29906,
29889,
4352,
6733,
29898,
2492,
29892,
4472,
29896,
29892,
1158,
29897,
13,
1678,
620,
29906,
353,
13850,
29906,
29889,
4352,
6733,
29898,
2492,
29892,
4472,
29906,
29892,
1158,
29897,
13,
13,
1678,
4744,
29889,
1188,
703,
5647,
1461,
278,
29871,
29946,
10350,
363,
278,
3353,
16641,
29902,
1159,
13,
1678,
1375,
29918,
791,
29896,
29892,
4236,
29918,
791,
29896,
29892,
1375,
29918,
2029,
29896,
29892,
4236,
29918,
2029,
29896,
353,
13850,
29906,
29889,
1195,
7976,
3524,
29898,
690,
29896,
29897,
13,
1678,
1375,
29918,
791,
29906,
29892,
4236,
29918,
791,
29906,
29892,
1375,
29918,
2029,
29906,
29892,
4236,
29918,
2029,
29906,
353,
13850,
29906,
29889,
1195,
7976,
3524,
29898,
690,
29906,
29897,
13,
1678,
2246,
29918,
1563,
29896,
353,
4236,
29918,
2029,
29896,
13,
1678,
2246,
29918,
1563,
29906,
353,
4236,
29918,
2029,
29906,
13,
1678,
5970,
29918,
1266,
29896,
353,
313,
3332,
29918,
1563,
29896,
29961,
29900,
29962,
718,
281,
29896,
29892,
2246,
29918,
1563,
29896,
29961,
29896,
29962,
718,
298,
29896,
29897,
13,
1678,
5970,
29918,
1266,
29906,
353,
313,
3332,
29918,
1563,
29906,
29961,
29900,
29962,
718,
281,
29906,
29892,
2246,
29918,
1563,
29906,
29961,
29896,
29962,
718,
298,
29906,
29897,
13,
13,
1678,
565,
4744,
29918,
3385,
29901,
13,
4706,
14100,
29918,
3332,
29918,
1563,
353,
2246,
29918,
1563,
29896,
13,
4706,
14100,
29918,
3332,
29918,
1266,
353,
313,
3332,
29918,
1563,
29896,
29961,
29900,
29962,
718,
281,
29896,
29892,
2246,
29918,
1563,
29896,
29961,
29896,
2314,
13,
4706,
14100,
29918,
8968,
29918,
1266,
353,
5970,
29918,
1266,
29906,
13,
4706,
14100,
29918,
8968,
29918,
1563,
353,
313,
8968,
29918,
1266,
29906,
29961,
29900,
29962,
448,
281,
29906,
29892,
5970,
29918,
1266,
29906,
29961,
29896,
2314,
13,
13,
4706,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
2246,
29918,
1563,
29896,
29892,
5970,
29918,
1266,
29896,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29897,
13,
4706,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
2246,
29918,
1563,
29906,
29892,
5970,
29918,
1266,
29906,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29897,
13,
13,
4706,
3291,
353,
518,
13,
9651,
1051,
29898,
307,
29875,
29918,
3332,
29918,
1563,
511,
13,
9651,
1051,
29898,
307,
29875,
29918,
3332,
29918,
1266,
511,
13,
9651,
1051,
29898,
307,
29875,
29918,
8968,
29918,
1266,
511,
13,
9651,
1051,
29898,
307,
29875,
29918,
8968,
29918,
1563,
29897,
13,
9651,
4514,
13,
13,
4706,
396,
2567,
6492,
278,
16641,
29902,
13,
4706,
282,
1372,
353,
7442,
29889,
2378,
29898,
9748,
29892,
7442,
29889,
524,
29941,
29906,
29897,
13,
4706,
13850,
29906,
29889,
3733,
2904,
1475,
29898,
2492,
29892,
518,
16485,
1402,
5852,
29892,
313,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
12003,
2264,
29922,
29945,
29897,
13,
13,
4706,
14770,
29889,
1491,
5317,
29898,
29896,
29896,
29896,
511,
14770,
29889,
326,
4294,
29898,
2492,
29892,
274,
1958,
2433,
21012,
1495,
13,
4706,
14770,
29889,
3257,
877,
1672,
29902,
5477,
14770,
29889,
486,
7358,
29898,
2636,
511,
14770,
29889,
3637,
7358,
4197,
2314,
13,
4706,
14770,
29889,
4294,
580,
13,
13,
1678,
2246,
29918,
1563,
29918,
10289,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
1678,
2246,
29918,
1266,
29918,
10289,
353,
313,
29893,
29896,
29892,
29871,
29900,
29897,
13,
1678,
5970,
29918,
1563,
29918,
10289,
353,
5135,
8968,
29918,
1266,
29906,
29961,
29900,
29962,
448,
281,
29906,
29897,
448,
2246,
29918,
1563,
29896,
29961,
29900,
1402,
5970,
29918,
1266,
29906,
29961,
29896,
29962,
448,
2246,
29918,
1563,
29896,
29961,
29896,
2314,
13,
1678,
5970,
29918,
1266,
29918,
10289,
353,
313,
8968,
29918,
1266,
29906,
29961,
29900,
29962,
448,
2246,
29918,
1563,
29896,
29961,
29900,
1402,
5970,
29918,
1266,
29906,
29961,
29896,
29962,
448,
2246,
29918,
1563,
29896,
29961,
29896,
2314,
13,
13,
1678,
1480,
29889,
8382,
703,
6422,
869,
6272,
934,
411,
278,
9210,
304,
3394,
304,
679,
278,
29871,
29946,
26995,
310,
278,
16641,
29902,
1159,
13,
1678,
1480,
29889,
8382,
703,
29911,
4590,
29918,
28024,
29918,
27681,
10490,
14672,
17969,
710,
29898,
3332,
29918,
1563,
29918,
10289,
7240,
29908,
5931,
29905,
29876,
29908,
320,
13,
4706,
376,
29911,
4590,
29918,
22789,
3912,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
3332,
29918,
1266,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
29908,
320,
13,
4706,
376,
29933,
2891,
4986,
29924,
29918,
28024,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
8968,
29918,
1563,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
29908,
320,
13,
4706,
376,
29933,
2891,
4986,
29924,
29918,
22789,
3912,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
8968,
29918,
1266,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
1159,
13,
13,
1678,
411,
1722,
17350,
6272,
613,
525,
29874,
1495,
408,
8829,
29901,
13,
4706,
8829,
29889,
3539,
14182,
29876,
1159,
13,
4706,
8829,
29889,
3539,
703,
29911,
4590,
29918,
28024,
29918,
27681,
10490,
14672,
17969,
710,
29898,
3332,
29918,
1563,
29918,
10289,
7240,
29908,
5931,
29905,
29876,
1159,
13,
4706,
8829,
29889,
3539,
703,
29911,
4590,
29918,
22789,
3912,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
3332,
29918,
1266,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
1159,
13,
4706,
8829,
29889,
3539,
703,
29933,
2891,
4986,
29924,
29918,
28024,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
8968,
29918,
1563,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
1159,
13,
4706,
8829,
29889,
3539,
703,
29933,
2891,
4986,
29924,
29918,
22789,
3912,
29918,
27681,
10490,
14672,
29908,
718,
851,
29898,
8968,
29918,
1266,
29918,
10289,
29897,
718,
376,
5931,
29905,
29876,
1159,
13,
13,
2
] |
growler/middleware/responsetime.py | pyGrowler/Growler | 806 | 191468 | <reponame>pyGrowler/Growler
#
# growler/middleware/responsetime.py
#
"""
Provides middleware which adds a header indicating how long the request took to
process
"""
import time
import logging
logger = logging.getLogger(__name__)
class ResponseTime:
"""
Middleware which saves the time when initially called, and sets an
'on_headers' event to get the time difference which can be logged or sent
to the client.
"""
UNIT_TO_FACTOR_MAP = {
's': 1,
'ms': 1000,
'us': 1000000,
}
def __init__(self,
digits=3,
log=None,
units='ms',
header="X-Response-Time",
suffix=True,
clobber_header=False):
"""
Construct ResponseTime middleware.
Parameters:
digits (int): precision
log (Logger or None): Writes the time difference to the log
units (str): Time units (default: milliseconds 'ms')
header (str): Name of header to send response time as
suffix (bool): Whether to format with
"""
self.units = units
self.header_name = header
self.digits = digits
self.log = log if log else logger.getChild("id=%x" % id(self))
self.suffix = suffix
self.clobber_header = clobber_header
def __call__(self, req, res):
start_time = time.monotonic()
def on_header_send():
# if header already exists, do NOT clobber it
if not self.clobber_header and self.header_name in res.headers:
return
dt = self.format_timediff(time.monotonic() - start_time)
val = "{}{}".format(dt, self.units) if self.suffix else dt
res.set(self.header_name, val)
if self.log:
self.log.info("-- timer %s", val)
res.events.on('before_headers', on_header_send)
def format_timediff(self, td):
factor = self.UNIT_TO_FACTOR_MAP[self.units]
return str(round(factor * td, self.digits))
| [
1,
529,
276,
1112,
420,
29958,
2272,
29954,
798,
1358,
29914,
29954,
798,
1358,
13,
29937,
13,
29937,
6548,
1358,
29914,
17662,
2519,
29914,
26679,
5410,
29889,
2272,
13,
29937,
13,
15945,
29908,
13,
1184,
29894,
2247,
7256,
2519,
607,
12778,
263,
4839,
23941,
920,
1472,
278,
2009,
3614,
304,
13,
5014,
13,
15945,
29908,
13,
13,
5215,
931,
13,
5215,
12183,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
13291,
2481,
29901,
13,
1678,
9995,
13,
1678,
14253,
2519,
607,
27401,
278,
931,
746,
12919,
2000,
29892,
322,
6166,
385,
13,
1678,
525,
265,
29918,
13662,
29915,
1741,
304,
679,
278,
931,
4328,
607,
508,
367,
13817,
470,
2665,
13,
1678,
304,
278,
3132,
29889,
13,
1678,
9995,
13,
13,
1678,
8291,
1806,
29918,
4986,
29918,
4519,
1783,
1955,
29918,
23827,
353,
426,
13,
4706,
525,
29879,
2396,
29871,
29896,
29892,
13,
4706,
525,
1516,
2396,
29871,
29896,
29900,
29900,
29900,
29892,
13,
4706,
525,
375,
2396,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
13,
1678,
500,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
13340,
29922,
29941,
29892,
13,
462,
1480,
29922,
8516,
29892,
13,
462,
10340,
2433,
1516,
742,
13,
462,
4839,
543,
29990,
29899,
5103,
29899,
2481,
613,
13,
462,
25557,
29922,
5574,
29892,
13,
462,
274,
2127,
495,
29918,
6672,
29922,
8824,
1125,
13,
4706,
9995,
13,
4706,
1281,
4984,
13291,
2481,
7256,
2519,
29889,
13,
13,
4706,
12662,
2699,
29901,
13,
9651,
13340,
313,
524,
1125,
16716,
13,
9651,
1480,
313,
16363,
470,
6213,
1125,
16849,
267,
278,
931,
4328,
304,
278,
1480,
13,
9651,
10340,
313,
710,
1125,
5974,
10340,
313,
4381,
29901,
3533,
21462,
525,
1516,
1495,
13,
9651,
4839,
313,
710,
1125,
4408,
310,
4839,
304,
3638,
2933,
931,
408,
13,
9651,
25557,
313,
11227,
1125,
26460,
304,
3402,
411,
13,
4706,
9995,
13,
4706,
1583,
29889,
348,
1169,
353,
10340,
13,
4706,
1583,
29889,
6672,
29918,
978,
353,
4839,
13,
4706,
1583,
29889,
7501,
1169,
353,
13340,
13,
4706,
1583,
29889,
1188,
353,
1480,
565,
1480,
1683,
17927,
29889,
657,
5938,
703,
333,
16328,
29916,
29908,
1273,
1178,
29898,
1311,
876,
13,
4706,
1583,
29889,
2146,
600,
861,
353,
25557,
13,
4706,
1583,
29889,
29883,
2127,
495,
29918,
6672,
353,
274,
2127,
495,
29918,
6672,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
12428,
29892,
620,
1125,
13,
4706,
1369,
29918,
2230,
353,
931,
29889,
3712,
327,
8927,
580,
13,
13,
4706,
822,
373,
29918,
6672,
29918,
6717,
7295,
13,
9651,
396,
565,
4839,
2307,
4864,
29892,
437,
6058,
274,
2127,
495,
372,
13,
9651,
565,
451,
1583,
29889,
29883,
2127,
495,
29918,
6672,
322,
1583,
29889,
6672,
29918,
978,
297,
620,
29889,
13662,
29901,
13,
18884,
736,
13,
13,
9651,
11636,
353,
1583,
29889,
4830,
29918,
9346,
287,
2593,
29898,
2230,
29889,
3712,
327,
8927,
580,
448,
1369,
29918,
2230,
29897,
13,
9651,
659,
353,
29850,
1157,
29913,
1642,
4830,
29898,
6008,
29892,
1583,
29889,
348,
1169,
29897,
565,
1583,
29889,
2146,
600,
861,
1683,
11636,
13,
9651,
620,
29889,
842,
29898,
1311,
29889,
6672,
29918,
978,
29892,
659,
29897,
13,
13,
9651,
565,
1583,
29889,
1188,
29901,
13,
18884,
1583,
29889,
1188,
29889,
3888,
703,
489,
12237,
1273,
29879,
613,
659,
29897,
13,
13,
4706,
620,
29889,
13604,
29889,
265,
877,
11083,
29918,
13662,
742,
373,
29918,
6672,
29918,
6717,
29897,
13,
13,
1678,
822,
3402,
29918,
9346,
287,
2593,
29898,
1311,
29892,
22599,
1125,
13,
4706,
7329,
353,
1583,
29889,
3904,
1806,
29918,
4986,
29918,
4519,
1783,
1955,
29918,
23827,
29961,
1311,
29889,
348,
1169,
29962,
13,
4706,
736,
851,
29898,
14486,
29898,
19790,
334,
22599,
29892,
1583,
29889,
7501,
1169,
876,
13,
2
] |
test_calculator.py | Kidatoy/Advanced-Calculator | 0 | 11307 | <reponame>Kidatoy/Advanced-Calculator
import unittest # https://docs.python.org/3/library/unittest.html
from modules.calculator import Calculator as Calc
class TestCalculator(unittest.TestCase):
"""
Test Driven Development Unittest File
Module: Calculator
Updated: 12/16/2019
Author: <NAME>
"""
def test_addition(self):
"""
Evaluate addition corner cases
"""
self.assertEqual(2, Calc().eval('1+1'))
self.assertEqual(2, Calc().eval('1.0+1.0'))
self.assertEqual(0, Calc().eval('-1+1'))
self.assertEqual(-2, Calc().eval('-1+-1'))
def test_subtraction(self):
"""
Evaluate subtraction corner cases
"""
self.assertEqual(0, Calc().eval('1-1'))
self.assertEqual(-2, Calc().eval('-1-1'))
self.assertEqual(0, Calc().eval('-1--1'))
def test_multiplication(self):
"""
Evaluate multiplication corner cases
"""
self.assertEqual(0, Calc().eval('1*0'))
self.assertEqual(0, Calc().eval('0*-1'))
self.assertEqual(1, Calc().eval('1*1'))
self.assertEqual(-1, Calc().eval('-1*1'))
self.assertEqual(1, Calc().eval('-1*-1'))
self.assertEqual(1, Calc().eval('.25*4'))
def test_division(self):
"""
Test division corner cases
Note: division by zero is handled in test_exceptions
"""
self.assertEqual(1, Calc().eval('1/1'))
self.assertEqual(.25, Calc().eval('1/4'))
self.assertEqual(-1, Calc().eval('-1/1'))
self.assertEqual(1, Calc().eval('-1/-1'))
self.assertEqual(0, Calc().eval('0/-1'))
def test_exponents(self):
"""
Test exponent corner cases
"""
self.assertEqual(1, Calc().eval('2^0'))
self.assertEqual(2, Calc().eval('2^1'))
self.assertEqual(4, Calc().eval('2^2'))
self.assertEqual(.5, Calc().eval('2^-1'))
self.assertEqual(4, Calc().eval('-2^2'))
def test_parentheses(self):
"""
Test parentheses corner cases
"""
self.assertEqual(5.0, Calc().eval('(4.0)+1'))
self.assertEqual(3.0, Calc().eval('(4+1)-2'))
self.assertEqual(5.0, Calc().eval('(5+-5)+5'))
self.assertEqual(-5.0, Calc().eval('(-10+3)+2'))
self.assertEqual(-26.0, Calc().eval('10-(3*2)^2'))
def test_pi(self):
"""
Test pi corner cases
"""
self.assertEqual(4.1415926535, Calc().eval('(pi)+1'))
self.assertEqual(1.1415926535, Calc().eval('(pi)-2'))
self.assertEqual(3.1415926535, Calc().eval('(pi+-5)+5'))
self.assertEqual(1.8584073465, Calc().eval('(-pi+3)+2'))
self.assertEqual(-29.478417602100684, Calc().eval('10-(pi*2)^2'))
self.assertEqual(1.57079632675, Calc().eval('pi/2'))
def test_e(self):
"""
Test e corner cases
"""
self.assertEqual(3.7182818284, Calc().eval('(e)+1'))
self.assertEqual(0.7182818283999999, Calc().eval('(e)-2'))
self.assertEqual(2.7182818284, Calc().eval('(e+-5)+5'))
self.assertEqual(2.2817181716, Calc().eval('(-e+3)+2'))
self.assertEqual(-19.556224394438587, Calc().eval('10-(e*2)^2'))
self.assertEqual(1.3591409142, Calc().eval('e/2'))
def test_phi(self):
"""
Test phi corner cases
"""
self.assertEqual(2.6180339886999997, Calc().eval('(phi)+1'))
self.assertEqual(-0.3819660113000001, Calc().eval('(phi)-2'))
self.assertEqual(1.6180339886999997, Calc().eval('(phi+-5)+5'))
self.assertEqual(3.3819660113000003, Calc().eval('(-phi+3)+2'))
self.assertEqual(-0.47213595435372646, Calc().eval('10-(phi*2)^2'))
self.assertEqual(0.80901699435, Calc().eval('phi/2'))
| [
1,
529,
276,
1112,
420,
29958,
29968,
333,
1219,
29891,
29914,
3253,
16858,
29899,
27065,
1061,
13,
5215,
443,
27958,
396,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29941,
29914,
5258,
29914,
348,
27958,
29889,
1420,
13,
3166,
10585,
29889,
15807,
1061,
1053,
20535,
1061,
408,
3037,
29883,
13,
13,
13,
1990,
4321,
27065,
1061,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
9995,
13,
1678,
4321,
360,
374,
854,
14650,
853,
27958,
3497,
13,
1678,
15591,
29901,
20535,
1061,
13,
1678,
25723,
29901,
29871,
29896,
29906,
29914,
29896,
29953,
29914,
29906,
29900,
29896,
29929,
13,
1678,
13361,
29901,
529,
5813,
29958,
13,
1678,
9995,
13,
1678,
822,
1243,
29918,
1202,
654,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
382,
4387,
403,
6124,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29974,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29889,
29900,
29974,
29896,
29889,
29900,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29974,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29974,
29899,
29896,
8785,
13,
13,
1678,
822,
1243,
29918,
1491,
3018,
428,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
382,
4387,
403,
1014,
3018,
428,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29899,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29899,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
489,
29896,
8785,
13,
268,
13,
1678,
822,
1243,
29918,
18056,
1414,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
382,
4387,
403,
21666,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29930,
29900,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29900,
29930,
29899,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29930,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29930,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29930,
29899,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
12839,
29906,
29945,
29930,
29946,
8785,
13,
268,
13,
1678,
822,
1243,
29918,
4563,
2459,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
8542,
11155,
4251,
13,
4706,
3940,
29901,
8542,
491,
5225,
338,
16459,
297,
1243,
29918,
11739,
29879,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29914,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
11891,
29906,
29945,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29914,
29946,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
29914,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29896,
24028,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29900,
24028,
29896,
8785,
13,
268,
13,
1678,
822,
1243,
29918,
735,
9340,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
28869,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29906,
29985,
29900,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29906,
29985,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29946,
29892,
3037,
29883,
2141,
14513,
877,
29906,
29985,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
11891,
29945,
29892,
3037,
29883,
2141,
14513,
877,
29906,
21583,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29946,
29892,
3037,
29883,
2141,
14513,
877,
29899,
29906,
29985,
29906,
8785,
13,
13,
1678,
822,
1243,
29918,
3560,
13244,
267,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29494,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29945,
29889,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29946,
29889,
29900,
7240,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29889,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29946,
29974,
29896,
6817,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29945,
29889,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29945,
29974,
29899,
29945,
7240,
29945,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29945,
29889,
29900,
29892,
3037,
29883,
2141,
14513,
877,
6278,
29896,
29900,
29974,
29941,
7240,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29906,
29953,
29889,
29900,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29900,
17722,
29941,
29930,
29906,
4887,
29906,
8785,
13,
418,
13,
1678,
822,
1243,
29918,
1631,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
2930,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29946,
29889,
29896,
29946,
29896,
29945,
29929,
29906,
29953,
29945,
29941,
29945,
29892,
3037,
29883,
2141,
14513,
877,
29898,
1631,
7240,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29889,
29896,
29946,
29896,
29945,
29929,
29906,
29953,
29945,
29941,
29945,
29892,
3037,
29883,
2141,
14513,
877,
29898,
1631,
6817,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29889,
29896,
29946,
29896,
29945,
29929,
29906,
29953,
29945,
29941,
29945,
29892,
3037,
29883,
2141,
14513,
877,
29898,
1631,
29974,
29899,
29945,
7240,
29945,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29889,
29947,
29945,
29947,
29946,
29900,
29955,
29941,
29946,
29953,
29945,
29892,
3037,
29883,
2141,
14513,
877,
6278,
1631,
29974,
29941,
7240,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29906,
29929,
29889,
29946,
29955,
29947,
29946,
29896,
29955,
29953,
29900,
29906,
29896,
29900,
29900,
29953,
29947,
29946,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29900,
17722,
1631,
29930,
29906,
4887,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29889,
29945,
29955,
29900,
29955,
29929,
29953,
29941,
29906,
29953,
29955,
29945,
29892,
3037,
29883,
2141,
14513,
877,
1631,
29914,
29906,
8785,
13,
13,
1678,
822,
1243,
29918,
29872,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
321,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29889,
29955,
29896,
29947,
29906,
29947,
29896,
29947,
29906,
29947,
29946,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29872,
7240,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29889,
29955,
29896,
29947,
29906,
29947,
29896,
29947,
29906,
29947,
29941,
29929,
29929,
29929,
29929,
29929,
29929,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29872,
6817,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29889,
29955,
29896,
29947,
29906,
29947,
29896,
29947,
29906,
29947,
29946,
29892,
3037,
29883,
2141,
14513,
877,
29898,
29872,
29974,
29899,
29945,
7240,
29945,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29889,
29906,
29947,
29896,
29955,
29896,
29947,
29896,
29955,
29896,
29953,
29892,
3037,
29883,
2141,
14513,
877,
6278,
29872,
29974,
29941,
7240,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29896,
29929,
29889,
29945,
29945,
29953,
29906,
29906,
29946,
29941,
29929,
29946,
29946,
29941,
29947,
29945,
29947,
29955,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29900,
17722,
29872,
29930,
29906,
4887,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29889,
29941,
29945,
29929,
29896,
29946,
29900,
29929,
29896,
29946,
29906,
29892,
3037,
29883,
2141,
14513,
877,
29872,
29914,
29906,
8785,
13,
13,
1678,
822,
1243,
29918,
2876,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1374,
29875,
11155,
4251,
13,
4706,
9995,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29889,
29953,
29896,
29947,
29900,
29941,
29941,
29929,
29947,
29947,
29953,
29929,
29929,
29929,
29929,
29929,
29955,
29892,
3037,
29883,
2141,
14513,
877,
29898,
2876,
7240,
29896,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29900,
29889,
29941,
29947,
29896,
29929,
29953,
29953,
29900,
29896,
29896,
29941,
29900,
29900,
29900,
29900,
29900,
29896,
29892,
3037,
29883,
2141,
14513,
877,
29898,
2876,
6817,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29896,
29889,
29953,
29896,
29947,
29900,
29941,
29941,
29929,
29947,
29947,
29953,
29929,
29929,
29929,
29929,
29929,
29955,
29892,
3037,
29883,
2141,
14513,
877,
29898,
2876,
29974,
29899,
29945,
7240,
29945,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29889,
29941,
29947,
29896,
29929,
29953,
29953,
29900,
29896,
29896,
29941,
29900,
29900,
29900,
29900,
29900,
29941,
29892,
3037,
29883,
2141,
14513,
877,
6278,
2876,
29974,
29941,
7240,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
6278,
29900,
29889,
29946,
29955,
29906,
29896,
29941,
29945,
29929,
29945,
29946,
29941,
29945,
29941,
29955,
29906,
29953,
29946,
29953,
29892,
3037,
29883,
2141,
14513,
877,
29896,
29900,
17722,
2876,
29930,
29906,
4887,
29906,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29889,
29947,
29900,
29929,
29900,
29896,
29953,
29929,
29929,
29946,
29941,
29945,
29892,
3037,
29883,
2141,
14513,
877,
2876,
29914,
29906,
8785,
13,
2
] |
transform.py | ShrillP/ImageScanner | 0 | 57770 | <filename>transform.py<gh_stars>0
import numpy as np
import cv2
def order_points(points):
rectangle = np.zeros((4, 2), dtype="float32")
s = points.sum(axis=1)
rectangle[0] = points[np.argmin(s)]
rectangle[2] = points[np.argmax(s)]
difference = np.diff(points, axis=1)
rectangle[1] = points[np.argmin(difference)]
rectangle[3] = points[np.argmax(difference)]
return rectangle
def four_point_transform(image, points):
rectangle = order_points(points)
(tl, tr, br, bl) = rectangle
width_A = np.sqrt(((br[0] - bl[0]) ** 2) + ((br[1] - bl[1]) ** 2))
width_B = np.sqrt(((tr[0] - tl[0]) ** 2) + ((tr[1] - tl[1]) ** 2))
max_width = max(int(width_A), int(width_B))
height_A = np.sqrt(((tr[0] - br[0]) ** 2) + ((tr[1] - br[1]) ** 2))
height_B = np.sqrt(((tl[0] - bl[0]) ** 2) + ((tl[1] - bl[1]) ** 2))
max_height = max(int(height_A), int(height_B))
destination = np.array([
[0, 0],
[max_width - 1, 0],
[max_width - 1, max_height - 1],
[0, max_height - 1]], dtype="float32")
transform = cv2.getPerspectiveTransform(rectangle, destination)
warped = cv2.warpPerspective(image, transform, (max_width, max_height))
return warped
| [
1,
529,
9507,
29958,
9067,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
12655,
408,
7442,
13,
5215,
13850,
29906,
13,
13,
13,
1753,
1797,
29918,
9748,
29898,
9748,
1125,
13,
1678,
16701,
353,
7442,
29889,
3298,
359,
3552,
29946,
29892,
29871,
29906,
511,
26688,
543,
7411,
29941,
29906,
1159,
13,
13,
1678,
269,
353,
3291,
29889,
2083,
29898,
8990,
29922,
29896,
29897,
13,
1678,
16701,
29961,
29900,
29962,
353,
3291,
29961,
9302,
29889,
1191,
1195,
29898,
29879,
4638,
13,
1678,
16701,
29961,
29906,
29962,
353,
3291,
29961,
9302,
29889,
1191,
3317,
29898,
29879,
4638,
13,
13,
1678,
4328,
353,
7442,
29889,
12765,
29898,
9748,
29892,
9685,
29922,
29896,
29897,
13,
1678,
16701,
29961,
29896,
29962,
353,
3291,
29961,
9302,
29889,
1191,
1195,
29898,
29881,
17678,
4638,
13,
1678,
16701,
29961,
29941,
29962,
353,
3291,
29961,
9302,
29889,
1191,
3317,
29898,
29881,
17678,
4638,
13,
13,
1678,
736,
16701,
13,
13,
13,
1753,
3023,
29918,
3149,
29918,
9067,
29898,
3027,
29892,
3291,
1125,
13,
1678,
16701,
353,
1797,
29918,
9748,
29898,
9748,
29897,
13,
1678,
313,
15206,
29892,
534,
29892,
1506,
29892,
1999,
29897,
353,
16701,
13,
13,
1678,
2920,
29918,
29909,
353,
7442,
29889,
3676,
3552,
29898,
1182,
29961,
29900,
29962,
448,
1999,
29961,
29900,
2314,
3579,
29871,
29906,
29897,
718,
5135,
1182,
29961,
29896,
29962,
448,
1999,
29961,
29896,
2314,
3579,
29871,
29906,
876,
13,
1678,
2920,
29918,
29933,
353,
7442,
29889,
3676,
3552,
29898,
509,
29961,
29900,
29962,
448,
260,
29880,
29961,
29900,
2314,
3579,
29871,
29906,
29897,
718,
5135,
509,
29961,
29896,
29962,
448,
260,
29880,
29961,
29896,
2314,
3579,
29871,
29906,
876,
13,
1678,
4236,
29918,
2103,
353,
4236,
29898,
524,
29898,
2103,
29918,
29909,
511,
938,
29898,
2103,
29918,
29933,
876,
13,
13,
1678,
3171,
29918,
29909,
353,
7442,
29889,
3676,
3552,
29898,
509,
29961,
29900,
29962,
448,
1506,
29961,
29900,
2314,
3579,
29871,
29906,
29897,
718,
5135,
509,
29961,
29896,
29962,
448,
1506,
29961,
29896,
2314,
3579,
29871,
29906,
876,
13,
1678,
3171,
29918,
29933,
353,
7442,
29889,
3676,
3552,
29898,
15206,
29961,
29900,
29962,
448,
1999,
29961,
29900,
2314,
3579,
29871,
29906,
29897,
718,
5135,
15206,
29961,
29896,
29962,
448,
1999,
29961,
29896,
2314,
3579,
29871,
29906,
876,
13,
1678,
4236,
29918,
3545,
353,
4236,
29898,
524,
29898,
3545,
29918,
29909,
511,
938,
29898,
3545,
29918,
29933,
876,
13,
13,
1678,
12551,
353,
7442,
29889,
2378,
4197,
13,
4706,
518,
29900,
29892,
29871,
29900,
1402,
13,
4706,
518,
3317,
29918,
2103,
448,
29871,
29896,
29892,
29871,
29900,
1402,
13,
4706,
518,
3317,
29918,
2103,
448,
29871,
29896,
29892,
4236,
29918,
3545,
448,
29871,
29896,
1402,
13,
4706,
518,
29900,
29892,
4236,
29918,
3545,
448,
29871,
29896,
20526,
26688,
543,
7411,
29941,
29906,
1159,
13,
13,
1678,
4327,
353,
13850,
29906,
29889,
657,
15136,
12645,
13372,
29898,
1621,
2521,
29892,
12551,
29897,
13,
1678,
1370,
9795,
353,
13850,
29906,
29889,
4495,
29886,
15136,
12645,
29898,
3027,
29892,
4327,
29892,
313,
3317,
29918,
2103,
29892,
4236,
29918,
3545,
876,
13,
13,
1678,
736,
1370,
9795,
13,
13,
2
] |
hello_world_cpp/launch/server.launch.py | fjnkt98/hello_world | 0 | 48931 | import launch
import launch_ros
def generate_launch_description():
server_node_container = launch_ros.actions.ComposableNodeContainer(
node_name='server_node_container',
node_namespace='',
package='rclcpp_components',
node_executable='component_container',
composable_node_descriptions=[
launch_ros.descriptions.ComposableNode(
package='hello_world_cpp',
node_plugin='hello_world_cpp::Server',
node_name='server'
)
],
output='screen'
)
return launch.LaunchDescription([server_node_container])
| [
1,
1053,
6826,
13,
5215,
6826,
29918,
1883,
13,
13,
13,
1753,
5706,
29918,
15343,
29918,
8216,
7295,
13,
1678,
1923,
29918,
3177,
29918,
7611,
353,
6826,
29918,
1883,
29889,
7387,
29889,
1523,
1066,
519,
4247,
7895,
29898,
13,
9651,
2943,
29918,
978,
2433,
2974,
29918,
3177,
29918,
7611,
742,
13,
9651,
2943,
29918,
22377,
2433,
742,
13,
9651,
3577,
2433,
29878,
695,
8223,
29918,
14036,
742,
13,
9651,
2943,
29918,
4258,
9246,
2433,
9700,
29918,
7611,
742,
13,
9651,
5541,
519,
29918,
3177,
29918,
2783,
699,
1980,
11759,
13,
18884,
6826,
29918,
1883,
29889,
2783,
699,
1980,
29889,
1523,
1066,
519,
4247,
29898,
13,
462,
1678,
3577,
2433,
12199,
29918,
11526,
29918,
8223,
742,
13,
462,
1678,
2943,
29918,
8582,
2433,
12199,
29918,
11526,
29918,
8223,
1057,
6004,
742,
13,
462,
1678,
2943,
29918,
978,
2433,
2974,
29915,
13,
462,
1678,
1723,
13,
18884,
21251,
13,
9651,
1962,
2433,
10525,
29915,
13,
9651,
1723,
13,
1678,
736,
6826,
29889,
17641,
9868,
4197,
2974,
29918,
3177,
29918,
7611,
2314,
13,
2
] |
Vigenere/decoder.py | zF4ke/Ciphr | 0 | 194004 | from operator import sub
word = str(input("Type the word to be decrypted: ")).strip().lower().replace(" ", "")
key = str(input("Type the vigenere key: ")).strip().lower().replace(" ", "")
nkey = 0
res, w, letters, srettel = "", "", " abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ", " zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba "
if len(word) > len(key):
nkey = len(word) - len(key)
if nkey < len(key):
w = key[:nkey]
res = key + w
elif nkey > len(key):
if len(key) == 1:
res = key * (nkey + 1)
elif len(key) == 2:
res = key * nkey
else:
w = key + key[:nkey]
res = key + w
else:
res += key + key
elif len(word) < len(key):
nkey = len(key) - len(word)
w = key[:-nkey]
res += w
else:
res += key
s, l, fin, enc = [], [], [], []
for i in word:
s.append(letters.find(i))
for j in res:
l.append(letters.find(j))
for n in range(0, len(s)):
s[n] = s[n] + 1
fin = list(map(sub, s, l))
for x in fin:
if x < 0:
x = abs(x) + 1
enc.append(srettel[x])
else:
enc.append(letters[x])
print("".join(enc))
| [
1,
515,
5455,
1053,
1014,
13,
13,
1742,
353,
851,
29898,
2080,
703,
1542,
278,
1734,
304,
367,
1602,
14740,
29901,
376,
8106,
17010,
2141,
13609,
2141,
6506,
703,
9162,
20569,
13,
1989,
353,
851,
29898,
2080,
703,
1542,
278,
325,
2101,
406,
1820,
29901,
376,
8106,
17010,
2141,
13609,
2141,
6506,
703,
9162,
20569,
13,
29876,
1989,
353,
29871,
29900,
13,
690,
29892,
281,
29892,
8721,
29892,
269,
13158,
295,
353,
12633,
12633,
376,
25638,
1753,
12443,
823,
6321,
23521,
459,
29939,
29878,
303,
4090,
29893,
20230,
10736,
1753,
12443,
823,
6321,
23521,
459,
29939,
29878,
303,
4090,
29893,
20230,
9162,
376,
503,
29891,
29916,
29893,
29894,
8842,
29878,
29939,
1112,
828,
29895,
27272,
29887,
29888,
287,
10702,
24683,
29916,
29893,
29894,
8842,
29878,
29939,
1112,
828,
29895,
27272,
29887,
29888,
287,
29883,
2291,
376,
13,
13,
361,
7431,
29898,
1742,
29897,
1405,
7431,
29898,
1989,
1125,
13,
1678,
302,
1989,
353,
7431,
29898,
1742,
29897,
448,
7431,
29898,
1989,
29897,
13,
1678,
565,
302,
1989,
529,
7431,
29898,
1989,
1125,
13,
4706,
281,
353,
1820,
7503,
29876,
1989,
29962,
13,
4706,
620,
353,
1820,
718,
281,
13,
1678,
25342,
302,
1989,
1405,
7431,
29898,
1989,
1125,
13,
4706,
565,
7431,
29898,
1989,
29897,
1275,
29871,
29896,
29901,
13,
9651,
620,
353,
1820,
334,
313,
29876,
1989,
718,
29871,
29896,
29897,
13,
4706,
25342,
7431,
29898,
1989,
29897,
1275,
29871,
29906,
29901,
13,
9651,
620,
353,
1820,
334,
302,
1989,
13,
4706,
1683,
29901,
13,
9651,
281,
353,
1820,
718,
1820,
7503,
29876,
1989,
29962,
13,
9651,
620,
353,
1820,
718,
281,
13,
1678,
1683,
29901,
13,
4706,
620,
4619,
1820,
718,
1820,
13,
13,
23681,
7431,
29898,
1742,
29897,
529,
7431,
29898,
1989,
1125,
13,
1678,
302,
1989,
353,
7431,
29898,
1989,
29897,
448,
7431,
29898,
1742,
29897,
13,
1678,
281,
353,
1820,
7503,
29899,
29876,
1989,
29962,
13,
1678,
620,
4619,
281,
13,
13,
2870,
29901,
13,
1678,
620,
4619,
1820,
13,
13,
29879,
29892,
301,
29892,
1436,
29892,
2094,
353,
19997,
19997,
19997,
5159,
13,
13,
1454,
474,
297,
1734,
29901,
13,
1678,
269,
29889,
4397,
29898,
1026,
2153,
29889,
2886,
29898,
29875,
876,
13,
13,
1454,
432,
297,
620,
29901,
13,
1678,
301,
29889,
4397,
29898,
1026,
2153,
29889,
2886,
29898,
29926,
876,
13,
13,
1454,
302,
297,
3464,
29898,
29900,
29892,
7431,
29898,
29879,
22164,
13,
1678,
269,
29961,
29876,
29962,
353,
269,
29961,
29876,
29962,
718,
29871,
29896,
13,
13,
4951,
353,
1051,
29898,
1958,
29898,
1491,
29892,
269,
29892,
301,
876,
13,
13,
1454,
921,
297,
1436,
29901,
13,
1678,
565,
921,
529,
29871,
29900,
29901,
13,
4706,
921,
353,
6425,
29898,
29916,
29897,
718,
29871,
29896,
13,
4706,
2094,
29889,
4397,
29898,
29879,
13158,
295,
29961,
29916,
2314,
13,
1678,
1683,
29901,
13,
4706,
2094,
29889,
4397,
29898,
1026,
2153,
29961,
29916,
2314,
13,
13,
2158,
703,
1642,
7122,
29898,
3977,
876,
13,
2
] |
Python/PythonIntro/Exercises.py | IQSS/workshops | 30 | 102942 | # ---
# jupyter:
# jupytext:
# formats: ipynb,md,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # Introduction to Python exercise solutions
# ## Exercise: Reading text from a file and splitting
# *Alice's Adventures in Wonderland* is full of memorable characters. The main characters from the story are listed, one-per-line, in the file named `Characters.txt`.
#
# NOTE: we will not always explicitly demonstrate everything you need to know in order to complete an exercise. Instead we focus on teaching you how to discover available methods and how use the help function to learn how to use them. It is expected that you will spend some time during the exercises looking for appropriate methods and perhaps reading documentation.
# 1. Open the `Characters.txt` file and read its contents.
# 2. Split text on newlines to produce a list with one element per line.
# Store the result as "alice_characters".
# ## Exercise: count the number of main characters
# So far we've learned that there are 12 chapters, around 830 paragraphs, and about 26 thousand words in *Alice's Adventures in Wonderland*. Along the way we've also learned how to open a file and read its contents, split strings, calculate the length of objects, discover methods for string and list objects, and index/subset lists in Python. Now it is time for you to put these skills to use to learn something about the main characters in the story.
# 1. Count the number of main characters in the story (i.e., get the length
# of the list you created in previous exercise).
# 2. Extract and print just the first character from the list you created in
# the previous exercise.
# 3. (BONUS, optional): Sort the list you created in step 2 alphabetically, and then extract the last element.
# ## Exercise: Iterating and counting things
# Now that we know how to iterate using for-loops and list comprehensions the possibilities really start to open up. For example, we can use these techniques to count the number of times each character appears in the story.
# +
# 1. Make sure you have both the text and the list of characters.
#
# Open and read both "Alice_in_wonderland.txt" and
# "Characters.txt" if you have not already done so.
# +
# 2. Which chapter has the most words?
#
# Split the text into chaptes (i.e., split on "CHAPTER ")
# and use a for-loop or list comprehension to iterate over
# the chapters. For each chapter, split it into words and
# calculate the length.
# +
# 3. How many times is each character mentioned in the text?
# Iterate over the list of characters using a for-loop or
# list comprehension. For each character, call the count method
# with that character as the argument.
# +
# 4. (BONUS, optional): Put the character counts computed
# above in a dictionary with character names as the keys and
# counts as the values.
# +
# 5. (BONUS, optional): Use a nested for-loop or nested comprehension
# to calculate the number of times each character is mentioned
# in each chapter.
| [
1,
396,
11474,
13,
29937,
432,
786,
25547,
29901,
13,
29937,
259,
432,
786,
29891,
726,
29901,
13,
29937,
268,
21971,
29901,
10377,
948,
29890,
29892,
3487,
29892,
2272,
29901,
4366,
13,
29937,
268,
1426,
29918,
276,
26081,
29901,
13,
29937,
539,
6081,
29901,
869,
2272,
13,
29937,
539,
3402,
29918,
978,
29901,
3578,
13,
29937,
539,
3402,
29918,
3259,
29901,
525,
29896,
29889,
29941,
29915,
13,
29937,
539,
432,
786,
29891,
726,
29918,
3259,
29901,
29871,
29900,
29889,
29947,
29889,
29953,
13,
29937,
259,
413,
824,
1379,
3135,
29901,
13,
29937,
268,
2479,
29918,
978,
29901,
5132,
29871,
29941,
13,
29937,
268,
4086,
29901,
3017,
13,
29937,
268,
1024,
29901,
3017,
29941,
13,
29937,
11474,
13,
13,
29937,
396,
27576,
304,
5132,
15058,
6851,
13,
13,
29937,
444,
1222,
6269,
895,
29901,
21439,
1426,
515,
263,
934,
322,
24368,
13,
29937,
334,
29909,
5897,
29915,
29879,
21255,
1973,
297,
28004,
1049,
29930,
338,
2989,
310,
26959,
519,
4890,
29889,
450,
1667,
4890,
515,
278,
5828,
526,
9904,
29892,
697,
29899,
546,
29899,
1220,
29892,
297,
278,
934,
4257,
421,
5914,
21706,
29889,
3945,
1412,
13,
29937,
13,
29937,
6058,
29923,
29901,
591,
674,
451,
2337,
9479,
22222,
4129,
366,
817,
304,
1073,
297,
1797,
304,
4866,
385,
15058,
29889,
8669,
591,
8569,
373,
18819,
366,
920,
304,
6523,
3625,
3519,
322,
920,
671,
278,
1371,
740,
304,
5110,
920,
304,
671,
963,
29889,
739,
338,
3806,
393,
366,
674,
18864,
777,
931,
2645,
278,
24472,
3476,
267,
3063,
363,
8210,
3519,
322,
6060,
5183,
5106,
29889,
13,
13,
29937,
29871,
29896,
29889,
4673,
278,
421,
5914,
21706,
29889,
3945,
29952,
934,
322,
1303,
967,
8118,
29889,
13,
13,
13,
29937,
29871,
29906,
29889,
26178,
1426,
373,
716,
9012,
304,
7738,
263,
1051,
411,
697,
1543,
639,
1196,
29889,
13,
29937,
1678,
14491,
278,
1121,
408,
376,
284,
625,
29918,
3090,
21706,
1642,
13,
13,
13,
13,
29937,
444,
1222,
6269,
895,
29901,
2302,
278,
1353,
310,
1667,
4890,
13,
29937,
1105,
2215,
591,
29915,
345,
10972,
393,
727,
526,
29871,
29896,
29906,
10708,
2153,
29892,
2820,
29871,
29947,
29941,
29900,
14880,
29879,
29892,
322,
1048,
29871,
29906,
29953,
10405,
3838,
297,
334,
29909,
5897,
29915,
29879,
21255,
1973,
297,
28004,
1049,
10521,
838,
549,
278,
982,
591,
29915,
345,
884,
10972,
920,
304,
1722,
263,
934,
322,
1303,
967,
8118,
29892,
6219,
6031,
29892,
29871,
8147,
278,
3309,
310,
3618,
29892,
6523,
3519,
363,
1347,
322,
1051,
3618,
29892,
322,
2380,
29914,
6484,
8857,
297,
5132,
29889,
2567,
372,
338,
931,
363,
366,
304,
1925,
1438,
25078,
304,
671,
304,
5110,
1554,
1048,
278,
1667,
4890,
297,
278,
5828,
29889,
13,
13,
29937,
29871,
29896,
29889,
3917,
278,
1353,
310,
1667,
4890,
297,
278,
5828,
313,
29875,
29889,
29872,
1696,
679,
278,
3309,
13,
29937,
1678,
310,
278,
1051,
366,
2825,
297,
3517,
15058,
467,
13,
13,
13,
29937,
29871,
29906,
29889,
7338,
1461,
322,
1596,
925,
278,
937,
2931,
515,
278,
1051,
366,
2825,
297,
13,
29937,
1678,
278,
3517,
15058,
29889,
13,
13,
13,
29937,
29871,
29941,
29889,
313,
29933,
1164,
3308,
29892,
13136,
1125,
20025,
278,
1051,
366,
2825,
297,
4331,
29871,
29906,
22968,
1711,
29892,
322,
769,
6597,
278,
1833,
1543,
29889,
13,
13,
13,
13,
29937,
444,
1222,
6269,
895,
29901,
20504,
1218,
322,
21248,
2712,
13,
29937,
2567,
393,
591,
1073,
920,
304,
13649,
773,
363,
29899,
417,
3554,
322,
1051,
15171,
5580,
278,
24496,
2289,
1369,
304,
1722,
701,
29889,
1152,
1342,
29892,
591,
508,
671,
1438,
13698,
304,
2302,
278,
1353,
310,
3064,
1269,
2931,
5692,
297,
278,
5828,
29889,
13,
13,
29937,
718,
13,
29937,
29871,
29896,
29889,
8561,
1854,
366,
505,
1716,
278,
1426,
322,
278,
1051,
310,
4890,
29889,
13,
29937,
13,
29937,
4673,
322,
1303,
1716,
376,
29909,
5897,
29918,
262,
29918,
29893,
8417,
1049,
29889,
3945,
29908,
322,
13,
29937,
376,
5914,
21706,
29889,
3945,
29908,
565,
366,
505,
451,
2307,
2309,
577,
29889,
13,
13,
13,
13,
29937,
718,
13,
29937,
29871,
29906,
29889,
8449,
16385,
756,
278,
1556,
3838,
29973,
13,
29937,
13,
29937,
26178,
278,
1426,
964,
521,
2156,
267,
313,
29875,
29889,
29872,
1696,
6219,
373,
376,
3210,
3301,
4945,
16521,
13,
29937,
322,
671,
263,
363,
29899,
7888,
470,
1051,
15171,
2673,
304,
13649,
975,
13,
29937,
278,
10708,
2153,
29889,
1152,
1269,
16385,
29892,
6219,
372,
964,
3838,
322,
29871,
13,
29937,
8147,
278,
3309,
29889,
13,
13,
13,
13,
29937,
718,
13,
29937,
29871,
29941,
29889,
1128,
1784,
3064,
338,
1269,
2931,
5276,
297,
278,
1426,
29973,
13,
13,
29937,
20504,
403,
975,
278,
1051,
310,
4890,
773,
263,
363,
29899,
7888,
470,
29871,
13,
29937,
1051,
15171,
2673,
29889,
1152,
1269,
2931,
29892,
1246,
278,
2302,
1158,
13,
29937,
411,
393,
2931,
408,
278,
2980,
29889,
13,
13,
13,
13,
29937,
718,
13,
29937,
29871,
29946,
29889,
313,
29933,
1164,
3308,
29892,
13136,
1125,
12065,
278,
2931,
18139,
15712,
29871,
13,
29937,
1678,
2038,
297,
263,
8600,
411,
2931,
2983,
408,
278,
6611,
322,
29871,
13,
29937,
1678,
18139,
408,
278,
1819,
29889,
13,
13,
13,
13,
29937,
718,
13,
29937,
29871,
29945,
29889,
313,
29933,
1164,
3308,
29892,
13136,
1125,
4803,
263,
9322,
363,
29899,
7888,
470,
9322,
15171,
2673,
29871,
13,
29937,
1678,
304,
8147,
278,
1353,
310,
3064,
1269,
2931,
338,
5276,
29871,
13,
29937,
1678,
297,
1269,
16385,
29889,
13,
13,
13,
2
] |
examples/fire.py | pombreda/py-lepton | 7 | 13028 | <filename>examples/fire.py
#############################################################################
#
# Copyright (c) 2008 by <NAME> and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
#
#############################################################################
"""Fire simulation using point sprites"""
__version__ = '$Id$'
import os
from pyglet import image
from pyglet.gl import *
from lepton import Particle, ParticleGroup, default_system
from lepton.renderer import PointRenderer
from lepton.texturizer import SpriteTexturizer, create_point_texture
from lepton.emitter import StaticEmitter
from lepton.domain import Line
from lepton.controller import Gravity, Lifetime, Movement, Fader, ColorBlender
win = pyglet.window.Window(resizable=True, visible=False)
win.clear()
glEnable(GL_BLEND)
glShadeModel(GL_SMOOTH)
glBlendFunc(GL_SRC_ALPHA,GL_ONE)
glDisable(GL_DEPTH_TEST)
flame = StaticEmitter(
rate=500,
template=Particle(
position=(300,25,0),
velocity=(0,0,0),
color=(1,1,1,1),
),
position=Line((win.width/2 - 85, -15, 0), (win.width/2 + 85, -15, 0)),
deviation=Particle(position=(10,0,0), velocity=(7,50,0), age=0.75)
)
default_system.add_global_controller(
Lifetime(6),
Gravity((0,20,0)),
Movement(),
ColorBlender(
[(0, (0,0,0.5,0)),
(0.5, (0,0,0.5,0.2)),
(0.75, (0,0.5,1,0.6)),
(1.5, (1,1,0,0.2)),
(2.7, (0.9,0.2,0,0.4)),
(3.2, (0.6,0.1,0.05,0.2)),
(4.0, (0.8,0.8,0.8,0.1)),
(6.0, (0.8,0.8,0.8,0)), ]
),
)
group = ParticleGroup(controllers=[flame],
renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 5))))
win.set_visible(True)
pyglet.clock.schedule_interval(default_system.update, (1.0/30.0))
pyglet.clock.set_fps_limit(None)
@win.event
def on_draw():
win.clear()
glLoadIdentity()
default_system.draw()
if __name__ == '__main__':
default_system.run_ahead(2, 30)
pyglet.app.run()
| [
1,
529,
9507,
29958,
19057,
29914,
8696,
29889,
2272,
13,
13383,
13383,
13383,
13383,
7346,
4136,
29937,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29900,
29947,
491,
529,
5813,
29958,
322,
17737,
29560,
13,
29937,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
910,
7047,
338,
4967,
304,
278,
1326,
12112,
310,
278,
341,
1806,
19245,
13,
29937,
319,
3509,
310,
278,
19405,
881,
10259,
1384,
445,
4978,
29889,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
13,
29937,
13,
13383,
13383,
13383,
13383,
7346,
4136,
29937,
13,
15945,
29908,
18654,
17402,
773,
1298,
7689,
3246,
15945,
29908,
13,
13,
1649,
3259,
1649,
353,
14180,
1204,
29938,
29915,
13,
13,
5215,
2897,
13,
3166,
19484,
1026,
1053,
1967,
13,
3166,
19484,
1026,
29889,
3820,
1053,
334,
13,
13,
3166,
454,
12533,
1053,
3455,
2512,
29892,
3455,
2512,
4782,
29892,
2322,
29918,
5205,
13,
3166,
454,
12533,
29889,
9482,
261,
1053,
8984,
21323,
13,
3166,
454,
12533,
29889,
726,
332,
3950,
1053,
14314,
568,
1626,
332,
3950,
29892,
1653,
29918,
3149,
29918,
726,
545,
13,
3166,
454,
12533,
29889,
331,
5171,
1053,
624,
2454,
29923,
2415,
357,
13,
3166,
454,
12533,
29889,
7247,
1053,
7407,
13,
3166,
454,
12533,
29889,
8299,
1053,
4989,
17037,
29892,
365,
361,
5410,
29892,
14104,
882,
29892,
383,
1664,
29892,
9159,
10358,
1581,
13,
13,
5080,
353,
19484,
1026,
29889,
7165,
29889,
5907,
29898,
690,
13902,
29922,
5574,
29892,
7962,
29922,
8824,
29897,
13,
5080,
29889,
8551,
580,
13,
13,
3820,
20701,
29898,
7239,
29918,
29933,
1307,
2797,
29897,
13,
3820,
2713,
1943,
3195,
29898,
7239,
29918,
29903,
6720,
2891,
29950,
29897,
13,
3820,
10358,
355,
14400,
29898,
7239,
29918,
29903,
10363,
29918,
1964,
29925,
15715,
29892,
7239,
29918,
12413,
29897,
13,
3820,
4205,
519,
29898,
7239,
29918,
2287,
29925,
4690,
29918,
18267,
29897,
13,
13,
1579,
420,
353,
624,
2454,
29923,
2415,
357,
29898,
13,
12,
10492,
29922,
29945,
29900,
29900,
29892,
13,
12,
6886,
29922,
7439,
2512,
29898,
13,
12,
12,
3283,
7607,
29941,
29900,
29900,
29892,
29906,
29945,
29892,
29900,
511,
29871,
13,
12,
12,
955,
25245,
7607,
29900,
29892,
29900,
29892,
29900,
511,
29871,
13,
12,
12,
2780,
7607,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
511,
13,
12,
511,
13,
12,
3283,
29922,
3542,
3552,
5080,
29889,
2103,
29914,
29906,
448,
29871,
29947,
29945,
29892,
448,
29896,
29945,
29892,
29871,
29900,
511,
313,
5080,
29889,
2103,
29914,
29906,
718,
29871,
29947,
29945,
29892,
448,
29896,
29945,
29892,
29871,
29900,
8243,
13,
12,
311,
14641,
29922,
7439,
2512,
29898,
3283,
7607,
29896,
29900,
29892,
29900,
29892,
29900,
511,
12885,
7607,
29955,
29892,
29945,
29900,
29892,
29900,
511,
5046,
29922,
29900,
29889,
29955,
29945,
29897,
13,
29897,
13,
13,
4381,
29918,
5205,
29889,
1202,
29918,
10945,
29918,
8299,
29898,
13,
12,
29931,
361,
5410,
29898,
29953,
511,
13,
12,
29954,
5705,
537,
3552,
29900,
29892,
29906,
29900,
29892,
29900,
8243,
29871,
13,
12,
29924,
586,
882,
3285,
29871,
13,
12,
3306,
10358,
1581,
29898,
13,
12,
12,
15625,
29900,
29892,
313,
29900,
29892,
29900,
29892,
29900,
29889,
29945,
29892,
29900,
8243,
29871,
13,
12,
12,
29898,
29900,
29889,
29945,
29892,
313,
29900,
29892,
29900,
29892,
29900,
29889,
29945,
29892,
29900,
29889,
29906,
8243,
29871,
13,
12,
12,
29898,
29900,
29889,
29955,
29945,
29892,
313,
29900,
29892,
29900,
29889,
29945,
29892,
29896,
29892,
29900,
29889,
29953,
8243,
29871,
13,
12,
12,
29898,
29896,
29889,
29945,
29892,
313,
29896,
29892,
29896,
29892,
29900,
29892,
29900,
29889,
29906,
8243,
29871,
13,
12,
12,
29898,
29906,
29889,
29955,
29892,
313,
29900,
29889,
29929,
29892,
29900,
29889,
29906,
29892,
29900,
29892,
29900,
29889,
29946,
8243,
29871,
13,
12,
12,
29898,
29941,
29889,
29906,
29892,
313,
29900,
29889,
29953,
29892,
29900,
29889,
29896,
29892,
29900,
29889,
29900,
29945,
29892,
29900,
29889,
29906,
8243,
29871,
13,
12,
12,
29898,
29946,
29889,
29900,
29892,
313,
29900,
29889,
29947,
29892,
29900,
29889,
29947,
29892,
29900,
29889,
29947,
29892,
29900,
29889,
29896,
8243,
13,
12,
12,
29898,
29953,
29889,
29900,
29892,
313,
29900,
29889,
29947,
29892,
29900,
29889,
29947,
29892,
29900,
29889,
29947,
29892,
29900,
8243,
4514,
13,
12,
511,
13,
29897,
13,
13,
2972,
353,
3455,
2512,
4782,
29898,
1285,
11897,
11759,
1579,
420,
1402,
29871,
13,
12,
9482,
261,
29922,
5228,
21323,
29898,
29953,
29946,
29892,
14314,
568,
1626,
332,
3950,
29898,
3258,
29918,
3149,
29918,
726,
545,
29898,
29953,
29946,
29892,
29871,
29945,
13697,
13,
13,
5080,
29889,
842,
29918,
12872,
29898,
5574,
29897,
13,
2272,
29887,
1026,
29889,
13058,
29889,
816,
11272,
29918,
19207,
29898,
4381,
29918,
5205,
29889,
5504,
29892,
313,
29896,
29889,
29900,
29914,
29941,
29900,
29889,
29900,
876,
13,
2272,
29887,
1026,
29889,
13058,
29889,
842,
29918,
29888,
567,
29918,
13400,
29898,
8516,
29897,
13,
13,
29992,
5080,
29889,
3696,
13,
1753,
373,
29918,
4012,
7295,
13,
12,
5080,
29889,
8551,
580,
13,
12,
3820,
5896,
18415,
580,
13,
12,
4381,
29918,
5205,
29889,
4012,
580,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
12,
4381,
29918,
5205,
29889,
3389,
29918,
29874,
2813,
29898,
29906,
29892,
29871,
29941,
29900,
29897,
13,
12,
2272,
29887,
1026,
29889,
932,
29889,
3389,
580,
13,
2
] |
server/ahj_app/tests/test_misc_views.py | btansy/ahj-registry | 0 | 90490 | <filename>server/ahj_app/tests/test_misc_views.py
from django.urls import reverse
from django.conf import settings
from ahj_app.models import User, Edit, Comment
from fixtures import *
import pytest
import datetime
@pytest.mark.django_db
def test_form_validator__username_exists(generate_client_with_webpage_credentials):
client = generate_client_with_webpage_credentials(Username='someone')
url = reverse('form-validator')
response = client.get(url, {'Username':'someone'})
assert response.data['UsernameExists']
assert response.status_code == 200
@pytest.mark.django_db
def test_form_validator__email_exists(generate_client_with_webpage_credentials):
client = generate_client_with_webpage_credentials(Email='<EMAIL>')
url = reverse('form-validator')
response = client.get(url, {'Email':'a<EMAIL>'})
assert response.data['EmailExists']
assert response.status_code == 200
@pytest.mark.django_db
def test_form_validator__no_params(client_with_webpage_credentials):
url = reverse('form-validator')
response = client_with_webpage_credentials.get(url, {})
assert not response.data['UsernameExists'] and not response.data['EmailExists']
assert response.status_code == 200
@pytest.mark.django_db
def test_user_comments__comments_exist(ahj_obj, generate_client_with_webpage_credentials):
client = generate_client_with_webpage_credentials(Username='someone')
user = User.objects.get(Username='someone')
comment1 = Comment.objects.create(UserID=user, AHJPK=ahj_obj.AHJPK, CommentText='This is one comment.', ReplyingTo=None)
comment2 = Comment.objects.create(UserID=user, AHJPK=ahj_obj.AHJPK, CommentText='This is another.', ReplyingTo=comment1.CommentID)
url = reverse('user-comments')
response = client.get(url, {'UserID': user.UserID})
assert len(response.data) == 2 # 2 comments returned
assert response.status_code == 200
@pytest.mark.django_db
def test_user_comments__user_does_not_exist(client_with_webpage_credentials):
url = reverse('user-comments')
response = client_with_webpage_credentials.get(url, {'UserID': 99999999})
assert len(response.data) == 0 # no comments returned
assert response.status_code == 200
@pytest.mark.django_db
def test_comment_submit__normal_submission(ahj_obj, client_with_webpage_credentials):
url = reverse('comment-submit')
response = client_with_webpage_credentials.post(url, {'CommentText': 'This is a comment.', 'AHJPK':ahj_obj.AHJPK})
assert response.data['CommentText']['Value'] == 'This is a comment.' # check if comment object returned matches
assert response.status_code == 200
@pytest.mark.django_db
def test_comment_submit__no_comment(ahj_obj, client_with_webpage_credentials):
url = reverse('comment-submit')
response = client_with_webpage_credentials.post(url, {'AHJPK':ahj_obj.AHJPK})
assert response.status_code == 400
@pytest.mark.django_db
def test_user_edits__edits_exist(ahj_obj, generate_client_with_webpage_credentials):
client = generate_client_with_webpage_credentials(Username='someone')
user = User.objects.get(Username='someone')
edit1 = Edit.objects.create(ChangedBy= user, AHJPK=ahj_obj, SourceTable='Contact', SourceColumn='Title', SourceRow='143', DateRequested=datetime.datetime.now())
edit2 = Edit.objects.create(ChangedBy= user, AHJPK=ahj_obj, SourceTable='Contact', SourceColumn='Title', SourceRow='143', DateRequested=datetime.datetime.now())
url = reverse('user-edits')
response = client.get(url, {'UserID': user.UserID})
assert len(response.data) == 2 # 2 edits returned
assert response.status_code == 200
@pytest.mark.django_db
def test_user_edits__user_does_not_exist(client_with_webpage_credentials):
url = reverse('user-edits')
response = client_with_webpage_credentials.get(url, {'UserID': 99999999})
assert len(response.data) == 0 # no edits returned
assert response.status_code == 200
@pytest.mark.django_db
def test_send_support_email__valid_usage(client_with_webpage_credentials):
url = reverse('send-support-email')
settings.SUNSPEC_SUPPORT_EMAIL = '<EMAIL>'
response = client_with_webpage_credentials.post(url, {'Email': '<EMAIL>', 'Subject': 'A subject.', 'Message': 'A message.'})
assert response.status_code == 200 | [
1,
529,
9507,
29958,
2974,
29914,
801,
29926,
29918,
932,
29914,
21150,
29914,
1688,
29918,
29885,
10669,
29918,
7406,
29889,
2272,
13,
3166,
9557,
29889,
26045,
1053,
11837,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
21023,
29926,
29918,
932,
29889,
9794,
1053,
4911,
29892,
7641,
29892,
461,
13,
3166,
5713,
486,
1973,
1053,
334,
13,
5215,
11451,
1688,
13,
5215,
12865,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
689,
29918,
3084,
1061,
1649,
6786,
29918,
9933,
29898,
17158,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3132,
353,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29898,
20249,
2433,
5372,
650,
1495,
13,
1678,
3142,
353,
11837,
877,
689,
29899,
3084,
1061,
1495,
13,
1678,
2933,
353,
3132,
29889,
657,
29898,
2271,
29892,
11117,
20249,
22099,
5372,
650,
29915,
1800,
13,
1678,
4974,
2933,
29889,
1272,
1839,
20249,
24217,
2033,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
689,
29918,
3084,
1061,
1649,
5269,
29918,
9933,
29898,
17158,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3132,
353,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29898,
9823,
2433,
29966,
26862,
6227,
29958,
1495,
13,
1678,
3142,
353,
11837,
877,
689,
29899,
3084,
1061,
1495,
13,
1678,
2933,
353,
3132,
29889,
657,
29898,
2271,
29892,
11117,
9823,
22099,
29874,
29966,
26862,
6227,
16299,
1800,
13,
1678,
4974,
2933,
29889,
1272,
1839,
9823,
24217,
2033,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
689,
29918,
3084,
1061,
1649,
1217,
29918,
7529,
29898,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
689,
29899,
3084,
1061,
1495,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
657,
29898,
2271,
29892,
426,
1800,
13,
1678,
4974,
451,
2933,
29889,
1272,
1839,
20249,
24217,
2033,
322,
451,
2933,
29889,
1272,
1839,
9823,
24217,
2033,
29871,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
1792,
29918,
21032,
1649,
21032,
29918,
28997,
29898,
801,
29926,
29918,
5415,
29892,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3132,
353,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29898,
20249,
2433,
5372,
650,
1495,
13,
1678,
1404,
353,
4911,
29889,
12650,
29889,
657,
29898,
20249,
2433,
5372,
650,
1495,
13,
1678,
3440,
29896,
353,
461,
29889,
12650,
29889,
3258,
29898,
2659,
1367,
29922,
1792,
29892,
319,
29950,
29967,
21738,
29922,
801,
29926,
29918,
5415,
29889,
29909,
29950,
29967,
21738,
29892,
461,
1626,
2433,
4013,
338,
697,
3440,
29889,
742,
10088,
5890,
1762,
29922,
8516,
29897,
13,
1678,
3440,
29906,
353,
461,
29889,
12650,
29889,
3258,
29898,
2659,
1367,
29922,
1792,
29892,
319,
29950,
29967,
21738,
29922,
801,
29926,
29918,
5415,
29889,
29909,
29950,
29967,
21738,
29892,
461,
1626,
2433,
4013,
338,
1790,
29889,
742,
10088,
5890,
1762,
29922,
9342,
29896,
29889,
20001,
1367,
29897,
13,
1678,
3142,
353,
11837,
877,
1792,
29899,
21032,
1495,
13,
1678,
2933,
353,
3132,
29889,
657,
29898,
2271,
29892,
11117,
2659,
1367,
2396,
1404,
29889,
2659,
1367,
1800,
13,
1678,
4974,
7431,
29898,
5327,
29889,
1272,
29897,
1275,
29871,
29906,
396,
29871,
29906,
6589,
4133,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
1792,
29918,
21032,
1649,
1792,
29918,
13221,
29918,
1333,
29918,
28997,
29898,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
1792,
29899,
21032,
1495,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
657,
29898,
2271,
29892,
11117,
2659,
1367,
2396,
29871,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
1800,
13,
1678,
4974,
7431,
29898,
5327,
29889,
1272,
29897,
1275,
29871,
29900,
396,
694,
6589,
4133,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
9342,
29918,
7892,
1649,
8945,
29918,
1491,
6737,
29898,
801,
29926,
29918,
5415,
29892,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
9342,
29899,
7892,
1495,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
2490,
29898,
2271,
29892,
11117,
20001,
1626,
2396,
525,
4013,
338,
263,
3440,
29889,
742,
525,
29909,
29950,
29967,
21738,
2396,
801,
29926,
29918,
5415,
29889,
29909,
29950,
29967,
21738,
1800,
13,
1678,
4974,
2933,
29889,
1272,
1839,
20001,
1626,
16215,
1917,
2033,
1275,
525,
4013,
338,
263,
3440,
6169,
396,
1423,
565,
3440,
1203,
4133,
7087,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
268,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
9342,
29918,
7892,
1649,
1217,
29918,
9342,
29898,
801,
29926,
29918,
5415,
29892,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
9342,
29899,
7892,
1495,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
2490,
29898,
2271,
29892,
11117,
29909,
29950,
29967,
21738,
2396,
801,
29926,
29918,
5415,
29889,
29909,
29950,
29967,
21738,
1800,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
1792,
29918,
287,
1169,
1649,
287,
1169,
29918,
28997,
29898,
801,
29926,
29918,
5415,
29892,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3132,
353,
5706,
29918,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29898,
20249,
2433,
5372,
650,
1495,
13,
1678,
1404,
353,
4911,
29889,
12650,
29889,
657,
29898,
20249,
2433,
5372,
650,
1495,
13,
1678,
3863,
29896,
353,
7641,
29889,
12650,
29889,
3258,
29898,
7590,
2059,
29922,
1404,
29892,
319,
29950,
29967,
21738,
29922,
801,
29926,
29918,
5415,
29892,
7562,
3562,
2433,
13443,
742,
7562,
4409,
2433,
7030,
742,
7562,
4301,
2433,
29896,
29946,
29941,
742,
4712,
3089,
287,
29922,
12673,
29889,
12673,
29889,
3707,
3101,
13,
1678,
3863,
29906,
353,
7641,
29889,
12650,
29889,
3258,
29898,
7590,
2059,
29922,
1404,
29892,
319,
29950,
29967,
21738,
29922,
801,
29926,
29918,
5415,
29892,
7562,
3562,
2433,
13443,
742,
7562,
4409,
2433,
7030,
742,
7562,
4301,
2433,
29896,
29946,
29941,
742,
4712,
3089,
287,
29922,
12673,
29889,
12673,
29889,
3707,
3101,
13,
13,
1678,
3142,
353,
11837,
877,
1792,
29899,
287,
1169,
1495,
13,
1678,
2933,
353,
3132,
29889,
657,
29898,
2271,
29892,
11117,
2659,
1367,
2396,
1404,
29889,
2659,
1367,
1800,
13,
1678,
4974,
7431,
29898,
5327,
29889,
1272,
29897,
1275,
29871,
29906,
396,
29871,
29906,
1226,
1169,
4133,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
1678,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
1792,
29918,
287,
1169,
1649,
1792,
29918,
13221,
29918,
1333,
29918,
28997,
29898,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
1792,
29899,
287,
1169,
1495,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
657,
29898,
2271,
29892,
11117,
2659,
1367,
2396,
29871,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
1800,
13,
1678,
4974,
7431,
29898,
5327,
29889,
1272,
29897,
1275,
29871,
29900,
396,
694,
1226,
1169,
4133,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
1753,
1243,
29918,
6717,
29918,
5924,
29918,
5269,
1649,
3084,
29918,
21125,
29898,
4645,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
1125,
13,
1678,
3142,
353,
11837,
877,
6717,
29899,
5924,
29899,
5269,
1495,
13,
1678,
6055,
29889,
14605,
3059,
4162,
29907,
29918,
29903,
4897,
15082,
29918,
26862,
6227,
353,
12801,
26862,
6227,
16299,
13,
1678,
2933,
353,
3132,
29918,
2541,
29918,
2676,
3488,
29918,
11944,
9409,
29889,
2490,
29898,
2271,
29892,
11117,
9823,
2396,
12801,
26862,
6227,
29958,
742,
525,
20622,
2396,
525,
29909,
4967,
29889,
742,
525,
3728,
2396,
525,
29909,
2643,
6169,
1800,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29871,
2
] |
educative/course1/graphs/ch2_dfs.py | liveroot/ambition2020 | 0 | 51603 | <gh_stars>0
import educative.course1.stacks_queues.stack as s
import educative.course1.graphs.graph as g
input_num_vertices = 5
input_edges = {0: [1, 2], 1: [3, 4]}
expected_output = "02143 or 02134 or 01432 or 01342"
# this code implements Depth First Traversal in a graph. Each element in the graph's adjacency list
# represents a list of nodes directly connected to the current element. Each of these lists represent
# levels in the graph. We traverse all the nodes from root node to last node first, then we back-track
# to the last visited common node and then we take second branch from there, until we back-track to root node
# and no branches are left unvisited.
# --------------
# For traversal:
# --------------
# 1. We first push the root node in a stack and mark it visited.
# 2. Now we get the list of adjacent nodes from the root node and push all adjacent nodes in the list
# to the stack.
# 3. As we are pushing the adjacent nodes to the stack, we mark them as visited.
# 4. Simultaneously, we pop the nodes from the stack and append the node's value to the result
# --------------
def bfs_traversal(graph, root):
result = ""
visited = [False] * graph.num_vertices
stack = s.Stack(graph.num_vertices, True) # suppress_printing = True
stack.push(root)
while not stack.is_empty():
g_node = stack.pop()
result += str(g_node)
dll = graph.adjacency_list[g_node]
if dll is not None:
current = dll.head
while current:
if not visited[current.value]:
stack.push(current.value)
visited[current.value] = True
current = current.next
return result
def main():
# create a graph from input data
graph = g.Graph(input_num_vertices, True) # suppress_printing = True
for x in input_edges.keys():
for y in input_edges[x]:
graph.add_edge(x, y)
# set a starting point for traversal
root = 0
print("Input:")
print("Graph in Adjacency List Representation:")
print(str(graph.prettify()))
print("Expected: " + str(expected_output))
print("Output: " + str(bfs_traversal(graph, root)))
if __name__ == '__main__':
main()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
6320,
1230,
29889,
15775,
29896,
29889,
1429,
29879,
29918,
802,
1041,
29889,
1429,
408,
269,
13,
5215,
6320,
1230,
29889,
15775,
29896,
29889,
4262,
29879,
29889,
4262,
408,
330,
13,
13,
2080,
29918,
1949,
29918,
1765,
1575,
353,
29871,
29945,
13,
2080,
29918,
287,
2710,
353,
426,
29900,
29901,
518,
29896,
29892,
29871,
29906,
1402,
29871,
29896,
29901,
518,
29941,
29892,
29871,
29946,
12258,
13,
9684,
29918,
4905,
353,
376,
29900,
29906,
29896,
29946,
29941,
470,
29871,
29900,
29906,
29896,
29941,
29946,
470,
29871,
29900,
29896,
29946,
29941,
29906,
470,
29871,
29900,
29896,
29941,
29946,
29906,
29908,
13,
13,
13,
29937,
445,
775,
10703,
10034,
386,
3824,
3201,
874,
284,
297,
263,
3983,
29889,
7806,
1543,
297,
278,
3983,
29915,
29879,
12109,
562,
3819,
1051,
13,
29937,
11524,
263,
1051,
310,
7573,
4153,
6631,
304,
278,
1857,
1543,
29889,
7806,
310,
1438,
8857,
2755,
13,
29937,
11174,
297,
278,
3983,
29889,
1334,
29370,
599,
278,
7573,
515,
3876,
2943,
304,
1833,
2943,
937,
29892,
769,
591,
1250,
29899,
11294,
13,
29937,
304,
278,
1833,
16669,
3619,
2943,
322,
769,
591,
2125,
1473,
5443,
515,
727,
29892,
2745,
591,
1250,
29899,
11294,
304,
3876,
2943,
13,
29937,
322,
694,
14202,
526,
2175,
443,
1730,
1573,
29889,
13,
29937,
448,
9072,
29899,
13,
29937,
1152,
13310,
284,
29901,
13,
29937,
448,
9072,
29899,
13,
29937,
29871,
29896,
29889,
1334,
937,
5503,
278,
3876,
2943,
297,
263,
5096,
322,
2791,
372,
16669,
29889,
13,
29937,
29871,
29906,
29889,
2567,
591,
679,
278,
1051,
310,
20114,
7573,
515,
278,
3876,
2943,
322,
5503,
599,
20114,
7573,
297,
278,
1051,
13,
29937,
1678,
304,
278,
5096,
29889,
13,
29937,
29871,
29941,
29889,
1094,
591,
526,
27556,
278,
20114,
7573,
304,
278,
5096,
29892,
591,
2791,
963,
408,
16669,
29889,
13,
29937,
29871,
29946,
29889,
3439,
499,
1662,
5794,
29892,
591,
1835,
278,
7573,
515,
278,
5096,
322,
9773,
278,
2943,
29915,
29879,
995,
304,
278,
1121,
13,
29937,
448,
9072,
29899,
13,
1753,
289,
5847,
29918,
3018,
874,
284,
29898,
4262,
29892,
3876,
1125,
13,
1678,
1121,
353,
5124,
13,
1678,
16669,
353,
518,
8824,
29962,
334,
3983,
29889,
1949,
29918,
1765,
1575,
13,
13,
1678,
5096,
353,
269,
29889,
7264,
29898,
4262,
29889,
1949,
29918,
1765,
1575,
29892,
5852,
29897,
396,
21301,
29918,
2158,
292,
353,
5852,
13,
1678,
5096,
29889,
5910,
29898,
4632,
29897,
13,
13,
1678,
1550,
451,
5096,
29889,
275,
29918,
6310,
7295,
13,
4706,
330,
29918,
3177,
353,
5096,
29889,
7323,
580,
13,
4706,
1121,
4619,
851,
29898,
29887,
29918,
3177,
29897,
13,
13,
4706,
24415,
353,
3983,
29889,
26859,
562,
3819,
29918,
1761,
29961,
29887,
29918,
3177,
29962,
13,
4706,
565,
24415,
338,
451,
6213,
29901,
13,
9651,
1857,
353,
24415,
29889,
2813,
13,
9651,
1550,
1857,
29901,
13,
18884,
565,
451,
16669,
29961,
3784,
29889,
1767,
5387,
13,
462,
1678,
5096,
29889,
5910,
29898,
3784,
29889,
1767,
29897,
13,
462,
1678,
16669,
29961,
3784,
29889,
1767,
29962,
353,
5852,
13,
18884,
1857,
353,
1857,
29889,
4622,
13,
13,
1678,
736,
1121,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
396,
1653,
263,
3983,
515,
1881,
848,
13,
1678,
3983,
353,
330,
29889,
9527,
29898,
2080,
29918,
1949,
29918,
1765,
1575,
29892,
5852,
29897,
396,
21301,
29918,
2158,
292,
353,
5852,
13,
1678,
363,
921,
297,
1881,
29918,
287,
2710,
29889,
8149,
7295,
13,
4706,
363,
343,
297,
1881,
29918,
287,
2710,
29961,
29916,
5387,
13,
9651,
3983,
29889,
1202,
29918,
12864,
29898,
29916,
29892,
343,
29897,
13,
13,
1678,
396,
731,
263,
6257,
1298,
363,
13310,
284,
13,
1678,
3876,
353,
29871,
29900,
13,
13,
1678,
1596,
703,
4290,
29901,
1159,
13,
1678,
1596,
703,
9527,
297,
2087,
29926,
562,
3819,
2391,
16314,
362,
29901,
1159,
13,
1678,
1596,
29898,
710,
29898,
4262,
29889,
1457,
698,
1598,
22130,
13,
13,
1678,
1596,
703,
1252,
6021,
29901,
376,
718,
851,
29898,
9684,
29918,
4905,
876,
13,
1678,
1596,
703,
6466,
29901,
376,
718,
851,
29898,
1635,
29879,
29918,
3018,
874,
284,
29898,
4262,
29892,
3876,
4961,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
13,
2
] |
hexun/hexun/items.py | judypol/pytonStudy | 0 | 1612353 | <filename>hexun/hexun/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy import Field
class HexunItem(scrapy.Item):
# define the fields for your item here like:
product=Field() #产品
dateTime = Field() # 时间
price = Field() # 价格
amount = Field() # 成交额
volumn = Field() # 成交量
avePrice = Field() # 领先指标
openInterest = Field() # 持仓量
| [
1,
529,
9507,
29958,
20970,
348,
29914,
20970,
348,
29914,
7076,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
22402,
1244,
278,
4733,
363,
596,
885,
2390,
287,
4452,
13,
29937,
13,
29937,
2823,
5106,
297,
29901,
13,
29937,
1732,
597,
1514,
29889,
1557,
336,
2272,
29889,
990,
29914,
264,
29914,
12333,
29914,
3332,
1199,
29914,
7076,
29889,
1420,
13,
13,
5215,
24559,
2272,
13,
3166,
24559,
2272,
1053,
8989,
13,
13,
13,
1990,
379,
735,
348,
2001,
29898,
1557,
336,
2272,
29889,
2001,
1125,
13,
1678,
396,
4529,
278,
4235,
363,
596,
2944,
1244,
763,
29901,
13,
1678,
3234,
29922,
3073,
580,
268,
396,
231,
189,
170,
31399,
13,
1678,
2635,
2481,
353,
8989,
580,
29871,
396,
29871,
30594,
31016,
13,
1678,
8666,
353,
8989,
580,
29871,
396,
29871,
231,
190,
186,
31168,
13,
1678,
5253,
353,
8989,
580,
29871,
396,
29871,
30494,
31398,
236,
165,
160,
13,
1678,
1700,
1227,
353,
8989,
580,
29871,
396,
29871,
30494,
31398,
31180,
13,
1678,
8992,
13026,
353,
8989,
580,
29871,
396,
29871,
236,
165,
137,
31244,
31084,
31062,
13,
1678,
1722,
4074,
342,
353,
8989,
580,
29871,
396,
29871,
31695,
231,
190,
150,
31180,
13,
2
] |
python/cendalytics/report/core/dmo/record_retriever.py | jiportilla/ontology | 0 | 120233 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tabulate import tabulate
from base import BaseObject
from datamongo import BaseMongoClient
from datamongo import CendantCollection
from datamongo import CendantXdm
from datamongo import TransformCendantRecords
class RecordRetriever(BaseObject):
def __init__(self,
key_field: str,
mongo_client: BaseMongoClient,
collection_names: dict,
is_debug: bool = False):
"""
Created:
13-Nov-2019
<EMAIL>
* refactored out of 'generate-feedback-report'
Updated:
14-Nov-2019
<EMAIL>
* added random record capability
https://github.ibm.com/GTS-CDO/unstructured-analytics/issues/1331#issuecomment-16009658
:param key_field:
the value of the keyfield to process
(e.g. the actual Serial Number or Open Seat ID)
:param collection_names:
a dictionary containing a complete set of collection names
Sample Input:
{ 'src': 'supply_src_20191025',
'tag': 'supply_tag_20191025',
'xdm': 'supply_xdm_20191029' }
:param is_debug:
"""
BaseObject.__init__(self, __name__)
self._is_debug = is_debug
self._key_field = key_field
self._mongo_client = mongo_client
self._collection_names = collection_names
def _retrieve_record(self,
collection_name: str):
collection = CendantCollection(is_debug=self._is_debug,
some_base_client=self._mongo_client,
some_collection_name=collection_name)
if self._key_field.lower().strip() == "random": # GIT-1331-16009658
return collection.random(total_records=1)[0]
return collection.by_key_field(self._key_field)
def _tag_record(self) -> dict or None:
tag_record = self._retrieve_record(self._collection_names["tag"])
if not self._collection_names["tag"]:
self.logger.warning('\n'.join([
"TAG Collection Not Found",
f"\t{self._collection_names}"]))
return None
if not tag_record:
self.logger.warning('\n'.join([
f"TAG Record Not Found ("
f"key-field={self._key_field})"]))
return None
if self._is_debug:
df_record = TransformCendantRecords.to_dataframe(a_record=tag_record,
include_text=False)
self.logger.debug('\n'.join([
f"Retrieved TAG Record ("
f"key-field={self._key_field})",
tabulate(df_record, tablefmt='psql', headers='keys')]))
return tag_record
def _xdm_record(self) -> dict or None:
if not self._collection_names["xdm"]:
self.logger.warning('\n'.join([
"XDM Collection Not Found",
f"\t{self._collection_names}"]))
return None
xdm_record = self._retrieve_record(self._collection_names["xdm"])
if not xdm_record:
self.logger.warning('\n'.join([
f"XDM Record Not Found ("
f"key-field={self._key_field})"]))
return None
if self._is_debug:
self.logger.debug('\n'.join([
f"Retrieved XDM Record ("
f"key-field={self._key_field})",
tabulate(CendantXdm.dataframe(xdm_record),
tablefmt='psql',
headers='keys')]))
return xdm_record
def process(self) -> dict:
svcresult = {
"tag": self._tag_record(),
"xdm": self._xdm_record()}
if self._is_debug:
self.logger.debug('\n'.join([
"Records Retrieved",
f"\tKey Field: {self._key_field}",
f"\tTAG Collection: {self._collection_names['tag']}",
f"\tXDM Collection: {self._collection_names['xdm']}"]))
return svcresult
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
13,
3166,
4434,
5987,
1053,
4434,
5987,
13,
13,
3166,
2967,
1053,
7399,
2061,
13,
3166,
1418,
314,
7443,
1053,
7399,
29924,
7443,
4032,
13,
3166,
1418,
314,
7443,
1053,
315,
5818,
7196,
13,
3166,
1418,
314,
7443,
1053,
315,
5818,
29990,
18933,
13,
3166,
1418,
314,
7443,
1053,
4103,
689,
29907,
5818,
4789,
4339,
13,
13,
13,
1990,
14164,
8015,
2546,
369,
29898,
5160,
2061,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
1820,
29918,
2671,
29901,
851,
29892,
13,
462,
19476,
29918,
4645,
29901,
7399,
29924,
7443,
4032,
29892,
13,
462,
4333,
29918,
7039,
29901,
9657,
29892,
13,
462,
338,
29918,
8382,
29901,
6120,
353,
7700,
1125,
13,
4706,
9995,
13,
4706,
6760,
630,
29901,
13,
632,
29896,
29941,
29899,
25363,
29899,
29906,
29900,
29896,
29929,
13,
9651,
529,
26862,
6227,
29958,
13,
9651,
334,
259,
2143,
627,
4395,
714,
310,
525,
17158,
29899,
18798,
1627,
29899,
12276,
29915,
13,
4706,
25723,
29901,
13,
632,
29896,
29946,
29899,
25363,
29899,
29906,
29900,
29896,
29929,
13,
9651,
529,
26862,
6227,
29958,
13,
9651,
334,
259,
2715,
4036,
2407,
2117,
3097,
13,
18884,
2045,
597,
3292,
29889,
29690,
29889,
510,
29914,
29954,
9375,
29899,
29907,
3970,
29914,
348,
4984,
2955,
29899,
7054,
22026,
29914,
12175,
29914,
29896,
29941,
29941,
29896,
29937,
15118,
9342,
29899,
29896,
29953,
29900,
29900,
29929,
29953,
29945,
29947,
13,
4706,
584,
3207,
1820,
29918,
2671,
29901,
13,
9651,
278,
995,
310,
278,
1820,
2671,
304,
1889,
13,
9651,
313,
29872,
29889,
29887,
29889,
278,
3935,
18896,
9681,
470,
4673,
922,
271,
3553,
29897,
13,
4706,
584,
3207,
4333,
29918,
7039,
29901,
13,
9651,
263,
8600,
6943,
263,
4866,
731,
310,
4333,
2983,
13,
9651,
21029,
10567,
29901,
13,
18884,
426,
259,
525,
4351,
2396,
29871,
525,
19303,
368,
29918,
4351,
29918,
29906,
29900,
29896,
29929,
29896,
29900,
29906,
29945,
742,
13,
462,
1678,
525,
4039,
2396,
29871,
525,
19303,
368,
29918,
4039,
29918,
29906,
29900,
29896,
29929,
29896,
29900,
29906,
29945,
742,
13,
462,
1678,
525,
29916,
18933,
2396,
29871,
525,
19303,
368,
29918,
29916,
18933,
29918,
29906,
29900,
29896,
29929,
29896,
29900,
29906,
29929,
29915,
500,
13,
4706,
584,
3207,
338,
29918,
8382,
29901,
13,
4706,
9995,
13,
4706,
7399,
2061,
17255,
2344,
12035,
1311,
29892,
4770,
978,
1649,
29897,
13,
13,
4706,
1583,
3032,
275,
29918,
8382,
353,
338,
29918,
8382,
13,
4706,
1583,
3032,
1989,
29918,
2671,
353,
1820,
29918,
2671,
13,
4706,
1583,
3032,
29885,
7443,
29918,
4645,
353,
19476,
29918,
4645,
13,
4706,
1583,
3032,
10855,
29918,
7039,
353,
4333,
29918,
7039,
13,
13,
1678,
822,
903,
276,
509,
2418,
29918,
11651,
29898,
1311,
29892,
13,
462,
308,
4333,
29918,
978,
29901,
851,
1125,
13,
4706,
4333,
353,
315,
5818,
7196,
29898,
275,
29918,
8382,
29922,
1311,
3032,
275,
29918,
8382,
29892,
13,
462,
462,
539,
777,
29918,
3188,
29918,
4645,
29922,
1311,
3032,
29885,
7443,
29918,
4645,
29892,
13,
462,
462,
539,
777,
29918,
10855,
29918,
978,
29922,
10855,
29918,
978,
29897,
13,
13,
4706,
565,
1583,
3032,
1989,
29918,
2671,
29889,
13609,
2141,
17010,
580,
1275,
376,
8172,
1115,
29871,
396,
402,
1806,
29899,
29896,
29941,
29941,
29896,
29899,
29896,
29953,
29900,
29900,
29929,
29953,
29945,
29947,
13,
9651,
736,
4333,
29889,
8172,
29898,
7827,
29918,
3757,
4339,
29922,
29896,
9601,
29900,
29962,
13,
13,
4706,
736,
4333,
29889,
1609,
29918,
1989,
29918,
2671,
29898,
1311,
3032,
1989,
29918,
2671,
29897,
13,
13,
1678,
822,
903,
4039,
29918,
11651,
29898,
1311,
29897,
1599,
9657,
470,
6213,
29901,
13,
4706,
4055,
29918,
11651,
353,
1583,
3032,
276,
509,
2418,
29918,
11651,
29898,
1311,
3032,
10855,
29918,
7039,
3366,
4039,
20068,
13,
13,
4706,
565,
451,
1583,
3032,
10855,
29918,
7039,
3366,
4039,
3108,
29901,
13,
9651,
1583,
29889,
21707,
29889,
27392,
28909,
29876,
4286,
7122,
4197,
13,
18884,
376,
16881,
14348,
2216,
7460,
613,
13,
18884,
285,
26732,
29873,
29912,
1311,
3032,
10855,
29918,
7039,
29913,
3108,
876,
13,
9651,
736,
6213,
13,
13,
4706,
565,
451,
4055,
29918,
11651,
29901,
13,
9651,
1583,
29889,
21707,
29889,
27392,
28909,
29876,
4286,
7122,
4197,
13,
18884,
285,
29908,
16881,
14164,
2216,
7460,
4852,
13,
18884,
285,
29908,
1989,
29899,
2671,
3790,
1311,
3032,
1989,
29918,
2671,
1800,
3108,
876,
13,
9651,
736,
6213,
13,
13,
4706,
565,
1583,
3032,
275,
29918,
8382,
29901,
13,
9651,
4489,
29918,
11651,
353,
4103,
689,
29907,
5818,
4789,
4339,
29889,
517,
29918,
1272,
2557,
29898,
29874,
29918,
11651,
29922,
4039,
29918,
11651,
29892,
13,
462,
462,
462,
632,
3160,
29918,
726,
29922,
8824,
29897,
13,
9651,
1583,
29889,
21707,
29889,
8382,
28909,
29876,
4286,
7122,
4197,
13,
18884,
285,
29908,
8015,
2546,
1490,
323,
10051,
14164,
4852,
13,
18884,
285,
29908,
1989,
29899,
2671,
3790,
1311,
3032,
1989,
29918,
2671,
1800,
613,
13,
18884,
4434,
5987,
29898,
2176,
29918,
11651,
29892,
1591,
23479,
2433,
567,
1519,
742,
9066,
2433,
8149,
1495,
12622,
13,
13,
4706,
736,
4055,
29918,
11651,
13,
13,
1678,
822,
903,
29916,
18933,
29918,
11651,
29898,
1311,
29897,
1599,
9657,
470,
6213,
29901,
13,
13,
4706,
565,
451,
1583,
3032,
10855,
29918,
7039,
3366,
29916,
18933,
3108,
29901,
13,
9651,
1583,
29889,
21707,
29889,
27392,
28909,
29876,
4286,
7122,
4197,
13,
18884,
376,
29990,
23560,
14348,
2216,
7460,
613,
13,
18884,
285,
26732,
29873,
29912,
1311,
3032,
10855,
29918,
7039,
29913,
3108,
876,
13,
9651,
736,
6213,
13,
13,
4706,
921,
18933,
29918,
11651,
353,
1583,
3032,
276,
509,
2418,
29918,
11651,
29898,
1311,
3032,
10855,
29918,
7039,
3366,
29916,
18933,
20068,
13,
13,
4706,
565,
451,
921,
18933,
29918,
11651,
29901,
13,
9651,
1583,
29889,
21707,
29889,
27392,
28909,
29876,
4286,
7122,
4197,
13,
18884,
285,
29908,
29990,
23560,
14164,
2216,
7460,
4852,
13,
18884,
285,
29908,
1989,
29899,
2671,
3790,
1311,
3032,
1989,
29918,
2671,
1800,
3108,
876,
13,
9651,
736,
6213,
13,
13,
4706,
565,
1583,
3032,
275,
29918,
8382,
29901,
13,
9651,
1583,
29889,
21707,
29889,
8382,
28909,
29876,
4286,
7122,
4197,
13,
18884,
285,
29908,
8015,
2546,
1490,
1060,
23560,
14164,
4852,
13,
18884,
285,
29908,
1989,
29899,
2671,
3790,
1311,
3032,
1989,
29918,
2671,
1800,
613,
13,
18884,
4434,
5987,
29898,
29907,
5818,
29990,
18933,
29889,
1272,
2557,
29898,
29916,
18933,
29918,
11651,
511,
13,
462,
308,
1591,
23479,
2433,
567,
1519,
742,
13,
462,
308,
9066,
2433,
8149,
1495,
12622,
13,
13,
4706,
736,
921,
18933,
29918,
11651,
13,
13,
1678,
822,
1889,
29898,
1311,
29897,
1599,
9657,
29901,
13,
13,
4706,
3731,
29883,
2914,
353,
426,
13,
9651,
376,
4039,
1115,
1583,
3032,
4039,
29918,
11651,
3285,
13,
9651,
376,
29916,
18933,
1115,
1583,
3032,
29916,
18933,
29918,
11651,
28296,
13,
13,
4706,
565,
1583,
3032,
275,
29918,
8382,
29901,
13,
9651,
1583,
29889,
21707,
29889,
8382,
28909,
29876,
4286,
7122,
4197,
13,
18884,
376,
4789,
4339,
25427,
613,
13,
18884,
285,
26732,
29873,
2558,
8989,
29901,
426,
1311,
3032,
1989,
29918,
2671,
17671,
13,
18884,
285,
26732,
29873,
16881,
14348,
29901,
426,
1311,
3032,
10855,
29918,
7039,
1839,
4039,
2033,
17671,
13,
18884,
285,
26732,
29873,
29990,
23560,
14348,
29901,
426,
1311,
3032,
10855,
29918,
7039,
1839,
29916,
18933,
2033,
29913,
3108,
876,
13,
13,
4706,
736,
3731,
29883,
2914,
13,
2
] |
tweet.py | m-r-moon/videographer | 0 | 88864 | <gh_stars>0
###############################
# Filename: tweet.py #
# Author: <NAME> #
###############################
import tweepy
from time import sleep
from credentials import *
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth)
# text status update
api.update_status('status')
# file status update
api.update_with_media(filename, status, video)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
13383,
7346,
4136,
2277,
29937,
13,
29937,
2514,
3871,
29901,
7780,
300,
29889,
2272,
3986,
396,
13,
29937,
13361,
29901,
529,
5813,
29958,
418,
396,
13,
13383,
7346,
4136,
2277,
29937,
13,
13,
5215,
7780,
1022,
29891,
13,
3166,
931,
1053,
8709,
13,
3166,
16140,
1053,
334,
13,
13,
5150,
353,
7780,
1022,
29891,
29889,
29949,
6444,
4598,
29898,
25978,
261,
29918,
1989,
29892,
21691,
29918,
19024,
29897,
13,
5150,
29889,
842,
29918,
5943,
29918,
6979,
29898,
5943,
29918,
6979,
29892,
2130,
29918,
19024,
29897,
13,
2754,
353,
7780,
1022,
29891,
29889,
8787,
29898,
5150,
29897,
13,
13,
29937,
1426,
4660,
2767,
13,
2754,
29889,
5504,
29918,
4882,
877,
4882,
1495,
13,
13,
29937,
934,
4660,
2767,
13,
2754,
29889,
5504,
29918,
2541,
29918,
9799,
29898,
9507,
29892,
4660,
29892,
4863,
29897,
13,
2
] |
tests/test_groups.py | daylinmorgan/click-rich-help | 4 | 182754 | <gh_stars>1-10
import click
from click_rich_help import StyledCommand, StyledGroup
def test_command_group(runner):
@click.group(
cls=StyledGroup,
command_groups={"main": ["cmd1", "cmd2"]},
)
def cli():
pass
@cli.command(cls=StyledCommand, styles={"header": "yellow", "option": "green"})
@click.option("--name", help="The person to greet.")
def cmd1(count):
pass
@cli.command()
def cmd2():
pass
@cli.command()
def othercmd():
pass
result = runner.invoke(cli, ["--help"], color=True)
assert not result.exception
assert result.output.splitlines() == [
"\x1b[1;3;36mUsage\x1b[0m: \x1b[1mcli\x1b[0m \x1b[1m[OPTIONS] COMMAND [ARGS]...\x1b[0m",
"",
"\x1b[1;3;36mOptions\x1b[0m:",
" \x1b[1;33m--help\x1b[0m Show this message and exit.",
"",
"\x1b[1;3;36mmain\x1b[0m:",
" \x1b[1;33mcmd1\x1b[0m ",
" \x1b[1;33mcmd2\x1b[0m ",
"",
"\x1b[1;3;36mCommands\x1b[0m:",
" \x1b[1;33mothercmd\x1b[0m ",
]
def test_unkown_command(runner):
@click.group(cls=StyledGroup, command_groups={"main": ["cmd1", "unknowncmd"]})
def cli():
pass
@cli.command(cls=StyledCommand, styles={"header": "yellow", "option": "green"})
@click.option("--name", help="The person to greet.")
def cmd1(count):
pass
@cli.command()
def cmd2():
pass
@cli.command()
def othercmd():
pass
result = runner.invoke(cli, ["--help"], color=True)
assert isinstance(result.exception, ValueError)
assert (
str(result.exception)
== "Unable to find command 'unknowncmd' in list of commands"
)
def test_option_group(runner):
@click.group(cls=StyledGroup, styles={"header": "yellow", "option": "green"})
def cli():
pass
@cli.command(option_groups={"Config": ["--config", "--save-config"]})
@click.option("--name", help="The person to greet.")
@click.option("--config", help="path to config")
@click.option("--save-config", help="save config", is_flag=True)
def command(name):
pass
result = runner.invoke(cli, ["command", "--help"], color=True)
assert not result.exception
assert result.output.splitlines() == [
"\x1b[33mUsage\x1b[0m: \x1b[1mcli command\x1b[0m \x1b[1m[OPTIONS]\x1b[0m",
"",
"\x1b[33mConfig\x1b[0m:",
" \x1b[32m--config \x1b[0m\x1b[32mTEXT\x1b[0m path to config",
" \x1b[32m--save-config\x1b[0m save config",
"",
"\x1b[33mOptions\x1b[0m:",
" \x1b[32m--name \x1b[0m\x1b[32mTEXT\x1b[0m The person to greet.",
" \x1b[32m--help\x1b[0m Show this message and exit.",
]
def test_unknown_option(runner):
@click.command(
cls=StyledCommand,
option_groups={"Config": ["--config", "--save-config", "--unknown-option"]},
)
@click.option("--name", help="The person to greet.")
@click.option("--config", help="path to config")
@click.option("--save-config", help="save config", is_flag=True)
def cli(name):
pass
result = runner.invoke(cli, ["--help"], color=True)
assert isinstance(result.exception, ValueError)
assert (
str(result.exception)
== "Unable to find option '--unknown-option' in list of options"
)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
2828,
13,
13,
3166,
2828,
29918,
4018,
29918,
8477,
1053,
624,
29891,
839,
6255,
29892,
624,
29891,
839,
4782,
13,
13,
13,
1753,
1243,
29918,
6519,
29918,
2972,
29898,
27492,
1125,
13,
1678,
732,
3808,
29889,
2972,
29898,
13,
4706,
1067,
29879,
29922,
855,
29891,
839,
4782,
29892,
13,
4706,
1899,
29918,
13155,
3790,
29908,
3396,
1115,
6796,
9006,
29896,
613,
376,
9006,
29906,
3108,
1118,
13,
1678,
1723,
13,
1678,
822,
9335,
7295,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
29898,
25932,
29922,
855,
29891,
839,
6255,
29892,
11949,
3790,
29908,
6672,
1115,
376,
29136,
613,
376,
3385,
1115,
376,
12692,
29908,
1800,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
978,
613,
1371,
543,
1576,
2022,
304,
1395,
300,
23157,
13,
1678,
822,
9920,
29896,
29898,
2798,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
580,
13,
1678,
822,
9920,
29906,
7295,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
580,
13,
1678,
822,
916,
9006,
7295,
13,
4706,
1209,
13,
13,
1678,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29892,
6796,
489,
8477,
12436,
2927,
29922,
5574,
29897,
13,
1678,
4974,
451,
1121,
29889,
11739,
13,
1678,
4974,
1121,
29889,
4905,
29889,
5451,
9012,
580,
1275,
518,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29936,
29941,
29953,
29885,
27573,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
320,
29916,
29896,
29890,
29961,
29896,
29885,
11303,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
320,
29916,
29896,
29890,
29961,
29896,
29885,
29961,
14094,
27946,
29962,
23353,
1529,
2797,
518,
1718,
10749,
29962,
856,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
613,
13,
4706,
12633,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29936,
29941,
29953,
29885,
5856,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29941,
29885,
489,
8477,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
7704,
445,
2643,
322,
6876,
19602,
13,
4706,
12633,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29936,
29941,
29953,
29885,
3396,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29941,
29885,
9006,
29896,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
9162,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29941,
29885,
9006,
29906,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
9162,
13,
4706,
12633,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29936,
29941,
29953,
29885,
5261,
4167,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29896,
29936,
29941,
29941,
29885,
1228,
9006,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
9162,
13,
1678,
4514,
13,
13,
13,
1753,
1243,
29918,
2960,
776,
29918,
6519,
29898,
27492,
1125,
13,
1678,
732,
3808,
29889,
2972,
29898,
25932,
29922,
855,
29891,
839,
4782,
29892,
1899,
29918,
13155,
3790,
29908,
3396,
1115,
6796,
9006,
29896,
613,
376,
26690,
9006,
3108,
1800,
13,
1678,
822,
9335,
7295,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
29898,
25932,
29922,
855,
29891,
839,
6255,
29892,
11949,
3790,
29908,
6672,
1115,
376,
29136,
613,
376,
3385,
1115,
376,
12692,
29908,
1800,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
978,
613,
1371,
543,
1576,
2022,
304,
1395,
300,
23157,
13,
1678,
822,
9920,
29896,
29898,
2798,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
580,
13,
1678,
822,
9920,
29906,
7295,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
580,
13,
1678,
822,
916,
9006,
7295,
13,
4706,
1209,
13,
13,
1678,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29892,
6796,
489,
8477,
12436,
2927,
29922,
5574,
29897,
13,
1678,
4974,
338,
8758,
29898,
2914,
29889,
11739,
29892,
7865,
2392,
29897,
13,
1678,
4974,
313,
13,
4706,
851,
29898,
2914,
29889,
11739,
29897,
13,
4706,
1275,
376,
2525,
519,
304,
1284,
1899,
525,
26690,
9006,
29915,
297,
1051,
310,
8260,
29908,
13,
1678,
1723,
13,
13,
13,
1753,
1243,
29918,
3385,
29918,
2972,
29898,
27492,
1125,
13,
1678,
732,
3808,
29889,
2972,
29898,
25932,
29922,
855,
29891,
839,
4782,
29892,
11949,
3790,
29908,
6672,
1115,
376,
29136,
613,
376,
3385,
1115,
376,
12692,
29908,
1800,
13,
1678,
822,
9335,
7295,
13,
4706,
1209,
13,
13,
1678,
732,
11303,
29889,
6519,
29898,
3385,
29918,
13155,
3790,
29908,
3991,
1115,
6796,
489,
2917,
613,
376,
489,
7620,
29899,
2917,
3108,
1800,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
978,
613,
1371,
543,
1576,
2022,
304,
1395,
300,
23157,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
2917,
613,
1371,
543,
2084,
304,
2295,
1159,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
7620,
29899,
2917,
613,
1371,
543,
7620,
2295,
613,
338,
29918,
15581,
29922,
5574,
29897,
13,
1678,
822,
1899,
29898,
978,
1125,
13,
4706,
1209,
13,
13,
1678,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29892,
6796,
6519,
613,
376,
489,
8477,
12436,
2927,
29922,
5574,
29897,
13,
1678,
4974,
451,
1121,
29889,
11739,
13,
1678,
4974,
1121,
29889,
4905,
29889,
5451,
9012,
580,
1275,
518,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29941,
29941,
29885,
27573,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
320,
29916,
29896,
29890,
29961,
29896,
29885,
11303,
1899,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
320,
29916,
29896,
29890,
29961,
29896,
29885,
29961,
14094,
27946,
10725,
29916,
29896,
29890,
29961,
29900,
29885,
613,
13,
4706,
12633,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29941,
29941,
29885,
3991,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
489,
2917,
320,
29916,
29896,
29890,
29961,
29900,
29885,
29905,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
16975,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
2224,
304,
2295,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
489,
7620,
29899,
2917,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
4078,
2295,
613,
13,
4706,
12633,
13,
4706,
6634,
29916,
29896,
29890,
29961,
29941,
29941,
29885,
5856,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29901,
613,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
489,
978,
320,
29916,
29896,
29890,
29961,
29900,
29885,
29905,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
16975,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
29871,
450,
2022,
304,
1395,
300,
19602,
13,
4706,
376,
29871,
320,
29916,
29896,
29890,
29961,
29941,
29906,
29885,
489,
8477,
29905,
29916,
29896,
29890,
29961,
29900,
29885,
539,
7704,
445,
2643,
322,
6876,
19602,
13,
1678,
4514,
13,
13,
13,
1753,
1243,
29918,
26690,
29918,
3385,
29898,
27492,
1125,
13,
1678,
732,
3808,
29889,
6519,
29898,
13,
4706,
1067,
29879,
29922,
855,
29891,
839,
6255,
29892,
13,
4706,
2984,
29918,
13155,
3790,
29908,
3991,
1115,
6796,
489,
2917,
613,
376,
489,
7620,
29899,
2917,
613,
376,
489,
26690,
29899,
3385,
3108,
1118,
13,
1678,
1723,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
978,
613,
1371,
543,
1576,
2022,
304,
1395,
300,
23157,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
2917,
613,
1371,
543,
2084,
304,
2295,
1159,
13,
1678,
732,
3808,
29889,
3385,
703,
489,
7620,
29899,
2917,
613,
1371,
543,
7620,
2295,
613,
338,
29918,
15581,
29922,
5574,
29897,
13,
1678,
822,
9335,
29898,
978,
1125,
13,
4706,
1209,
13,
13,
1678,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29892,
6796,
489,
8477,
12436,
2927,
29922,
5574,
29897,
13,
1678,
4974,
338,
8758,
29898,
2914,
29889,
11739,
29892,
7865,
2392,
29897,
13,
1678,
4974,
313,
13,
4706,
851,
29898,
2914,
29889,
11739,
29897,
13,
4706,
1275,
376,
2525,
519,
304,
1284,
2984,
525,
489,
26690,
29899,
3385,
29915,
297,
1051,
310,
3987,
29908,
13,
1678,
1723,
13,
2
] |
sigm/ia/views.py | mariobp/SIGM | 0 | 106899 | <reponame>mariobp/SIGM<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, logout, authenticate
import models
import forms
import json
# Create your views here.
@login_required(login_url='/login/')
def index(request):
periodo = models.Periodo.objects.last()
return render(request, 'index.html', {'periodo': periodo})
# end def
def logoutUsers(request):
logout(request)
return redirect('/')
# end def
def abrirPeriodo(request):
old = models.Periodo.objects.last()
if old:
num = old.numero+1
nuevo = models.Periodo(numero=num, cerrado=False)
nuevo.save()
else:
nuevo = models.Periodo(numero=1, cerrado=False)
nuevo.save()
# end if
return redirect('/')
# end def
def cerrarPeriodo(request, pk):
periodo = models.Periodo.objects.filter(id=pk).first()
if periodo:
periodo.cerrado = True
periodo.save()
return redirect('/')
# end def
def registrar_e(request):
if request.method == "POST":
form = forms.EstudianteForm(request.POST)
if form.is_valid():
form.save()
return redirect('/matricula/estudiante/')
else:
return render(request, 'registro_e.html', {'form': form})
# end if
return render(request, 'registro_e.html', {'form': forms.EstudianteForm()})
# end if
def matricula_e(request):
identificacion = request.GET.get('identificacion', False)
mensaje = ""
if identificacion:
estudiante = models.Estudiante.objects.filter(identificacion=identificacion).first()
if estudiante:
periodo = models.Periodo.objects.last()
if periodo:
matricula = models.Matricula.objects.filter(estudiante=estudiante, periodo=periodo)
if matricula:
mensaje = "Ya esta matriculado"
else:
if not periodo.cerrado:
matricula = models.Matricula(periodo=periodo, estudiante=estudiante)
matricula.save()
mensaje = "Matriculado"
else:
mensaje = "Periodo cerrado, no se puede matricular"
else:
mensaje = "No se puede matricular"
else:
mensaje = "No hay ningun estudiante con este codigo"
return render(request, 'matricula.html', {"mensaje": mensaje})
# end def
def desertados(request):
return render(request, 'desertados.html', {})
# end def
def listaMatriculados(request):
periodo = models.Periodo.objects.last()
estudiante = models.Estudiante.objects.all().exclude(matricula__periodo=periodo).values('latitud', 'longitud')
data = list(estudiante)
return HttpResponse(json.dumps(data), content_type="text/json")
# end def
| [
1,
529,
276,
1112,
420,
29958,
29885,
2628,
25288,
29914,
5425,
21576,
29966,
12443,
29918,
303,
1503,
29958,
29900,
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,
12759,
7582,
29879,
1053,
4050,
29892,
6684,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
6464,
29892,
1480,
449,
29892,
15585,
403,
13,
5215,
4733,
13,
5215,
7190,
13,
5215,
4390,
13,
29937,
6204,
596,
8386,
1244,
29889,
13,
13,
29992,
7507,
29918,
12403,
29898,
7507,
29918,
2271,
2433,
29914,
7507,
29914,
1495,
13,
1753,
2380,
29898,
3827,
1125,
13,
1678,
17848,
353,
4733,
29889,
29853,
29877,
29889,
12650,
29889,
4230,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
2248,
29889,
1420,
742,
11117,
19145,
29877,
2396,
17848,
1800,
13,
29937,
1095,
822,
13,
13,
1753,
1480,
449,
5959,
29898,
3827,
1125,
13,
1678,
1480,
449,
29898,
3827,
29897,
13,
1678,
736,
6684,
11219,
1495,
13,
29937,
1095,
822,
13,
13,
1753,
633,
12416,
29853,
29877,
29898,
3827,
1125,
13,
1678,
2030,
353,
4733,
29889,
29853,
29877,
29889,
12650,
29889,
4230,
580,
13,
1678,
565,
2030,
29901,
13,
4706,
954,
353,
2030,
29889,
1949,
1489,
29974,
29896,
13,
4706,
15671,
353,
4733,
29889,
29853,
29877,
29898,
1949,
1489,
29922,
1949,
29892,
274,
3127,
912,
29922,
8824,
29897,
13,
4706,
15671,
29889,
7620,
580,
13,
1678,
1683,
29901,
13,
4706,
15671,
353,
4733,
29889,
29853,
29877,
29898,
1949,
1489,
29922,
29896,
29892,
274,
3127,
912,
29922,
8824,
29897,
13,
4706,
15671,
29889,
7620,
580,
13,
1678,
396,
1095,
565,
13,
1678,
736,
6684,
11219,
1495,
13,
29937,
1095,
822,
13,
13,
1753,
274,
3127,
279,
29853,
29877,
29898,
3827,
29892,
282,
29895,
1125,
13,
1678,
17848,
353,
4733,
29889,
29853,
29877,
29889,
12650,
29889,
4572,
29898,
333,
29922,
20571,
467,
4102,
580,
13,
1678,
565,
17848,
29901,
13,
4706,
17848,
29889,
2265,
26881,
353,
5852,
13,
4706,
17848,
29889,
7620,
580,
13,
1678,
736,
6684,
11219,
1495,
13,
29937,
1095,
822,
13,
13,
13,
1753,
21557,
279,
29918,
29872,
29898,
3827,
1125,
13,
1678,
565,
2009,
29889,
5696,
1275,
376,
5438,
1115,
13,
4706,
883,
353,
7190,
29889,
12787,
566,
12361,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
883,
29889,
7620,
580,
13,
9651,
736,
6684,
11219,
2922,
2200,
2497,
29914,
342,
566,
12361,
29914,
1495,
13,
4706,
1683,
29901,
13,
9651,
736,
4050,
29898,
3827,
29892,
525,
1727,
19150,
29918,
29872,
29889,
1420,
742,
11117,
689,
2396,
883,
1800,
13,
4706,
396,
1095,
565,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1727,
19150,
29918,
29872,
29889,
1420,
742,
11117,
689,
2396,
7190,
29889,
12787,
566,
12361,
2500,
580,
1800,
13,
29937,
1095,
565,
13,
13,
13,
1753,
1775,
2200,
2497,
29918,
29872,
29898,
3827,
1125,
13,
1678,
25907,
16337,
353,
2009,
29889,
7194,
29889,
657,
877,
1693,
928,
16337,
742,
7700,
29897,
13,
1678,
18664,
8339,
353,
5124,
13,
1678,
565,
25907,
16337,
29901,
13,
4706,
13497,
12361,
353,
4733,
29889,
12787,
566,
12361,
29889,
12650,
29889,
4572,
29898,
1693,
928,
16337,
29922,
1693,
928,
16337,
467,
4102,
580,
13,
4706,
565,
13497,
12361,
29901,
13,
9651,
17848,
353,
4733,
29889,
29853,
29877,
29889,
12650,
29889,
4230,
580,
13,
9651,
565,
17848,
29901,
13,
18884,
1775,
2200,
2497,
353,
4733,
29889,
9782,
2200,
2497,
29889,
12650,
29889,
4572,
29898,
342,
566,
12361,
29922,
342,
566,
12361,
29892,
17848,
29922,
19145,
29877,
29897,
13,
18884,
565,
1775,
2200,
2497,
29901,
13,
462,
1678,
18664,
8339,
353,
376,
29979,
29874,
7444,
1775,
2200,
352,
912,
29908,
13,
18884,
1683,
29901,
13,
462,
1678,
565,
451,
17848,
29889,
2265,
26881,
29901,
13,
462,
4706,
1775,
2200,
2497,
353,
4733,
29889,
9782,
2200,
2497,
29898,
19145,
29877,
29922,
19145,
29877,
29892,
13497,
12361,
29922,
342,
566,
12361,
29897,
13,
462,
4706,
1775,
2200,
2497,
29889,
7620,
580,
13,
462,
4706,
18664,
8339,
353,
376,
9782,
2200,
352,
912,
29908,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
18664,
8339,
353,
376,
29853,
29877,
274,
3127,
912,
29892,
694,
409,
11493,
1775,
2200,
1070,
29908,
13,
9651,
1683,
29901,
13,
18884,
18664,
8339,
353,
376,
3782,
409,
11493,
1775,
2200,
1070,
29908,
13,
4706,
1683,
29901,
13,
9651,
18664,
8339,
353,
376,
3782,
14842,
26511,
348,
13497,
12361,
378,
4404,
15234,
5973,
29908,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
2922,
2200,
2497,
29889,
1420,
742,
8853,
29885,
575,
8339,
1115,
18664,
8339,
1800,
13,
29937,
1095,
822,
13,
13,
13,
1753,
18197,
2255,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
2783,
814,
2255,
29889,
1420,
742,
426,
1800,
13,
29937,
1095,
822,
13,
13,
13,
1753,
15023,
9782,
2200,
352,
2255,
29898,
3827,
1125,
13,
1678,
17848,
353,
4733,
29889,
29853,
29877,
29889,
12650,
29889,
4230,
580,
13,
1678,
13497,
12361,
353,
4733,
29889,
12787,
566,
12361,
29889,
12650,
29889,
497,
2141,
735,
2325,
29898,
2922,
2200,
2497,
1649,
19145,
29877,
29922,
19145,
29877,
467,
5975,
877,
5066,
11267,
742,
525,
5426,
11267,
1495,
13,
1678,
848,
353,
1051,
29898,
342,
566,
12361,
29897,
13,
1678,
736,
9056,
5103,
29898,
3126,
29889,
29881,
17204,
29898,
1272,
511,
2793,
29918,
1853,
543,
726,
29914,
3126,
1159,
13,
29937,
1095,
822,
13,
2
] |
src/genui/settings/__init__.py | Tontolda/genui | 15 | 60558 | """
__init__.py
Created by: <NAME>
On: 4/27/20, 10:49 AM
"""
| [
1,
9995,
13,
1649,
2344,
26914,
2272,
13,
13,
20399,
491,
29901,
529,
5813,
29958,
13,
2951,
29901,
29871,
29946,
29914,
29906,
29955,
29914,
29906,
29900,
29892,
29871,
29896,
29900,
29901,
29946,
29929,
13862,
13,
15945,
29908,
13,
13,
2
] |
sandbox/decorator_def.py | olileger/sBeull | 0 | 136106 | import functools
def FuncDecoratorOne(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
print("Calling: ", func.__name__)
return func(*args, **kwargs)
return wrapper
def FuncDecoratorListProperties(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
print("Object's properties: ", args[0].__dict__)
return func(*args, **kwargs)
return wrapper
def ClassDecoratorOne(c):
__init__ = c.__init__
@functools.wraps(c.__init__)
def wrapper(_self_, *args, **kwargs):
__init__(_self_, *args, **kwargs)
c.__init__ = wrapper
return c | [
1,
1053,
2090,
312,
8789,
13,
13,
1753,
383,
4661,
6185,
272,
1061,
6716,
29898,
9891,
1125,
13,
1678,
732,
7692,
312,
8789,
29889,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
14476,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1596,
703,
5594,
292,
29901,
9162,
3653,
17255,
978,
1649,
29897,
13,
4706,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
1678,
736,
14476,
13,
13,
13,
1753,
383,
4661,
6185,
272,
1061,
1293,
11857,
29898,
9891,
1125,
13,
1678,
732,
7692,
312,
8789,
29889,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
14476,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1596,
703,
2061,
29915,
29879,
4426,
29901,
9162,
6389,
29961,
29900,
1822,
1649,
8977,
1649,
29897,
13,
4706,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
1678,
736,
14476,
13,
13,
13,
1753,
4134,
6185,
272,
1061,
6716,
29898,
29883,
1125,
13,
1678,
4770,
2344,
1649,
353,
274,
17255,
2344,
1649,
13,
1678,
732,
7692,
312,
8789,
29889,
29893,
336,
567,
29898,
29883,
17255,
2344,
1649,
29897,
13,
1678,
822,
14476,
7373,
1311,
3383,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
4770,
2344,
1649,
7373,
1311,
3383,
334,
5085,
29892,
3579,
19290,
29897,
13,
1678,
274,
17255,
2344,
1649,
353,
14476,
13,
1678,
736,
274,
2
] |
RIPv2-Simulation/Router.py | vkmanojk/Networks-VirtualLAN | 0 | 8171 | '''
Summary: Program that implements a routing deamon based on the
RIP version 2 protocol from RFC2453.
Usage: python3 Router.py <router_config_file>
Configuration File:
The user supplies a router configuration file of the format:
[Settings]
router-id = <router_number>
input-ports = <input> [, <input>, ...]
outputs = <output>-<metric>-<destination_router>
[, <output>-<metric>-<destination_router>, ...]
where,
router_number: ID of router between 1 - 64000.
input: port number between 1024 - 64000.
output: port number between 1024 - 6400,
not equal to any inputs.
metric: metric of output between 1 - 16.
destination_router: ID of destination router.
Description:
This program implements a basic RIPv2 routing protocol from RFC2453
for routing computations in computer networks. It takes a configuration
file as shown above and sets up a router with a new socket for each
input-port.
The RIPv2 protocol uses a routing table to keep track of all reachable
routers on the network along with their metric/cost and the direct
next hop router ID along the route to that destination router. However,
it can only send messages to the direct neighbours specified in outputs.
The protocol uses the Bellman-Ford distance vector algorithm to compute
the lowest cost route to each router in the network. If the metric is
16 or greater, the router is considered unreachable.
The routing table initially starts with a single route entry (RTE) for
itself with a metric of zero. The routing table is periodically
transmitted too each of its direct output ports via an unsolicited
response message as defined in RFC2453 section 3.9.2 and 4. This is
performed on a separate thread so it does not interfere with other
operations
The receives messages from other routers by using the python select()
function which blocks until a message is ready to be read. Once a
message is received the header and contents are validated.
If the message is valid each RTE is processed according to RFC2453
section 3.9.2.
If a new router is found the RTE is added
to the routing table, adding the cost to the metric for the output
the message was received on.
If the RTE already exists, but the metric is smaller, the metric
is updated to the lower metric.
If the lower metric is from a different next hop router, change the
next hop.
If nothing has changed, restart the timeout timer.
If RTE metric >= max metric of 16, mark the entry for
garbage collection and update the metric in the table.
If any change has occurred in the routing table as a result of a
received message, a triggered update (RFC2453 section 3.10.1) is sent
to all outputs with the updated entries. Triggered updates are sent with
a random delay between 1 - 5 seconds to prevent synchronized updates.
Request messages are not implemented in this program.
Timers (all timers are on separate threads) (RFC2453 section 3.8):
Update timer - Periodic unsolicited response message sent to all
outputs. The period is adjusted each time to a random value
between 0.8 * BASE_TIMER and 1.2 * BASE_TIMER to prevent
synchronized updates.
Timeout - used to check the routing table for RTEs which have
have not been updated within the ROUTE_TIMEOUT interval. If
a router has not been heard from within this time, then set the
metric to the max metric of 16 and start the garbage collection
timer.
Garbage timer - used to check the routing table for RTEs set
for garbage collection. If the timeout >= DELETE_TIMEOUT,
mark the RTE for deletion.
Garbage Collection - used to check the routing table for RTEs
marked for deletion, and removes those entries from the table.
'''
import configparser
import select
import socket
import sys
import time
import threading
import struct
import datetime
from random import randint, randrange
DEBUG = False
HOST = '127.0.0.1' # localhost
BASE_TIMER = 5
MAX_METRIC = 16
ROUTE_TIMEOUT = BASE_TIMER * 6
DELETE_TIMEOUT = BASE_TIMER * 4
AF_INET = 2
# ===========================================================================
# TRANSITIONS
class Transistion():
'''Class Representing a transition between states.'''
def __init__(self, to_state):
self.to_state = to_state
def execute(self):
'''Run the transition functions'''
pass
# ===========================================================================
# STATES
class State():
'''Class Representing a generic state'''
def __init__(self, fsm):
self.fsm = fsm
def enter(self):
'''Execute functions for entering a state'''
pass
def execute(self):
'''Execute functions while in state'''
pass
def exit(self):
'''Execute functions for leaving a state'''
pass
class StartUp(State):
'''Class Representing the Start up state which reads the configuration file
'''
def __init__(self, fsm):
super(StartUp, self).__init__(fsm)
def execute(self):
'''Execute the configuration functions'''
print_message("Loading Configuration File: '"
+ self.fsm.router.config_file + "'")
config = configparser.ConfigParser()
config.read(self.fsm.router.config_file)
self.get_router_id(config)
self.setup_inputs(config)
self.get_outputs(config)
self.setup_routing_table()
self.fsm.router.print_routing_table()
self.fsm.to_transition("toWaiting")
def exit(self):
'''Print complete message'''
print_message("Router Setup Complete.")
def get_router_id(self, config):
'''Read the router id number from the configuration file'''
if 1 <= int(config['Settings']['router-id']) <= 64000:
self.fsm.router.router_settings['id'] = \
int(config['Settings']['router-id'])
else:
raise Exception('Invalid Router ID Number')
def get_outputs(self, config):
'''Return a dictionary of outputs containing port, cost and destination
router id from the Configuration file'''
outputs = config['Settings']['outputs'].split(', ')
outputs = [i.split('-') for i in outputs]
self.fsm.router.router_settings['outputs'] = {}
existing_ports = []
for output in outputs:
is_valid_port = 1024 <= int(output[0]) <= 64000 and not \
int(output[0]) in existing_ports
is_valid_cost = 1 <= int(output[1]) < 16
is_valid_id = 1 <= int(output[2]) <= 64000
if is_valid_port and is_valid_cost and is_valid_id:
existing_ports.append(int(output[0]))
self.fsm.router.router_settings['outputs'][int(output[2])] = \
{'metric': int(output[1]),
'port': int(output[0])}
else:
raise Exception('Invalid Outputs')
def setup_inputs(self, config):
'''Create input sockets from the inputs specified in the config file'''
# get inputs from configuration file
ports = config['Settings']['input-ports'].split(', ')
inputs = []
for port in ports:
if 1024 <= int(port) <= 64000 and not int(port) in inputs:
inputs.append(int(port))
else:
raise Exception('Invalid Port Number')
self.fsm.router.router_settings['inputs'] = {}
# create socket for each input port
for port in inputs:
try:
self.fsm.router.router_settings['inputs'][port] = \
socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print_message('Socket ' + str(port) + ' Created.')
except socket.error as msg:
print('Failed to create socket. Message: ' + str(msg))
sys.exit()
# bind port to socket
try:
self.fsm.router.router_settings['inputs'][port].bind(
(HOST, port))
print_message('Socket ' + str(port) + ' Bind Complete.')
except socket.error as msg:
print('Failed to create socket. Message ' + str(msg))
sys.exit()
def setup_routing_table(self):
'''Setup routing table with the outputs specified in the config file'''
self.fsm.router.routing_table[self.fsm.router.router_settings['id']] = \
RIPRouteEntry(address=self.fsm.router.router_settings['id'],
nexthop=0,
metric=0,
imported=True)
class Waiting(State):
'''
Class representing the waiting state of the FSM where the router waits
for messages to be received on its input sockets. When a message is
received the state changes to the ReadMeassage state.
'''
def __init__(self, fsm):
super(Waiting, self).__init__(fsm)
def enter(self):
'''Display State entry message'''
print_message("Entering idle state...")
def execute(self):
'''Waits for input sockets to be readable and then changes the state
to process the received message.'''
readable = select.select(
self.fsm.router.router_settings['inputs'].values(), [], [])
if readable[0]:
self.fsm.router.readable_ports = readable[0]
self.fsm.to_transition("toReadMessage")
def exit(self):
'''Display State exit message'''
print_message("Message Received")
class ReadMessage(State):
'''Class representing the state for reading messages received on the input
sockets'''
def __init__(self, fsm):
super(ReadMessage, self).__init__(fsm)
def enter(self):
print_message("Reading Messages...")
def execute(self):
for port in self.fsm.router.readable_ports:
packet = RIPPacket(port.recvfrom(1024)[0])
self.fsm.router.update_routing_table(packet)
if self.fsm.router.route_change:
self.fsm.router.trigger_update()
self.fsm.router.print_routing_table()
self.fsm.to_transition("toWaiting")
def exit(self):
print_message("Messages Read.")
# ===========================================================================
# FINITE STATE MACHINE
class RouterFSM():
'''Class representing the Router finite state machine'''
def __init__(self, rip_router):
self.router = rip_router
self.states = {}
self.transitions = {}
self.cur_state = None
self.trans = None
def add_transistion(self, trans_name, transition):
'''Add a new transition to the FSM'''
self.transitions[trans_name] = transition
def add_state(self, state_name, state):
'''Add a new state to the FSM'''
self.states[state_name] = state
def set_state(self, state_name):
'''Set the current state of the FSM'''
self.cur_state = self.states[state_name]
def to_transition(self, to_trans):
'''Set the current transition of the FSM'''
self.trans = self.transitions[to_trans]
def execute(self):
'''Run the FSM'''
if self.trans:
self.cur_state.exit()
self.trans.execute()
self.set_state(self.trans.to_state)
self.cur_state.enter()
self.trans = None
self.cur_state.execute()
# ===========================================================================
# IMPLEMENTATION
class RIPPacket:
'''Class representing a RIP packet containing a header and body as defined
in RFC2453 RIPv2 section 4.'''
def __init__(self, data=None, header=None, rtes=None):
if data:
self._init_from_network(data)
elif header and rtes:
self._init_from_host(header, rtes)
else:
raise ValueError
def __repr__(self):
return "RIPPacket: Command {}, Ver. {}, number of RTEs {}.". \
format(self.header.cmd, self.header.ver, len(self.rtes))
def _init_from_network(self, data):
'''Init for RIPPacket if data is from the network'''
# Packet Validation
datalen = len(data)
if datalen < RIPHeader.SIZE:
raise FormatException
malformed_rtes = (datalen - RIPHeader.SIZE) % RIPRouteEntry.SIZE
if malformed_rtes:
raise FormatException
# Convert bytes in packet to header and RTE data
num_rtes = int((datalen - RIPHeader.SIZE) / RIPRouteEntry.SIZE)
self.header = RIPHeader(data[0:RIPHeader.SIZE])
self.rtes = []
rte_start = RIPHeader.SIZE
rte_end = RIPHeader.SIZE + RIPRouteEntry.SIZE
# Loop over data packet to obtain each RTE
for i in range(num_rtes):
self.rtes.append(RIPRouteEntry(rawdata=data[rte_start:rte_end],
src_id=self.header.src))
rte_start += RIPRouteEntry.SIZE
rte_end += RIPRouteEntry.SIZE
def _init_from_host(self, header, rtes):
'''Init for imported data'''
if header.ver != 2:
raise ValueError("Only Version 2 is supported.")
self.header = header
self.rtes = rtes
def serialize(self):
'''Return the byte sting representing this packet for network
transmission'''
packed = self.header.serialize()
for rte in self.rtes:
packed += rte.serialize()
return packed
class RIPHeader:
'''Class representing the header of a RIP packet'''
FORMAT = "!BBH"
SIZE = struct.calcsize(FORMAT)
TYPE_RESPONSE = 2
VERSION = 2
def __init__(self, rawdata=None, router_id=None):
self.packed = None
if rawdata:
self._init_from_network(rawdata)
elif router_id:
self._init_from_host(router_id)
else:
raise ValueError
def __repr__(self):
return "RIP Header (cmd = {}, ver = {}, src = {})".format(self.cmd,
self.ver,
self.src)
def _init_from_network(self, rawdata):
'''init for data from network'''
header = struct.unpack(self.FORMAT, rawdata)
self.cmd = header[0]
self.ver = header[1]
self.src = header[2]
def _init_from_host(self, router_id):
'''Init for data from host'''
self.cmd = self.TYPE_RESPONSE
self.ver = self.VERSION
self.src = router_id
def serialize(self):
'''Return the byte sting representing this header for network
transmission'''
return struct.pack(self.FORMAT, self.cmd, self.ver, self.src)
class RIPRouteEntry:
'''Class representing a single RIP route entry (RTE)'''
FORMAT = "!HHIII"
SIZE = struct.calcsize(FORMAT)
MIN_METRIC = 0
MAX_METRIC = 16
def __init__(self, rawdata=None, src_id=None, address=None,
nexthop=None, metric=None, imported=False):
self.changed = False
self.imported = imported
self.init_timeout()
if rawdata and src_id != None:
self._init_from_network(rawdata, src_id)
elif address and nexthop != None and metric != None:
self._init_from_host(address, nexthop, metric)
else:
raise ValueError
def __repr__(self):
template = "|{:^11}|{:^10}|{:^11}|{:^15}|{:^10}|{:^13}|"
# Check that timeout is set
if self.timeout == None:
return template.format(self.addr, self.metric, self.nexthop,
self.changed, self.garbage,
str(self.timeout))
else:
timeout = (datetime.datetime.now() - self.timeout).total_seconds()
return template.format(self.addr, self.metric, self.nexthop,
self.changed, self.garbage,
round(timeout, 1))
def _init_from_host(self, address, nexthop, metric):
'''Init for data from host'''
self.afi = AF_INET
self.tag = 0 # not used
self.addr = address
self.nexthop = nexthop
self.metric = metric
def _init_from_network(self, rawdata, src_id):
'''Init for data received from network'''
rte = struct.unpack(self.FORMAT, rawdata)
self.afi = rte[0]
self.tag = rte[1]
self.addr = rte[2]
self.set_nexthop(rte[3])
self.metric = rte[4]
if self.nexthop == 0:
self.nexthop = src_id
# Validation
if not self.MIN_METRIC <= self.metric <= self.MAX_METRIC:
raise FormatException
def init_timeout(self):
'''Initialize the timeout property'''
if self.imported:
self.timeout = None
else:
self.timeout = datetime.datetime.now()
self.garbage = False
self.marked_for_delection = False
def __eq__(self, other):
if self.afi == other.afi and \
self.addr == other.addr and \
self.tag == other.tag and \
self.nexthop == other.nexthop and \
self.metric == other.metric:
return True
else:
return False
def set_nexthop(self, nexthop):
'''Set the nexthop property'''
self.nexthop = nexthop
def serialize(self):
'''Pack entries into typical RIPv2 packet format for sending over the
network. '''
return struct.pack(self.FORMAT, self.afi, self.tag, self.addr,
self.nexthop, self.metric)
class FormatException(Exception):
'''Class representing the Format Exception'''
def __init__(self, message=""):
self.message = message
class Router:
'''Class representing a single router'''
def __init__(self, config_file):
self.fsm = RouterFSM(self)
self.config_file = config_file
# Dictionary of router settings, including router-id, inputs and
# outputs
self.router_settings = {}
self.readable_ports = []
# Dictionary of routing table
self.routing_table = {}
self.route_change = False
# STATES
self.fsm.add_state("StartUp", StartUp(self.fsm))
self.fsm.add_state("Waiting", Waiting(self.fsm))
self.fsm.add_state("ReadMessage", ReadMessage(self.fsm))
# TRANSITIONS
self.fsm.add_transistion("toWaiting", Transistion("Waiting"))
self.fsm.add_transistion("toReadMessage", Transistion("ReadMessage"))
self.fsm.set_state("StartUp")
def execute(self):
'''Run the router's finite state machine'''
self.fsm.execute()
def update_routing_table(self, packet):
'''Update Routing table if new route info exist'''
for rte in packet.rtes:
# ignore RTEs of self
if rte.addr != self.fsm.router.router_settings['id']:
bestroute = self.routing_table.get(rte.addr)
# set nexthop to source router and calculate metric
rte.set_nexthop(packet.header.src)
rte.metric = min(rte.metric +
self.router_settings['outputs'][
packet.header.src]['metric'],
RIPRouteEntry.MAX_METRIC)
# Route dosn't yet exist
if not bestroute:
# ignore RTEs with a metric of MAX_METRIC
if rte.metric == RIPRouteEntry.MAX_METRIC:
return
# Add new RTE to routing table
rte.changed = True
self.route_change = True
self.routing_table[rte.addr] = rte
print_message("RTE added for Router: " + str(rte.addr))
return
else:
# Route already exists
if rte.nexthop == bestroute.nexthop:
if bestroute.metric != rte.metric:
if bestroute.metric != RIPRouteEntry.MAX_METRIC \
and rte.metric >= RIPRouteEntry.MAX_METRIC:
# mark for garbage collection
bestroute.metric = RIPRouteEntry.MAX_METRIC
bestroute.garbage = True
bestroute.changed = True
self.route_change = True
else:
self.update_route(bestroute, rte)
# Route still exists with same values
elif not bestroute.garbage:
bestroute.init_timeout()
# Lower metric on existing route
elif rte.metric < bestroute.metric:
self.update_route(bestroute, rte)
def update_route(self, bestroute, rte):
'''Update an existing route entry with new route info'''
bestroute.init_timeout()
bestroute.garbage = False
bestroute.changed = True
bestroute.metric = rte.metric
bestroute.nexthop = rte.nexthop
self.route_change = True
print_message("RTE for Router: " + str(rte.addr) +
" updated with metric=" + str(rte.metric) +
", nexthop=" + str(rte.nexthop) + ".")
def print_routing_table(self):
'''Print the routing table to the terminal'''
line = "+-----------+----------+-----------+---------------+----------+-------------+"
print(line)
print(
"| Routing Table (Router "
+ str(self.router_settings['id']) + ") |")
print(line)
print(
"|Router ID | Metric | NextHop | ChangedFlag | Garbage | Timeout(s) |")
print(line)
print(self.routing_table[self.router_settings['id']])
print(
"+===========+==========+===========+===============+==========+=============+")
for entry in self.routing_table:
if entry != self.router_settings['id']:
print(self.routing_table[entry])
print(line)
print('\n')
def trigger_update(self):
'''Send Routing update for only the routes which have changed'''
changed_rtes = []
print_message("Sending Trigger update.")
for rte in self.routing_table.values():
if rte.changed:
changed_rtes.append(rte)
rte.changed = False
self.route_change = False
# send update with random delay between 1 and 5 seconds
delay = randint(1, 5)
threading.Timer(delay, self.update, [changed_rtes])
def update(self, entries):
'''Send a message to all output ports'''
if self.router_settings != {}:
sock = list(self.router_settings['inputs'].values())[1]
local_header = RIPHeader(router_id=self.router_settings['id'])
for output in self.router_settings['outputs']:
# Split horizon
# Remove RTES for which nexthop == output
split_horizon_entries = []
for entry in entries:
if entry.nexthop != output:
split_horizon_entries.append(entry)
else:
# Poison reverse
# Create new entry to get around some funky referencing
# When doing poisoned_entry = entry
poisoned_entry = RIPRouteEntry(rawdata=None,
src_id=None, address=entry.addr,
nexthop=entry.nexthop, metric= RIPRouteEntry.MAX_METRIC,
imported=entry.imported)
split_horizon_entries.append(poisoned_entry)
# comment out to disable split horizon
packet = RIPPacket(
header=local_header, rtes=split_horizon_entries)
# Uncomment to disable split horizon
# packet = RIPPacket(header=local_header, rtes=entries)
sock.sendto(packet.serialize(),
(HOST,
self.router_settings['outputs'][output]["port"]))
print_message("Message Sent To Router: " + str(output))
def check_timeout(self):
'''Check the current timeout value for each RTE in the routing table.
If the time difference with now is greater than ROUTE_TIMEOUT, then
set the metric to 16 and start the garbage collection timer.'''
print_message("Checking timeout...")
if self.routing_table != {}:
for rte in self.routing_table.values():
if rte.timeout != None and \
(datetime.datetime.now() - rte.timeout).total_seconds() \
>= ROUTE_TIMEOUT:
rte.garbage = True
rte.changed = True
self.route_change = True
rte.metric = RIPRouteEntry.MAX_METRIC
rte.timeout = datetime.datetime.now()
self.print_routing_table()
print_message("Router: " + str(rte.addr) + " timed out.")
def garbage_timer(self):
'''Check the status of the garbage property of each RTE. If true, and
the timeout value difference with now is greater than DELETE_TIMEOUT,
mark it for deletion'''
print_message("Checking garbage timeout...")
if self.routing_table != {}:
for rte in self.routing_table.values():
if rte.garbage:
if (datetime.datetime.now() - rte.timeout).total_seconds() \
>= DELETE_TIMEOUT:
rte.marked_for_delection = True
def garbage_collection(self):
'''Check the routing table for RTE's that are marked for deletion and
remove them.'''
print_message("Collecting Garbage...")
if self.routing_table != {}:
delete_routes = []
for rte in self.routing_table.values():
if rte.marked_for_delection:
delete_routes.append(rte.addr)
print_message("Router: " + str(rte.addr) + " has been " +
"removed from the routing table.")
for entry in delete_routes:
del self.routing_table[entry]
self.print_routing_table()
def timer(self, function, param=None):
'''Start a periodic timer which calls a specified function'''
if param != None:
function(list(param.values()))
period = BASE_TIMER * randrange(8, 12, 1) / 10
else:
period = BASE_TIMER
function()
threading.Timer(period, self.timer, [function, param]).start()
def start_timers(self):
'''Start the timers on separate threads'''
self.timer(self.update, param=self.routing_table)
self.timer(self.check_timeout)
self.timer(self.garbage_timer)
self.timer(self.garbage_collection)
def main_loop(self):
'''Start the main loop for the program.'''
while True:
self.execute()
# RUN THE PROGRAM
def print_message(message):
'''Print the given message with the current time before it'''
if DEBUG:
print("[" + time.strftime("%H:%M:%S") + "]: " + message)
def main():
'''Main function to run the program.'''
if __name__ == "__main__":
router = Router(str(sys.argv[-1]))
router.start_timers()
router.main_loop()
main()
| [
1,
14550,
30004,
13,
1678,
6991,
5219,
29901,
7835,
393,
10703,
263,
21398,
316,
314,
265,
2729,
373,
278,
6756,
13,
632,
390,
5690,
1873,
29871,
29906,
9608,
515,
390,
8610,
29906,
29946,
29945,
29941,
22993,
13,
1678,
6756,
13,
1678,
10783,
482,
29901,
3017,
29941,
390,
5561,
29889,
2272,
529,
15140,
29918,
2917,
29918,
1445,
3238,
13,
1678,
6756,
13,
1678,
20999,
3497,
29901,
30004,
13,
1678,
6756,
13,
4706,
450,
1404,
28075,
263,
12876,
5285,
934,
310,
278,
3402,
29901,
30004,
13,
4706,
6756,
13,
632,
518,
9585,
29962,
30004,
13,
632,
12876,
29899,
333,
353,
529,
15140,
29918,
4537,
3238,
13,
632,
1881,
29899,
4011,
353,
529,
2080,
29958,
518,
29892,
529,
2080,
10202,
2023,
29962,
30004,
13,
632,
14391,
353,
529,
4905,
29958,
29899,
29966,
16414,
29958,
29899,
29966,
23848,
29918,
15140,
3238,
13,
462,
462,
518,
29892,
529,
4905,
29958,
29899,
29966,
16414,
29958,
29899,
29966,
23848,
29918,
15140,
10202,
2023,
29962,
30004,
13,
632,
6756,
13,
632,
988,
11167,
13,
462,
12876,
29918,
4537,
29901,
3553,
310,
12876,
1546,
29871,
29896,
448,
29871,
29953,
29946,
29900,
29900,
29900,
22993,
13,
462,
1881,
29901,
2011,
1353,
1546,
29871,
29896,
29900,
29906,
29946,
448,
29871,
29953,
29946,
29900,
29900,
29900,
22993,
13,
462,
1962,
29901,
2011,
1353,
1546,
29871,
29896,
29900,
29906,
29946,
448,
29871,
29953,
29946,
29900,
29900,
29892,
6756,
13,
462,
308,
451,
5186,
304,
738,
10970,
22993,
13,
462,
12714,
29901,
12714,
310,
1962,
1546,
29871,
29896,
448,
29871,
29896,
29953,
22993,
13,
462,
12551,
29918,
15140,
29901,
3553,
310,
12551,
12876,
22993,
13,
462,
6756,
13,
1678,
12953,
29901,
30004,
13,
4706,
6756,
13,
4706,
910,
1824,
10703,
263,
6996,
390,
5690,
29894,
29906,
21398,
9608,
515,
390,
8610,
29906,
29946,
29945,
29941,
30004,
13,
4706,
363,
21398,
2912,
800,
297,
6601,
14379,
29889,
739,
4893,
263,
5285,
6756,
13,
4706,
934,
408,
4318,
2038,
322,
6166,
701,
263,
12876,
411,
263,
716,
9909,
363,
1269,
6756,
13,
4706,
1881,
29899,
637,
22993,
13,
4706,
6756,
13,
4706,
450,
390,
5690,
29894,
29906,
9608,
3913,
263,
21398,
1591,
304,
3013,
5702,
310,
599,
6159,
519,
30004,
13,
4706,
16053,
2153,
373,
278,
3564,
3412,
411,
1009,
12714,
29914,
18253,
322,
278,
1513,
30004,
13,
4706,
2446,
8171,
12876,
3553,
3412,
278,
5782,
304,
393,
12551,
12876,
29889,
2398,
29892,
6756,
13,
4706,
372,
508,
871,
3638,
7191,
304,
278,
1513,
22092,
2470,
6790,
297,
14391,
29889,
6756,
13,
4706,
450,
9608,
3913,
278,
10914,
1171,
29899,
29943,
536,
5418,
4608,
5687,
304,
10272,
30004,
13,
4706,
278,
19604,
3438,
5782,
304,
1269,
12876,
297,
278,
3564,
29889,
960,
278,
12714,
338,
30004,
13,
308,
29896,
29953,
470,
7621,
29892,
278,
12876,
338,
5545,
443,
276,
496,
519,
22993,
13,
4706,
6756,
13,
4706,
450,
21398,
1591,
12919,
8665,
411,
263,
2323,
5782,
6251,
313,
29934,
4330,
29897,
363,
30004,
13,
4706,
3528,
411,
263,
12714,
310,
5225,
29889,
450,
21398,
1591,
338,
3785,
1711,
6756,
13,
4706,
18750,
4430,
2086,
1269,
310,
967,
1513,
1962,
16169,
3025,
385,
443,
2929,
293,
1573,
6756,
13,
4706,
2933,
2643,
408,
3342,
297,
390,
8610,
29906,
29946,
29945,
29941,
4004,
29871,
29941,
29889,
29929,
29889,
29906,
322,
29871,
29946,
29889,
910,
338,
6756,
13,
4706,
8560,
373,
263,
5004,
3244,
577,
372,
947,
451,
1006,
29888,
406,
411,
916,
6756,
13,
4706,
6931,
30004,
13,
4706,
6756,
13,
4706,
450,
20586,
7191,
515,
916,
16053,
2153,
491,
773,
278,
3017,
1831,
580,
6756,
13,
4706,
740,
607,
10930,
2745,
263,
2643,
338,
7960,
304,
367,
1303,
29889,
9038,
263,
6756,
13,
4706,
2643,
338,
4520,
278,
4839,
322,
8118,
526,
2854,
630,
29889,
6756,
13,
4706,
960,
278,
2643,
338,
2854,
1269,
390,
4330,
338,
19356,
5034,
304,
390,
8610,
29906,
29946,
29945,
29941,
6756,
13,
4706,
4004,
29871,
29941,
29889,
29929,
29889,
29906,
29889,
6756,
13,
4706,
6756,
13,
9651,
960,
263,
716,
12876,
338,
1476,
278,
390,
4330,
338,
2715,
6756,
13,
9651,
304,
278,
21398,
1591,
29892,
4417,
278,
3438,
304,
278,
12714,
363,
278,
1962,
6756,
13,
9651,
278,
2643,
471,
4520,
373,
29889,
6756,
13,
9651,
6756,
13,
9651,
960,
278,
390,
4330,
2307,
4864,
29892,
541,
278,
12714,
338,
7968,
29892,
278,
12714,
30004,
13,
9651,
338,
4784,
304,
278,
5224,
12714,
22993,
13,
9651,
6756,
13,
9651,
960,
278,
5224,
12714,
338,
515,
263,
1422,
2446,
8171,
12876,
29892,
1735,
278,
30004,
13,
9651,
2446,
8171,
29889,
6756,
13,
9651,
6756,
13,
9651,
960,
3078,
756,
3939,
29892,
10715,
278,
11815,
12237,
29889,
6756,
13,
9651,
6756,
13,
9651,
960,
390,
4330,
12714,
6736,
4236,
12714,
310,
29871,
29896,
29953,
29892,
2791,
278,
6251,
363,
30004,
13,
9651,
25861,
4333,
322,
2767,
278,
12714,
297,
278,
1591,
29889,
6756,
13,
9651,
6756,
13,
4706,
960,
738,
1735,
756,
10761,
297,
278,
21398,
1591,
408,
263,
1121,
310,
263,
6756,
13,
4706,
4520,
2643,
29892,
263,
19799,
2767,
313,
29934,
8610,
29906,
29946,
29945,
29941,
4004,
29871,
29941,
29889,
29896,
29900,
29889,
29896,
29897,
338,
2665,
6756,
13,
4706,
304,
599,
14391,
411,
278,
4784,
9976,
29889,
1605,
3567,
287,
11217,
526,
2665,
411,
30004,
13,
4706,
263,
4036,
9055,
1546,
29871,
29896,
448,
29871,
29945,
6923,
304,
5557,
12231,
1891,
11217,
22993,
13,
4706,
6756,
13,
4706,
10729,
7191,
526,
451,
8762,
297,
445,
1824,
22993,
13,
4706,
6756,
13,
4706,
7870,
414,
313,
497,
5335,
414,
526,
373,
5004,
9717,
29897,
313,
29934,
8610,
29906,
29946,
29945,
29941,
4004,
29871,
29941,
29889,
29947,
1125,
30004,
13,
4706,
6756,
13,
9651,
10318,
12237,
448,
29498,
293,
443,
2929,
293,
1573,
2933,
2643,
2665,
304,
599,
30004,
13,
18884,
14391,
29889,
450,
3785,
338,
10365,
287,
1269,
931,
304,
263,
4036,
995,
6756,
13,
18884,
1546,
29871,
29900,
29889,
29947,
334,
350,
8127,
29918,
29911,
7833,
1001,
322,
29871,
29896,
29889,
29906,
334,
350,
8127,
29918,
29911,
7833,
1001,
304,
5557,
6756,
13,
18884,
12231,
1891,
11217,
29889,
6756,
13,
9651,
6756,
13,
9651,
5974,
449,
448,
1304,
304,
1423,
278,
21398,
1591,
363,
390,
4330,
29879,
607,
505,
30004,
13,
18884,
505,
451,
1063,
4784,
2629,
278,
390,
12015,
29923,
29918,
15307,
12015,
7292,
29889,
960,
30004,
13,
18884,
263,
12876,
756,
451,
1063,
6091,
515,
2629,
445,
931,
29892,
769,
731,
278,
30004,
13,
18884,
12714,
304,
278,
4236,
12714,
310,
29871,
29896,
29953,
322,
1369,
278,
25861,
4333,
30004,
13,
18884,
12237,
22993,
13,
18884,
6756,
13,
9651,
7455,
17807,
12237,
448,
1304,
304,
1423,
278,
21398,
1591,
363,
390,
4330,
29879,
731,
6756,
13,
18884,
363,
25861,
4333,
29889,
960,
278,
11815,
6736,
5012,
18476,
29918,
15307,
12015,
29892,
6756,
13,
18884,
2791,
278,
390,
4330,
363,
7374,
291,
22993,
13,
9651,
6756,
13,
9651,
7455,
17807,
14348,
448,
1304,
304,
1423,
278,
21398,
1591,
363,
390,
4330,
29879,
6756,
13,
18884,
10902,
363,
7374,
291,
29892,
322,
25388,
1906,
9976,
515,
278,
1591,
29889,
6756,
13,
18884,
6756,
13,
12008,
30004,
13,
5215,
2295,
16680,
30004,
13,
5215,
1831,
30004,
13,
5215,
9909,
30004,
13,
5215,
10876,
30004,
13,
5215,
931,
30004,
13,
5215,
3244,
292,
30004,
13,
5215,
2281,
30004,
13,
5215,
12865,
30004,
13,
3166,
4036,
1053,
20088,
524,
29892,
20088,
3881,
30004,
13,
30004,
13,
18525,
353,
7700,
30004,
13,
30004,
13,
20832,
353,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29915,
29871,
396,
15683,
30004,
13,
25416,
29918,
29911,
7833,
1001,
353,
29871,
29945,
30004,
13,
12648,
29918,
2303,
5659,
2965,
353,
29871,
29896,
29953,
30004,
13,
1672,
26027,
29918,
15307,
12015,
353,
350,
8127,
29918,
29911,
7833,
1001,
334,
29871,
29953,
30004,
13,
2287,
18476,
29918,
15307,
12015,
353,
350,
8127,
29918,
29911,
7833,
1001,
334,
29871,
29946,
30004,
13,
30004,
13,
5098,
29918,
1177,
2544,
353,
29871,
29906,
30004,
13,
30004,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
29922,
30004,
13,
29937,
10014,
2190,
29903,
22122,
29903,
30004,
13,
30004,
13,
30004,
13,
1990,
4103,
391,
291,
7295,
30004,
13,
30004,
13,
1678,
14550,
2385,
16314,
292,
263,
9558,
1546,
5922,
29889,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
304,
29918,
3859,
1125,
30004,
13,
4706,
1583,
29889,
517,
29918,
3859,
353,
304,
29918,
3859,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
6558,
278,
9558,
3168,
12008,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
30004,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
29922,
30004,
13,
29937,
6850,
1299,
2890,
30004,
13,
30004,
13,
30004,
13,
1990,
4306,
7295,
30004,
13,
30004,
13,
1678,
14550,
2385,
16314,
292,
263,
10035,
2106,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
285,
3844,
1125,
30004,
13,
4706,
1583,
29889,
29888,
3844,
353,
285,
3844,
30004,
13,
30004,
13,
1678,
822,
3896,
29898,
1311,
1125,
30004,
13,
4706,
14550,
12296,
3168,
363,
18055,
263,
2106,
12008,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
12296,
3168,
1550,
297,
2106,
12008,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
1678,
822,
6876,
29898,
1311,
1125,
30004,
13,
4706,
14550,
12296,
3168,
363,
10124,
263,
2106,
12008,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
30004,
13,
1990,
7370,
3373,
29898,
2792,
1125,
30004,
13,
30004,
13,
1678,
14550,
2385,
16314,
292,
278,
7370,
701,
2106,
607,
13623,
278,
5285,
934,
30004,
13,
1678,
14550,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
285,
3844,
1125,
30004,
13,
4706,
2428,
29898,
4763,
3373,
29892,
1583,
467,
1649,
2344,
12035,
29888,
3844,
8443,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
12296,
278,
5285,
3168,
12008,
30004,
13,
30004,
13,
4706,
1596,
29918,
4906,
703,
23456,
20999,
3497,
29901,
18793,
30004,
13,
462,
418,
718,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
2917,
29918,
1445,
718,
13577,
1159,
30004,
13,
30004,
13,
4706,
2295,
353,
2295,
16680,
29889,
3991,
11726,
26471,
13,
4706,
2295,
29889,
949,
29898,
1311,
29889,
29888,
3844,
29889,
15140,
29889,
2917,
29918,
1445,
8443,
13,
30004,
13,
4706,
1583,
29889,
657,
29918,
15140,
29918,
333,
29898,
2917,
8443,
13,
4706,
1583,
29889,
14669,
29918,
2080,
29879,
29898,
2917,
8443,
13,
4706,
1583,
29889,
657,
29918,
4905,
29879,
29898,
2917,
8443,
13,
30004,
13,
4706,
1583,
29889,
14669,
29918,
14608,
292,
29918,
2371,
26471,
13,
4706,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
2158,
29918,
14608,
292,
29918,
2371,
26471,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
517,
29918,
20543,
703,
517,
15716,
292,
1159,
30004,
13,
30004,
13,
1678,
822,
6876,
29898,
1311,
1125,
30004,
13,
4706,
14550,
11816,
4866,
2643,
12008,
30004,
13,
30004,
13,
4706,
1596,
29918,
4906,
703,
23971,
3789,
786,
25034,
23157,
30004,
13,
30004,
13,
1678,
822,
679,
29918,
15140,
29918,
333,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
14550,
6359,
278,
12876,
1178,
1353,
515,
278,
5285,
934,
12008,
30004,
13,
30004,
13,
4706,
565,
29871,
29896,
5277,
938,
29898,
2917,
1839,
9585,
16215,
15140,
29899,
333,
11287,
5277,
29871,
29953,
29946,
29900,
29900,
29900,
29901,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
333,
2033,
353,
320,
30004,
13,
18884,
938,
29898,
2917,
1839,
9585,
16215,
15140,
29899,
333,
2033,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
8960,
877,
13919,
390,
5561,
3553,
9681,
1495,
30004,
13,
30004,
13,
1678,
822,
679,
29918,
4905,
29879,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
14550,
11609,
263,
8600,
310,
14391,
6943,
2011,
29892,
3438,
322,
12551,
30004,
13,
4706,
12876,
1178,
515,
278,
20999,
934,
12008,
30004,
13,
30004,
13,
4706,
14391,
353,
2295,
1839,
9585,
16215,
4905,
29879,
13359,
5451,
29317,
525,
8443,
13,
4706,
14391,
353,
518,
29875,
29889,
5451,
877,
29899,
1495,
363,
474,
297,
14391,
29962,
30004,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
4905,
29879,
2033,
353,
6571,
30004,
13,
4706,
5923,
29918,
4011,
353,
5159,
30004,
13,
30004,
13,
4706,
363,
1962,
297,
14391,
29901,
30004,
13,
9651,
338,
29918,
3084,
29918,
637,
353,
29871,
29896,
29900,
29906,
29946,
5277,
938,
29898,
4905,
29961,
29900,
2314,
5277,
29871,
29953,
29946,
29900,
29900,
29900,
322,
451,
320,
30004,
13,
18884,
938,
29898,
4905,
29961,
29900,
2314,
297,
5923,
29918,
4011,
30004,
13,
30004,
13,
9651,
338,
29918,
3084,
29918,
18253,
353,
29871,
29896,
5277,
938,
29898,
4905,
29961,
29896,
2314,
529,
29871,
29896,
29953,
30004,
13,
9651,
338,
29918,
3084,
29918,
333,
353,
29871,
29896,
5277,
938,
29898,
4905,
29961,
29906,
2314,
5277,
29871,
29953,
29946,
29900,
29900,
29900,
30004,
13,
9651,
565,
338,
29918,
3084,
29918,
637,
322,
338,
29918,
3084,
29918,
18253,
322,
338,
29918,
3084,
29918,
333,
29901,
30004,
13,
18884,
5923,
29918,
4011,
29889,
4397,
29898,
524,
29898,
4905,
29961,
29900,
12622,
30004,
13,
18884,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
4905,
29879,
2033,
29961,
524,
29898,
4905,
29961,
29906,
2314,
29962,
353,
320,
30004,
13,
462,
1678,
11117,
16414,
2396,
938,
29898,
4905,
29961,
29896,
11724,
30004,
13,
462,
268,
525,
637,
2396,
938,
29898,
4905,
29961,
29900,
2314,
8117,
13,
9651,
1683,
29901,
30004,
13,
18884,
12020,
8960,
877,
13919,
10604,
29879,
1495,
30004,
13,
30004,
13,
1678,
822,
6230,
29918,
2080,
29879,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
14550,
4391,
1881,
577,
9737,
515,
278,
10970,
6790,
297,
278,
2295,
934,
12008,
30004,
13,
30004,
13,
4706,
396,
679,
10970,
515,
5285,
934,
30004,
13,
4706,
16169,
353,
2295,
1839,
9585,
16215,
2080,
29899,
4011,
13359,
5451,
29317,
525,
8443,
13,
30004,
13,
4706,
10970,
353,
5159,
30004,
13,
4706,
363,
2011,
297,
16169,
29901,
30004,
13,
9651,
565,
29871,
29896,
29900,
29906,
29946,
5277,
938,
29898,
637,
29897,
5277,
29871,
29953,
29946,
29900,
29900,
29900,
322,
451,
938,
29898,
637,
29897,
297,
10970,
29901,
30004,
13,
18884,
10970,
29889,
4397,
29898,
524,
29898,
637,
876,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
12020,
8960,
877,
13919,
3371,
9681,
1495,
30004,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
2080,
29879,
2033,
353,
6571,
30004,
13,
4706,
396,
1653,
9909,
363,
1269,
1881,
2011,
30004,
13,
4706,
363,
2011,
297,
10970,
29901,
30004,
13,
9651,
1018,
29901,
30004,
13,
18884,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
2080,
29879,
2033,
29961,
637,
29962,
353,
320,
30004,
13,
462,
1678,
9909,
29889,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
29928,
29954,
25058,
8443,
13,
18884,
1596,
29918,
4906,
877,
11373,
525,
718,
851,
29898,
637,
29897,
718,
525,
6760,
630,
29889,
1495,
30004,
13,
9651,
5174,
9909,
29889,
2704,
408,
10191,
29901,
30004,
13,
18884,
1596,
877,
17776,
304,
1653,
9909,
29889,
7777,
29901,
525,
718,
851,
29898,
7645,
876,
30004,
13,
18884,
10876,
29889,
13322,
26471,
13,
30004,
13,
9651,
396,
7868,
2011,
304,
9909,
30004,
13,
9651,
1018,
29901,
30004,
13,
18884,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
2080,
29879,
2033,
29961,
637,
1822,
5355,
29898,
30004,
13,
462,
1678,
313,
20832,
29892,
2011,
876,
30004,
13,
30004,
13,
18884,
1596,
29918,
4906,
877,
11373,
525,
718,
851,
29898,
637,
29897,
718,
525,
29672,
25034,
29889,
1495,
30004,
13,
9651,
5174,
9909,
29889,
2704,
408,
10191,
29901,
30004,
13,
18884,
1596,
877,
17776,
304,
1653,
9909,
29889,
7777,
525,
718,
851,
29898,
7645,
876,
30004,
13,
18884,
10876,
29889,
13322,
26471,
13,
30004,
13,
1678,
822,
6230,
29918,
14608,
292,
29918,
2371,
29898,
1311,
1125,
30004,
13,
4706,
14550,
26947,
21398,
1591,
411,
278,
14391,
6790,
297,
278,
2295,
934,
12008,
30004,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
14608,
292,
29918,
2371,
29961,
1311,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
333,
2033,
29962,
353,
320,
30004,
13,
9651,
390,
5690,
12085,
9634,
29898,
7328,
29922,
1311,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
333,
7464,
30004,
13,
462,
3986,
452,
29916,
386,
459,
29922,
29900,
11167,
13,
462,
3986,
12714,
29922,
29900,
11167,
13,
462,
3986,
19673,
29922,
5574,
8443,
13,
30004,
13,
30004,
13,
1990,
20340,
292,
29898,
2792,
1125,
30004,
13,
30004,
13,
1678,
14550,
30004,
13,
4706,
4134,
15783,
278,
10534,
2106,
310,
278,
383,
17061,
988,
278,
12876,
11324,
1169,
30004,
13,
4706,
363,
7191,
304,
367,
4520,
373,
967,
1881,
577,
9737,
29889,
1932,
263,
2643,
338,
30004,
13,
4706,
4520,
278,
2106,
3620,
304,
278,
7523,
6816,
465,
482,
2106,
22993,
13,
1678,
14550,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
285,
3844,
1125,
30004,
13,
4706,
2428,
29898,
15716,
292,
29892,
1583,
467,
1649,
2344,
12035,
29888,
3844,
8443,
13,
30004,
13,
1678,
822,
3896,
29898,
1311,
1125,
30004,
13,
4706,
14550,
9323,
4306,
6251,
2643,
12008,
30004,
13,
4706,
1596,
29918,
4906,
703,
10399,
292,
28132,
2106,
856,
1159,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
29956,
29874,
1169,
363,
1881,
577,
9737,
304,
367,
19909,
322,
769,
3620,
278,
2106,
30004,
13,
4706,
304,
1889,
278,
4520,
2643,
29889,
12008,
30004,
13,
30004,
13,
4706,
19909,
353,
1831,
29889,
2622,
29898,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
2080,
29879,
13359,
5975,
3285,
19997,
518,
2314,
30004,
13,
30004,
13,
4706,
565,
19909,
29961,
29900,
5387,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
949,
519,
29918,
4011,
353,
19909,
29961,
29900,
29962,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
517,
29918,
20543,
703,
517,
6359,
3728,
1159,
30004,
13,
30004,
13,
1678,
822,
6876,
29898,
1311,
1125,
30004,
13,
4706,
14550,
9323,
4306,
6876,
2643,
12008,
30004,
13,
4706,
1596,
29918,
4906,
703,
3728,
24328,
2347,
1159,
30004,
13,
30004,
13,
30004,
13,
1990,
7523,
3728,
29898,
2792,
1125,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
278,
2106,
363,
5183,
7191,
4520,
373,
278,
1881,
30004,
13,
1678,
577,
9737,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
285,
3844,
1125,
30004,
13,
4706,
2428,
29898,
6359,
3728,
29892,
1583,
467,
1649,
2344,
12035,
29888,
3844,
8443,
13,
30004,
13,
1678,
822,
3896,
29898,
1311,
1125,
30004,
13,
4706,
1596,
29918,
4906,
703,
6359,
292,
11946,
1179,
856,
1159,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
30004,
13,
4706,
363,
2011,
297,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
949,
519,
29918,
4011,
29901,
30004,
13,
30004,
13,
9651,
18203,
353,
390,
5690,
16638,
300,
29898,
637,
29889,
3757,
29894,
3166,
29898,
29896,
29900,
29906,
29946,
9601,
29900,
2314,
30004,
13,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
5504,
29918,
14608,
292,
29918,
2371,
29898,
4058,
300,
8443,
13,
30004,
13,
4706,
565,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
13134,
29918,
3167,
29901,
30004,
13,
9651,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
21001,
29918,
5504,
26471,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
2158,
29918,
14608,
292,
29918,
2371,
26471,
13,
4706,
1583,
29889,
29888,
3844,
29889,
517,
29918,
20543,
703,
517,
15716,
292,
1159,
30004,
13,
30004,
13,
1678,
822,
6876,
29898,
1311,
1125,
30004,
13,
4706,
1596,
29918,
4906,
703,
25510,
7523,
23157,
30004,
13,
30004,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
29922,
30004,
13,
29937,
383,
1177,
9094,
6850,
3040,
26750,
29950,
8895,
30004,
13,
30004,
13,
30004,
13,
1990,
390,
5561,
9998,
29924,
7295,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
278,
390,
5561,
8093,
2106,
4933,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
18290,
29918,
15140,
1125,
30004,
13,
4706,
1583,
29889,
15140,
353,
18290,
29918,
15140,
30004,
13,
4706,
1583,
29889,
28631,
353,
6571,
30004,
13,
4706,
1583,
29889,
3286,
2187,
353,
6571,
30004,
13,
4706,
1583,
29889,
2764,
29918,
3859,
353,
6213,
30004,
13,
4706,
1583,
29889,
3286,
353,
6213,
30004,
13,
30004,
13,
1678,
822,
788,
29918,
3286,
391,
291,
29898,
1311,
29892,
1301,
29918,
978,
29892,
9558,
1125,
30004,
13,
4706,
14550,
2528,
263,
716,
9558,
304,
278,
383,
17061,
12008,
30004,
13,
4706,
1583,
29889,
3286,
2187,
29961,
3286,
29918,
978,
29962,
353,
9558,
30004,
13,
30004,
13,
1678,
822,
788,
29918,
3859,
29898,
1311,
29892,
2106,
29918,
978,
29892,
2106,
1125,
30004,
13,
4706,
14550,
2528,
263,
716,
2106,
304,
278,
383,
17061,
12008,
30004,
13,
4706,
1583,
29889,
28631,
29961,
3859,
29918,
978,
29962,
353,
2106,
30004,
13,
30004,
13,
1678,
822,
731,
29918,
3859,
29898,
1311,
29892,
2106,
29918,
978,
1125,
30004,
13,
4706,
14550,
2697,
278,
1857,
2106,
310,
278,
383,
17061,
12008,
30004,
13,
4706,
1583,
29889,
2764,
29918,
3859,
353,
1583,
29889,
28631,
29961,
3859,
29918,
978,
29962,
30004,
13,
30004,
13,
1678,
822,
304,
29918,
20543,
29898,
1311,
29892,
304,
29918,
3286,
1125,
30004,
13,
4706,
14550,
2697,
278,
1857,
9558,
310,
278,
383,
17061,
12008,
30004,
13,
4706,
1583,
29889,
3286,
353,
1583,
29889,
3286,
2187,
29961,
517,
29918,
3286,
29962,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
6558,
278,
383,
17061,
12008,
30004,
13,
30004,
13,
4706,
565,
1583,
29889,
3286,
29901,
30004,
13,
9651,
1583,
29889,
2764,
29918,
3859,
29889,
13322,
26471,
13,
9651,
1583,
29889,
3286,
29889,
7978,
26471,
13,
9651,
1583,
29889,
842,
29918,
3859,
29898,
1311,
29889,
3286,
29889,
517,
29918,
3859,
8443,
13,
9651,
1583,
29889,
2764,
29918,
3859,
29889,
5893,
26471,
13,
9651,
1583,
29889,
3286,
353,
6213,
30004,
13,
4706,
1583,
29889,
2764,
29918,
3859,
29889,
7978,
26471,
13,
30004,
13,
30004,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
29922,
30004,
13,
29937,
306,
3580,
1307,
13780,
8098,
30004,
13,
30004,
13,
1990,
390,
5690,
16638,
300,
29901,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
263,
390,
5690,
18203,
6943,
263,
4839,
322,
3573,
408,
3342,
30004,
13,
1678,
297,
390,
8610,
29906,
29946,
29945,
29941,
390,
5690,
29894,
29906,
4004,
29871,
29946,
29889,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
848,
29922,
8516,
29892,
4839,
29922,
8516,
29892,
364,
2167,
29922,
8516,
1125,
30004,
13,
30004,
13,
4706,
565,
848,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
11618,
29898,
1272,
8443,
13,
30004,
13,
4706,
25342,
4839,
322,
364,
2167,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
3069,
29898,
6672,
29892,
364,
2167,
8443,
13,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
7865,
2392,
30004,
13,
30004,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
30004,
13,
4706,
736,
376,
3960,
29925,
16638,
300,
29901,
10516,
24335,
1798,
29889,
24335,
1353,
310,
390,
4330,
29879,
6571,
1213,
29889,
320,
30004,
13,
9651,
3402,
29898,
1311,
29889,
6672,
29889,
9006,
29892,
1583,
29889,
6672,
29889,
369,
29892,
7431,
29898,
1311,
29889,
29878,
2167,
876,
30004,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
11618,
29898,
1311,
29892,
848,
1125,
30004,
13,
4706,
14550,
6644,
363,
390,
5690,
16638,
300,
565,
848,
338,
515,
278,
3564,
12008,
30004,
13,
30004,
13,
4706,
396,
18744,
300,
15758,
362,
30004,
13,
4706,
1418,
10066,
353,
7431,
29898,
1272,
8443,
13,
4706,
565,
1418,
10066,
529,
390,
5690,
7850,
29889,
14226,
29901,
30004,
13,
9651,
12020,
19191,
2451,
30004,
13,
30004,
13,
4706,
4439,
15628,
29918,
29878,
2167,
353,
313,
29881,
2075,
264,
448,
390,
5690,
7850,
29889,
14226,
29897,
1273,
390,
5690,
12085,
9634,
29889,
14226,
30004,
13,
30004,
13,
4706,
565,
4439,
15628,
29918,
29878,
2167,
29901,
30004,
13,
9651,
12020,
19191,
2451,
30004,
13,
30004,
13,
4706,
396,
14806,
6262,
297,
18203,
304,
4839,
322,
390,
4330,
848,
30004,
13,
4706,
954,
29918,
29878,
2167,
353,
938,
3552,
29881,
2075,
264,
448,
390,
5690,
7850,
29889,
14226,
29897,
847,
390,
5690,
12085,
9634,
29889,
14226,
8443,
13,
30004,
13,
4706,
1583,
29889,
6672,
353,
390,
5690,
7850,
29898,
1272,
29961,
29900,
29901,
3960,
29925,
7850,
29889,
14226,
2314,
30004,
13,
30004,
13,
4706,
1583,
29889,
29878,
2167,
353,
5159,
30004,
13,
30004,
13,
4706,
364,
371,
29918,
2962,
353,
390,
5690,
7850,
29889,
14226,
30004,
13,
4706,
364,
371,
29918,
355,
353,
390,
5690,
7850,
29889,
14226,
718,
390,
5690,
12085,
9634,
29889,
14226,
30004,
13,
30004,
13,
4706,
396,
21493,
975,
848,
18203,
304,
4017,
1269,
390,
4330,
30004,
13,
4706,
363,
474,
297,
3464,
29898,
1949,
29918,
29878,
2167,
1125,
30004,
13,
9651,
1583,
29889,
29878,
2167,
29889,
4397,
29898,
3960,
10593,
2663,
9634,
29898,
1610,
1272,
29922,
1272,
29961,
29878,
371,
29918,
2962,
29901,
29878,
371,
29918,
355,
1402,
30004,
13,
462,
462,
965,
4765,
29918,
333,
29922,
1311,
29889,
6672,
29889,
4351,
876,
30004,
13,
30004,
13,
9651,
364,
371,
29918,
2962,
4619,
390,
5690,
12085,
9634,
29889,
14226,
30004,
13,
9651,
364,
371,
29918,
355,
4619,
390,
5690,
12085,
9634,
29889,
14226,
30004,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
3069,
29898,
1311,
29892,
4839,
29892,
364,
2167,
1125,
30004,
13,
4706,
14550,
6644,
363,
19673,
848,
12008,
30004,
13,
30004,
13,
4706,
565,
4839,
29889,
369,
2804,
29871,
29906,
29901,
30004,
13,
9651,
12020,
7865,
2392,
703,
11730,
10079,
29871,
29906,
338,
6969,
23157,
30004,
13,
4706,
1583,
29889,
6672,
353,
4839,
30004,
13,
4706,
1583,
29889,
29878,
2167,
353,
364,
2167,
30004,
13,
30004,
13,
1678,
822,
28755,
29898,
1311,
1125,
30004,
13,
4706,
14550,
11609,
278,
7023,
380,
292,
15783,
445,
18203,
363,
3564,
30004,
13,
4706,
22713,
12008,
30004,
13,
30004,
13,
4706,
4870,
287,
353,
1583,
29889,
6672,
29889,
643,
6646,
26471,
13,
30004,
13,
4706,
363,
364,
371,
297,
1583,
29889,
29878,
2167,
29901,
30004,
13,
9651,
4870,
287,
4619,
364,
371,
29889,
643,
6646,
26471,
13,
30004,
13,
4706,
736,
4870,
287,
30004,
13,
30004,
13,
30004,
13,
1990,
390,
5690,
7850,
29901,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
278,
4839,
310,
263,
390,
5690,
18203,
12008,
30004,
13,
30004,
13,
1678,
383,
12054,
1299,
353,
376,
29991,
14388,
29950,
19451,
13,
1678,
22717,
10721,
353,
2281,
29889,
28667,
2311,
29898,
19094,
1299,
8443,
13,
1678,
323,
6959,
29918,
1525,
5550,
1164,
1660,
353,
29871,
29906,
30004,
13,
1678,
478,
1001,
13381,
353,
29871,
29906,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10650,
1272,
29922,
8516,
29892,
12876,
29918,
333,
29922,
8516,
1125,
30004,
13,
30004,
13,
4706,
1583,
29889,
4058,
287,
353,
6213,
30004,
13,
30004,
13,
4706,
565,
10650,
1272,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
11618,
29898,
1610,
1272,
8443,
13,
4706,
25342,
12876,
29918,
333,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
3069,
29898,
15140,
29918,
333,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
7865,
2392,
30004,
13,
30004,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
30004,
13,
4706,
736,
376,
3960,
29925,
19345,
313,
9006,
353,
24335,
1147,
353,
24335,
4765,
353,
426,
1800,
1642,
4830,
29898,
1311,
29889,
9006,
11167,
13,
462,
462,
462,
462,
29871,
1583,
29889,
369,
11167,
13,
462,
462,
462,
462,
29871,
1583,
29889,
4351,
8443,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
11618,
29898,
1311,
29892,
10650,
1272,
1125,
30004,
13,
4706,
14550,
2344,
363,
848,
515,
3564,
12008,
30004,
13,
4706,
4839,
353,
2281,
29889,
348,
4058,
29898,
1311,
29889,
19094,
1299,
29892,
10650,
1272,
8443,
13,
30004,
13,
4706,
1583,
29889,
9006,
353,
4839,
29961,
29900,
29962,
30004,
13,
4706,
1583,
29889,
369,
353,
4839,
29961,
29896,
29962,
30004,
13,
4706,
1583,
29889,
4351,
353,
4839,
29961,
29906,
29962,
30004,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
3069,
29898,
1311,
29892,
12876,
29918,
333,
1125,
30004,
13,
4706,
14550,
6644,
363,
848,
515,
3495,
12008,
30004,
13,
4706,
1583,
29889,
9006,
353,
1583,
29889,
11116,
29918,
1525,
5550,
1164,
1660,
30004,
13,
4706,
1583,
29889,
369,
353,
1583,
29889,
16358,
30004,
13,
4706,
1583,
29889,
4351,
353,
12876,
29918,
333,
30004,
13,
30004,
13,
1678,
822,
28755,
29898,
1311,
1125,
30004,
13,
4706,
14550,
11609,
278,
7023,
380,
292,
15783,
445,
4839,
363,
3564,
30004,
13,
4706,
22713,
12008,
30004,
13,
4706,
736,
2281,
29889,
4058,
29898,
1311,
29889,
19094,
1299,
29892,
1583,
29889,
9006,
29892,
1583,
29889,
369,
29892,
1583,
29889,
4351,
8443,
13,
30004,
13,
30004,
13,
1990,
390,
5690,
12085,
9634,
29901,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
263,
2323,
390,
5690,
5782,
6251,
313,
29934,
4330,
29897,
12008,
30004,
13,
30004,
13,
1678,
383,
12054,
1299,
353,
376,
29991,
27590,
5287,
19451,
13,
1678,
22717,
10721,
353,
2281,
29889,
28667,
2311,
29898,
19094,
1299,
8443,
13,
1678,
341,
1177,
29918,
2303,
5659,
2965,
353,
29871,
29900,
30004,
13,
1678,
18134,
29918,
2303,
5659,
2965,
353,
29871,
29896,
29953,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10650,
1272,
29922,
8516,
29892,
4765,
29918,
333,
29922,
8516,
29892,
3211,
29922,
8516,
11167,
13,
462,
452,
29916,
386,
459,
29922,
8516,
29892,
12714,
29922,
8516,
29892,
19673,
29922,
8824,
1125,
30004,
13,
30004,
13,
4706,
1583,
29889,
15033,
353,
7700,
30004,
13,
4706,
1583,
29889,
5215,
287,
353,
19673,
30004,
13,
4706,
1583,
29889,
2344,
29918,
15619,
26471,
13,
30004,
13,
4706,
565,
10650,
1272,
322,
4765,
29918,
333,
2804,
6213,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
11618,
29898,
1610,
1272,
29892,
4765,
29918,
333,
8443,
13,
4706,
25342,
3211,
322,
452,
29916,
386,
459,
2804,
6213,
322,
12714,
2804,
6213,
29901,
30004,
13,
9651,
1583,
3032,
2344,
29918,
3166,
29918,
3069,
29898,
7328,
29892,
452,
29916,
386,
459,
29892,
12714,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
7865,
2392,
30004,
13,
30004,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
30004,
13,
4706,
4472,
353,
376,
29989,
25641,
29985,
29896,
29896,
11079,
25641,
29985,
29896,
29900,
11079,
25641,
29985,
29896,
29896,
11079,
25641,
29985,
29896,
29945,
11079,
25641,
29985,
29896,
29900,
11079,
25641,
29985,
29896,
29941,
11079,
19451,
13,
30004,
13,
4706,
396,
5399,
393,
11815,
338,
731,
30004,
13,
4706,
565,
1583,
29889,
15619,
1275,
6213,
29901,
30004,
13,
9651,
736,
4472,
29889,
4830,
29898,
1311,
29889,
10030,
29892,
1583,
29889,
16414,
29892,
1583,
29889,
13996,
386,
459,
11167,
13,
462,
462,
259,
1583,
29889,
15033,
29892,
1583,
29889,
5397,
17807,
11167,
13,
462,
462,
259,
851,
29898,
1311,
29889,
15619,
876,
30004,
13,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
11815,
353,
313,
12673,
29889,
12673,
29889,
3707,
580,
448,
1583,
29889,
15619,
467,
7827,
29918,
23128,
26471,
13,
9651,
736,
4472,
29889,
4830,
29898,
1311,
29889,
10030,
29892,
1583,
29889,
16414,
29892,
1583,
29889,
13996,
386,
459,
11167,
13,
462,
462,
259,
1583,
29889,
15033,
29892,
1583,
29889,
5397,
17807,
11167,
13,
462,
462,
259,
4513,
29898,
15619,
29892,
29871,
29896,
876,
30004,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
3069,
29898,
1311,
29892,
3211,
29892,
452,
29916,
386,
459,
29892,
12714,
1125,
30004,
13,
4706,
14550,
6644,
363,
848,
515,
3495,
12008,
30004,
13,
4706,
1583,
29889,
2142,
29875,
353,
23844,
29918,
1177,
2544,
30004,
13,
4706,
1583,
29889,
4039,
353,
29871,
29900,
29871,
396,
451,
1304,
30004,
13,
4706,
1583,
29889,
10030,
353,
3211,
30004,
13,
4706,
1583,
29889,
13996,
386,
459,
353,
452,
29916,
386,
459,
30004,
13,
4706,
1583,
29889,
16414,
353,
12714,
30004,
13,
30004,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
11618,
29898,
1311,
29892,
10650,
1272,
29892,
4765,
29918,
333,
1125,
30004,
13,
4706,
14550,
6644,
363,
848,
4520,
515,
3564,
12008,
30004,
13,
4706,
364,
371,
353,
2281,
29889,
348,
4058,
29898,
1311,
29889,
19094,
1299,
29892,
10650,
1272,
8443,
13,
30004,
13,
4706,
1583,
29889,
2142,
29875,
353,
364,
371,
29961,
29900,
29962,
30004,
13,
4706,
1583,
29889,
4039,
353,
364,
371,
29961,
29896,
29962,
30004,
13,
4706,
1583,
29889,
10030,
353,
364,
371,
29961,
29906,
29962,
30004,
13,
4706,
1583,
29889,
842,
29918,
13996,
386,
459,
29898,
29878,
371,
29961,
29941,
2314,
30004,
13,
4706,
1583,
29889,
16414,
353,
364,
371,
29961,
29946,
29962,
30004,
13,
30004,
13,
4706,
565,
1583,
29889,
13996,
386,
459,
1275,
29871,
29900,
29901,
30004,
13,
9651,
1583,
29889,
13996,
386,
459,
353,
4765,
29918,
333,
30004,
13,
30004,
13,
4706,
396,
15758,
362,
30004,
13,
4706,
565,
451,
1583,
29889,
16173,
29918,
2303,
5659,
2965,
5277,
1583,
29889,
16414,
5277,
1583,
29889,
12648,
29918,
2303,
5659,
2965,
29901,
30004,
13,
9651,
12020,
19191,
2451,
30004,
13,
30004,
13,
1678,
822,
2069,
29918,
15619,
29898,
1311,
1125,
30004,
13,
4706,
14550,
6644,
6646,
278,
11815,
2875,
12008,
30004,
13,
30004,
13,
4706,
565,
1583,
29889,
5215,
287,
29901,
30004,
13,
9651,
1583,
29889,
15619,
353,
6213,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
1583,
29889,
15619,
353,
12865,
29889,
12673,
29889,
3707,
26471,
13,
30004,
13,
4706,
1583,
29889,
5397,
17807,
353,
7700,
30004,
13,
4706,
1583,
29889,
3502,
287,
29918,
1454,
29918,
311,
1464,
353,
7700,
30004,
13,
30004,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
30004,
13,
30004,
13,
4706,
565,
1583,
29889,
2142,
29875,
1275,
916,
29889,
2142,
29875,
322,
320,
30004,
13,
965,
1583,
29889,
10030,
1275,
916,
29889,
10030,
322,
320,
30004,
13,
965,
1583,
29889,
4039,
1275,
916,
29889,
4039,
322,
320,
30004,
13,
965,
1583,
29889,
13996,
386,
459,
1275,
916,
29889,
13996,
386,
459,
322,
320,
30004,
13,
965,
1583,
29889,
16414,
1275,
916,
29889,
16414,
29901,
30004,
13,
9651,
736,
5852,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
7700,
30004,
13,
30004,
13,
1678,
822,
731,
29918,
13996,
386,
459,
29898,
1311,
29892,
452,
29916,
386,
459,
1125,
30004,
13,
4706,
14550,
2697,
278,
452,
29916,
386,
459,
2875,
12008,
30004,
13,
4706,
1583,
29889,
13996,
386,
459,
353,
452,
29916,
386,
459,
30004,
13,
30004,
13,
1678,
822,
28755,
29898,
1311,
1125,
30004,
13,
4706,
14550,
16638,
9976,
964,
15662,
390,
5690,
29894,
29906,
18203,
3402,
363,
9348,
975,
278,
30004,
13,
4706,
3564,
29889,
14550,
30004,
13,
4706,
736,
2281,
29889,
4058,
29898,
1311,
29889,
19094,
1299,
29892,
1583,
29889,
2142,
29875,
29892,
1583,
29889,
4039,
29892,
1583,
29889,
10030,
11167,
13,
462,
965,
1583,
29889,
13996,
386,
459,
29892,
1583,
29889,
16414,
8443,
13,
30004,
13,
30004,
13,
1990,
19191,
2451,
29898,
2451,
1125,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
278,
19191,
8960,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2643,
13776,
1125,
30004,
13,
4706,
1583,
29889,
4906,
353,
2643,
30004,
13,
30004,
13,
30004,
13,
1990,
390,
5561,
29901,
30004,
13,
30004,
13,
1678,
14550,
2385,
15783,
263,
2323,
12876,
12008,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2295,
29918,
1445,
1125,
30004,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
353,
390,
5561,
9998,
29924,
29898,
1311,
8443,
13,
4706,
1583,
29889,
2917,
29918,
1445,
353,
2295,
29918,
1445,
30004,
13,
30004,
13,
4706,
396,
13343,
310,
12876,
6055,
29892,
3704,
12876,
29899,
333,
29892,
10970,
322,
30004,
13,
4706,
396,
14391,
30004,
13,
4706,
1583,
29889,
15140,
29918,
11027,
353,
6571,
30004,
13,
4706,
1583,
29889,
949,
519,
29918,
4011,
353,
5159,
30004,
13,
30004,
13,
4706,
396,
13343,
310,
21398,
1591,
30004,
13,
4706,
1583,
29889,
14608,
292,
29918,
2371,
353,
6571,
30004,
13,
30004,
13,
4706,
1583,
29889,
13134,
29918,
3167,
353,
7700,
30004,
13,
30004,
13,
4706,
396,
6850,
1299,
2890,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
1202,
29918,
3859,
703,
4763,
3373,
613,
7370,
3373,
29898,
1311,
29889,
29888,
3844,
876,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
1202,
29918,
3859,
703,
15716,
292,
613,
20340,
292,
29898,
1311,
29889,
29888,
3844,
876,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
1202,
29918,
3859,
703,
6359,
3728,
613,
7523,
3728,
29898,
1311,
29889,
29888,
3844,
876,
30004,
13,
30004,
13,
4706,
396,
10014,
2190,
29903,
22122,
29903,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
1202,
29918,
3286,
391,
291,
703,
517,
15716,
292,
613,
4103,
391,
291,
703,
15716,
292,
5783,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
1202,
29918,
3286,
391,
291,
703,
517,
6359,
3728,
613,
4103,
391,
291,
703,
6359,
3728,
5783,
30004,
13,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
842,
29918,
3859,
703,
4763,
3373,
1159,
30004,
13,
30004,
13,
1678,
822,
6222,
29898,
1311,
1125,
30004,
13,
4706,
14550,
6558,
278,
12876,
29915,
29879,
8093,
2106,
4933,
12008,
30004,
13,
4706,
1583,
29889,
29888,
3844,
29889,
7978,
26471,
13,
30004,
13,
1678,
822,
2767,
29918,
14608,
292,
29918,
2371,
29898,
1311,
29892,
18203,
1125,
30004,
13,
4706,
14550,
6422,
20829,
292,
1591,
565,
716,
5782,
5235,
1863,
12008,
30004,
13,
30004,
13,
4706,
363,
364,
371,
297,
18203,
29889,
29878,
2167,
29901,
30004,
13,
9651,
396,
11455,
390,
4330,
29879,
310,
1583,
30004,
13,
9651,
565,
364,
371,
29889,
10030,
2804,
1583,
29889,
29888,
3844,
29889,
15140,
29889,
15140,
29918,
11027,
1839,
333,
2033,
29901,
30004,
13,
30004,
13,
18884,
1900,
13134,
353,
1583,
29889,
14608,
292,
29918,
2371,
29889,
657,
29898,
29878,
371,
29889,
10030,
8443,
13,
30004,
13,
18884,
396,
731,
452,
29916,
386,
459,
304,
2752,
12876,
322,
8147,
12714,
30004,
13,
18884,
364,
371,
29889,
842,
29918,
13996,
386,
459,
29898,
4058,
300,
29889,
6672,
29889,
4351,
8443,
13,
18884,
364,
371,
29889,
16414,
353,
1375,
29898,
29878,
371,
29889,
16414,
718,
30004,
13,
462,
462,
1583,
29889,
15140,
29918,
11027,
1839,
4905,
29879,
2033,
29961,
30004,
13,
462,
462,
268,
18203,
29889,
6672,
29889,
4351,
22322,
16414,
7464,
30004,
13,
462,
462,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
8443,
13,
30004,
13,
18884,
396,
12034,
29871,
3248,
29876,
29915,
29873,
3447,
1863,
30004,
13,
18884,
565,
451,
1900,
13134,
29901,
30004,
13,
462,
1678,
396,
11455,
390,
4330,
29879,
411,
263,
12714,
310,
18134,
29918,
2303,
5659,
2965,
30004,
13,
462,
1678,
565,
364,
371,
29889,
16414,
1275,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
29901,
30004,
13,
462,
4706,
736,
30004,
13,
30004,
13,
462,
1678,
396,
3462,
716,
390,
4330,
304,
21398,
1591,
30004,
13,
462,
1678,
364,
371,
29889,
15033,
353,
5852,
30004,
13,
462,
1678,
1583,
29889,
13134,
29918,
3167,
353,
5852,
30004,
13,
462,
1678,
1583,
29889,
14608,
292,
29918,
2371,
29961,
29878,
371,
29889,
10030,
29962,
353,
364,
371,
30004,
13,
462,
1678,
1596,
29918,
4906,
703,
29934,
4330,
2715,
363,
390,
5561,
29901,
376,
718,
851,
29898,
29878,
371,
29889,
10030,
876,
30004,
13,
462,
1678,
736,
30004,
13,
18884,
1683,
29901,
30004,
13,
462,
1678,
396,
12034,
2307,
4864,
30004,
13,
462,
1678,
565,
364,
371,
29889,
13996,
386,
459,
1275,
1900,
13134,
29889,
13996,
386,
459,
29901,
30004,
13,
462,
4706,
565,
1900,
13134,
29889,
16414,
2804,
364,
371,
29889,
16414,
29901,
30004,
13,
462,
9651,
565,
1900,
13134,
29889,
16414,
2804,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
320,
30004,
13,
462,
1669,
322,
364,
371,
29889,
16414,
6736,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
29901,
30004,
13,
462,
18884,
396,
2791,
363,
25861,
4333,
30004,
13,
462,
18884,
1900,
13134,
29889,
16414,
353,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
30004,
13,
462,
18884,
1900,
13134,
29889,
5397,
17807,
353,
5852,
30004,
13,
462,
18884,
1900,
13134,
29889,
15033,
353,
5852,
30004,
13,
462,
18884,
1583,
29889,
13134,
29918,
3167,
353,
5852,
30004,
13,
462,
9651,
1683,
29901,
30004,
13,
462,
18884,
1583,
29889,
5504,
29918,
13134,
29898,
13318,
13134,
29892,
364,
371,
8443,
13,
462,
4706,
396,
12034,
1603,
4864,
411,
1021,
1819,
30004,
13,
462,
4706,
25342,
451,
1900,
13134,
29889,
5397,
17807,
29901,
30004,
13,
462,
9651,
1900,
13134,
29889,
2344,
29918,
15619,
26471,
13,
462,
1678,
396,
27723,
12714,
373,
5923,
5782,
30004,
13,
462,
1678,
25342,
364,
371,
29889,
16414,
529,
1900,
13134,
29889,
16414,
29901,
30004,
13,
462,
4706,
1583,
29889,
5504,
29918,
13134,
29898,
13318,
13134,
29892,
364,
371,
8443,
13,
30004,
13,
1678,
822,
2767,
29918,
13134,
29898,
1311,
29892,
1900,
13134,
29892,
364,
371,
1125,
30004,
13,
4706,
14550,
6422,
385,
5923,
5782,
6251,
411,
716,
5782,
5235,
12008,
30004,
13,
30004,
13,
4706,
1900,
13134,
29889,
2344,
29918,
15619,
26471,
13,
4706,
1900,
13134,
29889,
5397,
17807,
353,
7700,
30004,
13,
4706,
1900,
13134,
29889,
15033,
353,
5852,
30004,
13,
4706,
1900,
13134,
29889,
16414,
353,
364,
371,
29889,
16414,
30004,
13,
4706,
1900,
13134,
29889,
13996,
386,
459,
353,
364,
371,
29889,
13996,
386,
459,
30004,
13,
4706,
1583,
29889,
13134,
29918,
3167,
353,
5852,
30004,
13,
4706,
1596,
29918,
4906,
703,
29934,
4330,
363,
390,
5561,
29901,
376,
718,
851,
29898,
29878,
371,
29889,
10030,
29897,
718,
30004,
13,
462,
418,
376,
4784,
411,
12714,
543,
718,
851,
29898,
29878,
371,
29889,
16414,
29897,
718,
30004,
13,
462,
418,
9162,
452,
29916,
386,
459,
543,
718,
851,
29898,
29878,
371,
29889,
13996,
386,
459,
29897,
718,
11393,
1159,
30004,
13,
30004,
13,
1678,
822,
1596,
29918,
14608,
292,
29918,
2371,
29898,
1311,
1125,
30004,
13,
4706,
14550,
11816,
278,
21398,
1591,
304,
278,
8638,
12008,
30004,
13,
4706,
1196,
353,
15691,
1378,
12918,
1378,
13097,
1378,
12918,
9072,
12918,
1378,
13097,
9072,
11793,
19451,
13,
4706,
1596,
29898,
1220,
8443,
13,
4706,
1596,
29898,
30004,
13,
9651,
376,
29989,
462,
632,
20829,
292,
6137,
259,
313,
23971,
376,
30004,
13,
9651,
718,
851,
29898,
1311,
29889,
15140,
29918,
11027,
1839,
333,
11287,
718,
16521,
462,
1678,
891,
1159,
30004,
13,
4706,
1596,
29898,
1220,
8443,
13,
4706,
1596,
29898,
30004,
13,
9651,
376,
29989,
23971,
3553,
29871,
891,
29871,
4737,
2200,
29871,
891,
29871,
8084,
29950,
459,
29871,
891,
29871,
678,
4618,
21979,
29871,
891,
29871,
7455,
17807,
891,
29871,
5974,
449,
29898,
29879,
29897,
891,
1159,
30004,
13,
4706,
1596,
29898,
1220,
8443,
13,
30004,
13,
4706,
1596,
29898,
1311,
29889,
14608,
292,
29918,
2371,
29961,
1311,
29889,
15140,
29918,
11027,
1839,
333,
2033,
2314,
30004,
13,
30004,
13,
4706,
1596,
29898,
30004,
13,
9651,
15691,
4936,
25512,
29974,
4936,
1360,
29974,
4936,
25512,
29974,
4936,
2751,
25512,
29974,
4936,
1360,
29974,
4936,
2751,
29922,
29974,
1159,
30004,
13,
30004,
13,
4706,
363,
6251,
297,
1583,
29889,
14608,
292,
29918,
2371,
29901,
30004,
13,
9651,
565,
6251,
2804,
1583,
29889,
15140,
29918,
11027,
1839,
333,
2033,
29901,
30004,
13,
18884,
1596,
29898,
1311,
29889,
14608,
292,
29918,
2371,
29961,
8269,
2314,
30004,
13,
18884,
1596,
29898,
1220,
8443,
13,
4706,
1596,
28909,
29876,
1495,
30004,
13,
30004,
13,
1678,
822,
7135,
29918,
5504,
29898,
1311,
1125,
30004,
13,
4706,
14550,
12600,
20829,
292,
2767,
363,
871,
278,
12049,
607,
505,
3939,
12008,
30004,
13,
4706,
3939,
29918,
29878,
2167,
353,
5159,
30004,
13,
4706,
1596,
29918,
4906,
703,
29903,
2548,
1605,
3567,
2767,
23157,
30004,
13,
4706,
363,
364,
371,
297,
1583,
29889,
14608,
292,
29918,
2371,
29889,
5975,
7295,
30004,
13,
9651,
565,
364,
371,
29889,
15033,
29901,
30004,
13,
18884,
3939,
29918,
29878,
2167,
29889,
4397,
29898,
29878,
371,
8443,
13,
18884,
364,
371,
29889,
15033,
353,
7700,
30004,
13,
30004,
13,
4706,
1583,
29889,
13134,
29918,
3167,
353,
7700,
30004,
13,
4706,
396,
3638,
2767,
411,
4036,
9055,
1546,
29871,
29896,
322,
29871,
29945,
6923,
30004,
13,
4706,
9055,
353,
20088,
524,
29898,
29896,
29892,
29871,
29945,
8443,
13,
4706,
3244,
292,
29889,
14745,
29898,
18829,
29892,
1583,
29889,
5504,
29892,
518,
15033,
29918,
29878,
2167,
2314,
30004,
13,
30004,
13,
1678,
822,
2767,
29898,
1311,
29892,
9976,
1125,
30004,
13,
4706,
14550,
12600,
263,
2643,
304,
599,
1962,
16169,
12008,
30004,
13,
4706,
565,
1583,
29889,
15140,
29918,
11027,
2804,
426,
6177,
30004,
13,
30004,
13,
9651,
577,
384,
353,
1051,
29898,
1311,
29889,
15140,
29918,
11027,
1839,
2080,
29879,
13359,
5975,
3101,
29961,
29896,
29962,
30004,
13,
9651,
1887,
29918,
6672,
353,
390,
5690,
7850,
29898,
15140,
29918,
333,
29922,
1311,
29889,
15140,
29918,
11027,
1839,
333,
2033,
8443,
13,
30004,
13,
9651,
363,
1962,
297,
1583,
29889,
15140,
29918,
11027,
1839,
4905,
29879,
2033,
29901,
30004,
13,
18884,
396,
26178,
28205,
30004,
13,
18884,
396,
15154,
390,
29911,
2890,
363,
607,
452,
29916,
386,
459,
1275,
1962,
30004,
13,
18884,
6219,
29918,
2015,
18162,
29918,
26586,
353,
5159,
30004,
13,
18884,
363,
6251,
297,
9976,
29901,
30004,
13,
462,
1678,
565,
6251,
29889,
13996,
386,
459,
2804,
1962,
29901,
30004,
13,
462,
4706,
6219,
29918,
2015,
18162,
29918,
26586,
29889,
4397,
29898,
8269,
8443,
13,
462,
1678,
1683,
29901,
30004,
13,
462,
4706,
396,
3929,
2285,
11837,
30004,
13,
462,
4706,
396,
6204,
716,
6251,
304,
679,
2820,
777,
2090,
3459,
29371,
30004,
13,
462,
4706,
396,
1932,
2599,
27908,
287,
29918,
8269,
353,
6251,
30004,
13,
462,
4706,
27908,
287,
29918,
8269,
353,
390,
5690,
12085,
9634,
29898,
1610,
1272,
29922,
8516,
11167,
13,
462,
18884,
4765,
29918,
333,
29922,
8516,
29892,
3211,
29922,
8269,
29889,
10030,
11167,
13,
462,
18884,
452,
29916,
386,
459,
29922,
8269,
29889,
13996,
386,
459,
29892,
12714,
29922,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
11167,
13,
462,
18884,
19673,
29922,
8269,
29889,
5215,
287,
8443,
13,
462,
4706,
6219,
29918,
2015,
18162,
29918,
26586,
29889,
4397,
29898,
1129,
2285,
287,
29918,
8269,
8443,
13,
30004,
13,
18884,
396,
3440,
714,
304,
11262,
6219,
28205,
30004,
13,
18884,
18203,
353,
390,
5690,
16638,
300,
29898,
30004,
13,
462,
1678,
4839,
29922,
2997,
29918,
6672,
29892,
364,
2167,
29922,
5451,
29918,
2015,
18162,
29918,
26586,
8443,
13,
30004,
13,
18884,
396,
853,
9342,
304,
11262,
6219,
28205,
30004,
13,
18884,
396,
18203,
353,
390,
5690,
16638,
300,
29898,
6672,
29922,
2997,
29918,
6672,
29892,
364,
2167,
29922,
26586,
8443,
13,
30004,
13,
18884,
577,
384,
29889,
6717,
517,
29898,
4058,
300,
29889,
643,
6646,
3285,
30004,
13,
462,
9651,
313,
20832,
11167,
13,
462,
632,
1583,
29889,
15140,
29918,
11027,
1839,
4905,
29879,
2033,
29961,
4905,
29962,
3366,
637,
3108,
876,
30004,
13,
30004,
13,
18884,
1596,
29918,
4906,
703,
3728,
28048,
1763,
390,
5561,
29901,
376,
718,
851,
29898,
4905,
876,
30004,
13,
30004,
13,
1678,
822,
1423,
29918,
15619,
29898,
1311,
1125,
30004,
13,
4706,
14550,
5596,
278,
1857,
11815,
995,
363,
1269,
390,
4330,
297,
278,
21398,
1591,
22993,
13,
4706,
960,
278,
931,
4328,
411,
1286,
338,
7621,
1135,
390,
12015,
29923,
29918,
15307,
12015,
29892,
769,
30004,
13,
4706,
731,
278,
12714,
304,
29871,
29896,
29953,
322,
1369,
278,
25861,
4333,
12237,
29889,
12008,
30004,
13,
30004,
13,
4706,
1596,
29918,
4906,
703,
5596,
292,
11815,
856,
1159,
30004,
13,
4706,
565,
1583,
29889,
14608,
292,
29918,
2371,
2804,
426,
6177,
30004,
13,
30004,
13,
9651,
363,
364,
371,
297,
1583,
29889,
14608,
292,
29918,
2371,
29889,
5975,
7295,
30004,
13,
18884,
565,
364,
371,
29889,
15619,
2804,
6213,
322,
320,
30004,
13,
462,
259,
313,
12673,
29889,
12673,
29889,
3707,
580,
448,
364,
371,
29889,
15619,
467,
7827,
29918,
23128,
580,
320,
30004,
13,
462,
259,
6736,
390,
12015,
29923,
29918,
15307,
12015,
29901,
30004,
13,
462,
1678,
364,
371,
29889,
5397,
17807,
353,
5852,
30004,
13,
462,
1678,
364,
371,
29889,
15033,
353,
5852,
30004,
13,
462,
1678,
1583,
29889,
13134,
29918,
3167,
353,
5852,
30004,
13,
462,
1678,
364,
371,
29889,
16414,
353,
390,
5690,
12085,
9634,
29889,
12648,
29918,
2303,
5659,
2965,
30004,
13,
462,
1678,
364,
371,
29889,
15619,
353,
12865,
29889,
12673,
29889,
3707,
26471,
13,
462,
1678,
1583,
29889,
2158,
29918,
14608,
292,
29918,
2371,
26471,
13,
462,
1678,
1596,
29918,
4906,
703,
23971,
29901,
376,
718,
851,
29898,
29878,
371,
29889,
10030,
29897,
718,
376,
5335,
287,
714,
23157,
30004,
13,
30004,
13,
1678,
822,
25861,
29918,
20404,
29898,
1311,
1125,
30004,
13,
4706,
14550,
5596,
278,
4660,
310,
278,
25861,
2875,
310,
1269,
390,
4330,
29889,
960,
1565,
29892,
322,
30004,
13,
4706,
278,
11815,
995,
4328,
411,
1286,
338,
7621,
1135,
5012,
18476,
29918,
15307,
12015,
11167,
13,
4706,
2791,
372,
363,
7374,
291,
12008,
30004,
13,
30004,
13,
4706,
1596,
29918,
4906,
703,
5596,
292,
25861,
11815,
856,
1159,
30004,
13,
4706,
565,
1583,
29889,
14608,
292,
29918,
2371,
2804,
426,
6177,
30004,
13,
9651,
363,
364,
371,
297,
1583,
29889,
14608,
292,
29918,
2371,
29889,
5975,
7295,
30004,
13,
18884,
565,
364,
371,
29889,
5397,
17807,
29901,
30004,
13,
462,
1678,
565,
313,
12673,
29889,
12673,
29889,
3707,
580,
448,
364,
371,
29889,
15619,
467,
7827,
29918,
23128,
580,
320,
30004,
13,
462,
9651,
6736,
5012,
18476,
29918,
15307,
12015,
29901,
30004,
13,
462,
4706,
364,
371,
29889,
3502,
287,
29918,
1454,
29918,
311,
1464,
353,
5852,
30004,
13,
30004,
13,
1678,
822,
25861,
29918,
10855,
29898,
1311,
1125,
30004,
13,
4706,
14550,
5596,
278,
21398,
1591,
363,
390,
4330,
29915,
29879,
393,
526,
10902,
363,
7374,
291,
322,
30004,
13,
4706,
3349,
963,
29889,
12008,
30004,
13,
30004,
13,
4706,
1596,
29918,
4906,
703,
28916,
292,
7455,
17807,
856,
1159,
30004,
13,
4706,
565,
1583,
29889,
14608,
292,
29918,
2371,
2804,
426,
6177,
30004,
13,
9651,
5217,
29918,
27894,
353,
5159,
30004,
13,
9651,
363,
364,
371,
297,
1583,
29889,
14608,
292,
29918,
2371,
29889,
5975,
7295,
30004,
13,
18884,
565,
364,
371,
29889,
3502,
287,
29918,
1454,
29918,
311,
1464,
29901,
30004,
13,
462,
1678,
5217,
29918,
27894,
29889,
4397,
29898,
29878,
371,
29889,
10030,
8443,
13,
462,
1678,
1596,
29918,
4906,
703,
23971,
29901,
376,
718,
851,
29898,
29878,
371,
29889,
10030,
29897,
718,
376,
756,
1063,
376,
718,
30004,
13,
462,
462,
29871,
376,
1745,
8238,
515,
278,
21398,
1591,
23157,
30004,
13,
30004,
13,
9651,
363,
6251,
297,
5217,
29918,
27894,
29901,
30004,
13,
18884,
628,
1583,
29889,
14608,
292,
29918,
2371,
29961,
8269,
29962,
30004,
13,
18884,
1583,
29889,
2158,
29918,
14608,
292,
29918,
2371,
26471,
13,
30004,
13,
1678,
822,
12237,
29898,
1311,
29892,
740,
29892,
1828,
29922,
8516,
1125,
30004,
13,
4706,
14550,
4763,
263,
29591,
12237,
607,
5717,
263,
6790,
740,
12008,
30004,
13,
30004,
13,
4706,
565,
1828,
2804,
6213,
29901,
30004,
13,
9651,
740,
29898,
1761,
29898,
3207,
29889,
5975,
22130,
30004,
13,
9651,
3785,
353,
350,
8127,
29918,
29911,
7833,
1001,
334,
20088,
3881,
29898,
29947,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29897,
847,
29871,
29896,
29900,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
3785,
353,
350,
8127,
29918,
29911,
7833,
1001,
30004,
13,
9651,
740,
26471,
13,
30004,
13,
4706,
3244,
292,
29889,
14745,
29898,
19145,
29892,
1583,
29889,
20404,
29892,
518,
2220,
29892,
1828,
14664,
2962,
26471,
13,
30004,
13,
1678,
822,
1369,
29918,
9346,
414,
29898,
1311,
1125,
30004,
13,
4706,
14550,
4763,
278,
5335,
414,
373,
5004,
9717,
12008,
30004,
13,
4706,
1583,
29889,
20404,
29898,
1311,
29889,
5504,
29892,
1828,
29922,
1311,
29889,
14608,
292,
29918,
2371,
8443,
13,
4706,
1583,
29889,
20404,
29898,
1311,
29889,
3198,
29918,
15619,
8443,
13,
4706,
1583,
29889,
20404,
29898,
1311,
29889,
5397,
17807,
29918,
20404,
8443,
13,
4706,
1583,
29889,
20404,
29898,
1311,
29889,
5397,
17807,
29918,
10855,
8443,
13,
30004,
13,
1678,
822,
1667,
29918,
7888,
29898,
1311,
1125,
30004,
13,
4706,
14550,
4763,
278,
1667,
2425,
363,
278,
1824,
29889,
12008,
30004,
13,
30004,
13,
4706,
1550,
5852,
29901,
30004,
13,
9651,
1583,
29889,
7978,
26471,
13,
30004,
13,
29937,
27694,
6093,
13756,
29954,
25058,
30004,
13,
30004,
13,
30004,
13,
1753,
1596,
29918,
4906,
29898,
4906,
1125,
30004,
13,
1678,
14550,
11816,
278,
2183,
2643,
411,
278,
1857,
931,
1434,
372,
12008,
30004,
13,
1678,
565,
21681,
29901,
30004,
13,
4706,
1596,
703,
3366,
718,
931,
29889,
710,
615,
603,
11702,
29950,
16664,
29924,
16664,
29903,
1159,
718,
376,
5387,
376,
718,
2643,
8443,
13,
30004,
13,
30004,
13,
1753,
1667,
7295,
30004,
13,
1678,
14550,
6330,
740,
304,
1065,
278,
1824,
29889,
12008,
30004,
13,
30004,
13,
1678,
565,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
4706,
12876,
353,
390,
5561,
29898,
710,
29898,
9675,
29889,
19218,
14352,
29896,
12622,
30004,
13,
4706,
12876,
29889,
2962,
29918,
9346,
414,
26471,
13,
4706,
12876,
29889,
3396,
29918,
7888,
26471,
13,
30004,
13,
3396,
26471,
13,
2
] |
skylib/extraction/__init__.py | SkynetRTN/skylib | 1 | 102625 | """
SkyLib source extraction functions - a replacement for SExtractor.
main: high-level source extraction interface.
isophotal: a fast implementation of isophotal analysis.
"""
from .main import *
| [
1,
9995,
13,
29903,
3459,
14868,
2752,
4805,
428,
3168,
448,
263,
16920,
363,
3725,
486,
28891,
29889,
13,
13,
3396,
29901,
1880,
29899,
5563,
2752,
4805,
428,
5067,
29889,
13,
275,
3021,
7288,
29901,
263,
5172,
5314,
310,
338,
3021,
7288,
7418,
29889,
13,
15945,
29908,
13,
13,
3166,
869,
3396,
1053,
334,
13,
2
] |
scan/biotools.py | dubinnyi/rcsbscan | 0 | 187622 | <filename>scan/biotools.py
import gzip
import sys, os
import warnings
import time
from Bio.PDB.PDBExceptions import PDBConstructionWarning
import re
from Bio.PDB.mmtf import MMTFParser
from Bio.PDB import *
from Bio.Seq import Seq
from Bio.Data import IUPACData
import Bio.SVDSuperimposer
import multiprocessing as mp
LOCK = mp.Lock()
class MPCounter(object):
def __init__(self, initval=0):
self.val = mp.Value('i', initval)
self.lock = mp.Lock()
def increment(self):
with self.lock:
self.val.value += 1
def value(self):
with self.lock:
return self.val.value
def eprint(*args, **kwargs):
with LOCK:
print(*args, file=sys.stderr, **kwargs)
def mpprint(*args, **kwargs):
with LOCK:
print(*args, file=sys.stdout, **kwargs)
def opengz(filename, args: 'r'):
if filename[-2:] == "gz":
openfunc = gzip.open
openarg = args + 't'
else:
openfunc = open
openarg = args
return openfunc(filename, openarg)
def parse_structure_filename(filename):
id = os.path.basename(filename)
format = 'auto'
zip_flag = False
if id.startswith("pdb"):
id = id[3:]
format = 'pdb'
if id.endswith(".gz"):
id = id[0:-3]
zip_flag = True
if id.endswith(".pdb"):
id = id[0:-4]
format = 'pdb'
if id.endswith(".mmcif"):
id = id[0:-6]
format = 'cif'
if id.endswith(".cif"):
id = id[0:-4]
format = 'cif'
if id.endswith(".ent"):
id = id[0:-4]
if id.endswith(".mmtf"):
id = id[0:-5]
format = 'mmtf'
id = id.upper()
return (id, format, zip_flag)
def get_structure_from_file(filename, **kwargs):
# format argument is unused
force_format = format = 'auto'
if 'format' in kwargs.keys():
force_format = kwargs['format']
(file_id, filename_format, zip_flag) = parse_structure_filename(filename)
cif_parser = MMCIFParser()
pdb_parser = PDBParser()
mmtf_parser = MMTFParser()
if force_format != 'auto':
format = force_format
if format == 'auto':
format = filename_format
if format == 'pdb' or format == 'auto':
parsers = [pdb_parser, cif_parser]
elif format == 'mmtf' or format == 'auto':
parsers = [mmtf_parser]
else:
parsers = [cif_parser, pdb_parser, mmtf_parser]
for parser in parsers:
try:
if zip_flag:
open_function = opengz
else:
open_function = open
if format == 'mmtf':
structure = parser.get_structure(filename)
if structure:
return structure
with open_function(filename, 'r') as handle:
structure = parser.get_structure(file_id, handle)
if structure:
return structure
except:
continue
eprint("File {} could not be read".format(filename))
return None
def chain_sequence_ppbuild(chain):
# Fails if chain is dicontinued
ppb = PPBuilder()
pp = ppb.build_peptides(chain)
if pp and len(pp):
return (pp[0].get_sequence())
else:
return (None)
def chain_sequence_aaselect(chain):
# Ok if chain is discontinued
res_list = chain.get_list()
res_list_aa = [res for res in res_list if is_aa(res)]
return res_list_aa
def res_oneletter(res):
#dict_3to1 = IUPACData.protein_letters_3to1.copy()
dict_3to1 = {}
dict_3to1['Mse'] = 'm' # Seleno methyonine https://www.rcsb.org/ligand/MSE
dict_3to1['Mly'] = 'k' # N,N dimethyl lysine https://www.rcsb.org/ligand/MLY
dict_3to1['Cso'] = 'c' # S-HYDROXYCYSTEINE https://www.rcsb.org/ligand/CSO
dict_3to1['Csd'] = 'a' # 3-SULFINOALANINE https://www.rcsb.org/ligand/CSD
dict_3to1['Cme'] = 'e' # S,S-(2-HYDROXYETHYL)THIOCYSTEINE
# https://www.rcsb.org/ligand/CME
dict_3to1['Tys'] = 'y' # O-SULFO-L-TYROSINE https://www.rcsb.org/ligand/TYS
dict_3to1['Dah'] = 'f' # 3,4-DIHYDROXYPHENYLALANINE
# https://www.rcsb.org/ligand/DAH
rname3 = res.get_resname()
rname3 = rname3[0].upper() + rname3[1:].lower()
try:
rname1 = IUPACData.protein_letters_3to1[rname3]
except KeyError:
try:
rname1 = dict_3to1[rname3]
except KeyError:
rname1 = '.'
return rname1
def res_list_to_one_letter_string(res_list):
if not res_list:
return (0, "")
prev_id = None
sequence_start = None
seq = ''
for r in res_list:
this_id = r.get_id()[1] # residue number, may repeat o have gaps
if prev_id:
if this_id == prev_id or this_id == prev_id + 1:
seq += res_oneletter(r)
elif this_id > prev_id + 1:
for r1 in range(prev_id + 1, this_id):
seq += "."
seq += res_oneletter(r)
else:
sequence_start = this_id
seq += res_oneletter(r)
prev_id = this_id
return (sequence_start, Seq(seq))
def chain_one_letter_string(chain):
res_list = chain_sequence_aaselect(chain)
return res_list_to_one_letter_string(res_list)
def res_insertions(res_list):
res_list_ins = [res for res in res_list if res.get_id()[2] != ' ']
return res_list_ins
def chain_water(chain):
# Ok if chain is discontinued
res_list = chain.get_list()
res_list_water = [res for res in res_list if res.get_id()[0] == 'W']
return res_list_water
def chain_water_id(chain, water_id):
# Ok if chain is discontinued
res_list = chain.get_list()
res_list_water = [res for res in res_list \
if res.get_id()[0] == 'W' and res.get_id()[1] == water_id]
return res_list_water
def bio_str_to_resid(string, hetfield =' '):
# Return residue in biopython-compatible format
# insertion character after number is converted to icode
# hetfield is ' ' for ordinary residues
#
# examples:
# bio_str_to_resid('10')
# (' ', 10, ' ')
# bio_str_to_resid('11A')
# (' ', 11, 'A')
p = re.compile('(?P<resseq>\d+)(?P<icode>[A-Z]?)$')
m = p.match(string)
if not m:
return None
resseq = int(m.group('resseq'))
icode = m.group('icode')
icode = ' ' if not icode else icode
return (hetfield, resseq, icode)
def bio_resid_to_str(resid):
hetfield, resseq, icode = resid
return "{}{}".format(resseq, icode.strip())
def range_str_to_tuple(range_str):
if not range_str or range_str == '*' or range_str == '.' or range_str.upper() == 'ALL':
# Select all
return None
range_split = range_str.split('-')
if len(range_split) == 0:
# Select all
return None
elif len(range_split) == 1:
res_start = bio_str_to_resid(range_split[0])
res_finish = res_start
else:
res_start = bio_str_to_resid(range_split[0])
res_finish = bio_str_to_resid(range_split[1])
#res_finish[1] += 1
return (res_start, res_finish)
def select_residues_from_chain(chain, **kwargs):
# chain: biopython chain
# first_res: first residue id to select, e.g. (' ',1,' ')
# last_res: last residue to select, e.g. (' ',10, 'A')
# gap_count: select 'gap_count' residues before first_res or after last_res
# select all residues if no argumants provided
res_list_aa = chain_sequence_aaselect(chain)
id_list = [res.get_id() for res in res_list_aa]
res_tuple = kwargs['res_tuple'] if 'res_tuple' in kwargs else None
gap_count = kwargs['gap_count'] if 'gap_count' in kwargs else 0
if res_tuple:
(first_res, last_res) = res_tuple
else:
first_res = kwargs['first_res'] if 'first_res' in kwargs else None
last_res = kwargs['last_res'] if 'last_res' in kwargs else None
first_index, last_index = 0, len(res_list_aa)
if first_res:
try:
first_index = id_list.index(first_res)
except:
raise IndexError("Residue '{}' is out of sequence range".format(first_res))
if last_res:
try:
last_index = id_list.index(last_res)
except:
raise IndexError("Residue '{}' is out of sequence range".format(last_res))
if first_res and last_res:
return res_list_aa[first_index: last_index + 1]
elif first_res and ( gap_count is not None ):
if first_index - gap_count < 0:
gap_count = first_index
return res_list_aa[first_index - gap_count : first_index]
elif last_res and ( gap_count is not None ):
return res_list_aa[last_index + 1 : last_index + 1 + gap_count]
elif first_res and ( gap_count is None ):
return res_list_aa[first_index :]
elif last_res and ( gap_count is None ):
return res_list_aa[: last_index + 1]
else:
return res_list_aa
def atom_str_to_set(atom_str):
atom_set = set()
if not atom_str or atom_str == '*' or atom_str == '.' or atom_str.upper() == 'ALL':
return atom_set
atom_list = atom_str.split(',')
for a in atom_list:
a = a.strip()
atom_set.add(a)
return atom_set
def select_atoms_from_res_list(res_list, ref_atom_names_set):
atom_list = []
for r in res_list:
for a in r.get_list():
if ref_atom_names_set and a.get_name() in ref_atom_names_set:
atom_list.append(a)
if not ref_atom_names_set:
# set is empty, append all atoms
atom_list.append(a)
if ref_atom_names_set and not atom_list:
raise IndexError("Atoms not present in structure")
return atom_list
def check_res_list_is_continuous(res_list):
prev_id = None
for r in res_list:
this_id = r.get_id()[1] # residue number, may repeat o have gaps
if prev_id:
if not (this_id == prev_id or this_id == prev_id + 1):
return False
prev_id = this_id
return True
def get_res_and_atoms(chain_res_aa, resno, ref_res_list_len, ref_atom_names_set):
try:
res_list_to_fit = chain_res_aa[resno: resno + ref_res_list_len]
except:
return (None, None)
if check_res_list_is_continuous(res_list_to_fit):
atom_list_to_fit = select_atoms_from_res_list(res_list_to_fit, ref_atom_names_set)
return (res_list_to_fit, atom_list_to_fit)
else:
# eprint("Residue list is discontinous: {} - {}".format(res_list_to_fit[0].get_full_id(),
# res_list_to_fit[-1].get_id()))
return (None, None)
def recursive_expand(list_of_files_and_dirs):
result = []
for f in list_of_files_and_dirs:
if os.path.isfile(f):
result.append(f)
elif os.path.isdir(f):
subdirs = [os.path.join(f, d) for d in os.listdir(f)]
result.extend(recursive_expand(subdirs))
return result
| [
1,
529,
9507,
29958,
16192,
29914,
5365,
327,
8789,
29889,
2272,
13,
5215,
330,
7554,
13,
5215,
10876,
29892,
2897,
13,
5215,
18116,
13,
5215,
931,
13,
3166,
21184,
29889,
29925,
4051,
29889,
29925,
4051,
2451,
29879,
1053,
349,
4051,
12075,
4080,
22709,
13,
5215,
337,
13,
13,
3166,
21184,
29889,
29925,
4051,
29889,
4317,
13264,
1053,
28880,
8969,
11726,
13,
3166,
21184,
29889,
29925,
4051,
1053,
334,
13,
3166,
21184,
29889,
23718,
1053,
25981,
13,
3166,
21184,
29889,
1469,
1053,
306,
4897,
2477,
1469,
13,
13,
5215,
21184,
29889,
7597,
29928,
19111,
326,
1066,
261,
13,
13,
5215,
6674,
307,
985,
292,
408,
22326,
13,
13,
21339,
353,
22326,
29889,
16542,
580,
13,
13,
13,
1990,
341,
9026,
5336,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2069,
791,
29922,
29900,
1125,
13,
4706,
1583,
29889,
791,
353,
22326,
29889,
1917,
877,
29875,
742,
2069,
791,
29897,
13,
4706,
1583,
29889,
908,
353,
22326,
29889,
16542,
580,
13,
13,
1678,
822,
11924,
29898,
1311,
1125,
13,
4706,
411,
1583,
29889,
908,
29901,
13,
9651,
1583,
29889,
791,
29889,
1767,
4619,
29871,
29896,
13,
13,
1678,
822,
995,
29898,
1311,
1125,
13,
4706,
411,
1583,
29889,
908,
29901,
13,
9651,
736,
1583,
29889,
791,
29889,
1767,
13,
13,
13,
1753,
321,
2158,
10456,
5085,
29892,
3579,
19290,
1125,
13,
1678,
411,
11247,
7077,
29901,
13,
4706,
1596,
10456,
5085,
29892,
934,
29922,
9675,
29889,
303,
20405,
29892,
3579,
19290,
29897,
13,
13,
13,
1753,
286,
407,
29878,
524,
10456,
5085,
29892,
3579,
19290,
1125,
13,
1678,
411,
11247,
7077,
29901,
13,
4706,
1596,
10456,
5085,
29892,
934,
29922,
9675,
29889,
25393,
29892,
3579,
19290,
29897,
13,
13,
13,
1753,
1015,
996,
29920,
29898,
9507,
29892,
6389,
29901,
525,
29878,
29374,
13,
1678,
565,
10422,
14352,
29906,
17531,
1275,
376,
18828,
1115,
13,
4706,
1722,
9891,
353,
330,
7554,
29889,
3150,
13,
4706,
1722,
1191,
353,
6389,
718,
525,
29873,
29915,
13,
1678,
1683,
29901,
13,
4706,
1722,
9891,
353,
1722,
13,
4706,
1722,
1191,
353,
6389,
13,
1678,
736,
1722,
9891,
29898,
9507,
29892,
1722,
1191,
29897,
13,
13,
13,
1753,
6088,
29918,
23905,
29918,
9507,
29898,
9507,
1125,
13,
1678,
1178,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
9507,
29897,
13,
1678,
3402,
353,
525,
6921,
29915,
13,
1678,
14319,
29918,
15581,
353,
7700,
13,
1678,
565,
1178,
29889,
27382,
2541,
703,
29886,
2585,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29941,
17531,
13,
4706,
3402,
353,
525,
29886,
2585,
29915,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
18828,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29941,
29962,
13,
4706,
14319,
29918,
15581,
353,
5852,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
29886,
2585,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29946,
29962,
13,
4706,
3402,
353,
525,
29886,
2585,
29915,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
4317,
29883,
361,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29953,
29962,
13,
4706,
3402,
353,
525,
29883,
361,
29915,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
29883,
361,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29946,
29962,
13,
4706,
3402,
353,
525,
29883,
361,
29915,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
296,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29946,
29962,
13,
1678,
565,
1178,
29889,
1975,
2541,
17350,
4317,
13264,
29908,
1125,
13,
4706,
1178,
353,
1178,
29961,
29900,
13018,
29945,
29962,
13,
4706,
3402,
353,
525,
4317,
13264,
29915,
13,
1678,
1178,
353,
1178,
29889,
21064,
580,
13,
1678,
736,
313,
333,
29892,
3402,
29892,
14319,
29918,
15581,
29897,
13,
13,
13,
1753,
679,
29918,
23905,
29918,
3166,
29918,
1445,
29898,
9507,
29892,
3579,
19290,
1125,
13,
1678,
396,
3402,
2980,
338,
443,
3880,
13,
1678,
4889,
29918,
4830,
353,
3402,
353,
525,
6921,
29915,
13,
1678,
565,
525,
4830,
29915,
297,
9049,
5085,
29889,
8149,
7295,
13,
4706,
4889,
29918,
4830,
353,
9049,
5085,
1839,
4830,
2033,
13,
1678,
313,
1445,
29918,
333,
29892,
10422,
29918,
4830,
29892,
14319,
29918,
15581,
29897,
353,
6088,
29918,
23905,
29918,
9507,
29898,
9507,
29897,
13,
1678,
274,
361,
29918,
16680,
353,
341,
12513,
6545,
11726,
580,
13,
1678,
282,
2585,
29918,
16680,
353,
349,
4051,
11726,
580,
13,
1678,
286,
4378,
29888,
29918,
16680,
353,
28880,
8969,
11726,
580,
13,
1678,
565,
4889,
29918,
4830,
2804,
525,
6921,
2396,
13,
4706,
3402,
353,
4889,
29918,
4830,
13,
1678,
565,
3402,
1275,
525,
6921,
2396,
13,
4706,
3402,
353,
10422,
29918,
4830,
13,
1678,
565,
3402,
1275,
525,
29886,
2585,
29915,
470,
3402,
1275,
525,
6921,
2396,
13,
4706,
610,
4253,
353,
518,
29886,
2585,
29918,
16680,
29892,
274,
361,
29918,
16680,
29962,
13,
1678,
25342,
3402,
1275,
525,
4317,
13264,
29915,
470,
3402,
1275,
525,
6921,
2396,
13,
4706,
610,
4253,
353,
518,
4317,
13264,
29918,
16680,
29962,
13,
1678,
1683,
29901,
13,
4706,
610,
4253,
353,
518,
29883,
361,
29918,
16680,
29892,
282,
2585,
29918,
16680,
29892,
286,
4378,
29888,
29918,
16680,
29962,
13,
1678,
363,
13812,
297,
610,
4253,
29901,
13,
4706,
1018,
29901,
13,
9651,
565,
14319,
29918,
15581,
29901,
13,
18884,
1722,
29918,
2220,
353,
1015,
996,
29920,
13,
9651,
1683,
29901,
13,
18884,
1722,
29918,
2220,
353,
1722,
13,
9651,
565,
3402,
1275,
525,
4317,
13264,
2396,
13,
18884,
3829,
353,
13812,
29889,
657,
29918,
23905,
29898,
9507,
29897,
13,
18884,
565,
3829,
29901,
13,
462,
1678,
736,
3829,
13,
9651,
411,
1722,
29918,
2220,
29898,
9507,
29892,
525,
29878,
1495,
408,
4386,
29901,
13,
18884,
3829,
353,
13812,
29889,
657,
29918,
23905,
29898,
1445,
29918,
333,
29892,
4386,
29897,
13,
18884,
565,
3829,
29901,
13,
462,
1678,
736,
3829,
13,
4706,
5174,
29901,
13,
9651,
6773,
13,
1678,
321,
2158,
703,
2283,
6571,
1033,
451,
367,
1303,
1642,
4830,
29898,
9507,
876,
13,
1678,
736,
6213,
13,
13,
13,
1753,
9704,
29918,
16506,
29918,
407,
4282,
29898,
14153,
1125,
13,
1678,
396,
383,
2234,
565,
9704,
338,
12124,
609,
262,
6742,
13,
1678,
6499,
29890,
353,
349,
29925,
5627,
580,
13,
1678,
6499,
353,
6499,
29890,
29889,
4282,
29918,
412,
415,
2247,
29898,
14153,
29897,
13,
1678,
565,
6499,
322,
7431,
29898,
407,
1125,
13,
4706,
736,
313,
407,
29961,
29900,
1822,
657,
29918,
16506,
3101,
13,
1678,
1683,
29901,
13,
4706,
736,
313,
8516,
29897,
13,
13,
13,
1753,
9704,
29918,
16506,
29918,
29874,
559,
781,
29898,
14153,
1125,
13,
1678,
396,
3674,
565,
9704,
338,
766,
1285,
262,
6742,
13,
1678,
620,
29918,
1761,
353,
9704,
29889,
657,
29918,
1761,
580,
13,
1678,
620,
29918,
1761,
29918,
7340,
353,
518,
690,
363,
620,
297,
620,
29918,
1761,
565,
338,
29918,
7340,
29898,
690,
4638,
13,
1678,
736,
620,
29918,
1761,
29918,
7340,
13,
13,
13,
1753,
620,
29918,
650,
15670,
29898,
690,
1125,
13,
1678,
396,
8977,
29918,
29941,
517,
29896,
353,
306,
4897,
2477,
1469,
29889,
14676,
262,
29918,
1026,
2153,
29918,
29941,
517,
29896,
29889,
8552,
580,
13,
1678,
9657,
29918,
29941,
517,
29896,
353,
6571,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29924,
344,
2033,
353,
525,
29885,
29915,
396,
317,
4498,
29877,
286,
621,
29891,
265,
457,
259,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
29924,
1660,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29924,
368,
2033,
353,
525,
29895,
29915,
396,
405,
29892,
29940,
3964,
621,
2904,
301,
952,
457,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
1988,
29979,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29907,
578,
2033,
353,
525,
29883,
29915,
396,
317,
29899,
29950,
29979,
29928,
1672,
18454,
29907,
29979,
1254,
29923,
8895,
259,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
29907,
6156,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29907,
4928,
2033,
353,
525,
29874,
29915,
396,
29871,
29941,
29899,
29903,
13309,
29943,
1177,
29949,
1964,
2190,
8895,
1678,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
29907,
7230,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29907,
1004,
2033,
353,
525,
29872,
29915,
396,
317,
29892,
29903,
17722,
29906,
29899,
29950,
29979,
29928,
1672,
18454,
2544,
29950,
29979,
29931,
29897,
4690,
5971,
29907,
29979,
1254,
29923,
8895,
13,
1678,
396,
462,
462,
9651,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
29907,
2303,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29911,
952,
2033,
353,
525,
29891,
29915,
396,
438,
29899,
29903,
13309,
5800,
29899,
29931,
29899,
15631,
1672,
29903,
8895,
29871,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
15631,
29903,
13,
1678,
9657,
29918,
29941,
517,
29896,
1839,
29928,
801,
2033,
353,
525,
29888,
29915,
396,
29871,
29941,
29892,
29946,
29899,
4571,
29950,
29979,
29928,
1672,
18454,
19689,
1430,
29979,
29931,
1964,
2190,
8895,
13,
1678,
396,
462,
462,
9651,
2045,
597,
1636,
29889,
2214,
20778,
29889,
990,
29914,
3473,
392,
29914,
7698,
29950,
13,
13,
1678,
364,
978,
29941,
353,
620,
29889,
657,
29918,
690,
978,
580,
13,
1678,
364,
978,
29941,
353,
364,
978,
29941,
29961,
29900,
1822,
21064,
580,
718,
364,
978,
29941,
29961,
29896,
29901,
1822,
13609,
580,
13,
1678,
1018,
29901,
13,
4706,
364,
978,
29896,
353,
306,
4897,
2477,
1469,
29889,
14676,
262,
29918,
1026,
2153,
29918,
29941,
517,
29896,
29961,
29878,
978,
29941,
29962,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
1018,
29901,
13,
9651,
364,
978,
29896,
353,
9657,
29918,
29941,
517,
29896,
29961,
29878,
978,
29941,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
364,
978,
29896,
353,
525,
6169,
13,
1678,
736,
364,
978,
29896,
13,
13,
13,
1753,
620,
29918,
1761,
29918,
517,
29918,
650,
29918,
15670,
29918,
1807,
29898,
690,
29918,
1761,
1125,
13,
1678,
565,
451,
620,
29918,
1761,
29901,
13,
4706,
736,
313,
29900,
29892,
20569,
13,
13,
1678,
12379,
29918,
333,
353,
6213,
13,
1678,
5665,
29918,
2962,
353,
6213,
13,
1678,
19359,
353,
6629,
13,
1678,
363,
364,
297,
620,
29918,
1761,
29901,
13,
4706,
445,
29918,
333,
353,
364,
29889,
657,
29918,
333,
580,
29961,
29896,
29962,
29871,
396,
10995,
434,
1353,
29892,
1122,
12312,
288,
505,
330,
2547,
13,
4706,
565,
12379,
29918,
333,
29901,
13,
9651,
565,
445,
29918,
333,
1275,
12379,
29918,
333,
470,
445,
29918,
333,
1275,
12379,
29918,
333,
718,
29871,
29896,
29901,
13,
18884,
19359,
4619,
620,
29918,
650,
15670,
29898,
29878,
29897,
13,
9651,
25342,
445,
29918,
333,
1405,
12379,
29918,
333,
718,
29871,
29896,
29901,
13,
18884,
363,
364,
29896,
297,
3464,
29898,
16304,
29918,
333,
718,
29871,
29896,
29892,
445,
29918,
333,
1125,
13,
462,
1678,
19359,
4619,
376,
1213,
13,
18884,
19359,
4619,
620,
29918,
650,
15670,
29898,
29878,
29897,
13,
4706,
1683,
29901,
13,
9651,
5665,
29918,
2962,
353,
445,
29918,
333,
13,
9651,
19359,
4619,
620,
29918,
650,
15670,
29898,
29878,
29897,
13,
4706,
12379,
29918,
333,
353,
445,
29918,
333,
13,
1678,
736,
313,
16506,
29918,
2962,
29892,
25981,
29898,
11762,
876,
13,
13,
13,
1753,
9704,
29918,
650,
29918,
15670,
29918,
1807,
29898,
14153,
1125,
13,
1678,
620,
29918,
1761,
353,
9704,
29918,
16506,
29918,
29874,
559,
781,
29898,
14153,
29897,
13,
1678,
736,
620,
29918,
1761,
29918,
517,
29918,
650,
29918,
15670,
29918,
1807,
29898,
690,
29918,
1761,
29897,
13,
13,
13,
1753,
620,
29918,
7851,
1080,
29898,
690,
29918,
1761,
1125,
13,
1678,
620,
29918,
1761,
29918,
1144,
353,
518,
690,
363,
620,
297,
620,
29918,
1761,
565,
620,
29889,
657,
29918,
333,
580,
29961,
29906,
29962,
2804,
525,
525,
29962,
13,
1678,
736,
620,
29918,
1761,
29918,
1144,
13,
13,
13,
1753,
9704,
29918,
13405,
29898,
14153,
1125,
13,
1678,
396,
3674,
565,
9704,
338,
766,
1285,
262,
6742,
13,
1678,
620,
29918,
1761,
353,
9704,
29889,
657,
29918,
1761,
580,
13,
1678,
620,
29918,
1761,
29918,
13405,
353,
518,
690,
363,
620,
297,
620,
29918,
1761,
565,
620,
29889,
657,
29918,
333,
580,
29961,
29900,
29962,
1275,
525,
29956,
2033,
13,
1678,
736,
620,
29918,
1761,
29918,
13405,
13,
13,
13,
1753,
9704,
29918,
13405,
29918,
333,
29898,
14153,
29892,
4094,
29918,
333,
1125,
13,
1678,
396,
3674,
565,
9704,
338,
766,
1285,
262,
6742,
13,
1678,
620,
29918,
1761,
353,
9704,
29889,
657,
29918,
1761,
580,
13,
1678,
620,
29918,
1761,
29918,
13405,
353,
518,
690,
363,
620,
297,
620,
29918,
1761,
320,
13,
462,
418,
565,
620,
29889,
657,
29918,
333,
580,
29961,
29900,
29962,
1275,
525,
29956,
29915,
322,
620,
29889,
657,
29918,
333,
580,
29961,
29896,
29962,
1275,
4094,
29918,
333,
29962,
13,
1678,
736,
620,
29918,
1761,
29918,
13405,
13,
13,
13,
1753,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
29898,
1807,
29892,
1681,
2671,
353,
29915,
525,
1125,
13,
1678,
396,
7106,
10995,
434,
297,
4768,
459,
1656,
29899,
23712,
3402,
13,
1678,
396,
4635,
291,
2931,
1156,
1353,
338,
11543,
304,
29871,
12858,
13,
1678,
396,
1681,
2671,
338,
525,
525,
363,
15311,
10995,
1041,
13,
1678,
396,
13,
1678,
396,
6455,
29901,
13,
1678,
396,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
877,
29896,
29900,
1495,
13,
1678,
396,
6702,
13420,
29871,
29896,
29900,
29892,
525,
25710,
13,
1678,
396,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
877,
29896,
29896,
29909,
1495,
13,
1678,
396,
6702,
13420,
29871,
29896,
29896,
29892,
525,
29909,
1495,
13,
1678,
282,
353,
337,
29889,
12198,
877,
10780,
29925,
29966,
690,
11762,
14247,
29881,
29974,
5033,
29973,
29925,
29966,
12858,
24566,
29909,
29899,
29999,
29962,
29973,
1262,
1495,
13,
1678,
286,
353,
282,
29889,
4352,
29898,
1807,
29897,
13,
1678,
565,
451,
286,
29901,
13,
4706,
736,
6213,
13,
1678,
620,
11762,
353,
938,
29898,
29885,
29889,
2972,
877,
690,
11762,
8785,
13,
268,
12858,
353,
286,
29889,
2972,
877,
12858,
1495,
13,
268,
12858,
353,
525,
525,
565,
451,
29871,
12858,
1683,
29871,
12858,
13,
1678,
736,
313,
9188,
2671,
29892,
620,
11762,
29892,
29871,
12858,
29897,
13,
13,
13,
1753,
17799,
29918,
690,
333,
29918,
517,
29918,
710,
29898,
690,
333,
1125,
13,
1678,
1681,
2671,
29892,
620,
11762,
29892,
29871,
12858,
353,
10995,
13,
1678,
736,
29850,
1157,
29913,
1642,
4830,
29898,
690,
11762,
29892,
29871,
12858,
29889,
17010,
3101,
13,
13,
1753,
3464,
29918,
710,
29918,
517,
29918,
23583,
29898,
3881,
29918,
710,
1125,
13,
1678,
565,
451,
3464,
29918,
710,
470,
3464,
29918,
710,
1275,
525,
29930,
29915,
470,
3464,
29918,
710,
1275,
525,
6169,
470,
3464,
29918,
710,
29889,
21064,
580,
1275,
525,
9818,
2396,
13,
4706,
396,
7605,
599,
13,
4706,
736,
6213,
13,
1678,
3464,
29918,
5451,
353,
3464,
29918,
710,
29889,
5451,
877,
29899,
1495,
13,
1678,
565,
7431,
29898,
3881,
29918,
5451,
29897,
1275,
29871,
29900,
29901,
13,
4706,
396,
7605,
599,
13,
4706,
736,
6213,
13,
1678,
25342,
7431,
29898,
3881,
29918,
5451,
29897,
1275,
29871,
29896,
29901,
13,
4706,
620,
29918,
2962,
353,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
29898,
3881,
29918,
5451,
29961,
29900,
2314,
13,
4706,
620,
29918,
4951,
728,
353,
620,
29918,
2962,
13,
1678,
1683,
29901,
13,
4706,
620,
29918,
2962,
353,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
29898,
3881,
29918,
5451,
29961,
29900,
2314,
13,
4706,
620,
29918,
4951,
728,
353,
17799,
29918,
710,
29918,
517,
29918,
690,
333,
29898,
3881,
29918,
5451,
29961,
29896,
2314,
13,
1678,
396,
690,
29918,
4951,
728,
29961,
29896,
29962,
4619,
29871,
29896,
13,
1678,
736,
313,
690,
29918,
2962,
29892,
620,
29918,
4951,
728,
29897,
13,
13,
13,
1753,
1831,
29918,
690,
333,
1041,
29918,
3166,
29918,
14153,
29898,
14153,
29892,
3579,
19290,
1125,
13,
1678,
396,
9704,
29901,
4768,
459,
1656,
9704,
13,
1678,
396,
937,
29918,
690,
29901,
937,
10995,
434,
1178,
304,
1831,
29892,
321,
29889,
29887,
29889,
6702,
13420,
29896,
5501,
25710,
13,
1678,
396,
1833,
29918,
690,
29901,
1833,
10995,
434,
304,
1831,
29892,
321,
29889,
29887,
29889,
6702,
13420,
29896,
29900,
29892,
525,
29909,
1495,
13,
1678,
396,
17261,
29918,
2798,
29901,
1831,
525,
29887,
481,
29918,
2798,
29915,
10995,
1041,
1434,
937,
29918,
690,
470,
1156,
1833,
29918,
690,
13,
1678,
396,
1831,
599,
10995,
1041,
565,
694,
1852,
398,
1934,
4944,
13,
1678,
620,
29918,
1761,
29918,
7340,
353,
9704,
29918,
16506,
29918,
29874,
559,
781,
29898,
14153,
29897,
13,
1678,
1178,
29918,
1761,
353,
518,
690,
29889,
657,
29918,
333,
580,
363,
620,
297,
620,
29918,
1761,
29918,
7340,
29962,
13,
13,
1678,
620,
29918,
23583,
353,
9049,
5085,
1839,
690,
29918,
23583,
2033,
565,
525,
690,
29918,
23583,
29915,
297,
9049,
5085,
1683,
6213,
13,
1678,
17261,
29918,
2798,
353,
9049,
5085,
1839,
29887,
481,
29918,
2798,
2033,
565,
525,
29887,
481,
29918,
2798,
29915,
297,
9049,
5085,
1683,
29871,
29900,
13,
1678,
565,
620,
29918,
23583,
29901,
13,
4706,
313,
4102,
29918,
690,
29892,
1833,
29918,
690,
29897,
353,
620,
29918,
23583,
13,
1678,
1683,
29901,
13,
4706,
937,
29918,
690,
353,
9049,
5085,
1839,
4102,
29918,
690,
2033,
565,
525,
4102,
29918,
690,
29915,
297,
9049,
5085,
1683,
6213,
13,
4706,
1833,
29918,
690,
29871,
353,
9049,
5085,
1839,
4230,
29918,
690,
2033,
29871,
565,
525,
4230,
29918,
690,
29915,
29871,
297,
9049,
5085,
1683,
6213,
13,
13,
1678,
937,
29918,
2248,
29892,
1833,
29918,
2248,
353,
29871,
29900,
29892,
7431,
29898,
690,
29918,
1761,
29918,
7340,
29897,
13,
1678,
565,
937,
29918,
690,
29901,
13,
4706,
1018,
29901,
13,
9651,
937,
29918,
2248,
353,
1178,
29918,
1761,
29889,
2248,
29898,
4102,
29918,
690,
29897,
13,
4706,
5174,
29901,
13,
9651,
12020,
11374,
2392,
703,
1666,
333,
434,
525,
8875,
29915,
338,
714,
310,
5665,
3464,
1642,
4830,
29898,
4102,
29918,
690,
876,
13,
1678,
565,
1833,
29918,
690,
29901,
13,
4706,
1018,
29901,
13,
9651,
1833,
29918,
2248,
353,
1178,
29918,
1761,
29889,
2248,
29898,
4230,
29918,
690,
29897,
13,
4706,
5174,
29901,
13,
9651,
12020,
11374,
2392,
703,
1666,
333,
434,
525,
8875,
29915,
338,
714,
310,
5665,
3464,
1642,
4830,
29898,
4230,
29918,
690,
876,
13,
13,
1678,
565,
937,
29918,
690,
322,
1833,
29918,
690,
29901,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
29961,
4102,
29918,
2248,
29901,
1833,
29918,
2248,
718,
29871,
29896,
29962,
13,
1678,
25342,
937,
29918,
690,
322,
313,
17261,
29918,
2798,
338,
451,
6213,
29871,
1125,
13,
4706,
565,
937,
29918,
2248,
448,
17261,
29918,
2798,
529,
29871,
29900,
29901,
13,
9651,
17261,
29918,
2798,
353,
937,
29918,
2248,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
29961,
4102,
29918,
2248,
448,
17261,
29918,
2798,
584,
937,
29918,
2248,
29962,
13,
1678,
25342,
1833,
29918,
690,
322,
313,
17261,
29918,
2798,
338,
451,
6213,
29871,
1125,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
29961,
4230,
29918,
2248,
718,
29871,
29896,
584,
1833,
29918,
2248,
718,
29871,
29896,
718,
17261,
29918,
2798,
29962,
13,
1678,
25342,
937,
29918,
690,
322,
313,
17261,
29918,
2798,
338,
6213,
29871,
1125,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
29961,
4102,
29918,
2248,
584,
29962,
13,
1678,
25342,
1833,
29918,
690,
322,
313,
17261,
29918,
2798,
338,
6213,
29871,
1125,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
7503,
1833,
29918,
2248,
718,
29871,
29896,
29962,
13,
1678,
1683,
29901,
13,
4706,
736,
620,
29918,
1761,
29918,
7340,
13,
13,
13,
1753,
12301,
29918,
710,
29918,
517,
29918,
842,
29898,
8678,
29918,
710,
1125,
13,
1678,
12301,
29918,
842,
353,
731,
580,
13,
1678,
565,
451,
12301,
29918,
710,
470,
12301,
29918,
710,
1275,
525,
29930,
29915,
470,
12301,
29918,
710,
1275,
525,
6169,
470,
12301,
29918,
710,
29889,
21064,
580,
1275,
525,
9818,
2396,
13,
4706,
736,
12301,
29918,
842,
13,
1678,
12301,
29918,
1761,
353,
12301,
29918,
710,
29889,
5451,
29317,
1495,
13,
1678,
363,
263,
297,
12301,
29918,
1761,
29901,
13,
4706,
263,
353,
263,
29889,
17010,
580,
13,
4706,
12301,
29918,
842,
29889,
1202,
29898,
29874,
29897,
13,
1678,
736,
12301,
29918,
842,
13,
13,
13,
1753,
1831,
29918,
271,
4835,
29918,
3166,
29918,
690,
29918,
1761,
29898,
690,
29918,
1761,
29892,
2143,
29918,
8678,
29918,
7039,
29918,
842,
1125,
13,
1678,
12301,
29918,
1761,
353,
5159,
13,
1678,
363,
364,
297,
620,
29918,
1761,
29901,
13,
4706,
363,
263,
297,
364,
29889,
657,
29918,
1761,
7295,
13,
9651,
565,
2143,
29918,
8678,
29918,
7039,
29918,
842,
322,
263,
29889,
657,
29918,
978,
580,
297,
2143,
29918,
8678,
29918,
7039,
29918,
842,
29901,
13,
18884,
12301,
29918,
1761,
29889,
4397,
29898,
29874,
29897,
13,
9651,
565,
451,
2143,
29918,
8678,
29918,
7039,
29918,
842,
29901,
13,
18884,
396,
731,
338,
4069,
29892,
9773,
599,
28422,
13,
18884,
12301,
29918,
1761,
29889,
4397,
29898,
29874,
29897,
13,
1678,
565,
2143,
29918,
8678,
29918,
7039,
29918,
842,
322,
451,
12301,
29918,
1761,
29901,
13,
4706,
12020,
11374,
2392,
703,
4178,
4835,
451,
2198,
297,
3829,
1159,
13,
1678,
736,
12301,
29918,
1761,
13,
13,
13,
1753,
1423,
29918,
690,
29918,
1761,
29918,
275,
29918,
20621,
681,
29898,
690,
29918,
1761,
1125,
13,
1678,
12379,
29918,
333,
353,
6213,
13,
1678,
363,
364,
297,
620,
29918,
1761,
29901,
13,
4706,
445,
29918,
333,
353,
364,
29889,
657,
29918,
333,
580,
29961,
29896,
29962,
29871,
396,
10995,
434,
1353,
29892,
1122,
12312,
288,
505,
330,
2547,
13,
4706,
565,
12379,
29918,
333,
29901,
13,
9651,
565,
451,
313,
1366,
29918,
333,
1275,
12379,
29918,
333,
470,
445,
29918,
333,
1275,
12379,
29918,
333,
718,
29871,
29896,
1125,
13,
18884,
736,
7700,
13,
4706,
12379,
29918,
333,
353,
445,
29918,
333,
13,
1678,
736,
5852,
13,
13,
13,
1753,
679,
29918,
690,
29918,
392,
29918,
271,
4835,
29898,
14153,
29918,
690,
29918,
7340,
29892,
620,
1217,
29892,
2143,
29918,
690,
29918,
1761,
29918,
2435,
29892,
2143,
29918,
8678,
29918,
7039,
29918,
842,
1125,
13,
1678,
1018,
29901,
13,
4706,
620,
29918,
1761,
29918,
517,
29918,
9202,
353,
9704,
29918,
690,
29918,
7340,
29961,
690,
1217,
29901,
620,
1217,
718,
2143,
29918,
690,
29918,
1761,
29918,
2435,
29962,
13,
1678,
5174,
29901,
13,
4706,
736,
313,
8516,
29892,
6213,
29897,
13,
1678,
565,
1423,
29918,
690,
29918,
1761,
29918,
275,
29918,
20621,
681,
29898,
690,
29918,
1761,
29918,
517,
29918,
9202,
1125,
13,
4706,
12301,
29918,
1761,
29918,
517,
29918,
9202,
353,
1831,
29918,
271,
4835,
29918,
3166,
29918,
690,
29918,
1761,
29898,
690,
29918,
1761,
29918,
517,
29918,
9202,
29892,
2143,
29918,
8678,
29918,
7039,
29918,
842,
29897,
13,
4706,
736,
313,
690,
29918,
1761,
29918,
517,
29918,
9202,
29892,
12301,
29918,
1761,
29918,
517,
29918,
9202,
29897,
13,
1678,
1683,
29901,
13,
4706,
396,
321,
2158,
703,
1666,
333,
434,
1051,
338,
766,
1285,
262,
681,
29901,
6571,
448,
6571,
1642,
4830,
29898,
690,
29918,
1761,
29918,
517,
29918,
9202,
29961,
29900,
1822,
657,
29918,
8159,
29918,
333,
3285,
13,
4706,
396,
462,
462,
462,
418,
620,
29918,
1761,
29918,
517,
29918,
9202,
14352,
29896,
1822,
657,
29918,
333,
22130,
13,
4706,
736,
313,
8516,
29892,
6213,
29897,
13,
13,
13,
1753,
16732,
29918,
18837,
29898,
1761,
29918,
974,
29918,
5325,
29918,
392,
29918,
3972,
29879,
1125,
13,
1678,
1121,
353,
5159,
13,
1678,
363,
285,
297,
1051,
29918,
974,
29918,
5325,
29918,
392,
29918,
3972,
29879,
29901,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
29888,
1125,
13,
9651,
1121,
29889,
4397,
29898,
29888,
29897,
13,
4706,
25342,
2897,
29889,
2084,
29889,
275,
3972,
29898,
29888,
1125,
13,
9651,
1014,
3972,
29879,
353,
518,
359,
29889,
2084,
29889,
7122,
29898,
29888,
29892,
270,
29897,
363,
270,
297,
2897,
29889,
1761,
3972,
29898,
29888,
4638,
13,
9651,
1121,
29889,
21843,
29898,
3757,
25397,
29918,
18837,
29898,
1491,
3972,
29879,
876,
13,
1678,
736,
1121,
13,
268,
13,
2
] |
instance/config.py | Alweezy/cp2-bucketlist-api | 1 | 69746 | <reponame>Alweezy/cp2-bucketlist-api
import os
class Config(object):
"""Parent configuration class."""
DEBUG = False
CSRF_ENABLED = True
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL')
class DevelopmentConfig(Config):
"""Configurations for Development."""
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/flask_db'
class TestingConfig(Config):
"""Configurations for Testing, with a separate test database."""
TESTING = True
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_db'
DEBUG = True
class StagingConfig(Config):
"""Configurations for Staging."""
DEBUG = True
class ProductionConfig(Config):
"""Configurations for Production."""
DEBUG = False
TESTING = False
app_config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'staging': StagingConfig,
'production': ProductionConfig,
}
| [
1,
529,
276,
1112,
420,
29958,
2499,
705,
29872,
1537,
29914,
6814,
29906,
29899,
21454,
1761,
29899,
2754,
13,
5215,
2897,
13,
13,
13,
1990,
12782,
29898,
3318,
1125,
13,
1678,
9995,
9780,
5285,
770,
1213,
15945,
13,
1678,
21681,
353,
7700,
13,
1678,
315,
14098,
29943,
29918,
1430,
6181,
29928,
353,
5852,
13,
1678,
3725,
22245,
29911,
29918,
10818,
353,
2897,
29889,
657,
6272,
877,
1660,
22245,
29911,
29918,
10818,
1495,
13,
1678,
3758,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
353,
2897,
29889,
657,
6272,
877,
25832,
27982,
29918,
4219,
1495,
13,
13,
13,
1990,
14650,
3991,
29898,
3991,
1125,
13,
1678,
9995,
3991,
332,
800,
363,
14650,
1213,
15945,
13,
1678,
21681,
353,
5852,
13,
1678,
3758,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
353,
525,
29272,
597,
7640,
29914,
1579,
1278,
29918,
2585,
29915,
13,
13,
13,
1990,
4321,
292,
3991,
29898,
3991,
1125,
13,
1678,
9995,
3991,
332,
800,
363,
4321,
292,
29892,
411,
263,
5004,
1243,
2566,
1213,
15945,
13,
1678,
17067,
1254,
4214,
353,
5852,
13,
1678,
3758,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
353,
525,
29272,
597,
7640,
29914,
1688,
29918,
2585,
29915,
13,
1678,
21681,
353,
5852,
13,
13,
13,
1990,
624,
6751,
3991,
29898,
3991,
1125,
13,
1678,
9995,
3991,
332,
800,
363,
624,
6751,
1213,
15945,
13,
1678,
21681,
353,
5852,
13,
13,
13,
1990,
19561,
3991,
29898,
3991,
1125,
13,
1678,
9995,
3991,
332,
800,
363,
19561,
1213,
15945,
13,
1678,
21681,
353,
7700,
13,
1678,
17067,
1254,
4214,
353,
7700,
13,
13,
13,
932,
29918,
2917,
353,
426,
13,
1678,
525,
25431,
2396,
14650,
3991,
29892,
13,
1678,
525,
13424,
2396,
4321,
292,
3991,
29892,
13,
1678,
525,
303,
6751,
2396,
624,
6751,
3991,
29892,
13,
1678,
525,
24601,
2396,
19561,
3991,
29892,
13,
29913,
13,
2
] |
migrations/0018_auto_20180326_0331.py | tkhjp/editor_tkh | 0 | 77708 | <gh_stars>0
# Generated by Django 2.0.2 on 2018-03-26 03:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editor', '0017_knowledge_point_list_grade'),
]
operations = [
migrations.AlterField(
model_name='question_upload',
name='years_of_question',
field=models.CharField(choices=[('p2', '小二'), ('p3', '小三'), ('p2', '小四'), ('p2', '小五'), ('p2', '小六')], default='p5', max_length=2),
),
]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
3251,
630,
491,
15337,
29871,
29906,
29889,
29900,
29889,
29906,
373,
29871,
29906,
29900,
29896,
29947,
29899,
29900,
29941,
29899,
29906,
29953,
29871,
29900,
29941,
29901,
29941,
29896,
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,
15204,
742,
525,
29900,
29900,
29896,
29955,
29918,
28385,
5485,
29918,
3149,
29918,
1761,
29918,
8228,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
12470,
29918,
9009,
742,
13,
9651,
1024,
2433,
6360,
29879,
29918,
974,
29918,
12470,
742,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
1859,
1575,
11759,
877,
29886,
29906,
742,
525,
30446,
30685,
5477,
6702,
29886,
29941,
742,
525,
30446,
30457,
5477,
6702,
29886,
29906,
742,
525,
30446,
30928,
5477,
6702,
29886,
29906,
742,
525,
30446,
30904,
5477,
6702,
29886,
29906,
742,
525,
30446,
31304,
1495,
1402,
2322,
2433,
29886,
29945,
742,
4236,
29918,
2848,
29922,
29906,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
Oefeningen/standalone/list_comprehension_4.py | Seviran/Python_3 | 0 | 24049 |
string_input = "amazing"
vowels = "aeiou"
answer = [char for char in string_input if char not in vowels]
print(answer)
| [
1,
29871,
13,
1807,
29918,
2080,
353,
376,
314,
834,
292,
29908,
13,
29894,
340,
1379,
353,
376,
3660,
29875,
283,
29908,
13,
12011,
353,
518,
3090,
363,
1373,
297,
1347,
29918,
2080,
565,
1373,
451,
297,
325,
340,
1379,
29962,
13,
2158,
29898,
12011,
29897,
13,
2
] |
source/methods_upload_workspace_stats.py | CheyenneNS/metrics | 0 | 1603628 | <reponame>CheyenneNS/metrics
from pymongo import MongoClient
from pymongo import ReadPreference
from biokbase.workspace.client import Workspace
import json as _json
import os
import mysql.connector as mysql
import requests
import time
from datetime import date
#import pprint
requests.packages.urllib3.disable_warnings()
#pp = pprint.PrettyPrinter(indent=4)
# NOTE get_user_info_from_auth2 sets up the initial dict.
#The following functions update certain fields in the dict.
# So get_user_info_from_auth2 must be called before get_internal_users and get_user_orgs_count
metrics_mysql_password = os.environ['METRICS_MYSQL_PWD']
mongoDB_metrics_connection = os.environ['MONGO_PATH']
sql_host = os.environ['SQL_HOST']
query_on = os.environ['QUERY_ON']
ws_url = os.environ['WS_URL']
ws_user_token = os.environ["METRICS_WS_USER_TOKEN"]
to_workspace = os.environ['WRK_SUFFIX']
def get_workspaces(db):
"""
gets narrative workspaces information for non temporary workspaces
"""
workspaces_dict = {}
#Get all the legitimate workspaces and their respective user (saved(not_temp))
workspaces_cursor = db.workspaces.find({"moddate": {"$exists":True}},
# IF NOT DELETED NARRATIVES {"del" : False, "moddate": {"$exists":True}},
# IF ONLY SAVED NARRATIVES "meta" : {"k" : "is_temporary", "v" : "false"} },
{"owner":1,"ws":1,"moddate":1,"del":1,"_id":0})
for record in workspaces_cursor:
if record["ws"] != 615:
is_deleted_ws = 0
if record["del"] == True:
is_deleted_ws = 1
workspaces_dict[record["ws"]] = {"ws_id" : record["ws"],
"username" : record["owner"],
"mod_date" : record["moddate"],
"initial_save_date" : None,
"top_lvl_object_count" : 0,
"total_object_count" : 0,
"visible_app_cells_count" : 0,
"code_cells_count" : 0,
"narrative_version" : 0,
"hidden_object_count" : 0,
"deleted_object_count" : 0,
"total_size" : 0,
'top_lvl_size' : 0,
"is_public" : 0,
"is_deleted" : is_deleted_ws,
"is_temporary" : None,
"number_of_shares" : 0
}
workspace_is_temporary_cursor = db.workspaces.find({"moddate": {"$exists":True},
#{"del" : False,"moddate": {"$exists":True},
"meta" : {"k" : "is_temporary", "v" : "true"} },
{"ws":1,"_id":0})
for record in workspace_is_temporary_cursor:
workspaces_dict[record["ws"]]["is_temporary"] = 1
workspace_not_temporary_cursor = db.workspaces.find({"moddate": {"$exists":True},
#{"del" : False, "moddate": {"$exists":True},
"meta" : {"k" : "is_temporary", "v" : "false"} },
{"ws":1,"_id":0})
for record in workspace_not_temporary_cursor:
workspaces_dict[record["ws"]]["is_temporary"] = 0
return workspaces_dict
def get_workspace_shares(db, workspaces_dict):
"""
gets number of shares per workspace
"""
aggregation_string=[
{"$match" : {"perm" : { "$in": [ 10,20,30 ]}}},
{"$group" : {"_id" : "$id", "shared_count" : { "$sum" : 1 }}}]
all_shared_perms_cursor=db.workspaceACLs.aggregate(aggregation_string)
for record in db.workspaceACLs.aggregate(aggregation_string):
if record["_id"] in workspaces_dict:
workspaces_dict[record["_id"]]["number_of_shares"] = record["shared_count"]
return workspaces_dict
def get_public_workspaces(db, workspaces_dict):
"""
Gets IDs of public workspaces
"""
public_workspaces_cursor = db.workspaceACLs.find({"user" : "*"},{"id":1,"_id":0})
for record in public_workspaces_cursor:
if record["id"] in workspaces_dict:
workspaces_dict[record["id"]]["is_public"] = 1
return workspaces_dict
""" OLD FOR APP CELL COUNTING NOW HANDLED BY NEW FUNCTION
def get_app_cell_count(wsadmin, narrative_ref, workspaces_with_app_cell_oddities):
#
Gets the number of App Cells in the narrative
See documentation for WS administer here
https://github.com/kbase/workspace_deluxe/blob/02217e4d63da8442d9eed6611aaa790f173de58e/docsource/administrationinterface.rst
#
info = wsadmin.administer({'command': "getObjectInfo",
'params': {"objects": [{"ref": narrative_ref}], "includeMetadata": 1}
})["infos"][0]
meta = info[10]
total_app_cells = 0
# print("META: " + str(meta))
for key in meta:
if key.startswith("method."):
# if(isinstance(meta[key], int)):
try:
total_app_cells += int(meta[key])
except ValueError:
workspaces_with_app_cell_oddities.add(narrative_ref)
print("META: " + str(meta))
return (total_app_cells, workspaces_with_app_cell_oddities)
"""
def get_narrative_cell_counts(wsadmin, narrative_ref):
"""
Gets the number of App Cells and Code Cells in the narrative
See documentation for WS administer here
https://github.com/kbase/workspace_deluxe/blob/02217e4d63da8442d9eed6611aaa790f173de58e/docsource/administrationinterface.rst
"""
app_count = 0
code_count = 0
is_suspect = 0
try:
nar_obj = wsadmin.administer({'command': "getObjects",
'params': {"objects": [{"ref": narrative_ref}]}})["data"][0]["data"]
if "cells" in nar_obj:
for cell in nar_obj["cells"]:
if(cell["metadata"].get("kbase", {}).get("type") == "app"):
app_count += 1
elif(cell["metadata"].get("kbase", {}).get("type") == "code"):
code_count += 1
return(app_count, code_count, is_suspect)
except:
# Shock node is suspect
is_suspect = 1
print("Narrative Ref : " + narrative_ref + " has a shock node issue")
#try running on the previous version of the narrative if exists
#if previous version does not exist return zeros
(ws_id, obj_id, obj_ver) = narrative_ref.split("/")
if int(obj_ver) > 1:
new_ref = ws_id + "/" + obj_id + "/" + str(int(obj_ver) - 1)
(app_count, code_count, dummy) = get_narrative_cell_counts(wsadmin, new_ref)
return(app_count, code_count, is_suspect)
def get_kbase_staff(db_connection):
"""
get list of KBase staff
"""
cursor = db_connection.cursor()
query = "use "+query_on
cursor.execute(query)
#get all existing users
kbase_staff = set()
query = "select username from metrics.user_info where kb_internal_user = 1;"
cursor.execute(query)
for (username) in cursor:
kbase_staff.add(username[0])
return kbase_staff
def get_objects(db, workspaces_dict, db_connection):
"""
get object counts
as well as hidden del, size, is_narrative informationf for the workspace.
"""
wsadmin = Workspace(ws_url, token=ws_user_token)
#OBJECT COUNTS ACROSS ALL WORKSPACES.
object_counts_dict = dict()
#OBJECT COUNTS ACROSS USER WORKSPACES
users_object_counts_dict = dict()
#SAME FOR USER AND ALL
# {object_type_full : { "object_type" : ...,
# "object_spec_version" : ...,
# "last_mod_date" : max_date ,
# "top_lvl_object_count" : # ,
# "total_object_count" : # ,
# "public_object_count" : # ,
# "private_object_count" : # ,
# "hidden_object_count" : # ,
# "deleted_object_count" : # ,
# "copy_count" : # ,
# "total_size" : # ,
# "top_lvl_size" : #}}
kbase_staff = get_kbase_staff(db_connection)
# workspaces_with_app_cell_oddities = set() #keeping track of workspaces with odd metadata where app cell counting fails
narrative_refs_with_shock_node_issues = set() #keep track of narrative refs with shocknode issues to keep track of later.
###########################
#few debugging lines to do a smaller set of workspaces.
###########################
# ws_limit = 1 #For debugging purposes, if ws_limit is None then it does all workspaces.
# ws_counter = 0
# for ws_id in sorted(workspaces_dict.keys()):
# ws_counter += 1
# if ws_counter > ws_limit :
# del workspaces_dict[ws_id]
###########################
#debugging lines to minimal Workspaces
# temp_dict = dict()
# temp_dict[49114] = workspaces_dict[49114]
# temp_dict[3] = workspaces_dict[3]
# temp_dict[5009] = workspaces_dict[5009]
# temp_dict[1000] = workspaces_dict[1000]
# temp_dict[53462] = workspaces_dict[53462]
# temp_dict[324] = workspaces_dict[324]
# workspaces_dict.clear()
# workspaces_dict = temp_dict
###############
for ws_id in sorted(workspaces_dict.keys()):
print("PROCESSING WS : " + str(ws_id))
is_narrative = False
top_level_lookup_dict = dict()
is_public_flag = workspaces_dict[ws_id]["is_public"]
tl_ws_obj_cursor = db.workspaceObjects.find({"ws":ws_id},{"id":1,"numver":1,"del":1,"hide":1,"_id":0})
for tl_object in tl_ws_obj_cursor:
top_level_lookup_dict[tl_object["id"]] = {"numver" : tl_object["numver"],
"del" : tl_object["del"],
"hide" : tl_object["hide"]}
ws_obj_vers_cursor = db.workspaceObjVersions.find({"ws":ws_id},{"type":1,"id":1,"ver":1,"size":1, "savedate":1,"copied":1,"_id":0});
for ws_obj_ver in ws_obj_vers_cursor:
object_type_full = ws_obj_ver["type"]
(object_type, object_spec_version) = object_type_full.split("-")
obj_id = ws_obj_ver["id"]
obj_ver = ws_obj_ver["ver"]
obj_size = ws_obj_ver["size"]
top_obj_size = 0
obj_save_date = ws_obj_ver["savedate"]
obj_copied = 0
if ws_obj_ver["copied"] is not None:
obj_copied = 1
is_hidden = 0
is_deleted = 0
is_top_level = 0
workspaces_dict[ws_id]["total_object_count"] += 1
workspaces_dict[ws_id]["total_size"] += obj_size
if obj_ver == top_level_lookup_dict[obj_id]["numver"]:
#means have maxed version of the object top_level
is_top_level = 1
top_obj_size = obj_size
workspaces_dict[ws_id]["top_lvl_size"] += obj_size
#IF A NARRATIVE OBJECT, UPDATE THE WS dict
if object_type == "KBaseNarrative.Narrative":
workspaces_dict[ws_id]["narrative_version"] = obj_ver
if top_level_lookup_dict[obj_id]["del"]:
workspaces_dict[ws_id]["visible_app_cells_count"] = 0
workspaces_dict[ws_id]["code_cells_count"] = 0
# else:
# (workspaces_dict[ws_id]["visible_app_cells_count"],workspaces_with_app_cell_oddities) = get_app_cell_count(wsadmin,
# str(ws_id) + "/" + str(obj_id),
# workspaces_with_app_cell_oddities)
else:
(workspaces_dict[ws_id]["visible_app_cells_count"], workspaces_dict[ws_id]["code_cells_count"], is_suspect) = \
get_narrative_cell_counts(wsadmin, str(ws_id) + "/" + str(obj_id) + "/" + str(obj_ver))
if is_suspect == 1:
narrative_refs_with_shock_node_issues.add(str(ws_id) + "/" + str(obj_id) + "/" + str(obj_ver))
#Get Workspace numbers
workspaces_dict[ws_id]["top_lvl_object_count"] += 1
if top_level_lookup_dict[obj_id]["hide"]:
workspaces_dict[ws_id]["hidden_object_count"] += obj_ver
if top_level_lookup_dict[obj_id]["del"]:
workspaces_dict[ws_id]["deleted_object_count"] += obj_ver
if obj_ver == 1 and object_type == "KBaseNarrative.Narrative":
workspaces_dict[ws_id]["initial_save_date"] = obj_save_date
if top_level_lookup_dict[obj_id]["hide"]:
is_hidden = 1
if top_level_lookup_dict[obj_id]["del"]:
is_deleted = 1
if object_type_full not in object_counts_dict:
#First time seeing this object full type. Initialize in the dict
object_counts_dict[object_type_full] = dict()
object_counts_dict[object_type_full]["object_type"] = object_type
object_counts_dict[object_type_full]["object_spec_version"] = object_spec_version
object_counts_dict[object_type_full]["last_mod_date"] = obj_save_date
object_counts_dict[object_type_full]["total_size"] = obj_size
object_counts_dict[object_type_full]["top_lvl_size"] = top_obj_size
object_counts_dict[object_type_full]["total_object_count"] = 1
object_counts_dict[object_type_full]["copy_count"] = obj_copied
object_counts_dict[object_type_full]["top_lvl_object_count"] = is_top_level
object_counts_dict[object_type_full]["hidden_object_count"] = is_hidden
object_counts_dict[object_type_full]["deleted_object_count"] = is_deleted
object_counts_dict[object_type_full]["public_object_count"] = is_public_flag
object_counts_dict[object_type_full]["max_object_size"] = obj_size
if is_public_flag == 1:
object_counts_dict[object_type_full]["private_object_count"] = 0
else:
object_counts_dict[object_type_full]["private_object_count"] = 1
else:
#Exists, add up values accordingly.
#check if date is greater than last_mod_date
standing_date = object_counts_dict[object_type_full]["last_mod_date"]
if obj_save_date > standing_date:
object_counts_dict[object_type_full]["last_mod_date"] = obj_save_date
standing_max_object_size = object_counts_dict[object_type_full]["max_object_size"]
if obj_size > standing_max_object_size:
object_counts_dict[object_type_full]["max_object_size"] = obj_size
object_counts_dict[object_type_full]["total_size"] += obj_size
object_counts_dict[object_type_full]["top_lvl_size"] += top_obj_size
object_counts_dict[object_type_full]["total_object_count"] += 1
object_counts_dict[object_type_full]["copy_count"] += obj_copied
object_counts_dict[object_type_full]["top_lvl_object_count"] += is_top_level
object_counts_dict[object_type_full]["hidden_object_count"] += is_hidden
object_counts_dict[object_type_full]["deleted_object_count"] += is_deleted
object_counts_dict[object_type_full]["public_object_count"] += is_public_flag
if is_public_flag == 0:
object_counts_dict[object_type_full]["private_object_count"] += 1
# SAME THING AS ABOVE BUT FOR USER ONLY WORKSPACE OBJECTS
if workspaces_dict[ws_id]["username"] not in kbase_staff:
if object_type_full not in users_object_counts_dict:
#First time seeing this object full type for users data. Initialize in the dict
users_object_counts_dict[object_type_full] = dict()
users_object_counts_dict[object_type_full]["object_type"] = object_type
users_object_counts_dict[object_type_full]["object_spec_version"] = object_spec_version
users_object_counts_dict[object_type_full]["last_mod_date"] = obj_save_date
users_object_counts_dict[object_type_full]["total_size"] = obj_size
users_object_counts_dict[object_type_full]["top_lvl_size"] = top_obj_size
users_object_counts_dict[object_type_full]["total_object_count"] = 1
users_object_counts_dict[object_type_full]["copy_count"] = obj_copied
users_object_counts_dict[object_type_full]["top_lvl_object_count"] = is_top_level
users_object_counts_dict[object_type_full]["hidden_object_count"] = is_hidden
users_object_counts_dict[object_type_full]["deleted_object_count"] = is_deleted
users_object_counts_dict[object_type_full]["public_object_count"] = is_public_flag
users_object_counts_dict[object_type_full]["max_object_size"] = obj_size
if is_public_flag == 1:
users_object_counts_dict[object_type_full]["private_object_count"] = 0
else:
users_object_counts_dict[object_type_full]["private_object_count"] = 1
else:
#Exists, add up values accordingly.
#check if date is greater than last_mod_date
standing_date = users_object_counts_dict[object_type_full]["last_mod_date"]
if obj_save_date > standing_date:
users_object_counts_dict[object_type_full]["last_mod_date"] = obj_save_date
standing_max_object_size = users_object_counts_dict[object_type_full]["max_object_size"]
if obj_size > standing_max_object_size:
users_object_counts_dict[object_type_full]["max_object_size"] = obj_size
users_object_counts_dict[object_type_full]["total_size"] += obj_size
users_object_counts_dict[object_type_full]["top_lvl_size"] += top_obj_size
users_object_counts_dict[object_type_full]["total_object_count"] += 1
users_object_counts_dict[object_type_full]["copy_count"] += obj_copied
users_object_counts_dict[object_type_full]["top_lvl_object_count"] += is_top_level
users_object_counts_dict[object_type_full]["hidden_object_count"] += is_hidden
users_object_counts_dict[object_type_full]["deleted_object_count"] += is_deleted
users_object_counts_dict[object_type_full]["public_object_count"] += is_public_flag
if is_public_flag == 0:
users_object_counts_dict[object_type_full]["private_object_count"] += 1
return (workspaces_dict, object_counts_dict, users_object_counts_dict, narrative_refs_with_shock_node_issues)
def upload_workspace_stats():
"""
Is the "main" function to get and upload both workspace data as well as workspace object summary stats
"""
start_time = time.time()
#connect to mysql
db_connection = mysql.connect(
host = sql_host,
user = "metrics",
passwd = <PASSWORD>,
database = "metrics"
)
cursor = db_connection.cursor()
query = "use "+query_on
cursor.execute(query)
#CHECK IF THIS WAS DONE THIS MONTH ALREADY. IT IS MEANT TO BE RUN ONCE PER MONTH (IDEALLY THE FIRST OF THE MONTH)
today = date.today()
current_month = str(today.year) + "-" + today.strftime('%m')
query = "select DATE_FORMAT(max(record_date),'%Y-%m') from metrics.users_workspace_object_counts";
cursor.execute(query)
for (db_date) in cursor:
db_date_month = db_date[0]
if db_date_month == current_month:
print("THE WORKSPACE and WS OBJECTS COUNTS UPLOADER HAS BEEN RUN THIS MONTH. THE PROGRAM WILL EXIT")
exit()
else:
print("IT HAS NOT BEEN RUN THIS MONTH, WE WILL RUN THE PROGRAM")
client= MongoClient(mongoDB_metrics_connection+to_workspace)
db = client.workspace
workspaces_dict = get_workspaces(db)
get_ws_top_info_time = time.time() - start_time
workspaces_dict = get_workspace_shares(db, workspaces_dict)
workspaces_dict = get_public_workspaces(db, workspaces_dict)
(workspaces_dict, object_counts_dict, users_object_counts_dict, narrative_refs_with_shock_node_issues) = \
get_objects(db, workspaces_dict, db_connection)
print("TOTAL WS Number : " + str(len(workspaces_dict)))
gather_time = time.time() - start_time
# print("--- gather data %s seconds ---" % (gather_time))
# print("WORKSPACE DICT : ")
# pp.pprint(workspaces_dict)
# print("OBJECT COUNTS DICT : ")
# pp.pprint(object_counts_dict)
#WORKSPACES UPLOADING
prep_cursor = db_connection.cursor(prepared=True)
workspaces_insert_statement = "insert into metrics.workspaces "\
"(ws_id, username, mod_date, initial_save_date, record_date, "\
"top_lvl_object_count, total_object_count, "\
"visible_app_cells_count, code_cells_count, narrative_version, "\
"hidden_object_count, deleted_object_count, "\
"total_size, top_lvl_size, is_public, "\
"is_temporary, is_deleted, number_of_shares) "\
"values(%s,%s, %s, %s, now(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);"
for ws_id in sorted(workspaces_dict.keys()):
# print("PROCESSING WS: " + str(ws_id) + " USERNAME: " + workspaces_dict[ws_id]['username'])
input = (ws_id, workspaces_dict[ws_id]['username'], workspaces_dict[ws_id]['mod_date'],
workspaces_dict[ws_id]['initial_save_date'],
workspaces_dict[ws_id]['top_lvl_object_count'], workspaces_dict[ws_id]['total_object_count'],
workspaces_dict[ws_id]['visible_app_cells_count'],workspaces_dict[ws_id]['code_cells_count'],
workspaces_dict[ws_id]['narrative_version'],
workspaces_dict[ws_id]['hidden_object_count'], workspaces_dict[ws_id]['deleted_object_count'],
workspaces_dict[ws_id]['total_size'], workspaces_dict[ws_id]['top_lvl_size'], workspaces_dict[ws_id]['is_public'],
workspaces_dict[ws_id]['is_temporary'], workspaces_dict[ws_id]['is_deleted'], workspaces_dict[ws_id]['number_of_shares'])
prep_cursor.execute(workspaces_insert_statement,input)
print("TOTAL WS Number : " + str(len(workspaces_dict)))
print("--- get ws top info time took %s seconds ---" % (get_ws_top_info_time))
print("--- gather data %s seconds ---" % (gather_time))
workspace_time = time.time() - (gather_time + start_time)
print("--- workspaces uploading %s seconds ---" % (workspace_time))
#OBJECT COUNTS UPLOADING
prep_cursor_obj = db_connection.cursor(prepared=True)
obj_counts_insert_statement = "insert into metrics.workspace_object_counts "\
"(object_type, object_spec_version, object_type_full, "\
"record_date, last_mod_date, top_lvl_object_count, "\
"total_object_count, public_object_count, private_object_count, "\
"hidden_object_count, deleted_object_count, copy_count, "\
"total_size, top_lvl_size, max_object_size) "\
"values(%s,%s, %s, now(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);"
#print("OBJECT COUNTS DICT : " + str(object_counts_dict))
for obj_full in sorted(object_counts_dict):
obj_input = (object_counts_dict[obj_full]["object_type"],object_counts_dict[obj_full]["object_spec_version"],
obj_full, object_counts_dict[obj_full]["last_mod_date"],
object_counts_dict[obj_full]["top_lvl_object_count"], object_counts_dict[obj_full]["total_object_count"],
object_counts_dict[obj_full]["public_object_count"], object_counts_dict[obj_full]["private_object_count"],
object_counts_dict[obj_full]["hidden_object_count"], object_counts_dict[obj_full]["deleted_object_count"],
object_counts_dict[obj_full]["copy_count"], object_counts_dict[obj_full]["total_size"],
object_counts_dict[obj_full]["top_lvl_size"], object_counts_dict[obj_full]["max_object_size"])
prep_cursor.execute(obj_counts_insert_statement,obj_input)
object_time = time.time() - (workspace_time + gather_time + start_time)
print("--- object counts uploading %s seconds ---" % (object_time))
#USERS_OBJECT COUNTS UPLOADING
prep_cursor_obj = db_connection.cursor(prepared=True)
users_obj_counts_insert_statement = "insert into metrics.users_workspace_object_counts "\
"(object_type, object_spec_version, object_type_full, "\
"record_date, last_mod_date, top_lvl_object_count, "\
"total_object_count, public_object_count, private_object_count, "\
"hidden_object_count, deleted_object_count, copy_count, "\
"total_size, top_lvl_size, max_object_size) "\
"values(%s,%s, %s, now(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);"
for obj_full in sorted(users_object_counts_dict):
users_obj_input = (users_object_counts_dict[obj_full]["object_type"],
users_object_counts_dict[obj_full]["object_spec_version"],
obj_full, users_object_counts_dict[obj_full]["last_mod_date"],
users_object_counts_dict[obj_full]["top_lvl_object_count"],
users_object_counts_dict[obj_full]["total_object_count"],
users_object_counts_dict[obj_full]["public_object_count"],
users_object_counts_dict[obj_full]["private_object_count"],
users_object_counts_dict[obj_full]["hidden_object_count"],
users_object_counts_dict[obj_full]["deleted_object_count"],
users_object_counts_dict[obj_full]["copy_count"],
users_object_counts_dict[obj_full]["total_size"],
users_object_counts_dict[obj_full]["top_lvl_size"],
users_object_counts_dict[obj_full]["max_object_size"])
prep_cursor.execute(users_obj_counts_insert_statement,users_obj_input)
users_object_time = time.time() - (workspace_time + gather_time + start_time + object_time)
print("--- users object counts uploading %s seconds ---" % (users_object_time))
#SUSPECT SHOCK NODE INSERTING/UPDATING
#If exists, update the last_seen_date
#If does not exist make a new record.
# query to see if it exists
prep_cursor_ssn_exists = db_connection.cursor(prepared=True)
ssn_exists_query = "select count(*) from metrics.suspect_shock_nodes "\
"where ws_obj_reference = %s and shock_node = %s"
# query_to_update suspect_shock_nodes
prep_cursor_ssn_update = db_connection.cursor(prepared=True)
suspect_shock_node_update_statement = "update metrics.suspect_shock_nodes "\
"set last_seen_date = now() "\
"where ws_obj_reference = %s and shock_node = %s;"
# query_to_insert suspect_shock_nodes
prep_cursor_ssn_insert = db_connection.cursor(prepared=True)
suspect_shock_node_insert_statement = "insert into metrics.suspect_shock_nodes "\
"(ws_obj_reference, shock_node, "\
"first_seen_date, last_seen_date, ws_id) "\
"values(%s,%s, now(), now(), %s);"
# print("narrative_refs_with_shock_node_issues : " + str(narrative_refs_with_shock_node_issues))
for nar_ref in narrative_refs_with_shock_node_issues:
# print("IN SHOCK NODES ISSUES : " + nar_ref)
(ws_id, nar_id, nar_version) = nar_ref.split("/")
chksum_cursor = db.workspaceObjVersions.find({"ws":int(ws_id),"id":int(nar_id),"ver":int(nar_version)},{"chksum":1,"_id":0})
chksum = None
for chksum_arr in chksum_cursor:
chksum = chksum_arr["chksum"]
node_cursor =db.shock_nodeMap.find({"chksum":chksum},{"node":1,"_id":0})
node = None
for node_arr in node_cursor:
node = node_arr["node"]
#check if nar_ref_node combo exists:
prep_cursor_ssn_exists.execute(ssn_exists_query,(nar_ref, node))
exists_count_arr = prep_cursor_ssn_exists.fetchone()
if exists_count_arr[0] == 0:
#means a new problem narrative/node needs an insert
prep_cursor_ssn_insert.execute(suspect_shock_node_insert_statement,(nar_ref, node, int(ws_id)))
else:
#means the nar_ref node existed . Update the last seen date.
prep_cursor_ssn_insert.execute(suspect_shock_node_update_statement,(nar_ref, node))
db_connection.commit()
#upload_workspace_stats()
| [
1,
529,
276,
1112,
420,
29958,
26856,
29891,
4584,
3059,
29914,
2527,
10817,
13,
3166,
282,
962,
7443,
1053,
18294,
4032,
13,
3166,
282,
962,
7443,
1053,
7523,
29925,
5679,
13,
3166,
4768,
554,
3188,
29889,
1287,
3493,
29889,
4645,
1053,
5244,
3493,
13,
5215,
4390,
408,
903,
3126,
13,
5215,
2897,
13,
5215,
5749,
29889,
11958,
2801,
408,
5749,
13,
5215,
7274,
13,
5215,
931,
13,
3166,
29871,
12865,
1053,
2635,
13,
29937,
5215,
282,
2158,
13,
24830,
29889,
8318,
29889,
2271,
1982,
29941,
29889,
20472,
29918,
25442,
886,
580,
13,
13,
29937,
407,
353,
282,
2158,
29889,
6572,
4349,
4040,
1639,
29898,
12860,
29922,
29946,
29897,
13,
13,
29937,
6058,
29923,
679,
29918,
1792,
29918,
3888,
29918,
3166,
29918,
5150,
29906,
6166,
701,
278,
2847,
9657,
29889,
29871,
13,
29937,
1576,
1494,
3168,
2767,
3058,
4235,
297,
278,
9657,
29889,
13,
29937,
1105,
679,
29918,
1792,
29918,
3888,
29918,
3166,
29918,
5150,
29906,
1818,
367,
2000,
1434,
679,
29918,
7564,
29918,
7193,
322,
679,
29918,
1792,
29918,
990,
29879,
29918,
2798,
13,
13,
2527,
10817,
29918,
7938,
29918,
5630,
353,
2897,
29889,
21813,
1839,
2303,
5659,
2965,
29903,
29918,
17870,
4176,
29918,
29925,
24668,
2033,
13,
29885,
7443,
4051,
29918,
2527,
10817,
29918,
9965,
353,
2897,
29889,
21813,
1839,
22877,
17080,
29918,
10145,
2033,
13,
13,
2850,
29918,
3069,
353,
2897,
29889,
21813,
1839,
4176,
29918,
20832,
2033,
13,
1972,
29918,
265,
353,
2897,
29889,
21813,
1839,
13356,
24422,
29918,
1164,
2033,
13,
13,
5652,
29918,
2271,
353,
2897,
29889,
21813,
1839,
7811,
29918,
4219,
2033,
13,
5652,
29918,
1792,
29918,
6979,
353,
2897,
29889,
21813,
3366,
2303,
5659,
2965,
29903,
29918,
7811,
29918,
11889,
29918,
4986,
29968,
1430,
3108,
13,
517,
29918,
1287,
3493,
353,
29871,
2897,
29889,
21813,
1839,
9980,
29968,
29918,
14605,
29943,
25634,
2033,
13,
13,
1753,
679,
29918,
1287,
22854,
29898,
2585,
1125,
13,
1678,
9995,
13,
1678,
4947,
15474,
1230,
664,
22854,
2472,
363,
1661,
13201,
664,
22854,
13,
1678,
9995,
13,
1678,
664,
22854,
29918,
8977,
353,
6571,
13,
1678,
396,
2577,
599,
278,
25204,
6490,
664,
22854,
322,
1009,
18067,
1404,
313,
17314,
29898,
1333,
29918,
7382,
876,
13,
1678,
664,
22854,
29918,
18127,
353,
4833,
29889,
1287,
22854,
29889,
2886,
3319,
29908,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
11656,
13,
29937,
29871,
10762,
6058,
5012,
1307,
29911,
3352,
405,
1718,
29934,
1299,
5667,
2890,
1669,
8853,
6144,
29908,
584,
7700,
29892,
376,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
11656,
13,
29937,
29871,
10762,
6732,
16786,
317,
7520,
3352,
405,
1718,
29934,
1299,
5667,
2890,
18884,
376,
7299,
29908,
584,
8853,
29895,
29908,
584,
376,
275,
29918,
1356,
1971,
653,
613,
376,
29894,
29908,
584,
376,
4541,
9092,
2981,
13,
462,
462,
965,
8853,
20348,
1115,
29896,
1699,
5652,
1115,
29896,
1699,
1545,
1256,
1115,
29896,
1699,
6144,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
1678,
363,
2407,
297,
664,
22854,
29918,
18127,
29901,
13,
4706,
565,
2407,
3366,
5652,
3108,
2804,
29871,
29953,
29896,
29945,
29901,
13,
9651,
338,
29918,
311,
22742,
29918,
5652,
353,
29871,
29900,
13,
9651,
565,
2407,
3366,
6144,
3108,
1275,
5852,
29901,
13,
18884,
338,
29918,
311,
22742,
29918,
5652,
353,
29871,
29896,
13,
9651,
664,
22854,
29918,
8977,
29961,
11651,
3366,
5652,
3108,
29962,
353,
8853,
5652,
29918,
333,
29908,
584,
2407,
3366,
5652,
12436,
13,
462,
462,
632,
376,
6786,
29908,
584,
2407,
3366,
20348,
12436,
13,
462,
462,
632,
376,
1545,
29918,
1256,
29908,
584,
2407,
3366,
1545,
1256,
12436,
13,
462,
462,
632,
376,
11228,
29918,
7620,
29918,
1256,
29908,
584,
6213,
29892,
13,
462,
462,
632,
376,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
7827,
29918,
3318,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
401,
29918,
3729,
29879,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
29876,
2749,
1230,
29918,
3259,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
10892,
29918,
3318,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
311,
22742,
29918,
3318,
29918,
2798,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
7827,
29918,
2311,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
525,
3332,
29918,
29880,
20901,
29918,
2311,
29915,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
275,
29918,
3597,
29908,
584,
29871,
29900,
29892,
13,
462,
462,
632,
376,
275,
29918,
311,
22742,
29908,
584,
338,
29918,
311,
22742,
29918,
5652,
29892,
13,
462,
462,
632,
376,
275,
29918,
1356,
1971,
653,
29908,
584,
6213,
29892,
13,
462,
462,
632,
376,
4537,
29918,
974,
29918,
845,
5114,
29908,
584,
29871,
29900,
13,
9651,
500,
13,
13,
1678,
664,
3493,
29918,
275,
29918,
1356,
1971,
653,
29918,
18127,
353,
4833,
29889,
1287,
22854,
29889,
2886,
3319,
29908,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
1118,
13,
462,
462,
462,
539,
396,
6377,
6144,
29908,
584,
7700,
1699,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
1118,
13,
462,
462,
462,
4706,
376,
7299,
29908,
584,
8853,
29895,
29908,
584,
376,
275,
29918,
1356,
1971,
653,
613,
376,
29894,
29908,
584,
376,
3009,
9092,
2981,
13,
462,
462,
462,
539,
8853,
5652,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
1678,
363,
2407,
297,
664,
3493,
29918,
275,
29918,
1356,
1971,
653,
29918,
18127,
29901,
13,
4706,
664,
22854,
29918,
8977,
29961,
11651,
3366,
5652,
3108,
29962,
3366,
275,
29918,
1356,
1971,
653,
3108,
353,
29871,
29896,
13,
13,
1678,
664,
3493,
29918,
1333,
29918,
1356,
1971,
653,
29918,
18127,
353,
4833,
29889,
1287,
22854,
29889,
2886,
3319,
29908,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
1118,
13,
462,
462,
462,
4706,
396,
6377,
6144,
29908,
584,
7700,
29892,
376,
1545,
1256,
1115,
8853,
29938,
9933,
1115,
5574,
1118,
13,
462,
462,
462,
3986,
376,
7299,
29908,
584,
8853,
29895,
29908,
584,
376,
275,
29918,
1356,
1971,
653,
613,
376,
29894,
29908,
584,
376,
4541,
9092,
2981,
13,
462,
462,
462,
539,
8853,
5652,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
1678,
363,
2407,
297,
664,
3493,
29918,
1333,
29918,
1356,
1971,
653,
29918,
18127,
29901,
13,
4706,
664,
22854,
29918,
8977,
29961,
11651,
3366,
5652,
3108,
29962,
3366,
275,
29918,
1356,
1971,
653,
3108,
353,
29871,
29900,
13,
462,
462,
462,
539,
13,
1678,
736,
664,
22854,
29918,
8977,
13,
13,
1753,
679,
29918,
1287,
3493,
29918,
845,
5114,
29898,
2585,
29892,
664,
22854,
29918,
8977,
1125,
13,
1678,
9995,
13,
1678,
4947,
1353,
310,
29358,
639,
664,
3493,
13,
1678,
9995,
13,
1678,
11404,
362,
29918,
1807,
11759,
13,
4706,
8853,
29938,
4352,
29908,
584,
8853,
17858,
29908,
584,
426,
3908,
262,
1115,
518,
29871,
29896,
29900,
29892,
29906,
29900,
29892,
29941,
29900,
4514,
930,
1118,
13,
4706,
8853,
29938,
2972,
29908,
584,
8853,
29918,
333,
29908,
584,
3908,
333,
613,
376,
12366,
29918,
2798,
29908,
584,
426,
3908,
2083,
29908,
584,
29871,
29896,
500,
930,
29962,
13,
1678,
599,
29918,
12366,
29918,
546,
1516,
29918,
18127,
29922,
2585,
29889,
1287,
3493,
2477,
29931,
29879,
29889,
26193,
403,
29898,
26193,
362,
29918,
1807,
29897,
13,
13,
1678,
363,
2407,
297,
4833,
29889,
1287,
3493,
2477,
29931,
29879,
29889,
26193,
403,
29898,
26193,
362,
29918,
1807,
1125,
13,
4706,
565,
2407,
3366,
29918,
333,
3108,
297,
664,
22854,
29918,
8977,
29901,
13,
9651,
664,
22854,
29918,
8977,
29961,
11651,
3366,
29918,
333,
3108,
29962,
3366,
4537,
29918,
974,
29918,
845,
5114,
3108,
353,
2407,
3366,
12366,
29918,
2798,
3108,
13,
1678,
736,
664,
22854,
29918,
8977,
13,
13,
1753,
679,
29918,
3597,
29918,
1287,
22854,
29898,
2585,
29892,
664,
22854,
29918,
8977,
1125,
13,
1678,
9995,
13,
1678,
402,
1691,
23481,
310,
970,
664,
22854,
13,
1678,
9995,
13,
1678,
970,
29918,
1287,
22854,
29918,
18127,
353,
4833,
29889,
1287,
3493,
2477,
29931,
29879,
29889,
2886,
3319,
29908,
1792,
29908,
584,
26345,
10758,
6377,
333,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
1678,
363,
2407,
297,
970,
29918,
1287,
22854,
29918,
18127,
29901,
13,
4706,
565,
2407,
3366,
333,
3108,
297,
664,
22854,
29918,
8977,
29901,
13,
9651,
664,
22854,
29918,
8977,
29961,
11651,
3366,
333,
3108,
29962,
3366,
275,
29918,
3597,
3108,
353,
29871,
29896,
13,
1678,
736,
664,
22854,
29918,
8977,
13,
13,
13,
15945,
29908,
438,
10249,
15842,
12279,
29925,
14645,
2208,
21122,
4214,
405,
9806,
379,
9468,
20566,
6770,
29091,
383,
28700,
13,
1753,
679,
29918,
932,
29918,
3729,
29918,
2798,
29898,
5652,
6406,
29892,
15474,
1230,
29918,
999,
29892,
664,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
1125,
13,
29937,
13,
1678,
402,
1691,
278,
1353,
310,
2401,
315,
10071,
297,
278,
15474,
1230,
13,
1678,
2823,
5106,
363,
399,
29903,
4113,
1531,
1244,
29871,
13,
1678,
2045,
597,
3292,
29889,
510,
29914,
29895,
3188,
29914,
1287,
3493,
29918,
6144,
1314,
29872,
29914,
10054,
29914,
29900,
29906,
29906,
29896,
29955,
29872,
29946,
29881,
29953,
29941,
1388,
29947,
29946,
29946,
29906,
29881,
29929,
12613,
29953,
29953,
29896,
29896,
7340,
29874,
29955,
29929,
29900,
29888,
29896,
29955,
29941,
311,
29945,
29947,
29872,
29914,
2640,
1167,
29914,
6406,
8306,
13248,
29889,
29878,
303,
13,
29937,
13,
1678,
5235,
353,
16904,
6406,
29889,
6406,
1531,
3319,
29915,
6519,
2396,
376,
657,
2061,
3401,
613,
13,
462,
1669,
525,
7529,
2396,
29871,
8853,
12650,
1115,
518,
6377,
999,
1115,
15474,
1230,
29918,
999,
29913,
1402,
376,
2856,
18417,
1115,
29871,
29896,
29913,
13,
462,
795,
5615,
3366,
7192,
359,
3108,
29961,
29900,
29962,
13,
1678,
12700,
353,
5235,
29961,
29896,
29900,
29962,
13,
1678,
3001,
29918,
932,
29918,
3729,
29879,
353,
29871,
29900,
13,
29937,
1678,
1596,
703,
2303,
6040,
29901,
376,
718,
851,
29898,
7299,
876,
13,
1678,
363,
1820,
297,
12700,
29901,
13,
4706,
565,
1820,
29889,
27382,
2541,
703,
5696,
1213,
1125,
13,
29937,
9651,
565,
29898,
275,
8758,
29898,
7299,
29961,
1989,
1402,
938,
22164,
13,
9651,
1018,
29901,
13,
18884,
3001,
29918,
932,
29918,
3729,
29879,
4619,
938,
29898,
7299,
29961,
1989,
2314,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
664,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
29889,
1202,
29898,
29876,
2749,
1230,
29918,
999,
29897,
13,
18884,
1596,
703,
2303,
6040,
29901,
376,
718,
851,
29898,
7299,
876,
13,
1678,
736,
313,
7827,
29918,
932,
29918,
3729,
29879,
29892,
664,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
29897,
13,
15945,
29908,
13,
13,
1753,
679,
29918,
29876,
2749,
1230,
29918,
3729,
29918,
2798,
29879,
29898,
5652,
6406,
29892,
15474,
1230,
29918,
999,
1125,
13,
1678,
9995,
13,
1678,
402,
1691,
278,
1353,
310,
2401,
315,
10071,
322,
5920,
315,
10071,
297,
278,
15474,
1230,
13,
1678,
2823,
5106,
363,
399,
29903,
4113,
1531,
1244,
13,
1678,
2045,
597,
3292,
29889,
510,
29914,
29895,
3188,
29914,
1287,
3493,
29918,
6144,
1314,
29872,
29914,
10054,
29914,
29900,
29906,
29906,
29896,
29955,
29872,
29946,
29881,
29953,
29941,
1388,
29947,
29946,
29946,
29906,
29881,
29929,
12613,
29953,
29953,
29896,
29896,
7340,
29874,
29955,
29929,
29900,
29888,
29896,
29955,
29941,
311,
29945,
29947,
29872,
29914,
2640,
1167,
29914,
6406,
8306,
13248,
29889,
29878,
303,
13,
1678,
9995,
13,
1678,
623,
29918,
2798,
353,
29871,
29900,
13,
1678,
775,
29918,
2798,
353,
29871,
29900,
13,
1678,
338,
29918,
29879,
375,
1103,
353,
29871,
29900,
13,
1678,
1018,
29901,
13,
4706,
17655,
29918,
5415,
353,
16904,
6406,
29889,
6406,
1531,
3319,
29915,
6519,
2396,
376,
657,
12724,
613,
13,
462,
462,
418,
525,
7529,
2396,
29871,
8853,
12650,
1115,
518,
6377,
999,
1115,
15474,
1230,
29918,
999,
6525,
24289,
3366,
1272,
3108,
29961,
29900,
29962,
3366,
1272,
3108,
13,
13,
4706,
565,
376,
3729,
29879,
29908,
297,
17655,
29918,
5415,
29901,
13,
9651,
363,
3038,
297,
17655,
29918,
5415,
3366,
3729,
29879,
3108,
29901,
13,
18884,
565,
29898,
3729,
3366,
19635,
16862,
657,
703,
29895,
3188,
613,
6571,
467,
657,
703,
1853,
1159,
1275,
376,
932,
29908,
1125,
13,
462,
1678,
623,
29918,
2798,
4619,
29871,
29896,
13,
18884,
25342,
29898,
3729,
3366,
19635,
16862,
657,
703,
29895,
3188,
613,
6571,
467,
657,
703,
1853,
1159,
1275,
376,
401,
29908,
1125,
13,
462,
1678,
775,
29918,
2798,
4619,
29871,
29896,
13,
4706,
736,
29898,
932,
29918,
2798,
29892,
775,
29918,
2798,
29892,
338,
29918,
29879,
375,
1103,
29897,
13,
1678,
5174,
29901,
13,
4706,
396,
17550,
384,
2943,
338,
12326,
13,
4706,
338,
29918,
29879,
375,
1103,
353,
29871,
29896,
13,
4706,
1596,
703,
29940,
2749,
1230,
9897,
584,
376,
718,
15474,
1230,
29918,
999,
718,
376,
756,
263,
19253,
2943,
2228,
1159,
13,
4706,
396,
2202,
2734,
373,
278,
3517,
1873,
310,
278,
15474,
1230,
565,
4864,
13,
4706,
396,
361,
3517,
1873,
947,
451,
1863,
736,
24786,
29871,
13,
4706,
313,
5652,
29918,
333,
29892,
5446,
29918,
333,
29892,
5446,
29918,
369,
29897,
353,
15474,
1230,
29918,
999,
29889,
5451,
11974,
1159,
29871,
13,
4706,
565,
938,
29898,
5415,
29918,
369,
29897,
1405,
29871,
29896,
29901,
13,
9651,
716,
29918,
999,
353,
16904,
29918,
333,
718,
5591,
29908,
718,
5446,
29918,
333,
718,
5591,
29908,
718,
851,
29898,
524,
29898,
5415,
29918,
369,
29897,
448,
29871,
29896,
29897,
13,
9651,
313,
932,
29918,
2798,
29892,
775,
29918,
2798,
29892,
20254,
29897,
353,
679,
29918,
29876,
2749,
1230,
29918,
3729,
29918,
2798,
29879,
29898,
5652,
6406,
29892,
716,
29918,
999,
29897,
13,
4706,
736,
29898,
932,
29918,
2798,
29892,
775,
29918,
2798,
29892,
338,
29918,
29879,
375,
1103,
29897,
13,
13,
1753,
679,
29918,
29895,
3188,
29918,
303,
3470,
29898,
2585,
29918,
9965,
1125,
13,
1678,
9995,
13,
1678,
679,
1051,
310,
476,
5160,
13925,
13,
1678,
9995,
13,
1678,
10677,
353,
4833,
29918,
9965,
29889,
18127,
580,
13,
1678,
2346,
353,
376,
1509,
15691,
1972,
29918,
265,
13,
1678,
10677,
29889,
7978,
29898,
1972,
29897,
13,
13,
1678,
396,
657,
599,
5923,
4160,
13,
1678,
413,
3188,
29918,
303,
3470,
353,
731,
580,
13,
1678,
2346,
353,
376,
2622,
8952,
515,
21556,
29889,
1792,
29918,
3888,
988,
413,
29890,
29918,
7564,
29918,
1792,
353,
29871,
29896,
15458,
13,
1678,
10677,
29889,
7978,
29898,
1972,
29897,
13,
1678,
363,
313,
6786,
29897,
297,
10677,
29901,
13,
4706,
413,
3188,
29918,
303,
3470,
29889,
1202,
29898,
6786,
29961,
29900,
2314,
13,
1678,
736,
413,
3188,
29918,
303,
3470,
13,
13,
1753,
679,
29918,
12650,
29898,
2585,
29892,
664,
22854,
29918,
8977,
29892,
4833,
29918,
9965,
1125,
13,
1678,
9995,
13,
1678,
679,
1203,
18139,
29871,
13,
1678,
408,
1532,
408,
7934,
628,
29892,
2159,
29892,
338,
29918,
29876,
2749,
1230,
2472,
29888,
363,
278,
664,
3493,
29889,
13,
1678,
9995,
13,
13,
1678,
16904,
6406,
353,
5244,
3493,
29898,
5652,
29918,
2271,
29892,
5993,
29922,
5652,
29918,
1792,
29918,
6979,
29897,
13,
1678,
396,
14824,
17637,
4810,
3904,
9375,
14614,
1672,
1799,
15149,
399,
1955,
29968,
5550,
2477,
2890,
29889,
13,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
353,
9657,
580,
13,
1678,
396,
14824,
17637,
4810,
3904,
9375,
14614,
1672,
1799,
3148,
1001,
399,
1955,
29968,
5550,
2477,
2890,
13,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
353,
9657,
580,
13,
1678,
396,
8132,
2303,
15842,
3148,
1001,
5300,
15149,
13,
1678,
396,
1678,
426,
3318,
29918,
1853,
29918,
8159,
584,
426,
376,
3318,
29918,
1853,
29908,
584,
2023,
29892,
13,
1678,
396,
462,
3986,
376,
3318,
29918,
6550,
29918,
3259,
29908,
584,
2023,
29892,
259,
13,
1678,
396,
462,
3986,
376,
4230,
29918,
1545,
29918,
1256,
29908,
584,
4236,
29918,
1256,
1919,
13,
1678,
396,
462,
3986,
376,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
7827,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
3597,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
9053,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
10892,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
311,
22742,
29918,
3318,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
8552,
29918,
2798,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
7827,
29918,
2311,
29908,
584,
396,
1919,
13,
1678,
396,
462,
3986,
376,
3332,
29918,
29880,
20901,
29918,
2311,
29908,
584,
396,
930,
13,
13,
1678,
413,
3188,
29918,
303,
3470,
353,
679,
29918,
29895,
3188,
29918,
303,
3470,
29898,
2585,
29918,
9965,
29897,
13,
29937,
1678,
664,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
353,
731,
580,
396,
17462,
292,
5702,
310,
664,
22854,
411,
7736,
15562,
988,
623,
3038,
21248,
8465,
13,
1678,
15474,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
353,
731,
580,
396,
17462,
5702,
310,
15474,
1230,
2143,
29879,
411,
19253,
3177,
5626,
304,
3013,
5702,
310,
2678,
29889,
13,
268,
13,
1678,
835,
13383,
7346,
13,
1678,
396,
29888,
809,
13490,
3454,
304,
437,
263,
7968,
731,
310,
664,
22854,
29889,
13,
1678,
835,
13383,
7346,
13,
29937,
1678,
16904,
29918,
13400,
353,
29871,
29896,
396,
2831,
13490,
11976,
29892,
565,
16904,
29918,
13400,
338,
6213,
769,
372,
947,
599,
664,
22854,
29889,
13,
29937,
1678,
16904,
29918,
11808,
353,
29871,
29900,
13,
29937,
1678,
363,
16904,
29918,
333,
297,
12705,
29898,
1287,
22854,
29918,
8977,
29889,
8149,
580,
1125,
13,
29937,
4706,
16904,
29918,
11808,
4619,
29871,
29896,
13,
29937,
4706,
565,
16904,
29918,
11808,
1405,
16904,
29918,
13400,
584,
13,
29937,
9651,
628,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
13,
1678,
835,
13383,
7346,
13,
1678,
396,
8382,
3460,
3454,
304,
13114,
5244,
22854,
13,
29937,
1678,
5694,
29918,
8977,
353,
9657,
580,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29946,
29929,
29896,
29896,
29946,
29962,
353,
664,
22854,
29918,
8977,
29961,
29946,
29929,
29896,
29896,
29946,
29962,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29941,
29962,
353,
664,
22854,
29918,
8977,
29961,
29941,
29962,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29945,
29900,
29900,
29929,
29962,
353,
664,
22854,
29918,
8977,
29961,
29945,
29900,
29900,
29929,
29962,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29896,
29900,
29900,
29900,
29962,
353,
664,
22854,
29918,
8977,
29961,
29896,
29900,
29900,
29900,
29962,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29945,
29941,
29946,
29953,
29906,
29962,
353,
664,
22854,
29918,
8977,
29961,
29945,
29941,
29946,
29953,
29906,
29962,
13,
29937,
1678,
5694,
29918,
8977,
29961,
29941,
29906,
29946,
29962,
353,
664,
22854,
29918,
8977,
29961,
29941,
29906,
29946,
29962,
308,
13,
29937,
1678,
664,
22854,
29918,
8977,
29889,
8551,
580,
13,
29937,
1678,
664,
22854,
29918,
8977,
353,
5694,
29918,
8977,
13,
7346,
4136,
2277,
29937,
13,
13,
1678,
363,
16904,
29918,
333,
297,
12705,
29898,
1287,
22854,
29918,
8977,
29889,
8149,
580,
1125,
13,
4706,
1596,
703,
8618,
23524,
4214,
399,
29903,
584,
376,
718,
851,
29898,
5652,
29918,
333,
876,
13,
4706,
338,
29918,
29876,
2749,
1230,
353,
7700,
13,
4706,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
353,
9657,
580,
13,
4706,
338,
29918,
3597,
29918,
15581,
353,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
275,
29918,
3597,
3108,
29871,
13,
13,
4706,
260,
29880,
29918,
5652,
29918,
5415,
29918,
18127,
353,
4833,
29889,
1287,
3493,
12724,
29889,
2886,
3319,
29908,
5652,
1115,
5652,
29918,
333,
1118,
6377,
333,
1115,
29896,
1699,
1949,
369,
1115,
29896,
1699,
6144,
1115,
29896,
1699,
11458,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
4706,
363,
260,
29880,
29918,
3318,
297,
260,
29880,
29918,
5652,
29918,
5415,
29918,
18127,
29901,
13,
9651,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
15206,
29918,
3318,
3366,
333,
3108,
29962,
353,
8853,
1949,
369,
29908,
584,
260,
29880,
29918,
3318,
3366,
1949,
369,
12436,
13,
462,
462,
462,
418,
376,
6144,
29908,
584,
260,
29880,
29918,
3318,
3366,
6144,
12436,
13,
462,
462,
462,
418,
376,
11458,
29908,
584,
260,
29880,
29918,
3318,
3366,
11458,
3108,
29913,
13,
4706,
16904,
29918,
5415,
29918,
874,
29918,
18127,
353,
4833,
29889,
1287,
3493,
9930,
29963,
414,
1080,
29889,
2886,
3319,
29908,
5652,
1115,
5652,
29918,
333,
1118,
6377,
1853,
1115,
29896,
1699,
333,
1115,
29896,
1699,
369,
1115,
29896,
1699,
2311,
1115,
29896,
29892,
376,
17314,
403,
1115,
29896,
1699,
9708,
1000,
1115,
29896,
1699,
29918,
333,
1115,
29900,
3680,
13,
4706,
363,
16904,
29918,
5415,
29918,
369,
297,
16904,
29918,
5415,
29918,
874,
29918,
18127,
29901,
13,
9651,
1203,
29918,
1853,
29918,
8159,
353,
16904,
29918,
5415,
29918,
369,
3366,
1853,
3108,
13,
9651,
313,
3318,
29918,
1853,
29892,
1203,
29918,
6550,
29918,
3259,
29897,
353,
1203,
29918,
1853,
29918,
8159,
29889,
5451,
703,
29899,
1159,
13,
9651,
5446,
29918,
333,
353,
16904,
29918,
5415,
29918,
369,
3366,
333,
3108,
13,
9651,
5446,
29918,
369,
353,
16904,
29918,
5415,
29918,
369,
3366,
369,
3108,
13,
9651,
5446,
29918,
2311,
353,
16904,
29918,
5415,
29918,
369,
3366,
2311,
3108,
13,
9651,
2246,
29918,
5415,
29918,
2311,
353,
29871,
29900,
13,
9651,
5446,
29918,
7620,
29918,
1256,
353,
16904,
29918,
5415,
29918,
369,
3366,
17314,
403,
3108,
13,
9651,
5446,
29918,
9708,
1000,
353,
29871,
29900,
13,
9651,
565,
16904,
29918,
5415,
29918,
369,
3366,
9708,
1000,
3108,
338,
451,
6213,
29901,
13,
18884,
5446,
29918,
9708,
1000,
353,
29871,
29896,
13,
9651,
338,
29918,
10892,
353,
29871,
29900,
13,
9651,
338,
29918,
311,
22742,
353,
29871,
29900,
13,
9651,
338,
29918,
3332,
29918,
5563,
353,
29871,
29900,
13,
632,
13,
9651,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
9651,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
7827,
29918,
2311,
3108,
4619,
5446,
29918,
2311,
13,
13,
9651,
565,
5446,
29918,
369,
1275,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
1949,
369,
3108,
29901,
13,
18884,
396,
1004,
550,
505,
4236,
287,
1873,
310,
278,
1203,
2246,
29918,
5563,
13,
18884,
338,
29918,
3332,
29918,
5563,
353,
29871,
29896,
13,
18884,
2246,
29918,
5415,
29918,
2311,
353,
5446,
29918,
2311,
13,
18884,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
3108,
4619,
5446,
29918,
2311,
13,
18884,
396,
6545,
319,
405,
1718,
29934,
1299,
18474,
438,
29933,
17637,
29892,
16924,
6093,
399,
29903,
9657,
13,
18884,
565,
1203,
29918,
1853,
1275,
376,
29968,
5160,
29940,
2749,
1230,
29889,
29940,
2749,
1230,
1115,
13,
462,
1678,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
29876,
2749,
1230,
29918,
3259,
3108,
353,
5446,
29918,
369,
13,
462,
1678,
565,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
6144,
3108,
29901,
13,
462,
4706,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
3108,
353,
29871,
29900,
13,
462,
4706,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
401,
29918,
3729,
29879,
29918,
2798,
3108,
353,
29871,
29900,
13,
29937,
462,
1678,
1683,
29901,
13,
29937,
462,
4706,
313,
1287,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
12436,
1287,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
29897,
353,
679,
29918,
932,
29918,
3729,
29918,
2798,
29898,
5652,
6406,
29892,
13,
29937,
462,
462,
462,
462,
462,
462,
462,
462,
259,
851,
29898,
5652,
29918,
333,
29897,
718,
5591,
29908,
718,
851,
29898,
5415,
29918,
333,
511,
13,
29937,
462,
462,
462,
462,
462,
462,
462,
462,
259,
664,
22854,
29918,
2541,
29918,
932,
29918,
3729,
29918,
22861,
1907,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
313,
1287,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
12436,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
401,
29918,
3729,
29879,
29918,
2798,
12436,
338,
29918,
29879,
375,
1103,
29897,
353,
320,
13,
462,
9651,
679,
29918,
29876,
2749,
1230,
29918,
3729,
29918,
2798,
29879,
29898,
5652,
6406,
29892,
851,
29898,
5652,
29918,
333,
29897,
718,
5591,
29908,
718,
851,
29898,
5415,
29918,
333,
29897,
718,
5591,
29908,
718,
851,
29898,
5415,
29918,
369,
876,
13,
462,
4706,
565,
338,
29918,
29879,
375,
1103,
1275,
29871,
29896,
29901,
13,
462,
9651,
15474,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
29889,
1202,
29898,
710,
29898,
5652,
29918,
333,
29897,
718,
5591,
29908,
718,
851,
29898,
5415,
29918,
333,
29897,
718,
5591,
29908,
718,
851,
29898,
5415,
29918,
369,
876,
13,
462,
268,
13,
18884,
396,
2577,
5244,
3493,
3694,
13,
18884,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
18884,
565,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
11458,
3108,
29901,
13,
462,
1678,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
3108,
4619,
5446,
29918,
369,
13,
18884,
565,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
6144,
3108,
29901,
13,
462,
1678,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
3108,
4619,
5446,
29918,
369,
13,
13,
9651,
565,
5446,
29918,
369,
1275,
29871,
29896,
322,
1203,
29918,
1853,
1275,
376,
29968,
5160,
29940,
2749,
1230,
29889,
29940,
2749,
1230,
1115,
13,
18884,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
11228,
29918,
7620,
29918,
1256,
3108,
353,
5446,
29918,
7620,
29918,
1256,
13,
462,
268,
13,
9651,
565,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
11458,
3108,
29901,
13,
18884,
338,
29918,
10892,
353,
29871,
29896,
13,
9651,
565,
2246,
29918,
5563,
29918,
20401,
29918,
8977,
29961,
5415,
29918,
333,
29962,
3366,
6144,
3108,
29901,
13,
18884,
338,
29918,
311,
22742,
353,
29871,
29896,
13,
462,
13,
9651,
565,
1203,
29918,
1853,
29918,
8159,
451,
297,
1203,
29918,
2798,
29879,
29918,
8977,
29901,
13,
18884,
396,
6730,
931,
8790,
445,
1203,
2989,
1134,
29889,
25455,
297,
278,
9657,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
353,
9657,
580,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3318,
29918,
1853,
3108,
353,
1203,
29918,
1853,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3318,
29918,
6550,
29918,
3259,
3108,
353,
1203,
29918,
6550,
29918,
3259,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
353,
5446,
29918,
7620,
29918,
1256,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
3108,
353,
2246,
29918,
5415,
29918,
2311,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29896,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
3108,
353,
5446,
29918,
9708,
1000,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
3332,
29918,
5563,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
10892,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
311,
22742,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
3597,
29918,
15581,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
18884,
565,
338,
29918,
3597,
29918,
15581,
1275,
29871,
29896,
29901,
13,
462,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29900,
13,
18884,
1683,
29901,
13,
462,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
396,
24217,
29892,
788,
701,
1819,
16205,
29889,
13,
18884,
396,
3198,
565,
2635,
338,
7621,
1135,
1833,
29918,
1545,
29918,
1256,
13,
18884,
13407,
29918,
1256,
353,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
13,
18884,
565,
5446,
29918,
7620,
29918,
1256,
1405,
13407,
29918,
1256,
29901,
13,
462,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
353,
5446,
29918,
7620,
29918,
1256,
13,
13,
18884,
13407,
29918,
3317,
29918,
3318,
29918,
2311,
353,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
13,
18884,
565,
5446,
29918,
2311,
1405,
13407,
29918,
3317,
29918,
3318,
29918,
2311,
29901,
13,
462,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
462,
268,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
3108,
4619,
5446,
29918,
2311,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
3108,
4619,
2246,
29918,
5415,
29918,
2311,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
3108,
4619,
5446,
29918,
9708,
1000,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
3332,
29918,
5563,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
10892,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
311,
22742,
13,
18884,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
3597,
29918,
15581,
13,
18884,
565,
338,
29918,
3597,
29918,
15581,
1275,
29871,
29900,
29901,
13,
462,
1678,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
13,
9651,
396,
16698,
2303,
3446,
4214,
3339,
319,
8456,
12064,
350,
2692,
15842,
3148,
1001,
6732,
16786,
399,
1955,
29968,
5550,
11538,
438,
29933,
17637,
29903,
13,
9651,
565,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
29962,
3366,
6786,
3108,
451,
297,
413,
3188,
29918,
303,
3470,
29901,
13,
18884,
565,
1203,
29918,
1853,
29918,
8159,
451,
297,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29901,
13,
462,
1678,
396,
6730,
931,
8790,
445,
1203,
2989,
1134,
363,
4160,
848,
29889,
25455,
297,
278,
9657,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
353,
9657,
580,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3318,
29918,
1853,
3108,
353,
1203,
29918,
1853,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3318,
29918,
6550,
29918,
3259,
3108,
353,
1203,
29918,
6550,
29918,
3259,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
353,
5446,
29918,
7620,
29918,
1256,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
3108,
353,
2246,
29918,
5415,
29918,
2311,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29896,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
3108,
353,
5446,
29918,
9708,
1000,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
3332,
29918,
5563,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
10892,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
311,
22742,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
3108,
353,
338,
29918,
3597,
29918,
15581,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
462,
1678,
565,
338,
29918,
3597,
29918,
15581,
1275,
29871,
29896,
29901,
13,
462,
4706,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29900,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
353,
29871,
29896,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
24217,
29892,
788,
701,
1819,
16205,
29889,
13,
462,
1678,
396,
3198,
565,
2635,
338,
7621,
1135,
1833,
29918,
1545,
29918,
1256,
13,
462,
1678,
13407,
29918,
1256,
353,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
13,
462,
1678,
565,
5446,
29918,
7620,
29918,
1256,
1405,
13407,
29918,
1256,
29901,
13,
462,
4706,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
3108,
353,
5446,
29918,
7620,
29918,
1256,
13,
13,
462,
1678,
13407,
29918,
3317,
29918,
3318,
29918,
2311,
353,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
13,
462,
1678,
565,
5446,
29918,
2311,
1405,
13407,
29918,
3317,
29918,
3318,
29918,
2311,
29901,
13,
462,
4706,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
3108,
353,
5446,
29918,
2311,
13,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
3108,
4619,
5446,
29918,
2311,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
3108,
4619,
2246,
29918,
5415,
29918,
2311,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
3108,
4619,
5446,
29918,
9708,
1000,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
3332,
29918,
5563,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
10892,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
311,
22742,
13,
462,
1678,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
3108,
4619,
338,
29918,
3597,
29918,
15581,
13,
462,
1678,
565,
338,
29918,
3597,
29918,
15581,
1275,
29871,
29900,
29901,
13,
462,
4706,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
3318,
29918,
1853,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
3108,
4619,
29871,
29896,
13,
1678,
736,
313,
1287,
22854,
29918,
8977,
29892,
1203,
29918,
2798,
29879,
29918,
8977,
29892,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29892,
15474,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
29897,
13,
13,
308,
13,
1753,
6441,
29918,
1287,
3493,
29918,
16202,
7295,
13,
1678,
9995,
13,
1678,
1317,
278,
376,
3396,
29908,
740,
304,
679,
322,
6441,
1716,
664,
3493,
848,
408,
1532,
408,
664,
3493,
1203,
15837,
22663,
13,
1678,
9995,
13,
1678,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
268,
13,
13,
1678,
396,
6915,
304,
5749,
13,
1678,
4833,
29918,
9965,
353,
5749,
29889,
6915,
29898,
13,
4706,
3495,
353,
4576,
29918,
3069,
29892,
13,
4706,
1404,
353,
376,
2527,
10817,
613,
13,
4706,
1209,
9970,
353,
529,
25711,
17013,
10202,
13,
4706,
2566,
353,
376,
2527,
10817,
29908,
13,
1678,
1723,
13,
13,
1678,
10677,
353,
4833,
29918,
9965,
29889,
18127,
580,
13,
1678,
2346,
353,
376,
1509,
15691,
1972,
29918,
265,
13,
1678,
10677,
29889,
7978,
29898,
1972,
29897,
13,
268,
13,
1678,
396,
3210,
16658,
10762,
3446,
3235,
399,
3289,
360,
12413,
3446,
3235,
341,
1164,
4690,
14445,
16310,
29979,
29889,
13315,
8519,
22986,
13566,
7495,
20700,
27694,
6732,
4741,
349,
1001,
341,
1164,
4690,
313,
22027,
9818,
29979,
6093,
383,
8193,
1254,
8079,
6093,
341,
1164,
4690,
29897,
13,
1678,
9826,
353,
2635,
29889,
27765,
580,
13,
1678,
1857,
29918,
10874,
353,
851,
29898,
27765,
29889,
6360,
29897,
718,
11663,
29908,
718,
9826,
29889,
710,
615,
603,
877,
29995,
29885,
1495,
13,
13,
1678,
2346,
353,
376,
2622,
20231,
29918,
19094,
1299,
29898,
3317,
29898,
11651,
29918,
1256,
511,
29915,
29995,
29979,
19222,
29885,
1495,
515,
21556,
29889,
7193,
29918,
1287,
3493,
29918,
3318,
29918,
2798,
29879,
1769,
13,
1678,
10677,
29889,
7978,
29898,
1972,
29897,
13,
1678,
363,
313,
2585,
29918,
1256,
29897,
297,
10677,
29901,
13,
4706,
4833,
29918,
1256,
29918,
10874,
353,
4833,
29918,
1256,
29961,
29900,
29962,
13,
13,
1678,
565,
4833,
29918,
1256,
29918,
10874,
1275,
1857,
29918,
10874,
29901,
13,
4706,
1596,
703,
28350,
399,
1955,
29968,
5550,
11538,
322,
399,
29903,
438,
29933,
17637,
29903,
4810,
3904,
9375,
11901,
29428,
1001,
379,
3289,
20700,
1430,
27694,
3446,
3235,
341,
1164,
4690,
29889,
6093,
13756,
29954,
25058,
399,
24071,
8528,
1806,
1159,
13,
4706,
6876,
580,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
1806,
379,
3289,
6058,
20700,
1430,
27694,
3446,
3235,
341,
1164,
4690,
29892,
399,
29923,
399,
24071,
27694,
6093,
13756,
29954,
25058,
1159,
13,
268,
13,
13,
1678,
3132,
29922,
18294,
4032,
29898,
29885,
7443,
4051,
29918,
2527,
10817,
29918,
9965,
29974,
517,
29918,
1287,
3493,
29897,
13,
1678,
4833,
353,
3132,
29889,
1287,
3493,
13,
13,
1678,
664,
22854,
29918,
8977,
353,
679,
29918,
1287,
22854,
29898,
2585,
29897,
13,
1678,
679,
29918,
5652,
29918,
3332,
29918,
3888,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1369,
29918,
2230,
13,
1678,
664,
22854,
29918,
8977,
353,
679,
29918,
1287,
3493,
29918,
845,
5114,
29898,
2585,
29892,
664,
22854,
29918,
8977,
29897,
13,
1678,
664,
22854,
29918,
8977,
353,
679,
29918,
3597,
29918,
1287,
22854,
29898,
2585,
29892,
664,
22854,
29918,
8977,
29897,
13,
1678,
313,
1287,
22854,
29918,
8977,
29892,
1203,
29918,
2798,
29879,
29918,
8977,
29892,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29892,
15474,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
29897,
353,
320,
13,
462,
462,
462,
462,
1678,
679,
29918,
12650,
29898,
2585,
29892,
664,
22854,
29918,
8977,
29892,
4833,
29918,
9965,
29897,
13,
1678,
1596,
703,
29911,
2891,
1964,
399,
29903,
9681,
584,
376,
718,
851,
29898,
2435,
29898,
1287,
22854,
29918,
8977,
4961,
13,
1678,
11705,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1369,
29918,
2230,
13,
29937,
1678,
1596,
703,
5634,
11705,
848,
1273,
29879,
6923,
11474,
29908,
1273,
313,
29887,
1624,
29918,
2230,
876,
13,
29937,
1678,
1596,
703,
11686,
29968,
5550,
11538,
22471,
1783,
584,
16521,
13,
29937,
1678,
6499,
29889,
407,
29878,
524,
29898,
1287,
22854,
29918,
8977,
29897,
13,
29937,
1678,
1596,
703,
14824,
17637,
4810,
3904,
9375,
22471,
1783,
584,
16521,
13,
29937,
1678,
6499,
29889,
407,
29878,
524,
29898,
3318,
29918,
2798,
29879,
29918,
8977,
29897,
13,
13,
1678,
396,
11686,
29968,
5550,
2477,
2890,
11901,
29428,
4214,
13,
1678,
8273,
29918,
18127,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
664,
22854,
29918,
7851,
29918,
20788,
353,
376,
7851,
964,
21556,
29889,
1287,
22854,
6634,
13,
462,
462,
29871,
18227,
5652,
29918,
333,
29892,
8952,
29892,
878,
29918,
1256,
29892,
2847,
29918,
7620,
29918,
1256,
29892,
2407,
29918,
1256,
29892,
6634,
13,
462,
462,
29871,
376,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
29892,
3001,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
29871,
376,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
29892,
775,
29918,
3729,
29879,
29918,
2798,
29892,
15474,
1230,
29918,
3259,
29892,
6634,
13,
462,
462,
29871,
376,
10892,
29918,
3318,
29918,
2798,
29892,
11132,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
29871,
376,
7827,
29918,
2311,
29892,
2246,
29918,
29880,
20901,
29918,
2311,
29892,
338,
29918,
3597,
29892,
6634,
13,
462,
462,
29871,
376,
275,
29918,
1356,
1971,
653,
29892,
338,
29918,
311,
22742,
29892,
1353,
29918,
974,
29918,
845,
5114,
29897,
6634,
13,
462,
462,
29871,
376,
5975,
29414,
29879,
24163,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1286,
3285,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
416,
29908,
13,
13,
1678,
363,
16904,
29918,
333,
297,
12705,
29898,
1287,
22854,
29918,
8977,
29889,
8149,
580,
1125,
13,
29937,
4706,
1596,
703,
8618,
23524,
4214,
399,
29903,
29901,
376,
718,
851,
29898,
5652,
29918,
333,
29897,
718,
376,
29871,
3148,
1001,
5813,
29901,
376,
718,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
6786,
11287,
13,
4706,
1881,
353,
313,
5652,
29918,
333,
29892,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
6786,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
1545,
29918,
1256,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
11228,
29918,
7620,
29918,
1256,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
7827,
29918,
3318,
29918,
2798,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
12872,
29918,
932,
29918,
3729,
29879,
29918,
2798,
7464,
1287,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
401,
29918,
3729,
29879,
29918,
2798,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
29876,
2749,
1230,
29918,
3259,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
10892,
29918,
3318,
29918,
2798,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
311,
22742,
29918,
3318,
29918,
2798,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
7827,
29918,
2311,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
3332,
29918,
29880,
20901,
29918,
2311,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
275,
29918,
3597,
7464,
13,
462,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
275,
29918,
1356,
1971,
653,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
275,
29918,
311,
22742,
7464,
664,
22854,
29918,
8977,
29961,
5652,
29918,
333,
22322,
4537,
29918,
974,
29918,
845,
5114,
11287,
13,
4706,
8273,
29918,
18127,
29889,
7978,
29898,
1287,
22854,
29918,
7851,
29918,
20788,
29892,
2080,
29897,
13,
13,
308,
13,
1678,
1596,
703,
29911,
2891,
1964,
399,
29903,
9681,
584,
376,
718,
851,
29898,
2435,
29898,
1287,
22854,
29918,
8977,
4961,
13,
1678,
1596,
703,
5634,
679,
16904,
2246,
5235,
931,
3614,
1273,
29879,
6923,
11474,
29908,
1273,
313,
657,
29918,
5652,
29918,
3332,
29918,
3888,
29918,
2230,
876,
13,
1678,
1596,
703,
5634,
11705,
848,
1273,
29879,
6923,
11474,
29908,
1273,
313,
29887,
1624,
29918,
2230,
876,
13,
308,
13,
1678,
664,
3493,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
313,
29887,
1624,
29918,
2230,
718,
1369,
29918,
2230,
29897,
13,
1678,
1596,
703,
5634,
664,
22854,
6441,
292,
29871,
1273,
29879,
6923,
11474,
29908,
1273,
313,
1287,
3493,
29918,
2230,
876,
13,
13,
1678,
396,
14824,
17637,
4810,
3904,
9375,
11901,
29428,
4214,
13,
1678,
8273,
29918,
18127,
29918,
5415,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
5446,
29918,
2798,
29879,
29918,
7851,
29918,
20788,
353,
376,
7851,
964,
21556,
29889,
1287,
3493,
29918,
3318,
29918,
2798,
29879,
6634,
13,
462,
462,
29871,
18227,
3318,
29918,
1853,
29892,
1203,
29918,
6550,
29918,
3259,
29892,
1203,
29918,
1853,
29918,
8159,
29892,
6634,
13,
462,
462,
29871,
376,
11651,
29918,
1256,
29892,
1833,
29918,
1545,
29918,
1256,
29892,
2246,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
29871,
376,
7827,
29918,
3318,
29918,
2798,
29892,
970,
29918,
3318,
29918,
2798,
29892,
2024,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
29871,
376,
10892,
29918,
3318,
29918,
2798,
29892,
11132,
29918,
3318,
29918,
2798,
29892,
3509,
29918,
2798,
29892,
6634,
13,
462,
462,
29871,
376,
7827,
29918,
2311,
29892,
2246,
29918,
29880,
20901,
29918,
2311,
29892,
4236,
29918,
3318,
29918,
2311,
29897,
6634,
13,
462,
462,
29871,
376,
5975,
29414,
29879,
24163,
29879,
29892,
1273,
29879,
29892,
1286,
3285,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
416,
29908,
13,
1678,
396,
2158,
703,
14824,
17637,
4810,
3904,
9375,
22471,
1783,
584,
376,
718,
851,
29898,
3318,
29918,
2798,
29879,
29918,
8977,
876,
29871,
13,
1678,
363,
5446,
29918,
8159,
297,
12705,
29898,
3318,
29918,
2798,
29879,
29918,
8977,
1125,
13,
4706,
5446,
29918,
2080,
353,
313,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3318,
29918,
1853,
12436,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3318,
29918,
6550,
29918,
3259,
12436,
13,
462,
268,
5446,
29918,
8159,
29892,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
12436,
29871,
13,
462,
268,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
12436,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
12436,
13,
462,
268,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
12436,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
12436,
13,
462,
268,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
12436,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
12436,
13,
462,
268,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
12436,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
12436,
13,
462,
268,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
12436,
1203,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
20068,
13,
4706,
8273,
29918,
18127,
29889,
7978,
29898,
5415,
29918,
2798,
29879,
29918,
7851,
29918,
20788,
29892,
5415,
29918,
2080,
29897,
13,
13,
1678,
1203,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
313,
1287,
3493,
29918,
2230,
718,
11705,
29918,
2230,
718,
1369,
29918,
2230,
29897,
13,
1678,
1596,
703,
5634,
1203,
18139,
6441,
292,
1273,
29879,
6923,
11474,
29908,
1273,
313,
3318,
29918,
2230,
876,
13,
268,
13,
1678,
396,
11889,
29903,
29918,
14824,
17637,
4810,
3904,
9375,
11901,
29428,
4214,
13,
1678,
8273,
29918,
18127,
29918,
5415,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
4160,
29918,
5415,
29918,
2798,
29879,
29918,
7851,
29918,
20788,
353,
376,
7851,
964,
21556,
29889,
7193,
29918,
1287,
3493,
29918,
3318,
29918,
2798,
29879,
6634,
13,
462,
462,
4706,
18227,
3318,
29918,
1853,
29892,
1203,
29918,
6550,
29918,
3259,
29892,
1203,
29918,
1853,
29918,
8159,
29892,
6634,
13,
462,
462,
4706,
376,
11651,
29918,
1256,
29892,
1833,
29918,
1545,
29918,
1256,
29892,
2246,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
4706,
376,
7827,
29918,
3318,
29918,
2798,
29892,
970,
29918,
3318,
29918,
2798,
29892,
2024,
29918,
3318,
29918,
2798,
29892,
6634,
13,
462,
462,
4706,
376,
10892,
29918,
3318,
29918,
2798,
29892,
11132,
29918,
3318,
29918,
2798,
29892,
3509,
29918,
2798,
29892,
6634,
13,
462,
462,
4706,
376,
7827,
29918,
2311,
29892,
2246,
29918,
29880,
20901,
29918,
2311,
29892,
4236,
29918,
3318,
29918,
2311,
29897,
6634,
13,
462,
462,
4706,
376,
5975,
29414,
29879,
24163,
29879,
29892,
1273,
29879,
29892,
1286,
3285,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
29892,
1273,
29879,
416,
29908,
13,
1678,
363,
5446,
29918,
8159,
297,
12705,
29898,
7193,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
1125,
13,
4706,
4160,
29918,
5415,
29918,
2080,
353,
313,
7193,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3318,
29918,
1853,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3318,
29918,
6550,
29918,
3259,
12436,
13,
462,
965,
5446,
29918,
8159,
29892,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
4230,
29918,
1545,
29918,
1256,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
7827,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3597,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
9053,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
10892,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
311,
22742,
29918,
3318,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
8552,
29918,
2798,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
7827,
29918,
2311,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3332,
29918,
29880,
20901,
29918,
2311,
12436,
13,
462,
965,
4160,
29918,
3318,
29918,
2798,
29879,
29918,
8977,
29961,
5415,
29918,
8159,
29962,
3366,
3317,
29918,
3318,
29918,
2311,
20068,
13,
4706,
8273,
29918,
18127,
29889,
7978,
29898,
7193,
29918,
5415,
29918,
2798,
29879,
29918,
7851,
29918,
20788,
29892,
7193,
29918,
5415,
29918,
2080,
29897,
13,
13,
1678,
4160,
29918,
3318,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
313,
1287,
3493,
29918,
2230,
718,
11705,
29918,
2230,
718,
1369,
29918,
2230,
718,
1203,
29918,
2230,
29897,
13,
1678,
1596,
703,
5634,
4160,
1203,
18139,
6441,
292,
1273,
29879,
6923,
11474,
29908,
1273,
313,
7193,
29918,
3318,
29918,
2230,
876,
13,
13,
1678,
396,
29903,
3308,
4162,
1783,
317,
8187,
7077,
11698,
2287,
14482,
4214,
29914,
4897,
25832,
4214,
13,
1678,
396,
3644,
4864,
29892,
2767,
278,
1833,
29918,
28026,
29918,
1256,
13,
1678,
396,
3644,
947,
451,
1863,
1207,
263,
716,
2407,
29889,
13,
1678,
396,
2346,
304,
1074,
565,
372,
4864,
13,
1678,
8273,
29918,
18127,
29918,
893,
29876,
29918,
9933,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
269,
16586,
29918,
9933,
29918,
1972,
353,
376,
2622,
2302,
22798,
515,
21556,
29889,
29879,
375,
1103,
29918,
845,
1698,
29918,
18010,
6634,
13,
462,
539,
376,
3062,
16904,
29918,
5415,
29918,
5679,
353,
1273,
29879,
322,
19253,
29918,
3177,
353,
1273,
29879,
29908,
13,
13,
1678,
396,
2346,
29918,
517,
29918,
5504,
12326,
29918,
845,
1698,
29918,
18010,
13,
1678,
8273,
29918,
18127,
29918,
893,
29876,
29918,
5504,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
12326,
29918,
845,
1698,
29918,
3177,
29918,
5504,
29918,
20788,
353,
376,
5504,
21556,
29889,
29879,
375,
1103,
29918,
845,
1698,
29918,
18010,
6634,
13,
462,
462,
3986,
376,
842,
1833,
29918,
28026,
29918,
1256,
353,
1286,
580,
6634,
13,
462,
462,
3986,
376,
3062,
16904,
29918,
5415,
29918,
5679,
353,
1273,
29879,
322,
19253,
29918,
3177,
353,
1273,
29879,
15458,
13,
13,
1678,
396,
2346,
29918,
517,
29918,
7851,
12326,
29918,
845,
1698,
29918,
18010,
13,
1678,
8273,
29918,
18127,
29918,
893,
29876,
29918,
7851,
353,
4833,
29918,
9965,
29889,
18127,
29898,
15287,
1965,
29922,
5574,
29897,
13,
1678,
12326,
29918,
845,
1698,
29918,
3177,
29918,
7851,
29918,
20788,
353,
376,
7851,
964,
21556,
29889,
29879,
375,
1103,
29918,
845,
1698,
29918,
18010,
6634,
13,
462,
462,
3986,
18227,
5652,
29918,
5415,
29918,
5679,
29892,
19253,
29918,
3177,
29892,
6634,
13,
462,
462,
3986,
376,
4102,
29918,
28026,
29918,
1256,
29892,
1833,
29918,
28026,
29918,
1256,
29892,
16904,
29918,
333,
29897,
6634,
13,
462,
462,
3986,
376,
5975,
29414,
29879,
24163,
29879,
29892,
1286,
3285,
1286,
3285,
1273,
29879,
416,
29908,
13,
13,
29937,
1678,
1596,
703,
29876,
2749,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
584,
376,
718,
851,
29898,
29876,
2749,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
876,
13,
1678,
363,
17655,
29918,
999,
297,
15474,
1230,
29918,
24539,
29918,
2541,
29918,
845,
1698,
29918,
3177,
29918,
12175,
29901,
13,
29937,
4706,
1596,
703,
1177,
317,
8187,
7077,
11698,
2287,
29903,
306,
1799,
12996,
584,
376,
718,
17655,
29918,
999,
29897,
13,
4706,
313,
5652,
29918,
333,
29892,
17655,
29918,
333,
29892,
17655,
29918,
3259,
29897,
353,
17655,
29918,
999,
29889,
5451,
11974,
1159,
13,
4706,
521,
2039,
398,
29918,
18127,
353,
4833,
29889,
1287,
3493,
9930,
29963,
414,
1080,
29889,
2886,
3319,
29908,
5652,
1115,
524,
29898,
5652,
29918,
333,
511,
29908,
333,
1115,
524,
29898,
24156,
29918,
333,
511,
29908,
369,
1115,
524,
29898,
24156,
29918,
3259,
19230,
6377,
305,
2039,
398,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
4706,
521,
2039,
398,
353,
6213,
13,
4706,
363,
521,
2039,
398,
29918,
2749,
297,
521,
2039,
398,
29918,
18127,
29901,
13,
9651,
521,
2039,
398,
353,
521,
2039,
398,
29918,
2749,
3366,
305,
2039,
398,
3108,
13,
4706,
2943,
29918,
18127,
353,
2585,
29889,
845,
1698,
29918,
3177,
3388,
29889,
2886,
3319,
29908,
305,
2039,
398,
1115,
305,
2039,
398,
1118,
6377,
3177,
1115,
29896,
1699,
29918,
333,
1115,
29900,
1800,
13,
4706,
2943,
353,
6213,
13,
4706,
363,
2943,
29918,
2749,
297,
2943,
29918,
18127,
29901,
13,
9651,
2943,
353,
2943,
29918,
2749,
3366,
3177,
3108,
13,
13,
4706,
396,
3198,
565,
17655,
29918,
999,
29918,
3177,
419,
833,
4864,
29901,
13,
4706,
8273,
29918,
18127,
29918,
893,
29876,
29918,
9933,
29889,
7978,
29898,
893,
29876,
29918,
9933,
29918,
1972,
22657,
24156,
29918,
999,
29892,
2943,
876,
13,
4706,
4864,
29918,
2798,
29918,
2749,
353,
8273,
29918,
18127,
29918,
893,
29876,
29918,
9933,
29889,
9155,
650,
580,
13,
4706,
565,
4864,
29918,
2798,
29918,
2749,
29961,
29900,
29962,
1275,
29871,
29900,
29901,
13,
9651,
396,
1004,
550,
263,
716,
1108,
15474,
1230,
29914,
3177,
4225,
385,
4635,
13,
9651,
8273,
29918,
18127,
29918,
893,
29876,
29918,
7851,
29889,
7978,
29898,
29879,
375,
1103,
29918,
845,
1698,
29918,
3177,
29918,
7851,
29918,
20788,
22657,
24156,
29918,
999,
29892,
2943,
29892,
938,
29898,
5652,
29918,
333,
4961,
13,
4706,
1683,
29901,
13,
9651,
396,
1004,
550,
278,
17655,
29918,
999,
2943,
22856,
869,
10318,
278,
1833,
3595,
2635,
29889,
13,
9651,
8273,
29918,
18127,
29918,
893,
29876,
29918,
7851,
29889,
7978,
29898,
29879,
375,
1103,
29918,
845,
1698,
29918,
3177,
29918,
5504,
29918,
20788,
22657,
24156,
29918,
999,
29892,
2943,
876,
13,
3986,
13,
1678,
4833,
29918,
9965,
29889,
15060,
580,
13,
13,
29937,
9009,
29918,
1287,
3493,
29918,
16202,
580,
13,
2
] |
neviseh/persian/numbers.py | meyt/neviseh | 0 | 189886 | <filename>neviseh/persian/numbers.py
from . import PersianTextBase
class PersianNumbers(PersianTextBase):
def translate_arabic_numbers(self):
"""
Translate Arabic numbers to Persian
:return:
"""
characters_map = {
'١': '۱',
'٢': '۲',
'٣': '۳',
'٤': '۴',
'٥': '۵',
'٦': '۶',
'٧': '۷',
'٨': '۸',
'٩': '۹',
'٠': '۰',
}
self.replace_by_character_map('arabic_numbers_replace', characters_map)
return self
def translate_latin_numbers(self):
"""
Translate Latin numbers to Persian
:return:
"""
characters_map = {
'0': '۰',
'1': '۱',
'2': '۲',
'3': '۳',
'4': '۴',
'5': '۵',
'6': '۶',
'7': '۷',
'8': '۸',
'9': '۹',
'.': '.',
'%': '٪'
}
self.replace_by_character_map('latin_numbers_replace', characters_map)
return self
| [
1,
529,
9507,
29958,
484,
29894,
895,
29882,
29914,
6774,
713,
29914,
20326,
29889,
2272,
13,
3166,
869,
1053,
9034,
713,
1626,
5160,
13,
13,
13,
1990,
9034,
713,
29478,
29898,
15136,
713,
1626,
5160,
1125,
13,
13,
1678,
822,
14240,
29918,
25822,
293,
29918,
20326,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4103,
9632,
10387,
293,
3694,
304,
9034,
713,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
4890,
29918,
1958,
353,
426,
13,
9651,
525,
220,
164,
2396,
525,
222,
180,
742,
13,
9651,
525,
220,
165,
2396,
525,
222,
181,
742,
13,
9651,
525,
220,
166,
2396,
525,
222,
182,
742,
13,
9651,
525,
220,
167,
2396,
525,
222,
183,
742,
13,
9651,
525,
220,
168,
2396,
525,
222,
184,
742,
13,
9651,
525,
220,
169,
2396,
525,
222,
185,
742,
13,
9651,
525,
220,
170,
2396,
525,
222,
186,
742,
13,
9651,
525,
220,
171,
2396,
525,
222,
187,
742,
13,
9651,
525,
220,
172,
2396,
525,
222,
188,
742,
13,
9651,
525,
220,
163,
2396,
525,
222,
179,
742,
13,
4706,
500,
13,
4706,
1583,
29889,
6506,
29918,
1609,
29918,
18609,
29918,
1958,
877,
25822,
293,
29918,
20326,
29918,
6506,
742,
4890,
29918,
1958,
29897,
13,
4706,
736,
1583,
13,
13,
1678,
822,
14240,
29918,
5066,
262,
29918,
20326,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4103,
9632,
13548,
3694,
304,
9034,
713,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
4890,
29918,
1958,
353,
426,
13,
9651,
525,
29900,
2396,
525,
222,
179,
742,
13,
9651,
525,
29896,
2396,
525,
222,
180,
742,
13,
9651,
525,
29906,
2396,
525,
222,
181,
742,
13,
9651,
525,
29941,
2396,
525,
222,
182,
742,
13,
9651,
525,
29946,
2396,
525,
222,
183,
742,
13,
9651,
525,
29945,
2396,
525,
222,
184,
742,
13,
9651,
525,
29953,
2396,
525,
222,
185,
742,
13,
9651,
525,
29955,
2396,
525,
222,
186,
742,
13,
9651,
525,
29947,
2396,
525,
222,
187,
742,
13,
9651,
525,
29929,
2396,
525,
222,
188,
742,
13,
9651,
15300,
2396,
15300,
742,
13,
9651,
14210,
2396,
525,
220,
173,
29915,
13,
4706,
500,
13,
4706,
1583,
29889,
6506,
29918,
1609,
29918,
18609,
29918,
1958,
877,
5066,
262,
29918,
20326,
29918,
6506,
742,
4890,
29918,
1958,
29897,
13,
4706,
736,
1583,
13,
2
] |
pyrevolve/genotype/learning_body/crossover.py | braj29/robo_swimmers | 0 | 72173 | <reponame>braj29/robo_swimmers
from typing import List
from .config import Config
from pyrevolve.genotype.genotype import Genotype
def crossover(parents: List[Genotype], config: Config) -> Genotype:
return parents[0]
| [
1,
529,
276,
1112,
420,
29958,
2634,
29926,
29906,
29929,
29914,
307,
833,
29918,
2774,
6727,
414,
13,
3166,
19229,
1053,
2391,
13,
3166,
869,
2917,
1053,
12782,
13,
3166,
11451,
276,
1555,
345,
29889,
1885,
327,
668,
29889,
1885,
327,
668,
1053,
5739,
327,
668,
13,
13,
13,
1753,
274,
1883,
578,
369,
29898,
862,
1237,
29901,
2391,
29961,
15462,
327,
668,
1402,
2295,
29901,
12782,
29897,
1599,
5739,
327,
668,
29901,
13,
1678,
736,
11825,
29961,
29900,
29962,
13,
2
] |
bot/main.py | EJH2/IQ-Discord | 1 | 193132 | # coding=utf-8
"""Main bot file"""
import aiohttp
import time
from collections import Counter, deque
from pathlib import Path
import discord
from discord.ext import commands
from pyppeteer import launch, errors
from bot.utils.logging import setup_logger
from bot.utils.over import send, _default_help_command
discord.abc.Messageable.send = send
class Bot(commands.AutoShardedBot):
"""Subclasses AutoShardedBot to give more flexibility with design"""
def __init__(self, *args, **kwargs):
self.config = kwargs.pop('config')
self.start_time = time.time()
super().__init__(*args, **kwargs)
# pay no mind to this ugliness.
self.remove_command('help')
self.command(**self.help_attrs)(_default_help_command)
self.pm_help = None
self.case_insensitive = True
self.app_info = None
shard = f"| Shard {self.shard_id}" if self.shard_id else ""
self.activity = discord.Game(name=f"{self.command_prefix}help {shard}")
self.session = aiohttp.ClientSession(loop=self.loop, headers={"User-Agent": self.http.user_agent})
self.browser_page = None
self.browser = self.loop.create_task(self.create_browser())
self.priv = self.config['extras'].get('privatebin', 'https://privatebin.net')
self.polr = self.config['extras'].get('polr', None)
self.commands_used = Counter()
self.commands_used_in = Counter()
self.errors = deque(maxlen=10)
self.revisions = None
discord_logger = setup_logger("discord")
self.logger = setup_logger("Bot")
self.command_logger = setup_logger("Commands")
self.loggers = [discord_logger, self.logger, self.command_logger]
_modules = [mod.stem for mod in Path("bot/cogs").glob("*.py")]
self.load_extension(f"bot.cogs.core")
self.load_extension(f"bot.cogs.owner")
if 'bare' in kwargs.pop('argv'): # load the bot bare-bones to diagnose issues
return
for module in _modules:
try:
if module in ['core', 'errors']:
pass
self.load_extension(f"bot.cogs.{module}")
except discord.DiscordException as exc:
self.logger.error(f"{type(exc).__name__} occurred when loading {module}: {exc}")
# make sure to only print ready text once
self._loaded = False
async def on_ready(self):
"""Function called when bot is ready or resumed"""
if self._loaded is False:
end_time = time.time() - self.start_time
self.app_info = await self.application_info()
self.logger.info(f"Loaded Bot:")
self.logger.info(f"Logged in as {self.user}")
self.logger.info(f"ID is {self.user.id}")
self.logger.info(f"Owned by {self.app_info.owner}")
self.description = f"Hello, this is the help menu for {self.user.name}!"
self.logger.info(f"Bot started in {end_time} seconds")
self._loaded = True
return
self.logger.info(f"Resumed bot session on shard {self.shard_id}!")
async def create_browser(self):
"""Task to create browser for scraping purposes."""
await self.wait_until_ready()
self.browser = await launch(args=["--no-sandbox"], headless=True)
self.browser_page = await self.browser.newPage()
# noinspection PyProtectedMember
async def close(self):
"""Function called when closing the bot"""
try:
await self.browser_page.close() or self.logger.info("Browser page successfully closed!")
except (errors.PageError, AttributeError): # browser was never created; edge case
pass
await self.browser.close() or self.logger.info("Browser successfully closed!")
await super().close()
await self.http._session.close()
await self.session.close()
for logger in self.loggers:
for handler in logger.handlers:
logger.removeHandler(handler)
| [
1,
396,
14137,
29922,
9420,
29899,
29947,
13,
15945,
29908,
6330,
9225,
934,
15945,
29908,
13,
5215,
263,
601,
1124,
13,
5215,
931,
13,
3166,
16250,
1053,
315,
5336,
29892,
316,
802,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
5215,
2313,
536,
13,
3166,
2313,
536,
29889,
1062,
1053,
8260,
13,
3166,
11451,
407,
2650,
261,
1053,
6826,
29892,
4436,
13,
13,
3166,
9225,
29889,
13239,
29889,
21027,
1053,
6230,
29918,
21707,
13,
3166,
9225,
29889,
13239,
29889,
957,
1053,
3638,
29892,
903,
4381,
29918,
8477,
29918,
6519,
13,
13,
13,
2218,
16090,
29889,
10736,
29889,
3728,
519,
29889,
6717,
353,
3638,
13,
13,
13,
1990,
11273,
29898,
26381,
29889,
12300,
2713,
25600,
29933,
327,
1125,
13,
1678,
9995,
4035,
13203,
11133,
2713,
25600,
29933,
327,
304,
2367,
901,
8525,
4127,
411,
2874,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
2917,
353,
9049,
5085,
29889,
7323,
877,
2917,
1495,
13,
4706,
1583,
29889,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
396,
5146,
694,
3458,
304,
445,
318,
29887,
1915,
404,
29889,
13,
4706,
1583,
29889,
5992,
29918,
6519,
877,
8477,
1495,
13,
4706,
1583,
29889,
6519,
29898,
1068,
1311,
29889,
8477,
29918,
5552,
29879,
5033,
29918,
4381,
29918,
8477,
29918,
6519,
29897,
13,
4706,
1583,
29889,
3358,
29918,
8477,
353,
6213,
13,
4706,
1583,
29889,
4878,
29918,
1144,
575,
3321,
353,
5852,
13,
4706,
1583,
29889,
932,
29918,
3888,
353,
6213,
13,
4706,
528,
538,
353,
285,
29908,
29989,
1383,
538,
426,
1311,
29889,
845,
538,
29918,
333,
5038,
565,
1583,
29889,
845,
538,
29918,
333,
1683,
5124,
13,
4706,
1583,
29889,
10072,
353,
2313,
536,
29889,
14199,
29898,
978,
29922,
29888,
29908,
29912,
1311,
29889,
6519,
29918,
13506,
29913,
8477,
426,
845,
538,
27195,
13,
13,
4706,
1583,
29889,
7924,
353,
263,
601,
1124,
29889,
4032,
7317,
29898,
7888,
29922,
1311,
29889,
7888,
29892,
9066,
3790,
29908,
2659,
29899,
19661,
1115,
1583,
29889,
1124,
29889,
1792,
29918,
14748,
1800,
13,
4706,
1583,
29889,
15965,
29918,
3488,
353,
6213,
13,
4706,
1583,
29889,
15965,
353,
1583,
29889,
7888,
29889,
3258,
29918,
7662,
29898,
1311,
29889,
3258,
29918,
15965,
3101,
13,
4706,
1583,
29889,
22534,
353,
1583,
29889,
2917,
1839,
1062,
3417,
13359,
657,
877,
9053,
2109,
742,
525,
991,
597,
9053,
2109,
29889,
1212,
1495,
13,
4706,
1583,
29889,
3733,
29878,
353,
1583,
29889,
2917,
1839,
1062,
3417,
13359,
657,
877,
3733,
29878,
742,
6213,
29897,
13,
13,
4706,
1583,
29889,
26381,
29918,
3880,
353,
315,
5336,
580,
13,
4706,
1583,
29889,
26381,
29918,
3880,
29918,
262,
353,
315,
5336,
580,
13,
4706,
1583,
29889,
12523,
353,
316,
802,
29898,
3317,
2435,
29922,
29896,
29900,
29897,
13,
4706,
1583,
29889,
276,
1730,
1080,
353,
6213,
13,
13,
4706,
2313,
536,
29918,
21707,
353,
6230,
29918,
21707,
703,
2218,
16090,
1159,
13,
4706,
1583,
29889,
21707,
353,
6230,
29918,
21707,
703,
29933,
327,
1159,
13,
4706,
1583,
29889,
6519,
29918,
21707,
353,
6230,
29918,
21707,
703,
5261,
4167,
1159,
13,
4706,
1583,
29889,
1188,
5743,
353,
518,
2218,
16090,
29918,
21707,
29892,
1583,
29889,
21707,
29892,
1583,
29889,
6519,
29918,
21707,
29962,
13,
13,
4706,
903,
7576,
353,
518,
1545,
29889,
303,
331,
363,
878,
297,
10802,
703,
7451,
29914,
29883,
12099,
2564,
23705,
703,
10521,
2272,
13531,
13,
4706,
1583,
29889,
1359,
29918,
17588,
29898,
29888,
29908,
7451,
29889,
29883,
12099,
29889,
3221,
1159,
13,
4706,
1583,
29889,
1359,
29918,
17588,
29898,
29888,
29908,
7451,
29889,
29883,
12099,
29889,
20348,
1159,
13,
4706,
565,
525,
18354,
29915,
297,
9049,
5085,
29889,
7323,
877,
19218,
29374,
29871,
396,
2254,
278,
9225,
16079,
29899,
29890,
2873,
304,
24876,
852,
5626,
13,
9651,
736,
13,
4706,
363,
3883,
297,
903,
7576,
29901,
13,
9651,
1018,
29901,
13,
18884,
565,
3883,
297,
6024,
3221,
742,
525,
12523,
2033,
29901,
13,
462,
1678,
1209,
13,
18884,
1583,
29889,
1359,
29918,
17588,
29898,
29888,
29908,
7451,
29889,
29883,
12099,
29889,
29912,
5453,
27195,
13,
9651,
5174,
2313,
536,
29889,
4205,
16090,
2451,
408,
5566,
29901,
13,
18884,
1583,
29889,
21707,
29889,
2704,
29898,
29888,
29908,
29912,
1853,
29898,
735,
29883,
467,
1649,
978,
1649,
29913,
10761,
746,
8363,
426,
5453,
6177,
426,
735,
29883,
27195,
13,
13,
4706,
396,
1207,
1854,
304,
871,
1596,
7960,
1426,
2748,
13,
4706,
1583,
3032,
15638,
353,
7700,
13,
13,
1678,
7465,
822,
373,
29918,
2040,
29898,
1311,
1125,
13,
4706,
9995,
6678,
2000,
746,
9225,
338,
7960,
470,
620,
21571,
15945,
29908,
13,
4706,
565,
1583,
3032,
15638,
338,
7700,
29901,
13,
9651,
1095,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1583,
29889,
2962,
29918,
2230,
13,
9651,
1583,
29889,
932,
29918,
3888,
353,
7272,
1583,
29889,
6214,
29918,
3888,
580,
13,
9651,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
29147,
11273,
29901,
1159,
13,
9651,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
3403,
3192,
297,
408,
426,
1311,
29889,
1792,
27195,
13,
9651,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
1367,
338,
426,
1311,
29889,
1792,
29889,
333,
27195,
13,
9651,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
29949,
1233,
287,
491,
426,
1311,
29889,
932,
29918,
3888,
29889,
20348,
27195,
13,
9651,
1583,
29889,
8216,
353,
285,
29908,
10994,
29892,
445,
338,
278,
1371,
6143,
363,
426,
1311,
29889,
1792,
29889,
978,
29913,
3850,
13,
9651,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
29933,
327,
4687,
297,
426,
355,
29918,
2230,
29913,
6923,
1159,
13,
9651,
1583,
3032,
15638,
353,
5852,
13,
9651,
736,
13,
4706,
1583,
29889,
21707,
29889,
3888,
29898,
29888,
29908,
1666,
21571,
9225,
4867,
373,
528,
538,
426,
1311,
29889,
845,
538,
29918,
333,
29913,
29991,
1159,
13,
13,
1678,
7465,
822,
1653,
29918,
15965,
29898,
1311,
1125,
13,
4706,
9995,
5398,
304,
1653,
4714,
363,
885,
2390,
292,
11976,
1213,
15945,
13,
4706,
7272,
1583,
29889,
10685,
29918,
29305,
29918,
2040,
580,
13,
4706,
1583,
29889,
15965,
353,
7272,
6826,
29898,
5085,
29922,
3366,
489,
1217,
29899,
29879,
26738,
12436,
2343,
2222,
29922,
5574,
29897,
13,
4706,
1583,
29889,
15965,
29918,
3488,
353,
7272,
1583,
29889,
15965,
29889,
1482,
5074,
580,
13,
13,
1678,
396,
694,
1144,
27988,
10772,
1184,
371,
2954,
13404,
13,
1678,
7465,
822,
3802,
29898,
1311,
1125,
13,
4706,
9995,
6678,
2000,
746,
14382,
278,
9225,
15945,
29908,
13,
4706,
1018,
29901,
13,
9651,
7272,
1583,
29889,
15965,
29918,
3488,
29889,
5358,
580,
470,
1583,
29889,
21707,
29889,
3888,
703,
21537,
1813,
8472,
5764,
29991,
1159,
13,
4706,
5174,
313,
12523,
29889,
5074,
2392,
29892,
23833,
2392,
1125,
29871,
396,
4714,
471,
2360,
2825,
29936,
7636,
1206,
13,
9651,
1209,
13,
4706,
7272,
1583,
29889,
15965,
29889,
5358,
580,
470,
1583,
29889,
21707,
29889,
3888,
703,
21537,
8472,
5764,
29991,
1159,
13,
4706,
7272,
2428,
2141,
5358,
580,
13,
4706,
7272,
1583,
29889,
1124,
3032,
7924,
29889,
5358,
580,
13,
4706,
7272,
1583,
29889,
7924,
29889,
5358,
580,
13,
4706,
363,
17927,
297,
1583,
29889,
1188,
5743,
29901,
13,
9651,
363,
7834,
297,
17927,
29889,
3179,
9306,
29901,
13,
18884,
17927,
29889,
5992,
4598,
29898,
13789,
29897,
13,
2
] |
dbaas/drivers/mysqlpercona.py | didindinn/database-as-a-service | 303 | 78614 | from . import mysqldb
from physical.models import Instance
class MySQLPercona(mysqldb.MySQL):
def get_default_instance_type(self):
return Instance.MYSQL_PERCONA
@classmethod
def topology_name(cls):
return ['mysql_percona_single']
class MySQLPerconaFOXHA(mysqldb.MySQLFOXHA):
def get_default_instance_type(self):
return Instance.MYSQL_PERCONA
@classmethod
def topology_name(cls):
return ['mysql_percona_foxha']
| [
1,
515,
869,
1053,
15534,
430,
29890,
13,
3166,
9128,
29889,
9794,
1053,
2799,
749,
13,
13,
13,
1990,
9254,
5894,
535,
29874,
29898,
19268,
430,
29890,
29889,
3421,
4176,
1125,
13,
13,
1678,
822,
679,
29918,
4381,
29918,
8758,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
2799,
749,
29889,
17870,
4176,
29918,
13171,
6007,
29909,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
20159,
29918,
978,
29898,
25932,
1125,
13,
4706,
736,
6024,
7938,
29918,
546,
535,
29874,
29918,
14369,
2033,
13,
13,
13,
1990,
9254,
5894,
535,
29874,
5800,
29990,
15715,
29898,
19268,
430,
29890,
29889,
3421,
4176,
5800,
29990,
15715,
1125,
13,
13,
1678,
822,
679,
29918,
4381,
29918,
8758,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
2799,
749,
29889,
17870,
4176,
29918,
13171,
6007,
29909,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
20159,
29918,
978,
29898,
25932,
1125,
13,
4706,
736,
6024,
7938,
29918,
546,
535,
29874,
29918,
8944,
2350,
2033,
13,
2
] |
examples/max_min.py | csunny/algorithm | 21 | 70927 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
def max_min(v):
m_min, m_max = min(v[0], v[-1]), max(v[0], v[-1])
for i in v[1:len(v)-1]:
if i<m_min:
m_min = i
elif i > m_max:
m_max = i
return m_min, m_max
if __name__ == '__main__':
m_min, m_max = max_min([9, 3, 4, 7, 2, 0])
print(m_min, m_max)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
13,
1753,
4236,
29918,
1195,
29898,
29894,
1125,
13,
1678,
286,
29918,
1195,
29892,
286,
29918,
3317,
353,
1375,
29898,
29894,
29961,
29900,
1402,
325,
14352,
29896,
11724,
4236,
29898,
29894,
29961,
29900,
1402,
325,
14352,
29896,
2314,
13,
1678,
363,
474,
297,
325,
29961,
29896,
29901,
2435,
29898,
29894,
6817,
29896,
5387,
13,
4706,
565,
474,
29966,
29885,
29918,
1195,
29901,
13,
9651,
286,
29918,
1195,
353,
474,
13,
4706,
25342,
474,
1405,
286,
29918,
3317,
29901,
13,
9651,
286,
29918,
3317,
353,
474,
13,
268,
13,
1678,
736,
286,
29918,
1195,
29892,
286,
29918,
3317,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
286,
29918,
1195,
29892,
286,
29918,
3317,
353,
4236,
29918,
1195,
4197,
29929,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29955,
29892,
29871,
29906,
29892,
29871,
29900,
2314,
13,
1678,
1596,
29898,
29885,
29918,
1195,
29892,
286,
29918,
3317,
29897,
13,
2
] |
workflows/pangenome-generate/sort_fasta_by_quality_and_len.py | AndreaGuarracino/bh20-seq-resource | 2 | 138778 | #!/usr/bin/env python3
# Sort the sequences by quality (percentage of number of N bases not called, descending) and by length (descending).
# The best sequence is the longest one, with no uncalled bases.
import os
import sys
import gzip
#import xxhash # Faster library
import hashlib
def open_gzipsafe(path_file):
if path_file.endswith('.gz'):
return gzip.open(path_file, 'rt')
else:
return open(path_file)
path_fasta = sys.argv[1]
hash_to_count_and_headers_dict = {}
header_to_seq_dict = {}
header_percCalledBases_seqLength_list = []
with open_gzipsafe(path_fasta) as f:
for fasta in f.read().strip('\n>').split('>'):
header = fasta.strip('\n').split('\n')[0]
sequence = ''.join(fasta.strip('\n').split('\n')[1:])
##hash = xxhash.xxh64(sequence).hexdigest() # Faster library
hash = hashlib.md5(sequence.encode('utf-8')).hexdigest()
if hash not in hash_to_count_and_headers_dict:
# New sequence
hash_to_count_and_headers_dict[hash] = [0, []]
header_to_seq_dict[header] = sequence
seq_len = len(sequence)
header_percCalledBases_seqLength_list.append([header, (seq_len - sequence.count('N'))/seq_len, seq_len])
hash_to_count_and_headers_dict[hash][0] += 1
hash_to_count_and_headers_dict[hash][1].append(header)
with open('dups.txt', 'w') as fw:
for count, header_list in hash_to_count_and_headers_dict.values():
fw.write('\t'.join([str(count), ', '.join(header_list)]) + '\n')
for header, percCalledBases, seqLength_list in sorted(header_percCalledBases_seqLength_list, key=lambda x: (x[-2], x[-1]), reverse = True):
sys.stdout.write('>{}\n{}\n'.format(header, header_to_seq_dict[header]))
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
29937,
20025,
278,
15602,
491,
11029,
313,
25376,
482,
310,
1353,
310,
405,
22561,
451,
2000,
29892,
5153,
2548,
29897,
322,
491,
3309,
313,
14273,
2548,
467,
13,
29937,
450,
1900,
5665,
338,
278,
27217,
697,
29892,
411,
694,
443,
13998,
22561,
29889,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
330,
7554,
13,
13,
29937,
5215,
15473,
8568,
396,
383,
1901,
3489,
13,
5215,
6608,
1982,
13,
13,
1753,
1722,
29918,
29887,
2526,
567,
29874,
1725,
29898,
2084,
29918,
1445,
1125,
13,
1678,
565,
2224,
29918,
1445,
29889,
1975,
2541,
12839,
18828,
29374,
13,
268,
12,
2457,
330,
7554,
29889,
3150,
29898,
2084,
29918,
1445,
29892,
525,
2273,
1495,
13,
1678,
1683,
29901,
13,
4706,
736,
1722,
29898,
2084,
29918,
1445,
29897,
13,
13,
2084,
29918,
29888,
5427,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
13,
8568,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
353,
6571,
13,
13,
6672,
29918,
517,
29918,
11762,
29918,
8977,
353,
6571,
13,
6672,
29918,
546,
29883,
29907,
4212,
29933,
2129,
29918,
11762,
6513,
29918,
1761,
353,
5159,
13,
13,
2541,
1722,
29918,
29887,
2526,
567,
29874,
1725,
29898,
2084,
29918,
29888,
5427,
29897,
408,
285,
29901,
13,
1678,
363,
5172,
29874,
297,
285,
29889,
949,
2141,
17010,
28909,
29876,
29958,
2824,
5451,
877,
16299,
1125,
13,
4706,
4839,
353,
5172,
29874,
29889,
17010,
28909,
29876,
2824,
5451,
28909,
29876,
29861,
29900,
29962,
13,
4706,
5665,
353,
525,
4286,
7122,
29898,
29888,
5427,
29889,
17010,
28909,
29876,
2824,
5451,
28909,
29876,
29861,
29896,
29901,
2314,
13,
13,
4706,
444,
8568,
353,
15473,
8568,
29889,
4419,
29882,
29953,
29946,
29898,
16506,
467,
20970,
7501,
342,
580,
396,
383,
1901,
3489,
13,
4706,
6608,
353,
6608,
1982,
29889,
3487,
29945,
29898,
16506,
29889,
12508,
877,
9420,
29899,
29947,
1495,
467,
20970,
7501,
342,
580,
13,
13,
4706,
565,
6608,
451,
297,
6608,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
29901,
13,
9651,
396,
1570,
5665,
13,
9651,
6608,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
29961,
8568,
29962,
353,
518,
29900,
29892,
5159,
29962,
13,
13,
9651,
4839,
29918,
517,
29918,
11762,
29918,
8977,
29961,
6672,
29962,
353,
5665,
13,
13,
9651,
19359,
29918,
2435,
353,
7431,
29898,
16506,
29897,
13,
9651,
4839,
29918,
546,
29883,
29907,
4212,
29933,
2129,
29918,
11762,
6513,
29918,
1761,
29889,
4397,
4197,
6672,
29892,
313,
11762,
29918,
2435,
448,
5665,
29889,
2798,
877,
29940,
8785,
29914,
11762,
29918,
2435,
29892,
19359,
29918,
2435,
2314,
13,
13,
4706,
6608,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
29961,
8568,
3816,
29900,
29962,
4619,
29871,
29896,
13,
4706,
6608,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
29961,
8568,
3816,
29896,
1822,
4397,
29898,
6672,
29897,
13,
13,
13,
2541,
1722,
877,
700,
567,
29889,
3945,
742,
525,
29893,
1495,
408,
285,
29893,
29901,
13,
1678,
363,
2302,
29892,
4839,
29918,
1761,
297,
6608,
29918,
517,
29918,
2798,
29918,
392,
29918,
13662,
29918,
8977,
29889,
5975,
7295,
13,
4706,
285,
29893,
29889,
3539,
28909,
29873,
4286,
7122,
4197,
710,
29898,
2798,
511,
13420,
15300,
7122,
29898,
6672,
29918,
1761,
29897,
2314,
718,
11297,
29876,
1495,
13,
13,
1454,
4839,
29892,
639,
29883,
29907,
4212,
29933,
2129,
29892,
19359,
6513,
29918,
1761,
297,
12705,
29898,
6672,
29918,
546,
29883,
29907,
4212,
29933,
2129,
29918,
11762,
6513,
29918,
1761,
29892,
1820,
29922,
2892,
921,
29901,
313,
29916,
14352,
29906,
1402,
921,
14352,
29896,
11724,
11837,
353,
5852,
1125,
13,
1678,
10876,
29889,
25393,
29889,
3539,
877,
26208,
1012,
29876,
29912,
1012,
29876,
4286,
4830,
29898,
6672,
29892,
4839,
29918,
517,
29918,
11762,
29918,
8977,
29961,
6672,
12622,
13,
2
] |
plugins/welcome.py | su226/IdhagnBot | 2 | 1616563 | <reponame>su226/IdhagnBot
from util.config import BaseConfig, Field
from nonebot.adapters.onebot.v11 import Bot, Event, Message
import nonebot
class Config(BaseConfig):
__file__ = "welcome"
welcome: dict[int, str] = Field(default_factory=dict)
leave: set[int] = Field(default_factory=set)
CONFIG = Config.load()
async def check_welcome(event: Event):
return event.notice_type == "group_increase" and event.group_id in CONFIG.welcome
welcome = nonebot.on_notice(check_welcome)
@welcome.handle()
async def handle_welcome(event: Event):
await welcome.send(Message(CONFIG.welcome[event.group_id].format(event.user_id)))
async def check_leave(event: Event):
return event.notice_type == "group_decrease" and event.group_id in CONFIG.leave
leave = nonebot.on_notice(check_leave)
@leave.handle()
async def handle_leave(bot: Bot, event: Event):
username = (await bot.get_stranger_info(user_id=event.user_id))["nickname"]
if event.operator_id != event.user_id:
operator_name = (await bot.get_group_member_info(group_id=event.group_id, user_id=event.operator_id))["nickname"]
await leave.send(f"{operator_name}({event.operator_id})将 {username}({event.user_id})踢出了本群")
else:
await leave.send(f"{username}({event.user_id})退出了本群")
| [
1,
529,
276,
1112,
420,
29958,
2146,
29906,
29906,
29953,
29914,
1204,
29882,
4211,
29933,
327,
13,
3166,
3667,
29889,
2917,
1053,
7399,
3991,
29892,
8989,
13,
3166,
5642,
7451,
29889,
328,
481,
2153,
29889,
650,
7451,
29889,
29894,
29896,
29896,
1053,
11273,
29892,
6864,
29892,
7777,
13,
5215,
5642,
7451,
13,
13,
1990,
12782,
29898,
5160,
3991,
1125,
13,
29871,
4770,
1445,
1649,
353,
376,
20466,
2763,
29908,
13,
29871,
12853,
29901,
9657,
29961,
524,
29892,
851,
29962,
353,
8989,
29898,
4381,
29918,
14399,
29922,
8977,
29897,
13,
29871,
5967,
29901,
731,
29961,
524,
29962,
353,
8989,
29898,
4381,
29918,
14399,
29922,
842,
29897,
13,
13,
25903,
353,
12782,
29889,
1359,
580,
13,
13,
12674,
822,
1423,
29918,
20466,
2763,
29898,
3696,
29901,
6864,
1125,
13,
29871,
736,
1741,
29889,
1333,
625,
29918,
1853,
1275,
376,
2972,
29918,
262,
1037,
559,
29908,
322,
1741,
29889,
2972,
29918,
333,
297,
8707,
18667,
29889,
20466,
2763,
13,
20466,
2763,
353,
5642,
7451,
29889,
265,
29918,
1333,
625,
29898,
3198,
29918,
20466,
2763,
29897,
13,
29992,
20466,
2763,
29889,
8411,
580,
13,
12674,
822,
4386,
29918,
20466,
2763,
29898,
3696,
29901,
6864,
1125,
13,
29871,
7272,
12853,
29889,
6717,
29898,
3728,
29898,
25903,
29889,
20466,
2763,
29961,
3696,
29889,
2972,
29918,
333,
1822,
4830,
29898,
3696,
29889,
1792,
29918,
333,
4961,
13,
13,
12674,
822,
1423,
29918,
280,
1351,
29898,
3696,
29901,
6864,
1125,
13,
29871,
736,
1741,
29889,
1333,
625,
29918,
1853,
1275,
376,
2972,
29918,
311,
1037,
559,
29908,
322,
1741,
29889,
2972,
29918,
333,
297,
8707,
18667,
29889,
280,
1351,
13,
280,
1351,
353,
5642,
7451,
29889,
265,
29918,
1333,
625,
29898,
3198,
29918,
280,
1351,
29897,
13,
29992,
280,
1351,
29889,
8411,
580,
13,
12674,
822,
4386,
29918,
280,
1351,
29898,
7451,
29901,
11273,
29892,
1741,
29901,
6864,
1125,
13,
29871,
8952,
353,
313,
20675,
9225,
29889,
657,
29918,
710,
4600,
29918,
3888,
29898,
1792,
29918,
333,
29922,
3696,
29889,
1792,
29918,
333,
876,
3366,
19254,
978,
3108,
13,
29871,
565,
1741,
29889,
6891,
29918,
333,
2804,
1741,
29889,
1792,
29918,
333,
29901,
13,
1678,
5455,
29918,
978,
353,
313,
20675,
9225,
29889,
657,
29918,
2972,
29918,
14242,
29918,
3888,
29898,
2972,
29918,
333,
29922,
3696,
29889,
2972,
29918,
333,
29892,
1404,
29918,
333,
29922,
3696,
29889,
6891,
29918,
333,
876,
3366,
19254,
978,
3108,
13,
1678,
7272,
5967,
29889,
6717,
29898,
29888,
29908,
29912,
6891,
29918,
978,
29913,
30419,
29912,
3696,
29889,
6891,
29918,
333,
29913,
30409,
30998,
426,
6786,
29913,
30419,
29912,
3696,
29889,
1792,
29918,
333,
29913,
30409,
235,
187,
165,
30544,
30743,
30346,
31829,
1159,
13,
29871,
1683,
29901,
13,
1678,
7272,
5967,
29889,
6717,
29898,
29888,
29908,
29912,
6786,
29913,
30419,
29912,
3696,
29889,
1792,
29918,
333,
29913,
30409,
236,
131,
131,
30544,
30743,
30346,
31829,
1159,
13,
2
] |
interceptor/jobs_wrapper.py | fossabot/interceptor | 0 | 132538 | # Copyright 2018 getcarrier.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import docker
from uuid import uuid4
from interceptor import constants as c
class JobsWrapper(object):
@staticmethod
def dast(container, execution_params, job_name, redis_connection, *args, **kwargs):
client = docker.from_env()
required_keys = ['host', 'port', 'protocol', 'test_type']
if not all(k in execution_params for k in required_keys):
return False, "Missing required params (%s)" % ",".join(required_keys)
if not [container] in [k.tags for k in client.images.list()]:
return False, "Please specify proper tag of security container e.g. getcarrier/dast:latest"
host = execution_params.get('host')
port = execution_params.get('port')
protocol = execution_params.get('protocol')
project = execution_params.get('project', job_name)
environment = execution_params.get('environment', "default")
# redis_connection = ''
client.containers.run(container, name=f'{job_name}_{uuid4()}'[:36],
nano_cpus=c.CONTAINER_CPU_QUOTA, mem_limit=c.CONTAINER_MEMORY_QUOTA,
command=f"-s {execution_params['test_type']}",
environment={"host": host, "port": port,
"protocol": protocol, "project_name": project,
"environment": environment,
"redis_connection": redis_connection},
remove=True)
return True, "Done"
@staticmethod
def sast(container, execution_params, job_name, redis_connection, *args, **kwargs):
pass
@staticmethod
def perfui(container, execution_params, job_name, redis_connection, *args, **kwargs):
pass
@staticmethod
def perfmeter(container, execution_params, job_name, redis_connection, *args, **kwargs):
client = docker.from_env()
#redis_connection = ''
client.containers.run(container, name=f'{job_name}_{uuid4()}'[:36],
nano_cpus=c.CONTAINER_CPU_QUOTA, mem_limit=c.CONTAINER_MEMORY_QUOTA,
command=f"{execution_params['jmeter_execution_string']}",
environment={"redis_connection": redis_connection},
remove=True)
return True, "Done"
@staticmethod
def perfgatling(container, execution_params, job_name, redis_connection, *args, **kwargs):
pass | [
1,
396,
259,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
679,
4287,
4336,
29889,
601,
13,
29937,
13,
29937,
259,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
259,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
259,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
259,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
259,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
259,
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,
259,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
259,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
10346,
13,
13,
3166,
318,
5416,
1053,
318,
5416,
29946,
13,
3166,
1006,
14268,
1053,
17727,
408,
274,
13,
13,
13,
1990,
17163,
29879,
15646,
29898,
3318,
1125,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
270,
579,
29898,
7611,
29892,
8225,
29918,
7529,
29892,
4982,
29918,
978,
29892,
29825,
29918,
9965,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
3132,
353,
10346,
29889,
3166,
29918,
6272,
580,
13,
4706,
3734,
29918,
8149,
353,
6024,
3069,
742,
525,
637,
742,
525,
20464,
742,
525,
1688,
29918,
1853,
2033,
13,
4706,
565,
451,
599,
29898,
29895,
297,
8225,
29918,
7529,
363,
413,
297,
3734,
29918,
8149,
1125,
13,
9651,
736,
7700,
29892,
376,
18552,
292,
3734,
8636,
313,
29995,
29879,
5513,
1273,
9162,
1642,
7122,
29898,
12403,
29918,
8149,
29897,
13,
4706,
565,
451,
518,
7611,
29962,
297,
518,
29895,
29889,
11338,
363,
413,
297,
3132,
29889,
8346,
29889,
1761,
580,
5387,
13,
9651,
736,
7700,
29892,
376,
12148,
6084,
1571,
4055,
310,
6993,
5639,
321,
29889,
29887,
29889,
679,
4287,
4336,
29914,
29881,
579,
29901,
12333,
29908,
13,
4706,
3495,
353,
8225,
29918,
7529,
29889,
657,
877,
3069,
1495,
13,
4706,
2011,
353,
8225,
29918,
7529,
29889,
657,
877,
637,
1495,
13,
4706,
9608,
353,
8225,
29918,
7529,
29889,
657,
877,
20464,
1495,
13,
4706,
2060,
353,
8225,
29918,
7529,
29889,
657,
877,
4836,
742,
4982,
29918,
978,
29897,
13,
4706,
5177,
353,
8225,
29918,
7529,
29889,
657,
877,
20944,
742,
376,
4381,
1159,
13,
4706,
396,
29825,
29918,
9965,
353,
6629,
13,
4706,
3132,
29889,
1285,
475,
414,
29889,
3389,
29898,
7611,
29892,
1024,
29922,
29888,
29915,
29912,
9057,
29918,
978,
3227,
25118,
29946,
580,
10162,
7503,
29941,
29953,
1402,
13,
462,
795,
302,
1562,
29918,
6814,
375,
29922,
29883,
29889,
6007,
6040,
1177,
1001,
29918,
6271,
29965,
29918,
13356,
2891,
29909,
29892,
2626,
29918,
13400,
29922,
29883,
29889,
6007,
6040,
1177,
1001,
29918,
2303,
29924,
18929,
29918,
13356,
2891,
29909,
29892,
13,
462,
795,
1899,
29922,
29888,
29908,
29899,
29879,
426,
22256,
29918,
7529,
1839,
1688,
29918,
1853,
2033,
17671,
13,
462,
795,
5177,
3790,
29908,
3069,
1115,
3495,
29892,
376,
637,
1115,
2011,
29892,
13,
462,
462,
965,
376,
20464,
1115,
9608,
29892,
376,
4836,
29918,
978,
1115,
2060,
29892,
13,
462,
462,
965,
376,
20944,
1115,
5177,
29892,
13,
462,
462,
965,
376,
1127,
275,
29918,
9965,
1115,
29825,
29918,
9965,
1118,
13,
462,
795,
3349,
29922,
5574,
29897,
13,
4706,
736,
5852,
29892,
376,
25632,
29908,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
269,
579,
29898,
7611,
29892,
8225,
29918,
7529,
29892,
4982,
29918,
978,
29892,
29825,
29918,
9965,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
23895,
1481,
29898,
7611,
29892,
8225,
29918,
7529,
29892,
4982,
29918,
978,
29892,
29825,
29918,
9965,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
23895,
29391,
29898,
7611,
29892,
8225,
29918,
7529,
29892,
4982,
29918,
978,
29892,
29825,
29918,
9965,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
3132,
353,
10346,
29889,
3166,
29918,
6272,
580,
13,
4706,
396,
1127,
275,
29918,
9965,
353,
6629,
13,
4706,
3132,
29889,
1285,
475,
414,
29889,
3389,
29898,
7611,
29892,
1024,
29922,
29888,
29915,
29912,
9057,
29918,
978,
3227,
25118,
29946,
580,
10162,
7503,
29941,
29953,
1402,
13,
462,
795,
302,
1562,
29918,
6814,
375,
29922,
29883,
29889,
6007,
6040,
1177,
1001,
29918,
6271,
29965,
29918,
13356,
2891,
29909,
29892,
2626,
29918,
13400,
29922,
29883,
29889,
6007,
6040,
1177,
1001,
29918,
2303,
29924,
18929,
29918,
13356,
2891,
29909,
29892,
13,
462,
795,
1899,
29922,
29888,
29908,
29912,
22256,
29918,
7529,
1839,
21231,
1308,
29918,
22256,
29918,
1807,
2033,
17671,
13,
462,
795,
5177,
3790,
29908,
1127,
275,
29918,
9965,
1115,
29825,
29918,
9965,
1118,
13,
462,
795,
3349,
29922,
5574,
29897,
13,
4706,
736,
5852,
29892,
376,
25632,
29908,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
639,
16434,
271,
1847,
29898,
7611,
29892,
8225,
29918,
7529,
29892,
4982,
29918,
978,
29892,
29825,
29918,
9965,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
2
] |
FaceRecognitionWebsite/codeDesign/myDjango02/app01/migrations/0012_remove_getdatacss_copybook.py | ChunjunHu/FaceRecognitionLibraryWebsite | 1 | 169962 | # Generated by Django 2.0.1 on 2019-01-09 15:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app01', '0011_auto_20190109_2351'),
]
operations = [
migrations.RemoveField(
model_name='getdatacss',
name='CopyBook',
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29900,
29889,
29896,
373,
29871,
29906,
29900,
29896,
29929,
29899,
29900,
29896,
29899,
29900,
29929,
29871,
29896,
29945,
29901,
29945,
29946,
30004,
13,
30004,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
30004,
13,
30004,
13,
30004,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
30004,
13,
30004,
13,
1678,
9962,
353,
518,
30004,
13,
4706,
6702,
932,
29900,
29896,
742,
525,
29900,
29900,
29896,
29896,
29918,
6921,
29918,
29906,
29900,
29896,
29929,
29900,
29896,
29900,
29929,
29918,
29906,
29941,
29945,
29896,
5477,
30004,
13,
1678,
4514,
30004,
13,
30004,
13,
1678,
6931,
353,
518,
30004,
13,
4706,
9725,
800,
29889,
15941,
3073,
29898,
30004,
13,
9651,
1904,
29918,
978,
2433,
657,
1272,
4268,
23592,
13,
9651,
1024,
2433,
11882,
10967,
23592,
13,
4706,
10353,
30004,
13,
1678,
4514,
30004,
13,
2
] |
scripts/venv/lib/python2.7/site-packages/cogent/align/progressive.py | sauloal/cnidaria | 3 | 31612 | <gh_stars>1-10
#!/usr/bin/env python
from __future__ import with_statement
from cogent import LoadTree
from cogent.phylo import nj as NJ
from cogent.phylo.distance import EstimateDistances
from cogent.core.info import Info
from cogent.util import progress_display as UI
__author__ = "<NAME>"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"
@UI.display_wrap
def TreeAlign(model, seqs, tree=None, indel_rate=0.01, indel_length=0.01,
ui = None, ests_from_pairwise=True, param_vals=None):
"""Returns a multiple alignment and tree.
Uses the provided substitution model and a tree for determining the
progressive order. If a tree is not provided a Neighbour Joining tree is
constructed from pairwise distances estimated from pairwise aligning the
sequences. If running in parallel, only the distance estimation is
parallelised and only the master CPU returns the alignment and tree, other
CPU's return None, None.
Arguments:
- model: a substitution model
- seqs: a sequence collection
- indel_rate, indel_length: parameters for the progressive pair-HMM
- ests_from_pairwise: if no tree provided and True, the median value
of the substitution model parameters are used
- param_vals: named key, value pairs for model parameters. These
override ests_from_pairwise.
"""
_exclude_params = ['mprobs', 'rate', 'bin_switch']
if param_vals:
param_vals = dict(param_vals)
else:
param_vals = {}
if isinstance(seqs, dict):
seq_names = seqs.keys()
else:
seq_names = seqs.getSeqNames()
two_seqs = len(seq_names) == 2
if tree:
tip_names = tree.getTipNames()
tip_names.sort()
seq_names.sort()
assert tip_names == seq_names, \
"names don't match between seqs and tree: tree=%s; seqs=%s" % \
(tip_names, seq_names)
ests_from_pairwise = False
elif two_seqs:
tree = LoadTree(tip_names=seqs.getSeqNames())
ests_from_pairwise = False
else:
if ests_from_pairwise:
est_params = [param for param in model.getParamList() \
if param not in _exclude_params]
else:
est_params = None
dcalc = EstimateDistances(seqs, model, do_pair_align=True,
est_params=est_params)
dcalc.run()
dists = dcalc.getPairwiseDistances()
tree = NJ.nj(dists)
LF = model.makeLikelihoodFunction(tree.bifurcating(name_unnamed=True), aligned=False)
if ests_from_pairwise and not param_vals:
# we use the Median to avoid the influence of outlier pairs
param_vals = {}
for param in est_params:
numbers = dcalc.getParamValues(param)
print "Param Estimate Summary Stats: %s" % param
print numbers.summarize()
param_vals[param] = numbers.Median
ui.display("Doing %s alignment" % ["progressive", "pairwise"][two_seqs])
with LF.updatesPostponed():
for param, val in param_vals.items():
LF.setParamRule(param, value=val, is_constant=True)
LF.setParamRule('indel_rate', value=indel_rate, is_constant=True)
LF.setParamRule('indel_length', value=indel_length, is_constant=True)
LF.setSequences(seqs)
edge = LF.getLogLikelihood().edge
(vtLnL, align) = edge.getViterbiScoreAndAlignment(0.5)
info = Info()
info["AlignParams"] = param_vals
info["AlignParams"].update(dict(indel_length=indel_length, indel_rate=indel_rate))
align.Info = info
return align, tree
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
411,
29918,
20788,
13,
3166,
274,
468,
296,
1053,
16012,
9643,
13,
3166,
274,
468,
296,
29889,
11461,
417,
1053,
20199,
408,
405,
29967,
13,
3166,
274,
468,
296,
29889,
11461,
417,
29889,
19244,
1053,
2661,
6490,
13398,
2925,
13,
3166,
274,
468,
296,
29889,
3221,
29889,
3888,
1053,
22140,
13,
3166,
274,
468,
296,
29889,
4422,
1053,
6728,
29918,
4990,
408,
3740,
13,
13,
1649,
8921,
1649,
353,
9872,
5813,
11903,
13,
1649,
8552,
1266,
1649,
353,
376,
11882,
1266,
29871,
29906,
29900,
29900,
29955,
29899,
29906,
29900,
29896,
29906,
29892,
450,
315,
468,
296,
8010,
29908,
13,
1649,
11944,
1169,
1649,
353,
6796,
29966,
5813,
28341,
9872,
5813,
29958,
3108,
13,
1649,
506,
1947,
1649,
353,
376,
29954,
7390,
29908,
13,
1649,
3259,
1649,
353,
376,
29896,
29889,
29945,
29889,
29941,
29908,
13,
1649,
29885,
2365,
4008,
1649,
353,
9872,
5813,
11903,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
1649,
4882,
1649,
353,
376,
23665,
428,
29908,
13,
13,
29992,
3120,
29889,
4990,
29918,
6312,
13,
1753,
15472,
2499,
647,
29898,
4299,
29892,
19359,
29879,
29892,
5447,
29922,
8516,
29892,
1399,
295,
29918,
10492,
29922,
29900,
29889,
29900,
29896,
29892,
1399,
295,
29918,
2848,
29922,
29900,
29889,
29900,
29896,
29892,
13,
1678,
14313,
353,
6213,
29892,
707,
29879,
29918,
3166,
29918,
18784,
3538,
29922,
5574,
29892,
1828,
29918,
791,
29879,
29922,
8516,
1125,
13,
1678,
9995,
11609,
29879,
263,
2999,
22239,
322,
5447,
29889,
13,
268,
13,
1678,
10783,
267,
278,
4944,
23697,
1904,
322,
263,
5447,
363,
3683,
2827,
278,
13,
1678,
6728,
573,
1797,
29889,
960,
263,
5447,
338,
451,
4944,
263,
2448,
1141,
6526,
3650,
2827,
5447,
338,
13,
1678,
13319,
515,
5101,
3538,
24610,
15899,
515,
5101,
3538,
7595,
292,
278,
13,
1678,
15602,
29889,
960,
2734,
297,
8943,
29892,
871,
278,
5418,
23248,
338,
13,
1678,
8943,
3368,
322,
871,
278,
5835,
10808,
3639,
278,
22239,
322,
5447,
29892,
916,
13,
1678,
10808,
29915,
29879,
736,
6213,
29892,
6213,
29889,
13,
268,
13,
1678,
11842,
9331,
29901,
13,
4706,
448,
1904,
29901,
263,
23697,
1904,
13,
4706,
448,
19359,
29879,
29901,
263,
5665,
4333,
13,
4706,
448,
1399,
295,
29918,
10492,
29892,
1399,
295,
29918,
2848,
29901,
4128,
363,
278,
6728,
573,
5101,
29899,
29950,
7428,
13,
4706,
448,
707,
29879,
29918,
3166,
29918,
18784,
3538,
29901,
565,
694,
5447,
4944,
322,
5852,
29892,
278,
19194,
995,
13,
3986,
310,
278,
23697,
1904,
4128,
526,
1304,
13,
4706,
448,
1828,
29918,
791,
29879,
29901,
4257,
1820,
29892,
995,
11000,
363,
1904,
4128,
29889,
4525,
13,
3986,
5712,
707,
29879,
29918,
3166,
29918,
18784,
3538,
29889,
13,
1678,
9995,
13,
1678,
903,
735,
2325,
29918,
7529,
353,
6024,
29885,
771,
5824,
742,
525,
10492,
742,
525,
2109,
29918,
15123,
2033,
13,
1678,
565,
1828,
29918,
791,
29879,
29901,
13,
4706,
1828,
29918,
791,
29879,
353,
9657,
29898,
3207,
29918,
791,
29879,
29897,
13,
1678,
1683,
29901,
13,
4706,
1828,
29918,
791,
29879,
353,
6571,
13,
1678,
565,
338,
8758,
29898,
11762,
29879,
29892,
9657,
1125,
13,
4706,
19359,
29918,
7039,
353,
19359,
29879,
29889,
8149,
580,
13,
1678,
1683,
29901,
13,
4706,
19359,
29918,
7039,
353,
19359,
29879,
29889,
657,
23718,
8659,
580,
13,
268,
13,
1678,
1023,
29918,
11762,
29879,
353,
7431,
29898,
11762,
29918,
7039,
29897,
1275,
29871,
29906,
13,
268,
13,
1678,
565,
5447,
29901,
13,
4706,
6872,
29918,
7039,
353,
5447,
29889,
657,
29911,
666,
8659,
580,
13,
4706,
6872,
29918,
7039,
29889,
6605,
580,
13,
4706,
19359,
29918,
7039,
29889,
6605,
580,
13,
4706,
4974,
6872,
29918,
7039,
1275,
19359,
29918,
7039,
29892,
320,
13,
9651,
376,
7039,
1016,
29915,
29873,
1993,
1546,
19359,
29879,
322,
5447,
29901,
5447,
16328,
29879,
29936,
19359,
29879,
16328,
29879,
29908,
1273,
320,
13,
9651,
313,
12632,
29918,
7039,
29892,
19359,
29918,
7039,
29897,
13,
4706,
707,
29879,
29918,
3166,
29918,
18784,
3538,
353,
7700,
13,
1678,
25342,
1023,
29918,
11762,
29879,
29901,
13,
4706,
5447,
353,
16012,
9643,
29898,
12632,
29918,
7039,
29922,
11762,
29879,
29889,
657,
23718,
8659,
3101,
13,
4706,
707,
29879,
29918,
3166,
29918,
18784,
3538,
353,
7700,
13,
1678,
1683,
29901,
13,
4706,
565,
707,
29879,
29918,
3166,
29918,
18784,
3538,
29901,
13,
9651,
707,
29918,
7529,
353,
518,
3207,
363,
1828,
297,
1904,
29889,
657,
4736,
1293,
580,
320,
13,
462,
462,
1678,
565,
1828,
451,
297,
903,
735,
2325,
29918,
7529,
29962,
13,
4706,
1683,
29901,
13,
9651,
707,
29918,
7529,
353,
6213,
13,
308,
13,
4706,
270,
28667,
353,
2661,
6490,
13398,
2925,
29898,
11762,
29879,
29892,
1904,
29892,
437,
29918,
18784,
29918,
2520,
29922,
5574,
29892,
13,
462,
462,
1678,
707,
29918,
7529,
29922,
342,
29918,
7529,
29897,
13,
4706,
270,
28667,
29889,
3389,
580,
13,
4706,
1320,
29879,
353,
270,
28667,
29889,
657,
20547,
3538,
13398,
2925,
580,
13,
4706,
5447,
353,
405,
29967,
29889,
29876,
29926,
29898,
29881,
2879,
29897,
13,
268,
13,
1678,
365,
29943,
353,
1904,
29889,
5675,
29931,
638,
22342,
6678,
29898,
8336,
29889,
29890,
361,
332,
29883,
1218,
29898,
978,
29918,
5963,
2795,
29922,
5574,
511,
26118,
29922,
8824,
29897,
13,
1678,
565,
707,
29879,
29918,
3166,
29918,
18784,
3538,
322,
451,
1828,
29918,
791,
29879,
29901,
13,
4706,
396,
591,
671,
278,
3436,
713,
304,
4772,
278,
9949,
310,
714,
4926,
11000,
13,
4706,
1828,
29918,
791,
29879,
353,
6571,
13,
4706,
363,
1828,
297,
707,
29918,
7529,
29901,
13,
9651,
3694,
353,
270,
28667,
29889,
657,
4736,
9065,
29898,
3207,
29897,
13,
9651,
1596,
376,
4736,
2661,
6490,
6991,
5219,
624,
1446,
29901,
1273,
29879,
29908,
1273,
1828,
13,
9651,
1596,
3694,
29889,
2083,
3034,
675,
580,
13,
9651,
1828,
29918,
791,
29879,
29961,
3207,
29962,
353,
3694,
29889,
19302,
713,
13,
268,
13,
1678,
14313,
29889,
4990,
703,
6132,
292,
1273,
29879,
22239,
29908,
1273,
6796,
18035,
573,
613,
376,
18784,
3538,
3108,
29961,
10184,
29918,
11762,
29879,
2314,
13,
1678,
411,
365,
29943,
29889,
786,
15190,
6747,
1112,
287,
7295,
13,
4706,
363,
1828,
29892,
659,
297,
1828,
29918,
791,
29879,
29889,
7076,
7295,
13,
9651,
365,
29943,
29889,
842,
4736,
10740,
29898,
3207,
29892,
995,
29922,
791,
29892,
338,
29918,
23362,
29922,
5574,
29897,
13,
4706,
365,
29943,
29889,
842,
4736,
10740,
877,
513,
295,
29918,
10492,
742,
995,
29922,
513,
295,
29918,
10492,
29892,
338,
29918,
23362,
29922,
5574,
29897,
13,
4706,
365,
29943,
29889,
842,
4736,
10740,
877,
513,
295,
29918,
2848,
742,
995,
29922,
513,
295,
29918,
2848,
29892,
338,
29918,
23362,
29922,
5574,
29897,
13,
4706,
365,
29943,
29889,
842,
16941,
2063,
29898,
11762,
29879,
29897,
13,
1678,
7636,
353,
365,
29943,
29889,
657,
3403,
29931,
638,
22342,
2141,
12864,
13,
1678,
313,
21908,
29931,
29876,
29931,
29892,
7595,
29897,
353,
7636,
29889,
657,
29963,
1524,
5365,
20097,
2855,
14658,
29898,
29900,
29889,
29945,
29897,
13,
1678,
5235,
353,
22140,
580,
13,
1678,
5235,
3366,
2499,
647,
9629,
3108,
353,
1828,
29918,
791,
29879,
13,
1678,
5235,
3366,
2499,
647,
9629,
16862,
5504,
29898,
8977,
29898,
513,
295,
29918,
2848,
29922,
513,
295,
29918,
2848,
29892,
1399,
295,
29918,
10492,
29922,
513,
295,
29918,
10492,
876,
13,
1678,
7595,
29889,
3401,
353,
5235,
13,
1678,
736,
7595,
29892,
5447,
13,
2
] |
PythonServer/UnitTestCasesForWebSocket.py | Cyberlightning/2D-3DCapture | 2 | 4916 | '''
Created on Mar 6, 2014
@author: tharanga
'''
import unittest
from time import sleep
import EventService as es
from EventService import WebSocketServer as ws
from EventService import EventManager as em
import socket
from base64 import b64encode
import struct
import MySQLdb
import json
import EventService
import flaskr
import tempfile
def encodeMessage( message):
message = b64encode(message)
b1 =0x80 | 0x1 & 0x0f
b2 = 0
header=""
payload_len = len(message)
if payload_len < 126 :
header = struct.pack('>BB', b1, payload_len)
message= header +message
elif (payload_len < ((2 ** 16) - 1)):
b2 |= 126
header += chr(b1)
header += chr(b2)
l = struct.pack(">H", payload_len)
header += l
message = header +message
else:
b2 |= 127
header += chr(b1)
header += chr(b2)
l = struct.pack(">Q", payload_len)
header += l
message = header +message
return message
class TestWebSockets(unittest.TestCase):
def setUp(self):
self.wsServer = ws('',12345,'127.0.0.1')
self.wsServer.setRunning(True);
sleep(1)
self.testsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.testsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Create a socket object
host = 'localhost' # Get local machine name
port = 12345
self.testsocket.connect((host, port))
def tearDown(self):
self.wsServer.closeConnection();
self.testsocket.close()
sleep(1)
def test_webSocketServerOBject(self):
self.assertEqual(self.wsServer.SERVER, '', "Server set to the desired value")
self.assertEqual(self.wsServer.PORT, 12345, "Server port is set correctly")
self.assertEqual(self.wsServer.LOCALHOST, "127.0.0.1", "Localhost set to 127.0.0.1")
def test_invalid_Request(self):
message= "Test Message"
self.testsocket.send(message)
data = repr(self.testsocket.recv(1024))
#print 'Response to invalid message<TestMessage> %s'%(data)
self.assertEqual(data, '\'CONNECTION_REJECTED\'', "Invalid Message rejected")
def test_valid_WS_Request(self):
message = "GET /mychat HTTP/1.1\nHost: server.example.com\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Key: <KEY>nSec-WebSocket-Protocol: chat\nSec-WebSocket-Version: 13\nOrigin: localhost\n\n"
# message = "Test message"
self.testsocket.sendall(message)
wsresponse = repr(self.testsocket.recv(1024))
#print 'Response to valid ws request %s'%wsresponse
self.assertNotEqual(wsresponse, '\'CONNECTION_REJECTED\'', "Connection is not rejected")
self.assertIsNotNone(wsresponse, "Connection Response is not Empty")
self.testsocket.sendall(("Test Message"))
data = repr(self.testsocket.recv(1024))
#print 'Response to un encoded Request %s'%(data)
self.assertEqual(data, "\'Un expected opcode\'", "In valid Message rejected")
def test_invalid_Messge(self):
message = "GET /mychat HTTP/1.1\nHost: server.example.com\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Key: <KEY>==\nSec-WebSocket-Protocol: chat\nSec-WebSocket-Version: 13\nOrigin: localhost\n\n"
self.testsocket.sendall(message)
wsresponse = repr(self.testsocket.recv(1024))
sleep(1)
self.testsocket.sendall("Test Message")
data = repr(self.testsocket.recv(1024))
self.assertEqual(data, "\'Un expected opcode\'", "In valid Message rejected")
def test_malformed_Message(self):
message = "GET /mychat HTTP/1.1\nHost: server.example.com\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Key: <KEY>==\nSec-WebSocket-Protocol: chat\nSec-WebSocket-Version: 13\nOrigin: localhost\n\n"
self.testsocket.sendall(message)
wsresponse = repr(self.testsocket.recv(1024))
# print wsresponse
self.testsocket.send(encodeMessage("Test Message"))#This line seems to get stuck at times. Solution is to use sendAll, use \n at the end
data = repr(self.testsocket.recv(1024))
self.assertEqual(data, "\'MISFORMATED MESSAGE\'", "Messages with out a type is rejected")
def test_wellformed_Message_for_Text(self):
message = "GET /mychat HTTP/1.1\nHost: server.example.com\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Key: <KEY>nSec-WebSocket-Protocol: chat\nSec-WebSocket-Version: 13\nOrigin: localhost\n\n"
self.testsocket.sendall(message)
wsresponse = repr(self.testsocket.recv(1024))
# print wsresponse
self.testsocket.send(encodeMessage("1<---->Test Message"))#This line seems to get stuck at times. Solution is to use sendAll, use \n at the end
data = repr(self.testsocket.recv(1024))
print data
self.assertEqual(data, "\'Text received\'", "Text Messages is identified and accepted")
def test_wellformed_Message_for_Json(self):
message = "GET /mychat HTTP/1.1\nHost: server.example.com\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\nSec-WebSocket-Protocol: chat\nSec-WebSocket-Version: 13\nOrigin: localhost\n\n"
self.testsocket.sendall(message)
wsresponse = repr(self.testsocket.recv(1024))
self.testsocket.send(encodeMessage("2<---->Test Message"))#This line seems to get stuck at times. Solution is to use sendAll, use \n at the end
data = repr(self.testsocket.recv(1024))
# print data
self.assertEqual(data, "\'json is received\'", "json Messages is identified and accepted")
##TO RUN THE FOLLOWING UNIT TESTS IT IS EXPECTED HAVE THE DATABASE
##CREATED. DATABASE SCRIPT IS PROVIDED TO CREATE THE NECESSARY DATABASES AND TABLES
##ASSISCIATED DATA IS NOT PROVIDED.
class TestDatabase(unittest.TestCase):
def setUp(self):
self.connection = es.dbConnect()
def tearDown(self):
self.connection.close()
def test_data_insert_data_Read(self):
self.assertIsInstance(self.connection, MySQLdb.connection, "Database connection accurately set")
jsondata ={"type":"image", "time":"2014.3.4_14.40.30", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4583105, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
alt = str(jsondata["position"]["alt"]);
if alt=="None":
alt = '0'
heading = '0'
speed = '0'
width = jsondata["vwidth"]
height =jsondata["vheight"]
if width > height :
screenorientation= 1.00#landscape
else :
screenorientation= 0.00#potrait
filename = jsondata["type"]+"_"+jsondata["time"]+"."+jsondata["ext"]
sqlstring1 = "INSERT INTO Imagedata values (\'"+filename+"\',GeomFromText ('POINT("+ str(jsondata["position"]["lat"])+" "+str(jsondata["position"]["lon"])+")'),"+str(jsondata["position"]["alt"])+","+str(jsondata["position"]["acc"])
sqlstring2 =","+str(jsondata["device"]["gx"])+","+str(jsondata["device"]["gy"])+","+str(jsondata["device"]["gz"])
sqlstring3 = ","+str(jsondata["device"]["ra"])+","+str(jsondata["device"]["rb"])+","+str(jsondata["device"]["rg"])+","+str(screenorientation)+",\'"+jsondata["device"]["orientation"]+"\',now(),\'"+str(jsondata["deviceOS"])+"\',\'"+str(jsondata["browsertype"])+"\',\'"+str(jsondata["deviceType"])+"\');"
sqlstring = sqlstring1 + sqlstring2+ sqlstring3
#print(sqlstring)
es.dbInsert(sqlstring)
sqlreadsting = 'select imagename, Browser,devicetype,X(location) as latitude, Y(location) as longitude from Imagedata where time=\'2014.3.4_14.40.31\''
result = es.dbRead(sqlreadsting)
self.assertIsNotNone(result, "Inserted data is retrieved and it is not null")
for row in result:
self.assertEqual(row[0], "image_2014.3.4_14.40.30.png", "Image name is correctly set and saved")
self.assertEqual(row[1], 65.0600797, "Latitudes are saved")
self.assertEqual(row[2], 25.4583105, "Longitude are saved")
HOST = '127.0.0.1' # The remote host
PORT = 17322
class RestServerTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
EventService.app.config['TESTING'] = True
self.app = EventService.app.test_client()
flaskr.init_db()
#self.socketServer = self.app.WebSocketServer('',wsport,'127.0.0.1')
def test_rootpath(self):
rv = self.app.get('/')
assert 'This is a REST Service for 2D3DCapture Server.' in rv.data
def test_post_image(self):
rv = self.app.post('/postImage')
assert 'READY' in rv.data
def test_clossing_websocket(self):
rv =self.app.post('/closewebsocketserver')
assert 'CLOSED' or 'ALREADY_CLOSSED' in rv.data
def test_start_websocket(self):
rv =self.app.get('/startwebsocketserver')
# print rv.data
assert 'READY' in rv.data
def test_post_binary_image(self):
rv =self.app.post('/postBinaryImage')
assert 'READY' or '415 Unsupported Media Type' in rv.data
def test_get_All_Image_Data(self):
rv =self.app.get('/getAllImageData')
jsonmsg = json.loads(rv.data)
self.assertIsNotNone(jsonmsg['imageList'] , "getImageData returns a non None list")
def test_get_location_Image_Data(self):
rv =self.app.get('/getLocationImageData?lat=65.0600797&lon=25.4583105')
jsonmsg = json.loads(rv.data)
self.assertIsNotNone(jsonmsg['imageList'] , "getLocationImageData returns a non None list.This is a feature test for location based image data")
def test_closest_Image_retrieval(self):
jsondata1 ={"type":"image", "time":"2014.3.4_14.40.31", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4583105, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
jsondata2 ={"type":"image", "time":"2014.3.4_14.40.32", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4582115, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
jsondata3 ={"type":"image", "time":"2014.3.4_14.40.33", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4584104, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
jsondata4 ={"type":"image", "time":"2014.3.4_14.40.34", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4586115, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
jsondata5 ={"type":"image", "time":"2014.3.4_14.40.35", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4587125, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
jsondata6 ={"type":"image", "time":"2014.3.4_14.40.36", "ext":"png", "deviceType":"Mobile", "deviceOS":"Badda", "browsertype":"Firefox", "position":{"lon":25.4588125, "lat":65.0600797, "alt":-1000, "acc":48.38800048828125}, "device":{"ax":0, "ay":0, "az":0, "gx":0, "gy":0, "gz":0, "ra":210.5637, "rb":47.5657, "rg":6.9698, "orientation":"potrait"}, "vwidth":480, "vheight":800}
es.saveData(jsondata1)
es.saveData(jsondata2)
es.saveData(jsondata3)
es.saveData(jsondata4)
es.saveData(jsondata5)
es.saveData(jsondata6)
radius = 0.0001
photoList = es.getClosestImages( 65.0601787, 25.4583107, radius )
self.assertEqual(len(photoList), 4, "Length of the list should be equal of the first test")
for row in photoList:
assert 'image_2014.3.4_14.40.32.png' or 'image_2014.3.4_14.40.31.png' in row[0]
photoList2 = es.getClosestImages( 65.0601787, 25.4587107, radius )
self.assertEqual(len(photoList2), 2, "Length of the list should be equal of the second test")
for row in photoList2:
assert 'image_2014.3.4_14.40.34.png' or 'image_2014.3.4_14.40.35.png' in row[0]
def suite():
testsuit =unittest.TestSuite()
testsuit.addTest(TestWebSockets('test_webSocketServerOBject'))
testsuit.addTest(TestWebSockets('test_valid_WS_Request'))
testsuit.addTest(TestWebSockets('test_invalid_Messge'))
testsuit.addTest(TestWebSockets('test_invalid_Request'))
testsuit.addTest(TestWebSockets('test_malformed_Message'))
testsuit.addTest(TestWebSockets('test_wellformed_Message_for_Text'))
testsuit.addTest(TestWebSockets('test_wellformed_Message_for_Json'))
testsuit.addTest(TestDatabase('test_data_insert_data_Read'))
testsuit.addTest(RestServerTestCase('test_rootpath'))
testsuit.addTest(RestServerTestCase('test_post_image'))
testsuit.addTest(RestServerTestCase('test_start_websocket'))
testsuit.addTest(RestServerTestCase('test_clossing_websocket'))
testsuit.addTest(RestServerTestCase('test_post_binary_image'))
testsuit.addTest(RestServerTestCase('test_get_All_Image_Data'))
testsuit.addTest(RestServerTestCase('test_closest_Image_retrieval'))
return testsuit
suite = suite()
runner = unittest.TextTestRunner(verbosity=3)
runner.run(suite)
# if __name__ == "__main__":
# #import sys;sys.argv = ['', 'Test.testName']
# unittest.main() | [
1,
14550,
13,
20399,
373,
1085,
29871,
29953,
29892,
29871,
29906,
29900,
29896,
29946,
13,
13,
29992,
8921,
29901,
266,
279,
12686,
13,
12008,
13,
5215,
443,
27958,
13,
3166,
931,
1053,
8709,
13,
5215,
6864,
3170,
408,
831,
13,
3166,
6864,
3170,
1053,
2563,
11373,
6004,
408,
16904,
13,
3166,
6864,
3170,
1053,
6864,
3260,
408,
953,
13,
5215,
9909,
13,
3166,
2967,
29953,
29946,
1053,
289,
29953,
29946,
12508,
29871,
13,
5215,
2281,
13,
5215,
9254,
2585,
13,
5215,
4390,
13,
5215,
6864,
3170,
13,
5215,
29784,
29878,
13,
5215,
5694,
1445,
13,
13,
1753,
19750,
3728,
29898,
2643,
1125,
308,
13,
4706,
2643,
353,
289,
29953,
29946,
12508,
29898,
4906,
29897,
13,
4706,
289,
29896,
353,
29900,
29916,
29947,
29900,
891,
29871,
29900,
29916,
29896,
669,
29871,
29900,
29916,
29900,
29888,
13,
4706,
289,
29906,
353,
29871,
29900,
13,
4706,
4839,
13776,
13,
4706,
20092,
29918,
2435,
353,
7431,
29898,
4906,
29897,
13,
4706,
565,
20092,
29918,
2435,
529,
29871,
29896,
29906,
29953,
584,
13,
9651,
4839,
353,
2281,
29889,
4058,
877,
29958,
14388,
742,
289,
29896,
29892,
20092,
29918,
2435,
29897,
13,
9651,
2643,
29922,
4839,
718,
4906,
13,
4706,
25342,
313,
23813,
29918,
2435,
529,
5135,
29906,
3579,
29871,
29896,
29953,
29897,
448,
29871,
29896,
22164,
13,
9651,
289,
29906,
891,
29922,
29871,
29896,
29906,
29953,
13,
9651,
4839,
4619,
18460,
29898,
29890,
29896,
29897,
13,
9651,
4839,
4619,
18460,
29898,
29890,
29906,
29897,
13,
9651,
301,
353,
2281,
29889,
4058,
703,
29958,
29950,
613,
20092,
29918,
2435,
29897,
13,
9651,
4839,
4619,
301,
13,
9651,
2643,
353,
4839,
718,
4906,
13,
4706,
1683,
29901,
632,
13,
9651,
289,
29906,
891,
29922,
29871,
29896,
29906,
29955,
13,
9651,
4839,
4619,
18460,
29898,
29890,
29896,
29897,
13,
9651,
4839,
4619,
18460,
29898,
29890,
29906,
29897,
13,
9651,
301,
353,
2281,
29889,
4058,
703,
29958,
29984,
613,
20092,
29918,
2435,
29897,
13,
9651,
4839,
4619,
301,
13,
9651,
2643,
353,
4839,
718,
4906,
13,
4706,
736,
2643,
13,
13,
1990,
4321,
3609,
29903,
1698,
1691,
29898,
348,
27958,
29889,
3057,
8259,
1125,
268,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5652,
6004,
353,
16904,
877,
742,
29896,
29906,
29941,
29946,
29945,
5501,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1495,
13,
4706,
1583,
29889,
5652,
6004,
29889,
842,
27795,
29898,
5574,
416,
13,
4706,
8709,
29898,
29896,
29897,
13,
4706,
1583,
29889,
1688,
11514,
353,
9909,
29889,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
1254,
1525,
5194,
29897,
13,
4706,
1583,
29889,
1688,
11514,
29889,
842,
21852,
3670,
29898,
11514,
29889,
29903,
5607,
29918,
6156,
7077,
2544,
29892,
9909,
29889,
6156,
29918,
1525,
17171,
3035,
8353,
29892,
29871,
29896,
29897,
4706,
396,
6204,
263,
9909,
1203,
13,
4706,
3495,
353,
525,
7640,
29915,
396,
3617,
1887,
4933,
1024,
13,
4706,
2011,
353,
29871,
29896,
29906,
29941,
29946,
29945,
418,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6915,
3552,
3069,
29892,
2011,
876,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5652,
6004,
29889,
5358,
5350,
890,
13,
4706,
1583,
29889,
1688,
11514,
29889,
5358,
580,
13,
4706,
8709,
29898,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
2676,
11373,
6004,
14824,
622,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
5652,
6004,
29889,
18603,
29892,
15516,
376,
6004,
731,
304,
278,
7429,
995,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
5652,
6004,
29889,
15082,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29892,
376,
6004,
2011,
338,
731,
5149,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
5652,
6004,
29889,
16652,
1964,
20832,
29892,
376,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
613,
376,
7717,
3069,
731,
304,
29871,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
20965,
29918,
3089,
29898,
1311,
1125,
13,
4706,
2643,
29922,
376,
3057,
7777,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
29898,
4906,
29897,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
396,
2158,
525,
5103,
304,
8340,
2643,
29966,
3057,
3728,
29958,
29871,
1273,
29879,
29915,
29995,
29898,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
11297,
29915,
6007,
8186,
9838,
29918,
1525,
17637,
3352,
20333,
742,
376,
13919,
7777,
22225,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
3084,
29918,
7811,
29918,
3089,
29898,
1311,
1125,
13,
4706,
2643,
353,
376,
7194,
847,
1357,
13496,
7331,
29914,
29896,
29889,
29896,
29905,
29876,
8514,
29901,
1923,
29889,
4773,
29889,
510,
29905,
29876,
3373,
8228,
29901,
1856,
11514,
29905,
29876,
5350,
29901,
5020,
8228,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
2558,
29901,
529,
10818,
29958,
29876,
7898,
29899,
3609,
11373,
29899,
17830,
29901,
13563,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
6594,
29901,
29871,
29896,
29941,
29905,
29876,
23182,
29901,
15683,
29905,
29876,
29905,
29876,
29908,
13,
29937,
308,
2643,
353,
376,
3057,
2643,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
4906,
29897,
13,
4706,
16904,
5327,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
308,
13,
4706,
396,
2158,
525,
5103,
304,
2854,
16904,
2009,
1273,
29879,
29915,
29995,
5652,
5327,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
5652,
5327,
29892,
11297,
29915,
6007,
8186,
9838,
29918,
1525,
17637,
3352,
20333,
742,
376,
5350,
338,
451,
22225,
1159,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
5652,
5327,
29892,
376,
5350,
13291,
338,
451,
2812,
2349,
1159,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
703,
3057,
7777,
5783,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
396,
2158,
525,
5103,
304,
443,
18511,
10729,
29871,
1273,
29879,
29915,
29995,
29898,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
6634,
29915,
2525,
3806,
1015,
401,
20333,
613,
376,
797,
2854,
7777,
22225,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
20965,
29918,
19058,
479,
29898,
1311,
1125,
13,
4706,
2643,
353,
376,
7194,
847,
1357,
13496,
7331,
29914,
29896,
29889,
29896,
29905,
29876,
8514,
29901,
1923,
29889,
4773,
29889,
510,
29905,
29876,
3373,
8228,
29901,
1856,
11514,
29905,
29876,
5350,
29901,
5020,
8228,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
2558,
29901,
529,
10818,
29958,
1360,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
17830,
29901,
13563,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
6594,
29901,
29871,
29896,
29941,
29905,
29876,
23182,
29901,
15683,
29905,
29876,
29905,
29876,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
4906,
29897,
13,
4706,
16904,
5327,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
8709,
29898,
29896,
29897,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
703,
3057,
7777,
1159,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
6634,
29915,
2525,
3806,
1015,
401,
20333,
613,
376,
797,
2854,
7777,
22225,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
5156,
15628,
29918,
3728,
29898,
1311,
1125,
13,
4706,
2643,
353,
376,
7194,
847,
1357,
13496,
7331,
29914,
29896,
29889,
29896,
29905,
29876,
8514,
29901,
1923,
29889,
4773,
29889,
510,
29905,
29876,
3373,
8228,
29901,
1856,
11514,
29905,
29876,
5350,
29901,
5020,
8228,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
2558,
29901,
529,
10818,
29958,
1360,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
17830,
29901,
13563,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
6594,
29901,
29871,
29896,
29941,
29905,
29876,
23182,
29901,
15683,
29905,
29876,
29905,
29876,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
4906,
29897,
13,
4706,
16904,
5327,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
29937,
308,
1596,
16904,
5327,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
29898,
12508,
3728,
703,
3057,
7777,
5783,
29937,
4013,
1196,
2444,
304,
679,
10771,
472,
3064,
29889,
24380,
338,
304,
671,
3638,
3596,
29892,
671,
320,
29876,
472,
278,
1095,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
6634,
29915,
29924,
3235,
19094,
3040,
29928,
22986,
1799,
10461,
20333,
613,
376,
25510,
411,
714,
263,
1134,
338,
22225,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
5872,
15628,
29918,
3728,
29918,
1454,
29918,
1626,
29898,
1311,
1125,
13,
4706,
2643,
353,
376,
7194,
847,
1357,
13496,
7331,
29914,
29896,
29889,
29896,
29905,
29876,
8514,
29901,
1923,
29889,
4773,
29889,
510,
29905,
29876,
3373,
8228,
29901,
1856,
11514,
29905,
29876,
5350,
29901,
5020,
8228,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
2558,
29901,
529,
10818,
29958,
29876,
7898,
29899,
3609,
11373,
29899,
17830,
29901,
13563,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
6594,
29901,
29871,
29896,
29941,
29905,
29876,
23182,
29901,
15683,
29905,
29876,
29905,
29876,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
4906,
29897,
13,
4706,
16904,
5327,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
29937,
308,
1596,
16904,
5327,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
29898,
12508,
3728,
703,
29896,
29966,
807,
29958,
3057,
7777,
5783,
29937,
4013,
1196,
2444,
304,
679,
10771,
472,
3064,
29889,
24380,
338,
304,
671,
3638,
3596,
29892,
671,
320,
29876,
472,
278,
1095,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
1596,
848,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
6634,
29915,
1626,
4520,
20333,
613,
376,
1626,
11946,
1179,
338,
29871,
15659,
322,
9259,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
5872,
15628,
29918,
3728,
29918,
1454,
29918,
8148,
29898,
1311,
1125,
13,
4706,
2643,
353,
376,
7194,
847,
1357,
13496,
7331,
29914,
29896,
29889,
29896,
29905,
29876,
8514,
29901,
1923,
29889,
4773,
29889,
510,
29905,
29876,
3373,
8228,
29901,
1856,
11514,
29905,
29876,
5350,
29901,
5020,
8228,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
2558,
29901,
921,
29941,
29967,
29967,
29950,
29924,
29890,
19558,
29896,
29923,
29920,
29931,
15339,
29929,
7210,
29882,
29990,
29928,
29893,
1360,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
17830,
29901,
13563,
29905,
29876,
7898,
29899,
3609,
11373,
29899,
6594,
29901,
29871,
29896,
29941,
29905,
29876,
23182,
29901,
15683,
29905,
29876,
29905,
29876,
29908,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
497,
29898,
4906,
29897,
13,
4706,
16904,
5327,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
4706,
1583,
29889,
1688,
11514,
29889,
6717,
29898,
12508,
3728,
703,
29906,
29966,
807,
29958,
3057,
7777,
5783,
29937,
4013,
1196,
2444,
304,
679,
10771,
472,
3064,
29889,
24380,
338,
304,
671,
3638,
3596,
29892,
671,
320,
29876,
472,
278,
1095,
13,
4706,
848,
353,
2062,
29898,
1311,
29889,
1688,
11514,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
876,
13,
29937,
308,
1596,
848,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1272,
29892,
6634,
29915,
3126,
338,
4520,
20333,
613,
376,
3126,
11946,
1179,
338,
29871,
15659,
322,
9259,
1159,
13,
13,
2277,
4986,
27694,
6093,
18322,
2208,
9806,
4214,
8291,
1806,
17067,
1254,
29903,
13315,
8519,
8528,
4162,
1783,
3352,
379,
7520,
29923,
6093,
27640,
27982,
29871,
13,
2277,
27045,
29928,
29889,
27640,
27982,
12314,
24290,
8519,
13756,
13044,
3352,
7495,
14602,
6093,
14693,
23524,
19926,
27640,
27982,
29903,
5300,
10911,
29903,
13,
2277,
22933,
3235,
8426,
3040,
29928,
360,
8254,
8519,
6058,
13756,
13044,
3352,
29889,
539,
13,
1990,
4321,
9112,
29898,
348,
27958,
29889,
3057,
8259,
1125,
268,
13,
268,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9965,
353,
831,
29889,
2585,
17918,
580,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9965,
29889,
5358,
580,
13,
268,
13,
1678,
822,
1243,
29918,
1272,
29918,
7851,
29918,
1272,
29918,
6359,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
1311,
29889,
9965,
29892,
9254,
2585,
29889,
9965,
29892,
376,
9112,
3957,
7913,
2486,
731,
1159,
13,
4706,
6965,
898,
532,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29900,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29941,
29896,
29900,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
5272,
353,
851,
29898,
1315,
898,
532,
3366,
3283,
3108,
3366,
1997,
3108,
416,
13,
4706,
565,
5272,
26359,
8516,
1115,
13,
9651,
5272,
353,
525,
29900,
29915,
4706,
13,
4706,
28435,
353,
525,
29900,
29915,
13,
4706,
6210,
353,
525,
29900,
29915,
13,
4706,
2920,
353,
6965,
898,
532,
3366,
29894,
2103,
3108,
13,
4706,
3171,
353,
1315,
898,
532,
3366,
29894,
3545,
3108,
13,
4706,
565,
2920,
1405,
3171,
584,
13,
9651,
4315,
20659,
29922,
29871,
29896,
29889,
29900,
29900,
29937,
5252,
5738,
13,
4706,
1683,
584,
13,
9651,
4315,
20659,
29922,
29871,
29900,
29889,
29900,
29900,
29937,
17765,
8356,
13,
4706,
10422,
353,
29871,
6965,
898,
532,
3366,
1853,
3108,
13578,
29918,
17969,
1315,
898,
532,
3366,
2230,
3108,
13578,
1213,
29974,
1315,
898,
532,
3366,
1062,
3108,
13,
4706,
4576,
1807,
29896,
353,
376,
19460,
11646,
1954,
4063,
532,
1819,
3441,
11838,
29974,
9507,
13578,
29905,
742,
7999,
290,
4591,
1626,
6702,
29925,
6992,
29911,
703,
29974,
851,
29898,
1315,
898,
532,
3366,
3283,
3108,
3366,
5066,
20068,
13578,
15691,
710,
29898,
1315,
898,
532,
3366,
3283,
3108,
3366,
12957,
20068,
29974,
1159,
5477,
17969,
710,
29898,
1315,
898,
532,
3366,
3283,
3108,
3366,
1997,
20068,
29974,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
3283,
3108,
3366,
5753,
20068,
13,
4706,
4576,
1807,
29906,
353,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
29887,
29916,
20068,
29974,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
1927,
20068,
29974,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
18828,
20068,
13,
4706,
4576,
1807,
29941,
353,
28796,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
336,
20068,
29974,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
6050,
20068,
29974,
3284,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3108,
3366,
11007,
20068,
29974,
3284,
29974,
710,
29898,
10525,
20659,
7240,
613,
29905,
11838,
29974,
1315,
898,
532,
3366,
10141,
3108,
3366,
20659,
3108,
13578,
29905,
742,
3707,
3285,
29905,
11838,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
3267,
20068,
13578,
29905,
742,
29905,
11838,
29974,
710,
29898,
1315,
898,
532,
3366,
15965,
1853,
20068,
13578,
29905,
742,
29905,
11838,
29974,
710,
29898,
1315,
898,
532,
3366,
10141,
1542,
20068,
13578,
29905,
2157,
29908,
13,
4706,
4576,
1807,
353,
4576,
1807,
29896,
718,
4576,
1807,
29906,
29974,
4576,
1807,
29941,
13,
4706,
396,
2158,
29898,
2850,
1807,
29897,
13,
4706,
831,
29889,
2585,
17491,
29898,
2850,
1807,
29897,
308,
13,
4706,
4576,
949,
303,
292,
353,
525,
2622,
6382,
3871,
29892,
27088,
29892,
3359,
293,
300,
668,
29892,
29990,
29898,
5479,
29897,
408,
26271,
29892,
612,
29898,
5479,
29897,
408,
28745,
29871,
515,
1954,
4063,
532,
988,
931,
2013,
29915,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29896,
29905,
4907,
13,
4706,
1121,
353,
831,
29889,
2585,
6359,
29898,
2850,
949,
303,
292,
29897,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
2914,
29892,
376,
17491,
287,
848,
338,
27387,
322,
372,
338,
451,
1870,
1159,
13,
4706,
363,
1948,
297,
1121,
29901,
13,
9651,
1583,
29889,
9294,
9843,
29898,
798,
29961,
29900,
1402,
376,
3027,
29918,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29900,
29889,
2732,
613,
376,
2940,
1024,
338,
5149,
731,
322,
7160,
1159,
13,
9651,
1583,
29889,
9294,
9843,
29898,
798,
29961,
29896,
1402,
29871,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
13992,
20816,
526,
7160,
1159,
13,
9651,
1583,
29889,
9294,
9843,
29898,
798,
29961,
29906,
1402,
29871,
29906,
29945,
29889,
29946,
29945,
29947,
29941,
29896,
29900,
29945,
29892,
376,
8208,
4279,
526,
7160,
1159,
632,
13,
13,
308,
13,
20832,
353,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29915,
1678,
396,
450,
7592,
3495,
13,
15082,
353,
29871,
29896,
29955,
29941,
29906,
29906,
13,
539,
13,
1990,
11654,
6004,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
418,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2585,
29918,
11512,
29892,
29784,
29878,
29889,
932,
29889,
2917,
1839,
25832,
27982,
2033,
353,
5694,
1445,
29889,
11256,
303,
3451,
580,
13,
4706,
6864,
3170,
29889,
932,
29889,
2917,
1839,
18267,
4214,
2033,
353,
5852,
13,
4706,
1583,
29889,
932,
353,
6864,
3170,
29889,
932,
29889,
1688,
29918,
4645,
580,
13,
4706,
29784,
29878,
29889,
2344,
29918,
2585,
580,
13,
4706,
396,
1311,
29889,
11514,
6004,
353,
1583,
29889,
932,
29889,
3609,
11373,
6004,
877,
742,
5652,
637,
5501,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1495,
308,
13,
3986,
13,
1678,
822,
1243,
29918,
4632,
2084,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1583,
29889,
932,
29889,
657,
11219,
1495,
13,
4706,
4974,
525,
4013,
338,
263,
16759,
6692,
363,
29871,
29906,
29928,
29941,
12696,
2156,
545,
5656,
6169,
297,
364,
29894,
29889,
1272,
13,
3986,
13,
1678,
822,
1243,
29918,
2490,
29918,
3027,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1583,
29889,
932,
29889,
2490,
11219,
2490,
2940,
1495,
13,
4706,
4974,
525,
16310,
29979,
29915,
297,
364,
29894,
29889,
1272,
13,
308,
13,
1678,
822,
1243,
29918,
695,
2209,
292,
29918,
2676,
11514,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1311,
29889,
932,
29889,
2490,
11219,
5358,
2676,
11514,
2974,
1495,
13,
4706,
4974,
525,
29907,
3927,
1660,
29928,
29915,
470,
525,
1964,
16310,
29979,
29918,
6154,
3267,
1660,
29928,
29915,
29871,
297,
364,
29894,
29889,
1272,
259,
13,
308,
13,
1678,
822,
1243,
29918,
2962,
29918,
2676,
11514,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1311,
29889,
932,
29889,
657,
11219,
2962,
2676,
11514,
2974,
1495,
13,
29937,
308,
1596,
364,
29894,
29889,
1272,
13,
4706,
4974,
525,
16310,
29979,
29915,
297,
364,
29894,
29889,
1272,
4706,
13,
268,
13,
1678,
822,
1243,
29918,
2490,
29918,
19541,
29918,
3027,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1311,
29889,
932,
29889,
2490,
11219,
2490,
25196,
2940,
1495,
13,
4706,
4974,
525,
16310,
29979,
29915,
470,
525,
29946,
29896,
29945,
853,
23765,
8213,
5167,
29915,
297,
364,
29894,
29889,
1272,
13,
268,
13,
1678,
822,
1243,
29918,
657,
29918,
3596,
29918,
2940,
29918,
1469,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1311,
29889,
932,
29889,
657,
11219,
657,
3596,
2940,
1469,
1495,
13,
4706,
4390,
7645,
353,
4390,
29889,
18132,
29898,
15291,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
3126,
7645,
1839,
3027,
1293,
2033,
1919,
376,
657,
2940,
1469,
3639,
263,
1661,
6213,
1051,
1159,
13,
308,
13,
1678,
822,
1243,
29918,
657,
29918,
5479,
29918,
2940,
29918,
1469,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1311,
29889,
932,
29889,
657,
11219,
657,
6508,
2940,
1469,
29973,
5066,
29922,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29987,
12957,
29922,
29906,
29945,
29889,
29946,
29945,
29947,
29941,
29896,
29900,
29945,
1495,
13,
4706,
4390,
7645,
353,
4390,
29889,
18132,
29898,
15291,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
3624,
3664,
8516,
29898,
3126,
7645,
1839,
3027,
1293,
2033,
1919,
376,
657,
6508,
2940,
1469,
3639,
263,
1661,
6213,
1051,
29889,
4013,
338,
263,
4682,
1243,
363,
4423,
2729,
1967,
848,
1159,
13,
268,
13,
1678,
822,
1243,
29918,
11291,
342,
29918,
2940,
29918,
276,
509,
16837,
29898,
1311,
1125,
13,
4706,
6965,
898,
532,
29896,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29896,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29941,
29896,
29900,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
6965,
898,
532,
29906,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29906,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29906,
29896,
29896,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
6965,
898,
532,
29941,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29941,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29946,
29896,
29900,
29946,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
6965,
898,
532,
29946,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29946,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29953,
29896,
29896,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
6965,
898,
532,
29945,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29945,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29955,
29896,
29906,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
6965,
898,
532,
29953,
353,
6377,
1853,
4710,
3027,
613,
376,
2230,
4710,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29953,
613,
376,
1062,
4710,
2732,
613,
376,
10141,
1542,
4710,
29295,
613,
376,
10141,
3267,
4710,
29933,
1202,
29874,
613,
376,
15965,
1853,
4710,
18654,
8944,
613,
376,
3283,
28819,
12957,
1115,
29906,
29945,
29889,
29946,
29945,
29947,
29947,
29896,
29906,
29945,
29892,
376,
5066,
1115,
29953,
29945,
29889,
29900,
29953,
29900,
29900,
29955,
29929,
29955,
29892,
376,
1997,
1115,
29899,
29896,
29900,
29900,
29900,
29892,
376,
5753,
1115,
29946,
29947,
29889,
29941,
29947,
29947,
29900,
29900,
29900,
29946,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
1118,
376,
10141,
28819,
1165,
1115,
29900,
29892,
376,
388,
1115,
29900,
29892,
376,
834,
1115,
29900,
29892,
376,
29887,
29916,
1115,
29900,
29892,
376,
1927,
1115,
29900,
29892,
376,
18828,
1115,
29900,
29892,
376,
336,
1115,
29906,
29896,
29900,
29889,
29945,
29953,
29941,
29955,
29892,
376,
6050,
1115,
29946,
29955,
29889,
29945,
29953,
29945,
29955,
29892,
376,
11007,
1115,
29953,
29889,
29929,
29953,
29929,
29947,
29892,
376,
20659,
4710,
17765,
8356,
10758,
376,
29894,
2103,
1115,
29946,
29947,
29900,
29892,
376,
29894,
3545,
1115,
29947,
29900,
29900,
29913,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29896,
29897,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29906,
29897,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29941,
29897,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29946,
29897,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29945,
29897,
13,
4706,
831,
29889,
7620,
1469,
29898,
1315,
898,
532,
29953,
29897,
13,
4706,
11855,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
1669,
13,
4706,
15373,
1293,
353,
831,
29889,
657,
29907,
5409,
342,
20163,
29898,
29871,
29953,
29945,
29889,
29900,
29953,
29900,
29896,
29955,
29947,
29955,
29892,
259,
29906,
29945,
29889,
29946,
29945,
29947,
29941,
29896,
29900,
29955,
29892,
11855,
29871,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
21596,
1293,
511,
29871,
29946,
29892,
376,
6513,
310,
278,
1051,
881,
367,
5186,
310,
278,
937,
1243,
1159,
13,
4706,
363,
1948,
297,
15373,
1293,
29901,
13,
9651,
4974,
525,
3027,
29918,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29906,
29889,
2732,
29915,
470,
525,
3027,
29918,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29896,
29889,
2732,
29915,
297,
1948,
29961,
29900,
29962,
29871,
13,
4706,
15373,
1293,
29906,
353,
831,
29889,
657,
29907,
5409,
342,
20163,
29898,
29871,
29953,
29945,
29889,
29900,
29953,
29900,
29896,
29955,
29947,
29955,
29892,
259,
29906,
29945,
29889,
29946,
29945,
29947,
29955,
29896,
29900,
29955,
29892,
11855,
29871,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
21596,
1293,
29906,
511,
29871,
29906,
29892,
376,
6513,
310,
278,
1051,
881,
367,
5186,
310,
278,
1473,
1243,
1159,
13,
4706,
363,
1948,
297,
15373,
1293,
29906,
29901,
13,
9651,
4974,
525,
3027,
29918,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29946,
29889,
2732,
29915,
470,
525,
3027,
29918,
29906,
29900,
29896,
29946,
29889,
29941,
29889,
29946,
29918,
29896,
29946,
29889,
29946,
29900,
29889,
29941,
29945,
29889,
2732,
29915,
297,
1948,
29961,
29900,
29962,
13,
632,
13,
308,
13,
259,
13,
1753,
9460,
7295,
13,
1678,
1243,
29658,
353,
348,
27958,
29889,
3057,
5091,
568,
580,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
2676,
11373,
6004,
14824,
622,
8785,
268,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
3084,
29918,
7811,
29918,
3089,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
20965,
29918,
19058,
479,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
20965,
29918,
3089,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
5156,
15628,
29918,
3728,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
5872,
15628,
29918,
3728,
29918,
1454,
29918,
1626,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
3609,
29903,
1698,
1691,
877,
1688,
29918,
5872,
15628,
29918,
3728,
29918,
1454,
29918,
8148,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
3057,
9112,
877,
1688,
29918,
1272,
29918,
7851,
29918,
1272,
29918,
6359,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
4632,
2084,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
2490,
29918,
3027,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
2962,
29918,
2676,
11514,
8785,
268,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
695,
2209,
292,
29918,
2676,
11514,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
2490,
29918,
19541,
29918,
3027,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
657,
29918,
3596,
29918,
2940,
29918,
1469,
8785,
13,
1678,
1243,
29658,
29889,
1202,
3057,
29898,
15078,
6004,
3057,
8259,
877,
1688,
29918,
11291,
342,
29918,
2940,
29918,
276,
509,
16837,
8785,
29871,
13,
1678,
736,
1243,
29658,
13,
13,
13495,
353,
9460,
580,
13,
27492,
353,
443,
27958,
29889,
1626,
3057,
16802,
29898,
18248,
359,
537,
29922,
29941,
29897,
13,
27492,
29889,
3389,
29898,
13495,
29897,
13,
308,
13,
29937,
565,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
29937,
268,
396,
5215,
10876,
29936,
9675,
29889,
19218,
353,
6024,
742,
525,
3057,
29889,
1688,
1170,
2033,
13,
29937,
268,
443,
27958,
29889,
3396,
580,
2
] |
unionfind-component.py | surpace/shed | 2 | 181020 | class UnionFind:
def __init__(self, size):
self.parent = list(range(size))
self.component = [[i] for i in range(size)]
def root(self, i):
if self.parent[i] != i:
self.parent[i] = self.root(self.parent[i])
return self.parent[i]
def unite(self, i, j):
i, j = self.root(i), self.root(j)
if len(self.component[i]) < len(self.component[j]):
i, j = j, i
self.parent[j] = i
self.component[i] += self.component[j]
| [
1,
770,
7761,
12542,
29901,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
2159,
1125,
13,
1678,
1583,
29889,
3560,
353,
1051,
29898,
3881,
29898,
2311,
876,
13,
1678,
1583,
29889,
9700,
353,
5519,
29875,
29962,
363,
474,
297,
3464,
29898,
2311,
4638,
13,
259,
13,
29871,
822,
3876,
29898,
1311,
29892,
474,
1125,
13,
1678,
565,
1583,
29889,
3560,
29961,
29875,
29962,
2804,
474,
29901,
13,
418,
1583,
29889,
3560,
29961,
29875,
29962,
353,
1583,
29889,
4632,
29898,
1311,
29889,
3560,
29961,
29875,
2314,
13,
1678,
736,
1583,
29889,
3560,
29961,
29875,
29962,
13,
259,
13,
29871,
822,
443,
568,
29898,
1311,
29892,
474,
29892,
432,
1125,
13,
1678,
474,
29892,
432,
353,
1583,
29889,
4632,
29898,
29875,
511,
1583,
29889,
4632,
29898,
29926,
29897,
13,
1678,
565,
7431,
29898,
1311,
29889,
9700,
29961,
29875,
2314,
529,
7431,
29898,
1311,
29889,
9700,
29961,
29926,
29962,
1125,
13,
418,
474,
29892,
432,
353,
432,
29892,
474,
13,
1678,
1583,
29889,
3560,
29961,
29926,
29962,
353,
474,
13,
1678,
1583,
29889,
9700,
29961,
29875,
29962,
4619,
1583,
29889,
9700,
29961,
29926,
29962,
13,
2
] |
capsNet.py | zhaoaite/ASTCapsNet | 0 | 33158 | """
License: Apache-2.0
Author: <NAME>
E-mail: <EMAIL>
"""
import tensorflow as tf
import rnn_cell_GRU as rnn_cell
import rnn
import numpy as np
from config import cfg
from utils import get_batch_data
from capsLayer import CapsLayer
from sklearn import metrics
import pickle
from sklearn.cross_validation import train_test_split
from sklearn import preprocessing
from plot_confusion_matrix import plot_confusion_matrix
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import os
import tensorflow as tf
from tensorflow.contrib.tensor_forest.python import tensor_forest
from tensorflow.python.ops import resources
class CapsNet(object):
def __init__(self, is_training=True):
self.graph = tf.Graph()
with self.graph.as_default():
self.n_classes=52
self.X, self.labels = get_batch_data(cfg.dataset, cfg.batch_size, cfg.num_threads)
self.Y = tf.one_hot(self.labels, depth=self.n_classes, axis=1, dtype=tf.float32)
# LSTM Parameters
self.n_input=45
self.n_steps=45
# tf Graph input
self.lstm_x = tf.reshape(self.X, shape=(cfg.batch_size, self.n_steps, self.n_input))
self.lstm_y = tf.reshape(self.Y, shape=(cfg.batch_size, self.n_classes))
self.kernel_size1=13
self.kernel_size2=9
self.conv1_outa=self.n_input-self.kernel_size1+1
self.conv1_outb=self.n_steps-self.kernel_size1+1
# self.cap1_out=(self.conv1_outa-self.kernel_size+1)/2*((self.conv1_outb-self.kernel_size+1)/2)
# self.cap1_out=int((self.conv1_outa-self.kernel_size2+1)*(self.conv1_outb-self.kernel_size2+1)*32/4)
self.cap1_out=5408
self.n_hidden= self.conv1_outb
# Define weights
self.lstm_weights = {
'out': tf.Variable(tf.random_normal([self.n_hidden, self.n_classes]))
}
self.lstm_biases = {
'out': tf.Variable(tf.random_normal([self.n_classes]))
}
if is_training:
self.build_arch()
self.loss()
self._summary()
# t_vars = tf.trainable_variables()
self.global_step = tf.Variable(0, name='global_step', trainable=False)
self.optimizer = tf.train.AdamOptimizer()
self.train_op = self.optimizer.minimize(self.total_loss, global_step=self.global_step) # var_list=t_vars)
self.train_c1 = self.optimizer.minimize(self.lstm_cost, global_step=self.global_step)
self.train_c2 = self.optimizer.minimize(self.dense_cov1_cost, global_step=self.global_step)
self.train_c3 = self.optimizer.minimize(self.dense_caps1_cost, global_step=self.global_step)
print('end net')
else:
self.X = tf.placeholder(tf.float32, shape=(cfg.batch_size,self.n_input, self.n_steps, 1))
self.labels = tf.placeholder(tf.int32, shape=(cfg.batch_size, ))
self.Y = tf.reshape(self.labels, shape=(cfg.batch_size, self.n_classes, 1))
self.build_arch()
tf.logging.info('Seting up the main structure')
def RNN(self):
# Prepare data shape to match `rnn` function requirements
# Current data input shape: (batch_size, n_steps, n_input)
# Required shape: 'n_steps' tensors list of shape (batch_size, n_input)
# Permuting batch_size and n_steps
x = tf.transpose(self.lstm_x, [1, 0, 2])
# Reshaping to (n_steps*batch_size, n_input)
x = tf.reshape(tensor=x, shape=[-1, self.n_input])
# Split to get a list of 'n_steps' tensors of shape (batch_size, n_input)
x = tf.split(value=x, num_or_size_splits=self.n_steps, axis=0)
# Define a lstm cell with tensorflow
#lstm_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1)
lstm_cell = rnn_cell.GRUCell(self.n_hidden)
#lstm_cell = rnn_cell.LSTMCell(n_hidden,use_peepholes=True)
# avoid overfitting
lstm_cell = rnn_cell.DropoutWrapper(lstm_cell, output_keep_prob=0.5)
# 2 layers lstm
lstm_cell = rnn_cell.MultiRNNCell([lstm_cell]*2)
# Get lstm cell output
outputs, states = rnn.rnn(cell=lstm_cell, inputs=x, dtype=tf.float32)
# Linear activation, using rnn inner loop last output
return tf.matmul(outputs[-1], self.lstm_weights['out']) + self.lstm_biases['out'],outputs[-1]
def build_arch(self):
with tf.variable_scope('LSTM_layer'):
#pred batch*4d out batch*128d
pred,out = self.RNN()
out=tf.reshape(out,(-1,1,self.n_hidden,1))
# cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=pred, labels=y))
# #Adam optimizer
# optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(cost)
# Evaluate model
# correct_pred = tf.equal(tf.argmax(pred,1), tf.argmax(y,1))
# accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))
with tf.variable_scope('Conv1_layer'):
# Conv1, [batch_size, 20, 20, 256]
conv1 = tf.contrib.layers.conv2d(self.X, num_outputs=256,
kernel_size=self.kernel_size1, stride=1,
padding='VALID')
# print(conv1.get_shape(),[cfg.batch_size, self.conv1_outa,self.conv1_outb, 256])
assert conv1.get_shape() == [cfg.batch_size, self.conv1_outa,self.conv1_outb, 256]
out=tf.tile(out,[1,self.conv1_outa,1,256])
self.conv1=tf.add(conv1,out)
# out_temp= tf.placeholder(tf.float32, shape=(cfg.batch_size,self.conv1_outa+1,self.conv1_outb, 256))
# self.dense1 = tf.layers.dense(inputs=tf.reshape(self.conv1,(cfg.batch_size,-1)), units=self.n_classes, activation=tf.nn.relu)
#全连接层
pool = tf.layers.max_pooling2d(inputs=self.conv1, pool_size=[2, 2], strides=2)
fc1 = tf.layers.dense(inputs=pool, units=1024, activation=tf.nn.relu)
fc2 = tf.layers.dense(inputs=fc1, units=512, activation=tf.nn.relu)
self.dense1 = tf.layers.dense(inputs=tf.reshape(fc2,(cfg.batch_size,-1)), units=self.n_classes, activation=None)
self.dense1_index = tf.to_int32(tf.argmax(tf.nn.softmax(self.dense1, axis=1), axis=1))
# Primary Capsules layer, return [batch_size, 1152, 8, 1]
with tf.variable_scope('PrimaryCaps_layer'):
primaryCaps = CapsLayer(num_outputs=32, vec_len=8, with_routing=False, layer_type='CONV', conv1_outa=self.conv1_outa, conv1_outb=self.conv1_outb, cap1_out=self.cap1_out,n_classes=self.n_classes)
(self.caps1,pred) = primaryCaps(self.conv1, kernel_size=self.kernel_size2, stride=2)
self.lstmpred=pred
assert self.caps1.get_shape() == [cfg.batch_size, self.cap1_out, 8, 1]
# self.dense2= tf.layers.dense(inputs=tf.reshape(self.caps1,(cfg.batch_size,-1)), units=self.n_classes, activation=tf.nn.relu)
pool = tf.layers.max_pooling2d(inputs=self.caps1, pool_size=[2, 2], strides=2)
fc1 = tf.layers.dense(inputs=pool, units=1024, activation=tf.nn.relu)
fc2 = tf.layers.dense(inputs=fc1, units=512, activation=tf.nn.relu)
self.dense2 = tf.layers.dense(inputs=tf.reshape(fc2,(cfg.batch_size,-1)), units=self.n_classes, activation=None)
self.dense2_index = tf.to_int32(tf.argmax(tf.nn.softmax(self.dense2, axis=1), axis=1))
# DigitCaps layer, return [batch_size, 10, 16, 1]
with tf.variable_scope('DigitCaps_layer'):
digitCaps = CapsLayer(num_outputs=self.n_classes, vec_len=8, with_routing=True, layer_type='FC',conv1_outa=self.conv1_outa, conv1_outb=self.conv1_outb, cap1_out=self.cap1_out,n_classes=self.n_classes)
self.caps2 = digitCaps(self.caps1)
# self.caps2 = tf.add(tf.tile(tf.reshape(self.lstmpred,(cfg.batch_size,self.n_classes,1,1)),[1,1,16,1]),self.caps2)
# Decoder structure in Fig. 2
# 1. Do masking, how:
with tf.variable_scope('Masking'):
# a). calc ||v_c||, then do softmax(||v_c||)
# [batch_size, 10, 16, 1] => [batch_size, 10, 1, 1]
self.v_length = tf.sqrt(tf.reduce_sum(tf.square(self.caps2),
axis=2, keepdims=True))
self.softmax_v = tf.nn.softmax(self.v_length, axis=1)
assert self.softmax_v.get_shape() == [cfg.batch_size, self.n_classes, 1, 1]
# b). pick out the index of max softmax val of the 10 caps
# [batch_size, 10, 1, 1] => [batch_size] (index)
self.argmax_idx = tf.to_int32(tf.argmax(self.softmax_v, axis=1))
assert self.argmax_idx.get_shape() == [cfg.batch_size, 1, 1]
self.argmax_idx = tf.reshape(self.argmax_idx, shape=(cfg.batch_size, ))
# self.max_index_list= tf.Variable(tf.ones([cfg.batch_size, ],dtype=tf.int32))
# index_list=tf.stack([self.dense1_index,self.dense2_index,self.argmax_idx],1)
#
# for i in range(cfg.batch_size):
# max_index=tf.to_int32(tf.argmax(tf.bincount(index_list[i])))
# self.update_op=tf.assign(self.max_index_list[i],max_index)
# # Method 1.
# if not cfg.mask_with_y:
# # c). indexing
# # It's not easy to understand the indexing process with argmax_idx
# # as we are 3-dim animal
# masked_v = []
# for batch_size in range(cfg.batch_size):
# v = self.caps2[batch_size][self.argmax_idx[batch_size], :]
# masked_v.append(tf.reshape(v, shape=(1, 1, 8, 1)))
#
# self.masked_v = tf.concat(masked_v, axis=0)
# assert self.masked_v.get_shape() == [cfg.batch_size, 1, 8, 1]
# # Method 2. masking with true label, default mode
# else:
# # self.masked_v = tf.matmul(tf.squeeze(self.caps2), tf.reshape(self.Y, (-1, 10, 1)), transpose_a=True)
# self.masked_v = tf.multiply(tf.squeeze(self.caps2), tf.reshape(self.Y, (-1, self.n_classes, 1)))
# self.v_length = tf.sqrt(tf.reduce_sum(tf.square(self.caps2), axis=2, keepdims=True) + epsilon)
#
# # 2. Reconstructe the MNIST images with 3 FC layers
# # [batch_size, 1, 16, 1] => [batch_size, 16] => [batch_size, 512]
# with tf.variable_scope('Decoder'):
# vector_j = tf.reshape(self.masked_v, shape=(cfg.batch_size, -1))
# fc1 = tf.contrib.layers.fully_connected(vector_j, num_outputs=512)
# assert fc1.get_shape() == [cfg.batch_size, 512]
# fc2 = tf.contrib.layers.fully_connected(fc1, num_outputs=1024)
# assert fc2.get_shape() == [cfg.batch_size, 1024]
# self.decoded = tf.contrib.layers.fully_connected(fc2, num_outputs=self.n_steps*self.n_input, activation_fn=tf.sigmoid)
def loss(self):
# 1. The margin loss
# [batch_size, 10, 1, 1]
# max_l = max(0, m_plus-||v_c||)^2
max_l = tf.square(tf.maximum(0., cfg.m_plus - self.v_length))
# max_r = max(0, ||v_c||-m_minus)^2
max_r = tf.square(tf.maximum(0., self.v_length - cfg.m_minus))
assert max_l.get_shape() == [cfg.batch_size,self.n_classes, 1, 1]
# reshape: [batch_size, 10, 1, 1] => [batch_size, 10]
max_l = tf.reshape(max_l, shape=(cfg.batch_size, -1))
max_r = tf.reshape(max_r, shape=(cfg.batch_size, -1))
# calc T_c: [batch_size, 10]
# T_c = Y, is my understanding correct? Try it.
T_c = self.Y
# [batch_size, 10], element-wise multiply
L_c = T_c * max_l + cfg.lambda_val * (1 - T_c) * max_r
self.margin_loss = tf.reduce_mean(tf.reduce_sum(L_c, axis=1))
# # 2. The reconstruction loss
# orgin = tf.reshape(self.X, shape=(cfg.batch_size, -1))
# squared = tf.square(self.decoded - orgin)
# self.reconstruction_err = tf.reduce_mean(squared)
# lstm loss
self.lstm_cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=self.lstmpred, labels=self.lstm_y))
self.lstm_index = tf.to_int32(tf.argmax(self.lstmpred, axis=1))
self.dense_cov1_cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=self.dense1, labels=self.lstm_y))
self.dense_caps1_cost= tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=self.dense2, labels=self.lstm_y))
# 3. Total loss
# The paper uses sum of squared error as reconstruction error, but we
# have used reduce_mean in `# 2 The reconstruction loss` to calculate
# mean squared error. In order to keep in line with the paper,the
# regularization scale should be 0.0005*784=0.392
# self.total_loss = self.margin_loss + cfg.regularization_scale * self.reconstruction_err+lstm_cost
# self.total_loss = self.margin_loss+self.lstm_cost
self.total_loss = self.margin_loss+self.lstm_cost+self.dense_cov1_cost+self.dense_caps1_cost
# Summary
def _summary(self):
train_summary = []
train_summary.append(tf.summary.scalar('train/margin_loss', self.margin_loss))
# train_summary.append(tf.summary.scalar('train/reconstruction_loss', self.reconstruction_err))
train_summary.append(tf.summary.scalar('train/total_loss', self.total_loss))
# train_summary.append(tf.summary.scalar('train/rf_loss', self.rf_loss_op))
# recon_img = tf.reshape(self.decoded, shape=(cfg.batch_size, self.n_input,self.n_steps, 1))
# train_summary.append(tf.summary.image('reconstruction_img', recon_img))
self.train_summary = tf.summary.merge(train_summary)
# correct_prediction = tf.equal(tf.to_int32(self.labels), self.max_index_list)
# self.accuracy = tf.reduce_sum(tf.cast(correct_prediction, tf.float32))
| [
1,
9995,
13,
29931,
293,
1947,
29901,
13380,
29899,
29906,
29889,
29900,
13,
13720,
29901,
529,
5813,
29958,
13,
29923,
29899,
2549,
29901,
529,
26862,
6227,
29958,
13,
15945,
29908,
13,
13,
5215,
26110,
408,
15886,
13,
5215,
364,
15755,
29918,
3729,
29918,
14345,
29965,
408,
364,
15755,
29918,
3729,
13,
5215,
364,
15755,
13,
5215,
12655,
408,
7442,
13,
3166,
2295,
1053,
274,
16434,
13,
3166,
3667,
29879,
1053,
679,
29918,
16175,
29918,
1272,
13,
3166,
26091,
14420,
1053,
315,
2547,
14420,
13,
3166,
2071,
19668,
1053,
21556,
259,
13,
5215,
5839,
280,
13,
3166,
2071,
19668,
29889,
19128,
29918,
18157,
1053,
7945,
29918,
1688,
29918,
5451,
13,
3166,
2071,
19668,
1053,
758,
19170,
13,
3166,
6492,
29918,
5527,
3958,
29918,
5344,
1053,
6492,
29918,
5527,
3958,
29918,
5344,
13,
3166,
2071,
19668,
29889,
2527,
10817,
1053,
14679,
29918,
5344,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
5215,
2897,
13,
5215,
26110,
408,
15886,
13,
3166,
26110,
29889,
21570,
29889,
20158,
29918,
1454,
342,
29889,
4691,
1053,
12489,
29918,
1454,
342,
13,
3166,
26110,
29889,
4691,
29889,
3554,
1053,
7788,
13,
13,
13,
13,
13,
1990,
315,
2547,
6779,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
338,
29918,
26495,
29922,
5574,
1125,
13,
4706,
1583,
29889,
4262,
353,
15886,
29889,
9527,
580,
13,
4706,
411,
1583,
29889,
4262,
29889,
294,
29918,
4381,
7295,
13,
9651,
1583,
29889,
29876,
29918,
13203,
29922,
29945,
29906,
13,
9651,
1583,
29889,
29990,
29892,
1583,
29889,
21134,
353,
679,
29918,
16175,
29918,
1272,
29898,
16859,
29889,
24713,
29892,
274,
16434,
29889,
16175,
29918,
2311,
29892,
274,
16434,
29889,
1949,
29918,
28993,
29897,
13,
9651,
1583,
29889,
29979,
353,
15886,
29889,
650,
29918,
8711,
29898,
1311,
29889,
21134,
29892,
10809,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
9685,
29922,
29896,
29892,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
29897,
13,
9651,
396,
365,
1254,
29924,
12662,
2699,
13,
9651,
1583,
29889,
29876,
29918,
2080,
29922,
29946,
29945,
13,
9651,
1583,
29889,
29876,
29918,
24530,
29922,
29946,
29945,
13,
632,
13,
9651,
396,
15886,
12367,
1881,
13,
9651,
1583,
29889,
20155,
29885,
29918,
29916,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
29990,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
29876,
29918,
24530,
29892,
1583,
29889,
29876,
29918,
2080,
876,
13,
9651,
1583,
29889,
20155,
29885,
29918,
29891,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
29979,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
29876,
29918,
13203,
876,
13,
632,
13,
632,
13,
9651,
1583,
29889,
17460,
29918,
2311,
29896,
29922,
29896,
29941,
13,
9651,
1583,
29889,
17460,
29918,
2311,
29906,
29922,
29929,
13,
9651,
1583,
29889,
20580,
29896,
29918,
449,
29874,
29922,
1311,
29889,
29876,
29918,
2080,
29899,
1311,
29889,
17460,
29918,
2311,
29896,
29974,
29896,
13,
9651,
1583,
29889,
20580,
29896,
29918,
449,
29890,
29922,
1311,
29889,
29876,
29918,
24530,
29899,
1311,
29889,
17460,
29918,
2311,
29896,
29974,
29896,
13,
29937,
9651,
1583,
29889,
5030,
29896,
29918,
449,
7607,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29899,
1311,
29889,
17460,
29918,
2311,
29974,
29896,
6802,
29906,
29930,
3552,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29899,
1311,
29889,
17460,
29918,
2311,
29974,
29896,
6802,
29906,
29897,
13,
29937,
9651,
1583,
29889,
5030,
29896,
29918,
449,
29922,
524,
3552,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29899,
1311,
29889,
17460,
29918,
2311,
29906,
29974,
29896,
11877,
29898,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29899,
1311,
29889,
17460,
29918,
2311,
29906,
29974,
29896,
11877,
29941,
29906,
29914,
29946,
29897,
13,
9651,
1583,
29889,
5030,
29896,
29918,
449,
29922,
29945,
29946,
29900,
29947,
13,
9651,
1583,
29889,
29876,
29918,
10892,
29922,
1583,
29889,
20580,
29896,
29918,
449,
29890,
13,
632,
13,
9651,
396,
22402,
18177,
13,
9651,
1583,
29889,
20155,
29885,
29918,
705,
5861,
353,
426,
13,
18884,
525,
449,
2396,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
1311,
29889,
29876,
29918,
10892,
29892,
1583,
29889,
29876,
29918,
13203,
12622,
13,
9651,
500,
13,
9651,
1583,
29889,
20155,
29885,
29918,
5365,
2129,
353,
426,
13,
18884,
525,
449,
2396,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
1311,
29889,
29876,
29918,
13203,
12622,
13,
9651,
500,
13,
13,
9651,
565,
338,
29918,
26495,
29901,
13,
18884,
1583,
29889,
4282,
29918,
1279,
580,
13,
18884,
1583,
29889,
6758,
580,
13,
18884,
1583,
3032,
7727,
580,
13,
18884,
396,
260,
29918,
16908,
353,
15886,
29889,
14968,
519,
29918,
20897,
580,
13,
18884,
1583,
29889,
10945,
29918,
10568,
353,
15886,
29889,
16174,
29898,
29900,
29892,
1024,
2433,
10945,
29918,
10568,
742,
7945,
519,
29922,
8824,
29897,
13,
18884,
1583,
29889,
20640,
3950,
353,
15886,
29889,
14968,
29889,
3253,
314,
20624,
326,
3950,
580,
13,
18884,
1583,
29889,
14968,
29918,
459,
353,
1583,
29889,
20640,
3950,
29889,
1195,
326,
675,
29898,
1311,
29889,
7827,
29918,
6758,
29892,
5534,
29918,
10568,
29922,
1311,
29889,
10945,
29918,
10568,
29897,
29871,
396,
722,
29918,
1761,
29922,
29873,
29918,
16908,
29897,
13,
18884,
1583,
29889,
14968,
29918,
29883,
29896,
353,
1583,
29889,
20640,
3950,
29889,
1195,
326,
675,
29898,
1311,
29889,
20155,
29885,
29918,
18253,
29892,
5534,
29918,
10568,
29922,
1311,
29889,
10945,
29918,
10568,
29897,
13,
18884,
1583,
29889,
14968,
29918,
29883,
29906,
353,
1583,
29889,
20640,
3950,
29889,
1195,
326,
675,
29898,
1311,
29889,
1145,
344,
29918,
24542,
29896,
29918,
18253,
29892,
5534,
29918,
10568,
29922,
1311,
29889,
10945,
29918,
10568,
29897,
13,
18884,
1583,
29889,
14968,
29918,
29883,
29941,
353,
1583,
29889,
20640,
3950,
29889,
1195,
326,
675,
29898,
1311,
29889,
1145,
344,
29918,
29883,
2547,
29896,
29918,
18253,
29892,
5534,
29918,
10568,
29922,
1311,
29889,
10945,
29918,
10568,
29897,
13,
18884,
1596,
877,
355,
7787,
1495,
13,
9651,
1683,
29901,
13,
462,
13,
18884,
1583,
29889,
29990,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1311,
29889,
29876,
29918,
2080,
29892,
1583,
29889,
29876,
29918,
24530,
29892,
29871,
29896,
876,
13,
18884,
1583,
29889,
21134,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
876,
13,
18884,
1583,
29889,
29979,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
21134,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
29876,
29918,
13203,
29892,
29871,
29896,
876,
13,
18884,
1583,
29889,
4282,
29918,
1279,
580,
13,
13,
4706,
15886,
29889,
21027,
29889,
3888,
877,
2697,
292,
701,
278,
1667,
3829,
1495,
13,
268,
13,
268,
13,
268,
13,
1678,
822,
390,
10262,
29898,
1311,
1125,
13,
13,
4706,
396,
349,
3445,
598,
848,
8267,
304,
1993,
421,
29878,
15755,
29952,
740,
11780,
13,
4706,
396,
9626,
848,
1881,
8267,
29901,
313,
16175,
29918,
2311,
29892,
302,
29918,
24530,
29892,
302,
29918,
2080,
29897,
13,
4706,
396,
830,
5958,
8267,
29901,
525,
29876,
29918,
24530,
29915,
25187,
943,
1051,
310,
8267,
313,
16175,
29918,
2311,
29892,
302,
29918,
2080,
29897,
13,
268,
13,
4706,
396,
20894,
17068,
9853,
29918,
2311,
322,
302,
29918,
24530,
13,
4706,
921,
353,
15886,
29889,
3286,
4220,
29898,
1311,
29889,
20155,
29885,
29918,
29916,
29892,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29906,
2314,
13,
308,
13,
4706,
396,
2538,
29882,
21430,
304,
313,
29876,
29918,
24530,
29930,
16175,
29918,
2311,
29892,
302,
29918,
2080,
29897,
13,
4706,
921,
353,
15886,
29889,
690,
14443,
29898,
20158,
29922,
29916,
29892,
8267,
11759,
29899,
29896,
29892,
1583,
29889,
29876,
29918,
2080,
2314,
13,
4706,
396,
26178,
304,
679,
263,
1051,
310,
525,
29876,
29918,
24530,
29915,
25187,
943,
310,
8267,
313,
16175,
29918,
2311,
29892,
302,
29918,
2080,
29897,
13,
4706,
921,
353,
15886,
29889,
5451,
29898,
1767,
29922,
29916,
29892,
954,
29918,
272,
29918,
2311,
29918,
23579,
1169,
29922,
1311,
29889,
29876,
29918,
24530,
29892,
9685,
29922,
29900,
29897,
13,
4706,
396,
22402,
263,
24471,
29885,
3038,
411,
26110,
13,
4706,
396,
20155,
29885,
29918,
3729,
353,
364,
15755,
29918,
3729,
29889,
16616,
29931,
1254,
29924,
4617,
29898,
29876,
29918,
10892,
29892,
9566,
29918,
29890,
3173,
29922,
29896,
29897,
13,
4706,
24471,
29885,
29918,
3729,
353,
364,
15755,
29918,
3729,
29889,
14345,
29965,
4617,
29898,
1311,
29889,
29876,
29918,
10892,
29897,
13,
4706,
396,
20155,
29885,
29918,
3729,
353,
364,
15755,
29918,
3729,
29889,
29931,
1254,
29924,
4617,
29898,
29876,
29918,
10892,
29892,
1509,
29918,
412,
29872,
561,
6544,
29922,
5574,
29897,
13,
4706,
396,
4772,
975,
29888,
5367,
13,
4706,
24471,
29885,
29918,
3729,
353,
364,
15755,
29918,
3729,
29889,
15063,
449,
15646,
29898,
20155,
29885,
29918,
3729,
29892,
1962,
29918,
17462,
29918,
22795,
29922,
29900,
29889,
29945,
29897,
13,
4706,
396,
29871,
29906,
15359,
24471,
29885,
13,
4706,
24471,
29885,
29918,
3729,
353,
364,
15755,
29918,
3729,
29889,
15329,
29934,
10262,
4617,
4197,
20155,
29885,
29918,
3729,
14178,
29906,
29897,
1678,
13,
4706,
396,
3617,
24471,
29885,
3038,
1962,
13,
4706,
14391,
29892,
5922,
353,
364,
15755,
29889,
29878,
15755,
29898,
3729,
29922,
20155,
29885,
29918,
3729,
29892,
10970,
29922,
29916,
29892,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
29897,
13,
4706,
396,
22985,
26229,
29892,
773,
364,
15755,
6426,
2425,
1833,
1962,
13,
4706,
736,
15886,
29889,
2922,
16109,
29898,
4905,
29879,
14352,
29896,
1402,
1583,
29889,
20155,
29885,
29918,
705,
5861,
1839,
449,
11287,
718,
1583,
29889,
20155,
29885,
29918,
5365,
2129,
1839,
449,
7464,
4905,
29879,
14352,
29896,
29962,
13,
13,
13,
1678,
822,
2048,
29918,
1279,
29898,
1311,
1125,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
29931,
1254,
29924,
29918,
13148,
29374,
13,
12,
12,
12,
29937,
11965,
9853,
29930,
29946,
29881,
714,
9853,
29930,
29896,
29906,
29947,
29881,
29871,
13,
9651,
4450,
29892,
449,
353,
1583,
29889,
29934,
10262,
580,
13,
9651,
714,
29922,
13264,
29889,
690,
14443,
29898,
449,
29892,
6278,
29896,
29892,
29896,
29892,
1311,
29889,
29876,
29918,
10892,
29892,
29896,
876,
13,
12,
12,
12,
29937,
3438,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29918,
29894,
29906,
29898,
1188,
1169,
29922,
11965,
29892,
11073,
29922,
29891,
876,
13,
12,
12,
12,
29937,
396,
3253,
314,
5994,
3950,
13,
12,
12,
12,
29937,
5994,
3950,
353,
15886,
29889,
14968,
29889,
3253,
314,
20624,
326,
3950,
29898,
21891,
29918,
10492,
29922,
21891,
29918,
10492,
467,
1195,
326,
675,
29898,
18253,
29897,
13,
12,
12,
12,
29937,
382,
4387,
403,
1904,
13,
12,
12,
12,
29937,
1959,
29918,
11965,
353,
15886,
29889,
11745,
29898,
13264,
29889,
1191,
3317,
29898,
11965,
29892,
29896,
511,
15886,
29889,
1191,
3317,
29898,
29891,
29892,
29896,
876,
13,
12,
12,
12,
29937,
13600,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
4384,
29898,
15728,
29918,
11965,
29892,
15886,
29889,
7411,
29941,
29906,
876,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
1168,
29894,
29896,
29918,
13148,
29374,
13,
9651,
396,
1281,
29894,
29896,
29892,
518,
16175,
29918,
2311,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29945,
29953,
29962,
13,
9651,
7602,
29896,
353,
15886,
29889,
21570,
29889,
29277,
29889,
20580,
29906,
29881,
29898,
1311,
29889,
29990,
29892,
954,
29918,
4905,
29879,
29922,
29906,
29945,
29953,
29892,
13,
462,
462,
632,
8466,
29918,
2311,
29922,
1311,
29889,
17460,
29918,
2311,
29896,
29892,
380,
2426,
29922,
29896,
29892,
13,
462,
462,
632,
7164,
2433,
26707,
1495,
13,
29937,
9651,
1596,
29898,
20580,
29896,
29889,
657,
29918,
12181,
3285,
29961,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
20580,
29896,
29918,
449,
29874,
29892,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29892,
29871,
29906,
29945,
29953,
2314,
13,
9651,
4974,
7602,
29896,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
20580,
29896,
29918,
449,
29874,
29892,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29892,
29871,
29906,
29945,
29953,
29962,
13,
632,
13,
9651,
714,
29922,
13264,
29889,
29873,
488,
29898,
449,
17094,
29896,
29892,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29892,
29896,
29892,
29906,
29945,
29953,
2314,
13,
9651,
1583,
29889,
20580,
29896,
29922,
13264,
29889,
1202,
29898,
20580,
29896,
29892,
449,
29897,
13,
29937,
9651,
714,
29918,
7382,
29922,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29974,
29896,
29892,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29892,
29871,
29906,
29945,
29953,
876,
13,
29937,
9651,
1583,
29889,
1145,
344,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13264,
29889,
690,
14443,
29898,
1311,
29889,
20580,
29896,
22657,
16859,
29889,
16175,
29918,
2311,
6653,
29896,
8243,
10340,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
9651,
396,
30753,
31903,
31092,
232,
180,
133,
13,
9651,
11565,
353,
15886,
29889,
29277,
29889,
3317,
29918,
10109,
292,
29906,
29881,
29898,
2080,
29879,
29922,
1311,
29889,
20580,
29896,
29892,
11565,
29918,
2311,
11759,
29906,
29892,
29871,
29906,
1402,
851,
2247,
29922,
29906,
29897,
13,
9651,
285,
29883,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
10109,
29892,
10340,
29922,
29896,
29900,
29906,
29946,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
9651,
285,
29883,
29906,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13801,
29896,
29892,
10340,
29922,
29945,
29896,
29906,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
9651,
1583,
29889,
1145,
344,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13264,
29889,
690,
14443,
29898,
13801,
29906,
22657,
16859,
29889,
16175,
29918,
2311,
6653,
29896,
8243,
10340,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
26229,
29922,
8516,
29897,
13,
9651,
1583,
29889,
1145,
344,
29896,
29918,
2248,
353,
15886,
29889,
517,
29918,
524,
29941,
29906,
29898,
13264,
29889,
1191,
3317,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29898,
1311,
29889,
1145,
344,
29896,
29892,
9685,
29922,
29896,
511,
9685,
29922,
29896,
876,
13,
632,
13,
632,
13,
13,
4706,
396,
28267,
315,
2547,
2540,
7546,
29892,
736,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29896,
29945,
29906,
29892,
29871,
29947,
29892,
29871,
29896,
29962,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
26666,
29907,
2547,
29918,
13148,
29374,
13,
9651,
7601,
29907,
2547,
353,
315,
2547,
14420,
29898,
1949,
29918,
4905,
29879,
29922,
29941,
29906,
29892,
9649,
29918,
2435,
29922,
29947,
29892,
411,
29918,
14608,
292,
29922,
8824,
29892,
7546,
29918,
1853,
2433,
6007,
29963,
742,
7602,
29896,
29918,
449,
29874,
29922,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29892,
7602,
29896,
29918,
449,
29890,
29922,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29892,
2117,
29896,
29918,
449,
29922,
1311,
29889,
5030,
29896,
29918,
449,
29892,
29876,
29918,
13203,
29922,
1311,
29889,
29876,
29918,
13203,
29897,
13,
9651,
313,
1311,
29889,
29883,
2547,
29896,
29892,
11965,
29897,
353,
7601,
29907,
2547,
29898,
1311,
29889,
20580,
29896,
29892,
8466,
29918,
2311,
29922,
1311,
29889,
17460,
29918,
2311,
29906,
29892,
380,
2426,
29922,
29906,
29897,
13,
9651,
1583,
29889,
20155,
1526,
1127,
29922,
11965,
13,
9651,
4974,
1583,
29889,
29883,
2547,
29896,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
5030,
29896,
29918,
449,
29892,
29871,
29947,
29892,
29871,
29896,
29962,
13,
632,
13,
29937,
9651,
1583,
29889,
1145,
344,
29906,
29922,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13264,
29889,
690,
14443,
29898,
1311,
29889,
29883,
2547,
29896,
22657,
16859,
29889,
16175,
29918,
2311,
6653,
29896,
8243,
10340,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
13,
9651,
11565,
353,
15886,
29889,
29277,
29889,
3317,
29918,
10109,
292,
29906,
29881,
29898,
2080,
29879,
29922,
1311,
29889,
29883,
2547,
29896,
29892,
11565,
29918,
2311,
11759,
29906,
29892,
29871,
29906,
1402,
851,
2247,
29922,
29906,
29897,
13,
9651,
285,
29883,
29896,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
10109,
29892,
10340,
29922,
29896,
29900,
29906,
29946,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
9651,
285,
29883,
29906,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13801,
29896,
29892,
10340,
29922,
29945,
29896,
29906,
29892,
26229,
29922,
13264,
29889,
15755,
29889,
2674,
29884,
29897,
13,
9651,
1583,
29889,
1145,
344,
29906,
353,
15886,
29889,
29277,
29889,
1145,
344,
29898,
2080,
29879,
29922,
13264,
29889,
690,
14443,
29898,
13801,
29906,
22657,
16859,
29889,
16175,
29918,
2311,
6653,
29896,
8243,
10340,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
26229,
29922,
8516,
29897,
13,
9651,
1583,
29889,
1145,
344,
29906,
29918,
2248,
353,
15886,
29889,
517,
29918,
524,
29941,
29906,
29898,
13264,
29889,
1191,
3317,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29898,
1311,
29889,
1145,
344,
29906,
29892,
9685,
29922,
29896,
511,
9685,
29922,
29896,
876,
13,
13,
13,
13,
4706,
396,
10951,
277,
29907,
2547,
7546,
29892,
736,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29962,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
14991,
277,
29907,
2547,
29918,
13148,
29374,
13,
9651,
13615,
29907,
2547,
353,
315,
2547,
14420,
29898,
1949,
29918,
4905,
29879,
29922,
1311,
29889,
29876,
29918,
13203,
29892,
9649,
29918,
2435,
29922,
29947,
29892,
411,
29918,
14608,
292,
29922,
5574,
29892,
7546,
29918,
1853,
2433,
8610,
742,
20580,
29896,
29918,
449,
29874,
29922,
1311,
29889,
20580,
29896,
29918,
449,
29874,
29892,
7602,
29896,
29918,
449,
29890,
29922,
1311,
29889,
20580,
29896,
29918,
449,
29890,
29892,
2117,
29896,
29918,
449,
29922,
1311,
29889,
5030,
29896,
29918,
449,
29892,
29876,
29918,
13203,
29922,
1311,
29889,
29876,
29918,
13203,
29897,
13,
9651,
1583,
29889,
29883,
2547,
29906,
353,
13615,
29907,
2547,
29898,
1311,
29889,
29883,
2547,
29896,
29897,
13,
29937,
9651,
1583,
29889,
29883,
2547,
29906,
353,
15886,
29889,
1202,
29898,
13264,
29889,
29873,
488,
29898,
13264,
29889,
690,
14443,
29898,
1311,
29889,
20155,
1526,
1127,
22657,
16859,
29889,
16175,
29918,
2311,
29892,
1311,
29889,
29876,
29918,
13203,
29892,
29896,
29892,
29896,
8243,
29961,
29896,
29892,
29896,
29892,
29896,
29953,
29892,
29896,
11724,
1311,
29889,
29883,
2547,
29906,
29897,
13,
13,
308,
13,
308,
13,
4706,
396,
3826,
6119,
3829,
297,
5104,
29889,
29871,
29906,
13,
4706,
396,
29871,
29896,
29889,
1938,
11105,
292,
29892,
920,
29901,
13,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
19832,
292,
29374,
13,
9651,
396,
263,
467,
22235,
3830,
29894,
29918,
29883,
8876,
29892,
769,
437,
4964,
3317,
29898,
8876,
29894,
29918,
29883,
8876,
29897,
13,
9651,
396,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29962,
1149,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
9651,
1583,
29889,
29894,
29918,
2848,
353,
15886,
29889,
3676,
29898,
13264,
29889,
17469,
29918,
2083,
29898,
13264,
29889,
17619,
29898,
1311,
29889,
29883,
2547,
29906,
511,
13,
462,
462,
462,
29871,
9685,
29922,
29906,
29892,
3013,
6229,
29879,
29922,
5574,
876,
13,
9651,
1583,
29889,
2695,
3317,
29918,
29894,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29898,
1311,
29889,
29894,
29918,
2848,
29892,
9685,
29922,
29896,
29897,
13,
9651,
4974,
1583,
29889,
2695,
3317,
29918,
29894,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
29876,
29918,
13203,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
13,
9651,
396,
289,
467,
5839,
714,
278,
2380,
310,
4236,
4964,
3317,
659,
310,
278,
29871,
29896,
29900,
26091,
13,
9651,
396,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
1149,
518,
16175,
29918,
2311,
29962,
313,
2248,
29897,
13,
9651,
1583,
29889,
1191,
3317,
29918,
13140,
353,
15886,
29889,
517,
29918,
524,
29941,
29906,
29898,
13264,
29889,
1191,
3317,
29898,
1311,
29889,
2695,
3317,
29918,
29894,
29892,
9685,
29922,
29896,
876,
13,
9651,
4974,
1583,
29889,
1191,
3317,
29918,
13140,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
9651,
1583,
29889,
1191,
3317,
29918,
13140,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
1191,
3317,
29918,
13140,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
876,
13,
632,
13,
29937,
9651,
1583,
29889,
3317,
29918,
2248,
29918,
1761,
29922,
15886,
29889,
16174,
29898,
13264,
29889,
2873,
4197,
16859,
29889,
16175,
29918,
2311,
29892,
21251,
29881,
1853,
29922,
13264,
29889,
524,
29941,
29906,
876,
13,
29937,
9651,
2380,
29918,
1761,
29922,
13264,
29889,
1429,
4197,
1311,
29889,
1145,
344,
29896,
29918,
2248,
29892,
1311,
29889,
1145,
344,
29906,
29918,
2248,
29892,
1311,
29889,
1191,
3317,
29918,
13140,
1402,
29896,
29897,
13,
29937,
308,
13,
29937,
9651,
363,
474,
297,
3464,
29898,
16859,
29889,
16175,
29918,
2311,
1125,
13,
29937,
18884,
4236,
29918,
2248,
29922,
13264,
29889,
517,
29918,
524,
29941,
29906,
29898,
13264,
29889,
1191,
3317,
29898,
13264,
29889,
2109,
2798,
29898,
2248,
29918,
1761,
29961,
29875,
29962,
4961,
13,
29937,
18884,
1583,
29889,
5504,
29918,
459,
29922,
13264,
29889,
16645,
29898,
1311,
29889,
3317,
29918,
2248,
29918,
1761,
29961,
29875,
1402,
3317,
29918,
2248,
29897,
13,
13,
13,
13,
29937,
9651,
396,
8108,
29871,
29896,
29889,
13,
29937,
9651,
565,
451,
274,
16434,
29889,
13168,
29918,
2541,
29918,
29891,
29901,
13,
29937,
18884,
396,
274,
467,
26190,
13,
29937,
18884,
396,
739,
29915,
29879,
451,
4780,
304,
2274,
278,
26190,
1889,
411,
1852,
3317,
29918,
13140,
13,
29937,
18884,
396,
408,
591,
526,
29871,
29941,
29899,
6229,
13019,
13,
29937,
18884,
11105,
287,
29918,
29894,
353,
5159,
13,
29937,
18884,
363,
9853,
29918,
2311,
297,
3464,
29898,
16859,
29889,
16175,
29918,
2311,
1125,
13,
29937,
462,
1678,
325,
353,
1583,
29889,
29883,
2547,
29906,
29961,
16175,
29918,
2311,
3816,
1311,
29889,
1191,
3317,
29918,
13140,
29961,
16175,
29918,
2311,
1402,
584,
29962,
13,
29937,
462,
1678,
11105,
287,
29918,
29894,
29889,
4397,
29898,
13264,
29889,
690,
14443,
29898,
29894,
29892,
8267,
7607,
29896,
29892,
29871,
29896,
29892,
29871,
29947,
29892,
29871,
29896,
4961,
13,
29937,
13,
29937,
18884,
1583,
29889,
13168,
287,
29918,
29894,
353,
15886,
29889,
17685,
29898,
13168,
287,
29918,
29894,
29892,
9685,
29922,
29900,
29897,
13,
29937,
18884,
4974,
1583,
29889,
13168,
287,
29918,
29894,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
29896,
29892,
29871,
29947,
29892,
29871,
29896,
29962,
13,
29937,
9651,
396,
8108,
29871,
29906,
29889,
11105,
292,
411,
1565,
3858,
29892,
2322,
4464,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
396,
1583,
29889,
13168,
287,
29918,
29894,
353,
15886,
29889,
2922,
16109,
29898,
13264,
29889,
29879,
802,
29872,
911,
29898,
1311,
29889,
29883,
2547,
29906,
511,
15886,
29889,
690,
14443,
29898,
1311,
29889,
29979,
29892,
8521,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
8243,
1301,
4220,
29918,
29874,
29922,
5574,
29897,
13,
29937,
18884,
1583,
29889,
13168,
287,
29918,
29894,
353,
15886,
29889,
18056,
368,
29898,
13264,
29889,
29879,
802,
29872,
911,
29898,
1311,
29889,
29883,
2547,
29906,
511,
15886,
29889,
690,
14443,
29898,
1311,
29889,
29979,
29892,
8521,
29896,
29892,
1583,
29889,
29876,
29918,
13203,
29892,
29871,
29896,
4961,
13,
29937,
18884,
1583,
29889,
29894,
29918,
2848,
353,
15886,
29889,
3676,
29898,
13264,
29889,
17469,
29918,
2083,
29898,
13264,
29889,
17619,
29898,
1311,
29889,
29883,
2547,
29906,
511,
9685,
29922,
29906,
29892,
3013,
6229,
29879,
29922,
5574,
29897,
718,
321,
3232,
29897,
13,
29937,
13,
29937,
4706,
396,
29871,
29906,
29889,
830,
11433,
29872,
278,
341,
29940,
9047,
4558,
411,
29871,
29941,
7992,
15359,
13,
29937,
4706,
396,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29962,
1149,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29953,
29962,
1149,
518,
16175,
29918,
2311,
29892,
29871,
29945,
29896,
29906,
29962,
13,
29937,
4706,
411,
15886,
29889,
11918,
29918,
6078,
877,
6185,
6119,
29374,
13,
29937,
9651,
4608,
29918,
29926,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
13168,
287,
29918,
29894,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
448,
29896,
876,
13,
29937,
9651,
285,
29883,
29896,
353,
15886,
29889,
21570,
29889,
29277,
29889,
3730,
29918,
18045,
29898,
8111,
29918,
29926,
29892,
954,
29918,
4905,
29879,
29922,
29945,
29896,
29906,
29897,
13,
29937,
9651,
4974,
285,
29883,
29896,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
29945,
29896,
29906,
29962,
13,
29937,
9651,
285,
29883,
29906,
353,
15886,
29889,
21570,
29889,
29277,
29889,
3730,
29918,
18045,
29898,
13801,
29896,
29892,
954,
29918,
4905,
29879,
29922,
29896,
29900,
29906,
29946,
29897,
13,
29937,
9651,
4974,
285,
29883,
29906,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29906,
29946,
29962,
13,
29937,
9651,
1583,
29889,
7099,
6797,
353,
15886,
29889,
21570,
29889,
29277,
29889,
3730,
29918,
18045,
29898,
13801,
29906,
29892,
954,
29918,
4905,
29879,
29922,
1311,
29889,
29876,
29918,
24530,
29930,
1311,
29889,
29876,
29918,
2080,
29892,
26229,
29918,
9144,
29922,
13264,
29889,
18816,
29885,
3398,
29897,
13,
13,
13,
13,
13,
13,
1678,
822,
6410,
29898,
1311,
1125,
13,
4706,
396,
29871,
29896,
29889,
450,
5906,
6410,
13,
13,
4706,
396,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
4706,
396,
4236,
29918,
29880,
353,
4236,
29898,
29900,
29892,
286,
29918,
11242,
29899,
8876,
29894,
29918,
29883,
8876,
4887,
29906,
13,
4706,
4236,
29918,
29880,
353,
15886,
29889,
17619,
29898,
13264,
29889,
27525,
398,
29898,
29900,
1696,
274,
16434,
29889,
29885,
29918,
11242,
448,
1583,
29889,
29894,
29918,
2848,
876,
13,
4706,
396,
4236,
29918,
29878,
353,
4236,
29898,
29900,
29892,
3830,
29894,
29918,
29883,
8876,
29899,
29885,
29918,
12254,
4887,
29906,
13,
4706,
4236,
29918,
29878,
353,
15886,
29889,
17619,
29898,
13264,
29889,
27525,
398,
29898,
29900,
1696,
1583,
29889,
29894,
29918,
2848,
448,
274,
16434,
29889,
29885,
29918,
12254,
876,
13,
4706,
4974,
4236,
29918,
29880,
29889,
657,
29918,
12181,
580,
1275,
518,
16859,
29889,
16175,
29918,
2311,
29892,
1311,
29889,
29876,
29918,
13203,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
13,
4706,
396,
620,
14443,
29901,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
1149,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29962,
13,
4706,
4236,
29918,
29880,
353,
15886,
29889,
690,
14443,
29898,
3317,
29918,
29880,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
448,
29896,
876,
13,
4706,
4236,
29918,
29878,
353,
15886,
29889,
690,
14443,
29898,
3317,
29918,
29878,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
448,
29896,
876,
13,
13,
4706,
396,
22235,
323,
29918,
29883,
29901,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
29962,
13,
4706,
396,
323,
29918,
29883,
353,
612,
29892,
338,
590,
8004,
1959,
29973,
3967,
372,
29889,
13,
4706,
323,
29918,
29883,
353,
1583,
29889,
29979,
13,
4706,
396,
518,
16175,
29918,
2311,
29892,
29871,
29896,
29900,
1402,
1543,
29899,
3538,
22932,
13,
4706,
365,
29918,
29883,
353,
323,
29918,
29883,
334,
4236,
29918,
29880,
718,
274,
16434,
29889,
2892,
29918,
791,
334,
313,
29896,
448,
323,
29918,
29883,
29897,
334,
4236,
29918,
29878,
13,
13,
4706,
1583,
29889,
9264,
29918,
6758,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
17469,
29918,
2083,
29898,
29931,
29918,
29883,
29892,
9685,
29922,
29896,
876,
13,
13,
29937,
4706,
396,
29871,
29906,
29889,
450,
17789,
4080,
6410,
13,
29937,
4706,
1638,
262,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
29990,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
448,
29896,
876,
13,
29937,
4706,
10674,
1965,
353,
15886,
29889,
17619,
29898,
1311,
29889,
7099,
6797,
448,
1638,
262,
29897,
13,
29937,
4706,
1583,
29889,
276,
3075,
4080,
29918,
3127,
353,
15886,
29889,
17469,
29918,
12676,
29898,
26613,
1965,
29897,
13,
29937,
4706,
24471,
29885,
6410,
13,
4706,
1583,
29889,
20155,
29885,
29918,
18253,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29918,
29894,
29906,
29898,
1188,
1169,
29922,
1311,
29889,
20155,
1526,
1127,
29892,
11073,
29922,
1311,
29889,
20155,
29885,
29918,
29891,
876,
13,
4706,
1583,
29889,
20155,
29885,
29918,
2248,
353,
15886,
29889,
517,
29918,
524,
29941,
29906,
29898,
13264,
29889,
1191,
3317,
29898,
1311,
29889,
20155,
1526,
1127,
29892,
9685,
29922,
29896,
876,
13,
13,
4706,
1583,
29889,
1145,
344,
29918,
24542,
29896,
29918,
18253,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29918,
29894,
29906,
29898,
1188,
1169,
29922,
1311,
29889,
1145,
344,
29896,
29892,
11073,
29922,
1311,
29889,
20155,
29885,
29918,
29891,
876,
13,
4706,
1583,
29889,
1145,
344,
29918,
29883,
2547,
29896,
29918,
18253,
29922,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29918,
29894,
29906,
29898,
1188,
1169,
29922,
1311,
29889,
1145,
344,
29906,
29892,
11073,
29922,
1311,
29889,
20155,
29885,
29918,
29891,
876,
13,
308,
13,
308,
13,
308,
13,
4706,
396,
29871,
29941,
29889,
14990,
6410,
13,
4706,
396,
450,
5650,
3913,
2533,
310,
10674,
1965,
1059,
408,
17789,
4080,
1059,
29892,
541,
591,
13,
4706,
396,
505,
1304,
10032,
29918,
12676,
297,
15913,
29871,
29906,
450,
17789,
4080,
6410,
29952,
304,
8147,
13,
4706,
396,
2099,
10674,
1965,
1059,
29889,
512,
1797,
304,
3013,
297,
1196,
411,
278,
5650,
29892,
1552,
13,
4706,
396,
4943,
2133,
6287,
881,
367,
29871,
29900,
29889,
29900,
29900,
29900,
29945,
29930,
29955,
29947,
29946,
29922,
29900,
29889,
29941,
29929,
29906,
13,
29937,
4706,
1583,
29889,
7827,
29918,
6758,
353,
1583,
29889,
9264,
29918,
6758,
718,
274,
16434,
29889,
15227,
2133,
29918,
7052,
334,
1583,
29889,
276,
3075,
4080,
29918,
3127,
29974,
20155,
29885,
29918,
18253,
13,
29937,
4706,
1583,
29889,
7827,
29918,
6758,
353,
1583,
29889,
9264,
29918,
6758,
29974,
1311,
29889,
20155,
29885,
29918,
18253,
13,
4706,
1583,
29889,
7827,
29918,
6758,
353,
1583,
29889,
9264,
29918,
6758,
29974,
1311,
29889,
20155,
29885,
29918,
18253,
29974,
1311,
29889,
1145,
344,
29918,
24542,
29896,
29918,
18253,
29974,
1311,
29889,
1145,
344,
29918,
29883,
2547,
29896,
29918,
18253,
13,
13,
13,
1678,
396,
6991,
5219,
13,
1678,
822,
903,
7727,
29898,
1311,
1125,
13,
4706,
7945,
29918,
7727,
353,
5159,
13,
4706,
7945,
29918,
7727,
29889,
4397,
29898,
13264,
29889,
7727,
29889,
19529,
279,
877,
14968,
29914,
9264,
29918,
6758,
742,
1583,
29889,
9264,
29918,
6758,
876,
13,
29937,
4706,
7945,
29918,
7727,
29889,
4397,
29898,
13264,
29889,
7727,
29889,
19529,
279,
877,
14968,
29914,
276,
3075,
4080,
29918,
6758,
742,
1583,
29889,
276,
3075,
4080,
29918,
3127,
876,
13,
4706,
7945,
29918,
7727,
29889,
4397,
29898,
13264,
29889,
7727,
29889,
19529,
279,
877,
14968,
29914,
7827,
29918,
6758,
742,
1583,
29889,
7827,
29918,
6758,
876,
13,
29937,
4706,
7945,
29918,
7727,
29889,
4397,
29898,
13264,
29889,
7727,
29889,
19529,
279,
877,
14968,
29914,
9600,
29918,
6758,
742,
1583,
29889,
9600,
29918,
6758,
29918,
459,
876,
13,
29937,
4706,
8265,
29918,
2492,
353,
15886,
29889,
690,
14443,
29898,
1311,
29889,
7099,
6797,
29892,
8267,
7607,
16859,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
29876,
29918,
2080,
29892,
1311,
29889,
29876,
29918,
24530,
29892,
29871,
29896,
876,
13,
29937,
4706,
7945,
29918,
7727,
29889,
4397,
29898,
13264,
29889,
7727,
29889,
3027,
877,
276,
3075,
4080,
29918,
2492,
742,
8265,
29918,
2492,
876,
13,
4706,
1583,
29889,
14968,
29918,
7727,
353,
15886,
29889,
7727,
29889,
14634,
29898,
14968,
29918,
7727,
29897,
13,
29937,
4706,
1959,
29918,
11965,
2463,
353,
15886,
29889,
11745,
29898,
13264,
29889,
517,
29918,
524,
29941,
29906,
29898,
1311,
29889,
21134,
511,
1583,
29889,
3317,
29918,
2248,
29918,
1761,
29897,
13,
29937,
4706,
1583,
29889,
562,
2764,
4135,
353,
15886,
29889,
17469,
29918,
2083,
29898,
13264,
29889,
4384,
29898,
15728,
29918,
11965,
2463,
29892,
15886,
29889,
7411,
29941,
29906,
876,
13,
13,
13,
13,
13,
13,
13,
2
] |
vocoder/hifigan/env.py | 10088/MockingBird | 1 | 46337 | import os
import shutil
def build_env(config, config_name, path):
t_path = os.path.join(path, config_name)
if config != t_path:
os.makedirs(path, exist_ok=True)
shutil.copyfile(config, os.path.join(path, config_name))
| [
1,
1053,
2897,
13,
5215,
528,
4422,
13,
13,
1753,
2048,
29918,
6272,
29898,
2917,
29892,
2295,
29918,
978,
29892,
2224,
1125,
13,
1678,
260,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
2295,
29918,
978,
29897,
13,
1678,
565,
2295,
2804,
260,
29918,
2084,
29901,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
2084,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
4706,
528,
4422,
29889,
8552,
1445,
29898,
2917,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
2295,
29918,
978,
876,
13,
2
] |
python/deploy-cpu-alarms.py | earthlab/aws-ops | 1 | 37053 | # Deploy idle CPU alarms to stop EC2 instances
import boto3
account_id = boto3.client("sts").get_caller_identity().get("Account")
region = boto3.session.Session().region_name
client = boto3.client("cloudwatch")
ec = boto3.client("ec2")
reservations = ec.describe_instances()
exceptions = ["prf-"]
for r in reservations["Reservations"]:
for i in r["Instances"]:
instance_id = i["InstanceId"]
for t in i["Tags"]:
if t["Key"] == "Name":
iname = t["Value"]
name_excepted = any([e in iname for e in exceptions])
if name_excepted:
continue
else:
alarm_name = "CPU Alarm " + iname + instance_id
alarm = client.put_metric_alarm(
AlarmName=alarm_name,
MetricName="CPUUtilization",
Namespace="AWS/EC2",
Statistic="Maximum",
ComparisonOperator="LessThanOrEqualToThreshold",
Threshold=1.0,
Period=60 * 60, # in seconds
EvaluationPeriods=2,
Dimensions=[{"Name": "InstanceId", "Value": instance_id}],
Unit="Percent",
ActionsEnabled=True,
AlarmActions=[
":".join(
[
"arn:aws:swf",
region,
account_id,
"action/actions/AWS_EC2.InstanceId.Stop/1.0",
]
)
],
)
| [
1,
396,
10034,
2376,
28132,
10808,
394,
279,
1516,
304,
5040,
17522,
29906,
8871,
13,
5215,
289,
3747,
29941,
13,
13,
10149,
29918,
333,
353,
289,
3747,
29941,
29889,
4645,
703,
303,
29879,
2564,
657,
29918,
4804,
261,
29918,
22350,
2141,
657,
703,
10601,
1159,
13,
12803,
353,
289,
3747,
29941,
29889,
7924,
29889,
7317,
2141,
12803,
29918,
978,
13,
4645,
353,
289,
3747,
29941,
29889,
4645,
703,
9274,
12344,
1159,
13,
687,
353,
289,
3747,
29941,
29889,
4645,
703,
687,
29906,
1159,
13,
690,
6972,
800,
353,
21226,
29889,
2783,
29581,
29918,
2611,
2925,
580,
13,
13,
11739,
29879,
353,
6796,
558,
29888,
29899,
3108,
13,
13,
1454,
364,
297,
620,
6972,
800,
3366,
1666,
6972,
800,
3108,
29901,
13,
1678,
363,
474,
297,
364,
3366,
3379,
2925,
3108,
29901,
13,
4706,
2777,
29918,
333,
353,
474,
3366,
4998,
1204,
3108,
13,
4706,
363,
260,
297,
474,
3366,
28089,
3108,
29901,
13,
9651,
565,
260,
3366,
2558,
3108,
1275,
376,
1170,
1115,
13,
18884,
297,
420,
353,
260,
3366,
1917,
3108,
13,
18884,
1024,
29918,
19499,
287,
353,
738,
4197,
29872,
297,
297,
420,
363,
321,
297,
15283,
2314,
13,
18884,
565,
1024,
29918,
19499,
287,
29901,
13,
462,
1678,
6773,
13,
18884,
1683,
29901,
13,
462,
1678,
21200,
29918,
978,
353,
376,
6271,
29965,
838,
2817,
376,
718,
297,
420,
718,
2777,
29918,
333,
13,
462,
1678,
21200,
353,
3132,
29889,
649,
29918,
16414,
29918,
284,
2817,
29898,
13,
462,
4706,
838,
2817,
1170,
29922,
284,
2817,
29918,
978,
29892,
13,
462,
4706,
4737,
2200,
1170,
543,
6271,
29965,
7270,
2133,
613,
13,
462,
4706,
14706,
3535,
543,
29909,
7811,
29914,
11206,
29906,
613,
13,
462,
4706,
6666,
4695,
543,
7976,
12539,
613,
13,
462,
4706,
422,
20941,
26486,
543,
29931,
404,
1349,
273,
2816,
9843,
1762,
1349,
12268,
613,
13,
462,
4706,
498,
12268,
29922,
29896,
29889,
29900,
29892,
13,
462,
4706,
29498,
29922,
29953,
29900,
334,
29871,
29953,
29900,
29892,
29871,
396,
297,
6923,
13,
462,
4706,
382,
4387,
362,
29853,
29879,
29922,
29906,
29892,
13,
462,
4706,
4792,
5580,
11759,
6377,
1170,
1115,
376,
4998,
1204,
613,
376,
1917,
1115,
2777,
29918,
333,
29913,
1402,
13,
462,
4706,
13223,
543,
27933,
613,
13,
462,
4706,
319,
1953,
10861,
29922,
5574,
29892,
13,
462,
4706,
838,
2817,
26525,
11759,
13,
462,
9651,
29242,
1642,
7122,
29898,
13,
462,
18884,
518,
13,
462,
462,
1678,
376,
2753,
29901,
10467,
29901,
2774,
29888,
613,
13,
462,
462,
1678,
5120,
29892,
13,
462,
462,
1678,
3633,
29918,
333,
29892,
13,
462,
462,
1678,
376,
2467,
29914,
7387,
29914,
29909,
7811,
29918,
11206,
29906,
29889,
4998,
1204,
29889,
16329,
29914,
29896,
29889,
29900,
613,
13,
462,
18884,
4514,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
1723,
13,
2
] |
wirepas_backend_client/tools/utils.py | bencorrado/backend-client | 0 | 20802 | <gh_stars>0
"""
Utils
=======
Contains multipurpose utilities for serializing objects and obtaining
arguments from the command line.
.. Copyright:
Copyright 2019 Wirepas Ltd under Apache License, Version 2.0.
See file LICENSE for full license details.
"""
import binascii
import datetime
import json
import threading
from google.protobuf import json_format
def deferred_thread(fn):
"""
Decorator to handle a request on its own Thread
to avoid blocking the calling Thread on I/O.
It creates a new Thread but it shouldn't impact the performances
as requests are not supposed to be really frequent (few per seconds)
"""
def wrapper(*args, **kwargs):
thread = threading.Thread(target=fn, args=args, kwargs=kwargs)
thread.start()
return thread
return wrapper
class JsonSerializer(json.JSONEncoder):
"""
JsonSerializer
Extends the JSONEncoder base class with object handlers
for bytearrya, datetime and proto.
"""
proto_as_json = False
sort_keys = True
indent = 4
def __init__(self, proto_as_json: bool = False, **kwargs):
super(JsonSerializer, self).__init__(**kwargs)
self.proto_as_json = proto_as_json
if "indent" in kwargs:
self.indent = kwargs["indent"]
if "sort_keys" in kwargs:
self.sort_keys = kwargs["sort_keys"]
def default(self, obj) -> str:
"""
Lookup table for serializing objects
Pylint complains about the method signature, but this is the
recommended way of implementing a custom JSON serialization as
seen in:
https://docs.python.org/3/library/json.html#json.JSONEncoder
"""
# pylint: disable=locally-disabled, method-hidden, arguments-differ
if isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, (bytearray, bytes)):
return binascii.hexlify(obj)
if isinstance(obj, set):
return str(obj)
if hasattr(obj, "DESCRIPTOR"):
if self.proto_as_json is True:
pstr = json_format.MessageToJson(
obj, including_default_value_fields=True
)
else:
pstr = json_format.MessageToDict(
obj, including_default_value_fields=True
)
return pstr
return json.JSONEncoder.default(self, obj)
def serialize(self, obj, flatten=False):
""" returns a json representation of the object """
if flatten:
temp = dict()
for key, value in sorted(obj.items()):
if isinstance(value, dict):
for child_key, child_value in value.items():
temp[f"{key}.{child_key}"] = child_value
obj = temp
jobj = json.dumps(
obj,
cls=JsonSerializer,
sort_keys=self.sort_keys,
indent=self.indent,
)
return jobj
def flatten(input_dict, separator="/", prefix=""):
"""
Flattens a dictionary with nested dictionaries and lists
into a single dictionary.
The key compression is done using the chosen separator.
"""
output_dict = {}
def step(member, parent_key=""):
if isinstance(member, dict):
for key, value in member.items():
step(
value,
f"{parent_key}{separator}{key}"
if parent_key
else str(key),
)
elif isinstance(member, list):
for index, sublist in enumerate(member, start=0):
step(
sublist,
f"{parent_key}{separator}{index}"
if parent_key
else str(index),
)
else:
output_dict[f"{parent_key}"] = member
step(input_dict)
return output_dict
class Signal:
"""Wrapper around and exit signal"""
def __init__(self, signal=None):
super(Signal, self).__init__()
if signal is None:
signal = False
self.signal = signal
def is_set(self) -> bool:
""" Returns the state of the inner event or boolean """
try:
ret = self.signal.is_set()
except AttributeError:
ret = self.signal
return ret
def set(self) -> bool:
""" Sets the event or inner boolean """
try:
ret = self.signal.set()
except AttributeError:
self.signal = True
ret = True
return ret
def chunker(seq, size) -> list():
"""
Splits a sequence in multiple parts
Args:
seq ([]) : an array
size (int) : length of each array part
Returns:
array ([]) : a chunk of SEQ with given SIZE
"""
return (seq[pos : pos + size] for pos in range(0, len(seq), size))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
1678,
22310,
29879,
13,
1678,
1275,
2751,
29922,
13,
13,
1678,
2866,
2708,
6674,
332,
4220,
3667,
1907,
363,
7797,
5281,
3618,
322,
4017,
292,
13,
1678,
6273,
515,
278,
1899,
1196,
29889,
13,
13,
1678,
6317,
14187,
1266,
29901,
13,
4706,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
399,
533,
18182,
19806,
1090,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
29889,
13,
4706,
2823,
934,
365,
2965,
1430,
1660,
363,
2989,
19405,
4902,
29889,
13,
15945,
29908,
13,
13,
5215,
9016,
294,
18869,
13,
5215,
12865,
13,
5215,
4390,
13,
5215,
3244,
292,
13,
13,
3166,
5386,
29889,
17529,
9721,
1053,
4390,
29918,
4830,
13,
13,
13,
1753,
316,
14373,
29918,
7097,
29898,
9144,
1125,
13,
1678,
9995,
13,
1678,
3826,
272,
1061,
304,
4386,
263,
2009,
373,
967,
1914,
10480,
13,
1678,
304,
4772,
23473,
278,
5432,
10480,
373,
306,
29914,
29949,
29889,
13,
1678,
739,
10017,
263,
716,
10480,
541,
372,
9273,
29915,
29873,
10879,
278,
21637,
13,
1678,
408,
7274,
526,
451,
7424,
304,
367,
2289,
17091,
313,
29888,
809,
639,
6923,
29897,
13,
1678,
9995,
13,
13,
1678,
822,
14476,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
3244,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
9144,
29892,
6389,
29922,
5085,
29892,
9049,
5085,
29922,
19290,
29897,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
736,
3244,
13,
13,
1678,
736,
14476,
13,
13,
13,
1990,
14355,
17679,
29898,
3126,
29889,
7249,
8566,
6119,
1125,
13,
1678,
9995,
13,
1678,
14355,
17679,
13,
13,
1678,
7338,
1975,
278,
4663,
8566,
6119,
2967,
770,
411,
1203,
25795,
13,
1678,
363,
7023,
279,
719,
29874,
29892,
12865,
322,
17814,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
17814,
29918,
294,
29918,
3126,
353,
7700,
13,
1678,
2656,
29918,
8149,
353,
5852,
13,
1678,
29536,
353,
29871,
29946,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
17814,
29918,
294,
29918,
3126,
29901,
6120,
353,
7700,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
8148,
17679,
29892,
1583,
467,
1649,
2344,
12035,
1068,
19290,
29897,
13,
4706,
1583,
29889,
17529,
29918,
294,
29918,
3126,
353,
17814,
29918,
294,
29918,
3126,
13,
13,
4706,
565,
376,
12860,
29908,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
12860,
353,
9049,
5085,
3366,
12860,
3108,
13,
13,
4706,
565,
376,
6605,
29918,
8149,
29908,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
6605,
29918,
8149,
353,
9049,
5085,
3366,
6605,
29918,
8149,
3108,
13,
13,
1678,
822,
2322,
29898,
1311,
29892,
5446,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
7419,
786,
1591,
363,
7797,
5281,
3618,
13,
13,
4706,
349,
2904,
524,
15313,
1144,
1048,
278,
1158,
12608,
29892,
541,
445,
338,
278,
13,
4706,
13622,
982,
310,
16049,
263,
2888,
4663,
7797,
2133,
408,
13,
4706,
3595,
297,
29901,
13,
13,
4706,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29941,
29914,
5258,
29914,
3126,
29889,
1420,
29937,
3126,
29889,
7249,
8566,
6119,
13,
13,
4706,
9995,
13,
4706,
396,
282,
2904,
524,
29901,
11262,
29922,
2029,
635,
29899,
18279,
29892,
1158,
29899,
10892,
29892,
6273,
29899,
29881,
8349,
13,
13,
4706,
565,
338,
8758,
29898,
5415,
29892,
313,
12673,
29889,
12673,
29892,
12865,
29889,
1256,
22164,
13,
9651,
736,
5446,
29889,
10718,
4830,
580,
13,
13,
4706,
565,
338,
8758,
29898,
5415,
29892,
313,
10389,
2378,
29892,
6262,
22164,
13,
9651,
736,
9016,
294,
18869,
29889,
354,
15524,
1598,
29898,
5415,
29897,
13,
13,
4706,
565,
338,
8758,
29898,
5415,
29892,
731,
1125,
13,
9651,
736,
851,
29898,
5415,
29897,
13,
13,
4706,
565,
756,
5552,
29898,
5415,
29892,
376,
2287,
7187,
24290,
1955,
29908,
1125,
13,
13,
9651,
565,
1583,
29889,
17529,
29918,
294,
29918,
3126,
338,
5852,
29901,
13,
18884,
282,
710,
353,
4390,
29918,
4830,
29889,
3728,
1762,
8148,
29898,
13,
462,
1678,
5446,
29892,
3704,
29918,
4381,
29918,
1767,
29918,
9621,
29922,
5574,
13,
18884,
1723,
13,
9651,
1683,
29901,
13,
18884,
282,
710,
353,
4390,
29918,
4830,
29889,
3728,
1762,
21533,
29898,
13,
462,
1678,
5446,
29892,
3704,
29918,
4381,
29918,
1767,
29918,
9621,
29922,
5574,
13,
18884,
1723,
13,
9651,
736,
282,
710,
13,
13,
4706,
736,
4390,
29889,
7249,
8566,
6119,
29889,
4381,
29898,
1311,
29892,
5446,
29897,
13,
13,
1678,
822,
28755,
29898,
1311,
29892,
5446,
29892,
1652,
8606,
29922,
8824,
1125,
13,
4706,
9995,
3639,
263,
4390,
8954,
310,
278,
1203,
9995,
13,
13,
4706,
565,
1652,
8606,
29901,
13,
9651,
5694,
353,
9657,
580,
13,
9651,
363,
1820,
29892,
995,
297,
12705,
29898,
5415,
29889,
7076,
580,
1125,
13,
18884,
565,
338,
8758,
29898,
1767,
29892,
9657,
1125,
13,
462,
1678,
363,
2278,
29918,
1989,
29892,
2278,
29918,
1767,
297,
995,
29889,
7076,
7295,
13,
462,
4706,
5694,
29961,
29888,
29908,
29912,
1989,
1836,
29912,
5145,
29918,
1989,
29913,
3108,
353,
2278,
29918,
1767,
13,
9651,
5446,
353,
5694,
13,
13,
4706,
4982,
29926,
353,
4390,
29889,
29881,
17204,
29898,
13,
9651,
5446,
29892,
13,
9651,
1067,
29879,
29922,
8148,
17679,
29892,
13,
9651,
2656,
29918,
8149,
29922,
1311,
29889,
6605,
29918,
8149,
29892,
13,
9651,
29536,
29922,
1311,
29889,
12860,
29892,
13,
4706,
1723,
13,
13,
4706,
736,
4982,
29926,
13,
13,
13,
1753,
1652,
8606,
29898,
2080,
29918,
8977,
29892,
28128,
13802,
613,
10944,
13776,
1125,
13,
1678,
9995,
13,
1678,
2379,
1131,
575,
263,
8600,
411,
9322,
21503,
4314,
322,
8857,
13,
1678,
964,
263,
2323,
8600,
29889,
13,
13,
1678,
450,
1820,
24221,
338,
2309,
773,
278,
10434,
28128,
29889,
13,
1678,
9995,
13,
1678,
1962,
29918,
8977,
353,
6571,
13,
13,
1678,
822,
4331,
29898,
14242,
29892,
3847,
29918,
1989,
13776,
1125,
13,
4706,
565,
338,
8758,
29898,
14242,
29892,
9657,
1125,
13,
9651,
363,
1820,
29892,
995,
297,
4509,
29889,
7076,
7295,
13,
18884,
4331,
29898,
13,
462,
1678,
995,
29892,
13,
462,
1678,
285,
29908,
29912,
3560,
29918,
1989,
1157,
344,
17954,
1157,
1989,
5038,
13,
462,
1678,
565,
3847,
29918,
1989,
13,
462,
1678,
1683,
851,
29898,
1989,
511,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
14242,
29892,
1051,
1125,
13,
9651,
363,
2380,
29892,
1014,
1761,
297,
26985,
29898,
14242,
29892,
1369,
29922,
29900,
1125,
13,
18884,
4331,
29898,
13,
462,
1678,
1014,
1761,
29892,
13,
462,
1678,
285,
29908,
29912,
3560,
29918,
1989,
1157,
344,
17954,
1157,
2248,
5038,
13,
462,
1678,
565,
3847,
29918,
1989,
13,
462,
1678,
1683,
851,
29898,
2248,
511,
13,
18884,
1723,
13,
4706,
1683,
29901,
13,
9651,
1962,
29918,
8977,
29961,
29888,
29908,
29912,
3560,
29918,
1989,
29913,
3108,
353,
4509,
13,
13,
1678,
4331,
29898,
2080,
29918,
8977,
29897,
13,
13,
1678,
736,
1962,
29918,
8977,
13,
13,
13,
1990,
9954,
284,
29901,
13,
1678,
9995,
15646,
2820,
322,
6876,
7182,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7182,
29922,
8516,
1125,
13,
4706,
2428,
29898,
10140,
284,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
565,
7182,
338,
6213,
29901,
13,
9651,
7182,
353,
7700,
13,
13,
4706,
1583,
29889,
25436,
353,
7182,
13,
13,
1678,
822,
338,
29918,
842,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
9995,
16969,
278,
2106,
310,
278,
6426,
1741,
470,
7223,
9995,
13,
4706,
1018,
29901,
13,
9651,
3240,
353,
1583,
29889,
25436,
29889,
275,
29918,
842,
580,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
3240,
353,
1583,
29889,
25436,
13,
13,
4706,
736,
3240,
13,
13,
1678,
822,
731,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
9995,
317,
1691,
278,
1741,
470,
6426,
7223,
9995,
13,
4706,
1018,
29901,
13,
9651,
3240,
353,
1583,
29889,
25436,
29889,
842,
580,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
1583,
29889,
25436,
353,
5852,
13,
9651,
3240,
353,
5852,
13,
13,
4706,
736,
3240,
13,
13,
13,
1753,
19875,
261,
29898,
11762,
29892,
2159,
29897,
1599,
1051,
7295,
13,
1678,
9995,
13,
4706,
317,
572,
1169,
263,
5665,
297,
2999,
5633,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
19359,
9310,
2314,
584,
385,
1409,
13,
9651,
2159,
313,
524,
29897,
584,
3309,
310,
1269,
1409,
760,
13,
13,
4706,
16969,
29901,
13,
9651,
1409,
9310,
2314,
584,
263,
19875,
310,
3725,
29984,
411,
2183,
22717,
10721,
13,
1678,
9995,
13,
1678,
736,
313,
11762,
29961,
1066,
584,
926,
718,
2159,
29962,
363,
926,
297,
3464,
29898,
29900,
29892,
7431,
29898,
11762,
511,
2159,
876,
13,
2
] |
mooda/util/iplot/iplot_timeseries.py | rbardaji/mooda | 15 | 1606456 | <reponame>rbardaji/mooda
""" Implementation of WaterFrame.iplot_timeseries() """
import numpy as np
import plotly.graph_objects as go
def iplot_timeseries(list_wf, parameter_to_plot):
"""
It creates a Plotly figure with the time-series of the input parameter.
Parameters
----------
list_wf: List of WaterFrames
List of WaterFrames to be concatenated.
parameter_to_plot: str
Parameters to plot.
Returns
-------
figure: dict
Plotly figure dictionary
"""
data = []
for wf in list_wf:
# Extract data
df = wf.data[parameter_to_plot].dropna().reset_index()
df = df.groupby(['DEPTH', 'TIME'])[parameter_to_plot].mean()
df = df.reset_index()
df.set_index('TIME', inplace=True)
# df.renane(columns={parameter_to_plot: wf.metadata.get('platform_code')}, inplace=True)
data.append(
go.Scatter(x=df.index, y=df[parameter_to_plot],
# fill="tozeroy",
name=wf.metadata.get('platform_code')))
# Layout
y_label = None
try:
title = list_wf[0].vocabulary[parameter_to_plot]['long_name']
except KeyError:
title = parameter_to_plot
try:
y_label = list_wf[0].vocabulary[parameter_to_plot]['units']
except KeyError:
pass
min_value = np.nanmin(list_wf[-1].data[parameter_to_plot])
max_value = np.nanmax(list_wf[0].data[parameter_to_plot])
layout = {
'title': title,
'yaxis': {
# 'range': [min_value, max_value],
'title': y_label
},
'margin': {'l': 50, 'r': 10, 't': 45, 'b': 30}
}
figure = {"data": data, "layout": layout}
return figure
| [
1,
529,
276,
1112,
420,
29958,
6050,
538,
1175,
29875,
29914,
29885,
2092,
29874,
13,
15945,
29908,
1954,
14607,
310,
13062,
4308,
29889,
29875,
5317,
29918,
3706,
6358,
580,
9995,
13,
5215,
12655,
408,
7442,
13,
5215,
6492,
368,
29889,
4262,
29918,
12650,
408,
748,
13,
13,
13,
1753,
474,
5317,
29918,
3706,
6358,
29898,
1761,
29918,
29893,
29888,
29892,
3443,
29918,
517,
29918,
5317,
1125,
13,
1678,
9995,
13,
1678,
739,
10017,
263,
18399,
368,
4377,
411,
278,
931,
29899,
13757,
310,
278,
1881,
3443,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
4706,
1051,
29918,
29893,
29888,
29901,
2391,
310,
13062,
14438,
1280,
13,
9651,
2391,
310,
13062,
14438,
1280,
304,
367,
16125,
630,
29889,
13,
4706,
3443,
29918,
517,
29918,
5317,
29901,
851,
13,
9651,
12662,
2699,
304,
6492,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
4706,
4377,
29901,
9657,
13,
9651,
18399,
368,
4377,
8600,
13,
1678,
9995,
13,
1678,
848,
353,
5159,
13,
1678,
363,
281,
29888,
297,
1051,
29918,
29893,
29888,
29901,
13,
4706,
396,
7338,
1461,
848,
13,
4706,
4489,
353,
281,
29888,
29889,
1272,
29961,
15501,
29918,
517,
29918,
5317,
1822,
8865,
1056,
2141,
12071,
29918,
2248,
580,
13,
4706,
4489,
353,
4489,
29889,
27789,
18959,
2287,
29925,
4690,
742,
525,
15307,
2033,
9601,
15501,
29918,
517,
29918,
5317,
1822,
12676,
580,
13,
4706,
4489,
353,
4489,
29889,
12071,
29918,
2248,
580,
13,
4706,
4489,
29889,
842,
29918,
2248,
877,
15307,
742,
297,
6689,
29922,
5574,
29897,
13,
4706,
396,
4489,
29889,
1267,
1662,
29898,
13099,
3790,
15501,
29918,
517,
29918,
5317,
29901,
281,
29888,
29889,
19635,
29889,
657,
877,
12120,
29918,
401,
1495,
1118,
297,
6689,
29922,
5574,
29897,
13,
13,
4706,
848,
29889,
4397,
29898,
13,
9651,
748,
29889,
4421,
2620,
29898,
29916,
29922,
2176,
29889,
2248,
29892,
343,
29922,
2176,
29961,
15501,
29918,
517,
29918,
5317,
1402,
13,
462,
539,
396,
5445,
543,
517,
9171,
29891,
613,
13,
462,
539,
1024,
29922,
29893,
29888,
29889,
19635,
29889,
657,
877,
12120,
29918,
401,
29915,
4961,
13,
13,
1678,
396,
20259,
13,
1678,
343,
29918,
1643,
353,
6213,
13,
13,
1678,
1018,
29901,
13,
4706,
3611,
353,
1051,
29918,
29893,
29888,
29961,
29900,
1822,
29894,
542,
370,
352,
653,
29961,
15501,
29918,
517,
29918,
5317,
22322,
5426,
29918,
978,
2033,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
3611,
353,
3443,
29918,
517,
29918,
5317,
13,
1678,
1018,
29901,
13,
4706,
343,
29918,
1643,
353,
1051,
29918,
29893,
29888,
29961,
29900,
1822,
29894,
542,
370,
352,
653,
29961,
15501,
29918,
517,
29918,
5317,
22322,
348,
1169,
2033,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
1209,
13,
13,
1678,
1375,
29918,
1767,
353,
7442,
29889,
13707,
1195,
29898,
1761,
29918,
29893,
29888,
14352,
29896,
1822,
1272,
29961,
15501,
29918,
517,
29918,
5317,
2314,
13,
1678,
4236,
29918,
1767,
353,
7442,
29889,
13707,
3317,
29898,
1761,
29918,
29893,
29888,
29961,
29900,
1822,
1272,
29961,
15501,
29918,
517,
29918,
5317,
2314,
13,
13,
1678,
5912,
353,
426,
13,
4706,
525,
3257,
2396,
3611,
29892,
13,
4706,
525,
29891,
8990,
2396,
426,
13,
9651,
396,
525,
3881,
2396,
518,
1195,
29918,
1767,
29892,
4236,
29918,
1767,
1402,
13,
9651,
525,
3257,
2396,
343,
29918,
1643,
13,
4706,
2981,
13,
4706,
525,
9264,
2396,
11117,
29880,
2396,
29871,
29945,
29900,
29892,
525,
29878,
2396,
29871,
29896,
29900,
29892,
525,
29873,
2396,
29871,
29946,
29945,
29892,
525,
29890,
2396,
29871,
29941,
29900,
29913,
13,
1678,
500,
13,
13,
1678,
4377,
353,
8853,
1272,
1115,
848,
29892,
376,
2680,
1115,
5912,
29913,
13,
13,
1678,
736,
4377,
13,
2
] |
IGTI - Bootcamp Desenvolvedor Python/04/cap4/pygame/Cap2 - desenhando/desenhando_retangulo.py | ruginski/DS | 43 | 89395 | import pygame
from pygame.locals import *
from sys import exit
from random import *
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
screen.lock()
for count in range(10):
random_color = (randint(0,255), randint(0,255), randint(0,255))
random_pos = (randint(0,639), randint(0,479))
random_size = (639-randint(random_pos[0],639), 479-randint(random_pos[1],479))
pygame.draw.rect(screen, random_color, Rect(random_pos, random_size))
screen.unlock()
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
exit()
| [
1,
1053,
22028,
13,
3166,
22028,
29889,
2997,
29879,
1053,
334,
13,
3166,
10876,
1053,
6876,
29871,
13,
13,
3166,
4036,
1053,
334,
13,
13,
2272,
11802,
29889,
2344,
580,
13,
10525,
353,
22028,
29889,
4990,
29889,
842,
29918,
8513,
3552,
29953,
29946,
29900,
29892,
29871,
29946,
29947,
29900,
511,
29871,
29900,
29892,
29871,
29941,
29906,
29897,
13,
13,
10525,
29889,
908,
580,
13,
1454,
2302,
297,
3464,
29898,
29896,
29900,
1125,
13,
1678,
4036,
29918,
2780,
353,
313,
9502,
524,
29898,
29900,
29892,
29906,
29945,
29945,
511,
20088,
524,
29898,
29900,
29892,
29906,
29945,
29945,
511,
20088,
524,
29898,
29900,
29892,
29906,
29945,
29945,
876,
13,
1678,
4036,
29918,
1066,
353,
313,
9502,
524,
29898,
29900,
29892,
29953,
29941,
29929,
511,
20088,
524,
29898,
29900,
29892,
29946,
29955,
29929,
876,
13,
1678,
4036,
29918,
2311,
353,
313,
29953,
29941,
29929,
29899,
9502,
524,
29898,
8172,
29918,
1066,
29961,
29900,
1402,
29953,
29941,
29929,
511,
29871,
29946,
29955,
29929,
29899,
9502,
524,
29898,
8172,
29918,
1066,
29961,
29896,
1402,
29946,
29955,
29929,
876,
13,
1678,
22028,
29889,
4012,
29889,
1621,
29898,
10525,
29892,
4036,
29918,
2780,
29892,
22914,
29898,
8172,
29918,
1066,
29892,
4036,
29918,
2311,
876,
13,
13,
10525,
29889,
348,
908,
580,
13,
13,
2272,
11802,
29889,
4990,
29889,
5504,
580,
13,
13,
8000,
5852,
29901,
13,
1678,
363,
1741,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
4706,
565,
1741,
29889,
1853,
1275,
660,
29965,
1806,
29901,
13,
9651,
22028,
29889,
28358,
580,
13,
9651,
6876,
580,
13,
2
] |
Simulator/tournament.py | apayne19/DoubleAuctionMarket | 30 | 126936 | <reponame>apayne19/DoubleAuctionMarket<gh_stars>10-100
from Trader.trader import Trader_Shaver, Trader_ZIU, Trader_ZIC, Trader_Kaplan, Trader_PS, Trader_AA, Trader_GD, Trader_ZIP
import Institution.double_auction_institution as ins
import random
class Tournament(object):
""" A class that makes a trader"""
def __init__(self, name, iterations, auction):
self.name = name
self.iterations = iterations
self.traders = []
self.auction = auction
def show(self):
print ("I am tournament {}.".format(self.name))
def prepare_traders(self, tn, mkt, limits):
d = {}
t = {}
if len(tn) != mkt.num_buyers + mkt.num_sellers:
print ("tn = {} does not have the right length".format(tn))
for k in range(mkt.num_buyers + mkt.num_sellers):
t_id = "t" + str(k) # make trader id
t[t_id] = globals()[tn[k]]() # create object
t[t_id].name = t_id # set objects name
t[t_id].da = ins.Auction("da", limits[0], limits[1])
d[t_id] = {}
d[t_id]['units'] = 0 # keep track of units used
d[t_id]['earn'] = 0 # keep track of earnings
d[t_id]['strat'] = tn[k] # traders strategy
if k < mkt.num_buyers:
t[t_id].type = "buyer" # set objects type
t[t_id].values = mkt.get_buyer_values(k) # set objects values
d[t_id]['type'] = "B" # traders type
d[t_id]['values'] = mkt.get_buyer_values(k) # trader's values
else: # note seller index is trader_index - num_buyers
t[t_id].type = "seller" # set objects type
t[t_id].costs = mkt.get_seller_costs(k - mkt.num_buyers) # set objects values
d[t_id]['type'] = "S" # traders type
d[t_id]['costs'] = mkt.get_seller_costs(k - mkt.num_buyers) # trader's values
d["strategies"] = [k for k in set(tn)]
# get market efficiency
eqv = mkt.get_equilibrium() # (Price low, Price High Quantity, Maximum Surplus)
ep_low = eqv[0]
ep_high = eqv[1]
e_quantity = eqv[2]
maximum_surplus = eqv[3]
d["equilibrium"] = (ep_low, ep_high, e_quantity, maximum_surplus)
traders = [t[t_id] for t_id in t.keys()]
self.traders = [t[t_id] for t_id in t.keys()]
return d
def run(self, display):
self.auction.open_board("tournament official")
if display:
print()
print("Auction Open")
print(self.auction.report_standing(), self.auction.report_contracts())
length_old_contracts = 0
for i in range(self.iterations):
random.shuffle(self.traders)
for trader in self.traders:
trader.offer()
contracts = self.auction.report_contracts()
if len(contracts) > length_old_contracts:
length_old_contracts = len(contracts)
if display:
print (i, contracts[len(contracts) - 1])
if display:
print()
def eval(self, display, d, result_header):
# calculate market efficiency
ep_low = d['equilibrium'][0]
ep_high = d['equilibrium'][1]
e_quantity = d['equilibrium'][2]
maximum_surplus = d['equilibrium'][3]
for trader in self.traders:
trader_id = trader.name
d[trader_id]['units'] = 0
d[trader_id]['earn'] = 0
# calculate actual surplus and earnings
actual_surplus = 0
for contract in self.auction.report_contracts():
price = contract[0]
buyer_id = contract[1]
seller_id = contract[2]
if d[buyer_id]['type'] == 'B':
value = d[buyer_id]['values'][d[buyer_id]['units']]
d[buyer_id]['earn'] += value - price
d[buyer_id]['units'] += 1
else:
print ("error, buyer id = {}, buyer type = {}".format(buyer_id, d[buyer_id]['type']))
if d[seller_id]['type'] == 'S':
cost = d[seller_id]['costs'][d[seller_id]['units']]
d[seller_id]['earn'] += price - cost
d[seller_id]['units'] += 1
else:
print ("error in contract {}, seller id = {}, seller type = {}".format(contract, seller_id,
d[seller_id]['type']))
actual_surplus += value - cost
efficiency = int((actual_surplus / maximum_surplus) * 100)
result_header.extend([ep_low, ep_high, e_quantity, maximum_surplus, actual_surplus, efficiency])
if display:
print ("actual surplus = {}, maximum surplus = {}.".format(actual_surplus, maximum_surplus))
print ("market efficiency = {} percent.".format(efficiency))
for k in range(len(self.traders)):
t_id = "t" + str(k)
t_strat = d[t_id]['strat']
earn = d[t_id]['earn']
if display:
print ("Trader {}, using strategy {}, earned {}.".format(t_id, t_strat, earn))
result_header.extend([t_id, t_strat, earn])
if display:
print()
for k in d['strategies']:
strat_earn = 0
count = 0
for l in range(len(self.traders)):
t_id = "t" + str(l)
if k == d[t_id]['strat']:
count = count + 1
strat_earn += d[t_id]['earn']
if count > 0:
avg_earn = int(strat_earn / count)
result_header.extend([k, avg_earn])
if display:
print ("Strategy {} earned an average of {}.".format(k, avg_earn))
return result_header
def save_results(self, result_header, output_file):
# write tournamnet results as .csv file
output_file = open(output_file + '.csv', 'w', newline='')
output_writer = csv.writer(output_file)
# First write out result header record
output_writer.writerow(result_header)
# Second write out offers information
orders = self.auction.report_orders()
output_writer.writerow(["orders", "time, id, type, amt/null", len(orders)])
for element in orders:
s = []
s.append(element[0])
s.append(element[1])
s.append(element[2])
s.append(element[3])
output_writer.writerow(s)
# Third write out contract information
contracts = self.auction.report_contracts()
output_writer.writerow(["contracts", "price, buyer_id, seller_id", len(contracts)])
for element in contracts:
s = []
s.append(element[0])
s.append(element[1])
s.append(element[2])
output_writer.writerow(s)
output_file.close()
def sim(self, display, num_trials, d):
# initialize sum variables
total_earnings = [0] * len(d['strategies'])
sum_squared = [0] * len(d['strategies'])
for k in range(num_trials):
result = []
self.run(display)
# TODO Put input and output files back in for blanks
result_header = [" ", " ", len(self.traders)]
result_header = self.eval(display, d, result_header)
# result header = [input_file, output_file, num_traders, ep_low, ep_high, e_quantity,
# max_surplus, actual_surplus, efficiency,
# ** for all numtraders** trader id, trader strategy, trader earnings]
# print(result_header)
result.append(result_header[8])
j = 9 + int(result_header[2]) * 3 # move to where strategy results are
for k in d['strategies']:
result.append(result_header[j + 1])
j = j + 2
if display:
print("for run {} result {}".format(k, result))
for j in range(len(d['strategies'])):
earn = result[j + 1]
total_earnings[j] += earn
sum_squared[j] += earn * earn
avg_earning = []
var = []
sdev = []
for j in range(len(d['strategies'])):
avg_earn = total_earnings[j] / num_trials
variance = ((sum_squared[j] / num_trials) - (avg_earn * avg_earn))
standard_deviation = variance ** 0.5
avg_earning.append(avg_earn)
var.append(variance)
sdev.append(standard_deviation)
print ()
print ("Average Earnings for {} rounds".format(num_trials))
print (d['strategies'])
print(avg_earning)
print(sdev)
if __name__ == "__main__":
trn = Tournament ("Tournamnet Name", 10, "placeholder for double auction") | [
1,
529,
276,
1112,
420,
29958,
481,
388,
484,
29896,
29929,
29914,
11843,
29909,
29884,
428,
9802,
300,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
3166,
1605,
1664,
29889,
509,
1664,
1053,
1605,
1664,
29918,
29903,
2350,
369,
29892,
1605,
1664,
29918,
29999,
29902,
29965,
29892,
1605,
1664,
29918,
29999,
2965,
29892,
1605,
1664,
29918,
29968,
481,
6468,
29892,
1605,
1664,
29918,
7024,
29892,
1605,
1664,
29918,
6344,
29892,
1605,
1664,
29918,
29954,
29928,
29892,
1605,
1664,
29918,
29999,
5690,
13,
5215,
28218,
29889,
8896,
29918,
585,
428,
29918,
2611,
5008,
408,
1663,
13,
5215,
4036,
13,
13,
1990,
29427,
29898,
3318,
1125,
13,
1678,
9995,
319,
770,
393,
3732,
263,
534,
1664,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
24372,
29892,
782,
428,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
1524,
800,
353,
24372,
13,
4706,
1583,
29889,
509,
24574,
353,
5159,
13,
4706,
1583,
29889,
585,
428,
353,
782,
428,
13,
13,
1678,
822,
1510,
29898,
1311,
1125,
13,
4706,
1596,
4852,
29902,
626,
14743,
6571,
1213,
29889,
4830,
29898,
1311,
29889,
978,
876,
13,
13,
1678,
822,
19012,
29918,
509,
24574,
29898,
1311,
29892,
260,
29876,
29892,
286,
1193,
29892,
13071,
1125,
13,
4706,
270,
353,
6571,
13,
4706,
260,
353,
6571,
13,
4706,
565,
7431,
29898,
6277,
29897,
2804,
286,
1193,
29889,
1949,
29918,
2423,
29891,
414,
718,
286,
1193,
29889,
1949,
29918,
29879,
28257,
29901,
13,
9651,
1596,
4852,
6277,
353,
6571,
947,
451,
505,
278,
1492,
3309,
1642,
4830,
29898,
6277,
876,
13,
4706,
363,
413,
297,
3464,
29898,
29885,
1193,
29889,
1949,
29918,
2423,
29891,
414,
718,
286,
1193,
29889,
1949,
29918,
29879,
28257,
1125,
13,
9651,
260,
29918,
333,
353,
376,
29873,
29908,
718,
851,
29898,
29895,
29897,
29871,
396,
1207,
534,
1664,
1178,
13,
9651,
260,
29961,
29873,
29918,
333,
29962,
353,
13149,
1338,
580,
29961,
6277,
29961,
29895,
5262,
580,
29871,
396,
1653,
1203,
13,
9651,
260,
29961,
29873,
29918,
333,
1822,
978,
353,
260,
29918,
333,
29871,
396,
731,
3618,
1024,
13,
9651,
260,
29961,
29873,
29918,
333,
1822,
1388,
353,
1663,
29889,
29909,
29884,
428,
703,
1388,
613,
13071,
29961,
29900,
1402,
13071,
29961,
29896,
2314,
13,
9651,
270,
29961,
29873,
29918,
333,
29962,
353,
6571,
13,
9651,
270,
29961,
29873,
29918,
333,
22322,
348,
1169,
2033,
353,
29871,
29900,
29871,
396,
3013,
5702,
310,
10340,
1304,
13,
9651,
270,
29961,
29873,
29918,
333,
22322,
799,
29876,
2033,
353,
29871,
29900,
29871,
396,
3013,
5702,
310,
2326,
11753,
13,
9651,
270,
29961,
29873,
29918,
333,
22322,
710,
271,
2033,
353,
260,
29876,
29961,
29895,
29962,
29871,
396,
3534,
414,
13705,
13,
13,
9651,
565,
413,
529,
286,
1193,
29889,
1949,
29918,
2423,
29891,
414,
29901,
13,
18884,
260,
29961,
29873,
29918,
333,
1822,
1853,
353,
376,
2423,
7598,
29908,
29871,
396,
731,
3618,
1134,
13,
18884,
260,
29961,
29873,
29918,
333,
1822,
5975,
353,
286,
1193,
29889,
657,
29918,
2423,
7598,
29918,
5975,
29898,
29895,
29897,
29871,
396,
731,
3618,
1819,
13,
18884,
270,
29961,
29873,
29918,
333,
22322,
1853,
2033,
353,
376,
29933,
29908,
29871,
396,
3534,
414,
1134,
13,
18884,
270,
29961,
29873,
29918,
333,
22322,
5975,
2033,
353,
286,
1193,
29889,
657,
29918,
2423,
7598,
29918,
5975,
29898,
29895,
29897,
29871,
396,
534,
1664,
29915,
29879,
1819,
13,
9651,
1683,
29901,
29871,
396,
4443,
269,
4539,
2380,
338,
534,
1664,
29918,
2248,
448,
954,
29918,
2423,
29891,
414,
13,
18884,
260,
29961,
29873,
29918,
333,
1822,
1853,
353,
376,
29879,
4539,
29908,
29871,
396,
731,
3618,
1134,
13,
18884,
260,
29961,
29873,
29918,
333,
1822,
18253,
29879,
353,
286,
1193,
29889,
657,
29918,
29879,
4539,
29918,
18253,
29879,
29898,
29895,
448,
286,
1193,
29889,
1949,
29918,
2423,
29891,
414,
29897,
29871,
396,
731,
3618,
1819,
13,
18884,
270,
29961,
29873,
29918,
333,
22322,
1853,
2033,
353,
376,
29903,
29908,
29871,
396,
3534,
414,
1134,
13,
18884,
270,
29961,
29873,
29918,
333,
22322,
18253,
29879,
2033,
353,
286,
1193,
29889,
657,
29918,
29879,
4539,
29918,
18253,
29879,
29898,
29895,
448,
286,
1193,
29889,
1949,
29918,
2423,
29891,
414,
29897,
29871,
396,
534,
1664,
29915,
29879,
1819,
13,
13,
4706,
270,
3366,
710,
1845,
583,
3108,
353,
518,
29895,
363,
413,
297,
731,
29898,
6277,
4638,
13,
4706,
396,
679,
9999,
19201,
13,
4706,
11594,
29894,
353,
286,
1193,
29889,
657,
29918,
1686,
15943,
16241,
580,
29871,
396,
313,
13026,
4482,
29892,
20743,
5057,
22746,
537,
29892,
5918,
12539,
6298,
11242,
29897,
13,
4706,
9358,
29918,
677,
353,
11594,
29894,
29961,
29900,
29962,
13,
4706,
9358,
29918,
9812,
353,
11594,
29894,
29961,
29896,
29962,
13,
4706,
321,
29918,
22640,
353,
11594,
29894,
29961,
29906,
29962,
13,
4706,
7472,
29918,
7610,
11242,
353,
11594,
29894,
29961,
29941,
29962,
13,
4706,
270,
3366,
1686,
15943,
16241,
3108,
353,
313,
1022,
29918,
677,
29892,
9358,
29918,
9812,
29892,
321,
29918,
22640,
29892,
7472,
29918,
7610,
11242,
29897,
13,
4706,
3534,
414,
353,
518,
29873,
29961,
29873,
29918,
333,
29962,
363,
260,
29918,
333,
297,
260,
29889,
8149,
580,
29962,
13,
4706,
1583,
29889,
509,
24574,
353,
518,
29873,
29961,
29873,
29918,
333,
29962,
363,
260,
29918,
333,
297,
260,
29889,
8149,
580,
29962,
13,
4706,
736,
270,
13,
13,
1678,
822,
1065,
29898,
1311,
29892,
2479,
1125,
13,
4706,
1583,
29889,
585,
428,
29889,
3150,
29918,
3377,
703,
29873,
2905,
1166,
6221,
1159,
13,
4706,
565,
2479,
29901,
13,
9651,
1596,
580,
13,
9651,
1596,
703,
29909,
29884,
428,
4673,
1159,
13,
9651,
1596,
29898,
1311,
29889,
585,
428,
29889,
12276,
29918,
11235,
3285,
1583,
29889,
585,
428,
29889,
12276,
29918,
1285,
1461,
29879,
3101,
13,
4706,
3309,
29918,
1025,
29918,
1285,
1461,
29879,
353,
29871,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
1311,
29889,
1524,
800,
1125,
13,
9651,
4036,
29889,
845,
21897,
29898,
1311,
29889,
509,
24574,
29897,
13,
9651,
363,
534,
1664,
297,
1583,
29889,
509,
24574,
29901,
13,
18884,
534,
1664,
29889,
974,
571,
580,
13,
18884,
8078,
29879,
353,
1583,
29889,
585,
428,
29889,
12276,
29918,
1285,
1461,
29879,
580,
13,
18884,
565,
7431,
29898,
1285,
1461,
29879,
29897,
1405,
3309,
29918,
1025,
29918,
1285,
1461,
29879,
29901,
13,
462,
1678,
3309,
29918,
1025,
29918,
1285,
1461,
29879,
353,
7431,
29898,
1285,
1461,
29879,
29897,
13,
462,
1678,
565,
2479,
29901,
13,
462,
4706,
1596,
313,
29875,
29892,
8078,
29879,
29961,
2435,
29898,
1285,
1461,
29879,
29897,
448,
29871,
29896,
2314,
13,
4706,
565,
2479,
29901,
13,
9651,
1596,
580,
13,
13,
1678,
822,
19745,
29898,
1311,
29892,
2479,
29892,
270,
29892,
1121,
29918,
6672,
1125,
13,
4706,
396,
8147,
9999,
19201,
13,
4706,
9358,
29918,
677,
353,
270,
1839,
1686,
15943,
16241,
2033,
29961,
29900,
29962,
13,
4706,
9358,
29918,
9812,
353,
270,
1839,
1686,
15943,
16241,
2033,
29961,
29896,
29962,
13,
4706,
321,
29918,
22640,
353,
270,
1839,
1686,
15943,
16241,
2033,
29961,
29906,
29962,
13,
4706,
7472,
29918,
7610,
11242,
353,
270,
1839,
1686,
15943,
16241,
2033,
29961,
29941,
29962,
13,
13,
4706,
363,
534,
1664,
297,
1583,
29889,
509,
24574,
29901,
13,
9651,
534,
1664,
29918,
333,
353,
534,
1664,
29889,
978,
13,
9651,
270,
29961,
509,
1664,
29918,
333,
22322,
348,
1169,
2033,
353,
29871,
29900,
13,
9651,
270,
29961,
509,
1664,
29918,
333,
22322,
799,
29876,
2033,
353,
29871,
29900,
13,
13,
9651,
396,
8147,
3935,
1190,
11242,
322,
2326,
11753,
13,
13,
4706,
3935,
29918,
7610,
11242,
353,
29871,
29900,
13,
4706,
363,
8078,
297,
1583,
29889,
585,
428,
29889,
12276,
29918,
1285,
1461,
29879,
7295,
13,
9651,
8666,
353,
8078,
29961,
29900,
29962,
13,
9651,
1321,
7598,
29918,
333,
353,
8078,
29961,
29896,
29962,
13,
9651,
269,
4539,
29918,
333,
353,
8078,
29961,
29906,
29962,
13,
9651,
565,
270,
29961,
2423,
7598,
29918,
333,
22322,
1853,
2033,
1275,
525,
29933,
2396,
13,
18884,
995,
353,
270,
29961,
2423,
7598,
29918,
333,
22322,
5975,
2033,
29961,
29881,
29961,
2423,
7598,
29918,
333,
22322,
348,
1169,
2033,
29962,
13,
18884,
270,
29961,
2423,
7598,
29918,
333,
22322,
799,
29876,
2033,
4619,
995,
448,
8666,
13,
18884,
270,
29961,
2423,
7598,
29918,
333,
22322,
348,
1169,
2033,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
1596,
4852,
2704,
29892,
1321,
7598,
1178,
353,
24335,
1321,
7598,
1134,
353,
6571,
1642,
4830,
29898,
2423,
7598,
29918,
333,
29892,
270,
29961,
2423,
7598,
29918,
333,
22322,
1853,
25901,
13,
9651,
565,
270,
29961,
29879,
4539,
29918,
333,
22322,
1853,
2033,
1275,
525,
29903,
2396,
13,
18884,
3438,
353,
270,
29961,
29879,
4539,
29918,
333,
22322,
18253,
29879,
2033,
29961,
29881,
29961,
29879,
4539,
29918,
333,
22322,
348,
1169,
2033,
29962,
13,
18884,
270,
29961,
29879,
4539,
29918,
333,
22322,
799,
29876,
2033,
4619,
8666,
448,
3438,
13,
18884,
270,
29961,
29879,
4539,
29918,
333,
22322,
348,
1169,
2033,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
1596,
4852,
2704,
297,
8078,
24335,
269,
4539,
1178,
353,
24335,
269,
4539,
1134,
353,
6571,
1642,
4830,
29898,
1285,
1461,
29892,
269,
4539,
29918,
333,
29892,
13,
462,
462,
462,
462,
462,
539,
270,
29961,
29879,
4539,
29918,
333,
22322,
1853,
25901,
13,
9651,
3935,
29918,
7610,
11242,
4619,
995,
448,
3438,
13,
13,
4706,
19201,
353,
938,
3552,
19304,
29918,
7610,
11242,
847,
7472,
29918,
7610,
11242,
29897,
334,
29871,
29896,
29900,
29900,
29897,
13,
13,
4706,
1121,
29918,
6672,
29889,
21843,
4197,
1022,
29918,
677,
29892,
9358,
29918,
9812,
29892,
321,
29918,
22640,
29892,
7472,
29918,
7610,
11242,
29892,
3935,
29918,
7610,
11242,
29892,
19201,
2314,
13,
4706,
565,
2479,
29901,
13,
9651,
1596,
4852,
19304,
1190,
11242,
353,
24335,
7472,
1190,
11242,
353,
6571,
1213,
29889,
4830,
29898,
19304,
29918,
7610,
11242,
29892,
7472,
29918,
7610,
11242,
876,
13,
9651,
1596,
4852,
28549,
19201,
353,
6571,
10151,
1213,
29889,
4830,
29898,
29872,
2416,
13396,
876,
13,
13,
4706,
363,
413,
297,
3464,
29898,
2435,
29898,
1311,
29889,
509,
24574,
22164,
13,
9651,
260,
29918,
333,
353,
376,
29873,
29908,
718,
851,
29898,
29895,
29897,
13,
9651,
260,
29918,
710,
271,
353,
270,
29961,
29873,
29918,
333,
22322,
710,
271,
2033,
13,
9651,
2326,
29876,
353,
270,
29961,
29873,
29918,
333,
22322,
799,
29876,
2033,
13,
9651,
565,
2479,
29901,
13,
18884,
1596,
4852,
2308,
1664,
24335,
773,
13705,
24335,
20591,
6571,
1213,
29889,
4830,
29898,
29873,
29918,
333,
29892,
260,
29918,
710,
271,
29892,
2326,
29876,
876,
13,
9651,
1121,
29918,
6672,
29889,
21843,
4197,
29873,
29918,
333,
29892,
260,
29918,
710,
271,
29892,
2326,
29876,
2314,
13,
4706,
565,
2479,
29901,
13,
9651,
1596,
580,
13,
13,
4706,
363,
413,
297,
270,
1839,
710,
1845,
583,
2033,
29901,
13,
9651,
26742,
29918,
799,
29876,
353,
29871,
29900,
13,
9651,
2302,
353,
29871,
29900,
13,
9651,
363,
301,
297,
3464,
29898,
2435,
29898,
1311,
29889,
509,
24574,
22164,
13,
18884,
260,
29918,
333,
353,
376,
29873,
29908,
718,
851,
29898,
29880,
29897,
13,
18884,
565,
413,
1275,
270,
29961,
29873,
29918,
333,
22322,
710,
271,
2033,
29901,
13,
462,
1678,
2302,
353,
2302,
718,
29871,
29896,
13,
462,
1678,
26742,
29918,
799,
29876,
4619,
270,
29961,
29873,
29918,
333,
22322,
799,
29876,
2033,
13,
9651,
565,
2302,
1405,
29871,
29900,
29901,
13,
18884,
1029,
29887,
29918,
799,
29876,
353,
938,
29898,
710,
271,
29918,
799,
29876,
847,
2302,
29897,
13,
18884,
1121,
29918,
6672,
29889,
21843,
4197,
29895,
29892,
1029,
29887,
29918,
799,
29876,
2314,
13,
9651,
565,
2479,
29901,
13,
18884,
1596,
4852,
26910,
6571,
20591,
385,
6588,
310,
6571,
1213,
29889,
4830,
29898,
29895,
29892,
1029,
29887,
29918,
799,
29876,
876,
13,
13,
4706,
736,
1121,
29918,
6672,
13,
13,
1678,
822,
4078,
29918,
9902,
29898,
1311,
29892,
1121,
29918,
6672,
29892,
1962,
29918,
1445,
1125,
13,
4706,
396,
2436,
10733,
314,
1212,
2582,
408,
869,
7638,
934,
13,
4706,
1962,
29918,
1445,
353,
1722,
29898,
4905,
29918,
1445,
718,
15300,
7638,
742,
525,
29893,
742,
25899,
2433,
1495,
13,
4706,
1962,
29918,
13236,
353,
11799,
29889,
13236,
29898,
4905,
29918,
1445,
29897,
13,
13,
4706,
396,
3824,
2436,
714,
1121,
4839,
2407,
13,
4706,
1962,
29918,
13236,
29889,
13236,
340,
29898,
2914,
29918,
6672,
29897,
13,
13,
4706,
396,
6440,
2436,
714,
16688,
2472,
13,
4706,
11299,
353,
1583,
29889,
585,
428,
29889,
12276,
29918,
20488,
580,
13,
4706,
1962,
29918,
13236,
29889,
13236,
340,
29898,
3366,
20488,
613,
376,
2230,
29892,
1178,
29892,
1134,
29892,
626,
29873,
29914,
4304,
613,
7431,
29898,
20488,
29897,
2314,
13,
4706,
363,
1543,
297,
11299,
29901,
13,
9651,
269,
353,
5159,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29900,
2314,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29896,
2314,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29906,
2314,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29941,
2314,
13,
9651,
1962,
29918,
13236,
29889,
13236,
340,
29898,
29879,
29897,
13,
13,
4706,
396,
18008,
2436,
714,
8078,
2472,
13,
4706,
8078,
29879,
353,
1583,
29889,
585,
428,
29889,
12276,
29918,
1285,
1461,
29879,
580,
13,
4706,
1962,
29918,
13236,
29889,
13236,
340,
29898,
3366,
1285,
1461,
29879,
613,
376,
9175,
29892,
1321,
7598,
29918,
333,
29892,
269,
4539,
29918,
333,
613,
7431,
29898,
1285,
1461,
29879,
29897,
2314,
13,
4706,
363,
1543,
297,
8078,
29879,
29901,
13,
9651,
269,
353,
5159,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29900,
2314,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29896,
2314,
13,
9651,
269,
29889,
4397,
29898,
5029,
29961,
29906,
2314,
13,
9651,
1962,
29918,
13236,
29889,
13236,
340,
29898,
29879,
29897,
13,
13,
4706,
1962,
29918,
1445,
29889,
5358,
580,
13,
13,
1678,
822,
1027,
29898,
1311,
29892,
2479,
29892,
954,
29918,
3626,
1338,
29892,
270,
1125,
13,
13,
4706,
396,
11905,
2533,
3651,
13,
13,
4706,
3001,
29918,
799,
11753,
353,
518,
29900,
29962,
334,
7431,
29898,
29881,
1839,
710,
1845,
583,
11287,
13,
4706,
2533,
29918,
26613,
1965,
353,
518,
29900,
29962,
334,
7431,
29898,
29881,
1839,
710,
1845,
583,
11287,
13,
13,
4706,
363,
413,
297,
3464,
29898,
1949,
29918,
3626,
1338,
1125,
13,
9651,
1121,
353,
5159,
13,
9651,
1583,
29889,
3389,
29898,
4990,
29897,
13,
9651,
396,
14402,
12065,
1881,
322,
1962,
2066,
1250,
297,
363,
1999,
1331,
13,
9651,
1121,
29918,
6672,
353,
6796,
9162,
376,
9162,
7431,
29898,
1311,
29889,
509,
24574,
4638,
13,
9651,
1121,
29918,
6672,
353,
1583,
29889,
14513,
29898,
4990,
29892,
270,
29892,
1121,
29918,
6672,
29897,
13,
9651,
396,
1121,
4839,
353,
518,
2080,
29918,
1445,
29892,
1962,
29918,
1445,
29892,
954,
29918,
509,
24574,
29892,
9358,
29918,
677,
29892,
9358,
29918,
9812,
29892,
321,
29918,
22640,
29892,
13,
9651,
396,
462,
29871,
4236,
29918,
7610,
11242,
29892,
3935,
29918,
7610,
11242,
29892,
19201,
29892,
13,
9651,
396,
462,
29871,
3579,
363,
599,
954,
509,
24574,
1068,
534,
1664,
1178,
29892,
534,
1664,
13705,
29892,
534,
1664,
2326,
11753,
29962,
13,
9651,
396,
1596,
29898,
2914,
29918,
6672,
29897,
13,
9651,
1121,
29889,
4397,
29898,
2914,
29918,
6672,
29961,
29947,
2314,
13,
9651,
432,
353,
29871,
29929,
718,
938,
29898,
2914,
29918,
6672,
29961,
29906,
2314,
334,
29871,
29941,
29871,
396,
4337,
304,
988,
13705,
2582,
526,
13,
9651,
363,
413,
297,
270,
1839,
710,
1845,
583,
2033,
29901,
13,
18884,
1121,
29889,
4397,
29898,
2914,
29918,
6672,
29961,
29926,
718,
29871,
29896,
2314,
13,
18884,
432,
353,
432,
718,
29871,
29906,
13,
13,
9651,
565,
2479,
29901,
13,
18884,
1596,
703,
1454,
1065,
6571,
1121,
6571,
1642,
4830,
29898,
29895,
29892,
1121,
876,
13,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
29881,
1839,
710,
1845,
583,
2033,
22164,
13,
18884,
2326,
29876,
353,
1121,
29961,
29926,
718,
29871,
29896,
29962,
13,
18884,
3001,
29918,
799,
11753,
29961,
29926,
29962,
4619,
2326,
29876,
13,
18884,
2533,
29918,
26613,
1965,
29961,
29926,
29962,
4619,
2326,
29876,
334,
2326,
29876,
13,
13,
4706,
1029,
29887,
29918,
799,
1076,
353,
5159,
13,
4706,
722,
353,
5159,
13,
4706,
269,
3359,
353,
5159,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
29881,
1839,
710,
1845,
583,
2033,
22164,
13,
9651,
1029,
29887,
29918,
799,
29876,
353,
3001,
29918,
799,
11753,
29961,
29926,
29962,
847,
954,
29918,
3626,
1338,
13,
9651,
20162,
353,
5135,
2083,
29918,
26613,
1965,
29961,
29926,
29962,
847,
954,
29918,
3626,
1338,
29897,
448,
313,
485,
29887,
29918,
799,
29876,
334,
1029,
29887,
29918,
799,
29876,
876,
13,
9651,
3918,
29918,
311,
14641,
353,
20162,
3579,
29871,
29900,
29889,
29945,
13,
9651,
1029,
29887,
29918,
799,
1076,
29889,
4397,
29898,
485,
29887,
29918,
799,
29876,
29897,
13,
9651,
722,
29889,
4397,
29898,
1707,
8837,
29897,
13,
9651,
269,
3359,
29889,
4397,
29898,
15770,
29918,
311,
14641,
29897,
13,
4706,
1596,
3861,
13,
4706,
1596,
4852,
29909,
19698,
382,
2753,
886,
363,
6571,
364,
3885,
1642,
4830,
29898,
1949,
29918,
3626,
1338,
876,
13,
4706,
1596,
313,
29881,
1839,
710,
1845,
583,
11287,
13,
4706,
1596,
29898,
485,
29887,
29918,
799,
1076,
29897,
13,
4706,
1596,
29898,
29879,
3359,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
534,
29876,
353,
29427,
4852,
29911,
2905,
314,
1212,
4408,
613,
29871,
29896,
29900,
29892,
376,
27074,
363,
3765,
782,
428,
1159,
2
] |
akilib/raspberrypi/AKI_I2C_LPS25H.py | nonNoise/akilib | 29 | 24428 | <filename>akilib/raspberrypi/AKI_I2C_LPS25H.py
#import mraa
import smbus
import time
I2C_ADDR = 0x5C
class AKI_I2C_LPS25H:
def __init__(self):
print "AKI_I2C_LPS25H"
self.i2c = smbus.SMBus(1)
def i2cReg(self,wr,addr=0x00,data=0x00):
try:
if(wr == "w"):
return self.i2c.write_byte_data(I2C_ADDR,addr,data)
elif(wr == "r"):
return self.i2c.read_byte_data(I2C_ADDR,addr)
else :
return -1
except IOError, err:
print "No ACK!"
time.sleep(0.1)
self.i2cReg(wr,addr,data)
def WHO_AM_I(self):
# "WHO_AM_I"
return self.i2cReg("r",0x0F)
def Init(self):
return self.i2cReg("w",0x20,0x90)
def Press(self):
p =0
p = p | self.i2cReg("r",0x28) <<0
p = p | self.i2cReg("r",0x29) <<8
p = p | self.i2cReg("r",0x2A) <<16
mbar = p/4096
return mbar
def Temp (self):
t = 0
t = t | self.i2cReg("r",0x2B) <<0
t = t | self.i2cReg("r",0x2C) <<8
t = -((t-1)^0xffff)
return (42.5+(t/480.0)) | [
1,
529,
9507,
29958,
557,
15943,
29914,
3417,
29886,
16344,
1631,
29914,
22311,
29902,
29918,
29902,
29906,
29907,
29918,
29931,
7024,
29906,
29945,
29950,
29889,
2272,
13,
29937,
5215,
286,
336,
29874,
13,
13,
5215,
1560,
8262,
13,
5215,
931,
13,
13,
29902,
29906,
29907,
29918,
3035,
8353,
353,
29871,
29900,
29916,
29945,
29907,
13,
13,
1990,
319,
29968,
29902,
29918,
29902,
29906,
29907,
29918,
29931,
7024,
29906,
29945,
29950,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1596,
376,
22311,
29902,
29918,
29902,
29906,
29907,
29918,
29931,
7024,
29906,
29945,
29950,
29908,
13,
4706,
1583,
29889,
29875,
29906,
29883,
353,
1560,
8262,
29889,
29903,
9486,
375,
29898,
29896,
29897,
13,
1678,
822,
474,
29906,
29883,
4597,
29898,
1311,
29892,
15866,
29892,
10030,
29922,
29900,
29916,
29900,
29900,
29892,
1272,
29922,
29900,
29916,
29900,
29900,
1125,
13,
4706,
1018,
29901,
13,
9651,
565,
29898,
15866,
1275,
376,
29893,
29908,
1125,
13,
18884,
736,
1583,
29889,
29875,
29906,
29883,
29889,
3539,
29918,
10389,
29918,
1272,
29898,
29902,
29906,
29907,
29918,
3035,
8353,
29892,
10030,
29892,
1272,
29897,
13,
9651,
25342,
29898,
15866,
1275,
376,
29878,
29908,
1125,
13,
18884,
736,
1583,
29889,
29875,
29906,
29883,
29889,
949,
29918,
10389,
29918,
1272,
29898,
29902,
29906,
29907,
29918,
3035,
8353,
29892,
10030,
29897,
13,
9651,
1683,
584,
13,
18884,
736,
448,
29896,
13,
4706,
5174,
10663,
2392,
29892,
4589,
29901,
13,
9651,
1596,
376,
3782,
319,
7077,
3850,
13,
9651,
931,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
9651,
1583,
29889,
29875,
29906,
29883,
4597,
29898,
15866,
29892,
10030,
29892,
1272,
29897,
13,
1678,
822,
399,
8187,
29918,
5194,
29918,
29902,
29898,
1311,
1125,
13,
4706,
396,
376,
29956,
8187,
29918,
5194,
29918,
29902,
29908,
13,
4706,
736,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29900,
29943,
29897,
13,
13,
1678,
822,
10886,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29893,
613,
29900,
29916,
29906,
29900,
29892,
29900,
29916,
29929,
29900,
29897,
29871,
13,
29871,
13,
1678,
822,
5254,
29898,
1311,
1125,
13,
4706,
282,
353,
29900,
13,
4706,
282,
353,
282,
891,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29906,
29947,
29897,
3532,
29900,
13,
4706,
282,
353,
282,
891,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29906,
29929,
29897,
3532,
29947,
13,
4706,
282,
353,
282,
891,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29906,
29909,
29897,
3532,
29896,
29953,
13,
4706,
286,
1646,
353,
282,
29914,
29946,
29900,
29929,
29953,
13,
4706,
736,
286,
1646,
13,
13,
1678,
822,
21121,
313,
1311,
1125,
13,
4706,
260,
353,
29871,
29900,
13,
4706,
260,
353,
260,
891,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29906,
29933,
29897,
3532,
29900,
13,
4706,
260,
353,
260,
891,
1583,
29889,
29875,
29906,
29883,
4597,
703,
29878,
613,
29900,
29916,
29906,
29907,
29897,
3532,
29947,
13,
4706,
260,
353,
448,
3552,
29873,
29899,
29896,
4887,
29900,
29916,
17156,
29897,
13,
4706,
736,
313,
29946,
29906,
29889,
29945,
17108,
29873,
29914,
29946,
29947,
29900,
29889,
29900,
876,
2
] |
setup.py | MagnaXSoftware/popo | 0 | 146881 | <filename>setup.py<gh_stars>0
from setuptools import setup, find_packages
setup(
name="popo",
version="0.0.1",
url="https://github.com/MagnaXSoftware/popo",
license="MIT",
author="<NAME>",
author_email="<EMAIL>",
description="POPO gives you a simple, small, clean ORM with Plain Old Python Objects.",
packages=find_packages(),
classifiers=[
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Database",
],
)
| [
1,
529,
9507,
29958,
14669,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
731,
21245,
8789,
1053,
6230,
29892,
1284,
29918,
8318,
13,
13,
14669,
29898,
13,
1678,
1024,
543,
7323,
29877,
613,
13,
1678,
1873,
543,
29900,
29889,
29900,
29889,
29896,
613,
13,
1678,
3142,
543,
991,
597,
3292,
29889,
510,
29914,
29924,
15713,
29990,
6295,
14093,
29914,
7323,
29877,
613,
13,
1678,
19405,
543,
26349,
613,
13,
1678,
4148,
543,
29966,
5813,
28341,
13,
1678,
4148,
29918,
5269,
543,
29966,
26862,
6227,
28341,
13,
1678,
6139,
543,
29925,
4590,
29949,
4076,
366,
263,
2560,
29892,
2319,
29892,
5941,
6323,
29924,
411,
349,
7420,
8198,
5132,
4669,
29879,
19602,
13,
1678,
9741,
29922,
2886,
29918,
8318,
3285,
13,
1678,
770,
14903,
11759,
13,
4706,
376,
21956,
358,
16034,
4761,
29871,
29946,
448,
350,
1187,
613,
13,
4706,
376,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
613,
13,
4706,
376,
29931,
293,
1947,
4761,
438,
5425,
28268,
1490,
4761,
341,
1806,
19245,
613,
13,
4706,
376,
7094,
1218,
2184,
4761,
6570,
25266,
613,
13,
4706,
376,
7031,
293,
4761,
5470,
613,
13,
1678,
21251,
13,
29897,
13,
2
] |
et_micc2/templates/app-single-command/{{tmpl.project_name}}/{{tmpl.package_name}}/{{tmpl.cli_app_name}}.py | etijskens/et-micc2 | 0 | 184283 | <filename>et_micc2/templates/app-single-command/{{tmpl.project_name}}/{{tmpl.package_name}}/{{tmpl.cli_app_name}}.py
# -*- coding: utf-8 -*-
"""Command line interface {{tmpl.app_name}} (no sub-commands)."""
import sys
import click
@click.command()
@click.option('-v', '--verbosity', count=True
, help="The verbosity of the program."
, default=1
)
def main(verbosity):
"""Command line interface {{tmpl.app_name}}.
A 'hello' world CLI example.
"""
for _ in range(verbosity):
click.echo("running {{tmpl.app_name}}")
if __name__ == "__main__":
sys.exit(main()) # pragma: no cover
#eodf
| [
1,
529,
9507,
29958,
300,
29918,
13076,
29883,
29906,
29914,
20943,
29914,
932,
29899,
14369,
29899,
6519,
29914,
6224,
18276,
572,
29889,
4836,
29918,
978,
930,
29914,
6224,
18276,
572,
29889,
5113,
29918,
978,
930,
29914,
6224,
18276,
572,
29889,
11303,
29918,
932,
29918,
978,
27243,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
6255,
1196,
5067,
8620,
18276,
572,
29889,
932,
29918,
978,
930,
313,
1217,
1014,
29899,
26381,
467,
15945,
29908,
13,
13,
5215,
10876,
13,
13,
5215,
2828,
13,
13,
13,
29992,
3808,
29889,
6519,
580,
13,
29992,
3808,
29889,
3385,
877,
29899,
29894,
742,
525,
489,
18248,
359,
537,
742,
2302,
29922,
5574,
13,
632,
1919,
1371,
543,
1576,
9750,
359,
537,
310,
278,
1824,
1213,
13,
632,
1919,
2322,
29922,
29896,
13,
632,
1723,
13,
1753,
1667,
29898,
18248,
359,
537,
1125,
13,
1678,
9995,
6255,
1196,
5067,
8620,
18276,
572,
29889,
932,
29918,
978,
27243,
13,
268,
13,
1678,
319,
525,
12199,
29915,
3186,
24492,
1342,
29889,
13,
1678,
9995,
13,
268,
13,
1678,
363,
903,
297,
3464,
29898,
18248,
359,
537,
1125,
13,
4706,
2828,
29889,
8057,
703,
21094,
8620,
18276,
572,
29889,
932,
29918,
978,
930,
1159,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
10876,
29889,
13322,
29898,
3396,
3101,
29871,
396,
282,
23929,
29901,
694,
4612,
13,
29937,
29872,
397,
29888,
13,
2
] |
pkg/unix/Python27/Lib/site-packages/klei/textureconverter.py | hexgear-studio/ds_mod_tools | 112 | 199156 | import sys, os, tempfile, shutil
from PIL import Image
import util
import subprocess
'''
TOOL_PATH = os.path.join( os.path.dirname( __file__ ), "../../../../../../tools/bin" )
TEXTURE_CONVERTER = os.path.abspath( os.path.join( TOOL_PATH, "TextureConverter.exe" ) )
def Convert( src_filenames, dest_filename, texture_format="bc3", no_premultiply=False, force=False, platform='opengl',
generate_mips=False, width=None, height=None,
verbose=False, ignore_exceptions=False):
is_newer = False
# If a list is passed in, concatenate the filenames with semi-colon separators, otherwise just use the filename
src_filename_str = None
if isinstance( src_filenames, list ):
src_filename_str = ';'.join( src_filenames )
for filename in src_filenames:
is_newer = is_newer or util.IsFileNewer( filename, dest_filename )
else:
src_filename_str = src_filenames
is_newer = is_newer or util.IsFileNewer( src_filename_str, dest_filename )
if force or is_newer:
cmd_list = [ TEXTURE_CONVERTER,
'--swizzle',
'--format ' + texture_format,
'--platform ' + platform,
'-i ' + src_filename_str,
'-o ' + dest_filename,
]
if generate_mips:
cmd_list.append( '--mipmap' )
if not no_premultiply:
cmd_list.append( '--premultiply' )
if width:
cmd_list.append( '-w {}'.format( width ) )
if height:
cmd_list.append( '-h {}'.format( height ) )
cmd = " ".join( cmd_list )
if verbose:
print( cmd )
if subprocess.call( cmd_list ) != 0:
sys.stderr.write( "Error attempting to convert {} to {}\n".format( src_filenames, dest_filename ) )
sys.stderr.write( cmd + "\n" )
if not ignore_exceptions:
raise
'''
KTECH_LOCATION = "ktech"
texture_format_translation = {
'bc1': 'dxt1',
'bc2': 'dxt3',
'bc3': 'dxt5',
'rgb': 'rgb',
'argb': 'rgba',
}
def Convert( src_filenames, dest_filename, texture_format="bc3", no_premultiply=False, force=False, platform='opengl',
generate_mips=False, width=None, height=None,
verbose=False, ignore_exceptions=False):
is_newer = False
assert texture_format_translation[texture_format], "Invalid texture format {}".format(texture_format)
texture_format = texture_format_translation[texture_format]
# ktech has multiplatform texture support as a stub, but disabled since only opengl is used.
# (the support was built in, but the option to define in as a program parameter was left commented out)
assert platform == "opengl", "Invalid platform {}".format(platform)
# If a list is passed in, concatenate the filenames with semi-colon separators, otherwise just use the filename
src_filename_str = None
if isinstance( src_filenames, list ):
src_filename_str = ','.join( src_filenames )
for filename in src_filenames:
is_newer = is_newer or util.IsFileNewer( filename, dest_filename )
else:
src_filename_str = src_filenames
is_newer = is_newer or util.IsFileNewer( src_filename_str, dest_filename )
if force or is_newer:
cmd_list = [ KTECH_LOCATION,
'--quiet',
'--compression ' + texture_format,
]
if not generate_mips:
cmd_list.append( '--no-mipmaps' )
if no_premultiply:
cmd_list.append( '--no-premultiply' )
if width:
cmd_list.append( '--width {}'.format( width ) )
if height:
cmd_list.append( '--height {}'.format( height ) )
cmd_list.append( '--' )
cmd_list.append( src_filename_str )
cmd_list.append( dest_filename )
cmd = " ".join( cmd_list )
if verbose:
print( cmd )
if subprocess.call( cmd_list ) != 0:
sys.stderr.write( "Error attempting to convert {} to {}\n".format( src_filenames, dest_filename ) )
sys.stderr.write( cmd + "\n" )
if not ignore_exceptions:
raise
def GenerateMips( im ):
mips = []
w, h = im.size
while w >= 1 or h >= 1:
mips.append( im )
w /= 2
h /= 2
im = im.resize( ( max( w, 1 ), max( h, 1 ) ), Image.ANTIALIAS )
return mips
def SaveImagesToTemp( images, basename ):
tempdir = tempfile.mkdtemp()
idx = 0
filenames = []
for image in images:
name = "{0}{1}.png".format( basename, idx )
filename = os.path.join( tempdir, name )
filenames.append( filename )
image.save( filename )
idx += 1
return ( tempdir, filenames )
def MipAndConvert( im, dest_filename, platform='opengl', texture_format="bc3", no_premultiply = False, force=False, ignore_exceptions=False ):
if isinstance( im, str ):
im = Image.open( im )
mips = GenerateMips( im )
tempdir, filenames = SaveImagesToTemp( mips, "mip" )
try:
Convert( src_filenames=filenames, dest_filename=dest_filename, texture_format=texture_format, platform=platform,
no_premultiply=no_premultiply, force=force, ignore_exceptions=ignore_exceptions )
finally:
if os.path.exists( tempdir ):
shutil.rmtree( tempdir )
| [
1,
1053,
10876,
29892,
2897,
29892,
5694,
1445,
29892,
528,
4422,
30004,
13,
3166,
349,
6227,
1053,
7084,
30004,
13,
5215,
3667,
30004,
13,
5215,
1014,
5014,
30004,
13,
30004,
13,
12008,
30004,
13,
4986,
5607,
29918,
10145,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2897,
29889,
2084,
29889,
25721,
29898,
4770,
1445,
1649,
10353,
376,
21546,
21546,
21546,
8504,
29914,
2109,
29908,
1723,
30004,
13,
16975,
11499,
29918,
6007,
5348,
4945,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
2897,
29889,
2084,
29889,
7122,
29898,
7495,
5607,
29918,
10145,
29892,
376,
21898,
18545,
29889,
8097,
29908,
1723,
1723,
30004,
13,
30004,
13,
1753,
14806,
29898,
4765,
29918,
1777,
264,
1280,
29892,
2731,
29918,
9507,
29892,
18459,
29918,
4830,
543,
12328,
29941,
613,
694,
29918,
1457,
18056,
368,
29922,
8824,
29892,
4889,
29922,
8824,
29892,
7481,
2433,
459,
6180,
23592,
13,
632,
5706,
29918,
2460,
567,
29922,
8824,
29892,
2920,
29922,
8516,
29892,
3171,
29922,
8516,
11167,
13,
632,
26952,
29922,
8824,
29892,
11455,
29918,
11739,
29879,
29922,
8824,
1125,
30004,
13,
1678,
338,
29918,
484,
556,
353,
7700,
30004,
13,
30004,
13,
1678,
396,
960,
263,
1051,
338,
4502,
297,
29892,
16125,
403,
278,
977,
264,
1280,
411,
12647,
29899,
17308,
2903,
4097,
29892,
6467,
925,
671,
278,
10422,
30004,
13,
1678,
4765,
29918,
9507,
29918,
710,
353,
6213,
30004,
13,
1678,
565,
338,
8758,
29898,
4765,
29918,
1777,
264,
1280,
29892,
1051,
29871,
1125,
30004,
13,
4706,
4765,
29918,
9507,
29918,
710,
353,
21921,
4286,
7122,
29898,
4765,
29918,
1777,
264,
1280,
1723,
30004,
13,
4706,
363,
10422,
297,
4765,
29918,
1777,
264,
1280,
29901,
30004,
13,
9651,
338,
29918,
484,
556,
353,
338,
29918,
484,
556,
470,
3667,
29889,
3624,
2283,
8139,
556,
29898,
10422,
29892,
2731,
29918,
9507,
1723,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
4765,
29918,
9507,
29918,
710,
353,
4765,
29918,
1777,
264,
1280,
30004,
13,
4706,
338,
29918,
484,
556,
353,
338,
29918,
484,
556,
470,
3667,
29889,
3624,
2283,
8139,
556,
29898,
4765,
29918,
9507,
29918,
710,
29892,
2731,
29918,
9507,
1723,
30004,
13,
30004,
13,
1678,
565,
4889,
470,
338,
29918,
484,
556,
29901,
30004,
13,
4706,
9920,
29918,
1761,
353,
518,
323,
12194,
11499,
29918,
6007,
5348,
4945,
11167,
13,
462,
3986,
525,
489,
2774,
4981,
280,
23592,
13,
462,
3986,
525,
489,
4830,
525,
718,
18459,
29918,
4830,
11167,
13,
462,
3986,
525,
489,
12120,
525,
718,
7481,
11167,
13,
462,
3986,
17411,
29875,
525,
718,
4765,
29918,
9507,
29918,
710,
11167,
13,
462,
3986,
17411,
29877,
525,
718,
2731,
29918,
9507,
11167,
13,
462,
1678,
4514,
30004,
13,
30004,
13,
4706,
565,
5706,
29918,
2460,
567,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
29885,
666,
1958,
29915,
1723,
30004,
13,
30004,
13,
4706,
565,
451,
694,
29918,
1457,
18056,
368,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
1457,
18056,
368,
29915,
1723,
30004,
13,
30004,
13,
4706,
565,
2920,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
17411,
29893,
6571,
4286,
4830,
29898,
2920,
1723,
1723,
30004,
13,
4706,
565,
3171,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
17411,
29882,
6571,
4286,
4830,
29898,
3171,
1723,
1723,
30004,
13,
30004,
13,
4706,
9920,
353,
376,
11393,
7122,
29898,
9920,
29918,
1761,
1723,
30004,
13,
4706,
565,
26952,
29901,
30004,
13,
9651,
1596,
29898,
9920,
1723,
30004,
13,
4706,
565,
1014,
5014,
29889,
4804,
29898,
9920,
29918,
1761,
1723,
2804,
29871,
29900,
29901,
30004,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
29898,
376,
2392,
15661,
304,
3588,
6571,
304,
426,
1012,
29876,
1642,
4830,
29898,
4765,
29918,
1777,
264,
1280,
29892,
2731,
29918,
9507,
1723,
1723,
30004,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
29898,
9920,
718,
6634,
29876,
29908,
1723,
30004,
13,
9651,
565,
451,
11455,
29918,
11739,
29879,
29901,
30004,
13,
18884,
12020,
30004,
13,
12008,
30004,
13,
30004,
13,
29968,
4330,
3210,
29918,
16652,
8098,
353,
376,
8190,
305,
19451,
13,
30004,
13,
726,
545,
29918,
4830,
29918,
3286,
18411,
353,
3336,
13,
1678,
525,
12328,
29896,
2396,
525,
29881,
486,
29896,
23592,
13,
1678,
525,
12328,
29906,
2396,
525,
29881,
486,
29941,
23592,
13,
1678,
525,
12328,
29941,
2396,
525,
29881,
486,
29945,
23592,
13,
1678,
525,
23973,
2396,
525,
23973,
23592,
13,
1678,
525,
1191,
29890,
2396,
525,
11007,
2291,
23592,
13,
1678,
4970,
13,
30004,
13,
1753,
14806,
29898,
4765,
29918,
1777,
264,
1280,
29892,
2731,
29918,
9507,
29892,
18459,
29918,
4830,
543,
12328,
29941,
613,
694,
29918,
1457,
18056,
368,
29922,
8824,
29892,
4889,
29922,
8824,
29892,
7481,
2433,
459,
6180,
23592,
13,
632,
5706,
29918,
2460,
567,
29922,
8824,
29892,
2920,
29922,
8516,
29892,
3171,
29922,
8516,
11167,
13,
632,
26952,
29922,
8824,
29892,
11455,
29918,
11739,
29879,
29922,
8824,
1125,
30004,
13,
1678,
338,
29918,
484,
556,
353,
7700,
30004,
13,
30004,
13,
1678,
4974,
18459,
29918,
4830,
29918,
3286,
18411,
29961,
726,
545,
29918,
4830,
1402,
376,
13919,
18459,
3402,
6571,
1642,
4830,
29898,
726,
545,
29918,
4830,
8443,
13,
1678,
18459,
29918,
4830,
353,
18459,
29918,
4830,
29918,
3286,
18411,
29961,
726,
545,
29918,
4830,
29962,
30004,
13,
1678,
6756,
13,
1678,
396,
413,
11345,
756,
2473,
12120,
18459,
2304,
408,
263,
19281,
29892,
541,
12708,
1951,
871,
1015,
6180,
338,
1304,
22993,
13,
1678,
396,
313,
1552,
2304,
471,
4240,
297,
29892,
541,
278,
2984,
304,
4529,
297,
408,
263,
1824,
3443,
471,
2175,
19952,
714,
8443,
13,
1678,
4974,
7481,
1275,
376,
459,
6180,
613,
376,
13919,
7481,
6571,
1642,
4830,
29898,
12120,
8443,
13,
30004,
13,
1678,
396,
960,
263,
1051,
338,
4502,
297,
29892,
16125,
403,
278,
977,
264,
1280,
411,
12647,
29899,
17308,
2903,
4097,
29892,
6467,
925,
671,
278,
10422,
30004,
13,
1678,
4765,
29918,
9507,
29918,
710,
353,
6213,
30004,
13,
30004,
13,
1678,
565,
338,
8758,
29898,
4765,
29918,
1777,
264,
1280,
29892,
1051,
29871,
1125,
30004,
13,
4706,
4765,
29918,
9507,
29918,
710,
353,
13420,
4286,
7122,
29898,
4765,
29918,
1777,
264,
1280,
1723,
30004,
13,
4706,
363,
10422,
297,
4765,
29918,
1777,
264,
1280,
29901,
30004,
13,
9651,
338,
29918,
484,
556,
353,
338,
29918,
484,
556,
470,
3667,
29889,
3624,
2283,
8139,
556,
29898,
10422,
29892,
2731,
29918,
9507,
1723,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
4765,
29918,
9507,
29918,
710,
353,
4765,
29918,
1777,
264,
1280,
30004,
13,
4706,
338,
29918,
484,
556,
353,
338,
29918,
484,
556,
470,
3667,
29889,
3624,
2283,
8139,
556,
29898,
4765,
29918,
9507,
29918,
710,
29892,
2731,
29918,
9507,
1723,
30004,
13,
30004,
13,
1678,
565,
4889,
470,
338,
29918,
484,
556,
29901,
30004,
13,
4706,
9920,
29918,
1761,
353,
518,
476,
4330,
3210,
29918,
16652,
8098,
11167,
13,
462,
4706,
525,
489,
339,
2035,
23592,
13,
462,
4706,
525,
489,
510,
2590,
525,
718,
18459,
29918,
4830,
11167,
13,
462,
259,
4514,
30004,
13,
30004,
13,
4706,
565,
451,
5706,
29918,
2460,
567,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
1217,
29899,
29885,
666,
10339,
29915,
1723,
30004,
13,
30004,
13,
4706,
565,
694,
29918,
1457,
18056,
368,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
1217,
29899,
1457,
18056,
368,
29915,
1723,
30004,
13,
30004,
13,
4706,
565,
2920,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
2103,
6571,
4286,
4830,
29898,
2920,
1723,
1723,
30004,
13,
4706,
565,
3171,
29901,
30004,
13,
9651,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
3545,
6571,
4286,
4830,
29898,
3171,
1723,
1723,
30004,
13,
30004,
13,
4706,
9920,
29918,
1761,
29889,
4397,
29898,
525,
489,
29915,
1723,
30004,
13,
30004,
13,
4706,
9920,
29918,
1761,
29889,
4397,
29898,
4765,
29918,
9507,
29918,
710,
1723,
30004,
13,
4706,
9920,
29918,
1761,
29889,
4397,
29898,
2731,
29918,
9507,
1723,
30004,
13,
30004,
13,
4706,
9920,
353,
376,
11393,
7122,
29898,
9920,
29918,
1761,
1723,
30004,
13,
4706,
565,
26952,
29901,
30004,
13,
9651,
1596,
29898,
9920,
1723,
30004,
13,
4706,
565,
1014,
5014,
29889,
4804,
29898,
9920,
29918,
1761,
1723,
2804,
29871,
29900,
29901,
30004,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
29898,
376,
2392,
15661,
304,
3588,
6571,
304,
426,
1012,
29876,
1642,
4830,
29898,
4765,
29918,
1777,
264,
1280,
29892,
2731,
29918,
9507,
1723,
1723,
30004,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
29898,
9920,
718,
6634,
29876,
29908,
1723,
30004,
13,
9651,
565,
451,
11455,
29918,
11739,
29879,
29901,
30004,
13,
18884,
12020,
30004,
13,
30004,
13,
30004,
13,
1753,
3251,
403,
29924,
4512,
29898,
527,
29871,
1125,
30004,
13,
1678,
3737,
567,
353,
5159,
30004,
13,
1678,
281,
29892,
298,
353,
527,
29889,
2311,
30004,
13,
30004,
13,
1678,
1550,
281,
6736,
29871,
29896,
470,
298,
6736,
29871,
29896,
29901,
30004,
13,
4706,
3737,
567,
29889,
4397,
29898,
527,
1723,
30004,
13,
30004,
13,
4706,
281,
847,
29922,
29871,
29906,
30004,
13,
4706,
298,
847,
29922,
29871,
29906,
30004,
13,
30004,
13,
4706,
527,
353,
527,
29889,
21476,
29898,
313,
4236,
29898,
281,
29892,
29871,
29896,
10353,
4236,
29898,
298,
29892,
29871,
29896,
1723,
10353,
7084,
29889,
13566,
25758,
29902,
3289,
1723,
30004,
13,
30004,
13,
1678,
736,
3737,
567,
30004,
13,
30004,
13,
30004,
13,
1753,
16913,
20163,
1762,
15637,
29898,
4558,
29892,
2362,
3871,
29871,
1125,
30004,
13,
1678,
5694,
3972,
353,
5694,
1445,
29889,
11256,
29881,
7382,
26471,
13,
1678,
22645,
353,
29871,
29900,
30004,
13,
30004,
13,
1678,
977,
264,
1280,
353,
5159,
30004,
13,
1678,
363,
1967,
297,
4558,
29901,
30004,
13,
4706,
1024,
353,
29850,
29900,
1157,
29896,
1836,
2732,
1642,
4830,
29898,
2362,
3871,
29892,
22645,
1723,
30004,
13,
30004,
13,
4706,
10422,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5694,
3972,
29892,
1024,
1723,
30004,
13,
4706,
977,
264,
1280,
29889,
4397,
29898,
10422,
1723,
30004,
13,
4706,
1967,
29889,
7620,
29898,
10422,
29871,
1723,
30004,
13,
30004,
13,
4706,
22645,
4619,
29871,
29896,
30004,
13,
30004,
13,
1678,
736,
313,
5694,
3972,
29892,
977,
264,
1280,
1723,
30004,
13,
30004,
13,
30004,
13,
1753,
341,
666,
2855,
18455,
29898,
527,
29892,
2731,
29918,
9507,
29892,
7481,
2433,
459,
6180,
742,
18459,
29918,
4830,
543,
12328,
29941,
613,
694,
29918,
1457,
18056,
368,
353,
7700,
29892,
4889,
29922,
8824,
29892,
11455,
29918,
11739,
29879,
29922,
8824,
29871,
1125,
30004,
13,
1678,
565,
338,
8758,
29898,
527,
29892,
851,
29871,
1125,
30004,
13,
4706,
527,
353,
7084,
29889,
3150,
29898,
527,
1723,
30004,
13,
1678,
3737,
567,
353,
3251,
403,
29924,
4512,
29898,
527,
1723,
30004,
13,
30004,
13,
1678,
5694,
3972,
29892,
977,
264,
1280,
353,
16913,
20163,
1762,
15637,
29898,
3737,
567,
29892,
376,
29885,
666,
29908,
1723,
30004,
13,
1678,
1018,
29901,
30004,
13,
4706,
14806,
29898,
4765,
29918,
1777,
264,
1280,
29922,
1777,
264,
1280,
29892,
2731,
29918,
9507,
29922,
7854,
29918,
9507,
29892,
18459,
29918,
4830,
29922,
726,
545,
29918,
4830,
29892,
7481,
29922,
12120,
11167,
13,
18884,
694,
29918,
1457,
18056,
368,
29922,
1217,
29918,
1457,
18056,
368,
29892,
4889,
29922,
10118,
29892,
11455,
29918,
11739,
29879,
29922,
17281,
29918,
11739,
29879,
1723,
30004,
13,
1678,
7146,
29901,
30004,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
5694,
3972,
29871,
1125,
30004,
13,
9651,
528,
4422,
29889,
1758,
8336,
29898,
5694,
3972,
1723,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
2
] |
lib/coginvasion/hood/TTSafeZoneLoader.py | theclashingfritz/Cog-Invasion-Online-Dump | 1 | 1614361 | # uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.hood.TTSafeZoneLoader
from lib.coginvasion.holiday.HolidayManager import HolidayType
import SafeZoneLoader, TTPlayground
from lib.coginvasion.globals import CIGlobals
class TTSafeZoneLoader(SafeZoneLoader.SafeZoneLoader):
def __init__(self, hood, parentFSM, doneEvent):
SafeZoneLoader.SafeZoneLoader.__init__(self, hood, parentFSM, doneEvent)
self.playground = TTPlayground.TTPlayground
self.pgMusicFilename = 'phase_4/audio/bgm/TC_nbrhood.mid'
self.interiorMusicFilename = 'phase_3.5/audio/bgm/TC_SZ_activity.mid'
self.battleMusicFile = 'phase_3.5/audio/bgm/encntr_general_bg.mid'
self.invasionMusicFiles = [
'phase_12/audio/bgm/BossBot_CEO_v1.mid',
'phase_9/audio/bgm/encntr_suit_winning.mid']
self.tournamentMusicFiles = [
'phase_3.5/audio/bgm/encntr_nfsmw_bg_1.ogg',
'phase_3.5/audio/bgm/encntr_nfsmw_bg_2.ogg',
'phase_3.5/audio/bgm/encntr_nfsmw_bg_3.ogg',
'phase_3.5/audio/bgm/encntr_nfsmw_bg_4.ogg']
self.bossBattleMusicFile = 'phase_7/audio/bgm/encntr_suit_winning_indoor.mid'
self.dnaFile = 'phase_4/dna/new_ttc_sz.pdna'
self.szStorageDNAFile = 'phase_4/dna/storage_TT_sz.pdna'
self.szHolidayDNAFile = None
if base.cr.holidayManager.getHoliday() == HolidayType.CHRISTMAS:
self.szHolidayDNAFile = 'phase_4/dna/winter_storage_TT_sz.pdna'
self.telescope = None
self.birdNoises = [
'phase_4/audio/sfx/SZ_TC_bird1.ogg',
'phase_4/audio/sfx/SZ_TC_bird2.ogg',
'phase_4/audio/sfx/SZ_TC_bird3.ogg']
return
def load(self):
SafeZoneLoader.SafeZoneLoader.load(self)
self.geom.find('**/toontown_central_beta_DNARoot').setTwoSided(1)
self.geom.find('**/ground_center').setBin('ground', 18)
self.geom.find('**/ground_sidewalk').setBin('ground', 18)
self.geom.find('**/ground').setBin('ground', 18)
self.geom.find('**/ground_center_coll').setCollideMask(CIGlobals.FloorBitmask)
self.geom.find('**/ground_sidewalk_coll').setCollideMask(CIGlobals.FloorBitmask)
for tunnel in self.geom.findAllMatches('**/linktunnel_tt*'):
tunnel.find('**/tunnel_floor_1').setTexture(loader.loadTexture('phase_4/models/neighborhoods/tex/sidewalkbrown.jpg'), 1)
for tree in self.geom.findAllMatches('**/prop_green_tree_*_DNARoot'):
newShadow = loader.loadModel('phase_3/models/props/drop_shadow.bam')
newShadow.reparentTo(tree)
newShadow.setScale(1.5)
newShadow.setColor(0, 0, 0, 0.5, 1) | [
1,
396,
443,
2388,
1508,
29953,
1873,
29871,
29941,
29889,
29906,
29889,
29946,
13,
29937,
5132,
7023,
401,
29871,
29906,
29889,
29955,
313,
29953,
29906,
29906,
29896,
29896,
29897,
13,
29937,
897,
2388,
2356,
515,
29901,
5132,
29871,
29906,
29889,
29955,
29889,
29896,
29945,
313,
29894,
29906,
29889,
29955,
29889,
29896,
29945,
29901,
1113,
29900,
29955,
29929,
29874,
29941,
11248,
29941,
29892,
319,
558,
29871,
29941,
29900,
29871,
29906,
29900,
29896,
29947,
29892,
29871,
29896,
29953,
29901,
29941,
29900,
29901,
29906,
29953,
29897,
518,
4345,
29907,
325,
29889,
29896,
29945,
29900,
29900,
29871,
29953,
29946,
2586,
313,
5194,
29928,
29953,
29946,
4638,
13,
29937,
2812,
2580,
7176,
934,
1024,
29901,
4303,
29889,
29883,
468,
262,
4428,
291,
29889,
6614,
29889,
29911,
9375,
29874,
1725,
18482,
10036,
13,
3166,
4303,
29889,
29883,
468,
262,
4428,
291,
29889,
5391,
22394,
29889,
29950,
17211,
388,
3260,
1053,
4168,
22394,
1542,
13,
5215,
5701,
1725,
18482,
10036,
29892,
323,
29911,
13454,
2057,
13,
3166,
4303,
29889,
29883,
468,
262,
4428,
291,
29889,
23705,
1338,
1053,
315,
6259,
2127,
1338,
13,
13,
1990,
323,
9375,
29874,
1725,
18482,
10036,
29898,
17618,
1725,
18482,
10036,
29889,
17618,
1725,
18482,
10036,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
298,
2092,
29892,
3847,
9998,
29924,
29892,
2309,
2624,
1125,
13,
4706,
5701,
1725,
18482,
10036,
29889,
17618,
1725,
18482,
10036,
17255,
2344,
12035,
1311,
29892,
298,
2092,
29892,
3847,
9998,
29924,
29892,
2309,
2624,
29897,
13,
4706,
1583,
29889,
1456,
2057,
353,
323,
29911,
13454,
2057,
29889,
19988,
13454,
2057,
13,
4706,
1583,
29889,
4061,
21238,
3434,
3871,
353,
525,
21646,
29918,
29946,
29914,
18494,
29914,
16264,
29885,
29914,
9472,
29918,
29876,
1182,
6614,
29889,
6563,
29915,
13,
4706,
1583,
29889,
1639,
1611,
21238,
3434,
3871,
353,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
9472,
29918,
29903,
29999,
29918,
10072,
29889,
6563,
29915,
13,
4706,
1583,
29889,
29890,
5315,
21238,
2283,
353,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
17492,
29918,
16264,
29889,
6563,
29915,
13,
4706,
1583,
29889,
262,
4428,
291,
21238,
10547,
353,
518,
13,
308,
525,
21646,
29918,
29896,
29906,
29914,
18494,
29914,
16264,
29885,
29914,
29933,
2209,
29933,
327,
29918,
4741,
29949,
29918,
29894,
29896,
29889,
6563,
742,
13,
308,
525,
21646,
29918,
29929,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29658,
29918,
5080,
1076,
29889,
6563,
2033,
13,
4706,
1583,
29889,
29873,
2905,
1166,
21238,
10547,
353,
518,
13,
308,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29876,
29888,
3844,
29893,
29918,
16264,
29918,
29896,
29889,
468,
29887,
742,
13,
308,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29876,
29888,
3844,
29893,
29918,
16264,
29918,
29906,
29889,
468,
29887,
742,
13,
308,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29876,
29888,
3844,
29893,
29918,
16264,
29918,
29941,
29889,
468,
29887,
742,
13,
308,
525,
21646,
29918,
29941,
29889,
29945,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29876,
29888,
3844,
29893,
29918,
16264,
29918,
29946,
29889,
468,
29887,
2033,
13,
4706,
1583,
29889,
29890,
2209,
29933,
5315,
21238,
2283,
353,
525,
21646,
29918,
29955,
29914,
18494,
29914,
16264,
29885,
29914,
3977,
29876,
509,
29918,
29658,
29918,
5080,
1076,
29918,
15036,
272,
29889,
6563,
29915,
13,
4706,
1583,
29889,
29881,
1056,
2283,
353,
525,
21646,
29918,
29946,
29914,
29881,
1056,
29914,
1482,
29918,
698,
29883,
29918,
3616,
29889,
15926,
1056,
29915,
13,
4706,
1583,
29889,
3616,
10486,
29928,
3521,
2283,
353,
525,
21646,
29918,
29946,
29914,
29881,
1056,
29914,
12925,
29918,
19988,
29918,
3616,
29889,
15926,
1056,
29915,
13,
4706,
1583,
29889,
3616,
29950,
17211,
388,
29928,
3521,
2283,
353,
6213,
13,
4706,
565,
2967,
29889,
7283,
29889,
5391,
22394,
3260,
29889,
657,
29950,
17211,
388,
580,
1275,
4168,
22394,
1542,
29889,
3210,
3960,
1254,
1529,
29903,
29901,
13,
9651,
1583,
29889,
3616,
29950,
17211,
388,
29928,
3521,
2283,
353,
525,
21646,
29918,
29946,
29914,
29881,
1056,
29914,
29893,
1639,
29918,
12925,
29918,
19988,
29918,
3616,
29889,
15926,
1056,
29915,
13,
4706,
1583,
29889,
29873,
5830,
4338,
353,
6213,
13,
4706,
1583,
29889,
18513,
3782,
4637,
353,
518,
13,
308,
525,
21646,
29918,
29946,
29914,
18494,
29914,
4668,
29916,
29914,
29903,
29999,
29918,
9472,
29918,
18513,
29896,
29889,
468,
29887,
742,
13,
308,
525,
21646,
29918,
29946,
29914,
18494,
29914,
4668,
29916,
29914,
29903,
29999,
29918,
9472,
29918,
18513,
29906,
29889,
468,
29887,
742,
13,
308,
525,
21646,
29918,
29946,
29914,
18494,
29914,
4668,
29916,
29914,
29903,
29999,
29918,
9472,
29918,
18513,
29941,
29889,
468,
29887,
2033,
13,
4706,
736,
13,
13,
1678,
822,
2254,
29898,
1311,
1125,
13,
4706,
5701,
1725,
18482,
10036,
29889,
17618,
1725,
18482,
10036,
29889,
1359,
29898,
1311,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
517,
609,
776,
29918,
25171,
29918,
3571,
29918,
28307,
1718,
3155,
2824,
842,
13985,
29903,
2618,
29898,
29896,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
2057,
29918,
5064,
2824,
842,
29933,
262,
877,
2057,
742,
29871,
29896,
29947,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
2057,
29918,
2975,
20919,
2824,
842,
29933,
262,
877,
2057,
742,
29871,
29896,
29947,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
2057,
2824,
842,
29933,
262,
877,
2057,
742,
29871,
29896,
29947,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
2057,
29918,
5064,
29918,
22017,
2824,
842,
1625,
7459,
19832,
29898,
29907,
6259,
2127,
1338,
29889,
29943,
10102,
21591,
13168,
29897,
13,
4706,
1583,
29889,
479,
290,
29889,
2886,
877,
1068,
29914,
2057,
29918,
2975,
20919,
29918,
22017,
2824,
842,
1625,
7459,
19832,
29898,
29907,
6259,
2127,
1338,
29889,
29943,
10102,
21591,
13168,
29897,
13,
4706,
363,
26086,
297,
1583,
29889,
479,
290,
29889,
2886,
3596,
9652,
267,
877,
1068,
29914,
2324,
29873,
16163,
29918,
698,
29930,
29374,
13,
9651,
26086,
29889,
2886,
877,
1068,
29914,
29873,
16163,
29918,
14939,
29918,
29896,
2824,
12038,
545,
29898,
12657,
29889,
1359,
21898,
877,
21646,
29918,
29946,
29914,
9794,
29914,
484,
1141,
4089,
6614,
29879,
29914,
4776,
29914,
2975,
20919,
29890,
4708,
29889,
6173,
5477,
29871,
29896,
29897,
13,
13,
4706,
363,
5447,
297,
1583,
29889,
479,
290,
29889,
2886,
3596,
9652,
267,
877,
1068,
29914,
7728,
29918,
12692,
29918,
8336,
24563,
29918,
28307,
1718,
3155,
29374,
13,
9651,
716,
2713,
6986,
353,
23466,
29889,
1359,
3195,
877,
21646,
29918,
29941,
29914,
9794,
29914,
11030,
29914,
8865,
29918,
17505,
29889,
29890,
314,
1495,
13,
9651,
716,
2713,
6986,
29889,
276,
3560,
1762,
29898,
8336,
29897,
13,
9651,
716,
2713,
6986,
29889,
842,
17185,
29898,
29896,
29889,
29945,
29897,
13,
9651,
716,
2713,
6986,
29889,
842,
3306,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29896,
29897,
2
] |
util/__init__.py | TinDang97/face_recognition | 6 | 64123 | <gh_stars>1-10
import cv2
import numpy
def normalize_L2(x):
assert isinstance(x, numpy.ndarray)
return x / numpy.sqrt(numpy.sum((x ** 2), keepdims=True, axis=1))
def cosine_similarity(x1, x2, skip_normalize=False):
if type(x1) is list:
x1 = numpy.array(x1)
if type(x2) is list:
x2 = numpy.array(x2)
assert type(x1) is numpy.ndarray or type(x2) is numpy.ndarray
assert x1.shape[-1] == x2.shape[-1]
assert len(x1.shape) == 2
if not skip_normalize:
x1 = normalize_L2(x1)
x2 = normalize_L2(x2)
return numpy.dot(x1, x2.T)
def draw_square(img, position, color=(0, 255, 0)) -> numpy.ndarray:
"""
Draw text at position in image.
- position: top-left, bottom-right of square
- color: support tuple and hex_color
:return:
"""
if not isinstance(position, tuple):
position = tuple(position)
return cv2.rectangle(img, position[0:2], position[2:4], color, 2)
def show_image(img, windows_name, windows_size=(1280, 720), windows_mode=cv2.WINDOW_NORMAL, wait_time=1,
key_press_exit="q"):
"""
Show image in RGB format
Parameters
----------
img: numpy.ndarray
image array
windows_name: str
Title of window
windows_size: tuple[int, int]
(Default: SD_RESOLUTION) size of window
windows_mode: int
(Default: cv2.WINDOW_NORMAL) Mode of window
wait_time: int
Block time. (-1: infinite)
key_press_exit: str
Key stop event.
Returns
-------
bool
True - Stop event from user
"""
cv2.namedWindow(windows_name, windows_mode)
cv2.imshow(windows_name, img[:, :, ::-1])
cv2.resizeWindow(windows_name, *windows_size)
if cv2.waitKey(wait_time) & 0xFF == ord(key_press_exit):
cv2.destroyWindow(windows_name)
return False
return True
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
13850,
29906,
13,
5215,
12655,
13,
13,
13,
1753,
4226,
675,
29918,
29931,
29906,
29898,
29916,
1125,
13,
1678,
4974,
338,
8758,
29898,
29916,
29892,
12655,
29889,
299,
2378,
29897,
13,
1678,
736,
921,
847,
12655,
29889,
3676,
29898,
23749,
29889,
2083,
3552,
29916,
3579,
29871,
29906,
511,
3013,
6229,
29879,
29922,
5574,
29892,
9685,
29922,
29896,
876,
13,
13,
13,
1753,
6776,
457,
29918,
29764,
537,
29898,
29916,
29896,
29892,
921,
29906,
29892,
14383,
29918,
8945,
675,
29922,
8824,
1125,
13,
1678,
565,
1134,
29898,
29916,
29896,
29897,
338,
1051,
29901,
13,
4706,
921,
29896,
353,
12655,
29889,
2378,
29898,
29916,
29896,
29897,
13,
13,
1678,
565,
1134,
29898,
29916,
29906,
29897,
338,
1051,
29901,
13,
4706,
921,
29906,
353,
12655,
29889,
2378,
29898,
29916,
29906,
29897,
13,
13,
1678,
4974,
1134,
29898,
29916,
29896,
29897,
338,
12655,
29889,
299,
2378,
470,
1134,
29898,
29916,
29906,
29897,
338,
12655,
29889,
299,
2378,
13,
1678,
4974,
921,
29896,
29889,
12181,
14352,
29896,
29962,
1275,
921,
29906,
29889,
12181,
14352,
29896,
29962,
13,
1678,
4974,
7431,
29898,
29916,
29896,
29889,
12181,
29897,
1275,
29871,
29906,
13,
13,
1678,
565,
451,
14383,
29918,
8945,
675,
29901,
13,
4706,
921,
29896,
353,
4226,
675,
29918,
29931,
29906,
29898,
29916,
29896,
29897,
13,
4706,
921,
29906,
353,
4226,
675,
29918,
29931,
29906,
29898,
29916,
29906,
29897,
13,
1678,
736,
12655,
29889,
6333,
29898,
29916,
29896,
29892,
921,
29906,
29889,
29911,
29897,
13,
13,
13,
1753,
4216,
29918,
17619,
29898,
2492,
29892,
2602,
29892,
2927,
7607,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
876,
1599,
12655,
29889,
299,
2378,
29901,
13,
1678,
9995,
13,
1678,
18492,
1426,
472,
2602,
297,
1967,
29889,
13,
1678,
448,
2602,
29901,
2246,
29899,
1563,
29892,
5970,
29899,
1266,
310,
6862,
13,
1678,
448,
2927,
29901,
2304,
18761,
322,
15090,
29918,
2780,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
565,
451,
338,
8758,
29898,
3283,
29892,
18761,
1125,
13,
4706,
2602,
353,
18761,
29898,
3283,
29897,
13,
13,
1678,
736,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
2602,
29961,
29900,
29901,
29906,
1402,
2602,
29961,
29906,
29901,
29946,
1402,
2927,
29892,
29871,
29906,
29897,
13,
13,
13,
1753,
1510,
29918,
3027,
29898,
2492,
29892,
5417,
29918,
978,
29892,
5417,
29918,
2311,
7607,
29896,
29906,
29947,
29900,
29892,
29871,
29955,
29906,
29900,
511,
5417,
29918,
8513,
29922,
11023,
29906,
29889,
25152,
3970,
29956,
29918,
29940,
1955,
1529,
29931,
29892,
4480,
29918,
2230,
29922,
29896,
29892,
13,
1669,
1820,
29918,
2139,
29918,
13322,
543,
29939,
29908,
1125,
13,
1678,
9995,
13,
1678,
7704,
1967,
297,
390,
7210,
3402,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
10153,
29901,
12655,
29889,
299,
2378,
13,
4706,
1967,
1409,
13,
13,
1678,
5417,
29918,
978,
29901,
851,
13,
4706,
18527,
310,
3474,
13,
13,
1678,
5417,
29918,
2311,
29901,
18761,
29961,
524,
29892,
938,
29962,
13,
4706,
313,
4592,
29901,
8073,
29918,
15989,
5607,
2692,
2725,
29897,
2159,
310,
3474,
13,
13,
1678,
5417,
29918,
8513,
29901,
938,
13,
4706,
313,
4592,
29901,
13850,
29906,
29889,
25152,
3970,
29956,
29918,
29940,
1955,
1529,
29931,
29897,
21864,
310,
3474,
13,
13,
1678,
4480,
29918,
2230,
29901,
938,
13,
4706,
15658,
931,
29889,
8521,
29896,
29901,
10362,
29897,
13,
13,
1678,
1820,
29918,
2139,
29918,
13322,
29901,
851,
13,
4706,
7670,
5040,
1741,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
6120,
13,
4706,
5852,
448,
22303,
1741,
515,
1404,
13,
1678,
9995,
13,
1678,
13850,
29906,
29889,
17514,
5907,
29898,
10499,
29918,
978,
29892,
5417,
29918,
8513,
29897,
13,
1678,
13850,
29906,
29889,
326,
4294,
29898,
10499,
29918,
978,
29892,
10153,
7503,
29892,
584,
29892,
4761,
29899,
29896,
2314,
13,
1678,
13850,
29906,
29889,
21476,
5907,
29898,
10499,
29918,
978,
29892,
334,
10499,
29918,
2311,
29897,
13,
13,
1678,
565,
13850,
29906,
29889,
10685,
2558,
29898,
10685,
29918,
2230,
29897,
669,
29871,
29900,
29916,
4198,
1275,
4356,
29898,
1989,
29918,
2139,
29918,
13322,
1125,
13,
4706,
13850,
29906,
29889,
20524,
5907,
29898,
10499,
29918,
978,
29897,
13,
4706,
736,
7700,
13,
1678,
736,
5852,
13,
2
] |
scout/server/blueprints/login/views.py | szilvajuhos/scout | 0 | 1610778 | # -*- coding: utf-8 -*-
from datetime import datetime
from flask import (abort, current_app, Blueprint, flash, redirect, request,
session, url_for, render_template)
from flask_login import login_user, logout_user
from flask_oauthlib.client import OAuthException
from flask_ldap3_login.forms import LDAPLoginForm
from flask_ldap3_login import AuthenticationResponseStatus
from scout.server.extensions import google, login_manager, store, ldap_manager
from scout.server.utils import public_endpoint
from . import controllers
from .models import LoginUser, LdapUser
import logging
LOG = logging.getLogger(__name__)
login_bp = Blueprint('login', __name__, template_folder='templates',
static_folder='static', static_url_path='/login/static')
login_manager.login_view = 'login.login'
login_manager.login_message = 'Please log in to access this page.'
login_manager.login_message_category = 'info'
ldap_users = {} # used by ldap save_user
@login_manager.user_loader
def load_user(user_id):
"""Returns the currently active user as an object."""
user_obj = store.user(user_id)
user_inst = LoginUser(user_obj) if user_obj else None
return user_inst
@google.tokengetter
def get_google_token():
"""Returns a tuple of Google tokens, if they exist"""
return session.get('google_token')
@login_bp.route('/login', methods=['GET', 'POST'])
@public_endpoint
def login():
"""Login a user if they have access."""
if 'next' in request.args:
session['next_url'] = request.args['next']
user_id = None
if current_app.config.get('LDAP_HOST') and request.method=='POST':
form = LDAPLoginForm()
LOG.info('Validating LDAP user')
if form.validate_on_submit():
user_id = form.username.data
else:
flash("username-password combination is not valid, plase try again", "warning")
return redirect(url_for('public.index'))
if current_app.config.get('GOOGLE'):
if session.get('email'):
user_id = session['email']
session.pop('email')
else:
LOG.info('Validating Google user login')
callback_url = url_for('.authorized', _external=True)
return google.authorize(callback=callback_url)
if request.args.get('email'): # log in against Scout database
user_id = request.args.get('email')
LOG.info('Validating user {} against Scout database'.format(user_id))
user_obj = store.user(user_id)
if user_obj is None:
flash("User not whitelisted", 'warning')
return redirect(url_for('public.index'))
user_obj['accessed_at'] = datetime.now()
if session.get('name'): # These args come from google auth
user_obj['name'] = session.get('name')
user_obj['locale'] = session.get('locale')
store.update_user(user_obj)
user_dict = LoginUser(user_obj)
return perform_login(user_dict)
@login_bp.route('/logout')
def logout():
logout_user()
flash('you logged out', 'success')
return redirect(url_for('public.index'))
@login_bp.route('/authorized')
@public_endpoint
def authorized():
oauth_response = None
try:
oauth_response = google.authorized_response()
except OAuthException as error:
current_app.logger.warning(oauth_response.message)
flash("{} - try again!".format(oauth_response.message), 'warning')
return redirect(url_for('public.index'))
if oauth_response is None:
flash("Access denied: reason={} error={}"
.format(request.args.get['error_reason'],
request.args['error_description']), 'danger')
return abort(403)
# add token to session, do it before validation to be able to fetch
# additional data (like email) on the authenticated user
session['google_token'] = (oauth_response['access_token'], '')
# get additional user info with the access token
google_user = google.get('userinfo')
google_data = google_user.data
session['email'] = google_data['email'].lower()
session['name'] = google_data['name']
session['locale'] = google_data['locale']
return redirect(url_for('login.login'))
@login_bp.route('/users')
def users():
"""Show all users in the system."""
data = controllers.users(store)
return render_template('login/users.html', **data)
def perform_login(user_dict):
if login_user(user_dict, remember=True):
flash("you logged in as: {}".format(user_dict.name), 'success')
next_url = session.pop('next_url', None)
return redirect(request.args.get('next') or next_url or url_for('cases.index'))
else:
flash('sorry, you could not log in', 'warning')
return redirect(url_for('public.index'))
@ldap_manager.save_user
def save_user(dn, username, data, memberships):
user = LdapUser(dn, username, data)
ldap_users[dn] = user
return user
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
3166,
12865,
1053,
12865,
13,
13,
3166,
29784,
1053,
313,
370,
441,
29892,
1857,
29918,
932,
29892,
10924,
2158,
29892,
11013,
29892,
6684,
29892,
2009,
29892,
13,
462,
259,
4867,
29892,
3142,
29918,
1454,
29892,
4050,
29918,
6886,
29897,
13,
3166,
29784,
29918,
7507,
1053,
6464,
29918,
1792,
29892,
1480,
449,
29918,
1792,
13,
3166,
29784,
29918,
23106,
1982,
29889,
4645,
1053,
438,
6444,
2451,
13,
3166,
29784,
29918,
430,
481,
29941,
29918,
7507,
29889,
9514,
1053,
365,
29928,
3301,
11049,
2500,
13,
3166,
29784,
29918,
430,
481,
29941,
29918,
7507,
1053,
27241,
5103,
5709,
13,
13,
3166,
885,
449,
29889,
2974,
29889,
24299,
1053,
5386,
29892,
6464,
29918,
12847,
29892,
3787,
29892,
301,
29881,
481,
29918,
12847,
13,
3166,
885,
449,
29889,
2974,
29889,
13239,
1053,
970,
29918,
29734,
13,
3166,
869,
1053,
21385,
13,
3166,
869,
9794,
1053,
19130,
2659,
29892,
365,
29881,
481,
2659,
13,
13,
5215,
12183,
13,
14480,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
7507,
29918,
25288,
353,
10924,
2158,
877,
7507,
742,
4770,
978,
1649,
29892,
4472,
29918,
12083,
2433,
20943,
742,
13,
462,
268,
2294,
29918,
12083,
2433,
7959,
742,
2294,
29918,
2271,
29918,
2084,
2433,
29914,
7507,
29914,
7959,
1495,
13,
13,
7507,
29918,
12847,
29889,
7507,
29918,
1493,
353,
525,
7507,
29889,
7507,
29915,
13,
7507,
29918,
12847,
29889,
7507,
29918,
4906,
353,
525,
12148,
1480,
297,
304,
2130,
445,
1813,
6169,
13,
7507,
29918,
12847,
29889,
7507,
29918,
4906,
29918,
7320,
353,
525,
3888,
29915,
13,
13,
430,
481,
29918,
7193,
353,
6571,
396,
1304,
491,
301,
29881,
481,
4078,
29918,
1792,
13,
13,
29992,
7507,
29918,
12847,
29889,
1792,
29918,
12657,
13,
1753,
2254,
29918,
1792,
29898,
1792,
29918,
333,
1125,
13,
1678,
9995,
11609,
29879,
278,
5279,
6136,
1404,
408,
385,
1203,
1213,
15945,
13,
1678,
1404,
29918,
5415,
353,
3787,
29889,
1792,
29898,
1792,
29918,
333,
29897,
13,
1678,
1404,
29918,
2611,
353,
19130,
2659,
29898,
1792,
29918,
5415,
29897,
565,
1404,
29918,
5415,
1683,
6213,
13,
1678,
736,
1404,
29918,
2611,
13,
13,
13,
29992,
3608,
29889,
6979,
657,
357,
13,
1753,
679,
29918,
3608,
29918,
6979,
7295,
13,
1678,
9995,
11609,
29879,
263,
18761,
310,
5087,
18897,
29892,
565,
896,
1863,
15945,
29908,
13,
1678,
736,
4867,
29889,
657,
877,
3608,
29918,
6979,
1495,
13,
13,
13,
29992,
7507,
29918,
25288,
29889,
13134,
11219,
7507,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
29992,
3597,
29918,
29734,
13,
1753,
6464,
7295,
13,
1678,
9995,
11049,
263,
1404,
565,
896,
505,
2130,
1213,
15945,
13,
1678,
565,
525,
4622,
29915,
297,
2009,
29889,
5085,
29901,
13,
4706,
4867,
1839,
4622,
29918,
2271,
2033,
353,
2009,
29889,
5085,
1839,
4622,
2033,
13,
13,
1678,
1404,
29918,
333,
353,
6213,
13,
1678,
565,
1857,
29918,
932,
29889,
2917,
29889,
657,
877,
10249,
3301,
29918,
20832,
1495,
322,
2009,
29889,
5696,
1360,
29915,
5438,
2396,
13,
4706,
883,
353,
365,
29928,
3301,
11049,
2500,
580,
13,
4706,
25401,
29889,
3888,
877,
7211,
1218,
365,
29928,
3301,
1404,
1495,
13,
4706,
565,
883,
29889,
15480,
29918,
265,
29918,
7892,
7295,
13,
9651,
1404,
29918,
333,
353,
883,
29889,
6786,
29889,
1272,
13,
4706,
1683,
29901,
13,
9651,
11013,
703,
6786,
29899,
5630,
10296,
338,
451,
2854,
29892,
715,
559,
1018,
1449,
613,
376,
27392,
1159,
13,
9651,
736,
6684,
29898,
2271,
29918,
1454,
877,
3597,
29889,
2248,
8785,
13,
13,
1678,
565,
1857,
29918,
932,
29889,
2917,
29889,
657,
877,
17080,
29949,
29954,
1307,
29374,
13,
4706,
565,
4867,
29889,
657,
877,
5269,
29374,
13,
9651,
1404,
29918,
333,
353,
4867,
1839,
5269,
2033,
13,
9651,
4867,
29889,
7323,
877,
5269,
1495,
13,
4706,
1683,
29901,
13,
9651,
25401,
29889,
3888,
877,
7211,
1218,
5087,
1404,
6464,
1495,
13,
9651,
6939,
29918,
2271,
353,
3142,
29918,
1454,
12839,
8921,
1891,
742,
903,
23176,
29922,
5574,
29897,
13,
9651,
736,
5386,
29889,
8921,
675,
29898,
14035,
29922,
14035,
29918,
2271,
29897,
13,
13,
1678,
565,
2009,
29889,
5085,
29889,
657,
877,
5269,
29374,
29871,
396,
1480,
297,
2750,
2522,
449,
2566,
13,
4706,
1404,
29918,
333,
353,
2009,
29889,
5085,
29889,
657,
877,
5269,
1495,
13,
4706,
25401,
29889,
3888,
877,
7211,
1218,
1404,
6571,
2750,
2522,
449,
2566,
4286,
4830,
29898,
1792,
29918,
333,
876,
13,
13,
1678,
1404,
29918,
5415,
353,
3787,
29889,
1792,
29898,
1792,
29918,
333,
29897,
13,
1678,
565,
1404,
29918,
5415,
338,
6213,
29901,
13,
4706,
11013,
703,
2659,
451,
377,
7454,
12652,
613,
525,
27392,
1495,
13,
4706,
736,
6684,
29898,
2271,
29918,
1454,
877,
3597,
29889,
2248,
8785,
13,
13,
1678,
1404,
29918,
5415,
1839,
5943,
287,
29918,
271,
2033,
353,
12865,
29889,
3707,
580,
13,
1678,
565,
4867,
29889,
657,
877,
978,
29374,
396,
4525,
6389,
2041,
515,
5386,
4817,
13,
4706,
1404,
29918,
5415,
1839,
978,
2033,
353,
4867,
29889,
657,
877,
978,
1495,
13,
4706,
1404,
29918,
5415,
1839,
23337,
2033,
353,
4867,
29889,
657,
877,
23337,
1495,
13,
1678,
3787,
29889,
5504,
29918,
1792,
29898,
1792,
29918,
5415,
29897,
13,
13,
1678,
1404,
29918,
8977,
353,
19130,
2659,
29898,
1792,
29918,
5415,
29897,
13,
1678,
736,
2189,
29918,
7507,
29898,
1792,
29918,
8977,
29897,
13,
13,
13,
29992,
7507,
29918,
25288,
29889,
13134,
11219,
1188,
449,
1495,
13,
1753,
1480,
449,
7295,
13,
1678,
1480,
449,
29918,
1792,
580,
13,
1678,
11013,
877,
6293,
13817,
714,
742,
525,
8698,
1495,
13,
1678,
736,
6684,
29898,
2271,
29918,
1454,
877,
3597,
29889,
2248,
8785,
13,
13,
29992,
7507,
29918,
25288,
29889,
13134,
11219,
8921,
1891,
1495,
13,
29992,
3597,
29918,
29734,
13,
1753,
4148,
1891,
7295,
13,
1678,
288,
5150,
29918,
5327,
353,
6213,
13,
1678,
1018,
29901,
13,
4706,
288,
5150,
29918,
5327,
353,
5386,
29889,
8921,
1891,
29918,
5327,
580,
13,
1678,
5174,
438,
6444,
2451,
408,
1059,
29901,
13,
4706,
1857,
29918,
932,
29889,
21707,
29889,
27392,
29898,
23106,
29918,
5327,
29889,
4906,
29897,
13,
4706,
11013,
703,
8875,
448,
1018,
1449,
29991,
1642,
4830,
29898,
23106,
29918,
5327,
29889,
4906,
511,
525,
27392,
1495,
13,
4706,
736,
6684,
29898,
2271,
29918,
1454,
877,
3597,
29889,
2248,
8785,
13,
13,
1678,
565,
288,
5150,
29918,
5327,
338,
6213,
29901,
13,
4706,
11013,
703,
6638,
17935,
29901,
2769,
3790,
29913,
1059,
3790,
5038,
13,
795,
869,
4830,
29898,
3827,
29889,
5085,
29889,
657,
1839,
2704,
29918,
23147,
7464,
13,
462,
418,
2009,
29889,
5085,
1839,
2704,
29918,
8216,
2033,
511,
525,
29881,
4600,
1495,
13,
4706,
736,
27450,
29898,
29946,
29900,
29941,
29897,
13,
13,
1678,
396,
788,
5993,
304,
4867,
29892,
437,
372,
1434,
8845,
304,
367,
2221,
304,
6699,
13,
1678,
396,
5684,
848,
313,
4561,
4876,
29897,
373,
278,
15585,
630,
1404,
13,
1678,
4867,
1839,
3608,
29918,
6979,
2033,
353,
313,
23106,
29918,
5327,
1839,
5943,
29918,
6979,
7464,
27255,
13,
13,
1678,
396,
679,
5684,
1404,
5235,
411,
278,
2130,
5993,
13,
1678,
5386,
29918,
1792,
353,
5386,
29889,
657,
877,
1792,
3888,
1495,
13,
1678,
5386,
29918,
1272,
353,
5386,
29918,
1792,
29889,
1272,
13,
13,
1678,
4867,
1839,
5269,
2033,
353,
5386,
29918,
1272,
1839,
5269,
13359,
13609,
580,
13,
1678,
4867,
1839,
978,
2033,
353,
5386,
29918,
1272,
1839,
978,
2033,
13,
1678,
4867,
1839,
23337,
2033,
353,
5386,
29918,
1272,
1839,
23337,
2033,
13,
13,
1678,
736,
6684,
29898,
2271,
29918,
1454,
877,
7507,
29889,
7507,
8785,
13,
13,
13,
29992,
7507,
29918,
25288,
29889,
13134,
11219,
7193,
1495,
13,
1753,
4160,
7295,
13,
1678,
9995,
8964,
599,
4160,
297,
278,
1788,
1213,
15945,
13,
1678,
848,
353,
21385,
29889,
7193,
29898,
8899,
29897,
13,
1678,
736,
4050,
29918,
6886,
877,
7507,
29914,
7193,
29889,
1420,
742,
3579,
1272,
29897,
13,
13,
1753,
2189,
29918,
7507,
29898,
1792,
29918,
8977,
1125,
13,
1678,
565,
6464,
29918,
1792,
29898,
1792,
29918,
8977,
29892,
6456,
29922,
5574,
1125,
13,
4706,
11013,
703,
6293,
13817,
297,
408,
29901,
6571,
1642,
4830,
29898,
1792,
29918,
8977,
29889,
978,
511,
525,
8698,
1495,
13,
4706,
2446,
29918,
2271,
353,
4867,
29889,
7323,
877,
4622,
29918,
2271,
742,
6213,
29897,
13,
4706,
736,
6684,
29898,
3827,
29889,
5085,
29889,
657,
877,
4622,
1495,
470,
2446,
29918,
2271,
470,
3142,
29918,
1454,
877,
11436,
29889,
2248,
8785,
13,
1678,
1683,
29901,
13,
4706,
11013,
877,
29879,
3818,
29892,
366,
1033,
451,
1480,
297,
742,
525,
27392,
1495,
13,
4706,
736,
6684,
29898,
2271,
29918,
1454,
877,
3597,
29889,
2248,
8785,
13,
13,
29992,
430,
481,
29918,
12847,
29889,
7620,
29918,
1792,
13,
1753,
4078,
29918,
1792,
29898,
5200,
29892,
8952,
29892,
848,
29892,
5144,
14587,
1125,
13,
1678,
1404,
353,
365,
29881,
481,
2659,
29898,
5200,
29892,
8952,
29892,
848,
29897,
13,
1678,
301,
29881,
481,
29918,
7193,
29961,
5200,
29962,
353,
1404,
13,
1678,
736,
1404,
13,
2
] |
feature/functions/feature_selection.py | manaranjoc/ResonanceImageClassification | 0 | 182297 | import numpy as np
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
from sklearn.model_selection import KFold
from sklearn.feature_selection import SelectPercentile, mutual_info_classif
import sys
from pathlib import Path
sys.path[0] = str(Path(sys.path[0]).parent)
from metrics import metrics, meanMetrics, stdMetrics, printMetrics
import time
def select_features(classifier, n_features, fwd, fltg):
sfs = SFS(classifier,
k_features=n_features,
forward=fwd,
floating=fltg,
verbose=1,
scoring='accuracy',
cv=10,
n_jobs=-1)
return sfs
def select_features_number(classifier, number_features, fwd, fltg, X, Y):
tiempo_i = time.time()
Errores = np.ones(10)
Metrics = np.zeros((10,5))
j = 0
kf = KFold(n_splits=10)
clf = classifier
sf = select_features(clf, number_features, fwd, fltg)
sf = sf.fit(X, Y)
X_sf = sf.transform(X)
for train_index, test_index in kf.split(X_sf):
X_train, X_test = X_sf[train_index], X_sf[test_index]
y_train, y_test = Y[train_index], Y[test_index]
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
Errores[j] = 1-metrics(y_test,y_pred)[0]
Metrics[j,:] = metrics(y_test, y_pred)
j+=1
print("\nError de validación aplicando SFS: "+str(np.mean(Errores))+"+/-"+str(np.std(Errores)))
print("\nEficiencia en validación aplicando SFS: "+str((1-np.mean(Errores))*100)+"%")
print("\nTiempo total de ejecución: "+str(time.time()-tiempo_i)+" segundos.")
MetricsMean = meanMetrics(Metrics)
MetricsStd = stdMetrics(Metrics)
printMetrics(MetricsMean)
print("\nDesviaciones Estandard")
printMetrics(MetricsStd)
return sf
def select_features_filter_percentage(classifier, percentage, X, Y):
tiempo_i = time.time()
Errores = np.ones(10)
Metrics = np.zeros((10,5))
j = 0
kf = KFold(n_splits=10)
filter_method = SelectPercentile(mutual_info_classif, percentile=percentage)
filter_method.fit(X,Y)
X_sf = filter_method.transform(X)
for train_index, test_index in kf.split(X_sf):
X_train, X_test = X_sf[train_index], X_sf[test_index]
y_train, y_test = Y[train_index], Y[test_index]
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
Metrics[j,:] = metrics(y_test, y_pred)
Errores[j] = 1-metrics(y_test,y_pred)[0]
j+=1
print("\nError de validación aplicando at "+str(percentage)+"%: "+str(np.mean(Errores))+"+/-"+str(np.std(Errores)))
print("\nEficiencia en validación aplicando at "+str(percentage)+"%: "+str((1-np.mean(Errores))*100)+"%")
print("\nTiempo total de ejecución: "+str(time.time()-tiempo_i)+" segundos.")
MetricsMean = meanMetrics(Metrics)
MetricsStd = stdMetrics(Metrics)
printMetrics(MetricsMean)
print("\nDesviaciones Estandard")
printMetrics(MetricsStd)
return filter_method
| [
1,
1053,
12655,
408,
7442,
13,
3166,
286,
29880,
486,
355,
29889,
14394,
29918,
21731,
1053,
922,
339,
2556,
19132,
10378,
408,
317,
9998,
13,
3166,
2071,
19668,
29889,
4299,
29918,
21731,
1053,
476,
29943,
1025,
13,
3166,
2071,
19668,
29889,
14394,
29918,
21731,
1053,
7605,
27933,
488,
29892,
5478,
950,
29918,
3888,
29918,
1990,
361,
13,
13,
5215,
10876,
13,
3166,
2224,
1982,
1053,
10802,
13,
9675,
29889,
2084,
29961,
29900,
29962,
353,
851,
29898,
2605,
29898,
9675,
29889,
2084,
29961,
29900,
14664,
3560,
29897,
13,
13,
3166,
21556,
1053,
21556,
29892,
2099,
10095,
10817,
29892,
3659,
10095,
10817,
29892,
1596,
10095,
10817,
13,
13,
5215,
931,
13,
13,
1753,
1831,
29918,
22100,
29898,
1990,
3709,
29892,
302,
29918,
22100,
29892,
285,
9970,
29892,
1652,
29873,
29887,
1125,
13,
13,
1678,
269,
5847,
353,
317,
9998,
29898,
1990,
3709,
29892,
13,
4706,
413,
29918,
22100,
29922,
29876,
29918,
22100,
29892,
13,
4706,
6375,
29922,
29888,
9970,
29892,
13,
4706,
16526,
29922,
1579,
29873,
29887,
29892,
13,
4706,
26952,
29922,
29896,
29892,
13,
4706,
26654,
2433,
562,
2764,
4135,
742,
13,
4706,
13850,
29922,
29896,
29900,
29892,
13,
4706,
302,
29918,
9057,
29879,
10457,
29896,
29897,
13,
13,
1678,
736,
269,
5847,
13,
13,
1753,
1831,
29918,
22100,
29918,
4537,
29898,
1990,
3709,
29892,
1353,
29918,
22100,
29892,
285,
9970,
29892,
1652,
29873,
29887,
29892,
1060,
29892,
612,
1125,
13,
1678,
13924,
29918,
29875,
353,
931,
29889,
2230,
580,
13,
13,
1678,
4829,
267,
353,
7442,
29889,
2873,
29898,
29896,
29900,
29897,
13,
1678,
4737,
10817,
353,
7442,
29889,
3298,
359,
3552,
29896,
29900,
29892,
29945,
876,
13,
1678,
432,
353,
29871,
29900,
13,
1678,
413,
29888,
353,
476,
29943,
1025,
29898,
29876,
29918,
23579,
1169,
29922,
29896,
29900,
29897,
13,
1678,
1067,
29888,
353,
770,
3709,
13,
13,
1678,
18668,
353,
1831,
29918,
22100,
29898,
695,
29888,
29892,
1353,
29918,
22100,
29892,
285,
9970,
29892,
1652,
29873,
29887,
29897,
13,
13,
1678,
18668,
353,
18668,
29889,
9202,
29898,
29990,
29892,
612,
29897,
13,
13,
1678,
1060,
29918,
4668,
353,
18668,
29889,
9067,
29898,
29990,
29897,
13,
13,
1678,
363,
7945,
29918,
2248,
29892,
1243,
29918,
2248,
297,
413,
29888,
29889,
5451,
29898,
29990,
29918,
4668,
1125,
13,
13,
4706,
1060,
29918,
14968,
29892,
1060,
29918,
1688,
353,
1060,
29918,
4668,
29961,
14968,
29918,
2248,
1402,
1060,
29918,
4668,
29961,
1688,
29918,
2248,
29962,
13,
4706,
343,
29918,
14968,
29892,
343,
29918,
1688,
353,
612,
29961,
14968,
29918,
2248,
1402,
612,
29961,
1688,
29918,
2248,
29962,
13,
13,
4706,
770,
3709,
29889,
9202,
29898,
29990,
29918,
14968,
29892,
343,
29918,
14968,
29897,
13,
4706,
343,
29918,
11965,
353,
770,
3709,
29889,
27711,
29898,
29990,
29918,
1688,
29897,
13,
13,
4706,
4829,
267,
29961,
29926,
29962,
353,
29871,
29896,
29899,
2527,
10817,
29898,
29891,
29918,
1688,
29892,
29891,
29918,
11965,
9601,
29900,
29962,
13,
4706,
4737,
10817,
29961,
29926,
29892,
17531,
353,
21556,
29898,
29891,
29918,
1688,
29892,
343,
29918,
11965,
29897,
13,
4706,
432,
23661,
29896,
13,
13,
1678,
1596,
14182,
29876,
2392,
316,
659,
1458,
1290,
20760,
1743,
317,
9998,
29901,
15691,
710,
29898,
9302,
29889,
12676,
29898,
2392,
267,
876,
13578,
29974,
24028,
17969,
710,
29898,
9302,
29889,
4172,
29898,
2392,
267,
4961,
13,
1678,
1596,
14182,
29876,
29923,
9639,
24748,
427,
659,
1458,
1290,
20760,
1743,
317,
9998,
29901,
15691,
710,
3552,
29896,
29899,
9302,
29889,
12676,
29898,
2392,
267,
876,
29930,
29896,
29900,
29900,
7240,
29908,
29995,
1159,
13,
1678,
1596,
14182,
29876,
29911,
3768,
1129,
3001,
316,
25830,
16249,
29901,
15691,
710,
29898,
2230,
29889,
2230,
580,
29899,
2034,
331,
1129,
29918,
29875,
7240,
29908,
2377,
870,
359,
23157,
13,
268,
13,
1678,
4737,
10817,
6816,
273,
353,
2099,
10095,
10817,
29898,
10095,
10817,
29897,
13,
1678,
4737,
10817,
855,
29881,
353,
3659,
10095,
10817,
29898,
10095,
10817,
29897,
13,
13,
1678,
1596,
10095,
10817,
29898,
10095,
10817,
6816,
273,
29897,
13,
1678,
1596,
14182,
29876,
4002,
6071,
17593,
382,
15770,
1159,
13,
1678,
1596,
10095,
10817,
29898,
10095,
10817,
855,
29881,
29897,
13,
13,
1678,
736,
18668,
13,
13,
1753,
1831,
29918,
22100,
29918,
4572,
29918,
25376,
482,
29898,
1990,
3709,
29892,
19649,
29892,
1060,
29892,
612,
1125,
13,
1678,
13924,
29918,
29875,
353,
931,
29889,
2230,
580,
13,
13,
1678,
4829,
267,
353,
7442,
29889,
2873,
29898,
29896,
29900,
29897,
13,
1678,
4737,
10817,
353,
7442,
29889,
3298,
359,
3552,
29896,
29900,
29892,
29945,
876,
13,
1678,
432,
353,
29871,
29900,
13,
1678,
413,
29888,
353,
476,
29943,
1025,
29898,
29876,
29918,
23579,
1169,
29922,
29896,
29900,
29897,
13,
13,
1678,
4175,
29918,
5696,
353,
7605,
27933,
488,
29898,
6149,
950,
29918,
3888,
29918,
1990,
361,
29892,
10151,
488,
29922,
25376,
482,
29897,
13,
13,
1678,
4175,
29918,
5696,
29889,
9202,
29898,
29990,
29892,
29979,
29897,
13,
13,
1678,
1060,
29918,
4668,
353,
4175,
29918,
5696,
29889,
9067,
29898,
29990,
29897,
13,
13,
1678,
363,
7945,
29918,
2248,
29892,
1243,
29918,
2248,
297,
413,
29888,
29889,
5451,
29898,
29990,
29918,
4668,
1125,
13,
13,
4706,
1060,
29918,
14968,
29892,
1060,
29918,
1688,
353,
1060,
29918,
4668,
29961,
14968,
29918,
2248,
1402,
1060,
29918,
4668,
29961,
1688,
29918,
2248,
29962,
13,
4706,
343,
29918,
14968,
29892,
343,
29918,
1688,
353,
612,
29961,
14968,
29918,
2248,
1402,
612,
29961,
1688,
29918,
2248,
29962,
13,
13,
4706,
770,
3709,
29889,
9202,
29898,
29990,
29918,
14968,
29892,
343,
29918,
14968,
29897,
13,
4706,
343,
29918,
11965,
353,
770,
3709,
29889,
27711,
29898,
29990,
29918,
1688,
29897,
13,
13,
4706,
4737,
10817,
29961,
29926,
29892,
17531,
353,
21556,
29898,
29891,
29918,
1688,
29892,
343,
29918,
11965,
29897,
13,
4706,
4829,
267,
29961,
29926,
29962,
353,
29871,
29896,
29899,
2527,
10817,
29898,
29891,
29918,
1688,
29892,
29891,
29918,
11965,
9601,
29900,
29962,
13,
4706,
432,
23661,
29896,
13,
268,
13,
13,
1678,
1596,
14182,
29876,
2392,
316,
659,
1458,
1290,
20760,
1743,
472,
15691,
710,
29898,
25376,
482,
7240,
29908,
29995,
29901,
15691,
710,
29898,
9302,
29889,
12676,
29898,
2392,
267,
876,
13578,
29974,
24028,
17969,
710,
29898,
9302,
29889,
4172,
29898,
2392,
267,
4961,
13,
1678,
1596,
14182,
29876,
29923,
9639,
24748,
427,
659,
1458,
1290,
20760,
1743,
472,
15691,
710,
29898,
25376,
482,
7240,
29908,
29995,
29901,
15691,
710,
3552,
29896,
29899,
9302,
29889,
12676,
29898,
2392,
267,
876,
29930,
29896,
29900,
29900,
7240,
29908,
29995,
1159,
13,
1678,
1596,
14182,
29876,
29911,
3768,
1129,
3001,
316,
25830,
16249,
29901,
15691,
710,
29898,
2230,
29889,
2230,
580,
29899,
2034,
331,
1129,
29918,
29875,
7240,
29908,
2377,
870,
359,
23157,
13,
268,
13,
1678,
4737,
10817,
6816,
273,
353,
2099,
10095,
10817,
29898,
10095,
10817,
29897,
13,
1678,
4737,
10817,
855,
29881,
353,
3659,
10095,
10817,
29898,
10095,
10817,
29897,
13,
13,
1678,
1596,
10095,
10817,
29898,
10095,
10817,
6816,
273,
29897,
13,
1678,
1596,
14182,
29876,
4002,
6071,
17593,
382,
15770,
1159,
13,
1678,
1596,
10095,
10817,
29898,
10095,
10817,
855,
29881,
29897,
13,
13,
1678,
736,
4175,
29918,
5696,
13,
268,
13,
2
] |
Bin/RepoTools/Scripts/GithubTools/github_preparation.py | stinvi/dava.engine | 26 | 170170 | #!/usr/bin/env python
import sys
import os
import argparse
import subprocess
class Preparation:
system_list = set(['.gitattributes', '.gitignore', '.gitmodules'])
white_list = set()
clear_list = set(['Bin/RepoTools/Scripts/GithubTools/white_list.txt', 'Bin/RepoTools/Scripts/GithubTools/github_preparation.py'])
def __init__(self, base_path):
self.base_path = os.path.abspath(base_path)
self.read_white_list()
self.read_white_list()
self.do()
def read_white_list(self):
try:
files_list = open(os.path.abspath(self.base_path + '/Bin/RepoTools/Scripts/GithubTools/white_list.txt'))
for line in files_list:
full_path = os.path.abspath(self.base_path + line.partition('#')[0].replace('\n', '')).replace("!", "")
path = line.partition('#')[0].replace('\n', '').replace("!", "")[1:]
if "!" in line:
if path:
self.clear_list.add(path)
else:
if os.path.exists(path):
if path != self.base_path:
self.white_list.add(path)
except IOError:
print "##teamcity[message text='Unable to open file white_list.txt' status='ERROR']"
sys.exit(3)
def execute_cmd(self, cmd):
sys.stdout.write(cmd + '\n')
sys.stdout.flush()
try:
pass
cmd_log = subprocess.check_output(cmd, shell=True, cwd=self.base_path)
sys.stdout.write(cmd_log)
sys.stdout.flush()
except subprocess.CalledProcessError as cmd_except:
print "##teamcity[message text='CMD Error' errorDetails='CMD: {cmd} ERROR: {error}' status='ERROR']".format(cmd=cmd, error=cmd_except.output)
sys.exit(3)
def do(self):
os.chdir(self.base_path)
for path in self.system_list:
cmd = "git add {path}".format(path=path)
self.execute_cmd(cmd)
for path in self.white_list:
cmd = "git add -f {path}".format(path=path)
self.execute_cmd(cmd)
for path in self.clear_list:
cmd = "git reset {path}".format(path=path)
self.execute_cmd(cmd)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Utility add files to the repository from the whitelist.')
parser.add_argument('--path', required=True, help='Example: --path /var/git/repo')
args = parser.parse_args()
preparation = Preparation(args.path) | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
1852,
5510,
13,
5215,
1014,
5014,
13,
13,
13,
1990,
4721,
862,
362,
29901,
13,
1678,
1788,
29918,
1761,
353,
731,
18959,
29889,
5559,
15697,
742,
15300,
5559,
17281,
742,
15300,
5559,
7576,
11287,
13,
1678,
4796,
29918,
1761,
353,
731,
580,
13,
1678,
2821,
29918,
1761,
353,
731,
18959,
29933,
262,
29914,
5612,
29877,
24183,
29914,
4081,
29879,
29914,
29954,
2985,
24183,
29914,
10921,
29918,
1761,
29889,
3945,
742,
525,
29933,
262,
29914,
5612,
29877,
24183,
29914,
4081,
29879,
29914,
29954,
2985,
24183,
29914,
3292,
29918,
1457,
862,
362,
29889,
2272,
11287,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2967,
29918,
2084,
1125,
13,
4706,
1583,
29889,
3188,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
3188,
29918,
2084,
29897,
13,
4706,
1583,
29889,
949,
29918,
10921,
29918,
1761,
580,
13,
13,
4706,
1583,
29889,
949,
29918,
10921,
29918,
1761,
580,
13,
4706,
1583,
29889,
1867,
580,
13,
13,
1678,
822,
1303,
29918,
10921,
29918,
1761,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
2066,
29918,
1761,
353,
1722,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
1311,
29889,
3188,
29918,
2084,
718,
8207,
29933,
262,
29914,
5612,
29877,
24183,
29914,
4081,
29879,
29914,
29954,
2985,
24183,
29914,
10921,
29918,
1761,
29889,
3945,
8785,
13,
9651,
363,
1196,
297,
2066,
29918,
1761,
29901,
13,
18884,
2989,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
1311,
29889,
3188,
29918,
2084,
718,
1196,
29889,
16707,
14237,
29861,
29900,
1822,
6506,
28909,
29876,
742,
27255,
467,
6506,
703,
29991,
613,
20569,
13,
18884,
2224,
353,
1196,
29889,
16707,
14237,
29861,
29900,
1822,
6506,
28909,
29876,
742,
525,
2824,
6506,
703,
29991,
613,
20569,
29961,
29896,
17531,
13,
18884,
565,
376,
3850,
297,
1196,
29901,
13,
462,
1678,
565,
2224,
29901,
13,
462,
4706,
1583,
29889,
8551,
29918,
1761,
29889,
1202,
29898,
2084,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
565,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
1125,
13,
462,
4706,
565,
2224,
2804,
1583,
29889,
3188,
29918,
2084,
29901,
13,
462,
9651,
1583,
29889,
10921,
29918,
1761,
29889,
1202,
29898,
2084,
29897,
13,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
1596,
376,
2277,
14318,
12690,
29961,
4906,
1426,
2433,
2525,
519,
304,
1722,
934,
4796,
29918,
1761,
29889,
3945,
29915,
4660,
2433,
11432,
2033,
29908,
13,
9651,
10876,
29889,
13322,
29898,
29941,
29897,
13,
13,
1678,
822,
6222,
29918,
9006,
29898,
1311,
29892,
9920,
1125,
13,
4706,
10876,
29889,
25393,
29889,
3539,
29898,
9006,
718,
11297,
29876,
1495,
13,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
4706,
1018,
29901,
13,
9651,
1209,
13,
9651,
9920,
29918,
1188,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
9006,
29892,
6473,
29922,
5574,
29892,
274,
9970,
29922,
1311,
29889,
3188,
29918,
2084,
29897,
13,
9651,
10876,
29889,
25393,
29889,
3539,
29898,
9006,
29918,
1188,
29897,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
4706,
5174,
1014,
5014,
29889,
29907,
4212,
7032,
2392,
408,
9920,
29918,
19499,
29901,
13,
9651,
1596,
376,
2277,
14318,
12690,
29961,
4906,
1426,
2433,
29907,
5773,
4829,
29915,
1059,
10602,
2433,
29907,
5773,
29901,
426,
9006,
29913,
14431,
29901,
426,
2704,
10162,
4660,
2433,
11432,
2033,
1642,
4830,
29898,
9006,
29922,
9006,
29892,
1059,
29922,
9006,
29918,
19499,
29889,
4905,
29897,
13,
9651,
10876,
29889,
13322,
29898,
29941,
29897,
13,
13,
1678,
822,
437,
29898,
1311,
1125,
13,
4706,
2897,
29889,
305,
3972,
29898,
1311,
29889,
3188,
29918,
2084,
29897,
13,
13,
4706,
363,
2224,
297,
1583,
29889,
5205,
29918,
1761,
29901,
13,
9651,
9920,
353,
376,
5559,
788,
426,
2084,
29913,
1642,
4830,
29898,
2084,
29922,
2084,
29897,
13,
9651,
1583,
29889,
7978,
29918,
9006,
29898,
9006,
29897,
13,
13,
4706,
363,
2224,
297,
1583,
29889,
10921,
29918,
1761,
29901,
13,
9651,
9920,
353,
376,
5559,
788,
448,
29888,
426,
2084,
29913,
1642,
4830,
29898,
2084,
29922,
2084,
29897,
13,
9651,
1583,
29889,
7978,
29918,
9006,
29898,
9006,
29897,
13,
13,
4706,
363,
2224,
297,
1583,
29889,
8551,
29918,
1761,
29901,
13,
9651,
9920,
353,
376,
5559,
10092,
426,
2084,
29913,
1642,
4830,
29898,
2084,
29922,
2084,
29897,
13,
9651,
1583,
29889,
7978,
29918,
9006,
29898,
9006,
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,
7270,
537,
788,
2066,
304,
278,
9810,
515,
278,
377,
7454,
391,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2084,
742,
3734,
29922,
5574,
29892,
1371,
2433,
14023,
29901,
1192,
2084,
847,
1707,
29914,
5559,
29914,
20095,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
10223,
362,
353,
4721,
862,
362,
29898,
5085,
29889,
2084,
29897,
2
] |
packages/pyright-internal/src/tests/samples/paramInference1.py | Jasha10/pyright | 3,934 | 143288 | # This sample tests the logic that infers parameter types based on
# default argument values or annotated base class methods.
class Parent:
def func1(self, a: int, b: str) -> float:
...
class Child(Parent):
def func1(self, a, b):
reveal_type(self, expected_text="Self@Child")
reveal_type(a, expected_text="int")
reveal_type(b, expected_text="str")
return a
def func2(a, b=0, c=None):
reveal_type(a, expected_text="Unknown")
reveal_type(b, expected_text="int")
reveal_type(c, expected_text="Unknown | None")
def func3(a=(1, 2), b=[1,2], c={1: 2}):
reveal_type(a, expected_text="Unknown")
reveal_type(b, expected_text="Unknown")
reveal_type(c, expected_text="Unknown")
| [
1,
396,
910,
4559,
6987,
278,
5900,
393,
3041,
414,
3443,
4072,
2729,
373,
13,
29937,
2322,
2980,
1819,
470,
9732,
630,
2967,
770,
3519,
29889,
13,
13,
13,
1990,
22280,
29901,
13,
1678,
822,
3653,
29896,
29898,
1311,
29892,
263,
29901,
938,
29892,
289,
29901,
851,
29897,
1599,
5785,
29901,
13,
4706,
2023,
13,
13,
13,
1990,
10517,
29898,
9780,
1125,
13,
1678,
822,
3653,
29896,
29898,
1311,
29892,
263,
29892,
289,
1125,
13,
4706,
10320,
284,
29918,
1853,
29898,
1311,
29892,
3806,
29918,
726,
543,
24313,
29992,
5938,
1159,
13,
4706,
10320,
284,
29918,
1853,
29898,
29874,
29892,
3806,
29918,
726,
543,
524,
1159,
13,
4706,
10320,
284,
29918,
1853,
29898,
29890,
29892,
3806,
29918,
726,
543,
710,
1159,
13,
4706,
736,
263,
13,
13,
13,
1753,
3653,
29906,
29898,
29874,
29892,
289,
29922,
29900,
29892,
274,
29922,
8516,
1125,
13,
1678,
10320,
284,
29918,
1853,
29898,
29874,
29892,
3806,
29918,
726,
543,
14148,
1159,
13,
1678,
10320,
284,
29918,
1853,
29898,
29890,
29892,
3806,
29918,
726,
543,
524,
1159,
13,
1678,
10320,
284,
29918,
1853,
29898,
29883,
29892,
3806,
29918,
726,
543,
14148,
891,
6213,
1159,
13,
13,
13,
1753,
3653,
29941,
29898,
29874,
7607,
29896,
29892,
29871,
29906,
511,
289,
11759,
29896,
29892,
29906,
1402,
274,
3790,
29896,
29901,
29871,
29906,
29913,
1125,
13,
1678,
10320,
284,
29918,
1853,
29898,
29874,
29892,
3806,
29918,
726,
543,
14148,
1159,
13,
1678,
10320,
284,
29918,
1853,
29898,
29890,
29892,
3806,
29918,
726,
543,
14148,
1159,
13,
1678,
10320,
284,
29918,
1853,
29898,
29883,
29892,
3806,
29918,
726,
543,
14148,
1159,
13,
2
] |
tests/integration/RoyaltiesPayment/test_withdrawals.py | MiracleCorunus/nft_royalties_market | 37 | 179164 | <reponame>MiracleCorunus/nft_royalties_market<gh_stars>10-100
import brownie
from brownie.test import strategy
import math
class StateMachine:
value = strategy("uint256", min_value=1, max_value="100 ether")
withdrawal = strategy("uint256", min_value=1, max_value="20 ether")
address = strategy("address", length=5)
def __init__(cls, accounts, RoyaltiesPayment):
cls.accounts = accounts
cls.contract = RoyaltiesPayment.deploy(accounts[1:], {"from": accounts[0]})
def setup(self):
self.balance = 0
self.payouts = 0
self.total_deposits = 0
self.user_balances = {account: 0 for account in self.accounts[1:]}
def rule_add_user(self, address):
if self.contract.balances(address)["userIndex"] == 0:
self.contract.addPayee(address, {"from": self.accounts[0]})
self.user_balances = {account: 0 for account in self.accounts[1:]}
self.user_balances[address] = 0
self.payouts += 1
def rule_deposit(self, value):
self.accounts[0].transfer(to=self.contract, amount=value)
self.balance += value
self.total_deposits += value
self.user_balances = {
k: v + (value // len(self.user_balances))
for k, v in self.user_balances.items()
}
def rule_withdraw(self, address, withdrawal):
if (address in self.user_balances) and self.user_balances[address] >= withdrawal:
self.contract.withdraw(withdrawal, {"from": address})
self.user_balances[address] -= withdrawal
self.balance -= withdrawal
else:
with brownie.reverts():
self.contract.withdraw(withdrawal, {"from": address})
def rule_withdraw_all(self, address):
if (address in self.user_balances) and self.user_balances[address] > 0:
self.contract.withdrawAll({"from": address})
self.balance -= self.user_balances[address]
self.user_balances[address] = 0
else:
with brownie.reverts():
self.contract.withdrawAll({"from": address})
def invariant(self):
math.isclose(self.contract.balance(), self.balance, rel_tol=self.payouts)
for user, amount in self.user_balances.items():
assert math.isclose(
self.contract.balances(user)["balance"], amount, rel_tol=self.payouts
)
assert amount <= (self.total_deposits // len(self.user_balances))
def test_withdrawals(state_machine, RoyaltiesPayment, accounts):
state_machine(
StateMachine, accounts, RoyaltiesPayment, settings={"max_examples": 30}
)
| [
1,
529,
276,
1112,
420,
29958,
29924,
29875,
10792,
12521,
348,
375,
29914,
29876,
615,
29918,
4727,
1997,
583,
29918,
28549,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
3347,
2786,
13,
3166,
3347,
2786,
29889,
1688,
1053,
13705,
13,
5215,
5844,
13,
13,
13,
1990,
4306,
29076,
29901,
13,
13,
1678,
995,
353,
13705,
703,
13470,
29906,
29945,
29953,
613,
1375,
29918,
1767,
29922,
29896,
29892,
4236,
29918,
1767,
543,
29896,
29900,
29900,
29871,
1979,
1159,
13,
1678,
28679,
284,
353,
13705,
703,
13470,
29906,
29945,
29953,
613,
1375,
29918,
1767,
29922,
29896,
29892,
4236,
29918,
1767,
543,
29906,
29900,
29871,
1979,
1159,
13,
1678,
3211,
353,
13705,
703,
7328,
613,
3309,
29922,
29945,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
25932,
29892,
15303,
29892,
15793,
1997,
583,
15467,
358,
1125,
13,
4706,
1067,
29879,
29889,
10149,
29879,
353,
15303,
13,
4706,
1067,
29879,
29889,
1285,
1461,
353,
15793,
1997,
583,
15467,
358,
29889,
16519,
29898,
10149,
29879,
29961,
29896,
29901,
1402,
8853,
3166,
1115,
15303,
29961,
29900,
29962,
1800,
13,
13,
1678,
822,
6230,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5521,
749,
353,
29871,
29900,
13,
4706,
1583,
29889,
29886,
1534,
29879,
353,
29871,
29900,
13,
4706,
1583,
29889,
7827,
29918,
311,
1066,
1169,
353,
29871,
29900,
13,
4706,
1583,
29889,
1792,
29918,
5521,
2925,
353,
426,
10149,
29901,
29871,
29900,
363,
3633,
297,
1583,
29889,
10149,
29879,
29961,
29896,
29901,
12258,
13,
13,
1678,
822,
5751,
29918,
1202,
29918,
1792,
29898,
1311,
29892,
3211,
1125,
13,
4706,
565,
1583,
29889,
1285,
1461,
29889,
5521,
2925,
29898,
7328,
29897,
3366,
1792,
3220,
3108,
1275,
29871,
29900,
29901,
13,
9651,
1583,
29889,
1285,
1461,
29889,
1202,
15467,
3905,
29898,
7328,
29892,
8853,
3166,
1115,
1583,
29889,
10149,
29879,
29961,
29900,
29962,
1800,
13,
9651,
1583,
29889,
1792,
29918,
5521,
2925,
353,
426,
10149,
29901,
29871,
29900,
363,
3633,
297,
1583,
29889,
10149,
29879,
29961,
29896,
29901,
12258,
13,
9651,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
353,
29871,
29900,
13,
9651,
1583,
29889,
29886,
1534,
29879,
4619,
29871,
29896,
13,
13,
1678,
822,
5751,
29918,
311,
1066,
277,
29898,
1311,
29892,
995,
1125,
13,
4706,
1583,
29889,
10149,
29879,
29961,
29900,
1822,
3286,
571,
29898,
517,
29922,
1311,
29889,
1285,
1461,
29892,
5253,
29922,
1767,
29897,
13,
4706,
1583,
29889,
5521,
749,
4619,
995,
13,
4706,
1583,
29889,
7827,
29918,
311,
1066,
1169,
4619,
995,
13,
4706,
1583,
29889,
1792,
29918,
5521,
2925,
353,
426,
13,
9651,
413,
29901,
325,
718,
313,
1767,
849,
7431,
29898,
1311,
29889,
1792,
29918,
5521,
2925,
876,
13,
9651,
363,
413,
29892,
325,
297,
1583,
29889,
1792,
29918,
5521,
2925,
29889,
7076,
580,
13,
4706,
500,
13,
13,
1678,
822,
5751,
29918,
2541,
4012,
29898,
1311,
29892,
3211,
29892,
28679,
284,
1125,
13,
4706,
565,
313,
7328,
297,
1583,
29889,
1792,
29918,
5521,
2925,
29897,
322,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
6736,
28679,
284,
29901,
13,
9651,
1583,
29889,
1285,
1461,
29889,
2541,
4012,
29898,
2541,
4012,
284,
29892,
8853,
3166,
1115,
3211,
1800,
13,
9651,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
22361,
28679,
284,
13,
9651,
1583,
29889,
5521,
749,
22361,
28679,
284,
13,
4706,
1683,
29901,
13,
9651,
411,
3347,
2786,
29889,
276,
369,
1372,
7295,
13,
18884,
1583,
29889,
1285,
1461,
29889,
2541,
4012,
29898,
2541,
4012,
284,
29892,
8853,
3166,
1115,
3211,
1800,
13,
13,
1678,
822,
5751,
29918,
2541,
4012,
29918,
497,
29898,
1311,
29892,
3211,
1125,
13,
4706,
565,
313,
7328,
297,
1583,
29889,
1792,
29918,
5521,
2925,
29897,
322,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
1285,
1461,
29889,
2541,
4012,
3596,
3319,
29908,
3166,
1115,
3211,
1800,
13,
9651,
1583,
29889,
5521,
749,
22361,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
13,
9651,
1583,
29889,
1792,
29918,
5521,
2925,
29961,
7328,
29962,
353,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
411,
3347,
2786,
29889,
276,
369,
1372,
7295,
13,
18884,
1583,
29889,
1285,
1461,
29889,
2541,
4012,
3596,
3319,
29908,
3166,
1115,
3211,
1800,
13,
13,
1678,
822,
22619,
29898,
1311,
1125,
13,
4706,
5844,
29889,
275,
5358,
29898,
1311,
29889,
1285,
1461,
29889,
5521,
749,
3285,
1583,
29889,
5521,
749,
29892,
1104,
29918,
25027,
29922,
1311,
29889,
29886,
1534,
29879,
29897,
13,
4706,
363,
1404,
29892,
5253,
297,
1583,
29889,
1792,
29918,
5521,
2925,
29889,
7076,
7295,
13,
9651,
4974,
5844,
29889,
275,
5358,
29898,
13,
18884,
1583,
29889,
1285,
1461,
29889,
5521,
2925,
29898,
1792,
29897,
3366,
5521,
749,
12436,
5253,
29892,
1104,
29918,
25027,
29922,
1311,
29889,
29886,
1534,
29879,
13,
9651,
1723,
13,
9651,
4974,
5253,
5277,
313,
1311,
29889,
7827,
29918,
311,
1066,
1169,
849,
7431,
29898,
1311,
29889,
1792,
29918,
5521,
2925,
876,
13,
13,
13,
1753,
1243,
29918,
2541,
4012,
1338,
29898,
3859,
29918,
23523,
29892,
15793,
1997,
583,
15467,
358,
29892,
15303,
1125,
13,
1678,
2106,
29918,
23523,
29898,
13,
4706,
4306,
29076,
29892,
15303,
29892,
15793,
1997,
583,
15467,
358,
29892,
6055,
3790,
29908,
3317,
29918,
19057,
1115,
29871,
29941,
29900,
29913,
13,
1678,
1723,
13,
2
] |
hackathon/column1/problem_10_4_LCA.py | abdurahmanadilovic/elements-of-programming-interviews | 0 | 84656 | from collections import defaultdict
class Node:
def __init__(self, value):
self.parent = None
self.value = value
def get_height(node):
height = 0
while node is not None:
height += 1
node = node.parent
return height
def solution2(node1, node2):
height1, height2 = get_height(node1), get_height(node2)
node_to_correct = node1
if height1 < height2:
node_to_correct = node2
diff = abs(height1 - height2)
while diff > 0:
node_to_correct = node_to_correct.parent
diff -= 1
if height1 < height2:
node2 = node_to_correct
else:
node1 = node_to_correct
while node1.parent != node2.parent:
node1 = node1.parent
node2 = node2.parent
return node1.parent
# less efficient, takes O(n) space
def solution(node1, node2):
visited = defaultdict(bool)
while True:
if node1 and node1.parent:
if visited[node1.parent.value]:
return node1.parent
visited[node1.parent.value] = True
if node2 and node2.parent:
if visited[node2.parent.value]:
return node2.parent
visited[node2.parent.value] = True
node1 = node1.parent
node2 = node2.parent
| [
1,
515,
16250,
1053,
2322,
8977,
13,
13,
13,
1990,
9071,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
995,
1125,
13,
4706,
1583,
29889,
3560,
353,
6213,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
13,
13,
1753,
679,
29918,
3545,
29898,
3177,
1125,
13,
1678,
3171,
353,
29871,
29900,
13,
13,
1678,
1550,
2943,
338,
451,
6213,
29901,
13,
4706,
3171,
4619,
29871,
29896,
13,
4706,
2943,
353,
2943,
29889,
3560,
13,
13,
1678,
736,
3171,
13,
13,
13,
1753,
1650,
29906,
29898,
3177,
29896,
29892,
2943,
29906,
1125,
13,
1678,
3171,
29896,
29892,
3171,
29906,
353,
679,
29918,
3545,
29898,
3177,
29896,
511,
679,
29918,
3545,
29898,
3177,
29906,
29897,
13,
13,
1678,
2943,
29918,
517,
29918,
15728,
353,
2943,
29896,
13,
13,
1678,
565,
3171,
29896,
529,
3171,
29906,
29901,
13,
4706,
2943,
29918,
517,
29918,
15728,
353,
2943,
29906,
13,
13,
1678,
2923,
353,
6425,
29898,
3545,
29896,
448,
3171,
29906,
29897,
13,
13,
1678,
1550,
2923,
1405,
29871,
29900,
29901,
13,
4706,
2943,
29918,
517,
29918,
15728,
353,
2943,
29918,
517,
29918,
15728,
29889,
3560,
13,
4706,
2923,
22361,
29871,
29896,
13,
13,
1678,
565,
3171,
29896,
529,
3171,
29906,
29901,
13,
4706,
2943,
29906,
353,
2943,
29918,
517,
29918,
15728,
13,
1678,
1683,
29901,
13,
4706,
2943,
29896,
353,
2943,
29918,
517,
29918,
15728,
13,
13,
1678,
1550,
2943,
29896,
29889,
3560,
2804,
2943,
29906,
29889,
3560,
29901,
13,
4706,
2943,
29896,
353,
2943,
29896,
29889,
3560,
13,
4706,
2943,
29906,
353,
2943,
29906,
29889,
3560,
13,
13,
1678,
736,
2943,
29896,
29889,
3560,
13,
13,
13,
29937,
3109,
8543,
29892,
4893,
438,
29898,
29876,
29897,
2913,
13,
1753,
1650,
29898,
3177,
29896,
29892,
2943,
29906,
1125,
13,
13,
1678,
16669,
353,
2322,
8977,
29898,
11227,
29897,
13,
13,
1678,
1550,
5852,
29901,
13,
4706,
565,
2943,
29896,
322,
2943,
29896,
29889,
3560,
29901,
13,
9651,
565,
16669,
29961,
3177,
29896,
29889,
3560,
29889,
1767,
5387,
13,
18884,
736,
2943,
29896,
29889,
3560,
13,
9651,
16669,
29961,
3177,
29896,
29889,
3560,
29889,
1767,
29962,
353,
5852,
13,
13,
4706,
565,
2943,
29906,
322,
2943,
29906,
29889,
3560,
29901,
13,
9651,
565,
16669,
29961,
3177,
29906,
29889,
3560,
29889,
1767,
5387,
13,
18884,
736,
2943,
29906,
29889,
3560,
13,
13,
9651,
16669,
29961,
3177,
29906,
29889,
3560,
29889,
1767,
29962,
353,
5852,
13,
13,
4706,
2943,
29896,
353,
2943,
29896,
29889,
3560,
13,
4706,
2943,
29906,
353,
2943,
29906,
29889,
3560,
13,
2
] |
train.py | HirataYurina/yoloV4-keras-techi | 6 | 140196 | # -*- coding:utf-8 -*-
# author:平手友梨奈ii
# e-mail:<EMAIL>
# datetime:1993/12/01
# filename:configs.py
# software: PyCharm
import numpy as np
import tensorflow as tf
import keras.backend as K
from keras.layers import Input, Lambda
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from nets.yolo4 import yolo_body
from nets.yolo4_loss import yolo_loss
from keras.backend.tensorflow_backend import set_session
from utils.utils import get_random_data, get_random_mosaic_data, get_random_mosaic_data_v2
from my_queue import GeneratorEnqueuer
import time
import math
from cosine_anneal import WarmUpCosineDecayScheduler
from config.configs import CONFIG
def get_classes(classes_path):
"""loads the classes"""
with open(classes_path) as f:
class_names = f.readlines()
# use list expression to make your code more concise
class_names = [c.strip() for c in class_names]
return class_names
def get_anchors(anchors_path):
"""loads the anchors from a file"""
with open(anchors_path) as f:
anchors = f.readline()
# use list expression to make your code more concise
anchors = [float(x) for x in anchors.split(',')]
return np.array(anchors).reshape(-1, 2)
def data_generator(annotation_lines,
batch_size,
input_shape,
anchors,
num_classes):
"""data generator for fit_generator
the assignment strategy:
one gt ---> one anchor
1.find which anchor(9 anchors) gt belongs to
2.find which grid gt belongs to
Args:
annotation_lines: a list [anno1, anno2, ...]
batch_size: batch size
input_shape: resolution [h, w]
anchors: anchor boxes
num_classes: the number of class
max_boxes: box_data: [max_boxes, 5]
when have a lot of gt to predict, need to set max_boxes bigger.
Returns:
batch data: [image_data, *y_true], np.zeros(batch_size)
"""
n = len(annotation_lines)
i = 0
while True:
image_data = []
box_data = []
for b in range(batch_size):
if i == 0:
# shuffle dataset at begin of epoch
np.random.shuffle(annotation_lines)
image, box = get_random_data(annotation_lines[i], input_shape)
image_data.append(image)
box_data.append(box)
i = (i + 1) % n
image_data = np.array(image_data)
box_data = np.array(box_data)
# get true_boxes
# y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes)
y_true = preprocess_true_boxes_iou_thres(box_data, input_shape, anchors, num_classes,
iou_threshold=CONFIG.TRAIN.IOU_THRESHOLD)
# use yield to get generator
yield [image_data, *y_true], np.zeros(batch_size)
def data_generator_mosaic_iou_thres(annotation_lines,
batch_size,
input_shape,
anchors,
num_classes):
"""data generator for fit_generator
the assignment strategy:
one gt ---> more anchor(iou > iou_threshold)
Args:
annotation_lines: a list [anno1, anno2, ...]
batch_size: batch size
input_shape: resolution [h, w]
anchors: anchor boxes
num_classes: the number of class
max_boxes: box_data: [max_boxes, 5]
when have a lot of gt to predict, must set max_boxes bigger.
iou_threshold: if iou > iou_threshold, the anchor is responsible for this gt.
Returns:
batch data: [image_data, *y_true], np.zeros(batch_size)
"""
n = len(annotation_lines)
shuffle_num = n // 4
i = 0
while True:
image_data = []
box_data = []
for b in range(batch_size):
if i == 0:
# shuffle dataset at begin of epoch
np.random.shuffle(annotation_lines)
image, box = get_random_mosaic_data(annotation_lines[4 * i:4 * i + 4], input_shape)
image_data.append(image)
box_data.append(box)
i = (i + 1) % shuffle_num
image_data = np.array(image_data)
box_data = np.array(box_data)
y_true = preprocess_true_boxes_iou_thres(box_data, input_shape, anchors, num_classes,
iou_threshold=CONFIG.TRAIN.IOU_THRESHOLD)
# use yield to get generator
yield [image_data, *y_true], np.zeros(batch_size)
def preprocess_true_boxes(true_boxes,
input_shape,
anchors,
num_classes):
assert (true_boxes[..., 4] < num_classes).all(), 'class id must be less than num_classes'
num_layers = len(anchors) // 3
anchor_mask = [[6, 7, 8], [3, 4, 5], [0, 1, 2]] if num_layers == 3 else [[3, 4, 5], [1, 2, 3]]
true_boxes = np.array(true_boxes, dtype='float32')
input_shape = np.array(input_shape, dtype='int32') # 416,416
boxes_xy = (true_boxes[..., 0:2] + true_boxes[..., 2:4]) // 2
boxes_wh = true_boxes[..., 2:4] - true_boxes[..., 0:2]
true_boxes[..., 0:2] = boxes_xy / input_shape[:]
true_boxes[..., 2:4] = boxes_wh / input_shape[:]
m = true_boxes.shape[0]
grid_shapes = [input_shape // {0: 32, 1: 16, 2: 8}[l] for l in range(num_layers)]
# [(m, 13, 13, 3, 85), (m, 26, 26, 3, 85), (m, 52, 52, 3, 85)]
y_true = [np.zeros((m, grid_shapes[l][0], grid_shapes[l][1], len(anchor_mask[l]), 5 + num_classes),
dtype='float32') for l in range(num_layers)]
# (1, 9, 2)
anchors = np.expand_dims(anchors, 0)
anchor_maxes = anchors / 2.
anchor_mins = -anchor_maxes
# filter invalid boxes
valid_mask = boxes_wh[..., 0] > 0
for b in range(m):
wh = boxes_wh[b, valid_mask[b]]
if len(wh) == 0:
continue
# [n, 1, 2]
wh = np.expand_dims(wh, -2)
box_maxes = wh / 2.
box_mins = -box_maxes
# get iou
intersect_mins = np.maximum(box_mins, anchor_mins)
intersect_maxes = np.minimum(box_maxes, anchor_maxes)
intersect_wh = np.maximum(intersect_maxes - intersect_mins, 0.)
intersect_area = intersect_wh[..., 0] * intersect_wh[..., 1]
box_area = wh[..., 0] * wh[..., 1]
anchor_area = anchors[..., 0] * anchors[..., 1]
iou = intersect_area / (box_area + anchor_area - intersect_area)
best_anchor = np.argmax(iou, axis=-1)
for t, n in enumerate(best_anchor):
for l in range(num_layers):
if n in anchor_mask[l]:
# assign gt to one grid
i = np.floor(true_boxes[b, t, 0] * grid_shapes[l][1]).astype('int32')
j = np.floor(true_boxes[b, t, 1] * grid_shapes[l][0]).astype('int32')
# assign gt to one anchor
k = anchor_mask[l].index(n)
c = true_boxes[b, t, 4].astype('int32')
y_true[l][b, j, i, k, 0:4] = true_boxes[b, t, 0:4]
# score = 1 and get one hot class label
y_true[l][b, j, i, k, 4] = 1
y_true[l][b, j, i, k, 5 + c] = 1
return y_true
def preprocess_true_boxes_iou_thres(true_boxes,
input_shape,
anchors,
num_classes,
iou_threshold=0.3):
"""get true boxes with iou threshold"""
assert (true_boxes[..., 4] < num_classes).all(), 'class id must be less than num_classes'
num_layers = len(anchors) // 3
anchor_mask = [[6, 7, 8], [3, 4, 5], [0, 1, 2]] if num_layers == 3 else [[3, 4, 5], [1, 2, 3]]
true_boxes = np.array(true_boxes, dtype='float32')
input_shape = np.array(input_shape, dtype='int32') # 416,416
boxes_xy = (true_boxes[..., 0:2] + true_boxes[..., 2:4]) // 2
boxes_wh = true_boxes[..., 2:4] - true_boxes[..., 0:2]
true_boxes[..., 0:2] = boxes_xy / input_shape[:]
true_boxes[..., 2:4] = boxes_wh / input_shape[:]
m = true_boxes.shape[0]
grid_shapes = [input_shape // {0: 32, 1: 16, 2: 8}[l] for l in range(num_layers)]
y_true = [np.zeros((m, grid_shapes[l][0], grid_shapes[l][1], len(anchor_mask[l]), 5 + num_classes),
dtype='float32') for l in range(num_layers)]
# [1, 9, 2]
anchors = np.expand_dims(anchors, 0)
anchor_maxes = anchors / 2.
anchor_mins = -anchor_maxes
# filter invalid boxes
valid_mask = boxes_wh[..., 0] > 0
for b in range(m):
wh = boxes_wh[b, valid_mask[b]]
if len(wh) == 0:
continue
# [n, 1, 2]
wh = np.expand_dims(wh, -2)
box_maxes = wh / 2.
box_mins = -box_maxes
intersect_mins = np.maximum(box_mins, anchor_mins)
intersect_maxes = np.minimum(box_maxes, anchor_maxes)
intersect_wh = np.maximum(intersect_maxes - intersect_mins, 0.)
intersect_area = intersect_wh[..., 0] * intersect_wh[..., 1]
box_area = wh[..., 0] * wh[..., 1]
anchor_area = anchors[..., 0] * anchors[..., 1]
iou = intersect_area / (box_area + anchor_area - intersect_area)
# 1.iou > iou_threshold
positive = iou > iou_threshold # [num_true_boxes, num_anchors]
for t, n in enumerate(positive):
n = np.array(n, dtype=np.int32)
pos_index = np.argwhere(n == 1)
if len(pos_index):
continue
for id in pos_index:
id = id[0]
for l in range(num_layers):
if id in anchor_mask[l]:
i = np.floor(true_boxes[b, t, 0] * grid_shapes[l][1]).astype('int32')
j = np.floor(true_boxes[b, t, 1] * grid_shapes[l][0]).astype('int32')
k = anchor_mask[l].index(id)
c = true_boxes[b, t, 4].astype('int32')
y_true[l][b, j, i, k, 0:4] = true_boxes[b, t, 0:4]
y_true[l][b, j, i, k, 4] = 1
y_true[l][b, j, i, k, 5 + c] = 1
# 2.if no positive anchor, just choose the best one to be the positive.
best_anchor = np.argmax(iou, axis=-1)
for t, n in enumerate(best_anchor):
for l in range(num_layers):
if n in anchor_mask[l]:
i = np.floor(true_boxes[b, t, 0] * grid_shapes[l][1]).astype('int32')
j = np.floor(true_boxes[b, t, 1] * grid_shapes[l][0]).astype('int32')
k = anchor_mask[l].index(n)
c = true_boxes[b, t, 4].astype('int32')
y_true[l][b, j, i, k, 0:4] = true_boxes[b, t, 0:4]
y_true[l][b, j, i, k, 4] = 1
y_true[l][b, j, i, k, 5 + c] = 1
return y_true
def get_batch(num_workers,
max_queue_size=32,
use_mosaic_iout_generator=CONFIG.DATASET.MOSAIC_AUG,
multiprocessing=CONFIG.DATASET.MULTIPROCESS,
**kwargs):
"""
Args:
num_workers: number of workers
max_queue_size: max queue size
multiprocessing: true in linux and false in windows
use_mosaic_iout_generator: use mosaic_iou_thres_generator or not
**kwargs: args used in data generator
"""
enqueuer = None
try:
if use_mosaic_iout_generator:
enqueuer = GeneratorEnqueuer(data_generator_mosaic_iou_thres(**kwargs),
use_multiprocessing=multiprocessing)
else:
enqueuer = GeneratorEnqueuer(data_generator(**kwargs),
use_multiprocessing=multiprocessing)
enqueuer.start(max_queue_size=max_queue_size, workers=num_workers)
generator_output = None
while True:
while enqueuer.is_running():
if not enqueuer.queue.empty():
generator_output = enqueuer.queue.get()
break
else:
time.sleep(0.01)
yield generator_output
generator_output = None
finally:
if enqueuer is not None:
enqueuer.stop()
config = tf.ConfigProto()
# A "Best-fit with coalescing" algorithm, simplified from a version of dlmalloc.
config.gpu_options.allocator_type = 'BFC'
config.gpu_options.per_process_gpu_memory_fraction = 1
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
if __name__ == "__main__":
annotation_path = CONFIG.TRAIN.ANNO_PATH
valid_anno_path = CONFIG.TRAIN.VALID_PATH
classes_path = CONFIG.TRAIN.CLASS_PATH
anchors_path = CONFIG.TRAIN.ANCHOR_PATH
# pretrained model path
weights_path = CONFIG.TRAIN.PRE_TRAINED_MODEL
class_names = get_classes(classes_path)
anchors = get_anchors(anchors_path)
num_classes = len(class_names)
num_anchors = len(anchors)
# checkpoint path
log_dir = CONFIG.TRAIN.SAVE_PATH
# resolution
input_shape = CONFIG.TRAIN.RESOLUTION
# clear previous tf graph
K.clear_session()
image_input = Input(shape=(None, None, 3))
h, w = input_shape
# create model
print('Create YOLOv4 model with {} anchors and {} classes.'.format(num_anchors, num_classes))
model_body = yolo_body(image_input, num_anchors // 3, num_classes)
print('Load weights {}.'.format(weights_path))
model_body.load_weights(weights_path, by_name=True, skip_mismatch=True)
y_true = [Input(shape=(h // {0: 32, 1: 16, 2: 8}[l], w // {0: 32, 1: 16, 2: 8}[l],
num_anchors // 3, num_classes + 5)) for l in range(3)]
loss_input = [*model_body.output, *y_true]
# merge custom loss layer into model
model_loss = Lambda(yolo_loss, output_shape=(1,), name='yolo_loss',
arguments={'anchors': anchors,
'num_classes': num_classes,
'ignore_thresh': CONFIG.TRAIN.IGNORE_THRES,
'use_focal_confidence_loss': CONFIG.TRAIN.CONFIDENCE_FOCAL,
'use_focal_class_loss': CONFIG.TRAIN.CLASS_FOCAL,
'use_diou': CONFIG.TRAIN.DIOU,
'use_ciou': CONFIG.TRAIN.CIOU,
'print_loss': False})(loss_input)
# create model_loss
model = Model([model_body.input, *y_true], model_loss)
# freeze_layers = 249
freeze_layers = CONFIG.TRAIN.FREEZE_LAYERS
for i in range(freeze_layers):
model_body.layers[i].trainable = False
print('Freeze the first {} layers of total {} layers.'.format(freeze_layers, len(model_body.layers)))
# checkpoint
logging = TensorBoard(log_dir=log_dir)
checkpoint = ModelCheckpoint(log_dir + 'ep{epoch:03d}-loss{loss:.3f}.h5',
monitor='loss',
save_weights_only=True,
save_best_only=False, period=CONFIG.TRAIN.SAVE_PERIOD)
# reduce lr on plateau
# this lr decay is worse than cosine anneal
reduce_lr = ReduceLROnPlateau(monitor='loss', factor=0.1, patience=5, verbose=1)
# i don't use early stopping frequently because it is not orthogonal.
early_stopping = EarlyStopping(monitor='loss', min_delta=0, patience=10, verbose=1)
# get training annotations
with open(annotation_path) as f:
lines = f.readlines()
np.random.seed(10101)
np.random.shuffle(lines)
num_train = len(lines)
# get validating annotations
with open(valid_anno_path) as f:
valid_lines = f.readlines()
np.random.shuffle(valid_lines)
num_val = len(valid_lines)
np.random.seed(None)
# one stage training
if CONFIG.TRAIN.TRANSFER:
model.compile(optimizer=Adam(lr=CONFIG.TRAIN.LR_STAGE1),
loss={'yolo_loss': lambda y_true, y_pred: y_pred})
batch_size = CONFIG.TRAIN.BATCH1
print('Train on {} samples, val on {} samples, with batch size {}.'.format(num_train, num_val, batch_size))
model.fit_generator(get_batch(num_workers=CONFIG.DATASET.WORKERS,
max_queue_size=CONFIG.DATASET.MAX_QUEUE,
annotation_lines=lines, batch_size=batch_size,
input_shape=input_shape, anchors=anchors,
num_classes=num_classes),
steps_per_epoch=max(1, num_train // batch_size),
# validation_data=get_batch(1, annotation_lines=valid_lines, batch_size=batch_size,
# input_shape=input_shape, anchors=anchors,
# num_classes=num_classes),
# validation steps: at the end of epoch, generate validation_steps * batch data
# validation_steps=max(1, num_val // batch_size),
epochs=CONFIG.TRAIN.EPOCH1,
initial_epoch=0,
callbacks=[checkpoint])
model.save_weights(log_dir + 'trained_weights_stage_1.h5')
# unfreeze in second stage
for i in range(freeze_layers):
model_body.layers[i].trainable = True
print('layers have been unfrozen!!')
# training in second stage
# fine tune
if True:
model.compile(optimizer=Adam(lr=CONFIG.TRAIN.LR_STAGE2),
loss={'yolo_loss': lambda y_true, y_pred: y_pred})
batch_size = CONFIG.TRAIN.BATCH2
# cosine anneal
total_epoch = CONFIG.TRAIN.EPOCH2 - CONFIG.TRAIN.EPOCH1
cosine_anneal = WarmUpCosineDecayScheduler(learning_rate_base=CONFIG.TRAIN.LR_STAGE2,
total_steps=total_epoch * math.ceil(num_train / batch_size),
interval_epoch=CONFIG.TRAIN.COS_INTERVAL)
print('Train on {} samples, val on {} samples, with batch size {}.'.format(num_train, num_val, batch_size))
model.fit_generator(get_batch(num_workers=CONFIG.DATASET.WORKERS,
max_queue_size=CONFIG.DATASET.MAX_QUEUE,
annotation_lines=lines, batch_size=batch_size,
input_shape=input_shape, anchors=anchors,
num_classes=num_classes),
steps_per_epoch=max(1, num_train // batch_size),
# validation_data=get_batch(annotation_lines=valid_lines, batch_size=batch_size,
# input_shape=input_shape, anchors=anchors,
# num_classes=num_classes),
# validation_steps=max(1, num_val // batch_size),
epochs=CONFIG.TRAIN.EPOCH2,
initial_epoch=CONFIG.TRAIN.EPOCH1,
callbacks=[checkpoint, cosine_anneal])
model.save_weights(log_dir + 'last1.h5')
| [
1,
396,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
29937,
4148,
29901,
30606,
30880,
31373,
233,
165,
171,
31696,
2236,
13,
29937,
321,
29899,
2549,
29901,
29966,
26862,
6227,
29958,
13,
29937,
12865,
29901,
29896,
29929,
29929,
29941,
29914,
29896,
29906,
29914,
29900,
29896,
13,
29937,
10422,
29901,
2917,
29879,
29889,
2272,
13,
29937,
7047,
29901,
10772,
1451,
2817,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
5215,
13023,
294,
29889,
27852,
408,
476,
13,
3166,
13023,
294,
29889,
29277,
1053,
10567,
29892,
365,
2269,
13,
3166,
13023,
294,
29889,
9794,
1053,
8125,
13,
3166,
13023,
294,
29889,
20640,
19427,
1053,
11783,
13,
3166,
13023,
294,
29889,
14035,
29879,
1053,
323,
6073,
28397,
29892,
8125,
5596,
3149,
29892,
4367,
24551,
29931,
1672,
29876,
3247,
403,
585,
29892,
11095,
20754,
3262,
13,
3166,
302,
1691,
29889,
29891,
3543,
29946,
1053,
343,
3543,
29918,
2587,
13,
3166,
302,
1691,
29889,
29891,
3543,
29946,
29918,
6758,
1053,
343,
3543,
29918,
6758,
13,
3166,
13023,
294,
29889,
27852,
29889,
29056,
29918,
27852,
1053,
731,
29918,
7924,
13,
3166,
3667,
29879,
29889,
13239,
1053,
679,
29918,
8172,
29918,
1272,
29892,
679,
29918,
8172,
29918,
29885,
3628,
293,
29918,
1272,
29892,
679,
29918,
8172,
29918,
29885,
3628,
293,
29918,
1272,
29918,
29894,
29906,
13,
3166,
590,
29918,
9990,
1053,
3251,
1061,
2369,
802,
2853,
13,
5215,
931,
13,
5215,
5844,
13,
3166,
6776,
457,
29918,
11276,
284,
1053,
399,
2817,
3373,
29907,
359,
457,
6185,
388,
4504,
14952,
13,
3166,
2295,
29889,
2917,
29879,
1053,
8707,
18667,
13,
13,
13,
1753,
679,
29918,
13203,
29898,
13203,
29918,
2084,
1125,
13,
1678,
9995,
18132,
278,
4413,
15945,
29908,
13,
1678,
411,
1722,
29898,
13203,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
770,
29918,
7039,
353,
285,
29889,
949,
9012,
580,
13,
13,
1678,
396,
671,
1051,
4603,
304,
1207,
596,
775,
901,
3022,
895,
13,
1678,
770,
29918,
7039,
353,
518,
29883,
29889,
17010,
580,
363,
274,
297,
770,
29918,
7039,
29962,
13,
1678,
736,
770,
29918,
7039,
13,
13,
13,
1753,
679,
29918,
14588,
943,
29898,
14588,
943,
29918,
2084,
1125,
13,
1678,
9995,
18132,
278,
23791,
943,
515,
263,
934,
15945,
29908,
13,
1678,
411,
1722,
29898,
14588,
943,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
23791,
943,
353,
285,
29889,
949,
1220,
580,
13,
13,
1678,
396,
671,
1051,
4603,
304,
1207,
596,
775,
901,
3022,
895,
13,
1678,
23791,
943,
353,
518,
7411,
29898,
29916,
29897,
363,
921,
297,
23791,
943,
29889,
5451,
29317,
1495,
29962,
13,
1678,
736,
7442,
29889,
2378,
29898,
14588,
943,
467,
690,
14443,
6278,
29896,
29892,
29871,
29906,
29897,
13,
13,
13,
1753,
848,
29918,
27959,
29898,
18317,
29918,
9012,
29892,
13,
462,
259,
9853,
29918,
2311,
29892,
13,
462,
259,
1881,
29918,
12181,
29892,
13,
462,
259,
23791,
943,
29892,
13,
462,
259,
954,
29918,
13203,
1125,
13,
1678,
9995,
1272,
15299,
363,
6216,
29918,
27959,
13,
1678,
278,
12827,
13705,
29901,
13,
4706,
697,
330,
29873,
11474,
29958,
697,
17360,
13,
308,
29896,
29889,
2886,
607,
17360,
29898,
29929,
23791,
943,
29897,
330,
29873,
14393,
304,
13,
308,
29906,
29889,
2886,
607,
6856,
330,
29873,
14393,
304,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
17195,
29918,
9012,
29901,
263,
1051,
518,
7665,
29896,
29892,
12327,
29906,
29892,
2023,
29962,
13,
4706,
9853,
29918,
2311,
29901,
539,
9853,
2159,
13,
4706,
1881,
29918,
12181,
29901,
418,
10104,
518,
29882,
29892,
281,
29962,
13,
4706,
23791,
943,
29901,
3986,
17360,
16273,
13,
4706,
954,
29918,
13203,
29901,
418,
278,
1353,
310,
770,
13,
4706,
4236,
29918,
1884,
267,
29901,
4706,
3800,
29918,
1272,
29901,
518,
3317,
29918,
1884,
267,
29892,
29871,
29945,
29962,
13,
462,
3986,
746,
505,
263,
3287,
310,
330,
29873,
304,
8500,
29892,
817,
304,
29871,
731,
4236,
29918,
1884,
267,
16600,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
9853,
848,
29901,
539,
518,
3027,
29918,
1272,
29892,
334,
29891,
29918,
3009,
1402,
7442,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29897,
13,
13,
1678,
9995,
13,
1678,
302,
353,
7431,
29898,
18317,
29918,
9012,
29897,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
1550,
5852,
29901,
13,
4706,
1967,
29918,
1272,
353,
5159,
13,
4706,
3800,
29918,
1272,
353,
5159,
13,
4706,
363,
289,
297,
3464,
29898,
16175,
29918,
2311,
1125,
13,
9651,
565,
474,
1275,
29871,
29900,
29901,
13,
18884,
396,
528,
21897,
8783,
472,
3380,
310,
21502,
305,
13,
18884,
7442,
29889,
8172,
29889,
845,
21897,
29898,
18317,
29918,
9012,
29897,
13,
9651,
1967,
29892,
3800,
353,
679,
29918,
8172,
29918,
1272,
29898,
18317,
29918,
9012,
29961,
29875,
1402,
1881,
29918,
12181,
29897,
13,
9651,
1967,
29918,
1272,
29889,
4397,
29898,
3027,
29897,
13,
9651,
3800,
29918,
1272,
29889,
4397,
29898,
1884,
29897,
13,
9651,
474,
353,
313,
29875,
718,
29871,
29896,
29897,
1273,
302,
13,
4706,
1967,
29918,
1272,
353,
7442,
29889,
2378,
29898,
3027,
29918,
1272,
29897,
13,
4706,
3800,
29918,
1272,
353,
7442,
29889,
2378,
29898,
1884,
29918,
1272,
29897,
13,
4706,
396,
679,
1565,
29918,
1884,
267,
13,
4706,
396,
343,
29918,
3009,
353,
758,
5014,
29918,
3009,
29918,
1884,
267,
29898,
1884,
29918,
1272,
29892,
1881,
29918,
12181,
29892,
23791,
943,
29892,
954,
29918,
13203,
29897,
13,
4706,
343,
29918,
3009,
353,
758,
5014,
29918,
3009,
29918,
1884,
267,
29918,
29875,
283,
29918,
386,
690,
29898,
1884,
29918,
1272,
29892,
1881,
29918,
12181,
29892,
23791,
943,
29892,
954,
29918,
13203,
29892,
13,
462,
462,
462,
474,
283,
29918,
386,
12268,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
5971,
29965,
29918,
4690,
1525,
7068,
5607,
29928,
29897,
13,
4706,
396,
671,
7709,
304,
679,
15299,
13,
4706,
7709,
518,
3027,
29918,
1272,
29892,
334,
29891,
29918,
3009,
1402,
7442,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29897,
13,
13,
13,
1753,
848,
29918,
27959,
29918,
29885,
3628,
293,
29918,
29875,
283,
29918,
386,
690,
29898,
18317,
29918,
9012,
29892,
13,
462,
462,
1678,
9853,
29918,
2311,
29892,
13,
462,
462,
1678,
1881,
29918,
12181,
29892,
13,
462,
462,
1678,
23791,
943,
29892,
13,
462,
462,
1678,
954,
29918,
13203,
1125,
13,
1678,
9995,
1272,
15299,
363,
6216,
29918,
27959,
13,
1678,
278,
12827,
13705,
29901,
13,
4706,
697,
330,
29873,
11474,
29958,
901,
17360,
29898,
29875,
283,
1405,
474,
283,
29918,
386,
12268,
29897,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
17195,
29918,
9012,
29901,
263,
1051,
518,
7665,
29896,
29892,
12327,
29906,
29892,
2023,
29962,
13,
4706,
9853,
29918,
2311,
29901,
539,
9853,
2159,
13,
4706,
1881,
29918,
12181,
29901,
418,
10104,
518,
29882,
29892,
281,
29962,
13,
4706,
23791,
943,
29901,
3986,
17360,
16273,
13,
4706,
954,
29918,
13203,
29901,
418,
278,
1353,
310,
770,
13,
4706,
4236,
29918,
1884,
267,
29901,
4706,
3800,
29918,
1272,
29901,
518,
3317,
29918,
1884,
267,
29892,
29871,
29945,
29962,
13,
462,
3986,
746,
505,
263,
3287,
310,
330,
29873,
304,
8500,
29892,
1818,
731,
4236,
29918,
1884,
267,
16600,
29889,
13,
4706,
474,
283,
29918,
386,
12268,
29901,
1678,
565,
474,
283,
1405,
474,
283,
29918,
386,
12268,
29892,
278,
17360,
338,
14040,
363,
445,
330,
29873,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
9853,
848,
29901,
539,
518,
3027,
29918,
1272,
29892,
334,
29891,
29918,
3009,
1402,
7442,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29897,
13,
13,
1678,
9995,
13,
1678,
302,
353,
7431,
29898,
18317,
29918,
9012,
29897,
13,
1678,
528,
21897,
29918,
1949,
353,
302,
849,
29871,
29946,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
1550,
5852,
29901,
13,
4706,
1967,
29918,
1272,
353,
5159,
13,
4706,
3800,
29918,
1272,
353,
5159,
13,
4706,
363,
289,
297,
3464,
29898,
16175,
29918,
2311,
1125,
13,
9651,
565,
474,
1275,
29871,
29900,
29901,
13,
18884,
396,
528,
21897,
8783,
472,
3380,
310,
21502,
305,
13,
18884,
7442,
29889,
8172,
29889,
845,
21897,
29898,
18317,
29918,
9012,
29897,
13,
9651,
1967,
29892,
3800,
353,
679,
29918,
8172,
29918,
29885,
3628,
293,
29918,
1272,
29898,
18317,
29918,
9012,
29961,
29946,
334,
474,
29901,
29946,
334,
474,
718,
29871,
29946,
1402,
1881,
29918,
12181,
29897,
13,
9651,
1967,
29918,
1272,
29889,
4397,
29898,
3027,
29897,
13,
9651,
3800,
29918,
1272,
29889,
4397,
29898,
1884,
29897,
13,
9651,
474,
353,
313,
29875,
718,
29871,
29896,
29897,
1273,
528,
21897,
29918,
1949,
13,
4706,
1967,
29918,
1272,
353,
7442,
29889,
2378,
29898,
3027,
29918,
1272,
29897,
13,
4706,
3800,
29918,
1272,
353,
7442,
29889,
2378,
29898,
1884,
29918,
1272,
29897,
13,
13,
4706,
343,
29918,
3009,
353,
758,
5014,
29918,
3009,
29918,
1884,
267,
29918,
29875,
283,
29918,
386,
690,
29898,
1884,
29918,
1272,
29892,
1881,
29918,
12181,
29892,
23791,
943,
29892,
954,
29918,
13203,
29892,
13,
462,
462,
462,
474,
283,
29918,
386,
12268,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
5971,
29965,
29918,
4690,
1525,
7068,
5607,
29928,
29897,
13,
4706,
396,
671,
7709,
304,
679,
15299,
13,
4706,
7709,
518,
3027,
29918,
1272,
29892,
334,
29891,
29918,
3009,
1402,
7442,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29897,
13,
13,
13,
1753,
758,
5014,
29918,
3009,
29918,
1884,
267,
29898,
3009,
29918,
1884,
267,
29892,
13,
462,
3986,
1881,
29918,
12181,
29892,
13,
462,
3986,
23791,
943,
29892,
13,
462,
3986,
954,
29918,
13203,
1125,
13,
13,
1678,
4974,
313,
3009,
29918,
1884,
267,
29961,
16361,
29871,
29946,
29962,
529,
954,
29918,
13203,
467,
497,
3285,
525,
1990,
1178,
1818,
367,
3109,
1135,
954,
29918,
13203,
29915,
13,
1678,
954,
29918,
29277,
353,
7431,
29898,
14588,
943,
29897,
849,
29871,
29941,
13,
13,
1678,
17360,
29918,
13168,
353,
5519,
29953,
29892,
29871,
29955,
29892,
29871,
29947,
1402,
518,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
1402,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
5262,
565,
954,
29918,
29277,
1275,
29871,
29941,
1683,
5519,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
1402,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
5262,
13,
13,
1678,
1565,
29918,
1884,
267,
353,
7442,
29889,
2378,
29898,
3009,
29918,
1884,
267,
29892,
26688,
2433,
7411,
29941,
29906,
1495,
13,
1678,
1881,
29918,
12181,
353,
7442,
29889,
2378,
29898,
2080,
29918,
12181,
29892,
26688,
2433,
524,
29941,
29906,
1495,
29871,
396,
29871,
29946,
29896,
29953,
29892,
29946,
29896,
29953,
13,
13,
1678,
16273,
29918,
3594,
353,
313,
3009,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
718,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
2314,
849,
29871,
29906,
13,
1678,
16273,
29918,
1332,
353,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
29962,
448,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
13,
13,
1678,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
353,
16273,
29918,
3594,
847,
1881,
29918,
12181,
7503,
29962,
13,
1678,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
29962,
353,
16273,
29918,
1332,
847,
1881,
29918,
12181,
7503,
29962,
13,
13,
1678,
286,
353,
1565,
29918,
1884,
267,
29889,
12181,
29961,
29900,
29962,
13,
1678,
6856,
29918,
845,
11603,
353,
518,
2080,
29918,
12181,
849,
426,
29900,
29901,
29871,
29941,
29906,
29892,
29871,
29896,
29901,
29871,
29896,
29953,
29892,
29871,
29906,
29901,
29871,
29947,
4400,
29880,
29962,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
4638,
13,
13,
1678,
396,
17288,
29885,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29941,
29892,
29871,
29941,
29892,
29871,
29947,
29945,
511,
313,
29885,
29892,
29871,
29906,
29953,
29892,
29871,
29906,
29953,
29892,
29871,
29941,
29892,
29871,
29947,
29945,
511,
313,
29885,
29892,
29871,
29945,
29906,
29892,
29871,
29945,
29906,
29892,
29871,
29941,
29892,
29871,
29947,
29945,
4638,
13,
1678,
343,
29918,
3009,
353,
518,
9302,
29889,
3298,
359,
3552,
29885,
29892,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29900,
1402,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29896,
1402,
7431,
29898,
25367,
29918,
13168,
29961,
29880,
11724,
29871,
29945,
718,
954,
29918,
13203,
511,
13,
462,
539,
26688,
2433,
7411,
29941,
29906,
1495,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
4638,
13,
1678,
396,
313,
29896,
29892,
29871,
29929,
29892,
29871,
29906,
29897,
13,
1678,
23791,
943,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
14588,
943,
29892,
29871,
29900,
29897,
13,
1678,
17360,
29918,
3317,
267,
353,
23791,
943,
847,
29871,
29906,
29889,
13,
1678,
17360,
29918,
29885,
1144,
353,
448,
25367,
29918,
3317,
267,
13,
1678,
396,
4175,
8340,
16273,
13,
1678,
2854,
29918,
13168,
353,
16273,
29918,
1332,
29961,
16361,
29871,
29900,
29962,
1405,
29871,
29900,
13,
13,
1678,
363,
289,
297,
3464,
29898,
29885,
1125,
13,
4706,
377,
353,
16273,
29918,
1332,
29961,
29890,
29892,
2854,
29918,
13168,
29961,
29890,
5262,
13,
4706,
565,
7431,
29898,
1332,
29897,
1275,
29871,
29900,
29901,
13,
9651,
6773,
13,
4706,
396,
518,
29876,
29892,
29871,
29896,
29892,
29871,
29906,
29962,
13,
4706,
377,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
1332,
29892,
448,
29906,
29897,
13,
4706,
3800,
29918,
3317,
267,
353,
377,
847,
29871,
29906,
29889,
13,
4706,
3800,
29918,
29885,
1144,
353,
448,
1884,
29918,
3317,
267,
13,
13,
4706,
396,
679,
474,
283,
13,
4706,
25869,
29918,
29885,
1144,
353,
7442,
29889,
27525,
398,
29898,
1884,
29918,
29885,
1144,
29892,
17360,
29918,
29885,
1144,
29897,
13,
4706,
25869,
29918,
3317,
267,
353,
7442,
29889,
1195,
12539,
29898,
1884,
29918,
3317,
267,
29892,
17360,
29918,
3317,
267,
29897,
13,
4706,
25869,
29918,
1332,
353,
7442,
29889,
27525,
398,
29898,
1639,
8803,
29918,
3317,
267,
448,
25869,
29918,
29885,
1144,
29892,
29871,
29900,
1846,
13,
4706,
25869,
29918,
6203,
353,
25869,
29918,
1332,
29961,
16361,
29871,
29900,
29962,
334,
25869,
29918,
1332,
29961,
16361,
29871,
29896,
29962,
13,
4706,
3800,
29918,
6203,
353,
377,
29961,
16361,
29871,
29900,
29962,
334,
377,
29961,
16361,
29871,
29896,
29962,
13,
4706,
17360,
29918,
6203,
353,
23791,
943,
29961,
16361,
29871,
29900,
29962,
334,
23791,
943,
29961,
16361,
29871,
29896,
29962,
13,
4706,
474,
283,
353,
25869,
29918,
6203,
847,
313,
1884,
29918,
6203,
718,
17360,
29918,
6203,
448,
25869,
29918,
6203,
29897,
13,
13,
4706,
1900,
29918,
25367,
353,
7442,
29889,
1191,
3317,
29898,
29875,
283,
29892,
9685,
10457,
29896,
29897,
13,
13,
4706,
363,
260,
29892,
302,
297,
26985,
29898,
13318,
29918,
25367,
1125,
13,
9651,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
1125,
13,
18884,
565,
302,
297,
17360,
29918,
13168,
29961,
29880,
5387,
13,
13,
462,
1678,
396,
3566,
330,
29873,
304,
697,
6856,
13,
462,
1678,
474,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29896,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
432,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29896,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29900,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
396,
3566,
330,
29873,
304,
697,
17360,
13,
462,
1678,
413,
353,
17360,
29918,
13168,
29961,
29880,
1822,
2248,
29898,
29876,
29897,
13,
462,
1678,
274,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29946,
1822,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29900,
29901,
29946,
29962,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29901,
29946,
29962,
13,
462,
1678,
396,
8158,
353,
29871,
29896,
322,
679,
697,
7375,
770,
3858,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29946,
29962,
353,
29871,
29896,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29945,
718,
274,
29962,
353,
29871,
29896,
13,
13,
1678,
736,
343,
29918,
3009,
13,
13,
13,
1753,
758,
5014,
29918,
3009,
29918,
1884,
267,
29918,
29875,
283,
29918,
386,
690,
29898,
3009,
29918,
1884,
267,
29892,
13,
462,
462,
1678,
1881,
29918,
12181,
29892,
13,
462,
462,
1678,
23791,
943,
29892,
13,
462,
462,
1678,
954,
29918,
13203,
29892,
13,
462,
462,
1678,
474,
283,
29918,
386,
12268,
29922,
29900,
29889,
29941,
1125,
13,
1678,
9995,
657,
1565,
16273,
411,
474,
283,
16897,
15945,
29908,
13,
13,
1678,
4974,
313,
3009,
29918,
1884,
267,
29961,
16361,
29871,
29946,
29962,
529,
954,
29918,
13203,
467,
497,
3285,
525,
1990,
1178,
1818,
367,
3109,
1135,
954,
29918,
13203,
29915,
13,
13,
1678,
954,
29918,
29277,
353,
7431,
29898,
14588,
943,
29897,
849,
29871,
29941,
13,
1678,
17360,
29918,
13168,
353,
5519,
29953,
29892,
29871,
29955,
29892,
29871,
29947,
1402,
518,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
1402,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
5262,
565,
954,
29918,
29277,
1275,
29871,
29941,
1683,
5519,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
1402,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
5262,
13,
13,
1678,
1565,
29918,
1884,
267,
353,
7442,
29889,
2378,
29898,
3009,
29918,
1884,
267,
29892,
26688,
2433,
7411,
29941,
29906,
1495,
13,
1678,
1881,
29918,
12181,
353,
7442,
29889,
2378,
29898,
2080,
29918,
12181,
29892,
26688,
2433,
524,
29941,
29906,
1495,
29871,
396,
29871,
29946,
29896,
29953,
29892,
29946,
29896,
29953,
13,
13,
1678,
16273,
29918,
3594,
353,
313,
3009,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
718,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
2314,
849,
29871,
29906,
13,
1678,
16273,
29918,
1332,
353,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
29962,
448,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
13,
13,
1678,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29900,
29901,
29906,
29962,
353,
16273,
29918,
3594,
847,
1881,
29918,
12181,
7503,
29962,
13,
1678,
1565,
29918,
1884,
267,
29961,
16361,
29871,
29906,
29901,
29946,
29962,
353,
16273,
29918,
1332,
847,
1881,
29918,
12181,
7503,
29962,
13,
13,
1678,
286,
353,
1565,
29918,
1884,
267,
29889,
12181,
29961,
29900,
29962,
13,
1678,
6856,
29918,
845,
11603,
353,
518,
2080,
29918,
12181,
849,
426,
29900,
29901,
29871,
29941,
29906,
29892,
29871,
29896,
29901,
29871,
29896,
29953,
29892,
29871,
29906,
29901,
29871,
29947,
4400,
29880,
29962,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
4638,
13,
1678,
343,
29918,
3009,
353,
518,
9302,
29889,
3298,
359,
3552,
29885,
29892,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29900,
1402,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29896,
1402,
7431,
29898,
25367,
29918,
13168,
29961,
29880,
11724,
29871,
29945,
718,
954,
29918,
13203,
511,
13,
462,
539,
26688,
2433,
7411,
29941,
29906,
1495,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
4638,
13,
1678,
396,
518,
29896,
29892,
29871,
29929,
29892,
29871,
29906,
29962,
13,
1678,
23791,
943,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
14588,
943,
29892,
29871,
29900,
29897,
13,
1678,
17360,
29918,
3317,
267,
353,
23791,
943,
847,
29871,
29906,
29889,
13,
1678,
17360,
29918,
29885,
1144,
353,
448,
25367,
29918,
3317,
267,
13,
13,
1678,
396,
4175,
8340,
16273,
13,
1678,
2854,
29918,
13168,
353,
16273,
29918,
1332,
29961,
16361,
29871,
29900,
29962,
1405,
29871,
29900,
13,
13,
1678,
363,
289,
297,
3464,
29898,
29885,
1125,
13,
4706,
377,
353,
16273,
29918,
1332,
29961,
29890,
29892,
2854,
29918,
13168,
29961,
29890,
5262,
13,
4706,
565,
7431,
29898,
1332,
29897,
1275,
29871,
29900,
29901,
13,
9651,
6773,
13,
4706,
396,
518,
29876,
29892,
29871,
29896,
29892,
29871,
29906,
29962,
13,
4706,
377,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
1332,
29892,
448,
29906,
29897,
13,
4706,
3800,
29918,
3317,
267,
353,
377,
847,
29871,
29906,
29889,
13,
4706,
3800,
29918,
29885,
1144,
353,
448,
1884,
29918,
3317,
267,
13,
13,
4706,
25869,
29918,
29885,
1144,
353,
7442,
29889,
27525,
398,
29898,
1884,
29918,
29885,
1144,
29892,
17360,
29918,
29885,
1144,
29897,
13,
4706,
25869,
29918,
3317,
267,
353,
7442,
29889,
1195,
12539,
29898,
1884,
29918,
3317,
267,
29892,
17360,
29918,
3317,
267,
29897,
13,
4706,
25869,
29918,
1332,
353,
7442,
29889,
27525,
398,
29898,
1639,
8803,
29918,
3317,
267,
448,
25869,
29918,
29885,
1144,
29892,
29871,
29900,
1846,
13,
4706,
25869,
29918,
6203,
353,
25869,
29918,
1332,
29961,
16361,
29871,
29900,
29962,
334,
25869,
29918,
1332,
29961,
16361,
29871,
29896,
29962,
13,
4706,
3800,
29918,
6203,
353,
377,
29961,
16361,
29871,
29900,
29962,
334,
377,
29961,
16361,
29871,
29896,
29962,
13,
4706,
17360,
29918,
6203,
353,
23791,
943,
29961,
16361,
29871,
29900,
29962,
334,
23791,
943,
29961,
16361,
29871,
29896,
29962,
13,
4706,
474,
283,
353,
25869,
29918,
6203,
847,
313,
1884,
29918,
6203,
718,
17360,
29918,
6203,
448,
25869,
29918,
6203,
29897,
13,
13,
4706,
396,
29871,
29896,
29889,
29875,
283,
1405,
474,
283,
29918,
386,
12268,
13,
4706,
6374,
353,
474,
283,
1405,
474,
283,
29918,
386,
12268,
29871,
396,
518,
1949,
29918,
3009,
29918,
1884,
267,
29892,
954,
29918,
14588,
943,
29962,
13,
4706,
363,
260,
29892,
302,
297,
26985,
29898,
1066,
3321,
1125,
13,
9651,
302,
353,
7442,
29889,
2378,
29898,
29876,
29892,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
9651,
926,
29918,
2248,
353,
7442,
29889,
1191,
3062,
29898,
29876,
1275,
29871,
29896,
29897,
13,
9651,
565,
7431,
29898,
1066,
29918,
2248,
1125,
13,
18884,
6773,
13,
9651,
363,
1178,
297,
926,
29918,
2248,
29901,
13,
18884,
1178,
353,
1178,
29961,
29900,
29962,
13,
18884,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
1125,
13,
462,
1678,
565,
1178,
297,
17360,
29918,
13168,
29961,
29880,
5387,
13,
462,
4706,
474,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29896,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
4706,
432,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29896,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29900,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
4706,
413,
353,
17360,
29918,
13168,
29961,
29880,
1822,
2248,
29898,
333,
29897,
13,
462,
4706,
274,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29946,
1822,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
4706,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29900,
29901,
29946,
29962,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29901,
29946,
29962,
13,
13,
462,
4706,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29946,
29962,
353,
29871,
29896,
13,
462,
4706,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29945,
718,
274,
29962,
353,
29871,
29896,
13,
13,
4706,
396,
29871,
29906,
29889,
361,
694,
6374,
17360,
29892,
925,
6755,
278,
1900,
697,
304,
367,
278,
6374,
29889,
13,
4706,
1900,
29918,
25367,
353,
7442,
29889,
1191,
3317,
29898,
29875,
283,
29892,
9685,
10457,
29896,
29897,
13,
4706,
363,
260,
29892,
302,
297,
26985,
29898,
13318,
29918,
25367,
1125,
13,
9651,
363,
301,
297,
3464,
29898,
1949,
29918,
29277,
1125,
13,
18884,
565,
302,
297,
17360,
29918,
13168,
29961,
29880,
5387,
13,
462,
1678,
474,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29896,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
432,
353,
7442,
29889,
14939,
29898,
3009,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29896,
29962,
334,
6856,
29918,
845,
11603,
29961,
29880,
3816,
29900,
14664,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
413,
353,
17360,
29918,
13168,
29961,
29880,
1822,
2248,
29898,
29876,
29897,
13,
462,
1678,
274,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29946,
1822,
579,
668,
877,
524,
29941,
29906,
1495,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29900,
29901,
29946,
29962,
353,
1565,
29918,
1884,
267,
29961,
29890,
29892,
260,
29892,
29871,
29900,
29901,
29946,
29962,
13,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29946,
29962,
353,
29871,
29896,
13,
462,
1678,
343,
29918,
3009,
29961,
29880,
3816,
29890,
29892,
432,
29892,
474,
29892,
413,
29892,
29871,
29945,
718,
274,
29962,
353,
29871,
29896,
13,
13,
1678,
736,
343,
29918,
3009,
13,
13,
13,
1753,
679,
29918,
16175,
29898,
1949,
29918,
1287,
414,
29892,
13,
795,
4236,
29918,
9990,
29918,
2311,
29922,
29941,
29906,
29892,
13,
795,
671,
29918,
29885,
3628,
293,
29918,
29875,
449,
29918,
27959,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
29924,
3267,
29909,
2965,
29918,
29909,
23338,
29892,
13,
795,
6674,
307,
985,
292,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
29924,
8647,
5690,
1672,
23524,
29892,
13,
795,
3579,
19290,
1125,
13,
1678,
9995,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
954,
29918,
1287,
414,
29901,
1669,
1353,
310,
17162,
13,
4706,
4236,
29918,
9990,
29918,
2311,
29901,
9651,
4236,
9521,
2159,
13,
4706,
6674,
307,
985,
292,
29901,
965,
1565,
297,
10542,
322,
2089,
297,
5417,
13,
4706,
671,
29918,
29885,
3628,
293,
29918,
29875,
449,
29918,
27959,
29901,
671,
286,
3628,
293,
29918,
29875,
283,
29918,
386,
690,
29918,
27959,
470,
451,
13,
4706,
3579,
19290,
29901,
462,
29871,
6389,
1304,
297,
848,
15299,
13,
13,
1678,
9995,
13,
13,
1678,
427,
802,
2853,
353,
6213,
13,
13,
1678,
1018,
29901,
13,
4706,
565,
671,
29918,
29885,
3628,
293,
29918,
29875,
449,
29918,
27959,
29901,
13,
9651,
427,
802,
2853,
353,
3251,
1061,
2369,
802,
2853,
29898,
1272,
29918,
27959,
29918,
29885,
3628,
293,
29918,
29875,
283,
29918,
386,
690,
29898,
1068,
19290,
511,
13,
462,
462,
308,
671,
29918,
18056,
307,
985,
292,
29922,
18056,
307,
985,
292,
29897,
13,
4706,
1683,
29901,
13,
9651,
427,
802,
2853,
353,
3251,
1061,
2369,
802,
2853,
29898,
1272,
29918,
27959,
29898,
1068,
19290,
511,
13,
462,
462,
308,
671,
29918,
18056,
307,
985,
292,
29922,
18056,
307,
985,
292,
29897,
13,
4706,
427,
802,
2853,
29889,
2962,
29898,
3317,
29918,
9990,
29918,
2311,
29922,
3317,
29918,
9990,
29918,
2311,
29892,
17162,
29922,
1949,
29918,
1287,
414,
29897,
13,
4706,
15299,
29918,
4905,
353,
6213,
13,
4706,
1550,
5852,
29901,
13,
9651,
1550,
427,
802,
2853,
29889,
275,
29918,
21094,
7295,
13,
18884,
565,
451,
427,
802,
2853,
29889,
9990,
29889,
6310,
7295,
13,
462,
1678,
15299,
29918,
4905,
353,
427,
802,
2853,
29889,
9990,
29889,
657,
580,
13,
462,
1678,
2867,
13,
18884,
1683,
29901,
13,
462,
1678,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29896,
29897,
13,
9651,
7709,
15299,
29918,
4905,
13,
9651,
15299,
29918,
4905,
353,
6213,
13,
1678,
7146,
29901,
13,
4706,
565,
427,
802,
2853,
338,
451,
6213,
29901,
13,
9651,
427,
802,
2853,
29889,
9847,
580,
13,
13,
13,
2917,
353,
15886,
29889,
3991,
1184,
517,
580,
13,
29937,
319,
376,
25353,
29899,
9202,
411,
1302,
2122,
3277,
29908,
5687,
29892,
20875,
515,
263,
1873,
310,
270,
29880,
27631,
29889,
13,
2917,
29889,
29887,
3746,
29918,
6768,
29889,
15956,
1061,
29918,
1853,
353,
525,
29933,
8610,
29915,
13,
2917,
29889,
29887,
3746,
29918,
6768,
29889,
546,
29918,
5014,
29918,
29887,
3746,
29918,
14834,
29918,
29888,
13857,
353,
29871,
29896,
13,
2917,
29889,
29887,
3746,
29918,
6768,
29889,
9536,
29918,
29887,
798,
386,
353,
5852,
13,
842,
29918,
7924,
29898,
13264,
29889,
7317,
29898,
2917,
29922,
2917,
876,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
13,
1678,
17195,
29918,
2084,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
2190,
6632,
29918,
10145,
13,
1678,
2854,
29918,
7665,
29918,
2084,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
26707,
29918,
10145,
13,
13,
1678,
4413,
29918,
2084,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
13875,
1799,
29918,
10145,
13,
1678,
23791,
943,
29918,
2084,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
2190,
3210,
1955,
29918,
10145,
13,
1678,
396,
758,
3018,
1312,
1904,
2224,
13,
1678,
18177,
29918,
2084,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
15094,
29918,
29911,
4717,
1177,
3352,
29918,
20387,
29931,
13,
13,
1678,
770,
29918,
7039,
353,
679,
29918,
13203,
29898,
13203,
29918,
2084,
29897,
13,
1678,
23791,
943,
353,
679,
29918,
14588,
943,
29898,
14588,
943,
29918,
2084,
29897,
13,
1678,
954,
29918,
13203,
353,
7431,
29898,
1990,
29918,
7039,
29897,
13,
1678,
954,
29918,
14588,
943,
353,
7431,
29898,
14588,
943,
29897,
13,
1678,
396,
1423,
3149,
2224,
13,
1678,
1480,
29918,
3972,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29903,
7520,
29923,
29918,
10145,
13,
1678,
396,
10104,
13,
1678,
1881,
29918,
12181,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
15989,
5607,
2692,
2725,
13,
13,
1678,
396,
2821,
3517,
15886,
3983,
13,
1678,
476,
29889,
8551,
29918,
7924,
580,
13,
13,
1678,
1967,
29918,
2080,
353,
10567,
29898,
12181,
7607,
8516,
29892,
6213,
29892,
29871,
29941,
876,
13,
1678,
298,
29892,
281,
353,
1881,
29918,
12181,
13,
13,
1678,
396,
1653,
1904,
13,
1678,
1596,
877,
4391,
612,
29949,
3927,
29894,
29946,
1904,
411,
6571,
23791,
943,
322,
6571,
4413,
29889,
4286,
4830,
29898,
1949,
29918,
14588,
943,
29892,
954,
29918,
13203,
876,
13,
1678,
1904,
29918,
2587,
353,
343,
3543,
29918,
2587,
29898,
3027,
29918,
2080,
29892,
954,
29918,
14588,
943,
849,
29871,
29941,
29892,
954,
29918,
13203,
29897,
13,
13,
1678,
1596,
877,
5896,
18177,
426,
1836,
4286,
4830,
29898,
705,
5861,
29918,
2084,
876,
13,
1678,
1904,
29918,
2587,
29889,
1359,
29918,
705,
5861,
29898,
705,
5861,
29918,
2084,
29892,
491,
29918,
978,
29922,
5574,
29892,
14383,
29918,
29885,
1608,
905,
29922,
5574,
29897,
13,
13,
1678,
343,
29918,
3009,
353,
518,
4290,
29898,
12181,
7607,
29882,
849,
426,
29900,
29901,
29871,
29941,
29906,
29892,
29871,
29896,
29901,
29871,
29896,
29953,
29892,
29871,
29906,
29901,
29871,
29947,
4400,
29880,
1402,
281,
849,
426,
29900,
29901,
29871,
29941,
29906,
29892,
29871,
29896,
29901,
29871,
29896,
29953,
29892,
29871,
29906,
29901,
29871,
29947,
4400,
29880,
1402,
13,
462,
965,
954,
29918,
14588,
943,
849,
29871,
29941,
29892,
954,
29918,
13203,
718,
29871,
29945,
876,
363,
301,
297,
3464,
29898,
29941,
4638,
13,
13,
1678,
6410,
29918,
2080,
353,
518,
29930,
4299,
29918,
2587,
29889,
4905,
29892,
334,
29891,
29918,
3009,
29962,
13,
13,
1678,
396,
10366,
2888,
6410,
7546,
964,
1904,
13,
1678,
1904,
29918,
6758,
353,
365,
2269,
29898,
29891,
3543,
29918,
6758,
29892,
1962,
29918,
12181,
7607,
29896,
29892,
511,
1024,
2433,
29891,
3543,
29918,
6758,
742,
13,
462,
4706,
6273,
3790,
29915,
14588,
943,
2396,
23791,
943,
29892,
13,
462,
462,
259,
525,
1949,
29918,
13203,
2396,
954,
29918,
13203,
29892,
13,
462,
462,
259,
525,
17281,
29918,
386,
3781,
2396,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
6259,
6632,
1525,
29918,
4690,
15989,
29892,
13,
462,
462,
259,
525,
1509,
29918,
29888,
18642,
29918,
5527,
5084,
29918,
6758,
2396,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
6007,
29943,
1367,
1430,
4741,
29918,
5800,
29907,
1964,
29892,
13,
462,
462,
259,
525,
1509,
29918,
29888,
18642,
29918,
1990,
29918,
6758,
2396,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
13875,
1799,
29918,
5800,
29907,
1964,
29892,
13,
462,
462,
259,
525,
1509,
29918,
6051,
283,
2396,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
4571,
27269,
29892,
13,
462,
462,
259,
525,
1509,
29918,
455,
283,
2396,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29907,
5971,
29965,
29892,
13,
462,
462,
259,
525,
2158,
29918,
6758,
2396,
7700,
1800,
29898,
6758,
29918,
2080,
29897,
13,
13,
1678,
396,
1653,
1904,
29918,
6758,
13,
1678,
1904,
353,
8125,
4197,
4299,
29918,
2587,
29889,
2080,
29892,
334,
29891,
29918,
3009,
1402,
1904,
29918,
6758,
29897,
13,
13,
1678,
396,
3889,
911,
29918,
29277,
353,
29871,
29906,
29946,
29929,
13,
1678,
3889,
911,
29918,
29277,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29943,
21661,
10721,
29918,
18799,
23598,
13,
1678,
363,
474,
297,
3464,
29898,
9021,
911,
29918,
29277,
1125,
13,
4706,
1904,
29918,
2587,
29889,
29277,
29961,
29875,
1822,
14968,
519,
353,
7700,
13,
1678,
1596,
877,
20475,
911,
278,
937,
6571,
15359,
310,
3001,
6571,
15359,
29889,
4286,
4830,
29898,
9021,
911,
29918,
29277,
29892,
7431,
29898,
4299,
29918,
2587,
29889,
29277,
4961,
13,
13,
1678,
396,
1423,
3149,
13,
1678,
12183,
353,
323,
6073,
28397,
29898,
1188,
29918,
3972,
29922,
1188,
29918,
3972,
29897,
13,
1678,
1423,
3149,
353,
8125,
5596,
3149,
29898,
1188,
29918,
3972,
718,
525,
1022,
29912,
1022,
2878,
29901,
29900,
29941,
29881,
7402,
6758,
29912,
6758,
29901,
29889,
29941,
29888,
1836,
29882,
29945,
742,
13,
462,
462,
11819,
2433,
6758,
742,
13,
462,
462,
4078,
29918,
705,
5861,
29918,
6194,
29922,
5574,
29892,
13,
462,
462,
4078,
29918,
13318,
29918,
6194,
29922,
8824,
29892,
3785,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29903,
7520,
29923,
29918,
13171,
5971,
29928,
29897,
13,
1678,
396,
10032,
301,
29878,
373,
15284,
585,
13,
1678,
396,
445,
301,
29878,
20228,
338,
15029,
1135,
6776,
457,
385,
484,
284,
13,
1678,
10032,
29918,
29212,
353,
4367,
24551,
29931,
1672,
29876,
3247,
403,
585,
29898,
3712,
2105,
2433,
6758,
742,
7329,
29922,
29900,
29889,
29896,
29892,
282,
24701,
29922,
29945,
29892,
26952,
29922,
29896,
29897,
13,
1678,
396,
474,
1016,
29915,
29873,
671,
4688,
25480,
13672,
1363,
372,
338,
451,
28143,
29889,
13,
1678,
4688,
29918,
7864,
3262,
353,
11095,
20754,
3262,
29898,
3712,
2105,
2433,
6758,
742,
1375,
29918,
4181,
29922,
29900,
29892,
282,
24701,
29922,
29896,
29900,
29892,
26952,
29922,
29896,
29897,
13,
13,
1678,
396,
679,
6694,
25495,
13,
1678,
411,
1722,
29898,
18317,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
3454,
353,
285,
29889,
949,
9012,
580,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
29896,
29900,
29896,
29900,
29896,
29897,
13,
1678,
7442,
29889,
8172,
29889,
845,
21897,
29898,
9012,
29897,
13,
1678,
954,
29918,
14968,
353,
7431,
29898,
9012,
29897,
13,
1678,
396,
679,
2854,
1218,
25495,
13,
1678,
411,
1722,
29898,
3084,
29918,
7665,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
2854,
29918,
9012,
353,
285,
29889,
949,
9012,
580,
13,
1678,
7442,
29889,
8172,
29889,
845,
21897,
29898,
3084,
29918,
9012,
29897,
13,
1678,
954,
29918,
791,
353,
7431,
29898,
3084,
29918,
9012,
29897,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
8516,
29897,
13,
13,
1678,
396,
697,
7408,
6694,
13,
1678,
565,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
26813,
20322,
1001,
29901,
13,
4706,
1904,
29889,
12198,
29898,
20640,
3950,
29922,
3253,
314,
29898,
29212,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29519,
29918,
1254,
10461,
29896,
511,
13,
462,
418,
6410,
3790,
29915,
29891,
3543,
29918,
6758,
2396,
14013,
343,
29918,
3009,
29892,
343,
29918,
11965,
29901,
343,
29918,
11965,
1800,
13,
13,
4706,
9853,
29918,
2311,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29933,
14789,
29896,
13,
4706,
1596,
877,
5323,
262,
373,
6571,
11916,
29892,
659,
373,
6571,
11916,
29892,
411,
9853,
2159,
426,
1836,
4286,
4830,
29898,
1949,
29918,
14968,
29892,
954,
29918,
791,
29892,
9853,
29918,
2311,
876,
13,
4706,
1904,
29889,
9202,
29918,
27959,
29898,
657,
29918,
16175,
29898,
1949,
29918,
1287,
414,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
11686,
29968,
23598,
29892,
13,
462,
462,
418,
4236,
29918,
9990,
29918,
2311,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
12648,
29918,
11144,
4462,
29892,
13,
462,
462,
418,
17195,
29918,
9012,
29922,
9012,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
462,
462,
418,
1881,
29918,
12181,
29922,
2080,
29918,
12181,
29892,
23791,
943,
29922,
14588,
943,
29892,
13,
462,
462,
418,
954,
29918,
13203,
29922,
1949,
29918,
13203,
511,
13,
462,
9651,
6576,
29918,
546,
29918,
1022,
2878,
29922,
3317,
29898,
29896,
29892,
954,
29918,
14968,
849,
9853,
29918,
2311,
511,
13,
462,
9651,
396,
8845,
29918,
1272,
29922,
657,
29918,
16175,
29898,
29896,
29892,
17195,
29918,
9012,
29922,
3084,
29918,
9012,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
462,
9651,
396,
462,
965,
1881,
29918,
12181,
29922,
2080,
29918,
12181,
29892,
23791,
943,
29922,
14588,
943,
29892,
13,
462,
9651,
396,
462,
965,
954,
29918,
13203,
29922,
1949,
29918,
13203,
511,
13,
462,
9651,
396,
8845,
6576,
29901,
472,
278,
1095,
310,
21502,
305,
29892,
5706,
8845,
29918,
24530,
334,
9853,
848,
13,
462,
9651,
396,
8845,
29918,
24530,
29922,
3317,
29898,
29896,
29892,
954,
29918,
791,
849,
9853,
29918,
2311,
511,
13,
462,
9651,
21502,
12168,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29923,
13152,
3210,
29896,
29892,
13,
462,
9651,
2847,
29918,
1022,
2878,
29922,
29900,
29892,
13,
462,
9651,
6939,
29879,
11759,
3198,
3149,
2314,
13,
4706,
1904,
29889,
7620,
29918,
705,
5861,
29898,
1188,
29918,
3972,
718,
525,
3018,
1312,
29918,
705,
5861,
29918,
19190,
29918,
29896,
29889,
29882,
29945,
1495,
13,
13,
1678,
396,
443,
9021,
911,
297,
1473,
7408,
13,
1678,
363,
474,
297,
3464,
29898,
9021,
911,
29918,
29277,
1125,
13,
4706,
1904,
29918,
2587,
29889,
29277,
29961,
29875,
1822,
14968,
519,
353,
5852,
13,
1678,
1596,
877,
29277,
505,
1063,
29395,
307,
2256,
6824,
1495,
13,
13,
1678,
396,
6694,
297,
1473,
7408,
13,
1678,
396,
2691,
260,
1540,
13,
1678,
565,
5852,
29901,
13,
4706,
1904,
29889,
12198,
29898,
20640,
3950,
29922,
3253,
314,
29898,
29212,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29519,
29918,
1254,
10461,
29906,
511,
13,
462,
418,
6410,
3790,
29915,
29891,
3543,
29918,
6758,
2396,
14013,
343,
29918,
3009,
29892,
343,
29918,
11965,
29901,
343,
29918,
11965,
1800,
13,
13,
4706,
9853,
29918,
2311,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29933,
14789,
29906,
13,
13,
4706,
396,
6776,
457,
385,
484,
284,
13,
4706,
3001,
29918,
1022,
2878,
353,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29923,
13152,
3210,
29906,
448,
8707,
18667,
29889,
29911,
4717,
1177,
29889,
29923,
13152,
3210,
29896,
13,
4706,
6776,
457,
29918,
11276,
284,
353,
399,
2817,
3373,
29907,
359,
457,
6185,
388,
4504,
14952,
29898,
21891,
29918,
10492,
29918,
3188,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29519,
29918,
1254,
10461,
29906,
29892,
13,
462,
462,
462,
259,
3001,
29918,
24530,
29922,
7827,
29918,
1022,
2878,
334,
5844,
29889,
27696,
29898,
1949,
29918,
14968,
847,
9853,
29918,
2311,
511,
13,
462,
462,
462,
259,
7292,
29918,
1022,
2878,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
3217,
29903,
29918,
23845,
8932,
29897,
13,
13,
4706,
1596,
877,
5323,
262,
373,
6571,
11916,
29892,
659,
373,
6571,
11916,
29892,
411,
9853,
2159,
426,
1836,
4286,
4830,
29898,
1949,
29918,
14968,
29892,
954,
29918,
791,
29892,
9853,
29918,
2311,
876,
13,
4706,
1904,
29889,
9202,
29918,
27959,
29898,
657,
29918,
16175,
29898,
1949,
29918,
1287,
414,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
11686,
29968,
23598,
29892,
13,
462,
462,
418,
4236,
29918,
9990,
29918,
2311,
29922,
25903,
29889,
25832,
8127,
29911,
29889,
12648,
29918,
11144,
4462,
29892,
13,
462,
462,
418,
17195,
29918,
9012,
29922,
9012,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
462,
462,
418,
1881,
29918,
12181,
29922,
2080,
29918,
12181,
29892,
23791,
943,
29922,
14588,
943,
29892,
13,
462,
462,
418,
954,
29918,
13203,
29922,
1949,
29918,
13203,
511,
13,
462,
9651,
6576,
29918,
546,
29918,
1022,
2878,
29922,
3317,
29898,
29896,
29892,
954,
29918,
14968,
849,
9853,
29918,
2311,
511,
13,
462,
9651,
396,
8845,
29918,
1272,
29922,
657,
29918,
16175,
29898,
18317,
29918,
9012,
29922,
3084,
29918,
9012,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
462,
9651,
396,
462,
965,
1881,
29918,
12181,
29922,
2080,
29918,
12181,
29892,
23791,
943,
29922,
14588,
943,
29892,
13,
462,
9651,
396,
462,
965,
954,
29918,
13203,
29922,
1949,
29918,
13203,
511,
13,
462,
9651,
396,
8845,
29918,
24530,
29922,
3317,
29898,
29896,
29892,
954,
29918,
791,
849,
9853,
29918,
2311,
511,
13,
462,
9651,
21502,
12168,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29923,
13152,
3210,
29906,
29892,
13,
462,
9651,
2847,
29918,
1022,
2878,
29922,
25903,
29889,
29911,
4717,
1177,
29889,
29923,
13152,
3210,
29896,
29892,
13,
462,
9651,
6939,
29879,
11759,
3198,
3149,
29892,
6776,
457,
29918,
11276,
284,
2314,
13,
4706,
1904,
29889,
7620,
29918,
705,
5861,
29898,
1188,
29918,
3972,
718,
525,
4230,
29896,
29889,
29882,
29945,
1495,
13,
2
] |
katana-nbi/katana/api/nfvo.py | afoteas/katana-slice_manager | 0 | 21295 | # -*- coding: utf-8 -*-
import logging
from logging import handlers
import pickle
import time
import uuid
from bson.binary import Binary
from bson.json_util import dumps
from flask import request
from flask_classful import FlaskView
import pymongo
from requests import ConnectTimeout, ConnectionError
from katana.shared_utils.mongoUtils import mongoUtils
from katana.shared_utils.nfvoUtils import osmUtils
# Logging Parameters
logger = logging.getLogger(__name__)
file_handler = handlers.RotatingFileHandler("katana.log", maxBytes=10000, backupCount=5)
stream_handler = logging.StreamHandler()
formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s %(message)s")
stream_formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s %(message)s")
file_handler.setFormatter(formatter)
stream_handler.setFormatter(stream_formatter)
logger.setLevel(logging.DEBUG)
logger.addHandler(file_handler)
logger.addHandler(stream_handler)
class NFVOView(FlaskView):
route_prefix = "/api/"
req_fields = ["id", "nfvousername", "nfvopassword", "nfvoip", "tenantname"]
def index(self):
"""
Returns a list of nfvo and their details,
used by: `katana nfvo ls`
"""
nfvo_data = mongoUtils.index("nfvo")
return_data = []
for infvo in nfvo_data:
return_data.append(
dict(
_id=infvo["_id"],
nfvo_id=infvo["id"],
created_at=infvo["created_at"],
type=infvo["type"],
)
)
return dumps(return_data), 200
# @route('/all/') #/nfvo/all
def all(self):
"""
Same with index(self) above, but returns all nfvo details
"""
return dumps(mongoUtils.index("nfvo")), 200
def get(self, uuid):
"""
Returns the details of specific nfvo,
used by: `katana nfvo inspect [uuid]`
"""
data = mongoUtils.get("nfvo", uuid)
if data:
return dumps(data), 200
else:
return "Not Found", 404
def post(self):
"""
Add a new nfvo. The request must provide the nfvo details.
used by: `katana nfvo add -f [yaml file]`
"""
new_uuid = str(uuid.uuid4())
request.json["_id"] = new_uuid
request.json["created_at"] = time.time() # unix epoch
request.json["tenants"] = {}
if request.json["type"] == "OSM":
# Create the NFVO object
try:
osm_username = request.json["nfvousername"]
osm_password = request.json["<PASSWORD>"]
osm_ip = request.json["nfvoip"]
osm_project_name = request.json["tenantname"]
nfvo_id = request.json["id"]
except KeyError:
return f"Error: Required fields: {self.req_fields}", 400
else:
osm = osmUtils.Osm(nfvo_id, osm_ip, osm_username, osm_password, osm_project_name)
try:
osm.getToken()
except ConnectTimeout as e:
logger.exception("Connection Timeout: {}".format(e))
response = dumps({"error": "Unable to connect to NFVO"})
return (response, 400)
except ConnectionError as e:
logger.exception("Connection Error: {}".format(e))
response = dumps({"error": "Unable to connect to NFVO"})
return (response, 400)
else:
# Store the osm object to the mongo db
thebytes = pickle.dumps(osm)
obj_json = {"_id": new_uuid, "id": request.json["id"], "obj": Binary(thebytes)}
try:
new_uuid = mongoUtils.add("nfvo", request.json)
except pymongo.errors.DuplicateKeyError:
return f"NFVO with id {nfvo_id} already exists", 400
mongoUtils.add("nfvo_obj", obj_json)
# Get information regarding VNFDs and NSDs
osm.bootstrapNfvo()
return f"Created {new_uuid}", 201
else:
response = dumps({"error": "This type nfvo is not supported"})
return response, 400
def delete(self, uuid):
"""
Delete a specific nfvo.
used by: `katana nfvo rm [uuid]`
"""
del_nfvo = mongoUtils.get("nfvo", uuid)
if del_nfvo:
if del_nfvo["tenants"]:
return "Cannot delete nfvo {} - In use".format(uuid), 400
mongoUtils.delete("nfvo_obj", uuid)
mongoUtils.delete_all("nsd", {"nfvo_id": del_nfvo["id"]})
mongoUtils.delete_all("vnfd", {"nfvoid": del_nfvo["id"]})
mongoUtils.delete("nfvo", uuid)
return "Deleted NFVO {}".format(uuid), 200
else:
# if uuid is not found, return error
return "Error: No such nfvo: {}".format(uuid), 404
def put(self, uuid):
"""
Update the details of a specific nfvo.
used by: `katana nfvo update -f [yaml file] [uuid]`
"""
data = request.json
data["_id"] = uuid
old_data = mongoUtils.get("nfvo", uuid)
if old_data:
data["created_at"] = old_data["created_at"]
data["tenants"] = old_data["tenants"]
try:
for entry in self.req_fields:
if data[entry] != old_data[entry]:
return "Cannot update field: " + entry, 400
except KeyError:
return f"Error: Required fields: {self.req_fields}", 400
else:
mongoUtils.update("nfvo", uuid, data)
return f"Modified {uuid}", 200
else:
new_uuid = uuid
data = request.json
data["_id"] = new_uuid
data["created_at"] = time.time() # unix epoch
data["tenants"] = {}
if request.json["type"] == "OSM":
# Create the NFVO object
try:
osm_username = request.json["nfvousername"]
osm_password = request.json["nfvopassword"]
osm_ip = request.json["nfvoip"]
osm_project_name = request.json["tenantname"]
nfvo_id = request.json["id"]
except KeyError:
return f"Error: Required fields: {self.req_fields}", 400
else:
osm = osmUtils.Osm(
nfvo_id, osm_ip, osm_username, osm_password, osm_project_name
)
try:
osm.getToken()
except ConnectTimeout as e:
logger.exception("Connection Timeout: {}".format(e))
response = dumps({"error": "Unable to connect to NFVO"})
return (response, 400)
except ConnectionError as e:
logger.exception("Connection Error: {}".format(e))
response = dumps({"error": "Unable to connect to NFVO"})
return (response, 400)
else:
# Store the osm object to the mongo db
thebytes = pickle.dumps(osm)
obj_json = {"_id": new_uuid, "id": data["id"], "obj": Binary(thebytes)}
try:
new_uuid = mongoUtils.add("nfvo", data)
except pymongo.errors.DuplicateKeyError:
return f"NFVO with id {nfvo_id} already exists", 400
mongoUtils.add("nfvo_obj", obj_json)
# Get information regarding VNFDs and NSDs
osm.bootstrapNfvo()
else:
response = dumps({"error": "This type nfvo is not supported"})
return response, 400
return f"Created {new_uuid}", 201
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
5215,
12183,
13,
3166,
12183,
1053,
25795,
13,
5215,
5839,
280,
13,
5215,
931,
13,
5215,
318,
5416,
13,
13,
3166,
289,
1100,
29889,
19541,
1053,
29479,
13,
3166,
289,
1100,
29889,
3126,
29918,
4422,
1053,
270,
17204,
13,
3166,
29784,
1053,
2009,
13,
3166,
29784,
29918,
1990,
1319,
1053,
2379,
1278,
1043,
13,
5215,
282,
962,
7443,
13,
3166,
7274,
1053,
14971,
10851,
29892,
15160,
2392,
13,
13,
3166,
29466,
1648,
29889,
12366,
29918,
13239,
29889,
29885,
7443,
12177,
1053,
19476,
12177,
13,
3166,
29466,
1648,
29889,
12366,
29918,
13239,
29889,
29876,
29888,
1365,
12177,
1053,
2897,
29885,
12177,
13,
13,
29937,
4522,
3460,
12662,
2699,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
1445,
29918,
13789,
353,
25795,
29889,
21281,
1218,
2283,
4598,
703,
29895,
271,
1648,
29889,
1188,
613,
4236,
11207,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
16199,
3981,
29922,
29945,
29897,
13,
5461,
29918,
13789,
353,
12183,
29889,
3835,
4598,
580,
13,
689,
2620,
353,
12183,
29889,
18522,
11702,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
978,
29897,
29879,
1273,
29898,
5563,
978,
29897,
29879,
1273,
29898,
4906,
29897,
29879,
1159,
13,
5461,
29918,
689,
2620,
353,
12183,
29889,
18522,
11702,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
978,
29897,
29879,
1273,
29898,
5563,
978,
29897,
29879,
1273,
29898,
4906,
29897,
29879,
1159,
13,
1445,
29918,
13789,
29889,
842,
18522,
29898,
689,
2620,
29897,
13,
5461,
29918,
13789,
29889,
842,
18522,
29898,
5461,
29918,
689,
2620,
29897,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
21707,
29889,
1202,
4598,
29898,
1445,
29918,
13789,
29897,
13,
21707,
29889,
1202,
4598,
29898,
5461,
29918,
13789,
29897,
13,
13,
13,
1990,
405,
29943,
24898,
1043,
29898,
8754,
1278,
1043,
1125,
13,
1678,
5782,
29918,
13506,
353,
5591,
2754,
12975,
13,
1678,
12428,
29918,
9621,
353,
6796,
333,
613,
376,
29876,
29888,
29894,
283,
643,
978,
613,
376,
29876,
29888,
29894,
459,
465,
1742,
613,
376,
29876,
29888,
1365,
666,
613,
376,
841,
424,
978,
3108,
13,
13,
1678,
822,
2380,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
263,
1051,
310,
302,
29888,
1365,
322,
1009,
4902,
29892,
13,
4706,
1304,
491,
29901,
421,
29895,
271,
1648,
302,
29888,
1365,
19375,
29952,
13,
4706,
9995,
13,
4706,
302,
29888,
1365,
29918,
1272,
353,
19476,
12177,
29889,
2248,
703,
29876,
29888,
1365,
1159,
13,
4706,
736,
29918,
1272,
353,
5159,
13,
4706,
363,
3041,
1365,
297,
302,
29888,
1365,
29918,
1272,
29901,
13,
9651,
736,
29918,
1272,
29889,
4397,
29898,
13,
18884,
9657,
29898,
13,
462,
1678,
903,
333,
29922,
7192,
1365,
3366,
29918,
333,
12436,
13,
462,
1678,
302,
29888,
1365,
29918,
333,
29922,
7192,
1365,
3366,
333,
12436,
13,
462,
1678,
2825,
29918,
271,
29922,
7192,
1365,
3366,
11600,
29918,
271,
12436,
13,
462,
1678,
1134,
29922,
7192,
1365,
3366,
1853,
12436,
13,
18884,
1723,
13,
9651,
1723,
13,
4706,
736,
270,
17204,
29898,
2457,
29918,
1272,
511,
29871,
29906,
29900,
29900,
13,
13,
1678,
396,
732,
13134,
11219,
497,
29914,
1495,
396,
29914,
29876,
29888,
1365,
29914,
497,
13,
1678,
822,
599,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
19491,
411,
2380,
29898,
1311,
29897,
2038,
29892,
541,
3639,
599,
302,
29888,
1365,
4902,
13,
4706,
9995,
13,
4706,
736,
270,
17204,
29898,
29885,
7443,
12177,
29889,
2248,
703,
29876,
29888,
1365,
1159,
511,
29871,
29906,
29900,
29900,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
318,
5416,
1125,
13,
4706,
9995,
13,
4706,
16969,
278,
4902,
310,
2702,
302,
29888,
1365,
29892,
13,
4706,
1304,
491,
29901,
421,
29895,
271,
1648,
302,
29888,
1365,
16096,
518,
25118,
7961,
13,
4706,
9995,
13,
4706,
848,
353,
19476,
12177,
29889,
657,
703,
29876,
29888,
1365,
613,
318,
5416,
29897,
13,
4706,
565,
848,
29901,
13,
9651,
736,
270,
17204,
29898,
1272,
511,
29871,
29906,
29900,
29900,
13,
4706,
1683,
29901,
13,
9651,
736,
376,
3664,
7460,
613,
29871,
29946,
29900,
29946,
13,
13,
1678,
822,
1400,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3462,
263,
716,
302,
29888,
1365,
29889,
450,
2009,
1818,
3867,
278,
302,
29888,
1365,
4902,
29889,
13,
4706,
1304,
491,
29901,
421,
29895,
271,
1648,
302,
29888,
1365,
788,
448,
29888,
518,
25162,
934,
7961,
13,
4706,
9995,
13,
4706,
716,
29918,
25118,
353,
851,
29898,
25118,
29889,
25118,
29946,
3101,
13,
4706,
2009,
29889,
3126,
3366,
29918,
333,
3108,
353,
716,
29918,
25118,
13,
4706,
2009,
29889,
3126,
3366,
11600,
29918,
271,
3108,
353,
931,
29889,
2230,
580,
29871,
396,
28167,
21502,
305,
13,
4706,
2009,
29889,
3126,
3366,
841,
1934,
3108,
353,
6571,
13,
13,
4706,
565,
2009,
29889,
3126,
3366,
1853,
3108,
1275,
376,
3267,
29924,
1115,
13,
9651,
396,
6204,
278,
405,
29943,
24898,
1203,
13,
9651,
1018,
29901,
13,
18884,
2897,
29885,
29918,
6786,
353,
2009,
29889,
3126,
3366,
29876,
29888,
29894,
283,
643,
978,
3108,
13,
18884,
2897,
29885,
29918,
5630,
353,
2009,
29889,
3126,
3366,
29966,
25711,
17013,
29958,
3108,
13,
18884,
2897,
29885,
29918,
666,
353,
2009,
29889,
3126,
3366,
29876,
29888,
1365,
666,
3108,
13,
18884,
2897,
29885,
29918,
4836,
29918,
978,
353,
2009,
29889,
3126,
3366,
841,
424,
978,
3108,
13,
18884,
302,
29888,
1365,
29918,
333,
353,
2009,
29889,
3126,
3366,
333,
3108,
13,
9651,
5174,
7670,
2392,
29901,
13,
18884,
736,
285,
29908,
2392,
29901,
830,
5958,
4235,
29901,
426,
1311,
29889,
7971,
29918,
9621,
17671,
29871,
29946,
29900,
29900,
13,
9651,
1683,
29901,
13,
18884,
2897,
29885,
353,
2897,
29885,
12177,
29889,
29949,
3844,
29898,
29876,
29888,
1365,
29918,
333,
29892,
2897,
29885,
29918,
666,
29892,
2897,
29885,
29918,
6786,
29892,
2897,
29885,
29918,
5630,
29892,
2897,
29885,
29918,
4836,
29918,
978,
29897,
13,
9651,
1018,
29901,
13,
18884,
2897,
29885,
29889,
657,
6066,
580,
13,
9651,
5174,
14971,
10851,
408,
321,
29901,
13,
18884,
17927,
29889,
11739,
703,
5350,
5974,
449,
29901,
6571,
1642,
4830,
29898,
29872,
876,
13,
18884,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
2525,
519,
304,
4511,
304,
405,
29943,
24898,
29908,
1800,
13,
18884,
736,
313,
5327,
29892,
29871,
29946,
29900,
29900,
29897,
13,
9651,
5174,
15160,
2392,
408,
321,
29901,
13,
18884,
17927,
29889,
11739,
703,
5350,
4829,
29901,
6571,
1642,
4830,
29898,
29872,
876,
13,
18884,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
2525,
519,
304,
4511,
304,
405,
29943,
24898,
29908,
1800,
13,
18884,
736,
313,
5327,
29892,
29871,
29946,
29900,
29900,
29897,
13,
9651,
1683,
29901,
13,
18884,
396,
14491,
278,
2897,
29885,
1203,
304,
278,
19476,
4833,
13,
18884,
278,
13193,
353,
5839,
280,
29889,
29881,
17204,
29898,
359,
29885,
29897,
13,
18884,
5446,
29918,
3126,
353,
8853,
29918,
333,
1115,
716,
29918,
25118,
29892,
376,
333,
1115,
2009,
29889,
3126,
3366,
333,
12436,
376,
5415,
1115,
29479,
29898,
1552,
13193,
2915,
13,
18884,
1018,
29901,
13,
462,
1678,
716,
29918,
25118,
353,
19476,
12177,
29889,
1202,
703,
29876,
29888,
1365,
613,
2009,
29889,
3126,
29897,
13,
18884,
5174,
282,
962,
7443,
29889,
12523,
29889,
29928,
786,
5926,
2558,
2392,
29901,
13,
462,
1678,
736,
285,
29908,
22498,
24898,
411,
1178,
426,
29876,
29888,
1365,
29918,
333,
29913,
2307,
4864,
613,
29871,
29946,
29900,
29900,
13,
18884,
19476,
12177,
29889,
1202,
703,
29876,
29888,
1365,
29918,
5415,
613,
5446,
29918,
3126,
29897,
13,
18884,
396,
3617,
2472,
11211,
478,
22498,
29928,
29879,
322,
3865,
29928,
29879,
13,
18884,
2897,
29885,
29889,
8704,
29940,
29888,
1365,
580,
13,
18884,
736,
285,
29908,
20399,
426,
1482,
29918,
25118,
17671,
29871,
29906,
29900,
29896,
13,
4706,
1683,
29901,
13,
9651,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
4013,
1134,
302,
29888,
1365,
338,
451,
6969,
29908,
1800,
13,
9651,
736,
2933,
29892,
29871,
29946,
29900,
29900,
13,
13,
1678,
822,
5217,
29898,
1311,
29892,
318,
5416,
1125,
13,
4706,
9995,
13,
4706,
21267,
263,
2702,
302,
29888,
1365,
29889,
13,
4706,
1304,
491,
29901,
421,
29895,
271,
1648,
302,
29888,
1365,
20241,
518,
25118,
7961,
13,
4706,
9995,
13,
4706,
628,
29918,
29876,
29888,
1365,
353,
19476,
12177,
29889,
657,
703,
29876,
29888,
1365,
613,
318,
5416,
29897,
13,
4706,
565,
628,
29918,
29876,
29888,
1365,
29901,
13,
9651,
565,
628,
29918,
29876,
29888,
1365,
3366,
841,
1934,
3108,
29901,
13,
18884,
736,
376,
29089,
5217,
302,
29888,
1365,
6571,
448,
512,
671,
1642,
4830,
29898,
25118,
511,
29871,
29946,
29900,
29900,
13,
9651,
19476,
12177,
29889,
8143,
703,
29876,
29888,
1365,
29918,
5415,
613,
318,
5416,
29897,
13,
9651,
19476,
12177,
29889,
8143,
29918,
497,
703,
1983,
29881,
613,
8853,
29876,
29888,
1365,
29918,
333,
1115,
628,
29918,
29876,
29888,
1365,
3366,
333,
3108,
1800,
13,
9651,
19476,
12177,
29889,
8143,
29918,
497,
703,
18564,
11512,
613,
8853,
29876,
29888,
5405,
1115,
628,
29918,
29876,
29888,
1365,
3366,
333,
3108,
1800,
13,
9651,
19476,
12177,
29889,
8143,
703,
29876,
29888,
1365,
613,
318,
5416,
29897,
13,
9651,
736,
376,
2772,
22742,
405,
29943,
24898,
6571,
1642,
4830,
29898,
25118,
511,
29871,
29906,
29900,
29900,
13,
4706,
1683,
29901,
13,
9651,
396,
565,
318,
5416,
338,
451,
1476,
29892,
736,
1059,
13,
9651,
736,
376,
2392,
29901,
1939,
1316,
302,
29888,
1365,
29901,
6571,
1642,
4830,
29898,
25118,
511,
29871,
29946,
29900,
29946,
13,
13,
1678,
822,
1925,
29898,
1311,
29892,
318,
5416,
1125,
13,
4706,
9995,
13,
4706,
10318,
278,
4902,
310,
263,
2702,
302,
29888,
1365,
29889,
13,
4706,
1304,
491,
29901,
421,
29895,
271,
1648,
302,
29888,
1365,
2767,
448,
29888,
518,
25162,
934,
29962,
518,
25118,
7961,
13,
4706,
9995,
13,
4706,
848,
353,
2009,
29889,
3126,
13,
4706,
848,
3366,
29918,
333,
3108,
353,
318,
5416,
13,
4706,
2030,
29918,
1272,
353,
19476,
12177,
29889,
657,
703,
29876,
29888,
1365,
613,
318,
5416,
29897,
13,
13,
4706,
565,
2030,
29918,
1272,
29901,
13,
9651,
848,
3366,
11600,
29918,
271,
3108,
353,
2030,
29918,
1272,
3366,
11600,
29918,
271,
3108,
13,
9651,
848,
3366,
841,
1934,
3108,
353,
2030,
29918,
1272,
3366,
841,
1934,
3108,
13,
9651,
1018,
29901,
13,
18884,
363,
6251,
297,
1583,
29889,
7971,
29918,
9621,
29901,
13,
462,
1678,
565,
848,
29961,
8269,
29962,
2804,
2030,
29918,
1272,
29961,
8269,
5387,
13,
462,
4706,
736,
376,
29089,
2767,
1746,
29901,
376,
718,
6251,
29892,
29871,
29946,
29900,
29900,
13,
9651,
5174,
7670,
2392,
29901,
13,
18884,
736,
285,
29908,
2392,
29901,
830,
5958,
4235,
29901,
426,
1311,
29889,
7971,
29918,
9621,
17671,
29871,
29946,
29900,
29900,
13,
9651,
1683,
29901,
13,
18884,
19476,
12177,
29889,
5504,
703,
29876,
29888,
1365,
613,
318,
5416,
29892,
848,
29897,
13,
9651,
736,
285,
29908,
2111,
2164,
426,
25118,
17671,
29871,
29906,
29900,
29900,
13,
4706,
1683,
29901,
13,
9651,
716,
29918,
25118,
353,
318,
5416,
13,
9651,
848,
353,
2009,
29889,
3126,
13,
9651,
848,
3366,
29918,
333,
3108,
353,
716,
29918,
25118,
13,
9651,
848,
3366,
11600,
29918,
271,
3108,
353,
931,
29889,
2230,
580,
29871,
396,
28167,
21502,
305,
13,
9651,
848,
3366,
841,
1934,
3108,
353,
6571,
13,
13,
9651,
565,
2009,
29889,
3126,
3366,
1853,
3108,
1275,
376,
3267,
29924,
1115,
13,
18884,
396,
6204,
278,
405,
29943,
24898,
1203,
13,
18884,
1018,
29901,
13,
462,
1678,
2897,
29885,
29918,
6786,
353,
2009,
29889,
3126,
3366,
29876,
29888,
29894,
283,
643,
978,
3108,
13,
462,
1678,
2897,
29885,
29918,
5630,
353,
2009,
29889,
3126,
3366,
29876,
29888,
29894,
459,
465,
1742,
3108,
13,
462,
1678,
2897,
29885,
29918,
666,
353,
2009,
29889,
3126,
3366,
29876,
29888,
1365,
666,
3108,
13,
462,
1678,
2897,
29885,
29918,
4836,
29918,
978,
353,
2009,
29889,
3126,
3366,
841,
424,
978,
3108,
13,
462,
1678,
302,
29888,
1365,
29918,
333,
353,
2009,
29889,
3126,
3366,
333,
3108,
13,
18884,
5174,
7670,
2392,
29901,
13,
462,
1678,
736,
285,
29908,
2392,
29901,
830,
5958,
4235,
29901,
426,
1311,
29889,
7971,
29918,
9621,
17671,
29871,
29946,
29900,
29900,
13,
18884,
1683,
29901,
13,
462,
1678,
2897,
29885,
353,
2897,
29885,
12177,
29889,
29949,
3844,
29898,
13,
462,
4706,
302,
29888,
1365,
29918,
333,
29892,
2897,
29885,
29918,
666,
29892,
2897,
29885,
29918,
6786,
29892,
2897,
29885,
29918,
5630,
29892,
2897,
29885,
29918,
4836,
29918,
978,
13,
462,
1678,
1723,
13,
18884,
1018,
29901,
13,
462,
1678,
2897,
29885,
29889,
657,
6066,
580,
13,
18884,
5174,
14971,
10851,
408,
321,
29901,
13,
462,
1678,
17927,
29889,
11739,
703,
5350,
5974,
449,
29901,
6571,
1642,
4830,
29898,
29872,
876,
13,
462,
1678,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
2525,
519,
304,
4511,
304,
405,
29943,
24898,
29908,
1800,
13,
462,
1678,
736,
313,
5327,
29892,
29871,
29946,
29900,
29900,
29897,
13,
18884,
5174,
15160,
2392,
408,
321,
29901,
13,
462,
1678,
17927,
29889,
11739,
703,
5350,
4829,
29901,
6571,
1642,
4830,
29898,
29872,
876,
13,
462,
1678,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
2525,
519,
304,
4511,
304,
405,
29943,
24898,
29908,
1800,
13,
462,
1678,
736,
313,
5327,
29892,
29871,
29946,
29900,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
14491,
278,
2897,
29885,
1203,
304,
278,
19476,
4833,
13,
462,
1678,
278,
13193,
353,
5839,
280,
29889,
29881,
17204,
29898,
359,
29885,
29897,
13,
462,
1678,
5446,
29918,
3126,
353,
8853,
29918,
333,
1115,
716,
29918,
25118,
29892,
376,
333,
1115,
848,
3366,
333,
12436,
376,
5415,
1115,
29479,
29898,
1552,
13193,
2915,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
716,
29918,
25118,
353,
19476,
12177,
29889,
1202,
703,
29876,
29888,
1365,
613,
848,
29897,
13,
462,
1678,
5174,
282,
962,
7443,
29889,
12523,
29889,
29928,
786,
5926,
2558,
2392,
29901,
13,
462,
4706,
736,
285,
29908,
22498,
24898,
411,
1178,
426,
29876,
29888,
1365,
29918,
333,
29913,
2307,
4864,
613,
29871,
29946,
29900,
29900,
13,
462,
1678,
19476,
12177,
29889,
1202,
703,
29876,
29888,
1365,
29918,
5415,
613,
5446,
29918,
3126,
29897,
13,
462,
1678,
396,
3617,
2472,
11211,
478,
22498,
29928,
29879,
322,
3865,
29928,
29879,
13,
462,
1678,
2897,
29885,
29889,
8704,
29940,
29888,
1365,
580,
13,
9651,
1683,
29901,
13,
18884,
2933,
353,
270,
17204,
3319,
29908,
2704,
1115,
376,
4013,
1134,
302,
29888,
1365,
338,
451,
6969,
29908,
1800,
13,
18884,
736,
2933,
29892,
29871,
29946,
29900,
29900,
13,
9651,
736,
285,
29908,
20399,
426,
1482,
29918,
25118,
17671,
29871,
29906,
29900,
29896,
13,
2
] |
mtr/sync/lib/converters.py | mtrgroup/django-mtr-import-export | 0 | 1614403 | from decimal import Decimal
from django.utils.six import text_type
from django.utils.encoding import smart_text
from .manager import manager
from ..translation import gettext_lazy as _
@manager.register('converter', label=_('Decimal'))
def decimal(value, action):
if value:
if isinstance(value, text_type):
value = value.replace(',', '.')
return Decimal(value)
else:
return Decimal(0)
@manager.register('converter', label=_('String'))
def string(value, action):
if value:
return smart_text(value)
else:
return ''
@manager.register('converter', label=_('Coma separated list'))
def comalist(value, action):
if action == 'export':
if isinstance(value, list):
return ','.join(smart_text(v) for v in value)
else:
if isinstance(value, text_type):
return value.split(',')
return [value]
@manager.register('converter', label=_('Boolean'))
def boolean(value, action):
if isinstance(value, str):
if value.isdigit():
value = int(value)
elif not isinstance(value, int):
value = 0
return bool(value)
@manager.register('converter', label=_('File path'))
def filepath(value, action):
if value:
return value.path
else:
return value
@manager.register('converter', label=_('Integer'))
def integer(value, action):
if value:
return int(value)
else:
return value
@manager.register('converter', label=_('None'))
def none(value, action):
return None
| [
1,
515,
13677,
1053,
3826,
3039,
13,
13,
3166,
9557,
29889,
13239,
29889,
28319,
1053,
1426,
29918,
1853,
13,
3166,
9557,
29889,
13239,
29889,
22331,
1053,
15040,
29918,
726,
13,
13,
3166,
869,
12847,
1053,
8455,
13,
3166,
6317,
3286,
18411,
1053,
679,
726,
29918,
433,
1537,
408,
903,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
23307,
8785,
13,
1753,
13677,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
995,
29901,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
1426,
29918,
1853,
1125,
13,
9651,
995,
353,
995,
29889,
6506,
29317,
742,
15300,
1495,
13,
4706,
736,
3826,
3039,
29898,
1767,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
3826,
3039,
29898,
29900,
29897,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
1231,
8785,
13,
1753,
1347,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
995,
29901,
13,
4706,
736,
15040,
29918,
726,
29898,
1767,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
6629,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
1523,
29874,
13055,
1051,
8785,
13,
1753,
419,
284,
391,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
3158,
1275,
525,
15843,
2396,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
1051,
1125,
13,
9651,
736,
13420,
4286,
7122,
29898,
3844,
442,
29918,
726,
29898,
29894,
29897,
363,
325,
297,
995,
29897,
13,
1678,
1683,
29901,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
1426,
29918,
1853,
1125,
13,
9651,
736,
995,
29889,
5451,
29317,
1495,
13,
1678,
736,
518,
1767,
29962,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
18146,
8785,
13,
1753,
7223,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
338,
8758,
29898,
1767,
29892,
851,
1125,
13,
4706,
565,
995,
29889,
275,
26204,
7295,
13,
9651,
995,
353,
938,
29898,
1767,
29897,
13,
1678,
25342,
451,
338,
8758,
29898,
1767,
29892,
938,
1125,
13,
4706,
995,
353,
29871,
29900,
13,
1678,
736,
6120,
29898,
1767,
29897,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
2283,
2224,
8785,
13,
1753,
934,
2084,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
995,
29901,
13,
4706,
736,
995,
29889,
2084,
13,
1678,
1683,
29901,
13,
4706,
736,
995,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
7798,
8785,
13,
1753,
6043,
29898,
1767,
29892,
3158,
1125,
13,
1678,
565,
995,
29901,
13,
4706,
736,
938,
29898,
1767,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
995,
13,
13,
13,
29992,
12847,
29889,
9573,
877,
535,
13549,
742,
3858,
29922,
29918,
877,
8516,
8785,
13,
1753,
5642,
29898,
1767,
29892,
3158,
1125,
13,
1678,
736,
6213,
13,
2
] |
omicexperiment/transforms/filters/taxonomy.py | bassio/omicexperiment | 7 | 190878 | import pandas as pd
from omicexperiment.transforms.transform import Filter, AttributeFilter, AttributeFlexibleOperatorMixin
class TaxonomyAttributeFilter(AttributeFilter, AttributeFlexibleOperatorMixin):
def __dapply__(self, experiment):
_op = self._op_function(experiment._counts_with_tax())
criteria = _op(self.value)
return experiment.data_df[criteria]
def __eapply__(self, experiment):
filtered_df = self.__dapply__(experiment)
return experiment.with_data_df(filtered_df)
| [
1,
1053,
11701,
408,
10518,
13,
3166,
2703,
625,
29916,
15362,
29889,
9067,
29879,
29889,
9067,
1053,
19916,
29892,
23833,
5072,
29892,
23833,
29943,
2506,
1821,
26486,
29924,
861,
262,
13,
13,
13,
1990,
17847,
21926,
6708,
5072,
29898,
6708,
5072,
29892,
23833,
29943,
2506,
1821,
26486,
29924,
861,
262,
1125,
13,
1678,
822,
4770,
29881,
7302,
12035,
1311,
29892,
7639,
1125,
13,
4706,
903,
459,
353,
1583,
3032,
459,
29918,
2220,
29898,
735,
15362,
3032,
2798,
29879,
29918,
2541,
29918,
20725,
3101,
13,
4706,
16614,
353,
903,
459,
29898,
1311,
29889,
1767,
29897,
13,
4706,
736,
7639,
29889,
1272,
29918,
2176,
29961,
29883,
21977,
29962,
13,
268,
13,
1678,
822,
4770,
29872,
7302,
12035,
1311,
29892,
7639,
1125,
13,
4706,
22289,
29918,
2176,
353,
1583,
17255,
29881,
7302,
12035,
735,
15362,
29897,
13,
4706,
736,
7639,
29889,
2541,
29918,
1272,
29918,
2176,
29898,
4572,
287,
29918,
2176,
29897,
13,
308,
13,
2
] |
scqubits/io_utils/fileio_backends.py | IlyaLSMmisis/scqubits-1 | 0 | 119290 | # fileio_backends.py
#
# This file is part of scqubits.
#
# Copyright (c) 2019, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
############################################################################
"""
Helper routines for writing data to h5 files.
"""
import ast
import csv
import os
import re
from abc import ABC, abstractmethod
import numpy as np
try:
import h5py
except ImportError:
_HAS_H5PY = False
else:
_HAS_H5PY = True
import scqubits.io_utils.fileio as io
import scqubits.utils.misc as utils
class IOWriter(ABC):
"""
ABC for writing class instance data to file.
Parameters
----------
filename: str
file_handle: h5.Group, optional
"""
def __init__(self, filename, file_handle=None):
self.filename = filename
self.io_data = None
self.file_handle = file_handle
@abstractmethod
def to_file(self, io_data, **kwargs):
pass
@abstractmethod
def write_attributes(self, *args, **kwargs):
pass
@abstractmethod
def write_ndarrays(self, *args, **kwargs):
pass
@abstractmethod
def write_objects(self, *args, **kwargs):
pass
class H5Writer(IOWriter):
"""Writes IOData to a custom-format h5 file"""
def write_attributes(self, h5file_group):
"""
Attribute data consists of
1. `__init__` parameters that are of type str or numerical. These are directly written into `h5py.Group.attrs`
2. lists are stored under `<h5py.Group>/__lists`
3. dicts are stored under `<h5py.Group>/__dicts`
Parameters
----------
h5file_group: h5py.Group
"""
h5file_group.attrs.create("__type", self.io_data.typename) # Record the type of the current class instance
attributes = self.io_data.attributes
for attr_name, attr_value in attributes.items():
if isinstance(attr_value, dict): # h5py does not serialize dicts automatically, so have to do it manually
group_name = "__dicts/" + attr_name
h5file_group.create_group(group_name)
io.write(attr_value, self.filename, file_handle=h5file_group[group_name])
elif isinstance(attr_value, (list, tuple)):
group_name = "__lists/" + attr_name
h5file_group.create_group(group_name)
io.write(attr_value, self.filename, file_handle=h5file_group[group_name])
else:
h5file_group.attrs[attr_name] = attr_value
def write_ndarrays(self, h5file_group):
"""
Writes ndarray (float or complex) data contained in `self.iodata` to the provided `h5py.Group` as a
`h5py.Dataset`, using gzip compression.
Parameters
----------
h5file_group: h5py.Group
"""
for name, array in self.io_data.ndarrays.items():
h5file_group.create_dataset(name, data=array, dtype=array.dtype, compression="gzip")
def write_objects(self, h5file_group):
"""
Writes data representing a Python object other than ndarray, list and dict, contained in `self.iodata` to the
provided `h5py.Group` und `<h5py.Group>/__objects`.
Parameters
----------
h5file_group: h5py.Group
"""
h5file_group = h5file_group.create_group("__objects")
for obj_name in self.io_data.objects.keys():
new_h5group = h5file_group.create_group(obj_name)
io.write(self.io_data.objects[obj_name], self.filename, file_handle=new_h5group)
@utils.Required(h5py=_HAS_H5PY)
def to_file(self, io_data, file_handle=None):
"""
Takes the serialized IOData and writes it either to a new h5 file with file name given by `self.filename` to to
the given h5py.Group of an open h5 file.
Parameters
----------
io_data: IOData
file_handle: h5py.Group, optional
"""
self.io_data = io_data
if file_handle is None:
h5file_group = h5py.File(self.filename, 'w')
else:
h5file_group = file_handle
self.write_attributes(h5file_group)
self.write_ndarrays(h5file_group)
self.write_objects(h5file_group)
class H5Reader:
"""
Enables reading h5 files generated with scqubits.
Parameters
----------
filename: str
file_handle: h5py.Group, optional
"""
def __init__(self, filename, file_handle=None):
self.filename = filename
self.io_data = None
self.file_handle = file_handle
@staticmethod
def h5_attrs_to_dict(h5_attrs):
"""
Converts h5 attribute data to a Python dictionary.
Parameters
----------
h5_attrs: h5py.AttributeManager
as obtained by accessing `<h5py.Group>.attrs`
Returns
-------
dict [str, str or Number]
"""
return {attr_name: attr_value for attr_name, attr_value in h5_attrs.items()}
def read_attributes(self, h5file_group):
"""
Read data from h5 file group that is stored directly as `<h5py.Group>.attrs`, or saved in subgroups titled
`<h5py.Group>/__lists` and `<h5py.Group>/__dicts`.
Parameters
----------
h5file_group: h5py.Group
Returns
-------
dict [str, dict or list]
"""
attributes = self.h5_attrs_to_dict(h5file_group.attrs)
if '__dicts' in h5file_group:
for dict_name in h5file_group['__dicts']:
attributes[dict_name] = io.read(self.filename, h5file_group['__dicts/' + dict_name])
if '__lists' in h5file_group:
for list_name in h5file_group['__lists']:
attributes[list_name] = io.read(self.filename, h5file_group['__lists/' + list_name])
return attributes
def read_ndarrays(self, h5file_group):
"""
Read numpy array data from h5 file group.
Parameters
----------
h5file_group: h5py.Group
Returns
-------
dict [str, ndarray]
"""
ndarrays = {name: array[:] for name, array in h5file_group.items() if isinstance(array, h5py.Dataset)}
return ndarrays
def read_objects(self, h5file_group):
"""
Read data from the given h5 file group that represents a Python object other than an ndarray, list, or dict.
Parameters
----------
h5file_group: h5py.Group
Returns
-------
dict [str, IOData]
"""
inner_objects = {}
h5file_group = h5file_group["__objects"]
for obj_name in h5file_group:
inner_objects[obj_name] = io.read(self.filename, h5file_group[obj_name])
return inner_objects
@utils.Required(h5py=_HAS_H5PY)
def from_file(self, filename, file_handle=None):
"""
Either opens a new h5 file for reading or accesses an already opened file via the given h5.Group handle. Reads
all data from the three categories of attributes (incl. lists and dicts), ndarrays, and objects.
Parameters
----------
filename: str
file_handle: h5.Group, optional
Returns
-------
IOData
"""
if file_handle is None:
h5file_group = h5py.File(filename, 'r')
else:
h5file_group = file_handle
attributes = self.read_attributes(h5file_group)
typename = attributes['__type']
del attributes['__type']
ndarrays = self.read_ndarrays(h5file_group)
inner_objects = self.read_objects(h5file_group)
return io.IOData(typename, attributes, ndarrays, inner_objects)
class CSVWriter(IOWriter):
"""
Given filename='somename.csv', write initdata into somename.csv
Then, additional csv files are written for each dataset, with filenames: 'somename_' + dataname0 + '.csv' etc.
"""
def append_ndarray_info(self, attributes):
"""Add data set information to attributes, so that dataset names and dimensions are available
in attributes CSV file."""
for index, dataname in enumerate(self.io_data.ndarrays.keys()):
data = self.io_data.ndarrays[dataname]
attributes['dataset' + str(index)] = dataname
if data.ndim == 3:
slice_count = len(data)
else:
slice_count = 1
attributes['dataset' + str(index) + '.slices'] = slice_count
return attributes
def write_attributes(self, filename):
attributes = self.io_data.attributes
attributes["__type"] = self.io_data.typename
attributes = self.append_ndarray_info(attributes)
with open(filename, mode='w', newline='') as meta_file:
file_writer = csv.writer(meta_file, delimiter=',')
file_writer.writerow(attributes.keys())
file_writer.writerow(attributes.values())
def write_ndarrays(self, filename):
filename_stub, _ = os.path.splitext(filename)
for dataname, dataset in self.io_data.ndarrays.items():
filename = filename_stub + '_' + dataname + '.csv'
self.write_data(filename, dataset)
def write_data(self, filename, dataset):
if dataset.ndim <= 2:
np.savetxt(filename, dataset)
elif dataset.ndim == 3:
np_savetxt_3d(dataset, filename)
else:
raise Exception("Dataset has dimensions > 3. Cannot write to CSV file.")
def write_objects(self, *args, **kwargs):
raise NotImplementedError
def to_file(self, io_data, **kwargs):
self.io_data = io_data
self.write_attributes(self.filename)
self.write_ndarrays(self.filename)
# no support for write_objects in CSV format
class CSVReader:
@staticmethod
def read_attributes(filename):
with open(filename, mode='r') as meta_file:
file_reader = csv.reader(meta_file, delimiter=',')
meta_keys = file_reader.__next__()
meta_values = file_reader.__next__()
return dict(zip(meta_keys, meta_values))
def process_metadict(self, meta_dict):
attributes = {
attr_name: utils.to_expression_or_string(attr_value) for attr_name, attr_value in meta_dict.items()
if not re.match(r'dataset\d+', attr_name)
}
data_names = [dataname for datalabel, dataname in meta_dict.items() if re.match(r'dataset\d+$', datalabel)]
data_slices = [ast.literal_eval(value) for key, value in meta_dict.items()
if re.match(r'dataset\d+.slices', key)]
return attributes, data_names, data_slices
@staticmethod
def read_data(filename, slices):
try:
data_array = np.loadtxt(filename)
except ValueError:
data_array = np.loadtxt(filename, dtype=np.complex_)
if slices > 1:
nrows, ncols = data_array.shape
return data_array.reshape((slices, nrows//slices, ncols))
return data_array
def from_file(self, filename, **kwargs):
"""
Parameters
----------
filename: str
Returns
-------
class instance generated from file data
"""
ext_attributes = self.read_attributes(filename)
typename = ext_attributes['__type']
del ext_attributes['__type']
attributes, data_names, data_slices = self.process_metadict(ext_attributes)
filename_stub, _ = os.path.splitext(filename)
ndarrays = {}
for index, dataname in enumerate(data_names):
data_filename = filename_stub + '_' + dataname + '.csv'
slices = data_slices[index]
ndarrays[dataname] = self.read_data(data_filename, slices)
return io.IOData(typename, attributes, ndarrays, objects=None)
def np_savetxt_3d(array3d, filename):
"""
Helper function that splits a 3d numpy array into 2d slices for writing as csv data to a new file. Slices are
separated by a comment row `# New slice`.
Parameters
----------
array3d: ndarray with ndim = 3
filename: str
"""
with open(filename, mode='w', newline='') as datafile:
datafile.write('# Array shape: {0}\n'.format(array3d.shape))
for data_slice in array3d:
np.savetxt(datafile, data_slice)
datafile.write('# New slice\n')
| [
1,
396,
934,
601,
29918,
1627,
1975,
29889,
2272,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
885,
339,
14836,
29889,
13,
29937,
13,
29937,
1678,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29929,
29892,
529,
5813,
29958,
322,
529,
5813,
29958,
13,
29937,
1678,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
1678,
910,
2752,
775,
338,
7794,
21144,
1090,
278,
350,
7230,
29899,
3293,
19405,
1476,
297,
278,
13,
29937,
1678,
365,
2965,
1430,
1660,
934,
297,
278,
3876,
3884,
310,
445,
2752,
5447,
29889,
13,
13383,
13383,
13383,
13383,
7346,
4136,
13,
15945,
29908,
13,
10739,
6745,
1475,
363,
5007,
848,
304,
298,
29945,
2066,
29889,
13,
15945,
29908,
13,
5215,
8717,
13,
5215,
11799,
13,
5215,
2897,
13,
5215,
337,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
13,
5215,
12655,
408,
7442,
13,
13,
2202,
29901,
13,
1678,
1053,
298,
29945,
2272,
13,
19499,
16032,
2392,
29901,
13,
1678,
903,
29950,
3289,
29918,
29950,
29945,
20055,
353,
7700,
13,
2870,
29901,
13,
1678,
903,
29950,
3289,
29918,
29950,
29945,
20055,
353,
5852,
13,
13,
5215,
885,
339,
14836,
29889,
601,
29918,
13239,
29889,
1445,
601,
408,
12013,
13,
5215,
885,
339,
14836,
29889,
13239,
29889,
29885,
10669,
408,
3667,
29879,
13,
13,
13,
1990,
306,
9806,
5385,
29898,
19658,
1125,
13,
1678,
9995,
13,
1678,
16417,
363,
5007,
770,
2777,
848,
304,
934,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
10422,
29901,
851,
13,
1678,
934,
29918,
8411,
29901,
298,
29945,
29889,
4782,
29892,
13136,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10422,
29892,
934,
29918,
8411,
29922,
8516,
1125,
13,
4706,
1583,
29889,
9507,
353,
10422,
13,
4706,
1583,
29889,
601,
29918,
1272,
353,
6213,
13,
4706,
1583,
29889,
1445,
29918,
8411,
353,
934,
29918,
8411,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
304,
29918,
1445,
29898,
1311,
29892,
12013,
29918,
1272,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2436,
29918,
15697,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2436,
29918,
299,
2378,
29879,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2436,
29918,
12650,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
379,
29945,
10507,
29898,
5971,
10507,
1125,
13,
1678,
9995,
29956,
768,
267,
10663,
1469,
304,
263,
2888,
29899,
4830,
298,
29945,
934,
15945,
29908,
13,
1678,
822,
2436,
29918,
15697,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
23833,
848,
11624,
310,
13,
13,
3986,
29896,
29889,
21326,
2344,
1649,
29952,
4128,
393,
526,
310,
1134,
851,
470,
16259,
29889,
4525,
526,
4153,
3971,
964,
421,
29882,
29945,
2272,
29889,
4782,
29889,
5552,
29879,
29952,
13,
3986,
29906,
29889,
8857,
526,
6087,
1090,
14935,
29882,
29945,
2272,
29889,
4782,
20690,
1649,
21513,
29952,
13,
3986,
29941,
29889,
9657,
29879,
526,
6087,
1090,
14935,
29882,
29945,
2272,
29889,
4782,
20690,
1649,
8977,
29879,
29952,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
4706,
9995,
13,
4706,
298,
29945,
1445,
29918,
2972,
29889,
5552,
29879,
29889,
3258,
703,
1649,
1853,
613,
1583,
29889,
601,
29918,
1272,
29889,
22646,
29897,
1678,
396,
14164,
278,
1134,
310,
278,
1857,
770,
2777,
13,
4706,
8393,
353,
1583,
29889,
601,
29918,
1272,
29889,
15697,
13,
4706,
363,
12421,
29918,
978,
29892,
12421,
29918,
1767,
297,
8393,
29889,
7076,
7295,
13,
9651,
565,
338,
8758,
29898,
5552,
29918,
1767,
29892,
9657,
1125,
29871,
396,
298,
29945,
2272,
947,
451,
28755,
9657,
29879,
6336,
29892,
577,
505,
304,
437,
372,
7522,
13,
18884,
2318,
29918,
978,
353,
376,
1649,
8977,
29879,
12975,
718,
12421,
29918,
978,
13,
18884,
298,
29945,
1445,
29918,
2972,
29889,
3258,
29918,
2972,
29898,
2972,
29918,
978,
29897,
13,
18884,
12013,
29889,
3539,
29898,
5552,
29918,
1767,
29892,
1583,
29889,
9507,
29892,
934,
29918,
8411,
29922,
29882,
29945,
1445,
29918,
2972,
29961,
2972,
29918,
978,
2314,
13,
9651,
25342,
338,
8758,
29898,
5552,
29918,
1767,
29892,
313,
1761,
29892,
18761,
22164,
13,
18884,
2318,
29918,
978,
353,
376,
1649,
21513,
12975,
718,
12421,
29918,
978,
13,
18884,
298,
29945,
1445,
29918,
2972,
29889,
3258,
29918,
2972,
29898,
2972,
29918,
978,
29897,
13,
18884,
12013,
29889,
3539,
29898,
5552,
29918,
1767,
29892,
1583,
29889,
9507,
29892,
934,
29918,
8411,
29922,
29882,
29945,
1445,
29918,
2972,
29961,
2972,
29918,
978,
2314,
13,
9651,
1683,
29901,
13,
18884,
298,
29945,
1445,
29918,
2972,
29889,
5552,
29879,
29961,
5552,
29918,
978,
29962,
353,
12421,
29918,
1767,
13,
13,
1678,
822,
2436,
29918,
299,
2378,
29879,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
16849,
267,
29871,
299,
2378,
313,
7411,
470,
4280,
29897,
848,
11122,
297,
421,
1311,
29889,
2660,
532,
29952,
304,
278,
4944,
421,
29882,
29945,
2272,
29889,
4782,
29952,
408,
263,
13,
4706,
421,
29882,
29945,
2272,
29889,
16390,
24541,
1673,
773,
330,
7554,
24221,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
4706,
9995,
13,
4706,
363,
1024,
29892,
1409,
297,
1583,
29889,
601,
29918,
1272,
29889,
299,
2378,
29879,
29889,
7076,
7295,
13,
9651,
298,
29945,
1445,
29918,
2972,
29889,
3258,
29918,
24713,
29898,
978,
29892,
848,
29922,
2378,
29892,
26688,
29922,
2378,
29889,
29881,
1853,
29892,
24221,
543,
29887,
7554,
1159,
13,
13,
1678,
822,
2436,
29918,
12650,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
16849,
267,
848,
15783,
263,
5132,
1203,
916,
1135,
29871,
299,
2378,
29892,
1051,
322,
9657,
29892,
11122,
297,
421,
1311,
29889,
2660,
532,
29952,
304,
278,
13,
4706,
4944,
421,
29882,
29945,
2272,
29889,
4782,
29952,
29871,
563,
14935,
29882,
29945,
2272,
29889,
4782,
20690,
1649,
12650,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
4706,
9995,
13,
4706,
298,
29945,
1445,
29918,
2972,
353,
298,
29945,
1445,
29918,
2972,
29889,
3258,
29918,
2972,
703,
1649,
12650,
1159,
13,
4706,
363,
5446,
29918,
978,
297,
1583,
29889,
601,
29918,
1272,
29889,
12650,
29889,
8149,
7295,
13,
9651,
716,
29918,
29882,
29945,
2972,
353,
298,
29945,
1445,
29918,
2972,
29889,
3258,
29918,
2972,
29898,
5415,
29918,
978,
29897,
13,
9651,
12013,
29889,
3539,
29898,
1311,
29889,
601,
29918,
1272,
29889,
12650,
29961,
5415,
29918,
978,
1402,
1583,
29889,
9507,
29892,
934,
29918,
8411,
29922,
1482,
29918,
29882,
29945,
2972,
29897,
13,
13,
1678,
732,
13239,
29889,
19347,
29898,
29882,
29945,
2272,
29922,
29918,
29950,
3289,
29918,
29950,
29945,
20055,
29897,
13,
1678,
822,
304,
29918,
1445,
29898,
1311,
29892,
12013,
29918,
1272,
29892,
934,
29918,
8411,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
323,
6926,
278,
7797,
1891,
10663,
1469,
322,
15873,
372,
2845,
304,
263,
716,
298,
29945,
934,
411,
934,
1024,
2183,
491,
421,
1311,
29889,
9507,
29952,
304,
304,
13,
4706,
278,
2183,
298,
29945,
2272,
29889,
4782,
310,
385,
1722,
298,
29945,
934,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
12013,
29918,
1272,
29901,
10663,
1469,
13,
4706,
934,
29918,
8411,
29901,
298,
29945,
2272,
29889,
4782,
29892,
13136,
13,
4706,
9995,
13,
4706,
1583,
29889,
601,
29918,
1272,
353,
12013,
29918,
1272,
13,
4706,
565,
934,
29918,
8411,
338,
6213,
29901,
13,
9651,
298,
29945,
1445,
29918,
2972,
353,
298,
29945,
2272,
29889,
2283,
29898,
1311,
29889,
9507,
29892,
525,
29893,
1495,
13,
4706,
1683,
29901,
13,
9651,
298,
29945,
1445,
29918,
2972,
353,
934,
29918,
8411,
13,
13,
4706,
1583,
29889,
3539,
29918,
15697,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
4706,
1583,
29889,
3539,
29918,
299,
2378,
29879,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
4706,
1583,
29889,
3539,
29918,
12650,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
13,
13,
1990,
379,
29945,
6982,
29901,
13,
1678,
9995,
13,
1678,
1174,
1849,
5183,
298,
29945,
2066,
5759,
411,
885,
339,
14836,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
10422,
29901,
851,
13,
1678,
934,
29918,
8411,
29901,
298,
29945,
2272,
29889,
4782,
29892,
13136,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10422,
29892,
934,
29918,
8411,
29922,
8516,
1125,
13,
4706,
1583,
29889,
9507,
353,
10422,
13,
4706,
1583,
29889,
601,
29918,
1272,
353,
6213,
13,
4706,
1583,
29889,
1445,
29918,
8411,
353,
934,
29918,
8411,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
298,
29945,
29918,
5552,
29879,
29918,
517,
29918,
8977,
29898,
29882,
29945,
29918,
5552,
29879,
1125,
13,
4706,
9995,
13,
4706,
1281,
369,
1372,
298,
29945,
5352,
848,
304,
263,
5132,
8600,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
29918,
5552,
29879,
29901,
298,
29945,
2272,
29889,
6708,
3260,
13,
9651,
408,
7625,
491,
17378,
14935,
29882,
29945,
2272,
29889,
4782,
15513,
5552,
29879,
29952,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
518,
710,
29892,
851,
470,
9681,
29962,
13,
4706,
9995,
13,
4706,
736,
426,
5552,
29918,
978,
29901,
12421,
29918,
1767,
363,
12421,
29918,
978,
29892,
12421,
29918,
1767,
297,
298,
29945,
29918,
5552,
29879,
29889,
7076,
28296,
13,
13,
1678,
822,
1303,
29918,
15697,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
7523,
848,
515,
298,
29945,
934,
2318,
393,
338,
6087,
4153,
408,
14935,
29882,
29945,
2272,
29889,
4782,
15513,
5552,
29879,
1673,
470,
7160,
297,
1014,
13155,
25278,
13,
4706,
14935,
29882,
29945,
2272,
29889,
4782,
20690,
1649,
21513,
29952,
322,
14935,
29882,
29945,
2272,
29889,
4782,
20690,
1649,
8977,
29879,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
518,
710,
29892,
9657,
470,
1051,
29962,
13,
4706,
9995,
13,
4706,
8393,
353,
1583,
29889,
29882,
29945,
29918,
5552,
29879,
29918,
517,
29918,
8977,
29898,
29882,
29945,
1445,
29918,
2972,
29889,
5552,
29879,
29897,
13,
4706,
565,
525,
1649,
8977,
29879,
29915,
297,
298,
29945,
1445,
29918,
2972,
29901,
13,
9651,
363,
9657,
29918,
978,
297,
298,
29945,
1445,
29918,
2972,
1839,
1649,
8977,
29879,
2033,
29901,
13,
18884,
8393,
29961,
8977,
29918,
978,
29962,
353,
12013,
29889,
949,
29898,
1311,
29889,
9507,
29892,
298,
29945,
1445,
29918,
2972,
1839,
1649,
8977,
29879,
22208,
718,
9657,
29918,
978,
2314,
13,
4706,
565,
525,
1649,
21513,
29915,
297,
298,
29945,
1445,
29918,
2972,
29901,
13,
9651,
363,
1051,
29918,
978,
297,
298,
29945,
1445,
29918,
2972,
1839,
1649,
21513,
2033,
29901,
13,
18884,
8393,
29961,
1761,
29918,
978,
29962,
353,
12013,
29889,
949,
29898,
1311,
29889,
9507,
29892,
298,
29945,
1445,
29918,
2972,
1839,
1649,
21513,
22208,
718,
1051,
29918,
978,
2314,
13,
4706,
736,
8393,
13,
13,
1678,
822,
1303,
29918,
299,
2378,
29879,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
7523,
12655,
1409,
848,
515,
298,
29945,
934,
2318,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
518,
710,
29892,
29871,
299,
2378,
29962,
13,
4706,
9995,
13,
308,
299,
2378,
29879,
353,
426,
978,
29901,
1409,
7503,
29962,
363,
1024,
29892,
1409,
297,
298,
29945,
1445,
29918,
2972,
29889,
7076,
580,
565,
338,
8758,
29898,
2378,
29892,
298,
29945,
2272,
29889,
16390,
24541,
2915,
13,
4706,
736,
29871,
299,
2378,
29879,
13,
13,
1678,
822,
1303,
29918,
12650,
29898,
1311,
29892,
298,
29945,
1445,
29918,
2972,
1125,
13,
4706,
9995,
13,
4706,
7523,
848,
515,
278,
2183,
298,
29945,
934,
2318,
393,
11524,
263,
5132,
1203,
916,
1135,
385,
29871,
299,
2378,
29892,
1051,
29892,
470,
9657,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
298,
29945,
1445,
29918,
2972,
29901,
298,
29945,
2272,
29889,
4782,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
518,
710,
29892,
10663,
1469,
29962,
13,
4706,
9995,
13,
4706,
6426,
29918,
12650,
353,
6571,
13,
4706,
298,
29945,
1445,
29918,
2972,
353,
298,
29945,
1445,
29918,
2972,
3366,
1649,
12650,
3108,
13,
4706,
363,
5446,
29918,
978,
297,
298,
29945,
1445,
29918,
2972,
29901,
13,
9651,
6426,
29918,
12650,
29961,
5415,
29918,
978,
29962,
353,
12013,
29889,
949,
29898,
1311,
29889,
9507,
29892,
298,
29945,
1445,
29918,
2972,
29961,
5415,
29918,
978,
2314,
13,
4706,
736,
6426,
29918,
12650,
13,
13,
1678,
732,
13239,
29889,
19347,
29898,
29882,
29945,
2272,
29922,
29918,
29950,
3289,
29918,
29950,
29945,
20055,
29897,
13,
1678,
822,
515,
29918,
1445,
29898,
1311,
29892,
10422,
29892,
934,
29918,
8411,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
20370,
13246,
263,
716,
298,
29945,
934,
363,
5183,
470,
2130,
267,
385,
2307,
6496,
934,
3025,
278,
2183,
298,
29945,
29889,
4782,
4386,
29889,
7523,
29879,
13,
4706,
599,
848,
515,
278,
2211,
13997,
310,
8393,
313,
262,
695,
29889,
8857,
322,
9657,
29879,
511,
29871,
299,
2378,
29879,
29892,
322,
3618,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
10422,
29901,
851,
13,
4706,
934,
29918,
8411,
29901,
298,
29945,
29889,
4782,
29892,
13136,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
10663,
1469,
13,
4706,
9995,
13,
4706,
565,
934,
29918,
8411,
338,
6213,
29901,
13,
9651,
298,
29945,
1445,
29918,
2972,
353,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
525,
29878,
1495,
13,
4706,
1683,
29901,
13,
9651,
298,
29945,
1445,
29918,
2972,
353,
934,
29918,
8411,
13,
13,
4706,
8393,
353,
1583,
29889,
949,
29918,
15697,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
4706,
2393,
3871,
353,
8393,
1839,
1649,
1853,
2033,
13,
4706,
628,
8393,
1839,
1649,
1853,
2033,
13,
308,
299,
2378,
29879,
353,
1583,
29889,
949,
29918,
299,
2378,
29879,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
4706,
6426,
29918,
12650,
353,
1583,
29889,
949,
29918,
12650,
29898,
29882,
29945,
1445,
29918,
2972,
29897,
13,
4706,
736,
12013,
29889,
5971,
1469,
29898,
22646,
29892,
8393,
29892,
29871,
299,
2378,
29879,
29892,
6426,
29918,
12650,
29897,
13,
13,
13,
1990,
16874,
10507,
29898,
5971,
10507,
1125,
13,
1678,
9995,
13,
1678,
11221,
10422,
2433,
29879,
2770,
420,
29889,
7638,
742,
2436,
2069,
1272,
964,
1047,
3871,
29889,
7638,
13,
1678,
1987,
29892,
5684,
11799,
2066,
526,
3971,
363,
1269,
8783,
29892,
411,
977,
264,
1280,
29901,
525,
29879,
2770,
420,
29918,
29915,
718,
1418,
273,
420,
29900,
718,
15300,
7638,
29915,
2992,
29889,
13,
1678,
9995,
13,
1678,
822,
9773,
29918,
299,
2378,
29918,
3888,
29898,
1311,
29892,
8393,
1125,
13,
4706,
9995,
2528,
848,
731,
2472,
304,
8393,
29892,
577,
393,
8783,
2983,
322,
13391,
526,
3625,
13,
4706,
297,
8393,
16874,
934,
1213,
15945,
13,
4706,
363,
2380,
29892,
1418,
273,
420,
297,
26985,
29898,
1311,
29889,
601,
29918,
1272,
29889,
299,
2378,
29879,
29889,
8149,
580,
1125,
13,
9651,
848,
353,
1583,
29889,
601,
29918,
1272,
29889,
299,
2378,
29879,
29961,
4130,
273,
420,
29962,
13,
9651,
8393,
1839,
24713,
29915,
718,
851,
29898,
2248,
4638,
353,
1418,
273,
420,
13,
13,
9651,
565,
848,
29889,
299,
326,
1275,
29871,
29941,
29901,
13,
18884,
22780,
29918,
2798,
353,
7431,
29898,
1272,
29897,
13,
9651,
1683,
29901,
13,
18884,
22780,
29918,
2798,
353,
29871,
29896,
13,
9651,
8393,
1839,
24713,
29915,
718,
851,
29898,
2248,
29897,
718,
15300,
29879,
29399,
2033,
353,
22780,
29918,
2798,
13,
4706,
736,
8393,
13,
13,
1678,
822,
2436,
29918,
15697,
29898,
1311,
29892,
10422,
1125,
13,
4706,
8393,
353,
1583,
29889,
601,
29918,
1272,
29889,
15697,
13,
4706,
8393,
3366,
1649,
1853,
3108,
353,
1583,
29889,
601,
29918,
1272,
29889,
22646,
13,
4706,
8393,
353,
1583,
29889,
4397,
29918,
299,
2378,
29918,
3888,
29898,
15697,
29897,
13,
4706,
411,
1722,
29898,
9507,
29892,
4464,
2433,
29893,
742,
25899,
2433,
1495,
408,
12700,
29918,
1445,
29901,
13,
9651,
934,
29918,
13236,
353,
11799,
29889,
13236,
29898,
7299,
29918,
1445,
29892,
28552,
29922,
742,
1495,
13,
9651,
934,
29918,
13236,
29889,
13236,
340,
29898,
15697,
29889,
8149,
3101,
13,
9651,
934,
29918,
13236,
29889,
13236,
340,
29898,
15697,
29889,
5975,
3101,
13,
13,
1678,
822,
2436,
29918,
299,
2378,
29879,
29898,
1311,
29892,
10422,
1125,
13,
4706,
10422,
29918,
303,
431,
29892,
903,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
9507,
29897,
13,
4706,
363,
1418,
273,
420,
29892,
8783,
297,
1583,
29889,
601,
29918,
1272,
29889,
299,
2378,
29879,
29889,
7076,
7295,
13,
9651,
10422,
353,
10422,
29918,
303,
431,
718,
22868,
29915,
718,
1418,
273,
420,
718,
15300,
7638,
29915,
13,
9651,
1583,
29889,
3539,
29918,
1272,
29898,
9507,
29892,
8783,
29897,
13,
13,
1678,
822,
2436,
29918,
1272,
29898,
1311,
29892,
10422,
29892,
8783,
1125,
13,
4706,
565,
8783,
29889,
299,
326,
5277,
29871,
29906,
29901,
13,
9651,
7442,
29889,
29879,
485,
300,
486,
29898,
9507,
29892,
8783,
29897,
13,
4706,
25342,
8783,
29889,
299,
326,
1275,
29871,
29941,
29901,
13,
9651,
7442,
29918,
29879,
485,
300,
486,
29918,
29941,
29881,
29898,
24713,
29892,
10422,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
8960,
703,
16390,
24541,
756,
13391,
1405,
29871,
29941,
29889,
15808,
2436,
304,
16874,
934,
23157,
13,
13,
1678,
822,
2436,
29918,
12650,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
304,
29918,
1445,
29898,
1311,
29892,
12013,
29918,
1272,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
601,
29918,
1272,
353,
12013,
29918,
1272,
13,
4706,
1583,
29889,
3539,
29918,
15697,
29898,
1311,
29889,
9507,
29897,
13,
4706,
1583,
29889,
3539,
29918,
299,
2378,
29879,
29898,
1311,
29889,
9507,
29897,
13,
4706,
396,
694,
2304,
363,
2436,
29918,
12650,
297,
16874,
3402,
13,
13,
13,
1990,
16874,
6982,
29901,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1303,
29918,
15697,
29898,
9507,
1125,
13,
4706,
411,
1722,
29898,
9507,
29892,
4464,
2433,
29878,
1495,
408,
12700,
29918,
1445,
29901,
13,
9651,
934,
29918,
16950,
353,
11799,
29889,
16950,
29898,
7299,
29918,
1445,
29892,
28552,
29922,
742,
1495,
13,
9651,
12700,
29918,
8149,
353,
934,
29918,
16950,
17255,
4622,
1649,
580,
13,
9651,
12700,
29918,
5975,
353,
934,
29918,
16950,
17255,
4622,
1649,
580,
13,
4706,
736,
9657,
29898,
7554,
29898,
7299,
29918,
8149,
29892,
12700,
29918,
5975,
876,
13,
13,
1678,
822,
1889,
29918,
2527,
328,
919,
29898,
1311,
29892,
12700,
29918,
8977,
1125,
13,
4706,
8393,
353,
426,
13,
9651,
12421,
29918,
978,
29901,
3667,
29879,
29889,
517,
29918,
17471,
29918,
272,
29918,
1807,
29898,
5552,
29918,
1767,
29897,
363,
12421,
29918,
978,
29892,
12421,
29918,
1767,
297,
12700,
29918,
8977,
29889,
7076,
580,
13,
9651,
565,
451,
337,
29889,
4352,
29898,
29878,
29915,
24713,
29905,
29881,
29974,
742,
12421,
29918,
978,
29897,
13,
4706,
500,
13,
4706,
848,
29918,
7039,
353,
518,
4130,
273,
420,
363,
1418,
284,
1107,
29892,
1418,
273,
420,
297,
12700,
29918,
8977,
29889,
7076,
580,
565,
337,
29889,
4352,
29898,
29878,
29915,
24713,
29905,
29881,
24035,
742,
1418,
284,
1107,
4638,
13,
4706,
848,
29918,
29879,
29399,
353,
518,
579,
29889,
20889,
284,
29918,
14513,
29898,
1767,
29897,
363,
1820,
29892,
995,
297,
12700,
29918,
8977,
29889,
7076,
580,
13,
462,
539,
565,
337,
29889,
4352,
29898,
29878,
29915,
24713,
29905,
29881,
29974,
29889,
29879,
29399,
742,
1820,
4638,
13,
4706,
736,
8393,
29892,
848,
29918,
7039,
29892,
848,
29918,
29879,
29399,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1303,
29918,
1272,
29898,
9507,
29892,
269,
29399,
1125,
13,
4706,
1018,
29901,
13,
9651,
848,
29918,
2378,
353,
7442,
29889,
1359,
3945,
29898,
9507,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
848,
29918,
2378,
353,
7442,
29889,
1359,
3945,
29898,
9507,
29892,
26688,
29922,
9302,
29889,
19676,
19925,
13,
4706,
565,
269,
29399,
1405,
29871,
29896,
29901,
13,
9651,
302,
5727,
29892,
302,
22724,
353,
848,
29918,
2378,
29889,
12181,
13,
9651,
736,
848,
29918,
2378,
29889,
690,
14443,
3552,
29879,
29399,
29892,
302,
5727,
458,
29879,
29399,
29892,
302,
22724,
876,
13,
4706,
736,
848,
29918,
2378,
13,
13,
1678,
822,
515,
29918,
1445,
29898,
1311,
29892,
10422,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
10422,
29901,
851,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
770,
2777,
5759,
515,
934,
848,
13,
4706,
9995,
13,
4706,
1294,
29918,
15697,
353,
1583,
29889,
949,
29918,
15697,
29898,
9507,
29897,
13,
4706,
2393,
3871,
353,
1294,
29918,
15697,
1839,
1649,
1853,
2033,
13,
4706,
628,
1294,
29918,
15697,
1839,
1649,
1853,
2033,
13,
13,
4706,
8393,
29892,
848,
29918,
7039,
29892,
848,
29918,
29879,
29399,
353,
1583,
29889,
5014,
29918,
2527,
328,
919,
29898,
1062,
29918,
15697,
29897,
13,
13,
4706,
10422,
29918,
303,
431,
29892,
903,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
9507,
29897,
13,
308,
299,
2378,
29879,
353,
6571,
13,
4706,
363,
2380,
29892,
1418,
273,
420,
297,
26985,
29898,
1272,
29918,
7039,
1125,
13,
9651,
848,
29918,
9507,
353,
10422,
29918,
303,
431,
718,
22868,
29915,
718,
1418,
273,
420,
718,
15300,
7638,
29915,
13,
9651,
269,
29399,
353,
848,
29918,
29879,
29399,
29961,
2248,
29962,
13,
632,
299,
2378,
29879,
29961,
4130,
273,
420,
29962,
353,
1583,
29889,
949,
29918,
1272,
29898,
1272,
29918,
9507,
29892,
269,
29399,
29897,
13,
13,
4706,
736,
12013,
29889,
5971,
1469,
29898,
22646,
29892,
8393,
29892,
29871,
299,
2378,
29879,
29892,
3618,
29922,
8516,
29897,
13,
13,
13,
1753,
7442,
29918,
29879,
485,
300,
486,
29918,
29941,
29881,
29898,
2378,
29941,
29881,
29892,
10422,
1125,
13,
1678,
9995,
13,
1678,
6162,
546,
740,
393,
8536,
1169,
263,
29871,
29941,
29881,
12655,
1409,
964,
29871,
29906,
29881,
269,
29399,
363,
5007,
408,
11799,
848,
304,
263,
716,
934,
29889,
317,
29399,
526,
13,
1678,
13055,
491,
263,
3440,
1948,
15913,
1570,
22780,
1412,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
1409,
29941,
29881,
29901,
29871,
299,
2378,
411,
29871,
299,
326,
353,
29871,
29941,
13,
1678,
10422,
29901,
851,
13,
1678,
9995,
13,
1678,
411,
1722,
29898,
9507,
29892,
4464,
2433,
29893,
742,
25899,
2433,
1495,
408,
848,
1445,
29901,
13,
4706,
848,
1445,
29889,
3539,
14237,
4398,
8267,
29901,
426,
29900,
1012,
29876,
4286,
4830,
29898,
2378,
29941,
29881,
29889,
12181,
876,
13,
4706,
363,
848,
29918,
18337,
297,
1409,
29941,
29881,
29901,
13,
9651,
7442,
29889,
29879,
485,
300,
486,
29898,
1272,
1445,
29892,
848,
29918,
18337,
29897,
13,
9651,
848,
1445,
29889,
3539,
14237,
1570,
22780,
29905,
29876,
1495,
13,
2
] |
db/settings.py | liuansen/python-utils-class | 3 | 163973 | # -*- coding:utf-8 -*-
# author:Anson
from __future__ import unicode_literals
MYSQL_DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '3306',
'STORAGE_ENGINE': 'INNODB',
}
}
REDIS_CONNECTION = {
'default': {
'HOST': '',
'PORT': '',
'PASSWD': '',
'DB': 0,
}
}
try:
from local_settings import *
except ImportError:
pass
| [
1,
396,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
30004,
13,
29937,
4148,
30383,
2744,
1100,
30004,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
30004,
13,
30004,
13,
30004,
13,
17870,
4176,
29918,
25832,
27982,
29903,
353,
3336,
13,
1678,
525,
4381,
2396,
3336,
13,
4706,
525,
1430,
29954,
8895,
2396,
525,
7938,
23592,
13,
4706,
525,
5813,
2396,
15516,
30004,
13,
4706,
525,
11889,
2396,
15516,
30004,
13,
4706,
525,
25711,
17013,
2396,
15516,
30004,
13,
4706,
525,
20832,
2396,
15516,
30004,
13,
4706,
525,
15082,
2396,
525,
29941,
29941,
29900,
29953,
23592,
13,
4706,
525,
1254,
1955,
10461,
29918,
1430,
29954,
8895,
2396,
525,
1177,
6632,
4051,
23592,
13,
1678,
4970,
13,
8117,
13,
30004,
13,
19386,
3235,
29918,
6007,
8186,
9838,
353,
3336,
13,
1678,
525,
4381,
2396,
3336,
13,
4706,
525,
20832,
2396,
15516,
30004,
13,
4706,
525,
15082,
2396,
15516,
30004,
13,
4706,
525,
25711,
24668,
2396,
15516,
30004,
13,
4706,
525,
4051,
2396,
29871,
29900,
11167,
13,
1678,
4970,
13,
8117,
13,
30004,
13,
2202,
29901,
30004,
13,
1678,
515,
1887,
29918,
11027,
1053,
334,
30004,
13,
19499,
16032,
2392,
29901,
30004,
13,
1678,
1209,
30004,
13,
2
] |
anstosstools/__init__.py | ericziethen/anstosstools | 0 | 56126 | """Root package for anstoss tools."""
| [
1,
9995,
10303,
3577,
363,
385,
303,
2209,
8492,
1213,
15945,
13,
2
] |
faker/providers/company/ro_RO/__init__.py | jeffwright13/faker | 3 | 139815 | from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
'{{last_name}} {{company_suffix}}',
'{{last_name}} {{last_name}} {{company_suffix}}',
'{{last_name}}',
)
company_suffixes = (
'SRL', 'SA', 'SCA', 'SNC', 'SCS', 'AFJ', 'ASF', 'CON', 'CRL', 'INC',
'LOC', 'OC1', 'OC2', 'OC3', 'PFA', 'RA', 'SCS', 'SPI', 'URL',
)
def company_suffix(self):
return self.random_element(self.company_suffixes)
| [
1,
515,
6317,
1053,
1019,
5489,
408,
6938,
6980,
13,
13,
13,
1990,
1019,
5489,
29898,
21410,
6980,
1125,
13,
13,
1678,
21971,
353,
313,
13,
4706,
525,
6224,
4230,
29918,
978,
930,
8620,
14518,
29918,
2146,
600,
861,
930,
742,
13,
4706,
525,
6224,
4230,
29918,
978,
930,
8620,
4230,
29918,
978,
930,
8620,
14518,
29918,
2146,
600,
861,
930,
742,
13,
4706,
525,
6224,
4230,
29918,
978,
930,
742,
13,
1678,
1723,
13,
13,
1678,
5001,
29918,
2146,
600,
861,
267,
353,
313,
13,
4706,
525,
29903,
2241,
742,
525,
8132,
742,
525,
29903,
5454,
742,
525,
29903,
15868,
742,
525,
7187,
29903,
742,
525,
5098,
29967,
742,
525,
3289,
29943,
742,
525,
6007,
742,
525,
29907,
2241,
742,
525,
1177,
29907,
742,
13,
4706,
525,
16652,
742,
525,
20166,
29896,
742,
525,
20166,
29906,
742,
525,
20166,
29941,
742,
525,
29925,
4519,
742,
525,
4717,
742,
525,
7187,
29903,
742,
525,
29903,
2227,
742,
525,
4219,
742,
13,
1678,
1723,
13,
13,
1678,
822,
5001,
29918,
2146,
600,
861,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
8172,
29918,
5029,
29898,
1311,
29889,
14518,
29918,
2146,
600,
861,
267,
29897,
13,
2
] |
Task/Non-decimal-radices-Convert/Python/non-decimal-radices-convert-2.py | djgoku/RosettaCodeData | 5 | 77439 | digits = "0123456789abcdefghijklmnopqrstuvwxyz"
def baseN(num,b):
return (((num == 0) and "0" )
or ( baseN(num // b, b).lstrip("0")
+ digits[num % b]))
# alternatively:
def baseN(num,b):
if num == 0: return "0"
result = ""
while num != 0:
num, d = divmod(num, b)
result += digits[d]
return result[::-1] # reverse
k = 26
s = baseN(k,16) # returns the string 1a
| [
1,
13340,
353,
376,
29900,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
10736,
1753,
12443,
823,
6321,
23521,
459,
29939,
29878,
303,
4090,
29893,
20230,
29908,
13,
1753,
2967,
29940,
29898,
1949,
29892,
29890,
1125,
13,
259,
736,
313,
3552,
1949,
1275,
29871,
29900,
29897,
322,
29871,
376,
29900,
29908,
1723,
13,
965,
470,
313,
2967,
29940,
29898,
1949,
849,
289,
29892,
289,
467,
29880,
17010,
703,
29900,
1159,
13,
18884,
718,
13340,
29961,
1949,
1273,
289,
12622,
13,
13,
29937,
5136,
6703,
29901,
13,
1753,
2967,
29940,
29898,
1949,
29892,
29890,
1125,
13,
29871,
565,
954,
1275,
29871,
29900,
29901,
736,
376,
29900,
29908,
13,
29871,
1121,
353,
5124,
13,
29871,
1550,
954,
2804,
29871,
29900,
29901,
13,
1678,
954,
29892,
270,
353,
1933,
1545,
29898,
1949,
29892,
289,
29897,
13,
1678,
1121,
4619,
13340,
29961,
29881,
29962,
13,
29871,
736,
1121,
29961,
1057,
29899,
29896,
29962,
396,
11837,
13,
13,
29895,
353,
29871,
29906,
29953,
13,
29879,
353,
2967,
29940,
29898,
29895,
29892,
29896,
29953,
29897,
396,
3639,
278,
1347,
29871,
29896,
29874,
13,
2
] |
demo.py | geerk/toradbapi | 1 | 170332 | <reponame>geerk/toradbapi
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.gen
import tornado.platform.twisted
import mysql.connector
tornado.platform.twisted.install()
import toradbapi
DB_NAME = 'test_toradbapi'
DB_HOST = '127.0.0.1'
DB_PORT = 3306
DB_USER = 'root'
DB_PASSWORD = ''
class MainHandler(tornado.web.RequestHandler):
def initialize(self, db):
self.db = db
@tornado.gen.coroutine
def get(self):
people = yield self.db.run_query('SELECT `name` FROM `person`')
self.finish('<html><head><title>Demo toradbapi</title></head>'
'<body><h3>Type new name:</h3>'
'<form method="post"><input name="name" type="text"/>'
'<input type="submit" value="Submit"/></form>'
'<h3>Already inserted names:</h3>'
'<ul>%s</ul></body></html>' % ''.join(
'<li>%s</li>' % name for name in people))
@tornado.gen.coroutine
def post(self):
name = self.get_argument('name')
try:
yield self.db.run_operation(
# always use escaping functionality to avoid sql-injection
'INSERT INTO `person` (`name`) VALUES (%s)',
(name,))
except mysql.connector.errors.DatabaseError as e:
self.finish('<html><head><title>Demo toradbapi</title></head>'
'<body><h3>Error inserting new name: %s</h3>'
'<br/><a href="/">Main page</a></body></html>' % e)
else:
self.redirect('/')
def setup_database():
# just to ensure that database and table exist
cnx = mysql.connector.connect(
user=DB_USER, passwd=DB_PASSWORD, host=DB_HOST, port=DB_PORT)
cursor = cnx.cursor()
try:
cursor.execute('CREATE DATABASE `%s` CHARACTER SET utf8' % DB_NAME)
except mysql.connector.errors.DatabaseError:
# do nothing if database exists
pass
cursor.execute('USE `%s`' % DB_NAME)
cursor.execute('CREATE TABLE IF NOT EXISTS `person` ('
' `name` varchar(255) NOT NULL,'
' `dob` date DEFAULT NULL,'
' UNIQUE KEY (`name`))')
cursor.close()
cnx.close()
def main():
setup_database()
tornado.options.parse_command_line()
pool = toradbapi.ConnectionPool(
'mysql.connector', database=DB_NAME, user=DB_USER, port=DB_PORT,
password=<PASSWORD>, host=DB_HOST)
application = tornado.web.Application([(r'/', MainHandler, {'db': pool})])
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888, '127.0.0.1')
try:
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
pass
finally:
pool.close()
tornado.ioloop.IOLoop.instance().stop()
if __name__ == '__main__':
main()
| [
1,
529,
276,
1112,
420,
29958,
479,
5968,
29914,
7345,
328,
29890,
2754,
13,
3166,
4770,
29888,
9130,
1649,
1053,
313,
23552,
29918,
5215,
29892,
8542,
29892,
13,
462,
4706,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
29897,
13,
13,
5215,
10146,
912,
29889,
991,
261,
369,
13,
5215,
10146,
912,
29889,
29875,
3543,
459,
13,
5215,
10146,
912,
29889,
6768,
13,
5215,
10146,
912,
29889,
2676,
13,
5215,
10146,
912,
29889,
1885,
13,
5215,
10146,
912,
29889,
12120,
29889,
7516,
12652,
13,
5215,
5749,
29889,
11958,
2801,
13,
13,
29873,
1398,
912,
29889,
12120,
29889,
7516,
12652,
29889,
6252,
580,
13,
13,
5215,
4842,
328,
29890,
2754,
13,
13,
13,
4051,
29918,
5813,
353,
525,
1688,
29918,
7345,
328,
29890,
2754,
29915,
13,
4051,
29918,
20832,
353,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29915,
13,
4051,
29918,
15082,
353,
29871,
29941,
29941,
29900,
29953,
13,
4051,
29918,
11889,
353,
525,
4632,
29915,
13,
4051,
29918,
25711,
17013,
353,
6629,
13,
13,
13,
1990,
4241,
4598,
29898,
29873,
1398,
912,
29889,
2676,
29889,
3089,
4598,
1125,
13,
13,
1678,
822,
11905,
29898,
1311,
29892,
4833,
1125,
13,
4706,
1583,
29889,
2585,
353,
4833,
13,
13,
1678,
732,
29873,
1398,
912,
29889,
1885,
29889,
2616,
449,
457,
13,
1678,
822,
679,
29898,
1311,
1125,
13,
4706,
2305,
353,
7709,
1583,
29889,
2585,
29889,
3389,
29918,
1972,
877,
6404,
421,
978,
29952,
3895,
421,
10532,
29952,
1495,
13,
4706,
1583,
29889,
4951,
728,
877,
29966,
1420,
5299,
2813,
5299,
3257,
29958,
23444,
4842,
328,
29890,
2754,
829,
3257,
2565,
2813,
16299,
13,
462,
1678,
12801,
2587,
5299,
29882,
29941,
29958,
1542,
716,
1024,
29901,
829,
29882,
29941,
16299,
13,
462,
1678,
12801,
689,
1158,
543,
2490,
3254,
2080,
1024,
543,
978,
29908,
1134,
543,
726,
4681,
29915,
13,
462,
1678,
12801,
2080,
1134,
543,
7892,
29908,
995,
543,
16228,
23901,
2565,
689,
16299,
13,
462,
1678,
12801,
29882,
29941,
29958,
2499,
2040,
15478,
2983,
29901,
829,
29882,
29941,
16299,
13,
462,
1678,
12801,
352,
29958,
29995,
29879,
829,
352,
2565,
2587,
2565,
1420,
16299,
1273,
525,
4286,
7122,
29898,
13,
462,
4706,
12801,
492,
29958,
29995,
29879,
829,
492,
16299,
1273,
1024,
363,
1024,
297,
2305,
876,
13,
13,
1678,
732,
29873,
1398,
912,
29889,
1885,
29889,
2616,
449,
457,
13,
1678,
822,
1400,
29898,
1311,
1125,
13,
4706,
1024,
353,
1583,
29889,
657,
29918,
23516,
877,
978,
1495,
13,
4706,
1018,
29901,
13,
9651,
7709,
1583,
29889,
2585,
29889,
3389,
29918,
16453,
29898,
13,
18884,
396,
2337,
671,
3966,
21430,
9863,
304,
4772,
4576,
29899,
262,
6929,
13,
18884,
525,
19460,
11646,
421,
10532,
29952,
6695,
978,
6348,
15673,
313,
29995,
29879,
29897,
742,
13,
18884,
313,
978,
29892,
876,
13,
4706,
5174,
5749,
29889,
11958,
2801,
29889,
12523,
29889,
9112,
2392,
408,
321,
29901,
13,
9651,
1583,
29889,
4951,
728,
877,
29966,
1420,
5299,
2813,
5299,
3257,
29958,
23444,
4842,
328,
29890,
2754,
829,
3257,
2565,
2813,
16299,
13,
462,
4706,
12801,
2587,
5299,
29882,
29941,
29958,
2392,
23800,
716,
1024,
29901,
1273,
29879,
829,
29882,
29941,
16299,
13,
462,
4706,
12801,
1182,
3779,
29966,
29874,
2822,
13802,
1013,
6330,
1813,
829,
29874,
2565,
2587,
2565,
1420,
16299,
1273,
321,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
17886,
11219,
1495,
13,
13,
13,
1753,
6230,
29918,
9803,
7295,
13,
1678,
396,
925,
304,
9801,
393,
2566,
322,
1591,
1863,
13,
1678,
274,
23818,
353,
5749,
29889,
11958,
2801,
29889,
6915,
29898,
13,
4706,
1404,
29922,
4051,
29918,
11889,
29892,
1209,
9970,
29922,
4051,
29918,
25711,
17013,
29892,
3495,
29922,
4051,
29918,
20832,
29892,
2011,
29922,
4051,
29918,
15082,
29897,
13,
1678,
10677,
353,
274,
23818,
29889,
18127,
580,
13,
1678,
1018,
29901,
13,
4706,
10677,
29889,
7978,
877,
27045,
27640,
27982,
22570,
29879,
29952,
26871,
17923,
1001,
11368,
23616,
29947,
29915,
1273,
6535,
29918,
5813,
29897,
13,
1678,
5174,
5749,
29889,
11958,
2801,
29889,
12523,
29889,
9112,
2392,
29901,
13,
4706,
396,
437,
3078,
565,
2566,
4864,
13,
4706,
1209,
13,
1678,
10677,
29889,
7978,
877,
17171,
22570,
29879,
20497,
1273,
6535,
29918,
5813,
29897,
13,
1678,
10677,
29889,
7978,
877,
27045,
10911,
10762,
6058,
28731,
421,
10532,
29952,
6702,
13,
462,
259,
525,
1678,
421,
978,
29952,
15236,
29898,
29906,
29945,
29945,
29897,
6058,
4265,
5501,
13,
462,
259,
525,
1678,
421,
11152,
29952,
2635,
22236,
4265,
5501,
13,
462,
259,
525,
1678,
8291,
29902,
11144,
14636,
6695,
978,
29952,
876,
1495,
13,
1678,
10677,
29889,
5358,
580,
13,
1678,
274,
23818,
29889,
5358,
580,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
6230,
29918,
9803,
580,
13,
1678,
10146,
912,
29889,
6768,
29889,
5510,
29918,
6519,
29918,
1220,
580,
13,
1678,
11565,
353,
4842,
328,
29890,
2754,
29889,
5350,
11426,
29898,
13,
4706,
525,
7938,
29889,
11958,
2801,
742,
2566,
29922,
4051,
29918,
5813,
29892,
1404,
29922,
4051,
29918,
11889,
29892,
2011,
29922,
4051,
29918,
15082,
29892,
13,
4706,
4800,
29922,
29966,
25711,
17013,
10202,
3495,
29922,
4051,
29918,
20832,
29897,
13,
1678,
2280,
353,
10146,
912,
29889,
2676,
29889,
4873,
4197,
29898,
29878,
29915,
29914,
742,
4241,
4598,
29892,
11117,
2585,
2396,
11565,
1800,
2314,
13,
1678,
1732,
29918,
2974,
353,
10146,
912,
29889,
991,
261,
369,
29889,
10493,
6004,
29898,
6214,
29897,
13,
1678,
1732,
29918,
2974,
29889,
20631,
29898,
29947,
29947,
29947,
29947,
29892,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1495,
13,
1678,
1018,
29901,
13,
4706,
10146,
912,
29889,
29875,
3543,
459,
29889,
5971,
18405,
29889,
8758,
2141,
2962,
580,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
13,
4706,
1209,
13,
1678,
7146,
29901,
13,
4706,
11565,
29889,
5358,
580,
13,
4706,
10146,
912,
29889,
29875,
3543,
459,
29889,
5971,
18405,
29889,
8758,
2141,
9847,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
PolTools/main_programs/align.py | GeoffSCollins/PolTools | 0 | 1613892 | import os
import sys
import subprocess
import argparse
from PolTools.utils.make_random_filename import generate_random_filename
from PolTools.utils.remove_files import remove_files
from multiprocessing import Pool
from collections import defaultdict
from statistics import mean
from shutil import rmtree
# TODO: Move the files to pricenas
global MAIN_DIRECTORY
# Get input
def parse_args(args):
def positive_int(num):
try:
val = int(num)
if val <= 0:
raise Exception("Go to the except")
except:
raise argparse.ArgumentTypeError(num + " must be positive")
return val
parser = argparse.ArgumentParser(prog='PolTools align',
description='Align raw data to generate bed and bigwig files.\n' +
"More information can be found at " +
"https://geoffscollins.github.io/PolTools/align.html")
parser.add_argument('-u', '--url', dest='url', metavar='url', type=str)
parser.add_argument('-f', '--folder-name', dest='folder_name', metavar='folder_name', type=str)
parser.add_argument('-l', '--umi-length', dest='umi_length', metavar='umi_length', type=positive_int, default=8)
parser.add_argument('--min-insert', dest='min_insert', metavar='min_insert', type=positive_int, default=32)
parser.add_argument('--max-insert', dest='max_insert', metavar='max_insert', type=positive_int, default=600)
parser.add_argument('-t', '--threads', dest='threads', metavar='threads', type=positive_int, nargs='?', default=10)
parser.add_argument('-i', '--index', dest='index', metavar='index', type=str)
parser.add_argument('-c', '--chrom-sizes-file', dest='chrom_sizes_file', metavar='chrom_sizes_file', type=str)
parser.add_argument('-s', '--server-name', dest='server_name', metavar='server_name', type=str, default=None)
parser.add_argument('--spike-in-genome', dest='spike_in_genome', metavar='spike_in_genome', type=str, default=None)
parser.add_argument('-g', '--genome', dest='genomes', metavar='genome', type=str, nargs="+", action="extend")
parser.add_argument('-x', '--conversion-file', dest='sample_name_conversion_filename', metavar='conversion_file', type=str, default=None)
return parser.parse_args(args)
def read_sample_name_conversion_table(filename):
if not filename or not os.path.isfile(filename):
return None, ['.fastq.gz']
downloading_prefixes = []
sample_name_conversion = {}
with open(filename) as file:
for i, line in enumerate(file):
if i != 0:
download_prefix, prefix, new_name, group_name = line.split()
downloading_prefixes.append(download_prefix)
sample_name_conversion[prefix] = [new_name, group_name]
return sample_name_conversion, downloading_prefixes
def build_directory_structure():
os.mkdir(MAIN_DIRECTORY)
os.mkdir(MAIN_DIRECTORY + "original_files")
os.mkdir(MAIN_DIRECTORY + "trimmed")
os.mkdir(MAIN_DIRECTORY + "sam")
os.mkdir(MAIN_DIRECTORY + "bed")
os.mkdir(MAIN_DIRECTORY + "bigwig")
os.mkdir(MAIN_DIRECTORY + "logs")
def download_data(url, prefixes):
# Download the data in the original_files folder
# -q quiet, -nH is no host directories, -P is the directory prefix
original_files_directory = MAIN_DIRECTORY + "original_files"
# Comma separated list to -A
prefixes = [prefix + "*.fastq.gz" for prefix in prefixes]
accepted_file_string = ",".join(prefixes)
os.system("wget -q --cut-dirs=100 -nH -r -A " + accepted_file_string + " -P " + original_files_directory + " " + url)
def _trim_helper(prefix):
# Do the trimming and write the stdout and stderr to the logging file
result = subprocess.check_output(
"trim_galore --paired --small_rna --dont_gzip --quality 0 --length 34 --output_dir " +
MAIN_DIRECTORY + "trimmed" + " " + MAIN_DIRECTORY + "original_files/" + prefix + "*",
shell=True,
stderr=subprocess.STDOUT,
text=True
)
logs_directory = MAIN_DIRECTORY + "logs"
with open(logs_directory + "/trimming.log", 'a') as file:
file.write(result)
def trim_adapters(threads):
# Group the samples by the prefix -- string until the first underscore
prefixes = set()
for filename in os.listdir(MAIN_DIRECTORY + "original_files"):
prefixes.add(filename.split("_lane")[0])
# Trim adapters for each group with the same prefix
with Pool(threads) as pool:
pool.map(_trim_helper, prefixes)
def _align_and_dedup(read_one_file, read_two_file, sample_name, align_params, threads):
trim5 = align_params['trim5']
trim3 = align_params['trim3']
minins = align_params['minins']
maxins = align_params['maxins']
index = align_params['index']
sam_directory = MAIN_DIRECTORY + "sam"
bed_directory = MAIN_DIRECTORY + "bed"
sam_file = sam_directory + "/" + sample_name + ".sam"
result = subprocess.check_output(
"bowtie --trim5 " + trim5 + " --trim3 " + trim3 + " --minins " + minins + " --maxins " + maxins +
" --fr --best --allow-contain --sam --fullref --chunkmbs 5000 --threads " + str(threads) + " " + index +
" -1 " + read_one_file +
" -2 " + read_two_file +
" > " + sam_file,
shell=True,
stderr=subprocess.STDOUT,
text=True
)
logs_directory = MAIN_DIRECTORY + "logs"
with open(logs_directory + "/align.log", 'a') as file:
file.write(sample_name + "\n")
file.write(result + "\n\n")
# Also dedup and log
result = subprocess.check_output(
"dedup -n " + trim5 + " -f -p -t " + str(threads) +
" -1 " + read_one_file +
" -2 " + read_two_file +
" -S " + sam_file,
shell=True,
stderr=subprocess.STDOUT,
text=True
)
with open(logs_directory + "/dedup.log", 'a') as file:
file.write(result + "\n\n")
# Move the bed file to the bed directory
os.system('mv ' + sam_file.replace(".sam", "-dedup.bed") + ' ' + bed_directory)
def align(align_params, sample_name_conversion, threads):
trimmed_directory = MAIN_DIRECTORY + "trimmed"
bed_directory = MAIN_DIRECTORY + "bed"
# Group the trimmed files by prefix
prefixes = defaultdict(list)
for filename in os.listdir(trimmed_directory):
if 'trimming_report' not in filename:
prefix = '_'.join(filename.split('_')[:-6])
# Remove the lane string if there is one
if 'lane' in prefix:
location = prefix.find('lane')
prefix = prefix[:location] + prefix[location + 6:]
prefixes[prefix].append(filename)
# If there is more than one lane with the prefix, then we align and dedup separately but combine the bed files at the end
for prefix, filenames in prefixes.items():
if len(filenames) == 2:
prefixes[prefix] = [sorted(filenames)]
else:
# Group by lane
lane_strings = defaultdict(list)
for filename in filenames:
lane_string = filename.split('_')[-3]
lane_strings[lane_string].append(filename)
new_list = []
# Verify that there are two files for each lane string and make sure we add them to the prefixes dict
for lane_filenames in lane_strings.values():
if len(lane_filenames) != 2:
print("Something odd happened with lanes. Here are the samples grouped: " + str(lane_filenames))
else:
new_list.append(lane_filenames)
prefixes[prefix] = sorted(new_list)
for prefix, groups in prefixes.items():
need_to_combine_bed_files = False if len(groups) == 1 else True
# If the sample name is being converted, do it
if sample_name_conversion and prefix in sample_name_conversion:
sample_name = sample_name_conversion[prefix][0]
else:
sample_name = prefix
lane_specific_bed_files = []
for i, group in enumerate(groups):
read_one_file, read_two_file = group
read_one_file = trimmed_directory + "/" + read_one_file
read_two_file = trimmed_directory + "/" + read_two_file
# If the lanes need to be combined, then we will add a number to the end of the sample name
if need_to_combine_bed_files:
lane_specific_bed_files.append(bed_directory + "/" + sample_name + str(i) + ".bed")
_align_and_dedup(read_one_file, read_two_file, sample_name + str(i), align_params, threads)
else:
_align_and_dedup(read_one_file, read_two_file, sample_name, align_params, threads)
if need_to_combine_bed_files:
# Combine the bed files that begin with the sample name and write a new file without the numbers at the end
os.system(
'cat ' + bed_directory + "/" + sample_name + "*.bed" +
' > ' + bed_directory + "/" + sample_name + ".bed"
)
# Remove all the lane specific files
remove_files(lane_specific_bed_files)
def _calculate_spike_in_normalization_table(sample_name_conversion, spike_in_genome, genomes):
def get_group_name(filename):
sample_name = filename.replace('-dedup.bed', '')
for prefix in sample_name_conversion:
if sample_name_conversion[prefix][0] == sample_name:
return sample_name_conversion[prefix][1]
return "unknown"
bed_directory = MAIN_DIRECTORY + "bed"
normalization_group_data = defaultdict(dict)
# Loop through each bed file
for filename in os.listdir(bed_directory):
# Get the total number of reads and split it for each genome
group_name = get_group_name(filename)
normalization_group_data[group_name][filename] = {
'total reads': 0,
'library size normalization factor': 0.0,
'spike in normalization factor': 0.0
}
for genome in genomes:
normalization_group_data[group_name][filename][genome] = 0
with open(bed_directory + "/" + filename) as file:
for line in file:
chrom, left, right, name, score, strand = line.split()
# Add the read to total counts and the specific genome
normalization_group_data[group_name][filename]['total reads'] += 1
if 'chr' in chrom:
normalization_group_data[group_name][filename]['hg38'] += 1
else:
normalization_group_data[group_name][filename][chrom] += 1
# For each group, calculate the normalization factors and write it to the file
with open(MAIN_DIRECTORY + "normalization_table.tsv", 'w') as file:
file.write("\t".join(
["Sample", "Total Reads"] + genomes + ["Library Size Correction Factor", "Spike-in Correction Factor",
"Final Correction Factor", "Group"]
) + "\n")
for group_name, group_data in normalization_group_data.items():
# Now calculate the normalization factors
average_counts = mean([sample_data['total reads'] for sample_data in group_data.values()])
for sample_data in group_data.values():
sample_data['library size normalization factor'] = average_counts / sample_data['total reads']
average_normalized_spike_in_reads = mean(
[sample_data['library size normalization factor'] * sample_data[spike_in_genome]
for sample_data in group_data.values()]
)
for sample_data in group_data.values():
sample_data['spike in normalization factor'] = average_normalized_spike_in_reads / sample_data[spike_in_genome]
# Write the data for each sample
for sample_filename, sample_data in group_data.items():
final_correction_factor = sample_data['library size normalization factor'] * \
sample_data['spike in normalization factor']
file.write(
"\t".join(
[sample_filename.replace("-dedup.bed", ""), str(sample_data['total reads'])] +
[str(sample_data[genome]) for genome in genomes] +
[str(sample_data['library size normalization factor'])] +
[str(sample_data['spike in normalization factor'])] +
[str(final_correction_factor), group_name]
) + "\n"
)
def _calculate_library_size_normalization_table(sample_name_conversion):
def get_group_name(filename):
sample_name = filename.replace('-dedup.bed', '')
for prefix in sample_name_conversion:
if sample_name_conversion[prefix][0] == sample_name:
return sample_name_conversion[prefix][1]
return "unknown"
bed_directory = MAIN_DIRECTORY + "bed"
normalization_group_data = defaultdict(dict)
for filename in os.listdir(bed_directory):
group_name = get_group_name(filename)
with open(bed_directory + "/" + filename) as file:
for i, _ in enumerate(file):
pass
normalization_group_data[group_name][filename] = i + 1
# Write the data to a file
with open(MAIN_DIRECTORY + "normalization_table.tsv", 'w') as file:
for group_name, group_data in normalization_group_data.items():
average_library_size = mean([count for count in group_data.values()])
# Write the headers
file.write(
"\t".join(
["Sample", "Total Reads", "Correction Factor"]
) + "\n"
)
for filename, counts in group_data.items():
file.write(
"\t".join(
[filename.replace("-dedup.bed", ""), str(counts), str(average_library_size / counts), group_name]
) + "\n"
)
def calculate_normalization_table(sample_name_conversion, spike_in_genome=None, genomes=None):
# If they provide arguments, then it must be spike_in normalization
if spike_in_genome and genomes:
_calculate_spike_in_normalization_table(sample_name_conversion, spike_in_genome, genomes)
else:
# Calculate based on total library size
_calculate_library_size_normalization_table(sample_name_conversion)
def _generate_bigwig(filename, normalization_factor, chrom_sizes_file, hosting_location):
bigwig_directory = MAIN_DIRECTORY + "bigwig"
bedgraph_files = []
links = []
link_template = "track type=bigWig visibility=full name='<name>' autoScale=on alwaysZero=on " + \
"windowingFunction=maximum negateValues=off color=0,0,0 altColor=0,0,0 " + \
"bigDataUrl=<hostLocation>/<file>"
tmp_file = generate_random_filename(".tmp")
os.system('cat ' + filename + """ | awk '$1 != "chrEBV" {print $0}' > """ + tmp_file)
os.system('bedSort ' + tmp_file + ' ' + filename)
for strand, strand_string in [("+", "FW"), ("-", "RV")]:
os.system(
'bedtools genomecov -scale ' + normalization_factor +
' -i ' + filename + ' -g ' + chrom_sizes_file +
' -bg -strand ' + strand +
' > ' + filename.replace('.bed', '-' + strand_string + '.bedGraph')
)
os.system(
'bedtools genomecov -scale ' + normalization_factor +
' -i ' + filename + ' -g ' + chrom_sizes_file +
' -bg -strand ' + strand + ' -5' +
' > ' + filename.replace('.bed', '-' + strand_string + '-5.bedGraph')
)
os.system(
'bedtools genomecov -scale ' + normalization_factor +
' -i ' + filename + ' -g ' + chrom_sizes_file +
' -bg -strand ' + strand + ' -3' +
' > ' + filename.replace('.bed', '-' + strand_string + '-3.bedGraph')
)
bedgraph_files.append(filename.replace('.bed', '-' + strand_string + '.bedGraph'))
bedgraph_files.append(filename.replace('.bed', '-' + strand_string + '-5.bedGraph'))
bedgraph_files.append(filename.replace('.bed', '-' + strand_string + '-3.bedGraph'))
# Convert bedGraphs to bigwigs and add track links
for file in bedgraph_files:
os.system('bedSort ' + file + ' ' + file)
bigwig_file = bigwig_directory + "/" + file.split('/')[-1].replace('.bedGraph', '.bw')
os.system('bedGraphToBigWig ' + file + ' ' + chrom_sizes_file + ' ' + bigwig_file)
curr_link = link_template
if "-RV.bw" in bigwig_file or "-RV-5.bw" in bigwig_file or "-RV-3.bw" in bigwig_file:
curr_link = curr_link.replace("negateValues=off", "negateValues=on")
file_basename = file.split("/")[-1]
# Get the sample names
sample_name = file_basename
sample_name = sample_name.replace(".bw", "").replace("_", " ").replace("-", " ")
# Now put the sample name in
curr_link = curr_link.replace("<name>", sample_name).replace("<file>", file_basename)
if hosting_location:
curr_link = curr_link.replace("<hostLocation>", hosting_location)
links.append(curr_link)
# Remove all the bedgraph and tmp files
remove_files(bedgraph_files, tmp_file)
# Sort the links so they are in the order of FW, RV, FW5, RV 5, FW3, RV3
links.sort()
final_links = [
links[2], # Fw
links[5], # Rv
links[1], # Fw 5
links[4], # Rv 5
links[0], # Fw 3
links[3], # Rv 3
]
return final_links
def generate_bigwigs(chrom_sizes_filename, threads, hosting_location):
# First get the normalization factors
normalization_factors = {}
with open(MAIN_DIRECTORY + "normalization_table.tsv") as file:
for i, line in enumerate(file):
if i != 0:
sample_name, *_, normalization_factor, _ = line.split()
normalization_factors[sample_name] = normalization_factor
bed_directory = MAIN_DIRECTORY + "bed"
bigwig_directory = MAIN_DIRECTORY + "bigwig"
args = []
for filename in os.listdir(bed_directory):
sample_name = filename.split("/")[-1].replace("-dedup.bed", "")
args.append(
[
bed_directory + "/" + filename,
normalization_factors[sample_name],
chrom_sizes_filename,
hosting_location
]
)
with Pool(threads) as pool:
all_links = pool.starmap(_generate_bigwig, args)
# Write the links to a file
with open(bigwig_directory + "/links.txt", 'w') as file:
for dataset_links in all_links:
for link in dataset_links:
file.write(link + "\n")
def clean_directories():
# Remove the trimmed and sam directories
rmtree(MAIN_DIRECTORY + "trimmed")
rmtree(MAIN_DIRECTORY + "sam")
def main(args):
args = parse_args(args)
url = args.url
folder_name = args.folder_name
threads = args.threads
chrom_sizes_file = args.chrom_sizes_file
server_name = args.server_name
spike_in_genome = args.spike_in_genome
genomes = args.genomes + [spike_in_genome]
sample_name_conversion_filename = args.sample_name_conversion_filename
align_params = {
'trim5': str(args.umi_length),
'trim3': str(args.umi_length),
'minins': str(args.min_insert),
'maxins': str(args.max_insert),
'index': args.index
}
hosting_location = server_name + folder_name if server_name else ''
global MAIN_DIRECTORY
MAIN_DIRECTORY = "/home/geoff/.trial/" + folder_name + "/"
# If given a conversion file, then only download the ones in the conversion file
sample_name_conversion, prefixes = read_sample_name_conversion_table(sample_name_conversion_filename)
build_directory_structure()
download_data(url, prefixes)
trim_adapters(threads)
align(align_params, sample_name_conversion, threads)
calculate_normalization_table(sample_name_conversion, spike_in_genome, genomes)
generate_bigwigs(chrom_sizes_file, threads, hosting_location)
clean_directories()
if __name__ == '__main__':
main(sys.argv[1:])
| [
1,
1053,
2897,
13,
5215,
10876,
13,
5215,
1014,
5014,
13,
5215,
1852,
5510,
13,
13,
3166,
2043,
24183,
29889,
13239,
29889,
5675,
29918,
8172,
29918,
9507,
1053,
5706,
29918,
8172,
29918,
9507,
13,
3166,
2043,
24183,
29889,
13239,
29889,
5992,
29918,
5325,
1053,
3349,
29918,
5325,
13,
13,
3166,
6674,
307,
985,
292,
1053,
28625,
13,
3166,
16250,
1053,
2322,
8977,
13,
3166,
13964,
1053,
2099,
13,
3166,
528,
4422,
1053,
364,
4378,
929,
13,
13,
29937,
14402,
29901,
25249,
278,
2066,
304,
544,
293,
23509,
13,
13,
10945,
14861,
1177,
29918,
4571,
26282,
18929,
13,
13,
13,
29937,
3617,
1881,
13,
1753,
6088,
29918,
5085,
29898,
5085,
1125,
13,
1678,
822,
6374,
29918,
524,
29898,
1949,
1125,
13,
4706,
1018,
29901,
13,
9651,
659,
353,
938,
29898,
1949,
29897,
13,
9651,
565,
659,
5277,
29871,
29900,
29901,
13,
18884,
12020,
8960,
703,
8120,
304,
278,
5174,
1159,
13,
4706,
5174,
29901,
13,
9651,
12020,
1852,
5510,
29889,
15730,
1542,
2392,
29898,
1949,
718,
376,
1818,
367,
6374,
1159,
13,
13,
4706,
736,
659,
13,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
29097,
2433,
7713,
24183,
7595,
742,
13,
462,
462,
268,
6139,
2433,
2499,
647,
10650,
848,
304,
5706,
6592,
322,
4802,
9192,
2066,
7790,
29876,
29915,
718,
13,
462,
462,
462,
376,
20761,
2472,
508,
367,
1476,
472,
376,
718,
13,
462,
462,
462,
376,
991,
597,
479,
22450,
22017,
1144,
29889,
3292,
29889,
601,
29914,
7713,
24183,
29914,
2520,
29889,
1420,
1159,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29884,
742,
525,
489,
2271,
742,
2731,
2433,
2271,
742,
1539,
485,
279,
2433,
2271,
742,
1134,
29922,
710,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29888,
742,
525,
489,
12083,
29899,
978,
742,
2731,
2433,
12083,
29918,
978,
742,
1539,
485,
279,
2433,
12083,
29918,
978,
742,
1134,
29922,
710,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29880,
742,
525,
489,
15547,
29899,
2848,
742,
2731,
2433,
15547,
29918,
2848,
742,
1539,
485,
279,
2433,
15547,
29918,
2848,
742,
1134,
29922,
1066,
3321,
29918,
524,
29892,
2322,
29922,
29947,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1195,
29899,
7851,
742,
2731,
2433,
1195,
29918,
7851,
742,
1539,
485,
279,
2433,
1195,
29918,
7851,
742,
1134,
29922,
1066,
3321,
29918,
524,
29892,
2322,
29922,
29941,
29906,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
3317,
29899,
7851,
742,
2731,
2433,
3317,
29918,
7851,
742,
1539,
485,
279,
2433,
3317,
29918,
7851,
742,
1134,
29922,
1066,
3321,
29918,
524,
29892,
2322,
29922,
29953,
29900,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29873,
742,
525,
489,
28993,
742,
2731,
2433,
28993,
742,
1539,
485,
279,
2433,
28993,
742,
1134,
29922,
1066,
3321,
29918,
524,
29892,
302,
5085,
2433,
29973,
742,
2322,
29922,
29896,
29900,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29875,
742,
525,
489,
2248,
742,
2731,
2433,
2248,
742,
1539,
485,
279,
2433,
2248,
742,
1134,
29922,
710,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29883,
742,
525,
489,
27433,
29899,
29879,
7093,
29899,
1445,
742,
2731,
2433,
27433,
29918,
29879,
7093,
29918,
1445,
742,
1539,
485,
279,
2433,
27433,
29918,
29879,
7093,
29918,
1445,
742,
1134,
29922,
710,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29879,
742,
525,
489,
2974,
29899,
978,
742,
2731,
2433,
2974,
29918,
978,
742,
1539,
485,
279,
2433,
2974,
29918,
978,
742,
1134,
29922,
710,
29892,
2322,
29922,
8516,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1028,
9345,
29899,
262,
29899,
1885,
608,
742,
2731,
2433,
1028,
9345,
29918,
262,
29918,
1885,
608,
742,
1539,
485,
279,
2433,
1028,
9345,
29918,
262,
29918,
1885,
608,
742,
1134,
29922,
710,
29892,
2322,
29922,
8516,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29887,
742,
525,
489,
1885,
608,
742,
2731,
2433,
1885,
290,
267,
742,
1539,
485,
279,
2433,
1885,
608,
742,
1134,
29922,
710,
29892,
302,
5085,
543,
29974,
613,
3158,
543,
21843,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29916,
742,
525,
489,
535,
3259,
29899,
1445,
742,
2731,
2433,
11249,
29918,
978,
29918,
535,
3259,
29918,
9507,
742,
1539,
485,
279,
2433,
535,
3259,
29918,
1445,
742,
1134,
29922,
710,
29892,
2322,
29922,
8516,
29897,
13,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
29898,
5085,
29897,
13,
13,
13,
1753,
1303,
29918,
11249,
29918,
978,
29918,
535,
3259,
29918,
2371,
29898,
9507,
1125,
13,
1678,
565,
451,
10422,
470,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
9507,
1125,
13,
4706,
736,
6213,
29892,
518,
4286,
11255,
29939,
29889,
18828,
2033,
13,
13,
1678,
28536,
29918,
13506,
267,
353,
5159,
13,
13,
1678,
4559,
29918,
978,
29918,
535,
3259,
353,
6571,
13,
1678,
411,
1722,
29898,
9507,
29897,
408,
934,
29901,
13,
4706,
363,
474,
29892,
1196,
297,
26985,
29898,
1445,
1125,
13,
9651,
565,
474,
2804,
29871,
29900,
29901,
13,
18884,
5142,
29918,
13506,
29892,
10944,
29892,
716,
29918,
978,
29892,
2318,
29918,
978,
353,
1196,
29889,
5451,
580,
13,
18884,
28536,
29918,
13506,
267,
29889,
4397,
29898,
10382,
29918,
13506,
29897,
13,
13,
18884,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
29962,
353,
518,
1482,
29918,
978,
29892,
2318,
29918,
978,
29962,
13,
13,
1678,
736,
4559,
29918,
978,
29918,
535,
3259,
29892,
28536,
29918,
13506,
267,
13,
13,
13,
1753,
2048,
29918,
12322,
29918,
23905,
7295,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
29897,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
13492,
29918,
5325,
1159,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
15450,
2168,
1159,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
13445,
1159,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
2580,
1159,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
3752,
9192,
1159,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
20756,
1159,
13,
13,
13,
1753,
5142,
29918,
1272,
29898,
2271,
29892,
10944,
267,
1125,
13,
1678,
396,
25553,
278,
848,
297,
278,
2441,
29918,
5325,
4138,
13,
1678,
396,
448,
29939,
11813,
29892,
448,
29876,
29950,
338,
694,
3495,
17525,
29892,
448,
29925,
338,
278,
3884,
10944,
13,
1678,
2441,
29918,
5325,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
13492,
29918,
5325,
29908,
13,
1678,
396,
422,
655,
13055,
1051,
304,
448,
29909,
13,
1678,
10944,
267,
353,
518,
13506,
718,
376,
10521,
11255,
29939,
29889,
18828,
29908,
363,
10944,
297,
10944,
267,
29962,
13,
1678,
9259,
29918,
1445,
29918,
1807,
353,
9162,
1642,
7122,
29898,
13506,
267,
29897,
13,
1678,
2897,
29889,
5205,
703,
29893,
657,
448,
29939,
1192,
7582,
29899,
3972,
29879,
29922,
29896,
29900,
29900,
448,
29876,
29950,
448,
29878,
448,
29909,
376,
718,
9259,
29918,
1445,
29918,
1807,
718,
376,
448,
29925,
376,
718,
2441,
29918,
5325,
29918,
12322,
718,
376,
376,
718,
3142,
29897,
13,
13,
13,
1753,
903,
15450,
29918,
20907,
29898,
13506,
1125,
13,
1678,
396,
1938,
278,
17151,
4056,
322,
2436,
278,
27591,
322,
380,
20405,
304,
278,
12183,
934,
13,
1678,
1121,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
13,
4706,
376,
15450,
29918,
23014,
487,
1192,
3274,
2859,
1192,
9278,
29918,
29878,
1056,
1192,
29881,
609,
29918,
29887,
7554,
1192,
29567,
29871,
29900,
1192,
2848,
29871,
29941,
29946,
1192,
4905,
29918,
3972,
376,
718,
13,
4706,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
15450,
2168,
29908,
718,
376,
376,
718,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
13492,
29918,
5325,
12975,
718,
10944,
718,
26345,
613,
13,
4706,
6473,
29922,
5574,
29892,
13,
4706,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29892,
13,
4706,
1426,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
10748,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
20756,
29908,
13,
13,
1678,
411,
1722,
29898,
20756,
29918,
12322,
718,
5591,
15450,
4056,
29889,
1188,
613,
525,
29874,
1495,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
29898,
2914,
29897,
13,
13,
13,
1753,
17151,
29918,
328,
481,
2153,
29898,
28993,
1125,
13,
1678,
396,
6431,
278,
11916,
491,
278,
10944,
1192,
1347,
2745,
278,
937,
23400,
3221,
13,
1678,
10944,
267,
353,
731,
580,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
13492,
29918,
5325,
29908,
1125,
13,
4706,
10944,
267,
29889,
1202,
29898,
9507,
29889,
5451,
703,
29918,
25821,
1159,
29961,
29900,
2314,
13,
13,
1678,
396,
1605,
326,
594,
481,
2153,
363,
1269,
2318,
411,
278,
1021,
10944,
13,
1678,
411,
28625,
29898,
28993,
29897,
408,
11565,
29901,
13,
4706,
11565,
29889,
1958,
7373,
15450,
29918,
20907,
29892,
10944,
267,
29897,
13,
13,
13,
1753,
903,
2520,
29918,
392,
29918,
7176,
786,
29898,
949,
29918,
650,
29918,
1445,
29892,
1303,
29918,
10184,
29918,
1445,
29892,
4559,
29918,
978,
29892,
7595,
29918,
7529,
29892,
9717,
1125,
13,
1678,
17151,
29945,
353,
7595,
29918,
7529,
1839,
15450,
29945,
2033,
13,
1678,
17151,
29941,
353,
7595,
29918,
7529,
1839,
15450,
29941,
2033,
13,
1678,
1375,
1144,
353,
7595,
29918,
7529,
1839,
1195,
1144,
2033,
13,
1678,
4236,
1144,
353,
7595,
29918,
7529,
1839,
3317,
1144,
2033,
13,
1678,
2380,
353,
7595,
29918,
7529,
1839,
2248,
2033,
13,
13,
1678,
3514,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
13445,
29908,
13,
1678,
6592,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
2580,
29908,
13,
13,
1678,
3514,
29918,
1445,
353,
3514,
29918,
12322,
718,
5591,
29908,
718,
4559,
29918,
978,
718,
11393,
13445,
29908,
13,
13,
1678,
1121,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
13,
4706,
376,
17729,
29873,
347,
1192,
15450,
29945,
376,
718,
17151,
29945,
718,
376,
1192,
15450,
29941,
376,
718,
17151,
29941,
718,
376,
1192,
1195,
1144,
376,
718,
1375,
1144,
718,
376,
1192,
3317,
1144,
376,
718,
4236,
1144,
718,
13,
4706,
376,
1192,
1341,
1192,
13318,
1192,
9536,
29899,
1285,
475,
1192,
13445,
1192,
8159,
999,
1192,
29812,
29885,
5824,
29871,
29945,
29900,
29900,
29900,
1192,
28993,
376,
718,
851,
29898,
28993,
29897,
718,
376,
376,
718,
2380,
718,
13,
4706,
376,
448,
29896,
376,
718,
1303,
29918,
650,
29918,
1445,
718,
13,
4706,
376,
448,
29906,
376,
718,
1303,
29918,
10184,
29918,
1445,
718,
13,
4706,
376,
1405,
376,
718,
3514,
29918,
1445,
29892,
13,
4706,
6473,
29922,
5574,
29892,
13,
4706,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29892,
13,
4706,
1426,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
10748,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
20756,
29908,
13,
13,
1678,
411,
1722,
29898,
20756,
29918,
12322,
718,
5591,
2520,
29889,
1188,
613,
525,
29874,
1495,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
29898,
11249,
29918,
978,
718,
6634,
29876,
1159,
13,
4706,
934,
29889,
3539,
29898,
2914,
718,
6634,
29876,
29905,
29876,
1159,
13,
13,
1678,
396,
3115,
28262,
786,
322,
1480,
13,
1678,
1121,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
13,
4706,
376,
7176,
786,
448,
29876,
376,
718,
17151,
29945,
718,
376,
448,
29888,
448,
29886,
448,
29873,
376,
718,
851,
29898,
28993,
29897,
718,
13,
4706,
376,
448,
29896,
376,
718,
1303,
29918,
650,
29918,
1445,
718,
13,
4706,
376,
448,
29906,
376,
718,
1303,
29918,
10184,
29918,
1445,
718,
13,
4706,
376,
448,
29903,
376,
718,
3514,
29918,
1445,
29892,
13,
4706,
6473,
29922,
5574,
29892,
13,
4706,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29892,
13,
4706,
1426,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
411,
1722,
29898,
20756,
29918,
12322,
718,
5591,
7176,
786,
29889,
1188,
613,
525,
29874,
1495,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
29898,
2914,
718,
6634,
29876,
29905,
29876,
1159,
13,
13,
1678,
396,
25249,
278,
6592,
934,
304,
278,
6592,
3884,
13,
1678,
2897,
29889,
5205,
877,
29324,
525,
718,
3514,
29918,
1445,
29889,
6506,
17350,
13445,
613,
11663,
7176,
786,
29889,
2580,
1159,
718,
525,
525,
718,
6592,
29918,
12322,
29897,
13,
13,
13,
1753,
7595,
29898,
2520,
29918,
7529,
29892,
4559,
29918,
978,
29918,
535,
3259,
29892,
9717,
1125,
13,
1678,
17151,
2168,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
15450,
2168,
29908,
13,
1678,
6592,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
2580,
29908,
13,
13,
1678,
396,
6431,
278,
17151,
2168,
2066,
491,
10944,
13,
1678,
10944,
267,
353,
2322,
8977,
29898,
1761,
29897,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
15450,
2168,
29918,
12322,
1125,
13,
4706,
565,
525,
15450,
4056,
29918,
12276,
29915,
451,
297,
10422,
29901,
13,
9651,
10944,
353,
22868,
4286,
7122,
29898,
9507,
29889,
5451,
877,
29918,
1495,
7503,
29899,
29953,
2314,
13,
9651,
396,
15154,
278,
301,
1662,
1347,
565,
727,
338,
697,
13,
9651,
565,
525,
25821,
29915,
297,
10944,
29901,
13,
18884,
4423,
353,
10944,
29889,
2886,
877,
25821,
1495,
13,
18884,
10944,
353,
10944,
7503,
5479,
29962,
718,
10944,
29961,
5479,
718,
29871,
29953,
17531,
13,
13,
9651,
10944,
267,
29961,
13506,
1822,
4397,
29898,
9507,
29897,
13,
13,
1678,
396,
960,
727,
338,
901,
1135,
697,
301,
1662,
411,
278,
10944,
29892,
769,
591,
7595,
322,
28262,
786,
16949,
541,
14405,
278,
6592,
2066,
472,
278,
1095,
13,
1678,
363,
10944,
29892,
977,
264,
1280,
297,
10944,
267,
29889,
7076,
7295,
13,
4706,
565,
7431,
29898,
1777,
264,
1280,
29897,
1275,
29871,
29906,
29901,
13,
9651,
10944,
267,
29961,
13506,
29962,
353,
518,
24582,
29898,
1777,
264,
1280,
4638,
13,
4706,
1683,
29901,
13,
9651,
396,
6431,
491,
301,
1662,
13,
9651,
301,
1662,
29918,
19651,
353,
2322,
8977,
29898,
1761,
29897,
13,
13,
9651,
363,
10422,
297,
977,
264,
1280,
29901,
13,
18884,
301,
1662,
29918,
1807,
353,
10422,
29889,
5451,
877,
29918,
1495,
14352,
29941,
29962,
13,
18884,
301,
1662,
29918,
19651,
29961,
25821,
29918,
1807,
1822,
4397,
29898,
9507,
29897,
13,
13,
9651,
716,
29918,
1761,
353,
5159,
13,
13,
9651,
396,
1798,
1598,
393,
727,
526,
1023,
2066,
363,
1269,
301,
1662,
1347,
322,
1207,
1854,
591,
788,
963,
304,
278,
10944,
267,
9657,
13,
9651,
363,
301,
1662,
29918,
1777,
264,
1280,
297,
301,
1662,
29918,
19651,
29889,
5975,
7295,
13,
18884,
565,
7431,
29898,
25821,
29918,
1777,
264,
1280,
29897,
2804,
29871,
29906,
29901,
13,
462,
1678,
1596,
703,
16804,
7736,
9559,
411,
10906,
267,
29889,
2266,
526,
278,
11916,
27831,
29901,
376,
718,
851,
29898,
25821,
29918,
1777,
264,
1280,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
716,
29918,
1761,
29889,
4397,
29898,
25821,
29918,
1777,
264,
1280,
29897,
13,
13,
9651,
10944,
267,
29961,
13506,
29962,
353,
12705,
29898,
1482,
29918,
1761,
29897,
13,
13,
1678,
363,
10944,
29892,
6471,
297,
10944,
267,
29889,
7076,
7295,
13,
4706,
817,
29918,
517,
29918,
17743,
457,
29918,
2580,
29918,
5325,
353,
7700,
565,
7431,
29898,
13155,
29897,
1275,
29871,
29896,
1683,
5852,
13,
13,
4706,
396,
960,
278,
4559,
1024,
338,
1641,
11543,
29892,
437,
372,
13,
4706,
565,
4559,
29918,
978,
29918,
535,
3259,
322,
10944,
297,
4559,
29918,
978,
29918,
535,
3259,
29901,
13,
9651,
4559,
29918,
978,
353,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
3816,
29900,
29962,
13,
4706,
1683,
29901,
13,
9651,
4559,
29918,
978,
353,
10944,
13,
13,
4706,
301,
1662,
29918,
14940,
29918,
2580,
29918,
5325,
353,
5159,
13,
13,
4706,
363,
474,
29892,
2318,
297,
26985,
29898,
13155,
1125,
13,
9651,
1303,
29918,
650,
29918,
1445,
29892,
1303,
29918,
10184,
29918,
1445,
353,
2318,
13,
13,
9651,
1303,
29918,
650,
29918,
1445,
353,
17151,
2168,
29918,
12322,
718,
5591,
29908,
718,
1303,
29918,
650,
29918,
1445,
13,
9651,
1303,
29918,
10184,
29918,
1445,
353,
17151,
2168,
29918,
12322,
718,
5591,
29908,
718,
1303,
29918,
10184,
29918,
1445,
13,
13,
9651,
396,
960,
278,
10906,
267,
817,
304,
367,
12420,
29892,
769,
591,
674,
788,
263,
1353,
304,
278,
1095,
310,
278,
4559,
1024,
13,
9651,
565,
817,
29918,
517,
29918,
17743,
457,
29918,
2580,
29918,
5325,
29901,
13,
18884,
301,
1662,
29918,
14940,
29918,
2580,
29918,
5325,
29889,
4397,
29898,
2580,
29918,
12322,
718,
5591,
29908,
718,
4559,
29918,
978,
718,
851,
29898,
29875,
29897,
718,
11393,
2580,
1159,
13,
18884,
903,
2520,
29918,
392,
29918,
7176,
786,
29898,
949,
29918,
650,
29918,
1445,
29892,
1303,
29918,
10184,
29918,
1445,
29892,
4559,
29918,
978,
718,
851,
29898,
29875,
511,
7595,
29918,
7529,
29892,
9717,
29897,
13,
9651,
1683,
29901,
13,
18884,
903,
2520,
29918,
392,
29918,
7176,
786,
29898,
949,
29918,
650,
29918,
1445,
29892,
1303,
29918,
10184,
29918,
1445,
29892,
4559,
29918,
978,
29892,
7595,
29918,
7529,
29892,
9717,
29897,
13,
13,
4706,
565,
817,
29918,
517,
29918,
17743,
457,
29918,
2580,
29918,
5325,
29901,
13,
9651,
396,
422,
26062,
278,
6592,
2066,
393,
3380,
411,
278,
4559,
1024,
322,
2436,
263,
716,
934,
1728,
278,
3694,
472,
278,
1095,
13,
9651,
2897,
29889,
5205,
29898,
13,
18884,
525,
4117,
525,
718,
6592,
29918,
12322,
718,
5591,
29908,
718,
4559,
29918,
978,
718,
376,
10521,
2580,
29908,
718,
13,
18884,
525,
1405,
525,
718,
6592,
29918,
12322,
718,
5591,
29908,
718,
4559,
29918,
978,
718,
11393,
2580,
29908,
13,
9651,
1723,
13,
13,
9651,
396,
15154,
599,
278,
301,
1662,
2702,
2066,
13,
9651,
3349,
29918,
5325,
29898,
25821,
29918,
14940,
29918,
2580,
29918,
5325,
29897,
13,
13,
13,
1753,
903,
15807,
403,
29918,
1028,
9345,
29918,
262,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29892,
805,
9345,
29918,
262,
29918,
1885,
608,
29892,
20853,
267,
1125,
13,
1678,
822,
679,
29918,
2972,
29918,
978,
29898,
9507,
1125,
13,
4706,
4559,
29918,
978,
353,
10422,
29889,
6506,
877,
29899,
7176,
786,
29889,
2580,
742,
27255,
13,
13,
4706,
363,
10944,
297,
4559,
29918,
978,
29918,
535,
3259,
29901,
13,
9651,
565,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
3816,
29900,
29962,
1275,
4559,
29918,
978,
29901,
13,
18884,
736,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
3816,
29896,
29962,
13,
13,
4706,
736,
376,
26690,
29908,
13,
13,
13,
1678,
6592,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
2580,
29908,
13,
13,
1678,
4226,
2133,
29918,
2972,
29918,
1272,
353,
2322,
8977,
29898,
8977,
29897,
13,
13,
1678,
396,
21493,
1549,
1269,
6592,
934,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
2580,
29918,
12322,
1125,
13,
4706,
396,
3617,
278,
3001,
1353,
310,
13623,
322,
6219,
372,
363,
1269,
2531,
608,
13,
4706,
2318,
29918,
978,
353,
679,
29918,
2972,
29918,
978,
29898,
9507,
29897,
13,
13,
4706,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
29962,
353,
426,
13,
9651,
525,
7827,
13623,
2396,
29871,
29900,
29892,
13,
9651,
525,
5258,
2159,
4226,
2133,
7329,
2396,
29871,
29900,
29889,
29900,
29892,
13,
9651,
525,
1028,
9345,
297,
4226,
2133,
7329,
2396,
29871,
29900,
29889,
29900,
13,
4706,
500,
13,
13,
4706,
363,
2531,
608,
297,
20853,
267,
29901,
13,
9651,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
3816,
1885,
608,
29962,
353,
29871,
29900,
13,
13,
4706,
411,
1722,
29898,
2580,
29918,
12322,
718,
5591,
29908,
718,
10422,
29897,
408,
934,
29901,
13,
9651,
363,
1196,
297,
934,
29901,
13,
18884,
25173,
29892,
2175,
29892,
1492,
29892,
1024,
29892,
8158,
29892,
851,
392,
353,
1196,
29889,
5451,
580,
13,
13,
18884,
396,
3462,
278,
1303,
304,
3001,
18139,
322,
278,
2702,
2531,
608,
13,
18884,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
22322,
7827,
13623,
2033,
4619,
29871,
29896,
13,
13,
18884,
565,
525,
22495,
29915,
297,
25173,
29901,
13,
462,
1678,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
22322,
29882,
29887,
29941,
29947,
2033,
4619,
29871,
29896,
13,
13,
18884,
1683,
29901,
13,
462,
1678,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
3816,
27433,
29962,
4619,
29871,
29896,
13,
13,
13,
1678,
396,
1152,
1269,
2318,
29892,
8147,
278,
4226,
2133,
13879,
322,
2436,
372,
304,
278,
934,
13,
1678,
411,
1722,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
8945,
2133,
29918,
2371,
29889,
1372,
29894,
613,
525,
29893,
1495,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
14182,
29873,
1642,
7122,
29898,
13,
9651,
6796,
17708,
613,
376,
11536,
7523,
29879,
3108,
718,
20853,
267,
718,
6796,
12284,
21179,
2994,
276,
428,
383,
7168,
613,
376,
29903,
1631,
446,
29899,
262,
2994,
276,
428,
383,
7168,
613,
13,
462,
462,
462,
259,
376,
15790,
2994,
276,
428,
383,
7168,
613,
376,
4782,
3108,
13,
4706,
1723,
718,
6634,
29876,
1159,
13,
13,
4706,
363,
2318,
29918,
978,
29892,
2318,
29918,
1272,
297,
4226,
2133,
29918,
2972,
29918,
1272,
29889,
7076,
7295,
13,
13,
9651,
396,
2567,
8147,
278,
4226,
2133,
13879,
13,
9651,
6588,
29918,
2798,
29879,
353,
2099,
4197,
11249,
29918,
1272,
1839,
7827,
13623,
2033,
363,
4559,
29918,
1272,
297,
2318,
29918,
1272,
29889,
5975,
580,
2314,
13,
13,
9651,
363,
4559,
29918,
1272,
297,
2318,
29918,
1272,
29889,
5975,
7295,
13,
18884,
4559,
29918,
1272,
1839,
5258,
2159,
4226,
2133,
7329,
2033,
353,
6588,
29918,
2798,
29879,
847,
4559,
29918,
1272,
1839,
7827,
13623,
2033,
13,
13,
9651,
6588,
29918,
8945,
1891,
29918,
1028,
9345,
29918,
262,
29918,
949,
29879,
353,
2099,
29898,
13,
18884,
518,
11249,
29918,
1272,
1839,
5258,
2159,
4226,
2133,
7329,
2033,
334,
4559,
29918,
1272,
29961,
1028,
9345,
29918,
262,
29918,
1885,
608,
29962,
13,
462,
363,
4559,
29918,
1272,
297,
2318,
29918,
1272,
29889,
5975,
580,
29962,
13,
9651,
1723,
13,
13,
9651,
363,
4559,
29918,
1272,
297,
2318,
29918,
1272,
29889,
5975,
7295,
13,
18884,
4559,
29918,
1272,
1839,
1028,
9345,
297,
4226,
2133,
7329,
2033,
353,
6588,
29918,
8945,
1891,
29918,
1028,
9345,
29918,
262,
29918,
949,
29879,
847,
4559,
29918,
1272,
29961,
1028,
9345,
29918,
262,
29918,
1885,
608,
29962,
13,
13,
9651,
396,
14350,
278,
848,
363,
1269,
4559,
13,
9651,
363,
4559,
29918,
9507,
29892,
4559,
29918,
1272,
297,
2318,
29918,
1272,
29889,
7076,
7295,
13,
18884,
2186,
29918,
2616,
276,
428,
29918,
19790,
353,
4559,
29918,
1272,
1839,
5258,
2159,
4226,
2133,
7329,
2033,
334,
320,
13,
462,
462,
3986,
4559,
29918,
1272,
1839,
1028,
9345,
297,
4226,
2133,
7329,
2033,
13,
18884,
934,
29889,
3539,
29898,
13,
462,
1678,
6634,
29873,
1642,
7122,
29898,
13,
462,
4706,
518,
11249,
29918,
9507,
29889,
6506,
703,
29899,
7176,
786,
29889,
2580,
613,
376,
4968,
851,
29898,
11249,
29918,
1272,
1839,
7827,
13623,
2033,
4638,
718,
13,
462,
4706,
518,
710,
29898,
11249,
29918,
1272,
29961,
1885,
608,
2314,
363,
2531,
608,
297,
20853,
267,
29962,
718,
13,
462,
4706,
518,
710,
29898,
11249,
29918,
1272,
1839,
5258,
2159,
4226,
2133,
7329,
2033,
4638,
718,
13,
462,
4706,
518,
710,
29898,
11249,
29918,
1272,
1839,
1028,
9345,
297,
4226,
2133,
7329,
2033,
4638,
718,
13,
462,
4706,
518,
710,
29898,
8394,
29918,
2616,
276,
428,
29918,
19790,
511,
2318,
29918,
978,
29962,
13,
462,
1678,
1723,
718,
6634,
29876,
29908,
13,
18884,
1723,
13,
13,
13,
1753,
903,
15807,
403,
29918,
5258,
29918,
2311,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
1125,
13,
1678,
822,
679,
29918,
2972,
29918,
978,
29898,
9507,
1125,
13,
4706,
4559,
29918,
978,
353,
10422,
29889,
6506,
877,
29899,
7176,
786,
29889,
2580,
742,
27255,
13,
13,
4706,
363,
10944,
297,
4559,
29918,
978,
29918,
535,
3259,
29901,
13,
9651,
565,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
3816,
29900,
29962,
1275,
4559,
29918,
978,
29901,
13,
18884,
736,
4559,
29918,
978,
29918,
535,
3259,
29961,
13506,
3816,
29896,
29962,
13,
13,
4706,
736,
376,
26690,
29908,
13,
13,
13,
1678,
6592,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
2580,
29908,
13,
13,
1678,
4226,
2133,
29918,
2972,
29918,
1272,
353,
2322,
8977,
29898,
8977,
29897,
13,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
2580,
29918,
12322,
1125,
13,
4706,
2318,
29918,
978,
353,
679,
29918,
2972,
29918,
978,
29898,
9507,
29897,
13,
13,
4706,
411,
1722,
29898,
2580,
29918,
12322,
718,
5591,
29908,
718,
10422,
29897,
408,
934,
29901,
13,
9651,
363,
474,
29892,
903,
297,
26985,
29898,
1445,
1125,
13,
18884,
1209,
13,
13,
4706,
4226,
2133,
29918,
2972,
29918,
1272,
29961,
2972,
29918,
978,
3816,
9507,
29962,
353,
474,
718,
29871,
29896,
13,
13,
1678,
396,
14350,
278,
848,
304,
263,
934,
13,
1678,
411,
1722,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
8945,
2133,
29918,
2371,
29889,
1372,
29894,
613,
525,
29893,
1495,
408,
934,
29901,
13,
4706,
363,
2318,
29918,
978,
29892,
2318,
29918,
1272,
297,
4226,
2133,
29918,
2972,
29918,
1272,
29889,
7076,
7295,
13,
13,
9651,
6588,
29918,
5258,
29918,
2311,
353,
2099,
4197,
2798,
363,
2302,
297,
2318,
29918,
1272,
29889,
5975,
580,
2314,
13,
13,
9651,
396,
14350,
278,
9066,
13,
9651,
934,
29889,
3539,
29898,
13,
18884,
6634,
29873,
1642,
7122,
29898,
13,
462,
1678,
6796,
17708,
613,
376,
11536,
7523,
29879,
613,
376,
12521,
276,
428,
383,
7168,
3108,
13,
18884,
1723,
718,
6634,
29876,
29908,
13,
9651,
1723,
13,
13,
9651,
363,
10422,
29892,
18139,
297,
2318,
29918,
1272,
29889,
7076,
7295,
13,
18884,
934,
29889,
3539,
29898,
13,
462,
1678,
6634,
29873,
1642,
7122,
29898,
13,
462,
4706,
518,
9507,
29889,
6506,
703,
29899,
7176,
786,
29889,
2580,
613,
376,
4968,
851,
29898,
2798,
29879,
511,
851,
29898,
12483,
482,
29918,
5258,
29918,
2311,
847,
18139,
511,
2318,
29918,
978,
29962,
13,
462,
1678,
1723,
718,
6634,
29876,
29908,
13,
18884,
1723,
13,
13,
13,
1753,
8147,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29892,
805,
9345,
29918,
262,
29918,
1885,
608,
29922,
8516,
29892,
20853,
267,
29922,
8516,
1125,
13,
1678,
396,
960,
896,
3867,
6273,
29892,
769,
372,
1818,
367,
805,
9345,
29918,
262,
4226,
2133,
13,
1678,
565,
805,
9345,
29918,
262,
29918,
1885,
608,
322,
20853,
267,
29901,
13,
4706,
903,
15807,
403,
29918,
1028,
9345,
29918,
262,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29892,
805,
9345,
29918,
262,
29918,
1885,
608,
29892,
20853,
267,
29897,
13,
1678,
1683,
29901,
13,
4706,
396,
20535,
403,
2729,
373,
3001,
3489,
2159,
13,
4706,
903,
15807,
403,
29918,
5258,
29918,
2311,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29897,
13,
13,
13,
1753,
903,
17158,
29918,
3752,
9192,
29898,
9507,
29892,
4226,
2133,
29918,
19790,
29892,
25173,
29918,
29879,
7093,
29918,
1445,
29892,
23376,
29918,
5479,
1125,
13,
1678,
4802,
9192,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
3752,
9192,
29908,
13,
13,
1678,
6592,
4262,
29918,
5325,
353,
5159,
13,
1678,
2988,
353,
5159,
13,
13,
1678,
1544,
29918,
6886,
353,
376,
11294,
1134,
29922,
3752,
29956,
335,
26401,
29922,
8159,
1024,
2433,
29966,
978,
16299,
4469,
17185,
29922,
265,
2337,
24214,
29922,
265,
376,
718,
320,
13,
462,
1678,
376,
7165,
292,
6678,
29922,
27525,
398,
3480,
403,
9065,
29922,
2696,
2927,
29922,
29900,
29892,
29900,
29892,
29900,
5272,
3306,
29922,
29900,
29892,
29900,
29892,
29900,
376,
718,
320,
13,
462,
1678,
376,
3752,
1469,
5983,
29922,
29966,
3069,
6508,
20690,
29966,
1445,
11903,
13,
13,
1678,
13128,
29918,
1445,
353,
5706,
29918,
8172,
29918,
9507,
17350,
7050,
1159,
13,
13,
1678,
2897,
29889,
5205,
877,
4117,
525,
718,
10422,
718,
9995,
891,
13689,
14180,
29896,
2804,
376,
22495,
25752,
29963,
29908,
426,
2158,
395,
29900,
10162,
1405,
9995,
718,
13128,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5205,
877,
2580,
13685,
525,
718,
13128,
29918,
1445,
718,
525,
525,
718,
10422,
29897,
13,
13,
1678,
363,
851,
392,
29892,
851,
392,
29918,
1807,
297,
518,
703,
29974,
613,
376,
29943,
29956,
4968,
4852,
29899,
613,
376,
29934,
29963,
1159,
5387,
13,
4706,
2897,
29889,
5205,
29898,
13,
9651,
525,
2580,
8504,
2531,
608,
24542,
448,
7052,
525,
718,
4226,
2133,
29918,
19790,
718,
13,
9651,
525,
448,
29875,
525,
718,
10422,
718,
525,
448,
29887,
525,
718,
25173,
29918,
29879,
7093,
29918,
1445,
718,
13,
9651,
525,
448,
16264,
448,
710,
392,
525,
718,
851,
392,
718,
13,
9651,
525,
1405,
525,
718,
10422,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
15300,
2580,
9527,
1495,
13,
4706,
1723,
13,
4706,
2897,
29889,
5205,
29898,
13,
9651,
525,
2580,
8504,
2531,
608,
24542,
448,
7052,
525,
718,
4226,
2133,
29918,
19790,
718,
13,
9651,
525,
448,
29875,
525,
718,
10422,
718,
525,
448,
29887,
525,
718,
25173,
29918,
29879,
7093,
29918,
1445,
718,
13,
9651,
525,
448,
16264,
448,
710,
392,
525,
718,
851,
392,
718,
525,
448,
29945,
29915,
718,
13,
9651,
525,
1405,
525,
718,
10422,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
17411,
29945,
29889,
2580,
9527,
1495,
13,
4706,
1723,
13,
4706,
2897,
29889,
5205,
29898,
13,
9651,
525,
2580,
8504,
2531,
608,
24542,
448,
7052,
525,
718,
4226,
2133,
29918,
19790,
718,
13,
9651,
525,
448,
29875,
525,
718,
10422,
718,
525,
448,
29887,
525,
718,
25173,
29918,
29879,
7093,
29918,
1445,
718,
13,
9651,
525,
448,
16264,
448,
710,
392,
525,
718,
851,
392,
718,
525,
448,
29941,
29915,
718,
13,
9651,
525,
1405,
525,
718,
10422,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
17411,
29941,
29889,
2580,
9527,
1495,
13,
4706,
1723,
13,
13,
4706,
6592,
4262,
29918,
5325,
29889,
4397,
29898,
9507,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
15300,
2580,
9527,
8785,
13,
4706,
6592,
4262,
29918,
5325,
29889,
4397,
29898,
9507,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
17411,
29945,
29889,
2580,
9527,
8785,
13,
4706,
6592,
4262,
29918,
5325,
29889,
4397,
29898,
9507,
29889,
6506,
12839,
2580,
742,
17411,
29915,
718,
851,
392,
29918,
1807,
718,
17411,
29941,
29889,
2580,
9527,
8785,
13,
13,
1678,
396,
14806,
6592,
9527,
29879,
304,
4802,
9192,
29879,
322,
788,
5702,
2988,
13,
1678,
363,
934,
297,
6592,
4262,
29918,
5325,
29901,
13,
4706,
2897,
29889,
5205,
877,
2580,
13685,
525,
718,
934,
718,
525,
525,
718,
934,
29897,
13,
4706,
4802,
9192,
29918,
1445,
353,
4802,
9192,
29918,
12322,
718,
5591,
29908,
718,
934,
29889,
5451,
11219,
1495,
14352,
29896,
1822,
6506,
12839,
2580,
9527,
742,
15300,
29890,
29893,
1495,
13,
4706,
2897,
29889,
5205,
877,
2580,
9527,
1762,
6970,
29956,
335,
525,
718,
934,
718,
525,
525,
718,
25173,
29918,
29879,
7093,
29918,
1445,
718,
525,
525,
718,
4802,
9192,
29918,
1445,
29897,
13,
13,
4706,
16256,
29918,
2324,
353,
1544,
29918,
6886,
13,
13,
4706,
565,
11663,
29934,
29963,
29889,
29890,
29893,
29908,
297,
4802,
9192,
29918,
1445,
470,
11663,
29934,
29963,
29899,
29945,
29889,
29890,
29893,
29908,
297,
4802,
9192,
29918,
1445,
470,
11663,
29934,
29963,
29899,
29941,
29889,
29890,
29893,
29908,
297,
4802,
9192,
29918,
1445,
29901,
13,
9651,
16256,
29918,
2324,
353,
16256,
29918,
2324,
29889,
6506,
703,
10052,
403,
9065,
29922,
2696,
613,
376,
10052,
403,
9065,
29922,
265,
1159,
13,
13,
4706,
934,
29918,
6500,
3871,
353,
934,
29889,
5451,
11974,
1159,
14352,
29896,
29962,
13,
13,
4706,
396,
3617,
278,
4559,
2983,
13,
4706,
4559,
29918,
978,
353,
934,
29918,
6500,
3871,
13,
4706,
4559,
29918,
978,
353,
4559,
29918,
978,
29889,
6506,
17350,
29890,
29893,
613,
376,
2564,
6506,
703,
29918,
613,
376,
376,
467,
6506,
703,
29899,
613,
376,
16521,
13,
13,
4706,
396,
2567,
1925,
278,
4559,
1024,
297,
13,
4706,
16256,
29918,
2324,
353,
16256,
29918,
2324,
29889,
6506,
28945,
978,
28341,
4559,
29918,
978,
467,
6506,
28945,
1445,
28341,
934,
29918,
6500,
3871,
29897,
13,
13,
4706,
565,
23376,
29918,
5479,
29901,
13,
9651,
16256,
29918,
2324,
353,
16256,
29918,
2324,
29889,
6506,
28945,
3069,
6508,
28341,
23376,
29918,
5479,
29897,
13,
13,
4706,
2988,
29889,
4397,
29898,
21962,
29918,
2324,
29897,
13,
13,
1678,
396,
15154,
599,
278,
6592,
4262,
322,
13128,
2066,
13,
1678,
3349,
29918,
5325,
29898,
2580,
4262,
29918,
5325,
29892,
13128,
29918,
1445,
29897,
13,
13,
1678,
396,
20025,
278,
2988,
577,
896,
526,
297,
278,
1797,
310,
383,
29956,
29892,
390,
29963,
29892,
383,
29956,
29945,
29892,
390,
29963,
29871,
29945,
29892,
383,
29956,
29941,
29892,
390,
29963,
29941,
13,
1678,
2988,
29889,
6605,
580,
13,
1678,
2186,
29918,
4965,
353,
518,
13,
4706,
2988,
29961,
29906,
1402,
29871,
396,
383,
29893,
13,
4706,
2988,
29961,
29945,
1402,
29871,
396,
390,
29894,
13,
4706,
2988,
29961,
29896,
1402,
29871,
396,
383,
29893,
29871,
29945,
13,
4706,
2988,
29961,
29946,
1402,
29871,
396,
390,
29894,
29871,
29945,
13,
4706,
2988,
29961,
29900,
1402,
29871,
396,
383,
29893,
29871,
29941,
13,
4706,
2988,
29961,
29941,
1402,
29871,
396,
390,
29894,
29871,
29941,
13,
1678,
4514,
13,
13,
1678,
736,
2186,
29918,
4965,
13,
13,
13,
1753,
5706,
29918,
3752,
9192,
29879,
29898,
27433,
29918,
29879,
7093,
29918,
9507,
29892,
9717,
29892,
23376,
29918,
5479,
1125,
13,
1678,
396,
3824,
679,
278,
4226,
2133,
13879,
13,
1678,
4226,
2133,
29918,
17028,
943,
353,
6571,
13,
13,
1678,
411,
1722,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
8945,
2133,
29918,
2371,
29889,
1372,
29894,
1159,
408,
934,
29901,
13,
4706,
363,
474,
29892,
1196,
297,
26985,
29898,
1445,
1125,
13,
9651,
565,
474,
2804,
29871,
29900,
29901,
13,
18884,
4559,
29918,
978,
29892,
334,
3383,
4226,
2133,
29918,
19790,
29892,
903,
353,
1196,
29889,
5451,
580,
13,
18884,
4226,
2133,
29918,
17028,
943,
29961,
11249,
29918,
978,
29962,
353,
4226,
2133,
29918,
19790,
13,
13,
1678,
6592,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
2580,
29908,
13,
1678,
4802,
9192,
29918,
12322,
353,
14861,
1177,
29918,
4571,
26282,
18929,
718,
376,
3752,
9192,
29908,
13,
13,
1678,
6389,
353,
5159,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
2580,
29918,
12322,
1125,
13,
4706,
4559,
29918,
978,
353,
10422,
29889,
5451,
11974,
1159,
14352,
29896,
1822,
6506,
703,
29899,
7176,
786,
29889,
2580,
613,
20569,
13,
13,
4706,
6389,
29889,
4397,
29898,
13,
9651,
518,
13,
18884,
6592,
29918,
12322,
718,
5591,
29908,
718,
10422,
29892,
13,
18884,
4226,
2133,
29918,
17028,
943,
29961,
11249,
29918,
978,
1402,
13,
18884,
25173,
29918,
29879,
7093,
29918,
9507,
29892,
13,
18884,
23376,
29918,
5479,
13,
9651,
4514,
13,
4706,
1723,
13,
13,
1678,
411,
28625,
29898,
28993,
29897,
408,
11565,
29901,
13,
4706,
599,
29918,
4965,
353,
11565,
29889,
8508,
1958,
7373,
17158,
29918,
3752,
9192,
29892,
6389,
29897,
13,
13,
1678,
396,
14350,
278,
2988,
304,
263,
934,
13,
1678,
411,
1722,
29898,
3752,
9192,
29918,
12322,
718,
5591,
4965,
29889,
3945,
613,
525,
29893,
1495,
408,
934,
29901,
13,
4706,
363,
8783,
29918,
4965,
297,
599,
29918,
4965,
29901,
13,
9651,
363,
1544,
297,
8783,
29918,
4965,
29901,
13,
18884,
934,
29889,
3539,
29898,
2324,
718,
6634,
29876,
1159,
13,
13,
13,
1753,
5941,
29918,
11851,
3842,
7295,
13,
1678,
396,
15154,
278,
17151,
2168,
322,
3514,
17525,
13,
1678,
364,
4378,
929,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
15450,
2168,
1159,
13,
1678,
364,
4378,
929,
29898,
29032,
29918,
4571,
26282,
18929,
718,
376,
13445,
1159,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
1678,
6389,
353,
6088,
29918,
5085,
29898,
5085,
29897,
13,
1678,
3142,
353,
6389,
29889,
2271,
13,
1678,
4138,
29918,
978,
353,
6389,
29889,
12083,
29918,
978,
13,
1678,
9717,
353,
6389,
29889,
28993,
13,
1678,
25173,
29918,
29879,
7093,
29918,
1445,
353,
6389,
29889,
27433,
29918,
29879,
7093,
29918,
1445,
13,
13,
1678,
1923,
29918,
978,
353,
6389,
29889,
2974,
29918,
978,
13,
1678,
805,
9345,
29918,
262,
29918,
1885,
608,
353,
6389,
29889,
1028,
9345,
29918,
262,
29918,
1885,
608,
13,
1678,
20853,
267,
353,
6389,
29889,
1885,
290,
267,
718,
518,
1028,
9345,
29918,
262,
29918,
1885,
608,
29962,
13,
1678,
4559,
29918,
978,
29918,
535,
3259,
29918,
9507,
353,
6389,
29889,
11249,
29918,
978,
29918,
535,
3259,
29918,
9507,
13,
13,
1678,
7595,
29918,
7529,
353,
426,
13,
4706,
525,
15450,
29945,
2396,
851,
29898,
5085,
29889,
15547,
29918,
2848,
511,
13,
4706,
525,
15450,
29941,
2396,
851,
29898,
5085,
29889,
15547,
29918,
2848,
511,
13,
4706,
525,
1195,
1144,
2396,
851,
29898,
5085,
29889,
1195,
29918,
7851,
511,
13,
4706,
525,
3317,
1144,
2396,
851,
29898,
5085,
29889,
3317,
29918,
7851,
511,
13,
4706,
525,
2248,
2396,
6389,
29889,
2248,
13,
1678,
500,
13,
13,
1678,
23376,
29918,
5479,
353,
1923,
29918,
978,
718,
4138,
29918,
978,
565,
1923,
29918,
978,
1683,
6629,
13,
13,
1678,
5534,
14861,
1177,
29918,
4571,
26282,
18929,
13,
1678,
14861,
1177,
29918,
4571,
26282,
18929,
353,
5591,
5184,
29914,
479,
2696,
6294,
3626,
284,
12975,
718,
4138,
29918,
978,
718,
5591,
29908,
13,
13,
1678,
396,
960,
2183,
263,
11301,
934,
29892,
769,
871,
5142,
278,
6743,
297,
278,
11301,
934,
13,
1678,
4559,
29918,
978,
29918,
535,
3259,
29892,
10944,
267,
353,
1303,
29918,
11249,
29918,
978,
29918,
535,
3259,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29918,
9507,
29897,
13,
13,
1678,
2048,
29918,
12322,
29918,
23905,
580,
13,
1678,
5142,
29918,
1272,
29898,
2271,
29892,
10944,
267,
29897,
13,
1678,
17151,
29918,
328,
481,
2153,
29898,
28993,
29897,
13,
1678,
7595,
29898,
2520,
29918,
7529,
29892,
4559,
29918,
978,
29918,
535,
3259,
29892,
9717,
29897,
13,
1678,
8147,
29918,
8945,
2133,
29918,
2371,
29898,
11249,
29918,
978,
29918,
535,
3259,
29892,
805,
9345,
29918,
262,
29918,
1885,
608,
29892,
20853,
267,
29897,
13,
1678,
5706,
29918,
3752,
9192,
29879,
29898,
27433,
29918,
29879,
7093,
29918,
1445,
29892,
9717,
29892,
23376,
29918,
5479,
29897,
13,
1678,
5941,
29918,
11851,
3842,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
2314,
13,
2
] |
phase/jump_ge.py | ryos36/retro-for-FPGA | 0 | 133973 | class JUMP_GE:
def __init__(self, stack):
self.phase = 0
self.ip = 0
self.stack = stack
self.a = 0
def exec(self, ip, data):
if (self.phase == 0):
self.ip = ip + 1
self.a = self.stack.pop()
self.phase = 1
return False
elif (self.phase == 1):
b = self.stack.pop()
if b > self.a:
self.phase = 2
return False
else:
self.phase = 0
return True
elif (self.phase == 2):
self.ip = data - 1
self.phase = 3
return False
else:
assert(self.phase == 3)
self.phase = 0
return True
| [
1,
770,
435,
29965,
3580,
29918,
1692,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5096,
1125,
13,
4706,
1583,
29889,
21646,
353,
29871,
29900,
13,
4706,
1583,
29889,
666,
353,
29871,
29900,
13,
4706,
1583,
29889,
1429,
353,
5096,
13,
4706,
1583,
29889,
29874,
353,
29871,
29900,
13,
13,
1678,
822,
2279,
29898,
1311,
29892,
10377,
29892,
848,
1125,
13,
4706,
565,
313,
1311,
29889,
21646,
1275,
29871,
29900,
1125,
13,
9651,
1583,
29889,
666,
353,
10377,
718,
29871,
29896,
13,
9651,
1583,
29889,
29874,
353,
1583,
29889,
1429,
29889,
7323,
580,
13,
9651,
1583,
29889,
21646,
353,
29871,
29896,
13,
9651,
736,
7700,
13,
4706,
25342,
313,
1311,
29889,
21646,
1275,
29871,
29896,
1125,
13,
9651,
289,
353,
1583,
29889,
1429,
29889,
7323,
580,
13,
9651,
565,
289,
1405,
1583,
29889,
29874,
29901,
13,
18884,
1583,
29889,
21646,
353,
29871,
29906,
13,
18884,
736,
7700,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
21646,
353,
29871,
29900,
13,
18884,
736,
5852,
13,
4706,
25342,
313,
1311,
29889,
21646,
1275,
29871,
29906,
1125,
13,
9651,
1583,
29889,
666,
353,
848,
448,
29871,
29896,
13,
9651,
1583,
29889,
21646,
353,
29871,
29941,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
4974,
29898,
1311,
29889,
21646,
1275,
29871,
29941,
29897,
13,
9651,
1583,
29889,
21646,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
2
] |
nrw/viersen.py | risklayer/corona-landkreis-crawler | 12 | 1601807 | <filename>nrw/viersen.py
#!/usr/bin/python3
from botbase import *
_viersen_cc = re.compile(r"([0-9.]+) neue Infektionen")
_viersen_s = re.compile(r"([0-9.]+|\w+) Menschen werden stationär behandelt", re.U)
_viersen_i = re.compile(r"([0-9.]+|\w+) befinden sich auf der Intensiv", re.U)
_viersen_q = re.compile(r"([0-9.]+) Kontaktpersonen befinden")
def viersen(sheets):
soup = get_soup("https://www.presse-service.de/meldungen.aspx?ps_id=1381")
articles = soup.find(class_="ps_meldungsliste").findAll("li")
#print(*[a.get_text() for a in articles], sep"\n")
article = next(a for a in articles if "Sieben-Tage-Inzidenz" in a.get_text() or "Neuinfektionen" in a.get_text())
if not today().strftime("%d.%m.%Y") in article.get_text(): raise NotYetAvailableException("Viersen noch alt: "+article.get_text().strip().split("\n")[0])
url = urljoin("https://www.presse-service.de/meldungen.aspx?ps_id=1381", article.find("a")["href"])
print("Getting", url)
assert url
soup = get_soup(url)
main = soup.find(class_="ps_content")
text = main.get_text(" ").strip()
#print(text)
table = next(t for t in main.findAll("table") if "bestätigte Fälle" in t.get_text())
rows = [[x.get_text().strip() for x in y] for y in table.findAll("tr")]
#print(*rows, sep="\n")
assert "Gesamt" in rows[-1][1]
assert "bestätigte Fälle" in rows[0][3]
#assert "Genesene" in rows[0][7]
assert "verstorben" in rows[0][7]
#c, g, d = map(force_int, [rows[-1][3], rows[-1][7], rows[-1][9]])
c, d = map(force_int, [rows[-1][3], rows[-1][7]])
g = None
cc = force_int(_viersen_cc.search(text).group(1))
s, i, q = None, None, None
m = _viersen_q.search(text)
if m: q = force_int(m.group(1)) + c - d - g
m = _viersen_s.search(text)
if m: s = force_int(m.group(1))
m = _viersen_i.search(text)
if m: i = force_int(m.group(1))
update(sheets, 5166, c=c, cc=cc, d=d, g=g, q=q, s=s, i=i, sig="Bot", ignore_delta="mon")
return True
schedule.append(Task(15, 30, 18, 35, 360, viersen, 5166))
if __name__ == '__main__': viersen(googlesheets())
| [
1,
529,
9507,
29958,
29876,
13975,
29914,
1403,
414,
264,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
29941,
13,
3166,
9225,
3188,
1053,
334,
13,
13,
29918,
1403,
414,
264,
29918,
617,
353,
337,
29889,
12198,
29898,
29878,
29908,
4197,
29900,
29899,
29929,
5586,
28135,
16828,
512,
1725,
23668,
1159,
13,
29918,
1403,
414,
264,
29918,
29879,
353,
337,
29889,
12198,
29898,
29878,
29908,
4197,
29900,
29899,
29929,
5586,
29974,
4295,
29893,
28135,
14922,
3678,
5073,
1215,
2306,
392,
2152,
613,
337,
29889,
29965,
29897,
13,
29918,
1403,
414,
264,
29918,
29875,
353,
337,
29889,
12198,
29898,
29878,
29908,
4197,
29900,
29899,
29929,
5586,
29974,
4295,
29893,
28135,
12331,
264,
2160,
1622,
589,
3159,
575,
440,
613,
337,
29889,
29965,
29897,
13,
29918,
1403,
414,
264,
29918,
29939,
353,
337,
29889,
12198,
29898,
29878,
29908,
4197,
29900,
29899,
29929,
5586,
28135,
11587,
5867,
10532,
264,
12331,
264,
1159,
13,
13,
1753,
3516,
414,
264,
29898,
19360,
1125,
13,
1678,
22300,
353,
679,
29918,
29879,
1132,
703,
991,
597,
1636,
29889,
4569,
344,
29899,
5509,
29889,
311,
29914,
29885,
2495,
2469,
29889,
6307,
29973,
567,
29918,
333,
29922,
29896,
29941,
29947,
29896,
1159,
13,
1678,
7456,
353,
22300,
29889,
2886,
29898,
1990,
29918,
543,
567,
29918,
29885,
2495,
686,
2536,
2488,
2564,
2886,
3596,
703,
492,
1159,
13,
1678,
396,
2158,
10456,
29961,
29874,
29889,
657,
29918,
726,
580,
363,
263,
297,
7456,
1402,
16345,
26732,
29876,
1159,
13,
1678,
4274,
353,
2446,
29898,
29874,
363,
263,
297,
7456,
565,
376,
29903,
27507,
29899,
29911,
482,
29899,
797,
29920,
3615,
29920,
29908,
297,
263,
29889,
657,
29918,
726,
580,
470,
376,
8139,
29884,
262,
1725,
23668,
29908,
297,
263,
29889,
657,
29918,
726,
3101,
13,
1678,
565,
451,
9826,
2141,
710,
615,
603,
11702,
29881,
29889,
29995,
29885,
29889,
29995,
29979,
1159,
297,
4274,
29889,
657,
29918,
726,
7295,
12020,
2216,
29979,
300,
27635,
2451,
703,
29963,
4285,
264,
5440,
5272,
29901,
15691,
7914,
29889,
657,
29918,
726,
2141,
17010,
2141,
5451,
14182,
29876,
1159,
29961,
29900,
2314,
13,
1678,
3142,
353,
3142,
7122,
703,
991,
597,
1636,
29889,
4569,
344,
29899,
5509,
29889,
311,
29914,
29885,
2495,
2469,
29889,
6307,
29973,
567,
29918,
333,
29922,
29896,
29941,
29947,
29896,
613,
4274,
29889,
2886,
703,
29874,
1159,
3366,
12653,
20068,
13,
1678,
1596,
703,
2577,
1259,
613,
3142,
29897,
13,
1678,
4974,
3142,
13,
1678,
22300,
353,
679,
29918,
29879,
1132,
29898,
2271,
29897,
13,
1678,
1667,
353,
22300,
29889,
2886,
29898,
1990,
29918,
543,
567,
29918,
3051,
1159,
13,
1678,
1426,
353,
1667,
29889,
657,
29918,
726,
703,
376,
467,
17010,
580,
13,
1678,
396,
2158,
29898,
726,
29897,
13,
1678,
1591,
353,
2446,
29898,
29873,
363,
260,
297,
1667,
29889,
2886,
3596,
703,
2371,
1159,
565,
376,
13318,
3003,
15085,
383,
23637,
29908,
297,
260,
29889,
657,
29918,
726,
3101,
13,
1678,
4206,
353,
5519,
29916,
29889,
657,
29918,
726,
2141,
17010,
580,
363,
921,
297,
343,
29962,
363,
343,
297,
1591,
29889,
2886,
3596,
703,
509,
13531,
13,
1678,
396,
2158,
10456,
5727,
29892,
16345,
543,
29905,
29876,
1159,
13,
1678,
4974,
376,
29954,
267,
8035,
29908,
297,
4206,
14352,
29896,
3816,
29896,
29962,
13,
1678,
4974,
376,
13318,
3003,
15085,
383,
23637,
29908,
297,
4206,
29961,
29900,
3816,
29941,
29962,
13,
1678,
396,
9294,
376,
15462,
267,
1600,
29908,
297,
4206,
29961,
29900,
3816,
29955,
29962,
13,
1678,
4974,
376,
369,
28957,
1785,
29908,
297,
4206,
29961,
29900,
3816,
29955,
29962,
13,
1678,
396,
29883,
29892,
330,
29892,
270,
353,
2910,
29898,
10118,
29918,
524,
29892,
518,
5727,
14352,
29896,
3816,
29941,
1402,
4206,
14352,
29896,
3816,
29955,
1402,
4206,
14352,
29896,
3816,
29929,
24960,
13,
1678,
274,
29892,
270,
353,
2910,
29898,
10118,
29918,
524,
29892,
518,
5727,
14352,
29896,
3816,
29941,
1402,
4206,
14352,
29896,
3816,
29955,
24960,
13,
1678,
330,
353,
6213,
13,
1678,
21759,
353,
4889,
29918,
524,
7373,
1403,
414,
264,
29918,
617,
29889,
4478,
29898,
726,
467,
2972,
29898,
29896,
876,
13,
1678,
269,
29892,
474,
29892,
3855,
353,
6213,
29892,
6213,
29892,
6213,
13,
1678,
286,
353,
903,
1403,
414,
264,
29918,
29939,
29889,
4478,
29898,
726,
29897,
13,
1678,
565,
286,
29901,
3855,
353,
4889,
29918,
524,
29898,
29885,
29889,
2972,
29898,
29896,
876,
718,
274,
448,
270,
448,
330,
13,
1678,
286,
353,
903,
1403,
414,
264,
29918,
29879,
29889,
4478,
29898,
726,
29897,
13,
1678,
565,
286,
29901,
269,
353,
4889,
29918,
524,
29898,
29885,
29889,
2972,
29898,
29896,
876,
13,
1678,
286,
353,
903,
1403,
414,
264,
29918,
29875,
29889,
4478,
29898,
726,
29897,
13,
1678,
565,
286,
29901,
474,
353,
4889,
29918,
524,
29898,
29885,
29889,
2972,
29898,
29896,
876,
13,
1678,
2767,
29898,
19360,
29892,
29871,
29945,
29896,
29953,
29953,
29892,
274,
29922,
29883,
29892,
21759,
29922,
617,
29892,
270,
29922,
29881,
29892,
330,
29922,
29887,
29892,
3855,
29922,
29939,
29892,
269,
29922,
29879,
29892,
474,
29922,
29875,
29892,
4365,
543,
29933,
327,
613,
11455,
29918,
4181,
543,
3712,
1159,
13,
1678,
736,
5852,
13,
13,
816,
11272,
29889,
4397,
29898,
5398,
29898,
29896,
29945,
29892,
29871,
29941,
29900,
29892,
29871,
29896,
29947,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29900,
29892,
3516,
414,
264,
29892,
29871,
29945,
29896,
29953,
29953,
876,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
3516,
414,
264,
29898,
1484,
468,
793,
354,
1691,
3101,
13,
2
] |
alexaskillz.py | willchis/alexaskillz | 0 | 65182 | import os
import time
import urllib, json
from random import randint
from flask import Flask
from flask_ask import Ask, statement, question
app = Flask(__name__)
ask = Ask(app, '/')
MAGIC_SEAWEED_KEY = 'e96ca9b1f03a627aaab136eafe4f83ee'
SPOT_ID = '1449'
@ask.launch
def launched():
return question("This is a surf forecast skill for rest bay, porth call, South Wales. Would you like today's surf report?").reprompt("I didn't get that. Would you like the current conditions?")
@ask.intent('YesOrNoFIrstIntent', mapping = { 'answer': 'yesorno' })
def yes_or_no(answer):
statement('Okay')
if (answer == 'yes'):
return surf_report('today')
else:
return
@ask.intent('SwellIntent', mapping = { 'report_time': 'timeofday' })
def current_surf(report_time):
api_url = 'http://magicseaweed.com/api/%s/forecast/?spot_id=%s&fields=timestamp,swell.minBreakingHeight,swell.maxBreakingHeight,wind.speed, wind.compassDirection' % (MAGIC_SEAWEED_KEY, SPOT_ID)
print 'Calling Magic Seaweed via API URL: ' + api_url
json_reponse = read_from_url(api_url)
unix_now = time.time()
time_difference = 0
closest_time = json_reponse[0]
for item in json_reponse:
item_time_difference = abs(item['timestamp'] - unix_now)
if (item_time_difference <= time_difference):
time_difference = item_time_difference
closest_time = item
min_swell = closest_time['swell']['minBreakingHeight']
max_swell = closest_time['swell']['maxBreakingHeight']
wind_speed = closest_time['wind']['speed']
print 'Got swell heights: %d to %d ft and wind speed %d' % (min_swell, max_swell, wind_speed)
return statement('Currently the swell height is between %d and %d foot at rest bay. The wind speed is %d miles per hour.' \
% (min_swell, max_swell, wind_speed))
@ask.intent('BuildStatusIntent', mapping = { 'plan': 'Plan' })
def build_status(plan):
# Use Bamboo API to get build status(es) or trigger build etc.
return statement('The latest %s build is red, with 4 failing tests.' % plan)
@ask.intent('CurrentAdvertIntent')
def current_advert():
# E.g. match advert based on DAR info/IP and return related promo and alexa 'card'
return statement('That was the new Budweiser summer cider, available summer 2017. Visit the Alexa app for a free sample.') \
.standard_card(title='Budweiser Summer Cider', text='Claim your free sample..', large_image_url='https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Bud_and_Budvar.jpg/1200px-Bud_and_Budvar.jpg')
#<EMAIL>('GiveRandomInfo')
def politics_fact():
#TODO add headers to ensure wiki api allows access
title = get_random_politics_title()
statement(title.encode('utf-8'))
title = urllib.quote(title) # encode to include in url
wiki_api = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles='
json_reponse = read_from_url(wiki_api + title)
introduction = ''
try:
pages = json_reponse['query']['pages']
for key in pages.keys():
print 'wiki page ref: ' + key
introduction = pages[key]['extract']
except:
print 'Error thrown when using title: ' + title
politics_fact()
return
return statement(introduction.encode('utf-8'))
def read_from_url(url):
response = urllib.urlopen(url)
return json.loads(response.read())
def get_random_politics_title():
options = ['Anarchism',
'Anarcho-capitalism',
'Anarcho-primitivism',
'Anarcho-syndicalism',
'Anarchist communism',
'Anti-communism',
'Antidisestablishmentarianism',
'Asian values',
'Authoritarianism',
'Bioregional democracy',
'Black populism',
'Black supremacy',
'Bolivarian Revolution',
'Capitalism',
'Christian democracy',
'Christian socialism',
'Classical liberalism',
'Classical republicanism',
'Collectivism',
'Communism',
'Communitarianism',
'Conservatism',
'Corporatocracy',
'Demarchy',
'Democracy (varieties)',
'Democratic egalitarianism',
'Democratic peace theory',
'Democratic socialism',
'Democratic transhumanism',
'Eco-socialism',
'Egalitarianism',
'Fascism',
'Federalism',
'Green anarchism',
'Green politics',
'Green syndicalism',
'Hindu nationalism',
'Individualist anarchism',
'Integral humanism',
'Islamism',
'Isocracy',
'Kemalist ideology',
'Leftism',
'Liberalism',
'Libertarianism',
'Libertarian socialism',
'Localism',
'Majoritarianism',
'Marxism',
'Marxism-Leninism',
'Marxist philosophy',
'Meritocracy',
'Minarchism',
'Minoritarianism',
'Miscegenation',
'Moderate Libertarianism','Monarchism','Nationalism','National Socialism','Neoliberalism','Pacifism','Paleolibertarianism','Patriotism','Political symbolism','Panislamism','Peronism','Populism','Post-Communism','Progressivism','Putinism','Racial purity','Racial segregation','Racialism','Radical centrism','Radical liberalism','Rationalism','Republicanism','Screen theory','Slavophile','Small-l libertarianism','Social Credit','Social democracy','Socialism','Social liberalism','Social philosophy','Sphere of influence','Stalinism','Thatcherism','Third Position','Totalitarianism','Tribalism','Trotskyism',
'Utilitarianism' ]
return options[randint(0, len(options) - 1)]
if __name__ == '__main__':
#politics_fact()
current_surf('today')
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
| [
1,
1053,
2897,
13,
5215,
931,
13,
5215,
3142,
1982,
29892,
4390,
13,
3166,
4036,
1053,
20088,
524,
13,
13,
3166,
29784,
1053,
2379,
1278,
13,
3166,
29784,
29918,
1278,
1053,
26579,
29892,
3229,
29892,
1139,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
1278,
353,
26579,
29898,
932,
29892,
8207,
1495,
13,
13,
1529,
29954,
2965,
29918,
1660,
29909,
8851,
3352,
29918,
10818,
353,
525,
29872,
29929,
29953,
1113,
29929,
29890,
29896,
29888,
29900,
29941,
29874,
29953,
29906,
29955,
7340,
370,
29896,
29941,
29953,
11248,
1725,
29946,
29888,
29947,
29941,
3905,
29915,
13,
5550,
2891,
29918,
1367,
353,
525,
29896,
29946,
29946,
29929,
29915,
13,
13,
29992,
1278,
29889,
15343,
13,
1753,
15241,
7295,
13,
1678,
736,
1139,
703,
4013,
338,
263,
1190,
29888,
29821,
579,
19911,
363,
1791,
23041,
29892,
1277,
386,
1246,
29892,
4275,
13706,
29889,
29871,
10878,
366,
763,
9826,
29915,
29879,
1190,
29888,
3461,
29973,
2564,
3445,
456,
415,
703,
29902,
3282,
29915,
29873,
679,
393,
29889,
10878,
366,
763,
278,
1857,
5855,
29973,
1159,
13,
13,
29992,
1278,
29889,
14029,
877,
8241,
2816,
3782,
3738,
29878,
303,
10286,
742,
10417,
353,
426,
525,
12011,
2396,
525,
3582,
16378,
29915,
5615,
13,
1753,
4874,
29918,
272,
29918,
1217,
29898,
12011,
1125,
13,
1678,
3229,
877,
20434,
388,
1495,
13,
1678,
565,
313,
12011,
1275,
525,
3582,
29374,
259,
13,
4706,
736,
1190,
29888,
29918,
12276,
877,
27765,
1495,
13,
1678,
1683,
29901,
13,
4706,
736,
13,
13,
29992,
1278,
29889,
14029,
877,
29903,
5872,
10286,
742,
10417,
353,
426,
525,
12276,
29918,
2230,
2396,
525,
2230,
974,
3250,
29915,
5615,
13,
1753,
1857,
29918,
7610,
29888,
29898,
12276,
29918,
2230,
1125,
13,
13,
1678,
7882,
29918,
2271,
353,
525,
1124,
597,
11082,
293,
344,
29874,
705,
287,
29889,
510,
29914,
2754,
22584,
29879,
29914,
1079,
4384,
13401,
17500,
29918,
333,
16328,
29879,
29987,
9621,
29922,
16394,
29892,
2774,
514,
29889,
1195,
20130,
5086,
7011,
29892,
2774,
514,
29889,
3317,
20130,
5086,
7011,
29892,
14800,
29889,
19322,
29892,
8805,
29889,
2388,
465,
21602,
29915,
1273,
313,
1529,
29954,
2965,
29918,
1660,
29909,
8851,
3352,
29918,
10818,
29892,
10937,
2891,
29918,
1367,
29897,
13,
1678,
1596,
525,
5594,
292,
26494,
14070,
705,
287,
3025,
3450,
3988,
29901,
525,
718,
7882,
29918,
2271,
13,
1678,
4390,
29918,
276,
1713,
353,
1303,
29918,
3166,
29918,
2271,
29898,
2754,
29918,
2271,
29897,
13,
13,
1678,
28167,
29918,
3707,
353,
931,
29889,
2230,
580,
13,
1678,
931,
29918,
29881,
17678,
353,
29871,
29900,
13,
1678,
21438,
29918,
2230,
353,
4390,
29918,
276,
1713,
29961,
29900,
29962,
13,
13,
1678,
363,
2944,
297,
4390,
29918,
276,
1713,
29901,
13,
4706,
2944,
29918,
2230,
29918,
29881,
17678,
353,
6425,
29898,
667,
1839,
16394,
2033,
448,
28167,
29918,
3707,
29897,
13,
13,
4706,
565,
313,
667,
29918,
2230,
29918,
29881,
17678,
5277,
931,
29918,
29881,
17678,
1125,
13,
9651,
931,
29918,
29881,
17678,
353,
2944,
29918,
2230,
29918,
29881,
17678,
13,
9651,
21438,
29918,
2230,
353,
2944,
13,
13,
1678,
1375,
29918,
2774,
514,
353,
21438,
29918,
2230,
1839,
2774,
514,
16215,
1195,
20130,
5086,
7011,
2033,
13,
1678,
4236,
29918,
2774,
514,
353,
21438,
29918,
2230,
1839,
2774,
514,
16215,
3317,
20130,
5086,
7011,
2033,
13,
1678,
8805,
29918,
19322,
353,
21438,
29918,
2230,
1839,
14800,
16215,
19322,
2033,
13,
13,
1678,
1596,
525,
29954,
327,
2381,
514,
3171,
29879,
29901,
1273,
29881,
304,
1273,
29881,
11791,
322,
8805,
6210,
1273,
29881,
29915,
1273,
313,
1195,
29918,
2774,
514,
29892,
4236,
29918,
2774,
514,
29892,
8805,
29918,
19322,
29897,
13,
1678,
736,
3229,
877,
7583,
368,
278,
2381,
514,
3171,
338,
1546,
1273,
29881,
322,
1273,
29881,
3661,
472,
1791,
23041,
29889,
450,
8805,
6210,
338,
1273,
29881,
7800,
639,
7234,
6169,
320,
13,
4706,
1273,
313,
1195,
29918,
2774,
514,
29892,
4236,
29918,
2774,
514,
29892,
8805,
29918,
19322,
876,
13,
13,
13,
13,
29992,
1278,
29889,
14029,
877,
8893,
5709,
10286,
742,
10417,
353,
426,
525,
9018,
2396,
525,
20334,
29915,
5615,
13,
1753,
2048,
29918,
4882,
29898,
9018,
1125,
13,
1678,
396,
4803,
350,
314,
833,
29877,
3450,
304,
679,
2048,
4660,
29898,
267,
29897,
470,
7135,
2048,
2992,
29889,
13,
1678,
736,
3229,
877,
1576,
9281,
1273,
29879,
2048,
338,
2654,
29892,
411,
29871,
29946,
17581,
6987,
6169,
1273,
3814,
29897,
13,
13,
13,
29992,
1278,
29889,
14029,
877,
7583,
3253,
1765,
10286,
1495,
13,
1753,
1857,
29918,
328,
1765,
7295,
13,
1678,
396,
382,
29889,
29887,
29889,
1993,
18811,
2729,
373,
360,
1718,
5235,
29914,
5690,
322,
736,
4475,
2504,
29877,
322,
263,
2506,
29874,
525,
7543,
29915,
13,
1678,
736,
3229,
877,
7058,
471,
278,
716,
7038,
705,
7608,
11801,
274,
1241,
29892,
3625,
11801,
29871,
29906,
29900,
29896,
29955,
29889,
29871,
5741,
277,
278,
4827,
29874,
623,
363,
263,
3889,
4559,
29889,
1495,
320,
13,
1678,
869,
15770,
29918,
7543,
29898,
3257,
2433,
29933,
566,
705,
7608,
13329,
315,
1241,
742,
1426,
2433,
29907,
8342,
596,
3889,
4559,
636,
742,
2919,
29918,
3027,
29918,
2271,
2433,
991,
597,
9009,
29889,
2851,
3393,
29889,
990,
29914,
6011,
29914,
22382,
29914,
386,
3774,
29914,
29955,
29914,
29955,
29896,
29914,
29933,
566,
29918,
392,
29918,
29933,
566,
1707,
29889,
6173,
29914,
29896,
29906,
29900,
29900,
1756,
29899,
29933,
566,
29918,
392,
29918,
29933,
566,
1707,
29889,
6173,
1495,
13,
13,
13,
13,
29937,
29966,
26862,
6227,
29958,
877,
29954,
573,
17875,
3401,
1495,
13,
1753,
22661,
29918,
17028,
7295,
13,
13,
1678,
396,
4986,
3970,
788,
9066,
304,
9801,
281,
10058,
7882,
6511,
2130,
13,
13,
1678,
3611,
353,
679,
29918,
8172,
29918,
20087,
1199,
29918,
3257,
580,
13,
1678,
3229,
29898,
3257,
29889,
12508,
877,
9420,
29899,
29947,
8785,
13,
13,
1678,
3611,
353,
3142,
1982,
29889,
1396,
29898,
3257,
29897,
396,
19750,
304,
3160,
297,
3142,
13,
13,
1678,
281,
10058,
29918,
2754,
353,
525,
991,
597,
264,
29889,
6011,
29889,
990,
29914,
29893,
29914,
2754,
29889,
1961,
29973,
4830,
29922,
3126,
29987,
2467,
29922,
1972,
29987,
7728,
29922,
21111,
29879,
29987,
735,
23333,
29332,
4548,
7420,
726,
29332,
23545,
793,
2433,
13,
1678,
4390,
29918,
276,
1713,
353,
1303,
29918,
3166,
29918,
2271,
29898,
4594,
29918,
2754,
718,
3611,
29897,
13,
13,
1678,
18707,
353,
6629,
13,
308,
13,
1678,
1018,
29901,
13,
4706,
6515,
353,
4390,
29918,
276,
1713,
1839,
1972,
16215,
12292,
2033,
13,
4706,
363,
1820,
297,
6515,
29889,
8149,
7295,
13,
9651,
1596,
525,
4594,
1813,
2143,
29901,
525,
718,
1820,
13,
9651,
18707,
353,
6515,
29961,
1989,
22322,
21111,
2033,
13,
13,
1678,
5174,
29901,
13,
4706,
1596,
525,
2392,
12005,
746,
773,
3611,
29901,
525,
718,
3611,
13,
4706,
22661,
29918,
17028,
580,
13,
4706,
736,
13,
308,
13,
1678,
736,
3229,
29898,
524,
13210,
29889,
12508,
877,
9420,
29899,
29947,
8785,
13,
13,
1753,
1303,
29918,
3166,
29918,
2271,
29898,
2271,
1125,
13,
1678,
2933,
353,
3142,
1982,
29889,
332,
417,
2238,
29898,
2271,
29897,
13,
1678,
736,
4390,
29889,
18132,
29898,
5327,
29889,
949,
3101,
13,
13,
1753,
679,
29918,
8172,
29918,
20087,
1199,
29918,
3257,
7295,
13,
1678,
3987,
353,
6024,
2744,
1279,
1608,
742,
13,
4706,
525,
2744,
1279,
29877,
29899,
5030,
2410,
1608,
742,
13,
4706,
525,
2744,
1279,
29877,
29899,
9469,
277,
440,
1608,
742,
13,
4706,
525,
2744,
1279,
29877,
29899,
29879,
29891,
299,
936,
1608,
742,
13,
4706,
525,
2744,
1279,
391,
3817,
1608,
742,
13,
4706,
525,
13448,
29875,
29899,
2055,
348,
1608,
742,
13,
4706,
525,
13448,
333,
275,
342,
370,
1674,
358,
13956,
1608,
742,
13,
4706,
525,
2887,
713,
1819,
742,
13,
4706,
525,
13720,
3673,
713,
1608,
742,
13,
4706,
525,
29933,
1611,
387,
1848,
1261,
25804,
742,
13,
4706,
525,
18700,
14938,
1608,
742,
13,
4706,
525,
18700,
22747,
29885,
4135,
742,
13,
4706,
525,
29933,
324,
440,
13956,
14595,
742,
13,
4706,
525,
12415,
2410,
1608,
742,
13,
4706,
525,
18687,
713,
1261,
25804,
742,
13,
4706,
525,
18687,
713,
5264,
1608,
742,
13,
4706,
525,
2385,
936,
26054,
1608,
742,
13,
4706,
525,
2385,
936,
23925,
273,
1608,
742,
13,
4706,
525,
28916,
440,
1608,
742,
13,
4706,
525,
5261,
348,
1608,
742,
13,
4706,
525,
5261,
348,
3673,
713,
1608,
742,
13,
4706,
525,
1168,
2140,
271,
1608,
742,
13,
4706,
525,
12521,
1971,
271,
25804,
742,
13,
4706,
525,
29928,
331,
12040,
742,
13,
4706,
525,
29928,
331,
25804,
313,
5927,
20850,
29897,
742,
13,
4706,
525,
29928,
331,
8415,
2454,
8087,
284,
3673,
713,
1608,
742,
13,
4706,
525,
29928,
331,
8415,
2454,
10776,
6368,
742,
13,
4706,
525,
29928,
331,
8415,
2454,
5264,
1608,
742,
13,
4706,
525,
29928,
331,
8415,
2454,
1301,
26029,
1608,
742,
13,
4706,
525,
29923,
1111,
29899,
24911,
1608,
742,
13,
4706,
525,
29923,
23014,
3673,
713,
1608,
742,
13,
4706,
525,
29943,
6151,
1608,
742,
13,
4706,
525,
29943,
2447,
284,
1608,
742,
13,
4706,
525,
24599,
385,
1279,
1608,
742,
13,
4706,
525,
24599,
22661,
742,
13,
4706,
525,
24599,
22898,
936,
1608,
742,
13,
4706,
525,
29950,
19910,
4797,
1608,
742,
13,
4706,
525,
2568,
23352,
391,
385,
1279,
1608,
742,
13,
4706,
525,
23573,
284,
5199,
1608,
742,
13,
4706,
525,
29902,
2536,
314,
1608,
742,
13,
4706,
525,
3624,
25804,
742,
13,
4706,
525,
29968,
331,
284,
391,
1957,
3002,
742,
13,
4706,
525,
8091,
1608,
742,
13,
4706,
525,
29931,
12347,
284,
1608,
742,
13,
4706,
525,
23410,
2151,
13956,
1608,
742,
13,
4706,
525,
23410,
2151,
13956,
5264,
1608,
742,
13,
4706,
525,
7717,
1608,
742,
13,
4706,
525,
29924,
1175,
272,
3673,
713,
1608,
742,
13,
4706,
525,
7083,
29916,
1608,
742,
13,
4706,
525,
7083,
29916,
1608,
29899,
21515,
262,
1608,
742,
13,
4706,
525,
7083,
29916,
391,
22237,
742,
13,
4706,
525,
15836,
277,
25804,
742,
13,
4706,
525,
8140,
1279,
1608,
742,
13,
4706,
525,
8140,
272,
3673,
713,
1608,
742,
13,
4706,
525,
29924,
17438,
1885,
362,
742,
13,
4706,
525,
2111,
261,
403,
25421,
13956,
1608,
3788,
7185,
1279,
1608,
3788,
27325,
1608,
3788,
27325,
10307,
1608,
3788,
8139,
5079,
495,
284,
1608,
3788,
29925,
562,
361,
1608,
3788,
29925,
744,
5079,
2151,
13956,
1608,
3788,
11457,
374,
327,
1608,
3788,
7713,
277,
936,
5829,
1608,
3788,
23684,
275,
5288,
1608,
3788,
5894,
265,
1608,
3788,
12310,
352,
1608,
3788,
6747,
29899,
5261,
348,
1608,
3788,
14470,
440,
1608,
3788,
22908,
262,
1608,
3788,
29934,
29874,
1455,
3708,
537,
3788,
29934,
29874,
1455,
2377,
1727,
362,
3788,
29934,
29874,
1455,
1608,
3788,
9908,
936,
1644,
29878,
1608,
3788,
9908,
936,
26054,
1608,
3788,
29934,
1288,
1608,
3788,
5612,
803,
273,
1608,
3788,
11357,
6368,
3788,
29903,
4112,
3021,
488,
3788,
12636,
497,
29899,
29880,
17176,
13956,
1608,
3788,
6295,
1455,
24596,
277,
3788,
6295,
1455,
1261,
25804,
3788,
6295,
1455,
1608,
3788,
6295,
1455,
26054,
1608,
3788,
6295,
1455,
22237,
3788,
29903,
9085,
310,
9949,
3788,
855,
25977,
1608,
3788,
1349,
905,
261,
1608,
3788,
1349,
1823,
20627,
3788,
11536,
3673,
713,
1608,
3788,
29911,
1091,
284,
1608,
3788,
29911,
5450,
7912,
1608,
742,
13,
4706,
525,
7270,
3673,
713,
1608,
29915,
4514,
13,
1678,
736,
3987,
29961,
9502,
524,
29898,
29900,
29892,
7431,
29898,
6768,
29897,
448,
29871,
29896,
4638,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
20087,
1199,
29918,
17028,
580,
13,
1678,
1857,
29918,
7610,
29888,
877,
27765,
1495,
13,
13,
1678,
2011,
353,
938,
29898,
359,
29889,
21813,
29889,
657,
877,
15082,
742,
29871,
29945,
29900,
29900,
29900,
876,
13,
1678,
623,
29889,
3389,
29898,
3069,
2433,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
742,
2011,
29922,
637,
29897,
13,
2
] |
tests/test_notary.py | sxn/notary | 7 | 71345 | from pathlib import Path
from click.testing import CliRunner
import notary
from notary import cli
def test_add_license_no_preexisting():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE")
assert not license_file.exists()
result = runner.invoke(cli.add, input="\n".join(["mit", "<NAME>", "y"]))
assert result.exit_code == 0
assert "License name: mit\n" in result.output
assert "Author: <NAME>\n" in result.output
assert "Adding MIT License as the project's license. Continue? [y/N]: y\n"
assert "Added MIT License" in result.output
assert license_file.exists()
def test_add_license_no_preexisting_multiple_found():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE")
assert not license_file.exists()
result = runner.invoke(cli.add, input="\n".join(["m", "1", "<NAME>", "y"]))
assert result.exit_code == 0
assert "License name: m\n" in result.output
assert "Found the following matching licenses:\n" in result.output
assert "1: MIT License\n" in result.output
assert "2: Mozilla Public License Version 2.0\n" in result.output
assert "Please choose which one you'd like to add [1]: 1\n"
assert "Author: <NAME>\n" in result.output
assert "Adding MIT License as the project's license. Continue? [y/N]: y\n"
assert "Added MIT License to /" in result.output
assert "/LICENSE.\n" in result.output
assert license_file.exists()
def test_add_license_no_preexisting_no_author_needed():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE")
assert not license_file.exists()
result = runner.invoke(cli.add, input="\n".join(["agpl", "y"]))
assert result.exit_code == 0
assert "License name: agpl\n" in result.output
assert "Adding GNU Affero General Public License version 3 as the project's license. Continue? [y/N]: y\n" in result.output
assert "Added GNU Affero General Public License version 3 to /" in result.output
assert "/LICENSE.\n" in result.output
assert license_file.exists()
def test_add_license_no_preexisting_no_license_matched():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE")
assert not license_file.exists()
result = runner.invoke(cli.add, input="\n".join(["gibberish", "3", "y"]))
assert result.exit_code == 0
assert "License name: gibberish\n" in result.output
assert "Found the following matching licenses:\n" in result.output
assert "1: GNU Affero General Public License version 3\n" in result.output
assert "2: Apache License 2.0\n" in result.output
assert "3: GNU General Public License v3.0\n" in result.output
assert "4: GNU Lesser General Public License v3.0\n" in result.output
assert "5: MIT License\n" in result.output
assert "6: Mozilla Public License Version 2.0\n" in result.output
assert "7: The Unlicense\n" in result.output
assert "Please choose which one you'd like to add [1]: 3\n" in result.output
assert "Adding GNU General Public License v3.0 as the project's license. Continue? [y/N]: y\n" in result.output
assert "Added GNU General Public License v3.0 to /" in result.output
assert "/LICENSE.\n" in result.output
assert license_file.exists()
def test_add_license_preexisting_license():
runner = CliRunner()
with runner.isolated_filesystem():
old_license_file = Path("LICENSE.rst")
with old_license_file.open("w") as f:
f.write("")
new_license_file = Path("LICENSE")
assert not new_license_file.exists()
result = runner.invoke(cli.add, input="\n".join(["y", "mit", "<NAME>", "y"]))
assert result.exit_code == 0
assert "The following license file(s) already exist:\n" in result.output
assert "/LICENSE.rst\n" in result.output
assert "Remove /" in result.output
assert "/LICENSE.rst? [y/N]: y\n" in result.output
assert "Removed /" in result.output
assert "/LICENSE.rst.\n" in result.output
assert "License name: mit\n" in result.output
assert "Author: <NAME>\n" in result.output
assert "Adding MIT License as the project's license. Continue? [y/N]: y\n"
assert "Added MIT License" in result.output
assert new_license_file.exists()
def test_remove_no_license():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(cli.remove)
assert result.exit_code == 0
assert "No license file found in the current directory." in result.output
def test_remove_existing_license_answer_yes():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE.rst")
with license_file.open("w") as f:
f.write("")
assert license_file.exists()
result = runner.invoke(cli.remove, input="y")
assert result.exit_code == 0
assert "The following license file(s) already exist:" in result.output
assert "/LICENSE.rst? [y/N]: y\n" in result.output
assert "Removed /" in result.output
assert "/LICENSE.rst.\n" in result.output
assert not license_file.exists()
def test_remove_existing_license_answer_no():
runner = CliRunner()
with runner.isolated_filesystem():
license_file = Path("LICENSE.rst")
with license_file.open("w") as f:
f.write("")
assert license_file.exists()
result = runner.invoke(cli.remove, input="n")
assert result.exit_code == 0
assert "The following license file(s) already exist:" in result.output
assert "/LICENSE.rst? [y/N]: n\n" in result.output
assert "Not removing license.\n" in result.output
assert license_file.exists()
| [
1,
515,
2224,
1982,
1053,
10802,
13,
13,
3166,
2828,
29889,
13424,
1053,
315,
492,
16802,
13,
13,
5215,
451,
653,
13,
3166,
451,
653,
1053,
9335,
13,
13,
13,
1753,
1243,
29918,
1202,
29918,
506,
1947,
29918,
1217,
29918,
1457,
735,
15423,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
1159,
13,
4706,
4974,
451,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
1202,
29892,
1881,
543,
29905,
29876,
1642,
7122,
29898,
3366,
2415,
613,
9872,
5813,
28341,
376,
29891,
3108,
876,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
29931,
293,
1947,
1024,
29901,
1380,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
13720,
29901,
529,
5813,
14247,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
292,
341,
1806,
19245,
408,
278,
2060,
29915,
29879,
19405,
29889,
2866,
14150,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
13,
4706,
4974,
376,
2528,
287,
341,
1806,
19245,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
1202,
29918,
506,
1947,
29918,
1217,
29918,
1457,
735,
15423,
29918,
20787,
29918,
11940,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
1159,
13,
4706,
4974,
451,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
1202,
29892,
1881,
543,
29905,
29876,
1642,
7122,
29898,
3366,
29885,
613,
376,
29896,
613,
9872,
5813,
28341,
376,
29891,
3108,
876,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
29931,
293,
1947,
1024,
29901,
286,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
9692,
278,
1494,
9686,
7794,
11259,
3583,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29896,
29901,
341,
1806,
19245,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29906,
29901,
18129,
2911,
5236,
19245,
10079,
29871,
29906,
29889,
29900,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
12148,
6755,
607,
697,
366,
29915,
29881,
763,
304,
788,
518,
29896,
5387,
29871,
29896,
29905,
29876,
29908,
13,
4706,
4974,
376,
13720,
29901,
529,
5813,
14247,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
292,
341,
1806,
19245,
408,
278,
2060,
29915,
29879,
19405,
29889,
2866,
14150,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
13,
4706,
4974,
376,
2528,
287,
341,
1806,
19245,
304,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
1202,
29918,
506,
1947,
29918,
1217,
29918,
1457,
735,
15423,
29918,
1217,
29918,
8921,
29918,
484,
19226,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
1159,
13,
4706,
4974,
451,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
1202,
29892,
1881,
543,
29905,
29876,
1642,
7122,
29898,
3366,
351,
572,
613,
376,
29891,
3108,
876,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
29931,
293,
1947,
1024,
29901,
946,
572,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
292,
15143,
10393,
571,
29877,
4593,
5236,
19245,
1873,
29871,
29941,
408,
278,
2060,
29915,
29879,
19405,
29889,
2866,
14150,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
287,
15143,
10393,
571,
29877,
4593,
5236,
19245,
1873,
29871,
29941,
304,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
1202,
29918,
506,
1947,
29918,
1217,
29918,
1457,
735,
15423,
29918,
1217,
29918,
506,
1947,
29918,
4352,
287,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
1159,
13,
4706,
4974,
451,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
1202,
29892,
1881,
543,
29905,
29876,
1642,
7122,
29898,
3366,
29887,
747,
495,
728,
613,
376,
29941,
613,
376,
29891,
3108,
876,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
29931,
293,
1947,
1024,
29901,
330,
747,
495,
728,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
9692,
278,
1494,
9686,
7794,
11259,
3583,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29896,
29901,
15143,
10393,
571,
29877,
4593,
5236,
19245,
1873,
29871,
29941,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29906,
29901,
13380,
19245,
29871,
29906,
29889,
29900,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29941,
29901,
15143,
4593,
5236,
19245,
325,
29941,
29889,
29900,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29946,
29901,
15143,
365,
16136,
4593,
5236,
19245,
325,
29941,
29889,
29900,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29945,
29901,
341,
1806,
19245,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29953,
29901,
18129,
2911,
5236,
19245,
10079,
29871,
29906,
29889,
29900,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29955,
29901,
450,
853,
506,
1947,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
12148,
6755,
607,
697,
366,
29915,
29881,
763,
304,
788,
518,
29896,
5387,
29871,
29941,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
292,
15143,
4593,
5236,
19245,
325,
29941,
29889,
29900,
408,
278,
2060,
29915,
29879,
19405,
29889,
2866,
14150,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
287,
15143,
4593,
5236,
19245,
325,
29941,
29889,
29900,
304,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
1202,
29918,
506,
1947,
29918,
1457,
735,
15423,
29918,
506,
1947,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
2030,
29918,
506,
1947,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
29889,
29878,
303,
1159,
13,
4706,
411,
2030,
29918,
506,
1947,
29918,
1445,
29889,
3150,
703,
29893,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
703,
1159,
13,
4706,
716,
29918,
506,
1947,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
1159,
13,
4706,
4974,
451,
716,
29918,
506,
1947,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
1202,
29892,
1881,
543,
29905,
29876,
1642,
7122,
29898,
3366,
29891,
613,
376,
2415,
613,
9872,
5813,
28341,
376,
29891,
3108,
876,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
1576,
1494,
19405,
934,
29898,
29879,
29897,
2307,
1863,
3583,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
15941,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
7301,
8238,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
29931,
293,
1947,
1024,
29901,
1380,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
13720,
29901,
529,
5813,
14247,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
2528,
292,
341,
1806,
19245,
408,
278,
2060,
29915,
29879,
19405,
29889,
2866,
14150,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
13,
4706,
4974,
376,
2528,
287,
341,
1806,
19245,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
716,
29918,
506,
1947,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
5992,
29918,
1217,
29918,
506,
1947,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
5992,
29897,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
3782,
19405,
934,
1476,
297,
278,
1857,
3884,
1213,
297,
1121,
29889,
4905,
13,
13,
13,
1753,
1243,
29918,
5992,
29918,
735,
15423,
29918,
506,
1947,
29918,
12011,
29918,
3582,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
29889,
29878,
303,
1159,
13,
4706,
411,
19405,
29918,
1445,
29889,
3150,
703,
29893,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
703,
1159,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
5992,
29892,
1881,
543,
29891,
1159,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
1576,
1494,
19405,
934,
29898,
29879,
29897,
2307,
1863,
6160,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
29973,
518,
29891,
29914,
29940,
5387,
343,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
7301,
8238,
847,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
451,
19405,
29918,
1445,
29889,
9933,
580,
13,
13,
13,
1753,
1243,
29918,
5992,
29918,
735,
15423,
29918,
506,
1947,
29918,
12011,
29918,
1217,
7295,
13,
1678,
28877,
353,
315,
492,
16802,
580,
13,
1678,
411,
28877,
29889,
275,
324,
630,
29918,
5325,
973,
7295,
13,
4706,
19405,
29918,
1445,
353,
10802,
703,
27888,
1430,
1660,
29889,
29878,
303,
1159,
13,
4706,
411,
19405,
29918,
1445,
29889,
3150,
703,
29893,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
703,
1159,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
4706,
1121,
353,
28877,
29889,
9772,
29898,
11303,
29889,
5992,
29892,
1881,
543,
29876,
1159,
13,
4706,
4974,
1121,
29889,
13322,
29918,
401,
1275,
29871,
29900,
13,
4706,
4974,
376,
1576,
1494,
19405,
934,
29898,
29879,
29897,
2307,
1863,
6160,
297,
1121,
29889,
4905,
13,
4706,
4974,
5591,
27888,
1430,
1660,
29889,
29878,
303,
29973,
518,
29891,
29914,
29940,
5387,
302,
29905,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
376,
3664,
11077,
19405,
7790,
29876,
29908,
297,
1121,
29889,
4905,
13,
4706,
4974,
19405,
29918,
1445,
29889,
9933,
580,
13,
2
] |
src/utils.py | jaejun-lee/amzbinimg | 1 | 176628 | <gh_stars>1-10
import tensorflow.keras.backend as K
import matplotlib.pyplot as plt
import numpy as np
### Custome Metrics
def soft_rmse(y_true, y_pred):
'''caculate RMSE for categorical predictions.
'''
return K.sqrt( K.mean(K.cast_to_floatx ( K.square( K.argmax(y_true) - K.argmax(y_pred) )), axis=-1) )
def soft_acc(y_true, y_pred):
'''caculate accuracy for RMSE loss function prediction.
'''
return K.mean(K.equal(K.round(y_true), K.round(y_pred)))
### Plot
def plot_history(history):
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
def visualize(img, encoder, decoder):
"""Draws original, encoded and decoded images"""
# img[None] will have shape of (1, 32, 32, 3) which is the same as the model input
code = encoder.predict(img[None])[0]
reco = decoder.predict(code[None])[0]
plt.subplot(1,3,1)
plt.title("Original")
plt.imshow(img)
plt.subplot(1,3,2)
plt.title("Code")
plt.imshow(code.reshape([code.shape[-1]//2,-1]))
plt.subplot(1,3,3)
plt.title("Reconstructed")
plt.imshow(reco)
plt.show()
def visualize_features(img, encoder, decoder):
code = encoder.predict(img[None])[0]
images_per_row = 16
num_of_features = code.shape[0]
n_cols = num_of_features // images_per_row
display_grid = np.zeros(images_per_row, n_cols)
for row in range(images_per_row):
for col in range(n_cols):
mask = np.zeros(num_of_features)
mask[row * n_cols + cos] = 1
new_code = code.copy()
new_code = new_code * mask
reco = decoder.predict(new_code[None])[0]
display_grid[row, col] = reco
plt.figure(figsize= (images_per_row, n_cols))
plt.title("Feature Representation by Decoder")
plt.grid(False)
plt.imshow(display_grid, aspect='auto', cmap='viridis')
### configure training layer
def change_trainable_layers(model, trainable_index):
for layer in model.layers[:trainable_index]:
layer.trainable = False
for layer in model.layers[trainable_index:]:
layer.trainable = True
def print_model_properties(model, indices = 0):
for i, layer in enumerate(model.layers[indices:]):
print(f"Layer {i+indices} | Name: {layer.name} | Trainable: {layer.trainable}")
### Image Processing
def plot_image_and_histogram(img):
fig = plt.figure(figsize=(8,4))
ax1 = fig.add_subplot(121)
ax1.imshow(img)
ax1.set_title('Image')
ax2 = fig.add_subplot(122)
ax2.hist(img[:,:,0].flatten(), color='red', bins=25)
ax2.hist(img[:,:,1].flatten(), color='green', bins=25)
ax2.hist(img[:,:,2].flatten(), color='blue', bins=25)
ax2.set_title('Histogram of pixel intensities')
ax2.set_xlabel('Pixel intensity')
ax2.set_ylabel('Count')
plt.tight_layout(pad=1) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
26110,
29889,
3946,
294,
29889,
27852,
408,
476,
13,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
13,
13,
2277,
29937,
315,
504,
608,
4737,
10817,
13,
1753,
4964,
29918,
1758,
344,
29898,
29891,
29918,
3009,
29892,
343,
29918,
11965,
1125,
13,
1678,
14550,
29883,
562,
5987,
390,
29924,
1660,
363,
11608,
936,
27303,
29889,
29871,
13,
1678,
14550,
13,
1678,
736,
476,
29889,
3676,
29898,
29871,
476,
29889,
12676,
29898,
29968,
29889,
4384,
29918,
517,
29918,
7411,
29916,
313,
476,
29889,
17619,
29898,
476,
29889,
1191,
3317,
29898,
29891,
29918,
3009,
29897,
448,
476,
29889,
1191,
3317,
29898,
29891,
29918,
11965,
29897,
1723,
511,
9685,
10457,
29896,
29897,
1723,
13,
13,
1753,
4964,
29918,
5753,
29898,
29891,
29918,
3009,
29892,
343,
29918,
11965,
1125,
13,
1678,
14550,
29883,
562,
5987,
13600,
363,
390,
29924,
1660,
6410,
740,
18988,
29889,
13,
1678,
14550,
13,
1678,
736,
476,
29889,
12676,
29898,
29968,
29889,
11745,
29898,
29968,
29889,
14486,
29898,
29891,
29918,
3009,
511,
476,
29889,
14486,
29898,
29891,
29918,
11965,
4961,
13,
13,
2277,
29937,
18399,
13,
1753,
6492,
29918,
18434,
29898,
18434,
1125,
268,
13,
1678,
14770,
29889,
5317,
29898,
18434,
29889,
18434,
1839,
6758,
11287,
13,
1678,
14770,
29889,
5317,
29898,
18434,
29889,
18434,
1839,
791,
29918,
6758,
11287,
13,
1678,
14770,
29889,
3257,
877,
4299,
6410,
1495,
13,
1678,
14770,
29889,
29891,
1643,
877,
6758,
1495,
13,
1678,
14770,
29889,
29916,
1643,
877,
1022,
2878,
1495,
13,
1678,
14770,
29889,
26172,
18959,
14968,
742,
525,
1688,
7464,
1180,
2433,
21064,
2175,
1495,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
1753,
7604,
675,
29898,
2492,
29892,
2094,
6119,
29892,
1602,
6119,
1125,
13,
1678,
9995,
8537,
29879,
2441,
29892,
18511,
322,
1602,
6797,
4558,
15945,
29908,
13,
1678,
396,
10153,
29961,
8516,
29962,
674,
505,
8267,
310,
313,
29896,
29892,
29871,
29941,
29906,
29892,
29871,
29941,
29906,
29892,
29871,
29941,
29897,
607,
338,
278,
1021,
408,
278,
1904,
1881,
13,
1678,
775,
353,
2094,
6119,
29889,
27711,
29898,
2492,
29961,
8516,
2314,
29961,
29900,
29962,
13,
1678,
337,
1111,
353,
1602,
6119,
29889,
27711,
29898,
401,
29961,
8516,
2314,
29961,
29900,
29962,
13,
13,
1678,
14770,
29889,
1491,
5317,
29898,
29896,
29892,
29941,
29892,
29896,
29897,
13,
1678,
14770,
29889,
3257,
703,
26036,
1159,
13,
1678,
14770,
29889,
326,
4294,
29898,
2492,
29897,
13,
13,
1678,
14770,
29889,
1491,
5317,
29898,
29896,
29892,
29941,
29892,
29906,
29897,
13,
1678,
14770,
29889,
3257,
703,
3399,
1159,
13,
1678,
14770,
29889,
326,
4294,
29898,
401,
29889,
690,
14443,
4197,
401,
29889,
12181,
14352,
29896,
29962,
458,
29906,
6653,
29896,
12622,
13,
13,
1678,
14770,
29889,
1491,
5317,
29898,
29896,
29892,
29941,
29892,
29941,
29897,
13,
1678,
14770,
29889,
3257,
703,
1123,
11433,
287,
1159,
13,
1678,
14770,
29889,
326,
4294,
29898,
276,
1111,
29897,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
1753,
7604,
675,
29918,
22100,
29898,
2492,
29892,
2094,
6119,
29892,
1602,
6119,
1125,
13,
1678,
775,
353,
2094,
6119,
29889,
27711,
29898,
2492,
29961,
8516,
2314,
29961,
29900,
29962,
13,
268,
13,
1678,
4558,
29918,
546,
29918,
798,
353,
29871,
29896,
29953,
13,
1678,
954,
29918,
974,
29918,
22100,
353,
775,
29889,
12181,
29961,
29900,
29962,
13,
1678,
302,
29918,
22724,
353,
29871,
954,
29918,
974,
29918,
22100,
849,
4558,
29918,
546,
29918,
798,
13,
1678,
2479,
29918,
7720,
353,
7442,
29889,
3298,
359,
29898,
8346,
29918,
546,
29918,
798,
29892,
302,
29918,
22724,
29897,
13,
268,
13,
1678,
363,
1948,
297,
3464,
29898,
8346,
29918,
546,
29918,
798,
1125,
13,
4706,
363,
784,
297,
3464,
29898,
29876,
29918,
22724,
1125,
13,
9651,
11105,
353,
7442,
29889,
3298,
359,
29898,
1949,
29918,
974,
29918,
22100,
29897,
13,
9651,
11105,
29961,
798,
334,
302,
29918,
22724,
718,
6776,
29962,
353,
29871,
29896,
13,
9651,
716,
29918,
401,
353,
775,
29889,
8552,
580,
13,
9651,
716,
29918,
401,
353,
716,
29918,
401,
334,
11105,
13,
9651,
337,
1111,
353,
1602,
6119,
29889,
27711,
29898,
1482,
29918,
401,
29961,
8516,
2314,
29961,
29900,
29962,
13,
9651,
2479,
29918,
7720,
29961,
798,
29892,
784,
29962,
353,
337,
1111,
13,
268,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
29922,
313,
8346,
29918,
546,
29918,
798,
29892,
302,
29918,
22724,
876,
13,
1678,
14770,
29889,
3257,
703,
19132,
16314,
362,
491,
3826,
6119,
1159,
13,
1678,
14770,
29889,
7720,
29898,
8824,
29897,
13,
1678,
14770,
29889,
326,
4294,
29898,
4990,
29918,
7720,
29892,
9565,
2433,
6921,
742,
274,
1958,
2433,
2405,
333,
275,
1495,
13,
13,
2277,
29937,
10822,
6694,
7546,
13,
1753,
1735,
29918,
14968,
519,
29918,
29277,
29898,
4299,
29892,
7945,
519,
29918,
2248,
1125,
13,
1678,
363,
7546,
297,
1904,
29889,
29277,
7503,
14968,
519,
29918,
2248,
5387,
13,
4706,
7546,
29889,
14968,
519,
353,
7700,
13,
1678,
363,
7546,
297,
1904,
29889,
29277,
29961,
14968,
519,
29918,
2248,
29901,
5387,
13,
4706,
7546,
29889,
14968,
519,
353,
5852,
13,
268,
13,
1753,
1596,
29918,
4299,
29918,
11330,
29898,
4299,
29892,
16285,
353,
29871,
29900,
1125,
13,
268,
363,
474,
29892,
7546,
297,
26985,
29898,
4299,
29889,
29277,
29961,
513,
1575,
17531,
1125,
13,
4706,
1596,
29898,
29888,
29908,
14420,
426,
29875,
29974,
513,
1575,
29913,
891,
4408,
29901,
426,
13148,
29889,
978,
29913,
891,
28186,
519,
29901,
426,
13148,
29889,
14968,
519,
27195,
13,
13,
2277,
29937,
7084,
10554,
292,
13,
1753,
6492,
29918,
3027,
29918,
392,
29918,
29882,
391,
13342,
29898,
2492,
1125,
13,
1678,
2537,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29947,
29892,
29946,
876,
13,
1678,
4853,
29896,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29906,
29896,
29897,
13,
1678,
4853,
29896,
29889,
326,
4294,
29898,
2492,
29897,
13,
1678,
4853,
29896,
29889,
842,
29918,
3257,
877,
2940,
1495,
13,
1678,
4853,
29906,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29906,
29906,
29897,
13,
1678,
4853,
29906,
29889,
29882,
391,
29898,
2492,
7503,
29892,
29901,
29892,
29900,
1822,
1579,
8606,
3285,
2927,
2433,
1127,
742,
289,
1144,
29922,
29906,
29945,
29897,
13,
1678,
4853,
29906,
29889,
29882,
391,
29898,
2492,
7503,
29892,
29901,
29892,
29896,
1822,
1579,
8606,
3285,
2927,
2433,
12692,
742,
289,
1144,
29922,
29906,
29945,
29897,
13,
1678,
4853,
29906,
29889,
29882,
391,
29898,
2492,
7503,
29892,
29901,
29892,
29906,
1822,
1579,
8606,
3285,
2927,
2433,
9539,
742,
289,
1144,
29922,
29906,
29945,
29897,
13,
1678,
4853,
29906,
29889,
842,
29918,
3257,
877,
29950,
391,
13342,
310,
15526,
12838,
1907,
1495,
13,
1678,
4853,
29906,
29889,
842,
29918,
29916,
1643,
877,
29637,
26171,
1495,
13,
1678,
4853,
29906,
29889,
842,
29918,
29891,
1643,
877,
3981,
1495,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
29898,
8305,
29922,
29896,
29897,
2
] |
SimModel_Python_API/simmodel_swig/Release/SimSpace_Occupied_Default.py | EnEff-BIM/EnEffBIM-Framework | 3 | 79655 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_SimSpace_Occupied_Default', [dirname(__file__)])
except ImportError:
import _SimSpace_Occupied_Default
return _SimSpace_Occupied_Default
if fp is not None:
try:
_mod = imp.load_module('_SimSpace_Occupied_Default', fp, pathname, description)
finally:
fp.close()
return _mod
_SimSpace_Occupied_Default = swig_import_helper()
del swig_import_helper
else:
import _SimSpace_Occupied_Default
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
try:
import weakref
weakref_proxy = weakref.proxy
except:
weakref_proxy = lambda x: x
import base
class SimSpace(base.SimSpatialStructureElement):
__swig_setmethods__ = {}
for _s in [base.SimSpatialStructureElement]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SimSpace, name, value)
__swig_getmethods__ = {}
for _s in [base.SimSpatialStructureElement]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SimSpace, name)
__repr__ = _swig_repr
def SpaceZoneAssignments(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceZoneAssignments(self, *args)
def SpaceNumber(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceNumber(self, *args)
def SpaceName(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceName(self, *args)
def SpaceInteriorOrExterior(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceInteriorOrExterior(self, *args)
def SpaceDatumElevation(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceDatumElevation(self, *args)
def SpaceThermalSimulationType(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceThermalSimulationType(self, *args)
def SpaceConditioningRequirement(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceConditioningRequirement(self, *args)
def SpaceOccupantDensity(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceOccupantDensity(self, *args)
def SpaceOccupantHeatRateLatent(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceOccupantHeatRateLatent(self, *args)
def SpaceOccupantHeatRateSensible(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceOccupantHeatRateSensible(self, *args)
def SpaceOccupantLoad(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceOccupantLoad(self, *args)
def SpaceEquipmentLoad(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceEquipmentLoad(self, *args)
def SpaceLightingLoad(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceLightingLoad(self, *args)
def InsideDryBulbTempHeating(self, *args):
return _SimSpace_Occupied_Default.SimSpace_InsideDryBulbTempHeating(self, *args)
def InsideRelHumidityHeating(self, *args):
return _SimSpace_Occupied_Default.SimSpace_InsideRelHumidityHeating(self, *args)
def InsideDryBulbTempCooling(self, *args):
return _SimSpace_Occupied_Default.SimSpace_InsideDryBulbTempCooling(self, *args)
def InsideRelHumidityCooling(self, *args):
return _SimSpace_Occupied_Default.SimSpace_InsideRelHumidityCooling(self, *args)
def IncludesReturnAirPlenum(self, *args):
return _SimSpace_Occupied_Default.SimSpace_IncludesReturnAirPlenum(self, *args)
def PeakAirFlowCooling(self, *args):
return _SimSpace_Occupied_Default.SimSpace_PeakAirFlowCooling(self, *args)
def PeakAirFlowHeating(self, *args):
return _SimSpace_Occupied_Default.SimSpace_PeakAirFlowHeating(self, *args)
def ExhaustAirFlowRate(self, *args):
return _SimSpace_Occupied_Default.SimSpace_ExhaustAirFlowRate(self, *args)
def NaturalAirChangeRate(self, *args):
return _SimSpace_Occupied_Default.SimSpace_NaturalAirChangeRate(self, *args)
def MechanicalAirChangeRate(self, *args):
return _SimSpace_Occupied_Default.SimSpace_MechanicalAirChangeRate(self, *args)
def VentilationType(self, *args):
return _SimSpace_Occupied_Default.SimSpace_VentilationType(self, *args)
def OutsideAirPerPerson(self, *args):
return _SimSpace_Occupied_Default.SimSpace_OutsideAirPerPerson(self, *args)
def SpaceHeight(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceHeight(self, *args)
def SpaceGrossPerimeter(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceGrossPerimeter(self, *args)
def SpaceGrossFloorArea(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceGrossFloorArea(self, *args)
def SpaceNetFloorArea(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceNetFloorArea(self, *args)
def SpaceGrossVolume(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceGrossVolume(self, *args)
def SpaceNetVolume(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceNetVolume(self, *args)
def SpaceNetFloorAreaBOMA(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceNetFloorAreaBOMA(self, *args)
def SpaceUsableFloorAreaBOMA(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceUsableFloorAreaBOMA(self, *args)
def ClassRef_SpaceByFunction(self, *args):
return _SimSpace_Occupied_Default.SimSpace_ClassRef_SpaceByFunction(self, *args)
def ClassRef_SpaceTypeOwner(self, *args):
return _SimSpace_Occupied_Default.SimSpace_ClassRef_SpaceTypeOwner(self, *args)
def ClassRef_SpaceCategoryOwner(self, *args):
return _SimSpace_Occupied_Default.SimSpace_ClassRef_SpaceCategoryOwner(self, *args)
def ClassRef_SpaceCategoryBOMA(self, *args):
return _SimSpace_Occupied_Default.SimSpace_ClassRef_SpaceCategoryBOMA(self, *args)
def SpaceOccupants(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceOccupants(self, *args)
def OccupancyScheduleAssignment(self, *args):
return _SimSpace_Occupied_Default.SimSpace_OccupancyScheduleAssignment(self, *args)
def LightingScheduleAssignment(self, *args):
return _SimSpace_Occupied_Default.SimSpace_LightingScheduleAssignment(self, *args)
def EquipmentScheduleAssignment(self, *args):
return _SimSpace_Occupied_Default.SimSpace_EquipmentScheduleAssignment(self, *args)
def GeometricRepresentations(self, *args):
return _SimSpace_Occupied_Default.SimSpace_GeometricRepresentations(self, *args)
def SpaceInSpatialContainer(self, *args):
return _SimSpace_Occupied_Default.SimSpace_SpaceInSpatialContainer(self, *args)
def AssociatedPlena(self, *args):
return _SimSpace_Occupied_Default.SimSpace_AssociatedPlena(self, *args)
def AssociatedElements(self, *args):
return _SimSpace_Occupied_Default.SimSpace_AssociatedElements(self, *args)
def __init__(self, *args):
this = _SimSpace_Occupied_Default.new_SimSpace(*args)
try:
self.this.append(this)
except:
self.this = this
def _clone(self, f=0, c=None):
return _SimSpace_Occupied_Default.SimSpace__clone(self, f, c)
__swig_destroy__ = _SimSpace_Occupied_Default.delete_SimSpace
__del__ = lambda self: None
SimSpace_swigregister = _SimSpace_Occupied_Default.SimSpace_swigregister
SimSpace_swigregister(SimSpace)
class SimSpace_Occupied(SimSpace):
__swig_setmethods__ = {}
for _s in [SimSpace]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SimSpace_Occupied, name, value)
__swig_getmethods__ = {}
for _s in [SimSpace]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SimSpace_Occupied, name)
__repr__ = _swig_repr
def T24CommRefrigEPD(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24CommRefrigEPD(self, *args)
def T24CommRefrigEqmtSchedRef(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24CommRefrigEqmtSchedRef(self, *args)
def T24CommRefrigLatentFraction(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24CommRefrigLatentFraction(self, *args)
def T24CommRefrigLostFraction(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24CommRefrigLostFraction(self, *args)
def T24CommRefrigRadFraction(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24CommRefrigRadFraction(self, *args)
def T24EnvelopeStatus(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24EnvelopeStatus(self, *args)
def T24ExhaustAirChangesPerHour(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24ExhaustAirChangesPerHour(self, *args)
def T24ExhaustPerArea(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24ExhaustPerArea(self, *args)
def T24ExhaustPerSpace(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24ExhaustPerSpace(self, *args)
def T24HasProcessExhaust(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24HasProcessExhaust(self, *args)
def T24IntLightingSpecMethod(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24IntLightingSpecMethod(self, *args)
def T24KitchExhHoodDutyList(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24KitchExhHoodDutyList(self, *args)
def T24KitchExhHoodFlowList(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24KitchExhHoodFlowList(self, *args)
def T24KitchExhHoodLengthList(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24KitchExhHoodLengthList(self, *args)
def T24KitchExhHoodStyleList(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24KitchExhHoodStyleList(self, *args)
def T24LabExhRateType(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24LabExhRateType(self, *args)
def T24LightingStatus(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24LightingStatus(self, *args)
def T24MandLightCntrlCntRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlCntRpt(self, *args)
def T24MandLightCntrlDescRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlDescRpt(self, *args)
def T24MandLightCntrlAccepReqRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlAccepReqRpt(self, *args)
def T24MandLightCntrlIsAutoShOffCntrlRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlIsAutoShOffCntrlRpt(self, *args)
def T24MandLightCntrlIsDayltngCntrlRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlIsDayltngCntrlRpt(self, *args)
def T24MandLightCntrlIsDmndRespCntrlRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlIsDmndRespCntrlRpt(self, *args)
def T24MandLightCntrlIsManAreaCntrlRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlIsManAreaCntrlRpt(self, *args)
def T24MandLightCntrlIsMultLvlCntrlRpt(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24MandLightCntrlIsMultLvlCntrlRpt(self, *args)
def T24SkylightRqmtExcep(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24SkylightRqmtExcep(self, *args)
def T24SpaceFunction(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24SpaceFunction(self, *args)
def T24ConstructStatus3(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_T24ConstructStatus3(self, *args)
def __init__(self, *args):
this = _SimSpace_Occupied_Default.new_SimSpace_Occupied(*args)
try:
self.this.append(this)
except:
self.this = this
def _clone(self, f=0, c=None):
return _SimSpace_Occupied_Default.SimSpace_Occupied__clone(self, f, c)
__swig_destroy__ = _SimSpace_Occupied_Default.delete_SimSpace_Occupied
__del__ = lambda self: None
SimSpace_Occupied_swigregister = _SimSpace_Occupied_Default.SimSpace_Occupied_swigregister
SimSpace_Occupied_swigregister(SimSpace_Occupied)
class SimSpace_Occupied_Default(SimSpace_Occupied):
__swig_setmethods__ = {}
for _s in [SimSpace_Occupied]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SimSpace_Occupied_Default, name, value)
__swig_getmethods__ = {}
for _s in [SimSpace_Occupied]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SimSpace_Occupied_Default, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _SimSpace_Occupied_Default.new_SimSpace_Occupied_Default(*args)
try:
self.this.append(this)
except:
self.this = this
def _clone(self, f=0, c=None):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default__clone(self, f, c)
__swig_destroy__ = _SimSpace_Occupied_Default.delete_SimSpace_Occupied_Default
__del__ = lambda self: None
SimSpace_Occupied_Default_swigregister = _SimSpace_Occupied_Default.SimSpace_Occupied_Default_swigregister
SimSpace_Occupied_Default_swigregister(SimSpace_Occupied_Default)
class SimSpace_Occupied_Default_sequence(base.sequence_common):
__swig_setmethods__ = {}
for _s in [base.sequence_common]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SimSpace_Occupied_Default_sequence, name, value)
__swig_getmethods__ = {}
for _s in [base.sequence_common]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SimSpace_Occupied_Default_sequence, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _SimSpace_Occupied_Default.new_SimSpace_Occupied_Default_sequence(*args)
try:
self.this.append(this)
except:
self.this = this
def assign(self, n, x):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_assign(self, n, x)
def begin(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_begin(self, *args)
def end(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_end(self, *args)
def rbegin(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_rbegin(self, *args)
def rend(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_rend(self, *args)
def at(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_at(self, *args)
def front(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_front(self, *args)
def back(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_back(self, *args)
def push_back(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_push_back(self, *args)
def pop_back(self):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_pop_back(self)
def detach_back(self, pop=True):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_detach_back(self, pop)
def insert(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_insert(self, *args)
def erase(self, *args):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_erase(self, *args)
def detach(self, position, r, erase=True):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_detach(self, position, r, erase)
def swap(self, x):
return _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_swap(self, x)
__swig_destroy__ = _SimSpace_Occupied_Default.delete_SimSpace_Occupied_Default_sequence
__del__ = lambda self: None
SimSpace_Occupied_Default_sequence_swigregister = _SimSpace_Occupied_Default.SimSpace_Occupied_Default_sequence_swigregister
SimSpace_Occupied_Default_sequence_swigregister(SimSpace_Occupied_Default_sequence)
# This file is compatible with both classic and new-style classes.
| [
1,
396,
910,
934,
471,
6336,
5759,
491,
25289,
6259,
313,
1124,
597,
1636,
29889,
2774,
335,
29889,
990,
467,
13,
29937,
10079,
29871,
29941,
29889,
29900,
29889,
29955,
13,
29937,
13,
29937,
1938,
451,
1207,
3620,
304,
445,
934,
6521,
366,
1073,
825,
366,
526,
2599,
489,
1545,
1598,
13,
29937,
278,
25289,
6259,
5067,
934,
2012,
29889,
13,
13,
13,
13,
13,
13,
3166,
10876,
1053,
1873,
29918,
3888,
13,
361,
1873,
29918,
3888,
6736,
313,
29906,
29892,
29871,
29953,
29892,
29871,
29900,
1125,
13,
1678,
822,
2381,
335,
29918,
5215,
29918,
20907,
7295,
13,
4706,
515,
2897,
29889,
2084,
1053,
4516,
978,
13,
4706,
1053,
2411,
13,
4706,
285,
29886,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
285,
29886,
29892,
2224,
978,
29892,
6139,
353,
2411,
29889,
2886,
29918,
5453,
877,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
742,
518,
25721,
22168,
1445,
1649,
29897,
2314,
13,
4706,
5174,
16032,
2392,
29901,
13,
9651,
1053,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
13,
9651,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
13,
4706,
565,
285,
29886,
338,
451,
6213,
29901,
13,
9651,
1018,
29901,
13,
18884,
903,
1545,
353,
2411,
29889,
1359,
29918,
5453,
877,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
742,
285,
29886,
29892,
2224,
978,
29892,
6139,
29897,
13,
9651,
7146,
29901,
13,
18884,
285,
29886,
29889,
5358,
580,
13,
9651,
736,
903,
1545,
13,
1678,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
353,
2381,
335,
29918,
5215,
29918,
20907,
580,
13,
1678,
628,
2381,
335,
29918,
5215,
29918,
20907,
13,
2870,
29901,
13,
1678,
1053,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
13,
6144,
1873,
29918,
3888,
13,
2202,
29901,
13,
1678,
903,
2774,
335,
29918,
6799,
353,
2875,
13,
19499,
4408,
2392,
29901,
13,
1678,
1209,
29871,
396,
5132,
529,
29871,
29906,
29889,
29906,
1838,
29915,
29873,
505,
525,
6799,
4286,
13,
13,
13,
1753,
903,
2774,
335,
29918,
842,
5552,
29918,
29876,
898,
8739,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
29892,
995,
29892,
2294,
29922,
29896,
1125,
13,
1678,
565,
313,
978,
1275,
376,
1366,
776,
29908,
1125,
13,
4706,
736,
1583,
29889,
1366,
29889,
776,
29898,
1767,
29897,
13,
1678,
565,
313,
978,
1275,
376,
1366,
29908,
1125,
13,
4706,
565,
1134,
29898,
1767,
467,
1649,
978,
1649,
1275,
525,
29903,
9192,
19737,
2061,
2396,
13,
9651,
1583,
17255,
8977,
1649,
29961,
978,
29962,
353,
995,
13,
9651,
736,
13,
1678,
1158,
353,
770,
29918,
1853,
17255,
2774,
335,
29918,
842,
23515,
26914,
657,
29898,
978,
29892,
6213,
29897,
13,
1678,
565,
1158,
29901,
13,
4706,
736,
1158,
29898,
1311,
29892,
995,
29897,
13,
1678,
565,
313,
1333,
2294,
1125,
13,
4706,
565,
903,
1482,
1990,
29901,
13,
9651,
1203,
17255,
842,
5552,
12035,
1311,
29892,
1024,
29892,
995,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
17255,
8977,
1649,
29961,
978,
29962,
353,
995,
13,
1678,
1683,
29901,
13,
4706,
12020,
23833,
2392,
703,
3492,
2609,
788,
8393,
304,
1273,
29879,
29908,
1273,
1583,
29897,
13,
13,
13,
1753,
903,
2774,
335,
29918,
842,
5552,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
29892,
995,
1125,
13,
1678,
736,
903,
2774,
335,
29918,
842,
5552,
29918,
29876,
898,
8739,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
29892,
995,
29892,
29871,
29900,
29897,
13,
13,
13,
1753,
903,
2774,
335,
29918,
657,
5552,
29918,
29876,
898,
8739,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
29892,
2294,
29922,
29896,
1125,
13,
1678,
565,
313,
978,
1275,
376,
1366,
776,
29908,
1125,
13,
4706,
736,
1583,
29889,
1366,
29889,
776,
580,
13,
1678,
1158,
353,
770,
29918,
1853,
17255,
2774,
335,
29918,
657,
23515,
26914,
657,
29898,
978,
29892,
6213,
29897,
13,
1678,
565,
1158,
29901,
13,
4706,
736,
1158,
29898,
1311,
29897,
13,
1678,
565,
313,
1333,
2294,
1125,
13,
4706,
736,
1203,
17255,
657,
5552,
12035,
1311,
29892,
1024,
29897,
13,
1678,
1683,
29901,
13,
4706,
12020,
23833,
2392,
29898,
978,
29897,
13,
13,
1753,
903,
2774,
335,
29918,
657,
5552,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
1125,
13,
1678,
736,
903,
2774,
335,
29918,
657,
5552,
29918,
29876,
898,
8739,
29898,
1311,
29892,
770,
29918,
1853,
29892,
1024,
29892,
29871,
29900,
29897,
13,
13,
13,
1753,
903,
2774,
335,
29918,
276,
558,
29898,
1311,
1125,
13,
1678,
1018,
29901,
13,
4706,
851,
1366,
353,
376,
14701,
310,
376,
718,
1583,
29889,
1366,
17255,
276,
558,
1649,
580,
13,
1678,
5174,
29901,
13,
4706,
851,
1366,
353,
5124,
13,
1678,
736,
9872,
29995,
29879,
29889,
29995,
29879,
29936,
1273,
29879,
1405,
29908,
1273,
313,
1311,
17255,
1990,
1649,
17255,
5453,
1649,
29892,
1583,
17255,
1990,
1649,
17255,
978,
1649,
29892,
851,
1366,
29892,
29897,
13,
13,
2202,
29901,
13,
1678,
903,
3318,
353,
1203,
13,
1678,
903,
1482,
1990,
353,
29871,
29896,
13,
19499,
23833,
2392,
29901,
13,
1678,
770,
903,
3318,
29901,
13,
4706,
1209,
13,
1678,
903,
1482,
1990,
353,
29871,
29900,
13,
13,
13,
2202,
29901,
13,
1678,
1053,
8062,
999,
13,
1678,
8062,
999,
29918,
14701,
353,
8062,
999,
29889,
14701,
13,
19499,
29901,
13,
1678,
8062,
999,
29918,
14701,
353,
14013,
921,
29901,
921,
13,
13,
13,
5215,
2967,
13,
1990,
3439,
14936,
29898,
3188,
29889,
8942,
29903,
5031,
616,
5015,
12425,
2642,
1125,
13,
1678,
4770,
2774,
335,
29918,
842,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
3188,
29889,
8942,
29903,
5031,
616,
5015,
12425,
2642,
5387,
13,
4706,
4770,
2774,
335,
29918,
842,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
842,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
842,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29892,
995,
29901,
903,
2774,
335,
29918,
842,
5552,
29898,
1311,
29892,
3439,
14936,
29892,
1024,
29892,
995,
29897,
13,
1678,
4770,
2774,
335,
29918,
657,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
3188,
29889,
8942,
29903,
5031,
616,
5015,
12425,
2642,
5387,
13,
4706,
4770,
2774,
335,
29918,
657,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
657,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
657,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29901,
903,
2774,
335,
29918,
657,
5552,
29898,
1311,
29892,
3439,
14936,
29892,
1024,
29897,
13,
1678,
4770,
276,
558,
1649,
353,
903,
2774,
335,
29918,
276,
558,
13,
13,
1678,
822,
14121,
18482,
7900,
647,
1860,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
18482,
7900,
647,
1860,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
4557,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
4557,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
1170,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
1170,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
4074,
1611,
2816,
1252,
8733,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
4074,
1611,
2816,
1252,
8733,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
16390,
398,
29923,
2608,
362,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
16390,
398,
29923,
2608,
362,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
1349,
837,
284,
8942,
2785,
1542,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
1349,
837,
284,
8942,
2785,
1542,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
25255,
292,
1123,
1548,
358,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
25255,
292,
1123,
1548,
358,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
22034,
786,
424,
29928,
575,
537,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
22034,
786,
424,
29928,
575,
537,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
22034,
786,
424,
3868,
271,
19907,
13992,
296,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
22034,
786,
424,
3868,
271,
19907,
13992,
296,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
22034,
786,
424,
3868,
271,
19907,
29903,
575,
1821,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
22034,
786,
424,
3868,
271,
19907,
29903,
575,
1821,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
22034,
786,
424,
5896,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
22034,
786,
424,
5896,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
6108,
666,
358,
5896,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
6108,
666,
358,
5896,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
20769,
292,
5896,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
20769,
292,
5896,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
22804,
29928,
719,
29933,
352,
29890,
15637,
3868,
1218,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
797,
2975,
29928,
719,
29933,
352,
29890,
15637,
3868,
1218,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
22804,
9662,
29950,
398,
333,
537,
3868,
1218,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
797,
2975,
9662,
29950,
398,
333,
537,
3868,
1218,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
22804,
29928,
719,
29933,
352,
29890,
15637,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
797,
2975,
29928,
719,
29933,
352,
29890,
15637,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
22804,
9662,
29950,
398,
333,
537,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
797,
2975,
9662,
29950,
398,
333,
537,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
512,
27722,
11609,
29909,
381,
29925,
2435,
398,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
797,
27722,
11609,
29909,
381,
29925,
2435,
398,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
3938,
557,
29909,
381,
17907,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
15666,
557,
29909,
381,
17907,
29907,
1507,
292,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
3938,
557,
29909,
381,
17907,
3868,
1218,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
15666,
557,
29909,
381,
17907,
3868,
1218,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1222,
2350,
504,
29909,
381,
17907,
19907,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
1252,
2350,
504,
29909,
381,
17907,
19907,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
18385,
29909,
381,
7277,
19907,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
29940,
18771,
29909,
381,
7277,
19907,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
27439,
936,
29909,
381,
7277,
19907,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
6816,
5083,
936,
29909,
381,
7277,
19907,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
21141,
8634,
1542,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
29963,
296,
8634,
1542,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4451,
2975,
29909,
381,
5894,
7435,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
3744,
2975,
29909,
381,
5894,
7435,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
7011,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
7011,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
29954,
2124,
5894,
14772,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
29954,
2124,
5894,
14772,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
29954,
2124,
29943,
10102,
13799,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
29954,
2124,
29943,
10102,
13799,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
6779,
29943,
10102,
13799,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
6779,
29943,
10102,
13799,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
29954,
2124,
24679,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
29954,
2124,
24679,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
6779,
24679,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
6779,
24679,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
6779,
29943,
10102,
13799,
8456,
1529,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
6779,
29943,
10102,
13799,
8456,
1529,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
15922,
519,
29943,
10102,
13799,
8456,
1529,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
15922,
519,
29943,
10102,
13799,
8456,
1529,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4134,
5620,
29918,
14936,
2059,
6678,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
2385,
5620,
29918,
14936,
2059,
6678,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4134,
5620,
29918,
14936,
1542,
28213,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
2385,
5620,
29918,
14936,
1542,
28213,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4134,
5620,
29918,
14936,
10900,
28213,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
2385,
5620,
29918,
14936,
10900,
28213,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4134,
5620,
29918,
14936,
10900,
8456,
1529,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
2385,
5620,
29918,
14936,
10900,
8456,
1529,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
22034,
786,
1934,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
22034,
786,
1934,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
16117,
786,
6906,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
6906,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
12790,
292,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
20769,
292,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
11243,
666,
358,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
6108,
666,
358,
4504,
11272,
7900,
10194,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1879,
14066,
1123,
6338,
800,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
7999,
14066,
1123,
6338,
800,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
14121,
797,
29903,
5031,
616,
7895,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
14936,
797,
29903,
5031,
616,
7895,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
6853,
630,
3247,
2386,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
29254,
630,
3247,
2386,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
6853,
630,
18868,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
29254,
630,
18868,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
445,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
1482,
29918,
8942,
14936,
10456,
5085,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
1366,
29889,
4397,
29898,
1366,
29897,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1366,
353,
445,
13,
13,
1678,
822,
903,
16513,
29898,
1311,
29892,
285,
29922,
29900,
29892,
274,
29922,
8516,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
1649,
16513,
29898,
1311,
29892,
285,
29892,
274,
29897,
13,
1678,
4770,
2774,
335,
29918,
20524,
1649,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8143,
29918,
8942,
14936,
13,
1678,
4770,
6144,
1649,
353,
14013,
1583,
29901,
6213,
13,
8942,
14936,
29918,
2774,
335,
9573,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
2774,
335,
9573,
13,
8942,
14936,
29918,
2774,
335,
9573,
29898,
8942,
14936,
29897,
13,
13,
1990,
3439,
14936,
29918,
22034,
786,
1000,
29898,
8942,
14936,
1125,
13,
1678,
4770,
2774,
335,
29918,
842,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
8942,
14936,
5387,
13,
4706,
4770,
2774,
335,
29918,
842,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
842,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
842,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29892,
995,
29901,
903,
2774,
335,
29918,
842,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29892,
1024,
29892,
995,
29897,
13,
1678,
4770,
2774,
335,
29918,
657,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
8942,
14936,
5387,
13,
4706,
4770,
2774,
335,
29918,
657,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
657,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
657,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29901,
903,
2774,
335,
29918,
657,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29892,
1024,
29897,
13,
1678,
4770,
276,
558,
1649,
353,
903,
2774,
335,
29918,
276,
558,
13,
13,
1678,
822,
323,
29906,
29946,
5261,
1123,
1341,
335,
15488,
29928,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
5261,
1123,
1341,
335,
15488,
29928,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
5261,
1123,
1341,
335,
18630,
4378,
4504,
287,
5620,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
5261,
1123,
1341,
335,
18630,
4378,
4504,
287,
5620,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
5261,
1123,
1341,
335,
13992,
296,
29943,
13857,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
5261,
1123,
1341,
335,
13992,
296,
29943,
13857,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
5261,
1123,
1341,
335,
29931,
520,
29943,
13857,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
5261,
1123,
1341,
335,
29931,
520,
29943,
13857,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
5261,
1123,
1341,
335,
9908,
29943,
13857,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
5261,
1123,
1341,
335,
9908,
29943,
13857,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
2369,
21367,
5709,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
2369,
21367,
5709,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
1252,
2350,
504,
29909,
381,
21459,
5894,
29950,
473,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
1252,
2350,
504,
29909,
381,
21459,
5894,
29950,
473,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
1252,
2350,
504,
5894,
13799,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
1252,
2350,
504,
5894,
13799,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
1252,
2350,
504,
5894,
14936,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
1252,
2350,
504,
5894,
14936,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
14510,
7032,
1252,
2350,
504,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
14510,
7032,
1252,
2350,
504,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
2928,
20769,
292,
10299,
4062,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
2928,
20769,
292,
10299,
4062,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
29928,
329,
29891,
1293,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
29928,
329,
29891,
1293,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
17907,
1293,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
17907,
1293,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
6513,
1293,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
6513,
1293,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
5568,
1293,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29968,
2335,
1252,
29882,
29950,
2092,
5568,
1293,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
28632,
1252,
29882,
19907,
1542,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
28632,
1252,
29882,
19907,
1542,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
20769,
292,
5709,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
20769,
292,
5709,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
29907,
593,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
29907,
593,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
19617,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
19617,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
10644,
13300,
1123,
29939,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
10644,
13300,
1123,
29939,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
12300,
2713,
6880,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
12300,
2713,
6880,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
12742,
1896,
865,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
12742,
1896,
865,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
29928,
29885,
299,
1666,
29886,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
29928,
29885,
299,
1666,
29886,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
2517,
13799,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
2517,
13799,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
6857,
29931,
20901,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
29924,
392,
20769,
29907,
29876,
11742,
3624,
6857,
29931,
20901,
29907,
29876,
11742,
29934,
415,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
15797,
2904,
523,
29934,
29939,
4378,
1252,
13300,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
15797,
2904,
523,
29934,
29939,
4378,
1252,
13300,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
14936,
6678,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
14936,
6678,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
323,
29906,
29946,
1168,
4984,
5709,
29941,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
29911,
29906,
29946,
1168,
4984,
5709,
29941,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
445,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
1482,
29918,
8942,
14936,
29918,
22034,
786,
1000,
10456,
5085,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
1366,
29889,
4397,
29898,
1366,
29897,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1366,
353,
445,
13,
13,
1678,
822,
903,
16513,
29898,
1311,
29892,
285,
29922,
29900,
29892,
274,
29922,
8516,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
1649,
16513,
29898,
1311,
29892,
285,
29892,
274,
29897,
13,
1678,
4770,
2774,
335,
29918,
20524,
1649,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8143,
29918,
8942,
14936,
29918,
22034,
786,
1000,
13,
1678,
4770,
6144,
1649,
353,
14013,
1583,
29901,
6213,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
2774,
335,
9573,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
2774,
335,
9573,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
2774,
335,
9573,
29898,
8942,
14936,
29918,
22034,
786,
1000,
29897,
13,
13,
1990,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29898,
8942,
14936,
29918,
22034,
786,
1000,
1125,
13,
1678,
4770,
2774,
335,
29918,
842,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
8942,
14936,
29918,
22034,
786,
1000,
5387,
13,
4706,
4770,
2774,
335,
29918,
842,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
842,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
842,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29892,
995,
29901,
903,
2774,
335,
29918,
842,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29892,
1024,
29892,
995,
29897,
13,
1678,
4770,
2774,
335,
29918,
657,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
8942,
14936,
29918,
22034,
786,
1000,
5387,
13,
4706,
4770,
2774,
335,
29918,
657,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
657,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
657,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29901,
903,
2774,
335,
29918,
657,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29892,
1024,
29897,
13,
1678,
4770,
276,
558,
1649,
353,
903,
2774,
335,
29918,
276,
558,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
445,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
1482,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
10456,
5085,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
1366,
29889,
4397,
29898,
1366,
29897,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1366,
353,
445,
13,
13,
1678,
822,
903,
16513,
29898,
1311,
29892,
285,
29922,
29900,
29892,
274,
29922,
8516,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
1649,
16513,
29898,
1311,
29892,
285,
29892,
274,
29897,
13,
1678,
4770,
2774,
335,
29918,
20524,
1649,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8143,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
13,
1678,
4770,
6144,
1649,
353,
14013,
1583,
29901,
6213,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
2774,
335,
9573,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
2774,
335,
9573,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
2774,
335,
9573,
29898,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29897,
13,
13,
1990,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29898,
3188,
29889,
16506,
29918,
9435,
1125,
13,
1678,
4770,
2774,
335,
29918,
842,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
3188,
29889,
16506,
29918,
9435,
5387,
13,
4706,
4770,
2774,
335,
29918,
842,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
842,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
842,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29892,
995,
29901,
903,
2774,
335,
29918,
842,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29892,
1024,
29892,
995,
29897,
13,
1678,
4770,
2774,
335,
29918,
657,
23515,
1649,
353,
6571,
13,
1678,
363,
903,
29879,
297,
518,
3188,
29889,
16506,
29918,
9435,
5387,
13,
4706,
4770,
2774,
335,
29918,
657,
23515,
26914,
5504,
29898,
657,
5552,
7373,
29879,
29892,
525,
1649,
2774,
335,
29918,
657,
23515,
1649,
742,
6571,
876,
13,
1678,
4770,
657,
5552,
1649,
353,
14013,
1583,
29892,
1024,
29901,
903,
2774,
335,
29918,
657,
5552,
29898,
1311,
29892,
3439,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29892,
1024,
29897,
13,
1678,
4770,
276,
558,
1649,
353,
903,
2774,
335,
29918,
276,
558,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
445,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
1482,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
10456,
5085,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
1366,
29889,
4397,
29898,
1366,
29897,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1366,
353,
445,
13,
13,
1678,
822,
3566,
29898,
1311,
29892,
302,
29892,
921,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
16645,
29898,
1311,
29892,
302,
29892,
921,
29897,
13,
13,
1678,
822,
3380,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
463,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1095,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
355,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
364,
463,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
29878,
463,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
7697,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
28759,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
472,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
271,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
4565,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
8862,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1250,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
1627,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
5503,
29918,
1627,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
5910,
29918,
1627,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1835,
29918,
1627,
29898,
1311,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
7323,
29918,
1627,
29898,
1311,
29897,
13,
13,
1678,
822,
1439,
496,
29918,
1627,
29898,
1311,
29892,
1835,
29922,
5574,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
4801,
496,
29918,
1627,
29898,
1311,
29892,
1835,
29897,
13,
13,
1678,
822,
4635,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
7851,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
604,
559,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
261,
559,
29898,
1311,
29892,
334,
5085,
29897,
13,
13,
1678,
822,
1439,
496,
29898,
1311,
29892,
2602,
29892,
364,
29892,
604,
559,
29922,
5574,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
4801,
496,
29898,
1311,
29892,
2602,
29892,
364,
29892,
604,
559,
29897,
13,
13,
1678,
822,
17945,
29898,
1311,
29892,
921,
1125,
13,
4706,
736,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
26276,
29898,
1311,
29892,
921,
29897,
13,
1678,
4770,
2774,
335,
29918,
20524,
1649,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8143,
29918,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
13,
1678,
4770,
6144,
1649,
353,
14013,
1583,
29901,
6213,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
2774,
335,
9573,
353,
903,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29889,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
2774,
335,
9573,
13,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29918,
2774,
335,
9573,
29898,
8942,
14936,
29918,
22034,
786,
1000,
29918,
4592,
29918,
16506,
29897,
13,
13,
29937,
910,
934,
338,
15878,
411,
1716,
22037,
322,
716,
29899,
3293,
4413,
29889,
13,
13,
13,
2
] |
chj/index/JType.py | aemcgraw/CodeHawk-Java | 0 | 194700 | <filename>chj/index/JType.py<gh_stars>0
# ------------------------------------------------------------------------------
# CodeHawk Java Analyzer
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 Kestrel Technology LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ------------------------------------------------------------------------------
import chj.index.JDictionaryRecord as JD
class JavaTypesBase(JD.JDictionaryRecord):
def __init__(self,tpd,index,tags,args):
JD.JDictionaryRecord.__init__(self,index,tags,args)
self.tpd = tpd
def get_scalar_size(self): return 4
def is_scalar(self): return False
def is_array(self): return False
def is_object(self): return False
def __str__(self): return 'javatypesbase'
class StringConstant(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_string(self):
if len(self.tags) > 0:
return self.tags[0]
else:
return ''
def get_string_length(self): return int(self.args[0])
def is_hex(self): return len(self.tags) > 1
def __str__(self):
if self.is_hex():
return ('(' + str(self.get_string_length()) + '-char-string' +')')
else:
return self.get_string()
class ClassObjectType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class(self): return self.tpd.jd.get_cn(int(self.args[0]))
def is_object(self): return True
def __str__(self): return str(self.get_class())
class ArrayObjectType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def is_object_array_type(self): return True
def is_array(self): return True
def get_value_type(self): return self.tpd.get_value_type(int(self.args[0]))
def __str__(self): return str(self.get_value_type())
class ObjectValueType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def is_object_value_type(self): return True
def is_object_type(self): return True
def is_object(self): return True
def is_array_type(self): return self.get_object_type().is_object_array_type()
def get_object_type(self): return self.tpd.get_object_type(int(self.args[0]))
def get_class(self): return self.get_object_type().get_class()
def __str__(self): return str(self.get_object_type())
class BasicValueType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_scalar_size(self):
if self.is_long() or self.is_double():
return 8
else:
return 4
def is_basic_type(self): return True
def is_scalara(self): return True
def is_long(self): return self.tags[1] == 'L'
def is_double(self): return self.tags[1] == 'D'
def get_basic_type(self): return self.tags[1]
def __str__(self): return str(self.get_basic_type())
class MethodDescriptor(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def has_return_value(self): return int(self.args[0]) == 1
def get_return_type(self):
if self.has_return_value():
return self.tpd.get_value_type(int(self.args[1]))
def get_argument_types(self):
if self.has_return_value():
return [ self.tpd.get_value_type(int(x)) for x in self.args[2:] ]
else:
return [ self.tpd.get_value_type(int(x)) for x in self.args[1:] ]
def __str__(self):
sreturn = '' if self.get_return_type() is None else str(self.get_return_type())
return ('(' + ','.join([ str(x) for x in self.get_argument_types()])
+ ')' + sreturn )
class ValueDescriptor(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_value_type(self): return self.tpd.get_value_type(int(self.args[0]))
def __str__(self): return 'descr:' + str(self.get_value_type())
class ConstString(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_string(self): return self.tpd.get_string(int(self.args[0]))
def __str__(self): return self.get_string()
class ConstInt(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_int(self): return int(self.args[0])
def __str__(self): return str(self.get_int())
class ConstFloat(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_float(self): return float(self.tags[1])
def __str__(self): return self.tags[1]
def ConstLong(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_long(self): return int(self.tags[1])
def __str__(self): return self.tags[1]
class ConstDouble(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_double(self): return float(tags[1])
def __str__(self): return tags[1]
class ConstClass(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class(self):
return self.tpd.get_object_type(int(self.args[0]))
def __str__(self): return str(self.get_class())
class FieldHandle(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class_name(self):
return self.tpd.jd.get_class(int(self.args[0]))
def get_field_signature(self):
return self.tpd.jd.get_field_signature(int(self.args[1]))
def __str__(self):
return str(self.get_class_name()) + ':' + str(self.get_field_signature())
class MethodHandle(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_object_type(self):
return self.tpd.get_object_type(int(self.args[0]))
def get_method_signature(self):
return self.tpd.jd.get_method_signature(int(self.args[1]))
def __str__(self):
return str(self.get_object_type()) + ':' + str(self.get_method_signature())
class InterfaceHandle(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class_name(self):
return self.tpd.jd.get_class(int(self.args[0]))
def get_method_signature(self):
return self.tpd.jd.get_method+signature(int(self.args[1]))
def __str__(self):
return str(self.get_class_name()) + ':' + str(self.get_method_signature())
class ConstValue(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_constant_value(self):
return self.jd.get_constant_value(self.args[0])
def __str__(self): return 'C:' + str(self.get_constant_value())
class ConstField(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class_name(self):
return self.tpd.jd.get_cn(int(self.args[0]))
def get_field_signature(self):
return self.tpd.jd.get_field_signature(int(self.args[1]))
def __str__(self):
return 'C:' + str(self.get_class_name()) + '.' + str(self.get_field_signature())
class ConstMethod(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_object_type(self):
return self.tpd.get_object_type(int(args[0]))
def get_method_signature(self):
return self.tpd.jd.get_method_signature(int(args[1]))
def __str__(self):
return 'C:' + str(self.get_object_type()) + '.' + str(self.get_method_signature())
class ConstInterfaceMethod(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_class_name(self):
return self.tpd.jd.get_cn(int(self.args[0]))
def get_method_signature(self):
return self.tpd.jd.get_method_signature(int(self.args[1]))
def __str__(self):
return 'C:' + str(self.get_class_name()) + '.' + str(self.get_method_signature())
class ConstDynamicMethod(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_bootstrap_method_index(self):
return int(self.args[0])
def get_method_signature(self):
return self.tpd.jd.get_method_signature(int(self.args[1]))
def __str__(self):
return ('C:Dynamic(' + str(self.get_bootstrap_mehtod_index()) + ').'
+ str(self.get_method_signature()))
class ConstNameAndType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_name(self):
return self.tpd.get_string(int(self.args[0]))
def get_type(self):
return self.tpd.get_descriptor(int(self.args[1]))
def __str__(self): return 'CNT:' + self.get_name() + ':' + str(self.get_type())
class ConstStringUTF8(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_string(self):
return self.tpd.get_string(int(args[0]))
def __str__(self): return 'C:' + self.get_string()
class ConstMethodHandle(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_reference_kind(self): return self.tags[1]
def get_method_handle_type(self):
return self.tpd.get_method_handle_type(int(self.args[0]))
def __str__(self):
return ('C:' + str(self.get_method_handle_type())
+ '(' + self.get_reference_kind() + ')')
class ConstMethodType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_method_descriptor(self):
return self.tpd.get_method_descriptor(int(self.args[0]))
def __str__(self):
return 'C:' + str(self.get_method_descriptor())
class ConstUnusable(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def __str__(self): return 'unusable'
class BootstrapArgConstantValue(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_constant_value(self):
return self.tpd.get_constant_value(int(self.args[0]))
def __str__(self): return str(self.get_constant_value())
class BootstrapArgMethodHandle(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_reference_kind(self): return self.tags[1]
def get_method_handle_type(self):
return self.jd.get_method_handle_type(int(self.args[0]))
def __str__(self):
return (str(self.get_method_handle_type())
+ '(' + self.get_reference_kind() + ')')
class BootstrapArgMethodType(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_method_descriptor(self):
return self.tpd.get_method_descriptor(int(self.args[0]))
def __str__(self): return str(self.get_method_descriptor())
class BootstrapMethodData(JavaTypesBase):
def __init__(self,tpd,index,tags,args):
JavaTypesBase.__init__(self,tpd,index,tags,args)
def get_reference_kind(self): return self.tags[1]
def get_method_handle_type(self):
return self.tpd.get_method_handle_type(int(self.args[0]))
def get_arguments(self):
return [ self.tpd.get_bootstrap_argument(int(x)) for x in self.args[1:] ]
def __str__(self):
return (str(self.get_method_handle_types()) + '('
+ ','.join([ str(x) for x in self.get_arguments() ]) + ')')
| [
1,
529,
9507,
29958,
305,
29926,
29914,
2248,
29914,
29967,
1542,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
29937,
5920,
29950,
20011,
3355,
11597,
29891,
3298,
13,
29937,
13361,
29901,
529,
5813,
29958,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
29937,
450,
341,
1806,
19245,
313,
26349,
29897,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29953,
29899,
29906,
29900,
29896,
29929,
476,
342,
2674,
17968,
365,
12182,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
29871,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
13,
5215,
521,
29926,
29889,
2248,
29889,
29967,
11513,
9182,
408,
435,
29928,
13,
13,
1990,
3355,
10562,
5160,
29898,
29967,
29928,
29889,
29967,
11513,
9182,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
435,
29928,
29889,
29967,
11513,
9182,
17255,
2344,
12035,
1311,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
4706,
1583,
29889,
9392,
29881,
353,
260,
15926,
13,
13,
1678,
822,
679,
29918,
19529,
279,
29918,
2311,
29898,
1311,
1125,
736,
29871,
29946,
13,
13,
1678,
822,
338,
29918,
19529,
279,
29898,
1311,
1125,
736,
7700,
13,
13,
1678,
822,
338,
29918,
2378,
29898,
1311,
1125,
736,
7700,
13,
13,
1678,
822,
338,
29918,
3318,
29898,
1311,
1125,
736,
7700,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
9494,
271,
7384,
3188,
29915,
13,
13,
13,
1990,
1714,
12075,
424,
29898,
8404,
10562,
5160,
1125,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1807,
29898,
1311,
1125,
13,
4706,
565,
7431,
29898,
1311,
29889,
11338,
29897,
1405,
29871,
29900,
29901,
13,
9651,
736,
1583,
29889,
11338,
29961,
29900,
29962,
13,
4706,
1683,
29901,
13,
9651,
736,
6629,
13,
13,
1678,
822,
679,
29918,
1807,
29918,
2848,
29898,
1311,
1125,
736,
938,
29898,
1311,
29889,
5085,
29961,
29900,
2314,
13,
13,
1678,
822,
338,
29918,
20970,
29898,
1311,
1125,
736,
7431,
29898,
1311,
29889,
11338,
29897,
1405,
29871,
29896,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
565,
1583,
29889,
275,
29918,
20970,
7295,
13,
9651,
736,
6702,
877,
718,
851,
29898,
1311,
29889,
657,
29918,
1807,
29918,
2848,
3101,
718,
17411,
3090,
29899,
1807,
29915,
718,
1495,
1495,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
657,
29918,
1807,
580,
13,
13,
13,
1990,
4134,
2061,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29898,
1311,
1125,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
18038,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
338,
29918,
3318,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
1990,
3101,
13,
13,
13,
1990,
4398,
2061,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
338,
29918,
3318,
29918,
2378,
29918,
1853,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
2378,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
679,
29918,
1767,
29918,
1853,
29898,
1311,
1125,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1767,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
1767,
29918,
1853,
3101,
13,
13,
308,
13,
1990,
4669,
1917,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
338,
29918,
3318,
29918,
1767,
29918,
1853,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
3318,
29918,
1853,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
3318,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
2378,
29918,
1853,
29898,
1311,
1125,
736,
1583,
29889,
657,
29918,
3318,
29918,
1853,
2141,
275,
29918,
3318,
29918,
2378,
29918,
1853,
580,
13,
13,
1678,
822,
679,
29918,
3318,
29918,
1853,
29898,
1311,
1125,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
3318,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
1990,
29898,
1311,
1125,
736,
1583,
29889,
657,
29918,
3318,
29918,
1853,
2141,
657,
29918,
1990,
580,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
3318,
29918,
1853,
3101,
13,
13,
13,
1990,
19219,
1917,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
19529,
279,
29918,
2311,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
275,
29918,
5426,
580,
470,
1583,
29889,
275,
29918,
8896,
7295,
13,
9651,
736,
29871,
29947,
13,
4706,
1683,
29901,
13,
9651,
736,
29871,
29946,
13,
13,
1678,
822,
338,
29918,
16121,
29918,
1853,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
19529,
2518,
29898,
1311,
1125,
736,
5852,
13,
13,
1678,
822,
338,
29918,
5426,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
1275,
525,
29931,
29915,
13,
13,
1678,
822,
338,
29918,
8896,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
1275,
525,
29928,
29915,
13,
13,
1678,
822,
679,
29918,
16121,
29918,
1853,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
16121,
29918,
1853,
3101,
13,
13,
13,
1990,
8108,
19124,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
756,
29918,
2457,
29918,
1767,
29898,
1311,
1125,
736,
938,
29898,
1311,
29889,
5085,
29961,
29900,
2314,
1275,
29871,
29896,
13,
13,
1678,
822,
679,
29918,
2457,
29918,
1853,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5349,
29918,
2457,
29918,
1767,
7295,
13,
9651,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1767,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
679,
29918,
23516,
29918,
8768,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5349,
29918,
2457,
29918,
1767,
7295,
13,
9651,
736,
518,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1767,
29918,
1853,
29898,
524,
29898,
29916,
876,
363,
921,
297,
1583,
29889,
5085,
29961,
29906,
17531,
4514,
13,
4706,
1683,
29901,
13,
9651,
736,
518,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1767,
29918,
1853,
29898,
524,
29898,
29916,
876,
363,
921,
297,
1583,
29889,
5085,
29961,
29896,
17531,
4514,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
269,
2457,
353,
6629,
565,
1583,
29889,
657,
29918,
2457,
29918,
1853,
580,
338,
6213,
1683,
851,
29898,
1311,
29889,
657,
29918,
2457,
29918,
1853,
3101,
13,
4706,
736,
6702,
877,
718,
13420,
4286,
7122,
4197,
851,
29898,
29916,
29897,
363,
921,
297,
1583,
29889,
657,
29918,
23516,
29918,
8768,
580,
2314,
13,
462,
1678,
718,
525,
16029,
718,
269,
2457,
1723,
13,
13,
13,
1990,
7865,
19124,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1767,
29918,
1853,
29898,
1311,
1125,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1767,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
2783,
7283,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
1767,
29918,
1853,
3101,
13,
13,
13,
1990,
5798,
1231,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1807,
29898,
1311,
1125,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1807,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
1583,
29889,
657,
29918,
1807,
580,
13,
13,
13,
1990,
5798,
2928,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
524,
29898,
1311,
1125,
736,
938,
29898,
1311,
29889,
5085,
29961,
29900,
2314,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
524,
3101,
13,
13,
13,
1990,
5798,
11031,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
7411,
29898,
1311,
1125,
736,
5785,
29898,
1311,
29889,
11338,
29961,
29896,
2314,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
13,
1753,
5798,
8208,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5426,
29898,
1311,
1125,
736,
938,
29898,
1311,
29889,
11338,
29961,
29896,
2314,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
13,
1990,
5798,
11843,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
8896,
29898,
1311,
1125,
736,
5785,
29898,
11338,
29961,
29896,
2314,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
8282,
29961,
29896,
29962,
13,
13,
13,
1990,
5798,
2385,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
3318,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
1990,
3101,
13,
13,
13,
1990,
8989,
13554,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29918,
978,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
1990,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
2671,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
2671,
29918,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
657,
29918,
1990,
29918,
978,
3101,
718,
525,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
2671,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
8108,
13554,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
3318,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
3318,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
5696,
29918,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
657,
29918,
3318,
29918,
1853,
3101,
718,
525,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
25796,
13554,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29918,
978,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
1990,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
5696,
29974,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
657,
29918,
1990,
29918,
978,
3101,
718,
525,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
5798,
1917,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
23362,
29918,
1767,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
26012,
29889,
657,
29918,
23362,
29918,
1767,
29898,
1311,
29889,
5085,
29961,
29900,
2314,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
23362,
29918,
1767,
3101,
13,
13,
13,
1990,
5798,
3073,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29918,
978,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
18038,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
2671,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
2671,
29918,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
525,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
1990,
29918,
978,
3101,
718,
525,
6169,
718,
851,
29898,
1311,
29889,
657,
29918,
2671,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
5798,
4062,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
3318,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
3318,
29918,
1853,
29898,
524,
29898,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
5696,
29918,
4530,
1535,
29898,
524,
29898,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
525,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
3318,
29918,
1853,
3101,
718,
525,
6169,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
5798,
10448,
4062,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1990,
29918,
978,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
18038,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
5696,
29918,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
525,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
1990,
29918,
978,
3101,
718,
525,
6169,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
4530,
1535,
3101,
13,
13,
13,
1990,
5798,
24001,
4062,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
8704,
29918,
5696,
29918,
2248,
29898,
1311,
1125,
13,
4706,
736,
938,
29898,
1311,
29889,
5085,
29961,
29900,
2314,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
4530,
1535,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
26012,
29889,
657,
29918,
5696,
29918,
4530,
1535,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
6702,
29907,
29901,
24001,
877,
718,
851,
29898,
1311,
29889,
657,
29918,
8704,
29918,
1004,
400,
397,
29918,
2248,
3101,
718,
525,
467,
29915,
13,
462,
1678,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
4530,
1535,
22130,
13,
13,
13,
1990,
5798,
1170,
2855,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
978,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1807,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
2783,
11709,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29896,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
13778,
29911,
11283,
718,
1583,
29889,
657,
29918,
978,
580,
718,
525,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
1853,
3101,
13,
13,
13,
1990,
5798,
1231,
10496,
29947,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
1807,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
1807,
29898,
524,
29898,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
29907,
11283,
718,
1583,
29889,
657,
29918,
1807,
580,
13,
13,
13,
1990,
5798,
4062,
13554,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5679,
29918,
14380,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
6702,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
8411,
29918,
1853,
3101,
13,
462,
1678,
718,
525,
877,
718,
1583,
29889,
657,
29918,
5679,
29918,
14380,
580,
718,
25710,
1495,
13,
13,
13,
1990,
5798,
4062,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
2783,
11709,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
5696,
29918,
2783,
11709,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
525,
29907,
11283,
718,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
2783,
11709,
3101,
13,
13,
13,
1990,
5798,
2525,
27979,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
525,
348,
27979,
29915,
13,
13,
13,
1990,
25746,
8559,
12075,
424,
1917,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
23362,
29918,
1767,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
23362,
29918,
1767,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
23362,
29918,
1767,
3101,
13,
13,
13,
1990,
25746,
8559,
4062,
13554,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5679,
29918,
14380,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
26012,
29889,
657,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
313,
710,
29898,
1311,
29889,
657,
29918,
5696,
29918,
8411,
29918,
1853,
3101,
13,
462,
1678,
718,
525,
877,
718,
1583,
29889,
657,
29918,
5679,
29918,
14380,
580,
718,
25710,
1495,
13,
13,
13,
1990,
25746,
8559,
4062,
1542,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
2783,
11709,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
5696,
29918,
2783,
11709,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
736,
851,
29898,
1311,
29889,
657,
29918,
5696,
29918,
2783,
11709,
3101,
13,
13,
13,
1990,
25746,
4062,
1469,
29898,
8404,
10562,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
1125,
13,
4706,
3355,
10562,
5160,
17255,
2344,
12035,
1311,
29892,
9392,
29881,
29892,
2248,
29892,
11338,
29892,
5085,
29897,
13,
13,
1678,
822,
679,
29918,
5679,
29918,
14380,
29898,
1311,
1125,
736,
1583,
29889,
11338,
29961,
29896,
29962,
13,
13,
1678,
822,
679,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9392,
29881,
29889,
657,
29918,
5696,
29918,
8411,
29918,
1853,
29898,
524,
29898,
1311,
29889,
5085,
29961,
29900,
12622,
13,
13,
1678,
822,
679,
29918,
25699,
29898,
1311,
1125,
13,
4706,
736,
518,
1583,
29889,
9392,
29881,
29889,
657,
29918,
8704,
29918,
23516,
29898,
524,
29898,
29916,
876,
363,
921,
297,
1583,
29889,
5085,
29961,
29896,
17531,
4514,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
313,
710,
29898,
1311,
29889,
657,
29918,
5696,
29918,
8411,
29918,
8768,
3101,
718,
525,
877,
13,
462,
1678,
718,
13420,
4286,
7122,
4197,
851,
29898,
29916,
29897,
363,
921,
297,
1583,
29889,
657,
29918,
25699,
580,
29871,
2314,
718,
25710,
1495,
13,
2
] |
code/df_data_struct.py | jrihds/pdat.github.io | 0 | 170392 | #!/usr/bin/env python3
"""Creating a dataframe from a dict or list."""
import pandas as pd
d = {"a": [1, 2, 3],
"b": [4, 5, 6],
"c": [7, 8, 9]}
l = [[1,4,7],
[2,5,8],
[3,6,9]]
df = pd.DataFrame(d)
print(df)
df = pd.DataFrame(l)
df.columns = ['a', 'b', 'c']
print(df)
# a b c
# 0 1 4 7
# 1 2 5 8
# 2 3 6 9
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
15945,
29908,
9832,
1218,
263,
12205,
515,
263,
9657,
470,
1051,
1213,
15945,
13,
13,
5215,
11701,
408,
10518,
13,
13,
29881,
353,
8853,
29874,
1115,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
13,
268,
376,
29890,
1115,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
13,
268,
376,
29883,
1115,
518,
29955,
29892,
29871,
29947,
29892,
29871,
29929,
12258,
13,
13,
29880,
353,
5519,
29896,
29892,
29946,
29892,
29955,
1402,
13,
268,
518,
29906,
29892,
29945,
29892,
29947,
1402,
13,
268,
518,
29941,
29892,
29953,
29892,
29929,
5262,
13,
13,
2176,
353,
10518,
29889,
17271,
29898,
29881,
29897,
13,
2158,
29898,
2176,
29897,
13,
13,
2176,
353,
10518,
29889,
17271,
29898,
29880,
29897,
13,
2176,
29889,
13099,
353,
6024,
29874,
742,
525,
29890,
742,
525,
29883,
2033,
13,
2158,
29898,
2176,
29897,
13,
13,
29937,
1678,
263,
29871,
289,
29871,
274,
13,
29937,
29871,
29900,
259,
29896,
259,
29946,
259,
29955,
13,
29937,
29871,
29896,
259,
29906,
259,
29945,
259,
29947,
13,
29937,
29871,
29906,
259,
29941,
259,
29953,
259,
29929,
13,
2
] |
source/energy_function.py | Bolt64/protein_lab | 0 | 59333 | <gh_stars>0
#!/usr/bin/env python
import get_atom_distances as gad
import itertools as it
import pdb_parser as parser
lj_potential = lambda distance, rm: (rm/distance)**12 - 2*(rm/distance)**6
def get_energy(pdb_file, rm_file):
energy=0
rm_values=gad.read_labeled_pairs(rm_file)
for atom1,atom2 in it.combinations(parser.parse_file(pdb_file), 2):
key=tuple(sorted(((atom1['resName'], atom1['name']),(atom2['resName'], atom2['name']))))
if key in rm_values:
energy+=lj_potential(gad.get_distance(atom1, atom2), rm_values[key])
return energy
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
679,
29918,
8678,
29918,
5721,
2925,
408,
330,
328,
13,
5215,
4256,
8504,
408,
372,
13,
5215,
282,
2585,
29918,
16680,
408,
13812,
13,
13,
14042,
29918,
17765,
2556,
353,
14013,
5418,
29892,
20241,
29901,
313,
1758,
29914,
19244,
29897,
1068,
29896,
29906,
448,
29871,
29906,
16395,
1758,
29914,
19244,
29897,
1068,
29953,
13,
13,
1753,
679,
29918,
27548,
29898,
29886,
2585,
29918,
1445,
29892,
20241,
29918,
1445,
1125,
13,
1678,
5864,
29922,
29900,
13,
1678,
20241,
29918,
5975,
29922,
29887,
328,
29889,
949,
29918,
29880,
24025,
29918,
29886,
7121,
29898,
1758,
29918,
1445,
29897,
13,
1678,
363,
12301,
29896,
29892,
8678,
29906,
297,
372,
29889,
510,
2109,
800,
29898,
16680,
29889,
5510,
29918,
1445,
29898,
29886,
2585,
29918,
1445,
511,
29871,
29906,
1125,
13,
4706,
1820,
29922,
23583,
29898,
24582,
3552,
29898,
8678,
29896,
1839,
690,
1170,
7464,
12301,
29896,
1839,
978,
2033,
21336,
8678,
29906,
1839,
690,
1170,
7464,
12301,
29906,
1839,
978,
2033,
13697,
13,
4706,
565,
1820,
297,
20241,
29918,
5975,
29901,
13,
9651,
5864,
23661,
14042,
29918,
17765,
2556,
29898,
29887,
328,
29889,
657,
29918,
19244,
29898,
8678,
29896,
29892,
12301,
29906,
511,
20241,
29918,
5975,
29961,
1989,
2314,
13,
1678,
736,
5864,
13,
2
] |
lib/Site.py | EthanZeigler/pastebin_scraper | 0 | 36989 | from queue import Queue
import time
from settings import USE_DB, DB_DB, DB_DUMP_TABLE, DB_ACCT_TABLE, REQUEST_SPACING
import logging
from . import helper
import sqlite3
import threading
class Site(object):
'''
Site - parent class used for a generic
'Queue' structure with a few helper methods
and features. Implements the following methods:
empty() - Is the Queue empty
get(): Get the next item in the queue
put(item): Puts an item in the queue
tail(): Shows the last item in the queue
peek(): Shows the next item in the queue
length(): Returns the length of the queue
clear(): Clears the queue
list(): Lists the contents of the Queue
download(url): Returns the content from the URL
'''
# Note from Jordan (original author)
# I would have used the built-in queue, but there is no support for a peek() method
# that I could find... So, I decided to implement my own queue with a few
# changes
def __init__(self, queue=None):
if queue is None:
self.queue = []
def empty(self):
return len(self.queue) == 0
def get(self):
if not self.empty():
result = self.queue[0]
del self.queue[0]
else:
result = None
return result
def put(self, item):
self.queue.append(item)
def peek(self):
return self.queue[0] if not self.empty() else None
def tail(self):
return self.queue[-1] if not self.empty() else None
def length(self):
return len(self.queue)
def clear(self):
self.queue = []
def list(self):
print('\n'.join(url for url in self.queue))
def monitor(self, t_lock, db_lock, db_client):
self.update()
while(1):
while not self.empty():
paste = self.get()
self.ref_id = paste.id
logging.info('[*] Checking + Spacer ' + paste.url)
paste.text = self.get_paste_text(paste)
time.sleep(REQUEST_SPACING)
interesting = helper.run_match(paste)
if interesting:
logging.info('[*] FOUND ' + (paste.type).upper() + ' ' + paste.url)
if USE_DB:
db_lock.acquire()
try:
cursor = db_client.cursor()
cursor.execute('''INSERT INTO %s (
text,
emails,
hashes,
num_emails,
num_hashes,
type,
db_keywords,
url,
author
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?
)''' % (DB_DUMP_TABLE), (paste.text, str(paste.emails), str(paste.hashes), paste.num_emails, paste.num_hashes, paste.type, str(paste.db_keywords), str("https://pastebin.com/"+paste.id), paste.author,))
except:
logging.info('[*] ERROR: Failed to save paste. Manual review: ' + paste.url)
db_lock.release()
self.update()
while self.empty():
logging.debug('[*] No results... sleeping')
time.sleep(self.sleep)
self.update()
| [
1,
515,
9521,
1053,
5462,
434,
30004,
13,
5215,
931,
30004,
13,
3166,
6055,
1053,
501,
1660,
29918,
4051,
29892,
6535,
29918,
4051,
29892,
6535,
29918,
14849,
3580,
29918,
21009,
29892,
6535,
29918,
2477,
1783,
29918,
21009,
29892,
5195,
14130,
29918,
5550,
2477,
4214,
30004,
13,
5215,
12183,
30004,
13,
3166,
869,
1053,
16876,
30004,
13,
5215,
21120,
29941,
30004,
13,
5215,
3244,
292,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
1990,
10781,
29898,
3318,
1125,
30004,
13,
1678,
14550,
30004,
13,
1678,
10781,
448,
3847,
770,
1304,
363,
263,
10035,
30004,
13,
1678,
525,
10620,
29915,
3829,
411,
263,
2846,
16876,
3519,
30004,
13,
1678,
322,
5680,
29889,
1954,
9711,
278,
1494,
3519,
29901,
30004,
13,
30004,
13,
9651,
4069,
580,
448,
1317,
278,
5462,
434,
4069,
30004,
13,
9651,
679,
7295,
3617,
278,
2446,
2944,
297,
278,
9521,
30004,
13,
9651,
1925,
29898,
667,
1125,
349,
8842,
385,
2944,
297,
278,
9521,
30004,
13,
9651,
12464,
7295,
1383,
1242,
278,
1833,
2944,
297,
278,
9521,
30004,
13,
9651,
1236,
1416,
7295,
1383,
1242,
278,
2446,
2944,
297,
278,
9521,
30004,
13,
9651,
3309,
7295,
16969,
278,
3309,
310,
278,
9521,
30004,
13,
9651,
2821,
7295,
21386,
1503,
278,
9521,
30004,
13,
9651,
1051,
7295,
2391,
29879,
278,
8118,
310,
278,
5462,
434,
30004,
13,
9651,
5142,
29898,
2271,
1125,
16969,
278,
2793,
515,
278,
3988,
30004,
13,
30004,
13,
1678,
14550,
30004,
13,
1678,
396,
3940,
515,
18284,
313,
13492,
4148,
8443,
13,
4706,
396,
306,
723,
505,
1304,
278,
4240,
29899,
262,
9521,
29892,
541,
727,
338,
694,
2304,
363,
263,
1236,
1416,
580,
1158,
30004,
13,
4706,
396,
393,
306,
1033,
1284,
856,
1105,
29892,
306,
8459,
304,
2334,
590,
1914,
9521,
411,
263,
2846,
30004,
13,
4706,
396,
3620,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9521,
29922,
8516,
1125,
30004,
13,
4706,
565,
9521,
338,
6213,
29901,
30004,
13,
9651,
1583,
29889,
9990,
353,
5159,
30004,
13,
30004,
13,
1678,
822,
4069,
29898,
1311,
1125,
30004,
13,
4706,
736,
7431,
29898,
1311,
29889,
9990,
29897,
1275,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
679,
29898,
1311,
1125,
30004,
13,
4706,
565,
451,
1583,
29889,
6310,
7295,
30004,
13,
9651,
1121,
353,
1583,
29889,
9990,
29961,
29900,
29962,
30004,
13,
9651,
628,
1583,
29889,
9990,
29961,
29900,
29962,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
1121,
353,
6213,
30004,
13,
4706,
736,
1121,
30004,
13,
30004,
13,
1678,
822,
1925,
29898,
1311,
29892,
2944,
1125,
30004,
13,
4706,
1583,
29889,
9990,
29889,
4397,
29898,
667,
8443,
13,
30004,
13,
1678,
822,
1236,
1416,
29898,
1311,
1125,
30004,
13,
4706,
736,
1583,
29889,
9990,
29961,
29900,
29962,
565,
451,
1583,
29889,
6310,
580,
1683,
6213,
30004,
13,
30004,
13,
1678,
822,
12464,
29898,
1311,
1125,
30004,
13,
4706,
736,
1583,
29889,
9990,
14352,
29896,
29962,
565,
451,
1583,
29889,
6310,
580,
1683,
6213,
30004,
13,
30004,
13,
1678,
822,
3309,
29898,
1311,
1125,
30004,
13,
4706,
736,
7431,
29898,
1311,
29889,
9990,
8443,
13,
30004,
13,
1678,
822,
2821,
29898,
1311,
1125,
30004,
13,
4706,
1583,
29889,
9990,
353,
5159,
30004,
13,
30004,
13,
1678,
822,
1051,
29898,
1311,
1125,
30004,
13,
4706,
1596,
28909,
29876,
4286,
7122,
29898,
2271,
363,
3142,
297,
1583,
29889,
9990,
876,
30004,
13,
30004,
13,
1678,
822,
11819,
29898,
1311,
29892,
260,
29918,
908,
29892,
4833,
29918,
908,
29892,
4833,
29918,
4645,
1125,
30004,
13,
4706,
1583,
29889,
5504,
26471,
13,
4706,
1550,
29898,
29896,
1125,
30004,
13,
9651,
1550,
451,
1583,
29889,
6310,
7295,
30004,
13,
18884,
11417,
353,
1583,
29889,
657,
26471,
13,
18884,
1583,
29889,
999,
29918,
333,
353,
11417,
29889,
333,
30004,
13,
18884,
12183,
29889,
3888,
877,
29961,
29930,
29962,
5399,
292,
718,
1706,
562,
261,
525,
718,
11417,
29889,
2271,
8443,
13,
18884,
11417,
29889,
726,
353,
1583,
29889,
657,
29918,
16179,
29918,
726,
29898,
16179,
8443,
13,
18884,
931,
29889,
17059,
29898,
16244,
29918,
5550,
2477,
4214,
8443,
13,
18884,
8031,
353,
16876,
29889,
3389,
29918,
4352,
29898,
16179,
8443,
13,
18884,
565,
8031,
29901,
30004,
13,
462,
1678,
12183,
29889,
3888,
877,
29961,
29930,
29962,
18322,
18783,
525,
718,
313,
16179,
29889,
1853,
467,
21064,
580,
718,
525,
525,
718,
29871,
11417,
29889,
2271,
8443,
13,
462,
1678,
565,
501,
1660,
29918,
4051,
29901,
30004,
13,
462,
4706,
4833,
29918,
908,
29889,
562,
1548,
26471,
13,
462,
4706,
1018,
29901,
30004,
13,
462,
9651,
10677,
353,
29871,
4833,
29918,
4645,
29889,
18127,
26471,
13,
462,
9651,
10677,
29889,
7978,
877,
4907,
19460,
11646,
1273,
29879,
313,
30004,
13,
462,
18884,
1426,
11167,
13,
462,
18884,
24609,
11167,
13,
462,
18884,
6608,
267,
11167,
13,
462,
18884,
954,
29918,
331,
2234,
11167,
13,
462,
18884,
954,
29918,
8568,
267,
11167,
13,
462,
18884,
1134,
11167,
13,
462,
18884,
4833,
29918,
1989,
9303,
11167,
13,
462,
18884,
3142,
11167,
13,
462,
18884,
4148,
30004,
13,
462,
9651,
1723,
15673,
313,
30004,
13,
462,
18884,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
30004,
13,
462,
9651,
1723,
12008,
1273,
313,
4051,
29918,
14849,
3580,
29918,
21009,
511,
313,
16179,
29889,
726,
29892,
851,
29898,
16179,
29889,
331,
2234,
511,
851,
29898,
16179,
29889,
8568,
267,
511,
11417,
29889,
1949,
29918,
331,
2234,
29892,
11417,
29889,
1949,
29918,
8568,
267,
29892,
11417,
29889,
1853,
29892,
851,
29898,
16179,
29889,
2585,
29918,
1989,
9303,
511,
851,
703,
991,
597,
16179,
2109,
29889,
510,
12975,
29974,
16179,
29889,
333,
511,
11417,
29889,
8921,
29892,
876,
30004,
13,
462,
4706,
5174,
29901,
30004,
13,
462,
9651,
12183,
29889,
3888,
877,
29961,
29930,
29962,
14431,
29901,
18390,
304,
4078,
11417,
29889,
2315,
950,
9076,
29901,
525,
718,
11417,
29889,
2271,
8443,
13,
462,
4706,
4833,
29918,
908,
29889,
14096,
26471,
13,
9651,
1583,
29889,
5504,
26471,
13,
9651,
1550,
1583,
29889,
6310,
7295,
30004,
13,
18884,
12183,
29889,
8382,
877,
29961,
29930,
29962,
1939,
2582,
856,
8709,
292,
1495,
30004,
13,
18884,
931,
29889,
17059,
29898,
1311,
29889,
17059,
8443,
13,
18884,
1583,
29889,
5504,
26471,
13,
2
] |
mission_cannibal_Mike_Boodoo.py | BluedragonXVI/missionary_cannibal | 0 | 69325 | import heapq
# <NAME>
# Artificial Intelligence Assign 01
# DFS and A* algorithms acting on Node class who's state is represented as a dictionary
# DFS's fringe/frontier is a list and A* is a min-priority queue, using the heapq module
# Since dictionaries aren't hashable, the closed/reached set contains string representation of state, str(Node.state)
# Node class has global Node class counter that is cleared after DFS or A* are run
# Main work happens in the Node.perform_action method that takes an action from the action tuple and ensures it is valid
# New node is only generated if resulting new state is valid and satifies constraints of the problem
# Output and discussion at end
class Node:
node_count = 0
def __init__(self, state:dict, parent, prev_action, depth:int, total_cost:int):
self.state = state
self.parent:Node = parent
self.prev_action:tuple = prev_action
self.depth = depth
Node.node_count += 1
def A_star_cost(self, depth): # f(n) used in A*
# need total number on left for both side heuristics
num_left = self.state[ML] + self.state[CL]
if self.state["position"] == left and num_left < 3:
return 1 + depth
elif self.state["position"] == left and num_left > 2:
return ((num_left-2)*2)+1+depth
elif self.state["position"] == right:
return (2*num_left) + depth
def print_path(self, flag:bool):
num_miss:int
num_cann:int
direction = ""
while self.parent is not None:
for miss, cann in self.prev_action.items():
num_miss, num_cann = miss, cann
if (self.state["position"] == left):
direction = right
else:
direction = left
if flag != True:
print("DFS SOLUTION NODE -", str(self.state), "at depth: ",self.depth, "by bringing", num_miss, "miss and", num_cann, " cann from the", direction)
else:
print("A* SOLUTION NODE -", str(self.state), "at depth: ",self.depth, "by bringing", num_miss, "miss and", num_cann, " cann from the", direction, "f(n) =", self.total_cost)
self = self.parent
print("INITIAL NODE -", str(self.state), "at depth: ",self.depth)
def perform_action(self, action:dict, fringe:list, reached:set):
num_miss:int
num_cann:int
for miss, cann in action.items():
num_miss, num_cann = miss, cann
# check if action is actually possible (enough miss or cann on that side)
# for initial state, {3,3,L,0,0} gave me no missed actions as expected
if self.state["position"] == left: # all actions will be applied to left -> right
if num_miss > self.state[ML]:
#print("Action not performed, not enough miss to move, num_miss: ", num_miss)
return # ensure there are enough miss and cann to transfer
if num_cann > self.state[CL]:
#print("Action not performed, not enough cann to move, num_cann: ", num_cann)
return
# now ensure that the state is legal (cann don't outnumber miss)
next_miss_left, next_miss_right = self.state[ML] - num_miss, self.state[MR] + num_miss
next_cann_left, next_cann_right = self.state[CL] - num_cann, self.state[CR] + num_cann
if next_cann_left > next_miss_left and next_miss_left > 0:
#print("Illegal move detected, cannibals:", next_cann_left, " outnumber missionaries:", next_miss_left, "on left!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, "missionaries to the right")
return
if next_cann_right > next_miss_right and next_miss_right > 0:
#print("Illegal move detected, cannibals:", next_cann_right, " outnumber missionaries:", next_miss_right, "on right!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, " missionaries to the right")
return
# legal nodes can now be added to frontier/fringe
# create the state of the new node
new_state:dict = {ML:next_miss_left, CL:next_cann_left, "position":right, MR:next_miss_right, CR:next_cann_right}
state_string = str(new_state)
if state_string not in reached:
new_node:Node = Node(new_state, self, action, self.depth+1, None)
new_node.total_cost = new_node.A_star_cost(self.depth)
print("New unique node created with state:", new_state, "with depth:", new_node.depth)
fringe.append(new_node)
reached.add(state_string)
#print("state string added to reached with value:", state_string)
if self.state["position"] == right: # all actions will be applied to right -> left
if num_miss > self.state[MR]:
#print("Action not performed, not enough miss to move, num_miss: ", num_miss)
return # ensure there are enough miss and cann to transfer
if num_cann > self.state[CR]:
#print("Action not performed, not enough cann to move, num_cann: ", num_cann)
return
# now ensure that the state is legal (cann don't outnumber miss)
next_miss_left, next_miss_right = self.state[ML] + num_miss, self.state[MR] - num_miss
next_cann_left, next_cann_right = self.state[CL] + num_cann, self.state[CR] - num_cann
if next_cann_left > next_miss_left and next_miss_left > 0:
#print("Illegal move detected, cannibals:", next_cann_left, " outnumber missionaries:", next_miss_left, "on left!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, "missionaries to the right")
return
if next_cann_right > next_miss_right and next_miss_right > 0:
#print("Illegal move detected, cannibals:", next_cann_right, " outnumber missionaries:", next_miss_right, "on right!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, " missionaries to the right")
return
# legal nodes can now be added to frontier/fringe
# create the state of the new node
new_state:dict = {ML:next_miss_left, CL:next_cann_left, "position":left, MR:next_miss_right, CR:next_cann_right}
state_string = str(new_state)
if state_string not in reached:
new_node:Node = Node(new_state, self, action, self.depth+1, None)
print("New unique node created with state:", new_state, "with depth:", new_node.depth)
fringe.append(new_node)
reached.add(state_string)
#print("state string added to reached with value:", state_string)
# A_star action
def perform_action_a_star(self, action:dict, priority_queue, reached:set):
num_miss:int
num_cann:int
for miss, cann in action.items():
num_miss, num_cann = miss, cann
# check if action is actually possible (enough miss or cann on that side)
# for initial state, {3,3,L,0,0} gave me no missed actions as expected
if self.state["position"] == left: # all actions will be applied to left -> right
if num_miss > self.state[ML]:
#print("Action not performed, not enough miss to move, num_miss: ", num_miss)
return # ensure there are enough miss and cann to transfer
if num_cann > self.state[CL]:
#print("Action not performed, not enough cann to move, num_cann: ", num_cann)
return
# now ensure that the state is legal (cann don't outnumber miss)
next_miss_left, next_miss_right = self.state[ML] - num_miss, self.state[MR] + num_miss
next_cann_left, next_cann_right = self.state[CL] - num_cann, self.state[CR] + num_cann
if next_cann_left > next_miss_left and next_miss_left > 0:
#print("Illegal move detected, cannibals:", next_cann_left, " outnumber missionaries:", next_miss_left, "on left!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, "missionaries to the right")
return
if next_cann_right > next_miss_right and next_miss_right > 0:
#print("Illegal move detected, cannibals:", next_cann_right, " outnumber missionaries:", next_miss_right, "on right!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, " missionaries to the right")
return
# legal nodes can now be added to frontier/fringe
# create the state of the new node
new_state:dict = {ML:next_miss_left, CL:next_cann_left, "position":right, MR:next_miss_right, CR:next_cann_right}
state_string = str(new_state)
if state_string not in reached:
new_node:Node = Node(new_state, self, action, self.depth+1, None)
new_node.total_cost = new_node.A_star_cost(new_node.depth)
print("New unique node created with state:", new_state, "with depth:", new_node.depth, "and A* cost:", new_node.total_cost)
#fringe.append(new_node)
heapq.heappush(priority_queue, (new_node.total_cost, state_string, new_node))
reached.add(state_string)
#print("state string added to reached with value:", state_string)
if self.state["position"] == right: # all actions will be applied to right -> left
if num_miss > self.state[MR]:
#print("Action not performed, not enough miss to move, num_miss: ", num_miss)
return # ensure there are enough miss and cann to transfer
if num_cann > self.state[CR]:
#print("Action not performed, not enough cann to move, num_cann: ", num_cann)
return
# now ensure that the state is legal (cann don't outnumber miss)
next_miss_left, next_miss_right = self.state[ML] + num_miss, self.state[MR] - num_miss
next_cann_left, next_cann_right = self.state[CL] + num_cann, self.state[CR] - num_cann
if next_cann_left > next_miss_left and next_miss_left > 0:
#print("Illegal move detected, cannibals:", next_cann_left, " outnumber missionaries:", next_miss_left, "on left!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, "missionaries to the right")
return
if next_cann_right > next_miss_right and next_miss_right > 0:
#print("Illegal move detected, cannibals:", next_cann_right, " outnumber missionaries:", next_miss_right, "on right!")
#print("The attemped move was sending", num_cann, "cannibals and", num_miss, " missionaries to the right")
return
# legal nodes can now be added to frontier/fringe
# create the state of the new node
new_state:dict = {ML:next_miss_left, CL:next_cann_left, "position":left, MR:next_miss_right, CR:next_cann_right}
state_string = str(new_state)
if state_string not in reached:
new_node:Node = Node(new_state, self, action, self.depth+1, None)
new_node.total_cost = new_node.A_star_cost(new_node.depth)
print("New unique node created with state:", new_state, "with depth:", new_node.depth, "and A* cost:", new_node.total_cost)
#fringe.append(new_node)
heapq.heappush(priority_queue, (new_node.total_cost, state_string, new_node))
reached.add(state_string)
#print("state string added to reached with value:", state_string)
if __name__ == "__main__":
ML, MR = "miss_left", "miss_right"
CL, CR = "cann_left", "cann_right"
left, right = "left", "right"
frontier:list = []
actions:tuple = ({2:0}, {0:2}, {1:1}, {1:0}, {0:1}) # tuple of {miss:cann} entries. key of tuple entry is miss, value of tuple entry is cann
initial_state = {ML:3, CL:3, "position":left, MR:0, CR:0}
goal_state = {ML:0, CL:0, "position":right, MR:3, CR:3}
reached:set = set()
Node.node_count = 0
inital_node = Node(initial_state, None, None, 0, None)
for action in actions: # each item is a miss:cann dictionary
a_star_flag = False
inital_node.perform_action(action, frontier, reached)
found_solution = False
while frontier and (found_solution != True):
current_node:Node = frontier.pop()
if current_node.state == goal_state:
print("VALID STATE REACHED at depth:", current_node.depth)
found_solution = True
current_node.print_path(a_star_flag)
print("Number of nodes created:", Node.node_count)
break
else:
for action_2 in actions:
current_node.perform_action(action_2, frontier, reached)
print("End reached...")
reached.clear()
# A* version of above which is same except for min_priority_queue operations
Node.node_count = 0
reached_a_star:set = set()
priority_queue = []
for action in actions: # each item is a miss:cann dictionary
a_star_flag = True
inital_node.perform_action_a_star(action, priority_queue, reached_a_star)
found_solution = False
while priority_queue and (found_solution != True):
popped_node_tuple = heapq.heappop(priority_queue)
current_node:Node = popped_node_tuple[2]
if current_node.state == goal_state:
print("VALID STATE REACHED at depth:", current_node.depth)
found_solution = True
current_node.print_path(a_star_flag)
print("Number of nodes created:", Node.node_count)
break
else:
for action_2 in actions:
current_node.perform_action_a_star(action_2, priority_queue, reached_a_star)
print("End reached...")
reached_a_star.clear()
# Code output and analysis below:
# Without using a reached set, DFS never stopped and generated nodes at depth > 40,000 until manually stopping program
# Using a reached set, DFS found a solution at depth 11 while generating 15 legal nodes, output below:
# Solution nodes output in reverse order (Goal_state -> ... -> Initial_state) along with action previously applied to get to that state
"""
VALID STATE REACHED at depth: 11
DFS SOLUTION NODE - {'miss_left': 0, 'cann_left': 0, 'position': 'right', 'miss_right': 3, 'cann_right': 3} at depth: 11 by bringing 0 miss and 2 cann from the left
DFS SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'left', 'miss_right': 3, 'cann_right': 1} at depth: 10 by bringing 0 miss and 1 cann from the right
DFS SOLUTION NODE - {'miss_left': 0, 'cann_left': 1, 'position': 'right', 'miss_right': 3, 'cann_right': 2} at depth: 9 by bringing 0 miss and 2 cann from the left
DFS SOLUTION NODE - {'miss_left': 0, 'cann_left': 3, 'position': 'left', 'miss_right': 3, 'cann_right': 0} at depth: 8 by bringing 0 miss and 1 cann from the right
DFS SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'right', 'miss_right': 3, 'cann_right': 1} at depth: 7 by bringing 2 miss and 0 cann from the left
DFS SOLUTION NODE - {'miss_left': 2, 'cann_left': 2, 'position': 'left', 'miss_right': 1, 'cann_right': 1} at depth: 6 by bringing 1 miss and 1 cann from the right
DFS SOLUTION NODE - {'miss_left': 1, 'cann_left': 1, 'position': 'right', 'miss_right': 2, 'cann_right': 2} at depth: 5 by bringing 2 miss and 0 cann from the left
DFS SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'left', 'miss_right': 0, 'cann_right': 2} at depth: 4 by bringing 0 miss and 1 cann from the right
DFS SOLUTION NODE - {'miss_left': 3, 'cann_left': 0, 'position': 'right', 'miss_right': 0, 'cann_right': 3} at depth: 3 by bringing 0 miss and 2 cann from the left
DFS SOLUTION NODE - {'miss_left': 3, 'cann_left': 2, 'position': 'left', 'miss_right': 0, 'cann_right': 1} at depth: 2 by bringing 0 miss and 1 cann from the right
DFS SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'right', 'miss_right': 0, 'cann_right': 2} at depth: 1 by bringing 0 miss and 2 cann from the left
INITIAL NODE - {'miss_left': 3, 'cann_left': 3, 'position': 'left', 'miss_right': 0, 'cann_right': 0} at depth: 0
"""
# Without using a reached set, A* found a solution at depth 11 while generating 23 legal nodes, output below:
"""
VALID STATE REACHED at depth: 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 0, 'position': 'right', 'miss_right': 3, 'cann_right': 3} at depth: 11 by bringing 0 miss and 2 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'left', 'miss_right': 3, 'cann_right': 1} at depth: 10 by bringing 0 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 1, 'position': 'right', 'miss_right': 3, 'cann_right': 2} at depth: 9 by bringing 0 miss and 2 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 3, 'position': 'left', 'miss_right': 3, 'cann_right': 0} at depth: 8 by bringing 0 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'right', 'miss_right': 3, 'cann_right': 1} at depth: 7 by bringing 2 miss and 0 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 2, 'cann_left': 2, 'position': 'left', 'miss_right': 1, 'cann_right': 1} at depth: 6 by bringing 1 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 1, 'cann_left': 1, 'position': 'right', 'miss_right': 2, 'cann_right': 2} at depth: 5 by bringing 2 miss and 0 cann from the left f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'left', 'miss_right': 0, 'cann_right': 2} at depth: 4 by bringing 0 miss and 1 cann from the right f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 0, 'position': 'right', 'miss_right': 0, 'cann_right': 3} at depth: 3 by bringing 0 miss and 2 cann from the left f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 2, 'position': 'left', 'miss_right': 0, 'cann_right': 1} at depth: 2 by bringing 0 miss and 1 cann from the right f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'right', 'miss_right': 0, 'cann_right': 2} at depth: 1 by bringing 0 miss and 2 cann from the left f(n) = 9
INITIAL NODE - {'miss_left': 3, 'cann_left': 3, 'position': 'left', 'miss_right': 0, 'cann_right': 0} at depth: 0
Number of nodes created: 23
-------------------------------------------------------------------------------------------------------------------
"""
# Using a reached set to avoid cycles, A* found a solution at depth 11 while generating 14 nodes, output below:
"""
VALID STATE REACHED at depth: 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 0, 'position': 'right', 'miss_right': 3, 'cann_right': 3} at depth: 11 by bringing 0 miss and 2 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'left', 'miss_right': 3, 'cann_right': 1} at depth: 10 by bringing 0 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 1, 'position': 'right', 'miss_right': 3, 'cann_right': 2} at depth: 9 by bringing 0 miss and 2 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 3, 'position': 'left', 'miss_right': 3, 'cann_right': 0} at depth: 8 by bringing 0 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 0, 'cann_left': 2, 'position': 'right', 'miss_right': 3, 'cann_right': 1} at depth: 7 by bringing 2 miss and 0 cann from the left f(n) = 11
A* SOLUTION NODE - {'miss_left': 2, 'cann_left': 2, 'position': 'left', 'miss_right': 1, 'cann_right': 1} at depth: 6 by bringing 1 miss and 1 cann from the right f(n) = 11
A* SOLUTION NODE - {'miss_left': 1, 'cann_left': 1, 'position': 'right', 'miss_right': 2, 'cann_right': 2} at depth: 5 by bringing 2 miss and 0 cann from the left f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'left', 'miss_right': 0, 'cann_right': 2} at depth: 4 by bringing 0 miss and 1 cann from the right f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 0, 'position': 'right', 'miss_right': 0, 'cann_right': 3} at depth: 3 by bringing 0 miss and 2 cann from the left f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 2, 'position': 'left', 'miss_right': 0, 'cann_right': 1} at depth: 2 by bringing 0 miss and 1 cann from the right f(n) = 9
A* SOLUTION NODE - {'miss_left': 3, 'cann_left': 1, 'position': 'right', 'miss_right': 0, 'cann_right': 2} at depth: 1 by bringing 0 miss and 2 cann from the left f(n) = 9
INITIAL NODE - {'miss_left': 3, 'cann_left': 3, 'position': 'left', 'miss_right': 0, 'cann_right': 0} at depth: 0
Number of nodes created: 14
"""
# DFS found solution at same depth as A*, I believe this is due to the constraints of the problem severely reducing the amount of nodes being made.
# The branching factor ends up being less than 5 many times because of the constraints
# Should test with bigger initial state with more miss and cann to see if algorithms diverge
# Unlike DFS, A* found the same solution with and without a closed/reached set where DFS only worked with a closed list since
# due to being trapped in a cycle.
# If the heuristic function is admissible and consistent this would then suggest depth 11 is the optimal solution depth. | [
1,
1053,
16947,
29939,
13,
13,
29937,
529,
5813,
29958,
13,
29937,
3012,
928,
616,
3159,
28286,
4007,
647,
29871,
29900,
29896,
13,
13,
29937,
360,
9998,
322,
319,
29930,
14009,
16684,
373,
9071,
770,
1058,
29915,
29879,
2106,
338,
9875,
408,
263,
8600,
13,
29937,
360,
9998,
29915,
29879,
1424,
19144,
29914,
8862,
631,
338,
263,
1051,
322,
319,
29930,
338,
263,
1375,
29899,
29886,
21766,
9521,
29892,
773,
278,
16947,
29939,
3883,
13,
29937,
4001,
21503,
4314,
9455,
29915,
29873,
6608,
519,
29892,
278,
5764,
29914,
276,
3791,
731,
3743,
1347,
8954,
310,
2106,
29892,
851,
29898,
4247,
29889,
3859,
29897,
13,
29937,
9071,
770,
756,
5534,
9071,
770,
6795,
393,
338,
24639,
1156,
360,
9998,
470,
319,
29930,
526,
1065,
13,
29937,
4241,
664,
5930,
297,
278,
9071,
29889,
19826,
29918,
2467,
1158,
393,
4893,
385,
3158,
515,
278,
3158,
18761,
322,
5662,
1973,
372,
338,
2854,
13,
29937,
1570,
2943,
338,
871,
5759,
565,
9819,
716,
2106,
338,
2854,
322,
3290,
11057,
11938,
310,
278,
1108,
13,
13,
29937,
10604,
322,
10679,
472,
1095,
13,
13,
1990,
9071,
29901,
13,
13,
1678,
2943,
29918,
2798,
353,
29871,
29900,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29901,
8977,
29892,
3847,
29892,
12379,
29918,
2467,
29892,
10809,
29901,
524,
29892,
3001,
29918,
18253,
29901,
524,
1125,
13,
4706,
1583,
29889,
3859,
353,
2106,
13,
4706,
1583,
29889,
3560,
29901,
4247,
353,
3847,
13,
4706,
1583,
29889,
16304,
29918,
2467,
29901,
23583,
353,
12379,
29918,
2467,
13,
4706,
1583,
29889,
19488,
353,
10809,
13,
4706,
9071,
29889,
3177,
29918,
2798,
4619,
29871,
29896,
13,
13,
1678,
822,
319,
29918,
8508,
29918,
18253,
29898,
1311,
29892,
10809,
1125,
396,
285,
29898,
29876,
29897,
1304,
297,
319,
29930,
13,
4706,
396,
817,
3001,
1353,
373,
2175,
363,
1716,
2625,
540,
332,
6765,
13,
4706,
954,
29918,
1563,
353,
1583,
29889,
3859,
29961,
1988,
29962,
718,
1583,
29889,
3859,
29961,
6154,
29962,
13,
4706,
565,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
2175,
322,
954,
29918,
1563,
529,
29871,
29941,
29901,
13,
9651,
736,
29871,
29896,
718,
10809,
13,
4706,
25342,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
2175,
322,
954,
29918,
1563,
1405,
29871,
29906,
29901,
13,
9651,
736,
5135,
1949,
29918,
1563,
29899,
29906,
11877,
29906,
7240,
29896,
29974,
19488,
13,
4706,
25342,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
1492,
29901,
13,
9651,
736,
313,
29906,
29930,
1949,
29918,
1563,
29897,
718,
10809,
13,
13,
1678,
822,
1596,
29918,
2084,
29898,
1311,
29892,
7353,
29901,
11227,
1125,
13,
4706,
954,
29918,
9894,
29901,
524,
13,
4706,
954,
29918,
29883,
812,
29901,
524,
13,
4706,
5305,
353,
5124,
13,
308,
13,
4706,
1550,
1583,
29889,
3560,
338,
451,
6213,
29901,
13,
9651,
363,
3052,
29892,
508,
29876,
297,
1583,
29889,
16304,
29918,
2467,
29889,
7076,
7295,
13,
18884,
954,
29918,
9894,
29892,
954,
29918,
29883,
812,
353,
3052,
29892,
508,
29876,
13,
9651,
565,
313,
1311,
29889,
3859,
3366,
3283,
3108,
1275,
2175,
1125,
13,
18884,
5305,
353,
1492,
13,
9651,
1683,
29901,
13,
18884,
5305,
353,
2175,
13,
9651,
565,
7353,
2804,
5852,
29901,
13,
18884,
1596,
703,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
613,
851,
29898,
1311,
29889,
3859,
511,
376,
271,
10809,
29901,
9162,
1311,
29889,
19488,
29892,
376,
1609,
20794,
613,
954,
29918,
9894,
29892,
376,
9894,
322,
613,
954,
29918,
29883,
812,
29892,
376,
508,
29876,
515,
278,
613,
5305,
29897,
13,
9651,
1683,
29901,
29871,
13,
18884,
1596,
703,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
613,
851,
29898,
1311,
29889,
3859,
511,
376,
271,
10809,
29901,
9162,
1311,
29889,
19488,
29892,
376,
1609,
20794,
613,
954,
29918,
9894,
29892,
376,
9894,
322,
613,
954,
29918,
29883,
812,
29892,
376,
508,
29876,
515,
278,
613,
5305,
29892,
376,
29888,
29898,
29876,
29897,
353,
613,
1583,
29889,
7827,
29918,
18253,
29897,
13,
9651,
1583,
353,
1583,
29889,
3560,
13,
4706,
1596,
703,
26019,
25758,
11698,
2287,
448,
613,
851,
29898,
1311,
29889,
3859,
511,
376,
271,
10809,
29901,
9162,
1311,
29889,
19488,
29897,
13,
13,
1678,
822,
2189,
29918,
2467,
29898,
1311,
29892,
3158,
29901,
8977,
29892,
1424,
19144,
29901,
1761,
29892,
7450,
29901,
842,
1125,
13,
13,
4706,
954,
29918,
9894,
29901,
524,
13,
4706,
954,
29918,
29883,
812,
29901,
524,
13,
4706,
363,
3052,
29892,
508,
29876,
297,
3158,
29889,
7076,
7295,
13,
9651,
954,
29918,
9894,
29892,
954,
29918,
29883,
812,
353,
3052,
29892,
508,
29876,
13,
13,
4706,
396,
1423,
565,
3158,
338,
2869,
1950,
313,
264,
820,
3052,
470,
508,
29876,
373,
393,
2625,
29897,
13,
4706,
396,
363,
2847,
2106,
29892,
426,
29941,
29892,
29941,
29892,
29931,
29892,
29900,
29892,
29900,
29913,
4846,
592,
694,
13726,
8820,
408,
3806,
13,
4706,
565,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
2175,
29901,
396,
599,
8820,
674,
367,
7436,
304,
2175,
1599,
1492,
13,
9651,
565,
954,
29918,
9894,
1405,
1583,
29889,
3859,
29961,
1988,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
3052,
304,
4337,
29892,
954,
29918,
9894,
29901,
9162,
954,
29918,
9894,
29897,
13,
18884,
736,
396,
9801,
727,
526,
3307,
3052,
322,
508,
29876,
304,
6782,
13,
9651,
565,
954,
29918,
29883,
812,
1405,
1583,
29889,
3859,
29961,
6154,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
508,
29876,
304,
4337,
29892,
954,
29918,
29883,
812,
29901,
9162,
954,
29918,
29883,
812,
29897,
13,
18884,
736,
13,
13,
9651,
396,
1286,
9801,
393,
278,
2106,
338,
11706,
313,
29883,
812,
1016,
29915,
29873,
714,
4537,
3052,
29897,
13,
9651,
2446,
29918,
9894,
29918,
1563,
29892,
2446,
29918,
9894,
29918,
1266,
353,
1583,
29889,
3859,
29961,
1988,
29962,
448,
954,
29918,
9894,
29892,
1583,
29889,
3859,
29961,
21055,
29962,
718,
954,
29918,
9894,
13,
9651,
2446,
29918,
29883,
812,
29918,
1563,
29892,
2446,
29918,
29883,
812,
29918,
1266,
353,
1583,
29889,
3859,
29961,
6154,
29962,
448,
954,
29918,
29883,
812,
29892,
1583,
29889,
3859,
29961,
11341,
29962,
718,
954,
29918,
29883,
812,
13,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1563,
1405,
2446,
29918,
9894,
29918,
1563,
322,
2446,
29918,
9894,
29918,
1563,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1563,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1563,
29892,
376,
265,
2175,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
6737,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1266,
1405,
2446,
29918,
9894,
29918,
1266,
322,
2446,
29918,
9894,
29918,
1266,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1266,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1266,
29892,
376,
265,
1492,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
10655,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
13,
9651,
396,
11706,
7573,
508,
1286,
367,
2715,
304,
4565,
631,
29914,
1341,
19144,
13,
9651,
396,
1653,
278,
2106,
310,
278,
716,
2943,
13,
9651,
716,
29918,
3859,
29901,
8977,
353,
426,
1988,
29901,
4622,
29918,
9894,
29918,
1563,
29892,
17332,
29901,
4622,
29918,
29883,
812,
29918,
1563,
29892,
376,
3283,
1115,
1266,
29892,
29751,
29901,
4622,
29918,
9894,
29918,
1266,
29892,
15600,
29901,
4622,
29918,
29883,
812,
29918,
1266,
29913,
13,
9651,
2106,
29918,
1807,
353,
851,
29898,
1482,
29918,
3859,
29897,
13,
9651,
565,
2106,
29918,
1807,
451,
297,
7450,
29901,
13,
18884,
716,
29918,
3177,
29901,
4247,
353,
9071,
29898,
1482,
29918,
3859,
29892,
1583,
29892,
3158,
29892,
1583,
29889,
19488,
29974,
29896,
29892,
6213,
29897,
13,
18884,
716,
29918,
3177,
29889,
7827,
29918,
18253,
353,
716,
29918,
3177,
29889,
29909,
29918,
8508,
29918,
18253,
29898,
1311,
29889,
19488,
29897,
13,
18884,
1596,
703,
4373,
5412,
2943,
2825,
411,
2106,
29901,
613,
716,
29918,
3859,
29892,
376,
2541,
10809,
29901,
613,
716,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1424,
19144,
29889,
4397,
29898,
1482,
29918,
3177,
29897,
13,
18884,
7450,
29889,
1202,
29898,
3859,
29918,
1807,
29897,
13,
18884,
396,
2158,
703,
3859,
1347,
2715,
304,
7450,
411,
995,
29901,
613,
2106,
29918,
1807,
29897,
13,
13,
4706,
565,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
1492,
29901,
396,
599,
8820,
674,
367,
7436,
304,
1492,
1599,
2175,
13,
9651,
565,
954,
29918,
9894,
1405,
1583,
29889,
3859,
29961,
21055,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
3052,
304,
4337,
29892,
954,
29918,
9894,
29901,
9162,
954,
29918,
9894,
29897,
13,
18884,
736,
396,
9801,
727,
526,
3307,
3052,
322,
508,
29876,
304,
6782,
13,
9651,
565,
954,
29918,
29883,
812,
1405,
1583,
29889,
3859,
29961,
11341,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
508,
29876,
304,
4337,
29892,
954,
29918,
29883,
812,
29901,
9162,
954,
29918,
29883,
812,
29897,
13,
18884,
736,
13,
13,
9651,
396,
1286,
9801,
393,
278,
2106,
338,
11706,
313,
29883,
812,
1016,
29915,
29873,
714,
4537,
3052,
29897,
13,
9651,
2446,
29918,
9894,
29918,
1563,
29892,
2446,
29918,
9894,
29918,
1266,
353,
1583,
29889,
3859,
29961,
1988,
29962,
718,
954,
29918,
9894,
29892,
1583,
29889,
3859,
29961,
21055,
29962,
448,
954,
29918,
9894,
13,
9651,
2446,
29918,
29883,
812,
29918,
1563,
29892,
2446,
29918,
29883,
812,
29918,
1266,
353,
1583,
29889,
3859,
29961,
6154,
29962,
718,
954,
29918,
29883,
812,
29892,
1583,
29889,
3859,
29961,
11341,
29962,
448,
954,
29918,
29883,
812,
13,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1563,
1405,
2446,
29918,
9894,
29918,
1563,
322,
2446,
29918,
9894,
29918,
1563,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1563,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1563,
29892,
376,
265,
2175,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
6737,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1266,
1405,
2446,
29918,
9894,
29918,
1266,
322,
2446,
29918,
9894,
29918,
1266,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1266,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1266,
29892,
376,
265,
1492,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
10655,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
13,
9651,
396,
11706,
7573,
508,
1286,
367,
2715,
304,
4565,
631,
29914,
1341,
19144,
13,
9651,
396,
1653,
278,
2106,
310,
278,
716,
2943,
13,
9651,
716,
29918,
3859,
29901,
8977,
353,
426,
1988,
29901,
4622,
29918,
9894,
29918,
1563,
29892,
17332,
29901,
4622,
29918,
29883,
812,
29918,
1563,
29892,
376,
3283,
1115,
1563,
29892,
29751,
29901,
4622,
29918,
9894,
29918,
1266,
29892,
15600,
29901,
4622,
29918,
29883,
812,
29918,
1266,
29913,
13,
9651,
2106,
29918,
1807,
353,
851,
29898,
1482,
29918,
3859,
29897,
13,
9651,
565,
2106,
29918,
1807,
451,
297,
7450,
29901,
13,
18884,
716,
29918,
3177,
29901,
4247,
353,
9071,
29898,
1482,
29918,
3859,
29892,
1583,
29892,
3158,
29892,
1583,
29889,
19488,
29974,
29896,
29892,
6213,
29897,
13,
18884,
1596,
703,
4373,
5412,
2943,
2825,
411,
2106,
29901,
613,
716,
29918,
3859,
29892,
376,
2541,
10809,
29901,
613,
716,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1424,
19144,
29889,
4397,
29898,
1482,
29918,
3177,
29897,
13,
18884,
7450,
29889,
1202,
29898,
3859,
29918,
1807,
29897,
13,
18884,
396,
2158,
703,
3859,
1347,
2715,
304,
7450,
411,
995,
29901,
613,
2106,
29918,
1807,
29897,
13,
268,
13,
632,
13,
1678,
396,
319,
29918,
8508,
3158,
13,
1678,
822,
2189,
29918,
2467,
29918,
29874,
29918,
8508,
29898,
1311,
29892,
3158,
29901,
8977,
29892,
20136,
29918,
9990,
29892,
7450,
29901,
842,
1125,
13,
13,
4706,
954,
29918,
9894,
29901,
524,
13,
4706,
954,
29918,
29883,
812,
29901,
524,
13,
4706,
363,
3052,
29892,
508,
29876,
297,
3158,
29889,
7076,
7295,
13,
9651,
954,
29918,
9894,
29892,
954,
29918,
29883,
812,
353,
3052,
29892,
508,
29876,
13,
13,
4706,
396,
1423,
565,
3158,
338,
2869,
1950,
313,
264,
820,
3052,
470,
508,
29876,
373,
393,
2625,
29897,
13,
4706,
396,
363,
2847,
2106,
29892,
426,
29941,
29892,
29941,
29892,
29931,
29892,
29900,
29892,
29900,
29913,
4846,
592,
694,
13726,
8820,
408,
3806,
13,
4706,
565,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
2175,
29901,
396,
599,
8820,
674,
367,
7436,
304,
2175,
1599,
1492,
13,
9651,
565,
954,
29918,
9894,
1405,
1583,
29889,
3859,
29961,
1988,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
3052,
304,
4337,
29892,
954,
29918,
9894,
29901,
9162,
954,
29918,
9894,
29897,
13,
18884,
736,
396,
9801,
727,
526,
3307,
3052,
322,
508,
29876,
304,
6782,
13,
9651,
565,
954,
29918,
29883,
812,
1405,
1583,
29889,
3859,
29961,
6154,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
508,
29876,
304,
4337,
29892,
954,
29918,
29883,
812,
29901,
9162,
954,
29918,
29883,
812,
29897,
13,
18884,
736,
13,
13,
9651,
396,
1286,
9801,
393,
278,
2106,
338,
11706,
313,
29883,
812,
1016,
29915,
29873,
714,
4537,
3052,
29897,
13,
9651,
2446,
29918,
9894,
29918,
1563,
29892,
2446,
29918,
9894,
29918,
1266,
353,
1583,
29889,
3859,
29961,
1988,
29962,
448,
954,
29918,
9894,
29892,
1583,
29889,
3859,
29961,
21055,
29962,
718,
954,
29918,
9894,
13,
9651,
2446,
29918,
29883,
812,
29918,
1563,
29892,
2446,
29918,
29883,
812,
29918,
1266,
353,
1583,
29889,
3859,
29961,
6154,
29962,
448,
954,
29918,
29883,
812,
29892,
1583,
29889,
3859,
29961,
11341,
29962,
718,
954,
29918,
29883,
812,
13,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1563,
1405,
2446,
29918,
9894,
29918,
1563,
322,
2446,
29918,
9894,
29918,
1563,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1563,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1563,
29892,
376,
265,
2175,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
6737,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1266,
1405,
2446,
29918,
9894,
29918,
1266,
322,
2446,
29918,
9894,
29918,
1266,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1266,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1266,
29892,
376,
265,
1492,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
10655,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
13,
9651,
396,
11706,
7573,
508,
1286,
367,
2715,
304,
4565,
631,
29914,
1341,
19144,
13,
9651,
396,
1653,
278,
2106,
310,
278,
716,
2943,
13,
9651,
716,
29918,
3859,
29901,
8977,
353,
426,
1988,
29901,
4622,
29918,
9894,
29918,
1563,
29892,
17332,
29901,
4622,
29918,
29883,
812,
29918,
1563,
29892,
376,
3283,
1115,
1266,
29892,
29751,
29901,
4622,
29918,
9894,
29918,
1266,
29892,
15600,
29901,
4622,
29918,
29883,
812,
29918,
1266,
29913,
13,
9651,
2106,
29918,
1807,
353,
851,
29898,
1482,
29918,
3859,
29897,
13,
9651,
565,
2106,
29918,
1807,
451,
297,
7450,
29901,
13,
18884,
716,
29918,
3177,
29901,
4247,
353,
9071,
29898,
1482,
29918,
3859,
29892,
1583,
29892,
3158,
29892,
1583,
29889,
19488,
29974,
29896,
29892,
6213,
29897,
13,
18884,
716,
29918,
3177,
29889,
7827,
29918,
18253,
353,
716,
29918,
3177,
29889,
29909,
29918,
8508,
29918,
18253,
29898,
1482,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1596,
703,
4373,
5412,
2943,
2825,
411,
2106,
29901,
613,
716,
29918,
3859,
29892,
376,
2541,
10809,
29901,
613,
716,
29918,
3177,
29889,
19488,
29892,
376,
392,
319,
29930,
3438,
29901,
613,
716,
29918,
3177,
29889,
7827,
29918,
18253,
29897,
13,
18884,
396,
1341,
19144,
29889,
4397,
29898,
1482,
29918,
3177,
29897,
13,
18884,
16947,
29939,
29889,
354,
932,
1878,
29898,
29886,
21766,
29918,
9990,
29892,
313,
1482,
29918,
3177,
29889,
7827,
29918,
18253,
29892,
2106,
29918,
1807,
29892,
716,
29918,
3177,
876,
13,
18884,
7450,
29889,
1202,
29898,
3859,
29918,
1807,
29897,
13,
18884,
396,
2158,
703,
3859,
1347,
2715,
304,
7450,
411,
995,
29901,
613,
2106,
29918,
1807,
29897,
13,
13,
4706,
565,
1583,
29889,
3859,
3366,
3283,
3108,
1275,
1492,
29901,
396,
599,
8820,
674,
367,
7436,
304,
1492,
1599,
2175,
13,
9651,
565,
954,
29918,
9894,
1405,
1583,
29889,
3859,
29961,
21055,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
3052,
304,
4337,
29892,
954,
29918,
9894,
29901,
9162,
954,
29918,
9894,
29897,
13,
18884,
736,
396,
9801,
727,
526,
3307,
3052,
322,
508,
29876,
304,
6782,
13,
9651,
565,
954,
29918,
29883,
812,
1405,
1583,
29889,
3859,
29961,
11341,
5387,
29871,
13,
18884,
396,
2158,
703,
4276,
451,
8560,
29892,
451,
3307,
508,
29876,
304,
4337,
29892,
954,
29918,
29883,
812,
29901,
9162,
954,
29918,
29883,
812,
29897,
13,
18884,
736,
13,
13,
9651,
396,
1286,
9801,
393,
278,
2106,
338,
11706,
313,
29883,
812,
1016,
29915,
29873,
714,
4537,
3052,
29897,
13,
9651,
2446,
29918,
9894,
29918,
1563,
29892,
2446,
29918,
9894,
29918,
1266,
353,
1583,
29889,
3859,
29961,
1988,
29962,
718,
954,
29918,
9894,
29892,
1583,
29889,
3859,
29961,
21055,
29962,
448,
954,
29918,
9894,
13,
9651,
2446,
29918,
29883,
812,
29918,
1563,
29892,
2446,
29918,
29883,
812,
29918,
1266,
353,
1583,
29889,
3859,
29961,
6154,
29962,
718,
954,
29918,
29883,
812,
29892,
1583,
29889,
3859,
29961,
11341,
29962,
448,
954,
29918,
29883,
812,
13,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1563,
1405,
2446,
29918,
9894,
29918,
1563,
322,
2446,
29918,
9894,
29918,
1563,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1563,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1563,
29892,
376,
265,
2175,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
6737,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
9651,
565,
2446,
29918,
29883,
812,
29918,
1266,
1405,
2446,
29918,
9894,
29918,
1266,
322,
2446,
29918,
9894,
29918,
1266,
1405,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
14126,
12018,
4337,
17809,
29892,
508,
29876,
747,
1338,
29901,
613,
2446,
29918,
29883,
812,
29918,
1266,
29892,
376,
714,
4537,
10655,
4314,
29901,
613,
2446,
29918,
9894,
29918,
1266,
29892,
376,
265,
1492,
29991,
1159,
13,
18884,
396,
2158,
703,
1576,
1098,
3451,
287,
4337,
471,
9348,
613,
954,
29918,
29883,
812,
29892,
376,
29883,
812,
747,
1338,
322,
613,
954,
29918,
9894,
29892,
376,
10655,
4314,
304,
278,
1492,
1159,
13,
18884,
736,
13,
13,
9651,
396,
11706,
7573,
508,
1286,
367,
2715,
304,
4565,
631,
29914,
1341,
19144,
13,
9651,
396,
1653,
278,
2106,
310,
278,
716,
2943,
13,
9651,
716,
29918,
3859,
29901,
8977,
353,
426,
1988,
29901,
4622,
29918,
9894,
29918,
1563,
29892,
17332,
29901,
4622,
29918,
29883,
812,
29918,
1563,
29892,
376,
3283,
1115,
1563,
29892,
29751,
29901,
4622,
29918,
9894,
29918,
1266,
29892,
15600,
29901,
4622,
29918,
29883,
812,
29918,
1266,
29913,
13,
9651,
2106,
29918,
1807,
353,
851,
29898,
1482,
29918,
3859,
29897,
13,
9651,
565,
2106,
29918,
1807,
451,
297,
7450,
29901,
13,
18884,
716,
29918,
3177,
29901,
4247,
353,
9071,
29898,
1482,
29918,
3859,
29892,
1583,
29892,
3158,
29892,
1583,
29889,
19488,
29974,
29896,
29892,
6213,
29897,
13,
18884,
716,
29918,
3177,
29889,
7827,
29918,
18253,
353,
716,
29918,
3177,
29889,
29909,
29918,
8508,
29918,
18253,
29898,
1482,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1596,
703,
4373,
5412,
2943,
2825,
411,
2106,
29901,
613,
716,
29918,
3859,
29892,
376,
2541,
10809,
29901,
613,
716,
29918,
3177,
29889,
19488,
29892,
376,
392,
319,
29930,
3438,
29901,
613,
716,
29918,
3177,
29889,
7827,
29918,
18253,
29897,
13,
18884,
396,
1341,
19144,
29889,
4397,
29898,
1482,
29918,
3177,
29897,
13,
18884,
16947,
29939,
29889,
354,
932,
1878,
29898,
29886,
21766,
29918,
9990,
29892,
313,
1482,
29918,
3177,
29889,
7827,
29918,
18253,
29892,
2106,
29918,
1807,
29892,
716,
29918,
3177,
876,
13,
18884,
7450,
29889,
1202,
29898,
3859,
29918,
1807,
29897,
13,
18884,
396,
2158,
703,
3859,
1347,
2715,
304,
7450,
411,
995,
29901,
613,
2106,
29918,
1807,
29897,
13,
308,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
13,
1678,
23158,
29892,
29751,
353,
376,
9894,
29918,
1563,
613,
376,
9894,
29918,
1266,
29908,
13,
1678,
17332,
29892,
15600,
353,
376,
29883,
812,
29918,
1563,
613,
376,
29883,
812,
29918,
1266,
29908,
13,
1678,
2175,
29892,
1492,
353,
376,
1563,
613,
376,
1266,
29908,
13,
1678,
4565,
631,
29901,
1761,
353,
5159,
13,
1678,
8820,
29901,
23583,
353,
21313,
29906,
29901,
29900,
1118,
426,
29900,
29901,
29906,
1118,
426,
29896,
29901,
29896,
1118,
426,
29896,
29901,
29900,
1118,
426,
29900,
29901,
29896,
1800,
396,
18761,
310,
426,
9894,
29901,
29883,
812,
29913,
9976,
29889,
1820,
310,
18761,
6251,
338,
3052,
29892,
995,
310,
18761,
6251,
338,
508,
29876,
13,
1678,
2847,
29918,
3859,
353,
426,
1988,
29901,
29941,
29892,
17332,
29901,
29941,
29892,
376,
3283,
1115,
1563,
29892,
29751,
29901,
29900,
29892,
15600,
29901,
29900,
29913,
13,
1678,
7306,
29918,
3859,
353,
426,
1988,
29901,
29900,
29892,
17332,
29901,
29900,
29892,
376,
3283,
1115,
1266,
29892,
29751,
29901,
29941,
29892,
15600,
29901,
29941,
29913,
13,
1678,
7450,
29901,
842,
353,
731,
580,
13,
268,
13,
1678,
9071,
29889,
3177,
29918,
2798,
353,
29871,
29900,
13,
1678,
2069,
284,
29918,
3177,
353,
9071,
29898,
11228,
29918,
3859,
29892,
6213,
29892,
6213,
29892,
29871,
29900,
29892,
6213,
29897,
13,
13,
1678,
363,
3158,
297,
8820,
29901,
396,
1269,
2944,
338,
263,
3052,
29901,
29883,
812,
8600,
13,
4706,
263,
29918,
8508,
29918,
15581,
353,
7700,
13,
4706,
2069,
284,
29918,
3177,
29889,
19826,
29918,
2467,
29898,
2467,
29892,
4565,
631,
29892,
7450,
29897,
13,
4706,
1476,
29918,
2929,
918,
353,
7700,
13,
4706,
1550,
4565,
631,
322,
313,
11940,
29918,
2929,
918,
2804,
5852,
1125,
13,
9651,
1857,
29918,
3177,
29901,
4247,
353,
4565,
631,
29889,
7323,
580,
13,
9651,
565,
1857,
29918,
3177,
29889,
3859,
1275,
7306,
29918,
3859,
29901,
13,
18884,
1596,
703,
26707,
6850,
3040,
5195,
2477,
29950,
3352,
472,
10809,
29901,
613,
1857,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1476,
29918,
2929,
918,
353,
5852,
13,
18884,
1857,
29918,
3177,
29889,
2158,
29918,
2084,
29898,
29874,
29918,
8508,
29918,
15581,
29897,
13,
18884,
1596,
703,
4557,
310,
7573,
2825,
29901,
613,
9071,
29889,
3177,
29918,
2798,
29897,
13,
18884,
2867,
13,
9651,
1683,
29901,
13,
18884,
363,
3158,
29918,
29906,
297,
8820,
29901,
13,
462,
1678,
1857,
29918,
3177,
29889,
19826,
29918,
2467,
29898,
2467,
29918,
29906,
29892,
4565,
631,
29892,
7450,
29897,
13,
1678,
1596,
703,
5044,
7450,
856,
1159,
13,
1678,
7450,
29889,
8551,
580,
13,
13,
1678,
396,
319,
29930,
1873,
310,
2038,
607,
338,
1021,
5174,
363,
1375,
29918,
29886,
21766,
29918,
9990,
6931,
13,
1678,
9071,
29889,
3177,
29918,
2798,
353,
29871,
29900,
13,
1678,
7450,
29918,
29874,
29918,
8508,
29901,
842,
353,
731,
580,
13,
1678,
20136,
29918,
9990,
353,
5159,
13,
1678,
363,
3158,
297,
8820,
29901,
396,
1269,
2944,
338,
263,
3052,
29901,
29883,
812,
8600,
13,
4706,
263,
29918,
8508,
29918,
15581,
353,
5852,
13,
4706,
2069,
284,
29918,
3177,
29889,
19826,
29918,
2467,
29918,
29874,
29918,
8508,
29898,
2467,
29892,
20136,
29918,
9990,
29892,
7450,
29918,
29874,
29918,
8508,
29897,
13,
4706,
1476,
29918,
2929,
918,
353,
7700,
13,
4706,
1550,
20136,
29918,
9990,
322,
313,
11940,
29918,
2929,
918,
2804,
5852,
1125,
13,
9651,
772,
2986,
29918,
3177,
29918,
23583,
353,
16947,
29939,
29889,
354,
932,
459,
29898,
29886,
21766,
29918,
9990,
29897,
13,
9651,
1857,
29918,
3177,
29901,
4247,
353,
772,
2986,
29918,
3177,
29918,
23583,
29961,
29906,
29962,
13,
9651,
565,
1857,
29918,
3177,
29889,
3859,
1275,
7306,
29918,
3859,
29901,
13,
18884,
1596,
703,
26707,
6850,
3040,
5195,
2477,
29950,
3352,
472,
10809,
29901,
613,
1857,
29918,
3177,
29889,
19488,
29897,
13,
18884,
1476,
29918,
2929,
918,
353,
5852,
13,
18884,
1857,
29918,
3177,
29889,
2158,
29918,
2084,
29898,
29874,
29918,
8508,
29918,
15581,
29897,
13,
18884,
1596,
703,
4557,
310,
7573,
2825,
29901,
613,
9071,
29889,
3177,
29918,
2798,
29897,
13,
18884,
2867,
13,
9651,
1683,
29901,
13,
18884,
363,
3158,
29918,
29906,
297,
8820,
29901,
13,
462,
1678,
1857,
29918,
3177,
29889,
19826,
29918,
2467,
29918,
29874,
29918,
8508,
29898,
2467,
29918,
29906,
29892,
20136,
29918,
9990,
29892,
7450,
29918,
29874,
29918,
8508,
29897,
13,
1678,
1596,
703,
5044,
7450,
856,
1159,
13,
1678,
7450,
29918,
29874,
29918,
8508,
29889,
8551,
580,
13,
13,
29937,
5920,
1962,
322,
7418,
2400,
29901,
13,
13,
29937,
13932,
773,
263,
7450,
731,
29892,
360,
9998,
2360,
11084,
322,
5759,
7573,
472,
10809,
1405,
29871,
29946,
29900,
29892,
29900,
29900,
29900,
2745,
7522,
25480,
1824,
13,
29937,
5293,
263,
7450,
731,
29892,
360,
9998,
1476,
263,
1650,
472,
10809,
29871,
29896,
29896,
1550,
14655,
29871,
29896,
29945,
11706,
7573,
29892,
1962,
2400,
29901,
13,
13,
29937,
24380,
7573,
1962,
297,
11837,
1797,
313,
8120,
284,
29918,
3859,
1599,
2023,
1599,
17250,
29918,
3859,
29897,
3412,
411,
3158,
9251,
7436,
304,
679,
304,
393,
2106,
13,
29871,
13,
15945,
29908,
13,
26707,
6850,
3040,
5195,
2477,
29950,
3352,
472,
10809,
29901,
29871,
29896,
29896,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29896,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29896,
29900,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29929,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29947,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29955,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29953,
491,
20794,
29871,
29896,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29945,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29946,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29941,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29906,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
13,
4037,
29903,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
13,
26019,
25758,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29900,
13,
15945,
29908,
13,
13,
13,
13,
29937,
13932,
773,
263,
7450,
731,
29892,
319,
29930,
1476,
263,
1650,
472,
10809,
29871,
29896,
29896,
1550,
14655,
29871,
29906,
29941,
11706,
7573,
29892,
1962,
2400,
29901,
13,
15945,
29908,
13,
26707,
6850,
3040,
5195,
2477,
29950,
3352,
472,
10809,
29901,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29896,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29896,
29900,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29929,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29947,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29955,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29953,
491,
20794,
29871,
29896,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29945,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29946,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29941,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29906,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
26019,
25758,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29900,
13,
4557,
310,
7573,
2825,
29901,
29871,
29906,
29941,
13,
2683,
2683,
2683,
2683,
2683,
2683,
2683,
5634,
13,
15945,
29908,
13,
13,
29937,
5293,
263,
7450,
731,
304,
4772,
25785,
29892,
319,
29930,
1476,
263,
1650,
472,
10809,
29871,
29896,
29896,
1550,
14655,
29871,
29896,
29946,
7573,
29892,
1962,
2400,
29901,
13,
15945,
29908,
13,
26707,
6850,
3040,
5195,
2477,
29950,
3352,
472,
10809,
29901,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29896,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29896,
29900,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29929,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29947,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29955,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29953,
491,
20794,
29871,
29896,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29896,
29896,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29896,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29906,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29945,
491,
20794,
29871,
29906,
3052,
322,
29871,
29900,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29946,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29900,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29941,
29913,
472,
10809,
29901,
259,
29941,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29906,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29896,
29913,
472,
10809,
29901,
259,
29906,
491,
20794,
29871,
29900,
3052,
322,
29871,
29896,
29871,
508,
29876,
515,
278,
1492,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
29909,
29930,
317,
5607,
2692,
2725,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29896,
29892,
525,
3283,
2396,
525,
1266,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29906,
29913,
472,
10809,
29901,
259,
29896,
491,
20794,
29871,
29900,
3052,
322,
29871,
29906,
29871,
508,
29876,
515,
278,
2175,
285,
29898,
29876,
29897,
353,
29871,
29929,
13,
26019,
25758,
11698,
2287,
448,
11117,
9894,
29918,
1563,
2396,
29871,
29941,
29892,
525,
29883,
812,
29918,
1563,
2396,
29871,
29941,
29892,
525,
3283,
2396,
525,
1563,
742,
525,
9894,
29918,
1266,
2396,
29871,
29900,
29892,
525,
29883,
812,
29918,
1266,
2396,
29871,
29900,
29913,
472,
10809,
29901,
259,
29900,
13,
4557,
310,
7573,
2825,
29901,
29871,
29896,
29946,
13,
15945,
29908,
13,
29937,
360,
9998,
1476,
1650,
472,
1021,
10809,
408,
319,
15966,
306,
4658,
445,
338,
2861,
304,
278,
11938,
310,
278,
1108,
2775,
873,
27668,
278,
5253,
310,
7573,
1641,
1754,
29889,
29871,
13,
29937,
450,
5443,
292,
7329,
10614,
701,
1641,
3109,
1135,
29871,
29945,
1784,
3064,
1363,
310,
278,
11938,
13,
29937,
10575,
1243,
411,
16600,
2847,
2106,
411,
901,
3052,
322,
508,
29876,
304,
1074,
565,
14009,
17089,
479,
13,
13,
29937,
853,
4561,
360,
9998,
29892,
319,
29930,
1476,
278,
1021,
1650,
411,
322,
1728,
263,
5764,
29914,
276,
3791,
731,
988,
360,
9998,
871,
3796,
411,
263,
5764,
1051,
1951,
13,
29937,
2861,
304,
1641,
1020,
2986,
297,
263,
11412,
29889,
29871,
13,
29937,
960,
278,
540,
332,
4695,
740,
338,
7336,
790,
1821,
322,
13747,
445,
723,
769,
4368,
10809,
29871,
29896,
29896,
338,
278,
14413,
1650,
10809,
29889,
2
] |
PyTorch/UOSBT/Supervised/uossl_1.py | agcdke/UOS | 0 | 145110 | import os
import sys
import PIL
import math
import time
import json
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torchvision
from pathlib import Path
from PIL import Image, ImageOps, ImageFilter
from torch import nn, optim
from torchvision import transforms, utils
import torchvision.models as models
from torchvision.transforms import ToTensor
import torchvision.transforms.functional as VisionF
from torchvision.utils import make_grid
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
from torch.utils.data.sampler import SubsetRandomSampler
torch.cuda.empty_cache()
torch.manual_seed(42)
class DoctableDataset(Dataset):
def __init__(self, root, image_dir, csv_file, train=True, transform=None):
self.root = root
self.image_dir = image_dir
self.image_files = os.listdir(image_dir)
self.data = pd.read_csv(csv_file, header=None)
self.transform = transform
self.train = train
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
if torch.is_tensor(idx):
idx = idx.tolist()
img_name = self.data.iloc[idx,0]
label = self.data.iloc[idx,1]
image_name = os.path.join(self.image_dir, img_name)
image = PIL.Image.open(image_name).convert('RGB')
if self.transform:
image = self.transform(image)
return (image, label)
def uossl_doctab_main():
# check if CUDA is available
train_on_gpu = torch.cuda.is_available()
if not train_on_gpu:
print('CUDA is not available. Training on CPU ...')
else:
print('CUDA is available! Training on GPU ...')
num_workers = 2
batch_size = 8
valid_size = 0.2
n_epochs = 400
root = "data/ssldoctable"
train_image_dir = "data/ssldoctable/train"
test_image_dir = "data/ssldoctable/test"
train_csv_file = "data/ssldoctable/train_labels.csv"
test_csv_file = "data/ssldoctable/test_labels.csv"
checkpoint_dir = Path("chkpt/")
start_time = time.time()
checkpoint_dir.mkdir(parents=True, exist_ok=True)
stats_file = open(checkpoint_dir / 'stats.txt', 'a', buffering=1)
val_stats_file = open(checkpoint_dir / 'val_stats.txt', 'a', buffering=1)
print(' '.join(sys.argv))
print(' '.join(sys.argv), file=stats_file)
print(' '.join(sys.argv), file=val_stats_file)
# convert data to a normalized torch.FloatTensor
transform = transforms.Compose([
transforms.Resize(256, interpolation=Image.BICUBIC),
transforms.RandomResizedCrop(224, interpolation=Image.BICUBIC),
transforms.RandomHorizontalFlip(p=0.5),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
# choose the training and test datasets
train_data = DoctableDataset(root, train_image_dir, train_csv_file, train=True, transform= transform)
test_data = DoctableDataset(root, test_image_dir, test_csv_file, train=False, transform= transform)
# obtain training indices that will be used for validation
num_train = len(train_data)
indices = list(range(num_train))
np.random.shuffle(indices)
split = int(np.floor(valid_size * num_train))
train_idx, valid_idx = indices[split:], indices[:split]
# define samplers for obtaining training and validation batches
train_sampler = SubsetRandomSampler(train_idx)
valid_sampler = SubsetRandomSampler(valid_idx)
# prepare data loaders (combine dataset and sampler)
train_loader = torch.utils.data.DataLoader(train_data, batch_size=batch_size,
sampler=train_sampler, num_workers=num_workers)
valid_loader = torch.utils.data.DataLoader(train_data, batch_size=batch_size,
sampler=valid_sampler, num_workers=num_workers)
test_loader = torch.utils.data.DataLoader(test_data, batch_size=batch_size,
num_workers=num_workers)
# specify the image classes
classes = ['bargraph', 'doctable']
model = models.resnet50(pretrained=True)
#print(model)
# move tensors to GPU if CUDA is available
if train_on_gpu:
model.cuda()
# specify loss function (categorical cross-entropy)
criterion = nn.CrossEntropyLoss()
# specify optimizer
optimizer = torch.optim.Adam(model.parameters(),lr = 0.001)
# number of epochs to train the model
valid_loss_min = np.Inf # track change in validation loss
for epoch in range(1, n_epochs+1):
# keep track of training and validation loss
train_loss = 0.0
valid_loss = 0.0
###################
# train the model #
###################
model.train()
for data, target in train_loader:
# move tensors to GPU if CUDA is available
if train_on_gpu:
data, target = data.cuda(), target.cuda()
# clear the gradients of all optimized variables
optimizer.zero_grad()
# forward pass: compute predicted outputs by passing inputs to the model
output = model(data)
# calculate the batch loss
loss = criterion(output, target)
# backward pass: compute gradient of the loss with respect to model parameters
loss.backward()
# perform a single optimization step (parameter update)
optimizer.step()
# update training loss
train_loss += loss.item()*data.size(0)
######################
# validate the model #
######################
model.eval()
for data, target in valid_loader:
# move tensors to GPU if CUDA is available
if train_on_gpu:
data, target = data.cuda(), target.cuda()
# forward pass: compute predicted outputs by passing inputs to the model
output = model(data)
# calculate the batch loss
loss = criterion(output, target)
# update average validation loss
valid_loss += loss.item()*data.size(0)
# calculate average losses
train_loss = train_loss/len(train_loader.sampler)
valid_loss = valid_loss/len(valid_loader.sampler)
stats = dict(epoch=epoch, train_loss=train_loss, valid_loss=valid_loss,
time=int(time.time() - start_time))
print(json.dumps(stats))
print(json.dumps(stats), file=stats_file)
# print training/validation statistics
print('Epoch: {} \tTraining Loss: {:.6f} \tValidation Loss: {:.6f}'.format(
epoch, train_loss, valid_loss))
# save model if validation loss has decreased
if valid_loss <= valid_loss_min:
val_stats = dict(valid_loss_min=valid_loss_min,valid_loss=valid_loss)
print(json.dumps(val_stats))
print(json.dumps(val_stats), file=val_stats_file)
print('Validation loss decreased ({:.6f} --> {:.6f}). Saving model ...'.format(
valid_loss_min,
valid_loss))
torch.save(model.state_dict(), 'chkpt/model_sl_doctable.pt')
valid_loss_min = valid_loss
######################
#model.load_state_dict(torch.load('chkpt/model_sl_doctable.pt'))
if __name__ == "__main__":
uossl_doctab_main() | [
1,
1053,
2897,
13,
5215,
10876,
13,
5215,
349,
6227,
13,
5215,
5844,
13,
5215,
931,
13,
5215,
4390,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
4924,
13,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
349,
6227,
1053,
7084,
29892,
7084,
29949,
567,
29892,
7084,
5072,
13,
13,
3166,
4842,
305,
1053,
302,
29876,
29892,
5994,
13,
3166,
4842,
305,
4924,
1053,
4327,
29879,
29892,
3667,
29879,
29871,
13,
5215,
4842,
305,
4924,
29889,
9794,
408,
4733,
13,
13,
3166,
4842,
305,
4924,
29889,
9067,
29879,
1053,
1763,
29911,
6073,
13,
5215,
4842,
305,
4924,
29889,
9067,
29879,
29889,
2220,
284,
408,
478,
2459,
29943,
13,
13,
3166,
4842,
305,
4924,
29889,
13239,
1053,
1207,
29918,
7720,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
13373,
24541,
29892,
3630,
10036,
13,
5215,
4842,
305,
4924,
29889,
9067,
29879,
408,
4327,
29879,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
29889,
13445,
20069,
1053,
3323,
842,
17875,
22966,
20069,
13,
13,
7345,
305,
29889,
29883,
6191,
29889,
6310,
29918,
8173,
580,
13,
7345,
305,
29889,
11288,
29918,
26776,
29898,
29946,
29906,
29897,
13,
13,
1990,
1938,
312,
519,
16390,
24541,
29898,
16390,
24541,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3876,
29892,
1967,
29918,
3972,
29892,
11799,
29918,
1445,
29892,
7945,
29922,
5574,
29892,
4327,
29922,
8516,
1125,
13,
4706,
1583,
29889,
4632,
353,
3876,
13,
4706,
1583,
29889,
3027,
29918,
3972,
353,
1967,
29918,
3972,
13,
4706,
1583,
29889,
3027,
29918,
5325,
353,
2897,
29889,
1761,
3972,
29898,
3027,
29918,
3972,
29897,
13,
4706,
1583,
29889,
1272,
353,
10518,
29889,
949,
29918,
7638,
29898,
7638,
29918,
1445,
29892,
4839,
29922,
8516,
29897,
13,
632,
13,
4706,
1583,
29889,
9067,
353,
4327,
13,
4706,
1583,
29889,
14968,
353,
7945,
13,
632,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
1272,
29897,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
22645,
1125,
29871,
13,
308,
13,
4706,
565,
4842,
305,
29889,
275,
29918,
20158,
29898,
13140,
1125,
13,
9651,
22645,
353,
22645,
29889,
25027,
391,
580,
13,
632,
13,
4706,
10153,
29918,
978,
353,
1583,
29889,
1272,
29889,
309,
542,
29961,
13140,
29892,
29900,
29962,
13,
4706,
3858,
353,
1583,
29889,
1272,
29889,
309,
542,
29961,
13140,
29892,
29896,
29962,
13,
4706,
1967,
29918,
978,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3027,
29918,
3972,
29892,
10153,
29918,
978,
29897,
13,
4706,
1967,
353,
349,
6227,
29889,
2940,
29889,
3150,
29898,
3027,
29918,
978,
467,
13441,
877,
28212,
1495,
13,
308,
13,
4706,
565,
1583,
29889,
9067,
29901,
13,
9651,
1967,
353,
1583,
29889,
9067,
29898,
3027,
29897,
13,
13,
4706,
736,
313,
3027,
29892,
3858,
29897,
13,
268,
13,
1753,
318,
2209,
29880,
29918,
1867,
312,
370,
29918,
3396,
7295,
13,
268,
13,
1678,
396,
1423,
565,
315,
29965,
7698,
338,
3625,
13,
1678,
7945,
29918,
265,
29918,
29887,
3746,
353,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
13,
13,
1678,
565,
451,
7945,
29918,
265,
29918,
29887,
3746,
29901,
13,
4706,
1596,
877,
29907,
29965,
7698,
338,
451,
3625,
29889,
29871,
26101,
373,
10808,
2023,
1495,
13,
1678,
1683,
29901,
13,
4706,
1596,
877,
29907,
29965,
7698,
338,
3625,
29991,
29871,
26101,
373,
22796,
2023,
1495,
13,
13,
1678,
954,
29918,
1287,
414,
353,
29871,
29906,
13,
1678,
9853,
29918,
2311,
353,
29871,
29947,
13,
1678,
2854,
29918,
2311,
353,
29871,
29900,
29889,
29906,
13,
1678,
302,
29918,
1022,
2878,
29879,
353,
29871,
29946,
29900,
29900,
13,
1678,
3876,
353,
376,
1272,
29914,
893,
430,
20082,
519,
29908,
13,
1678,
7945,
29918,
3027,
29918,
3972,
353,
376,
1272,
29914,
893,
430,
20082,
519,
29914,
14968,
29908,
13,
1678,
1243,
29918,
3027,
29918,
3972,
353,
376,
1272,
29914,
893,
430,
20082,
519,
29914,
1688,
29908,
13,
1678,
7945,
29918,
7638,
29918,
1445,
353,
376,
1272,
29914,
893,
430,
20082,
519,
29914,
14968,
29918,
21134,
29889,
7638,
29908,
13,
1678,
1243,
29918,
7638,
29918,
1445,
353,
376,
1272,
29914,
893,
430,
20082,
519,
29914,
1688,
29918,
21134,
29889,
7638,
29908,
13,
1678,
1423,
3149,
29918,
3972,
353,
10802,
703,
29570,
415,
29914,
1159,
13,
1678,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
268,
13,
1678,
1423,
3149,
29918,
3972,
29889,
11256,
3972,
29898,
862,
1237,
29922,
5574,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
1678,
22663,
29918,
1445,
353,
1722,
29898,
3198,
3149,
29918,
3972,
847,
525,
16202,
29889,
3945,
742,
525,
29874,
742,
6835,
292,
29922,
29896,
29897,
13,
1678,
659,
29918,
16202,
29918,
1445,
353,
1722,
29898,
3198,
3149,
29918,
3972,
847,
525,
791,
29918,
16202,
29889,
3945,
742,
525,
29874,
742,
6835,
292,
29922,
29896,
29897,
13,
1678,
1596,
877,
15300,
7122,
29898,
9675,
29889,
19218,
876,
13,
1678,
1596,
877,
15300,
7122,
29898,
9675,
29889,
19218,
511,
934,
29922,
16202,
29918,
1445,
29897,
13,
1678,
1596,
877,
15300,
7122,
29898,
9675,
29889,
19218,
511,
934,
29922,
791,
29918,
16202,
29918,
1445,
29897,
13,
13,
13,
1678,
396,
3588,
848,
304,
263,
4226,
1891,
4842,
305,
29889,
11031,
29911,
6073,
13,
1678,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
4706,
4327,
29879,
29889,
1666,
675,
29898,
29906,
29945,
29953,
29892,
29694,
29922,
2940,
29889,
29933,
2965,
7466,
2965,
511,
13,
4706,
4327,
29879,
29889,
17875,
1666,
1891,
29907,
1336,
29898,
29906,
29906,
29946,
29892,
29694,
29922,
2940,
29889,
29933,
2965,
7466,
2965,
511,
13,
4706,
4327,
29879,
29889,
17875,
24932,
29943,
3466,
29898,
29886,
29922,
29900,
29889,
29945,
511,
13,
4706,
4327,
29879,
29889,
1762,
29911,
6073,
3285,
13,
4706,
4327,
29879,
29889,
19077,
675,
29898,
12676,
11759,
29900,
29889,
29946,
29947,
29945,
29892,
29871,
29900,
29889,
29946,
29945,
29953,
29892,
29871,
29900,
29889,
29946,
29900,
29953,
1402,
13,
462,
462,
268,
3659,
11759,
29900,
29889,
29906,
29906,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29946,
29892,
29871,
29900,
29889,
29906,
29906,
29945,
2314,
13,
308,
2314,
13,
1678,
396,
6755,
278,
6694,
322,
1243,
20035,
13,
1678,
7945,
29918,
1272,
353,
1938,
312,
519,
16390,
24541,
29898,
4632,
29892,
7945,
29918,
3027,
29918,
3972,
29892,
7945,
29918,
7638,
29918,
1445,
29892,
7945,
29922,
5574,
29892,
4327,
29922,
4327,
29897,
13,
1678,
1243,
29918,
1272,
353,
1938,
312,
519,
16390,
24541,
29898,
4632,
29892,
1243,
29918,
3027,
29918,
3972,
29892,
1243,
29918,
7638,
29918,
1445,
29892,
7945,
29922,
8824,
29892,
4327,
29922,
4327,
29897,
13,
13,
1678,
396,
4017,
6694,
16285,
393,
674,
367,
1304,
363,
8845,
13,
1678,
954,
29918,
14968,
353,
7431,
29898,
14968,
29918,
1272,
29897,
13,
1678,
16285,
353,
1051,
29898,
3881,
29898,
1949,
29918,
14968,
876,
13,
1678,
7442,
29889,
8172,
29889,
845,
21897,
29898,
513,
1575,
29897,
13,
1678,
6219,
353,
938,
29898,
9302,
29889,
14939,
29898,
3084,
29918,
2311,
334,
954,
29918,
14968,
876,
13,
1678,
7945,
29918,
13140,
29892,
2854,
29918,
13140,
353,
16285,
29961,
5451,
29901,
1402,
16285,
7503,
5451,
29962,
13,
13,
1678,
396,
4529,
3514,
572,
414,
363,
4017,
292,
6694,
322,
8845,
9853,
267,
13,
1678,
7945,
29918,
13445,
20069,
353,
3323,
842,
17875,
22966,
20069,
29898,
14968,
29918,
13140,
29897,
13,
1678,
2854,
29918,
13445,
20069,
353,
3323,
842,
17875,
22966,
20069,
29898,
3084,
29918,
13140,
29897,
13,
13,
1678,
396,
19012,
848,
2254,
414,
313,
17743,
457,
8783,
322,
3514,
20069,
29897,
13,
1678,
7945,
29918,
12657,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
14968,
29918,
1272,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
4706,
3514,
20069,
29922,
14968,
29918,
13445,
20069,
29892,
954,
29918,
1287,
414,
29922,
1949,
29918,
1287,
414,
29897,
13,
1678,
2854,
29918,
12657,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
14968,
29918,
1272,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
29871,
13,
4706,
3514,
20069,
29922,
3084,
29918,
13445,
20069,
29892,
954,
29918,
1287,
414,
29922,
1949,
29918,
1287,
414,
29897,
13,
1678,
1243,
29918,
12657,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
1688,
29918,
1272,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
29871,
13,
4706,
954,
29918,
1287,
414,
29922,
1949,
29918,
1287,
414,
29897,
13,
13,
1678,
396,
6084,
278,
1967,
4413,
13,
1678,
4413,
353,
6024,
29890,
1191,
1140,
742,
525,
1867,
312,
519,
2033,
13,
13,
1678,
1904,
353,
4733,
29889,
690,
1212,
29945,
29900,
29898,
1457,
3018,
1312,
29922,
5574,
29897,
13,
1678,
396,
2158,
29898,
4299,
29897,
13,
13,
1678,
396,
4337,
25187,
943,
304,
22796,
565,
315,
29965,
7698,
338,
3625,
13,
1678,
565,
7945,
29918,
265,
29918,
29887,
3746,
29901,
13,
4706,
1904,
29889,
29883,
6191,
580,
13,
308,
13,
1678,
396,
6084,
6410,
740,
313,
29883,
20440,
936,
4891,
29899,
296,
14441,
29897,
13,
1678,
28770,
291,
353,
302,
29876,
29889,
29907,
2124,
5292,
14441,
29931,
2209,
580,
13,
13,
1678,
396,
6084,
5994,
3950,
13,
1678,
5994,
3950,
353,
4842,
305,
29889,
20640,
29889,
3253,
314,
29898,
4299,
29889,
16744,
3285,
29212,
353,
29871,
29900,
29889,
29900,
29900,
29896,
29897,
13,
4706,
13,
1678,
396,
1353,
310,
21502,
12168,
304,
7945,
278,
1904,
13,
1678,
2854,
29918,
6758,
29918,
1195,
353,
7442,
29889,
25433,
396,
5702,
1735,
297,
8845,
6410,
13,
13,
1678,
363,
21502,
305,
297,
3464,
29898,
29896,
29892,
302,
29918,
1022,
2878,
29879,
29974,
29896,
1125,
13,
13,
4706,
396,
3013,
5702,
310,
6694,
322,
8845,
6410,
13,
4706,
7945,
29918,
6758,
353,
29871,
29900,
29889,
29900,
13,
4706,
2854,
29918,
6758,
353,
29871,
29900,
29889,
29900,
13,
4706,
835,
13383,
13,
4706,
396,
7945,
278,
1904,
396,
13,
4706,
835,
13383,
13,
4706,
1904,
29889,
14968,
580,
13,
4706,
363,
848,
29892,
3646,
297,
7945,
29918,
12657,
29901,
13,
9651,
396,
4337,
25187,
943,
304,
22796,
565,
315,
29965,
7698,
338,
3625,
13,
9651,
565,
7945,
29918,
265,
29918,
29887,
3746,
29901,
13,
18884,
848,
29892,
3646,
353,
848,
29889,
29883,
6191,
3285,
3646,
29889,
29883,
6191,
580,
13,
9651,
396,
2821,
278,
4656,
10070,
310,
599,
27545,
3651,
13,
9651,
5994,
3950,
29889,
9171,
29918,
5105,
580,
13,
9651,
396,
6375,
1209,
29901,
10272,
25383,
14391,
491,
6819,
10970,
304,
278,
1904,
13,
9651,
1962,
353,
1904,
29898,
1272,
29897,
13,
9651,
396,
8147,
278,
9853,
6410,
13,
9651,
6410,
353,
28770,
291,
29898,
4905,
29892,
3646,
29897,
13,
9651,
396,
1250,
1328,
1209,
29901,
10272,
16030,
310,
278,
6410,
411,
3390,
304,
1904,
4128,
13,
9651,
6410,
29889,
1627,
1328,
580,
13,
9651,
396,
2189,
263,
2323,
13883,
4331,
313,
15501,
2767,
29897,
13,
9651,
5994,
3950,
29889,
10568,
580,
13,
9651,
396,
2767,
6694,
6410,
13,
9651,
7945,
29918,
6758,
4619,
6410,
29889,
667,
580,
29930,
1272,
29889,
2311,
29898,
29900,
29897,
13,
13,
4706,
835,
13383,
2277,
29937,
268,
13,
4706,
396,
12725,
278,
1904,
396,
13,
4706,
835,
13383,
2277,
29937,
13,
4706,
1904,
29889,
14513,
580,
13,
4706,
363,
848,
29892,
3646,
297,
2854,
29918,
12657,
29901,
13,
9651,
396,
4337,
25187,
943,
304,
22796,
565,
315,
29965,
7698,
338,
3625,
13,
9651,
565,
7945,
29918,
265,
29918,
29887,
3746,
29901,
13,
18884,
848,
29892,
3646,
353,
848,
29889,
29883,
6191,
3285,
3646,
29889,
29883,
6191,
580,
13,
9651,
396,
6375,
1209,
29901,
10272,
25383,
14391,
491,
6819,
10970,
304,
278,
1904,
13,
9651,
1962,
353,
1904,
29898,
1272,
29897,
13,
9651,
396,
8147,
278,
9853,
6410,
13,
9651,
6410,
353,
28770,
291,
29898,
4905,
29892,
3646,
29897,
13,
9651,
396,
2767,
6588,
8845,
6410,
29871,
13,
9651,
2854,
29918,
6758,
4619,
6410,
29889,
667,
580,
29930,
1272,
29889,
2311,
29898,
29900,
29897,
13,
13,
4706,
396,
8147,
6588,
28495,
13,
4706,
7945,
29918,
6758,
353,
7945,
29918,
6758,
29914,
2435,
29898,
14968,
29918,
12657,
29889,
13445,
20069,
29897,
13,
4706,
2854,
29918,
6758,
353,
2854,
29918,
6758,
29914,
2435,
29898,
3084,
29918,
12657,
29889,
13445,
20069,
29897,
13,
308,
13,
4706,
22663,
353,
9657,
29898,
1022,
2878,
29922,
1022,
2878,
29892,
7945,
29918,
6758,
29922,
14968,
29918,
6758,
29892,
2854,
29918,
6758,
29922,
3084,
29918,
6758,
29892,
29871,
13,
462,
268,
931,
29922,
524,
29898,
2230,
29889,
2230,
580,
448,
1369,
29918,
2230,
876,
13,
4706,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
16202,
876,
13,
4706,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
16202,
511,
934,
29922,
16202,
29918,
1445,
29897,
13,
462,
13,
4706,
396,
1596,
6694,
29914,
18157,
13964,
29871,
13,
4706,
1596,
877,
29923,
1129,
305,
29901,
6571,
320,
29873,
5323,
2827,
365,
2209,
29901,
12365,
29889,
29953,
29888,
29913,
320,
29873,
19448,
365,
2209,
29901,
12365,
29889,
29953,
29888,
29913,
4286,
4830,
29898,
13,
9651,
21502,
305,
29892,
7945,
29918,
6758,
29892,
2854,
29918,
6758,
876,
13,
13,
4706,
396,
4078,
1904,
565,
8845,
6410,
756,
9263,
1463,
13,
4706,
565,
2854,
29918,
6758,
5277,
2854,
29918,
6758,
29918,
1195,
29901,
13,
9651,
659,
29918,
16202,
353,
9657,
29898,
3084,
29918,
6758,
29918,
1195,
29922,
3084,
29918,
6758,
29918,
1195,
29892,
3084,
29918,
6758,
29922,
3084,
29918,
6758,
29897,
13,
9651,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
791,
29918,
16202,
876,
13,
9651,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
791,
29918,
16202,
511,
934,
29922,
791,
29918,
16202,
29918,
1445,
29897,
13,
9651,
1596,
877,
19448,
6410,
9263,
1463,
21313,
29901,
29889,
29953,
29888,
29913,
6660,
12365,
29889,
29953,
29888,
7690,
29871,
317,
5555,
1904,
2023,
4286,
4830,
29898,
13,
9651,
2854,
29918,
6758,
29918,
1195,
29892,
13,
9651,
2854,
29918,
6758,
876,
13,
9651,
4842,
305,
29889,
7620,
29898,
4299,
29889,
3859,
29918,
8977,
3285,
525,
29570,
415,
29914,
4299,
29918,
2536,
29918,
1867,
312,
519,
29889,
415,
1495,
13,
9651,
2854,
29918,
6758,
29918,
1195,
353,
2854,
29918,
6758,
13,
632,
13,
1678,
835,
13383,
2277,
29937,
13,
1678,
396,
4299,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
7345,
305,
29889,
1359,
877,
29570,
415,
29914,
4299,
29918,
2536,
29918,
1867,
312,
519,
29889,
415,
8785,
13,
268,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
268,
13,
1678,
318,
2209,
29880,
29918,
1867,
312,
370,
29918,
3396,
580,
2
] |
7_kyu/Strings_swap_vowels_case.py | UlrichBerntien/Codewars-Katas | 0 | 127786 | <gh_stars>0
VOWELS = { c for c in "aeouiAEOUI" }
def swap_vowel_case_char(c :str) -> str:
return c.swapcase() if c in VOWELS else c
def swap_vowel_case(st: str) -> str:
return "".join(swap_vowel_case_char(c) for c in st)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29963,
9806,
6670,
29903,
353,
426,
274,
363,
274,
297,
376,
3660,
283,
29875,
16036,
29949,
3120,
29908,
500,
13,
13,
1753,
17945,
29918,
29894,
27531,
29918,
4878,
29918,
3090,
29898,
29883,
584,
710,
29897,
1599,
851,
29901,
13,
1678,
736,
274,
29889,
26276,
4878,
580,
565,
274,
297,
478,
9806,
6670,
29903,
1683,
274,
13,
13,
1753,
17945,
29918,
29894,
27531,
29918,
4878,
29898,
303,
29901,
851,
29897,
1599,
851,
29901,
29871,
13,
1678,
736,
376,
1642,
7122,
29898,
26276,
29918,
29894,
27531,
29918,
4878,
29918,
3090,
29898,
29883,
29897,
363,
274,
297,
380,
29897,
13,
2
] |
DesignPattern/CompositePattern/__init__.py | Oliver-Yan-2019/algorithm | 1 | 57452 | """
组合模式
"""
from DataStructure.Link import FavoritesList
if __name__ == '__main__':
_favorites_list = FavoritesList()
| [
1,
9995,
13,
31263,
30733,
31382,
30607,
13,
15945,
29908,
13,
13,
3166,
3630,
5015,
12425,
29889,
6595,
1053,
383,
17118,
3246,
1293,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
903,
29888,
17118,
3246,
29918,
1761,
353,
383,
17118,
3246,
1293,
580,
13,
2
] |
examples/passwd_example.py | ZhukovGreen/aiohttp-json-rpc | 0 | 99315 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
from aiohttp_json_rpc.auth.passwd import PasswdAuthBackend
from aiohttp_json_rpc.auth import login_required
from aiohttp_json_rpc import JsonRpc
from aiohttp.web import Application
import asyncio
import os
@asyncio.coroutine
def ping(request):
return 'pong'
@login_required
@asyncio.coroutine
def pong(request):
return 'ping'
if __name__ == '__main__':
PASSWD_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'user.db') # login: admin:admin
loop = asyncio.get_event_loop()
rpc = JsonRpc(auth_backend=PasswdAuthBackend(PASSWD_FILE))
rpc.add_methods(
('', ping),
('', pong),
)
app = Application(loop=loop)
app.router.add_route('*', '/', rpc)
handler = app.make_handler()
server = loop.run_until_complete(
loop.create_server(handler, '0.0.0.0', 8080))
loop.run_forever()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
3166,
263,
601,
1124,
29918,
3126,
29918,
29878,
6739,
29889,
5150,
29889,
3364,
9970,
1053,
6978,
9970,
6444,
5841,
355,
13,
3166,
263,
601,
1124,
29918,
3126,
29918,
29878,
6739,
29889,
5150,
1053,
6464,
29918,
12403,
13,
3166,
263,
601,
1124,
29918,
3126,
29918,
29878,
6739,
1053,
14355,
29934,
6739,
13,
3166,
263,
601,
1124,
29889,
2676,
1053,
8427,
13,
5215,
408,
948,
3934,
13,
5215,
2897,
13,
13,
13,
29992,
294,
948,
3934,
29889,
2616,
449,
457,
13,
1753,
24543,
29898,
3827,
1125,
13,
1678,
736,
525,
29886,
549,
29915,
13,
13,
13,
29992,
7507,
29918,
12403,
13,
29992,
294,
948,
3934,
29889,
2616,
449,
457,
13,
1753,
282,
549,
29898,
3827,
1125,
13,
1678,
736,
525,
15702,
29915,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
17687,
1799,
24668,
29918,
7724,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
8243,
13,
462,
1669,
525,
1792,
29889,
2585,
1495,
29871,
396,
6464,
29901,
4113,
29901,
6406,
13,
13,
1678,
2425,
353,
408,
948,
3934,
29889,
657,
29918,
3696,
29918,
7888,
580,
13,
1678,
364,
6739,
353,
14355,
29934,
6739,
29898,
5150,
29918,
27852,
29922,
7129,
9970,
6444,
5841,
355,
29898,
25711,
24668,
29918,
7724,
876,
13,
13,
1678,
364,
6739,
29889,
1202,
29918,
23515,
29898,
13,
4706,
6702,
742,
24543,
511,
13,
4706,
6702,
742,
282,
549,
511,
13,
1678,
1723,
13,
13,
1678,
623,
353,
8427,
29898,
7888,
29922,
7888,
29897,
13,
1678,
623,
29889,
15140,
29889,
1202,
29918,
13134,
877,
29930,
742,
8207,
742,
364,
6739,
29897,
13,
13,
1678,
7834,
353,
623,
29889,
5675,
29918,
13789,
580,
13,
13,
1678,
1923,
353,
2425,
29889,
3389,
29918,
29305,
29918,
8835,
29898,
13,
4706,
2425,
29889,
3258,
29918,
2974,
29898,
13789,
29892,
525,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
742,
29871,
29947,
29900,
29947,
29900,
876,
13,
13,
1678,
2425,
29889,
3389,
29918,
1079,
369,
580,
13,
2
] |
api/admin.py | titans55/pizza-ordering-service | 1 | 44719 | from django.contrib import admin
from django import forms
from . import models
class PizzaFlavorAdminForm(forms.ModelForm):
class Meta:
model = models.PizzaFlavor
fields = "__all__"
class PizzaFlavorAdmin(admin.ModelAdmin):
form = PizzaFlavorAdminForm
list_display = [
"id",
"name",
"s_size_price",
"m_size_price",
"l_size_price",
]
readonly_fields = [
"m_size_price",
"s_size_price",
"l_size_price",
"id",
"name",
]
class OrderedPizzaAdminForm(forms.ModelForm):
class Meta:
model = models.OrderedPizza
fields = "__all__"
class OrderedPizzaAdmin(admin.ModelAdmin):
form = OrderedPizzaAdminForm
list_display = [
"id",
"size",
"created",
"count",
]
readonly_fields = [
"id",
"size",
"created",
"count",
]
class OrderAdminForm(forms.ModelForm):
class Meta:
model = models.Order
fields = "__all__"
class OrderAdmin(admin.ModelAdmin):
form = OrderAdminForm
list_display = [
"id",
"customer_id",
"last_updated",
"created",
"is_paid",
]
readonly_fields = [
"customer_id",
"last_updated",
"created",
"is_paid",
"id",
]
class DeliveryDetailAdminForm(forms.ModelForm):
class Meta:
model = models.DeliveryDetail
fields = "__all__"
class DeliveryDetailAdmin(admin.ModelAdmin):
form = DeliveryDetailAdminForm
list_display = [
"id",
"assigned_courier_id",
"status",
"created",
]
readonly_fields = [
"assigned_courier_id",
"status",
"id",
"created",
]
admin.site.register(models.PizzaFlavor, PizzaFlavorAdmin)
admin.site.register(models.OrderedPizza, OrderedPizzaAdmin)
admin.site.register(models.Order, OrderAdmin)
admin.site.register(models.DeliveryDetail, DeliveryDetailAdmin) | [
1,
515,
9557,
29889,
21570,
1053,
4113,
13,
3166,
9557,
1053,
7190,
13,
13,
3166,
869,
1053,
4733,
13,
13,
13,
1990,
349,
24990,
29943,
4112,
272,
12754,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4733,
29889,
29925,
24990,
29943,
4112,
272,
13,
4706,
4235,
353,
376,
1649,
497,
1649,
29908,
13,
13,
13,
1990,
349,
24990,
29943,
4112,
272,
12754,
29898,
6406,
29889,
3195,
12754,
1125,
13,
1678,
883,
353,
349,
24990,
29943,
4112,
272,
12754,
2500,
13,
1678,
1051,
29918,
4990,
353,
518,
13,
4706,
376,
333,
613,
13,
4706,
376,
978,
613,
13,
4706,
376,
29879,
29918,
2311,
29918,
9175,
613,
13,
4706,
376,
29885,
29918,
2311,
29918,
9175,
613,
13,
4706,
376,
29880,
29918,
2311,
29918,
9175,
613,
13,
1678,
4514,
13,
1678,
20623,
29918,
9621,
353,
518,
13,
4706,
376,
29885,
29918,
2311,
29918,
9175,
613,
13,
4706,
376,
29879,
29918,
2311,
29918,
9175,
613,
13,
4706,
376,
29880,
29918,
2311,
29918,
9175,
613,
13,
4706,
376,
333,
613,
13,
4706,
376,
978,
613,
13,
1678,
4514,
13,
13,
13,
1990,
8170,
287,
29925,
24990,
12754,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4733,
29889,
7514,
287,
29925,
24990,
13,
4706,
4235,
353,
376,
1649,
497,
1649,
29908,
13,
13,
13,
1990,
8170,
287,
29925,
24990,
12754,
29898,
6406,
29889,
3195,
12754,
1125,
13,
1678,
883,
353,
8170,
287,
29925,
24990,
12754,
2500,
13,
1678,
1051,
29918,
4990,
353,
518,
13,
4706,
376,
333,
613,
13,
4706,
376,
2311,
613,
13,
4706,
376,
11600,
613,
13,
4706,
376,
2798,
613,
13,
1678,
4514,
13,
1678,
20623,
29918,
9621,
353,
518,
13,
4706,
376,
333,
613,
13,
4706,
376,
2311,
613,
13,
4706,
376,
11600,
613,
13,
4706,
376,
2798,
613,
13,
1678,
4514,
13,
13,
13,
1990,
8170,
12754,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4733,
29889,
7514,
13,
4706,
4235,
353,
376,
1649,
497,
1649,
29908,
13,
13,
13,
1990,
8170,
12754,
29898,
6406,
29889,
3195,
12754,
1125,
13,
1678,
883,
353,
8170,
12754,
2500,
13,
1678,
1051,
29918,
4990,
353,
518,
13,
4706,
376,
333,
613,
13,
4706,
376,
15539,
29918,
333,
613,
13,
4706,
376,
4230,
29918,
21402,
613,
13,
4706,
376,
11600,
613,
13,
4706,
376,
275,
29918,
3274,
333,
613,
13,
1678,
4514,
13,
1678,
20623,
29918,
9621,
353,
518,
13,
4706,
376,
15539,
29918,
333,
613,
13,
4706,
376,
4230,
29918,
21402,
613,
13,
4706,
376,
11600,
613,
13,
4706,
376,
275,
29918,
3274,
333,
613,
13,
4706,
376,
333,
613,
13,
1678,
4514,
13,
13,
13,
1990,
360,
27657,
16570,
12754,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4733,
29889,
29928,
27657,
16570,
13,
4706,
4235,
353,
376,
1649,
497,
1649,
29908,
13,
13,
13,
1990,
360,
27657,
16570,
12754,
29898,
6406,
29889,
3195,
12754,
1125,
13,
1678,
883,
353,
360,
27657,
16570,
12754,
2500,
13,
1678,
1051,
29918,
4990,
353,
518,
13,
4706,
376,
333,
613,
13,
4706,
376,
465,
12961,
29918,
16589,
4336,
29918,
333,
613,
13,
4706,
376,
4882,
613,
13,
4706,
376,
11600,
613,
13,
1678,
4514,
13,
1678,
20623,
29918,
9621,
353,
518,
13,
4706,
376,
465,
12961,
29918,
16589,
4336,
29918,
333,
613,
13,
4706,
376,
4882,
613,
13,
4706,
376,
333,
613,
13,
4706,
376,
11600,
613,
13,
1678,
4514,
13,
13,
13,
6406,
29889,
2746,
29889,
9573,
29898,
9794,
29889,
29925,
24990,
29943,
4112,
272,
29892,
349,
24990,
29943,
4112,
272,
12754,
29897,
13,
6406,
29889,
2746,
29889,
9573,
29898,
9794,
29889,
7514,
287,
29925,
24990,
29892,
8170,
287,
29925,
24990,
12754,
29897,
13,
6406,
29889,
2746,
29889,
9573,
29898,
9794,
29889,
7514,
29892,
8170,
12754,
29897,
13,
6406,
29889,
2746,
29889,
9573,
29898,
9794,
29889,
29928,
27657,
16570,
29892,
360,
27657,
16570,
12754,
29897,
2
] |
api/portfolio/utils.py | lucasblazzi/insights-project | 0 | 1601653 | import os
import grpc
from google.protobuf.json_format import MessageToDict
from insights_pb2_grpc import MetricsStub
from insights_pb2 import PortfolioRequest, Product
import redis
import ast
metrics_port = os.environ.get("METRICS_PORT", "9999")
def message_encoder(message):
for k, v in message.items():
if isinstance(v, list):
message[k] = str(v)
return message
def build_request(payload):
request = PortfolioRequest()
request.start_date = payload["start_date"]
request.end_date = payload["end_date"]
request.amount = float(payload["amount"])
for p in payload.get("products", []):
product = request.products.add()
product.id = p["id"]
product.proportion = float(p["proportion"])
product.amount = float(p["amount"])
return request
def get_portfolio_metrics(payload):
try:
with grpc.insecure_channel(f"metrics_service:{metrics_port}") as channel:
stub = MetricsStub(channel)
request = build_request(payload)
metrics = stub.GetPortfolioMetrics(request)
return MessageToDict(metrics)
except Exception as e:
raise e
def send_notifications(portfolio, clients):
try:
client = redis.Redis(host="redis_db", port=6379)
_portfolio = ast.literal_eval(portfolio)
for c in clients:
_portfolio["email"] = c["email"]
_portfolio["name"] = c["name"]
client.xadd("portfolio", message_encoder(_portfolio))
except Exception as e:
raise e
| [
1,
1053,
2897,
13,
5215,
867,
6739,
13,
3166,
5386,
29889,
17529,
9721,
29889,
3126,
29918,
4830,
1053,
7777,
1762,
21533,
13,
3166,
1663,
5861,
29918,
24381,
29906,
29918,
629,
6739,
1053,
4737,
10817,
855,
431,
13,
3166,
1663,
5861,
29918,
24381,
29906,
1053,
3371,
25648,
3089,
29892,
10969,
13,
5215,
29825,
13,
5215,
8717,
13,
13,
2527,
10817,
29918,
637,
353,
2897,
29889,
21813,
29889,
657,
703,
2303,
5659,
2965,
29903,
29918,
15082,
613,
376,
29929,
29929,
29929,
29929,
1159,
13,
13,
13,
1753,
2643,
29918,
3977,
6119,
29898,
4906,
1125,
13,
1678,
363,
413,
29892,
325,
297,
2643,
29889,
7076,
7295,
13,
4706,
565,
338,
8758,
29898,
29894,
29892,
1051,
1125,
13,
9651,
2643,
29961,
29895,
29962,
353,
851,
29898,
29894,
29897,
13,
1678,
736,
2643,
13,
13,
13,
1753,
2048,
29918,
3827,
29898,
23813,
1125,
13,
1678,
2009,
353,
3371,
25648,
3089,
580,
13,
1678,
2009,
29889,
2962,
29918,
1256,
353,
20092,
3366,
2962,
29918,
1256,
3108,
13,
1678,
2009,
29889,
355,
29918,
1256,
353,
20092,
3366,
355,
29918,
1256,
3108,
13,
1678,
2009,
29889,
14506,
353,
5785,
29898,
23813,
3366,
14506,
20068,
13,
1678,
363,
282,
297,
20092,
29889,
657,
703,
14456,
613,
5159,
1125,
13,
4706,
3234,
353,
2009,
29889,
14456,
29889,
1202,
580,
13,
4706,
3234,
29889,
333,
353,
282,
3366,
333,
3108,
13,
4706,
3234,
29889,
771,
637,
291,
353,
5785,
29898,
29886,
3366,
771,
637,
291,
20068,
13,
4706,
3234,
29889,
14506,
353,
5785,
29898,
29886,
3366,
14506,
20068,
13,
1678,
736,
2009,
13,
13,
13,
1753,
679,
29918,
637,
25648,
29918,
2527,
10817,
29898,
23813,
1125,
13,
1678,
1018,
29901,
13,
4706,
411,
867,
6739,
29889,
262,
24216,
29918,
12719,
29898,
29888,
29908,
2527,
10817,
29918,
5509,
26254,
2527,
10817,
29918,
637,
27195,
408,
8242,
29901,
13,
9651,
19281,
353,
4737,
10817,
855,
431,
29898,
12719,
29897,
13,
9651,
2009,
353,
2048,
29918,
3827,
29898,
23813,
29897,
13,
9651,
21556,
353,
19281,
29889,
2577,
2290,
25648,
10095,
10817,
29898,
3827,
29897,
13,
9651,
736,
7777,
1762,
21533,
29898,
2527,
10817,
29897,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
12020,
321,
13,
13,
13,
1753,
3638,
29918,
1333,
8232,
29898,
637,
25648,
29892,
13154,
1125,
13,
1678,
1018,
29901,
13,
4706,
3132,
353,
29825,
29889,
9039,
275,
29898,
3069,
543,
1127,
275,
29918,
2585,
613,
2011,
29922,
29953,
29941,
29955,
29929,
29897,
13,
4706,
903,
637,
25648,
353,
8717,
29889,
20889,
284,
29918,
14513,
29898,
637,
25648,
29897,
13,
4706,
363,
274,
297,
13154,
29901,
13,
9651,
903,
637,
25648,
3366,
5269,
3108,
353,
274,
3366,
5269,
3108,
13,
9651,
903,
637,
25648,
3366,
978,
3108,
353,
274,
3366,
978,
3108,
13,
9651,
3132,
29889,
29916,
1202,
703,
637,
25648,
613,
2643,
29918,
3977,
6119,
7373,
637,
25648,
876,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
12020,
321,
13,
13,
2
] |
floreal/views/view_purchases.py | caracole-io/circuitscourts | 0 | 18364 | <reponame>caracole-io/circuitscourts<filename>floreal/views/view_purchases.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from caracole import settings
from .decorators import nw_admin_required
from .getters import get_delivery, get_subgroup
from . import latex
from .spreadsheet import spreadsheet
from .delivery_description import delivery_description
MIME_TYPE = {
'pdf': "application/pdf",
'xlsx': "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}
def non_html_response(name_bits, name_extension, content):
"""Common helper to serve PDF and Excel content."""
filename = ("_".join(name_bits) + "." + name_extension).replace(" ", "_")
mime_type = MIME_TYPE[name_extension]
response = HttpResponse(content_type=mime_type)
response['Content-Disposition'] = 'attachment; filename="%s"' % filename
response.write(content)
return response
@login_required()
def view_purchases_html(request, delivery, subgroup=None):
"""View purchases for a given delivery, possibly restricted to a subgroup. (subgroup) staff only."""
dv = get_delivery(delivery)
if subgroup:
sg = get_subgroup(subgroup)
if request.user not in sg.staff.all() and request.user not in sg.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
subgroups = [sg]
else:
if request.user not in dv.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
subgroups = dv.network.subgroup_set.all()
return render_to_response('view_purchases.html', delivery_description(dv, subgroups))
@login_required()
def view_purchases_xlsx(request, delivery, subgroup=None):
"""View purchases for a given delivery as an MS-Excel spreadsheet, possibly restricted to a subgroup.
(subgroup) staff only."""
dv = get_delivery(delivery)
if subgroup:
sg = get_subgroup(subgroup)
if request.user not in sg.staff.all() and request.user not in sg.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
subgroups = [sg]
else:
if request.user not in dv.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
subgroups = dv.network.subgroup_set.all()
return non_html_response((dv.network.name, dv.name), "xlsx", spreadsheet(dv, subgroups))
@login_required()
def view_purchases_latex(request, delivery, subgroup=None):
"""View purchases for a given delivery as a PDF table, generated through LaTeX, possibly restricted to a subgroup.
(subgroup) staff only."""
dv = get_delivery(delivery)
if subgroup:
sg = get_subgroup(subgroup)
if request.user not in sg.staff.all() and request.user not in sg.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
content = latex.subgroup(dv, sg)
name_bits = (dv.network.name, dv.name, sg.name)
else:
if request.user not in dv.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
content = latex.delivery_table(dv)
name_bits = (dv.network.name, dv.name)
return non_html_response(name_bits, "pdf", content)
@login_required()
def view_cards_latex(request, delivery, subgroup=None):
"""View purchases for a given delivery as a PDF table, generated through LaTeX, possibly restricted to a subgroup.
Subgroups are presented as ready-to-cut tables, whole deliveries as list per subgroup. (subgroup) staff only."""
dv = get_delivery(delivery)
if subgroup:
sg = get_subgroup(subgroup)
if request.user not in sg.staff.all() and request.user not in sg.network.staff.all():
return HttpResponseForbidden("Réservé aux admins")
content = latex.cards(dv, sg)
name_bits = (dv.network.name, dv.name, sg.name)
else:
content = latex.delivery_cards(dv)
name_bits = (dv.network.name, dv.name)
return non_html_response(name_bits, "pdf", content)
@nw_admin_required(lambda a: get_delivery(a['delivery']).network)
def get_archive(request, delivery, suffix):
"""Retrieve the PDF/MS-Excel file versions of a terminated delivery which have been saved upontermination."""
dv = get_delivery(delivery)
file_name = os.path.join(settings.DELIVERY_ARCHIVE_DIR, "dv-%d.%s" % (dv.id, suffix))
with open(file_name) as f:
content = f.read()
name_bits = (dv.network.name, dv.name)
return non_html_response(name_bits, suffix, content) | [
1,
529,
276,
1112,
420,
29958,
4287,
562,
1772,
29899,
601,
29914,
6034,
19544,
29883,
473,
1372,
29966,
9507,
29958,
1579,
487,
284,
29914,
7406,
29914,
1493,
29918,
29886,
2458,
2129,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
2897,
13,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
29892,
9056,
5103,
2831,
29890,
4215,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29918,
517,
29918,
5327,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
13,
13,
3166,
1559,
562,
1772,
1053,
6055,
13,
3166,
869,
19557,
4097,
1053,
302,
29893,
29918,
6406,
29918,
12403,
13,
3166,
869,
657,
2153,
1053,
679,
29918,
29881,
27657,
29892,
679,
29918,
1491,
2972,
13,
3166,
869,
1053,
5683,
29916,
13,
3166,
869,
1028,
27844,
1053,
9677,
9855,
13,
3166,
869,
29881,
27657,
29918,
8216,
1053,
28289,
29918,
8216,
13,
13,
13,
29924,
8890,
29918,
11116,
353,
426,
13,
1678,
525,
5140,
2396,
376,
6214,
29914,
5140,
613,
13,
1678,
525,
20267,
29916,
2396,
376,
6214,
29914,
29894,
299,
29889,
3150,
3134,
689,
1446,
29899,
29877,
2416,
287,
4463,
29889,
1028,
27844,
828,
29889,
9855,
9092,
13,
13,
13,
1753,
1661,
29918,
1420,
29918,
5327,
29898,
978,
29918,
14836,
29892,
1024,
29918,
17588,
29892,
2793,
1125,
13,
1678,
9995,
18877,
16876,
304,
9080,
11328,
322,
11388,
2793,
1213,
15945,
13,
1678,
10422,
353,
4852,
29918,
1642,
7122,
29898,
978,
29918,
14836,
29897,
718,
376,
1213,
718,
1024,
29918,
17588,
467,
6506,
703,
9162,
11119,
1159,
13,
1678,
286,
603,
29918,
1853,
353,
341,
8890,
29918,
11116,
29961,
978,
29918,
17588,
29962,
13,
1678,
2933,
353,
9056,
5103,
29898,
3051,
29918,
1853,
29922,
29885,
603,
29918,
1853,
29897,
13,
1678,
2933,
1839,
3916,
29899,
4205,
3283,
2033,
353,
525,
14930,
358,
29936,
10422,
543,
29995,
29879,
29908,
29915,
1273,
10422,
13,
1678,
2933,
29889,
3539,
29898,
3051,
29897,
13,
1678,
736,
2933,
13,
13,
13,
29992,
7507,
29918,
12403,
580,
13,
1753,
1776,
29918,
29886,
2458,
2129,
29918,
1420,
29898,
3827,
29892,
28289,
29892,
24410,
29922,
8516,
1125,
13,
1678,
9995,
1043,
10596,
2129,
363,
263,
2183,
28289,
29892,
10075,
22078,
304,
263,
24410,
29889,
313,
1491,
2972,
29897,
13925,
871,
1213,
15945,
13,
1678,
14897,
353,
679,
29918,
29881,
27657,
29898,
29881,
27657,
29897,
13,
1678,
565,
24410,
29901,
13,
4706,
269,
29887,
353,
679,
29918,
1491,
2972,
29898,
1491,
2972,
29897,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
303,
3470,
29889,
497,
580,
322,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
1014,
13155,
353,
518,
5311,
29962,
13,
1678,
1683,
29901,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
14897,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
1014,
13155,
353,
14897,
29889,
11618,
29889,
1491,
2972,
29918,
842,
29889,
497,
580,
13,
1678,
736,
4050,
29918,
517,
29918,
5327,
877,
1493,
29918,
29886,
2458,
2129,
29889,
1420,
742,
28289,
29918,
8216,
29898,
29881,
29894,
29892,
1014,
13155,
876,
13,
13,
13,
29992,
7507,
29918,
12403,
580,
13,
1753,
1776,
29918,
29886,
2458,
2129,
29918,
20267,
29916,
29898,
3827,
29892,
28289,
29892,
24410,
29922,
8516,
1125,
13,
1678,
9995,
1043,
10596,
2129,
363,
263,
2183,
28289,
408,
385,
10888,
29899,
22926,
9677,
9855,
29892,
10075,
22078,
304,
263,
24410,
29889,
13,
1678,
313,
1491,
2972,
29897,
13925,
871,
1213,
15945,
13,
1678,
14897,
353,
679,
29918,
29881,
27657,
29898,
29881,
27657,
29897,
13,
1678,
565,
24410,
29901,
13,
4706,
269,
29887,
353,
679,
29918,
1491,
2972,
29898,
1491,
2972,
29897,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
303,
3470,
29889,
497,
580,
322,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
1014,
13155,
353,
518,
5311,
29962,
13,
1678,
1683,
29901,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
14897,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
1014,
13155,
353,
14897,
29889,
11618,
29889,
1491,
2972,
29918,
842,
29889,
497,
580,
13,
1678,
736,
1661,
29918,
1420,
29918,
5327,
3552,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
511,
376,
20267,
29916,
613,
9677,
9855,
29898,
29881,
29894,
29892,
1014,
13155,
876,
13,
13,
13,
29992,
7507,
29918,
12403,
580,
13,
1753,
1776,
29918,
29886,
2458,
2129,
29918,
25694,
29898,
3827,
29892,
28289,
29892,
24410,
29922,
8516,
1125,
13,
1678,
9995,
1043,
10596,
2129,
363,
263,
2183,
28289,
408,
263,
11328,
1591,
29892,
5759,
1549,
29186,
29892,
10075,
22078,
304,
263,
24410,
29889,
13,
1678,
313,
1491,
2972,
29897,
13925,
871,
1213,
15945,
13,
1678,
14897,
353,
679,
29918,
29881,
27657,
29898,
29881,
27657,
29897,
13,
1678,
565,
24410,
29901,
13,
4706,
269,
29887,
353,
679,
29918,
1491,
2972,
29898,
1491,
2972,
29897,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
303,
3470,
29889,
497,
580,
322,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
2793,
353,
5683,
29916,
29889,
1491,
2972,
29898,
29881,
29894,
29892,
269,
29887,
29897,
13,
4706,
1024,
29918,
14836,
353,
313,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
29892,
269,
29887,
29889,
978,
29897,
13,
1678,
1683,
29901,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
14897,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
2793,
353,
5683,
29916,
29889,
29881,
27657,
29918,
2371,
29898,
29881,
29894,
29897,
13,
4706,
1024,
29918,
14836,
353,
313,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
29897,
13,
1678,
736,
1661,
29918,
1420,
29918,
5327,
29898,
978,
29918,
14836,
29892,
376,
5140,
613,
2793,
29897,
13,
13,
13,
29992,
7507,
29918,
12403,
580,
13,
1753,
1776,
29918,
28160,
29918,
25694,
29898,
3827,
29892,
28289,
29892,
24410,
29922,
8516,
1125,
13,
1678,
9995,
1043,
10596,
2129,
363,
263,
2183,
28289,
408,
263,
11328,
1591,
29892,
5759,
1549,
29186,
29892,
10075,
22078,
304,
263,
24410,
29889,
13,
1678,
3323,
13155,
526,
9132,
408,
7960,
29899,
517,
29899,
7582,
6131,
29892,
3353,
12021,
583,
408,
1051,
639,
24410,
29889,
313,
1491,
2972,
29897,
13925,
871,
1213,
15945,
13,
1678,
14897,
353,
679,
29918,
29881,
27657,
29898,
29881,
27657,
29897,
13,
1678,
565,
24410,
29901,
13,
4706,
269,
29887,
353,
679,
29918,
1491,
2972,
29898,
1491,
2972,
29897,
13,
4706,
565,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
303,
3470,
29889,
497,
580,
322,
2009,
29889,
1792,
451,
297,
269,
29887,
29889,
11618,
29889,
303,
3470,
29889,
497,
7295,
13,
9651,
736,
9056,
5103,
2831,
29890,
4215,
703,
29934,
29948,
2140,
29948,
3479,
7336,
1144,
1159,
13,
4706,
2793,
353,
5683,
29916,
29889,
28160,
29898,
29881,
29894,
29892,
269,
29887,
29897,
13,
4706,
1024,
29918,
14836,
353,
313,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
29892,
269,
29887,
29889,
978,
29897,
13,
1678,
1683,
29901,
13,
4706,
2793,
353,
5683,
29916,
29889,
29881,
27657,
29918,
28160,
29898,
29881,
29894,
29897,
13,
4706,
1024,
29918,
14836,
353,
313,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
29897,
13,
1678,
736,
1661,
29918,
1420,
29918,
5327,
29898,
978,
29918,
14836,
29892,
376,
5140,
613,
2793,
29897,
13,
13,
13,
29992,
29876,
29893,
29918,
6406,
29918,
12403,
29898,
2892,
263,
29901,
679,
29918,
29881,
27657,
29898,
29874,
1839,
29881,
27657,
2033,
467,
11618,
29897,
13,
1753,
679,
29918,
10867,
29898,
3827,
29892,
28289,
29892,
25557,
1125,
13,
1678,
9995,
8015,
29878,
2418,
278,
11328,
29914,
4345,
29899,
22926,
934,
6910,
310,
263,
29185,
28289,
607,
505,
1063,
7160,
2501,
18821,
362,
1213,
15945,
13,
1678,
14897,
353,
679,
29918,
29881,
27657,
29898,
29881,
27657,
29897,
13,
1678,
934,
29918,
978,
353,
2897,
29889,
2084,
29889,
7122,
29898,
11027,
29889,
2287,
5265,
5348,
29979,
29918,
1718,
3210,
18474,
29918,
9464,
29892,
376,
29881,
29894,
19222,
29881,
29889,
29995,
29879,
29908,
1273,
313,
29881,
29894,
29889,
333,
29892,
25557,
876,
13,
1678,
411,
1722,
29898,
1445,
29918,
978,
29897,
408,
285,
29901,
13,
4706,
2793,
353,
285,
29889,
949,
580,
13,
1678,
1024,
29918,
14836,
353,
313,
29881,
29894,
29889,
11618,
29889,
978,
29892,
14897,
29889,
978,
29897,
13,
1678,
736,
1661,
29918,
1420,
29918,
5327,
29898,
978,
29918,
14836,
29892,
25557,
29892,
2793,
29897,
2
] |
mindspore/parallel/mpi/_mpi_config.py | GuoSuiming/mindspore | 55 | 131048 | <reponame>GuoSuiming/mindspore<filename>mindspore/parallel/mpi/_mpi_config.py
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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.
# ============================================================================
"""
The MPI config, used to configure the MPI environment.
"""
import threading
from mindspore._c_expression import MpiConfig
from mindspore._checkparam import args_type_check
class _MpiConfig:
"""
_MpiConfig is the config tool for controlling MPI
Note:
Create a config through instantiating MpiConfig object is not recommended.
should use MpiConfig() to get the config since MpiConfig is singleton.
"""
_instance = None
_instance_lock = threading.Lock()
def __init__(self):
self._mpiconfig_handle = MpiConfig.get_instance()
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance_lock.acquire()
cls._instance = object.__new__(cls)
cls._instance_lock.release()
return cls._instance
def __getattribute__(self, attr):
value = object.__getattribute__(self, attr)
if attr == "_mpiconfig_handle" and value is None:
raise ValueError("mpiconfig handle is none in MpiConfig!!!")
return value
@property
def enable_mpi(self):
return self._mpiconfig_handle.get_enable_mpi()
@enable_mpi.setter
def enable_mpi(self, enable_mpi):
self._mpiconfig_handle.set_enable_mpi(enable_mpi)
_k_mpi_config = None
def _mpi_config():
"""
Get the global mpi config, if mpi config is not created, create a new one.
Returns:
_MpiConfig, the global mpi config.
"""
global _k_mpi_config
if _k_mpi_config is None:
_k_mpi_config = _MpiConfig()
return _k_mpi_config
@args_type_check(enable_mpi=bool)
def _set_mpi_config(**kwargs):
"""
Sets mpi config for running environment.
mpi config should be configured before running your program. If there is no configuration,
mpi moudle will be disabled by default.
Note:
Attribute name is required for setting attributes.
Args:
enable_mpi (bool): Whether to enable mpi. Default: False.
Raises:
ValueError: If input key is not an attribute in mpi config.
Examples:
>>> mpiconfig.set_mpi_config(enable_mpi=True)
"""
for key, value in kwargs.items():
if not hasattr(_mpi_config(), key):
raise ValueError("Set mpi config keyword %s is not recognized!" % key)
setattr(_mpi_config(), key, value)
def _get_mpi_config(attr_key):
"""
Gets mpi config attribute value according to the input key.
Args:
attr_key (str): The key of the attribute.
Returns:
Object, The value of given attribute key.
Raises:
ValueError: If input key is not an attribute in config.
"""
if not hasattr(_mpi_config(), attr_key):
raise ValueError("Get context keyword %s is not recognized!" % attr_key)
return getattr(_mpi_config(), attr_key)
| [
1,
529,
276,
1112,
420,
29958,
9485,
29877,
5091,
326,
292,
29914,
24021,
1028,
487,
29966,
9507,
29958,
24021,
1028,
487,
29914,
23482,
29914,
1526,
29875,
19891,
1526,
29875,
29918,
2917,
29889,
2272,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
379,
3357,
26599,
8364,
11763,
3189,
1696,
19806,
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,
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,
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,
1275,
9166,
9166,
9166,
9166,
4936,
1360,
13,
15945,
29908,
13,
1576,
341,
2227,
2295,
29892,
1304,
304,
10822,
278,
341,
2227,
5177,
29889,
13,
15945,
29908,
13,
5215,
3244,
292,
13,
3166,
3458,
1028,
487,
3032,
29883,
29918,
17471,
1053,
341,
1631,
3991,
13,
3166,
3458,
1028,
487,
3032,
3198,
3207,
1053,
6389,
29918,
1853,
29918,
3198,
13,
13,
1990,
903,
29924,
1631,
3991,
29901,
13,
1678,
9995,
13,
1678,
903,
29924,
1631,
3991,
338,
278,
2295,
5780,
363,
640,
22155,
341,
2227,
13,
13,
1678,
3940,
29901,
13,
4706,
6204,
263,
2295,
1549,
13213,
1218,
341,
1631,
3991,
1203,
338,
451,
13622,
29889,
13,
4706,
881,
671,
341,
1631,
3991,
580,
304,
679,
278,
2295,
1951,
341,
1631,
3991,
338,
27130,
29889,
13,
1678,
9995,
13,
1678,
903,
8758,
353,
6213,
13,
1678,
903,
8758,
29918,
908,
353,
3244,
292,
29889,
16542,
580,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
1526,
4144,
1003,
29918,
8411,
353,
341,
1631,
3991,
29889,
657,
29918,
8758,
580,
13,
13,
1678,
822,
4770,
1482,
12035,
25932,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
565,
1067,
29879,
3032,
8758,
338,
6213,
29901,
13,
9651,
1067,
29879,
3032,
8758,
29918,
908,
29889,
562,
1548,
580,
13,
9651,
1067,
29879,
3032,
8758,
353,
1203,
17255,
1482,
12035,
25932,
29897,
13,
9651,
1067,
29879,
3032,
8758,
29918,
908,
29889,
14096,
580,
13,
4706,
736,
1067,
29879,
3032,
8758,
13,
13,
1678,
822,
4770,
657,
12715,
12035,
1311,
29892,
12421,
1125,
13,
4706,
995,
353,
1203,
17255,
657,
12715,
12035,
1311,
29892,
12421,
29897,
13,
4706,
565,
12421,
1275,
11119,
1526,
4144,
1003,
29918,
8411,
29908,
322,
995,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
1526,
4144,
1003,
4386,
338,
5642,
297,
341,
1631,
3991,
21004,
1159,
13,
4706,
736,
995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
9025,
29918,
1526,
29875,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
1526,
4144,
1003,
29918,
8411,
29889,
657,
29918,
12007,
29918,
1526,
29875,
580,
13,
13,
1678,
732,
12007,
29918,
1526,
29875,
29889,
842,
357,
13,
1678,
822,
9025,
29918,
1526,
29875,
29898,
1311,
29892,
9025,
29918,
1526,
29875,
1125,
13,
4706,
1583,
3032,
1526,
4144,
1003,
29918,
8411,
29889,
842,
29918,
12007,
29918,
1526,
29875,
29898,
12007,
29918,
1526,
29875,
29897,
13,
13,
29918,
29895,
29918,
1526,
29875,
29918,
2917,
353,
6213,
13,
1753,
903,
1526,
29875,
29918,
2917,
7295,
13,
1678,
9995,
13,
1678,
3617,
278,
5534,
286,
1631,
2295,
29892,
565,
286,
1631,
2295,
338,
451,
2825,
29892,
1653,
263,
716,
697,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
903,
29924,
1631,
3991,
29892,
278,
5534,
286,
1631,
2295,
29889,
13,
1678,
9995,
13,
1678,
5534,
903,
29895,
29918,
1526,
29875,
29918,
2917,
13,
1678,
565,
903,
29895,
29918,
1526,
29875,
29918,
2917,
338,
6213,
29901,
13,
4706,
903,
29895,
29918,
1526,
29875,
29918,
2917,
353,
903,
29924,
1631,
3991,
580,
13,
1678,
736,
903,
29895,
29918,
1526,
29875,
29918,
2917,
13,
13,
29992,
5085,
29918,
1853,
29918,
3198,
29898,
12007,
29918,
1526,
29875,
29922,
11227,
29897,
13,
1753,
903,
842,
29918,
1526,
29875,
29918,
2917,
29898,
1068,
19290,
1125,
13,
1678,
9995,
13,
1678,
317,
1691,
286,
1631,
2295,
363,
2734,
5177,
29889,
13,
13,
1678,
286,
1631,
2295,
881,
367,
13252,
1434,
2734,
596,
1824,
29889,
960,
727,
338,
694,
5285,
29892,
13,
1678,
286,
1631,
286,
2736,
280,
674,
367,
12708,
491,
2322,
29889,
13,
13,
1678,
3940,
29901,
13,
4706,
23833,
1024,
338,
3734,
363,
4444,
8393,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
9025,
29918,
1526,
29875,
313,
11227,
1125,
26460,
304,
9025,
286,
1631,
29889,
13109,
29901,
7700,
29889,
13,
13,
1678,
390,
1759,
267,
29901,
13,
4706,
7865,
2392,
29901,
960,
1881,
1820,
338,
451,
385,
5352,
297,
286,
1631,
2295,
29889,
13,
13,
1678,
1222,
9422,
29901,
13,
4706,
8653,
22326,
4144,
1003,
29889,
842,
29918,
1526,
29875,
29918,
2917,
29898,
12007,
29918,
1526,
29875,
29922,
5574,
29897,
13,
1678,
9995,
13,
1678,
363,
1820,
29892,
995,
297,
9049,
5085,
29889,
7076,
7295,
13,
4706,
565,
451,
756,
5552,
7373,
1526,
29875,
29918,
2917,
3285,
1820,
1125,
13,
9651,
12020,
7865,
2392,
703,
2697,
286,
1631,
2295,
13553,
1273,
29879,
338,
451,
14831,
3850,
1273,
1820,
29897,
13,
4706,
731,
5552,
7373,
1526,
29875,
29918,
2917,
3285,
1820,
29892,
995,
29897,
13,
13,
13,
1753,
903,
657,
29918,
1526,
29875,
29918,
2917,
29898,
5552,
29918,
1989,
1125,
13,
1678,
9995,
13,
1678,
402,
1691,
286,
1631,
2295,
5352,
995,
5034,
304,
278,
1881,
1820,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
12421,
29918,
1989,
313,
710,
1125,
450,
1820,
310,
278,
5352,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
4669,
29892,
450,
995,
310,
2183,
5352,
1820,
29889,
13,
13,
1678,
390,
1759,
267,
29901,
13,
4706,
7865,
2392,
29901,
960,
1881,
1820,
338,
451,
385,
5352,
297,
2295,
29889,
13,
1678,
9995,
13,
1678,
565,
451,
756,
5552,
7373,
1526,
29875,
29918,
2917,
3285,
12421,
29918,
1989,
1125,
13,
4706,
12020,
7865,
2392,
703,
2577,
3030,
13553,
1273,
29879,
338,
451,
14831,
3850,
1273,
12421,
29918,
1989,
29897,
13,
1678,
736,
679,
5552,
7373,
1526,
29875,
29918,
2917,
3285,
12421,
29918,
1989,
29897,
13,
2
] |
DP/ValueIteration.py | davidbrown3/reinforcement-learning | 1 | 127823 | import numpy as np
def value_iteration(env, theta=0.0001, discount_factor=1.0):
"""
Value Iteration Algorithm.
Args:
env: OpenAI environment. env.P represents the transition probabilities of the environment.
theta: Stopping threshold. If the value of all states changes less than theta
in one iteration we are done.
discount_factor: lambda time discount factor.
Returns:
A tuple (policy, V) of the optimal policy and the optimal value function.
"""
V = np.zeros(env.nS)
Policy = np.zeros([env.nS, env.nA])
while True:
ConvergeFlag = True
for StateIdx, StateName in enumerate(env.P.keys()):
ActionValues = np.zeros(env.nA)
StateInfo = env.P[StateName]
for ActionIdx, ActionName in enumerate(StateInfo.keys()):
# For now assume that all probabilities are 1
ActionInfo = StateInfo[ActionName][0]
Reward = ActionInfo[2]
NextState = ActionInfo[1]
NextStateValue = V[NextState]
ActionValues[ActionIdx] = Reward + discount_factor*NextStateValue
UpdatedValue = np.max(ActionValues)
ConvergeFlag = ConvergeFlag & (np.abs(V[StateIdx]-UpdatedValue) < theta)
V[StateIdx] = UpdatedValue
if ConvergeFlag: break
for StateIdx, StateName in enumerate(env.P.keys()):
StateInfo = env.P[StateName]
ActionValues = np.zeros(env.nA)
for ActionIdx, ActionName in enumerate(StateInfo.keys()):
# For now assume that all probabilities are 1
ActionInfo = StateInfo[ActionName][0]
Reward = ActionInfo[2]
NextState = ActionInfo[1]
NextStateValue = V[NextState]
ActionValues[ActionIdx] = Reward + discount_factor*NextStateValue
MaxValueIdx = np.argmax(ActionValues)
Policy[StateIdx,:] = 0
Policy[StateIdx,MaxValueIdx] = 1
return Policy, V | [
1,
1053,
12655,
408,
7442,
13,
13,
1753,
995,
29918,
1524,
362,
29898,
6272,
29892,
278,
941,
29922,
29900,
29889,
29900,
29900,
29900,
29896,
29892,
2313,
792,
29918,
19790,
29922,
29896,
29889,
29900,
1125,
13,
1678,
9995,
13,
1678,
7865,
20504,
362,
29068,
29889,
13,
268,
13,
1678,
826,
3174,
29901,
13,
4706,
8829,
29901,
4673,
23869,
5177,
29889,
8829,
29889,
29925,
11524,
278,
9558,
2070,
11614,
310,
278,
5177,
29889,
13,
4706,
278,
941,
29901,
6639,
3262,
16897,
29889,
960,
278,
995,
310,
599,
5922,
3620,
3109,
1135,
278,
941,
13,
9651,
297,
697,
12541,
591,
526,
2309,
29889,
13,
4706,
2313,
792,
29918,
19790,
29901,
14013,
931,
2313,
792,
7329,
29889,
13,
308,
13,
1678,
16969,
29901,
13,
4706,
319,
18761,
313,
22197,
29892,
478,
29897,
310,
278,
14413,
8898,
322,
278,
14413,
995,
740,
29889,
308,
13,
1678,
9995,
13,
13,
1678,
478,
353,
7442,
29889,
3298,
359,
29898,
6272,
29889,
29876,
29903,
29897,
13,
1678,
25219,
353,
7442,
29889,
3298,
359,
4197,
6272,
29889,
29876,
29903,
29892,
8829,
29889,
29876,
29909,
2314,
13,
268,
13,
1678,
1550,
5852,
29901,
13,
13,
4706,
1281,
369,
479,
21979,
353,
5852,
13,
13,
4706,
363,
4306,
1204,
29916,
29892,
4306,
1170,
297,
26985,
29898,
6272,
29889,
29925,
29889,
8149,
580,
1125,
13,
13,
9651,
9123,
9065,
353,
7442,
29889,
3298,
359,
29898,
6272,
29889,
29876,
29909,
29897,
13,
632,
13,
9651,
4306,
3401,
353,
8829,
29889,
29925,
29961,
2792,
1170,
29962,
13,
632,
13,
9651,
363,
9123,
1204,
29916,
29892,
9123,
1170,
297,
26985,
29898,
2792,
3401,
29889,
8149,
580,
1125,
13,
462,
13,
18884,
396,
1152,
1286,
5251,
393,
599,
2070,
11614,
526,
29871,
29896,
13,
18884,
9123,
3401,
353,
4306,
3401,
29961,
4276,
1170,
3816,
29900,
29962,
13,
462,
13,
18884,
390,
809,
538,
353,
9123,
3401,
29961,
29906,
29962,
13,
18884,
8084,
2792,
353,
9123,
3401,
29961,
29896,
29962,
13,
18884,
8084,
2792,
1917,
353,
478,
29961,
9190,
2792,
29962,
13,
18884,
9123,
9065,
29961,
4276,
1204,
29916,
29962,
353,
390,
809,
538,
718,
2313,
792,
29918,
19790,
29930,
9190,
2792,
1917,
13,
632,
13,
9651,
25723,
1917,
353,
7442,
29889,
3317,
29898,
4276,
9065,
29897,
13,
9651,
1281,
369,
479,
21979,
353,
1281,
369,
479,
21979,
669,
313,
9302,
29889,
6897,
29898,
29963,
29961,
2792,
1204,
29916,
29962,
29899,
29248,
1917,
29897,
529,
278,
941,
29897,
13,
9651,
478,
29961,
2792,
1204,
29916,
29962,
353,
25723,
1917,
13,
13,
4706,
565,
1281,
369,
479,
21979,
29901,
2867,
13,
13,
1678,
363,
4306,
1204,
29916,
29892,
4306,
1170,
297,
26985,
29898,
6272,
29889,
29925,
29889,
8149,
580,
1125,
13,
13,
4706,
4306,
3401,
353,
8829,
29889,
29925,
29961,
2792,
1170,
29962,
13,
4706,
9123,
9065,
353,
7442,
29889,
3298,
359,
29898,
6272,
29889,
29876,
29909,
29897,
13,
13,
4706,
363,
9123,
1204,
29916,
29892,
9123,
1170,
297,
26985,
29898,
2792,
3401,
29889,
8149,
580,
1125,
13,
632,
13,
9651,
396,
1152,
1286,
5251,
393,
599,
2070,
11614,
526,
29871,
29896,
13,
9651,
9123,
3401,
353,
4306,
3401,
29961,
4276,
1170,
3816,
29900,
29962,
13,
632,
13,
9651,
390,
809,
538,
353,
9123,
3401,
29961,
29906,
29962,
13,
9651,
8084,
2792,
353,
9123,
3401,
29961,
29896,
29962,
13,
9651,
8084,
2792,
1917,
353,
478,
29961,
9190,
2792,
29962,
13,
9651,
9123,
9065,
29961,
4276,
1204,
29916,
29962,
353,
390,
809,
538,
718,
2313,
792,
29918,
19790,
29930,
9190,
2792,
1917,
13,
308,
13,
4706,
5918,
1917,
1204,
29916,
353,
7442,
29889,
1191,
3317,
29898,
4276,
9065,
29897,
13,
4706,
25219,
29961,
2792,
1204,
29916,
29892,
17531,
353,
29871,
29900,
13,
4706,
25219,
29961,
2792,
1204,
29916,
29892,
7976,
1917,
1204,
29916,
29962,
353,
29871,
29896,
13,
632,
13,
1678,
736,
25219,
29892,
478,
2
] |
survae/tests/transforms/bijections/coupling/coupling_linear.py | alisiahkoohi/survae_flows | 262 | 99673 | import numpy as np
import torch
import torch.nn as nn
import torchtestcase
import unittest
from survae.transforms.bijections.coupling import *
from survae.nn.layers import ElementwiseParams, ElementwiseParams2d
from survae.tests.transforms.bijections import BijectionTest
class AdditiveCouplingBijectionTest(BijectionTest):
def test_bijection_is_well_behaved(self):
batch_size = 10
self.eps = 1e-6
for shape in [(6,),
(6,8,8)]:
for num_condition in [None, 1]:
with self.subTest(shape=shape, num_condition=num_condition):
x = torch.randn(batch_size, *shape)
if num_condition is None:
if len(shape) == 1: net = nn.Linear(3,3)
if len(shape) == 3: net = nn.Conv2d(3,3, kernel_size=3, padding=1)
else:
if len(shape) == 1: net = nn.Linear(1,5)
if len(shape) == 3: net = nn.Conv2d(1,5, kernel_size=3, padding=1)
bijection = AdditiveCouplingBijection(net, num_condition=num_condition)
self.assert_bijection_is_well_behaved(bijection, x, z_shape=(batch_size, *shape))
z, _ = bijection.forward(x)
if num_condition is None:
self.assertEqual(x[:,:3], z[:,:3])
else:
self.assertEqual(x[:,:1], z[:,:1])
class AffineCouplingBijectionTest(BijectionTest):
def test_bijection_is_well_behaved(self):
batch_size = 10
self.eps = 5e-6
for shape in [(6,),
(6,8,8)]:
for num_condition in [None, 1]:
with self.subTest(shape=shape, num_condition=num_condition):
x = torch.randn(batch_size, *shape)
if num_condition is None:
if len(shape) == 1: net = nn.Sequential(nn.Linear(3,3*2), ElementwiseParams(2))
if len(shape) == 3: net = nn.Sequential(nn.Conv2d(3,3*2, kernel_size=3, padding=1), ElementwiseParams2d(2))
else:
if len(shape) == 1: net = nn.Sequential(nn.Linear(1,5*2), ElementwiseParams(2))
if len(shape) == 3: net = nn.Sequential(nn.Conv2d(1,5*2, kernel_size=3, padding=1), ElementwiseParams2d(2))
bijection = AffineCouplingBijection(net, num_condition=num_condition)
self.assert_bijection_is_well_behaved(bijection, x, z_shape=(batch_size, *shape))
z, _ = bijection.forward(x)
if num_condition is None:
self.assertEqual(x[:,:3], z[:,:3])
else:
self.assertEqual(x[:,:1], z[:,:1])
if __name__ == '__main__':
unittest.main()
| [
1,
1053,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
1688,
4878,
13,
5215,
443,
27958,
13,
3166,
1190,
1564,
29872,
29889,
9067,
29879,
29889,
29890,
7253,
1953,
29889,
16589,
10335,
1053,
334,
13,
3166,
1190,
1564,
29872,
29889,
15755,
29889,
29277,
1053,
10619,
3538,
9629,
29892,
10619,
3538,
9629,
29906,
29881,
13,
3166,
1190,
1564,
29872,
29889,
21150,
29889,
9067,
29879,
29889,
29890,
7253,
1953,
1053,
350,
7253,
428,
3057,
13,
13,
13,
1990,
3462,
3321,
29907,
283,
10335,
29933,
7253,
428,
3057,
29898,
29933,
7253,
428,
3057,
1125,
13,
13,
1678,
822,
1243,
29918,
29890,
7253,
428,
29918,
275,
29918,
5872,
29918,
915,
8708,
287,
29898,
1311,
1125,
13,
4706,
9853,
29918,
2311,
353,
29871,
29896,
29900,
13,
13,
4706,
1583,
29889,
8961,
353,
29871,
29896,
29872,
29899,
29953,
13,
4706,
363,
8267,
297,
17288,
29953,
29892,
511,
13,
462,
418,
313,
29953,
29892,
29947,
29892,
29947,
4638,
29901,
13,
9651,
363,
954,
29918,
16122,
297,
518,
8516,
29892,
29871,
29896,
5387,
13,
18884,
411,
1583,
29889,
1491,
3057,
29898,
12181,
29922,
12181,
29892,
954,
29918,
16122,
29922,
1949,
29918,
16122,
1125,
13,
462,
1678,
921,
353,
4842,
305,
29889,
9502,
29876,
29898,
16175,
29918,
2311,
29892,
334,
12181,
29897,
13,
462,
1678,
565,
954,
29918,
16122,
338,
6213,
29901,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29896,
29901,
7787,
353,
302,
29876,
29889,
12697,
29898,
29941,
29892,
29941,
29897,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29941,
29901,
7787,
353,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29941,
29892,
29941,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
7164,
29922,
29896,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29896,
29901,
7787,
353,
302,
29876,
29889,
12697,
29898,
29896,
29892,
29945,
29897,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29941,
29901,
7787,
353,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29896,
29892,
29945,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
7164,
29922,
29896,
29897,
13,
462,
1678,
5928,
9739,
353,
3462,
3321,
29907,
283,
10335,
29933,
7253,
428,
29898,
1212,
29892,
954,
29918,
16122,
29922,
1949,
29918,
16122,
29897,
13,
462,
1678,
1583,
29889,
9294,
29918,
29890,
7253,
428,
29918,
275,
29918,
5872,
29918,
915,
8708,
287,
29898,
29890,
7253,
428,
29892,
921,
29892,
503,
29918,
12181,
7607,
16175,
29918,
2311,
29892,
334,
12181,
876,
13,
462,
1678,
503,
29892,
903,
353,
5928,
9739,
29889,
11333,
29898,
29916,
29897,
13,
462,
1678,
565,
954,
29918,
16122,
338,
6213,
29901,
13,
462,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
7503,
29892,
29901,
29941,
1402,
503,
7503,
29892,
29901,
29941,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
7503,
29892,
29901,
29896,
1402,
503,
7503,
29892,
29901,
29896,
2314,
13,
13,
13,
1990,
13737,
457,
29907,
283,
10335,
29933,
7253,
428,
3057,
29898,
29933,
7253,
428,
3057,
1125,
13,
13,
1678,
822,
1243,
29918,
29890,
7253,
428,
29918,
275,
29918,
5872,
29918,
915,
8708,
287,
29898,
1311,
1125,
13,
4706,
9853,
29918,
2311,
353,
29871,
29896,
29900,
13,
13,
4706,
1583,
29889,
8961,
353,
29871,
29945,
29872,
29899,
29953,
13,
4706,
363,
8267,
297,
17288,
29953,
29892,
511,
13,
462,
418,
313,
29953,
29892,
29947,
29892,
29947,
4638,
29901,
13,
9651,
363,
954,
29918,
16122,
297,
518,
8516,
29892,
29871,
29896,
5387,
13,
18884,
411,
1583,
29889,
1491,
3057,
29898,
12181,
29922,
12181,
29892,
954,
29918,
16122,
29922,
1949,
29918,
16122,
1125,
13,
462,
1678,
921,
353,
4842,
305,
29889,
9502,
29876,
29898,
16175,
29918,
2311,
29892,
334,
12181,
29897,
13,
462,
1678,
565,
954,
29918,
16122,
338,
6213,
29901,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29896,
29901,
7787,
353,
302,
29876,
29889,
16941,
2556,
29898,
15755,
29889,
12697,
29898,
29941,
29892,
29941,
29930,
29906,
511,
10619,
3538,
9629,
29898,
29906,
876,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29941,
29901,
7787,
353,
302,
29876,
29889,
16941,
2556,
29898,
15755,
29889,
1168,
29894,
29906,
29881,
29898,
29941,
29892,
29941,
29930,
29906,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
7164,
29922,
29896,
511,
10619,
3538,
9629,
29906,
29881,
29898,
29906,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29896,
29901,
7787,
353,
302,
29876,
29889,
16941,
2556,
29898,
15755,
29889,
12697,
29898,
29896,
29892,
29945,
29930,
29906,
511,
10619,
3538,
9629,
29898,
29906,
876,
13,
462,
4706,
565,
7431,
29898,
12181,
29897,
1275,
29871,
29941,
29901,
7787,
353,
302,
29876,
29889,
16941,
2556,
29898,
15755,
29889,
1168,
29894,
29906,
29881,
29898,
29896,
29892,
29945,
29930,
29906,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
7164,
29922,
29896,
511,
10619,
3538,
9629,
29906,
29881,
29898,
29906,
876,
13,
462,
1678,
5928,
9739,
353,
13737,
457,
29907,
283,
10335,
29933,
7253,
428,
29898,
1212,
29892,
954,
29918,
16122,
29922,
1949,
29918,
16122,
29897,
13,
462,
1678,
1583,
29889,
9294,
29918,
29890,
7253,
428,
29918,
275,
29918,
5872,
29918,
915,
8708,
287,
29898,
29890,
7253,
428,
29892,
921,
29892,
503,
29918,
12181,
7607,
16175,
29918,
2311,
29892,
334,
12181,
876,
13,
462,
1678,
503,
29892,
903,
353,
5928,
9739,
29889,
11333,
29898,
29916,
29897,
13,
462,
1678,
565,
954,
29918,
16122,
338,
6213,
29901,
13,
462,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
7503,
29892,
29901,
29941,
1402,
503,
7503,
29892,
29901,
29941,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
7503,
29892,
29901,
29896,
1402,
503,
7503,
29892,
29901,
29896,
2314,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
tests/bdd/steps/test_calculate_season.py | nora-ns/allseasons | 4 | 1614974 | from pytest_bdd import scenario, given, when, then
from pytest_bdd import parsers
from urllib.parse import urljoin
import pytest
import sys
# pytestmark means it this mark will apply to all tests in the module
pytestmark = pytest.mark.skipif(sys.platform in ('win32', 'cygwin', 'darwin'),
reason="firefox tests don't work in Windows/OSX")
# @pytest.mark.django_db tells the tests that we intend to access the DB
@pytest.mark.django_db
@scenario('../features/calculate_season.feature', 'First form')
def test_form1():
pass
@pytest.mark.django_db
@scenario('../features/calculate_season.feature', 'Second form')
def test_form2():
pass
# browser fixture comes from pytest-splinter
# live_server fixture comes from pytest-django
@when('I go to the convert page')
def go_to_convert(browser, live_server):
browser.visit(urljoin(str(live_server), '/convert/'))
@when(parsers.parse('I fill out the name "{name}"'))
def fill_out_name(browser, name):
browser.fill_form({
'0-name': name,
})
@when(parsers.parse('I fill out the date as [{day}] [{month}] [{year}]'))
def fill_out_date(browser, day, month, year):
browser.fill_form({
'0-date_day': day,
'0-date_month': month,
'0-date_year': year,
})
@when(parsers.parse('I select the location as Latitude {lat} Longitude {lng}'))
def select_the_location(browser, lat, lng):
browser.fill_form({
'0-location_0': lat,
'0-location_1': lng,
})
@when('I submit the form')
def submit_form(browser):
browser.find_by_css('button[type=submit]').first.click()
@then(parsers.parse('I should see the following available calendars:\n{text}'))
def see_calendars(browser, text):
expected = text.split('\n')
elements = [el.text for el in browser.find_by_css('.radio')]
assert elements == expected
@given(parsers.parse('I have submitted the first form as follows:\n{text}'))
def submitted_first_form(browser, live_server, text):
items = dict([item.split(': ') for item in text.split('\n')])
go_to_convert(browser, live_server)
fill_out_name(browser, items['name'])
fill_out_date(browser, items['day'], items['month'], items['year'])
select_the_location(browser, items['lat'], items['lng'])
submit_form(browser)
@when(parsers.parse('I select the calendar "{calendar}"'))
def select_the_seasonset(browser, calendar):
browser.choose('1-calendar', calendar)
@then(parsers.parse('I should see "{expected}"'))
def see_text(browser, expected):
el = browser.find_by_css('#result').first
assert el.text == expected
| [
1,
515,
11451,
1688,
29918,
29890,
1289,
1053,
10483,
29892,
2183,
29892,
746,
29892,
769,
13,
3166,
11451,
1688,
29918,
29890,
1289,
1053,
610,
4253,
13,
3166,
3142,
1982,
29889,
5510,
1053,
3142,
7122,
13,
5215,
11451,
1688,
13,
5215,
10876,
13,
13,
29937,
11451,
1688,
3502,
2794,
372,
445,
2791,
674,
3394,
304,
599,
6987,
297,
278,
3883,
13,
13,
2272,
1688,
3502,
353,
11451,
1688,
29889,
3502,
29889,
11014,
361,
29898,
9675,
29889,
12120,
297,
6702,
5080,
29941,
29906,
742,
525,
1270,
29887,
5080,
742,
525,
16702,
5080,
5477,
13,
462,
18884,
2769,
543,
8696,
8944,
6987,
1016,
29915,
29873,
664,
297,
3852,
29914,
3267,
29990,
1159,
13,
13,
13,
29937,
732,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
10603,
278,
6987,
393,
591,
24042,
304,
2130,
278,
6535,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
29992,
1557,
24893,
877,
6995,
22100,
29914,
15807,
403,
29918,
25682,
29889,
14394,
742,
525,
6730,
883,
1495,
13,
1753,
1243,
29918,
689,
29896,
7295,
13,
1678,
1209,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
14095,
29918,
2585,
13,
29992,
1557,
24893,
877,
6995,
22100,
29914,
15807,
403,
29918,
25682,
29889,
14394,
742,
525,
11863,
883,
1495,
13,
1753,
1243,
29918,
689,
29906,
7295,
13,
1678,
1209,
13,
13,
13,
29937,
4714,
5713,
15546,
5304,
515,
11451,
1688,
29899,
23579,
1639,
13,
29937,
5735,
29918,
2974,
5713,
15546,
5304,
515,
11451,
1688,
29899,
14095,
13,
13,
29992,
8256,
877,
29902,
748,
304,
278,
3588,
1813,
1495,
13,
1753,
748,
29918,
517,
29918,
13441,
29898,
15965,
29892,
5735,
29918,
2974,
1125,
13,
1678,
4714,
29889,
1730,
277,
29898,
2271,
7122,
29898,
710,
29898,
9258,
29918,
2974,
511,
8207,
13441,
29914,
8785,
13,
13,
13,
29992,
8256,
29898,
862,
4253,
29889,
5510,
877,
29902,
5445,
714,
278,
1024,
29850,
978,
5038,
8785,
13,
1753,
5445,
29918,
449,
29918,
978,
29898,
15965,
29892,
1024,
1125,
13,
1678,
4714,
29889,
5589,
29918,
689,
3319,
13,
4706,
525,
29900,
29899,
978,
2396,
1024,
29892,
13,
1678,
5615,
13,
13,
13,
29992,
8256,
29898,
862,
4253,
29889,
5510,
877,
29902,
5445,
714,
278,
2635,
408,
15974,
3250,
6525,
15974,
10874,
6525,
15974,
6360,
6525,
8785,
13,
1753,
5445,
29918,
449,
29918,
1256,
29898,
15965,
29892,
2462,
29892,
4098,
29892,
1629,
1125,
13,
1678,
4714,
29889,
5589,
29918,
689,
3319,
13,
4706,
525,
29900,
29899,
1256,
29918,
3250,
2396,
2462,
29892,
13,
4706,
525,
29900,
29899,
1256,
29918,
10874,
2396,
4098,
29892,
13,
4706,
525,
29900,
29899,
1256,
29918,
6360,
2396,
1629,
29892,
13,
1678,
5615,
13,
13,
13,
29992,
8256,
29898,
862,
4253,
29889,
5510,
877,
29902,
1831,
278,
4423,
408,
7053,
4279,
426,
5066,
29913,
6242,
4279,
426,
29880,
865,
29913,
8785,
13,
1753,
1831,
29918,
1552,
29918,
5479,
29898,
15965,
29892,
3405,
29892,
301,
865,
1125,
13,
1678,
4714,
29889,
5589,
29918,
689,
3319,
13,
4706,
525,
29900,
29899,
5479,
29918,
29900,
2396,
3405,
29892,
13,
4706,
525,
29900,
29899,
5479,
29918,
29896,
2396,
301,
865,
29892,
13,
1678,
5615,
13,
13,
13,
29992,
8256,
877,
29902,
9752,
278,
883,
1495,
13,
1753,
9752,
29918,
689,
29898,
15965,
1125,
13,
1678,
4714,
29889,
2886,
29918,
1609,
29918,
4268,
877,
3092,
29961,
1853,
29922,
7892,
29962,
2824,
4102,
29889,
3808,
580,
13,
13,
13,
29992,
6098,
29898,
862,
4253,
29889,
5510,
877,
29902,
881,
1074,
278,
1494,
3625,
1208,
355,
1503,
3583,
29876,
29912,
726,
29913,
8785,
13,
1753,
1074,
29918,
1052,
355,
1503,
29898,
15965,
29892,
1426,
1125,
13,
1678,
3806,
353,
1426,
29889,
5451,
28909,
29876,
1495,
13,
1678,
3161,
353,
518,
295,
29889,
726,
363,
560,
297,
4714,
29889,
2886,
29918,
1609,
29918,
4268,
12839,
13399,
1495,
29962,
13,
1678,
4974,
3161,
1275,
3806,
13,
13,
13,
29992,
29887,
5428,
29898,
862,
4253,
29889,
5510,
877,
29902,
505,
18397,
278,
937,
883,
408,
4477,
3583,
29876,
29912,
726,
29913,
8785,
13,
1753,
18397,
29918,
4102,
29918,
689,
29898,
15965,
29892,
5735,
29918,
2974,
29892,
1426,
1125,
13,
1678,
4452,
353,
9657,
4197,
667,
29889,
5451,
877,
29901,
25710,
363,
2944,
297,
1426,
29889,
5451,
28909,
29876,
1495,
2314,
13,
1678,
748,
29918,
517,
29918,
13441,
29898,
15965,
29892,
5735,
29918,
2974,
29897,
13,
1678,
5445,
29918,
449,
29918,
978,
29898,
15965,
29892,
4452,
1839,
978,
11287,
13,
1678,
5445,
29918,
449,
29918,
1256,
29898,
15965,
29892,
4452,
1839,
3250,
7464,
4452,
1839,
10874,
7464,
4452,
1839,
6360,
11287,
13,
1678,
1831,
29918,
1552,
29918,
5479,
29898,
15965,
29892,
4452,
1839,
5066,
7464,
4452,
1839,
29880,
865,
11287,
13,
1678,
9752,
29918,
689,
29898,
15965,
29897,
13,
13,
13,
29992,
8256,
29898,
862,
4253,
29889,
5510,
877,
29902,
1831,
278,
17684,
29850,
23392,
5038,
8785,
13,
1753,
1831,
29918,
1552,
29918,
344,
7040,
300,
29898,
15965,
29892,
17684,
1125,
13,
1678,
4714,
29889,
21803,
877,
29896,
29899,
23392,
742,
17684,
29897,
13,
13,
13,
29992,
6098,
29898,
862,
4253,
29889,
5510,
877,
29902,
881,
1074,
29850,
9684,
5038,
8785,
13,
1753,
1074,
29918,
726,
29898,
15965,
29892,
3806,
1125,
13,
1678,
560,
353,
4714,
29889,
2886,
29918,
1609,
29918,
4268,
14237,
2914,
2824,
4102,
13,
1678,
4974,
560,
29889,
726,
1275,
3806,
13,
13,
2
] |
maskrcnn_benchmark/modeling/roi_heads/box_head/loss.py | RyanXLi/OneshotDet | 16 | 25466 | <reponame>RyanXLi/OneshotDet<gh_stars>10-100
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss, SigmoidFocalLoss
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou
from maskrcnn_benchmark.modeling.balanced_positive_negative_sampler import (
BalancedPositiveNegativeSampler
)
from maskrcnn_benchmark.modeling.utils import cat
class FastRCNNLossComputation(object):
"""
Computes the loss for Faster R-CNN.
Also supports FPN
"""
def __init__(
self,
cfg,
proposal_matcher,
fg_bg_sampler,
box_coder,
cls_agnostic_bbox_reg=False
):
"""
Arguments:
proposal_matcher (Matcher)
fg_bg_sampler (BalancedPositiveNegativeSampler)
box_coder (BoxCoder)
"""
self.cfg = cfg
self.proposal_matcher = proposal_matcher
self.fg_bg_sampler = fg_bg_sampler
self.box_coder = box_coder
self.cls_agnostic_bbox_reg = cls_agnostic_bbox_reg
if cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'focal_loss':
self.cls_loss_func = SigmoidFocalLoss(
cfg.MODEL.FCOS.LOSS_GAMMA,
cfg.FEW_SHOT.SECOND_STAGE_LOSS_ALPHA
)
def match_targets_to_proposals(self, proposal, target):
match_quality_matrix = boxlist_iou(target, proposal) # (M, N)
matched_idxs = self.proposal_matcher(match_quality_matrix) # -1, -2 (N)
###############################
### create soft labels ### currently only assume 1 class
###############################
if self.cfg.FEW_SHOT.SOFT_LABELING:
match_iou_matrix = match_quality_matrix.t() # (N, M)
# assert match_iou_matrix.size(1) == 2, 'only supporting 1 classes right now, but received {} classes'.format(match_iou_matrix.size(1))
# assert torch.sum(match_iou_matrix[torch.nonzero(matched_idxs<1), 1]) == 0, \
# ['positive class column of non-positive prediction should all be zero ! ',
# torch.sum(match_iou_matrix[torch.nonzero(matched_idxs>0), 1])]
matched_idxs_temp = matched_idxs.clone()
matched_idxs_temp[matched_idxs_temp<0] = 0
match_iou = match_iou_matrix[torch.arange(len(matched_idxs_temp)).long(), matched_idxs_temp].clone()
matched_idxs_invalid_inds = torch.nonzero(matched_idxs<0)
match_iou[matched_idxs_invalid_inds] = 0
# match_iou_matrix_max, _ = match_iou_matrix.max(dim=1)
# match_iou_big_iou = torch.nonzero(match_iou_matrix_max>0.5).squeeze(1)
# print(match_iou_big_iou)
# print('iiou', torch.cat([match_iou[match_iou_big_iou].unsqueeze(1), match_iou_matrix[match_iou_big_iou]], dim=1))
# Fast RCNN only need "labels" field for selecting the targets
target = target.copy_with_fields("labels")
# get the targets corresponding GT for each proposal
# NB: need to clamp the indices because we can have a single
# GT in the image, and matched_idxs can be -2, which goes
# out of bounds
matched_targets = target[matched_idxs.clamp(min=0)]
if self.cfg.FEW_SHOT.SOFT_LABELING:
matched_targets.add_field('soft_labels', match_iou)
matched_targets.add_field("matched_idxs", matched_idxs)
return matched_targets
def soft_labeling_function(self, t):
'''
discrete: t >= 0.5
linear : t
transLinear: (0.2*t+0.8) * (t>=0.5) + 0.5 ~ 1 --> 0.9 ~ 1
(2.25*t-0.225) * (t>=0.1) * (t<0.5) + 0.1 ~ 0.5 --> 0 ~ 0.9
0 0 ~ 0.1
trans4thLinear: (0.2*t + 0.8) * (t>=0.5) + 0.5 ~ 1 --> 0.9 ~ 1
0.9*(2*t)**4 0 ~ 0.5 --> 0 ~ 0.9
'''
if self.cfg.FEW_SHOT.SOFT_LABELING_FUNC == 'discrete':
return (t>=0.5).float()
elif self.cfg.FEW_SHOT.SOFT_LABELING_FUNC == 'linear':
return t
elif self.cfg.FEW_SHOT.SOFT_LABELING_FUNC == 'transLinear': # transitional linear
upper = (0.2*t+0.8) * (t>=0.5).float()
middle = (2.25*t-0.225) * (t>=0.1).float() * (t<0.5).float()
lower = 0
return upper+middle+lower
elif self.cfg.FEW_SHOT.SOFT_LABELING_FUNC == 'trans4thLinear': # transitional 4th order linear
upper = (0.2*t+0.8) * (t>=0.5).float()
lower = 0.9*((2*t)**4) * (t<0.5).float()
return upper+lower
def prepare_targets(self, proposals, targets):
labels = []
regression_targets = []
if self.cfg.FEW_SHOT.SOFT_LABELING:
soft_labels = []
for proposals_per_image, targets_per_image in zip(proposals, targets):
matched_targets = self.match_targets_to_proposals( # -1, -2
proposals_per_image, targets_per_image
)
matched_idxs = matched_targets.get_field("matched_idxs")
if self.cfg.FEW_SHOT.SOFT_LABELING:
soft_labels_per_image = self.soft_labeling_function(matched_targets.get_field("soft_labels"))
soft_labels.append(soft_labels_per_image)
labels_per_image = matched_targets.get_field("labels")
labels_per_image = labels_per_image.to(dtype=torch.int64)
# Label background (below the low threshold)
bg_inds = matched_idxs == Matcher.BELOW_LOW_THRESHOLD
labels_per_image[bg_inds] = 0
# Label ignore proposals (between low and high thresholds)
ignore_inds = matched_idxs == Matcher.BETWEEN_THRESHOLDS
labels_per_image[ignore_inds] = -1 # -1 is ignored by sampler
# compute regression targets
regression_targets_per_image = self.box_coder.encode(
matched_targets.bbox, proposals_per_image.bbox
)
labels.append(labels_per_image)
regression_targets.append(regression_targets_per_image)
if self.cfg.FEW_SHOT.SOFT_LABELING:
return labels, soft_labels, regression_targets
return labels, regression_targets
# def sample_proposal_per_box(self, box, image_size, iou_range=(0.5, 0.9), num=100):
# '''
# receive box (x1, y1, x2, y2)
# '''
# def uniSample(a, b):
# return torch.rand(1).squeeze()*(b-a) + a
# def b_area(box):
# return (box[2]-box[0])*(box[3]-box[1])
# def b_iou(box1, box2):
# l = torch.max(box1[0], box2[0])
# t = torch.max(box1[1], box2[1])
# r = torch.min(box1[2], box2[2])
# b = torch.min(box1[3], box2[3])
# area = (r-l)*(b-t)
# return area / ( b_area(box1) + b_area(box2) - area )
# x1, y1, x2, y2 = box
# W, H = image_size
# assert x1>=0 and x1<=x2 and x2<W and \
# y1>=0 and y1<=y2 and y2<H, 'input box not valid {} {} {} {}'.format(x1, y1, x2, y2)
# center_x, center_y = (x1+x2)/2, (y1+y2)/2
# box_w = x2-x1+1
# box_h = y2-y1+1
# proposals = []
# while len(proposals) < num:
# rand_iou = uniSample(*iou_range) # restrict to iou range
# min_iou_term = 2*rand_iou/(rand_iou+1)
# xc_prop = uniSample(0, 0.3333) # restrict to 0~1/3
# yc_prop_min = torch.max(0., min_iou_term)
# yc_prop_max = torch.min(0.3333, min_iou_term)
# if yc_prop_max <= yc_prop_min:
# continue
# yc_prop = uniSample(yc_prop_min, yc_prop_max)
# xc_dir = torch.randint(2).float()*2-1
# xc = center_x + xc_dir*box_w*xc_prop
# yc_dir = torch.randint(2).float()*2-1
# yc = center_y + yc_dir*box_h*yc_prop
# for i in range(100): # each center location only try at most 100 times, resort another center location if not
# width_min = rand_iou*box_w,
# width_max = box_w/rand_iou
# width = uniSample(width_min, width_max)
# height_min = rand_iou*box_h / min(width, box_w)
# height_max = box_h/rand_iou
# height = uniSample(height_min, height_max)
# rand_box = torch.tensor( [int(xc-width/2), int(yc-height/2), int(xc+width/2), int(yc+height/2)]).float()
# rand_box.clamp_(0, image_size-1)
# if b_iou(rand_box, box) >= rand_iou:
# break
# proposals.append(rand_box)
# proposals = torch.stack(proposals, dim=0) # (num, 4) xyxy
# return proposals
# def handcraft_sample_proposals(self, targets, num_per_image=100):
# proposals = []
# labels = []
# num_sample_per_box = 100
# for targets_per_image in targets:
# image_size = targets_per_image.size
# bboxes_per_image = targets_per_image.bbox
# labels_per_image = targets.get_field('labels')
# proposals_per_image = []
# labels_per_image = []
# for bbox, label in zip(bboxes_per_image, labels_per_image):
# sampled_bboxes = self.sample_proposal_per_box(bbox, image_size, iou_range=(0.5, 0.9), num=num_sample_per_box)
# sampled_labels = label.unsqueeze().repeat(len(sampled_bboxes))
# proposals_per_image.append(sampled_bboxes)
# labels_per_image.append(sampled_labels)
# proposals_per_image = torch.cat(proposals_per_image, dim=0)
# labels_per_image = torch.cat(labels_per_image, dim=0)
# if len(proposals_per_image) > num_per_image:
# inds = torch.randperm(len(proposals_per_image))
# selected_inds = inds[:num_per_image]
# proposals_per_image = proposals_per_image[selected_inds]
# labels_per_image = labels_per_image[selected_inds]
# assert len(proposals_per_image) == num_per_image, [ len(proposals_per_image), num_per_image ]
# proposals.append(proposals_per_image)
# labels.append(labels_per_image)
# return proposals, labels
def subsample(self, proposals, targets):
"""
This method performs the positive/negative sampling, and return
the sampled proposals.
Note: this function keeps a state.
Arguments:
proposals (list[BoxList])
targets (list[BoxList])
"""
# handcrafted_proposals, handcrafted_labels = self.handcraft_sample_proposals(proposals, targets)
# assert len(handcrafted_proposals) == len(proposals), [len(handcrafted_proposals), len(proposals)]
# proposals = [torch.cat([proposals[i], handcrafted_proposals[i]]) for i in range(len(proposals))]
if self.cfg.FEW_SHOT.SOFT_LABELING:
labels, soft_labels, regression_targets = self.prepare_targets(proposals, targets)
else:
labels, regression_targets = self.prepare_targets(proposals, targets)
sampled_pos_inds, sampled_neg_inds = self.fg_bg_sampler(labels, neg_supp=self.cfg.FEW_SHOT.NEG_SUPPORT.TURN_ON)
# print('pos:', len(sampled_pos_inds[0].nonzero()), 'neg', len(sampled_neg_inds[0].nonzero()))
proposals = list(proposals)
# add corresponding label and regression_targets information to the bounding boxes
if self.cfg.FEW_SHOT.SOFT_LABELING:
for labels_per_image, soft_labels_per_image, regression_targets_per_image, proposals_per_image in zip(
labels, soft_labels, regression_targets, proposals
):
proposals_per_image.add_field("labels", labels_per_image)
proposals_per_image.add_field("soft_labels", soft_labels_per_image)
proposals_per_image.add_field(
"regression_targets", regression_targets_per_image
)
else:
for labels_per_image, regression_targets_per_image, proposals_per_image in zip(
labels, regression_targets, proposals
):
proposals_per_image.add_field("labels", labels_per_image)
proposals_per_image.add_field(
"regression_targets", regression_targets_per_image
)
# distributed sampled proposals, that were obtained on all feature maps
# concatenated via the fg_bg_sampler, into individual feature map levels
for img_idx, (pos_inds_img, neg_inds_img) in enumerate(
zip(sampled_pos_inds, sampled_neg_inds)
):
img_sampled_inds = torch.nonzero(pos_inds_img | neg_inds_img).squeeze(1)
proposals_per_image = proposals[img_idx][img_sampled_inds]
# assert torch.sum(proposals_per_image.get_field('labels').float() - proposals_per_image.get_field('soft_labels'))==0, \
# [proposals_per_image.get_field('labels'), proposals_per_image.get_field('soft_labels')]
proposals[img_idx] = proposals_per_image
self._proposals = proposals
return proposals
def CXE(self, predicted, target):
my_target = torch.stack([1-target, target], dim=1)
return -(my_target * torch.log(predicted)).mean()
def FOCAL_LOSS(self, predicted_diff):
'''
multi cls focal loss
'''
EPISILON = 1e-6
log_pt = torch.log(1-predicted_diff + EPISILON)
return - ((predicted_diff) * log_pt).mean()
def __call__(self, class_logits, box_regression, neg_class_logits=None, rev_class_logits=None, gt_label=-1):
"""
Computes the loss for Faster R-CNN.
This requires that the subsample method has been called beforehand.
Arguments:
class_logits (list[Tensor])
box_regression (list[Tensor])
Returns:
classification_loss (Tensor)
box_loss (Tensor)
"""
class_logits = cat(class_logits, dim=0)
box_regression = cat(box_regression, dim=0)
if self.cfg.FEW_SHOT.REVERSE_ORDER:
assert rev_class_logits is not None
rev_class_logits = cat(rev_class_logits, dim=0)
device = class_logits.device
if not hasattr(self, "_proposals"):
raise RuntimeError("subsample needs to be called before")
proposals = self._proposals
if self.cfg.FEW_SHOT.SOFT_LABELING:
soft_labels = cat([proposal.get_field("soft_labels") for proposal in proposals], dim=0)
labels = cat([proposal.get_field("labels") for proposal in proposals], dim=0)
regression_targets = cat(
[proposal.get_field("regression_targets") for proposal in proposals], dim=0
)
if gt_label == -1:
N = labels.size(0)
pos_inds = torch.nonzero(labels > 0)
if self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'focal_loss':
classification_loss = self.cls_loss_func(
class_logits,
labels.int()
) / max(pos_inds.numel(), 1)
elif self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'ce_loss':
if self.cfg.FEW_SHOT.LOSS_WEIGHTED:
fg_weight = 0.75
if class_logits.size(1) == 2:
weight = torch.tensor([1-fg_weight, fg_weight]).cuda(class_logits.get_device()).float()
elif class_logits.size(1) == 3:
weight = torch.tensor([1-fg_weight, fg_weight, fg_weight]).cuda(class_logits.get_device()).float()
else:
raise Exception('class logits dimention wrong, can only be 2 or 3 for softmax ce loss')
classification_loss = F.cross_entropy(class_logits, labels, weight=weight) # change to focal loss
else:
classification_loss = F.cross_entropy(class_logits, labels) # change to focal loss
elif self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'mse_loss' and self.cfg.FEW_SHOT.SOFT_LABELING:
classification_loss = torch.mean((class_logits.sigmoid()-soft_labels)**2)
elif self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'mse_loss' and not self.cfg.FEW_SHOT.SOFT_LABELING:
classification_loss = torch.mean((class_logits.sigmoid()-labels.float())**2)
elif self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'l1_loss' and self.cfg.FEW_SHOT.SOFT_LABELING:
classification_loss = torch.mean(torch.abs(class_logits.sigmoid()-soft_labels))
elif self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'cxe_loss' and self.cfg.FEW_SHOT.SOFT_LABELING:
classification_loss = self.CXE(class_logits.softmax(dim=1), soft_labels)
else:
raise Exception('clasification loss of second stage not valid')
if self.cfg.FEW_SHOT.REVERSE_ORDER:
reverse_cls_loss = self.FOCAL_LOSS(
torch.abs(class_logits.softmax(dim=-1)-rev_class_logits.softmax(dim=-1))
)
# get indices that correspond to the regression targets for
# the corresponding ground truth labels, to be used with
# advanced indexing
sampled_pos_inds_subset = torch.nonzero(labels > 0).squeeze(1)
labels_pos = labels[sampled_pos_inds_subset]
if self.cls_agnostic_bbox_reg:
map_inds = torch.tensor([4, 5, 6, 7], device=device)
else:
map_inds = 4 * labels_pos[:, None] + torch.tensor(
[0, 1, 2, 3], device=device)
box_loss = smooth_l1_loss(
box_regression[sampled_pos_inds_subset[:, None], map_inds],
regression_targets[sampled_pos_inds_subset],
size_average=False,
beta=1,
)
box_loss = box_loss / labels.numel()
else: # only calculating loss of bboxes belonging to gt_label and mse loss
N = labels.size(0)
cls_labels = labels.clone()
cls_labels[torch.nonzero(cls_labels!=gt_label)] = 0
cls_labels[torch.nonzero(cls_labels==gt_label)] = 1
pos_inds = torch.nonzero(cls_labels > 0)
if self.cfg.FEW_SHOT.SECOND_STAGE_CLS_LOSS == 'focal_loss':
classification_loss = self.cls_loss_func(
class_logits,
cls_labels.int()
) / ( pos_inds.numel() + N )
else:
classification_loss = F.cross_entropy(class_logits, cls_labels) # change to focal loss
# get indices that correspond to the regression targets for
# the corresponding ground truth labels, to be used with
# advanced indexing
if cls_labels.numel() == 0:
box_loss = torch.tensor(0).float().cuda(device)
else:
sampled_pos_inds_subset = torch.nonzero(cls_labels > 0).squeeze(1)
labels_pos = cls_labels[sampled_pos_inds_subset]
if self.cls_agnostic_bbox_reg:
map_inds = torch.tensor([4, 5, 6, 7], device=device)
else:
map_inds = 4 * labels_pos[:, None] + torch.tensor(
[0, 1, 2, 3], device=device)
box_loss = smooth_l1_loss(
box_regression[sampled_pos_inds_subset[:, None], map_inds],
regression_targets[sampled_pos_inds_subset],
size_average=False,
beta=1,
)
box_loss = box_loss / cls_labels.numel()
if self.cfg.FEW_SHOT.REVERSE_ORDER:
return classification_loss, box_loss, reverse_cls_loss
# add in new neg support linz
if neg_class_logits is not None:
neg_class_logits = cat(neg_class_logits, dim=0)
focus_neg_class_logits = neg_class_logits[labels==1]
focus_pos_class_logits = class_logits[labels==1]
# focus_labels = labels[labels==1]
focus_neg_class_scores = focus_neg_class_logits.softmax(dim=1)[:,1]
focus_pos_class_scores = focus_pos_class_logits.softmax(dim=1)[:,1]
cls_suppress_loss = F.relu(focus_neg_class_scores-focus_pos_class_scores+0.3).mean()
# cls_suppress_loss = F.cross_entropy(focus_neg_class_logits, 1-focus_labels) # change to focal loss
return classification_loss, box_loss, cls_suppress_loss
return classification_loss, box_loss
def make_roi_box_loss_evaluator(cfg):
matcher = Matcher(
cfg.MODEL.ROI_HEADS.FG_IOU_THRESHOLD,
cfg.MODEL.ROI_HEADS.BG_IOU_THRESHOLD,
allow_low_quality_matches=False,
)
bbox_reg_weights = cfg.MODEL.ROI_HEADS.BBOX_REG_WEIGHTS
box_coder = BoxCoder(weights=bbox_reg_weights)
fg_bg_sampler = BalancedPositiveNegativeSampler(
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE, cfg.MODEL.ROI_HEADS.POSITIVE_FRACTION
)
cls_agnostic_bbox_reg = cfg.MODEL.CLS_AGNOSTIC_BBOX_REG
loss_evaluator = FastRCNNLossComputation(
cfg,
matcher,
fg_bg_sampler,
box_coder,
cls_agnostic_bbox_reg
)
return loss_evaluator
| [
1,
529,
276,
1112,
420,
29958,
29934,
10094,
29990,
23410,
29914,
2951,
267,
8711,
6362,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
14187,
1266,
313,
29883,
29897,
13327,
29892,
9266,
29889,
322,
967,
23736,
1078,
29889,
2178,
26863,
2538,
9841,
29889,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
29889,
15755,
1053,
13303,
408,
383,
13,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
29277,
1053,
10597,
29918,
29880,
29896,
29918,
6758,
29892,
15861,
29885,
3398,
29943,
18642,
29931,
2209,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4299,
292,
29889,
1884,
29918,
29883,
6119,
1053,
11773,
29907,
6119,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4299,
292,
29889,
4352,
261,
1053,
14514,
261,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4984,
1973,
29889,
1884,
1761,
29918,
3554,
1053,
3800,
1761,
29918,
29875,
283,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4299,
292,
29889,
5521,
8362,
29918,
1066,
3321,
29918,
22198,
29918,
13445,
20069,
1053,
313,
13,
1678,
7392,
8362,
9135,
3321,
29940,
387,
1230,
22966,
20069,
13,
29897,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4299,
292,
29889,
13239,
1053,
6635,
13,
13,
13,
1990,
23786,
10363,
10262,
29931,
2209,
1523,
14584,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
11796,
267,
278,
6410,
363,
383,
1901,
390,
29899,
29907,
10262,
29889,
13,
1678,
3115,
11286,
383,
15695,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
29871,
13,
4706,
274,
16434,
29892,
13,
4706,
24963,
29918,
4352,
261,
29892,
29871,
13,
4706,
285,
29887,
29918,
16264,
29918,
13445,
20069,
29892,
29871,
13,
4706,
3800,
29918,
29883,
6119,
29892,
29871,
13,
4706,
1067,
29879,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
29922,
8824,
13,
268,
1125,
13,
4706,
9995,
13,
4706,
11842,
9331,
29901,
13,
9651,
24963,
29918,
4352,
261,
313,
9652,
261,
29897,
13,
9651,
285,
29887,
29918,
16264,
29918,
13445,
20069,
313,
22031,
8362,
9135,
3321,
29940,
387,
1230,
22966,
20069,
29897,
13,
9651,
3800,
29918,
29883,
6119,
313,
3313,
29907,
6119,
29897,
13,
4706,
9995,
13,
4706,
1583,
29889,
16859,
353,
274,
16434,
13,
4706,
1583,
29889,
771,
1066,
284,
29918,
4352,
261,
353,
24963,
29918,
4352,
261,
13,
4706,
1583,
29889,
16434,
29918,
16264,
29918,
13445,
20069,
353,
285,
29887,
29918,
16264,
29918,
13445,
20069,
13,
4706,
1583,
29889,
1884,
29918,
29883,
6119,
353,
3800,
29918,
29883,
6119,
13,
4706,
1583,
29889,
25932,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
353,
1067,
29879,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
13,
4706,
565,
274,
16434,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29888,
18642,
29918,
6758,
2396,
13,
9651,
1583,
29889,
25932,
29918,
6758,
29918,
9891,
353,
15861,
29885,
3398,
29943,
18642,
29931,
2209,
29898,
13,
18884,
274,
16434,
29889,
20387,
29931,
29889,
29943,
3217,
29903,
29889,
3927,
1799,
29918,
29954,
5194,
1529,
29892,
13,
18884,
274,
16434,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
3927,
1799,
29918,
1964,
29925,
15715,
13,
9651,
1723,
13,
13,
1678,
822,
1993,
29918,
5182,
29879,
29918,
517,
29918,
771,
1066,
1338,
29898,
1311,
29892,
24963,
29892,
3646,
1125,
13,
4706,
1993,
29918,
29567,
29918,
5344,
353,
3800,
1761,
29918,
29875,
283,
29898,
5182,
29892,
24963,
29897,
396,
313,
29924,
29892,
405,
29897,
13,
4706,
19228,
29918,
333,
10351,
353,
1583,
29889,
771,
1066,
284,
29918,
4352,
261,
29898,
4352,
29918,
29567,
29918,
5344,
29897,
396,
448,
29896,
29892,
448,
29906,
29871,
313,
29940,
29897,
259,
13,
4706,
835,
13383,
7346,
4136,
13,
4706,
835,
259,
1653,
4964,
11073,
1678,
835,
5279,
871,
5251,
29871,
29896,
770,
13,
4706,
835,
13383,
7346,
4136,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
1993,
29918,
29875,
283,
29918,
5344,
353,
1993,
29918,
29567,
29918,
5344,
29889,
29873,
580,
396,
313,
29940,
29892,
341,
29897,
13,
9651,
396,
4974,
1993,
29918,
29875,
283,
29918,
5344,
29889,
2311,
29898,
29896,
29897,
1275,
29871,
29906,
29892,
525,
6194,
20382,
29871,
29896,
4413,
1492,
1286,
29892,
541,
4520,
6571,
4413,
4286,
4830,
29898,
4352,
29918,
29875,
283,
29918,
5344,
29889,
2311,
29898,
29896,
876,
13,
9651,
396,
4974,
4842,
305,
29889,
2083,
29898,
4352,
29918,
29875,
283,
29918,
5344,
29961,
7345,
305,
29889,
5464,
9171,
29898,
4352,
287,
29918,
333,
10351,
29966,
29896,
511,
29871,
29896,
2314,
1275,
29871,
29900,
29892,
320,
13,
9651,
396,
632,
6024,
1066,
3321,
770,
1897,
310,
1661,
29899,
1066,
3321,
18988,
881,
599,
367,
5225,
1738,
13420,
13,
9651,
396,
462,
4842,
305,
29889,
2083,
29898,
4352,
29918,
29875,
283,
29918,
5344,
29961,
7345,
305,
29889,
5464,
9171,
29898,
4352,
287,
29918,
333,
10351,
29958,
29900,
511,
29871,
29896,
2314,
29962,
13,
9651,
19228,
29918,
333,
10351,
29918,
7382,
353,
19228,
29918,
333,
10351,
29889,
16513,
580,
13,
9651,
19228,
29918,
333,
10351,
29918,
7382,
29961,
4352,
287,
29918,
333,
10351,
29918,
7382,
29966,
29900,
29962,
353,
29871,
29900,
13,
9651,
1993,
29918,
29875,
283,
353,
1993,
29918,
29875,
283,
29918,
5344,
29961,
7345,
305,
29889,
279,
927,
29898,
2435,
29898,
4352,
287,
29918,
333,
10351,
29918,
7382,
8106,
5426,
3285,
19228,
29918,
333,
10351,
29918,
7382,
1822,
16513,
580,
13,
9651,
19228,
29918,
333,
10351,
29918,
20965,
29918,
12772,
353,
4842,
305,
29889,
5464,
9171,
29898,
4352,
287,
29918,
333,
10351,
29966,
29900,
29897,
13,
9651,
1993,
29918,
29875,
283,
29961,
4352,
287,
29918,
333,
10351,
29918,
20965,
29918,
12772,
29962,
353,
29871,
29900,
13,
13,
9651,
396,
1993,
29918,
29875,
283,
29918,
5344,
29918,
3317,
29892,
903,
353,
1993,
29918,
29875,
283,
29918,
5344,
29889,
3317,
29898,
6229,
29922,
29896,
29897,
13,
9651,
396,
1993,
29918,
29875,
283,
29918,
3752,
29918,
29875,
283,
353,
4842,
305,
29889,
5464,
9171,
29898,
4352,
29918,
29875,
283,
29918,
5344,
29918,
3317,
29958,
29900,
29889,
29945,
467,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
9651,
396,
1596,
29898,
4352,
29918,
29875,
283,
29918,
3752,
29918,
29875,
283,
29897,
13,
9651,
396,
1596,
877,
2236,
283,
742,
4842,
305,
29889,
4117,
4197,
4352,
29918,
29875,
283,
29961,
4352,
29918,
29875,
283,
29918,
3752,
29918,
29875,
283,
1822,
6948,
802,
29872,
911,
29898,
29896,
511,
1993,
29918,
29875,
283,
29918,
5344,
29961,
4352,
29918,
29875,
283,
29918,
3752,
29918,
29875,
283,
20526,
3964,
29922,
29896,
876,
13,
13,
4706,
396,
23786,
29138,
10262,
871,
817,
376,
21134,
29908,
1746,
363,
18851,
278,
22525,
13,
4706,
3646,
353,
3646,
29889,
8552,
29918,
2541,
29918,
9621,
703,
21134,
1159,
13,
4706,
396,
679,
278,
22525,
6590,
21342,
363,
1269,
24963,
13,
4706,
396,
405,
29933,
29901,
817,
304,
1067,
1160,
278,
16285,
1363,
591,
508,
505,
263,
2323,
13,
4706,
396,
21342,
297,
278,
1967,
29892,
322,
19228,
29918,
333,
10351,
508,
367,
448,
29906,
29892,
607,
5771,
13,
4706,
396,
714,
310,
13451,
13,
4706,
19228,
29918,
5182,
29879,
353,
3646,
29961,
4352,
287,
29918,
333,
10351,
29889,
695,
1160,
29898,
1195,
29922,
29900,
4638,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
19228,
29918,
5182,
29879,
29889,
1202,
29918,
2671,
877,
2695,
29918,
21134,
742,
1993,
29918,
29875,
283,
29897,
13,
4706,
19228,
29918,
5182,
29879,
29889,
1202,
29918,
2671,
703,
4352,
287,
29918,
333,
10351,
613,
19228,
29918,
333,
10351,
29897,
13,
4706,
736,
19228,
29918,
5182,
29879,
13,
13,
1678,
822,
4964,
29918,
1643,
292,
29918,
2220,
29898,
1311,
29892,
260,
1125,
13,
4706,
14550,
13,
9651,
19554,
29901,
260,
6736,
29871,
29900,
29889,
29945,
13,
9651,
5608,
29871,
584,
260,
13,
9651,
1301,
12697,
29901,
313,
29900,
29889,
29906,
29930,
29873,
29974,
29900,
29889,
29947,
29897,
334,
313,
29873,
18572,
29900,
29889,
29945,
29897,
718,
462,
29900,
29889,
29945,
3695,
29871,
29896,
1678,
6660,
259,
29900,
29889,
29929,
3695,
29871,
29896,
13,
462,
308,
313,
29906,
29889,
29906,
29945,
29930,
29873,
29899,
29900,
29889,
29906,
29906,
29945,
29897,
334,
313,
29873,
18572,
29900,
29889,
29896,
29897,
334,
313,
29873,
29966,
29900,
29889,
29945,
29897,
718,
1678,
29900,
29889,
29896,
3695,
29871,
29900,
29889,
29945,
29871,
6660,
268,
29900,
3695,
29871,
29900,
29889,
29929,
13,
462,
3986,
29900,
462,
462,
4706,
29900,
3695,
29871,
29900,
29889,
29896,
539,
13,
9651,
1301,
29946,
386,
12697,
29901,
313,
29900,
29889,
29906,
29930,
29873,
718,
29871,
29900,
29889,
29947,
29897,
334,
313,
29873,
18572,
29900,
29889,
29945,
29897,
718,
462,
29900,
29889,
29945,
3695,
29871,
29896,
1678,
6660,
259,
29900,
29889,
29929,
3695,
29871,
29896,
13,
462,
632,
29900,
29889,
29929,
16395,
29906,
29930,
29873,
29897,
1068,
29946,
462,
462,
29900,
3695,
29871,
29900,
29889,
29945,
29871,
6660,
268,
29900,
3695,
29871,
29900,
29889,
29929,
13,
13,
4706,
14550,
308,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29918,
29943,
3904,
29907,
1275,
525,
2218,
9084,
2396,
13,
9651,
736,
313,
29873,
18572,
29900,
29889,
29945,
467,
7411,
580,
13,
4706,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29918,
29943,
3904,
29907,
1275,
525,
10660,
2396,
13,
9651,
736,
260,
13,
4706,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29918,
29943,
3904,
29907,
1275,
525,
3286,
12697,
2396,
4706,
396,
1301,
3245,
5608,
13,
9651,
7568,
29871,
353,
313,
29900,
29889,
29906,
29930,
29873,
29974,
29900,
29889,
29947,
29897,
334,
313,
29873,
18572,
29900,
29889,
29945,
467,
7411,
580,
13,
9651,
7256,
353,
313,
29906,
29889,
29906,
29945,
29930,
29873,
29899,
29900,
29889,
29906,
29906,
29945,
29897,
334,
313,
29873,
18572,
29900,
29889,
29896,
467,
7411,
580,
334,
313,
29873,
29966,
29900,
29889,
29945,
467,
7411,
580,
13,
9651,
5224,
29871,
353,
29871,
29900,
13,
9651,
736,
7568,
29974,
17662,
29974,
13609,
13,
4706,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29918,
29943,
3904,
29907,
1275,
525,
3286,
29946,
386,
12697,
2396,
4706,
396,
1301,
3245,
29871,
29946,
386,
1797,
5608,
13,
9651,
7568,
29871,
353,
313,
29900,
29889,
29906,
29930,
29873,
29974,
29900,
29889,
29947,
29897,
334,
313,
29873,
18572,
29900,
29889,
29945,
467,
7411,
580,
13,
9651,
5224,
29871,
353,
29871,
29900,
29889,
29929,
29930,
3552,
29906,
29930,
29873,
29897,
1068,
29946,
29897,
334,
313,
29873,
29966,
29900,
29889,
29945,
467,
7411,
580,
13,
9651,
736,
7568,
29974,
13609,
13,
13,
1678,
822,
19012,
29918,
5182,
29879,
29898,
1311,
29892,
9551,
1338,
29892,
22525,
1125,
13,
4706,
11073,
353,
5159,
13,
4706,
17855,
29918,
5182,
29879,
353,
5159,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
4964,
29918,
21134,
353,
5159,
13,
13,
4706,
363,
9551,
1338,
29918,
546,
29918,
3027,
29892,
22525,
29918,
546,
29918,
3027,
297,
14319,
29898,
771,
1066,
1338,
29892,
22525,
1125,
13,
9651,
19228,
29918,
5182,
29879,
353,
1583,
29889,
4352,
29918,
5182,
29879,
29918,
517,
29918,
771,
1066,
1338,
29898,
396,
448,
29896,
29892,
448,
29906,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29892,
22525,
29918,
546,
29918,
3027,
13,
9651,
1723,
13,
9651,
19228,
29918,
333,
10351,
353,
19228,
29918,
5182,
29879,
29889,
657,
29918,
2671,
703,
4352,
287,
29918,
333,
10351,
1159,
13,
13,
9651,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
18884,
4964,
29918,
21134,
29918,
546,
29918,
3027,
353,
1583,
29889,
2695,
29918,
1643,
292,
29918,
2220,
29898,
4352,
287,
29918,
5182,
29879,
29889,
657,
29918,
2671,
703,
2695,
29918,
21134,
5783,
29871,
13,
18884,
4964,
29918,
21134,
29889,
4397,
29898,
2695,
29918,
21134,
29918,
546,
29918,
3027,
29897,
13,
13,
9651,
11073,
29918,
546,
29918,
3027,
353,
19228,
29918,
5182,
29879,
29889,
657,
29918,
2671,
703,
21134,
1159,
13,
9651,
11073,
29918,
546,
29918,
3027,
353,
11073,
29918,
546,
29918,
3027,
29889,
517,
29898,
29881,
1853,
29922,
7345,
305,
29889,
524,
29953,
29946,
29897,
13,
13,
9651,
396,
15796,
3239,
313,
22503,
278,
4482,
16897,
29897,
13,
9651,
25989,
29918,
12772,
353,
19228,
29918,
333,
10351,
1275,
14514,
261,
29889,
15349,
27998,
29918,
27998,
29918,
4690,
1525,
7068,
5607,
29928,
13,
9651,
11073,
29918,
546,
29918,
3027,
29961,
16264,
29918,
12772,
29962,
353,
29871,
29900,
13,
13,
9651,
396,
15796,
11455,
9551,
1338,
313,
14811,
4482,
322,
1880,
266,
3781,
3361,
29897,
13,
9651,
11455,
29918,
12772,
353,
19228,
29918,
333,
10351,
1275,
14514,
261,
29889,
29933,
2544,
8851,
1430,
29918,
4690,
1525,
7068,
5607,
8452,
13,
9651,
11073,
29918,
546,
29918,
3027,
29961,
17281,
29918,
12772,
29962,
353,
448,
29896,
29871,
396,
448,
29896,
338,
17262,
491,
3514,
20069,
13,
13,
9651,
396,
10272,
17855,
22525,
13,
9651,
17855,
29918,
5182,
29879,
29918,
546,
29918,
3027,
353,
1583,
29889,
1884,
29918,
29883,
6119,
29889,
12508,
29898,
13,
18884,
19228,
29918,
5182,
29879,
29889,
29890,
1884,
29892,
9551,
1338,
29918,
546,
29918,
3027,
29889,
29890,
1884,
13,
9651,
1723,
13,
13,
9651,
11073,
29889,
4397,
29898,
21134,
29918,
546,
29918,
3027,
29897,
13,
9651,
17855,
29918,
5182,
29879,
29889,
4397,
29898,
276,
11476,
29918,
5182,
29879,
29918,
546,
29918,
3027,
29897,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
736,
11073,
29892,
4964,
29918,
21134,
29892,
17855,
29918,
5182,
29879,
13,
4706,
736,
11073,
29892,
17855,
29918,
5182,
29879,
13,
13,
1678,
396,
822,
4559,
29918,
771,
1066,
284,
29918,
546,
29918,
1884,
29898,
1311,
29892,
3800,
29892,
1967,
29918,
2311,
29892,
474,
283,
29918,
3881,
7607,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29929,
511,
954,
29922,
29896,
29900,
29900,
1125,
13,
1678,
396,
268,
14550,
13,
1678,
396,
308,
7150,
3800,
313,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29897,
13,
1678,
396,
268,
14550,
13,
1678,
396,
268,
822,
443,
29875,
17708,
29898,
29874,
29892,
289,
1125,
13,
1678,
396,
308,
736,
4842,
305,
29889,
9502,
29898,
29896,
467,
29879,
802,
29872,
911,
580,
16395,
29890,
29899,
29874,
29897,
718,
263,
13,
1678,
396,
268,
822,
289,
29918,
6203,
29898,
1884,
1125,
13,
1678,
396,
308,
736,
313,
1884,
29961,
29906,
29962,
29899,
1884,
29961,
29900,
2314,
16395,
1884,
29961,
29941,
29962,
29899,
1884,
29961,
29896,
2314,
13,
1678,
396,
268,
822,
289,
29918,
29875,
283,
29898,
1884,
29896,
29892,
3800,
29906,
1125,
13,
1678,
396,
308,
301,
353,
4842,
305,
29889,
3317,
29898,
1884,
29896,
29961,
29900,
1402,
3800,
29906,
29961,
29900,
2314,
13,
1678,
396,
308,
260,
353,
4842,
305,
29889,
3317,
29898,
1884,
29896,
29961,
29896,
1402,
3800,
29906,
29961,
29896,
2314,
13,
1678,
396,
308,
364,
353,
4842,
305,
29889,
1195,
29898,
1884,
29896,
29961,
29906,
1402,
3800,
29906,
29961,
29906,
2314,
13,
1678,
396,
308,
289,
353,
4842,
305,
29889,
1195,
29898,
1884,
29896,
29961,
29941,
1402,
3800,
29906,
29961,
29941,
2314,
13,
1678,
396,
308,
4038,
353,
313,
29878,
29899,
29880,
11877,
29898,
29890,
29899,
29873,
29897,
13,
1678,
396,
308,
736,
29871,
4038,
847,
313,
289,
29918,
6203,
29898,
1884,
29896,
29897,
718,
289,
29918,
6203,
29898,
1884,
29906,
29897,
448,
4038,
1723,
29871,
13,
4706,
13,
1678,
396,
268,
921,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
353,
3800,
13,
1678,
396,
268,
399,
29892,
379,
353,
1967,
29918,
2311,
29871,
13,
1678,
396,
268,
4974,
29871,
921,
29896,
18572,
29900,
322,
921,
29896,
14065,
29916,
29906,
322,
921,
29906,
29966,
29956,
322,
320,
13,
1678,
396,
632,
343,
29896,
18572,
29900,
322,
343,
29896,
14065,
29891,
29906,
322,
343,
29906,
29966,
29950,
29892,
525,
2080,
3800,
451,
2854,
6571,
6571,
6571,
6571,
4286,
4830,
29898,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29897,
13,
1678,
396,
268,
4818,
29918,
29916,
29892,
4818,
29918,
29891,
353,
313,
29916,
29896,
29974,
29916,
29906,
6802,
29906,
29892,
313,
29891,
29896,
29974,
29891,
29906,
6802,
29906,
13,
1678,
396,
268,
3800,
29918,
29893,
353,
921,
29906,
29899,
29916,
29896,
29974,
29896,
13,
1678,
396,
268,
3800,
29918,
29882,
353,
343,
29906,
29899,
29891,
29896,
29974,
29896,
13,
1678,
396,
268,
9551,
1338,
353,
5159,
13,
13,
1678,
396,
268,
1550,
7431,
29898,
771,
1066,
1338,
29897,
529,
954,
29901,
13,
1678,
396,
308,
20088,
29918,
29875,
283,
353,
443,
29875,
17708,
10456,
29875,
283,
29918,
3881,
29897,
396,
9250,
304,
474,
283,
3464,
13,
1678,
396,
308,
1375,
29918,
29875,
283,
29918,
8489,
353,
29871,
29906,
29930,
9502,
29918,
29875,
283,
14571,
9502,
29918,
29875,
283,
29974,
29896,
29897,
13,
1678,
396,
308,
921,
29883,
29918,
7728,
353,
443,
29875,
17708,
29898,
29900,
29892,
29871,
29900,
29889,
29941,
29941,
29941,
29941,
29897,
29871,
396,
9250,
304,
29871,
29900,
30022,
29896,
29914,
29941,
13,
1678,
396,
308,
343,
29883,
29918,
7728,
29918,
1195,
353,
4842,
305,
29889,
3317,
29898,
29900,
1696,
1375,
29918,
29875,
283,
29918,
8489,
29897,
13,
1678,
396,
308,
343,
29883,
29918,
7728,
29918,
3317,
353,
4842,
305,
29889,
1195,
29898,
29900,
29889,
29941,
29941,
29941,
29941,
29892,
1375,
29918,
29875,
283,
29918,
8489,
29897,
13,
1678,
396,
308,
565,
343,
29883,
29918,
7728,
29918,
3317,
5277,
343,
29883,
29918,
7728,
29918,
1195,
29901,
13,
1678,
396,
632,
6773,
13,
1678,
396,
308,
343,
29883,
29918,
7728,
353,
443,
29875,
17708,
29898,
11078,
29918,
7728,
29918,
1195,
29892,
343,
29883,
29918,
7728,
29918,
3317,
29897,
13,
13,
1678,
396,
308,
921,
29883,
29918,
3972,
353,
4842,
305,
29889,
9502,
524,
29898,
29906,
467,
7411,
580,
29930,
29906,
29899,
29896,
13,
1678,
396,
308,
921,
29883,
353,
4818,
29918,
29916,
718,
921,
29883,
29918,
3972,
29930,
1884,
29918,
29893,
29930,
21791,
29918,
7728,
13,
1678,
396,
308,
343,
29883,
29918,
3972,
353,
4842,
305,
29889,
9502,
524,
29898,
29906,
467,
7411,
580,
29930,
29906,
29899,
29896,
13,
1678,
396,
308,
343,
29883,
353,
4818,
29918,
29891,
718,
343,
29883,
29918,
3972,
29930,
1884,
29918,
29882,
29930,
11078,
29918,
7728,
13,
13,
1678,
396,
308,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
1125,
396,
1269,
4818,
4423,
871,
1018,
472,
1556,
29871,
29896,
29900,
29900,
3064,
29892,
25362,
1790,
4818,
4423,
565,
451,
13,
1678,
396,
632,
2920,
29918,
1195,
353,
20088,
29918,
29875,
283,
29930,
1884,
29918,
29893,
29892,
13,
1678,
396,
632,
2920,
29918,
3317,
353,
3800,
29918,
29893,
29914,
9502,
29918,
29875,
283,
13,
1678,
396,
632,
2920,
353,
443,
29875,
17708,
29898,
2103,
29918,
1195,
29892,
2920,
29918,
3317,
29897,
13,
13,
1678,
396,
632,
3171,
29918,
1195,
353,
20088,
29918,
29875,
283,
29930,
1884,
29918,
29882,
847,
1375,
29898,
2103,
29892,
3800,
29918,
29893,
29897,
13,
1678,
396,
632,
3171,
29918,
3317,
353,
3800,
29918,
29882,
29914,
9502,
29918,
29875,
283,
13,
1678,
396,
632,
3171,
353,
443,
29875,
17708,
29898,
3545,
29918,
1195,
29892,
3171,
29918,
3317,
29897,
13,
13,
1678,
396,
632,
20088,
29918,
1884,
353,
4842,
305,
29889,
20158,
29898,
518,
524,
29898,
21791,
29899,
2103,
29914,
29906,
511,
938,
29898,
11078,
29899,
3545,
29914,
29906,
511,
938,
29898,
21791,
29974,
2103,
29914,
29906,
511,
938,
29898,
11078,
29974,
3545,
29914,
29906,
4638,
467,
7411,
580,
13,
1678,
396,
632,
20088,
29918,
1884,
29889,
695,
1160,
23538,
29900,
29892,
1967,
29918,
2311,
29899,
29896,
29897,
13,
1678,
396,
632,
565,
289,
29918,
29875,
283,
29898,
9502,
29918,
1884,
29892,
3800,
29897,
6736,
20088,
29918,
29875,
283,
29901,
13,
1678,
396,
462,
2867,
13,
1678,
396,
308,
9551,
1338,
29889,
4397,
29898,
9502,
29918,
1884,
29897,
13,
13,
1678,
396,
268,
9551,
1338,
353,
4842,
305,
29889,
1429,
29898,
771,
1066,
1338,
29892,
3964,
29922,
29900,
29897,
396,
313,
1949,
29892,
29871,
29946,
29897,
921,
29891,
3594,
13,
1678,
396,
268,
736,
9551,
1338,
308,
13,
13,
1678,
396,
822,
1361,
17293,
29918,
11249,
29918,
771,
1066,
1338,
29898,
1311,
29892,
22525,
29892,
954,
29918,
546,
29918,
3027,
29922,
29896,
29900,
29900,
1125,
13,
1678,
396,
268,
9551,
1338,
353,
5159,
13,
1678,
396,
268,
11073,
353,
5159,
13,
13,
1678,
396,
268,
954,
29918,
11249,
29918,
546,
29918,
1884,
353,
29871,
29896,
29900,
29900,
13,
1678,
396,
268,
363,
22525,
29918,
546,
29918,
3027,
297,
22525,
29901,
13,
1678,
396,
308,
1967,
29918,
2311,
353,
22525,
29918,
546,
29918,
3027,
29889,
2311,
13,
1678,
396,
308,
289,
1884,
267,
29918,
546,
29918,
3027,
353,
22525,
29918,
546,
29918,
3027,
29889,
29890,
1884,
13,
1678,
396,
308,
11073,
29918,
546,
29918,
3027,
353,
22525,
29889,
657,
29918,
2671,
877,
21134,
1495,
13,
1678,
396,
308,
9551,
1338,
29918,
546,
29918,
3027,
353,
5159,
13,
1678,
396,
308,
11073,
29918,
546,
29918,
3027,
353,
5159,
13,
1678,
396,
308,
363,
289,
1884,
29892,
3858,
297,
14319,
29898,
29890,
1884,
267,
29918,
546,
29918,
3027,
29892,
11073,
29918,
546,
29918,
3027,
1125,
13,
1678,
396,
632,
4559,
29881,
29918,
29890,
1884,
267,
353,
1583,
29889,
11249,
29918,
771,
1066,
284,
29918,
546,
29918,
1884,
29898,
29890,
1884,
29892,
1967,
29918,
2311,
29892,
474,
283,
29918,
3881,
7607,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29929,
511,
954,
29922,
1949,
29918,
11249,
29918,
546,
29918,
1884,
29897,
13,
1678,
396,
632,
4559,
29881,
29918,
21134,
353,
3858,
29889,
6948,
802,
29872,
911,
2141,
14358,
29898,
2435,
29898,
11249,
29881,
29918,
29890,
1884,
267,
876,
13,
1678,
396,
632,
9551,
1338,
29918,
546,
29918,
3027,
29889,
4397,
29898,
11249,
29881,
29918,
29890,
1884,
267,
29897,
13,
1678,
396,
632,
11073,
29918,
546,
29918,
3027,
29889,
4397,
29898,
11249,
29881,
29918,
21134,
29897,
13,
1678,
396,
308,
9551,
1338,
29918,
546,
29918,
3027,
353,
4842,
305,
29889,
4117,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
29892,
3964,
29922,
29900,
29897,
13,
1678,
396,
308,
11073,
29918,
546,
29918,
3027,
353,
4842,
305,
29889,
4117,
29898,
21134,
29918,
546,
29918,
3027,
29892,
3964,
29922,
29900,
29897,
13,
13,
1678,
396,
308,
565,
7431,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
29897,
1405,
954,
29918,
546,
29918,
3027,
29901,
13,
1678,
396,
632,
1399,
29879,
353,
4842,
305,
29889,
9502,
17858,
29898,
2435,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
876,
13,
1678,
396,
632,
4629,
29918,
12772,
353,
1399,
29879,
7503,
1949,
29918,
546,
29918,
3027,
29962,
13,
1678,
396,
632,
9551,
1338,
29918,
546,
29918,
3027,
353,
9551,
1338,
29918,
546,
29918,
3027,
29961,
8391,
29918,
12772,
29962,
13,
1678,
396,
632,
11073,
29918,
546,
29918,
3027,
353,
11073,
29918,
546,
29918,
3027,
29961,
8391,
29918,
12772,
29962,
13,
13,
1678,
396,
308,
4974,
7431,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
29897,
1275,
954,
29918,
546,
29918,
3027,
29892,
518,
7431,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
511,
954,
29918,
546,
29918,
3027,
4514,
29871,
13,
1678,
396,
308,
9551,
1338,
29889,
4397,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
29897,
13,
1678,
396,
308,
11073,
29889,
4397,
29898,
21134,
29918,
546,
29918,
3027,
29897,
13,
13,
1678,
396,
268,
736,
9551,
1338,
29892,
11073,
13,
13,
1678,
822,
1014,
11249,
29898,
1311,
29892,
9551,
1338,
29892,
22525,
1125,
13,
4706,
9995,
13,
4706,
910,
1158,
23233,
278,
6374,
29914,
22198,
23460,
29892,
322,
736,
13,
4706,
278,
4559,
29881,
9551,
1338,
29889,
13,
4706,
3940,
29901,
445,
740,
14874,
263,
2106,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
9651,
9551,
1338,
313,
1761,
29961,
3313,
1293,
2314,
13,
9651,
22525,
313,
1761,
29961,
3313,
1293,
2314,
13,
4706,
9995,
13,
4706,
396,
1361,
17293,
287,
29918,
771,
1066,
1338,
29892,
1361,
17293,
287,
29918,
21134,
353,
1583,
29889,
3179,
17293,
29918,
11249,
29918,
771,
1066,
1338,
29898,
771,
1066,
1338,
29892,
22525,
29897,
13,
4706,
396,
4974,
7431,
29898,
3179,
17293,
287,
29918,
771,
1066,
1338,
29897,
1275,
7431,
29898,
771,
1066,
1338,
511,
518,
2435,
29898,
3179,
17293,
287,
29918,
771,
1066,
1338,
511,
7431,
29898,
771,
1066,
1338,
4638,
13,
4706,
396,
9551,
1338,
353,
518,
7345,
305,
29889,
4117,
4197,
771,
1066,
1338,
29961,
29875,
1402,
1361,
17293,
287,
29918,
771,
1066,
1338,
29961,
29875,
24960,
363,
474,
297,
3464,
29898,
2435,
29898,
771,
1066,
1338,
28166,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
11073,
29892,
4964,
29918,
21134,
29892,
17855,
29918,
5182,
29879,
353,
1583,
29889,
19125,
29918,
5182,
29879,
29898,
771,
1066,
1338,
29892,
22525,
29897,
13,
4706,
1683,
29901,
13,
9651,
11073,
29892,
17855,
29918,
5182,
29879,
353,
1583,
29889,
19125,
29918,
5182,
29879,
29898,
771,
1066,
1338,
29892,
22525,
29897,
13,
13,
4706,
4559,
29881,
29918,
1066,
29918,
12772,
29892,
4559,
29881,
29918,
10052,
29918,
12772,
353,
1583,
29889,
16434,
29918,
16264,
29918,
13445,
20069,
29898,
21134,
29892,
3480,
29918,
19303,
29922,
1311,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
8186,
29954,
29918,
29903,
4897,
15082,
29889,
29911,
24015,
29918,
1164,
29897,
13,
4706,
396,
1596,
877,
1066,
29901,
742,
7431,
29898,
11249,
29881,
29918,
1066,
29918,
12772,
29961,
29900,
1822,
5464,
9171,
25739,
525,
10052,
742,
7431,
29898,
11249,
29881,
29918,
10052,
29918,
12772,
29961,
29900,
1822,
5464,
9171,
22130,
13,
308,
13,
4706,
9551,
1338,
353,
1051,
29898,
771,
1066,
1338,
29897,
13,
308,
13,
13,
4706,
396,
788,
6590,
3858,
322,
17855,
29918,
5182,
29879,
2472,
304,
278,
3216,
292,
16273,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
363,
11073,
29918,
546,
29918,
3027,
29892,
4964,
29918,
21134,
29918,
546,
29918,
3027,
29892,
17855,
29918,
5182,
29879,
29918,
546,
29918,
3027,
29892,
9551,
1338,
29918,
546,
29918,
3027,
297,
14319,
29898,
13,
18884,
11073,
29892,
4964,
29918,
21134,
29892,
17855,
29918,
5182,
29879,
29892,
9551,
1338,
13,
632,
1125,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29889,
1202,
29918,
2671,
703,
21134,
613,
11073,
29918,
546,
29918,
3027,
29897,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29889,
1202,
29918,
2671,
703,
2695,
29918,
21134,
613,
4964,
29918,
21134,
29918,
546,
29918,
3027,
29897,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29889,
1202,
29918,
2671,
29898,
13,
462,
1678,
376,
276,
11476,
29918,
5182,
29879,
613,
17855,
29918,
5182,
29879,
29918,
546,
29918,
3027,
13,
18884,
1723,
13,
4706,
1683,
29901,
13,
9651,
363,
11073,
29918,
546,
29918,
3027,
29892,
17855,
29918,
5182,
29879,
29918,
546,
29918,
3027,
29892,
9551,
1338,
29918,
546,
29918,
3027,
297,
14319,
29898,
13,
18884,
11073,
29892,
17855,
29918,
5182,
29879,
29892,
9551,
1338,
13,
632,
1125,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29889,
1202,
29918,
2671,
703,
21134,
613,
11073,
29918,
546,
29918,
3027,
29897,
13,
18884,
9551,
1338,
29918,
546,
29918,
3027,
29889,
1202,
29918,
2671,
29898,
13,
462,
1678,
376,
276,
11476,
29918,
5182,
29879,
613,
17855,
29918,
5182,
29879,
29918,
546,
29918,
3027,
13,
18884,
1723,
13,
13,
4706,
396,
13235,
4559,
29881,
9551,
1338,
29892,
393,
892,
7625,
373,
599,
4682,
11053,
13,
4706,
396,
16125,
630,
3025,
278,
285,
29887,
29918,
16264,
29918,
13445,
20069,
29892,
964,
5375,
4682,
2910,
11174,
13,
4706,
363,
10153,
29918,
13140,
29892,
313,
1066,
29918,
12772,
29918,
2492,
29892,
3480,
29918,
12772,
29918,
2492,
29897,
297,
26985,
29898,
13,
9651,
14319,
29898,
11249,
29881,
29918,
1066,
29918,
12772,
29892,
4559,
29881,
29918,
10052,
29918,
12772,
29897,
13,
308,
1125,
13,
9651,
10153,
29918,
11249,
29881,
29918,
12772,
353,
4842,
305,
29889,
5464,
9171,
29898,
1066,
29918,
12772,
29918,
2492,
891,
3480,
29918,
12772,
29918,
2492,
467,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
9651,
9551,
1338,
29918,
546,
29918,
3027,
353,
9551,
1338,
29961,
2492,
29918,
13140,
3816,
2492,
29918,
11249,
29881,
29918,
12772,
29962,
13,
9651,
396,
4974,
4842,
305,
29889,
2083,
29898,
771,
1066,
1338,
29918,
546,
29918,
3027,
29889,
657,
29918,
2671,
877,
21134,
2824,
7411,
580,
448,
9551,
1338,
29918,
546,
29918,
3027,
29889,
657,
29918,
2671,
877,
2695,
29918,
21134,
8785,
1360,
29900,
29892,
320,
13,
9651,
396,
3986,
518,
771,
1066,
1338,
29918,
546,
29918,
3027,
29889,
657,
29918,
2671,
877,
21134,
5477,
9551,
1338,
29918,
546,
29918,
3027,
29889,
657,
29918,
2671,
877,
2695,
29918,
21134,
1495,
29962,
13,
9651,
9551,
1338,
29961,
2492,
29918,
13140,
29962,
353,
9551,
1338,
29918,
546,
29918,
3027,
13,
13,
13,
4706,
1583,
3032,
771,
1066,
1338,
353,
9551,
1338,
13,
13,
4706,
736,
9551,
1338,
13,
13,
1678,
822,
315,
29990,
29923,
29898,
1311,
29892,
25383,
29892,
3646,
1125,
13,
4706,
590,
29918,
5182,
353,
4842,
305,
29889,
1429,
4197,
29896,
29899,
5182,
29892,
3646,
1402,
3964,
29922,
29896,
29897,
13,
4706,
736,
19691,
1357,
29918,
5182,
334,
4842,
305,
29889,
1188,
29898,
11965,
18186,
8106,
12676,
580,
13,
13,
1678,
822,
18322,
29907,
1964,
29918,
3927,
1799,
29898,
1311,
29892,
25383,
29918,
12765,
1125,
13,
4706,
14550,
13,
9651,
2473,
1067,
29879,
12789,
284,
6410,
13,
4706,
14550,
13,
4706,
382,
2227,
5425,
29931,
1164,
353,
29871,
29896,
29872,
29899,
29953,
13,
4706,
1480,
29918,
415,
353,
4842,
305,
29889,
1188,
29898,
29896,
29899,
11965,
18186,
29918,
12765,
718,
382,
2227,
5425,
29931,
1164,
29897,
13,
4706,
736,
448,
5135,
11965,
18186,
29918,
12765,
29897,
334,
1480,
29918,
415,
467,
12676,
580,
29871,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
770,
29918,
1188,
1169,
29892,
3800,
29918,
276,
11476,
29892,
3480,
29918,
1990,
29918,
1188,
1169,
29922,
8516,
29892,
6664,
29918,
1990,
29918,
1188,
1169,
29922,
8516,
29892,
330,
29873,
29918,
1643,
10457,
29896,
1125,
13,
4706,
9995,
13,
4706,
11796,
267,
278,
6410,
363,
383,
1901,
390,
29899,
29907,
10262,
29889,
13,
4706,
910,
6858,
393,
278,
1014,
11249,
1158,
756,
1063,
2000,
1434,
3179,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
9651,
770,
29918,
1188,
1169,
313,
1761,
29961,
29911,
6073,
2314,
13,
9651,
3800,
29918,
276,
11476,
313,
1761,
29961,
29911,
6073,
2314,
13,
13,
4706,
16969,
29901,
13,
9651,
12965,
29918,
6758,
313,
29911,
6073,
29897,
13,
9651,
3800,
29918,
6758,
313,
29911,
6073,
29897,
13,
4706,
9995,
13,
13,
4706,
770,
29918,
1188,
1169,
353,
6635,
29898,
1990,
29918,
1188,
1169,
29892,
3964,
29922,
29900,
29897,
13,
4706,
3800,
29918,
276,
11476,
353,
6635,
29898,
1884,
29918,
276,
11476,
29892,
3964,
29922,
29900,
29897,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1525,
5348,
1660,
29918,
22364,
29901,
13,
9651,
4974,
6664,
29918,
1990,
29918,
1188,
1169,
338,
451,
6213,
13,
9651,
6664,
29918,
1990,
29918,
1188,
1169,
353,
6635,
29898,
13478,
29918,
1990,
29918,
1188,
1169,
29892,
3964,
29922,
29900,
29897,
13,
4706,
4742,
353,
770,
29918,
1188,
1169,
29889,
10141,
13,
13,
4706,
565,
451,
756,
5552,
29898,
1311,
29892,
11119,
771,
1066,
1338,
29908,
1125,
13,
9651,
12020,
24875,
2392,
703,
1491,
11249,
4225,
304,
367,
2000,
1434,
1159,
13,
13,
4706,
9551,
1338,
353,
1583,
3032,
771,
1066,
1338,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
9651,
4964,
29918,
21134,
353,
6635,
4197,
771,
1066,
284,
29889,
657,
29918,
2671,
703,
2695,
29918,
21134,
1159,
363,
24963,
297,
9551,
1338,
1402,
3964,
29922,
29900,
29897,
13,
4706,
11073,
353,
6635,
4197,
771,
1066,
284,
29889,
657,
29918,
2671,
703,
21134,
1159,
363,
24963,
297,
9551,
1338,
1402,
3964,
29922,
29900,
29897,
13,
4706,
17855,
29918,
5182,
29879,
353,
6635,
29898,
13,
9651,
518,
771,
1066,
284,
29889,
657,
29918,
2671,
703,
276,
11476,
29918,
5182,
29879,
1159,
363,
24963,
297,
9551,
1338,
1402,
3964,
29922,
29900,
13,
4706,
1723,
13,
13,
4706,
565,
330,
29873,
29918,
1643,
1275,
448,
29896,
29901,
29871,
13,
9651,
405,
353,
11073,
29889,
2311,
29898,
29900,
29897,
13,
9651,
926,
29918,
12772,
353,
4842,
305,
29889,
5464,
9171,
29898,
21134,
1405,
29871,
29900,
29897,
13,
9651,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29888,
18642,
29918,
6758,
2396,
13,
18884,
12965,
29918,
6758,
353,
1583,
29889,
25932,
29918,
6758,
29918,
9891,
29898,
13,
462,
18884,
770,
29918,
1188,
1169,
29892,
13,
462,
18884,
11073,
29889,
524,
580,
13,
462,
9651,
1723,
847,
4236,
29898,
1066,
29918,
12772,
29889,
1949,
295,
3285,
29871,
29896,
29897,
13,
9651,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
346,
29918,
6758,
2396,
13,
18884,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
3927,
1799,
29918,
8851,
22530,
3352,
29901,
13,
462,
1678,
285,
29887,
29918,
7915,
353,
29871,
29900,
29889,
29955,
29945,
13,
462,
1678,
565,
770,
29918,
1188,
1169,
29889,
2311,
29898,
29896,
29897,
1275,
29871,
29906,
29901,
13,
462,
4706,
7688,
353,
4842,
305,
29889,
20158,
4197,
29896,
29899,
16434,
29918,
7915,
29892,
285,
29887,
29918,
7915,
14664,
29883,
6191,
29898,
1990,
29918,
1188,
1169,
29889,
657,
29918,
10141,
16655,
7411,
580,
13,
462,
1678,
25342,
770,
29918,
1188,
1169,
29889,
2311,
29898,
29896,
29897,
1275,
29871,
29941,
29901,
13,
462,
4706,
7688,
353,
4842,
305,
29889,
20158,
4197,
29896,
29899,
16434,
29918,
7915,
29892,
285,
29887,
29918,
7915,
29892,
285,
29887,
29918,
7915,
14664,
29883,
6191,
29898,
1990,
29918,
1188,
1169,
29889,
657,
29918,
10141,
16655,
7411,
580,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
12020,
8960,
877,
1990,
1480,
1169,
270,
2073,
291,
2743,
29892,
508,
871,
367,
29871,
29906,
470,
29871,
29941,
363,
4964,
3317,
2257,
6410,
1495,
13,
462,
1678,
12965,
29918,
6758,
353,
383,
29889,
19128,
29918,
296,
14441,
29898,
1990,
29918,
1188,
1169,
29892,
11073,
29892,
7688,
29922,
7915,
29897,
396,
1735,
304,
12789,
284,
6410,
259,
13,
18884,
1683,
29901,
13,
462,
1678,
12965,
29918,
6758,
353,
383,
29889,
19128,
29918,
296,
14441,
29898,
1990,
29918,
1188,
1169,
29892,
11073,
29897,
396,
1735,
304,
12789,
284,
6410,
259,
13,
9651,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29885,
344,
29918,
6758,
29915,
322,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
18884,
12965,
29918,
6758,
353,
4842,
305,
29889,
12676,
3552,
1990,
29918,
1188,
1169,
29889,
18816,
29885,
3398,
580,
29899,
2695,
29918,
21134,
29897,
1068,
29906,
29897,
3986,
13,
9651,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29885,
344,
29918,
6758,
29915,
322,
451,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
18884,
12965,
29918,
6758,
353,
4842,
305,
29889,
12676,
3552,
1990,
29918,
1188,
1169,
29889,
18816,
29885,
3398,
580,
29899,
21134,
29889,
7411,
3101,
1068,
29906,
29897,
3986,
13,
9651,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29880,
29896,
29918,
6758,
29915,
322,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
18884,
12965,
29918,
6758,
353,
4842,
305,
29889,
12676,
29898,
7345,
305,
29889,
6897,
29898,
1990,
29918,
1188,
1169,
29889,
18816,
29885,
3398,
580,
29899,
2695,
29918,
21134,
876,
13,
9651,
25342,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29883,
17115,
29918,
6758,
29915,
322,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
6156,
7818,
29918,
24461,
6670,
4214,
29901,
13,
18884,
12965,
29918,
6758,
353,
1583,
29889,
29907,
29990,
29923,
29898,
1990,
29918,
1188,
1169,
29889,
2695,
3317,
29898,
6229,
29922,
29896,
511,
4964,
29918,
21134,
29897,
13,
9651,
1683,
29901,
13,
18884,
12020,
8960,
877,
695,
294,
2450,
6410,
310,
1473,
7408,
451,
2854,
1495,
13,
13,
9651,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1525,
5348,
1660,
29918,
22364,
29901,
13,
18884,
11837,
29918,
25932,
29918,
6758,
353,
1583,
29889,
5800,
29907,
1964,
29918,
3927,
1799,
29898,
13,
462,
1678,
4842,
305,
29889,
6897,
29898,
1990,
29918,
1188,
1169,
29889,
2695,
3317,
29898,
6229,
10457,
29896,
6817,
13478,
29918,
1990,
29918,
1188,
1169,
29889,
2695,
3317,
29898,
6229,
10457,
29896,
876,
13,
462,
1678,
1723,
13,
13,
9651,
396,
679,
16285,
393,
3928,
304,
278,
17855,
22525,
363,
13,
9651,
396,
278,
6590,
5962,
8760,
11073,
29892,
304,
367,
1304,
411,
13,
9651,
396,
12862,
26190,
13,
9651,
4559,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
353,
4842,
305,
29889,
5464,
9171,
29898,
21134,
1405,
29871,
29900,
467,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
9651,
11073,
29918,
1066,
353,
11073,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
29962,
13,
9651,
565,
1583,
29889,
25932,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
29901,
13,
18884,
2910,
29918,
12772,
353,
4842,
305,
29889,
20158,
4197,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29955,
1402,
4742,
29922,
10141,
29897,
13,
9651,
1683,
29901,
13,
18884,
2910,
29918,
12772,
353,
29871,
29946,
334,
11073,
29918,
1066,
7503,
29892,
6213,
29962,
718,
4842,
305,
29889,
20158,
29898,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
4742,
29922,
10141,
29897,
13,
13,
9651,
3800,
29918,
6758,
353,
10597,
29918,
29880,
29896,
29918,
6758,
29898,
13,
18884,
3800,
29918,
276,
11476,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
7503,
29892,
6213,
1402,
2910,
29918,
12772,
1402,
13,
18884,
17855,
29918,
5182,
29879,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
1402,
13,
18884,
2159,
29918,
12483,
482,
29922,
8824,
29892,
13,
18884,
21762,
29922,
29896,
29892,
13,
9651,
1723,
13,
9651,
3800,
29918,
6758,
353,
3800,
29918,
6758,
847,
11073,
29889,
1949,
295,
580,
13,
4706,
1683,
29901,
396,
871,
25202,
6410,
310,
289,
1884,
267,
23329,
304,
330,
29873,
29918,
1643,
322,
286,
344,
6410,
13,
9651,
405,
353,
11073,
29889,
2311,
29898,
29900,
29897,
13,
9651,
1067,
29879,
29918,
21134,
353,
11073,
29889,
16513,
580,
13,
9651,
1067,
29879,
29918,
21134,
29961,
7345,
305,
29889,
5464,
9171,
29898,
25932,
29918,
21134,
19216,
4141,
29918,
1643,
4638,
353,
29871,
29900,
13,
9651,
1067,
29879,
29918,
21134,
29961,
7345,
305,
29889,
5464,
9171,
29898,
25932,
29918,
21134,
1360,
4141,
29918,
1643,
4638,
353,
29871,
29896,
13,
13,
9651,
926,
29918,
12772,
353,
4842,
305,
29889,
5464,
9171,
29898,
25932,
29918,
21134,
1405,
29871,
29900,
29897,
13,
9651,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1660,
6007,
29928,
29918,
1254,
10461,
29918,
6154,
29903,
29918,
3927,
1799,
1275,
525,
29888,
18642,
29918,
6758,
2396,
13,
18884,
12965,
29918,
6758,
353,
1583,
29889,
25932,
29918,
6758,
29918,
9891,
29898,
13,
462,
18884,
770,
29918,
1188,
1169,
29892,
13,
462,
18884,
1067,
29879,
29918,
21134,
29889,
524,
580,
13,
462,
9651,
1723,
847,
313,
926,
29918,
12772,
29889,
1949,
295,
580,
718,
405,
1723,
13,
9651,
1683,
29901,
13,
18884,
12965,
29918,
6758,
353,
383,
29889,
19128,
29918,
296,
14441,
29898,
1990,
29918,
1188,
1169,
29892,
1067,
29879,
29918,
21134,
29897,
396,
1735,
304,
12789,
284,
6410,
13,
13,
9651,
396,
679,
16285,
393,
3928,
304,
278,
17855,
22525,
363,
13,
9651,
396,
278,
6590,
5962,
8760,
11073,
29892,
304,
367,
1304,
411,
13,
9651,
396,
12862,
26190,
13,
9651,
565,
1067,
29879,
29918,
21134,
29889,
1949,
295,
580,
1275,
29871,
29900,
29901,
13,
18884,
3800,
29918,
6758,
353,
4842,
305,
29889,
20158,
29898,
29900,
467,
7411,
2141,
29883,
6191,
29898,
10141,
29897,
13,
9651,
1683,
29901,
13,
18884,
4559,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
353,
4842,
305,
29889,
5464,
9171,
29898,
25932,
29918,
21134,
1405,
29871,
29900,
467,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
18884,
11073,
29918,
1066,
353,
1067,
29879,
29918,
21134,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
29962,
13,
18884,
565,
1583,
29889,
25932,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
29901,
13,
462,
1678,
2910,
29918,
12772,
353,
4842,
305,
29889,
20158,
4197,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29955,
1402,
4742,
29922,
10141,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
2910,
29918,
12772,
353,
29871,
29946,
334,
11073,
29918,
1066,
7503,
29892,
6213,
29962,
718,
4842,
305,
29889,
20158,
29898,
13,
462,
4706,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
4742,
29922,
10141,
29897,
13,
13,
13,
18884,
3800,
29918,
6758,
353,
10597,
29918,
29880,
29896,
29918,
6758,
29898,
13,
462,
1678,
3800,
29918,
276,
11476,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
7503,
29892,
6213,
1402,
2910,
29918,
12772,
1402,
13,
462,
1678,
17855,
29918,
5182,
29879,
29961,
11249,
29881,
29918,
1066,
29918,
12772,
29918,
6484,
1402,
13,
462,
1678,
2159,
29918,
12483,
482,
29922,
8824,
29892,
13,
462,
1678,
21762,
29922,
29896,
29892,
13,
18884,
1723,
13,
18884,
3800,
29918,
6758,
353,
3800,
29918,
6758,
847,
1067,
29879,
29918,
21134,
29889,
1949,
295,
580,
13,
4706,
565,
1583,
29889,
16859,
29889,
16359,
29956,
29918,
7068,
2891,
29889,
1525,
5348,
1660,
29918,
22364,
29901,
13,
9651,
736,
12965,
29918,
6758,
29892,
3800,
29918,
6758,
29892,
11837,
29918,
25932,
29918,
6758,
13,
13,
4706,
396,
788,
297,
716,
3480,
2304,
6276,
29920,
13,
4706,
565,
3480,
29918,
1990,
29918,
1188,
1169,
338,
451,
6213,
29901,
29871,
13,
9651,
3480,
29918,
1990,
29918,
1188,
1169,
353,
6635,
29898,
10052,
29918,
1990,
29918,
1188,
1169,
29892,
3964,
29922,
29900,
29897,
13,
9651,
8569,
29918,
10052,
29918,
1990,
29918,
1188,
1169,
353,
3480,
29918,
1990,
29918,
1188,
1169,
29961,
21134,
1360,
29896,
29962,
13,
9651,
8569,
29918,
1066,
29918,
1990,
29918,
1188,
1169,
353,
770,
29918,
1188,
1169,
29961,
21134,
1360,
29896,
29962,
13,
9651,
396,
8569,
29918,
21134,
353,
11073,
29961,
21134,
1360,
29896,
29962,
13,
9651,
8569,
29918,
10052,
29918,
1990,
29918,
1557,
2361,
353,
8569,
29918,
10052,
29918,
1990,
29918,
1188,
1169,
29889,
2695,
3317,
29898,
6229,
29922,
29896,
29897,
7503,
29892,
29896,
29962,
13,
9651,
8569,
29918,
1066,
29918,
1990,
29918,
1557,
2361,
353,
8569,
29918,
1066,
29918,
1990,
29918,
1188,
1169,
29889,
2695,
3317,
29898,
6229,
29922,
29896,
29897,
7503,
29892,
29896,
29962,
13,
9651,
1067,
29879,
29918,
19303,
1253,
29918,
6758,
353,
383,
29889,
2674,
29884,
29898,
18037,
29918,
10052,
29918,
1990,
29918,
1557,
2361,
29899,
18037,
29918,
1066,
29918,
1990,
29918,
1557,
2361,
29974,
29900,
29889,
29941,
467,
12676,
580,
13,
9651,
396,
1067,
29879,
29918,
19303,
1253,
29918,
6758,
353,
383,
29889,
19128,
29918,
296,
14441,
29898,
18037,
29918,
10052,
29918,
1990,
29918,
1188,
1169,
29892,
29871,
29896,
29899,
18037,
29918,
21134,
29897,
396,
1735,
304,
12789,
284,
6410,
259,
13,
9651,
736,
12965,
29918,
6758,
29892,
3800,
29918,
6758,
29892,
1067,
29879,
29918,
19303,
1253,
29918,
6758,
13,
13,
4706,
736,
12965,
29918,
6758,
29892,
3800,
29918,
6758,
13,
13,
13,
1753,
1207,
29918,
307,
29875,
29918,
1884,
29918,
6758,
29918,
24219,
1061,
29898,
16859,
1125,
13,
1678,
1993,
261,
353,
14514,
261,
29898,
13,
4706,
274,
16434,
29889,
20387,
29931,
29889,
1672,
29902,
29918,
23252,
29903,
29889,
29943,
29954,
29918,
5971,
29965,
29918,
4690,
1525,
7068,
5607,
29928,
29892,
13,
4706,
274,
16434,
29889,
20387,
29931,
29889,
1672,
29902,
29918,
23252,
29903,
29889,
29933,
29954,
29918,
5971,
29965,
29918,
4690,
1525,
7068,
5607,
29928,
29892,
13,
4706,
2758,
29918,
677,
29918,
29567,
29918,
20317,
29922,
8824,
29892,
13,
1678,
1723,
13,
13,
1678,
289,
1884,
29918,
1727,
29918,
705,
5861,
353,
274,
16434,
29889,
20387,
29931,
29889,
1672,
29902,
29918,
23252,
29903,
29889,
29933,
8456,
29990,
29918,
18166,
29918,
8851,
22530,
29903,
13,
1678,
3800,
29918,
29883,
6119,
353,
11773,
29907,
6119,
29898,
705,
5861,
29922,
29890,
1884,
29918,
1727,
29918,
705,
5861,
29897,
13,
13,
1678,
285,
29887,
29918,
16264,
29918,
13445,
20069,
353,
7392,
8362,
9135,
3321,
29940,
387,
1230,
22966,
20069,
29898,
13,
4706,
274,
16434,
29889,
20387,
29931,
29889,
1672,
29902,
29918,
23252,
29903,
29889,
29933,
14789,
29918,
14226,
29918,
13171,
29918,
2382,
29892,
274,
16434,
29889,
20387,
29931,
29889,
1672,
29902,
29918,
23252,
29903,
29889,
24815,
1806,
18474,
29918,
29943,
4717,
9838,
13,
1678,
1723,
13,
13,
1678,
1067,
29879,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
353,
274,
16434,
29889,
20387,
29931,
29889,
6154,
29903,
29918,
10051,
29940,
3718,
2965,
29918,
29933,
8456,
29990,
29918,
18166,
13,
13,
1678,
6410,
29918,
24219,
1061,
353,
23786,
10363,
10262,
29931,
2209,
1523,
14584,
29898,
13,
4706,
274,
16434,
29892,
13,
4706,
1993,
261,
29892,
29871,
13,
4706,
285,
29887,
29918,
16264,
29918,
13445,
20069,
29892,
29871,
13,
4706,
3800,
29918,
29883,
6119,
29892,
29871,
13,
4706,
1067,
29879,
29918,
21780,
29918,
29890,
1884,
29918,
1727,
13,
1678,
1723,
13,
13,
1678,
736,
6410,
29918,
24219,
1061,
13,
2
] |
databass/exprutil.py | ivychen/databass-public | 6 | 86626 | from itertools import chain
from .exprs import *
def predicate_to_cnf(e):
"""
Split AND tree into a list of conditions
"""
if not e:
return []
if e.is_type("Expr") and e.op.lower() == "and":
return list(chain(*map(predicate_to_cnf, [e.l, e.r])))
if e.is_type("Paren"):
return [e.c]
return [e]
def cnf_to_predicate(conds):
"""
turn list of conditions into an AND tree
"""
if not conds: return None
cond = conds[0]
for c in conds[1:]:
cond = Expr("and", cond, c)
return cond
| [
1,
515,
4256,
8504,
1053,
9704,
13,
3166,
869,
13338,
29879,
1053,
334,
13,
13,
1753,
24384,
29918,
517,
29918,
18038,
29888,
29898,
29872,
1125,
13,
29871,
9995,
13,
29871,
26178,
5300,
5447,
964,
263,
1051,
310,
5855,
13,
29871,
9995,
13,
29871,
565,
451,
321,
29901,
13,
1678,
736,
5159,
13,
29871,
565,
321,
29889,
275,
29918,
1853,
703,
21176,
1159,
322,
321,
29889,
459,
29889,
13609,
580,
1275,
376,
392,
1115,
13,
1678,
736,
1051,
29898,
14153,
10456,
1958,
29898,
11965,
9593,
29918,
517,
29918,
18038,
29888,
29892,
518,
29872,
29889,
29880,
29892,
321,
29889,
29878,
29962,
4961,
13,
29871,
565,
321,
29889,
275,
29918,
1853,
703,
2177,
264,
29908,
1125,
13,
1678,
736,
518,
29872,
29889,
29883,
29962,
13,
29871,
736,
518,
29872,
29962,
13,
13,
1753,
274,
29876,
29888,
29918,
517,
29918,
11965,
9593,
29898,
1116,
29879,
1125,
13,
29871,
9995,
13,
29871,
2507,
1051,
310,
5855,
964,
385,
5300,
5447,
13,
29871,
9995,
13,
29871,
565,
451,
2148,
29879,
29901,
736,
6213,
13,
29871,
2148,
353,
2148,
29879,
29961,
29900,
29962,
13,
29871,
363,
274,
297,
2148,
29879,
29961,
29896,
29901,
5387,
13,
1678,
2148,
353,
1222,
558,
703,
392,
613,
2148,
29892,
274,
29897,
13,
29871,
736,
2148,
13,
13,
13,
2
] |
nesta/packages/worldbank/collect_worldbank.py | anniyanvr/nesta | 13 | 1604553 | """
Collect worldbank
=================
Collect worldbank sociodemographic data by country.
"""
import requests
from retrying import retry
import json
from collections import defaultdict
import re
import math
import pandas as pd
WORLDBANK_ENDPOINT = "http://api.worldbank.org/v2/{}"
DEAD_RESPONSE = (None, None) # tuple to match the default python return type
def worldbank_request(suffix, page, per_page=10000, data_key_path=None):
"""Hit the worldbank API and extract metadata and data from the response.
Args:
suffix (str): Suffix to append to :obj:`WORLDBANK_ENDPOINT`.
page (int): Pagination number in API request.
per_page (int): Number of results to return per request.
data_key_path (list): List specifying json path to data object.
Returns:
metadata, data (dict, list): Metadata and data from API response.
"""
response = _worldbank_request(suffix=suffix, page=page, per_page=per_page)
metadata, data = data_from_response(response=response,
data_key_path=data_key_path)
return metadata, data
@retry(stop_max_attempt_number=3, wait_fixed=2000)
def _worldbank_request(suffix, page, per_page):
"""Hit the worldbank API and return the response.
Args:
suffix (str): Suffix to append to :obj:`WORLDBANK_ENDPOINT`.
page (int): Pagination number in API request.
per_page (int): Number of results to return per request.
Returns:
response (:obj:`requests.Response`)
"""
# Hit the API
r = requests.get(WORLDBANK_ENDPOINT.format(suffix),
params=dict(per_page=per_page, format="json", page=page))
# There are some non-404 status codes which indicate invalid API request
if r.status_code == 400:
return DEAD_RESPONSE
r.raise_for_status()
# There are even some 200 status codes which indicate invalid API request
# purely by returning non-json data
response = DEAD_RESPONSE
try:
response = r.json()
except json.JSONDecodeError:
pass
finally:
return response
def data_from_response(response, data_key_path=None):
"""Split up the response from the worldbank API.
Args:
response (tuple): Response from worldbank API, expected to be a tuple of two json items.
data_key_path (list): List specifying json path to data object.
Returns:
metadata, data (dict, list): Metadata and data from API response.
"""
# If the data is stored ({metadata}, [datarows])
if data_key_path is None or response == DEAD_RESPONSE:
metadata, datarows = response
# Otherwise if the data is stored as {metadata, path:{[to:data]}}
# (or similar)
else:
metadata = response
datarows = response.copy()
for key in data_key_path:
datarows = datarows[key]
if key != data_key_path[-1] and type(datarows) is list:
datarows = datarows[0]
return metadata, datarows
def calculate_number_of_api_pages(suffix, per_page=10000, data_key_path=None):
"""Calculate the number of API scrolls required to paginate through this
request.
Args:
suffix (str): Suffix to append to :obj:`WORLDBANK_ENDPOINT`.
per_page (int): Number of results to return per request.
data_key_path (list): List specifying json path to data object.
Returns:
n_pages (int): Number of API scrolls required.
"""
# Discover the shape of the data by inspecting the metadata with
# a tiny request (1 result, 1 page)
metadata, _ = worldbank_request(suffix=suffix, page=1,
per_page=1,
data_key_path=data_key_path)
# If the request was invalid, there are no pages
if metadata is None:
return 0
# Calculate the number of pages required
total = int(metadata["total"])
n_pages = math.floor(total / per_page) + int(total % per_page > 0)
return n_pages
def worldbank_data_interval(suffix, first_page, last_page,
per_page=10000, data_key_path=None):
"""Yield a row of data from worldbank API in a page interval.
Args:
suffix (str): Suffix to append to :obj:`WORLDBANK_ENDPOINT`.
{first, last}_page (int): First (last) page number of the API request.
per_page (int): Number of results to return per request.
data_key_path (list): List specifying json path to data object.
Yields:
row (dict): A row of data from the worldbank API.
"""
for page in range(first_page, last_page+1):
_, datarows = worldbank_request(suffix=suffix, page=page,
per_page=per_page,
data_key_path=data_key_path)
if datarows is None:
continue
for row in datarows:
yield row
def worldbank_data(suffix, per_page=10000, data_key_path=None):
"""Yield a row of data from worldbank API in a page interval.
Args:
suffix (str): Suffix to append to :obj:`WORLDBANK_ENDPOINT`.
per_page (int): Number of results to return per request.
data_key_path (list): List specifying json path to data object.
Yields:
row (dict): A row of data from the worldbank API.
"""
n_pages = calculate_number_of_api_pages(suffix=suffix,
per_page=per_page,
data_key_path=data_key_path)
return worldbank_data_interval(suffix, first_page=1,
last_page=n_pages,
per_page=per_page,
data_key_path=data_key_path)
def get_worldbank_resource(resource):
"""Extract and flatten all data for one worldbank resource.
Args:
resource (str): One of "countries", "series" or "source"
Returns:
collection (list): A list of resource data.
"""
collection = []
for row in worldbank_data(resource):
# Flatten out any data stored by a key named "value"
data = {}
for k, v in row.items():
if type(v) is dict:
v = v["value"]
data[k] = v
collection.append(data)
return collection
def get_variables_by_code(codes):
"""Discover all dataset locations for each variable id, by variable code.
Note: one variable may exist in many datasets, which is handy in the case
of missing data.
Args:
codes (list): The codes of all variables to be discovered.
Returns:
variables (dict): Mapping of variable id --> dataset names.
"""
key_path = ["source", "concept", "variable"]
# Mapping variable id --> dataset names
variables = defaultdict(list)
sources = get_worldbank_resource("source")
for source in sources:
# Extract variables in this "source" (dataset)
suffix = f"sources/{source['id']}/series/data"
data = worldbank_data(suffix, data_key_path=key_path)
# Filter out variables that we don't want
filtered_data = filter(lambda row: (row['id'] in codes), data)
# Assign remaining datasets to this variable
for row in filtered_data:
variables[row['id']].append(source['id'])
return variables
def unpack_quantity(row, concept, value):
"""Unpack row like {"variable": [{"concept":<concept>, <value>:_i_want_this_}]}
Args:
row (dict): Row of Worldbank API data.
concept (str): The name of the dataset containing the variable.
value (str): The name of the variable to unpack.
Returns:
A value.
"""
for quantity in row['variable']:
if quantity['concept'] == concept:
return quantity[value]
raise NameError(f"No item found in {row['variable']} with "
f"concept = {concept}")
def unpack_data(row):
"""Unpack an entire row of Worldbank API data.
Args:
row (dict): Row of Worldbank API data.
Returns:
country, variable, time, value
"""
country = unpack_quantity(row, 'Country', 'id')
#variable = unpack_quantity(row, 'Series', 'value')
time = unpack_quantity(row, 'Time', 'value')
value = row['value']
return country, time, value
def get_country_data(variables, aliases, time="all"):
"""Extract data for specified variables for all available
countries, in a specified year.
Args:
variables (dict): Mapping of variable --> dataset ids.
aliases (dict): Mapping of dirty -> clean variable name.
time (str): String to identify time period to request.
Returns:
country_data (dict): Mapping of country --> variable name --> value
"""
# Iterate through datasets
country_data = defaultdict(dict) # lambda: defaultdict(list))
kwargs_list = get_country_data_kwargs(variables=variables,
aliases=aliases,
time=time)
for kwargs in kwargs_list:
_country_data = country_data_single_request(**kwargs)
for country, data in _country_data.items():
for var_name, data_row in data.items():
country_data[country][var_name] = data_row
return country_data
def get_country_data_kwargs(variables, aliases, time="all", per_page=10000, max_pages=None):
"""Generate every set of kwargs required to make single requests.
Designed to be used with :obj:`country_data_single_request` in order
to be batched.
Args:
variables (dict): Mapping of variable --> dataset ids.
aliases (dict): Mapping of variable name aliases, to ensure
consistent variable naming between data collections.
per_page (int): Number of results to return per request.
Returns:
kwargs_list (list): kwargs list for :obj:`country_data_single_request`.
"""
# Iterate through datasets
kwargs_list = []
key_path = ["source", "data"]
for series, sources in variables.items():
# The name of a given variable varies subtlely across multiple
# datasets, so we extract the variable name the first time for
# consistency across datasets.
alias = aliases[series]
for source in sources:
suffix = (f"sources/{source}/country/all/"
f"series/{series}/time/{time}/data")
n_pages = calculate_number_of_api_pages(suffix=suffix,
per_page=per_page,
data_key_path=key_path)
for page in range(1, n_pages+1):
if max_pages is not None and page > max_pages:
break
parameters = dict(alias=alias,
suffix=suffix, first_page=page,
last_page=page, per_page=per_page,
data_key_path=key_path)
kwargs_list.append(parameters)
return kwargs_list
def country_data_single_request(alias, **kwargs):
"""Extract data for all countries using kwargs generated by
:obj:`get_country_data_kwargs`.
Args:
kwargs (dict): An item returned by :obj:`get_country_data_kwargs`.
Returns:
country_data (dict): Mapping of country --> variable name --> value
"""
country_data = defaultdict(lambda: defaultdict(list))
done_pkeys = set()
data = worldbank_data_interval(**kwargs)
for country, time, value in map(unpack_data, data):
if value is None: # Missing data for this country
continue
pkey = (country, time)
if pkey in done_pkeys: # Already done this country
continue
done_pkeys.add(pkey)
new_row = {"value": value, "time": time}
country_data[country][alias].append(new_row)
return country_data
# def flatten_country_data(country_data, country_metadata):
# """Merge and flatten country data and metadata together.
# Args:
# country_data (dict): Mapping of country --> variable name --> value
# country_metadata (list): List of country metadata.
# Returns:
# flat_country_data (list): Flattened country data and metadata.
# """
# flat_country_data = [dict(**country_data[metadata['id']], **metadata)
# for metadata in country_metadata
# if metadata['id'] in country_data]
# return flat_country_data
def discover_variable_name(series):
"""Discover variable names from each series [short hand code].
Args:
series (str): The short hand code for the variable name,
according to Worldbank API.
Returns:
alias (str): The variable name for the given series.
"""
_, data = worldbank_request(f"en/indicator/{series}", page=1)
alias = data[0]["name"]
return alias
def clean_variable_name(var_name):
"""Clean a single variable name ready for DB storage.
Args:
var_name (str): Variable name to be cleaned
Returns:
new_var_name (str): A MySQL compliant variable name.
"""
# Lower, replace '%', remove non-alphanums and use '_'
new_var_name = var_name.lower().replace("%", "pc")
new_var_name = re.sub('[^0-9a-zA-Z]+', ' ', new_var_name)
new_var_name = new_var_name.lstrip().rstrip().replace(" ", "_")
# Recursively shorten from middle character until less than 64 chars long
# (this is the default MySQL limit)
# Middle character has been chosen to allow some readability.
while len(new_var_name) > 64:
# Find the longest term
longest_term = ""
for term in new_var_name.split("_"):
if len(term) <= len(longest_term):
continue
longest_term = term
# Remove the middle character from the longest term
middle = len(longest_term) - 1
new_term = longest_term[:middle] + longest_term[middle+1:]
new_var_name = new_var_name.replace(longest_term, new_term)
return new_var_name
def clean_variable_names(flat_country_data):
"""Clean variable names ready for DB storage.
Args:
flat_country_data (list): Flattened country data.
Returns:
out_data (list): Same as input data, with MySQL compliant field names.
"""
out_data = []
for row in flat_country_data:
new_row = {}
for key, v in row.items():
# Only clean names containing spaces
if " " not in key:
new_row[key] = v
continue
new_key = clean_variable_name(key)
new_row[new_key] = v
out_data.append(new_row)
return out_data
def is_bad_quarter(x, bad_quarters):
return any(q in x for q in bad_quarters)
def flatten_country_data(country_data, country_metadata,
bad_quarters=("Q1", "Q3", "Q4")):
# Discover the year from the time variable.
# Expected to be in the formats "XXXX" and "XXXX QX"
country_metadata = {metadata["id"]: metadata
for metadata in country_metadata}
fairly_flat_data = []
for iso3, _ in country_metadata.items():
for variable, data in country_data[iso3].items():
for row in data:
year = re.findall(r'(\d{4})', row["time"])[0]
flatter_row = dict(country=iso3, variable=variable,
year=year, **row)
fairly_flat_data.append(flatter_row)
# Group by country and year and remove quarters we don't want.
very_flat_data = []
df = pd.DataFrame(fairly_flat_data)
for (country, year), _df in df.groupby(["country", "year"]):
# Identify quarters we don't want
condition = _df["time"].apply(is_bad_quarter,
bad_quarters=bad_quarters)
if (~condition).sum() == 0:
continue
row = {r["variable"]: r["value"]
for _, r in _df.loc[~condition].iterrows()}
row = dict(year=year, **row, **country_metadata[country])
very_flat_data.append(row)
return very_flat_data
if __name__ == "__main__":
# DO ALL OF THE FOLLOWING IN A SINGLE LUIGI TASK
variables = get_variables_by_code(["SP.RUR.TOTL.ZS", "SP.URB.TOTL.IN.ZS",
"SP.POP.DPND", "SP.POP.TOTL",
"SP.DYN.LE00.IN", "SP.DYN.IMRT.IN",
"BAR.NOED.25UP.ZS",
"BAR.TER.CMPT.25UP.ZS",
"NYGDPMKTPSAKD",
"SI.POV.NAHC", "SI.POV.GINI"])
aliases = {series: discover_variable_name(series)
for series, sources in variables.items()}
# (EXCEPT THIS ONE)
# country_data = get_country_data(variables, aliases)
# ALSO DO THIS
kwargs_list = get_country_data_kwargs(variables=variables,
aliases=aliases,
max_pages=2) # <== Test mode
# THEN BATCH, FOR CHUNKS OF KWARGS
country_data = defaultdict(dict)
for kwargs in kwargs_list:
_country_data = country_data_single_request(**kwargs)
for country, data in _country_data.items():
for var_name, data_row in data.items():
country_data[country][var_name] = data_row
# THEN A FINAL TASK GETS THE ABOVE RESULTS BY COUNTRY
# AND WRITES TO DATABASE
country_metadata = get_worldbank_resource("countries")
flat_country_data = flatten_country_data(country_data, country_metadata)
cleaned_data = clean_variable_names(flat_country_data)
# STEP AFTER PUTS THESE IN ES
| [
1,
9995,
13,
28916,
3186,
9157,
13,
9166,
29922,
13,
13,
28916,
3186,
9157,
5374,
356,
29885,
12122,
848,
491,
4234,
29889,
13,
15945,
29908,
13,
13,
5215,
7274,
13,
3166,
337,
2202,
292,
1053,
337,
2202,
13,
5215,
4390,
13,
3166,
16250,
1053,
2322,
8977,
13,
5215,
337,
13,
5215,
5844,
13,
5215,
11701,
408,
10518,
13,
13,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
353,
376,
1124,
597,
2754,
29889,
11526,
9157,
29889,
990,
29914,
29894,
29906,
19248,
5038,
13,
2287,
3035,
29918,
1525,
5550,
1164,
1660,
353,
313,
8516,
29892,
6213,
29897,
29871,
396,
18761,
304,
1993,
278,
2322,
3017,
736,
1134,
13,
13,
13,
1753,
3186,
9157,
29918,
3827,
29898,
2146,
600,
861,
29892,
1813,
29892,
639,
29918,
3488,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
848,
29918,
1989,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
29950,
277,
278,
3186,
9157,
3450,
322,
6597,
15562,
322,
848,
515,
278,
2933,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
25557,
313,
710,
1125,
2166,
600,
861,
304,
9773,
304,
584,
5415,
18078,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
1412,
13,
4706,
1813,
313,
524,
1125,
349,
351,
3381,
1353,
297,
3450,
2009,
29889,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
4706,
848,
29918,
1989,
29918,
2084,
313,
1761,
1125,
2391,
22146,
4390,
2224,
304,
848,
1203,
29889,
13,
1678,
16969,
29901,
13,
4706,
15562,
29892,
848,
313,
8977,
29892,
1051,
1125,
4737,
7221,
322,
848,
515,
3450,
2933,
29889,
13,
1678,
9995,
13,
1678,
2933,
353,
903,
11526,
9157,
29918,
3827,
29898,
2146,
600,
861,
29922,
2146,
600,
861,
29892,
1813,
29922,
3488,
29892,
639,
29918,
3488,
29922,
546,
29918,
3488,
29897,
13,
1678,
15562,
29892,
848,
353,
848,
29918,
3166,
29918,
5327,
29898,
5327,
29922,
5327,
29892,
13,
462,
462,
4706,
848,
29918,
1989,
29918,
2084,
29922,
1272,
29918,
1989,
29918,
2084,
29897,
13,
1678,
736,
15562,
29892,
848,
13,
13,
13,
29992,
276,
2202,
29898,
9847,
29918,
3317,
29918,
1131,
3456,
29918,
4537,
29922,
29941,
29892,
4480,
29918,
20227,
29922,
29906,
29900,
29900,
29900,
29897,
13,
1753,
903,
11526,
9157,
29918,
3827,
29898,
2146,
600,
861,
29892,
1813,
29892,
639,
29918,
3488,
1125,
13,
1678,
9995,
29950,
277,
278,
3186,
9157,
3450,
322,
736,
278,
2933,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
25557,
313,
710,
1125,
2166,
600,
861,
304,
9773,
304,
584,
5415,
18078,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
1412,
13,
4706,
1813,
313,
524,
1125,
349,
351,
3381,
1353,
297,
3450,
2009,
29889,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
1678,
16969,
29901,
13,
4706,
2933,
13940,
5415,
18078,
24830,
29889,
5103,
6348,
13,
1678,
9995,
13,
1678,
396,
14309,
278,
3450,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
29889,
4830,
29898,
2146,
600,
861,
511,
13,
462,
268,
8636,
29922,
8977,
29898,
546,
29918,
3488,
29922,
546,
29918,
3488,
29892,
3402,
543,
3126,
613,
1813,
29922,
3488,
876,
13,
13,
1678,
396,
1670,
526,
777,
1661,
29899,
29946,
29900,
29946,
4660,
11561,
607,
12266,
8340,
3450,
2009,
13,
1678,
565,
364,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
29901,
13,
4706,
736,
5012,
3035,
29918,
1525,
5550,
1164,
1660,
13,
1678,
364,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
13,
1678,
396,
1670,
526,
1584,
777,
29871,
29906,
29900,
29900,
4660,
11561,
607,
12266,
8340,
3450,
2009,
13,
1678,
396,
24837,
491,
7863,
1661,
29899,
3126,
848,
13,
1678,
2933,
353,
5012,
3035,
29918,
1525,
5550,
1164,
1660,
13,
1678,
1018,
29901,
13,
4706,
2933,
353,
364,
29889,
3126,
580,
13,
1678,
5174,
4390,
29889,
7249,
2772,
401,
2392,
29901,
13,
4706,
1209,
13,
1678,
7146,
29901,
13,
4706,
736,
2933,
13,
13,
13,
1753,
848,
29918,
3166,
29918,
5327,
29898,
5327,
29892,
848,
29918,
1989,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
18772,
701,
278,
2933,
515,
278,
3186,
9157,
3450,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
2933,
313,
23583,
1125,
13291,
515,
3186,
9157,
3450,
29892,
3806,
304,
367,
263,
18761,
310,
1023,
4390,
4452,
29889,
13,
4706,
848,
29918,
1989,
29918,
2084,
313,
1761,
1125,
2391,
22146,
4390,
2224,
304,
848,
1203,
29889,
13,
1678,
16969,
29901,
13,
4706,
15562,
29892,
848,
313,
8977,
29892,
1051,
1125,
4737,
7221,
322,
848,
515,
3450,
2933,
29889,
13,
1678,
9995,
13,
1678,
396,
960,
278,
848,
338,
6087,
21313,
19635,
1118,
518,
4130,
279,
1242,
2314,
13,
1678,
565,
848,
29918,
1989,
29918,
2084,
338,
6213,
470,
2933,
1275,
5012,
3035,
29918,
1525,
5550,
1164,
1660,
29901,
13,
4706,
15562,
29892,
1418,
279,
1242,
353,
2933,
13,
1678,
396,
13466,
565,
278,
848,
338,
6087,
408,
426,
19635,
29892,
2224,
29901,
13970,
517,
29901,
1272,
29962,
930,
13,
1678,
396,
313,
272,
2788,
29897,
13,
1678,
1683,
29901,
13,
4706,
15562,
353,
2933,
13,
4706,
1418,
279,
1242,
353,
2933,
29889,
8552,
580,
13,
4706,
363,
1820,
297,
848,
29918,
1989,
29918,
2084,
29901,
13,
9651,
1418,
279,
1242,
353,
1418,
279,
1242,
29961,
1989,
29962,
13,
9651,
565,
1820,
2804,
848,
29918,
1989,
29918,
2084,
14352,
29896,
29962,
322,
1134,
29898,
4130,
279,
1242,
29897,
338,
1051,
29901,
13,
18884,
1418,
279,
1242,
353,
1418,
279,
1242,
29961,
29900,
29962,
13,
1678,
736,
15562,
29892,
1418,
279,
1242,
13,
13,
13,
1753,
8147,
29918,
4537,
29918,
974,
29918,
2754,
29918,
12292,
29898,
2146,
600,
861,
29892,
639,
29918,
3488,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
848,
29918,
1989,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
27065,
403,
278,
1353,
310,
3450,
6355,
29879,
3734,
304,
10203,
16976,
1549,
445,
13,
1678,
2009,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
25557,
313,
710,
1125,
2166,
600,
861,
304,
9773,
304,
584,
5415,
18078,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
1412,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
4706,
848,
29918,
1989,
29918,
2084,
313,
1761,
1125,
2391,
22146,
4390,
2224,
304,
848,
1203,
29889,
13,
1678,
16969,
29901,
13,
4706,
302,
29918,
12292,
313,
524,
1125,
9681,
310,
3450,
6355,
29879,
3734,
29889,
13,
1678,
9995,
13,
1678,
396,
8565,
957,
278,
8267,
310,
278,
848,
491,
16096,
292,
278,
15562,
411,
13,
1678,
396,
263,
21577,
2009,
313,
29896,
1121,
29892,
29871,
29896,
1813,
29897,
13,
1678,
15562,
29892,
903,
353,
3186,
9157,
29918,
3827,
29898,
2146,
600,
861,
29922,
2146,
600,
861,
29892,
1813,
29922,
29896,
29892,
13,
462,
462,
1678,
639,
29918,
3488,
29922,
29896,
29892,
13,
462,
462,
1678,
848,
29918,
1989,
29918,
2084,
29922,
1272,
29918,
1989,
29918,
2084,
29897,
13,
13,
1678,
396,
960,
278,
2009,
471,
8340,
29892,
727,
526,
694,
6515,
13,
1678,
565,
15562,
338,
6213,
29901,
13,
4706,
736,
29871,
29900,
13,
13,
1678,
396,
20535,
403,
278,
1353,
310,
6515,
3734,
13,
1678,
3001,
353,
938,
29898,
19635,
3366,
7827,
20068,
13,
1678,
302,
29918,
12292,
353,
5844,
29889,
14939,
29898,
7827,
847,
639,
29918,
3488,
29897,
718,
938,
29898,
7827,
1273,
639,
29918,
3488,
1405,
29871,
29900,
29897,
13,
1678,
736,
302,
29918,
12292,
13,
13,
13,
1753,
3186,
9157,
29918,
1272,
29918,
19207,
29898,
2146,
600,
861,
29892,
937,
29918,
3488,
29892,
1833,
29918,
3488,
29892,
13,
462,
9651,
639,
29918,
3488,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
848,
29918,
1989,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
29979,
969,
263,
1948,
310,
848,
515,
3186,
9157,
3450,
297,
263,
1813,
7292,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
25557,
313,
710,
1125,
2166,
600,
861,
304,
9773,
304,
584,
5415,
18078,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
1412,
13,
4706,
426,
4102,
29892,
1833,
2403,
3488,
313,
524,
1125,
3824,
313,
4230,
29897,
1813,
1353,
310,
278,
3450,
2009,
29889,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
4706,
848,
29918,
1989,
29918,
2084,
313,
1761,
1125,
2391,
22146,
4390,
2224,
304,
848,
1203,
29889,
13,
1678,
612,
969,
29879,
29901,
13,
4706,
1948,
313,
8977,
1125,
319,
1948,
310,
848,
515,
278,
3186,
9157,
3450,
29889,
13,
1678,
9995,
13,
1678,
363,
1813,
297,
3464,
29898,
4102,
29918,
3488,
29892,
1833,
29918,
3488,
29974,
29896,
1125,
13,
4706,
17117,
1418,
279,
1242,
353,
3186,
9157,
29918,
3827,
29898,
2146,
600,
861,
29922,
2146,
600,
861,
29892,
1813,
29922,
3488,
29892,
13,
462,
462,
4706,
639,
29918,
3488,
29922,
546,
29918,
3488,
29892,
13,
462,
462,
4706,
848,
29918,
1989,
29918,
2084,
29922,
1272,
29918,
1989,
29918,
2084,
29897,
13,
4706,
565,
1418,
279,
1242,
338,
6213,
29901,
13,
9651,
6773,
13,
4706,
363,
1948,
297,
1418,
279,
1242,
29901,
13,
9651,
7709,
1948,
13,
13,
13,
1753,
3186,
9157,
29918,
1272,
29898,
2146,
600,
861,
29892,
639,
29918,
3488,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
848,
29918,
1989,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
29979,
969,
263,
1948,
310,
848,
515,
3186,
9157,
3450,
297,
263,
1813,
7292,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
25557,
313,
710,
1125,
2166,
600,
861,
304,
9773,
304,
584,
5415,
18078,
11686,
29931,
4051,
2190,
29968,
29918,
1430,
11191,
6992,
29911,
1412,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
4706,
848,
29918,
1989,
29918,
2084,
313,
1761,
1125,
2391,
22146,
4390,
2224,
304,
848,
1203,
29889,
13,
1678,
612,
969,
29879,
29901,
13,
4706,
1948,
313,
8977,
1125,
319,
1948,
310,
848,
515,
278,
3186,
9157,
3450,
29889,
13,
1678,
9995,
13,
1678,
302,
29918,
12292,
353,
8147,
29918,
4537,
29918,
974,
29918,
2754,
29918,
12292,
29898,
2146,
600,
861,
29922,
2146,
600,
861,
29892,
13,
462,
462,
9651,
639,
29918,
3488,
29922,
546,
29918,
3488,
29892,
13,
462,
462,
9651,
848,
29918,
1989,
29918,
2084,
29922,
1272,
29918,
1989,
29918,
2084,
29897,
13,
1678,
736,
3186,
9157,
29918,
1272,
29918,
19207,
29898,
2146,
600,
861,
29892,
937,
29918,
3488,
29922,
29896,
29892,
13,
462,
462,
259,
1833,
29918,
3488,
29922,
29876,
29918,
12292,
29892,
13,
462,
462,
259,
639,
29918,
3488,
29922,
546,
29918,
3488,
29892,
13,
462,
462,
259,
848,
29918,
1989,
29918,
2084,
29922,
1272,
29918,
1989,
29918,
2084,
29897,
13,
13,
13,
1753,
679,
29918,
11526,
9157,
29918,
10314,
29898,
10314,
1125,
13,
1678,
9995,
5647,
1461,
322,
1652,
8606,
599,
848,
363,
697,
3186,
9157,
6503,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
6503,
313,
710,
1125,
3118,
310,
376,
2798,
2722,
613,
376,
13757,
29908,
470,
376,
4993,
29908,
13,
1678,
16969,
29901,
13,
4706,
4333,
313,
1761,
1125,
319,
1051,
310,
6503,
848,
29889,
13,
1678,
9995,
13,
1678,
4333,
353,
5159,
13,
1678,
363,
1948,
297,
3186,
9157,
29918,
1272,
29898,
10314,
1125,
13,
4706,
396,
2379,
8606,
714,
738,
848,
6087,
491,
263,
1820,
4257,
376,
1767,
29908,
13,
4706,
848,
353,
6571,
13,
4706,
363,
413,
29892,
325,
297,
1948,
29889,
7076,
7295,
13,
9651,
565,
1134,
29898,
29894,
29897,
338,
9657,
29901,
13,
18884,
325,
353,
325,
3366,
1767,
3108,
13,
9651,
848,
29961,
29895,
29962,
353,
325,
13,
4706,
4333,
29889,
4397,
29898,
1272,
29897,
13,
1678,
736,
4333,
13,
13,
13,
1753,
679,
29918,
20897,
29918,
1609,
29918,
401,
29898,
18137,
1125,
13,
1678,
9995,
4205,
11911,
599,
8783,
14354,
363,
1269,
2286,
1178,
29892,
491,
2286,
775,
29889,
13,
1678,
3940,
29901,
697,
2286,
1122,
1863,
297,
1784,
20035,
29892,
607,
338,
1361,
29891,
297,
278,
1206,
13,
1678,
310,
4567,
848,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
11561,
313,
1761,
1125,
450,
11561,
310,
599,
3651,
304,
367,
10943,
29889,
13,
1678,
16969,
29901,
13,
4706,
3651,
313,
8977,
1125,
341,
20304,
310,
2286,
1178,
6660,
8783,
2983,
29889,
13,
1678,
9995,
13,
1678,
1820,
29918,
2084,
353,
6796,
4993,
613,
376,
535,
1547,
613,
376,
11918,
3108,
13,
13,
1678,
396,
341,
20304,
2286,
1178,
6660,
8783,
2983,
13,
1678,
3651,
353,
2322,
8977,
29898,
1761,
29897,
13,
1678,
8974,
353,
679,
29918,
11526,
9157,
29918,
10314,
703,
4993,
1159,
13,
1678,
363,
2752,
297,
8974,
29901,
13,
4706,
396,
7338,
1461,
3651,
297,
445,
376,
4993,
29908,
313,
24713,
29897,
13,
4706,
25557,
353,
285,
29908,
29879,
2863,
19248,
4993,
1839,
333,
2033,
6822,
13757,
29914,
1272,
29908,
13,
4706,
848,
353,
3186,
9157,
29918,
1272,
29898,
2146,
600,
861,
29892,
848,
29918,
1989,
29918,
2084,
29922,
1989,
29918,
2084,
29897,
13,
4706,
396,
19916,
714,
3651,
393,
591,
1016,
29915,
29873,
864,
13,
4706,
22289,
29918,
1272,
353,
4175,
29898,
2892,
1948,
29901,
313,
798,
1839,
333,
2033,
297,
11561,
511,
848,
29897,
13,
4706,
396,
4007,
647,
9886,
20035,
304,
445,
2286,
13,
4706,
363,
1948,
297,
22289,
29918,
1272,
29901,
13,
9651,
3651,
29961,
798,
1839,
333,
2033,
1822,
4397,
29898,
4993,
1839,
333,
11287,
13,
1678,
736,
3651,
13,
13,
13,
1753,
443,
4058,
29918,
22640,
29898,
798,
29892,
6964,
29892,
995,
1125,
13,
1678,
9995,
2525,
4058,
1948,
763,
8853,
11918,
1115,
518,
6377,
535,
1547,
1115,
29966,
535,
1547,
10202,
529,
1767,
23917,
29918,
29875,
29918,
29893,
424,
29918,
1366,
29918,
6525,
29913,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1948,
313,
8977,
1125,
11438,
310,
2787,
9157,
3450,
848,
29889,
13,
4706,
6964,
313,
710,
1125,
450,
1024,
310,
278,
8783,
6943,
278,
2286,
29889,
13,
4706,
995,
313,
710,
1125,
450,
1024,
310,
278,
2286,
304,
443,
4058,
29889,
13,
1678,
16969,
29901,
13,
4706,
319,
995,
29889,
13,
1678,
9995,
13,
1678,
363,
14728,
297,
1948,
1839,
11918,
2033,
29901,
13,
4706,
565,
14728,
1839,
535,
1547,
2033,
1275,
6964,
29901,
13,
9651,
736,
14728,
29961,
1767,
29962,
13,
1678,
12020,
4408,
2392,
29898,
29888,
29908,
3782,
2944,
1476,
297,
426,
798,
1839,
11918,
2033,
29913,
411,
376,
13,
462,
1678,
285,
29908,
535,
1547,
353,
426,
535,
1547,
27195,
13,
13,
13,
1753,
443,
4058,
29918,
1272,
29898,
798,
1125,
13,
1678,
9995,
2525,
4058,
385,
4152,
1948,
310,
2787,
9157,
3450,
848,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1948,
313,
8977,
1125,
11438,
310,
2787,
9157,
3450,
848,
29889,
13,
1678,
16969,
29901,
13,
4706,
4234,
29892,
2286,
29892,
931,
29892,
995,
13,
1678,
9995,
13,
1678,
4234,
353,
443,
4058,
29918,
22640,
29898,
798,
29892,
525,
20779,
742,
525,
333,
1495,
13,
1678,
396,
11918,
353,
443,
4058,
29918,
22640,
29898,
798,
29892,
525,
19204,
742,
525,
1767,
1495,
13,
1678,
931,
353,
443,
4058,
29918,
22640,
29898,
798,
29892,
525,
2481,
742,
525,
1767,
1495,
13,
1678,
995,
353,
1948,
1839,
1767,
2033,
13,
1678,
736,
4234,
29892,
931,
29892,
995,
13,
13,
13,
1753,
679,
29918,
13509,
29918,
1272,
29898,
20897,
29892,
14430,
2129,
29892,
931,
543,
497,
29908,
1125,
13,
1678,
9995,
5647,
1461,
848,
363,
6790,
3651,
363,
599,
3625,
13,
1678,
10916,
29892,
297,
263,
6790,
1629,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3651,
313,
8977,
1125,
341,
20304,
310,
2286,
6660,
8783,
18999,
29889,
13,
4706,
14430,
2129,
313,
8977,
1125,
341,
20304,
310,
26616,
1599,
5941,
2286,
1024,
29889,
13,
4706,
931,
313,
710,
1125,
1714,
304,
12439,
931,
3785,
304,
2009,
29889,
13,
1678,
16969,
29901,
13,
4706,
4234,
29918,
1272,
313,
8977,
1125,
341,
20304,
310,
4234,
6660,
2286,
1024,
6660,
995,
13,
1678,
9995,
13,
1678,
396,
20504,
403,
1549,
20035,
13,
1678,
4234,
29918,
1272,
353,
2322,
8977,
29898,
8977,
29897,
29871,
396,
14013,
29901,
2322,
8977,
29898,
1761,
876,
13,
1678,
9049,
5085,
29918,
1761,
353,
679,
29918,
13509,
29918,
1272,
29918,
19290,
29898,
20897,
29922,
20897,
29892,
13,
462,
462,
3986,
14430,
2129,
29922,
2606,
2129,
29892,
13,
462,
462,
3986,
931,
29922,
2230,
29897,
13,
1678,
363,
9049,
5085,
297,
9049,
5085,
29918,
1761,
29901,
13,
4706,
903,
13509,
29918,
1272,
353,
4234,
29918,
1272,
29918,
14369,
29918,
3827,
29898,
1068,
19290,
29897,
13,
4706,
363,
4234,
29892,
848,
297,
903,
13509,
29918,
1272,
29889,
7076,
7295,
13,
9651,
363,
722,
29918,
978,
29892,
848,
29918,
798,
297,
848,
29889,
7076,
7295,
13,
18884,
4234,
29918,
1272,
29961,
13509,
3816,
1707,
29918,
978,
29962,
353,
848,
29918,
798,
13,
1678,
736,
4234,
29918,
1272,
13,
13,
13,
1753,
679,
29918,
13509,
29918,
1272,
29918,
19290,
29898,
20897,
29892,
14430,
2129,
29892,
931,
543,
497,
613,
639,
29918,
3488,
29922,
29896,
29900,
29900,
29900,
29900,
29892,
4236,
29918,
12292,
29922,
8516,
1125,
13,
1678,
9995,
5631,
403,
1432,
731,
310,
9049,
5085,
3734,
304,
1207,
2323,
7274,
29889,
13,
1678,
12037,
287,
304,
367,
1304,
411,
584,
5415,
18078,
13509,
29918,
1272,
29918,
14369,
29918,
3827,
29952,
297,
1797,
13,
1678,
304,
367,
9853,
287,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3651,
313,
8977,
1125,
341,
20304,
310,
2286,
6660,
8783,
18999,
29889,
13,
4706,
14430,
2129,
313,
8977,
1125,
341,
20304,
310,
2286,
1024,
14430,
2129,
29892,
304,
9801,
13,
462,
4706,
13747,
2286,
22006,
1546,
848,
16250,
29889,
13,
4706,
639,
29918,
3488,
313,
524,
1125,
9681,
310,
2582,
304,
736,
639,
2009,
29889,
13,
1678,
16969,
29901,
13,
4706,
9049,
5085,
29918,
1761,
313,
1761,
1125,
9049,
5085,
1051,
363,
584,
5415,
18078,
13509,
29918,
1272,
29918,
14369,
29918,
3827,
1412,
13,
1678,
9995,
13,
1678,
396,
20504,
403,
1549,
20035,
13,
1678,
9049,
5085,
29918,
1761,
353,
5159,
13,
1678,
1820,
29918,
2084,
353,
6796,
4993,
613,
376,
1272,
3108,
13,
1678,
363,
3652,
29892,
8974,
297,
3651,
29889,
7076,
7295,
13,
4706,
396,
450,
1024,
310,
263,
2183,
2286,
722,
583,
12059,
280,
368,
4822,
2999,
13,
4706,
396,
20035,
29892,
577,
591,
6597,
278,
2286,
1024,
278,
937,
931,
363,
13,
4706,
396,
5718,
3819,
4822,
20035,
29889,
13,
4706,
13995,
353,
14430,
2129,
29961,
13757,
29962,
13,
4706,
363,
2752,
297,
8974,
29901,
13,
9651,
25557,
353,
313,
29888,
29908,
29879,
2863,
19248,
4993,
6822,
13509,
29914,
497,
12975,
13,
462,
418,
285,
29908,
13757,
19248,
13757,
6822,
2230,
19248,
2230,
6822,
1272,
1159,
13,
9651,
302,
29918,
12292,
353,
8147,
29918,
4537,
29918,
974,
29918,
2754,
29918,
12292,
29898,
2146,
600,
861,
29922,
2146,
600,
861,
29892,
13,
462,
462,
462,
1678,
639,
29918,
3488,
29922,
546,
29918,
3488,
29892,
13,
462,
462,
462,
1678,
848,
29918,
1989,
29918,
2084,
29922,
1989,
29918,
2084,
29897,
13,
9651,
363,
1813,
297,
3464,
29898,
29896,
29892,
302,
29918,
12292,
29974,
29896,
1125,
13,
18884,
565,
4236,
29918,
12292,
338,
451,
6213,
322,
1813,
1405,
4236,
29918,
12292,
29901,
13,
462,
1678,
2867,
13,
18884,
4128,
353,
9657,
29898,
19973,
29922,
19973,
29892,
13,
462,
462,
29871,
25557,
29922,
2146,
600,
861,
29892,
937,
29918,
3488,
29922,
3488,
29892,
13,
462,
462,
29871,
1833,
29918,
3488,
29922,
3488,
29892,
639,
29918,
3488,
29922,
546,
29918,
3488,
29892,
13,
462,
462,
29871,
848,
29918,
1989,
29918,
2084,
29922,
1989,
29918,
2084,
29897,
13,
18884,
9049,
5085,
29918,
1761,
29889,
4397,
29898,
16744,
29897,
13,
1678,
736,
9049,
5085,
29918,
1761,
13,
13,
13,
1753,
4234,
29918,
1272,
29918,
14369,
29918,
3827,
29898,
19973,
29892,
3579,
19290,
1125,
13,
1678,
9995,
5647,
1461,
848,
363,
599,
10916,
773,
9049,
5085,
5759,
491,
13,
1678,
584,
5415,
18078,
657,
29918,
13509,
29918,
1272,
29918,
19290,
1412,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
9049,
5085,
313,
8977,
1125,
530,
2944,
4133,
491,
584,
5415,
18078,
657,
29918,
13509,
29918,
1272,
29918,
19290,
1412,
13,
1678,
16969,
29901,
13,
4706,
4234,
29918,
1272,
313,
8977,
1125,
341,
20304,
310,
4234,
6660,
2286,
1024,
6660,
995,
13,
1678,
9995,
13,
1678,
4234,
29918,
1272,
353,
2322,
8977,
29898,
2892,
29901,
2322,
8977,
29898,
1761,
876,
13,
1678,
2309,
29918,
29886,
8149,
353,
731,
580,
13,
1678,
848,
353,
3186,
9157,
29918,
1272,
29918,
19207,
29898,
1068,
19290,
29897,
13,
1678,
363,
4234,
29892,
931,
29892,
995,
297,
2910,
29898,
348,
4058,
29918,
1272,
29892,
848,
1125,
13,
4706,
565,
995,
338,
6213,
29901,
29871,
396,
4750,
292,
848,
363,
445,
4234,
13,
9651,
6773,
13,
4706,
282,
1989,
353,
313,
13509,
29892,
931,
29897,
13,
4706,
565,
282,
1989,
297,
2309,
29918,
29886,
8149,
29901,
29871,
396,
838,
2040,
2309,
445,
4234,
13,
9651,
6773,
13,
4706,
2309,
29918,
29886,
8149,
29889,
1202,
29898,
29886,
1989,
29897,
13,
4706,
716,
29918,
798,
353,
8853,
1767,
1115,
995,
29892,
376,
2230,
1115,
931,
29913,
13,
4706,
4234,
29918,
1272,
29961,
13509,
3816,
19973,
1822,
4397,
29898,
1482,
29918,
798,
29897,
13,
1678,
736,
4234,
29918,
1272,
13,
13,
13,
29937,
822,
1652,
8606,
29918,
13509,
29918,
1272,
29898,
13509,
29918,
1272,
29892,
4234,
29918,
19635,
1125,
13,
29937,
268,
9995,
15836,
479,
322,
1652,
8606,
4234,
848,
322,
15562,
4208,
29889,
13,
13,
29937,
268,
826,
3174,
29901,
13,
29937,
308,
4234,
29918,
1272,
313,
8977,
1125,
341,
20304,
310,
4234,
6660,
2286,
1024,
6660,
995,
13,
29937,
308,
4234,
29918,
19635,
313,
1761,
1125,
2391,
310,
4234,
15562,
29889,
13,
29937,
268,
16969,
29901,
13,
29937,
308,
12151,
29918,
13509,
29918,
1272,
313,
1761,
1125,
2379,
8606,
287,
4234,
848,
322,
15562,
29889,
13,
29937,
268,
9995,
13,
29937,
268,
12151,
29918,
13509,
29918,
1272,
353,
518,
8977,
29898,
1068,
13509,
29918,
1272,
29961,
19635,
1839,
333,
2033,
1402,
3579,
19635,
29897,
13,
29937,
462,
3986,
363,
15562,
297,
4234,
29918,
19635,
13,
29937,
462,
3986,
565,
15562,
1839,
333,
2033,
297,
4234,
29918,
1272,
29962,
13,
29937,
268,
736,
12151,
29918,
13509,
29918,
1272,
13,
13,
13,
1753,
6523,
29918,
11918,
29918,
978,
29898,
13757,
1125,
13,
1678,
9995,
4205,
11911,
2286,
2983,
515,
1269,
3652,
518,
12759,
1361,
775,
1822,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3652,
313,
710,
1125,
450,
3273,
1361,
775,
363,
278,
2286,
1024,
29892,
13,
462,
418,
5034,
304,
2787,
9157,
3450,
29889,
13,
1678,
16969,
29901,
13,
4706,
13995,
313,
710,
1125,
450,
2286,
1024,
363,
278,
2183,
3652,
29889,
13,
1678,
9995,
13,
1678,
17117,
848,
353,
3186,
9157,
29918,
3827,
29898,
29888,
29908,
264,
29914,
513,
20485,
19248,
13757,
17671,
1813,
29922,
29896,
29897,
13,
1678,
13995,
353,
848,
29961,
29900,
29962,
3366,
978,
3108,
13,
1678,
736,
13995,
13,
13,
13,
1753,
5941,
29918,
11918,
29918,
978,
29898,
1707,
29918,
978,
1125,
13,
1678,
9995,
29907,
14044,
263,
2323,
2286,
1024,
7960,
363,
6535,
8635,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
722,
29918,
978,
313,
710,
1125,
28736,
1024,
304,
367,
5941,
287,
13,
1678,
16969,
29901,
13,
4706,
716,
29918,
1707,
29918,
978,
313,
710,
1125,
319,
9254,
752,
492,
424,
2286,
1024,
29889,
13,
1678,
9995,
13,
13,
1678,
396,
27723,
29892,
5191,
14210,
742,
3349,
1661,
29899,
284,
16711,
6762,
322,
671,
22868,
29915,
13,
1678,
716,
29918,
1707,
29918,
978,
353,
722,
29918,
978,
29889,
13609,
2141,
6506,
11702,
613,
376,
6739,
1159,
13,
1678,
716,
29918,
1707,
29918,
978,
353,
337,
29889,
1491,
877,
22896,
29900,
29899,
29929,
29874,
29899,
25265,
29899,
29999,
10062,
742,
525,
13420,
716,
29918,
1707,
29918,
978,
29897,
13,
1678,
716,
29918,
1707,
29918,
978,
353,
716,
29918,
1707,
29918,
978,
29889,
29880,
17010,
2141,
29878,
17010,
2141,
6506,
703,
9162,
11119,
1159,
13,
1678,
396,
3599,
1295,
3598,
3273,
264,
515,
7256,
2931,
2745,
3109,
1135,
29871,
29953,
29946,
22524,
1472,
13,
1678,
396,
313,
1366,
338,
278,
2322,
9254,
4046,
29897,
13,
1678,
396,
14253,
2931,
756,
1063,
10434,
304,
2758,
777,
1303,
3097,
29889,
13,
1678,
1550,
7431,
29898,
1482,
29918,
1707,
29918,
978,
29897,
1405,
29871,
29953,
29946,
29901,
13,
4706,
396,
10987,
278,
27217,
1840,
13,
4706,
27217,
29918,
8489,
353,
5124,
13,
4706,
363,
1840,
297,
716,
29918,
1707,
29918,
978,
29889,
5451,
703,
27508,
1125,
13,
9651,
565,
7431,
29898,
8489,
29897,
5277,
7431,
29898,
5426,
342,
29918,
8489,
1125,
13,
18884,
6773,
13,
9651,
27217,
29918,
8489,
353,
1840,
13,
4706,
396,
15154,
278,
7256,
2931,
515,
278,
27217,
1840,
13,
4706,
7256,
353,
7431,
29898,
5426,
342,
29918,
8489,
29897,
448,
29871,
29896,
13,
4706,
716,
29918,
8489,
353,
27217,
29918,
8489,
7503,
17662,
29962,
718,
27217,
29918,
8489,
29961,
17662,
29974,
29896,
17531,
13,
4706,
716,
29918,
1707,
29918,
978,
353,
716,
29918,
1707,
29918,
978,
29889,
6506,
29898,
5426,
342,
29918,
8489,
29892,
716,
29918,
8489,
29897,
13,
1678,
736,
716,
29918,
1707,
29918,
978,
13,
13,
13,
13,
1753,
5941,
29918,
11918,
29918,
7039,
29898,
20620,
29918,
13509,
29918,
1272,
1125,
13,
1678,
9995,
29907,
14044,
2286,
2983,
7960,
363,
6535,
8635,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
12151,
29918,
13509,
29918,
1272,
313,
1761,
1125,
2379,
8606,
287,
4234,
848,
29889,
13,
1678,
16969,
29901,
13,
4706,
714,
29918,
1272,
313,
1761,
1125,
19491,
408,
1881,
848,
29892,
411,
9254,
752,
492,
424,
1746,
2983,
29889,
13,
1678,
9995,
13,
1678,
714,
29918,
1272,
353,
5159,
13,
1678,
363,
1948,
297,
12151,
29918,
13509,
29918,
1272,
29901,
13,
4706,
716,
29918,
798,
353,
6571,
13,
4706,
363,
1820,
29892,
325,
297,
1948,
29889,
7076,
7295,
13,
9651,
396,
9333,
5941,
2983,
6943,
8162,
13,
9651,
565,
376,
376,
451,
297,
1820,
29901,
13,
18884,
716,
29918,
798,
29961,
1989,
29962,
353,
325,
13,
18884,
6773,
13,
9651,
716,
29918,
1989,
353,
5941,
29918,
11918,
29918,
978,
29898,
1989,
29897,
13,
9651,
716,
29918,
798,
29961,
1482,
29918,
1989,
29962,
353,
325,
13,
4706,
714,
29918,
1272,
29889,
4397,
29898,
1482,
29918,
798,
29897,
13,
1678,
736,
714,
29918,
1272,
13,
13,
13,
1753,
338,
29918,
12313,
29918,
339,
4254,
29898,
29916,
29892,
4319,
29918,
19252,
1125,
13,
1678,
736,
738,
29898,
29939,
297,
921,
363,
3855,
297,
4319,
29918,
19252,
29897,
13,
13,
13,
1753,
1652,
8606,
29918,
13509,
29918,
1272,
29898,
13509,
29918,
1272,
29892,
4234,
29918,
19635,
29892,
13,
462,
308,
4319,
29918,
19252,
29922,
703,
29984,
29896,
613,
376,
29984,
29941,
613,
376,
29984,
29946,
5783,
29901,
13,
1678,
396,
8565,
957,
278,
1629,
515,
278,
931,
2286,
29889,
13,
1678,
396,
1222,
6021,
304,
367,
297,
278,
21971,
376,
19165,
29908,
322,
376,
19165,
660,
29990,
29908,
13,
1678,
4234,
29918,
19635,
353,
426,
19635,
3366,
333,
3108,
29901,
15562,
13,
462,
4706,
363,
15562,
297,
4234,
29918,
19635,
29913,
13,
1678,
12558,
29918,
20620,
29918,
1272,
353,
5159,
13,
1678,
363,
338,
29877,
29941,
29892,
903,
297,
4234,
29918,
19635,
29889,
7076,
7295,
13,
4706,
363,
2286,
29892,
848,
297,
4234,
29918,
1272,
29961,
10718,
29941,
1822,
7076,
7295,
13,
9651,
363,
1948,
297,
848,
29901,
13,
18884,
1629,
353,
337,
29889,
2886,
497,
29898,
29878,
29915,
1194,
29881,
29912,
29946,
1800,
742,
1948,
3366,
2230,
20068,
29961,
29900,
29962,
13,
18884,
1652,
2620,
29918,
798,
353,
9657,
29898,
13509,
29922,
10718,
29941,
29892,
2286,
29922,
11918,
29892,
13,
462,
462,
259,
1629,
29922,
6360,
29892,
3579,
798,
29897,
13,
18884,
12558,
29918,
20620,
29918,
1272,
29889,
4397,
29898,
1579,
2620,
29918,
798,
29897,
13,
13,
1678,
396,
6431,
491,
4234,
322,
1629,
322,
3349,
439,
13868,
591,
1016,
29915,
29873,
864,
29889,
13,
1678,
1407,
29918,
20620,
29918,
1272,
353,
5159,
13,
1678,
4489,
353,
10518,
29889,
17271,
29898,
29888,
1466,
368,
29918,
20620,
29918,
1272,
29897,
13,
1678,
363,
313,
13509,
29892,
1629,
511,
903,
2176,
297,
4489,
29889,
27789,
29898,
3366,
13509,
613,
376,
6360,
3108,
1125,
13,
4706,
396,
13355,
1598,
439,
13868,
591,
1016,
29915,
29873,
864,
13,
4706,
4195,
353,
903,
2176,
3366,
2230,
16862,
7302,
29898,
275,
29918,
12313,
29918,
339,
4254,
29892,
13,
462,
462,
418,
4319,
29918,
19252,
29922,
12313,
29918,
19252,
29897,
13,
4706,
565,
313,
30022,
16122,
467,
2083,
580,
1275,
29871,
29900,
29901,
13,
9651,
6773,
13,
4706,
1948,
353,
426,
29878,
3366,
11918,
3108,
29901,
364,
3366,
1767,
3108,
13,
1669,
363,
17117,
364,
297,
903,
2176,
29889,
2029,
29961,
30022,
16122,
1822,
1524,
5727,
28296,
13,
4706,
1948,
353,
9657,
29898,
6360,
29922,
6360,
29892,
3579,
798,
29892,
3579,
13509,
29918,
19635,
29961,
13509,
2314,
13,
4706,
1407,
29918,
20620,
29918,
1272,
29889,
4397,
29898,
798,
29897,
13,
13,
1678,
736,
1407,
29918,
20620,
29918,
1272,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
13,
1678,
396,
11662,
15149,
8079,
6093,
18322,
2208,
9806,
4214,
2672,
319,
317,
4214,
1307,
365,
3120,
29954,
29902,
323,
3289,
29968,
13,
1678,
3651,
353,
679,
29918,
20897,
29918,
1609,
29918,
401,
29898,
3366,
5550,
29889,
29934,
4574,
29889,
29911,
2891,
29931,
29889,
29999,
29903,
613,
376,
5550,
29889,
4574,
29933,
29889,
29911,
2891,
29931,
29889,
1177,
29889,
29999,
29903,
613,
13,
462,
462,
539,
376,
5550,
29889,
29925,
4590,
29889,
11191,
2797,
613,
376,
5550,
29889,
29925,
4590,
29889,
29911,
2891,
29931,
613,
13,
462,
462,
539,
376,
5550,
29889,
29928,
29979,
29940,
29889,
1307,
29900,
29900,
29889,
1177,
613,
376,
5550,
29889,
29928,
29979,
29940,
29889,
7833,
13079,
29889,
1177,
613,
13,
462,
462,
539,
376,
29933,
1718,
29889,
6632,
3352,
29889,
29906,
29945,
4897,
29889,
29999,
29903,
613,
13,
462,
462,
539,
376,
29933,
1718,
29889,
4945,
29889,
29907,
3580,
29911,
29889,
29906,
29945,
4897,
29889,
29999,
29903,
613,
13,
462,
462,
539,
376,
29940,
29979,
29954,
11191,
29924,
29968,
3557,
8132,
29968,
29928,
613,
13,
462,
462,
539,
376,
5425,
29889,
13152,
29963,
29889,
3521,
19127,
613,
376,
5425,
29889,
13152,
29963,
29889,
29954,
1177,
29902,
20068,
13,
1678,
14430,
2129,
353,
426,
13757,
29901,
6523,
29918,
11918,
29918,
978,
29898,
13757,
29897,
13,
1669,
363,
3652,
29892,
8974,
297,
3651,
29889,
7076,
28296,
13,
13,
1678,
396,
313,
5746,
4741,
7982,
3446,
3235,
6732,
29923,
29897,
13,
1678,
396,
4234,
29918,
1272,
353,
679,
29918,
13509,
29918,
1272,
29898,
20897,
29892,
14430,
2129,
29897,
13,
13,
1678,
396,
14445,
6156,
11662,
3446,
3235,
13,
1678,
9049,
5085,
29918,
1761,
353,
679,
29918,
13509,
29918,
1272,
29918,
19290,
29898,
20897,
29922,
20897,
29892,
13,
462,
462,
3986,
14430,
2129,
29922,
2606,
2129,
29892,
13,
462,
462,
3986,
4236,
29918,
12292,
29922,
29906,
29897,
29871,
396,
529,
1360,
4321,
4464,
13,
13,
1678,
396,
8183,
350,
14789,
29892,
15842,
5868,
3904,
17557,
8079,
476,
29956,
1718,
10749,
13,
1678,
4234,
29918,
1272,
353,
2322,
8977,
29898,
8977,
29897,
13,
1678,
363,
9049,
5085,
297,
9049,
5085,
29918,
1761,
29901,
13,
4706,
903,
13509,
29918,
1272,
353,
4234,
29918,
1272,
29918,
14369,
29918,
3827,
29898,
1068,
19290,
29897,
13,
4706,
363,
4234,
29892,
848,
297,
903,
13509,
29918,
1272,
29889,
7076,
7295,
13,
9651,
363,
722,
29918,
978,
29892,
848,
29918,
798,
297,
848,
29889,
7076,
7295,
13,
18884,
4234,
29918,
1272,
29961,
13509,
3816,
1707,
29918,
978,
29962,
353,
848,
29918,
798,
13,
13,
13,
1678,
396,
8183,
319,
383,
1177,
1964,
323,
3289,
29968,
12354,
29903,
6093,
319,
8456,
12064,
390,
2890,
8647,
29903,
6770,
4810,
3904,
5659,
29979,
13,
1678,
396,
5300,
399,
29934,
1806,
2890,
7495,
27640,
27982,
13,
1678,
4234,
29918,
19635,
353,
679,
29918,
11526,
9157,
29918,
10314,
703,
2798,
2722,
1159,
13,
1678,
12151,
29918,
13509,
29918,
1272,
353,
1652,
8606,
29918,
13509,
29918,
1272,
29898,
13509,
29918,
1272,
29892,
4234,
29918,
19635,
29897,
13,
1678,
5941,
287,
29918,
1272,
353,
5941,
29918,
11918,
29918,
7039,
29898,
20620,
29918,
13509,
29918,
1272,
29897,
13,
13,
1678,
396,
317,
4330,
29925,
23844,
4945,
349,
2692,
29903,
6093,
1660,
2672,
17956,
13,
2
] |
src/ctc/protocols/fei_utils/analytics/metric_groups/buyback_metrics.py | fei-protocol/checkthechain | 94 | 50674 | from __future__ import annotations
import typing
from ctc import spec
from ctc.protocols import balancer_utils
from .. import analytics_spec
async def async_compute_buybacks(
blocks: list[int], verbose: bool = False
) -> analytics_spec.MetricGroup:
return {
'name': 'Buybacks',
'metrics': {
'buybacks_usd': (await async_compute_tribe_buybacks_usd(blocks)),
},
}
async def async_compute_tribe_buybacks_usd(
blocks: list[int], swaps: typing.Optional[spec.DataFrame] = None
) -> analytics_spec.MetricData:
from ctc.toolbox import pd_utils
# load swaps
if swaps is None:
swaps = await balancer_utils.async_get_pool_swaps(
pool_address='0xc1382fe6e17bcdbc3d35f73f5317fbf261ebeecd'
)
swaps = typing.cast(
spec.DataFrame,
swaps.droplevel('transaction_index').droplevel('log_index'),
)
# filter tribe buys
fei = '0x956f47f50a910163d8bf957cf5846d573e7f87ca'
tribe_buys: typing.Any = swaps[swaps['arg__tokenOut'] == fei] # type: ignore
tribe_buys = tribe_buys['arg__amountOut'].map(float) / 1e18
cummulative_tribe_buys = tribe_buys.cumsum()
# cummulative_tribe_buys = evm.interpolate_block_series(
# start_block=min(blocks),
# pre_fill_value=0,
# series=cummulative_tribe_buys,
# end_block=max(blocks),
# )
cummulative_tribe_buys = pd_utils.interpolate_series(
series=cummulative_tribe_buys,
start_index=min(blocks),
end_index=max(blocks),
pre_fill_value=0,
)
# filter tribe sells
tribe_sells_df = swaps[swaps['arg__tokenIn'] == fei] # type: ignore
if len(tribe_sells_df) > 0:
tribe_sells = tribe_sells_df['arg__amountIn'].map(float) / 1e18
cummulative_tribe_sells = tribe_sells.cumsum()
# cummulative_tribe_sells = evm.interpolate_block_series(
# start_block=min(blocks),
# pre_fill_value=0,
# series=cummulative_tribe_sells,
# end_block=max(blocks),
# )
cummulative_tribe_sells = pd_utils.interpolate_series(
series=cummulative_tribe_sells,
start_index=min(blocks),
end_index=max(blocks),
pre_fill_value=0,
)
net_tribe_buys = cummulative_tribe_buys - cummulative_tribe_sells
else:
net_tribe_buys = cummulative_tribe_buys
return {
'name': 'Buybacks USD',
'values': [net_tribe_buys[block] for block in blocks],
'units': 'FEI',
}
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
5215,
19229,
13,
13,
3166,
274,
14246,
1053,
1580,
13,
3166,
274,
14246,
29889,
20464,
29879,
1053,
6411,
25856,
29918,
13239,
13,
13,
3166,
6317,
1053,
16114,
1199,
29918,
6550,
13,
13,
13,
12674,
822,
7465,
29918,
26017,
29918,
2423,
29891,
1627,
29879,
29898,
13,
1678,
10930,
29901,
1051,
29961,
524,
1402,
26952,
29901,
6120,
353,
7700,
13,
29897,
1599,
16114,
1199,
29918,
6550,
29889,
10095,
2200,
4782,
29901,
13,
13,
1678,
736,
426,
13,
4706,
525,
978,
2396,
525,
3727,
29891,
1627,
29879,
742,
13,
4706,
525,
2527,
10817,
2396,
426,
13,
9651,
525,
2423,
29891,
1627,
29879,
29918,
375,
29881,
2396,
313,
20675,
7465,
29918,
26017,
29918,
3626,
915,
29918,
2423,
29891,
1627,
29879,
29918,
375,
29881,
29898,
1271,
29879,
8243,
13,
4706,
2981,
13,
1678,
500,
13,
13,
13,
12674,
822,
7465,
29918,
26017,
29918,
3626,
915,
29918,
2423,
29891,
1627,
29879,
29918,
375,
29881,
29898,
13,
1678,
10930,
29901,
1051,
29961,
524,
1402,
2381,
2547,
29901,
19229,
29889,
27636,
29961,
6550,
29889,
17271,
29962,
353,
6213,
13,
29897,
1599,
16114,
1199,
29918,
6550,
29889,
10095,
2200,
1469,
29901,
13,
1678,
515,
274,
14246,
29889,
10154,
1884,
1053,
10518,
29918,
13239,
13,
13,
1678,
396,
2254,
2381,
2547,
13,
1678,
565,
2381,
2547,
338,
6213,
29901,
13,
4706,
2381,
2547,
353,
7272,
6411,
25856,
29918,
13239,
29889,
12674,
29918,
657,
29918,
10109,
29918,
2774,
2547,
29898,
13,
9651,
11565,
29918,
7328,
2433,
29900,
21791,
29896,
29941,
29947,
29906,
1725,
29953,
29872,
29896,
29955,
29890,
2252,
12328,
29941,
29881,
29941,
29945,
29888,
29955,
29941,
29888,
29945,
29941,
29896,
29955,
29888,
1635,
29906,
29953,
29896,
774,
29872,
687,
29881,
29915,
13,
4706,
1723,
13,
1678,
2381,
2547,
353,
19229,
29889,
4384,
29898,
13,
4706,
1580,
29889,
17271,
29892,
13,
4706,
2381,
2547,
29889,
26419,
552,
955,
877,
20736,
29918,
2248,
2824,
26419,
552,
955,
877,
1188,
29918,
2248,
5477,
13,
1678,
1723,
13,
13,
1678,
396,
4175,
29563,
1321,
952,
13,
1678,
1238,
29875,
353,
525,
29900,
29916,
29929,
29945,
29953,
29888,
29946,
29955,
29888,
29945,
29900,
29874,
29929,
29896,
29900,
29896,
29953,
29941,
29881,
29947,
1635,
29929,
29945,
29955,
6854,
29945,
29947,
29946,
29953,
29881,
29945,
29955,
29941,
29872,
29955,
29888,
29947,
29955,
1113,
29915,
13,
1678,
29563,
29918,
2423,
952,
29901,
19229,
29889,
10773,
353,
2381,
2547,
29961,
2774,
2547,
1839,
1191,
1649,
6979,
3744,
2033,
1275,
1238,
29875,
29962,
29871,
396,
1134,
29901,
11455,
13,
1678,
29563,
29918,
2423,
952,
353,
29563,
29918,
2423,
952,
1839,
1191,
1649,
14506,
3744,
13359,
1958,
29898,
7411,
29897,
847,
29871,
29896,
29872,
29896,
29947,
13,
1678,
13299,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
353,
29563,
29918,
2423,
952,
29889,
29883,
398,
2083,
580,
13,
1678,
396,
13299,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
353,
3415,
29885,
29889,
1639,
3733,
403,
29918,
1271,
29918,
13757,
29898,
13,
1678,
396,
268,
1369,
29918,
1271,
29922,
1195,
29898,
1271,
29879,
511,
13,
1678,
396,
268,
758,
29918,
5589,
29918,
1767,
29922,
29900,
29892,
13,
1678,
396,
268,
3652,
29922,
29883,
398,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
29892,
13,
1678,
396,
268,
1095,
29918,
1271,
29922,
3317,
29898,
1271,
29879,
511,
13,
1678,
396,
1723,
13,
1678,
13299,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
353,
10518,
29918,
13239,
29889,
1639,
3733,
403,
29918,
13757,
29898,
13,
4706,
3652,
29922,
29883,
398,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
29892,
13,
4706,
1369,
29918,
2248,
29922,
1195,
29898,
1271,
29879,
511,
13,
4706,
1095,
29918,
2248,
29922,
3317,
29898,
1271,
29879,
511,
13,
4706,
758,
29918,
5589,
29918,
1767,
29922,
29900,
29892,
13,
1678,
1723,
13,
13,
1678,
396,
4175,
29563,
269,
10071,
13,
1678,
29563,
29918,
29879,
10071,
29918,
2176,
353,
2381,
2547,
29961,
2774,
2547,
1839,
1191,
1649,
6979,
797,
2033,
1275,
1238,
29875,
29962,
29871,
396,
1134,
29901,
11455,
13,
1678,
565,
7431,
29898,
3626,
915,
29918,
29879,
10071,
29918,
2176,
29897,
1405,
29871,
29900,
29901,
13,
4706,
29563,
29918,
29879,
10071,
353,
29563,
29918,
29879,
10071,
29918,
2176,
1839,
1191,
1649,
14506,
797,
13359,
1958,
29898,
7411,
29897,
847,
29871,
29896,
29872,
29896,
29947,
13,
4706,
13299,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
353,
29563,
29918,
29879,
10071,
29889,
29883,
398,
2083,
580,
13,
4706,
396,
13299,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
353,
3415,
29885,
29889,
1639,
3733,
403,
29918,
1271,
29918,
13757,
29898,
13,
4706,
396,
268,
1369,
29918,
1271,
29922,
1195,
29898,
1271,
29879,
511,
13,
4706,
396,
268,
758,
29918,
5589,
29918,
1767,
29922,
29900,
29892,
13,
4706,
396,
268,
3652,
29922,
29883,
398,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
29892,
13,
4706,
396,
268,
1095,
29918,
1271,
29922,
3317,
29898,
1271,
29879,
511,
13,
4706,
396,
1723,
13,
4706,
13299,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
353,
10518,
29918,
13239,
29889,
1639,
3733,
403,
29918,
13757,
29898,
13,
9651,
3652,
29922,
29883,
398,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
29892,
13,
9651,
1369,
29918,
2248,
29922,
1195,
29898,
1271,
29879,
511,
13,
9651,
1095,
29918,
2248,
29922,
3317,
29898,
1271,
29879,
511,
13,
9651,
758,
29918,
5589,
29918,
1767,
29922,
29900,
29892,
13,
4706,
1723,
13,
13,
4706,
7787,
29918,
3626,
915,
29918,
2423,
952,
353,
13299,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
448,
13299,
16109,
1230,
29918,
3626,
915,
29918,
29879,
10071,
13,
13,
1678,
1683,
29901,
13,
4706,
7787,
29918,
3626,
915,
29918,
2423,
952,
353,
13299,
16109,
1230,
29918,
3626,
915,
29918,
2423,
952,
13,
13,
1678,
736,
426,
13,
4706,
525,
978,
2396,
525,
3727,
29891,
1627,
29879,
3148,
29928,
742,
13,
4706,
525,
5975,
2396,
518,
1212,
29918,
3626,
915,
29918,
2423,
952,
29961,
1271,
29962,
363,
2908,
297,
10930,
1402,
13,
4706,
525,
348,
1169,
2396,
525,
16359,
29902,
742,
13,
1678,
500,
13,
13,
2
] |
huTools/http/engine_httplib2.py | gadventures/huTools | 0 | 72186 | #!/usr/bin/env python
# encoding: utf-8
"""
engine_httplib2.py implements httplib2 based queries for huTools.http
Created by <NAME> on 2010-10-24.
Copyright (c) 2010, 2011 HUDORA. All rights reserved.
"""
from __future__ import unicode_literals
from builtins import object
import socket
import huTools.http.tools
from huTools.http import exceptions
_http = None
def request(url, method, content, headers, timeout=50, caching=None):
"""Does a HTTP Request via httplib2."""
global _http
if not _http:
import huTools.http._httplib2
_http = huTools.http._httplib2.Http(timeout=timeout)
headers['User-Agent'] = headers.get('User-Agent', '') + ' (httplib2)'
_http.clear_credentials()
_http.forward_authorization_headers = True
# Do not re-use the global Http object after a timeout.
# To achieve this, it is set to None.
try:
resp, content = _http.request(url, method, content, headers=headers)
except socket.timeout:
_http = None
raise exceptions.Timeout
replyheaders = {}
replyheaders.update(resp)
return int(resp.status), replyheaders, content
class AsyncHttpResult(object):
"""Syncronous emulation for plain Python.
See `engine_appengine.AsyncHttpResult()` for the thinking behind it.
`huTools.http.fetch_async()` is a somewhat more high-level interface.
"""
def __init__(self, caching=None):
self.url, self.method, self.content, self.headers, self.timeout = None, None, None, None, None
self._result = None
def fetch(self, url, content='', method='GET', credentials=None, headers=None, multipart=False, ua='',
timeout=25, returnhandler=lambda x, y, z: (x, y, z)):
"""Save parameters but delay request execution until get_result() is called."""
self.url, self.method, self.content, self.headers, self.timeout, _dummy = \
huTools.http.tools.prepare_headers(url, content, method, credentials, headers, multipart,
ua, timeout)
self.returnhandler = returnhandler
def get_result(self):
"""Execute request pass it to returnhandler and return."""
# Cache the result because we mght get called more than once
if not self._result:
self._result = self.returnhandler(*request(self.url, self.method, self.content,
self.headers, self.timeout))
return self._result
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
8025,
29901,
23616,
29899,
29947,
13,
15945,
29908,
13,
10599,
29918,
1124,
1982,
29906,
29889,
2272,
10703,
1732,
1982,
29906,
2729,
9365,
363,
22888,
24183,
29889,
1124,
13,
13,
20399,
491,
529,
5813,
29958,
373,
29871,
29906,
29900,
29896,
29900,
29899,
29896,
29900,
29899,
29906,
29946,
29889,
13,
11882,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29900,
29892,
29871,
29906,
29900,
29896,
29896,
379,
15789,
1955,
29909,
29889,
2178,
10462,
21676,
29889,
13,
15945,
29908,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
4240,
1144,
1053,
1203,
13,
5215,
9909,
13,
5215,
22888,
24183,
29889,
1124,
29889,
8504,
13,
3166,
22888,
24183,
29889,
1124,
1053,
15283,
13,
29918,
1124,
353,
6213,
13,
13,
13,
1753,
2009,
29898,
2271,
29892,
1158,
29892,
2793,
29892,
9066,
29892,
11815,
29922,
29945,
29900,
29892,
22488,
29922,
8516,
1125,
13,
1678,
9995,
25125,
263,
7331,
10729,
3025,
1732,
1982,
29906,
1213,
15945,
13,
1678,
5534,
903,
1124,
13,
1678,
565,
451,
903,
1124,
29901,
13,
4706,
1053,
22888,
24183,
29889,
1124,
3032,
1124,
1982,
29906,
13,
4706,
903,
1124,
353,
22888,
24183,
29889,
1124,
3032,
1124,
1982,
29906,
29889,
5506,
29898,
15619,
29922,
15619,
29897,
13,
13,
1678,
9066,
1839,
2659,
29899,
19661,
2033,
353,
9066,
29889,
657,
877,
2659,
29899,
19661,
742,
27255,
718,
525,
313,
1124,
1982,
29906,
16029,
13,
1678,
903,
1124,
29889,
8551,
29918,
11944,
9409,
580,
13,
1678,
903,
1124,
29889,
11333,
29918,
8921,
2133,
29918,
13662,
353,
5852,
13,
1678,
396,
1938,
451,
337,
29899,
1509,
278,
5534,
9056,
1203,
1156,
263,
11815,
29889,
13,
1678,
396,
1763,
6176,
445,
29892,
372,
338,
731,
304,
6213,
29889,
13,
1678,
1018,
29901,
13,
4706,
4613,
29892,
2793,
353,
903,
1124,
29889,
3827,
29898,
2271,
29892,
1158,
29892,
2793,
29892,
9066,
29922,
13662,
29897,
13,
1678,
5174,
9909,
29889,
15619,
29901,
13,
4706,
903,
1124,
353,
6213,
13,
4706,
12020,
15283,
29889,
10851,
13,
13,
1678,
8908,
13662,
353,
6571,
13,
1678,
8908,
13662,
29889,
5504,
29898,
13713,
29897,
13,
1678,
736,
938,
29898,
13713,
29889,
4882,
511,
8908,
13662,
29892,
2793,
13,
13,
13,
1990,
20688,
5506,
3591,
29898,
3318,
1125,
13,
1678,
9995,
21077,
1617,
681,
953,
2785,
363,
8656,
5132,
29889,
13,
13,
1678,
2823,
421,
10599,
29918,
932,
10599,
29889,
8123,
5506,
3591,
2555,
363,
278,
7291,
5742,
372,
29889,
13,
1678,
421,
6905,
24183,
29889,
1124,
29889,
9155,
29918,
12674,
2555,
338,
263,
10579,
901,
1880,
29899,
5563,
5067,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
22488,
29922,
8516,
1125,
13,
4706,
1583,
29889,
2271,
29892,
1583,
29889,
5696,
29892,
1583,
29889,
3051,
29892,
1583,
29889,
13662,
29892,
1583,
29889,
15619,
353,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
13,
4706,
1583,
3032,
2914,
353,
6213,
13,
13,
1678,
822,
6699,
29898,
1311,
29892,
3142,
29892,
2793,
2433,
742,
1158,
2433,
7194,
742,
16140,
29922,
8516,
29892,
9066,
29922,
8516,
29892,
6674,
442,
29922,
8824,
29892,
318,
29874,
2433,
742,
13,
795,
11815,
29922,
29906,
29945,
29892,
736,
13789,
29922,
2892,
921,
29892,
343,
29892,
503,
29901,
313,
29916,
29892,
343,
29892,
503,
22164,
13,
4706,
9995,
11371,
4128,
541,
9055,
2009,
8225,
2745,
679,
29918,
2914,
580,
338,
2000,
1213,
15945,
13,
4706,
1583,
29889,
2271,
29892,
1583,
29889,
5696,
29892,
1583,
29889,
3051,
29892,
1583,
29889,
13662,
29892,
1583,
29889,
15619,
29892,
903,
29881,
11770,
353,
320,
13,
9651,
22888,
24183,
29889,
1124,
29889,
8504,
29889,
19125,
29918,
13662,
29898,
2271,
29892,
2793,
29892,
1158,
29892,
16140,
29892,
9066,
29892,
6674,
442,
29892,
13,
462,
462,
1669,
318,
29874,
29892,
11815,
29897,
13,
4706,
1583,
29889,
2457,
13789,
353,
736,
13789,
13,
13,
1678,
822,
679,
29918,
2914,
29898,
1311,
1125,
13,
4706,
9995,
12296,
2009,
1209,
372,
304,
736,
13789,
322,
736,
1213,
15945,
13,
4706,
396,
28540,
278,
1121,
1363,
591,
286,
29887,
400,
679,
2000,
901,
1135,
2748,
13,
4706,
565,
451,
1583,
3032,
2914,
29901,
13,
9651,
1583,
3032,
2914,
353,
1583,
29889,
2457,
13789,
10456,
3827,
29898,
1311,
29889,
2271,
29892,
1583,
29889,
5696,
29892,
1583,
29889,
3051,
29892,
13,
462,
462,
462,
539,
1583,
29889,
13662,
29892,
1583,
29889,
15619,
876,
13,
4706,
736,
1583,
3032,
2914,
13,
2
] |
lunespy/wallet/assembly.py | lunes-platform/LunesPy | 4 | 167408 | def random_seed(len: int) -> str:
from lunespy.wallet.constants import word_list
from os import urandom
def f():
word_count = 2048
r: bytes = urandom(4)
x: int = r[3] + (r[2] << 8) + (r[1] << 16) + (r[0] << 24)
w1: int = x % word_count
w2: int = ((int(x / word_count) >> 0) + w1) % word_count
w3: int = ((int((int(x / word_count) >> 0) / word_count) >> 0) + w2) % word_count
return w1, w2, w3
n_words_multiple_of_3: int = len // 3
return " ".join([
word_list[n]
for _ in range(n_words_multiple_of_3)
for n in f()
])
def from_seed(seed: str, nonce: int, chain: int):
from lunespy.crypto import bytes_to_b58, to_address, to_private_key, to_public_key, hidden_seed
from lunespy.wallet import Wallet
hash_seed: bytes = hidden_seed(nonce, seed)
private_key: bytes = to_private_key(hash_seed)
public_key: bytes = to_public_key(private_key)
address: bytes = to_address(public_key, chain, 1)
return Wallet(
private_key=bytes_to_b58(private_key),
public_key=bytes_to_b58(public_key),
address=bytes_to_b58(address),
nonce=nonce,
chain=chain,
seed=seed
)
def from_private_key(private_key: str, chain: int = 1):
from lunespy.crypto import bytes_to_b58, b58_to_bytes, to_address, to_private_key, to_public_key
from lunespy.wallet import Wallet
private_key: bytes = to_private_key(b58_to_bytes(private_key))
public_key: bytes = to_public_key(private_key)
address: bytes = to_address(public_key, chain, 1)
return Wallet(
private_key=bytes_to_b58(private_key),
public_key=bytes_to_b58(public_key),
address=bytes_to_b58(address),
seed_len=0,
nonce=0,
chain=chain,
seed=""
)
| [
1,
822,
4036,
29918,
26776,
29898,
2435,
29901,
938,
29897,
1599,
851,
29901,
13,
1678,
515,
301,
7844,
2272,
29889,
14625,
1026,
29889,
3075,
1934,
1053,
1734,
29918,
1761,
13,
1678,
515,
2897,
1053,
5065,
2685,
13,
13,
1678,
822,
285,
7295,
13,
4706,
1734,
29918,
2798,
353,
29871,
29906,
29900,
29946,
29947,
13,
4706,
364,
29901,
6262,
353,
5065,
2685,
29898,
29946,
29897,
13,
4706,
921,
29901,
938,
353,
364,
29961,
29941,
29962,
718,
313,
29878,
29961,
29906,
29962,
3532,
29871,
29947,
29897,
718,
313,
29878,
29961,
29896,
29962,
3532,
29871,
29896,
29953,
29897,
718,
313,
29878,
29961,
29900,
29962,
3532,
29871,
29906,
29946,
29897,
13,
4706,
281,
29896,
29901,
938,
353,
921,
1273,
1734,
29918,
2798,
13,
4706,
281,
29906,
29901,
938,
353,
5135,
524,
29898,
29916,
847,
1734,
29918,
2798,
29897,
5099,
29871,
29900,
29897,
718,
281,
29896,
29897,
1273,
1734,
29918,
2798,
13,
4706,
281,
29941,
29901,
938,
353,
5135,
524,
3552,
524,
29898,
29916,
847,
1734,
29918,
2798,
29897,
5099,
29871,
29900,
29897,
847,
1734,
29918,
2798,
29897,
5099,
29871,
29900,
29897,
718,
281,
29906,
29897,
1273,
1734,
29918,
2798,
13,
4706,
736,
281,
29896,
29892,
281,
29906,
29892,
281,
29941,
13,
13,
1678,
302,
29918,
9303,
29918,
20787,
29918,
974,
29918,
29941,
29901,
938,
353,
7431,
849,
29871,
29941,
13,
13,
1678,
736,
376,
11393,
7122,
4197,
13,
4706,
1734,
29918,
1761,
29961,
29876,
29962,
13,
4706,
363,
903,
297,
3464,
29898,
29876,
29918,
9303,
29918,
20787,
29918,
974,
29918,
29941,
29897,
13,
4706,
363,
302,
297,
285,
580,
13,
268,
2314,
13,
13,
13,
1753,
515,
29918,
26776,
29898,
26776,
29901,
851,
29892,
1661,
346,
29901,
938,
29892,
9704,
29901,
938,
1125,
13,
1678,
515,
301,
7844,
2272,
29889,
29883,
17929,
1053,
6262,
29918,
517,
29918,
29890,
29945,
29947,
29892,
304,
29918,
7328,
29892,
304,
29918,
9053,
29918,
1989,
29892,
304,
29918,
3597,
29918,
1989,
29892,
7934,
29918,
26776,
13,
1678,
515,
301,
7844,
2272,
29889,
14625,
1026,
1053,
5260,
1026,
13,
13,
1678,
6608,
29918,
26776,
29901,
6262,
353,
7934,
29918,
26776,
29898,
5464,
346,
29892,
16717,
29897,
13,
1678,
2024,
29918,
1989,
29901,
6262,
353,
304,
29918,
9053,
29918,
1989,
29898,
8568,
29918,
26776,
29897,
13,
1678,
970,
29918,
1989,
29901,
6262,
353,
304,
29918,
3597,
29918,
1989,
29898,
9053,
29918,
1989,
29897,
13,
1678,
3211,
29901,
6262,
353,
304,
29918,
7328,
29898,
3597,
29918,
1989,
29892,
9704,
29892,
29871,
29896,
29897,
13,
13,
1678,
736,
5260,
1026,
29898,
13,
4706,
2024,
29918,
1989,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
9053,
29918,
1989,
511,
13,
4706,
970,
29918,
1989,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
3597,
29918,
1989,
511,
13,
4706,
3211,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
7328,
511,
13,
4706,
1661,
346,
29922,
5464,
346,
29892,
13,
4706,
9704,
29922,
14153,
29892,
13,
4706,
16717,
29922,
26776,
13,
1678,
1723,
13,
13,
13,
1753,
515,
29918,
9053,
29918,
1989,
29898,
9053,
29918,
1989,
29901,
851,
29892,
9704,
29901,
938,
353,
29871,
29896,
1125,
13,
1678,
515,
301,
7844,
2272,
29889,
29883,
17929,
1053,
6262,
29918,
517,
29918,
29890,
29945,
29947,
29892,
289,
29945,
29947,
29918,
517,
29918,
13193,
29892,
304,
29918,
7328,
29892,
304,
29918,
9053,
29918,
1989,
29892,
304,
29918,
3597,
29918,
1989,
13,
1678,
515,
301,
7844,
2272,
29889,
14625,
1026,
1053,
5260,
1026,
13,
13,
1678,
2024,
29918,
1989,
29901,
6262,
353,
304,
29918,
9053,
29918,
1989,
29898,
29890,
29945,
29947,
29918,
517,
29918,
13193,
29898,
9053,
29918,
1989,
876,
13,
1678,
970,
29918,
1989,
29901,
6262,
353,
304,
29918,
3597,
29918,
1989,
29898,
9053,
29918,
1989,
29897,
13,
1678,
3211,
29901,
6262,
353,
304,
29918,
7328,
29898,
3597,
29918,
1989,
29892,
9704,
29892,
29871,
29896,
29897,
13,
13,
1678,
736,
5260,
1026,
29898,
13,
4706,
2024,
29918,
1989,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
9053,
29918,
1989,
511,
13,
4706,
970,
29918,
1989,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
3597,
29918,
1989,
511,
13,
4706,
3211,
29922,
13193,
29918,
517,
29918,
29890,
29945,
29947,
29898,
7328,
511,
13,
4706,
16717,
29918,
2435,
29922,
29900,
29892,
13,
4706,
1661,
346,
29922,
29900,
29892,
13,
4706,
9704,
29922,
14153,
29892,
13,
4706,
16717,
13776,
13,
1678,
1723,
13,
13,
2
] |
github_oauth_gateway/auth.py | HDI-Project/ballet-oauth-gateway | 1 | 169868 | import requests
GITHUB_OAUTH_URL = 'https://github.com/login/oauth/access_token'
def request_token(client_id, client_secret, code, redirect_uri, state):
url = GITHUB_OAUTH_URL
data = {
'client_id': client_id,
'client_secret': client_secret,
'code': code,
'state': state,
}
headers = {
'Accept': 'application/json'
}
response = requests.post(url, data=data, headers=headers)
response.raise_for_status()
return response.json()
| [
1,
1053,
7274,
13,
13,
29954,
13054,
7466,
29918,
29949,
20656,
29950,
29918,
4219,
353,
525,
991,
597,
3292,
29889,
510,
29914,
7507,
29914,
23106,
29914,
5943,
29918,
6979,
29915,
13,
13,
13,
1753,
2009,
29918,
6979,
29898,
4645,
29918,
333,
29892,
3132,
29918,
19024,
29892,
775,
29892,
6684,
29918,
5338,
29892,
2106,
1125,
13,
1678,
3142,
353,
402,
13054,
7466,
29918,
29949,
20656,
29950,
29918,
4219,
13,
13,
1678,
848,
353,
426,
13,
4706,
525,
4645,
29918,
333,
2396,
3132,
29918,
333,
29892,
13,
4706,
525,
4645,
29918,
19024,
2396,
3132,
29918,
19024,
29892,
13,
4706,
525,
401,
2396,
775,
29892,
13,
4706,
525,
3859,
2396,
2106,
29892,
13,
1678,
500,
13,
13,
1678,
9066,
353,
426,
13,
4706,
525,
23965,
2396,
525,
6214,
29914,
3126,
29915,
13,
1678,
500,
13,
13,
1678,
2933,
353,
7274,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1272,
29892,
9066,
29922,
13662,
29897,
13,
1678,
2933,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
13,
1678,
736,
2933,
29889,
3126,
580,
13,
2
] |
cap9/ex3/index1.py | felipesch92/livroPython | 0 | 137595 | with open('multiplos4.txt', 'w') as multiplos:
pares = open('pares.txt')
for l in pares.readlines():
num = l.replace('\n', '')
if int(num) % 4 == 0:
multiplos.write(f'{num}\n')
| [
1,
411,
1722,
877,
9910,
572,
359,
29946,
29889,
3945,
742,
525,
29893,
1495,
408,
2473,
572,
359,
29901,
13,
1678,
610,
267,
353,
1722,
877,
862,
267,
29889,
3945,
1495,
13,
1678,
363,
301,
297,
610,
267,
29889,
949,
9012,
7295,
13,
4706,
954,
353,
301,
29889,
6506,
28909,
29876,
742,
27255,
13,
4706,
565,
938,
29898,
1949,
29897,
1273,
29871,
29946,
1275,
29871,
29900,
29901,
13,
9651,
2473,
572,
359,
29889,
3539,
29898,
29888,
29915,
29912,
1949,
1012,
29876,
1495,
13,
2
] |
packages/mccomponents/tests/mccomponentsbpmodule/sample/Broadened_E_Q_Kernel_TestCase.py | mcvine/mcvine | 5 | 5432 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 2006-2010 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
standalone = True
import unittestX as unittest
import journal
debug = journal.debug( "Broadened_E_Q_Kernel_TestCase" )
warning = journal.warning( "Broadened_E_Q_Kernel_TestCase" )
import mcni
from mccomposite import mccompositebp
from mccomponents import mccomponentsbp
class TestCase(unittest.TestCase):
def test(self):
E_Q = "Q*Q/3."
S_Q = "1"
sigma_Q = "Q/2."
Qmin = 0; Qmax = 10
absorption_coefficient = scattering_coefficient = 1.
kernel = mccomponentsbp.create_Broadened_E_Q_Kernel(
E_Q, S_Q, sigma_Q,
Qmin, Qmax,
absorption_coefficient,
scattering_coefficient,
)
ei = 500 # meV
from mcni.utils import conversion
vil = conversion.e2v(ei)
vi = (0,0,vil)
import numpy.linalg as nl
import numpy as np
for i in range(10):
event = mcni.neutron(
r = (0,0,0), v = vi,
prob = 1, time = 0 )
kernel.scatter( event );
vf = np.array(event.state.velocity)
diffv = vi - vf
Q = conversion.v2k(nl.norm(diffv))
ef = conversion.v2e(nl.norm(vf))
E = ei - ef
# print E, Q, event
E1 = eval(E_Q)
continue
return
pass # end of TestCase
def main():
unittest.main()
return
if __name__ == "__main__":
main()
# version
__id__ = "$Id: TestCase.py 696 2010-11-09 06:23:06Z linjiao $"
# End of file
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
13,
29937,
3695,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
14087,
30022,
13,
29937,
13,
29937,
462,
462,
259,
529,
5813,
29958,
13,
29937,
462,
418,
8046,
8907,
310,
17968,
13,
29937,
462,
418,
313,
29907,
29897,
29871,
29906,
29900,
29900,
29953,
29899,
29906,
29900,
29896,
29900,
2178,
26863,
2538,
9841,
259,
13,
29937,
13,
29937,
426,
29931,
293,
1947,
1626,
29913,
13,
29937,
13,
29937,
3695,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
26594,
14087,
30022,
13,
29937,
13,
13,
13,
1689,
18785,
353,
5852,
13,
13,
13,
5215,
443,
27958,
29990,
408,
443,
27958,
13,
5215,
8955,
13,
13,
8382,
353,
8955,
29889,
8382,
29898,
376,
29857,
4858,
287,
29918,
29923,
29918,
29984,
29918,
29968,
5851,
29918,
3057,
8259,
29908,
1723,
13,
27392,
353,
8955,
29889,
27392,
29898,
376,
29857,
4858,
287,
29918,
29923,
29918,
29984,
29918,
29968,
5851,
29918,
3057,
8259,
29908,
1723,
13,
13,
13,
5215,
286,
29883,
1240,
13,
3166,
286,
29883,
22410,
568,
1053,
286,
29883,
22410,
568,
25288,
29871,
13,
3166,
286,
29883,
14036,
1053,
286,
29883,
14036,
25288,
13,
13,
1990,
4321,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29898,
1311,
1125,
13,
4706,
382,
29918,
29984,
353,
376,
29984,
29930,
29984,
29914,
29941,
1213,
13,
4706,
317,
29918,
29984,
353,
376,
29896,
29908,
13,
4706,
269,
2934,
29918,
29984,
353,
376,
29984,
29914,
29906,
1213,
13,
4706,
660,
1195,
353,
29871,
29900,
29936,
660,
3317,
353,
29871,
29896,
29900,
13,
4706,
17977,
683,
29918,
1111,
8462,
353,
14801,
292,
29918,
1111,
8462,
353,
29871,
29896,
29889,
13,
4706,
8466,
353,
286,
29883,
14036,
25288,
29889,
3258,
29918,
29857,
4858,
287,
29918,
29923,
29918,
29984,
29918,
29968,
5851,
29898,
13,
9651,
382,
29918,
29984,
29892,
317,
29918,
29984,
29892,
269,
2934,
29918,
29984,
29892,
13,
9651,
660,
1195,
29892,
660,
3317,
29892,
13,
9651,
17977,
683,
29918,
1111,
8462,
29892,
13,
9651,
14801,
292,
29918,
1111,
8462,
29892,
13,
9651,
1723,
13,
13,
4706,
321,
29875,
353,
29871,
29945,
29900,
29900,
396,
592,
29963,
13,
4706,
515,
286,
29883,
1240,
29889,
13239,
1053,
11301,
13,
4706,
11928,
353,
11301,
29889,
29872,
29906,
29894,
29898,
10096,
29897,
13,
4706,
3516,
353,
313,
29900,
29892,
29900,
29892,
17191,
29897,
13,
13,
4706,
1053,
12655,
29889,
29880,
979,
29887,
408,
302,
29880,
13,
4706,
1053,
12655,
408,
7442,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29900,
1125,
13,
9651,
1741,
353,
286,
29883,
1240,
29889,
17821,
1617,
29898,
29871,
13,
18884,
364,
353,
313,
29900,
29892,
29900,
29892,
29900,
511,
325,
353,
3516,
29892,
29871,
13,
18884,
2070,
353,
29871,
29896,
29892,
931,
353,
29871,
29900,
1723,
13,
9651,
8466,
29889,
1557,
2620,
29898,
1741,
3482,
13,
9651,
325,
29888,
353,
7442,
29889,
2378,
29898,
3696,
29889,
3859,
29889,
955,
25245,
29897,
13,
9651,
2923,
29894,
353,
3516,
448,
325,
29888,
13,
9651,
660,
353,
11301,
29889,
29894,
29906,
29895,
29898,
12938,
29889,
12324,
29898,
12765,
29894,
876,
13,
9651,
321,
29888,
353,
11301,
29889,
29894,
29906,
29872,
29898,
12938,
29889,
12324,
29898,
29894,
29888,
876,
13,
9651,
382,
353,
321,
29875,
448,
321,
29888,
13,
9651,
396,
1596,
382,
29892,
660,
29892,
1741,
13,
9651,
382,
29896,
353,
19745,
29898,
29923,
29918,
29984,
29897,
13,
9651,
6773,
13,
13,
4706,
736,
13,
268,
13,
268,
13,
1678,
1209,
29871,
396,
1095,
310,
4321,
8259,
13,
13,
268,
13,
1753,
1667,
7295,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
1678,
736,
13,
268,
13,
268,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
268,
13,
29937,
1873,
13,
1649,
333,
1649,
353,
3908,
1204,
29901,
4321,
8259,
29889,
2272,
29871,
29953,
29929,
29953,
29871,
29906,
29900,
29896,
29900,
29899,
29896,
29896,
29899,
29900,
29929,
29871,
29900,
29953,
29901,
29906,
29941,
29901,
29900,
29953,
29999,
6276,
29926,
29653,
395,
29908,
13,
13,
29937,
2796,
310,
934,
29871,
13,
2
] |
cyk/cnf/linear_cnf.py | azoimide/cyk | 0 | 93569 | <reponame>azoimide/cyk
import sys
def read_linear_grammar(f=sys.stdin):
lines = f.readlines()
# rule_lines = lines[:-1]
rule_lines = lines
# s = map(lambda c: ord(c) - ord('a'), lines[-1].strip())
ups = []
rnups = []
lnups = []
nt_count = 0
t_count = 0
t_tab = {}
nt_tab = {}
for line in rule_lines:
if line[0] == '#':
continue
lhs, rhs = line.strip().split(' ')
# New N in LHS
if lhs not in nt_tab:
nt_tab[lhs] = len(nt_tab)
lnups.append([])
rnups.append([])
ups.append([])
# N -> T (up)
if len(rhs) == 1:
if rhs.istitle():
raise ValueError("Invalid terminal: " + rhs)
if rhs not in t_tab:
t_tab[rhs] = len(t_tab)
ups[nt_tab[lhs]].append(t_tab[rhs])
else:
# N -> NT (lnup)
if rhs[0].istitle() and not rhs[1].istitle():
nt = rhs[0]
t = rhs[1]
# New N in RHS
if nt not in nt_tab:
nt_tab[nt] = len(nt_tab)
ups.append([])
rnups.append([])
lnups.append([])
# New T in RHS
if t not in t_tab:
t_tab[t] = len(t_tab)
lnups[nt_tab[lhs]].append((nt_tab[nt],t_tab[t]))
# N -> TN (rnup)
elif not rhs[0].istitle() and rhs[1].istitle():
t = rhs[0]
nt = rhs[1]
# New N in RHS
if nt not in nt_tab:
nt_tab[nt] = len(nt_tab)
ups.append([])
rnups.append([])
lnups.append([])
# New T in RHS
if t not in t_tab:
t_tab[t] = len(t_tab)
rnups[nt_tab[lhs]].append((t_tab[t],nt_tab[nt]))
else:
raise ValueError("Invalid rule: " + line)
return lnups, rnups, ups, nt_tab, t_tab, 0
| [
1,
529,
276,
1112,
420,
29958,
834,
29877,
326,
680,
29914,
25923,
13,
5215,
10876,
13,
13,
1753,
1303,
29918,
10660,
29918,
1393,
3034,
29898,
29888,
29922,
9675,
29889,
4172,
262,
1125,
13,
1678,
3454,
353,
285,
29889,
949,
9012,
580,
13,
1678,
396,
5751,
29918,
9012,
353,
3454,
7503,
29899,
29896,
29962,
13,
1678,
5751,
29918,
9012,
353,
3454,
13,
1678,
396,
269,
353,
2910,
29898,
2892,
274,
29901,
4356,
29898,
29883,
29897,
448,
4356,
877,
29874,
5477,
3454,
14352,
29896,
1822,
17010,
3101,
13,
1678,
24081,
353,
5159,
13,
1678,
364,
3433,
567,
353,
5159,
13,
1678,
301,
3433,
567,
353,
5159,
13,
1678,
302,
29873,
29918,
2798,
353,
29871,
29900,
13,
1678,
260,
29918,
2798,
353,
29871,
29900,
13,
1678,
260,
29918,
3891,
353,
6571,
13,
1678,
302,
29873,
29918,
3891,
353,
6571,
13,
1678,
363,
1196,
297,
5751,
29918,
9012,
29901,
13,
4706,
565,
1196,
29961,
29900,
29962,
1275,
16321,
2396,
13,
9651,
6773,
13,
4706,
301,
9499,
29892,
29365,
353,
1196,
29889,
17010,
2141,
5451,
877,
25710,
13,
13,
4706,
396,
1570,
405,
297,
365,
14851,
13,
4706,
565,
301,
9499,
451,
297,
302,
29873,
29918,
3891,
29901,
13,
9651,
302,
29873,
29918,
3891,
29961,
29880,
9499,
29962,
353,
7431,
29898,
593,
29918,
3891,
29897,
13,
9651,
301,
3433,
567,
29889,
4397,
4197,
2314,
13,
9651,
364,
3433,
567,
29889,
4397,
4197,
2314,
13,
9651,
24081,
29889,
4397,
4197,
2314,
13,
13,
4706,
396,
405,
1599,
323,
313,
786,
29897,
13,
4706,
565,
7431,
29898,
29878,
9499,
29897,
1275,
29871,
29896,
29901,
29871,
13,
9651,
565,
29365,
29889,
391,
1740,
7295,
13,
18884,
12020,
7865,
2392,
703,
13919,
8638,
29901,
376,
718,
29365,
29897,
13,
9651,
565,
29365,
451,
297,
260,
29918,
3891,
29901,
13,
18884,
260,
29918,
3891,
29961,
29878,
9499,
29962,
353,
7431,
29898,
29873,
29918,
3891,
29897,
13,
9651,
24081,
29961,
593,
29918,
3891,
29961,
29880,
9499,
29962,
1822,
4397,
29898,
29873,
29918,
3891,
29961,
29878,
9499,
2314,
13,
4706,
1683,
29901,
13,
13,
9651,
396,
405,
1599,
405,
29911,
313,
3083,
786,
29897,
13,
9651,
565,
29365,
29961,
29900,
1822,
391,
1740,
580,
322,
451,
29365,
29961,
29896,
1822,
391,
1740,
7295,
29871,
13,
18884,
302,
29873,
353,
29365,
29961,
29900,
29962,
13,
18884,
260,
353,
29365,
29961,
29896,
29962,
13,
13,
18884,
396,
1570,
405,
297,
390,
14851,
13,
18884,
565,
302,
29873,
451,
297,
302,
29873,
29918,
3891,
29901,
13,
462,
1678,
302,
29873,
29918,
3891,
29961,
593,
29962,
353,
7431,
29898,
593,
29918,
3891,
29897,
13,
462,
1678,
24081,
29889,
4397,
4197,
2314,
13,
462,
1678,
364,
3433,
567,
29889,
4397,
4197,
2314,
13,
462,
1678,
301,
3433,
567,
29889,
4397,
4197,
2314,
13,
13,
18884,
396,
1570,
323,
297,
390,
14851,
13,
18884,
565,
260,
451,
297,
260,
29918,
3891,
29901,
13,
462,
1678,
260,
29918,
3891,
29961,
29873,
29962,
353,
7431,
29898,
29873,
29918,
3891,
29897,
13,
13,
18884,
301,
3433,
567,
29961,
593,
29918,
3891,
29961,
29880,
9499,
29962,
1822,
4397,
3552,
593,
29918,
3891,
29961,
593,
1402,
29873,
29918,
3891,
29961,
29873,
12622,
13,
13,
9651,
396,
405,
1599,
323,
29940,
313,
27539,
786,
29897,
13,
9651,
25342,
451,
29365,
29961,
29900,
1822,
391,
1740,
580,
322,
29365,
29961,
29896,
1822,
391,
1740,
7295,
29871,
13,
18884,
260,
353,
29365,
29961,
29900,
29962,
13,
18884,
302,
29873,
353,
29365,
29961,
29896,
29962,
13,
13,
18884,
396,
1570,
405,
297,
390,
14851,
13,
18884,
565,
302,
29873,
451,
297,
302,
29873,
29918,
3891,
29901,
13,
462,
1678,
302,
29873,
29918,
3891,
29961,
593,
29962,
353,
7431,
29898,
593,
29918,
3891,
29897,
13,
462,
1678,
24081,
29889,
4397,
4197,
2314,
13,
462,
1678,
364,
3433,
567,
29889,
4397,
4197,
2314,
13,
462,
1678,
301,
3433,
567,
29889,
4397,
4197,
2314,
13,
13,
18884,
396,
1570,
323,
297,
390,
14851,
13,
18884,
565,
260,
451,
297,
260,
29918,
3891,
29901,
13,
462,
1678,
260,
29918,
3891,
29961,
29873,
29962,
353,
7431,
29898,
29873,
29918,
3891,
29897,
13,
13,
18884,
364,
3433,
567,
29961,
593,
29918,
3891,
29961,
29880,
9499,
29962,
1822,
4397,
3552,
29873,
29918,
3891,
29961,
29873,
1402,
593,
29918,
3891,
29961,
593,
12622,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
703,
13919,
5751,
29901,
376,
718,
1196,
29897,
13,
1678,
736,
301,
3433,
567,
29892,
364,
3433,
567,
29892,
24081,
29892,
302,
29873,
29918,
3891,
29892,
260,
29918,
3891,
29892,
29871,
29900,
13,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.