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
|
---|---|---|---|---|---|
strips/utils.py | cyclone923/pyplanners | 0 | 117539 | from .ff import ff_fn, plan_cost, first_goals
from misc.numerical import INF
from misc.functions import in_add
from planner.progression.best_first import a_star_search, best_first_search, deferred_best_first_search
def h_0(state, goal, operators):
return 0
def h_naive(state, goal, operators):
return sum(1 for literal in goal.conditions if literal not in state)
def h_blind(state, goal, operators):
return min(operator.cost for operator in ha_applicable(state, goal, operators))
###########################################################################
def filter_axioms(operators):
return filter(lambda o: not o.is_axiom(), operators)
def ha_all(state, goal, operators):
return operators
def ha_applicable(state, goal, operators):
return [operator for operator in operators if operator(state) is not None]
def ha_sorted(state, goal, operators):
return sorted(ha_applicable(state, goal, operators), key=lambda o: o.cost)
def ha_combine(state, goal, operators, *helpful_actions):
seen_operators = set()
for ha in helpful_actions:
ha_operators = []
for operator in ha(state, goal, operators):
if not in_add(seen_operators, operator):
ha_operators.append(operator)
yield ha_operators
###########################################################################
def combine(heuristic, helpful_actions):
return lambda s, g, o: (heuristic(s, g, o), helpful_actions(s, g, o))
#default_successors = combine(h_add, ha_applicable)
default_successors = ff_fn(plan_cost, first_goals, op=sum)
###########################################################################
def single_generator(initial, goal, operators, successors):
def generator(vertex):
yield successors(vertex.state, goal, operators)
return generator
#return = lambda v: (yield successors(v.state, goal, operators))
def filter_axioms_generator(goal, operators, axioms, successors):
def generator(vertex):
#heuristic, helpful_actions = successors(vertex.state, goal, operators + axioms)
heuristic, helpful_actions = successors(vertex.derived_state, goal, operators + axioms)
#yield heuristic, helpful_actions
#yield heuristic, operators
yield heuristic, filter_axioms(helpful_actions) # NOTE - the first_actions should be anything applicable in derived_state
#yield heuristic, filter(lambda op: op not in axioms, helpful_actions)
return generator, axioms
default_generator = lambda i, g, o: single_generator(i, g, o, default_successors)
###########################################################################
def weighted(w):
if w == INF:
return lambda v: v.h_cost
return lambda v: (v.cost + w*v.h_cost)
uniform = weighted(0)
astar = weighted(1)
greedy = weighted(INF)
###########################################################################
# TODO: # stack=True vs False can matter quite a bit
#default_search = lambda initial, goal, generator: a_star_search(initial, goal, generator, astar, stack=True)
default_search = lambda initial, goal, generator: best_first_search(initial, goal, generator, greedy, stack=False)
#default_search = lambda initial, goal, generator: deferred_best_first_search(initial, goal, generator, greedy, stack=False)
def default_plan(initial, goal, operators):
return default_search(initial, goal, default_generator(initial, goal, operators))
def default_derived_plan(initial, goal, operators, axioms):
#return default_search(initial, goal, (lambda v: iter([default_successors(v.state, goal, operators + axioms)]), axioms))
return default_search(initial, goal, filter_axioms_generator(goal, operators, axioms, default_successors))
| [
1,
515,
869,
600,
1053,
14336,
29918,
9144,
29892,
3814,
29918,
18253,
29892,
937,
29918,
1484,
1338,
13,
3166,
3984,
29883,
29889,
8058,
936,
1053,
2672,
29943,
13,
3166,
3984,
29883,
29889,
12171,
1053,
297,
29918,
1202,
13,
3166,
715,
7310,
29889,
771,
11476,
29889,
13318,
29918,
4102,
1053,
263,
29918,
8508,
29918,
4478,
29892,
1900,
29918,
4102,
29918,
4478,
29892,
316,
14373,
29918,
13318,
29918,
4102,
29918,
4478,
13,
13,
1753,
298,
29918,
29900,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
29871,
29900,
13,
1753,
298,
29918,
1056,
573,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
2533,
29898,
29896,
363,
16333,
297,
7306,
29889,
1116,
2187,
565,
16333,
451,
297,
2106,
29897,
13,
1753,
298,
29918,
2204,
513,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
1375,
29898,
6891,
29889,
18253,
363,
5455,
297,
447,
29918,
932,
506,
519,
29898,
3859,
29892,
7306,
29892,
12768,
876,
13,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
1753,
4175,
29918,
20593,
4835,
29898,
3372,
4097,
1125,
13,
1678,
736,
4175,
29898,
2892,
288,
29901,
451,
288,
29889,
275,
29918,
1165,
14910,
3285,
12768,
29897,
13,
13,
1753,
447,
29918,
497,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
12768,
13,
1753,
447,
29918,
932,
506,
519,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
518,
6891,
363,
5455,
297,
12768,
565,
5455,
29898,
3859,
29897,
338,
451,
6213,
29962,
13,
1753,
447,
29918,
24582,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
12705,
29898,
2350,
29918,
932,
506,
519,
29898,
3859,
29892,
7306,
29892,
12768,
511,
1820,
29922,
2892,
288,
29901,
288,
29889,
18253,
29897,
13,
13,
1753,
447,
29918,
17743,
457,
29898,
3859,
29892,
7306,
29892,
12768,
29892,
334,
8477,
1319,
29918,
7387,
1125,
13,
1678,
3595,
29918,
3372,
4097,
353,
731,
580,
13,
1678,
363,
447,
297,
8444,
29918,
7387,
29901,
13,
4706,
447,
29918,
3372,
4097,
353,
5159,
13,
4706,
363,
5455,
297,
447,
29898,
3859,
29892,
7306,
29892,
12768,
1125,
13,
9651,
565,
451,
297,
29918,
1202,
29898,
28026,
29918,
3372,
4097,
29892,
5455,
1125,
13,
18884,
447,
29918,
3372,
4097,
29889,
4397,
29898,
6891,
29897,
13,
4706,
7709,
447,
29918,
3372,
4097,
13,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
1753,
14405,
29898,
354,
332,
4695,
29892,
8444,
29918,
7387,
1125,
13,
1678,
736,
14013,
269,
29892,
330,
29892,
288,
29901,
313,
354,
332,
4695,
29898,
29879,
29892,
330,
29892,
288,
511,
8444,
29918,
7387,
29898,
29879,
29892,
330,
29892,
288,
876,
13,
13,
29937,
4381,
29918,
8698,
943,
353,
14405,
29898,
29882,
29918,
1202,
29892,
447,
29918,
932,
506,
519,
29897,
13,
4381,
29918,
8698,
943,
353,
14336,
29918,
9144,
29898,
9018,
29918,
18253,
29892,
937,
29918,
1484,
1338,
29892,
1015,
29922,
2083,
29897,
13,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
1753,
2323,
29918,
27959,
29898,
11228,
29892,
7306,
29892,
12768,
29892,
2551,
943,
1125,
13,
1678,
822,
15299,
29898,
369,
4776,
1125,
13,
4706,
7709,
2551,
943,
29898,
369,
4776,
29889,
3859,
29892,
7306,
29892,
12768,
29897,
13,
1678,
736,
15299,
13,
1678,
396,
2457,
353,
14013,
325,
29901,
313,
29891,
969,
2551,
943,
29898,
29894,
29889,
3859,
29892,
7306,
29892,
12768,
876,
13,
13,
1753,
4175,
29918,
20593,
4835,
29918,
27959,
29898,
28111,
29892,
12768,
29892,
4853,
29875,
4835,
29892,
2551,
943,
1125,
13,
1678,
822,
15299,
29898,
369,
4776,
1125,
13,
4706,
396,
354,
332,
4695,
29892,
8444,
29918,
7387,
353,
2551,
943,
29898,
369,
4776,
29889,
3859,
29892,
7306,
29892,
12768,
718,
4853,
29875,
4835,
29897,
13,
4706,
540,
332,
4695,
29892,
8444,
29918,
7387,
353,
2551,
943,
29898,
369,
4776,
29889,
672,
2347,
29918,
3859,
29892,
7306,
29892,
12768,
718,
4853,
29875,
4835,
29897,
13,
4706,
396,
29891,
969,
540,
332,
4695,
29892,
8444,
29918,
7387,
13,
4706,
396,
29891,
969,
540,
332,
4695,
29892,
12768,
13,
4706,
7709,
540,
332,
4695,
29892,
4175,
29918,
20593,
4835,
29898,
8477,
1319,
29918,
7387,
29897,
396,
6058,
29923,
448,
278,
937,
29918,
7387,
881,
367,
3099,
22903,
297,
10723,
29918,
3859,
13,
4706,
396,
29891,
969,
540,
332,
4695,
29892,
4175,
29898,
2892,
1015,
29901,
1015,
451,
297,
4853,
29875,
4835,
29892,
8444,
29918,
7387,
29897,
13,
1678,
736,
15299,
29892,
4853,
29875,
4835,
13,
13,
4381,
29918,
27959,
353,
14013,
474,
29892,
330,
29892,
288,
29901,
2323,
29918,
27959,
29898,
29875,
29892,
330,
29892,
288,
29892,
2322,
29918,
8698,
943,
29897,
13,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
1753,
7688,
287,
29898,
29893,
1125,
13,
1678,
565,
281,
1275,
2672,
29943,
29901,
13,
4706,
736,
14013,
325,
29901,
325,
29889,
29882,
29918,
18253,
13,
1678,
736,
14013,
325,
29901,
313,
29894,
29889,
18253,
718,
281,
29930,
29894,
29889,
29882,
29918,
18253,
29897,
13,
13,
29590,
353,
7688,
287,
29898,
29900,
29897,
13,
579,
279,
353,
7688,
287,
29898,
29896,
29897,
13,
7979,
7584,
353,
7688,
287,
29898,
24065,
29897,
13,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
29937,
14402,
29901,
396,
5096,
29922,
5574,
7186,
7700,
508,
4383,
3755,
263,
2586,
13,
29937,
4381,
29918,
4478,
353,
14013,
2847,
29892,
7306,
29892,
15299,
29901,
263,
29918,
8508,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
15299,
29892,
263,
8508,
29892,
5096,
29922,
5574,
29897,
13,
4381,
29918,
4478,
353,
14013,
2847,
29892,
7306,
29892,
15299,
29901,
1900,
29918,
4102,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
15299,
29892,
1395,
7584,
29892,
5096,
29922,
8824,
29897,
13,
29937,
4381,
29918,
4478,
353,
14013,
2847,
29892,
7306,
29892,
15299,
29901,
316,
14373,
29918,
13318,
29918,
4102,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
15299,
29892,
1395,
7584,
29892,
5096,
29922,
8824,
29897,
13,
13,
1753,
2322,
29918,
9018,
29898,
11228,
29892,
7306,
29892,
12768,
1125,
13,
1678,
736,
2322,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
2322,
29918,
27959,
29898,
11228,
29892,
7306,
29892,
12768,
876,
13,
13,
1753,
2322,
29918,
672,
2347,
29918,
9018,
29898,
11228,
29892,
7306,
29892,
12768,
29892,
4853,
29875,
4835,
1125,
13,
1678,
396,
2457,
2322,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
313,
2892,
325,
29901,
4256,
4197,
4381,
29918,
8698,
943,
29898,
29894,
29889,
3859,
29892,
7306,
29892,
12768,
718,
4853,
29875,
4835,
4638,
511,
4853,
29875,
4835,
876,
13,
1678,
736,
2322,
29918,
4478,
29898,
11228,
29892,
7306,
29892,
4175,
29918,
20593,
4835,
29918,
27959,
29898,
28111,
29892,
12768,
29892,
4853,
29875,
4835,
29892,
2322,
29918,
8698,
943,
876,
13,
2
] |
zero_padding.py | dcxSt/kaggle_mais | 0 | 110574 | #! /home/steve/anaconda3/bin/python3.7
import numpy as np
train_images = np.load("train_images.npy")
padded_train_images = []
print("padding train images")
for i in train_images:
entry=[]
entry.append(np.zeros(32))
entry.append(np.zeros(32))
for j in i:
entry.append([0,0]+list(j)+[0,0])
entry.append(np.zeros(32))
entry.append(np.zeros(32))
padded_train_images.append(entry)
print("saving padded train images")
np.save("padded_train_images.npy", np.array(padded_train_images))
test_images = np.load("test_images.npy")
padded_test_images = []
print("padding test images")
for i in test_images:
entry=[]
entry.append(np.zeros(32))
entry.append(np.zeros(32))
for j in i:
entry.append([0,0]+list(j)+[0,0])
entry.append(np.zeros(32))
entry.append(np.zeros(32))
padded_test_images.append(entry)
print("saving padded test images")
np.save("padded_test_images.npy", np.array(padded_test_images))
| [
1,
396,
29991,
847,
5184,
29914,
1655,
345,
29914,
1648,
18050,
29941,
29914,
2109,
29914,
4691,
29941,
29889,
29955,
13,
13,
5215,
12655,
408,
7442,
13,
14968,
29918,
8346,
353,
7442,
29889,
1359,
703,
14968,
29918,
8346,
29889,
29876,
2272,
1159,
13,
13,
29886,
23959,
29918,
14968,
29918,
8346,
353,
5159,
13,
2158,
703,
12791,
7945,
4558,
1159,
13,
13,
1454,
474,
297,
7945,
29918,
8346,
29901,
13,
1678,
6251,
29922,
2636,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
363,
432,
297,
474,
29901,
13,
4706,
6251,
29889,
4397,
4197,
29900,
29892,
29900,
10062,
1761,
29898,
29926,
7240,
29961,
29900,
29892,
29900,
2314,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
282,
23959,
29918,
14968,
29918,
8346,
29889,
4397,
29898,
8269,
29897,
13,
2158,
703,
29879,
5555,
282,
23959,
7945,
4558,
1159,
13,
9302,
29889,
7620,
703,
29886,
23959,
29918,
14968,
29918,
8346,
29889,
29876,
2272,
613,
7442,
29889,
2378,
29898,
29886,
23959,
29918,
14968,
29918,
8346,
876,
13,
13,
13,
13,
13,
1688,
29918,
8346,
353,
7442,
29889,
1359,
703,
1688,
29918,
8346,
29889,
29876,
2272,
1159,
13,
13,
29886,
23959,
29918,
1688,
29918,
8346,
353,
5159,
13,
2158,
703,
12791,
1243,
4558,
1159,
13,
13,
1454,
474,
297,
1243,
29918,
8346,
29901,
13,
1678,
6251,
29922,
2636,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
363,
432,
297,
474,
29901,
13,
4706,
6251,
29889,
4397,
4197,
29900,
29892,
29900,
10062,
1761,
29898,
29926,
7240,
29961,
29900,
29892,
29900,
2314,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
6251,
29889,
4397,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
876,
13,
1678,
282,
23959,
29918,
1688,
29918,
8346,
29889,
4397,
29898,
8269,
29897,
13,
13,
2158,
703,
29879,
5555,
282,
23959,
1243,
4558,
1159,
13,
9302,
29889,
7620,
703,
29886,
23959,
29918,
1688,
29918,
8346,
29889,
29876,
2272,
613,
7442,
29889,
2378,
29898,
29886,
23959,
29918,
1688,
29918,
8346,
876,
13,
13,
2
] |
medium/1780-check-if-number-is-a-sum-of-powers-of-three.py | wanglongjiang/leetcode | 2 | 184392 | '''
判断一个数字是否可以表示成三的幂的和
给你一个整数 n ,如果你可以将 n 表示成若干个不同的三的幂之和,请你返回 true ,否则请返回 false 。
对于一个整数 y ,如果存在整数 x 满足 y == 3x ,我们称这个整数 y 是三的幂。
提示:
1 <= n <= 107
'''
'''
思路:数学
对于一个整数x,如果是3的幂的和,说明x=y*3 or x= y*3+1
也就是x是3的整数倍或整数倍+1
不对,是3个不同的幂之和如果是21,3^2+3^2+3^1
TODO
'''
| [
1,
14550,
13,
31791,
31683,
30287,
30502,
30354,
30578,
30392,
31191,
30682,
30651,
30746,
30858,
30494,
30457,
30210,
232,
188,
133,
30210,
30503,
13,
31999,
30919,
30287,
30502,
233,
152,
183,
30354,
30081,
29876,
30081,
30214,
30847,
30801,
30919,
30682,
30651,
30998,
30081,
29876,
30081,
30746,
30858,
30494,
31653,
232,
188,
181,
30502,
30413,
30980,
30210,
30457,
30210,
232,
188,
133,
30577,
30503,
30214,
31088,
30919,
31086,
30742,
30081,
3009,
30081,
30214,
31191,
31403,
31088,
31086,
30742,
2089,
30081,
30267,
13,
13,
30783,
30909,
30287,
30502,
233,
152,
183,
30354,
343,
30081,
30214,
30847,
30801,
30946,
30505,
233,
152,
183,
30354,
921,
30081,
233,
190,
164,
31722,
343,
1275,
29871,
29941,
29916,
30081,
30214,
30672,
31381,
31685,
30810,
30502,
233,
152,
183,
30354,
343,
30081,
30392,
30457,
30210,
232,
188,
133,
30267,
13,
13,
31302,
30858,
30383,
13,
13,
29896,
5277,
302,
5277,
29871,
29896,
29900,
29955,
13,
12008,
13,
12008,
13,
31579,
30874,
30383,
30354,
30415,
13,
30783,
30909,
30287,
30502,
233,
152,
183,
30354,
29916,
30214,
30847,
30801,
30392,
29941,
30210,
232,
188,
133,
30210,
30503,
30214,
31639,
30592,
29916,
29922,
29891,
29930,
29941,
470,
921,
29922,
343,
29930,
29941,
29974,
29896,
13,
30953,
31238,
30392,
29916,
30392,
29941,
30210,
233,
152,
183,
30354,
232,
131,
144,
31391,
233,
152,
183,
30354,
232,
131,
144,
29974,
29896,
13,
30413,
30783,
30214,
30392,
29941,
30502,
30413,
30980,
30210,
232,
188,
133,
30577,
30503,
30847,
30801,
30392,
29906,
29896,
30214,
29941,
29985,
29906,
29974,
29941,
29985,
29906,
29974,
29941,
29985,
29896,
13,
4986,
3970,
13,
12008,
13,
2
] |
test_tscribe.py | craigmayhew/aws_transcribe_to_docx | 0 | 135911 | <reponame>craigmayhew/aws_transcribe_to_docx
import tscribe
import os
def test_multiple_speakers():
"""
Test output exists with multiple speaker input
# GIVEN a sample file containing multiple speakers
# WHEN calling tscribe.write(...)
# THEN produce the .docx without errors
"""
# Setup
input_file = "sample_multiple.json"
output_file = "sample_multiple.docx"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file)
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove("chart.png")
def test_multiple_speakers_with_save_as():
"""
Test output exists with multiple speaker input, and save_as defined
# GIVEN a sample file containing multiple speakers, and an output filename
# WHEN calling tscribe.write(...)
# THEN produce the .docx, named correctly, without errors
"""
# Setup
input_file = "sample_multiple.json"
output_file = "test_sample.docx"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file, save_as=output_file)
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove("chart.png")
def test_multiple_speakers_with_save_as_with_tmp_dir():
"""
Test output exists with multiple speaker input, and save_as defined, and tmp_dir defined
# GIVEN a sample file containing multiple speakers, and an output filename, and a writable tmp directory
# WHEN calling tscribe.write(...)
# THEN produce the .docx, with a chart, named correctly, without errors
"""
# Setup
input_file = "sample_multiple.json"
output_file = "test_sample.docx"
tmp_dir = "/tmp/"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file, save_as=output_file, tmp_dir=tmp_dir)
assert os.access(tmp_dir+"chart.png", os.F_OK), "Chart file not found"
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove(tmp_dir+"chart.png")
def test_single_speaker():
"""
Test output exists with single speaker input
# GIVEN a sample file containing single speaker
# WHEN calling tscribe.write(...)
# THEN produce the .docx without errors
"""
# Setup
input_file = "sample_single.json"
output_file = "sample_single.docx"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file)
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove("chart.png")
def test_single_speaker_with_save_as():
"""
Test output exists with single speaker input, and save_as defined
# GIVEN a sample file containing single speaker, and an output filename
# WHEN calling tscribe.write(...)
# THEN produce the .docx, named correctly, without errors
"""
# Setup
input_file = "sample_single.json"
output_file = "test_sample.docx"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file, save_as=output_file)
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove("chart.png")
def test_single_speaker_with_save_as_with_tmp_dir():
"""
Test output exists with single speaker input, and save_as defined, and tmp_dir defined
# GIVEN a sample file containing single speaker, and an output filename, and a writable tmp directory
# WHEN calling tscribe.write(...)
# THEN produce the .docx, with a chart, named correctly, without errors
"""
# Setup
input_file = "sample_single.json"
output_file = "test_sample.docx"
tmp_dir = "/tmp/"
assert os.access(input_file, os.F_OK), "Input file not found"
# Function
tscribe.write(input_file, save_as=output_file, tmp_dir=tmp_dir)
assert os.access(tmp_dir+"chart.png", os.F_OK), "Chart file not found"
assert os.access(output_file, os.F_OK), "Output file not found"
# Teardown
os.remove(output_file)
os.remove(tmp_dir+"chart.png") | [
1,
529,
276,
1112,
420,
29958,
26844,
335,
13029,
13636,
29914,
10467,
29918,
3286,
29581,
29918,
517,
29918,
1514,
29916,
13,
5215,
260,
13086,
13,
5215,
2897,
13,
13,
13,
1753,
1243,
29918,
20787,
29918,
5965,
21079,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2999,
25657,
1881,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2999,
7726,
414,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
20787,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
11249,
29918,
20787,
29889,
1514,
29916,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
703,
15425,
29889,
2732,
1159,
13,
13,
13,
1753,
1243,
29918,
20787,
29918,
5965,
21079,
29918,
2541,
29918,
7620,
29918,
294,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2999,
25657,
1881,
29892,
322,
4078,
29918,
294,
3342,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2999,
7726,
414,
29892,
322,
385,
1962,
10422,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
29892,
4257,
5149,
29892,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
20787,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
1688,
29918,
11249,
29889,
1514,
29916,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29892,
4078,
29918,
294,
29922,
4905,
29918,
1445,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
703,
15425,
29889,
2732,
1159,
13,
13,
13,
1753,
1243,
29918,
20787,
29918,
5965,
21079,
29918,
2541,
29918,
7620,
29918,
294,
29918,
2541,
29918,
7050,
29918,
3972,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2999,
25657,
1881,
29892,
322,
4078,
29918,
294,
3342,
29892,
322,
13128,
29918,
3972,
3342,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2999,
7726,
414,
29892,
322,
385,
1962,
10422,
29892,
322,
263,
2044,
519,
13128,
3884,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
29892,
411,
263,
8727,
29892,
4257,
5149,
29892,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
20787,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
1688,
29918,
11249,
29889,
1514,
29916,
29908,
13,
1678,
13128,
29918,
3972,
353,
5591,
7050,
12975,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29892,
4078,
29918,
294,
29922,
4905,
29918,
1445,
29892,
13128,
29918,
3972,
29922,
7050,
29918,
3972,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
7050,
29918,
3972,
13578,
15425,
29889,
2732,
613,
2897,
29889,
29943,
29918,
8949,
511,
376,
14732,
934,
451,
1476,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
29898,
7050,
29918,
3972,
13578,
15425,
29889,
2732,
1159,
13,
13,
13,
1753,
1243,
29918,
14369,
29918,
5965,
5790,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2323,
25657,
1881,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2323,
25657,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
14369,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
11249,
29918,
14369,
29889,
1514,
29916,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
703,
15425,
29889,
2732,
1159,
13,
13,
13,
1753,
1243,
29918,
14369,
29918,
5965,
5790,
29918,
2541,
29918,
7620,
29918,
294,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2323,
25657,
1881,
29892,
322,
4078,
29918,
294,
3342,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2323,
25657,
29892,
322,
385,
1962,
10422,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
29892,
4257,
5149,
29892,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
14369,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
1688,
29918,
11249,
29889,
1514,
29916,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29892,
4078,
29918,
294,
29922,
4905,
29918,
1445,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
703,
15425,
29889,
2732,
1159,
13,
13,
13,
1753,
1243,
29918,
14369,
29918,
5965,
5790,
29918,
2541,
29918,
7620,
29918,
294,
29918,
2541,
29918,
7050,
29918,
3972,
7295,
13,
1678,
9995,
13,
1678,
4321,
1962,
4864,
411,
2323,
25657,
1881,
29892,
322,
4078,
29918,
294,
3342,
29892,
322,
13128,
29918,
3972,
3342,
13,
13,
1678,
396,
402,
5667,
1430,
263,
4559,
934,
6943,
2323,
25657,
29892,
322,
385,
1962,
10422,
29892,
322,
263,
2044,
519,
13128,
3884,
13,
1678,
396,
17980,
5432,
260,
13086,
29889,
3539,
29077,
13,
1678,
396,
8183,
7738,
278,
869,
1514,
29916,
29892,
411,
263,
8727,
29892,
4257,
5149,
29892,
1728,
4436,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
786,
13,
1678,
1881,
29918,
1445,
353,
376,
11249,
29918,
14369,
29889,
3126,
29908,
13,
1678,
1962,
29918,
1445,
353,
376,
1688,
29918,
11249,
29889,
1514,
29916,
29908,
13,
1678,
13128,
29918,
3972,
353,
5591,
7050,
12975,
13,
1678,
4974,
2897,
29889,
5943,
29898,
2080,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
4290,
934,
451,
1476,
29908,
13,
13,
1678,
396,
6680,
13,
1678,
260,
13086,
29889,
3539,
29898,
2080,
29918,
1445,
29892,
4078,
29918,
294,
29922,
4905,
29918,
1445,
29892,
13128,
29918,
3972,
29922,
7050,
29918,
3972,
29897,
13,
1678,
4974,
2897,
29889,
5943,
29898,
7050,
29918,
3972,
13578,
15425,
29889,
2732,
613,
2897,
29889,
29943,
29918,
8949,
511,
376,
14732,
934,
451,
1476,
29908,
13,
1678,
4974,
2897,
29889,
5943,
29898,
4905,
29918,
1445,
29892,
2897,
29889,
29943,
29918,
8949,
511,
376,
6466,
934,
451,
1476,
29908,
13,
13,
1678,
396,
1920,
538,
776,
13,
1678,
2897,
29889,
5992,
29898,
4905,
29918,
1445,
29897,
13,
1678,
2897,
29889,
5992,
29898,
7050,
29918,
3972,
13578,
15425,
29889,
2732,
1159,
2
] |
src/badd/__init__.py | wksmirnowa/badd | 1 | 145161 | <filename>src/badd/__init__.py<gh_stars>1-10
from .ad import AdDetector
from .toxic import ToxicDetector
from .obscene import ObsceneDetector
from .file_loader import FileLoader
| [
1,
529,
9507,
29958,
4351,
29914,
29890,
1202,
29914,
1649,
2344,
26914,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
869,
328,
1053,
2087,
6362,
3019,
13,
3166,
869,
517,
27375,
1053,
1763,
27375,
6362,
3019,
13,
3166,
869,
711,
24645,
1053,
4250,
24645,
6362,
3019,
13,
3166,
869,
1445,
29918,
12657,
1053,
3497,
10036,
13,
2
] |
simpleml/classifiers/decisiontree.py | get9/ml-test | 1 | 1602078 | <gh_stars>1-10
import sys
import numpy as np
from .baseclassifier import BaseClassifier
# Calculate gini impurity of vector {f}
def gini(f):
return 1.0 - np.sum(np.square(f))
# Score the split given by {splitval} on {dim} according to gini impurity
def score_split(splitval, dim, left, right):
N = len(left) + len(right)
fleft = np.bincount(left[:, 2].astype(np.int)) + np.finfo(float).eps
fleft /= np.sum(fleft)
fright = np.bincount(right[:, 2].astype(np.int)) + np.finfo(float).eps
fright /= np.sum(fright)
return (len(left) * gini(fleft) + len(right) * gini(fright)) / N
# Splits dataset {d} according to {splitval} on {dim}
def split(splitval, dim, d):
assert dim < len(d[0]) - 1
return d[d[:, dim] < splitval], d[d[:, dim] >= splitval]
# A node in the decision tree
class DTNode:
def __init__(self, val, left=None, right=None, feature_idx=-1):
self.val = val
self.left = left
self.right = right
self.feature_idx = feature_idx
def __str__(self):
return "val = {}; feature_idx = {}".format(self.val, self.feature_idx)
# Main decision tree class
class DecisionTree(BaseClassifier):
def __init__(self, depth=3, nsplits=100):
super().__init__()
self.t = None
self.depth = depth
self.nsplits = nsplits
# Main entry point for recursive call that builds the tree
def train(self, dataset):
self.t = self.train_internal(dataset, self.depth, list(range(len(dataset[0]) - 1)))
# Recursive training method. Stops when no more dimensions to condition
def train_internal(self, dataset, depth, dims):
# Base case: we're at a leaf, so return whichever label is more common
labelcount = np.bincount(dataset[:, 2].astype(np.int))
if depth == 0 or labelcount.max() == len(dataset):
ret = DTNode(np.argmax(labelcount))
assert ret.val == 0 or ret.val == 1
return ret
best_split_val = None
best_split_dim = None
best_left = np.array([])
best_right = np.array([])
best_score = 1.0
# For each dimension, check every possible split and see if it's best
# When we find the best split after going through all dimensions and
# all possible splits, remove that dimension from further consideration
for i in range(len(dims)):
col = dataset[:, i]
splits = np.linspace(np.min(col), np.max(col), self.nsplits)
for j in range(len(splits)):
left, right = split(splits[j], dims[i], dataset)
score = score_split(splits[j], dims[i], left, right)
if score < best_score:
best_score = score
best_split_val = splits[j]
best_split_dim = dims[i]
best_left = left
best_right = right
# Recurse
assert score != 1.0
left_node = self.train_internal(best_left, depth-1, dims)
right_node = self.train_internal(best_right, depth-1, dims)
return DTNode(best_split_val, left=left_node, right=right_node,
feature_idx=best_split_dim)
def print_tree(self):
self.print_tree_r(self.t)
def print_tree_r(self, node, indent=''):
if not node:
return
print(indent + str(node))
self.print_tree_r(node.left, indent+' ')
self.print_tree_r(node.right, indent+' ')
def predict(self, points):
predicted_l = np.empty((len(points)), dtype=np.int)
for i in range(len(points)):
predicted_l[i] = self.predict_single(points[i])
return predicted_l
def predict_single(self, point):
assert self.t != None
currnode = self.t
while currnode.feature_idx > -1:
if point[currnode.feature_idx] <= currnode.val:
currnode = currnode.left
else:
currnode = currnode.right
return currnode.val
def error(self, predicted, actual):
return np.count_nonzero(np.abs(predicted - actual)) / len(predicted)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
10876,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
869,
3188,
1990,
3709,
1053,
7399,
2385,
3709,
13,
13,
29937,
20535,
403,
330,
2172,
2411,
7710,
310,
4608,
426,
29888,
29913,
13,
1753,
330,
2172,
29898,
29888,
1125,
13,
1678,
736,
29871,
29896,
29889,
29900,
448,
7442,
29889,
2083,
29898,
9302,
29889,
17619,
29898,
29888,
876,
13,
13,
29937,
2522,
487,
278,
6219,
2183,
491,
426,
5451,
791,
29913,
373,
426,
6229,
29913,
5034,
304,
330,
2172,
2411,
7710,
13,
1753,
8158,
29918,
5451,
29898,
5451,
791,
29892,
3964,
29892,
2175,
29892,
1492,
1125,
13,
1678,
405,
353,
7431,
29898,
1563,
29897,
718,
7431,
29898,
1266,
29897,
13,
1678,
285,
1563,
353,
7442,
29889,
2109,
2798,
29898,
1563,
7503,
29892,
29871,
29906,
1822,
579,
668,
29898,
9302,
29889,
524,
876,
718,
7442,
29889,
29888,
3888,
29898,
7411,
467,
8961,
13,
1678,
285,
1563,
847,
29922,
7442,
29889,
2083,
29898,
29888,
1563,
29897,
13,
1678,
22739,
353,
7442,
29889,
2109,
2798,
29898,
1266,
7503,
29892,
29871,
29906,
1822,
579,
668,
29898,
9302,
29889,
524,
876,
718,
7442,
29889,
29888,
3888,
29898,
7411,
467,
8961,
13,
1678,
22739,
847,
29922,
7442,
29889,
2083,
29898,
29888,
1266,
29897,
13,
1678,
736,
313,
2435,
29898,
1563,
29897,
334,
330,
2172,
29898,
29888,
1563,
29897,
718,
7431,
29898,
1266,
29897,
334,
330,
2172,
29898,
29888,
1266,
876,
847,
405,
13,
13,
29937,
317,
572,
1169,
8783,
426,
29881,
29913,
5034,
304,
426,
5451,
791,
29913,
373,
426,
6229,
29913,
13,
1753,
6219,
29898,
5451,
791,
29892,
3964,
29892,
270,
1125,
13,
1678,
4974,
3964,
529,
7431,
29898,
29881,
29961,
29900,
2314,
448,
29871,
29896,
13,
1678,
736,
270,
29961,
29881,
7503,
29892,
3964,
29962,
529,
6219,
791,
1402,
270,
29961,
29881,
7503,
29892,
3964,
29962,
6736,
6219,
791,
29962,
13,
13,
13,
29937,
319,
2943,
297,
278,
10608,
5447,
13,
1990,
360,
29911,
4247,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
659,
29892,
2175,
29922,
8516,
29892,
1492,
29922,
8516,
29892,
4682,
29918,
13140,
10457,
29896,
1125,
13,
4706,
1583,
29889,
791,
353,
659,
13,
4706,
1583,
29889,
1563,
353,
2175,
13,
4706,
1583,
29889,
1266,
353,
1492,
13,
4706,
1583,
29889,
14394,
29918,
13140,
353,
4682,
29918,
13140,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
376,
791,
353,
15739,
4682,
29918,
13140,
353,
6571,
1642,
4830,
29898,
1311,
29889,
791,
29892,
1583,
29889,
14394,
29918,
13140,
29897,
13,
13,
29937,
4241,
10608,
5447,
770,
13,
1990,
3826,
2459,
9643,
29898,
5160,
2385,
3709,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10809,
29922,
29941,
29892,
17534,
572,
1169,
29922,
29896,
29900,
29900,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29873,
353,
6213,
13,
4706,
1583,
29889,
19488,
353,
10809,
13,
4706,
1583,
29889,
1983,
572,
1169,
353,
17534,
572,
1169,
13,
13,
1678,
396,
4241,
6251,
1298,
363,
16732,
1246,
393,
23315,
278,
5447,
13,
1678,
822,
7945,
29898,
1311,
29892,
8783,
1125,
13,
4706,
1583,
29889,
29873,
353,
1583,
29889,
14968,
29918,
7564,
29898,
24713,
29892,
1583,
29889,
19488,
29892,
1051,
29898,
3881,
29898,
2435,
29898,
24713,
29961,
29900,
2314,
448,
29871,
29896,
4961,
13,
13,
1678,
396,
3599,
25397,
6694,
1158,
29889,
624,
3554,
746,
694,
901,
13391,
304,
4195,
13,
1678,
822,
7945,
29918,
7564,
29898,
1311,
29892,
8783,
29892,
10809,
29892,
3964,
29879,
1125,
13,
4706,
396,
7399,
1206,
29901,
591,
29915,
276,
472,
263,
20447,
29892,
577,
736,
377,
4070,
369,
3858,
338,
901,
3619,
13,
4706,
3858,
2798,
353,
7442,
29889,
2109,
2798,
29898,
24713,
7503,
29892,
29871,
29906,
1822,
579,
668,
29898,
9302,
29889,
524,
876,
13,
4706,
565,
10809,
1275,
29871,
29900,
470,
3858,
2798,
29889,
3317,
580,
1275,
7431,
29898,
24713,
1125,
13,
9651,
3240,
353,
360,
29911,
4247,
29898,
9302,
29889,
1191,
3317,
29898,
1643,
2798,
876,
13,
9651,
4974,
3240,
29889,
791,
1275,
29871,
29900,
470,
3240,
29889,
791,
1275,
29871,
29896,
13,
9651,
736,
3240,
13,
13,
4706,
1900,
29918,
5451,
29918,
791,
353,
6213,
13,
4706,
1900,
29918,
5451,
29918,
6229,
353,
6213,
13,
4706,
1900,
29918,
1563,
418,
353,
7442,
29889,
2378,
4197,
2314,
13,
4706,
1900,
29918,
1266,
268,
353,
7442,
29889,
2378,
4197,
2314,
13,
4706,
1900,
29918,
13628,
268,
353,
29871,
29896,
29889,
29900,
13,
13,
4706,
396,
1152,
1269,
9927,
29892,
1423,
1432,
1950,
6219,
322,
1074,
565,
372,
29915,
29879,
1900,
13,
4706,
396,
1932,
591,
1284,
278,
1900,
6219,
1156,
2675,
1549,
599,
13391,
322,
13,
4706,
396,
599,
1950,
8536,
1169,
29892,
3349,
393,
9927,
515,
4340,
19220,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
6229,
29879,
22164,
13,
9651,
784,
353,
8783,
7503,
29892,
474,
29962,
13,
9651,
8536,
1169,
353,
7442,
29889,
1915,
3493,
29898,
9302,
29889,
1195,
29898,
1054,
511,
7442,
29889,
3317,
29898,
1054,
511,
1583,
29889,
1983,
572,
1169,
29897,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
23579,
1169,
22164,
13,
18884,
2175,
29892,
1492,
353,
6219,
29898,
23579,
1169,
29961,
29926,
1402,
3964,
29879,
29961,
29875,
1402,
8783,
29897,
13,
18884,
8158,
353,
8158,
29918,
5451,
29898,
23579,
1169,
29961,
29926,
1402,
3964,
29879,
29961,
29875,
1402,
2175,
29892,
1492,
29897,
13,
18884,
565,
8158,
529,
1900,
29918,
13628,
29901,
13,
462,
1678,
1900,
29918,
13628,
268,
353,
8158,
13,
462,
1678,
1900,
29918,
5451,
29918,
791,
353,
8536,
1169,
29961,
29926,
29962,
13,
462,
1678,
1900,
29918,
5451,
29918,
6229,
353,
3964,
29879,
29961,
29875,
29962,
13,
462,
1678,
1900,
29918,
1563,
418,
353,
2175,
13,
462,
1678,
1900,
29918,
1266,
268,
353,
1492,
13,
13,
4706,
396,
3599,
332,
344,
13,
4706,
4974,
8158,
2804,
29871,
29896,
29889,
29900,
13,
4706,
2175,
29918,
3177,
29871,
353,
1583,
29889,
14968,
29918,
7564,
29898,
13318,
29918,
1563,
29892,
10809,
29899,
29896,
29892,
3964,
29879,
29897,
13,
4706,
1492,
29918,
3177,
353,
1583,
29889,
14968,
29918,
7564,
29898,
13318,
29918,
1266,
29892,
10809,
29899,
29896,
29892,
3964,
29879,
29897,
13,
4706,
736,
360,
29911,
4247,
29898,
13318,
29918,
5451,
29918,
791,
29892,
2175,
29922,
1563,
29918,
3177,
29892,
1492,
29922,
1266,
29918,
3177,
29892,
13,
18884,
4682,
29918,
13140,
29922,
13318,
29918,
5451,
29918,
6229,
29897,
13,
13,
1678,
822,
1596,
29918,
8336,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2158,
29918,
8336,
29918,
29878,
29898,
1311,
29889,
29873,
29897,
13,
13,
1678,
822,
1596,
29918,
8336,
29918,
29878,
29898,
1311,
29892,
2943,
29892,
29536,
2433,
29374,
13,
4706,
565,
451,
2943,
29901,
13,
9651,
736,
13,
4706,
1596,
29898,
12860,
718,
851,
29898,
3177,
876,
13,
4706,
1583,
29889,
2158,
29918,
8336,
29918,
29878,
29898,
3177,
29889,
1563,
29892,
29536,
23097,
29871,
25710,
13,
4706,
1583,
29889,
2158,
29918,
8336,
29918,
29878,
29898,
3177,
29889,
1266,
29892,
29536,
23097,
29871,
25710,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
3291,
1125,
13,
4706,
25383,
29918,
29880,
353,
7442,
29889,
6310,
3552,
2435,
29898,
9748,
8243,
26688,
29922,
9302,
29889,
524,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
9748,
22164,
13,
9651,
25383,
29918,
29880,
29961,
29875,
29962,
353,
1583,
29889,
27711,
29918,
14369,
29898,
9748,
29961,
29875,
2314,
13,
4706,
736,
25383,
29918,
29880,
13,
13,
1678,
822,
8500,
29918,
14369,
29898,
1311,
29892,
1298,
1125,
13,
4706,
4974,
1583,
29889,
29873,
2804,
6213,
13,
4706,
16256,
3177,
353,
1583,
29889,
29873,
13,
4706,
1550,
16256,
3177,
29889,
14394,
29918,
13140,
1405,
448,
29896,
29901,
13,
9651,
565,
1298,
29961,
21962,
3177,
29889,
14394,
29918,
13140,
29962,
5277,
16256,
3177,
29889,
791,
29901,
13,
18884,
16256,
3177,
353,
16256,
3177,
29889,
1563,
13,
9651,
1683,
29901,
13,
18884,
16256,
3177,
353,
16256,
3177,
29889,
1266,
13,
4706,
736,
16256,
3177,
29889,
791,
13,
13,
1678,
822,
1059,
29898,
1311,
29892,
25383,
29892,
3935,
1125,
13,
4706,
736,
7442,
29889,
2798,
29918,
5464,
9171,
29898,
9302,
29889,
6897,
29898,
11965,
18186,
448,
3935,
876,
847,
7431,
29898,
11965,
18186,
29897,
13,
13,
2
] |
code/custom_utils.py | dataspider/momo | 4 | 63097 | import functools
import json
import re
from collections import Counter
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from statics import STRUCTURE_TYPES
sns.set_style("whitegrid")
plt.rcParams["figure.figsize"] = (18, 12)
plt.rcParams["font.size"] = 12
np.random.seed(1234)
def get_jaccard(structure1, structure2, structure_type):
if structure_type == "clique":
nodes1 = set(structure1["nodes"])
nodes2 = set(structure2["nodes"])
overlap = nodes1.intersection(nodes2)
union = nodes1.union(nodes2)
return len(overlap) / len(union)
if structure_type in ["biclique", "starclique"]:
left1, left2 = set(structure1["left_nodes"]), set(structure2["left_nodes"])
right1, right2 = set(structure1["right_nodes"]), set(structure2["right_nodes"])
left_overlap = left1.intersection(left2)
left_union = left1.union(left2)
right_overlap = right1.intersection(right2)
right_union = right1.union(right2)
return (
len(left_overlap) / len(left_union) + len(right_overlap) / len(right_union)
) / 2
if structure_type == "star":
hub1, hub2 = {structure1["hub"]}, {structure2["hub"]}
spokes1, spokes2 = set(structure1["spokes"]), set(structure2["spokes"])
hub_overlap = hub1.intersection(hub2)
hub_union = hub1.union(hub2)
spoke_overlap = spokes1.intersection(spokes2)
spoke_union = spokes1.union(spokes2)
return (
len(hub_overlap) / len(hub_union) + len(spoke_overlap) / len(spoke_union)
) / 2
raise Exception(f"Unknown structure type: {structure_type}!")
def get_dataset_color(dataset):
if dataset.startswith("ors") or dataset.startswith("asb"):
return "dodgerblue"
elif dataset.startswith("orp") or dataset.startswith("asp"):
return "lightskyblue"
elif dataset.startswith("usl") or dataset.startswith("lus"):
return "r"
elif dataset.startswith("del") or dataset.startswith("lde"):
return "darkorange"
elif dataset.startswith("clg"):
return "purple"
elif dataset.startswith("csi"):
return "magenta"
elif "bio$_{\mathcal{A}}" in dataset:
return "green"
elif dataset.startswith("bio\n") or dataset.startswith("bio"):
return "g"
elif dataset.startswith("bag") or dataset.startswith("rba"):
return "gray"
elif dataset.startswith("erg") or dataset.startswith("rer"):
return "darkgray"
else:
raise Exception(dataset)
def load_json(file):
"""
load a json file as a dictionary
"""
with open(file) as f:
model_json = json.load(f)
return model_json
def load_log(file):
"""
load a log file as a list of log file lines
"""
with open(file) as f:
model_log = f.read().split("\n")
return model_log
def create_df(model_json):
"""
convert the model json computed by julia into a pd.DataFrame
"""
tuples = list(
zip(
model_json["macro_structures"],
model_json["macro_structure_description_lengths"],
model_json["description_lengths_over_time"],
)
)
df = pd.DataFrame(
tuples, columns=["structure", "structure_cost", "description_length"]
)
df["n_edges_total"] = [
x.get("n_edges_total", model_json["m"]) for x in df.structure
]
df["n_nodes_total"] = [
x.get("n_nodes_total", model_json["n"]) for x in df.structure
]
df["structure_type"] = [x.get("structure_type") for x in df.structure]
df["structure_shape"] = [
get_node_marker(x) if x in STRUCTURE_TYPES else "X" for x in df.structure_type
]
df["structure_color"] = [
get_node_color(x) if x in STRUCTURE_TYPES else "k" for x in df.structure_type
]
return df
def create_progression_plot(df, save_path=None):
"""
position of structure in the sequence on x, description length after adding structure on y, color signaling structure type, size signalling number of edges
"""
scattertuples = list(
zip(
df.index - 1,
df.description_length / df.description_length.max(),
df.n_edges_total,
df.structure_color,
df.structure_shape,
)
)
for t in reversed(scattertuples[1:]):
plt.scatter(t[0], t[1], s=t[2] if t[3] != "k" else 10, c=t[3], marker="o")
plt.xticks(range(0, len(scattertuples[1:]) + 1, 2))
plt.xlim(-1, len(scattertuples[1:]) + 1)
plt.xlabel("Selected structure")
plt.ylabel("Total description length after structure selected")
plt.title(save_path)
plt.tight_layout()
if save_path is not None:
plt.savefig(save_path)
plt.close()
def create_size_plot(model_json, x_granularity, y_granularity, save_path=None):
"""
number of nodes on x, number of edges on y, color signaling structure type
"""
structure_types, n_nodes, n_edges = list(
zip(
*(
[
(s["structure_type"], s.get("n_nodes_total", 0), s["n_edges_total"])
for s in model_json["macro_structures"]
]
)
)
)
plt.scatter(
n_nodes[2:],
n_edges[2:],
c=list(map(get_node_color, structure_types[2:])),
)
plt.xlabel("Number of Nodes")
plt.xticks(range(0, max(n_nodes[2:]) + x_granularity, x_granularity))
plt.yticks(range(0, max(n_edges[2:]) + y_granularity, y_granularity))
plt.ylim(0, max(n_edges[2:]) + y_granularity)
plt.ylabel("Number of Edges")
plt.title(save_path)
plt.tight_layout()
if save_path is not None:
plt.savefig(save_path)
plt.close()
def get_structures_added(model_json):
"""
return list of dicts, with each dict a structure added in the model building process (i.e., generic structures are excluded)
"""
return model_json["macro_structures"][2:]
def get_node_sets(structures_added):
"""
return a list of lists, with each inner list holding the nodes of a structure
"""
return [_get_nodes(structure) for structure in structures_added]
def _get_nodes(structure):
"""
helper for get_node_sets
"""
if structure["structure_type"] in ["biclique", "starclique"]:
return structure["left_nodes"] + structure["right_nodes"]
elif structure["structure_type"] == "clique":
return structure["nodes"]
elif structure["structure_type"] == "star":
return [structure["hub"]] + structure["spokes"]
else:
raise Exception(f"Unknown structure type {structure['structure_type']}!")
def get_structure_dfs(structures_added, node_sets):
"""
return two pd.DataFrame objects encoding the node overlap between structures: abs_df (# nodes in the overlap), rel_df (jaccard similarity)
"""
abs_df = pd.DataFrame(
index=range(len(structures_added)),
columns=range(len(structures_added)),
data=np.nan,
)
rel_df = pd.DataFrame(
index=range(len(structures_added)),
columns=range(len(structures_added)),
data=np.nan,
)
for idx in range(0, len(node_sets) - 1):
for idx2 in range(idx + 1, len(node_sets)):
abs_df.at[idx, idx2] = len(
set(node_sets[idx]).intersection(set(node_sets[idx2]))
)
abs_df.at[idx2, idx] = abs_df.at[idx, idx2]
rel_df.at[idx, idx2] = len(
set(node_sets[idx]).intersection(set(node_sets[idx2]))
) / len(set(node_sets[idx]).union(set(node_sets[idx2])))
rel_df.at[idx2, idx] = rel_df.at[idx, idx2]
return abs_df, rel_df
def _get_n_nodes_covered(node_sets):
"""
helper for get_fraction_nodes_covered
"""
return len(set(functools.reduce(lambda x, y: x + y, node_sets, [])))
def get_fraction_nodes_covered(node_sets, model_json):
return _get_n_nodes_covered(node_sets) / model_json["n"]
def plot_overlap_heatmap(df, save_path=None):
"""
structures added to model on x and y, similarity as per df as color, default colormap, robust=False
"""
sns.heatmap(df, square=True)
if save_path is not None:
plt.savefig(save_path)
plt.close()
def create_rooted_bfs_tree(df, layout=False):
G = nx.Graph(df.fillna(0))
maxst = nx.tree.maximum_spanning_tree(G)
artificial_root = G.number_of_nodes()
ccs = list(nx.connected_components(G))
for c in ccs:
component_subgraph = maxst.subgraph(c)
component_root = max(nx.degree(component_subgraph), key=lambda tup: tup[-1])[
0
] # node with max unweighted degree
maxst.add_edge(artificial_root, component_root, weight=np.finfo(float).eps)
tree = nx.traversal.bfs_tree(maxst, artificial_root)
for e in tree.edges():
tree.edges[e]["weight"] = maxst.edges[e]["weight"]
if layout:
pos = nx.layout.kamada_kawai_layout(maxst, weight=None)
return tree, pos
else:
return tree
def add_tree_layout(G, root, node_sep, level_sep):
for node in G.nodes():
G.nodes[node]["y"] = -level_sep * nx.dijkstra_path_length(
G, root, node, weight=None
)
base = 0
for node in nx.dfs_postorder_nodes(G, root):
succ = sorted(list(G.successors(node)), reverse=True)
if len(succ) < 1:
G.nodes[node]["x"] = base + node_sep
base += node_sep
else:
xmin = min([G.nodes[node]["x"] for node in succ])
xmax = max([G.nodes[node]["x"] for node in succ])
G.nodes[node]["x"] = xmin + (xmax - xmin) / 2
for node in G.nodes:
G.nodes[node]["x"] = -G.nodes[node]["x"]
return G
def add_color(G, df):
for node in G.nodes():
G.nodes[node]["color"] = (
df.at[node + 2, "structure_color"] if node != len(df) - 2 else "k"
)
return G
def plot_tree(G, df, save_path=None):
G = add_color(G, df)
_, ax = plt.subplots(1, 1, figsize=(12, 12))
for node in G.nodes():
x = G.nodes[node]["x"]
y = G.nodes[node]["y"]
color = G.nodes[node]["color"]
for succ in G.successors(node):
ax.plot(
[x, G.nodes[succ]["x"]],
[y, G.nodes[succ]["y"]],
"-k",
linewidth=max(G.edges[node, succ]["weight"] * 10, 1),
zorder=1,
alpha=1,
)
ax.scatter(
x,
y,
color=color,
s=df.at[node + 2, "n_nodes_total"] * 6 if node != len(df) - 2 else 300,
marker=df.at[node + 2, "structure_shape"] if node != len(df) - 2 else "X",
zorder=2,
alpha=1,
)
# if node != len(df) - 2:
# ax.annotate(node + 1, (x, y), fontsize=10, ha="center", va="center")
plt.tick_params(left=False, labelleft=False, bottom=False, labelbottom=False)
plt.axis("off")
plt.tight_layout()
if save_path is not None:
plt.savefig(save_path, transparent=True, bbox_inches="tight")
plt.close()
def plot_structure_tree(tree, layout, df, save_path=None):
"""
plot structure tree in basic kamada kawai layout;
structure identifiers in order of structure addition and color corresponding to structure type (artificial root node black)
"""
nx.draw_networkx_edges(tree, pos=layout)
for node, (x, y) in layout.items():
plt.scatter(
x,
y,
color=df.at[node + 2, "structure_color"] if node != len(df) - 2 else "k",
s=df.at[node + 2, "n_nodes_total"] * 6 if node != len(df) - 2 else 100,
marker=df.at[node + 2, "structure_shape"] if node != len(df) - 2 else "X",
zorder=2,
alpha=0.8,
)
labels = {idx: idx + 1 for idx in tree.nodes()}
nx.draw_networkx_labels(tree, pos=layout, labels=labels)
plt.axis("off")
if save_path is not None:
plt.savefig(save_path)
plt.close()
def write_plots_for_model_json(
json_path,
save_base,
x_granularity_size,
y_granularity_size,
):
"""
end-to-end plot generation for json file at given json_path
"""
print(f"Starting {json_path}...")
model_json = load_json(json_path)
save_base = save_base.split("_size")[0]
df = create_df(model_json)
df.to_csv(re.sub("figure", "structures", save_base) + ".csv", index=False)
structures_added = get_structures_added(model_json)
node_sets = get_node_sets(structures_added)
try:
abs_df, rel_df = get_structure_dfs(structures_added, node_sets)
rel_df.to_csv(re.sub("figure", "structure_overlap_matrix", save_base) + ".csv")
tree, layout = create_rooted_bfs_tree(rel_df, layout=True)
plot_tree(
add_tree_layout(tree, tree.number_of_nodes() - 1, 10, 10),
df,
re.sub("figure", "tree-hierarchical", save_base) + ".pdf",
)
plot_structure_tree(
tree, layout, df, re.sub("figure", "tree-kamada", save_base) + ".pdf"
)
G = create_overlap_quotient_graph(structures_added, abs_df, model_json["n"])
plot_overlap_quotient_graph(
G,
df,
model_json["n"],
re.sub("figure", "overlap-quotient", save_base) + ".pdf",
)
G = create_structure_quotient_graph(node_sets, save_base)
plot_structure_quotient_graph(
G,
node_sets,
structures_added,
save_path=re.sub("figure", "structure-quotient", save_base) + ".pdf",
)
except:
print(
f"Error for overlap dataframes or graph plots: {json_path} - moving on..."
)
try:
create_progression_plot(
df,
re.sub("figure", "progress", save_base) + ".pdf",
)
except:
print(f"Error for progression plot: {json_path} - moving on...")
try:
create_size_plot(
model_json,
x_granularity_size,
y_granularity_size,
re.sub("figure", "sizes", save_base) + ".pdf",
)
except:
print(f"Error for size plot: {json_path} - moving on...")
def get_edgelist_separator(edgelist_path):
with open(edgelist_path) as f:
for line in f:
if not line.startswith("#"):
if "\t" in line:
return "\t"
elif "," in line:
return ","
elif " " in line:
return " "
else:
raise
def create_structure_quotient_graph(nodes, save_base):
nodemap_path = (
re.sub("figure-", "", re.sub("graphics/", "results/", save_base))
+ "-nodemap.csv"
)
nodemap = pd.read_csv(nodemap_path)
edgelist_path = (
re.sub("figure-", "", re.sub("graphics/", "data/", save_base)) + ".txt"
)
edges = pd.read_csv(
edgelist_path,
sep=get_edgelist_separator(edgelist_path),
comment="#",
header=None,
usecols=[0, 1],
).rename({0: "u", 1: "v"}, axis=1)
new_edges = edges.merge(nodemap, left_on="u", right_on="original_id").merge(
nodemap, left_on="v", right_on="original_id", suffixes=("_u", "_v")
)[["julia_id_u", "julia_id_v"]]
assert len(edges) == len(new_edges)
nodes_to_structures = get_nodes_to_structures(nodes)
G = nx.MultiGraph()
G.add_nodes_from(range(1, len(nodes) + 1))
for u, v in zip(new_edges.julia_id_u, new_edges.julia_id_v):
u_structures = nodes_to_structures.get(u, [])
v_structures = nodes_to_structures.get(v, [])
if (
u_structures
and v_structures
and not set(u_structures).intersection(v_structures)
):
for us in u_structures:
for vs in v_structures:
G.add_edge(us, vs)
wG = nx.Graph()
wG.add_nodes_from(G.nodes())
wG.add_weighted_edges_from([(*k, v) for k, v in dict(Counter(G.edges())).items()])
return wG
def get_nodes_to_structures(nodes):
nodes_to_structures = {}
for idx, nodeset in enumerate(nodes, start=1):
for node in nodeset:
nodes_to_structures[node] = nodes_to_structures.get(node, []) + [idx]
return nodes_to_structures
def get_node_color(node_type):
if node_type == "star":
return "orange"
elif node_type == "clique":
return "dodgerblue"
elif node_type == "biclique":
return "#BE271A" # red3
elif node_type == "starclique":
return "orchid"
else:
raise
def get_node_marker(node_type):
if node_type == "star":
return "^"
elif node_type == "clique":
return "o"
elif node_type == "biclique":
return "s"
elif node_type == "starclique":
return "d"
else:
raise
def plot_structure_quotient_graph(wG, nodes, structures, save_path=None):
pos = nx.layout.fruchterman_reingold_layout(wG, k=2.5, seed=0)
_ = plt.figure(figsize=(12, 12))
nx.draw_networkx_edges(
wG,
pos=pos,
edgelist=wG.edges(),
width=[w / 100 for u, v, w in wG.edges(data="weight")],
)
for node in wG.nodes():
plt.scatter(
*pos[node],
s=len(nodes[node - 1]) * 5,
c=get_node_color(structures[node - 1]["structure_type"]),
marker=get_node_marker(structures[node - 1]["structure_type"]),
)
nx.draw_networkx_labels(wG, pos, zorder=100)
plt.axis("off")
plt.tight_layout()
if save_path is not None:
plt.savefig(save_path)
plt.close()
def create_overlap_quotient_graph(structures_added, abs_df, n_total):
G = nx.Graph()
for idx, structure in enumerate(structures_added, start=1):
G.add_node(
idx, **{**structure, "n_relative": structure["n_nodes_total"] / n_total}
)
for i in range(len(abs_df)):
for j in range(i + 1, len(abs_df)):
edge_weight = abs_df.at[i, j] / n_total
if edge_weight > 0:
G.add_edge(i + 1, j + 1, weight=edge_weight)
return G
def plot_overlap_quotient_graph(G, df, n_total, save_path=None):
np.random.seed(1234)
pos = nx.layout.fruchterman_reingold_layout(G)
_, ax = plt.subplots(1, 1, figsize=(12, 12))
for x, y, w in G.edges(data="weight"):
if w * n_total > 1:
ax.plot(
[pos[x][0], pos[y][0]],
[pos[x][1], pos[y][1]],
"-k",
linewidth=w * n_total / 100,
zorder=-10,
alpha=0.5,
)
for node in G.nodes(data=True):
ax.scatter(
*pos[node[0]],
s=5.0 * node[1]["n_nodes_total"],
c=df.at[node[0] + 1, "structure_color"],
marker=df.at[node[0] + 1, "structure_shape"],
zorder=1,
)
nx.draw_networkx_labels(G, pos, zorder=100)
plt.axis("off")
plt.tight_layout()
if save_path is not None:
plt.savefig(save_path, transparent=True)
plt.close()
| [
1,
1053,
2090,
312,
8789,
13,
5215,
4390,
13,
5215,
337,
13,
3166,
16250,
1053,
315,
5336,
13,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
3564,
29916,
408,
302,
29916,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
409,
370,
1398,
408,
269,
1983,
13,
13,
3166,
1002,
1199,
1053,
29486,
29965,
1783,
11499,
29918,
15631,
29925,
2890,
13,
13,
29879,
1983,
29889,
842,
29918,
3293,
703,
1332,
277,
387,
2429,
1159,
13,
572,
29873,
29889,
2214,
9629,
3366,
4532,
29889,
1003,
2311,
3108,
353,
313,
29896,
29947,
29892,
29871,
29896,
29906,
29897,
13,
572,
29873,
29889,
2214,
9629,
3366,
5657,
29889,
2311,
3108,
353,
29871,
29896,
29906,
13,
9302,
29889,
8172,
29889,
26776,
29898,
29896,
29906,
29941,
29946,
29897,
13,
13,
13,
1753,
679,
29918,
29926,
5753,
538,
29898,
23905,
29896,
29892,
3829,
29906,
29892,
3829,
29918,
1853,
1125,
13,
1678,
565,
3829,
29918,
1853,
1275,
376,
29883,
9854,
1115,
13,
4706,
7573,
29896,
353,
731,
29898,
23905,
29896,
3366,
18010,
20068,
13,
4706,
7573,
29906,
353,
731,
29898,
23905,
29906,
3366,
18010,
20068,
13,
4706,
25457,
353,
7573,
29896,
29889,
1639,
2042,
29898,
18010,
29906,
29897,
13,
4706,
9833,
353,
7573,
29896,
29889,
13094,
29898,
18010,
29906,
29897,
13,
4706,
736,
7431,
29898,
957,
6984,
29897,
847,
7431,
29898,
13094,
29897,
13,
1678,
565,
3829,
29918,
1853,
297,
6796,
29890,
293,
9854,
613,
376,
303,
5666,
9854,
3108,
29901,
13,
4706,
2175,
29896,
29892,
2175,
29906,
353,
731,
29898,
23905,
29896,
3366,
1563,
29918,
18010,
3108,
511,
731,
29898,
23905,
29906,
3366,
1563,
29918,
18010,
20068,
13,
4706,
1492,
29896,
29892,
1492,
29906,
353,
731,
29898,
23905,
29896,
3366,
1266,
29918,
18010,
3108,
511,
731,
29898,
23905,
29906,
3366,
1266,
29918,
18010,
20068,
13,
4706,
2175,
29918,
957,
6984,
353,
2175,
29896,
29889,
1639,
2042,
29898,
1563,
29906,
29897,
13,
4706,
2175,
29918,
13094,
353,
2175,
29896,
29889,
13094,
29898,
1563,
29906,
29897,
13,
4706,
1492,
29918,
957,
6984,
353,
1492,
29896,
29889,
1639,
2042,
29898,
1266,
29906,
29897,
13,
4706,
1492,
29918,
13094,
353,
1492,
29896,
29889,
13094,
29898,
1266,
29906,
29897,
13,
4706,
736,
313,
13,
9651,
7431,
29898,
1563,
29918,
957,
6984,
29897,
847,
7431,
29898,
1563,
29918,
13094,
29897,
718,
7431,
29898,
1266,
29918,
957,
6984,
29897,
847,
7431,
29898,
1266,
29918,
13094,
29897,
13,
4706,
1723,
847,
29871,
29906,
13,
1678,
565,
3829,
29918,
1853,
1275,
376,
8508,
1115,
13,
4706,
19766,
29896,
29892,
19766,
29906,
353,
426,
23905,
29896,
3366,
29882,
431,
3108,
1118,
426,
23905,
29906,
3366,
29882,
431,
3108,
29913,
13,
4706,
805,
23195,
29896,
29892,
805,
23195,
29906,
353,
731,
29898,
23905,
29896,
3366,
1028,
23195,
3108,
511,
731,
29898,
23905,
29906,
3366,
1028,
23195,
20068,
13,
4706,
19766,
29918,
957,
6984,
353,
19766,
29896,
29889,
1639,
2042,
29898,
29882,
431,
29906,
29897,
13,
4706,
19766,
29918,
13094,
353,
19766,
29896,
29889,
13094,
29898,
29882,
431,
29906,
29897,
13,
4706,
12707,
29918,
957,
6984,
353,
805,
23195,
29896,
29889,
1639,
2042,
29898,
1028,
23195,
29906,
29897,
13,
4706,
12707,
29918,
13094,
353,
805,
23195,
29896,
29889,
13094,
29898,
1028,
23195,
29906,
29897,
13,
4706,
736,
313,
13,
9651,
7431,
29898,
29882,
431,
29918,
957,
6984,
29897,
847,
7431,
29898,
29882,
431,
29918,
13094,
29897,
718,
7431,
29898,
1028,
6946,
29918,
957,
6984,
29897,
847,
7431,
29898,
1028,
6946,
29918,
13094,
29897,
13,
4706,
1723,
847,
29871,
29906,
13,
1678,
12020,
8960,
29898,
29888,
29908,
14148,
3829,
1134,
29901,
426,
23905,
29918,
1853,
29913,
29991,
1159,
13,
13,
13,
1753,
679,
29918,
24713,
29918,
2780,
29898,
24713,
1125,
13,
1678,
565,
8783,
29889,
27382,
2541,
703,
943,
1159,
470,
8783,
29889,
27382,
2541,
703,
294,
29890,
29908,
1125,
13,
4706,
736,
376,
29881,
397,
914,
9539,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
26423,
1159,
470,
8783,
29889,
27382,
2541,
703,
4692,
29908,
1125,
13,
4706,
736,
376,
4366,
7912,
9539,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
375,
29880,
1159,
470,
8783,
29889,
27382,
2541,
703,
12160,
29908,
1125,
13,
4706,
736,
376,
29878,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
6144,
1159,
470,
8783,
29889,
27382,
2541,
703,
29880,
311,
29908,
1125,
13,
4706,
736,
376,
26031,
272,
927,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
695,
29887,
29908,
1125,
13,
4706,
736,
376,
15503,
552,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
29883,
1039,
29908,
1125,
13,
4706,
736,
376,
11082,
6381,
29908,
13,
1678,
25342,
376,
24840,
29938,
1665,
1942,
29912,
29909,
930,
29908,
297,
8783,
29901,
13,
4706,
736,
376,
12692,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
24840,
29905,
29876,
1159,
470,
8783,
29889,
27382,
2541,
703,
24840,
29908,
1125,
13,
4706,
736,
376,
29887,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
23156,
1159,
470,
8783,
29889,
27382,
2541,
703,
29878,
2291,
29908,
1125,
13,
4706,
736,
376,
21012,
29908,
13,
1678,
25342,
8783,
29889,
27382,
2541,
703,
15064,
1159,
470,
8783,
29889,
27382,
2541,
703,
2872,
29908,
1125,
13,
4706,
736,
376,
26031,
21012,
29908,
13,
1678,
1683,
29901,
13,
4706,
12020,
8960,
29898,
24713,
29897,
13,
13,
13,
1753,
2254,
29918,
3126,
29898,
1445,
1125,
13,
1678,
9995,
13,
1678,
2254,
263,
4390,
934,
408,
263,
8600,
13,
1678,
9995,
13,
1678,
411,
1722,
29898,
1445,
29897,
408,
285,
29901,
13,
4706,
1904,
29918,
3126,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
1678,
736,
1904,
29918,
3126,
13,
13,
13,
1753,
2254,
29918,
1188,
29898,
1445,
1125,
13,
1678,
9995,
13,
1678,
2254,
263,
1480,
934,
408,
263,
1051,
310,
1480,
934,
3454,
13,
1678,
9995,
13,
1678,
411,
1722,
29898,
1445,
29897,
408,
285,
29901,
13,
4706,
1904,
29918,
1188,
353,
285,
29889,
949,
2141,
5451,
14182,
29876,
1159,
13,
1678,
736,
1904,
29918,
1188,
13,
13,
13,
1753,
1653,
29918,
2176,
29898,
4299,
29918,
3126,
1125,
13,
1678,
9995,
13,
1678,
3588,
278,
1904,
4390,
15712,
491,
5757,
423,
964,
263,
10518,
29889,
17271,
13,
1678,
9995,
13,
1678,
5291,
2701,
353,
1051,
29898,
13,
4706,
14319,
29898,
13,
9651,
1904,
29918,
3126,
3366,
25254,
29918,
4984,
1973,
12436,
13,
9651,
1904,
29918,
3126,
3366,
25254,
29918,
23905,
29918,
8216,
29918,
2848,
29879,
12436,
13,
9651,
1904,
29918,
3126,
3366,
8216,
29918,
2848,
29879,
29918,
957,
29918,
2230,
12436,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
4489,
353,
10518,
29889,
17271,
29898,
13,
4706,
5291,
2701,
29892,
4341,
29922,
3366,
23905,
613,
376,
23905,
29918,
18253,
613,
376,
8216,
29918,
2848,
3108,
13,
1678,
1723,
13,
1678,
4489,
3366,
29876,
29918,
287,
2710,
29918,
7827,
3108,
353,
518,
13,
4706,
921,
29889,
657,
703,
29876,
29918,
287,
2710,
29918,
7827,
613,
1904,
29918,
3126,
3366,
29885,
20068,
363,
921,
297,
4489,
29889,
23905,
13,
1678,
4514,
13,
1678,
4489,
3366,
29876,
29918,
18010,
29918,
7827,
3108,
353,
518,
13,
4706,
921,
29889,
657,
703,
29876,
29918,
18010,
29918,
7827,
613,
1904,
29918,
3126,
3366,
29876,
20068,
363,
921,
297,
4489,
29889,
23905,
13,
1678,
4514,
13,
1678,
4489,
3366,
23905,
29918,
1853,
3108,
353,
518,
29916,
29889,
657,
703,
23905,
29918,
1853,
1159,
363,
921,
297,
4489,
29889,
23905,
29962,
13,
1678,
4489,
3366,
23905,
29918,
12181,
3108,
353,
518,
13,
4706,
679,
29918,
3177,
29918,
22976,
29898,
29916,
29897,
565,
921,
297,
29486,
29965,
1783,
11499,
29918,
15631,
29925,
2890,
1683,
376,
29990,
29908,
363,
921,
297,
4489,
29889,
23905,
29918,
1853,
13,
1678,
4514,
13,
1678,
4489,
3366,
23905,
29918,
2780,
3108,
353,
518,
13,
4706,
679,
29918,
3177,
29918,
2780,
29898,
29916,
29897,
565,
921,
297,
29486,
29965,
1783,
11499,
29918,
15631,
29925,
2890,
1683,
376,
29895,
29908,
363,
921,
297,
4489,
29889,
23905,
29918,
1853,
13,
1678,
4514,
13,
1678,
736,
4489,
13,
13,
13,
1753,
1653,
29918,
771,
11476,
29918,
5317,
29898,
2176,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
2602,
310,
3829,
297,
278,
5665,
373,
921,
29892,
6139,
3309,
1156,
4417,
3829,
373,
343,
29892,
2927,
7182,
292,
3829,
1134,
29892,
2159,
1804,
27855,
1353,
310,
12770,
13,
1678,
9995,
13,
1678,
14801,
9161,
2701,
353,
1051,
29898,
13,
4706,
14319,
29898,
13,
9651,
4489,
29889,
2248,
448,
29871,
29896,
29892,
13,
9651,
4489,
29889,
8216,
29918,
2848,
847,
4489,
29889,
8216,
29918,
2848,
29889,
3317,
3285,
13,
9651,
4489,
29889,
29876,
29918,
287,
2710,
29918,
7827,
29892,
13,
9651,
4489,
29889,
23905,
29918,
2780,
29892,
13,
9651,
4489,
29889,
23905,
29918,
12181,
29892,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
363,
260,
297,
18764,
287,
29898,
1557,
2620,
9161,
2701,
29961,
29896,
17531,
1125,
13,
4706,
14770,
29889,
1557,
2620,
29898,
29873,
29961,
29900,
1402,
260,
29961,
29896,
1402,
269,
29922,
29873,
29961,
29906,
29962,
565,
260,
29961,
29941,
29962,
2804,
376,
29895,
29908,
1683,
29871,
29896,
29900,
29892,
274,
29922,
29873,
29961,
29941,
1402,
17456,
543,
29877,
1159,
13,
1678,
14770,
29889,
486,
7358,
29898,
3881,
29898,
29900,
29892,
7431,
29898,
1557,
2620,
9161,
2701,
29961,
29896,
29901,
2314,
718,
29871,
29896,
29892,
29871,
29906,
876,
13,
1678,
14770,
29889,
29916,
2576,
6278,
29896,
29892,
7431,
29898,
1557,
2620,
9161,
2701,
29961,
29896,
29901,
2314,
718,
29871,
29896,
29897,
13,
1678,
14770,
29889,
29916,
1643,
703,
8592,
3829,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
11536,
6139,
3309,
1156,
3829,
4629,
1159,
13,
1678,
14770,
29889,
3257,
29898,
7620,
29918,
2084,
29897,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
1653,
29918,
2311,
29918,
5317,
29898,
4299,
29918,
3126,
29892,
921,
29918,
629,
273,
1070,
537,
29892,
343,
29918,
629,
273,
1070,
537,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
1353,
310,
7573,
373,
921,
29892,
1353,
310,
12770,
373,
343,
29892,
2927,
7182,
292,
3829,
1134,
13,
1678,
9995,
13,
1678,
3829,
29918,
8768,
29892,
302,
29918,
18010,
29892,
302,
29918,
287,
2710,
353,
1051,
29898,
13,
4706,
14319,
29898,
13,
9651,
334,
29898,
13,
18884,
518,
13,
462,
1678,
313,
29879,
3366,
23905,
29918,
1853,
12436,
269,
29889,
657,
703,
29876,
29918,
18010,
29918,
7827,
613,
29871,
29900,
511,
269,
3366,
29876,
29918,
287,
2710,
29918,
7827,
20068,
13,
462,
1678,
363,
269,
297,
1904,
29918,
3126,
3366,
25254,
29918,
4984,
1973,
3108,
13,
18884,
4514,
13,
9651,
1723,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
14770,
29889,
1557,
2620,
29898,
13,
4706,
302,
29918,
18010,
29961,
29906,
29901,
1402,
13,
4706,
302,
29918,
287,
2710,
29961,
29906,
29901,
1402,
13,
4706,
274,
29922,
1761,
29898,
1958,
29898,
657,
29918,
3177,
29918,
2780,
29892,
3829,
29918,
8768,
29961,
29906,
29901,
2314,
511,
13,
1678,
1723,
13,
1678,
14770,
29889,
29916,
1643,
703,
4557,
310,
405,
2631,
1159,
13,
1678,
14770,
29889,
486,
7358,
29898,
3881,
29898,
29900,
29892,
4236,
29898,
29876,
29918,
18010,
29961,
29906,
29901,
2314,
718,
921,
29918,
629,
273,
1070,
537,
29892,
921,
29918,
629,
273,
1070,
537,
876,
13,
1678,
14770,
29889,
3637,
7358,
29898,
3881,
29898,
29900,
29892,
4236,
29898,
29876,
29918,
287,
2710,
29961,
29906,
29901,
2314,
718,
343,
29918,
629,
273,
1070,
537,
29892,
343,
29918,
629,
273,
1070,
537,
876,
13,
1678,
14770,
29889,
29891,
2576,
29898,
29900,
29892,
4236,
29898,
29876,
29918,
287,
2710,
29961,
29906,
29901,
2314,
718,
343,
29918,
629,
273,
1070,
537,
29897,
13,
1678,
14770,
29889,
29891,
1643,
703,
4557,
310,
2155,
2710,
1159,
13,
1678,
14770,
29889,
3257,
29898,
7620,
29918,
2084,
29897,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
679,
29918,
4984,
1973,
29918,
23959,
29898,
4299,
29918,
3126,
1125,
13,
1678,
9995,
13,
1678,
736,
1051,
310,
9657,
29879,
29892,
411,
1269,
9657,
263,
3829,
2715,
297,
278,
1904,
5214,
1889,
313,
29875,
29889,
29872,
1696,
10035,
12286,
526,
429,
13347,
29897,
13,
1678,
9995,
13,
1678,
736,
1904,
29918,
3126,
3366,
25254,
29918,
4984,
1973,
3108,
29961,
29906,
17531,
13,
13,
13,
1753,
679,
29918,
3177,
29918,
7224,
29898,
4984,
1973,
29918,
23959,
1125,
13,
1678,
9995,
13,
1678,
736,
263,
1051,
310,
8857,
29892,
411,
1269,
6426,
1051,
13587,
278,
7573,
310,
263,
3829,
13,
1678,
9995,
13,
1678,
736,
23160,
657,
29918,
18010,
29898,
23905,
29897,
363,
3829,
297,
12286,
29918,
23959,
29962,
13,
13,
13,
1753,
903,
657,
29918,
18010,
29898,
23905,
1125,
13,
1678,
9995,
13,
1678,
16876,
363,
679,
29918,
3177,
29918,
7224,
13,
1678,
9995,
13,
1678,
565,
3829,
3366,
23905,
29918,
1853,
3108,
297,
6796,
29890,
293,
9854,
613,
376,
303,
5666,
9854,
3108,
29901,
13,
4706,
736,
3829,
3366,
1563,
29918,
18010,
3108,
718,
3829,
3366,
1266,
29918,
18010,
3108,
13,
1678,
25342,
3829,
3366,
23905,
29918,
1853,
3108,
1275,
376,
29883,
9854,
1115,
13,
4706,
736,
3829,
3366,
18010,
3108,
13,
1678,
25342,
3829,
3366,
23905,
29918,
1853,
3108,
1275,
376,
8508,
1115,
13,
4706,
736,
518,
23905,
3366,
29882,
431,
3108,
29962,
718,
3829,
3366,
1028,
23195,
3108,
13,
1678,
1683,
29901,
13,
4706,
12020,
8960,
29898,
29888,
29908,
14148,
3829,
1134,
426,
23905,
1839,
23905,
29918,
1853,
2033,
29913,
29991,
1159,
13,
13,
13,
1753,
679,
29918,
23905,
29918,
29069,
29898,
4984,
1973,
29918,
23959,
29892,
2943,
29918,
7224,
1125,
13,
1678,
9995,
13,
1678,
736,
1023,
10518,
29889,
17271,
3618,
8025,
278,
2943,
25457,
1546,
12286,
29901,
6425,
29918,
2176,
313,
29937,
7573,
297,
278,
25457,
511,
1104,
29918,
2176,
313,
29926,
5753,
538,
29501,
29897,
13,
1678,
9995,
13,
1678,
6425,
29918,
2176,
353,
10518,
29889,
17271,
29898,
13,
4706,
2380,
29922,
3881,
29898,
2435,
29898,
4984,
1973,
29918,
23959,
8243,
13,
4706,
4341,
29922,
3881,
29898,
2435,
29898,
4984,
1973,
29918,
23959,
8243,
13,
4706,
848,
29922,
9302,
29889,
13707,
29892,
13,
1678,
1723,
13,
1678,
1104,
29918,
2176,
353,
10518,
29889,
17271,
29898,
13,
4706,
2380,
29922,
3881,
29898,
2435,
29898,
4984,
1973,
29918,
23959,
8243,
13,
4706,
4341,
29922,
3881,
29898,
2435,
29898,
4984,
1973,
29918,
23959,
8243,
13,
4706,
848,
29922,
9302,
29889,
13707,
29892,
13,
1678,
1723,
13,
1678,
363,
22645,
297,
3464,
29898,
29900,
29892,
7431,
29898,
3177,
29918,
7224,
29897,
448,
29871,
29896,
1125,
13,
4706,
363,
22645,
29906,
297,
3464,
29898,
13140,
718,
29871,
29896,
29892,
7431,
29898,
3177,
29918,
7224,
22164,
13,
9651,
6425,
29918,
2176,
29889,
271,
29961,
13140,
29892,
22645,
29906,
29962,
353,
7431,
29898,
13,
18884,
731,
29898,
3177,
29918,
7224,
29961,
13140,
14664,
1639,
2042,
29898,
842,
29898,
3177,
29918,
7224,
29961,
13140,
29906,
12622,
13,
9651,
1723,
13,
9651,
6425,
29918,
2176,
29889,
271,
29961,
13140,
29906,
29892,
22645,
29962,
353,
6425,
29918,
2176,
29889,
271,
29961,
13140,
29892,
22645,
29906,
29962,
13,
9651,
1104,
29918,
2176,
29889,
271,
29961,
13140,
29892,
22645,
29906,
29962,
353,
7431,
29898,
13,
18884,
731,
29898,
3177,
29918,
7224,
29961,
13140,
14664,
1639,
2042,
29898,
842,
29898,
3177,
29918,
7224,
29961,
13140,
29906,
12622,
13,
9651,
1723,
847,
7431,
29898,
842,
29898,
3177,
29918,
7224,
29961,
13140,
14664,
13094,
29898,
842,
29898,
3177,
29918,
7224,
29961,
13140,
29906,
29962,
4961,
13,
9651,
1104,
29918,
2176,
29889,
271,
29961,
13140,
29906,
29892,
22645,
29962,
353,
1104,
29918,
2176,
29889,
271,
29961,
13140,
29892,
22645,
29906,
29962,
13,
1678,
736,
6425,
29918,
2176,
29892,
1104,
29918,
2176,
13,
13,
13,
1753,
903,
657,
29918,
29876,
29918,
18010,
29918,
11911,
287,
29898,
3177,
29918,
7224,
1125,
13,
1678,
9995,
13,
1678,
16876,
363,
679,
29918,
29888,
13857,
29918,
18010,
29918,
11911,
287,
13,
1678,
9995,
13,
1678,
736,
7431,
29898,
842,
29898,
7692,
312,
8789,
29889,
17469,
29898,
2892,
921,
29892,
343,
29901,
921,
718,
343,
29892,
2943,
29918,
7224,
29892,
5159,
4961,
13,
13,
13,
1753,
679,
29918,
29888,
13857,
29918,
18010,
29918,
11911,
287,
29898,
3177,
29918,
7224,
29892,
1904,
29918,
3126,
1125,
13,
1678,
736,
903,
657,
29918,
29876,
29918,
18010,
29918,
11911,
287,
29898,
3177,
29918,
7224,
29897,
847,
1904,
29918,
3126,
3366,
29876,
3108,
13,
13,
13,
1753,
6492,
29918,
957,
6984,
29918,
354,
271,
1958,
29898,
2176,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
12286,
2715,
304,
1904,
373,
921,
322,
343,
29892,
29501,
408,
639,
4489,
408,
2927,
29892,
2322,
784,
555,
481,
29892,
16424,
29922,
8824,
13,
1678,
9995,
13,
1678,
269,
1983,
29889,
354,
271,
1958,
29898,
2176,
29892,
6862,
29922,
5574,
29897,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
1653,
29918,
4632,
287,
29918,
1635,
29879,
29918,
8336,
29898,
2176,
29892,
5912,
29922,
8824,
1125,
13,
1678,
402,
353,
302,
29916,
29889,
9527,
29898,
2176,
29889,
5589,
1056,
29898,
29900,
876,
13,
1678,
4236,
303,
353,
302,
29916,
29889,
8336,
29889,
27525,
398,
29918,
1028,
9450,
29918,
8336,
29898,
29954,
29897,
13,
1678,
23116,
29918,
4632,
353,
402,
29889,
4537,
29918,
974,
29918,
18010,
580,
13,
1678,
274,
2395,
353,
1051,
29898,
23818,
29889,
18045,
29918,
14036,
29898,
29954,
876,
13,
1678,
363,
274,
297,
274,
2395,
29901,
13,
4706,
4163,
29918,
1491,
4262,
353,
4236,
303,
29889,
1491,
4262,
29898,
29883,
29897,
13,
4706,
4163,
29918,
4632,
353,
4236,
29898,
23818,
29889,
12163,
929,
29898,
9700,
29918,
1491,
4262,
511,
1820,
29922,
2892,
260,
786,
29901,
260,
786,
14352,
29896,
2314,
29961,
13,
632,
29900,
13,
4706,
4514,
29871,
396,
2943,
411,
4236,
443,
7915,
287,
7426,
13,
4706,
4236,
303,
29889,
1202,
29918,
12864,
29898,
442,
928,
616,
29918,
4632,
29892,
4163,
29918,
4632,
29892,
7688,
29922,
9302,
29889,
29888,
3888,
29898,
7411,
467,
8961,
29897,
13,
1678,
5447,
353,
302,
29916,
29889,
3018,
874,
284,
29889,
1635,
29879,
29918,
8336,
29898,
3317,
303,
29892,
23116,
29918,
4632,
29897,
13,
1678,
363,
321,
297,
5447,
29889,
287,
2710,
7295,
13,
4706,
5447,
29889,
287,
2710,
29961,
29872,
29962,
3366,
7915,
3108,
353,
4236,
303,
29889,
287,
2710,
29961,
29872,
29962,
3366,
7915,
3108,
13,
1678,
565,
5912,
29901,
13,
4706,
926,
353,
302,
29916,
29889,
2680,
29889,
29895,
314,
1114,
29918,
1335,
29893,
1794,
29918,
2680,
29898,
3317,
303,
29892,
7688,
29922,
8516,
29897,
13,
4706,
736,
5447,
29892,
926,
13,
1678,
1683,
29901,
13,
4706,
736,
5447,
13,
13,
13,
1753,
788,
29918,
8336,
29918,
2680,
29898,
29954,
29892,
3876,
29892,
2943,
29918,
19570,
29892,
3233,
29918,
19570,
1125,
13,
1678,
363,
2943,
297,
402,
29889,
18010,
7295,
13,
4706,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29891,
3108,
353,
448,
5563,
29918,
19570,
334,
302,
29916,
29889,
29881,
13535,
4151,
29918,
2084,
29918,
2848,
29898,
13,
9651,
402,
29892,
3876,
29892,
2943,
29892,
7688,
29922,
8516,
13,
4706,
1723,
13,
1678,
2967,
353,
29871,
29900,
13,
1678,
363,
2943,
297,
302,
29916,
29889,
29069,
29918,
2490,
2098,
29918,
18010,
29898,
29954,
29892,
3876,
1125,
13,
4706,
8348,
353,
12705,
29898,
1761,
29898,
29954,
29889,
8698,
943,
29898,
3177,
8243,
11837,
29922,
5574,
29897,
13,
4706,
565,
7431,
29898,
2146,
617,
29897,
529,
29871,
29896,
29901,
13,
9651,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
353,
2967,
718,
2943,
29918,
19570,
13,
9651,
2967,
4619,
2943,
29918,
19570,
13,
4706,
1683,
29901,
13,
9651,
921,
1195,
353,
1375,
4197,
29954,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
363,
2943,
297,
8348,
2314,
13,
9651,
921,
3317,
353,
4236,
4197,
29954,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
363,
2943,
297,
8348,
2314,
13,
9651,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
353,
921,
1195,
718,
313,
29916,
3317,
448,
921,
1195,
29897,
847,
29871,
29906,
13,
1678,
363,
2943,
297,
402,
29889,
18010,
29901,
13,
4706,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
353,
448,
29954,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
13,
1678,
736,
402,
13,
13,
13,
1753,
788,
29918,
2780,
29898,
29954,
29892,
4489,
1125,
13,
1678,
363,
2943,
297,
402,
29889,
18010,
7295,
13,
4706,
402,
29889,
18010,
29961,
3177,
29962,
3366,
2780,
3108,
353,
313,
13,
9651,
4489,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
23905,
29918,
2780,
3108,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
376,
29895,
29908,
13,
4706,
1723,
13,
1678,
736,
402,
13,
13,
13,
1753,
6492,
29918,
8336,
29898,
29954,
29892,
4489,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
402,
353,
788,
29918,
2780,
29898,
29954,
29892,
4489,
29897,
13,
1678,
17117,
4853,
353,
14770,
29889,
1491,
26762,
29898,
29896,
29892,
29871,
29896,
29892,
2537,
2311,
7607,
29896,
29906,
29892,
29871,
29896,
29906,
876,
13,
1678,
363,
2943,
297,
402,
29889,
18010,
7295,
13,
4706,
921,
353,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29916,
3108,
13,
4706,
343,
353,
402,
29889,
18010,
29961,
3177,
29962,
3366,
29891,
3108,
13,
4706,
2927,
353,
402,
29889,
18010,
29961,
3177,
29962,
3366,
2780,
3108,
13,
4706,
363,
8348,
297,
402,
29889,
8698,
943,
29898,
3177,
1125,
13,
9651,
4853,
29889,
5317,
29898,
13,
18884,
518,
29916,
29892,
402,
29889,
18010,
29961,
2146,
617,
29962,
3366,
29916,
3108,
1402,
13,
18884,
518,
29891,
29892,
402,
29889,
18010,
29961,
2146,
617,
29962,
3366,
29891,
3108,
1402,
13,
18884,
11663,
29895,
613,
13,
18884,
1196,
2103,
29922,
3317,
29898,
29954,
29889,
287,
2710,
29961,
3177,
29892,
8348,
29962,
3366,
7915,
3108,
334,
29871,
29896,
29900,
29892,
29871,
29896,
511,
13,
18884,
503,
2098,
29922,
29896,
29892,
13,
18884,
15595,
29922,
29896,
29892,
13,
9651,
1723,
13,
4706,
4853,
29889,
1557,
2620,
29898,
13,
9651,
921,
29892,
13,
9651,
343,
29892,
13,
9651,
2927,
29922,
2780,
29892,
13,
9651,
269,
29922,
2176,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
29876,
29918,
18010,
29918,
7827,
3108,
334,
29871,
29953,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
29871,
29941,
29900,
29900,
29892,
13,
9651,
17456,
29922,
2176,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
23905,
29918,
12181,
3108,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
376,
29990,
613,
13,
9651,
503,
2098,
29922,
29906,
29892,
13,
9651,
15595,
29922,
29896,
29892,
13,
4706,
1723,
13,
4706,
396,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
29901,
13,
4706,
396,
268,
4853,
29889,
6735,
403,
29898,
3177,
718,
29871,
29896,
29892,
313,
29916,
29892,
343,
511,
4079,
2311,
29922,
29896,
29900,
29892,
447,
543,
5064,
613,
2947,
543,
5064,
1159,
13,
1678,
14770,
29889,
24667,
29918,
7529,
29898,
1563,
29922,
8824,
29892,
3858,
1563,
29922,
8824,
29892,
5970,
29922,
8824,
29892,
3858,
8968,
29922,
8824,
29897,
13,
1678,
14770,
29889,
8990,
703,
2696,
1159,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29892,
17772,
29922,
5574,
29892,
289,
1884,
29918,
262,
6609,
543,
29873,
523,
1159,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
6492,
29918,
23905,
29918,
8336,
29898,
8336,
29892,
5912,
29892,
4489,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
6492,
3829,
5447,
297,
6996,
9286,
1114,
413,
1450,
1794,
5912,
29936,
13,
1678,
3829,
2893,
14903,
297,
1797,
310,
3829,
6124,
322,
2927,
6590,
304,
3829,
1134,
313,
442,
928,
616,
3876,
2943,
4628,
29897,
13,
1678,
9995,
13,
1678,
302,
29916,
29889,
4012,
29918,
11618,
29916,
29918,
287,
2710,
29898,
8336,
29892,
926,
29922,
2680,
29897,
13,
1678,
363,
2943,
29892,
313,
29916,
29892,
343,
29897,
297,
5912,
29889,
7076,
7295,
13,
4706,
14770,
29889,
1557,
2620,
29898,
13,
9651,
921,
29892,
13,
9651,
343,
29892,
13,
9651,
2927,
29922,
2176,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
23905,
29918,
2780,
3108,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
376,
29895,
613,
13,
9651,
269,
29922,
2176,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
29876,
29918,
18010,
29918,
7827,
3108,
334,
29871,
29953,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
29871,
29896,
29900,
29900,
29892,
13,
9651,
17456,
29922,
2176,
29889,
271,
29961,
3177,
718,
29871,
29906,
29892,
376,
23905,
29918,
12181,
3108,
565,
2943,
2804,
7431,
29898,
2176,
29897,
448,
29871,
29906,
1683,
376,
29990,
613,
13,
9651,
503,
2098,
29922,
29906,
29892,
13,
9651,
15595,
29922,
29900,
29889,
29947,
29892,
13,
4706,
1723,
13,
1678,
11073,
353,
426,
13140,
29901,
22645,
718,
29871,
29896,
363,
22645,
297,
5447,
29889,
18010,
28296,
13,
1678,
302,
29916,
29889,
4012,
29918,
11618,
29916,
29918,
21134,
29898,
8336,
29892,
926,
29922,
2680,
29892,
11073,
29922,
21134,
29897,
13,
1678,
14770,
29889,
8990,
703,
2696,
1159,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
2436,
29918,
26762,
29918,
1454,
29918,
4299,
29918,
3126,
29898,
13,
1678,
4390,
29918,
2084,
29892,
13,
1678,
4078,
29918,
3188,
29892,
13,
1678,
921,
29918,
629,
273,
1070,
537,
29918,
2311,
29892,
13,
1678,
343,
29918,
629,
273,
1070,
537,
29918,
2311,
29892,
13,
1125,
13,
1678,
9995,
13,
1678,
1095,
29899,
517,
29899,
355,
6492,
12623,
363,
4390,
934,
472,
2183,
4390,
29918,
2084,
13,
1678,
9995,
13,
1678,
1596,
29898,
29888,
29908,
4763,
292,
426,
3126,
29918,
2084,
29913,
856,
1159,
13,
1678,
1904,
29918,
3126,
353,
2254,
29918,
3126,
29898,
3126,
29918,
2084,
29897,
13,
1678,
4078,
29918,
3188,
353,
4078,
29918,
3188,
29889,
5451,
703,
29918,
2311,
1159,
29961,
29900,
29962,
13,
1678,
4489,
353,
1653,
29918,
2176,
29898,
4299,
29918,
3126,
29897,
13,
1678,
4489,
29889,
517,
29918,
7638,
29898,
276,
29889,
1491,
703,
4532,
613,
376,
4984,
1973,
613,
4078,
29918,
3188,
29897,
718,
11393,
7638,
613,
2380,
29922,
8824,
29897,
13,
1678,
12286,
29918,
23959,
353,
679,
29918,
4984,
1973,
29918,
23959,
29898,
4299,
29918,
3126,
29897,
13,
1678,
2943,
29918,
7224,
353,
679,
29918,
3177,
29918,
7224,
29898,
4984,
1973,
29918,
23959,
29897,
13,
1678,
1018,
29901,
13,
4706,
6425,
29918,
2176,
29892,
1104,
29918,
2176,
353,
679,
29918,
23905,
29918,
29069,
29898,
4984,
1973,
29918,
23959,
29892,
2943,
29918,
7224,
29897,
13,
4706,
1104,
29918,
2176,
29889,
517,
29918,
7638,
29898,
276,
29889,
1491,
703,
4532,
613,
376,
23905,
29918,
957,
6984,
29918,
5344,
613,
4078,
29918,
3188,
29897,
718,
11393,
7638,
1159,
13,
4706,
5447,
29892,
5912,
353,
1653,
29918,
4632,
287,
29918,
1635,
29879,
29918,
8336,
29898,
2674,
29918,
2176,
29892,
5912,
29922,
5574,
29897,
13,
4706,
6492,
29918,
8336,
29898,
13,
9651,
788,
29918,
8336,
29918,
2680,
29898,
8336,
29892,
5447,
29889,
4537,
29918,
974,
29918,
18010,
580,
448,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29900,
511,
13,
9651,
4489,
29892,
13,
9651,
337,
29889,
1491,
703,
4532,
613,
376,
8336,
29899,
29882,
631,
1279,
936,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
613,
13,
4706,
1723,
13,
4706,
6492,
29918,
23905,
29918,
8336,
29898,
13,
9651,
5447,
29892,
5912,
29892,
4489,
29892,
337,
29889,
1491,
703,
4532,
613,
376,
8336,
29899,
29895,
314,
1114,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
29908,
13,
4706,
1723,
13,
4706,
402,
353,
1653,
29918,
957,
6984,
29918,
23083,
993,
29918,
4262,
29898,
4984,
1973,
29918,
23959,
29892,
6425,
29918,
2176,
29892,
1904,
29918,
3126,
3366,
29876,
20068,
13,
4706,
6492,
29918,
957,
6984,
29918,
23083,
993,
29918,
4262,
29898,
13,
9651,
402,
29892,
13,
9651,
4489,
29892,
13,
9651,
1904,
29918,
3126,
3366,
29876,
12436,
13,
9651,
337,
29889,
1491,
703,
4532,
613,
376,
957,
6984,
29899,
23083,
993,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
613,
13,
4706,
1723,
13,
4706,
402,
353,
1653,
29918,
23905,
29918,
23083,
993,
29918,
4262,
29898,
3177,
29918,
7224,
29892,
4078,
29918,
3188,
29897,
13,
4706,
6492,
29918,
23905,
29918,
23083,
993,
29918,
4262,
29898,
13,
9651,
402,
29892,
13,
9651,
2943,
29918,
7224,
29892,
13,
9651,
12286,
29918,
23959,
29892,
13,
9651,
4078,
29918,
2084,
29922,
276,
29889,
1491,
703,
4532,
613,
376,
23905,
29899,
23083,
993,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
613,
13,
4706,
1723,
13,
1678,
5174,
29901,
13,
4706,
1596,
29898,
13,
9651,
285,
29908,
2392,
363,
25457,
848,
19935,
470,
3983,
24580,
29901,
426,
3126,
29918,
2084,
29913,
448,
8401,
373,
17794,
13,
4706,
1723,
13,
1678,
1018,
29901,
13,
4706,
1653,
29918,
771,
11476,
29918,
5317,
29898,
13,
9651,
4489,
29892,
13,
9651,
337,
29889,
1491,
703,
4532,
613,
376,
18035,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
613,
13,
4706,
1723,
13,
1678,
5174,
29901,
13,
4706,
1596,
29898,
29888,
29908,
2392,
363,
410,
11476,
6492,
29901,
426,
3126,
29918,
2084,
29913,
448,
8401,
373,
856,
1159,
13,
1678,
1018,
29901,
13,
4706,
1653,
29918,
2311,
29918,
5317,
29898,
13,
9651,
1904,
29918,
3126,
29892,
13,
9651,
921,
29918,
629,
273,
1070,
537,
29918,
2311,
29892,
13,
9651,
343,
29918,
629,
273,
1070,
537,
29918,
2311,
29892,
13,
9651,
337,
29889,
1491,
703,
4532,
613,
376,
29879,
7093,
613,
4078,
29918,
3188,
29897,
718,
11393,
5140,
613,
13,
4706,
1723,
13,
1678,
5174,
29901,
13,
4706,
1596,
29898,
29888,
29908,
2392,
363,
2159,
6492,
29901,
426,
3126,
29918,
2084,
29913,
448,
8401,
373,
856,
1159,
13,
13,
13,
1753,
679,
29918,
287,
7467,
391,
29918,
344,
17954,
29898,
287,
7467,
391,
29918,
2084,
1125,
13,
1678,
411,
1722,
29898,
287,
7467,
391,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
363,
1196,
297,
285,
29901,
13,
9651,
565,
451,
1196,
29889,
27382,
2541,
14822,
29908,
1125,
13,
18884,
565,
6634,
29873,
29908,
297,
1196,
29901,
13,
462,
1678,
736,
6634,
29873,
29908,
13,
18884,
25342,
28796,
297,
1196,
29901,
13,
462,
1678,
736,
28796,
13,
18884,
25342,
376,
376,
297,
1196,
29901,
13,
462,
1678,
736,
376,
376,
13,
18884,
1683,
29901,
13,
462,
1678,
12020,
13,
13,
13,
1753,
1653,
29918,
23905,
29918,
23083,
993,
29918,
4262,
29898,
18010,
29892,
4078,
29918,
3188,
1125,
13,
1678,
2943,
1958,
29918,
2084,
353,
313,
13,
4706,
337,
29889,
1491,
703,
4532,
29899,
613,
12633,
337,
29889,
1491,
703,
6420,
29914,
613,
376,
9902,
29914,
613,
4078,
29918,
3188,
876,
13,
4706,
718,
11663,
3177,
1958,
29889,
7638,
29908,
13,
1678,
1723,
13,
1678,
2943,
1958,
353,
10518,
29889,
949,
29918,
7638,
29898,
3177,
1958,
29918,
2084,
29897,
13,
1678,
1226,
7467,
391,
29918,
2084,
353,
313,
13,
4706,
337,
29889,
1491,
703,
4532,
29899,
613,
12633,
337,
29889,
1491,
703,
6420,
29914,
613,
376,
1272,
29914,
613,
4078,
29918,
3188,
876,
718,
11393,
3945,
29908,
13,
1678,
1723,
13,
1678,
12770,
353,
10518,
29889,
949,
29918,
7638,
29898,
13,
4706,
1226,
7467,
391,
29918,
2084,
29892,
13,
4706,
16345,
29922,
657,
29918,
287,
7467,
391,
29918,
344,
17954,
29898,
287,
7467,
391,
29918,
2084,
511,
13,
4706,
3440,
9880,
613,
13,
4706,
4839,
29922,
8516,
29892,
13,
4706,
671,
22724,
11759,
29900,
29892,
29871,
29896,
1402,
13,
1678,
13742,
1267,
420,
3319,
29900,
29901,
376,
29884,
613,
29871,
29896,
29901,
376,
29894,
10758,
9685,
29922,
29896,
29897,
13,
1678,
716,
29918,
287,
2710,
353,
12770,
29889,
14634,
29898,
3177,
1958,
29892,
2175,
29918,
265,
543,
29884,
613,
1492,
29918,
265,
543,
13492,
29918,
333,
2564,
14634,
29898,
13,
4706,
2943,
1958,
29892,
2175,
29918,
265,
543,
29894,
613,
1492,
29918,
265,
543,
13492,
29918,
333,
613,
25557,
267,
29922,
703,
29918,
29884,
613,
11119,
29894,
1159,
13,
1678,
1723,
29961,
3366,
29926,
352,
423,
29918,
333,
29918,
29884,
613,
376,
29926,
352,
423,
29918,
333,
29918,
29894,
3108,
29962,
13,
1678,
4974,
7431,
29898,
287,
2710,
29897,
1275,
7431,
29898,
1482,
29918,
287,
2710,
29897,
13,
1678,
7573,
29918,
517,
29918,
4984,
1973,
353,
679,
29918,
18010,
29918,
517,
29918,
4984,
1973,
29898,
18010,
29897,
13,
1678,
402,
353,
302,
29916,
29889,
15329,
9527,
580,
13,
1678,
402,
29889,
1202,
29918,
18010,
29918,
3166,
29898,
3881,
29898,
29896,
29892,
7431,
29898,
18010,
29897,
718,
29871,
29896,
876,
13,
1678,
363,
318,
29892,
325,
297,
14319,
29898,
1482,
29918,
287,
2710,
29889,
29926,
352,
423,
29918,
333,
29918,
29884,
29892,
716,
29918,
287,
2710,
29889,
29926,
352,
423,
29918,
333,
29918,
29894,
1125,
13,
4706,
318,
29918,
4984,
1973,
353,
7573,
29918,
517,
29918,
4984,
1973,
29889,
657,
29898,
29884,
29892,
518,
2314,
13,
4706,
325,
29918,
4984,
1973,
353,
7573,
29918,
517,
29918,
4984,
1973,
29889,
657,
29898,
29894,
29892,
518,
2314,
13,
4706,
565,
313,
13,
9651,
318,
29918,
4984,
1973,
13,
9651,
322,
325,
29918,
4984,
1973,
13,
9651,
322,
451,
731,
29898,
29884,
29918,
4984,
1973,
467,
1639,
2042,
29898,
29894,
29918,
4984,
1973,
29897,
13,
308,
1125,
13,
9651,
363,
502,
297,
318,
29918,
4984,
1973,
29901,
13,
18884,
363,
7186,
297,
325,
29918,
4984,
1973,
29901,
13,
462,
1678,
402,
29889,
1202,
29918,
12864,
29898,
375,
29892,
7186,
29897,
13,
1678,
281,
29954,
353,
302,
29916,
29889,
9527,
580,
13,
1678,
281,
29954,
29889,
1202,
29918,
18010,
29918,
3166,
29898,
29954,
29889,
18010,
3101,
13,
1678,
281,
29954,
29889,
1202,
29918,
7915,
287,
29918,
287,
2710,
29918,
3166,
4197,
10456,
29895,
29892,
325,
29897,
363,
413,
29892,
325,
297,
9657,
29898,
17779,
29898,
29954,
29889,
287,
2710,
3101,
467,
7076,
580,
2314,
13,
1678,
736,
281,
29954,
13,
13,
13,
1753,
679,
29918,
18010,
29918,
517,
29918,
4984,
1973,
29898,
18010,
1125,
13,
1678,
7573,
29918,
517,
29918,
4984,
1973,
353,
6571,
13,
1678,
363,
22645,
29892,
7573,
300,
297,
26985,
29898,
18010,
29892,
1369,
29922,
29896,
1125,
13,
4706,
363,
2943,
297,
7573,
300,
29901,
13,
9651,
7573,
29918,
517,
29918,
4984,
1973,
29961,
3177,
29962,
353,
7573,
29918,
517,
29918,
4984,
1973,
29889,
657,
29898,
3177,
29892,
518,
2314,
718,
518,
13140,
29962,
13,
1678,
736,
7573,
29918,
517,
29918,
4984,
1973,
13,
13,
13,
1753,
679,
29918,
3177,
29918,
2780,
29898,
3177,
29918,
1853,
1125,
13,
1678,
565,
2943,
29918,
1853,
1275,
376,
8508,
1115,
13,
4706,
736,
376,
272,
927,
29908,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
29883,
9854,
1115,
13,
4706,
736,
376,
29881,
397,
914,
9539,
29908,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
29890,
293,
9854,
1115,
13,
4706,
736,
12305,
15349,
29906,
29955,
29896,
29909,
29908,
29871,
396,
2654,
29941,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
303,
5666,
9854,
1115,
13,
4706,
736,
376,
25350,
333,
29908,
13,
1678,
1683,
29901,
13,
4706,
12020,
13,
13,
13,
1753,
679,
29918,
3177,
29918,
22976,
29898,
3177,
29918,
1853,
1125,
13,
1678,
565,
2943,
29918,
1853,
1275,
376,
8508,
1115,
13,
4706,
736,
13898,
29908,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
29883,
9854,
1115,
13,
4706,
736,
376,
29877,
29908,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
29890,
293,
9854,
1115,
13,
4706,
736,
376,
29879,
29908,
13,
1678,
25342,
2943,
29918,
1853,
1275,
376,
303,
5666,
9854,
1115,
13,
4706,
736,
376,
29881,
29908,
13,
1678,
1683,
29901,
13,
4706,
12020,
13,
13,
13,
1753,
6492,
29918,
23905,
29918,
23083,
993,
29918,
4262,
29898,
29893,
29954,
29892,
7573,
29892,
12286,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
926,
353,
302,
29916,
29889,
2680,
29889,
29888,
582,
8255,
1171,
29918,
276,
292,
1025,
29918,
2680,
29898,
29893,
29954,
29892,
413,
29922,
29906,
29889,
29945,
29892,
16717,
29922,
29900,
29897,
13,
1678,
903,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29906,
29892,
29871,
29896,
29906,
876,
13,
1678,
302,
29916,
29889,
4012,
29918,
11618,
29916,
29918,
287,
2710,
29898,
13,
4706,
281,
29954,
29892,
13,
4706,
926,
29922,
1066,
29892,
13,
4706,
1226,
7467,
391,
29922,
29893,
29954,
29889,
287,
2710,
3285,
13,
4706,
2920,
11759,
29893,
847,
29871,
29896,
29900,
29900,
363,
318,
29892,
325,
29892,
281,
297,
281,
29954,
29889,
287,
2710,
29898,
1272,
543,
7915,
1159,
1402,
13,
1678,
1723,
13,
1678,
363,
2943,
297,
281,
29954,
29889,
18010,
7295,
13,
4706,
14770,
29889,
1557,
2620,
29898,
13,
9651,
334,
1066,
29961,
3177,
1402,
13,
9651,
269,
29922,
2435,
29898,
18010,
29961,
3177,
448,
29871,
29896,
2314,
334,
29871,
29945,
29892,
13,
9651,
274,
29922,
657,
29918,
3177,
29918,
2780,
29898,
4984,
1973,
29961,
3177,
448,
29871,
29896,
29962,
3366,
23905,
29918,
1853,
3108,
511,
13,
9651,
17456,
29922,
657,
29918,
3177,
29918,
22976,
29898,
4984,
1973,
29961,
3177,
448,
29871,
29896,
29962,
3366,
23905,
29918,
1853,
3108,
511,
13,
4706,
1723,
13,
1678,
302,
29916,
29889,
4012,
29918,
11618,
29916,
29918,
21134,
29898,
29893,
29954,
29892,
926,
29892,
503,
2098,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
8990,
703,
2696,
1159,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
13,
13,
1753,
1653,
29918,
957,
6984,
29918,
23083,
993,
29918,
4262,
29898,
4984,
1973,
29918,
23959,
29892,
6425,
29918,
2176,
29892,
302,
29918,
7827,
1125,
13,
1678,
402,
353,
302,
29916,
29889,
9527,
580,
13,
1678,
363,
22645,
29892,
3829,
297,
26985,
29898,
4984,
1973,
29918,
23959,
29892,
1369,
29922,
29896,
1125,
13,
4706,
402,
29889,
1202,
29918,
3177,
29898,
13,
9651,
22645,
29892,
3579,
29912,
1068,
23905,
29892,
376,
29876,
29918,
22925,
1115,
3829,
3366,
29876,
29918,
18010,
29918,
7827,
3108,
847,
302,
29918,
7827,
29913,
13,
4706,
1723,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
6897,
29918,
2176,
22164,
13,
4706,
363,
432,
297,
3464,
29898,
29875,
718,
29871,
29896,
29892,
7431,
29898,
6897,
29918,
2176,
22164,
13,
9651,
7636,
29918,
7915,
353,
6425,
29918,
2176,
29889,
271,
29961,
29875,
29892,
432,
29962,
847,
302,
29918,
7827,
13,
9651,
565,
7636,
29918,
7915,
1405,
29871,
29900,
29901,
13,
18884,
402,
29889,
1202,
29918,
12864,
29898,
29875,
718,
29871,
29896,
29892,
432,
718,
29871,
29896,
29892,
7688,
29922,
12864,
29918,
7915,
29897,
13,
1678,
736,
402,
13,
13,
13,
1753,
6492,
29918,
957,
6984,
29918,
23083,
993,
29918,
4262,
29898,
29954,
29892,
4489,
29892,
302,
29918,
7827,
29892,
4078,
29918,
2084,
29922,
8516,
1125,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
29896,
29906,
29941,
29946,
29897,
13,
1678,
926,
353,
302,
29916,
29889,
2680,
29889,
29888,
582,
8255,
1171,
29918,
276,
292,
1025,
29918,
2680,
29898,
29954,
29897,
13,
1678,
17117,
4853,
353,
14770,
29889,
1491,
26762,
29898,
29896,
29892,
29871,
29896,
29892,
2537,
2311,
7607,
29896,
29906,
29892,
29871,
29896,
29906,
876,
13,
1678,
363,
921,
29892,
343,
29892,
281,
297,
402,
29889,
287,
2710,
29898,
1272,
543,
7915,
29908,
1125,
13,
4706,
565,
281,
334,
302,
29918,
7827,
1405,
29871,
29896,
29901,
13,
9651,
4853,
29889,
5317,
29898,
13,
18884,
518,
1066,
29961,
29916,
3816,
29900,
1402,
926,
29961,
29891,
3816,
29900,
20526,
13,
18884,
518,
1066,
29961,
29916,
3816,
29896,
1402,
926,
29961,
29891,
3816,
29896,
20526,
13,
18884,
11663,
29895,
613,
13,
18884,
1196,
2103,
29922,
29893,
334,
302,
29918,
7827,
847,
29871,
29896,
29900,
29900,
29892,
13,
18884,
503,
2098,
10457,
29896,
29900,
29892,
13,
18884,
15595,
29922,
29900,
29889,
29945,
29892,
13,
9651,
1723,
13,
1678,
363,
2943,
297,
402,
29889,
18010,
29898,
1272,
29922,
5574,
1125,
13,
4706,
4853,
29889,
1557,
2620,
29898,
13,
9651,
334,
1066,
29961,
3177,
29961,
29900,
20526,
13,
9651,
269,
29922,
29945,
29889,
29900,
334,
2943,
29961,
29896,
29962,
3366,
29876,
29918,
18010,
29918,
7827,
12436,
13,
9651,
274,
29922,
2176,
29889,
271,
29961,
3177,
29961,
29900,
29962,
718,
29871,
29896,
29892,
376,
23905,
29918,
2780,
12436,
13,
9651,
17456,
29922,
2176,
29889,
271,
29961,
3177,
29961,
29900,
29962,
718,
29871,
29896,
29892,
376,
23905,
29918,
12181,
12436,
13,
9651,
503,
2098,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
302,
29916,
29889,
4012,
29918,
11618,
29916,
29918,
21134,
29898,
29954,
29892,
926,
29892,
503,
2098,
29922,
29896,
29900,
29900,
29897,
13,
1678,
14770,
29889,
8990,
703,
2696,
1159,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
565,
4078,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
14770,
29889,
7620,
1003,
29898,
7620,
29918,
2084,
29892,
17772,
29922,
5574,
29897,
13,
4706,
14770,
29889,
5358,
580,
13,
2
] |
Exercicios-mundo-2/desafio044.py | talitadeoa/CEV-Exercicios-Python | 0 | 115342 | #Um gerenciador de pagementos simples
preco = float(input('Qual o valor da compra? '))
pagamento = int(input("""Qual será a forma de pagamento?
Digite 0 para pagamento à vista no dinheiro ou cheque
Digite 1 para pagamento à vista no cartão
Digite 2 para pagamento parcelado em até 2x
Digite 3 para pagamento parcelado em 3x ou mais
"""))
if pagamento == 0:
pagamento = 'pagamento à vista em dinheiro ou cheque'
saldo = preco - (preco*10/100)
print("""Você escolheu a opção {}
Você irá pagar {}""".format(pagamento,saldo))
elif pagamento == 1:
pagamento = 'pagamento à vista no cartão'
saldo = preco - (preco*5/100)
print("""Você escolheu a opção {}
Você irá pagar {}""".format(pagamento,saldo))
elif pagamento == 2:
pagamento = 'pagamento parcelado em até 2x'
saldo = preco
print("""Você escolheu a opção {}
Você irá pagar {}""".format(pagamento,saldo))
elif pagamento == 3:
pagamento = 'pagamento parcelado em 3x ou mais'
saldo = preco + (preco*20/100)
print("""Você escolheu a opção {}
Você irá pagar {}""".format(pagamento,saldo)) | [
1,
396,
29965,
29885,
330,
4578,
455,
3136,
316,
282,
5049,
359,
1027,
2701,
13,
13,
1457,
1111,
353,
5785,
29898,
2080,
877,
24399,
288,
16497,
1146,
752,
336,
29973,
525,
876,
13,
13573,
4487,
353,
938,
29898,
2080,
703,
15945,
24399,
724,
29976,
263,
5954,
316,
10203,
4487,
29973,
29871,
13,
14991,
568,
29871,
29900,
1702,
10203,
4487,
818,
21225,
694,
4538,
354,
3350,
2123,
923,
802,
13,
14991,
568,
29871,
29896,
1702,
10203,
4487,
818,
21225,
694,
7774,
1368,
13,
14991,
568,
29871,
29906,
1702,
10203,
4487,
610,
2242,
912,
953,
16659,
29871,
29906,
29916,
13,
14991,
568,
29871,
29941,
1702,
10203,
4487,
610,
2242,
912,
953,
29871,
29941,
29916,
2123,
3503,
29871,
13,
15945,
5783,
13,
13,
361,
10203,
4487,
1275,
29871,
29900,
29901,
13,
1678,
10203,
4487,
353,
525,
13573,
4487,
818,
21225,
953,
4538,
354,
3350,
2123,
923,
802,
29915,
13,
1678,
4497,
1867,
353,
758,
1111,
448,
313,
1457,
1111,
29930,
29896,
29900,
29914,
29896,
29900,
29900,
29897,
13,
1678,
1596,
703,
15945,
29963,
542,
30037,
25224,
354,
29884,
263,
1015,
2340,
6571,
13,
1678,
478,
542,
30037,
3805,
29976,
10203,
279,
426,
5038,
29908,
1642,
4830,
29898,
13573,
4487,
29892,
19585,
1867,
876,
13,
23681,
10203,
4487,
1275,
29871,
29896,
29901,
13,
1678,
10203,
4487,
353,
525,
13573,
4487,
818,
21225,
694,
7774,
1368,
29915,
13,
1678,
4497,
1867,
353,
758,
1111,
448,
313,
1457,
1111,
29930,
29945,
29914,
29896,
29900,
29900,
29897,
13,
1678,
1596,
703,
15945,
29963,
542,
30037,
25224,
354,
29884,
263,
1015,
2340,
6571,
13,
1678,
478,
542,
30037,
3805,
29976,
10203,
279,
426,
5038,
29908,
1642,
4830,
29898,
13573,
4487,
29892,
19585,
1867,
876,
13,
23681,
10203,
4487,
1275,
29871,
29906,
29901,
13,
1678,
10203,
4487,
353,
525,
13573,
4487,
610,
2242,
912,
953,
16659,
29871,
29906,
29916,
29915,
13,
1678,
4497,
1867,
353,
758,
1111,
13,
1678,
1596,
703,
15945,
29963,
542,
30037,
25224,
354,
29884,
263,
1015,
2340,
6571,
13,
1678,
478,
542,
30037,
3805,
29976,
10203,
279,
426,
5038,
29908,
1642,
4830,
29898,
13573,
4487,
29892,
19585,
1867,
876,
13,
23681,
10203,
4487,
1275,
29871,
29941,
29901,
13,
1678,
10203,
4487,
353,
525,
13573,
4487,
610,
2242,
912,
953,
29871,
29941,
29916,
2123,
3503,
29915,
13,
1678,
4497,
1867,
353,
758,
1111,
718,
313,
1457,
1111,
29930,
29906,
29900,
29914,
29896,
29900,
29900,
29897,
13,
1678,
1596,
703,
15945,
29963,
542,
30037,
25224,
354,
29884,
263,
1015,
2340,
6571,
13,
1678,
478,
542,
30037,
3805,
29976,
10203,
279,
426,
5038,
29908,
1642,
4830,
29898,
13573,
4487,
29892,
19585,
1867,
876,
2
] |
3Sum15.py | Bit64L/LeetCode-Python- | 0 | 114876 | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
n = len(nums)
ans = []
for i in range(0, n-2):
if i > 0 and nums[i] == nums[i-1]:
continue
j,k = i + 1, n - 1
while j < k:
s = nums[i] + nums[j] + nums[k]
if s > 0:
k -= 1
elif s < 0:
j += 1
else:
ans.append([nums[i], nums[j], nums[k]])
while j<k and nums[j] == nums[j+1]:
j += 1
while j<k and nums[k] == nums[k-1]:
k -= 1
j, k = j+1, k-1
return ans
solution = Solution()
print(solution.threeSum( [-1, 0, 1, 2, -1, -4]))
| [
1,
770,
24380,
29898,
3318,
1125,
13,
1678,
822,
2211,
11139,
29898,
1311,
29892,
954,
29879,
1125,
13,
4706,
9995,
13,
4706,
584,
1853,
954,
29879,
29901,
2391,
29961,
524,
29962,
13,
4706,
584,
29878,
1853,
29901,
2391,
29961,
1293,
29961,
524,
5262,
13,
4706,
9995,
13,
4706,
954,
29879,
29889,
6605,
580,
13,
4706,
302,
353,
7431,
29898,
1949,
29879,
29897,
13,
4706,
6063,
353,
5159,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
302,
29899,
29906,
1125,
13,
9651,
565,
474,
1405,
29871,
29900,
322,
954,
29879,
29961,
29875,
29962,
1275,
954,
29879,
29961,
29875,
29899,
29896,
5387,
13,
18884,
6773,
13,
9651,
432,
29892,
29895,
353,
474,
718,
29871,
29896,
29892,
302,
448,
29871,
29896,
13,
9651,
1550,
432,
529,
413,
29901,
13,
18884,
269,
353,
954,
29879,
29961,
29875,
29962,
718,
954,
29879,
29961,
29926,
29962,
718,
954,
29879,
29961,
29895,
29962,
13,
18884,
565,
269,
1405,
29871,
29900,
29901,
13,
462,
1678,
413,
22361,
29871,
29896,
13,
18884,
25342,
269,
529,
29871,
29900,
29901,
13,
462,
1678,
432,
4619,
29871,
29896,
13,
18884,
1683,
29901,
13,
462,
1678,
6063,
29889,
4397,
4197,
1949,
29879,
29961,
29875,
1402,
954,
29879,
29961,
29926,
1402,
954,
29879,
29961,
29895,
24960,
13,
462,
1678,
1550,
432,
29966,
29895,
322,
954,
29879,
29961,
29926,
29962,
1275,
954,
29879,
29961,
29926,
29974,
29896,
5387,
13,
462,
4706,
432,
4619,
29871,
29896,
13,
462,
1678,
1550,
432,
29966,
29895,
322,
954,
29879,
29961,
29895,
29962,
1275,
954,
29879,
29961,
29895,
29899,
29896,
5387,
13,
462,
4706,
413,
22361,
29871,
29896,
13,
462,
1678,
432,
29892,
413,
353,
432,
29974,
29896,
29892,
413,
29899,
29896,
13,
4706,
736,
6063,
13,
13,
2929,
918,
353,
24380,
580,
13,
2158,
29898,
2929,
918,
29889,
17536,
11139,
29898,
21069,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
448,
29896,
29892,
448,
29946,
12622,
13,
2
] |
TaskManager/profiles/views.py | Z0ltek/TaskManager_v2 | 0 | 129182 | <filename>TaskManager/profiles/views.py
from django.contrib.auth import login as auth_login
from django.http import Http404
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import TemplateView
from django.contrib.auth import logout
from django.contrib.auth.models import User
from .forms import SignUpForm
from .forms import CreateTaskForm
from .forms import CreateSubtaskForm
from .models import Project as ProjectModel, Task as TaskModel, Subtask, Status
def HomeView(request):
return render(request, 'home.html', {})
def projectview(request):
proj = ProjectModel.objects.filter(owner=request.user)
return render(request, 'projects.html', {'proj': proj})
def signup(request):
if request.method == 'POST':
form = SignUpForm(request.POST)
if form.is_valid():
user = form.save()
auth_login(request, user)
return redirect('home')
else:
form = SignUpForm()
return render(request, 'signup.html', {'form': form})
def LogoutView(request):
logout(request)
def project_tasks(request, id):
project = get_object_or_404(ProjectModel, id=id)
tasks = project.tasks.all().order_by('status')
return render(request, 'tasks.html', {'project': project, 'tasks': tasks})
def task_view(request, id, task_id):
project = get_object_or_404(ProjectModel, id=id)
task = get_object_or_404(TaskModel, id=task_id)
subtasks = task.subtasks.all().order_by('status')
if request.method == 'POST':
status_id = request.POST.get('status_id')
task.status = status_id
task.save()
return redirect('project_tasks', id=project.id)
return render(request, 'subtasks.html',
{'project': project, 'task': task, 'subtasks': subtasks, 'status': Status.STATUS_CHOISE})
def view_subtask(request, id, task_id, subtask_id):
project = get_object_or_404(ProjectModel, id=id)
task = get_object_or_404(TaskModel, id=task_id)
subtask = get_object_or_404(Subtask, id=subtask_id)
if request.method == 'POST':
status_id = request.POST.get('status_id')
subtask.status = status_id
subtask.save()
return redirect('task_view', id=id, task_id=task.id)
return render(request, 'view_subtasks.html',
{'project': project, 'task': task, 'subtask': subtask, 'status': Status.STATUS_CHOISE})
def new_task(request, id):
project = get_object_or_404(ProjectModel, id=id)
user = User.objects.first()
if request.method == 'POST':
form = CreateTaskForm(request.POST)
if form.is_valid():
task = form.save(commit=False)
task.project = project
task.created_by = user
task.status = 2
task.save()
return redirect('project_tasks', id=project.id)
else:
form = CreateTaskForm()
return render(request, 'new_task.html', {'form': form, 'project': project})
def new_subtask(request, id, task_id):
project = get_object_or_404(ProjectModel, id=id)
task = get_object_or_404(TaskModel, id=task_id)
user = User.objects.first()
if request.method == 'POST':
form = CreateSubtaskForm(request.POST)
if form.is_valid():
subtask = form.save(commit=False)
subtask.task = task
subtask.created_by = user
subtask.status = 2
subtask.save()
return redirect('task_view', id=id, task_id=task.id)
else:
form = CreateSubtaskForm()
return render(request, 'new_subtask.html', {'form': form, 'task': task, 'project': project})
| [
1,
529,
9507,
29958,
5398,
3260,
29914,
771,
5325,
29914,
7406,
29889,
2272,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
6464,
408,
4817,
29918,
7507,
13,
3166,
9557,
29889,
1124,
1053,
9056,
29946,
29900,
29946,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29892,
6684,
29892,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
13,
3166,
9557,
29889,
7406,
29889,
19206,
1053,
25663,
1043,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
1480,
449,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
4911,
13,
13,
3166,
869,
9514,
1053,
9954,
3373,
2500,
13,
3166,
869,
9514,
1053,
6204,
5398,
2500,
13,
3166,
869,
9514,
1053,
6204,
4035,
7662,
2500,
13,
13,
3166,
869,
9794,
1053,
8010,
408,
8010,
3195,
29892,
9330,
408,
9330,
3195,
29892,
3323,
7662,
29892,
16034,
13,
13,
13,
1753,
8778,
1043,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
5184,
29889,
1420,
742,
426,
1800,
13,
13,
13,
1753,
2060,
1493,
29898,
3827,
1125,
13,
1678,
410,
29926,
353,
8010,
3195,
29889,
12650,
29889,
4572,
29898,
20348,
29922,
3827,
29889,
1792,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
16418,
29889,
1420,
742,
11117,
20865,
2396,
410,
29926,
1800,
13,
13,
13,
1753,
1804,
786,
29898,
3827,
1125,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
883,
353,
9954,
3373,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
1404,
353,
883,
29889,
7620,
580,
13,
9651,
4817,
29918,
7507,
29898,
3827,
29892,
1404,
29897,
13,
9651,
736,
6684,
877,
5184,
1495,
13,
1678,
1683,
29901,
13,
4706,
883,
353,
9954,
3373,
2500,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4530,
786,
29889,
1420,
742,
11117,
689,
2396,
883,
1800,
13,
13,
13,
1753,
4522,
449,
1043,
29898,
3827,
1125,
13,
1678,
1480,
449,
29898,
3827,
29897,
13,
13,
13,
1753,
2060,
29918,
20673,
29898,
3827,
29892,
1178,
1125,
13,
1678,
2060,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7653,
3195,
29892,
1178,
29922,
333,
29897,
13,
1678,
9595,
353,
2060,
29889,
20673,
29889,
497,
2141,
2098,
29918,
1609,
877,
4882,
1495,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
20673,
29889,
1420,
742,
11117,
4836,
2396,
2060,
29892,
525,
20673,
2396,
9595,
1800,
13,
13,
13,
1753,
3414,
29918,
1493,
29898,
3827,
29892,
1178,
29892,
3414,
29918,
333,
1125,
13,
1678,
2060,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7653,
3195,
29892,
1178,
29922,
333,
29897,
13,
1678,
3414,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
5398,
3195,
29892,
1178,
29922,
7662,
29918,
333,
29897,
13,
1678,
1014,
20673,
353,
3414,
29889,
1491,
20673,
29889,
497,
2141,
2098,
29918,
1609,
877,
4882,
1495,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
4660,
29918,
333,
353,
2009,
29889,
5438,
29889,
657,
877,
4882,
29918,
333,
1495,
13,
13,
4706,
3414,
29889,
4882,
353,
4660,
29918,
333,
13,
4706,
3414,
29889,
7620,
580,
13,
4706,
736,
6684,
877,
4836,
29918,
20673,
742,
1178,
29922,
4836,
29889,
333,
29897,
13,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1491,
20673,
29889,
1420,
742,
13,
462,
29871,
11117,
4836,
2396,
2060,
29892,
525,
7662,
2396,
3414,
29892,
525,
1491,
20673,
2396,
1014,
20673,
29892,
525,
4882,
2396,
16034,
29889,
27047,
29918,
3210,
29949,
29902,
1660,
1800,
13,
13,
13,
1753,
1776,
29918,
1491,
7662,
29898,
3827,
29892,
1178,
29892,
3414,
29918,
333,
29892,
1014,
7662,
29918,
333,
1125,
13,
1678,
2060,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7653,
3195,
29892,
1178,
29922,
333,
29897,
13,
1678,
3414,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
5398,
3195,
29892,
1178,
29922,
7662,
29918,
333,
29897,
13,
1678,
1014,
7662,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
4035,
7662,
29892,
1178,
29922,
1491,
7662,
29918,
333,
29897,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
4660,
29918,
333,
353,
2009,
29889,
5438,
29889,
657,
877,
4882,
29918,
333,
1495,
13,
4706,
1014,
7662,
29889,
4882,
353,
4660,
29918,
333,
13,
4706,
1014,
7662,
29889,
7620,
580,
13,
4706,
736,
6684,
877,
7662,
29918,
1493,
742,
1178,
29922,
333,
29892,
3414,
29918,
333,
29922,
7662,
29889,
333,
29897,
13,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1493,
29918,
1491,
20673,
29889,
1420,
742,
13,
462,
29871,
11117,
4836,
2396,
2060,
29892,
525,
7662,
2396,
3414,
29892,
525,
1491,
7662,
2396,
1014,
7662,
29892,
525,
4882,
2396,
16034,
29889,
27047,
29918,
3210,
29949,
29902,
1660,
1800,
13,
13,
13,
1753,
716,
29918,
7662,
29898,
3827,
29892,
1178,
1125,
13,
1678,
2060,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7653,
3195,
29892,
1178,
29922,
333,
29897,
13,
1678,
1404,
353,
4911,
29889,
12650,
29889,
4102,
580,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
883,
353,
6204,
5398,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
3414,
353,
883,
29889,
7620,
29898,
15060,
29922,
8824,
29897,
13,
9651,
3414,
29889,
4836,
353,
2060,
13,
9651,
3414,
29889,
11600,
29918,
1609,
353,
1404,
13,
9651,
3414,
29889,
4882,
353,
29871,
29906,
13,
9651,
3414,
29889,
7620,
580,
13,
9651,
736,
6684,
877,
4836,
29918,
20673,
742,
1178,
29922,
4836,
29889,
333,
29897,
13,
1678,
1683,
29901,
13,
4706,
883,
353,
6204,
5398,
2500,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1482,
29918,
7662,
29889,
1420,
742,
11117,
689,
2396,
883,
29892,
525,
4836,
2396,
2060,
1800,
13,
13,
13,
1753,
716,
29918,
1491,
7662,
29898,
3827,
29892,
1178,
29892,
3414,
29918,
333,
1125,
13,
1678,
2060,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7653,
3195,
29892,
1178,
29922,
333,
29897,
13,
1678,
3414,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
5398,
3195,
29892,
1178,
29922,
7662,
29918,
333,
29897,
13,
1678,
1404,
353,
4911,
29889,
12650,
29889,
4102,
580,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
883,
353,
6204,
4035,
7662,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
1014,
7662,
353,
883,
29889,
7620,
29898,
15060,
29922,
8824,
29897,
13,
9651,
1014,
7662,
29889,
7662,
353,
3414,
13,
9651,
1014,
7662,
29889,
11600,
29918,
1609,
353,
1404,
13,
9651,
1014,
7662,
29889,
4882,
353,
29871,
29906,
13,
9651,
1014,
7662,
29889,
7620,
580,
13,
9651,
736,
6684,
877,
7662,
29918,
1493,
742,
1178,
29922,
333,
29892,
3414,
29918,
333,
29922,
7662,
29889,
333,
29897,
13,
1678,
1683,
29901,
13,
4706,
883,
353,
6204,
4035,
7662,
2500,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1482,
29918,
1491,
7662,
29889,
1420,
742,
11117,
689,
2396,
883,
29892,
525,
7662,
2396,
3414,
29892,
525,
4836,
2396,
2060,
1800,
13,
2
] |
rest_framework_swagger/compat.py | kaitlin/django-rest-swagger | 0 | 1615886 | <filename>rest_framework_swagger/compat.py
import platform
if platform.python_version_tuple() < ('2', '7'):
import ordereddict
OrderedDict = ordereddict.OrderedDict
else:
import collections
OrderedDict = collections.OrderedDict
if platform.python_version_tuple() < ('3', '0'):
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
else:
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.strict = False
self.convert_charrefs = True
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
try:
from django.utils.module_loading import import_string
except ImportError:
def import_string(dotted_path):
from django.utils.importlib import import_module
from django.core.exceptions import ImproperlyConfigured
module, attr = dotted_path.rsplit('.', 1)
try:
mod = import_module(module)
except ImportError as e:
raise ImproperlyConfigured('Error importing module %s: "%s"' %
(module, e))
try:
view = getattr(mod, attr)
except AttributeError:
raise ImproperlyConfigured('Module "%s" does not define a "%s".'
% (module, attr))
return view
| [
1,
529,
9507,
29958,
5060,
29918,
4468,
29918,
2774,
9921,
29914,
12667,
29889,
2272,
13,
5215,
7481,
13,
361,
7481,
29889,
4691,
29918,
3259,
29918,
23583,
580,
529,
6702,
29906,
742,
525,
29955,
29374,
13,
1678,
1053,
10372,
8977,
13,
1678,
8170,
287,
21533,
353,
10372,
8977,
29889,
7514,
287,
21533,
13,
2870,
29901,
13,
1678,
1053,
16250,
13,
1678,
8170,
287,
21533,
353,
16250,
29889,
7514,
287,
21533,
13,
13,
361,
7481,
29889,
4691,
29918,
3259,
29918,
23583,
580,
529,
6702,
29941,
742,
525,
29900,
29374,
13,
1678,
515,
4544,
11726,
1053,
4544,
11726,
13,
13,
1678,
770,
23158,
855,
374,
2496,
29898,
7020,
11726,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
1125,
13,
9651,
1583,
29889,
12071,
580,
13,
9651,
1583,
29889,
29888,
287,
353,
5159,
13,
13,
4706,
822,
4386,
29918,
1272,
29898,
1311,
29892,
270,
1125,
13,
9651,
1583,
29889,
29888,
287,
29889,
4397,
29898,
29881,
29897,
13,
13,
4706,
822,
679,
29918,
1272,
29898,
1311,
1125,
13,
9651,
736,
525,
4286,
7122,
29898,
1311,
29889,
29888,
287,
29897,
13,
2870,
29901,
13,
1678,
515,
3472,
29889,
16680,
1053,
4544,
11726,
13,
13,
1678,
770,
23158,
855,
374,
2496,
29898,
7020,
11726,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
1125,
13,
9651,
1583,
29889,
12071,
580,
13,
9651,
1583,
29889,
710,
919,
353,
7700,
13,
9651,
1583,
29889,
13441,
29918,
3090,
24539,
353,
5852,
13,
9651,
1583,
29889,
29888,
287,
353,
5159,
13,
13,
4706,
822,
4386,
29918,
1272,
29898,
1311,
29892,
270,
1125,
13,
9651,
1583,
29889,
29888,
287,
29889,
4397,
29898,
29881,
29897,
13,
13,
4706,
822,
679,
29918,
1272,
29898,
1311,
1125,
13,
9651,
736,
525,
4286,
7122,
29898,
1311,
29889,
29888,
287,
29897,
13,
13,
13,
1753,
17820,
29918,
11338,
29898,
1420,
1125,
13,
1678,
269,
353,
23158,
855,
374,
2496,
580,
13,
1678,
269,
29889,
18798,
29898,
1420,
29897,
13,
1678,
736,
269,
29889,
657,
29918,
1272,
580,
13,
13,
2202,
29901,
13,
1678,
515,
9557,
29889,
13239,
29889,
5453,
29918,
13234,
1053,
1053,
29918,
1807,
13,
19499,
16032,
2392,
29901,
13,
1678,
822,
1053,
29918,
1807,
29898,
29881,
15048,
29918,
2084,
1125,
13,
4706,
515,
9557,
29889,
13239,
29889,
5215,
1982,
1053,
1053,
29918,
5453,
13,
4706,
515,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
1954,
771,
546,
368,
3991,
2955,
13,
4706,
3883,
29892,
12421,
353,
270,
15048,
29918,
2084,
29889,
2288,
2830,
12839,
742,
29871,
29896,
29897,
13,
4706,
1018,
29901,
13,
9651,
878,
353,
1053,
29918,
5453,
29898,
5453,
29897,
13,
4706,
5174,
16032,
2392,
408,
321,
29901,
13,
9651,
12020,
1954,
771,
546,
368,
3991,
2955,
877,
2392,
28348,
3883,
1273,
29879,
29901,
11860,
29879,
29908,
29915,
1273,
13,
462,
462,
539,
313,
5453,
29892,
321,
876,
13,
4706,
1018,
29901,
13,
9651,
1776,
353,
679,
5552,
29898,
1545,
29892,
12421,
29897,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
12020,
1954,
771,
546,
368,
3991,
2955,
877,
7355,
11860,
29879,
29908,
947,
451,
4529,
263,
11860,
29879,
1642,
29915,
13,
462,
462,
539,
1273,
313,
5453,
29892,
12421,
876,
13,
4706,
736,
1776,
13,
2
] |
Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py | jrauen/content | 2 | 91008 | <gh_stars>1-10
# type: ignore
from copy import deepcopy
from typing import Any, Dict, List, Optional, Tuple
from urllib.parse import urljoin
import urllib3
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
# disable insecure warnings
urllib3.disable_warnings()
DEFAULT_PAGE = 1
DEFAULT_LIMIT = 50
DEFAULT_MAX_FETCH = DEFAULT_LIMIT
DEFAULT_EVENTS_FETCH = DEFAULT_LIMIT
DEFAULT_EVENT_TYPE = 'application'
DEFAULT_FIRST_FETCH = '7 days'
MAX_LIMIT = 100
MAX_FETCH = 200
MAX_EVENTS_FETCH = 200
TIME_PERIOD_MAPPING = {
'Last 60 Minutes': 3600,
'Last 24 Hours': 86400,
'Last 7 Days': 604800,
'Last 30 Days': 2592000,
'Last 60 Days': 5184000,
'Last 90 Days': 7776000
}
class Client(BaseClient):
"""
Client for Netskope RESTful API.
Args:
base_url (str): The base URL of Netskope.
token (str): The token to authenticate against Netskope API.
use_ssl (bool): Specifies whether to verify the SSL certificate or not.
use_proxy (bool): Specifies if to use XSOAR proxy settings.
"""
def __init__(self, base_url: str, token: str, use_ssl: bool, use_proxy: bool):
super().__init__(urljoin(base_url, '/api/v1/'), verify=use_ssl, proxy=use_proxy)
self._session.params['token'] = token
def list_events_request(self,
query: Optional[str] = None,
event_type: Optional[str] = None,
timeperiod: Optional[int] = None,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
insertion_start_time: Optional[int] = None,
insertion_end_time: Optional[int] = None,
limit: Optional[int] = None,
skip: Optional[int] = None,
unsorted: Optional[bool] = None) -> Dict[str, Any]:
"""
Get events extracted from SaaS traffic and or logs.
Args:
query (Optional[str]): Free query to filter the events.
event_type (Optional[str]): Select events by their type.
timeperiod (Optional[int]): Get all events from a certain time period.
start_time (Optional[int]): Restrict events to those that have timestamps greater than the provided timestamp.
end_time (Optional[int]): Restrict events to those that have timestamps less than or equal to the provided timestamp.
insertion_start_time (Optional[int]): Restrict events to those that were inserted to the system
after the provided timestamp.
insertion_end_time (Optional[int]): Restrict events to those that were inserted to the system
before the provided timestamp.
limit (Optional[int]): The maximum amount of events to retrieve (up to 10000 events).
skip (Optional[int]): The skip number of the events to retrieve (minimum is 1).
unsorted (Optional[bool]): If true, the returned data will not be sorted (useful for improved performance).
Returns:
Dict[str, Any]: Netskope events.
"""
body = remove_empty_elements({
'query': query,
'type': event_type,
'timeperiod': timeperiod,
'starttime': start_time,
'endtime': end_time,
'insertionstarttime': insertion_start_time,
'insertionendtime': insertion_end_time,
'limit': limit,
'skip': skip,
'unsorted': unsorted
})
return self._http_request(method='POST', url_suffix='events', json_data=body)
def list_alerts_request(self,
query: Optional[str] = None,
alert_type: Optional[str] = None,
acked: Optional[bool] = None,
timeperiod: Optional[int] = None,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
insertion_start_time: Optional[int] = None,
insertion_end_time: Optional[int] = None,
limit: Optional[int] = None,
skip: Optional[int] = None,
unsorted: Optional[bool] = None) -> Dict[str, Any]:
"""
Get alerts generated by Netskope, including policy, DLP, and watch list alerts.
Args:
query (Optional[str]): Free query to filter the alerts.
alert_type (Optional[str]): Select alerts by their type.
acked (Optional[bool]): Whether to retrieve acknowledged alerts or not.
timeperiod (Optional[int]): Get alerts from certain time period.
start_time (Optional[int]): Restrict alerts to those that have timestamps greater than the provided timestamp.
end_time (Optional[int]): Restrict alerts to those that have timestamps less than or equal to the provided timestamp.
insertion_start_time (Optional[int]): Restrict alerts which have been inserted into the system
after the provided timestamp.
insertion_end_time (Optional[int]): Restrict alerts which have been inserted into the system
before the provided timestamp.
limit (Optional[int]): The maximum number of alerts to return (up to 10000).
skip (Optional[int]): The skip number of the alerts to retrieve (minimum is 1).
unsorted (Optional[bool]): If true, the returned data will not be sorted (useful for improved performance).
Returns:
Dict[str, Any]: Netskope alerts.
"""
body = remove_empty_elements({
'query': query,
'alert_type': alert_type,
'acked': acked,
'timeperiod': timeperiod,
'starttime': start_time,
'endtime': end_time,
'insertionstarttime': insertion_start_time,
'insertionendtime': insertion_end_time,
'limit': limit,
'skip': skip,
'unsorted': unsorted
})
return self._http_request(method='POST', url_suffix='alerts', json_data=body)
def list_quarantined_files_request(self,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
limit: Optional[int] = None,
skip: Optional[int] = None) -> Dict[str, Any]:
"""
List all quarantined files.
Args:
start_time (Optional[int]): Get files last modified within a certain time period.
end_time (Optional[int]): Get files last modified within a certain time period.
limit (Optional[int]): The maximum amount of clients to retrieve (up to 10000).
skip (Optional[int]): The skip number of the clients to retrieve (minimum is 1).
Returns:
Dict[str, Any]: Netskope quarantine files.
"""
body = remove_empty_elements({
'starttime': start_time,
'endtime': end_time,
'limit': limit,
'skip': skip,
'op': 'get-files'
})
return self._http_request(method='POST', url_suffix='quarantine', json_data=body)
def get_quarantined_file_request(self, quarantine_profile_id: str, file_id: str) -> bytes:
"""
Download a quarantined file.
Args:
quarantine_profile_id (str): The ID of quarantine profile.
file_id (str): The ID of the quarantined file.
Returns:
bytes: The quarantined file content.
"""
body = {
'quarantine_profile_id': quarantine_profile_id,
'file_id': file_id,
'op': 'download-url'
}
return self._http_request(method='POST',
url_suffix='quarantine',
json_data=body,
resp_type='content')
def update_quarantined_file_request(self, quarantine_profile_id: str, file_id: str,
action: str) -> None:
"""
Take an action on a quarantined file.
Args:
quarantine_profile_id (str): The profile id of the quarantined file.
file_id (str): The id of the quarantined file.
action (str): Action to be performed on a quarantined.
"""
body = {
'quarantine_profile_id': quarantine_profile_id,
'file_id': file_id,
'action': action,
'op': 'take-action'
}
self._http_request(method='POST', url_suffix='quarantine', json_data=body, resp_type='text')
def update_url_list_request(self, name: str, urls: List[str]) -> None:
"""
Update the URL List with the values provided.
Args:
name (str): Name of an existing URL List shown in the Netskope UI on the URL List skip.
urls (List[str]): The content of the URL list.
"""
body = {'name': name, 'list': ','.join(urls)}
self._http_request(method='POST', url_suffix='updateUrlList', json_data=body)
def update_file_hash_list_request(self, name: str, hashes: List[str]) -> None:
"""
Update file hash list with the values provided.
Args:
name (str): Name of an existing file hash list shown in the Netskope UI on the file hash list skip.
hashes (str): List of file hashes (md5 or sha256).
"""
body = {'name': name, 'list': ','.join(hashes)}
return self._http_request(method='POST', url_suffix='updateFileHashList', json_data=body)
def list_clients_request(self,
query: Optional[str] = None,
limit: Optional[int] = None,
skip: Optional[int] = None) -> Dict[str, Any]:
"""
Get information about the Netskope clients.
Args:
query (Optional[str]): Free query on the clients, based on the client fields.
limit (Optional[int]): The maximum amount of clients to retrieve (up to 10000).
skip (Optional[int]): The skip number of the clients to retrieve (minimum is 1).
Returns:
Dict[str, Any]: The clients information.
"""
body = remove_empty_elements({'query': query, 'limit': limit, 'skip': skip})
return self._http_request(method='POST', url_suffix='clients', params=body)
def _http_request(self, *args, **kwargs):
response = super()._http_request(*args, **kwargs)
if isinstance(response, dict) and 'errors' in response:
errors = '\n'.join(response['errors'])
raise DemistoException(f'Invalid API call: {errors}', res=response)
return response
def arg_to_boolean(arg: Optional[str]) -> Optional[bool]:
"""
Converts an XSOAR argument to a Python boolean or None.
Args:
arg (Optional[str]): The argument to convert.
Returns:
Optional[bool]: A boolean if arg can be converted,
or None if arg is None.
"""
if arg is None:
return None
return argToBoolean(arg)
def arg_to_seconds_timestamp(arg: Optional[str]) -> Optional[int]:
"""
Converts an XSOAR date string argument to a timestamp in seconds.
Args:
arg (Optional[str]): The argument to convert.
Returns:
Optional[int]: A timestamp if arg can be converted,
or None if arg is None.
"""
if arg is None:
return None
return date_to_seconds_timestamp(arg_to_datetime(arg))
def date_to_seconds_timestamp(date_str_or_dt: Union[str, datetime]) -> int:
"""
Converts date string or datetime object to a timestamp in seconds.
Args:
date_str_or_dt (Union[str, datetime]): The datestring or datetime.
Returns:
int: The timestamp in seconds.
"""
return date_to_timestamp(date_str_or_dt) // 1000
def validate_time_arguments(start_time: Optional[int] = None,
end_time: Optional[int] = None,
insertion_start_time: Optional[int] = None,
insertion_end_time: Optional[int] = None,
timeperiod: Optional[int] = None) -> None:
"""
Validates time arguments from the user.
The user must provide one of the following:
- start_time and end_time.
- insertion_start_time and insertion_end_time.
- timeperiod.
Args:
start_time (Optional[int], optional): The start time to fetch from the API.
end_time (Optional[int], optional): The end time to fetch from the API.
insertion_start_time (Optional[int], optional): The insertion start time to fetch from the API.
insertion_end_time (Optional[int], optional): The insertion end time to fetch from the API.
timeperiod (Optional[str], optional): The timeperiod to fetch from the API.
Raises:
DemistoException: The user did not provide valid timestamp.
"""
combination = (all((start_time, end_time)), all(
(insertion_start_time, insertion_end_time)), bool(timeperiod))
if not any(combination):
raise DemistoException('Missing time arguments. Please provide start_time and end_time, '
'or insertion_start_time and or insertion_end_time or timeperiod.')
if combination.count(True) > 1:
raise DemistoException(
'Invalid time arguments. Please provide only start_time and end_time, '
'or insertion_start_time and or insertion_end_time or timeperiod. '
'You must not combine between the mentioned options.')
def validate_fetch_params(max_fetch: int, max_events_fetch: int, fetch_events: bool,
first_fetch: str, event_types: List[str]) -> None:
"""
Validates the parameters for fetch incident command.
Args:
max_fetch: (int): The maximum number of incidents for one fetch.
max_events_fetch (int) The maximum number of events per incident for one fetch.
fetch_events (bool): Whether or not fetch events when fetching incident.
first_fetch: (str): First fetch time in words.
"""
if first_fetch:
arg_to_datetime(first_fetch) # verify that it is a date.
if max_fetch > MAX_FETCH:
return_error(f'The Maximum number of incidents per fetch should not exceed {MAX_FETCH}.')
if fetch_events and max_events_fetch > MAX_EVENTS_FETCH:
return_error(
f'The Maximum number of events for each incident per fetch should not exceed {MAX_EVENTS_FETCH}.'
)
if not isinstance(event_types, list):
return_error('The fetched event types must be a list.')
def get_pagination_readable_message(header: str, page: int, limit: int) -> str:
return f'{header}\n Current page size: {limit}\n Showing page {page} out of others that may exist.'
def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]:
"""
Gets and validates pagination arguments for client (skip and limit).
Args:
args (Dict[str, Any]): The command arguments (page and limit).
Returns:
Tuple[int, int]: The page, calculated skip and limit after validation.
"""
page = arg_to_number(args.get('page', DEFAULT_PAGE))
limit = arg_to_number(args.get('limit', DEFAULT_LIMIT))
if page < 1:
raise DemistoException('Page argument must be greater than 1')
if not 1 <= limit <= MAX_LIMIT:
raise DemistoException(f'Limit argument must be between 1 to {MAX_LIMIT}')
return page, (page - 1) * limit, limit
def list_events_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Get events extracted from SaaS traffic and or logs.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
query = args.get('query')
event_type = args['event_type']
timeperiod = TIME_PERIOD_MAPPING.get(args.get('timeperiod'))
start_time = arg_to_seconds_timestamp(args.get('start_time'))
end_time = arg_to_seconds_timestamp(args.get('end_time'))
insertion_start_time = arg_to_seconds_timestamp(args.get('insertion_start_time'))
insertion_end_time = arg_to_seconds_timestamp(args.get('insertion_end_time'))
page, skip, limit = get_pagination_arguments(args)
unsorted = arg_to_boolean(args.get('unsorted'))
validate_time_arguments(start_time=start_time,
end_time=end_time,
timeperiod=timeperiod,
insertion_start_time=insertion_start_time,
insertion_end_time=insertion_end_time)
response = client.list_events_request(query=query,
event_type=event_type,
timeperiod=timeperiod,
start_time=start_time,
end_time=end_time,
insertion_start_time=insertion_start_time,
insertion_end_time=insertion_end_time,
limit=limit,
skip=skip,
unsorted=unsorted)
outputs = deepcopy(response['data'])
for event in outputs:
event['event_id'] = event['_id']
event['timestamp'] = timestamp_to_datestring(event['timestamp'] * 1000)
readable_output = tableToMarkdown(
get_pagination_readable_message('Events List:', page=page, limit=limit),
outputs,
removeNull=True,
headers=['event_id', 'timestamp', 'type', 'access_method', 'app', 'traffic_type'],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.Event',
outputs_key_field='event_id',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Get alerts generated by Netskope, including policy, DLP, and watch list alerts.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
query = args.get('query')
alert_type = args.get('alert_type')
acked = arg_to_boolean(args.get('acked'))
timeperiod = TIME_PERIOD_MAPPING.get(args.get('timeperiod'))
start_time = arg_to_seconds_timestamp(args.get('start_time'))
end_time = arg_to_seconds_timestamp(args.get('end_time'))
insertion_start_time = arg_to_seconds_timestamp(args.get('insertion_start_time'))
insertion_end_time = arg_to_seconds_timestamp(args.get('insertion_end_time'))
page, skip, limit = get_pagination_arguments(args)
unsorted = arg_to_boolean(args.get('unsorted'))
validate_time_arguments(start_time=start_time,
end_time=end_time,
timeperiod=timeperiod,
insertion_start_time=insertion_start_time,
insertion_end_time=insertion_end_time)
response = client.list_alerts_request(query=query,
alert_type=alert_type,
acked=acked,
timeperiod=timeperiod,
start_time=start_time,
end_time=end_time,
insertion_start_time=insertion_start_time,
insertion_end_time=insertion_end_time,
limit=limit,
skip=skip,
unsorted=unsorted)
outputs = deepcopy(response['data'])
for alert in outputs:
alert['alert_id'] = alert['_id']
alert['timestamp'] = timestamp_to_datestring(alert['timestamp'] * 1000)
readable_output = tableToMarkdown(
get_pagination_readable_message('Alerts List:', page=page, limit=limit),
outputs,
removeNull=True,
headers=['alert_id', 'alert_name', 'alert_type', 'timestamp', 'action'],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.Alert',
outputs_key_field='alert_id',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def list_quarantined_files_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
List all quarantined files.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
start_time = arg_to_seconds_timestamp(args.get('start_time'))
end_time = arg_to_seconds_timestamp(args.get('end_time'))
page, skip, limit = get_pagination_arguments(args)
response = client.list_quarantined_files_request(start_time=start_time,
end_time=end_time,
limit=limit,
skip=skip)
outputs = dict_safe_get(response, ['data', 'quarantined'])
for output in outputs:
for file_output in output['files']:
file_output['quarantine_profile_id'] = output['quarantine_profile_id']
file_output['quarantine_profile_name'] = output['quarantine_profile_name']
outputs = sum((output['files'] for output in outputs), [])
readable_header = get_pagination_readable_message('Quarantined Files List:',
page=page,
limit=limit)
readable_output = tableToMarkdown(readable_header,
outputs,
removeNull=True,
headers=[
'quarantine_profile_id', 'quarantine_profile_name',
'file_id', 'original_file_name', 'policy'
],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.Quarantine',
outputs_key_field='file_id',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def get_quarantined_file_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Download a quarantined file.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
quarantine_profile_id = args['quarantine_profile_id']
file_id = args['file_id']
response = client.get_quarantined_file_request(quarantine_profile_id=quarantine_profile_id,
file_id=file_id)
return fileResult(filename=f'{file_id}.zip', data=response, file_type=EntryType.FILE)
def update_quarantined_file_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Take an action on a quarantined file.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
quarantine_profile_id = args['quarantine_profile_id']
file_id = args['file_id']
action = args['action']
client.update_quarantined_file_request(quarantine_profile_id=quarantine_profile_id,
file_id=file_id,
action=action)
readable_output = f'## The file {file_id} was successfully {action}ed!'
return CommandResults(readable_output=readable_output)
def update_url_list_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Update the URL List with the values provided.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
name = args['name']
urls = argToList(args['urls'])
client.update_url_list_request(name=name, urls=urls)
outputs = {'name': name, 'URL': urls}
readable_output = f'URL List {name}:\n{", ".join(urls)}'
return CommandResults(outputs_prefix='Netskope.URLList',
outputs_key_field='name',
outputs=outputs,
readable_output=readable_output)
def update_file_hash_list_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Update file hash list with the values provided.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
name = args.get('name')
hashes = argToList(args.get('hash'))
client.update_file_hash_list_request(name=name, hashes=hashes)
outputs = {'name': name, 'hash': hashes}
readable_output = f'Hash List {name}:\n{", ".join(hashes)}'
return CommandResults(outputs_prefix='Netskope.FileHashList',
outputs_key_field='name',
outputs=outputs,
readable_output=readable_output)
def list_clients_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
Get information about the Netskope clients.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
query = args.get('query')
page, skip, limit = get_pagination_arguments(args)
response = client.list_clients_request(query=query, limit=limit, skip=skip)
outputs = [client['attributes'] for client in response['data']]
for output in outputs:
output['client_id'] = output['_id']
readable_header = get_pagination_readable_message('Clients List:', page=page, limit=limit)
readable_output = tableToMarkdown(
readable_header,
outputs,
removeNull=True,
headers=['client_id', 'client_version', 'device_id', 'user_added_time'],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.Client',
outputs_key_field='client_id',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def list_host_associated_user_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
List all users of certain host by its hostname.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
hostname = args['hostname']
page, skip, limit = get_pagination_arguments(args)
response = client.list_clients_request(query=f'host_info.hostname eq {hostname}',
limit=limit,
skip=skip)
outputs = sum((client['attributes'].get('users') for client in response['data']), [])
for output in outputs:
output['user_id'] = output['_id']
readable_header = get_pagination_readable_message(f'Users Associated With {hostname}:',
page=page,
limit=limit)
readable_output = tableToMarkdown(readable_header,
outputs,
removeNull=True,
headers=['user_id', 'username', 'user_source'],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.User',
outputs_key_field='user_id',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def list_user_associated_host_command(client: Client, args: Dict[str, str]) -> CommandResults:
"""
List all hosts related to a certain username.
Args:
client (client): The Netskope client.
args (Dict[str, Any]): Command arguments from XSOAR.
Returns:
CommandResults: Command results with raw response, outputs and readable outputs.
"""
username = args['username']
page, skip, limit = get_pagination_arguments(args)
response = client.list_clients_request(query=f'username eq {username}', limit=limit, skip=skip)
outputs = []
for client in response['data']:
attributes = client['attributes']
agent_status = dict_safe_get(attributes, ['last_event', 'status'])
outputs.append({'agent_status': agent_status, **attributes['host_info']})
readable_header = get_pagination_readable_message(f'Hosts Associated With {username}:',
page=page,
limit=limit)
readable_output = tableToMarkdown(readable_header,
outputs,
removeNull=True,
headers=['hostname', 'os_version', 'agent_status'],
headerTransform=string_to_table_header)
return CommandResults(outputs_prefix='Netskope.Host',
outputs_key_field='nsdeviceuid',
outputs=outputs,
readable_output=readable_output,
raw_response=response)
def test_module(client: Client, max_fetch: int, first_fetch: str, fetch_events: bool,
max_events_fetch: int, event_types: List[str]) -> str:
"""
Validates all integration parameters, and tests connection to Netskope instance.
"""
validate_fetch_params(max_fetch, max_events_fetch, fetch_events, first_fetch, event_types)
client.list_alerts_request(limit=1,
skip=0,
start_time=date_to_seconds_timestamp(datetime.now()),
end_time=date_to_seconds_timestamp(datetime.now()))
return 'ok'
def fetch_multiple_type_events(client: Client, max_fetch: int, start_time: int,
event_types: List[str],
query: Optional[str]) -> List[Dict[str, Any]]:
"""
Fetches events from multiple types.
The function makes an API call for each type, since the API requires
specifying the event type.
Args:
client (Client): The Netskope client.
max_fetch (int): The maximum amount of events to fetch for each type.
start_time (int): The time to fetch the events from.
event_types (List[str]): The event types to fetch as incidents.
query (Optional[str]): Query for filtering the events.
Returns:
List[Dict[str, Any]]: The fetched events.
"""
events = []
if event_types:
max_fetch = max_fetch // len(event_types)
for event_type in event_types:
new_events = client.list_events_request(start_time=start_time,
end_time=date_to_seconds_timestamp(datetime.now()),
limit=max_fetch,
unsorted=False,
event_type=event_type,
query=query)['data']
for event in new_events:
event['event_id'] = event['_id']
event['incident_type'] = event_type
events.extend(new_events)
return events
def fetch_incidents(client: Client, max_fetch: int, first_fetch: str, fetch_events: bool,
max_events_fetch: int, event_types: List[str], alerts_query: Optional[str],
events_query: Optional[str]) -> None:
"""
Fetches alerts and events as incidents.
Args:
client (Client): The Netskope client.
max_fetch (int): Maximum number of incidents to fetch.
first_fetch (str): The timestamp to fetch the incidents from.
max_events_fetch (int): Maximum number of events to fetch.
event_types (List[str]): The type of events to fetch.
alerts_query (Optional[str]): Query for filtering the fetched alerts.
events_query (Optional[str]): Query for filtering the fetched events.
"""
validate_fetch_params(max_fetch, max_events_fetch, fetch_events, first_fetch, event_types)
last_run = demisto.getLastRun() or {}
first_fetch = arg_to_seconds_timestamp(first_fetch)
last_alert_time = last_run.get('last_alert_time') or first_fetch
alerts = client.list_alerts_request(start_time=last_alert_time,
end_time=date_to_seconds_timestamp(datetime.now()),
limit=max_fetch,
query=alerts_query,
unsorted=False)['data']
last_event_time = last_run.get('last_event_time') or first_fetch
if fetch_events:
events = fetch_multiple_type_events(client,
max_fetch=max_events_fetch,
start_time=last_event_time,
event_types=event_types,
query=events_query)
else:
events = []
incidents = []
for alert in alerts:
alert['incident_type'] = alert['alert_type']
incidents.append({
'name': alert['alert_name'],
'occurred': timestamp_to_datestring(alert['timestamp']),
'rawJSON': json.dumps(alert)
})
for event in events:
incidents.append({
'name': event['event_id'],
'occurred': timestamp_to_datestring(event['timestamp']),
'rawJSON': json.dumps(event)
})
# The alerts and events are sorted in descending order.
# Also, we increment the timestamp in one second to avoid duplicates.
demisto.setLastRun({
'last_alert_time': alerts[0]['timestamp'] + 1 if alerts else last_alert_time,
'last_event_time': events[0]['timestamp'] + 1 if events else last_event_time
})
demisto.incidents(incidents)
def main():
params = demisto.params()
url = params['url']
token = params['<PASSWORD>']['password']
use_ssl = not params.get('insecure', False)
use_proxy = params.get('proxy', False)
max_fetch = arg_to_number(params.get('max_fetch', DEFAULT_MAX_FETCH))
first_fetch = params.get('first_fetch', DEFAULT_FIRST_FETCH)
fetch_events = argToBoolean(params.get('fetch_events', False))
event_types = argToList(params.get('fetch_event_types', DEFAULT_EVENT_TYPE))
max_events_fetch = arg_to_number(params.get('max_events_fetch', DEFAULT_EVENTS_FETCH))
client = Client(url, token, use_ssl, use_proxy)
commands = {
'netskope-event-list': list_events_command,
'netskope-alert-list': list_alerts_command,
'netskope-quarantined-file-list': list_quarantined_files_command,
'netskope-quarantined-file-get': get_quarantined_file_command,
'netskope-quarantined-file-update': update_quarantined_file_command,
'netskope-url-list-update': update_url_list_command,
'netskope-file-hash-list-update': update_file_hash_list_command,
'netskope-client-list': list_clients_command,
'netskope-host-associated-user-list': list_host_associated_user_command,
'netskope-user-associated-host-list': list_user_associated_host_command,
}
try:
command = demisto.command()
if command == 'test-module':
return_results(
test_module(client,
max_fetch=max_fetch,
first_fetch=first_fetch,
fetch_events=fetch_events,
max_events_fetch=max_events_fetch,
event_types=event_types))
elif command == 'fetch-incidents':
fetch_incidents(client,
max_fetch=max_fetch,
first_fetch=first_fetch,
fetch_events=fetch_events,
max_events_fetch=max_events_fetch,
event_types=event_types,
alerts_query=demisto.params().get('alert_query'),
events_query=demisto.params().get('events_query'))
elif command in commands:
return_results(commands[command](client, demisto.args()))
else:
raise NotImplementedError(f'The command {command} does not exist!')
except Exception as e:
demisto.error(traceback.format_exc())
return_error(f'Failed to execute {demisto.command()} command.\nError:\n{e}')
if __name__ in ('__main__', '__builtin__', 'builtins'):
main()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
1134,
29901,
11455,
13,
3166,
3509,
1053,
6483,
8552,
13,
3166,
19229,
1053,
3139,
29892,
360,
919,
29892,
2391,
29892,
28379,
29892,
12603,
552,
13,
3166,
3142,
1982,
29889,
5510,
1053,
3142,
7122,
13,
13,
5215,
3142,
1982,
29941,
13,
13,
5215,
1261,
391,
290,
1698,
408,
1261,
5137,
13,
3166,
13103,
6004,
11980,
1053,
334,
13,
3166,
13103,
6004,
2659,
11980,
1053,
334,
13,
13,
29937,
11262,
297,
24216,
18116,
13,
2271,
1982,
29941,
29889,
20472,
29918,
25442,
886,
580,
13,
13,
23397,
29918,
7228,
1692,
353,
29871,
29896,
13,
23397,
29918,
5265,
26349,
353,
29871,
29945,
29900,
13,
23397,
29918,
12648,
29918,
29943,
2544,
3210,
353,
22236,
29918,
5265,
26349,
13,
23397,
29918,
22240,
3919,
29903,
29918,
29943,
2544,
3210,
353,
22236,
29918,
5265,
26349,
13,
23397,
29918,
22240,
3919,
29918,
11116,
353,
525,
6214,
29915,
13,
23397,
29918,
3738,
29934,
1254,
29918,
29943,
2544,
3210,
353,
525,
29955,
3841,
29915,
13,
12648,
29918,
5265,
26349,
353,
29871,
29896,
29900,
29900,
13,
12648,
29918,
29943,
2544,
3210,
353,
29871,
29906,
29900,
29900,
13,
12648,
29918,
22240,
3919,
29903,
29918,
29943,
2544,
3210,
353,
29871,
29906,
29900,
29900,
13,
13,
15307,
29918,
13171,
5971,
29928,
29918,
1529,
18009,
4214,
353,
426,
13,
1678,
525,
8897,
29871,
29953,
29900,
3080,
2667,
2396,
29871,
29941,
29953,
29900,
29900,
29892,
13,
1678,
525,
8897,
29871,
29906,
29946,
379,
2470,
2396,
29871,
29947,
29953,
29946,
29900,
29900,
29892,
13,
1678,
525,
8897,
29871,
29955,
24728,
2396,
29871,
29953,
29900,
29946,
29947,
29900,
29900,
29892,
13,
1678,
525,
8897,
29871,
29941,
29900,
24728,
2396,
29871,
29906,
29945,
29929,
29906,
29900,
29900,
29900,
29892,
13,
1678,
525,
8897,
29871,
29953,
29900,
24728,
2396,
29871,
29945,
29896,
29947,
29946,
29900,
29900,
29900,
29892,
13,
1678,
525,
8897,
29871,
29929,
29900,
24728,
2396,
29871,
29955,
29955,
29955,
29953,
29900,
29900,
29900,
13,
29913,
13,
13,
13,
1990,
12477,
29898,
5160,
4032,
1125,
13,
1678,
9995,
13,
1678,
12477,
363,
12670,
808,
2300,
16759,
1319,
3450,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
2967,
29918,
2271,
313,
710,
1125,
450,
2967,
3988,
310,
12670,
808,
2300,
29889,
13,
4706,
5993,
313,
710,
1125,
450,
5993,
304,
15585,
403,
2750,
12670,
808,
2300,
3450,
29889,
13,
4706,
671,
29918,
16265,
313,
11227,
1125,
12048,
11057,
3692,
304,
11539,
278,
17122,
12289,
470,
451,
29889,
13,
4706,
671,
29918,
14701,
313,
11227,
1125,
12048,
11057,
565,
304,
671,
1060,
6156,
1718,
10166,
6055,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2967,
29918,
2271,
29901,
851,
29892,
5993,
29901,
851,
29892,
671,
29918,
16265,
29901,
6120,
29892,
671,
29918,
14701,
29901,
6120,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
2271,
7122,
29898,
3188,
29918,
2271,
29892,
8207,
2754,
29914,
29894,
29896,
29914,
5477,
11539,
29922,
1509,
29918,
16265,
29892,
10166,
29922,
1509,
29918,
14701,
29897,
13,
4706,
1583,
3032,
7924,
29889,
7529,
1839,
6979,
2033,
353,
5993,
13,
13,
1678,
822,
1051,
29918,
13604,
29918,
3827,
29898,
1311,
29892,
13,
462,
9651,
2346,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
9651,
1741,
29918,
1853,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
9651,
931,
19145,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
1369,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
1095,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
2962,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
355,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4046,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
14383,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
443,
24582,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
9995,
13,
4706,
3617,
4959,
23892,
515,
5701,
29874,
29903,
12469,
322,
470,
10748,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2346,
313,
27636,
29961,
710,
29962,
1125,
12362,
2346,
304,
4175,
278,
4959,
29889,
13,
9651,
1741,
29918,
1853,
313,
27636,
29961,
710,
29962,
1125,
7605,
4959,
491,
1009,
1134,
29889,
13,
9651,
931,
19145,
313,
27636,
29961,
524,
29962,
1125,
3617,
599,
4959,
515,
263,
3058,
931,
3785,
29889,
13,
9651,
1369,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
4959,
304,
1906,
393,
505,
5335,
342,
15092,
7621,
1135,
278,
4944,
14334,
29889,
13,
9651,
1095,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
4959,
304,
1906,
393,
505,
5335,
342,
15092,
3109,
1135,
470,
5186,
304,
278,
4944,
14334,
29889,
13,
9651,
4635,
291,
29918,
2962,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
4959,
304,
1906,
393,
892,
15478,
304,
278,
1788,
13,
18884,
1156,
278,
4944,
14334,
29889,
13,
9651,
4635,
291,
29918,
355,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
4959,
304,
1906,
393,
892,
15478,
304,
278,
1788,
13,
18884,
1434,
278,
4944,
14334,
29889,
13,
9651,
4046,
313,
27636,
29961,
524,
29962,
1125,
450,
7472,
5253,
310,
4959,
304,
10563,
313,
786,
304,
29871,
29896,
29900,
29900,
29900,
29900,
4959,
467,
13,
9651,
14383,
313,
27636,
29961,
524,
29962,
1125,
450,
14383,
1353,
310,
278,
4959,
304,
10563,
313,
1195,
12539,
338,
29871,
29896,
467,
13,
9651,
443,
24582,
313,
27636,
29961,
11227,
29962,
1125,
960,
1565,
29892,
278,
4133,
848,
674,
451,
367,
12705,
313,
1509,
1319,
363,
16710,
4180,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
360,
919,
29961,
710,
29892,
3139,
5387,
12670,
808,
2300,
4959,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
3349,
29918,
6310,
29918,
17664,
3319,
13,
9651,
525,
1972,
2396,
2346,
29892,
13,
9651,
525,
1853,
2396,
1741,
29918,
1853,
29892,
13,
9651,
525,
2230,
19145,
2396,
931,
19145,
29892,
13,
9651,
525,
2962,
2230,
2396,
1369,
29918,
2230,
29892,
13,
9651,
525,
355,
2230,
2396,
1095,
29918,
2230,
29892,
13,
9651,
525,
7851,
291,
2962,
2230,
2396,
4635,
291,
29918,
2962,
29918,
2230,
29892,
13,
9651,
525,
7851,
291,
355,
2230,
2396,
4635,
291,
29918,
355,
29918,
2230,
29892,
13,
9651,
525,
13400,
2396,
4046,
29892,
13,
9651,
525,
11014,
2396,
14383,
29892,
13,
9651,
525,
348,
24582,
2396,
443,
24582,
13,
4706,
5615,
13,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
13604,
742,
4390,
29918,
1272,
29922,
2587,
29897,
13,
13,
1678,
822,
1051,
29918,
12888,
29879,
29918,
3827,
29898,
1311,
29892,
13,
462,
9651,
2346,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
9651,
6655,
29918,
1853,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
9651,
263,
384,
287,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29892,
13,
462,
9651,
931,
19145,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
1369,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
1095,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
2962,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
355,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4046,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
14383,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
443,
24582,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
9995,
13,
4706,
3617,
6655,
29879,
5759,
491,
12670,
808,
2300,
29892,
3704,
8898,
29892,
360,
13208,
29892,
322,
6505,
1051,
6655,
29879,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2346,
313,
27636,
29961,
710,
29962,
1125,
12362,
2346,
304,
4175,
278,
6655,
29879,
29889,
13,
9651,
6655,
29918,
1853,
313,
27636,
29961,
710,
29962,
1125,
7605,
6655,
29879,
491,
1009,
1134,
29889,
13,
9651,
263,
384,
287,
313,
27636,
29961,
11227,
29962,
1125,
26460,
304,
10563,
24084,
3192,
6655,
29879,
470,
451,
29889,
13,
9651,
931,
19145,
313,
27636,
29961,
524,
29962,
1125,
3617,
6655,
29879,
515,
3058,
931,
3785,
29889,
13,
9651,
1369,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
6655,
29879,
304,
1906,
393,
505,
5335,
342,
15092,
7621,
1135,
278,
4944,
14334,
29889,
13,
9651,
1095,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
6655,
29879,
304,
1906,
393,
505,
5335,
342,
15092,
3109,
1135,
470,
5186,
304,
278,
4944,
14334,
29889,
13,
9651,
4635,
291,
29918,
2962,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
6655,
29879,
607,
505,
1063,
15478,
964,
278,
1788,
13,
18884,
1156,
278,
4944,
14334,
29889,
13,
9651,
4635,
291,
29918,
355,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
11654,
4146,
6655,
29879,
607,
505,
1063,
15478,
964,
278,
1788,
13,
18884,
1434,
278,
4944,
14334,
29889,
13,
9651,
4046,
313,
27636,
29961,
524,
29962,
1125,
450,
7472,
1353,
310,
6655,
29879,
304,
736,
313,
786,
304,
29871,
29896,
29900,
29900,
29900,
29900,
467,
13,
9651,
14383,
313,
27636,
29961,
524,
29962,
1125,
450,
14383,
1353,
310,
278,
6655,
29879,
304,
10563,
313,
1195,
12539,
338,
29871,
29896,
467,
13,
9651,
443,
24582,
313,
27636,
29961,
11227,
29962,
1125,
960,
1565,
29892,
278,
4133,
848,
674,
451,
367,
12705,
313,
1509,
1319,
363,
16710,
4180,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
360,
919,
29961,
710,
29892,
3139,
5387,
12670,
808,
2300,
6655,
29879,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
3349,
29918,
6310,
29918,
17664,
3319,
13,
9651,
525,
1972,
2396,
2346,
29892,
13,
9651,
525,
12888,
29918,
1853,
2396,
6655,
29918,
1853,
29892,
13,
9651,
525,
547,
287,
2396,
263,
384,
287,
29892,
13,
9651,
525,
2230,
19145,
2396,
931,
19145,
29892,
13,
9651,
525,
2962,
2230,
2396,
1369,
29918,
2230,
29892,
13,
9651,
525,
355,
2230,
2396,
1095,
29918,
2230,
29892,
13,
9651,
525,
7851,
291,
2962,
2230,
2396,
4635,
291,
29918,
2962,
29918,
2230,
29892,
13,
9651,
525,
7851,
291,
355,
2230,
2396,
4635,
291,
29918,
355,
29918,
2230,
29892,
13,
9651,
525,
13400,
2396,
4046,
29892,
13,
9651,
525,
11014,
2396,
14383,
29892,
13,
9651,
525,
348,
24582,
2396,
443,
24582,
13,
4706,
5615,
13,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
12888,
29879,
742,
4390,
29918,
1272,
29922,
2587,
29897,
13,
13,
1678,
822,
1051,
29918,
339,
279,
424,
1312,
29918,
5325,
29918,
3827,
29898,
1311,
29892,
13,
462,
462,
539,
1369,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
462,
539,
1095,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
462,
539,
4046,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
462,
539,
14383,
29901,
28379,
29961,
524,
29962,
353,
6213,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
9995,
13,
4706,
2391,
599,
20089,
424,
1312,
2066,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1369,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
3617,
2066,
1833,
9120,
2629,
263,
3058,
931,
3785,
29889,
13,
9651,
1095,
29918,
2230,
313,
27636,
29961,
524,
29962,
1125,
3617,
2066,
1833,
9120,
2629,
263,
3058,
931,
3785,
29889,
13,
9651,
4046,
313,
27636,
29961,
524,
29962,
1125,
450,
7472,
5253,
310,
13154,
304,
10563,
313,
786,
304,
29871,
29896,
29900,
29900,
29900,
29900,
467,
13,
9651,
14383,
313,
27636,
29961,
524,
29962,
1125,
450,
14383,
1353,
310,
278,
13154,
304,
10563,
313,
1195,
12539,
338,
29871,
29896,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
360,
919,
29961,
710,
29892,
3139,
5387,
12670,
808,
2300,
20089,
20578,
2066,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
3349,
29918,
6310,
29918,
17664,
3319,
13,
9651,
525,
2962,
2230,
2396,
1369,
29918,
2230,
29892,
13,
9651,
525,
355,
2230,
2396,
1095,
29918,
2230,
29892,
13,
9651,
525,
13400,
2396,
4046,
29892,
13,
9651,
525,
11014,
2396,
14383,
29892,
13,
9651,
525,
459,
2396,
525,
657,
29899,
5325,
29915,
13,
4706,
5615,
13,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
339,
279,
20578,
742,
4390,
29918,
1272,
29922,
2587,
29897,
13,
13,
1678,
822,
679,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
3827,
29898,
1311,
29892,
20089,
20578,
29918,
10185,
29918,
333,
29901,
851,
29892,
934,
29918,
333,
29901,
851,
29897,
1599,
6262,
29901,
13,
4706,
9995,
13,
4706,
25553,
263,
20089,
424,
1312,
934,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
20089,
20578,
29918,
10185,
29918,
333,
313,
710,
1125,
450,
3553,
310,
20089,
20578,
8722,
29889,
13,
9651,
934,
29918,
333,
313,
710,
1125,
450,
3553,
310,
278,
20089,
424,
1312,
934,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
6262,
29901,
450,
20089,
424,
1312,
934,
2793,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
426,
13,
9651,
525,
339,
279,
20578,
29918,
10185,
29918,
333,
2396,
20089,
20578,
29918,
10185,
29918,
333,
29892,
13,
9651,
525,
1445,
29918,
333,
2396,
934,
29918,
333,
29892,
13,
9651,
525,
459,
2396,
525,
10382,
29899,
2271,
29915,
13,
4706,
500,
13,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
13,
462,
462,
29871,
3142,
29918,
2146,
600,
861,
2433,
339,
279,
20578,
742,
13,
462,
462,
29871,
4390,
29918,
1272,
29922,
2587,
29892,
13,
462,
462,
29871,
4613,
29918,
1853,
2433,
3051,
1495,
13,
13,
1678,
822,
2767,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
3827,
29898,
1311,
29892,
20089,
20578,
29918,
10185,
29918,
333,
29901,
851,
29892,
934,
29918,
333,
29901,
851,
29892,
13,
462,
462,
4706,
3158,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
11190,
385,
3158,
373,
263,
20089,
424,
1312,
934,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
20089,
20578,
29918,
10185,
29918,
333,
313,
710,
1125,
450,
8722,
1178,
310,
278,
20089,
424,
1312,
934,
29889,
13,
9651,
934,
29918,
333,
313,
710,
1125,
450,
1178,
310,
278,
20089,
424,
1312,
934,
29889,
13,
9651,
3158,
313,
710,
1125,
9123,
304,
367,
8560,
373,
263,
20089,
424,
1312,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
426,
13,
9651,
525,
339,
279,
20578,
29918,
10185,
29918,
333,
2396,
20089,
20578,
29918,
10185,
29918,
333,
29892,
13,
9651,
525,
1445,
29918,
333,
2396,
934,
29918,
333,
29892,
13,
9651,
525,
2467,
2396,
3158,
29892,
13,
9651,
525,
459,
2396,
525,
19730,
29899,
2467,
29915,
13,
4706,
500,
13,
13,
4706,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
339,
279,
20578,
742,
4390,
29918,
1272,
29922,
2587,
29892,
4613,
29918,
1853,
2433,
726,
1495,
13,
13,
1678,
822,
2767,
29918,
2271,
29918,
1761,
29918,
3827,
29898,
1311,
29892,
1024,
29901,
851,
29892,
23942,
29901,
2391,
29961,
710,
2314,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
10318,
278,
3988,
2391,
411,
278,
1819,
4944,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1024,
313,
710,
1125,
4408,
310,
385,
5923,
3988,
2391,
4318,
297,
278,
12670,
808,
2300,
3740,
373,
278,
3988,
2391,
14383,
29889,
13,
9651,
23942,
313,
1293,
29961,
710,
29962,
1125,
450,
2793,
310,
278,
3988,
1051,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
11117,
978,
2396,
1024,
29892,
525,
1761,
2396,
13420,
4286,
7122,
29898,
26045,
2915,
13,
4706,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
5504,
5983,
1293,
742,
4390,
29918,
1272,
29922,
2587,
29897,
13,
13,
1678,
822,
2767,
29918,
1445,
29918,
8568,
29918,
1761,
29918,
3827,
29898,
1311,
29892,
1024,
29901,
851,
29892,
6608,
267,
29901,
2391,
29961,
710,
2314,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
10318,
934,
6608,
1051,
411,
278,
1819,
4944,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1024,
313,
710,
1125,
4408,
310,
385,
5923,
934,
6608,
1051,
4318,
297,
278,
12670,
808,
2300,
3740,
373,
278,
934,
6608,
1051,
14383,
29889,
13,
9651,
6608,
267,
313,
710,
1125,
2391,
310,
934,
6608,
267,
313,
3487,
29945,
470,
528,
29874,
29906,
29945,
29953,
467,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
11117,
978,
2396,
1024,
29892,
525,
1761,
2396,
13420,
4286,
7122,
29898,
8568,
267,
2915,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
5504,
2283,
10438,
1293,
742,
4390,
29918,
1272,
29922,
2587,
29897,
13,
13,
1678,
822,
1051,
29918,
11303,
1237,
29918,
3827,
29898,
1311,
29892,
13,
462,
632,
2346,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
632,
4046,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
632,
14383,
29901,
28379,
29961,
524,
29962,
353,
6213,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
9995,
13,
4706,
3617,
2472,
1048,
278,
12670,
808,
2300,
13154,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2346,
313,
27636,
29961,
710,
29962,
1125,
12362,
2346,
373,
278,
13154,
29892,
2729,
373,
278,
3132,
4235,
29889,
13,
9651,
4046,
313,
27636,
29961,
524,
29962,
1125,
450,
7472,
5253,
310,
13154,
304,
10563,
313,
786,
304,
29871,
29896,
29900,
29900,
29900,
29900,
467,
13,
9651,
14383,
313,
27636,
29961,
524,
29962,
1125,
450,
14383,
1353,
310,
278,
13154,
304,
10563,
313,
1195,
12539,
338,
29871,
29896,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
360,
919,
29961,
710,
29892,
3139,
5387,
450,
13154,
2472,
29889,
13,
4706,
9995,
13,
13,
4706,
3573,
353,
3349,
29918,
6310,
29918,
17664,
3319,
29915,
1972,
2396,
2346,
29892,
525,
13400,
2396,
4046,
29892,
525,
11014,
2396,
14383,
1800,
13,
4706,
736,
1583,
3032,
1124,
29918,
3827,
29898,
5696,
2433,
5438,
742,
3142,
29918,
2146,
600,
861,
2433,
11303,
1237,
742,
8636,
29922,
2587,
29897,
13,
13,
1678,
822,
903,
1124,
29918,
3827,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
2428,
2141,
29918,
1124,
29918,
3827,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
565,
338,
8758,
29898,
5327,
29892,
9657,
29897,
322,
525,
12523,
29915,
297,
2933,
29901,
13,
9651,
4436,
353,
11297,
29876,
4286,
7122,
29898,
5327,
1839,
12523,
11287,
13,
9651,
12020,
4432,
5137,
2451,
29898,
29888,
29915,
13919,
3450,
1246,
29901,
426,
12523,
29913,
742,
620,
29922,
5327,
29897,
13,
13,
4706,
736,
2933,
13,
13,
13,
1753,
1852,
29918,
517,
29918,
20054,
29898,
1191,
29901,
28379,
29961,
710,
2314,
1599,
28379,
29961,
11227,
5387,
13,
1678,
9995,
13,
1678,
1281,
369,
1372,
385,
1060,
6156,
1718,
2980,
304,
263,
5132,
7223,
470,
6213,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1852,
313,
27636,
29961,
710,
29962,
1125,
450,
2980,
304,
3588,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
28379,
29961,
11227,
5387,
319,
7223,
565,
1852,
508,
367,
11543,
29892,
13,
4706,
470,
6213,
565,
1852,
338,
6213,
29889,
13,
1678,
9995,
13,
13,
1678,
565,
1852,
338,
6213,
29901,
13,
4706,
736,
6213,
13,
13,
1678,
736,
1852,
1762,
18146,
29898,
1191,
29897,
13,
13,
13,
1753,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
1191,
29901,
28379,
29961,
710,
2314,
1599,
28379,
29961,
524,
5387,
13,
1678,
9995,
13,
1678,
1281,
369,
1372,
385,
1060,
6156,
1718,
2635,
1347,
2980,
304,
263,
14334,
297,
6923,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1852,
313,
27636,
29961,
710,
29962,
1125,
450,
2980,
304,
3588,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
28379,
29961,
524,
5387,
319,
14334,
565,
1852,
508,
367,
11543,
29892,
13,
4706,
470,
6213,
565,
1852,
338,
6213,
29889,
13,
1678,
9995,
13,
13,
1678,
565,
1852,
338,
6213,
29901,
13,
4706,
736,
6213,
13,
13,
1678,
736,
2635,
29918,
517,
29918,
23128,
29918,
16394,
29898,
1191,
29918,
517,
29918,
12673,
29898,
1191,
876,
13,
13,
13,
1753,
2635,
29918,
517,
29918,
23128,
29918,
16394,
29898,
1256,
29918,
710,
29918,
272,
29918,
6008,
29901,
7761,
29961,
710,
29892,
12865,
2314,
1599,
938,
29901,
13,
1678,
9995,
13,
1678,
1281,
369,
1372,
2635,
1347,
470,
12865,
1203,
304,
263,
14334,
297,
6923,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
2635,
29918,
710,
29918,
272,
29918,
6008,
313,
19986,
29961,
710,
29892,
12865,
29962,
1125,
450,
1418,
342,
5393,
470,
12865,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
938,
29901,
450,
14334,
297,
6923,
29889,
13,
1678,
9995,
13,
13,
1678,
736,
2635,
29918,
517,
29918,
16394,
29898,
1256,
29918,
710,
29918,
272,
29918,
6008,
29897,
849,
29871,
29896,
29900,
29900,
29900,
13,
13,
13,
1753,
12725,
29918,
2230,
29918,
25699,
29898,
2962,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
1095,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
2962,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
4635,
291,
29918,
355,
29918,
2230,
29901,
28379,
29961,
524,
29962,
353,
6213,
29892,
13,
462,
9651,
931,
19145,
29901,
28379,
29961,
524,
29962,
353,
6213,
29897,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
15758,
1078,
931,
6273,
515,
278,
1404,
29889,
13,
1678,
450,
1404,
1818,
3867,
697,
310,
278,
1494,
29901,
13,
4706,
448,
1369,
29918,
2230,
322,
1095,
29918,
2230,
29889,
13,
4706,
448,
4635,
291,
29918,
2962,
29918,
2230,
322,
4635,
291,
29918,
355,
29918,
2230,
29889,
13,
4706,
448,
931,
19145,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1369,
29918,
2230,
313,
27636,
29961,
524,
1402,
13136,
1125,
450,
1369,
931,
304,
6699,
515,
278,
3450,
29889,
13,
4706,
1095,
29918,
2230,
313,
27636,
29961,
524,
1402,
13136,
1125,
450,
1095,
931,
304,
6699,
515,
278,
3450,
29889,
13,
4706,
4635,
291,
29918,
2962,
29918,
2230,
313,
27636,
29961,
524,
1402,
13136,
1125,
450,
4635,
291,
1369,
931,
304,
6699,
515,
278,
3450,
29889,
13,
4706,
4635,
291,
29918,
355,
29918,
2230,
313,
27636,
29961,
524,
1402,
13136,
1125,
450,
4635,
291,
1095,
931,
304,
6699,
515,
278,
3450,
29889,
13,
4706,
931,
19145,
313,
27636,
29961,
710,
1402,
13136,
1125,
450,
931,
19145,
304,
6699,
515,
278,
3450,
29889,
13,
13,
1678,
390,
1759,
267,
29901,
13,
4706,
4432,
5137,
2451,
29901,
450,
1404,
1258,
451,
3867,
2854,
14334,
29889,
13,
1678,
9995,
13,
13,
1678,
10296,
353,
313,
497,
3552,
2962,
29918,
2230,
29892,
1095,
29918,
2230,
8243,
599,
29898,
13,
4706,
313,
7851,
291,
29918,
2962,
29918,
2230,
29892,
4635,
291,
29918,
355,
29918,
2230,
8243,
6120,
29898,
2230,
19145,
876,
13,
13,
1678,
565,
451,
738,
29898,
510,
2109,
362,
1125,
13,
4706,
12020,
4432,
5137,
2451,
877,
18552,
292,
931,
6273,
29889,
3529,
3867,
1369,
29918,
2230,
322,
1095,
29918,
2230,
29892,
525,
13,
462,
1669,
525,
272,
4635,
291,
29918,
2962,
29918,
2230,
322,
470,
4635,
291,
29918,
355,
29918,
2230,
470,
931,
19145,
29889,
1495,
13,
1678,
565,
10296,
29889,
2798,
29898,
5574,
29897,
1405,
29871,
29896,
29901,
13,
4706,
12020,
4432,
5137,
2451,
29898,
13,
9651,
525,
13919,
931,
6273,
29889,
3529,
3867,
871,
1369,
29918,
2230,
322,
1095,
29918,
2230,
29892,
525,
13,
9651,
525,
272,
4635,
291,
29918,
2962,
29918,
2230,
322,
470,
4635,
291,
29918,
355,
29918,
2230,
470,
931,
19145,
29889,
525,
13,
9651,
525,
3492,
1818,
451,
14405,
1546,
278,
5276,
3987,
29889,
1495,
13,
13,
13,
1753,
12725,
29918,
9155,
29918,
7529,
29898,
3317,
29918,
9155,
29901,
938,
29892,
4236,
29918,
13604,
29918,
9155,
29901,
938,
29892,
6699,
29918,
13604,
29901,
6120,
29892,
13,
462,
3986,
937,
29918,
9155,
29901,
851,
29892,
1741,
29918,
8768,
29901,
2391,
29961,
710,
2314,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
15758,
1078,
278,
4128,
363,
6699,
15134,
1899,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
4236,
29918,
9155,
29901,
313,
524,
1125,
450,
7472,
1353,
310,
5528,
16719,
363,
697,
6699,
29889,
13,
4706,
4236,
29918,
13604,
29918,
9155,
313,
524,
29897,
450,
7472,
1353,
310,
4959,
639,
15134,
363,
697,
6699,
29889,
13,
4706,
6699,
29918,
13604,
313,
11227,
1125,
26460,
470,
451,
6699,
4959,
746,
6699,
292,
15134,
29889,
13,
4706,
937,
29918,
9155,
29901,
313,
710,
1125,
3824,
6699,
931,
297,
3838,
29889,
13,
1678,
9995,
13,
13,
1678,
565,
937,
29918,
9155,
29901,
13,
4706,
1852,
29918,
517,
29918,
12673,
29898,
4102,
29918,
9155,
29897,
29871,
396,
11539,
393,
372,
338,
263,
2635,
29889,
13,
13,
1678,
565,
4236,
29918,
9155,
1405,
18134,
29918,
29943,
2544,
3210,
29901,
13,
4706,
736,
29918,
2704,
29898,
29888,
29915,
1576,
5918,
12539,
1353,
310,
5528,
16719,
639,
6699,
881,
451,
13461,
426,
12648,
29918,
29943,
2544,
3210,
1836,
1495,
13,
1678,
565,
6699,
29918,
13604,
322,
4236,
29918,
13604,
29918,
9155,
1405,
18134,
29918,
22240,
3919,
29903,
29918,
29943,
2544,
3210,
29901,
13,
4706,
736,
29918,
2704,
29898,
13,
9651,
285,
29915,
1576,
5918,
12539,
1353,
310,
4959,
363,
1269,
15134,
639,
6699,
881,
451,
13461,
426,
12648,
29918,
22240,
3919,
29903,
29918,
29943,
2544,
3210,
1836,
29915,
13,
4706,
1723,
13,
13,
1678,
565,
451,
338,
8758,
29898,
3696,
29918,
8768,
29892,
1051,
1125,
13,
4706,
736,
29918,
2704,
877,
1576,
6699,
287,
1741,
4072,
1818,
367,
263,
1051,
29889,
1495,
13,
13,
13,
1753,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
29898,
6672,
29901,
851,
29892,
1813,
29901,
938,
29892,
4046,
29901,
938,
29897,
1599,
851,
29901,
13,
1678,
736,
285,
29915,
29912,
6672,
1012,
29876,
9626,
1813,
2159,
29901,
426,
13400,
1012,
29876,
7704,
292,
1813,
426,
3488,
29913,
714,
310,
4045,
393,
1122,
1863,
6169,
13,
13,
13,
1753,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29901,
360,
919,
29961,
710,
29892,
3139,
2314,
1599,
12603,
552,
29961,
524,
29892,
938,
29892,
938,
5387,
13,
1678,
9995,
13,
1678,
402,
1691,
322,
2854,
1078,
10203,
3381,
6273,
363,
3132,
313,
11014,
322,
4046,
467,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
450,
1899,
6273,
313,
3488,
322,
4046,
467,
13,
13,
1678,
16969,
29901,
13,
4706,
12603,
552,
29961,
524,
29892,
938,
5387,
450,
1813,
29892,
12833,
14383,
322,
4046,
1156,
8845,
29889,
13,
1678,
9995,
13,
13,
1678,
1813,
353,
1852,
29918,
517,
29918,
4537,
29898,
5085,
29889,
657,
877,
3488,
742,
22236,
29918,
7228,
1692,
876,
13,
1678,
4046,
353,
1852,
29918,
517,
29918,
4537,
29898,
5085,
29889,
657,
877,
13400,
742,
22236,
29918,
5265,
26349,
876,
13,
13,
1678,
565,
1813,
529,
29871,
29896,
29901,
13,
4706,
12020,
4432,
5137,
2451,
877,
5074,
2980,
1818,
367,
7621,
1135,
29871,
29896,
1495,
13,
1678,
565,
451,
29871,
29896,
5277,
4046,
5277,
18134,
29918,
5265,
26349,
29901,
13,
4706,
12020,
4432,
5137,
2451,
29898,
29888,
29915,
24445,
2980,
1818,
367,
1546,
29871,
29896,
304,
426,
12648,
29918,
5265,
26349,
29913,
1495,
13,
13,
1678,
736,
1813,
29892,
313,
3488,
448,
29871,
29896,
29897,
334,
4046,
29892,
4046,
13,
13,
13,
1753,
1051,
29918,
13604,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
3617,
4959,
23892,
515,
5701,
29874,
29903,
12469,
322,
470,
10748,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
2346,
353,
6389,
29889,
657,
877,
1972,
1495,
13,
1678,
1741,
29918,
1853,
353,
6389,
1839,
3696,
29918,
1853,
2033,
13,
1678,
931,
19145,
353,
323,
8890,
29918,
13171,
5971,
29928,
29918,
1529,
18009,
4214,
29889,
657,
29898,
5085,
29889,
657,
877,
2230,
19145,
8785,
13,
1678,
1369,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
2962,
29918,
2230,
8785,
13,
1678,
1095,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
355,
29918,
2230,
8785,
13,
1678,
4635,
291,
29918,
2962,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
7851,
291,
29918,
2962,
29918,
2230,
8785,
13,
1678,
4635,
291,
29918,
355,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
7851,
291,
29918,
355,
29918,
2230,
8785,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
1678,
443,
24582,
353,
1852,
29918,
517,
29918,
20054,
29898,
5085,
29889,
657,
877,
348,
24582,
8785,
13,
13,
1678,
12725,
29918,
2230,
29918,
25699,
29898,
2962,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
9651,
1095,
29918,
2230,
29922,
355,
29918,
2230,
29892,
13,
462,
9651,
931,
19145,
29922,
2230,
19145,
29892,
13,
462,
9651,
4635,
291,
29918,
2962,
29918,
2230,
29922,
7851,
291,
29918,
2962,
29918,
2230,
29892,
13,
462,
9651,
4635,
291,
29918,
355,
29918,
2230,
29922,
7851,
291,
29918,
355,
29918,
2230,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
13604,
29918,
3827,
29898,
1972,
29922,
1972,
29892,
13,
462,
462,
3986,
1741,
29918,
1853,
29922,
3696,
29918,
1853,
29892,
13,
462,
462,
3986,
931,
19145,
29922,
2230,
19145,
29892,
13,
462,
462,
3986,
1369,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
462,
3986,
1095,
29918,
2230,
29922,
355,
29918,
2230,
29892,
13,
462,
462,
3986,
4635,
291,
29918,
2962,
29918,
2230,
29922,
7851,
291,
29918,
2962,
29918,
2230,
29892,
13,
462,
462,
3986,
4635,
291,
29918,
355,
29918,
2230,
29922,
7851,
291,
29918,
355,
29918,
2230,
29892,
13,
462,
462,
3986,
4046,
29922,
13400,
29892,
13,
462,
462,
3986,
14383,
29922,
11014,
29892,
13,
462,
462,
3986,
443,
24582,
29922,
348,
24582,
29897,
13,
1678,
14391,
353,
6483,
8552,
29898,
5327,
1839,
1272,
11287,
13,
1678,
363,
1741,
297,
14391,
29901,
13,
4706,
1741,
1839,
3696,
29918,
333,
2033,
353,
1741,
1839,
29918,
333,
2033,
13,
4706,
1741,
1839,
16394,
2033,
353,
14334,
29918,
517,
29918,
4130,
342,
5393,
29898,
3696,
1839,
16394,
2033,
334,
29871,
29896,
29900,
29900,
29900,
29897,
13,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
13,
4706,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
877,
13634,
2391,
29901,
742,
1813,
29922,
3488,
29892,
4046,
29922,
13400,
511,
13,
4706,
14391,
29892,
13,
4706,
3349,
7327,
29922,
5574,
29892,
13,
4706,
9066,
29922,
1839,
3696,
29918,
333,
742,
525,
16394,
742,
525,
1853,
742,
525,
5943,
29918,
5696,
742,
525,
932,
742,
525,
3018,
2416,
29918,
1853,
7464,
13,
4706,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
2624,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
3696,
29918,
333,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
1051,
29918,
12888,
29879,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
3617,
6655,
29879,
5759,
491,
12670,
808,
2300,
29892,
3704,
8898,
29892,
360,
13208,
29892,
322,
6505,
1051,
6655,
29879,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
2346,
353,
6389,
29889,
657,
877,
1972,
1495,
13,
1678,
6655,
29918,
1853,
353,
6389,
29889,
657,
877,
12888,
29918,
1853,
1495,
13,
1678,
263,
384,
287,
353,
1852,
29918,
517,
29918,
20054,
29898,
5085,
29889,
657,
877,
547,
287,
8785,
13,
1678,
931,
19145,
353,
323,
8890,
29918,
13171,
5971,
29928,
29918,
1529,
18009,
4214,
29889,
657,
29898,
5085,
29889,
657,
877,
2230,
19145,
8785,
13,
1678,
1369,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
2962,
29918,
2230,
8785,
13,
1678,
1095,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
355,
29918,
2230,
8785,
13,
1678,
4635,
291,
29918,
2962,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
7851,
291,
29918,
2962,
29918,
2230,
8785,
13,
1678,
4635,
291,
29918,
355,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
7851,
291,
29918,
355,
29918,
2230,
8785,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
1678,
443,
24582,
353,
1852,
29918,
517,
29918,
20054,
29898,
5085,
29889,
657,
877,
348,
24582,
8785,
13,
13,
1678,
12725,
29918,
2230,
29918,
25699,
29898,
2962,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
9651,
1095,
29918,
2230,
29922,
355,
29918,
2230,
29892,
13,
462,
9651,
931,
19145,
29922,
2230,
19145,
29892,
13,
462,
9651,
4635,
291,
29918,
2962,
29918,
2230,
29922,
7851,
291,
29918,
2962,
29918,
2230,
29892,
13,
462,
9651,
4635,
291,
29918,
355,
29918,
2230,
29922,
7851,
291,
29918,
355,
29918,
2230,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
12888,
29879,
29918,
3827,
29898,
1972,
29922,
1972,
29892,
13,
462,
462,
3986,
6655,
29918,
1853,
29922,
12888,
29918,
1853,
29892,
13,
462,
462,
3986,
263,
384,
287,
29922,
547,
287,
29892,
13,
462,
462,
3986,
931,
19145,
29922,
2230,
19145,
29892,
13,
462,
462,
3986,
1369,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
462,
3986,
1095,
29918,
2230,
29922,
355,
29918,
2230,
29892,
13,
462,
462,
3986,
4635,
291,
29918,
2962,
29918,
2230,
29922,
7851,
291,
29918,
2962,
29918,
2230,
29892,
13,
462,
462,
3986,
4635,
291,
29918,
355,
29918,
2230,
29922,
7851,
291,
29918,
355,
29918,
2230,
29892,
13,
462,
462,
3986,
4046,
29922,
13400,
29892,
13,
462,
462,
3986,
14383,
29922,
11014,
29892,
13,
462,
462,
3986,
443,
24582,
29922,
348,
24582,
29897,
13,
1678,
14391,
353,
6483,
8552,
29898,
5327,
1839,
1272,
11287,
13,
1678,
363,
6655,
297,
14391,
29901,
13,
4706,
6655,
1839,
12888,
29918,
333,
2033,
353,
6655,
1839,
29918,
333,
2033,
13,
4706,
6655,
1839,
16394,
2033,
353,
14334,
29918,
517,
29918,
4130,
342,
5393,
29898,
12888,
1839,
16394,
2033,
334,
29871,
29896,
29900,
29900,
29900,
29897,
13,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
13,
4706,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
877,
16649,
29879,
2391,
29901,
742,
1813,
29922,
3488,
29892,
4046,
29922,
13400,
511,
13,
4706,
14391,
29892,
13,
4706,
3349,
7327,
29922,
5574,
29892,
13,
4706,
9066,
29922,
1839,
12888,
29918,
333,
742,
525,
12888,
29918,
978,
742,
525,
12888,
29918,
1853,
742,
525,
16394,
742,
525,
2467,
7464,
13,
4706,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
16649,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
12888,
29918,
333,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
1051,
29918,
339,
279,
424,
1312,
29918,
5325,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
2391,
599,
20089,
424,
1312,
2066,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
1369,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
2962,
29918,
2230,
8785,
13,
1678,
1095,
29918,
2230,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
5085,
29889,
657,
877,
355,
29918,
2230,
8785,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
339,
279,
424,
1312,
29918,
5325,
29918,
3827,
29898,
2962,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
462,
462,
268,
1095,
29918,
2230,
29922,
355,
29918,
2230,
29892,
13,
462,
462,
462,
268,
4046,
29922,
13400,
29892,
13,
462,
462,
462,
268,
14383,
29922,
11014,
29897,
13,
13,
1678,
14391,
353,
9657,
29918,
11177,
29918,
657,
29898,
5327,
29892,
6024,
1272,
742,
525,
339,
279,
424,
1312,
11287,
13,
1678,
363,
1962,
297,
14391,
29901,
13,
4706,
363,
934,
29918,
4905,
297,
1962,
1839,
5325,
2033,
29901,
13,
9651,
934,
29918,
4905,
1839,
339,
279,
20578,
29918,
10185,
29918,
333,
2033,
353,
1962,
1839,
339,
279,
20578,
29918,
10185,
29918,
333,
2033,
13,
9651,
934,
29918,
4905,
1839,
339,
279,
20578,
29918,
10185,
29918,
978,
2033,
353,
1962,
1839,
339,
279,
20578,
29918,
10185,
29918,
978,
2033,
13,
1678,
14391,
353,
2533,
3552,
4905,
1839,
5325,
2033,
363,
1962,
297,
14391,
511,
518,
2314,
13,
13,
1678,
19909,
29918,
6672,
353,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
877,
2182,
279,
424,
1312,
12745,
2391,
29901,
742,
13,
462,
462,
462,
418,
1813,
29922,
3488,
29892,
13,
462,
462,
462,
418,
4046,
29922,
13400,
29897,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
949,
519,
29918,
6672,
29892,
13,
462,
462,
418,
14391,
29892,
13,
462,
462,
418,
3349,
7327,
29922,
5574,
29892,
13,
462,
462,
418,
9066,
11759,
13,
462,
462,
3986,
525,
339,
279,
20578,
29918,
10185,
29918,
333,
742,
525,
339,
279,
20578,
29918,
10185,
29918,
978,
742,
13,
462,
462,
3986,
525,
1445,
29918,
333,
742,
525,
13492,
29918,
1445,
29918,
978,
742,
525,
22197,
29915,
13,
462,
462,
418,
21251,
13,
462,
462,
418,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
2182,
279,
20578,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
1445,
29918,
333,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
679,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
25553,
263,
20089,
424,
1312,
934,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
20089,
20578,
29918,
10185,
29918,
333,
353,
6389,
1839,
339,
279,
20578,
29918,
10185,
29918,
333,
2033,
13,
1678,
934,
29918,
333,
353,
6389,
1839,
1445,
29918,
333,
2033,
13,
13,
1678,
2933,
353,
3132,
29889,
657,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
3827,
29898,
339,
279,
20578,
29918,
10185,
29918,
333,
29922,
339,
279,
20578,
29918,
10185,
29918,
333,
29892,
13,
462,
462,
462,
259,
934,
29918,
333,
29922,
1445,
29918,
333,
29897,
13,
13,
1678,
736,
934,
3591,
29898,
9507,
29922,
29888,
29915,
29912,
1445,
29918,
333,
1836,
7554,
742,
848,
29922,
5327,
29892,
934,
29918,
1853,
29922,
9634,
1542,
29889,
7724,
29897,
13,
13,
13,
1753,
2767,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
11190,
385,
3158,
373,
263,
20089,
424,
1312,
934,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
20089,
20578,
29918,
10185,
29918,
333,
353,
6389,
1839,
339,
279,
20578,
29918,
10185,
29918,
333,
2033,
13,
1678,
934,
29918,
333,
353,
6389,
1839,
1445,
29918,
333,
2033,
13,
1678,
3158,
353,
6389,
1839,
2467,
2033,
13,
13,
1678,
3132,
29889,
5504,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
3827,
29898,
339,
279,
20578,
29918,
10185,
29918,
333,
29922,
339,
279,
20578,
29918,
10185,
29918,
333,
29892,
13,
462,
462,
965,
934,
29918,
333,
29922,
1445,
29918,
333,
29892,
13,
462,
462,
965,
3158,
29922,
2467,
29897,
13,
1678,
19909,
29918,
4905,
353,
285,
29915,
2277,
450,
934,
426,
1445,
29918,
333,
29913,
471,
8472,
426,
2467,
29913,
287,
20714,
13,
13,
1678,
736,
10516,
12191,
29898,
949,
519,
29918,
4905,
29922,
949,
519,
29918,
4905,
29897,
13,
13,
13,
1753,
2767,
29918,
2271,
29918,
1761,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
10318,
278,
3988,
2391,
411,
278,
1819,
4944,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
6389,
1839,
978,
2033,
13,
1678,
23942,
353,
1852,
21254,
29898,
5085,
1839,
26045,
11287,
13,
13,
1678,
3132,
29889,
5504,
29918,
2271,
29918,
1761,
29918,
3827,
29898,
978,
29922,
978,
29892,
23942,
29922,
26045,
29897,
13,
13,
1678,
14391,
353,
11117,
978,
2396,
1024,
29892,
525,
4219,
2396,
23942,
29913,
13,
1678,
19909,
29918,
4905,
353,
285,
29915,
4219,
2391,
426,
978,
29913,
3583,
29876,
29912,
613,
11393,
7122,
29898,
26045,
2915,
29915,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
4219,
1293,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
978,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29897,
13,
13,
13,
1753,
2767,
29918,
1445,
29918,
8568,
29918,
1761,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
10318,
934,
6608,
1051,
411,
278,
1819,
4944,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
6389,
29889,
657,
877,
978,
1495,
13,
1678,
6608,
267,
353,
1852,
21254,
29898,
5085,
29889,
657,
877,
8568,
8785,
13,
13,
1678,
3132,
29889,
5504,
29918,
1445,
29918,
8568,
29918,
1761,
29918,
3827,
29898,
978,
29922,
978,
29892,
6608,
267,
29922,
8568,
267,
29897,
13,
13,
1678,
14391,
353,
11117,
978,
2396,
1024,
29892,
525,
8568,
2396,
6608,
267,
29913,
13,
1678,
19909,
29918,
4905,
353,
285,
29915,
10438,
2391,
426,
978,
29913,
3583,
29876,
29912,
613,
11393,
7122,
29898,
8568,
267,
2915,
29915,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
2283,
10438,
1293,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
978,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29897,
13,
13,
13,
1753,
1051,
29918,
11303,
1237,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
3617,
2472,
1048,
278,
12670,
808,
2300,
13154,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
2346,
353,
6389,
29889,
657,
877,
1972,
1495,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
11303,
1237,
29918,
3827,
29898,
1972,
29922,
1972,
29892,
4046,
29922,
13400,
29892,
14383,
29922,
11014,
29897,
13,
1678,
14391,
353,
518,
4645,
1839,
15697,
2033,
363,
3132,
297,
2933,
1839,
1272,
2033,
29962,
13,
1678,
363,
1962,
297,
14391,
29901,
13,
4706,
1962,
1839,
4645,
29918,
333,
2033,
353,
1962,
1839,
29918,
333,
2033,
13,
13,
1678,
19909,
29918,
6672,
353,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
877,
29907,
492,
1237,
2391,
29901,
742,
1813,
29922,
3488,
29892,
4046,
29922,
13400,
29897,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
13,
4706,
19909,
29918,
6672,
29892,
13,
4706,
14391,
29892,
13,
4706,
3349,
7327,
29922,
5574,
29892,
13,
4706,
9066,
29922,
1839,
4645,
29918,
333,
742,
525,
4645,
29918,
3259,
742,
525,
10141,
29918,
333,
742,
525,
1792,
29918,
23959,
29918,
2230,
7464,
13,
4706,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
4032,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
4645,
29918,
333,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
1051,
29918,
3069,
29918,
21264,
630,
29918,
1792,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
2391,
599,
4160,
310,
3058,
3495,
491,
967,
3495,
978,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
3495,
978,
353,
6389,
1839,
28988,
2033,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
11303,
1237,
29918,
3827,
29898,
1972,
29922,
29888,
29915,
3069,
29918,
3888,
29889,
28988,
11594,
426,
28988,
29913,
742,
13,
462,
462,
965,
4046,
29922,
13400,
29892,
13,
462,
462,
965,
14383,
29922,
11014,
29897,
13,
13,
1678,
14391,
353,
2533,
3552,
4645,
1839,
15697,
13359,
657,
877,
7193,
1495,
363,
3132,
297,
2933,
1839,
1272,
2033,
511,
518,
2314,
13,
1678,
363,
1962,
297,
14391,
29901,
13,
4706,
1962,
1839,
1792,
29918,
333,
2033,
353,
1962,
1839,
29918,
333,
2033,
13,
13,
1678,
19909,
29918,
6672,
353,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
29898,
29888,
29915,
5959,
6853,
630,
2973,
426,
28988,
6177,
742,
13,
462,
462,
462,
418,
1813,
29922,
3488,
29892,
13,
462,
462,
462,
418,
4046,
29922,
13400,
29897,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
949,
519,
29918,
6672,
29892,
13,
462,
462,
418,
14391,
29892,
13,
462,
462,
418,
3349,
7327,
29922,
5574,
29892,
13,
462,
462,
418,
9066,
29922,
1839,
1792,
29918,
333,
742,
525,
6786,
742,
525,
1792,
29918,
4993,
7464,
13,
462,
462,
418,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
2659,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
1792,
29918,
333,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
1051,
29918,
1792,
29918,
21264,
630,
29918,
3069,
29918,
6519,
29898,
4645,
29901,
12477,
29892,
6389,
29901,
360,
919,
29961,
710,
29892,
851,
2314,
1599,
10516,
12191,
29901,
13,
1678,
9995,
13,
1678,
2391,
599,
18982,
4475,
304,
263,
3058,
8952,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4645,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
6389,
313,
21533,
29961,
710,
29892,
3139,
29962,
1125,
10516,
6273,
515,
1060,
6156,
1718,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
10516,
12191,
29901,
10516,
2582,
411,
10650,
2933,
29892,
14391,
322,
19909,
14391,
29889,
13,
1678,
9995,
13,
13,
1678,
8952,
353,
6389,
1839,
6786,
2033,
13,
1678,
1813,
29892,
14383,
29892,
4046,
353,
679,
29918,
13573,
3381,
29918,
25699,
29898,
5085,
29897,
13,
13,
1678,
2933,
353,
3132,
29889,
1761,
29918,
11303,
1237,
29918,
3827,
29898,
1972,
29922,
29888,
29915,
6786,
11594,
426,
6786,
29913,
742,
4046,
29922,
13400,
29892,
14383,
29922,
11014,
29897,
13,
13,
1678,
14391,
353,
5159,
13,
1678,
363,
3132,
297,
2933,
1839,
1272,
2033,
29901,
13,
4706,
8393,
353,
3132,
1839,
15697,
2033,
13,
4706,
10823,
29918,
4882,
353,
9657,
29918,
11177,
29918,
657,
29898,
15697,
29892,
6024,
4230,
29918,
3696,
742,
525,
4882,
11287,
13,
4706,
14391,
29889,
4397,
3319,
29915,
14748,
29918,
4882,
2396,
10823,
29918,
4882,
29892,
3579,
15697,
1839,
3069,
29918,
3888,
2033,
1800,
13,
13,
1678,
19909,
29918,
6672,
353,
679,
29918,
13573,
3381,
29918,
949,
519,
29918,
4906,
29898,
29888,
29915,
8514,
29879,
6853,
630,
2973,
426,
6786,
6177,
742,
13,
462,
462,
462,
418,
1813,
29922,
3488,
29892,
13,
462,
462,
462,
418,
4046,
29922,
13400,
29897,
13,
1678,
19909,
29918,
4905,
353,
1591,
1762,
9802,
3204,
29898,
949,
519,
29918,
6672,
29892,
13,
462,
462,
418,
14391,
29892,
13,
462,
462,
418,
3349,
7327,
29922,
5574,
29892,
13,
462,
462,
418,
9066,
29922,
1839,
28988,
742,
525,
359,
29918,
3259,
742,
525,
14748,
29918,
4882,
7464,
13,
462,
462,
418,
4839,
13372,
29922,
1807,
29918,
517,
29918,
2371,
29918,
6672,
29897,
13,
13,
1678,
736,
10516,
12191,
29898,
4905,
29879,
29918,
13506,
2433,
6779,
808,
2300,
29889,
8514,
742,
13,
462,
3986,
14391,
29918,
1989,
29918,
2671,
2433,
1983,
10141,
5416,
742,
13,
462,
3986,
14391,
29922,
4905,
29879,
29892,
13,
462,
3986,
19909,
29918,
4905,
29922,
949,
519,
29918,
4905,
29892,
13,
462,
3986,
10650,
29918,
5327,
29922,
5327,
29897,
13,
13,
13,
1753,
1243,
29918,
5453,
29898,
4645,
29901,
12477,
29892,
4236,
29918,
9155,
29901,
938,
29892,
937,
29918,
9155,
29901,
851,
29892,
6699,
29918,
13604,
29901,
6120,
29892,
13,
18884,
4236,
29918,
13604,
29918,
9155,
29901,
938,
29892,
1741,
29918,
8768,
29901,
2391,
29961,
710,
2314,
1599,
851,
29901,
13,
1678,
9995,
13,
1678,
15758,
1078,
599,
13465,
4128,
29892,
322,
6987,
3957,
304,
12670,
808,
2300,
2777,
29889,
13,
1678,
9995,
13,
13,
1678,
12725,
29918,
9155,
29918,
7529,
29898,
3317,
29918,
9155,
29892,
4236,
29918,
13604,
29918,
9155,
29892,
6699,
29918,
13604,
29892,
937,
29918,
9155,
29892,
1741,
29918,
8768,
29897,
13,
1678,
3132,
29889,
1761,
29918,
12888,
29879,
29918,
3827,
29898,
13400,
29922,
29896,
29892,
13,
462,
1669,
14383,
29922,
29900,
29892,
13,
462,
1669,
1369,
29918,
2230,
29922,
1256,
29918,
517,
29918,
23128,
29918,
16394,
29898,
12673,
29889,
3707,
25739,
13,
462,
1669,
1095,
29918,
2230,
29922,
1256,
29918,
517,
29918,
23128,
29918,
16394,
29898,
12673,
29889,
3707,
22130,
13,
1678,
736,
525,
554,
29915,
13,
13,
13,
1753,
6699,
29918,
20787,
29918,
1853,
29918,
13604,
29898,
4645,
29901,
12477,
29892,
4236,
29918,
9155,
29901,
938,
29892,
1369,
29918,
2230,
29901,
938,
29892,
13,
462,
1669,
1741,
29918,
8768,
29901,
2391,
29961,
710,
1402,
13,
462,
1669,
2346,
29901,
28379,
29961,
710,
2314,
1599,
2391,
29961,
21533,
29961,
710,
29892,
3139,
5262,
29901,
13,
1678,
9995,
13,
1678,
383,
3486,
267,
4959,
515,
2999,
4072,
29889,
13,
1678,
450,
740,
3732,
385,
3450,
1246,
363,
1269,
1134,
29892,
1951,
278,
3450,
6858,
13,
1678,
22146,
278,
1741,
1134,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4032,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
4236,
29918,
9155,
313,
524,
1125,
450,
7472,
5253,
310,
4959,
304,
6699,
363,
1269,
1134,
29889,
13,
4706,
1369,
29918,
2230,
313,
524,
1125,
450,
931,
304,
6699,
278,
4959,
515,
29889,
13,
4706,
1741,
29918,
8768,
313,
1293,
29961,
710,
29962,
1125,
450,
1741,
4072,
304,
6699,
408,
5528,
16719,
29889,
13,
4706,
2346,
313,
27636,
29961,
710,
29962,
1125,
13641,
363,
21166,
278,
4959,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
2391,
29961,
21533,
29961,
710,
29892,
3139,
5262,
29901,
450,
6699,
287,
4959,
29889,
13,
1678,
9995,
13,
13,
1678,
4959,
353,
5159,
13,
1678,
565,
1741,
29918,
8768,
29901,
13,
4706,
4236,
29918,
9155,
353,
4236,
29918,
9155,
849,
7431,
29898,
3696,
29918,
8768,
29897,
13,
13,
1678,
363,
1741,
29918,
1853,
297,
1741,
29918,
8768,
29901,
13,
4706,
716,
29918,
13604,
353,
3132,
29889,
1761,
29918,
13604,
29918,
3827,
29898,
2962,
29918,
2230,
29922,
2962,
29918,
2230,
29892,
13,
462,
462,
18884,
1095,
29918,
2230,
29922,
1256,
29918,
517,
29918,
23128,
29918,
16394,
29898,
12673,
29889,
3707,
25739,
13,
462,
462,
18884,
4046,
29922,
3317,
29918,
9155,
29892,
13,
462,
462,
18884,
443,
24582,
29922,
8824,
29892,
13,
462,
462,
18884,
1741,
29918,
1853,
29922,
3696,
29918,
1853,
29892,
13,
462,
462,
18884,
2346,
29922,
1972,
29897,
1839,
1272,
2033,
13,
4706,
363,
1741,
297,
716,
29918,
13604,
29901,
13,
9651,
1741,
1839,
3696,
29918,
333,
2033,
353,
1741,
1839,
29918,
333,
2033,
13,
9651,
1741,
1839,
3742,
1693,
29918,
1853,
2033,
353,
1741,
29918,
1853,
13,
13,
4706,
4959,
29889,
21843,
29898,
1482,
29918,
13604,
29897,
13,
13,
1678,
736,
4959,
13,
13,
13,
1753,
6699,
29918,
3742,
16719,
29898,
4645,
29901,
12477,
29892,
4236,
29918,
9155,
29901,
938,
29892,
937,
29918,
9155,
29901,
851,
29892,
6699,
29918,
13604,
29901,
6120,
29892,
13,
462,
1678,
4236,
29918,
13604,
29918,
9155,
29901,
938,
29892,
1741,
29918,
8768,
29901,
2391,
29961,
710,
1402,
6655,
29879,
29918,
1972,
29901,
28379,
29961,
710,
1402,
13,
462,
1678,
4959,
29918,
1972,
29901,
28379,
29961,
710,
2314,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
383,
3486,
267,
6655,
29879,
322,
4959,
408,
5528,
16719,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3132,
313,
4032,
1125,
450,
12670,
808,
2300,
3132,
29889,
13,
4706,
4236,
29918,
9155,
313,
524,
1125,
5918,
12539,
1353,
310,
5528,
16719,
304,
6699,
29889,
13,
4706,
937,
29918,
9155,
313,
710,
1125,
450,
14334,
304,
6699,
278,
5528,
16719,
515,
29889,
13,
4706,
4236,
29918,
13604,
29918,
9155,
313,
524,
1125,
5918,
12539,
1353,
310,
4959,
304,
6699,
29889,
13,
4706,
1741,
29918,
8768,
313,
1293,
29961,
710,
29962,
1125,
450,
1134,
310,
4959,
304,
6699,
29889,
13,
4706,
6655,
29879,
29918,
1972,
313,
27636,
29961,
710,
29962,
1125,
13641,
363,
21166,
278,
6699,
287,
6655,
29879,
29889,
13,
4706,
4959,
29918,
1972,
313,
27636,
29961,
710,
29962,
1125,
13641,
363,
21166,
278,
6699,
287,
4959,
29889,
13,
1678,
9995,
13,
13,
1678,
12725,
29918,
9155,
29918,
7529,
29898,
3317,
29918,
9155,
29892,
4236,
29918,
13604,
29918,
9155,
29892,
6699,
29918,
13604,
29892,
937,
29918,
9155,
29892,
1741,
29918,
8768,
29897,
13,
13,
1678,
1833,
29918,
3389,
353,
1261,
5137,
29889,
657,
8897,
6558,
580,
470,
6571,
13,
1678,
937,
29918,
9155,
353,
1852,
29918,
517,
29918,
23128,
29918,
16394,
29898,
4102,
29918,
9155,
29897,
13,
13,
1678,
1833,
29918,
12888,
29918,
2230,
353,
1833,
29918,
3389,
29889,
657,
877,
4230,
29918,
12888,
29918,
2230,
1495,
470,
937,
29918,
9155,
13,
1678,
6655,
29879,
353,
3132,
29889,
1761,
29918,
12888,
29879,
29918,
3827,
29898,
2962,
29918,
2230,
29922,
4230,
29918,
12888,
29918,
2230,
29892,
13,
462,
462,
4706,
1095,
29918,
2230,
29922,
1256,
29918,
517,
29918,
23128,
29918,
16394,
29898,
12673,
29889,
3707,
25739,
13,
462,
462,
4706,
4046,
29922,
3317,
29918,
9155,
29892,
13,
462,
462,
4706,
2346,
29922,
12888,
29879,
29918,
1972,
29892,
13,
462,
462,
4706,
443,
24582,
29922,
8824,
29897,
1839,
1272,
2033,
13,
13,
1678,
1833,
29918,
3696,
29918,
2230,
353,
1833,
29918,
3389,
29889,
657,
877,
4230,
29918,
3696,
29918,
2230,
1495,
470,
937,
29918,
9155,
13,
1678,
565,
6699,
29918,
13604,
29901,
13,
4706,
4959,
353,
6699,
29918,
20787,
29918,
1853,
29918,
13604,
29898,
4645,
29892,
13,
462,
462,
9651,
4236,
29918,
9155,
29922,
3317,
29918,
13604,
29918,
9155,
29892,
13,
462,
462,
9651,
1369,
29918,
2230,
29922,
4230,
29918,
3696,
29918,
2230,
29892,
13,
462,
462,
9651,
1741,
29918,
8768,
29922,
3696,
29918,
8768,
29892,
13,
462,
462,
9651,
2346,
29922,
13604,
29918,
1972,
29897,
13,
1678,
1683,
29901,
13,
4706,
4959,
353,
5159,
13,
13,
1678,
5528,
16719,
353,
5159,
13,
1678,
363,
6655,
297,
6655,
29879,
29901,
13,
4706,
6655,
1839,
3742,
1693,
29918,
1853,
2033,
353,
6655,
1839,
12888,
29918,
1853,
2033,
13,
13,
4706,
5528,
16719,
29889,
4397,
3319,
13,
9651,
525,
978,
2396,
6655,
1839,
12888,
29918,
978,
7464,
13,
9651,
525,
542,
2764,
1127,
2396,
14334,
29918,
517,
29918,
4130,
342,
5393,
29898,
12888,
1839,
16394,
2033,
511,
13,
9651,
525,
1610,
7249,
2396,
4390,
29889,
29881,
17204,
29898,
12888,
29897,
13,
4706,
5615,
13,
13,
1678,
363,
1741,
297,
4959,
29901,
13,
4706,
5528,
16719,
29889,
4397,
3319,
13,
9651,
525,
978,
2396,
1741,
1839,
3696,
29918,
333,
7464,
13,
9651,
525,
542,
2764,
1127,
2396,
14334,
29918,
517,
29918,
4130,
342,
5393,
29898,
3696,
1839,
16394,
2033,
511,
13,
9651,
525,
1610,
7249,
2396,
4390,
29889,
29881,
17204,
29898,
3696,
29897,
13,
4706,
5615,
13,
13,
1678,
396,
450,
6655,
29879,
322,
4959,
526,
12705,
297,
5153,
2548,
1797,
29889,
13,
1678,
396,
3115,
29892,
591,
11924,
278,
14334,
297,
697,
1473,
304,
4772,
20955,
29889,
13,
1678,
1261,
5137,
29889,
842,
8897,
6558,
3319,
13,
4706,
525,
4230,
29918,
12888,
29918,
2230,
2396,
6655,
29879,
29961,
29900,
22322,
16394,
2033,
718,
29871,
29896,
565,
6655,
29879,
1683,
1833,
29918,
12888,
29918,
2230,
29892,
13,
4706,
525,
4230,
29918,
3696,
29918,
2230,
2396,
4959,
29961,
29900,
22322,
16394,
2033,
718,
29871,
29896,
565,
4959,
1683,
1833,
29918,
3696,
29918,
2230,
13,
1678,
5615,
13,
1678,
1261,
5137,
29889,
3742,
16719,
29898,
3742,
16719,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
8636,
353,
1261,
5137,
29889,
7529,
580,
13,
13,
1678,
3142,
353,
8636,
1839,
2271,
2033,
13,
13,
1678,
5993,
353,
8636,
1839,
29966,
25711,
17013,
29958,
16215,
5630,
2033,
13,
1678,
671,
29918,
16265,
353,
451,
8636,
29889,
657,
877,
262,
24216,
742,
7700,
29897,
13,
1678,
671,
29918,
14701,
353,
8636,
29889,
657,
877,
14701,
742,
7700,
29897,
13,
1678,
4236,
29918,
9155,
353,
1852,
29918,
517,
29918,
4537,
29898,
7529,
29889,
657,
877,
3317,
29918,
9155,
742,
22236,
29918,
12648,
29918,
29943,
2544,
3210,
876,
13,
1678,
937,
29918,
9155,
353,
8636,
29889,
657,
877,
4102,
29918,
9155,
742,
22236,
29918,
3738,
29934,
1254,
29918,
29943,
2544,
3210,
29897,
13,
1678,
6699,
29918,
13604,
353,
1852,
1762,
18146,
29898,
7529,
29889,
657,
877,
9155,
29918,
13604,
742,
7700,
876,
13,
1678,
1741,
29918,
8768,
353,
1852,
21254,
29898,
7529,
29889,
657,
877,
9155,
29918,
3696,
29918,
8768,
742,
22236,
29918,
22240,
3919,
29918,
11116,
876,
13,
1678,
4236,
29918,
13604,
29918,
9155,
353,
1852,
29918,
517,
29918,
4537,
29898,
7529,
29889,
657,
877,
3317,
29918,
13604,
29918,
9155,
742,
22236,
29918,
22240,
3919,
29903,
29918,
29943,
2544,
3210,
876,
13,
13,
1678,
3132,
353,
12477,
29898,
2271,
29892,
5993,
29892,
671,
29918,
16265,
29892,
671,
29918,
14701,
29897,
13,
13,
1678,
8260,
353,
426,
13,
4706,
525,
1212,
808,
2300,
29899,
3696,
29899,
1761,
2396,
1051,
29918,
13604,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
12888,
29899,
1761,
2396,
1051,
29918,
12888,
29879,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
339,
279,
424,
1312,
29899,
1445,
29899,
1761,
2396,
1051,
29918,
339,
279,
424,
1312,
29918,
5325,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
339,
279,
424,
1312,
29899,
1445,
29899,
657,
2396,
679,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
339,
279,
424,
1312,
29899,
1445,
29899,
5504,
2396,
2767,
29918,
339,
279,
424,
1312,
29918,
1445,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
2271,
29899,
1761,
29899,
5504,
2396,
2767,
29918,
2271,
29918,
1761,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
1445,
29899,
8568,
29899,
1761,
29899,
5504,
2396,
2767,
29918,
1445,
29918,
8568,
29918,
1761,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
4645,
29899,
1761,
2396,
1051,
29918,
11303,
1237,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
3069,
29899,
21264,
630,
29899,
1792,
29899,
1761,
2396,
1051,
29918,
3069,
29918,
21264,
630,
29918,
1792,
29918,
6519,
29892,
13,
4706,
525,
1212,
808,
2300,
29899,
1792,
29899,
21264,
630,
29899,
3069,
29899,
1761,
2396,
1051,
29918,
1792,
29918,
21264,
630,
29918,
3069,
29918,
6519,
29892,
13,
1678,
500,
13,
13,
1678,
1018,
29901,
13,
4706,
1899,
353,
1261,
5137,
29889,
6519,
580,
13,
13,
4706,
565,
1899,
1275,
525,
1688,
29899,
5453,
2396,
13,
9651,
736,
29918,
9902,
29898,
13,
18884,
1243,
29918,
5453,
29898,
4645,
29892,
13,
462,
9651,
4236,
29918,
9155,
29922,
3317,
29918,
9155,
29892,
13,
462,
9651,
937,
29918,
9155,
29922,
4102,
29918,
9155,
29892,
13,
462,
9651,
6699,
29918,
13604,
29922,
9155,
29918,
13604,
29892,
13,
462,
9651,
4236,
29918,
13604,
29918,
9155,
29922,
3317,
29918,
13604,
29918,
9155,
29892,
13,
462,
9651,
1741,
29918,
8768,
29922,
3696,
29918,
8768,
876,
13,
4706,
25342,
1899,
1275,
525,
9155,
29899,
3742,
16719,
2396,
13,
9651,
6699,
29918,
3742,
16719,
29898,
4645,
29892,
13,
462,
9651,
4236,
29918,
9155,
29922,
3317,
29918,
9155,
29892,
13,
462,
9651,
937,
29918,
9155,
29922,
4102,
29918,
9155,
29892,
13,
462,
9651,
6699,
29918,
13604,
29922,
9155,
29918,
13604,
29892,
13,
462,
9651,
4236,
29918,
13604,
29918,
9155,
29922,
3317,
29918,
13604,
29918,
9155,
29892,
13,
462,
9651,
1741,
29918,
8768,
29922,
3696,
29918,
8768,
29892,
13,
462,
9651,
6655,
29879,
29918,
1972,
29922,
2310,
5137,
29889,
7529,
2141,
657,
877,
12888,
29918,
1972,
5477,
13,
462,
9651,
4959,
29918,
1972,
29922,
2310,
5137,
29889,
7529,
2141,
657,
877,
13604,
29918,
1972,
8785,
13,
4706,
25342,
1899,
297,
8260,
29901,
13,
9651,
736,
29918,
9902,
29898,
26381,
29961,
6519,
850,
4645,
29892,
1261,
5137,
29889,
5085,
22130,
13,
4706,
1683,
29901,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
29898,
29888,
29915,
1576,
1899,
426,
6519,
29913,
947,
451,
1863,
29991,
1495,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1261,
5137,
29889,
2704,
29898,
15003,
1627,
29889,
4830,
29918,
735,
29883,
3101,
13,
4706,
736,
29918,
2704,
29898,
29888,
29915,
17776,
304,
6222,
426,
2310,
5137,
29889,
6519,
28296,
1899,
7790,
29876,
2392,
3583,
29876,
29912,
29872,
29913,
1495,
13,
13,
13,
361,
4770,
978,
1649,
297,
6702,
1649,
3396,
1649,
742,
525,
1649,
16145,
262,
1649,
742,
525,
16145,
1144,
29374,
13,
1678,
1667,
580,
13,
2
] |
UQ/UQtutorial.py | ISR3D/ISR3D | 0 | 39100 | import subprocess
lib_list = ['numpy','ymmsl','sobol_seq','csv','seaborn','zenodo_get']
for lib_name in lib_list:
try:
import lib_name
except ImportError:
if lib_name == 'csv':
print(lib_name,' Module not installed')
subprocess.run(['pip','install','python-csv'])
else:
print(lib_name,' Module not installed')
subprocess.run(['pip','install','%s'%lib_name])
import numpy as np
import ymmsl
import sobol_seq
import csv
import os
import seaborn as sns
import zenodo_get
# Transform the normalized sample matrix to ranges of uncertain parameters
def dim_transform(sobol_vector,uncertain_list):
dim = len(uncertain_list)
for num_dim in range(dim):
para_max = uncertain_list[num_dim].get('max')
para_min = uncertain_list[num_dim].get('min')
sobol_vector[:,num_dim] = para_min + (para_max-para_min)*sobol_vector[:,num_dim]
return sobol_vector
####################################################################################
##### Sample generation and UQ campaign creation (including instances folder)#######
####################################################################################
# Note:
# This is used to generate UQ samples for only four biological parameters:
# 1) Endothelium endpoint 2)smc max stran 3)balloon extension 4) Fenestration probability
# Naming of Folder and files for samples
# Level 0: UQtest (UQ campaign name)
# Level 1: UQtest/A (sample matrix of sobol sequence)
# Level 2: UQtest/A/A_X where X vary from 1 -> N (N: number of samples)
# Level 3: UQtest/A/A_X/input.ymmsl
### Main function
# Number of samples for UQ
# Note that ISR3D is a computationally intensive application.
# Running 128 instances would need some cluster resources
# You can start with a small number, 16 for instances.
NumSample = 128
# Template path to the ymmsl file (relative path from ISR3D/Result/UQtest/ to ISR3D/UQ/template/input_stage4.ymmsl)
input_path = '../../UQ/template/'
input_ymmsl_filename = 'input_stage4.ymmsl'
# Output directory for UQ campagin folder and name
output_path = './'
experiment_name = 'UQtest'
# Read in the data of template ymmsl file
with open(input_path+input_ymmsl_filename,'r') as f:
ymmsl_data = ymmsl.load(f)
# Take out the unchanged model part and need-for-change settings part for ymmsl model
model = ymmsl_data.model
settings = ymmsl_data.settings
# Set uncertain parameters and its ranges as a list
ymmsl_uncertain_parameters = [
{
'name': 'smc.endo_endpoint',
'min': 10.0,
'max': 20.0
},
{
'name': 'smc.balloon_extension',
'min': 0.5,
'max': 1.5
},
{
'name': 'smc.smc_max_strain',
'min': 1.2,
'max': 1.8
},
{
'name': 'smc.fenestration_probability',
'min': 0.0,# Calculate the lumen volume from (lumen_area_of_each_slice*depth_of_slice)
'max': 0.1
}]
# Count the total uncertain input dimensions (here 4 parameters)
num_uncer_para = len(ymmsl_uncertain_parameters)
print('Number of uncertain parameter: '+str(num_uncer_para))
# Generate sobel sequence range (0,1), save the file and transform to (min,max)
A = sobol_seq.i4_sobol_generate(num_uncer_para,NumSample)
A = dim_transform(A,ymmsl_uncertain_parameters)
np.savetxt("A.csv",A)
# Create corresponding directory and folders
try:
os.mkdir(output_path+experiment_name)
except OSError:
print ("Creation of the directory %s failed" % output_path+experiment_name)
else:
print ("Successfully created the directory %s" % output_path+experiment_name)
# A: Replace the corresponding value within the dict and output the file
os.mkdir(output_path+experiment_name+'/A')
checklist = ['A']
for n in range(NumSample):
sample_path = output_path+experiment_name+'/A'+'/A_'+str(n)
os.mkdir(sample_path)
# Generate file for ymmsl
num_para = 0
for para in ymmsl_uncertain_parameters:
settings[para.get('name')] = float(A[n,num_para])
num_para = num_para + 1
config = ymmsl.Configuration(model, settings, None, None)
with open(sample_path+'/input_stage4.ymmsl', 'w') as f:
ymmsl.save(config, f)
print('ymmsl input for each UQ instance has been generated')
####################################################################################
##### Run shell script to broadcast other input files to each sample folder#########
####################################################################################
import subprocess
# Download Other input files from Zenodo
print('Start to download other input files for ISR3D from Zenodo')
subprocess.run(['wget https://zenodo.org/record/4603912/files/stage3.test_vessel.dat'],shell = True)
subprocess.run(['wget https://zenodo.org/record/4603912/files/stage3.test_vessel_nb.dat'],shell = True)
subprocess.run(['wget https://zenodo.org/record/4603912/files/test_vessel_centerline.csv'],shell = True)
print('Start to broadcast the input to each UQ instance directory')
# Template path to the ymmsl file (relative path from ISR3D/Result/UQtest/ to ISR3D/UQ/function/BCastStage3.sh)
pass_arg = str(NumSample)
subprocess.run(['bash','../../UQ/function/BCastStage3.sh', '%s'%pass_arg])
print('Sample generation done') | [
1,
1053,
1014,
5014,
13,
1982,
29918,
1761,
353,
6024,
23749,
3788,
962,
1516,
29880,
3788,
578,
2095,
29918,
11762,
3788,
7638,
3788,
344,
370,
1398,
3788,
2256,
8144,
29918,
657,
2033,
13,
1454,
4303,
29918,
978,
297,
4303,
29918,
1761,
29901,
13,
12,
2202,
29901,
13,
12,
12,
5215,
4303,
29918,
978,
13,
12,
19499,
16032,
2392,
29901,
13,
12,
12,
361,
4303,
29918,
978,
1275,
525,
7638,
2396,
13,
12,
12,
12,
2158,
29898,
1982,
29918,
978,
5501,
15591,
451,
5130,
1495,
13,
12,
12,
12,
1491,
5014,
29889,
3389,
18959,
13096,
3788,
6252,
3788,
4691,
29899,
7638,
11287,
29871,
13,
12,
12,
2870,
29901,
13,
12,
12,
12,
2158,
29898,
1982,
29918,
978,
5501,
15591,
451,
5130,
1495,
13,
12,
12,
12,
1491,
5014,
29889,
3389,
18959,
13096,
3788,
6252,
3788,
29995,
29879,
29915,
29995,
1982,
29918,
978,
2314,
13,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
343,
29885,
1516,
29880,
13,
5215,
577,
2095,
29918,
11762,
13,
5215,
11799,
13,
5215,
2897,
13,
5215,
409,
370,
1398,
408,
269,
1983,
13,
5215,
503,
264,
8144,
29918,
657,
13,
13,
13,
29937,
4103,
689,
278,
4226,
1891,
4559,
4636,
304,
20238,
310,
17999,
4128,
13,
1753,
3964,
29918,
9067,
29898,
578,
2095,
29918,
8111,
29892,
4661,
13946,
29918,
1761,
1125,
13,
268,
13,
1678,
3964,
353,
7431,
29898,
4661,
13946,
29918,
1761,
29897,
13,
1678,
363,
954,
29918,
6229,
297,
3464,
29898,
6229,
1125,
13,
4706,
1702,
29918,
3317,
353,
17999,
29918,
1761,
29961,
1949,
29918,
6229,
1822,
657,
877,
3317,
1495,
13,
4706,
1702,
29918,
1195,
353,
17999,
29918,
1761,
29961,
1949,
29918,
6229,
1822,
657,
877,
1195,
1495,
13,
4706,
577,
2095,
29918,
8111,
7503,
29892,
1949,
29918,
6229,
29962,
353,
1702,
29918,
1195,
718,
313,
22752,
29918,
3317,
29899,
22752,
29918,
1195,
11877,
578,
2095,
29918,
8111,
7503,
29892,
1949,
29918,
6229,
29962,
13,
308,
13,
1678,
736,
577,
2095,
29918,
8111,
13,
13,
13383,
13383,
13383,
13383,
13383,
4136,
13,
4136,
29937,
21029,
12623,
322,
501,
29984,
11531,
11265,
313,
18271,
8871,
4138,
29897,
4136,
2277,
29937,
13,
13383,
13383,
13383,
13383,
13383,
4136,
13,
29937,
3940,
29901,
13,
29937,
29871,
910,
338,
1304,
304,
5706,
501,
29984,
11916,
363,
871,
3023,
4768,
5996,
4128,
29901,
13,
29937,
12,
29896,
29897,
2796,
720,
295,
1974,
16248,
29871,
29906,
29897,
3844,
29883,
4236,
16463,
29871,
29941,
29897,
5521,
417,
265,
6081,
29871,
29946,
29897,
20685,
16444,
362,
6976,
13,
13,
29937,
405,
11500,
310,
383,
3194,
322,
2066,
363,
11916,
13,
29937,
21597,
29871,
29900,
29901,
1678,
501,
29984,
1688,
462,
462,
1678,
313,
29965,
29984,
11531,
1024,
29897,
13,
29937,
21597,
29871,
29896,
29901,
1678,
501,
29984,
1688,
29914,
29909,
462,
462,
29871,
313,
11249,
4636,
310,
577,
2095,
5665,
29897,
13,
29937,
21597,
29871,
29906,
29901,
1678,
501,
29984,
1688,
29914,
29909,
29914,
29909,
29918,
29990,
988,
1060,
13100,
515,
29871,
29896,
1599,
405,
268,
313,
29940,
29901,
1353,
310,
11916,
29897,
13,
29937,
21597,
29871,
29941,
29901,
1678,
501,
29984,
1688,
29914,
29909,
29914,
29909,
29918,
29990,
29914,
2080,
29889,
962,
1516,
29880,
13,
13,
13,
2277,
29937,
4241,
740,
13,
29937,
9681,
310,
11916,
363,
501,
29984,
13,
29937,
3940,
393,
8519,
29934,
29941,
29928,
338,
263,
16287,
635,
938,
6270,
2280,
29889,
13,
29937,
19509,
29871,
29896,
29906,
29947,
8871,
723,
817,
777,
9867,
7788,
13,
29937,
887,
508,
1369,
411,
263,
2319,
1353,
29892,
29871,
29896,
29953,
363,
8871,
29889,
13,
8009,
17708,
353,
29871,
29896,
29906,
29947,
13,
13,
29937,
25663,
2224,
304,
278,
343,
29885,
1516,
29880,
934,
313,
22925,
2224,
515,
8519,
29934,
29941,
29928,
29914,
3591,
29914,
29965,
29984,
1688,
29914,
304,
8519,
29934,
29941,
29928,
29914,
29965,
29984,
29914,
6886,
29914,
2080,
29918,
19190,
29946,
29889,
962,
1516,
29880,
29897,
13,
2080,
29918,
2084,
353,
525,
21546,
29965,
29984,
29914,
6886,
22208,
13,
2080,
29918,
962,
1516,
29880,
29918,
9507,
353,
525,
2080,
29918,
19190,
29946,
29889,
962,
1516,
29880,
29915,
13,
13,
29937,
10604,
3884,
363,
501,
29984,
4242,
26584,
4138,
322,
1024,
13,
4905,
29918,
2084,
353,
19283,
29915,
13,
735,
15362,
29918,
978,
353,
525,
29965,
29984,
1688,
29915,
13,
13,
13,
29937,
7523,
297,
278,
848,
310,
4472,
343,
29885,
1516,
29880,
934,
13,
2541,
1722,
29898,
2080,
29918,
2084,
29974,
2080,
29918,
962,
1516,
29880,
29918,
9507,
5501,
29878,
1495,
408,
285,
29901,
13,
1678,
343,
29885,
1516,
29880,
29918,
1272,
353,
343,
29885,
1516,
29880,
29889,
1359,
29898,
29888,
29897,
13,
13,
29937,
11190,
714,
278,
443,
15033,
1904,
760,
322,
817,
29899,
1454,
29899,
3167,
6055,
760,
363,
343,
29885,
1516,
29880,
1904,
13,
4299,
353,
343,
29885,
1516,
29880,
29918,
1272,
29889,
4299,
13,
11027,
353,
343,
29885,
1516,
29880,
29918,
1272,
29889,
11027,
13,
13,
13,
29937,
3789,
17999,
4128,
322,
967,
20238,
408,
263,
1051,
13,
962,
1516,
29880,
29918,
4661,
13946,
29918,
16744,
353,
518,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
3844,
29883,
29889,
2765,
29918,
29734,
742,
13,
9651,
525,
1195,
2396,
29871,
29896,
29900,
29889,
29900,
29892,
13,
9651,
525,
3317,
2396,
29871,
29906,
29900,
29889,
29900,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
3844,
29883,
29889,
5521,
417,
265,
29918,
17588,
742,
13,
9651,
525,
1195,
2396,
29871,
29900,
29889,
29945,
29892,
13,
9651,
525,
3317,
2396,
29871,
29896,
29889,
29945,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
3844,
29883,
29889,
3844,
29883,
29918,
3317,
29918,
4151,
262,
742,
13,
9651,
525,
1195,
2396,
29871,
29896,
29889,
29906,
29892,
13,
9651,
525,
3317,
2396,
29871,
29896,
29889,
29947,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
3844,
29883,
29889,
11350,
16444,
362,
29918,
22795,
3097,
742,
13,
9651,
525,
1195,
2396,
29871,
29900,
29889,
29900,
29892,
29937,
20535,
403,
278,
301,
14170,
7977,
515,
313,
29880,
14170,
29918,
6203,
29918,
974,
29918,
4204,
29918,
18337,
29930,
19488,
29918,
974,
29918,
18337,
29897,
13,
9651,
525,
3317,
2396,
29871,
29900,
29889,
29896,
13,
4706,
500,
29962,
13,
13,
29937,
3917,
278,
3001,
17999,
1881,
13391,
313,
4150,
29871,
29946,
4128,
29897,
13,
1949,
29918,
348,
2265,
29918,
22752,
353,
7431,
29898,
962,
1516,
29880,
29918,
4661,
13946,
29918,
16744,
29897,
13,
2158,
877,
4557,
310,
17999,
3443,
29901,
525,
29974,
710,
29898,
1949,
29918,
348,
2265,
29918,
22752,
876,
13,
13,
29937,
3251,
403,
577,
6596,
5665,
3464,
313,
29900,
29892,
29896,
511,
4078,
278,
934,
322,
4327,
304,
313,
1195,
29892,
3317,
29897,
13,
29909,
353,
577,
2095,
29918,
11762,
29889,
29875,
29946,
29918,
578,
2095,
29918,
17158,
29898,
1949,
29918,
348,
2265,
29918,
22752,
29892,
8009,
17708,
29897,
13,
29909,
353,
3964,
29918,
9067,
29898,
29909,
29892,
962,
1516,
29880,
29918,
4661,
13946,
29918,
16744,
29897,
13,
9302,
29889,
29879,
485,
300,
486,
703,
29909,
29889,
7638,
613,
29909,
29897,
13,
13,
29937,
6204,
6590,
3884,
322,
16495,
13,
2202,
29901,
13,
1678,
2897,
29889,
11256,
3972,
29898,
4905,
29918,
2084,
29974,
735,
15362,
29918,
978,
29897,
13,
19499,
438,
29173,
29901,
13,
1678,
1596,
4852,
9832,
362,
310,
278,
3884,
1273,
29879,
5229,
29908,
1273,
1962,
29918,
2084,
29974,
735,
15362,
29918,
978,
29897,
13,
2870,
29901,
13,
1678,
1596,
4852,
14191,
3730,
2825,
278,
3884,
1273,
29879,
29908,
1273,
1962,
29918,
2084,
29974,
735,
15362,
29918,
978,
29897,
13,
13,
13,
29937,
319,
29901,
22108,
278,
6590,
995,
2629,
278,
9657,
322,
1962,
278,
934,
13,
359,
29889,
11256,
3972,
29898,
4905,
29918,
2084,
29974,
735,
15362,
29918,
978,
23097,
29914,
29909,
1495,
13,
3198,
1761,
353,
6024,
29909,
2033,
13,
13,
1454,
302,
297,
3464,
29898,
8009,
17708,
1125,
13,
1678,
4559,
29918,
2084,
353,
1962,
29918,
2084,
29974,
735,
15362,
29918,
978,
23097,
29914,
29909,
18717,
29915,
29914,
29909,
29918,
18717,
710,
29898,
29876,
29897,
13,
1678,
2897,
29889,
11256,
3972,
29898,
11249,
29918,
2084,
29897,
13,
268,
13,
1678,
396,
3251,
403,
934,
363,
343,
29885,
1516,
29880,
29871,
13,
1678,
954,
29918,
22752,
353,
29871,
29900,
13,
1678,
363,
1702,
297,
343,
29885,
1516,
29880,
29918,
4661,
13946,
29918,
16744,
29901,
13,
4706,
6055,
29961,
22752,
29889,
657,
877,
978,
1495,
29962,
353,
5785,
29898,
29909,
29961,
29876,
29892,
1949,
29918,
22752,
2314,
13,
4706,
954,
29918,
22752,
353,
954,
29918,
22752,
718,
29871,
29896,
13,
308,
13,
1678,
2295,
353,
343,
29885,
1516,
29880,
29889,
8614,
29898,
4299,
29892,
6055,
29892,
6213,
29892,
6213,
29897,
13,
1678,
411,
1722,
29898,
11249,
29918,
2084,
23097,
29914,
2080,
29918,
19190,
29946,
29889,
962,
1516,
29880,
742,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
343,
29885,
1516,
29880,
29889,
7620,
29898,
2917,
29892,
285,
29897,
13,
13,
2158,
877,
962,
1516,
29880,
1881,
363,
1269,
501,
29984,
2777,
756,
1063,
5759,
1495,
13,
13,
13383,
13383,
13383,
13383,
13383,
4136,
13,
4136,
29937,
7525,
6473,
2471,
304,
12672,
916,
1881,
2066,
304,
1269,
4559,
4138,
7346,
29937,
13,
13383,
13383,
13383,
13383,
13383,
4136,
13,
5215,
1014,
5014,
13,
29937,
25553,
5901,
1881,
2066,
515,
796,
264,
8144,
13,
2158,
877,
4763,
304,
5142,
916,
1881,
2066,
363,
8519,
29934,
29941,
29928,
515,
796,
264,
8144,
1495,
13,
1491,
5014,
29889,
3389,
18959,
29893,
657,
2045,
597,
2256,
8144,
29889,
990,
29914,
11651,
29914,
29946,
29953,
29900,
29941,
29929,
29896,
29906,
29914,
5325,
29914,
19190,
29941,
29889,
1688,
29918,
29894,
25583,
29889,
4130,
7464,
15903,
353,
5852,
29897,
13,
1491,
5014,
29889,
3389,
18959,
29893,
657,
2045,
597,
2256,
8144,
29889,
990,
29914,
11651,
29914,
29946,
29953,
29900,
29941,
29929,
29896,
29906,
29914,
5325,
29914,
19190,
29941,
29889,
1688,
29918,
29894,
25583,
29918,
9877,
29889,
4130,
7464,
15903,
353,
5852,
29897,
13,
1491,
5014,
29889,
3389,
18959,
29893,
657,
2045,
597,
2256,
8144,
29889,
990,
29914,
11651,
29914,
29946,
29953,
29900,
29941,
29929,
29896,
29906,
29914,
5325,
29914,
1688,
29918,
29894,
25583,
29918,
5064,
1220,
29889,
7638,
7464,
15903,
353,
5852,
29897,
13,
2158,
877,
4763,
304,
12672,
278,
1881,
304,
1269,
501,
29984,
2777,
3884,
1495,
13,
29937,
25663,
2224,
304,
278,
343,
29885,
1516,
29880,
934,
313,
22925,
2224,
515,
8519,
29934,
29941,
29928,
29914,
3591,
29914,
29965,
29984,
1688,
29914,
304,
8519,
29934,
29941,
29928,
29914,
29965,
29984,
29914,
2220,
29914,
5371,
579,
27276,
29941,
29889,
845,
29897,
13,
3364,
29918,
1191,
353,
851,
29898,
8009,
17708,
29897,
13,
1491,
5014,
29889,
3389,
18959,
13067,
3788,
21546,
29965,
29984,
29914,
2220,
29914,
5371,
579,
27276,
29941,
29889,
845,
742,
14210,
29879,
29915,
29995,
3364,
29918,
1191,
2314,
29871,
13,
2158,
877,
17708,
12623,
2309,
1495,
2
] |
example/django_example/polls/tests.py | dmsimard/dynaconf | 0 | 24926 | from django.conf import settings
from django.test import TestCase
# Create your tests here.
class SettingsTest(TestCase):
def test_settings(self):
self.assertEqual(settings.SERVER, 'prodserver.com')
self.assertEqual(
settings.STATIC_URL, '/changed/in/settings.toml/by/dynaconf/')
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.PASSWORD, '<PASSWORD>')
self.assertEqual(settings.get('PASSWORD'), '<PASSWORD>')
self.assertEqual(settings.FOO, 'It overrides every other env')
with settings.using_env('development'):
self.assertEqual(settings.SERVER, 'devserver.com')
self.assertEqual(settings.PASSWORD, False)
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
self.assertEqual(settings.SERVER, 'prodserver.com')
self.assertEqual(settings.PASSWORD, '<PASSWORD>')
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
with settings.using_env('staging'):
self.assertEqual(settings.SERVER, 'stagingserver.com')
self.assertEqual(settings.PASSWORD, False)
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
self.assertEqual(settings.SERVER, 'prodserver.com')
self.assertEqual(settings.PASSWORD, '<PASSWORD>')
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
with settings.using_env('customenv'):
self.assertEqual(settings.SERVER, 'customserver.com')
self.assertEqual(settings.PASSWORD, False)
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
self.assertEqual(settings.SERVER, 'prodserver.com')
self.assertEqual(settings.PASSWORD, '<PASSWORD>')
self.assertEqual(settings.USERNAME, 'admin_user_from_env')
self.assertEqual(settings.FOO, 'It overrides every other env')
| [
1,
515,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
1688,
1053,
4321,
8259,
13,
13,
29937,
6204,
596,
6987,
1244,
29889,
13,
13,
13,
1990,
19215,
3057,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
11027,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
10633,
2974,
29889,
510,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
6055,
29889,
17816,
2965,
29918,
4219,
29892,
8207,
15033,
29914,
262,
29914,
11027,
29889,
15135,
29880,
29914,
1609,
29914,
29881,
18477,
5527,
29914,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
12801,
25711,
17013,
29958,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
657,
877,
25711,
17013,
5477,
12801,
25711,
17013,
29958,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
411,
6055,
29889,
4746,
29918,
6272,
877,
25431,
29374,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
3359,
2974,
29889,
510,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
7700,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
10633,
2974,
29889,
510,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
12801,
25711,
17013,
29958,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
411,
6055,
29889,
4746,
29918,
6272,
877,
303,
6751,
29374,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
303,
6751,
2974,
29889,
510,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
7700,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
10633,
2974,
29889,
510,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
12801,
25711,
17013,
29958,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
411,
6055,
29889,
4746,
29918,
6272,
877,
6341,
6272,
29374,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
6341,
2974,
29889,
510,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
7700,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
18603,
29892,
525,
10633,
2974,
29889,
510,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
25711,
17013,
29892,
12801,
25711,
17013,
29958,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
11889,
5813,
29892,
525,
6406,
29918,
1792,
29918,
3166,
29918,
6272,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11027,
29889,
5800,
29949,
29892,
525,
3112,
975,
24040,
1432,
916,
8829,
1495,
13,
2
] |
app/workers/main.py | brotskydotcom/public-services.py | 0 | 114657 | # MIT License
#
# Copyright (c) 2020 <NAME>
#
# 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.
# MIT License
#
#
# 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 asyncio
import os
from random import uniform
from typing import List, ClassVar
from .csv_transfer import process_csv_lists
from .webhook_transfer import process_webhook_lists
from ..base import prinl, log_error
from ..db import ItemListStore
from ..utils import MapContext
async def worker(item_type: str):
"""
The main worker loop. This is meant to be run as a task,
either in the web process or a separate worker process.
It only processes items of the given type, so if you
want to process both types in one worker you will need
to run one of these tasks for each type of worker.
You have to do MapContext and ItemListStore initialization
and teardown around your call to this function.
"""
if item_type not in ("webhook", "csv"):
raise ValueError(f"Worker item type ({item_type}) must be 'webhook' or 'csv'")
try:
while True:
if item_type == "webhook":
await process_webhook_lists()
else:
await process_csv_lists()
prinl(f"Waiting for new {item_type} items to arrive...")
key = await ItemListStore.select_from_channel(item_type)
if key:
prinl(f"New incoming {item_type} item list: {key}")
else:
# this happens on shutdown, so we do a silent exit
break
# minimize conflict between multiple workers with random stagger
await asyncio.sleep(uniform(0.1, 0.9))
except asyncio.CancelledError:
prinl(f"Cancelled: {item_type} worker.")
raise
async def app(item_types: List[str]):
"""
The main worker app, run as the only task in a process.
Spawns tasks for each worker type and waits for them.
"""
MapContext.initialize()
await ItemListStore.initialize()
try:
await EmbeddedWorkers.start(item_types)
await EmbeddedWorkers.run()
except asyncio.CancelledError:
raise
except:
log_error(f"Exception in worker")
await EmbeddedWorkers.stop()
finally:
await ItemListStore.finalize()
MapContext.finalize()
class EmbeddedWorkers:
"""
A way of using _workers as tasks, rather than as
a top-level process, so they can be embedded in
a web server or other async process.
"""
_item_types: ClassVar[List[str]] = []
_workers: ClassVar[List[asyncio.Task]] = []
@classmethod
async def _cancel_workers(cls):
"""
Forcibly cancel any running worker tasks.
"""
for item_type, task in zip(cls._item_types, cls._workers):
if task.done():
continue
try:
task.cancel()
await task
except asyncio.CancelledError:
pass
except:
log_error(f"Failure: {item_type} worker")
@classmethod
async def _main(cls):
"""
Run _workers as sub-tasks. We assume all the
initialization, teardown, and error handling
is done by our embedding process or the worker itself.
"""
try:
for item_type in cls._item_types:
prinl(f"Starting {item_type} worker.")
cls._workers.append(asyncio.create_task(worker(item_type)))
except asyncio.CancelledError:
await cls._cancel_workers()
raise
except:
log_error(f"Exception in worker manager")
await cls._cancel_workers()
raise
@classmethod
async def start(cls, item_types: List[str] = None):
"""
Starts embedded worker tasks for each of the given item types.
If not item types are given, we check the OS environment variable
EMBEDDED_WEBHOOK_TYPES and, if it's non-empty, we treat it as a
list of item types separated by ':'
No workers are started if the resulting list of item types is empty.
"""
if cls._workers:
raise NotImplementedError("Embedded workers are already started")
if not item_types:
if types := os.getenv("EMBEDDED_WORKER_TYPES", ""):
item_types = types.split(":")
if not item_types:
return
cls._item_types = item_types
cls._workers = []
await cls._main()
@classmethod
async def run(cls, ignore_exceptions=False):
"""
Wait for currently running workers to complete.
If ignore_exceptions is specified, an exception
in one of the workers will not be raised to the caller.
"""
await asyncio.gather(*cls._workers, return_exceptions=ignore_exceptions)
@classmethod
async def stop(cls):
"""
Shuts down any running workers.
"""
if cls._workers:
await cls._cancel_workers()
cls._workers = []
| [
1,
396,
29871,
341,
1806,
19245,
13,
29937,
13,
29937,
29871,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29900,
529,
5813,
29958,
13,
29937,
13,
29937,
29871,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
29871,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
29871,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
29871,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
29871,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
29871,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
29871,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
29871,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
7791,
7818,
12982,
1525,
29889,
13,
13,
29937,
29871,
341,
1806,
19245,
13,
29937,
13,
29937,
13,
29937,
29871,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
29871,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
29871,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
29871,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
29871,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
29871,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
29871,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
29871,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
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,
29871,
7791,
7818,
12982,
1525,
29889,
13,
5215,
408,
948,
3934,
13,
5215,
2897,
13,
3166,
4036,
1053,
9090,
13,
3166,
19229,
1053,
2391,
29892,
4134,
9037,
13,
13,
3166,
869,
7638,
29918,
3286,
571,
1053,
1889,
29918,
7638,
29918,
21513,
13,
3166,
869,
2676,
20849,
29918,
3286,
571,
1053,
1889,
29918,
2676,
20849,
29918,
21513,
13,
3166,
6317,
3188,
1053,
12456,
29880,
29892,
1480,
29918,
2704,
13,
3166,
6317,
2585,
1053,
10976,
1293,
9044,
13,
3166,
6317,
13239,
1053,
7315,
2677,
13,
13,
13,
12674,
822,
15645,
29898,
667,
29918,
1853,
29901,
851,
1125,
13,
1678,
9995,
13,
1678,
450,
1667,
15645,
2425,
29889,
29871,
910,
338,
6839,
304,
367,
1065,
408,
263,
3414,
29892,
13,
1678,
2845,
297,
278,
1856,
1889,
470,
263,
5004,
15645,
1889,
29889,
13,
1678,
739,
871,
10174,
4452,
310,
278,
2183,
1134,
29892,
577,
565,
366,
13,
1678,
864,
304,
1889,
1716,
4072,
297,
697,
15645,
366,
674,
817,
13,
1678,
304,
1065,
697,
310,
1438,
9595,
363,
1269,
1134,
310,
15645,
29889,
13,
13,
1678,
887,
505,
304,
437,
7315,
2677,
322,
10976,
1293,
9044,
17865,
13,
1678,
322,
734,
538,
776,
2820,
596,
1246,
304,
445,
740,
29889,
13,
1678,
9995,
13,
1678,
565,
2944,
29918,
1853,
451,
297,
4852,
2676,
20849,
613,
376,
7638,
29908,
1125,
13,
4706,
12020,
7865,
2392,
29898,
29888,
29908,
16164,
2944,
1134,
21313,
667,
29918,
1853,
1800,
1818,
367,
525,
2676,
20849,
29915,
470,
525,
7638,
29915,
1159,
13,
1678,
1018,
29901,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
2944,
29918,
1853,
1275,
376,
2676,
20849,
1115,
13,
18884,
7272,
1889,
29918,
2676,
20849,
29918,
21513,
580,
13,
9651,
1683,
29901,
13,
18884,
7272,
1889,
29918,
7638,
29918,
21513,
580,
13,
9651,
12456,
29880,
29898,
29888,
29908,
15716,
292,
363,
716,
426,
667,
29918,
1853,
29913,
4452,
304,
18331,
856,
1159,
13,
9651,
1820,
353,
7272,
10976,
1293,
9044,
29889,
2622,
29918,
3166,
29918,
12719,
29898,
667,
29918,
1853,
29897,
13,
9651,
565,
1820,
29901,
13,
18884,
12456,
29880,
29898,
29888,
29908,
4373,
23235,
426,
667,
29918,
1853,
29913,
2944,
1051,
29901,
426,
1989,
27195,
13,
9651,
1683,
29901,
13,
18884,
396,
445,
5930,
373,
12522,
3204,
29892,
577,
591,
437,
263,
17436,
6876,
13,
18884,
2867,
13,
9651,
396,
6260,
675,
14529,
1546,
2999,
17162,
411,
4036,
380,
9921,
13,
9651,
7272,
408,
948,
3934,
29889,
17059,
29898,
29590,
29898,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29929,
876,
13,
1678,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
4706,
12456,
29880,
29898,
29888,
29908,
19420,
839,
29901,
426,
667,
29918,
1853,
29913,
15645,
23157,
13,
4706,
12020,
13,
13,
13,
12674,
822,
623,
29898,
667,
29918,
8768,
29901,
2391,
29961,
710,
29962,
1125,
13,
1678,
9995,
13,
1678,
450,
1667,
15645,
623,
29892,
1065,
408,
278,
871,
3414,
297,
263,
1889,
29889,
13,
1678,
1706,
18101,
29879,
9595,
363,
1269,
15645,
1134,
322,
11324,
1169,
363,
963,
29889,
13,
1678,
9995,
13,
1678,
7315,
2677,
29889,
24926,
580,
13,
1678,
7272,
10976,
1293,
9044,
29889,
24926,
580,
13,
1678,
1018,
29901,
13,
4706,
7272,
2812,
2580,
7176,
5531,
414,
29889,
2962,
29898,
667,
29918,
8768,
29897,
13,
4706,
7272,
2812,
2580,
7176,
5531,
414,
29889,
3389,
580,
13,
1678,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
4706,
12020,
13,
1678,
5174,
29901,
13,
4706,
1480,
29918,
2704,
29898,
29888,
29908,
2451,
297,
15645,
1159,
13,
4706,
7272,
2812,
2580,
7176,
5531,
414,
29889,
9847,
580,
13,
1678,
7146,
29901,
13,
4706,
7272,
10976,
1293,
9044,
29889,
8394,
675,
580,
13,
4706,
7315,
2677,
29889,
8394,
675,
580,
13,
13,
13,
1990,
2812,
2580,
7176,
5531,
414,
29901,
13,
1678,
9995,
13,
1678,
319,
982,
310,
773,
903,
1287,
414,
408,
9595,
29892,
3265,
1135,
408,
13,
1678,
263,
2246,
29899,
5563,
1889,
29892,
577,
896,
508,
367,
15685,
297,
13,
1678,
263,
1856,
1923,
470,
916,
7465,
1889,
29889,
13,
1678,
9995,
13,
13,
1678,
903,
667,
29918,
8768,
29901,
4134,
9037,
29961,
1293,
29961,
710,
5262,
353,
5159,
13,
1678,
903,
1287,
414,
29901,
4134,
9037,
29961,
1293,
29961,
294,
948,
3934,
29889,
5398,
5262,
353,
5159,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
903,
20713,
29918,
1287,
414,
29898,
25932,
1125,
13,
4706,
9995,
13,
4706,
1152,
455,
29890,
368,
12611,
738,
2734,
15645,
9595,
29889,
13,
4706,
9995,
13,
4706,
363,
2944,
29918,
1853,
29892,
3414,
297,
14319,
29898,
25932,
3032,
667,
29918,
8768,
29892,
1067,
29879,
3032,
1287,
414,
1125,
13,
9651,
565,
3414,
29889,
15091,
7295,
13,
18884,
6773,
13,
9651,
1018,
29901,
13,
18884,
3414,
29889,
20713,
580,
13,
18884,
7272,
3414,
13,
9651,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
18884,
1209,
13,
9651,
5174,
29901,
13,
18884,
1480,
29918,
2704,
29898,
29888,
29908,
24155,
29901,
426,
667,
29918,
1853,
29913,
15645,
1159,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
903,
3396,
29898,
25932,
1125,
13,
4706,
9995,
13,
4706,
7525,
903,
1287,
414,
408,
1014,
29899,
20673,
29889,
29871,
1334,
5251,
599,
278,
13,
4706,
17865,
29892,
734,
538,
776,
29892,
322,
1059,
11415,
13,
4706,
338,
2309,
491,
1749,
23655,
1889,
470,
278,
15645,
3528,
29889,
13,
4706,
9995,
13,
4706,
1018,
29901,
13,
9651,
363,
2944,
29918,
1853,
297,
1067,
29879,
3032,
667,
29918,
8768,
29901,
13,
18884,
12456,
29880,
29898,
29888,
29908,
4763,
292,
426,
667,
29918,
1853,
29913,
15645,
23157,
13,
18884,
1067,
29879,
3032,
1287,
414,
29889,
4397,
29898,
294,
948,
3934,
29889,
3258,
29918,
7662,
29898,
24602,
29898,
667,
29918,
1853,
4961,
13,
4706,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
9651,
7272,
1067,
29879,
3032,
20713,
29918,
1287,
414,
580,
13,
9651,
12020,
13,
4706,
5174,
29901,
13,
9651,
1480,
29918,
2704,
29898,
29888,
29908,
2451,
297,
15645,
8455,
1159,
13,
9651,
7272,
1067,
29879,
3032,
20713,
29918,
1287,
414,
580,
13,
9651,
12020,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
1369,
29898,
25932,
29892,
2944,
29918,
8768,
29901,
2391,
29961,
710,
29962,
353,
6213,
1125,
13,
4706,
9995,
13,
4706,
624,
5708,
15685,
15645,
9595,
363,
1269,
310,
278,
2183,
2944,
4072,
29889,
13,
4706,
960,
451,
2944,
4072,
526,
2183,
29892,
591,
1423,
278,
6570,
5177,
2286,
13,
4706,
382,
9486,
3352,
2287,
29928,
29918,
8851,
29933,
8187,
8949,
29918,
15631,
29925,
2890,
322,
29892,
565,
372,
29915,
29879,
1661,
29899,
6310,
29892,
591,
7539,
372,
408,
263,
13,
4706,
1051,
310,
2944,
4072,
13055,
491,
525,
11283,
13,
13,
4706,
1939,
17162,
526,
4687,
565,
278,
9819,
1051,
310,
2944,
4072,
338,
4069,
29889,
13,
4706,
9995,
13,
4706,
565,
1067,
29879,
3032,
1287,
414,
29901,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
703,
6026,
2580,
7176,
17162,
526,
2307,
4687,
1159,
13,
4706,
565,
451,
2944,
29918,
8768,
29901,
13,
9651,
565,
4072,
3490,
2897,
29889,
657,
6272,
703,
29923,
9486,
3352,
2287,
29928,
29918,
11686,
29968,
1001,
29918,
15631,
29925,
2890,
613,
5124,
1125,
13,
18884,
2944,
29918,
8768,
353,
4072,
29889,
5451,
703,
29901,
1159,
13,
4706,
565,
451,
2944,
29918,
8768,
29901,
13,
9651,
736,
13,
4706,
1067,
29879,
3032,
667,
29918,
8768,
353,
2944,
29918,
8768,
13,
4706,
1067,
29879,
3032,
1287,
414,
353,
5159,
13,
4706,
7272,
1067,
29879,
3032,
3396,
580,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
1065,
29898,
25932,
29892,
11455,
29918,
11739,
29879,
29922,
8824,
1125,
13,
4706,
9995,
13,
4706,
20340,
363,
5279,
2734,
17162,
304,
4866,
29889,
13,
13,
4706,
960,
11455,
29918,
11739,
29879,
338,
6790,
29892,
385,
3682,
13,
4706,
297,
697,
310,
278,
17162,
674,
451,
367,
10425,
304,
278,
24959,
29889,
13,
4706,
9995,
13,
4706,
7272,
408,
948,
3934,
29889,
29887,
1624,
10456,
25932,
3032,
1287,
414,
29892,
736,
29918,
11739,
29879,
29922,
17281,
29918,
11739,
29879,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
5040,
29898,
25932,
1125,
13,
4706,
9995,
13,
4706,
1383,
8842,
1623,
738,
2734,
17162,
29889,
13,
4706,
9995,
13,
4706,
565,
1067,
29879,
3032,
1287,
414,
29901,
13,
9651,
7272,
1067,
29879,
3032,
20713,
29918,
1287,
414,
580,
13,
4706,
1067,
29879,
3032,
1287,
414,
353,
5159,
13,
2
] |
eth_tester/normalization/common.py | PabloLefort/eth-tester | 215 | 12080 | from cytoolz.functoolz import (
curry,
)
from eth_utils import (
to_dict,
to_tuple,
)
@curry
@to_dict
def normalize_dict(value, normalizers):
for key, item in value.items():
normalizer = normalizers[key]
yield key, normalizer(item)
@curry
@to_tuple
def normalize_array(value, normalizer):
"""
This is just `map` but it's nice to have it return a consisten type
(tuple).
"""
for item in value:
yield normalizer(item)
@curry
def normalize_if(value, conditional_fn, normalizer):
if conditional_fn(value):
return normalizer(value)
else:
return value
| [
1,
515,
5094,
10154,
29920,
29889,
7692,
312,
1507,
29920,
1053,
313,
13,
1678,
3151,
719,
29892,
13,
29897,
13,
13,
3166,
11314,
29918,
13239,
1053,
313,
13,
1678,
304,
29918,
8977,
29892,
13,
1678,
304,
29918,
23583,
29892,
13,
29897,
13,
13,
13,
29992,
2764,
719,
13,
29992,
517,
29918,
8977,
13,
1753,
4226,
675,
29918,
8977,
29898,
1767,
29892,
4226,
19427,
1125,
13,
1678,
363,
1820,
29892,
2944,
297,
995,
29889,
7076,
7295,
13,
4706,
4226,
3950,
353,
4226,
19427,
29961,
1989,
29962,
13,
4706,
7709,
1820,
29892,
4226,
3950,
29898,
667,
29897,
13,
13,
13,
29992,
2764,
719,
13,
29992,
517,
29918,
23583,
13,
1753,
4226,
675,
29918,
2378,
29898,
1767,
29892,
4226,
3950,
1125,
13,
1678,
9995,
13,
1678,
910,
338,
925,
421,
1958,
29952,
541,
372,
29915,
29879,
7575,
304,
505,
372,
736,
263,
5718,
264,
1134,
13,
1678,
313,
23583,
467,
13,
1678,
9995,
13,
1678,
363,
2944,
297,
995,
29901,
13,
4706,
7709,
4226,
3950,
29898,
667,
29897,
13,
13,
13,
29992,
2764,
719,
13,
1753,
4226,
675,
29918,
361,
29898,
1767,
29892,
15047,
29918,
9144,
29892,
4226,
3950,
1125,
13,
1678,
565,
15047,
29918,
9144,
29898,
1767,
1125,
13,
4706,
736,
4226,
3950,
29898,
1767,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
995,
13,
2
] |
bubble_sort.py | rogueleaderr/import_madness | 2 | 1614496 | import time
__author__ = 'rogueleaderr'
def bubble_sort(list_to_sort):
start_time = time.time()
while True:
list_len = len(list_to_sort)
max_index = (list_len - 1)
swaps = 0
for i in range(list_len):
j = i + 1
if j > max_index:
break
if list_to_sort[i] > list_to_sort[j]:
list_to_sort[j], list_to_sort[i] = list_to_sort[i], list_to_sort[j]
swaps += 1
if swaps == 0:
break
finished_time = time.time()
print("Sort took {}".format(finished_time - start_time))
return list_to_sort
| [
1,
1053,
931,
13,
13,
1649,
8921,
1649,
353,
525,
9102,
434,
280,
1664,
29878,
29915,
13,
13,
13,
1753,
289,
23232,
29918,
6605,
29898,
1761,
29918,
517,
29918,
6605,
1125,
13,
1678,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
13,
1678,
1550,
5852,
29901,
13,
4706,
1051,
29918,
2435,
353,
7431,
29898,
1761,
29918,
517,
29918,
6605,
29897,
13,
4706,
4236,
29918,
2248,
353,
313,
1761,
29918,
2435,
448,
29871,
29896,
29897,
13,
4706,
2381,
2547,
353,
29871,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
1761,
29918,
2435,
1125,
13,
9651,
432,
353,
474,
718,
29871,
29896,
13,
9651,
565,
432,
1405,
4236,
29918,
2248,
29901,
13,
18884,
2867,
13,
9651,
565,
1051,
29918,
517,
29918,
6605,
29961,
29875,
29962,
1405,
1051,
29918,
517,
29918,
6605,
29961,
29926,
5387,
13,
18884,
1051,
29918,
517,
29918,
6605,
29961,
29926,
1402,
1051,
29918,
517,
29918,
6605,
29961,
29875,
29962,
353,
1051,
29918,
517,
29918,
6605,
29961,
29875,
1402,
1051,
29918,
517,
29918,
6605,
29961,
29926,
29962,
13,
18884,
2381,
2547,
4619,
29871,
29896,
13,
4706,
565,
2381,
2547,
1275,
29871,
29900,
29901,
13,
9651,
2867,
13,
13,
1678,
7743,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
1596,
703,
13685,
3614,
6571,
1642,
4830,
29898,
4951,
3276,
29918,
2230,
448,
1369,
29918,
2230,
876,
13,
1678,
736,
1051,
29918,
517,
29918,
6605,
13,
2
] |
DQM/L1TMonitorClient/python/L1TOccupancyClient_cff.py | ckamtsikis/cmssw | 852 | 1605203 | import FWCore.ParameterSet.Config as cms
from DQM.L1TMonitorClient.L1TOccupancyClient_cfi import *
| [
1,
1053,
383,
29956,
9203,
29889,
9329,
2697,
29889,
3991,
408,
274,
1516,
13,
13,
3166,
360,
29984,
29924,
29889,
29931,
29896,
29911,
7185,
2105,
4032,
29889,
29931,
29896,
4986,
617,
786,
6906,
4032,
29918,
6854,
29875,
1053,
334,
13,
2
] |
portfolio/gui/tabresults/righttable.py | timeerr/portfolio | 0 | 8509 | <filename>portfolio/gui/tabresults/righttable.py
#!/usr/bin/python3
from datetime import datetime
from PyQt5.QtWidgets import QTableWidgetItem, QTableWidget, QAbstractItemView, QMenu, QMessageBox
from PyQt5.QtGui import QCursor
from PyQt5.QtCore import Qt, pyqtSignal, QObject
from portfolio.db.fdbhandler import results, strategies, balances
def updatingdata(func):
"""
Decorator to flag self.updatingdata_flag whenever a function
that edits data without user intervention is being run
"""
def wrapper(self, *args, **kwargs):
self.updatingdata_flag = True
func(self, *args, **kwargs)
self.updatingdata_flag = False
return wrapper
class RightTable(QTableWidget):
"""
Table dynamically showing results
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Custom Menu
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.showMenu)
# A signal that will be emited whenever a line is removed
self.lineremoved = LineRemoved()
# UI Tweaks
self.verticalHeader().hide()
self.setSortingEnabled(True)
self.setHorizontalHeaderLabels(
["id", self.tr("Date"), self.tr("Account"), self.tr("Strategy"), self.tr("Amount")])
# When edited, change the data on the database too
self.cellChanged.connect(self.changeCellOnDatabase)
# A flag to prevent changeCellOnDatabase execution when needed
self.updatingdata_flag = True
# Initialization: show all transactions
self.setData(datetime(1980, 1, 1), datetime.today(), "All", "All")
@updatingdata
def setData(self, startdate, enddate, strategy, account):
"""
Asks the database for results data within certain parameters,
then shows that data on the table
"""
# Clear table
self.clear()
self.setHorizontalHeaderLabels(
["id", self.tr("Date"), self.tr("Account"), self.tr("Strategy"), self.tr("Amount"), self.tr("Description")])
# Get desired data from db
results_to_show = results.get_results_from_query(
start_date=startdate, end_date=enddate, strategy=strategy, account=account)
# If the data is empty, we are done
if len(results_to_show) == 0:
self.setRowCount(0)
return
# Resize table
self.setRowCount(len(results_to_show))
self.setColumnCount(len(results_to_show[0]))
# Change content
for rownum, row in enumerate(results_to_show):
for colnum, data in enumerate(row):
item = QTableWidgetItem() # Item that will be inserted
if colnum == 0:
# Ids can't be editable
item.setFlags(Qt.ItemIsSelectable)
elif colnum == 1:
# Change format to display date better
data = datetime.fromtimestamp(data).strftime("%d-%m-%Y")
# Data is now formatted, we can write it on table
item.setData(0, data)
self.setItem(rownum, colnum, item)
def showMenu(self, event):
"""
Custom Menu to show when an item is right-clicked
Options:
- Remove Line: removes line from table and database
"""
menu = QMenu()
# Actions
remove_action = menu.addAction(self.tr("Remove Line"))
# Getting action selected by user
action = menu.exec_(QCursor.pos())
# Act accordingly
if action == remove_action:
self.removeSelection()
self.lineremoved.lineRemoved.emit()
@updatingdata
def removeSelection(self):
"""
Removes the entire row of every selected item,
and then does the same on the databse
"""
# Getting selected indexes, and their corresponding ids
# from the database
selected_indexes_table, selected_ids = [], []
for index in self.selectedIndexes():
index = index.row() # Row number
if index not in selected_indexes_table: # Avoid duplicates
selected_indexes_table.append(index)
selected_ids.append(int(self.item(index, 0).text()))
# Removing the rows from the table and the database
for index, id_db in zip(selected_indexes_table, selected_ids):
results.delete_result(id_db)
self.removeRow(index)
print("Removed rows with ids on db : ", selected_ids,
"\n & ids on table: ", selected_indexes_table)
def changeCellOnDatabase(self, row, column):
"""
When a Table Item is edited by the user,
we want to check if it fits the type
and edit it on the database too
"""
if self.updatingdata_flag is True:
return
# The data is being modified internally (not by the user)
# so no errors assumed
new_item = self.item(row, column)
new_item_data = new_item.text()
database_entry_id = self.item(row, 0).text()
previous_amount = results.getResultAmountById(
database_entry_id) # Useful for balance adjustments later
columnselected_name = self.horizontalHeaderItem(column).text()
# Depending on from which column the item is, we check the data
# proposed differently
# Check which part of the transaction has been edited, and accting accordingly
# -------------- id --------------------
if columnselected_name == self.tr("Id"):
# Ids can't be edited
error_mssg = QMessageBox()
error_mssg.setIcon(QMessageBox.Warning)
error_mssg.setText(self.tr("Ids can't be edited"))
error_mssg.exec_()
# -------------- Date --------------------
elif columnselected_name == self.tr("Date"):
# The new text has to be a date
try:
new_date = datetime.strptime(new_item_data, "%d-%m-%Y")
results.update_result(
database_entry_id, new_date=new_date.timestamp())
except ValueError:
error_mssg = QMessageBox()
error_mssg.setIcon(QMessageBox.Warning)
error_mssg.setText(
self.tr("Has to be a date in format dd-mm-yyyy"))
error_mssg.exec_()
# Reset date to previous one
previous_date_timestamp = results.get_result_date_by_id(
database_entry_id)
previous_date_text = datetime.fromtimestamp(
previous_date_timestamp).strftime("%d-%m-%Y")
self.updatingdata_flag = True
new_item.setData(0, previous_date_text)
self.updatingdata_flag = False
# -------------- Account --------------------
elif columnselected_name == self.tr("Account"):
# The account has to be an existing one
all_accounts = [a[0] for a in balances.get_all_accounts()]
previous_account = results.get_result_account_by_id(
database_entry_id)
if new_item_data not in all_accounts:
error_mssg = QMessageBox()
error_mssg.setIcon(QMessageBox.Warning)
error_mssg.setText(
self.tr("The account has to be an existing one. \nAdd it first manually"))
error_mssg.exec_()
# Reset strategy to previous one
self.updatingdata_flag = True
new_item.setData(0, previous_account)
self.updatingdata_flag = False
else:
# The data is good
# Change the result on the results table on the db
results.update_result(
database_entry_id, new_account=new_item_data)
# Update the balance of the two accounts involved,
# according to the result amount
balances.update_balances_with_new_result(
previous_account, - previous_amount)
balances.update_balances_with_new_result(
new_item_data, previous_amount)
# -------------- Strategy --------------------
elif columnselected_name == self.tr("Strategy"):
# The strategy has to be an existing one
previous_strategy = results.get_result_strategy_by_id(
database_entry_id)
all_strategies = [s[0] for s in strategies.get_all_strategies()]
if new_item_data not in all_strategies:
error_mssg = QMessageBox()
error_mssg.setIcon(QMessageBox.Warning)
error_mssg.setText(
self.tr("The strategy has to be an existing one. \nAdd it first manually"))
error_mssg.exec_()
# Reset strategy to previous one
self.updatingdata_flag = True
new_item.setData(0, previous_strategy)
self.updatingdata_flag = False
else:
# The data is good
# Change the result on the results table of the db
results.updateResult(
database_entry_id, newstrategy=new_item_data)
# Update the pnl of the two strategies involved,
# according to the result amount
strategies.update_strategies_with_new_result(
previous_strategy, - previous_amount)
strategies.update_strategies_with_new_result(
new_item_data, previous_amount)
# -------------- Amount --------------------
elif columnselected_name == self.tr("Amount"):
# The amount has to be an integer
try:
new_item_data = int(new_item_data)
# Change the result on the results table of the db
results.update_result(
database_entry_id, new_amount=new_item_data)
# Update the balances and strategies with the difference
# between the old and the new result
diff_betweeen_results = new_item_data - previous_amount
account_involved = results.get_result_account_by_id(
database_entry_id)
strategy_involved = results.get_result_strategy_by_id(
database_entry_id)
balances.update_balances_with_new_result(
account_involved, diff_betweeen_results)
strategies.update_strategies_with_new_result(
strategy_involved, diff_betweeen_results)
except Exception:
error_mssg = QMessageBox()
error_mssg.setIcon(QMessageBox.Warning)
error_mssg.setText(
self.tr("Has to be an integer"))
error_mssg.exec_()
# Reset to previous amount
previous_amount = results.get_result_amount_by_id(
database_entry_id)
self.updatingdata_flag = True
new_item.setData(0, previous_amount)
self.updatingdata_flag = False
# -------------- Description --------------------
elif columnselected_name == self.tr("Description"):
# A description can be any data. So no checks
results.update_result(
database_entry_id, new_description=new_item_data)
class LineRemoved(QObject):
lineRemoved = pyqtSignal()
| [
1,
529,
9507,
29958,
637,
25648,
29914,
23569,
29914,
3891,
9902,
29914,
1266,
2371,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
29941,
13,
13,
3166,
12865,
1053,
12865,
13,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
3562,
8801,
2001,
29892,
660,
3562,
8801,
29892,
660,
9118,
2001,
1043,
29892,
660,
6823,
29892,
660,
3728,
3313,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
660,
19890,
13,
3166,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
14705,
29892,
11451,
17915,
10140,
284,
29892,
660,
2061,
13,
13,
3166,
2011,
25648,
29889,
2585,
29889,
29888,
2585,
13789,
1053,
2582,
29892,
16650,
583,
29892,
6411,
2925,
13,
13,
13,
1753,
13271,
1272,
29898,
9891,
1125,
13,
1678,
9995,
13,
1678,
3826,
272,
1061,
304,
7353,
1583,
29889,
786,
26747,
1272,
29918,
15581,
10940,
263,
740,
13,
1678,
393,
1226,
1169,
848,
1728,
1404,
1006,
7316,
338,
1641,
1065,
13,
1678,
9995,
13,
13,
1678,
822,
14476,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
4706,
3653,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
7700,
13,
1678,
736,
14476,
13,
13,
13,
1990,
10428,
3562,
29898,
29984,
3562,
8801,
1125,
13,
1678,
9995,
13,
1678,
6137,
11200,
6445,
2582,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
396,
8701,
20019,
13,
4706,
1583,
29889,
842,
2677,
6823,
15644,
29898,
17303,
29889,
7281,
2677,
6823,
29897,
13,
4706,
1583,
29889,
6341,
2677,
6823,
3089,
287,
29889,
6915,
29898,
1311,
29889,
4294,
6823,
29897,
13,
4706,
396,
319,
7182,
393,
674,
367,
953,
1573,
10940,
263,
1196,
338,
6206,
13,
4706,
1583,
29889,
1915,
14992,
8238,
353,
7407,
7301,
8238,
580,
13,
13,
4706,
396,
3740,
27637,
10327,
13,
4706,
1583,
29889,
18575,
7850,
2141,
11458,
580,
13,
4706,
1583,
29889,
842,
13685,
292,
10861,
29898,
5574,
29897,
13,
13,
4706,
1583,
29889,
842,
24932,
7850,
4775,
29879,
29898,
13,
9651,
6796,
333,
613,
1583,
29889,
509,
703,
2539,
4968,
1583,
29889,
509,
703,
10601,
4968,
1583,
29889,
509,
703,
26910,
4968,
1583,
29889,
509,
703,
18087,
1159,
2314,
13,
13,
4706,
396,
1932,
8788,
29892,
1735,
278,
848,
373,
278,
2566,
2086,
13,
4706,
1583,
29889,
3729,
7590,
29889,
6915,
29898,
1311,
29889,
3167,
4617,
2951,
9112,
29897,
13,
13,
4706,
396,
319,
7353,
304,
5557,
1735,
4617,
2951,
9112,
8225,
746,
4312,
13,
4706,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
13,
4706,
396,
17250,
2133,
29901,
1510,
599,
22160,
13,
4706,
1583,
29889,
842,
1469,
29898,
12673,
29898,
29896,
29929,
29947,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
511,
12865,
29889,
27765,
3285,
376,
3596,
613,
376,
3596,
1159,
13,
13,
1678,
732,
786,
26747,
1272,
13,
1678,
822,
731,
1469,
29898,
1311,
29892,
1369,
1256,
29892,
1095,
1256,
29892,
13705,
29892,
3633,
1125,
13,
4706,
9995,
13,
4706,
26579,
29879,
278,
2566,
363,
2582,
848,
2629,
3058,
4128,
29892,
13,
4706,
769,
3697,
393,
848,
373,
278,
1591,
13,
4706,
9995,
13,
4706,
396,
17732,
1591,
13,
4706,
1583,
29889,
8551,
580,
13,
4706,
1583,
29889,
842,
24932,
7850,
4775,
29879,
29898,
13,
9651,
6796,
333,
613,
1583,
29889,
509,
703,
2539,
4968,
1583,
29889,
509,
703,
10601,
4968,
1583,
29889,
509,
703,
26910,
4968,
1583,
29889,
509,
703,
18087,
4968,
1583,
29889,
509,
703,
9868,
1159,
2314,
13,
13,
4706,
396,
3617,
7429,
848,
515,
4833,
13,
4706,
2582,
29918,
517,
29918,
4294,
353,
2582,
29889,
657,
29918,
9902,
29918,
3166,
29918,
1972,
29898,
13,
9651,
1369,
29918,
1256,
29922,
2962,
1256,
29892,
1095,
29918,
1256,
29922,
355,
1256,
29892,
13705,
29922,
710,
8963,
29892,
3633,
29922,
10149,
29897,
13,
13,
4706,
396,
960,
278,
848,
338,
4069,
29892,
591,
526,
2309,
13,
4706,
565,
7431,
29898,
9902,
29918,
517,
29918,
4294,
29897,
1275,
29871,
29900,
29901,
13,
9651,
1583,
29889,
842,
4301,
3981,
29898,
29900,
29897,
13,
9651,
736,
13,
13,
4706,
396,
2538,
675,
1591,
13,
4706,
1583,
29889,
842,
4301,
3981,
29898,
2435,
29898,
9902,
29918,
517,
29918,
4294,
876,
13,
4706,
1583,
29889,
842,
4409,
3981,
29898,
2435,
29898,
9902,
29918,
517,
29918,
4294,
29961,
29900,
12622,
13,
13,
4706,
396,
10726,
2793,
13,
4706,
363,
696,
1233,
398,
29892,
1948,
297,
26985,
29898,
9902,
29918,
517,
29918,
4294,
1125,
13,
9651,
363,
784,
1949,
29892,
848,
297,
26985,
29898,
798,
1125,
13,
18884,
2944,
353,
660,
3562,
8801,
2001,
580,
29871,
396,
10976,
393,
674,
367,
15478,
13,
13,
18884,
565,
784,
1949,
1275,
29871,
29900,
29901,
13,
462,
1678,
396,
5163,
29879,
508,
29915,
29873,
367,
3863,
519,
13,
462,
1678,
2944,
29889,
842,
15675,
29898,
17303,
29889,
2001,
3624,
3549,
519,
29897,
13,
18884,
25342,
784,
1949,
1275,
29871,
29896,
29901,
13,
462,
1678,
396,
10726,
3402,
304,
2479,
2635,
2253,
13,
462,
1678,
848,
353,
12865,
29889,
3166,
16394,
29898,
1272,
467,
710,
615,
603,
11702,
29881,
19222,
29885,
19222,
29979,
1159,
13,
13,
18884,
396,
3630,
338,
1286,
20917,
29892,
591,
508,
2436,
372,
373,
1591,
13,
18884,
2944,
29889,
842,
1469,
29898,
29900,
29892,
848,
29897,
13,
18884,
1583,
29889,
842,
2001,
29898,
798,
1949,
29892,
784,
1949,
29892,
2944,
29897,
13,
13,
1678,
822,
1510,
6823,
29898,
1311,
29892,
1741,
1125,
13,
4706,
9995,
13,
4706,
8701,
20019,
304,
1510,
746,
385,
2944,
338,
1492,
29899,
3808,
287,
13,
13,
4706,
25186,
29901,
13,
4706,
448,
15154,
7407,
29901,
25388,
1196,
515,
1591,
322,
2566,
13,
4706,
9995,
13,
4706,
6143,
353,
660,
6823,
580,
13,
13,
4706,
396,
319,
1953,
13,
4706,
3349,
29918,
2467,
353,
6143,
29889,
1202,
4276,
29898,
1311,
29889,
509,
703,
15941,
7407,
5783,
13,
13,
4706,
396,
24162,
3158,
4629,
491,
1404,
13,
4706,
3158,
353,
6143,
29889,
4258,
23538,
29984,
19890,
29889,
1066,
3101,
13,
13,
4706,
396,
3185,
16205,
13,
4706,
565,
3158,
1275,
3349,
29918,
2467,
29901,
13,
9651,
1583,
29889,
5992,
15097,
580,
13,
9651,
1583,
29889,
1915,
14992,
8238,
29889,
1220,
7301,
8238,
29889,
21976,
580,
13,
13,
1678,
732,
786,
26747,
1272,
13,
1678,
822,
3349,
15097,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
5240,
586,
267,
278,
4152,
1948,
310,
1432,
4629,
2944,
29892,
13,
4706,
322,
769,
947,
278,
1021,
373,
278,
16236,
344,
13,
4706,
9995,
13,
13,
4706,
396,
24162,
4629,
18111,
29892,
322,
1009,
6590,
18999,
13,
4706,
396,
515,
278,
2566,
13,
4706,
4629,
29918,
2248,
267,
29918,
2371,
29892,
4629,
29918,
4841,
353,
19997,
5159,
13,
4706,
363,
2380,
297,
1583,
29889,
8391,
3220,
267,
7295,
13,
9651,
2380,
353,
2380,
29889,
798,
580,
29871,
396,
11438,
1353,
13,
9651,
565,
2380,
451,
297,
4629,
29918,
2248,
267,
29918,
2371,
29901,
29871,
396,
319,
5405,
20955,
13,
18884,
4629,
29918,
2248,
267,
29918,
2371,
29889,
4397,
29898,
2248,
29897,
13,
18884,
4629,
29918,
4841,
29889,
4397,
29898,
524,
29898,
1311,
29889,
667,
29898,
2248,
29892,
29871,
29900,
467,
726,
22130,
13,
13,
4706,
396,
5240,
21081,
278,
4206,
515,
278,
1591,
322,
278,
2566,
13,
4706,
363,
2380,
29892,
1178,
29918,
2585,
297,
14319,
29898,
8391,
29918,
2248,
267,
29918,
2371,
29892,
4629,
29918,
4841,
1125,
13,
9651,
2582,
29889,
8143,
29918,
2914,
29898,
333,
29918,
2585,
29897,
13,
9651,
1583,
29889,
5992,
4301,
29898,
2248,
29897,
13,
13,
4706,
1596,
703,
7301,
8238,
4206,
411,
18999,
373,
4833,
584,
9162,
4629,
29918,
4841,
29892,
13,
795,
6634,
29876,
669,
18999,
373,
1591,
29901,
9162,
4629,
29918,
2248,
267,
29918,
2371,
29897,
13,
13,
1678,
822,
1735,
4617,
2951,
9112,
29898,
1311,
29892,
1948,
29892,
1897,
1125,
13,
4706,
9995,
13,
4706,
1932,
263,
6137,
10976,
338,
8788,
491,
278,
1404,
29892,
13,
4706,
591,
864,
304,
1423,
565,
372,
23994,
278,
1134,
13,
4706,
322,
3863,
372,
373,
278,
2566,
2086,
13,
4706,
9995,
13,
13,
4706,
565,
1583,
29889,
786,
26747,
1272,
29918,
15581,
338,
5852,
29901,
13,
9651,
736,
13,
9651,
396,
450,
848,
338,
1641,
9120,
25106,
313,
1333,
491,
278,
1404,
29897,
13,
9651,
396,
577,
694,
4436,
12023,
13,
13,
4706,
716,
29918,
667,
353,
1583,
29889,
667,
29898,
798,
29892,
1897,
29897,
13,
4706,
716,
29918,
667,
29918,
1272,
353,
716,
29918,
667,
29889,
726,
580,
13,
4706,
2566,
29918,
8269,
29918,
333,
353,
1583,
29889,
667,
29898,
798,
29892,
29871,
29900,
467,
726,
580,
13,
13,
4706,
3517,
29918,
14506,
353,
2582,
29889,
657,
3591,
18087,
4499,
29898,
13,
9651,
2566,
29918,
8269,
29918,
333,
29897,
29871,
396,
4803,
1319,
363,
17346,
10365,
1860,
2678,
13,
4706,
1897,
8391,
29918,
978,
353,
1583,
29889,
22672,
7850,
2001,
29898,
4914,
467,
726,
580,
13,
4706,
396,
28277,
373,
515,
607,
1897,
278,
2944,
338,
29892,
591,
1423,
278,
848,
13,
4706,
396,
7972,
17587,
13,
13,
4706,
396,
5399,
607,
760,
310,
278,
10804,
756,
1063,
8788,
29892,
322,
1274,
312,
292,
16205,
13,
4706,
396,
448,
9072,
29899,
1178,
448,
2683,
5634,
13,
4706,
565,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
1204,
29908,
1125,
13,
9651,
396,
5163,
29879,
508,
29915,
29873,
367,
8788,
13,
9651,
1059,
29918,
29885,
893,
29887,
353,
660,
3728,
3313,
580,
13,
9651,
1059,
29918,
29885,
893,
29887,
29889,
842,
12492,
29898,
29984,
3728,
3313,
29889,
22709,
29897,
13,
9651,
1059,
29918,
29885,
893,
29887,
29889,
12038,
29898,
1311,
29889,
509,
703,
21943,
508,
29915,
29873,
367,
8788,
5783,
13,
9651,
1059,
29918,
29885,
893,
29887,
29889,
4258,
29918,
580,
13,
13,
4706,
396,
448,
9072,
29899,
4712,
448,
2683,
5634,
13,
4706,
25342,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
2539,
29908,
1125,
13,
9651,
396,
450,
716,
1426,
756,
304,
367,
263,
2635,
13,
9651,
1018,
29901,
13,
18884,
716,
29918,
1256,
353,
12865,
29889,
710,
415,
603,
29898,
1482,
29918,
667,
29918,
1272,
29892,
11860,
29881,
19222,
29885,
19222,
29979,
1159,
13,
18884,
2582,
29889,
5504,
29918,
2914,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29892,
716,
29918,
1256,
29922,
1482,
29918,
1256,
29889,
16394,
3101,
13,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
1059,
29918,
29885,
893,
29887,
353,
660,
3728,
3313,
580,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
842,
12492,
29898,
29984,
3728,
3313,
29889,
22709,
29897,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
12038,
29898,
13,
462,
1678,
1583,
29889,
509,
703,
14510,
304,
367,
263,
2635,
297,
3402,
24488,
29899,
4317,
29899,
18855,
5783,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
4258,
29918,
580,
13,
13,
18884,
396,
2538,
300,
2635,
304,
3517,
697,
13,
18884,
3517,
29918,
1256,
29918,
16394,
353,
2582,
29889,
657,
29918,
2914,
29918,
1256,
29918,
1609,
29918,
333,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29897,
13,
18884,
3517,
29918,
1256,
29918,
726,
353,
12865,
29889,
3166,
16394,
29898,
13,
462,
1678,
3517,
29918,
1256,
29918,
16394,
467,
710,
615,
603,
11702,
29881,
19222,
29885,
19222,
29979,
1159,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
18884,
716,
29918,
667,
29889,
842,
1469,
29898,
29900,
29892,
3517,
29918,
1256,
29918,
726,
29897,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
7700,
13,
13,
4706,
396,
448,
9072,
29899,
16535,
448,
2683,
5634,
13,
4706,
25342,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
10601,
29908,
1125,
13,
9651,
396,
450,
3633,
756,
304,
367,
385,
5923,
697,
13,
9651,
599,
29918,
10149,
29879,
353,
518,
29874,
29961,
29900,
29962,
363,
263,
297,
6411,
2925,
29889,
657,
29918,
497,
29918,
10149,
29879,
580,
29962,
13,
9651,
3517,
29918,
10149,
353,
2582,
29889,
657,
29918,
2914,
29918,
10149,
29918,
1609,
29918,
333,
29898,
13,
18884,
2566,
29918,
8269,
29918,
333,
29897,
13,
13,
9651,
565,
716,
29918,
667,
29918,
1272,
451,
297,
599,
29918,
10149,
29879,
29901,
13,
18884,
1059,
29918,
29885,
893,
29887,
353,
660,
3728,
3313,
580,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
842,
12492,
29898,
29984,
3728,
3313,
29889,
22709,
29897,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
12038,
29898,
13,
462,
1678,
1583,
29889,
509,
703,
1576,
3633,
756,
304,
367,
385,
5923,
697,
29889,
320,
29876,
2528,
372,
937,
7522,
5783,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
4258,
29918,
580,
13,
13,
18884,
396,
2538,
300,
13705,
304,
3517,
697,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
18884,
716,
29918,
667,
29889,
842,
1469,
29898,
29900,
29892,
3517,
29918,
10149,
29897,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
7700,
13,
13,
9651,
1683,
29901,
13,
18884,
396,
450,
848,
338,
1781,
13,
18884,
396,
10726,
278,
1121,
373,
278,
2582,
1591,
373,
278,
4833,
13,
18884,
2582,
29889,
5504,
29918,
2914,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29892,
716,
29918,
10149,
29922,
1482,
29918,
667,
29918,
1272,
29897,
13,
18884,
396,
10318,
278,
17346,
310,
278,
1023,
15303,
9701,
29892,
13,
18884,
396,
5034,
304,
278,
1121,
5253,
13,
18884,
6411,
2925,
29889,
5504,
29918,
5521,
2925,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
3517,
29918,
10149,
29892,
448,
3517,
29918,
14506,
29897,
13,
18884,
6411,
2925,
29889,
5504,
29918,
5521,
2925,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
716,
29918,
667,
29918,
1272,
29892,
3517,
29918,
14506,
29897,
13,
13,
4706,
396,
448,
9072,
29899,
3767,
8963,
448,
2683,
5634,
13,
4706,
25342,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
26910,
29908,
1125,
13,
9651,
396,
450,
13705,
756,
304,
367,
385,
5923,
697,
13,
9651,
3517,
29918,
710,
8963,
353,
2582,
29889,
657,
29918,
2914,
29918,
710,
8963,
29918,
1609,
29918,
333,
29898,
13,
18884,
2566,
29918,
8269,
29918,
333,
29897,
13,
9651,
599,
29918,
710,
1845,
583,
353,
518,
29879,
29961,
29900,
29962,
363,
269,
297,
16650,
583,
29889,
657,
29918,
497,
29918,
710,
1845,
583,
580,
29962,
13,
13,
9651,
565,
716,
29918,
667,
29918,
1272,
451,
297,
599,
29918,
710,
1845,
583,
29901,
13,
18884,
1059,
29918,
29885,
893,
29887,
353,
660,
3728,
3313,
580,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
842,
12492,
29898,
29984,
3728,
3313,
29889,
22709,
29897,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
12038,
29898,
13,
462,
1678,
1583,
29889,
509,
703,
1576,
13705,
756,
304,
367,
385,
5923,
697,
29889,
320,
29876,
2528,
372,
937,
7522,
5783,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
4258,
29918,
580,
13,
13,
18884,
396,
2538,
300,
13705,
304,
3517,
697,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
18884,
716,
29918,
667,
29889,
842,
1469,
29898,
29900,
29892,
3517,
29918,
710,
8963,
29897,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
7700,
13,
9651,
1683,
29901,
13,
18884,
396,
450,
848,
338,
1781,
13,
18884,
396,
10726,
278,
1121,
373,
278,
2582,
1591,
310,
278,
4833,
13,
18884,
2582,
29889,
5504,
3591,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29892,
716,
710,
8963,
29922,
1482,
29918,
667,
29918,
1272,
29897,
13,
18884,
396,
10318,
278,
282,
12938,
310,
278,
1023,
16650,
583,
9701,
29892,
13,
18884,
396,
5034,
304,
278,
1121,
5253,
13,
18884,
16650,
583,
29889,
5504,
29918,
710,
1845,
583,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
3517,
29918,
710,
8963,
29892,
448,
3517,
29918,
14506,
29897,
13,
18884,
16650,
583,
29889,
5504,
29918,
710,
1845,
583,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
716,
29918,
667,
29918,
1272,
29892,
3517,
29918,
14506,
29897,
13,
13,
4706,
396,
448,
9072,
29899,
1913,
792,
448,
2683,
5634,
13,
4706,
25342,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
18087,
29908,
1125,
13,
9651,
396,
450,
5253,
756,
304,
367,
385,
6043,
13,
9651,
1018,
29901,
13,
18884,
716,
29918,
667,
29918,
1272,
353,
938,
29898,
1482,
29918,
667,
29918,
1272,
29897,
13,
18884,
396,
10726,
278,
1121,
373,
278,
2582,
1591,
310,
278,
4833,
13,
18884,
2582,
29889,
5504,
29918,
2914,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29892,
716,
29918,
14506,
29922,
1482,
29918,
667,
29918,
1272,
29897,
13,
18884,
396,
10318,
278,
6411,
2925,
322,
16650,
583,
411,
278,
4328,
13,
18884,
396,
1546,
278,
2030,
322,
278,
716,
1121,
13,
18884,
2923,
29918,
6878,
705,
27294,
29918,
9902,
353,
716,
29918,
667,
29918,
1272,
448,
3517,
29918,
14506,
13,
18884,
3633,
29918,
262,
1555,
1490,
353,
2582,
29889,
657,
29918,
2914,
29918,
10149,
29918,
1609,
29918,
333,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29897,
13,
18884,
13705,
29918,
262,
1555,
1490,
353,
2582,
29889,
657,
29918,
2914,
29918,
710,
8963,
29918,
1609,
29918,
333,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29897,
13,
13,
18884,
6411,
2925,
29889,
5504,
29918,
5521,
2925,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
3633,
29918,
262,
1555,
1490,
29892,
2923,
29918,
6878,
705,
27294,
29918,
9902,
29897,
13,
18884,
16650,
583,
29889,
5504,
29918,
710,
1845,
583,
29918,
2541,
29918,
1482,
29918,
2914,
29898,
13,
462,
1678,
13705,
29918,
262,
1555,
1490,
29892,
2923,
29918,
6878,
705,
27294,
29918,
9902,
29897,
13,
13,
9651,
5174,
8960,
29901,
13,
18884,
1059,
29918,
29885,
893,
29887,
353,
660,
3728,
3313,
580,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
842,
12492,
29898,
29984,
3728,
3313,
29889,
22709,
29897,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
12038,
29898,
13,
462,
1678,
1583,
29889,
509,
703,
14510,
304,
367,
385,
6043,
5783,
13,
18884,
1059,
29918,
29885,
893,
29887,
29889,
4258,
29918,
580,
13,
13,
18884,
396,
2538,
300,
304,
3517,
5253,
13,
18884,
3517,
29918,
14506,
353,
2582,
29889,
657,
29918,
2914,
29918,
14506,
29918,
1609,
29918,
333,
29898,
13,
462,
1678,
2566,
29918,
8269,
29918,
333,
29897,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
5852,
13,
18884,
716,
29918,
667,
29889,
842,
1469,
29898,
29900,
29892,
3517,
29918,
14506,
29897,
13,
18884,
1583,
29889,
786,
26747,
1272,
29918,
15581,
353,
7700,
13,
13,
4706,
396,
448,
9072,
29899,
12953,
448,
2683,
5634,
13,
4706,
25342,
1897,
8391,
29918,
978,
1275,
1583,
29889,
509,
703,
9868,
29908,
1125,
13,
9651,
396,
319,
6139,
508,
367,
738,
848,
29889,
1105,
694,
12747,
13,
9651,
2582,
29889,
5504,
29918,
2914,
29898,
13,
18884,
2566,
29918,
8269,
29918,
333,
29892,
716,
29918,
8216,
29922,
1482,
29918,
667,
29918,
1272,
29897,
13,
13,
13,
1990,
7407,
7301,
8238,
29898,
29984,
2061,
1125,
13,
1678,
1196,
7301,
8238,
353,
11451,
17915,
10140,
284,
580,
13,
2
] |
util1.py | Daim-Akram/chat_app-Socket | 0 | 118510 | '''
This file contains basic utility functions that you can use.
'''
import binascii
MAX_NUM_CLIENTS = 10
TIME_OUT = 0.5 # 500ms
NUM_OF_RETRANSMISSIONS = 3
CHUNK_SIZE = 1400 # 1400 Bytes
def validate_checksum(message):
'''
Validates Checksum of a message and returns true/false
'''
try:
msg, checksum = message.rsplit('|', 1)
msg += '|'
return generate_checksum(msg.encode()) == checksum
except BaseException:
return False
def generate_checksum(message):
'''
Returns Checksum of the given message
'''
return str(binascii.crc32(message) & 0xffffffff)
def make_packet(msg_type="data", seqno=0, msg=""):
'''
This will add the header to your message.
The formats is `<message_type> <sequence_number> <body> <checksum>`
msg_type can be data, ack, end, start
seqno is a packet sequence number (integer)
msg is the actual message string
'''
body = "%s|%d|%s|" % (msg_type, seqno, msg)
checksum = generate_checksum(body.encode())
packet = "%s%s" % (body, checksum)
return packet
def parse_packet(message):
'''
This function will parse the packet in the same way it was made in the above function.
'''
pieces = message.split('|')
msg_type, seqno = pieces[0:2]
checksum = pieces[-1]
data = '|'.join(pieces[2:-1])
return msg_type, seqno, data, checksum
def make_message(msg_type, msg_format, message=None):
'''
This function can be used to format your message according
to any one of the formats described in the documentation.
msg_type defines type like join, disconnect etc.
msg_format is either 1,2,3 or 4
msg is remaining.
'''
if msg_format == 2:
msg_len = 0
return "%s %d" % (msg_type, msg_len)
if msg_format in [1, 3, 4]:
msg_len = len(message)
return "%s %d %s" % (msg_type, msg_len, message)
return ""
| [
1,
14550,
13,
4013,
934,
3743,
6996,
19725,
3168,
393,
366,
508,
671,
29889,
13,
12008,
13,
5215,
9016,
294,
18869,
13,
13,
12648,
29918,
13967,
29918,
27205,
3919,
29903,
353,
29871,
29896,
29900,
13,
15307,
29918,
12015,
353,
29871,
29900,
29889,
29945,
396,
29871,
29945,
29900,
29900,
1516,
13,
13967,
29918,
9800,
29918,
1525,
26813,
29903,
10403,
13507,
29903,
353,
29871,
29941,
13,
3210,
3904,
29968,
29918,
14226,
353,
29871,
29896,
29946,
29900,
29900,
396,
29871,
29896,
29946,
29900,
29900,
2648,
2167,
13,
13,
1753,
12725,
29918,
3198,
2083,
29898,
4906,
1125,
13,
1678,
14550,
13,
1678,
15758,
1078,
5399,
2083,
310,
263,
2643,
322,
3639,
1565,
29914,
4541,
13,
1678,
14550,
13,
1678,
1018,
29901,
13,
4706,
10191,
29892,
1423,
2083,
353,
2643,
29889,
2288,
2830,
877,
29989,
742,
29871,
29896,
29897,
13,
4706,
10191,
4619,
525,
29989,
29915,
13,
4706,
736,
5706,
29918,
3198,
2083,
29898,
7645,
29889,
12508,
3101,
1275,
1423,
2083,
13,
1678,
5174,
7399,
2451,
29901,
13,
4706,
736,
7700,
13,
13,
13,
1753,
5706,
29918,
3198,
2083,
29898,
4906,
1125,
13,
1678,
14550,
13,
1678,
16969,
5399,
2083,
310,
278,
2183,
2643,
13,
1678,
14550,
13,
1678,
736,
851,
29898,
2109,
294,
18869,
29889,
29883,
2214,
29941,
29906,
29898,
4906,
29897,
669,
29871,
29900,
29916,
17156,
17156,
29897,
13,
13,
13,
1753,
1207,
29918,
4058,
300,
29898,
7645,
29918,
1853,
543,
1272,
613,
19359,
1217,
29922,
29900,
29892,
10191,
13776,
1125,
13,
1678,
14550,
13,
1678,
910,
674,
788,
278,
4839,
304,
596,
2643,
29889,
13,
1678,
450,
21971,
338,
14935,
4906,
29918,
1853,
29958,
529,
16506,
29918,
4537,
29958,
529,
2587,
29958,
529,
3198,
2083,
13885,
13,
1678,
10191,
29918,
1853,
508,
367,
848,
29892,
263,
384,
29892,
1095,
29892,
1369,
13,
1678,
19359,
1217,
338,
263,
18203,
5665,
1353,
313,
16031,
29897,
13,
1678,
10191,
338,
278,
3935,
2643,
1347,
13,
1678,
14550,
13,
1678,
3573,
353,
11860,
29879,
29989,
29995,
29881,
29989,
29995,
29879,
29989,
29908,
1273,
313,
7645,
29918,
1853,
29892,
19359,
1217,
29892,
10191,
29897,
13,
1678,
1423,
2083,
353,
5706,
29918,
3198,
2083,
29898,
2587,
29889,
12508,
3101,
13,
1678,
18203,
353,
11860,
29879,
29995,
29879,
29908,
1273,
313,
2587,
29892,
1423,
2083,
29897,
13,
1678,
736,
18203,
13,
13,
13,
1753,
6088,
29918,
4058,
300,
29898,
4906,
1125,
13,
1678,
14550,
13,
1678,
910,
740,
674,
6088,
278,
18203,
297,
278,
1021,
982,
372,
471,
1754,
297,
278,
2038,
740,
29889,
13,
1678,
14550,
13,
1678,
12785,
353,
2643,
29889,
5451,
877,
29989,
1495,
13,
1678,
10191,
29918,
1853,
29892,
19359,
1217,
353,
12785,
29961,
29900,
29901,
29906,
29962,
13,
1678,
1423,
2083,
353,
12785,
14352,
29896,
29962,
13,
1678,
848,
353,
525,
29989,
4286,
7122,
29898,
12343,
778,
29961,
29906,
13018,
29896,
2314,
13,
1678,
736,
10191,
29918,
1853,
29892,
19359,
1217,
29892,
848,
29892,
1423,
2083,
13,
13,
13,
1753,
1207,
29918,
4906,
29898,
7645,
29918,
1853,
29892,
10191,
29918,
4830,
29892,
2643,
29922,
8516,
1125,
13,
1678,
14550,
13,
1678,
910,
740,
508,
367,
1304,
304,
3402,
596,
2643,
5034,
13,
1678,
304,
738,
697,
310,
278,
21971,
5439,
297,
278,
5106,
29889,
13,
1678,
10191,
29918,
1853,
17645,
1134,
763,
5988,
29892,
766,
6915,
2992,
29889,
13,
1678,
10191,
29918,
4830,
338,
2845,
29871,
29896,
29892,
29906,
29892,
29941,
470,
29871,
29946,
13,
1678,
10191,
338,
9886,
29889,
29871,
13,
1678,
14550,
13,
1678,
565,
10191,
29918,
4830,
1275,
29871,
29906,
29901,
13,
4706,
10191,
29918,
2435,
353,
29871,
29900,
13,
4706,
736,
11860,
29879,
1273,
29881,
29908,
1273,
313,
7645,
29918,
1853,
29892,
10191,
29918,
2435,
29897,
13,
1678,
565,
10191,
29918,
4830,
297,
518,
29896,
29892,
29871,
29941,
29892,
29871,
29946,
5387,
13,
4706,
10191,
29918,
2435,
353,
7431,
29898,
4906,
29897,
13,
4706,
736,
11860,
29879,
1273,
29881,
1273,
29879,
29908,
1273,
313,
7645,
29918,
1853,
29892,
10191,
29918,
2435,
29892,
2643,
29897,
13,
1678,
736,
5124,
13,
2
] |
solutionbox/structured_data/mltoolbox/_structured_data/preprocess/local_preprocess.py | freyrsae/pydatalab | 198 | 18258 | <gh_stars>100-1000
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import collections
import json
import os
import six
import sys
from tensorflow.python.lib.io import file_io
SCHEMA_FILE = 'schema.json'
NUMERICAL_ANALYSIS_FILE = 'stats.json'
CATEGORICAL_ANALYSIS_FILE = 'vocab_%s.csv'
def parse_arguments(argv):
"""Parse command line arguments.
Args:
argv: list of command line arguments, includeing programe name.
Returns:
An argparse Namespace object.
"""
parser = argparse.ArgumentParser(
description='Runs Preprocessing on structured CSV data.')
parser.add_argument('--input-file-pattern',
type=str,
required=True,
help='Input CSV file names. May contain a file pattern')
parser.add_argument('--output-dir',
type=str,
required=True,
help='Google Cloud Storage which to place outputs.')
parser.add_argument('--schema-file',
type=str,
required=True,
help=('BigQuery json schema file'))
args = parser.parse_args(args=argv[1:])
# Make sure the output folder exists if local folder.
file_io.recursive_create_dir(args.output_dir)
return args
def run_numerical_categorical_analysis(args, schema_list):
"""Makes the numerical and categorical analysis files.
Args:
args: the command line args
schema_list: python object of the schema json file.
Raises:
ValueError: if schema contains unknown column types.
"""
header = [column['name'] for column in schema_list]
input_files = file_io.get_matching_files(args.input_file_pattern)
# Check the schema is valid
for col_schema in schema_list:
col_type = col_schema['type'].lower()
if col_type != 'string' and col_type != 'integer' and col_type != 'float':
raise ValueError('Schema contains an unsupported type %s.' % col_type)
# initialize the results
def _init_numerical_results():
return {'min': float('inf'),
'max': float('-inf'),
'count': 0,
'sum': 0.0}
numerical_results = collections.defaultdict(_init_numerical_results)
categorical_results = collections.defaultdict(set)
# for each file, update the numerical stats from that file, and update the set
# of unique labels.
for input_file in input_files:
with file_io.FileIO(input_file, 'r') as f:
for line in f:
parsed_line = dict(zip(header, line.strip().split(',')))
for col_schema in schema_list:
col_name = col_schema['name']
col_type = col_schema['type']
if col_type.lower() == 'string':
categorical_results[col_name].update([parsed_line[col_name]])
else:
# numerical column.
# if empty, skip
if not parsed_line[col_name].strip():
continue
numerical_results[col_name]['min'] = (
min(numerical_results[col_name]['min'],
float(parsed_line[col_name])))
numerical_results[col_name]['max'] = (
max(numerical_results[col_name]['max'],
float(parsed_line[col_name])))
numerical_results[col_name]['count'] += 1
numerical_results[col_name]['sum'] += float(parsed_line[col_name])
# Update numerical_results to just have min/min/mean
for col_schema in schema_list:
if col_schema['type'].lower() != 'string':
col_name = col_schema['name']
mean = numerical_results[col_name]['sum'] / numerical_results[col_name]['count']
del numerical_results[col_name]['sum']
del numerical_results[col_name]['count']
numerical_results[col_name]['mean'] = mean
# Write the numerical_results to a json file.
file_io.write_string_to_file(
os.path.join(args.output_dir, NUMERICAL_ANALYSIS_FILE),
json.dumps(numerical_results, indent=2, separators=(',', ': ')))
# Write the vocab files. Each label is on its own line.
for name, unique_labels in six.iteritems(categorical_results):
labels = '\n'.join(list(unique_labels))
file_io.write_string_to_file(
os.path.join(args.output_dir, CATEGORICAL_ANALYSIS_FILE % name),
labels)
def run_analysis(args):
"""Builds an analysis files for training."""
# Read the schema and input feature types
schema_list = json.loads(
file_io.read_file_to_string(args.schema_file))
run_numerical_categorical_analysis(args, schema_list)
# Also save a copy of the schema in the output folder.
file_io.copy(args.schema_file,
os.path.join(args.output_dir, SCHEMA_FILE),
overwrite=True)
def main(argv=None):
args = parse_arguments(sys.argv if argv is None else argv)
run_analysis(args)
if __name__ == '__main__':
main()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
5087,
9266,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
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,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
13,
5215,
1852,
5510,
13,
5215,
16250,
13,
5215,
4390,
13,
5215,
2897,
13,
5215,
4832,
13,
5215,
10876,
13,
13,
13,
3166,
26110,
29889,
4691,
29889,
1982,
29889,
601,
1053,
934,
29918,
601,
13,
13,
13,
29903,
3210,
26862,
29918,
7724,
353,
525,
11010,
29889,
3126,
29915,
13,
13967,
1001,
2965,
1964,
29918,
2190,
1964,
21554,
3235,
29918,
7724,
353,
525,
16202,
29889,
3126,
29915,
13,
29907,
3040,
29954,
1955,
2965,
1964,
29918,
2190,
1964,
21554,
3235,
29918,
7724,
353,
525,
29894,
542,
370,
29918,
29995,
29879,
29889,
7638,
29915,
13,
13,
13,
1753,
6088,
29918,
25699,
29898,
19218,
1125,
13,
29871,
9995,
12914,
1899,
1196,
6273,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
1852,
29894,
29901,
1051,
310,
1899,
1196,
6273,
29892,
3160,
292,
410,
629,
420,
1024,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
530,
1852,
5510,
14706,
3535,
1203,
29889,
13,
29871,
9995,
13,
29871,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
418,
6139,
2433,
6558,
29879,
4721,
19170,
373,
2281,
2955,
16874,
848,
29889,
1495,
13,
29871,
13812,
29889,
1202,
29918,
23516,
877,
489,
2080,
29899,
1445,
29899,
11037,
742,
13,
462,
418,
1134,
29922,
710,
29892,
13,
462,
418,
3734,
29922,
5574,
29892,
13,
462,
418,
1371,
2433,
4290,
16874,
934,
2983,
29889,
2610,
1712,
263,
934,
4766,
1495,
13,
29871,
13812,
29889,
1202,
29918,
23516,
877,
489,
4905,
29899,
3972,
742,
13,
462,
418,
1134,
29922,
710,
29892,
13,
462,
418,
3734,
29922,
5574,
29892,
13,
462,
418,
1371,
2433,
14207,
14293,
26162,
607,
304,
2058,
14391,
29889,
1495,
13,
29871,
13812,
29889,
1202,
29918,
23516,
877,
489,
11010,
29899,
1445,
742,
13,
462,
418,
1134,
29922,
710,
29892,
13,
462,
418,
3734,
29922,
5574,
29892,
13,
462,
418,
1371,
29922,
877,
6970,
3010,
4390,
10938,
934,
8785,
13,
13,
29871,
6389,
353,
13812,
29889,
5510,
29918,
5085,
29898,
5085,
29922,
19218,
29961,
29896,
29901,
2314,
13,
13,
29871,
396,
8561,
1854,
278,
1962,
4138,
4864,
565,
1887,
4138,
29889,
13,
29871,
934,
29918,
601,
29889,
3757,
25397,
29918,
3258,
29918,
3972,
29898,
5085,
29889,
4905,
29918,
3972,
29897,
13,
13,
29871,
736,
6389,
13,
13,
13,
1753,
1065,
29918,
8058,
936,
29918,
29883,
20440,
936,
29918,
15916,
29898,
5085,
29892,
10938,
29918,
1761,
1125,
13,
29871,
9995,
29924,
6926,
278,
16259,
322,
11608,
936,
7418,
2066,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
6389,
29901,
278,
1899,
1196,
6389,
13,
1678,
10938,
29918,
1761,
29901,
3017,
1203,
310,
278,
10938,
4390,
934,
29889,
13,
13,
29871,
390,
1759,
267,
29901,
13,
1678,
7865,
2392,
29901,
565,
10938,
3743,
9815,
1897,
4072,
29889,
13,
29871,
9995,
13,
29871,
4839,
353,
518,
4914,
1839,
978,
2033,
363,
1897,
297,
10938,
29918,
1761,
29962,
13,
29871,
1881,
29918,
5325,
353,
934,
29918,
601,
29889,
657,
29918,
4352,
292,
29918,
5325,
29898,
5085,
29889,
2080,
29918,
1445,
29918,
11037,
29897,
13,
13,
29871,
396,
5399,
278,
10938,
338,
2854,
13,
29871,
363,
784,
29918,
11010,
297,
10938,
29918,
1761,
29901,
13,
1678,
784,
29918,
1853,
353,
784,
29918,
11010,
1839,
1853,
13359,
13609,
580,
13,
1678,
565,
784,
29918,
1853,
2804,
525,
1807,
29915,
322,
784,
29918,
1853,
2804,
525,
16031,
29915,
322,
784,
29918,
1853,
2804,
525,
7411,
2396,
13,
418,
12020,
7865,
2392,
877,
12763,
3743,
385,
443,
23765,
1134,
1273,
29879,
6169,
1273,
784,
29918,
1853,
29897,
13,
13,
29871,
396,
11905,
278,
2582,
13,
29871,
822,
903,
2344,
29918,
8058,
936,
29918,
9902,
7295,
13,
1678,
736,
11117,
1195,
2396,
5785,
877,
7192,
5477,
13,
9651,
525,
3317,
2396,
5785,
877,
29899,
7192,
5477,
13,
9651,
525,
2798,
2396,
29871,
29900,
29892,
13,
9651,
525,
2083,
2396,
29871,
29900,
29889,
29900,
29913,
13,
29871,
16259,
29918,
9902,
353,
16250,
29889,
4381,
8977,
7373,
2344,
29918,
8058,
936,
29918,
9902,
29897,
13,
29871,
11608,
936,
29918,
9902,
353,
16250,
29889,
4381,
8977,
29898,
842,
29897,
13,
13,
29871,
396,
363,
1269,
934,
29892,
2767,
278,
16259,
22663,
515,
393,
934,
29892,
322,
2767,
278,
731,
13,
29871,
396,
310,
5412,
11073,
29889,
13,
29871,
363,
1881,
29918,
1445,
297,
1881,
29918,
5325,
29901,
13,
1678,
411,
934,
29918,
601,
29889,
2283,
5971,
29898,
2080,
29918,
1445,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
418,
363,
1196,
297,
285,
29901,
13,
4706,
21213,
29918,
1220,
353,
9657,
29898,
7554,
29898,
6672,
29892,
1196,
29889,
17010,
2141,
5451,
29898,
3788,
4961,
13,
13,
4706,
363,
784,
29918,
11010,
297,
10938,
29918,
1761,
29901,
13,
3986,
784,
29918,
978,
353,
784,
29918,
11010,
1839,
978,
2033,
13,
3986,
784,
29918,
1853,
353,
784,
29918,
11010,
1839,
1853,
2033,
13,
3986,
565,
784,
29918,
1853,
29889,
13609,
580,
1275,
525,
1807,
2396,
13,
9651,
11608,
936,
29918,
9902,
29961,
1054,
29918,
978,
1822,
5504,
4197,
862,
8485,
29918,
1220,
29961,
1054,
29918,
978,
24960,
13,
3986,
1683,
29901,
13,
9651,
396,
16259,
1897,
29889,
13,
13,
9651,
396,
565,
4069,
29892,
14383,
13,
9651,
565,
451,
21213,
29918,
1220,
29961,
1054,
29918,
978,
1822,
17010,
7295,
13,
795,
6773,
13,
13,
9651,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
1195,
2033,
353,
313,
13,
795,
1375,
29898,
8058,
936,
29918,
9902,
29961,
1054,
29918,
978,
22322,
1195,
7464,
13,
462,
29871,
5785,
29898,
862,
8485,
29918,
1220,
29961,
1054,
29918,
978,
29962,
4961,
13,
9651,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
3317,
2033,
353,
313,
13,
795,
4236,
29898,
8058,
936,
29918,
9902,
29961,
1054,
29918,
978,
22322,
3317,
7464,
13,
462,
29871,
5785,
29898,
862,
8485,
29918,
1220,
29961,
1054,
29918,
978,
29962,
4961,
13,
9651,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2798,
2033,
4619,
29871,
29896,
13,
9651,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2083,
2033,
4619,
5785,
29898,
862,
8485,
29918,
1220,
29961,
1054,
29918,
978,
2314,
13,
13,
29871,
396,
10318,
16259,
29918,
9902,
304,
925,
505,
1375,
29914,
1195,
29914,
12676,
13,
29871,
363,
784,
29918,
11010,
297,
10938,
29918,
1761,
29901,
13,
1678,
565,
784,
29918,
11010,
1839,
1853,
13359,
13609,
580,
2804,
525,
1807,
2396,
13,
418,
784,
29918,
978,
353,
784,
29918,
11010,
1839,
978,
2033,
13,
418,
2099,
353,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2083,
2033,
847,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2798,
2033,
13,
418,
628,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2083,
2033,
13,
418,
628,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
2798,
2033,
13,
418,
16259,
29918,
9902,
29961,
1054,
29918,
978,
22322,
12676,
2033,
353,
2099,
13,
13,
29871,
396,
14350,
278,
16259,
29918,
9902,
304,
263,
4390,
934,
29889,
13,
29871,
934,
29918,
601,
29889,
3539,
29918,
1807,
29918,
517,
29918,
1445,
29898,
13,
418,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
28019,
1001,
2965,
1964,
29918,
2190,
1964,
21554,
3235,
29918,
7724,
511,
13,
418,
4390,
29889,
29881,
17204,
29898,
8058,
936,
29918,
9902,
29892,
29536,
29922,
29906,
29892,
2903,
4097,
7607,
742,
742,
525,
29901,
525,
4961,
13,
13,
29871,
396,
14350,
278,
7931,
370,
2066,
29889,
7806,
3858,
338,
373,
967,
1914,
1196,
29889,
13,
29871,
363,
1024,
29892,
5412,
29918,
21134,
297,
4832,
29889,
1524,
7076,
29898,
29883,
20440,
936,
29918,
9902,
1125,
13,
1678,
11073,
353,
11297,
29876,
4286,
7122,
29898,
1761,
29898,
13092,
29918,
21134,
876,
13,
1678,
934,
29918,
601,
29889,
3539,
29918,
1807,
29918,
517,
29918,
1445,
29898,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
315,
3040,
29954,
1955,
2965,
1964,
29918,
2190,
1964,
21554,
3235,
29918,
7724,
1273,
1024,
511,
13,
4706,
11073,
29897,
13,
13,
13,
1753,
1065,
29918,
15916,
29898,
5085,
1125,
13,
29871,
9995,
8893,
29879,
385,
7418,
2066,
363,
6694,
1213,
15945,
13,
13,
29871,
396,
7523,
278,
10938,
322,
1881,
4682,
4072,
13,
29871,
10938,
29918,
1761,
353,
4390,
29889,
18132,
29898,
13,
418,
934,
29918,
601,
29889,
949,
29918,
1445,
29918,
517,
29918,
1807,
29898,
5085,
29889,
11010,
29918,
1445,
876,
13,
13,
29871,
1065,
29918,
8058,
936,
29918,
29883,
20440,
936,
29918,
15916,
29898,
5085,
29892,
10938,
29918,
1761,
29897,
13,
13,
29871,
396,
3115,
4078,
263,
3509,
310,
278,
10938,
297,
278,
1962,
4138,
29889,
13,
29871,
934,
29918,
601,
29889,
8552,
29898,
5085,
29889,
11010,
29918,
1445,
29892,
13,
1669,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
317,
3210,
26862,
29918,
7724,
511,
13,
1669,
26556,
29922,
5574,
29897,
13,
13,
13,
1753,
1667,
29898,
19218,
29922,
8516,
1125,
13,
29871,
6389,
353,
6088,
29918,
25699,
29898,
9675,
29889,
19218,
565,
1852,
29894,
338,
6213,
1683,
1852,
29894,
29897,
13,
29871,
1065,
29918,
15916,
29898,
5085,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29871,
1667,
580,
13,
2
] |
3cw.py | lisoleg/pybancor | 0 | 58518 | import numpy as np
import matplotlib.pyplot as plt
import random
s0=4.96*10**8
mtop=5.04*10**8
oneday=24*60*60
oneyear=365
t=[i for i in range(1,oneyear*30)]
bprice0=6.4669
bprice=bprice0
bnum0=1000000
b0=1.0*bnum0
cw0=0.065
cw1=0.075
cw2=0.08
cw3=0.1
realmine=0
p0list=[]
b0list=[]
s0list=[]
p1list=[]
b1list=[]
s1list=[]
p2list=[]
b2list=[]
s2list=[]
p3list=[]
b3list=[]
s3list=[]
b=b0
p0=b0/(cw0*s0)
percentforbancor=0.08
dotpersec=2
s=1.0*s0
newprice=p=p0
sp=s0*p0
allmine=0
for i in t:
l=i/(365*4+1)
mineperday=(1.0*dotpersec/(2**l))*oneday
if allmine+mineperday>mtop:
realmine=mtop-allmine
else:
realmine=mineperday
allmine+=realmine
s+=realmine
newprice=b/(cw0*s)
b+=realmine*percentforbancor*newprice
newprice=b/(cw0*s)
b0list.append(b/10**6)
s0list.append(s/10**6)
p0list.append(newprice*10**3)
b=b0
s=s0
realmine=allmine=0
for i in t:
l=i/(365*4+1)
mineperhalfday=(1.0*dotpersec/(2**l))*oneday
if allmine+mineperhalfday>mtop:
realmine=mtop-allmine
else:
realmine=mineperhalfday
allmine+=realmine
s+=realmine
newprice=b/(cw1*s)
b+=realmine*percentforbancor*newprice
newprice=b/(cw1*s)
b1list.append(b/10**6)
s1list.append(s/10**6)
p1list.append(newprice*10**3)
b=b0
s=s0
realmine=allmine=0
for i in t:
l=i/(365*4+1)
mineperhalfday=(1.0*dotpersec/(2**l))*oneday
if allmine+mineperhalfday>mtop:
realmine=mtop-allmine
else:
realmine=mineperhalfday
allmine+=realmine
s+=realmine
newprice=b/(cw2*s)
b+=realmine*percentforbancor*newprice
newprice=b/(cw2*s)
b2list.append(b/10**6)
s2list.append(s/10**6)
p2list.append(newprice*10**3)
b=b0
s=s0
realmine=allmine=0
for i in t:
l=i/(365*4+1)
mineperhalfday=(1.0*dotpersec/(2**l))*oneday
if allmine+mineperhalfday>mtop:
realmine=mtop-allmine
else:
realmine=mineperhalfday
allmine+=realmine
s+=realmine
newprice=b/(cw3*s)
b+=realmine*percentforbancor*newprice
newprice=b/(cw3*s)
b3list.append(b/10**6)
s3list.append(s/10**6)
p3list.append(newprice*10**3)
sp=plt.subplot(311)
sp.plot(t,np.array(s0list),color="black")
sp.plot(t,np.array(s1list),color="red")
sp.plot(t,np.array(s2list),color="green")
sp.plot(t,np.array(s3list),color="grey")
bp=plt.subplot(312)
bp.plot(t,np.array(b0list),color="black")
bp.plot(t,np.array(b1list),color="red")
bp.plot(t,np.array(b2list),color="green")
bp.plot(t,np.array(b3list),color="grey")
pp=plt.subplot(313)
pp.plot(t,np.array(p0list),color="black")
pp.plot(t,np.array(p1list),color="red")
pp.plot(t,np.array(p2list),color="green")
pp.plot(t,np.array(p3list),color="grey")
plt.legend()
plt.rcParams['font.sans-serif']=['AR PL UKai CN']
pp.set_title('Price-Day')
pp.set_ylabel("10^-3EOS")
sp.set_title("Supply-Day cw b="+str(cw0)+"/r"+str(cw1)+"/g"+str(cw2)+"/y"+str(cw3)+" rate="+str(percentforbancor))
sp.set_ylabel("mDOT")
bp.set_title("Reserve-Day")
bp.set_ylabel("mEOS")
plt.tight_layout()
plt.show()
| [
1,
1053,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
4036,
13,
13,
29879,
29900,
29922,
29946,
29889,
29929,
29953,
29930,
29896,
29900,
1068,
29947,
13,
29885,
3332,
29922,
29945,
29889,
29900,
29946,
29930,
29896,
29900,
1068,
29947,
13,
22367,
388,
29922,
29906,
29946,
29930,
29953,
29900,
29930,
29953,
29900,
13,
4992,
799,
29922,
29941,
29953,
29945,
13,
29873,
11759,
29875,
363,
474,
297,
3464,
29898,
29896,
29892,
4992,
799,
29930,
29941,
29900,
4638,
29871,
13,
29890,
9175,
29900,
29922,
29953,
29889,
29946,
29953,
29953,
29929,
13,
29890,
9175,
29922,
29890,
9175,
29900,
13,
29890,
1949,
29900,
29922,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
13,
29890,
29900,
29922,
29896,
29889,
29900,
29930,
29890,
1949,
29900,
13,
29883,
29893,
29900,
29922,
29900,
29889,
29900,
29953,
29945,
13,
29883,
29893,
29896,
29922,
29900,
29889,
29900,
29955,
29945,
13,
29883,
29893,
29906,
29922,
29900,
29889,
29900,
29947,
13,
29883,
29893,
29941,
29922,
29900,
29889,
29896,
13,
6370,
24669,
29922,
29900,
13,
29886,
29900,
1761,
29922,
2636,
13,
29890,
29900,
1761,
29922,
2636,
13,
29879,
29900,
1761,
29922,
2636,
13,
29886,
29896,
1761,
29922,
2636,
13,
29890,
29896,
1761,
29922,
2636,
13,
29879,
29896,
1761,
29922,
2636,
13,
29886,
29906,
1761,
29922,
2636,
13,
29890,
29906,
1761,
29922,
2636,
13,
29879,
29906,
1761,
29922,
2636,
13,
29886,
29941,
1761,
29922,
2636,
13,
29890,
29941,
1761,
29922,
2636,
13,
29879,
29941,
1761,
29922,
2636,
13,
29890,
29922,
29890,
29900,
13,
29886,
29900,
29922,
29890,
29900,
14571,
29883,
29893,
29900,
29930,
29879,
29900,
29897,
13,
25376,
1454,
2571,
2616,
29922,
29900,
29889,
29900,
29947,
13,
6333,
546,
3471,
29922,
29906,
13,
29879,
29922,
29896,
29889,
29900,
29930,
29879,
29900,
13,
1482,
9175,
29922,
29886,
29922,
29886,
29900,
13,
1028,
29922,
29879,
29900,
29930,
29886,
29900,
13,
497,
24669,
29922,
29900,
13,
1454,
474,
297,
260,
29901,
13,
12,
29880,
29922,
29875,
14571,
29941,
29953,
29945,
29930,
29946,
29974,
29896,
29897,
13,
12,
24669,
546,
3250,
7607,
29896,
29889,
29900,
29930,
6333,
546,
3471,
14571,
29906,
1068,
29880,
876,
29930,
22367,
388,
13,
12,
361,
599,
24669,
29974,
24669,
546,
3250,
29958,
29885,
3332,
29901,
13,
12,
12,
6370,
24669,
29922,
29885,
3332,
29899,
497,
24669,
13,
12,
2870,
29901,
13,
12,
12,
6370,
24669,
29922,
24669,
546,
3250,
13,
12,
497,
24669,
23661,
6370,
24669,
13,
12,
29879,
23661,
6370,
24669,
13,
12,
1482,
9175,
29922,
29890,
14571,
29883,
29893,
29900,
29930,
29879,
29897,
13,
12,
29890,
23661,
6370,
24669,
29930,
25376,
1454,
2571,
2616,
29930,
1482,
9175,
13,
12,
1482,
9175,
29922,
29890,
14571,
29883,
29893,
29900,
29930,
29879,
29897,
13,
12,
29890,
29900,
1761,
29889,
4397,
29898,
29890,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
269,
29900,
1761,
29889,
4397,
29898,
29879,
29914,
29896,
29900,
1068,
29953,
29897,
13,
12,
29886,
29900,
1761,
29889,
4397,
29898,
1482,
9175,
29930,
29896,
29900,
1068,
29941,
29897,
13,
29890,
29922,
29890,
29900,
13,
29879,
29922,
29879,
29900,
13,
6370,
24669,
29922,
497,
24669,
29922,
29900,
13,
1454,
474,
297,
260,
29901,
13,
4706,
301,
29922,
29875,
14571,
29941,
29953,
29945,
29930,
29946,
29974,
29896,
29897,
13,
4706,
7903,
546,
24498,
3250,
7607,
29896,
29889,
29900,
29930,
6333,
546,
3471,
14571,
29906,
1068,
29880,
876,
29930,
22367,
388,
13,
4706,
565,
599,
24669,
29974,
24669,
546,
24498,
3250,
29958,
29885,
3332,
29901,
13,
18884,
1855,
24669,
29922,
29885,
3332,
29899,
497,
24669,
13,
4706,
1683,
29901,
13,
18884,
1855,
24669,
29922,
24669,
546,
24498,
3250,
13,
4706,
599,
24669,
23661,
6370,
24669,
13,
4706,
269,
23661,
6370,
24669,
13,
12,
1482,
9175,
29922,
29890,
14571,
29883,
29893,
29896,
29930,
29879,
29897,
13,
12,
29890,
23661,
6370,
24669,
29930,
25376,
1454,
2571,
2616,
29930,
1482,
9175,
13,
4706,
716,
9175,
29922,
29890,
14571,
29883,
29893,
29896,
29930,
29879,
29897,
13,
4706,
289,
29896,
1761,
29889,
4397,
29898,
29890,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
269,
29896,
1761,
29889,
4397,
29898,
29879,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
282,
29896,
1761,
29889,
4397,
29898,
1482,
9175,
29930,
29896,
29900,
1068,
29941,
29897,
13,
29890,
29922,
29890,
29900,
13,
29879,
29922,
29879,
29900,
13,
6370,
24669,
29922,
497,
24669,
29922,
29900,
13,
1454,
474,
297,
260,
29901,
13,
4706,
301,
29922,
29875,
14571,
29941,
29953,
29945,
29930,
29946,
29974,
29896,
29897,
13,
4706,
7903,
546,
24498,
3250,
7607,
29896,
29889,
29900,
29930,
6333,
546,
3471,
14571,
29906,
1068,
29880,
876,
29930,
22367,
388,
13,
4706,
565,
599,
24669,
29974,
24669,
546,
24498,
3250,
29958,
29885,
3332,
29901,
13,
18884,
1855,
24669,
29922,
29885,
3332,
29899,
497,
24669,
13,
4706,
1683,
29901,
13,
18884,
1855,
24669,
29922,
24669,
546,
24498,
3250,
13,
4706,
599,
24669,
23661,
6370,
24669,
13,
4706,
269,
23661,
6370,
24669,
13,
12,
1482,
9175,
29922,
29890,
14571,
29883,
29893,
29906,
29930,
29879,
29897,
13,
12,
29890,
23661,
6370,
24669,
29930,
25376,
1454,
2571,
2616,
29930,
1482,
9175,
13,
4706,
716,
9175,
29922,
29890,
14571,
29883,
29893,
29906,
29930,
29879,
29897,
13,
4706,
289,
29906,
1761,
29889,
4397,
29898,
29890,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
269,
29906,
1761,
29889,
4397,
29898,
29879,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
282,
29906,
1761,
29889,
4397,
29898,
1482,
9175,
29930,
29896,
29900,
1068,
29941,
29897,
13,
29890,
29922,
29890,
29900,
13,
29879,
29922,
29879,
29900,
13,
6370,
24669,
29922,
497,
24669,
29922,
29900,
13,
1454,
474,
297,
260,
29901,
13,
4706,
301,
29922,
29875,
14571,
29941,
29953,
29945,
29930,
29946,
29974,
29896,
29897,
13,
4706,
7903,
546,
24498,
3250,
7607,
29896,
29889,
29900,
29930,
6333,
546,
3471,
14571,
29906,
1068,
29880,
876,
29930,
22367,
388,
13,
4706,
565,
599,
24669,
29974,
24669,
546,
24498,
3250,
29958,
29885,
3332,
29901,
13,
18884,
1855,
24669,
29922,
29885,
3332,
29899,
497,
24669,
13,
4706,
1683,
29901,
13,
18884,
1855,
24669,
29922,
24669,
546,
24498,
3250,
13,
12,
497,
24669,
23661,
6370,
24669,
13,
4706,
269,
23661,
6370,
24669,
13,
12,
1482,
9175,
29922,
29890,
14571,
29883,
29893,
29941,
29930,
29879,
29897,
13,
12,
29890,
23661,
6370,
24669,
29930,
25376,
1454,
2571,
2616,
29930,
1482,
9175,
13,
4706,
716,
9175,
29922,
29890,
14571,
29883,
29893,
29941,
29930,
29879,
29897,
13,
4706,
289,
29941,
1761,
29889,
4397,
29898,
29890,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
269,
29941,
1761,
29889,
4397,
29898,
29879,
29914,
29896,
29900,
1068,
29953,
29897,
13,
4706,
282,
29941,
1761,
29889,
4397,
29898,
1482,
9175,
29930,
29896,
29900,
1068,
29941,
29897,
13,
1028,
29922,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29896,
29897,
13,
1028,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29879,
29900,
1761,
511,
2780,
543,
8517,
1159,
13,
1028,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29879,
29896,
1761,
511,
2780,
543,
1127,
1159,
13,
1028,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29879,
29906,
1761,
511,
2780,
543,
12692,
1159,
13,
1028,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29879,
29941,
1761,
511,
2780,
543,
7979,
29891,
1159,
13,
25288,
29922,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29906,
29897,
13,
25288,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29890,
29900,
1761,
511,
2780,
543,
8517,
1159,
13,
25288,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29890,
29896,
1761,
511,
2780,
543,
1127,
1159,
13,
25288,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29890,
29906,
1761,
511,
2780,
543,
12692,
1159,
13,
25288,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29890,
29941,
1761,
511,
2780,
543,
7979,
29891,
1159,
13,
407,
29922,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29941,
29897,
13,
407,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29886,
29900,
1761,
511,
2780,
543,
8517,
1159,
13,
407,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29886,
29896,
1761,
511,
2780,
543,
1127,
1159,
13,
407,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29886,
29906,
1761,
511,
2780,
543,
12692,
1159,
13,
407,
29889,
5317,
29898,
29873,
29892,
9302,
29889,
2378,
29898,
29886,
29941,
1761,
511,
2780,
543,
7979,
29891,
1159,
13,
572,
29873,
29889,
26172,
580,
13,
572,
29873,
29889,
2214,
9629,
1839,
5657,
29889,
29879,
550,
29899,
643,
361,
2033,
29922,
1839,
1718,
16507,
10261,
1794,
315,
29940,
2033,
13,
407,
29889,
842,
29918,
3257,
877,
13026,
29899,
12742,
1495,
13,
407,
29889,
842,
29918,
29891,
1643,
703,
29896,
29900,
21583,
29941,
29923,
3267,
1159,
13,
1028,
29889,
842,
29918,
3257,
703,
20182,
368,
29899,
12742,
274,
29893,
289,
543,
29974,
710,
29898,
29883,
29893,
29900,
7240,
23901,
29878,
17969,
710,
29898,
29883,
29893,
29896,
7240,
23901,
29887,
17969,
710,
29898,
29883,
29893,
29906,
7240,
23901,
29891,
17969,
710,
29898,
29883,
29893,
29941,
7240,
29908,
6554,
543,
29974,
710,
29898,
25376,
1454,
2571,
2616,
876,
13,
1028,
29889,
842,
29918,
29891,
1643,
703,
29885,
29928,
2891,
1159,
13,
25288,
29889,
842,
29918,
3257,
703,
1666,
7143,
29899,
12742,
1159,
13,
25288,
29889,
842,
29918,
29891,
1643,
703,
29885,
29923,
3267,
1159,
13,
572,
29873,
29889,
29873,
523,
29918,
2680,
580,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
hackerrank/contests/30_days_of_code/operators-class-instance.py | spradeepv/dive-into-python | 0 | 111808 | """
Problem Statement
Welcome to Day 4! Check out a video review of logical operations here,
or just jump right into the problem.
Note: This task is focused on Object Oriented concepts, so it is only
enabled in a few languages.
You will create a class Person and write a constructor that takes an
integer, initial_Age. In this constructor, you should check that the
initial_Age is not negative because we can't have people with negative ages.
If the initial_Age is negative, set the instance's age equal to zero then print
"This person is not valid, setting age to 0."
without the quotations..
Inside of this class, you will also create an instance variable called age
and if initial_Age is not negative, then you will set age to equal the value
of initial_Age. In addition, you will write an instance method, amIOld(),
that prints whether people are old or not to the console.
In amIOld(), do the following things:
If the age of the Person instance is less than 13, then print "You are young."
If the age of the Person instance is equal or greater than 13, but less 18,
print "You are a teenager."
Otherwise, print "You are old."
In addition, create an instance function called yearPasses() that increases
the age of the person instance by one.
Much of the structure of the code is given to you below, but in the future,
you will write this. The code that will create instances of your Person
class is in the main function. You may not understand it all yet, but take a
look just to see what's going on. Do not change any of the variable names or
remove any of the code given.
Input Format
First line contains T, number of test cases. Each test case contains an
integer age, representing age of the person.
Constraints
1<=T<=4
-5<=age<=30
Output Format
The code that will test your methods is already in the editor. All you have
to do is edit the methods given to you in the editor so that they perform
correctly as stated above. If your methods are implemented correctly,
each testcase will print out either two or three lines.
If the age is less than zero, then your program should print out:
This person is not valid, setting age to 0.
You are young.
You are young.
If the age is equal or greater than 0, then your program should print out
two lines. The first line that the program prints out should be the output
of amIOld() on the current age. Then, three years pass via yearPasses() and
the second line the program prints should be the output of amIOld() after
the time has passed.
Sample Input
4
-1
10
16
18
Sample Output
This person is not valid, setting age to 0.
You are young.
You are young.
You are young.
You are a teenager.
You are a teenager.
You are old.
You are old.
You are old.
Explanation
For the first testcase, the age is less than 0 so we set the age to 0.Three
years pass and the age is 3. So we print out:
This person is not valid, setting age to 0.
You are young.
You are young.
For the second testcase, the age is 10, which is considered young according
to our program. Three years pass and the age is 13. 13 is considered a
'teenager' age so we print out:
You are young.
You are a teenager.
For the third testcase, the age is 16, which is the age of a teenager. Three
years pass and the age is 19. 19 is considered an 'old' age according to our
program so we print out:
You are a teenager.
You are old.
For the last testcase, the age is 18, which is considered an old age
according to our program. Three years pass and the age is 21. 21 is still
considered old so we print out:
You are old.
You are old.
"""
class Person:
def __init__(self, initial_Age):
# Add some more code to run some checks on initial_Age
if initial_Age < 0:
print "This person is not valid, setting age to 0."
self.initial_age = 0
self.age = initial_Age
def amIOld(self):
# Do some computations in here and print out the correct statement to
# the console
if self.age < 13:
print "You are young."
elif self.age >= 13 and self.age < 18:
print "You are a teenager."
else:
print "You are old."
def yearPasses(self):
# Increment the age of the person in here
self.age += 1
T = int(raw_input())
for i in range(0, T):
age = int(raw_input())
p = Person(age)
p.amIOld()
for j in range(0, 3):
p.yearPasses()
p.amIOld()
print ""
| [
1,
9995,
13,
26604,
6666,
882,
13,
13,
28862,
2763,
304,
8373,
29871,
29946,
29991,
5399,
714,
263,
4863,
9076,
310,
16667,
6931,
1244,
29892,
13,
272,
925,
12500,
1492,
964,
278,
1108,
29889,
13,
13,
9842,
29901,
910,
3414,
338,
21309,
373,
4669,
11678,
14927,
22001,
29892,
577,
372,
338,
871,
13,
17590,
297,
263,
2846,
10276,
29889,
13,
13,
3492,
674,
1653,
263,
770,
5196,
322,
2436,
263,
5823,
393,
4893,
385,
13,
16031,
29892,
2847,
29918,
22406,
29889,
512,
445,
5823,
29892,
366,
881,
1423,
393,
278,
13,
11228,
29918,
22406,
338,
451,
8178,
1363,
591,
508,
29915,
29873,
505,
2305,
411,
8178,
24646,
29889,
13,
13,
3644,
278,
2847,
29918,
22406,
338,
8178,
29892,
731,
278,
2777,
29915,
29879,
5046,
5186,
304,
5225,
769,
1596,
13,
13,
29908,
4013,
2022,
338,
451,
2854,
29892,
4444,
5046,
304,
29871,
29900,
1213,
13,
14037,
278,
13911,
800,
636,
13,
13,
797,
2975,
310,
445,
770,
29892,
366,
674,
884,
1653,
385,
2777,
2286,
2000,
5046,
13,
392,
565,
2847,
29918,
22406,
338,
451,
8178,
29892,
769,
366,
674,
731,
5046,
304,
5186,
278,
995,
13,
974,
2847,
29918,
22406,
29889,
512,
6124,
29892,
366,
674,
2436,
385,
2777,
1158,
29892,
626,
5971,
430,
3285,
13,
5747,
14677,
3692,
2305,
526,
2030,
470,
451,
304,
278,
2991,
29889,
13,
13,
797,
626,
5971,
430,
3285,
437,
278,
1494,
2712,
29901,
13,
13,
3644,
278,
5046,
310,
278,
5196,
2777,
338,
3109,
1135,
29871,
29896,
29941,
29892,
769,
1596,
376,
3492,
526,
4123,
1213,
13,
3644,
278,
5046,
310,
278,
5196,
2777,
338,
5186,
470,
7621,
1135,
29871,
29896,
29941,
29892,
541,
3109,
29871,
29896,
29947,
29892,
13,
2158,
376,
3492,
526,
263,
734,
264,
1875,
1213,
13,
16107,
3538,
29892,
1596,
376,
3492,
526,
2030,
1213,
13,
797,
6124,
29892,
1653,
385,
2777,
740,
2000,
1629,
7129,
267,
580,
393,
16415,
13,
1552,
5046,
310,
278,
2022,
2777,
491,
697,
29889,
13,
13,
29924,
987,
310,
278,
3829,
310,
278,
775,
338,
2183,
304,
366,
2400,
29892,
541,
297,
278,
5434,
29892,
13,
6293,
674,
2436,
445,
29889,
450,
775,
393,
674,
1653,
8871,
310,
596,
5196,
13,
1990,
338,
297,
278,
1667,
740,
29889,
887,
1122,
451,
2274,
372,
599,
3447,
29892,
541,
2125,
263,
13,
6914,
925,
304,
1074,
825,
29915,
29879,
2675,
373,
29889,
1938,
451,
1735,
738,
310,
278,
2286,
2983,
470,
13,
5992,
738,
310,
278,
775,
2183,
29889,
13,
13,
4290,
19191,
13,
13,
6730,
1196,
3743,
323,
29892,
1353,
310,
1243,
4251,
29889,
7806,
1243,
1206,
3743,
385,
13,
16031,
5046,
29892,
15783,
5046,
310,
278,
2022,
29889,
13,
13,
27427,
13,
29896,
14065,
29911,
14065,
29946,
13,
29899,
29945,
14065,
482,
14065,
29941,
29900,
13,
6466,
19191,
13,
13,
1576,
775,
393,
674,
1243,
596,
3519,
338,
2307,
297,
278,
6920,
29889,
2178,
366,
505,
13,
517,
437,
338,
3863,
278,
3519,
2183,
304,
366,
297,
278,
6920,
577,
393,
896,
2189,
13,
15728,
368,
408,
8703,
2038,
29889,
960,
596,
3519,
526,
8762,
5149,
29892,
13,
4204,
1243,
4878,
674,
1596,
714,
2845,
1023,
470,
2211,
3454,
29889,
13,
13,
3644,
278,
5046,
338,
3109,
1135,
5225,
29892,
769,
596,
1824,
881,
1596,
714,
29901,
13,
13,
4013,
2022,
338,
451,
2854,
29892,
4444,
5046,
304,
29871,
29900,
29889,
13,
3492,
526,
4123,
29889,
13,
3492,
526,
4123,
29889,
13,
3644,
278,
5046,
338,
5186,
470,
7621,
1135,
29871,
29900,
29892,
769,
596,
1824,
881,
1596,
714,
13,
10184,
3454,
29889,
450,
937,
1196,
393,
278,
1824,
14677,
714,
881,
367,
278,
1962,
13,
974,
626,
5971,
430,
580,
373,
278,
1857,
5046,
29889,
1987,
29892,
2211,
2440,
1209,
3025,
1629,
7129,
267,
580,
322,
13,
1552,
1473,
1196,
278,
1824,
14677,
881,
367,
278,
1962,
310,
626,
5971,
430,
580,
1156,
13,
1552,
931,
756,
4502,
29889,
13,
13,
17708,
10567,
13,
13,
29946,
13,
29899,
29896,
13,
29896,
29900,
13,
29896,
29953,
13,
29896,
29947,
13,
17708,
10604,
13,
13,
4013,
2022,
338,
451,
2854,
29892,
4444,
5046,
304,
29871,
29900,
29889,
13,
3492,
526,
4123,
29889,
13,
3492,
526,
4123,
29889,
13,
13,
3492,
526,
4123,
29889,
13,
3492,
526,
263,
734,
264,
1875,
29889,
13,
13,
3492,
526,
263,
734,
264,
1875,
29889,
13,
3492,
526,
2030,
29889,
13,
13,
3492,
526,
2030,
29889,
13,
3492,
526,
2030,
29889,
13,
1252,
9018,
362,
13,
13,
2831,
278,
937,
1243,
4878,
29892,
278,
5046,
338,
3109,
1135,
29871,
29900,
577,
591,
731,
278,
5046,
304,
29871,
29900,
29889,
28575,
13,
6360,
29879,
1209,
322,
278,
5046,
338,
29871,
29941,
29889,
1105,
591,
1596,
714,
29901,
13,
13,
4013,
2022,
338,
451,
2854,
29892,
4444,
5046,
304,
29871,
29900,
29889,
13,
3492,
526,
4123,
29889,
13,
3492,
526,
4123,
29889,
13,
2831,
278,
1473,
1243,
4878,
29892,
278,
5046,
338,
29871,
29896,
29900,
29892,
607,
338,
5545,
4123,
5034,
13,
517,
1749,
1824,
29889,
12753,
2440,
1209,
322,
278,
5046,
338,
29871,
29896,
29941,
29889,
29871,
29896,
29941,
338,
5545,
263,
13,
29915,
9404,
1875,
29915,
5046,
577,
591,
1596,
714,
29901,
13,
13,
3492,
526,
4123,
29889,
13,
3492,
526,
263,
734,
264,
1875,
29889,
13,
2831,
278,
4654,
1243,
4878,
29892,
278,
5046,
338,
29871,
29896,
29953,
29892,
607,
338,
278,
5046,
310,
263,
734,
264,
1875,
29889,
12753,
13,
6360,
29879,
1209,
322,
278,
5046,
338,
29871,
29896,
29929,
29889,
29871,
29896,
29929,
338,
5545,
385,
525,
1025,
29915,
5046,
5034,
304,
1749,
13,
8860,
577,
591,
1596,
714,
29901,
13,
13,
3492,
526,
263,
734,
264,
1875,
29889,
13,
3492,
526,
2030,
29889,
13,
2831,
278,
1833,
1243,
4878,
29892,
278,
5046,
338,
29871,
29896,
29947,
29892,
607,
338,
5545,
385,
2030,
5046,
13,
5753,
3278,
304,
1749,
1824,
29889,
12753,
2440,
1209,
322,
278,
5046,
338,
29871,
29906,
29896,
29889,
29871,
29906,
29896,
338,
1603,
13,
3200,
1241,
287,
2030,
577,
591,
1596,
714,
29901,
13,
13,
3492,
526,
2030,
29889,
13,
3492,
526,
2030,
29889,
13,
15945,
29908,
13,
13,
13,
1990,
5196,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2847,
29918,
22406,
1125,
13,
4706,
396,
3462,
777,
901,
775,
304,
1065,
777,
12747,
373,
2847,
29918,
22406,
13,
4706,
565,
2847,
29918,
22406,
529,
29871,
29900,
29901,
13,
9651,
1596,
376,
4013,
2022,
338,
451,
2854,
29892,
4444,
5046,
304,
29871,
29900,
1213,
13,
9651,
1583,
29889,
11228,
29918,
482,
353,
29871,
29900,
13,
4706,
1583,
29889,
482,
353,
2847,
29918,
22406,
13,
13,
1678,
822,
626,
5971,
430,
29898,
1311,
1125,
13,
4706,
396,
1938,
777,
2912,
800,
297,
1244,
322,
1596,
714,
278,
1959,
3229,
304,
13,
4706,
396,
278,
2991,
13,
4706,
565,
1583,
29889,
482,
529,
29871,
29896,
29941,
29901,
13,
9651,
1596,
376,
3492,
526,
4123,
1213,
13,
4706,
25342,
1583,
29889,
482,
6736,
29871,
29896,
29941,
322,
1583,
29889,
482,
529,
29871,
29896,
29947,
29901,
13,
9651,
1596,
376,
3492,
526,
263,
734,
264,
1875,
1213,
13,
4706,
1683,
29901,
13,
9651,
1596,
376,
3492,
526,
2030,
1213,
13,
13,
1678,
822,
1629,
7129,
267,
29898,
1311,
1125,
13,
4706,
396,
512,
17053,
278,
5046,
310,
278,
2022,
297,
1244,
13,
4706,
1583,
29889,
482,
4619,
29871,
29896,
13,
13,
13,
29911,
353,
938,
29898,
1610,
29918,
2080,
3101,
13,
1454,
474,
297,
3464,
29898,
29900,
29892,
323,
1125,
13,
1678,
5046,
353,
938,
29898,
1610,
29918,
2080,
3101,
13,
1678,
282,
353,
5196,
29898,
482,
29897,
13,
1678,
282,
29889,
314,
5971,
430,
580,
13,
1678,
363,
432,
297,
3464,
29898,
29900,
29892,
29871,
29941,
1125,
13,
4706,
282,
29889,
6360,
7129,
267,
580,
13,
1678,
282,
29889,
314,
5971,
430,
580,
13,
1678,
1596,
5124,
13,
2
] |
pyrobolearn/dynamics/nn.py | Pandinosaurus/pyrobolearn | 2 | 167349 | <reponame>Pandinosaurus/pyrobolearn
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides dynamic transition neural network approximators
For instance, a dynamic network is a function represented by a neural network that maps a state-action to the next
state.
"""
from pyrobolearn.approximators import NNApproximator, MLPApproximator
from pyrobolearn.dynamics.dynamic import ParametrizedDynamicModel
__author__ = "<NAME>"
__copyright__ = "Copyright 2018, PyRoboLearn"
__credits__ = ["<NAME>"]
__license__ = "GNU GPLv3"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
class NNDynamicModel(ParametrizedDynamicModel):
r"""Neural Network Dynamic Model
Dynamic model using neural networks.
Pros:
Cons: requires lot of samples, overfitting,...
"""
def __init__(self, state, action, model, next_state=None, distributions=None, preprocessors=None,
postprocessors=None):
"""
Initialize the NN dynamic model.
Args:
state (State): state inputs.
action (Action): action inputs.
next_state (State, None): state outputs. If None, it will take the state inputs as the outputs.
model (NNApproximator, NN): neural network model.
distributions (torch.distributions.Distribution): distribution to use to sample the next state. If None,
it will be deterministic.
preprocessors (Processor, list of Processor, None): pre-processors to be applied to the given input
postprocessors (Processor, list of Processor, None): post-processors to be applied to the output
"""
if model is None:
raise TypeError("Expecting the model to be a neural network and not None.")
elif not isinstance(model, NNApproximator):
if next_state is None:
next_state = state
model = NNApproximator(inputs=[state, action], outputs=next_state, model=model,
preprocessors=preprocessors, postprocessors=postprocessors)
super(NNDynamicModel, self).__init__(state, action, model=model, next_state=next_state,
distributions=distributions)
class MLPDynamicModel(NNDynamicModel):
r"""MLP Dynamic Model
"""
def __init__(self, state, action, next_state=None, hidden_units=(), activation='linear', last_activation=None,
dropout=None, distributions=None, preprocessors=None, postprocessors=None):
"""
Initialize the multi-layer perceptron model.
Args:
state (State): state inputs.
action (Action): action inputs.
next_state (State, None): state outputs. If None, it will take the state inputs as the outputs.
hidden_units (tuple, list of int): number of hidden units in each layer
activation (str): activation function to apply on each layer
last_activation (str, None): activation function to apply on the last layer
dropout (None, float): dropout probability
distributions (torch.distributions.Distribution): distribution to use to sample the next state. If None,
it will be deterministic.
preprocessors (Processor, list of Processor, None): pre-processors to be applied to the given input
postprocessors (Processor, list of Processor, None): post-processors to be applied to the output
"""
if next_state is None:
next_state = state
model = MLPApproximator(inputs=[state, action], outputs=next_state, hidden_units=hidden_units,
activation=activation, last_activation=last_activation,
dropout=dropout)
super(MLPDynamicModel, self).__init__(state, action, model=model, next_state=next_state,
distributions=distributions, preprocessors=preprocessors,
postprocessors=postprocessors)
| [
1,
529,
276,
1112,
420,
29958,
29925,
392,
262,
3628,
17142,
29914,
2272,
307,
833,
19668,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
1184,
29894,
2247,
7343,
9558,
19677,
3564,
6881,
4097,
13,
13,
2831,
2777,
29892,
263,
7343,
3564,
338,
263,
740,
9875,
491,
263,
19677,
3564,
393,
11053,
263,
2106,
29899,
2467,
304,
278,
2446,
13,
3859,
29889,
13,
15945,
29908,
13,
13,
3166,
11451,
307,
833,
19668,
29889,
9961,
2657,
4097,
1053,
405,
29940,
2052,
307,
2657,
1061,
29892,
341,
13208,
2052,
307,
2657,
1061,
13,
3166,
11451,
307,
833,
19668,
29889,
29881,
2926,
1199,
29889,
16626,
1053,
12662,
300,
7485,
287,
24001,
3195,
13,
13,
13,
1649,
8921,
1649,
353,
9872,
5813,
11903,
13,
1649,
8552,
1266,
1649,
353,
376,
11882,
1266,
29871,
29906,
29900,
29896,
29947,
29892,
10772,
21860,
29877,
29931,
799,
29876,
29908,
13,
1649,
11944,
1169,
1649,
353,
6796,
29966,
5813,
29958,
3108,
13,
1649,
506,
1947,
1649,
353,
376,
29954,
11601,
402,
7390,
29894,
29941,
29908,
13,
1649,
3259,
1649,
353,
376,
29896,
29889,
29900,
29889,
29900,
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,
21956,
358,
29908,
13,
13,
13,
1990,
405,
2797,
8739,
3195,
29898,
4736,
300,
7485,
287,
24001,
3195,
1125,
13,
1678,
364,
15945,
29908,
8139,
3631,
8527,
27747,
8125,
13,
13,
1678,
27747,
1904,
773,
19677,
14379,
29889,
13,
13,
1678,
1019,
29879,
29901,
13,
1678,
2138,
29901,
6858,
3287,
310,
11916,
29892,
975,
29888,
5367,
29892,
856,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29892,
3158,
29892,
1904,
29892,
2446,
29918,
3859,
29922,
8516,
29892,
18822,
29922,
8516,
29892,
758,
5014,
943,
29922,
8516,
29892,
13,
462,
1400,
5014,
943,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
25455,
278,
405,
29940,
7343,
1904,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2106,
313,
2792,
1125,
2106,
10970,
29889,
13,
9651,
3158,
313,
4276,
1125,
3158,
10970,
29889,
13,
9651,
2446,
29918,
3859,
313,
2792,
29892,
6213,
1125,
2106,
14391,
29889,
960,
6213,
29892,
372,
674,
2125,
278,
2106,
10970,
408,
278,
14391,
29889,
13,
9651,
1904,
313,
10262,
2052,
307,
2657,
1061,
29892,
405,
29940,
1125,
19677,
3564,
1904,
29889,
13,
9651,
18822,
313,
7345,
305,
29889,
27691,
29879,
29889,
13398,
3224,
1125,
4978,
304,
671,
304,
4559,
278,
2446,
2106,
29889,
960,
6213,
29892,
13,
18884,
372,
674,
367,
11806,
4695,
29889,
13,
9651,
758,
5014,
943,
313,
18689,
29892,
1051,
310,
10554,
272,
29892,
6213,
1125,
758,
29899,
5014,
943,
304,
367,
7436,
304,
278,
2183,
1881,
13,
9651,
1400,
5014,
943,
313,
18689,
29892,
1051,
310,
10554,
272,
29892,
6213,
1125,
1400,
29899,
5014,
943,
304,
367,
7436,
304,
278,
1962,
13,
4706,
9995,
13,
4706,
565,
1904,
338,
6213,
29901,
13,
9651,
12020,
20948,
703,
1252,
1103,
292,
278,
1904,
304,
367,
263,
19677,
3564,
322,
451,
6213,
23157,
13,
4706,
25342,
451,
338,
8758,
29898,
4299,
29892,
405,
29940,
2052,
307,
2657,
1061,
1125,
13,
9651,
565,
2446,
29918,
3859,
338,
6213,
29901,
13,
18884,
2446,
29918,
3859,
353,
2106,
13,
9651,
1904,
353,
405,
29940,
2052,
307,
2657,
1061,
29898,
2080,
29879,
11759,
3859,
29892,
3158,
1402,
14391,
29922,
4622,
29918,
3859,
29892,
1904,
29922,
4299,
29892,
13,
462,
462,
259,
758,
5014,
943,
29922,
1457,
5014,
943,
29892,
1400,
5014,
943,
29922,
2490,
5014,
943,
29897,
13,
4706,
2428,
29898,
29940,
2797,
8739,
3195,
29892,
1583,
467,
1649,
2344,
12035,
3859,
29892,
3158,
29892,
1904,
29922,
4299,
29892,
2446,
29918,
3859,
29922,
4622,
29918,
3859,
29892,
13,
462,
462,
632,
18822,
29922,
27691,
29879,
29897,
13,
13,
13,
1990,
341,
13208,
24001,
3195,
29898,
29940,
2797,
8739,
3195,
1125,
13,
1678,
364,
15945,
29908,
1988,
29925,
27747,
8125,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29892,
3158,
29892,
2446,
29918,
3859,
29922,
8516,
29892,
7934,
29918,
348,
1169,
29922,
3285,
26229,
2433,
10660,
742,
1833,
29918,
11236,
362,
29922,
8516,
29892,
13,
462,
5768,
449,
29922,
8516,
29892,
18822,
29922,
8516,
29892,
758,
5014,
943,
29922,
8516,
29892,
1400,
5014,
943,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
25455,
278,
2473,
29899,
13148,
639,
1547,
1617,
1904,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2106,
313,
2792,
1125,
2106,
10970,
29889,
13,
9651,
3158,
313,
4276,
1125,
3158,
10970,
29889,
13,
9651,
2446,
29918,
3859,
313,
2792,
29892,
6213,
1125,
2106,
14391,
29889,
960,
6213,
29892,
372,
674,
2125,
278,
2106,
10970,
408,
278,
14391,
29889,
13,
9651,
7934,
29918,
348,
1169,
313,
23583,
29892,
1051,
310,
938,
1125,
1353,
310,
7934,
10340,
297,
1269,
7546,
13,
9651,
26229,
313,
710,
1125,
26229,
740,
304,
3394,
373,
1269,
7546,
13,
9651,
1833,
29918,
11236,
362,
313,
710,
29892,
6213,
1125,
26229,
740,
304,
3394,
373,
278,
1833,
7546,
13,
9651,
5768,
449,
313,
8516,
29892,
5785,
1125,
5768,
449,
6976,
13,
9651,
18822,
313,
7345,
305,
29889,
27691,
29879,
29889,
13398,
3224,
1125,
4978,
304,
671,
304,
4559,
278,
2446,
2106,
29889,
960,
6213,
29892,
13,
18884,
372,
674,
367,
11806,
4695,
29889,
13,
9651,
758,
5014,
943,
313,
18689,
29892,
1051,
310,
10554,
272,
29892,
6213,
1125,
758,
29899,
5014,
943,
304,
367,
7436,
304,
278,
2183,
1881,
13,
9651,
1400,
5014,
943,
313,
18689,
29892,
1051,
310,
10554,
272,
29892,
6213,
1125,
1400,
29899,
5014,
943,
304,
367,
7436,
304,
278,
1962,
13,
4706,
9995,
13,
4706,
565,
2446,
29918,
3859,
338,
6213,
29901,
13,
9651,
2446,
29918,
3859,
353,
2106,
13,
4706,
1904,
353,
341,
13208,
2052,
307,
2657,
1061,
29898,
2080,
29879,
11759,
3859,
29892,
3158,
1402,
14391,
29922,
4622,
29918,
3859,
29892,
7934,
29918,
348,
1169,
29922,
10892,
29918,
348,
1169,
29892,
13,
462,
18884,
26229,
29922,
11236,
362,
29892,
1833,
29918,
11236,
362,
29922,
4230,
29918,
11236,
362,
29892,
13,
462,
18884,
5768,
449,
29922,
8865,
449,
29897,
13,
4706,
2428,
29898,
1988,
29925,
24001,
3195,
29892,
1583,
467,
1649,
2344,
12035,
3859,
29892,
3158,
29892,
1904,
29922,
4299,
29892,
2446,
29918,
3859,
29922,
4622,
29918,
3859,
29892,
13,
462,
462,
795,
18822,
29922,
27691,
29879,
29892,
758,
5014,
943,
29922,
1457,
5014,
943,
29892,
13,
462,
462,
795,
1400,
5014,
943,
29922,
2490,
5014,
943,
29897,
13,
2
] |
FortiJson/rpcrequest.py | talbiston/fortijson-rpc | 0 | 72869 | <reponame>talbiston/fortijson-rpc
import json
from collections import OrderedDict
import requests
def sort_request(request):
"""
Sort a JSON-RPC request dict.
This has no effect other than making the request nicer to read.
>>> json.dumps(sort_request(
... {'id': 2, 'params': [2, 3], 'method': 'add', 'jsonrpc': '2.0'}))
'{"jsonrpc": "2.0", "method": "add", "params": [2, 3], "id": 2}'
Args:
request: JSON-RPC request in dict format.
"""
sort_order = ["jsonrpc", "method", "params", "id", "session", "verbose"]
return OrderedDict(sorted(request.items(), key=lambda k: sort_order.index(k[0])))
def fix_keys(kwargs):
# get keys to change
change_keys = []
if kwargs:
for k in kwargs.keys():
if '_' in k:
change_keys.append(k)
#change keys
for i in change_keys:
left, right = i.split('_')
if left == 'meta':
kwargs[f'{left} {right}'] = kwargs.pop(i)
else:
kwargs[f'{left}-{right}'] = kwargs.pop(i)
return kwargs
class JsonRpc(dict): # type: ignore
def __init__(self, method: str, *args, **kwargs):
super().__init__(jsonrpc="2.0", method=method)
# Add the params to self.
kwargs = fix_keys(kwargs)
session = kwargs.pop('session', None)
verbose = kwargs.pop('verbose', None)
base_list = []
if args and kwargs:
# The 'params' can be *EITHER* "by-position" (a list) or "by-name" (a dict).
# Therefore, in this case it violates the JSON-RPC 2.0 specification.
# However, it provides the same behavior as the previous version of
# jsonrpcclient to keep compatibility.
# TODO: consider to raise a warning.
print("Args: ",args)
print("Kwargs:", kwargs)
params_list = list(args)
params_list.append(kwargs)
self.update(params=params_list)
self.update(session=session)
self.update(verbose=verbose)
elif args:
self.update(params=list(args))
self.update(session=session)
self.update(verbose=verbose)
elif kwargs:
base_list.append(kwargs)
self.update(params=base_list)
self.update(session=session)
self.update(verbose=verbose)
def __json__(self):
return sort_request(self)
class HTTPclient:
def __init__(self, baseUrl, timeOut=20):
self.baseUrl = baseUrl
self.timeout = timeOut
def send(self, json):
response = requests.post(self.baseUrl, json=json, timeout=self.timeout, verify=False)
return response
if __name__ == '__main__':
jrpc = JsonRpc('get', url='https://adc.com', session="123456789qwewerwert")
print(jrpc)
| [
1,
529,
276,
1112,
420,
29958,
20411,
29890,
391,
265,
29914,
3921,
823,
1100,
29899,
29878,
6739,
13,
5215,
4390,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
5215,
7274,
13,
13,
13,
13,
13,
1753,
2656,
29918,
3827,
29898,
3827,
1125,
13,
1678,
9995,
13,
1678,
20025,
263,
4663,
29899,
29934,
9026,
2009,
9657,
29889,
13,
13,
1678,
910,
756,
694,
2779,
916,
1135,
3907,
278,
2009,
16588,
261,
304,
1303,
29889,
13,
13,
4706,
8653,
4390,
29889,
29881,
17204,
29898,
6605,
29918,
3827,
29898,
13,
4706,
2023,
268,
11117,
333,
2396,
29871,
29906,
29892,
525,
7529,
2396,
518,
29906,
29892,
29871,
29941,
1402,
525,
5696,
2396,
525,
1202,
742,
525,
3126,
29878,
6739,
2396,
525,
29906,
29889,
29900,
10827,
876,
13,
4706,
525,
6377,
3126,
29878,
6739,
1115,
376,
29906,
29889,
29900,
613,
376,
5696,
1115,
376,
1202,
613,
376,
7529,
1115,
518,
29906,
29892,
29871,
29941,
1402,
376,
333,
1115,
29871,
29906,
10162,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
2009,
29901,
4663,
29899,
29934,
9026,
2009,
297,
9657,
3402,
29889,
13,
1678,
9995,
13,
1678,
2656,
29918,
2098,
353,
6796,
3126,
29878,
6739,
613,
376,
5696,
613,
376,
7529,
613,
376,
333,
613,
376,
7924,
613,
376,
369,
15828,
3108,
13,
1678,
736,
8170,
287,
21533,
29898,
24582,
29898,
3827,
29889,
7076,
3285,
1820,
29922,
2892,
413,
29901,
2656,
29918,
2098,
29889,
2248,
29898,
29895,
29961,
29900,
29962,
4961,
13,
13,
13,
1753,
2329,
29918,
8149,
29898,
19290,
1125,
13,
4706,
396,
679,
6611,
304,
1735,
13,
4706,
1735,
29918,
8149,
353,
5159,
13,
4706,
565,
9049,
5085,
29901,
13,
9651,
363,
413,
297,
9049,
5085,
29889,
8149,
7295,
13,
18884,
565,
22868,
29915,
297,
413,
29901,
13,
462,
1678,
1735,
29918,
8149,
29889,
4397,
29898,
29895,
29897,
13,
13,
4706,
396,
3167,
6611,
13,
4706,
363,
474,
297,
1735,
29918,
8149,
29901,
13,
9651,
2175,
29892,
1492,
353,
474,
29889,
5451,
877,
29918,
1495,
13,
9651,
565,
2175,
1275,
525,
7299,
2396,
13,
18884,
9049,
5085,
29961,
29888,
29915,
29912,
1563,
29913,
426,
1266,
29913,
2033,
353,
9049,
5085,
29889,
7323,
29898,
29875,
29897,
13,
9651,
1683,
29901,
268,
13,
18884,
9049,
5085,
29961,
29888,
29915,
29912,
1563,
7402,
29912,
1266,
29913,
2033,
353,
9049,
5085,
29889,
7323,
29898,
29875,
29897,
13,
4706,
736,
9049,
5085,
13,
13,
13,
1990,
14355,
29934,
6739,
29898,
8977,
1125,
29871,
396,
1134,
29901,
11455,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1158,
29901,
851,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
3126,
29878,
6739,
543,
29906,
29889,
29900,
613,
1158,
29922,
5696,
29897,
13,
4706,
396,
3462,
278,
8636,
304,
1583,
29889,
13,
13,
4706,
9049,
5085,
353,
2329,
29918,
8149,
29898,
19290,
29897,
13,
4706,
4867,
353,
9049,
5085,
29889,
7323,
877,
7924,
742,
6213,
29897,
13,
4706,
26952,
353,
9049,
5085,
29889,
7323,
877,
369,
15828,
742,
6213,
29897,
13,
4706,
2967,
29918,
1761,
353,
5159,
13,
4706,
565,
6389,
322,
9049,
5085,
29901,
13,
9651,
396,
450,
525,
7529,
29915,
508,
367,
334,
29923,
1806,
4448,
29930,
376,
1609,
29899,
3283,
29908,
313,
29874,
1051,
29897,
470,
376,
1609,
29899,
978,
29908,
313,
29874,
9657,
467,
13,
9651,
396,
7857,
29892,
297,
445,
1206,
372,
5537,
1078,
278,
4663,
29899,
29934,
9026,
29871,
29906,
29889,
29900,
21992,
29889,
13,
9651,
396,
2398,
29892,
372,
8128,
278,
1021,
6030,
408,
278,
3517,
1873,
310,
13,
9651,
396,
4390,
19080,
617,
1593,
304,
3013,
24521,
29889,
13,
9651,
396,
14402,
29901,
2050,
304,
12020,
263,
9177,
29889,
13,
13,
9651,
1596,
703,
7883,
29901,
9162,
5085,
29897,
13,
9651,
1596,
703,
29968,
29893,
5085,
29901,
613,
9049,
5085,
29897,
13,
13,
9651,
8636,
29918,
1761,
353,
1051,
29898,
5085,
29897,
13,
9651,
8636,
29918,
1761,
29889,
4397,
29898,
19290,
29897,
13,
9651,
1583,
29889,
5504,
29898,
7529,
29922,
7529,
29918,
1761,
29897,
13,
9651,
1583,
29889,
5504,
29898,
7924,
29922,
7924,
29897,
13,
9651,
1583,
29889,
5504,
29898,
369,
15828,
29922,
369,
15828,
29897,
13,
4706,
25342,
6389,
29901,
13,
9651,
1583,
29889,
5504,
29898,
7529,
29922,
1761,
29898,
5085,
876,
13,
9651,
1583,
29889,
5504,
29898,
7924,
29922,
7924,
29897,
13,
9651,
1583,
29889,
5504,
29898,
369,
15828,
29922,
369,
15828,
29897,
13,
4706,
25342,
9049,
5085,
29901,
13,
9651,
2967,
29918,
1761,
29889,
4397,
29898,
19290,
29897,
13,
9651,
1583,
29889,
5504,
29898,
7529,
29922,
3188,
29918,
1761,
29897,
13,
9651,
1583,
29889,
5504,
29898,
7924,
29922,
7924,
29897,
13,
9651,
1583,
29889,
5504,
29898,
369,
15828,
29922,
369,
15828,
29897,
13,
13,
1678,
822,
4770,
3126,
12035,
1311,
1125,
13,
13,
4706,
736,
2656,
29918,
3827,
29898,
1311,
29897,
13,
13,
13,
1990,
7331,
4645,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2967,
5983,
29892,
931,
3744,
29922,
29906,
29900,
1125,
13,
4706,
1583,
29889,
3188,
5983,
353,
2967,
5983,
13,
4706,
1583,
29889,
15619,
353,
931,
3744,
13,
13,
13,
1678,
822,
3638,
29898,
1311,
29892,
4390,
1125,
13,
13,
4706,
2933,
353,
7274,
29889,
2490,
29898,
1311,
29889,
3188,
5983,
29892,
4390,
29922,
3126,
29892,
11815,
29922,
1311,
29889,
15619,
29892,
11539,
29922,
8824,
29897,
13,
4706,
736,
2933,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
432,
29878,
6739,
353,
14355,
29934,
6739,
877,
657,
742,
3142,
2433,
991,
597,
328,
29883,
29889,
510,
742,
4867,
543,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
29939,
705,
556,
16347,
1159,
13,
1678,
1596,
29898,
29926,
29878,
6739,
29897,
13,
2
] |
liqian/crawl_dblp.py | doge-search/webdoge | 0 | 73232 | <gh_stars>0
#!/usr/bin/python
#coding=utf-8
import requests
from lxml import etree
from collections import namedtuple
import sys
#f_handler = open('out.log', 'w')
#sys.stdout = f_handler
DBLP_BASE_URL = 'http://dblp.uni-trier.de/'
DBLP_AUTHOR_SEARCH_URL = DBLP_BASE_URL + 'search/author'
DBLP_PERSON_URL = DBLP_BASE_URL + 'pers/xk/{urlpt}'
DBLP_PUBLICATION_URL = DBLP_BASE_URL + 'rec/bibtex/{key}.xml'
class LazyAPIData(object):
def __init__(self, lazy_attrs):
self.lazy_attrs = set(lazy_attrs)
self.data = None
def __getattr__(self, key):
if key in self.lazy_attrs:
if self.data is None:
self.load_data()
return self.data[key]
raise AttributeError, key
def load_data(self):
pass
class Author(LazyAPIData):
"""
Represents a DBLP author. All data but the author's key is lazily loaded.
Fields that aren't provided by the underlying XML are None.
Attributes:
name - the author's primary name record
publications - a list of lazy-loaded Publications results by this author
homepages - a list of author homepage URLs
homonyms - a list of author aliases
"""
def __init__(self, urlpt):
self.urlpt = urlpt
self.xml = None
super(Author, self).__init__(['name','publications','homepages',
'homonyms'])
def load_data(self):
resp = requests.get(DBLP_PERSON_URL.format(urlpt=self.urlpt))
# TODO error handling
xml = resp.content
self.xml = xml
root = etree.fromstring(xml)
data = {
'name':root.attrib['name'],
'publications':[Publication(k) for k in
root.xpath('/dblpperson/dblpkey[not(@type)]/text()')],
'homepages':root.xpath(
'/dblpperson/dblpkey[@type="person record"]/text()'),
'homonyms':root.xpath('/dblpperson/homonym/text()')
}
self.data = data
def first_or_none(seq):
try:
return next(iter(seq))
except StopIteration:
pass
Publisher = namedtuple('Publisher', ['name', 'href'])
Series = namedtuple('Series', ['text','href'])
Citation = namedtuple('Citation', ['reference','label'])
class Publication(LazyAPIData):
"""
Represents a DBLP publication- eg, article, inproceedings, etc. All data but
the key is lazily loaded. Fields that aren't provided by the underlying XML
are None.
Attributes:
type - the publication type, eg "article", "inproceedings", "proceedings",
"incollection", "book", "phdthesis", "mastersthessis"
sub_type - further type information, if provided- eg, "encyclopedia entry",
"informal publication", "survey"
title - the title of the work
authors - a list of author names
journal - the journal the work was published in, if applicable
volume - the volume, if applicable
number - the number, if applicable
chapter - the chapter, if this work is part of a book or otherwise
applicable
pages - the page numbers of the work, if applicable
isbn - the ISBN for works that have them
ee - an ee URL
crossref - a crossrel relative URL
publisher - the publisher, returned as a (name, href) named tuple
citations - a list of (text, label) named tuples representing cited works
series - a (text, href) named tuple describing the containing series, if
applicable
"""
def __init__(self, key):
self.key = key
self.xml = None
super(Publication, self).__init__( ['type', 'sub_type', 'mdate',
'authors', 'editors', 'title', 'year', 'month', 'journal',
'volume', 'number', 'chapter', 'pages', 'ee', 'isbn', 'url',
'booktitle', 'crossref', 'publisher', 'school', 'citations',
'series'])
def load_data(self):
resp = requests.get(DBLP_PUBLICATION_URL.format(key=self.key))
xml = resp.content
self.xml = xml
root = etree.fromstring(xml)
publication = first_or_none(root.xpath('/dblp/*[1]'))
if publication is None:
raise ValueError
data = {
'type':publication.tag,
'sub_type':publication.attrib.get('publtype', None),
'mdate':publication.attrib.get('mdate', None),
'authors':publication.xpath('author/text()'),
'editors':publication.xpath('editor/text()'),
'title':first_or_none(publication.xpath('title/text()')),
'year':int(first_or_none(publication.xpath('year/text()'))),
'month':first_or_none(publication.xpath('month/text()')),
'journal':first_or_none(publication.xpath('journal/text()')),
'volume':first_or_none(publication.xpath('volume/text()')),
'number':first_or_none(publication.xpath('number/text()')),
'chapter':first_or_none(publication.xpath('chapter/text()')),
'pages':first_or_none(publication.xpath('pages/text()')),
'ee':first_or_none(publication.xpath('ee/text()')),
'isbn':first_or_none(publication.xpath('isbn/text()')),
'url':first_or_none(publication.xpath('url/text()')),
'booktitle':first_or_none(publication.xpath('booktitle/text()')),
'crossref':first_or_none(publication.xpath('crossref/text()')),
'publisher':first_or_none(publication.xpath('publisher/text()')),
'school':first_or_none(publication.xpath('school/text()')),
'citations':[Citation(c.text, c.attrib.get('label',None))
for c in publication.xpath('cite') if c.text != '...'],
'series':first_or_none(Series(s.text, s.attrib.get('href', None))
for s in publication.xpath('series'))
}
self.data = data
def dblp_search(author_str):
resp = requests.get(DBLP_AUTHOR_SEARCH_URL, params={'xauthor':author_str})
#TODO error handling
root = etree.fromstring(resp.content)
return [Author(urlpt) for urlpt in root.xpath('/authors/author/@urlpt')]
import urllib2
import HTMLParser
import xml.dom.minidom as minidom
from htmlentitydefs import entitydefs
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import glob
import os
reload(sys)
sys.setdefaultencoding('utf-8')
schools = [#'brown', 'Caltech', 'columbia', 'duke',
'harvard', 'JHU', 'northwestern', 'NYU', 'OSU', 'PSU', 'purdue', 'rice', 'UCI', 'UCLA', 'UCSD', 'UMASS', 'UMD', 'umich', 'UMN', 'UNC',
'upenn', 'USC', 'virginia', 'WISC', 'yale']
def search(ini_name):
name = ini_name.strip()
nname = name.split(',')
if len(nname) > 1:
name = nname[1] + ' ' + nname[0]
authors = dblp_search(' ' + name + ' ')
author_num = len(authors)
if not authors:
print "not found: " + name.encode('utf-8') + '\n'
sys.stdout.flush()
return (ini_name, -1)
else:
if author_num > 10:
print "multiple: " + str(author_num) + ' ' + name.encode('utf-8') + '\n'
sys.stdout.flush()
cnt = 0
index = 0
if author_num > 1:
for indx in range(author_num):
if authors[indx].name == name:
#print "match!" + name
break
index += 1
if index == len(authors):
print "not found in the list!" + name + ' compare with ' + authors[0].name.encode('utf-8') + ' use default 0...' + '\n'
sys.stdout.flush()
index = 0
publications = authors[index].publications
profname = authors[index].name
for pub in publications:
auth_len = len(pub.authors)
pub_authors = []
for i in range(auth_len):
pub_authors.append(pub.authors[i])
try: idx = pub_authors.index(profname)
except ValueError:
split_name = profname.split(' ')
#profname = split_name[0] + ' ' + split_name[1][0] + '. ' + split_name[-1] #change middle name
idx = 0
for i in range(auth_len):
pub_split = pub_authors[i].split(' ')
if pub_split[0] == split_name[0] and pub_split[-1] == split_name[-1]:
break
idx += 1
if idx == auth_len:
print pub.title.encode('utf-8') + '\m'
sys.stdout.flush()
#print pub.authors
idx = -1
if idx >= 0:
cnt += 1.0 / (idx + 1)
return (ini_name, cnt)
if __name__ == "__main__":
for school in schools:
print "=== start crawling school:" + school + '\n'
sys.stdout.flush()
filename = school + '/' + school + '.xml'
if not os.path.isfile(filename):
print "cannot find: " + filename + '\n'
sys.stdout.flush()
continue
tree = ET.ElementTree(file = filename)
fout_xml = file(school+'/'+school+'_sort.xml', 'w')
doc = minidom.Document()
institution = doc.createElement("institution")
doc.appendChild(institution)
for prof in tree.getroot():
for info in prof:
if info.tag == 'name':
name, cnt = search(info.text)
print school + ': ' + name.encode('utf-8') + ' with score: ' + "%.4f" % cnt + '\n'
sys.stdout.flush()
professor = doc.createElement("professor")
namenode = doc.createElement("name")
namenode.appendChild(doc.createTextNode(name))
professor.appendChild(namenode)
papernode = doc.createElement("papers")
papernode.appendChild(doc.createTextNode(str(cnt)))
professor.appendChild(papernode)
institution.appendChild(professor)
doc.writexml(fout_xml, "\t", "\t", "\n")
fout_xml.close()
print "=== finished crawling: " + school + '\n'
sys.stdout.flush()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
30004,
13,
29937,
29883,
3689,
29922,
9420,
29899,
29947,
30004,
13,
5215,
7274,
30004,
13,
3166,
301,
3134,
1053,
634,
929,
30004,
13,
3166,
16250,
1053,
4257,
23583,
30004,
13,
5215,
10876,
30004,
13,
29937,
29888,
29918,
13789,
353,
1722,
877,
449,
29889,
1188,
742,
525,
29893,
1495,
30004,
13,
29937,
9675,
29889,
25393,
353,
285,
29918,
13789,
30004,
13,
30004,
13,
4051,
13208,
29918,
25416,
29918,
4219,
353,
525,
1124,
597,
29881,
2204,
29886,
29889,
3909,
29899,
3626,
261,
29889,
311,
22208,
30004,
13,
4051,
13208,
29918,
20656,
29950,
1955,
29918,
1660,
1718,
3210,
29918,
4219,
353,
6535,
13208,
29918,
25416,
29918,
4219,
718,
525,
4478,
29914,
8921,
29915,
30004,
13,
30004,
13,
4051,
13208,
29918,
13171,
3094,
29918,
4219,
353,
6535,
13208,
29918,
25416,
29918,
4219,
718,
525,
6774,
29914,
29916,
29895,
19248,
2271,
415,
10162,
30004,
13,
4051,
13208,
29918,
7056,
13367,
28541,
29918,
4219,
353,
6535,
13208,
29918,
25416,
29918,
4219,
718,
525,
3757,
29914,
18508,
4776,
19248,
1989,
1836,
3134,
29915,
30004,
13,
30004,
13,
1990,
19575,
29891,
3301,
1367,
532,
29898,
3318,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
17366,
29918,
5552,
29879,
1125,
30004,
13,
4706,
1583,
29889,
433,
1537,
29918,
5552,
29879,
353,
731,
29898,
433,
1537,
29918,
5552,
29879,
8443,
13,
4706,
1583,
29889,
1272,
353,
6213,
30004,
13,
30004,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
1820,
1125,
30004,
13,
4706,
565,
1820,
297,
1583,
29889,
433,
1537,
29918,
5552,
29879,
29901,
30004,
13,
9651,
565,
1583,
29889,
1272,
338,
6213,
29901,
30004,
13,
18884,
1583,
29889,
1359,
29918,
1272,
26471,
13,
9651,
736,
1583,
29889,
1272,
29961,
1989,
29962,
30004,
13,
4706,
12020,
23833,
2392,
29892,
1820,
30004,
13,
30004,
13,
1678,
822,
2254,
29918,
1272,
29898,
1311,
1125,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
1990,
13361,
29898,
29931,
24683,
3301,
1367,
532,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
830,
4569,
1237,
263,
6535,
13208,
4148,
29889,
2178,
848,
541,
278,
4148,
29915,
29879,
1820,
338,
425,
29920,
2354,
7500,
22993,
13,
1678,
8989,
29879,
393,
9455,
29915,
29873,
4944,
491,
278,
14407,
6560,
526,
6213,
22993,
13,
1678,
6212,
5026,
29901,
30004,
13,
1678,
1024,
448,
278,
4148,
29915,
29879,
7601,
1024,
2407,
30004,
13,
1678,
25964,
448,
263,
1051,
310,
17366,
29899,
15638,
22865,
2582,
491,
445,
4148,
30004,
13,
1678,
3271,
12292,
448,
263,
1051,
310,
4148,
3271,
3488,
24295,
30004,
13,
1678,
3632,
4735,
29879,
448,
263,
1051,
310,
4148,
14430,
2129,
30004,
13,
1678,
9995,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3142,
415,
1125,
30004,
13,
4706,
1583,
29889,
2271,
415,
353,
3142,
415,
30004,
13,
4706,
1583,
29889,
3134,
353,
6213,
30004,
13,
4706,
2428,
29898,
13720,
29892,
1583,
467,
1649,
2344,
12035,
1839,
978,
3788,
3597,
800,
3788,
5184,
12292,
23592,
13,
462,
462,
418,
525,
9706,
4735,
29879,
2033,
8443,
13,
30004,
13,
1678,
822,
2254,
29918,
1272,
29898,
1311,
1125,
30004,
13,
4706,
4613,
353,
7274,
29889,
657,
29898,
4051,
13208,
29918,
13171,
3094,
29918,
4219,
29889,
4830,
29898,
2271,
415,
29922,
1311,
29889,
2271,
415,
876,
30004,
13,
4706,
396,
14402,
1059,
11415,
30004,
13,
4706,
4903,
353,
4613,
29889,
3051,
30004,
13,
4706,
1583,
29889,
3134,
353,
4903,
30004,
13,
4706,
3876,
353,
634,
929,
29889,
3166,
1807,
29898,
3134,
8443,
13,
4706,
848,
353,
3336,
13,
9651,
525,
978,
2396,
4632,
29889,
1131,
1091,
1839,
978,
7464,
30004,
13,
9651,
525,
3597,
800,
2396,
29961,
19858,
362,
29898,
29895,
29897,
363,
413,
297,
6756,
13,
462,
9651,
3876,
29889,
23635,
11219,
29881,
2204,
407,
1330,
29914,
29881,
2204,
29886,
1989,
29961,
1333,
10394,
1853,
4638,
29914,
726,
580,
1495,
1402,
30004,
13,
9651,
525,
5184,
12292,
2396,
4632,
29889,
23635,
29898,
30004,
13,
18884,
8207,
29881,
2204,
407,
1330,
29914,
29881,
2204,
29886,
1989,
17548,
1853,
543,
10532,
2407,
3108,
29914,
726,
580,
5477,
30004,
13,
9651,
525,
9706,
4735,
29879,
2396,
4632,
29889,
23635,
11219,
29881,
2204,
407,
1330,
29914,
9706,
4735,
29914,
726,
580,
1495,
30004,
13,
4706,
4970,
13,
30004,
13,
4706,
1583,
29889,
1272,
353,
848,
30004,
13,
30004,
13,
1753,
937,
29918,
272,
29918,
9290,
29898,
11762,
1125,
30004,
13,
1678,
1018,
29901,
30004,
13,
4706,
736,
2446,
29898,
1524,
29898,
11762,
876,
30004,
13,
1678,
5174,
22303,
13463,
362,
29901,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
21076,
1674,
261,
353,
4257,
23583,
877,
21076,
1674,
261,
742,
6024,
978,
742,
525,
12653,
2033,
8443,
13,
19204,
353,
4257,
23583,
877,
19204,
742,
6024,
726,
3788,
12653,
2033,
8443,
13,
29907,
7018,
353,
4257,
23583,
877,
29907,
7018,
742,
6024,
5679,
3788,
1643,
2033,
8443,
13,
30004,
13,
1990,
5236,
362,
29898,
29931,
24683,
3301,
1367,
532,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
830,
4569,
1237,
263,
6535,
13208,
17745,
29899,
8087,
29892,
4274,
29892,
297,
771,
3947,
886,
29892,
2992,
29889,
2178,
848,
541,
30004,
13,
1678,
278,
1820,
338,
425,
29920,
2354,
7500,
29889,
8989,
29879,
393,
9455,
29915,
29873,
4944,
491,
278,
14407,
6560,
30004,
13,
1678,
526,
6213,
22993,
13,
1678,
6212,
5026,
29901,
30004,
13,
1678,
1134,
448,
278,
17745,
1134,
29892,
8087,
376,
7914,
613,
376,
262,
771,
3947,
886,
613,
376,
771,
3947,
886,
15231,
13,
1678,
376,
262,
10855,
613,
376,
2909,
613,
376,
561,
29881,
26533,
613,
376,
6207,
303,
29882,
404,
275,
19451,
13,
1678,
1014,
29918,
1853,
448,
4340,
1134,
2472,
29892,
565,
4944,
29899,
8087,
29892,
376,
3819,
29883,
9547,
6251,
15231,
13,
1678,
376,
262,
689,
284,
17745,
613,
376,
7610,
6950,
19451,
13,
1678,
3611,
448,
278,
3611,
310,
278,
664,
30004,
13,
1678,
15717,
448,
263,
1051,
310,
4148,
2983,
30004,
13,
1678,
8955,
448,
278,
8955,
278,
664,
471,
6369,
297,
29892,
565,
22903,
30004,
13,
1678,
7977,
448,
278,
7977,
29892,
565,
22903,
30004,
13,
1678,
1353,
448,
278,
1353,
29892,
565,
22903,
30004,
13,
1678,
16385,
448,
278,
16385,
29892,
565,
445,
664,
338,
760,
310,
263,
3143,
470,
6467,
30004,
13,
1678,
22903,
30004,
13,
1678,
6515,
448,
278,
1813,
3694,
310,
278,
664,
29892,
565,
22903,
30004,
13,
1678,
338,
11197,
448,
278,
2210,
363,
1736,
393,
505,
963,
30004,
13,
1678,
321,
29872,
448,
385,
321,
29872,
3988,
30004,
13,
1678,
4891,
999,
448,
263,
4891,
2674,
6198,
3988,
30004,
13,
1678,
9805,
261,
448,
278,
9805,
261,
29892,
4133,
408,
263,
313,
978,
29892,
2822,
29897,
4257,
18761,
30004,
13,
1678,
7537,
800,
448,
263,
1051,
310,
313,
726,
29892,
3858,
29897,
4257,
5291,
2701,
15783,
274,
1573,
1736,
30004,
13,
1678,
3652,
448,
263,
313,
726,
29892,
2822,
29897,
4257,
18761,
20766,
278,
6943,
3652,
29892,
565,
30004,
13,
1678,
22903,
30004,
13,
1678,
9995,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1820,
1125,
30004,
13,
4706,
1583,
29889,
1989,
353,
1820,
30004,
13,
4706,
1583,
29889,
3134,
353,
6213,
30004,
13,
4706,
2428,
29898,
19858,
362,
29892,
1583,
467,
1649,
2344,
12035,
6024,
1853,
742,
525,
1491,
29918,
1853,
742,
525,
29885,
1256,
23592,
13,
18884,
525,
5150,
943,
742,
525,
5628,
943,
742,
525,
3257,
742,
525,
6360,
742,
525,
10874,
742,
525,
29926,
4659,
23592,
13,
18884,
525,
24623,
742,
525,
4537,
742,
525,
27349,
742,
525,
12292,
742,
525,
3905,
742,
525,
275,
11197,
742,
525,
2271,
23592,
13,
18884,
525,
2909,
3257,
742,
525,
19128,
999,
742,
525,
23679,
261,
742,
525,
27041,
742,
525,
20752,
800,
23592,
13,
18884,
525,
13757,
2033,
8443,
13,
30004,
13,
1678,
822,
2254,
29918,
1272,
29898,
1311,
1125,
30004,
13,
4706,
4613,
353,
7274,
29889,
657,
29898,
4051,
13208,
29918,
7056,
13367,
28541,
29918,
4219,
29889,
4830,
29898,
1989,
29922,
1311,
29889,
1989,
876,
30004,
13,
4706,
4903,
353,
4613,
29889,
3051,
30004,
13,
4706,
1583,
29889,
3134,
353,
4903,
30004,
13,
4706,
3876,
353,
634,
929,
29889,
3166,
1807,
29898,
3134,
8443,
13,
4706,
17745,
353,
937,
29918,
272,
29918,
9290,
29898,
4632,
29889,
23635,
11219,
29881,
2204,
29886,
5515,
29961,
29896,
29962,
8785,
30004,
13,
4706,
565,
17745,
338,
6213,
29901,
30004,
13,
9651,
12020,
7865,
2392,
30004,
13,
4706,
848,
353,
3336,
13,
9651,
525,
1853,
2396,
3597,
362,
29889,
4039,
11167,
13,
9651,
525,
1491,
29918,
1853,
2396,
3597,
362,
29889,
1131,
1091,
29889,
657,
877,
5467,
29880,
1853,
742,
6213,
511,
30004,
13,
9651,
525,
29885,
1256,
2396,
3597,
362,
29889,
1131,
1091,
29889,
657,
877,
29885,
1256,
742,
6213,
511,
30004,
13,
9651,
525,
5150,
943,
2396,
3597,
362,
29889,
23635,
877,
8921,
29914,
726,
580,
5477,
30004,
13,
9651,
525,
5628,
943,
2396,
3597,
362,
29889,
23635,
877,
15204,
29914,
726,
580,
5477,
30004,
13,
9651,
525,
3257,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
3257,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
6360,
2396,
524,
29898,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
6360,
29914,
726,
580,
8785,
511,
30004,
13,
9651,
525,
10874,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
10874,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
29926,
4659,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
29926,
4659,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
24623,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
24623,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
4537,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
4537,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
27349,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
27349,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
12292,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
12292,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
3905,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
3905,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
275,
11197,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
275,
11197,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
2271,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
2271,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
2909,
3257,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
2909,
3257,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
19128,
999,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
19128,
999,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
23679,
261,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
23679,
261,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
27041,
2396,
4102,
29918,
272,
29918,
9290,
29898,
3597,
362,
29889,
23635,
877,
27041,
29914,
726,
580,
1495,
511,
30004,
13,
9651,
525,
20752,
800,
2396,
29961,
29907,
7018,
29898,
29883,
29889,
726,
29892,
274,
29889,
1131,
1091,
29889,
657,
877,
1643,
742,
8516,
876,
30004,
13,
462,
308,
363,
274,
297,
17745,
29889,
23635,
877,
2036,
1495,
565,
274,
29889,
726,
2804,
525,
856,
7464,
30004,
13,
9651,
525,
13757,
2396,
4102,
29918,
272,
29918,
9290,
29898,
19204,
29898,
29879,
29889,
726,
29892,
269,
29889,
1131,
1091,
29889,
657,
877,
12653,
742,
6213,
876,
30004,
13,
462,
418,
363,
269,
297,
17745,
29889,
23635,
877,
13757,
8785,
30004,
13,
4706,
4970,
13,
30004,
13,
4706,
1583,
29889,
1272,
353,
848,
30004,
13,
30004,
13,
1753,
270,
2204,
29886,
29918,
4478,
29898,
8921,
29918,
710,
1125,
30004,
13,
1678,
4613,
353,
7274,
29889,
657,
29898,
4051,
13208,
29918,
20656,
29950,
1955,
29918,
1660,
1718,
3210,
29918,
4219,
29892,
8636,
3790,
29915,
29916,
8921,
2396,
8921,
29918,
710,
1800,
30004,
13,
1678,
396,
4986,
3970,
1059,
11415,
30004,
13,
1678,
3876,
353,
634,
929,
29889,
3166,
1807,
29898,
13713,
29889,
3051,
8443,
13,
1678,
736,
518,
13720,
29898,
2271,
415,
29897,
363,
3142,
415,
297,
3876,
29889,
23635,
11219,
5150,
943,
29914,
8921,
29368,
2271,
415,
1495,
29962,
30004,
13,
30004,
13,
30004,
13,
5215,
3142,
1982,
29906,
30004,
13,
5215,
4544,
11726,
30004,
13,
5215,
4903,
29889,
3129,
29889,
1195,
333,
290,
408,
1375,
333,
290,
30004,
13,
3166,
3472,
10041,
1753,
29879,
1053,
7855,
1753,
29879,
30004,
13,
2202,
29901,
30004,
13,
12,
5215,
4903,
29889,
300,
929,
29889,
29883,
2642,
9643,
408,
382,
29911,
30004,
13,
19499,
16032,
2392,
29901,
30004,
13,
12,
5215,
4903,
29889,
300,
929,
29889,
2642,
9643,
408,
382,
29911,
30004,
13,
5215,
13149,
30004,
13,
5215,
2897,
30004,
13,
30004,
13,
28120,
29898,
9675,
8443,
13,
9675,
29889,
842,
4381,
22331,
877,
9420,
29899,
29947,
1495,
30004,
13,
816,
8789,
353,
518,
29937,
29915,
29890,
4708,
742,
525,
7856,
11345,
742,
525,
1054,
3774,
423,
742,
525,
700,
446,
742,
6756,
13,
12,
12,
12,
29915,
8222,
16927,
742,
525,
29967,
29950,
29965,
742,
525,
29876,
2072,
22741,
742,
525,
29940,
29979,
29965,
742,
525,
3267,
29965,
742,
525,
7024,
29965,
742,
525,
15503,
29123,
742,
525,
11674,
742,
525,
29965,
8426,
742,
525,
29965,
13875,
742,
525,
23129,
7230,
742,
525,
29965,
1529,
1799,
742,
525,
5005,
29928,
742,
525,
398,
436,
742,
525,
29127,
742,
525,
3904,
29907,
23592,
13,
12,
12,
12,
29915,
786,
2108,
742,
525,
3308,
29907,
742,
525,
2405,
5359,
423,
742,
525,
29956,
3235,
29907,
742,
525,
29891,
744,
2033,
30004,
13,
1753,
2740,
29898,
2172,
29918,
978,
1125,
30004,
13,
12,
978,
353,
297,
29875,
29918,
978,
29889,
17010,
26471,
13,
12,
29876,
978,
353,
1024,
29889,
5451,
29317,
1495,
30004,
13,
12,
361,
7431,
29898,
29876,
978,
29897,
1405,
29871,
29896,
29901,
30004,
13,
12,
12,
978,
353,
302,
978,
29961,
29896,
29962,
718,
525,
525,
718,
302,
978,
29961,
29900,
29962,
30004,
13,
12,
5150,
943,
353,
270,
2204,
29886,
29918,
4478,
877,
12,
29915,
718,
1024,
718,
525,
12,
1495,
30004,
13,
12,
8921,
29918,
1949,
353,
7431,
29898,
5150,
943,
8443,
13,
30004,
13,
12,
361,
451,
15717,
29901,
30004,
13,
12,
12,
2158,
376,
1333,
1476,
29901,
376,
718,
1024,
29889,
12508,
877,
9420,
29899,
29947,
1495,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
2457,
313,
2172,
29918,
978,
29892,
448,
29896,
8443,
13,
12,
2870,
29901,
30004,
13,
12,
12,
361,
4148,
29918,
1949,
1405,
29871,
29896,
29900,
29901,
30004,
13,
12,
12,
12,
2158,
376,
20787,
29901,
376,
718,
851,
29898,
8921,
29918,
1949,
29897,
718,
525,
525,
718,
1024,
29889,
12508,
877,
9420,
29899,
29947,
1495,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
30004,
13,
12,
20047,
353,
29871,
29900,
30004,
13,
12,
2248,
353,
29871,
29900,
30004,
13,
12,
361,
4148,
29918,
1949,
1405,
29871,
29896,
29901,
30004,
13,
12,
12,
1454,
1399,
29916,
297,
3464,
29898,
8921,
29918,
1949,
1125,
30004,
13,
12,
12,
12,
361,
15717,
29961,
513,
29916,
1822,
978,
1275,
1024,
29901,
30004,
13,
12,
12,
12,
12,
29937,
2158,
376,
4352,
3850,
718,
1024,
30004,
13,
12,
12,
12,
12,
8690,
30004,
13,
12,
12,
12,
2248,
4619,
29871,
29896,
30004,
13,
12,
12,
361,
2380,
1275,
7431,
29898,
5150,
943,
1125,
30004,
13,
12,
12,
12,
2158,
376,
1333,
1476,
297,
278,
1051,
3850,
718,
1024,
718,
525,
7252,
411,
525,
718,
15717,
29961,
29900,
1822,
978,
29889,
12508,
877,
9420,
29899,
29947,
1495,
718,
525,
671,
2322,
29871,
29900,
856,
29915,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
12,
2248,
353,
29871,
29900,
30004,
13,
30004,
13,
12,
3597,
800,
353,
15717,
29961,
2248,
1822,
3597,
800,
30004,
13,
12,
23221,
978,
353,
15717,
29961,
2248,
1822,
978,
30004,
13,
12,
1454,
2529,
297,
25964,
29901,
30004,
13,
12,
12,
5150,
29918,
2435,
353,
7431,
29898,
5467,
29889,
5150,
943,
8443,
13,
12,
12,
5467,
29918,
5150,
943,
353,
5159,
30004,
13,
12,
12,
1454,
474,
297,
3464,
29898,
5150,
29918,
2435,
1125,
30004,
13,
12,
12,
12,
5467,
29918,
5150,
943,
29889,
4397,
29898,
5467,
29889,
5150,
943,
29961,
29875,
2314,
30004,
13,
30004,
13,
12,
12,
2202,
29901,
22645,
353,
2529,
29918,
5150,
943,
29889,
2248,
29898,
23221,
978,
8443,
13,
12,
12,
19499,
7865,
2392,
29901,
30004,
13,
12,
12,
12,
5451,
29918,
978,
353,
2600,
978,
29889,
5451,
877,
525,
8443,
13,
12,
12,
12,
29937,
23221,
978,
353,
6219,
29918,
978,
29961,
29900,
29962,
718,
525,
525,
718,
6219,
29918,
978,
29961,
29896,
3816,
29900,
29962,
718,
15300,
525,
718,
6219,
29918,
978,
14352,
29896,
29962,
396,
3167,
7256,
1024,
30004,
13,
12,
12,
12,
13140,
353,
29871,
29900,
30004,
13,
12,
12,
12,
1454,
474,
297,
3464,
29898,
5150,
29918,
2435,
1125,
30004,
13,
12,
12,
12,
12,
5467,
29918,
5451,
353,
2529,
29918,
5150,
943,
29961,
29875,
1822,
5451,
877,
525,
8443,
13,
12,
12,
12,
12,
361,
2529,
29918,
5451,
29961,
29900,
29962,
1275,
6219,
29918,
978,
29961,
29900,
29962,
322,
2529,
29918,
5451,
14352,
29896,
29962,
1275,
6219,
29918,
978,
14352,
29896,
5387,
30004,
13,
12,
12,
12,
12,
12,
8690,
30004,
13,
12,
12,
12,
12,
13140,
4619,
29871,
29896,
30004,
13,
12,
12,
12,
12,
30004,
13,
12,
12,
12,
361,
22645,
1275,
4817,
29918,
2435,
29901,
30004,
13,
12,
12,
12,
12,
2158,
2529,
29889,
3257,
29889,
12508,
877,
9420,
29899,
29947,
1495,
718,
11297,
29885,
29915,
30004,
13,
12,
12,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
12,
12,
29937,
2158,
2529,
29889,
5150,
943,
30004,
13,
12,
12,
12,
12,
13140,
353,
448,
29896,
30004,
13,
30004,
13,
12,
12,
361,
22645,
6736,
29871,
29900,
29901,
30004,
13,
12,
12,
12,
20047,
4619,
29871,
29896,
29889,
29900,
847,
313,
13140,
718,
29871,
29896,
8443,
13,
12,
2457,
313,
2172,
29918,
978,
29892,
274,
593,
8443,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
12,
1454,
3762,
297,
12462,
29901,
30004,
13,
12,
12,
2158,
376,
25512,
1369,
29349,
1847,
3762,
6160,
718,
3762,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
9507,
353,
3762,
718,
8207,
29915,
718,
3762,
718,
15300,
3134,
29915,
30004,
13,
12,
12,
361,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
9507,
1125,
30004,
13,
12,
12,
12,
2158,
376,
29883,
6735,
1284,
29901,
376,
718,
10422,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
12,
19878,
30004,
13,
12,
12,
8336,
353,
382,
29911,
29889,
2642,
9643,
29898,
1445,
353,
10422,
8443,
13,
12,
12,
29888,
449,
29918,
3134,
353,
934,
29898,
27041,
23097,
29914,
18717,
27041,
29974,
15972,
6605,
29889,
3134,
742,
525,
29893,
1495,
30004,
13,
12,
12,
1514,
353,
1375,
333,
290,
29889,
6268,
26471,
13,
12,
12,
2611,
5008,
353,
1574,
29889,
22662,
703,
2611,
5008,
1159,
30004,
13,
12,
12,
1514,
29889,
23850,
29898,
2611,
5008,
8443,
13,
30004,
13,
12,
12,
1454,
2600,
297,
5447,
29889,
657,
4632,
7295,
30004,
13,
12,
12,
12,
1454,
5235,
297,
2600,
29901,
30004,
13,
12,
12,
12,
12,
361,
5235,
29889,
4039,
1275,
525,
978,
2396,
30004,
13,
12,
12,
12,
12,
12,
978,
29892,
274,
593,
353,
2740,
29898,
3888,
29889,
726,
8443,
13,
12,
12,
12,
12,
12,
2158,
3762,
718,
525,
29901,
525,
718,
1024,
29889,
12508,
877,
9420,
29899,
29947,
1495,
718,
525,
411,
8158,
29901,
525,
718,
11860,
29889,
29946,
29888,
29908,
1273,
274,
593,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
12,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
12,
12,
12,
12,
12,
23221,
6329,
353,
1574,
29889,
22662,
703,
23221,
6329,
1159,
30004,
13,
12,
12,
12,
12,
12,
29876,
5071,
356,
353,
1574,
29889,
22662,
703,
978,
1159,
30004,
13,
12,
12,
12,
12,
12,
29876,
5071,
356,
29889,
23850,
29898,
1514,
29889,
3258,
1626,
4247,
29898,
978,
876,
30004,
13,
12,
12,
12,
12,
12,
23221,
6329,
29889,
23850,
29898,
29876,
5071,
356,
8443,
13,
12,
12,
12,
12,
12,
29886,
481,
824,
356,
353,
1574,
29889,
22662,
703,
29886,
21321,
1159,
30004,
13,
12,
12,
12,
12,
12,
29886,
481,
824,
356,
29889,
23850,
29898,
1514,
29889,
3258,
1626,
4247,
29898,
710,
29898,
20047,
4961,
30004,
13,
12,
12,
12,
12,
12,
23221,
6329,
29889,
23850,
29898,
29886,
481,
824,
356,
8443,
13,
12,
12,
12,
12,
12,
2611,
5008,
29889,
23850,
29898,
23221,
6329,
8443,
13,
12,
12,
1514,
29889,
3539,
3134,
29898,
29888,
449,
29918,
3134,
29892,
6634,
29873,
613,
6634,
29873,
613,
6634,
29876,
1159,
30004,
13,
12,
12,
29888,
449,
29918,
3134,
29889,
5358,
26471,
13,
12,
12,
2158,
376,
25512,
7743,
29349,
1847,
29901,
376,
718,
3762,
718,
11297,
29876,
29915,
30004,
13,
12,
12,
9675,
29889,
25393,
29889,
23126,
26471,
13,
30004,
13,
2
] |
flashnrf.py | struempelix/flashnrf | 0 | 187726 | <filename>flashnrf.py
"""
This file contains example code meant to be used in order to test the
pynrfjprog API and Hex. If multiple devices are connected, pop-up will appear.
Sample program: program_hex.py
Requires nrf51-DK or nrf52-DK for visual confirmation (LEDs).
Run from command line:
python program_hex.py
or if imported as "from pynrfjprog import examples"
examples.program_hex.run()
Program flow:
0. API is opened and checked to see if correct family type is used
1. Memory is erased
2. test_program_path is parsed and written to memory
3. Device is reset and application is run
"""
from __future__ import division
from __future__ import print_function
from builtins import int
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
# Import pynrfjprog API module and HEX parser module
from pynrfjprog import API, Hex
import os # Used to create path to .hex file
class myHandler(PatternMatchingEventHandler):
patterns = ["*.hex"]
ignore_patterns = ["_OTA"]
def process(self, event):
print (event.dest_path, event.event_type)
def on_moved(self, event):
self.process(event)
print('# pynrfjprog program hex example started... ')
device_family = API.DeviceFamily.NRF51 # Start out with nrf51, will be checked and changed if needed
# Init API with NRF51, open, connect, then check if NRF51 is correct
print('# Opening API with device %s, checking if correct ' % device_family)
api = API.API(device_family) # Initializing API with correct NRF51 family type (will be checked later if correct)
api.open() # Open the dll with the set family type
api.connect_to_emu_without_snr() # Connect to emulator, it multiple are connected - pop up will appear
# Check if family used was correct or else change
try:
device_version = api.read_device_version()
except API.APIError as e:
if e.err_code == API.NrfjprogdllErr.WRONG_FAMILY_FOR_DEVICE:
device_family = API.DeviceFamily.NRF52
print('# Closing API and re-opening with device %s ' % device_family)
api.close() # Close API so that correct family can be used to open
# Re-Init API, open, connect, and erase device
api = API.API(device_family) # Initializing API with correct family type [API.DeviceFamily.NRF51 or ...NRF52]
api.open() # Open the dll with the set family type
api.connect_to_emu_without_snr() # Connect to emulator, it multiple are connected - pop up will appear# change
else:
raise e
print('# Erasing all... ')
api.erase_all() # Erase memory of device
# Find path to test hex file
#module_dir, module_file = os.path.split(__file__)
#hex_file_path = os.path.join(os.path.abspath(module_dir), device_family.name + '_dk_blinky.hex')
# Parse hex, program to device
print('# Parsing hex file into segments ')
program = Hex.Hex(event.dest_path) # Parse .hex file into segments
print('# Writing %s to device ' % event.dest_path)
for segment in program:
api.write(segment.address, segment.data, True)
# Reset device, run
api.sys_reset() # Reset device
api.go() # Run application
print('# Application running ')
# Close API
api.close() # Close the dll
print('# done... ')
os.system('say "done"')
def run():
args = sys.argv[1:]
observer = Observer()
observer.schedule(myHandler(), path=args[0] if args else '.')
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
if __name__ == '__main__':
run()
| [
1,
529,
9507,
29958,
28041,
29876,
9600,
29889,
2272,
13,
15945,
19451,
13,
30004,
13,
1678,
910,
934,
3743,
1342,
775,
6839,
304,
367,
1304,
297,
1797,
304,
1243,
278,
30004,
13,
1678,
282,
948,
9600,
29926,
29097,
3450,
322,
379,
735,
29889,
960,
2999,
9224,
526,
6631,
29892,
1835,
29899,
786,
674,
2615,
22993,
13,
30004,
13,
1678,
21029,
1824,
29901,
1824,
29918,
20970,
29889,
2272,
30004,
13,
1678,
830,
339,
2658,
302,
9600,
29945,
29896,
29899,
17359,
470,
302,
9600,
29945,
29906,
29899,
17359,
363,
7604,
9659,
362,
313,
20566,
29879,
467,
30004,
13,
30004,
13,
1678,
7525,
515,
1899,
1196,
29901,
30004,
13,
4706,
3017,
1824,
29918,
20970,
29889,
2272,
30004,
13,
1678,
470,
565,
19673,
408,
376,
3166,
282,
948,
9600,
29926,
29097,
1053,
6455,
19451,
13,
4706,
6455,
29889,
8860,
29918,
20970,
29889,
3389,
26471,
13,
30004,
13,
1678,
7835,
4972,
29901,
30004,
13,
308,
29900,
29889,
3450,
338,
6496,
322,
7120,
304,
1074,
565,
1959,
3942,
1134,
338,
1304,
30004,
13,
308,
29896,
29889,
18914,
338,
604,
1463,
30004,
13,
308,
29906,
29889,
1243,
29918,
8860,
29918,
2084,
338,
21213,
322,
3971,
304,
3370,
30004,
13,
308,
29941,
29889,
21830,
338,
10092,
322,
2280,
338,
1065,
30004,
13,
30004,
13,
15945,
19451,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
30004,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
30004,
13,
3166,
4240,
1144,
1053,
938,
30004,
13,
5215,
10876,
30004,
13,
5215,
931,
30004,
13,
5215,
12183,
30004,
13,
3166,
6505,
26169,
29889,
711,
643,
874,
1053,
4250,
2974,
30004,
13,
3166,
6505,
26169,
29889,
13604,
1053,
25860,
9652,
292,
2624,
4598,
30004,
13,
30004,
13,
29937,
16032,
282,
948,
9600,
29926,
29097,
3450,
3883,
322,
379,
5746,
13812,
3883,
30004,
13,
3166,
282,
948,
9600,
29926,
29097,
1053,
3450,
29892,
379,
735,
30004,
13,
30004,
13,
5215,
2897,
259,
396,
501,
8485,
304,
1653,
2224,
304,
869,
20970,
934,
30004,
13,
30004,
13,
1990,
590,
4598,
29898,
17144,
9652,
292,
2624,
4598,
1125,
30004,
13,
1678,
15038,
353,
6796,
10521,
20970,
3108,
30004,
13,
1678,
11455,
29918,
11037,
29879,
353,
6796,
29918,
2891,
29909,
3108,
30004,
13,
30004,
13,
1678,
822,
1889,
29898,
1311,
29892,
1741,
1125,
30004,
13,
4706,
1596,
313,
3696,
29889,
7854,
29918,
2084,
29892,
1741,
29889,
3696,
29918,
1853,
8443,
13,
30004,
13,
1678,
822,
373,
29918,
29885,
8238,
29898,
1311,
29892,
1741,
1125,
30004,
13,
4706,
1583,
29889,
5014,
29898,
3696,
8443,
13,
4706,
1596,
14237,
282,
948,
9600,
29926,
29097,
1824,
15090,
1342,
4687,
856,
29871,
525,
8443,
13,
30004,
13,
4706,
4742,
29918,
11922,
353,
3450,
29889,
11501,
27104,
29889,
16514,
29943,
29945,
29896,
29871,
396,
7370,
714,
411,
302,
9600,
29945,
29896,
29892,
674,
367,
7120,
322,
3939,
565,
4312,
30004,
13,
30004,
13,
4706,
396,
10886,
3450,
411,
27759,
29943,
29945,
29896,
29892,
1722,
29892,
4511,
29892,
769,
1423,
565,
27759,
29943,
29945,
29896,
338,
1959,
30004,
13,
4706,
1596,
14237,
4673,
292,
3450,
411,
4742,
1273,
29879,
29892,
8454,
565,
1959,
29871,
525,
1273,
4742,
29918,
11922,
8443,
13,
4706,
7882,
353,
3450,
29889,
8787,
29898,
10141,
29918,
11922,
29897,
9651,
396,
17250,
5281,
3450,
411,
1959,
27759,
29943,
29945,
29896,
3942,
1134,
313,
14043,
367,
7120,
2678,
565,
1959,
8443,
13,
4706,
7882,
29889,
3150,
580,
462,
795,
396,
4673,
278,
24415,
411,
278,
731,
3942,
1134,
30004,
13,
4706,
7882,
29889,
6915,
29918,
517,
29918,
24425,
29918,
14037,
29918,
16586,
29878,
580,
4706,
396,
14971,
304,
26364,
29892,
372,
2999,
526,
6631,
448,
1835,
701,
674,
2615,
30004,
13,
30004,
13,
4706,
396,
5399,
565,
3942,
1304,
471,
1959,
470,
1683,
1735,
30004,
13,
4706,
1018,
29901,
30004,
13,
9651,
4742,
29918,
3259,
353,
7882,
29889,
949,
29918,
10141,
29918,
3259,
26471,
13,
4706,
5174,
3450,
29889,
8787,
2392,
408,
321,
29901,
30004,
13,
9651,
565,
321,
29889,
3127,
29918,
401,
1275,
3450,
29889,
29940,
9600,
29926,
29097,
12396,
19212,
29889,
9980,
20614,
29918,
4519,
29924,
6227,
29979,
29918,
22051,
29918,
2287,
19059,
29901,
30004,
13,
18884,
4742,
29918,
11922,
353,
3450,
29889,
11501,
27104,
29889,
16514,
29943,
29945,
29906,
30004,
13,
18884,
1596,
14237,
2233,
14556,
3450,
322,
337,
29899,
3150,
292,
411,
4742,
1273,
29879,
29871,
525,
1273,
4742,
29918,
11922,
8443,
13,
18884,
7882,
29889,
5358,
580,
462,
308,
396,
23186,
3450,
577,
393,
1959,
3942,
508,
367,
1304,
304,
1722,
30004,
13,
30004,
13,
18884,
396,
830,
29899,
6644,
3450,
29892,
1722,
29892,
4511,
29892,
322,
604,
559,
4742,
30004,
13,
18884,
7882,
353,
3450,
29889,
8787,
29898,
10141,
29918,
11922,
29897,
4706,
396,
17250,
5281,
3450,
411,
1959,
3942,
1134,
518,
8787,
29889,
11501,
27104,
29889,
16514,
29943,
29945,
29896,
470,
2023,
16514,
29943,
29945,
29906,
29962,
30004,
13,
18884,
7882,
29889,
3150,
580,
462,
3986,
396,
4673,
278,
24415,
411,
278,
731,
3942,
1134,
30004,
13,
18884,
7882,
29889,
6915,
29918,
517,
29918,
24425,
29918,
14037,
29918,
16586,
29878,
580,
1678,
396,
14971,
304,
26364,
29892,
372,
2999,
526,
6631,
448,
1835,
701,
674,
2615,
29937,
1735,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
12020,
321,
30004,
13,
30004,
13,
4706,
1596,
14237,
1425,
5832,
599,
856,
525,
8443,
13,
4706,
7882,
29889,
261,
559,
29918,
497,
580,
462,
308,
396,
1425,
559,
3370,
310,
4742,
30004,
13,
30004,
13,
4706,
396,
10987,
2224,
304,
1243,
15090,
934,
30004,
13,
4706,
396,
5453,
29918,
3972,
29892,
3883,
29918,
1445,
353,
2897,
29889,
2084,
29889,
5451,
22168,
1445,
1649,
8443,
13,
4706,
396,
20970,
29918,
1445,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
5453,
29918,
3972,
511,
4742,
29918,
11922,
29889,
978,
718,
22868,
8181,
29918,
2204,
682,
29891,
29889,
20970,
1495,
30004,
13,
30004,
13,
4706,
396,
20969,
15090,
29892,
1824,
304,
4742,
30004,
13,
4706,
1596,
14237,
1459,
2976,
15090,
934,
964,
24611,
29871,
525,
8443,
13,
4706,
1824,
353,
379,
735,
29889,
29950,
735,
29898,
3696,
29889,
7854,
29918,
2084,
29897,
396,
20969,
869,
20970,
934,
964,
24611,
30004,
13,
4706,
1596,
14237,
28676,
1273,
29879,
304,
4742,
29871,
525,
1273,
1741,
29889,
7854,
29918,
2084,
8443,
13,
4706,
363,
10768,
297,
1824,
29901,
30004,
13,
9651,
7882,
29889,
3539,
29898,
28192,
29889,
7328,
29892,
10768,
29889,
1272,
29892,
5852,
8443,
13,
30004,
13,
4706,
396,
2538,
300,
4742,
29892,
1065,
30004,
13,
4706,
7882,
29889,
9675,
29918,
12071,
580,
462,
308,
396,
2538,
300,
4742,
30004,
13,
4706,
7882,
29889,
1484,
580,
462,
18884,
396,
7525,
2280,
30004,
13,
4706,
1596,
14237,
8427,
2734,
29871,
525,
8443,
13,
30004,
13,
4706,
396,
23186,
3450,
30004,
13,
4706,
7882,
29889,
5358,
580,
462,
632,
396,
23186,
278,
24415,
30004,
13,
30004,
13,
4706,
1596,
14237,
2309,
856,
29871,
525,
8443,
13,
4706,
2897,
29889,
5205,
877,
20834,
376,
15091,
29908,
1495,
30004,
13,
30004,
13,
1753,
1065,
7295,
30004,
13,
1678,
6389,
353,
10876,
29889,
19218,
29961,
29896,
17531,
30004,
13,
1678,
22944,
353,
4250,
2974,
26471,
13,
1678,
22944,
29889,
816,
11272,
29898,
1357,
4598,
3285,
2224,
29922,
5085,
29961,
29900,
29962,
565,
6389,
1683,
15300,
1495,
30004,
13,
1678,
22944,
29889,
2962,
26471,
13,
30004,
13,
1678,
1018,
29901,
30004,
13,
4706,
1550,
5852,
29901,
30004,
13,
9651,
931,
29889,
17059,
29898,
29896,
8443,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
30004,
13,
4706,
22944,
29889,
9847,
26471,
13,
30004,
13,
1678,
22944,
29889,
7122,
26471,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
1065,
26471,
13,
2
] |
ontquery/utils.py | tmsincomb/ontquery | 1 | 106656 | <gh_stars>1-10
import logging
from functools import wraps
red = '\x1b[31m{}\x1b[0m'
def makeSimpleLogger(name, level=logging.INFO):
logger = logging.getLogger(name)
logger.setLevel(level)
ch = logging.StreamHandler() # FileHander goes to disk
fmt = ('[%(asctime)s] - %(levelname)8s - '
'%(name)14s - '
'%(filename)16s:%(lineno)-4d - '
'%(message)s')
formatter = logging.Formatter(fmt)
ch.setFormatter(formatter)
logger.addHandler(ch)
return logger
log = makeSimpleLogger('ontquery')
__logged = set()
def _already_logged(thing):
case = thing in __logged
if not case:
__logged.add(thing)
return case
def subclasses(start, done=None):
if done is None:
done = set()
for sc in start.__subclasses__():
if sc is not None and sc not in done:
done.add(sc)
yield sc
yield from subclasses(sc, done)
class SubClassCompare:
def __init__(self, cls):
self.cls = cls
def __lt__(self, other, *, forgt=False):
if self.cls is None: # i.e. None is the least derived class
return False
elif other.cls is None:
return True
elif issubclass(other.cls, self.cls):
# if you are a subclass of the other, you are greater
# fewer parent classes rank lower
return True
elif issubclass(self.cls, other.cls):
return False
else:
# NOTE useful in some cases
# but not useful in the case where you just want
# the parent class to be above the child but not
# above other classes
ls, lo = len(self.cls.mro()), len(other.cls.mro())
return ls < lo
def __gt__(self, other):
lt = self.__lt__(other, forgt=True)
return not lt
#return False if lt is None else not lt
def __eq__(self, other):
return self.cls is other.cls or not self < other and not self > other
def __repr__(self):
return f'SubClassCompare({self.cls!r})'
def bunch(pairs):
""" pairs -> dict """
out = {}
for k, v in pairs:
if k not in out:
out[k] = []
out[k].append(v)
return out
def cullNone(**kwargs):
return {k:v for k, v in kwargs.items() if v is not None}
def one_or_many(arg):
return tuple() if not arg else ((arg,)
if isinstance(arg, str)
else arg)
def mimicArgs(function_to_mimic):
def decorator(function):
@wraps(function_to_mimic)
def wrapper(*args, **kwargs):
return function(*args, **kwargs)
return wrapper
return decorator
class Graph():
""" I can be pickled! And I can be loaded from a pickle dumped from a graph loaded via rdflib. """
def __init__(self, triples=tuple()):
self.store = triples
def add(triple):
self.store += triple
def subjects(self, predicate, object): # this method by iteself is sufficient to build a keyword based query interface via query(predicate='object')
for s, p, o in self.store:
if (predicate is None or predicate == p) and (object == None or object == o):
yield s
def predicates(self, subject, object):
for s, p, o in self.store:
if (subject is None or subject == s) and (object == None or object == o):
yield p
def predicate_objects(subject): # this is sufficient to let OntTerm work as desired
for s, p, o in self.store:
if subject == None or subject == s:
yield p, o
class QueryResult:
""" Encapsulate query results and allow for clear and clean documentation
of how a particular service maps their result terminology onto the
ontquery keyword api. """
@classmethod
def new_from_instrumented(cls, instrumented):
return type(cls.__name__, (cls,), dict(_instrumented=instrumented))
def __init__(self,
query_args,
iri=None,
curie=None,
label=None,
labels=tuple(),
abbrev=None, # TODO
acronym=None, # TODO
definition=None,
synonyms=tuple(),
deprecated=None,
prefix=None,
category=None,
predicates=None, # FIXME dict
type=None,
types=tuple(),
_graph=None,
_blob=None, # FIXME unify graph/blob under progenitor ?
source=None,
):
self.__query_args = query_args # for debug
self.__dict = {}
for k, v in dict(iri=iri,
curie=curie,
label=label,
labels=labels,
definition=definition,
synonyms=synonyms,
deprecated=deprecated,
predicates=predicates,
type=type,
types=types,
_graph=_graph,
_blob=_blob,
source=source).items():
# this must return the empty values for all keys
# so that users don't have to worry about hasattring
# to make sure they aren't about to step into a typeless void
setattr(self, k, v)
self.__dict[k] = v
#self.__dict__[k] = v
@property
def OntTerm(self): # FIXME naming XXXX deprecate this
if self.iri is None:
raise BaseException(f'I can\'t believe you\'ve done this! {self!r}')
return self._instrumented._from_query_result(self)
def asTerm(self):
return self.OntTerm
@property
def hasOntTerm(self): # FIXME naming
# run against _OntTerm to prevent recursion
return hasattr(self, '_instrumented')
def keys(self):
yield from self.__dict.keys()
def values(self):
yield from self.__dict.values()
def items(self):
yield from self.__dict.items()
def __iter__(self):
yield from self.__dict
def __getitem__(self, key):
try:
return self.__dict[key]
except KeyError as e:
self.__missing__(key, e)
def __contains__(self, key):
return key in self.__dict
def __missing__(self, key, e=None):
raise KeyError(f'{key} {type(key)}') from e
def __setitem__(self, key, value):
raise ValueError('Cannot set results of a query.')
def __repr__(self):
return f'{self.__class__.__name__}({self.__dict!r})'
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
12183,
13,
3166,
2090,
312,
8789,
1053,
11463,
567,
13,
13,
1127,
353,
11297,
29916,
29896,
29890,
29961,
29941,
29896,
29885,
29912,
1012,
29916,
29896,
29890,
29961,
29900,
29885,
29915,
13,
13,
13,
1753,
1207,
15427,
16363,
29898,
978,
29892,
3233,
29922,
21027,
29889,
11690,
1125,
13,
1678,
17927,
353,
12183,
29889,
657,
16363,
29898,
978,
29897,
13,
1678,
17927,
29889,
842,
10108,
29898,
5563,
29897,
13,
1678,
521,
353,
12183,
29889,
3835,
4598,
580,
29871,
396,
3497,
3481,
261,
5771,
304,
8086,
13,
1678,
19200,
353,
6702,
29961,
29995,
29898,
294,
312,
603,
29897,
29879,
29962,
448,
1273,
29898,
5563,
978,
29897,
29947,
29879,
448,
525,
13,
965,
14210,
29898,
978,
29897,
29896,
29946,
29879,
448,
525,
13,
965,
14210,
29898,
9507,
29897,
29896,
29953,
29879,
16664,
29898,
1915,
8154,
6817,
29946,
29881,
448,
525,
13,
965,
14210,
29898,
4906,
29897,
29879,
1495,
13,
1678,
883,
2620,
353,
12183,
29889,
18522,
29898,
23479,
29897,
13,
1678,
521,
29889,
842,
18522,
29898,
689,
2620,
29897,
13,
1678,
17927,
29889,
1202,
4598,
29898,
305,
29897,
13,
1678,
736,
17927,
13,
13,
13,
1188,
353,
1207,
15427,
16363,
877,
609,
1972,
1495,
13,
13,
13,
1649,
1188,
3192,
353,
731,
580,
13,
1753,
903,
284,
2040,
29918,
1188,
3192,
29898,
1918,
1125,
13,
1678,
1206,
353,
2655,
297,
4770,
1188,
3192,
13,
1678,
565,
451,
1206,
29901,
13,
4706,
4770,
1188,
3192,
29889,
1202,
29898,
1918,
29897,
13,
13,
1678,
736,
1206,
13,
13,
13,
1753,
1014,
13203,
29898,
2962,
29892,
2309,
29922,
8516,
1125,
13,
1678,
565,
2309,
338,
6213,
29901,
13,
4706,
2309,
353,
731,
580,
13,
1678,
363,
885,
297,
1369,
17255,
1491,
13203,
1649,
7295,
13,
4706,
565,
885,
338,
451,
6213,
322,
885,
451,
297,
2309,
29901,
13,
9651,
2309,
29889,
1202,
29898,
1557,
29897,
13,
9651,
7709,
885,
13,
9651,
7709,
515,
1014,
13203,
29898,
1557,
29892,
2309,
29897,
13,
13,
13,
1990,
3323,
2385,
6843,
598,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1067,
29879,
1125,
13,
4706,
1583,
29889,
25932,
353,
1067,
29879,
13,
13,
1678,
822,
4770,
1896,
12035,
1311,
29892,
916,
29892,
334,
29892,
363,
4141,
29922,
8824,
1125,
13,
4706,
565,
1583,
29889,
25932,
338,
6213,
29901,
29871,
396,
474,
29889,
29872,
29889,
6213,
338,
278,
3203,
10723,
770,
13,
9651,
736,
7700,
13,
4706,
25342,
916,
29889,
25932,
338,
6213,
29901,
13,
9651,
736,
5852,
13,
4706,
25342,
338,
1491,
1990,
29898,
1228,
29889,
25932,
29892,
1583,
29889,
25932,
1125,
13,
9651,
396,
565,
366,
526,
263,
19481,
310,
278,
916,
29892,
366,
526,
7621,
13,
9651,
396,
28145,
3847,
4413,
7115,
5224,
13,
9651,
736,
5852,
13,
4706,
25342,
338,
1491,
1990,
29898,
1311,
29889,
25932,
29892,
916,
29889,
25932,
1125,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
396,
6058,
29923,
5407,
297,
777,
4251,
13,
9651,
396,
541,
451,
5407,
297,
278,
1206,
988,
366,
925,
864,
13,
9651,
396,
278,
3847,
770,
304,
367,
2038,
278,
2278,
541,
451,
13,
9651,
396,
2038,
916,
4413,
13,
9651,
19375,
29892,
658,
353,
7431,
29898,
1311,
29889,
25932,
29889,
29885,
307,
25739,
7431,
29898,
1228,
29889,
25932,
29889,
29885,
307,
3101,
13,
9651,
736,
19375,
529,
658,
13,
13,
1678,
822,
4770,
4141,
12035,
1311,
29892,
916,
1125,
13,
4706,
301,
29873,
353,
1583,
17255,
1896,
12035,
1228,
29892,
363,
4141,
29922,
5574,
29897,
13,
4706,
736,
451,
301,
29873,
13,
4706,
396,
2457,
7700,
565,
301,
29873,
338,
6213,
1683,
451,
301,
29873,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
25932,
338,
916,
29889,
25932,
470,
451,
1583,
529,
916,
322,
451,
1583,
1405,
916,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
285,
29915,
4035,
2385,
6843,
598,
3319,
1311,
29889,
25932,
29991,
29878,
1800,
29915,
13,
13,
13,
1753,
14928,
29898,
29886,
7121,
1125,
13,
1678,
9995,
11000,
1599,
9657,
9995,
13,
1678,
714,
353,
6571,
13,
1678,
363,
413,
29892,
325,
297,
11000,
29901,
13,
4706,
565,
413,
451,
297,
714,
29901,
13,
9651,
714,
29961,
29895,
29962,
353,
5159,
13,
13,
4706,
714,
29961,
29895,
1822,
4397,
29898,
29894,
29897,
13,
13,
1678,
736,
714,
13,
13,
13,
1753,
274,
913,
8516,
29898,
1068,
19290,
1125,
13,
1678,
736,
426,
29895,
29901,
29894,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
580,
565,
325,
338,
451,
6213,
29913,
13,
13,
13,
1753,
697,
29918,
272,
29918,
13011,
29898,
1191,
1125,
13,
1678,
736,
18761,
580,
565,
451,
1852,
1683,
5135,
1191,
29892,
29897,
13,
462,
462,
1678,
565,
338,
8758,
29898,
1191,
29892,
851,
29897,
13,
462,
462,
1678,
1683,
1852,
29897,
13,
13,
1753,
286,
326,
293,
7883,
29898,
2220,
29918,
517,
29918,
29885,
326,
293,
1125,
13,
1678,
822,
10200,
1061,
29898,
2220,
1125,
13,
4706,
732,
29893,
336,
567,
29898,
2220,
29918,
517,
29918,
29885,
326,
293,
29897,
13,
4706,
822,
14476,
10456,
5085,
29892,
3579,
19290,
1125,
13,
9651,
736,
740,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
736,
14476,
13,
1678,
736,
10200,
1061,
13,
13,
13,
1990,
12367,
7295,
13,
1678,
9995,
306,
508,
367,
5839,
839,
29991,
1126,
306,
508,
367,
7500,
515,
263,
5839,
280,
16766,
287,
515,
263,
3983,
7500,
3025,
364,
2176,
1982,
29889,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3367,
2701,
29922,
23583,
580,
1125,
13,
4706,
1583,
29889,
8899,
353,
3367,
2701,
13,
13,
1678,
822,
788,
29898,
3626,
552,
1125,
13,
4706,
1583,
29889,
8899,
4619,
21954,
13,
13,
1678,
822,
17800,
29898,
1311,
29892,
24384,
29892,
1203,
1125,
29871,
396,
445,
1158,
491,
372,
267,
761,
338,
8002,
304,
2048,
263,
13553,
2729,
2346,
5067,
3025,
2346,
29898,
11965,
9593,
2433,
3318,
1495,
13,
4706,
363,
269,
29892,
282,
29892,
288,
297,
1583,
29889,
8899,
29901,
13,
9651,
565,
313,
11965,
9593,
338,
6213,
470,
24384,
1275,
282,
29897,
322,
313,
3318,
1275,
6213,
470,
1203,
1275,
288,
1125,
13,
18884,
7709,
269,
13,
13,
1678,
822,
4450,
293,
1078,
29898,
1311,
29892,
4967,
29892,
1203,
1125,
13,
4706,
363,
269,
29892,
282,
29892,
288,
297,
1583,
29889,
8899,
29901,
13,
9651,
565,
313,
16009,
338,
6213,
470,
4967,
1275,
269,
29897,
322,
313,
3318,
1275,
6213,
470,
1203,
1275,
288,
1125,
13,
18884,
7709,
282,
13,
13,
1678,
822,
24384,
29918,
12650,
29898,
16009,
1125,
29871,
396,
445,
338,
8002,
304,
1235,
18265,
14343,
664,
408,
7429,
13,
4706,
363,
269,
29892,
282,
29892,
288,
297,
1583,
29889,
8899,
29901,
13,
9651,
565,
4967,
1275,
6213,
470,
4967,
1275,
269,
29901,
13,
18884,
7709,
282,
29892,
288,
13,
13,
13,
1990,
13641,
3591,
29901,
13,
1678,
9995,
11346,
2547,
5987,
2346,
2582,
322,
2758,
363,
2821,
322,
5941,
5106,
13,
4706,
310,
920,
263,
3153,
2669,
11053,
1009,
1121,
6624,
3002,
11480,
278,
13,
4706,
4625,
1972,
13553,
7882,
29889,
9995,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
716,
29918,
3166,
29918,
2611,
15461,
287,
29898,
25932,
29892,
11395,
287,
1125,
13,
4706,
736,
1134,
29898,
25932,
17255,
978,
1649,
29892,
313,
25932,
29892,
511,
9657,
7373,
2611,
15461,
287,
29922,
2611,
15461,
287,
876,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
2346,
29918,
5085,
29892,
13,
462,
474,
374,
29922,
8516,
29892,
13,
462,
3151,
347,
29922,
8516,
29892,
13,
462,
3858,
29922,
8516,
29892,
13,
462,
11073,
29922,
23583,
3285,
13,
462,
29759,
29894,
29922,
8516,
29892,
29871,
396,
14402,
13,
462,
1274,
1617,
962,
29922,
8516,
29892,
29871,
396,
14402,
13,
462,
5023,
29922,
8516,
29892,
13,
462,
5222,
4735,
29879,
29922,
23583,
3285,
13,
462,
18164,
29922,
8516,
29892,
13,
462,
10944,
29922,
8516,
29892,
13,
462,
7663,
29922,
8516,
29892,
13,
462,
4450,
293,
1078,
29922,
8516,
29892,
29871,
396,
383,
6415,
2303,
9657,
13,
462,
1134,
29922,
8516,
29892,
13,
462,
4072,
29922,
23583,
3285,
13,
462,
903,
4262,
29922,
8516,
29892,
13,
462,
903,
10054,
29922,
8516,
29892,
29871,
396,
383,
6415,
2303,
443,
1598,
3983,
29914,
10054,
1090,
410,
1885,
2105,
1577,
13,
462,
2752,
29922,
8516,
29892,
13,
268,
1125,
13,
4706,
1583,
17255,
1972,
29918,
5085,
353,
2346,
29918,
5085,
29871,
396,
363,
4744,
13,
4706,
1583,
17255,
8977,
353,
6571,
13,
4706,
363,
413,
29892,
325,
297,
9657,
29898,
12737,
29922,
12737,
29892,
13,
462,
308,
3151,
347,
29922,
2764,
347,
29892,
13,
462,
308,
3858,
29922,
1643,
29892,
13,
462,
308,
11073,
29922,
21134,
29892,
13,
462,
308,
5023,
29922,
16553,
29892,
13,
462,
308,
5222,
4735,
29879,
29922,
19274,
4735,
29879,
29892,
13,
462,
308,
18164,
29922,
311,
17990,
630,
29892,
13,
462,
308,
4450,
293,
1078,
29922,
11965,
293,
1078,
29892,
13,
462,
308,
1134,
29922,
1853,
29892,
13,
462,
308,
4072,
29922,
8768,
29892,
13,
462,
308,
903,
4262,
29922,
29918,
4262,
29892,
13,
462,
308,
903,
10054,
29922,
29918,
10054,
29892,
13,
462,
308,
2752,
29922,
4993,
467,
7076,
7295,
13,
9651,
396,
445,
1818,
736,
278,
4069,
1819,
363,
599,
6611,
13,
9651,
396,
577,
393,
4160,
1016,
29915,
29873,
505,
304,
15982,
1048,
756,
271,
909,
13,
9651,
396,
304,
1207,
1854,
896,
9455,
29915,
29873,
1048,
304,
4331,
964,
263,
2393,
6393,
1780,
13,
13,
9651,
731,
5552,
29898,
1311,
29892,
413,
29892,
325,
29897,
13,
9651,
1583,
17255,
8977,
29961,
29895,
29962,
353,
325,
13,
9651,
396,
1311,
17255,
8977,
1649,
29961,
29895,
29962,
353,
325,
13,
13,
1678,
732,
6799,
13,
1678,
822,
18265,
14343,
29898,
1311,
1125,
29871,
396,
383,
6415,
2303,
22006,
6193,
6247,
16460,
403,
445,
13,
4706,
565,
1583,
29889,
12737,
338,
6213,
29901,
13,
9651,
12020,
7399,
2451,
29898,
29888,
29915,
29902,
508,
20333,
29873,
4658,
366,
20333,
345,
2309,
445,
29991,
426,
1311,
29991,
29878,
29913,
1495,
13,
4706,
736,
1583,
3032,
2611,
15461,
287,
3032,
3166,
29918,
1972,
29918,
2914,
29898,
1311,
29897,
13,
13,
1678,
822,
408,
14343,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29949,
593,
14343,
13,
13,
1678,
732,
6799,
13,
1678,
822,
756,
29949,
593,
14343,
29898,
1311,
1125,
29871,
396,
383,
6415,
2303,
22006,
13,
4706,
396,
1065,
2750,
903,
29949,
593,
14343,
304,
5557,
20437,
13,
4706,
736,
756,
5552,
29898,
1311,
29892,
22868,
2611,
15461,
287,
1495,
13,
13,
1678,
822,
6611,
29898,
1311,
1125,
13,
4706,
7709,
515,
1583,
17255,
8977,
29889,
8149,
580,
13,
13,
1678,
822,
1819,
29898,
1311,
1125,
13,
4706,
7709,
515,
1583,
17255,
8977,
29889,
5975,
580,
13,
13,
1678,
822,
4452,
29898,
1311,
1125,
13,
4706,
7709,
515,
1583,
17255,
8977,
29889,
7076,
580,
13,
13,
1678,
822,
4770,
1524,
12035,
1311,
1125,
13,
4706,
7709,
515,
1583,
17255,
8977,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
1820,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
1583,
17255,
8977,
29961,
1989,
29962,
13,
4706,
5174,
7670,
2392,
408,
321,
29901,
13,
9651,
1583,
17255,
27259,
12035,
1989,
29892,
321,
29897,
13,
13,
1678,
822,
4770,
11516,
12035,
1311,
29892,
1820,
1125,
13,
4706,
736,
1820,
297,
1583,
17255,
8977,
13,
13,
1678,
822,
4770,
27259,
12035,
1311,
29892,
1820,
29892,
321,
29922,
8516,
1125,
13,
4706,
12020,
7670,
2392,
29898,
29888,
29915,
29912,
1989,
29913,
426,
1853,
29898,
1989,
2915,
1495,
515,
321,
13,
13,
1678,
822,
4770,
842,
667,
12035,
1311,
29892,
1820,
29892,
995,
1125,
13,
4706,
12020,
7865,
2392,
877,
29089,
731,
2582,
310,
263,
2346,
29889,
1495,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
285,
29915,
29912,
1311,
17255,
1990,
1649,
17255,
978,
1649,
2119,
29912,
1311,
17255,
8977,
29991,
29878,
1800,
29915,
13,
2
] |
Python code/isPrime.py | jlwgong/hangman | 0 | 101687 | # This function tells a user whether or not a number is prime
def isPrime(number):
# this will tell us if the number is prime, set to True automatically
# We will set to False if the number is divisible by any number less than it
number_is_prime = True
# loop over all numbers less than the input number
for i in range(2, number):
# calculate the remainder
remainder = number % i
# if the remainder is 0, then the number is not prime by definition!
if remainder == 0:
number_is_prime = False
# return result to the user
return number_is_prime
| [
1,
396,
910,
740,
10603,
263,
1404,
3692,
470,
451,
263,
1353,
338,
6019,
13,
13,
1753,
338,
4040,
603,
29898,
4537,
1125,
13,
13,
1678,
396,
445,
674,
2649,
502,
565,
278,
1353,
338,
6019,
29892,
731,
304,
5852,
6336,
13,
1678,
396,
1334,
674,
731,
304,
7700,
565,
278,
1353,
338,
8572,
1821,
491,
738,
1353,
3109,
1135,
372,
13,
1678,
1353,
29918,
275,
29918,
10080,
353,
5852,
13,
13,
1678,
396,
2425,
975,
599,
3694,
3109,
1135,
278,
1881,
1353,
13,
1678,
363,
474,
297,
3464,
29898,
29906,
29892,
1353,
1125,
13,
13,
4706,
396,
8147,
278,
21162,
13,
4706,
21162,
353,
1353,
1273,
474,
13,
13,
4706,
396,
565,
278,
21162,
338,
29871,
29900,
29892,
769,
278,
1353,
338,
451,
6019,
491,
5023,
29991,
13,
4706,
565,
21162,
1275,
29871,
29900,
29901,
13,
9651,
1353,
29918,
275,
29918,
10080,
353,
7700,
13,
13,
1678,
396,
736,
1121,
304,
278,
1404,
13,
1678,
736,
1353,
29918,
275,
29918,
10080,
13,
2
] |
ramjet/analysis/viewer/preloader.py | golmschenk/ramjet | 3 | 133160 | """
Code to load view entities in the background so they show up quickly when displayed.
"""
import pandas as pd
import asyncio
from asyncio import Task
from collections import deque
import warnings
from pathlib import Path
from typing import Union, Deque
from ramjet.analysis.viewer.view_entity import ViewEntity
from ramjet.data_interface.tess_data_interface import NoDataProductsFoundException
class Preloader:
"""
A class to load view entities in the background so they show up quickly when displayed.
"""
minimum_preloaded = 25
maximum_preloaded = 50
def __init__(self):
self.current_view_entity: Union[None, ViewEntity] = None
self.next_view_entity_deque: Deque[ViewEntity] = deque(maxlen=self.maximum_preloaded)
self.previous_view_entity_deque: Deque[ViewEntity] = deque(maxlen=self.maximum_preloaded)
self.identifier_data_frame: Union[pd.DataFrame, None] = None
self.running_loading_task: Union[Task, None] = None
async def load_view_entity_at_index_as_current(self, index: int):
"""
Loads the view entity at the passed index as the current view entity.
:param index: The index in the path list to load.
"""
await self.cancel_loading_task()
self.current_view_entity = await ViewEntity.from_identifier_data_frame_row(
self.identifier_data_frame.iloc[index])
await self.reset_deques()
async def load_surrounding_view_entities(self):
"""
Loads the next and previous view entities relative to the current view entity.
"""
await self.load_next_view_entities()
await self.load_previous_view_entities()
async def load_next_view_entities(self):
"""
Preload the next view entities.
"""
if len(self.next_view_entity_deque) > 0:
last_index = self.next_view_entity_deque[-1].index
else:
last_index = self.current_view_entity.index
while (len(self.next_view_entity_deque) < self.minimum_preloaded and
last_index != self.identifier_data_frame.shape[0] - 1):
last_index += 1
try:
last_view_entity = await ViewEntity.from_identifier_data_frame_row(
self.identifier_data_frame.iloc[last_index])
except NoDataProductsFoundException:
warnings.warn(f'No light curve found for identifier {self.identifier_data_frame.iloc[last_index]}.')
continue
self.next_view_entity_deque.append(last_view_entity)
async def load_previous_view_entities(self):
"""
Preload the previous view entities.
"""
if len(self.previous_view_entity_deque) > 0:
first_index = self.previous_view_entity_deque[0].index
else:
first_index = self.current_view_entity.index
while (len(self.previous_view_entity_deque) < self.minimum_preloaded and
first_index != 0):
first_index -= 1
try:
first_view_entity = await ViewEntity.from_identifier_data_frame_row(
self.identifier_data_frame.iloc[first_index])
except NoDataProductsFoundException:
warnings.warn(f'No light curve found for identifier {self.identifier_data_frame.iloc[first_index]}.')
continue
self.previous_view_entity_deque.appendleft(first_view_entity)
async def increment(self) -> ViewEntity:
"""
Increments to the next view entity, and calls loading as necessary.
:return: The new current view entity.
"""
self.previous_view_entity_deque.append(self.current_view_entity)
if len(self.next_view_entity_deque) == 0 and (
self.running_loading_task is not None and not self.running_loading_task.done()):
await self.running_loading_task
self.current_view_entity = self.next_view_entity_deque.popleft()
await self.refresh_surrounding_light_curve_loading()
return self.current_view_entity
async def decrement(self) -> ViewEntity:
"""
Decrements to the previous view entity, and calls loading as necessary.
:return: The new current view entity.
"""
self.next_view_entity_deque.appendleft(self.current_view_entity)
while len(self.previous_view_entity_deque) == 0 and (
self.running_loading_task is not None and not self.running_loading_task.done()):
await self.running_loading_task
self.current_view_entity = self.previous_view_entity_deque.pop()
await self.refresh_surrounding_light_curve_loading()
return self.current_view_entity
async def refresh_surrounding_light_curve_loading(self):
"""
Cancels the existing loading task and starts a new one.
"""
await self.cancel_loading_task()
self.running_loading_task = asyncio.create_task(self.load_surrounding_view_entities())
async def cancel_loading_task(self):
"""
Cancels an existing loading task if it exists.
"""
if self.running_loading_task is not None:
self.running_loading_task.cancel()
try:
await self.running_loading_task
except asyncio.CancelledError:
pass
async def reset_deques(self):
"""
Cancels any loading tasks, clears the deques, and starts the loading task.
"""
await self.cancel_loading_task()
self.previous_view_entity_deque = deque(maxlen=self.maximum_preloaded)
self.next_view_entity_deque = deque(maxlen=self.maximum_preloaded)
self.running_loading_task = asyncio.create_task(self.load_surrounding_view_entities())
@classmethod
async def from_csv_path(cls, csv_path: Path, starting_index: int = 0):
"""
Create a preloader from a CSV of light curve identifiers.
:param csv_path: A path to a CSV containing light curve identifier information.
:param starting_index: The starting index to preload around.
:return: The preloader.
"""
preloader = cls()
preloader.identifier_data_frame = pd.read_csv(csv_path)
await preloader.load_view_entity_at_index_as_current(starting_index)
return preloader
| [
1,
9995,
13,
3399,
304,
2254,
1776,
16212,
297,
278,
3239,
577,
896,
1510,
701,
9098,
746,
8833,
29889,
13,
15945,
29908,
13,
5215,
11701,
408,
10518,
13,
5215,
408,
948,
3934,
13,
3166,
408,
948,
3934,
1053,
9330,
13,
3166,
16250,
1053,
316,
802,
13,
5215,
18116,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
7761,
29892,
897,
802,
13,
13,
3166,
13472,
4026,
29889,
15916,
29889,
29894,
15580,
29889,
1493,
29918,
10041,
1053,
4533,
6691,
13,
3166,
13472,
4026,
29889,
1272,
29918,
13248,
29889,
29873,
404,
29918,
1272,
29918,
13248,
1053,
1939,
1469,
25767,
9692,
2451,
13,
13,
13,
1990,
4721,
12657,
29901,
13,
1678,
9995,
13,
1678,
319,
770,
304,
2254,
1776,
16212,
297,
278,
3239,
577,
896,
1510,
701,
9098,
746,
8833,
29889,
13,
1678,
9995,
13,
1678,
9212,
29918,
1457,
15638,
353,
29871,
29906,
29945,
13,
1678,
7472,
29918,
1457,
15638,
353,
29871,
29945,
29900,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
29901,
7761,
29961,
8516,
29892,
4533,
6691,
29962,
353,
6213,
13,
4706,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29901,
897,
802,
29961,
1043,
6691,
29962,
353,
316,
802,
29898,
3317,
2435,
29922,
1311,
29889,
27525,
398,
29918,
1457,
15638,
29897,
13,
4706,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29901,
897,
802,
29961,
1043,
6691,
29962,
353,
316,
802,
29898,
3317,
2435,
29922,
1311,
29889,
27525,
398,
29918,
1457,
15638,
29897,
13,
4706,
1583,
29889,
25378,
29918,
1272,
29918,
2557,
29901,
7761,
29961,
15926,
29889,
17271,
29892,
6213,
29962,
353,
6213,
13,
4706,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
29901,
7761,
29961,
5398,
29892,
6213,
29962,
353,
6213,
13,
13,
1678,
7465,
822,
2254,
29918,
1493,
29918,
10041,
29918,
271,
29918,
2248,
29918,
294,
29918,
3784,
29898,
1311,
29892,
2380,
29901,
938,
1125,
13,
4706,
9995,
13,
4706,
4309,
7925,
278,
1776,
7855,
472,
278,
4502,
2380,
408,
278,
1857,
1776,
7855,
29889,
13,
13,
4706,
584,
3207,
2380,
29901,
450,
2380,
297,
278,
2224,
1051,
304,
2254,
29889,
13,
4706,
9995,
13,
4706,
7272,
1583,
29889,
20713,
29918,
13234,
29918,
7662,
580,
13,
4706,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
353,
7272,
4533,
6691,
29889,
3166,
29918,
25378,
29918,
1272,
29918,
2557,
29918,
798,
29898,
13,
9651,
1583,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
309,
542,
29961,
2248,
2314,
13,
4706,
7272,
1583,
29889,
12071,
29918,
311,
1912,
580,
13,
13,
1678,
7465,
822,
2254,
29918,
29879,
1038,
12449,
29918,
1493,
29918,
296,
1907,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4309,
7925,
278,
2446,
322,
3517,
1776,
16212,
6198,
304,
278,
1857,
1776,
7855,
29889,
13,
4706,
9995,
13,
4706,
7272,
1583,
29889,
1359,
29918,
4622,
29918,
1493,
29918,
296,
1907,
580,
13,
4706,
7272,
1583,
29889,
1359,
29918,
24957,
29918,
1493,
29918,
296,
1907,
580,
13,
13,
1678,
7465,
822,
2254,
29918,
4622,
29918,
1493,
29918,
296,
1907,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4721,
1359,
278,
2446,
1776,
16212,
29889,
13,
4706,
9995,
13,
4706,
565,
7431,
29898,
1311,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1833,
29918,
2248,
353,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
14352,
29896,
1822,
2248,
13,
4706,
1683,
29901,
13,
9651,
1833,
29918,
2248,
353,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
29889,
2248,
13,
4706,
1550,
313,
2435,
29898,
1311,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
529,
1583,
29889,
1195,
12539,
29918,
1457,
15638,
322,
13,
1669,
1833,
29918,
2248,
2804,
1583,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
12181,
29961,
29900,
29962,
448,
29871,
29896,
1125,
13,
9651,
1833,
29918,
2248,
4619,
29871,
29896,
13,
9651,
1018,
29901,
13,
18884,
1833,
29918,
1493,
29918,
10041,
353,
7272,
4533,
6691,
29889,
3166,
29918,
25378,
29918,
1272,
29918,
2557,
29918,
798,
29898,
13,
462,
1678,
1583,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
309,
542,
29961,
4230,
29918,
2248,
2314,
13,
9651,
5174,
1939,
1469,
25767,
9692,
2451,
29901,
13,
18884,
18116,
29889,
25442,
29898,
29888,
29915,
3782,
3578,
11672,
1476,
363,
15882,
426,
1311,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
309,
542,
29961,
4230,
29918,
2248,
29962,
1836,
1495,
13,
18884,
6773,
13,
9651,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
4397,
29898,
4230,
29918,
1493,
29918,
10041,
29897,
13,
13,
1678,
7465,
822,
2254,
29918,
24957,
29918,
1493,
29918,
296,
1907,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4721,
1359,
278,
3517,
1776,
16212,
29889,
13,
4706,
9995,
13,
4706,
565,
7431,
29898,
1311,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
1405,
29871,
29900,
29901,
13,
9651,
937,
29918,
2248,
353,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29961,
29900,
1822,
2248,
13,
4706,
1683,
29901,
13,
9651,
937,
29918,
2248,
353,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
29889,
2248,
13,
4706,
1550,
313,
2435,
29898,
1311,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
529,
1583,
29889,
1195,
12539,
29918,
1457,
15638,
322,
13,
1669,
937,
29918,
2248,
2804,
29871,
29900,
1125,
13,
9651,
937,
29918,
2248,
22361,
29871,
29896,
13,
9651,
1018,
29901,
13,
18884,
937,
29918,
1493,
29918,
10041,
353,
7272,
4533,
6691,
29889,
3166,
29918,
25378,
29918,
1272,
29918,
2557,
29918,
798,
29898,
13,
462,
1678,
1583,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
309,
542,
29961,
4102,
29918,
2248,
2314,
13,
9651,
5174,
1939,
1469,
25767,
9692,
2451,
29901,
13,
18884,
18116,
29889,
25442,
29898,
29888,
29915,
3782,
3578,
11672,
1476,
363,
15882,
426,
1311,
29889,
25378,
29918,
1272,
29918,
2557,
29889,
309,
542,
29961,
4102,
29918,
2248,
29962,
1836,
1495,
13,
18884,
6773,
13,
9651,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
4397,
1563,
29898,
4102,
29918,
1493,
29918,
10041,
29897,
13,
13,
1678,
7465,
822,
11924,
29898,
1311,
29897,
1599,
4533,
6691,
29901,
13,
4706,
9995,
13,
4706,
512,
1037,
1860,
304,
278,
2446,
1776,
7855,
29892,
322,
5717,
8363,
408,
5181,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
716,
1857,
1776,
7855,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
4397,
29898,
1311,
29889,
3784,
29918,
1493,
29918,
10041,
29897,
13,
4706,
565,
7431,
29898,
1311,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
1275,
29871,
29900,
322,
313,
13,
18884,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
338,
451,
6213,
322,
451,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
29889,
15091,
580,
1125,
13,
9651,
7272,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
13,
4706,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
353,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
7323,
1563,
580,
13,
4706,
7272,
1583,
29889,
22379,
29918,
29879,
1038,
12449,
29918,
4366,
29918,
2764,
345,
29918,
13234,
580,
13,
4706,
736,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
13,
13,
1678,
7465,
822,
9263,
358,
29898,
1311,
29897,
1599,
4533,
6691,
29901,
13,
4706,
9995,
13,
4706,
3826,
276,
1860,
304,
278,
3517,
1776,
7855,
29892,
322,
5717,
8363,
408,
5181,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
716,
1857,
1776,
7855,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
4397,
1563,
29898,
1311,
29889,
3784,
29918,
1493,
29918,
10041,
29897,
13,
4706,
1550,
7431,
29898,
1311,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29897,
1275,
29871,
29900,
322,
313,
13,
18884,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
338,
451,
6213,
322,
451,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
29889,
15091,
580,
1125,
13,
9651,
7272,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
13,
4706,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
353,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
29889,
7323,
580,
13,
4706,
7272,
1583,
29889,
22379,
29918,
29879,
1038,
12449,
29918,
4366,
29918,
2764,
345,
29918,
13234,
580,
13,
4706,
736,
1583,
29889,
3784,
29918,
1493,
29918,
10041,
13,
13,
1678,
7465,
822,
11086,
29918,
29879,
1038,
12449,
29918,
4366,
29918,
2764,
345,
29918,
13234,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1815,
29883,
1379,
278,
5923,
8363,
3414,
322,
8665,
263,
716,
697,
29889,
13,
4706,
9995,
13,
4706,
7272,
1583,
29889,
20713,
29918,
13234,
29918,
7662,
580,
13,
4706,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
353,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
1311,
29889,
1359,
29918,
29879,
1038,
12449,
29918,
1493,
29918,
296,
1907,
3101,
13,
13,
1678,
7465,
822,
12611,
29918,
13234,
29918,
7662,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1815,
29883,
1379,
385,
5923,
8363,
3414,
565,
372,
4864,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
29889,
20713,
580,
13,
9651,
1018,
29901,
13,
18884,
7272,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
13,
9651,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
18884,
1209,
13,
13,
1678,
7465,
822,
10092,
29918,
311,
1912,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1815,
29883,
1379,
738,
8363,
9595,
29892,
4531,
1503,
278,
316,
1912,
29892,
322,
8665,
278,
8363,
3414,
29889,
13,
4706,
9995,
13,
4706,
7272,
1583,
29889,
20713,
29918,
13234,
29918,
7662,
580,
13,
4706,
1583,
29889,
24957,
29918,
1493,
29918,
10041,
29918,
311,
802,
353,
316,
802,
29898,
3317,
2435,
29922,
1311,
29889,
27525,
398,
29918,
1457,
15638,
29897,
13,
4706,
1583,
29889,
4622,
29918,
1493,
29918,
10041,
29918,
311,
802,
353,
316,
802,
29898,
3317,
2435,
29922,
1311,
29889,
27525,
398,
29918,
1457,
15638,
29897,
13,
4706,
1583,
29889,
21094,
29918,
13234,
29918,
7662,
353,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
1311,
29889,
1359,
29918,
29879,
1038,
12449,
29918,
1493,
29918,
296,
1907,
3101,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
7465,
822,
515,
29918,
7638,
29918,
2084,
29898,
25932,
29892,
11799,
29918,
2084,
29901,
10802,
29892,
6257,
29918,
2248,
29901,
938,
353,
29871,
29900,
1125,
13,
4706,
9995,
13,
4706,
6204,
263,
758,
12657,
515,
263,
16874,
310,
3578,
11672,
2893,
14903,
29889,
13,
13,
4706,
584,
3207,
11799,
29918,
2084,
29901,
319,
2224,
304,
263,
16874,
6943,
3578,
11672,
15882,
2472,
29889,
13,
4706,
584,
3207,
6257,
29918,
2248,
29901,
450,
6257,
2380,
304,
758,
1359,
2820,
29889,
13,
4706,
584,
2457,
29901,
450,
758,
12657,
29889,
13,
4706,
9995,
13,
4706,
758,
12657,
353,
1067,
29879,
580,
13,
4706,
758,
12657,
29889,
25378,
29918,
1272,
29918,
2557,
353,
10518,
29889,
949,
29918,
7638,
29898,
7638,
29918,
2084,
29897,
13,
4706,
7272,
758,
12657,
29889,
1359,
29918,
1493,
29918,
10041,
29918,
271,
29918,
2248,
29918,
294,
29918,
3784,
29898,
2962,
292,
29918,
2248,
29897,
13,
4706,
736,
758,
12657,
13,
2
] |
qa327_test/backend/test_r1_post.py | winterNebs/HyperTextAssassins | 2 | 152751 | import pytest
from seleniumbase import BaseCase
from qa327.models import db, User
from qa327_test.conftest import base_url
from unittest.mock import patch
from werkzeug.security import generate_password_hash, check_password_hash
test_user = User(
email='<EMAIL>',
name='testuser',
password=generate_password_hash('<PASSWORD>$')
)
testuser1 = User(email='<EMAIL>', name='testuser',
password=generate_password_hash('<PASSWORD>$')
)
testuser2 = User(
email='<EMAIL>',
name='testuser',
password=generate_password_hash('<PASSWORD>$')
)
testuser3 = User(
email="this'isactuallyv{<EMAIL>",
name='testuser',
password=generate_password_hash('<PASSWORD>$')
)
testuser4 = User(email='<EMAIL>', name='testuser',
password=generate_password_hash("<PASSWORD>")
)
testuser5 = User(email='<EMAIL>', name='testuser',
password=generate_password_hash('<PASSWORD>')
)
class R1TestPost(BaseCase):
# Test form post
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter user name and password
self.type("#email", "<EMAIL>")
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test both password username empty
def test_r1_post_2_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# try submit login without password or name
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test password empty
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_2_2(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter user name
self.type("#email", "<EMAIL>")
# try submit form
self.click("input[type='submit']")
# should be email format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test no email
def test_r1_post_2_3(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter password but no email
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be email format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test invalid email formats
def test_r1_post_3_1(self, *_):
for i in ["<EMAIL>", "<EMAIL>"]:
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", i)
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be email format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test invalid email characters
def test_r1_post_3_2(self, *_):
for i in ["test\"(test,:;<>[\\]<EMAIL>", "test\"test <EMAIL>", "t<EMAIL>"]:
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", i)
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be email format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test valid emails
@patch('qa327.backend.get_user', return_value=testuser1)
def test_r1_post_3_3_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", '<EMAIL>')
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test valid email
@patch('qa327.backend.get_user', return_value=testuser2)
def test_r1_post_3_3_2(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", '<EMAIL>')
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test valid email
@patch('qa327.backend.get_user', return_value=testuser3)
def test_r1_post_3_3_3(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "this'isactuallyv{[email protected]")
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test email that is too long
def test_r1_post_3_4(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "12345678<EMAIL>2345678<EMAIL>2345678<EMAIL>5678<EMAIL>2345678<EMAIL>8<EMAIL>" )
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test invalid email formats
def test_r1_post_3_5(self, *_):
# for the following emails
for i in ["test..<EMAIL>", "<EMAIL>.<EMAIL>",".<EMAIL>", "<EMAIL>"]:
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", i)
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# password too short
def test_r1_post_4_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>!")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# password missing special character
def test_r1_post_4_2(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# password missing lowercase
def test_r1_post_4_3(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>!!!!")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# password missing uppercase
def test_r1_post_4_4(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>!!!!")
# try submit form
self.click("input[type='submit']")
# should be format is incorrect
self.assert_element("#message")
self.assert_text("Email/password format is incorrect.")
# test that valid passwords work
@patch('qa327.backend.get_user', return_value=testuser4)
def test_r1_post_4_6_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", '<EMAIL>')
# enter password
self.type("#password", "<PASSWORD>")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test that valid passwords work
@patch('qa327.backend.get_user', return_value=testuser5)
def test_r1_post_4_6_2(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>")
# try submit form
self.click("input[type='submit']")
self.open(base_url)
# validate that we are logged in (ie we can see the welcome header
# and our name)
self.assert_element("#welcome-header")
self.assert_text("Hi testuser !")
# test that redirected to / with valid email pw
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_6(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter user name and password
self.type("#email", "<EMAIL>")
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# check that we are on / now
self.assertEqual(self.get_current_url(), base_url+'/')
# incorrect passwoord
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_7_1(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password but no name
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be incorrect combo
self.assert_element("#message")
self.assert_text("Email/password combination incorrect")
# incorrect email
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_7_2(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>$")
# try submit form
self.click("input[type='submit']")
# should be incorrect combo
self.assert_element("#message")
self.assert_text("Email/password combination incorrect")
# incorrect email and password
@patch('qa327.backend.get_user', return_value=test_user)
def test_r1_post_7_3(self, *_):
# logout if logged in
self.open(base_url + '/logout')
# open login page
self.open(base_url +'/login')
# enter email
self.type("#email", "<EMAIL>")
# enter password
self.type("#password", "<PASSWORD>!")
# try submit form
self.click("input[type='submit']")
# should be incorrect combo
self.assert_element("#message")
self.assert_text("Email/password combination incorrect")
| [
1,
1053,
11451,
1688,
13,
3166,
18866,
3188,
1053,
7399,
8259,
13,
3166,
3855,
29874,
29941,
29906,
29955,
29889,
9794,
1053,
4833,
29892,
4911,
13,
3166,
3855,
29874,
29941,
29906,
29955,
29918,
1688,
29889,
535,
615,
342,
1053,
2967,
29918,
2271,
13,
3166,
443,
27958,
29889,
17640,
1053,
13261,
13,
3166,
23085,
13289,
29889,
8926,
1053,
5706,
29918,
5630,
29918,
8568,
29892,
1423,
29918,
5630,
29918,
8568,
13,
13,
1688,
29918,
1792,
353,
4911,
29898,
13,
1678,
4876,
2433,
29966,
26862,
6227,
29958,
742,
13,
1678,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
877,
29966,
25711,
17013,
29958,
29938,
1495,
13,
29897,
13,
1688,
1792,
29896,
353,
4911,
29898,
5269,
2433,
29966,
26862,
6227,
29958,
742,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
877,
29966,
25711,
17013,
29958,
29938,
1495,
13,
29897,
13,
1688,
1792,
29906,
353,
4911,
29898,
13,
1678,
4876,
2433,
29966,
26862,
6227,
29958,
742,
13,
1678,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
877,
29966,
25711,
17013,
29958,
29938,
1495,
13,
29897,
13,
1688,
1792,
29941,
353,
4911,
29898,
13,
1678,
4876,
543,
1366,
29915,
275,
627,
1474,
29894,
29912,
29966,
26862,
6227,
28341,
13,
1678,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
877,
29966,
25711,
17013,
29958,
29938,
1495,
13,
29897,
13,
13,
1688,
1792,
29946,
353,
4911,
29898,
5269,
2433,
29966,
26862,
6227,
29958,
742,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
28945,
25711,
17013,
29958,
1159,
13,
29897,
13,
1688,
1792,
29945,
353,
4911,
29898,
5269,
2433,
29966,
26862,
6227,
29958,
742,
1024,
2433,
1688,
1792,
742,
13,
1678,
4800,
29922,
17158,
29918,
5630,
29918,
8568,
877,
29966,
25711,
17013,
29958,
1495,
13,
29897,
13,
1990,
390,
29896,
3057,
6747,
29898,
5160,
8259,
1125,
13,
1678,
396,
4321,
883,
1400,
29871,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
1404,
1024,
322,
4800,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
1716,
4800,
8952,
4069,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29906,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
1018,
9752,
6464,
1728,
4800,
470,
1024,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
29871,
3402,
29871,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
4800,
4069,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29906,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
1404,
1024,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
4876,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
694,
4876,
29871,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29906,
29918,
29941,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4800,
541,
694,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
4876,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
8340,
4876,
21971,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
363,
474,
297,
6796,
29966,
26862,
6227,
28341,
9872,
26862,
6227,
29958,
3108,
29901,
13,
9651,
396,
1480,
449,
565,
13817,
297,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
9651,
396,
1722,
6464,
1813,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
9651,
396,
3896,
4876,
259,
13,
9651,
1583,
29889,
1853,
14822,
5269,
613,
474,
29897,
13,
9651,
396,
3896,
4800,
13,
9651,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
9651,
396,
1018,
9752,
883,
29871,
13,
9651,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
9651,
396,
881,
367,
4876,
3402,
338,
10240,
29871,
13,
9651,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
9651,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
8340,
4876,
4890,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
363,
474,
297,
6796,
1688,
5931,
29898,
1688,
29892,
29901,
29936,
29966,
24566,
1966,
29962,
29966,
26862,
6227,
28341,
376,
1688,
5931,
1688,
529,
26862,
6227,
28341,
376,
29873,
29966,
26862,
6227,
29958,
3108,
29901,
13,
9651,
396,
1480,
449,
565,
13817,
297,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
9651,
396,
1722,
6464,
1813,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
9651,
396,
3896,
4876,
259,
13,
9651,
1583,
29889,
1853,
14822,
5269,
613,
474,
29897,
13,
9651,
396,
3896,
4800,
29871,
13,
9651,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
9651,
396,
1018,
9752,
883,
29871,
13,
9651,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
9651,
396,
881,
367,
4876,
3402,
338,
10240,
29871,
13,
9651,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
9651,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
2854,
24609,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
1792,
29896,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29941,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
12801,
26862,
6227,
29958,
1495,
13,
4706,
396,
3896,
4800,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
2854,
4876,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
1792,
29906,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29941,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
12801,
26862,
6227,
29958,
1495,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
2854,
4876,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
1792,
29941,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29941,
29918,
29941,
29898,
1311,
29892,
334,
29918,
1125,
13,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
376,
1366,
29915,
275,
627,
1474,
29894,
29912,
554,
29992,
29893,
13264,
29889,
29880,
324,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
4876,
393,
338,
2086,
1472,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29946,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
376,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29966,
26862,
6227,
29958,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29966,
26862,
6227,
29958,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29966,
26862,
6227,
29958,
29945,
29953,
29955,
29947,
29966,
26862,
6227,
29958,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29966,
26862,
6227,
29958,
29947,
29966,
26862,
6227,
11903,
1723,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
1243,
8340,
4876,
21971,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29941,
29918,
29945,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
363,
278,
1494,
24609,
29871,
13,
4706,
363,
474,
297,
6796,
1688,
636,
29966,
26862,
6227,
28341,
9872,
26862,
6227,
15513,
29966,
26862,
6227,
28341,
1642,
29966,
26862,
6227,
28341,
9872,
26862,
6227,
29958,
3108,
29901,
13,
9651,
396,
1480,
449,
565,
13817,
297,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
9651,
396,
1722,
6464,
1813,
13,
9651,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
9651,
396,
3896,
4876,
259,
13,
9651,
1583,
29889,
1853,
14822,
5269,
613,
474,
29897,
13,
9651,
396,
3896,
4800,
29871,
13,
9651,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
9651,
396,
1018,
9752,
883,
29871,
13,
9651,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
9651,
396,
881,
367,
3402,
338,
10240,
29871,
13,
9651,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
9651,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
4800,
2086,
3273,
29871,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29991,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
1678,
396,
4800,
4567,
4266,
2931,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
13,
13,
1678,
396,
4800,
4567,
5224,
4878,
29871,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29941,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
6824,
6824,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
13,
1678,
396,
4800,
4567,
7568,
4878,
259,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29946,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
6824,
6824,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
3402,
338,
10240,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
3402,
338,
10240,
23157,
13,
13,
13,
1678,
396,
1243,
393,
2854,
27630,
664,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
1792,
29946,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29953,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
12801,
26862,
6227,
29958,
1495,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
393,
2854,
27630,
664,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
1792,
29945,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29946,
29918,
29953,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
29897,
13,
4706,
396,
12725,
393,
591,
526,
13817,
297,
313,
347,
591,
508,
1074,
278,
12853,
4839,
13,
4706,
396,
322,
1749,
1024,
29897,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
20466,
2763,
29899,
6672,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
18567,
1243,
1792,
1738,
1159,
13,
13,
1678,
396,
1243,
393,
6684,
287,
304,
847,
411,
2854,
4876,
282,
29893,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29953,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
1404,
1024,
322,
4800,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
1423,
393,
591,
526,
373,
847,
1286,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
657,
29918,
3784,
29918,
2271,
3285,
2967,
29918,
2271,
23097,
29914,
1495,
13,
13,
1678,
396,
10240,
1209,
25317,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29955,
29918,
29896,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
541,
694,
1024,
259,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
10240,
419,
833,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
10296,
10240,
1159,
13,
13,
1678,
396,
10240,
4876,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29955,
29918,
29906,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29938,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
10240,
419,
833,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
10296,
10240,
1159,
13,
13,
1678,
396,
10240,
4876,
322,
4800,
13,
1678,
732,
5041,
877,
25621,
29941,
29906,
29955,
29889,
27852,
29889,
657,
29918,
1792,
742,
736,
29918,
1767,
29922,
1688,
29918,
1792,
29897,
13,
1678,
822,
1243,
29918,
29878,
29896,
29918,
2490,
29918,
29955,
29918,
29941,
29898,
1311,
29892,
334,
29918,
1125,
13,
4706,
396,
1480,
449,
565,
13817,
297,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
8207,
1188,
449,
1495,
13,
4706,
396,
1722,
6464,
1813,
13,
4706,
1583,
29889,
3150,
29898,
3188,
29918,
2271,
718,
29915,
29914,
7507,
1495,
13,
4706,
396,
3896,
4876,
259,
13,
4706,
1583,
29889,
1853,
14822,
5269,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
396,
3896,
4800,
29871,
13,
4706,
1583,
29889,
1853,
14822,
5630,
613,
9872,
25711,
17013,
29958,
29991,
1159,
13,
4706,
396,
1018,
9752,
883,
29871,
13,
4706,
1583,
29889,
3808,
703,
2080,
29961,
1853,
2433,
7892,
2033,
1159,
13,
4706,
396,
881,
367,
10240,
419,
833,
29871,
13,
4706,
1583,
29889,
9294,
29918,
5029,
14822,
4906,
1159,
13,
4706,
1583,
29889,
9294,
29918,
726,
703,
9823,
29914,
5630,
10296,
10240,
1159,
13,
2
] |
src/generator/AutoRest.Python.Azure.Tests/AcceptanceTests/xms_request_clientid_tests.py | yugangw-msft/AutoRest | 3 | 88681 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# 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 unittest
import subprocess
import sys
import isodate
import tempfile
import json
from uuid import uuid4
from datetime import date, datetime, timedelta
import os
from os.path import dirname, pardir, join, realpath
cwd = dirname(realpath(__file__))
log_level = int(os.environ.get('PythonLogLevel', 30))
tests = realpath(join(cwd, pardir, "Expected", "AcceptanceTests"))
sys.path.append(join(tests, "AzureSpecials"))
from msrest.serialization import Deserializer
from msrest.exceptions import DeserializationError
from msrest.authentication import BasicTokenAuthentication
from msrestazure.azure_exceptions import CloudError, CloudErrorData
from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient
from autorestazurespecialparameterstestclient import models
class XmsRequestClientIdTests(unittest.TestCase):
def test_xms_request_client_id(self):
validSubscription = '1234-5678-9012-3456'
validClientId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'
cred = BasicTokenAuthentication({"access_token":123})
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
custom_headers = {"x-ms-client-request-id": validClientId }
result1 = client.xms_client_request_id.get(custom_headers = custom_headers, raw=True)
#TODO: should we put the x-ms-request-id into response header of swagger spec?
self.assertEqual("123", result1.response.headers.get("x-ms-request-id"))
result2 = client.xms_client_request_id.param_get(validClientId, raw=True)
self.assertEqual("123", result2.response.headers.get("x-ms-request-id"))
def test_custom_named_request_id(self):
validSubscription = '1234-5678-9012-3456'
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'
cred = BasicTokenAuthentication({"access_token":123})
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
response = client.header.custom_named_request_id(expectedRequestId, raw=True)
self.assertEqual("123", response.response.headers.get("foo-request-id"))
def test_custom_named_request_id_param_grouping(self):
validSubscription = '1234-5678-9012-3456'
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'
cred = BasicTokenAuthentication({"access_token":123})
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
group = models.HeaderCustomNamedRequestIdParamGroupingParameters(foo_client_request_id=expectedRequestId)
response = client.header.custom_named_request_id_param_grouping(group, raw=True)
self.assertEqual("123", response.response.headers.get("foo-request-id"))
def test_client_request_id_in_exception(self):
validSubscription = '1234-5678-9012-3456'
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'
cred = BasicTokenAuthentication({"access_token":123})
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
try:
client.xms_client_request_id.get()
self.fail("CloudError wasn't raised as expected")
except CloudError as err:
self.assertEqual("123", err.request_id)
def test_xms_request_client_id_in_client(self):
validSubscription = '1234-5678-9012-3456'
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'
cred = BasicTokenAuthentication({"access_token":123})
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
client.config.generate_client_request_id = False
client.xms_client_request_id.get()
if __name__ == '__main__':
unittest.main()
| [
1,
29871,
30143,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
7783,
15025,
29889,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
450,
341,
1806,
19245,
313,
26349,
29897,
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,
5124,
6295,
14093,
29908,
4968,
304,
13,
29937,
5376,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
13,
29937,
10462,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
13,
29937,
19417,
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,
13,
29937,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
334,
3289,
8519,
15966,
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,
13,
29937,
3895,
29892,
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,
13,
29937,
2672,
6093,
7791,
7818,
12982,
1525,
29889,
13,
29937,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
13,
5215,
443,
27958,
13,
5215,
1014,
5014,
13,
5215,
10876,
13,
5215,
338,
397,
403,
13,
5215,
5694,
1445,
13,
5215,
4390,
13,
3166,
318,
5416,
1053,
318,
5416,
29946,
13,
3166,
12865,
1053,
2635,
29892,
12865,
29892,
5335,
287,
2554,
13,
5215,
2897,
13,
3166,
2897,
29889,
2084,
1053,
4516,
978,
29892,
282,
538,
381,
29892,
5988,
29892,
1855,
2084,
13,
13,
29883,
9970,
353,
4516,
978,
29898,
6370,
2084,
22168,
1445,
1649,
876,
13,
1188,
29918,
5563,
353,
938,
29898,
359,
29889,
21813,
29889,
657,
877,
11980,
3403,
10108,
742,
29871,
29941,
29900,
876,
13,
13,
21150,
353,
1855,
2084,
29898,
7122,
29898,
29883,
9970,
29892,
282,
538,
381,
29892,
376,
1252,
6021,
613,
376,
23965,
749,
24376,
5783,
13,
9675,
29889,
2084,
29889,
4397,
29898,
7122,
29898,
21150,
29892,
376,
28413,
10649,
455,
1338,
5783,
13,
13,
3166,
10887,
5060,
29889,
15550,
2133,
1053,
2726,
261,
616,
3950,
13,
3166,
10887,
5060,
29889,
11739,
29879,
1053,
2726,
261,
616,
2133,
2392,
13,
3166,
10887,
5060,
29889,
23055,
1053,
19219,
6066,
16746,
13,
3166,
10887,
5060,
17688,
29889,
17688,
29918,
11739,
29879,
1053,
14293,
2392,
29892,
14293,
2392,
1469,
13,
13,
3166,
8478,
342,
834,
1973,
412,
1455,
15501,
303,
342,
4645,
1053,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
13,
3166,
8478,
342,
834,
1973,
412,
1455,
15501,
303,
342,
4645,
1053,
4733,
13,
13,
1990,
1060,
1516,
3089,
4032,
1204,
24376,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
29916,
1516,
29918,
3827,
29918,
4645,
29918,
333,
29898,
1311,
1125,
13,
13,
4706,
2854,
4035,
22371,
353,
525,
29896,
29906,
29941,
29946,
29899,
29945,
29953,
29955,
29947,
29899,
29929,
29900,
29896,
29906,
29899,
29941,
29946,
29945,
29953,
29915,
13,
4706,
2854,
4032,
1204,
353,
525,
29929,
29907,
29946,
29928,
29945,
29900,
17896,
29899,
29906,
29928,
29945,
29953,
29899,
29946,
6530,
29941,
29899,
29947,
29896,
29945,
29906,
29899,
29941,
29946,
29941,
29946,
29955,
12696,
29929,
29943,
29906,
29933,
29900,
29915,
13,
13,
4706,
6625,
353,
19219,
6066,
16746,
3319,
29908,
5943,
29918,
6979,
1115,
29896,
29906,
29941,
1800,
13,
4706,
3132,
353,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
29898,
11944,
29892,
2854,
4035,
22371,
29892,
2967,
29918,
2271,
543,
1124,
597,
7640,
29901,
29941,
29900,
29900,
29900,
1159,
13,
13,
4706,
2888,
29918,
13662,
353,
8853,
29916,
29899,
1516,
29899,
4645,
29899,
3827,
29899,
333,
1115,
2854,
4032,
1204,
500,
13,
13,
4706,
1121,
29896,
353,
3132,
29889,
29916,
1516,
29918,
4645,
29918,
3827,
29918,
333,
29889,
657,
29898,
6341,
29918,
13662,
353,
2888,
29918,
13662,
29892,
10650,
29922,
5574,
29897,
13,
4706,
396,
4986,
3970,
29901,
881,
591,
1925,
278,
921,
29899,
1516,
29899,
3827,
29899,
333,
964,
2933,
4839,
310,
2381,
9921,
1580,
29973,
13,
4706,
1583,
29889,
9294,
9843,
703,
29896,
29906,
29941,
613,
1121,
29896,
29889,
5327,
29889,
13662,
29889,
657,
703,
29916,
29899,
1516,
29899,
3827,
29899,
333,
5783,
13,
13,
4706,
1121,
29906,
353,
3132,
29889,
29916,
1516,
29918,
4645,
29918,
3827,
29918,
333,
29889,
3207,
29918,
657,
29898,
3084,
4032,
1204,
29892,
10650,
29922,
5574,
29897,
13,
4706,
1583,
29889,
9294,
9843,
703,
29896,
29906,
29941,
613,
1121,
29906,
29889,
5327,
29889,
13662,
29889,
657,
703,
29916,
29899,
1516,
29899,
3827,
29899,
333,
5783,
13,
13,
1678,
822,
1243,
29918,
6341,
29918,
17514,
29918,
3827,
29918,
333,
29898,
1311,
1125,
13,
13,
4706,
2854,
4035,
22371,
353,
525,
29896,
29906,
29941,
29946,
29899,
29945,
29953,
29955,
29947,
29899,
29929,
29900,
29896,
29906,
29899,
29941,
29946,
29945,
29953,
29915,
13,
4706,
3806,
3089,
1204,
353,
525,
29929,
29907,
29946,
29928,
29945,
29900,
17896,
29899,
29906,
29928,
29945,
29953,
29899,
29946,
6530,
29941,
29899,
29947,
29896,
29945,
29906,
29899,
29941,
29946,
29941,
29946,
29955,
12696,
29929,
29943,
29906,
29933,
29900,
29915,
13,
13,
4706,
6625,
353,
19219,
6066,
16746,
3319,
29908,
5943,
29918,
6979,
1115,
29896,
29906,
29941,
1800,
13,
4706,
3132,
353,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
29898,
11944,
29892,
2854,
4035,
22371,
29892,
2967,
29918,
2271,
543,
1124,
597,
7640,
29901,
29941,
29900,
29900,
29900,
1159,
13,
13,
4706,
2933,
353,
3132,
29889,
6672,
29889,
6341,
29918,
17514,
29918,
3827,
29918,
333,
29898,
9684,
3089,
1204,
29892,
10650,
29922,
5574,
29897,
13,
4706,
1583,
29889,
9294,
9843,
703,
29896,
29906,
29941,
613,
2933,
29889,
5327,
29889,
13662,
29889,
657,
703,
5431,
29899,
3827,
29899,
333,
5783,
13,
13,
1678,
822,
1243,
29918,
6341,
29918,
17514,
29918,
3827,
29918,
333,
29918,
3207,
29918,
2972,
292,
29898,
1311,
1125,
13,
13,
4706,
2854,
4035,
22371,
353,
525,
29896,
29906,
29941,
29946,
29899,
29945,
29953,
29955,
29947,
29899,
29929,
29900,
29896,
29906,
29899,
29941,
29946,
29945,
29953,
29915,
13,
4706,
3806,
3089,
1204,
353,
525,
29929,
29907,
29946,
29928,
29945,
29900,
17896,
29899,
29906,
29928,
29945,
29953,
29899,
29946,
6530,
29941,
29899,
29947,
29896,
29945,
29906,
29899,
29941,
29946,
29941,
29946,
29955,
12696,
29929,
29943,
29906,
29933,
29900,
29915,
13,
13,
4706,
6625,
353,
19219,
6066,
16746,
3319,
29908,
5943,
29918,
6979,
1115,
29896,
29906,
29941,
1800,
13,
4706,
3132,
353,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
29898,
11944,
29892,
2854,
4035,
22371,
29892,
2967,
29918,
2271,
543,
1124,
597,
7640,
29901,
29941,
29900,
29900,
29900,
1159,
13,
13,
4706,
2318,
353,
4733,
29889,
7850,
7281,
22175,
3089,
1204,
4736,
4782,
292,
11507,
29898,
5431,
29918,
4645,
29918,
3827,
29918,
333,
29922,
9684,
3089,
1204,
29897,
13,
4706,
2933,
353,
3132,
29889,
6672,
29889,
6341,
29918,
17514,
29918,
3827,
29918,
333,
29918,
3207,
29918,
2972,
292,
29898,
2972,
29892,
10650,
29922,
5574,
29897,
13,
4706,
1583,
29889,
9294,
9843,
703,
29896,
29906,
29941,
613,
2933,
29889,
5327,
29889,
13662,
29889,
657,
703,
5431,
29899,
3827,
29899,
333,
5783,
13,
13,
1678,
822,
1243,
29918,
4645,
29918,
3827,
29918,
333,
29918,
262,
29918,
11739,
29898,
1311,
1125,
13,
4706,
2854,
4035,
22371,
353,
525,
29896,
29906,
29941,
29946,
29899,
29945,
29953,
29955,
29947,
29899,
29929,
29900,
29896,
29906,
29899,
29941,
29946,
29945,
29953,
29915,
13,
4706,
3806,
3089,
1204,
353,
525,
29929,
29907,
29946,
29928,
29945,
29900,
17896,
29899,
29906,
29928,
29945,
29953,
29899,
29946,
6530,
29941,
29899,
29947,
29896,
29945,
29906,
29899,
29941,
29946,
29941,
29946,
29955,
12696,
29929,
29943,
29906,
29933,
29900,
29915,
13,
13,
4706,
6625,
353,
19219,
6066,
16746,
3319,
29908,
5943,
29918,
6979,
1115,
29896,
29906,
29941,
1800,
13,
4706,
3132,
353,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
29898,
11944,
29892,
2854,
4035,
22371,
29892,
2967,
29918,
2271,
543,
1124,
597,
7640,
29901,
29941,
29900,
29900,
29900,
1159,
13,
13,
4706,
1018,
29901,
13,
9651,
3132,
29889,
29916,
1516,
29918,
4645,
29918,
3827,
29918,
333,
29889,
657,
580,
13,
9651,
1583,
29889,
14057,
703,
20442,
2392,
9007,
29915,
29873,
10425,
408,
3806,
1159,
13,
13,
4706,
5174,
14293,
2392,
408,
4589,
29901,
13,
9651,
1583,
29889,
9294,
9843,
703,
29896,
29906,
29941,
613,
4589,
29889,
3827,
29918,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
29916,
1516,
29918,
3827,
29918,
4645,
29918,
333,
29918,
262,
29918,
4645,
29898,
1311,
1125,
13,
4706,
2854,
4035,
22371,
353,
525,
29896,
29906,
29941,
29946,
29899,
29945,
29953,
29955,
29947,
29899,
29929,
29900,
29896,
29906,
29899,
29941,
29946,
29945,
29953,
29915,
13,
4706,
3806,
3089,
1204,
353,
525,
29929,
29907,
29946,
29928,
29945,
29900,
17896,
29899,
29906,
29928,
29945,
29953,
29899,
29946,
6530,
29941,
29899,
29947,
29896,
29945,
29906,
29899,
29941,
29946,
29941,
29946,
29955,
12696,
29929,
29943,
29906,
29933,
29900,
29915,
13,
13,
4706,
6625,
353,
19219,
6066,
16746,
3319,
29908,
5943,
29918,
6979,
1115,
29896,
29906,
29941,
1800,
13,
4706,
3132,
353,
11133,
15078,
28413,
24780,
11507,
3057,
4032,
29898,
11944,
29892,
2854,
4035,
22371,
29892,
2967,
29918,
2271,
543,
1124,
597,
7640,
29901,
29941,
29900,
29900,
29900,
1159,
13,
4706,
3132,
29889,
2917,
29889,
17158,
29918,
4645,
29918,
3827,
29918,
333,
353,
7700,
13,
4706,
3132,
29889,
29916,
1516,
29918,
4645,
29918,
3827,
29918,
333,
29889,
657,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
intern/views/alliance.py | mrcrgl/gge-storage | 0 | 1612443 | <reponame>mrcrgl/gge-storage<filename>intern/views/alliance.py
from __future__ import unicode_literals
from django.views.generic import (ListView, DetailView, View)
from django.shortcuts import render_to_response, RequestContext, Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse
from gge_proxy_manager.models import Alliance, Kingdom, Castle
# from django.db.models import Q
from .mixins import GameFilterMixin, game_queryset
class AllianceListView(GameFilterMixin, ListView):
model = Alliance
template_name = "alliance/list.html"
paginate_by = 25
def get_queryset(self):
queryset = game_queryset(self)
#super(GameFilterMixin, self).get_queryset()
query = self.request.GET.get("q", None)
if not query:
return queryset
for word in query.split():
queryset = queryset.filter(name__icontains=word)
return queryset
class AllianceDetailView(DetailView):
model = Alliance
template_name = "alliance/detail.html"
template_name_field = "alliance"
class AllianceMapNoKdView(View, GameFilterMixin):
def get(self, request, pk):
kingdom = Kingdom.objects.filter(game=self.get_game()).order_by('kid').first()
return HttpResponseRedirect(reverse("intern:alliance_neighborhood", kwargs={"pk": pk, "kingdom_id": kingdom.pk}))
class AllianceMapView(View, GameFilterMixin):
x_start = 0
x_stop = 1400
y_start = 0
y_stop = 1400
def get_kingdoms(self):
return Kingdom.objects.filter(game=self.get_game()).order_by('kid')
def kingdom_or_404(self, kingdom_id):
try:
return Kingdom.objects.get(pk=kingdom_id)
except Kingdom.DoesNotExist:
raise Http404
def alliance_or_404(self, alliance_id):
try:
return Alliance.objects.get(pk=alliance_id)
except Alliance.DoesNotExist:
raise Http404
def get(self, request, pk, kingdom_id):
alliance = self.alliance_or_404(pk)
kingdom = self.kingdom_or_404(kingdom_id)
kingdoms = self.get_kingdoms()
castles = Castle.objects.filter(kingdom=kingdom, player__alliance=alliance)
# , type__in=Castle.TYPE_WITH_WARRIORS
ruler_steps = [i for i in range(self.x_start, self.x_stop, 100)]
return render_to_response(
"alliance/neighborhood.html",
{
"kingdom_list": kingdoms,
"kingdom": kingdom,
"alliance": alliance,
"castle_list": castles,
"x_start": self.x_start,
"x_stop": self.x_stop,
"y_start": self.y_start,
"y_stop": self.y_stop,
"ruler_steps": ruler_steps,
},
context_instance=RequestContext(request)
) | [
1,
529,
276,
1112,
420,
29958,
29885,
2214,
29878,
3820,
29914,
29887,
479,
29899,
12925,
29966,
9507,
29958,
14168,
29914,
7406,
29914,
284,
13036,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
7406,
29889,
19206,
1053,
313,
15660,
29892,
5953,
737,
1043,
29892,
4533,
29897,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29918,
517,
29918,
5327,
29892,
10729,
2677,
29892,
9056,
29946,
29900,
29946,
29892,
9056,
5103,
24735,
13,
3166,
9557,
29889,
3221,
29889,
2271,
9778,
874,
1053,
11837,
13,
3166,
330,
479,
29918,
14701,
29918,
12847,
29889,
9794,
1053,
29855,
29892,
12626,
29892,
15194,
13,
29937,
515,
9557,
29889,
2585,
29889,
9794,
1053,
660,
13,
3166,
869,
28084,
1144,
1053,
8448,
5072,
29924,
861,
262,
29892,
3748,
29918,
1972,
842,
13,
13,
13,
1990,
29855,
15660,
29898,
14199,
5072,
29924,
861,
262,
29892,
22184,
1125,
13,
1678,
1904,
353,
29855,
13,
1678,
4472,
29918,
978,
353,
376,
284,
13036,
29914,
1761,
29889,
1420,
29908,
13,
1678,
10203,
16976,
29918,
1609,
353,
29871,
29906,
29945,
13,
13,
1678,
822,
679,
29918,
1972,
842,
29898,
1311,
1125,
13,
4706,
2346,
842,
353,
3748,
29918,
1972,
842,
29898,
1311,
29897,
13,
4706,
396,
9136,
29898,
14199,
5072,
29924,
861,
262,
29892,
1583,
467,
657,
29918,
1972,
842,
580,
13,
13,
4706,
2346,
353,
1583,
29889,
3827,
29889,
7194,
29889,
657,
703,
29939,
613,
6213,
29897,
13,
4706,
565,
451,
2346,
29901,
13,
9651,
736,
2346,
842,
13,
13,
4706,
363,
1734,
297,
2346,
29889,
5451,
7295,
13,
9651,
2346,
842,
353,
2346,
842,
29889,
4572,
29898,
978,
1649,
293,
609,
2708,
29922,
1742,
29897,
13,
13,
4706,
736,
2346,
842,
13,
13,
13,
1990,
29855,
16570,
1043,
29898,
16570,
1043,
1125,
13,
1678,
1904,
353,
29855,
13,
1678,
4472,
29918,
978,
353,
376,
284,
13036,
29914,
16432,
29889,
1420,
29908,
13,
1678,
4472,
29918,
978,
29918,
2671,
353,
376,
284,
13036,
29908,
13,
13,
13,
1990,
29855,
3388,
3782,
29968,
29881,
1043,
29898,
1043,
29892,
8448,
5072,
29924,
861,
262,
1125,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
29892,
282,
29895,
1125,
13,
4706,
20748,
353,
12626,
29889,
12650,
29889,
4572,
29898,
11802,
29922,
1311,
29889,
657,
29918,
11802,
16655,
2098,
29918,
1609,
877,
29895,
333,
2824,
4102,
580,
13,
4706,
736,
9056,
5103,
24735,
29898,
24244,
703,
14168,
29901,
284,
13036,
29918,
484,
1141,
4089,
6614,
613,
9049,
5085,
3790,
29908,
20571,
1115,
282,
29895,
29892,
376,
9292,
3129,
29918,
333,
1115,
20748,
29889,
20571,
20073,
13,
13,
13,
1990,
29855,
3388,
1043,
29898,
1043,
29892,
8448,
5072,
29924,
861,
262,
1125,
13,
13,
1678,
921,
29918,
2962,
353,
29871,
29900,
13,
1678,
921,
29918,
9847,
353,
29871,
29896,
29946,
29900,
29900,
13,
1678,
343,
29918,
2962,
353,
29871,
29900,
13,
1678,
343,
29918,
9847,
353,
29871,
29896,
29946,
29900,
29900,
13,
13,
1678,
822,
679,
29918,
9292,
3129,
29879,
29898,
1311,
1125,
13,
4706,
736,
12626,
29889,
12650,
29889,
4572,
29898,
11802,
29922,
1311,
29889,
657,
29918,
11802,
16655,
2098,
29918,
1609,
877,
29895,
333,
1495,
13,
13,
1678,
822,
20748,
29918,
272,
29918,
29946,
29900,
29946,
29898,
1311,
29892,
20748,
29918,
333,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
12626,
29889,
12650,
29889,
657,
29898,
20571,
29922,
9292,
3129,
29918,
333,
29897,
13,
4706,
5174,
12626,
29889,
25125,
3664,
1252,
391,
29901,
13,
9651,
12020,
9056,
29946,
29900,
29946,
13,
13,
1678,
822,
394,
13036,
29918,
272,
29918,
29946,
29900,
29946,
29898,
1311,
29892,
394,
13036,
29918,
333,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
29855,
29889,
12650,
29889,
657,
29898,
20571,
29922,
284,
13036,
29918,
333,
29897,
13,
4706,
5174,
29855,
29889,
25125,
3664,
1252,
391,
29901,
13,
9651,
12020,
9056,
29946,
29900,
29946,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
29892,
282,
29895,
29892,
20748,
29918,
333,
1125,
13,
4706,
394,
13036,
353,
1583,
29889,
284,
13036,
29918,
272,
29918,
29946,
29900,
29946,
29898,
20571,
29897,
13,
4706,
20748,
353,
1583,
29889,
9292,
3129,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9292,
3129,
29918,
333,
29897,
13,
4706,
20748,
29879,
353,
1583,
29889,
657,
29918,
9292,
3129,
29879,
580,
13,
13,
4706,
4320,
793,
353,
15194,
29889,
12650,
29889,
4572,
29898,
9292,
3129,
29922,
9292,
3129,
29892,
4847,
1649,
284,
13036,
29922,
284,
13036,
29897,
13,
4706,
396,
1919,
1134,
1649,
262,
29922,
15738,
280,
29889,
11116,
29918,
29956,
13054,
29918,
29956,
1718,
3960,
24125,
13,
13,
4706,
364,
8584,
29918,
24530,
353,
518,
29875,
363,
474,
297,
3464,
29898,
1311,
29889,
29916,
29918,
2962,
29892,
1583,
29889,
29916,
29918,
9847,
29892,
29871,
29896,
29900,
29900,
4638,
13,
13,
4706,
736,
4050,
29918,
517,
29918,
5327,
29898,
13,
9651,
376,
284,
13036,
29914,
484,
1141,
4089,
6614,
29889,
1420,
613,
13,
9651,
426,
13,
18884,
376,
9292,
3129,
29918,
1761,
1115,
20748,
29879,
29892,
13,
18884,
376,
9292,
3129,
1115,
20748,
29892,
13,
18884,
376,
284,
13036,
1115,
394,
13036,
29892,
13,
18884,
376,
27193,
29918,
1761,
1115,
4320,
793,
29892,
13,
18884,
376,
29916,
29918,
2962,
1115,
1583,
29889,
29916,
29918,
2962,
29892,
13,
18884,
376,
29916,
29918,
9847,
1115,
1583,
29889,
29916,
29918,
9847,
29892,
13,
18884,
376,
29891,
29918,
2962,
1115,
1583,
29889,
29891,
29918,
2962,
29892,
13,
18884,
376,
29891,
29918,
9847,
1115,
1583,
29889,
29891,
29918,
9847,
29892,
13,
18884,
376,
29878,
8584,
29918,
24530,
1115,
364,
8584,
29918,
24530,
29892,
13,
9651,
2981,
13,
9651,
3030,
29918,
8758,
29922,
3089,
2677,
29898,
3827,
29897,
13,
4706,
1723,
2
] |
src/dispatch/tag/recommender.py | homebysix/dispatch | 0 | 86441 | """
.. module: dispatch.tag.recommender
:platform: Unix
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
"""
import logging
from typing import List, Any
from collections import defaultdict
import tempfile
import pandas as pd
from pandas.core.frame import DataFrame
from dispatch.database import SessionLocal
from dispatch.tag import service as tag_service
log = logging.getLogger(__name__)
def save_model(dataframe: DataFrame, model_name: str):
"""Saves a correlation dataframe to disk."""
file_name = f"{tempfile.gettempdir()}/{model_name}.pkl"
dataframe.to_pickle(file_name)
def load_model(model_name: str):
"""Loads a correlation dataframe from disk."""
file_name = f"{tempfile.gettempdir()}/{model_name}.pkl"
return pd.read_pickle(file_name)
def correlation(df, tag_a, tag_b):
"""Determine the probability of correlation/association."""
# Find all rows where a AND b == True
a_and_b = df[(df[tag_a]) & (df[tag_b])]
# Find all rows where a == True AND b != True
a_not_b = df[(df[tag_a]) & ~(df[tag_b])]
# Find all rows where b == True AND a != True
b_not_a = df[(df[tag_b]) & ~(df[tag_a])]
# Calculate the number of positive and possible outcomes using the shape attribute
possible_outcomes = (
a_and_b.shape[0] + a_not_b.shape[0] + b_not_a.shape[0]
) # shape[0] returns the number of rows
positive_outcomes = a_and_b.shape[0]
# Calculate the final correlation coefficient
r = positive_outcomes / possible_outcomes
return r
def correlate_with_every_tag(df, tag_a):
"""Create correlations between every tag."""
unique_tags = list(df.columns)
# Loop through every tag and store the correlation in a list
correlation_list = []
for tag_b in unique_tags:
correlation_list.append(correlation(df, tag_a, tag_b))
return correlation_list
def get_unique_tags(items: List[Any]):
"""Get unique tags."""
unique_tags = {}
for i in items:
for t in i.tags:
unique_tags[t.id] = t.id
return unique_tags
def create_correlation_dataframe(dataframe):
"""Create the correlation dataframe based on the boolean dataframe."""
unique_tags = list(dataframe.columns)
correlation_matrix_dict = {}
for tag_a in unique_tags:
correlation_matrix_dict[tag_a] = correlate_with_every_tag(dataframe, tag_a)
correlated_dataframe = pd.DataFrame(correlation_matrix_dict)
correlated_dataframe["index"] = unique_tags
return correlated_dataframe.set_index("index")
def create_boolean_dataframe(items: List[Any]):
"""Create a boolean dataframe with tag and item data."""
unique_tags = get_unique_tags(items)
boolean_df = pd.DataFrame(columns=unique_tags.values())
data_dict = defaultdict(list)
for col in boolean_df:
for i in items:
tag_ids = [t.id for t in i.tags]
data_dict[col].append(col in tag_ids)
for col in boolean_df:
boolean_df[col] = data_dict[col]
return boolean_df
def find_correlations(dataframe, tag):
"""Find all correlations for the given tag."""
# Setup empty list
correlations = []
columns = []
# Loop through all column at the row with the tag as its index
for i, corr in enumerate(dataframe.loc[tag, :]):
# Find the column
col = dataframe.columns[i]
# Append the correlation to the list
correlations.append(corr)
columns.append(col)
# Create a df out of the lists
results_df = pd.DataFrame({"tag": columns, "correlation": correlations})
return results_df
def find_highest_correlations(correlated_dataframe, recommendations):
"""Find the correlations with the highest relevancy."""
# Sort the input df
corr_df_sorted = correlated_dataframe.sort_values(by=["correlation"], ascending=False)
# Extract the relevant correlations
corr_df_sliced = corr_df_sorted.iloc[1 : recommendations + 1] # noqa
return corr_df_sliced
def get_recommendations(db_session: SessionLocal, tag_ids: List[str], model_name: str, recommendations: int = 5):
"""Get recommendations based on current tag."""
try:
correlation_dataframe = load_model(model_name)
except FileNotFoundError:
log.warning(f"No model file found. ModelName: {model_name}")
return []
recommendations_dataframe = pd.DataFrame()
for tag_id in tag_ids:
correlated_dataframe = find_correlations(correlation_dataframe, tag_id)
recommendations_dataframe = pd.concat(
[
recommendations_dataframe,
find_highest_correlations(correlated_dataframe, recommendations),
],
ignore_index=True,
)
# convert back to tag objects
tags = []
for t in recommendations_dataframe["tag"][:recommendations]:
tags.append(tag_service.get(db_session=db_session, tag_id=int(t)))
log.debug(f"Making tag recommendation. RecommendedTags: {','.join([t.name for t in tags])} ModelName: {model_name}")
return tags
def build_model(items: List[Any], model_name: str):
"""Builds the correlation dataframe for items."""
boolean_dataframe = create_boolean_dataframe(items)
correlation_dataframe = create_correlation_dataframe(boolean_dataframe)
save_model(correlation_dataframe, model_name)
| [
1,
9995,
13,
636,
3883,
29901,
13916,
29889,
4039,
29889,
276,
2055,
1581,
13,
1678,
584,
12120,
29901,
26663,
13,
1678,
584,
8552,
1266,
29901,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29929,
491,
12670,
20157,
29916,
9266,
1696,
1074,
26524,
29950,
24125,
363,
901,
13,
1678,
584,
506,
1947,
29901,
13380,
29892,
1074,
365,
2965,
1430,
1660,
363,
901,
4902,
29889,
13,
15945,
29908,
13,
5215,
12183,
13,
3166,
19229,
1053,
2391,
29892,
3139,
13,
3166,
16250,
1053,
2322,
8977,
13,
13,
5215,
5694,
1445,
13,
5215,
11701,
408,
10518,
13,
3166,
11701,
29889,
3221,
29889,
2557,
1053,
3630,
4308,
13,
13,
3166,
13916,
29889,
9803,
1053,
16441,
7717,
13,
3166,
13916,
29889,
4039,
1053,
2669,
408,
4055,
29918,
5509,
13,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
4078,
29918,
4299,
29898,
1272,
2557,
29901,
3630,
4308,
29892,
1904,
29918,
978,
29901,
851,
1125,
13,
1678,
9995,
29903,
5989,
263,
19869,
12205,
304,
8086,
1213,
15945,
13,
1678,
934,
29918,
978,
353,
285,
29908,
29912,
7382,
1445,
29889,
657,
7382,
3972,
580,
6822,
29912,
4299,
29918,
978,
1836,
29886,
6321,
29908,
13,
1678,
12205,
29889,
517,
29918,
23945,
280,
29898,
1445,
29918,
978,
29897,
13,
13,
13,
1753,
2254,
29918,
4299,
29898,
4299,
29918,
978,
29901,
851,
1125,
13,
1678,
9995,
5896,
29879,
263,
19869,
12205,
515,
8086,
1213,
15945,
13,
1678,
934,
29918,
978,
353,
285,
29908,
29912,
7382,
1445,
29889,
657,
7382,
3972,
580,
6822,
29912,
4299,
29918,
978,
1836,
29886,
6321,
29908,
13,
1678,
736,
10518,
29889,
949,
29918,
23945,
280,
29898,
1445,
29918,
978,
29897,
13,
13,
13,
1753,
19869,
29898,
2176,
29892,
4055,
29918,
29874,
29892,
4055,
29918,
29890,
1125,
13,
1678,
9995,
6362,
837,
457,
278,
6976,
310,
19869,
29914,
21264,
362,
1213,
15945,
13,
1678,
396,
10987,
599,
4206,
988,
263,
5300,
289,
1275,
5852,
13,
1678,
263,
29918,
392,
29918,
29890,
353,
4489,
15625,
2176,
29961,
4039,
29918,
29874,
2314,
669,
313,
2176,
29961,
4039,
29918,
29890,
2314,
29962,
13,
13,
1678,
396,
10987,
599,
4206,
988,
263,
1275,
5852,
5300,
289,
2804,
5852,
13,
1678,
263,
29918,
1333,
29918,
29890,
353,
4489,
15625,
2176,
29961,
4039,
29918,
29874,
2314,
669,
3695,
29898,
2176,
29961,
4039,
29918,
29890,
2314,
29962,
13,
1678,
396,
10987,
599,
4206,
988,
289,
1275,
5852,
5300,
263,
2804,
5852,
13,
1678,
289,
29918,
1333,
29918,
29874,
353,
4489,
15625,
2176,
29961,
4039,
29918,
29890,
2314,
669,
3695,
29898,
2176,
29961,
4039,
29918,
29874,
2314,
29962,
13,
13,
1678,
396,
20535,
403,
278,
1353,
310,
6374,
322,
1950,
714,
26807,
773,
278,
8267,
5352,
13,
1678,
1950,
29918,
449,
26807,
353,
313,
13,
4706,
263,
29918,
392,
29918,
29890,
29889,
12181,
29961,
29900,
29962,
718,
263,
29918,
1333,
29918,
29890,
29889,
12181,
29961,
29900,
29962,
718,
289,
29918,
1333,
29918,
29874,
29889,
12181,
29961,
29900,
29962,
13,
1678,
1723,
29871,
396,
8267,
29961,
29900,
29962,
3639,
278,
1353,
310,
4206,
13,
1678,
6374,
29918,
449,
26807,
353,
263,
29918,
392,
29918,
29890,
29889,
12181,
29961,
29900,
29962,
13,
13,
1678,
396,
20535,
403,
278,
2186,
19869,
10825,
13,
1678,
364,
353,
6374,
29918,
449,
26807,
847,
1950,
29918,
449,
26807,
13,
13,
1678,
736,
364,
13,
13,
13,
1753,
18088,
29918,
2541,
29918,
17991,
29918,
4039,
29898,
2176,
29892,
4055,
29918,
29874,
1125,
13,
1678,
9995,
4391,
8855,
800,
1546,
1432,
4055,
1213,
15945,
13,
13,
1678,
5412,
29918,
11338,
353,
1051,
29898,
2176,
29889,
13099,
29897,
13,
1678,
396,
21493,
1549,
1432,
4055,
322,
3787,
278,
19869,
297,
263,
1051,
13,
1678,
19869,
29918,
1761,
353,
5159,
13,
1678,
363,
4055,
29918,
29890,
297,
5412,
29918,
11338,
29901,
13,
4706,
19869,
29918,
1761,
29889,
4397,
29898,
2616,
23445,
29898,
2176,
29892,
4055,
29918,
29874,
29892,
4055,
29918,
29890,
876,
13,
1678,
736,
19869,
29918,
1761,
13,
13,
13,
1753,
679,
29918,
13092,
29918,
11338,
29898,
7076,
29901,
2391,
29961,
10773,
29962,
1125,
13,
1678,
9995,
2577,
5412,
8282,
1213,
15945,
13,
1678,
5412,
29918,
11338,
353,
6571,
13,
1678,
363,
474,
297,
4452,
29901,
13,
4706,
363,
260,
297,
474,
29889,
11338,
29901,
13,
9651,
5412,
29918,
11338,
29961,
29873,
29889,
333,
29962,
353,
260,
29889,
333,
13,
1678,
736,
5412,
29918,
11338,
13,
13,
13,
1753,
1653,
29918,
2616,
23445,
29918,
1272,
2557,
29898,
1272,
2557,
1125,
13,
1678,
9995,
4391,
278,
19869,
12205,
2729,
373,
278,
7223,
12205,
1213,
15945,
13,
1678,
5412,
29918,
11338,
353,
1051,
29898,
1272,
2557,
29889,
13099,
29897,
13,
13,
1678,
19869,
29918,
5344,
29918,
8977,
353,
6571,
13,
13,
1678,
363,
4055,
29918,
29874,
297,
5412,
29918,
11338,
29901,
13,
4706,
19869,
29918,
5344,
29918,
8977,
29961,
4039,
29918,
29874,
29962,
353,
18088,
29918,
2541,
29918,
17991,
29918,
4039,
29898,
1272,
2557,
29892,
4055,
29918,
29874,
29897,
13,
13,
1678,
8855,
630,
29918,
1272,
2557,
353,
10518,
29889,
17271,
29898,
2616,
23445,
29918,
5344,
29918,
8977,
29897,
13,
1678,
8855,
630,
29918,
1272,
2557,
3366,
2248,
3108,
353,
5412,
29918,
11338,
13,
1678,
736,
8855,
630,
29918,
1272,
2557,
29889,
842,
29918,
2248,
703,
2248,
1159,
13,
13,
13,
1753,
1653,
29918,
20054,
29918,
1272,
2557,
29898,
7076,
29901,
2391,
29961,
10773,
29962,
1125,
13,
1678,
9995,
4391,
263,
7223,
12205,
411,
4055,
322,
2944,
848,
1213,
15945,
13,
1678,
5412,
29918,
11338,
353,
679,
29918,
13092,
29918,
11338,
29898,
7076,
29897,
13,
1678,
7223,
29918,
2176,
353,
10518,
29889,
17271,
29898,
13099,
29922,
13092,
29918,
11338,
29889,
5975,
3101,
13,
13,
1678,
848,
29918,
8977,
353,
2322,
8977,
29898,
1761,
29897,
13,
1678,
363,
784,
297,
7223,
29918,
2176,
29901,
13,
4706,
363,
474,
297,
4452,
29901,
13,
9651,
4055,
29918,
4841,
353,
518,
29873,
29889,
333,
363,
260,
297,
474,
29889,
11338,
29962,
13,
9651,
848,
29918,
8977,
29961,
1054,
1822,
4397,
29898,
1054,
297,
4055,
29918,
4841,
29897,
13,
13,
1678,
363,
784,
297,
7223,
29918,
2176,
29901,
13,
4706,
7223,
29918,
2176,
29961,
1054,
29962,
353,
848,
29918,
8977,
29961,
1054,
29962,
13,
13,
1678,
736,
7223,
29918,
2176,
13,
13,
13,
1753,
1284,
29918,
2616,
2674,
800,
29898,
1272,
2557,
29892,
4055,
1125,
13,
1678,
9995,
12542,
599,
8855,
800,
363,
278,
2183,
4055,
1213,
15945,
13,
1678,
396,
3789,
786,
4069,
1051,
13,
1678,
8855,
800,
353,
5159,
13,
1678,
4341,
353,
5159,
13,
13,
1678,
396,
21493,
1549,
599,
1897,
472,
278,
1948,
411,
278,
4055,
408,
967,
2380,
13,
1678,
363,
474,
29892,
27760,
297,
26985,
29898,
1272,
2557,
29889,
2029,
29961,
4039,
29892,
584,
29962,
1125,
13,
13,
4706,
396,
10987,
278,
1897,
13,
4706,
784,
353,
12205,
29889,
13099,
29961,
29875,
29962,
13,
13,
4706,
396,
22871,
278,
19869,
304,
278,
1051,
13,
4706,
8855,
800,
29889,
4397,
29898,
29725,
29897,
13,
4706,
4341,
29889,
4397,
29898,
1054,
29897,
13,
13,
1678,
396,
6204,
263,
4489,
714,
310,
278,
8857,
13,
1678,
2582,
29918,
2176,
353,
10518,
29889,
17271,
3319,
29908,
4039,
1115,
4341,
29892,
376,
2616,
23445,
1115,
8855,
800,
1800,
13,
13,
1678,
736,
2582,
29918,
2176,
13,
13,
13,
1753,
1284,
29918,
9812,
342,
29918,
2616,
2674,
800,
29898,
2616,
12817,
29918,
1272,
2557,
29892,
6907,
800,
1125,
13,
1678,
9995,
12542,
278,
8855,
800,
411,
278,
9939,
29527,
6906,
1213,
15945,
13,
1678,
396,
20025,
278,
1881,
4489,
13,
1678,
27760,
29918,
2176,
29918,
24582,
353,
8855,
630,
29918,
1272,
2557,
29889,
6605,
29918,
5975,
29898,
1609,
29922,
3366,
2616,
23445,
12436,
12066,
2548,
29922,
8824,
29897,
13,
13,
1678,
396,
7338,
1461,
278,
8018,
8855,
800,
13,
1678,
27760,
29918,
2176,
29918,
29879,
506,
287,
353,
27760,
29918,
2176,
29918,
24582,
29889,
309,
542,
29961,
29896,
584,
6907,
800,
718,
29871,
29896,
29962,
29871,
396,
694,
25621,
13,
13,
1678,
736,
27760,
29918,
2176,
29918,
29879,
506,
287,
13,
13,
13,
1753,
679,
29918,
276,
2055,
355,
800,
29898,
2585,
29918,
7924,
29901,
16441,
7717,
29892,
4055,
29918,
4841,
29901,
2391,
29961,
710,
1402,
1904,
29918,
978,
29901,
851,
29892,
6907,
800,
29901,
938,
353,
29871,
29945,
1125,
13,
1678,
9995,
2577,
6907,
800,
2729,
373,
1857,
4055,
1213,
15945,
13,
1678,
1018,
29901,
13,
4706,
19869,
29918,
1272,
2557,
353,
2254,
29918,
4299,
29898,
4299,
29918,
978,
29897,
13,
1678,
5174,
3497,
17413,
2392,
29901,
13,
4706,
1480,
29889,
27392,
29898,
29888,
29908,
3782,
1904,
934,
1476,
29889,
8125,
1170,
29901,
426,
4299,
29918,
978,
27195,
13,
4706,
736,
5159,
13,
13,
1678,
6907,
800,
29918,
1272,
2557,
353,
10518,
29889,
17271,
580,
13,
1678,
363,
4055,
29918,
333,
297,
4055,
29918,
4841,
29901,
13,
4706,
8855,
630,
29918,
1272,
2557,
353,
1284,
29918,
2616,
2674,
800,
29898,
2616,
23445,
29918,
1272,
2557,
29892,
4055,
29918,
333,
29897,
13,
4706,
6907,
800,
29918,
1272,
2557,
353,
10518,
29889,
17685,
29898,
13,
9651,
518,
13,
18884,
6907,
800,
29918,
1272,
2557,
29892,
13,
18884,
1284,
29918,
9812,
342,
29918,
2616,
2674,
800,
29898,
2616,
12817,
29918,
1272,
2557,
29892,
6907,
800,
511,
13,
9651,
21251,
13,
9651,
11455,
29918,
2248,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
1678,
396,
3588,
1250,
304,
4055,
3618,
13,
1678,
8282,
353,
5159,
13,
1678,
363,
260,
297,
6907,
800,
29918,
1272,
2557,
3366,
4039,
3108,
7503,
276,
2055,
355,
800,
5387,
13,
4706,
8282,
29889,
4397,
29898,
4039,
29918,
5509,
29889,
657,
29898,
2585,
29918,
7924,
29922,
2585,
29918,
7924,
29892,
4055,
29918,
333,
29922,
524,
29898,
29873,
4961,
13,
13,
1678,
1480,
29889,
8382,
29898,
29888,
29908,
29924,
5086,
4055,
29303,
29889,
830,
2055,
2760,
28089,
29901,
426,
3788,
29889,
7122,
4197,
29873,
29889,
978,
363,
260,
297,
8282,
2314,
29913,
8125,
1170,
29901,
426,
4299,
29918,
978,
27195,
13,
1678,
736,
8282,
13,
13,
13,
1753,
2048,
29918,
4299,
29898,
7076,
29901,
2391,
29961,
10773,
1402,
1904,
29918,
978,
29901,
851,
1125,
13,
1678,
9995,
8893,
29879,
278,
19869,
12205,
363,
4452,
1213,
15945,
13,
1678,
7223,
29918,
1272,
2557,
353,
1653,
29918,
20054,
29918,
1272,
2557,
29898,
7076,
29897,
13,
1678,
19869,
29918,
1272,
2557,
353,
1653,
29918,
2616,
23445,
29918,
1272,
2557,
29898,
20054,
29918,
1272,
2557,
29897,
13,
1678,
4078,
29918,
4299,
29898,
2616,
23445,
29918,
1272,
2557,
29892,
1904,
29918,
978,
29897,
13,
2
] |
examples/get_data_advanced.py | dark-vex/sysdig-sdk-python | 45 | 84301 | #!/usr/bin/env python
#
# This script shows an advanced Sysdig Monitor data request that leverages
# filtering and segmentation.
#
# The request returns the last 10 minutes of CPU utilization for the 5
# busiest containers inside the given host, with 1 minute data granularity
#
import json
import sys
from sdcclient import SdcClient
#
# Parse arguments
#
if len(sys.argv) != 3:
print(('usage: %s <sysdig-token> <hostname>' % sys.argv[0]))
print('You can find your token at https://app.sysdigcloud.com/#/settings/user')
sys.exit(1)
sdc_token = sys.argv[1]
hostname = sys.argv[2]
#
# Instantiate the SDC client
#
sdclient = SdcClient(sdc_token)
#
# Prepare the metrics list.
#
metrics = [
# The first metric we request is the container name. This is a segmentation
# metric, and you can tell by the fact that we don't specify any aggregation
# criteria. This entry tells Sysdig Monitor that we want to see the CPU
# utilization for each container separately.
{"id": "container.name"},
# The second metric we request is the CPU. We aggregate it as an average.
{"id": "cpu.used.percent",
"aggregations": {
"time": "avg",
"group": "avg"
}
}
]
#
# Prepare the filter
#
filter = "host.hostName = '%s'" % hostname
#
# Paging (from and to included; by default you get from=0 to=9)
# Here we'll get the top 5.
#
paging = {"from": 0, "to": 4}
#
# Fire the query.
#
ok, res = sdclient.get_data(metrics=metrics, # List of metrics to query
start_ts=-600, # Start of query span is 600 seconds ago
end_ts=0, # End the query span now
sampling_s=60, # 1 data point per minute
filter=filter, # The filter specifying the target host
paging=paging, # Paging to limit to just the 5 most busy
datasource_type='container') # The source for our metrics is the container
#
# Show the result!
#
print((json.dumps(res, sort_keys=True, indent=4)))
if not ok:
sys.exit(1)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
13,
29937,
910,
2471,
3697,
385,
12862,
317,
952,
7501,
2598,
2105,
848,
2009,
393,
26610,
1179,
13,
29937,
21166,
322,
10768,
362,
29889,
13,
29937,
13,
29937,
450,
2009,
3639,
278,
1833,
29871,
29896,
29900,
6233,
310,
10808,
3667,
2133,
363,
278,
29871,
29945,
13,
29937,
3593,
12239,
22637,
2768,
278,
2183,
3495,
29892,
411,
29871,
29896,
11015,
848,
3803,
1070,
537,
13,
29937,
13,
13,
5215,
4390,
13,
5215,
10876,
13,
13,
3166,
28972,
617,
1593,
1053,
317,
13891,
4032,
13,
13,
29937,
13,
29937,
20969,
6273,
13,
29937,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
2804,
29871,
29941,
29901,
13,
1678,
1596,
29898,
877,
21125,
29901,
1273,
29879,
529,
9675,
7501,
29899,
6979,
29958,
529,
28988,
16299,
1273,
10876,
29889,
19218,
29961,
29900,
12622,
13,
1678,
1596,
877,
3492,
508,
1284,
596,
5993,
472,
2045,
597,
932,
29889,
9675,
7501,
9274,
29889,
510,
8484,
29914,
11027,
29914,
1792,
1495,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
4928,
29883,
29918,
6979,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
28988,
353,
10876,
29889,
19218,
29961,
29906,
29962,
13,
13,
29937,
13,
29937,
2799,
3656,
403,
278,
8073,
29907,
3132,
13,
29937,
13,
4928,
4645,
353,
317,
13891,
4032,
29898,
4928,
29883,
29918,
6979,
29897,
13,
13,
29937,
13,
29937,
349,
3445,
598,
278,
21556,
1051,
29889,
13,
29937,
13,
2527,
10817,
353,
518,
13,
1678,
396,
450,
937,
12714,
591,
2009,
338,
278,
5639,
1024,
29889,
910,
338,
263,
10768,
362,
13,
1678,
396,
12714,
29892,
322,
366,
508,
2649,
491,
278,
2114,
393,
591,
1016,
29915,
29873,
6084,
738,
11404,
362,
13,
1678,
396,
16614,
29889,
910,
6251,
10603,
317,
952,
7501,
2598,
2105,
393,
591,
864,
304,
1074,
278,
10808,
13,
1678,
396,
3667,
2133,
363,
1269,
5639,
16949,
29889,
13,
1678,
8853,
333,
1115,
376,
7611,
29889,
978,
10758,
13,
1678,
396,
450,
1473,
12714,
591,
2009,
338,
278,
10808,
29889,
1334,
20431,
372,
408,
385,
6588,
29889,
13,
1678,
8853,
333,
1115,
376,
21970,
29889,
3880,
29889,
25376,
613,
13,
268,
376,
26193,
800,
1115,
426,
13,
308,
376,
2230,
1115,
376,
485,
29887,
613,
13,
308,
376,
2972,
1115,
376,
485,
29887,
29908,
13,
268,
500,
13,
268,
500,
13,
29962,
13,
13,
29937,
13,
29937,
349,
3445,
598,
278,
4175,
13,
29937,
13,
4572,
353,
376,
3069,
29889,
3069,
1170,
353,
14210,
29879,
11838,
1273,
3495,
978,
13,
13,
29937,
13,
29937,
349,
6751,
313,
3166,
322,
304,
5134,
29936,
491,
2322,
366,
679,
515,
29922,
29900,
304,
29922,
29929,
29897,
13,
29937,
2266,
591,
29915,
645,
679,
278,
2246,
29871,
29945,
29889,
13,
29937,
13,
29886,
6751,
353,
8853,
3166,
1115,
29871,
29900,
29892,
376,
517,
1115,
29871,
29946,
29913,
13,
13,
29937,
13,
29937,
6438,
278,
2346,
29889,
13,
29937,
13,
554,
29892,
620,
353,
28972,
4645,
29889,
657,
29918,
1272,
29898,
2527,
10817,
29922,
2527,
10817,
29892,
29871,
396,
2391,
310,
21556,
304,
2346,
13,
462,
9651,
1369,
29918,
1372,
10457,
29953,
29900,
29900,
29892,
29871,
396,
7370,
310,
2346,
10638,
338,
29871,
29953,
29900,
29900,
6923,
8020,
13,
462,
9651,
1095,
29918,
1372,
29922,
29900,
29892,
29871,
396,
2796,
278,
2346,
10638,
1286,
13,
462,
9651,
23460,
29918,
29879,
29922,
29953,
29900,
29892,
29871,
396,
29871,
29896,
848,
1298,
639,
11015,
13,
462,
9651,
4175,
29922,
4572,
29892,
29871,
396,
450,
4175,
22146,
278,
3646,
3495,
13,
462,
9651,
282,
6751,
29922,
29886,
6751,
29892,
29871,
396,
349,
6751,
304,
4046,
304,
925,
278,
29871,
29945,
1556,
19587,
13,
462,
9651,
6155,
1167,
29918,
1853,
2433,
7611,
1495,
29871,
396,
450,
2752,
363,
1749,
21556,
338,
278,
5639,
13,
13,
29937,
13,
29937,
7704,
278,
1121,
29991,
13,
29937,
13,
2158,
3552,
3126,
29889,
29881,
17204,
29898,
690,
29892,
2656,
29918,
8149,
29922,
5574,
29892,
29536,
29922,
29946,
4961,
13,
361,
451,
3431,
29901,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
2
] |
Python/lc_497_random_point_nonoverlapping_rectangles.py | cmattey/leetcode_problems | 6 | 151020 | # Time: init: O(N), pick: O(logN)
# Space: O(N)
class Solution:
import random
def __init__(self, rects: List[List[int]]):
self.rects = rects
rect_areas = []
for rect in rects:
rect_areas.append(self.get_area(rect))
self.sum_areas = sum(rect_areas)
self.cum_sum = [rect_areas[0]]
for i in range(1,len(rect_areas)):
self.cum_sum.append(self.cum_sum[i-1]+rect_areas[i])
def get_area(self,rect):
x1,y1,x2,y2 = rect
return abs(y2-y1+1)*abs(x2-x1+1)
def pick(self) -> List[int]:
rand_num = random.randint(0,self.sum_areas)
rect_index = -1
# for index,sum in enumerate(self.cum_sum): # Can do binary search here to reduce to O(logN)
# if sum>=rand_num:
# rect_index = index
# break
low = 0
high = len(self.cum_sum)-1
while low<=high:
mid = (low+high)//2
if self.cum_sum[mid]==rand_num:
rect_index = mid
break
elif self.cum_sum[mid]>rand_num:
high = mid-1
else:
low = mid+1
if rect_index==-1:
rect_index = low
rect = self.rects[rect_index]
min_x = min(rect[0],rect[2])
max_x = max(rect[0],rect[2])
min_y = min(rect[1],rect[3])
max_y = max(rect[1],rect[3])
return [random.randint(min_x,max_x),random.randint(min_y,max_y)]
# Your Solution object will be instantiated and called as such:
# obj = Solution(rects)
# param_1 = obj.pick()
| [
1,
396,
5974,
29901,
2069,
29901,
438,
29898,
29940,
511,
5839,
29901,
438,
29898,
1188,
29940,
29897,
13,
29937,
14121,
29901,
438,
29898,
29940,
29897,
13,
13,
1990,
24380,
29901,
13,
1678,
1053,
4036,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7705,
29879,
29901,
2391,
29961,
1293,
29961,
524,
5262,
1125,
13,
4706,
1583,
29889,
1621,
29879,
353,
7705,
29879,
13,
4706,
7705,
29918,
598,
294,
353,
5159,
13,
4706,
363,
7705,
297,
7705,
29879,
29901,
13,
9651,
7705,
29918,
598,
294,
29889,
4397,
29898,
1311,
29889,
657,
29918,
6203,
29898,
1621,
876,
13,
13,
4706,
1583,
29889,
2083,
29918,
598,
294,
353,
2533,
29898,
1621,
29918,
598,
294,
29897,
13,
13,
4706,
1583,
29889,
29883,
398,
29918,
2083,
353,
518,
1621,
29918,
598,
294,
29961,
29900,
5262,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
2435,
29898,
1621,
29918,
598,
294,
22164,
13,
9651,
1583,
29889,
29883,
398,
29918,
2083,
29889,
4397,
29898,
1311,
29889,
29883,
398,
29918,
2083,
29961,
29875,
29899,
29896,
10062,
1621,
29918,
598,
294,
29961,
29875,
2314,
13,
13,
1678,
822,
679,
29918,
6203,
29898,
1311,
29892,
1621,
1125,
13,
4706,
921,
29896,
29892,
29891,
29896,
29892,
29916,
29906,
29892,
29891,
29906,
353,
7705,
13,
4706,
736,
6425,
29898,
29891,
29906,
29899,
29891,
29896,
29974,
29896,
11877,
6897,
29898,
29916,
29906,
29899,
29916,
29896,
29974,
29896,
29897,
13,
13,
13,
1678,
822,
5839,
29898,
1311,
29897,
1599,
2391,
29961,
524,
5387,
13,
4706,
20088,
29918,
1949,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
1311,
29889,
2083,
29918,
598,
294,
29897,
13,
13,
4706,
7705,
29918,
2248,
353,
448,
29896,
13,
4706,
396,
363,
2380,
29892,
2083,
297,
26985,
29898,
1311,
29889,
29883,
398,
29918,
2083,
1125,
396,
1815,
437,
7581,
2740,
1244,
304,
10032,
304,
438,
29898,
1188,
29940,
29897,
13,
4706,
396,
268,
565,
2533,
18572,
9502,
29918,
1949,
29901,
13,
4706,
396,
308,
7705,
29918,
2248,
353,
2380,
13,
4706,
396,
308,
2867,
13,
13,
4706,
4482,
353,
29871,
29900,
13,
4706,
1880,
353,
7431,
29898,
1311,
29889,
29883,
398,
29918,
2083,
6817,
29896,
13,
13,
4706,
1550,
4482,
14065,
9812,
29901,
13,
9651,
7145,
353,
313,
677,
29974,
9812,
29897,
458,
29906,
13,
9651,
565,
1583,
29889,
29883,
398,
29918,
2083,
29961,
6563,
29962,
1360,
9502,
29918,
1949,
29901,
13,
18884,
7705,
29918,
2248,
353,
7145,
13,
18884,
2867,
13,
9651,
25342,
1583,
29889,
29883,
398,
29918,
2083,
29961,
6563,
29962,
29958,
9502,
29918,
1949,
29901,
13,
18884,
1880,
353,
7145,
29899,
29896,
13,
9651,
1683,
29901,
13,
18884,
4482,
353,
7145,
29974,
29896,
13,
13,
4706,
565,
7705,
29918,
2248,
1360,
29899,
29896,
29901,
13,
9651,
7705,
29918,
2248,
353,
4482,
13,
13,
4706,
7705,
353,
1583,
29889,
1621,
29879,
29961,
1621,
29918,
2248,
29962,
13,
4706,
1375,
29918,
29916,
353,
1375,
29898,
1621,
29961,
29900,
1402,
1621,
29961,
29906,
2314,
13,
4706,
4236,
29918,
29916,
353,
4236,
29898,
1621,
29961,
29900,
1402,
1621,
29961,
29906,
2314,
13,
4706,
1375,
29918,
29891,
353,
1375,
29898,
1621,
29961,
29896,
1402,
1621,
29961,
29941,
2314,
13,
4706,
4236,
29918,
29891,
353,
4236,
29898,
1621,
29961,
29896,
1402,
1621,
29961,
29941,
2314,
13,
4706,
736,
518,
8172,
29889,
9502,
524,
29898,
1195,
29918,
29916,
29892,
3317,
29918,
29916,
511,
8172,
29889,
9502,
524,
29898,
1195,
29918,
29891,
29892,
3317,
29918,
29891,
4638,
13,
13,
13,
13,
29937,
3575,
24380,
1203,
674,
367,
13213,
630,
322,
2000,
408,
1316,
29901,
13,
29937,
5446,
353,
24380,
29898,
1621,
29879,
29897,
13,
29937,
1828,
29918,
29896,
353,
5446,
29889,
23945,
580,
13,
2
] |
log/slack_sender.py | SmashKs/BarBarian | 0 | 2888 | <gh_stars>0
from slackclient import SlackClient
from external import SLACK_API_KEY
class SlackBot:
API_CHAT_MSG = 'chat.postMessage'
BOT_NAME = 'News Bot'
DEFAULT_CHANNEL = 'news_notification'
def __new__(cls, *p, **k):
if '_the_instance' not in cls.__dict__:
cls._the_instance = object.__new__(cls)
return cls._the_instance
def __init__(self):
self.__slack_client = SlackClient(SLACK_API_KEY)
def send_msg_to(self, text='', channel=DEFAULT_CHANNEL):
self.__slack_client.api_call(SlackBot.API_CHAT_MSG,
username=SlackBot.BOT_NAME,
channel=channel,
text=text)
def send_formatted_msg_to(self, text='', channel=DEFAULT_CHANNEL):
self.__slack_client.api_call(SlackBot.API_CHAT_MSG,
username=SlackBot.BOT_NAME,
mrkdwn=True,
channel=channel,
text=text)
if __name__ == '__main__':
SlackBot().send_msg_to('hello world!!')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
269,
2364,
4645,
1053,
317,
2364,
4032,
13,
13,
3166,
7029,
1053,
27146,
11375,
29918,
8787,
29918,
10818,
13,
13,
13,
1990,
317,
2364,
29933,
327,
29901,
13,
1678,
3450,
29918,
3210,
1299,
29918,
4345,
29954,
353,
525,
13496,
29889,
2490,
3728,
29915,
13,
1678,
350,
2891,
29918,
5813,
353,
525,
29328,
11273,
29915,
13,
1678,
22236,
29918,
3210,
2190,
29940,
6670,
353,
525,
15753,
29918,
24671,
29915,
13,
13,
1678,
822,
4770,
1482,
12035,
25932,
29892,
334,
29886,
29892,
3579,
29895,
1125,
13,
4706,
565,
22868,
1552,
29918,
8758,
29915,
451,
297,
1067,
29879,
17255,
8977,
1649,
29901,
13,
9651,
1067,
29879,
3032,
1552,
29918,
8758,
353,
1203,
17255,
1482,
12035,
25932,
29897,
13,
4706,
736,
1067,
29879,
3032,
1552,
29918,
8758,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
17255,
29879,
2364,
29918,
4645,
353,
317,
2364,
4032,
29898,
12750,
11375,
29918,
8787,
29918,
10818,
29897,
13,
13,
1678,
822,
3638,
29918,
7645,
29918,
517,
29898,
1311,
29892,
1426,
2433,
742,
8242,
29922,
23397,
29918,
3210,
2190,
29940,
6670,
1125,
13,
4706,
1583,
17255,
29879,
2364,
29918,
4645,
29889,
2754,
29918,
4804,
29898,
29903,
2364,
29933,
327,
29889,
8787,
29918,
3210,
1299,
29918,
4345,
29954,
29892,
13,
462,
462,
268,
8952,
29922,
29903,
2364,
29933,
327,
29889,
29933,
2891,
29918,
5813,
29892,
13,
462,
462,
268,
8242,
29922,
12719,
29892,
13,
462,
462,
268,
1426,
29922,
726,
29897,
13,
13,
1678,
822,
3638,
29918,
689,
19667,
29918,
7645,
29918,
517,
29898,
1311,
29892,
1426,
2433,
742,
8242,
29922,
23397,
29918,
3210,
2190,
29940,
6670,
1125,
13,
4706,
1583,
17255,
29879,
2364,
29918,
4645,
29889,
2754,
29918,
4804,
29898,
29903,
2364,
29933,
327,
29889,
8787,
29918,
3210,
1299,
29918,
4345,
29954,
29892,
13,
462,
462,
268,
8952,
29922,
29903,
2364,
29933,
327,
29889,
29933,
2891,
29918,
5813,
29892,
13,
462,
462,
268,
286,
29878,
29895,
29881,
1233,
29922,
5574,
29892,
13,
462,
462,
268,
8242,
29922,
12719,
29892,
13,
462,
462,
268,
1426,
29922,
726,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
317,
2364,
29933,
327,
2141,
6717,
29918,
7645,
29918,
517,
877,
12199,
3186,
6824,
1495,
13,
2
] |
scripts/mlp/wholebody/croccodyl.py | JasonChmn/multicontact-locomotion-planning | 0 | 133067 | <filename>scripts/mlp/wholebody/croccodyl.py
import mlp.config as cfg
def generateWholeBodyMotion(cs,fullBody=None,viewer=None):
raise NotImplemented("TODO") | [
1,
529,
9507,
29958,
16713,
29914,
828,
29886,
29914,
15970,
280,
2587,
29914,
24077,
617,
1486,
29880,
29889,
2272,
13,
5215,
286,
22833,
29889,
2917,
408,
274,
16434,
13,
13,
1753,
5706,
22110,
280,
8434,
29924,
8194,
29898,
2395,
29892,
8159,
8434,
29922,
8516,
29892,
29894,
15580,
29922,
8516,
1125,
13,
1678,
12020,
2216,
1888,
2037,
287,
703,
4986,
3970,
1159,
2
] |
impy/tests/test_new_interface.py | kotania/impy | 6 | 70127 | <filename>impy/tests/test_new_interface.py
import sys
import os
import numpy as np
root_dir = os.path.abspath(os.path.dirname(__file__) + "/..")
sys.path.append(root_dir)
sys.path.append(os.path.join(root_dir,'../DPMJET-III-gitlab'))
from impy.definitions import *
from impy.constants import *
from impy.kinematics import EventKinematics
from impy.common import impy_config, pdata
# AF: This is what the user interaction has to yield.
# It is the typical expected configuration that one
# wants to run (read pp-mode at energies not exceeding
# 7 TeV). If you want cosmic ray energies, this should
# be rather p-N at 10 EeV and lab frame (not yet defined).
event_kinematics = EventKinematics(
ecm=7 * TeV,
p1pdg=-211,
# nuc1_prop=(12,6),
nuc2_prop=(12, 6))
impy_config["user_frame"] = 'laboratory'
generator = make_generator_instance(interaction_model_by_tag['DPMJETIII171'])
generator.init_generator(event_kinematics)
# import IPython
# IPython.embed()
# This
for event in generator.event_generator(event_kinematics, 10):
event.filter_final_state()
# print 'px', event.px
# print 'py', event.py
# print 'pz', event.pz
# print 'en', event.en
print('p_ids', event.p_id)
print('impact param', event.impact_parameter)
# import IPython
# IPython.embed()
# print event.impact_parameter, event.n_wounded_A, event.n_wounded_B#, event.n_NN_interactions
| [
1,
529,
9507,
29958,
326,
2272,
29914,
21150,
29914,
1688,
29918,
1482,
29918,
13248,
29889,
2272,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
13,
4632,
29918,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
29897,
718,
5591,
636,
1159,
13,
9675,
29889,
2084,
29889,
4397,
29898,
4632,
29918,
3972,
29897,
13,
9675,
29889,
2084,
29889,
4397,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4632,
29918,
3972,
5501,
6995,
11191,
29924,
29967,
2544,
29899,
5287,
29899,
5559,
8205,
8785,
13,
13,
13,
3166,
527,
2272,
29889,
25476,
2187,
1053,
334,
13,
3166,
527,
2272,
29889,
3075,
1934,
1053,
334,
13,
3166,
527,
2272,
29889,
9089,
4579,
1199,
1053,
6864,
29968,
262,
4579,
1199,
13,
3166,
527,
2272,
29889,
9435,
1053,
527,
2272,
29918,
2917,
29892,
282,
1272,
13,
13,
29937,
23844,
29901,
910,
338,
825,
278,
1404,
14881,
756,
304,
7709,
29889,
13,
29937,
739,
338,
278,
15662,
3806,
5285,
393,
697,
13,
29937,
10753,
304,
1065,
313,
949,
6499,
29899,
8513,
472,
18190,
583,
451,
13461,
292,
13,
29937,
29871,
29955,
1920,
29963,
467,
960,
366,
864,
6776,
13076,
15570,
18190,
583,
29892,
445,
881,
13,
29937,
367,
3265,
282,
29899,
29940,
472,
29871,
29896,
29900,
382,
29872,
29963,
322,
9775,
3515,
313,
1333,
3447,
3342,
467,
13,
13,
3696,
29918,
9089,
4579,
1199,
353,
6864,
29968,
262,
4579,
1199,
29898,
13,
1678,
321,
4912,
29922,
29955,
334,
1920,
29963,
29892,
13,
1678,
282,
29896,
15926,
29887,
10457,
29906,
29896,
29896,
29892,
13,
1678,
396,
11205,
29896,
29918,
7728,
7607,
29896,
29906,
29892,
29953,
511,
13,
1678,
11205,
29906,
29918,
7728,
7607,
29896,
29906,
29892,
29871,
29953,
876,
13,
13,
326,
2272,
29918,
2917,
3366,
1792,
29918,
2557,
3108,
353,
525,
29880,
3717,
7606,
29915,
13,
13,
27959,
353,
1207,
29918,
27959,
29918,
8758,
29898,
1639,
2467,
29918,
4299,
29918,
1609,
29918,
4039,
1839,
11191,
29924,
29967,
2544,
5287,
29896,
29955,
29896,
11287,
13,
27959,
29889,
2344,
29918,
27959,
29898,
3696,
29918,
9089,
4579,
1199,
29897,
13,
29937,
1053,
5641,
1656,
13,
29937,
5641,
1656,
29889,
17987,
580,
13,
13,
29937,
910,
13,
1454,
1741,
297,
15299,
29889,
3696,
29918,
27959,
29898,
3696,
29918,
9089,
4579,
1199,
29892,
29871,
29896,
29900,
1125,
13,
1678,
1741,
29889,
4572,
29918,
8394,
29918,
3859,
580,
13,
1678,
396,
1596,
525,
1756,
742,
1741,
29889,
1756,
13,
1678,
396,
1596,
525,
2272,
742,
1741,
29889,
2272,
13,
1678,
396,
1596,
525,
29886,
29920,
742,
1741,
29889,
29886,
29920,
13,
1678,
396,
1596,
525,
264,
742,
1741,
29889,
264,
13,
1678,
1596,
877,
29886,
29918,
4841,
742,
1741,
29889,
29886,
29918,
333,
29897,
13,
1678,
1596,
877,
6574,
627,
1828,
742,
1741,
29889,
6574,
627,
29918,
15501,
29897,
13,
1678,
396,
1053,
5641,
1656,
13,
1678,
396,
5641,
1656,
29889,
17987,
580,
13,
1678,
396,
1596,
1741,
29889,
6574,
627,
29918,
15501,
29892,
1741,
29889,
29876,
29918,
29893,
7261,
29918,
29909,
29892,
1741,
29889,
29876,
29918,
29893,
7261,
29918,
29933,
6552,
1741,
29889,
29876,
29918,
10262,
29918,
1639,
7387,
13,
2
] |
src/modules/print.py | wuttinanhi/dumb-lang | 0 | 95812 | from typing import Dict
from src.token import Token
from src.modules.content import ContentParser
from src.variable_storage import VariableStorage
class PrintModule:
@staticmethod
def execute(token: Token, variable_storage: VariableStorage):
# seperate text by space
content = token.line.script.split(" ", 1)
# parse content and print
parsed = ContentParser.parse(content[1], variable_storage)
# output to screen
print(parsed)
| [
1,
515,
19229,
1053,
360,
919,
13,
3166,
4765,
29889,
6979,
1053,
25159,
13,
3166,
4765,
29889,
7576,
29889,
3051,
1053,
10576,
11726,
13,
3166,
4765,
29889,
11918,
29918,
12925,
1053,
28736,
10486,
13,
13,
1990,
13905,
7355,
29901,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6222,
29898,
6979,
29901,
25159,
29892,
2286,
29918,
12925,
29901,
28736,
10486,
1125,
13,
4706,
396,
409,
21194,
1426,
491,
2913,
13,
4706,
2793,
353,
5993,
29889,
1220,
29889,
2154,
29889,
5451,
703,
9162,
29871,
29896,
29897,
13,
13,
4706,
396,
6088,
2793,
322,
1596,
13,
4706,
21213,
353,
10576,
11726,
29889,
5510,
29898,
3051,
29961,
29896,
1402,
2286,
29918,
12925,
29897,
13,
13,
4706,
396,
1962,
304,
4315,
13,
4706,
1596,
29898,
862,
8485,
29897,
13,
2
] |
10.py | tlgs/aoc-2021 | 1 | 157874 | """Day 10: Syntax Scoring"""
import sys
def syntax_error_score(lines):
pairs = {")": "(", "]": "[", "}": "{", ">": "<"}
points = {"(": 3, "[": 57, "{": 1197, "<": 25137}
total = 0
for line in lines:
stack = []
for c in line:
if c in points:
stack.append(c)
elif pairs[c] == stack[-1]:
stack.pop()
else:
total += points[pairs[c]]
break
return total
def middle_autocomplete_score(lines):
pairs = {")": "(", "]": "[", "}": "{", ">": "<"}
points = {"(": 1, "[": 2, "{": 3, "<": 4}
scores = []
for line in lines:
stack = []
for c in line:
if c in points:
stack.append(c)
elif pairs[c] == stack[-1]:
stack.pop()
else:
break
else:
total = 0
while stack:
total = total * 5 + points[stack.pop()]
scores.append(total)
scores.sort()
return scores[len(scores) // 2]
class Test:
example = [
"[({(<(())[]>[[{[]{<()<>>",
"[(()[<>])]({[<{<<[]>>(",
"{([(<{}[<>[]}>{[]{[(<()>",
"(((({<>}<{<{<>}{[]{[]{}",
"[[<[([]))<([[{}[[()]]]",
"[{[{({}]{}}([{[{{{}}([]",
"{<[[]]>}<{[{[{[]{()[[[]",
"[<(<(<(<{}))><([]([]()",
"<{([([[(<>()){}]>(<<{{",
"<{([{{}}[<[[[<>{}]]]>[]]",
]
def test_one(self):
assert syntax_error_score(self.example) == 26397
def test_two(self):
assert middle_autocomplete_score(self.example) == 288957
def main():
puzzle = [line.rstrip() for line in sys.stdin]
print("part 1:", syntax_error_score(puzzle))
print("part 2:", middle_autocomplete_score(puzzle))
if __name__ == "__main__":
main()
| [
1,
9995,
12742,
29871,
29896,
29900,
29901,
21306,
2522,
8253,
15945,
29908,
13,
5215,
10876,
13,
13,
13,
1753,
5877,
29918,
2704,
29918,
13628,
29898,
9012,
1125,
13,
1678,
11000,
353,
426,
1159,
1115,
18227,
613,
376,
29962,
1115,
14704,
613,
376,
29913,
1115,
29850,
613,
376,
29958,
1115,
9872,
9092,
13,
1678,
3291,
353,
8853,
703,
29901,
29871,
29941,
29892,
14704,
1115,
29871,
29945,
29955,
29892,
29850,
1115,
29871,
29896,
29896,
29929,
29955,
29892,
9872,
1115,
29871,
29906,
29945,
29896,
29941,
29955,
29913,
13,
1678,
3001,
353,
29871,
29900,
13,
1678,
363,
1196,
297,
3454,
29901,
13,
4706,
5096,
353,
5159,
13,
4706,
363,
274,
297,
1196,
29901,
13,
9651,
565,
274,
297,
3291,
29901,
13,
18884,
5096,
29889,
4397,
29898,
29883,
29897,
13,
9651,
25342,
11000,
29961,
29883,
29962,
1275,
5096,
14352,
29896,
5387,
13,
18884,
5096,
29889,
7323,
580,
13,
9651,
1683,
29901,
13,
18884,
3001,
4619,
3291,
29961,
29886,
7121,
29961,
29883,
5262,
13,
18884,
2867,
13,
13,
1678,
736,
3001,
13,
13,
13,
1753,
7256,
29918,
6921,
8835,
29918,
13628,
29898,
9012,
1125,
13,
1678,
11000,
353,
426,
1159,
1115,
18227,
613,
376,
29962,
1115,
14704,
613,
376,
29913,
1115,
29850,
613,
376,
29958,
1115,
9872,
9092,
13,
1678,
3291,
353,
8853,
703,
29901,
29871,
29896,
29892,
14704,
1115,
29871,
29906,
29892,
29850,
1115,
29871,
29941,
29892,
9872,
1115,
29871,
29946,
29913,
13,
1678,
19435,
353,
5159,
13,
1678,
363,
1196,
297,
3454,
29901,
13,
4706,
5096,
353,
5159,
13,
4706,
363,
274,
297,
1196,
29901,
13,
9651,
565,
274,
297,
3291,
29901,
13,
18884,
5096,
29889,
4397,
29898,
29883,
29897,
13,
9651,
25342,
11000,
29961,
29883,
29962,
1275,
5096,
14352,
29896,
5387,
13,
18884,
5096,
29889,
7323,
580,
13,
9651,
1683,
29901,
13,
18884,
2867,
13,
13,
4706,
1683,
29901,
13,
9651,
3001,
353,
29871,
29900,
13,
9651,
1550,
5096,
29901,
13,
18884,
3001,
353,
3001,
334,
29871,
29945,
718,
3291,
29961,
1429,
29889,
7323,
580,
29962,
13,
9651,
19435,
29889,
4397,
29898,
7827,
29897,
13,
13,
1678,
19435,
29889,
6605,
580,
13,
1678,
736,
19435,
29961,
2435,
29898,
1557,
2361,
29897,
849,
29871,
29906,
29962,
13,
13,
13,
1990,
4321,
29901,
13,
1678,
1342,
353,
518,
13,
4706,
14704,
3319,
29898,
29966,
29898,
3101,
2636,
29958,
8999,
29912,
24406,
29966,
580,
29966,
6778,
613,
13,
4706,
14704,
14885,
29961,
25299,
2314,
850,
13970,
29966,
29912,
9314,
2636,
29958,
5961,
613,
13,
4706,
29850,
4197,
29898,
29966,
29912,
4400,
25299,
2636,
17428,
29912,
2636,
13970,
29898,
29966,
580,
28341,
13,
4706,
376,
3552,
29898,
3319,
25299,
29913,
29966,
29912,
29966,
29912,
25299,
1157,
24406,
2636,
8875,
613,
13,
4706,
376,
8999,
29966,
15625,
2636,
876,
29966,
4197,
19660,
4400,
29961,
580,
5262,
29962,
613,
13,
4706,
14704,
13970,
29912,
3319,
29913,
3199,
930,
4197,
13970,
6224,
29912,
12156,
2636,
613,
13,
4706,
29850,
29966,
29961,
2636,
29962,
29958,
29913,
29966,
13970,
13970,
29912,
24406,
580,
8999,
2636,
613,
13,
4706,
14704,
29966,
29898,
29966,
29898,
29966,
29898,
29966,
8875,
876,
5299,
4197,
850,
2636,
580,
613,
13,
4706,
9872,
29912,
4197,
4197,
15625,
29966,
16917,
2597,
6525,
5961,
9314,
6224,
613,
13,
4706,
9872,
29912,
4197,
6224,
930,
29961,
29966,
8999,
29961,
25299,
8875,
5262,
29962,
29958,
2636,
29962,
613,
13,
1678,
4514,
13,
13,
1678,
822,
1243,
29918,
650,
29898,
1311,
1125,
13,
4706,
4974,
5877,
29918,
2704,
29918,
13628,
29898,
1311,
29889,
4773,
29897,
1275,
29871,
29906,
29953,
29941,
29929,
29955,
13,
13,
1678,
822,
1243,
29918,
10184,
29898,
1311,
1125,
13,
4706,
4974,
7256,
29918,
6921,
8835,
29918,
13628,
29898,
1311,
29889,
4773,
29897,
1275,
29871,
29906,
29947,
29947,
29929,
29945,
29955,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
20285,
280,
353,
518,
1220,
29889,
29878,
17010,
580,
363,
1196,
297,
10876,
29889,
4172,
262,
29962,
13,
13,
1678,
1596,
703,
1595,
29871,
29896,
29901,
613,
5877,
29918,
2704,
29918,
13628,
29898,
29886,
18813,
280,
876,
13,
1678,
1596,
703,
1595,
29871,
29906,
29901,
613,
7256,
29918,
6921,
8835,
29918,
13628,
29898,
29886,
18813,
280,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
donkeycar/parts/angle_adjust.py | hironorinaka99/donkeycar | 0 | 31211 | class angle_adjustclass(): #ステアリングの切れ角を調整する
def __init__(self):
self.angle_adjust = 1.0
return
def angleincrease(self):
self.angle_adjust = round(min(2.0, self.angle_adjust + 0.05), 2)
print("In angle_adjust increase",self.angle_adjust)
def angledecrease(self):
self.angle_adjust = round(max(0.5, self.angle_adjust - 0.05), 2)
print("In angle_adjust increase",self.angle_adjust)
def run(self):
return self.angle_adjust | [
1,
770,
10696,
29918,
328,
5143,
1990,
7295,
396,
30255,
30572,
30310,
30303,
30203,
30521,
30199,
31757,
30553,
31432,
30396,
235,
173,
194,
233,
152,
183,
30427,
30332,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
2521,
29918,
328,
5143,
353,
29871,
29896,
29889,
29900,
13,
4706,
736,
13,
13,
1678,
822,
10696,
262,
1037,
559,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2521,
29918,
328,
5143,
353,
4513,
29898,
1195,
29898,
29906,
29889,
29900,
29892,
1583,
29889,
2521,
29918,
328,
5143,
718,
29871,
29900,
29889,
29900,
29945,
511,
29871,
29906,
29897,
13,
4706,
1596,
703,
797,
10696,
29918,
328,
5143,
7910,
613,
1311,
29889,
2521,
29918,
328,
5143,
29897,
13,
13,
1678,
822,
10696,
311,
1037,
559,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2521,
29918,
328,
5143,
353,
4513,
29898,
3317,
29898,
29900,
29889,
29945,
29892,
1583,
29889,
2521,
29918,
328,
5143,
448,
29871,
29900,
29889,
29900,
29945,
511,
29871,
29906,
29897,
13,
4706,
1596,
703,
797,
10696,
29918,
328,
5143,
7910,
613,
1311,
29889,
2521,
29918,
328,
5143,
29897,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
2521,
29918,
328,
5143,
2
] |
armada_flexbe_states/src/armada_flexbe_states/concatenate_pointcloud_service_state.py | uml-robotics/armada_behaviors | 0 | 136889 | #!/usr/bin/env python
import rospy
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyServiceCaller
from sensor_msgs.msg import PointCloud2
from armada_flexbe_utilities.srv import ConcatenatePointCloud, ConcatenatePointCloudResponse, ConcatenatePointCloudRequest
class concatenatePointCloudState(EventState):
'''
Example for a state to demonstrate which functionality is available for state implementation.
This example lets the behavior wait until the given target_time has passed since the behavior has been started.
># pointcloud_list List of PointCloud2 messages
#> combined_pointcloud Concatenated PointCloud2 message
<= continue Concatenated pointclouds successfully
<= failed Something went wrong
'''
def __init__(self):
# Declare outcomes, input_keys, and output_keys by calling the super constructor with the corresponding arguments.
super(concatenatePointCloudState, self).__init__(outcomes = ['continue', 'failed'],
input_keys = ['pointcloud_list'],
output_keys = ['combined_pointcloud'])
def execute(self, userdata):
# This method is called periodically while the state is active.
# Main purpose is to check state conditions and trigger a corresponding outcome.
# If no outcome is returned, the state will stay active.
self._service_topic = '/concatenate_pointcloud'
rospy.wait_for_service(self._service_topic)
self._service = ProxyServiceCaller({self._service_topic: ConcatenatePointCloud})
try:
service_response = self._service.call(self._service_topic, userdata.pointcloud_list)
userdata.combined_pointcloud = service_response.cloud_out
return 'continue'
except:
return 'failed'
def on_enter(self, userdata):
# This method is called when the state becomes active, i.e. a transition from another state to this one is taken.
# It is primarily used to start actions which are associated with this state.
Logger.loginfo('attempting to concatenate pointcloud...' )
def on_exit(self, userdata):
# This method is called when an outcome is returned and another state gets active.
# It can be used to stop possibly running processes started by on_enter.
pass # Nothing to do in this state.
def on_start(self):
# This method is called when the behavior is started.
# If possible, it is generally better to initialize used resources in the constructor
# because if anything failed, the behavior would not even be started.
pass # Nothing to do in this state.
def on_stop(self):
# This method is called whenever the behavior stops execution, also if it is cancelled.
# Use this event to clean up things like claimed resources.
pass # Nothing to do in this state.
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
696,
1028,
29891,
13,
13,
3166,
8525,
915,
29918,
3221,
1053,
6864,
2792,
29892,
28468,
13,
3166,
8525,
915,
29918,
3221,
29889,
14701,
1053,
1019,
3594,
3170,
5594,
261,
13,
3166,
23530,
29918,
1516,
3174,
29889,
7645,
1053,
8984,
20442,
29906,
13,
13,
3166,
5075,
1114,
29918,
16041,
915,
29918,
4422,
1907,
29889,
29879,
15291,
1053,
23924,
2579,
403,
5228,
20442,
29892,
23924,
2579,
403,
5228,
20442,
5103,
29892,
23924,
2579,
403,
5228,
20442,
3089,
13,
13,
13,
1990,
16125,
403,
5228,
20442,
2792,
29898,
2624,
2792,
1125,
13,
4706,
14550,
13,
4706,
8741,
363,
263,
2106,
304,
22222,
607,
9863,
338,
3625,
363,
2106,
5314,
29889,
13,
4706,
910,
1342,
16869,
278,
6030,
4480,
2745,
278,
2183,
3646,
29918,
2230,
756,
4502,
1951,
278,
6030,
756,
1063,
4687,
29889,
13,
13,
4706,
1405,
29937,
1298,
9274,
29918,
1761,
462,
795,
2391,
310,
8984,
20442,
29906,
7191,
13,
4706,
20454,
12420,
29918,
3149,
9274,
462,
3986,
23924,
2579,
630,
8984,
20442,
29906,
2643,
13,
13,
4706,
5277,
6773,
462,
462,
268,
23924,
2579,
630,
1298,
9274,
29879,
8472,
13,
4706,
5277,
5229,
462,
462,
539,
12538,
3512,
2743,
13,
13,
4706,
14550,
13,
13,
4706,
822,
4770,
2344,
12035,
1311,
1125,
13,
18884,
396,
3826,
8663,
714,
26807,
29892,
1881,
29918,
8149,
29892,
322,
1962,
29918,
8149,
491,
5432,
278,
2428,
5823,
411,
278,
6590,
6273,
29889,
13,
18884,
2428,
29898,
535,
29883,
2579,
403,
5228,
20442,
2792,
29892,
1583,
467,
1649,
2344,
12035,
449,
26807,
353,
6024,
19878,
742,
525,
26061,
7464,
13,
462,
462,
462,
539,
1881,
29918,
8149,
353,
6024,
3149,
9274,
29918,
1761,
7464,
13,
462,
462,
462,
539,
1962,
29918,
8149,
353,
6024,
17743,
1312,
29918,
3149,
9274,
11287,
13,
13,
4706,
822,
6222,
29898,
1311,
29892,
1404,
1272,
1125,
13,
18884,
396,
910,
1158,
338,
2000,
3785,
1711,
1550,
278,
2106,
338,
6136,
29889,
13,
18884,
396,
4241,
6437,
338,
304,
1423,
2106,
5855,
322,
7135,
263,
6590,
21957,
29889,
13,
18884,
396,
960,
694,
21957,
338,
4133,
29892,
278,
2106,
674,
7952,
6136,
29889,
13,
13,
18884,
1583,
3032,
5509,
29918,
13010,
353,
8207,
535,
29883,
2579,
403,
29918,
3149,
9274,
29915,
13,
18884,
696,
1028,
29891,
29889,
10685,
29918,
1454,
29918,
5509,
29898,
1311,
3032,
5509,
29918,
13010,
29897,
13,
18884,
1583,
3032,
5509,
353,
1019,
3594,
3170,
5594,
261,
3319,
1311,
3032,
5509,
29918,
13010,
29901,
23924,
2579,
403,
5228,
20442,
1800,
13,
13,
18884,
1018,
29901,
13,
462,
29871,
2669,
29918,
5327,
353,
1583,
3032,
5509,
29889,
4804,
29898,
1311,
3032,
5509,
29918,
13010,
29892,
1404,
1272,
29889,
3149,
9274,
29918,
1761,
29897,
13,
462,
29871,
1404,
1272,
29889,
17743,
1312,
29918,
3149,
9274,
353,
2669,
29918,
5327,
29889,
9274,
29918,
449,
13,
462,
29871,
736,
525,
19878,
29915,
13,
18884,
5174,
29901,
13,
462,
29871,
736,
525,
26061,
29915,
13,
13,
4706,
822,
373,
29918,
5893,
29898,
1311,
29892,
1404,
1272,
1125,
13,
18884,
396,
910,
1158,
338,
2000,
746,
278,
2106,
7415,
6136,
29892,
474,
29889,
29872,
29889,
263,
9558,
515,
1790,
2106,
304,
445,
697,
338,
4586,
29889,
13,
18884,
396,
739,
338,
19434,
1304,
304,
1369,
8820,
607,
526,
6942,
411,
445,
2106,
29889,
13,
13,
18884,
28468,
29889,
1188,
3888,
877,
1131,
3456,
292,
304,
16125,
403,
1298,
9274,
856,
29915,
1723,
13,
13,
4706,
822,
373,
29918,
13322,
29898,
1311,
29892,
1404,
1272,
1125,
13,
18884,
396,
910,
1158,
338,
2000,
746,
385,
21957,
338,
4133,
322,
1790,
2106,
4947,
6136,
29889,
13,
18884,
396,
739,
508,
367,
1304,
304,
5040,
10075,
2734,
10174,
4687,
491,
373,
29918,
5893,
29889,
13,
13,
18884,
1209,
396,
9531,
304,
437,
297,
445,
2106,
29889,
13,
13,
4706,
822,
373,
29918,
2962,
29898,
1311,
1125,
13,
18884,
396,
910,
1158,
338,
2000,
746,
278,
6030,
338,
4687,
29889,
13,
18884,
396,
960,
1950,
29892,
372,
338,
6892,
2253,
304,
11905,
1304,
7788,
297,
278,
5823,
13,
18884,
396,
1363,
565,
3099,
5229,
29892,
278,
6030,
723,
451,
1584,
367,
4687,
29889,
13,
13,
18884,
1209,
396,
9531,
304,
437,
297,
445,
2106,
29889,
13,
13,
4706,
822,
373,
29918,
9847,
29898,
1311,
1125,
13,
18884,
396,
910,
1158,
338,
2000,
10940,
278,
6030,
17726,
8225,
29892,
884,
565,
372,
338,
12611,
839,
29889,
13,
18884,
396,
4803,
445,
1741,
304,
5941,
701,
2712,
763,
17049,
7788,
29889,
13,
13,
18884,
1209,
396,
9531,
304,
437,
297,
445,
2106,
29889,
13,
13,
2
] |
scify/__init__.py | DanielBok/scify | 6 | 54133 | <filename>scify/__init__.py
# -*- coding: utf-8 -*-
"""Top-level package for scify."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| [
1,
529,
9507,
29958,
1557,
1598,
29914,
1649,
2344,
26914,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
15945,
29908,
7031,
29899,
5563,
3577,
363,
885,
1598,
1213,
15945,
13,
13,
1649,
8921,
1649,
353,
9995,
29966,
5813,
11903,
15945,
13,
1649,
5269,
1649,
353,
12801,
26862,
6227,
16299,
13,
1649,
3259,
1649,
353,
525,
29900,
29889,
29896,
29889,
29900,
29915,
13,
2
] |
igem2017/sdin/views/main_views.py | StrickerLee/SYSU-Software-2017 | 40 | 113910 | <reponame>StrickerLee/SYSU-Software-2017
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from sdin.forms import *
from sdin.models import *
from django.contrib import messages
from django.db import IntegrityError
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse, HttpResponse
import traceback
import json
Err = "Something wrong!"
Inv = "Invalid form!"
def index(request):
return render(request, 'index.html')
def login_view(request):
if request.method == "POST":
# Login action
form = LoginForm(request.POST)
if form.is_valid():
email = form.cleaned_data['email']
password = <PASSWORD>.cleaned_data['password']
user = authenticate(username = email, password = password)
if user is not None:
login(request, user)
messages.success(request, "Login successfully!")
next_url = request.POST.get('next')
if next_url:
return redirect(next_url)
else:
return redirect('/')
else:
messages.error(request, "Invalid Login!")
else:
messages.error(request, Inv)
return render(request, 'login.html')
elif request.method == 'GET':
return render(request, 'login.html')
@login_required
def logout_view(request):
logout(request)
return redirect('/index')
@login_required
def interest_view(request):
return render(request, 'interest.html')
def register(request):
if request.method == "POST":
form = RegisterForm(request.POST)
if form.is_valid():
try:
user = User.objects.create_user(email = form.cleaned_data["email"],
password = form.cleaned_data["password"],
org = form.cleaned_data["org"],
igem = form.cleaned_data["igem"]
)
login(request, user)
messages.success(request, "Register successfully!")
return redirect('/interest')
except IntegrityError:
messages.error(request, "Email already exists!")
except:
messages.error(request, Err)
else:
messages.error(request, Inv)
return render(request, 'register.html')
def work(request):
try:
wk = Works.objects.get(TeamID = request.GET.get('id'))
use_parts = wk.Use_parts.split(';')
part = []
for item in use_parts:
try:
pt = Parts.objects.get(Name = item)
if request.user.is_authenticated:
try:
FavoriteParts.objects.get(user = request.user, part = pt)
favor = True
except FavoriteParts.DoesNotExist:
favor = False
else:
favor = False
part.append({
'id': pt.id,
'BBa': item,
'name': pt.secondName,
'isFavourite': favor})
except Parts.DoesNotExist:
part.append({
'id': request.GET.get('id'),
'BBa': item,
'name': pt.secondName,
'isFavourite': False})
if request.user.is_authenticated:
try:
UserFavorite.objects.get(user = request.user, circuit = wk.Circuit)
favorite = True
except UserFavorite.DoesNotExist:
favorite = False
else:
favorite = False
if wk.Img.all().count() == 0:
Img = [wk.DefaultImg]
else:
Img = [i.URL for i in wk.Img.all()]
Awards = wk.Award.split(';')
while len(Awards) > 0 and Awards[-1] == '':
Awards = Awards[: -1]
relatedTeams = Trelation.objects.filter(first = wk)
relatedTeams = list(map(lambda rt: {
'teamName': rt.second.Teamname,
'projectName': rt.second.Title,
'year': rt.second.Year,
'id': rt.second.TeamID
}, relatedTeams))
keywords = TeamKeyword.objects.filter(Team = wk)
keywords = list(map(lambda tk: [tk.keyword, tk.score], keywords))
keywords.sort(key = lambda tk: -tk[1])
keywords = list(map(lambda tk: tk[0], keywords))[:5]
wk.ReadCount += 1
wk.save()
context = {
'projectName': wk.Title,
'teamName': wk.Teamname,
'year': wk.Year,
'readCount': wk.ReadCount,
'medal': wk.Medal,
'rewards': Awards,
'description': wk.Description,
'isFavourite': favorite,
'images': Img,
'designId': -1 if wk.Circuit is None else wk.Circuit.id,
'part': part,
'logo': wk.logo,
'keywords': keywords,
'relatedTeams': relatedTeams
}
return render(request, 'work.html', context)
except Works.DoesNotExist:
return HttpResponse("Work Does Not Exist!")
search_url = 'http://sdin.sysusoftware.info:10086'
import requests
import json
trackTable = {
'artDesign': 'Art & Design',
'diagnostics': 'Diagnostics',
'energy': 'Energy',
'environment': 'Environment',
'foodEnergy': 'Food & Energy',
'foodAndNutrition': 'Food and Nutrition',
'foundationalAdvance': 'Foundational Advance',
'hardware': 'Hardware',
'healthMedicine': 'Health & Medicine',
'highSchool': 'High School',
'informationProcessing': 'Information Processing',
'manufacturing': 'Manufacturing',
'measurement': 'Measurement',
'newApplication': 'New Application',
'software': 'Software',
'therapeutics': 'Therapeutics'}
def _get_work(w, request):
if request.user.is_authenticated:
try:
UserFavorite.objects.get(user = request.user, circuit = w.Circuit)
favourite = True
except UserFavorite.DoesNotExist:
favourite = False
else:
favourite = False
awards = w.Award.split(';')
while len(awards) > 0 and awards[-1] == '':
awards = awards[:-1]
return {
'id': w.TeamID,
'year': w.Year,
'teamName': w.Teamname,
'projectName': w.Title,
'school': w.Teamname,
'medal': w.Medal,
'description': w.SimpleDescription,
'chassis': w.Chassis,
'rewards': awards,
'isFavourite': favourite,
'logo': w.logo,
'IEF': w.IEF
}
def safety_level(s):
try:
return {
1: 'Low risk',
2: 'Moderate risk',
3: 'High risk'
}[s]
except KeyError:
return 'Unknown risk'
def _get_part(p, request):
if request.user.is_authenticated:
try:
FavoriteParts.objects.get(user = request.user, part = p)
favourite = True
except FavoriteParts.DoesNotExist:
favourite = False
else:
favourite = False
return {
'id': p.id,
'name': p.Name,
'group': p.Group,
'date': p.DATE,
'description': p.Description,
'type': p.Type,
'releaseStatus': p.Release_status,
'sampleStatus': p.Sample_status,
'rating': p.Part_rating,
'use': p.Use,
'partResult': p.Part_results,
'safety': safety_level(p.Safety),
'isFavorite': favourite
}
def search_work(request):
key = request.GET.get('q')
lkey = key.lower()
year = request.GET.get('year')
if year == None:
year = 'any'
medal = request.GET.get('medal')
if medal == None:
medal = 'any'
track = request.GET.get('track')
if track == None:
track = 'any'
if track != 'any':
track = trackTable[track]
keys = key.split()
true_keys = []
key_dict = {}
q = Keyword.objects.all()
d = list(filter(lambda x: x.name.lower() in lkey, q))
for i in d:
if 'name' not in key_dict or len(key_dict['name']) < len(i.name):
key_dict = i.__dict__
for i in keys:
keyword_query = Keyword.objects.filter(name__contains = i)
filter_key = False
for j in keyword_query:
if j._type == 'year' and (year == 'any' or year == j.name):
year = j.name
filter_key = True
elif j._type == 'track' and (track == 'any' or track == j.name):
track = j.name
filter_key = True
elif j._type == 'medal' and (medal == 'any' or medal == j.name):
medal = j.name
filter_key = True
if not filter_key:
true_keys.append(i)
if 'link' in key_dict:
key_dict['link'] = json.loads(key_dict['link'])[0]
parts = []
works = []
keywords = []
if '_type' in key_dict and (key_dict['_type'] == 'team name' or key_dict['_type'] == 'special prizes'):
_data = json.loads(key_dict['suggestedProject'])
for d in _data:
try:
w = Works.objects.get(Year = d[1][0:4], Teamname = d[1][5:])
works.append(_get_work(w, request))
except:
pass
_data = json.loads(key_dict['suggestedPart'])
for d in _data:
try:
w = Parts.objects.get(Name = d[1])
parts.append(_get_part(w, request))
except:
pass
key = ''.join(map(lambda x: str(x) + ' ', true_keys))
if len(key) > 0:
key = key[:-1]
key = key.lower()
if request.user.is_authenticated and request.user.interest != 'None':
interest = json.dumps(json.loads(request.user.interest)['interest'])
else:
interest = '[]'
res = requests.get(search_url + "?key=" + key + "&interest=" + interest)
try:
result = json.loads(res.text)
except:
result = res.text
if len(true_keys) == 0:
q = Works.objects.all().order_by('-IEF')
if year != 'any':
q = q.filter(Year = year)
if medal != 'any':
q = q.filter(Medal = medal)
if track != 'any':
q = q.filter(Track = track)
for w in q:
works.append(_get_work(w, request))
if type(result) is dict:
if parts == []:
for item in result['parts']:
try:
p = Parts.objects.get(Name = item)
parts.append(_get_part(p, request))
except Parts.DoesNotExist:
pass
if works == []:
for item in result['teams']:
try:
s = item.split(' ')
w = Works.objects.get(Teamname = s[0], Year = s[1])
if year is not None and year != 'any' and w.Year != int(year):
continue
if medal is not None and medal != 'any' and w.Medal != medal:
continue
if track is not None and track != 'any' and w.Track != track:
continue
works.append(_get_work(w, request))
except Works.DoesNotExist:
pass
keywords = result['keyWords']
context = {
'works': works,
'parts': parts,
'keywords': keywords,
'resultsCount': len(works),
'additional': key_dict}
return render(request, 'search/work.html', context)
def search_paper(request):
key = request.GET.get('q')
query = Papers.objects.filter(Title__contains = key)
papers = [{
'id': x.id,
'title': x.Title,
'author': x.Authors,
'DOI': x.DOI,
'abstract': x.Abstract if len(x.Abstract) <= 120 else x.Abstract[:117] + '...',
'JIF': x.JIF,
'logo': x.LogoURL,
'circuitId': x.Circuit.id} for x in query]
context = {
'resultsCount': len(papers),
'papers': papers}
print(context)
return render(request, 'search/paper.html', context)
def search_part(request):
key = request.GET.get('q')
if key.find('BBa_') != -1:
query_set = Parts.objects.filter(Name__contains = key)
parts = [_get_part(x, request) for x in query_set]
context = {
'parts': parts,
'resultsCount': len(parts)
}
return render(request, 'search/part.html', context)
lkey = key.lower()
year = request.GET.get('year')
if year == None:
year = 'any'
medal = request.GET.get('medal')
if medal == None:
medal = 'any'
track = request.GET.get('track')
if track == None:
track = 'any'
if track != 'any':
track = trackTable[track]
keys = key.split()
true_keys = []
key_dict = {}
q = Keyword.objects.all()
d = list(filter(lambda x: x.name.lower() in lkey, q))
for i in d:
if 'name' not in key_dict or len(key_dict['name']) < len(i.name):
key_dict = i.__dict__
for i in keys:
keyword_query = Keyword.objects.filter(name__contains = i)
filter_key = False
for j in keyword_query:
if j._type == 'year' and (year == 'any' or year == j.name):
year = j.name
filter_key = True
elif j._type == 'track' and (track == 'any' or track == j.name):
track = j.name
filter_key = True
elif j._type == 'medal' and (medal == 'any' or medal == j.name):
medal = j.name
filter_key = True
if not filter_key:
true_keys.append(i)
if 'link' in key_dict:
key_dict['link'] = json.loads(key_dict['link'])
parts = []
works = []
keywords = []
if '_type' in key_dict and (key_dict['_type'] == 'team name' or key_dict['_type'] == 'special prizes'):
_data = json.loads(key_dict['suggestedProject'])
for d in _data:
try:
w = Works.objects.get(Year = d[1][0:4], Teamname = d[1][5:])
works.append(_get_work(w, request))
except:
pass
_data = json.loads(key_dict['suggestedPart'])
for d in _data:
try:
w = Parts.objects.get(Name = d[1])
parts.append(_get_part(w, request))
except:
pass
key = ''.join(map(lambda x: str(x) + ' ', true_keys))
if len(key) > 0:
key = key[:-1]
key = key.lower()
if request.user.is_authenticated and request.user.interest != 'None':
interest = json.dumps(json.loads(request.user.interest)['interest'])
else:
interest = '[]'
res = requests.get(search_url + "?key=" + key + "&interest=" + interest)
try:
result = json.loads(res.text)
except:
result = res.text
if len(true_keys) == 0:
q = Works.objects.all().order_by('-IEF')
if year != 'any':
q = q.filter(Year = year)
if medal != 'any':
q = q.filter(Medal = medal)
if track != 'any':
q = q.filter(Track = track)
for w in q:
works.append(_get_work(w, request))
if type(result) is dict:
if parts == []:
for item in result['parts']:
try:
p = Parts.objects.get(Name = item)
parts.append(_get_part(p, request))
except Parts.DoesNotExist:
pass
if works == []:
for item in result['teams']:
try:
s = item.split(' ')
w = Works.objects.get(Teamname = s[0], Year = s[1])
if year is not None and year != 'any' and w.Year != int(year):
continue
if medal is not None and medal != 'any' and w.Medal != medal:
continue
if track is not None and track != 'any' and w.Track != track:
continue
works.append(_get_work(w, request))
except Works.DoesNotExist:
pass
keywords = result['keyWords']
context = {
'works': works,
'parts': parts,
'keywords': keywords,
'resultsCount': len(parts),
'additional': key_dict}
return render(request, 'search/part.html', context)
def search_paper(request):
key = request.GET.get('q')
query = Papers.objects.filter(Abstract__contains = key)
papers = [{
'id': x.id,
'title': x.Title,
'author': x.Authors,
'DOI': x.DOI,
'abstract': x.Abstract if len(x.Abstract) <= 120 else x.Abstract[:117] + '...',
'JIF': x.JIF,
'logo': x.LogoURL,
'circuitId': x.Circuit.id} for x in query]
context = {
'resultsCount': len(papers),
'papers': papers}
print(context)
return render(request, 'search/paper.html', context)
return render(request, 'search/part.html', context)
def paper(request):
key = request.GET.get('id')
try:
paper = Papers.objects.get(pk = key)
parts_query = CircuitParts.objects.filter(Circuit = paper.Circuit)
part = []
for q in parts_query:
try:
pt = q.Part
if request.user.is_authenticated:
try:
FavoriteParts.objects.get(user = request.user, part = pt)
part.append({
'id': pt.id,
'BBa': pt.Name,
'name': pt.secondName,
'isFavourite': True})
except FavoriteParts.DoesNotExist:
part.append({
'id': pt.id,
'BBa': pt.Name,
'name': pt.secondName,
'isFavourite': False})
except Parts.DoesNotExist:
part.append({
'id': pt.id,
'BBa': pt.Name,
'name': pt.secondName,
'isFavourite': False})
if request.user.is_authenticated:
try:
UserFavorite.objects.get(user = request.user, circuit = paper.Circuit)
favorite = True
except UserFavorite.DoesNotExist:
favorite = False
else:
favorite = False
context = {
'title': paper.Title,
'DOI': paper.DOI,
'authors': paper.Authors.split(','),
'abstract': paper.Abstract,
'JIF': paper.JIF,
'keywords': paper.Keywords,
'designId': paper.Circuit.id,
'articleURL': paper.ArticleURL,
'copyright': paper.Copyright,
'part': part
}
return render(request, 'paper.html', context)
except Papers.DoesNotExist:
return HttpResponse('Does not exist.')
@login_required
def interest(request):
'''
GET /api/interest (get user interests)
return:
interest: ['xxx', 'xxx']
POST /api/interest (set user interests)
interest: ['xxx', 'xxx']
return:
success: true of false
'''
try:
if request.method == 'POST':
request.user.interest = request.POST['data']
request.user.save()
return JsonResponse({
'success': True})
else:
interests = request.user.interest
if interests == 'None':
interests = []
else:
interests = json.loads(interests)['interest']
return JsonResponse({
'success': True,
'interest': interests})
except:
traceback.print_exc()
return JsonResponse({
'success': False})
import json
with open(os.path.abspath(os.path.join(BASE_DIR, 'tools/preload/others/daotu.json'))) as f:
daotu = json.load(f)
def keywords(request):
'''
GET /keywords
'''
return JsonResponse(daotu)
| [
1,
529,
276,
1112,
420,
29958,
5015,
6541,
3226,
29872,
29914,
14816,
14605,
29899,
6295,
14093,
29899,
29906,
29900,
29896,
29955,
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,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29892,
6684,
13,
13,
3166,
269,
24581,
29889,
9514,
1053,
334,
13,
3166,
269,
24581,
29889,
9794,
1053,
334,
13,
13,
3166,
9557,
29889,
21570,
1053,
7191,
13,
3166,
9557,
29889,
2585,
1053,
17100,
537,
2392,
13,
3166,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
4669,
25125,
3664,
1252,
391,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
15585,
403,
29892,
6464,
29892,
1480,
449,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
13,
13,
3166,
9557,
29889,
1124,
1053,
14355,
5103,
29892,
9056,
5103,
13,
13,
5215,
9637,
1627,
13,
5215,
4390,
13,
13,
19212,
353,
376,
16804,
2743,
3850,
13,
12165,
353,
376,
13919,
883,
3850,
13,
13,
1753,
2380,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
2248,
29889,
1420,
1495,
13,
13,
1753,
6464,
29918,
1493,
29898,
3827,
1125,
13,
1678,
565,
2009,
29889,
5696,
1275,
376,
5438,
1115,
13,
4706,
396,
19130,
3158,
13,
4706,
883,
353,
19130,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
4876,
353,
883,
29889,
14941,
287,
29918,
1272,
1839,
5269,
2033,
13,
9651,
4800,
353,
529,
25711,
17013,
15513,
14941,
287,
29918,
1272,
1839,
5630,
2033,
13,
9651,
1404,
353,
15585,
403,
29898,
6786,
353,
4876,
29892,
4800,
353,
4800,
29897,
13,
9651,
565,
1404,
338,
451,
6213,
29901,
13,
18884,
6464,
29898,
3827,
29892,
1404,
29897,
13,
18884,
7191,
29889,
8698,
29898,
3827,
29892,
376,
11049,
8472,
29991,
1159,
13,
18884,
2446,
29918,
2271,
353,
2009,
29889,
5438,
29889,
657,
877,
4622,
1495,
13,
18884,
565,
2446,
29918,
2271,
29901,
13,
462,
1678,
736,
6684,
29898,
4622,
29918,
2271,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
736,
6684,
11219,
1495,
13,
9651,
1683,
29901,
13,
18884,
7191,
29889,
2704,
29898,
3827,
29892,
376,
13919,
19130,
29991,
1159,
13,
4706,
1683,
29901,
13,
9651,
7191,
29889,
2704,
29898,
3827,
29892,
15518,
29897,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
7507,
29889,
1420,
1495,
13,
1678,
25342,
2009,
29889,
5696,
1275,
525,
7194,
2396,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
7507,
29889,
1420,
1495,
13,
13,
29992,
7507,
29918,
12403,
13,
1753,
1480,
449,
29918,
1493,
29898,
3827,
1125,
13,
1678,
1480,
449,
29898,
3827,
29897,
13,
1678,
736,
6684,
11219,
2248,
1495,
13,
13,
29992,
7507,
29918,
12403,
13,
1753,
4066,
29918,
1493,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
1639,
342,
29889,
1420,
1495,
13,
13,
1753,
6036,
29898,
3827,
1125,
13,
1678,
565,
2009,
29889,
5696,
1275,
376,
5438,
1115,
13,
4706,
883,
353,
12577,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
1018,
29901,
13,
18884,
1404,
353,
4911,
29889,
12650,
29889,
3258,
29918,
1792,
29898,
5269,
353,
883,
29889,
14941,
287,
29918,
1272,
3366,
5269,
12436,
13,
462,
4706,
4800,
353,
883,
29889,
14941,
287,
29918,
1272,
3366,
5630,
12436,
13,
462,
4706,
1638,
353,
883,
29889,
14941,
287,
29918,
1272,
3366,
990,
12436,
13,
462,
4706,
8919,
331,
353,
883,
29889,
14941,
287,
29918,
1272,
3366,
335,
331,
3108,
13,
462,
4706,
1723,
13,
18884,
6464,
29898,
3827,
29892,
1404,
29897,
13,
18884,
7191,
29889,
8698,
29898,
3827,
29892,
376,
15213,
8472,
29991,
1159,
13,
18884,
736,
6684,
11219,
1639,
342,
1495,
13,
9651,
5174,
17100,
537,
2392,
29901,
13,
18884,
7191,
29889,
2704,
29898,
3827,
29892,
376,
9823,
2307,
4864,
29991,
1159,
13,
9651,
5174,
29901,
13,
18884,
7191,
29889,
2704,
29898,
3827,
29892,
25361,
29897,
13,
4706,
1683,
29901,
13,
9651,
7191,
29889,
2704,
29898,
3827,
29892,
15518,
29897,
13,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
9573,
29889,
1420,
1495,
13,
13,
1753,
664,
29898,
3827,
1125,
13,
1678,
1018,
29901,
13,
4706,
281,
29895,
353,
13976,
29889,
12650,
29889,
657,
29898,
19409,
1367,
353,
2009,
29889,
7194,
29889,
657,
877,
333,
8785,
13,
4706,
671,
29918,
20895,
353,
281,
29895,
29889,
11403,
29918,
20895,
29889,
5451,
877,
29936,
1495,
13,
4706,
760,
353,
5159,
13,
4706,
363,
2944,
297,
671,
29918,
20895,
29901,
13,
9651,
1018,
29901,
13,
18884,
19592,
353,
3455,
29879,
29889,
12650,
29889,
657,
29898,
1170,
353,
2944,
29897,
13,
18884,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
383,
17118,
568,
29925,
5708,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
760,
353,
19592,
29897,
13,
462,
4706,
7853,
353,
5852,
13,
462,
1678,
5174,
383,
17118,
568,
29925,
5708,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
4706,
7853,
353,
7700,
13,
18884,
1683,
29901,
13,
462,
1678,
7853,
353,
7700,
13,
13,
18884,
760,
29889,
4397,
3319,
13,
462,
1678,
525,
333,
2396,
19592,
29889,
333,
29892,
13,
462,
1678,
525,
14388,
29874,
2396,
2944,
29892,
13,
462,
1678,
525,
978,
2396,
19592,
29889,
7496,
1170,
29892,
13,
462,
1678,
525,
275,
29943,
485,
473,
568,
2396,
7853,
1800,
13,
13,
13,
9651,
5174,
3455,
29879,
29889,
25125,
3664,
1252,
391,
29901,
13,
18884,
760,
29889,
4397,
3319,
13,
462,
1678,
525,
333,
2396,
2009,
29889,
7194,
29889,
657,
877,
333,
5477,
13,
462,
1678,
525,
14388,
29874,
2396,
2944,
29892,
13,
462,
1678,
525,
978,
2396,
19592,
29889,
7496,
1170,
29892,
13,
462,
1678,
525,
275,
29943,
485,
473,
568,
2396,
7700,
1800,
13,
4706,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
9651,
1018,
29901,
13,
18884,
4911,
29943,
17118,
568,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
11369,
353,
281,
29895,
29889,
23495,
3121,
29897,
13,
18884,
25448,
353,
5852,
13,
9651,
5174,
4911,
29943,
17118,
568,
29889,
25125,
3664,
1252,
391,
29901,
13,
18884,
25448,
353,
7700,
13,
4706,
1683,
29901,
13,
9651,
25448,
353,
7700,
13,
13,
4706,
565,
281,
29895,
29889,
25518,
29889,
497,
2141,
2798,
580,
1275,
29871,
29900,
29901,
13,
9651,
1954,
29887,
353,
518,
29893,
29895,
29889,
4592,
25518,
29962,
13,
4706,
1683,
29901,
13,
9651,
1954,
29887,
353,
518,
29875,
29889,
4219,
363,
474,
297,
281,
29895,
29889,
25518,
29889,
497,
580,
29962,
13,
13,
4706,
9220,
353,
281,
29895,
29889,
29909,
1328,
29889,
5451,
877,
29936,
1495,
13,
4706,
1550,
7431,
29898,
29909,
2935,
29897,
1405,
29871,
29900,
322,
9220,
14352,
29896,
29962,
1275,
525,
2396,
13,
9651,
9220,
353,
9220,
7503,
448,
29896,
29962,
13,
13,
4706,
4475,
7141,
2232,
353,
323,
23445,
29889,
12650,
29889,
4572,
29898,
4102,
353,
281,
29895,
29897,
13,
4706,
4475,
7141,
2232,
353,
1051,
29898,
1958,
29898,
2892,
364,
29873,
29901,
426,
13,
9651,
525,
14318,
1170,
2396,
364,
29873,
29889,
7496,
29889,
19409,
978,
29892,
13,
9651,
525,
4836,
1170,
2396,
364,
29873,
29889,
7496,
29889,
7030,
29892,
13,
9651,
525,
6360,
2396,
364,
29873,
29889,
7496,
29889,
12883,
29892,
13,
9651,
525,
333,
2396,
364,
29873,
29889,
7496,
29889,
19409,
1367,
13,
4706,
2981,
4475,
7141,
2232,
876,
13,
13,
4706,
29361,
353,
8583,
2558,
1742,
29889,
12650,
29889,
4572,
29898,
19409,
353,
281,
29895,
29897,
13,
4706,
29361,
353,
1051,
29898,
1958,
29898,
2892,
18883,
29901,
518,
11178,
29889,
26766,
29892,
18883,
29889,
13628,
1402,
29361,
876,
13,
4706,
29361,
29889,
6605,
29898,
1989,
353,
14013,
18883,
29901,
448,
11178,
29961,
29896,
2314,
13,
4706,
29361,
353,
1051,
29898,
1958,
29898,
2892,
18883,
29901,
18883,
29961,
29900,
1402,
29361,
876,
7503,
29945,
29962,
13,
13,
4706,
281,
29895,
29889,
6359,
3981,
4619,
29871,
29896,
13,
4706,
281,
29895,
29889,
7620,
580,
13,
4706,
3030,
353,
426,
13,
9651,
525,
4836,
1170,
2396,
281,
29895,
29889,
7030,
29892,
13,
9651,
525,
14318,
1170,
2396,
281,
29895,
29889,
19409,
978,
29892,
13,
9651,
525,
6360,
2396,
281,
29895,
29889,
12883,
29892,
13,
9651,
525,
949,
3981,
2396,
281,
29895,
29889,
6359,
3981,
29892,
13,
9651,
525,
2168,
284,
2396,
281,
29895,
29889,
19302,
284,
29892,
13,
9651,
525,
276,
2935,
2396,
9220,
29892,
13,
9651,
525,
8216,
2396,
281,
29895,
29889,
9868,
29892,
13,
9651,
525,
275,
29943,
485,
473,
568,
2396,
25448,
29892,
13,
9651,
525,
8346,
2396,
1954,
29887,
29892,
13,
9651,
525,
13892,
1204,
2396,
448,
29896,
565,
281,
29895,
29889,
23495,
3121,
338,
6213,
1683,
281,
29895,
29889,
23495,
3121,
29889,
333,
29892,
13,
9651,
525,
1595,
2396,
760,
29892,
13,
9651,
525,
14569,
2396,
281,
29895,
29889,
14569,
29892,
13,
9651,
525,
1989,
9303,
2396,
29361,
29892,
13,
9651,
525,
12817,
7141,
2232,
2396,
4475,
7141,
2232,
13,
4706,
500,
13,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
1287,
29889,
1420,
742,
3030,
29897,
13,
13,
1678,
5174,
13976,
29889,
25125,
3664,
1252,
391,
29901,
13,
4706,
736,
9056,
5103,
703,
5531,
5538,
2216,
1222,
391,
29991,
1159,
13,
13,
4478,
29918,
2271,
353,
525,
1124,
597,
4928,
262,
29889,
9675,
10648,
14093,
29889,
3888,
29901,
29896,
29900,
29900,
29947,
29953,
29915,
13,
5215,
7274,
13,
5215,
4390,
13,
13,
11294,
3562,
353,
426,
13,
1678,
525,
442,
4002,
647,
2396,
525,
9986,
669,
12037,
742,
13,
1678,
525,
6051,
20921,
2396,
525,
12130,
20921,
742,
13,
1678,
525,
27548,
2396,
525,
29923,
1089,
1927,
742,
13,
1678,
525,
20944,
2396,
525,
18649,
742,
13,
1678,
525,
1181,
397,
29923,
1089,
1927,
2396,
525,
29943,
2092,
669,
24836,
742,
13,
1678,
525,
1181,
397,
2855,
29940,
329,
29878,
654,
2396,
525,
29943,
2092,
322,
405,
329,
29878,
654,
742,
13,
1678,
525,
11940,
1288,
3253,
29894,
749,
2396,
525,
9692,
1288,
25215,
749,
742,
13,
1678,
525,
6800,
2519,
2396,
525,
29950,
538,
2519,
742,
13,
1678,
525,
354,
4298,
29924,
7486,
457,
2396,
525,
3868,
4298,
669,
27529,
742,
13,
1678,
525,
9812,
4504,
1507,
2396,
525,
16382,
4523,
742,
13,
1678,
525,
19678,
7032,
292,
2396,
525,
20350,
10554,
292,
742,
13,
1678,
525,
1171,
9765,
3864,
2396,
525,
2517,
9765,
3864,
742,
13,
1678,
525,
26658,
358,
2396,
525,
6816,
3745,
358,
742,
13,
1678,
525,
1482,
4873,
2396,
525,
4373,
8427,
742,
13,
1678,
525,
20415,
2396,
525,
6295,
14093,
742,
13,
1678,
525,
721,
4085,
329,
1199,
2396,
525,
1349,
1572,
412,
329,
1199,
10827,
13,
13,
1753,
903,
657,
29918,
1287,
29898,
29893,
29892,
2009,
1125,
13,
1678,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
4706,
1018,
29901,
13,
9651,
4911,
29943,
17118,
568,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
11369,
353,
281,
29889,
23495,
3121,
29897,
13,
9651,
15381,
568,
353,
5852,
13,
4706,
5174,
4911,
29943,
17118,
568,
29889,
25125,
3664,
1252,
391,
29901,
13,
9651,
15381,
568,
353,
7700,
13,
1678,
1683,
29901,
13,
4706,
15381,
568,
353,
7700,
13,
13,
1678,
24441,
353,
281,
29889,
29909,
1328,
29889,
5451,
877,
29936,
1495,
13,
1678,
1550,
7431,
29898,
29874,
2935,
29897,
1405,
29871,
29900,
322,
24441,
14352,
29896,
29962,
1275,
525,
2396,
13,
4706,
24441,
353,
24441,
7503,
29899,
29896,
29962,
13,
13,
1678,
736,
426,
13,
4706,
525,
333,
2396,
281,
29889,
19409,
1367,
29892,
13,
4706,
525,
6360,
2396,
281,
29889,
12883,
29892,
13,
4706,
525,
14318,
1170,
2396,
281,
29889,
19409,
978,
29892,
13,
4706,
525,
4836,
1170,
2396,
281,
29889,
7030,
29892,
13,
4706,
525,
27041,
2396,
281,
29889,
19409,
978,
29892,
13,
4706,
525,
2168,
284,
2396,
281,
29889,
19302,
284,
29892,
13,
4706,
525,
8216,
2396,
281,
29889,
15427,
9868,
29892,
13,
4706,
525,
305,
465,
275,
2396,
281,
29889,
1451,
465,
275,
29892,
13,
4706,
525,
276,
2935,
2396,
24441,
29892,
13,
4706,
525,
275,
29943,
485,
473,
568,
2396,
15381,
568,
29892,
13,
4706,
525,
14569,
2396,
281,
29889,
14569,
29892,
13,
4706,
525,
8673,
29943,
2396,
281,
29889,
8673,
29943,
13,
1678,
500,
13,
13,
1753,
15332,
29918,
5563,
29898,
29879,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
426,
13,
462,
29896,
29901,
525,
29931,
340,
12045,
742,
13,
462,
29906,
29901,
525,
2111,
261,
403,
12045,
742,
13,
462,
29941,
29901,
525,
16382,
12045,
29915,
13,
9651,
500,
29961,
29879,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
736,
525,
14148,
12045,
29915,
13,
13,
1753,
903,
657,
29918,
1595,
29898,
29886,
29892,
2009,
1125,
13,
1678,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
4706,
1018,
29901,
13,
9651,
383,
17118,
568,
29925,
5708,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
760,
353,
282,
29897,
13,
9651,
15381,
568,
353,
5852,
13,
4706,
5174,
383,
17118,
568,
29925,
5708,
29889,
25125,
3664,
1252,
391,
29901,
13,
9651,
15381,
568,
353,
7700,
13,
1678,
1683,
29901,
13,
4706,
15381,
568,
353,
7700,
13,
1678,
736,
426,
13,
4706,
525,
333,
2396,
282,
29889,
333,
29892,
13,
4706,
525,
978,
2396,
282,
29889,
1170,
29892,
13,
4706,
525,
2972,
2396,
282,
29889,
4782,
29892,
13,
4706,
525,
1256,
2396,
282,
29889,
6248,
29892,
13,
4706,
525,
8216,
2396,
282,
29889,
9868,
29892,
13,
4706,
525,
1853,
2396,
282,
29889,
1542,
29892,
13,
4706,
525,
14096,
5709,
2396,
282,
29889,
19729,
29918,
4882,
29892,
13,
4706,
525,
11249,
5709,
2396,
282,
29889,
17708,
29918,
4882,
29892,
13,
4706,
525,
29741,
2396,
282,
29889,
7439,
29918,
29741,
29892,
13,
4706,
525,
1509,
2396,
282,
29889,
11403,
29892,
13,
4706,
525,
1595,
3591,
2396,
282,
29889,
7439,
29918,
9902,
29892,
13,
4706,
525,
29879,
2142,
3305,
2396,
15332,
29918,
5563,
29898,
29886,
29889,
29903,
2142,
3305,
511,
13,
4706,
525,
275,
29943,
17118,
568,
2396,
15381,
568,
13,
1678,
500,
13,
13,
1753,
2740,
29918,
1287,
29898,
3827,
1125,
13,
1678,
1820,
353,
2009,
29889,
7194,
29889,
657,
877,
29939,
1495,
13,
1678,
301,
1989,
353,
1820,
29889,
13609,
580,
13,
13,
1678,
1629,
353,
2009,
29889,
7194,
29889,
657,
877,
6360,
1495,
13,
1678,
565,
1629,
1275,
6213,
29901,
13,
4706,
1629,
353,
525,
1384,
29915,
13,
1678,
12807,
353,
2009,
29889,
7194,
29889,
657,
877,
2168,
284,
1495,
13,
1678,
565,
12807,
1275,
6213,
29901,
13,
4706,
12807,
353,
525,
1384,
29915,
13,
1678,
5702,
353,
2009,
29889,
7194,
29889,
657,
877,
11294,
1495,
13,
1678,
565,
5702,
1275,
6213,
29901,
13,
4706,
5702,
353,
525,
1384,
29915,
13,
1678,
565,
5702,
2804,
525,
1384,
2396,
13,
4706,
5702,
353,
5702,
3562,
29961,
11294,
29962,
13,
13,
1678,
6611,
353,
1820,
29889,
5451,
580,
13,
1678,
1565,
29918,
8149,
353,
5159,
13,
13,
1678,
1820,
29918,
8977,
353,
6571,
13,
1678,
3855,
353,
7670,
1742,
29889,
12650,
29889,
497,
580,
13,
1678,
270,
353,
1051,
29898,
4572,
29898,
2892,
921,
29901,
921,
29889,
978,
29889,
13609,
580,
297,
301,
1989,
29892,
3855,
876,
13,
1678,
363,
474,
297,
270,
29901,
13,
4706,
565,
525,
978,
29915,
451,
297,
1820,
29918,
8977,
470,
7431,
29898,
1989,
29918,
8977,
1839,
978,
11287,
529,
7431,
29898,
29875,
29889,
978,
1125,
13,
9651,
1820,
29918,
8977,
353,
474,
17255,
8977,
1649,
13,
13,
1678,
363,
474,
297,
6611,
29901,
13,
4706,
13553,
29918,
1972,
353,
7670,
1742,
29889,
12650,
29889,
4572,
29898,
978,
1649,
11516,
353,
474,
29897,
13,
4706,
4175,
29918,
1989,
353,
7700,
13,
4706,
363,
432,
297,
13553,
29918,
1972,
29901,
13,
9651,
565,
432,
3032,
1853,
1275,
525,
6360,
29915,
322,
313,
6360,
1275,
525,
1384,
29915,
470,
1629,
1275,
432,
29889,
978,
1125,
13,
18884,
1629,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
9651,
25342,
432,
3032,
1853,
1275,
525,
11294,
29915,
322,
313,
11294,
1275,
525,
1384,
29915,
470,
5702,
1275,
432,
29889,
978,
1125,
13,
18884,
5702,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
9651,
25342,
432,
3032,
1853,
1275,
525,
2168,
284,
29915,
322,
313,
2168,
284,
1275,
525,
1384,
29915,
470,
12807,
1275,
432,
29889,
978,
1125,
13,
18884,
12807,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
13,
4706,
565,
451,
4175,
29918,
1989,
29901,
13,
9651,
1565,
29918,
8149,
29889,
4397,
29898,
29875,
29897,
13,
13,
1678,
565,
525,
2324,
29915,
297,
1820,
29918,
8977,
29901,
13,
4706,
1820,
29918,
8977,
1839,
2324,
2033,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
2324,
2033,
9601,
29900,
29962,
13,
13,
1678,
5633,
353,
5159,
13,
1678,
1736,
353,
5159,
13,
1678,
29361,
353,
5159,
13,
13,
1678,
565,
22868,
1853,
29915,
297,
1820,
29918,
8977,
322,
313,
1989,
29918,
8977,
1839,
29918,
1853,
2033,
1275,
525,
14318,
1024,
29915,
470,
1820,
29918,
8977,
1839,
29918,
1853,
2033,
1275,
525,
18732,
3691,
10947,
29374,
13,
4706,
903,
1272,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
29879,
12981,
2868,
7653,
11287,
13,
4706,
363,
270,
297,
903,
1272,
29901,
13,
9651,
1018,
29901,
13,
18884,
281,
353,
13976,
29889,
12650,
29889,
657,
29898,
12883,
353,
270,
29961,
29896,
3816,
29900,
29901,
29946,
1402,
8583,
978,
353,
270,
29961,
29896,
3816,
29945,
29901,
2314,
13,
18884,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
9651,
5174,
29901,
13,
18884,
1209,
13,
4706,
903,
1272,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
29879,
12981,
2868,
7439,
11287,
13,
4706,
363,
270,
297,
903,
1272,
29901,
13,
9651,
1018,
29901,
13,
18884,
281,
353,
3455,
29879,
29889,
12650,
29889,
657,
29898,
1170,
353,
270,
29961,
29896,
2314,
13,
18884,
5633,
29889,
4397,
7373,
657,
29918,
1595,
29898,
29893,
29892,
2009,
876,
13,
9651,
5174,
29901,
13,
18884,
1209,
13,
13,
13,
1678,
1820,
353,
525,
4286,
7122,
29898,
1958,
29898,
2892,
921,
29901,
851,
29898,
29916,
29897,
718,
525,
13420,
1565,
29918,
8149,
876,
13,
1678,
565,
7431,
29898,
1989,
29897,
1405,
29871,
29900,
29901,
13,
4706,
1820,
353,
1820,
7503,
29899,
29896,
29962,
13,
1678,
1820,
353,
1820,
29889,
13609,
580,
13,
13,
1678,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
322,
2009,
29889,
1792,
29889,
1639,
342,
2804,
525,
8516,
2396,
13,
4706,
4066,
353,
4390,
29889,
29881,
17204,
29898,
3126,
29889,
18132,
29898,
3827,
29889,
1792,
29889,
1639,
342,
29897,
1839,
1639,
342,
11287,
13,
1678,
1683,
29901,
13,
4706,
4066,
353,
525,
2636,
29915,
13,
1678,
620,
353,
7274,
29889,
657,
29898,
4478,
29918,
2271,
718,
376,
29973,
1989,
543,
718,
1820,
718,
376,
29987,
1639,
342,
543,
718,
4066,
29897,
13,
1678,
1018,
29901,
13,
4706,
1121,
353,
4390,
29889,
18132,
29898,
690,
29889,
726,
29897,
13,
1678,
5174,
29901,
13,
4706,
1121,
353,
620,
29889,
726,
13,
13,
1678,
565,
7431,
29898,
3009,
29918,
8149,
29897,
1275,
29871,
29900,
29901,
13,
4706,
3855,
353,
13976,
29889,
12650,
29889,
497,
2141,
2098,
29918,
1609,
877,
29899,
8673,
29943,
1495,
13,
4706,
565,
1629,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
12883,
353,
1629,
29897,
13,
4706,
565,
12807,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
19302,
284,
353,
12807,
29897,
13,
4706,
565,
5702,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
17936,
353,
5702,
29897,
13,
13,
4706,
363,
281,
297,
3855,
29901,
13,
9651,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
13,
1678,
565,
1134,
29898,
2914,
29897,
338,
9657,
29901,
13,
4706,
565,
5633,
1275,
5159,
29901,
13,
9651,
363,
2944,
297,
1121,
1839,
20895,
2033,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
282,
353,
3455,
29879,
29889,
12650,
29889,
657,
29898,
1170,
353,
2944,
29897,
13,
462,
1678,
5633,
29889,
4397,
7373,
657,
29918,
1595,
29898,
29886,
29892,
2009,
876,
13,
13,
18884,
5174,
3455,
29879,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
1678,
1209,
13,
13,
4706,
565,
1736,
1275,
5159,
29901,
13,
9651,
363,
2944,
297,
1121,
1839,
371,
2232,
2033,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
269,
353,
2944,
29889,
5451,
877,
25710,
13,
462,
1678,
281,
353,
13976,
29889,
12650,
29889,
657,
29898,
19409,
978,
353,
269,
29961,
29900,
1402,
8905,
353,
269,
29961,
29896,
2314,
13,
13,
462,
1678,
565,
1629,
338,
451,
6213,
322,
1629,
2804,
525,
1384,
29915,
322,
281,
29889,
12883,
2804,
938,
29898,
6360,
1125,
13,
462,
4706,
6773,
13,
462,
1678,
565,
12807,
338,
451,
6213,
322,
12807,
2804,
525,
1384,
29915,
322,
281,
29889,
19302,
284,
2804,
12807,
29901,
13,
462,
4706,
6773,
13,
462,
1678,
565,
5702,
338,
451,
6213,
322,
5702,
2804,
525,
1384,
29915,
322,
281,
29889,
17936,
2804,
5702,
29901,
13,
462,
4706,
6773,
13,
13,
462,
1678,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
13,
18884,
5174,
13976,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
1678,
1209,
13,
13,
4706,
29361,
353,
1121,
1839,
1989,
29956,
4339,
2033,
13,
13,
1678,
3030,
353,
426,
13,
4706,
525,
13129,
2396,
1736,
29892,
13,
4706,
525,
20895,
2396,
5633,
29892,
13,
4706,
525,
1989,
9303,
2396,
29361,
29892,
13,
4706,
525,
9902,
3981,
2396,
7431,
29898,
13129,
511,
13,
4706,
525,
1202,
3245,
2396,
1820,
29918,
8977,
29913,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
1287,
29889,
1420,
742,
3030,
29897,
13,
13,
1753,
2740,
29918,
19773,
29898,
3827,
1125,
13,
1678,
1820,
353,
2009,
29889,
7194,
29889,
657,
877,
29939,
1495,
13,
1678,
2346,
353,
8579,
414,
29889,
12650,
29889,
4572,
29898,
7030,
1649,
11516,
353,
1820,
29897,
13,
1678,
15055,
353,
15974,
13,
4706,
525,
333,
2396,
921,
29889,
333,
29892,
13,
4706,
525,
3257,
2396,
921,
29889,
7030,
29892,
13,
4706,
525,
8921,
2396,
921,
29889,
6444,
943,
29892,
13,
4706,
525,
3970,
29902,
2396,
921,
29889,
3970,
29902,
29892,
13,
4706,
525,
16595,
2396,
921,
29889,
9118,
565,
7431,
29898,
29916,
29889,
9118,
29897,
5277,
29871,
29896,
29906,
29900,
1683,
921,
29889,
9118,
7503,
29896,
29896,
29955,
29962,
718,
525,
856,
742,
13,
4706,
525,
29967,
6545,
2396,
921,
29889,
29967,
6545,
29892,
13,
4706,
525,
14569,
2396,
921,
29889,
3403,
29877,
4219,
29892,
13,
4706,
525,
6034,
3121,
1204,
2396,
921,
29889,
23495,
3121,
29889,
333,
29913,
363,
921,
297,
2346,
29962,
13,
1678,
3030,
353,
426,
13,
9651,
525,
9902,
3981,
2396,
7431,
29898,
29886,
21321,
511,
13,
9651,
525,
29886,
21321,
2396,
15055,
29913,
13,
1678,
1596,
29898,
4703,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
19773,
29889,
1420,
742,
3030,
29897,
13,
13,
1753,
2740,
29918,
1595,
29898,
3827,
1125,
13,
1678,
1820,
353,
2009,
29889,
7194,
29889,
657,
877,
29939,
1495,
13,
1678,
565,
1820,
29889,
2886,
877,
14388,
29874,
29918,
1495,
2804,
448,
29896,
29901,
13,
4706,
2346,
29918,
842,
353,
3455,
29879,
29889,
12650,
29889,
4572,
29898,
1170,
1649,
11516,
353,
1820,
29897,
13,
4706,
5633,
353,
23160,
657,
29918,
1595,
29898,
29916,
29892,
2009,
29897,
363,
921,
297,
2346,
29918,
842,
29962,
13,
4706,
3030,
353,
426,
13,
9651,
525,
20895,
2396,
5633,
29892,
13,
9651,
525,
9902,
3981,
2396,
7431,
29898,
20895,
29897,
13,
4706,
500,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
1595,
29889,
1420,
742,
3030,
29897,
13,
1678,
301,
1989,
353,
1820,
29889,
13609,
580,
13,
13,
1678,
1629,
353,
2009,
29889,
7194,
29889,
657,
877,
6360,
1495,
13,
1678,
565,
1629,
1275,
6213,
29901,
13,
4706,
1629,
353,
525,
1384,
29915,
13,
1678,
12807,
353,
2009,
29889,
7194,
29889,
657,
877,
2168,
284,
1495,
13,
1678,
565,
12807,
1275,
6213,
29901,
13,
4706,
12807,
353,
525,
1384,
29915,
13,
1678,
5702,
353,
2009,
29889,
7194,
29889,
657,
877,
11294,
1495,
13,
1678,
565,
5702,
1275,
6213,
29901,
13,
4706,
5702,
353,
525,
1384,
29915,
13,
1678,
565,
5702,
2804,
525,
1384,
2396,
13,
4706,
5702,
353,
5702,
3562,
29961,
11294,
29962,
13,
13,
1678,
6611,
353,
1820,
29889,
5451,
580,
13,
1678,
1565,
29918,
8149,
353,
5159,
13,
13,
1678,
1820,
29918,
8977,
353,
6571,
13,
1678,
3855,
353,
7670,
1742,
29889,
12650,
29889,
497,
580,
13,
1678,
270,
353,
1051,
29898,
4572,
29898,
2892,
921,
29901,
921,
29889,
978,
29889,
13609,
580,
297,
301,
1989,
29892,
3855,
876,
13,
1678,
363,
474,
297,
270,
29901,
13,
4706,
565,
525,
978,
29915,
451,
297,
1820,
29918,
8977,
470,
7431,
29898,
1989,
29918,
8977,
1839,
978,
11287,
529,
7431,
29898,
29875,
29889,
978,
1125,
13,
9651,
1820,
29918,
8977,
353,
474,
17255,
8977,
1649,
13,
13,
1678,
363,
474,
297,
6611,
29901,
13,
4706,
13553,
29918,
1972,
353,
7670,
1742,
29889,
12650,
29889,
4572,
29898,
978,
1649,
11516,
353,
474,
29897,
13,
4706,
4175,
29918,
1989,
353,
7700,
13,
4706,
363,
432,
297,
13553,
29918,
1972,
29901,
13,
9651,
565,
432,
3032,
1853,
1275,
525,
6360,
29915,
322,
313,
6360,
1275,
525,
1384,
29915,
470,
1629,
1275,
432,
29889,
978,
1125,
13,
18884,
1629,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
9651,
25342,
432,
3032,
1853,
1275,
525,
11294,
29915,
322,
313,
11294,
1275,
525,
1384,
29915,
470,
5702,
1275,
432,
29889,
978,
1125,
13,
18884,
5702,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
9651,
25342,
432,
3032,
1853,
1275,
525,
2168,
284,
29915,
322,
313,
2168,
284,
1275,
525,
1384,
29915,
470,
12807,
1275,
432,
29889,
978,
1125,
13,
18884,
12807,
353,
432,
29889,
978,
13,
18884,
4175,
29918,
1989,
353,
5852,
13,
13,
4706,
565,
451,
4175,
29918,
1989,
29901,
13,
9651,
1565,
29918,
8149,
29889,
4397,
29898,
29875,
29897,
13,
13,
1678,
565,
525,
2324,
29915,
297,
1820,
29918,
8977,
29901,
13,
4706,
1820,
29918,
8977,
1839,
2324,
2033,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
2324,
11287,
13,
13,
1678,
5633,
353,
5159,
13,
1678,
1736,
353,
5159,
13,
1678,
29361,
353,
5159,
13,
13,
1678,
565,
22868,
1853,
29915,
297,
1820,
29918,
8977,
322,
313,
1989,
29918,
8977,
1839,
29918,
1853,
2033,
1275,
525,
14318,
1024,
29915,
470,
1820,
29918,
8977,
1839,
29918,
1853,
2033,
1275,
525,
18732,
3691,
10947,
29374,
13,
4706,
903,
1272,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
29879,
12981,
2868,
7653,
11287,
13,
4706,
363,
270,
297,
903,
1272,
29901,
13,
9651,
1018,
29901,
13,
18884,
281,
353,
13976,
29889,
12650,
29889,
657,
29898,
12883,
353,
270,
29961,
29896,
3816,
29900,
29901,
29946,
1402,
8583,
978,
353,
270,
29961,
29896,
3816,
29945,
29901,
2314,
13,
18884,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
9651,
5174,
29901,
13,
18884,
1209,
13,
4706,
903,
1272,
353,
4390,
29889,
18132,
29898,
1989,
29918,
8977,
1839,
29879,
12981,
2868,
7439,
11287,
13,
4706,
363,
270,
297,
903,
1272,
29901,
13,
9651,
1018,
29901,
13,
18884,
281,
353,
3455,
29879,
29889,
12650,
29889,
657,
29898,
1170,
353,
270,
29961,
29896,
2314,
13,
18884,
5633,
29889,
4397,
7373,
657,
29918,
1595,
29898,
29893,
29892,
2009,
876,
13,
9651,
5174,
29901,
13,
18884,
1209,
13,
13,
1678,
1820,
353,
525,
4286,
7122,
29898,
1958,
29898,
2892,
921,
29901,
851,
29898,
29916,
29897,
718,
525,
13420,
1565,
29918,
8149,
876,
13,
1678,
565,
7431,
29898,
1989,
29897,
1405,
29871,
29900,
29901,
13,
4706,
1820,
353,
1820,
7503,
29899,
29896,
29962,
13,
1678,
1820,
353,
1820,
29889,
13609,
580,
13,
13,
1678,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
322,
2009,
29889,
1792,
29889,
1639,
342,
2804,
525,
8516,
2396,
13,
4706,
4066,
353,
4390,
29889,
29881,
17204,
29898,
3126,
29889,
18132,
29898,
3827,
29889,
1792,
29889,
1639,
342,
29897,
1839,
1639,
342,
11287,
13,
1678,
1683,
29901,
13,
4706,
4066,
353,
525,
2636,
29915,
13,
1678,
620,
353,
7274,
29889,
657,
29898,
4478,
29918,
2271,
718,
376,
29973,
1989,
543,
718,
1820,
718,
376,
29987,
1639,
342,
543,
718,
4066,
29897,
13,
1678,
1018,
29901,
13,
4706,
1121,
353,
4390,
29889,
18132,
29898,
690,
29889,
726,
29897,
13,
1678,
5174,
29901,
13,
4706,
1121,
353,
620,
29889,
726,
13,
13,
1678,
565,
7431,
29898,
3009,
29918,
8149,
29897,
1275,
29871,
29900,
29901,
13,
4706,
3855,
353,
13976,
29889,
12650,
29889,
497,
2141,
2098,
29918,
1609,
877,
29899,
8673,
29943,
1495,
13,
4706,
565,
1629,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
12883,
353,
1629,
29897,
13,
4706,
565,
12807,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
19302,
284,
353,
12807,
29897,
13,
4706,
565,
5702,
2804,
525,
1384,
2396,
13,
9651,
3855,
353,
3855,
29889,
4572,
29898,
17936,
353,
5702,
29897,
13,
13,
4706,
363,
281,
297,
3855,
29901,
13,
9651,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
13,
1678,
565,
1134,
29898,
2914,
29897,
338,
9657,
29901,
13,
4706,
565,
5633,
1275,
5159,
29901,
13,
9651,
363,
2944,
297,
1121,
1839,
20895,
2033,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
282,
353,
3455,
29879,
29889,
12650,
29889,
657,
29898,
1170,
353,
2944,
29897,
13,
462,
1678,
5633,
29889,
4397,
7373,
657,
29918,
1595,
29898,
29886,
29892,
2009,
876,
13,
13,
18884,
5174,
3455,
29879,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
1678,
1209,
13,
13,
4706,
565,
1736,
1275,
5159,
29901,
13,
9651,
363,
2944,
297,
1121,
1839,
371,
2232,
2033,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
269,
353,
2944,
29889,
5451,
877,
25710,
13,
462,
1678,
281,
353,
13976,
29889,
12650,
29889,
657,
29898,
19409,
978,
353,
269,
29961,
29900,
1402,
8905,
353,
269,
29961,
29896,
2314,
13,
13,
462,
1678,
565,
1629,
338,
451,
6213,
322,
1629,
2804,
525,
1384,
29915,
322,
281,
29889,
12883,
2804,
938,
29898,
6360,
1125,
13,
462,
4706,
6773,
13,
462,
1678,
565,
12807,
338,
451,
6213,
322,
12807,
2804,
525,
1384,
29915,
322,
281,
29889,
19302,
284,
2804,
12807,
29901,
13,
462,
4706,
6773,
13,
462,
1678,
565,
5702,
338,
451,
6213,
322,
5702,
2804,
525,
1384,
29915,
322,
281,
29889,
17936,
2804,
5702,
29901,
13,
462,
4706,
6773,
13,
13,
462,
1678,
1736,
29889,
4397,
7373,
657,
29918,
1287,
29898,
29893,
29892,
2009,
876,
13,
13,
18884,
5174,
13976,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
1678,
1209,
13,
13,
4706,
29361,
353,
1121,
1839,
1989,
29956,
4339,
2033,
13,
13,
1678,
3030,
353,
426,
13,
4706,
525,
13129,
2396,
1736,
29892,
13,
4706,
525,
20895,
2396,
5633,
29892,
13,
4706,
525,
1989,
9303,
2396,
29361,
29892,
13,
4706,
525,
9902,
3981,
2396,
7431,
29898,
20895,
511,
13,
4706,
525,
1202,
3245,
2396,
1820,
29918,
8977,
29913,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
1595,
29889,
1420,
742,
3030,
29897,
13,
13,
1753,
2740,
29918,
19773,
29898,
3827,
1125,
13,
1678,
1820,
353,
2009,
29889,
7194,
29889,
657,
877,
29939,
1495,
13,
1678,
2346,
353,
8579,
414,
29889,
12650,
29889,
4572,
29898,
9118,
1649,
11516,
353,
1820,
29897,
13,
1678,
15055,
353,
15974,
13,
4706,
525,
333,
2396,
921,
29889,
333,
29892,
13,
4706,
525,
3257,
2396,
921,
29889,
7030,
29892,
13,
4706,
525,
8921,
2396,
921,
29889,
6444,
943,
29892,
13,
4706,
525,
3970,
29902,
2396,
921,
29889,
3970,
29902,
29892,
13,
4706,
525,
16595,
2396,
921,
29889,
9118,
565,
7431,
29898,
29916,
29889,
9118,
29897,
5277,
29871,
29896,
29906,
29900,
1683,
921,
29889,
9118,
7503,
29896,
29896,
29955,
29962,
718,
525,
856,
742,
13,
4706,
525,
29967,
6545,
2396,
921,
29889,
29967,
6545,
29892,
13,
4706,
525,
14569,
2396,
921,
29889,
3403,
29877,
4219,
29892,
13,
4706,
525,
6034,
3121,
1204,
2396,
921,
29889,
23495,
3121,
29889,
333,
29913,
363,
921,
297,
2346,
29962,
13,
1678,
3030,
353,
426,
13,
9651,
525,
9902,
3981,
2396,
7431,
29898,
29886,
21321,
511,
13,
9651,
525,
29886,
21321,
2396,
15055,
29913,
13,
1678,
1596,
29898,
4703,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
19773,
29889,
1420,
742,
3030,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
4478,
29914,
1595,
29889,
1420,
742,
3030,
29897,
13,
13,
13,
1753,
5650,
29898,
3827,
1125,
13,
1678,
1820,
353,
2009,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1018,
29901,
13,
4706,
5650,
353,
8579,
414,
29889,
12650,
29889,
657,
29898,
20571,
353,
1820,
29897,
13,
13,
4706,
5633,
29918,
1972,
353,
12594,
3121,
29925,
5708,
29889,
12650,
29889,
4572,
29898,
23495,
3121,
353,
5650,
29889,
23495,
3121,
29897,
13,
4706,
760,
353,
5159,
13,
4706,
363,
3855,
297,
5633,
29918,
1972,
29901,
13,
9651,
1018,
29901,
13,
18884,
19592,
353,
3855,
29889,
7439,
13,
18884,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
383,
17118,
568,
29925,
5708,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
760,
353,
19592,
29897,
13,
462,
4706,
760,
29889,
4397,
3319,
13,
462,
9651,
525,
333,
2396,
19592,
29889,
333,
29892,
13,
462,
9651,
525,
14388,
29874,
2396,
19592,
29889,
1170,
29892,
13,
462,
9651,
525,
978,
2396,
19592,
29889,
7496,
1170,
29892,
13,
462,
9651,
525,
275,
29943,
485,
473,
568,
2396,
5852,
1800,
13,
462,
1678,
5174,
383,
17118,
568,
29925,
5708,
29889,
25125,
3664,
1252,
391,
29901,
13,
462,
4706,
760,
29889,
4397,
3319,
13,
462,
9651,
525,
333,
2396,
19592,
29889,
333,
29892,
13,
462,
9651,
525,
14388,
29874,
2396,
19592,
29889,
1170,
29892,
13,
462,
9651,
525,
978,
2396,
19592,
29889,
7496,
1170,
29892,
13,
462,
9651,
525,
275,
29943,
485,
473,
568,
2396,
7700,
1800,
13,
13,
9651,
5174,
3455,
29879,
29889,
25125,
3664,
1252,
391,
29901,
13,
18884,
760,
29889,
4397,
3319,
13,
462,
1678,
525,
333,
2396,
19592,
29889,
333,
29892,
13,
462,
1678,
525,
14388,
29874,
2396,
19592,
29889,
1170,
29892,
13,
462,
1678,
525,
978,
2396,
19592,
29889,
7496,
1170,
29892,
13,
462,
1678,
525,
275,
29943,
485,
473,
568,
2396,
7700,
1800,
13,
4706,
565,
2009,
29889,
1792,
29889,
275,
29918,
27218,
630,
29901,
13,
9651,
1018,
29901,
13,
18884,
4911,
29943,
17118,
568,
29889,
12650,
29889,
657,
29898,
1792,
353,
2009,
29889,
1792,
29892,
11369,
353,
5650,
29889,
23495,
3121,
29897,
13,
18884,
25448,
353,
5852,
13,
9651,
5174,
4911,
29943,
17118,
568,
29889,
25125,
3664,
1252,
391,
29901,
13,
18884,
25448,
353,
7700,
13,
4706,
1683,
29901,
13,
9651,
25448,
353,
7700,
13,
13,
4706,
3030,
353,
426,
13,
9651,
525,
3257,
2396,
5650,
29889,
7030,
29892,
13,
9651,
525,
3970,
29902,
2396,
5650,
29889,
3970,
29902,
29892,
13,
9651,
525,
5150,
943,
2396,
5650,
29889,
6444,
943,
29889,
5451,
29898,
3788,
511,
13,
9651,
525,
16595,
2396,
5650,
29889,
9118,
29892,
13,
9651,
525,
29967,
6545,
2396,
5650,
29889,
29967,
6545,
29892,
13,
9651,
525,
1989,
9303,
2396,
5650,
29889,
2558,
9303,
29892,
13,
9651,
525,
13892,
1204,
2396,
5650,
29889,
23495,
3121,
29889,
333,
29892,
13,
9651,
525,
7914,
4219,
2396,
5650,
29889,
9986,
2512,
4219,
29892,
13,
9651,
525,
8552,
1266,
2396,
5650,
29889,
11882,
1266,
29892,
13,
9651,
525,
1595,
2396,
760,
13,
4706,
500,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
19773,
29889,
1420,
742,
3030,
29897,
13,
1678,
5174,
8579,
414,
29889,
25125,
3664,
1252,
391,
29901,
13,
4706,
736,
9056,
5103,
877,
25125,
451,
1863,
29889,
1495,
13,
13,
13,
29992,
7507,
29918,
12403,
13,
1753,
4066,
29898,
3827,
1125,
13,
1678,
14550,
13,
1678,
12354,
847,
2754,
29914,
1639,
342,
313,
657,
1404,
20017,
29897,
13,
1678,
736,
29901,
13,
4706,
4066,
29901,
6024,
12353,
742,
525,
12353,
2033,
13,
13,
13,
1678,
11971,
847,
2754,
29914,
1639,
342,
313,
842,
1404,
20017,
29897,
13,
4706,
4066,
29901,
6024,
12353,
742,
525,
12353,
2033,
13,
1678,
736,
29901,
13,
4706,
2551,
29901,
1565,
310,
2089,
13,
1678,
14550,
13,
1678,
1018,
29901,
13,
4706,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
9651,
2009,
29889,
1792,
29889,
1639,
342,
353,
2009,
29889,
5438,
1839,
1272,
2033,
13,
9651,
2009,
29889,
1792,
29889,
7620,
580,
13,
9651,
736,
14355,
5103,
3319,
13,
18884,
525,
8698,
2396,
5852,
1800,
13,
4706,
1683,
29901,
13,
9651,
20017,
353,
2009,
29889,
1792,
29889,
1639,
342,
13,
9651,
565,
20017,
1275,
525,
8516,
2396,
13,
18884,
20017,
353,
5159,
13,
9651,
1683,
29901,
13,
18884,
20017,
353,
4390,
29889,
18132,
29898,
1639,
9197,
29897,
1839,
1639,
342,
2033,
13,
9651,
736,
14355,
5103,
3319,
13,
18884,
525,
8698,
2396,
5852,
29892,
13,
18884,
525,
1639,
342,
2396,
20017,
1800,
13,
1678,
5174,
29901,
13,
4706,
9637,
1627,
29889,
2158,
29918,
735,
29883,
580,
13,
4706,
736,
14355,
5103,
3319,
13,
9651,
525,
8698,
2396,
7700,
1800,
13,
13,
5215,
4390,
13,
2541,
1722,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
9464,
29892,
525,
8504,
29914,
1457,
1359,
29914,
720,
414,
29914,
1388,
327,
29884,
29889,
3126,
29915,
4961,
408,
285,
29901,
13,
1678,
1146,
327,
29884,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
13,
1753,
29361,
29898,
3827,
1125,
13,
1678,
14550,
13,
1678,
12354,
847,
1989,
9303,
13,
1678,
14550,
13,
1678,
736,
14355,
5103,
29898,
1388,
327,
29884,
29897,
13,
2
] |
data_utils/split_train_val.py | aman0044/pytorch-classifier | 0 | 44524 | import torch
from torchvision import datasets
import shutil
import argparse
import os
import numpy as np
from tqdm import tqdm
########### Help ###########
'''
#size = (h,w)
python split_train_val.py \
--data_dir /Users/aman.gupta/Documents/self/datasets/blank_page_detection/letterbox_training_data/ \
--val_ratio 0.10 \
--output_dir /Users/aman.gupta/Documents/self/datasets/blank_page_detection/splitted_letterbox_training_data
'''
###########################
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="this script splits classification data into train and val based on ratio provided by user")
parser.add_argument("--data_dir",required = True,help="training data path")
parser.add_argument("--val_ratio",default = 0.2,type = float, help="ratio of val in total data")
parser.add_argument("--output_dir",required=False,default="./data/",type=str,help="dir to save images")
args = parser.parse_args()
os.makedirs(args.output_dir,exist_ok=True)
data = datasets.ImageFolder(args.data_dir)
imgs_info = data.imgs
classes = data.classes
output_folders = ['train','val']
for o_folder in output_folders:
for folder in classes:
os.makedirs(os.path.join(args.output_dir,o_folder,folder),exist_ok=True)
print(f"Total classes:{len(classes)}")
np.random.shuffle(imgs_info)
num_samples = len(imgs_info)
split = int(np.floor(args.val_ratio * num_samples))
train_info, test_info = imgs_info[split:], imgs_info[:split]
print(f"processing train...")
for info in tqdm(train_info):
folder = classes[info[1]]
source = info[0]
file_name = os.path.basename(source)
destination = os.path.join(args.output_dir,output_folders[0],folder,file_name)
shutil.copy(source, destination)
print(f"processing val...")
for info in tqdm(test_info):
folder = classes[info[1]]
source = info[0]
file_name = os.path.basename(source)
destination = os.path.join(args.output_dir,output_folders[1],folder,file_name)
shutil.copy(source, destination)
| [
1,
1053,
4842,
305,
13,
3166,
4842,
305,
4924,
1053,
20035,
13,
5215,
528,
4422,
13,
5215,
1852,
5510,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
7346,
2277,
29937,
22305,
835,
7346,
13,
29871,
13,
12008,
13,
29937,
2311,
29871,
353,
313,
29882,
29892,
29893,
29897,
13,
13,
4691,
6219,
29918,
14968,
29918,
791,
29889,
2272,
320,
13,
1678,
1192,
1272,
29918,
3972,
847,
5959,
29914,
13533,
29889,
2543,
28363,
29914,
20128,
29914,
1311,
29914,
14538,
1691,
29914,
19465,
29918,
3488,
29918,
29881,
2650,
428,
29914,
15670,
1884,
29918,
26495,
29918,
1272,
29914,
320,
13,
1678,
1192,
791,
29918,
3605,
601,
29871,
29900,
29889,
29896,
29900,
320,
13,
1678,
1192,
4905,
29918,
3972,
847,
5959,
29914,
13533,
29889,
2543,
28363,
29914,
20128,
29914,
1311,
29914,
14538,
1691,
29914,
19465,
29918,
3488,
29918,
29881,
2650,
428,
29914,
23579,
4430,
29918,
15670,
1884,
29918,
26495,
29918,
1272,
29871,
13,
13,
12008,
13,
13,
13383,
7346,
2277,
29937,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
1366,
2471,
8536,
1169,
12965,
848,
964,
7945,
322,
659,
2729,
373,
11959,
4944,
491,
1404,
1159,
13,
268,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1272,
29918,
3972,
613,
12403,
353,
5852,
29892,
8477,
543,
26495,
848,
2224,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
791,
29918,
3605,
601,
613,
4381,
353,
29871,
29900,
29889,
29906,
29892,
1853,
353,
5785,
29892,
1371,
543,
3605,
601,
310,
659,
297,
3001,
848,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
4905,
29918,
3972,
613,
12403,
29922,
8824,
29892,
4381,
543,
6904,
1272,
29914,
613,
1853,
29922,
710,
29892,
8477,
543,
3972,
304,
4078,
4558,
1159,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
28997,
29918,
554,
29922,
5574,
29897,
13,
13,
13,
1678,
848,
353,
20035,
29889,
2940,
12924,
29898,
5085,
29889,
1272,
29918,
3972,
29897,
13,
1678,
527,
3174,
29918,
3888,
353,
848,
29889,
2492,
29879,
13,
1678,
4413,
353,
848,
29889,
13203,
13,
13,
1678,
1962,
29918,
8771,
414,
353,
6024,
14968,
3788,
791,
2033,
13,
1678,
363,
288,
29918,
12083,
297,
1962,
29918,
8771,
414,
29901,
13,
4706,
363,
4138,
297,
4413,
29901,
13,
9651,
2897,
29889,
29885,
12535,
12935,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
29877,
29918,
12083,
29892,
12083,
511,
28997,
29918,
554,
29922,
5574,
29897,
13,
13,
1678,
1596,
29898,
29888,
29908,
11536,
4413,
26254,
2435,
29898,
13203,
2915,
1159,
13,
268,
13,
1678,
7442,
29889,
8172,
29889,
845,
21897,
29898,
2492,
29879,
29918,
3888,
29897,
13,
268,
13,
1678,
954,
29918,
27736,
353,
7431,
29898,
2492,
29879,
29918,
3888,
29897,
13,
1678,
6219,
353,
938,
29898,
9302,
29889,
14939,
29898,
5085,
29889,
791,
29918,
3605,
601,
334,
954,
29918,
27736,
876,
13,
1678,
7945,
29918,
3888,
29892,
1243,
29918,
3888,
353,
527,
3174,
29918,
3888,
29961,
5451,
29901,
1402,
527,
3174,
29918,
3888,
7503,
5451,
29962,
13,
13,
1678,
1596,
29898,
29888,
29908,
19170,
7945,
856,
1159,
13,
13,
1678,
363,
5235,
297,
260,
29939,
18933,
29898,
14968,
29918,
3888,
1125,
13,
4706,
4138,
353,
4413,
29961,
3888,
29961,
29896,
5262,
13,
4706,
2752,
353,
5235,
29961,
29900,
29962,
13,
4706,
934,
29918,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
4993,
29897,
13,
4706,
12551,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
4905,
29918,
8771,
414,
29961,
29900,
1402,
12083,
29892,
1445,
29918,
978,
29897,
13,
4706,
528,
4422,
29889,
8552,
29898,
4993,
29892,
12551,
29897,
13,
268,
13,
1678,
1596,
29898,
29888,
29908,
19170,
659,
856,
1159,
13,
13,
1678,
363,
5235,
297,
260,
29939,
18933,
29898,
1688,
29918,
3888,
1125,
13,
4706,
4138,
353,
4413,
29961,
3888,
29961,
29896,
5262,
13,
4706,
2752,
353,
5235,
29961,
29900,
29962,
13,
4706,
934,
29918,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
4993,
29897,
13,
4706,
12551,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
3972,
29892,
4905,
29918,
8771,
414,
29961,
29896,
1402,
12083,
29892,
1445,
29918,
978,
29897,
13,
4706,
528,
4422,
29889,
8552,
29898,
4993,
29892,
12551,
29897,
13,
13,
13,
13,
13,
268,
13,
2
] |
custom_components/yoosee/const.py | shaonianzhentan/ha_yoosee_camera | 0 | 31054 | DOMAIN = "yoosee"
PLATFORMS = ["camera"]
DEFAULT_NAME = "Yoosee摄像头"
VERSION = "1.1"
SERVICE_PTZ = 'ptz' | [
1,
11662,
29032,
353,
376,
9029,
852,
29872,
29908,
13,
7390,
1299,
22051,
4345,
353,
6796,
26065,
3108,
13,
23397,
29918,
5813,
353,
376,
29979,
29877,
852,
29872,
233,
148,
135,
31551,
31584,
29908,
13,
16358,
353,
376,
29896,
29889,
29896,
29908,
13,
6304,
19059,
29918,
7982,
29999,
353,
525,
415,
29920,
29915,
2
] |
src/apps/devices/cubelib/emulator.py | ajintom/music_sync | 0 | 19048 | #!/bin/env python
#using the wireframe module downloaded from http://www.petercollingridge.co.uk/
import mywireframe as wireframe
import pygame
from pygame import display
from pygame.draw import *
import time
import numpy
key_to_function = {
pygame.K_LEFT: (lambda x: x.translateAll('x', -10)),
pygame.K_RIGHT: (lambda x: x.translateAll('x', 10)),
pygame.K_DOWN: (lambda x: x.translateAll('y', 10)),
pygame.K_UP: (lambda x: x.translateAll('y', -10)),
pygame.K_EQUALS: (lambda x: x.scaleAll(1.25)),
pygame.K_MINUS: (lambda x: x.scaleAll( 0.8)),
pygame.K_q: (lambda x: x.rotateAll('X', 0.1)),
pygame.K_w: (lambda x: x.rotateAll('X', -0.1)),
pygame.K_a: (lambda x: x.rotateAll('Y', 0.1)),
pygame.K_s: (lambda x: x.rotateAll('Y', -0.1)),
pygame.K_z: (lambda x: x.rotateAll('Z', 0.1)),
pygame.K_x: (lambda x: x.rotateAll('Z', -0.1))}
class ProjectionViewer:
""" Displays 3D objects on a Pygame screen """
def __init__(self, width, height):
self.width = width
self.height = height
self.screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Wireframe Display')
self.background = (10,10,50)
self.wireframes = {}
self.displayNodes = True
self.displayEdges = True
self.nodeColour = (255,255,255)
self.edgeColour = (200,200,200)
self.nodeRadius = 3 #Modify to change size of the spheres
def addWireframe(self, name, wireframe):
""" Add a named wireframe object. """
self.wireframes[name] = wireframe
def run(self):
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key in key_to_function:
key_to_function[event.key](self)
self.display()
pygame.display.flip()
def display(self):
""" Draw the wireframes on the screen. """
self.screen.fill(self.background)
for wireframe in self.wireframes.values():
if self.displayEdges:
for edge in wireframe.edges:
pygame.draw.aaline(self.screen, self.edgeColour, (edge.start.x, edge.start.y), (edge.stop.x, edge.stop.y), 1)
if self.displayNodes:
for node in wireframe.nodes:
if node.visiblity:
pygame.draw.circle(self.screen, self.nodeColour, (int(node.x), int(node.y)), self.nodeRadius, 0)
def translateAll(self, axis, d):
""" Translate all wireframes along a given axis by d units. """
for wireframe in self.wireframes.itervalues():
wireframe.translate(axis, d)
def scaleAll(self, scale):
""" Scale all wireframes by a given scale, centred on the centre of the screen. """
centre_x = self.width/2
centre_y = self.height/2
for wireframe in self.wireframes.itervalues():
wireframe.scale((centre_x, centre_y), scale)
def rotateAll(self, axis, theta):
""" Rotate all wireframe about their centre, along a given axis by a given angle. """
rotateFunction = 'rotate' + axis
for wireframe in self.wireframes.itervalues():
centre = wireframe.findCentre()
getattr(wireframe, rotateFunction)(centre, theta)
def createCube(self,cube,X=[50,140], Y=[50,140], Z=[50,140]):
cube.addNodes([(x,y,z) for x in X for y in Y for z in Z]) #adding the nodes of the cube framework.
allnodes = []
cube.addEdges([(n,n+4) for n in range(0,4)]+[(n,n+1) for n in range(0,8,2)]+[(n,n+2) for n in (0,1,4,5)]) #creating edges of the cube framework.
for i in range(0,10):
for j in range(0,10):
for k in range(0,10):
allnodes.append((X[0]+(X[1]-X[0])/9 * i,Y[0]+(Y[1] - Y[0])/9 * j,Z[0] + (Z[1]-Z[0])/9 * k))
cube.addNodes(allnodes)
#cube.outputNodes()
self.addWireframe('cube',cube)
def findIndex(coords): #Send coordinates of the points you want lit up. Will convert to neede
indices = []
for nodes in coords:
x,y,z = nodes
index = x*100+y*10+z + 8
indices.append(index)
return indices
def findIndexArray(array): #Takes a 3-D numpy array containing bool of all the LED points.
indices = []
for i in range(0,10):
for j in range(0,10):
for k in range(0,10):
if(array[i][j][k] == 1):
index = i*100+j*10+ k + 8
indices.append(index)
return indices
def wireframecube(size):
if size % 2 == 1:
size = size+1
half = size/2
start = 5 - half
end = 5 + half - 1
cubecords = [(x,y,z) for x in (start,end) for y in (start,end) for z in range(start,end+1)]+[(x,z,y) for x in (start,end) for y in (start,end) for z in range(start,end+1)] + [(z,y,x) for x in (start,end) for y in (start,end) for z in range(start,end+1)]
return cubecords
def cubes(size):
if size % 2 == 1:
size = size+1
half = size/2
cubecords = []
for i in range(0,size):
for j in range(0,size):
for k in range(0,size):
cubecords.append((5-half+i,5-half+j,5-half+k))
return cubecords
if __name__ == '__main__':
pv = ProjectionViewer(400, 300)
allnodes =[]
cube = wireframe.Wireframe() #storing all the nodes in this wireframe object.
X = [50,140]
Y = [50,140]
Z = [50,140]
pv.createCube(cube,X,Y,Z)
YZface = findIndex((0,y,z) for y in range(0,10) for z in range(0,10))
count = 0
for k in range(1,150000):
if k%5000 ==2500:
count = (count+2)%11
cube.setVisible(findIndex(wireframecube(count)))
pv.run()
| [
1,
18787,
2109,
29914,
6272,
3017,
13,
29937,
4746,
278,
8014,
2557,
3883,
16532,
515,
1732,
597,
1636,
29889,
29886,
1308,
1054,
1847,
8605,
29889,
1111,
29889,
2679,
29914,
13,
5215,
590,
22376,
2557,
408,
8014,
2557,
13,
5215,
22028,
13,
3166,
22028,
1053,
2479,
13,
3166,
22028,
29889,
4012,
1053,
334,
13,
5215,
931,
13,
5215,
12655,
13,
13,
1989,
29918,
517,
29918,
2220,
353,
426,
13,
1678,
22028,
29889,
29968,
29918,
28024,
29901,
259,
313,
2892,
921,
29901,
921,
29889,
21652,
3596,
877,
29916,
742,
448,
29896,
29900,
8243,
13,
1678,
22028,
29889,
29968,
29918,
22789,
3912,
29901,
29871,
313,
2892,
921,
29901,
921,
29889,
21652,
3596,
877,
29916,
742,
259,
29896,
29900,
8243,
13,
1678,
22028,
29889,
29968,
29918,
3970,
16048,
29901,
259,
313,
2892,
921,
29901,
921,
29889,
21652,
3596,
877,
29891,
742,
259,
29896,
29900,
8243,
13,
1678,
22028,
29889,
29968,
29918,
4897,
29901,
268,
313,
2892,
921,
29901,
921,
29889,
21652,
3596,
877,
29891,
742,
448,
29896,
29900,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29923,
13356,
1964,
29903,
29901,
313,
2892,
921,
29901,
921,
29889,
7052,
3596,
29898,
29896,
29889,
29906,
29945,
8243,
13,
1678,
22028,
29889,
29968,
29918,
16173,
3308,
29901,
29871,
313,
2892,
921,
29901,
921,
29889,
7052,
3596,
29898,
29871,
29900,
29889,
29947,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29939,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29990,
742,
259,
29900,
29889,
29896,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29893,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29990,
742,
448,
29900,
29889,
29896,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29874,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29979,
742,
259,
29900,
29889,
29896,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29879,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29979,
742,
448,
29900,
29889,
29896,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29920,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29999,
742,
259,
29900,
29889,
29896,
8243,
13,
1678,
22028,
29889,
29968,
29918,
29916,
29901,
418,
313,
2892,
921,
29901,
921,
29889,
23361,
3596,
877,
29999,
742,
448,
29900,
29889,
29896,
876,
29913,
13,
13,
1990,
1019,
6929,
29963,
15580,
29901,
13,
1678,
9995,
3295,
12922,
29871,
29941,
29928,
3618,
373,
263,
349,
4790,
420,
4315,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2920,
29892,
3171,
1125,
13,
4706,
1583,
29889,
2103,
353,
2920,
13,
4706,
1583,
29889,
3545,
353,
3171,
13,
4706,
1583,
29889,
10525,
353,
22028,
29889,
4990,
29889,
842,
29918,
8513,
3552,
2103,
29892,
3171,
876,
13,
4706,
22028,
29889,
4990,
29889,
842,
29918,
6671,
877,
29956,
533,
2557,
17440,
1495,
13,
4706,
1583,
29889,
7042,
353,
313,
29896,
29900,
29892,
29896,
29900,
29892,
29945,
29900,
29897,
13,
13,
4706,
1583,
29889,
22376,
19935,
353,
6571,
13,
4706,
1583,
29889,
4990,
20284,
353,
5852,
13,
4706,
1583,
29889,
4990,
3853,
2710,
353,
5852,
13,
4706,
1583,
29889,
3177,
1625,
473,
353,
313,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29897,
13,
4706,
1583,
29889,
12864,
1625,
473,
353,
313,
29906,
29900,
29900,
29892,
29906,
29900,
29900,
29892,
29906,
29900,
29900,
29897,
13,
4706,
1583,
29889,
3177,
20494,
353,
29871,
29941,
29871,
396,
2111,
1598,
304,
1735,
2159,
310,
278,
26903,
267,
13,
13,
1678,
822,
788,
29956,
533,
2557,
29898,
1311,
29892,
1024,
29892,
8014,
2557,
1125,
13,
4706,
9995,
3462,
263,
4257,
8014,
2557,
1203,
29889,
9995,
13,
13,
4706,
1583,
29889,
22376,
19935,
29961,
978,
29962,
353,
8014,
2557,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
1678,
13,
4706,
363,
1741,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
12,
12,
361,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
29901,
13,
308,
12,
12,
361,
1741,
29889,
1989,
297,
1820,
29918,
517,
29918,
2220,
29901,
13,
462,
12,
12,
1989,
29918,
517,
29918,
2220,
29961,
3696,
29889,
1989,
850,
1311,
29897,
13,
13,
4706,
1583,
29889,
4990,
580,
13,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
308,
13,
1678,
822,
2479,
29898,
1311,
1125,
13,
4706,
9995,
18492,
278,
8014,
19935,
373,
278,
4315,
29889,
9995,
13,
13,
4706,
1583,
29889,
10525,
29889,
5589,
29898,
1311,
29889,
7042,
29897,
13,
13,
4706,
363,
8014,
2557,
297,
1583,
29889,
22376,
19935,
29889,
5975,
7295,
13,
9651,
565,
1583,
29889,
4990,
3853,
2710,
29901,
13,
18884,
363,
7636,
297,
8014,
2557,
29889,
287,
2710,
29901,
13,
462,
1678,
22028,
29889,
4012,
29889,
16113,
457,
29898,
1311,
29889,
10525,
29892,
1583,
29889,
12864,
1625,
473,
29892,
313,
12864,
29889,
2962,
29889,
29916,
29892,
7636,
29889,
2962,
29889,
29891,
511,
313,
12864,
29889,
9847,
29889,
29916,
29892,
7636,
29889,
9847,
29889,
29891,
511,
29871,
29896,
29897,
13,
13,
9651,
565,
1583,
29889,
4990,
20284,
29901,
13,
18884,
363,
2943,
297,
8014,
2557,
29889,
18010,
29901,
13,
462,
1678,
565,
2943,
29889,
1730,
747,
29880,
537,
29901,
13,
462,
965,
22028,
29889,
4012,
29889,
16622,
29898,
1311,
29889,
10525,
29892,
1583,
29889,
3177,
1625,
473,
29892,
313,
524,
29898,
3177,
29889,
29916,
511,
938,
29898,
3177,
29889,
29891,
8243,
1583,
29889,
3177,
20494,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
14240,
3596,
29898,
1311,
29892,
9685,
29892,
270,
1125,
13,
4706,
9995,
4103,
9632,
599,
8014,
19935,
3412,
263,
2183,
9685,
491,
270,
10340,
29889,
9995,
13,
13,
4706,
363,
8014,
2557,
297,
1583,
29889,
22376,
19935,
29889,
1524,
5975,
7295,
13,
9651,
8014,
2557,
29889,
21652,
29898,
8990,
29892,
270,
29897,
13,
13,
1678,
822,
6287,
3596,
29898,
1311,
29892,
6287,
1125,
13,
4706,
9995,
2522,
744,
599,
8014,
19935,
491,
263,
2183,
6287,
29892,
1644,
1127,
373,
278,
8442,
310,
278,
4315,
29889,
9995,
13,
13,
4706,
8442,
29918,
29916,
353,
1583,
29889,
2103,
29914,
29906,
13,
4706,
8442,
29918,
29891,
353,
1583,
29889,
3545,
29914,
29906,
13,
13,
4706,
363,
8014,
2557,
297,
1583,
29889,
22376,
19935,
29889,
1524,
5975,
7295,
13,
9651,
8014,
2557,
29889,
7052,
3552,
1760,
276,
29918,
29916,
29892,
8442,
29918,
29891,
511,
6287,
29897,
13,
13,
1678,
822,
16734,
3596,
29898,
1311,
29892,
9685,
29892,
278,
941,
1125,
13,
4706,
9995,
9664,
403,
599,
8014,
2557,
1048,
1009,
8442,
29892,
3412,
263,
2183,
9685,
491,
263,
2183,
10696,
29889,
9995,
13,
13,
4706,
16734,
6678,
353,
525,
23361,
29915,
718,
9685,
13,
13,
4706,
363,
8014,
2557,
297,
1583,
29889,
22376,
19935,
29889,
1524,
5975,
7295,
13,
9651,
8442,
353,
8014,
2557,
29889,
2886,
29907,
14056,
580,
13,
9651,
679,
5552,
29898,
22376,
2557,
29892,
16734,
6678,
5033,
1760,
276,
29892,
278,
941,
29897,
13,
268,
13,
1678,
822,
1653,
29907,
4003,
29898,
1311,
29892,
29883,
4003,
29892,
29990,
11759,
29945,
29900,
29892,
29896,
29946,
29900,
1402,
612,
11759,
29945,
29900,
29892,
29896,
29946,
29900,
1402,
796,
11759,
29945,
29900,
29892,
29896,
29946,
29900,
29962,
1125,
13,
4706,
28704,
29889,
1202,
20284,
4197,
29898,
29916,
29892,
29891,
29892,
29920,
29897,
363,
921,
297,
1060,
363,
343,
297,
612,
363,
503,
297,
796,
2314,
396,
4676,
278,
7573,
310,
278,
28704,
6890,
29889,
29871,
13,
4706,
599,
18010,
353,
5159,
13,
268,
12,
29883,
4003,
29889,
1202,
3853,
2710,
4197,
29898,
29876,
29892,
29876,
29974,
29946,
29897,
363,
302,
297,
3464,
29898,
29900,
29892,
29946,
4638,
29974,
15625,
29876,
29892,
29876,
29974,
29896,
29897,
363,
302,
297,
3464,
29898,
29900,
29892,
29947,
29892,
29906,
4638,
29974,
15625,
29876,
29892,
29876,
29974,
29906,
29897,
363,
302,
297,
313,
29900,
29892,
29896,
29892,
29946,
29892,
29945,
29897,
2314,
396,
1037,
1218,
12770,
310,
278,
28704,
6890,
29889,
13,
268,
12,
1454,
474,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
308,
12,
1454,
432,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
462,
12,
1454,
413,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
462,
308,
12,
497,
18010,
29889,
4397,
3552,
29990,
29961,
29900,
10062,
29898,
29990,
29961,
29896,
29962,
29899,
29990,
29961,
29900,
2314,
29914,
29929,
334,
474,
29892,
29979,
29961,
29900,
10062,
29898,
29979,
29961,
29896,
29962,
448,
612,
29961,
29900,
2314,
29914,
29929,
334,
432,
29892,
29999,
29961,
29900,
29962,
718,
313,
29999,
29961,
29896,
29962,
29899,
29999,
29961,
29900,
2314,
29914,
29929,
334,
413,
876,
13,
13,
268,
12,
29883,
4003,
29889,
1202,
20284,
29898,
497,
18010,
29897,
13,
268,
12,
29937,
29883,
4003,
29889,
4905,
20284,
580,
13,
268,
12,
1311,
29889,
1202,
29956,
533,
2557,
877,
29883,
4003,
742,
29883,
4003,
29897,
13,
13,
13,
13,
1753,
1284,
3220,
29898,
1111,
4339,
1125,
396,
12600,
10350,
310,
278,
3291,
366,
864,
11872,
701,
29889,
2811,
3588,
304,
817,
29872,
29871,
13,
13,
12,
513,
1575,
353,
5159,
13,
12,
1454,
7573,
297,
1302,
4339,
29901,
13,
12,
12,
29916,
29892,
29891,
29892,
29920,
353,
7573,
13,
12,
12,
2248,
353,
921,
29930,
29896,
29900,
29900,
29974,
29891,
29930,
29896,
29900,
29974,
29920,
718,
29871,
29947,
13,
12,
12,
513,
1575,
29889,
4397,
29898,
2248,
29897,
13,
12,
2457,
16285,
13,
13,
1753,
1284,
3220,
2588,
29898,
2378,
1125,
396,
29911,
6926,
263,
29871,
29941,
29899,
29928,
12655,
1409,
6943,
6120,
310,
599,
278,
25023,
3291,
29889,
13,
13,
12,
513,
1575,
353,
5159,
13,
12,
1454,
474,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
12,
12,
1454,
432,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
12,
12,
12,
1454,
413,
297,
3464,
29898,
29900,
29892,
29896,
29900,
1125,
13,
12,
12,
12,
12,
361,
29898,
2378,
29961,
29875,
3816,
29926,
3816,
29895,
29962,
1275,
29871,
29896,
1125,
13,
12,
12,
12,
12,
12,
2248,
353,
474,
29930,
29896,
29900,
29900,
29974,
29926,
29930,
29896,
29900,
29974,
413,
718,
29871,
29947,
13,
12,
12,
12,
12,
12,
513,
1575,
29889,
4397,
29898,
2248,
29897,
13,
12,
2457,
16285,
13,
13,
13,
1753,
8014,
2557,
29883,
4003,
29898,
2311,
1125,
13,
12,
361,
2159,
1273,
29871,
29906,
1275,
29871,
29896,
29901,
13,
12,
12,
2311,
353,
2159,
29974,
29896,
13,
12,
24498,
353,
2159,
29914,
29906,
13,
12,
2962,
353,
29871,
29945,
448,
4203,
13,
12,
355,
353,
29871,
29945,
718,
4203,
448,
29871,
29896,
13,
12,
29883,
431,
687,
4339,
353,
17288,
29916,
29892,
29891,
29892,
29920,
29897,
363,
921,
297,
313,
2962,
29892,
355,
29897,
363,
343,
297,
313,
2962,
29892,
355,
29897,
363,
503,
297,
3464,
29898,
2962,
29892,
355,
29974,
29896,
4638,
29974,
15625,
29916,
29892,
29920,
29892,
29891,
29897,
363,
921,
297,
313,
2962,
29892,
355,
29897,
363,
343,
297,
313,
2962,
29892,
355,
29897,
363,
503,
297,
3464,
29898,
2962,
29892,
355,
29974,
29896,
4638,
718,
17288,
29920,
29892,
29891,
29892,
29916,
29897,
363,
921,
297,
313,
2962,
29892,
355,
29897,
363,
343,
297,
313,
2962,
29892,
355,
29897,
363,
503,
297,
3464,
29898,
2962,
29892,
355,
29974,
29896,
4638,
13,
12,
2457,
13630,
687,
4339,
13,
13,
1753,
13630,
267,
29898,
2311,
1125,
13,
12,
361,
2159,
1273,
29871,
29906,
1275,
29871,
29896,
29901,
13,
12,
12,
2311,
353,
2159,
29974,
29896,
13,
12,
24498,
353,
2159,
29914,
29906,
13,
12,
29883,
431,
687,
4339,
353,
5159,
13,
12,
1454,
474,
297,
3464,
29898,
29900,
29892,
2311,
1125,
13,
12,
12,
1454,
432,
297,
3464,
29898,
29900,
29892,
2311,
1125,
13,
12,
12,
12,
1454,
413,
297,
3464,
29898,
29900,
29892,
2311,
1125,
13,
12,
12,
12,
12,
29883,
431,
687,
4339,
29889,
4397,
3552,
29945,
29899,
24498,
29974,
29875,
29892,
29945,
29899,
24498,
29974,
29926,
29892,
29945,
29899,
24498,
29974,
29895,
876,
12,
13,
12,
2457,
13630,
687,
4339,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
268,
13,
1678,
282,
29894,
353,
1019,
6929,
29963,
15580,
29898,
29946,
29900,
29900,
29892,
29871,
29941,
29900,
29900,
29897,
13,
1678,
599,
18010,
353,
2636,
13,
1678,
28704,
353,
8014,
2557,
29889,
29956,
533,
2557,
580,
396,
303,
8253,
599,
278,
7573,
297,
445,
8014,
2557,
1203,
29889,
13,
1678,
1060,
353,
518,
29945,
29900,
29892,
29896,
29946,
29900,
29962,
13,
1678,
612,
353,
518,
29945,
29900,
29892,
29896,
29946,
29900,
29962,
13,
1678,
796,
353,
518,
29945,
29900,
29892,
29896,
29946,
29900,
29962,
29871,
13,
1678,
282,
29894,
29889,
3258,
29907,
4003,
29898,
29883,
4003,
29892,
29990,
29892,
29979,
29892,
29999,
29897,
13,
1678,
612,
29999,
2161,
353,
1284,
3220,
3552,
29900,
29892,
29891,
29892,
29920,
29897,
363,
343,
297,
3464,
29898,
29900,
29892,
29896,
29900,
29897,
363,
503,
297,
3464,
29898,
29900,
29892,
29896,
29900,
876,
29871,
13,
1678,
2302,
353,
29871,
29900,
29871,
13,
1678,
363,
413,
297,
3464,
29898,
29896,
29892,
29896,
29945,
29900,
29900,
29900,
29900,
1125,
13,
12,
361,
413,
29995,
29945,
29900,
29900,
29900,
1275,
29906,
29945,
29900,
29900,
29901,
13,
12,
12,
2798,
353,
313,
2798,
29974,
29906,
29897,
29995,
29896,
29896,
462,
308,
13,
12,
12,
29883,
4003,
29889,
842,
12911,
29898,
2886,
3220,
29898,
22376,
2557,
29883,
4003,
29898,
2798,
4961,
13,
12,
29886,
29894,
29889,
3389,
580,
13,
12,
12,
13,
2
] |
xbbo/search_algorithm/multi_fidelity/BOHB.py | zhanglei1172/XBBO | 0 | 79643 | <reponame>zhanglei1172/XBBO<gh_stars>0
'''
Reference: https://github.com/automl/DEHB
'''
from typing import List
import numpy as np
# from xbbo.configspace.feature_space import Uniform2Gaussian
from xbbo.search_algorithm.multi_fidelity.hyperband import HB
from xbbo.configspace.space import DenseConfiguration, DenseConfigurationSpace
from xbbo.core.trials import Trials, Trial
from xbbo.search_algorithm.multi_fidelity.utils.bracket_manager import BasicConfigGenerator
from xbbo.search_algorithm.tpe_optimizer import TPE
from xbbo.search_algorithm.bo_optimizer import BO
from xbbo.utils.constants import MAXINT, Key
from .. import alg_register
class BOHB_CG_TPE(BasicConfigGenerator, TPE):
def __init__(self, cs, budget, max_pop_size, rng, **kwargs) -> None:
BasicConfigGenerator.__init__(self, cs, budget, max_pop_size, rng, **kwargs)
TPE.__init__(self, space=cs, **kwargs)
self.reset(max_pop_size)
class BOHB_CG(BasicConfigGenerator, BO):
def __init__(self, cs, budget, max_pop_size, rng, **kwargs) -> None:
BasicConfigGenerator.__init__(self, cs, budget, max_pop_size, rng, **kwargs)
BO.__init__(self, space=cs, **kwargs)
self.reset(max_pop_size)
@property
def kde_models(self):
return (self.trials.trials_num) >= self.min_sample
alg_marker = 'bohb'
@alg_register.register(alg_marker)
class BOHB(HB):
name = alg_marker
def __init__(self,
space: DenseConfigurationSpace,
budget_bound=[9, 729],
# mutation_factor=0.5,
# crossover_prob=0.5,
# strategy='rand1_bin',
eta: int = 3,
seed: int = 42,
round_limit: int = 1,
bracket_limit=np.inf,
bo_opt_name='prf',
boundary_fix_type='random',
**kwargs):
self.bo_opt_name = bo_opt_name
HB.__init__(self,
space,
budget_bound,
eta,
seed=seed,
round_limit=round_limit,
bracket_limit=bracket_limit,
boundary_fix_type=boundary_fix_type,
**kwargs)
# Uniform2Gaussian.__init__(self,)
# self._get_max_pop_sizes()
# self._init_subpop(**kwargs)
def _init_subpop(self, **kwargs):
""" List of DE objects corresponding to the budgets (fidelities)
"""
self.cg = {}
for i, b in enumerate(self._max_pop_size.keys()):
if self.bo_opt_name.upper() == 'TPE':
self.cg[b] = BOHB_CG_TPE(
self.space,
seed=self.rng.randint(MAXINT),
initial_design="random",
init_budget=0,
budget=b,
max_pop_size=self._max_pop_size[b],
rng=self.rng,
**kwargs)
else:
self.cg[b] = BOHB_CG(
self.space,
seed=self.rng.randint(MAXINT),
initial_design="random",
init_budget=0,
budget=b,
max_pop_size=self._max_pop_size[b],
rng=self.rng,
surrogate=self.bo_opt_name,
**kwargs)
# self.cg[b] = TPE(
# self.space,
# seed=self.rng.randint(MAXINT),
# initial_design="random",
# init_budget=0,
# **kwargs)
# self.cg[b].population = [None] * self._max_pop_size[b]
# self.cg[b].population_fitness = [np.inf] * self._max_pop_size[b]
def _acquire_candidate(self, bracket, budget):
""" Generates/chooses a configuration based on the budget and iteration number
"""
# select a parent/target
# select a parent/target
parent_id = self._get_next_idx_for_subpop(budget, bracket)
if budget != bracket.budgets[0]:
if bracket.is_new_rung():
# TODO: check if generalizes to all budget spacings
lower_budget, num_configs = bracket.get_lower_budget_promotions(
budget)
self._get_promotion_candidate(lower_budget, budget,
num_configs)
# else: # 每一列中的第一行,随机生成config
else:
if bracket.is_new_rung():
lower_budget, num_configs = bracket.get_lower_budget_promotions(
budget)
self.cg[budget].population_fitness[:] = np.inf
for b in reversed(self.budgets):
if self.cg[b].kde_models:
break
# trial = self.cg[b]._suggest()[0]
trials = self.cg[b]._suggest(1)
for i in range(len(trials)):
self.cg[budget].population[parent_id+i] = trials[i].array
# self.cg[budget].population[parent_id] = trial.array
# parent_id = self._get_next_idx_for_subpop(budget, bracket)
target = self.cg[budget].population[parent_id]
# target = self.fix_boundary(target)
return target, parent_id
def _observe(self, trial_list):
for trial in trial_list:
self.trials.add_a_trial(trial, True)
fitness = trial.observe_value
job_info = trial.info
# learner_train_time = job_info.get(Key.EVAL_TIME, 0)
budget = job_info[Key.BUDGET]
parent_id = job_info['parent_id']
individual = trial.array # TODO
for bracket in self.active_brackets:
if bracket.bracket_id == job_info['bracket_id']:
# registering is IMPORTANT for Bracket Manager to perform SH
bracket.register_job(budget) # may be new row
# bracket job complete
bracket.complete_job(
budget) # IMPORTANT to perform synchronous SH
self.cg[budget].population[parent_id] = individual
self.cg[budget].population_fitness[parent_id] = fitness
# updating incumbents
if fitness < self.current_best_fitness:
self.current_best = individual
self.current_best_fitness = trial.observe_value
self.current_best_trial = trial
# for rung in range(bracket.n_rungs-1, bracket.current_rung, -1):
# if self.cg[bracket.budgets[rung]].kde_models:
# break
# else:
self.cg[budget]._observe([trial])
self._clean_inactive_brackets()
opt_class = BOHB
| [
1,
529,
276,
1112,
420,
29958,
17599,
2521,
29875,
29896,
29896,
29955,
29906,
29914,
29990,
29933,
8456,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
12008,
13,
7422,
29901,
2045,
597,
3292,
29889,
510,
29914,
17405,
29880,
29914,
2287,
29950,
29933,
13,
12008,
13,
13,
3166,
19229,
1053,
2391,
13,
5215,
12655,
408,
7442,
13,
13,
29937,
515,
921,
29890,
833,
29889,
2917,
3493,
29889,
14394,
29918,
3493,
1053,
853,
5560,
29906,
29954,
17019,
13,
3166,
921,
29890,
833,
29889,
4478,
29918,
20567,
29889,
9910,
29918,
29888,
10652,
537,
29889,
24947,
4980,
1053,
379,
29933,
13,
3166,
921,
29890,
833,
29889,
2917,
3493,
29889,
3493,
1053,
360,
1947,
8614,
29892,
360,
1947,
8614,
14936,
13,
3166,
921,
29890,
833,
29889,
3221,
29889,
3626,
1338,
1053,
8602,
1338,
29892,
8602,
284,
13,
3166,
921,
29890,
833,
29889,
4478,
29918,
20567,
29889,
9910,
29918,
29888,
10652,
537,
29889,
13239,
29889,
2634,
3522,
29918,
12847,
1053,
19219,
3991,
21575,
13,
3166,
921,
29890,
833,
29889,
4478,
29918,
20567,
29889,
29873,
412,
29918,
20640,
3950,
1053,
323,
4162,
13,
3166,
921,
29890,
833,
29889,
4478,
29918,
20567,
29889,
833,
29918,
20640,
3950,
1053,
16437,
13,
3166,
921,
29890,
833,
29889,
13239,
29889,
3075,
1934,
1053,
18134,
10192,
29892,
7670,
13,
3166,
6317,
1053,
3093,
29918,
9573,
13,
13,
1990,
16437,
29950,
29933,
29918,
11135,
29918,
3557,
29923,
29898,
16616,
3991,
21575,
29892,
323,
4162,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5939,
29892,
23562,
29892,
4236,
29918,
7323,
29918,
2311,
29892,
364,
865,
29892,
3579,
19290,
29897,
1599,
6213,
29901,
13,
4706,
19219,
3991,
21575,
17255,
2344,
12035,
1311,
29892,
5939,
29892,
23562,
29892,
4236,
29918,
7323,
29918,
2311,
29892,
364,
865,
29892,
3579,
19290,
29897,
13,
4706,
323,
4162,
17255,
2344,
12035,
1311,
29892,
2913,
29922,
2395,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
12071,
29898,
3317,
29918,
7323,
29918,
2311,
29897,
13,
308,
13,
1990,
16437,
29950,
29933,
29918,
11135,
29898,
16616,
3991,
21575,
29892,
16437,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5939,
29892,
23562,
29892,
4236,
29918,
7323,
29918,
2311,
29892,
364,
865,
29892,
3579,
19290,
29897,
1599,
6213,
29901,
13,
4706,
19219,
3991,
21575,
17255,
2344,
12035,
1311,
29892,
5939,
29892,
23562,
29892,
4236,
29918,
7323,
29918,
2311,
29892,
364,
865,
29892,
3579,
19290,
29897,
13,
4706,
16437,
17255,
2344,
12035,
1311,
29892,
2913,
29922,
2395,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
12071,
29898,
3317,
29918,
7323,
29918,
2311,
29897,
13,
268,
13,
1678,
732,
6799,
13,
1678,
822,
26109,
29918,
9794,
29898,
1311,
1125,
13,
4706,
736,
313,
1311,
29889,
3626,
1338,
29889,
3626,
1338,
29918,
1949,
29897,
6736,
1583,
29889,
1195,
29918,
11249,
13,
13,
9564,
29918,
22976,
353,
525,
833,
29882,
29890,
29915,
13,
13,
29992,
9564,
29918,
9573,
29889,
9573,
29898,
9564,
29918,
22976,
29897,
13,
1990,
16437,
29950,
29933,
29898,
29950,
29933,
1125,
13,
1678,
1024,
353,
3093,
29918,
22976,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
2913,
29901,
360,
1947,
8614,
14936,
29892,
13,
462,
23562,
29918,
9917,
11759,
29929,
29892,
29871,
29955,
29906,
29929,
1402,
13,
18884,
396,
29871,
5478,
362,
29918,
19790,
29922,
29900,
29889,
29945,
29892,
13,
18884,
396,
29871,
274,
1883,
578,
369,
29918,
22795,
29922,
29900,
29889,
29945,
29892,
13,
18884,
396,
29871,
13705,
2433,
9502,
29896,
29918,
2109,
742,
13,
462,
634,
29874,
29901,
938,
353,
29871,
29941,
29892,
13,
462,
16717,
29901,
938,
353,
29871,
29946,
29906,
29892,
13,
462,
4513,
29918,
13400,
29901,
938,
353,
29871,
29896,
29892,
13,
462,
4105,
3522,
29918,
13400,
29922,
9302,
29889,
7192,
29892,
13,
462,
1045,
29918,
3670,
29918,
978,
2433,
558,
29888,
742,
13,
462,
10452,
29918,
5878,
29918,
1853,
2433,
8172,
742,
13,
462,
3579,
19290,
1125,
13,
4706,
1583,
29889,
833,
29918,
3670,
29918,
978,
353,
1045,
29918,
3670,
29918,
978,
13,
4706,
379,
29933,
17255,
2344,
12035,
1311,
29892,
13,
462,
1678,
2913,
29892,
13,
462,
1678,
23562,
29918,
9917,
29892,
13,
462,
1678,
634,
29874,
29892,
13,
462,
1678,
16717,
29922,
26776,
29892,
13,
462,
1678,
4513,
29918,
13400,
29922,
14486,
29918,
13400,
29892,
13,
462,
1678,
4105,
3522,
29918,
13400,
29922,
2634,
3522,
29918,
13400,
29892,
13,
462,
1678,
10452,
29918,
5878,
29918,
1853,
29922,
9917,
653,
29918,
5878,
29918,
1853,
29892,
13,
462,
1678,
3579,
19290,
29897,
13,
4706,
396,
853,
5560,
29906,
29954,
17019,
17255,
2344,
12035,
1311,
29892,
29897,
13,
4706,
396,
1583,
3032,
657,
29918,
3317,
29918,
7323,
29918,
29879,
7093,
580,
13,
4706,
396,
1583,
3032,
2344,
29918,
1491,
7323,
29898,
1068,
19290,
29897,
13,
13,
1678,
822,
903,
2344,
29918,
1491,
7323,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2391,
310,
5012,
3618,
6590,
304,
278,
8619,
20078,
313,
29888,
10652,
1907,
29897,
13,
4706,
9995,
13,
4706,
1583,
29889,
29883,
29887,
353,
6571,
13,
4706,
363,
474,
29892,
289,
297,
26985,
29898,
1311,
3032,
3317,
29918,
7323,
29918,
2311,
29889,
8149,
580,
1125,
13,
9651,
565,
1583,
29889,
833,
29918,
3670,
29918,
978,
29889,
21064,
580,
1275,
525,
3557,
29923,
2396,
13,
18884,
1583,
29889,
29883,
29887,
29961,
29890,
29962,
353,
16437,
29950,
29933,
29918,
11135,
29918,
3557,
29923,
29898,
13,
462,
1678,
1583,
29889,
3493,
29892,
13,
462,
1678,
16717,
29922,
1311,
29889,
29878,
865,
29889,
9502,
524,
29898,
12648,
10192,
511,
13,
462,
1678,
2847,
29918,
13892,
543,
8172,
613,
13,
462,
1678,
2069,
29918,
15841,
657,
29922,
29900,
29892,
13,
462,
1678,
23562,
29922,
29890,
29892,
13,
462,
1678,
4236,
29918,
7323,
29918,
2311,
29922,
1311,
3032,
3317,
29918,
7323,
29918,
2311,
29961,
29890,
1402,
13,
462,
1678,
364,
865,
29922,
1311,
29889,
29878,
865,
29892,
13,
462,
1678,
3579,
19290,
29897,
13,
9651,
1683,
29901,
13,
1669,
1583,
29889,
29883,
29887,
29961,
29890,
29962,
353,
16437,
29950,
29933,
29918,
11135,
29898,
13,
462,
1678,
1583,
29889,
3493,
29892,
13,
462,
1678,
16717,
29922,
1311,
29889,
29878,
865,
29889,
9502,
524,
29898,
12648,
10192,
511,
13,
462,
1678,
2847,
29918,
13892,
543,
8172,
613,
13,
462,
1678,
2069,
29918,
15841,
657,
29922,
29900,
29892,
13,
462,
1678,
23562,
29922,
29890,
29892,
13,
462,
1678,
4236,
29918,
7323,
29918,
2311,
29922,
1311,
3032,
3317,
29918,
7323,
29918,
2311,
29961,
29890,
1402,
13,
462,
1678,
364,
865,
29922,
1311,
29889,
29878,
865,
29892,
13,
462,
1678,
1190,
9102,
403,
29922,
1311,
29889,
833,
29918,
3670,
29918,
978,
29892,
13,
462,
1678,
3579,
19290,
29897,
29871,
13,
9651,
396,
1583,
29889,
29883,
29887,
29961,
29890,
29962,
353,
323,
4162,
29898,
13,
9651,
396,
268,
1583,
29889,
3493,
29892,
13,
9651,
396,
268,
16717,
29922,
1311,
29889,
29878,
865,
29889,
9502,
524,
29898,
12648,
10192,
511,
13,
9651,
396,
268,
2847,
29918,
13892,
543,
8172,
613,
13,
9651,
396,
268,
2069,
29918,
15841,
657,
29922,
29900,
29892,
13,
9651,
396,
268,
3579,
19290,
29897,
13,
9651,
396,
1583,
29889,
29883,
29887,
29961,
29890,
1822,
7323,
2785,
353,
518,
8516,
29962,
334,
1583,
3032,
3317,
29918,
7323,
29918,
2311,
29961,
29890,
29962,
13,
9651,
396,
1583,
29889,
29883,
29887,
29961,
29890,
1822,
7323,
2785,
29918,
9202,
2264,
353,
518,
9302,
29889,
7192,
29962,
334,
1583,
3032,
3317,
29918,
7323,
29918,
2311,
29961,
29890,
29962,
13,
13,
1678,
822,
903,
562,
1548,
29918,
29883,
5380,
403,
29898,
1311,
29892,
4105,
3522,
29892,
23562,
1125,
13,
4706,
9995,
3251,
1078,
29914,
1859,
15806,
263,
5285,
2729,
373,
278,
23562,
322,
12541,
1353,
13,
4706,
9995,
13,
4706,
396,
1831,
263,
3847,
29914,
5182,
13,
18884,
396,
1831,
263,
3847,
29914,
5182,
13,
4706,
3847,
29918,
333,
353,
1583,
3032,
657,
29918,
4622,
29918,
13140,
29918,
1454,
29918,
1491,
7323,
29898,
15841,
657,
29892,
4105,
3522,
29897,
13,
13,
4706,
565,
23562,
2804,
4105,
3522,
29889,
15841,
20078,
29961,
29900,
5387,
13,
9651,
565,
4105,
3522,
29889,
275,
29918,
1482,
29918,
29878,
686,
7295,
13,
18884,
396,
14402,
29901,
1423,
565,
2498,
7093,
304,
599,
23562,
26325,
886,
13,
18884,
5224,
29918,
15841,
657,
29892,
954,
29918,
2917,
29879,
353,
4105,
3522,
29889,
657,
29918,
13609,
29918,
15841,
657,
29918,
14032,
327,
1080,
29898,
13,
462,
1678,
23562,
29897,
13,
18884,
1583,
3032,
657,
29918,
14032,
8194,
29918,
29883,
5380,
403,
29898,
13609,
29918,
15841,
657,
29892,
23562,
29892,
13,
462,
462,
795,
954,
29918,
2917,
29879,
29897,
13,
9651,
396,
1683,
29901,
396,
29871,
31951,
30287,
31025,
30275,
30210,
30622,
30287,
30448,
30214,
236,
157,
146,
31429,
30486,
30494,
2917,
13,
13,
4706,
1683,
29901,
13,
9651,
565,
4105,
3522,
29889,
275,
29918,
1482,
29918,
29878,
686,
7295,
13,
18884,
5224,
29918,
15841,
657,
29892,
954,
29918,
2917,
29879,
353,
4105,
3522,
29889,
657,
29918,
13609,
29918,
15841,
657,
29918,
14032,
327,
1080,
29898,
13,
462,
1678,
23562,
29897,
13,
18884,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29918,
9202,
2264,
7503,
29962,
353,
7442,
29889,
7192,
13,
462,
13,
9651,
363,
289,
297,
18764,
287,
29898,
1311,
29889,
15841,
20078,
1125,
13,
18884,
565,
1583,
29889,
29883,
29887,
29961,
29890,
1822,
29895,
311,
29918,
9794,
29901,
13,
462,
1678,
2867,
29871,
13,
9651,
396,
14260,
353,
1583,
29889,
29883,
29887,
29961,
29890,
1822,
29918,
29879,
688,
7118,
580,
29961,
29900,
29962,
13,
9651,
3367,
1338,
353,
1583,
29889,
29883,
29887,
29961,
29890,
1822,
29918,
29879,
688,
7118,
29898,
29896,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
2435,
29898,
3626,
1338,
22164,
13,
18884,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29961,
3560,
29918,
333,
29974,
29875,
29962,
353,
3367,
1338,
29961,
29875,
1822,
2378,
13,
18884,
396,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29961,
3560,
29918,
333,
29962,
353,
14260,
29889,
2378,
13,
4706,
396,
3847,
29918,
333,
353,
1583,
3032,
657,
29918,
4622,
29918,
13140,
29918,
1454,
29918,
1491,
7323,
29898,
15841,
657,
29892,
4105,
3522,
29897,
13,
13,
4706,
3646,
353,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29961,
3560,
29918,
333,
29962,
13,
4706,
396,
3646,
353,
1583,
29889,
5878,
29918,
9917,
653,
29898,
5182,
29897,
13,
4706,
736,
3646,
29892,
3847,
29918,
333,
13,
13,
1678,
822,
903,
711,
16349,
29898,
1311,
29892,
14260,
29918,
1761,
1125,
13,
4706,
363,
14260,
297,
14260,
29918,
1761,
29901,
13,
9651,
1583,
29889,
3626,
1338,
29889,
1202,
29918,
29874,
29918,
3626,
284,
29898,
3626,
284,
29892,
5852,
29897,
13,
9651,
6216,
2264,
353,
14260,
29889,
711,
16349,
29918,
1767,
13,
9651,
4982,
29918,
3888,
353,
14260,
29889,
3888,
13,
9651,
396,
24298,
1089,
29918,
14968,
29918,
2230,
353,
4982,
29918,
3888,
29889,
657,
29898,
2558,
29889,
29923,
8932,
29918,
15307,
29892,
29871,
29900,
29897,
13,
9651,
23562,
353,
4982,
29918,
3888,
29961,
2558,
29889,
7838,
29928,
7194,
29962,
13,
9651,
3847,
29918,
333,
353,
4982,
29918,
3888,
1839,
3560,
29918,
333,
2033,
13,
9651,
5375,
353,
14260,
29889,
2378,
29871,
396,
14402,
13,
9651,
363,
4105,
3522,
297,
1583,
29889,
4925,
29918,
2634,
9737,
29901,
13,
18884,
565,
4105,
3522,
29889,
2634,
3522,
29918,
333,
1275,
4982,
29918,
3888,
1839,
2634,
3522,
29918,
333,
2033,
29901,
13,
462,
1678,
396,
6036,
292,
338,
306,
3580,
8476,
13566,
363,
5032,
3522,
15629,
304,
2189,
24972,
13,
462,
1678,
4105,
3522,
29889,
9573,
29918,
9057,
29898,
15841,
657,
29897,
29871,
396,
1122,
367,
716,
1948,
13,
462,
1678,
396,
4105,
3522,
4982,
4866,
13,
462,
1678,
4105,
3522,
29889,
8835,
29918,
9057,
29898,
13,
462,
4706,
23562,
29897,
29871,
396,
306,
3580,
8476,
13566,
304,
2189,
12231,
681,
24972,
13,
9651,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29961,
3560,
29918,
333,
29962,
353,
5375,
13,
9651,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
7323,
2785,
29918,
9202,
2264,
29961,
3560,
29918,
333,
29962,
353,
6216,
2264,
13,
9651,
396,
13271,
5528,
3774,
1237,
13,
9651,
565,
6216,
2264,
529,
1583,
29889,
3784,
29918,
13318,
29918,
9202,
2264,
29901,
13,
18884,
1583,
29889,
3784,
29918,
13318,
353,
5375,
13,
18884,
1583,
29889,
3784,
29918,
13318,
29918,
9202,
2264,
353,
14260,
29889,
711,
16349,
29918,
1767,
13,
18884,
1583,
29889,
3784,
29918,
13318,
29918,
3626,
284,
353,
14260,
13,
4706,
396,
363,
364,
686,
297,
3464,
29898,
2634,
3522,
29889,
29876,
29918,
29878,
3085,
29899,
29896,
29892,
4105,
3522,
29889,
3784,
29918,
29878,
686,
29892,
448,
29896,
1125,
13,
4706,
396,
268,
565,
1583,
29889,
29883,
29887,
29961,
2634,
3522,
29889,
15841,
20078,
29961,
29878,
686,
29962,
1822,
29895,
311,
29918,
9794,
29901,
13,
4706,
396,
308,
2867,
13,
4706,
396,
1683,
29901,
13,
9651,
1583,
29889,
29883,
29887,
29961,
15841,
657,
1822,
29918,
711,
16349,
4197,
3626,
284,
2314,
13,
13,
4706,
1583,
3032,
14941,
29918,
262,
4925,
29918,
2634,
9737,
580,
13,
13,
3670,
29918,
1990,
353,
16437,
29950,
29933,
13,
2
] |
lib/handlers/base.py | WXSD-Sales/APMBot | 0 | 73177 | import json
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
cookie = self.get_secure_cookie("sessionId", max_age_days=1, min_version=1)
if cookie != None:
cookie = cookie.decode('utf-8')
cookie = json.loads(cookie)
return cookie
| [
1,
1053,
4390,
13,
5215,
10146,
912,
29889,
2676,
13,
13,
1990,
7399,
4598,
29898,
29873,
1398,
912,
29889,
2676,
29889,
3089,
4598,
1125,
13,
1678,
822,
679,
29918,
3784,
29918,
1792,
29898,
1311,
1125,
13,
4706,
15327,
353,
1583,
29889,
657,
29918,
24216,
29918,
21509,
703,
7924,
1204,
613,
4236,
29918,
482,
29918,
16700,
29922,
29896,
29892,
1375,
29918,
3259,
29922,
29896,
29897,
13,
4706,
565,
15327,
2804,
6213,
29901,
13,
9651,
15327,
353,
15327,
29889,
13808,
877,
9420,
29899,
29947,
1495,
13,
9651,
15327,
353,
4390,
29889,
18132,
29898,
21509,
29897,
13,
4706,
736,
15327,
13,
2
] |
fhir.py | bionicles/playing_with_fhir | 0 | 179385 | "quantify shape and depth diversity of FHIR data"
# conda create -n py39 python=3.9
# conda activate py39
# pip install rich, numpy
# python fhir.py
from dataclasses import dataclass
from itertools import chain
from typing import Dict, List, Optional, Tuple
import json
import os
from plotly.subplots import make_subplots
import plotly.graph_objects as go
from rich import print
import numpy as np
Array = np.ndarray
# data from https://synthetichealth.github.io/synthea/
VERSIONS = ("dstu2", "stu3", "r4")
N_PATIENTS = 200 # use NONE to analyze all patient bundles in each folder
def test_get_paths():
item1 = {
"a": "bion",
"b": {"c": "is", "d": "cool"},
} # (("a",), ("b", "c"), ("b", "d"))
paths1 = get_paths(item1)
# print(item1, "\n", paths1)
assert paths1 == (("a",), ("b", "c"), ("b", "d"))
item2 = {"a": ("bion", "is", "cool")} # (("a", 0), ("a", 1), ("a", 2))
paths2 = get_paths(item2)
# print(item2, "\n", paths2)
assert paths2 == (("a", 0), ("a", 1), ("a", 2))
item3 = {"a": {"b": ("bion", "is", "cool")}}
paths3 = get_paths(item3)
# print(item3, "\n", paths3)
assert paths3 == (("a", "b", 0), ("a", "b", 1), ("a", "b", 2))
assert get_paths("bion") == ((),)
assert get_paths(b"cool") == ((),)
assert get_paths(True) == ((),)
assert get_paths(None) == ((),)
assert get_paths(1) == ((),)
shape1 = {"a": "bion", "b": {"c": "is", "d": "cool"}}
shape2 = {"a": "stuff", "b": {"c": True, "d": False}}
assert get_paths(shape1) == get_paths(shape2)
def get_paths(
item: any, path: Tuple[any, ...] = ()
) -> Tuple[Tuple[any, ...]]: # (()) or ((step0,), (step0, step1) ...)
"""
given a PyTree / collection, returns a tuple of path tuples, one per leaf.
leaves are non-collection types (str, int, float, bool, bytes, None)
get_paths({"a": "bion", "b": {"c": "is", "d": "cool"}}) = (("a",), ("b", "c"), ("b", "d"))
get_paths({"a": ("bion", "is", "cool")}) = (("a", 0), ("a", 1), ("a", 2))
{"a": {"b": ("bion", "is", "cool")}} = (("a", "b", 0), ("a", "b", 1), ("a", "b", 2))
"""
if isinstance(item, (str, int, float, bool, bytes, type(None))):
return (path,)
if isinstance(item, dict):
nested = tuple(get_paths(value, path + (key,)) for key, value in item.items())
# unnest nested tuples
return tuple(chain.from_iterable(nested))
if isinstance(item, (list, tuple)):
nested = tuple(
get_paths(value, path + (index,)) for index, value in enumerate(item)
)
# unnest nested tuples
return tuple(chain.from_iterable(nested))
raise TypeError(f"unsupported type: {type(item)}")
def get_data(folder: str, n_patients: Optional[int] = N_PATIENTS) -> List[dict]:
"get data from a folder"
data = []
path = os.path.join("data", folder)
for file in os.listdir(path):
if file.endswith(".json"):
filepath = os.path.join("data", folder, file)
with open(filepath) as f:
data.append(json.load(f))
if n_patients is not None and len(data) == n_patients:
break
return data
def group_by_resource_type(bundles: List[dict]) -> Dict[str, List[dict]]:
"group data by resource type"
grouped = {}
for bundle in bundles:
for entry in bundle["entry"]:
resource = entry["resource"]
resource_type = resource["resourceType"]
if resource_type not in grouped:
grouped[resource_type] = []
grouped[resource_type].append(resource)
return grouped
def get_shapes_and_depths(grouped: dict) -> Tuple[Dict[str, tuple], Dict[str, Array]]:
"get shapes and leaf depths of resources"
shapes, depths = {}, {}
for resource_type, instances in grouped.items():
if resource_type not in shapes:
shapes[resource_type] = []
if resource_type not in depths:
depths[resource_type] = []
for instance in instances:
paths = get_paths(instance)
leaf_depths = tuple(len(path) for path in paths)
shapes[resource_type].append(len(paths))
depths[resource_type].extend(leaf_depths)
shapes = {k: tuple(set(v)) for k, v in shapes.items()}
depths = {k: np.array(v) for k, v in depths.items()}
return shapes, depths
@dataclass(frozen=True)
class VersionStats:
"statistics for a FHIR version"
version: str
n_patients: int
counts: Dict[str, int] # {resource_type: count}
depths: Dict[str, Array] # {resource_type: leaf_depths}
shapes: Dict[str, tuple] # {resource_type: (shape, ...)}
def get_version_stats(version: str, n_patients: int = N_PATIENTS) -> Dict[str, tuple]:
"get shapes of resources"
data = get_data(version, n_patients)
grouped = group_by_resource_type(data)
shapes, depths = get_shapes_and_depths(grouped)
version_stats = VersionStats(
version=version,
n_patients=n_patients,
counts={k: len(v) for k, v in grouped.items()},
depths=depths,
shapes=shapes,
)
return version_stats
def show_version(stats: VersionStats) -> None:
"renders a VersionStats to stdout"
print("FHIR Version {stats.version}")
print(" n_patients: {stats.n_patients}")
for key in sorted(stats.counts.keys()):
print(f" {key}: ")
print(f" count: {stats.counts[key]}")
print(f" n_shapes: {len(stats.shapes[key])}")
print(f" avg_depth: {stats.depths[key].mean()}")
print(f" max_depth: {stats.depths[key].max()}")
@dataclass(frozen=True)
class ResourceTypeStats:
"statistics for a resource type"
resource_type: str
n_patients: int
counts: Dict[str, int] # {version: count}
depths: Dict[str, Array] # {version: depths}
shapes: Dict[str, tuple] # {version: shapes}
def get_resource_stats(
stats: Dict[str, VersionStats] # {version: version_stats}
) -> Dict[str, ResourceTypeStats]: # {resource_type: resource_type_stats}
"group the resources by type across FHIR versions"
grouped = {}
for version, version_stats in stats.items():
for resource_type, instances in version_stats.counts.items():
if resource_type not in grouped:
grouped[resource_type] = ResourceTypeStats(
resource_type=resource_type,
n_patients=version_stats.n_patients,
counts={},
depths={},
shapes={},
)
grouped[resource_type].counts[version] = instances
grouped[resource_type].depths[version] = version_stats.depths[resource_type]
grouped[resource_type].shapes[version] = version_stats.shapes[resource_type]
return grouped
def show_resource_stats(stats: ResourceTypeStats) -> None:
"renders a ResourceTypeStats to stdout"
print(f"Resource Type: {stats.resource_type}")
for version in stats.counts.keys():
print(f" {version}: ")
print(f" count: {stats.counts[version]}")
print(f" n_shapes: {len(stats.shapes[version])}")
print(f" avg_depth: {stats.depths[version].mean()}")
print(f" max_depth: {stats.depths[version].max()}")
def plot_lines_and_violins(
all_version_stats: Dict[str, VersionStats], # {version: version_stats}
all_resource_type_stats: Dict[
str, ResourceTypeStats
], # {resource_type: resource_type_stats}
) -> go.Figure:
"""
Plots 2 subfigures in 1 column
top row: a (version, n_shapes) line per resource type
top row: a (version, n_shapes) violin per version
bottom row: a (version, depths) violin per version
"""
# make a figure with 2 rows and 1 column
fig = make_subplots(
rows=2,
cols=1,
shared_xaxes=True,
vertical_spacing=0.05,
subplot_titles=("", ""),
)
# label the figure
fig.update_layout(
title_text="Resource Polymorphism & Nesting Of FHIR Versions",
xaxis_title="--- FHIR Version ---> ",
yaxis_title="Count",
width=1000,
height=800,
)
# make the top row
# add a (version, n_shapes) line per resource_type
for resource_type, resource_type_stats in all_resource_type_stats.items():
fig.add_trace(
go.Scatter(
x=list(resource_type_stats.counts.keys()),
y=list(
len(resource_type_stats.shapes[version])
for version in resource_type_stats.counts.keys()
),
mode="lines",
name=resource_type,
),
row=1,
col=1,
)
# label the top row
fig.update_yaxes(
title_text="Polymorphism / # Unique Shapes (lower is better)", row=1, col=1
)
# add a (version, n_shapes) violin per version
colors = {"dstu2": "red", "stu3": "green", "r4": "blue"}
for version, version_stats in all_version_stats.items():
# group by version
n_shapes = list(map(len, version_stats.shapes.values()))
fig.add_trace(
go.Violin(
x=[version] * len(n_shapes),
y=n_shapes,
name=version,
marker_color=colors[version],
showlegend=False,
legendgroup=version,
),
row=1,
col=1,
)
# make the bottom row
# add a (version, depths) violin per version
for version, version_stats in all_version_stats.items():
# group all the depths for all the resource_types of this version
depths = np.concatenate(
[
version_stats.depths[resource_type]
for resource_type in version_stats.counts.keys()
]
)
fig.add_trace(
go.Violin(
x=[version] * len(depths),
y=depths,
name=version,
marker_color=colors[version],
legendgroup=version,
),
row=2,
col=1,
)
# label the bottom row
fig.update_yaxes(title_text="Nesting / Leaf Depth (lower is better)", row=2, col=1)
return fig
def plot_bars(
all_resource_type_stats: Dict[
str, ResourceTypeStats
], # {resource_type: resource_type_stats}
) -> go.Figure:
"""
Plots 2 subfigures in 1 column
top row: a (resource_type, n_shapes) bar group per resource_type, one bar per version
bottom row: a (resource_type, depths) box plot group per resource_type, one box per version
"""
# make a figure with 2 rows and 1 column
fig = make_subplots(
rows=2,
cols=1,
shared_xaxes=True,
vertical_spacing=0.05,
subplot_titles=("", ""),
)
# label the figure
fig.update_layout(
title_text="Polymorphism & Nesting Of FHIR Resource Types",
xaxis_title="Resource Type",
yaxis_title="Count",
barmode="group",
width=1000,
height=800,
)
colors = {"dstu2": "red", "stu3": "green", "r4": "blue"}
# make the top row
# add a (resource_type, n_shapes) bar group per resource_type, one bar per version
for version in colors.keys():
x = [
resource_type
for resource_type in all_resource_type_stats.keys()
if version in all_resource_type_stats[resource_type].counts
]
y = [
len(resource_type_stats.shapes[version])
for resource_type_stats in all_resource_type_stats.values()
if version in resource_type_stats.counts
]
fig.add_trace(
go.Bar(
name=version,
x=x,
y=y,
marker_color=colors[version],
legendgroup=version,
),
row=1,
col=1,
)
# label the top row
fig.update_yaxes(
title_text="Polymorphism / # Unique Shapes (lower is better)", row=1, col=1
)
# add a (resource_type, depths) bar group per resource_type, one box per version
for version in colors.keys():
x = [
resource_type
for resource_type in all_resource_type_stats.keys()
if version in all_resource_type_stats[resource_type].counts
]
y = [
resource_type_stats.depths[version].mean()
for resource_type_stats in all_resource_type_stats.values()
if version in resource_type_stats.counts
]
fig.add_trace(
go.Bar(
name=version,
x=x,
y=y,
marker_color=colors[version],
legendgroup=version,
showlegend=False,
),
row=2,
col=1,
)
# label the bottom row
fig.update_yaxes(
title_text="Average Nesting / Leaf Depth (lower is better)", row=2, col=1
)
return fig
def find_worst_offenders(
all_resource_type_stats: Dict[str, ResourceTypeStats],
version: str,
) -> Dict[str, ResourceTypeStats]:
"""
Finds the resource types with the worst polymorphing and nesting
"""
# find the resource type with the most number of shapes
most_polymorphic_resource_type = None
deepest_resource_type_by_mean = None
deepest_resource_type_by_max = None
for resource_type, resource_type_stats in all_resource_type_stats.items():
if version not in resource_type_stats.counts:
continue
shapes = resource_type_stats.shapes[version]
depths = resource_type_stats.depths[version]
if most_polymorphic_resource_type is None or len(shapes) > len(
all_resource_type_stats[most_polymorphic_resource_type].shapes[version]
):
most_polymorphic_resource_type = resource_type
if (
deepest_resource_type_by_mean is None
or depths.mean()
> all_resource_type_stats[deepest_resource_type_by_mean]
.depths[version]
.mean()
):
deepest_resource_type_by_mean = resource_type
if (
deepest_resource_type_by_max is None
or depths.max()
> all_resource_type_stats[deepest_resource_type_by_max]
.depths[version]
.max()
):
deepest_resource_type_by_max = resource_type
return {
"version": version,
"most_polymorphic": all_resource_type_stats[most_polymorphic_resource_type],
"deepest_by_mean": all_resource_type_stats[deepest_resource_type_by_mean],
"deepest_by_max": all_resource_type_stats[deepest_resource_type_by_max],
}
# - the resource type with the most inconsistent data:
# ImagingStudy with 177 different shapes in a sample of 977 ImagingStudy instances
# - the resource type with most deeply nested data (on average):
# ImagingStudy, which requires an average of 5.3 operations to access each leaf
# - the resource type with most deeply nested data (worst case):
# ExplanationOfBenefit has a leaf which requires 8 operations to access
def show_worst_offenders(worst_offenders: dict) -> None:
version = worst_offenders["version"]
print(f"\nworst offenders in FHIR {version}\n")
most_polymorphic = worst_offenders["most_polymorphic"]
resource_type = most_polymorphic.resource_type
n_shapes = len(most_polymorphic.shapes[version])
count = most_polymorphic.counts[version]
print("the resource type with the most inconsistent data:")
print(
f"{resource_type}, with {n_shapes} unique shapes in a sample of {count} {resource_type} instances"
)
print()
deepest_by_mean = worst_offenders["deepest_by_mean"]
resource_type = deepest_by_mean.resource_type
mean_depth = deepest_by_mean.depths[version].mean()
print("the resource type with most deeply nested data (on average):")
print(
f"{resource_type}, which requires an average of {mean_depth} operations to access each leaf"
)
print()
deepest_by_max = worst_offenders["deepest_by_max"]
resource_type = deepest_by_max.resource_type
max_depth = deepest_by_max.depths[version].max()
print("the resource type with most deeply nested data (worst case):")
print(
f"{resource_type}, which has a leaf which requires {max_depth} operations to access"
)
if __name__ == "__main__":
version_stats = {
version: get_version_stats(version, n_patients=N_PATIENTS)
for version in VERSIONS
}
resource_stats = get_resource_stats(version_stats)
# to make output.txt, uncomment this and run `python fhir.py > output.txt`
for resource_type, resource_type_stats in resource_stats.items():
show_resource_stats(resource_type_stats)
# to make worst.txt, uncomment this and run `python fhir.py > worst.txt`
worst_offenders = find_worst_offenders(resource_stats, "r4")
show_worst_offenders(worst_offenders)
# to make plots, uncomment this and run `python fhir.py`
# warning: violin plots are slow if you have a lot of data
lines_and_violins = plot_lines_and_violins(version_stats, resource_stats)
lines_and_violins.show()
# lines_and_violins.write_image("by_fhir_version.png")
bars = plot_bars(resource_stats)
bars.show()
# bars.write_image("by_resource_type.png") | [
1,
376,
12150,
1598,
8267,
322,
10809,
6894,
537,
310,
383,
29950,
8193,
848,
29908,
13,
29937,
378,
1388,
1653,
448,
29876,
11451,
29941,
29929,
3017,
29922,
29941,
29889,
29929,
13,
29937,
378,
1388,
5039,
403,
11451,
29941,
29929,
13,
29937,
8450,
2601,
8261,
29892,
12655,
13,
29937,
3017,
285,
29882,
381,
29889,
2272,
13,
13,
3166,
848,
13203,
1053,
848,
1990,
13,
3166,
4256,
8504,
1053,
9704,
13,
3166,
19229,
1053,
360,
919,
29892,
2391,
29892,
28379,
29892,
12603,
552,
13,
5215,
4390,
13,
5215,
2897,
13,
13,
3166,
6492,
368,
29889,
1491,
26762,
1053,
1207,
29918,
1491,
26762,
13,
5215,
6492,
368,
29889,
4262,
29918,
12650,
408,
748,
13,
3166,
8261,
1053,
1596,
13,
5215,
12655,
408,
7442,
13,
13,
2588,
353,
7442,
29889,
299,
2378,
13,
13,
29937,
848,
515,
2045,
597,
19274,
386,
300,
4070,
4298,
29889,
3292,
29889,
601,
29914,
29879,
3903,
354,
29874,
29914,
13,
16358,
29903,
353,
4852,
22992,
29884,
29906,
613,
376,
303,
29884,
29941,
613,
376,
29878,
29946,
1159,
13,
29940,
29918,
29925,
1299,
29902,
3919,
29903,
353,
29871,
29906,
29900,
29900,
29871,
396,
671,
405,
12413,
304,
27599,
599,
16500,
22813,
793,
297,
1269,
4138,
13,
13,
13,
1753,
1243,
29918,
657,
29918,
24772,
7295,
13,
1678,
2944,
29896,
353,
426,
13,
4706,
376,
29874,
1115,
376,
29890,
291,
613,
13,
4706,
376,
29890,
1115,
8853,
29883,
1115,
376,
275,
613,
376,
29881,
1115,
376,
1111,
324,
10758,
13,
1678,
500,
29871,
396,
313,
703,
29874,
613,
511,
4852,
29890,
613,
376,
29883,
4968,
4852,
29890,
613,
376,
29881,
5783,
13,
1678,
10898,
29896,
353,
679,
29918,
24772,
29898,
667,
29896,
29897,
13,
1678,
396,
1596,
29898,
667,
29896,
29892,
6634,
29876,
613,
10898,
29896,
29897,
13,
1678,
4974,
10898,
29896,
1275,
313,
703,
29874,
613,
511,
4852,
29890,
613,
376,
29883,
4968,
4852,
29890,
613,
376,
29881,
5783,
13,
1678,
2944,
29906,
353,
8853,
29874,
1115,
4852,
29890,
291,
613,
376,
275,
613,
376,
1111,
324,
1159,
29913,
29871,
396,
313,
703,
29874,
613,
29871,
29900,
511,
4852,
29874,
613,
29871,
29896,
511,
4852,
29874,
613,
29871,
29906,
876,
13,
1678,
10898,
29906,
353,
679,
29918,
24772,
29898,
667,
29906,
29897,
13,
1678,
396,
1596,
29898,
667,
29906,
29892,
6634,
29876,
613,
10898,
29906,
29897,
13,
1678,
4974,
10898,
29906,
1275,
313,
703,
29874,
613,
29871,
29900,
511,
4852,
29874,
613,
29871,
29896,
511,
4852,
29874,
613,
29871,
29906,
876,
13,
1678,
2944,
29941,
353,
8853,
29874,
1115,
8853,
29890,
1115,
4852,
29890,
291,
613,
376,
275,
613,
376,
1111,
324,
1159,
930,
13,
1678,
10898,
29941,
353,
679,
29918,
24772,
29898,
667,
29941,
29897,
13,
1678,
396,
1596,
29898,
667,
29941,
29892,
6634,
29876,
613,
10898,
29941,
29897,
13,
1678,
4974,
10898,
29941,
1275,
313,
703,
29874,
613,
376,
29890,
613,
29871,
29900,
511,
4852,
29874,
613,
376,
29890,
613,
29871,
29896,
511,
4852,
29874,
613,
376,
29890,
613,
29871,
29906,
876,
13,
1678,
4974,
679,
29918,
24772,
703,
29890,
291,
1159,
1275,
313,
3285,
29897,
13,
1678,
4974,
679,
29918,
24772,
29898,
29890,
29908,
1111,
324,
1159,
1275,
313,
3285,
29897,
13,
1678,
4974,
679,
29918,
24772,
29898,
5574,
29897,
1275,
313,
3285,
29897,
13,
1678,
4974,
679,
29918,
24772,
29898,
8516,
29897,
1275,
313,
3285,
29897,
13,
1678,
4974,
679,
29918,
24772,
29898,
29896,
29897,
1275,
313,
3285,
29897,
13,
1678,
8267,
29896,
353,
8853,
29874,
1115,
376,
29890,
291,
613,
376,
29890,
1115,
8853,
29883,
1115,
376,
275,
613,
376,
29881,
1115,
376,
1111,
324,
29908,
930,
13,
1678,
8267,
29906,
353,
8853,
29874,
1115,
376,
303,
3096,
613,
376,
29890,
1115,
8853,
29883,
1115,
5852,
29892,
376,
29881,
1115,
7700,
930,
13,
1678,
4974,
679,
29918,
24772,
29898,
12181,
29896,
29897,
1275,
679,
29918,
24772,
29898,
12181,
29906,
29897,
13,
13,
13,
1753,
679,
29918,
24772,
29898,
13,
1678,
2944,
29901,
738,
29892,
2224,
29901,
12603,
552,
29961,
1384,
29892,
2023,
29962,
353,
3861,
13,
29897,
1599,
12603,
552,
29961,
23215,
552,
29961,
1384,
29892,
2023,
5262,
29901,
29871,
396,
313,
3101,
470,
5135,
10568,
29900,
29892,
511,
313,
10568,
29900,
29892,
4331,
29896,
29897,
29757,
13,
1678,
9995,
13,
1678,
2183,
263,
10772,
9643,
847,
4333,
29892,
3639,
263,
18761,
310,
2224,
5291,
2701,
29892,
697,
639,
20447,
29889,
13,
1678,
11308,
526,
1661,
29899,
10855,
4072,
313,
710,
29892,
938,
29892,
5785,
29892,
6120,
29892,
6262,
29892,
6213,
29897,
13,
1678,
679,
29918,
24772,
3319,
29908,
29874,
1115,
376,
29890,
291,
613,
376,
29890,
1115,
8853,
29883,
1115,
376,
275,
613,
376,
29881,
1115,
376,
1111,
324,
29908,
24289,
353,
313,
703,
29874,
613,
511,
4852,
29890,
613,
376,
29883,
4968,
4852,
29890,
613,
376,
29881,
5783,
13,
1678,
679,
29918,
24772,
3319,
29908,
29874,
1115,
4852,
29890,
291,
613,
376,
275,
613,
376,
1111,
324,
1159,
1800,
353,
313,
703,
29874,
613,
29871,
29900,
511,
4852,
29874,
613,
29871,
29896,
511,
4852,
29874,
613,
29871,
29906,
876,
13,
1678,
8853,
29874,
1115,
8853,
29890,
1115,
4852,
29890,
291,
613,
376,
275,
613,
376,
1111,
324,
1159,
930,
353,
313,
703,
29874,
613,
376,
29890,
613,
29871,
29900,
511,
4852,
29874,
613,
376,
29890,
613,
29871,
29896,
511,
4852,
29874,
613,
376,
29890,
613,
29871,
29906,
876,
13,
1678,
9995,
13,
1678,
565,
338,
8758,
29898,
667,
29892,
313,
710,
29892,
938,
29892,
5785,
29892,
6120,
29892,
6262,
29892,
1134,
29898,
8516,
876,
1125,
13,
4706,
736,
313,
2084,
29892,
29897,
13,
1678,
565,
338,
8758,
29898,
667,
29892,
9657,
1125,
13,
4706,
9322,
353,
18761,
29898,
657,
29918,
24772,
29898,
1767,
29892,
2224,
718,
313,
1989,
29892,
876,
363,
1820,
29892,
995,
297,
2944,
29889,
7076,
3101,
13,
4706,
396,
443,
17510,
9322,
5291,
2701,
13,
4706,
736,
18761,
29898,
14153,
29889,
3166,
29918,
1524,
519,
29898,
27420,
876,
13,
1678,
565,
338,
8758,
29898,
667,
29892,
313,
1761,
29892,
18761,
22164,
13,
4706,
9322,
353,
18761,
29898,
13,
9651,
679,
29918,
24772,
29898,
1767,
29892,
2224,
718,
313,
2248,
29892,
876,
363,
2380,
29892,
995,
297,
26985,
29898,
667,
29897,
13,
4706,
1723,
13,
4706,
396,
443,
17510,
9322,
5291,
2701,
13,
4706,
736,
18761,
29898,
14153,
29889,
3166,
29918,
1524,
519,
29898,
27420,
876,
13,
1678,
12020,
20948,
29898,
29888,
29908,
348,
23765,
1134,
29901,
426,
1853,
29898,
667,
2915,
1159,
13,
13,
13,
1753,
679,
29918,
1272,
29898,
12083,
29901,
851,
29892,
302,
29918,
5031,
10070,
29901,
28379,
29961,
524,
29962,
353,
405,
29918,
29925,
1299,
29902,
3919,
29903,
29897,
1599,
2391,
29961,
8977,
5387,
13,
1678,
376,
657,
848,
515,
263,
4138,
29908,
13,
13,
1678,
848,
353,
5159,
13,
1678,
2224,
353,
2897,
29889,
2084,
29889,
7122,
703,
1272,
613,
4138,
29897,
13,
1678,
363,
934,
297,
2897,
29889,
1761,
3972,
29898,
2084,
1125,
13,
4706,
565,
934,
29889,
1975,
2541,
17350,
3126,
29908,
1125,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
703,
1272,
613,
4138,
29892,
934,
29897,
13,
9651,
411,
1722,
29898,
1445,
2084,
29897,
408,
285,
29901,
13,
18884,
848,
29889,
4397,
29898,
3126,
29889,
1359,
29898,
29888,
876,
13,
4706,
565,
302,
29918,
5031,
10070,
338,
451,
6213,
322,
7431,
29898,
1272,
29897,
1275,
302,
29918,
5031,
10070,
29901,
13,
9651,
2867,
13,
1678,
736,
848,
13,
13,
13,
1753,
2318,
29918,
1609,
29918,
10314,
29918,
1853,
29898,
16293,
793,
29901,
2391,
29961,
8977,
2314,
1599,
360,
919,
29961,
710,
29892,
2391,
29961,
8977,
5262,
29901,
13,
1678,
376,
2972,
848,
491,
6503,
1134,
29908,
13,
13,
1678,
27831,
353,
6571,
13,
1678,
363,
11846,
297,
22813,
793,
29901,
13,
4706,
363,
6251,
297,
11846,
3366,
8269,
3108,
29901,
13,
9651,
6503,
353,
6251,
3366,
10314,
3108,
13,
9651,
6503,
29918,
1853,
353,
6503,
3366,
10314,
1542,
3108,
13,
9651,
565,
6503,
29918,
1853,
451,
297,
27831,
29901,
13,
18884,
27831,
29961,
10314,
29918,
1853,
29962,
353,
5159,
13,
9651,
27831,
29961,
10314,
29918,
1853,
1822,
4397,
29898,
10314,
29897,
13,
1678,
736,
27831,
13,
13,
13,
1753,
679,
29918,
845,
11603,
29918,
392,
29918,
19488,
29879,
29898,
2972,
287,
29901,
9657,
29897,
1599,
12603,
552,
29961,
21533,
29961,
710,
29892,
18761,
1402,
360,
919,
29961,
710,
29892,
4398,
5262,
29901,
13,
1678,
376,
657,
25834,
322,
20447,
10809,
29879,
310,
7788,
29908,
13,
1678,
25834,
29892,
10809,
29879,
353,
24335,
6571,
13,
1678,
363,
6503,
29918,
1853,
29892,
8871,
297,
27831,
29889,
7076,
7295,
13,
4706,
565,
6503,
29918,
1853,
451,
297,
25834,
29901,
13,
9651,
25834,
29961,
10314,
29918,
1853,
29962,
353,
5159,
13,
4706,
565,
6503,
29918,
1853,
451,
297,
10809,
29879,
29901,
13,
9651,
10809,
29879,
29961,
10314,
29918,
1853,
29962,
353,
5159,
13,
4706,
363,
2777,
297,
8871,
29901,
13,
9651,
10898,
353,
679,
29918,
24772,
29898,
8758,
29897,
13,
9651,
20447,
29918,
19488,
29879,
353,
18761,
29898,
2435,
29898,
2084,
29897,
363,
2224,
297,
10898,
29897,
13,
9651,
25834,
29961,
10314,
29918,
1853,
1822,
4397,
29898,
2435,
29898,
24772,
876,
13,
9651,
10809,
29879,
29961,
10314,
29918,
1853,
1822,
21843,
29898,
29500,
29918,
19488,
29879,
29897,
13,
1678,
25834,
353,
426,
29895,
29901,
18761,
29898,
842,
29898,
29894,
876,
363,
413,
29892,
325,
297,
25834,
29889,
7076,
28296,
13,
1678,
10809,
29879,
353,
426,
29895,
29901,
7442,
29889,
2378,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
10809,
29879,
29889,
7076,
28296,
13,
1678,
736,
25834,
29892,
10809,
29879,
13,
13,
13,
29992,
1272,
1990,
29898,
29888,
307,
2256,
29922,
5574,
29897,
13,
1990,
10079,
25060,
29901,
13,
1678,
376,
6112,
6765,
363,
263,
383,
29950,
8193,
1873,
29908,
13,
1678,
1873,
29901,
851,
13,
1678,
302,
29918,
5031,
10070,
29901,
938,
13,
1678,
18139,
29901,
360,
919,
29961,
710,
29892,
938,
29962,
29871,
396,
426,
10314,
29918,
1853,
29901,
2302,
29913,
13,
1678,
10809,
29879,
29901,
360,
919,
29961,
710,
29892,
4398,
29962,
29871,
396,
426,
10314,
29918,
1853,
29901,
20447,
29918,
19488,
29879,
29913,
13,
1678,
25834,
29901,
360,
919,
29961,
710,
29892,
18761,
29962,
29871,
396,
426,
10314,
29918,
1853,
29901,
313,
12181,
29892,
2023,
2915,
13,
13,
13,
1753,
679,
29918,
3259,
29918,
16202,
29898,
3259,
29901,
851,
29892,
302,
29918,
5031,
10070,
29901,
938,
353,
405,
29918,
29925,
1299,
29902,
3919,
29903,
29897,
1599,
360,
919,
29961,
710,
29892,
18761,
5387,
13,
1678,
376,
657,
25834,
310,
7788,
29908,
13,
1678,
848,
353,
679,
29918,
1272,
29898,
3259,
29892,
302,
29918,
5031,
10070,
29897,
13,
1678,
27831,
353,
2318,
29918,
1609,
29918,
10314,
29918,
1853,
29898,
1272,
29897,
13,
1678,
25834,
29892,
10809,
29879,
353,
679,
29918,
845,
11603,
29918,
392,
29918,
19488,
29879,
29898,
2972,
287,
29897,
13,
1678,
1873,
29918,
16202,
353,
10079,
25060,
29898,
13,
4706,
1873,
29922,
3259,
29892,
13,
4706,
302,
29918,
5031,
10070,
29922,
29876,
29918,
5031,
10070,
29892,
13,
4706,
18139,
3790,
29895,
29901,
7431,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
27831,
29889,
7076,
580,
1118,
13,
4706,
10809,
29879,
29922,
19488,
29879,
29892,
13,
4706,
25834,
29922,
845,
11603,
29892,
13,
1678,
1723,
13,
1678,
736,
1873,
29918,
16202,
13,
13,
13,
1753,
1510,
29918,
3259,
29898,
16202,
29901,
10079,
25060,
29897,
1599,
6213,
29901,
13,
1678,
376,
29878,
21043,
263,
10079,
25060,
304,
27591,
29908,
13,
1678,
1596,
703,
29943,
29950,
8193,
10079,
426,
16202,
29889,
3259,
27195,
13,
1678,
1596,
703,
29871,
302,
29918,
5031,
10070,
29901,
426,
16202,
29889,
29876,
29918,
5031,
10070,
27195,
13,
1678,
363,
1820,
297,
12705,
29898,
16202,
29889,
2798,
29879,
29889,
8149,
580,
1125,
13,
4706,
1596,
29898,
29888,
29908,
1678,
426,
1989,
6177,
16521,
13,
4706,
1596,
29898,
29888,
29908,
418,
2302,
29901,
426,
16202,
29889,
2798,
29879,
29961,
1989,
12258,
1159,
13,
4706,
1596,
29898,
29888,
29908,
418,
302,
29918,
845,
11603,
29901,
426,
2435,
29898,
16202,
29889,
845,
11603,
29961,
1989,
2314,
27195,
13,
4706,
1596,
29898,
29888,
29908,
418,
1029,
29887,
29918,
19488,
29901,
426,
16202,
29889,
19488,
29879,
29961,
1989,
1822,
12676,
580,
27195,
13,
4706,
1596,
29898,
29888,
29908,
418,
4236,
29918,
19488,
29901,
426,
16202,
29889,
19488,
29879,
29961,
1989,
1822,
3317,
580,
27195,
13,
13,
13,
29992,
1272,
1990,
29898,
29888,
307,
2256,
29922,
5574,
29897,
13,
1990,
18981,
1542,
25060,
29901,
13,
1678,
376,
6112,
6765,
363,
263,
6503,
1134,
29908,
13,
1678,
6503,
29918,
1853,
29901,
851,
13,
1678,
302,
29918,
5031,
10070,
29901,
938,
13,
1678,
18139,
29901,
360,
919,
29961,
710,
29892,
938,
29962,
29871,
396,
426,
3259,
29901,
2302,
29913,
13,
1678,
10809,
29879,
29901,
360,
919,
29961,
710,
29892,
4398,
29962,
29871,
396,
426,
3259,
29901,
10809,
29879,
29913,
13,
1678,
25834,
29901,
360,
919,
29961,
710,
29892,
18761,
29962,
29871,
396,
426,
3259,
29901,
25834,
29913,
13,
13,
13,
1753,
679,
29918,
10314,
29918,
16202,
29898,
13,
1678,
22663,
29901,
360,
919,
29961,
710,
29892,
10079,
25060,
29962,
29871,
396,
426,
3259,
29901,
1873,
29918,
16202,
29913,
13,
29897,
1599,
360,
919,
29961,
710,
29892,
18981,
1542,
25060,
5387,
29871,
396,
426,
10314,
29918,
1853,
29901,
6503,
29918,
1853,
29918,
16202,
29913,
13,
1678,
376,
2972,
278,
7788,
491,
1134,
4822,
383,
29950,
8193,
6910,
29908,
13,
1678,
27831,
353,
6571,
13,
1678,
363,
1873,
29892,
1873,
29918,
16202,
297,
22663,
29889,
7076,
7295,
13,
4706,
363,
6503,
29918,
1853,
29892,
8871,
297,
1873,
29918,
16202,
29889,
2798,
29879,
29889,
7076,
7295,
13,
9651,
565,
6503,
29918,
1853,
451,
297,
27831,
29901,
13,
18884,
27831,
29961,
10314,
29918,
1853,
29962,
353,
18981,
1542,
25060,
29898,
13,
462,
1678,
6503,
29918,
1853,
29922,
10314,
29918,
1853,
29892,
13,
462,
1678,
302,
29918,
5031,
10070,
29922,
3259,
29918,
16202,
29889,
29876,
29918,
5031,
10070,
29892,
13,
462,
1678,
18139,
3790,
1118,
13,
462,
1678,
10809,
29879,
3790,
1118,
13,
462,
1678,
25834,
3790,
1118,
13,
18884,
1723,
13,
9651,
27831,
29961,
10314,
29918,
1853,
1822,
2798,
29879,
29961,
3259,
29962,
353,
8871,
13,
9651,
27831,
29961,
10314,
29918,
1853,
1822,
19488,
29879,
29961,
3259,
29962,
353,
1873,
29918,
16202,
29889,
19488,
29879,
29961,
10314,
29918,
1853,
29962,
13,
9651,
27831,
29961,
10314,
29918,
1853,
1822,
845,
11603,
29961,
3259,
29962,
353,
1873,
29918,
16202,
29889,
845,
11603,
29961,
10314,
29918,
1853,
29962,
13,
1678,
736,
27831,
13,
13,
13,
1753,
1510,
29918,
10314,
29918,
16202,
29898,
16202,
29901,
18981,
1542,
25060,
29897,
1599,
6213,
29901,
13,
1678,
376,
29878,
21043,
263,
18981,
1542,
25060,
304,
27591,
29908,
13,
1678,
1596,
29898,
29888,
29908,
6848,
5167,
29901,
426,
16202,
29889,
10314,
29918,
1853,
27195,
13,
1678,
363,
1873,
297,
22663,
29889,
2798,
29879,
29889,
8149,
7295,
13,
4706,
1596,
29898,
29888,
29908,
1678,
426,
3259,
6177,
16521,
13,
4706,
1596,
29898,
29888,
29908,
418,
2302,
29901,
426,
16202,
29889,
2798,
29879,
29961,
3259,
12258,
1159,
13,
4706,
1596,
29898,
29888,
29908,
418,
302,
29918,
845,
11603,
29901,
426,
2435,
29898,
16202,
29889,
845,
11603,
29961,
3259,
2314,
27195,
13,
4706,
1596,
29898,
29888,
29908,
418,
1029,
29887,
29918,
19488,
29901,
426,
16202,
29889,
19488,
29879,
29961,
3259,
1822,
12676,
580,
27195,
13,
4706,
1596,
29898,
29888,
29908,
418,
4236,
29918,
19488,
29901,
426,
16202,
29889,
19488,
29879,
29961,
3259,
1822,
3317,
580,
27195,
13,
13,
13,
1753,
6492,
29918,
9012,
29918,
392,
29918,
1403,
324,
1144,
29898,
13,
1678,
599,
29918,
3259,
29918,
16202,
29901,
360,
919,
29961,
710,
29892,
10079,
25060,
1402,
29871,
396,
426,
3259,
29901,
1873,
29918,
16202,
29913,
13,
1678,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29901,
360,
919,
29961,
13,
4706,
851,
29892,
18981,
1542,
25060,
13,
1678,
21251,
29871,
396,
426,
10314,
29918,
1853,
29901,
6503,
29918,
1853,
29918,
16202,
29913,
13,
29897,
1599,
748,
29889,
13080,
545,
29901,
13,
1678,
9995,
13,
1678,
1858,
1862,
29871,
29906,
1014,
1003,
1973,
297,
29871,
29896,
1897,
13,
1678,
2246,
1948,
29901,
263,
313,
3259,
29892,
302,
29918,
845,
11603,
29897,
1196,
639,
6503,
1134,
13,
1678,
2246,
1948,
29901,
263,
313,
3259,
29892,
302,
29918,
845,
11603,
29897,
5537,
262,
639,
1873,
13,
1678,
5970,
1948,
29901,
263,
313,
3259,
29892,
10809,
29879,
29897,
5537,
262,
639,
1873,
13,
1678,
9995,
13,
1678,
396,
1207,
263,
4377,
411,
29871,
29906,
4206,
322,
29871,
29896,
1897,
13,
1678,
2537,
353,
1207,
29918,
1491,
26762,
29898,
13,
4706,
4206,
29922,
29906,
29892,
13,
4706,
28730,
29922,
29896,
29892,
13,
4706,
7258,
29918,
29916,
1165,
267,
29922,
5574,
29892,
13,
4706,
11408,
29918,
1028,
9390,
29922,
29900,
29889,
29900,
29945,
29892,
13,
4706,
1014,
5317,
29918,
23545,
793,
29922,
703,
613,
376,
4968,
13,
1678,
1723,
13,
1678,
396,
3858,
278,
4377,
13,
1678,
2537,
29889,
5504,
29918,
2680,
29898,
13,
4706,
3611,
29918,
726,
543,
6848,
2043,
962,
28611,
669,
405,
342,
292,
4587,
383,
29950,
8193,
10138,
1080,
613,
13,
4706,
921,
8990,
29918,
3257,
543,
5634,
383,
29950,
8193,
10079,
11474,
29958,
9162,
13,
4706,
343,
8990,
29918,
3257,
543,
3981,
613,
13,
4706,
2920,
29922,
29896,
29900,
29900,
29900,
29892,
13,
4706,
3171,
29922,
29947,
29900,
29900,
29892,
13,
1678,
1723,
13,
1678,
396,
1207,
278,
2246,
1948,
13,
1678,
396,
788,
263,
313,
3259,
29892,
302,
29918,
845,
11603,
29897,
1196,
639,
6503,
29918,
1853,
13,
1678,
363,
6503,
29918,
1853,
29892,
6503,
29918,
1853,
29918,
16202,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
7076,
7295,
13,
4706,
2537,
29889,
1202,
29918,
15003,
29898,
13,
9651,
748,
29889,
4421,
2620,
29898,
13,
18884,
921,
29922,
1761,
29898,
10314,
29918,
1853,
29918,
16202,
29889,
2798,
29879,
29889,
8149,
25739,
13,
18884,
343,
29922,
1761,
29898,
13,
462,
1678,
7431,
29898,
10314,
29918,
1853,
29918,
16202,
29889,
845,
11603,
29961,
3259,
2314,
13,
462,
1678,
363,
1873,
297,
6503,
29918,
1853,
29918,
16202,
29889,
2798,
29879,
29889,
8149,
580,
13,
18884,
10353,
13,
18884,
4464,
543,
9012,
613,
13,
18884,
1024,
29922,
10314,
29918,
1853,
29892,
13,
9651,
10353,
13,
9651,
1948,
29922,
29896,
29892,
13,
9651,
784,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
396,
3858,
278,
2246,
1948,
13,
1678,
2537,
29889,
5504,
29918,
29891,
1165,
267,
29898,
13,
4706,
3611,
29918,
726,
543,
7713,
962,
28611,
847,
396,
853,
1387,
1383,
11603,
313,
13609,
338,
2253,
19123,
1948,
29922,
29896,
29892,
784,
29922,
29896,
13,
1678,
1723,
13,
1678,
396,
788,
263,
313,
3259,
29892,
302,
29918,
845,
11603,
29897,
5537,
262,
639,
1873,
13,
1678,
11955,
353,
8853,
22992,
29884,
29906,
1115,
376,
1127,
613,
376,
303,
29884,
29941,
1115,
376,
12692,
613,
376,
29878,
29946,
1115,
376,
9539,
9092,
13,
1678,
363,
1873,
29892,
1873,
29918,
16202,
297,
599,
29918,
3259,
29918,
16202,
29889,
7076,
7295,
13,
4706,
396,
2318,
491,
1873,
13,
4706,
302,
29918,
845,
11603,
353,
1051,
29898,
1958,
29898,
2435,
29892,
1873,
29918,
16202,
29889,
845,
11603,
29889,
5975,
22130,
13,
4706,
2537,
29889,
1202,
29918,
15003,
29898,
13,
9651,
748,
29889,
29963,
29875,
22878,
29898,
13,
18884,
921,
11759,
3259,
29962,
334,
7431,
29898,
29876,
29918,
845,
11603,
511,
13,
18884,
343,
29922,
29876,
29918,
845,
11603,
29892,
13,
18884,
1024,
29922,
3259,
29892,
13,
18884,
17456,
29918,
2780,
29922,
27703,
29961,
3259,
1402,
13,
18884,
1510,
26172,
29922,
8824,
29892,
13,
18884,
15983,
2972,
29922,
3259,
29892,
13,
9651,
10353,
13,
9651,
1948,
29922,
29896,
29892,
13,
9651,
784,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
396,
1207,
278,
5970,
1948,
13,
1678,
396,
788,
263,
313,
3259,
29892,
10809,
29879,
29897,
5537,
262,
639,
1873,
13,
1678,
363,
1873,
29892,
1873,
29918,
16202,
297,
599,
29918,
3259,
29918,
16202,
29889,
7076,
7295,
13,
4706,
396,
2318,
599,
278,
10809,
29879,
363,
599,
278,
6503,
29918,
8768,
310,
445,
1873,
13,
4706,
10809,
29879,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
9651,
518,
13,
18884,
1873,
29918,
16202,
29889,
19488,
29879,
29961,
10314,
29918,
1853,
29962,
13,
18884,
363,
6503,
29918,
1853,
297,
1873,
29918,
16202,
29889,
2798,
29879,
29889,
8149,
580,
13,
9651,
4514,
13,
4706,
1723,
13,
4706,
2537,
29889,
1202,
29918,
15003,
29898,
13,
9651,
748,
29889,
29963,
29875,
22878,
29898,
13,
18884,
921,
11759,
3259,
29962,
334,
7431,
29898,
19488,
29879,
511,
13,
18884,
343,
29922,
19488,
29879,
29892,
13,
18884,
1024,
29922,
3259,
29892,
13,
18884,
17456,
29918,
2780,
29922,
27703,
29961,
3259,
1402,
13,
18884,
15983,
2972,
29922,
3259,
29892,
13,
9651,
10353,
13,
9651,
1948,
29922,
29906,
29892,
13,
9651,
784,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
396,
3858,
278,
5970,
1948,
13,
1678,
2537,
29889,
5504,
29918,
29891,
1165,
267,
29898,
3257,
29918,
726,
543,
29940,
342,
292,
847,
951,
2142,
10034,
386,
313,
13609,
338,
2253,
19123,
1948,
29922,
29906,
29892,
784,
29922,
29896,
29897,
13,
1678,
736,
2537,
13,
13,
13,
1753,
6492,
29918,
28408,
29898,
13,
1678,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29901,
360,
919,
29961,
13,
4706,
851,
29892,
18981,
1542,
25060,
13,
1678,
21251,
29871,
396,
426,
10314,
29918,
1853,
29901,
6503,
29918,
1853,
29918,
16202,
29913,
13,
29897,
1599,
748,
29889,
13080,
545,
29901,
13,
1678,
9995,
13,
1678,
1858,
1862,
29871,
29906,
1014,
1003,
1973,
297,
29871,
29896,
1897,
13,
1678,
2246,
1948,
29901,
263,
313,
10314,
29918,
1853,
29892,
302,
29918,
845,
11603,
29897,
2594,
2318,
639,
6503,
29918,
1853,
29892,
697,
2594,
639,
1873,
13,
1678,
5970,
1948,
29901,
263,
313,
10314,
29918,
1853,
29892,
10809,
29879,
29897,
3800,
6492,
2318,
639,
6503,
29918,
1853,
29892,
697,
3800,
639,
1873,
13,
1678,
9995,
13,
1678,
396,
1207,
263,
4377,
411,
29871,
29906,
4206,
322,
29871,
29896,
1897,
13,
1678,
2537,
353,
1207,
29918,
1491,
26762,
29898,
13,
4706,
4206,
29922,
29906,
29892,
13,
4706,
28730,
29922,
29896,
29892,
13,
4706,
7258,
29918,
29916,
1165,
267,
29922,
5574,
29892,
13,
4706,
11408,
29918,
1028,
9390,
29922,
29900,
29889,
29900,
29945,
29892,
13,
4706,
1014,
5317,
29918,
23545,
793,
29922,
703,
613,
376,
4968,
13,
1678,
1723,
13,
1678,
396,
3858,
278,
4377,
13,
1678,
2537,
29889,
5504,
29918,
2680,
29898,
13,
4706,
3611,
29918,
726,
543,
7713,
962,
28611,
669,
405,
342,
292,
4587,
383,
29950,
8193,
18981,
28025,
613,
13,
4706,
921,
8990,
29918,
3257,
543,
6848,
5167,
613,
13,
4706,
343,
8990,
29918,
3257,
543,
3981,
613,
13,
4706,
2594,
8513,
543,
2972,
613,
13,
4706,
2920,
29922,
29896,
29900,
29900,
29900,
29892,
13,
4706,
3171,
29922,
29947,
29900,
29900,
29892,
13,
1678,
1723,
13,
1678,
11955,
353,
8853,
22992,
29884,
29906,
1115,
376,
1127,
613,
376,
303,
29884,
29941,
1115,
376,
12692,
613,
376,
29878,
29946,
1115,
376,
9539,
9092,
13,
1678,
396,
1207,
278,
2246,
1948,
13,
1678,
396,
788,
263,
313,
10314,
29918,
1853,
29892,
302,
29918,
845,
11603,
29897,
2594,
2318,
639,
6503,
29918,
1853,
29892,
697,
2594,
639,
1873,
13,
1678,
363,
1873,
297,
11955,
29889,
8149,
7295,
13,
4706,
921,
353,
518,
13,
9651,
6503,
29918,
1853,
13,
9651,
363,
6503,
29918,
1853,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
8149,
580,
13,
9651,
565,
1873,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
10314,
29918,
1853,
1822,
2798,
29879,
13,
4706,
4514,
13,
4706,
343,
353,
518,
13,
9651,
7431,
29898,
10314,
29918,
1853,
29918,
16202,
29889,
845,
11603,
29961,
3259,
2314,
13,
9651,
363,
6503,
29918,
1853,
29918,
16202,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
5975,
580,
13,
9651,
565,
1873,
297,
6503,
29918,
1853,
29918,
16202,
29889,
2798,
29879,
13,
4706,
4514,
13,
4706,
2537,
29889,
1202,
29918,
15003,
29898,
13,
9651,
748,
29889,
4297,
29898,
13,
18884,
1024,
29922,
3259,
29892,
13,
18884,
921,
29922,
29916,
29892,
13,
18884,
343,
29922,
29891,
29892,
13,
18884,
17456,
29918,
2780,
29922,
27703,
29961,
3259,
1402,
13,
18884,
15983,
2972,
29922,
3259,
29892,
13,
9651,
10353,
13,
9651,
1948,
29922,
29896,
29892,
13,
9651,
784,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
396,
3858,
278,
2246,
1948,
13,
1678,
2537,
29889,
5504,
29918,
29891,
1165,
267,
29898,
13,
4706,
3611,
29918,
726,
543,
7713,
962,
28611,
847,
396,
853,
1387,
1383,
11603,
313,
13609,
338,
2253,
19123,
1948,
29922,
29896,
29892,
784,
29922,
29896,
13,
1678,
1723,
13,
1678,
396,
788,
263,
313,
10314,
29918,
1853,
29892,
10809,
29879,
29897,
2594,
2318,
639,
6503,
29918,
1853,
29892,
697,
3800,
639,
1873,
13,
1678,
363,
1873,
297,
11955,
29889,
8149,
7295,
13,
4706,
921,
353,
518,
13,
9651,
6503,
29918,
1853,
13,
9651,
363,
6503,
29918,
1853,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
8149,
580,
13,
9651,
565,
1873,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
10314,
29918,
1853,
1822,
2798,
29879,
13,
4706,
4514,
13,
4706,
343,
353,
518,
13,
9651,
6503,
29918,
1853,
29918,
16202,
29889,
19488,
29879,
29961,
3259,
1822,
12676,
580,
13,
9651,
363,
6503,
29918,
1853,
29918,
16202,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
5975,
580,
13,
9651,
565,
1873,
297,
6503,
29918,
1853,
29918,
16202,
29889,
2798,
29879,
13,
4706,
4514,
13,
4706,
2537,
29889,
1202,
29918,
15003,
29898,
13,
9651,
748,
29889,
4297,
29898,
13,
18884,
1024,
29922,
3259,
29892,
13,
18884,
921,
29922,
29916,
29892,
13,
18884,
343,
29922,
29891,
29892,
13,
18884,
17456,
29918,
2780,
29922,
27703,
29961,
3259,
1402,
13,
18884,
15983,
2972,
29922,
3259,
29892,
13,
18884,
1510,
26172,
29922,
8824,
29892,
13,
9651,
10353,
13,
9651,
1948,
29922,
29906,
29892,
13,
9651,
784,
29922,
29896,
29892,
13,
4706,
1723,
13,
1678,
396,
3858,
278,
5970,
1948,
13,
1678,
2537,
29889,
5504,
29918,
29891,
1165,
267,
29898,
13,
4706,
3611,
29918,
726,
543,
29909,
19698,
405,
342,
292,
847,
951,
2142,
10034,
386,
313,
13609,
338,
2253,
19123,
1948,
29922,
29906,
29892,
784,
29922,
29896,
13,
1678,
1723,
13,
1678,
736,
2537,
13,
13,
13,
1753,
1284,
29918,
13762,
303,
29918,
2696,
21043,
29898,
13,
1678,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29901,
360,
919,
29961,
710,
29892,
18981,
1542,
25060,
1402,
13,
1678,
1873,
29901,
851,
29892,
13,
29897,
1599,
360,
919,
29961,
710,
29892,
18981,
1542,
25060,
5387,
13,
1678,
9995,
13,
1678,
10987,
29879,
278,
6503,
4072,
411,
278,
17322,
24324,
5676,
292,
322,
17763,
292,
13,
1678,
9995,
13,
1678,
396,
1284,
278,
6503,
1134,
411,
278,
1556,
1353,
310,
25834,
13,
1678,
1556,
29918,
3733,
962,
5676,
293,
29918,
10314,
29918,
1853,
353,
6213,
13,
1678,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
12676,
353,
6213,
13,
1678,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
3317,
353,
6213,
13,
1678,
363,
6503,
29918,
1853,
29892,
6503,
29918,
1853,
29918,
16202,
297,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29889,
7076,
7295,
13,
4706,
565,
1873,
451,
297,
6503,
29918,
1853,
29918,
16202,
29889,
2798,
29879,
29901,
13,
9651,
6773,
13,
4706,
25834,
353,
6503,
29918,
1853,
29918,
16202,
29889,
845,
11603,
29961,
3259,
29962,
13,
4706,
10809,
29879,
353,
6503,
29918,
1853,
29918,
16202,
29889,
19488,
29879,
29961,
3259,
29962,
13,
4706,
565,
1556,
29918,
3733,
962,
5676,
293,
29918,
10314,
29918,
1853,
338,
6213,
470,
7431,
29898,
845,
11603,
29897,
1405,
7431,
29898,
13,
9651,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
3242,
29918,
3733,
962,
5676,
293,
29918,
10314,
29918,
1853,
1822,
845,
11603,
29961,
3259,
29962,
13,
308,
1125,
13,
9651,
1556,
29918,
3733,
962,
5676,
293,
29918,
10314,
29918,
1853,
353,
6503,
29918,
1853,
13,
4706,
565,
313,
13,
9651,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
12676,
338,
6213,
13,
9651,
470,
10809,
29879,
29889,
12676,
580,
13,
9651,
1405,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
24535,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
12676,
29962,
13,
9651,
869,
19488,
29879,
29961,
3259,
29962,
13,
9651,
869,
12676,
580,
13,
308,
1125,
13,
9651,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
12676,
353,
6503,
29918,
1853,
13,
4706,
565,
313,
13,
9651,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
3317,
338,
6213,
13,
9651,
470,
10809,
29879,
29889,
3317,
580,
13,
9651,
1405,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
24535,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
3317,
29962,
13,
9651,
869,
19488,
29879,
29961,
3259,
29962,
13,
9651,
869,
3317,
580,
13,
308,
1125,
13,
9651,
6483,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
3317,
353,
6503,
29918,
1853,
13,
1678,
736,
426,
13,
4706,
376,
3259,
1115,
1873,
29892,
13,
4706,
376,
3242,
29918,
3733,
962,
5676,
293,
1115,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
3242,
29918,
3733,
962,
5676,
293,
29918,
10314,
29918,
1853,
1402,
13,
4706,
376,
24535,
342,
29918,
1609,
29918,
12676,
1115,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
24535,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
12676,
1402,
13,
4706,
376,
24535,
342,
29918,
1609,
29918,
3317,
1115,
599,
29918,
10314,
29918,
1853,
29918,
16202,
29961,
24535,
342,
29918,
10314,
29918,
1853,
29918,
1609,
29918,
3317,
1402,
13,
1678,
500,
13,
13,
13,
29937,
448,
278,
6503,
1134,
411,
278,
1556,
22435,
9696,
848,
29901,
13,
29937,
1954,
6751,
855,
566,
29891,
411,
29871,
29896,
29955,
29955,
1422,
25834,
297,
263,
4559,
310,
29871,
29929,
29955,
29955,
1954,
6751,
855,
566,
29891,
8871,
13,
13,
29937,
448,
278,
6503,
1134,
411,
1556,
24344,
9322,
848,
313,
265,
6588,
1125,
13,
29937,
1954,
6751,
855,
566,
29891,
29892,
607,
6858,
385,
6588,
310,
29871,
29945,
29889,
29941,
6931,
304,
2130,
1269,
20447,
13,
13,
29937,
448,
278,
6503,
1134,
411,
1556,
24344,
9322,
848,
313,
13762,
303,
1206,
1125,
13,
29937,
1222,
9018,
362,
2776,
20841,
1389,
277,
756,
263,
20447,
607,
6858,
29871,
29947,
6931,
304,
2130,
13,
1753,
1510,
29918,
13762,
303,
29918,
2696,
21043,
29898,
13762,
303,
29918,
2696,
21043,
29901,
9657,
29897,
1599,
6213,
29901,
13,
1678,
1873,
353,
17322,
29918,
2696,
21043,
3366,
3259,
3108,
13,
1678,
1596,
29898,
29888,
26732,
29876,
13762,
303,
1283,
21043,
297,
383,
29950,
8193,
426,
3259,
1012,
29876,
1159,
13,
1678,
1556,
29918,
3733,
962,
5676,
293,
353,
17322,
29918,
2696,
21043,
3366,
3242,
29918,
3733,
962,
5676,
293,
3108,
13,
1678,
6503,
29918,
1853,
353,
1556,
29918,
3733,
962,
5676,
293,
29889,
10314,
29918,
1853,
13,
1678,
302,
29918,
845,
11603,
353,
7431,
29898,
3242,
29918,
3733,
962,
5676,
293,
29889,
845,
11603,
29961,
3259,
2314,
13,
1678,
2302,
353,
1556,
29918,
3733,
962,
5676,
293,
29889,
2798,
29879,
29961,
3259,
29962,
13,
1678,
1596,
703,
1552,
6503,
1134,
411,
278,
1556,
22435,
9696,
848,
29901,
1159,
13,
1678,
1596,
29898,
13,
4706,
285,
29908,
29912,
10314,
29918,
1853,
1118,
411,
426,
29876,
29918,
845,
11603,
29913,
5412,
25834,
297,
263,
4559,
310,
426,
2798,
29913,
426,
10314,
29918,
1853,
29913,
8871,
29908,
13,
1678,
1723,
13,
1678,
1596,
580,
13,
1678,
6483,
342,
29918,
1609,
29918,
12676,
353,
17322,
29918,
2696,
21043,
3366,
24535,
342,
29918,
1609,
29918,
12676,
3108,
13,
1678,
6503,
29918,
1853,
353,
6483,
342,
29918,
1609,
29918,
12676,
29889,
10314,
29918,
1853,
13,
1678,
2099,
29918,
19488,
353,
6483,
342,
29918,
1609,
29918,
12676,
29889,
19488,
29879,
29961,
3259,
1822,
12676,
580,
13,
1678,
1596,
703,
1552,
6503,
1134,
411,
1556,
24344,
9322,
848,
313,
265,
6588,
1125,
1159,
13,
1678,
1596,
29898,
13,
4706,
285,
29908,
29912,
10314,
29918,
1853,
1118,
607,
6858,
385,
6588,
310,
426,
12676,
29918,
19488,
29913,
6931,
304,
2130,
1269,
20447,
29908,
13,
1678,
1723,
13,
1678,
1596,
580,
13,
1678,
6483,
342,
29918,
1609,
29918,
3317,
353,
17322,
29918,
2696,
21043,
3366,
24535,
342,
29918,
1609,
29918,
3317,
3108,
13,
1678,
6503,
29918,
1853,
353,
6483,
342,
29918,
1609,
29918,
3317,
29889,
10314,
29918,
1853,
13,
1678,
4236,
29918,
19488,
353,
6483,
342,
29918,
1609,
29918,
3317,
29889,
19488,
29879,
29961,
3259,
1822,
3317,
580,
13,
1678,
1596,
703,
1552,
6503,
1134,
411,
1556,
24344,
9322,
848,
313,
13762,
303,
1206,
1125,
1159,
13,
1678,
1596,
29898,
13,
4706,
285,
29908,
29912,
10314,
29918,
1853,
1118,
607,
756,
263,
20447,
607,
6858,
426,
3317,
29918,
19488,
29913,
6931,
304,
2130,
29908,
13,
1678,
1723,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1873,
29918,
16202,
353,
426,
13,
4706,
1873,
29901,
679,
29918,
3259,
29918,
16202,
29898,
3259,
29892,
302,
29918,
5031,
10070,
29922,
29940,
29918,
29925,
1299,
29902,
3919,
29903,
29897,
13,
4706,
363,
1873,
297,
478,
1001,
13381,
29903,
13,
1678,
500,
13,
1678,
6503,
29918,
16202,
353,
679,
29918,
10314,
29918,
16202,
29898,
3259,
29918,
16202,
29897,
13,
13,
1678,
396,
304,
1207,
1962,
29889,
3945,
29892,
443,
9342,
445,
322,
1065,
421,
4691,
285,
29882,
381,
29889,
2272,
1405,
1962,
29889,
3945,
29952,
13,
1678,
363,
6503,
29918,
1853,
29892,
6503,
29918,
1853,
29918,
16202,
297,
6503,
29918,
16202,
29889,
7076,
7295,
13,
4706,
1510,
29918,
10314,
29918,
16202,
29898,
10314,
29918,
1853,
29918,
16202,
29897,
13,
13,
1678,
396,
304,
1207,
17322,
29889,
3945,
29892,
443,
9342,
445,
322,
1065,
421,
4691,
285,
29882,
381,
29889,
2272,
1405,
17322,
29889,
3945,
29952,
13,
1678,
17322,
29918,
2696,
21043,
353,
1284,
29918,
13762,
303,
29918,
2696,
21043,
29898,
10314,
29918,
16202,
29892,
376,
29878,
29946,
1159,
13,
1678,
1510,
29918,
13762,
303,
29918,
2696,
21043,
29898,
13762,
303,
29918,
2696,
21043,
29897,
13,
13,
1678,
396,
304,
1207,
24580,
29892,
443,
9342,
445,
322,
1065,
421,
4691,
285,
29882,
381,
29889,
2272,
29952,
13,
1678,
396,
9177,
29901,
5537,
262,
24580,
526,
5232,
565,
366,
505,
263,
3287,
310,
848,
13,
1678,
3454,
29918,
392,
29918,
1403,
324,
1144,
353,
6492,
29918,
9012,
29918,
392,
29918,
1403,
324,
1144,
29898,
3259,
29918,
16202,
29892,
6503,
29918,
16202,
29897,
13,
1678,
3454,
29918,
392,
29918,
1403,
324,
1144,
29889,
4294,
580,
13,
1678,
396,
3454,
29918,
392,
29918,
1403,
324,
1144,
29889,
3539,
29918,
3027,
703,
1609,
29918,
29888,
29882,
381,
29918,
3259,
29889,
2732,
1159,
13,
1678,
22306,
353,
6492,
29918,
28408,
29898,
10314,
29918,
16202,
29897,
13,
1678,
22306,
29889,
4294,
580,
13,
1678,
396,
22306,
29889,
3539,
29918,
3027,
703,
1609,
29918,
10314,
29918,
1853,
29889,
2732,
1159,
2
] |
tests/unit/utils/test_views.py | rolandgeider/OpenSlides | 0 | 37959 | from unittest import TestCase
from unittest.mock import MagicMock, patch
from openslides.utils import views
@patch('builtins.super')
class SingleObjectMixinTest(TestCase):
def test_get_object_cache(self, mock_super):
"""
Test that the method get_object caches his result.
Tests that get_object from the django view is only called once, even if
get_object on our class is called twice.
"""
view = views.SingleObjectMixin()
view.get_object()
view.get_object()
mock_super().get_object.assert_called_once_with()
def test_dispatch_with_existin_object(self, mock_super):
view = views.SingleObjectMixin()
view.object = 'old_object'
view.get_object = MagicMock()
view.dispatch()
mock_super().dispatch.assert_called_with()
self.assertEqual(
view.object,
'old_object',
"view.object should not be changed")
self.assertFalse(
view.get_object.called,
"view.get_object() should not be called")
def test_dispatch_without_existin_object(self, mock_super):
view = views.SingleObjectMixin()
view.get_object = MagicMock(return_value='new_object')
view.dispatch()
mock_super().dispatch.assert_called_with()
self.assertEqual(
view.object,
'new_object',
"view.object should be changed")
self.assertTrue(
view.get_object.called,
"view.get_object() should be called")
class TestAPIView(TestCase):
def test_class_creation(self):
"""
Tests that the APIView has all relevant methods
"""
http_methods = set(('get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'))
self.assertTrue(
http_methods.issubset(views.APIView.__dict__),
"All http methods should be defined in the APIView")
self.assertFalse(
hasattr(views.APIView, 'method_call'),
"The APIView should not have the method 'method_call'")
class TestCSRFMixin(TestCase):
@patch('builtins.super')
def test_as_view(self, mock_super):
"""
Tests, that ensure_csrf_cookie is called.
"""
mock_super().as_view.return_value = 'super_view'
with patch('openslides.utils.views.ensure_csrf_cookie') as ensure_csrf_cookie:
views.CSRFMixin.as_view()
ensure_csrf_cookie.assert_called_once_with('super_view')
| [
1,
515,
443,
27958,
1053,
4321,
8259,
13,
3166,
443,
27958,
29889,
17640,
1053,
26494,
18680,
29892,
13261,
13,
13,
3166,
13246,
29880,
2247,
29889,
13239,
1053,
8386,
13,
13,
13,
29992,
5041,
877,
16145,
1144,
29889,
9136,
1495,
13,
1990,
16740,
2061,
29924,
861,
262,
3057,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
657,
29918,
3318,
29918,
8173,
29898,
1311,
29892,
11187,
29918,
9136,
1125,
13,
4706,
9995,
13,
4706,
4321,
393,
278,
1158,
679,
29918,
3318,
274,
14520,
670,
1121,
29889,
13,
13,
4706,
4321,
29879,
393,
679,
29918,
3318,
515,
278,
9557,
1776,
338,
871,
2000,
2748,
29892,
1584,
565,
13,
4706,
679,
29918,
3318,
373,
1749,
770,
338,
2000,
8951,
29889,
13,
4706,
9995,
13,
4706,
1776,
353,
8386,
29889,
15771,
2061,
29924,
861,
262,
580,
13,
13,
4706,
1776,
29889,
657,
29918,
3318,
580,
13,
4706,
1776,
29889,
657,
29918,
3318,
580,
13,
13,
4706,
11187,
29918,
9136,
2141,
657,
29918,
3318,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
580,
13,
13,
1678,
822,
1243,
29918,
13369,
29918,
2541,
29918,
28997,
262,
29918,
3318,
29898,
1311,
29892,
11187,
29918,
9136,
1125,
13,
4706,
1776,
353,
8386,
29889,
15771,
2061,
29924,
861,
262,
580,
13,
4706,
1776,
29889,
3318,
353,
525,
1025,
29918,
3318,
29915,
13,
4706,
1776,
29889,
657,
29918,
3318,
353,
26494,
18680,
580,
13,
13,
4706,
1776,
29889,
13369,
580,
13,
13,
4706,
11187,
29918,
9136,
2141,
13369,
29889,
9294,
29918,
13998,
29918,
2541,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1776,
29889,
3318,
29892,
13,
9651,
525,
1025,
29918,
3318,
742,
13,
9651,
376,
1493,
29889,
3318,
881,
451,
367,
3939,
1159,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
1776,
29889,
657,
29918,
3318,
29889,
13998,
29892,
13,
9651,
376,
1493,
29889,
657,
29918,
3318,
580,
881,
451,
367,
2000,
1159,
13,
13,
1678,
822,
1243,
29918,
13369,
29918,
14037,
29918,
28997,
262,
29918,
3318,
29898,
1311,
29892,
11187,
29918,
9136,
1125,
13,
4706,
1776,
353,
8386,
29889,
15771,
2061,
29924,
861,
262,
580,
13,
4706,
1776,
29889,
657,
29918,
3318,
353,
26494,
18680,
29898,
2457,
29918,
1767,
2433,
1482,
29918,
3318,
1495,
13,
13,
4706,
1776,
29889,
13369,
580,
13,
13,
4706,
11187,
29918,
9136,
2141,
13369,
29889,
9294,
29918,
13998,
29918,
2541,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1776,
29889,
3318,
29892,
13,
9651,
525,
1482,
29918,
3318,
742,
13,
9651,
376,
1493,
29889,
3318,
881,
367,
3939,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1776,
29889,
657,
29918,
3318,
29889,
13998,
29892,
13,
9651,
376,
1493,
29889,
657,
29918,
3318,
580,
881,
367,
2000,
1159,
13,
13,
13,
1990,
4321,
8787,
1043,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
1990,
29918,
1037,
362,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
393,
278,
3450,
1043,
756,
599,
8018,
3519,
13,
4706,
9995,
13,
4706,
1732,
29918,
23515,
353,
731,
29898,
877,
657,
742,
525,
2490,
742,
525,
649,
742,
525,
5041,
742,
525,
8143,
742,
525,
2813,
742,
525,
6768,
742,
525,
15003,
8785,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1732,
29918,
23515,
29889,
790,
431,
842,
29898,
7406,
29889,
8787,
1043,
17255,
8977,
1649,
511,
13,
9651,
376,
3596,
1732,
3519,
881,
367,
3342,
297,
278,
3450,
1043,
1159,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
756,
5552,
29898,
7406,
29889,
8787,
1043,
29892,
525,
5696,
29918,
4804,
5477,
13,
9651,
376,
1576,
3450,
1043,
881,
451,
505,
278,
1158,
525,
5696,
29918,
4804,
29915,
1159,
13,
13,
13,
1990,
4321,
9295,
29934,
22192,
861,
262,
29898,
3057,
8259,
1125,
13,
1678,
732,
5041,
877,
16145,
1144,
29889,
9136,
1495,
13,
1678,
822,
1243,
29918,
294,
29918,
1493,
29898,
1311,
29892,
11187,
29918,
9136,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
29892,
393,
9801,
29918,
2395,
9600,
29918,
21509,
338,
2000,
29889,
13,
4706,
9995,
13,
4706,
11187,
29918,
9136,
2141,
294,
29918,
1493,
29889,
2457,
29918,
1767,
353,
525,
9136,
29918,
1493,
29915,
13,
4706,
411,
13261,
877,
22156,
29880,
2247,
29889,
13239,
29889,
7406,
29889,
7469,
29918,
2395,
9600,
29918,
21509,
1495,
408,
9801,
29918,
2395,
9600,
29918,
21509,
29901,
13,
9651,
8386,
29889,
9295,
29934,
22192,
861,
262,
29889,
294,
29918,
1493,
580,
13,
13,
4706,
9801,
29918,
2395,
9600,
29918,
21509,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
877,
9136,
29918,
1493,
1495,
13,
2
] |
parsedmarc/template.py | dwt/dmarc-visualizer | 5 | 144748 | <reponame>dwt/dmarc-visualizer<gh_stars>1-10
#!/usr/bin/env python
import sys
import re
import os
possible_keys = os.environ.keys()
def substituter(match):
string_to_replace = match.group()
environment_variable_name = string_to_replace[1:]
if environment_variable_name in os.environ:
return os.environ[environment_variable_name]
else:
return string_to_replace
with open(sys.argv[1]) as template:
print(re.sub(r'\$\w+', substituter, template.read()))
| [
1,
529,
276,
1112,
420,
29958,
29881,
14554,
29914,
29881,
3034,
29883,
29899,
20119,
3950,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
10876,
13,
5215,
337,
13,
5215,
2897,
13,
13,
27338,
29918,
8149,
353,
2897,
29889,
21813,
29889,
8149,
580,
13,
13,
1753,
5960,
277,
12811,
29898,
4352,
1125,
13,
1678,
1347,
29918,
517,
29918,
6506,
353,
29871,
1993,
29889,
2972,
580,
13,
1678,
5177,
29918,
11918,
29918,
978,
353,
1347,
29918,
517,
29918,
6506,
29961,
29896,
17531,
13,
1678,
565,
5177,
29918,
11918,
29918,
978,
297,
2897,
29889,
21813,
29901,
13,
4706,
736,
2897,
29889,
21813,
29961,
20944,
29918,
11918,
29918,
978,
29962,
13,
1678,
1683,
29901,
13,
4706,
736,
1347,
29918,
517,
29918,
6506,
13,
13,
2541,
1722,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
408,
4472,
29901,
13,
1678,
1596,
29898,
276,
29889,
1491,
29898,
29878,
12764,
4535,
29893,
29974,
742,
5960,
277,
12811,
29892,
4472,
29889,
949,
22130,
13,
2
] |
Python/danger_mouse_game/character_profile.py | jastr945/PDXclass | 0 | 154482 | <filename>Python/danger_mouse_game/character_profile.py
"""
This portion of code begins the game play.
The user gets an introduction to the game
and chooses a major player character.
The code instantiates a Mouse object.
This instantiates an Inventory object
for the Mouse. And the code then adds
two Spell objects to the Mouse's
inventory.
Because the Spells each Mouse character
starts with differ, the choice changes
the game play.
"""
import character, item
import room
import inventory
def create_character():
"""
This function will go at the beginning of the game play.
This function allows a user to choose a major player character from a menu.
:return:
"""
"""
:return:
"""
run_again = True
while run_again == True:
print("""
Welcome to the game Danger Mouse!
Your goal will be to avoid danger
while gathering enough food from
rooms in the castle to last a day.
You will find various spells to
aid you. Keep an eye on your health,
as you will need to eat throughout
the day and also store food to bring
home.
Please choose a character to play:
1. Mortimer - a wise mouse with a
keen understanding of the rats
and dogs who occupy the castle.
2. Sydney - a clever mouse skilled
at hiding and evasion from the rats,
cats, dogs, and people who occupy
the castle.
3. Aster - a brave mouse quick to
cause fright in cats and people
who occupy the castle.
""")
try:
choice = input("Do you choose character 1, 2, or 3?\n:")
if choice == '1' or choice == '2' or choice == '3':
run_again = False
except KeyError:
continue
if choice == '1':
"""
Creates character Mortimer.
"""
befriend_1 = item.Spell("befriend")
befriend_2 = item.Spell("befriend")
char_list = ['Mortimer', 'You are an elderly mouse who\'s body is worn, but who\'s smile is genuine.',
'library', [befriend_1, befriend_2]]
elif choice == '2':
"""
Creates character Sydney.
"""
hide_1 = item.Spell("hide")
hide_2 = item.Spell("hide")
char_list = ['Sydney',
'You try to look at yourself, but you quickly dodge your own gaze and hide in the shadows.',
'nest', [hide_1, hide_2]]
elif choice == '3':
"""
Creates character Aster.
"""
scare_1 = item.Spell("scare")
scare_2 = item.Spell("scare")
char_list = ['Aster',
'Your physical appearance is not notable, but you act with confidence that leaves others intimidated.',
'chapel', [scare_1, scare_2]]
"""
Uses variable player to instantiate a Mouse character and call the needed list of attributes.
Returns the Mouse character.
"""
player = character.Mouse(char_list[0], char_list[1], char_list[2])
player.inventory.put_in_quiet(char_list[3][0])
player.inventory.put_in_quiet(char_list[3][1])
return player
| [
1,
529,
9507,
29958,
11980,
29914,
29881,
4600,
29918,
15769,
29918,
11802,
29914,
18609,
29918,
10185,
29889,
2272,
13,
15945,
29908,
13,
4013,
11910,
310,
775,
16410,
278,
3748,
1708,
29889,
13,
1576,
1404,
4947,
385,
18707,
304,
278,
3748,
13,
392,
3060,
15806,
263,
4655,
4847,
2931,
29889,
13,
13,
1576,
775,
13213,
1078,
263,
25992,
1203,
29889,
13,
4013,
13213,
1078,
385,
512,
23886,
1203,
13,
1454,
278,
25992,
29889,
29871,
1126,
278,
775,
769,
12778,
13,
10184,
1706,
514,
3618,
304,
278,
25992,
29915,
29879,
13,
262,
23886,
29889,
13,
13,
29933,
5658,
278,
1706,
10071,
1269,
25992,
2931,
13,
27382,
411,
1163,
29892,
278,
7348,
3620,
13,
1552,
3748,
1708,
29889,
13,
13,
15945,
29908,
13,
13,
5215,
2931,
29892,
2944,
13,
5215,
5716,
13,
5215,
11817,
706,
13,
13,
13,
1753,
1653,
29918,
18609,
7295,
13,
1678,
9995,
13,
1678,
910,
740,
674,
748,
472,
278,
6763,
310,
278,
3748,
1708,
29889,
13,
1678,
910,
740,
6511,
263,
1404,
304,
6755,
263,
4655,
4847,
2931,
515,
263,
6143,
29889,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
9995,
13,
1678,
584,
2457,
29901,
29871,
13,
1678,
9995,
13,
1678,
1065,
29918,
351,
475,
353,
5852,
13,
1678,
1550,
1065,
29918,
351,
475,
1275,
5852,
29901,
13,
13,
4706,
1596,
703,
15945,
13,
9651,
21829,
304,
278,
3748,
360,
4600,
25992,
29991,
13,
9651,
3575,
7306,
674,
367,
304,
4772,
9703,
13,
9651,
1550,
11705,
292,
3307,
9687,
515,
13,
9651,
19600,
297,
278,
20610,
304,
1833,
263,
2462,
29889,
13,
13,
9651,
887,
674,
1284,
5164,
805,
10071,
304,
13,
9651,
16226,
366,
29889,
29871,
19152,
385,
10977,
373,
596,
9045,
29892,
13,
9651,
408,
366,
674,
817,
304,
17545,
10106,
13,
9651,
278,
2462,
322,
884,
3787,
9687,
304,
6963,
13,
9651,
3271,
29889,
13,
13,
9651,
3529,
6755,
263,
2931,
304,
1708,
29901,
13,
13,
632,
29896,
29889,
15533,
4193,
448,
263,
19396,
9495,
411,
263,
13,
9651,
28430,
8004,
310,
278,
364,
1446,
13,
9651,
322,
26361,
1058,
6919,
29891,
278,
20610,
29889,
13,
13,
632,
29906,
29889,
16198,
448,
263,
23455,
9495,
2071,
24455,
13,
9651,
472,
25508,
322,
3415,
7002,
515,
278,
364,
1446,
29892,
13,
9651,
274,
1446,
29892,
26361,
29892,
322,
2305,
1058,
6919,
29891,
13,
9651,
278,
20610,
29889,
13,
13,
632,
29941,
29889,
319,
2475,
448,
263,
26565,
9495,
4996,
304,
13,
9651,
4556,
22739,
297,
274,
1446,
322,
2305,
13,
9651,
1058,
6919,
29891,
278,
20610,
29889,
13,
13,
9651,
5124,
1159,
13,
13,
4706,
1018,
29901,
13,
9651,
7348,
353,
1881,
703,
6132,
366,
6755,
2931,
29871,
29896,
29892,
29871,
29906,
29892,
470,
29871,
29941,
29973,
29905,
29876,
29901,
1159,
13,
9651,
565,
7348,
1275,
525,
29896,
29915,
470,
7348,
1275,
525,
29906,
29915,
470,
7348,
1275,
525,
29941,
2396,
13,
18884,
1065,
29918,
351,
475,
353,
7700,
13,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
6773,
13,
13,
1678,
565,
7348,
1275,
525,
29896,
2396,
13,
4706,
9995,
13,
9651,
6760,
1078,
2931,
15533,
4193,
29889,
259,
13,
4706,
9995,
13,
4706,
367,
18326,
29918,
29896,
353,
2944,
29889,
5592,
514,
703,
915,
18326,
1159,
13,
4706,
367,
18326,
29918,
29906,
353,
2944,
29889,
5592,
514,
703,
915,
18326,
1159,
13,
4706,
1373,
29918,
1761,
353,
6024,
29924,
441,
4193,
742,
525,
3492,
526,
385,
27008,
368,
9495,
1058,
20333,
29879,
3573,
338,
28043,
29892,
541,
1058,
20333,
29879,
17819,
338,
29120,
457,
29889,
742,
13,
462,
268,
525,
5258,
742,
518,
915,
18326,
29918,
29896,
29892,
367,
18326,
29918,
29906,
5262,
13,
13,
1678,
25342,
7348,
1275,
525,
29906,
2396,
13,
4706,
9995,
13,
9651,
6760,
1078,
2931,
16198,
29889,
13,
4706,
9995,
13,
4706,
9563,
29918,
29896,
353,
2944,
29889,
5592,
514,
703,
11458,
1159,
13,
4706,
9563,
29918,
29906,
353,
2944,
29889,
5592,
514,
703,
11458,
1159,
13,
4706,
1373,
29918,
1761,
353,
6024,
29903,
2941,
3801,
742,
13,
462,
268,
525,
3492,
1018,
304,
1106,
472,
7535,
29892,
541,
366,
9098,
270,
17979,
596,
1914,
12642,
29872,
322,
9563,
297,
278,
528,
23626,
29889,
742,
13,
462,
268,
525,
17510,
742,
518,
11458,
29918,
29896,
29892,
9563,
29918,
29906,
5262,
13,
13,
1678,
25342,
7348,
1275,
525,
29941,
2396,
13,
4706,
9995,
13,
9651,
6760,
1078,
2931,
319,
2475,
29889,
13,
4706,
9995,
13,
4706,
885,
598,
29918,
29896,
353,
2944,
29889,
5592,
514,
703,
1557,
598,
1159,
13,
4706,
885,
598,
29918,
29906,
353,
2944,
29889,
5592,
514,
703,
1557,
598,
1159,
13,
4706,
1373,
29918,
1761,
353,
6024,
29909,
2475,
742,
13,
462,
268,
525,
10858,
9128,
10097,
338,
451,
18697,
29892,
541,
366,
1044,
411,
16420,
393,
11308,
4045,
938,
326,
333,
630,
29889,
742,
13,
462,
268,
525,
305,
481,
295,
742,
518,
1557,
598,
29918,
29896,
29892,
885,
598,
29918,
29906,
5262,
13,
13,
1678,
9995,
13,
1678,
10783,
267,
2286,
4847,
304,
25112,
263,
25992,
2931,
322,
1246,
278,
4312,
1051,
310,
8393,
29889,
13,
1678,
16969,
278,
25992,
2931,
29889,
259,
13,
1678,
9995,
13,
1678,
4847,
353,
2931,
29889,
14346,
29898,
3090,
29918,
1761,
29961,
29900,
1402,
1373,
29918,
1761,
29961,
29896,
1402,
1373,
29918,
1761,
29961,
29906,
2314,
13,
1678,
4847,
29889,
262,
23886,
29889,
649,
29918,
262,
29918,
339,
2035,
29898,
3090,
29918,
1761,
29961,
29941,
3816,
29900,
2314,
13,
1678,
4847,
29889,
262,
23886,
29889,
649,
29918,
262,
29918,
339,
2035,
29898,
3090,
29918,
1761,
29961,
29941,
3816,
29896,
2314,
13,
1678,
736,
4847,
13,
2
] |
src/sims4communitylib/enums/enumtypes/common_int.py | velocist/TS4CheatsInfo | 0 | 56186 | <reponame>velocist/TS4CheatsInfo<gh_stars>0
"""
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from sims4.utils import classproperty
from collections import OrderedDict
from typing import Iterator
# noinspection PyBroadException
try:
# noinspection PyUnresolvedReferences
from enum import Int
except:
# noinspection PyMissingOrEmptyDocstring
class Int:
# noinspection PyPropertyDefinition
@property
def name(self) -> str:
pass
# noinspection PyPropertyDefinition
@property
def value(self) -> int:
pass
# noinspection PyPropertyDefinition,PyMethodParameters
@classproperty
def values(cls) -> Iterator[int]:
pass
# noinspection PyPropertyDefinition,PyMethodParameters
@classproperty
def name_to_value(cls) -> OrderedDict:
pass
# noinspection PyPropertyDefinition,PyMethodParameters
@classproperty
def value_to_name(cls) -> OrderedDict:
pass
class CommonInt(Int):
"""An inheritable class that inherits from the vanilla Sims 4 enum.Int class so you don't have to.
"""
pass
| [
1,
529,
276,
1112,
420,
29958,
955,
542,
391,
29914,
9375,
29946,
26856,
1446,
3401,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
1576,
3439,
29879,
29871,
29946,
19184,
9538,
338,
7794,
21144,
1090,
278,
26635,
3468,
6212,
3224,
29871,
29946,
29889,
29900,
4623,
970,
19405,
313,
4174,
6770,
29871,
29946,
29889,
29900,
467,
13,
991,
597,
1037,
1230,
22382,
29889,
990,
29914,
506,
11259,
29914,
1609,
29914,
29946,
29889,
29900,
29914,
13,
991,
597,
1037,
1230,
22382,
29889,
990,
29914,
506,
11259,
29914,
1609,
29914,
29946,
29889,
29900,
29914,
12018,
401,
13,
13,
11882,
1266,
313,
29883,
29897,
23958,
1164,
5607,
29940,
2692,
15631,
13,
15945,
29908,
13,
3166,
1027,
29879,
29946,
29889,
13239,
1053,
770,
6799,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
3166,
19229,
1053,
20504,
1061,
13,
13,
29937,
694,
1144,
27988,
10772,
29933,
9972,
2451,
13,
2202,
29901,
13,
1678,
396,
694,
1144,
27988,
10772,
2525,
9778,
1490,
1123,
10662,
13,
1678,
515,
14115,
1053,
3159,
13,
19499,
29901,
13,
1678,
396,
694,
1144,
27988,
10772,
18552,
292,
2816,
8915,
14526,
1807,
13,
1678,
770,
3159,
29901,
13,
4706,
396,
694,
1144,
27988,
10772,
4854,
14683,
13,
4706,
732,
6799,
13,
4706,
822,
1024,
29898,
1311,
29897,
1599,
851,
29901,
13,
9651,
1209,
13,
13,
4706,
396,
694,
1144,
27988,
10772,
4854,
14683,
13,
4706,
732,
6799,
13,
4706,
822,
995,
29898,
1311,
29897,
1599,
938,
29901,
13,
9651,
1209,
13,
13,
4706,
396,
694,
1144,
27988,
10772,
4854,
14683,
29892,
19737,
4062,
11507,
13,
4706,
732,
1990,
6799,
13,
4706,
822,
1819,
29898,
25932,
29897,
1599,
20504,
1061,
29961,
524,
5387,
13,
9651,
1209,
13,
13,
4706,
396,
694,
1144,
27988,
10772,
4854,
14683,
29892,
19737,
4062,
11507,
13,
4706,
732,
1990,
6799,
13,
4706,
822,
1024,
29918,
517,
29918,
1767,
29898,
25932,
29897,
1599,
8170,
287,
21533,
29901,
13,
9651,
1209,
13,
13,
4706,
396,
694,
1144,
27988,
10772,
4854,
14683,
29892,
19737,
4062,
11507,
13,
4706,
732,
1990,
6799,
13,
4706,
822,
995,
29918,
517,
29918,
978,
29898,
25932,
29897,
1599,
8170,
287,
21533,
29901,
13,
9651,
1209,
13,
13,
13,
1990,
13103,
2928,
29898,
2928,
1125,
13,
1678,
9995,
2744,
7846,
8270,
770,
393,
7846,
1169,
515,
278,
1109,
2911,
3439,
29879,
29871,
29946,
14115,
29889,
2928,
770,
577,
366,
1016,
29915,
29873,
505,
304,
29889,
13,
13,
1678,
9995,
13,
1678,
1209,
13,
2
] |
bmcs_beam/mxn/scripts/__init__.py | bmcs-group/bmcs_beam | 1 | 26043 | '''
Created on Dec 18, 2016
@author: rch
'''
| [
1,
14550,
13,
20399,
373,
3826,
29871,
29896,
29947,
29892,
29871,
29906,
29900,
29896,
29953,
13,
13,
29992,
8921,
29901,
364,
305,
13,
12008,
13,
2
] |
scripts/snippets/eval-clevr-instance-retrieval/eval-referential.py | Glaciohound/VCML | 52 | 33995 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : eval-referential.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 30.07.2019
# Last Modified Date: 16.10.2019
# Last Modified By : Chi Han, Jiayuan Mao
#
# This file is part of the VCML codebase
# Distributed under MIT license
# -*- coding: utf-8 -*-
# File : eval-referential.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 07/30/2019
#
# This file is part of eval-clevr-instance-retrieval.
# Distributed under terms of the MIT license.
import six
import functools
import sys
from IPython.core import ultratb
import numpy as np
import jacinle.io as io
import jacinle.random as random
from jacinle.cli.argument import JacArgumentParser
from jacinle.utils.tqdm import tqdm_gofor, get_current_tqdm
from jacinle.utils.meter import GroupMeters
sys.excepthook = ultratb.FormattedTB(
mode='Plain', color_scheme='Linux', call_pdb=True)
parser = JacArgumentParser()
parser.add_argument('--scene-json', required=True, type='checked_file')
parser.add_argument('--preds-json', required=True, type='checked_file')
args = parser.parse_args()
class Definition(object):
annotation_attribute_names = ['color', 'material', 'shape', 'size']
annotation_relation_names = ['behind', 'front', 'left', 'right']
concepts = {
'color': ['gray', 'red', 'blue', 'green', 'brown', 'purple', 'cyan', 'yellow'],
'material': ['rubber', 'metal'],
'shape': ['cube', 'sphere', 'cylinder'],
'size': ['small', 'large']
}
concept2attribute = {
v: k for k, vs in concepts.items() for v in vs
}
relational_concepts = {
'spatial_relation': ['left', 'right', 'front', 'behind']
}
synonyms = {
"thing": ["thing", "object"],
"sphere": ["sphere", "ball"],
"cube": ["cube", "block"],
"cylinder": ["cylinder"],
"large": ["large", "big"],
"small": ["small", "tiny"],
"metal": ["metallic", "metal", "shiny"],
"rubber": ["rubber", "matte"],
}
word2lemma = {
v: k for k, vs in synonyms.items() for v in vs
}
def_ = Definition()
def get_desc(obj):
names = [obj[k] for k in def_.annotation_attribute_names]
for i, n in enumerate(names):
if n in def_.synonyms:
names[i] = random.choice_list(def_.synonyms[n])
return names
def run_desc_obj(obj, desc):
for d in desc:
dd = def_.word2lemma.get(d, d)
if dd != obj[def_.concept2attribute[dd]]:
return False
return True
def run_desc_pred(all_preds, desc):
s = 10000
for d in desc:
s = np.fmin(s, all_preds[d])
return s
def test(index, all_objs, all_preds, meter):
obj = all_objs[index]
nr_descriptors = random.randint(1, 3)
desc = random.choice_list(get_desc(obj), size=nr_descriptors)
if isinstance(desc, six.string_types):
desc = [desc]
filtered_objs = [i for i, o in enumerate(all_objs) if not run_desc_obj(o, desc)]
all_scores = run_desc_pred(all_preds, desc)
rank = (all_scores[filtered_objs] > all_scores[index]).sum()
# print(desc)
# print(all_scores)
# print(all_scores[index])
meter.update('r@01', rank <= 1)
meter.update('r@02', rank <= 2)
meter.update('r@03', rank <= 3)
meter.update('r@04', rank <= 4)
meter.update('r@05', rank <= 5)
def transpose_scene(scene):
ret = dict()
for k in scene['0']:
ret[k] = np.array([scene[str(o)][k] for o in range(len(scene))])
return ret
def main():
scenes = io.load_json(args.scene_json)['scenes']
preds = io.load(args.preds_json)
if isinstance(preds, dict):
preds = list(preds.values())
if False:
preds = [transpose_scene(s) for s in preds]
# flattened_objs = [o for s in scenes for o in s['objects']]
# flattened_preds = {
# k: np.concatenate([np.array(p[k]) for p in preds], axis=0)
# for k in preds[0]
# }
meter = GroupMeters()
'''
for i, scene in tqdm_gofor(scenes, mininterval=0.5):
for j in range(len(scene['objects'])):
test(j, scene['objects'], preds[i], meter)
'''
for i, pred in tqdm_gofor(preds, mininterval=0.5):
scene = scenes[i]
for j in range(len(scene['objects'])):
test(j, scene['objects'], pred, meter)
print(meter.format_simple('Results:', compressed=False))
if __name__ == '__main__':
main()
| [
1,
396,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3497,
795,
584,
19745,
29899,
20275,
2556,
29889,
2272,
13,
29937,
13361,
9651,
584,
529,
5813,
10202,
529,
5813,
29958,
13,
29937,
22608,
632,
584,
529,
26862,
6227,
10202,
529,
26862,
6227,
29958,
13,
29937,
4712,
795,
584,
29871,
29941,
29900,
29889,
29900,
29955,
29889,
29906,
29900,
29896,
29929,
13,
29937,
9208,
3382,
2164,
4712,
29901,
29871,
29896,
29953,
29889,
29896,
29900,
29889,
29906,
29900,
29896,
29929,
13,
29937,
9208,
3382,
2164,
2648,
29871,
584,
18168,
7169,
29892,
18122,
388,
12323,
3219,
29877,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
278,
478,
29907,
1988,
775,
3188,
13,
29937,
6652,
7541,
1090,
341,
1806,
19405,
13,
13,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3497,
259,
584,
19745,
29899,
20275,
2556,
29889,
2272,
13,
29937,
13361,
584,
529,
5813,
29958,
13,
29937,
22608,
29871,
584,
529,
26862,
6227,
29958,
13,
29937,
4712,
259,
584,
29871,
29900,
29955,
29914,
29941,
29900,
29914,
29906,
29900,
29896,
29929,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
19745,
29899,
29883,
2608,
29878,
29899,
8758,
29899,
276,
509,
16837,
29889,
13,
29937,
6652,
7541,
1090,
4958,
310,
278,
341,
1806,
19405,
29889,
13,
13,
5215,
4832,
13,
5215,
2090,
312,
8789,
13,
5215,
10876,
13,
3166,
5641,
1656,
29889,
3221,
1053,
9238,
26614,
29890,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
432,
562,
262,
280,
29889,
601,
408,
12013,
13,
5215,
432,
562,
262,
280,
29889,
8172,
408,
4036,
13,
3166,
432,
562,
262,
280,
29889,
11303,
29889,
23516,
1053,
6044,
15730,
11726,
13,
3166,
432,
562,
262,
280,
29889,
13239,
29889,
29873,
29939,
18933,
1053,
260,
29939,
18933,
29918,
29887,
974,
272,
29892,
679,
29918,
3784,
29918,
29873,
29939,
18933,
13,
3166,
432,
562,
262,
280,
29889,
13239,
29889,
29391,
1053,
6431,
29924,
2699,
13,
13,
9675,
29889,
735,
13300,
386,
2550,
353,
9238,
26614,
29890,
29889,
2500,
19667,
24895,
29898,
13,
1678,
4464,
2433,
29925,
7420,
742,
2927,
29918,
816,
2004,
2433,
24085,
742,
1246,
29918,
29886,
2585,
29922,
5574,
29897,
13,
13,
16680,
353,
6044,
15730,
11726,
580,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
24645,
29899,
3126,
742,
3734,
29922,
5574,
29892,
1134,
2433,
11238,
29918,
1445,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
11965,
29879,
29899,
3126,
742,
3734,
29922,
5574,
29892,
1134,
2433,
11238,
29918,
1445,
1495,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13,
1990,
21940,
29898,
3318,
1125,
13,
1678,
17195,
29918,
12715,
29918,
7039,
353,
6024,
2780,
742,
525,
15388,
742,
525,
12181,
742,
525,
2311,
2033,
13,
1678,
17195,
29918,
23445,
29918,
7039,
353,
6024,
915,
16887,
742,
525,
8862,
742,
525,
1563,
742,
525,
1266,
2033,
13,
1678,
22001,
353,
426,
13,
4706,
525,
2780,
2396,
6024,
21012,
742,
525,
1127,
742,
525,
9539,
742,
525,
12692,
742,
525,
29890,
4708,
742,
525,
15503,
552,
742,
525,
1270,
273,
742,
525,
29136,
7464,
13,
4706,
525,
15388,
2396,
6024,
29878,
431,
495,
742,
525,
2527,
284,
7464,
13,
4706,
525,
12181,
2396,
6024,
29883,
4003,
742,
525,
29879,
9085,
742,
525,
1270,
29880,
4995,
7464,
13,
4706,
525,
2311,
2396,
6024,
9278,
742,
525,
16961,
2033,
13,
1678,
500,
13,
1678,
6964,
29906,
12715,
353,
426,
13,
4706,
325,
29901,
413,
363,
413,
29892,
7186,
297,
22001,
29889,
7076,
580,
363,
325,
297,
7186,
13,
1678,
500,
13,
1678,
1104,
1288,
29918,
535,
1547,
29879,
353,
426,
13,
4706,
525,
1028,
15238,
29918,
23445,
2396,
6024,
1563,
742,
525,
1266,
742,
525,
8862,
742,
525,
915,
16887,
2033,
13,
1678,
500,
13,
13,
1678,
5222,
4735,
29879,
353,
426,
13,
4706,
376,
1918,
1115,
6796,
1918,
613,
376,
3318,
12436,
13,
4706,
376,
29879,
9085,
1115,
6796,
29879,
9085,
613,
376,
2135,
12436,
13,
4706,
376,
29883,
4003,
1115,
6796,
29883,
4003,
613,
376,
1271,
12436,
13,
4706,
376,
1270,
29880,
4995,
1115,
6796,
1270,
29880,
4995,
12436,
13,
4706,
376,
16961,
1115,
6796,
16961,
613,
376,
3752,
12436,
13,
4706,
376,
9278,
1115,
6796,
9278,
613,
376,
25649,
12436,
13,
4706,
376,
2527,
284,
1115,
6796,
2527,
497,
293,
613,
376,
2527,
284,
613,
376,
845,
4901,
12436,
13,
4706,
376,
29878,
431,
495,
1115,
6796,
29878,
431,
495,
613,
376,
2922,
371,
12436,
13,
1678,
500,
13,
13,
1678,
1734,
29906,
13846,
353,
426,
13,
4706,
325,
29901,
413,
363,
413,
29892,
7186,
297,
5222,
4735,
29879,
29889,
7076,
580,
363,
325,
297,
7186,
13,
1678,
500,
13,
13,
13,
1753,
29918,
353,
21940,
580,
13,
13,
13,
1753,
679,
29918,
14273,
29898,
5415,
1125,
13,
1678,
2983,
353,
518,
5415,
29961,
29895,
29962,
363,
413,
297,
822,
5396,
18317,
29918,
12715,
29918,
7039,
29962,
13,
1678,
363,
474,
29892,
302,
297,
26985,
29898,
7039,
1125,
13,
4706,
565,
302,
297,
822,
5396,
19274,
4735,
29879,
29901,
13,
9651,
2983,
29961,
29875,
29962,
353,
4036,
29889,
16957,
29918,
1761,
29898,
1753,
5396,
19274,
4735,
29879,
29961,
29876,
2314,
13,
1678,
736,
2983,
13,
13,
13,
1753,
1065,
29918,
14273,
29918,
5415,
29898,
5415,
29892,
5153,
1125,
13,
1678,
363,
270,
297,
5153,
29901,
13,
4706,
24488,
353,
822,
5396,
1742,
29906,
13846,
29889,
657,
29898,
29881,
29892,
270,
29897,
13,
4706,
565,
24488,
2804,
5446,
29961,
1753,
5396,
535,
1547,
29906,
12715,
29961,
1289,
5262,
29901,
13,
9651,
736,
7700,
13,
1678,
736,
5852,
13,
13,
13,
1753,
1065,
29918,
14273,
29918,
11965,
29898,
497,
29918,
11965,
29879,
29892,
5153,
1125,
13,
1678,
269,
353,
29871,
29896,
29900,
29900,
29900,
29900,
13,
1678,
363,
270,
297,
5153,
29901,
13,
4706,
269,
353,
7442,
29889,
29888,
1195,
29898,
29879,
29892,
599,
29918,
11965,
29879,
29961,
29881,
2314,
13,
1678,
736,
269,
13,
13,
13,
1753,
1243,
29898,
2248,
29892,
599,
29918,
711,
1315,
29892,
599,
29918,
11965,
29879,
29892,
11134,
1125,
13,
1678,
5446,
353,
599,
29918,
711,
1315,
29961,
2248,
29962,
13,
1678,
17114,
29918,
2783,
924,
943,
353,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29941,
29897,
13,
1678,
5153,
353,
4036,
29889,
16957,
29918,
1761,
29898,
657,
29918,
14273,
29898,
5415,
511,
2159,
29922,
22230,
29918,
2783,
924,
943,
29897,
13,
1678,
565,
338,
8758,
29898,
14273,
29892,
4832,
29889,
1807,
29918,
8768,
1125,
13,
4706,
5153,
353,
518,
14273,
29962,
13,
13,
1678,
22289,
29918,
711,
1315,
353,
518,
29875,
363,
474,
29892,
288,
297,
26985,
29898,
497,
29918,
711,
1315,
29897,
565,
451,
1065,
29918,
14273,
29918,
5415,
29898,
29877,
29892,
5153,
4638,
13,
1678,
599,
29918,
1557,
2361,
353,
1065,
29918,
14273,
29918,
11965,
29898,
497,
29918,
11965,
29879,
29892,
5153,
29897,
13,
1678,
7115,
353,
313,
497,
29918,
1557,
2361,
29961,
4572,
287,
29918,
711,
1315,
29962,
1405,
599,
29918,
1557,
2361,
29961,
2248,
14664,
2083,
580,
13,
13,
1678,
396,
1596,
29898,
14273,
29897,
13,
1678,
396,
1596,
29898,
497,
29918,
1557,
2361,
29897,
13,
1678,
396,
1596,
29898,
497,
29918,
1557,
2361,
29961,
2248,
2314,
13,
13,
1678,
11134,
29889,
5504,
877,
29878,
29992,
29900,
29896,
742,
7115,
5277,
29871,
29896,
29897,
13,
1678,
11134,
29889,
5504,
877,
29878,
29992,
29900,
29906,
742,
7115,
5277,
29871,
29906,
29897,
13,
1678,
11134,
29889,
5504,
877,
29878,
29992,
29900,
29941,
742,
7115,
5277,
29871,
29941,
29897,
13,
1678,
11134,
29889,
5504,
877,
29878,
29992,
29900,
29946,
742,
7115,
5277,
29871,
29946,
29897,
13,
1678,
11134,
29889,
5504,
877,
29878,
29992,
29900,
29945,
742,
7115,
5277,
29871,
29945,
29897,
13,
13,
13,
1753,
1301,
4220,
29918,
24645,
29898,
24645,
1125,
13,
1678,
3240,
353,
9657,
580,
13,
1678,
363,
413,
297,
9088,
1839,
29900,
2033,
29901,
13,
4706,
3240,
29961,
29895,
29962,
353,
7442,
29889,
2378,
4197,
24645,
29961,
710,
29898,
29877,
29897,
3816,
29895,
29962,
363,
288,
297,
3464,
29898,
2435,
29898,
24645,
876,
2314,
13,
1678,
736,
3240,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
20407,
353,
12013,
29889,
1359,
29918,
3126,
29898,
5085,
29889,
24645,
29918,
3126,
29897,
1839,
1557,
25487,
2033,
13,
1678,
4450,
29879,
353,
12013,
29889,
1359,
29898,
5085,
29889,
11965,
29879,
29918,
3126,
29897,
13,
1678,
565,
338,
8758,
29898,
11965,
29879,
29892,
9657,
1125,
13,
4706,
4450,
29879,
353,
1051,
29898,
11965,
29879,
29889,
5975,
3101,
13,
1678,
565,
7700,
29901,
13,
4706,
4450,
29879,
353,
518,
3286,
4220,
29918,
24645,
29898,
29879,
29897,
363,
269,
297,
4450,
29879,
29962,
13,
13,
1678,
396,
1652,
8606,
287,
29918,
711,
1315,
353,
518,
29877,
363,
269,
297,
20407,
363,
288,
297,
269,
1839,
12650,
2033,
29962,
13,
1678,
396,
1652,
8606,
287,
29918,
11965,
29879,
353,
426,
13,
1678,
396,
268,
413,
29901,
7442,
29889,
535,
29883,
2579,
403,
4197,
9302,
29889,
2378,
29898,
29886,
29961,
29895,
2314,
363,
282,
297,
4450,
29879,
1402,
9685,
29922,
29900,
29897,
13,
1678,
396,
268,
363,
413,
297,
4450,
29879,
29961,
29900,
29962,
13,
1678,
396,
500,
13,
1678,
11134,
353,
6431,
29924,
2699,
580,
13,
13,
1678,
14550,
13,
1678,
363,
474,
29892,
9088,
297,
260,
29939,
18933,
29918,
29887,
974,
272,
29898,
1557,
25487,
29892,
1375,
19207,
29922,
29900,
29889,
29945,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
24645,
1839,
12650,
2033,
22164,
13,
9651,
1243,
29898,
29926,
29892,
9088,
1839,
12650,
7464,
4450,
29879,
29961,
29875,
1402,
11134,
29897,
13,
1678,
14550,
13,
1678,
363,
474,
29892,
4450,
297,
260,
29939,
18933,
29918,
29887,
974,
272,
29898,
11965,
29879,
29892,
1375,
19207,
29922,
29900,
29889,
29945,
1125,
13,
4706,
9088,
353,
20407,
29961,
29875,
29962,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
24645,
1839,
12650,
2033,
22164,
13,
9651,
1243,
29898,
29926,
29892,
9088,
1839,
12650,
7464,
4450,
29892,
11134,
29897,
13,
13,
1678,
1596,
29898,
29391,
29889,
4830,
29918,
12857,
877,
12191,
29901,
742,
419,
13120,
29922,
8824,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
eth/tools/factories/transaction.py | kclowes/py-evm | 0 | 164002 | <gh_stars>0
from eth_utils.toolz import curry
from eth.vm.spoof import (
SpoofTransaction,
)
@curry
def new_transaction(
vm,
from_,
to,
amount=0,
private_key=None,
gas_price=10,
gas=100000,
data=b'',
nonce=None,
chain_id=None):
"""
Create and return a transaction sending amount from <from_> to <to>.
The transaction will be signed with the given private key.
"""
if nonce is None:
nonce = vm.state.get_nonce(from_)
tx = vm.create_unsigned_transaction(
nonce=nonce,
gas_price=gas_price,
gas=gas,
to=to,
value=amount,
data=data,
)
if private_key:
if chain_id is None:
return tx.as_signed_transaction(private_key)
else:
return tx.as_signed_transaction(private_key, chain_id=chain_id)
else:
return SpoofTransaction(tx, from_=from_)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
11314,
29918,
13239,
29889,
10154,
29920,
1053,
3151,
719,
13,
13,
3166,
11314,
29889,
6925,
29889,
1028,
29877,
974,
1053,
313,
13,
1678,
24674,
974,
12460,
29892,
13,
29897,
13,
13,
13,
29992,
2764,
719,
13,
1753,
716,
29918,
20736,
29898,
13,
4706,
22419,
29892,
13,
4706,
515,
3383,
13,
4706,
304,
29892,
13,
4706,
5253,
29922,
29900,
29892,
13,
4706,
2024,
29918,
1989,
29922,
8516,
29892,
13,
4706,
10489,
29918,
9175,
29922,
29896,
29900,
29892,
13,
4706,
10489,
29922,
29896,
29900,
29900,
29900,
29900,
29900,
29892,
13,
4706,
848,
29922,
29890,
29915,
742,
13,
4706,
1661,
346,
29922,
8516,
29892,
13,
4706,
9704,
29918,
333,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
6204,
322,
736,
263,
10804,
9348,
5253,
515,
529,
3166,
29918,
29958,
304,
529,
517,
15513,
13,
13,
1678,
450,
10804,
674,
367,
8794,
411,
278,
2183,
2024,
1820,
29889,
13,
1678,
9995,
13,
1678,
565,
1661,
346,
338,
6213,
29901,
13,
4706,
1661,
346,
353,
22419,
29889,
3859,
29889,
657,
29918,
5464,
346,
29898,
3166,
19925,
13,
13,
1678,
25568,
353,
22419,
29889,
3258,
29918,
15395,
29918,
20736,
29898,
13,
4706,
1661,
346,
29922,
5464,
346,
29892,
13,
4706,
10489,
29918,
9175,
29922,
25496,
29918,
9175,
29892,
13,
4706,
10489,
29922,
25496,
29892,
13,
4706,
304,
29922,
517,
29892,
13,
4706,
995,
29922,
14506,
29892,
13,
4706,
848,
29922,
1272,
29892,
13,
1678,
1723,
13,
1678,
565,
2024,
29918,
1989,
29901,
13,
4706,
565,
9704,
29918,
333,
338,
6213,
29901,
13,
9651,
736,
25568,
29889,
294,
29918,
7433,
29918,
20736,
29898,
9053,
29918,
1989,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
25568,
29889,
294,
29918,
7433,
29918,
20736,
29898,
9053,
29918,
1989,
29892,
9704,
29918,
333,
29922,
14153,
29918,
333,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
24674,
974,
12460,
29898,
7508,
29892,
515,
29918,
29922,
3166,
19925,
13,
2
] |
main.py | jfmaes/transformationsuite | 0 | 113009 | <reponame>jfmaes/transformationsuite
import argparse
from transformer import Transformer
from format import Formatter
from Crypto.Hash import MD5
parser = argparse.ArgumentParser(description="Transformer next generation by jfmaes")
#DONT FORGET TO PUT REQUIRED TRUE
parser.add_argument("-f", "--file", help="the payload file", required=True)
parser.add_argument("-x", "--xor", help="use xor encryption", action="store_true")
parser.add_argument("-key", help="the xor key")
parser.add_argument("-c", "--caesar", help="use caesar cipher", action="store_true")
parser.add_argument("-rotation", help="the rotation to follow, can be + or - ")
parser.add_argument("-b64","-base64","--base64", help= "base 64 encode payload", action="store_true")
parser.add_argument("-rev","--reverse", help= "reverse payload", action="store_true")
parser.add_argument("-o", "--output-file", help="the output file")
parser.add_argument("-vba", help="format to vba", action="store_true")
parser.add_argument("-csharp", help="format to csharp", action="store_true")
parser.add_argument("-cpp", help="format to cpp", action="store_true")
parser.add_argument("-raw", help="format to raw payload", action="store_true")
parser.add_argument("-v", "--verbose", help="print shellcode to terminal", action="store_true")
parser.add_argument("--no-transform", help="doesnt transform payload, just formats.", action="store_true")
def check_args(args):
if args.xor and not args.key:
print(f"[!] XOR encryption needs a key")
quit()
if args.caesar and not args.rotation:
print(f"[!] Caesar encryption needs a rotation")
quit()
if not args.verbose and not args.output_file:
print(f"[!] Your payload needs to go somewhere. Use either verbose or outfile params, or both.")
quit()
def get_shellcode_from_file(inFile):
try:
with open(inFile, "rb") as shellcodeFileHandle:
shellcodeBytes = bytearray(shellcodeFileHandle.read())
shellcodeFileHandle.close()
print (f"[*] Payload file [{inFile}] successfully loaded")
except IOError:
print(f"[!] Could not open or read file [{inFile}]")
quit()
print("[*] MD5 hash of the initial payload: [{}]".format(MD5.new(shellcodeBytes).hexdigest()))
print("[*] Payload size: [{}] bytes".format(len(shellcodeBytes)))
return shellcodeBytes
def main(args):
transformer = Transformer()
formatter = Formatter()
data = get_shellcode_from_file(args.file)
transform_blob = transformer.transform(args, data)
if not args.no_transform:
formatter.format(args, transform_blob)
if args.no_transform:
formatter.format(args, data)
if __name__ == '__main__':
args = parser.parse_args()
check_args(args)
main(args)
| [
1,
529,
276,
1112,
420,
29958,
29926,
29888,
655,
267,
29914,
9067,
800,
29884,
568,
13,
5215,
1852,
5510,
30004,
13,
3166,
4327,
261,
1053,
4103,
24784,
30004,
13,
3166,
3402,
1053,
3812,
2620,
30004,
13,
3166,
315,
17929,
29889,
10438,
1053,
20672,
29945,
30004,
13,
30004,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
13372,
261,
2446,
12623,
491,
432,
29888,
655,
267,
1159,
30004,
13,
29937,
29928,
1164,
29911,
15842,
7194,
7495,
349,
2692,
5195,
29984,
3120,
19386,
15676,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29888,
613,
376,
489,
1445,
613,
1371,
543,
1552,
20092,
934,
613,
3734,
29922,
5574,
8443,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29916,
613,
376,
489,
29916,
272,
613,
1371,
543,
1509,
921,
272,
20956,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
1989,
613,
1371,
543,
1552,
921,
272,
1820,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29883,
613,
376,
489,
1113,
26892,
613,
1371,
543,
1509,
5777,
26892,
4583,
8096,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
5450,
362,
613,
1371,
543,
1552,
13733,
304,
1101,
29892,
508,
367,
718,
470,
448,
376,
8443,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29890,
29953,
29946,
3284,
29899,
3188,
29953,
29946,
3284,
489,
3188,
29953,
29946,
613,
1371,
29922,
376,
3188,
29871,
29953,
29946,
19750,
20092,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
13478,
3284,
489,
24244,
613,
1371,
29922,
376,
24244,
20092,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29877,
613,
376,
489,
4905,
29899,
1445,
613,
1371,
543,
1552,
1962,
934,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29894,
2291,
613,
1371,
543,
4830,
304,
27237,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29883,
22064,
613,
1371,
543,
4830,
304,
274,
22064,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
8223,
613,
1371,
543,
4830,
304,
274,
407,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
1610,
613,
1371,
543,
4830,
304,
10650,
20092,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29894,
613,
376,
489,
369,
15828,
613,
1371,
543,
2158,
6473,
401,
304,
8638,
613,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
1217,
29899,
9067,
613,
1371,
543,
13221,
593,
4327,
20092,
29892,
925,
21971,
19602,
3158,
543,
8899,
29918,
3009,
1159,
30004,
13,
30004,
13,
30004,
13,
1753,
1423,
29918,
5085,
29898,
5085,
1125,
30004,
13,
1678,
565,
6389,
29889,
29916,
272,
322,
451,
6389,
29889,
1989,
29901,
30004,
13,
4706,
1596,
29898,
29888,
29908,
29961,
29991,
29962,
1060,
1955,
20956,
4225,
263,
1820,
1159,
30004,
13,
4706,
23283,
26471,
13,
30004,
13,
1678,
565,
6389,
29889,
1113,
26892,
322,
451,
6389,
29889,
5450,
362,
29901,
30004,
13,
4706,
1596,
29898,
29888,
29908,
29961,
29991,
29962,
9243,
26892,
20956,
4225,
263,
13733,
1159,
30004,
13,
4706,
23283,
26471,
13,
30004,
13,
1678,
565,
451,
6389,
29889,
369,
15828,
322,
451,
6389,
29889,
4905,
29918,
1445,
29901,
30004,
13,
4706,
1596,
29898,
29888,
29908,
29961,
29991,
29962,
3575,
20092,
4225,
304,
748,
9051,
29889,
4803,
2845,
26952,
470,
714,
1445,
8636,
29892,
470,
1716,
23157,
30004,
13,
4706,
23283,
26471,
13,
30004,
13,
1753,
679,
29918,
15903,
401,
29918,
3166,
29918,
1445,
29898,
262,
2283,
1125,
30004,
13,
1678,
1018,
29901,
30004,
13,
4706,
411,
1722,
29898,
262,
2283,
29892,
376,
6050,
1159,
408,
6473,
401,
2283,
13554,
29901,
30004,
13,
9651,
6473,
401,
11207,
353,
7023,
2378,
29898,
15903,
401,
2283,
13554,
29889,
949,
3101,
30004,
13,
9651,
6473,
401,
2283,
13554,
29889,
5358,
26471,
13,
9651,
1596,
313,
29888,
29908,
29961,
29930,
29962,
14617,
1359,
934,
15974,
262,
2283,
6525,
8472,
7500,
1159,
30004,
13,
1678,
5174,
10663,
2392,
29901,
30004,
13,
4706,
1596,
29898,
29888,
29908,
29961,
29991,
29962,
6527,
451,
1722,
470,
1303,
934,
15974,
262,
2283,
6525,
1159,
30004,
13,
4706,
23283,
26471,
13,
1678,
1596,
703,
29961,
29930,
29962,
20672,
29945,
6608,
310,
278,
2847,
20092,
29901,
15974,
6525,
1642,
4830,
29898,
5773,
29945,
29889,
1482,
29898,
15903,
401,
11207,
467,
20970,
7501,
342,
22130,
30004,
13,
1678,
1596,
703,
29961,
29930,
29962,
14617,
1359,
2159,
29901,
15974,
6525,
6262,
1642,
4830,
29898,
2435,
29898,
15903,
401,
11207,
4961,
30004,
13,
1678,
736,
6473,
401,
11207,
30004,
13,
30004,
13,
30004,
13,
1753,
1667,
29898,
5085,
1125,
30004,
13,
1678,
4327,
261,
353,
4103,
24784,
26471,
13,
1678,
883,
2620,
353,
3812,
2620,
26471,
13,
1678,
848,
353,
679,
29918,
15903,
401,
29918,
3166,
29918,
1445,
29898,
5085,
29889,
1445,
8443,
13,
1678,
4327,
29918,
10054,
353,
4327,
261,
29889,
9067,
29898,
5085,
29892,
848,
8443,
13,
1678,
565,
451,
6389,
29889,
1217,
29918,
9067,
29901,
30004,
13,
4706,
883,
2620,
29889,
4830,
29898,
5085,
29892,
4327,
29918,
10054,
8443,
13,
1678,
565,
6389,
29889,
1217,
29918,
9067,
29901,
30004,
13,
4706,
883,
2620,
29889,
4830,
29898,
5085,
29892,
848,
8443,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
26471,
13,
1678,
1423,
29918,
5085,
29898,
5085,
8443,
13,
1678,
1667,
29898,
5085,
8443,
13,
2
] |
departure/provider/tfl_tube/commons.py | Woll78/departure-python | 4 | 60394 | import os
class TflTubeException(Exception):
pass
def check_env_vars():
if "TFL_APP_KEY" not in os.environ:
raise TflTubeException("missing env var TFL_APP_KEY")
| [
1,
1053,
2897,
13,
13,
13,
1990,
323,
1579,
13425,
2451,
29898,
2451,
1125,
13,
1678,
1209,
13,
13,
13,
1753,
1423,
29918,
6272,
29918,
16908,
7295,
13,
1678,
565,
376,
8969,
29931,
29918,
20576,
29918,
10818,
29908,
451,
297,
2897,
29889,
21813,
29901,
13,
4706,
12020,
323,
1579,
13425,
2451,
703,
27259,
8829,
722,
323,
10536,
29918,
20576,
29918,
10818,
1159,
13,
2
] |
dss/stepfunctions/__init__.py | ucsc-cgp/cgp-data-store | 0 | 134594 | import json
import os
import typing
import logging
from dss.util.aws import ARN
from dss.util.aws.clients import stepfunctions # type: ignore
from dss.util.aws import send_sns_msg
"""
The keys used to transfer step function invocation data over SNS to the dss-sfn-* Lambda. dss-sfn starts step function
execution and configured with DLQ for resiliency
"""
SFN_TEMPLATE_KEY = 'sfn_template'
SFN_EXECUTION_KEY = 'sfn_execution'
SFN_INPUT_KEY = 'sfn_input'
region = ARN.get_region()
stage = os.environ["DSS_DEPLOYMENT_STAGE"]
accountid = ARN.get_account_id()
sfn_sns_topic = f"dss-sfn-{stage}"
sfn_sns_topic_arn = f"arn:aws:sns:{region}:{accountid}:{sfn_sns_topic}"
logger = logging.getLogger(__name__)
def step_functions_arn(state_machine_name_template: str) -> str:
"""
The ARN of a state machine, with name derived from `state_machine_name_template`, with string formatting to
replace {stage} with the dss deployment stage.
"""
sfn_name = state_machine_name_template.format(stage=stage)
state_machine_arn = f"arn:aws:states:{region}:{accountid}:stateMachine:{sfn_name}"
return state_machine_arn
def step_functions_execution_arn(state_machine_name_template: str, execution_name: str) -> str:
"""
The ARN of a state machine execution, with name derived from `state_machine_name_template`, with string formatting
to replace {stage} with the dss deployment stage.
"""
sfn_name = state_machine_name_template.format(stage=stage)
state_machine_execution_arn = f"arn:aws:states:{region}:{accountid}:execution:{sfn_name}:{execution_name}"
return state_machine_execution_arn
def step_functions_invoke(state_machine_name_template: str, execution_name: str, input, attributes=None) -> typing.Any:
"""
Invoke a step functions state machine. The name of the state machine to be invoked will be derived from
`state_machine_name_template`, with string formatting to replace {stage} with the dss deployment stage.
"""
message = {
SFN_TEMPLATE_KEY: state_machine_name_template,
SFN_EXECUTION_KEY: execution_name,
SFN_INPUT_KEY: json.dumps(input)
}
logger.debug('Sending message: %s', str(message))
response = send_sns_msg(sfn_sns_topic_arn, message, attributes)
return response
def _step_functions_start_execution(state_machine_name_template: str, execution_name: str,
execution_input: str) -> typing.Any:
"""
Invoke a step functions state machine. The name of the state machine to be invoked will be derived from
`state_machine_name_template`, with string formatting to replace {stage} with the dss deployment stage.
"""
state_machine_arn = step_functions_arn(state_machine_name_template)
response = stepfunctions.start_execution(
stateMachineArn=state_machine_arn,
name=execution_name,
input=execution_input
)
return response
def step_functions_describe_execution(state_machine_name_template: str, execution_name: str) -> typing.Any:
"""
Return description of a step function execution, possible in-progress, completed, errored, etc.
"""
execution_arn = step_functions_execution_arn(state_machine_name_template, execution_name)
resp = stepfunctions.describe_execution(executionArn=execution_arn)
return resp
def step_functions_list_executions(
state_machine_name_template: str,
status_filter: str=None,
max_results_per_page: int=None
) -> typing.Iterable:
"""
List step function executions, performing paging in the background.
"""
state_machine_arn = step_functions_arn(state_machine_name_template)
kwargs = dict(stateMachineArn=state_machine_arn) # type: typing.Dict[str, typing.Any]
if max_results_per_page is not None:
kwargs['maxResults'] = max_results_per_page
if status_filter is not None:
kwargs['statusFilter'] = status_filter
paginator = stepfunctions.get_paginator('list_executions')
page_iterator = paginator.paginate(**kwargs)
for page in page_iterator:
for ex in page['executions']:
yield ex
| [
1,
1053,
4390,
13,
5215,
2897,
13,
5215,
19229,
13,
5215,
12183,
13,
13,
3166,
270,
893,
29889,
4422,
29889,
10467,
1053,
9033,
29940,
13,
3166,
270,
893,
29889,
4422,
29889,
10467,
29889,
11303,
1237,
1053,
4331,
12171,
29871,
396,
1134,
29901,
11455,
13,
3166,
270,
893,
29889,
4422,
29889,
10467,
1053,
3638,
29918,
29879,
1983,
29918,
7645,
13,
13,
15945,
29908,
13,
1576,
6611,
1304,
304,
6782,
4331,
740,
2437,
10610,
848,
975,
317,
3059,
304,
278,
270,
893,
29899,
4668,
29876,
29899,
29930,
365,
2269,
29889,
270,
893,
29899,
4668,
29876,
8665,
4331,
740,
13,
22256,
322,
13252,
411,
360,
29931,
29984,
363,
620,
309,
13396,
13,
15945,
29908,
13,
20322,
29940,
29918,
4330,
3580,
29931,
3040,
29918,
10818,
353,
525,
4668,
29876,
29918,
6886,
29915,
13,
20322,
29940,
29918,
5746,
11206,
2692,
2725,
29918,
10818,
353,
525,
4668,
29876,
29918,
22256,
29915,
13,
20322,
29940,
29918,
1177,
12336,
29918,
10818,
353,
525,
4668,
29876,
29918,
2080,
29915,
13,
13,
12803,
353,
9033,
29940,
29889,
657,
29918,
12803,
580,
13,
19190,
353,
2897,
29889,
21813,
3366,
29928,
1799,
29918,
2287,
29925,
3927,
29979,
13780,
29918,
1254,
10461,
3108,
13,
10149,
333,
353,
9033,
29940,
29889,
657,
29918,
10149,
29918,
333,
580,
13,
13,
4668,
29876,
29918,
29879,
1983,
29918,
13010,
353,
285,
29908,
29881,
893,
29899,
4668,
29876,
29899,
29912,
19190,
5038,
13,
4668,
29876,
29918,
29879,
1983,
29918,
13010,
29918,
2753,
353,
285,
29908,
2753,
29901,
10467,
29901,
29879,
1983,
26254,
12803,
6177,
29912,
10149,
333,
6177,
29912,
4668,
29876,
29918,
29879,
1983,
29918,
13010,
5038,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
4331,
29918,
12171,
29918,
2753,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
13,
1678,
450,
9033,
29940,
310,
263,
2106,
4933,
29892,
411,
1024,
10723,
515,
421,
3859,
29918,
23523,
29918,
978,
29918,
6886,
1673,
411,
1347,
15998,
304,
13,
1678,
5191,
426,
19190,
29913,
411,
278,
270,
893,
18209,
7408,
29889,
13,
1678,
9995,
13,
13,
1678,
269,
9144,
29918,
978,
353,
2106,
29918,
23523,
29918,
978,
29918,
6886,
29889,
4830,
29898,
19190,
29922,
19190,
29897,
13,
1678,
2106,
29918,
23523,
29918,
2753,
353,
285,
29908,
2753,
29901,
10467,
29901,
28631,
26254,
12803,
6177,
29912,
10149,
333,
6177,
3859,
29076,
26254,
4668,
29876,
29918,
978,
5038,
13,
1678,
736,
2106,
29918,
23523,
29918,
2753,
13,
13,
13,
1753,
4331,
29918,
12171,
29918,
22256,
29918,
2753,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29892,
8225,
29918,
978,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
13,
1678,
450,
9033,
29940,
310,
263,
2106,
4933,
8225,
29892,
411,
1024,
10723,
515,
421,
3859,
29918,
23523,
29918,
978,
29918,
6886,
1673,
411,
1347,
15998,
13,
1678,
304,
5191,
426,
19190,
29913,
411,
278,
270,
893,
18209,
7408,
29889,
13,
1678,
9995,
13,
13,
1678,
269,
9144,
29918,
978,
353,
2106,
29918,
23523,
29918,
978,
29918,
6886,
29889,
4830,
29898,
19190,
29922,
19190,
29897,
13,
1678,
2106,
29918,
23523,
29918,
22256,
29918,
2753,
353,
285,
29908,
2753,
29901,
10467,
29901,
28631,
26254,
12803,
6177,
29912,
10149,
333,
6177,
22256,
26254,
4668,
29876,
29918,
978,
6177,
29912,
22256,
29918,
978,
5038,
13,
1678,
736,
2106,
29918,
23523,
29918,
22256,
29918,
2753,
13,
13,
13,
1753,
4331,
29918,
12171,
29918,
9772,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29892,
8225,
29918,
978,
29901,
851,
29892,
1881,
29892,
8393,
29922,
8516,
29897,
1599,
19229,
29889,
10773,
29901,
13,
1678,
9995,
13,
1678,
512,
5744,
263,
4331,
3168,
2106,
4933,
29889,
29871,
450,
1024,
310,
278,
2106,
4933,
304,
367,
22336,
674,
367,
10723,
515,
13,
1678,
421,
3859,
29918,
23523,
29918,
978,
29918,
6886,
1673,
411,
1347,
15998,
304,
5191,
426,
19190,
29913,
411,
278,
270,
893,
18209,
7408,
29889,
13,
1678,
9995,
13,
13,
1678,
2643,
353,
426,
13,
4706,
28768,
29940,
29918,
4330,
3580,
29931,
3040,
29918,
10818,
29901,
2106,
29918,
23523,
29918,
978,
29918,
6886,
29892,
13,
4706,
28768,
29940,
29918,
5746,
11206,
2692,
2725,
29918,
10818,
29901,
8225,
29918,
978,
29892,
13,
4706,
28768,
29940,
29918,
1177,
12336,
29918,
10818,
29901,
4390,
29889,
29881,
17204,
29898,
2080,
29897,
13,
1678,
500,
13,
1678,
17927,
29889,
8382,
877,
29903,
2548,
2643,
29901,
1273,
29879,
742,
851,
29898,
4906,
876,
13,
13,
1678,
2933,
353,
3638,
29918,
29879,
1983,
29918,
7645,
29898,
4668,
29876,
29918,
29879,
1983,
29918,
13010,
29918,
2753,
29892,
2643,
29892,
8393,
29897,
13,
13,
1678,
736,
2933,
13,
13,
13,
1753,
903,
10568,
29918,
12171,
29918,
2962,
29918,
22256,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29892,
8225,
29918,
978,
29901,
851,
29892,
13,
462,
462,
1678,
8225,
29918,
2080,
29901,
851,
29897,
1599,
19229,
29889,
10773,
29901,
13,
1678,
9995,
13,
1678,
512,
5744,
263,
4331,
3168,
2106,
4933,
29889,
29871,
450,
1024,
310,
278,
2106,
4933,
304,
367,
22336,
674,
367,
10723,
515,
13,
1678,
421,
3859,
29918,
23523,
29918,
978,
29918,
6886,
1673,
411,
1347,
15998,
304,
5191,
426,
19190,
29913,
411,
278,
270,
893,
18209,
7408,
29889,
13,
1678,
9995,
13,
13,
1678,
2106,
29918,
23523,
29918,
2753,
353,
4331,
29918,
12171,
29918,
2753,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29897,
13,
13,
1678,
2933,
353,
4331,
12171,
29889,
2962,
29918,
22256,
29898,
13,
4706,
2106,
29076,
1433,
29876,
29922,
3859,
29918,
23523,
29918,
2753,
29892,
13,
4706,
1024,
29922,
22256,
29918,
978,
29892,
13,
4706,
1881,
29922,
22256,
29918,
2080,
13,
1678,
1723,
13,
13,
1678,
736,
2933,
13,
13,
13,
1753,
4331,
29918,
12171,
29918,
2783,
29581,
29918,
22256,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29892,
8225,
29918,
978,
29901,
851,
29897,
1599,
19229,
29889,
10773,
29901,
13,
1678,
9995,
13,
1678,
7106,
6139,
310,
263,
4331,
740,
8225,
29892,
1950,
297,
29899,
18035,
29892,
8676,
29892,
1059,
287,
29892,
2992,
29889,
13,
1678,
9995,
13,
1678,
8225,
29918,
2753,
353,
4331,
29918,
12171,
29918,
22256,
29918,
2753,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29892,
8225,
29918,
978,
29897,
13,
1678,
4613,
353,
4331,
12171,
29889,
2783,
29581,
29918,
22256,
29898,
22256,
1433,
29876,
29922,
22256,
29918,
2753,
29897,
13,
1678,
736,
4613,
13,
13,
13,
1753,
4331,
29918,
12171,
29918,
1761,
29918,
4258,
17925,
29898,
13,
1678,
2106,
29918,
23523,
29918,
978,
29918,
6886,
29901,
851,
29892,
13,
1678,
4660,
29918,
4572,
29901,
851,
29922,
8516,
29892,
13,
1678,
4236,
29918,
9902,
29918,
546,
29918,
3488,
29901,
938,
29922,
8516,
13,
29897,
1599,
19229,
29889,
13463,
519,
29901,
13,
1678,
9995,
13,
1678,
2391,
4331,
740,
8225,
29879,
29892,
15859,
282,
6751,
297,
278,
3239,
29889,
13,
1678,
9995,
13,
13,
1678,
2106,
29918,
23523,
29918,
2753,
353,
4331,
29918,
12171,
29918,
2753,
29898,
3859,
29918,
23523,
29918,
978,
29918,
6886,
29897,
13,
13,
1678,
9049,
5085,
353,
9657,
29898,
3859,
29076,
1433,
29876,
29922,
3859,
29918,
23523,
29918,
2753,
29897,
29871,
396,
1134,
29901,
19229,
29889,
21533,
29961,
710,
29892,
19229,
29889,
10773,
29962,
13,
13,
1678,
565,
4236,
29918,
9902,
29918,
546,
29918,
3488,
338,
451,
6213,
29901,
13,
4706,
9049,
5085,
1839,
3317,
12191,
2033,
353,
4236,
29918,
9902,
29918,
546,
29918,
3488,
13,
13,
1678,
565,
4660,
29918,
4572,
338,
451,
6213,
29901,
13,
4706,
9049,
5085,
1839,
4882,
5072,
2033,
353,
4660,
29918,
4572,
13,
13,
1678,
10203,
262,
1061,
353,
4331,
12171,
29889,
657,
29918,
13573,
262,
1061,
877,
1761,
29918,
4258,
17925,
1495,
13,
1678,
1813,
29918,
17609,
353,
10203,
262,
1061,
29889,
13573,
16976,
29898,
1068,
19290,
29897,
13,
13,
1678,
363,
1813,
297,
1813,
29918,
17609,
29901,
13,
4706,
363,
429,
297,
1813,
1839,
4258,
17925,
2033,
29901,
13,
9651,
7709,
429,
13,
2
] |
acictf/Move ZIG/code.py | benhunter/ctf | 0 | 36164 | #!/usr/bin/python3
import argparse
import socket
import base64
import binascii
# 'argparse' is a very useful library for building python tools that are easy
# to use from the command line. It greatly simplifies the input validation
# and "usage" prompts which really help when trying to debug your own code.
# parser = argparse.ArgumentParser(description="Solver for 'All Your Base' challenge")
# parser.add_argument("ip", help="IP (or hostname) of remote instance")
# parser.add_argument("port", type=int, help="port for remote instance")
# args = parser.parse_args()
ip = 'challenge.acictf.com'
port = 47912
# This tells the computer that we want a new TCP "socket"
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# This says we want to connect to the given IP and port
# socket.connect((args.ip, args.port))
socket.connect((ip, port))
# This gives us a file-like view of the connection which makes reading data
# easier since it handles the buffering of lines for you.
f = socket.makefile()
# while True:
# line = f.readline().strip()
# This iterates over data from the server a line at a time. This can cause
# some unexpected behavior like not seeing "prompts" until after you've sent
# a reply for it (for example, you won't see "answer:" for this problem).
# However, you can still send data and it will be handled correctly.
# Handle the information from the server to extact the problem and build
# the answer string.
# pass # Fill this in with your logic
# Send a response back to the server
# answer = "Clearly not the answer..."
# socket.send((answer + "\n").encode()) # The "\n" is important for the server's
# interpretation of your answer, so make
# sure there is only one sent for each
# answer.
def raw_dec(x):
e = x.encode()
b = bytes(e)
i = int.from_bytes(b, byteorder='big')
return i
def b64_dec(x):
b = base64.b64decode(x)
i = int.from_bytes(b, byteorder='big')
return i
def hex_dec(x):
# return int(binascii.unhexlify(x))
i = int(x, 16)
return i
def oct_dec(x):
d = int(x, 8)
return d
def bin_dec(x):
d = int(x, 2)
return d
def dec_raw(x):
# return str(x)
i = int(x).to_bytes(int(x).bit_length(), byteorder='big').strip(b'\x00')
return i.decode()
def dec_b64(x):
by = x.to_bytes((x.bit_length() + 7) // 8, byteorder='big').strip(b'A')
b64 = base64.b64encode(by)
return b64.decode()
def dec_hex(x):
# by = x.to_bytes(x.bit_length(), byteorder='big')
# h = binascii.hexlify(by)
h = hex(x)
return h[2:]
def dec_oct(x):
o = oct(x)
s = str(o)
return s[2:]
def dec_bin(x):
b = bin(x)
s = str(b)
return s[2:]
# def read_to_dash():
# pass
while True:
line = f.readline().strip()
if len(line) > 1 and line[0] == '-':
break
while True:
line = f.readline().strip().split()
print(line)
encode = line[0]
decode = line[2]
print(encode, decode)
src = f.readline().strip()
print(src)
# src to dec
if encode == 'raw':
dec = raw_dec(src)
elif encode == 'b64':
dec = b64_dec(src)
elif encode == 'hex':
dec = hex_dec(src)
elif encode == 'dec':
dec = int(src)
elif encode == 'oct':
dec = oct_dec(src)
elif encode == 'bin':
dec = bin_dec(src)
# dec to target
if decode == 'raw':
target = dec_raw(dec)
elif decode == 'b64':
target = dec_b64(dec)
elif decode == 'hex':
target = dec_hex(dec)
elif decode == 'dec':
target = str(dec)
elif decode == 'oct':
target = dec_oct(dec)
elif decode == 'bin':
target = dec_bin(dec)
# answer = "Clearly not the answer..."
socket.send((target + "\n").encode()) # The "\n" is important for the server's
# interpretation of your answer, so make
# sure there is only one sent for each
# answer.
line = f.readline().strip()
print(line)
line = f.readline().strip()
print(line)
line = f.readline().strip()
print(line)
if 'incorrect' in line:
print('hold up')
line = f.readline().strip()
print(line)
# ACI{for_great_justice_618c35ec}
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
29941,
13,
5215,
1852,
5510,
13,
5215,
9909,
13,
5215,
2967,
29953,
29946,
13,
5215,
9016,
294,
18869,
13,
13,
29937,
525,
1191,
5510,
29915,
338,
263,
1407,
5407,
3489,
363,
5214,
3017,
8492,
393,
526,
4780,
13,
29937,
304,
671,
515,
278,
1899,
1196,
29889,
29871,
739,
11180,
5466,
11057,
278,
1881,
8845,
13,
29937,
322,
376,
21125,
29908,
9508,
29879,
607,
2289,
1371,
746,
1811,
304,
4744,
596,
1914,
775,
29889,
13,
29937,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
13296,
369,
363,
525,
3596,
3575,
7399,
29915,
18766,
1159,
13,
29937,
13812,
29889,
1202,
29918,
23516,
703,
666,
613,
1371,
543,
5690,
313,
272,
3495,
978,
29897,
310,
7592,
2777,
1159,
13,
29937,
13812,
29889,
1202,
29918,
23516,
703,
637,
613,
1134,
29922,
524,
29892,
1371,
543,
637,
363,
7592,
2777,
1159,
13,
29937,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
666,
353,
525,
305,
11768,
29889,
562,
919,
29888,
29889,
510,
29915,
13,
637,
353,
29871,
29946,
29955,
29929,
29896,
29906,
13,
13,
29937,
910,
10603,
278,
6601,
393,
591,
864,
263,
716,
19374,
376,
11514,
29908,
13,
11514,
353,
9909,
29889,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
1254,
1525,
5194,
29897,
13,
13,
29937,
910,
4083,
591,
864,
304,
4511,
304,
278,
2183,
5641,
322,
2011,
13,
29937,
9909,
29889,
6915,
3552,
5085,
29889,
666,
29892,
6389,
29889,
637,
876,
13,
11514,
29889,
6915,
3552,
666,
29892,
2011,
876,
13,
13,
29937,
910,
4076,
502,
263,
934,
29899,
4561,
1776,
310,
278,
3957,
607,
3732,
5183,
848,
13,
29937,
6775,
1951,
372,
17766,
278,
6835,
292,
310,
3454,
363,
366,
29889,
13,
29888,
353,
9909,
29889,
5675,
1445,
580,
13,
13,
29937,
1550,
5852,
29901,
13,
1678,
396,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
396,
910,
4256,
1078,
975,
848,
515,
278,
1923,
263,
1196,
472,
263,
931,
29889,
29871,
910,
508,
4556,
13,
1678,
396,
777,
15668,
6030,
763,
451,
8790,
376,
14032,
16485,
29908,
2745,
1156,
366,
29915,
345,
2665,
13,
1678,
396,
263,
8908,
363,
372,
313,
1454,
1342,
29892,
366,
2113,
29915,
29873,
1074,
376,
12011,
6160,
363,
445,
1108,
467,
13,
1678,
396,
2398,
29892,
366,
508,
1603,
3638,
848,
322,
372,
674,
367,
16459,
5149,
29889,
13,
13,
1678,
396,
29273,
278,
2472,
515,
278,
1923,
304,
1294,
627,
278,
1108,
322,
2048,
13,
1678,
396,
278,
1234,
1347,
29889,
13,
1678,
396,
1209,
396,
383,
453,
445,
297,
411,
596,
5900,
13,
13,
1678,
396,
15076,
263,
2933,
1250,
304,
278,
1923,
13,
1678,
396,
1234,
353,
376,
18759,
368,
451,
278,
1234,
17794,
13,
1678,
396,
9909,
29889,
6717,
3552,
12011,
718,
6634,
29876,
2564,
12508,
3101,
396,
450,
6634,
29876,
29908,
338,
4100,
363,
278,
1923,
29915,
29879,
13,
462,
462,
268,
396,
19854,
310,
596,
1234,
29892,
577,
1207,
13,
462,
462,
268,
396,
1854,
727,
338,
871,
697,
2665,
363,
1269,
13,
462,
462,
268,
396,
1234,
29889,
13,
13,
1753,
10650,
29918,
7099,
29898,
29916,
1125,
13,
1678,
321,
353,
921,
29889,
12508,
580,
13,
1678,
289,
353,
6262,
29898,
29872,
29897,
13,
1678,
474,
353,
938,
29889,
3166,
29918,
13193,
29898,
29890,
29892,
7023,
2098,
2433,
3752,
1495,
13,
1678,
736,
474,
13,
13,
1753,
289,
29953,
29946,
29918,
7099,
29898,
29916,
1125,
13,
1678,
289,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
13808,
29898,
29916,
29897,
13,
1678,
474,
353,
938,
29889,
3166,
29918,
13193,
29898,
29890,
29892,
7023,
2098,
2433,
3752,
1495,
13,
1678,
736,
474,
13,
13,
1753,
15090,
29918,
7099,
29898,
29916,
1125,
13,
1678,
396,
736,
938,
29898,
2109,
294,
18869,
29889,
348,
354,
15524,
1598,
29898,
29916,
876,
13,
1678,
474,
353,
938,
29898,
29916,
29892,
29871,
29896,
29953,
29897,
13,
1678,
736,
474,
13,
13,
1753,
4725,
29918,
7099,
29898,
29916,
1125,
13,
1678,
270,
353,
938,
29898,
29916,
29892,
29871,
29947,
29897,
13,
1678,
736,
270,
13,
13,
1753,
9016,
29918,
7099,
29898,
29916,
1125,
13,
1678,
270,
353,
938,
29898,
29916,
29892,
29871,
29906,
29897,
13,
1678,
736,
270,
13,
13,
1753,
1602,
29918,
1610,
29898,
29916,
1125,
13,
1678,
396,
736,
851,
29898,
29916,
29897,
13,
1678,
474,
353,
938,
29898,
29916,
467,
517,
29918,
13193,
29898,
524,
29898,
29916,
467,
2966,
29918,
2848,
3285,
7023,
2098,
2433,
3752,
2824,
17010,
29898,
29890,
12764,
29916,
29900,
29900,
1495,
13,
1678,
736,
474,
29889,
13808,
580,
13,
13,
1753,
1602,
29918,
29890,
29953,
29946,
29898,
29916,
1125,
13,
1678,
491,
353,
921,
29889,
517,
29918,
13193,
3552,
29916,
29889,
2966,
29918,
2848,
580,
718,
29871,
29955,
29897,
849,
29871,
29947,
29892,
7023,
2098,
2433,
3752,
2824,
17010,
29898,
29890,
29915,
29909,
1495,
13,
1678,
289,
29953,
29946,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
1609,
29897,
13,
1678,
736,
289,
29953,
29946,
29889,
13808,
580,
13,
13,
1753,
1602,
29918,
20970,
29898,
29916,
1125,
13,
1678,
396,
491,
353,
921,
29889,
517,
29918,
13193,
29898,
29916,
29889,
2966,
29918,
2848,
3285,
7023,
2098,
2433,
3752,
1495,
13,
1678,
396,
298,
353,
9016,
294,
18869,
29889,
354,
15524,
1598,
29898,
1609,
29897,
13,
1678,
298,
353,
15090,
29898,
29916,
29897,
13,
1678,
736,
298,
29961,
29906,
17531,
13,
13,
1753,
1602,
29918,
20082,
29898,
29916,
1125,
13,
1678,
288,
353,
4725,
29898,
29916,
29897,
13,
1678,
269,
353,
851,
29898,
29877,
29897,
13,
1678,
736,
269,
29961,
29906,
17531,
13,
13,
1753,
1602,
29918,
2109,
29898,
29916,
1125,
13,
1678,
289,
353,
9016,
29898,
29916,
29897,
13,
1678,
269,
353,
851,
29898,
29890,
29897,
13,
1678,
736,
269,
29961,
29906,
17531,
13,
13,
29937,
822,
1303,
29918,
517,
29918,
14592,
7295,
13,
29937,
1678,
1209,
13,
13,
13,
8000,
5852,
29901,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
565,
7431,
29898,
1220,
29897,
1405,
29871,
29896,
322,
1196,
29961,
29900,
29962,
1275,
17411,
2396,
13,
4706,
2867,
13,
13,
8000,
5852,
29901,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
2141,
5451,
580,
13,
1678,
1596,
29898,
1220,
29897,
13,
13,
1678,
19750,
353,
1196,
29961,
29900,
29962,
13,
1678,
21822,
353,
1196,
29961,
29906,
29962,
13,
1678,
1596,
29898,
12508,
29892,
21822,
29897,
13,
13,
1678,
4765,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
1596,
29898,
4351,
29897,
13,
13,
1678,
396,
4765,
304,
1602,
13,
1678,
565,
19750,
1275,
525,
1610,
2396,
13,
4706,
1602,
353,
10650,
29918,
7099,
29898,
4351,
29897,
13,
1678,
25342,
19750,
1275,
525,
29890,
29953,
29946,
2396,
13,
4706,
1602,
353,
289,
29953,
29946,
29918,
7099,
29898,
4351,
29897,
13,
1678,
25342,
19750,
1275,
525,
20970,
2396,
13,
4706,
1602,
353,
15090,
29918,
7099,
29898,
4351,
29897,
13,
1678,
25342,
19750,
1275,
525,
7099,
2396,
13,
4706,
1602,
353,
938,
29898,
4351,
29897,
13,
1678,
25342,
19750,
1275,
525,
20082,
2396,
13,
4706,
1602,
353,
4725,
29918,
7099,
29898,
4351,
29897,
13,
1678,
25342,
19750,
1275,
525,
2109,
2396,
13,
4706,
1602,
353,
9016,
29918,
7099,
29898,
4351,
29897,
13,
268,
13,
1678,
396,
1602,
304,
3646,
13,
1678,
565,
21822,
1275,
525,
1610,
2396,
13,
4706,
3646,
353,
1602,
29918,
1610,
29898,
7099,
29897,
13,
1678,
25342,
21822,
1275,
525,
29890,
29953,
29946,
2396,
13,
4706,
3646,
353,
1602,
29918,
29890,
29953,
29946,
29898,
7099,
29897,
13,
1678,
25342,
21822,
1275,
525,
20970,
2396,
13,
4706,
3646,
353,
1602,
29918,
20970,
29898,
7099,
29897,
13,
1678,
25342,
21822,
1275,
525,
7099,
2396,
13,
4706,
3646,
353,
851,
29898,
7099,
29897,
13,
1678,
25342,
21822,
1275,
525,
20082,
2396,
13,
4706,
3646,
353,
1602,
29918,
20082,
29898,
7099,
29897,
13,
1678,
25342,
21822,
1275,
525,
2109,
2396,
13,
4706,
3646,
353,
1602,
29918,
2109,
29898,
7099,
29897,
13,
13,
13,
1678,
396,
1234,
353,
376,
18759,
368,
451,
278,
1234,
17794,
13,
1678,
9909,
29889,
6717,
3552,
5182,
718,
6634,
29876,
2564,
12508,
3101,
29871,
396,
450,
6634,
29876,
29908,
338,
4100,
363,
278,
1923,
29915,
29879,
13,
462,
462,
268,
396,
19854,
310,
596,
1234,
29892,
577,
1207,
13,
462,
462,
268,
396,
1854,
727,
338,
871,
697,
2665,
363,
1269,
13,
462,
462,
268,
396,
1234,
29889,
13,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
1596,
29898,
1220,
29897,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
1596,
29898,
1220,
29897,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
1596,
29898,
1220,
29897,
13,
1678,
565,
525,
262,
15728,
29915,
297,
1196,
29901,
13,
4706,
1596,
877,
8948,
701,
1495,
13,
1678,
1196,
353,
285,
29889,
949,
1220,
2141,
17010,
580,
13,
1678,
1596,
29898,
1220,
29897,
13,
13,
29937,
319,
8426,
29912,
1454,
29918,
7979,
271,
29918,
5143,
625,
29918,
29953,
29896,
29947,
29883,
29941,
29945,
687,
29913,
13,
2
] |
confply/cpp_compiler/options/tool.py | graehu/confply | 0 | 111502 | echo = "echo"
gcc = "gcc"
gpp = "g++"
emcc = "emcc"
empp = "em++"
cl = "cl"
clang = "clang"
clangpp = "clang++"
| [
1,
2916,
353,
376,
8057,
29908,
13,
19644,
353,
376,
19644,
29908,
13,
29887,
407,
353,
376,
29887,
1817,
29908,
13,
331,
617,
353,
376,
331,
617,
29908,
13,
331,
407,
353,
376,
331,
1817,
29908,
13,
695,
353,
376,
695,
29908,
13,
695,
574,
353,
376,
695,
574,
29908,
13,
695,
574,
407,
353,
376,
695,
574,
1817,
29908,
13,
2
] |
plugins/python/test/testCustomEntity.py | shotgunsoftware/cplusplus-api | 3 | 18104 | <gh_stars>1-10
#!/usr/bin/env python
import sys
from shotgun import *
try:
if len(sys.argv) > 1:
sg = Shotgun(sys.argv[1])
else:
sg = Shotgun()
#################################################################
# Find CustomEntity01 entities
#################################################################
print "*" * 40, "findEntities - CustomEntity01", "*" * 40
for entity in sg.findEntities("CustomEntity01", FilterBy(), 5):
#print entity
#print "-" * 40
print "%s : %s" % (entity.sgProjectCode(), entity.getAttrValue("code"))
#################################################################
# Find CustomEntity02 entities
#################################################################
print "*" * 40, "findEntities - CustomEntity02", "*" * 40
for entity in sg.findEntities("CustomEntity02", FilterBy(), 5):
#print entity
#print "-" * 40
print "%s : %s" % (entity.sgProjectCode(), entity.getAttrValue("code"))
except SgError, e:
print "SgError:", e
except Exception, e:
print "Error:", e
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
10876,
13,
3166,
10322,
28798,
1053,
334,
13,
13,
2202,
29901,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29896,
29901,
13,
4706,
269,
29887,
353,
1383,
327,
28798,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
13,
1678,
1683,
29901,
13,
4706,
269,
29887,
353,
1383,
327,
28798,
580,
13,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
1678,
396,
10987,
8701,
6691,
29900,
29896,
16212,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
1678,
1596,
376,
20605,
334,
29871,
29946,
29900,
29892,
376,
2886,
5292,
1907,
448,
8701,
6691,
29900,
29896,
613,
376,
20605,
334,
29871,
29946,
29900,
13,
1678,
363,
7855,
297,
269,
29887,
29889,
2886,
5292,
1907,
703,
7281,
6691,
29900,
29896,
613,
19916,
2059,
3285,
29871,
29945,
1125,
13,
4706,
396,
2158,
7855,
13,
4706,
396,
2158,
11663,
29908,
334,
29871,
29946,
29900,
13,
4706,
1596,
11860,
29879,
584,
1273,
29879,
29908,
1273,
313,
10041,
29889,
5311,
7653,
3399,
3285,
7855,
29889,
657,
25098,
1917,
703,
401,
5783,
13,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
1678,
396,
10987,
8701,
6691,
29900,
29906,
16212,
13,
1678,
835,
13383,
13383,
13383,
7346,
4136,
2277,
13,
1678,
1596,
376,
20605,
334,
29871,
29946,
29900,
29892,
376,
2886,
5292,
1907,
448,
8701,
6691,
29900,
29906,
613,
376,
20605,
334,
29871,
29946,
29900,
13,
1678,
363,
7855,
297,
269,
29887,
29889,
2886,
5292,
1907,
703,
7281,
6691,
29900,
29906,
613,
19916,
2059,
3285,
29871,
29945,
1125,
13,
4706,
396,
2158,
7855,
13,
4706,
396,
2158,
11663,
29908,
334,
29871,
29946,
29900,
13,
4706,
1596,
11860,
29879,
584,
1273,
29879,
29908,
1273,
313,
10041,
29889,
5311,
7653,
3399,
3285,
7855,
29889,
657,
25098,
1917,
703,
401,
5783,
13,
13,
19499,
317,
29887,
2392,
29892,
321,
29901,
13,
1678,
1596,
376,
29903,
29887,
2392,
29901,
613,
321,
13,
19499,
8960,
29892,
321,
29901,
13,
1678,
1596,
376,
2392,
29901,
613,
321,
13,
13,
2
] |
tdd_wallet/views/get_wallet_balance/request_response_mocks.py | kapeed2091/tdd_practice | 0 | 164847 | <filename>tdd_wallet/views/get_wallet_balance/request_response_mocks.py
REQUEST_BODY_JSON = """
{
"customer_ids": [
"string"
]
}
"""
RESPONSE_200_JSON = """
{
"customers_balance": [
{
"balance": 1.1,
"customer_id": "string"
}
]
}
"""
| [
1,
529,
9507,
29958,
29873,
1289,
29918,
14625,
1026,
29914,
7406,
29914,
657,
29918,
14625,
1026,
29918,
5521,
749,
29914,
3827,
29918,
5327,
29918,
17640,
29879,
29889,
2272,
13,
13,
13,
16244,
29918,
8456,
29928,
29979,
29918,
7249,
353,
9995,
13,
29912,
13,
1678,
376,
15539,
29918,
4841,
1115,
518,
13,
4706,
376,
1807,
29908,
13,
1678,
4514,
13,
29913,
13,
15945,
29908,
13,
13,
13,
1525,
5550,
1164,
1660,
29918,
29906,
29900,
29900,
29918,
7249,
353,
9995,
13,
29912,
13,
1678,
376,
6341,
414,
29918,
5521,
749,
1115,
518,
13,
4706,
426,
13,
9651,
376,
5521,
749,
1115,
29871,
29896,
29889,
29896,
29892,
29871,
13,
9651,
376,
15539,
29918,
333,
1115,
376,
1807,
29908,
13,
4706,
500,
13,
1678,
4514,
13,
29913,
13,
15945,
29908,
13,
13,
2
] |
pgmpy/tests/test_models/test_SEM.py | predictive-analytics-lab/pgmpy | 0 | 10592 | <filename>pgmpy/tests/test_models/test_SEM.py
import os
import unittest
import numpy as np
import networkx as nx
import numpy.testing as npt
from pgmpy.models import SEM, SEMGraph, SEMAlg
class TestSEM(unittest.TestCase):
def test_from_graph(self):
self.demo = SEM.from_graph(
ebunch=[
("xi1", "x1"),
("xi1", "x2"),
("xi1", "x3"),
("xi1", "eta1"),
("eta1", "y1"),
("eta1", "y2"),
("eta1", "y3"),
("eta1", "y4"),
("eta1", "eta2"),
("xi1", "eta2"),
("eta2", "y5"),
("eta2", "y6"),
("eta2", "y7"),
("eta2", "y8"),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[
("y1", "y5"),
("y2", "y6"),
("y2", "y4"),
("y3", "y7"),
("y4", "y8"),
("y6", "y8"),
],
)
self.assertSetEqual(self.demo.latents, {"xi1", "eta1", "eta2"})
self.assertSetEqual(
self.demo.observed, {"x1", "x2", "x3", "y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8"}
)
self.assertListEqual(
sorted(self.demo.graph.nodes()),
[
"eta1",
"eta2",
"x1",
"x2",
"x3",
"xi1",
"y1",
"y2",
"y3",
"y4",
"y5",
"y6",
"y7",
"y8",
],
)
self.assertListEqual(
sorted(self.demo.graph.edges()),
sorted(
[
("eta1", "eta2"),
("eta1", "y1"),
("eta1", "y2"),
("eta1", "y3"),
("eta1", "y4"),
("eta2", "y5"),
("eta2", "y6"),
("eta2", "y7"),
("eta2", "y8"),
("xi1", "eta1"),
("xi1", "eta2"),
("xi1", "x1"),
("xi1", "x2"),
("xi1", "x3"),
]
),
)
self.assertDictEqual(self.demo.graph.edges[("xi1", "x1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "x2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "x3")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "eta1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y3")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y4")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "eta2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "eta2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y5")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y6")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y7")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y8")], {"weight": np.NaN})
npt.assert_equal(
nx.to_numpy_matrix(
self.demo.err_graph, nodelist=sorted(self.demo.err_graph.nodes()), weight=None
),
np.array(
[
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0],
]
),
)
for edge in self.demo.err_graph.edges():
self.assertDictEqual(self.demo.err_graph.edges[edge], {"weight": np.NaN})
for node in self.demo.err_graph.nodes():
self.assertDictEqual(self.demo.err_graph.nodes[node], {"weight": np.NaN})
def test_from_lavaan(self):
model_str = """# %load model.lav
# measurement model
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
"""
model_from_str = SEM.from_lavaan(string=model_str)
with open("test_model.lav", "w") as f:
f.write(model_str)
model_from_file = SEM.from_lavaan(filename="test_model.lav")
os.remove("test_model.lav")
expected_edges = set(
[
("ind60", "x1"),
("ind60", "x2"),
("ind60", "x3"),
("ind60", "dem60"),
("ind60", "dem65"),
("dem60", "dem65"),
("dem60", "y1"),
("dem60", "y2"),
("dem60", "y3"),
("dem60", "y4"),
("dem65", "y5"),
("dem65", "y6"),
("dem65", "y7"),
("dem65", "y8"),
]
)
# Undirected Graph, needs to handle when edges returned in reverse.
expected_err_edges = set(
[
("y1", "y5"),
("y5", "y1"),
("y2", "y6"),
("y6", "y2"),
("y2", "y4"),
("y4", "y2"),
("y3", "y7"),
("y7", "y3"),
("y4", "y8"),
("y8", "y4"),
("y6", "y8"),
("y8", "y6"),
]
)
expected_latents = set(["dem60", "dem65", "ind60"])
self.assertEqual(set(model_from_str.graph.edges()), expected_edges)
self.assertEqual(set(model_from_file.graph.edges()), expected_edges)
self.assertFalse(set(model_from_str.err_graph.edges()) - expected_err_edges)
self.assertFalse(set(model_from_file.err_graph.edges()) - expected_err_edges)
self.assertEqual(set(model_from_str.latents), expected_latents)
self.assertEqual(set(model_from_file.latents), expected_latents)
def test_from_lisrel(self):
pass # TODO: Add this test when done writing the tests for SEMAlg
def test_from_ram(self):
pass # TODO: Add this.
class TestSEMGraph(unittest.TestCase):
def setUp(self):
self.demo = SEMGraph(
ebunch=[
("xi1", "x1"),
("xi1", "x2"),
("xi1", "x3"),
("xi1", "eta1"),
("eta1", "y1"),
("eta1", "y2"),
("eta1", "y3"),
("eta1", "y4"),
("eta1", "eta2"),
("xi1", "eta2"),
("eta2", "y5"),
("eta2", "y6"),
("eta2", "y7"),
("eta2", "y8"),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[
("y1", "y5"),
("y2", "y6"),
("y2", "y4"),
("y3", "y7"),
("y4", "y8"),
("y6", "y8"),
],
)
self.union = SEMGraph(
ebunch=[
("yrsmill", "unionsen"),
("age", "laboract"),
("age", "deferenc"),
("deferenc", "laboract"),
("deferenc", "unionsen"),
("laboract", "unionsen"),
],
latents=[],
err_corr=[("yrsmill", "age")],
)
self.demo_params = SEMGraph(
ebunch=[
("xi1", "x1", 0.4),
("xi1", "x2", 0.5),
("xi1", "x3", 0.6),
("xi1", "eta1", 0.3),
("eta1", "y1", 1.1),
("eta1", "y2", 1.2),
("eta1", "y3", 1.3),
("eta1", "y4", 1.4),
("eta1", "eta2", 0.1),
("xi1", "eta2", 0.2),
("eta2", "y5", 0.7),
("eta2", "y6", 0.8),
("eta2", "y7", 0.9),
("eta2", "y8", 1.0),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[
("y1", "y5", 1.5),
("y2", "y6", 1.6),
("y2", "y4", 1.9),
("y3", "y7", 1.7),
("y4", "y8", 1.8),
("y6", "y8", 2.0),
],
err_var={
"y1": 2.1,
"y2": 2.2,
"y3": 2.3,
"y4": 2.4,
"y5": 2.5,
"y6": 2.6,
"y7": 2.7,
"y8": 2.8,
"x1": 3.1,
"x2": 3.2,
"x3": 3.3,
"eta1": 2.9,
"eta2": 3.0,
"xi1": 3.4,
},
)
self.custom = SEMGraph(
ebunch=[
("xi1", "eta1"),
("xi1", "y1"),
("xi1", "y4"),
("xi1", "x1"),
("xi1", "x2"),
("y4", "y1"),
("y1", "eta2"),
("eta2", "y5"),
("y1", "eta1"),
("eta1", "y2"),
("eta1", "y3"),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[("y1", "y2"), ("y2", "y3")],
err_var={},
)
def test_demo_init(self):
self.assertSetEqual(self.demo.latents, {"xi1", "eta1", "eta2"})
self.assertSetEqual(
self.demo.observed, {"x1", "x2", "x3", "y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8"}
)
self.assertListEqual(
sorted(self.demo.graph.nodes()),
[
"eta1",
"eta2",
"x1",
"x2",
"x3",
"xi1",
"y1",
"y2",
"y3",
"y4",
"y5",
"y6",
"y7",
"y8",
],
)
self.assertListEqual(
sorted(self.demo.graph.edges()),
sorted(
[
("eta1", "eta2"),
("eta1", "y1"),
("eta1", "y2"),
("eta1", "y3"),
("eta1", "y4"),
("eta2", "y5"),
("eta2", "y6"),
("eta2", "y7"),
("eta2", "y8"),
("xi1", "eta1"),
("xi1", "eta2"),
("xi1", "x1"),
("xi1", "x2"),
("xi1", "x3"),
]
),
)
self.assertDictEqual(self.demo.graph.edges[("xi1", "x1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "x2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "x3")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "eta1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y1")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y3")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "y4")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta1", "eta2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("xi1", "eta2")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y5")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y6")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y7")], {"weight": np.NaN})
self.assertDictEqual(self.demo.graph.edges[("eta2", "y8")], {"weight": np.NaN})
npt.assert_equal(
nx.to_numpy_matrix(
self.demo.err_graph, nodelist=sorted(self.demo.err_graph.nodes()), weight=None
),
np.array(
[
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0],
]
),
)
for edge in self.demo.err_graph.edges():
self.assertDictEqual(self.demo.err_graph.edges[edge], {"weight": np.NaN})
for node in self.demo.err_graph.nodes():
self.assertDictEqual(self.demo.err_graph.nodes[node], {"weight": np.NaN})
def test_union_init(self):
self.assertSetEqual(self.union.latents, set())
self.assertSetEqual(
self.union.observed, {"yrsmill", "unionsen", "age", "laboract", "deferenc"}
)
self.assertListEqual(
sorted(self.union.graph.nodes()),
sorted(["yrsmill", "unionsen", "age", "laboract", "deferenc"]),
)
self.assertListEqual(
sorted(self.union.graph.edges()),
sorted(
[
("yrsmill", "unionsen"),
("age", "laboract"),
("age", "deferenc"),
("deferenc", "laboract"),
("deferenc", "unionsen"),
("laboract", "unionsen"),
]
),
)
self.assertDictEqual(self.union.graph.edges[("yrsmill", "unionsen")], {"weight": np.NaN})
self.assertDictEqual(self.union.graph.edges[("age", "laboract")], {"weight": np.NaN})
self.assertDictEqual(self.union.graph.edges[("age", "deferenc")], {"weight": np.NaN})
self.assertDictEqual(self.union.graph.edges[("deferenc", "laboract")], {"weight": np.NaN})
self.assertDictEqual(self.union.graph.edges[("deferenc", "unionsen")], {"weight": np.NaN})
self.assertDictEqual(self.union.graph.edges[("laboract", "unionsen")], {"weight": np.NaN})
npt.assert_equal(
nx.to_numpy_matrix(
self.union.err_graph, nodelist=sorted(self.union.err_graph.nodes()), weight=None
),
np.array(
[
[0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0],
]
),
)
for edge in self.union.err_graph.edges():
self.assertDictEqual(self.union.err_graph.edges[edge], {"weight": np.NaN})
for node in self.union.err_graph.nodes():
self.assertDictEqual(self.union.err_graph.nodes[node], {"weight": np.NaN})
def test_demo_param_init(self):
self.assertDictEqual(self.demo_params.graph.edges[("xi1", "x1")], {"weight": 0.4})
self.assertDictEqual(self.demo_params.graph.edges[("xi1", "x2")], {"weight": 0.5})
self.assertDictEqual(self.demo_params.graph.edges[("xi1", "x3")], {"weight": 0.6})
self.assertDictEqual(self.demo_params.graph.edges[("xi1", "eta1")], {"weight": 0.3})
self.assertDictEqual(self.demo_params.graph.edges[("eta1", "y1")], {"weight": 1.1})
self.assertDictEqual(self.demo_params.graph.edges[("eta1", "y2")], {"weight": 1.2})
self.assertDictEqual(self.demo_params.graph.edges[("eta1", "y3")], {"weight": 1.3})
self.assertDictEqual(self.demo_params.graph.edges[("eta1", "y4")], {"weight": 1.4})
self.assertDictEqual(self.demo_params.graph.edges[("eta1", "eta2")], {"weight": 0.1})
self.assertDictEqual(self.demo_params.graph.edges[("xi1", "eta2")], {"weight": 0.2})
self.assertDictEqual(self.demo_params.graph.edges[("eta2", "y5")], {"weight": 0.7})
self.assertDictEqual(self.demo_params.graph.edges[("eta2", "y6")], {"weight": 0.8})
self.assertDictEqual(self.demo_params.graph.edges[("eta2", "y7")], {"weight": 0.9})
self.assertDictEqual(self.demo_params.graph.edges[("eta2", "y8")], {"weight": 1.0})
self.assertDictEqual(self.demo_params.err_graph.edges[("y1", "y5")], {"weight": 1.5})
self.assertDictEqual(self.demo_params.err_graph.edges[("y2", "y6")], {"weight": 1.6})
self.assertDictEqual(self.demo_params.err_graph.edges[("y2", "y4")], {"weight": 1.9})
self.assertDictEqual(self.demo_params.err_graph.edges[("y3", "y7")], {"weight": 1.7})
self.assertDictEqual(self.demo_params.err_graph.edges[("y4", "y8")], {"weight": 1.8})
self.assertDictEqual(self.demo_params.err_graph.edges[("y6", "y8")], {"weight": 2.0})
self.assertDictEqual(self.demo_params.err_graph.nodes["y1"], {"weight": 2.1})
self.assertDictEqual(self.demo_params.err_graph.nodes["y2"], {"weight": 2.2})
self.assertDictEqual(self.demo_params.err_graph.nodes["y3"], {"weight": 2.3})
self.assertDictEqual(self.demo_params.err_graph.nodes["y4"], {"weight": 2.4})
self.assertDictEqual(self.demo_params.err_graph.nodes["y5"], {"weight": 2.5})
self.assertDictEqual(self.demo_params.err_graph.nodes["y6"], {"weight": 2.6})
self.assertDictEqual(self.demo_params.err_graph.nodes["y7"], {"weight": 2.7})
self.assertDictEqual(self.demo_params.err_graph.nodes["y8"], {"weight": 2.8})
self.assertDictEqual(self.demo_params.err_graph.nodes["x1"], {"weight": 3.1})
self.assertDictEqual(self.demo_params.err_graph.nodes["x2"], {"weight": 3.2})
self.assertDictEqual(self.demo_params.err_graph.nodes["x3"], {"weight": 3.3})
self.assertDictEqual(self.demo_params.err_graph.nodes["eta1"], {"weight": 2.9})
self.assertDictEqual(self.demo_params.err_graph.nodes["eta2"], {"weight": 3.0})
def test_get_full_graph_struct(self):
full_struct = self.union._get_full_graph_struct()
self.assertFalse(
set(full_struct.nodes())
- set(
[
"yrsmill",
"unionsen",
"age",
"laboract",
"deferenc",
".yrsmill",
".unionsen",
".age",
".laboract",
".deferenc",
"..ageyrsmill",
"..yrsmillage",
]
)
)
self.assertFalse(
set(full_struct.edges())
- set(
[
("yrsmill", "unionsen"),
("age", "laboract"),
("age", "deferenc"),
("deferenc", "laboract"),
("deferenc", "unionsen"),
("laboract", "unionsen"),
(".yrsmill", "yrsmill"),
(".unionsen", "unionsen"),
(".age", "age"),
(".laboract", "laboract"),
(".deferenc", "deferenc"),
("..ageyrsmill", ".age"),
("..ageyrsmill", ".yrsmill"),
("..yrsmillage", ".age"),
("..yrsmillage", ".yrsmill"),
]
)
)
def test_active_trail_nodes(self):
demo_nodes = ["x1", "x2", "x3", "y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8"]
for node in demo_nodes:
self.assertSetEqual(
self.demo.active_trail_nodes(node, struct="full")[node], set(demo_nodes)
)
union_nodes = self.union.graph.nodes()
active_trails = self.union.active_trail_nodes(list(union_nodes), struct="full")
for node in union_nodes:
self.assertSetEqual(active_trails[node], set(union_nodes))
self.assertSetEqual(
self.union.active_trail_nodes("age", observed=["laboract", "deferenc", "unionsen"])[
"age"
],
{"age", "yrsmill"},
)
def test_get_scaling_indicators(self):
demo_scaling_indicators = self.demo.get_scaling_indicators()
self.assertTrue(demo_scaling_indicators["eta1"] in ["y1", "y2", "y3", "y4"])
self.assertTrue(demo_scaling_indicators["eta2"] in ["y5", "y6", "y7", "y8"])
self.assertTrue(demo_scaling_indicators["xi1"] in ["x1", "x2", "x3"])
union_scaling_indicators = self.union.get_scaling_indicators()
self.assertDictEqual(union_scaling_indicators, dict())
custom_scaling_indicators = self.custom.get_scaling_indicators()
self.assertTrue(custom_scaling_indicators["xi1"] in ["x1", "x2", "y1", "y4"])
self.assertTrue(custom_scaling_indicators["eta1"] in ["y2", "y3"])
self.assertTrue(custom_scaling_indicators["eta2"] in ["y5"])
def test_to_lisrel(self):
demo = SEMGraph(
ebunch=[
("xi1", "x1", 1.000),
("xi1", "x2", 2.180),
("xi1", "x3", 1.819),
("xi1", "eta1", 1.483),
("eta1", "y1", 1.000),
("eta1", "y2", 1.257),
("eta1", "y3", 1.058),
("eta1", "y4", 1.265),
("eta1", "eta2", 0.837),
("xi1", "eta2", 0.572),
("eta2", "y5", 1.000),
("eta2", "y6", 1.186),
("eta2", "y7", 1.280),
("eta2", "y8", 1.266),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[
("y1", "y5", 0.624),
("y2", "y6", 2.153),
("y2", "y4", 1.313),
("y3", "y7", 0.795),
("y4", "y8", 0.348),
("y6", "y8", 1.356),
],
err_var={
"x1": 0.082,
"x2": 0.120,
"x3": 0.467,
"y1": 1.891,
"y2": 7.373,
"y3": 5.067,
"y4": 3.148,
"y5": 2.351,
"y6": 4.954,
"y7": 3.431,
"y8": 3.254,
"xi1": 0.448,
"eta1": 3.956,
"eta2": 0.172,
},
)
demo_lisrel = demo.to_lisrel()
indexing = []
vars_ordered = [
"y1",
"y2",
"y3",
"y4",
"y5",
"y6",
"y7",
"y8",
"x1",
"x2",
"x3",
"xi1",
"eta1",
"eta2",
]
for var in vars_ordered:
indexing.append(demo_lisrel.eta.index(var))
eta_reorder = [demo_lisrel.eta[i] for i in indexing]
B_reorder = demo_lisrel.B[indexing, :][:, indexing]
B_fixed_reorder = demo_lisrel.B_fixed_mask[indexing, :][:, indexing]
zeta_reorder = demo_lisrel.zeta[indexing, :][:, indexing]
zeta_fixed_reorder = demo_lisrel.zeta_fixed_mask[indexing, :][:, indexing]
wedge_y_reorder = demo_lisrel.wedge_y[:, indexing]
self.assertEqual(vars_ordered, eta_reorder)
npt.assert_array_equal(
B_reorder,
np.array(
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
]
),
)
npt.assert_array_equal(
zeta_reorder,
np.array(
[
[1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
]
),
)
npt.assert_array_equal(
B_fixed_reorder,
np.array(
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.257, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.058, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.265, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.186],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.280],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.266],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.180, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.819, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.483, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.572, 0.837, 0],
]
),
)
npt.assert_array_equal(
zeta_fixed_reorder,
np.array(
[
[1.891, 0, 0, 0, 0.624, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 7.373, 0, 1.313, 0, 2.153, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 5.067, 0, 0, 0, 0.795, 0, 0, 0, 0, 0, 0, 0],
[0, 1.313, 0, 3.148, 0, 0, 0, 0.348, 0, 0, 0, 0, 0, 0],
[0.624, 0, 0, 0, 2.351, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 2.153, 0, 0, 0, 4.954, 0, 1.356, 0, 0, 0, 0, 0, 0],
[0, 0, 0.795, 0, 0, 0, 3.431, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0.348, 0, 1.356, 0, 3.254, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0.082, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0.120, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.467, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.448, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.956, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.172],
]
),
)
npt.assert_array_equal(
demo_lisrel.wedge_y,
np.array(
[
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
]
),
)
def test_to_from_lisrel(self):
demo_lisrel = self.demo.to_lisrel()
union_lisrel = self.union.to_lisrel()
demo_params_lisrel = self.demo_params.to_lisrel()
custom_lisrel = self.custom.to_lisrel()
demo_graph = demo_lisrel.to_SEMGraph()
union_graph = union_lisrel.to_SEMGraph()
demo_params_graph = demo_params_lisrel.to_SEMGraph()
custom_graph = custom_lisrel.to_SEMGraph()
# Test demo
self.assertSetEqual(set(self.demo.graph.nodes()), set(demo_graph.graph.nodes()))
self.assertSetEqual(set(self.demo.graph.edges()), set(demo_graph.graph.edges()))
self.assertSetEqual(set(self.demo.err_graph.nodes()), set(demo_graph.err_graph.nodes()))
npt.assert_array_equal(
nx.to_numpy_matrix(self.demo.err_graph, nodelist=sorted(self.demo.err_graph.nodes())),
nx.to_numpy_matrix(demo_graph, nodelist=sorted(demo_graph.err_graph.nodes())),
)
self.assertSetEqual(
set(self.demo.full_graph_struct.nodes()), set(demo_graph.full_graph_struct.nodes())
)
self.assertSetEqual(
set(self.demo.full_graph_struct.edges()), set(demo_graph.full_graph_struct.edges())
)
self.assertSetEqual(self.demo.latents, demo_graph.latents)
self.assertSetEqual(self.demo.observed, demo_graph.observed)
# Test union
self.assertSetEqual(set(self.union.graph.nodes()), set(union_graph.graph.nodes()))
self.assertSetEqual(set(self.union.graph.edges()), set(union_graph.graph.edges()))
self.assertSetEqual(set(self.union.err_graph.nodes()), set(union_graph.err_graph.nodes()))
npt.assert_array_equal(
nx.to_numpy_matrix(self.union.err_graph, nodelist=sorted(self.union.err_graph.nodes())),
nx.to_numpy_matrix(union_graph, nodelist=sorted(union_graph.err_graph.nodes())),
)
self.assertSetEqual(
set(self.union.full_graph_struct.nodes()), set(union_graph.full_graph_struct.nodes())
)
self.assertSetEqual(
set(self.union.full_graph_struct.edges()), set(union_graph.full_graph_struct.edges())
)
self.assertSetEqual(self.union.latents, union_graph.latents)
self.assertSetEqual(self.union.observed, union_graph.observed)
# Test demo_params
self.assertSetEqual(
set(self.demo_params.graph.nodes()), set(demo_params_graph.graph.nodes())
)
self.assertSetEqual(
set(self.demo_params.graph.edges()), set(demo_params_graph.graph.edges())
)
self.assertSetEqual(
set(self.demo_params.err_graph.nodes()), set(demo_params_graph.err_graph.nodes())
)
npt.assert_array_equal(
nx.to_numpy_matrix(
self.demo_params.err_graph,
nodelist=sorted(self.demo_params.err_graph.nodes()),
weight=None,
),
nx.to_numpy_matrix(
demo_graph.err_graph,
nodelist=sorted(demo_params_graph.err_graph.nodes()),
weight=None,
),
)
self.assertSetEqual(
set(self.demo_params.full_graph_struct.nodes()),
set(demo_params_graph.full_graph_struct.nodes()),
)
self.assertSetEqual(
set(self.demo_params.full_graph_struct.edges()),
set(demo_params_graph.full_graph_struct.edges()),
)
self.assertSetEqual(self.demo_params.latents, demo_params_graph.latents)
self.assertSetEqual(self.demo_params.observed, demo_params_graph.observed)
# Test demo
self.assertSetEqual(set(self.custom.graph.nodes()), set(custom_graph.graph.nodes()))
self.assertSetEqual(set(self.custom.graph.edges()), set(custom_graph.graph.edges()))
self.assertSetEqual(set(self.custom.err_graph.nodes()), set(custom_graph.err_graph.nodes()))
npt.assert_array_equal(
nx.to_numpy_matrix(
self.custom.err_graph, nodelist=sorted(self.custom.err_graph.nodes())
),
nx.to_numpy_matrix(custom_graph, nodelist=sorted(custom_graph.err_graph.nodes())),
)
self.assertSetEqual(
set(self.custom.full_graph_struct.nodes()), set(custom_graph.full_graph_struct.nodes())
)
self.assertSetEqual(
set(self.custom.full_graph_struct.edges()), set(custom_graph.full_graph_struct.edges())
)
self.assertSetEqual(self.custom.latents, custom_graph.latents)
self.assertSetEqual(self.custom.observed, custom_graph.observed)
def test_iv_transformations_demo(self):
scale = {"eta1": "y1", "eta2": "y5", "xi1": "x1"}
self.assertRaises(ValueError, self.demo._iv_transformations, "x1", "y1", scale)
for y in ["y2", "y3", "y4"]:
full_graph, dependent_var = self.demo._iv_transformations(
X="eta1", Y=y, scaling_indicators=scale
)
self.assertEqual(dependent_var, y)
self.assertTrue((".y1", y) in full_graph.edges)
self.assertFalse(("eta1", y) in full_graph.edges)
for y in ["y6", "y7", "y8"]:
full_graph, dependent_var = self.demo._iv_transformations(
X="eta2", Y=y, scaling_indicators=scale
)
self.assertEqual(dependent_var, y)
self.assertTrue((".y5", y) in full_graph.edges)
self.assertFalse(("eta2", y) in full_graph.edges)
full_graph, dependent_var = self.demo._iv_transformations(
X="xi1", Y="eta1", scaling_indicators=scale
)
self.assertEqual(dependent_var, "y1")
self.assertTrue((".eta1", "y1") in full_graph.edges())
self.assertTrue((".x1", "y1") in full_graph.edges())
self.assertFalse(("xi1", "eta1") in full_graph.edges())
full_graph, dependent_var = self.demo._iv_transformations(
X="xi1", Y="eta2", scaling_indicators=scale
)
self.assertEqual(dependent_var, "y5")
self.assertTrue((".y1", "y5") in full_graph.edges())
self.assertTrue((".eta2", "y5") in full_graph.edges())
self.assertTrue((".x1", "y5") in full_graph.edges())
self.assertFalse(("eta1", "eta2") in full_graph.edges())
self.assertFalse(("xi1", "eta2") in full_graph.edges())
full_graph, dependent_var = self.demo._iv_transformations(
X="eta1", Y="eta2", scaling_indicators=scale
)
self.assertEqual(dependent_var, "y5")
self.assertTrue((".y1", "y5") in full_graph.edges())
self.assertTrue((".eta2", "y5") in full_graph.edges())
self.assertTrue((".x1", "y5") in full_graph.edges())
self.assertFalse(("eta1", "eta2") in full_graph.edges())
self.assertFalse(("xi1", "eta2") in full_graph.edges())
def test_iv_transformations_union(self):
scale = {}
for u, v in self.union.graph.edges():
full_graph, dependent_var = self.union._iv_transformations(
u, v, scaling_indicators=scale
)
self.assertFalse((u, v) in full_graph.edges())
self.assertEqual(dependent_var, v)
def test_get_ivs_demo(self):
scale = {"eta1": "y1", "eta2": "y5", "xi1": "x1"}
self.assertSetEqual(
self.demo.get_ivs("eta1", "y2", scaling_indicators=scale),
{"x1", "x2", "x3", "y3", "y7", "y8"},
)
self.assertSetEqual(
self.demo.get_ivs("eta1", "y3", scaling_indicators=scale),
{"x1", "x2", "x3", "y2", "y4", "y6", "y8"},
)
self.assertSetEqual(
self.demo.get_ivs("eta1", "y4", scaling_indicators=scale),
{"x1", "x2", "x3", "y3", "y6", "y7"},
)
self.assertSetEqual(
self.demo.get_ivs("eta2", "y6", scaling_indicators=scale),
{"x1", "x2", "x3", "y3", "y4", "y7"},
)
self.assertSetEqual(
self.demo.get_ivs("eta2", "y7", scaling_indicators=scale),
{"x1", "x2", "x3", "y2", "y4", "y6", "y8"},
)
self.assertSetEqual(
self.demo.get_ivs("eta2", "y8", scaling_indicators=scale),
{"x1", "x2", "x3", "y2", "y3", "y7"},
)
self.assertSetEqual(
self.demo.get_ivs("xi1", "x2", scaling_indicators=scale),
{"x3", "y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8"},
)
self.assertSetEqual(
self.demo.get_ivs("xi1", "x3", scaling_indicators=scale),
{"x2", "y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8"},
)
self.assertSetEqual(
self.demo.get_ivs("xi1", "eta1", scaling_indicators=scale), {"x2", "x3"}
)
self.assertSetEqual(
self.demo.get_ivs("xi1", "eta2", scaling_indicators=scale),
{"x2", "x3", "y2", "y3", "y4"},
)
self.assertSetEqual(
self.demo.get_ivs("eta1", "eta2", scaling_indicators=scale),
{"x2", "x3", "y2", "y3", "y4"},
)
def test_get_conditional_ivs_demo(self):
scale = {"eta1": "y1", "eta2": "y5", "xi1": "x1"}
self.assertEqual(self.demo.get_conditional_ivs("eta1", "y2", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("eta1", "y3", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("eta1", "y4", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("eta2", "y6", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("eta2", "y7", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("eta2", "y8", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("xi1", "x2", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("xi1", "x3", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("xi1", "eta1", scaling_indicators=scale), [])
self.assertEqual(self.demo.get_conditional_ivs("xi1", "eta2", scaling_indicators=scale), [])
self.assertEqual(
self.demo.get_conditional_ivs("eta1", "eta2", scaling_indicators=scale), []
)
def test_get_ivs_union(self):
scale = {}
self.assertSetEqual(
self.union.get_ivs("yrsmill", "unionsen", scaling_indicators=scale), set()
)
self.assertSetEqual(
self.union.get_ivs("deferenc", "unionsen", scaling_indicators=scale), set()
)
self.assertSetEqual(
self.union.get_ivs("laboract", "unionsen", scaling_indicators=scale), set()
)
self.assertSetEqual(
self.union.get_ivs("deferenc", "laboract", scaling_indicators=scale), set()
)
self.assertSetEqual(
self.union.get_ivs("age", "laboract", scaling_indicators=scale), {"yrsmill"}
)
self.assertSetEqual(
self.union.get_ivs("age", "deferenc", scaling_indicators=scale), {"yrsmill"}
)
def test_get_conditional_ivs_union(self):
self.assertEqual(
self.union.get_conditional_ivs("yrsmill", "unionsen"),
[("age", {"laboract", "deferenc"})],
)
# This case wouldn't have conditonal IV if the Total effect between `deferenc` and
# `unionsen` needs to be computed because one of the conditional variable lies on the
# effect path.
self.assertEqual(
self.union.get_conditional_ivs("deferenc", "unionsen"),
[("age", {"yrsmill", "laboract"})],
)
self.assertEqual(
self.union.get_conditional_ivs("laboract", "unionsen"),
[("age", {"yrsmill", "deferenc"})],
)
self.assertEqual(self.union.get_conditional_ivs("deferenc", "laboract"), [])
self.assertEqual(
self.union.get_conditional_ivs("age", "laboract"), [("yrsmill", {"deferenc"})]
)
self.assertEqual(self.union.get_conditional_ivs("age", "deferenc"), [])
def test_iv_transformations_custom(self):
scale_custom = {"eta1": "y2", "eta2": "y5", "xi1": "x1"}
full_graph, var = self.custom._iv_transformations(
"xi1", "x2", scaling_indicators=scale_custom
)
self.assertEqual(var, "x2")
self.assertTrue((".x1", "x2") in full_graph.edges())
self.assertFalse(("xi1", "x2") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"xi1", "y4", scaling_indicators=scale_custom
)
self.assertEqual(var, "y4")
self.assertTrue((".x1", "y4") in full_graph.edges())
self.assertFalse(("xi1", "y4") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"xi1", "y1", scaling_indicators=scale_custom
)
self.assertEqual(var, "y1")
self.assertTrue((".x1", "y1") in full_graph.edges())
self.assertFalse(("xi1", "y1") in full_graph.edges())
self.assertFalse(("y4", "y1") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"xi1", "eta1", scaling_indicators=scale_custom
)
self.assertEqual(var, "y2")
self.assertTrue((".eta1", "y2") in full_graph.edges())
self.assertTrue((".x1", "y2") in full_graph.edges())
self.assertFalse(("y1", "eta1") in full_graph.edges())
self.assertFalse(("xi1", "eta1") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"y1", "eta1", scaling_indicators=scale_custom
)
self.assertEqual(var, "y2")
self.assertTrue((".eta1", "y2") in full_graph.edges())
self.assertTrue((".x1", "y2") in full_graph.edges())
self.assertFalse(("y1", "eta1") in full_graph.edges())
self.assertFalse(("xi1", "eta1") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"y1", "eta2", scaling_indicators=scale_custom
)
self.assertEqual(var, "y5")
self.assertTrue((".eta2", "y5") in full_graph.edges())
self.assertFalse(("y1", "eta2") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"y4", "y1", scaling_indicators=scale_custom
)
self.assertEqual(var, "y1")
self.assertFalse(("y4", "y1") in full_graph.edges())
full_graph, var = self.custom._iv_transformations(
"eta1", "y3", scaling_indicators=scale_custom
)
self.assertEqual(var, "y3")
self.assertTrue((".y2", "y3") in full_graph.edges())
self.assertFalse(("eta1", "y3") in full_graph.edges())
def test_get_ivs_custom(self):
scale_custom = {"eta1": "y2", "eta2": "y5", "xi1": "x1"}
self.assertSetEqual(
self.custom.get_ivs("xi1", "x2", scaling_indicators=scale_custom),
{"y1", "y2", "y3", "y4", "y5"},
)
self.assertSetEqual(
self.custom.get_ivs("xi1", "y4", scaling_indicators=scale_custom), {"x2"}
)
self.assertSetEqual(
self.custom.get_ivs("xi1", "y1", scaling_indicators=scale_custom), {"x2", "y4"}
)
self.assertSetEqual(
self.custom.get_ivs("xi1", "eta1", scaling_indicators=scale_custom), {"x2", "y4"}
)
# TODO: Test this and fix.
self.assertSetEqual(
self.custom.get_ivs("y1", "eta1", scaling_indicators=scale_custom), {"x2", "y4", "y5"}
)
self.assertSetEqual(
self.custom.get_ivs("y1", "eta2", scaling_indicators=scale_custom),
{"x1", "x2", "y2", "y3", "y4"},
)
self.assertSetEqual(self.custom.get_ivs("y4", "y1", scaling_indicators=scale_custom), set())
self.assertSetEqual(
self.custom.get_ivs("eta1", "y3", scaling_indicators=scale_custom), {"x1", "x2", "y4"}
)
def test_small_model_ivs(self):
model1 = SEMGraph(
ebunch=[("X", "Y"), ("I", "X"), ("W", "I")],
latents=[],
err_corr=[("W", "Y")],
err_var={},
)
self.assertEqual(model1.get_conditional_ivs("X", "Y"), [("I", {"W"})])
model2 = SEMGraph(
ebunch=[("x", "y"), ("z", "x"), ("w", "z"), ("w", "u"), ("u", "x"), ("u", "y")],
latents=["u"],
)
self.assertEqual(model2.get_conditional_ivs("x", "y"), [("z", {"w"})])
model3 = SEMGraph(ebunch=[("x", "y"), ("u", "x"), ("u", "y"), ("z", "x")], latents=["u"])
self.assertEqual(model3.get_ivs("x", "y"), {"z"})
model4 = SEMGraph(ebunch=[("x", "y"), ("z", "x"), ("u", "x"), ("u", "y")])
self.assertEqual(model4.get_conditional_ivs("x", "y"), [("z", {"u"})])
class TestSEMAlg(unittest.TestCase):
def setUp(self):
self.demo = SEMGraph(
ebunch=[
("xi1", "x1", 1.000),
("xi1", "x2", 2.180),
("xi1", "x3", 1.819),
("xi1", "eta1", 1.483),
("eta1", "y1", 1.000),
("eta1", "y2", 1.257),
("eta1", "y3", 1.058),
("eta1", "y4", 1.265),
("eta1", "eta2", 0.837),
("xi1", "eta2", 0.572),
("eta2", "y5", 1.000),
("eta2", "y6", 1.186),
("eta2", "y7", 1.280),
("eta2", "y8", 1.266),
],
latents=["xi1", "eta1", "eta2"],
err_corr=[
("y1", "y5", 0.624),
("y2", "y6", 2.153),
("y2", "y4", 1.313),
("y3", "y7", 0.795),
("y4", "y8", 0.348),
("y6", "y8", 1.356),
],
err_var={
"x1": 0.082,
"x2": 0.120,
"x3": 0.467,
"y1": 1.891,
"y2": 7.373,
"y3": 5.067,
"y4": 3.148,
"y5": 2.351,
"y6": 4.954,
"y7": 3.431,
"y8": 3.254,
"xi1": 0.448,
"eta1": 3.956,
"eta2": 0.172,
},
)
self.demo_lisrel = self.demo.to_lisrel()
self.small_model = SEM.from_graph(
ebunch=[("X", "Y", 0.3)], latents=[], err_var={"X": 0.1, "Y": 0.1}
)
self.small_model_lisrel = self.small_model.to_lisrel()
def test_generate_samples(self):
samples = self.small_model_lisrel.generate_samples(n_samples=100)
samples = self.demo_lisrel.generate_samples(n_samples=100)
| [
1,
529,
9507,
29958,
4061,
1526,
29891,
29914,
21150,
29914,
1688,
29918,
9794,
29914,
1688,
29918,
1660,
29924,
29889,
2272,
13,
5215,
2897,
13,
5215,
443,
27958,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
3564,
29916,
408,
302,
29916,
13,
5215,
12655,
29889,
13424,
408,
302,
415,
13,
13,
3166,
23822,
1526,
29891,
29889,
9794,
1053,
3725,
29924,
29892,
3725,
29924,
9527,
29892,
3725,
1529,
19920,
13,
13,
13,
1990,
4321,
1660,
29924,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
3166,
29918,
4262,
29898,
1311,
1125,
13,
4706,
1583,
29889,
17482,
353,
3725,
29924,
29889,
3166,
29918,
4262,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29941,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
1187,
29906,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29906,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29947,
4968,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
4968,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
4968,
13,
9651,
21251,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29889,
5066,
1237,
29892,
8853,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
29908,
1800,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
711,
643,
1490,
29892,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
18010,
25739,
13,
9651,
518,
13,
18884,
376,
1187,
29896,
613,
13,
18884,
376,
1187,
29906,
613,
13,
18884,
376,
29916,
29896,
613,
13,
18884,
376,
29916,
29906,
613,
13,
18884,
376,
29916,
29941,
613,
13,
18884,
376,
5389,
29896,
613,
13,
18884,
376,
29891,
29896,
613,
13,
18884,
376,
29891,
29906,
613,
13,
18884,
376,
29891,
29941,
613,
13,
18884,
376,
29891,
29946,
613,
13,
18884,
376,
29891,
29945,
613,
13,
18884,
376,
29891,
29953,
613,
13,
18884,
376,
29891,
29955,
613,
13,
18884,
376,
29891,
29947,
613,
13,
9651,
21251,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
25739,
13,
9651,
12705,
29898,
13,
18884,
518,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
1187,
29906,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29896,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29906,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29941,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29946,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29945,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29953,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29955,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29947,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
1187,
29896,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
1187,
29906,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29896,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29906,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29941,
4968,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29941,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29941,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29946,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29945,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29953,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29955,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29947,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
7688,
29922,
8516,
13,
9651,
10353,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
363,
7636,
297,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
287,
2710,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
12864,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
363,
2943,
297,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
29961,
3177,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
1678,
822,
1243,
29918,
3166,
29918,
23087,
273,
29898,
1311,
1125,
13,
4706,
1904,
29918,
710,
353,
9995,
29937,
1273,
1359,
1904,
29889,
4112,
13,
462,
539,
396,
20039,
1904,
13,
462,
308,
1399,
29953,
29900,
16788,
921,
29896,
718,
921,
29906,
718,
921,
29941,
13,
462,
308,
1261,
29953,
29900,
16788,
343,
29896,
718,
343,
29906,
718,
343,
29941,
718,
343,
29946,
13,
462,
308,
1261,
29953,
29945,
16788,
343,
29945,
718,
343,
29953,
718,
343,
29955,
718,
343,
29947,
13,
462,
539,
396,
337,
3663,
1080,
13,
462,
308,
1261,
29953,
29900,
3695,
1399,
29953,
29900,
13,
462,
308,
1261,
29953,
29945,
3695,
1399,
29953,
29900,
718,
1261,
29953,
29900,
13,
462,
539,
396,
10995,
950,
8855,
800,
13,
462,
308,
343,
29896,
3695,
30022,
343,
29945,
13,
462,
308,
343,
29906,
3695,
30022,
343,
29946,
718,
343,
29953,
13,
462,
308,
343,
29941,
3695,
30022,
343,
29955,
13,
462,
308,
343,
29946,
3695,
30022,
343,
29947,
13,
462,
308,
343,
29953,
3695,
30022,
343,
29947,
13,
462,
539,
9995,
13,
4706,
1904,
29918,
3166,
29918,
710,
353,
3725,
29924,
29889,
3166,
29918,
23087,
273,
29898,
1807,
29922,
4299,
29918,
710,
29897,
13,
13,
4706,
411,
1722,
703,
1688,
29918,
4299,
29889,
4112,
613,
376,
29893,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
4299,
29918,
710,
29897,
13,
4706,
1904,
29918,
3166,
29918,
1445,
353,
3725,
29924,
29889,
3166,
29918,
23087,
273,
29898,
9507,
543,
1688,
29918,
4299,
29889,
4112,
1159,
13,
4706,
2897,
29889,
5992,
703,
1688,
29918,
4299,
29889,
4112,
1159,
13,
13,
4706,
3806,
29918,
287,
2710,
353,
731,
29898,
13,
9651,
518,
13,
18884,
4852,
513,
29953,
29900,
613,
376,
29916,
29896,
4968,
13,
18884,
4852,
513,
29953,
29900,
613,
376,
29916,
29906,
4968,
13,
18884,
4852,
513,
29953,
29900,
613,
376,
29916,
29941,
4968,
13,
18884,
4852,
513,
29953,
29900,
613,
376,
2310,
29953,
29900,
4968,
13,
18884,
4852,
513,
29953,
29900,
613,
376,
2310,
29953,
29945,
4968,
13,
18884,
4852,
2310,
29953,
29900,
613,
376,
2310,
29953,
29945,
4968,
13,
18884,
4852,
2310,
29953,
29900,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
2310,
29953,
29900,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
2310,
29953,
29900,
613,
376,
29891,
29941,
4968,
13,
18884,
4852,
2310,
29953,
29900,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
2310,
29953,
29945,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
2310,
29953,
29945,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
2310,
29953,
29945,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
2310,
29953,
29945,
613,
376,
29891,
29947,
4968,
13,
9651,
4514,
13,
4706,
1723,
13,
13,
4706,
396,
14211,
1088,
287,
12367,
29892,
4225,
304,
4386,
746,
12770,
4133,
297,
11837,
29889,
13,
4706,
3806,
29918,
3127,
29918,
287,
2710,
353,
731,
29898,
13,
9651,
518,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
29891,
29945,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
29891,
29955,
613,
376,
29891,
29941,
4968,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
4968,
13,
18884,
4852,
29891,
29947,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
4968,
13,
18884,
4852,
29891,
29947,
613,
376,
29891,
29953,
4968,
13,
9651,
4514,
13,
4706,
1723,
13,
13,
4706,
3806,
29918,
5066,
1237,
353,
731,
29898,
3366,
2310,
29953,
29900,
613,
376,
2310,
29953,
29945,
613,
376,
513,
29953,
29900,
20068,
13,
4706,
1583,
29889,
9294,
9843,
29898,
842,
29898,
4299,
29918,
3166,
29918,
710,
29889,
4262,
29889,
287,
2710,
25739,
3806,
29918,
287,
2710,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
842,
29898,
4299,
29918,
3166,
29918,
1445,
29889,
4262,
29889,
287,
2710,
25739,
3806,
29918,
287,
2710,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
842,
29898,
4299,
29918,
3166,
29918,
710,
29889,
3127,
29918,
4262,
29889,
287,
2710,
3101,
448,
3806,
29918,
3127,
29918,
287,
2710,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
842,
29898,
4299,
29918,
3166,
29918,
1445,
29889,
3127,
29918,
4262,
29889,
287,
2710,
3101,
448,
3806,
29918,
3127,
29918,
287,
2710,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
842,
29898,
4299,
29918,
3166,
29918,
710,
29889,
5066,
1237,
511,
3806,
29918,
5066,
1237,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
842,
29898,
4299,
29918,
3166,
29918,
1445,
29889,
5066,
1237,
511,
3806,
29918,
5066,
1237,
29897,
13,
13,
1678,
822,
1243,
29918,
3166,
29918,
23443,
2674,
29898,
1311,
1125,
13,
4706,
1209,
29871,
396,
14402,
29901,
3462,
445,
1243,
746,
2309,
5007,
278,
6987,
363,
3725,
1529,
19920,
13,
13,
1678,
822,
1243,
29918,
3166,
29918,
2572,
29898,
1311,
1125,
13,
4706,
1209,
29871,
396,
14402,
29901,
3462,
445,
29889,
13,
13,
13,
1990,
4321,
1660,
29924,
9527,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
17482,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29941,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
1187,
29906,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29906,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29947,
4968,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
4968,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
4968,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
4968,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
4968,
13,
9651,
21251,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
13094,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
4968,
13,
18884,
4852,
482,
613,
376,
29880,
3717,
627,
4968,
13,
18884,
4852,
482,
613,
376,
311,
571,
3977,
4968,
13,
18884,
4852,
311,
571,
3977,
613,
376,
29880,
3717,
627,
4968,
13,
18884,
4852,
311,
571,
3977,
613,
376,
348,
1080,
264,
4968,
13,
18884,
4852,
29880,
3717,
627,
613,
376,
348,
1080,
264,
4968,
13,
9651,
21251,
13,
9651,
3405,
1237,
11759,
1402,
13,
9651,
4589,
29918,
29725,
11759,
703,
29891,
2288,
19958,
613,
376,
482,
1159,
1402,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
17482,
29918,
7529,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
613,
29871,
29900,
29889,
29946,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
613,
29871,
29900,
29889,
29945,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29941,
613,
29871,
29900,
29889,
29953,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
613,
29871,
29900,
29889,
29941,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29896,
613,
29871,
29896,
29889,
29896,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
613,
29871,
29896,
29889,
29906,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
613,
29871,
29896,
29889,
29941,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29946,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29896,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29906,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
613,
29871,
29900,
29889,
29955,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29953,
613,
29871,
29900,
29889,
29947,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29955,
613,
29871,
29900,
29889,
29929,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29900,
511,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
613,
29871,
29896,
29889,
29945,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
613,
29871,
29896,
29889,
29953,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29929,
511,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
613,
29871,
29896,
29889,
29955,
511,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29947,
511,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
613,
29871,
29906,
29889,
29900,
511,
13,
9651,
21251,
13,
9651,
4589,
29918,
1707,
3790,
13,
18884,
376,
29891,
29896,
1115,
29871,
29906,
29889,
29896,
29892,
13,
18884,
376,
29891,
29906,
1115,
29871,
29906,
29889,
29906,
29892,
13,
18884,
376,
29891,
29941,
1115,
29871,
29906,
29889,
29941,
29892,
13,
18884,
376,
29891,
29946,
1115,
29871,
29906,
29889,
29946,
29892,
13,
18884,
376,
29891,
29945,
1115,
29871,
29906,
29889,
29945,
29892,
13,
18884,
376,
29891,
29953,
1115,
29871,
29906,
29889,
29953,
29892,
13,
18884,
376,
29891,
29955,
1115,
29871,
29906,
29889,
29955,
29892,
13,
18884,
376,
29891,
29947,
1115,
29871,
29906,
29889,
29947,
29892,
13,
18884,
376,
29916,
29896,
1115,
29871,
29941,
29889,
29896,
29892,
13,
18884,
376,
29916,
29906,
1115,
29871,
29941,
29889,
29906,
29892,
13,
18884,
376,
29916,
29941,
1115,
29871,
29941,
29889,
29941,
29892,
13,
18884,
376,
1187,
29896,
1115,
29871,
29906,
29889,
29929,
29892,
13,
18884,
376,
1187,
29906,
1115,
29871,
29941,
29889,
29900,
29892,
13,
18884,
376,
5389,
29896,
1115,
29871,
29941,
29889,
29946,
29892,
13,
9651,
2981,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
6341,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29891,
29946,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
4968,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
4968,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29896,
4968,
13,
18884,
4852,
29891,
29896,
613,
376,
1187,
29906,
4968,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
4968,
13,
18884,
4852,
29891,
29896,
613,
376,
1187,
29896,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
4968,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
4968,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
703,
29891,
29896,
613,
376,
29891,
29906,
4968,
4852,
29891,
29906,
613,
376,
29891,
29941,
1159,
1402,
13,
9651,
4589,
29918,
1707,
3790,
1118,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
17482,
29918,
2344,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29889,
5066,
1237,
29892,
8853,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
29908,
1800,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
711,
643,
1490,
29892,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
18010,
25739,
13,
9651,
518,
13,
18884,
376,
1187,
29896,
613,
13,
18884,
376,
1187,
29906,
613,
13,
18884,
376,
29916,
29896,
613,
13,
18884,
376,
29916,
29906,
613,
13,
18884,
376,
29916,
29941,
613,
13,
18884,
376,
5389,
29896,
613,
13,
18884,
376,
29891,
29896,
613,
13,
18884,
376,
29891,
29906,
613,
13,
18884,
376,
29891,
29941,
613,
13,
18884,
376,
29891,
29946,
613,
13,
18884,
376,
29891,
29945,
613,
13,
18884,
376,
29891,
29953,
613,
13,
18884,
376,
29891,
29955,
613,
13,
18884,
376,
29891,
29947,
613,
13,
9651,
21251,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
25739,
13,
9651,
12705,
29898,
13,
18884,
518,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
1187,
29906,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29896,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29906,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29941,
4968,
13,
462,
1678,
4852,
1187,
29896,
613,
376,
29891,
29946,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29945,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29953,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29955,
4968,
13,
462,
1678,
4852,
1187,
29906,
613,
376,
29891,
29947,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
1187,
29896,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
1187,
29906,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29896,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29906,
4968,
13,
462,
1678,
4852,
5389,
29896,
613,
376,
29916,
29941,
4968,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29941,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29896,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29941,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29946,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29945,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29953,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29955,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29947,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
7688,
29922,
8516,
13,
9651,
10353,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
363,
7636,
297,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
287,
2710,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
12864,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
363,
2943,
297,
1583,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
29961,
3177,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
1678,
822,
1243,
29918,
13094,
29918,
2344,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
13094,
29889,
5066,
1237,
29892,
731,
3101,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
711,
643,
1490,
29892,
8853,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
613,
376,
482,
613,
376,
29880,
3717,
627,
613,
376,
311,
571,
3977,
9092,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
18010,
25739,
13,
9651,
12705,
29898,
3366,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
613,
376,
482,
613,
376,
29880,
3717,
627,
613,
376,
311,
571,
3977,
3108,
511,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
13,
9651,
12705,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
25739,
13,
9651,
12705,
29898,
13,
18884,
518,
13,
462,
1678,
4852,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
4852,
482,
613,
376,
29880,
3717,
627,
4968,
13,
462,
1678,
4852,
482,
613,
376,
311,
571,
3977,
4968,
13,
462,
1678,
4852,
311,
571,
3977,
613,
376,
29880,
3717,
627,
4968,
13,
462,
1678,
4852,
311,
571,
3977,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
4852,
29880,
3717,
627,
613,
376,
348,
1080,
264,
4968,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
482,
613,
376,
29880,
3717,
627,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
482,
613,
376,
311,
571,
3977,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
311,
571,
3977,
613,
376,
29880,
3717,
627,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
311,
571,
3977,
613,
376,
348,
1080,
264,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
29961,
703,
29880,
3717,
627,
613,
376,
348,
1080,
264,
1159,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
1583,
29889,
13094,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
7688,
29922,
8516,
13,
9651,
10353,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
462,
1678,
518,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
363,
7636,
297,
1583,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
287,
2710,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
12864,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
4706,
363,
2943,
297,
1583,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
18010,
7295,
13,
9651,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
18010,
29961,
3177,
1402,
8853,
7915,
1115,
7442,
29889,
19377,
1800,
13,
13,
1678,
822,
1243,
29918,
17482,
29918,
3207,
29918,
2344,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29896,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29946,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29906,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29945,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
29916,
29941,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29953,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29941,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29896,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29896,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29906,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29906,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29941,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29941,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
29891,
29946,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29946,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29896,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
5389,
29896,
613,
376,
1187,
29906,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29906,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29945,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29955,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29953,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29947,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29955,
1159,
1402,
8853,
7915,
1115,
29871,
29900,
29889,
29929,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
29961,
703,
1187,
29906,
613,
376,
29891,
29947,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29900,
1800,
13,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29896,
613,
376,
29891,
29945,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29945,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29906,
613,
376,
29891,
29953,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29953,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29906,
613,
376,
29891,
29946,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29929,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29941,
613,
376,
29891,
29955,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29955,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29946,
613,
376,
29891,
29947,
1159,
1402,
8853,
7915,
1115,
29871,
29896,
29889,
29947,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
287,
2710,
29961,
703,
29891,
29953,
613,
376,
29891,
29947,
1159,
1402,
8853,
7915,
1115,
29871,
29906,
29889,
29900,
1800,
13,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29896,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29896,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29906,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29906,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29941,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29941,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29946,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29946,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29945,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29945,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29953,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29953,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29955,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29955,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29891,
29947,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29947,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29916,
29896,
12436,
8853,
7915,
1115,
29871,
29941,
29889,
29896,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29916,
29906,
12436,
8853,
7915,
1115,
29871,
29941,
29889,
29906,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
29916,
29941,
12436,
8853,
7915,
1115,
29871,
29941,
29889,
29941,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
1187,
29896,
12436,
8853,
7915,
1115,
29871,
29906,
29889,
29929,
1800,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
3366,
1187,
29906,
12436,
8853,
7915,
1115,
29871,
29941,
29889,
29900,
1800,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
8159,
29918,
4262,
29918,
4984,
29898,
1311,
1125,
13,
4706,
2989,
29918,
4984,
353,
1583,
29889,
13094,
3032,
657,
29918,
8159,
29918,
4262,
29918,
4984,
580,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
731,
29898,
8159,
29918,
4984,
29889,
18010,
3101,
13,
9651,
448,
731,
29898,
13,
18884,
518,
13,
462,
1678,
376,
29891,
2288,
19958,
613,
13,
462,
1678,
376,
348,
1080,
264,
613,
13,
462,
1678,
376,
482,
613,
13,
462,
1678,
376,
29880,
3717,
627,
613,
13,
462,
1678,
376,
311,
571,
3977,
613,
13,
462,
1678,
11393,
29891,
2288,
19958,
613,
13,
462,
1678,
11393,
348,
1080,
264,
613,
13,
462,
1678,
11393,
482,
613,
13,
462,
1678,
11393,
29880,
3717,
627,
613,
13,
462,
1678,
11393,
311,
571,
3977,
613,
13,
462,
1678,
376,
636,
482,
29891,
2288,
19958,
613,
13,
462,
1678,
376,
636,
29891,
2288,
19958,
482,
613,
13,
18884,
4514,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
731,
29898,
8159,
29918,
4984,
29889,
287,
2710,
3101,
13,
9651,
448,
731,
29898,
13,
18884,
518,
13,
462,
1678,
4852,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
4852,
482,
613,
376,
29880,
3717,
627,
4968,
13,
462,
1678,
4852,
482,
613,
376,
311,
571,
3977,
4968,
13,
462,
1678,
4852,
311,
571,
3977,
613,
376,
29880,
3717,
627,
4968,
13,
462,
1678,
4852,
311,
571,
3977,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
4852,
29880,
3717,
627,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
313,
1642,
29891,
2288,
19958,
613,
376,
29891,
2288,
19958,
4968,
13,
462,
1678,
313,
1642,
348,
1080,
264,
613,
376,
348,
1080,
264,
4968,
13,
462,
1678,
313,
1642,
482,
613,
376,
482,
4968,
13,
462,
1678,
313,
1642,
29880,
3717,
627,
613,
376,
29880,
3717,
627,
4968,
13,
462,
1678,
313,
1642,
311,
571,
3977,
613,
376,
311,
571,
3977,
4968,
13,
462,
1678,
4852,
636,
482,
29891,
2288,
19958,
613,
11393,
482,
4968,
13,
462,
1678,
4852,
636,
482,
29891,
2288,
19958,
613,
11393,
29891,
2288,
19958,
4968,
13,
462,
1678,
4852,
636,
29891,
2288,
19958,
482,
613,
11393,
482,
4968,
13,
462,
1678,
4852,
636,
29891,
2288,
19958,
482,
613,
11393,
29891,
2288,
19958,
4968,
13,
18884,
4514,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4925,
29918,
3018,
309,
29918,
18010,
29898,
1311,
1125,
13,
4706,
13455,
29918,
18010,
353,
6796,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
3108,
13,
4706,
363,
2943,
297,
13455,
29918,
18010,
29901,
13,
9651,
1583,
29889,
9294,
2697,
9843,
29898,
13,
18884,
1583,
29889,
17482,
29889,
4925,
29918,
3018,
309,
29918,
18010,
29898,
3177,
29892,
2281,
543,
8159,
1159,
29961,
3177,
1402,
731,
29898,
17482,
29918,
18010,
29897,
13,
9651,
1723,
13,
13,
4706,
9833,
29918,
18010,
353,
1583,
29889,
13094,
29889,
4262,
29889,
18010,
580,
13,
4706,
6136,
29918,
3018,
2719,
353,
1583,
29889,
13094,
29889,
4925,
29918,
3018,
309,
29918,
18010,
29898,
1761,
29898,
13094,
29918,
18010,
511,
2281,
543,
8159,
1159,
13,
4706,
363,
2943,
297,
9833,
29918,
18010,
29901,
13,
9651,
1583,
29889,
9294,
2697,
9843,
29898,
4925,
29918,
3018,
2719,
29961,
3177,
1402,
731,
29898,
13094,
29918,
18010,
876,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
4925,
29918,
3018,
309,
29918,
18010,
703,
482,
613,
8900,
29922,
3366,
29880,
3717,
627,
613,
376,
311,
571,
3977,
613,
376,
348,
1080,
264,
20068,
29961,
13,
18884,
376,
482,
29908,
13,
9651,
21251,
13,
9651,
8853,
482,
613,
376,
29891,
2288,
19958,
10758,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
19529,
292,
29918,
513,
293,
4097,
29898,
1311,
1125,
13,
4706,
13455,
29918,
19529,
292,
29918,
513,
293,
4097,
353,
1583,
29889,
17482,
29889,
657,
29918,
19529,
292,
29918,
513,
293,
4097,
580,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17482,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
1187,
29896,
3108,
297,
6796,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
20068,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17482,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
1187,
29906,
3108,
297,
6796,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
20068,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17482,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
5389,
29896,
3108,
297,
6796,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
20068,
13,
13,
4706,
9833,
29918,
19529,
292,
29918,
513,
293,
4097,
353,
1583,
29889,
13094,
29889,
657,
29918,
19529,
292,
29918,
513,
293,
4097,
580,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
13094,
29918,
19529,
292,
29918,
513,
293,
4097,
29892,
9657,
3101,
13,
13,
4706,
2888,
29918,
19529,
292,
29918,
513,
293,
4097,
353,
1583,
29889,
6341,
29889,
657,
29918,
19529,
292,
29918,
513,
293,
4097,
580,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6341,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
5389,
29896,
3108,
297,
6796,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29891,
29896,
613,
376,
29891,
29946,
20068,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6341,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
1187,
29896,
3108,
297,
6796,
29891,
29906,
613,
376,
29891,
29941,
20068,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6341,
29918,
19529,
292,
29918,
513,
293,
4097,
3366,
1187,
29906,
3108,
297,
6796,
29891,
29945,
20068,
13,
13,
1678,
822,
1243,
29918,
517,
29918,
23443,
2674,
29898,
1311,
1125,
13,
4706,
13455,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
613,
29871,
29906,
29889,
29896,
29947,
29900,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29941,
613,
29871,
29896,
29889,
29947,
29896,
29929,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
613,
29871,
29896,
29889,
29946,
29947,
29941,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29896,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
613,
29871,
29896,
29889,
29906,
29945,
29955,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
613,
29871,
29896,
29889,
29900,
29945,
29947,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29906,
29953,
29945,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29947,
29941,
29955,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29945,
29955,
29906,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29953,
613,
29871,
29896,
29889,
29896,
29947,
29953,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29955,
613,
29871,
29896,
29889,
29906,
29947,
29900,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29906,
29953,
29953,
511,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
613,
29871,
29900,
29889,
29953,
29906,
29946,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
613,
29871,
29906,
29889,
29896,
29945,
29941,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29941,
29896,
29941,
511,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
613,
29871,
29900,
29889,
29955,
29929,
29945,
511,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
613,
29871,
29900,
29889,
29941,
29946,
29947,
511,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29941,
29945,
29953,
511,
13,
9651,
21251,
13,
9651,
4589,
29918,
1707,
3790,
13,
18884,
376,
29916,
29896,
1115,
29871,
29900,
29889,
29900,
29947,
29906,
29892,
13,
18884,
376,
29916,
29906,
1115,
29871,
29900,
29889,
29896,
29906,
29900,
29892,
13,
18884,
376,
29916,
29941,
1115,
29871,
29900,
29889,
29946,
29953,
29955,
29892,
13,
18884,
376,
29891,
29896,
1115,
29871,
29896,
29889,
29947,
29929,
29896,
29892,
13,
18884,
376,
29891,
29906,
1115,
29871,
29955,
29889,
29941,
29955,
29941,
29892,
13,
18884,
376,
29891,
29941,
1115,
29871,
29945,
29889,
29900,
29953,
29955,
29892,
13,
18884,
376,
29891,
29946,
1115,
29871,
29941,
29889,
29896,
29946,
29947,
29892,
13,
18884,
376,
29891,
29945,
1115,
29871,
29906,
29889,
29941,
29945,
29896,
29892,
13,
18884,
376,
29891,
29953,
1115,
29871,
29946,
29889,
29929,
29945,
29946,
29892,
13,
18884,
376,
29891,
29955,
1115,
29871,
29941,
29889,
29946,
29941,
29896,
29892,
13,
18884,
376,
29891,
29947,
1115,
29871,
29941,
29889,
29906,
29945,
29946,
29892,
13,
18884,
376,
5389,
29896,
1115,
29871,
29900,
29889,
29946,
29946,
29947,
29892,
13,
18884,
376,
1187,
29896,
1115,
29871,
29941,
29889,
29929,
29945,
29953,
29892,
13,
18884,
376,
1187,
29906,
1115,
29871,
29900,
29889,
29896,
29955,
29906,
29892,
13,
9651,
2981,
13,
4706,
1723,
13,
4706,
13455,
29918,
23443,
2674,
353,
13455,
29889,
517,
29918,
23443,
2674,
580,
13,
13,
4706,
26190,
353,
5159,
13,
4706,
24987,
29918,
21693,
353,
518,
13,
9651,
376,
29891,
29896,
613,
13,
9651,
376,
29891,
29906,
613,
13,
9651,
376,
29891,
29941,
613,
13,
9651,
376,
29891,
29946,
613,
13,
9651,
376,
29891,
29945,
613,
13,
9651,
376,
29891,
29953,
613,
13,
9651,
376,
29891,
29955,
613,
13,
9651,
376,
29891,
29947,
613,
13,
9651,
376,
29916,
29896,
613,
13,
9651,
376,
29916,
29906,
613,
13,
9651,
376,
29916,
29941,
613,
13,
9651,
376,
5389,
29896,
613,
13,
9651,
376,
1187,
29896,
613,
13,
9651,
376,
1187,
29906,
613,
13,
4706,
4514,
13,
4706,
363,
722,
297,
24987,
29918,
21693,
29901,
13,
9651,
26190,
29889,
4397,
29898,
17482,
29918,
23443,
2674,
29889,
1187,
29889,
2248,
29898,
1707,
876,
13,
13,
4706,
634,
29874,
29918,
276,
2098,
353,
518,
17482,
29918,
23443,
2674,
29889,
1187,
29961,
29875,
29962,
363,
474,
297,
26190,
29962,
13,
13,
4706,
350,
29918,
276,
2098,
353,
13455,
29918,
23443,
2674,
29889,
29933,
29961,
2248,
292,
29892,
584,
3816,
29901,
29892,
26190,
29962,
13,
4706,
350,
29918,
20227,
29918,
276,
2098,
353,
13455,
29918,
23443,
2674,
29889,
29933,
29918,
20227,
29918,
13168,
29961,
2248,
292,
29892,
584,
3816,
29901,
29892,
26190,
29962,
13,
13,
4706,
503,
1187,
29918,
276,
2098,
353,
13455,
29918,
23443,
2674,
29889,
11327,
29961,
2248,
292,
29892,
584,
3816,
29901,
29892,
26190,
29962,
13,
4706,
503,
1187,
29918,
20227,
29918,
276,
2098,
353,
13455,
29918,
23443,
2674,
29889,
11327,
29918,
20227,
29918,
13168,
29961,
2248,
292,
29892,
584,
3816,
29901,
29892,
26190,
29962,
13,
13,
4706,
281,
12864,
29918,
29891,
29918,
276,
2098,
353,
13455,
29918,
23443,
2674,
29889,
17864,
29918,
29891,
7503,
29892,
26190,
29962,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16908,
29918,
21693,
29892,
634,
29874,
29918,
276,
2098,
29897,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
350,
29918,
276,
2098,
29892,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
503,
1187,
29918,
276,
2098,
29892,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
350,
29918,
20227,
29918,
276,
2098,
29892,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29900,
29900,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29906,
29945,
29955,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29900,
29945,
29947,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29906,
29953,
29945,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29900,
29900,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29896,
29947,
29953,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29906,
29947,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29906,
29953,
29953,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29900,
29900,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29889,
29896,
29947,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29947,
29896,
29929,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29946,
29947,
29941,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29945,
29955,
29906,
29892,
29871,
29900,
29889,
29947,
29941,
29955,
29892,
29871,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
503,
1187,
29918,
20227,
29918,
276,
2098,
29892,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29896,
29889,
29947,
29929,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29953,
29906,
29946,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29955,
29889,
29941,
29955,
29941,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29941,
29896,
29941,
29892,
29871,
29900,
29892,
29871,
29906,
29889,
29896,
29945,
29941,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29945,
29889,
29900,
29953,
29955,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29955,
29929,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29889,
29941,
29896,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29889,
29896,
29946,
29947,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29941,
29946,
29947,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29889,
29953,
29906,
29946,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29889,
29941,
29945,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29906,
29889,
29896,
29945,
29941,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29946,
29889,
29929,
29945,
29946,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29941,
29945,
29953,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29955,
29929,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29941,
29889,
29946,
29941,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29941,
29946,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29889,
29941,
29945,
29953,
29892,
29871,
29900,
29892,
29871,
29941,
29889,
29906,
29945,
29946,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29900,
29947,
29906,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29896,
29906,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29946,
29953,
29955,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29946,
29946,
29947,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29941,
29889,
29929,
29945,
29953,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29896,
29955,
29906,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
13455,
29918,
23443,
2674,
29889,
17864,
29918,
29891,
29892,
13,
9651,
7442,
29889,
2378,
29898,
13,
18884,
518,
13,
462,
1678,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
18884,
4514,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
517,
29918,
3166,
29918,
23443,
2674,
29898,
1311,
1125,
13,
4706,
13455,
29918,
23443,
2674,
353,
1583,
29889,
17482,
29889,
517,
29918,
23443,
2674,
580,
13,
4706,
9833,
29918,
23443,
2674,
353,
1583,
29889,
13094,
29889,
517,
29918,
23443,
2674,
580,
13,
4706,
13455,
29918,
7529,
29918,
23443,
2674,
353,
1583,
29889,
17482,
29918,
7529,
29889,
517,
29918,
23443,
2674,
580,
13,
4706,
2888,
29918,
23443,
2674,
353,
1583,
29889,
6341,
29889,
517,
29918,
23443,
2674,
580,
13,
13,
4706,
13455,
29918,
4262,
353,
13455,
29918,
23443,
2674,
29889,
517,
29918,
1660,
29924,
9527,
580,
13,
4706,
9833,
29918,
4262,
353,
9833,
29918,
23443,
2674,
29889,
517,
29918,
1660,
29924,
9527,
580,
13,
4706,
13455,
29918,
7529,
29918,
4262,
353,
13455,
29918,
7529,
29918,
23443,
2674,
29889,
517,
29918,
1660,
29924,
9527,
580,
13,
4706,
2888,
29918,
4262,
353,
2888,
29918,
23443,
2674,
29889,
517,
29918,
1660,
29924,
9527,
580,
13,
13,
4706,
396,
4321,
13455,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
18010,
25739,
731,
29898,
17482,
29918,
4262,
29889,
4262,
29889,
18010,
22130,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
17482,
29889,
4262,
29889,
287,
2710,
25739,
731,
29898,
17482,
29918,
4262,
29889,
4262,
29889,
287,
2710,
22130,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
731,
29898,
17482,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
22130,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
17482,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
511,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
17482,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
17482,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
511,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
25739,
731,
29898,
17482,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
3101,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
25739,
731,
29898,
17482,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
3101,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29889,
5066,
1237,
29892,
13455,
29918,
4262,
29889,
5066,
1237,
29897,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29889,
711,
643,
1490,
29892,
13455,
29918,
4262,
29889,
711,
643,
1490,
29897,
13,
13,
4706,
396,
4321,
9833,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
18010,
25739,
731,
29898,
13094,
29918,
4262,
29889,
4262,
29889,
18010,
22130,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
13094,
29889,
4262,
29889,
287,
2710,
25739,
731,
29898,
13094,
29918,
4262,
29889,
4262,
29889,
287,
2710,
22130,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
731,
29898,
13094,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
22130,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
13094,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
511,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13094,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
13094,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
511,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
13094,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
25739,
731,
29898,
13094,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
3101,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
13094,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
25739,
731,
29898,
13094,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
3101,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
13094,
29889,
5066,
1237,
29892,
9833,
29918,
4262,
29889,
5066,
1237,
29897,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
13094,
29889,
711,
643,
1490,
29892,
9833,
29918,
4262,
29889,
711,
643,
1490,
29897,
13,
13,
4706,
396,
4321,
13455,
29918,
7529,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
18010,
25739,
731,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
4262,
29889,
18010,
3101,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
4262,
29889,
287,
2710,
25739,
731,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
4262,
29889,
287,
2710,
3101,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
731,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
13,
4706,
1723,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
1583,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29892,
13,
18884,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
13,
18884,
7688,
29922,
8516,
29892,
13,
9651,
10353,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
13455,
29918,
4262,
29889,
3127,
29918,
4262,
29892,
13,
18884,
18778,
295,
391,
29922,
24582,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
13,
18884,
7688,
29922,
8516,
29892,
13,
9651,
10353,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
25739,
13,
9651,
731,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
25739,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
25739,
13,
9651,
731,
29898,
17482,
29918,
7529,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
25739,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
5066,
1237,
29892,
13455,
29918,
7529,
29918,
4262,
29889,
5066,
1237,
29897,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
17482,
29918,
7529,
29889,
711,
643,
1490,
29892,
13455,
29918,
7529,
29918,
4262,
29889,
711,
643,
1490,
29897,
13,
13,
4706,
396,
4321,
13455,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
6341,
29889,
4262,
29889,
18010,
25739,
731,
29898,
6341,
29918,
4262,
29889,
4262,
29889,
18010,
22130,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
6341,
29889,
4262,
29889,
287,
2710,
25739,
731,
29898,
6341,
29918,
4262,
29889,
4262,
29889,
287,
2710,
22130,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
842,
29898,
1311,
29889,
6341,
29889,
3127,
29918,
4262,
29889,
18010,
25739,
731,
29898,
6341,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
22130,
13,
4706,
302,
415,
29889,
9294,
29918,
2378,
29918,
11745,
29898,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
13,
18884,
1583,
29889,
6341,
29889,
3127,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
1311,
29889,
6341,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
13,
9651,
10353,
13,
9651,
302,
29916,
29889,
517,
29918,
23749,
29918,
5344,
29898,
6341,
29918,
4262,
29892,
18778,
295,
391,
29922,
24582,
29898,
6341,
29918,
4262,
29889,
3127,
29918,
4262,
29889,
18010,
3101,
511,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
6341,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
25739,
731,
29898,
6341,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
18010,
3101,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
731,
29898,
1311,
29889,
6341,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
25739,
731,
29898,
6341,
29918,
4262,
29889,
8159,
29918,
4262,
29918,
4984,
29889,
287,
2710,
3101,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
6341,
29889,
5066,
1237,
29892,
2888,
29918,
4262,
29889,
5066,
1237,
29897,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
6341,
29889,
711,
643,
1490,
29892,
2888,
29918,
4262,
29889,
711,
643,
1490,
29897,
13,
13,
1678,
822,
1243,
29918,
440,
29918,
9067,
800,
29918,
17482,
29898,
1311,
1125,
13,
4706,
6287,
353,
8853,
1187,
29896,
1115,
376,
29891,
29896,
613,
376,
1187,
29906,
1115,
376,
29891,
29945,
613,
376,
5389,
29896,
1115,
376,
29916,
29896,
9092,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29892,
376,
29916,
29896,
613,
376,
29891,
29896,
613,
6287,
29897,
13,
13,
4706,
363,
343,
297,
6796,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
3108,
29901,
13,
9651,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29898,
13,
18884,
1060,
543,
1187,
29896,
613,
612,
29922,
29891,
29892,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
9651,
1723,
13,
9651,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
343,
29897,
13,
9651,
1583,
29889,
9294,
5574,
29898,
17350,
29891,
29896,
613,
343,
29897,
297,
2989,
29918,
4262,
29889,
287,
2710,
29897,
13,
9651,
1583,
29889,
9294,
8824,
29898,
703,
1187,
29896,
613,
343,
29897,
297,
2989,
29918,
4262,
29889,
287,
2710,
29897,
13,
13,
4706,
363,
343,
297,
6796,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
3108,
29901,
13,
9651,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29898,
13,
18884,
1060,
543,
1187,
29906,
613,
612,
29922,
29891,
29892,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
9651,
1723,
13,
9651,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
343,
29897,
13,
9651,
1583,
29889,
9294,
5574,
29898,
17350,
29891,
29945,
613,
343,
29897,
297,
2989,
29918,
4262,
29889,
287,
2710,
29897,
13,
9651,
1583,
29889,
9294,
8824,
29898,
703,
1187,
29906,
613,
343,
29897,
297,
2989,
29918,
4262,
29889,
287,
2710,
29897,
13,
13,
4706,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
1060,
543,
5389,
29896,
613,
612,
543,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
376,
29891,
29896,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29896,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
1060,
543,
5389,
29896,
613,
612,
543,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
376,
29891,
29945,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29891,
29896,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29906,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
1187,
29896,
613,
376,
1187,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
1187,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
17482,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
1060,
543,
1187,
29896,
613,
612,
543,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
376,
29891,
29945,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29891,
29896,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29906,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
1187,
29896,
613,
376,
1187,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
1187,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
1678,
822,
1243,
29918,
440,
29918,
9067,
800,
29918,
13094,
29898,
1311,
1125,
13,
4706,
6287,
353,
6571,
13,
4706,
363,
318,
29892,
325,
297,
1583,
29889,
13094,
29889,
4262,
29889,
287,
2710,
7295,
13,
9651,
2989,
29918,
4262,
29892,
14278,
29918,
1707,
353,
1583,
29889,
13094,
3032,
440,
29918,
9067,
800,
29898,
13,
18884,
318,
29892,
325,
29892,
21640,
29918,
513,
293,
4097,
29922,
7052,
13,
9651,
1723,
13,
9651,
1583,
29889,
9294,
8824,
3552,
29884,
29892,
325,
29897,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
9651,
1583,
29889,
9294,
9843,
29898,
18980,
29918,
1707,
29892,
325,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
440,
29879,
29918,
17482,
29898,
1311,
1125,
13,
4706,
6287,
353,
8853,
1187,
29896,
1115,
376,
29891,
29896,
613,
376,
1187,
29906,
1115,
376,
29891,
29945,
613,
376,
5389,
29896,
1115,
376,
29916,
29896,
9092,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29941,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29906,
613,
376,
29891,
29946,
613,
376,
29891,
29953,
613,
376,
29891,
29947,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29946,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29941,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
10758,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29953,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29955,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29955,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29906,
613,
376,
29891,
29946,
613,
376,
29891,
29953,
613,
376,
29891,
29947,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29947,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29955,
10758,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29916,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29941,
613,
376,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29916,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29906,
613,
376,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
613,
376,
29891,
29953,
613,
376,
29891,
29955,
613,
376,
29891,
29947,
10758,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
8853,
29916,
29906,
613,
376,
29916,
29941,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
13,
9651,
8853,
29916,
29906,
613,
376,
29916,
29941,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
10758,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
1116,
3245,
29918,
440,
29879,
29918,
17482,
29898,
1311,
1125,
13,
4706,
6287,
353,
8853,
1187,
29896,
1115,
376,
29891,
29896,
613,
376,
1187,
29906,
1115,
376,
29891,
29945,
613,
376,
5389,
29896,
1115,
376,
29916,
29896,
9092,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29946,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29953,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29955,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29906,
613,
376,
29891,
29947,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29916,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29916,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
518,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
17482,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
5159,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
440,
29879,
29918,
13094,
29898,
1311,
1125,
13,
4706,
6287,
353,
6571,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
731,
580,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
311,
571,
3977,
613,
376,
348,
1080,
264,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
731,
580,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
29880,
3717,
627,
613,
376,
348,
1080,
264,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
731,
580,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
311,
571,
3977,
613,
376,
29880,
3717,
627,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
731,
580,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
482,
613,
376,
29880,
3717,
627,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
8853,
29891,
2288,
19958,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
440,
29879,
703,
482,
613,
376,
311,
571,
3977,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
511,
8853,
29891,
2288,
19958,
9092,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
1116,
3245,
29918,
440,
29879,
29918,
13094,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
29891,
2288,
19958,
613,
376,
348,
1080,
264,
4968,
13,
9651,
518,
703,
482,
613,
8853,
29880,
3717,
627,
613,
376,
311,
571,
3977,
29908,
1800,
1402,
13,
4706,
1723,
13,
4706,
396,
910,
1206,
7656,
29915,
29873,
505,
2148,
277,
7177,
6599,
565,
278,
14990,
2779,
1546,
421,
311,
571,
3977,
29952,
322,
13,
4706,
396,
421,
348,
1080,
264,
29952,
4225,
304,
367,
15712,
1363,
697,
310,
278,
15047,
2286,
12185,
373,
278,
13,
4706,
396,
2779,
2224,
29889,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
311,
571,
3977,
613,
376,
348,
1080,
264,
4968,
13,
9651,
518,
703,
482,
613,
8853,
29891,
2288,
19958,
613,
376,
29880,
3717,
627,
29908,
1800,
1402,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
29880,
3717,
627,
613,
376,
348,
1080,
264,
4968,
13,
9651,
518,
703,
482,
613,
8853,
29891,
2288,
19958,
613,
376,
311,
571,
3977,
29908,
1800,
1402,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
311,
571,
3977,
613,
376,
29880,
3717,
627,
4968,
518,
2314,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
482,
613,
376,
29880,
3717,
627,
4968,
518,
703,
29891,
2288,
19958,
613,
8853,
311,
571,
3977,
29908,
1800,
29962,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
13094,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
482,
613,
376,
311,
571,
3977,
4968,
518,
2314,
13,
13,
1678,
822,
1243,
29918,
440,
29918,
9067,
800,
29918,
6341,
29898,
1311,
1125,
13,
4706,
6287,
29918,
6341,
353,
8853,
1187,
29896,
1115,
376,
29891,
29906,
613,
376,
1187,
29906,
1115,
376,
29891,
29945,
613,
376,
5389,
29896,
1115,
376,
29916,
29896,
9092,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
5389,
29896,
613,
376,
29916,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29916,
29906,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29916,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
29916,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
5389,
29896,
613,
376,
29891,
29946,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29946,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29946,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
29891,
29946,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
5389,
29896,
613,
376,
29891,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29896,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
29891,
29946,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
5389,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29906,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29896,
613,
376,
29891,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
29891,
29896,
613,
376,
1187,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
29891,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29906,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29896,
613,
376,
29891,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29916,
29896,
613,
376,
29891,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
29891,
29896,
613,
376,
1187,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
5389,
29896,
613,
376,
1187,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
29891,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29945,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
1187,
29906,
613,
376,
29891,
29945,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
29891,
29896,
613,
376,
1187,
29906,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
29891,
29946,
613,
376,
29891,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29896,
1159,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
29891,
29946,
613,
376,
29891,
29896,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
4706,
2989,
29918,
4262,
29892,
722,
353,
1583,
29889,
6341,
3032,
440,
29918,
9067,
800,
29898,
13,
9651,
376,
1187,
29896,
613,
376,
29891,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1707,
29892,
376,
29891,
29941,
1159,
13,
4706,
1583,
29889,
9294,
5574,
29898,
17350,
29891,
29906,
613,
376,
29891,
29941,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
4706,
1583,
29889,
9294,
8824,
29898,
703,
1187,
29896,
613,
376,
29891,
29941,
1159,
297,
2989,
29918,
4262,
29889,
287,
2710,
3101,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
440,
29879,
29918,
6341,
29898,
1311,
1125,
13,
4706,
6287,
29918,
6341,
353,
8853,
1187,
29896,
1115,
376,
29891,
29906,
613,
376,
1187,
29906,
1115,
376,
29891,
29945,
613,
376,
5389,
29896,
1115,
376,
29916,
29896,
9092,
13,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29916,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
13,
9651,
8853,
29891,
29896,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29891,
29946,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
8853,
29916,
29906,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
29891,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
8853,
29916,
29906,
613,
376,
29891,
29946,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
5389,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
8853,
29916,
29906,
613,
376,
29891,
29946,
9092,
13,
4706,
1723,
13,
4706,
396,
14402,
29901,
4321,
445,
322,
2329,
29889,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
29891,
29896,
613,
376,
1187,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
8853,
29916,
29906,
613,
376,
29891,
29946,
613,
376,
29891,
29945,
9092,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
29891,
29896,
613,
376,
1187,
29906,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
13,
9651,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29891,
29906,
613,
376,
29891,
29941,
613,
376,
29891,
29946,
10758,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
1311,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
29891,
29946,
613,
376,
29891,
29896,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
731,
3101,
13,
4706,
1583,
29889,
9294,
2697,
9843,
29898,
13,
9651,
1583,
29889,
6341,
29889,
657,
29918,
440,
29879,
703,
1187,
29896,
613,
376,
29891,
29941,
613,
21640,
29918,
513,
293,
4097,
29922,
7052,
29918,
6341,
511,
8853,
29916,
29896,
613,
376,
29916,
29906,
613,
376,
29891,
29946,
9092,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
9278,
29918,
4299,
29918,
440,
29879,
29898,
1311,
1125,
13,
4706,
1904,
29896,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
703,
29990,
613,
376,
29979,
4968,
4852,
29902,
613,
376,
29990,
4968,
4852,
29956,
613,
376,
29902,
1159,
1402,
13,
9651,
3405,
1237,
11759,
1402,
13,
9651,
4589,
29918,
29725,
11759,
703,
29956,
613,
376,
29979,
1159,
1402,
13,
9651,
4589,
29918,
1707,
3790,
1118,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4299,
29896,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
29990,
613,
376,
29979,
4968,
518,
703,
29902,
613,
8853,
29956,
29908,
1800,
2314,
13,
13,
4706,
1904,
29906,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
703,
29916,
613,
376,
29891,
4968,
4852,
29920,
613,
376,
29916,
4968,
4852,
29893,
613,
376,
29920,
4968,
4852,
29893,
613,
376,
29884,
4968,
4852,
29884,
613,
376,
29916,
4968,
4852,
29884,
613,
376,
29891,
1159,
1402,
13,
9651,
3405,
1237,
29922,
3366,
29884,
12436,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4299,
29906,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
29916,
613,
376,
29891,
4968,
518,
703,
29920,
613,
8853,
29893,
29908,
1800,
2314,
13,
13,
4706,
1904,
29941,
353,
3725,
29924,
9527,
29898,
774,
3322,
11759,
703,
29916,
613,
376,
29891,
4968,
4852,
29884,
613,
376,
29916,
4968,
4852,
29884,
613,
376,
29891,
4968,
4852,
29920,
613,
376,
29916,
1159,
1402,
3405,
1237,
29922,
3366,
29884,
20068,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4299,
29941,
29889,
657,
29918,
440,
29879,
703,
29916,
613,
376,
29891,
4968,
8853,
29920,
29908,
1800,
13,
13,
4706,
1904,
29946,
353,
3725,
29924,
9527,
29898,
774,
3322,
11759,
703,
29916,
613,
376,
29891,
4968,
4852,
29920,
613,
376,
29916,
4968,
4852,
29884,
613,
376,
29916,
4968,
4852,
29884,
613,
376,
29891,
1159,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4299,
29946,
29889,
657,
29918,
1116,
3245,
29918,
440,
29879,
703,
29916,
613,
376,
29891,
4968,
518,
703,
29920,
613,
8853,
29884,
29908,
1800,
2314,
13,
13,
13,
1990,
4321,
1660,
1529,
19920,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
17482,
353,
3725,
29924,
9527,
29898,
13,
9651,
18230,
3322,
11759,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29896,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29906,
613,
29871,
29906,
29889,
29896,
29947,
29900,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
29916,
29941,
613,
29871,
29896,
29889,
29947,
29896,
29929,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29896,
613,
29871,
29896,
29889,
29946,
29947,
29941,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29896,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29906,
613,
29871,
29896,
29889,
29906,
29945,
29955,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29941,
613,
29871,
29896,
29889,
29900,
29945,
29947,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29906,
29953,
29945,
511,
13,
18884,
4852,
1187,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29947,
29941,
29955,
511,
13,
18884,
4852,
5389,
29896,
613,
376,
1187,
29906,
613,
29871,
29900,
29889,
29945,
29955,
29906,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29945,
613,
29871,
29896,
29889,
29900,
29900,
29900,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29953,
613,
29871,
29896,
29889,
29896,
29947,
29953,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29955,
613,
29871,
29896,
29889,
29906,
29947,
29900,
511,
13,
18884,
4852,
1187,
29906,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29906,
29953,
29953,
511,
13,
9651,
21251,
13,
9651,
3405,
1237,
29922,
3366,
5389,
29896,
613,
376,
1187,
29896,
613,
376,
1187,
29906,
12436,
13,
9651,
4589,
29918,
29725,
11759,
13,
18884,
4852,
29891,
29896,
613,
376,
29891,
29945,
613,
29871,
29900,
29889,
29953,
29906,
29946,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29953,
613,
29871,
29906,
29889,
29896,
29945,
29941,
511,
13,
18884,
4852,
29891,
29906,
613,
376,
29891,
29946,
613,
29871,
29896,
29889,
29941,
29896,
29941,
511,
13,
18884,
4852,
29891,
29941,
613,
376,
29891,
29955,
613,
29871,
29900,
29889,
29955,
29929,
29945,
511,
13,
18884,
4852,
29891,
29946,
613,
376,
29891,
29947,
613,
29871,
29900,
29889,
29941,
29946,
29947,
511,
13,
18884,
4852,
29891,
29953,
613,
376,
29891,
29947,
613,
29871,
29896,
29889,
29941,
29945,
29953,
511,
13,
9651,
21251,
13,
9651,
4589,
29918,
1707,
3790,
13,
18884,
376,
29916,
29896,
1115,
29871,
29900,
29889,
29900,
29947,
29906,
29892,
13,
18884,
376,
29916,
29906,
1115,
29871,
29900,
29889,
29896,
29906,
29900,
29892,
13,
18884,
376,
29916,
29941,
1115,
29871,
29900,
29889,
29946,
29953,
29955,
29892,
13,
18884,
376,
29891,
29896,
1115,
29871,
29896,
29889,
29947,
29929,
29896,
29892,
13,
18884,
376,
29891,
29906,
1115,
29871,
29955,
29889,
29941,
29955,
29941,
29892,
13,
18884,
376,
29891,
29941,
1115,
29871,
29945,
29889,
29900,
29953,
29955,
29892,
13,
18884,
376,
29891,
29946,
1115,
29871,
29941,
29889,
29896,
29946,
29947,
29892,
13,
18884,
376,
29891,
29945,
1115,
29871,
29906,
29889,
29941,
29945,
29896,
29892,
13,
18884,
376,
29891,
29953,
1115,
29871,
29946,
29889,
29929,
29945,
29946,
29892,
13,
18884,
376,
29891,
29955,
1115,
29871,
29941,
29889,
29946,
29941,
29896,
29892,
13,
18884,
376,
29891,
29947,
1115,
29871,
29941,
29889,
29906,
29945,
29946,
29892,
13,
18884,
376,
5389,
29896,
1115,
29871,
29900,
29889,
29946,
29946,
29947,
29892,
13,
18884,
376,
1187,
29896,
1115,
29871,
29941,
29889,
29929,
29945,
29953,
29892,
13,
18884,
376,
1187,
29906,
1115,
29871,
29900,
29889,
29896,
29955,
29906,
29892,
13,
9651,
2981,
13,
4706,
1723,
13,
4706,
1583,
29889,
17482,
29918,
23443,
2674,
353,
1583,
29889,
17482,
29889,
517,
29918,
23443,
2674,
580,
13,
13,
4706,
1583,
29889,
9278,
29918,
4299,
353,
3725,
29924,
29889,
3166,
29918,
4262,
29898,
13,
9651,
18230,
3322,
11759,
703,
29990,
613,
376,
29979,
613,
29871,
29900,
29889,
29941,
29897,
1402,
3405,
1237,
11759,
1402,
4589,
29918,
1707,
3790,
29908,
29990,
1115,
29871,
29900,
29889,
29896,
29892,
376,
29979,
1115,
29871,
29900,
29889,
29896,
29913,
13,
4706,
1723,
13,
4706,
1583,
29889,
9278,
29918,
4299,
29918,
23443,
2674,
353,
1583,
29889,
9278,
29918,
4299,
29889,
517,
29918,
23443,
2674,
580,
13,
13,
1678,
822,
1243,
29918,
17158,
29918,
27736,
29898,
1311,
1125,
13,
4706,
11916,
353,
1583,
29889,
9278,
29918,
4299,
29918,
23443,
2674,
29889,
17158,
29918,
27736,
29898,
29876,
29918,
27736,
29922,
29896,
29900,
29900,
29897,
13,
4706,
11916,
353,
1583,
29889,
17482,
29918,
23443,
2674,
29889,
17158,
29918,
27736,
29898,
29876,
29918,
27736,
29922,
29896,
29900,
29900,
29897,
13,
2
] |
contessa/alembic/packages_migrations.py | mindartur/contessa | 15 | 1607600 | migration_map = {
"0.0.0": "54f8985b0ee5",
"0.2.4": "480e6618700d",
"0.2.5": "a179e5ca0ad2",
}
| [
1,
20332,
29918,
1958,
353,
426,
13,
1678,
376,
29900,
29889,
29900,
29889,
29900,
1115,
376,
29945,
29946,
29888,
29947,
29929,
29947,
29945,
29890,
29900,
3905,
29945,
613,
13,
1678,
376,
29900,
29889,
29906,
29889,
29946,
1115,
376,
29946,
29947,
29900,
29872,
29953,
29953,
29896,
29947,
29955,
29900,
29900,
29881,
613,
13,
1678,
376,
29900,
29889,
29906,
29889,
29945,
1115,
376,
29874,
29896,
29955,
29929,
29872,
29945,
1113,
29900,
328,
29906,
613,
13,
29913,
13,
2
] |
brambling/forms/invites.py | Shivanjain023/django-brambling | 8 | 98277 | <reponame>Shivanjain023/django-brambling
from django.forms import BaseFormSet
import floppyforms as forms
from brambling.utils.invites import (
get_invite_class,
OrganizationOwnerInvite,
OrganizationEditInvite,
OrganizationViewInvite,
EventEditInvite,
EventViewInvite,
)
class BaseInviteFormSet(BaseFormSet):
def __init__(self, request, content, *args, **kwargs):
self.request = request
self.content = content
super(BaseInviteFormSet, self).__init__(*args, **kwargs)
def _construct_form(self, i, **kwargs):
kwargs['request'] = self.request
kwargs['content'] = self.content
return super(BaseInviteFormSet, self)._construct_form(i, **kwargs)
@property
def empty_form(self):
form = self.form(
auto_id=self.auto_id,
prefix=self.add_prefix('__prefix__'),
empty_permitted=True,
request=self.request,
content=self.content,
)
self.add_fields(form, None)
return form
def save(self):
deleted_forms = set(self.deleted_forms)
for form in self:
if form not in deleted_forms and form.has_changed():
form.save()
class BaseInviteForm(forms.Form):
email = forms.EmailField()
kind = forms.ChoiceField()
choices = ()
def __init__(self, request, content, *args, **kwargs):
super(BaseInviteForm, self).__init__(*args, **kwargs)
self.request = request
self.content = content
self.fields['kind'].choices = self.choices
self.fields['kind'].initial = self.choices[0][0]
def save(self):
invite_class = get_invite_class(self.cleaned_data['kind'])
invite, created = invite_class.get_or_create(
request=self.request,
email=self.cleaned_data['email'],
content=self.content,
)
if created:
invite.send()
class EventAdminInviteForm(BaseInviteForm):
choices = (
(EventEditInvite.slug, EventEditInvite.verbose_name),
(EventViewInvite.slug, EventViewInvite.verbose_name),
)
class OrganizationAdminInviteForm(BaseInviteForm):
choices = (
(OrganizationOwnerInvite.slug, OrganizationOwnerInvite.verbose_name),
(OrganizationEditInvite.slug, OrganizationEditInvite.verbose_name),
(OrganizationViewInvite.slug, OrganizationViewInvite.verbose_name),
)
| [
1,
529,
276,
1112,
420,
29958,
2713,
20595,
29926,
475,
29900,
29906,
29941,
29914,
14095,
29899,
1182,
1117,
1847,
13,
3166,
9557,
29889,
9514,
1053,
7399,
2500,
2697,
13,
13,
5215,
5685,
23717,
9514,
408,
7190,
13,
13,
3166,
1506,
1117,
1847,
29889,
13239,
29889,
11569,
3246,
1053,
313,
13,
1678,
679,
29918,
11569,
568,
29918,
1990,
29892,
13,
1678,
9205,
2133,
28213,
12165,
568,
29892,
13,
1678,
9205,
2133,
6103,
12165,
568,
29892,
13,
1678,
9205,
2133,
1043,
12165,
568,
29892,
13,
1678,
6864,
6103,
12165,
568,
29892,
13,
1678,
6864,
1043,
12165,
568,
29892,
13,
29897,
13,
13,
13,
1990,
7399,
12165,
568,
2500,
2697,
29898,
5160,
2500,
2697,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2009,
29892,
2793,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
3827,
353,
2009,
13,
4706,
1583,
29889,
3051,
353,
2793,
13,
4706,
2428,
29898,
5160,
12165,
568,
2500,
2697,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
822,
903,
11433,
29918,
689,
29898,
1311,
29892,
474,
29892,
3579,
19290,
1125,
13,
4706,
9049,
5085,
1839,
3827,
2033,
353,
1583,
29889,
3827,
13,
4706,
9049,
5085,
1839,
3051,
2033,
353,
1583,
29889,
3051,
13,
4706,
736,
2428,
29898,
5160,
12165,
568,
2500,
2697,
29892,
1583,
467,
29918,
11433,
29918,
689,
29898,
29875,
29892,
3579,
19290,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
4069,
29918,
689,
29898,
1311,
1125,
13,
4706,
883,
353,
1583,
29889,
689,
29898,
13,
9651,
4469,
29918,
333,
29922,
1311,
29889,
6921,
29918,
333,
29892,
13,
9651,
10944,
29922,
1311,
29889,
1202,
29918,
13506,
877,
1649,
13506,
1649,
5477,
13,
9651,
4069,
29918,
17858,
4430,
29922,
5574,
29892,
13,
9651,
2009,
29922,
1311,
29889,
3827,
29892,
13,
9651,
2793,
29922,
1311,
29889,
3051,
29892,
13,
4706,
1723,
13,
4706,
1583,
29889,
1202,
29918,
9621,
29898,
689,
29892,
6213,
29897,
13,
4706,
736,
883,
13,
13,
1678,
822,
4078,
29898,
1311,
1125,
13,
4706,
11132,
29918,
9514,
353,
731,
29898,
1311,
29889,
311,
22742,
29918,
9514,
29897,
13,
4706,
363,
883,
297,
1583,
29901,
13,
9651,
565,
883,
451,
297,
11132,
29918,
9514,
322,
883,
29889,
5349,
29918,
15033,
7295,
13,
18884,
883,
29889,
7620,
580,
13,
13,
13,
1990,
7399,
12165,
568,
2500,
29898,
9514,
29889,
2500,
1125,
13,
1678,
4876,
353,
7190,
29889,
9823,
3073,
580,
13,
1678,
2924,
353,
7190,
29889,
29620,
3073,
580,
13,
1678,
19995,
353,
3861,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2009,
29892,
2793,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
5160,
12165,
568,
2500,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
3827,
353,
2009,
13,
4706,
1583,
29889,
3051,
353,
2793,
13,
4706,
1583,
29889,
9621,
1839,
14380,
13359,
1859,
1575,
353,
1583,
29889,
1859,
1575,
13,
4706,
1583,
29889,
9621,
1839,
14380,
13359,
11228,
353,
1583,
29889,
1859,
1575,
29961,
29900,
3816,
29900,
29962,
13,
13,
1678,
822,
4078,
29898,
1311,
1125,
13,
4706,
2437,
568,
29918,
1990,
353,
679,
29918,
11569,
568,
29918,
1990,
29898,
1311,
29889,
14941,
287,
29918,
1272,
1839,
14380,
11287,
13,
4706,
2437,
568,
29892,
2825,
353,
2437,
568,
29918,
1990,
29889,
657,
29918,
272,
29918,
3258,
29898,
13,
9651,
2009,
29922,
1311,
29889,
3827,
29892,
13,
9651,
4876,
29922,
1311,
29889,
14941,
287,
29918,
1272,
1839,
5269,
7464,
13,
9651,
2793,
29922,
1311,
29889,
3051,
29892,
13,
4706,
1723,
13,
4706,
565,
2825,
29901,
13,
9651,
2437,
568,
29889,
6717,
580,
13,
13,
13,
1990,
6864,
12754,
12165,
568,
2500,
29898,
5160,
12165,
568,
2500,
1125,
13,
1678,
19995,
353,
313,
13,
4706,
313,
2624,
6103,
12165,
568,
29889,
29517,
29892,
6864,
6103,
12165,
568,
29889,
369,
15828,
29918,
978,
511,
13,
4706,
313,
2624,
1043,
12165,
568,
29889,
29517,
29892,
6864,
1043,
12165,
568,
29889,
369,
15828,
29918,
978,
511,
13,
1678,
1723,
13,
13,
13,
1990,
9205,
2133,
12754,
12165,
568,
2500,
29898,
5160,
12165,
568,
2500,
1125,
13,
1678,
19995,
353,
313,
13,
4706,
313,
27356,
2133,
28213,
12165,
568,
29889,
29517,
29892,
9205,
2133,
28213,
12165,
568,
29889,
369,
15828,
29918,
978,
511,
13,
4706,
313,
27356,
2133,
6103,
12165,
568,
29889,
29517,
29892,
9205,
2133,
6103,
12165,
568,
29889,
369,
15828,
29918,
978,
511,
13,
4706,
313,
27356,
2133,
1043,
12165,
568,
29889,
29517,
29892,
9205,
2133,
1043,
12165,
568,
29889,
369,
15828,
29918,
978,
511,
13,
1678,
1723,
13,
2
] |
newsapp/migrations/0003_news.py | adi112100/newsapp | 0 | 8815 | # Generated by Django 3.0.8 on 2020-07-11 08:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('newsapp', '0002_auto_20200711_1124'),
]
operations = [
migrations.CreateModel(
name='News',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField()),
('indian_news', models.TextField()),
('national_news', models.TextField()),
('international_news', models.TextField()),
('bollywood_news', models.TextField()),
('lifestyle_news', models.TextField()),
('sport_news', models.TextField()),
('business_news', models.TextField()),
('sharemarket_news', models.TextField()),
('corona_news', models.TextField()),
('space_news', models.TextField()),
('motivation_news', models.TextField()),
],
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29941,
29889,
29900,
29889,
29947,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29955,
29899,
29896,
29896,
29871,
29900,
29947,
29901,
29896,
29900,
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,
15753,
932,
742,
525,
29900,
29900,
29900,
29906,
29918,
6921,
29918,
29906,
29900,
29906,
29900,
29900,
29955,
29896,
29896,
29918,
29896,
29896,
29906,
29946,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
29328,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
12300,
3073,
29898,
6921,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
28755,
29922,
8824,
29892,
26952,
29918,
978,
2433,
1367,
1495,
511,
13,
18884,
6702,
1256,
742,
4733,
29889,
11384,
3073,
25739,
13,
18884,
6702,
513,
713,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
29876,
1288,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
14168,
1288,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
2095,
16239,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
29880,
7004,
1508,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
29879,
637,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
8262,
3335,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
13653,
28549,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
2616,
2681,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
3493,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
14817,
440,
362,
29918,
15753,
742,
4733,
29889,
15778,
25739,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
bob/blitz/examples/bob.example.project/bob/example/project/test.py | bioidiap/bob.blitz | 0 | 106536 | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""Test Units
"""
def test_version():
from .script import version
assert version.main() == 0
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
325,
326,
29901,
731,
934,
22331,
29922,
9420,
29899,
29947,
584,
13,
13,
15945,
29908,
3057,
28386,
13,
15945,
29908,
13,
13,
1753,
1243,
29918,
3259,
7295,
13,
29871,
515,
869,
2154,
1053,
1873,
13,
29871,
4974,
1873,
29889,
3396,
580,
1275,
29871,
29900,
13,
2
] |
src/TestBenchCliReporter/actions.py | StaudtEngineering/testbench-cli-reporter | 0 | 138081 | # Copyright 2021- imbus AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
from typing import Dict, Optional, Union
from zipfile import ZipFile
from abc import ABC, abstractmethod
from os import path
from xml.etree import ElementTree as ET
import sys
import base64
from TestBenchCliReporter import questions
from TestBenchCliReporter import testbench
from TestBenchCliReporter.util import (
close_program,
get_project_keys,
XmlExportConfig,
ImportConfig,
login,
pretty_print,
)
def Action(class_name: str, parameters: dict[str, str]) -> AbstractAction:
try:
return globals()[class_name](parameters)
except AttributeError:
print(f"Failed to create class {class_name}")
close_program()
class AbstractAction(ABC):
def __init__(self, parameters: Optional[Dict] = None):
self.parameters = parameters or {}
self.report_tmp_name = ""
self.job_id = ""
def prepare(self, connection_log: testbench.ConnectionLog) -> bool:
return True
@abstractmethod
def trigger(self, connection_log: testbench.ConnectionLog) -> bool:
raise NotImplementedError
def wait(self, connection_log: testbench.ConnectionLog) -> bool:
return True
def poll(self, connection_log: testbench.ConnectionLog) -> bool:
return True
def finish(self, connection_log: testbench.ConnectionLog) -> bool:
return True
def export(self):
return {"type": type(self).__name__, "parameters": self.parameters}
class UnloggedAction(AbstractAction):
def export(self):
return None
class ExportXMLReport(AbstractAction):
def prepare(self, connection_log: testbench.ConnectionLog) -> bool:
all_projects = connection_log.active_connection.get_all_projects()
selected_project = questions.ask_to_select_project(all_projects)
selected_tov = questions.ask_to_select_tov(selected_project)
self.parameters["tovKey"] = selected_tov["key"]["serial"]
self.parameters["projectPath"] = [
selected_project["name"],
selected_tov["name"],
]
selected_cycle = questions.ask_to_select_cycle(selected_tov, export=True)
print(" Selection:")
pretty_print(
{
"value": f"{' ' * 4 + selected_project['name']: <50}",
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" projectKey: ", "end": None},
{
"value": f"{selected_project['key']['serial']: >15}",
"style": "#06c8ff bold italic",
},
{
"value": f"{' ' * 6 + selected_tov['name']: <50}",
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" tovKey: ", "end": None},
{
"value": f"{selected_tov['key']['serial']: >15}",
"style": "#06c8ff bold italic",
},
)
if selected_cycle == "NO_EXEC":
self.parameters["cycleKey"] = None
tttree_structure = connection_log.active_connection.get_tov_structure(
self.parameters["tovKey"]
)
else:
pretty_print(
{
"value": f"{' ' * 8 + selected_cycle['name']: <50}",
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" cycleKey: ", "end": None},
{
"value": f"{selected_cycle['key']['serial']: >15}",
"style": "#06c8ff bold italic",
},
)
self.parameters["cycleKey"] = selected_cycle["key"]["serial"]
self.parameters["projectPath"].append(selected_cycle["name"])
tttree_structure = (
connection_log.active_connection.get_test_cycle_structure(
self.parameters["cycleKey"]
)
)
self.parameters["reportRootUID"] = questions.ask_to_select_report_root_uid(
tttree_structure
)
all_filters = connection_log.active_connection.get_all_filters()
self.parameters["filters"] = questions.ask_to_select_filters(all_filters)
self.parameters["report_config"] = questions.ask_to_config_report()
self.parameters["outputPath"] = questions.ask_for_output_path()
return True
def trigger(self, connection_log: testbench.ConnectionLog) -> Union[bool, str]:
if not self.parameters.get("cycleKey"):
if (
not self.parameters.get("tovKey")
and len(self.parameters["projectPath"]) >= 2
):
all_projects = connection_log.active_connection.get_all_projects()
(
project_key,
self.parameters["tovKey"],
self.parameters["cycleKey"],
) = get_project_keys(all_projects, *self.parameters["projectPath"])
self.job_id = connection_log.active_connection.trigger_xml_report_generation(
self.parameters.get("tovKey"),
self.parameters.get("cycleKey"),
self.parameters.get("reportRootUID", "ROOT"),
self.parameters.get("filters", []),
self.parameters.get("report_config", XmlExportConfig["Itep Export"]),
)
return self.job_id
def wait(self, connection_log: testbench.ConnectionLog) -> Union[bool, str]:
try:
self.report_tmp_name = (
connection_log.active_connection.wait_for_tmp_xml_report_name(
self.job_id
)
)
return self.report_tmp_name
except KeyError as e:
print(f"{str(e)}")
return False
def poll(self, connection_log: testbench.ConnectionLog) -> bool:
result = connection_log.active_connection.get_exp_job_result(self.job_id)
if result is not None:
self.report_tmp_name = result
return result
def finish(self, connection_log: testbench.ConnectionLog) -> bool:
report = connection_log.active_connection.get_xml_report_data(
self.report_tmp_name
)
with open(self.parameters["outputPath"], "wb") as output_file:
output_file.write(report)
pretty_print(
{"value": f"Report ", "end": None},
{
"value": f'{path.abspath(self.parameters["outputPath"])}',
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" was generated"},
)
return True
class ImportExecutionResults(AbstractAction):
def prepare(self, connection_log: testbench.ConnectionLog) -> bool:
self.parameters["inputPath"] = questions.ask_for_input_path()
project = version = cycle = None
try:
project, version, cycle = self.get_project_path_from_report()
except:
pass
all_projects = connection_log.active_connection.get_all_projects()
selected_project = questions.ask_to_select_project(
all_projects, default=project
)
selected_tov = questions.ask_to_select_tov(selected_project, default=version)
self.parameters["cycleKey"] = questions.ask_to_select_cycle(
selected_tov, default=cycle
)["key"]["serial"]
cycle_structure = connection_log.active_connection.get_test_cycle_structure(
self.parameters["cycleKey"]
)
self.parameters["reportRootUID"] = questions.ask_to_select_report_root_uid(
cycle_structure
)
available_testers = connection_log.active_connection.get_all_testers_of_project(
selected_project["key"]["serial"]
)
self.parameters["defaultTester"] = questions.ask_to_select_default_tester(
available_testers
)
all_filters = connection_log.active_connection.get_all_filters()
self.parameters["filters"] = questions.ask_to_select_filters(all_filters)
self.parameters["importConfig"] = questions.ask_to_config_import()
return True
def get_project_path_from_report(self):
zip_file = ZipFile(self.parameters["inputPath"])
xml = ET.fromstring(zip_file.read("report.xml"))
project = xml.find("./header/project").get("name")
version = xml.find("./header/version").get("name")
cycle = xml.find("./header/cycle").get("name")
return project, version, cycle
def trigger(self, connection_log: testbench.ConnectionLog) -> bool:
if not self.parameters.get("cycleKey"):
if len(self.parameters.get("projectPath", [])) != 3:
self.parameters["projectPath"] = self.get_project_path_from_report()
self.set_cycle_key_from_path(connection_log)
with open(self.parameters["inputPath"], "rb") as execution_report:
execution_report_base64 = base64.b64encode(execution_report.read()).decode()
serverside_file_name = (
connection_log.active_connection.upload_execution_results(
execution_report_base64
)
)
if serverside_file_name:
self.job_id = (
connection_log.active_connection.trigger_execution_results_import(
self.parameters["cycleKey"],
self.parameters["reportRootUID"],
serverside_file_name,
self.parameters["defaultTester"],
self.parameters["filters"],
self.parameters.get("importConfig", ImportConfig["Typical"]),
)
)
return True
def set_cycle_key_from_path(self, connection_log):
all_projects = connection_log.active_connection.get_all_projects()
(
project_key,
tov_key,
self.parameters["cycleKey"],
) = get_project_keys(all_projects, *self.parameters["projectPath"])
if not self.parameters["cycleKey"]:
raise ValueError("Invalid Config! 'cycleKey' missing.")
def wait(self, connection_log: testbench.ConnectionLog) -> bool:
self.report_tmp_name = connection_log.active_connection.wait_for_execution_results_import_to_finish(
self.job_id
)
return self.report_tmp_name
def poll(self, connection_log: testbench.ConnectionLog) -> bool:
result = connection_log.active_connection.get_imp_job_result(self.job_id)
if result is not None:
self.report_tmp_name = result
return result
def finish(self, connection_log: testbench.ConnectionLog) -> bool:
if self.report_tmp_name:
pretty_print(
{"value": f"Report ", "end": None},
{
"value": f'{path.abspath(self.parameters["inputPath"])}',
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" was imported"},
)
return True
class ExportActionLog(UnloggedAction):
def prepare(self, connection_log: testbench.ConnectionLog):
self.parameters["outputPath"] = questions.ask_for_output_path("config.json")
return True
def trigger(self, connection_log: testbench.ConnectionLog) -> bool:
try:
connection_log.export_as_json(self.parameters["outputPath"])
pretty_print(
{"value": f"Config ", "end": None},
{
"value": f'{path.abspath(self.parameters["outputPath"])}',
"style": "#06c8ff bold italic",
"end": None,
},
{"value": f" was generated"},
)
return True
except KeyError as e:
print(f"{str(e)}")
return False
class ChangeConnection(UnloggedAction):
def prepare(self, connection_log: testbench.ConnectionLog):
self.parameters["newConnection"] = login()
return True
def trigger(self, connection_log: testbench.ConnectionLog) -> bool:
connection_log.active_connection.close()
connection_log.add_connection(self.parameters["newConnection"])
return True
class Quit(UnloggedAction):
def trigger(self, connection_log: testbench.ConnectionLog = None):
print("Closing program.")
sys.exit(0)
| [
1,
396,
29871,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
29899,
527,
8262,
16369,
13,
29937,
13,
29937,
29871,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
29871,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
29871,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
29871,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
29871,
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,
29871,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
29871,
27028,
1090,
278,
19245,
29889,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
3166,
19229,
1053,
360,
919,
29892,
28379,
29892,
7761,
13,
3166,
14319,
1445,
1053,
796,
666,
2283,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
3166,
2897,
1053,
2224,
13,
3166,
4903,
29889,
300,
929,
1053,
10619,
9643,
408,
382,
29911,
13,
5215,
10876,
13,
5215,
2967,
29953,
29946,
13,
3166,
4321,
20841,
305,
29907,
492,
5612,
9555,
1053,
5155,
13,
3166,
4321,
20841,
305,
29907,
492,
5612,
9555,
1053,
1243,
1785,
305,
13,
3166,
4321,
20841,
305,
29907,
492,
5612,
9555,
29889,
4422,
1053,
313,
13,
1678,
3802,
29918,
8860,
29892,
13,
1678,
679,
29918,
4836,
29918,
8149,
29892,
13,
1678,
24409,
26382,
3991,
29892,
13,
1678,
16032,
3991,
29892,
13,
1678,
6464,
29892,
13,
1678,
5051,
29918,
2158,
29892,
13,
29897,
13,
13,
13,
1753,
9123,
29898,
1990,
29918,
978,
29901,
851,
29892,
4128,
29901,
9657,
29961,
710,
29892,
851,
2314,
1599,
25513,
4276,
29901,
13,
1678,
1018,
29901,
13,
4706,
736,
13149,
1338,
580,
29961,
1990,
29918,
978,
850,
16744,
29897,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
1596,
29898,
29888,
29908,
17776,
304,
1653,
770,
426,
1990,
29918,
978,
27195,
13,
4706,
3802,
29918,
8860,
580,
13,
13,
13,
1990,
25513,
4276,
29898,
19658,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4128,
29901,
28379,
29961,
21533,
29962,
353,
6213,
1125,
13,
4706,
1583,
29889,
16744,
353,
4128,
470,
6571,
13,
4706,
1583,
29889,
12276,
29918,
7050,
29918,
978,
353,
5124,
13,
4706,
1583,
29889,
9057,
29918,
333,
353,
5124,
13,
13,
1678,
822,
19012,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
736,
5852,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4480,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
736,
5852,
13,
13,
1678,
822,
21180,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
736,
5852,
13,
13,
1678,
822,
8341,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
736,
5852,
13,
13,
1678,
822,
5609,
29898,
1311,
1125,
13,
4706,
736,
8853,
1853,
1115,
1134,
29898,
1311,
467,
1649,
978,
1649,
29892,
376,
16744,
1115,
1583,
29889,
16744,
29913,
13,
13,
13,
1990,
853,
1188,
3192,
4276,
29898,
9118,
4276,
1125,
13,
1678,
822,
5609,
29898,
1311,
1125,
13,
4706,
736,
6213,
13,
13,
13,
1990,
1222,
637,
9165,
13020,
29898,
9118,
4276,
1125,
13,
1678,
822,
19012,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
599,
29918,
16418,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
16418,
580,
13,
4706,
4629,
29918,
4836,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
4836,
29898,
497,
29918,
16418,
29897,
13,
4706,
4629,
29918,
517,
29894,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
517,
29894,
29898,
8391,
29918,
4836,
29897,
13,
4706,
1583,
29889,
16744,
3366,
517,
29894,
2558,
3108,
353,
4629,
29918,
517,
29894,
3366,
1989,
3108,
3366,
15550,
3108,
13,
4706,
1583,
29889,
16744,
3366,
4836,
2605,
3108,
353,
518,
13,
9651,
4629,
29918,
4836,
3366,
978,
12436,
13,
9651,
4629,
29918,
517,
29894,
3366,
978,
12436,
13,
4706,
4514,
13,
4706,
4629,
29918,
23090,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
23090,
29898,
8391,
29918,
517,
29894,
29892,
5609,
29922,
5574,
29897,
13,
4706,
1596,
703,
29871,
27930,
29901,
1159,
13,
13,
4706,
5051,
29918,
2158,
29898,
13,
9651,
426,
13,
18884,
376,
1767,
1115,
285,
29908,
10998,
525,
334,
29871,
29946,
718,
4629,
29918,
4836,
1839,
978,
2033,
29901,
529,
29945,
29900,
17671,
13,
18884,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
18884,
376,
355,
1115,
6213,
29892,
13,
9651,
2981,
13,
9651,
8853,
1767,
1115,
285,
29908,
29871,
2060,
2558,
29901,
9162,
376,
355,
1115,
6213,
1118,
13,
9651,
426,
13,
18884,
376,
1767,
1115,
285,
29908,
29912,
8391,
29918,
4836,
1839,
1989,
16215,
15550,
2033,
29901,
1405,
29896,
29945,
17671,
13,
18884,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
376,
1767,
1115,
285,
29908,
10998,
525,
334,
29871,
29953,
718,
4629,
29918,
517,
29894,
1839,
978,
2033,
29901,
529,
29945,
29900,
17671,
13,
18884,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
18884,
376,
355,
1115,
6213,
29892,
13,
9651,
2981,
13,
9651,
8853,
1767,
1115,
285,
29908,
29871,
304,
29894,
2558,
29901,
268,
9162,
376,
355,
1115,
6213,
1118,
13,
9651,
426,
13,
18884,
376,
1767,
1115,
285,
29908,
29912,
8391,
29918,
517,
29894,
1839,
1989,
16215,
15550,
2033,
29901,
1405,
29896,
29945,
17671,
13,
18884,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
9651,
2981,
13,
4706,
1723,
13,
4706,
565,
4629,
29918,
23090,
1275,
376,
6632,
29918,
5746,
11206,
1115,
13,
9651,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
353,
6213,
13,
9651,
260,
698,
929,
29918,
23905,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
517,
29894,
29918,
23905,
29898,
13,
18884,
1583,
29889,
16744,
3366,
517,
29894,
2558,
3108,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
5051,
29918,
2158,
29898,
13,
18884,
426,
13,
462,
1678,
376,
1767,
1115,
285,
29908,
10998,
525,
334,
29871,
29947,
718,
4629,
29918,
23090,
1839,
978,
2033,
29901,
529,
29945,
29900,
17671,
13,
462,
1678,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
462,
1678,
376,
355,
1115,
6213,
29892,
13,
18884,
2981,
13,
18884,
8853,
1767,
1115,
285,
29908,
29871,
11412,
2558,
29901,
259,
9162,
376,
355,
1115,
6213,
1118,
13,
18884,
426,
13,
462,
1678,
376,
1767,
1115,
285,
29908,
29912,
8391,
29918,
23090,
1839,
1989,
16215,
15550,
2033,
29901,
1405,
29896,
29945,
17671,
13,
462,
1678,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
18884,
2981,
13,
9651,
1723,
13,
9651,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
353,
4629,
29918,
23090,
3366,
1989,
3108,
3366,
15550,
3108,
13,
9651,
1583,
29889,
16744,
3366,
4836,
2605,
16862,
4397,
29898,
8391,
29918,
23090,
3366,
978,
20068,
13,
9651,
260,
698,
929,
29918,
23905,
353,
313,
13,
18884,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
1688,
29918,
23090,
29918,
23905,
29898,
13,
462,
1678,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
13,
18884,
1723,
13,
9651,
1723,
13,
4706,
1583,
29889,
16744,
3366,
12276,
10303,
11150,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
12276,
29918,
4632,
29918,
5416,
29898,
13,
9651,
260,
698,
929,
29918,
23905,
13,
4706,
1723,
13,
4706,
599,
29918,
26705,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
26705,
580,
13,
4706,
1583,
29889,
16744,
3366,
26705,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
26705,
29898,
497,
29918,
26705,
29897,
13,
4706,
1583,
29889,
16744,
3366,
12276,
29918,
2917,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2917,
29918,
12276,
580,
13,
4706,
1583,
29889,
16744,
3366,
4905,
2605,
3108,
353,
5155,
29889,
1278,
29918,
1454,
29918,
4905,
29918,
2084,
580,
13,
13,
4706,
736,
5852,
13,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
7761,
29961,
11227,
29892,
851,
5387,
13,
4706,
565,
451,
1583,
29889,
16744,
29889,
657,
703,
23090,
2558,
29908,
1125,
13,
9651,
565,
313,
13,
18884,
451,
1583,
29889,
16744,
29889,
657,
703,
517,
29894,
2558,
1159,
13,
18884,
322,
7431,
29898,
1311,
29889,
16744,
3366,
4836,
2605,
20068,
6736,
29871,
29906,
13,
632,
1125,
13,
18884,
599,
29918,
16418,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
16418,
580,
13,
18884,
313,
13,
462,
1678,
2060,
29918,
1989,
29892,
13,
462,
1678,
1583,
29889,
16744,
3366,
517,
29894,
2558,
12436,
13,
462,
1678,
1583,
29889,
16744,
3366,
23090,
2558,
12436,
13,
18884,
1723,
353,
679,
29918,
4836,
29918,
8149,
29898,
497,
29918,
16418,
29892,
334,
1311,
29889,
16744,
3366,
4836,
2605,
20068,
13,
13,
4706,
1583,
29889,
9057,
29918,
333,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
21001,
29918,
3134,
29918,
12276,
29918,
4738,
362,
29898,
13,
9651,
1583,
29889,
16744,
29889,
657,
703,
517,
29894,
2558,
4968,
13,
9651,
1583,
29889,
16744,
29889,
657,
703,
23090,
2558,
4968,
13,
9651,
1583,
29889,
16744,
29889,
657,
703,
12276,
10303,
11150,
613,
376,
21289,
4968,
13,
9651,
1583,
29889,
16744,
29889,
657,
703,
26705,
613,
5159,
511,
13,
9651,
1583,
29889,
16744,
29889,
657,
703,
12276,
29918,
2917,
613,
24409,
26382,
3991,
3366,
29902,
371,
29886,
1222,
637,
3108,
511,
13,
4706,
1723,
13,
4706,
736,
1583,
29889,
9057,
29918,
333,
13,
13,
1678,
822,
4480,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
7761,
29961,
11227,
29892,
851,
5387,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
12276,
29918,
7050,
29918,
978,
353,
313,
13,
18884,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
10685,
29918,
1454,
29918,
7050,
29918,
3134,
29918,
12276,
29918,
978,
29898,
13,
462,
1678,
1583,
29889,
9057,
29918,
333,
13,
18884,
1723,
13,
9651,
1723,
13,
9651,
736,
1583,
29889,
12276,
29918,
7050,
29918,
978,
13,
4706,
5174,
7670,
2392,
408,
321,
29901,
13,
9651,
1596,
29898,
29888,
29908,
29912,
710,
29898,
29872,
2915,
1159,
13,
9651,
736,
7700,
13,
13,
1678,
822,
21180,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
1121,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
4548,
29918,
9057,
29918,
2914,
29898,
1311,
29889,
9057,
29918,
333,
29897,
13,
4706,
565,
1121,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
12276,
29918,
7050,
29918,
978,
353,
1121,
13,
4706,
736,
1121,
13,
13,
1678,
822,
8341,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
3461,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
3134,
29918,
12276,
29918,
1272,
29898,
13,
9651,
1583,
29889,
12276,
29918,
7050,
29918,
978,
13,
4706,
1723,
13,
4706,
411,
1722,
29898,
1311,
29889,
16744,
3366,
4905,
2605,
12436,
376,
29893,
29890,
1159,
408,
1962,
29918,
1445,
29901,
13,
9651,
1962,
29918,
1445,
29889,
3539,
29898,
12276,
29897,
13,
4706,
5051,
29918,
2158,
29898,
13,
9651,
8853,
1767,
1115,
285,
29908,
13020,
9162,
376,
355,
1115,
6213,
1118,
13,
9651,
426,
13,
18884,
376,
1767,
1115,
285,
29915,
29912,
2084,
29889,
370,
1028,
493,
29898,
1311,
29889,
16744,
3366,
4905,
2605,
20068,
29913,
742,
13,
18884,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
18884,
376,
355,
1115,
6213,
29892,
13,
9651,
2981,
13,
9651,
8853,
1767,
1115,
285,
29908,
471,
5759,
10758,
13,
4706,
1723,
13,
4706,
736,
5852,
13,
13,
13,
1990,
16032,
20418,
12191,
29898,
9118,
4276,
1125,
13,
1678,
822,
19012,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
1583,
29889,
16744,
3366,
2080,
2605,
3108,
353,
5155,
29889,
1278,
29918,
1454,
29918,
2080,
29918,
2084,
580,
13,
4706,
2060,
353,
1873,
353,
11412,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
2060,
29892,
1873,
29892,
11412,
353,
1583,
29889,
657,
29918,
4836,
29918,
2084,
29918,
3166,
29918,
12276,
580,
13,
4706,
5174,
29901,
13,
9651,
1209,
13,
4706,
599,
29918,
16418,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
16418,
580,
13,
4706,
4629,
29918,
4836,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
4836,
29898,
13,
9651,
599,
29918,
16418,
29892,
2322,
29922,
4836,
13,
4706,
1723,
13,
4706,
4629,
29918,
517,
29894,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
517,
29894,
29898,
8391,
29918,
4836,
29892,
2322,
29922,
3259,
29897,
13,
4706,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
23090,
29898,
13,
9651,
4629,
29918,
517,
29894,
29892,
2322,
29922,
23090,
13,
4706,
1723,
3366,
1989,
3108,
3366,
15550,
3108,
13,
4706,
11412,
29918,
23905,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
1688,
29918,
23090,
29918,
23905,
29898,
13,
9651,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
13,
4706,
1723,
13,
4706,
1583,
29889,
16744,
3366,
12276,
10303,
11150,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
12276,
29918,
4632,
29918,
5416,
29898,
13,
9651,
11412,
29918,
23905,
13,
4706,
1723,
13,
4706,
3625,
29918,
1688,
414,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
1688,
414,
29918,
974,
29918,
4836,
29898,
13,
9651,
4629,
29918,
4836,
3366,
1989,
3108,
3366,
15550,
3108,
13,
4706,
1723,
13,
4706,
1583,
29889,
16744,
3366,
4381,
3057,
261,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
4381,
29918,
1688,
261,
29898,
13,
9651,
3625,
29918,
1688,
414,
13,
4706,
1723,
13,
4706,
599,
29918,
26705,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
26705,
580,
13,
4706,
1583,
29889,
16744,
3366,
26705,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2622,
29918,
26705,
29898,
497,
29918,
26705,
29897,
13,
4706,
1583,
29889,
16744,
3366,
5215,
3991,
3108,
353,
5155,
29889,
1278,
29918,
517,
29918,
2917,
29918,
5215,
580,
13,
4706,
736,
5852,
13,
13,
1678,
822,
679,
29918,
4836,
29918,
2084,
29918,
3166,
29918,
12276,
29898,
1311,
1125,
13,
4706,
14319,
29918,
1445,
353,
796,
666,
2283,
29898,
1311,
29889,
16744,
3366,
2080,
2605,
20068,
13,
4706,
4903,
353,
382,
29911,
29889,
3166,
1807,
29898,
7554,
29918,
1445,
29889,
949,
703,
12276,
29889,
3134,
5783,
13,
4706,
2060,
353,
4903,
29889,
2886,
703,
6904,
6672,
29914,
4836,
2564,
657,
703,
978,
1159,
13,
4706,
1873,
353,
4903,
29889,
2886,
703,
6904,
6672,
29914,
3259,
2564,
657,
703,
978,
1159,
13,
4706,
11412,
353,
4903,
29889,
2886,
703,
6904,
6672,
29914,
23090,
2564,
657,
703,
978,
1159,
13,
4706,
736,
2060,
29892,
1873,
29892,
11412,
13,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
565,
451,
1583,
29889,
16744,
29889,
657,
703,
23090,
2558,
29908,
1125,
13,
9651,
565,
7431,
29898,
1311,
29889,
16744,
29889,
657,
703,
4836,
2605,
613,
5159,
876,
2804,
29871,
29941,
29901,
13,
18884,
1583,
29889,
16744,
3366,
4836,
2605,
3108,
353,
1583,
29889,
657,
29918,
4836,
29918,
2084,
29918,
3166,
29918,
12276,
580,
13,
9651,
1583,
29889,
842,
29918,
23090,
29918,
1989,
29918,
3166,
29918,
2084,
29898,
9965,
29918,
1188,
29897,
13,
13,
4706,
411,
1722,
29898,
1311,
29889,
16744,
3366,
2080,
2605,
12436,
376,
6050,
1159,
408,
8225,
29918,
12276,
29901,
13,
9651,
8225,
29918,
12276,
29918,
3188,
29953,
29946,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
22256,
29918,
12276,
29889,
949,
16655,
13808,
580,
13,
13,
4706,
12424,
680,
29918,
1445,
29918,
978,
353,
313,
13,
9651,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
9009,
29918,
22256,
29918,
9902,
29898,
13,
18884,
8225,
29918,
12276,
29918,
3188,
29953,
29946,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
565,
12424,
680,
29918,
1445,
29918,
978,
29901,
13,
9651,
1583,
29889,
9057,
29918,
333,
353,
313,
13,
18884,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
21001,
29918,
22256,
29918,
9902,
29918,
5215,
29898,
13,
462,
1678,
1583,
29889,
16744,
3366,
23090,
2558,
12436,
13,
462,
1678,
1583,
29889,
16744,
3366,
12276,
10303,
11150,
12436,
13,
462,
1678,
12424,
680,
29918,
1445,
29918,
978,
29892,
13,
462,
1678,
1583,
29889,
16744,
3366,
4381,
3057,
261,
12436,
13,
462,
1678,
1583,
29889,
16744,
3366,
26705,
12436,
13,
462,
1678,
1583,
29889,
16744,
29889,
657,
703,
5215,
3991,
613,
16032,
3991,
3366,
24933,
936,
3108,
511,
13,
18884,
1723,
13,
9651,
1723,
13,
9651,
736,
5852,
13,
13,
1678,
822,
731,
29918,
23090,
29918,
1989,
29918,
3166,
29918,
2084,
29898,
1311,
29892,
3957,
29918,
1188,
1125,
13,
4706,
599,
29918,
16418,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
497,
29918,
16418,
580,
13,
4706,
313,
13,
9651,
2060,
29918,
1989,
29892,
13,
9651,
304,
29894,
29918,
1989,
29892,
13,
9651,
1583,
29889,
16744,
3366,
23090,
2558,
12436,
13,
4706,
1723,
353,
679,
29918,
4836,
29918,
8149,
29898,
497,
29918,
16418,
29892,
334,
1311,
29889,
16744,
3366,
4836,
2605,
20068,
13,
4706,
565,
451,
1583,
29889,
16744,
3366,
23090,
2558,
3108,
29901,
13,
9651,
12020,
7865,
2392,
703,
13919,
12782,
29991,
525,
23090,
2558,
29915,
4567,
23157,
13,
13,
1678,
822,
4480,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
1583,
29889,
12276,
29918,
7050,
29918,
978,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
10685,
29918,
1454,
29918,
22256,
29918,
9902,
29918,
5215,
29918,
517,
29918,
4951,
728,
29898,
13,
9651,
1583,
29889,
9057,
29918,
333,
13,
4706,
1723,
13,
4706,
736,
1583,
29889,
12276,
29918,
7050,
29918,
978,
13,
13,
1678,
822,
21180,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
1121,
353,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
657,
29918,
6574,
29918,
9057,
29918,
2914,
29898,
1311,
29889,
9057,
29918,
333,
29897,
13,
4706,
565,
1121,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
12276,
29918,
7050,
29918,
978,
353,
1121,
13,
4706,
736,
1121,
13,
13,
1678,
822,
8341,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
565,
1583,
29889,
12276,
29918,
7050,
29918,
978,
29901,
13,
9651,
5051,
29918,
2158,
29898,
13,
18884,
8853,
1767,
1115,
285,
29908,
13020,
9162,
376,
355,
1115,
6213,
1118,
13,
18884,
426,
13,
462,
1678,
376,
1767,
1115,
285,
29915,
29912,
2084,
29889,
370,
1028,
493,
29898,
1311,
29889,
16744,
3366,
2080,
2605,
20068,
29913,
742,
13,
462,
1678,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
462,
1678,
376,
355,
1115,
6213,
29892,
13,
18884,
2981,
13,
18884,
8853,
1767,
1115,
285,
29908,
471,
19673,
10758,
13,
9651,
1723,
13,
9651,
736,
5852,
13,
13,
13,
1990,
1222,
637,
4276,
3403,
29898,
2525,
1188,
3192,
4276,
1125,
13,
1678,
822,
19012,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
1125,
13,
4706,
1583,
29889,
16744,
3366,
4905,
2605,
3108,
353,
5155,
29889,
1278,
29918,
1454,
29918,
4905,
29918,
2084,
703,
2917,
29889,
3126,
1159,
13,
4706,
736,
5852,
13,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
1018,
29901,
13,
9651,
3957,
29918,
1188,
29889,
15843,
29918,
294,
29918,
3126,
29898,
1311,
29889,
16744,
3366,
4905,
2605,
20068,
13,
9651,
5051,
29918,
2158,
29898,
13,
18884,
8853,
1767,
1115,
285,
29908,
3991,
9162,
376,
355,
1115,
6213,
1118,
13,
18884,
426,
13,
462,
1678,
376,
1767,
1115,
285,
29915,
29912,
2084,
29889,
370,
1028,
493,
29898,
1311,
29889,
16744,
3366,
4905,
2605,
20068,
29913,
742,
13,
462,
1678,
376,
3293,
1115,
12305,
29900,
29953,
29883,
29947,
600,
14288,
4698,
293,
613,
13,
462,
1678,
376,
355,
1115,
6213,
29892,
13,
18884,
2981,
13,
18884,
8853,
1767,
1115,
285,
29908,
471,
5759,
10758,
13,
9651,
1723,
13,
9651,
736,
5852,
13,
4706,
5174,
7670,
2392,
408,
321,
29901,
13,
9651,
1596,
29898,
29888,
29908,
29912,
710,
29898,
29872,
2915,
1159,
13,
9651,
736,
7700,
13,
13,
13,
1990,
10726,
5350,
29898,
2525,
1188,
3192,
4276,
1125,
13,
1678,
822,
19012,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
1125,
13,
4706,
1583,
29889,
16744,
3366,
1482,
5350,
3108,
353,
6464,
580,
13,
4706,
736,
5852,
13,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
29897,
1599,
6120,
29901,
13,
4706,
3957,
29918,
1188,
29889,
4925,
29918,
9965,
29889,
5358,
580,
13,
4706,
3957,
29918,
1188,
29889,
1202,
29918,
9965,
29898,
1311,
29889,
16744,
3366,
1482,
5350,
20068,
13,
4706,
736,
5852,
13,
13,
13,
1990,
751,
277,
29898,
2525,
1188,
3192,
4276,
1125,
13,
1678,
822,
7135,
29898,
1311,
29892,
3957,
29918,
1188,
29901,
1243,
1785,
305,
29889,
5350,
3403,
353,
6213,
1125,
13,
4706,
1596,
703,
29907,
5409,
292,
1824,
23157,
13,
4706,
10876,
29889,
13322,
29898,
29900,
29897,
13,
2
] |
python/ex23.py | kazushiyuuki/Lab-ICC | 0 | 191178 | <reponame>kazushiyuuki/Lab-ICC<gh_stars>0
n = int(input())
cont = 0
while cont < n:
num = int(input())
if cont == 0:
maior = num
elif num > maior:
maior = num
cont += 1
print(maior)
| [
1,
529,
276,
1112,
420,
29958,
8637,
1878,
19881,
29884,
19267,
29914,
28632,
29899,
2965,
29907,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29876,
353,
938,
29898,
2080,
3101,
13,
1285,
353,
29871,
29900,
13,
8000,
640,
529,
302,
29901,
13,
1678,
954,
353,
938,
29898,
2080,
3101,
13,
1678,
565,
640,
1275,
29871,
29900,
29901,
13,
4706,
17136,
353,
954,
13,
1678,
25342,
954,
1405,
17136,
29901,
13,
4706,
17136,
353,
954,
13,
1678,
640,
4619,
29871,
29896,
13,
2158,
29898,
655,
1611,
29897,
13,
268,
2
] |
github/recorders/github/github_user_info_recorder.py | zvtvz/play-github | 2 | 18428 | # -*- coding: utf-8 -*-
import argparse
from github.accounts.github_account import GithubAccount
from github.domain.github import GithubUser
from github.recorders.github.common import get_result
from zvdata.api import get_entities
from zvdata.domain import get_db_session
from zvdata.recorder import TimeSeriesDataRecorder
from zvdata.utils.time_utils import day_offset_today, now_pd_timestamp
class GithubUserInfoRecorder(TimeSeriesDataRecorder):
entity_provider = 'github'
entity_schema = GithubUser
provider = 'github'
data_schema = GithubUser
url = 'https://api.github.com/users/{}'
def __init__(self,
codes=None,
batch_size=50,
force_update=True,
sleeping_time=5,
default_size=2000,
one_shot=True,
fix_duplicate_way='ignore',
start_timestamp=None,
end_timestamp=None) -> None:
super().__init__('github_user', ['github'], None, codes, batch_size, force_update, sleeping_time,
default_size, one_shot, fix_duplicate_way, start_timestamp, end_timestamp)
self.seed = 0
def init_entities(self):
if self.entity_provider == self.provider and self.entity_schema == self.data_schema:
self.entity_session = self.session
else:
self.entity_session = get_db_session(provider=self.entity_provider, data_schema=self.entity_schema)
# init the entity list
self.entities = get_entities(session=self.entity_session,
entity_type=self.entity_type,
entity_ids=self.entity_ids,
codes=self.codes,
return_type='domain',
provider=self.entity_provider,
# 最近7天更新过的跳过
filters=[(GithubUser.updated_timestamp < day_offset_today(
-7)) | (GithubUser.updated_timestamp.is_(None))],
start_timestamp=self.start_timestamp,
end_timestamp=self.end_timestamp)
def record(self, entity_item, start, end, size, timestamps):
self.seed += 1
the_url = self.url.format(entity_item.code)
user_info = get_result(url=the_url, token=GithubAccount.get_token(seed=self.seed))
if user_info:
user_info['updated_timestamp'] = now_pd_timestamp()
return [user_info]
return []
def get_data_map(self):
return {
'site_admin': 'site_admin',
'name': 'name',
'avatar_url': 'avatar_url',
'gravatar_id': 'gravatar_id',
'company': 'company',
'blog': 'blog',
'location': 'location',
'email': 'email',
'hireable': 'hireable',
'bio': 'bio',
'public_repos': 'public_repos',
'public_gists': 'public_gists',
'followers': 'followers',
'following': 'following',
'updated_timestamp': 'updated_timestamp'
}
def generate_domain_id(self, security_item, original_data):
return security_item.id
def evaluate_start_end_size_timestamps(self, entity):
latest_record = self.get_latest_saved_record(entity=entity)
if latest_record:
latest_timestamp = latest_record.updated_timestamp
if latest_timestamp is not None:
if (now_pd_timestamp() - latest_timestamp).days < 7:
self.logger.info('entity_item:{},updated_timestamp:{},ignored'.format(entity.id, latest_timestamp))
return None, None, 0, None
return None, None, self.default_size, None
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--start', help='start_timestamp', default='2015-01-01')
parser.add_argument('--end', help='end_timestamp', default='2015-12-31')
args = parser.parse_args()
start = args.start
end = args.end
recorder = GithubUserInfoRecorder(start_timestamp=start, end_timestamp=end)
recorder.run()
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
5215,
1852,
5510,
13,
13,
3166,
18546,
29889,
10149,
29879,
29889,
3292,
29918,
10149,
1053,
402,
2985,
10601,
13,
3166,
18546,
29889,
7247,
29889,
3292,
1053,
402,
2985,
2659,
13,
3166,
18546,
29889,
11651,
414,
29889,
3292,
29889,
9435,
1053,
679,
29918,
2914,
13,
3166,
15486,
1272,
29889,
2754,
1053,
679,
29918,
296,
1907,
13,
3166,
15486,
1272,
29889,
7247,
1053,
679,
29918,
2585,
29918,
7924,
13,
3166,
15486,
1272,
29889,
3757,
2098,
1053,
5974,
19204,
1469,
4789,
2098,
13,
3166,
15486,
1272,
29889,
13239,
29889,
2230,
29918,
13239,
1053,
2462,
29918,
10289,
29918,
27765,
29892,
1286,
29918,
15926,
29918,
16394,
13,
13,
13,
1990,
402,
2985,
2659,
3401,
4789,
2098,
29898,
2481,
19204,
1469,
4789,
2098,
1125,
13,
1678,
7855,
29918,
18121,
353,
525,
3292,
29915,
13,
1678,
7855,
29918,
11010,
353,
402,
2985,
2659,
13,
13,
1678,
13113,
353,
525,
3292,
29915,
13,
1678,
848,
29918,
11010,
353,
402,
2985,
2659,
13,
13,
1678,
3142,
353,
525,
991,
597,
2754,
29889,
3292,
29889,
510,
29914,
7193,
29914,
8875,
29915,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
11561,
29922,
8516,
29892,
13,
462,
9853,
29918,
2311,
29922,
29945,
29900,
29892,
13,
462,
4889,
29918,
5504,
29922,
5574,
29892,
13,
462,
8709,
292,
29918,
2230,
29922,
29945,
29892,
13,
462,
2322,
29918,
2311,
29922,
29906,
29900,
29900,
29900,
29892,
13,
462,
697,
29918,
8962,
29922,
5574,
29892,
13,
462,
2329,
29918,
20908,
5926,
29918,
1582,
2433,
17281,
742,
13,
462,
1369,
29918,
16394,
29922,
8516,
29892,
13,
462,
1095,
29918,
16394,
29922,
8516,
29897,
1599,
6213,
29901,
13,
4706,
2428,
2141,
1649,
2344,
1649,
877,
3292,
29918,
1792,
742,
6024,
3292,
7464,
6213,
29892,
11561,
29892,
9853,
29918,
2311,
29892,
4889,
29918,
5504,
29892,
8709,
292,
29918,
2230,
29892,
13,
462,
308,
2322,
29918,
2311,
29892,
697,
29918,
8962,
29892,
2329,
29918,
20908,
5926,
29918,
1582,
29892,
1369,
29918,
16394,
29892,
1095,
29918,
16394,
29897,
13,
13,
4706,
1583,
29889,
26776,
353,
29871,
29900,
13,
13,
1678,
822,
2069,
29918,
296,
1907,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
10041,
29918,
18121,
1275,
1583,
29889,
18121,
322,
1583,
29889,
10041,
29918,
11010,
1275,
1583,
29889,
1272,
29918,
11010,
29901,
13,
9651,
1583,
29889,
10041,
29918,
7924,
353,
1583,
29889,
7924,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
10041,
29918,
7924,
353,
679,
29918,
2585,
29918,
7924,
29898,
18121,
29922,
1311,
29889,
10041,
29918,
18121,
29892,
848,
29918,
11010,
29922,
1311,
29889,
10041,
29918,
11010,
29897,
13,
13,
4706,
396,
2069,
278,
7855,
1051,
13,
4706,
1583,
29889,
296,
1907,
353,
679,
29918,
296,
1907,
29898,
7924,
29922,
1311,
29889,
10041,
29918,
7924,
29892,
13,
462,
462,
268,
7855,
29918,
1853,
29922,
1311,
29889,
10041,
29918,
1853,
29892,
13,
462,
462,
268,
7855,
29918,
4841,
29922,
1311,
29889,
10041,
29918,
4841,
29892,
13,
462,
462,
268,
11561,
29922,
1311,
29889,
18137,
29892,
13,
462,
462,
268,
736,
29918,
1853,
2433,
7247,
742,
13,
462,
462,
268,
13113,
29922,
1311,
29889,
10041,
29918,
18121,
29892,
13,
462,
462,
268,
396,
29871,
30878,
31830,
242,
191,
154,
30408,
31100,
30374,
31138,
30210,
235,
186,
182,
31138,
13,
462,
462,
268,
18094,
11759,
29898,
29954,
2985,
2659,
29889,
21402,
29918,
16394,
529,
2462,
29918,
10289,
29918,
27765,
29898,
13,
462,
462,
308,
448,
29955,
876,
891,
313,
29954,
2985,
2659,
29889,
21402,
29918,
16394,
29889,
275,
23538,
8516,
876,
1402,
13,
462,
462,
268,
1369,
29918,
16394,
29922,
1311,
29889,
2962,
29918,
16394,
29892,
13,
462,
462,
268,
1095,
29918,
16394,
29922,
1311,
29889,
355,
29918,
16394,
29897,
13,
13,
1678,
822,
2407,
29898,
1311,
29892,
7855,
29918,
667,
29892,
1369,
29892,
1095,
29892,
2159,
29892,
5335,
342,
15092,
1125,
13,
4706,
1583,
29889,
26776,
4619,
29871,
29896,
13,
13,
4706,
278,
29918,
2271,
353,
1583,
29889,
2271,
29889,
4830,
29898,
10041,
29918,
667,
29889,
401,
29897,
13,
4706,
1404,
29918,
3888,
353,
679,
29918,
2914,
29898,
2271,
29922,
1552,
29918,
2271,
29892,
5993,
29922,
29954,
2985,
10601,
29889,
657,
29918,
6979,
29898,
26776,
29922,
1311,
29889,
26776,
876,
13,
4706,
565,
1404,
29918,
3888,
29901,
13,
9651,
1404,
29918,
3888,
1839,
21402,
29918,
16394,
2033,
353,
1286,
29918,
15926,
29918,
16394,
580,
13,
9651,
736,
518,
1792,
29918,
3888,
29962,
13,
4706,
736,
5159,
13,
13,
1678,
822,
679,
29918,
1272,
29918,
1958,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
525,
2746,
29918,
6406,
2396,
525,
2746,
29918,
6406,
742,
13,
9651,
525,
978,
2396,
525,
978,
742,
13,
9651,
525,
485,
14873,
29918,
2271,
2396,
525,
485,
14873,
29918,
2271,
742,
13,
9651,
525,
3874,
9046,
279,
29918,
333,
2396,
525,
3874,
9046,
279,
29918,
333,
742,
13,
9651,
525,
14518,
2396,
525,
14518,
742,
13,
9651,
525,
7312,
2396,
525,
7312,
742,
13,
9651,
525,
5479,
2396,
525,
5479,
742,
13,
9651,
525,
5269,
2396,
525,
5269,
742,
13,
9651,
525,
14812,
519,
2396,
525,
14812,
519,
742,
13,
9651,
525,
24840,
2396,
525,
24840,
742,
13,
9651,
525,
3597,
29918,
276,
1066,
2396,
525,
3597,
29918,
276,
1066,
742,
13,
9651,
525,
3597,
29918,
29887,
2879,
2396,
525,
3597,
29918,
29887,
2879,
742,
13,
9651,
525,
23031,
414,
2396,
525,
23031,
414,
742,
13,
9651,
525,
23031,
292,
2396,
525,
23031,
292,
742,
13,
9651,
525,
21402,
29918,
16394,
2396,
525,
21402,
29918,
16394,
29915,
13,
4706,
500,
13,
13,
1678,
822,
5706,
29918,
7247,
29918,
333,
29898,
1311,
29892,
6993,
29918,
667,
29892,
2441,
29918,
1272,
1125,
13,
4706,
736,
6993,
29918,
667,
29889,
333,
13,
13,
1678,
822,
14707,
29918,
2962,
29918,
355,
29918,
2311,
29918,
9346,
342,
15092,
29898,
1311,
29892,
7855,
1125,
13,
4706,
9281,
29918,
11651,
353,
1583,
29889,
657,
29918,
12333,
29918,
17314,
29918,
11651,
29898,
10041,
29922,
10041,
29897,
13,
13,
4706,
565,
9281,
29918,
11651,
29901,
13,
9651,
9281,
29918,
16394,
353,
9281,
29918,
11651,
29889,
21402,
29918,
16394,
13,
9651,
565,
9281,
29918,
16394,
338,
451,
6213,
29901,
13,
18884,
565,
313,
3707,
29918,
15926,
29918,
16394,
580,
448,
9281,
29918,
16394,
467,
16700,
529,
29871,
29955,
29901,
13,
462,
1678,
1583,
29889,
21707,
29889,
3888,
877,
10041,
29918,
667,
26254,
1118,
21402,
29918,
16394,
26254,
1118,
647,
4395,
4286,
4830,
29898,
10041,
29889,
333,
29892,
9281,
29918,
16394,
876,
13,
462,
1678,
736,
6213,
29892,
6213,
29892,
29871,
29900,
29892,
6213,
13,
13,
4706,
736,
6213,
29892,
6213,
29892,
1583,
29889,
4381,
29918,
2311,
29892,
6213,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2962,
742,
1371,
2433,
2962,
29918,
16394,
742,
2322,
2433,
29906,
29900,
29896,
29945,
29899,
29900,
29896,
29899,
29900,
29896,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
355,
742,
1371,
2433,
355,
29918,
16394,
742,
2322,
2433,
29906,
29900,
29896,
29945,
29899,
29896,
29906,
29899,
29941,
29896,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
1369,
353,
6389,
29889,
2962,
13,
1678,
1095,
353,
6389,
29889,
355,
13,
13,
1678,
1162,
2098,
353,
402,
2985,
2659,
3401,
4789,
2098,
29898,
2962,
29918,
16394,
29922,
2962,
29892,
1095,
29918,
16394,
29922,
355,
29897,
13,
13,
1678,
1162,
2098,
29889,
3389,
580,
13,
2
] |
new_test.py | kingsam91/Habari-zote | 0 | 147890 | <gh_stars>0
from news import News # Importing the contact class
class TestNews(unittest.TestCase):
'''
Test class that defines test cases for the news class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
''' | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
9763,
1053,
10130,
396,
16032,
292,
278,
6958,
770,
13,
13,
1990,
4321,
29328,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
14550,
13,
1678,
4321,
770,
393,
17645,
1243,
4251,
363,
278,
9763,
770,
4010,
29875,
2470,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
443,
27958,
29889,
3057,
8259,
29901,
4321,
8259,
770,
393,
6911,
297,
4969,
1243,
4251,
13,
1678,
14550,
2
] |
MITx-6.00.2x/ProblemSet5/ps5.py | maistrovas/My-Courses-Solutions | 0 | 138643 | # 6.00.2x Problem Set 5
# Graph optimization
# Finding shortest paths through MIT buildings
#
import string
# This imports everything from `graph.py` as if it was defined in this file!
from graph import *
#
# Problem 2: Building up the Campus Map
#
# Before you write any code, write a couple of sentences here
# describing how you will model this problem as a graph.
# This is a helpful exercise to help you organize your
# thoughts before you tackle a big design problem!
#
# My description of the problem:
#
# Nodes is a buildings, edges is the roads between them. Every path (edge) from building
# to building has parameters (weights (Indoor)(Oundoor)) of distance. I should finde a combination
# of paths (edges) fro building (NodeA) to building (NodeB) with smallest
# summ of diatances(weights) whether it is Indoor or Oundoor.
def load_map(mapFilename):
"""
Parses the map file and constructs a directed graph
Parameters:
mapFilename : name of the map file
Assumes:
Each entry in the map file consists of the following four positive
integers, separated by a blank space:
From To TotalDistance DistanceOutdoors
e.g.
32 76 54 23
This entry would become an edge from 32 to 76.
Returns:
a directed graph representing the map
"""
inFile = open(mapFilename, 'r', 0)
string_list = []
for line in inFile:
wordlist = string.split(line)
string_list.append(wordlist)
nodes = set([])
edges = []
w_graph = WeightedDigraph()
for strings in string_list:
start = strings[0]
dest = strings[1]
tot_distance = float(strings[2])
outd_distance = float(strings[3])
start_node = Node(start)
destin_node = Node(dest)
w_edge = WeightedEdge(start_node, destin_node, tot_distance , outd_distance)
try:
w_graph.addNode(start_node)
except ValueError:
pass
try:
w_graph.addNode(destin_node)
except ValueError:
pass
try:
w_graph.addEdge(w_edge)
except ValueError:
pass
return w_graph
#mitMap = load_map("mit_map.txt")
#nodes = mitMap.nodes
#nodes = list(nodes)
# Problem 3: Finding the Shortest Path using Brute Force Search
#
# State the optimization problem as a function to minimize
# and what the constraints are
#
def getPaths(digraph, start, end):
start = Node(start)
end = Node(end)
stack = [[start]]
pathss = []
while stack:
path = stack.pop()
node = path[-1]
if node == end:
pathss.append(path[:])
continue
children = digraph.childrenOf(node)
if not children: continue
stack += [path +[c] for c in children if c not in path]
return pathss
def getPathDistance(digraph, path):
totalDist = outdDist = 0.0
for n1, n2 in zip(path,path[1:]):
for edge in digraph.edges[n1]:
if edge[0] == n2:
totalDist += edge[1][0]
outdDist +=edge[1][1]
break
return (totalDist, outdDist)
def getShortestPath(digraph, paths, maxTotalDist, maxDistOutdoors):
res = ''
shortest = None
for path in paths:
totalDist, outdDist = getPathDistance(digraph, path)
if totalDist <= maxTotalDist and outdDist <= maxDistOutdoors:
if not shortest or totalDist < shortest:
res, shortest = path, totalDist
return res
def bruteForceSearch(digraph, start, end, maxTotalDist, maxDistOutdoors):
"""
Finds the shortest path from start to end using brute-force approach.
The total distance travelled on the path must not exceed maxTotalDist, and
the distance spent outdoor on this path must not exceed maxDistOutdoors.
Parameters:
digraph: instance of class Digraph or its subclass
start, end: start & end building numbers (strings)
maxTotalDist : maximum total distance on a path (integer)
maxDistOutdoors: maximum distance spent outdoors on a path (integer)
Assumes:
start and end are numbers for existing buildings in graph
Returns:
The shortest-path from start to end, represented by
a list of building numbers (in strings), [n_1, n_2, ..., n_k],
where there exists an edge from n_i to n_(i+1) in digraph,
for all 1 <= i < k.
If there exists no path that satisfies maxTotalDist and
maxDistOutdoors constraints, then raises a ValueError.
"""
paths = getPaths(digraph, start, end)
shortest = getShortestPath(digraph, paths, maxTotalDist, maxDistOutdoors)
if shortest:
return map(str, shortest)
else:
raise ValueError ('ValueError')
#
# Problem 4: Finding the Shorest Path using Optimized Search Method
#
def directedDFS_Defected(digraph, start, end, maxTotalDist, maxDistOutdoors, path = [], shortest = None):
"""
Finds the shortest path from start to end using directed depth-first.
search approach. The total distance travelled on the path must not
exceed maxTotalDist, and the distance spent outdoor on this path must
not exceed maxDistOutdoors.
Parameters:
digraph: instance of class Digraph or its subclass
start, end: start & end building numbers (strings)
maxTotalDist : maximum total distance on a path (integer)
maxDistOutdoors: maximum distance spent outdoors on a path (integer)
Assumes:
start and end are numbers for existing buildings in graph
Returns:
The shortest-path from start to end, represented by
a list of building numbers (in strings), [n_1, n_2, ..., n_k],
where there exists an edge from n_i to n_(i+1) in digraph,
for all 1 <= i < k.
If there exists no path that satisfies maxTotalDist and
maxDistOutdoors constraints, then raises a ValueError.
"""
start = Node(start)
end = Node(end)
path = path + [start]
if start == end:
return path
#continue
#print digraph.
print digraph.childrenOf(start)
for node in digraph.childrenOf(start):
print node not in path
if node not in path:
if shortest == None or len(path) < len (shortest):
newPath = directedDFS(digraph, node, end,maxTotalDist,maxDistOutdoors, path, shortest)
if newPath != None:
return newPath
#print path_list
return shortest
def getOptimizedPath(digraph, start, end, maxTotalDist, maxOutdoorDist):
start, end = Node(start), Node(end)
stack = [[start, n] for n in digraph.childrenOf(start) if n != start]
res, shortest = "", None
while stack:
path = stack.pop()
totalDist, outDist = getPathDistance(digraph, path)
if totalDist > maxTotslDist or outDist > maxOutdoorDist:
continue
node = path[-1]
if node == end:
if not shortest or totalDist < shortest:
res, shortest = path, totalDist
continue
children = digraph.childrenOf(node)
if not children: continue
stack += [path + [c] for c in children if c not in path]
return res
def directedDFS(digraph, start, end, maxTotalDist, maxDistOutdoors):
res = getOptimizedPath(digraph, start, end, maxTotalDist, maxDistOutdoors)
if res:
return map(str, res)
else:
raise ValueError('ValueError')
#mitMap = load_map("mit_map.txt")
#print directedDFS(mitMap, '32', '56', 200, 200)
#print getPaths(mitMap, '32', '56')
# Uncomment below when ready to test
#### NOTE! These tests may take a few minutes to run!! ####
if __name__ == '__main__':
mitMap = load_map("mit_map.txt")
print isinstance(mitMap, Digraph)
print isinstance(mitMap, WeightedDigraph)
print 'nodes', mitMap.nodes
print 'edges', mitMap.edges
#
#
LARGE_DIST = 1000000
#
# Test case 1
# print "---------------"
# print "Test case 1:"
# print "Find the shortest-path from Building 32 to 56"
# expectedPath1 = ['32', '56']
#brutePath1 = bruteForceSearch(mitMap, '32', '56', LARGE_DIST, LARGE_DIST)
# dfsPath1 = directedDFS(mitMap, '32', '56', LARGE_DIST, LARGE_DIST)
# print "Expected: ", expectedPath1
#print "Brute-force: ", brutePath1
# print "DFS: ", dfsPath1
#print "Correct? BFS: {0}; DFS: {1}".format(expectedPath1 == brutePath1, expectedPath1 == dfsPath1)
#
# Test case 2
# print "---------------"
# print "Test case 2:"
# print "Find the shortest-path from Building 32 to 56 without going outdoors"
# expectedPath2 = ['32', '36', '26', '16', '56']
# brutePath2 = bruteForceSearch(mitMap, '32', '56', LARGE_DIST, 0)
# dfsPath2 = directedDFS(mitMap, '32', '56', LARGE_DIST, 0)
# print "Expected: ", expectedPath2
# print "Brute-force: ", brutePath2
# print "DFS: ", dfsPath2
# print "Correct? BFS: {0}; DFS: {1}".format(expectedPath2 == brutePath2, expectedPath2 == dfsPath2)
# Test case 3
# print "---------------"
# print "Test case 3:"
# print "Find the shortest-path from Building 2 to 9"
# expectedPath3 = ['2', '3', '7', '9']
# brutePath3 = bruteForceSearch(mitMap, '2', '9', LARGE_DIST, LARGE_DIST)
# dfsPath3 = directedDFS(mitMap, '2', '9', LARGE_DIST, LARGE_DIST)
# print "Expected: ", expectedPath3
# print "Brute-force: ", brutePath3
# print "DFS: ", dfsPath3
# print "Correct? BFS: {0}; DFS: {1}".format(expectedPath3 == brutePath3, expectedPath3 == dfsPath3)
# Test case 4
# print "---------------"
# print "Test case 4:"
# print "Find the shortest-path from Building 2 to 9 without going outdoors"
# expectedPath4 = ['2', '4', '10', '13', '9']
# brutePath4 = bruteForceSearch(mitMap, '2', '9', LARGE_DIST, 0)
# dfsPath4 = directedDFS(mitMap, '2', '9', LARGE_DIST, 0)
# print "Expected: ", expectedPath4
# print "Brute-force: ", brutePath4
# print "DFS: ", dfsPath4
# print "Correct? BFS: {0}; DFS: {1}".format(expectedPath4 == brutePath4, expectedPath4 == dfsPath4)
# Test case 5
# print "---------------"
# print "Test case 5:"
# print "Find the shortest-path from Building 1 to 32"
# expectedPath5 = ['1', '4', '12', '32']
# brutePath5 = bruteForceSearch(mitMap, '1', '32', LARGE_DIST, LARGE_DIST)
# dfsPath5 = directedDFS(mitMap, '1', '32', LARGE_DIST, LARGE_DIST)
# print "Expected: ", expectedPath5
# print "Brute-force: ", brutePath5
# print "DFS: ", dfsPath5
# print "Correct? BFS: {0}; DFS: {1}".format(expectedPath5 == brutePath5, expectedPath5 == dfsPath5)
# Test case 6
# print "---------------"
# print "Test case 6:"
# print "Find the shortest-path from Building 1 to 32 without going outdoors"
# expectedPath6 = ['1', '3', '10', '4', '12', '24', '34', '36', '32']
# brutePath6 = bruteForceSearch(mitMap, '1', '32', LARGE_DIST, 0)
# dfsPath6 = directedDFS(mitMap, '1', '32', LARGE_DIST, 0)
# print "Expected: ", expectedPath6
# print "Brute-force: ", brutePath6
# print "DFS: ", dfsPath6
# print "Correct? BFS: {0}; DFS: {1}".format(expectedPath6 == brutePath6, expectedPath6 == dfsPath6)
# Test case 7
# print "---------------"
# print "Test case 7:"
# print "Find the shortest-path from Building 8 to 50 without going outdoors"
# bruteRaisedErr = 'No'
# dfsRaisedErr = 'No'
# try:
# bruteForceSearch(mitMap, '8', '50', LARGE_DIST, 0)
# except ValueError:
# bruteRaisedErr = 'Yes'
# try:
# directedDFS(mitMap, '8', '50', LARGE_DIST, 0)
# except ValueError:
# dfsRaisedErr = 'Yes'
# print "Expected: No such path! Should throw a value error."
# print "Did brute force search raise an error?", bruteRaisedErr
# print "Did DFS search raise an error?", dfsRaisedErr
# Test case 8
# print "---------------"
# print "Test case 8:"
# print "Find the shortest-path from Building 10 to 32 without walking"
# print "more than 100 meters in total"
# bruteRaisedErr = 'No'
# dfsRaisedErr = 'No'
# try:
# bruteForceSearch(mitMap, '10', '32', 100, LARGE_DIST)
# except ValueError:
# bruteRaisedErr = 'Yes'
# try:
# directedDFS(mitMap, '10', '32', 100, LARGE_DIST)
# except ValueError:
# dfsRaisedErr = 'Yes'
# print "Expected: No such path! Should throw a value error."
# print "Did brute force search raise an error?", bruteRaisedErr
# print "Did DFS search raise an error?", dfsRaisedErr
#
#
#
#
#
#
#
#
#
| [
1,
29871,
30143,
29937,
29871,
29953,
29889,
29900,
29900,
29889,
29906,
29916,
11583,
3789,
29871,
29945,
13,
29937,
12367,
13883,
13,
29937,
383,
4015,
3273,
342,
10898,
1549,
341,
1806,
13814,
13,
29937,
13,
13,
5215,
1347,
13,
29937,
910,
24802,
4129,
515,
421,
4262,
29889,
2272,
29952,
408,
565,
372,
471,
3342,
297,
445,
934,
29991,
13,
3166,
3983,
1053,
334,
29871,
13,
13,
29937,
13,
29937,
11583,
29871,
29906,
29901,
17166,
701,
278,
7259,
375,
7315,
13,
29937,
13,
29937,
10949,
366,
2436,
738,
775,
29892,
2436,
263,
7303,
310,
25260,
1244,
29871,
13,
29937,
20766,
920,
366,
674,
1904,
445,
1108,
408,
263,
3983,
29889,
29871,
13,
13,
29937,
910,
338,
263,
8444,
15058,
304,
1371,
366,
2894,
675,
596,
13,
29937,
13133,
1434,
366,
22002,
280,
263,
4802,
2874,
1108,
29991,
13,
29937,
13,
13,
29937,
1619,
6139,
310,
278,
1108,
29901,
13,
29937,
13,
29937,
405,
2631,
338,
263,
13814,
29892,
12770,
338,
278,
25320,
1546,
963,
29889,
7569,
2224,
313,
12864,
29897,
515,
5214,
13,
29937,
304,
5214,
756,
4128,
313,
705,
5861,
313,
2568,
16946,
5033,
29949,
6201,
272,
876,
310,
5418,
29889,
306,
881,
1436,
311,
263,
10296,
29871,
13,
29937,
310,
10898,
313,
287,
2710,
29897,
14671,
5214,
313,
4247,
29909,
29897,
304,
5214,
313,
4247,
29933,
29897,
411,
19087,
13,
29937,
22792,
310,
652,
271,
2925,
29898,
705,
5861,
29897,
3692,
372,
338,
1894,
16946,
470,
438,
6201,
272,
29889,
13,
13,
13,
1753,
2254,
29918,
1958,
29898,
1958,
3434,
3871,
1125,
13,
1678,
9995,
29871,
13,
1678,
1459,
29879,
267,
278,
2910,
934,
322,
3386,
29879,
263,
10624,
3983,
13,
13,
1678,
12662,
2699,
29901,
29871,
13,
4706,
2910,
3434,
3871,
584,
1024,
310,
278,
2910,
934,
13,
13,
1678,
4007,
9351,
29901,
13,
4706,
7806,
6251,
297,
278,
2910,
934,
11624,
310,
278,
1494,
3023,
6374,
29871,
13,
4706,
11920,
29892,
13055,
491,
263,
9654,
2913,
29901,
13,
9651,
3645,
1763,
14990,
27469,
6652,
749,
3744,
1867,
943,
13,
4706,
321,
29889,
29887,
29889,
13,
632,
29941,
29906,
29871,
29955,
29953,
29871,
29945,
29946,
29871,
29906,
29941,
13,
4706,
910,
6251,
723,
4953,
385,
7636,
515,
29871,
29941,
29906,
304,
29871,
29955,
29953,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
263,
10624,
3983,
15783,
278,
2910,
13,
1678,
9995,
13,
1678,
297,
2283,
353,
1722,
29898,
1958,
3434,
3871,
29892,
525,
29878,
742,
29871,
29900,
29897,
13,
1678,
1347,
29918,
1761,
353,
5159,
13,
1678,
363,
1196,
297,
297,
2283,
29901,
13,
4706,
1734,
1761,
353,
1347,
29889,
5451,
29898,
1220,
29897,
13,
4706,
1347,
29918,
1761,
29889,
4397,
29898,
1742,
1761,
29897,
13,
1678,
7573,
353,
731,
4197,
2314,
13,
1678,
12770,
353,
5159,
13,
1678,
281,
29918,
4262,
353,
1334,
523,
287,
14991,
1140,
580,
29871,
13,
1678,
363,
6031,
297,
1347,
29918,
1761,
29901,
13,
13,
4706,
1369,
353,
6031,
29961,
29900,
29962,
13,
4706,
2731,
353,
6031,
29961,
29896,
29962,
13,
4706,
2025,
29918,
19244,
353,
5785,
29898,
19651,
29961,
29906,
2314,
13,
4706,
714,
29881,
29918,
19244,
353,
5785,
29898,
19651,
29961,
29941,
2314,
13,
13,
4706,
1369,
29918,
3177,
353,
9071,
29898,
2962,
29897,
13,
4706,
15422,
29918,
3177,
353,
9071,
29898,
7854,
29897,
13,
4706,
281,
29918,
12864,
353,
1334,
523,
287,
23894,
29898,
2962,
29918,
3177,
29892,
15422,
29918,
3177,
29892,
2025,
29918,
19244,
1919,
714,
29881,
29918,
19244,
29897,
13,
308,
13,
4706,
1018,
29901,
13,
9651,
281,
29918,
4262,
29889,
1202,
4247,
29898,
2962,
29918,
3177,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
1209,
13,
4706,
1018,
29901,
13,
9651,
281,
29918,
4262,
29889,
1202,
4247,
29898,
7854,
262,
29918,
3177,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
1209,
13,
4706,
1018,
29901,
13,
9651,
281,
29918,
4262,
29889,
1202,
23894,
29898,
29893,
29918,
12864,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
1209,
13,
4706,
736,
281,
29918,
4262,
13,
268,
13,
29937,
2415,
3388,
353,
2254,
29918,
1958,
703,
2415,
29918,
1958,
29889,
3945,
1159,
13,
29937,
18010,
353,
1380,
3388,
29889,
18010,
13,
29937,
18010,
353,
1051,
29898,
18010,
29897,
13,
13,
13,
13,
29937,
11583,
29871,
29941,
29901,
383,
4015,
278,
13899,
342,
10802,
773,
1771,
1082,
11004,
11856,
13,
29937,
13,
29937,
4306,
278,
13883,
1108,
408,
263,
740,
304,
6260,
675,
13,
29937,
322,
825,
278,
11938,
526,
13,
29937,
13,
1753,
679,
2605,
29879,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
1125,
13,
1678,
1369,
353,
9071,
29898,
2962,
29897,
13,
1678,
1095,
353,
9071,
29898,
355,
29897,
13,
1678,
5096,
353,
5519,
2962,
5262,
13,
1678,
2224,
893,
353,
5159,
13,
13,
1678,
1550,
5096,
29901,
13,
4706,
2224,
353,
5096,
29889,
7323,
580,
13,
4706,
2943,
353,
2224,
14352,
29896,
29962,
13,
4706,
565,
2943,
1275,
1095,
29901,
13,
9651,
2224,
893,
29889,
4397,
29898,
2084,
7503,
2314,
13,
9651,
6773,
13,
4706,
4344,
353,
4697,
1140,
29889,
11991,
2776,
29898,
3177,
29897,
13,
4706,
565,
451,
4344,
29901,
6773,
13,
4706,
5096,
4619,
518,
2084,
718,
29961,
29883,
29962,
363,
274,
297,
4344,
565,
274,
451,
297,
2224,
29962,
13,
1678,
736,
2224,
893,
13,
13,
1753,
679,
2605,
27469,
29898,
7501,
1140,
29892,
2224,
1125,
13,
1678,
3001,
13398,
353,
714,
29881,
13398,
353,
29871,
29900,
29889,
29900,
13,
1678,
363,
302,
29896,
29892,
302,
29906,
297,
14319,
29898,
2084,
29892,
2084,
29961,
29896,
17531,
1125,
13,
4706,
363,
7636,
297,
4697,
1140,
29889,
287,
2710,
29961,
29876,
29896,
5387,
13,
9651,
565,
7636,
29961,
29900,
29962,
1275,
302,
29906,
29901,
13,
18884,
3001,
13398,
4619,
7636,
29961,
29896,
3816,
29900,
29962,
13,
18884,
714,
29881,
13398,
4619,
12864,
29961,
29896,
3816,
29896,
29962,
13,
18884,
2867,
13,
1678,
736,
313,
7827,
13398,
29892,
714,
29881,
13398,
29897,
13,
13,
1753,
679,
21322,
342,
2605,
29898,
7501,
1140,
29892,
10898,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
1125,
13,
1678,
620,
353,
6629,
13,
1678,
3273,
342,
353,
6213,
13,
1678,
363,
2224,
297,
10898,
29901,
13,
4706,
3001,
13398,
29892,
714,
29881,
13398,
353,
679,
2605,
27469,
29898,
7501,
1140,
29892,
2224,
29897,
13,
4706,
565,
3001,
13398,
5277,
4236,
11536,
13398,
322,
714,
29881,
13398,
5277,
29871,
4236,
13398,
3744,
1867,
943,
29901,
13,
9651,
565,
451,
3273,
342,
470,
3001,
13398,
529,
3273,
342,
29901,
13,
18884,
620,
29892,
3273,
342,
353,
2224,
29892,
3001,
13398,
13,
1678,
736,
620,
13,
13,
1753,
1506,
1082,
2831,
346,
7974,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
1125,
268,
13,
1678,
9995,
13,
1678,
10987,
29879,
278,
3273,
342,
2224,
515,
1369,
304,
1095,
773,
1506,
1082,
29899,
10118,
2948,
29889,
13,
1678,
450,
3001,
5418,
9850,
839,
373,
278,
2224,
1818,
451,
13461,
4236,
11536,
13398,
29892,
322,
13,
1678,
278,
5418,
10398,
714,
17433,
373,
445,
2224,
1818,
451,
13461,
4236,
13398,
3744,
1867,
943,
29889,
13,
13,
1678,
12662,
2699,
29901,
29871,
13,
4706,
4697,
1140,
29901,
2777,
310,
770,
10951,
1140,
470,
967,
19481,
13,
4706,
1369,
29892,
1095,
29901,
1369,
669,
1095,
5214,
3694,
313,
19651,
29897,
13,
4706,
4236,
11536,
13398,
584,
7472,
3001,
5418,
373,
263,
2224,
313,
16031,
29897,
13,
4706,
4236,
13398,
3744,
1867,
943,
29901,
7472,
5418,
10398,
714,
1867,
943,
373,
263,
2224,
313,
16031,
29897,
13,
13,
1678,
4007,
9351,
29901,
13,
4706,
1369,
322,
1095,
526,
3694,
363,
5923,
13814,
297,
3983,
13,
13,
1678,
16969,
29901,
13,
4706,
450,
3273,
342,
29899,
2084,
515,
1369,
304,
1095,
29892,
9875,
491,
29871,
13,
4706,
263,
1051,
310,
5214,
3694,
313,
262,
6031,
511,
518,
29876,
29918,
29896,
29892,
302,
29918,
29906,
29892,
2023,
29892,
302,
29918,
29895,
1402,
29871,
13,
4706,
988,
727,
4864,
385,
7636,
515,
302,
29918,
29875,
304,
302,
23538,
29875,
29974,
29896,
29897,
297,
4697,
1140,
29892,
29871,
13,
4706,
363,
599,
29871,
29896,
5277,
474,
529,
413,
29889,
13,
13,
4706,
960,
727,
4864,
694,
2224,
393,
17150,
4236,
11536,
13398,
322,
13,
4706,
4236,
13398,
3744,
1867,
943,
11938,
29892,
769,
1153,
4637,
263,
7865,
2392,
29889,
13,
13,
1678,
9995,
13,
1678,
10898,
353,
679,
2605,
29879,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29897,
13,
1678,
3273,
342,
353,
679,
21322,
342,
2605,
29898,
7501,
1140,
29892,
10898,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
29897,
13,
1678,
565,
3273,
342,
29901,
13,
4706,
736,
2910,
29898,
710,
29892,
3273,
342,
29897,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
6702,
1917,
2392,
1495,
29871,
13,
13,
29937,
13,
29937,
11583,
29871,
29946,
29901,
383,
4015,
278,
1383,
272,
342,
10802,
773,
20693,
326,
1891,
11856,
8108,
13,
29937,
13,
1753,
10624,
4037,
29903,
29918,
3206,
26458,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
29892,
2224,
353,
19997,
3273,
342,
353,
6213,
1125,
13,
1678,
9995,
13,
1678,
10987,
29879,
278,
3273,
342,
2224,
515,
1369,
304,
1095,
773,
10624,
10809,
29899,
4102,
29889,
13,
1678,
2740,
2948,
29889,
450,
3001,
5418,
9850,
839,
373,
278,
2224,
1818,
451,
13,
1678,
13461,
4236,
11536,
13398,
29892,
322,
278,
5418,
10398,
714,
17433,
373,
445,
2224,
1818,
13,
12,
1333,
13461,
4236,
13398,
3744,
1867,
943,
29889,
13,
13,
1678,
12662,
2699,
29901,
29871,
13,
4706,
4697,
1140,
29901,
2777,
310,
770,
10951,
1140,
470,
967,
19481,
13,
4706,
1369,
29892,
1095,
29901,
1369,
669,
1095,
5214,
3694,
313,
19651,
29897,
13,
4706,
4236,
11536,
13398,
584,
7472,
3001,
5418,
373,
263,
2224,
313,
16031,
29897,
13,
4706,
4236,
13398,
3744,
1867,
943,
29901,
7472,
5418,
10398,
714,
1867,
943,
373,
263,
2224,
313,
16031,
29897,
13,
13,
1678,
4007,
9351,
29901,
13,
4706,
1369,
322,
1095,
526,
3694,
363,
5923,
13814,
297,
3983,
13,
13,
1678,
16969,
29901,
13,
4706,
450,
3273,
342,
29899,
2084,
515,
1369,
304,
1095,
29892,
9875,
491,
29871,
13,
4706,
263,
1051,
310,
5214,
3694,
313,
262,
6031,
511,
518,
29876,
29918,
29896,
29892,
302,
29918,
29906,
29892,
2023,
29892,
302,
29918,
29895,
1402,
29871,
13,
4706,
988,
727,
4864,
385,
7636,
515,
302,
29918,
29875,
304,
302,
23538,
29875,
29974,
29896,
29897,
297,
4697,
1140,
29892,
29871,
13,
4706,
363,
599,
29871,
29896,
5277,
474,
529,
413,
29889,
13,
13,
4706,
960,
727,
4864,
694,
2224,
393,
17150,
4236,
11536,
13398,
322,
13,
4706,
4236,
13398,
3744,
1867,
943,
11938,
29892,
769,
1153,
4637,
263,
7865,
2392,
29889,
13,
1678,
9995,
13,
1678,
1369,
353,
9071,
29898,
2962,
29897,
13,
1678,
1095,
353,
9071,
29898,
355,
29897,
13,
1678,
2224,
353,
2224,
718,
518,
2962,
29962,
13,
1678,
565,
1369,
1275,
1095,
29901,
13,
4706,
736,
2224,
13,
4706,
396,
19878,
13,
1678,
396,
2158,
4697,
1140,
29889,
13,
1678,
1596,
4697,
1140,
29889,
11991,
2776,
29898,
2962,
29897,
13,
1678,
363,
2943,
297,
4697,
1140,
29889,
11991,
2776,
29898,
2962,
1125,
13,
4706,
1596,
2943,
451,
297,
2224,
13,
4706,
565,
2943,
451,
297,
2224,
29901,
13,
9651,
565,
3273,
342,
1275,
6213,
470,
7431,
29898,
2084,
29897,
529,
7431,
313,
12759,
342,
1125,
13,
18884,
716,
2605,
353,
10624,
4037,
29903,
29898,
7501,
1140,
29892,
2943,
29892,
1095,
29892,
3317,
11536,
13398,
29892,
3317,
13398,
3744,
1867,
943,
29892,
2224,
29892,
3273,
342,
29897,
13,
18884,
565,
716,
2605,
2804,
6213,
29901,
13,
462,
1678,
736,
716,
2605,
13,
1678,
396,
2158,
2224,
29918,
1761,
13,
1678,
736,
3273,
342,
13,
13,
1753,
679,
20624,
326,
1891,
2605,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29892,
4236,
11536,
13398,
29892,
4236,
3744,
17433,
13398,
1125,
13,
1678,
1369,
29892,
1095,
353,
9071,
29898,
2962,
511,
9071,
29898,
355,
29897,
13,
1678,
5096,
353,
5519,
2962,
29892,
302,
29962,
363,
302,
297,
4697,
1140,
29889,
11991,
2776,
29898,
2962,
29897,
565,
302,
2804,
1369,
29962,
13,
1678,
620,
29892,
3273,
342,
353,
29871,
12633,
6213,
13,
13,
1678,
1550,
5096,
29901,
13,
4706,
2224,
353,
5096,
29889,
7323,
580,
13,
4706,
3001,
13398,
29892,
714,
13398,
353,
679,
2605,
27469,
29898,
7501,
1140,
29892,
2224,
29897,
13,
4706,
565,
3001,
13398,
1405,
4236,
29911,
1862,
29880,
13398,
470,
714,
13398,
1405,
4236,
3744,
17433,
13398,
29901,
13,
9651,
6773,
13,
4706,
2943,
353,
2224,
14352,
29896,
29962,
13,
4706,
565,
2943,
1275,
1095,
29901,
13,
9651,
565,
451,
3273,
342,
470,
3001,
13398,
529,
3273,
342,
29901,
13,
18884,
620,
29892,
3273,
342,
353,
2224,
29892,
3001,
13398,
13,
9651,
6773,
13,
4706,
4344,
353,
4697,
1140,
29889,
11991,
2776,
29898,
3177,
29897,
13,
4706,
565,
451,
4344,
29901,
6773,
13,
4706,
5096,
4619,
518,
2084,
718,
518,
29883,
29962,
363,
274,
297,
4344,
565,
274,
451,
297,
2224,
29962,
13,
1678,
736,
620,
13,
13,
13,
1753,
10624,
4037,
29903,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
1125,
13,
1678,
620,
353,
679,
20624,
326,
1891,
2605,
29898,
7501,
1140,
29892,
1369,
29892,
1095,
29892,
4236,
11536,
13398,
29892,
4236,
13398,
3744,
1867,
943,
29897,
13,
1678,
565,
620,
29901,
13,
4706,
736,
2910,
29898,
710,
29892,
620,
29897,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
877,
1917,
2392,
1495,
13,
268,
13,
13,
13,
29937,
2415,
3388,
353,
2254,
29918,
1958,
703,
2415,
29918,
1958,
29889,
3945,
1159,
13,
29937,
2158,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
742,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29897,
13,
29937,
2158,
679,
2605,
29879,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
1495,
13,
13,
13,
13,
29937,
853,
9342,
2400,
746,
7960,
304,
1243,
13,
4136,
6058,
29923,
29991,
4525,
6987,
1122,
2125,
263,
2846,
6233,
304,
1065,
6824,
3191,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
268,
1380,
3388,
353,
2254,
29918,
1958,
703,
2415,
29918,
1958,
29889,
3945,
1159,
13,
268,
1596,
338,
8758,
29898,
2415,
3388,
29892,
10951,
1140,
29897,
13,
268,
1596,
338,
8758,
29898,
2415,
3388,
29892,
1334,
523,
287,
14991,
1140,
29897,
13,
268,
1596,
525,
18010,
742,
1380,
3388,
29889,
18010,
13,
268,
1596,
525,
287,
2710,
742,
1380,
3388,
29889,
287,
2710,
13,
29937,
13,
29937,
13,
268,
365,
1718,
1692,
29918,
4571,
1254,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
13,
29937,
13,
29937,
268,
4321,
1206,
29871,
29896,
13,
268,
396,
1596,
376,
9072,
5634,
29908,
13,
268,
396,
1596,
376,
3057,
1206,
29871,
29896,
6160,
13,
268,
396,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29941,
29906,
304,
29871,
29945,
29953,
29908,
13,
268,
396,
3806,
2605,
29896,
353,
6024,
29941,
29906,
742,
525,
29945,
29953,
2033,
13,
268,
396,
1182,
1082,
2605,
29896,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
268,
396,
4489,
29879,
2605,
29896,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
268,
396,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29896,
13,
268,
396,
2158,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29896,
13,
268,
396,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29896,
13,
268,
396,
2158,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29896,
1275,
1506,
1082,
2605,
29896,
29892,
3806,
2605,
29896,
1275,
4489,
29879,
2605,
29896,
29897,
13,
29937,
13,
29937,
268,
4321,
1206,
29871,
29906,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29906,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29941,
29906,
304,
29871,
29945,
29953,
1728,
2675,
714,
1867,
943,
29908,
13,
29937,
268,
3806,
2605,
29906,
353,
6024,
29941,
29906,
742,
525,
29941,
29953,
742,
525,
29906,
29953,
742,
525,
29896,
29953,
742,
525,
29945,
29953,
2033,
13,
29937,
268,
1506,
1082,
2605,
29906,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
4489,
29879,
2605,
29906,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29941,
29906,
742,
525,
29945,
29953,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29906,
13,
29937,
268,
1596,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29906,
13,
29937,
268,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29906,
13,
29937,
268,
1596,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29906,
1275,
1506,
1082,
2605,
29906,
29892,
3806,
2605,
29906,
1275,
4489,
29879,
2605,
29906,
29897,
13,
13,
29937,
268,
4321,
1206,
29871,
29941,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29941,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29906,
304,
29871,
29929,
29908,
13,
29937,
268,
3806,
2605,
29941,
353,
6024,
29906,
742,
525,
29941,
742,
525,
29955,
742,
525,
29929,
2033,
13,
29937,
268,
1506,
1082,
2605,
29941,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29906,
742,
525,
29929,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
4489,
29879,
2605,
29941,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29906,
742,
525,
29929,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29941,
13,
29937,
268,
1596,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29941,
13,
29937,
268,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29941,
13,
29937,
268,
1596,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29941,
1275,
1506,
1082,
2605,
29941,
29892,
3806,
2605,
29941,
1275,
4489,
29879,
2605,
29941,
29897,
13,
13,
29937,
268,
4321,
1206,
29871,
29946,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29946,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29906,
304,
29871,
29929,
1728,
2675,
714,
1867,
943,
29908,
13,
29937,
268,
3806,
2605,
29946,
353,
6024,
29906,
742,
525,
29946,
742,
525,
29896,
29900,
742,
525,
29896,
29941,
742,
525,
29929,
2033,
13,
29937,
268,
1506,
1082,
2605,
29946,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29906,
742,
525,
29929,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
4489,
29879,
2605,
29946,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29906,
742,
525,
29929,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29946,
13,
29937,
268,
1596,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29946,
13,
29937,
268,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29946,
13,
29937,
268,
1596,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29946,
1275,
1506,
1082,
2605,
29946,
29892,
3806,
2605,
29946,
1275,
4489,
29879,
2605,
29946,
29897,
13,
13,
29937,
268,
4321,
1206,
29871,
29945,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29945,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29896,
304,
29871,
29941,
29906,
29908,
13,
29937,
268,
3806,
2605,
29945,
353,
6024,
29896,
742,
525,
29946,
742,
525,
29896,
29906,
742,
525,
29941,
29906,
2033,
13,
29937,
268,
1506,
1082,
2605,
29945,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29896,
742,
525,
29941,
29906,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
4489,
29879,
2605,
29945,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29896,
742,
525,
29941,
29906,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29945,
13,
29937,
268,
1596,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29945,
13,
29937,
268,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29945,
13,
29937,
268,
1596,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29945,
1275,
1506,
1082,
2605,
29945,
29892,
3806,
2605,
29945,
1275,
4489,
29879,
2605,
29945,
29897,
13,
13,
29937,
268,
4321,
1206,
29871,
29953,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29953,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29896,
304,
29871,
29941,
29906,
1728,
2675,
714,
1867,
943,
29908,
13,
29937,
268,
3806,
2605,
29953,
353,
6024,
29896,
742,
525,
29941,
742,
525,
29896,
29900,
742,
525,
29946,
742,
525,
29896,
29906,
742,
525,
29906,
29946,
742,
525,
29941,
29946,
742,
525,
29941,
29953,
742,
525,
29941,
29906,
2033,
13,
29937,
268,
1506,
1082,
2605,
29953,
353,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29896,
742,
525,
29941,
29906,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
4489,
29879,
2605,
29953,
353,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29896,
742,
525,
29941,
29906,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
9162,
3806,
2605,
29953,
13,
29937,
268,
1596,
376,
12432,
1082,
29899,
10118,
29901,
9162,
1506,
1082,
2605,
29953,
13,
29937,
268,
1596,
376,
4037,
29903,
29901,
9162,
4489,
29879,
2605,
29953,
13,
29937,
268,
1596,
376,
12521,
1621,
29973,
350,
9998,
29901,
426,
29900,
3400,
360,
9998,
29901,
426,
29896,
29913,
1642,
4830,
29898,
9684,
2605,
29953,
1275,
1506,
1082,
2605,
29953,
29892,
3806,
2605,
29953,
1275,
4489,
29879,
2605,
29953,
29897,
13,
13,
29937,
268,
4321,
1206,
29871,
29955,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29955,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29947,
304,
29871,
29945,
29900,
1728,
2675,
714,
1867,
943,
29908,
13,
29937,
268,
1506,
1082,
29934,
1759,
287,
19212,
353,
525,
3782,
29915,
13,
29937,
268,
4489,
29879,
29934,
1759,
287,
19212,
353,
525,
3782,
29915,
13,
29937,
268,
1018,
29901,
13,
29937,
308,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29947,
742,
525,
29945,
29900,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
5174,
7865,
2392,
29901,
13,
29937,
308,
1506,
1082,
29934,
1759,
287,
19212,
353,
525,
8241,
29915,
13,
268,
13,
29937,
268,
1018,
29901,
13,
29937,
308,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29947,
742,
525,
29945,
29900,
742,
365,
1718,
1692,
29918,
4571,
1254,
29892,
29871,
29900,
29897,
13,
29937,
268,
5174,
7865,
2392,
29901,
13,
29937,
308,
4489,
29879,
29934,
1759,
287,
19212,
353,
525,
8241,
29915,
13,
268,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
1939,
1316,
2224,
29991,
10575,
3183,
263,
995,
1059,
1213,
13,
29937,
268,
1596,
376,
9260,
1506,
1082,
4889,
2740,
12020,
385,
1059,
29973,
613,
1506,
1082,
29934,
1759,
287,
19212,
13,
29937,
268,
1596,
376,
9260,
360,
9998,
2740,
12020,
385,
1059,
29973,
613,
4489,
29879,
29934,
1759,
287,
19212,
13,
13,
29937,
268,
4321,
1206,
29871,
29947,
13,
29937,
268,
1596,
376,
9072,
5634,
29908,
13,
29937,
268,
1596,
376,
3057,
1206,
29871,
29947,
6160,
13,
29937,
268,
1596,
376,
12542,
278,
3273,
342,
29899,
2084,
515,
17166,
29871,
29896,
29900,
304,
29871,
29941,
29906,
1728,
22049,
29908,
13,
29937,
268,
1596,
376,
5514,
1135,
29871,
29896,
29900,
29900,
27881,
297,
3001,
29908,
13,
29937,
268,
1506,
1082,
29934,
1759,
287,
19212,
353,
525,
3782,
29915,
13,
29937,
268,
4489,
29879,
29934,
1759,
287,
19212,
353,
525,
3782,
29915,
13,
29937,
268,
1018,
29901,
13,
29937,
308,
1506,
1082,
2831,
346,
7974,
29898,
2415,
3388,
29892,
525,
29896,
29900,
742,
525,
29941,
29906,
742,
29871,
29896,
29900,
29900,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
5174,
7865,
2392,
29901,
13,
29937,
308,
1506,
1082,
29934,
1759,
287,
19212,
353,
525,
8241,
29915,
13,
268,
13,
29937,
268,
1018,
29901,
13,
29937,
308,
10624,
4037,
29903,
29898,
2415,
3388,
29892,
525,
29896,
29900,
742,
525,
29941,
29906,
742,
29871,
29896,
29900,
29900,
29892,
365,
1718,
1692,
29918,
4571,
1254,
29897,
13,
29937,
268,
5174,
7865,
2392,
29901,
13,
29937,
308,
4489,
29879,
29934,
1759,
287,
19212,
353,
525,
8241,
29915,
13,
268,
13,
29937,
268,
1596,
376,
1252,
6021,
29901,
1939,
1316,
2224,
29991,
10575,
3183,
263,
995,
1059,
1213,
13,
29937,
268,
1596,
376,
9260,
1506,
1082,
4889,
2740,
12020,
385,
1059,
29973,
613,
1506,
1082,
29934,
1759,
287,
19212,
13,
29937,
268,
1596,
376,
9260,
360,
9998,
2740,
12020,
385,
1059,
29973,
613,
4489,
29879,
29934,
1759,
287,
19212,
13,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
29937,
13,
2
] |
src/radical/pilot/agent/launch_method/srun.py | radical-cybertools/radical.pilot | 47 | 124033 | <filename>src/radical/pilot/agent/launch_method/srun.py
__copyright__ = "Copyright 2016, http://radical.rutgers.edu"
__license__ = "MIT"
import math
import radical.utils as ru
from .base import LaunchMethod
# ------------------------------------------------------------------------------
#
class Srun(LaunchMethod):
'''
This launch method uses `srun` to place tasks into a slurm allocation.
Srun has severe limitations compared to other launch methods, in that it
does not allow to place a task on a specific set of nodes and cores, at
least not in the general case. It is possible to select nodes as long as
the task uses (a part of) a single node, or the task is using multiple nodes
uniformly. Core pinning is only available on tasks which use exactly one
full node (and in that case becomes useless for our purposes).
We use srun in the following way:
IF task <= nodesize
OR task is uniformel
THEN enforce node placement
ELSE leave *all* placement to slurm
'''
# --------------------------------------------------------------------------
#
def __init__(self, name, lm_cfg, rm_info, log, prof):
self._command: str = ''
LaunchMethod.__init__(self, name, lm_cfg, rm_info, log, prof)
# --------------------------------------------------------------------------
#
def _init_from_scratch(self, env, env_sh):
command = ru.which('srun')
out, err, ret = ru.sh_callout('%s -V' % command)
if ret:
raise RuntimeError('cannot use srun [%s] [%s]' % (out, err))
self._version = out.split()[-1]
self._log.debug('using srun from %s [%s]',
command, self._version)
lm_info = {'env' : env,
'env_sh' : env_sh,
'command': command}
return lm_info
# --------------------------------------------------------------------------
#
def _init_from_info(self, lm_info):
self._env = lm_info['env']
self._env_sh = lm_info['env_sh']
self._command = lm_info['command']
assert self._command
# --------------------------------------------------------------------------
#
def finalize(self):
pass
# --------------------------------------------------------------------------
#
def can_launch(self, task):
if not task['description']['executable']:
return False, 'no executable'
return True, ''
# -------------------------------------------------------------------------
#
def get_slurm_ver(self):
major_version = int(self._version.split('.')[0].split()[-1])
return major_version
# --------------------------------------------------------------------------
#
def get_launcher_env(self):
return ['export SLURM_CPU_BIND=verbose', # debug mapping
'. $RP_PILOT_SANDBOX/%s' % self._env_sh]
# --------------------------------------------------------------------------
#
def get_launch_cmds(self, task, exec_path):
uid = task['uid']
slots = task['slots']
td = task['description']
sbox = task['task_sandbox_path']
n_tasks = td['cpu_processes']
n_task_threads = td.get('cpu_threads', 1)
n_gpus = td.get('gpu_processes', 1)
# Alas, exact rank-to-core mapping seems only be available in Slurm when
# tasks use full nodes - which in RP is rarely the case. We thus are
# limited to specifying the list of nodes we want the processes to be
# placed on, and otherwise have to rely on the `--exclusive` flag to get
# a decent auto mapping. In cases where the scheduler did not place
# the task we leave the node placement to srun as well.
if not slots:
nodefile = None
n_nodes = int(math.ceil(float(n_tasks) /
self._rm_info.get('cores_per_node', 1)))
else:
# the scheduler did place tasks - we can't honor the core and gpu
# mapping (see above), but we at least honor the nodelist.
nodelist = [rank['node_name'] for rank in slots['ranks']]
nodefile = '%s/%s.nodes' % (sbox, uid)
with ru.ru_open(nodefile, 'w') as fout:
fout.write(','.join(nodelist))
fout.write('\n')
n_nodes = len(set(nodelist))
# use `--exclusive` to ensure all tasks get individual resources.
# do not use core binding: it triggers warnings on some installations
# FIXME: warnings are triggered anyway :-(
mapping = '--exclusive --cpu-bind=none ' \
+ '--nodes %d ' % n_nodes \
+ '--ntasks %d ' % n_tasks \
+ '--gpus %d ' % (n_gpus * n_tasks) \
+ '--cpus-per-task %d' % n_task_threads
# check that gpus were requested to be allocated
if self._rm_info.get('gpus'):
mapping += ' --gpus-per-task %d' % n_gpus
if nodefile:
if self.get_slurm_ver() <= 18:
mapping += ' --nodelist=%s' % ','.join(str(n) for n in nodelist)
else:
mapping += ' --nodefile=%s' % nodefile
cmd = '%s %s %s' % (self._command, mapping, exec_path)
return cmd.rstrip()
# --------------------------------------------------------------------------
#
def get_rank_cmd(self):
# FIXME: does SRUN set a rank env?
ret = 'test -z "$MPI_RANK" || export RP_RANK=$MPI_RANK\n'
ret += 'test -z "$PMIX_RANK" || export RP_RANK=$PMIX_RANK\n'
return ret
# --------------------------------------------------------------------------
#
def get_rank_exec(self, task, rank_id, rank):
td = task['description']
task_exec = td['executable']
task_args = td.get('arguments')
task_argstr = self._create_arg_string(task_args)
command = '%s %s' % (task_exec, task_argstr)
return command.rstrip()
# ------------------------------------------------------------------------------
| [
1,
529,
9507,
29958,
4351,
29914,
3665,
936,
29914,
29886,
309,
327,
29914,
14748,
29914,
15343,
29918,
5696,
29914,
29879,
3389,
29889,
2272,
13,
13,
1649,
8552,
1266,
1649,
353,
376,
11882,
1266,
29871,
29906,
29900,
29896,
29953,
29892,
1732,
597,
3665,
936,
29889,
23798,
5743,
29889,
6085,
29908,
13,
1649,
506,
1947,
1649,
259,
353,
376,
26349,
29908,
13,
13,
5215,
5844,
13,
13,
5215,
24818,
29889,
13239,
408,
5796,
13,
13,
3166,
869,
3188,
1053,
997,
3322,
4062,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
29937,
13,
1990,
317,
3389,
29898,
17641,
4062,
1125,
13,
1678,
14550,
13,
1678,
910,
6826,
1158,
3913,
421,
29879,
3389,
29952,
304,
2058,
9595,
964,
263,
2243,
17095,
24082,
29889,
13,
13,
1678,
317,
3389,
756,
22261,
27028,
9401,
304,
916,
6826,
3519,
29892,
297,
393,
372,
13,
1678,
947,
451,
2758,
304,
2058,
263,
3414,
373,
263,
2702,
731,
310,
7573,
322,
28337,
29892,
472,
13,
1678,
3203,
451,
297,
278,
2498,
1206,
29889,
29871,
739,
338,
1950,
304,
1831,
7573,
408,
1472,
408,
13,
1678,
278,
3414,
3913,
313,
29874,
760,
310,
29897,
263,
2323,
2943,
29892,
470,
278,
3414,
338,
773,
2999,
7573,
13,
1678,
26018,
29889,
29871,
10239,
12534,
1076,
338,
871,
3625,
373,
9595,
607,
671,
3721,
697,
13,
1678,
2989,
2943,
313,
392,
297,
393,
1206,
7415,
19315,
363,
1749,
11976,
467,
13,
13,
1678,
1334,
671,
269,
3389,
297,
278,
1494,
982,
29901,
13,
13,
4706,
10762,
1678,
3414,
5277,
7573,
675,
13,
4706,
6323,
1678,
3414,
338,
9090,
295,
13,
4706,
8183,
29871,
427,
10118,
2943,
2174,
13561,
13,
4706,
26446,
29871,
5967,
334,
497,
29930,
2174,
13561,
304,
2243,
17095,
13,
1678,
14550,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
301,
29885,
29918,
16859,
29892,
20241,
29918,
3888,
29892,
1480,
29892,
2600,
1125,
13,
13,
4706,
1583,
3032,
6519,
29901,
851,
353,
6629,
13,
13,
4706,
997,
3322,
4062,
17255,
2344,
12035,
1311,
29892,
1024,
29892,
301,
29885,
29918,
16859,
29892,
20241,
29918,
3888,
29892,
1480,
29892,
2600,
29897,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
10526,
905,
29898,
1311,
29892,
8829,
29892,
8829,
29918,
845,
1125,
13,
13,
4706,
1899,
353,
5796,
29889,
4716,
877,
29879,
3389,
1495,
13,
13,
4706,
714,
29892,
4589,
29892,
3240,
353,
5796,
29889,
845,
29918,
4804,
449,
877,
29995,
29879,
448,
29963,
29915,
1273,
1899,
29897,
13,
4706,
565,
3240,
29901,
13,
9651,
12020,
24875,
2392,
877,
29883,
6735,
671,
269,
3389,
518,
29995,
29879,
29962,
518,
29995,
29879,
29962,
29915,
1273,
313,
449,
29892,
4589,
876,
13,
13,
4706,
1583,
3032,
3259,
353,
714,
29889,
5451,
580,
14352,
29896,
29962,
13,
4706,
1583,
3032,
1188,
29889,
8382,
877,
4746,
269,
3389,
515,
1273,
29879,
518,
29995,
29879,
29962,
742,
13,
462,
4706,
1899,
29892,
1583,
3032,
3259,
29897,
13,
13,
4706,
301,
29885,
29918,
3888,
353,
11117,
6272,
29915,
1678,
584,
8829,
29892,
13,
462,
259,
525,
6272,
29918,
845,
29915,
584,
8829,
29918,
845,
29892,
13,
462,
259,
525,
6519,
2396,
1899,
29913,
13,
13,
4706,
736,
301,
29885,
29918,
3888,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
903,
2344,
29918,
3166,
29918,
3888,
29898,
1311,
29892,
301,
29885,
29918,
3888,
1125,
13,
13,
4706,
1583,
3032,
6272,
268,
353,
301,
29885,
29918,
3888,
1839,
6272,
2033,
13,
4706,
1583,
3032,
6272,
29918,
845,
29871,
353,
301,
29885,
29918,
3888,
1839,
6272,
29918,
845,
2033,
13,
4706,
1583,
3032,
6519,
353,
301,
29885,
29918,
3888,
1839,
6519,
2033,
13,
13,
4706,
4974,
1583,
3032,
6519,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
2186,
675,
29898,
1311,
1125,
13,
13,
4706,
1209,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
508,
29918,
15343,
29898,
1311,
29892,
3414,
1125,
13,
13,
4706,
565,
451,
3414,
1839,
8216,
16215,
4258,
9246,
2033,
29901,
13,
9651,
736,
7700,
29892,
525,
1217,
16813,
29915,
13,
13,
4706,
736,
5852,
29892,
6629,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
13,
1678,
396,
13,
1678,
822,
679,
29918,
2536,
17095,
29918,
369,
29898,
1311,
1125,
13,
13,
4706,
4655,
29918,
3259,
353,
938,
29898,
1311,
3032,
3259,
29889,
5451,
12839,
29861,
29900,
1822,
5451,
580,
14352,
29896,
2314,
13,
4706,
736,
4655,
29918,
3259,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
679,
29918,
15343,
261,
29918,
6272,
29898,
1311,
1125,
13,
13,
4706,
736,
6024,
15843,
27146,
4574,
29924,
29918,
6271,
29965,
29918,
29933,
22255,
29922,
369,
15828,
742,
29871,
396,
4744,
10417,
13,
18884,
15300,
395,
29934,
29925,
29918,
2227,
29931,
2891,
29918,
29903,
2190,
4051,
29949,
29990,
22584,
29879,
29915,
1273,
1583,
3032,
6272,
29918,
845,
29962,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
679,
29918,
15343,
29918,
9006,
29879,
29898,
1311,
29892,
3414,
29892,
2279,
29918,
2084,
1125,
13,
13,
4706,
318,
333,
9651,
353,
3414,
1839,
5416,
2033,
13,
4706,
2243,
1862,
3986,
353,
3414,
1839,
2536,
1862,
2033,
13,
4706,
22599,
632,
353,
3414,
1839,
8216,
2033,
13,
4706,
269,
1884,
965,
353,
3414,
1839,
7662,
29918,
29879,
26738,
29918,
2084,
2033,
13,
13,
4706,
302,
29918,
20673,
4706,
353,
22599,
1839,
21970,
29918,
5014,
267,
2033,
13,
4706,
302,
29918,
7662,
29918,
28993,
353,
22599,
29889,
657,
877,
21970,
29918,
28993,
742,
29871,
29896,
29897,
13,
4706,
302,
29918,
29887,
13364,
308,
353,
22599,
29889,
657,
877,
29887,
3746,
29918,
5014,
267,
742,
29871,
29896,
29897,
13,
13,
4706,
396,
838,
294,
29892,
2684,
7115,
29899,
517,
29899,
3221,
10417,
2444,
871,
367,
3625,
297,
14866,
17095,
746,
13,
4706,
396,
9595,
671,
2989,
7573,
448,
607,
297,
390,
29925,
338,
23703,
278,
1206,
29889,
29871,
1334,
4550,
526,
13,
4706,
396,
9078,
304,
22146,
278,
1051,
310,
7573,
591,
864,
278,
10174,
304,
367,
13,
4706,
396,
7180,
373,
29892,
322,
6467,
505,
304,
19104,
373,
278,
22974,
735,
7009,
573,
29952,
7353,
304,
679,
13,
4706,
396,
263,
27189,
4469,
10417,
29889,
29871,
512,
4251,
988,
278,
1364,
14952,
1258,
451,
2058,
13,
4706,
396,
278,
3414,
591,
5967,
278,
2943,
2174,
13561,
304,
269,
3389,
408,
1532,
29889,
13,
13,
4706,
565,
451,
2243,
1862,
29901,
13,
9651,
2943,
1445,
353,
6213,
13,
9651,
302,
29918,
18010,
29871,
353,
938,
29898,
755,
29889,
27696,
29898,
7411,
29898,
29876,
29918,
20673,
29897,
847,
13,
462,
462,
268,
1583,
3032,
1758,
29918,
3888,
29889,
657,
877,
29883,
2361,
29918,
546,
29918,
3177,
742,
29871,
29896,
4961,
13,
4706,
1683,
29901,
13,
9651,
396,
278,
1364,
14952,
1258,
2058,
9595,
448,
591,
508,
29915,
29873,
10657,
278,
7136,
322,
330,
3746,
13,
9651,
396,
10417,
313,
4149,
2038,
511,
541,
591,
472,
3203,
10657,
278,
18778,
295,
391,
29889,
13,
9651,
18778,
295,
391,
353,
518,
10003,
1839,
3177,
29918,
978,
2033,
363,
7115,
297,
2243,
1862,
1839,
661,
2039,
2033,
29962,
13,
9651,
2943,
1445,
353,
14210,
29879,
22584,
29879,
29889,
18010,
29915,
1273,
313,
29879,
1884,
29892,
318,
333,
29897,
13,
9651,
411,
5796,
29889,
582,
29918,
3150,
29898,
3177,
1445,
29892,
525,
29893,
1495,
408,
285,
449,
29901,
13,
18884,
285,
449,
29889,
3539,
29898,
3788,
29889,
7122,
29898,
29876,
27224,
391,
876,
13,
18884,
285,
449,
29889,
3539,
28909,
29876,
1495,
13,
13,
9651,
302,
29918,
18010,
353,
7431,
29898,
842,
29898,
29876,
27224,
391,
876,
13,
13,
4706,
396,
671,
22974,
735,
7009,
573,
29952,
304,
9801,
599,
9595,
679,
5375,
7788,
29889,
13,
4706,
396,
437,
451,
671,
7136,
9956,
29901,
372,
23660,
18116,
373,
777,
2601,
800,
13,
4706,
396,
383,
6415,
2303,
29901,
18116,
526,
19799,
8763,
8956,
29898,
13,
4706,
10417,
353,
525,
489,
735,
7009,
573,
1192,
21970,
29899,
5355,
29922,
9290,
525,
320,
13,
18884,
718,
525,
489,
18010,
1273,
29881,
525,
4706,
1273,
302,
29918,
18010,
320,
13,
18884,
718,
525,
489,
593,
1278,
29879,
1273,
29881,
525,
539,
1273,
302,
29918,
20673,
320,
13,
18884,
718,
525,
489,
29887,
13364,
1273,
29881,
525,
308,
1273,
313,
29876,
29918,
29887,
13364,
334,
302,
29918,
20673,
29897,
320,
13,
18884,
718,
525,
489,
6814,
375,
29899,
546,
29899,
7662,
1273,
29881,
29915,
1273,
302,
29918,
7662,
29918,
28993,
13,
13,
4706,
396,
1423,
393,
330,
13364,
892,
13877,
304,
367,
19591,
13,
4706,
565,
1583,
3032,
1758,
29918,
3888,
29889,
657,
877,
29887,
13364,
29374,
13,
9651,
10417,
4619,
525,
1192,
29887,
13364,
29899,
546,
29899,
7662,
1273,
29881,
29915,
1273,
302,
29918,
29887,
13364,
13,
13,
4706,
565,
2943,
1445,
29901,
13,
9651,
565,
1583,
29889,
657,
29918,
2536,
17095,
29918,
369,
580,
5277,
29871,
29896,
29947,
29901,
13,
18884,
10417,
4619,
525,
1192,
29876,
27224,
391,
16328,
29879,
29915,
1273,
13420,
4286,
7122,
29898,
710,
29898,
29876,
29897,
363,
302,
297,
18778,
295,
391,
29897,
13,
9651,
1683,
29901,
13,
18884,
10417,
4619,
525,
1192,
3177,
1445,
16328,
29879,
29915,
1273,
2943,
1445,
13,
13,
4706,
9920,
353,
14210,
29879,
1273,
29879,
1273,
29879,
29915,
1273,
313,
1311,
3032,
6519,
29892,
10417,
29892,
2279,
29918,
2084,
29897,
13,
4706,
736,
9920,
29889,
29878,
17010,
580,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
679,
29918,
10003,
29918,
9006,
29898,
1311,
1125,
13,
13,
4706,
396,
383,
6415,
2303,
29901,
947,
21020,
3904,
731,
263,
7115,
8829,
29973,
13,
4706,
3240,
29871,
353,
525,
1688,
448,
29920,
3908,
29924,
2227,
29918,
29934,
2190,
29968,
29908,
29871,
3830,
5609,
390,
29925,
29918,
29934,
2190,
29968,
6080,
29924,
2227,
29918,
29934,
2190,
29968,
29905,
29876,
29915,
13,
4706,
3240,
4619,
525,
1688,
448,
29920,
3908,
13427,
6415,
29918,
29934,
2190,
29968,
29908,
3830,
5609,
390,
29925,
29918,
29934,
2190,
29968,
6080,
13427,
6415,
29918,
29934,
2190,
29968,
29905,
29876,
29915,
13,
13,
4706,
736,
3240,
13,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
1678,
396,
13,
1678,
822,
679,
29918,
10003,
29918,
4258,
29898,
1311,
29892,
3414,
29892,
7115,
29918,
333,
29892,
7115,
1125,
13,
13,
4706,
22599,
3986,
353,
3414,
1839,
8216,
2033,
13,
4706,
3414,
29918,
4258,
259,
353,
22599,
1839,
4258,
9246,
2033,
13,
4706,
3414,
29918,
5085,
259,
353,
22599,
29889,
657,
877,
25699,
1495,
13,
4706,
3414,
29918,
1191,
710,
353,
1583,
3032,
3258,
29918,
1191,
29918,
1807,
29898,
7662,
29918,
5085,
29897,
13,
4706,
1899,
268,
353,
14210,
29879,
1273,
29879,
29915,
1273,
313,
7662,
29918,
4258,
29892,
3414,
29918,
1191,
710,
29897,
13,
13,
4706,
736,
1899,
29889,
29878,
17010,
580,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
13,
2
] |
tests/uservirtualrackattack.py | shlomimatichin/rackattack-virtual | 0 | 102962 | import subprocess
import os
import shutil
import time
from rackattack import clientfactory
from tests import testlib
import rackattack
class UserVirtualRackAttack:
MAXIMUM_VMS = 4
def __init__(self):
assert '/usr' not in rackattack.__file__
self._requestPort = 3443
self._subscribePort = 3444
imageDir = os.path.join(os.getcwd(), "images.fortests")
shutil.rmtree(imageDir, ignore_errors=True)
self._popen = subprocess.Popen(
["sudo", "PYTHONPATH=.", "UPSETO_JOIN_PYTHON_NAMESPACES=Yes",
"python", "rackattack/virtual/main.py",
"--requestPort=%d" % self._requestPort,
"--subscribePort=%d" % self._subscribePort,
"--diskImagesDirectory=" + imageDir,
"--serialLogsDirectory=" + imageDir,
"--maximumVMs=%d" % self.MAXIMUM_VMS],
close_fds=True, stderr=subprocess.STDOUT)
testlib.waitForTCPServer(('localhost', self._requestPort))
time.sleep(0.5) # dnsmasq needs to be able to receive a SIGHUP
def done(self):
if self._popen.poll() is not None:
raise Exception("Virtual RackAttack server terminated before it's time")
subprocess.check_call(["sudo", "kill", str(self._popen.pid)], close_fds=True)
self._popen.wait()
def createClient(self):
os.environ['RACKATTACK_PROVIDER'] = 'tcp://localhost:%d@tcp://localhost:%d' % (
self._requestPort, self._subscribePort)
return clientfactory.factory()
| [
1,
1053,
1014,
5014,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
931,
13,
3166,
1153,
384,
1131,
547,
1053,
3132,
14399,
13,
3166,
6987,
1053,
1243,
1982,
13,
5215,
1153,
384,
1131,
547,
13,
13,
13,
1990,
4911,
21287,
29934,
547,
4165,
547,
29901,
13,
1678,
18134,
7833,
5005,
29918,
29963,
4345,
353,
29871,
29946,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
4974,
8207,
4855,
29915,
451,
297,
1153,
384,
1131,
547,
17255,
1445,
1649,
13,
4706,
1583,
3032,
3827,
2290,
353,
29871,
29941,
29946,
29946,
29941,
13,
4706,
1583,
3032,
19496,
2290,
353,
29871,
29941,
29946,
29946,
29946,
13,
4706,
1967,
9170,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
376,
8346,
29889,
3921,
9197,
1159,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
3027,
9170,
29892,
11455,
29918,
12523,
29922,
5574,
29897,
13,
4706,
1583,
3032,
29886,
3150,
353,
1014,
5014,
29889,
29925,
3150,
29898,
13,
9651,
6796,
15360,
613,
376,
20055,
4690,
1164,
10145,
29922,
19602,
376,
4897,
1660,
4986,
29918,
29967,
6992,
29918,
20055,
4690,
1164,
29918,
5813,
5550,
2477,
2890,
29922,
8241,
613,
13,
18884,
376,
4691,
613,
376,
22282,
1131,
547,
29914,
18714,
29914,
3396,
29889,
2272,
613,
13,
18884,
376,
489,
3827,
2290,
16328,
29881,
29908,
1273,
1583,
3032,
3827,
2290,
29892,
13,
18884,
376,
489,
19496,
2290,
16328,
29881,
29908,
1273,
1583,
3032,
19496,
2290,
29892,
13,
18884,
376,
489,
20960,
20163,
9882,
543,
718,
1967,
9170,
29892,
13,
18884,
376,
489,
15550,
3403,
29879,
9882,
543,
718,
1967,
9170,
29892,
13,
18884,
376,
489,
27525,
398,
9219,
29879,
16328,
29881,
29908,
1273,
1583,
29889,
12648,
7833,
5005,
29918,
29963,
4345,
1402,
13,
9651,
3802,
29918,
29888,
6289,
29922,
5574,
29892,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29897,
13,
4706,
1243,
1982,
29889,
10685,
2831,
29911,
6271,
6004,
29898,
877,
7640,
742,
1583,
3032,
3827,
2290,
876,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29945,
29897,
29871,
396,
270,
1983,
8247,
29939,
4225,
304,
367,
2221,
304,
7150,
263,
317,
6259,
29950,
4897,
13,
13,
1678,
822,
2309,
29898,
1311,
1125,
13,
4706,
565,
1583,
3032,
29886,
3150,
29889,
29886,
3028,
580,
338,
451,
6213,
29901,
13,
9651,
12020,
8960,
703,
21287,
390,
547,
4165,
547,
1923,
29185,
1434,
372,
29915,
29879,
931,
1159,
13,
4706,
1014,
5014,
29889,
3198,
29918,
4804,
29898,
3366,
15360,
613,
376,
21174,
613,
851,
29898,
1311,
3032,
29886,
3150,
29889,
5935,
29897,
1402,
3802,
29918,
29888,
6289,
29922,
5574,
29897,
13,
4706,
1583,
3032,
29886,
3150,
29889,
10685,
580,
13,
13,
1678,
822,
1653,
4032,
29898,
1311,
1125,
13,
4706,
2897,
29889,
21813,
1839,
29934,
11375,
1299,
8687,
29968,
29918,
8618,
13044,
1001,
2033,
353,
525,
23981,
597,
7640,
16664,
29881,
29992,
23981,
597,
7640,
16664,
29881,
29915,
1273,
313,
13,
9651,
1583,
3032,
3827,
2290,
29892,
1583,
3032,
19496,
2290,
29897,
13,
4706,
736,
3132,
14399,
29889,
14399,
580,
13,
2
] |
serve/api/predict.py | HalleyYoung/musicautobot | 402 | 13952 | import sys
from . import app
sys.path.append(str(app.config['LIB_PATH']))
from musicautobot.music_transformer import *
from musicautobot.config import *
from flask import Response, send_from_directory, send_file, request, jsonify
from .save import to_s3
import torch
import traceback
torch.set_num_threads(4)
data = load_data(app.config['DATA_PATH'], app.config['DATA_SAVE_NAME'], num_workers=1)
learn = music_model_learner(data, pretrained_path=app.config['MUSIC_MODEL_PATH'])
if torch.cuda.is_available(): learn.model.cuda()
# learn.to_fp16(loss_scale=512) # fp16 not supported for cpu - https://github.com/pytorch/pytorch/issues/17699
@app.route('/predict/midi', methods=['POST'])
def predict_midi():
args = request.form.to_dict()
midi = request.files['midi'].read()
print('THE ARGS PASSED:', args)
bpm = float(args['bpm']) # (AS) TODO: get bpm from midi file instead
temperatures = (float(args.get('noteTemp', 1.2)), float(args.get('durationTemp', 0.8)))
n_words = int(args.get('nSteps', 200))
seed_len = int(args.get('seedLen', 12))
# debugging 1 - send exact midi back
# with open('/tmp/test.mid', 'wb') as f:
# f.write(midi)
# return send_from_directory('/tmp', 'test.mid', mimetype='audio/midi')
# debugging 2 - test music21 conversion
# stream = file2stream(midi) # 1.
# debugging 3 - test npenc conversion
# seed_np = midi2npenc(midi) # music21 can handle bytes directly
# stream = npenc2stream(seed_np, bpm=bpm)
# debugging 4 - midi in, convert, midi out
# stream = file2stream(midi) # 1.
# midi_in = Path(stream.write("musicxml"))
# print('Midi in:', midi_in)
# stream_sep = separate_melody_chord(stream)
# midi_out = Path(stream_sep.write("midi"))
# print('Midi out:', midi_out)
# s3_id = to_s3(midi_out, args)
# result = {
# 'result': s3_id
# }
# return jsonify(result)
# Main logic
try:
full = predict_from_midi(learn, midi=midi, n_words=n_words, seed_len=seed_len, temperatures=temperatures)
stream = separate_melody_chord(full.to_stream(bpm=bpm))
midi_out = Path(stream.write("midi"))
print('Wrote to temporary file:', midi_out)
except Exception as e:
traceback.print_exc()
return jsonify({'error': f'Failed to predict: {e}'})
s3_id = to_s3(midi_out, args)
result = {
'result': s3_id
}
return jsonify(result)
# return send_from_directory(midi_out.parent, midi_out.name, mimetype='audio/midi')
# @app.route('/midi/song/<path:sid>')
# def get_song_midi(sid):
# return send_from_directory(file_path/data_dir, htlist[sid]['midi'], mimetype='audio/midi')
@app.route('/midi/convert', methods=['POST'])
def convert_midi():
args = request.form.to_dict()
if 'midi' in request.files:
midi = request.files['midi'].read()
elif 'midi_path'in args:
midi = args['midi_path']
stream = file2stream(midi) # 1.
# stream = file2stream(midi).chordify() # 1.
stream_out = Path(stream.write('musicxml'))
return send_from_directory(stream_out.parent, stream_out.name, mimetype='xml')
| [
1,
1053,
10876,
13,
3166,
869,
1053,
623,
13,
9675,
29889,
2084,
29889,
4397,
29898,
710,
29898,
932,
29889,
2917,
1839,
5265,
29933,
29918,
10145,
25901,
13,
13,
3166,
27383,
329,
711,
327,
29889,
23596,
29918,
9067,
261,
1053,
334,
13,
3166,
27383,
329,
711,
327,
29889,
2917,
1053,
334,
13,
13,
3166,
29784,
1053,
13291,
29892,
3638,
29918,
3166,
29918,
12322,
29892,
3638,
29918,
1445,
29892,
2009,
29892,
4390,
1598,
13,
3166,
869,
7620,
1053,
304,
29918,
29879,
29941,
13,
13,
5215,
4842,
305,
13,
5215,
9637,
1627,
13,
7345,
305,
29889,
842,
29918,
1949,
29918,
28993,
29898,
29946,
29897,
13,
13,
1272,
353,
2254,
29918,
1272,
29898,
932,
29889,
2917,
1839,
14573,
29918,
10145,
7464,
623,
29889,
2917,
1839,
14573,
29918,
29903,
7520,
29923,
29918,
5813,
7464,
954,
29918,
1287,
414,
29922,
29896,
29897,
13,
19668,
353,
4696,
29918,
4299,
29918,
1945,
1089,
29898,
1272,
29892,
758,
3018,
1312,
29918,
2084,
29922,
932,
29889,
2917,
1839,
29924,
3308,
2965,
29918,
20387,
29931,
29918,
10145,
11287,
13,
13,
361,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
7295,
5110,
29889,
4299,
29889,
29883,
6191,
580,
13,
29937,
5110,
29889,
517,
29918,
18091,
29896,
29953,
29898,
6758,
29918,
7052,
29922,
29945,
29896,
29906,
29897,
396,
285,
29886,
29896,
29953,
451,
6969,
363,
26403,
448,
2045,
597,
3292,
29889,
510,
29914,
2272,
7345,
305,
29914,
2272,
7345,
305,
29914,
12175,
29914,
29896,
29955,
29953,
29929,
29929,
13,
13,
29992,
932,
29889,
13134,
11219,
27711,
29914,
6563,
29875,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
8500,
29918,
6563,
29875,
7295,
13,
1678,
6389,
353,
2009,
29889,
689,
29889,
517,
29918,
8977,
580,
13,
1678,
7145,
29875,
353,
2009,
29889,
5325,
1839,
6563,
29875,
13359,
949,
580,
13,
1678,
1596,
877,
28350,
9033,
10749,
349,
3289,
1660,
29928,
29901,
742,
6389,
29897,
13,
1678,
289,
3358,
353,
5785,
29898,
5085,
1839,
29890,
3358,
11287,
396,
313,
3289,
29897,
14402,
29901,
679,
289,
3358,
515,
7145,
29875,
934,
2012,
13,
1678,
6238,
3698,
353,
313,
7411,
29898,
5085,
29889,
657,
877,
6812,
15637,
742,
29871,
29896,
29889,
29906,
8243,
5785,
29898,
5085,
29889,
657,
877,
19708,
15637,
742,
29871,
29900,
29889,
29947,
4961,
13,
1678,
302,
29918,
9303,
353,
938,
29898,
5085,
29889,
657,
877,
29876,
7789,
567,
742,
29871,
29906,
29900,
29900,
876,
13,
1678,
16717,
29918,
2435,
353,
938,
29898,
5085,
29889,
657,
877,
26776,
21515,
742,
29871,
29896,
29906,
876,
13,
1678,
396,
13490,
29871,
29896,
448,
3638,
2684,
7145,
29875,
1250,
13,
1678,
396,
411,
1722,
11219,
7050,
29914,
1688,
29889,
6563,
742,
525,
29893,
29890,
1495,
408,
285,
29901,
13,
1678,
396,
268,
285,
29889,
3539,
29898,
6563,
29875,
29897,
13,
1678,
396,
736,
3638,
29918,
3166,
29918,
12322,
11219,
7050,
742,
525,
1688,
29889,
6563,
742,
286,
17528,
668,
2433,
18494,
29914,
6563,
29875,
1495,
13,
13,
1678,
396,
13490,
29871,
29906,
448,
1243,
4696,
29906,
29896,
11301,
13,
1678,
396,
4840,
353,
934,
29906,
5461,
29898,
6563,
29875,
29897,
396,
29871,
29896,
29889,
13,
13,
1678,
396,
13490,
29871,
29941,
448,
1243,
302,
2238,
29883,
11301,
13,
1678,
396,
16717,
29918,
9302,
353,
7145,
29875,
29906,
29876,
2238,
29883,
29898,
6563,
29875,
29897,
396,
4696,
29906,
29896,
508,
4386,
6262,
4153,
29871,
13,
1678,
396,
4840,
353,
302,
2238,
29883,
29906,
5461,
29898,
26776,
29918,
9302,
29892,
289,
3358,
29922,
29890,
3358,
29897,
13,
13,
1678,
396,
13490,
29871,
29946,
448,
7145,
29875,
297,
29892,
3588,
29892,
7145,
29875,
714,
13,
1678,
396,
4840,
353,
934,
29906,
5461,
29898,
6563,
29875,
29897,
396,
29871,
29896,
29889,
13,
1678,
396,
7145,
29875,
29918,
262,
353,
10802,
29898,
5461,
29889,
3539,
703,
23596,
3134,
5783,
13,
1678,
396,
1596,
877,
29924,
8819,
297,
29901,
742,
7145,
29875,
29918,
262,
29897,
13,
1678,
396,
4840,
29918,
19570,
353,
5004,
29918,
12873,
1486,
29918,
305,
536,
29898,
5461,
29897,
13,
1678,
396,
7145,
29875,
29918,
449,
353,
10802,
29898,
5461,
29918,
19570,
29889,
3539,
703,
6563,
29875,
5783,
13,
1678,
396,
1596,
877,
29924,
8819,
714,
29901,
742,
7145,
29875,
29918,
449,
29897,
13,
1678,
396,
269,
29941,
29918,
333,
353,
304,
29918,
29879,
29941,
29898,
6563,
29875,
29918,
449,
29892,
6389,
29897,
13,
1678,
396,
1121,
353,
426,
13,
1678,
396,
268,
525,
2914,
2396,
269,
29941,
29918,
333,
13,
1678,
396,
500,
13,
1678,
396,
736,
4390,
1598,
29898,
2914,
29897,
13,
13,
1678,
396,
4241,
5900,
13,
1678,
1018,
29901,
13,
4706,
2989,
353,
8500,
29918,
3166,
29918,
6563,
29875,
29898,
19668,
29892,
7145,
29875,
29922,
6563,
29875,
29892,
302,
29918,
9303,
29922,
29876,
29918,
9303,
29892,
16717,
29918,
2435,
29922,
26776,
29918,
2435,
29892,
6238,
3698,
29922,
12863,
3698,
29897,
13,
4706,
4840,
353,
5004,
29918,
12873,
1486,
29918,
305,
536,
29898,
8159,
29889,
517,
29918,
5461,
29898,
29890,
3358,
29922,
29890,
3358,
876,
13,
4706,
7145,
29875,
29918,
449,
353,
10802,
29898,
5461,
29889,
3539,
703,
6563,
29875,
5783,
13,
4706,
1596,
877,
29956,
4859,
304,
13201,
934,
29901,
742,
7145,
29875,
29918,
449,
29897,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
9637,
1627,
29889,
2158,
29918,
735,
29883,
580,
13,
4706,
736,
4390,
1598,
3319,
29915,
2704,
2396,
285,
29915,
17776,
304,
8500,
29901,
426,
29872,
10162,
1800,
13,
13,
1678,
269,
29941,
29918,
333,
353,
304,
29918,
29879,
29941,
29898,
6563,
29875,
29918,
449,
29892,
6389,
29897,
13,
1678,
1121,
353,
426,
13,
4706,
525,
2914,
2396,
269,
29941,
29918,
333,
13,
1678,
500,
13,
1678,
736,
4390,
1598,
29898,
2914,
29897,
13,
13,
1678,
396,
736,
3638,
29918,
3166,
29918,
12322,
29898,
6563,
29875,
29918,
449,
29889,
3560,
29892,
7145,
29875,
29918,
449,
29889,
978,
29892,
286,
17528,
668,
2433,
18494,
29914,
6563,
29875,
1495,
13,
13,
29937,
732,
932,
29889,
13134,
11219,
6563,
29875,
29914,
21453,
29914,
29966,
2084,
29901,
29879,
333,
29958,
1495,
13,
29937,
822,
679,
29918,
21453,
29918,
6563,
29875,
29898,
29879,
333,
1125,
13,
29937,
268,
736,
3638,
29918,
3166,
29918,
12322,
29898,
1445,
29918,
2084,
29914,
1272,
29918,
3972,
29892,
298,
29873,
1761,
29961,
29879,
333,
22322,
6563,
29875,
7464,
286,
17528,
668,
2433,
18494,
29914,
6563,
29875,
1495,
13,
13,
29992,
932,
29889,
13134,
11219,
6563,
29875,
29914,
13441,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
3588,
29918,
6563,
29875,
7295,
13,
1678,
6389,
353,
2009,
29889,
689,
29889,
517,
29918,
8977,
580,
13,
1678,
565,
525,
6563,
29875,
29915,
297,
2009,
29889,
5325,
29901,
13,
4706,
7145,
29875,
353,
2009,
29889,
5325,
1839,
6563,
29875,
13359,
949,
580,
13,
1678,
25342,
525,
6563,
29875,
29918,
2084,
29915,
262,
6389,
29901,
13,
4706,
7145,
29875,
353,
6389,
1839,
6563,
29875,
29918,
2084,
2033,
13,
13,
1678,
4840,
353,
934,
29906,
5461,
29898,
6563,
29875,
29897,
396,
29871,
29896,
29889,
13,
1678,
396,
4840,
353,
934,
29906,
5461,
29898,
6563,
29875,
467,
305,
536,
1598,
580,
396,
29871,
29896,
29889,
13,
1678,
4840,
29918,
449,
353,
10802,
29898,
5461,
29889,
3539,
877,
23596,
3134,
8785,
13,
1678,
736,
3638,
29918,
3166,
29918,
12322,
29898,
5461,
29918,
449,
29889,
3560,
29892,
4840,
29918,
449,
29889,
978,
29892,
286,
17528,
668,
2433,
3134,
1495,
13,
13,
2
] |
invo/LinearModels/AbsoluteDualityGap.py | rafidrm/invo | 7 | 132305 | <reponame>rafidrm/invo
""" Absolute Duality Gap Inverse Optimization
The absolute duality gap method for inverse optimization minimizes the aggregate
duality gap between the primal and dual objective values for each observed
decision. The problem is formulated as follows
.. math::
\min_{\mathbf{c, y},\epsilon_1, \dots, \epsilon_Q} \quad & \sum_{q=1}^Q | \epsilon_q |
\\text{s.t.}\quad\quad & \mathbf{A'y = c}
& \mathbf{c'\hat{x}_q = b'y} + \epsilon_q, \quad \\forall q
& \| \mathbf{c} \|_1 = 1
& \mathbf{y \geq 0}
"""
import cvxpy as cvx
import numpy as np
#import pudb
from ..utils.invoutils import checkFeasibility, validateFOP
class AbsoluteDualityGap():
""" Formulate an Absolute Duality Gap method of GMIO.
Args:
tol (int): Sets number of significant digits. Default is 8.
verbose (bool): Sets displays. Default is False.
force_feasible_method (bool): If set to True, then will enforce the hyperplane projection method regardless of feasible points. Default is False.
normalize_c: Set to either 1 or np.inf. Decides the normalization constraint on c
ban_constraints (list): A list of constraint indices to force to zero when solving. Default is none.
Example:
Suppose that the variables ``A`` and ``b`` are numpy matrices and ``points`` is
a list of numpy arrays::
model = AbsoluteDualityGap()
model.FOP(A, b)
model.solve(points)
print (model.c)
"""
def __init__(self, **kwargs):
self._fop = False
self._verbose = False
self._solved = False
self.tol = 8
self.solver = cvx.ECOS_BB
self.force_feasible_method = False
self.ban_constraints = []
self.normalize_c = 1
self._kwargs = self._initialize_kwargs(kwargs)
def FOP(self, A, b):
""" Create a forward optimization problem.
Args:
A (matrix): numpy matrix of shape :math:`m \\times n`.
b (matrix): numpy matrix of shape :math:`m \\times 1`.
Currently, the forward problem is constructed by the user supplying a
constraint matrix ``A`` and vector ``b``. The forward problem is
.. math::
\min_{\mathbf{x}} \quad&\mathbf{c'x}
\\text{s.t} \quad&\mathbf{A x \geq b}
"""
#self.A = np.mat(A)
#self.b = np.mat(b)
self.A, self.b = validateFOP(A, b)
self._fop = True
def solve(self, points, **kwargs):
""" Solves the inverse optimization problem.
Args:
points (list): list of numpy arrays, denoting the (optimal) observed points.
Returns:
error (float): the optimal value of the inverse optimization problem.
First check if all of the points are feasible, in which case we can
just project the points to each of the hyperplanes. Let :math:`\\bar{x}`
denote the centroid of the points. Then, we just solve
.. math::
\min_{i \in \mathcal{M}} \left\{ \\frac{\mathbf{a_i'\\bar{x} - }b_i }{\| \mathbf{a_i} \|_1} \\right\}
Let :math:`i^*` denote the optimal index. The optimal cost and dual
variables are
.. math::
\mathbf{c^*} &= \mathbf{\\frac{a_{i^*}}{\|a_{i^*}\|}}
\mathbf{y^*} &= \mathbf{\\frac{e_{i^*}}{\|a_{i^*}\|}}
If not all of the points are feasible, then we need to solve an
exponential number of optimization problems. Let :math:`\mathcal{C}^+, \mathcal{C}^- \subseteq \{ 1, \dots, n \}`
be a partition of the index set of length ``n``. For each possible
partition, we solve the following problem
.. math::
\min_{\mathbf{c, y}, \epsilon_1,\dots,\epsilon_Q} \quad & \sum_{q=1}^Q | \epsilon_q |
\\text{s.t.} \quad & \mathbf{A'y = c}
& \mathbf{c'\hat{x}_q = b'y} + \epsilon_q, \quad \\forall q
& \sum_{i \in \mathcal{C}^+} c_i + \sum_{i \in \mathcal{C}^-} c_i = 1
& c_i \geq 0, \quad i \in \mathcal{C}^+
& c_i \leq 0, \quad i \in \mathcal{C}^-
& \mathbf{y \geq 0}
"""
self._kwargs = self._initialize_kwargs(kwargs)
points = [np.mat(point).T for point in points]
assert self._fop, 'No forward model given.'
feasible = checkFeasibility(points, self.A, self.b, self.tol)
if feasible or self.force_feasible_method:
self.error = self._solveHyperplaneProjection(points)
else:
if self.normalize_c == 1:
self.error = self._solveBruteForceNorm1(points)
elif self.normalize_c == np.inf:
self.error = self._solveBruteForceNormInf(points)
else:
return -1
return self.error
def _solveHyperplaneProjection(self, points):
m, n = self.A.shape
errors = np.zeros(m)
for i in range(m):
if i in self.ban_constraints:
errors[i] = 9999999
else:
ai = self.A[i] / np.linalg.norm(self.A[i].T, self.normalize_c)
bi = self.b[i] / np.linalg.norm(self.A[i].T, self.normalize_c)
errors[i] = np.sum([ai * pt - bi for pt in points])
minInd = np.argmin(errors)
self.c = self.A[minInd] / np.linalg.norm(self.A[minInd].T,
self.normalize_c)
self.c = self.c.tolist()[0]
self.error = errors[minInd]
self.dual = np.zeros(m)
self.dual[minInd] = 1 / np.linalg.norm(self.A[minInd].T,
self.normalize_c)
self._solved = True
return errors[minInd]
def _baseBruteForceProblem(self, y, z, c, points):
obj = cvx.Minimize(sum(z))
cons = []
cons.append(y >= 0)
cons.append(self.A.T * y == c)
for i in range(len(points)):
chi = self.A * points[i] - self.b
cons.append(z[i] >= y.T * chi)
cons.append(z[i] >= -1 * y.T * chi)
for i in self.ban_constraints:
cons.append(y[i] == 0)
return obj, cons
def _solveBruteForceNorm1(self, points):
m, n = self.A.shape
nPoints = len(points)
nFormulations = 2**n
bestResult = np.inf
for formulation in range(nFormulations):
binFormulation = format(formulation, '0{}b'.format(n))
cSign = [int(i) for i in binFormulation]
cSign = np.mat(cSign)
cSign[cSign == 0] = -1
y = cvx.Variable(m)
z = cvx.Variable(nPoints)
c = cvx.Variable(n)
obj, cons = self._baseBruteForceProblem(y, z, c, points)
# add the normalization constraint
cons.append(cSign * c == 1)
for i in range(n):
if cSign[0, i] == 1:
cons.append(c[i] >= 0)
else:
cons.append(c[i] <= 0)
prob = cvx.Problem(obj, cons)
result = prob.solve(solver=self.solver)
if result < bestResult:
bestResult = result
self.c = c.value / np.linalg.norm(c.value, 1)
self.dual = y.value / np.linalg.norm(c.value, 1)
self._solved = True
self.error = bestResult
self.dual = self.dual.T.tolist()[0] # reconvert to just a list
self.c = self.c.T.tolist()[0]
return self.error
def _solveBruteForceNormInf(self, points):
m, n = self.A.shape
nPoints = len(points)
bestResult = np.inf
for j in range(n):
y1 = cvx.Variable(m)
z1 = cvx.Variable(nPoints)
c1 = cvx.Variable(n)
obj1, cons1 = self._baseBruteForceProblem(y1, z1, c1, points)
# Add the normalization constraint
cons1.append(c1 <= 1)
cons1.append(c1 >= -1)
cons1.append(c1[j] == 1)
prob1 = cvx.Problem(obj1, cons1)
result1 = prob1.solve(solver=self.solver)
y2 = cvx.Variable(m)
z2 = cvx.Variable(nPoints)
c2 = cvx.Variable(n)
obj2, cons2 = self._baseBruteForceProblem(y2, z2, c2, points)
# Add the normalization constraint
cons2.append(c2 <= 1)
cons2.append(c2 >= -1)
cons2.append(c2[j] == -1)
prob2 = cvx.Problem(obj2, cons2)
result2 = prob2.solve(solver=self.solver)
optimalReform = np.argmin([result1, result2, bestResult])
if optimalReform == 0:
bestResult = result1
self.c = c1.value / np.linalg.norm(c1.value, np.inf)
self.dual = y1.value / np.linalg.norm(y1.value, np.inf)
elif optimalReform == 1:
bestResult = result2
self.c = c2.value / np.linalg.norm(c2.value, np.inf)
self.dual = y2.value / np.linalg.norm(y2.value, np.inf)
self._solved = True
self.error = bestResult
self.dual = self.dual.T.tolist()[0] # reconvert to just a list
self.c = self.c.T.tolist()[0]
return self.error
def rho(self, points):
""" Solves the goodness of fit.
"""
assert self._solved, 'you need to solve first.'
m, n = self.A.shape
numer = [
np.abs(np.dot(self.c, point) - np.dot(self.dual, self.b))
for point in points
]
numer = sum(numer)
denom = 0
for i in range(m):
denomTerm = [
np.abs(np.dot(self.A[i], point) - self.b[i]) / np.linalg.norm(
self.A[i].T, self.normalize_c) for point in points
]
denom += sum(denomTerm)
rho = 1 - numer / denom
return rho[0, 0]
def _initialize_kwargs(self, kwargs):
if 'verbose' in kwargs:
assert isinstance(kwargs['verbose'],
bool), 'verbose needs to be True or False.'
self._verbose = kwargs['verbose']
if 'tol' in kwargs:
assert isinstance(kwargs['tol'],
int), 'tolerance needs to be an integer.'
self.tol = kwargs['tol']
if 'force_feasible_method' in kwargs:
assert isinstance(
kwargs['force_feasible_method'],
bool), 'force feasible method needs to be True or False.'
self.force_feasible_method = kwargs['force_feasible_method']
if 'ban_constraints' in kwargs:
assert isinstance(kwargs['ban_constraints'],
list), 'ban constraints needs to be a list.'
self.ban_constraints = kwargs['ban_constraints']
if 'normalize_c' in kwargs:
assert kwargs['normalize_c'] == 1 or kwargs['normalize_c'] == np.inf, 'normalize c with 1 or infinity norm.'
self.normalize_c = kwargs['normalize_c']
if 'solver' in kwargs:
if kwargs['solver'] in cvx.installed_solvers():
self.solver = getattr(cvx, kwargs['solver'])
else:
print('you do not have this solver.')
return kwargs
| [
1,
529,
276,
1112,
420,
29958,
1929,
333,
1758,
29914,
262,
1365,
13,
15945,
29908,
1976,
14977,
360,
950,
537,
402,
481,
512,
3901,
20693,
326,
2133,
13,
13,
1576,
8380,
868,
2877,
17261,
1158,
363,
16402,
13883,
6260,
7093,
278,
20431,
13,
700,
2877,
17261,
1546,
278,
1903,
284,
322,
14581,
12091,
1819,
363,
1269,
8900,
13,
7099,
2459,
29889,
450,
1108,
338,
883,
7964,
408,
4477,
13,
13,
636,
5844,
1057,
13,
13,
1678,
320,
1195,
1665,
2762,
29912,
29883,
29892,
343,
7570,
5463,
29918,
29896,
29892,
320,
7778,
29892,
320,
5463,
29918,
29984,
29913,
320,
3425,
29871,
669,
320,
2083,
648,
29939,
29922,
29896,
2137,
29984,
891,
320,
5463,
29918,
29939,
891,
13,
13,
308,
2474,
726,
29912,
29879,
29889,
29873,
29889,
1012,
3425,
29905,
3425,
29871,
669,
320,
2762,
29912,
29909,
29915,
29891,
353,
274,
29913,
13,
13,
308,
669,
320,
2762,
29912,
29883,
12764,
2455,
29912,
29916,
2403,
29939,
353,
289,
29915,
29891,
29913,
718,
320,
5463,
29918,
29939,
29892,
320,
3425,
2474,
10956,
3855,
13,
13,
308,
669,
12926,
320,
2762,
29912,
29883,
29913,
12926,
29918,
29896,
353,
29871,
29896,
13,
13,
308,
669,
320,
2762,
29912,
29891,
320,
6279,
29871,
29900,
29913,
13,
15945,
29908,
13,
5215,
13850,
29916,
2272,
408,
13850,
29916,
13,
5215,
12655,
408,
7442,
13,
29937,
5215,
282,
566,
29890,
13,
13,
3166,
6317,
13239,
29889,
11569,
449,
2719,
1053,
1423,
8263,
294,
4127,
29892,
12725,
29943,
4590,
13,
13,
13,
1990,
1976,
14977,
29928,
950,
537,
29954,
481,
7295,
13,
1678,
9995,
3812,
5987,
385,
1976,
14977,
360,
950,
537,
402,
481,
1158,
310,
402,
29924,
5971,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
304,
29880,
313,
524,
1125,
317,
1691,
1353,
310,
7282,
13340,
29889,
13109,
338,
29871,
29947,
29889,
13,
4706,
26952,
313,
11227,
1125,
317,
1691,
14423,
29889,
29871,
13109,
338,
7700,
29889,
13,
4706,
4889,
29918,
1725,
294,
1821,
29918,
5696,
313,
11227,
1125,
960,
731,
304,
5852,
29892,
769,
674,
427,
10118,
278,
11266,
22116,
18246,
1158,
17126,
310,
28326,
1821,
3291,
29889,
13109,
338,
7700,
29889,
13,
4706,
4226,
675,
29918,
29883,
29901,
3789,
304,
2845,
29871,
29896,
470,
7442,
29889,
7192,
29889,
3826,
2247,
278,
4226,
2133,
7276,
373,
274,
13,
4706,
9892,
29918,
13646,
29879,
313,
1761,
1125,
319,
1051,
310,
7276,
16285,
304,
4889,
304,
5225,
746,
17069,
29889,
13109,
338,
5642,
29889,
13,
13,
1678,
8741,
29901,
13,
4706,
12142,
393,
278,
3651,
4954,
29909,
16159,
322,
4954,
29890,
16159,
526,
12655,
13516,
322,
4954,
9748,
16159,
338,
13,
4706,
263,
1051,
310,
12655,
7049,
1057,
13,
13,
965,
1904,
353,
1976,
14977,
29928,
950,
537,
29954,
481,
580,
13,
965,
1904,
29889,
29943,
4590,
29898,
29909,
29892,
289,
29897,
13,
965,
1904,
29889,
2929,
345,
29898,
9748,
29897,
13,
965,
1596,
313,
4299,
29889,
29883,
29897,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
1583,
3032,
29888,
459,
353,
7700,
13,
4706,
1583,
3032,
369,
15828,
353,
7700,
13,
4706,
1583,
3032,
2929,
1490,
353,
7700,
13,
4706,
1583,
29889,
25027,
353,
29871,
29947,
13,
4706,
1583,
29889,
2929,
369,
353,
13850,
29916,
29889,
29923,
3217,
29903,
29918,
14388,
13,
4706,
1583,
29889,
10118,
29918,
1725,
294,
1821,
29918,
5696,
353,
7700,
13,
4706,
1583,
29889,
2571,
29918,
13646,
29879,
353,
5159,
13,
4706,
1583,
29889,
8945,
675,
29918,
29883,
353,
29871,
29896,
13,
4706,
1583,
3032,
19290,
353,
1583,
3032,
24926,
29918,
19290,
29898,
19290,
29897,
13,
13,
1678,
822,
383,
4590,
29898,
1311,
29892,
319,
29892,
289,
1125,
13,
4706,
9995,
6204,
263,
6375,
13883,
1108,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
319,
313,
5344,
1125,
12655,
4636,
310,
8267,
584,
755,
18078,
29885,
2474,
3706,
302,
1412,
13,
9651,
289,
313,
5344,
1125,
12655,
4636,
310,
8267,
584,
755,
18078,
29885,
2474,
3706,
29871,
29896,
1412,
13,
13,
4706,
15447,
29892,
278,
6375,
1108,
338,
13319,
491,
278,
1404,
1462,
5890,
263,
13,
4706,
7276,
4636,
4954,
29909,
16159,
322,
4608,
4954,
29890,
29952,
1412,
450,
6375,
1108,
338,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
320,
1195,
1665,
2762,
29912,
29916,
930,
320,
3425,
11035,
2762,
29912,
29883,
29915,
29916,
29913,
13,
13,
9651,
2474,
726,
29912,
29879,
29889,
29873,
29913,
320,
3425,
11035,
2762,
29912,
29909,
921,
320,
6279,
289,
29913,
13,
4706,
9995,
13,
4706,
396,
1311,
29889,
29909,
353,
7442,
29889,
2922,
29898,
29909,
29897,
13,
4706,
396,
1311,
29889,
29890,
353,
7442,
29889,
2922,
29898,
29890,
29897,
13,
4706,
1583,
29889,
29909,
29892,
1583,
29889,
29890,
353,
12725,
29943,
4590,
29898,
29909,
29892,
289,
29897,
13,
4706,
1583,
3032,
29888,
459,
353,
5852,
13,
13,
1678,
822,
4505,
29898,
1311,
29892,
3291,
29892,
3579,
19290,
1125,
13,
4706,
9995,
4956,
1960,
278,
16402,
13883,
1108,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
3291,
313,
1761,
1125,
1051,
310,
12655,
7049,
29892,
972,
11427,
278,
313,
3670,
3039,
29897,
8900,
3291,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
1059,
313,
7411,
1125,
278,
14413,
995,
310,
278,
16402,
13883,
1108,
29889,
13,
13,
4706,
3824,
1423,
565,
599,
310,
278,
3291,
526,
28326,
1821,
29892,
297,
607,
1206,
591,
508,
13,
4706,
925,
2060,
278,
3291,
304,
1269,
310,
278,
11266,
9018,
267,
29889,
2803,
584,
755,
18078,
1966,
1646,
29912,
29916,
10114,
13,
4706,
13530,
278,
1644,
1007,
310,
278,
3291,
29889,
1987,
29892,
591,
925,
4505,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
320,
1195,
648,
29875,
320,
262,
320,
1942,
29912,
29924,
930,
320,
1563,
10045,
2474,
1154,
741,
2762,
29912,
29874,
29918,
29875,
29915,
1966,
1646,
29912,
29916,
29913,
448,
500,
29890,
29918,
29875,
500,
741,
29989,
320,
2762,
29912,
29874,
29918,
29875,
29913,
12926,
29918,
29896,
29913,
2474,
1266,
18105,
13,
13,
4706,
2803,
584,
755,
18078,
29875,
6622,
29952,
13530,
278,
14413,
2380,
29889,
450,
14413,
3438,
322,
14581,
13,
4706,
3651,
526,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
320,
2762,
29912,
29883,
29985,
4044,
7878,
320,
2762,
741,
29905,
1154,
29912,
29874,
648,
29875,
6622,
12431,
29989,
29874,
648,
29875,
6622,
1012,
29989,
930,
13,
13,
9651,
320,
2762,
29912,
29891,
29985,
4044,
7878,
320,
2762,
741,
29905,
1154,
29912,
29872,
648,
29875,
6622,
12431,
29989,
29874,
648,
29875,
6622,
1012,
29989,
930,
13,
13,
4706,
960,
451,
599,
310,
278,
3291,
526,
28326,
1821,
29892,
769,
591,
817,
304,
4505,
385,
13,
4706,
25658,
1353,
310,
13883,
4828,
29889,
2803,
584,
755,
18078,
29905,
1942,
29912,
29907,
2137,
29974,
29892,
320,
1942,
29912,
29907,
2137,
29899,
320,
11725,
9991,
29871,
29896,
29892,
320,
7778,
29892,
302,
320,
10114,
13,
4706,
367,
263,
8877,
310,
278,
2380,
731,
310,
3309,
4954,
29876,
29952,
1412,
1152,
1269,
1950,
13,
4706,
8877,
29892,
591,
4505,
278,
1494,
1108,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
320,
1195,
1665,
2762,
29912,
29883,
29892,
343,
1118,
320,
5463,
29918,
29896,
2053,
7778,
2053,
5463,
29918,
29984,
29913,
320,
3425,
29871,
669,
320,
2083,
648,
29939,
29922,
29896,
2137,
29984,
891,
320,
5463,
29918,
29939,
891,
13,
13,
9651,
2474,
726,
29912,
29879,
29889,
29873,
5003,
320,
3425,
29871,
669,
320,
2762,
29912,
29909,
29915,
29891,
353,
274,
29913,
13,
13,
9651,
669,
320,
2762,
29912,
29883,
12764,
2455,
29912,
29916,
2403,
29939,
353,
289,
29915,
29891,
29913,
718,
320,
5463,
29918,
29939,
29892,
320,
3425,
2474,
10956,
3855,
13,
13,
9651,
669,
320,
2083,
648,
29875,
320,
262,
320,
1942,
29912,
29907,
2137,
29974,
29913,
274,
29918,
29875,
718,
320,
2083,
648,
29875,
320,
262,
320,
1942,
29912,
29907,
2137,
27154,
274,
29918,
29875,
353,
29871,
29896,
13,
13,
9651,
669,
274,
29918,
29875,
320,
6279,
29871,
29900,
29892,
320,
3425,
474,
320,
262,
320,
1942,
29912,
29907,
2137,
29974,
13,
13,
9651,
669,
274,
29918,
29875,
320,
3797,
29871,
29900,
29892,
320,
3425,
474,
320,
262,
320,
1942,
29912,
29907,
2137,
29899,
13,
13,
9651,
669,
320,
2762,
29912,
29891,
320,
6279,
29871,
29900,
29913,
13,
4706,
9995,
13,
4706,
1583,
3032,
19290,
353,
1583,
3032,
24926,
29918,
19290,
29898,
19290,
29897,
13,
13,
4706,
3291,
353,
518,
9302,
29889,
2922,
29898,
3149,
467,
29911,
363,
1298,
297,
3291,
29962,
13,
4706,
4974,
1583,
3032,
29888,
459,
29892,
525,
3782,
6375,
1904,
2183,
6169,
13,
4706,
28326,
1821,
353,
1423,
8263,
294,
4127,
29898,
9748,
29892,
1583,
29889,
29909,
29892,
1583,
29889,
29890,
29892,
1583,
29889,
25027,
29897,
13,
4706,
565,
28326,
1821,
470,
1583,
29889,
10118,
29918,
1725,
294,
1821,
29918,
5696,
29901,
13,
9651,
1583,
29889,
2704,
353,
1583,
3032,
2929,
345,
26322,
546,
22116,
1184,
6929,
29898,
9748,
29897,
13,
4706,
1683,
29901,
13,
9651,
565,
1583,
29889,
8945,
675,
29918,
29883,
1275,
29871,
29896,
29901,
13,
18884,
1583,
29889,
2704,
353,
1583,
3032,
2929,
345,
12432,
1082,
2831,
346,
29940,
555,
29896,
29898,
9748,
29897,
13,
9651,
25342,
1583,
29889,
8945,
675,
29918,
29883,
1275,
7442,
29889,
7192,
29901,
13,
18884,
1583,
29889,
2704,
353,
1583,
3032,
2929,
345,
12432,
1082,
2831,
346,
29940,
555,
25433,
29898,
9748,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
448,
29896,
13,
4706,
736,
1583,
29889,
2704,
13,
13,
1678,
822,
903,
2929,
345,
26322,
546,
22116,
1184,
6929,
29898,
1311,
29892,
3291,
1125,
13,
4706,
286,
29892,
302,
353,
1583,
29889,
29909,
29889,
12181,
13,
4706,
4436,
353,
7442,
29889,
3298,
359,
29898,
29885,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29885,
1125,
13,
9651,
565,
474,
297,
1583,
29889,
2571,
29918,
13646,
29879,
29901,
13,
18884,
4436,
29961,
29875,
29962,
353,
29871,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
13,
9651,
1683,
29901,
13,
18884,
7468,
353,
1583,
29889,
29909,
29961,
29875,
29962,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
1311,
29889,
29909,
29961,
29875,
1822,
29911,
29892,
1583,
29889,
8945,
675,
29918,
29883,
29897,
13,
18884,
4768,
353,
1583,
29889,
29890,
29961,
29875,
29962,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
1311,
29889,
29909,
29961,
29875,
1822,
29911,
29892,
1583,
29889,
8945,
675,
29918,
29883,
29897,
13,
18884,
4436,
29961,
29875,
29962,
353,
7442,
29889,
2083,
4197,
1794,
334,
19592,
448,
4768,
363,
19592,
297,
3291,
2314,
13,
4706,
1375,
2568,
353,
7442,
29889,
1191,
1195,
29898,
12523,
29897,
13,
4706,
1583,
29889,
29883,
353,
1583,
29889,
29909,
29961,
1195,
2568,
29962,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
1311,
29889,
29909,
29961,
1195,
2568,
1822,
29911,
29892,
13,
462,
462,
462,
1583,
29889,
8945,
675,
29918,
29883,
29897,
13,
4706,
1583,
29889,
29883,
353,
1583,
29889,
29883,
29889,
25027,
391,
580,
29961,
29900,
29962,
13,
4706,
1583,
29889,
2704,
353,
4436,
29961,
1195,
2568,
29962,
13,
4706,
1583,
29889,
700,
284,
353,
7442,
29889,
3298,
359,
29898,
29885,
29897,
13,
4706,
1583,
29889,
700,
284,
29961,
1195,
2568,
29962,
353,
29871,
29896,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
1311,
29889,
29909,
29961,
1195,
2568,
1822,
29911,
29892,
13,
462,
462,
1669,
1583,
29889,
8945,
675,
29918,
29883,
29897,
13,
4706,
1583,
3032,
2929,
1490,
353,
5852,
13,
4706,
736,
4436,
29961,
1195,
2568,
29962,
13,
13,
1678,
822,
903,
3188,
12432,
1082,
2831,
346,
26604,
29898,
1311,
29892,
343,
29892,
503,
29892,
274,
29892,
3291,
1125,
13,
4706,
5446,
353,
13850,
29916,
29889,
8140,
326,
675,
29898,
2083,
29898,
29920,
876,
13,
4706,
1136,
353,
5159,
13,
4706,
1136,
29889,
4397,
29898,
29891,
6736,
29871,
29900,
29897,
13,
4706,
1136,
29889,
4397,
29898,
1311,
29889,
29909,
29889,
29911,
334,
343,
1275,
274,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
9748,
22164,
13,
9651,
18558,
353,
1583,
29889,
29909,
334,
3291,
29961,
29875,
29962,
448,
1583,
29889,
29890,
13,
9651,
1136,
29889,
4397,
29898,
29920,
29961,
29875,
29962,
6736,
343,
29889,
29911,
334,
18558,
29897,
13,
9651,
1136,
29889,
4397,
29898,
29920,
29961,
29875,
29962,
6736,
448,
29896,
334,
343,
29889,
29911,
334,
18558,
29897,
13,
4706,
363,
474,
297,
1583,
29889,
2571,
29918,
13646,
29879,
29901,
13,
9651,
1136,
29889,
4397,
29898,
29891,
29961,
29875,
29962,
1275,
29871,
29900,
29897,
13,
4706,
736,
5446,
29892,
1136,
13,
13,
1678,
822,
903,
2929,
345,
12432,
1082,
2831,
346,
29940,
555,
29896,
29898,
1311,
29892,
3291,
1125,
13,
4706,
286,
29892,
302,
353,
1583,
29889,
29909,
29889,
12181,
13,
4706,
302,
20325,
353,
7431,
29898,
9748,
29897,
13,
4706,
302,
2500,
8250,
353,
29871,
29906,
1068,
29876,
13,
4706,
1900,
3591,
353,
7442,
29889,
7192,
13,
13,
4706,
363,
883,
2785,
297,
3464,
29898,
29876,
2500,
8250,
1125,
13,
9651,
9016,
2500,
2785,
353,
3402,
29898,
689,
2785,
29892,
525,
29900,
8875,
29890,
4286,
4830,
29898,
29876,
876,
13,
9651,
274,
10140,
353,
518,
524,
29898,
29875,
29897,
363,
474,
297,
9016,
2500,
2785,
29962,
13,
9651,
274,
10140,
353,
7442,
29889,
2922,
29898,
29883,
10140,
29897,
13,
9651,
274,
10140,
29961,
29883,
10140,
1275,
29871,
29900,
29962,
353,
448,
29896,
13,
13,
9651,
343,
353,
13850,
29916,
29889,
16174,
29898,
29885,
29897,
13,
9651,
503,
353,
13850,
29916,
29889,
16174,
29898,
29876,
20325,
29897,
13,
9651,
274,
353,
13850,
29916,
29889,
16174,
29898,
29876,
29897,
13,
13,
9651,
5446,
29892,
1136,
353,
1583,
3032,
3188,
12432,
1082,
2831,
346,
26604,
29898,
29891,
29892,
503,
29892,
274,
29892,
3291,
29897,
13,
13,
9651,
396,
788,
278,
4226,
2133,
7276,
13,
9651,
1136,
29889,
4397,
29898,
29883,
10140,
334,
274,
1275,
29871,
29896,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
18884,
565,
274,
10140,
29961,
29900,
29892,
474,
29962,
1275,
29871,
29896,
29901,
13,
462,
1678,
1136,
29889,
4397,
29898,
29883,
29961,
29875,
29962,
6736,
29871,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
1136,
29889,
4397,
29898,
29883,
29961,
29875,
29962,
5277,
29871,
29900,
29897,
13,
13,
9651,
2070,
353,
13850,
29916,
29889,
26604,
29898,
5415,
29892,
1136,
29897,
13,
9651,
1121,
353,
2070,
29889,
2929,
345,
29898,
2929,
369,
29922,
1311,
29889,
2929,
369,
29897,
13,
13,
9651,
565,
1121,
529,
1900,
3591,
29901,
13,
18884,
1900,
3591,
353,
1121,
13,
18884,
1583,
29889,
29883,
353,
274,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29883,
29889,
1767,
29892,
29871,
29896,
29897,
13,
18884,
1583,
29889,
700,
284,
353,
343,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29883,
29889,
1767,
29892,
29871,
29896,
29897,
13,
4706,
1583,
3032,
2929,
1490,
353,
5852,
13,
4706,
1583,
29889,
2704,
353,
1900,
3591,
13,
4706,
1583,
29889,
700,
284,
353,
1583,
29889,
700,
284,
29889,
29911,
29889,
25027,
391,
580,
29961,
29900,
29962,
29871,
396,
8265,
1765,
304,
925,
263,
1051,
13,
4706,
1583,
29889,
29883,
353,
1583,
29889,
29883,
29889,
29911,
29889,
25027,
391,
580,
29961,
29900,
29962,
13,
4706,
736,
1583,
29889,
2704,
13,
13,
1678,
822,
903,
2929,
345,
12432,
1082,
2831,
346,
29940,
555,
25433,
29898,
1311,
29892,
3291,
1125,
13,
4706,
286,
29892,
302,
353,
1583,
29889,
29909,
29889,
12181,
13,
4706,
302,
20325,
353,
7431,
29898,
9748,
29897,
13,
4706,
1900,
3591,
353,
7442,
29889,
7192,
13,
13,
4706,
363,
432,
297,
3464,
29898,
29876,
1125,
13,
9651,
343,
29896,
353,
13850,
29916,
29889,
16174,
29898,
29885,
29897,
13,
9651,
503,
29896,
353,
13850,
29916,
29889,
16174,
29898,
29876,
20325,
29897,
13,
9651,
274,
29896,
353,
13850,
29916,
29889,
16174,
29898,
29876,
29897,
13,
13,
9651,
5446,
29896,
29892,
1136,
29896,
353,
1583,
3032,
3188,
12432,
1082,
2831,
346,
26604,
29898,
29891,
29896,
29892,
503,
29896,
29892,
274,
29896,
29892,
3291,
29897,
13,
13,
9651,
396,
3462,
278,
4226,
2133,
7276,
13,
9651,
1136,
29896,
29889,
4397,
29898,
29883,
29896,
5277,
29871,
29896,
29897,
13,
9651,
1136,
29896,
29889,
4397,
29898,
29883,
29896,
6736,
448,
29896,
29897,
13,
9651,
1136,
29896,
29889,
4397,
29898,
29883,
29896,
29961,
29926,
29962,
1275,
29871,
29896,
29897,
13,
13,
9651,
2070,
29896,
353,
13850,
29916,
29889,
26604,
29898,
5415,
29896,
29892,
1136,
29896,
29897,
13,
9651,
1121,
29896,
353,
2070,
29896,
29889,
2929,
345,
29898,
2929,
369,
29922,
1311,
29889,
2929,
369,
29897,
13,
13,
9651,
343,
29906,
353,
13850,
29916,
29889,
16174,
29898,
29885,
29897,
13,
9651,
503,
29906,
353,
13850,
29916,
29889,
16174,
29898,
29876,
20325,
29897,
13,
9651,
274,
29906,
353,
13850,
29916,
29889,
16174,
29898,
29876,
29897,
13,
13,
9651,
5446,
29906,
29892,
1136,
29906,
353,
1583,
3032,
3188,
12432,
1082,
2831,
346,
26604,
29898,
29891,
29906,
29892,
503,
29906,
29892,
274,
29906,
29892,
3291,
29897,
13,
13,
9651,
396,
3462,
278,
4226,
2133,
7276,
13,
9651,
1136,
29906,
29889,
4397,
29898,
29883,
29906,
5277,
29871,
29896,
29897,
13,
9651,
1136,
29906,
29889,
4397,
29898,
29883,
29906,
6736,
448,
29896,
29897,
13,
9651,
1136,
29906,
29889,
4397,
29898,
29883,
29906,
29961,
29926,
29962,
1275,
448,
29896,
29897,
13,
13,
9651,
2070,
29906,
353,
13850,
29916,
29889,
26604,
29898,
5415,
29906,
29892,
1136,
29906,
29897,
13,
9651,
1121,
29906,
353,
2070,
29906,
29889,
2929,
345,
29898,
2929,
369,
29922,
1311,
29889,
2929,
369,
29897,
13,
13,
9651,
14413,
1123,
689,
353,
7442,
29889,
1191,
1195,
4197,
2914,
29896,
29892,
1121,
29906,
29892,
1900,
3591,
2314,
13,
9651,
565,
14413,
1123,
689,
1275,
29871,
29900,
29901,
13,
18884,
1900,
3591,
353,
1121,
29896,
13,
18884,
1583,
29889,
29883,
353,
274,
29896,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29883,
29896,
29889,
1767,
29892,
7442,
29889,
7192,
29897,
13,
18884,
1583,
29889,
700,
284,
353,
343,
29896,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29891,
29896,
29889,
1767,
29892,
7442,
29889,
7192,
29897,
13,
9651,
25342,
14413,
1123,
689,
1275,
29871,
29896,
29901,
13,
18884,
1900,
3591,
353,
1121,
29906,
13,
18884,
1583,
29889,
29883,
353,
274,
29906,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29883,
29906,
29889,
1767,
29892,
7442,
29889,
7192,
29897,
13,
18884,
1583,
29889,
700,
284,
353,
343,
29906,
29889,
1767,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29891,
29906,
29889,
1767,
29892,
7442,
29889,
7192,
29897,
13,
13,
4706,
1583,
3032,
2929,
1490,
353,
5852,
13,
4706,
1583,
29889,
2704,
353,
1900,
3591,
13,
4706,
1583,
29889,
700,
284,
353,
1583,
29889,
700,
284,
29889,
29911,
29889,
25027,
391,
580,
29961,
29900,
29962,
29871,
396,
8265,
1765,
304,
925,
263,
1051,
13,
4706,
1583,
29889,
29883,
353,
1583,
29889,
29883,
29889,
29911,
29889,
25027,
391,
580,
29961,
29900,
29962,
13,
4706,
736,
1583,
29889,
2704,
13,
13,
1678,
822,
364,
1251,
29898,
1311,
29892,
3291,
1125,
13,
4706,
9995,
4956,
1960,
278,
1781,
2264,
310,
6216,
29889,
13,
4706,
9995,
13,
4706,
4974,
1583,
3032,
2929,
1490,
29892,
525,
6293,
817,
304,
4505,
937,
6169,
13,
13,
4706,
286,
29892,
302,
353,
1583,
29889,
29909,
29889,
12181,
13,
4706,
4825,
353,
518,
13,
9651,
7442,
29889,
6897,
29898,
9302,
29889,
6333,
29898,
1311,
29889,
29883,
29892,
1298,
29897,
448,
7442,
29889,
6333,
29898,
1311,
29889,
700,
284,
29892,
1583,
29889,
29890,
876,
13,
9651,
363,
1298,
297,
3291,
13,
4706,
4514,
13,
4706,
4825,
353,
2533,
29898,
8058,
29897,
13,
4706,
972,
290,
353,
29871,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
29885,
1125,
13,
9651,
972,
290,
14343,
353,
518,
13,
18884,
7442,
29889,
6897,
29898,
9302,
29889,
6333,
29898,
1311,
29889,
29909,
29961,
29875,
1402,
1298,
29897,
448,
1583,
29889,
29890,
29961,
29875,
2314,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
13,
462,
1678,
1583,
29889,
29909,
29961,
29875,
1822,
29911,
29892,
1583,
29889,
8945,
675,
29918,
29883,
29897,
363,
1298,
297,
3291,
13,
9651,
4514,
13,
9651,
972,
290,
4619,
2533,
29898,
1145,
290,
14343,
29897,
13,
4706,
364,
1251,
353,
29871,
29896,
448,
4825,
847,
972,
290,
13,
4706,
736,
364,
1251,
29961,
29900,
29892,
29871,
29900,
29962,
13,
13,
1678,
822,
903,
24926,
29918,
19290,
29898,
1311,
29892,
9049,
5085,
1125,
13,
4706,
565,
525,
369,
15828,
29915,
297,
9049,
5085,
29901,
13,
9651,
4974,
338,
8758,
29898,
19290,
1839,
369,
15828,
7464,
13,
462,
795,
6120,
511,
525,
369,
15828,
4225,
304,
367,
5852,
470,
7700,
6169,
13,
9651,
1583,
3032,
369,
15828,
353,
9049,
5085,
1839,
369,
15828,
2033,
13,
13,
4706,
565,
525,
25027,
29915,
297,
9049,
5085,
29901,
13,
9651,
4974,
338,
8758,
29898,
19290,
1839,
25027,
7464,
13,
462,
795,
938,
511,
525,
25027,
261,
749,
4225,
304,
367,
385,
6043,
6169,
13,
9651,
1583,
29889,
25027,
353,
9049,
5085,
1839,
25027,
2033,
13,
13,
4706,
565,
525,
10118,
29918,
1725,
294,
1821,
29918,
5696,
29915,
297,
9049,
5085,
29901,
13,
9651,
4974,
338,
8758,
29898,
13,
18884,
9049,
5085,
1839,
10118,
29918,
1725,
294,
1821,
29918,
5696,
7464,
13,
18884,
6120,
511,
525,
10118,
28326,
1821,
1158,
4225,
304,
367,
5852,
470,
7700,
6169,
13,
9651,
1583,
29889,
10118,
29918,
1725,
294,
1821,
29918,
5696,
353,
9049,
5085,
1839,
10118,
29918,
1725,
294,
1821,
29918,
5696,
2033,
13,
13,
4706,
565,
525,
2571,
29918,
13646,
29879,
29915,
297,
9049,
5085,
29901,
13,
9651,
4974,
338,
8758,
29898,
19290,
1839,
2571,
29918,
13646,
29879,
7464,
13,
462,
795,
1051,
511,
525,
2571,
11938,
4225,
304,
367,
263,
1051,
6169,
13,
9651,
1583,
29889,
2571,
29918,
13646,
29879,
353,
9049,
5085,
1839,
2571,
29918,
13646,
29879,
2033,
13,
13,
4706,
565,
525,
8945,
675,
29918,
29883,
29915,
297,
9049,
5085,
29901,
13,
9651,
4974,
9049,
5085,
1839,
8945,
675,
29918,
29883,
2033,
1275,
29871,
29896,
470,
9049,
5085,
1839,
8945,
675,
29918,
29883,
2033,
1275,
7442,
29889,
7192,
29892,
525,
8945,
675,
274,
411,
29871,
29896,
470,
27971,
6056,
6169,
13,
9651,
1583,
29889,
8945,
675,
29918,
29883,
353,
9049,
5085,
1839,
8945,
675,
29918,
29883,
2033,
13,
13,
4706,
565,
525,
2929,
369,
29915,
297,
9049,
5085,
29901,
13,
9651,
565,
9049,
5085,
1839,
2929,
369,
2033,
297,
13850,
29916,
29889,
25537,
29918,
2929,
874,
7295,
13,
18884,
1583,
29889,
2929,
369,
353,
679,
5552,
29898,
11023,
29916,
29892,
9049,
5085,
1839,
2929,
369,
11287,
13,
9651,
1683,
29901,
13,
18884,
1596,
877,
6293,
437,
451,
505,
445,
899,
369,
29889,
1495,
13,
13,
4706,
736,
9049,
5085,
13,
2
] |
helpers.py | old-school-vienna/predict-future-sales-py | 0 | 164133 | <reponame>old-school-vienna/predict-future-sales-py<gh_stars>0
import os
import typing
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import List, Dict
import numpy as np
import pandas as pd
import tensorflow.python.keras as keras
import tensorflow.python.keras.layers as kerasl
from sklearn.preprocessing import MinMaxScaler
@dataclass
class Trainset:
id: str
x: np.array
y: np.array
y_min_max_scaler: MinMaxScaler
def pivot(df: pd.DataFrame, grp_vars: List[str], col: str, val: str) -> pd.DataFrame:
grpd = df.groupby(grp_vars).first()
return grpd.pivot_table(index=grp_vars, columns=col, values=val, fill_value=0.0)
def dd() -> Path:
datadir = os.getenv("DATADIR")
if datadir is None:
raise RuntimeError("Environment variable DATADIR not defined")
datadir_path = Path(datadir)
if not datadir_path.exists():
raise RuntimeError(f"Directory {datadir_path} does not exist")
return datadir_path
_dt_start: datetime.date = datetime.strptime("1.1.2013", '%d.%m.%Y').date()
def to_ds(date: str) -> int:
dt: datetime.date = datetime.strptime(date, '%d.%m.%Y').date()
diff = dt - _dt_start
return diff.days
def read_train_fillna() -> pd.DataFrame:
file_name = dd() / 'in' / "df_train.csv"
df_train = pd.read_csv(file_name)
return df_train.fillna(value=0.0)
# noinspection PyTypeChecker
def category_dict() -> Dict[int, int]:
file_name = dd() / 'in' / "items.csv"
df = pd.read_csv(file_name)
df = df[['item_id', 'item_category_id']]
return pd.Series(df.item_category_id.values, index=df.item_id).to_dict()
@dataclass
class LayerConfig:
size_relative: float
@dataclass
class ModelConfig:
activation: str
optimizer: str
loss: str
layers: typing.List[LayerConfig]
def create_model(model_config: ModelConfig, input_size: int):
model = keras.Sequential()
model.add(kerasl.Dense(input_size, activation=model_config.activation))
for layer in model_config.layers:
model.add(kerasl.Dense(int(layer.size_relative * input_size), activation=model_config.activation))
model.add(kerasl.Dense(1))
model.compile(optimizer=model_config.optimizer, loss=model_config.loss)
return model
| [
1,
529,
276,
1112,
420,
29958,
1025,
29899,
27041,
29899,
29894,
819,
1056,
29914,
27711,
29899,
29888,
9130,
29899,
29879,
2122,
29899,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2897,
13,
5215,
19229,
13,
3166,
848,
13203,
1053,
848,
1990,
13,
3166,
12865,
1053,
12865,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
2391,
29892,
360,
919,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
26110,
29889,
4691,
29889,
3946,
294,
408,
13023,
294,
13,
5215,
26110,
29889,
4691,
29889,
3946,
294,
29889,
29277,
408,
13023,
294,
29880,
13,
3166,
2071,
19668,
29889,
1457,
19170,
1053,
3080,
7976,
29636,
261,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
28186,
842,
29901,
13,
1678,
1178,
29901,
851,
13,
1678,
921,
29901,
7442,
29889,
2378,
13,
1678,
343,
29901,
7442,
29889,
2378,
13,
1678,
343,
29918,
1195,
29918,
3317,
29918,
19529,
261,
29901,
3080,
7976,
29636,
261,
13,
13,
13,
1753,
24438,
29898,
2176,
29901,
10518,
29889,
17271,
29892,
867,
29886,
29918,
16908,
29901,
2391,
29961,
710,
1402,
784,
29901,
851,
29892,
659,
29901,
851,
29897,
1599,
10518,
29889,
17271,
29901,
13,
1678,
867,
15926,
353,
4489,
29889,
27789,
29898,
629,
29886,
29918,
16908,
467,
4102,
580,
13,
1678,
736,
867,
15926,
29889,
29886,
11002,
29918,
2371,
29898,
2248,
29922,
629,
29886,
29918,
16908,
29892,
4341,
29922,
1054,
29892,
1819,
29922,
791,
29892,
5445,
29918,
1767,
29922,
29900,
29889,
29900,
29897,
13,
13,
13,
1753,
24488,
580,
1599,
10802,
29901,
13,
1678,
1418,
328,
381,
353,
2897,
29889,
657,
6272,
703,
25832,
3035,
8193,
1159,
13,
1678,
565,
1418,
328,
381,
338,
6213,
29901,
13,
4706,
12020,
24875,
2392,
703,
18649,
2286,
27640,
3035,
8193,
451,
3342,
1159,
13,
1678,
1418,
328,
381,
29918,
2084,
353,
10802,
29898,
4130,
328,
381,
29897,
13,
1678,
565,
451,
1418,
328,
381,
29918,
2084,
29889,
9933,
7295,
13,
4706,
12020,
24875,
2392,
29898,
29888,
29908,
9882,
426,
4130,
328,
381,
29918,
2084,
29913,
947,
451,
1863,
1159,
13,
1678,
736,
1418,
328,
381,
29918,
2084,
13,
13,
13,
29918,
6008,
29918,
2962,
29901,
12865,
29889,
1256,
353,
12865,
29889,
710,
415,
603,
703,
29896,
29889,
29896,
29889,
29906,
29900,
29896,
29941,
613,
14210,
29881,
29889,
29995,
29885,
29889,
29995,
29979,
2824,
1256,
580,
13,
13,
13,
1753,
304,
29918,
6289,
29898,
1256,
29901,
851,
29897,
1599,
938,
29901,
13,
1678,
11636,
29901,
12865,
29889,
1256,
353,
12865,
29889,
710,
415,
603,
29898,
1256,
29892,
14210,
29881,
29889,
29995,
29885,
29889,
29995,
29979,
2824,
1256,
580,
13,
1678,
2923,
353,
11636,
448,
903,
6008,
29918,
2962,
13,
1678,
736,
2923,
29889,
16700,
13,
13,
13,
1753,
1303,
29918,
14968,
29918,
5589,
1056,
580,
1599,
10518,
29889,
17271,
29901,
13,
1678,
934,
29918,
978,
353,
24488,
580,
847,
525,
262,
29915,
847,
376,
2176,
29918,
14968,
29889,
7638,
29908,
13,
1678,
4489,
29918,
14968,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
978,
29897,
13,
1678,
736,
4489,
29918,
14968,
29889,
5589,
1056,
29898,
1767,
29922,
29900,
29889,
29900,
29897,
13,
13,
13,
29937,
694,
1144,
27988,
10772,
1542,
5596,
261,
13,
1753,
7663,
29918,
8977,
580,
1599,
360,
919,
29961,
524,
29892,
938,
5387,
13,
1678,
934,
29918,
978,
353,
24488,
580,
847,
525,
262,
29915,
847,
376,
7076,
29889,
7638,
29908,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
978,
29897,
13,
1678,
4489,
353,
4489,
29961,
1839,
667,
29918,
333,
742,
525,
667,
29918,
7320,
29918,
333,
2033,
29962,
13,
1678,
736,
10518,
29889,
19204,
29898,
2176,
29889,
667,
29918,
7320,
29918,
333,
29889,
5975,
29892,
2380,
29922,
2176,
29889,
667,
29918,
333,
467,
517,
29918,
8977,
580,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
365,
2747,
3991,
29901,
13,
1678,
2159,
29918,
22925,
29901,
5785,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
8125,
3991,
29901,
13,
1678,
26229,
29901,
851,
13,
1678,
5994,
3950,
29901,
851,
13,
1678,
6410,
29901,
851,
13,
1678,
15359,
29901,
19229,
29889,
1293,
29961,
14420,
3991,
29962,
13,
13,
13,
1753,
1653,
29918,
4299,
29898,
4299,
29918,
2917,
29901,
8125,
3991,
29892,
1881,
29918,
2311,
29901,
938,
1125,
13,
1678,
1904,
353,
13023,
294,
29889,
16941,
2556,
580,
13,
1678,
1904,
29889,
1202,
29898,
3946,
294,
29880,
29889,
29928,
1947,
29898,
2080,
29918,
2311,
29892,
26229,
29922,
4299,
29918,
2917,
29889,
11236,
362,
876,
13,
1678,
363,
7546,
297,
1904,
29918,
2917,
29889,
29277,
29901,
13,
4706,
1904,
29889,
1202,
29898,
3946,
294,
29880,
29889,
29928,
1947,
29898,
524,
29898,
13148,
29889,
2311,
29918,
22925,
334,
1881,
29918,
2311,
511,
26229,
29922,
4299,
29918,
2917,
29889,
11236,
362,
876,
13,
1678,
1904,
29889,
1202,
29898,
3946,
294,
29880,
29889,
29928,
1947,
29898,
29896,
876,
13,
1678,
1904,
29889,
12198,
29898,
20640,
3950,
29922,
4299,
29918,
2917,
29889,
20640,
3950,
29892,
6410,
29922,
4299,
29918,
2917,
29889,
6758,
29897,
13,
1678,
736,
1904,
13,
2
] |
setup.py | zhanglabtools/CIRCLET | 1 | 103936 | # -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import os
import sys
import shutil
from subprocess import call
from warnings import warn
from setuptools import setup
setup(name='CIRCLET',
version='1.0',
package_dir={'': 'src'},
packages=['CIRCLET'],
package_data={
# And include any *.msg files found in the 'hello' package, too:
'CIRCLET': ['DATA/*','*.txt','DATA/RNA-seq/*','DATA/Hi-Cmaps/*','DATA/Nagano et al/*'],
},
include_package_data=True
)
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
15945,
19451,
13,
29992,
8921,
29901,
529,
5813,
3238,
13,
15945,
19451,
13,
30004,
13,
5215,
2897,
30004,
13,
5215,
10876,
30004,
13,
5215,
528,
4422,
30004,
13,
3166,
1014,
5014,
1053,
1246,
30004,
13,
3166,
18116,
1053,
29383,
30004,
13,
3166,
731,
21245,
8789,
1053,
6230,
30004,
13,
30004,
13,
14669,
29898,
978,
2433,
29907,
8193,
29907,
1307,
29911,
23592,
13,
3259,
2433,
29896,
29889,
29900,
23592,
13,
5113,
29918,
3972,
3790,
29915,
2396,
525,
4351,
16675,
30004,
13,
8318,
29922,
1839,
29907,
8193,
29907,
1307,
29911,
7464,
30004,
13,
5113,
29918,
1272,
3790,
30004,
13,
4706,
396,
1126,
3160,
738,
20611,
7645,
2066,
1476,
297,
278,
525,
12199,
29915,
3577,
29892,
2086,
29901,
30004,
13,
4706,
525,
29907,
8193,
29907,
1307,
29911,
2396,
6024,
14573,
5515,
3788,
10521,
3945,
3788,
14573,
29914,
29934,
3521,
29899,
11762,
5515,
3788,
14573,
29914,
18567,
29899,
29907,
10339,
5515,
3788,
14573,
29914,
29940,
351,
1562,
634,
394,
5515,
7464,
30004,
13,
1678,
2981,
30004,
13,
30004,
13,
2856,
29918,
5113,
29918,
1272,
29922,
5574,
30004,
13,
8443,
13,
30004,
13,
2
] |
Robofont-scripts/select/unsel Alternates.py | casasin/RobofontTools | 5 | 75654 | # unselectGlyphsWithExtension.py
f = CurrentFont()
for gname in f.selection:
if '.' in gname:
f[gname].selected = 0
| [
1,
396,
443,
2622,
29954,
27026,
29879,
3047,
17657,
29889,
2272,
13,
13,
29888,
353,
9626,
9824,
580,
13,
13,
1454,
330,
978,
297,
285,
29889,
21731,
29901,
13,
1678,
565,
525,
6169,
297,
330,
978,
29901,
13,
4706,
285,
29961,
29887,
978,
1822,
8391,
353,
29871,
29900,
13,
2
] |
get_data/get_tencent_data.py | blueberry686868/crawler_code | 0 | 168177 | import requests
import json
import time
# 获取腾讯疫情数据
def get_tencent_data():
"""
:return: 返回历史数据和当日详细数据
"""
url = 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5'
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36'
}
r = requests.get(url, headers)
# 把json格式转换成字典
res = json.loads(r.text)
# 字典中有4个key,分别是lastUpdateTime, chinaTotal, chinaAdd, areaTree
data_all = json.loads(res['data'])
# 取出data_all中的areaTree这个key值,areaTree是一个列表,里面只有一个字典,索引0取出字典,得到省份数据
# 字典里面的key值为name(中国),today(全国今日新增),total(总计,包括现有确诊,已确诊,疑似,死亡...),children(省级数据)
china_data = data_all['areaTree'][0]
# china_data中key值为children为省级数据,china_data['children']是一个列表(每一个省份是一个字典)
province_data = china_data['children']
# 循环遍历出每个省份的数据
# for province in province_data:
# print(province)
# 爬取历史数据
history_url = 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_other&callback=jQuery34107549579501076509_1596161763386&_=1596161763387'
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36'
}
history_res = requests.get(history_url, headers)
# 把字符串转换成字典
history_response_data = json.loads(history_res.text.replace('jQuery34107549579501076509_1596161763386(', '')[:-1])
# 获取字典中的data
history_response = history_response_data.get('data')
# 需要把response转换成字典,chinaDayList全国历史数据,是一个列表,每个元素就是一天的数据
# chinaDayAddList历史新增数据
history_data_all = json.loads(history_response)
history = {} # 历史数据
for i in history_data_all['chinaDayList']:
ds = "2020." + i['date']
# time.strptime是将字符串格式化成元组
tup = time.strptime(ds, "%Y.%m.%d")
# time.strftime改变时间格式
ds = time.strftime("%Y-%m-%d", tup)
confirm = i['confirm']
suspect = i['suspect']
heal = i['heal']
dead = i['dead']
history[ds] = {'confirm': confirm, 'suspect': suspect, 'heal': heal, 'dead': dead}
for i in history_data_all['chinaDayAddList']:
ds = '2020.' + i['date']
tup = time.strptime(ds, "%Y.%m.%d")
ds = time.strftime("%Y-%m-%d", tup)
confirm = i['confirm']
suspect = i['suspect']
heal = i['heal']
dead = i['dead']
history[ds].update({'confirm_add': confirm, 'suspect_add': suspect, 'heal_add': heal, 'dead_add': dead})
detail = [] # 当日详细数据
update_time = data_all['lastUpdateTime']
data_province = province_data # 中国各省
for pro_infos in data_province:
province = pro_infos['name']
for city_infos in pro_infos['children']:
city = city_infos['name']
confirm = city_infos['total']['confirm']
confirm_now = city_infos['total']['nowConfirm']
confirm_add = city_infos['today']['confirm']
heal = city_infos['total']['heal']
dead = city_infos['total']['dead']
detail.append([update_time, province, city, confirm, confirm_now, confirm_add, heal, dead])
return history, detail
if __name__ == '__main__':
history, details = get_tencent_data()
print(history)
print(details) | [
1,
1053,
7274,
13,
5215,
4390,
13,
5215,
931,
13,
13,
13,
29937,
29871,
31024,
30683,
235,
136,
193,
235,
177,
178,
234,
153,
174,
30993,
30354,
30763,
13,
1753,
679,
29918,
841,
1760,
29918,
1272,
7295,
13,
1678,
9995,
13,
13,
1678,
584,
2457,
29901,
29871,
31086,
30742,
232,
145,
137,
30911,
30354,
30763,
30503,
30948,
30325,
235,
178,
169,
234,
190,
137,
30354,
30763,
13,
1678,
9995,
13,
1678,
3142,
353,
525,
991,
597,
1493,
29889,
457,
5652,
29889,
24349,
29889,
510,
29914,
29887,
29906,
29914,
657,
29949,
1983,
3401,
29973,
978,
29922,
29881,
895,
559,
29918,
29882,
29945,
29915,
13,
13,
1678,
9066,
353,
426,
13,
4706,
525,
1792,
29899,
14748,
2396,
525,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
399,
9806,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
10228,
29914,
29947,
29946,
29889,
29900,
29889,
29946,
29896,
29946,
29955,
29889,
29896,
29900,
29945,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
29915,
13,
1678,
500,
13,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
2271,
29892,
9066,
29897,
13,
13,
1678,
396,
29871,
233,
141,
141,
3126,
31168,
30607,
31415,
31640,
30494,
30578,
31259,
13,
1678,
620,
353,
4390,
29889,
18132,
29898,
29878,
29889,
726,
29897,
13,
13,
1678,
396,
29871,
30578,
31259,
30275,
30417,
29946,
30502,
1989,
30214,
30748,
232,
139,
174,
30392,
4230,
6422,
2481,
29892,
521,
1099,
11536,
29892,
521,
1099,
2528,
29892,
4038,
9643,
13,
1678,
848,
29918,
497,
353,
4390,
29889,
18132,
29898,
690,
1839,
1272,
11287,
13,
13,
1678,
396,
29871,
30683,
30544,
1272,
29918,
497,
30275,
30210,
6203,
9643,
30810,
30502,
1989,
30959,
29892,
6203,
9643,
30392,
30287,
30502,
31025,
30746,
30214,
30755,
30806,
31557,
30417,
30287,
30502,
30578,
31259,
30214,
31836,
31674,
29900,
30683,
30544,
30578,
31259,
30214,
31050,
30780,
31600,
231,
190,
192,
30354,
30763,
13,
1678,
396,
29871,
30578,
31259,
30755,
30806,
30210,
1989,
30959,
30573,
978,
29898,
30275,
30356,
511,
27765,
29898,
30753,
30356,
31482,
30325,
30374,
232,
165,
161,
511,
7827,
29898,
233,
131,
190,
31466,
29892,
31473,
233,
142,
175,
31424,
30417,
31835,
235,
178,
141,
29892,
31290,
31835,
235,
178,
141,
29892,
234,
153,
148,
231,
191,
191,
29892,
31580,
231,
189,
164,
856,
511,
11991,
29898,
31600,
234,
189,
170,
30354,
30763,
29897,
13,
1678,
521,
1099,
29918,
1272,
353,
848,
29918,
497,
1839,
6203,
9643,
2033,
29961,
29900,
29962,
13,
13,
1678,
396,
521,
1099,
29918,
1272,
30275,
1989,
30959,
30573,
11991,
30573,
31600,
234,
189,
170,
30354,
30763,
30214,
305,
1099,
29918,
1272,
1839,
11991,
2033,
30392,
30287,
30502,
31025,
30746,
29898,
31951,
30287,
30502,
31600,
231,
190,
192,
30392,
30287,
30502,
30578,
31259,
29897,
13,
1678,
12291,
29918,
1272,
353,
521,
1099,
29918,
1272,
1839,
11991,
2033,
13,
13,
1678,
396,
29871,
232,
193,
173,
234,
145,
178,
236,
132,
144,
232,
145,
137,
30544,
31951,
30502,
31600,
231,
190,
192,
30210,
30354,
30763,
13,
1678,
396,
363,
12291,
297,
12291,
29918,
1272,
29901,
13,
1678,
396,
268,
1596,
29898,
16123,
1239,
29897,
13,
13,
1678,
396,
29871,
234,
139,
175,
30683,
232,
145,
137,
30911,
30354,
30763,
13,
1678,
4955,
29918,
2271,
353,
525,
991,
597,
1493,
29889,
457,
5652,
29889,
24349,
29889,
510,
29914,
29887,
29906,
29914,
657,
29949,
1983,
3401,
29973,
978,
29922,
29881,
895,
559,
29918,
1228,
29987,
14035,
29922,
17038,
29941,
29946,
29896,
29900,
29955,
29945,
29946,
29929,
29945,
29955,
29929,
29945,
29900,
29896,
29900,
29955,
29953,
29945,
29900,
29929,
29918,
29896,
29945,
29929,
29953,
29896,
29953,
29896,
29955,
29953,
29941,
29941,
29947,
29953,
29987,
29918,
29922,
29896,
29945,
29929,
29953,
29896,
29953,
29896,
29955,
29953,
29941,
29941,
29947,
29955,
29915,
13,
13,
1678,
9066,
353,
426,
13,
4706,
525,
1792,
29899,
14748,
2396,
525,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
399,
9806,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
10228,
29914,
29947,
29946,
29889,
29900,
29889,
29946,
29896,
29946,
29955,
29889,
29896,
29900,
29945,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
29915,
13,
1678,
500,
13,
13,
1678,
4955,
29918,
690,
353,
7274,
29889,
657,
29898,
18434,
29918,
2271,
29892,
9066,
29897,
13,
13,
1678,
396,
29871,
233,
141,
141,
30578,
31277,
31767,
31415,
31640,
30494,
30578,
31259,
13,
1678,
4955,
29918,
5327,
29918,
1272,
353,
4390,
29889,
18132,
29898,
18434,
29918,
690,
29889,
726,
29889,
6506,
877,
17038,
29941,
29946,
29896,
29900,
29955,
29945,
29946,
29929,
29945,
29955,
29929,
29945,
29900,
29896,
29900,
29955,
29953,
29945,
29900,
29929,
29918,
29896,
29945,
29929,
29953,
29896,
29953,
29896,
29955,
29953,
29941,
29941,
29947,
29953,
29317,
27255,
7503,
29899,
29896,
2314,
13,
13,
1678,
396,
29871,
31024,
30683,
30578,
31259,
30275,
30210,
1272,
13,
1678,
4955,
29918,
5327,
353,
4955,
29918,
5327,
29918,
1272,
29889,
657,
877,
1272,
1495,
13,
13,
1678,
396,
29871,
31383,
30698,
233,
141,
141,
5327,
31415,
31640,
30494,
30578,
31259,
29892,
305,
1099,
12742,
1293,
30753,
30356,
232,
145,
137,
30911,
30354,
30763,
30214,
30392,
30287,
30502,
31025,
30746,
30214,
31951,
30502,
30824,
31605,
31238,
30392,
30287,
30408,
30210,
30354,
30763,
13,
1678,
396,
521,
1099,
12742,
2528,
1293,
232,
145,
137,
30911,
30374,
232,
165,
161,
30354,
30763,
13,
1678,
4955,
29918,
1272,
29918,
497,
353,
4390,
29889,
18132,
29898,
18434,
29918,
5327,
29897,
13,
13,
1678,
4955,
353,
6571,
29871,
396,
29871,
232,
145,
137,
30911,
30354,
30763,
13,
13,
1678,
363,
474,
297,
4955,
29918,
1272,
29918,
497,
1839,
305,
1099,
12742,
1293,
2033,
29901,
13,
4706,
18031,
353,
376,
29906,
29900,
29906,
29900,
1213,
718,
474,
1839,
1256,
2033,
13,
4706,
396,
931,
29889,
710,
415,
603,
30392,
30998,
30578,
31277,
31767,
31168,
30607,
30705,
30494,
30824,
31263,
13,
4706,
260,
786,
353,
931,
29889,
710,
415,
603,
29898,
6289,
29892,
11860,
29979,
29889,
29995,
29885,
29889,
29995,
29881,
1159,
13,
4706,
396,
931,
29889,
710,
615,
603,
31264,
31462,
30594,
31016,
31168,
30607,
13,
4706,
18031,
353,
931,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
613,
260,
786,
29897,
13,
4706,
9659,
353,
474,
1839,
26897,
2033,
13,
4706,
12326,
353,
474,
1839,
29879,
375,
1103,
2033,
13,
4706,
540,
284,
353,
474,
1839,
354,
284,
2033,
13,
4706,
7123,
353,
474,
1839,
311,
328,
2033,
13,
4706,
4955,
29961,
6289,
29962,
353,
11117,
26897,
2396,
9659,
29892,
525,
29879,
375,
1103,
2396,
12326,
29892,
525,
354,
284,
2396,
540,
284,
29892,
525,
311,
328,
2396,
7123,
29913,
13,
13,
1678,
363,
474,
297,
4955,
29918,
1272,
29918,
497,
1839,
305,
1099,
12742,
2528,
1293,
2033,
29901,
13,
4706,
18031,
353,
525,
29906,
29900,
29906,
29900,
6169,
718,
474,
1839,
1256,
2033,
13,
4706,
260,
786,
353,
931,
29889,
710,
415,
603,
29898,
6289,
29892,
11860,
29979,
29889,
29995,
29885,
29889,
29995,
29881,
1159,
13,
4706,
18031,
353,
931,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
613,
260,
786,
29897,
13,
4706,
9659,
353,
474,
1839,
26897,
2033,
13,
4706,
12326,
353,
474,
1839,
29879,
375,
1103,
2033,
13,
4706,
540,
284,
353,
474,
1839,
354,
284,
2033,
13,
4706,
7123,
353,
474,
1839,
311,
328,
2033,
13,
4706,
4955,
29961,
6289,
1822,
5504,
3319,
29915,
26897,
29918,
1202,
2396,
9659,
29892,
525,
29879,
375,
1103,
29918,
1202,
2396,
12326,
29892,
525,
354,
284,
29918,
1202,
2396,
540,
284,
29892,
525,
311,
328,
29918,
1202,
2396,
7123,
1800,
13,
13,
1678,
9493,
353,
5159,
29871,
396,
29871,
30948,
30325,
235,
178,
169,
234,
190,
137,
30354,
30763,
13,
13,
1678,
2767,
29918,
2230,
353,
848,
29918,
497,
1839,
4230,
6422,
2481,
2033,
13,
1678,
848,
29918,
16123,
1239,
353,
12291,
29918,
1272,
29871,
396,
29871,
30275,
30356,
232,
147,
135,
31600,
13,
13,
1678,
363,
410,
29918,
7192,
359,
297,
848,
29918,
16123,
1239,
29901,
13,
4706,
12291,
353,
410,
29918,
7192,
359,
1839,
978,
2033,
13,
4706,
363,
4272,
29918,
7192,
359,
297,
410,
29918,
7192,
359,
1839,
11991,
2033,
29901,
13,
9651,
4272,
353,
4272,
29918,
7192,
359,
1839,
978,
2033,
13,
9651,
9659,
353,
4272,
29918,
7192,
359,
1839,
7827,
16215,
26897,
2033,
13,
9651,
9659,
29918,
3707,
353,
4272,
29918,
7192,
359,
1839,
7827,
16215,
3707,
16376,
3568,
2033,
13,
9651,
9659,
29918,
1202,
353,
4272,
29918,
7192,
359,
1839,
27765,
16215,
26897,
2033,
13,
9651,
540,
284,
353,
4272,
29918,
7192,
359,
1839,
7827,
16215,
354,
284,
2033,
13,
9651,
7123,
353,
4272,
29918,
7192,
359,
1839,
7827,
16215,
311,
328,
2033,
13,
9651,
9493,
29889,
4397,
4197,
5504,
29918,
2230,
29892,
12291,
29892,
4272,
29892,
9659,
29892,
9659,
29918,
3707,
29892,
9659,
29918,
1202,
29892,
540,
284,
29892,
7123,
2314,
13,
1678,
736,
4955,
29892,
9493,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4955,
29892,
4902,
353,
679,
29918,
841,
1760,
29918,
1272,
580,
13,
13,
1678,
1596,
29898,
18434,
29897,
13,
1678,
1596,
29898,
14144,
29897,
2
] |
slacker/workers/django.py | kmike/tornado-slacker | 8 | 108353 | <filename>slacker/workers/django.py
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from slacker.django_backend.conf import SLACKER_SERVER
from .http import HttpWorker
class DjangoWorker(HttpWorker):
""" HttpWorker with django's defaults """
def __init__(self, server=None, path=None):
server = server or SLACKER_SERVER
path = path or reverse('slacker-execute')
super(DjangoWorker, self).__init__(server, path)
| [
1,
529,
9507,
29958,
29879,
2364,
261,
29914,
1287,
414,
29914,
14095,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
13,
3166,
9557,
29889,
3221,
29889,
2271,
9778,
874,
1053,
11837,
13,
3166,
269,
2364,
261,
29889,
14095,
29918,
27852,
29889,
5527,
1053,
27146,
11375,
1001,
29918,
18603,
13,
3166,
869,
1124,
1053,
9056,
16164,
13,
13,
1990,
15337,
16164,
29898,
5506,
16164,
1125,
13,
13,
1678,
9995,
9056,
16164,
411,
9557,
29915,
29879,
21274,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1923,
29922,
8516,
29892,
2224,
29922,
8516,
1125,
13,
4706,
1923,
353,
1923,
470,
27146,
11375,
1001,
29918,
18603,
13,
4706,
2224,
353,
2224,
470,
11837,
877,
29879,
2364,
261,
29899,
7978,
1495,
13,
4706,
2428,
29898,
29928,
5364,
16164,
29892,
1583,
467,
1649,
2344,
12035,
2974,
29892,
2224,
29897,
13,
13,
2
] |
modules/GEM_500_COM3.py | ZeppW/ODMRGUI | 0 | 34780 | import pyvisa
import time
import numpy as np
from struct import unpack
import matplotlib.pyplot as plt
rm = pyvisa.ResourceManager()
rm.list_resources()
GEM = rm.open_resource('ASRL3::INSTR')
def Turn_on():
GEM.write('ON')
GEM.write('POWER=001')
print('Laser has initialized!!!')
def SetPower(pw_mw):
GEM.write('POWER='+str(pw_mw))
print('Power has changed to '+str(pw_mw)+' mW!!!Please wait...')
time.sleep(10)
def Turn_off():
GEM.write('POWER=001')
print('Reset power!!!Please wait...')
time.sleep(10)
GEM.write('OFF')
print('Laser has been disabled!!!')
def PowerQ():
return GEM.query('POWER?').split()[0]
def tempQ():
temp_list = []
i = 0
while i < 5:
tt = GEM.query('LASTEMP?').split()
if tt != []:
tt = ''.join(list(tt[0])[:-1])
temp_list.append(float(tt))
i += 1
print(temp_list)
| [
1,
1053,
11451,
1730,
29874,
13,
5215,
931,
13,
5215,
12655,
408,
7442,
13,
3166,
2281,
1053,
443,
4058,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
1758,
353,
11451,
1730,
29874,
29889,
6848,
3260,
580,
13,
1758,
29889,
1761,
29918,
13237,
580,
13,
1692,
29924,
353,
20241,
29889,
3150,
29918,
10314,
877,
3289,
2241,
29941,
1057,
1177,
10810,
1495,
13,
13,
1753,
9603,
29918,
265,
7295,
13,
1678,
402,
12665,
29889,
3539,
877,
1164,
1495,
13,
1678,
402,
12665,
29889,
3539,
877,
29925,
9806,
1001,
29922,
29900,
29900,
29896,
1495,
13,
1678,
1596,
877,
29931,
29440,
756,
16601,
21004,
1495,
13,
13,
1753,
3789,
21472,
29898,
29886,
29893,
29918,
29885,
29893,
1125,
13,
1678,
402,
12665,
29889,
3539,
877,
29925,
9806,
1001,
2433,
29974,
710,
29898,
29886,
29893,
29918,
29885,
29893,
876,
13,
1678,
1596,
877,
21472,
756,
3939,
304,
525,
29974,
710,
29898,
29886,
29893,
29918,
29885,
29893,
7240,
29915,
286,
29956,
21004,
12148,
4480,
856,
1495,
13,
1678,
931,
29889,
17059,
29898,
29896,
29900,
29897,
13,
13,
1753,
9603,
29918,
2696,
7295,
13,
1678,
402,
12665,
29889,
3539,
877,
29925,
9806,
1001,
29922,
29900,
29900,
29896,
1495,
13,
1678,
1596,
877,
27175,
3081,
21004,
12148,
4480,
856,
1495,
13,
1678,
931,
29889,
17059,
29898,
29896,
29900,
29897,
13,
1678,
402,
12665,
29889,
3539,
877,
27681,
1495,
13,
1678,
1596,
877,
29931,
29440,
756,
1063,
12708,
21004,
1495,
13,
13,
1753,
9206,
29984,
7295,
13,
1678,
736,
402,
12665,
29889,
1972,
877,
29925,
9806,
1001,
29973,
2824,
5451,
580,
29961,
29900,
29962,
13,
13,
1753,
5694,
29984,
7295,
13,
1678,
5694,
29918,
1761,
353,
5159,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
1550,
474,
529,
29871,
29945,
29901,
13,
4706,
260,
29873,
353,
402,
12665,
29889,
1972,
877,
4375,
1254,
29923,
3580,
29973,
2824,
5451,
580,
13,
4706,
565,
260,
29873,
2804,
5159,
29901,
13,
9651,
260,
29873,
353,
525,
4286,
7122,
29898,
1761,
29898,
698,
29961,
29900,
2314,
7503,
29899,
29896,
2314,
13,
9651,
5694,
29918,
1761,
29889,
4397,
29898,
7411,
29898,
698,
876,
13,
9651,
474,
4619,
29871,
29896,
13,
13,
1678,
1596,
29898,
7382,
29918,
1761,
29897,
13,
13,
2
] |
dronecan/driver/timestamp_estimator.py | bugobliterator/pydronecan | 0 | 1608435 | #
# Copyright (C) 2014-2016 UAVCAN Development Team <dronecan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
from __future__ import division, absolute_import, print_function, unicode_literals
import decimal
class SourceTimeResolver:
"""
This class contains logic that recovers absolute value of a remote clock observable via small overflowing
integer samples.
For example, consider a remote system that reports timestamps as a 16-bit integer number of milliseconds that
overflows every 60 seconds (this method is used in SLCAN for example). This class can recover the time difference
in the remote clock domain between two arbitrary timestamps, even if the timestamp variable overflowed more than
once between these events.
"""
def __init__(self, source_clock_overflow_period=None):
"""
Args:
source_clock_overflow_period: Overflow period of the remote clock, in seconds.
If not provided, the remote clock is considered to never
overflow (i.e. absolute).
"""
self.source_clock_overflow_period = \
decimal.Decimal(source_clock_overflow_period) if source_clock_overflow_period else None
if self.source_clock_overflow_period is not None and self.source_clock_overflow_period <= 0:
raise ValueError('source_clock_overflow_period must be positive or None')
# Internal states
self._resolved_time = None
self._prev_source_sample = None
self._prev_target_sample = None
def reset(self):
"""
Resets the internal logic; resolved time will start over.
"""
self._resolved_time = None
self._prev_source_sample = None
self._prev_target_sample = None
def update(self, source_clock_sample, target_clock_sample):
"""
Args:
source_clock_sample: Sample of the source clock, in seconds
target_clock_sample: Sample of the target clock, in seconds
Returns: Resolved absolute source clock value
"""
if self._resolved_time is None or self.source_clock_overflow_period is None:
self._resolved_time = decimal.Decimal(source_clock_sample)
self._prev_source_sample = source_clock_sample
self._prev_target_sample = target_clock_sample
else:
# Time between updates in the target clock domain
tgt_delta = target_clock_sample - self._prev_target_sample
self._prev_target_sample = target_clock_sample
assert tgt_delta >= 0
# Time between updates in the source clock domain
src_delta = source_clock_sample - self._prev_source_sample
self._prev_source_sample = source_clock_sample
# Using the target clock we can resolve the integer ambiguity (number of overflows)
full_cycles = int(round((tgt_delta - src_delta) / float(self.source_clock_overflow_period), 0))
# Updating the source clock now; in two steps, in order to avoid error accumulation in floats
self._resolved_time += decimal.Decimal(full_cycles * self.source_clock_overflow_period)
self._resolved_time += decimal.Decimal(src_delta)
return self._resolved_time
class TimestampEstimator:
"""
Based on "A Passive Solution to the Sensor Synchronization Problem" [<NAME> 2010]
https://april.eecs.umich.edu/pdfs/olson2010.pdf
"""
DEFAULT_MAX_DRIFT_PPM = 200
DEFAULT_MAX_PHASE_ERROR_TO_RESYNC = 1.
def __init__(self,
max_rate_error=None,
source_clock_overflow_period=None,
fixed_delay=None,
max_phase_error_to_resync=None):
"""
Args:
max_rate_error: The max drift parameter must be not lower than maximum relative clock
drift in PPM. If the max relative drift is guaranteed to be lower,
reducing this value will improve estimation. The default covers vast
majority of low-cost (and up) crystal oscillators.
source_clock_overflow_period: How often the source clocks wraps over, in seconds.
For example, for SLCAN this value is 60 seconds.
If not provided, the source clock is considered to never wrap over.
fixed_delay: This value will be unconditionally added to the delay estimations.
Represented in seconds. Default is zero.
For USB-interfaced sources it should be safe to use as much as 100 usec.
max_phase_error_to_resync: When this value is exceeded, the estimator will start over.
Defaults to a large value.
"""
self.max_rate_error = float(max_rate_error or (self.DEFAULT_MAX_DRIFT_PPM / 1e6))
self.fixed_delay = fixed_delay or 0
self.max_phase_error_to_resync = max_phase_error_to_resync or self.DEFAULT_MAX_PHASE_ERROR_TO_RESYNC
if self.max_rate_error < 0:
raise ValueError('max_rate_error must be non-negative')
if self.fixed_delay < 0:
raise ValueError('fixed_delay must be non-negative')
if self.max_phase_error_to_resync <= 0:
raise ValueError('max_phase_error_to_resync must be positive')
# This is used to recover absolute source time
self._source_time_resolver = SourceTimeResolver(source_clock_overflow_period=source_clock_overflow_period)
# Refer to the paper for explanations
self._p = None
self._q = None
# Statistics
self._estimated_delay = 0.0
self._resync_count = 0
def update(self, source_clock_sample, target_clock_sample):
"""
Args:
source_clock_sample: E.g. value received from the source system, in seconds
target_clock_sample: E.g. target time sampled when the data arrived to the local system, in seconds
Returns: Event timestamp converted to the target time domain.
"""
pi = float(self._source_time_resolver.update(source_clock_sample, target_clock_sample))
qi = target_clock_sample
# Initialization
if self._p is None:
self._p = pi
self._q = qi
# Sync error - refer to the reference implementation of the algorithm
self._estimated_delay = abs((pi - self._p) - (qi - self._q))
# Resynchronization (discarding known state)
if self._estimated_delay > self.max_phase_error_to_resync:
self._source_time_resolver.reset()
self._resync_count += 1
self._p = pi = float(self._source_time_resolver.update(source_clock_sample, target_clock_sample))
self._q = qi
# Offset options
assert pi >= self._p
offset = self._p - self._q - self.max_rate_error * (pi - self._p) - self.fixed_delay
new_offset = pi - qi - self.fixed_delay
# Updating p/q if the new offset is lower by magnitude
if new_offset >= offset:
offset = new_offset
self._p = pi
self._q = qi
ti = pi - offset
return ti
@property
def estimated_delay(self):
"""Estimated delay, updated in the last call to update()"""
return self._estimated_delay
@property
def resync_count(self):
return self._resync_count
if __name__ == '__main__':
# noinspection PyPackageRequirements
import matplotlib.pyplot as plt
# noinspection PyPackageRequirements
import numpy
import time
if 1:
estimator = TimestampEstimator()
print(estimator.update(.0, 1000.0))
print(estimator.update(.1, 1000.1))
print(estimator.update(.2, 1000.1)) # Repeat
print(estimator.update(.3, 1000.1)) # Repeat
print(estimator.update(.4, 1000.2))
print(estimator.update(.5, 1000.3))
if 1:
# Conversion from Real to Monotonic
estimator = TimestampEstimator(max_rate_error=1e-5,
fixed_delay=1e-6,
max_phase_error_to_resync=1e-2)
print('Initial mono to real:', time.time() - time.monotonic())
while True:
mono = time.monotonic()
real = time.time()
est_real = estimator.update(mono, real)
mono_to_real_offset = est_real - mono
print(mono_to_real_offset)
time.sleep(1)
max_rate_error = None
source_clock_range = 10
delay_min = 0.0001
delay_max = 0.02
num_samples = 200
x = range(num_samples)
delays = numpy.random.uniform(delay_min, delay_max, size=num_samples)
estimator = TimestampEstimator(max_rate_error=max_rate_error, fixed_delay=delay_min,
source_clock_overflow_period=source_clock_range)
source_clocks = []
estimated_times = []
offset_errors = []
estimated_delays = []
for i, delay in enumerate(delays):
source_clock = i
source_clocks.append(source_clock)
target_clock = i + delay
estimated_time = estimator.update(source_clock % source_clock_range, target_clock)
estimated_times.append(estimated_time)
offset_errors.append(estimated_time - source_clock)
estimated_delays.append(estimator.estimated_delay)
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax1.plot(x, numpy.array(delays) * 1e3)
ax1.plot(x, numpy.array(offset_errors) * 1e3)
ax2 = fig.add_subplot(212)
ax2.plot(x, (numpy.array(estimated_times) - numpy.array(source_clocks)) * 1e3)
plt.show()
| [
1,
396,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29946,
29899,
29906,
29900,
29896,
29953,
29871,
501,
7520,
29907,
2190,
14650,
8583,
29871,
529,
7707,
650,
3068,
29889,
990,
29958,
13,
29937,
13,
29937,
910,
7047,
338,
13235,
1090,
278,
4958,
310,
278,
341,
1806,
19245,
29889,
13,
29937,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
308,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
29892,
8380,
29918,
5215,
29892,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
13,
5215,
13677,
13,
13,
13,
1990,
7562,
2481,
19648,
29901,
13,
1678,
9995,
13,
1678,
910,
770,
3743,
5900,
393,
337,
1111,
874,
8380,
995,
310,
263,
7592,
12006,
25209,
3025,
2319,
11969,
292,
13,
1678,
6043,
11916,
29889,
13,
1678,
1152,
1342,
29892,
2050,
263,
7592,
1788,
393,
13676,
5335,
342,
15092,
408,
263,
29871,
29896,
29953,
29899,
2966,
6043,
1353,
310,
3533,
21462,
393,
13,
1678,
11969,
29879,
1432,
29871,
29953,
29900,
6923,
313,
1366,
1158,
338,
1304,
297,
317,
12182,
2190,
363,
1342,
467,
910,
770,
508,
9792,
278,
931,
4328,
13,
1678,
297,
278,
7592,
12006,
5354,
1546,
1023,
11472,
5335,
342,
15092,
29892,
1584,
565,
278,
14334,
2286,
11969,
287,
901,
1135,
13,
1678,
2748,
1546,
1438,
4959,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
29901,
28845,
3785,
310,
278,
7592,
12006,
29892,
297,
6923,
29889,
13,
462,
462,
3986,
960,
451,
4944,
29892,
278,
7592,
12006,
338,
5545,
304,
2360,
13,
462,
462,
3986,
11969,
313,
29875,
29889,
29872,
29889,
8380,
467,
13,
4706,
9995,
13,
4706,
1583,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
353,
320,
13,
9651,
13677,
29889,
23307,
29898,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
29897,
565,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
1683,
6213,
13,
13,
4706,
565,
1583,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
338,
451,
6213,
322,
1583,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
5277,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
877,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
1818,
367,
6374,
470,
6213,
1495,
13,
13,
4706,
396,
512,
1890,
5922,
13,
4706,
1583,
3032,
9778,
1490,
29918,
2230,
353,
6213,
13,
4706,
1583,
3032,
16304,
29918,
4993,
29918,
11249,
353,
6213,
13,
4706,
1583,
3032,
16304,
29918,
5182,
29918,
11249,
353,
6213,
13,
13,
1678,
822,
10092,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
2538,
1691,
278,
7463,
5900,
29936,
11527,
931,
674,
1369,
975,
29889,
13,
4706,
9995,
13,
4706,
1583,
3032,
9778,
1490,
29918,
2230,
353,
6213,
13,
4706,
1583,
3032,
16304,
29918,
4993,
29918,
11249,
353,
6213,
13,
4706,
1583,
3032,
16304,
29918,
5182,
29918,
11249,
353,
6213,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
2752,
29918,
13058,
29918,
11249,
29892,
3646,
29918,
13058,
29918,
11249,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
2752,
29918,
13058,
29918,
11249,
29901,
21029,
310,
278,
2752,
12006,
29892,
297,
6923,
13,
9651,
3646,
29918,
13058,
29918,
11249,
29901,
21029,
310,
278,
3646,
12006,
29892,
297,
6923,
13,
13,
4706,
16969,
29901,
24062,
1490,
8380,
2752,
12006,
995,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
9778,
1490,
29918,
2230,
338,
6213,
470,
1583,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
338,
6213,
29901,
13,
9651,
1583,
3032,
9778,
1490,
29918,
2230,
353,
13677,
29889,
23307,
29898,
4993,
29918,
13058,
29918,
11249,
29897,
13,
9651,
1583,
3032,
16304,
29918,
4993,
29918,
11249,
353,
2752,
29918,
13058,
29918,
11249,
13,
9651,
1583,
3032,
16304,
29918,
5182,
29918,
11249,
353,
3646,
29918,
13058,
29918,
11249,
13,
4706,
1683,
29901,
13,
9651,
396,
5974,
1546,
11217,
297,
278,
3646,
12006,
5354,
13,
9651,
260,
4141,
29918,
4181,
353,
3646,
29918,
13058,
29918,
11249,
448,
1583,
3032,
16304,
29918,
5182,
29918,
11249,
13,
9651,
1583,
3032,
16304,
29918,
5182,
29918,
11249,
353,
3646,
29918,
13058,
29918,
11249,
13,
9651,
4974,
260,
4141,
29918,
4181,
6736,
29871,
29900,
13,
13,
9651,
396,
5974,
1546,
11217,
297,
278,
2752,
12006,
5354,
13,
9651,
4765,
29918,
4181,
353,
2752,
29918,
13058,
29918,
11249,
448,
1583,
3032,
16304,
29918,
4993,
29918,
11249,
13,
9651,
1583,
3032,
16304,
29918,
4993,
29918,
11249,
353,
2752,
29918,
13058,
29918,
11249,
13,
13,
9651,
396,
5293,
278,
3646,
12006,
591,
508,
8814,
278,
6043,
22363,
537,
313,
4537,
310,
11969,
29879,
29897,
13,
9651,
2989,
29918,
1270,
7799,
353,
938,
29898,
14486,
3552,
29873,
4141,
29918,
4181,
448,
4765,
29918,
4181,
29897,
847,
5785,
29898,
1311,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
511,
29871,
29900,
876,
13,
13,
9651,
396,
5020,
26747,
278,
2752,
12006,
1286,
29936,
297,
1023,
6576,
29892,
297,
1797,
304,
4772,
1059,
18414,
2785,
297,
5685,
1446,
13,
9651,
1583,
3032,
9778,
1490,
29918,
2230,
4619,
13677,
29889,
23307,
29898,
8159,
29918,
1270,
7799,
334,
1583,
29889,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
29897,
13,
9651,
1583,
3032,
9778,
1490,
29918,
2230,
4619,
13677,
29889,
23307,
29898,
4351,
29918,
4181,
29897,
13,
13,
4706,
736,
1583,
3032,
9778,
1490,
29918,
2230,
13,
13,
13,
1990,
7870,
7416,
12787,
326,
1061,
29901,
13,
1678,
9995,
13,
1678,
16564,
373,
376,
29909,
6978,
573,
24380,
304,
278,
317,
6073,
317,
9524,
2133,
11583,
29908,
518,
29966,
5813,
29958,
29871,
29906,
29900,
29896,
29900,
29962,
13,
4706,
2045,
597,
481,
4115,
29889,
29872,
687,
29879,
29889,
398,
436,
29889,
6085,
29914,
5140,
29879,
29914,
324,
1100,
29906,
29900,
29896,
29900,
29889,
5140,
13,
1678,
9995,
13,
13,
1678,
22236,
29918,
12648,
29918,
29928,
3960,
7818,
29918,
29925,
13427,
353,
29871,
29906,
29900,
29900,
13,
1678,
22236,
29918,
12648,
29918,
19689,
8127,
29918,
11432,
29918,
4986,
29918,
1525,
14816,
15868,
353,
29871,
29896,
29889,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
4236,
29918,
10492,
29918,
2704,
29922,
8516,
29892,
13,
462,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
29922,
8516,
29892,
13,
462,
4343,
29918,
18829,
29922,
8516,
29892,
13,
462,
4236,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
4236,
29918,
10492,
29918,
2704,
29901,
462,
450,
4236,
4192,
2027,
3443,
1818,
367,
451,
5224,
1135,
7472,
6198,
12006,
13,
462,
462,
9651,
4192,
2027,
297,
349,
13427,
29889,
960,
278,
4236,
6198,
4192,
2027,
338,
22688,
304,
367,
5224,
29892,
13,
462,
462,
9651,
27668,
445,
995,
674,
11157,
23248,
29889,
450,
2322,
18469,
13426,
13,
462,
462,
9651,
13638,
310,
4482,
29899,
18253,
313,
392,
701,
29897,
10901,
11195,
21519,
4097,
29889,
13,
9651,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
29901,
259,
1128,
4049,
278,
2752,
12006,
29879,
11463,
567,
975,
29892,
297,
6923,
29889,
13,
462,
462,
9651,
1152,
1342,
29892,
363,
317,
12182,
2190,
445,
995,
338,
29871,
29953,
29900,
6923,
29889,
13,
462,
462,
9651,
960,
451,
4944,
29892,
278,
2752,
12006,
338,
5545,
304,
2360,
12244,
975,
29889,
13,
9651,
4343,
29918,
18829,
29901,
462,
1678,
910,
995,
674,
367,
443,
16122,
635,
2715,
304,
278,
9055,
4844,
800,
29889,
13,
462,
462,
9651,
16314,
287,
297,
6923,
29889,
13109,
338,
5225,
29889,
13,
462,
462,
9651,
1152,
12951,
29899,
1639,
17470,
287,
8974,
372,
881,
367,
9109,
304,
671,
408,
1568,
408,
29871,
29896,
29900,
29900,
671,
29883,
29889,
13,
9651,
4236,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
29901,
418,
1932,
445,
995,
338,
13461,
287,
29892,
278,
4844,
1061,
674,
1369,
975,
29889,
13,
462,
462,
9651,
13109,
29879,
304,
263,
2919,
995,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
3317,
29918,
10492,
29918,
2704,
353,
5785,
29898,
3317,
29918,
10492,
29918,
2704,
470,
313,
1311,
29889,
23397,
29918,
12648,
29918,
29928,
3960,
7818,
29918,
29925,
13427,
847,
29871,
29896,
29872,
29953,
876,
13,
4706,
1583,
29889,
20227,
29918,
18829,
353,
4343,
29918,
18829,
470,
29871,
29900,
13,
4706,
1583,
29889,
3317,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
353,
4236,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
470,
1583,
29889,
23397,
29918,
12648,
29918,
19689,
8127,
29918,
11432,
29918,
4986,
29918,
1525,
14816,
15868,
13,
13,
4706,
565,
1583,
29889,
3317,
29918,
10492,
29918,
2704,
529,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
877,
3317,
29918,
10492,
29918,
2704,
1818,
367,
1661,
29899,
22198,
1495,
13,
13,
4706,
565,
1583,
29889,
20227,
29918,
18829,
529,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
877,
20227,
29918,
18829,
1818,
367,
1661,
29899,
22198,
1495,
13,
13,
4706,
565,
1583,
29889,
3317,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
5277,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
877,
3317,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
1818,
367,
6374,
1495,
13,
13,
4706,
396,
910,
338,
1304,
304,
9792,
8380,
2752,
931,
13,
4706,
1583,
3032,
4993,
29918,
2230,
29918,
9778,
369,
353,
7562,
2481,
19648,
29898,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
29922,
4993,
29918,
13058,
29918,
2262,
29918,
19145,
29897,
13,
13,
4706,
396,
4118,
304,
278,
5650,
363,
7309,
800,
13,
4706,
1583,
3032,
29886,
353,
6213,
13,
4706,
1583,
3032,
29939,
353,
6213,
13,
13,
4706,
396,
27098,
13,
4706,
1583,
3032,
342,
326,
630,
29918,
18829,
353,
29871,
29900,
29889,
29900,
13,
4706,
1583,
3032,
690,
2720,
29918,
2798,
353,
29871,
29900,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
2752,
29918,
13058,
29918,
11249,
29892,
3646,
29918,
13058,
29918,
11249,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
2752,
29918,
13058,
29918,
11249,
29901,
1678,
382,
29889,
29887,
29889,
995,
4520,
515,
278,
2752,
1788,
29892,
297,
6923,
13,
9651,
3646,
29918,
13058,
29918,
11249,
29901,
1678,
382,
29889,
29887,
29889,
3646,
931,
4559,
29881,
746,
278,
848,
11977,
304,
278,
1887,
1788,
29892,
297,
6923,
13,
4706,
16969,
29901,
6864,
14334,
11543,
304,
278,
3646,
931,
5354,
29889,
13,
4706,
9995,
13,
4706,
2930,
353,
5785,
29898,
1311,
3032,
4993,
29918,
2230,
29918,
9778,
369,
29889,
5504,
29898,
4993,
29918,
13058,
29918,
11249,
29892,
3646,
29918,
13058,
29918,
11249,
876,
13,
4706,
3855,
29875,
353,
3646,
29918,
13058,
29918,
11249,
13,
13,
4706,
396,
17250,
2133,
13,
4706,
565,
1583,
3032,
29886,
338,
6213,
29901,
13,
9651,
1583,
3032,
29886,
353,
2930,
13,
9651,
1583,
3032,
29939,
353,
3855,
29875,
13,
13,
4706,
396,
317,
2720,
1059,
448,
2737,
304,
278,
3407,
5314,
310,
278,
5687,
13,
4706,
1583,
3032,
342,
326,
630,
29918,
18829,
353,
6425,
3552,
1631,
448,
1583,
3032,
29886,
29897,
448,
313,
26461,
448,
1583,
3032,
29939,
876,
13,
13,
4706,
396,
2538,
9524,
2133,
313,
2218,
7543,
292,
2998,
2106,
29897,
13,
4706,
565,
1583,
3032,
342,
326,
630,
29918,
18829,
1405,
1583,
29889,
3317,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
29901,
13,
9651,
1583,
3032,
4993,
29918,
2230,
29918,
9778,
369,
29889,
12071,
580,
13,
9651,
1583,
3032,
690,
2720,
29918,
2798,
4619,
29871,
29896,
13,
9651,
1583,
3032,
29886,
353,
2930,
353,
5785,
29898,
1311,
3032,
4993,
29918,
2230,
29918,
9778,
369,
29889,
5504,
29898,
4993,
29918,
13058,
29918,
11249,
29892,
3646,
29918,
13058,
29918,
11249,
876,
13,
9651,
1583,
3032,
29939,
353,
3855,
29875,
13,
13,
4706,
396,
5947,
842,
3987,
13,
4706,
4974,
2930,
6736,
1583,
3032,
29886,
13,
4706,
9210,
353,
1583,
3032,
29886,
448,
1583,
3032,
29939,
448,
1583,
29889,
3317,
29918,
10492,
29918,
2704,
334,
313,
1631,
448,
1583,
3032,
29886,
29897,
448,
1583,
29889,
20227,
29918,
18829,
13,
4706,
716,
29918,
10289,
353,
2930,
448,
3855,
29875,
448,
1583,
29889,
20227,
29918,
18829,
13,
13,
4706,
396,
5020,
26747,
282,
29914,
29939,
565,
278,
716,
9210,
338,
5224,
491,
18497,
13,
4706,
565,
716,
29918,
10289,
6736,
9210,
29901,
13,
9651,
9210,
353,
716,
29918,
10289,
13,
9651,
1583,
3032,
29886,
353,
2930,
13,
9651,
1583,
3032,
29939,
353,
3855,
29875,
13,
13,
4706,
19538,
353,
2930,
448,
9210,
13,
13,
4706,
736,
19538,
13,
13,
1678,
732,
6799,
13,
1678,
822,
15899,
29918,
18829,
29898,
1311,
1125,
13,
4706,
9995,
12787,
326,
630,
9055,
29892,
4784,
297,
278,
1833,
1246,
304,
2767,
580,
15945,
29908,
13,
4706,
736,
1583,
3032,
342,
326,
630,
29918,
18829,
13,
13,
1678,
732,
6799,
13,
1678,
822,
620,
2720,
29918,
2798,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
690,
2720,
29918,
2798,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
694,
1144,
27988,
10772,
14459,
1123,
1548,
1860,
13,
1678,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
1678,
396,
694,
1144,
27988,
10772,
14459,
1123,
1548,
1860,
13,
1678,
1053,
12655,
13,
1678,
1053,
931,
13,
13,
1678,
565,
29871,
29896,
29901,
13,
4706,
4844,
1061,
353,
7870,
7416,
12787,
326,
1061,
580,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29900,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29900,
876,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29896,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29896,
876,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29906,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29896,
876,
29871,
396,
830,
11666,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29941,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29896,
876,
29871,
396,
830,
11666,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29946,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29906,
876,
13,
4706,
1596,
29898,
342,
326,
1061,
29889,
5504,
11891,
29945,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29941,
876,
13,
13,
1678,
565,
29871,
29896,
29901,
13,
4706,
396,
1281,
3259,
515,
8195,
304,
2598,
327,
8927,
13,
4706,
4844,
1061,
353,
7870,
7416,
12787,
326,
1061,
29898,
3317,
29918,
10492,
29918,
2704,
29922,
29896,
29872,
29899,
29945,
29892,
13,
462,
462,
539,
4343,
29918,
18829,
29922,
29896,
29872,
29899,
29953,
29892,
13,
462,
462,
539,
4236,
29918,
21646,
29918,
2704,
29918,
517,
29918,
690,
2720,
29922,
29896,
29872,
29899,
29906,
29897,
13,
4706,
1596,
877,
15514,
1601,
29877,
304,
1855,
29901,
742,
931,
29889,
2230,
580,
448,
931,
29889,
3712,
327,
8927,
3101,
13,
4706,
1550,
5852,
29901,
13,
9651,
1601,
29877,
353,
931,
29889,
3712,
327,
8927,
580,
13,
9651,
1855,
353,
931,
29889,
2230,
580,
13,
9651,
707,
29918,
6370,
353,
4844,
1061,
29889,
5504,
29898,
29885,
3231,
29892,
1855,
29897,
13,
9651,
1601,
29877,
29918,
517,
29918,
6370,
29918,
10289,
353,
707,
29918,
6370,
448,
1601,
29877,
13,
9651,
1596,
29898,
29885,
3231,
29918,
517,
29918,
6370,
29918,
10289,
29897,
13,
9651,
931,
29889,
17059,
29898,
29896,
29897,
13,
13,
1678,
4236,
29918,
10492,
29918,
2704,
353,
6213,
13,
1678,
2752,
29918,
13058,
29918,
3881,
353,
29871,
29896,
29900,
13,
1678,
9055,
29918,
1195,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
13,
1678,
9055,
29918,
3317,
353,
29871,
29900,
29889,
29900,
29906,
13,
1678,
954,
29918,
27736,
353,
29871,
29906,
29900,
29900,
13,
13,
1678,
921,
353,
3464,
29898,
1949,
29918,
27736,
29897,
13,
1678,
628,
1036,
353,
12655,
29889,
8172,
29889,
29590,
29898,
18829,
29918,
1195,
29892,
9055,
29918,
3317,
29892,
2159,
29922,
1949,
29918,
27736,
29897,
13,
13,
1678,
4844,
1061,
353,
7870,
7416,
12787,
326,
1061,
29898,
3317,
29918,
10492,
29918,
2704,
29922,
3317,
29918,
10492,
29918,
2704,
29892,
4343,
29918,
18829,
29922,
18829,
29918,
1195,
29892,
13,
462,
462,
259,
2752,
29918,
13058,
29918,
2262,
29918,
19145,
29922,
4993,
29918,
13058,
29918,
3881,
29897,
13,
13,
1678,
2752,
29918,
13058,
29879,
353,
5159,
13,
1678,
15899,
29918,
3706,
353,
5159,
13,
1678,
9210,
29918,
12523,
353,
5159,
13,
1678,
15899,
29918,
6144,
1036,
353,
5159,
13,
1678,
363,
474,
29892,
9055,
297,
26985,
29898,
6144,
1036,
1125,
13,
4706,
2752,
29918,
13058,
353,
474,
13,
4706,
2752,
29918,
13058,
29879,
29889,
4397,
29898,
4993,
29918,
13058,
29897,
13,
4706,
3646,
29918,
13058,
353,
474,
718,
9055,
13,
13,
4706,
15899,
29918,
2230,
353,
4844,
1061,
29889,
5504,
29898,
4993,
29918,
13058,
1273,
2752,
29918,
13058,
29918,
3881,
29892,
3646,
29918,
13058,
29897,
13,
4706,
15899,
29918,
3706,
29889,
4397,
29898,
342,
326,
630,
29918,
2230,
29897,
13,
4706,
9210,
29918,
12523,
29889,
4397,
29898,
342,
326,
630,
29918,
2230,
448,
2752,
29918,
13058,
29897,
13,
4706,
15899,
29918,
6144,
1036,
29889,
4397,
29898,
342,
326,
1061,
29889,
342,
326,
630,
29918,
18829,
29897,
13,
13,
1678,
2537,
353,
14770,
29889,
4532,
580,
13,
13,
1678,
4853,
29896,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29906,
29896,
29896,
29897,
13,
1678,
4853,
29896,
29889,
5317,
29898,
29916,
29892,
12655,
29889,
2378,
29898,
6144,
1036,
29897,
334,
29871,
29896,
29872,
29941,
29897,
13,
1678,
4853,
29896,
29889,
5317,
29898,
29916,
29892,
12655,
29889,
2378,
29898,
10289,
29918,
12523,
29897,
334,
29871,
29896,
29872,
29941,
29897,
13,
13,
1678,
4853,
29906,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29906,
29896,
29906,
29897,
13,
1678,
4853,
29906,
29889,
5317,
29898,
29916,
29892,
313,
23749,
29889,
2378,
29898,
342,
326,
630,
29918,
3706,
29897,
448,
12655,
29889,
2378,
29898,
4993,
29918,
13058,
29879,
876,
334,
29871,
29896,
29872,
29941,
29897,
13,
13,
1678,
14770,
29889,
4294,
580,
13,
2
] |
pretalx_vimeo/recording.py | pretalx/pretalx-vimeo | 0 | 133579 | from pretalx.agenda.recording import BaseRecordingProvider
class VimeoProvider(BaseRecordingProvider):
def get_recording(self, submission):
vimeo = getattr(submission, "vimeo_link", None)
if vimeo:
return {"iframe": vimeo.iframe, "csp_header": "https://player.vimeo.com"}
| [
1,
515,
14794,
284,
29916,
29889,
351,
8395,
29889,
3757,
3278,
1053,
7399,
4789,
3278,
6980,
13,
13,
13,
1990,
478,
603,
29877,
6980,
29898,
5160,
4789,
3278,
6980,
1125,
13,
1678,
822,
679,
29918,
3757,
3278,
29898,
1311,
29892,
29240,
1125,
13,
4706,
325,
603,
29877,
353,
679,
5552,
29898,
1491,
6737,
29892,
376,
29894,
603,
29877,
29918,
2324,
613,
6213,
29897,
13,
4706,
565,
325,
603,
29877,
29901,
13,
9651,
736,
8853,
22000,
1115,
325,
603,
29877,
29889,
22000,
29892,
376,
29883,
1028,
29918,
6672,
1115,
376,
991,
597,
9106,
29889,
29894,
603,
29877,
29889,
510,
9092,
13,
2
] |
hrnet/src/train.py | sentinel-hub/multi-temporal-super-resolution | 34 | 121877 | """ Python script to train HRNet + shiftNet for multi frame super resolution (MFSR)
Credits:
This code is adapted from ElementAI's HighRes-Net: https://github.com/ElementAI/HighRes-net
"""
import os
import gc
import json
import argparse
import datetime
from functools import partial
from collections import defaultdict, deque
import numpy as np
import cv2 as cv
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from sr.metrics import calculate_metrics
from hrnet.src.DeepNetworks.HRNet import HRNet
from hrnet.src.DeepNetworks.ShiftNet import ShiftNet
from hrnet.src.utils import normalize_plotting
from hrnet.src.utils import distributions_plot
from sr.data_loader import ImagesetDataset, augment
from sr.metrics import compute_perceptual_loss
from tqdm.auto import tqdm
from tensorboardX import SummaryWriter
import wandb
def register_batch(shiftNet, lrs, reference):
"""
Registers images against references.
Args:
shiftNet: torch.model
lrs: tensor (batch size, views, C, W, H), images to shift
reference: tensor (batch size, 1, C, W, H), reference images to shift
Returns:
thetas: tensor (batch size, views, 2)
"""
n_views = lrs.size(1)
thetas = []
for i in range(n_views):
# Add references as views
concated = torch.cat([reference, lrs[:, i:i + 1]], 1)
theta = shiftNet(concated)
thetas.append(theta)
thetas = torch.stack(thetas, 1)
return thetas
def apply_shifts(shiftNet, images, thetas, device):
"""
Applies sub-pixel translations to images with Lanczos interpolation.
Args:
shiftNet: torch.model
images: tensor (batch size, views, C, W, H), images to shift
thetas: tensor (batch size, views, 2), translation params
Returns:
new_images: tensor (batch size, views, C, W, H), warped images
"""
batch_size, n_views, channels, height, width = images.shape
images = images.view(-1, channels, height, width)
thetas = thetas.view(-1, 2)
new_images = shiftNet.transform(thetas, images, device=device)
return new_images.view(-1, n_views, channels, images.size(2), images.size(3))
def resize_batch_images(batch, fx=3, fy=3, interpolation=cv.INTER_CUBIC):
resized = torch.tensor([cv.resize(np.moveaxis(img.detach().cpu().numpy(), 0, 2), None,
fx=fx, fy=fy, interpolation=interpolation) for img in batch])
# The channel dimension was 1 and was lost by opencv...
if resized.ndim < batch.ndim:
b, w, h = resized.shape
return resized.view(b, 1, w, h)
return resized.permute([0, 3, 1, 2])
def save_per_sample_scores(val_score_lists, baseline_val_score_lists, val_names, filename):
out_dict = {}
for metric, batch_scores in val_score_lists.items():
out_dict[metric] = np.concatenate(batch_scores).tolist()
for metric, batch_scores in baseline_val_score_lists.items():
out_dict[metric] = np.concatenate(batch_scores).tolist()
out_dict['name'] = val_names
with open(filename, 'w') as out_file:
json.dump(out_dict, out_file)
def trainAndGetBestModel(fusion_model, regis_model, optimizer, dataloaders, config, perceptual_loss_model=None):
"""
Trains HRNet and ShiftNet for Multi-Frame Super Resolution (MFSR), and saves best model.
Args:
fusion_model: torch.model, HRNet
regis_model: torch.model, ShiftNet
optimizer: torch.optim, optimizer to minimize loss
dataloaders: dict, wraps train and validation dataloaders
config: dict, configuration file
perceptual_loss_model: model used for perceptual loss
"""
# Set params from config
num_epochs = config['training']['num_epochs']
batch_size = config['training']['batch_size']
loss_metric = config['training']['loss_metric']
val_metrics = config['training']['validation_metrics']
apply_correction = config['training']['apply_correction']
use_reg_regularisation = config['training']['use_reg_regularization']
lambda_ = config['training']['lambda']
use_kl_div_loss = config['training']['use_kl_div_loss']
eta_ = config['training']['eta']
upscale_factor = config['network']['upscale_factor']
reg_offset = config['training']['reg_offset']
plot_chnls = config['visualization']['channels_to_plot']
distribution_sampling_proba = config['visualization']['distribution_sampling_proba']
assert loss_metric in ['MAE', 'MSE', 'SSIM', 'MIXED']
# Logging
subfolder_pattern = 'batch_{}_time_{}'.format(batch_size, f"{datetime.datetime.now():%Y-%m-%d-%H-%M-%S-%f}")
if config['training']['wandb']:
wandb.watch(fusion_model)
wandb.watch(regis_model)
out_fusion = os.path.join(wandb.run.dir, 'HRNet.pth')
out_regis = os.path.join(wandb.run.dir, 'ShiftNet.pth')
out_val_scores = os.path.join(wandb.run.dir, 'val_scores.json')
else:
checkpoint_dir_run = os.path.join(config['paths']['checkpoint_dir'], subfolder_pattern)
scores_dir_run = os.path.join(config['paths']['scores_dir'], subfolder_pattern)
os.makedirs(checkpoint_dir_run, exist_ok=True)
os.makedirs(scores_dir_run, exist_ok=True)
out_fusion = os.path.join(checkpoint_dir_run, 'HRNet.pth')
out_regis = os.path.join(checkpoint_dir_run, 'ShiftNet.pth')
out_val_scores = os.path.join(scores_dir_run, 'val_scores.json')
tb_logging_dir = config['paths']['tb_log_file_dir']
logging_dir = os.path.join(tb_logging_dir, subfolder_pattern)
os.makedirs(logging_dir, exist_ok=True)
writer = SummaryWriter(logging_dir)
# Set backend
device = torch.device('cuda' if torch.cuda.is_available() and config['training']['use_gpu'] else 'cpu')
fusion_model.to(device)
regis_model.to(device)
# Iterate
best_score_loss = np.Inf
val_names_saved = False
val_names = deque()
for epoch in tqdm(range(0, num_epochs), desc='Epochs'):
# Set train mode
fusion_model.train()
regis_model.train()
# Reset epoch loss
train_loss = 0.
train_loss_reg = 0.
train_loss_kl = 0.
train_loss_perceptual = 0.
for sample in tqdm(dataloaders['train'], desc='Training iter. %d' % epoch):
# Reset parameter gradients
optimizer.zero_grad()
# Potentially transfer data to GPU
lrs = sample['lr'].float().to(device, non_blocking=True)
alphas = sample['alphas'].float().to(device, non_blocking=True)
lrs_last = lrs[np.arange(len(alphas)), torch.sum(alphas, dim=1, dtype=torch.int64) - 1]
hrs = sample['hr'].float().to(device, non_blocking=True)
# Fuse multiple frames into (B, 1, upscale_factor*W, upscale_factor*H)
srs = fusion_model(lrs, alphas)
batch, c, w, h = srs.shape
srs = srs.view(batch, 1, c, w, h)
# Register batch wrt HR
shifts = register_batch(
regis_model,
srs[:, :, :, reg_offset:-reg_offset, reg_offset:-reg_offset],
reference=hrs[:, :, reg_offset:-reg_offset, reg_offset:-reg_offset].view(-1, 1,
c,
h-2*reg_offset,
w-2*reg_offset))
srs_shifted = apply_shifts(regis_model, srs, shifts, device)[:, 0]
# Training loss
scores = calculate_metrics(hrs=hrs,
srs=srs_shifted,
metrics=loss_metric,
apply_correction=apply_correction)
loss = torch.mean(scores)
if loss_metric == 'SSIM':
loss = -1 * loss + 1
loss_registration = torch.mean(torch.linalg.norm(shifts, ord=2, dim=1))
if use_reg_regularisation:
loss += lambda_ * loss_registration
srs = srs.view(batch, c, w, h)
kl_losses = 0
if use_kl_div_loss:
for nc in np.arange(c):
mean_diffs = srs[:, nc, ...].mean(dim=(1, 2)) - lrs_last[:, nc, ...].mean(dim=(1, 2))
tmp_kl_loss = torch.abs(mean_diffs).mean()
loss += eta_ * tmp_kl_loss
kl_losses += tmp_kl_loss
del tmp_kl_loss
kl_losses /= c
# adding perceptual loss
if perceptual_loss_model:
feat_perceptual_loss, style_perceptual_loss = compute_perceptual_loss(hrs,
srs,
perceptual_loss_model)
perceptual_loss = feat_perceptual_loss + style_perceptual_loss
loss += config["perceptual_loss"]["weight"] * perceptual_loss
del feat_perceptual_loss, style_perceptual_loss
# Backprop
loss.backward()
optimizer.step()
# Scale loss so that epoch loss is the average of batch losses
num_batches = len(dataloaders['train'].dataset) / len(hrs)
train_loss += loss.detach().item() / num_batches
train_loss_reg += loss_registration.detach().item() / num_batches
train_loss_kl += kl_losses / num_batches
train_loss_perceptual += perceptual_loss.detach().item() / num_batches
# Try releasing some memory
del lrs, alphas, hrs, srs, srs_shifted, scores, loss, loss_registration, sample, kl_losses, perceptual_loss
gc.collect()
torch.cuda.empty_cache()
# Set eval mode
fusion_model.eval()
val_scores = defaultdict(float)
baseline_val_scores = defaultdict(float)
val_score_lists = defaultdict(list)
baseline_val_score_lists = defaultdict(list)
lrs_ref = None
hrs_ref = None
srs_ref = None
lin_interp_img = None
distribution_s2, distribution_deimos, distribution_sr = [], [], []
# Run validation
with torch.no_grad():
for sample in tqdm(dataloaders['val'], desc='Valid. iter. %d' % epoch):
# Potentially transfer data to GPU
lrs_cpu = sample['lr'].float()
hrs_cpu = sample['hr'].float()
lrs = lrs_cpu.to(device, non_blocking=True)
hrs = hrs_cpu.to(device, non_blocking=True)
alphas = sample['alphas'].float().to(device, non_blocking=True)
# Inference
srs = fusion_model(lrs, alphas)
if np.random.random() < distribution_sampling_proba: # sampling....
for lr, hr, sr, a in zip(lrs_cpu, hrs_cpu, srs.cpu().numpy(), sample['alphas']):
num_valid = torch.sum(a, dim=0, dtype=torch.int64).int()
distribution_s2.append(lr[:num_valid, ...])
distribution_deimos.append(np.expand_dims(hr, 0))
distribution_sr.append(np.expand_dims(sr, 0))
# Update scores
metrics = calculate_metrics(hrs, srs, val_metrics, apply_correction)
for metric, batch_scores in metrics.items():
batch_scores = batch_scores.cpu()
val_scores[metric] += torch.sum(batch_scores).item()
val_score_lists[metric].append(batch_scores.numpy().flatten())
# First val. iter.: add names, calculate baseline
if not val_names_saved:
val_names.append(sample['name'])
latest_s2_images = lrs_cpu[np.arange(len(alphas)), torch.sum(alphas, dim=1, dtype=torch.int64) - 1]
lin_interp_imgs = resize_batch_images(latest_s2_images, fx=upscale_factor, fy=upscale_factor)
baseline_metrics = calculate_metrics(hrs_cpu, lin_interp_imgs, val_metrics, apply_correction)
for metric, batch_scores in baseline_metrics.items():
batch_scores = batch_scores.cpu()
baseline_val_scores[f'{metric}_baseline'] += torch.sum(batch_scores).item()
baseline_val_score_lists[f'{metric}_baseline'].append(batch_scores.numpy().flatten())
del baseline_metrics
# Keep a reference for plotting
if lrs_ref is None:
lrs_ref = lrs_cpu[0].numpy()
hrs_ref = hrs_cpu[0].numpy()
lin_interp_img = lin_interp_imgs[0].numpy()
if srs_ref is None:
srs_ref = srs[0].cpu().numpy()
# Try releasing some memory
del lrs_cpu, hrs_cpu, lrs, alphas, hrs, srs, metrics, batch_scores, sample
gc.collect()
torch.cuda.empty_cache()
s2 = np.concatenate(distribution_s2)
deimos = np.concatenate(distribution_deimos)
sresolved = np.concatenate(distribution_sr)
# Compute the average scores per sample (note the sum instead of the mean above)
n = len(dataloaders['val'].dataset)
for metric in val_scores:
val_scores[metric] /= n
# Validation file identifiers
if not val_names_saved:
val_names = np.concatenate(val_names).tolist()
val_names_saved = True
for metric in baseline_val_scores:
baseline_val_scores[metric] /= n
# Save improved model
val_loss_metric = loss_metric if not use_kl_div_loss else 'SSIM'
val_scores_loss = val_scores[val_loss_metric]
if val_loss_metric == 'SSIM':
val_scores_loss = -1 * val_scores_loss + 1
if val_scores_loss < best_score_loss:
print('Saving model (val. loss has improved).')
torch.save(fusion_model.state_dict(), out_fusion)
torch.save(regis_model.state_dict(), out_regis)
save_per_sample_scores(val_score_lists, baseline_val_score_lists, val_names, out_val_scores)
best_score_loss = val_scores_loss
# Plotting
lrs = lrs_ref
srs = srs_ref
hrs = hrs_ref
normalized_srs = (srs - np.min(srs)) / np.max(srs)
normalized_plot = normalized_srs[plot_chnls, ...]
lrs_plot = np.array([normalize_plotting(x[plot_chnls, ...]) for x in lrs if np.any(x)])
error_map = hrs - srs
writer.add_image('SR Image', normalize_plotting(normalized_plot), epoch, dataformats='HWC')
writer.add_image('Error Map', normalize_plotting(error_map[plot_chnls, ...]), epoch, dataformats='HWC')
writer.add_image('HR GT', normalize_plotting(hrs[plot_chnls, ...]), epoch, dataformats='HWC')
writer.add_images('S2', np.moveaxis(lrs_plot, 3, 1), epoch, dataformats='NCHW')
writer.add_scalar('train/loss', train_loss, epoch)
for metric in val_metrics:
writer.add_scalar('val/%s' % metric.lower(), val_scores[metric], epoch)
# wandb
if config['training']['wandb']:
wandb.log({'Train loss': train_loss,
'Train loss registration': train_loss_reg,
'Train KL loss': train_loss_kl,
'Train loss perceptual': train_loss_perceptual}, step=epoch)
wandb.log({'sr': [wandb.Image(normalize_plotting(normalized_plot), caption='SR Image')]}, step=epoch)
wandb.log({'gt': [wandb.Image(normalize_plotting(hrs[plot_chnls, ...]), caption='HR GT')]}, step=epoch)
wandb.log({'S2': [wandb.Image(x, caption='S2 GT') for x in lrs_plot]}, step=epoch)
wandb.log({'S2 bilinear interpolation baseline': [wandb.Image(normalize_plotting(lin_interp_img[plot_chnls, ...]))]}, step=epoch)
wandb.log({'Distributions': [wandb.Image(normalize_plotting(hrs[plot_chnls, ...]), caption='HR GT')]}, step=epoch)
wandb.log({'Distribution Blue': [wandb.Image(distributions_plot(s2, deimos, sresolved, 0), caption='Band Blue')],
'Distribution Green': [wandb.Image(distributions_plot(s2, deimos, sresolved, 1), caption='Band Green')],
'Distributions Red': [wandb.Image(distributions_plot(s2, deimos, sresolved, 2), caption='Band Red')],
'DIstributions NIR': [wandb.Image(distributions_plot(s2, deimos, sresolved, 3), caption='Band NIR')]
}, step=epoch)
wandb.log(val_scores, step=epoch)
wandb.log(baseline_val_scores, step=epoch)
del lrs, srs, hrs, lrs_ref, srs_ref, hrs_ref
del val_scores, baseline_val_scores, val_score_lists, baseline_val_score_lists
gc.collect()
writer.close()
def main(
config, data_df, filesystem=None, country_norm_df=None, normalize=True, norm_deimos_npz=None, norm_s2_npz=None, perceptual_loss_model=None,
fusion_model = None, regis_model = None
):
"""
Given a configuration, trains HRNet and ShiftNet for Multi-Frame Super Resolution (MFSR), and saves best model.
Args:
config: dict, configuration file
"""
# Reproducibility options
seed = config['training']['seed']
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.enabled = True
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
channels_labels = config['training']['channels_labels']
channels_features = config['training']['channels_features']
lr_patch_size = config['training']['patch_size']
upscale_factor = config['network']['upscale_factor']
reg_offset = config['training']['reg_offset']
histogram_matching = config['training']['histogram_matching']
# Initialize the network based on the network configuration
if fusion_model is None:
fusion_model = HRNet(config["network"])
if regis_model is None:
regis_model = ShiftNet(in_channel=len(channels_labels),
patch_size=lr_patch_size*upscale_factor - 2*reg_offset)
optimizer = optim.Adam(list(fusion_model.parameters()) + list(regis_model.parameters()),
lr=config['training']['lr'])
data_directory = config['paths']['prefix']
# Dataloaders
batch_size = config['training']['batch_size']
n_workers = config['training']['n_workers']
n_views = config['training']['n_views']
use_augment = config['training']['augment']
aug_fn = partial(augment, permute_timestamps=False) if use_augment else None
# Train data loader
train_samples = data_df[data_df.train_test_validation == 'train'].singleton_npz_filename.values
train_dataset = ImagesetDataset(
imset_dir=data_directory,
imset_npz_files=train_samples,
time_first=True,
filesystem=filesystem,
country_norm_df=country_norm_df,
normalize=normalize,
norm_deimos_npz=norm_deimos_npz,
norm_s2_npz=norm_s2_npz,
channels_labels=channels_labels,
channels_feats=channels_features,
n_views=n_views,
padding='zeros',
transform=aug_fn,
histogram_matching=histogram_matching)
train_dataloader = DataLoader(
train_dataset,
batch_size=batch_size,
shuffle=True,
num_workers=n_workers,
pin_memory=True)
# Validation data loader
validation_samples = data_df[data_df.train_test_validation == 'validation'].singleton_npz_filename.values
val_dataset = ImagesetDataset(
imset_dir=data_directory,
imset_npz_files=validation_samples,
time_first=True,
filesystem=filesystem,
country_norm_df=country_norm_df,
normalize=normalize,
norm_deimos_npz=norm_deimos_npz,
norm_s2_npz=norm_s2_npz,
channels_labels=channels_labels,
channels_feats=channels_features,
n_views=n_views,
padding='zeros',
transform=None,
histogram_matching=False)
val_dataloader = DataLoader(
val_dataset,
batch_size=batch_size,
shuffle=False,
num_workers=n_workers,
pin_memory=True)
dataloaders = {'train': train_dataloader, 'val': val_dataloader}
# Train model
torch.cuda.empty_cache()
trainAndGetBestModel(fusion_model, regis_model, optimizer, dataloaders, config, perceptual_loss_model)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--config', help='path of the config file', default='config/config.json')
args = parser.parse_args()
assert os.path.isfile(args.config)
with open(args.config, 'r') as read_file:
config = json.load(read_file)
main(config)
| [
1,
9995,
5132,
2471,
304,
7945,
379,
29934,
6779,
718,
9500,
6779,
363,
2473,
3515,
2428,
10104,
313,
29924,
9998,
29934,
29897,
29871,
13,
13,
15507,
1169,
29901,
13,
4013,
775,
338,
23430,
515,
10619,
23869,
29915,
29879,
5057,
1666,
29899,
6779,
29901,
2045,
597,
3292,
29889,
510,
29914,
2642,
23869,
29914,
16382,
1666,
29899,
1212,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
5215,
330,
29883,
13,
5215,
4390,
13,
5215,
1852,
5510,
13,
5215,
12865,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
3166,
16250,
1053,
2322,
8977,
29892,
316,
802,
13,
13,
5215,
12655,
408,
7442,
13,
13,
5215,
13850,
29906,
408,
13850,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
20640,
408,
5994,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
13,
3166,
27236,
29889,
2527,
10817,
1053,
8147,
29918,
2527,
10817,
13,
3166,
22157,
1212,
29889,
4351,
29889,
2772,
1022,
13724,
29879,
29889,
20938,
6779,
1053,
379,
29934,
6779,
13,
3166,
22157,
1212,
29889,
4351,
29889,
2772,
1022,
13724,
29879,
29889,
29657,
6779,
1053,
1383,
2027,
6779,
13,
3166,
22157,
1212,
29889,
4351,
29889,
13239,
1053,
4226,
675,
29918,
5317,
1259,
13,
3166,
22157,
1212,
29889,
4351,
29889,
13239,
1053,
18822,
29918,
5317,
13,
3166,
27236,
29889,
1272,
29918,
12657,
1053,
1954,
1179,
300,
16390,
24541,
29892,
18765,
13,
3166,
27236,
29889,
2527,
10817,
1053,
10272,
29918,
546,
1547,
950,
29918,
6758,
13,
13,
3166,
260,
29939,
18933,
29889,
6921,
1053,
260,
29939,
18933,
13,
3166,
12489,
3377,
29990,
1053,
6991,
5219,
10507,
13,
5215,
24706,
29890,
13,
13,
13,
1753,
6036,
29918,
16175,
29898,
10889,
6779,
29892,
301,
2288,
29892,
3407,
1125,
13,
1678,
9995,
13,
1678,
12577,
29879,
4558,
2750,
9282,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
9500,
6779,
29901,
4842,
305,
29889,
4299,
13,
4706,
301,
2288,
29901,
12489,
313,
16175,
2159,
29892,
8386,
29892,
315,
29892,
399,
29892,
379,
511,
4558,
304,
9500,
13,
4706,
3407,
29901,
12489,
313,
16175,
2159,
29892,
29871,
29896,
29892,
315,
29892,
399,
29892,
379,
511,
3407,
4558,
304,
9500,
13,
1678,
16969,
29901,
13,
4706,
278,
29873,
294,
29901,
12489,
313,
16175,
2159,
29892,
8386,
29892,
29871,
29906,
29897,
13,
1678,
9995,
13,
13,
1678,
302,
29918,
7406,
353,
301,
2288,
29889,
2311,
29898,
29896,
29897,
13,
1678,
278,
29873,
294,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29918,
7406,
1125,
13,
4706,
396,
3462,
9282,
408,
8386,
13,
4706,
3022,
630,
353,
4842,
305,
29889,
4117,
4197,
5679,
29892,
301,
2288,
7503,
29892,
474,
29901,
29875,
718,
29871,
29896,
20526,
29871,
29896,
29897,
13,
4706,
278,
941,
353,
9500,
6779,
29898,
535,
29883,
630,
29897,
13,
4706,
278,
29873,
294,
29889,
4397,
29898,
3416,
29897,
13,
13,
1678,
278,
29873,
294,
353,
4842,
305,
29889,
1429,
29898,
386,
300,
294,
29892,
29871,
29896,
29897,
13,
1678,
736,
278,
29873,
294,
13,
13,
13,
1753,
3394,
29918,
845,
17741,
29898,
10889,
6779,
29892,
4558,
29892,
278,
29873,
294,
29892,
4742,
1125,
13,
1678,
9995,
13,
1678,
2401,
3687,
1014,
29899,
29886,
15711,
5578,
800,
304,
4558,
411,
18273,
2067,
359,
29694,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
9500,
6779,
29901,
4842,
305,
29889,
4299,
13,
4706,
4558,
29901,
12489,
313,
16175,
2159,
29892,
8386,
29892,
315,
29892,
399,
29892,
379,
511,
4558,
304,
9500,
13,
4706,
278,
29873,
294,
29901,
12489,
313,
16175,
2159,
29892,
8386,
29892,
29871,
29906,
511,
13962,
8636,
13,
1678,
16969,
29901,
13,
4706,
716,
29918,
8346,
29901,
12489,
313,
16175,
2159,
29892,
8386,
29892,
315,
29892,
399,
29892,
379,
511,
1370,
9795,
4558,
13,
1678,
9995,
13,
13,
1678,
9853,
29918,
2311,
29892,
302,
29918,
7406,
29892,
18196,
29892,
3171,
29892,
2920,
353,
4558,
29889,
12181,
13,
1678,
4558,
353,
4558,
29889,
1493,
6278,
29896,
29892,
18196,
29892,
3171,
29892,
2920,
29897,
13,
1678,
278,
29873,
294,
353,
278,
29873,
294,
29889,
1493,
6278,
29896,
29892,
29871,
29906,
29897,
13,
13,
1678,
716,
29918,
8346,
353,
9500,
6779,
29889,
9067,
29898,
386,
300,
294,
29892,
4558,
29892,
4742,
29922,
10141,
29897,
13,
13,
1678,
736,
716,
29918,
8346,
29889,
1493,
6278,
29896,
29892,
302,
29918,
7406,
29892,
18196,
29892,
4558,
29889,
2311,
29898,
29906,
511,
4558,
29889,
2311,
29898,
29941,
876,
13,
13,
13,
1753,
19490,
29918,
16175,
29918,
8346,
29898,
16175,
29892,
285,
29916,
29922,
29941,
29892,
285,
29891,
29922,
29941,
29892,
29694,
29922,
11023,
29889,
23845,
29918,
29907,
7466,
2965,
1125,
13,
1678,
620,
1891,
353,
4842,
305,
29889,
20158,
4197,
11023,
29889,
21476,
29898,
9302,
29889,
11631,
8990,
29898,
2492,
29889,
4801,
496,
2141,
21970,
2141,
23749,
3285,
29871,
29900,
29892,
29871,
29906,
511,
6213,
29892,
13,
462,
9651,
285,
29916,
29922,
11093,
29892,
285,
29891,
29922,
29888,
29891,
29892,
29694,
29922,
1639,
3733,
362,
29897,
363,
10153,
297,
9853,
2314,
13,
13,
1678,
396,
450,
8242,
9927,
471,
29871,
29896,
322,
471,
5714,
491,
1722,
11023,
856,
13,
1678,
565,
620,
1891,
29889,
299,
326,
529,
9853,
29889,
299,
326,
29901,
13,
4706,
289,
29892,
281,
29892,
298,
353,
620,
1891,
29889,
12181,
13,
4706,
736,
620,
1891,
29889,
1493,
29898,
29890,
29892,
29871,
29896,
29892,
281,
29892,
298,
29897,
13,
13,
1678,
736,
620,
1891,
29889,
17858,
1082,
4197,
29900,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29906,
2314,
13,
13,
13,
1753,
4078,
29918,
546,
29918,
11249,
29918,
1557,
2361,
29898,
791,
29918,
13628,
29918,
21513,
29892,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
29892,
659,
29918,
7039,
29892,
10422,
1125,
13,
1678,
714,
29918,
8977,
353,
6571,
13,
13,
1678,
363,
12714,
29892,
9853,
29918,
1557,
2361,
297,
659,
29918,
13628,
29918,
21513,
29889,
7076,
7295,
13,
4706,
714,
29918,
8977,
29961,
16414,
29962,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
16175,
29918,
1557,
2361,
467,
25027,
391,
580,
13,
13,
1678,
363,
12714,
29892,
9853,
29918,
1557,
2361,
297,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
29889,
7076,
7295,
13,
4706,
714,
29918,
8977,
29961,
16414,
29962,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
16175,
29918,
1557,
2361,
467,
25027,
391,
580,
13,
13,
1678,
714,
29918,
8977,
1839,
978,
2033,
353,
659,
29918,
7039,
13,
13,
1678,
411,
1722,
29898,
9507,
29892,
525,
29893,
1495,
408,
714,
29918,
1445,
29901,
13,
4706,
4390,
29889,
15070,
29898,
449,
29918,
8977,
29892,
714,
29918,
1445,
29897,
13,
13,
13,
1753,
7945,
2855,
2577,
25353,
3195,
29898,
29888,
3958,
29918,
4299,
29892,
1072,
275,
29918,
4299,
29892,
5994,
3950,
29892,
1418,
7003,
24574,
29892,
2295,
29892,
639,
1547,
950,
29918,
6758,
29918,
4299,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
3201,
1144,
379,
29934,
6779,
322,
1383,
2027,
6779,
363,
14974,
29899,
4308,
5670,
24062,
918,
313,
29924,
9998,
29934,
511,
322,
27401,
1900,
1904,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
21736,
29918,
4299,
29901,
4842,
305,
29889,
4299,
29892,
379,
29934,
6779,
13,
4706,
1072,
275,
29918,
4299,
29901,
4842,
305,
29889,
4299,
29892,
1383,
2027,
6779,
13,
4706,
5994,
3950,
29901,
4842,
305,
29889,
20640,
29892,
5994,
3950,
304,
6260,
675,
6410,
13,
4706,
1418,
7003,
24574,
29901,
9657,
29892,
11463,
567,
7945,
322,
8845,
1418,
7003,
24574,
13,
4706,
2295,
29901,
9657,
29892,
5285,
934,
13,
4706,
639,
1547,
950,
29918,
6758,
29918,
4299,
29901,
1904,
1304,
363,
639,
1547,
950,
6410,
29871,
13,
1678,
9995,
13,
13,
1678,
396,
3789,
8636,
515,
2295,
13,
1678,
954,
29918,
1022,
2878,
29879,
353,
2295,
1839,
26495,
16215,
1949,
29918,
1022,
2878,
29879,
2033,
13,
1678,
9853,
29918,
2311,
353,
2295,
1839,
26495,
16215,
16175,
29918,
2311,
2033,
13,
1678,
6410,
29918,
16414,
353,
2295,
1839,
26495,
16215,
6758,
29918,
16414,
2033,
13,
1678,
659,
29918,
2527,
10817,
353,
2295,
1839,
26495,
16215,
18157,
29918,
2527,
10817,
2033,
13,
1678,
3394,
29918,
2616,
276,
428,
353,
2295,
1839,
26495,
16215,
7302,
29918,
2616,
276,
428,
2033,
13,
1678,
671,
29918,
1727,
29918,
15227,
4371,
353,
2295,
1839,
26495,
16215,
1509,
29918,
1727,
29918,
15227,
2133,
2033,
13,
1678,
14013,
29918,
353,
2295,
1839,
26495,
16215,
2892,
2033,
13,
1678,
671,
29918,
6321,
29918,
4563,
29918,
6758,
353,
2295,
1839,
26495,
16215,
1509,
29918,
6321,
29918,
4563,
29918,
6758,
2033,
13,
1678,
634,
29874,
29918,
353,
2295,
1839,
26495,
16215,
1187,
2033,
13,
1678,
24081,
29883,
744,
29918,
19790,
353,
2295,
1839,
11618,
16215,
14340,
29883,
744,
29918,
19790,
2033,
13,
13,
1678,
1072,
29918,
10289,
353,
2295,
1839,
26495,
16215,
1727,
29918,
10289,
2033,
13,
1678,
6492,
29918,
3049,
3137,
353,
2295,
1839,
20119,
2133,
16215,
305,
12629,
29918,
517,
29918,
5317,
2033,
13,
1678,
4978,
29918,
13445,
10335,
29918,
771,
2291,
353,
2295,
1839,
20119,
2133,
16215,
27691,
29918,
13445,
10335,
29918,
771,
2291,
2033,
13,
13,
1678,
4974,
6410,
29918,
16414,
297,
6024,
1529,
29923,
742,
525,
29924,
1660,
742,
525,
1799,
7833,
742,
525,
29924,
6415,
3352,
2033,
13,
13,
1678,
396,
4522,
3460,
13,
1678,
1014,
12083,
29918,
11037,
353,
525,
16175,
648,
2403,
2230,
648,
29913,
4286,
4830,
29898,
16175,
29918,
2311,
29892,
285,
29908,
29912,
12673,
29889,
12673,
29889,
3707,
7295,
29995,
29979,
19222,
29885,
19222,
29881,
19222,
29950,
19222,
29924,
19222,
29903,
19222,
29888,
27195,
13,
13,
1678,
565,
2295,
1839,
26495,
16215,
18622,
29890,
2033,
29901,
13,
4706,
24706,
29890,
29889,
12344,
29898,
29888,
3958,
29918,
4299,
29897,
13,
4706,
24706,
29890,
29889,
12344,
29898,
1727,
275,
29918,
4299,
29897,
13,
13,
4706,
714,
29918,
29888,
3958,
353,
2897,
29889,
2084,
29889,
7122,
29898,
18622,
29890,
29889,
3389,
29889,
3972,
29892,
525,
20938,
6779,
29889,
29886,
386,
1495,
13,
4706,
714,
29918,
1727,
275,
353,
2897,
29889,
2084,
29889,
7122,
29898,
18622,
29890,
29889,
3389,
29889,
3972,
29892,
525,
29657,
6779,
29889,
29886,
386,
1495,
13,
4706,
714,
29918,
791,
29918,
1557,
2361,
353,
2897,
29889,
2084,
29889,
7122,
29898,
18622,
29890,
29889,
3389,
29889,
3972,
29892,
525,
791,
29918,
1557,
2361,
29889,
3126,
1495,
13,
1678,
1683,
29901,
13,
4706,
1423,
3149,
29918,
3972,
29918,
3389,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
1839,
24772,
16215,
3198,
3149,
29918,
3972,
7464,
1014,
12083,
29918,
11037,
29897,
13,
4706,
19435,
29918,
3972,
29918,
3389,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
1839,
24772,
16215,
1557,
2361,
29918,
3972,
7464,
1014,
12083,
29918,
11037,
29897,
13,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
3198,
3149,
29918,
3972,
29918,
3389,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
1557,
2361,
29918,
3972,
29918,
3389,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
13,
4706,
714,
29918,
29888,
3958,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3198,
3149,
29918,
3972,
29918,
3389,
29892,
525,
20938,
6779,
29889,
29886,
386,
1495,
13,
4706,
714,
29918,
1727,
275,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3198,
3149,
29918,
3972,
29918,
3389,
29892,
525,
29657,
6779,
29889,
29886,
386,
1495,
13,
4706,
714,
29918,
791,
29918,
1557,
2361,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1557,
2361,
29918,
3972,
29918,
3389,
29892,
525,
791,
29918,
1557,
2361,
29889,
3126,
1495,
13,
13,
1678,
260,
29890,
29918,
21027,
29918,
3972,
353,
2295,
1839,
24772,
16215,
22625,
29918,
1188,
29918,
1445,
29918,
3972,
2033,
13,
1678,
12183,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
22625,
29918,
21027,
29918,
3972,
29892,
1014,
12083,
29918,
11037,
29897,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
21027,
29918,
3972,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
13,
1678,
9227,
353,
6991,
5219,
10507,
29898,
21027,
29918,
3972,
29897,
13,
13,
1678,
396,
3789,
14998,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
877,
29883,
6191,
29915,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
322,
2295,
1839,
26495,
16215,
1509,
29918,
29887,
3746,
2033,
1683,
525,
21970,
1495,
13,
13,
1678,
21736,
29918,
4299,
29889,
517,
29898,
10141,
29897,
13,
1678,
1072,
275,
29918,
4299,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
396,
20504,
403,
13,
1678,
1900,
29918,
13628,
29918,
6758,
353,
7442,
29889,
25433,
13,
1678,
659,
29918,
7039,
29918,
17314,
353,
7700,
13,
1678,
659,
29918,
7039,
353,
316,
802,
580,
13,
268,
13,
1678,
363,
21502,
305,
297,
260,
29939,
18933,
29898,
3881,
29898,
29900,
29892,
954,
29918,
1022,
2878,
29879,
511,
5153,
2433,
29923,
1129,
12168,
29374,
13,
4706,
396,
3789,
7945,
4464,
13,
4706,
21736,
29918,
4299,
29889,
14968,
580,
13,
4706,
1072,
275,
29918,
4299,
29889,
14968,
580,
13,
13,
4706,
396,
2538,
300,
21502,
305,
6410,
13,
4706,
7945,
29918,
6758,
353,
29871,
29900,
29889,
13,
4706,
7945,
29918,
6758,
29918,
1727,
353,
29871,
29900,
29889,
13,
4706,
7945,
29918,
6758,
29918,
6321,
353,
29871,
29900,
29889,
13,
4706,
7945,
29918,
6758,
29918,
546,
1547,
950,
353,
29871,
29900,
29889,
29871,
13,
13,
4706,
363,
4559,
297,
260,
29939,
18933,
29898,
29881,
2075,
29877,
24574,
1839,
14968,
7464,
5153,
2433,
5323,
2827,
4256,
29889,
1273,
29881,
29915,
1273,
21502,
305,
1125,
13,
9651,
396,
2538,
300,
3443,
4656,
10070,
13,
9651,
5994,
3950,
29889,
9171,
29918,
5105,
580,
13,
13,
9651,
396,
10173,
9247,
6782,
848,
304,
22796,
13,
9651,
301,
2288,
353,
4559,
1839,
29212,
13359,
7411,
2141,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
9651,
394,
16130,
353,
4559,
1839,
284,
16130,
13359,
7411,
2141,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
9651,
301,
2288,
29918,
4230,
353,
301,
2288,
29961,
9302,
29889,
279,
927,
29898,
2435,
29898,
284,
16130,
8243,
4842,
305,
29889,
2083,
29898,
284,
16130,
29892,
3964,
29922,
29896,
29892,
26688,
29922,
7345,
305,
29889,
524,
29953,
29946,
29897,
448,
29871,
29896,
29962,
13,
9651,
298,
2288,
353,
4559,
1839,
1092,
13359,
7411,
2141,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
13,
9651,
396,
383,
1509,
2999,
16608,
964,
313,
29933,
29892,
29871,
29896,
29892,
24081,
29883,
744,
29918,
19790,
29930,
29956,
29892,
24081,
29883,
744,
29918,
19790,
29930,
29950,
29897,
13,
9651,
269,
2288,
353,
21736,
29918,
4299,
29898,
29880,
2288,
29892,
394,
16130,
29897,
13,
9651,
9853,
29892,
274,
29892,
281,
29892,
298,
353,
269,
2288,
29889,
12181,
13,
9651,
269,
2288,
353,
269,
2288,
29889,
1493,
29898,
16175,
29892,
29871,
29896,
29892,
274,
29892,
281,
29892,
298,
29897,
13,
632,
13,
9651,
396,
12577,
9853,
281,
2273,
379,
29934,
13,
9651,
528,
17741,
353,
6036,
29918,
16175,
29898,
13,
18884,
1072,
275,
29918,
4299,
29892,
13,
18884,
269,
2288,
7503,
29892,
584,
29892,
584,
29892,
1072,
29918,
10289,
13018,
1727,
29918,
10289,
29892,
1072,
29918,
10289,
13018,
1727,
29918,
10289,
1402,
13,
18884,
3407,
29922,
1092,
29879,
7503,
29892,
584,
29892,
1072,
29918,
10289,
13018,
1727,
29918,
10289,
29892,
1072,
29918,
10289,
13018,
1727,
29918,
10289,
1822,
1493,
6278,
29896,
29892,
29871,
29896,
29892,
13,
462,
462,
462,
462,
462,
308,
274,
29892,
13,
462,
462,
462,
462,
462,
308,
298,
29899,
29906,
29930,
1727,
29918,
10289,
29892,
13,
462,
462,
462,
462,
462,
308,
281,
29899,
29906,
29930,
1727,
29918,
10289,
876,
13,
13,
9651,
269,
2288,
29918,
10889,
287,
353,
3394,
29918,
845,
17741,
29898,
1727,
275,
29918,
4299,
29892,
269,
2288,
29892,
528,
17741,
29892,
4742,
29897,
7503,
29892,
29871,
29900,
29962,
13,
13,
9651,
396,
26101,
6410,
13,
9651,
19435,
353,
8147,
29918,
2527,
10817,
29898,
1092,
29879,
29922,
1092,
29879,
29892,
13,
462,
462,
539,
269,
2288,
29922,
29879,
2288,
29918,
10889,
287,
29892,
13,
462,
462,
539,
21556,
29922,
6758,
29918,
16414,
29892,
13,
462,
462,
539,
3394,
29918,
2616,
276,
428,
29922,
7302,
29918,
2616,
276,
428,
29897,
13,
9651,
6410,
353,
4842,
305,
29889,
12676,
29898,
1557,
2361,
29897,
13,
632,
13,
9651,
565,
6410,
29918,
16414,
1275,
525,
1799,
7833,
2396,
13,
18884,
6410,
353,
448,
29896,
334,
6410,
718,
29871,
29896,
13,
13,
9651,
6410,
29918,
1727,
8306,
353,
4842,
305,
29889,
12676,
29898,
7345,
305,
29889,
29880,
979,
29887,
29889,
12324,
29898,
845,
17741,
29892,
4356,
29922,
29906,
29892,
3964,
29922,
29896,
876,
13,
9651,
13,
9651,
565,
671,
29918,
1727,
29918,
15227,
4371,
29901,
13,
18884,
6410,
4619,
14013,
29918,
334,
6410,
29918,
1727,
8306,
13,
13,
9651,
269,
2288,
353,
269,
2288,
29889,
1493,
29898,
16175,
29892,
274,
29892,
281,
29892,
298,
29897,
13,
13,
9651,
9489,
29918,
6758,
267,
353,
29871,
29900,
13,
9651,
565,
671,
29918,
6321,
29918,
4563,
29918,
6758,
29901,
13,
18884,
363,
302,
29883,
297,
7442,
29889,
279,
927,
29898,
29883,
1125,
13,
462,
1678,
2099,
29918,
12765,
29879,
353,
269,
2288,
7503,
29892,
302,
29883,
29892,
2023,
1822,
12676,
29898,
6229,
7607,
29896,
29892,
29871,
29906,
876,
448,
301,
2288,
29918,
4230,
7503,
29892,
302,
29883,
29892,
2023,
1822,
12676,
29898,
6229,
7607,
29896,
29892,
29871,
29906,
876,
13,
462,
1678,
13128,
29918,
6321,
29918,
6758,
353,
4842,
305,
29889,
6897,
29898,
12676,
29918,
12765,
29879,
467,
12676,
580,
13,
462,
1678,
6410,
4619,
634,
29874,
29918,
334,
13128,
29918,
6321,
29918,
6758,
13,
462,
1678,
9489,
29918,
6758,
267,
4619,
13128,
29918,
6321,
29918,
6758,
13,
462,
1678,
628,
13128,
29918,
6321,
29918,
6758,
13,
18884,
9489,
29918,
6758,
267,
847,
29922,
274,
13,
13,
9651,
396,
4417,
639,
1547,
950,
6410,
29871,
13,
9651,
565,
639,
1547,
950,
29918,
6758,
29918,
4299,
29901,
29871,
13,
18884,
1238,
271,
29918,
546,
1547,
950,
29918,
6758,
29892,
3114,
29918,
546,
1547,
950,
29918,
6758,
353,
10272,
29918,
546,
1547,
950,
29918,
6758,
29898,
1092,
29879,
29892,
29871,
13,
462,
462,
462,
462,
462,
418,
269,
2288,
29892,
29871,
13,
462,
462,
462,
462,
462,
418,
639,
1547,
950,
29918,
6758,
29918,
4299,
29897,
13,
18884,
639,
1547,
950,
29918,
6758,
29871,
353,
1238,
271,
29918,
546,
1547,
950,
29918,
6758,
718,
3114,
29918,
546,
1547,
950,
29918,
6758,
13,
18884,
6410,
4619,
2295,
3366,
546,
1547,
950,
29918,
6758,
3108,
3366,
7915,
3108,
334,
639,
1547,
950,
29918,
6758,
13,
18884,
628,
1238,
271,
29918,
546,
1547,
950,
29918,
6758,
29892,
3114,
29918,
546,
1547,
950,
29918,
6758,
13,
462,
13,
9651,
396,
7437,
7728,
13,
9651,
6410,
29889,
1627,
1328,
580,
13,
9651,
5994,
3950,
29889,
10568,
580,
13,
13,
9651,
396,
2522,
744,
6410,
577,
393,
21502,
305,
6410,
338,
278,
6588,
310,
9853,
28495,
13,
9651,
954,
29918,
16175,
267,
353,
7431,
29898,
29881,
2075,
29877,
24574,
1839,
14968,
13359,
24713,
29897,
847,
7431,
29898,
1092,
29879,
29897,
13,
9651,
7945,
29918,
6758,
4619,
6410,
29889,
4801,
496,
2141,
667,
580,
847,
954,
29918,
16175,
267,
13,
9651,
7945,
29918,
6758,
29918,
1727,
4619,
6410,
29918,
1727,
8306,
29889,
4801,
496,
2141,
667,
580,
847,
954,
29918,
16175,
267,
13,
9651,
7945,
29918,
6758,
29918,
6321,
4619,
9489,
29918,
6758,
267,
847,
954,
29918,
16175,
267,
13,
9651,
7945,
29918,
6758,
29918,
546,
1547,
950,
4619,
639,
1547,
950,
29918,
6758,
29889,
4801,
496,
2141,
667,
580,
847,
954,
29918,
16175,
267,
13,
13,
9651,
396,
3967,
337,
280,
5832,
777,
3370,
13,
9651,
628,
301,
2288,
29892,
394,
16130,
29892,
298,
2288,
29892,
269,
2288,
29892,
269,
2288,
29918,
10889,
287,
29892,
19435,
29892,
6410,
29892,
6410,
29918,
1727,
8306,
29892,
4559,
29892,
9489,
29918,
6758,
267,
29892,
639,
1547,
950,
29918,
6758,
13,
9651,
330,
29883,
29889,
15914,
580,
13,
9651,
4842,
305,
29889,
29883,
6191,
29889,
6310,
29918,
8173,
580,
13,
13,
4706,
396,
3789,
19745,
4464,
13,
4706,
21736,
29918,
4299,
29889,
14513,
580,
13,
13,
4706,
659,
29918,
1557,
2361,
353,
2322,
8977,
29898,
7411,
29897,
13,
4706,
2362,
5570,
29918,
791,
29918,
1557,
2361,
353,
2322,
8977,
29898,
7411,
29897,
13,
13,
4706,
659,
29918,
13628,
29918,
21513,
353,
2322,
8977,
29898,
1761,
29897,
13,
4706,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
353,
2322,
8977,
29898,
1761,
29897,
13,
13,
4706,
301,
2288,
29918,
999,
353,
6213,
13,
4706,
298,
2288,
29918,
999,
353,
6213,
13,
4706,
269,
2288,
29918,
999,
353,
6213,
13,
4706,
6276,
29918,
1639,
29886,
29918,
2492,
353,
6213,
13,
4706,
4978,
29918,
29879,
29906,
29892,
4978,
29918,
311,
18594,
29892,
4978,
29918,
21935,
353,
19997,
19997,
5159,
29871,
13,
13,
4706,
396,
7525,
8845,
13,
4706,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
9651,
363,
4559,
297,
260,
29939,
18933,
29898,
29881,
2075,
29877,
24574,
1839,
791,
7464,
5153,
2433,
7211,
29889,
4256,
29889,
1273,
29881,
29915,
1273,
21502,
305,
1125,
13,
18884,
396,
10173,
9247,
6782,
848,
304,
22796,
13,
18884,
301,
2288,
29918,
21970,
353,
4559,
1839,
29212,
13359,
7411,
580,
13,
18884,
298,
2288,
29918,
21970,
353,
4559,
1839,
1092,
13359,
7411,
580,
13,
13,
18884,
301,
2288,
353,
301,
2288,
29918,
21970,
29889,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
18884,
298,
2288,
353,
298,
2288,
29918,
21970,
29889,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
18884,
394,
16130,
353,
4559,
1839,
284,
16130,
13359,
7411,
2141,
517,
29898,
10141,
29892,
1661,
29918,
1271,
292,
29922,
5574,
29897,
13,
13,
18884,
396,
512,
1659,
13,
18884,
269,
2288,
353,
21736,
29918,
4299,
29898,
29880,
2288,
29892,
394,
16130,
29897,
13,
462,
13,
18884,
565,
7442,
29889,
8172,
29889,
8172,
580,
529,
4978,
29918,
13445,
10335,
29918,
771,
2291,
29901,
396,
23460,
3045,
13,
462,
1678,
363,
301,
29878,
29892,
22157,
29892,
27236,
29892,
263,
297,
14319,
29898,
29880,
2288,
29918,
21970,
29892,
298,
2288,
29918,
21970,
29892,
269,
2288,
29889,
21970,
2141,
23749,
3285,
4559,
1839,
284,
16130,
2033,
1125,
13,
462,
4706,
954,
29918,
3084,
353,
4842,
305,
29889,
2083,
29898,
29874,
29892,
3964,
29922,
29900,
29892,
26688,
29922,
7345,
305,
29889,
524,
29953,
29946,
467,
524,
580,
13,
462,
4706,
4978,
29918,
29879,
29906,
29889,
4397,
29898,
29212,
7503,
1949,
29918,
3084,
29892,
2023,
2314,
13,
462,
4706,
4978,
29918,
311,
18594,
29889,
4397,
29898,
9302,
29889,
18837,
29918,
6229,
29879,
29898,
1092,
29892,
29871,
29900,
876,
13,
462,
4706,
4978,
29918,
21935,
29889,
4397,
29898,
9302,
29889,
18837,
29918,
6229,
29879,
29898,
21935,
29892,
29871,
29900,
876,
13,
462,
308,
13,
462,
13,
18884,
396,
10318,
19435,
13,
18884,
21556,
353,
8147,
29918,
2527,
10817,
29898,
1092,
29879,
29892,
269,
2288,
29892,
659,
29918,
2527,
10817,
29892,
3394,
29918,
2616,
276,
428,
29897,
13,
18884,
363,
12714,
29892,
9853,
29918,
1557,
2361,
297,
21556,
29889,
7076,
7295,
13,
462,
1678,
9853,
29918,
1557,
2361,
353,
9853,
29918,
1557,
2361,
29889,
21970,
580,
13,
462,
1678,
659,
29918,
1557,
2361,
29961,
16414,
29962,
4619,
4842,
305,
29889,
2083,
29898,
16175,
29918,
1557,
2361,
467,
667,
580,
13,
462,
1678,
659,
29918,
13628,
29918,
21513,
29961,
16414,
1822,
4397,
29898,
16175,
29918,
1557,
2361,
29889,
23749,
2141,
1579,
8606,
3101,
13,
13,
18884,
396,
3824,
659,
29889,
4256,
4898,
788,
2983,
29892,
8147,
2362,
5570,
13,
18884,
565,
451,
659,
29918,
7039,
29918,
17314,
29901,
13,
462,
1678,
659,
29918,
7039,
29889,
4397,
29898,
11249,
1839,
978,
11287,
13,
13,
462,
1678,
9281,
29918,
29879,
29906,
29918,
8346,
353,
301,
2288,
29918,
21970,
29961,
9302,
29889,
279,
927,
29898,
2435,
29898,
284,
16130,
8243,
4842,
305,
29889,
2083,
29898,
284,
16130,
29892,
3964,
29922,
29896,
29892,
26688,
29922,
7345,
305,
29889,
524,
29953,
29946,
29897,
448,
29871,
29896,
29962,
13,
462,
1678,
6276,
29918,
1639,
29886,
29918,
2492,
29879,
353,
19490,
29918,
16175,
29918,
8346,
29898,
12333,
29918,
29879,
29906,
29918,
8346,
29892,
285,
29916,
29922,
14340,
29883,
744,
29918,
19790,
29892,
285,
29891,
29922,
14340,
29883,
744,
29918,
19790,
29897,
13,
462,
1678,
2362,
5570,
29918,
2527,
10817,
353,
8147,
29918,
2527,
10817,
29898,
1092,
29879,
29918,
21970,
29892,
6276,
29918,
1639,
29886,
29918,
2492,
29879,
29892,
659,
29918,
2527,
10817,
29892,
3394,
29918,
2616,
276,
428,
29897,
13,
13,
462,
1678,
363,
12714,
29892,
9853,
29918,
1557,
2361,
297,
2362,
5570,
29918,
2527,
10817,
29889,
7076,
7295,
13,
462,
4706,
9853,
29918,
1557,
2361,
353,
9853,
29918,
1557,
2361,
29889,
21970,
580,
13,
462,
4706,
2362,
5570,
29918,
791,
29918,
1557,
2361,
29961,
29888,
29915,
29912,
16414,
2403,
6500,
5570,
2033,
4619,
4842,
305,
29889,
2083,
29898,
16175,
29918,
1557,
2361,
467,
667,
580,
13,
462,
4706,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
29961,
29888,
29915,
29912,
16414,
2403,
6500,
5570,
13359,
4397,
29898,
16175,
29918,
1557,
2361,
29889,
23749,
2141,
1579,
8606,
3101,
13,
13,
462,
1678,
628,
2362,
5570,
29918,
2527,
10817,
13,
13,
18884,
396,
19152,
263,
3407,
363,
6492,
1259,
13,
18884,
565,
301,
2288,
29918,
999,
338,
6213,
29901,
13,
462,
1678,
301,
2288,
29918,
999,
353,
301,
2288,
29918,
21970,
29961,
29900,
1822,
23749,
580,
13,
462,
1678,
298,
2288,
29918,
999,
353,
298,
2288,
29918,
21970,
29961,
29900,
1822,
23749,
580,
13,
462,
1678,
6276,
29918,
1639,
29886,
29918,
2492,
353,
6276,
29918,
1639,
29886,
29918,
2492,
29879,
29961,
29900,
1822,
23749,
580,
13,
13,
18884,
565,
269,
2288,
29918,
999,
338,
6213,
29901,
13,
462,
1678,
269,
2288,
29918,
999,
353,
269,
2288,
29961,
29900,
1822,
21970,
2141,
23749,
580,
13,
13,
18884,
396,
3967,
337,
280,
5832,
777,
3370,
13,
18884,
628,
301,
2288,
29918,
21970,
29892,
298,
2288,
29918,
21970,
29892,
301,
2288,
29892,
394,
16130,
29892,
298,
2288,
29892,
269,
2288,
29892,
21556,
29892,
9853,
29918,
1557,
2361,
29892,
4559,
13,
18884,
330,
29883,
29889,
15914,
580,
13,
18884,
4842,
305,
29889,
29883,
6191,
29889,
6310,
29918,
8173,
580,
13,
13,
4706,
269,
29906,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
27691,
29918,
29879,
29906,
29897,
13,
4706,
316,
18594,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
27691,
29918,
311,
18594,
29897,
13,
4706,
269,
9778,
1490,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
27691,
29918,
21935,
29897,
13,
308,
13,
4706,
396,
11796,
29872,
278,
6588,
19435,
639,
4559,
313,
6812,
278,
2533,
2012,
310,
278,
2099,
2038,
29897,
13,
4706,
302,
353,
7431,
29898,
29881,
2075,
29877,
24574,
1839,
791,
13359,
24713,
29897,
13,
13,
4706,
363,
12714,
297,
659,
29918,
1557,
2361,
29901,
13,
9651,
659,
29918,
1557,
2361,
29961,
16414,
29962,
847,
29922,
302,
13,
13,
4706,
396,
15758,
362,
934,
2893,
14903,
13,
4706,
565,
451,
659,
29918,
7039,
29918,
17314,
29901,
13,
9651,
659,
29918,
7039,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
791,
29918,
7039,
467,
25027,
391,
580,
13,
9651,
659,
29918,
7039,
29918,
17314,
353,
5852,
13,
13,
9651,
363,
12714,
297,
2362,
5570,
29918,
791,
29918,
1557,
2361,
29901,
13,
18884,
2362,
5570,
29918,
791,
29918,
1557,
2361,
29961,
16414,
29962,
847,
29922,
302,
13,
13,
4706,
396,
16913,
16710,
1904,
13,
4706,
659,
29918,
6758,
29918,
16414,
353,
6410,
29918,
16414,
565,
451,
671,
29918,
6321,
29918,
4563,
29918,
6758,
1683,
525,
1799,
7833,
29915,
13,
4706,
659,
29918,
1557,
2361,
29918,
6758,
353,
659,
29918,
1557,
2361,
29961,
791,
29918,
6758,
29918,
16414,
29962,
13,
4706,
565,
659,
29918,
6758,
29918,
16414,
1275,
525,
1799,
7833,
2396,
13,
9651,
659,
29918,
1557,
2361,
29918,
6758,
353,
448,
29896,
334,
659,
29918,
1557,
2361,
29918,
6758,
718,
29871,
29896,
13,
13,
4706,
565,
659,
29918,
1557,
2361,
29918,
6758,
529,
1900,
29918,
13628,
29918,
6758,
29901,
13,
9651,
1596,
877,
29903,
5555,
1904,
313,
791,
29889,
6410,
756,
16710,
467,
1495,
13,
13,
9651,
4842,
305,
29889,
7620,
29898,
29888,
3958,
29918,
4299,
29889,
3859,
29918,
8977,
3285,
714,
29918,
29888,
3958,
29897,
13,
9651,
4842,
305,
29889,
7620,
29898,
1727,
275,
29918,
4299,
29889,
3859,
29918,
8977,
3285,
714,
29918,
1727,
275,
29897,
13,
13,
9651,
4078,
29918,
546,
29918,
11249,
29918,
1557,
2361,
29898,
791,
29918,
13628,
29918,
21513,
29892,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
29892,
659,
29918,
7039,
29892,
714,
29918,
791,
29918,
1557,
2361,
29897,
13,
9651,
1900,
29918,
13628,
29918,
6758,
353,
659,
29918,
1557,
2361,
29918,
6758,
13,
13,
4706,
396,
18399,
1259,
13,
4706,
301,
2288,
353,
301,
2288,
29918,
999,
13,
4706,
269,
2288,
353,
269,
2288,
29918,
999,
13,
4706,
298,
2288,
353,
298,
2288,
29918,
999,
13,
13,
4706,
4226,
1891,
29918,
29879,
2288,
353,
313,
29879,
2288,
448,
7442,
29889,
1195,
29898,
29879,
2288,
876,
847,
7442,
29889,
3317,
29898,
29879,
2288,
29897,
13,
4706,
4226,
1891,
29918,
5317,
353,
4226,
1891,
29918,
29879,
2288,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
29962,
13,
4706,
301,
2288,
29918,
5317,
353,
7442,
29889,
2378,
4197,
8945,
675,
29918,
5317,
1259,
29898,
29916,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
2314,
363,
921,
297,
301,
2288,
565,
7442,
29889,
1384,
29898,
29916,
29897,
2314,
13,
4706,
1059,
29918,
1958,
353,
298,
2288,
448,
269,
2288,
13,
4706,
9227,
29889,
1202,
29918,
3027,
877,
14098,
7084,
742,
4226,
675,
29918,
5317,
1259,
29898,
8945,
1891,
29918,
5317,
511,
21502,
305,
29892,
848,
689,
1446,
2433,
29950,
29956,
29907,
1495,
13,
4706,
9227,
29889,
1202,
29918,
3027,
877,
2392,
7315,
742,
4226,
675,
29918,
5317,
1259,
29898,
2704,
29918,
1958,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
11724,
21502,
305,
29892,
848,
689,
1446,
2433,
29950,
29956,
29907,
1495,
13,
4706,
9227,
29889,
1202,
29918,
3027,
877,
20938,
21342,
742,
4226,
675,
29918,
5317,
1259,
29898,
1092,
29879,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
11724,
21502,
305,
29892,
848,
689,
1446,
2433,
29950,
29956,
29907,
1495,
13,
4706,
9227,
29889,
1202,
29918,
8346,
877,
29903,
29906,
742,
7442,
29889,
11631,
8990,
29898,
29880,
2288,
29918,
5317,
29892,
29871,
29941,
29892,
29871,
29896,
511,
21502,
305,
29892,
848,
689,
1446,
2433,
29940,
3210,
29956,
1495,
13,
4706,
9227,
29889,
1202,
29918,
19529,
279,
877,
14968,
29914,
6758,
742,
7945,
29918,
6758,
29892,
21502,
305,
29897,
13,
13,
4706,
363,
12714,
297,
659,
29918,
2527,
10817,
29901,
13,
9651,
9227,
29889,
1202,
29918,
19529,
279,
877,
791,
22584,
29879,
29915,
1273,
12714,
29889,
13609,
3285,
659,
29918,
1557,
2361,
29961,
16414,
1402,
21502,
305,
29897,
13,
13,
4706,
396,
24706,
29890,
13,
4706,
565,
2295,
1839,
26495,
16215,
18622,
29890,
2033,
29901,
632,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
5323,
262,
6410,
2396,
7945,
29918,
6758,
29892,
13,
462,
539,
525,
5323,
262,
6410,
22583,
2396,
7945,
29918,
6758,
29918,
1727,
29892,
13,
462,
539,
525,
5323,
262,
476,
29931,
6410,
2396,
7945,
29918,
6758,
29918,
6321,
29892,
29871,
13,
462,
539,
525,
5323,
262,
6410,
639,
1547,
950,
2396,
7945,
29918,
6758,
29918,
546,
1547,
950,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
21935,
2396,
518,
18622,
29890,
29889,
2940,
29898,
8945,
675,
29918,
5317,
1259,
29898,
8945,
1891,
29918,
5317,
511,
5777,
683,
2433,
14098,
7084,
1495,
29962,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
4141,
2396,
518,
18622,
29890,
29889,
2940,
29898,
8945,
675,
29918,
5317,
1259,
29898,
1092,
29879,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
11724,
5777,
683,
2433,
20938,
21342,
1495,
29962,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
29903,
29906,
2396,
518,
18622,
29890,
29889,
2940,
29898,
29916,
29892,
5777,
683,
2433,
29903,
29906,
21342,
1495,
363,
921,
297,
301,
2288,
29918,
5317,
29962,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
29903,
29906,
13181,
457,
279,
29694,
2362,
5570,
2396,
518,
18622,
29890,
29889,
2940,
29898,
8945,
675,
29918,
5317,
1259,
29898,
1915,
29918,
1639,
29886,
29918,
2492,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
12622,
29962,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
13398,
3224,
29879,
2396,
518,
18622,
29890,
29889,
2940,
29898,
8945,
675,
29918,
5317,
1259,
29898,
1092,
29879,
29961,
5317,
29918,
3049,
3137,
29892,
2023,
11724,
5777,
683,
2433,
20938,
21342,
1495,
29962,
1118,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
3319,
29915,
13398,
3224,
10924,
2396,
518,
18622,
29890,
29889,
2940,
29898,
27691,
29879,
29918,
5317,
29898,
29879,
29906,
29892,
316,
18594,
29892,
269,
9778,
1490,
29892,
29871,
29900,
511,
5777,
683,
2433,
29933,
392,
10924,
1495,
1402,
13,
462,
539,
525,
13398,
3224,
7646,
2396,
518,
18622,
29890,
29889,
2940,
29898,
27691,
29879,
29918,
5317,
29898,
29879,
29906,
29892,
316,
18594,
29892,
269,
9778,
1490,
29892,
29871,
29896,
511,
5777,
683,
2433,
29933,
392,
7646,
1495,
1402,
13,
462,
539,
525,
13398,
3224,
29879,
4367,
2396,
29871,
518,
18622,
29890,
29889,
2940,
29898,
27691,
29879,
29918,
5317,
29898,
29879,
29906,
29892,
316,
18594,
29892,
269,
9778,
1490,
29892,
29871,
29906,
511,
5777,
683,
2433,
29933,
392,
4367,
1495,
1402,
13,
462,
539,
525,
4571,
303,
3224,
29879,
405,
8193,
2396,
518,
18622,
29890,
29889,
2940,
29898,
27691,
29879,
29918,
5317,
29898,
29879,
29906,
29892,
316,
18594,
29892,
269,
9778,
1490,
29892,
29871,
29941,
511,
5777,
683,
2433,
29933,
392,
405,
8193,
1495,
29962,
13,
462,
418,
2981,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
29898,
791,
29918,
1557,
2361,
29892,
4331,
29922,
1022,
2878,
29897,
13,
9651,
24706,
29890,
29889,
1188,
29898,
6500,
5570,
29918,
791,
29918,
1557,
2361,
29892,
4331,
29922,
1022,
2878,
29897,
13,
13,
4706,
628,
301,
2288,
29892,
269,
2288,
29892,
298,
2288,
29892,
301,
2288,
29918,
999,
29892,
269,
2288,
29918,
999,
29892,
298,
2288,
29918,
999,
13,
4706,
628,
659,
29918,
1557,
2361,
29892,
2362,
5570,
29918,
791,
29918,
1557,
2361,
29892,
659,
29918,
13628,
29918,
21513,
29892,
2362,
5570,
29918,
791,
29918,
13628,
29918,
21513,
13,
4706,
330,
29883,
29889,
15914,
580,
13,
13,
1678,
9227,
29889,
5358,
580,
13,
13,
13,
1753,
1667,
29898,
13,
1678,
2295,
29892,
848,
29918,
2176,
29892,
22101,
29922,
8516,
29892,
4234,
29918,
12324,
29918,
2176,
29922,
8516,
29892,
4226,
675,
29922,
5574,
29892,
6056,
29918,
311,
18594,
29918,
9302,
29920,
29922,
8516,
29892,
6056,
29918,
29879,
29906,
29918,
9302,
29920,
29922,
8516,
29892,
639,
1547,
950,
29918,
6758,
29918,
4299,
29922,
8516,
29892,
29871,
13,
1678,
21736,
29918,
4299,
353,
6213,
29892,
1072,
275,
29918,
4299,
353,
6213,
13,
1125,
13,
1678,
9995,
13,
1678,
11221,
263,
5285,
29892,
22983,
379,
29934,
6779,
322,
1383,
2027,
6779,
363,
14974,
29899,
4308,
5670,
24062,
918,
313,
29924,
9998,
29934,
511,
322,
27401,
1900,
1904,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
2295,
29901,
9657,
29892,
5285,
934,
13,
1678,
9995,
13,
13,
1678,
396,
830,
5498,
455,
29890,
1793,
3987,
13,
1678,
16717,
353,
2295,
1839,
26495,
16215,
26776,
2033,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
26776,
29897,
13,
1678,
4842,
305,
29889,
11288,
29918,
26776,
29898,
26776,
29897,
13,
1678,
4842,
305,
29889,
29883,
6191,
29889,
11288,
29918,
26776,
29898,
26776,
29897,
13,
1678,
4842,
305,
29889,
1627,
1975,
29889,
29883,
566,
15755,
29889,
17590,
353,
5852,
13,
1678,
4842,
305,
29889,
1627,
1975,
29889,
29883,
566,
15755,
29889,
4801,
837,
262,
4695,
353,
5852,
13,
1678,
4842,
305,
29889,
1627,
1975,
29889,
29883,
566,
15755,
29889,
1785,
16580,
353,
7700,
13,
13,
1678,
18196,
29918,
21134,
353,
2295,
1839,
26495,
16215,
305,
12629,
29918,
21134,
2033,
13,
1678,
18196,
29918,
22100,
353,
2295,
1839,
26495,
16215,
305,
12629,
29918,
22100,
2033,
13,
13,
1678,
301,
29878,
29918,
5041,
29918,
2311,
353,
2295,
1839,
26495,
16215,
5041,
29918,
2311,
2033,
13,
1678,
24081,
29883,
744,
29918,
19790,
353,
2295,
1839,
11618,
16215,
14340,
29883,
744,
29918,
19790,
2033,
13,
1678,
1072,
29918,
10289,
353,
2295,
1839,
26495,
16215,
1727,
29918,
10289,
2033,
13,
1678,
9825,
13342,
29918,
4352,
292,
353,
2295,
1839,
26495,
16215,
29882,
391,
13342,
29918,
4352,
292,
2033,
13,
13,
1678,
396,
25455,
278,
3564,
2729,
373,
278,
3564,
5285,
13,
268,
13,
1678,
565,
21736,
29918,
4299,
338,
6213,
29901,
13,
4706,
21736,
29918,
4299,
353,
379,
29934,
6779,
29898,
2917,
3366,
11618,
20068,
13,
1678,
565,
1072,
275,
29918,
4299,
338,
6213,
29901,
29871,
13,
4706,
1072,
275,
29918,
4299,
353,
1383,
2027,
6779,
29898,
262,
29918,
12719,
29922,
2435,
29898,
305,
12629,
29918,
21134,
511,
13,
462,
965,
13261,
29918,
2311,
29922,
29212,
29918,
5041,
29918,
2311,
29930,
14340,
29883,
744,
29918,
19790,
448,
29871,
29906,
29930,
1727,
29918,
10289,
29897,
13,
13,
1678,
5994,
3950,
353,
5994,
29889,
3253,
314,
29898,
1761,
29898,
29888,
3958,
29918,
4299,
29889,
16744,
3101,
718,
1051,
29898,
1727,
275,
29918,
4299,
29889,
16744,
25739,
13,
462,
965,
301,
29878,
29922,
2917,
1839,
26495,
16215,
29212,
11287,
13,
13,
1678,
848,
29918,
12322,
353,
2295,
1839,
24772,
16215,
13506,
2033,
13,
13,
1678,
396,
360,
2075,
29877,
24574,
13,
1678,
9853,
29918,
2311,
353,
2295,
1839,
26495,
16215,
16175,
29918,
2311,
2033,
13,
1678,
302,
29918,
1287,
414,
353,
2295,
1839,
26495,
16215,
29876,
29918,
1287,
414,
2033,
13,
1678,
302,
29918,
7406,
353,
2295,
1839,
26495,
16215,
29876,
29918,
7406,
2033,
13,
1678,
671,
29918,
2987,
358,
353,
2295,
1839,
26495,
16215,
2987,
358,
2033,
13,
13,
13,
1678,
11307,
29918,
9144,
353,
7687,
29898,
2987,
358,
29892,
3635,
1082,
29918,
9346,
342,
15092,
29922,
8824,
29897,
565,
671,
29918,
2987,
358,
1683,
6213,
13,
13,
1678,
396,
28186,
848,
23466,
13,
1678,
7945,
29918,
27736,
353,
848,
29918,
2176,
29961,
1272,
29918,
2176,
29889,
14968,
29918,
1688,
29918,
18157,
1275,
525,
14968,
13359,
2976,
11285,
29918,
9302,
29920,
29918,
9507,
29889,
5975,
13,
13,
1678,
7945,
29918,
24713,
353,
1954,
1179,
300,
16390,
24541,
29898,
13,
4706,
527,
842,
29918,
3972,
29922,
1272,
29918,
12322,
29892,
13,
4706,
527,
842,
29918,
9302,
29920,
29918,
5325,
29922,
14968,
29918,
27736,
29892,
13,
4706,
931,
29918,
4102,
29922,
5574,
29892,
13,
4706,
22101,
29922,
5325,
973,
29892,
13,
4706,
4234,
29918,
12324,
29918,
2176,
29922,
13509,
29918,
12324,
29918,
2176,
29892,
13,
4706,
4226,
675,
29922,
8945,
675,
29892,
13,
4706,
6056,
29918,
311,
18594,
29918,
9302,
29920,
29922,
12324,
29918,
311,
18594,
29918,
9302,
29920,
29892,
13,
4706,
6056,
29918,
29879,
29906,
29918,
9302,
29920,
29922,
12324,
29918,
29879,
29906,
29918,
9302,
29920,
29892,
13,
4706,
18196,
29918,
21134,
29922,
305,
12629,
29918,
21134,
29892,
13,
4706,
18196,
29918,
1725,
1446,
29922,
305,
12629,
29918,
22100,
29892,
13,
4706,
302,
29918,
7406,
29922,
29876,
29918,
7406,
29892,
13,
4706,
7164,
2433,
3298,
359,
742,
13,
4706,
4327,
29922,
2987,
29918,
9144,
29892,
13,
4706,
9825,
13342,
29918,
4352,
292,
29922,
29882,
391,
13342,
29918,
4352,
292,
29897,
13,
13,
1678,
7945,
29918,
29881,
2075,
29877,
1664,
353,
3630,
10036,
29898,
13,
4706,
7945,
29918,
24713,
29892,
13,
4706,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
4706,
528,
21897,
29922,
5574,
29892,
13,
4706,
954,
29918,
1287,
414,
29922,
29876,
29918,
1287,
414,
29892,
13,
4706,
12534,
29918,
14834,
29922,
5574,
29897,
13,
13,
1678,
396,
15758,
362,
848,
23466,
13,
1678,
8845,
29918,
27736,
353,
848,
29918,
2176,
29961,
1272,
29918,
2176,
29889,
14968,
29918,
1688,
29918,
18157,
1275,
525,
18157,
13359,
2976,
11285,
29918,
9302,
29920,
29918,
9507,
29889,
5975,
13,
13,
1678,
659,
29918,
24713,
353,
1954,
1179,
300,
16390,
24541,
29898,
13,
4706,
527,
842,
29918,
3972,
29922,
1272,
29918,
12322,
29892,
13,
4706,
527,
842,
29918,
9302,
29920,
29918,
5325,
29922,
18157,
29918,
27736,
29892,
13,
4706,
931,
29918,
4102,
29922,
5574,
29892,
13,
4706,
22101,
29922,
5325,
973,
29892,
13,
4706,
4234,
29918,
12324,
29918,
2176,
29922,
13509,
29918,
12324,
29918,
2176,
29892,
13,
4706,
4226,
675,
29922,
8945,
675,
29892,
13,
4706,
6056,
29918,
311,
18594,
29918,
9302,
29920,
29922,
12324,
29918,
311,
18594,
29918,
9302,
29920,
29892,
13,
4706,
6056,
29918,
29879,
29906,
29918,
9302,
29920,
29922,
12324,
29918,
29879,
29906,
29918,
9302,
29920,
29892,
13,
4706,
18196,
29918,
21134,
29922,
305,
12629,
29918,
21134,
29892,
13,
4706,
18196,
29918,
1725,
1446,
29922,
305,
12629,
29918,
22100,
29892,
13,
4706,
302,
29918,
7406,
29922,
29876,
29918,
7406,
29892,
13,
4706,
7164,
2433,
3298,
359,
742,
13,
4706,
4327,
29922,
8516,
29892,
29871,
13,
4706,
9825,
13342,
29918,
4352,
292,
29922,
8824,
29897,
13,
13,
1678,
659,
29918,
29881,
2075,
29877,
1664,
353,
3630,
10036,
29898,
13,
4706,
659,
29918,
24713,
29892,
13,
4706,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
4706,
528,
21897,
29922,
8824,
29892,
13,
4706,
954,
29918,
1287,
414,
29922,
29876,
29918,
1287,
414,
29892,
13,
4706,
12534,
29918,
14834,
29922,
5574,
29897,
13,
13,
1678,
1418,
7003,
24574,
353,
11117,
14968,
2396,
7945,
29918,
29881,
2075,
29877,
1664,
29892,
525,
791,
2396,
659,
29918,
29881,
2075,
29877,
1664,
29913,
13,
268,
13,
1678,
396,
28186,
1904,
13,
1678,
4842,
305,
29889,
29883,
6191,
29889,
6310,
29918,
8173,
580,
13,
1678,
7945,
2855,
2577,
25353,
3195,
29898,
29888,
3958,
29918,
4299,
29892,
1072,
275,
29918,
4299,
29892,
5994,
3950,
29892,
1418,
7003,
24574,
29892,
2295,
29892,
639,
1547,
950,
29918,
6758,
29918,
4299,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2917,
742,
1371,
2433,
2084,
310,
278,
2295,
934,
742,
2322,
2433,
2917,
29914,
2917,
29889,
3126,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
4974,
2897,
29889,
2084,
29889,
275,
1445,
29898,
5085,
29889,
2917,
29897,
13,
13,
1678,
411,
1722,
29898,
5085,
29889,
2917,
29892,
525,
29878,
1495,
408,
1303,
29918,
1445,
29901,
13,
4706,
2295,
353,
4390,
29889,
1359,
29898,
949,
29918,
1445,
29897,
13,
13,
1678,
1667,
29898,
2917,
29897,
13,
2
] |
pedal/tifa/feedbacks.py | acbart/python-analysis | 14 | 73738 | """
All of the feedback responses generated by TIFA.
"""
from pedal.utilities.operators import OPERATION_DESCRIPTION
from pedal.core.report import MAIN_REPORT
from pedal.core.feedback import FeedbackResponse
class TifaFeedback(FeedbackResponse):
""" Base class for all TIFA feedback """
muted = False
category = FeedbackResponse.CATEGORIES.ALGORITHMIC
kind = FeedbackResponse.KINDS.MISTAKE
class action_after_return(TifaFeedback):
""" Statement after return """
title = "Action after Return"
message_template = ("You performed an action after already returning from "
"a function, on line {location.line}. You can "
"only return on a path once.")
justification = ("TIFA visited a node not in the top scope when its "
"*return variable was definitely set in this scope.")
def __init__(self, location, **kwargs):
super().__init__(location=location, **kwargs)
class return_outside_function(TifaFeedback):
""" Return statement outside of function """
title = "Return outside Function"
message_template = ("You attempted to return outside of a function on line "
"{location.line}. But you can only return from within "
"a function.")
justification = "TIFA visited a return node at the top level."
def __init__(self, location, **kwargs):
super().__init__(location=location, **kwargs)
class multiple_return_types(TifaFeedback):
""" Multiple returned types in single function """
title = "Multiple Return Types"
message_template = ("Your function returned {actual} on line {location.line}, "
"even though you defined it to return {expected}. "
"Your function should return values consistently.")
justification = ("TIFA visited a function definition with multiple returns "
"that unequal types.")
def __init__(self, location, expected, actual, **kwargs):
super().__init__(location=location, expected=expected,
actual=actual, **kwargs)
class write_out_of_scope(TifaFeedback):
""" Write out of Scope """
title = "Write Out of Scope"
message_template = ("You attempted to write the variable {name_message} "
"from a higher scope (outside the function) on line "
"{location.line}. You should only use variables inside "
"the function they were declared in.")
justification = "TIFA stored to an existing variable not in this scope"
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class unconnected_blocks(TifaFeedback):
""" Unconnected Blocks """
title = "Unconnected Blocks"
message_template = ("It looks like you have unconnected blocks on line {location.line}. "
"Before you run your program, you must make sure that all "
"of your blocks are connected that there are no unfilled "
"holes.")
justification = "TIFA found a name equal to ___"
def __init__(self, location, **kwargs):
super().__init__(location=location, **kwargs)
class iteration_problem(TifaFeedback):
""" Iteration Problem """
title = "Iteration Problem"
message_template = ("The variable {name_message} was iterated on line "
"{location.line} but you used the same variable as the iteration "
"variable. You should choose a different variable name "
"for the iteration variable. Usually, the iteration variable "
"is the singular form of the iteration list (e.g., "
"`for a_dog in dogs:`).")
justification = "TIFA visited a loop where the iteration list and target were the same."
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class initialization_problem(TifaFeedback):
""" Initialization Problem """
title = "Initialization Problem"
message_template = ("The variable {name_message} was used on line {location.line}, "
"but it was not given a value on a previous line. "
"You cannot use a variable until it has been given a value."
)
justification = "TIFA read a variable that did not exist or was not previously set in this branch."
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class possible_initialization_problem(TifaFeedback):
""" Possible Initialization Problem """
title = "Possible Initialization Problem"
message_template = ("The variable {name_message} was used on line {location.line}, "
"but it was possibly not given a value on a previous "
"line. You cannot use a variable until it has been given "
"a value. Check to make sure that this variable was "
"declared in all of the branches of your decision."
)
justification = "TIFA read a variable that was maybe set but not definitely set in this branch."
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class unused_variable(TifaFeedback):
""" Unused Variable """
title = "Unused Variable"
message_template = ("The {kind} {name_message} was given a {initialization} on line "
"{location.line}, but was never used after that.")
justification = ("TIFA stored a variable but it was not read any other time "
"in the program.")
def __init__(self, location, name, variable_type, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
if variable_type.is_equal('function'):
kind, initialization = 'function', 'definition'
else:
kind, initialization = 'variable', 'value'
fields = {'location': location, 'name': name, 'type': variable_type,
'name_message': report.format.name(name),
'kind': kind, 'initialization': initialization}
if 'fields' in kwargs:
fields.update(kwargs.pop('fields'))
super().__init__(location=location, fields=fields, **kwargs)
class overwritten_variable(TifaFeedback):
""" Overwritten Variable """
title = "Overwritten Variable"
message_template = ("The variable {name_message} was given a value, but "
"{name_message} was changed on line {location.line} "
"before it was used. One of the times that you gave "
"{name_message} a value was incorrect."
)
justification = ("TIFA attempted to store to a variable that was previously "
"stored but not read.")
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class iterating_over_non_list(TifaFeedback):
""" Iterating over non-list """
title = "Iterating over Non-list"
message_template = ("The {iter} is not a list, but you used it in the "
"iteration on line {location.line}. You should only "
"iterate over sequences like lists.")
justification = ("TIFA visited a loop's iteration list whose type was"
"not indexable.")
def __init__(self, location, iter_name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
if iter_name is None:
iter_list = "expression"
else:
iter_list = "variable " + report.format.name(iter_name)
fields = {'location': location, 'name': iter_name, 'iter': iter_list}
if 'fields' in kwargs:
fields.update(kwargs.pop('fields'))
super().__init__(location=location, fields=fields, **kwargs)
class iterating_over_empty_list(TifaFeedback):
""" Iterating over empty list """
title = "Iterating over empty list"
message_template = ("The {iter} was set as an empty list, "
"and then you attempted to use it in an iteration on line "
"{location.line}. You should only iterate over non-empty lists."
)
justification = "TIFA visited a loop's iteration list that was empty."
def __init__(self, location, iter_name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
if iter_name is None:
iter_list = "expression"
else:
iter_list = "variable " + report.format.name(iter_name)
fields = {'location': location, 'name': iter_name, 'iter': iter_list}
super().__init__(location=location, fields=fields, **kwargs)
class incompatible_types(TifaFeedback):
""" Incompatible types """
title = "Incompatible types"
message_template = ("You used {op_name} operation with {left_name} and {right_name} on line "
"{location.line}. But you can't do that with that operator. Make "
"sure both sides of the operator are the right type."
)
justification = "TIFA visited an operation with operands of the wrong type."
def __init__(self, location, operation, left, right, **kwargs):
op_name = OPERATION_DESCRIPTION.get(operation.__class__,
str(operation))
left_name = left.singular_name
right_name = right.singular_name
fields = {'location': location,
'operation': operation, 'op_name': op_name,
'left': left, 'right': right,
'left_name': left_name, 'right_name': right_name}
super().__init__(location=location, fields=fields, **kwargs)
class invalid_indexing(TifaFeedback):
""" Invalid Index """
title = "Invalid Index"
message_template = ("You indexed {left_name} with {right_name} on line "
"{location.line}. But you can't index {left_name} with "
"{right_name}."
)
justification = ("TIFA attempted to call an .index() operation on a type"
" with a type that wasn't acceptable.")
muted = True
def __init__(self, location, left, right, **kwargs):
left_name = left.singular_name
right_name = right.singular_name
fields = {'location': location,
'left': left, 'right': right,
'left_name': left_name, 'right_name': right_name}
super().__init__(location=location, fields=fields, **kwargs)
class parameter_type_mismatch(TifaFeedback):
""" Parameter type mismatch """
title = "Parameter Type Mismatch"
message_template = ("You defined the parameter {parameter_name_message} on line {location.line} "
"as {parameter_type_name}. However, the argument passed to that parameter "
"was {argument_type_name}. The formal parameter type must match the argument's type."
)
justification = "TIFA visited a function definition where a parameter type and argument type were not equal."
def __init__(self, location, parameter_name, parameter, argument, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
parameter_type_name = parameter.singular_name
argument_type_name = argument.singular_name
fields = {'location': location,
'parameter_name': parameter_name,
'parameter_name_message': report.format.name(parameter_name),
'parameter_type': parameter,
'argument_type': argument,
'parameter_type_name': parameter_type_name,
'argument_type_name': argument_type_name}
super().__init__(location=location, fields=fields, **kwargs)
class read_out_of_scope(TifaFeedback):
""" Read out of scope """
title = "Read out of Scope"
message_template = ("You attempted to read the variable {name_message} "
"from a different scope on line {location.line}. You "
"should only use variables inside the function they "
"were declared in."
)
justification = "TIFA read a variable that did not exist in this scope but existed in another."
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
# TODO: Complete these
class type_changes(TifaFeedback):
""" Type changes """
title = "Type Changes"
message_template = ("The variable {name_message} changed type from {old} to "
"{new} on line {location.line}.")
justification = ""
muted = True
def __init__(self, location, name, old, new, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
fields = {'location': location, 'name': name,
'name_message': report.format.name(name),
'old': old, 'new': new}
super().__init__(location=location, fields=fields, **kwargs)
class unnecessary_second_branch(TifaFeedback):
""" Unnecessary second branch """
title = "Unnecessary Second Branch"
message_template = ("You have an `if` statement where one of the two branches"
" only has `pass` in its body, on line {location.line}."
" You shouldn't need an empty body.")
justification = "There is an else or if statement who's body is just pass."
def __init__(self, location, **kwargs):
super().__init__(location=location, **kwargs)
class else_on_loop_body(TifaFeedback):
""" Else on Loop body """
title = "Else on Loop Body"
message_template = "TODO"
justification = ""
def __init__(self, location, **kwargs):
super().__init__(location=location, **kwargs)
class recursive_call(TifaFeedback):
""" recursive call """
title = "Recursive Call"
message_template = "TODO"
justification = ""
muted = True
def __init__(self, location, name, **kwargs):
super().__init__(location=location, name=name, **kwargs)
class not_a_function(TifaFeedback):
""" Not a function """
title = "Not a Function"
message_template = ("You attempted to call {name} as if it"
" was a function on line {location.line}. However,"
" that expression was actually a {called_type}.")
justification = ""
# TODO: Unmute?
#muted = True
def __init__(self, location, name, called_type, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
singular_name = called_type.singular_name
fields = {'location': location, 'name': name,
'called_type': called_type,
'singular_name': singular_name}
super().__init__(fields=fields, **kwargs)
class incorrect_arity(TifaFeedback):
""" Incorrect arity """
title = "Incorrect Arity"
message_template = ("The function {function_name_message} was given the "
"wrong number of arguments.")
justification = ""
def __init__(self, location, function_name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, function_name=function_name,
function_name_message=report.format.name(function_name),
**kwargs)
class module_not_found(TifaFeedback):
""" Module not found """
title = "Module Not Found"
message_template = "TODO"
justification = ""
muted = True
def __init__(self, location, name, is_dynamic=False, error=None, **kwargs):
fields = {"location": location, "name": name,
"is_dynamic": is_dynamic, "error": error}
super().__init__(location=location, fields=fields, **kwargs)
class append_to_non_list(TifaFeedback):
""" Append to non-list """
title = "Append to non-list"
message_template = "TODO"
justification = ""
muted = True
def __init__(self, location, name, actual_type, **kwargs):
fields = {'location': location, "name": name,
"actual_type": actual_type}
super().__init__(location=location, fields=fields, **kwargs)
class nested_function_definition(TifaFeedback):
""" Function defined not at top-level """
message_template = ("The function {name_message} was defined inside of another"
"block on line {location.line}. For instance, you may "
"have placed it inside another function definition, or "
"inside of a loop. Do not nest your function "
"definition!")
title = "Don't Nest Functions"
justification = "Found a FunctionDef that was not at the top-level."
muted = True
unscored = True
def __init__(self, location, name, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
super().__init__(location=location, name=name,
name_message=report.format.name(name), **kwargs)
class unused_returned_value(TifaFeedback):
""" Expr node had a non-None value """
title = "Did Not Use Function's Return Value"
message_template = ("It looks like you called the {call_type} {name_message} on "
"{location.line}, but failed to store the result in "
"a variable or use it in an expression. You should "
"remember to use the result!")
justification = "Expression node calculated a non-None value."
muted = True
unscored = True
def __init__(self, location, name, call_type, result_type, **kwargs):
report = kwargs.get("report", MAIN_REPORT)
fields = {'location': location, 'name': name, 'call_type': call_type,
'result_type': result_type,
'name_message': report.format.name(name)}
super().__init__(fields=fields, location=location, **kwargs)
'''
TODO: Finish these checks
"Empty Body": [], # Any use of pass on its own
"Malformed Conditional": [], # An if/else with empty else or if
"Unnecessary Pass": [], # Any use of pass
"Append to non-list": [], # Attempted to use the append method on a non-list
"Used iteration list": [], #
"Unused iteration variable": [], #
"Type changes": [], #
"Unknown functions": [], #
"Not a function": [], # Attempt to call non-function as function
"Recursive Call": [],
"Incorrect Arity": [],
"Aliased built-in": [], #
"Method not in Type": [], # A method was used that didn't exist for that type
"Submodule not found": [],
"Module not found": [],
"Else on loop body": [], # Used an Else on a For or While
'''
# TODO: Equality instead of assignment
| [
1,
9995,
13,
3596,
310,
278,
16705,
20890,
5759,
491,
323,
29902,
4519,
29889,
13,
15945,
29908,
13,
3166,
8939,
284,
29889,
4422,
1907,
29889,
3372,
4097,
1053,
6418,
1001,
8098,
29918,
2287,
7187,
24290,
2725,
13,
3166,
8939,
284,
29889,
3221,
29889,
12276,
1053,
14861,
1177,
29918,
1525,
15082,
13,
3166,
8939,
284,
29889,
3221,
29889,
18798,
1627,
1053,
5169,
287,
1627,
5103,
13,
13,
13,
1990,
323,
26056,
29737,
1627,
29898,
29737,
1627,
5103,
1125,
13,
1678,
9995,
7399,
770,
363,
599,
323,
29902,
4519,
16705,
9995,
13,
1678,
286,
3860,
353,
7700,
13,
1678,
7663,
353,
5169,
287,
1627,
5103,
29889,
29907,
3040,
29954,
1955,
29059,
29889,
1964,
29954,
1955,
13054,
29924,
2965,
13,
1678,
2924,
353,
5169,
287,
1627,
5103,
29889,
29968,
1177,
8452,
29889,
29924,
9047,
29909,
6059,
13,
13,
13,
1990,
3158,
29918,
7045,
29918,
2457,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
6666,
882,
1156,
736,
9995,
13,
1678,
3611,
353,
376,
4276,
1156,
7106,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
8560,
385,
3158,
1156,
2307,
7863,
515,
376,
13,
462,
4706,
376,
29874,
740,
29892,
373,
1196,
426,
5479,
29889,
1220,
1836,
887,
508,
376,
13,
462,
4706,
376,
6194,
736,
373,
263,
2224,
2748,
23157,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
16669,
263,
2943,
451,
297,
278,
2246,
6874,
746,
967,
376,
13,
462,
268,
26345,
2457,
2286,
471,
11630,
731,
297,
445,
6874,
23157,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
736,
29918,
449,
2975,
29918,
2220,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
7106,
3229,
5377,
310,
740,
9995,
13,
1678,
3611,
353,
376,
11609,
5377,
6680,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
16388,
304,
736,
5377,
310,
263,
740,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1836,
1205,
366,
508,
871,
736,
515,
2629,
376,
13,
462,
4706,
376,
29874,
740,
23157,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
16669,
263,
736,
2943,
472,
278,
2246,
3233,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
2999,
29918,
2457,
29918,
8768,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
26905,
4133,
4072,
297,
2323,
740,
9995,
13,
1678,
3611,
353,
376,
15329,
552,
7106,
28025,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
10858,
740,
4133,
426,
19304,
29913,
373,
1196,
426,
5479,
29889,
1220,
1118,
376,
13,
462,
4706,
376,
11884,
2466,
366,
3342,
372,
304,
736,
426,
9684,
1836,
376,
13,
462,
4706,
376,
10858,
740,
881,
736,
1819,
5718,
2705,
23157,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
16669,
263,
740,
5023,
411,
2999,
3639,
376,
13,
462,
268,
376,
5747,
1597,
15380,
4072,
23157,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3806,
29892,
3935,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3806,
29922,
9684,
29892,
13,
462,
308,
3935,
29922,
19304,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
2436,
29918,
449,
29918,
974,
29918,
6078,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
14350,
714,
310,
317,
4338,
9995,
13,
1678,
3611,
353,
376,
6113,
4451,
310,
317,
4338,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
16388,
304,
2436,
278,
2286,
426,
978,
29918,
4906,
29913,
376,
13,
462,
4706,
376,
3166,
263,
6133,
6874,
313,
449,
2975,
278,
740,
29897,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1836,
887,
881,
871,
671,
3651,
2768,
376,
13,
462,
4706,
376,
1552,
740,
896,
892,
8052,
297,
23157,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
6087,
304,
385,
5923,
2286,
451,
297,
445,
6874,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
443,
18045,
29918,
1271,
29879,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
853,
18045,
15658,
29879,
9995,
13,
1678,
3611,
353,
376,
2525,
18045,
15658,
29879,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3112,
3430,
763,
366,
505,
443,
18045,
10930,
373,
1196,
426,
5479,
29889,
1220,
1836,
376,
13,
462,
4706,
376,
18743,
366,
1065,
596,
1824,
29892,
366,
1818,
1207,
1854,
393,
599,
376,
13,
462,
4706,
376,
974,
596,
10930,
526,
6631,
393,
727,
526,
694,
443,
26940,
376,
13,
462,
4706,
376,
5391,
267,
23157,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
1476,
263,
1024,
5186,
304,
903,
1649,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
12541,
29918,
17199,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
20504,
362,
11583,
9995,
13,
1678,
3611,
353,
376,
13463,
362,
11583,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
2286,
426,
978,
29918,
4906,
29913,
471,
4256,
630,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
29913,
541,
366,
1304,
278,
1021,
2286,
408,
278,
12541,
376,
13,
462,
4706,
376,
11918,
29889,
887,
881,
6755,
263,
1422,
2286,
1024,
376,
13,
462,
4706,
376,
1454,
278,
12541,
2286,
29889,
26991,
29892,
278,
12541,
2286,
376,
13,
462,
4706,
376,
275,
278,
13512,
883,
310,
278,
12541,
1051,
313,
29872,
29889,
29887,
1696,
376,
13,
462,
4706,
29724,
1454,
263,
29918,
26169,
297,
26361,
29901,
12913,
1159,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
16669,
263,
2425,
988,
278,
12541,
1051,
322,
3646,
892,
278,
1021,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
17865,
29918,
17199,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
17250,
2133,
11583,
9995,
13,
1678,
3611,
353,
376,
15514,
2133,
11583,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
2286,
426,
978,
29918,
4906,
29913,
471,
1304,
373,
1196,
426,
5479,
29889,
1220,
1118,
376,
13,
462,
4706,
376,
4187,
372,
471,
451,
2183,
263,
995,
373,
263,
3517,
1196,
29889,
376,
13,
462,
4706,
376,
3492,
2609,
671,
263,
2286,
2745,
372,
756,
1063,
2183,
263,
995,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
1303,
263,
2286,
393,
1258,
451,
1863,
470,
471,
451,
9251,
731,
297,
445,
5443,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
1950,
29918,
11228,
2133,
29918,
17199,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
20049,
17250,
2133,
11583,
9995,
13,
1678,
3611,
353,
376,
9135,
1687,
17250,
2133,
11583,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
2286,
426,
978,
29918,
4906,
29913,
471,
1304,
373,
1196,
426,
5479,
29889,
1220,
1118,
376,
13,
462,
4706,
376,
4187,
372,
471,
10075,
451,
2183,
263,
995,
373,
263,
3517,
376,
13,
462,
4706,
376,
1220,
29889,
887,
2609,
671,
263,
2286,
2745,
372,
756,
1063,
2183,
376,
13,
462,
4706,
376,
29874,
995,
29889,
5399,
304,
1207,
1854,
393,
445,
2286,
471,
376,
13,
462,
4706,
376,
7099,
433,
1127,
297,
599,
310,
278,
14202,
310,
596,
10608,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
1303,
263,
2286,
393,
471,
5505,
731,
541,
451,
11630,
731,
297,
445,
5443,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
443,
3880,
29918,
11918,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
853,
3880,
28736,
9995,
13,
1678,
3611,
353,
376,
2525,
3880,
28736,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
426,
14380,
29913,
426,
978,
29918,
4906,
29913,
471,
2183,
263,
426,
11228,
2133,
29913,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1118,
541,
471,
2360,
1304,
1156,
393,
23157,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
6087,
263,
2286,
541,
372,
471,
451,
1303,
738,
916,
931,
376,
13,
462,
268,
376,
262,
278,
1824,
23157,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
2286,
29918,
1853,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
565,
2286,
29918,
1853,
29889,
275,
29918,
11745,
877,
2220,
29374,
13,
9651,
2924,
29892,
17865,
353,
525,
2220,
742,
525,
16553,
29915,
13,
4706,
1683,
29901,
13,
9651,
2924,
29892,
17865,
353,
525,
11918,
742,
525,
1767,
29915,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
1024,
29892,
525,
1853,
2396,
2286,
29918,
1853,
29892,
13,
462,
29871,
525,
978,
29918,
4906,
2396,
3461,
29889,
4830,
29889,
978,
29898,
978,
511,
13,
462,
29871,
525,
14380,
2396,
2924,
29892,
525,
11228,
2133,
2396,
17865,
29913,
13,
4706,
565,
525,
9621,
29915,
297,
9049,
5085,
29901,
13,
9651,
4235,
29889,
5504,
29898,
19290,
29889,
7323,
877,
9621,
8785,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
975,
17625,
29918,
11918,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
6811,
17625,
28736,
9995,
13,
1678,
3611,
353,
376,
3563,
17625,
28736,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
2286,
426,
978,
29918,
4906,
29913,
471,
2183,
263,
995,
29892,
541,
376,
13,
462,
4706,
29850,
978,
29918,
4906,
29913,
471,
3939,
373,
1196,
426,
5479,
29889,
1220,
29913,
376,
13,
462,
4706,
376,
11083,
372,
471,
1304,
29889,
3118,
310,
278,
3064,
393,
366,
4846,
376,
13,
462,
4706,
29850,
978,
29918,
4906,
29913,
263,
995,
471,
10240,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
16388,
304,
3787,
304,
263,
2286,
393,
471,
9251,
376,
13,
462,
268,
376,
303,
4395,
541,
451,
1303,
23157,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
4256,
1218,
29918,
957,
29918,
5464,
29918,
1761,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
20504,
1218,
975,
1661,
29899,
1761,
9995,
13,
1678,
3611,
353,
376,
13463,
1218,
975,
10050,
29899,
1761,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
426,
1524,
29913,
338,
451,
263,
1051,
29892,
541,
366,
1304,
372,
297,
278,
376,
13,
462,
4706,
376,
1524,
362,
373,
1196,
426,
5479,
29889,
1220,
1836,
887,
881,
871,
376,
13,
462,
4706,
376,
1524,
403,
975,
15602,
763,
8857,
23157,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
16669,
263,
2425,
29915,
29879,
12541,
1051,
5069,
1134,
471,
29908,
13,
462,
268,
376,
1333,
2380,
519,
23157,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
4256,
29918,
978,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
565,
4256,
29918,
978,
338,
6213,
29901,
13,
9651,
4256,
29918,
1761,
353,
376,
17471,
29908,
13,
4706,
1683,
29901,
13,
13,
9651,
4256,
29918,
1761,
353,
376,
11918,
376,
718,
3461,
29889,
4830,
29889,
978,
29898,
1524,
29918,
978,
29897,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
4256,
29918,
978,
29892,
525,
1524,
2396,
4256,
29918,
1761,
29913,
13,
4706,
565,
525,
9621,
29915,
297,
9049,
5085,
29901,
13,
9651,
4235,
29889,
5504,
29898,
19290,
29889,
7323,
877,
9621,
8785,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
4256,
1218,
29918,
957,
29918,
6310,
29918,
1761,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
20504,
1218,
975,
4069,
1051,
9995,
13,
1678,
3611,
353,
376,
13463,
1218,
975,
4069,
1051,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
426,
1524,
29913,
471,
731,
408,
385,
4069,
1051,
29892,
376,
13,
462,
4706,
376,
392,
769,
366,
16388,
304,
671,
372,
297,
385,
12541,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1836,
887,
881,
871,
13649,
975,
1661,
29899,
6310,
8857,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
16669,
263,
2425,
29915,
29879,
12541,
1051,
393,
471,
4069,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
4256,
29918,
978,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
565,
4256,
29918,
978,
338,
6213,
29901,
13,
9651,
4256,
29918,
1761,
353,
376,
17471,
29908,
13,
4706,
1683,
29901,
13,
9651,
4256,
29918,
1761,
353,
376,
11918,
376,
718,
3461,
29889,
4830,
29889,
978,
29898,
1524,
29918,
978,
29897,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
4256,
29918,
978,
29892,
525,
1524,
2396,
4256,
29918,
1761,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
297,
23712,
29918,
8768,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
512,
23712,
4072,
9995,
13,
1678,
3611,
353,
376,
797,
23712,
4072,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
1304,
426,
459,
29918,
978,
29913,
5858,
411,
426,
1563,
29918,
978,
29913,
322,
426,
1266,
29918,
978,
29913,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1836,
1205,
366,
508,
29915,
29873,
437,
393,
411,
393,
5455,
29889,
8561,
376,
13,
462,
4706,
376,
29879,
545,
1716,
11192,
310,
278,
5455,
526,
278,
1492,
1134,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
16669,
385,
5858,
411,
1751,
4167,
310,
278,
2743,
1134,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
5858,
29892,
2175,
29892,
1492,
29892,
3579,
19290,
1125,
13,
4706,
1015,
29918,
978,
353,
6418,
1001,
8098,
29918,
2287,
7187,
24290,
2725,
29889,
657,
29898,
16453,
17255,
1990,
1649,
29892,
13,
462,
462,
9651,
851,
29898,
16453,
876,
13,
4706,
2175,
29918,
978,
353,
2175,
29889,
2976,
1070,
29918,
978,
13,
4706,
1492,
29918,
978,
353,
1492,
29889,
2976,
1070,
29918,
978,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
13,
462,
29871,
525,
16453,
2396,
5858,
29892,
525,
459,
29918,
978,
2396,
1015,
29918,
978,
29892,
13,
462,
29871,
525,
1563,
2396,
2175,
29892,
525,
1266,
2396,
1492,
29892,
13,
462,
29871,
525,
1563,
29918,
978,
2396,
2175,
29918,
978,
29892,
525,
1266,
29918,
978,
2396,
1492,
29918,
978,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
8340,
29918,
2248,
292,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
21403,
11374,
9995,
13,
1678,
3611,
353,
376,
13919,
11374,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
27541,
426,
1563,
29918,
978,
29913,
411,
426,
1266,
29918,
978,
29913,
373,
1196,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1836,
1205,
366,
508,
29915,
29873,
2380,
426,
1563,
29918,
978,
29913,
411,
376,
13,
462,
4706,
29850,
1266,
29918,
978,
29913,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
4852,
24301,
4519,
16388,
304,
1246,
385,
869,
2248,
580,
5858,
373,
263,
1134,
29908,
13,
462,
268,
376,
411,
263,
1134,
393,
9007,
29915,
29873,
22691,
23157,
13,
1678,
286,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
2175,
29892,
1492,
29892,
3579,
19290,
1125,
13,
4706,
2175,
29918,
978,
353,
2175,
29889,
2976,
1070,
29918,
978,
13,
4706,
1492,
29918,
978,
353,
1492,
29889,
2976,
1070,
29918,
978,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
13,
462,
29871,
525,
1563,
2396,
2175,
29892,
525,
1266,
2396,
1492,
29892,
13,
462,
29871,
525,
1563,
29918,
978,
2396,
2175,
29918,
978,
29892,
525,
1266,
29918,
978,
2396,
1492,
29918,
978,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
3443,
29918,
1853,
29918,
29885,
1608,
905,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
24953,
1134,
29635,
9995,
13,
1678,
3611,
353,
376,
9329,
5167,
341,
1608,
905,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
3342,
278,
3443,
426,
15501,
29918,
978,
29918,
4906,
29913,
373,
1196,
426,
5479,
29889,
1220,
29913,
376,
13,
462,
4706,
376,
294,
426,
15501,
29918,
1853,
29918,
978,
1836,
2398,
29892,
278,
2980,
4502,
304,
393,
3443,
376,
13,
462,
4706,
376,
11102,
426,
23516,
29918,
1853,
29918,
978,
1836,
450,
11595,
3443,
1134,
1818,
1993,
278,
2980,
29915,
29879,
1134,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
16669,
263,
740,
5023,
988,
263,
3443,
1134,
322,
2980,
1134,
892,
451,
5186,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3443,
29918,
978,
29892,
3443,
29892,
2980,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
3443,
29918,
1853,
29918,
978,
353,
3443,
29889,
2976,
1070,
29918,
978,
13,
4706,
2980,
29918,
1853,
29918,
978,
353,
2980,
29889,
2976,
1070,
29918,
978,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
13,
462,
29871,
525,
15501,
29918,
978,
2396,
3443,
29918,
978,
29892,
13,
462,
29871,
525,
15501,
29918,
978,
29918,
4906,
2396,
3461,
29889,
4830,
29889,
978,
29898,
15501,
29918,
978,
511,
13,
462,
29871,
525,
15501,
29918,
1853,
2396,
3443,
29892,
13,
462,
29871,
525,
23516,
29918,
1853,
2396,
2980,
29892,
13,
462,
29871,
525,
15501,
29918,
1853,
29918,
978,
2396,
3443,
29918,
1853,
29918,
978,
29892,
13,
462,
29871,
525,
23516,
29918,
1853,
29918,
978,
2396,
2980,
29918,
1853,
29918,
978,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
1303,
29918,
449,
29918,
974,
29918,
6078,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
7523,
714,
310,
6874,
9995,
13,
1678,
3611,
353,
376,
6359,
714,
310,
317,
4338,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
16388,
304,
1303,
278,
2286,
426,
978,
29918,
4906,
29913,
376,
13,
462,
4706,
376,
3166,
263,
1422,
6874,
373,
1196,
426,
5479,
29889,
1220,
1836,
887,
376,
13,
462,
4706,
376,
9344,
871,
671,
3651,
2768,
278,
740,
896,
376,
13,
462,
4706,
376,
29893,
406,
8052,
297,
1213,
13,
462,
4706,
1723,
13,
1678,
925,
2450,
353,
376,
24301,
4519,
1303,
263,
2286,
393,
1258,
451,
1863,
297,
445,
6874,
541,
22856,
297,
1790,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
29937,
14402,
29901,
25034,
1438,
13,
1990,
1134,
29918,
25990,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
5167,
3620,
9995,
13,
1678,
3611,
353,
376,
1542,
678,
6916,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
2286,
426,
978,
29918,
4906,
29913,
3939,
1134,
515,
426,
1025,
29913,
304,
376,
13,
462,
4706,
29850,
1482,
29913,
373,
1196,
426,
5479,
29889,
1220,
1836,
1159,
13,
1678,
925,
2450,
353,
5124,
13,
1678,
286,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
2030,
29892,
716,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
1024,
29892,
13,
462,
29871,
525,
978,
29918,
4906,
2396,
3461,
29889,
4830,
29889,
978,
29898,
978,
511,
13,
462,
29871,
525,
1025,
2396,
2030,
29892,
525,
1482,
2396,
716,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
19039,
29918,
7496,
29918,
17519,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
853,
15107,
653,
1473,
5443,
9995,
13,
1678,
3611,
353,
376,
2525,
15107,
653,
6440,
25889,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
505,
385,
421,
361,
29952,
3229,
988,
697,
310,
278,
1023,
14202,
29908,
13,
462,
539,
376,
871,
756,
421,
3364,
29952,
297,
967,
3573,
29892,
373,
1196,
426,
5479,
29889,
1220,
29913,
1213,
13,
462,
4706,
376,
887,
9273,
29915,
29873,
817,
385,
4069,
3573,
23157,
13,
1678,
925,
2450,
353,
376,
8439,
338,
385,
1683,
470,
565,
3229,
1058,
29915,
29879,
3573,
338,
925,
1209,
1213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
1683,
29918,
265,
29918,
7888,
29918,
2587,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
15785,
373,
21493,
3573,
9995,
13,
1678,
3611,
353,
376,
27406,
373,
21493,
24928,
29908,
13,
1678,
2643,
29918,
6886,
353,
376,
4986,
3970,
29908,
13,
1678,
925,
2450,
353,
5124,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
16732,
29918,
4804,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
16732,
1246,
9995,
13,
1678,
3611,
353,
376,
4789,
25397,
8251,
29908,
13,
1678,
2643,
29918,
6886,
353,
376,
4986,
3970,
29908,
13,
1678,
925,
2450,
353,
5124,
13,
1678,
286,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
451,
29918,
29874,
29918,
2220,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
2216,
263,
740,
9995,
13,
1678,
3611,
353,
376,
3664,
263,
6680,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3492,
16388,
304,
1246,
426,
978,
29913,
408,
565,
372,
29908,
13,
462,
4706,
376,
471,
263,
740,
373,
1196,
426,
5479,
29889,
1220,
1836,
2398,
1699,
13,
462,
4706,
376,
393,
4603,
471,
2869,
263,
426,
13998,
29918,
1853,
1836,
1159,
13,
1678,
925,
2450,
353,
5124,
13,
1678,
396,
14402,
29901,
853,
29885,
1082,
29973,
13,
1678,
396,
29885,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
2000,
29918,
1853,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
13512,
29918,
978,
353,
2000,
29918,
1853,
29889,
2976,
1070,
29918,
978,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
1024,
29892,
13,
462,
29871,
525,
13998,
29918,
1853,
2396,
2000,
29918,
1853,
29892,
13,
462,
29871,
525,
2976,
1070,
29918,
978,
2396,
13512,
29918,
978,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
9621,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
10240,
29918,
279,
537,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
512,
15728,
564,
537,
9995,
13,
1678,
3611,
353,
376,
797,
15728,
826,
537,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
740,
426,
2220,
29918,
978,
29918,
4906,
29913,
471,
2183,
278,
376,
13,
462,
4706,
376,
15866,
549,
1353,
310,
6273,
23157,
13,
1678,
925,
2450,
353,
5124,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
740,
29918,
978,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
740,
29918,
978,
29922,
2220,
29918,
978,
29892,
13,
462,
308,
740,
29918,
978,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
2220,
29918,
978,
511,
13,
462,
308,
3579,
19290,
29897,
13,
13,
13,
1990,
3883,
29918,
1333,
29918,
11940,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
15591,
451,
1476,
9995,
13,
1678,
3611,
353,
376,
7355,
2216,
7460,
29908,
13,
1678,
2643,
29918,
6886,
353,
376,
4986,
3970,
29908,
13,
1678,
925,
2450,
353,
5124,
13,
1678,
286,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
338,
29918,
16626,
29922,
8824,
29892,
1059,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
4235,
353,
8853,
5479,
1115,
4423,
29892,
376,
978,
1115,
1024,
29892,
13,
462,
29871,
376,
275,
29918,
16626,
1115,
338,
29918,
16626,
29892,
376,
2704,
1115,
1059,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
9773,
29918,
517,
29918,
5464,
29918,
1761,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
22871,
304,
1661,
29899,
1761,
9995,
13,
1678,
3611,
353,
376,
18277,
304,
1661,
29899,
1761,
29908,
13,
1678,
2643,
29918,
6886,
353,
376,
4986,
3970,
29908,
13,
1678,
925,
2450,
353,
5124,
13,
1678,
286,
3860,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3935,
29918,
1853,
29892,
3579,
19290,
1125,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
376,
978,
1115,
1024,
29892,
13,
462,
29871,
376,
19304,
29918,
1853,
1115,
3935,
29918,
1853,
29913,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
4235,
29922,
9621,
29892,
3579,
19290,
29897,
13,
13,
13,
1990,
9322,
29918,
2220,
29918,
16553,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
6680,
3342,
451,
472,
2246,
29899,
5563,
9995,
13,
1678,
2643,
29918,
6886,
353,
4852,
1576,
740,
426,
978,
29918,
4906,
29913,
471,
3342,
2768,
310,
1790,
29908,
13,
462,
4706,
376,
1271,
373,
1196,
426,
5479,
29889,
1220,
1836,
1152,
2777,
29892,
366,
1122,
376,
13,
462,
4706,
376,
17532,
7180,
372,
2768,
1790,
740,
5023,
29892,
470,
376,
13,
462,
4706,
376,
26102,
310,
263,
2425,
29889,
1938,
451,
17763,
596,
740,
376,
13,
462,
4706,
376,
16553,
29991,
1159,
13,
1678,
3611,
353,
376,
10310,
29915,
29873,
405,
342,
6680,
29879,
29908,
13,
1678,
925,
2450,
353,
376,
9692,
263,
6680,
3206,
393,
471,
451,
472,
278,
2246,
29899,
5563,
1213,
13,
1678,
286,
3860,
353,
5852,
13,
1678,
443,
1557,
4395,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5479,
29922,
5479,
29892,
1024,
29922,
978,
29892,
13,
462,
308,
1024,
29918,
4906,
29922,
12276,
29889,
4830,
29889,
978,
29898,
978,
511,
3579,
19290,
29897,
13,
13,
13,
1990,
443,
3880,
29918,
2457,
287,
29918,
1767,
29898,
29911,
26056,
29737,
1627,
1125,
13,
1678,
9995,
1222,
558,
2943,
750,
263,
1661,
29899,
8516,
995,
9995,
13,
1678,
3611,
353,
376,
9260,
2216,
4803,
6680,
29915,
29879,
7106,
7865,
29908,
13,
1678,
2643,
29918,
6886,
353,
4852,
3112,
3430,
763,
366,
2000,
278,
426,
4804,
29918,
1853,
29913,
426,
978,
29918,
4906,
29913,
373,
376,
13,
462,
4706,
29850,
5479,
29889,
1220,
1118,
541,
5229,
304,
3787,
278,
1121,
297,
376,
13,
462,
4706,
376,
29874,
2286,
470,
671,
372,
297,
385,
4603,
29889,
887,
881,
376,
13,
462,
4706,
376,
1745,
1096,
304,
671,
278,
1121,
29991,
1159,
13,
1678,
925,
2450,
353,
376,
10960,
2943,
12833,
263,
1661,
29899,
8516,
995,
1213,
13,
1678,
286,
3860,
353,
5852,
13,
1678,
443,
1557,
4395,
353,
5852,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
1024,
29892,
1246,
29918,
1853,
29892,
1121,
29918,
1853,
29892,
3579,
19290,
1125,
13,
4706,
3461,
353,
9049,
5085,
29889,
657,
703,
12276,
613,
14861,
1177,
29918,
1525,
15082,
29897,
13,
4706,
4235,
353,
11117,
5479,
2396,
4423,
29892,
525,
978,
2396,
1024,
29892,
525,
4804,
29918,
1853,
2396,
1246,
29918,
1853,
29892,
13,
462,
29871,
525,
2914,
29918,
1853,
2396,
1121,
29918,
1853,
29892,
13,
462,
29871,
525,
978,
29918,
4906,
2396,
3461,
29889,
4830,
29889,
978,
29898,
978,
2915,
13,
4706,
2428,
2141,
1649,
2344,
12035,
9621,
29922,
9621,
29892,
4423,
29922,
5479,
29892,
3579,
19290,
29897,
13,
13,
13,
12008,
13,
4986,
3970,
29901,
4231,
728,
1438,
12747,
13,
29908,
8915,
24928,
1115,
19997,
396,
3139,
671,
310,
1209,
373,
967,
1914,
13,
29908,
22995,
15628,
11790,
3245,
1115,
19997,
396,
530,
565,
29914,
2870,
411,
4069,
1683,
470,
565,
13,
29908,
2525,
15107,
653,
6978,
1115,
19997,
396,
3139,
671,
310,
1209,
13,
29908,
18277,
304,
1661,
29899,
1761,
1115,
19997,
396,
6212,
3456,
287,
304,
671,
278,
9773,
1158,
373,
263,
1661,
29899,
1761,
13,
29908,
29965,
8485,
12541,
1051,
1115,
19997,
396,
13,
29908,
2525,
3880,
12541,
2286,
1115,
19997,
396,
13,
29908,
1542,
3620,
1115,
19997,
396,
13,
29908,
14148,
3168,
1115,
19997,
396,
13,
29908,
3664,
263,
740,
1115,
19997,
396,
6212,
3456,
304,
1246,
1661,
29899,
2220,
408,
740,
13,
29908,
4789,
25397,
8251,
1115,
19997,
13,
29908,
797,
15728,
826,
537,
1115,
19997,
13,
29908,
29909,
492,
1463,
4240,
29899,
262,
1115,
19997,
396,
13,
29908,
4062,
451,
297,
5167,
1115,
19997,
396,
319,
1158,
471,
1304,
393,
3282,
29915,
29873,
1863,
363,
393,
1134,
13,
29908,
4035,
5453,
451,
1476,
1115,
19997,
13,
29908,
7355,
451,
1476,
1115,
19997,
13,
29908,
27406,
373,
2425,
3573,
1115,
19997,
396,
501,
8485,
385,
15785,
373,
263,
1152,
470,
5806,
13,
12008,
13,
13,
29937,
14402,
29901,
11243,
2877,
2012,
310,
12827,
13,
2
] |
baseDeConversao.py | wcalazans81/Mundo_02_Python | 0 | 115280 | print('\033[34m^=\033[m' * 27)
print('Conversor de decimal para binário, octol e hexadecimal')
print('\033[34m=^\033[m' * 27)
print("""Opção [1] Binário
Opção [2] Octal
Opção [3] Hexadecimal""")
print('\033[34m^=\033[m' * 27)
num = int(input('Digite o valor que deseja converter: '))
op = int(input('Digite a opção de conversão que deseja: '))
if op == 1:
print('O número {} convertido para Binário é {}'.format(num, bin(num)[2:]))
elif op == 2:
print('O número {} convertido para Octal é {}'.format(num, oct(num)[2:]))
elif op == 3:
print('O número {} convertido para Hexadecimal é {}'.format(num, hex(num)[2:]))
else:
print('\033[31mOpção inválida tente novamente !!!\033[m')
| [
1,
1596,
28909,
29900,
29941,
29941,
29961,
29941,
29946,
29885,
29985,
2013,
29900,
29941,
29941,
29961,
29885,
29915,
334,
29871,
29906,
29955,
29897,
13,
2158,
877,
1168,
874,
272,
316,
13677,
1702,
9016,
12288,
29892,
4725,
324,
321,
15090,
1943,
29883,
3039,
1495,
13,
2158,
28909,
29900,
29941,
29941,
29961,
29941,
29946,
29885,
29922,
3823,
29900,
29941,
29941,
29961,
29885,
29915,
334,
29871,
29906,
29955,
29897,
13,
2158,
703,
15945,
11746,
2340,
518,
29896,
29962,
27662,
12288,
13,
11746,
2340,
518,
29906,
29962,
4756,
284,
13,
11746,
2340,
518,
29941,
29962,
379,
735,
1943,
29883,
3039,
15945,
1159,
13,
2158,
28909,
29900,
29941,
29941,
29961,
29941,
29946,
29885,
29985,
2013,
29900,
29941,
29941,
29961,
29885,
29915,
334,
29871,
29906,
29955,
29897,
13,
1949,
353,
938,
29898,
2080,
877,
14991,
568,
288,
16497,
712,
553,
29872,
1764,
29105,
29901,
525,
876,
13,
459,
353,
938,
29898,
2080,
877,
14991,
568,
263,
1015,
2340,
316,
9678,
1368,
712,
553,
29872,
1764,
29901,
525,
876,
13,
361,
1015,
1275,
29871,
29896,
29901,
13,
1678,
1596,
877,
29949,
13831,
6571,
3588,
1941,
1702,
27662,
12288,
904,
6571,
4286,
4830,
29898,
1949,
29892,
9016,
29898,
1949,
9601,
29906,
29901,
12622,
13,
23681,
1015,
1275,
29871,
29906,
29901,
13,
1678,
1596,
877,
29949,
13831,
6571,
3588,
1941,
1702,
4756,
284,
904,
6571,
4286,
4830,
29898,
1949,
29892,
4725,
29898,
1949,
9601,
29906,
29901,
12622,
13,
23681,
1015,
1275,
29871,
29941,
29901,
13,
1678,
1596,
877,
29949,
13831,
6571,
3588,
1941,
1702,
379,
735,
1943,
29883,
3039,
904,
6571,
4286,
4830,
29898,
1949,
29892,
15090,
29898,
1949,
9601,
29906,
29901,
12622,
13,
2870,
29901,
13,
1678,
1596,
28909,
29900,
29941,
29941,
29961,
29941,
29896,
29885,
11746,
2340,
2437,
2464,
1458,
260,
2016,
2420,
2503,
1738,
6824,
29905,
29900,
29941,
29941,
29961,
29885,
1495,
13,
2
] |
clinica/pipelines/pet_linear/pet_linear_utils.py | Raelag0112/clinica | 1 | 148024 | # coding: utf8
# Functions used by nipype interface.
# Initiate the pipeline
def init_input_node(pet):
from clinica.utils.filemanip import get_subject_id
from clinica.utils.ux import print_begin_image
# Extract image ID
image_id = get_subject_id(pet)
print_begin_image(image_id)
return pet
# Concatenate two transformation in one transformation list
def concatenate_transforms(pet_to_t1w_tranform, t1w_to_mni_tranform):
"""Concatenate two input transformation files into a list.
Args:
transform1 (str): first transformation to apply
transform2 (str): second transformation to apply
Returns:
transform_list (list of string): both transform files path in a list
"""
return [t1w_to_mni_tranform, pet_to_t1w_tranform]
# Normalize the images based on the reference mask region
def suvr_normalization(input_img, norm_img, ref_mask):
"""Normalize the input image according to the reference region.
It uses nilearn `resample_to_img` and scipy `trim_mean` functions.
This function is different than the one in other PET pipelines
because there is a downsampling step.
Args:
input_img (str): image to be processed
norm_img (str): image used to compute the mean of the reference region
ref_mask (str): mask of the reference region
Returns:
output_img (nifty image): normalized nifty image
mask_template (nifty image): output mask on disk
"""
import os
import nibabel as nib
import numpy as np
from nilearn.image import resample_to_img
from scipy.stats import trim_mean
pet = nib.load(input_img)
norm = nib.load(norm_img)
mask = nib.load(ref_mask)
# Downsample the pet image used for normalization so we can multiply it with the mask
ds_img = resample_to_img(norm, mask, interpolation="nearest")
# Compute the mean of the region
region = np.multiply(ds_img.get_fdata(), mask.get_fdata(dtype="float32"))
array_region = np.where(region != 0, region, np.nan).flatten()
region_mean = trim_mean(array_region[~np.isnan(array_region)], 0.1)
from clinica.utils.stream import cprint
cprint(region_mean)
# Divide the value of the image voxels by the computed mean
data = pet.get_fdata(dtype="float32") / region_mean
# Create and save the normalized image
output_img = os.path.join(
os.getcwd(),
os.path.basename(input_img).split(".nii")[0] + "_suvr_normalized.nii.gz",
)
normalized_img = nib.Nifti1Image(data, pet.affine, header=pet.header)
normalized_img.to_filename(output_img)
return output_img
# It crops an image based on the reference.
def crop_nifti(input_img, ref_crop):
"""Crop input image based on the reference. It uses nilearn
`resample_to_img` function.
Args:
input_img (str): image to be processed
ref_img (str): template used to crop the image
Returns:
output_img (nifty image): crop image on disk.
crop_template (nifty image): output template on disk.
"""
import os
import nibabel as nib
import numpy as np
from nilearn.image import resample_to_img
basedir = os.getcwd()
# resample the individual MRI into the cropped template image
crop_img = resample_to_img(input_img, ref_crop, force_resample=True)
output_img = os.path.join(
basedir, os.path.basename(input_img).split(".nii")[0] + "_cropped.nii.gz"
)
crop_img.to_filename(output_img)
return output_img
def rename_into_caps(
in_bids_pet,
fname_pet,
fname_trans,
suvr_reference_region,
uncropped_image,
fname_pet_in_t1w=None,
):
"""
Rename the outputs of the pipelines into CAPS format.
Args:
in_bids_pet (str): Input BIDS PET to extract the <source_file>
fname_pet (str): Preprocessed PET file.
fname_trans (str): Transformation file from PET to MRI space
suvr_reference_region (str): SUVR mask name for file name output
uncropped_image (bool): Pipeline argument for image cropping
fname_pet_in_t1w (bool): Pipeline argument for saving intermediate file
Returns:
The different outputs in CAPS format
"""
import os
from nipype.interfaces.utility import Rename
from nipype.utils.filemanip import split_filename
_, source_file_pet, _ = split_filename(in_bids_pet)
# Rename into CAPS PET:
rename_pet = Rename()
rename_pet.inputs.in_file = fname_pet
if not uncropped_image:
suffix = f"_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-{suvr_reference_region}_pet.nii.gz"
rename_pet.inputs.format_string = source_file_pet + suffix
else:
suffix = f"_space-MNI152NLin2009cSym_res-1x1x1_suvr-{suvr_reference_region}_pet.nii.gz"
rename_pet.inputs.format_string = source_file_pet + suffix
out_caps_pet = rename_pet.run().outputs.out_file
# Rename into CAPS transformation file:
rename_trans = Rename()
rename_trans.inputs.in_file = fname_trans
rename_trans.inputs.format_string = source_file_pet + "_space-T1w_rigid.mat"
out_caps_trans = rename_trans.run().outputs.out_file
# Rename intermediate PET in T1w MRI space
if fname_pet_in_t1w is not None:
rename_pet_in_t1w = Rename()
rename_pet_in_t1w.inputs.in_file = fname_pet_in_t1w
rename_pet_in_t1w.inputs.format_string = (
source_file_pet + "_space-T1w_pet.nii.gz"
)
out_caps_pet_in_t1w = rename_pet_in_t1w.run().outputs.out_file
else:
out_caps_pet_in_t1w = None
return out_caps_pet, out_caps_trans, out_caps_pet_in_t1w
def print_end_pipeline(pet, final_file):
"""
Display end message for <subject_id> when <final_file> is connected.
"""
from clinica.utils.filemanip import get_subject_id
from clinica.utils.ux import print_end_image
print_end_image(get_subject_id(pet))
| [
1,
396,
14137,
29901,
23616,
29947,
13,
13,
13,
29937,
6680,
29879,
1304,
491,
302,
666,
668,
5067,
29889,
13,
13,
29937,
512,
4812,
403,
278,
16439,
13,
1753,
2069,
29918,
2080,
29918,
3177,
29898,
10963,
1125,
13,
1678,
515,
24899,
983,
29889,
13239,
29889,
1445,
1171,
666,
1053,
679,
29918,
16009,
29918,
333,
13,
1678,
515,
24899,
983,
29889,
13239,
29889,
1314,
1053,
1596,
29918,
463,
29918,
3027,
13,
13,
1678,
396,
7338,
1461,
1967,
3553,
13,
1678,
1967,
29918,
333,
353,
679,
29918,
16009,
29918,
333,
29898,
10963,
29897,
13,
1678,
1596,
29918,
463,
29918,
3027,
29898,
3027,
29918,
333,
29897,
13,
1678,
736,
5697,
13,
13,
13,
29937,
23924,
2579,
403,
1023,
13852,
297,
697,
13852,
1051,
13,
1753,
16125,
403,
29918,
9067,
29879,
29898,
10963,
29918,
517,
29918,
29873,
29896,
29893,
29918,
509,
273,
689,
29892,
260,
29896,
29893,
29918,
517,
29918,
29885,
1240,
29918,
509,
273,
689,
1125,
13,
1678,
9995,
1168,
29883,
2579,
403,
1023,
1881,
13852,
2066,
964,
263,
1051,
29889,
13,
1678,
826,
3174,
29901,
13,
539,
4327,
29896,
313,
710,
1125,
937,
13852,
304,
3394,
13,
539,
4327,
29906,
313,
710,
1125,
1473,
13852,
304,
3394,
13,
1678,
16969,
29901,
13,
539,
4327,
29918,
1761,
313,
1761,
310,
1347,
1125,
1716,
4327,
2066,
2224,
297,
263,
1051,
13,
1678,
9995,
13,
1678,
736,
518,
29873,
29896,
29893,
29918,
517,
29918,
29885,
1240,
29918,
509,
273,
689,
29892,
5697,
29918,
517,
29918,
29873,
29896,
29893,
29918,
509,
273,
689,
29962,
13,
13,
13,
29937,
21981,
675,
278,
4558,
2729,
373,
278,
3407,
11105,
5120,
13,
1753,
480,
13416,
29918,
8945,
2133,
29898,
2080,
29918,
2492,
29892,
6056,
29918,
2492,
29892,
2143,
29918,
13168,
1125,
13,
1678,
9995,
19077,
675,
278,
1881,
1967,
5034,
304,
278,
3407,
5120,
29889,
13,
1678,
739,
3913,
302,
488,
2753,
421,
690,
981,
29918,
517,
29918,
2492,
29952,
322,
4560,
2272,
421,
15450,
29918,
12676,
29952,
3168,
29889,
13,
1678,
910,
740,
338,
1422,
1135,
278,
697,
297,
916,
349,
2544,
8450,
24210,
13,
1678,
1363,
727,
338,
263,
1623,
13445,
10335,
4331,
29889,
13,
1678,
826,
3174,
29901,
13,
539,
1881,
29918,
2492,
313,
710,
1125,
1967,
304,
367,
19356,
13,
539,
6056,
29918,
2492,
313,
710,
1125,
1967,
1304,
304,
10272,
278,
2099,
310,
278,
3407,
5120,
13,
539,
2143,
29918,
13168,
313,
710,
1125,
11105,
310,
278,
3407,
5120,
13,
1678,
16969,
29901,
13,
539,
1962,
29918,
2492,
313,
29876,
361,
1017,
1967,
1125,
4226,
1891,
302,
361,
1017,
1967,
13,
539,
11105,
29918,
6886,
313,
29876,
361,
1017,
1967,
1125,
1962,
11105,
373,
8086,
13,
1678,
9995,
13,
13,
1678,
1053,
2897,
13,
13,
1678,
1053,
302,
747,
1107,
408,
302,
747,
13,
1678,
1053,
12655,
408,
7442,
13,
1678,
515,
302,
488,
2753,
29889,
3027,
1053,
620,
981,
29918,
517,
29918,
2492,
13,
1678,
515,
4560,
2272,
29889,
16202,
1053,
17151,
29918,
12676,
13,
13,
1678,
5697,
353,
302,
747,
29889,
1359,
29898,
2080,
29918,
2492,
29897,
13,
1678,
6056,
353,
302,
747,
29889,
1359,
29898,
12324,
29918,
2492,
29897,
13,
1678,
11105,
353,
302,
747,
29889,
1359,
29898,
999,
29918,
13168,
29897,
13,
13,
1678,
396,
9943,
11249,
278,
5697,
1967,
1304,
363,
4226,
2133,
577,
591,
508,
22932,
372,
411,
278,
11105,
13,
1678,
18031,
29918,
2492,
353,
620,
981,
29918,
517,
29918,
2492,
29898,
12324,
29892,
11105,
29892,
29694,
543,
28502,
342,
1159,
13,
13,
1678,
396,
11796,
29872,
278,
2099,
310,
278,
5120,
13,
1678,
5120,
353,
7442,
29889,
18056,
368,
29898,
6289,
29918,
2492,
29889,
657,
29918,
29888,
1272,
3285,
11105,
29889,
657,
29918,
29888,
1272,
29898,
29881,
1853,
543,
7411,
29941,
29906,
5783,
13,
1678,
1409,
29918,
12803,
353,
7442,
29889,
3062,
29898,
12803,
2804,
29871,
29900,
29892,
5120,
29892,
7442,
29889,
13707,
467,
1579,
8606,
580,
13,
1678,
5120,
29918,
12676,
353,
17151,
29918,
12676,
29898,
2378,
29918,
12803,
29961,
30022,
9302,
29889,
275,
13707,
29898,
2378,
29918,
12803,
29897,
1402,
29871,
29900,
29889,
29896,
29897,
13,
13,
1678,
515,
24899,
983,
29889,
13239,
29889,
5461,
1053,
274,
2158,
13,
13,
1678,
274,
2158,
29898,
12803,
29918,
12676,
29897,
13,
13,
1678,
396,
4910,
680,
278,
995,
310,
278,
1967,
992,
29916,
1379,
491,
278,
15712,
2099,
13,
1678,
848,
353,
5697,
29889,
657,
29918,
29888,
1272,
29898,
29881,
1853,
543,
7411,
29941,
29906,
1159,
847,
5120,
29918,
12676,
13,
13,
1678,
396,
6204,
322,
4078,
278,
4226,
1891,
1967,
13,
1678,
1962,
29918,
2492,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
4706,
2897,
29889,
657,
29883,
9970,
3285,
13,
4706,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
2080,
29918,
2492,
467,
5451,
17350,
1240,
29875,
1159,
29961,
29900,
29962,
718,
11119,
2146,
13416,
29918,
8945,
1891,
29889,
1240,
29875,
29889,
18828,
613,
13,
1678,
1723,
13,
13,
1678,
4226,
1891,
29918,
2492,
353,
302,
747,
29889,
29940,
2027,
29875,
29896,
2940,
29898,
1272,
29892,
5697,
29889,
3470,
457,
29892,
4839,
29922,
10963,
29889,
6672,
29897,
13,
1678,
4226,
1891,
29918,
2492,
29889,
517,
29918,
9507,
29898,
4905,
29918,
2492,
29897,
13,
13,
1678,
736,
1962,
29918,
2492,
13,
13,
13,
29937,
739,
8182,
567,
385,
1967,
2729,
373,
278,
3407,
29889,
13,
1753,
274,
1336,
29918,
29876,
2027,
29875,
29898,
2080,
29918,
2492,
29892,
2143,
29918,
29883,
1336,
1125,
13,
1678,
9995,
29907,
1336,
1881,
1967,
2729,
373,
278,
3407,
29889,
739,
3913,
302,
488,
2753,
13,
1678,
421,
690,
981,
29918,
517,
29918,
2492,
29952,
740,
29889,
13,
1678,
826,
3174,
29901,
13,
539,
1881,
29918,
2492,
313,
710,
1125,
1967,
304,
367,
19356,
13,
539,
2143,
29918,
2492,
313,
710,
1125,
4472,
1304,
304,
274,
1336,
278,
1967,
13,
1678,
16969,
29901,
13,
539,
1962,
29918,
2492,
313,
29876,
361,
1017,
1967,
1125,
274,
1336,
1967,
373,
8086,
29889,
13,
539,
274,
1336,
29918,
6886,
313,
29876,
361,
1017,
1967,
1125,
1962,
4472,
373,
8086,
29889,
13,
1678,
9995,
13,
13,
1678,
1053,
2897,
13,
13,
1678,
1053,
302,
747,
1107,
408,
302,
747,
13,
1678,
1053,
12655,
408,
7442,
13,
1678,
515,
302,
488,
2753,
29889,
3027,
1053,
620,
981,
29918,
517,
29918,
2492,
13,
13,
1678,
2729,
381,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
13,
1678,
396,
620,
981,
278,
5375,
341,
3960,
964,
278,
8182,
2986,
4472,
1967,
13,
1678,
274,
1336,
29918,
2492,
353,
620,
981,
29918,
517,
29918,
2492,
29898,
2080,
29918,
2492,
29892,
2143,
29918,
29883,
1336,
29892,
4889,
29918,
690,
981,
29922,
5574,
29897,
13,
13,
1678,
1962,
29918,
2492,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
4706,
2729,
381,
29892,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
2080,
29918,
2492,
467,
5451,
17350,
1240,
29875,
1159,
29961,
29900,
29962,
718,
11119,
24077,
2986,
29889,
1240,
29875,
29889,
18828,
29908,
13,
1678,
1723,
13,
13,
1678,
274,
1336,
29918,
2492,
29889,
517,
29918,
9507,
29898,
4905,
29918,
2492,
29897,
13,
13,
1678,
736,
1962,
29918,
2492,
13,
13,
13,
1753,
19508,
29918,
8941,
29918,
29883,
2547,
29898,
13,
1678,
297,
29918,
29890,
4841,
29918,
10963,
29892,
13,
1678,
285,
978,
29918,
10963,
29892,
13,
1678,
285,
978,
29918,
3286,
29892,
13,
1678,
480,
13416,
29918,
5679,
29918,
12803,
29892,
13,
1678,
443,
24077,
2986,
29918,
3027,
29892,
13,
1678,
285,
978,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
29922,
8516,
29892,
13,
1125,
13,
1678,
9995,
13,
1678,
390,
3871,
278,
14391,
310,
278,
8450,
24210,
964,
315,
3301,
29903,
3402,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
297,
29918,
29890,
4841,
29918,
10963,
313,
710,
1125,
10567,
350,
1367,
29903,
349,
2544,
304,
6597,
278,
529,
4993,
29918,
1445,
29958,
13,
4706,
285,
978,
29918,
10963,
313,
710,
1125,
4721,
5014,
287,
349,
2544,
934,
29889,
13,
4706,
285,
978,
29918,
3286,
313,
710,
1125,
4103,
5404,
934,
515,
349,
2544,
304,
341,
3960,
2913,
13,
4706,
480,
13416,
29918,
5679,
29918,
12803,
313,
710,
1125,
20134,
29963,
29934,
11105,
1024,
363,
934,
1024,
1962,
13,
4706,
443,
24077,
2986,
29918,
3027,
313,
11227,
1125,
349,
23828,
2980,
363,
1967,
8182,
3262,
13,
4706,
285,
978,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
313,
11227,
1125,
349,
23828,
2980,
363,
14238,
19697,
934,
13,
1678,
16969,
29901,
13,
4706,
450,
1422,
14391,
297,
315,
3301,
29903,
3402,
13,
1678,
9995,
13,
1678,
1053,
2897,
13,
13,
1678,
515,
302,
666,
668,
29889,
1639,
8726,
29889,
329,
1793,
1053,
390,
3871,
13,
1678,
515,
302,
666,
668,
29889,
13239,
29889,
1445,
1171,
666,
1053,
6219,
29918,
9507,
13,
13,
1678,
17117,
2752,
29918,
1445,
29918,
10963,
29892,
903,
353,
6219,
29918,
9507,
29898,
262,
29918,
29890,
4841,
29918,
10963,
29897,
13,
13,
1678,
396,
390,
3871,
964,
315,
3301,
29903,
349,
2544,
29901,
13,
1678,
19508,
29918,
10963,
353,
390,
3871,
580,
13,
1678,
19508,
29918,
10963,
29889,
2080,
29879,
29889,
262,
29918,
1445,
353,
285,
978,
29918,
10963,
13,
1678,
565,
451,
443,
24077,
2986,
29918,
3027,
29901,
13,
4706,
25557,
353,
285,
29908,
29918,
3493,
29899,
29924,
12916,
29896,
29945,
29906,
29940,
11667,
29906,
29900,
29900,
29929,
29883,
25548,
29918,
14273,
29899,
29907,
1336,
29918,
690,
29899,
29896,
29916,
29896,
29916,
29896,
29918,
2146,
13416,
29899,
29912,
2146,
13416,
29918,
5679,
29918,
12803,
2403,
10963,
29889,
1240,
29875,
29889,
18828,
29908,
13,
4706,
19508,
29918,
10963,
29889,
2080,
29879,
29889,
4830,
29918,
1807,
353,
2752,
29918,
1445,
29918,
10963,
718,
25557,
13,
1678,
1683,
29901,
13,
4706,
25557,
353,
285,
29908,
29918,
3493,
29899,
29924,
12916,
29896,
29945,
29906,
29940,
11667,
29906,
29900,
29900,
29929,
29883,
25548,
29918,
690,
29899,
29896,
29916,
29896,
29916,
29896,
29918,
2146,
13416,
29899,
29912,
2146,
13416,
29918,
5679,
29918,
12803,
2403,
10963,
29889,
1240,
29875,
29889,
18828,
29908,
13,
4706,
19508,
29918,
10963,
29889,
2080,
29879,
29889,
4830,
29918,
1807,
353,
2752,
29918,
1445,
29918,
10963,
718,
25557,
13,
1678,
714,
29918,
29883,
2547,
29918,
10963,
353,
19508,
29918,
10963,
29889,
3389,
2141,
4905,
29879,
29889,
449,
29918,
1445,
13,
13,
1678,
396,
390,
3871,
964,
315,
3301,
29903,
13852,
934,
29901,
13,
1678,
19508,
29918,
3286,
353,
390,
3871,
580,
13,
1678,
19508,
29918,
3286,
29889,
2080,
29879,
29889,
262,
29918,
1445,
353,
285,
978,
29918,
3286,
13,
1678,
19508,
29918,
3286,
29889,
2080,
29879,
29889,
4830,
29918,
1807,
353,
2752,
29918,
1445,
29918,
10963,
718,
11119,
3493,
29899,
29911,
29896,
29893,
29918,
8966,
333,
29889,
2922,
29908,
13,
1678,
714,
29918,
29883,
2547,
29918,
3286,
353,
19508,
29918,
3286,
29889,
3389,
2141,
4905,
29879,
29889,
449,
29918,
1445,
13,
13,
1678,
396,
390,
3871,
19697,
349,
2544,
297,
323,
29896,
29893,
341,
3960,
2913,
13,
1678,
565,
285,
978,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
338,
451,
6213,
29901,
13,
4706,
19508,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
353,
390,
3871,
580,
13,
4706,
19508,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
29889,
2080,
29879,
29889,
262,
29918,
1445,
353,
285,
978,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
13,
4706,
19508,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
29889,
2080,
29879,
29889,
4830,
29918,
1807,
353,
313,
13,
9651,
2752,
29918,
1445,
29918,
10963,
718,
11119,
3493,
29899,
29911,
29896,
29893,
29918,
10963,
29889,
1240,
29875,
29889,
18828,
29908,
13,
4706,
1723,
13,
4706,
714,
29918,
29883,
2547,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
353,
19508,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
29889,
3389,
2141,
4905,
29879,
29889,
449,
29918,
1445,
13,
1678,
1683,
29901,
13,
4706,
714,
29918,
29883,
2547,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
353,
6213,
13,
13,
1678,
736,
714,
29918,
29883,
2547,
29918,
10963,
29892,
714,
29918,
29883,
2547,
29918,
3286,
29892,
714,
29918,
29883,
2547,
29918,
10963,
29918,
262,
29918,
29873,
29896,
29893,
13,
13,
13,
1753,
1596,
29918,
355,
29918,
13096,
5570,
29898,
10963,
29892,
2186,
29918,
1445,
1125,
13,
1678,
9995,
13,
1678,
17440,
1095,
2643,
363,
529,
16009,
29918,
333,
29958,
746,
529,
8394,
29918,
1445,
29958,
338,
6631,
29889,
13,
1678,
9995,
13,
1678,
515,
24899,
983,
29889,
13239,
29889,
1445,
1171,
666,
1053,
679,
29918,
16009,
29918,
333,
13,
1678,
515,
24899,
983,
29889,
13239,
29889,
1314,
1053,
1596,
29918,
355,
29918,
3027,
13,
13,
1678,
1596,
29918,
355,
29918,
3027,
29898,
657,
29918,
16009,
29918,
333,
29898,
10963,
876,
13,
2
] |
KNN/iris_knn.py | artalukd/Data_Mining_Lab | 2 | 199952 | <filename>KNN/iris_knn.py
# Example of kNN implemented from Scratch in Python
import numpy as np
from sklearn import datasets
'''
Before we actually start with writing a nearest neighbor classifier, we need to think about the data, i.e. the testset.
We will use the "iris" dataset provided by the datasets of the sklearn module.
The data set consists of 50 samples from each of three species of Iris
Iris setosa,
Iris virginica and
Iris versicolor.
Four features were measured from each sample: the length and the width of the sepals and petals, in centimetres.'''
iris = datasets.load_iris()
iris_data = iris.data
iris_labels = iris.target
print(iris_data[0], iris_data[79], iris_data[100])
print(iris_labels[0], iris_labels[79], iris_labels[100])
''' We create a trainset from the sets above. We use permutation from np.random to split the data randomly. '''
np.random.seed(42)
indices = np.random.permutation(len(iris_data))
n_training_samples = 12
trainset_data = iris_data[indices[:-n_training_samples]]
trainset_labels = iris_labels[indices[:-n_training_samples]]
testset_data = iris_data[indices[-n_training_samples:]]
testset_labels = iris_labels[indices[-n_training_samples:]]
print(trainset_data[:4], trainset_labels[:4])
print(testset_data[:4], testset_labels[:4])
'''
The following code is only necessary to visualize the data of our testset, not a part of the course.
Our data consists of four values per iris item, so we will reduce
the data to three values by dropping fourth value. You can change the dimensions on lines 48-50
This way, we are capable of depicting the data in 3-dimensional space:
'''
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
colours = ("r", "b")
X = []
for iclass in range(3):
X.append([[], [], []])
for i in range(len(trainset_data)):
if trainset_labels[i] == iclass:
X[iclass][0].append(trainset_data[i][0])
X[iclass][1].append(trainset_data[i][1])
X[iclass][2].append((trainset_data[i][2]))
colours = ("r", "g", "y")
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for iclass in range(3):
ax.scatter(X[iclass][0], X[iclass][1], X[iclass][2], c=colours[iclass])
plt.show()
| [
1,
529,
9507,
29958,
29968,
10262,
29914,
381,
275,
29918,
3959,
29876,
29889,
2272,
13,
29937,
8741,
310,
413,
10262,
8762,
515,
2522,
29878,
905,
297,
5132,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
19668,
1053,
20035,
13,
12008,
13,
18743,
591,
2869,
1369,
411,
5007,
263,
20471,
12307,
770,
3709,
29892,
591,
817,
304,
1348,
1048,
278,
848,
29892,
474,
29889,
29872,
29889,
278,
1243,
842,
29889,
29871,
13,
4806,
674,
671,
278,
376,
381,
275,
29908,
8783,
4944,
491,
278,
20035,
310,
278,
2071,
19668,
3883,
29889,
13,
13,
1576,
848,
731,
11624,
310,
29871,
29945,
29900,
11916,
515,
1269,
310,
2211,
6606,
310,
306,
3780,
13,
13,
29902,
3780,
731,
3628,
29892,
13,
29902,
3780,
10636,
5359,
983,
322,
13,
29902,
3780,
1224,
5283,
272,
29889,
13,
29943,
473,
5680,
892,
17005,
515,
1269,
4559,
29901,
278,
3309,
322,
278,
2920,
310,
278,
16345,
1338,
322,
5697,
1338,
29892,
297,
1644,
17528,
690,
29889,
12008,
13,
13,
381,
275,
353,
20035,
29889,
1359,
29918,
381,
275,
580,
13,
381,
275,
29918,
1272,
353,
3805,
275,
29889,
1272,
13,
381,
275,
29918,
21134,
353,
3805,
275,
29889,
5182,
13,
2158,
29898,
381,
275,
29918,
1272,
29961,
29900,
1402,
3805,
275,
29918,
1272,
29961,
29955,
29929,
1402,
3805,
275,
29918,
1272,
29961,
29896,
29900,
29900,
2314,
13,
2158,
29898,
381,
275,
29918,
21134,
29961,
29900,
1402,
3805,
275,
29918,
21134,
29961,
29955,
29929,
1402,
3805,
275,
29918,
21134,
29961,
29896,
29900,
29900,
2314,
13,
13,
12008,
1334,
1653,
263,
7945,
842,
515,
278,
6166,
2038,
29889,
1334,
671,
20005,
362,
515,
7442,
29889,
8172,
304,
6219,
278,
848,
20459,
29889,
14550,
13,
9302,
29889,
8172,
29889,
26776,
29898,
29946,
29906,
29897,
13,
513,
1575,
353,
7442,
29889,
8172,
29889,
546,
6149,
362,
29898,
2435,
29898,
381,
275,
29918,
1272,
876,
13,
29876,
29918,
26495,
29918,
27736,
353,
29871,
29896,
29906,
13,
14968,
842,
29918,
1272,
353,
3805,
275,
29918,
1272,
29961,
513,
1575,
7503,
29899,
29876,
29918,
26495,
29918,
27736,
5262,
13,
14968,
842,
29918,
21134,
353,
3805,
275,
29918,
21134,
29961,
513,
1575,
7503,
29899,
29876,
29918,
26495,
29918,
27736,
5262,
13,
1688,
842,
29918,
1272,
353,
3805,
275,
29918,
1272,
29961,
513,
1575,
14352,
29876,
29918,
26495,
29918,
27736,
29901,
5262,
13,
1688,
842,
29918,
21134,
353,
3805,
275,
29918,
21134,
29961,
513,
1575,
14352,
29876,
29918,
26495,
29918,
27736,
29901,
5262,
13,
2158,
29898,
14968,
842,
29918,
1272,
7503,
29946,
1402,
7945,
842,
29918,
21134,
7503,
29946,
2314,
13,
2158,
29898,
1688,
842,
29918,
1272,
7503,
29946,
1402,
1243,
842,
29918,
21134,
7503,
29946,
2314,
13,
13,
12008,
13,
1576,
1494,
775,
338,
871,
5181,
304,
7604,
675,
278,
848,
310,
1749,
1243,
842,
29892,
451,
263,
760,
310,
278,
3236,
29889,
29871,
13,
29949,
332,
848,
11624,
310,
3023,
1819,
639,
3805,
275,
2944,
29892,
577,
591,
674,
10032,
29871,
13,
1552,
848,
304,
2211,
1819,
491,
4441,
3262,
11582,
995,
29889,
887,
508,
1735,
278,
13391,
373,
3454,
29871,
29946,
29947,
29899,
29945,
29900,
29871,
13,
4013,
982,
29892,
591,
526,
15390,
310,
1401,
919,
292,
278,
848,
297,
29871,
29941,
29899,
12531,
2913,
29901,
13,
12008,
13,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
3166,
286,
572,
29918,
10154,
29895,
1169,
29889,
29885,
5317,
29941,
29881,
1053,
319,
9100,
29941,
29928,
13,
1054,
2470,
353,
4852,
29878,
613,
376,
29890,
1159,
13,
29990,
353,
5159,
13,
1454,
16077,
605,
297,
3464,
29898,
29941,
1125,
13,
1678,
1060,
29889,
4397,
4197,
29961,
1402,
19997,
5159,
2314,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
14968,
842,
29918,
1272,
22164,
13,
4706,
565,
7945,
842,
29918,
21134,
29961,
29875,
29962,
1275,
16077,
605,
29901,
13,
9651,
1060,
29961,
293,
605,
3816,
29900,
1822,
4397,
29898,
14968,
842,
29918,
1272,
29961,
29875,
3816,
29900,
2314,
13,
9651,
1060,
29961,
293,
605,
3816,
29896,
1822,
4397,
29898,
14968,
842,
29918,
1272,
29961,
29875,
3816,
29896,
2314,
13,
9651,
1060,
29961,
293,
605,
3816,
29906,
1822,
4397,
3552,
14968,
842,
29918,
1272,
29961,
29875,
3816,
29906,
12622,
13,
1054,
2470,
353,
4852,
29878,
613,
376,
29887,
613,
376,
29891,
1159,
13,
1003,
353,
14770,
29889,
4532,
580,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29896,
29896,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1454,
16077,
605,
297,
3464,
29898,
29941,
1125,
13,
539,
4853,
29889,
1557,
2620,
29898,
29990,
29961,
293,
605,
3816,
29900,
1402,
1060,
29961,
293,
605,
3816,
29896,
1402,
1060,
29961,
293,
605,
3816,
29906,
1402,
274,
29922,
1054,
2470,
29961,
293,
605,
2314,
13,
572,
29873,
29889,
4294,
580,
13,
13,
2
] |
python/bigadd.py | seckcoder/lang-learn | 1 | 146483 | import itertools
def bigadd(a, b):
z = [x+y for x,y in itertools.izip_longest(reversed(a),reversed(b),fillvalue=0)]
res = [x+y for x,y in itertools.izip_longest([i%10 for i in z],[0] + [i/10 for i in z],fillvalue=0)]
[x for x in itertools.dropwhile(lambda x: x == 0, reversed(res))]
print bigadd([1,2,3], [4,5,6,8])
| [
1,
1053,
4256,
8504,
13,
1753,
4802,
1202,
29898,
29874,
29892,
289,
1125,
13,
1678,
503,
353,
518,
29916,
29974,
29891,
363,
921,
29892,
29891,
297,
4256,
8504,
29889,
466,
666,
29918,
5426,
342,
29898,
276,
874,
287,
29898,
29874,
511,
276,
874,
287,
29898,
29890,
511,
5589,
1767,
29922,
29900,
4638,
13,
1678,
620,
353,
518,
29916,
29974,
29891,
363,
921,
29892,
29891,
297,
4256,
8504,
29889,
466,
666,
29918,
5426,
342,
4197,
29875,
29995,
29896,
29900,
363,
474,
297,
503,
16272,
29900,
29962,
718,
518,
29875,
29914,
29896,
29900,
363,
474,
297,
503,
1402,
5589,
1767,
29922,
29900,
4638,
13,
1678,
518,
29916,
363,
921,
297,
4256,
8504,
29889,
8865,
8000,
29898,
2892,
921,
29901,
921,
1275,
29871,
29900,
29892,
18764,
287,
29898,
690,
28166,
13,
13,
2158,
4802,
1202,
4197,
29896,
29892,
29906,
29892,
29941,
1402,
518,
29946,
29892,
29945,
29892,
29953,
29892,
29947,
2314,
13,
2
] |
accounts/urls.py | mishrakeshav/Django-Real-Estate-Website | 0 | 22898 | <reponame>mishrakeshav/Django-Real-Estate-Website
from django.urls import path
from . import views
urlpatterns = [
path('login', views.login, name = 'login'),
path('register', views.register, name = 'register'),
path('logout', views.logout, name = 'logout'),
path('dashboard', views.dashboard, name = 'dashboard'),
] | [
1,
529,
276,
1112,
420,
29958,
29885,
728,
4442,
267,
8708,
29914,
29928,
5364,
29899,
21713,
29899,
29923,
3859,
29899,
3609,
2746,
13,
3166,
9557,
29889,
26045,
1053,
2224,
13,
3166,
869,
1053,
8386,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
2224,
877,
7507,
742,
8386,
29889,
7507,
29892,
1024,
353,
525,
7507,
5477,
13,
1678,
2224,
877,
9573,
742,
8386,
29889,
9573,
29892,
1024,
353,
525,
9573,
5477,
13,
1678,
2224,
877,
1188,
449,
742,
8386,
29889,
1188,
449,
29892,
1024,
353,
525,
1188,
449,
5477,
13,
1678,
2224,
877,
14592,
3377,
742,
8386,
29889,
14592,
3377,
29892,
1024,
353,
525,
14592,
3377,
5477,
13,
268,
13,
29962,
2
] |
models/cnn_stft.py | gumpy-hybridBCI/GUMPY- | 27 | 21827 | from .model import KerasModel
import keras
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.layers import BatchNormalization, Dropout, Conv2D, MaxPooling2D
import kapre
from kapre.utils import Normalization2D
from kapre.time_frequency import Spectrogram
class CNN_STFT(KerasModel):
def create_model(self, input_shape, dropout=0.5, print_summary=False):
# basis of the CNN_STFT is a Sequential network
model = Sequential()
# spectrogram creation using STFT
model.add(Spectrogram(n_dft = 128, n_hop = 16, input_shape = input_shape,
return_decibel_spectrogram = False, power_spectrogram = 2.0,
trainable_kernel = False, name = 'static_stft'))
model.add(Normalization2D(str_axis = 'freq'))
# Conv Block 1
model.add(Conv2D(filters = 24, kernel_size = (12, 12),
strides = (1, 1), name = 'conv1',
border_mode = 'same'))
model.add(BatchNormalization(axis = 1))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size = (2, 2), strides = (2,2), padding = 'valid',
data_format = 'channels_last'))
# Conv Block 2
model.add(Conv2D(filters = 48, kernel_size = (8, 8),
name = 'conv2', border_mode = 'same'))
model.add(BatchNormalization(axis = 1))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size = (2, 2), strides = (2, 2), padding = 'valid',
data_format = 'channels_last'))
# Conv Block 3
model.add(Conv2D(filters = 96, kernel_size = (4, 4),
name = 'conv3', border_mode = 'same'))
model.add(BatchNormalization(axis = 1))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size = (2, 2), strides = (2,2),
padding = 'valid',
data_format = 'channels_last'))
model.add(Dropout(dropout))
# classificator
model.add(Flatten())
model.add(Dense(2)) # two classes only
model.add(Activation('softmax'))
if print_summary:
print(model.summary())
# compile the model
model.compile(loss = 'categorical_crossentropy',
optimizer = 'adam',
metrics = ['accuracy'])
# assign model and return
self.model = model
return model
| [
1,
515,
869,
4299,
1053,
12693,
294,
3195,
13,
5215,
13023,
294,
13,
3166,
13023,
294,
29889,
9794,
1053,
922,
339,
2556,
13,
3166,
13023,
294,
29889,
29277,
1053,
360,
1947,
29892,
21775,
362,
29892,
2379,
8606,
13,
3166,
13023,
294,
29889,
29277,
1053,
350,
905,
19077,
2133,
29892,
20724,
449,
29892,
1281,
29894,
29906,
29928,
29892,
5918,
11426,
292,
29906,
29928,
13,
13,
5215,
10494,
276,
13,
3166,
10494,
276,
29889,
13239,
1053,
21981,
2133,
29906,
29928,
13,
3166,
10494,
276,
29889,
2230,
29918,
10745,
23860,
1053,
27738,
307,
1393,
13,
13,
13,
1990,
29696,
29918,
1254,
7818,
29898,
29968,
18464,
3195,
1125,
13,
13,
1678,
822,
1653,
29918,
4299,
29898,
1311,
29892,
1881,
29918,
12181,
29892,
5768,
449,
29922,
29900,
29889,
29945,
29892,
1596,
29918,
7727,
29922,
8824,
1125,
13,
13,
4706,
396,
8405,
310,
278,
29696,
29918,
1254,
7818,
338,
263,
922,
339,
2556,
3564,
13,
4706,
1904,
353,
922,
339,
2556,
580,
13,
13,
4706,
396,
6683,
307,
1393,
11265,
773,
6850,
7818,
13,
4706,
1904,
29889,
1202,
29898,
29903,
1103,
307,
1393,
29898,
29876,
29918,
29881,
615,
353,
29871,
29896,
29906,
29947,
29892,
302,
29918,
29882,
459,
353,
29871,
29896,
29953,
29892,
1881,
29918,
12181,
353,
1881,
29918,
12181,
29892,
13,
462,
29871,
736,
29918,
311,
455,
6596,
29918,
21494,
307,
1393,
353,
7700,
29892,
3081,
29918,
21494,
307,
1393,
353,
29871,
29906,
29889,
29900,
29892,
13,
462,
29871,
7945,
519,
29918,
17460,
353,
7700,
29892,
1024,
353,
525,
7959,
29918,
303,
615,
8785,
13,
4706,
1904,
29889,
1202,
29898,
19077,
2133,
29906,
29928,
29898,
710,
29918,
8990,
353,
525,
29888,
7971,
8785,
13,
13,
4706,
396,
1281,
29894,
15658,
29871,
29896,
13,
4706,
1904,
29889,
1202,
29898,
1168,
29894,
29906,
29928,
29898,
26705,
353,
29871,
29906,
29946,
29892,
8466,
29918,
2311,
353,
313,
29896,
29906,
29892,
29871,
29896,
29906,
511,
13,
462,
308,
851,
2247,
353,
313,
29896,
29892,
29871,
29896,
511,
1024,
353,
525,
20580,
29896,
742,
13,
462,
308,
5139,
29918,
8513,
353,
525,
17642,
8785,
13,
4706,
1904,
29889,
1202,
29898,
23145,
19077,
2133,
29898,
8990,
353,
29871,
29896,
876,
13,
4706,
1904,
29889,
1202,
29898,
21786,
362,
877,
2674,
29884,
8785,
13,
4706,
1904,
29889,
1202,
29898,
7976,
11426,
292,
29906,
29928,
29898,
10109,
29918,
2311,
353,
313,
29906,
29892,
29871,
29906,
511,
851,
2247,
353,
313,
29906,
29892,
29906,
511,
7164,
353,
525,
3084,
742,
13,
462,
1669,
848,
29918,
4830,
353,
525,
305,
12629,
29918,
4230,
8785,
13,
13,
4706,
396,
1281,
29894,
15658,
29871,
29906,
13,
4706,
1904,
29889,
1202,
29898,
1168,
29894,
29906,
29928,
29898,
26705,
353,
29871,
29946,
29947,
29892,
8466,
29918,
2311,
353,
313,
29947,
29892,
29871,
29947,
511,
13,
462,
308,
1024,
353,
525,
20580,
29906,
742,
5139,
29918,
8513,
353,
525,
17642,
8785,
13,
4706,
1904,
29889,
1202,
29898,
23145,
19077,
2133,
29898,
8990,
353,
29871,
29896,
876,
13,
4706,
1904,
29889,
1202,
29898,
21786,
362,
877,
2674,
29884,
8785,
13,
4706,
1904,
29889,
1202,
29898,
7976,
11426,
292,
29906,
29928,
29898,
10109,
29918,
2311,
353,
313,
29906,
29892,
29871,
29906,
511,
851,
2247,
353,
313,
29906,
29892,
29871,
29906,
511,
7164,
353,
525,
3084,
742,
13,
462,
1669,
848,
29918,
4830,
353,
525,
305,
12629,
29918,
4230,
8785,
13,
13,
4706,
396,
1281,
29894,
15658,
29871,
29941,
13,
4706,
1904,
29889,
1202,
29898,
1168,
29894,
29906,
29928,
29898,
26705,
353,
29871,
29929,
29953,
29892,
8466,
29918,
2311,
353,
313,
29946,
29892,
29871,
29946,
511,
13,
462,
308,
1024,
353,
525,
20580,
29941,
742,
5139,
29918,
8513,
353,
525,
17642,
8785,
13,
4706,
1904,
29889,
1202,
29898,
23145,
19077,
2133,
29898,
8990,
353,
29871,
29896,
876,
13,
4706,
1904,
29889,
1202,
29898,
21786,
362,
877,
2674,
29884,
8785,
13,
4706,
1904,
29889,
1202,
29898,
7976,
11426,
292,
29906,
29928,
29898,
10109,
29918,
2311,
353,
313,
29906,
29892,
29871,
29906,
511,
851,
2247,
353,
313,
29906,
29892,
29906,
511,
13,
462,
1669,
7164,
353,
525,
3084,
742,
13,
462,
1669,
848,
29918,
4830,
353,
525,
305,
12629,
29918,
4230,
8785,
13,
4706,
1904,
29889,
1202,
29898,
15063,
449,
29898,
8865,
449,
876,
13,
13,
4706,
396,
20670,
1061,
13,
4706,
1904,
29889,
1202,
29898,
29943,
5066,
841,
3101,
13,
4706,
1904,
29889,
1202,
29898,
29928,
1947,
29898,
29906,
876,
29871,
396,
1023,
4413,
871,
13,
4706,
1904,
29889,
1202,
29898,
21786,
362,
877,
2695,
3317,
8785,
13,
13,
4706,
565,
1596,
29918,
7727,
29901,
13,
9651,
1596,
29898,
4299,
29889,
7727,
3101,
13,
13,
4706,
396,
6633,
278,
1904,
13,
4706,
1904,
29889,
12198,
29898,
6758,
353,
525,
29883,
20440,
936,
29918,
19128,
296,
14441,
742,
13,
462,
418,
5994,
3950,
353,
525,
328,
314,
742,
13,
462,
418,
21556,
353,
6024,
562,
2764,
4135,
11287,
13,
13,
4706,
396,
3566,
1904,
322,
736,
13,
4706,
1583,
29889,
4299,
353,
1904,
13,
4706,
736,
1904,
13,
2
] |
xsInterface/containers/datasettings.py | CORE-GATECH-GROUP/xs-interface | 0 | 165316 | <filename>xsInterface/containers/datasettings.py
# -*- coding: utf-8 -*-
"""datasettings.py
The user needs to define the required data to be stored on the containers.
This container stores all the attributes and settings for the required data.
Created on Sat Mar 19 18:30:00 2022 @author: <NAME> and <NAME>
Last updated on Tue Apr 01 11:30:00 2022 @author: <NAME>
email: <EMAIL>
"""
import numpy as np
from xsInterface.errors.checkerrors import _isint, _islist, _isbool, _inlist,\
_ispositive, _isstr, _isuniquelist, _isarray,\
_is1darray, _isequallength, _isBoundArray
from xsInterface.containers.container_header import DATA_TYPES
class DataSettings():
"""
Stores the names and data that are expected to be stored on containers
Parameters
-----------
NG : int
number of energy groups for multi-group parameters
DN : int
Delayed neutron groups for kinetic parameters
macro : boolean
indicate whether macro data is expected to be provided
micro : boolean
indicate whether micro data is expected to be provided
kinetics : boolean
indicate whether kinetic data is expected to be provided
meta : boolean
indicate whether meta data is expected to be provided
isotopes : array
ZZAAA0/1 for all the isotopes to be provided
Attributes
-----------
NG : int
number of energy groups for multi-group parameters
DN : int
delayed neutron groups for kinetic parameters
dataFlags : dict
boolean flags to indicate the data types that are provided
macro : dict
contains all the macro attributes (e.g., ``abs``)
micro : boolean
contains all the micro attributes for all the isotopes (e.g., ``fiss``)
kinetics : boolean
contains all the kinetic attributes (e.g., ``beta``)
meta : boolean
contains all the metadata attributes (e.g., ``time``)
Methods
--------
AddData(dataType, attributes, attrDims=None):
Add relevant macroscopic/microscopic/meta data
Raises
-------
TypeError
If any of the parameters, e.g., ``NG``, ``DN`` are not integers.
If any of the ``macro``, ``micro``, ``kinetics``, ``meta``
are not booleans.
ValueError
If ``NG`` is below one.
If ``DN`` is below one.
If ``isotopes`` list is not provided but ``micro`` data is expected.
KeyError
If ``dataType`` or ``frmt`` do not exist in DATA_TYPES or FRMT_OPTS.
Examples
---------
>>> rc = DataSettings(NG=2, DN=7, macro=True, micro=False, kinetics=True,
>>> meta=False, isotopes=None)
"""
def __init__(self, NG, DN, macro=True, micro=False, kinetics=False,
meta=False, isotopes=None):
"""Assign parameters that describe the required data to be provided"""
# Check variables types
_isint(NG, "number of energy groups")
_isint(DN, "number of delayed neutron groups")
_isbool(macro, "macro data")
_isbool(micro, "micro data")
_isbool(kinetics, "kinetics data")
_isbool(meta, "meta data")
# Check values/entries for different variables
_ispositive(NG, "number of energy groups")
_ispositive(DN, "number of delayed neutron groups")
if micro:
if isotopes is not None:
isotopes = np.array(isotopes, dtype=int)
else:
raise ValueError("<isotopes> list/array must be provided")
# Reset variables
self.ng = NG # number of energy groups
self.dn = DN # number of delayed neutron groups
self.isotopes = isotopes
self.dataFlags = {"macro": macro, "micro": micro,
"kinetics": kinetics, "meta": meta}
self.macro = []
self.micro = []
self.kinetics = []
self.meta = []
def AddData(self, dataType, attributes):
"""Add relevant macroscopic/microscopic/meta data
Parameters
----------
dataType : ["macro", "micro", "kinetics", "meta"]
type of data
attributes : list of strings
user-defined names for the provided data type (e.g., ``abs``)
Examples
--------
>>> rc.AddData("macro", ["abs", "nsf", "sct"], "array")
>>> rc.AddData("kinetics", ["beta", "decay"], "array")
"""
# Error checking
_isstr(dataType, "data types")
_inlist(dataType, "data types", DATA_TYPES)
if not self.dataFlags[dataType]:
raise ValueError("Data type <{}> was disabled when DataSettings "
"object was created".format(dataType))
_islist(attributes, "names of "+dataType+" attributes")
_isuniquelist(attributes, "attribute names in ")
# check if data is already populated
data0 = getattr(self, dataType)
if data0 == []: # data is new
# define the specific dictionary for the selected data type
attrList = attributes
else: # data already exists
attr0 = data0
# create a new/appended list of attributes
attr1 = attr0 + attributes
_isuniquelist(attr1, "attribute names in ")
attrList = attr1
# set a muted attribute with the settings for the selected data type
setattr(self, dataType, attrList)
def _proofTest(self):
"""Check that data was inputted"""
if self.dataFlags["macro"] and self.macro == []:
raise ValueError("macro data is expected to be provided.")
if self.dataFlags["micro"] and self.micro == []:
raise ValueError("micro data is expected to be provided.")
if self.dataFlags["kinetics"] and self.kinetics == []:
raise ValueError("kinetics data is expected to be provided.")
if self.dataFlags["meta"] and self.meta == []:
raise ValueError("meta data is expected to be provided.")
| [
1,
529,
9507,
29958,
10351,
10448,
29914,
1285,
475,
414,
29914,
14538,
7409,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
14538,
7409,
29889,
2272,
13,
13,
1576,
1404,
4225,
304,
4529,
278,
3734,
848,
304,
367,
6087,
373,
278,
22637,
29889,
13,
4013,
5639,
14422,
599,
278,
8393,
322,
6055,
363,
278,
3734,
848,
29889,
13,
13,
13,
20399,
373,
12178,
1085,
29871,
29896,
29929,
29871,
29896,
29947,
29901,
29941,
29900,
29901,
29900,
29900,
29871,
29906,
29900,
29906,
29906,
732,
8921,
29901,
529,
5813,
29958,
322,
529,
5813,
29958,
13,
8897,
4784,
373,
323,
434,
319,
558,
29871,
29900,
29896,
29871,
29896,
29896,
29901,
29941,
29900,
29901,
29900,
29900,
29871,
29906,
29900,
29906,
29906,
732,
8921,
29901,
529,
5813,
29958,
13,
13,
5269,
29901,
529,
26862,
6227,
29958,
13,
15945,
29908,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
14492,
10448,
29889,
12523,
29889,
3198,
12523,
1053,
903,
275,
524,
29892,
903,
275,
1761,
29892,
903,
275,
11227,
29892,
903,
262,
1761,
2053,
13,
1678,
903,
275,
1066,
3321,
29892,
903,
275,
710,
29892,
903,
275,
3909,
13295,
391,
29892,
903,
275,
2378,
2053,
13,
1678,
903,
275,
29896,
29881,
2378,
29892,
903,
895,
339,
497,
1477,
29892,
903,
275,
17109,
2588,
13,
3166,
14492,
10448,
29889,
1285,
475,
414,
29889,
7611,
29918,
6672,
1053,
360,
8254,
29918,
15631,
29925,
2890,
13,
13,
13,
1990,
3630,
9585,
7295,
13,
1678,
9995,
13,
1678,
624,
2361,
278,
2983,
322,
848,
393,
526,
3806,
304,
367,
6087,
373,
22637,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
28400,
13,
1678,
405,
29954,
584,
938,
13,
4706,
1353,
310,
5864,
6471,
363,
2473,
29899,
2972,
4128,
13,
1678,
360,
29940,
584,
938,
13,
4706,
5556,
388,
287,
11553,
1617,
6471,
363,
19015,
7492,
4128,
13,
1678,
11758,
584,
7223,
13,
4706,
12266,
3692,
11758,
848,
338,
3806,
304,
367,
4944,
13,
1678,
9200,
584,
7223,
13,
4706,
12266,
3692,
9200,
848,
338,
3806,
304,
367,
4944,
13,
1678,
413,
10157,
1199,
584,
7223,
13,
4706,
12266,
3692,
19015,
7492,
848,
338,
3806,
304,
367,
4944,
13,
1678,
12700,
584,
7223,
13,
4706,
12266,
3692,
12700,
848,
338,
3806,
304,
367,
4944,
13,
1678,
338,
327,
459,
267,
584,
1409,
13,
4706,
796,
29999,
6344,
29909,
29900,
29914,
29896,
363,
599,
278,
338,
327,
459,
267,
304,
367,
4944,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
28400,
13,
1678,
405,
29954,
584,
938,
13,
4706,
1353,
310,
5864,
6471,
363,
2473,
29899,
2972,
4128,
13,
1678,
360,
29940,
584,
938,
13,
4706,
29801,
11553,
1617,
6471,
363,
19015,
7492,
4128,
13,
1678,
848,
15675,
584,
9657,
13,
4706,
7223,
13449,
304,
12266,
278,
848,
4072,
393,
526,
4944,
13,
1678,
11758,
584,
9657,
13,
4706,
3743,
599,
278,
11758,
8393,
313,
29872,
29889,
29887,
1696,
4954,
6897,
29952,
6348,
13,
1678,
9200,
584,
7223,
13,
4706,
3743,
599,
278,
9200,
8393,
363,
599,
278,
338,
327,
459,
267,
313,
29872,
29889,
29887,
1696,
4954,
29888,
790,
29952,
6348,
13,
1678,
413,
10157,
1199,
584,
7223,
13,
4706,
3743,
599,
278,
19015,
7492,
8393,
313,
29872,
29889,
29887,
1696,
4954,
3571,
29952,
6348,
13,
1678,
12700,
584,
7223,
13,
4706,
3743,
599,
278,
15562,
8393,
313,
29872,
29889,
29887,
1696,
4954,
2230,
29952,
6348,
13,
13,
13,
1678,
8108,
29879,
13,
1678,
448,
26589,
13,
1678,
3462,
1469,
29898,
1272,
1542,
29892,
8393,
29892,
12421,
29928,
9893,
29922,
8516,
1125,
13,
4706,
3462,
8018,
11758,
21785,
293,
29914,
29885,
2357,
21785,
293,
29914,
7299,
848,
13,
13,
1678,
390,
1759,
267,
13,
1678,
448,
22158,
13,
1678,
20948,
13,
4706,
960,
738,
310,
278,
4128,
29892,
321,
29889,
29887,
1696,
4954,
9312,
29952,
1673,
4954,
28307,
16159,
526,
451,
11920,
29889,
13,
4706,
960,
738,
310,
278,
4954,
25254,
29952,
1673,
4954,
29885,
2357,
29952,
1673,
4954,
9089,
300,
1199,
29952,
1673,
4954,
7299,
16159,
13,
4706,
526,
451,
1045,
1772,
550,
29889,
13,
1678,
7865,
2392,
13,
4706,
960,
4954,
9312,
16159,
338,
2400,
697,
29889,
13,
4706,
960,
4954,
28307,
16159,
338,
2400,
697,
29889,
13,
4706,
960,
4954,
275,
327,
459,
267,
16159,
1051,
338,
451,
4944,
541,
4954,
29885,
2357,
16159,
848,
338,
3806,
29889,
13,
1678,
7670,
2392,
13,
4706,
960,
4954,
1272,
1542,
16159,
470,
4954,
1341,
4378,
16159,
437,
451,
1863,
297,
360,
8254,
29918,
15631,
29925,
2890,
470,
23788,
11490,
29918,
4590,
9375,
29889,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
1378,
13,
1678,
8653,
364,
29883,
353,
3630,
9585,
29898,
9312,
29922,
29906,
29892,
360,
29940,
29922,
29955,
29892,
11758,
29922,
5574,
29892,
9200,
29922,
8824,
29892,
413,
10157,
1199,
29922,
5574,
29892,
13,
1678,
8653,
462,
259,
12700,
29922,
8824,
29892,
338,
327,
459,
267,
29922,
8516,
29897,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
405,
29954,
29892,
360,
29940,
29892,
11758,
29922,
5574,
29892,
9200,
29922,
8824,
29892,
413,
10157,
1199,
29922,
8824,
29892,
13,
462,
12700,
29922,
8824,
29892,
338,
327,
459,
267,
29922,
8516,
1125,
13,
4706,
9995,
7900,
647,
4128,
393,
8453,
278,
3734,
848,
304,
367,
4944,
15945,
29908,
13,
13,
4706,
396,
5399,
3651,
4072,
13,
4706,
903,
275,
524,
29898,
9312,
29892,
376,
4537,
310,
5864,
6471,
1159,
13,
4706,
903,
275,
524,
29898,
28307,
29892,
376,
4537,
310,
29801,
11553,
1617,
6471,
1159,
13,
4706,
903,
275,
11227,
29898,
25254,
29892,
376,
25254,
848,
1159,
13,
4706,
903,
275,
11227,
29898,
29885,
2357,
29892,
376,
29885,
2357,
848,
1159,
13,
4706,
903,
275,
11227,
29898,
9089,
300,
1199,
29892,
376,
9089,
300,
1199,
848,
1159,
13,
4706,
903,
275,
11227,
29898,
7299,
29892,
376,
7299,
848,
1159,
13,
13,
4706,
396,
5399,
1819,
29914,
26586,
363,
1422,
3651,
13,
4706,
903,
275,
1066,
3321,
29898,
9312,
29892,
376,
4537,
310,
5864,
6471,
1159,
13,
4706,
903,
275,
1066,
3321,
29898,
28307,
29892,
376,
4537,
310,
29801,
11553,
1617,
6471,
1159,
13,
4706,
565,
9200,
29901,
13,
9651,
565,
338,
327,
459,
267,
338,
451,
6213,
29901,
13,
18884,
338,
327,
459,
267,
353,
7442,
29889,
2378,
29898,
275,
327,
459,
267,
29892,
26688,
29922,
524,
29897,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
28945,
275,
327,
459,
267,
29958,
1051,
29914,
2378,
1818,
367,
4944,
1159,
13,
13,
4706,
396,
2538,
300,
3651,
13,
4706,
1583,
29889,
865,
353,
405,
29954,
29871,
396,
1353,
310,
5864,
6471,
13,
4706,
1583,
29889,
5200,
353,
360,
29940,
29871,
396,
1353,
310,
29801,
11553,
1617,
6471,
13,
4706,
1583,
29889,
275,
327,
459,
267,
353,
338,
327,
459,
267,
13,
4706,
1583,
29889,
1272,
15675,
353,
8853,
25254,
1115,
11758,
29892,
376,
29885,
2357,
1115,
9200,
29892,
13,
462,
3986,
376,
9089,
300,
1199,
1115,
413,
10157,
1199,
29892,
376,
7299,
1115,
12700,
29913,
13,
4706,
1583,
29889,
25254,
353,
5159,
13,
4706,
1583,
29889,
29885,
2357,
353,
5159,
13,
4706,
1583,
29889,
9089,
300,
1199,
353,
5159,
13,
4706,
1583,
29889,
7299,
353,
5159,
13,
13,
1678,
822,
3462,
1469,
29898,
1311,
29892,
848,
1542,
29892,
8393,
1125,
13,
4706,
9995,
2528,
8018,
11758,
21785,
293,
29914,
29885,
2357,
21785,
293,
29914,
7299,
848,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
848,
1542,
584,
6796,
25254,
613,
376,
29885,
2357,
613,
376,
9089,
300,
1199,
613,
376,
7299,
3108,
13,
9651,
1134,
310,
848,
13,
4706,
8393,
584,
1051,
310,
6031,
13,
9651,
1404,
29899,
12119,
2983,
363,
278,
4944,
848,
1134,
313,
29872,
29889,
29887,
1696,
4954,
6897,
29952,
6348,
13,
13,
4706,
1222,
9422,
13,
4706,
448,
26589,
13,
4706,
8653,
364,
29883,
29889,
2528,
1469,
703,
25254,
613,
6796,
6897,
613,
376,
1983,
29888,
613,
376,
29879,
312,
12436,
376,
2378,
1159,
13,
4706,
8653,
364,
29883,
29889,
2528,
1469,
703,
9089,
300,
1199,
613,
6796,
3571,
613,
376,
7099,
388,
12436,
376,
2378,
1159,
13,
13,
4706,
9995,
13,
4706,
396,
4829,
8454,
13,
4706,
903,
275,
710,
29898,
1272,
1542,
29892,
376,
1272,
4072,
1159,
13,
4706,
903,
262,
1761,
29898,
1272,
1542,
29892,
376,
1272,
4072,
613,
360,
8254,
29918,
15631,
29925,
2890,
29897,
13,
4706,
565,
451,
1583,
29889,
1272,
15675,
29961,
1272,
1542,
5387,
13,
9651,
12020,
7865,
2392,
703,
1469,
1134,
529,
8875,
29958,
471,
12708,
746,
3630,
9585,
376,
13,
462,
632,
376,
3318,
471,
2825,
1642,
4830,
29898,
1272,
1542,
876,
13,
4706,
903,
275,
1761,
29898,
15697,
29892,
376,
7039,
310,
15691,
1272,
1542,
13578,
8393,
1159,
13,
4706,
903,
275,
3909,
13295,
391,
29898,
15697,
29892,
376,
12715,
2983,
297,
16521,
13,
13,
4706,
396,
1423,
565,
848,
338,
2307,
24146,
13,
4706,
848,
29900,
353,
679,
5552,
29898,
1311,
29892,
848,
1542,
29897,
13,
4706,
565,
848,
29900,
1275,
5159,
29901,
29871,
396,
848,
338,
716,
13,
9651,
396,
4529,
278,
2702,
8600,
363,
278,
4629,
848,
1134,
13,
9651,
12421,
1293,
353,
8393,
13,
4706,
1683,
29901,
29871,
396,
848,
2307,
4864,
13,
9651,
12421,
29900,
353,
848,
29900,
13,
9651,
396,
1653,
263,
716,
29914,
932,
2760,
1051,
310,
8393,
13,
9651,
12421,
29896,
353,
12421,
29900,
718,
8393,
13,
9651,
903,
275,
3909,
13295,
391,
29898,
5552,
29896,
29892,
376,
12715,
2983,
297,
16521,
13,
9651,
12421,
1293,
353,
12421,
29896,
13,
13,
4706,
396,
731,
263,
286,
3860,
5352,
411,
278,
6055,
363,
278,
4629,
848,
1134,
13,
4706,
731,
5552,
29898,
1311,
29892,
848,
1542,
29892,
12421,
1293,
29897,
13,
13,
1678,
822,
903,
8017,
3057,
29898,
1311,
1125,
13,
4706,
9995,
5596,
393,
848,
471,
1881,
9446,
15945,
29908,
13,
4706,
565,
1583,
29889,
1272,
15675,
3366,
25254,
3108,
322,
1583,
29889,
25254,
1275,
5159,
29901,
13,
9651,
12020,
7865,
2392,
703,
25254,
848,
338,
3806,
304,
367,
4944,
23157,
13,
4706,
565,
1583,
29889,
1272,
15675,
3366,
29885,
2357,
3108,
322,
1583,
29889,
29885,
2357,
1275,
5159,
29901,
13,
9651,
12020,
7865,
2392,
703,
29885,
2357,
848,
338,
3806,
304,
367,
4944,
23157,
13,
4706,
565,
1583,
29889,
1272,
15675,
3366,
9089,
300,
1199,
3108,
322,
1583,
29889,
9089,
300,
1199,
1275,
5159,
29901,
13,
9651,
12020,
7865,
2392,
703,
9089,
300,
1199,
848,
338,
3806,
304,
367,
4944,
23157,
13,
4706,
565,
1583,
29889,
1272,
15675,
3366,
7299,
3108,
322,
1583,
29889,
7299,
1275,
5159,
29901,
13,
9651,
12020,
7865,
2392,
703,
7299,
848,
338,
3806,
304,
367,
4944,
23157,
13,
2
] |
src/CrossQuantilogram/__init__.py | wangys96/CrossQuantilogram | 12 | 197485 | from .stationarybootstrap import Bootstrap
from .crossquantilogram import CrossQuantilogram
from .qtests import BoxPierceQ,LjungBoxQ
from .utils import DescriptiveStatistics
from .api import CQBS,CQBS_alphas,CQBS_years
from .plot import bar_example,heatmap_example,rolling_example
__doc__ = """The `Cross-Quantilogram`(CQ) is a correlation statistics that measures the quantile dependence between two time series. It can test the hypothesis that one time series has no directional predictability to another. Stationary bootstrap method helps establish the asymptotic distribution for CQ statistics and other corresponding test statistics.""" | [
1,
515,
869,
19569,
653,
8704,
1053,
25746,
13,
3166,
869,
19128,
12150,
309,
13342,
1053,
11189,
22930,
309,
13342,
13,
3166,
869,
29939,
21150,
1053,
11773,
29925,
631,
346,
29984,
29892,
29931,
29926,
686,
3313,
29984,
13,
3166,
869,
13239,
1053,
2726,
924,
573,
9513,
6765,
13,
3166,
869,
2754,
1053,
315,
29984,
9851,
29892,
29907,
29984,
9851,
29918,
284,
16130,
29892,
29907,
29984,
9851,
29918,
6360,
29879,
13,
3166,
869,
5317,
1053,
2594,
29918,
4773,
29892,
354,
271,
1958,
29918,
4773,
29892,
22155,
29918,
4773,
13,
13,
1649,
1514,
1649,
353,
9995,
1576,
421,
29907,
2124,
29899,
22930,
309,
13342,
29952,
29898,
29907,
29984,
29897,
338,
263,
19869,
13964,
393,
15366,
278,
4323,
488,
26307,
1546,
1023,
931,
3652,
29889,
739,
508,
1243,
278,
20051,
393,
697,
931,
3652,
756,
694,
5305,
284,
8500,
3097,
304,
1790,
29889,
12039,
653,
16087,
1158,
6911,
10127,
278,
22784,
13574,
4978,
363,
315,
29984,
13964,
322,
916,
6590,
1243,
13964,
1213,
15945,
2
] |
waitlist_parser/waitlist_parser.py | Itsindigo/waitlist-parser | 0 | 122255 | <reponame>Itsindigo/waitlist-parser
import os
import sys
from random import choice
from string import ascii_lowercase
from csv import DictReader, DictWriter
if __name__ == "__main__":
if len(sys.argv) > 1:
my_file = sys.argv[-1]
else:
print("File path not provided")
sys.exit(1)
_, extension = os.path.splitext(my_file)
if extension != '.csv':
print("This script accepts CSV Filetypes only.")
sys.exit(1)
with open(my_file) as csvfile:
records = []
waitlist = DictReader(csvfile)
for row in waitlist:
records.append(row)
column_headers = records[0].keys()
input = input('Enter the column header you would like to split: \n')
if input not in column_headers:
print("Input supplied not in column headings.... exiting.")
sys.exit(1)
for record in records:
target = record[input]
split_names = target.split(' ')
del record[input]
record['first %s' % input] = split_names[0]
record['last %s' % input] = ''
if len(split_names) > 1:
record['last %s' % input] = ' '.join(split_names[1:])
output_filename = 'outfiles/waitlist-%s.csv' % (''.join(choice(ascii_lowercase) for i in range(4)))
with open(output_filename, 'w') as outfile:
writer = DictWriter(outfile, records[0].keys())
writer.writeheader()
writer.writerows(records) | [
1,
529,
276,
1112,
420,
29958,
29902,
1372,
513,
5973,
29914,
10685,
1761,
29899,
16680,
13,
5215,
2897,
13,
5215,
10876,
13,
3166,
4036,
1053,
7348,
13,
3166,
1347,
1053,
408,
18869,
29918,
13609,
4878,
13,
3166,
11799,
1053,
360,
919,
6982,
29892,
360,
919,
10507,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29896,
29901,
13,
4706,
590,
29918,
1445,
353,
10876,
29889,
19218,
14352,
29896,
29962,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
2283,
2224,
451,
4944,
1159,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
17117,
6081,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
1357,
29918,
1445,
29897,
13,
1678,
565,
6081,
2804,
15300,
7638,
2396,
13,
4706,
1596,
703,
4013,
2471,
21486,
16874,
3497,
8768,
871,
23157,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
411,
1722,
29898,
1357,
29918,
1445,
29897,
408,
11799,
1445,
29901,
13,
4706,
6475,
353,
5159,
13,
4706,
4480,
1761,
353,
360,
919,
6982,
29898,
7638,
1445,
29897,
13,
4706,
363,
1948,
297,
4480,
1761,
29901,
13,
9651,
6475,
29889,
4397,
29898,
798,
29897,
13,
13,
1678,
1897,
29918,
13662,
353,
6475,
29961,
29900,
1822,
8149,
580,
13,
13,
1678,
1881,
353,
1881,
877,
10399,
278,
1897,
4839,
366,
723,
763,
304,
6219,
29901,
320,
29876,
1495,
13,
13,
1678,
565,
1881,
451,
297,
1897,
29918,
13662,
29901,
13,
4706,
1596,
703,
4290,
19056,
451,
297,
1897,
2343,
886,
3045,
6876,
292,
23157,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
363,
2407,
297,
6475,
29901,
13,
4706,
3646,
353,
2407,
29961,
2080,
29962,
13,
4706,
6219,
29918,
7039,
353,
3646,
29889,
5451,
877,
25710,
13,
4706,
628,
2407,
29961,
2080,
29962,
13,
4706,
2407,
1839,
4102,
1273,
29879,
29915,
1273,
1881,
29962,
353,
6219,
29918,
7039,
29961,
29900,
29962,
13,
4706,
2407,
1839,
4230,
1273,
29879,
29915,
1273,
1881,
29962,
353,
6629,
13,
4706,
565,
7431,
29898,
5451,
29918,
7039,
29897,
1405,
29871,
29896,
29901,
13,
9651,
2407,
1839,
4230,
1273,
29879,
29915,
1273,
1881,
29962,
353,
525,
15300,
7122,
29898,
5451,
29918,
7039,
29961,
29896,
29901,
2314,
13,
13,
1678,
1962,
29918,
9507,
353,
525,
449,
5325,
29914,
10685,
1761,
19222,
29879,
29889,
7638,
29915,
1273,
6702,
4286,
7122,
29898,
16957,
29898,
294,
18869,
29918,
13609,
4878,
29897,
363,
474,
297,
3464,
29898,
29946,
4961,
13,
13,
1678,
411,
1722,
29898,
4905,
29918,
9507,
29892,
525,
29893,
1495,
408,
714,
1445,
29901,
13,
4706,
9227,
353,
360,
919,
10507,
29898,
449,
1445,
29892,
6475,
29961,
29900,
1822,
8149,
3101,
13,
4706,
9227,
29889,
3539,
6672,
580,
13,
4706,
9227,
29889,
13236,
1242,
29898,
3757,
4339,
29897,
2
] |
content/migrations/0001_initial.py | Daniel-and-Zach/character_generator | 0 | 179648 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Race',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255, choices=[(b'Elf', b'Elf'), (b'Dwarf', b'Dwarf'), (b'Gnome', b'Gnome'), (b'Half-Elf', b'Half-Elf'), (b'Halfling', b'Halfling'), (b'Half-Orc', b'Half-Orc'), (b'Human', b'Human')])),
('size', models.CharField(max_length=255)),
('base_speed', models.IntegerField()),
('description', models.TextField()),
('history', models.TextField()),
],
),
]
| [
1,
529,
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,
2585,
1053,
4733,
29892,
9725,
800,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
29934,
815,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
12300,
3073,
29898,
369,
15828,
29918,
978,
2433,
1367,
742,
28755,
29922,
8824,
29892,
4469,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
8243,
13,
18884,
6702,
978,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
19995,
11759,
29898,
29890,
29915,
6489,
29888,
742,
289,
29915,
6489,
29888,
5477,
313,
29890,
29915,
29928,
4495,
29888,
742,
289,
29915,
29928,
4495,
29888,
5477,
313,
29890,
29915,
29954,
25155,
742,
289,
29915,
29954,
25155,
5477,
313,
29890,
29915,
29950,
3131,
29899,
6489,
29888,
742,
289,
29915,
29950,
3131,
29899,
6489,
29888,
5477,
313,
29890,
29915,
29950,
284,
1579,
292,
742,
289,
29915,
29950,
284,
1579,
292,
5477,
313,
29890,
29915,
29950,
3131,
29899,
29949,
2214,
742,
289,
29915,
29950,
3131,
29899,
29949,
2214,
5477,
313,
29890,
29915,
29950,
7889,
742,
289,
29915,
29950,
7889,
1495,
2314,
511,
13,
18884,
6702,
2311,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
8243,
13,
18884,
6702,
3188,
29918,
19322,
742,
4733,
29889,
7798,
3073,
25739,
13,
18884,
6702,
8216,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
18434,
742,
4733,
29889,
15778,
25739,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
lab4_CNN_intro/create_dataset.py | j-adamczyk/Pattern_recognition | 1 | 54441 | from concurrent.futures.thread import ThreadPoolExecutor
from io import BytesIO
import os
import cv2
import numpy as np
import requests
def get_img(url):
try:
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; "
"Intel Mac OS X 10_11_6) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/61.0.3163.100 Safari/537.36"}
response = requests.get(url, headers=headers, timeout=2)
if response.status_code == requests.codes.ok:
return response
else:
return None
except Exception:
return None
def download_images_from_file(label):
with open("links_" + label + ".txt") as file:
URLs = file.readlines()
URLs = [url.rstrip() for url in URLs]
next_img_num = 0
num_threads = min(len(URLs), 30)
for i in range(0, len(URLs), 50):
part = URLs[i:i + 50]
with ThreadPoolExecutor(num_threads) as executor:
results = [result for result
in executor.map(get_img, part)
if result is not None]
for result in results:
filename = str(next_img_num) + ".png"
filepath = os.path.join("dataset_2", label, filename)
img_bytes = BytesIO(result.content)
img = cv2.imdecode(np.frombuffer(img_bytes.read(), np.uint8),
flags=1)
if img is None:
continue
height, width = img.shape[:2]
if height < width:
new_height = 224
new_width = int((new_height / height) * width)
else:
new_width = 224
new_height = int((new_width / width) * height)
img = cv2.resize(img,
dsize=(new_width, new_height),
interpolation=cv2.INTER_AREA)
cv2.imwrite(filepath, img)
next_img_num += 1
def create_csv(labels):
labels.sort()
text = "file label\n"
for label_num, label in enumerate(labels):
label_dir = os.path.join("dataset_2", label)
filenames = os.listdir(label_dir)
filenames = [os.path.join(label_dir, filename)
for filename in filenames]
for filename in filenames:
# save numerical values for labels
text += filename + " " + str(label_num) + "\n"
with open("dataset_2.csv", "w") as file:
file.write(text)
if __name__ == '__main__':
#for file in ["cats", "cats", "cats"]:
# download_images_from_file(file)
#labels = ["cat", "dog", "owl"]
#create_csv(labels)
#for file in ["deku", "naruto", "saitama"]:
# download_images_from_file(file)
labels = ["deku", "naruto", "saitama"]
create_csv(labels)
| [
1,
515,
21984,
29889,
29888,
329,
1973,
29889,
7097,
1053,
10480,
11426,
13366,
13,
3166,
12013,
1053,
2648,
2167,
5971,
13,
5215,
2897,
13,
13,
5215,
13850,
29906,
13,
5215,
12655,
408,
7442,
13,
5215,
7274,
13,
13,
13,
1753,
679,
29918,
2492,
29898,
2271,
1125,
13,
1678,
1018,
29901,
13,
4706,
9066,
353,
8853,
2659,
29899,
19661,
1115,
376,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
15735,
524,
10578,
29936,
376,
13,
462,
462,
376,
2928,
295,
4326,
6570,
1060,
29871,
29896,
29900,
29918,
29896,
29896,
29918,
29953,
29897,
376,
13,
462,
462,
376,
2052,
280,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
376,
13,
462,
462,
376,
1451,
4871,
29914,
29953,
29896,
29889,
29900,
29889,
29941,
29896,
29953,
29941,
29889,
29896,
29900,
29900,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
9092,
13,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
9066,
29922,
13662,
29892,
11815,
29922,
29906,
29897,
13,
4706,
565,
2933,
29889,
4882,
29918,
401,
1275,
7274,
29889,
18137,
29889,
554,
29901,
13,
9651,
736,
2933,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
1678,
5174,
8960,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
5142,
29918,
8346,
29918,
3166,
29918,
1445,
29898,
1643,
1125,
13,
1678,
411,
1722,
703,
4965,
27508,
718,
3858,
718,
11393,
3945,
1159,
408,
934,
29901,
13,
4706,
24295,
353,
934,
29889,
949,
9012,
580,
13,
13,
1678,
24295,
353,
518,
2271,
29889,
29878,
17010,
580,
363,
3142,
297,
24295,
29962,
13,
13,
1678,
2446,
29918,
2492,
29918,
1949,
353,
29871,
29900,
13,
13,
1678,
954,
29918,
28993,
353,
1375,
29898,
2435,
29898,
4219,
29879,
511,
29871,
29941,
29900,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
4219,
29879,
511,
29871,
29945,
29900,
1125,
13,
4706,
760,
353,
24295,
29961,
29875,
29901,
29875,
718,
29871,
29945,
29900,
29962,
13,
4706,
411,
10480,
11426,
13366,
29898,
1949,
29918,
28993,
29897,
408,
2279,
3406,
29901,
13,
9651,
2582,
353,
518,
2914,
363,
1121,
13,
462,
539,
297,
2279,
3406,
29889,
1958,
29898,
657,
29918,
2492,
29892,
760,
29897,
13,
462,
539,
565,
1121,
338,
451,
6213,
29962,
13,
13,
4706,
363,
1121,
297,
2582,
29901,
13,
9651,
10422,
353,
851,
29898,
4622,
29918,
2492,
29918,
1949,
29897,
718,
11393,
2732,
29908,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
703,
24713,
29918,
29906,
613,
3858,
29892,
10422,
29897,
13,
9651,
10153,
29918,
13193,
353,
2648,
2167,
5971,
29898,
2914,
29889,
3051,
29897,
13,
9651,
10153,
353,
13850,
29906,
29889,
326,
13808,
29898,
9302,
29889,
3166,
9040,
29898,
2492,
29918,
13193,
29889,
949,
3285,
7442,
29889,
13470,
29947,
511,
13,
462,
1669,
13449,
29922,
29896,
29897,
13,
13,
9651,
565,
10153,
338,
6213,
29901,
13,
18884,
6773,
13,
13,
9651,
3171,
29892,
2920,
353,
10153,
29889,
12181,
7503,
29906,
29962,
13,
9651,
565,
3171,
529,
2920,
29901,
13,
18884,
716,
29918,
3545,
353,
29871,
29906,
29906,
29946,
13,
18884,
716,
29918,
2103,
353,
938,
3552,
1482,
29918,
3545,
847,
3171,
29897,
334,
2920,
29897,
13,
9651,
1683,
29901,
13,
18884,
716,
29918,
2103,
353,
29871,
29906,
29906,
29946,
13,
18884,
716,
29918,
3545,
353,
938,
3552,
1482,
29918,
2103,
847,
2920,
29897,
334,
3171,
29897,
13,
13,
9651,
10153,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29892,
13,
462,
632,
270,
2311,
7607,
1482,
29918,
2103,
29892,
716,
29918,
3545,
511,
13,
462,
632,
29694,
29922,
11023,
29906,
29889,
23845,
29918,
29909,
1525,
29909,
29897,
13,
13,
9651,
13850,
29906,
29889,
326,
3539,
29898,
1445,
2084,
29892,
10153,
29897,
13,
9651,
2446,
29918,
2492,
29918,
1949,
4619,
29871,
29896,
13,
13,
13,
1753,
1653,
29918,
7638,
29898,
21134,
1125,
13,
1678,
11073,
29889,
6605,
580,
13,
13,
1678,
1426,
353,
376,
1445,
3858,
29905,
29876,
29908,
13,
13,
1678,
363,
3858,
29918,
1949,
29892,
3858,
297,
26985,
29898,
21134,
1125,
13,
4706,
3858,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
703,
24713,
29918,
29906,
613,
3858,
29897,
13,
4706,
977,
264,
1280,
353,
2897,
29889,
1761,
3972,
29898,
1643,
29918,
3972,
29897,
13,
4706,
977,
264,
1280,
353,
518,
359,
29889,
2084,
29889,
7122,
29898,
1643,
29918,
3972,
29892,
10422,
29897,
13,
462,
268,
363,
10422,
297,
977,
264,
1280,
29962,
13,
4706,
363,
10422,
297,
977,
264,
1280,
29901,
13,
9651,
396,
4078,
16259,
1819,
363,
11073,
13,
9651,
1426,
4619,
10422,
718,
376,
376,
718,
851,
29898,
1643,
29918,
1949,
29897,
718,
6634,
29876,
29908,
13,
13,
1678,
411,
1722,
703,
24713,
29918,
29906,
29889,
7638,
613,
376,
29893,
1159,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
29898,
726,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
1454,
934,
297,
6796,
29883,
1446,
613,
376,
29883,
1446,
613,
376,
29883,
1446,
3108,
29901,
13,
1678,
396,
1678,
5142,
29918,
8346,
29918,
3166,
29918,
1445,
29898,
1445,
29897,
13,
13,
1678,
396,
21134,
353,
6796,
4117,
613,
376,
26169,
613,
376,
340,
29880,
3108,
13,
1678,
396,
3258,
29918,
7638,
29898,
21134,
29897,
13,
13,
1678,
396,
1454,
934,
297,
6796,
311,
2120,
613,
376,
24156,
3066,
613,
376,
29879,
1249,
3304,
3108,
29901,
13,
1678,
396,
1678,
5142,
29918,
8346,
29918,
3166,
29918,
1445,
29898,
1445,
29897,
13,
13,
1678,
11073,
353,
6796,
311,
2120,
613,
376,
24156,
3066,
613,
376,
29879,
1249,
3304,
3108,
13,
1678,
1653,
29918,
7638,
29898,
21134,
29897,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.