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
|
---|---|---|---|---|---|
PP4E-Examples-1.4/Examples/PP4E/System/Processes/spawnv.py | AngelLiang/PP4E | 0 | 1616319 | """
start up 10 copies of child.py running in parallel;
use spawnv to launch a program on Windows (like fork+exec);
P_OVERLAY replaces, P_DETACH makes child stdout go nowhere;
or use portable subprocess or multiprocessing options today!
"""
import os, sys
for i in range(10):
if sys.platform[:3] == 'win':
pypath = sys.executable
os.spawnv(os.P_NOWAIT, pypath, ('python', 'child.py', str(i)))
else:
pid = os.fork()
if pid != 0:
print('Process %d spawned' % pid)
else:
os.execlp('python', 'python', 'child.py', str(i))
print('Main process exiting.')
| [
1,
9995,
13,
2962,
701,
29871,
29896,
29900,
14591,
310,
2278,
29889,
2272,
2734,
297,
8943,
29936,
13,
1509,
29178,
29894,
304,
6826,
263,
1824,
373,
3852,
313,
4561,
27350,
29974,
4258,
416,
13,
29925,
29918,
29949,
5348,
18799,
1634,
6048,
29892,
349,
29918,
2287,
8687,
29950,
3732,
2278,
27591,
748,
1286,
4150,
29936,
13,
272,
671,
2011,
519,
1014,
5014,
470,
6674,
307,
985,
292,
3987,
9826,
29991,
13,
15945,
29908,
13,
13,
5215,
2897,
29892,
10876,
13,
13,
1454,
474,
297,
3464,
29898,
29896,
29900,
1125,
13,
1678,
565,
10876,
29889,
12120,
7503,
29941,
29962,
1275,
525,
5080,
2396,
13,
4706,
282,
1478,
493,
353,
10876,
29889,
4258,
9246,
13,
4706,
2897,
29889,
1028,
18101,
29894,
29898,
359,
29889,
29925,
29918,
6632,
12982,
1806,
29892,
282,
1478,
493,
29892,
6702,
4691,
742,
525,
5145,
29889,
2272,
742,
851,
29898,
29875,
4961,
13,
1678,
1683,
29901,
13,
4706,
23107,
353,
2897,
29889,
29888,
548,
580,
13,
4706,
565,
23107,
2804,
29871,
29900,
29901,
13,
9651,
1596,
877,
7032,
1273,
29881,
29178,
287,
29915,
1273,
23107,
29897,
13,
4706,
1683,
29901,
13,
9651,
2897,
29889,
4258,
22833,
877,
4691,
742,
525,
4691,
742,
525,
5145,
29889,
2272,
742,
851,
29898,
29875,
876,
13,
2158,
877,
6330,
1889,
6876,
292,
29889,
1495,
13,
2
] |
yatube/posts/migrations/0014_auto_20210712_1142.py | EugeneSal/hw05-ver2 | 0 | 169215 | # Generated by Django 2.2.6 on 2021-07-12 11:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('posts', '0013_auto_20210630_1252'),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date_of_birth', models.DateField(blank=True, null=True)),
('photo', models.ImageField(blank=True, upload_to='users/%Y/%m/%d')),
],
),
migrations.AddConstraint(
model_name='follow',
constraint=models.UniqueConstraint(fields=('user', 'author'), name='unique_list'),
),
migrations.AddField(
model_name='profile',
name='user',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29906,
29889,
29953,
373,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29955,
29899,
29896,
29906,
29871,
29896,
29896,
29901,
29946,
29906,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
9725,
800,
29889,
2774,
932,
519,
29918,
10836,
29898,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
511,
13,
4706,
6702,
14080,
742,
525,
29900,
29900,
29896,
29941,
29918,
6921,
29918,
29906,
29900,
29906,
29896,
29900,
29953,
29941,
29900,
29918,
29896,
29906,
29945,
29906,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
13909,
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,
29918,
974,
29918,
29890,
7515,
742,
4733,
29889,
2539,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
21596,
742,
4733,
29889,
2940,
3073,
29898,
19465,
29922,
5574,
29892,
6441,
29918,
517,
2433,
7193,
22584,
29979,
22584,
29885,
22584,
29881,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2528,
21529,
29898,
13,
9651,
1904,
29918,
978,
2433,
23031,
742,
13,
9651,
7276,
29922,
9794,
29889,
8110,
802,
21529,
29898,
9621,
29922,
877,
1792,
742,
525,
8921,
5477,
1024,
2433,
13092,
29918,
1761,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2528,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
10185,
742,
13,
9651,
1024,
2433,
1792,
742,
13,
9651,
1746,
29922,
9794,
29889,
6716,
1762,
6716,
3073,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
304,
29922,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
consumer.py | sandeeppradhan92/python-kafka-avro | 71 | 150768 | <filename>consumer.py
import io
import avro.schema
import avro.io
from kafka import KafkaConsumer
# To consume messages
CONSUMER = KafkaConsumer('my-topic',
group_id='my_group',
bootstrap_servers=['localhost:9092'])
SCHEMA_PATH = "user.avsc"
SCHEMA = avro.schema.parse(open(SCHEMA_PATH).read())
for msg in CONSUMER:
bytes_reader = io.BytesIO(msg.value)
decoder = avro.io.BinaryDecoder(bytes_reader)
reader = avro.io.DatumReader(SCHEMA)
user1 = reader.read(decoder)
print user1
| [
1,
529,
9507,
29958,
25978,
261,
29889,
2272,
13,
5215,
12013,
13,
5215,
1029,
307,
29889,
11010,
13,
5215,
1029,
307,
29889,
601,
13,
3166,
413,
20817,
1053,
476,
20817,
13696,
4680,
13,
13,
29937,
1763,
29151,
7191,
13,
6007,
25021,
1001,
353,
476,
20817,
13696,
4680,
877,
1357,
29899,
13010,
742,
13,
462,
308,
2318,
29918,
333,
2433,
1357,
29918,
2972,
742,
13,
462,
308,
16087,
29918,
643,
874,
29922,
1839,
7640,
29901,
29929,
29900,
29929,
29906,
11287,
13,
13,
29903,
3210,
26862,
29918,
10145,
353,
376,
1792,
29889,
485,
1557,
29908,
13,
29903,
3210,
26862,
353,
1029,
307,
29889,
11010,
29889,
5510,
29898,
3150,
29898,
29903,
3210,
26862,
29918,
10145,
467,
949,
3101,
13,
13,
1454,
10191,
297,
8707,
25021,
1001,
29901,
13,
1678,
6262,
29918,
16950,
353,
12013,
29889,
11207,
5971,
29898,
7645,
29889,
1767,
29897,
13,
1678,
1602,
6119,
353,
1029,
307,
29889,
601,
29889,
25196,
6185,
6119,
29898,
13193,
29918,
16950,
29897,
13,
1678,
9591,
353,
1029,
307,
29889,
601,
29889,
16390,
398,
6982,
29898,
29903,
3210,
26862,
29897,
13,
1678,
1404,
29896,
353,
9591,
29889,
949,
29898,
7099,
6119,
29897,
13,
1678,
1596,
1404,
29896,
13,
2
] |
stock-filters/decliff.py | bennettdc/MCEdit-Unified | 237 | 177632 | """
DeCliff filter contributed by Minecraft Forums user "DrRomz"
Originally posted here:
http://www.minecraftforum.net/topic/13807-mcedit-minecraft-world-editor-compatible-with-mc-beta-18/page__st__3940__p__7648793#entry7648793
"""
from numpy import zeros, array
import itertools
from pymclevel import alphaMaterials
am = alphaMaterials
# Consider below materials when determining terrain height
blocks = [
am.Stone,
am.Grass,
am.Dirt,
am.Bedrock,
am.Sand,
am.Sandstone,
am.Clay,
am.Gravel,
am.GoldOre,
am.IronOre,
am.CoalOre,
am.LapisLazuliOre,
am.DiamondOre,
am.RedstoneOre,
am.RedstoneOreGlowing,
am.Netherrack,
am.SoulSand,
am.Glowstone
]
terrainBlocktypes = [b.ID for b in blocks]
terrainBlockmask = zeros((256,), dtype='bool')
# Truth table used to calculate terrain height
# trees, leaves, etc. sit on top of terrain
terrainBlockmask[terrainBlocktypes] = True
inputs = (
# Option to limit change to raise_cliff_floor / lower_cliff_top
# Default is to adjust both and meet somewhere in the middle
("Raise/Lower", ("Both", "Lower Only", "Raise Only")),
)
#
# Calculate the maximum adjustment that can be made from
# cliff_pos in direction dir (-1/1) keeping terain at most
# maxstep blocks away from previous column
def maxadj(heightmap, slice_no, cliff_pos, dir, pushup, maxstep, slice_width):
ret = 0
if dir < 0:
if cliff_pos < 2:
return 0
end = 0
else:
if cliff_pos > slice_width - 2:
return 0
end = slice_width - 1
for cur_pos in range(cliff_pos, end, dir):
if pushup:
ret = ret + \
max([0, maxstep - dir * heightmap[slice_no, cur_pos] +
dir * heightmap[slice_no, cur_pos + dir]])
else:
ret = ret + \
min([0, -maxstep + dir * heightmap[slice_no, cur_pos] -
dir * heightmap[slice_no, cur_pos + dir]])
return ret
#
# Raise/lower column at cliff face by adj and decrement change as we move away
# from the face. Each level will be at most maxstep blocks from those beside it.
#
# This function dosn't actually change anything, but just sets array 'new'
# with the desired height.
def adjheight(orig, new, slice_no, cliff_pos, dir, adj, can_adj, maxstep, slice_width):
cur_adj = adj
prev = 0
done_adj = 0
if dir < 0:
end = 1
else:
end = slice_width - 1
if adj == 0 or can_adj == 0:
for cur_pos in range(cliff_pos, end, dir):
new[slice_no, cur_pos] = orig[slice_no, cur_pos]
else:
for cur_pos in range(cliff_pos, end, dir):
if adj > 0:
done_adj = done_adj + \
max([0, maxstep - orig[slice_no, cur_pos] +
orig[slice_no, cur_pos + dir]])
if orig[slice_no, cur_pos] - \
orig[slice_no, cur_pos + dir] > 0:
cur_adj = max([0, cur_adj - orig[slice_no, cur_pos] +
orig[slice_no, cur_pos + dir]])
prev = adj - cur_adj
else:
done_adj = done_adj + \
min([0, -maxstep +
orig[slice_no, cur_pos] -
orig[slice_no, cur_pos + dir]])
if orig[slice_no, cur_pos] - \
orig[slice_no, cur_pos + dir] > 0:
cur_adj = min([0, cur_adj + orig[slice_no, cur_pos] - orig[slice_no, cur_pos + dir]])
prev = adj - cur_adj
new[slice_no, cur_pos] = max([0, orig[slice_no, cur_pos] + cur_adj])
if cur_adj != 0 and \
abs(prev) < abs(int(adj * done_adj / can_adj)):
cur_adj += prev - int(adj * done_adj / can_adj)
prev = int(adj * done_adj / can_adj)
new[slice_no, end] = orig[slice_no, end]
def perform(level, box, options):
if box.volume > 16000000:
raise ValueError("Volume too big for this filter method!")
RLOption = options["Raise/Lower"]
schema = level.extractSchematic(box)
schema.removeEntitiesInBox(schema.bounds)
schema.removeTileEntitiesInBox(schema.bounds)
terrainBlocks = terrainBlockmask[schema.Blocks]
coords = terrainBlocks.nonzero()
# Swap values around so long edge of selected rectangle is first
# - the long edge is assumed to run parallel to the cliff face
# and we want to process slices perpendicular to the face
# heightmap will have x,z (or z,x) index with highest ground level
if schema.Width > schema.Length:
heightmap = zeros((schema.Width, schema.Length), dtype='float32')
heightmap[coords[0], coords[1]] = coords[2]
newHeightmap = zeros((schema.Width, schema.Length), dtype='uint16')
slice_count = schema.Width
slice_width = schema.Length
else:
heightmap = zeros((schema.Length, schema.Width), dtype='float32')
heightmap[coords[1], coords[0]] = coords[2]
newHeightmap = zeros((schema.Length, schema.Width), dtype='uint16')
slice_count = schema.Length
slice_width = schema.Width
nonTerrainBlocks = ~terrainBlocks
nonTerrainBlocks &= schema.Blocks != 0
for slice_no in range(0, slice_count):
cliff_height = 0
# determine pos and height of cliff in this slice
for cur_pos in range(0, slice_width - 1):
if abs(heightmap[slice_no, cur_pos] -
heightmap[slice_no, cur_pos + 1]) > abs(cliff_height):
cliff_height = \
heightmap[slice_no, cur_pos] - \
heightmap[slice_no, cur_pos + 1]
cliff_pos = cur_pos
if abs(cliff_height) < 2:
# nothing to adjust - just copy heightmap to newHightmap
adjheight(heightmap, newHeightmap, slice_no, 0, 1, 0, 1, 1, slice_width)
continue
# Try to keep adjusted columns within 1 column of their neighbours
# but ramp up to 4 blocks up/down on each column when needed
for max_step in range(1, 4):
can_left = maxadj(heightmap, slice_no, cliff_pos, -1, cliff_height < 0, max_step, slice_width)
can_right = maxadj(heightmap, slice_no, cliff_pos + 1, 1, cliff_height > 0, max_step, slice_width)
if can_right < 0 and RLOption == "Raise Only":
can_right = 0
if can_right > 0 and RLOption == "Lower Only":
can_right = 0
if can_left < 0 and RLOption == "Raise Only":
can_left = 0
if can_left > 0 and RLOption == "Lower Only":
can_left = 0
if 0 > cliff_height > can_right - can_left:
if abs(can_left) > abs(can_right):
adj_left = -1 * (cliff_height - max([int(cliff_height / 2), can_right]))
adj_right = cliff_height + adj_left
else:
adj_right = cliff_height - max([int(cliff_height / 2), -can_left])
adj_left = -1 * (cliff_height - adj_right + 1)
else:
if 0 < cliff_height < can_right - can_left:
if abs(can_left) > abs(can_right):
adj_left = -1 * (cliff_height - min([int(cliff_height / 2), can_right]))
adj_right = cliff_height + adj_left
else:
adj_right = cliff_height - min([int(cliff_height / 2), -can_left]) - 1
adj_left = -1 * (cliff_height - adj_right)
else:
adj_right = 0
adj_left = 0
continue
break
adjheight(heightmap, newHeightmap, slice_no, cliff_pos, -1, adj_left, can_left, max_step, slice_width)
adjheight(heightmap, newHeightmap, slice_no, cliff_pos + 1, 1, adj_right, can_right, max_step, slice_width)
# OK, newHeightMap has new height for each column
# so it's just a matter of moving everything up/down
for x, z in itertools.product(xrange(1, schema.Width - 1), xrange(1, schema.Length - 1)):
if schema.Width > schema.Length:
oh = heightmap[x, z]
nh = newHeightmap[x, z]
else:
oh = heightmap[z, x]
nh = newHeightmap[z, x]
delta = nh - oh
column = array(schema.Blocks[x, z])
# Keep bottom 5 blocks, so we don't loose bedrock
keep = min([5, nh])
Waterdepth = 0
# Detect Water on top
if column[oh + 1:oh + 2] == am.Water.ID or \
column[oh + 1:oh + 2] == am.Ice.ID:
for cur_pos in range(int(oh) + 1, schema.Height):
if column[cur_pos:cur_pos + 1] != am.Water.ID and \
column[cur_pos:cur_pos + 1] != am.Ice.ID:
break
Waterdepth += 1
if delta == 0:
column[oh:] = schema.Blocks[x, z, oh:]
if delta < 0:
# Moving column down
column[keep:delta] = schema.Blocks[x, z, keep - delta:]
column[delta:] = am.Air.ID
if Waterdepth > 0:
# Avoid steping small lakes, etc on cliff top
# replace with dirt 'n grass
column[nh:nh + 1] = am.Grass.ID
column[nh + 1:nh + 1 + delta] = am.Air.ID
if delta > 0:
# Moving column up
column[keep + delta:] = schema.Blocks[x, z, keep:-delta]
# Put stone in gap at the bottom
column[keep:keep + delta] = am.Stone.ID
if Waterdepth > 0:
if Waterdepth > delta:
# Retain Ice
if column[nh + Waterdepth:nh + Waterdepth + 1] == am.Ice.ID:
column[nh + Waterdepth - delta:nh + 1 + Waterdepth - delta] = \
am.Ice.ID
column[nh + 1 + Waterdepth - delta:nh + 1 + Waterdepth] = am.Air.ID
else:
if Waterdepth < delta - 2:
column[nh:nh + 1] = am.Grass.ID
column[nh + 1:nh + 1 + Waterdepth] = am.Air.ID
else:
# Beach at the edge
column[nh - 4:nh - 2] = am.Sandstone.ID
column[nh - 2:nh + 1] = am.Sand.ID
column[nh + 1:nh + 1 + Waterdepth] = am.Air.ID
schema.Blocks[x, z] = column
level.copyBlocksFrom(schema, schema.bounds, box.origin)
| [
1,
9995,
13,
2772,
6821,
2593,
4175,
26869,
491,
26833,
17293,
1152,
6762,
1404,
376,
25639,
29934,
290,
29920,
29908,
13,
13,
23182,
635,
8059,
1244,
29901,
13,
1124,
597,
1636,
29889,
24669,
17293,
23343,
29889,
1212,
29914,
13010,
29914,
29896,
29941,
29947,
29900,
29955,
29899,
29885,
1133,
277,
29899,
24669,
17293,
29899,
11526,
29899,
15204,
29899,
23712,
29899,
2541,
29899,
14047,
29899,
3571,
29899,
29896,
29947,
29914,
3488,
1649,
303,
1649,
29941,
29929,
29946,
29900,
1649,
29886,
1649,
29955,
29953,
29946,
29947,
29955,
29929,
29941,
29937,
8269,
29955,
29953,
29946,
29947,
29955,
29929,
29941,
13,
15945,
29908,
13,
3166,
12655,
1053,
24786,
29892,
1409,
13,
5215,
4256,
8504,
13,
3166,
282,
962,
2841,
955,
1053,
15595,
24095,
29879,
13,
13,
314,
353,
15595,
24095,
29879,
13,
13,
29937,
10056,
2400,
17279,
746,
3683,
2827,
28439,
3171,
13,
1271,
29879,
353,
518,
13,
1678,
626,
29889,
855,
650,
29892,
13,
1678,
626,
29889,
3338,
465,
29892,
13,
1678,
626,
29889,
29928,
2728,
29892,
13,
1678,
626,
29889,
29933,
287,
20821,
29892,
13,
1678,
626,
29889,
29903,
392,
29892,
13,
1678,
626,
29889,
29903,
392,
12734,
29892,
13,
1678,
626,
29889,
6821,
388,
29892,
13,
1678,
626,
29889,
29954,
336,
955,
29892,
13,
1678,
626,
29889,
29954,
1025,
29949,
276,
29892,
13,
1678,
626,
29889,
29902,
1617,
29949,
276,
29892,
13,
1678,
626,
29889,
7967,
284,
29949,
276,
29892,
13,
1678,
626,
29889,
29931,
11355,
29931,
834,
14549,
29949,
276,
29892,
13,
1678,
626,
29889,
29928,
2829,
898,
29949,
276,
29892,
13,
1678,
626,
29889,
9039,
12734,
29949,
276,
29892,
13,
1678,
626,
29889,
9039,
12734,
29949,
276,
29954,
677,
292,
29892,
13,
1678,
626,
29889,
29940,
1979,
22282,
29892,
13,
1678,
626,
29889,
29903,
5059,
29903,
392,
29892,
13,
1678,
626,
29889,
29954,
677,
12734,
13,
29962,
13,
357,
6038,
7445,
8768,
353,
518,
29890,
29889,
1367,
363,
289,
297,
10930,
29962,
13,
357,
6038,
7445,
13168,
353,
24786,
3552,
29906,
29945,
29953,
29892,
511,
26688,
2433,
11227,
1495,
13,
13,
29937,
1605,
2806,
1591,
1304,
304,
8147,
28439,
3171,
13,
29937,
10697,
29892,
11308,
29892,
2992,
29889,
7845,
373,
2246,
310,
28439,
13,
357,
6038,
7445,
13168,
29961,
357,
6038,
7445,
8768,
29962,
353,
5852,
13,
13,
2080,
29879,
353,
313,
13,
1678,
396,
10831,
304,
4046,
1735,
304,
12020,
29918,
695,
2593,
29918,
14939,
847,
5224,
29918,
695,
2593,
29918,
3332,
13,
1678,
396,
13109,
338,
304,
10365,
1716,
322,
5870,
9051,
297,
278,
7256,
13,
1678,
4852,
29934,
29874,
895,
29914,
19357,
613,
4852,
29933,
720,
613,
376,
19357,
9333,
613,
376,
29934,
29874,
895,
9333,
1159,
511,
13,
29897,
13,
13,
13,
29937,
13,
29937,
20535,
403,
278,
7472,
10365,
358,
393,
508,
367,
1754,
515,
13,
29937,
1067,
2593,
29918,
1066,
297,
5305,
4516,
8521,
29896,
29914,
29896,
29897,
12515,
1935,
475,
472,
1556,
13,
29937,
4236,
10568,
10930,
3448,
515,
3517,
1897,
13,
1753,
4236,
26859,
29898,
3545,
1958,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
29892,
4516,
29892,
5503,
786,
29892,
4236,
10568,
29892,
22780,
29918,
2103,
1125,
13,
1678,
3240,
353,
29871,
29900,
13,
1678,
565,
4516,
529,
29871,
29900,
29901,
13,
4706,
565,
1067,
2593,
29918,
1066,
529,
29871,
29906,
29901,
13,
9651,
736,
29871,
29900,
13,
4706,
1095,
353,
29871,
29900,
13,
1678,
1683,
29901,
13,
4706,
565,
1067,
2593,
29918,
1066,
1405,
22780,
29918,
2103,
448,
29871,
29906,
29901,
13,
9651,
736,
29871,
29900,
13,
4706,
1095,
353,
22780,
29918,
2103,
448,
29871,
29896,
13,
13,
1678,
363,
3151,
29918,
1066,
297,
3464,
29898,
695,
2593,
29918,
1066,
29892,
1095,
29892,
4516,
1125,
13,
4706,
565,
5503,
786,
29901,
13,
9651,
3240,
353,
3240,
718,
320,
13,
462,
29871,
4236,
4197,
29900,
29892,
4236,
10568,
448,
4516,
334,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
718,
13,
462,
539,
4516,
334,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
4706,
1683,
29901,
13,
9651,
3240,
353,
3240,
718,
320,
13,
462,
29871,
1375,
4197,
29900,
29892,
448,
3317,
10568,
718,
4516,
334,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
13,
462,
539,
4516,
334,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
13,
1678,
736,
3240,
13,
13,
13,
29937,
13,
29937,
6981,
895,
29914,
13609,
1897,
472,
1067,
2593,
3700,
491,
12109,
322,
9263,
358,
1735,
408,
591,
4337,
3448,
13,
29937,
515,
278,
3700,
29889,
7806,
3233,
674,
367,
472,
1556,
4236,
10568,
10930,
515,
1906,
17620,
372,
29889,
13,
29937,
13,
29937,
910,
740,
3248,
29876,
29915,
29873,
2869,
1735,
3099,
29892,
541,
925,
6166,
1409,
525,
1482,
29915,
13,
29937,
411,
278,
7429,
3171,
29889,
13,
1753,
12109,
3545,
29898,
12683,
29892,
716,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
29892,
4516,
29892,
12109,
29892,
508,
29918,
26859,
29892,
4236,
10568,
29892,
22780,
29918,
2103,
1125,
13,
1678,
3151,
29918,
26859,
353,
12109,
13,
1678,
12379,
353,
29871,
29900,
13,
1678,
2309,
29918,
26859,
353,
29871,
29900,
13,
13,
1678,
565,
4516,
529,
29871,
29900,
29901,
13,
4706,
1095,
353,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
1095,
353,
22780,
29918,
2103,
448,
29871,
29896,
13,
13,
1678,
565,
12109,
1275,
29871,
29900,
470,
508,
29918,
26859,
1275,
29871,
29900,
29901,
13,
4706,
363,
3151,
29918,
1066,
297,
3464,
29898,
695,
2593,
29918,
1066,
29892,
1095,
29892,
4516,
1125,
13,
9651,
716,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
353,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
13,
1678,
1683,
29901,
13,
13,
4706,
363,
3151,
29918,
1066,
297,
3464,
29898,
695,
2593,
29918,
1066,
29892,
1095,
29892,
4516,
1125,
13,
9651,
565,
12109,
1405,
29871,
29900,
29901,
13,
18884,
2309,
29918,
26859,
353,
2309,
29918,
26859,
718,
320,
13,
462,
965,
4236,
4197,
29900,
29892,
4236,
10568,
448,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
718,
13,
462,
18884,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
13,
18884,
565,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
320,
13,
462,
4706,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
29962,
1405,
29871,
29900,
29901,
13,
462,
1678,
3151,
29918,
26859,
353,
4236,
4197,
29900,
29892,
3151,
29918,
26859,
448,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
718,
13,
462,
462,
259,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
462,
1678,
12379,
353,
12109,
448,
3151,
29918,
26859,
13,
9651,
1683,
29901,
13,
18884,
2309,
29918,
26859,
353,
2309,
29918,
26859,
718,
320,
13,
462,
965,
1375,
4197,
29900,
29892,
448,
3317,
10568,
718,
13,
462,
18884,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
13,
462,
18884,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
18884,
565,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
320,
13,
462,
4706,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
29962,
1405,
29871,
29900,
29901,
13,
462,
1678,
3151,
29918,
26859,
353,
1375,
4197,
29900,
29892,
3151,
29918,
26859,
718,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
4516,
24960,
13,
462,
1678,
12379,
353,
12109,
448,
3151,
29918,
26859,
13,
9651,
716,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
353,
4236,
4197,
29900,
29892,
1677,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
718,
3151,
29918,
26859,
2314,
13,
9651,
565,
3151,
29918,
26859,
2804,
29871,
29900,
322,
320,
13,
462,
9651,
6425,
29898,
16304,
29897,
529,
6425,
29898,
524,
29898,
26859,
334,
2309,
29918,
26859,
847,
508,
29918,
26859,
22164,
13,
18884,
3151,
29918,
26859,
4619,
12379,
448,
938,
29898,
26859,
334,
2309,
29918,
26859,
847,
508,
29918,
26859,
29897,
13,
18884,
12379,
353,
938,
29898,
26859,
334,
2309,
29918,
26859,
847,
508,
29918,
26859,
29897,
13,
13,
1678,
716,
29961,
18337,
29918,
1217,
29892,
1095,
29962,
353,
1677,
29961,
18337,
29918,
1217,
29892,
1095,
29962,
13,
13,
13,
1753,
2189,
29898,
5563,
29892,
3800,
29892,
3987,
1125,
13,
1678,
565,
3800,
29889,
24623,
1405,
29871,
29896,
29953,
29900,
29900,
29900,
29900,
29900,
29900,
29901,
13,
4706,
12020,
7865,
2392,
703,
24679,
2086,
4802,
363,
445,
4175,
1158,
29991,
1159,
13,
13,
1678,
390,
3927,
683,
353,
3987,
3366,
29934,
29874,
895,
29914,
19357,
3108,
13,
1678,
10938,
353,
3233,
29889,
21111,
4504,
19217,
29898,
1884,
29897,
13,
1678,
10938,
29889,
5992,
5292,
1907,
797,
3313,
29898,
11010,
29889,
23687,
29897,
13,
1678,
10938,
29889,
5992,
29911,
488,
5292,
1907,
797,
3313,
29898,
11010,
29889,
23687,
29897,
13,
13,
1678,
28439,
7445,
29879,
353,
28439,
7445,
13168,
29961,
11010,
29889,
7445,
29879,
29962,
13,
13,
1678,
1302,
4339,
353,
28439,
7445,
29879,
29889,
5464,
9171,
580,
13,
13,
1678,
396,
3925,
481,
1819,
2820,
577,
1472,
7636,
310,
4629,
16701,
338,
937,
13,
1678,
396,
448,
278,
1472,
7636,
338,
12023,
304,
1065,
8943,
304,
278,
1067,
2593,
3700,
13,
1678,
396,
322,
591,
864,
304,
1889,
269,
29399,
639,
14081,
16311,
304,
278,
3700,
13,
1678,
396,
29871,
3171,
1958,
674,
505,
921,
29892,
29920,
313,
272,
503,
29892,
29916,
29897,
2380,
411,
9939,
5962,
3233,
13,
1678,
565,
10938,
29889,
6110,
1405,
10938,
29889,
6513,
29901,
13,
4706,
3171,
1958,
353,
24786,
3552,
11010,
29889,
6110,
29892,
10938,
29889,
6513,
511,
26688,
2433,
7411,
29941,
29906,
1495,
13,
4706,
3171,
1958,
29961,
1111,
4339,
29961,
29900,
1402,
1302,
4339,
29961,
29896,
5262,
353,
1302,
4339,
29961,
29906,
29962,
13,
4706,
716,
7011,
1958,
353,
24786,
3552,
11010,
29889,
6110,
29892,
10938,
29889,
6513,
511,
26688,
2433,
13470,
29896,
29953,
1495,
13,
4706,
22780,
29918,
2798,
353,
10938,
29889,
6110,
13,
4706,
22780,
29918,
2103,
353,
10938,
29889,
6513,
13,
1678,
1683,
29901,
13,
4706,
3171,
1958,
353,
24786,
3552,
11010,
29889,
6513,
29892,
10938,
29889,
6110,
511,
26688,
2433,
7411,
29941,
29906,
1495,
13,
4706,
3171,
1958,
29961,
1111,
4339,
29961,
29896,
1402,
1302,
4339,
29961,
29900,
5262,
353,
1302,
4339,
29961,
29906,
29962,
13,
4706,
716,
7011,
1958,
353,
24786,
3552,
11010,
29889,
6513,
29892,
10938,
29889,
6110,
511,
26688,
2433,
13470,
29896,
29953,
1495,
13,
4706,
22780,
29918,
2798,
353,
10938,
29889,
6513,
13,
4706,
22780,
29918,
2103,
353,
10938,
29889,
6110,
13,
13,
1678,
1661,
29911,
261,
6038,
7445,
29879,
353,
3695,
357,
6038,
7445,
29879,
13,
1678,
1661,
29911,
261,
6038,
7445,
29879,
7878,
10938,
29889,
7445,
29879,
2804,
29871,
29900,
13,
13,
1678,
363,
22780,
29918,
1217,
297,
3464,
29898,
29900,
29892,
22780,
29918,
2798,
1125,
13,
13,
4706,
1067,
2593,
29918,
3545,
353,
29871,
29900,
13,
4706,
396,
8161,
926,
322,
3171,
310,
1067,
2593,
297,
445,
22780,
13,
4706,
363,
3151,
29918,
1066,
297,
3464,
29898,
29900,
29892,
22780,
29918,
2103,
448,
29871,
29896,
1125,
13,
9651,
565,
6425,
29898,
3545,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
13,
462,
1678,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
29871,
29896,
2314,
1405,
6425,
29898,
695,
2593,
29918,
3545,
1125,
13,
18884,
1067,
2593,
29918,
3545,
353,
320,
13,
462,
1678,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
29962,
448,
320,
13,
462,
1678,
3171,
1958,
29961,
18337,
29918,
1217,
29892,
3151,
29918,
1066,
718,
29871,
29896,
29962,
13,
18884,
1067,
2593,
29918,
1066,
353,
3151,
29918,
1066,
13,
13,
4706,
565,
6425,
29898,
695,
2593,
29918,
3545,
29897,
529,
29871,
29906,
29901,
13,
9651,
396,
3078,
304,
10365,
448,
925,
3509,
3171,
1958,
304,
716,
29950,
523,
1958,
13,
9651,
12109,
3545,
29898,
3545,
1958,
29892,
716,
7011,
1958,
29892,
22780,
29918,
1217,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
22780,
29918,
2103,
29897,
13,
9651,
6773,
13,
13,
4706,
396,
3967,
304,
3013,
10365,
287,
4341,
2629,
29871,
29896,
1897,
310,
1009,
22092,
2470,
13,
4706,
396,
541,
364,
1160,
701,
304,
29871,
29946,
10930,
701,
29914,
3204,
373,
1269,
1897,
746,
4312,
13,
4706,
363,
4236,
29918,
10568,
297,
3464,
29898,
29896,
29892,
29871,
29946,
1125,
13,
13,
9651,
508,
29918,
1563,
353,
4236,
26859,
29898,
3545,
1958,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
29892,
448,
29896,
29892,
1067,
2593,
29918,
3545,
529,
29871,
29900,
29892,
4236,
29918,
10568,
29892,
22780,
29918,
2103,
29897,
13,
9651,
508,
29918,
1266,
353,
4236,
26859,
29898,
3545,
1958,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
718,
29871,
29896,
29892,
29871,
29896,
29892,
1067,
2593,
29918,
3545,
1405,
29871,
29900,
29892,
4236,
29918,
10568,
29892,
22780,
29918,
2103,
29897,
13,
13,
9651,
565,
508,
29918,
1266,
529,
29871,
29900,
322,
390,
3927,
683,
1275,
376,
29934,
29874,
895,
9333,
1115,
13,
18884,
508,
29918,
1266,
353,
29871,
29900,
13,
9651,
565,
508,
29918,
1266,
1405,
29871,
29900,
322,
390,
3927,
683,
1275,
376,
19357,
9333,
1115,
13,
18884,
508,
29918,
1266,
353,
29871,
29900,
13,
9651,
565,
508,
29918,
1563,
529,
29871,
29900,
322,
390,
3927,
683,
1275,
376,
29934,
29874,
895,
9333,
1115,
13,
18884,
508,
29918,
1563,
353,
29871,
29900,
13,
9651,
565,
508,
29918,
1563,
1405,
29871,
29900,
322,
390,
3927,
683,
1275,
376,
19357,
9333,
1115,
13,
18884,
508,
29918,
1563,
353,
29871,
29900,
13,
13,
9651,
565,
29871,
29900,
1405,
1067,
2593,
29918,
3545,
1405,
508,
29918,
1266,
448,
508,
29918,
1563,
29901,
13,
18884,
565,
6425,
29898,
3068,
29918,
1563,
29897,
1405,
6425,
29898,
3068,
29918,
1266,
1125,
13,
462,
1678,
12109,
29918,
1563,
353,
448,
29896,
334,
313,
695,
2593,
29918,
3545,
448,
4236,
4197,
524,
29898,
695,
2593,
29918,
3545,
847,
29871,
29906,
511,
508,
29918,
1266,
12622,
13,
462,
1678,
12109,
29918,
1266,
353,
1067,
2593,
29918,
3545,
718,
12109,
29918,
1563,
13,
18884,
1683,
29901,
13,
462,
1678,
12109,
29918,
1266,
353,
1067,
2593,
29918,
3545,
448,
4236,
4197,
524,
29898,
695,
2593,
29918,
3545,
847,
29871,
29906,
511,
448,
3068,
29918,
1563,
2314,
13,
462,
1678,
12109,
29918,
1563,
353,
448,
29896,
334,
313,
695,
2593,
29918,
3545,
448,
12109,
29918,
1266,
718,
29871,
29896,
29897,
13,
9651,
1683,
29901,
13,
18884,
565,
29871,
29900,
529,
1067,
2593,
29918,
3545,
529,
508,
29918,
1266,
448,
508,
29918,
1563,
29901,
13,
462,
1678,
565,
6425,
29898,
3068,
29918,
1563,
29897,
1405,
6425,
29898,
3068,
29918,
1266,
1125,
13,
462,
4706,
12109,
29918,
1563,
353,
448,
29896,
334,
313,
695,
2593,
29918,
3545,
448,
1375,
4197,
524,
29898,
695,
2593,
29918,
3545,
847,
29871,
29906,
511,
508,
29918,
1266,
12622,
13,
462,
4706,
12109,
29918,
1266,
353,
1067,
2593,
29918,
3545,
718,
12109,
29918,
1563,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
12109,
29918,
1266,
353,
1067,
2593,
29918,
3545,
448,
1375,
4197,
524,
29898,
695,
2593,
29918,
3545,
847,
29871,
29906,
511,
448,
3068,
29918,
1563,
2314,
448,
29871,
29896,
13,
462,
4706,
12109,
29918,
1563,
353,
448,
29896,
334,
313,
695,
2593,
29918,
3545,
448,
12109,
29918,
1266,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
12109,
29918,
1266,
353,
29871,
29900,
13,
462,
1678,
12109,
29918,
1563,
353,
29871,
29900,
13,
462,
1678,
6773,
13,
9651,
2867,
13,
13,
4706,
12109,
3545,
29898,
3545,
1958,
29892,
716,
7011,
1958,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
29892,
448,
29896,
29892,
12109,
29918,
1563,
29892,
508,
29918,
1563,
29892,
4236,
29918,
10568,
29892,
22780,
29918,
2103,
29897,
13,
4706,
12109,
3545,
29898,
3545,
1958,
29892,
716,
7011,
1958,
29892,
22780,
29918,
1217,
29892,
1067,
2593,
29918,
1066,
718,
29871,
29896,
29892,
29871,
29896,
29892,
12109,
29918,
1266,
29892,
508,
29918,
1266,
29892,
4236,
29918,
10568,
29892,
22780,
29918,
2103,
29897,
13,
13,
1678,
396,
9280,
29892,
716,
7011,
3388,
756,
716,
3171,
363,
1269,
1897,
13,
1678,
396,
577,
372,
29915,
29879,
925,
263,
4383,
310,
8401,
4129,
701,
29914,
3204,
13,
1678,
363,
921,
29892,
503,
297,
4256,
8504,
29889,
4704,
29898,
29916,
3881,
29898,
29896,
29892,
10938,
29889,
6110,
448,
29871,
29896,
511,
921,
3881,
29898,
29896,
29892,
10938,
29889,
6513,
448,
29871,
29896,
22164,
13,
13,
4706,
565,
10938,
29889,
6110,
1405,
10938,
29889,
6513,
29901,
13,
9651,
9360,
353,
3171,
1958,
29961,
29916,
29892,
503,
29962,
13,
9651,
302,
29882,
353,
716,
7011,
1958,
29961,
29916,
29892,
503,
29962,
13,
4706,
1683,
29901,
13,
9651,
9360,
353,
3171,
1958,
29961,
29920,
29892,
921,
29962,
13,
9651,
302,
29882,
353,
716,
7011,
1958,
29961,
29920,
29892,
921,
29962,
13,
13,
4706,
19471,
353,
302,
29882,
448,
9360,
13,
13,
4706,
1897,
353,
1409,
29898,
11010,
29889,
7445,
29879,
29961,
29916,
29892,
503,
2314,
13,
4706,
396,
19152,
5970,
29871,
29945,
10930,
29892,
577,
591,
1016,
29915,
29873,
23819,
6592,
20821,
13,
4706,
3013,
353,
1375,
4197,
29945,
29892,
302,
29882,
2314,
13,
13,
4706,
13062,
19488,
353,
29871,
29900,
13,
4706,
396,
5953,
522,
13062,
373,
2246,
13,
4706,
565,
1897,
29961,
1148,
718,
29871,
29896,
29901,
1148,
718,
29871,
29906,
29962,
1275,
626,
29889,
29956,
1008,
29889,
1367,
470,
320,
13,
462,
4706,
1897,
29961,
1148,
718,
29871,
29896,
29901,
1148,
718,
29871,
29906,
29962,
1275,
626,
29889,
29902,
346,
29889,
1367,
29901,
13,
9651,
363,
3151,
29918,
1066,
297,
3464,
29898,
524,
29898,
1148,
29897,
718,
29871,
29896,
29892,
10938,
29889,
7011,
1125,
13,
18884,
565,
1897,
29961,
2764,
29918,
1066,
29901,
2764,
29918,
1066,
718,
29871,
29896,
29962,
2804,
626,
29889,
29956,
1008,
29889,
1367,
322,
320,
13,
462,
18884,
1897,
29961,
2764,
29918,
1066,
29901,
2764,
29918,
1066,
718,
29871,
29896,
29962,
2804,
626,
29889,
29902,
346,
29889,
1367,
29901,
13,
462,
1678,
2867,
13,
18884,
13062,
19488,
4619,
29871,
29896,
13,
13,
4706,
565,
19471,
1275,
29871,
29900,
29901,
13,
9651,
1897,
29961,
1148,
17531,
353,
10938,
29889,
7445,
29879,
29961,
29916,
29892,
503,
29892,
9360,
17531,
13,
13,
4706,
565,
19471,
529,
29871,
29900,
29901,
13,
9651,
396,
14104,
292,
1897,
1623,
13,
9651,
1897,
29961,
17462,
29901,
4181,
29962,
353,
10938,
29889,
7445,
29879,
29961,
29916,
29892,
503,
29892,
3013,
448,
19471,
17531,
13,
9651,
1897,
29961,
4181,
17531,
353,
626,
29889,
29909,
381,
29889,
1367,
13,
9651,
565,
13062,
19488,
1405,
29871,
29900,
29901,
13,
18884,
396,
319,
5405,
4331,
292,
2319,
425,
10794,
29892,
2992,
373,
1067,
2593,
2246,
13,
18884,
396,
5191,
411,
270,
2728,
525,
29876,
17455,
13,
18884,
1897,
29961,
29876,
29882,
29901,
29876,
29882,
718,
29871,
29896,
29962,
353,
626,
29889,
3338,
465,
29889,
1367,
13,
18884,
1897,
29961,
29876,
29882,
718,
29871,
29896,
29901,
29876,
29882,
718,
29871,
29896,
718,
19471,
29962,
353,
626,
29889,
29909,
381,
29889,
1367,
13,
4706,
565,
19471,
1405,
29871,
29900,
29901,
13,
9651,
396,
14104,
292,
1897,
701,
13,
9651,
1897,
29961,
17462,
718,
19471,
17531,
353,
10938,
29889,
7445,
29879,
29961,
29916,
29892,
503,
29892,
3013,
13018,
4181,
29962,
13,
9651,
396,
12065,
12565,
297,
17261,
472,
278,
5970,
13,
9651,
1897,
29961,
17462,
29901,
17462,
718,
19471,
29962,
353,
626,
29889,
855,
650,
29889,
1367,
13,
13,
9651,
565,
13062,
19488,
1405,
29871,
29900,
29901,
13,
18884,
565,
13062,
19488,
1405,
19471,
29901,
13,
462,
1678,
396,
4649,
475,
26998,
13,
462,
1678,
565,
1897,
29961,
29876,
29882,
718,
13062,
19488,
29901,
29876,
29882,
718,
13062,
19488,
718,
29871,
29896,
29962,
1275,
626,
29889,
29902,
346,
29889,
1367,
29901,
13,
462,
4706,
1897,
29961,
29876,
29882,
718,
13062,
19488,
448,
19471,
29901,
29876,
29882,
718,
29871,
29896,
718,
13062,
19488,
448,
19471,
29962,
353,
320,
13,
462,
9651,
626,
29889,
29902,
346,
29889,
1367,
13,
462,
1678,
1897,
29961,
29876,
29882,
718,
29871,
29896,
718,
13062,
19488,
448,
19471,
29901,
29876,
29882,
718,
29871,
29896,
718,
13062,
19488,
29962,
353,
626,
29889,
29909,
381,
29889,
1367,
13,
18884,
1683,
29901,
13,
462,
1678,
565,
13062,
19488,
529,
19471,
448,
29871,
29906,
29901,
13,
462,
4706,
1897,
29961,
29876,
29882,
29901,
29876,
29882,
718,
29871,
29896,
29962,
353,
626,
29889,
3338,
465,
29889,
1367,
13,
462,
4706,
1897,
29961,
29876,
29882,
718,
29871,
29896,
29901,
29876,
29882,
718,
29871,
29896,
718,
13062,
19488,
29962,
353,
626,
29889,
29909,
381,
29889,
1367,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
396,
17594,
472,
278,
7636,
13,
462,
4706,
1897,
29961,
29876,
29882,
448,
29871,
29946,
29901,
29876,
29882,
448,
29871,
29906,
29962,
353,
626,
29889,
29903,
392,
12734,
29889,
1367,
13,
462,
4706,
1897,
29961,
29876,
29882,
448,
29871,
29906,
29901,
29876,
29882,
718,
29871,
29896,
29962,
353,
626,
29889,
29903,
392,
29889,
1367,
13,
462,
4706,
1897,
29961,
29876,
29882,
718,
29871,
29896,
29901,
29876,
29882,
718,
29871,
29896,
718,
13062,
19488,
29962,
353,
626,
29889,
29909,
381,
29889,
1367,
13,
13,
4706,
10938,
29889,
7445,
29879,
29961,
29916,
29892,
503,
29962,
353,
1897,
13,
13,
1678,
3233,
29889,
8552,
7445,
29879,
4591,
29898,
11010,
29892,
10938,
29889,
23687,
29892,
3800,
29889,
12574,
29897,
13,
2
] |
sbpy/spectroscopy/tests/test_spec.py | dirac-institute/sbpy | 47 | 147357 | <filename>sbpy/spectroscopy/tests/test_spec.py
import os
def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)
class MockResponseSpec(object):
def __init__(self, filename):
self.filename = data_path(filename)
@property
def text(self):
with open(self.filename) as f:
return f.read()
| [
1,
529,
9507,
29958,
20778,
2272,
29914,
21494,
307,
1557,
2270,
29914,
21150,
29914,
1688,
29918,
6550,
29889,
2272,
13,
5215,
2897,
13,
13,
13,
1753,
848,
29918,
2084,
29898,
9507,
1125,
13,
1678,
848,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
1272,
1495,
13,
1678,
736,
2897,
29889,
2084,
29889,
7122,
29898,
1272,
29918,
3972,
29892,
10422,
29897,
13,
13,
13,
1990,
26297,
5103,
10299,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10422,
1125,
13,
4706,
1583,
29889,
9507,
353,
848,
29918,
2084,
29898,
9507,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1426,
29898,
1311,
1125,
13,
4706,
411,
1722,
29898,
1311,
29889,
9507,
29897,
408,
285,
29901,
13,
9651,
736,
285,
29889,
949,
580,
13,
2
] |
test/test_worm_api.py | Atomicology/isilon_sdk_python | 0 | 191715 | <gh_stars>0
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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.
ref: https://github.com/swagger-api/swagger-codegen
"""
from __future__ import absolute_import
import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.worm_api import WormApi
class TestWormApi(unittest.TestCase):
""" WormApi unit test stubs """
def setUp(self):
self.api = swagger_client.apis.worm_api.WormApi()
def tearDown(self):
pass
def test_create_worm_domain(self):
"""
Test case for create_worm_domain
"""
pass
def test_get_worm_domain(self):
"""
Test case for get_worm_domain
"""
pass
def test_get_worm_settings(self):
"""
Test case for get_worm_settings
"""
pass
def test_list_worm_domains(self):
"""
Test case for list_worm_domains
"""
pass
def test_update_worm_domain(self):
"""
Test case for update_worm_domain
"""
pass
def test_update_worm_settings(self):
"""
Test case for update_worm_settings
"""
pass
if __name__ == '__main__':
unittest.main() | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
15945,
29908,
13,
11882,
1266,
29871,
29906,
29900,
29896,
29953,
4116,
442,
29933,
799,
18540,
13,
13,
259,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
259,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
259,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
259,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
259,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
259,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
259,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
259,
27028,
1090,
278,
19245,
29889,
13,
13,
259,
2143,
29901,
2045,
597,
3292,
29889,
510,
29914,
2774,
9921,
29899,
2754,
29914,
2774,
9921,
29899,
401,
1885,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
443,
27958,
13,
13,
5215,
2381,
9921,
29918,
4645,
13,
3166,
2381,
9921,
29918,
4645,
29889,
5060,
1053,
29749,
2451,
13,
3166,
2381,
9921,
29918,
4645,
29889,
11355,
29889,
29893,
555,
29918,
2754,
1053,
399,
555,
11713,
13,
13,
13,
1990,
4321,
29956,
555,
11713,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
9995,
399,
555,
11713,
5190,
1243,
19281,
29879,
9995,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2754,
353,
2381,
9921,
29918,
4645,
29889,
11355,
29889,
29893,
555,
29918,
2754,
29889,
29956,
555,
11713,
580,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
29893,
555,
29918,
7247,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
1653,
29918,
29893,
555,
29918,
7247,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29893,
555,
29918,
7247,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
679,
29918,
29893,
555,
29918,
7247,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29893,
555,
29918,
11027,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
679,
29918,
29893,
555,
29918,
11027,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
1761,
29918,
29893,
555,
29918,
3129,
2708,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
1051,
29918,
29893,
555,
29918,
3129,
2708,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
29893,
555,
29918,
7247,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
2767,
29918,
29893,
555,
29918,
7247,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
29893,
555,
29918,
11027,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
1206,
363,
2767,
29918,
29893,
555,
29918,
11027,
13,
13,
308,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
2
] |
recruiting/migrations/0002_adminresume_bottom_msg.py | NSYT0607/DONGKEY | 1 | 44302 | <filename>recruiting/migrations/0002_adminresume_bottom_msg.py<gh_stars>1-10
# Generated by Django 2.0.1 on 2018-02-15 22:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruiting', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='adminresume',
name='bottom_msg',
field=models.TextField(default='지원해주셔서 감사합니다.'),
),
]
| [
1,
529,
9507,
29958,
3757,
9216,
292,
29914,
26983,
800,
29914,
29900,
29900,
29900,
29906,
29918,
6406,
690,
2017,
29918,
8968,
29918,
7645,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
3251,
630,
491,
15337,
29871,
29906,
29889,
29900,
29889,
29896,
373,
29871,
29906,
29900,
29896,
29947,
29899,
29900,
29906,
29899,
29896,
29945,
29871,
29906,
29906,
29901,
29906,
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,
3757,
9216,
292,
742,
525,
29900,
29900,
29900,
29896,
29918,
11228,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2528,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
6406,
690,
2017,
742,
13,
9651,
1024,
2433,
8968,
29918,
7645,
742,
13,
9651,
1746,
29922,
9794,
29889,
15778,
29898,
4381,
2433,
30811,
31198,
31435,
30981,
239,
136,
151,
31093,
29871,
237,
179,
147,
30791,
31980,
31063,
30709,
29889,
5477,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
software/supervisor/views/ErrorView.py | ghsecuritylab/project-powerline | 0 | 1615868 | from PyQt5.QtWidgets import QWidget, QPushButton, QLabel
from PyQt5.QtGui import QFont
import time
class ErrorView(QWidget):
def __init__(self, parent):
super(ErrorView, self).__init__(parent)
font = QFont("Arial", 10)
font_title = QFont()
font.setBold(1)
self.error_lb = QLabel("Modulfehler", self)
self.error_lb.setFont(QFont("bold", 20))
self.error_lb.move(70, 0)
self.modul_nr_title_lb = QLabel('Modulnummer: \n' + str(hex(0)) + '\n' + time.strftime('%d-%m-%Y %H:%M'), self)
self.modul_nr_title_lb.move(0, 50)
self.modul_nr_title_lb.setFont(font)
self.modul_nr_lb = QLabel(self)
self.modul_nr_lb.move(120, 150)
self.hist_bt = QPushButton("Verlauf", self)
self.hist_bt.resize(140, 50)
self.hist_bt.move(0, 160)
self.hist_bt.clicked.connect(self.parent().show_history_view)
self.ok_bt = QPushButton("OK", self)
self.ok_bt.clicked.connect(self.parent().show_home_view)
self.ok_bt.resize(140, 50)
self.ok_bt.move(150, 160)
def set_serial_number(self, serial_number):
t = time.strftime('%d-%m-%Y %H:%M')
self.modul_nr_title_lb.setText('Modulnummer: \n' + str(hex(serial_number)) + '\n' + t)
self.parent().parent().history_view.add_new_fault(serial_number, t)
| [
1,
515,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
8801,
29892,
660,
27031,
3125,
29892,
660,
4775,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
660,
9824,
13,
5215,
931,
13,
13,
13,
1990,
4829,
1043,
29898,
29984,
8801,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3847,
1125,
13,
4706,
2428,
29898,
2392,
1043,
29892,
1583,
467,
1649,
2344,
12035,
3560,
29897,
13,
13,
4706,
4079,
353,
660,
9824,
703,
29909,
9315,
613,
29871,
29896,
29900,
29897,
13,
4706,
4079,
29918,
3257,
353,
660,
9824,
580,
13,
4706,
4079,
29889,
842,
29933,
1025,
29898,
29896,
29897,
13,
13,
4706,
1583,
29889,
2704,
29918,
27728,
353,
660,
4775,
703,
2111,
352,
1725,
29882,
1358,
613,
1583,
29897,
13,
4706,
1583,
29889,
2704,
29918,
27728,
29889,
842,
9824,
29898,
29984,
9824,
703,
8934,
613,
29871,
29906,
29900,
876,
13,
4706,
1583,
29889,
2704,
29918,
27728,
29889,
11631,
29898,
29955,
29900,
29892,
29871,
29900,
29897,
13,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
3257,
29918,
27728,
353,
660,
4775,
877,
2111,
352,
1949,
1050,
29901,
320,
29876,
29915,
718,
851,
29898,
20970,
29898,
29900,
876,
718,
11297,
29876,
29915,
718,
931,
29889,
710,
615,
603,
877,
29995,
29881,
19222,
29885,
19222,
29979,
1273,
29950,
16664,
29924,
5477,
1583,
29897,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
3257,
29918,
27728,
29889,
11631,
29898,
29900,
29892,
29871,
29945,
29900,
29897,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
3257,
29918,
27728,
29889,
842,
9824,
29898,
5657,
29897,
13,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
27728,
353,
660,
4775,
29898,
1311,
29897,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
27728,
29889,
11631,
29898,
29896,
29906,
29900,
29892,
29871,
29896,
29945,
29900,
29897,
13,
13,
4706,
1583,
29889,
29882,
391,
29918,
3116,
353,
660,
27031,
3125,
703,
6565,
14844,
613,
1583,
29897,
13,
4706,
1583,
29889,
29882,
391,
29918,
3116,
29889,
21476,
29898,
29896,
29946,
29900,
29892,
29871,
29945,
29900,
29897,
13,
4706,
1583,
29889,
29882,
391,
29918,
3116,
29889,
11631,
29898,
29900,
29892,
29871,
29896,
29953,
29900,
29897,
13,
4706,
1583,
29889,
29882,
391,
29918,
3116,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
3560,
2141,
4294,
29918,
18434,
29918,
1493,
29897,
13,
13,
4706,
1583,
29889,
554,
29918,
3116,
353,
660,
27031,
3125,
703,
8949,
613,
1583,
29897,
13,
4706,
1583,
29889,
554,
29918,
3116,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
3560,
2141,
4294,
29918,
5184,
29918,
1493,
29897,
13,
4706,
1583,
29889,
554,
29918,
3116,
29889,
21476,
29898,
29896,
29946,
29900,
29892,
29871,
29945,
29900,
29897,
13,
4706,
1583,
29889,
554,
29918,
3116,
29889,
11631,
29898,
29896,
29945,
29900,
29892,
29871,
29896,
29953,
29900,
29897,
13,
13,
1678,
822,
731,
29918,
15550,
29918,
4537,
29898,
1311,
29892,
7797,
29918,
4537,
1125,
13,
4706,
260,
353,
931,
29889,
710,
615,
603,
877,
29995,
29881,
19222,
29885,
19222,
29979,
1273,
29950,
16664,
29924,
1495,
13,
4706,
1583,
29889,
1545,
352,
29918,
22230,
29918,
3257,
29918,
27728,
29889,
12038,
877,
2111,
352,
1949,
1050,
29901,
320,
29876,
29915,
718,
851,
29898,
20970,
29898,
15550,
29918,
4537,
876,
718,
11297,
29876,
29915,
718,
260,
29897,
13,
4706,
1583,
29889,
3560,
2141,
3560,
2141,
18434,
29918,
1493,
29889,
1202,
29918,
1482,
29918,
27934,
29898,
15550,
29918,
4537,
29892,
260,
29897,
13,
2
] |
servidor/delivery/views.py | Mendw/delivery | 0 | 72208 | <filename>servidor/delivery/views.py
# pylint: disable=no-member
from delivery.models import *
from delivery.serializers import *
from django.contrib.auth.forms import UserCreationForm
from django.utils.http import urlsafe_base64_decode
from django.utils.encoding import force_text
from django.contrib.auth import login
from rest_framework.settings import api_settings
from rest_framework.response import Response
from rest_framework import generics
from rest_framework import status
from django.shortcuts import render, redirect
class Registration(generics.CreateAPIView):
queryset = User.objects.all()
serializer_class = UserRegistrationSerializer
def post(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
user = serializer.save()
user.email_user('Activate your -El Menu- account', render_to_string(
'confirmation-email.html', {
'user': user,
'domain': get_current_site(request).domain,
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
'token': account_activation_token.make_token(user),
}
))
headers = self.get_success_headers(serializer.data)
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
def get_success_headers(self, data):
try:
return {'Location': str(data[api_settings.URL_FIELD_NAME])}
except (TypeError, KeyError):
return {}
def activate(request, uidb64, token):
try:
uid = force_text(urlsafe_base64_decode(uidb64))
user = User.objects.get(pk=uid)
except (TypeError, ValueError, OverflowError, User.DoesNotExist):
user = None
if user is not None and account_activation_token.check_token(user, token):
user.is_active = True
user.is_email_verified = True
user.save()
login(request, user)
return redirect('home')
else:
return render(request, 'account_activation_invalid.html')
class UserList(generics.ListAPIView):
queryset = User.objects.all()
serializer_class = UserOverviewSerializer
class UserDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer
# ========================================= #
class ZoneList(generics.ListCreateAPIView):
queryset = Zone.objects.all()
serializer_class = ZoneSerializer
class ZoneDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Zone.objects.all()
serializer_class = ZoneSerializer
# ========================================= #
class CharacteristicList(generics.ListCreateAPIView):
queryset = Characteristic.objects.all()
serializer_class = CharacteristicSerializer
class CharacteristicDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Characteristic.objects.all()
serializer_class = CharacteristicSerializer
# ========================================= #
class DeliveryList(generics.ListCreateAPIView):
queryset = Delivery.objects.all()
serializer_class = DeliverySerializer
class DeliveryDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Delivery.objects.all()
serializer_class = DeliverySerializer
# ========================================= #
class StoreList(generics.ListCreateAPIView):
queryset = Store.objects.all()
serializer_class = StoreSerializer
class StoreDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Store.objects.all()
serializer_class = StoreSerializer
# ========================================= #
class DeliveryPersonList(generics.ListCreateAPIView):
queryset = DeliveryPerson.objects.all()
serializer_class = DeliveryPersonSerializer
class DeliveryPersonDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = DeliveryPerson.objects.all()
serializer_class = DeliveryPersonSerializer
# ========================================= #
class NoteList(generics.ListCreateAPIView):
queryset = Note.objects.all()
serializer_class = NoteSerializer
class NoteDetails(generics.RetrieveUpdateDestroyAPIView):
queryset = Note.objects.all()
serializer_class = NoteSerializer
| [
1,
529,
9507,
29958,
2140,
23377,
29914,
29881,
27657,
29914,
7406,
29889,
2272,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
1217,
29899,
14242,
13,
13,
3166,
28289,
29889,
9794,
1053,
334,
13,
3166,
28289,
29889,
15550,
19427,
1053,
334,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9514,
1053,
4911,
9832,
362,
2500,
13,
3166,
9557,
29889,
13239,
29889,
1124,
1053,
3142,
11177,
29918,
3188,
29953,
29946,
29918,
13808,
13,
3166,
9557,
29889,
13239,
29889,
22331,
1053,
4889,
29918,
726,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
6464,
13,
13,
3166,
1791,
29918,
4468,
29889,
11027,
1053,
7882,
29918,
11027,
13,
3166,
1791,
29918,
4468,
29889,
5327,
1053,
13291,
13,
3166,
1791,
29918,
4468,
1053,
1176,
1199,
13,
3166,
1791,
29918,
4468,
1053,
4660,
13,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
29892,
6684,
13,
13,
13,
1990,
2169,
8306,
29898,
4738,
1199,
29889,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
4911,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
4911,
4597,
8306,
17679,
13,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
7797,
3950,
353,
1583,
29889,
657,
29918,
15550,
3950,
29898,
1272,
29922,
3827,
29889,
1272,
29897,
13,
4706,
7797,
3950,
29889,
275,
29918,
3084,
29898,
22692,
29918,
11739,
29922,
5574,
29897,
13,
4706,
1404,
353,
7797,
3950,
29889,
7620,
580,
13,
13,
4706,
1404,
29889,
5269,
29918,
1792,
877,
21786,
403,
596,
448,
6489,
20019,
29899,
3633,
742,
4050,
29918,
517,
29918,
1807,
29898,
13,
9651,
525,
26897,
362,
29899,
5269,
29889,
1420,
742,
426,
13,
18884,
525,
1792,
2396,
1404,
29892,
13,
18884,
525,
7247,
2396,
679,
29918,
3784,
29918,
2746,
29898,
3827,
467,
7247,
29892,
13,
18884,
525,
5416,
2396,
3142,
11177,
29918,
3188,
29953,
29946,
29918,
12508,
29898,
10118,
29918,
13193,
29898,
1792,
29889,
20571,
8243,
13,
18884,
525,
6979,
2396,
3633,
29918,
11236,
362,
29918,
6979,
29889,
5675,
29918,
6979,
29898,
1792,
511,
13,
9651,
500,
13,
308,
876,
13,
13,
4706,
9066,
353,
1583,
29889,
657,
29918,
8698,
29918,
13662,
29898,
15550,
3950,
29889,
1272,
29897,
13,
4706,
736,
13291,
29898,
15550,
3950,
29889,
1272,
29892,
4660,
29922,
4882,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29892,
9066,
29922,
13662,
29897,
13,
13,
1678,
822,
679,
29918,
8698,
29918,
13662,
29898,
1311,
29892,
848,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
11117,
6508,
2396,
851,
29898,
1272,
29961,
2754,
29918,
11027,
29889,
4219,
29918,
3738,
27286,
29918,
5813,
2314,
29913,
13,
4706,
5174,
313,
1542,
2392,
29892,
7670,
2392,
1125,
13,
9651,
736,
6571,
13,
13,
13,
1753,
5039,
403,
29898,
3827,
29892,
318,
333,
29890,
29953,
29946,
29892,
5993,
1125,
13,
1678,
1018,
29901,
13,
4706,
318,
333,
353,
4889,
29918,
726,
29898,
2271,
11177,
29918,
3188,
29953,
29946,
29918,
13808,
29898,
5416,
29890,
29953,
29946,
876,
13,
4706,
1404,
353,
4911,
29889,
12650,
29889,
657,
29898,
20571,
29922,
5416,
29897,
13,
1678,
5174,
313,
1542,
2392,
29892,
7865,
2392,
29892,
28845,
2392,
29892,
4911,
29889,
25125,
3664,
1252,
391,
1125,
13,
4706,
1404,
353,
6213,
13,
13,
1678,
565,
1404,
338,
451,
6213,
322,
3633,
29918,
11236,
362,
29918,
6979,
29889,
3198,
29918,
6979,
29898,
1792,
29892,
5993,
1125,
13,
4706,
1404,
29889,
275,
29918,
4925,
353,
5852,
13,
4706,
1404,
29889,
275,
29918,
5269,
29918,
369,
2164,
353,
5852,
13,
4706,
1404,
29889,
7620,
580,
13,
4706,
6464,
29898,
3827,
29892,
1404,
29897,
13,
4706,
736,
6684,
877,
5184,
1495,
13,
1678,
1683,
29901,
13,
4706,
736,
4050,
29898,
3827,
29892,
525,
10149,
29918,
11236,
362,
29918,
20965,
29889,
1420,
1495,
13,
13,
13,
1990,
4911,
1293,
29898,
4738,
1199,
29889,
1293,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
4911,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
4911,
3563,
1493,
17679,
13,
13,
13,
1990,
4911,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
4911,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
4911,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
24385,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
24385,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
24385,
17679,
13,
13,
13,
1990,
24385,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
24385,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
24385,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
26804,
4695,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
26804,
4695,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
26804,
4695,
17679,
13,
13,
13,
1990,
26804,
4695,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
26804,
4695,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
26804,
4695,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
360,
27657,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
360,
27657,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
360,
27657,
17679,
13,
13,
13,
1990,
360,
27657,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
360,
27657,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
360,
27657,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
14491,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
14491,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
14491,
17679,
13,
13,
13,
1990,
14491,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
14491,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
14491,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
360,
27657,
7435,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
360,
27657,
7435,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
360,
27657,
7435,
17679,
13,
13,
13,
1990,
360,
27657,
7435,
16570,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
360,
27657,
7435,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
360,
27657,
7435,
17679,
13,
29937,
1275,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1990,
3940,
1293,
29898,
4738,
1199,
29889,
1293,
4391,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
3940,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
3940,
17679,
13,
13,
13,
1990,
3940,
10602,
29898,
4738,
1199,
29889,
8015,
29878,
2418,
6422,
14994,
4727,
8787,
1043,
1125,
13,
1678,
2346,
842,
353,
3940,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
3940,
17679,
13,
2
] |
lambda_function.py | sagnikdas98/Monopoly-Master | 2 | 172848 | from monopoly_backend import *
from lambda_stuff import *
board = None
started = False
def lambda_handler(event, context):
if event['request']['type'] == "LaunchRequest":
return on_launch(event, context)
elif event['request']['type'] == "IntentRequest":
return intent_router(event, context,)
def on_launch(event, content,):
return statement("Start", combine_statement(random_statement(ret_launch),random_statement(ask_no_players)))
def intent_router(event, context):
intent = event['request']['intent']['name']
if intent == "AMAZON.YesIntent":
return Yes_Intent(event, context)
if intent == "AMAZON.NoIntent":
return No_Intent(event, context)
if intent == "mortgage":
return statement("Mortgage","You cannot mortgage any property right now.")
if intent == "usejailcards":
return statement("Out Of Jail", board.get_out_card(board.current_player))
if intent == "usejailmoney":
return statement ("Out Of Jail", board.get_out_money(board.current_player))
if intent == "numberOfPlayers":
return numberOfPlayers_intent(event, context)
if intent == "nextplayer":
return nextplayer(event, context)
if intent == "diceroll":
return diceroll_intent(event, context)
if intent == "account_balance":
return accountbalance_intent(event,context)
if intent == "prop_list":
return prop_list_intent(event,context)
if intent == "buy_house":
return statement("Buying House", combine_say_it(board.buy_house(board.current_player)))
if intent == "AMAZON.CancelIntent":
return stop_intent(event, context)
if intent == "AMAZON.HelpIntent":
return help_intent ()
if intent == "AMAZON.StopIntent":
return stop_intent(event, context)
def Yes_Intent(event,context):
global board, started
started = True
if board.question_id == "next_player":
return diceroll_intent(event, context)
if board.question_id == "want_to_buy_prop":
board.bought_prop(board.current_player)
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "want_to_buy_railroad":
board.bought_railroad(board.current_player)
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "want_to_buy_utility":
board.bought_utility(board.current_player)
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "jail_card":
#board.question_id = ""
return statement("Out Of Jail", board.get_out_card(board.current_player))
if board.question_id == "jail_money":
#board.question_id = ""
return statement("Out Of Jail", board.get_out_money(board.current_player))
if board.question_id == "buy_house":
board.bought_house(board.current_player)
board.question_id = "next_player"
return nextplayer(event, context)
return statement("Invalid", random_statement(not_valid))
def No_Intent(event, context):
global board
if board.question_id == "want_to_buy_prop":
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "want_to_buy_railroad":
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "want_to_buy_utility":
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "jail_card":
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "jail_money":
board.question_id = "next_player"
return nextplayer(event, context)
if board.question_id == "":
board.question_id = "next_player"
return nextplayer(event, context)
return statement("Invalid", random_statement(not_valid))
def numberOfPlayers_intent(event, context):
dialog_state = event['request']['dialogState']
global board
if dialog_state in ("STARTED", "IN_PROGRESS"):
return continue_dialog()
elif dialog_state == "COMPLETED":
slots = event['request']['intent']['slots']
number = int(slots['number']['value'])
if number in (2, 3, 4):
board = Board(number)
board.started = True
board.question_id = "next_player"
board.current_player_index = 0
board.current_player = board.playerlist[board.current_player_index]
return statement("Confirm,Set Board", combine_statement(random_statement(confirmation),
format_statement(random_statement(set_board), number),
"Its player one's turn. "))
elif number < 2:
return statement("Alone", combine_statement(random_statement(alone), random_statement(ask_again)))
elif number > 4:
return statement("Too many", combine_statement(random_statement(too_many), random_statement(ask_again)))
else:
return statement("Not valid", combine_statement(random_statement(not_valid), random_statement(ask_again)))
else:
return statement("Number of players", "I need a head count")
def nextplayer(event,context):
global board
board.current_player_index += 1
board.current_player = board.playerlist[board.current_player_index % len (board.playerlist)]
say_curr_player = format_statement(random_statement(next_player_turn),board.current_player.number)
if board.current_player.jailtime > 0:
ret_sat = board.jail_check(board.current_player)
return statement("In jail ", combine_statement(say_curr_player,ret_sat))
return statement("Current player", say_curr_player)
def diceroll_intent(event, context):
rN1 = random.randint(1, 6)
rN2 = random.randint(1, 6)
return statement ("Roll Dice", combine_statement(
format_statement_2(random_statement(you_have_rolled),rN1,rN2), combine_say_it(board.playermove(board.current_player, rN1 + rN2))))
def accountbalance_intent(event,context):
acc_bal = board.current_player.money
return statement("Balance", format_statement(random_statement(current_balance),acc_bal))
def prop_list_intent(event, context):
say_list = []
for color in board.current_player.proplist:
for prop in color:
say_list.append(prop.name)
for rail in board.current_player.raillist:
say_list.append(rail.name)
for ut in board.current_player.utlist:
say_list.append(ut.name)
return statement("Property List", combine_say_it(say_list))
def stop_intent(event, context):
say_it = []
if started == True :
net_worth = 0
max_net_worth = 0
player_worth = 0
for player_net_worth in board.playerlist:
for color in player_net_worth.proplist:
for prop in color:
net_worth += prop.cost
for rail in player_net_worth.raillist:
net_worth += rail.cost
for ut in player_net_worth.utlist:
net_worth += ut.cost
net_worth += player_net_worth.money
if net_worth >= max_net_worth:
max_net_worth = net_worth
player_worth = player_net_worth.number
net_worth = 0
say_it.append(format_statement(random_statement(win),player_worth))
say_it.append(random_statement(finish))
return statement_stop("Finish", combine_say_it(say_it))
else:
say_it.append (random_statement (finish_no_start))
say_it.append (random_statement (finish))
return statement_stop("Finish", combine_say_it(say_it)) | [
1,
515,
1601,
13242,
29891,
29918,
27852,
1053,
334,
13,
3166,
14013,
29918,
303,
3096,
1053,
334,
13,
13,
3377,
353,
6213,
13,
2962,
287,
353,
7700,
13,
13,
1753,
14013,
29918,
13789,
29898,
3696,
29892,
3030,
1125,
13,
13,
1678,
565,
1741,
1839,
3827,
16215,
1853,
2033,
1275,
376,
17641,
3089,
1115,
13,
4706,
736,
373,
29918,
15343,
29898,
3696,
29892,
3030,
29897,
13,
1678,
25342,
1741,
1839,
3827,
16215,
1853,
2033,
1275,
376,
10286,
3089,
1115,
13,
4706,
736,
7609,
29918,
15140,
29898,
3696,
29892,
3030,
29892,
29897,
13,
13,
13,
1753,
373,
29918,
15343,
29898,
3696,
29892,
2793,
29892,
1125,
13,
1678,
736,
3229,
703,
4763,
613,
14405,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
2267,
29918,
15343,
511,
8172,
29918,
20788,
29898,
1278,
29918,
1217,
29918,
1456,
414,
4961,
13,
13,
13,
1753,
7609,
29918,
15140,
29898,
3696,
29892,
3030,
1125,
13,
1678,
7609,
353,
1741,
1839,
3827,
16215,
14029,
16215,
978,
2033,
13,
13,
1678,
565,
7609,
1275,
376,
29909,
1529,
29999,
1164,
29889,
8241,
10286,
1115,
13,
4706,
736,
3869,
29918,
10286,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
29909,
1529,
29999,
1164,
29889,
3782,
10286,
1115,
13,
4706,
736,
1939,
29918,
10286,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
29720,
29887,
482,
1115,
13,
4706,
736,
3229,
703,
29924,
441,
29887,
482,
3284,
3492,
2609,
5758,
29887,
482,
738,
2875,
1492,
1286,
23157,
13,
13,
1678,
565,
7609,
1275,
376,
1509,
29926,
737,
28160,
1115,
13,
4706,
736,
3229,
703,
3744,
4587,
435,
737,
613,
7613,
29889,
657,
29918,
449,
29918,
7543,
29898,
3377,
29889,
3784,
29918,
9106,
876,
13,
13,
1678,
565,
7609,
1275,
376,
1509,
29926,
737,
29885,
4992,
1115,
13,
4706,
736,
3229,
4852,
3744,
4587,
435,
737,
613,
7613,
29889,
657,
29918,
449,
29918,
29885,
4992,
29898,
3377,
29889,
3784,
29918,
9106,
876,
13,
13,
1678,
565,
7609,
1275,
376,
4537,
2776,
13454,
414,
1115,
13,
4706,
736,
1353,
2776,
13454,
414,
29918,
14029,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
4622,
9106,
1115,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
27774,
261,
3028,
1115,
13,
4706,
736,
12124,
261,
3028,
29918,
14029,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
10149,
29918,
5521,
749,
1115,
13,
4706,
736,
3633,
5521,
749,
29918,
14029,
29898,
3696,
29892,
4703,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
7728,
29918,
1761,
1115,
13,
4706,
736,
3107,
29918,
1761,
29918,
14029,
29898,
3696,
29892,
4703,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
2423,
29891,
29918,
8697,
1115,
13,
4706,
736,
3229,
703,
3727,
5414,
5619,
613,
14405,
29918,
20834,
29918,
277,
29898,
3377,
29889,
2423,
29891,
29918,
8697,
29898,
3377,
29889,
3784,
29918,
9106,
4961,
13,
13,
1678,
565,
7609,
1275,
376,
29909,
1529,
29999,
1164,
29889,
19420,
10286,
1115,
13,
4706,
736,
5040,
29918,
14029,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7609,
1275,
376,
29909,
1529,
29999,
1164,
29889,
29648,
10286,
1115,
13,
4706,
736,
1371,
29918,
14029,
3861,
13,
13,
1678,
565,
7609,
1275,
376,
29909,
1529,
29999,
1164,
29889,
16329,
10286,
1115,
13,
4706,
736,
5040,
29918,
14029,
29898,
3696,
29892,
3030,
29897,
13,
13,
13,
1753,
3869,
29918,
10286,
29898,
3696,
29892,
4703,
1125,
13,
13,
1678,
5534,
7613,
29892,
4687,
13,
1678,
4687,
353,
5852,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
4622,
29918,
9106,
1115,
13,
4706,
736,
12124,
261,
3028,
29918,
14029,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
7728,
1115,
13,
4706,
7613,
29889,
29890,
1774,
29918,
7728,
29898,
3377,
29889,
3784,
29918,
9106,
29897,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
336,
309,
9972,
1115,
13,
4706,
7613,
29889,
29890,
1774,
29918,
336,
309,
9972,
29898,
3377,
29889,
3784,
29918,
9106,
29897,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
329,
1793,
1115,
13,
4706,
7613,
29889,
29890,
1774,
29918,
329,
1793,
29898,
3377,
29889,
3784,
29918,
9106,
29897,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29926,
737,
29918,
7543,
1115,
13,
4706,
396,
3377,
29889,
12470,
29918,
333,
353,
5124,
13,
4706,
736,
3229,
703,
3744,
4587,
435,
737,
613,
7613,
29889,
657,
29918,
449,
29918,
7543,
29898,
3377,
29889,
3784,
29918,
9106,
876,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29926,
737,
29918,
29885,
4992,
1115,
13,
4706,
396,
3377,
29889,
12470,
29918,
333,
353,
5124,
13,
4706,
736,
3229,
703,
3744,
4587,
435,
737,
613,
7613,
29889,
657,
29918,
449,
29918,
29885,
4992,
29898,
3377,
29889,
3784,
29918,
9106,
876,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
2423,
29891,
29918,
8697,
1115,
13,
4706,
7613,
29889,
29890,
1774,
29918,
8697,
29898,
3377,
29889,
3784,
29918,
9106,
29897,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
736,
3229,
703,
13919,
613,
4036,
29918,
20788,
29898,
1333,
29918,
3084,
876,
13,
13,
13,
1753,
1939,
29918,
10286,
29898,
3696,
29892,
3030,
1125,
13,
13,
1678,
5534,
7613,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
7728,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
336,
309,
9972,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29893,
424,
29918,
517,
29918,
2423,
29891,
29918,
329,
1793,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29926,
737,
29918,
7543,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
29926,
737,
29918,
29885,
4992,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
565,
7613,
29889,
12470,
29918,
333,
1275,
376,
1115,
13,
4706,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
4706,
736,
2446,
9106,
29898,
3696,
29892,
3030,
29897,
13,
13,
1678,
736,
3229,
703,
13919,
613,
4036,
29918,
20788,
29898,
1333,
29918,
3084,
876,
13,
13,
13,
1753,
1353,
2776,
13454,
414,
29918,
14029,
29898,
3696,
29892,
3030,
1125,
13,
1678,
7928,
29918,
3859,
353,
1741,
1839,
3827,
16215,
15901,
2792,
2033,
13,
1678,
5534,
7613,
13,
13,
1678,
565,
7928,
29918,
3859,
297,
4852,
25826,
3352,
613,
376,
1177,
29918,
8618,
29954,
26785,
29908,
1125,
13,
4706,
736,
6773,
29918,
15901,
580,
13,
13,
1678,
25342,
7928,
29918,
3859,
1275,
376,
21514,
1307,
29911,
3352,
1115,
13,
4706,
2243,
1862,
353,
1741,
1839,
3827,
16215,
14029,
16215,
2536,
1862,
2033,
13,
4706,
1353,
353,
938,
29898,
2536,
1862,
1839,
4537,
16215,
1767,
11287,
13,
13,
4706,
565,
1353,
297,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
1125,
13,
13,
9651,
7613,
353,
12590,
29898,
4537,
29897,
13,
9651,
7613,
29889,
2962,
287,
353,
5852,
13,
9651,
7613,
29889,
12470,
29918,
333,
353,
376,
4622,
29918,
9106,
29908,
13,
9651,
7613,
29889,
3784,
29918,
9106,
29918,
2248,
353,
29871,
29900,
13,
9651,
7613,
29889,
3784,
29918,
9106,
353,
7613,
29889,
9106,
1761,
29961,
3377,
29889,
3784,
29918,
9106,
29918,
2248,
29962,
13,
9651,
736,
3229,
703,
16376,
3568,
29892,
2697,
12590,
613,
14405,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
26897,
362,
511,
13,
462,
462,
462,
462,
1678,
3402,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
842,
29918,
3377,
511,
1353,
511,
13,
462,
462,
462,
462,
1678,
376,
29902,
1372,
4847,
697,
29915,
29879,
2507,
29889,
376,
876,
13,
13,
4706,
25342,
1353,
529,
29871,
29906,
29901,
13,
9651,
736,
3229,
703,
2499,
650,
613,
14405,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
18785,
511,
4036,
29918,
20788,
29898,
1278,
29918,
351,
475,
4961,
13,
13,
4706,
25342,
1353,
1405,
29871,
29946,
29901,
13,
9651,
736,
3229,
703,
1762,
29877,
1784,
613,
14405,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
517,
29877,
29918,
13011,
511,
4036,
29918,
20788,
29898,
1278,
29918,
351,
475,
4961,
13,
13,
4706,
1683,
29901,
13,
9651,
736,
3229,
703,
3664,
2854,
613,
14405,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
1333,
29918,
3084,
511,
4036,
29918,
20788,
29898,
1278,
29918,
351,
475,
4961,
13,
13,
1678,
1683,
29901,
13,
4706,
736,
3229,
703,
4557,
310,
10769,
613,
376,
29902,
817,
263,
2343,
2302,
1159,
13,
13,
13,
1753,
2446,
9106,
29898,
3696,
29892,
4703,
1125,
13,
13,
1678,
5534,
29871,
7613,
13,
13,
1678,
7613,
29889,
3784,
29918,
9106,
29918,
2248,
4619,
29871,
29896,
13,
1678,
7613,
29889,
3784,
29918,
9106,
353,
7613,
29889,
9106,
1761,
29961,
3377,
29889,
3784,
29918,
9106,
29918,
2248,
1273,
7431,
313,
3377,
29889,
9106,
1761,
4638,
13,
1678,
1827,
29918,
21962,
29918,
9106,
353,
3402,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
4622,
29918,
9106,
29918,
685,
511,
3377,
29889,
3784,
29918,
9106,
29889,
4537,
29897,
13,
1678,
565,
7613,
29889,
3784,
29918,
9106,
29889,
29926,
737,
2230,
1405,
29871,
29900,
29901,
13,
4706,
3240,
29918,
29879,
271,
353,
7613,
29889,
29926,
737,
29918,
3198,
29898,
3377,
29889,
3784,
29918,
9106,
29897,
13,
4706,
736,
3229,
703,
797,
432,
737,
9162,
14405,
29918,
20788,
29898,
20834,
29918,
21962,
29918,
9106,
29892,
2267,
29918,
29879,
271,
876,
13,
1678,
736,
3229,
703,
7583,
4847,
613,
1827,
29918,
21962,
29918,
9106,
29897,
13,
13,
13,
1753,
12124,
261,
3028,
29918,
14029,
29898,
3696,
29892,
3030,
1125,
13,
13,
1678,
364,
29940,
29896,
353,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29953,
29897,
13,
1678,
364,
29940,
29906,
353,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29953,
29897,
13,
1678,
736,
3229,
4852,
29934,
3028,
360,
625,
613,
14405,
29918,
20788,
29898,
13,
4706,
3402,
29918,
20788,
29918,
29906,
29898,
8172,
29918,
20788,
29898,
6293,
29918,
17532,
29918,
24476,
511,
29878,
29940,
29896,
29892,
29878,
29940,
29906,
511,
14405,
29918,
20834,
29918,
277,
29898,
3377,
29889,
1456,
837,
994,
29898,
3377,
29889,
3784,
29918,
9106,
29892,
364,
29940,
29896,
718,
364,
29940,
29906,
13697,
13,
13,
13,
1753,
3633,
5521,
749,
29918,
14029,
29898,
3696,
29892,
4703,
1125,
13,
1678,
1035,
29918,
5521,
353,
7613,
29889,
3784,
29918,
9106,
29889,
29885,
4992,
13,
1678,
736,
3229,
703,
22031,
749,
613,
3402,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
3784,
29918,
5521,
749,
511,
5753,
29918,
5521,
876,
13,
13,
13,
1753,
3107,
29918,
1761,
29918,
14029,
29898,
3696,
29892,
3030,
1125,
13,
13,
1678,
1827,
29918,
1761,
353,
5159,
13,
13,
1678,
363,
2927,
297,
7613,
29889,
3784,
29918,
9106,
29889,
771,
572,
391,
29901,
13,
4706,
363,
3107,
297,
2927,
29901,
13,
9651,
1827,
29918,
1761,
29889,
4397,
29898,
7728,
29889,
978,
29897,
13,
1678,
363,
8367,
297,
7613,
29889,
3784,
29918,
9106,
29889,
336,
453,
391,
29901,
13,
4706,
1827,
29918,
1761,
29889,
4397,
29898,
336,
309,
29889,
978,
29897,
13,
1678,
363,
3477,
297,
7613,
29889,
3784,
29918,
9106,
29889,
329,
1761,
29901,
13,
4706,
1827,
29918,
1761,
29889,
4397,
29898,
329,
29889,
978,
29897,
13,
1678,
736,
3229,
703,
4854,
2391,
613,
14405,
29918,
20834,
29918,
277,
29898,
20834,
29918,
1761,
876,
13,
13,
13,
1753,
5040,
29918,
14029,
29898,
3696,
29892,
3030,
1125,
13,
1678,
1827,
29918,
277,
353,
5159,
13,
1678,
565,
4687,
1275,
5852,
584,
13,
13,
13,
4706,
7787,
29918,
12554,
353,
29871,
29900,
13,
4706,
4236,
29918,
1212,
29918,
12554,
353,
29871,
29900,
13,
4706,
4847,
29918,
12554,
353,
29871,
29900,
13,
13,
4706,
363,
4847,
29918,
1212,
29918,
12554,
297,
7613,
29889,
9106,
1761,
29901,
13,
9651,
363,
2927,
297,
4847,
29918,
1212,
29918,
12554,
29889,
771,
572,
391,
29901,
13,
18884,
363,
3107,
297,
2927,
29901,
13,
462,
1678,
7787,
29918,
12554,
4619,
3107,
29889,
18253,
13,
9651,
363,
8367,
297,
4847,
29918,
1212,
29918,
12554,
29889,
336,
453,
391,
29901,
13,
18884,
7787,
29918,
12554,
4619,
8367,
29889,
18253,
13,
9651,
363,
3477,
297,
4847,
29918,
1212,
29918,
12554,
29889,
329,
1761,
29901,
13,
18884,
7787,
29918,
12554,
4619,
3477,
29889,
18253,
13,
9651,
7787,
29918,
12554,
4619,
4847,
29918,
1212,
29918,
12554,
29889,
29885,
4992,
13,
9651,
565,
7787,
29918,
12554,
6736,
4236,
29918,
1212,
29918,
12554,
29901,
13,
18884,
4236,
29918,
1212,
29918,
12554,
353,
7787,
29918,
12554,
13,
18884,
4847,
29918,
12554,
353,
4847,
29918,
1212,
29918,
12554,
29889,
4537,
13,
9651,
7787,
29918,
12554,
353,
29871,
29900,
13,
13,
4706,
1827,
29918,
277,
29889,
4397,
29898,
4830,
29918,
20788,
29898,
8172,
29918,
20788,
29898,
5080,
511,
9106,
29918,
12554,
876,
13,
4706,
1827,
29918,
277,
29889,
4397,
29898,
8172,
29918,
20788,
29898,
4951,
728,
876,
13,
13,
4706,
736,
3229,
29918,
9847,
703,
12881,
728,
613,
14405,
29918,
20834,
29918,
277,
29898,
20834,
29918,
277,
876,
13,
1678,
1683,
29901,
13,
4706,
1827,
29918,
277,
29889,
4397,
313,
8172,
29918,
20788,
313,
4951,
728,
29918,
1217,
29918,
2962,
876,
13,
4706,
1827,
29918,
277,
29889,
4397,
313,
8172,
29918,
20788,
313,
4951,
728,
876,
13,
4706,
736,
3229,
29918,
9847,
703,
12881,
728,
613,
14405,
29918,
20834,
29918,
277,
29898,
20834,
29918,
277,
876,
2
] |
tests/test_joints.py | slaclab/pystand | 0 | 13532 | ############
# Standard #
############
import math
###############
# Third Party #
###############
import ophyd
import pytest
##########
# Module #
##########
from detrot import ConeJoint, AngledJoint, StandPoint, Point
from conftest import PseudoMotor
@pytest.fixture(scope='function')
def pseudo_cone():
angled = ConeJoint(slide = PseudoMotor(5),
lift = PseudoMotor(10),
offset = Point(1,2,3))
return angled
@pytest.fixture(scope='function')
def pseudo_angle():
angled = AngledJoint(slide = PseudoMotor(5),
lift = PseudoMotor(10),
offset = Point(1,2,3))
return angled
def test_cone_joint(pseudo_cone):
#Test Vertical
pseudo_cone.alpha = math.pi/2.
assert pytest.approx(pseudo_cone.joint.x) == 5
assert pytest.approx(pseudo_cone.joint.y) == 10
#Test Horizontal
pseudo_cone.alpha= 0
assert pseudo_cone.joint.x == 15
assert pseudo_cone.joint.y == 0
def test_cone_invert(pseudo_cone):
#Test 45
pseudo_cone.alpha = math.pi/4.
assert pseudo_cone.invert((13.07,9.07))[0] == pytest.approx(5,0.1)
assert pseudo_cone.invert((13.07,9.07))[1] == pytest.approx(10,0.1)
def test_angle_joint(pseudo_angle):
#Test Vertical
pseudo_angle.alpha = math.pi/2.
assert pytest.approx(pseudo_angle.joint.x) == 5
assert pytest.approx(pseudo_angle.joint.y) == 10
assert pytest.approx(pseudo_angle.joint.z) == 0
#Test Horizontal
pseudo_angle.alpha = 0
assert pytest.approx(pseudo_angle.joint.x) == 5
assert pytest.approx(pseudo_angle.joint.y) == 0
assert pytest.approx(pseudo_angle.joint.z) == 10
#Test no-slide
pseudo_angle.slide = None
assert pytest.approx(pseudo_angle.joint.x) == 0
assert pytest.approx(pseudo_angle.joint.y) == 0
assert pytest.approx(pseudo_angle.joint.z) == 10
def test_angle_invert(pseudo_angle):
#Test Vertical
pseudo_angle.alpha = math.pi/2.
assert pseudo_angle.invert((6,12))[0] == pytest.approx(5,0.1)
assert pseudo_angle.invert((6,12))[1] == pytest.approx(10,0.1)
#Test no-slide
pseudo_angle.slide = None
assert pseudo_angle.invert((6,12)) == pytest.approx(10,0.1)
def test_position(pseudo_cone):
pseudo_cone.alpha= 0
assert pseudo_cone.position == (16, 2, 3)
pseudo_cone.alpha = math.pi/2.
assert pseudo_cone.position.x == pytest.approx(6,0.1)
assert pseudo_cone.position.y == 12
assert pseudo_cone.position.z == 3
def test_displacement(pseudo_angle):
assert pseudo_angle.displacement == (5,10)
pseudo_angle.slide = None
assert pseudo_angle.displacement == 10
def test_set_joint(pseudo_angle):
#Vertical
pseudo_angle.alpha = math.pi/2.
pseudo_angle.set_joint((6,12))
assert pseudo_angle.displacement[0] == pytest.approx(5,0.1)
assert pseudo_angle.displacement[1] == pytest.approx(10,0.1)
#Test no-slide
pseudo_angle.slide = None
pseudo_angle.set_joint((6,12))
assert pseudo_angle.displacement == pytest.approx(10,0.1)
def test_model(pseudo_angle, pseudo_cone):
model = AngledJoint.model(pseudo_angle)
assert isinstance(model.slide, ophyd.SoftPositioner)
assert isinstance(model.lift, ophyd.SoftPositioner)
assert model.displacement == pseudo_angle.displacement
#Test no slide
pseudo_angle.slide = None
model = AngledJoint.model(pseudo_angle)
assert model.slide == None
assert isinstance(model.lift, ophyd.SoftPositioner)
assert model.displacement == pseudo_angle.displacement
#Test cone
model = ConeJoint.model(pseudo_cone)
assert isinstance(model.slide, ophyd.SoftPositioner)
assert isinstance(model.lift, ophyd.SoftPositioner)
assert model.displacement == pseudo_cone.displacement
def test_stop(pseudo_cone):
pseudo_cone.stop()
pseudo_cone.slide.stop_call.method.assert_called_with()
pseudo_cone.lift.stop_call.method.assert_called_with()
def test_cmp():
p1 = PseudoMotor(5)
p2 = PseudoMotor(10)
assert AngledJoint(p1,p2) == AngledJoint(p1, p2)
| [
1,
835,
7346,
29937,
13,
29937,
10117,
396,
13,
7346,
4136,
13,
5215,
5844,
13,
13,
7346,
4136,
2277,
29937,
13,
29937,
18008,
9173,
396,
13,
7346,
4136,
2277,
29937,
13,
5215,
288,
561,
2941,
13,
5215,
11451,
1688,
13,
13,
7346,
2277,
13,
29937,
15591,
396,
13,
7346,
2277,
13,
3166,
1439,
5450,
29871,
1053,
315,
650,
29967,
2461,
29892,
3218,
839,
29967,
2461,
29892,
6679,
5228,
29892,
8984,
13,
3166,
378,
615,
342,
1053,
17646,
5333,
29924,
327,
272,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
6078,
2433,
2220,
1495,
13,
1753,
17381,
29918,
535,
29872,
7295,
13,
1678,
2614,
839,
353,
315,
650,
29967,
2461,
29898,
19265,
29871,
353,
17646,
5333,
29924,
327,
272,
29898,
29945,
511,
13,
462,
539,
13777,
259,
353,
17646,
5333,
29924,
327,
272,
29898,
29896,
29900,
511,
13,
462,
539,
9210,
353,
8984,
29898,
29896,
29892,
29906,
29892,
29941,
876,
13,
1678,
736,
2614,
839,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
6078,
2433,
2220,
1495,
13,
1753,
17381,
29918,
2521,
7295,
13,
1678,
2614,
839,
353,
3218,
839,
29967,
2461,
29898,
19265,
29871,
353,
17646,
5333,
29924,
327,
272,
29898,
29945,
511,
13,
462,
308,
13777,
259,
353,
17646,
5333,
29924,
327,
272,
29898,
29896,
29900,
511,
13,
462,
308,
9210,
353,
8984,
29898,
29896,
29892,
29906,
29892,
29941,
876,
13,
1678,
736,
2614,
839,
13,
13,
1753,
1243,
29918,
535,
29872,
29918,
12090,
29898,
27358,
5333,
29918,
535,
29872,
1125,
13,
1678,
396,
3057,
11198,
936,
29871,
13,
1678,
17381,
29918,
535,
29872,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29906,
29889,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
535,
29872,
29889,
12090,
29889,
29916,
29897,
1275,
29871,
29945,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
535,
29872,
29889,
12090,
29889,
29891,
29897,
1275,
29871,
29896,
29900,
13,
13,
1678,
396,
3057,
6912,
7731,
13,
1678,
17381,
29918,
535,
29872,
29889,
2312,
29922,
29871,
29900,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
12090,
29889,
29916,
1275,
29871,
29896,
29945,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
12090,
29889,
29891,
1275,
29871,
29900,
13,
13,
1753,
1243,
29918,
535,
29872,
29918,
262,
1765,
29898,
27358,
5333,
29918,
535,
29872,
1125,
13,
1678,
396,
3057,
29871,
29946,
29945,
13,
1678,
17381,
29918,
535,
29872,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29946,
29889,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
262,
1765,
3552,
29896,
29941,
29889,
29900,
29955,
29892,
29929,
29889,
29900,
29955,
876,
29961,
29900,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29945,
29892,
29900,
29889,
29896,
29897,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
262,
1765,
3552,
29896,
29941,
29889,
29900,
29955,
29892,
29929,
29889,
29900,
29955,
876,
29961,
29896,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29896,
29900,
29892,
29900,
29889,
29896,
29897,
13,
13,
1753,
1243,
29918,
2521,
29918,
12090,
29898,
27358,
5333,
29918,
2521,
1125,
13,
1678,
396,
3057,
11198,
936,
13,
1678,
17381,
29918,
2521,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29906,
29889,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29916,
29897,
1275,
29871,
29945,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29891,
29897,
1275,
29871,
29896,
29900,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29920,
29897,
1275,
29871,
29900,
13,
13,
1678,
396,
3057,
6912,
7731,
13,
1678,
17381,
29918,
2521,
29889,
2312,
353,
29871,
29900,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29916,
29897,
1275,
29871,
29945,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29891,
29897,
1275,
29871,
29900,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29920,
29897,
1275,
29871,
29896,
29900,
13,
13,
1678,
396,
3057,
694,
29899,
19265,
13,
1678,
17381,
29918,
2521,
29889,
19265,
353,
6213,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29916,
29897,
1275,
29871,
29900,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29891,
29897,
1275,
29871,
29900,
13,
1678,
4974,
11451,
1688,
29889,
14850,
29898,
27358,
5333,
29918,
2521,
29889,
12090,
29889,
29920,
29897,
1275,
29871,
29896,
29900,
13,
13,
1753,
1243,
29918,
2521,
29918,
262,
1765,
29898,
27358,
5333,
29918,
2521,
1125,
13,
1678,
396,
3057,
11198,
936,
13,
1678,
17381,
29918,
2521,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29906,
29889,
13,
1678,
4974,
17381,
29918,
2521,
29889,
262,
1765,
3552,
29953,
29892,
29896,
29906,
876,
29961,
29900,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29945,
29892,
29900,
29889,
29896,
29897,
13,
1678,
4974,
17381,
29918,
2521,
29889,
262,
1765,
3552,
29953,
29892,
29896,
29906,
876,
29961,
29896,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29896,
29900,
29892,
29900,
29889,
29896,
29897,
13,
13,
1678,
396,
3057,
694,
29899,
19265,
13,
1678,
17381,
29918,
2521,
29889,
19265,
353,
6213,
13,
1678,
4974,
17381,
29918,
2521,
29889,
262,
1765,
3552,
29953,
29892,
29896,
29906,
876,
1275,
11451,
1688,
29889,
14850,
29898,
29896,
29900,
29892,
29900,
29889,
29896,
29897,
13,
13,
1753,
1243,
29918,
3283,
29898,
27358,
5333,
29918,
535,
29872,
1125,
13,
1678,
17381,
29918,
535,
29872,
29889,
2312,
29922,
29871,
29900,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
3283,
1275,
313,
29896,
29953,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
13,
13,
1678,
17381,
29918,
535,
29872,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29906,
29889,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
3283,
29889,
29916,
1275,
11451,
1688,
29889,
14850,
29898,
29953,
29892,
29900,
29889,
29896,
29897,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
3283,
29889,
29891,
1275,
29871,
29896,
29906,
13,
1678,
4974,
17381,
29918,
535,
29872,
29889,
3283,
29889,
29920,
1275,
29871,
29941,
13,
13,
1753,
1243,
29918,
2218,
29886,
9552,
29898,
27358,
5333,
29918,
2521,
1125,
13,
1678,
4974,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
1275,
313,
29945,
29892,
29896,
29900,
29897,
13,
1678,
17381,
29918,
2521,
29889,
19265,
353,
6213,
13,
1678,
4974,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
1275,
29871,
29896,
29900,
13,
13,
13,
1753,
1243,
29918,
842,
29918,
12090,
29898,
27358,
5333,
29918,
2521,
1125,
13,
1678,
396,
29270,
13,
1678,
17381,
29918,
2521,
29889,
2312,
353,
5844,
29889,
1631,
29914,
29906,
29889,
13,
1678,
17381,
29918,
2521,
29889,
842,
29918,
12090,
3552,
29953,
29892,
29896,
29906,
876,
13,
1678,
4974,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
29961,
29900,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29945,
29892,
29900,
29889,
29896,
29897,
13,
1678,
4974,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
29961,
29896,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
29896,
29900,
29892,
29900,
29889,
29896,
29897,
13,
13,
1678,
396,
3057,
694,
29899,
19265,
13,
1678,
17381,
29918,
2521,
29889,
19265,
353,
6213,
13,
1678,
17381,
29918,
2521,
29889,
842,
29918,
12090,
3552,
29953,
29892,
29896,
29906,
876,
29871,
13,
1678,
4974,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
1275,
11451,
1688,
29889,
14850,
29898,
29896,
29900,
29892,
29900,
29889,
29896,
29897,
29871,
13,
13,
1753,
1243,
29918,
4299,
29898,
27358,
5333,
29918,
2521,
29892,
17381,
29918,
535,
29872,
1125,
13,
1678,
1904,
353,
3218,
839,
29967,
2461,
29889,
4299,
29898,
27358,
5333,
29918,
2521,
29897,
13,
1678,
4974,
338,
8758,
29898,
4299,
29889,
19265,
29892,
288,
561,
2941,
29889,
6295,
615,
8003,
261,
29897,
13,
1678,
4974,
338,
8758,
29898,
4299,
29889,
29880,
2027,
29892,
288,
561,
2941,
29889,
6295,
615,
8003,
261,
29897,
13,
1678,
4974,
1904,
29889,
2218,
29886,
9552,
1275,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
13,
13,
1678,
396,
3057,
694,
20343,
13,
1678,
17381,
29918,
2521,
29889,
19265,
353,
6213,
13,
1678,
1904,
353,
3218,
839,
29967,
2461,
29889,
4299,
29898,
27358,
5333,
29918,
2521,
29897,
13,
1678,
4974,
1904,
29889,
19265,
1275,
6213,
13,
1678,
4974,
338,
8758,
29898,
4299,
29889,
29880,
2027,
29892,
288,
561,
2941,
29889,
6295,
615,
8003,
261,
29897,
13,
1678,
4974,
1904,
29889,
2218,
29886,
9552,
1275,
17381,
29918,
2521,
29889,
2218,
29886,
9552,
13,
13,
1678,
396,
3057,
27843,
13,
1678,
1904,
353,
315,
650,
29967,
2461,
29889,
4299,
29898,
27358,
5333,
29918,
535,
29872,
29897,
13,
1678,
4974,
338,
8758,
29898,
4299,
29889,
19265,
29892,
288,
561,
2941,
29889,
6295,
615,
8003,
261,
29897,
13,
1678,
4974,
338,
8758,
29898,
4299,
29889,
29880,
2027,
29892,
288,
561,
2941,
29889,
6295,
615,
8003,
261,
29897,
13,
1678,
4974,
1904,
29889,
2218,
29886,
9552,
1275,
17381,
29918,
535,
29872,
29889,
2218,
29886,
9552,
13,
13,
1753,
1243,
29918,
9847,
29898,
27358,
5333,
29918,
535,
29872,
1125,
13,
1678,
17381,
29918,
535,
29872,
29889,
9847,
580,
13,
1678,
17381,
29918,
535,
29872,
29889,
19265,
29889,
9847,
29918,
4804,
29889,
5696,
29889,
9294,
29918,
13998,
29918,
2541,
580,
13,
1678,
17381,
29918,
535,
29872,
29889,
29880,
2027,
29889,
9847,
29918,
4804,
29889,
5696,
29889,
9294,
29918,
13998,
29918,
2541,
580,
13,
13,
1753,
1243,
29918,
21058,
7295,
13,
1678,
282,
29896,
353,
17646,
5333,
29924,
327,
272,
29898,
29945,
29897,
13,
1678,
282,
29906,
353,
17646,
5333,
29924,
327,
272,
29898,
29896,
29900,
29897,
13,
1678,
4974,
3218,
839,
29967,
2461,
29898,
29886,
29896,
29892,
29886,
29906,
29897,
1275,
3218,
839,
29967,
2461,
29898,
29886,
29896,
29892,
282,
29906,
29897,
13,
13,
13,
2
] |
00_data_ingest/dowload_han_data.py | mjoppich/tabula-muris | 0 | 1605558 | <reponame>mjoppich/tabula-muris<filename>00_data_ingest/dowload_han_data.py
import urllib.request
import os
with open("han_data/han_metadata.csv") as fin:
for line in fin:
aline = line.strip().split(",")
gsm = aline[0]
if gsm == None or not gsm.startswith("GSM"):
continue
print(gsm)
agsm = gsm.split("_")[0]
urlBase = "https://www.ncbi.nlm.nih.gov/geo/download/?acc="
if os.path.isfile('han_data/' + gsm + ".gz"):
continue
gsmUrl = urlBase + agsm + "&format=file&file=" + gsm + ".gz"
try:
urllib.request.urlretrieve(gsmUrl, 'han_data/' + gsm + ".gz")
except:
print("ERROR", "file not found", gsm, gsmUrl)
| [
1,
529,
276,
1112,
420,
29958,
29885,
2212,
407,
436,
29914,
3891,
2497,
29899,
29885,
332,
275,
29966,
9507,
29958,
29900,
29900,
29918,
1272,
29918,
292,
342,
29914,
29881,
340,
1359,
29918,
5403,
29918,
1272,
29889,
2272,
13,
5215,
3142,
1982,
29889,
3827,
13,
5215,
2897,
13,
13,
2541,
1722,
703,
5403,
29918,
1272,
29914,
5403,
29918,
19635,
29889,
7638,
1159,
408,
1436,
29901,
13,
13,
1678,
363,
1196,
297,
1436,
29901,
13,
13,
4706,
394,
457,
353,
1196,
29889,
17010,
2141,
5451,
28165,
1159,
13,
13,
4706,
330,
3844,
353,
394,
457,
29961,
29900,
29962,
13,
13,
4706,
565,
330,
3844,
1275,
6213,
470,
451,
330,
3844,
29889,
27382,
2541,
703,
10749,
29924,
29908,
1125,
13,
9651,
6773,
13,
13,
4706,
1596,
29898,
3174,
29885,
29897,
13,
13,
4706,
946,
3844,
353,
330,
3844,
29889,
5451,
703,
29918,
1159,
29961,
29900,
29962,
13,
13,
4706,
3142,
5160,
353,
376,
991,
597,
1636,
29889,
17608,
5365,
29889,
12938,
29885,
29889,
13428,
29889,
13513,
29914,
24756,
29914,
10382,
13401,
5753,
543,
13,
308,
13,
308,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
877,
5403,
29918,
1272,
22208,
718,
330,
3844,
718,
11393,
18828,
29908,
1125,
13,
9651,
6773,
13,
13,
13,
4706,
330,
3844,
5983,
353,
3142,
5160,
718,
946,
3844,
718,
376,
29987,
4830,
29922,
1445,
29987,
1445,
543,
718,
330,
3844,
718,
11393,
18828,
29908,
13,
13,
4706,
1018,
29901,
13,
9651,
3142,
1982,
29889,
3827,
29889,
2271,
276,
509,
2418,
29898,
3174,
29885,
5983,
29892,
525,
5403,
29918,
1272,
22208,
718,
330,
3844,
718,
11393,
18828,
1159,
13,
4706,
5174,
29901,
13,
9651,
1596,
703,
11432,
613,
376,
1445,
451,
1476,
613,
330,
3844,
29892,
330,
3844,
5983,
29897,
13,
13,
308,
2
] |
moshmosh/extensions/pipelines.py | Aloxaf/moshmosh | 114 | 572 | <reponame>Aloxaf/moshmosh<gh_stars>100-1000
from moshmosh.extension import Extension
from moshmosh.ast_compat import ast
class PipelineVisitor(ast.NodeTransformer):
"""
`a | f -> f(a)`, recursively
"""
def __init__(self, activation):
self.activation = activation
def visit_BinOp(self, n: ast.BinOp):
if n.lineno in self.activation and isinstance(n.op, ast.BitOr):
return ast.Call(
self.visit(n.right),
[self.visit(n.left)],
[],
lineno=n.lineno,
col_offset=n.col_offset
)
return self.generic_visit(n)
class Pipeline(Extension):
identifier = "pipeline"
def __init__(self):
self.visitor = PipelineVisitor(self.activation)
def rewrite_ast(self, node):
return self.visitor.visit(node)
| [
1,
529,
276,
1112,
420,
29958,
29909,
417,
29916,
2142,
29914,
7681,
7184,
10578,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
3166,
19767,
7184,
10578,
29889,
17588,
1053,
7338,
2673,
13,
3166,
19767,
7184,
10578,
29889,
579,
29918,
12667,
1053,
8717,
13,
13,
13,
1990,
349,
23828,
6116,
2105,
29898,
579,
29889,
4247,
13372,
261,
1125,
13,
1678,
9995,
13,
1678,
421,
29874,
891,
285,
1599,
285,
29898,
29874,
20362,
8304,
3598,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
26229,
1125,
13,
4706,
1583,
29889,
11236,
362,
353,
26229,
13,
13,
1678,
822,
6493,
29918,
29933,
262,
11746,
29898,
1311,
29892,
302,
29901,
8717,
29889,
29933,
262,
11746,
1125,
13,
4706,
565,
302,
29889,
1915,
8154,
297,
1583,
29889,
11236,
362,
322,
338,
8758,
29898,
29876,
29889,
459,
29892,
8717,
29889,
21591,
2816,
1125,
13,
9651,
736,
8717,
29889,
5594,
29898,
13,
18884,
1583,
29889,
1730,
277,
29898,
29876,
29889,
1266,
511,
13,
18884,
518,
1311,
29889,
1730,
277,
29898,
29876,
29889,
1563,
29897,
1402,
13,
18884,
19997,
13,
18884,
6276,
8154,
29922,
29876,
29889,
1915,
8154,
29892,
13,
18884,
784,
29918,
10289,
29922,
29876,
29889,
1054,
29918,
10289,
13,
9651,
1723,
13,
4706,
736,
1583,
29889,
19206,
29918,
1730,
277,
29898,
29876,
29897,
13,
13,
1990,
349,
23828,
29898,
17657,
1125,
13,
1678,
15882,
353,
376,
13096,
5570,
29908,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
1730,
2105,
353,
349,
23828,
6116,
2105,
29898,
1311,
29889,
11236,
362,
29897,
13,
13,
1678,
822,
10683,
29918,
579,
29898,
1311,
29892,
2943,
1125,
13,
4706,
736,
1583,
29889,
1730,
2105,
29889,
1730,
277,
29898,
3177,
29897,
13,
2
] |
util.py | samrat2825/Skeleton-Based-Human-Action-Recognition-SGN- | 0 | 195374 | import os
import csv
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch
import os.path as osp
def make_dir(dataset):
if dataset == 'NTU':
output_dir = os.path.join('./results/NTU/')
elif dataset == 'NTU120':
output_dir = os.path.join('./results/NTU120/')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
return output_dir
def get_num_classes(dataset):
if dataset == 'NTU':
return 60
elif dataset == 'NTU120':
return 120
| [
1,
1053,
2897,
13,
5215,
11799,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
13,
5215,
2897,
29889,
2084,
408,
288,
1028,
13,
13,
1753,
1207,
29918,
3972,
29898,
24713,
1125,
13,
1678,
565,
8783,
1275,
525,
20321,
29965,
2396,
13,
4706,
1962,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
877,
6904,
9902,
29914,
20321,
29965,
29914,
1495,
13,
1678,
25342,
8783,
1275,
525,
20321,
29965,
29896,
29906,
29900,
2396,
13,
4706,
1962,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
877,
6904,
9902,
29914,
20321,
29965,
29896,
29906,
29900,
29914,
1495,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
4905,
29918,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
4905,
29918,
3972,
29897,
13,
13,
1678,
736,
1962,
29918,
3972,
13,
13,
1753,
679,
29918,
1949,
29918,
13203,
29898,
24713,
1125,
13,
1678,
565,
8783,
1275,
525,
20321,
29965,
2396,
13,
4706,
736,
29871,
29953,
29900,
13,
1678,
25342,
8783,
1275,
525,
20321,
29965,
29896,
29906,
29900,
2396,
13,
4706,
736,
29871,
29896,
29906,
29900,
13,
13,
268,
13,
2
] |
day04.py | drax-dev/AoC | 0 | 1617986 | <filename>day04.py
class BoardField:
def __init__(self, input_value):
self.value = input_value
self.is_marked = False
class Board:
def __init__(self, size_x, size_y):
self.size_x = size_x
self.size_y = size_y
self.board = [[BoardField(0) for x in range(size_x)] for y in range(size_y)]
self.sum = 0
self.bingo = False
def set_values(self, list_of_values, row):
for y in range(self.size_y):
current_value = int(list_of_values[y])
self.board[row][y].value = current_value
self.sum += current_value
def check_bingo_in_column(self, x):
for y in range(self.size_y):
if not self.board[x][y].is_marked:
return False
return True
def check_bingo_in_row(self, y):
for x in range(self.size_x):
if not self.board[x][y].is_marked:
return False
return True
def check_bingo(self):
for x in range(self.size_x):
if check_bingo_in_column(x):
return True
for y in range(self.size_y):
if check_bingo_in_row(y):
return True
return False
def marked_number_and_check_bingo(self, number):
number = int(number)
for x in range(self.size_x):
for y in range(self.size_y):
if self.board[x][y].value == number:
self.board[x][y].is_marked = True
self.sum -= number
if self.check_bingo_in_column(x) or self.check_bingo_in_row(y):
self.bingo = True
return True
return False
def __str__(self):
result_str = str("BOARD:\n")
for x in range(self.size_x):
for y in range(self.size_y):
result_str += str(self.board[x][y].value)
result_str += " "
result_str = result_str[:-1]
result_str += '\n'
return result_str
def load_data(file_name):
with open(file_name, mode="r") as input_f:
list_of_boards = list()
first_line = input_f.readline()
first_line = first_line.strip().split(',')
current_board = -1
current_row = 0
for line in input_f:
line = line.replace(" ", " ")
line = line.strip()
if len(line) > 0:
line = line.split(' ')
list_of_boards[current_board].set_values(line, current_row)
current_row += 1
else:
if len(list_of_boards) > 0:
print(list_of_boards[current_board])
list_of_boards.append(Board(5, 5))
current_board += 1
current_row = 0
return list_of_boards, first_line
def play_bingo(list_of_boards, numbers):
for number in numbers:
number = int(number)
for board in list_of_boards:
if board.marked_number_and_check_bingo(number):
return number * board.sum
def lose_bingo(list_of_boards, numbers):
for number in numbers:
number = int(number)
filtered_list_of_boards = [board for board in list_of_boards if board.bingo is False]
for board in filtered_list_of_boards:
if board.marked_number_and_check_bingo(number):
if len(filtered_list_of_boards) == 1:
return number * board.sum
if __name__ == '__main__':
boards, bingo_numbers = load_data("input_day04")
# result = play_bingo(boards, bingo_numbers)
# print(result)
# print()
result = lose_bingo(boards, bingo_numbers)
print(result)
| [
1,
529,
9507,
29958,
3250,
29900,
29946,
29889,
2272,
13,
1990,
12590,
3073,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1881,
29918,
1767,
1125,
13,
4706,
1583,
29889,
1767,
353,
1881,
29918,
1767,
13,
4706,
1583,
29889,
275,
29918,
3502,
287,
353,
7700,
13,
13,
13,
1990,
12590,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2159,
29918,
29916,
29892,
2159,
29918,
29891,
1125,
13,
4706,
1583,
29889,
2311,
29918,
29916,
353,
2159,
29918,
29916,
13,
4706,
1583,
29889,
2311,
29918,
29891,
353,
2159,
29918,
29891,
13,
4706,
1583,
29889,
3377,
353,
5519,
28397,
3073,
29898,
29900,
29897,
363,
921,
297,
3464,
29898,
2311,
29918,
29916,
4638,
363,
343,
297,
3464,
29898,
2311,
29918,
29891,
4638,
13,
4706,
1583,
29889,
2083,
353,
29871,
29900,
13,
4706,
1583,
29889,
10549,
29877,
353,
7700,
13,
13,
1678,
822,
731,
29918,
5975,
29898,
1311,
29892,
1051,
29918,
974,
29918,
5975,
29892,
1948,
1125,
13,
4706,
363,
343,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29891,
1125,
13,
9651,
1857,
29918,
1767,
353,
938,
29898,
1761,
29918,
974,
29918,
5975,
29961,
29891,
2314,
13,
9651,
1583,
29889,
3377,
29961,
798,
3816,
29891,
1822,
1767,
353,
1857,
29918,
1767,
13,
9651,
1583,
29889,
2083,
4619,
1857,
29918,
1767,
13,
13,
1678,
822,
1423,
29918,
10549,
29877,
29918,
262,
29918,
4914,
29898,
1311,
29892,
921,
1125,
13,
4706,
363,
343,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29891,
1125,
13,
9651,
565,
451,
1583,
29889,
3377,
29961,
29916,
3816,
29891,
1822,
275,
29918,
3502,
287,
29901,
13,
18884,
736,
7700,
13,
4706,
736,
5852,
13,
13,
1678,
822,
1423,
29918,
10549,
29877,
29918,
262,
29918,
798,
29898,
1311,
29892,
343,
1125,
13,
4706,
363,
921,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29916,
1125,
13,
9651,
565,
451,
1583,
29889,
3377,
29961,
29916,
3816,
29891,
1822,
275,
29918,
3502,
287,
29901,
13,
18884,
736,
7700,
13,
4706,
736,
5852,
13,
13,
1678,
822,
1423,
29918,
10549,
29877,
29898,
1311,
1125,
13,
4706,
363,
921,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29916,
1125,
13,
9651,
565,
1423,
29918,
10549,
29877,
29918,
262,
29918,
4914,
29898,
29916,
1125,
13,
18884,
736,
5852,
13,
4706,
363,
343,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29891,
1125,
13,
9651,
565,
1423,
29918,
10549,
29877,
29918,
262,
29918,
798,
29898,
29891,
1125,
13,
18884,
736,
5852,
13,
4706,
736,
7700,
13,
13,
1678,
822,
10902,
29918,
4537,
29918,
392,
29918,
3198,
29918,
10549,
29877,
29898,
1311,
29892,
1353,
1125,
13,
4706,
1353,
353,
938,
29898,
4537,
29897,
13,
4706,
363,
921,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29916,
1125,
13,
9651,
363,
343,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29891,
1125,
13,
18884,
565,
1583,
29889,
3377,
29961,
29916,
3816,
29891,
1822,
1767,
1275,
1353,
29901,
13,
462,
1678,
1583,
29889,
3377,
29961,
29916,
3816,
29891,
1822,
275,
29918,
3502,
287,
353,
5852,
13,
462,
1678,
1583,
29889,
2083,
22361,
1353,
13,
462,
1678,
565,
1583,
29889,
3198,
29918,
10549,
29877,
29918,
262,
29918,
4914,
29898,
29916,
29897,
470,
1583,
29889,
3198,
29918,
10549,
29877,
29918,
262,
29918,
798,
29898,
29891,
1125,
13,
462,
4706,
1583,
29889,
10549,
29877,
353,
5852,
13,
462,
4706,
736,
5852,
13,
4706,
736,
7700,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
1121,
29918,
710,
353,
851,
703,
8456,
17011,
3583,
29876,
1159,
13,
4706,
363,
921,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29916,
1125,
13,
9651,
363,
343,
297,
3464,
29898,
1311,
29889,
2311,
29918,
29891,
1125,
13,
18884,
1121,
29918,
710,
4619,
851,
29898,
1311,
29889,
3377,
29961,
29916,
3816,
29891,
1822,
1767,
29897,
13,
18884,
1121,
29918,
710,
4619,
376,
376,
13,
9651,
1121,
29918,
710,
353,
1121,
29918,
710,
7503,
29899,
29896,
29962,
13,
9651,
1121,
29918,
710,
4619,
11297,
29876,
29915,
13,
4706,
736,
1121,
29918,
710,
13,
13,
13,
1753,
2254,
29918,
1272,
29898,
1445,
29918,
978,
1125,
13,
1678,
411,
1722,
29898,
1445,
29918,
978,
29892,
4464,
543,
29878,
1159,
408,
1881,
29918,
29888,
29901,
13,
4706,
1051,
29918,
974,
29918,
24691,
353,
1051,
580,
13,
4706,
937,
29918,
1220,
353,
1881,
29918,
29888,
29889,
949,
1220,
580,
13,
4706,
937,
29918,
1220,
353,
937,
29918,
1220,
29889,
17010,
2141,
5451,
29317,
1495,
13,
4706,
1857,
29918,
3377,
353,
448,
29896,
13,
4706,
1857,
29918,
798,
353,
29871,
29900,
13,
4706,
363,
1196,
297,
1881,
29918,
29888,
29901,
13,
9651,
1196,
353,
1196,
29889,
6506,
703,
29871,
9162,
376,
16521,
13,
9651,
1196,
353,
1196,
29889,
17010,
580,
13,
9651,
565,
7431,
29898,
1220,
29897,
1405,
29871,
29900,
29901,
13,
18884,
1196,
353,
1196,
29889,
5451,
877,
25710,
13,
18884,
1051,
29918,
974,
29918,
24691,
29961,
3784,
29918,
3377,
1822,
842,
29918,
5975,
29898,
1220,
29892,
1857,
29918,
798,
29897,
13,
18884,
1857,
29918,
798,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
565,
7431,
29898,
1761,
29918,
974,
29918,
24691,
29897,
1405,
29871,
29900,
29901,
13,
462,
1678,
1596,
29898,
1761,
29918,
974,
29918,
24691,
29961,
3784,
29918,
3377,
2314,
13,
18884,
1051,
29918,
974,
29918,
24691,
29889,
4397,
29898,
28397,
29898,
29945,
29892,
29871,
29945,
876,
13,
18884,
1857,
29918,
3377,
4619,
29871,
29896,
13,
18884,
1857,
29918,
798,
353,
29871,
29900,
13,
1678,
736,
1051,
29918,
974,
29918,
24691,
29892,
937,
29918,
1220,
13,
13,
13,
1753,
1708,
29918,
10549,
29877,
29898,
1761,
29918,
974,
29918,
24691,
29892,
3694,
1125,
13,
1678,
363,
1353,
297,
3694,
29901,
13,
4706,
1353,
353,
938,
29898,
4537,
29897,
13,
4706,
363,
7613,
297,
1051,
29918,
974,
29918,
24691,
29901,
13,
9651,
565,
7613,
29889,
3502,
287,
29918,
4537,
29918,
392,
29918,
3198,
29918,
10549,
29877,
29898,
4537,
1125,
13,
18884,
736,
1353,
334,
7613,
29889,
2083,
13,
13,
13,
1753,
14074,
29918,
10549,
29877,
29898,
1761,
29918,
974,
29918,
24691,
29892,
3694,
1125,
13,
1678,
363,
1353,
297,
3694,
29901,
13,
4706,
1353,
353,
938,
29898,
4537,
29897,
13,
4706,
22289,
29918,
1761,
29918,
974,
29918,
24691,
353,
518,
3377,
363,
7613,
297,
1051,
29918,
974,
29918,
24691,
565,
7613,
29889,
10549,
29877,
338,
7700,
29962,
13,
4706,
363,
7613,
297,
22289,
29918,
1761,
29918,
974,
29918,
24691,
29901,
13,
9651,
565,
7613,
29889,
3502,
287,
29918,
4537,
29918,
392,
29918,
3198,
29918,
10549,
29877,
29898,
4537,
1125,
13,
18884,
565,
7431,
29898,
4572,
287,
29918,
1761,
29918,
974,
29918,
24691,
29897,
1275,
29871,
29896,
29901,
13,
462,
1678,
736,
1353,
334,
7613,
29889,
2083,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1045,
3163,
29892,
289,
20191,
29918,
20326,
353,
2254,
29918,
1272,
703,
2080,
29918,
3250,
29900,
29946,
1159,
13,
1678,
396,
1121,
353,
1708,
29918,
10549,
29877,
29898,
24691,
29892,
289,
20191,
29918,
20326,
29897,
13,
1678,
396,
1596,
29898,
2914,
29897,
13,
1678,
396,
1596,
580,
13,
1678,
1121,
353,
14074,
29918,
10549,
29877,
29898,
24691,
29892,
289,
20191,
29918,
20326,
29897,
13,
1678,
1596,
29898,
2914,
29897,
13,
2
] |
src/4-4.py | Zepyhrus/tf2 | 0 | 120702 | <reponame>Zepyhrus/tf2<filename>src/4-4.py
import tensorflow as tf
import tensorflow_datasets as tfds
tf.compat.v1.disable_v2_behavior()
def get_iris_data():
ds_train, *_ = tfds.load(name='iris', split=['train'])
with open('iris.csv', 'w') as f:
for i, ds in enumerate(ds_train):
features = ds['features'].numpy()
label = ds['label'].numpy()
msg = f'{i},'
for feature in features:
msg += f'{feature:.1f},'
msg += f'{label}\n'
f.write(msg)
def read_data(file_queue):
reader = tf.compat.v1.TextLineReader(skip_header_lines=1)
key, value = reader.read(file_queue)
defaults = [[0], [0.], [0.], [0.], [0.], [0]]
csv_column = tf.io.decode_csv(records=value, record_defaults=defaults)
feature_column = [i for i in csv_column[1:-1]]
label_column = csv_column[-1]
return tf.stack(feature_column), label_column
def create_pipeline(filename, batch_size, num_epochs=None):
file_queue = tf.compat.v1.train.string_input_producer([filename], num_epochs=num_epochs)
feature, label = read_data(file_queue)
min_after_dequeue = 1000 # keep at least 1000 data
capacity = min_after_dequeue + batch_size
feature_batch, label_batch = tf.compat.v1.train.shuffle_batch(
[feature, label],
batch_size=batch_size,
capacity=capacity,
min_after_dequeue=min_after_dequeue
)
return feature_batch, label_batch
if __name__ == "__main__":
x_train_batch, y_train_batch = create_pipeline('iris.csv', 32, num_epochs=100)
x_test, y_test = create_pipeline('iris.csv', 32)
with tf.compat.v1.Session() as sess:
sess.run(tf.compat.v1.global_variables_initializer())
sess.run(tf.compat.v1.local_variables_initializer()) # this is necessary
coord = tf.train.Coordinator()
threads = tf.compat.v1.train.start_queue_runners(coord=coord)
try:
while True:
if coord.should_stop():
break
example, label = sess.run([x_train_batch, y_train_batch])
print('training data: ', example)
print('training label: ', label)
except tf.errors.OutOfRangeError:
print('Done reading')
example, label = sess.run([x_test, y_test])
print('test data: ', example)
print('test label: ', label)
except KeyboardInterrupt:
print('Terminated by keyboard')
finally:
coord.request_stop()
coord.join(threads)
sess.close()
| [
1,
529,
276,
1112,
420,
29958,
29999,
1022,
29891,
1092,
375,
29914,
13264,
29906,
29966,
9507,
29958,
4351,
29914,
29946,
29899,
29946,
29889,
2272,
13,
5215,
26110,
408,
15886,
13,
5215,
26110,
29918,
14538,
1691,
408,
15886,
6289,
13,
13,
13264,
29889,
12667,
29889,
29894,
29896,
29889,
20472,
29918,
29894,
29906,
29918,
915,
16300,
580,
13,
13,
1753,
679,
29918,
381,
275,
29918,
1272,
7295,
13,
29871,
18031,
29918,
14968,
29892,
334,
29918,
353,
15886,
6289,
29889,
1359,
29898,
978,
2433,
381,
275,
742,
6219,
29922,
1839,
14968,
11287,
13,
13,
13,
29871,
411,
1722,
877,
381,
275,
29889,
7638,
742,
525,
29893,
1495,
408,
285,
29901,
13,
1678,
363,
474,
29892,
18031,
297,
26985,
29898,
6289,
29918,
14968,
1125,
13,
418,
5680,
353,
18031,
1839,
22100,
13359,
23749,
580,
13,
418,
3858,
353,
18031,
1839,
1643,
13359,
23749,
580,
13,
13,
418,
10191,
353,
285,
29915,
29912,
29875,
1118,
29915,
13,
418,
363,
4682,
297,
5680,
29901,
13,
4706,
10191,
4619,
285,
29915,
29912,
14394,
29901,
29889,
29896,
29888,
1118,
29915,
13,
418,
10191,
4619,
285,
29915,
29912,
1643,
1012,
29876,
29915,
13,
13,
418,
285,
29889,
3539,
29898,
7645,
29897,
13,
13,
13,
1753,
1303,
29918,
1272,
29898,
1445,
29918,
9990,
1125,
13,
29871,
9591,
353,
15886,
29889,
12667,
29889,
29894,
29896,
29889,
1626,
3542,
6982,
29898,
11014,
29918,
6672,
29918,
9012,
29922,
29896,
29897,
13,
29871,
1820,
29892,
995,
353,
9591,
29889,
949,
29898,
1445,
29918,
9990,
29897,
13,
13,
29871,
21274,
353,
5519,
29900,
1402,
518,
29900,
29889,
1402,
518,
29900,
29889,
1402,
518,
29900,
29889,
1402,
518,
29900,
29889,
1402,
518,
29900,
5262,
13,
29871,
11799,
29918,
4914,
353,
15886,
29889,
601,
29889,
13808,
29918,
7638,
29898,
3757,
4339,
29922,
1767,
29892,
2407,
29918,
4381,
29879,
29922,
4381,
29879,
29897,
13,
13,
29871,
4682,
29918,
4914,
353,
518,
29875,
363,
474,
297,
11799,
29918,
4914,
29961,
29896,
13018,
29896,
5262,
13,
29871,
3858,
29918,
4914,
353,
11799,
29918,
4914,
14352,
29896,
29962,
13,
13,
29871,
736,
15886,
29889,
1429,
29898,
14394,
29918,
4914,
511,
3858,
29918,
4914,
13,
13,
13,
1753,
1653,
29918,
13096,
5570,
29898,
9507,
29892,
9853,
29918,
2311,
29892,
954,
29918,
1022,
2878,
29879,
29922,
8516,
1125,
13,
29871,
934,
29918,
9990,
353,
15886,
29889,
12667,
29889,
29894,
29896,
29889,
14968,
29889,
1807,
29918,
2080,
29918,
5498,
2265,
4197,
9507,
1402,
954,
29918,
1022,
2878,
29879,
29922,
1949,
29918,
1022,
2878,
29879,
29897,
13,
13,
29871,
4682,
29892,
3858,
353,
1303,
29918,
1272,
29898,
1445,
29918,
9990,
29897,
13,
13,
29871,
1375,
29918,
7045,
29918,
311,
9990,
353,
29871,
29896,
29900,
29900,
29900,
29871,
396,
3013,
472,
3203,
29871,
29896,
29900,
29900,
29900,
848,
13,
29871,
13284,
353,
1375,
29918,
7045,
29918,
311,
9990,
718,
9853,
29918,
2311,
13,
13,
29871,
4682,
29918,
16175,
29892,
3858,
29918,
16175,
353,
15886,
29889,
12667,
29889,
29894,
29896,
29889,
14968,
29889,
845,
21897,
29918,
16175,
29898,
13,
1678,
518,
14394,
29892,
3858,
1402,
13,
1678,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
1678,
13284,
29922,
5030,
5946,
29892,
13,
1678,
1375,
29918,
7045,
29918,
311,
9990,
29922,
1195,
29918,
7045,
29918,
311,
9990,
13,
29871,
1723,
13,
13,
29871,
736,
4682,
29918,
16175,
29892,
3858,
29918,
16175,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
29871,
921,
29918,
14968,
29918,
16175,
29892,
343,
29918,
14968,
29918,
16175,
353,
1653,
29918,
13096,
5570,
877,
381,
275,
29889,
7638,
742,
29871,
29941,
29906,
29892,
954,
29918,
1022,
2878,
29879,
29922,
29896,
29900,
29900,
29897,
13,
29871,
921,
29918,
1688,
29892,
343,
29918,
1688,
353,
1653,
29918,
13096,
5570,
877,
381,
275,
29889,
7638,
742,
29871,
29941,
29906,
29897,
13,
13,
29871,
411,
15886,
29889,
12667,
29889,
29894,
29896,
29889,
7317,
580,
408,
27937,
29901,
13,
1678,
27937,
29889,
3389,
29898,
13264,
29889,
12667,
29889,
29894,
29896,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
3101,
13,
1678,
27937,
29889,
3389,
29898,
13264,
29889,
12667,
29889,
29894,
29896,
29889,
2997,
29918,
20897,
29918,
11228,
3950,
3101,
29871,
396,
445,
338,
5181,
13,
13,
1678,
29311,
353,
15886,
29889,
14968,
29889,
7967,
4194,
1061,
580,
13,
1678,
9717,
353,
15886,
29889,
12667,
29889,
29894,
29896,
29889,
14968,
29889,
2962,
29918,
9990,
29918,
3389,
8397,
29898,
1111,
536,
29922,
1111,
536,
29897,
13,
13,
1678,
1018,
29901,
13,
418,
1550,
5852,
29901,
13,
4706,
565,
29311,
29889,
9344,
29918,
9847,
7295,
13,
3986,
2867,
13,
308,
13,
4706,
1342,
29892,
3858,
353,
27937,
29889,
3389,
4197,
29916,
29918,
14968,
29918,
16175,
29892,
343,
29918,
14968,
29918,
16175,
2314,
13,
13,
4706,
1596,
877,
26495,
848,
29901,
13420,
1342,
29897,
13,
4706,
1596,
877,
26495,
3858,
29901,
13420,
3858,
29897,
13,
1678,
5174,
15886,
29889,
12523,
29889,
3744,
2776,
6069,
2392,
29901,
13,
418,
1596,
877,
25632,
5183,
1495,
13,
418,
1342,
29892,
3858,
353,
27937,
29889,
3389,
4197,
29916,
29918,
1688,
29892,
343,
29918,
1688,
2314,
13,
13,
418,
1596,
877,
1688,
848,
29901,
13420,
1342,
29897,
13,
418,
1596,
877,
1688,
3858,
29901,
13420,
3858,
29897,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
13,
418,
1596,
877,
14343,
262,
630,
491,
12247,
1495,
13,
1678,
7146,
29901,
13,
418,
29311,
29889,
3827,
29918,
9847,
580,
13,
13,
1678,
29311,
29889,
7122,
29898,
28993,
29897,
13,
1678,
27937,
29889,
5358,
580,
13,
2
] |
scattered_cifar.py | ethanwharris/foveated-convolutions | 4 | 74650 | from torchvision.datasets import CIFAR10
from torchvision.transforms import Pad, RandomAffine
class ScatteredCIFAR10(CIFAR10):
def __init__(self, root, train=True, transform=None, target_transform=None, download=False, pad=32, translate=0.4):
super().__init__(root, train=train, target_transform=target_transform, download=download)
self._transform = transform
self.p = pad
self.sz = (2 * self.p) + 32
self._pad = Pad(pad)
self._affine = RandomAffine(0, translate=(translate, translate))
def __getitem__(self, index):
img, target = super().__getitem__(index)
img = self._pad(img)
img = self._affine(img)
if self._transform is not None:
img = self._transform(img)
return img, target
| [
1,
515,
4842,
305,
4924,
29889,
14538,
1691,
1053,
315,
6545,
1718,
29896,
29900,
13,
3166,
4842,
305,
4924,
29889,
9067,
29879,
1053,
18011,
29892,
16968,
27867,
457,
13,
13,
13,
1990,
2522,
2620,
287,
29907,
6545,
1718,
29896,
29900,
29898,
29907,
6545,
1718,
29896,
29900,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3876,
29892,
7945,
29922,
5574,
29892,
4327,
29922,
8516,
29892,
3646,
29918,
9067,
29922,
8516,
29892,
5142,
29922,
8824,
29892,
17132,
29922,
29941,
29906,
29892,
14240,
29922,
29900,
29889,
29946,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
4632,
29892,
7945,
29922,
14968,
29892,
3646,
29918,
9067,
29922,
5182,
29918,
9067,
29892,
5142,
29922,
10382,
29897,
13,
13,
4706,
1583,
3032,
9067,
353,
4327,
13,
13,
4706,
1583,
29889,
29886,
353,
17132,
13,
4706,
1583,
29889,
3616,
353,
313,
29906,
334,
1583,
29889,
29886,
29897,
718,
29871,
29941,
29906,
13,
13,
4706,
1583,
3032,
8305,
353,
18011,
29898,
8305,
29897,
13,
4706,
1583,
3032,
3470,
457,
353,
16968,
27867,
457,
29898,
29900,
29892,
14240,
7607,
21652,
29892,
14240,
876,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
10153,
29892,
3646,
353,
2428,
2141,
1649,
657,
667,
12035,
2248,
29897,
13,
13,
4706,
10153,
353,
1583,
3032,
8305,
29898,
2492,
29897,
13,
4706,
10153,
353,
1583,
3032,
3470,
457,
29898,
2492,
29897,
13,
13,
4706,
565,
1583,
3032,
9067,
338,
451,
6213,
29901,
13,
9651,
10153,
353,
1583,
3032,
9067,
29898,
2492,
29897,
13,
13,
4706,
736,
10153,
29892,
3646,
13,
2
] |
examples/datahistos.py | earlyuniverse/gutfit | 0 | 148042 | <reponame>earlyuniverse/gutfit
from gutfit.experimentalneutrinomassmatrix import ExperimentalNeutrinoMassMatrix
from gutfit.type1and2seesaw import Type1And2SeeSaw
from gutfit import parameterlist
def sample(E,PL,m1):
p=PL()
p["data_neutrino_m1"] = m1
return E(p)
#https://stackoverflow.com/questions/13377046/scipy-fill-a-histogram-reading-from-a-db-event-by-event-in-a-loop
import numpy as np
class Hist1D(object):
def __init__(self, nbins, xlow, xhigh):
self.nbins = nbins
self.xlow = xlow
self.xhigh = xhigh
self.hist, edges = np.histogram([], bins=nbins, range=(xlow, xhigh))
self.bins = (edges[:-1] + edges[1:]) / 2.
def fill(self, arr):
hist, edges = np.histogram(arr, bins=self.nbins, range=(self.xlow, self.xhigh))
self.hist += hist
@property
def data(self):
return self.bins, self.hist
if __name__=="__main__":
import sys
E = ExperimentalNeutrinoMassMatrix()
S = Type1And2SeeSaw()
PL = parameterlist.ParameterList.fromConfigFile(sys.argv[1])#"examples/param_card.dat")
from matplotlib import pyplot as plt
import matplotlib as mpl
plt.style.use('ggplot')
D = []
T = []
mass = float(sys.argv[3])
for _ in range(int(sys.argv[2])):
data = sample(E, PL, mass)
theo = sample(S, PL, mass)
D.append(data)
T.append(theo)
fig, axes = plt.subplots(figsize=(10, 10), sharex=False, sharey=False, ncols=3, nrows=3)
for i in range(3):
for j in range(3):
if i<j:
axes[i, j].axis('off')
else:
values = [d[i][j] for d in D]
theos = [t[i][j] for t in T]
axes[i, j].hist(values, bins=30)
axes[i, j].hist(theos, bins=30)
axes[i, j].set_xscale("log")
axes[i, j].set_xscale("log")
plt.savefig("both_{}.pdf".format(sys.argv[3]))
# from IPython import embed
# embed()
| [
1,
529,
276,
1112,
420,
29958,
799,
368,
348,
12193,
29914,
29887,
329,
9202,
13,
3166,
22341,
9202,
29889,
735,
27910,
17821,
17056,
290,
465,
5344,
1053,
1222,
27910,
8139,
329,
29878,
1789,
29924,
465,
14609,
13,
3166,
22341,
9202,
29889,
1853,
29896,
392,
29906,
344,
267,
1450,
1053,
5167,
29896,
2855,
29906,
13393,
29903,
1450,
13,
3166,
22341,
9202,
1053,
3443,
1761,
13,
13,
1753,
4559,
29898,
29923,
29892,
7390,
29892,
29885,
29896,
1125,
13,
1678,
282,
29922,
7390,
580,
13,
1678,
282,
3366,
1272,
29918,
17821,
29878,
1789,
29918,
29885,
29896,
3108,
353,
286,
29896,
13,
1678,
736,
382,
29898,
29886,
29897,
13,
13,
29937,
991,
597,
2417,
29889,
510,
29914,
2619,
29914,
29896,
29941,
29941,
29955,
29955,
29900,
29946,
29953,
29914,
26167,
2272,
29899,
5589,
29899,
29874,
29899,
29882,
391,
13342,
29899,
19715,
29899,
3166,
29899,
29874,
29899,
2585,
29899,
3696,
29899,
1609,
29899,
3696,
29899,
262,
29899,
29874,
29899,
7888,
13,
5215,
12655,
408,
7442,
13,
1990,
15179,
29896,
29928,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
302,
29890,
1144,
29892,
921,
677,
29892,
921,
9812,
1125,
13,
4706,
1583,
29889,
9877,
1144,
353,
302,
29890,
1144,
13,
4706,
1583,
29889,
29916,
677,
29871,
353,
921,
677,
13,
4706,
1583,
29889,
29916,
9812,
353,
921,
9812,
13,
4706,
1583,
29889,
29882,
391,
29892,
12770,
353,
7442,
29889,
29882,
391,
13342,
4197,
1402,
289,
1144,
29922,
9877,
1144,
29892,
3464,
7607,
29916,
677,
29892,
921,
9812,
876,
13,
4706,
1583,
29889,
29890,
1144,
353,
313,
287,
2710,
7503,
29899,
29896,
29962,
718,
12770,
29961,
29896,
29901,
2314,
847,
29871,
29906,
29889,
13,
13,
1678,
822,
5445,
29898,
1311,
29892,
3948,
1125,
13,
4706,
9825,
29892,
12770,
353,
7442,
29889,
29882,
391,
13342,
29898,
2749,
29892,
289,
1144,
29922,
1311,
29889,
9877,
1144,
29892,
3464,
7607,
1311,
29889,
29916,
677,
29892,
1583,
29889,
29916,
9812,
876,
13,
4706,
1583,
29889,
29882,
391,
4619,
9825,
13,
13,
1678,
732,
6799,
13,
1678,
822,
848,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29890,
1144,
29892,
1583,
29889,
29882,
391,
13,
13,
13,
361,
4770,
978,
1649,
26359,
1649,
3396,
1649,
1115,
13,
1678,
1053,
10876,
13,
1678,
382,
353,
1222,
27910,
8139,
329,
29878,
1789,
29924,
465,
14609,
580,
13,
1678,
317,
353,
5167,
29896,
2855,
29906,
13393,
29903,
1450,
580,
13,
1678,
16507,
353,
29871,
3443,
1761,
29889,
9329,
1293,
29889,
3166,
3991,
2283,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
29937,
29908,
19057,
29914,
3207,
29918,
7543,
29889,
4130,
1159,
13,
13,
13,
1678,
515,
22889,
1053,
11451,
5317,
408,
14770,
13,
1678,
1053,
22889,
408,
286,
572,
13,
1678,
14770,
29889,
3293,
29889,
1509,
877,
1505,
5317,
1495,
13,
13,
13,
1678,
360,
353,
5159,
13,
1678,
323,
353,
5159,
13,
13,
1678,
4158,
353,
5785,
29898,
9675,
29889,
19218,
29961,
29941,
2314,
13,
1678,
363,
903,
297,
3464,
29898,
524,
29898,
9675,
29889,
19218,
29961,
29906,
12622,
29901,
13,
4706,
848,
353,
4559,
29898,
29923,
29892,
16507,
29892,
4158,
29897,
13,
4706,
278,
29877,
353,
4559,
29898,
29903,
29892,
16507,
29892,
4158,
29897,
13,
4706,
360,
29889,
4397,
29898,
1272,
29897,
13,
4706,
323,
29889,
4397,
29898,
1552,
29877,
29897,
13,
13,
1678,
2537,
29892,
27815,
353,
14770,
29889,
1491,
26762,
29898,
1003,
2311,
7607,
29896,
29900,
29892,
29871,
29896,
29900,
511,
6232,
29916,
29922,
8824,
29892,
6232,
29891,
29922,
8824,
29892,
302,
22724,
29922,
29941,
29892,
302,
5727,
29922,
29941,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
29941,
1125,
13,
9651,
565,
474,
29966,
29926,
29901,
13,
18884,
27815,
29961,
29875,
29892,
432,
1822,
8990,
877,
2696,
1495,
13,
9651,
1683,
29901,
13,
18884,
1819,
353,
518,
29881,
29961,
29875,
3816,
29926,
29962,
363,
270,
297,
360,
29962,
13,
18884,
278,
359,
29871,
353,
518,
29873,
29961,
29875,
3816,
29926,
29962,
363,
260,
297,
323,
29962,
13,
18884,
27815,
29961,
29875,
29892,
432,
1822,
29882,
391,
29898,
5975,
29892,
289,
1144,
29922,
29941,
29900,
29897,
13,
18884,
27815,
29961,
29875,
29892,
432,
1822,
29882,
391,
29898,
1552,
359,
29892,
289,
1144,
29922,
29941,
29900,
29897,
13,
18884,
27815,
29961,
29875,
29892,
432,
1822,
842,
29918,
29916,
7052,
703,
1188,
1159,
13,
18884,
27815,
29961,
29875,
29892,
432,
1822,
842,
29918,
29916,
7052,
703,
1188,
1159,
13,
13,
13,
13,
1678,
14770,
29889,
7620,
1003,
703,
20313,
648,
1836,
5140,
1642,
4830,
29898,
9675,
29889,
19218,
29961,
29941,
12622,
13,
13,
1678,
396,
515,
5641,
1656,
1053,
8297,
13,
1678,
396,
8297,
580,
13,
2
] |
xbbo/surrogate/gaussian_process.py | zhanglei1172/bbobenchmark | 2 | 21915 | <reponame>zhanglei1172/bbobenchmark
from typing import List
import typing
from scipy import optimize
import sklearn
# from sklearn.gaussian_process import kernels
from sklearn.gaussian_process.kernels import Kernel, KernelOperator
# import torch
# from scipy.linalg import solve_triangular, cholesky
# from scipy import optimize, stats
import numpy as np
# import GPy
from sklearn import gaussian_process
# from botorch.acquisition import ExpectedImprovement
from xbbo.surrogate.base import Surrogate, BaseGP
from xbbo.surrogate.gp_kernels import HammingKernel, Matern, ConstantKernel, WhiteKernel
from xbbo.surrogate.gp_prior import HorseshoePrior, LognormalPrior, Prior, SoftTopHatPrior, TophatPrior
from xbbo.utils.util import get_types
VERY_SMALL_NUMBER = 1e-10
class GaussianTransform:
"""
Transform data into Gaussian by applying psi = Phi^{-1} o F where F is the truncated ECDF.
:param y: shape (n, dim)
"""
def __init__(self, y: np.array):
assert y.ndim == 2
self.dim = y.shape[1]
self.sorted = y.copy()
self.sorted.sort(axis=0)
@staticmethod
def z_transform(series, values_sorted=None):
# applies truncated ECDF then inverse Gaussian CDF.
if values_sorted is None:
values_sorted = sorted(series)
def winsorized_delta(n):
return 1.0 / (4.0 * n**0.25 * np.sqrt(np.pi * np.log(n)))
delta = winsorized_delta(len(series))
def quantile(values_sorted, values_to_insert, delta):
res = np.searchsorted(values_sorted,
values_to_insert) / len(values_sorted)
return np.clip(res, a_min=delta, a_max=1 - delta)
quantiles = quantile(values_sorted, series, delta)
quantiles = np.clip(quantiles, a_min=delta, a_max=1 - delta)
return stats.norm.ppf(quantiles)
def transform(self, y: np.array):
"""
:param y: shape (n, dim)
:return: shape (n, dim), distributed along a normal
"""
assert y.shape[1] == self.dim
# compute truncated quantile, apply gaussian inv cdf
return np.stack([
self.z_transform(y[:, i], self.sorted[:, i])
for i in range(self.dim)
]).T
class StandardTransform:
def __init__(self, y: np.array):
assert y.ndim == 2
self.dim = y.shape[1]
self.mean = y.mean(axis=0, keepdims=True)
self.std = y.std(axis=0, keepdims=True)
def transform(self, y: np.array):
z = (y - self.mean) / np.clip(self.std, a_min=0.001, a_max=None)
return z
class SEkernel():
def __init__(self):
self.initialize()
def initialize(self):
# self.sumF = 0.001
# self.sumL = 0.001
# self.sumY = 0.001
self.sigma_f = 1
self.sigma_l = 1 # TODO 之前设的是1
self.sigma_y = 0.001
def compute_kernel(self, x1, x2=None):
if x2 is None:
x2 = x1
x2 = np.atleast_2d(x2)
x1 = np.atleast_2d(x1)
# noise = np.diag([self.sigma_y**2 for _ in range(x1.shape[0])])
noise = np.eye(x1.shape[0]) * self.sigma_y**2
else:
x2 = np.atleast_2d(x2)
x1 = np.atleast_2d(x1)
noise = 0
dist_matrix = np.sum(x1**2, 1).reshape(-1, 1) + np.sum(
x2**2, 1) - 2 * (x1 @ x2.T)
return self.sigma_f**2 * np.exp(
-0.5 / self.sigma_l**2 * dist_matrix) + noise
class GaussianProcessRegressorARD_gpy(Surrogate):
def __init__(self, dim, min_sample=3):
super(GaussianProcessRegressorARD_gpy, self).__init__(dim, min_sample)
self.cached = {}
self.cached_mu_sigma = {}
self.cached_mu_cov = {}
self.kernel = GPy.kern.Matern52(input_dim=dim, ARD=True)
# self.kernel = GPy.kern.RBF(input_dim=self.dim,
# variance=0.001,
# lengthscale=0.5,
# ARD=True)
self.is_fited = False
self.standardlize = False
def fit(self, x, y):
x = np.atleast_2d(x)
if x.shape[0] < self.min_sample:
return
self.is_fited = True
y = np.asarray(y)
if self.standardlize:
self.Y_mean = y.mean()
self.Y_std = y.std()
else:
self.Y_mean = 0
self.Y_std = 1
y = (y - self.Y_mean) / self.Y_std
self.gpr = GPy.models.gp_regression.GPRegression(x, y, self.kernel)
self.gpr.optimize(max_iters=100)
# self.kernel = self.gpr.kern
def predict(self, newX):
assert self.is_fited
return np.squeeze(self.gpr.predict(
np.atleast_2d(newX))[0]) * self.Y_std + self.Y_mean
def cached_predict(self, newX):
key = hash(newX.data.tobytes())
if key in self.cached_mu_sigma:
return self.cached_mu_sigma[key][0]
if key not in self.cached:
self.cached[key] = self.predict(newX)
return self.cached[key]
def predict_with_sigma(self, newX):
assert self.is_fited
if not self.is_fited:
return 0, np.inf
else:
mu, std = self.gpr.predict(np.atleast_2d(newX), full_cov=True)
return np.squeeze(mu) * self.Y_std + self.Y_mean, np.squeeze(
np.sqrt(std)) * self.Y_std
def cached_predict_with_sigma(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached_mu_sigma:
self.cached_mu_sigma[key] = self.predict_with_sigma(newX)
return self.cached_mu_sigma[key]
def predict_with_cov(self, newX):
assert self.is_fited
if not self.is_fited:
return 0, np.inf
else:
mu, cov = self.gpr.predict(np.atleast_2d(newX), full_cov=True)
return np.squeeze(mu) * self.Y_std + self.Y_mean, np.squeeze(
cov) * self.Y_std**2
def cached_predict_with_cov(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached_mu_sigma:
self.cached_mu_cov[key] = self.predict_with_cov(newX)
return self.cached_mu_cov[key]
class GPR_sklearn(BaseGP):
def __init__(
self,
cs,
# min_sample=3,
# alpha=0,
rng=np.random.RandomState(0),
n_opt_restarts: int = 10,
instance_features: typing.Optional[np.ndarray] = None,
pca_components: typing.Optional[int] = None,
**kwargs
):
types, bounds = get_types(cs)
# self.cached = {}
super(GPR_sklearn, self).__init__(cs, types, bounds, rng,instance_features=instance_features,
pca_components=pca_components,**kwargs)
self.is_fited = False
# self.alpha = alpha # Fix RBF kernel error
self.n_opt_restarts = n_opt_restarts
self._n_ll_evals = 0
self._set_has_conditions()
def _get_kernel(self, ):
cov_amp = ConstantKernel(
2.0,
constant_value_bounds=(np.exp(-10), np.exp(2)),
prior=LognormalPrior(mean=0.0, sigma=1.0, rng=self.rng),
)
cont_dims = np.where(np.array(self.types) == 0)[0]
cat_dims = np.where(np.array(self.types) != 0)[0]
if len(cont_dims) > 0:
exp_kernel = Matern(
np.ones([len(cont_dims)]),
[(np.exp(-6.754111155189306), np.exp(0.0858637988771976))
for _ in range(len(cont_dims))],
nu=2.5,
operate_on=cont_dims,
)
if len(cat_dims) > 0:
ham_kernel = HammingKernel(
np.ones([len(cat_dims)]),
[(np.exp(-6.754111155189306), np.exp(0.0858637988771976))
for _ in range(len(cat_dims))],
operate_on=cat_dims,
)
# assert (len(cont_dims) + len(cat_dims)) == len(
# scenario.cs.get_hyperparameters())
noise_kernel = WhiteKernel(
noise_level=1e-8,
noise_level_bounds=(np.exp(-25), np.exp(2)),
prior=HorseshoePrior(scale=0.1, rng=self.rng),
)
if len(cont_dims) > 0 and len(cat_dims) > 0:
# both
kernel = cov_amp * (exp_kernel * ham_kernel) + noise_kernel
elif len(cont_dims) > 0 and len(cat_dims) == 0:
# only cont
kernel = cov_amp * exp_kernel + noise_kernel
elif len(cont_dims) == 0 and len(cat_dims) > 0:
# only cont
kernel = cov_amp * ham_kernel + noise_kernel
else:
raise ValueError()
# kernel = gaussian_process.kernels.ConstantKernel(
# constant_value=1 #, constant_value_bounds=(1e-4, 1e4)
# ) * gaussian_process.kernels.RBF(
# length_scale=1 #, length_scale_bounds=(1e-4, 1e4)
# )
return kernel
def _predict(self,
X_test,
cov_return_type: typing.Optional[str] = 'diagonal_cov'):
'''
return: \mu ,\sigma^2
'''
assert self.is_fited
X_test = self._impute_inactive(X_test)
if cov_return_type is None:
mu = self.gp.predict(X_test)
var = None
if self.normalize_y:
mu = self._untransform_y(mu)
else:
predict_kwargs = {'return_cov': False, 'return_std': True}
if cov_return_type == 'full_cov':
predict_kwargs = {'return_cov': True, 'return_std': False}
mu, var = self.gp.predict(X_test, **predict_kwargs)
if cov_return_type != 'full_cov':
var = var**2 # since we get standard deviation for faster computation
# Clip negative variances and set them to the smallest
# positive float value
var = np.clip(var, VERY_SMALL_NUMBER, np.inf)
if self.normalize_y:
mu, var = self._untransform_y(mu, var)
if cov_return_type == 'diagonal_std':
var = np.sqrt(
var) # converting variance to std deviation if specified
return mu, var
def _get_gp(self) -> gaussian_process.GaussianProcessRegressor:
return gaussian_process.GaussianProcessRegressor(
kernel=self.kernel,
normalize_y=False,
optimizer=None,
n_restarts_optimizer=
-1, # Do not use scikit-learn's optimization routine
alpha=0, # Governed by the kernel
random_state=self.rng,
)
def _nll(self, theta: np.ndarray) -> typing.Tuple[float, np.ndarray]:
"""
Returns the negative marginal log likelihood (+ the prior) for
a hyperparameter configuration theta.
(negative because we use scipy minimize for optimization)
Parameters
----------
theta : np.ndarray(H)
Hyperparameter vector. Note that all hyperparameter are
on a log scale.
Returns
----------
float
lnlikelihood + prior
"""
self._n_ll_evals += 1
try:
lml, grad = self.gp.log_marginal_likelihood(theta, eval_gradient=True)
except np.linalg.LinAlgError:
return 1e25, np.zeros(theta.shape)
for dim, priors in enumerate(self._all_priors):
for prior in priors:
lml += prior.lnprob(theta[dim])
grad[dim] += prior.gradient(theta[dim])
# We add a minus here because scipy is minimizing
if not np.isfinite(lml).all() or not np.all(np.isfinite(grad)):
return 1e25, np.zeros(theta.shape)
else:
return -lml, -grad
def _train(self, X: np.ndarray, y: np.ndarray, **kwargs):
X = np.atleast_2d(X)
X = self._impute_inactive(X)
if self.normalize_y:
y = self._normalize_y(y)
if len(y.shape) == 1:
self.n_objectives_ = 1
else:
self.n_objectives_ = y.shape[1]
if self.n_objectives_ == 1:
y = y.flatten()
n_tries = 10
for i in range(n_tries):
try:
self.gp = self._get_gp() # new model
self.gp.fit(X, y)
break
except np.linalg.LinAlgError as e:
if i == n_tries:
raise e
# Assume that the last entry of theta is the noise
theta = np.exp(self.kernel.theta)
theta[-1] += 1
self.kernel.theta = np.log(theta)
if self.do_optimize:
self._all_priors = self._get_all_priors(add_bound_priors=False)
self.hypers = self._optimize()
self.gp.kernel.theta = self.hypers
self.gp.fit(X, y)
else:
self.hypers = self.gp.kernel.theta
self.is_fited = True
def _get_all_priors(
self,
add_bound_priors: bool = True,
add_soft_bounds: bool = False,
) -> List[List[Prior]]:
# Obtain a list of all priors for each tunable hyperparameter of the kernel
all_priors = []
to_visit = []
to_visit.append(self.gp.kernel.k1)
to_visit.append(self.gp.kernel.k2)
while len(to_visit) > 0:
current_param = to_visit.pop(0)
if isinstance(current_param, KernelOperator):
to_visit.insert(0, current_param.k1)
to_visit.insert(1, current_param.k2)
continue
elif isinstance(current_param, Kernel):
hps = current_param.hyperparameters
assert len(hps) == 1
hp = hps[0]
if hp.fixed:
continue
bounds = hps[0].bounds
for i in range(hps[0].n_elements):
priors_for_hp = []
if current_param.prior is not None:
priors_for_hp.append(current_param.prior)
if add_bound_priors:
if add_soft_bounds:
priors_for_hp.append(
SoftTopHatPrior(
lower_bound=bounds[i][0],
upper_bound=bounds[i][1],
rng=self.rng,
exponent=2,
))
else:
priors_for_hp.append(
TophatPrior(
lower_bound=bounds[i][0],
upper_bound=bounds[i][1],
rng=self.rng,
))
all_priors.append(priors_for_hp)
return all_priors
def _optimize(self) -> np.ndarray:
"""
Optimizes the marginal log likelihood and returns the best found
hyperparameter configuration theta.
Returns
-------
theta : np.ndarray(H)
Hyperparameter vector that maximizes the marginal log likelihood
"""
log_bounds = [(b[0], b[1]) for b in self.gp.kernel.bounds]
# Start optimization from the previous hyperparameter configuration
p0 = [self.gp.kernel.theta]
if self.n_opt_restarts > 0:
dim_samples = []
prior = None # type: typing.Optional[typing.Union[typing.List[Prior], Prior]]
for dim, hp_bound in enumerate(log_bounds):
prior = self._all_priors[dim]
# Always sample from the first prior
if isinstance(prior, list):
if len(prior) == 0:
prior = None
else:
prior = prior[0]
prior = typing.cast(typing.Optional[Prior], prior)
if prior is None:
try:
sample = self.rng.uniform(
low=hp_bound[0],
high=hp_bound[1],
size=(self.n_opt_restarts, ),
)
except OverflowError:
raise ValueError(
'OverflowError while sampling from (%f, %f)' %
(hp_bound[0], hp_bound[1]))
dim_samples.append(sample.flatten())
else:
dim_samples.append(
prior.sample_from_prior(self.n_opt_restarts).flatten())
p0 += list(np.vstack(dim_samples).transpose())
theta_star = None
f_opt_star = np.inf
for i, start_point in enumerate(p0):
theta, f_opt, _ = optimize.fmin_l_bfgs_b(self._nll,
start_point,
bounds=log_bounds)
if f_opt < f_opt_star:
f_opt_star = f_opt
theta_star = theta
return theta_star
def _set_has_conditions(self) -> None:
has_conditions = len(self.configspace.get_conditions()) > 0
to_visit = []
to_visit.append(self.kernel)
while len(to_visit) > 0:
current_param = to_visit.pop(0)
if isinstance(current_param,
sklearn.gaussian_process.kernels.KernelOperator):
to_visit.insert(0, current_param.k1)
to_visit.insert(1, current_param.k2)
current_param.has_conditions = has_conditions
elif isinstance(current_param,
sklearn.gaussian_process.kernels.Kernel):
current_param.has_conditions = has_conditions
else:
raise ValueError(current_param)
class GaussianProcessRegressorARD_sklearn(Surrogate):
def __init__(self, dim, min_sample=3):
super(GaussianProcessRegressorARD_sklearn,
self).__init__(dim, min_sample)
self.cached = {}
kernel = gaussian_process.kernels.ConstantKernel(
constant_value=1 #, constant_value_bounds=(1e-4, 1e4)
) * gaussian_process.kernels.RBF(
length_scale=1 #, length_scale_bounds=(1e-4, 1e4)
)
self.gpr = gaussian_process.GaussianProcessRegressor(
kernel=kernel, n_restarts_optimizer=2)
self.is_fited = False
def fit(self, x, y):
x = np.atleast_2d(x)
if x.shape[0] < self.min_sample:
return
self.gpr.fit(x, y)
self.is_fited = True
def predict(self, newX):
assert self.is_fited
return self.gpr.predict(np.atleast_2d(newX))
def cached_predict(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached:
self.cached[key] = self.predict(newX)
return self.cached[key]
def predict_with_sigma(self, newX):
assert self.is_fited
if not self.is_fited:
return 0, np.inf
else:
mu, std = self.gpr.predict(np.atleast_2d(newX), return_std=True)
return mu, std
class GaussianProcessRegressor(Surrogate):
def __init__(self, dim, min_sample=3):
super().__init__(dim, min_sample)
self.kernel = SEkernel()
self.cached = {}
self.cached_mu_sigma = {}
self.cached_mu_cov = {}
self.is_fited = False
def fit(self, x, y):
x = np.atleast_2d(x)
if x.shape[0] < self.min_sample:
return
self.is_fited = True
self.X = x
kernel = self.kernel.compute_kernel(x)
self.L = cholesky(kernel, lower=True)
_part = solve_triangular(self.L, y, lower=True)
self.KinvY = solve_triangular(self.L.T, _part, lower=False)
def predict(self, newX):
assert self.is_fited
# Kstar = np.squeeze(self.kernel.compute_kernel(self.X, newX))
Kstar = (self.kernel.compute_kernel(self.X, newX))
return (Kstar.T @ self.KinvY).item()
def cached_predict(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached:
self.cached[key] = self.predict(newX)
return self.cached[key]
def predict_with_sigma(self, newX):
assert self.is_fited
if not hasattr(self, 'X'):
return 0, np.inf
else:
Kstar = self.kernel.compute_kernel(self.X, newX)
_LinvKstar = solve_triangular(self.L, Kstar, lower=True)
return np.squeeze(Kstar.T @ self.KinvY), np.sqrt(
self.kernel.compute_kernel(newX) - _LinvKstar.T @ _LinvKstar)
def cached_predict_with_sigma(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached_mu_sigma:
self.cached_mu_sigma[key] = self.predict_with_sigma(newX)
return self.cached_mu_sigma[key]
def cached_predict_with_cov(self, newX):
key = hash(newX.data.tobytes())
if key not in self.cached_mu_cov:
self.cached_mu_cov[key] = self.predict_with_cov(newX)
return self.cached_mu_cov[key]
def predict_with_cov(self, newX):
assert self.is_fited
if not hasattr(self, 'X'):
return 0, np.inf
else:
Kstar = self.kernel.compute_kernel(self.X, newX)
_LinvKstar = solve_triangular(self.L, Kstar, lower=True)
return np.squeeze(
Kstar.T @ self.KinvY), (self.kernel.compute_kernel(newX) -
_LinvKstar.T @ _LinvKstar)
class GaussianProcessRegressorARD_torch(Surrogate):
def __init__(self, dim, min_sample=4, name='standard'):
from botorch.models import SingleTaskGP, FixedNoiseGP
from botorch import fit_gpytorch_model
from botorch.optim import optimize_acqf
from gpytorch import ExactMarginalLogLikelihood
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.constraints import GreaterThan
Surrogate.__init__(self, dim, min_sample)
# self.cached = {}
# self.cached_mu_sigma = {}
# self.cached_mu_cov = {}
self.is_fited = False
assert name in ["standard", "gaussian"]
mapping = {
"standard": StandardTransform,
"gaussian": GaussianTransform,
}
self.normalizer = mapping[name]
# self.observed_z = torch.empty(size=(0, dim))
self.y_observed = torch.empty(size=(0, 1))
self.X_observed = torch.empty(size=(0, dim))
def transform_outputs(self, y: np.array):
# return y # TODO
psi = self.normalizer(y)
z = psi.transform(y)
return z
def fit(self, x, y):
self.X_observed = torch.cat((self.X_observed, torch.Tensor(x)), dim=0)
self.y_observed = torch.cat(
(self.y_observed, torch.Tensor(y).unsqueeze(1)), dim=0)
# x = torch.atleast_2d(x)
if self.X_observed.shape[-2] < self.min_sample:
return
self.is_fited = True
# if y.ndim == 1:
# y = y[..., None]
self.z_observed = torch.Tensor(
self.transform_outputs(self.y_observed.cpu().numpy()))
# self.gpr = SingleTaskGP(
# train_X=self.X_observed,
# train_Y=self.z_observed,
# # special likelihood for numerical Cholesky errors, following advice from
# # https://www.gitmemory.com/issue/pytorch/botorch/179/506276521
# # likelihood=GaussianLikelihood(noise_constraint=GreaterThan(1e-3)),
# )
self.gpr = FixedNoiseGP(
train_X=self.X_observed,
train_Y=self.z_observed,
train_Yvar=torch.full_like(self.z_observed, 1)
# special likelihood for numerical Cholesky errors, following advice from
# https://www.gitmemory.com/issue/pytorch/botorch/179/506276521
# likelihood=GaussianLikelihood(noise_constraint=GreaterThan(1e-3)),
)
mll = ExactMarginalLogLikelihood(self.gpr.likelihood, self.gpr)
# with gpytorch.settings.cholesky_jitter(1e-1):
fit_gpytorch_model(mll)
def get_posterior(self, newX):
assert self.is_fited
return self.gpr.posterior(torch.atleast_2d(newX))
| [
1,
529,
276,
1112,
420,
29958,
17599,
2521,
29875,
29896,
29896,
29955,
29906,
29914,
1327,
29217,
16580,
13,
3166,
19229,
1053,
2391,
13,
5215,
19229,
13,
3166,
4560,
2272,
1053,
24656,
13,
5215,
2071,
19668,
13,
29937,
515,
2071,
19668,
29889,
29887,
17019,
29918,
5014,
1053,
413,
824,
1379,
13,
3166,
2071,
19668,
29889,
29887,
17019,
29918,
5014,
29889,
22178,
1379,
1053,
476,
5851,
29892,
476,
5851,
26486,
13,
29937,
1053,
4842,
305,
13,
29937,
515,
4560,
2272,
29889,
29880,
979,
29887,
1053,
4505,
29918,
3626,
6825,
29892,
521,
6544,
3459,
13,
29937,
515,
4560,
2272,
1053,
24656,
29892,
22663,
13,
5215,
12655,
408,
7442,
13,
29937,
1053,
402,
19737,
13,
3166,
2071,
19668,
1053,
330,
17019,
29918,
5014,
13,
29937,
515,
9225,
25350,
29889,
562,
23493,
1053,
1222,
6021,
1888,
16123,
882,
13,
13,
3166,
921,
29890,
833,
29889,
7610,
9102,
403,
29889,
3188,
1053,
6298,
9102,
403,
29892,
7399,
19903,
13,
3166,
921,
29890,
833,
29889,
7610,
9102,
403,
29889,
29887,
29886,
29918,
22178,
1379,
1053,
7904,
4056,
29968,
5851,
29892,
5345,
824,
29892,
28601,
29968,
5851,
29892,
8037,
29968,
5851,
13,
3166,
921,
29890,
833,
29889,
7610,
9102,
403,
29889,
29887,
29886,
29918,
29886,
13479,
1053,
379,
943,
267,
1251,
29872,
29925,
13479,
29892,
365,
3811,
2759,
29925,
13479,
29892,
22096,
29892,
1105,
615,
7031,
29950,
271,
29925,
13479,
29892,
7488,
2455,
29925,
13479,
13,
3166,
921,
29890,
833,
29889,
13239,
29889,
4422,
1053,
679,
29918,
8768,
13,
13,
5348,
29979,
29918,
29903,
1529,
2208,
29918,
23207,
353,
29871,
29896,
29872,
29899,
29896,
29900,
13,
13,
13,
1990,
22477,
13372,
29901,
13,
1678,
9995,
13,
1678,
4103,
689,
848,
964,
22477,
491,
15399,
282,
1039,
353,
1963,
29875,
3426,
29896,
29913,
288,
383,
988,
383,
338,
278,
21022,
630,
17522,
4037,
29889,
13,
1678,
584,
3207,
343,
29901,
8267,
313,
29876,
29892,
3964,
29897,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
343,
29901,
7442,
29889,
2378,
1125,
13,
4706,
4974,
343,
29889,
299,
326,
1275,
29871,
29906,
13,
4706,
1583,
29889,
6229,
353,
343,
29889,
12181,
29961,
29896,
29962,
13,
4706,
1583,
29889,
24582,
353,
343,
29889,
8552,
580,
13,
4706,
1583,
29889,
24582,
29889,
6605,
29898,
8990,
29922,
29900,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
503,
29918,
9067,
29898,
13757,
29892,
1819,
29918,
24582,
29922,
8516,
1125,
13,
4706,
396,
16058,
21022,
630,
17522,
4037,
769,
16402,
22477,
315,
4037,
29889,
13,
4706,
565,
1819,
29918,
24582,
338,
6213,
29901,
13,
9651,
1819,
29918,
24582,
353,
12705,
29898,
13757,
29897,
13,
13,
4706,
822,
21614,
272,
1891,
29918,
4181,
29898,
29876,
1125,
13,
9651,
736,
29871,
29896,
29889,
29900,
847,
313,
29946,
29889,
29900,
334,
302,
1068,
29900,
29889,
29906,
29945,
334,
7442,
29889,
3676,
29898,
9302,
29889,
1631,
334,
7442,
29889,
1188,
29898,
29876,
4961,
13,
13,
4706,
19471,
353,
21614,
272,
1891,
29918,
4181,
29898,
2435,
29898,
13757,
876,
13,
13,
4706,
822,
4323,
488,
29898,
5975,
29918,
24582,
29892,
1819,
29918,
517,
29918,
7851,
29892,
19471,
1125,
13,
9651,
620,
353,
7442,
29889,
4478,
24582,
29898,
5975,
29918,
24582,
29892,
13,
462,
462,
29871,
1819,
29918,
517,
29918,
7851,
29897,
847,
7431,
29898,
5975,
29918,
24582,
29897,
13,
9651,
736,
7442,
29889,
24049,
29898,
690,
29892,
263,
29918,
1195,
29922,
4181,
29892,
263,
29918,
3317,
29922,
29896,
448,
19471,
29897,
13,
13,
4706,
4323,
5475,
353,
4323,
488,
29898,
5975,
29918,
24582,
29892,
3652,
29892,
19471,
29897,
13,
13,
4706,
4323,
5475,
353,
7442,
29889,
24049,
29898,
12150,
5475,
29892,
263,
29918,
1195,
29922,
4181,
29892,
263,
29918,
3317,
29922,
29896,
448,
19471,
29897,
13,
13,
4706,
736,
22663,
29889,
12324,
29889,
407,
29888,
29898,
12150,
5475,
29897,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
343,
29901,
7442,
29889,
2378,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
343,
29901,
8267,
313,
29876,
29892,
3964,
29897,
13,
4706,
584,
2457,
29901,
8267,
313,
29876,
29892,
3964,
511,
13235,
3412,
263,
4226,
13,
4706,
9995,
13,
4706,
4974,
343,
29889,
12181,
29961,
29896,
29962,
1275,
1583,
29889,
6229,
13,
4706,
396,
10272,
21022,
630,
4323,
488,
29892,
3394,
330,
17019,
2437,
274,
2176,
13,
4706,
736,
7442,
29889,
1429,
4197,
13,
9651,
1583,
29889,
29920,
29918,
9067,
29898,
29891,
7503,
29892,
474,
1402,
1583,
29889,
24582,
7503,
29892,
474,
2314,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
6229,
29897,
13,
4706,
4514,
467,
29911,
13,
13,
13,
1990,
10117,
13372,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
343,
29901,
7442,
29889,
2378,
1125,
13,
4706,
4974,
343,
29889,
299,
326,
1275,
29871,
29906,
13,
4706,
1583,
29889,
6229,
353,
343,
29889,
12181,
29961,
29896,
29962,
13,
4706,
1583,
29889,
12676,
353,
343,
29889,
12676,
29898,
8990,
29922,
29900,
29892,
3013,
6229,
29879,
29922,
5574,
29897,
13,
4706,
1583,
29889,
4172,
353,
343,
29889,
4172,
29898,
8990,
29922,
29900,
29892,
3013,
6229,
29879,
29922,
5574,
29897,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
343,
29901,
7442,
29889,
2378,
1125,
13,
4706,
503,
353,
313,
29891,
448,
1583,
29889,
12676,
29897,
847,
7442,
29889,
24049,
29898,
1311,
29889,
4172,
29892,
263,
29918,
1195,
29922,
29900,
29889,
29900,
29900,
29896,
29892,
263,
29918,
3317,
29922,
8516,
29897,
13,
4706,
736,
503,
13,
13,
13,
1990,
3725,
17460,
7295,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
24926,
580,
13,
13,
1678,
822,
11905,
29898,
1311,
1125,
13,
4706,
396,
1583,
29889,
2083,
29943,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
4706,
396,
1583,
29889,
2083,
29931,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
4706,
396,
1583,
29889,
2083,
29979,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
4706,
1583,
29889,
3754,
29918,
29888,
353,
29871,
29896,
13,
4706,
1583,
29889,
3754,
29918,
29880,
353,
29871,
29896,
29871,
396,
14402,
29871,
30577,
30658,
30872,
30210,
30392,
29896,
13,
4706,
1583,
29889,
3754,
29918,
29891,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
13,
1678,
822,
10272,
29918,
17460,
29898,
1311,
29892,
921,
29896,
29892,
921,
29906,
29922,
8516,
1125,
13,
4706,
565,
921,
29906,
338,
6213,
29901,
13,
9651,
921,
29906,
353,
921,
29896,
13,
9651,
921,
29906,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29906,
29897,
13,
9651,
921,
29896,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29896,
29897,
13,
9651,
396,
11462,
353,
7442,
29889,
6051,
351,
4197,
1311,
29889,
3754,
29918,
29891,
1068,
29906,
363,
903,
297,
3464,
29898,
29916,
29896,
29889,
12181,
29961,
29900,
2314,
2314,
13,
9651,
11462,
353,
7442,
29889,
1032,
29872,
29898,
29916,
29896,
29889,
12181,
29961,
29900,
2314,
334,
1583,
29889,
3754,
29918,
29891,
1068,
29906,
13,
4706,
1683,
29901,
13,
9651,
921,
29906,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29906,
29897,
13,
9651,
921,
29896,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29896,
29897,
13,
9651,
11462,
353,
29871,
29900,
13,
4706,
1320,
29918,
5344,
353,
7442,
29889,
2083,
29898,
29916,
29896,
1068,
29906,
29892,
29871,
29896,
467,
690,
14443,
6278,
29896,
29892,
29871,
29896,
29897,
718,
7442,
29889,
2083,
29898,
13,
9651,
921,
29906,
1068,
29906,
29892,
29871,
29896,
29897,
448,
29871,
29906,
334,
313,
29916,
29896,
732,
921,
29906,
29889,
29911,
29897,
13,
4706,
736,
1583,
29889,
3754,
29918,
29888,
1068,
29906,
334,
7442,
29889,
4548,
29898,
13,
9651,
448,
29900,
29889,
29945,
847,
1583,
29889,
3754,
29918,
29880,
1068,
29906,
334,
1320,
29918,
5344,
29897,
718,
11462,
13,
13,
13,
1990,
22477,
7032,
4597,
1253,
272,
17011,
29918,
29887,
2272,
29898,
18498,
9102,
403,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29892,
1375,
29918,
11249,
29922,
29941,
1125,
13,
4706,
2428,
29898,
29954,
17019,
7032,
4597,
1253,
272,
17011,
29918,
29887,
2272,
29892,
1583,
467,
1649,
2344,
12035,
6229,
29892,
1375,
29918,
11249,
29897,
13,
4706,
1583,
29889,
29883,
3791,
353,
6571,
13,
4706,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
353,
6571,
13,
4706,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
353,
6571,
13,
4706,
1583,
29889,
17460,
353,
402,
19737,
29889,
22178,
29889,
9782,
824,
29945,
29906,
29898,
2080,
29918,
6229,
29922,
6229,
29892,
9033,
29928,
29922,
5574,
29897,
13,
4706,
396,
1583,
29889,
17460,
353,
402,
19737,
29889,
22178,
29889,
29934,
28062,
29898,
2080,
29918,
6229,
29922,
1311,
29889,
6229,
29892,
13,
4706,
396,
462,
539,
20162,
29922,
29900,
29889,
29900,
29900,
29896,
29892,
13,
4706,
396,
462,
539,
3309,
7052,
29922,
29900,
29889,
29945,
29892,
13,
4706,
396,
462,
539,
9033,
29928,
29922,
5574,
29897,
13,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
7700,
13,
4706,
1583,
29889,
15770,
29880,
675,
353,
7700,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
921,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29897,
13,
4706,
565,
921,
29889,
12181,
29961,
29900,
29962,
529,
1583,
29889,
1195,
29918,
11249,
29901,
13,
9651,
736,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
5852,
13,
4706,
343,
353,
7442,
29889,
294,
2378,
29898,
29891,
29897,
13,
4706,
565,
1583,
29889,
15770,
29880,
675,
29901,
13,
9651,
1583,
29889,
29979,
29918,
12676,
353,
343,
29889,
12676,
580,
13,
9651,
1583,
29889,
29979,
29918,
4172,
353,
343,
29889,
4172,
580,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29979,
29918,
12676,
353,
29871,
29900,
13,
9651,
1583,
29889,
29979,
29918,
4172,
353,
29871,
29896,
13,
13,
4706,
343,
353,
313,
29891,
448,
1583,
29889,
29979,
29918,
12676,
29897,
847,
1583,
29889,
29979,
29918,
4172,
13,
4706,
1583,
29889,
29887,
558,
353,
402,
19737,
29889,
9794,
29889,
29887,
29886,
29918,
276,
11476,
29889,
19903,
4597,
23881,
29898,
29916,
29892,
343,
29892,
1583,
29889,
17460,
29897,
13,
4706,
1583,
29889,
29887,
558,
29889,
20640,
675,
29898,
3317,
29918,
277,
414,
29922,
29896,
29900,
29900,
29897,
13,
4706,
396,
1583,
29889,
17460,
353,
1583,
29889,
29887,
558,
29889,
22178,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
1311,
29889,
29887,
558,
29889,
27711,
29898,
13,
9651,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
876,
29961,
29900,
2314,
334,
1583,
29889,
29979,
29918,
4172,
718,
1583,
29889,
29979,
29918,
12676,
13,
13,
1678,
822,
22152,
29918,
27711,
29898,
1311,
29892,
716,
29990,
1125,
13,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
297,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29901,
13,
9651,
736,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29961,
1989,
3816,
29900,
29962,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
13,
13,
1678,
822,
8500,
29918,
2541,
29918,
3754,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
565,
451,
1583,
29889,
275,
29918,
29888,
1573,
29901,
13,
9651,
736,
29871,
29900,
29892,
7442,
29889,
7192,
13,
4706,
1683,
29901,
13,
9651,
3887,
29892,
3659,
353,
1583,
29889,
29887,
558,
29889,
27711,
29898,
9302,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
511,
2989,
29918,
24542,
29922,
5574,
29897,
13,
9651,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
2589,
29897,
334,
1583,
29889,
29979,
29918,
4172,
718,
1583,
29889,
29979,
29918,
12676,
29892,
7442,
29889,
29879,
802,
29872,
911,
29898,
13,
18884,
7442,
29889,
3676,
29898,
4172,
876,
334,
1583,
29889,
29979,
29918,
4172,
13,
13,
1678,
822,
22152,
29918,
27711,
29918,
2541,
29918,
3754,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29918,
2541,
29918,
3754,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29961,
1989,
29962,
13,
13,
1678,
822,
8500,
29918,
2541,
29918,
24542,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
565,
451,
1583,
29889,
275,
29918,
29888,
1573,
29901,
13,
9651,
736,
29871,
29900,
29892,
7442,
29889,
7192,
13,
4706,
1683,
29901,
13,
9651,
3887,
29892,
18838,
353,
1583,
29889,
29887,
558,
29889,
27711,
29898,
9302,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
511,
2989,
29918,
24542,
29922,
5574,
29897,
13,
9651,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
2589,
29897,
334,
1583,
29889,
29979,
29918,
4172,
718,
1583,
29889,
29979,
29918,
12676,
29892,
7442,
29889,
29879,
802,
29872,
911,
29898,
13,
18884,
18838,
29897,
334,
1583,
29889,
29979,
29918,
4172,
1068,
29906,
13,
13,
1678,
822,
22152,
29918,
27711,
29918,
2541,
29918,
24542,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29918,
2541,
29918,
24542,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
29961,
1989,
29962,
13,
13,
13,
1990,
402,
10593,
29918,
808,
19668,
29898,
5160,
19903,
1125,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
5939,
29892,
13,
4706,
396,
29871,
1375,
29918,
11249,
29922,
29941,
29892,
13,
4706,
396,
15595,
29922,
29900,
29892,
13,
4706,
364,
865,
29922,
9302,
29889,
8172,
29889,
17875,
2792,
29898,
29900,
511,
13,
4706,
302,
29918,
3670,
29918,
5060,
5708,
29901,
938,
353,
29871,
29896,
29900,
29892,
13,
4706,
2777,
29918,
22100,
29901,
19229,
29889,
27636,
29961,
9302,
29889,
299,
2378,
29962,
353,
6213,
29892,
13,
4706,
282,
1113,
29918,
14036,
29901,
19229,
29889,
27636,
29961,
524,
29962,
353,
6213,
29892,
13,
4706,
3579,
19290,
13,
268,
1125,
13,
4706,
4072,
29892,
13451,
353,
679,
29918,
8768,
29898,
2395,
29897,
13,
4706,
396,
1583,
29889,
29883,
3791,
353,
6571,
13,
13,
4706,
2428,
29898,
29954,
10593,
29918,
808,
19668,
29892,
1583,
467,
1649,
2344,
12035,
2395,
29892,
4072,
29892,
13451,
29892,
364,
865,
29892,
8758,
29918,
22100,
29922,
8758,
29918,
22100,
29892,
13,
9651,
282,
1113,
29918,
14036,
29922,
29886,
1113,
29918,
14036,
29892,
1068,
19290,
29897,
13,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
7700,
13,
4706,
396,
1583,
29889,
2312,
353,
15595,
29871,
396,
24778,
390,
28062,
8466,
1059,
13,
4706,
1583,
29889,
29876,
29918,
3670,
29918,
5060,
5708,
353,
302,
29918,
3670,
29918,
5060,
5708,
13,
4706,
1583,
3032,
29876,
29918,
645,
29918,
14513,
29879,
353,
29871,
29900,
13,
4706,
1583,
3032,
842,
29918,
5349,
29918,
1116,
2187,
580,
13,
13,
1678,
822,
903,
657,
29918,
17460,
29898,
1311,
29892,
29871,
1125,
13,
4706,
18838,
29918,
1160,
353,
28601,
29968,
5851,
29898,
13,
632,
29906,
29889,
29900,
29892,
13,
9651,
4868,
29918,
1767,
29918,
23687,
7607,
9302,
29889,
4548,
6278,
29896,
29900,
511,
7442,
29889,
4548,
29898,
29906,
8243,
13,
9651,
7536,
29922,
3403,
8945,
29925,
13479,
29898,
12676,
29922,
29900,
29889,
29900,
29892,
269,
2934,
29922,
29896,
29889,
29900,
29892,
364,
865,
29922,
1311,
29889,
29878,
865,
511,
13,
4706,
1723,
13,
13,
4706,
640,
29918,
6229,
29879,
353,
7442,
29889,
3062,
29898,
9302,
29889,
2378,
29898,
1311,
29889,
8768,
29897,
1275,
29871,
29900,
9601,
29900,
29962,
13,
4706,
6635,
29918,
6229,
29879,
353,
7442,
29889,
3062,
29898,
9302,
29889,
2378,
29898,
1311,
29889,
8768,
29897,
2804,
29871,
29900,
9601,
29900,
29962,
13,
13,
4706,
565,
7431,
29898,
1285,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1518,
29918,
17460,
353,
5345,
824,
29898,
13,
18884,
7442,
29889,
2873,
4197,
2435,
29898,
1285,
29918,
6229,
29879,
4638,
511,
13,
18884,
17288,
9302,
29889,
4548,
6278,
29953,
29889,
29955,
29945,
29946,
29896,
29896,
29896,
29896,
29945,
29945,
29896,
29947,
29929,
29941,
29900,
29953,
511,
7442,
29889,
4548,
29898,
29900,
29889,
29900,
29947,
29945,
29947,
29953,
29941,
29955,
29929,
29947,
29947,
29955,
29955,
29896,
29929,
29955,
29953,
876,
13,
462,
363,
903,
297,
3464,
29898,
2435,
29898,
1285,
29918,
6229,
29879,
876,
1402,
13,
18884,
4948,
29922,
29906,
29889,
29945,
29892,
13,
18884,
21994,
29918,
265,
29922,
1285,
29918,
6229,
29879,
29892,
13,
9651,
1723,
13,
13,
4706,
565,
7431,
29898,
4117,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
29901,
13,
9651,
16366,
29918,
17460,
353,
7904,
4056,
29968,
5851,
29898,
13,
18884,
7442,
29889,
2873,
4197,
2435,
29898,
4117,
29918,
6229,
29879,
4638,
511,
13,
18884,
17288,
9302,
29889,
4548,
6278,
29953,
29889,
29955,
29945,
29946,
29896,
29896,
29896,
29896,
29945,
29945,
29896,
29947,
29929,
29941,
29900,
29953,
511,
7442,
29889,
4548,
29898,
29900,
29889,
29900,
29947,
29945,
29947,
29953,
29941,
29955,
29929,
29947,
29947,
29955,
29955,
29896,
29929,
29955,
29953,
876,
13,
462,
363,
903,
297,
3464,
29898,
2435,
29898,
4117,
29918,
6229,
29879,
876,
1402,
13,
18884,
21994,
29918,
265,
29922,
4117,
29918,
6229,
29879,
29892,
13,
9651,
1723,
13,
13,
4706,
396,
4974,
313,
2435,
29898,
1285,
29918,
6229,
29879,
29897,
718,
7431,
29898,
4117,
29918,
6229,
29879,
876,
1275,
7431,
29898,
13,
4706,
396,
268,
10483,
29889,
2395,
29889,
657,
29918,
24947,
16744,
3101,
13,
13,
4706,
11462,
29918,
17460,
353,
8037,
29968,
5851,
29898,
13,
9651,
11462,
29918,
5563,
29922,
29896,
29872,
29899,
29947,
29892,
13,
9651,
11462,
29918,
5563,
29918,
23687,
7607,
9302,
29889,
4548,
6278,
29906,
29945,
511,
7442,
29889,
4548,
29898,
29906,
8243,
13,
9651,
7536,
29922,
29950,
943,
267,
1251,
29872,
29925,
13479,
29898,
7052,
29922,
29900,
29889,
29896,
29892,
364,
865,
29922,
1311,
29889,
29878,
865,
511,
13,
4706,
1723,
13,
13,
4706,
565,
7431,
29898,
1285,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
322,
7431,
29898,
4117,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
29901,
13,
9651,
396,
1716,
13,
9651,
8466,
353,
18838,
29918,
1160,
334,
313,
4548,
29918,
17460,
334,
16366,
29918,
17460,
29897,
718,
11462,
29918,
17460,
13,
4706,
25342,
7431,
29898,
1285,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
322,
7431,
29898,
4117,
29918,
6229,
29879,
29897,
1275,
29871,
29900,
29901,
13,
9651,
396,
871,
640,
13,
9651,
8466,
353,
18838,
29918,
1160,
334,
1518,
29918,
17460,
718,
11462,
29918,
17460,
13,
4706,
25342,
7431,
29898,
1285,
29918,
6229,
29879,
29897,
1275,
29871,
29900,
322,
7431,
29898,
4117,
29918,
6229,
29879,
29897,
1405,
29871,
29900,
29901,
13,
9651,
396,
871,
640,
13,
9651,
8466,
353,
18838,
29918,
1160,
334,
16366,
29918,
17460,
718,
11462,
29918,
17460,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
580,
13,
4706,
396,
8466,
353,
330,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
12075,
424,
29968,
5851,
29898,
13,
4706,
396,
268,
4868,
29918,
1767,
29922,
29896,
29871,
396,
29892,
4868,
29918,
1767,
29918,
23687,
7607,
29896,
29872,
29899,
29946,
29892,
29871,
29896,
29872,
29946,
29897,
13,
4706,
396,
1723,
334,
330,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
29934,
28062,
29898,
13,
4706,
396,
268,
3309,
29918,
7052,
29922,
29896,
29871,
396,
29892,
3309,
29918,
7052,
29918,
23687,
7607,
29896,
29872,
29899,
29946,
29892,
29871,
29896,
29872,
29946,
29897,
13,
4706,
396,
1723,
13,
4706,
736,
8466,
13,
13,
1678,
822,
903,
27711,
29898,
1311,
29892,
13,
18884,
1060,
29918,
1688,
29892,
13,
18884,
18838,
29918,
2457,
29918,
1853,
29901,
19229,
29889,
27636,
29961,
710,
29962,
353,
525,
6051,
351,
7177,
29918,
24542,
29374,
13,
4706,
14550,
13,
4706,
736,
29901,
320,
2589,
1919,
29905,
3754,
29985,
29906,
13,
4706,
14550,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
1060,
29918,
1688,
353,
1583,
3032,
326,
649,
29872,
29918,
262,
4925,
29898,
29990,
29918,
1688,
29897,
13,
4706,
565,
18838,
29918,
2457,
29918,
1853,
338,
6213,
29901,
13,
9651,
3887,
353,
1583,
29889,
29887,
29886,
29889,
27711,
29898,
29990,
29918,
1688,
29897,
13,
9651,
722,
353,
6213,
13,
13,
9651,
565,
1583,
29889,
8945,
675,
29918,
29891,
29901,
13,
18884,
3887,
353,
1583,
3032,
348,
9067,
29918,
29891,
29898,
2589,
29897,
13,
13,
4706,
1683,
29901,
13,
9651,
8500,
29918,
19290,
353,
11117,
2457,
29918,
24542,
2396,
7700,
29892,
525,
2457,
29918,
4172,
2396,
5852,
29913,
13,
9651,
565,
18838,
29918,
2457,
29918,
1853,
1275,
525,
8159,
29918,
24542,
2396,
13,
18884,
8500,
29918,
19290,
353,
11117,
2457,
29918,
24542,
2396,
5852,
29892,
525,
2457,
29918,
4172,
2396,
7700,
29913,
13,
13,
9651,
3887,
29892,
722,
353,
1583,
29889,
29887,
29886,
29889,
27711,
29898,
29990,
29918,
1688,
29892,
3579,
27711,
29918,
19290,
29897,
13,
13,
9651,
565,
18838,
29918,
2457,
29918,
1853,
2804,
525,
8159,
29918,
24542,
2396,
13,
18884,
722,
353,
722,
1068,
29906,
29871,
396,
1951,
591,
679,
3918,
29522,
363,
8473,
16287,
13,
13,
9651,
396,
315,
3466,
8178,
722,
713,
778,
322,
731,
963,
304,
278,
19087,
13,
9651,
396,
6374,
5785,
995,
13,
9651,
722,
353,
7442,
29889,
24049,
29898,
1707,
29892,
478,
24422,
29918,
29903,
1529,
2208,
29918,
23207,
29892,
7442,
29889,
7192,
29897,
13,
13,
9651,
565,
1583,
29889,
8945,
675,
29918,
29891,
29901,
13,
18884,
3887,
29892,
722,
353,
1583,
3032,
348,
9067,
29918,
29891,
29898,
2589,
29892,
722,
29897,
13,
13,
9651,
565,
18838,
29918,
2457,
29918,
1853,
1275,
525,
6051,
351,
7177,
29918,
4172,
2396,
13,
18884,
722,
353,
7442,
29889,
3676,
29898,
13,
462,
1678,
722,
29897,
29871,
396,
17415,
20162,
304,
3659,
29522,
565,
6790,
13,
13,
4706,
736,
3887,
29892,
722,
13,
13,
1678,
822,
903,
657,
29918,
29887,
29886,
29898,
1311,
29897,
1599,
330,
17019,
29918,
5014,
29889,
29954,
17019,
7032,
4597,
1253,
272,
29901,
13,
4706,
736,
330,
17019,
29918,
5014,
29889,
29954,
17019,
7032,
4597,
1253,
272,
29898,
13,
9651,
8466,
29922,
1311,
29889,
17460,
29892,
13,
9651,
4226,
675,
29918,
29891,
29922,
8824,
29892,
13,
9651,
5994,
3950,
29922,
8516,
29892,
13,
9651,
302,
29918,
5060,
5708,
29918,
20640,
3950,
29922,
13,
9651,
448,
29896,
29892,
29871,
396,
1938,
451,
671,
4560,
7354,
29899,
19668,
29915,
29879,
13883,
26529,
13,
9651,
15595,
29922,
29900,
29892,
29871,
396,
6769,
287,
491,
278,
8466,
13,
9651,
4036,
29918,
3859,
29922,
1311,
29889,
29878,
865,
29892,
13,
4706,
1723,
13,
268,
13,
1678,
822,
903,
29876,
645,
29898,
1311,
29892,
278,
941,
29901,
7442,
29889,
299,
2378,
29897,
1599,
19229,
29889,
23215,
552,
29961,
7411,
29892,
7442,
29889,
299,
2378,
5387,
13,
4706,
9995,
13,
4706,
16969,
278,
8178,
15276,
979,
1480,
4188,
22342,
20532,
278,
7536,
29897,
363,
13,
4706,
263,
11266,
15501,
5285,
278,
941,
29889,
13,
4706,
313,
22198,
1363,
591,
671,
4560,
2272,
6260,
675,
363,
13883,
29897,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
278,
941,
584,
7442,
29889,
299,
2378,
29898,
29950,
29897,
13,
9651,
26078,
15501,
4608,
29889,
3940,
393,
599,
11266,
15501,
526,
13,
9651,
373,
263,
1480,
6287,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
1378,
29899,
13,
4706,
5785,
13,
9651,
301,
29876,
5081,
22342,
718,
7536,
13,
4706,
9995,
13,
4706,
1583,
3032,
29876,
29918,
645,
29918,
14513,
29879,
4619,
29871,
29896,
13,
13,
4706,
1018,
29901,
13,
9651,
301,
828,
29892,
4656,
353,
1583,
29889,
29887,
29886,
29889,
1188,
29918,
29885,
1191,
979,
29918,
5081,
22342,
29898,
3416,
29892,
19745,
29918,
24970,
29922,
5574,
29897,
13,
4706,
5174,
7442,
29889,
29880,
979,
29887,
29889,
11667,
22461,
2392,
29901,
13,
9651,
736,
29871,
29896,
29872,
29906,
29945,
29892,
7442,
29889,
3298,
359,
29898,
3416,
29889,
12181,
29897,
13,
13,
4706,
363,
3964,
29892,
3691,
943,
297,
26985,
29898,
1311,
3032,
497,
29918,
29886,
28739,
1125,
13,
9651,
363,
7536,
297,
3691,
943,
29901,
13,
18884,
301,
828,
4619,
7536,
29889,
3083,
22795,
29898,
3416,
29961,
6229,
2314,
13,
18884,
4656,
29961,
6229,
29962,
4619,
7536,
29889,
24970,
29898,
3416,
29961,
6229,
2314,
13,
13,
4706,
396,
1334,
788,
263,
26134,
1244,
1363,
4560,
2272,
338,
6260,
5281,
13,
4706,
565,
451,
7442,
29889,
4492,
262,
568,
29898,
29880,
828,
467,
497,
580,
470,
451,
7442,
29889,
497,
29898,
9302,
29889,
4492,
262,
568,
29898,
5105,
22164,
13,
9651,
736,
29871,
29896,
29872,
29906,
29945,
29892,
7442,
29889,
3298,
359,
29898,
3416,
29889,
12181,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
448,
29880,
828,
29892,
448,
5105,
13,
13,
1678,
822,
903,
14968,
29898,
1311,
29892,
1060,
29901,
7442,
29889,
299,
2378,
29892,
343,
29901,
7442,
29889,
299,
2378,
29892,
3579,
19290,
1125,
13,
4706,
1060,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29990,
29897,
13,
4706,
1060,
353,
1583,
3032,
326,
649,
29872,
29918,
262,
4925,
29898,
29990,
29897,
13,
4706,
565,
1583,
29889,
8945,
675,
29918,
29891,
29901,
13,
9651,
343,
353,
1583,
3032,
8945,
675,
29918,
29891,
29898,
29891,
29897,
13,
4706,
565,
7431,
29898,
29891,
29889,
12181,
29897,
1275,
29871,
29896,
29901,
13,
9651,
1583,
29889,
29876,
29918,
3318,
3145,
29918,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29876,
29918,
3318,
3145,
29918,
353,
343,
29889,
12181,
29961,
29896,
29962,
13,
4706,
565,
1583,
29889,
29876,
29918,
3318,
3145,
29918,
1275,
29871,
29896,
29901,
13,
9651,
343,
353,
343,
29889,
1579,
8606,
580,
13,
13,
4706,
302,
29918,
29873,
2722,
353,
29871,
29896,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
29876,
29918,
29873,
2722,
1125,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
29887,
29886,
353,
1583,
3032,
657,
29918,
29887,
29886,
580,
29871,
396,
716,
1904,
13,
18884,
1583,
29889,
29887,
29886,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
18884,
2867,
13,
9651,
5174,
7442,
29889,
29880,
979,
29887,
29889,
11667,
22461,
2392,
408,
321,
29901,
13,
18884,
565,
474,
1275,
302,
29918,
29873,
2722,
29901,
13,
462,
1678,
12020,
321,
13,
18884,
396,
22680,
393,
278,
1833,
6251,
310,
278,
941,
338,
278,
11462,
13,
18884,
278,
941,
353,
7442,
29889,
4548,
29898,
1311,
29889,
17460,
29889,
3416,
29897,
13,
18884,
278,
941,
14352,
29896,
29962,
4619,
29871,
29896,
13,
18884,
1583,
29889,
17460,
29889,
3416,
353,
7442,
29889,
1188,
29898,
3416,
29897,
13,
4706,
565,
1583,
29889,
1867,
29918,
20640,
675,
29901,
13,
9651,
1583,
3032,
497,
29918,
29886,
28739,
353,
1583,
3032,
657,
29918,
497,
29918,
29886,
28739,
29898,
1202,
29918,
9917,
29918,
29886,
28739,
29922,
8824,
29897,
13,
9651,
1583,
29889,
29882,
1478,
414,
353,
1583,
3032,
20640,
675,
580,
13,
9651,
1583,
29889,
29887,
29886,
29889,
17460,
29889,
3416,
353,
1583,
29889,
29882,
1478,
414,
13,
9651,
1583,
29889,
29887,
29886,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29882,
1478,
414,
353,
1583,
29889,
29887,
29886,
29889,
17460,
29889,
3416,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
5852,
13,
13,
1678,
822,
903,
657,
29918,
497,
29918,
29886,
28739,
29898,
13,
4706,
1583,
29892,
13,
4706,
788,
29918,
9917,
29918,
29886,
28739,
29901,
6120,
353,
5852,
29892,
13,
4706,
788,
29918,
2695,
29918,
23687,
29901,
6120,
353,
7700,
29892,
13,
1678,
1723,
1599,
2391,
29961,
1293,
29961,
29925,
13479,
5262,
29901,
13,
4706,
396,
4250,
2408,
263,
1051,
310,
599,
3691,
943,
363,
1269,
18515,
519,
11266,
15501,
310,
278,
8466,
13,
4706,
599,
29918,
29886,
28739,
353,
5159,
13,
4706,
304,
29918,
1730,
277,
353,
5159,
13,
4706,
304,
29918,
1730,
277,
29889,
4397,
29898,
1311,
29889,
29887,
29886,
29889,
17460,
29889,
29895,
29896,
29897,
13,
4706,
304,
29918,
1730,
277,
29889,
4397,
29898,
1311,
29889,
29887,
29886,
29889,
17460,
29889,
29895,
29906,
29897,
13,
4706,
1550,
7431,
29898,
517,
29918,
1730,
277,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1857,
29918,
3207,
353,
304,
29918,
1730,
277,
29889,
7323,
29898,
29900,
29897,
13,
9651,
565,
338,
8758,
29898,
3784,
29918,
3207,
29892,
476,
5851,
26486,
1125,
13,
18884,
304,
29918,
1730,
277,
29889,
7851,
29898,
29900,
29892,
1857,
29918,
3207,
29889,
29895,
29896,
29897,
13,
18884,
304,
29918,
1730,
277,
29889,
7851,
29898,
29896,
29892,
1857,
29918,
3207,
29889,
29895,
29906,
29897,
13,
18884,
6773,
13,
9651,
25342,
338,
8758,
29898,
3784,
29918,
3207,
29892,
476,
5851,
1125,
13,
18884,
298,
567,
353,
1857,
29918,
3207,
29889,
24947,
16744,
13,
18884,
4974,
7431,
29898,
29882,
567,
29897,
1275,
29871,
29896,
13,
18884,
298,
29886,
353,
298,
567,
29961,
29900,
29962,
13,
18884,
565,
298,
29886,
29889,
20227,
29901,
13,
462,
1678,
6773,
13,
18884,
13451,
353,
298,
567,
29961,
29900,
1822,
23687,
13,
18884,
363,
474,
297,
3464,
29898,
29882,
567,
29961,
29900,
1822,
29876,
29918,
17664,
1125,
13,
462,
1678,
3691,
943,
29918,
1454,
29918,
28887,
353,
5159,
13,
462,
1678,
565,
1857,
29918,
3207,
29889,
29886,
13479,
338,
451,
6213,
29901,
13,
462,
4706,
3691,
943,
29918,
1454,
29918,
28887,
29889,
4397,
29898,
3784,
29918,
3207,
29889,
29886,
13479,
29897,
13,
462,
1678,
565,
788,
29918,
9917,
29918,
29886,
28739,
29901,
13,
462,
4706,
565,
788,
29918,
2695,
29918,
23687,
29901,
13,
462,
9651,
3691,
943,
29918,
1454,
29918,
28887,
29889,
4397,
29898,
13,
462,
18884,
1105,
615,
7031,
29950,
271,
29925,
13479,
29898,
13,
462,
462,
1678,
5224,
29918,
9917,
29922,
23687,
29961,
29875,
3816,
29900,
1402,
13,
462,
462,
1678,
7568,
29918,
9917,
29922,
23687,
29961,
29875,
3816,
29896,
1402,
13,
462,
462,
1678,
364,
865,
29922,
1311,
29889,
29878,
865,
29892,
13,
462,
462,
1678,
28869,
29922,
29906,
29892,
13,
462,
462,
876,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
3691,
943,
29918,
1454,
29918,
28887,
29889,
4397,
29898,
13,
462,
18884,
7488,
2455,
29925,
13479,
29898,
13,
462,
462,
1678,
5224,
29918,
9917,
29922,
23687,
29961,
29875,
3816,
29900,
1402,
13,
462,
462,
1678,
7568,
29918,
9917,
29922,
23687,
29961,
29875,
3816,
29896,
1402,
13,
462,
462,
1678,
364,
865,
29922,
1311,
29889,
29878,
865,
29892,
13,
462,
462,
876,
13,
462,
1678,
599,
29918,
29886,
28739,
29889,
4397,
29898,
29886,
28739,
29918,
1454,
29918,
28887,
29897,
13,
4706,
736,
599,
29918,
29886,
28739,
13,
13,
1678,
822,
903,
20640,
675,
29898,
1311,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
20693,
326,
7093,
278,
15276,
979,
1480,
4188,
22342,
322,
3639,
278,
1900,
1476,
13,
4706,
11266,
15501,
5285,
278,
941,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
278,
941,
584,
7442,
29889,
299,
2378,
29898,
29950,
29897,
13,
9651,
26078,
15501,
4608,
393,
5256,
7093,
278,
15276,
979,
1480,
4188,
22342,
13,
4706,
9995,
13,
13,
4706,
1480,
29918,
23687,
353,
17288,
29890,
29961,
29900,
1402,
289,
29961,
29896,
2314,
363,
289,
297,
1583,
29889,
29887,
29886,
29889,
17460,
29889,
23687,
29962,
13,
13,
4706,
396,
7370,
13883,
515,
278,
3517,
11266,
15501,
5285,
13,
4706,
282,
29900,
353,
518,
1311,
29889,
29887,
29886,
29889,
17460,
29889,
3416,
29962,
13,
4706,
565,
1583,
29889,
29876,
29918,
3670,
29918,
5060,
5708,
1405,
29871,
29900,
29901,
13,
9651,
3964,
29918,
27736,
353,
5159,
13,
13,
9651,
7536,
353,
6213,
29871,
396,
1134,
29901,
19229,
29889,
27636,
29961,
1017,
15702,
29889,
19986,
29961,
1017,
15702,
29889,
1293,
29961,
29925,
13479,
1402,
22096,
5262,
13,
9651,
363,
3964,
29892,
298,
29886,
29918,
9917,
297,
26985,
29898,
1188,
29918,
23687,
1125,
13,
18884,
7536,
353,
1583,
3032,
497,
29918,
29886,
28739,
29961,
6229,
29962,
13,
18884,
396,
29849,
4559,
515,
278,
937,
7536,
13,
18884,
565,
338,
8758,
29898,
29886,
13479,
29892,
1051,
1125,
13,
462,
1678,
565,
7431,
29898,
29886,
13479,
29897,
1275,
29871,
29900,
29901,
13,
462,
4706,
7536,
353,
6213,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
7536,
353,
7536,
29961,
29900,
29962,
13,
18884,
7536,
353,
19229,
29889,
4384,
29898,
1017,
15702,
29889,
27636,
29961,
29925,
13479,
1402,
7536,
29897,
13,
18884,
565,
7536,
338,
6213,
29901,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
4559,
353,
1583,
29889,
29878,
865,
29889,
29590,
29898,
13,
462,
9651,
4482,
29922,
28887,
29918,
9917,
29961,
29900,
1402,
13,
462,
9651,
1880,
29922,
28887,
29918,
9917,
29961,
29896,
1402,
13,
462,
9651,
2159,
7607,
1311,
29889,
29876,
29918,
3670,
29918,
5060,
5708,
29892,
10353,
13,
462,
4706,
1723,
13,
462,
1678,
5174,
28845,
2392,
29901,
13,
462,
4706,
12020,
7865,
2392,
29898,
13,
462,
9651,
525,
23773,
2392,
1550,
23460,
515,
313,
29995,
29888,
29892,
1273,
29888,
16029,
1273,
13,
462,
9651,
313,
28887,
29918,
9917,
29961,
29900,
1402,
298,
29886,
29918,
9917,
29961,
29896,
12622,
13,
462,
1678,
3964,
29918,
27736,
29889,
4397,
29898,
11249,
29889,
1579,
8606,
3101,
13,
18884,
1683,
29901,
13,
462,
1678,
3964,
29918,
27736,
29889,
4397,
29898,
13,
462,
4706,
7536,
29889,
11249,
29918,
3166,
29918,
29886,
13479,
29898,
1311,
29889,
29876,
29918,
3670,
29918,
5060,
5708,
467,
1579,
8606,
3101,
13,
9651,
282,
29900,
4619,
1051,
29898,
9302,
29889,
29894,
1429,
29898,
6229,
29918,
27736,
467,
3286,
4220,
3101,
13,
13,
4706,
278,
941,
29918,
8508,
353,
6213,
13,
4706,
285,
29918,
3670,
29918,
8508,
353,
7442,
29889,
7192,
13,
4706,
363,
474,
29892,
1369,
29918,
3149,
297,
26985,
29898,
29886,
29900,
1125,
13,
9651,
278,
941,
29892,
285,
29918,
3670,
29892,
903,
353,
24656,
29889,
29888,
1195,
29918,
29880,
29918,
1635,
3174,
29918,
29890,
29898,
1311,
3032,
29876,
645,
29892,
13,
462,
462,
462,
268,
1369,
29918,
3149,
29892,
13,
462,
462,
462,
268,
13451,
29922,
1188,
29918,
23687,
29897,
13,
9651,
565,
285,
29918,
3670,
529,
285,
29918,
3670,
29918,
8508,
29901,
13,
18884,
285,
29918,
3670,
29918,
8508,
353,
285,
29918,
3670,
13,
18884,
278,
941,
29918,
8508,
353,
278,
941,
13,
4706,
736,
278,
941,
29918,
8508,
13,
13,
1678,
822,
903,
842,
29918,
5349,
29918,
1116,
2187,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
756,
29918,
1116,
2187,
353,
7431,
29898,
1311,
29889,
2917,
3493,
29889,
657,
29918,
1116,
2187,
3101,
1405,
29871,
29900,
13,
4706,
304,
29918,
1730,
277,
353,
5159,
13,
4706,
304,
29918,
1730,
277,
29889,
4397,
29898,
1311,
29889,
17460,
29897,
13,
4706,
1550,
7431,
29898,
517,
29918,
1730,
277,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1857,
29918,
3207,
353,
304,
29918,
1730,
277,
29889,
7323,
29898,
29900,
29897,
13,
9651,
565,
338,
8758,
29898,
3784,
29918,
3207,
29892,
13,
462,
3986,
2071,
19668,
29889,
29887,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
29968,
5851,
26486,
1125,
13,
18884,
304,
29918,
1730,
277,
29889,
7851,
29898,
29900,
29892,
1857,
29918,
3207,
29889,
29895,
29896,
29897,
13,
18884,
304,
29918,
1730,
277,
29889,
7851,
29898,
29896,
29892,
1857,
29918,
3207,
29889,
29895,
29906,
29897,
13,
18884,
1857,
29918,
3207,
29889,
5349,
29918,
1116,
2187,
353,
756,
29918,
1116,
2187,
13,
9651,
25342,
338,
8758,
29898,
3784,
29918,
3207,
29892,
13,
462,
9651,
2071,
19668,
29889,
29887,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
29968,
5851,
1125,
13,
18884,
1857,
29918,
3207,
29889,
5349,
29918,
1116,
2187,
353,
756,
29918,
1116,
2187,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
3784,
29918,
3207,
29897,
13,
13,
13,
1990,
22477,
7032,
4597,
1253,
272,
17011,
29918,
808,
19668,
29898,
18498,
9102,
403,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29892,
1375,
29918,
11249,
29922,
29941,
1125,
13,
4706,
2428,
29898,
29954,
17019,
7032,
4597,
1253,
272,
17011,
29918,
808,
19668,
29892,
13,
795,
1583,
467,
1649,
2344,
12035,
6229,
29892,
1375,
29918,
11249,
29897,
13,
4706,
1583,
29889,
29883,
3791,
353,
6571,
13,
4706,
8466,
353,
330,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
12075,
424,
29968,
5851,
29898,
13,
9651,
4868,
29918,
1767,
29922,
29896,
29871,
396,
29892,
4868,
29918,
1767,
29918,
23687,
7607,
29896,
29872,
29899,
29946,
29892,
29871,
29896,
29872,
29946,
29897,
13,
4706,
1723,
334,
330,
17019,
29918,
5014,
29889,
22178,
1379,
29889,
29934,
28062,
29898,
13,
9651,
3309,
29918,
7052,
29922,
29896,
29871,
396,
29892,
3309,
29918,
7052,
29918,
23687,
7607,
29896,
29872,
29899,
29946,
29892,
29871,
29896,
29872,
29946,
29897,
13,
4706,
1723,
13,
4706,
1583,
29889,
29887,
558,
353,
330,
17019,
29918,
5014,
29889,
29954,
17019,
7032,
4597,
1253,
272,
29898,
13,
9651,
8466,
29922,
17460,
29892,
302,
29918,
5060,
5708,
29918,
20640,
3950,
29922,
29906,
29897,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
7700,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
921,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29897,
13,
4706,
565,
921,
29889,
12181,
29961,
29900,
29962,
529,
1583,
29889,
1195,
29918,
11249,
29901,
13,
9651,
736,
13,
4706,
1583,
29889,
29887,
558,
29889,
9202,
29898,
29916,
29892,
343,
29897,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
5852,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
736,
1583,
29889,
29887,
558,
29889,
27711,
29898,
9302,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
876,
13,
13,
1678,
822,
22152,
29918,
27711,
29898,
1311,
29892,
716,
29990,
1125,
13,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
13,
13,
1678,
822,
8500,
29918,
2541,
29918,
3754,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
565,
451,
1583,
29889,
275,
29918,
29888,
1573,
29901,
13,
9651,
736,
29871,
29900,
29892,
7442,
29889,
7192,
13,
4706,
1683,
29901,
13,
9651,
3887,
29892,
3659,
353,
1583,
29889,
29887,
558,
29889,
27711,
29898,
9302,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
511,
736,
29918,
4172,
29922,
5574,
29897,
13,
9651,
736,
3887,
29892,
3659,
13,
13,
13,
1990,
22477,
7032,
4597,
1253,
272,
29898,
18498,
9102,
403,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29892,
1375,
29918,
11249,
29922,
29941,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
6229,
29892,
1375,
29918,
11249,
29897,
13,
4706,
1583,
29889,
17460,
353,
3725,
17460,
580,
13,
4706,
1583,
29889,
29883,
3791,
353,
6571,
13,
4706,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
353,
6571,
13,
4706,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
353,
6571,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
7700,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
921,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29897,
13,
4706,
565,
921,
29889,
12181,
29961,
29900,
29962,
529,
1583,
29889,
1195,
29918,
11249,
29901,
13,
9651,
736,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
5852,
13,
4706,
1583,
29889,
29990,
353,
921,
13,
4706,
8466,
353,
1583,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
29916,
29897,
13,
4706,
1583,
29889,
29931,
353,
521,
6544,
3459,
29898,
17460,
29892,
5224,
29922,
5574,
29897,
13,
4706,
903,
1595,
353,
4505,
29918,
3626,
6825,
29898,
1311,
29889,
29931,
29892,
343,
29892,
5224,
29922,
5574,
29897,
13,
4706,
1583,
29889,
29968,
11569,
29979,
353,
4505,
29918,
3626,
6825,
29898,
1311,
29889,
29931,
29889,
29911,
29892,
903,
1595,
29892,
5224,
29922,
8824,
29897,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
396,
476,
8508,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
1311,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1311,
29889,
29990,
29892,
716,
29990,
876,
13,
4706,
476,
8508,
353,
313,
1311,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1311,
29889,
29990,
29892,
716,
29990,
876,
13,
4706,
736,
313,
29968,
8508,
29889,
29911,
732,
1583,
29889,
29968,
11569,
29979,
467,
667,
580,
13,
13,
1678,
822,
22152,
29918,
27711,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29961,
1989,
29962,
13,
13,
1678,
822,
8500,
29918,
2541,
29918,
3754,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
565,
451,
756,
5552,
29898,
1311,
29892,
525,
29990,
29374,
13,
9651,
736,
29871,
29900,
29892,
7442,
29889,
7192,
13,
4706,
1683,
29901,
13,
9651,
476,
8508,
353,
1583,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1311,
29889,
29990,
29892,
716,
29990,
29897,
13,
9651,
903,
29931,
11569,
29968,
8508,
353,
4505,
29918,
3626,
6825,
29898,
1311,
29889,
29931,
29892,
476,
8508,
29892,
5224,
29922,
5574,
29897,
13,
9651,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
29968,
8508,
29889,
29911,
732,
1583,
29889,
29968,
11569,
29979,
511,
7442,
29889,
3676,
29898,
13,
18884,
1583,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1482,
29990,
29897,
448,
903,
29931,
11569,
29968,
8508,
29889,
29911,
732,
903,
29931,
11569,
29968,
8508,
29897,
13,
13,
1678,
822,
22152,
29918,
27711,
29918,
2541,
29918,
3754,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29918,
2541,
29918,
3754,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
29961,
1989,
29962,
13,
13,
1678,
822,
22152,
29918,
27711,
29918,
2541,
29918,
24542,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
1820,
353,
6608,
29898,
1482,
29990,
29889,
1272,
29889,
517,
13193,
3101,
13,
4706,
565,
1820,
451,
297,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
29901,
13,
9651,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
29961,
1989,
29962,
353,
1583,
29889,
27711,
29918,
2541,
29918,
24542,
29898,
1482,
29990,
29897,
13,
4706,
736,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
29961,
1989,
29962,
13,
13,
1678,
822,
8500,
29918,
2541,
29918,
24542,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
565,
451,
756,
5552,
29898,
1311,
29892,
525,
29990,
29374,
13,
9651,
736,
29871,
29900,
29892,
7442,
29889,
7192,
13,
4706,
1683,
29901,
13,
9651,
476,
8508,
353,
1583,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1311,
29889,
29990,
29892,
716,
29990,
29897,
13,
9651,
903,
29931,
11569,
29968,
8508,
353,
4505,
29918,
3626,
6825,
29898,
1311,
29889,
29931,
29892,
476,
8508,
29892,
5224,
29922,
5574,
29897,
13,
9651,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
13,
18884,
476,
8508,
29889,
29911,
732,
1583,
29889,
29968,
11569,
29979,
511,
313,
1311,
29889,
17460,
29889,
26017,
29918,
17460,
29898,
1482,
29990,
29897,
448,
13,
462,
462,
4706,
903,
29931,
11569,
29968,
8508,
29889,
29911,
732,
903,
29931,
11569,
29968,
8508,
29897,
13,
13,
13,
1990,
22477,
7032,
4597,
1253,
272,
17011,
29918,
7345,
305,
29898,
18498,
9102,
403,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3964,
29892,
1375,
29918,
11249,
29922,
29946,
29892,
1024,
2433,
15770,
29374,
13,
4706,
515,
9225,
25350,
29889,
9794,
1053,
16740,
5398,
19903,
29892,
383,
11925,
3782,
895,
19903,
13,
4706,
515,
9225,
25350,
1053,
6216,
29918,
29887,
2272,
7345,
305,
29918,
4299,
13,
4706,
515,
9225,
25350,
29889,
20640,
1053,
24656,
29918,
562,
29939,
29888,
13,
4706,
515,
330,
2272,
7345,
305,
1053,
1222,
627,
29924,
1191,
979,
3403,
29931,
638,
22342,
13,
4706,
515,
330,
2272,
7345,
305,
29889,
5081,
22342,
29879,
1053,
22477,
29931,
638,
22342,
13,
4706,
515,
330,
2272,
7345,
305,
29889,
13646,
29879,
1053,
4122,
1008,
1349,
273,
13,
4706,
6298,
9102,
403,
17255,
2344,
12035,
1311,
29892,
3964,
29892,
1375,
29918,
11249,
29897,
13,
4706,
396,
1583,
29889,
29883,
3791,
353,
6571,
13,
4706,
396,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
3754,
353,
6571,
13,
4706,
396,
1583,
29889,
29883,
3791,
29918,
2589,
29918,
24542,
353,
6571,
13,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
7700,
13,
4706,
4974,
1024,
297,
6796,
15770,
613,
376,
29887,
17019,
3108,
13,
4706,
10417,
353,
426,
13,
9651,
376,
15770,
1115,
10117,
13372,
29892,
13,
9651,
376,
29887,
17019,
1115,
22477,
13372,
29892,
13,
4706,
500,
13,
4706,
1583,
29889,
8945,
3950,
353,
10417,
29961,
978,
29962,
13,
4706,
396,
1583,
29889,
711,
643,
1490,
29918,
29920,
353,
4842,
305,
29889,
6310,
29898,
2311,
7607,
29900,
29892,
3964,
876,
13,
4706,
1583,
29889,
29891,
29918,
711,
643,
1490,
353,
4842,
305,
29889,
6310,
29898,
2311,
7607,
29900,
29892,
29871,
29896,
876,
13,
4706,
1583,
29889,
29990,
29918,
711,
643,
1490,
353,
4842,
305,
29889,
6310,
29898,
2311,
7607,
29900,
29892,
3964,
876,
13,
13,
1678,
822,
4327,
29918,
4905,
29879,
29898,
1311,
29892,
343,
29901,
7442,
29889,
2378,
1125,
13,
4706,
396,
736,
343,
396,
14402,
13,
4706,
282,
1039,
353,
1583,
29889,
8945,
3950,
29898,
29891,
29897,
13,
4706,
503,
353,
282,
1039,
29889,
9067,
29898,
29891,
29897,
13,
4706,
736,
503,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
1583,
29889,
29990,
29918,
711,
643,
1490,
353,
4842,
305,
29889,
4117,
3552,
1311,
29889,
29990,
29918,
711,
643,
1490,
29892,
4842,
305,
29889,
29911,
6073,
29898,
29916,
8243,
3964,
29922,
29900,
29897,
13,
4706,
1583,
29889,
29891,
29918,
711,
643,
1490,
353,
4842,
305,
29889,
4117,
29898,
13,
9651,
313,
1311,
29889,
29891,
29918,
711,
643,
1490,
29892,
4842,
305,
29889,
29911,
6073,
29898,
29891,
467,
6948,
802,
29872,
911,
29898,
29896,
8243,
3964,
29922,
29900,
29897,
13,
4706,
396,
921,
353,
4842,
305,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
29916,
29897,
13,
4706,
565,
1583,
29889,
29990,
29918,
711,
643,
1490,
29889,
12181,
14352,
29906,
29962,
529,
1583,
29889,
1195,
29918,
11249,
29901,
13,
9651,
736,
13,
4706,
1583,
29889,
275,
29918,
29888,
1573,
353,
5852,
13,
13,
4706,
396,
565,
343,
29889,
299,
326,
1275,
29871,
29896,
29901,
13,
4706,
396,
268,
343,
353,
343,
29961,
16361,
6213,
29962,
13,
4706,
1583,
29889,
29920,
29918,
711,
643,
1490,
353,
4842,
305,
29889,
29911,
6073,
29898,
13,
9651,
1583,
29889,
9067,
29918,
4905,
29879,
29898,
1311,
29889,
29891,
29918,
711,
643,
1490,
29889,
21970,
2141,
23749,
22130,
13,
4706,
396,
1583,
29889,
29887,
558,
353,
16740,
5398,
19903,
29898,
13,
4706,
396,
268,
7945,
29918,
29990,
29922,
1311,
29889,
29990,
29918,
711,
643,
1490,
29892,
13,
4706,
396,
268,
7945,
29918,
29979,
29922,
1311,
29889,
29920,
29918,
711,
643,
1490,
29892,
13,
4706,
396,
268,
396,
4266,
4188,
22342,
363,
16259,
678,
6544,
3459,
4436,
29892,
1494,
9848,
515,
13,
4706,
396,
268,
396,
2045,
597,
1636,
29889,
5559,
14834,
29889,
510,
29914,
15118,
29914,
2272,
7345,
305,
29914,
7451,
25350,
29914,
29896,
29955,
29929,
29914,
29945,
29900,
29953,
29906,
29955,
29953,
29945,
29906,
29896,
13,
4706,
396,
268,
396,
4188,
22342,
29922,
29954,
17019,
29931,
638,
22342,
29898,
1217,
895,
29918,
13646,
29922,
25120,
1008,
1349,
273,
29898,
29896,
29872,
29899,
29941,
8243,
13,
4706,
396,
1723,
13,
4706,
1583,
29889,
29887,
558,
353,
383,
11925,
3782,
895,
19903,
29898,
13,
9651,
7945,
29918,
29990,
29922,
1311,
29889,
29990,
29918,
711,
643,
1490,
29892,
13,
9651,
7945,
29918,
29979,
29922,
1311,
29889,
29920,
29918,
711,
643,
1490,
29892,
13,
9651,
7945,
29918,
29979,
1707,
29922,
7345,
305,
29889,
8159,
29918,
4561,
29898,
1311,
29889,
29920,
29918,
711,
643,
1490,
29892,
29871,
29896,
29897,
13,
9651,
396,
4266,
4188,
22342,
363,
16259,
678,
6544,
3459,
4436,
29892,
1494,
9848,
515,
13,
9651,
396,
2045,
597,
1636,
29889,
5559,
14834,
29889,
510,
29914,
15118,
29914,
2272,
7345,
305,
29914,
7451,
25350,
29914,
29896,
29955,
29929,
29914,
29945,
29900,
29953,
29906,
29955,
29953,
29945,
29906,
29896,
13,
9651,
396,
4188,
22342,
29922,
29954,
17019,
29931,
638,
22342,
29898,
1217,
895,
29918,
13646,
29922,
25120,
1008,
1349,
273,
29898,
29896,
29872,
29899,
29941,
8243,
13,
4706,
1723,
13,
13,
4706,
286,
645,
353,
1222,
627,
29924,
1191,
979,
3403,
29931,
638,
22342,
29898,
1311,
29889,
29887,
558,
29889,
5081,
22342,
29892,
1583,
29889,
29887,
558,
29897,
13,
4706,
396,
411,
330,
2272,
7345,
305,
29889,
11027,
29889,
305,
6544,
3459,
29918,
29926,
5171,
29898,
29896,
29872,
29899,
29896,
1125,
13,
4706,
6216,
29918,
29887,
2272,
7345,
305,
29918,
4299,
29898,
29885,
645,
29897,
13,
13,
1678,
822,
679,
29918,
2490,
261,
1611,
29898,
1311,
29892,
716,
29990,
1125,
13,
4706,
4974,
1583,
29889,
275,
29918,
29888,
1573,
13,
4706,
736,
1583,
29889,
29887,
558,
29889,
2490,
261,
1611,
29898,
7345,
305,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
1482,
29990,
876,
13,
2
] |
analysis/playing_with_pykalman.py | rafaelvalero/covid_forecast | 3 | 17468 | <reponame>rafaelvalero/covid_forecast
'''
=============================
EM for Linear-Gaussian Models
=============================
This example shows how one may use the EM algorithm to estimate model
parameters with a Kalman Filter.
The EM algorithm is a meta-algorithm for learning parameters in probabilistic
models. The algorithm works by first fixing the parameters and finding a closed
form distribution over the unobserved variables, then finds new parameters that
maximize the expected likelihood of the observed variables (where the
expectation is taken over the unobserved ones). Due to convexity arguments, we
are guaranteed that each iteration of the algorithm will increase the
likelihood of the observed data and that it will eventually reach a local
optimum.
The EM algorithm is applied to the Linear-Gaussian system (that is, the model
assumed by the Kalman Filter) by first using the Kalman Smoother to calculate
the distribution over all unobserved variables (in this case, the hidden target
states), then closed-form update equations are used to update the model
parameters.
The first figure plotted contains 4 sets of lines. The first, labeled `true`,
represents the true, unobserved state of the system. The second, labeled
`blind`, represents the predicted state of the system if no measurements are
incorporated. The third, labeled `filtered`, are the state estimates given
measurements up to and including the current time step. Finally, the fourth,
labeled `smoothed`, are the state estimates using all observations for all time
steps. The latter three estimates use parameters learned via 10 iterations of
the EM algorithm.
The second figure contains a single line representing the likelihood of the
observed data as a function of the EM Algorithm iteration.
'''
from pykalman import KalmanFilter
import numpy as np
import matplotlib.pyplot as plt
import time
measurements = np.asarray([(399,293),(403,299),(409,308),(416,315),(418,318),(420,323),(429,326),(423,328),(429,334),(431,337),(433,342),(434,352),(434,349),(433,350),(431,350),(430,349),(428,347),(427,345),(425,341),(429,338),(431,328),(410,313),(406,306),(402,299),(397,291),(391,294),(376,270),(372,272),(351,248),(336,244),(327,236),(307,220)])
initial_state_mean = [measurements[0, 0],
0,
measurements[0, 1],
0]
transition_matrix = [[1, 1, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 0, 1]]
observation_matrix = [[1, 0, 0, 0],
[0, 0, 1, 0]]
kf1 = KalmanFilter(transition_matrices = transition_matrix,
observation_matrices = observation_matrix,
initial_state_mean = initial_state_mean)
kf1 = kf1.em(measurements, n_iter=5)
(smoothed_state_means, smoothed_state_covariances) = kf1.smooth(measurements)
'''
=============================
EM for Linear-Gaussian Models
=============================
This example shows how one may use the EM algorithm to estimate model
parameters with a Kalman Filter.
The EM algorithm is a meta-algorithm for learning parameters in probabilistic
models. The algorithm works by first fixing the parameters and finding a closed
form distribution over the unobserved variables, then finds new parameters that
maximize the expected likelihood of the observed variables (where the
expectation is taken over the unobserved ones). Due to convexity arguments, we
are guaranteed that each iteration of the algorithm will increase the
likelihood of the observed data and that it will eventually reach a local
optimum.
The EM algorithm is applied to the Linear-Gaussian system (that is, the model
assumed by the Kalman Filter) by first using the Kalman Smoother to calculate
the distribution over all unobserved variables (in this case, the hidden target
states), then closed-form update equations are used to update the model
parameters.
The first figure plotted contains 4 sets of lines. The first, labeled `true`,
represents the true, unobserved state of the system. The second, labeled
`blind`, represents the predicted state of the system if no measurements are
incorporated. The third, labeled `filtered`, are the state estimates given
measurements up to and including the current time step. Finally, the fourth,
labeled `smoothed`, are the state estimates using all observations for all time
steps. The latter three estimates use parameters learned via 10 iterations of
the EM algorithm.
The second figure contains a single line representing the likelihood of the
observed data as a function of the EM Algorithm iteration.
'''
from pykalman import KalmanFilter
import numpy as np
import matplotlib.pyplot as plt
import time
measurements = np.asarray([(399,293),(403,299),(409,308),(416,315),(418,318),(420,323),(429,326),(423,328),(429,334),(431,337),(433,342),(434,352),(434,349),(433,350),(431,350),(430,349),(428,347),(427,345),(425,341),(429,338),(431,328),(410,313),(406,306),(402,299),(397,291),(391,294),(376,270),(372,272),(351,248),(336,244),(327,236),(307,220)])
initial_state_mean = [measurements[0, 0],
0,
measurements[0, 1],
0]
transition_matrix = [[1, 1, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 0, 1]]
observation_matrix = [[1, 0, 0, 0],
[0, 0, 1, 0]]
kf1 = KalmanFilter(transition_matrices = transition_matrix,
observation_matrices = observation_matrix,
initial_state_mean = initial_state_mean)
kf1 = kf1.em(measurements, n_iter=5)
(smoothed_state_means, smoothed_state_covariances) = kf1.smooth(measurements)
plt.figure(1)
times = range(measurements.shape[0])
plt.plot(times, measurements[:, 0], 'bo',
times, measurements[:, 1], 'ro',
times, smoothed_state_means[:, 0], 'b--',
times, smoothed_state_means[:, 2], 'r--',)
plt.show() | [
1,
529,
276,
1112,
420,
29958,
1929,
4271,
791,
1489,
29914,
24542,
333,
29918,
1079,
4384,
13,
12008,
13,
9166,
4936,
2751,
29922,
13,
12665,
363,
22985,
29899,
29954,
17019,
3382,
1379,
13,
9166,
4936,
2751,
29922,
13,
4013,
1342,
3697,
920,
697,
1122,
671,
278,
27295,
5687,
304,
12678,
1904,
13,
16744,
411,
263,
9172,
1171,
19916,
29889,
13,
1576,
27295,
5687,
338,
263,
12700,
29899,
20567,
363,
6509,
4128,
297,
23950,
4695,
13,
9794,
29889,
450,
5687,
1736,
491,
937,
27826,
278,
4128,
322,
9138,
263,
5764,
13,
689,
4978,
975,
278,
443,
711,
643,
1490,
3651,
29892,
769,
14061,
716,
4128,
393,
13,
27525,
675,
278,
3806,
4188,
22342,
310,
278,
8900,
3651,
313,
3062,
278,
13,
17854,
362,
338,
4586,
975,
278,
443,
711,
643,
1490,
6743,
467,
16809,
304,
18635,
537,
6273,
29892,
591,
13,
598,
22688,
393,
1269,
12541,
310,
278,
5687,
674,
7910,
278,
13,
5081,
22342,
310,
278,
8900,
848,
322,
393,
372,
674,
10201,
6159,
263,
1887,
13,
3670,
12539,
29889,
13,
1576,
27295,
5687,
338,
7436,
304,
278,
22985,
29899,
29954,
17019,
1788,
313,
5747,
338,
29892,
278,
1904,
13,
465,
21571,
491,
278,
9172,
1171,
19916,
29897,
491,
937,
773,
278,
9172,
1171,
4116,
29877,
1228,
304,
8147,
13,
1552,
4978,
975,
599,
443,
711,
643,
1490,
3651,
313,
262,
445,
1206,
29892,
278,
7934,
3646,
13,
28631,
511,
769,
5764,
29899,
689,
2767,
10693,
526,
1304,
304,
2767,
278,
1904,
13,
16744,
29889,
13,
1576,
937,
4377,
715,
15048,
3743,
29871,
29946,
6166,
310,
3454,
29889,
450,
937,
29892,
301,
24025,
421,
3009,
1673,
13,
276,
4569,
1237,
278,
1565,
29892,
443,
711,
643,
1490,
2106,
310,
278,
1788,
29889,
450,
1473,
29892,
301,
24025,
13,
29952,
2204,
513,
1673,
11524,
278,
25383,
2106,
310,
278,
1788,
565,
694,
20398,
526,
13,
262,
2616,
1971,
630,
29889,
29871,
450,
4654,
29892,
301,
24025,
421,
4572,
287,
1673,
526,
278,
2106,
21875,
2183,
13,
26658,
1860,
701,
304,
322,
3704,
278,
1857,
931,
4331,
29889,
29871,
9788,
29892,
278,
11582,
29892,
13,
29880,
24025,
421,
3844,
6983,
287,
1673,
526,
278,
2106,
21875,
773,
599,
13917,
363,
599,
931,
13,
24530,
29889,
29871,
450,
7480,
2211,
21875,
671,
4128,
10972,
3025,
29871,
29896,
29900,
24372,
310,
13,
1552,
27295,
5687,
29889,
13,
1576,
1473,
4377,
3743,
263,
2323,
1196,
15783,
278,
4188,
22342,
310,
278,
13,
711,
643,
1490,
848,
408,
263,
740,
310,
278,
27295,
29068,
12541,
29889,
13,
12008,
13,
3166,
11451,
11311,
1171,
1053,
9172,
1171,
5072,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
931,
13,
13,
26658,
1860,
353,
7442,
29889,
294,
2378,
4197,
29898,
29941,
29929,
29929,
29892,
29906,
29929,
29941,
21336,
29946,
29900,
29941,
29892,
29906,
29929,
29929,
21336,
29946,
29900,
29929,
29892,
29941,
29900,
29947,
21336,
29946,
29896,
29953,
29892,
29941,
29896,
29945,
21336,
29946,
29896,
29947,
29892,
29941,
29896,
29947,
21336,
29946,
29906,
29900,
29892,
29941,
29906,
29941,
21336,
29946,
29906,
29929,
29892,
29941,
29906,
29953,
21336,
29946,
29906,
29941,
29892,
29941,
29906,
29947,
21336,
29946,
29906,
29929,
29892,
29941,
29941,
29946,
21336,
29946,
29941,
29896,
29892,
29941,
29941,
29955,
21336,
29946,
29941,
29941,
29892,
29941,
29946,
29906,
21336,
29946,
29941,
29946,
29892,
29941,
29945,
29906,
21336,
29946,
29941,
29946,
29892,
29941,
29946,
29929,
21336,
29946,
29941,
29941,
29892,
29941,
29945,
29900,
21336,
29946,
29941,
29896,
29892,
29941,
29945,
29900,
21336,
29946,
29941,
29900,
29892,
29941,
29946,
29929,
21336,
29946,
29906,
29947,
29892,
29941,
29946,
29955,
21336,
29946,
29906,
29955,
29892,
29941,
29946,
29945,
21336,
29946,
29906,
29945,
29892,
29941,
29946,
29896,
21336,
29946,
29906,
29929,
29892,
29941,
29941,
29947,
21336,
29946,
29941,
29896,
29892,
29941,
29906,
29947,
21336,
29946,
29896,
29900,
29892,
29941,
29896,
29941,
21336,
29946,
29900,
29953,
29892,
29941,
29900,
29953,
21336,
29946,
29900,
29906,
29892,
29906,
29929,
29929,
21336,
29941,
29929,
29955,
29892,
29906,
29929,
29896,
21336,
29941,
29929,
29896,
29892,
29906,
29929,
29946,
21336,
29941,
29955,
29953,
29892,
29906,
29955,
29900,
21336,
29941,
29955,
29906,
29892,
29906,
29955,
29906,
21336,
29941,
29945,
29896,
29892,
29906,
29946,
29947,
21336,
29941,
29941,
29953,
29892,
29906,
29946,
29946,
21336,
29941,
29906,
29955,
29892,
29906,
29941,
29953,
21336,
29941,
29900,
29955,
29892,
29906,
29906,
29900,
29897,
2314,
13,
13,
11228,
29918,
3859,
29918,
12676,
353,
518,
26658,
1860,
29961,
29900,
29892,
29871,
29900,
1402,
13,
462,
539,
29900,
29892,
13,
462,
418,
20398,
29961,
29900,
29892,
29871,
29896,
1402,
13,
462,
539,
29900,
29962,
13,
13,
20543,
29918,
5344,
353,
5519,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
5262,
13,
13,
26739,
362,
29918,
5344,
353,
5519,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
418,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
5262,
13,
13,
29895,
29888,
29896,
353,
9172,
1171,
5072,
29898,
20543,
29918,
2922,
11669,
353,
9558,
29918,
5344,
29892,
13,
462,
29871,
15500,
29918,
2922,
11669,
353,
15500,
29918,
5344,
29892,
13,
462,
29871,
2847,
29918,
3859,
29918,
12676,
353,
2847,
29918,
3859,
29918,
12676,
29897,
13,
13,
29895,
29888,
29896,
353,
413,
29888,
29896,
29889,
331,
29898,
26658,
1860,
29892,
302,
29918,
1524,
29922,
29945,
29897,
13,
29898,
3844,
6983,
287,
29918,
3859,
29918,
1004,
550,
29892,
10597,
287,
29918,
3859,
29918,
24542,
13956,
778,
29897,
353,
413,
29888,
29896,
29889,
3844,
6983,
29898,
26658,
1860,
29897,
13,
12008,
13,
9166,
4936,
2751,
29922,
13,
12665,
363,
22985,
29899,
29954,
17019,
3382,
1379,
13,
9166,
4936,
2751,
29922,
13,
4013,
1342,
3697,
920,
697,
1122,
671,
278,
27295,
5687,
304,
12678,
1904,
13,
16744,
411,
263,
9172,
1171,
19916,
29889,
13,
1576,
27295,
5687,
338,
263,
12700,
29899,
20567,
363,
6509,
4128,
297,
23950,
4695,
13,
9794,
29889,
450,
5687,
1736,
491,
937,
27826,
278,
4128,
322,
9138,
263,
5764,
13,
689,
4978,
975,
278,
443,
711,
643,
1490,
3651,
29892,
769,
14061,
716,
4128,
393,
13,
27525,
675,
278,
3806,
4188,
22342,
310,
278,
8900,
3651,
313,
3062,
278,
13,
17854,
362,
338,
4586,
975,
278,
443,
711,
643,
1490,
6743,
467,
16809,
304,
18635,
537,
6273,
29892,
591,
13,
598,
22688,
393,
1269,
12541,
310,
278,
5687,
674,
7910,
278,
13,
5081,
22342,
310,
278,
8900,
848,
322,
393,
372,
674,
10201,
6159,
263,
1887,
13,
3670,
12539,
29889,
13,
1576,
27295,
5687,
338,
7436,
304,
278,
22985,
29899,
29954,
17019,
1788,
313,
5747,
338,
29892,
278,
1904,
13,
465,
21571,
491,
278,
9172,
1171,
19916,
29897,
491,
937,
773,
278,
9172,
1171,
4116,
29877,
1228,
304,
8147,
13,
1552,
4978,
975,
599,
443,
711,
643,
1490,
3651,
313,
262,
445,
1206,
29892,
278,
7934,
3646,
13,
28631,
511,
769,
5764,
29899,
689,
2767,
10693,
526,
1304,
304,
2767,
278,
1904,
13,
16744,
29889,
13,
1576,
937,
4377,
715,
15048,
3743,
29871,
29946,
6166,
310,
3454,
29889,
450,
937,
29892,
301,
24025,
421,
3009,
1673,
13,
276,
4569,
1237,
278,
1565,
29892,
443,
711,
643,
1490,
2106,
310,
278,
1788,
29889,
450,
1473,
29892,
301,
24025,
13,
29952,
2204,
513,
1673,
11524,
278,
25383,
2106,
310,
278,
1788,
565,
694,
20398,
526,
13,
262,
2616,
1971,
630,
29889,
29871,
450,
4654,
29892,
301,
24025,
421,
4572,
287,
1673,
526,
278,
2106,
21875,
2183,
13,
26658,
1860,
701,
304,
322,
3704,
278,
1857,
931,
4331,
29889,
29871,
9788,
29892,
278,
11582,
29892,
13,
29880,
24025,
421,
3844,
6983,
287,
1673,
526,
278,
2106,
21875,
773,
599,
13917,
363,
599,
931,
13,
24530,
29889,
29871,
450,
7480,
2211,
21875,
671,
4128,
10972,
3025,
29871,
29896,
29900,
24372,
310,
13,
1552,
27295,
5687,
29889,
13,
1576,
1473,
4377,
3743,
263,
2323,
1196,
15783,
278,
4188,
22342,
310,
278,
13,
711,
643,
1490,
848,
408,
263,
740,
310,
278,
27295,
29068,
12541,
29889,
13,
12008,
13,
3166,
11451,
11311,
1171,
1053,
9172,
1171,
5072,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
931,
13,
13,
26658,
1860,
353,
7442,
29889,
294,
2378,
4197,
29898,
29941,
29929,
29929,
29892,
29906,
29929,
29941,
21336,
29946,
29900,
29941,
29892,
29906,
29929,
29929,
21336,
29946,
29900,
29929,
29892,
29941,
29900,
29947,
21336,
29946,
29896,
29953,
29892,
29941,
29896,
29945,
21336,
29946,
29896,
29947,
29892,
29941,
29896,
29947,
21336,
29946,
29906,
29900,
29892,
29941,
29906,
29941,
21336,
29946,
29906,
29929,
29892,
29941,
29906,
29953,
21336,
29946,
29906,
29941,
29892,
29941,
29906,
29947,
21336,
29946,
29906,
29929,
29892,
29941,
29941,
29946,
21336,
29946,
29941,
29896,
29892,
29941,
29941,
29955,
21336,
29946,
29941,
29941,
29892,
29941,
29946,
29906,
21336,
29946,
29941,
29946,
29892,
29941,
29945,
29906,
21336,
29946,
29941,
29946,
29892,
29941,
29946,
29929,
21336,
29946,
29941,
29941,
29892,
29941,
29945,
29900,
21336,
29946,
29941,
29896,
29892,
29941,
29945,
29900,
21336,
29946,
29941,
29900,
29892,
29941,
29946,
29929,
21336,
29946,
29906,
29947,
29892,
29941,
29946,
29955,
21336,
29946,
29906,
29955,
29892,
29941,
29946,
29945,
21336,
29946,
29906,
29945,
29892,
29941,
29946,
29896,
21336,
29946,
29906,
29929,
29892,
29941,
29941,
29947,
21336,
29946,
29941,
29896,
29892,
29941,
29906,
29947,
21336,
29946,
29896,
29900,
29892,
29941,
29896,
29941,
21336,
29946,
29900,
29953,
29892,
29941,
29900,
29953,
21336,
29946,
29900,
29906,
29892,
29906,
29929,
29929,
21336,
29941,
29929,
29955,
29892,
29906,
29929,
29896,
21336,
29941,
29929,
29896,
29892,
29906,
29929,
29946,
21336,
29941,
29955,
29953,
29892,
29906,
29955,
29900,
21336,
29941,
29955,
29906,
29892,
29906,
29955,
29906,
21336,
29941,
29945,
29896,
29892,
29906,
29946,
29947,
21336,
29941,
29941,
29953,
29892,
29906,
29946,
29946,
21336,
29941,
29906,
29955,
29892,
29906,
29941,
29953,
21336,
29941,
29900,
29955,
29892,
29906,
29906,
29900,
29897,
2314,
13,
13,
11228,
29918,
3859,
29918,
12676,
353,
518,
26658,
1860,
29961,
29900,
29892,
29871,
29900,
1402,
13,
462,
539,
29900,
29892,
13,
462,
418,
20398,
29961,
29900,
29892,
29871,
29896,
1402,
13,
462,
539,
29900,
29962,
13,
13,
20543,
29918,
5344,
353,
5519,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
13,
462,
268,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
5262,
13,
13,
26739,
362,
29918,
5344,
353,
5519,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
418,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
5262,
13,
13,
29895,
29888,
29896,
353,
9172,
1171,
5072,
29898,
20543,
29918,
2922,
11669,
353,
9558,
29918,
5344,
29892,
13,
462,
29871,
15500,
29918,
2922,
11669,
353,
15500,
29918,
5344,
29892,
13,
462,
29871,
2847,
29918,
3859,
29918,
12676,
353,
2847,
29918,
3859,
29918,
12676,
29897,
13,
13,
29895,
29888,
29896,
353,
413,
29888,
29896,
29889,
331,
29898,
26658,
1860,
29892,
302,
29918,
1524,
29922,
29945,
29897,
13,
29898,
3844,
6983,
287,
29918,
3859,
29918,
1004,
550,
29892,
10597,
287,
29918,
3859,
29918,
24542,
13956,
778,
29897,
353,
413,
29888,
29896,
29889,
3844,
6983,
29898,
26658,
1860,
29897,
13,
13,
572,
29873,
29889,
4532,
29898,
29896,
29897,
13,
3706,
353,
3464,
29898,
26658,
1860,
29889,
12181,
29961,
29900,
2314,
13,
572,
29873,
29889,
5317,
29898,
3706,
29892,
20398,
7503,
29892,
29871,
29900,
1402,
525,
833,
742,
13,
308,
3064,
29892,
20398,
7503,
29892,
29871,
29896,
1402,
525,
307,
742,
13,
308,
3064,
29892,
10597,
287,
29918,
3859,
29918,
1004,
550,
7503,
29892,
29871,
29900,
1402,
525,
29890,
489,
742,
13,
308,
3064,
29892,
10597,
287,
29918,
3859,
29918,
1004,
550,
7503,
29892,
29871,
29906,
1402,
525,
29878,
489,
742,
29897,
13,
572,
29873,
29889,
4294,
580,
2
] |
lane_detector.py | arasharn/carnd-P4 | 0 | 86720 | #%% Importing dependencies
import numpy as np
from PIL import Image
import glob
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
#%% Defining functions
#%% Camera callibration
# Load images and concvert to grayscale
ny = 6
nx = 9
imgpoints = [] # Images
objpoints = []
images = []
objp = np.zeros((ny*nx,3), np.float32)
for filename in glob.glob('./camera_cal/*.jpg'):
#print(filename)
# Loading the image
im = cv2.imread(filename)
# Convert to grayscale
im_gry = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
#plt.imshow(im_gry, cmap="gray")
# Appending to the list of images
#image.append(im_gry)
images.append(im_gry)
ret, corners = cv2.findChessboardCorners(im_gry, (nx,ny), None)
if ret == True:
objpoints.append(objp)
imgpoints.append(corners)
#images = np.array(images)
shape = (im.shape[1],im.shape[0])
ret, cameraMatrix, distortionCoeffs, rvecs, tvecs = \
cv2.calibrateCamera(objpoints, imgpoints, shape,None,None)
im_undist = []
for i in images:
#plt.subplot(2,1,1)
#plt.imshow(i, cmap = "gray")
undist = cv2.undistort(i, cameraMatrix, distortionCoeffs, None, cameraMatrix)
im_undist.append(undist)
#plt.subplot(2,1,2)
#plt.imshow(undist, cmap = "gray")
plt.subplot(2,1,1)
plt.imshow(images[18],cmap = "gray")
plt.subplot(2,1,2)
plt.imshow(im_undist[18],cmap = "gray")
plt.show()
print('======================================================================')
print('Done')
print('======================================================================')
| [
1,
396,
7686,
16032,
292,
9962,
13,
5215,
12655,
408,
7442,
13,
3166,
349,
6227,
1053,
7084,
13,
5215,
13149,
13,
5215,
13850,
29906,
13,
5215,
22889,
29889,
3027,
408,
22326,
2492,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
29937,
7686,
5282,
2827,
3168,
13,
13,
13,
29937,
7686,
24321,
1208,
492,
1182,
362,
13,
29937,
16012,
4558,
322,
3022,
1765,
304,
16749,
7052,
13,
13,
1460,
353,
29871,
29953,
13,
23818,
353,
29871,
29929,
29871,
13,
2492,
9748,
353,
5159,
462,
462,
4706,
396,
1954,
1179,
13,
5415,
9748,
353,
5159,
13,
8346,
353,
5159,
13,
5415,
29886,
353,
7442,
29889,
3298,
359,
3552,
1460,
29930,
23818,
29892,
29941,
511,
7442,
29889,
7411,
29941,
29906,
29897,
13,
1454,
10422,
297,
13149,
29889,
23705,
877,
6904,
26065,
29918,
1052,
5515,
29889,
6173,
29374,
13,
1678,
396,
2158,
29898,
9507,
29897,
13,
1678,
396,
4309,
9382,
278,
1967,
13,
1678,
527,
353,
13850,
29906,
29889,
326,
949,
29898,
9507,
29897,
13,
1678,
396,
14806,
304,
16749,
7052,
13,
1678,
527,
29918,
14793,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
326,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29954,
22800,
29897,
13,
1678,
396,
572,
29873,
29889,
326,
4294,
29898,
326,
29918,
14793,
29892,
274,
1958,
543,
21012,
1159,
13,
1678,
396,
2401,
2548,
304,
278,
1051,
310,
4558,
13,
1678,
396,
3027,
29889,
4397,
29898,
326,
29918,
14793,
29897,
13,
1678,
4558,
29889,
4397,
29898,
326,
29918,
14793,
29897,
13,
1678,
3240,
29892,
26995,
353,
13850,
29906,
29889,
2886,
1451,
404,
3377,
29907,
1398,
414,
29898,
326,
29918,
14793,
29892,
313,
23818,
29892,
1460,
511,
6213,
29897,
13,
268,
13,
1678,
565,
3240,
1275,
5852,
29901,
13,
4706,
5446,
9748,
29889,
4397,
29898,
5415,
29886,
29897,
13,
4706,
10153,
9748,
29889,
4397,
29898,
29883,
1398,
414,
29897,
13,
29937,
8346,
353,
7442,
29889,
2378,
29898,
8346,
29897,
29871,
13,
4706,
13,
12181,
353,
313,
326,
29889,
12181,
29961,
29896,
1402,
326,
29889,
12181,
29961,
29900,
2314,
13,
2267,
29892,
10656,
14609,
29892,
1320,
441,
291,
29907,
7297,
600,
29879,
29892,
364,
2003,
29879,
29892,
260,
2003,
29879,
353,
320,
13,
11023,
29906,
29889,
1052,
4626,
403,
20717,
29898,
5415,
9748,
29892,
10153,
9748,
29892,
8267,
29892,
8516,
29892,
8516,
29897,
13,
13,
326,
29918,
870,
391,
353,
5159,
13,
1454,
474,
297,
4558,
29901,
13,
1678,
396,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29892,
29896,
29892,
29896,
29897,
13,
1678,
396,
572,
29873,
29889,
326,
4294,
29898,
29875,
29892,
274,
1958,
353,
376,
21012,
1159,
13,
1678,
563,
391,
353,
13850,
29906,
29889,
870,
391,
441,
29898,
29875,
29892,
10656,
14609,
29892,
1320,
441,
291,
29907,
7297,
600,
29879,
29892,
6213,
29892,
10656,
14609,
29897,
13,
1678,
527,
29918,
870,
391,
29889,
4397,
29898,
870,
391,
29897,
13,
1678,
396,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29892,
29896,
29892,
29906,
29897,
13,
1678,
396,
572,
29873,
29889,
326,
4294,
29898,
870,
391,
29892,
274,
1958,
353,
376,
21012,
1159,
13,
268,
13,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29892,
29896,
29892,
29896,
29897,
13,
572,
29873,
29889,
326,
4294,
29898,
8346,
29961,
29896,
29947,
1402,
29883,
1958,
353,
376,
21012,
1159,
13,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29892,
29896,
29892,
29906,
29897,
13,
572,
29873,
29889,
326,
4294,
29898,
326,
29918,
870,
391,
29961,
29896,
29947,
1402,
29883,
1958,
353,
376,
21012,
1159,
13,
572,
29873,
29889,
4294,
580,
13,
29871,
13,
13,
2158,
877,
9166,
9166,
9166,
9166,
2751,
1360,
1495,
13,
2158,
877,
25632,
1495,
13,
2158,
877,
9166,
9166,
9166,
9166,
2751,
1360,
1495,
13,
13,
2
] |
alipay/aop/api/domain/HealthServiceSku.py | antopen/alipay-sdk-python-all | 213 | 99913 | <filename>alipay/aop/api/domain/HealthServiceSku.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class HealthServiceSku(object):
def __init__(self):
self._merchant_item_sku_bar_code = None
self._sku_id = None
@property
def merchant_item_sku_bar_code(self):
return self._merchant_item_sku_bar_code
@merchant_item_sku_bar_code.setter
def merchant_item_sku_bar_code(self, value):
self._merchant_item_sku_bar_code = value
@property
def sku_id(self):
return self._sku_id
@sku_id.setter
def sku_id(self, value):
self._sku_id = value
def to_alipay_dict(self):
params = dict()
if self.merchant_item_sku_bar_code:
if hasattr(self.merchant_item_sku_bar_code, 'to_alipay_dict'):
params['merchant_item_sku_bar_code'] = self.merchant_item_sku_bar_code.to_alipay_dict()
else:
params['merchant_item_sku_bar_code'] = self.merchant_item_sku_bar_code
if self.sku_id:
if hasattr(self.sku_id, 'to_alipay_dict'):
params['sku_id'] = self.sku_id.to_alipay_dict()
else:
params['sku_id'] = self.sku_id
return params
@staticmethod
def from_alipay_dict(d):
if not d:
return None
o = HealthServiceSku()
if 'merchant_item_sku_bar_code' in d:
o.merchant_item_sku_bar_code = d['merchant_item_sku_bar_code']
if 'sku_id' in d:
o.sku_id = d['sku_id']
return o
| [
1,
529,
9507,
29958,
284,
666,
388,
29914,
29874,
459,
29914,
2754,
29914,
7247,
29914,
3868,
4298,
3170,
29903,
2120,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
5215,
4390,
13,
13,
3166,
394,
666,
388,
29889,
29874,
459,
29889,
2754,
29889,
23362,
29889,
4736,
26570,
1053,
334,
13,
13,
13,
1990,
15202,
3170,
29903,
2120,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
353,
6213,
13,
4706,
1583,
3032,
18181,
29918,
333,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
29055,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
13,
13,
1678,
732,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29889,
842,
357,
13,
1678,
822,
29055,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29898,
1311,
29892,
995,
1125,
13,
4706,
1583,
3032,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
353,
995,
13,
1678,
732,
6799,
13,
1678,
822,
2071,
29884,
29918,
333,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
18181,
29918,
333,
13,
13,
1678,
732,
18181,
29918,
333,
29889,
842,
357,
13,
1678,
822,
2071,
29884,
29918,
333,
29898,
1311,
29892,
995,
1125,
13,
4706,
1583,
3032,
18181,
29918,
333,
353,
995,
13,
13,
13,
1678,
822,
304,
29918,
284,
666,
388,
29918,
8977,
29898,
1311,
1125,
13,
4706,
8636,
353,
9657,
580,
13,
4706,
565,
1583,
29889,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29901,
13,
9651,
565,
756,
5552,
29898,
1311,
29889,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29892,
525,
517,
29918,
284,
666,
388,
29918,
8977,
29374,
13,
18884,
8636,
1839,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
2033,
353,
1583,
29889,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29889,
517,
29918,
284,
666,
388,
29918,
8977,
580,
13,
9651,
1683,
29901,
13,
18884,
8636,
1839,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
2033,
353,
1583,
29889,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
13,
4706,
565,
1583,
29889,
18181,
29918,
333,
29901,
13,
9651,
565,
756,
5552,
29898,
1311,
29889,
18181,
29918,
333,
29892,
525,
517,
29918,
284,
666,
388,
29918,
8977,
29374,
13,
18884,
8636,
1839,
18181,
29918,
333,
2033,
353,
1583,
29889,
18181,
29918,
333,
29889,
517,
29918,
284,
666,
388,
29918,
8977,
580,
13,
9651,
1683,
29901,
13,
18884,
8636,
1839,
18181,
29918,
333,
2033,
353,
1583,
29889,
18181,
29918,
333,
13,
4706,
736,
8636,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
515,
29918,
284,
666,
388,
29918,
8977,
29898,
29881,
1125,
13,
4706,
565,
451,
270,
29901,
13,
9651,
736,
6213,
13,
4706,
288,
353,
15202,
3170,
29903,
2120,
580,
13,
4706,
565,
525,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
29915,
297,
270,
29901,
13,
9651,
288,
29889,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
353,
270,
1839,
1050,
13775,
29918,
667,
29918,
18181,
29918,
1646,
29918,
401,
2033,
13,
4706,
565,
525,
18181,
29918,
333,
29915,
297,
270,
29901,
13,
9651,
288,
29889,
18181,
29918,
333,
353,
270,
1839,
18181,
29918,
333,
2033,
13,
4706,
736,
288,
13,
13,
13,
2
] |
examples/relationship/many_to_many/pre_defined_models_auto.py | MihailMiller/OpenAlchemy | 40 | 187576 | <filename>examples/relationship/many_to_many/pre_defined_models_auto.py
"""Autogenerated SQLAlchemy models based on OpenAlchemy models."""
# pylint: disable=no-member,super-init-not-called,unused-argument
import typing
import sqlalchemy
from sqlalchemy import orm
from open_alchemy import models
Base = models.Base # type: ignore
class ProjectDict(typing.TypedDict, total=False):
"""TypedDict for properties that are not required."""
id: typing.Optional[int]
name: typing.Optional[str]
class TProject(typing.Protocol):
"""
SQLAlchemy model protocol.
A large sized business objective.
Attrs:
id: Unique identifier for the project.
name: The name of the project.
"""
# SQLAlchemy properties
__table__: sqlalchemy.Table
__tablename__: str
query: orm.Query
# Model properties
id: "sqlalchemy.Column[typing.Optional[int]]"
name: "sqlalchemy.Column[typing.Optional[str]]"
def __init__(
self, id: typing.Optional[int] = None, name: typing.Optional[str] = None
) -> None:
"""
Construct.
Args:
id: Unique identifier for the project.
name: The name of the project.
"""
...
@classmethod
def from_dict(
cls, id: typing.Optional[int] = None, name: typing.Optional[str] = None
) -> "TProject":
"""
Construct from a dictionary (eg. a POST payload).
Args:
id: Unique identifier for the project.
name: The name of the project.
Returns:
Model instance based on the dictionary.
"""
...
@classmethod
def from_str(cls, value: str) -> "TProject":
"""
Construct from a JSON string (eg. a POST payload).
Returns:
Model instance based on the JSON string.
"""
...
def to_dict(self) -> ProjectDict:
"""
Convert to a dictionary (eg. to send back for a GET request).
Returns:
Dictionary based on the model instance.
"""
...
def to_str(self) -> str:
"""
Convert to a JSON string (eg. to send back for a GET request).
Returns:
JSON string based on the model instance.
"""
...
Project: typing.Type[TProject] = models.Project # type: ignore
class EmployeeDict(typing.TypedDict, total=False):
"""TypedDict for properties that are not required."""
id: typing.Optional[int]
name: typing.Optional[str]
projects: typing.Sequence["ProjectDict"]
class TEmployee(typing.Protocol):
"""
SQLAlchemy model protocol.
Person that works for a company.
Attrs:
id: Unique identifier for the employee.
name: The name of the employee.
projects: The projects the employee is working on.
"""
# SQLAlchemy properties
__table__: sqlalchemy.Table
__tablename__: str
query: orm.Query
# Model properties
id: "sqlalchemy.Column[typing.Optional[int]]"
name: "sqlalchemy.Column[typing.Optional[str]]"
projects: 'sqlalchemy.Column[typing.Sequence["TProject"]]'
def __init__(
self,
id: typing.Optional[int] = None,
name: typing.Optional[str] = None,
projects: typing.Optional[typing.Sequence["TProject"]] = None,
) -> None:
"""
Construct.
Args:
id: Unique identifier for the employee.
name: The name of the employee.
projects: The projects the employee is working on.
"""
...
@classmethod
def from_dict(
cls,
id: typing.Optional[int] = None,
name: typing.Optional[str] = None,
projects: typing.Optional[typing.Sequence["ProjectDict"]] = None,
) -> "TEmployee":
"""
Construct from a dictionary (eg. a POST payload).
Args:
id: Unique identifier for the employee.
name: The name of the employee.
projects: The projects the employee is working on.
Returns:
Model instance based on the dictionary.
"""
...
@classmethod
def from_str(cls, value: str) -> "TEmployee":
"""
Construct from a JSON string (eg. a POST payload).
Returns:
Model instance based on the JSON string.
"""
...
def to_dict(self) -> EmployeeDict:
"""
Convert to a dictionary (eg. to send back for a GET request).
Returns:
Dictionary based on the model instance.
"""
...
def to_str(self) -> str:
"""
Convert to a JSON string (eg. to send back for a GET request).
Returns:
JSON string based on the model instance.
"""
...
Employee: typing.Type[TEmployee] = models.Employee # type: ignore
class EmployeeProjectDict(typing.TypedDict, total=True):
"""TypedDict for properties that are required."""
employee_id: int
project_id: int
class TEmployeeProject(typing.Protocol):
"""
SQLAlchemy model protocol.
Attrs:
employee_id: The employee_id of the EmployeeProject.
project_id: The project_id of the EmployeeProject.
"""
# SQLAlchemy properties
__table__: sqlalchemy.Table
__tablename__: str
query: orm.Query
# Model properties
employee_id: "sqlalchemy.Column[int]"
project_id: "sqlalchemy.Column[int]"
def __init__(self, employee_id: int, project_id: int) -> None:
"""
Construct.
Args:
employee_id: The employee_id of the EmployeeProject.
project_id: The project_id of the EmployeeProject.
"""
...
@classmethod
def from_dict(cls, employee_id: int, project_id: int) -> "TEmployeeProject":
"""
Construct from a dictionary (eg. a POST payload).
Args:
employee_id: The employee_id of the EmployeeProject.
project_id: The project_id of the EmployeeProject.
Returns:
Model instance based on the dictionary.
"""
...
@classmethod
def from_str(cls, value: str) -> "TEmployeeProject":
"""
Construct from a JSON string (eg. a POST payload).
Returns:
Model instance based on the JSON string.
"""
...
def to_dict(self) -> EmployeeProjectDict:
"""
Convert to a dictionary (eg. to send back for a GET request).
Returns:
Dictionary based on the model instance.
"""
...
def to_str(self) -> str:
"""
Convert to a JSON string (eg. to send back for a GET request).
Returns:
JSON string based on the model instance.
"""
...
EmployeeProject: typing.Type[TEmployeeProject] = models.EmployeeProject # type: ignore
| [
1,
529,
9507,
29958,
19057,
29914,
2674,
800,
4034,
29914,
13011,
29918,
517,
29918,
13011,
29914,
1457,
29918,
12119,
29918,
9794,
29918,
6921,
29889,
2272,
13,
15945,
29908,
6147,
468,
759,
630,
3758,
2499,
305,
6764,
4733,
2729,
373,
4673,
2499,
305,
6764,
4733,
1213,
15945,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
1217,
29899,
14242,
29892,
9136,
29899,
2344,
29899,
1333,
29899,
13998,
29892,
348,
3880,
29899,
23516,
13,
13,
5215,
19229,
13,
13,
5215,
4576,
284,
305,
6764,
13,
3166,
4576,
284,
305,
6764,
1053,
470,
29885,
13,
13,
3166,
1722,
29918,
284,
305,
6764,
1053,
4733,
13,
13,
5160,
353,
4733,
29889,
5160,
29871,
396,
1134,
29901,
11455,
13,
13,
13,
1990,
8010,
21533,
29898,
1017,
15702,
29889,
24933,
287,
21533,
29892,
3001,
29922,
8824,
1125,
13,
1678,
9995,
24933,
287,
21533,
363,
4426,
393,
526,
451,
3734,
1213,
15945,
13,
13,
1678,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
13,
1678,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
13,
13,
13,
1990,
323,
7653,
29898,
1017,
15702,
29889,
17830,
1125,
13,
1678,
9995,
13,
1678,
3758,
2499,
305,
6764,
1904,
9608,
29889,
13,
13,
1678,
319,
2919,
269,
1891,
5381,
12091,
29889,
13,
13,
1678,
2180,
509,
29879,
29901,
13,
4706,
1178,
29901,
853,
1387,
15882,
363,
278,
2060,
29889,
13,
4706,
1024,
29901,
450,
1024,
310,
278,
2060,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3758,
2499,
305,
6764,
4426,
13,
1678,
4770,
2371,
1649,
29901,
4576,
284,
305,
6764,
29889,
3562,
13,
1678,
4770,
3891,
2435,
420,
1649,
29901,
851,
13,
1678,
2346,
29901,
470,
29885,
29889,
3010,
13,
13,
1678,
396,
8125,
4426,
13,
1678,
1178,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
1017,
15702,
29889,
27636,
29961,
524,
5262,
29908,
13,
1678,
1024,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
1017,
15702,
29889,
27636,
29961,
710,
5262,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
353,
6213,
29892,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
353,
6213,
13,
1678,
1723,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
1281,
4984,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1178,
29901,
853,
1387,
15882,
363,
278,
2060,
29889,
13,
9651,
1024,
29901,
450,
1024,
310,
278,
2060,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
8977,
29898,
13,
4706,
1067,
29879,
29892,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
353,
6213,
29892,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
353,
6213,
13,
1678,
1723,
1599,
376,
29911,
7653,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
8600,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1178,
29901,
853,
1387,
15882,
363,
278,
2060,
29889,
13,
9651,
1024,
29901,
450,
1024,
310,
278,
2060,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
8600,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
710,
29898,
25932,
29892,
995,
29901,
851,
29897,
1599,
376,
29911,
7653,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
4663,
1347,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
4663,
1347,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
29897,
1599,
8010,
21533,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
8600,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
13343,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
710,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
4663,
1347,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
4663,
1347,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
13,
7653,
29901,
19229,
29889,
1542,
29961,
29911,
7653,
29962,
353,
4733,
29889,
7653,
29871,
396,
1134,
29901,
11455,
13,
13,
13,
1990,
24654,
21533,
29898,
1017,
15702,
29889,
24933,
287,
21533,
29892,
3001,
29922,
8824,
1125,
13,
1678,
9995,
24933,
287,
21533,
363,
4426,
393,
526,
451,
3734,
1213,
15945,
13,
13,
1678,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
13,
1678,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
13,
1678,
9279,
29901,
19229,
29889,
20529,
3366,
7653,
21533,
3108,
13,
13,
13,
1990,
323,
19461,
29898,
1017,
15702,
29889,
17830,
1125,
13,
1678,
9995,
13,
1678,
3758,
2499,
305,
6764,
1904,
9608,
29889,
13,
13,
1678,
5196,
393,
1736,
363,
263,
5001,
29889,
13,
13,
1678,
2180,
509,
29879,
29901,
13,
4706,
1178,
29901,
853,
1387,
15882,
363,
278,
19001,
29889,
13,
4706,
1024,
29901,
450,
1024,
310,
278,
19001,
29889,
13,
4706,
9279,
29901,
450,
9279,
278,
19001,
338,
1985,
373,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3758,
2499,
305,
6764,
4426,
13,
1678,
4770,
2371,
1649,
29901,
4576,
284,
305,
6764,
29889,
3562,
13,
1678,
4770,
3891,
2435,
420,
1649,
29901,
851,
13,
1678,
2346,
29901,
470,
29885,
29889,
3010,
13,
13,
1678,
396,
8125,
4426,
13,
1678,
1178,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
1017,
15702,
29889,
27636,
29961,
524,
5262,
29908,
13,
1678,
1024,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
1017,
15702,
29889,
27636,
29961,
710,
5262,
29908,
13,
1678,
9279,
29901,
525,
2850,
284,
305,
6764,
29889,
4409,
29961,
1017,
15702,
29889,
20529,
3366,
29911,
7653,
3108,
29962,
29915,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
353,
6213,
29892,
13,
4706,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
9279,
29901,
19229,
29889,
27636,
29961,
1017,
15702,
29889,
20529,
3366,
29911,
7653,
3108,
29962,
353,
6213,
29892,
13,
1678,
1723,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
1281,
4984,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1178,
29901,
853,
1387,
15882,
363,
278,
19001,
29889,
13,
9651,
1024,
29901,
450,
1024,
310,
278,
19001,
29889,
13,
9651,
9279,
29901,
450,
9279,
278,
19001,
338,
1985,
373,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
8977,
29898,
13,
4706,
1067,
29879,
29892,
13,
4706,
1178,
29901,
19229,
29889,
27636,
29961,
524,
29962,
353,
6213,
29892,
13,
4706,
1024,
29901,
19229,
29889,
27636,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
9279,
29901,
19229,
29889,
27636,
29961,
1017,
15702,
29889,
20529,
3366,
7653,
21533,
3108,
29962,
353,
6213,
29892,
13,
1678,
1723,
1599,
376,
4330,
1526,
10164,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
8600,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
1178,
29901,
853,
1387,
15882,
363,
278,
19001,
29889,
13,
9651,
1024,
29901,
450,
1024,
310,
278,
19001,
29889,
13,
9651,
9279,
29901,
450,
9279,
278,
19001,
338,
1985,
373,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
8600,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
710,
29898,
25932,
29892,
995,
29901,
851,
29897,
1599,
376,
4330,
1526,
10164,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
4663,
1347,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
4663,
1347,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
29897,
1599,
24654,
21533,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
8600,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
13343,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
710,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
4663,
1347,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
4663,
1347,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
13,
19461,
29901,
19229,
29889,
1542,
29961,
4330,
1526,
10164,
29962,
353,
4733,
29889,
19461,
29871,
396,
1134,
29901,
11455,
13,
13,
13,
1990,
24654,
7653,
21533,
29898,
1017,
15702,
29889,
24933,
287,
21533,
29892,
3001,
29922,
5574,
1125,
13,
1678,
9995,
24933,
287,
21533,
363,
4426,
393,
526,
3734,
1213,
15945,
13,
13,
1678,
19001,
29918,
333,
29901,
938,
13,
1678,
2060,
29918,
333,
29901,
938,
13,
13,
13,
1990,
323,
19461,
7653,
29898,
1017,
15702,
29889,
17830,
1125,
13,
1678,
9995,
13,
1678,
3758,
2499,
305,
6764,
1904,
9608,
29889,
13,
13,
1678,
2180,
509,
29879,
29901,
13,
4706,
19001,
29918,
333,
29901,
450,
19001,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
4706,
2060,
29918,
333,
29901,
450,
2060,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
396,
3758,
2499,
305,
6764,
4426,
13,
1678,
4770,
2371,
1649,
29901,
4576,
284,
305,
6764,
29889,
3562,
13,
1678,
4770,
3891,
2435,
420,
1649,
29901,
851,
13,
1678,
2346,
29901,
470,
29885,
29889,
3010,
13,
13,
1678,
396,
8125,
4426,
13,
1678,
19001,
29918,
333,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
524,
18017,
13,
1678,
2060,
29918,
333,
29901,
376,
2850,
284,
305,
6764,
29889,
4409,
29961,
524,
18017,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
19001,
29918,
333,
29901,
938,
29892,
2060,
29918,
333,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
1281,
4984,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
19001,
29918,
333,
29901,
450,
19001,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
9651,
2060,
29918,
333,
29901,
450,
2060,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
8977,
29898,
25932,
29892,
19001,
29918,
333,
29901,
938,
29892,
2060,
29918,
333,
29901,
938,
29897,
1599,
376,
4330,
1526,
10164,
7653,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
8600,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
19001,
29918,
333,
29901,
450,
19001,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
9651,
2060,
29918,
333,
29901,
450,
2060,
29918,
333,
310,
278,
24654,
7653,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
8600,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
710,
29898,
25932,
29892,
995,
29901,
851,
29897,
1599,
376,
4330,
1526,
10164,
7653,
1115,
13,
4706,
9995,
13,
4706,
1281,
4984,
515,
263,
4663,
1347,
313,
387,
29889,
263,
11971,
20092,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
8125,
2777,
2729,
373,
278,
4663,
1347,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
29897,
1599,
24654,
7653,
21533,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
8600,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
13343,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
1678,
822,
304,
29918,
710,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
14806,
304,
263,
4663,
1347,
313,
387,
29889,
304,
3638,
1250,
363,
263,
12354,
2009,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
4663,
1347,
2729,
373,
278,
1904,
2777,
29889,
13,
13,
4706,
9995,
13,
4706,
2023,
13,
13,
13,
19461,
7653,
29901,
19229,
29889,
1542,
29961,
4330,
1526,
10164,
7653,
29962,
353,
4733,
29889,
19461,
7653,
29871,
396,
1134,
29901,
11455,
13,
2
] |
hes/views.py | dwcaraway/homeschoolring | 0 | 143119 | __author__ = 'dave'
from django.shortcuts import render
def ajax(request, ajax_code):
return render(request=request, template_name="hes/ajax/%s.html" % ajax_code, context={})
def coming_soon(request):
return render(request=request, template_name="hes/coming-soon.html", context={})
| [
1,
4770,
8921,
1649,
353,
525,
29881,
1351,
29915,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
13,
1753,
9349,
29898,
3827,
29892,
9349,
29918,
401,
1125,
13,
1678,
736,
4050,
29898,
3827,
29922,
3827,
29892,
4472,
29918,
978,
543,
13244,
29914,
6538,
22584,
29879,
29889,
1420,
29908,
1273,
9349,
29918,
401,
29892,
3030,
3790,
1800,
13,
13,
1753,
6421,
29918,
578,
265,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29922,
3827,
29892,
4472,
29918,
978,
543,
13244,
29914,
11506,
29899,
578,
265,
29889,
1420,
613,
3030,
3790,
1800,
13,
2
] |
moai/monads/human/pose/__init__.py | ai-in-motion/moai | 10 | 51206 | from moai.monads.human.pose.openpose import (
Split as OpenposeSplit,
JointMap as OpenposeJointMap
)
__all__ = [
'OpenposeSplit',
'OpenposeJointMap',
] | [
1,
515,
2730,
1794,
29889,
3712,
7925,
29889,
26029,
29889,
4220,
29889,
3150,
4220,
1053,
313,
13,
1678,
26178,
408,
4673,
4220,
18772,
29892,
13,
1678,
435,
2461,
3388,
408,
4673,
4220,
29967,
2461,
3388,
13,
29897,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
6585,
4220,
18772,
742,
13,
1678,
525,
6585,
4220,
29967,
2461,
3388,
742,
13,
29962,
2
] |
strategies/mas/experiment.py | rmassidda/reproducible-continual-learning | 0 | 63433 | import unittest
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD
from avalanche.evaluation.metrics import (
accuracy_metrics,
forgetting_metrics,
loss_metrics
)
from avalanche.training.plugins import EvaluationPlugin
from models import MultiHeadVGGSmall
from strategies.utils import create_default_args, get_average_metric
from strategies.utils import get_target_result, set_seed
import avalanche as avl
class MAS(unittest.TestCase):
"""
Reproducing Memory Aware Synapses experiments from paper
"A continual learning survey: Defying forgetting in classification tasks"
by De Lange et al.
https://doi.org/10.1109/TPAMI.2021.3057446
"""
def test_stinyimagenet(self, override_args=None):
"""Split Tiny ImageNet benchmark"""
args = create_default_args(
{'cuda': 0, 'lambda_reg': 2., 'alpha': 0.5,
'verbose': True, 'learning_rate': 0.005,
'train_mb_size': 200, 'epochs': 70, 'seed': 0,
'dataset_root': None}, override_args)
set_seed(args.seed)
device = torch.device(f"cuda:{args.cuda}"
if torch.cuda.is_available() and
args.cuda >= 0 else "cpu")
"""
"In order to construct a balanced dataset, we assign an equal amount of
20 randomly chosen classes to each task in a sequence of 10 consecutive
tasks. This task incremental setting allows using an oracle at test
time for our evaluation per task, ensuring all tasks are roughly
similar in terms of difficulty, size, and distribution, making the
interpretation of the results easier."
"""
benchmark = avl.benchmarks.SplitTinyImageNet(
10, return_task_id=True, dataset_root=args.dataset_root)
model = MultiHeadVGGSmall(n_classes=20)
criterion = CrossEntropyLoss()
interactive_logger = avl.logging.InteractiveLogger()
evaluation_plugin = EvaluationPlugin(
accuracy_metrics(
epoch=True, experience=True, stream=True
),
loss_metrics(
epoch=True, experience=True, stream=True
),
forgetting_metrics(
experience=True, stream=True
),
loggers=[interactive_logger], benchmark=benchmark)
cl_strategy = avl.training.MAS(
model,
SGD(model.parameters(), lr=args.learning_rate, momentum=0.9),
criterion, lambda_reg=args.lambda_reg, alpha=args.alpha,
verbose=args.verbose, train_mb_size=args.train_mb_size,
train_epochs=args.epochs, eval_mb_size=128, device=device,
evaluator=evaluation_plugin)
res = None
for experience in benchmark.train_stream:
cl_strategy.train(experience)
res = cl_strategy.eval(benchmark.test_stream)
if res is None:
raise Exception("No results found")
avg_stream_acc = get_average_metric(res)
print("MAS-SplitTinyImageNet Average "
f"Stream Accuracy: {avg_stream_acc:.2f}")
# Recover target from CSV
target = get_target_result('mas', 'stiny-imagenet')
if isinstance(target, list):
target_acc = target[0]
else:
target_acc = target
target_acc = float(target_acc)
print(f"The target value was {target_acc:.2f}")
# Check if the result is close to the target
if args.check and target_acc > avg_stream_acc:
self.assertAlmostEqual(target_acc, avg_stream_acc, delta=0.03)
| [
1,
1053,
443,
27958,
13,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
29889,
15755,
1053,
11189,
5292,
14441,
29931,
2209,
13,
3166,
4842,
305,
29889,
20640,
1053,
317,
29954,
29928,
13,
13,
3166,
263,
791,
20372,
29889,
24219,
362,
29889,
2527,
10817,
1053,
313,
13,
1678,
13600,
29918,
2527,
10817,
29892,
13,
1678,
9566,
1259,
29918,
2527,
10817,
29892,
13,
1678,
6410,
29918,
2527,
10817,
13,
29897,
13,
3166,
263,
791,
20372,
29889,
26495,
29889,
12800,
1053,
382,
4387,
362,
16288,
13,
3166,
4733,
1053,
14974,
5494,
29963,
29954,
10749,
29885,
497,
13,
3166,
16650,
583,
29889,
13239,
1053,
1653,
29918,
4381,
29918,
5085,
29892,
679,
29918,
12483,
482,
29918,
16414,
13,
3166,
16650,
583,
29889,
13239,
1053,
679,
29918,
5182,
29918,
2914,
29892,
731,
29918,
26776,
13,
5215,
263,
791,
20372,
408,
1029,
29880,
13,
13,
13,
1990,
341,
3289,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
9995,
13,
1678,
830,
5498,
3277,
18914,
319,
2519,
10829,
2547,
267,
15729,
515,
5650,
13,
1678,
376,
29909,
2145,
950,
6509,
18994,
29901,
5282,
5414,
9566,
1259,
297,
12965,
9595,
29908,
13,
1678,
491,
897,
365,
927,
634,
394,
29889,
13,
1678,
2045,
597,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
3557,
5194,
29902,
29889,
29906,
29900,
29906,
29896,
29889,
29941,
29900,
29945,
29955,
29946,
29946,
29953,
13,
1678,
9995,
13,
13,
1678,
822,
1243,
29918,
303,
4901,
326,
5370,
300,
29898,
1311,
29892,
5712,
29918,
5085,
29922,
8516,
1125,
13,
4706,
9995,
18772,
323,
4901,
7084,
6779,
23513,
15945,
29908,
13,
4706,
6389,
353,
1653,
29918,
4381,
29918,
5085,
29898,
13,
9651,
11117,
29883,
6191,
2396,
29871,
29900,
29892,
525,
2892,
29918,
1727,
2396,
29871,
29906,
1696,
525,
2312,
2396,
29871,
29900,
29889,
29945,
29892,
13,
632,
525,
369,
15828,
2396,
5852,
29892,
525,
21891,
29918,
10492,
2396,
29871,
29900,
29889,
29900,
29900,
29945,
29892,
13,
632,
525,
14968,
29918,
8337,
29918,
2311,
2396,
29871,
29906,
29900,
29900,
29892,
525,
1022,
2878,
29879,
2396,
29871,
29955,
29900,
29892,
525,
26776,
2396,
29871,
29900,
29892,
13,
632,
525,
24713,
29918,
4632,
2396,
6213,
1118,
5712,
29918,
5085,
29897,
13,
4706,
731,
29918,
26776,
29898,
5085,
29889,
26776,
29897,
13,
4706,
4742,
353,
4842,
305,
29889,
10141,
29898,
29888,
29908,
29883,
6191,
26254,
5085,
29889,
29883,
6191,
5038,
13,
462,
795,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
322,
13,
462,
795,
6389,
29889,
29883,
6191,
6736,
29871,
29900,
1683,
376,
21970,
1159,
13,
13,
4706,
9995,
13,
4706,
376,
797,
1797,
304,
3386,
263,
6411,
8362,
8783,
29892,
591,
3566,
385,
5186,
5253,
310,
13,
308,
29906,
29900,
20459,
10434,
4413,
304,
1269,
3414,
297,
263,
5665,
310,
29871,
29896,
29900,
18942,
13,
4706,
9595,
29889,
910,
3414,
11924,
284,
4444,
6511,
773,
385,
17919,
472,
1243,
13,
4706,
931,
363,
1749,
17983,
639,
3414,
29892,
5662,
3864,
599,
9595,
526,
20928,
13,
4706,
2788,
297,
4958,
310,
14656,
29892,
2159,
29892,
322,
4978,
29892,
3907,
278,
13,
4706,
19854,
310,
278,
2582,
6775,
1213,
13,
4706,
9995,
13,
4706,
23513,
353,
1029,
29880,
29889,
1785,
16580,
29879,
29889,
18772,
29911,
4901,
2940,
6779,
29898,
13,
632,
29896,
29900,
29892,
736,
29918,
7662,
29918,
333,
29922,
5574,
29892,
8783,
29918,
4632,
29922,
5085,
29889,
24713,
29918,
4632,
29897,
13,
4706,
1904,
353,
14974,
5494,
29963,
29954,
10749,
29885,
497,
29898,
29876,
29918,
13203,
29922,
29906,
29900,
29897,
13,
4706,
28770,
291,
353,
11189,
5292,
14441,
29931,
2209,
580,
13,
13,
4706,
28923,
29918,
21707,
353,
1029,
29880,
29889,
21027,
29889,
4074,
4925,
16363,
580,
13,
13,
4706,
17983,
29918,
8582,
353,
382,
4387,
362,
16288,
29898,
13,
9651,
13600,
29918,
2527,
10817,
29898,
13,
18884,
21502,
305,
29922,
5574,
29892,
7271,
29922,
5574,
29892,
4840,
29922,
5574,
13,
9651,
10353,
13,
9651,
6410,
29918,
2527,
10817,
29898,
13,
18884,
21502,
305,
29922,
5574,
29892,
7271,
29922,
5574,
29892,
4840,
29922,
5574,
13,
9651,
10353,
13,
9651,
9566,
1259,
29918,
2527,
10817,
29898,
13,
18884,
7271,
29922,
5574,
29892,
4840,
29922,
5574,
13,
9651,
10353,
13,
9651,
1480,
5743,
11759,
1639,
4925,
29918,
21707,
1402,
23513,
29922,
1785,
16580,
29897,
13,
13,
4706,
1067,
29918,
710,
8963,
353,
1029,
29880,
29889,
26495,
29889,
1529,
29903,
29898,
13,
9651,
1904,
29892,
13,
9651,
317,
29954,
29928,
29898,
4299,
29889,
16744,
3285,
301,
29878,
29922,
5085,
29889,
21891,
29918,
10492,
29892,
19399,
29922,
29900,
29889,
29929,
511,
13,
9651,
28770,
291,
29892,
14013,
29918,
1727,
29922,
5085,
29889,
2892,
29918,
1727,
29892,
15595,
29922,
5085,
29889,
2312,
29892,
13,
9651,
26952,
29922,
5085,
29889,
369,
15828,
29892,
7945,
29918,
8337,
29918,
2311,
29922,
5085,
29889,
14968,
29918,
8337,
29918,
2311,
29892,
13,
9651,
7945,
29918,
1022,
2878,
29879,
29922,
5085,
29889,
1022,
2878,
29879,
29892,
19745,
29918,
8337,
29918,
2311,
29922,
29896,
29906,
29947,
29892,
4742,
29922,
10141,
29892,
13,
9651,
6161,
1061,
29922,
24219,
362,
29918,
8582,
29897,
13,
13,
4706,
620,
353,
6213,
13,
4706,
363,
7271,
297,
23513,
29889,
14968,
29918,
5461,
29901,
13,
9651,
1067,
29918,
710,
8963,
29889,
14968,
29898,
735,
546,
5597,
29897,
13,
9651,
620,
353,
1067,
29918,
710,
8963,
29889,
14513,
29898,
1785,
16580,
29889,
1688,
29918,
5461,
29897,
13,
13,
4706,
565,
620,
338,
6213,
29901,
13,
9651,
12020,
8960,
703,
3782,
2582,
1476,
1159,
13,
13,
4706,
1029,
29887,
29918,
5461,
29918,
5753,
353,
679,
29918,
12483,
482,
29918,
16414,
29898,
690,
29897,
13,
4706,
1596,
703,
1529,
29903,
29899,
18772,
29911,
4901,
2940,
6779,
319,
19698,
376,
13,
795,
285,
29908,
3835,
4831,
332,
4135,
29901,
426,
485,
29887,
29918,
5461,
29918,
5753,
29901,
29889,
29906,
29888,
27195,
13,
13,
4706,
396,
3599,
957,
3646,
515,
16874,
13,
4706,
3646,
353,
679,
29918,
5182,
29918,
2914,
877,
8247,
742,
525,
303,
4901,
29899,
326,
5370,
300,
1495,
13,
4706,
565,
338,
8758,
29898,
5182,
29892,
1051,
1125,
13,
9651,
3646,
29918,
5753,
353,
3646,
29961,
29900,
29962,
13,
4706,
1683,
29901,
13,
9651,
3646,
29918,
5753,
353,
3646,
13,
4706,
3646,
29918,
5753,
353,
5785,
29898,
5182,
29918,
5753,
29897,
13,
13,
4706,
1596,
29898,
29888,
29908,
1576,
3646,
995,
471,
426,
5182,
29918,
5753,
29901,
29889,
29906,
29888,
27195,
13,
13,
4706,
396,
5399,
565,
278,
1121,
338,
3802,
304,
278,
3646,
13,
4706,
565,
6389,
29889,
3198,
322,
3646,
29918,
5753,
1405,
1029,
29887,
29918,
5461,
29918,
5753,
29901,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
5182,
29918,
5753,
29892,
1029,
29887,
29918,
5461,
29918,
5753,
29892,
19471,
29922,
29900,
29889,
29900,
29941,
29897,
13,
2
] |
automol/convert/graph.py | sjklipp/autochem | 1 | 64045 | <reponame>sjklipp/autochem<gh_stars>1-10
""" graph conversions
"""
import autoparse.pattern as app
import autoparse.find as apf
from automol.util import dict_
from automol.convert.inchi import standard_form
from automol.convert.inchi import object_to_hardcoded_inchi_by_key
from automol.convert import _molfile
from automol.convert import _rdkit
from automol.convert import _util
from automol.graph._graph_dep import atom_keys
from automol.graph._graph_dep import bond_keys
from automol.graph._graph_dep import atom_symbols
from automol.graph._graph_dep import bond_orders
# getters
from automol.graph._graph_dep import without_dummy_atoms
from automol.graph._graph_dep import atom_bond_valences
from automol.graph._graph_dep import explicit
from automol.graph._graph_dep import atom_unsaturated_valences
# stereo
from automol.graph._graph_dep import has_stereo
from automol.graph._graph_dep import dominant_resonance
# dep
from automol.graph._embed_dep import fake_stereo_geometry
from automol.graph._embed_dep import geometry as embed_geometry
from automol.graph._embed_dep import backbone_isomorphic
from automol.graph.geom import coordinates
# graph => inchi
def inchi(gra, stereo=True):
""" Generate an InChI string from a molecular graph.
:param gra: molecular graph
:type gra: automol graph data structure
:param stereo: parameter to include stereochemistry information
:type stereo: bool
:rtype: str
"""
ich = object_to_hardcoded_inchi_by_key(
'graph', gra, comp=_compare)
if ich is None:
if not stereo or not has_stereo(gra):
ich, _ = inchi_with_sort_from_geometry(gra)
ich = standard_form(ich, stereo=stereo)
else:
gra = explicit(gra)
geo, geo_idx_dct = fake_stereo_geometry(gra)
ich, _ = inchi_with_sort_from_geometry(
gra, geo=geo, geo_idx_dct=geo_idx_dct)
return ich
def _compare(gra1, gra2):
""" Compare the backbone structure of two moleculare graphs.
:param gra1: molecular graph 1
:type gra1: automol graph data structure
:param gra2: molecular graph 2
:type gra2: automol graph data structure
:rtype: bool
"""
gra1 = without_dummy_atoms(gra1)
gra2 = without_dummy_atoms(gra2)
return backbone_isomorphic(gra1, gra2)
def inchi_with_sort_from_geometry(gra, geo=None, geo_idx_dct=None):
""" Generate an InChI string from a molecular graph.
If coordinates are passed in, they are used to determine stereo.
:param gra: molecular graph
:type gra: automol graph data structure
:param geo: molecular geometry
:type geo: automol geometry data structure
:param geo_idx_dct:
:type geo_idx_dct: dict[:]
:rtype: (str, tuple(int))
"""
gra = without_dummy_atoms(gra)
gra = dominant_resonance(gra)
atm_keys = sorted(atom_keys(gra))
bnd_keys = list(bond_keys(gra))
atm_syms = dict_.values_by_key(atom_symbols(gra), atm_keys)
atm_bnd_vlcs = dict_.values_by_key(
atom_bond_valences(gra), atm_keys)
atm_rad_vlcs = dict_.values_by_key(
atom_unsaturated_valences(gra), atm_keys)
bnd_ords = dict_.values_by_key(bond_orders(gra), bnd_keys)
if geo is not None:
assert geo_idx_dct is not None
atm_xyzs = coordinates(geo)
atm_xyzs = [atm_xyzs[geo_idx_dct[atm_key]] if atm_key in geo_idx_dct
else (0., 0., 0.) for atm_key in atm_keys]
else:
atm_xyzs = None
mlf, key_map_inv = _molfile.from_data(
atm_keys, bnd_keys, atm_syms, atm_bnd_vlcs, atm_rad_vlcs, bnd_ords,
atm_xyzs=atm_xyzs)
rdm = _rdkit.from_molfile(mlf)
ich, aux_info = _rdkit.to_inchi(rdm, with_aux_info=True)
nums = _parse_sort_order_from_aux_info(aux_info)
nums = tuple(map(key_map_inv.__getitem__, nums))
return ich, nums
def _parse_sort_order_from_aux_info(aux_info):
ptt = app.escape('/N:') + app.capturing(
app.series(app.UNSIGNED_INTEGER, ','))
num_str = apf.first_capture(ptt, aux_info)
nums = tuple(map(int, num_str.split(',')))
return nums
def geometry(gra):
""" Convert a molecular graph to a molecular geometry.
:param gra: molecular graph
:type gra: automol graph data structure
:rtype: automol molecular geometry data structure
"""
symbs = atom_symbols(gra)
if len(symbs) != 1:
gra = explicit(gra)
geo = embed_geometry(gra)
else:
symb = list(symbs.values())[0]
# symb = list(symbs.keys())[0]
geo = ((symb, (0.00, 0.00, 0.00)),)
return geo
def formula(gra):
""" Generate a stoichiometric formula dictionary from a molecular graph.
:param gra: molecular graph
:type gra: automol graph data structure
:type: dict[str: int]
"""
gra = explicit(gra)
syms = atom_symbols(gra).values()
fml = _util.formula(syms)
return fml
#
#
# if __name__ == '__main__':
# import automol
#
# for ICH in [
# 'InChI=1S/C4H7O2/c1-3-4(2)6-5/h3-5H,1-2H2/t4-/m0/s1',
# 'InChI=1S/C4H7O/c1-4(2)3-5/h3-4H,1H2,2H3/t4-/m1/s1',
# 'InChI=1S/C5H7/c1-3-5-4-2/h1,5H,4H2,2H3',
# 'InChI=1S/C5H9/c1-4-5(2)3/h4-5H,1-2H2,3H3/t5-/m1/s1',
# 'InChI=1S/C5H5O/c1-2-3-4-5-6/h1-5H/b4-3+',
# 'InChI=1S/C5H7O/c1-5-3-2-4-6-5/h2-5H,1H3/t5-/m0/s1',
# 'InChI=1S/C6H11/c1-5(2)6(3)4/h5H,1,3H2,2,4H3/t5-/m1/s1',
# 'InChI=1S/C6H6O/c7-6-4-2-1-3-5-6/h1-2,4-5H,3H2',
# 'InChI=1S/C8H15O2/c1-7(2)5-8(3,4)6-10-9/h5,9H,3,6H2,1-2,'
# '4H3/t8-/m0/s1', ]:
# GEO = automol.inchi.geometry(ICH)
# print(automol.geom.string(GEO))
# print()
# GRA = automol.geom.graph(GEO)
# RAD_GRP_DCT = automol.graph.radical_group_dct(GRA)
# for ATM, GRPS in RAD_GRP_DCT.items():
# print(len(GRPS))
# for GRP in GRPS:
# print(len(GRP))
# print('atom', ATM)
# print('group', GRP)
# ATM_KEYS = automol.graph.atom_keys(GRP)
# GRP_GEO = automol.geom.from_subset(GEO, ATM_KEYS)
# print(automol.geom.string(GRP_GEO))
# print()
#
# print(automol.graph.string(GRP, one_indexed=False))
# STE_ATM_KEYS = automol.graph.stereogenic_atom_keys(GRP)
# print(STE_ATM_KEYS)
# # GRP_ICH = automol.graph.inchi(GRP, stereo=False)
# # GRP_ICH = automol.inchi.add_stereo(GRP_ICH)
# # print(GRP_ICH)
# GRP_ICH = automol.graph.inchi(GRP, stereo=True)
| [
1,
529,
276,
1112,
420,
29958,
29879,
25467,
492,
407,
29914,
1300,
2878,
331,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
3983,
9678,
1080,
13,
15945,
29908,
13,
5215,
1120,
459,
7989,
29889,
11037,
408,
623,
13,
5215,
1120,
459,
7989,
29889,
2886,
408,
3095,
29888,
13,
3166,
3345,
324,
29889,
4422,
1053,
9657,
29918,
13,
3166,
3345,
324,
29889,
13441,
29889,
262,
4161,
1053,
3918,
29918,
689,
13,
3166,
3345,
324,
29889,
13441,
29889,
262,
4161,
1053,
1203,
29918,
517,
29918,
6800,
29659,
29918,
262,
4161,
29918,
1609,
29918,
1989,
13,
3166,
3345,
324,
29889,
13441,
1053,
903,
29885,
324,
1445,
13,
3166,
3345,
324,
29889,
13441,
1053,
903,
5499,
7354,
13,
3166,
3345,
324,
29889,
13441,
1053,
903,
4422,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
12301,
29918,
8149,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
21224,
29918,
8149,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
12301,
29918,
18098,
29879,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
21224,
29918,
20488,
13,
29937,
679,
2153,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
1728,
29918,
29881,
11770,
29918,
271,
4835,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
12301,
29918,
29890,
898,
29918,
791,
2063,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
6261,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
12301,
29918,
6948,
1337,
630,
29918,
791,
2063,
13,
29937,
269,
12358,
29877,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
756,
29918,
303,
406,
29877,
13,
3166,
3345,
324,
29889,
4262,
3032,
4262,
29918,
2716,
1053,
28526,
29918,
690,
265,
749,
13,
29937,
1401,
13,
3166,
3345,
324,
29889,
4262,
3032,
17987,
29918,
2716,
1053,
25713,
29918,
303,
406,
29877,
29918,
19156,
13,
3166,
3345,
324,
29889,
4262,
3032,
17987,
29918,
2716,
1053,
16303,
408,
8297,
29918,
19156,
13,
3166,
3345,
324,
29889,
4262,
3032,
17987,
29918,
2716,
1053,
1250,
15933,
29918,
275,
16898,
13,
3166,
3345,
324,
29889,
4262,
29889,
479,
290,
1053,
10350,
13,
13,
13,
29937,
3983,
1149,
297,
4161,
13,
1753,
297,
4161,
29898,
3874,
29892,
269,
12358,
29877,
29922,
5574,
1125,
13,
1678,
9995,
3251,
403,
385,
512,
1451,
29902,
1347,
515,
263,
13206,
16637,
3983,
29889,
13,
13,
4706,
584,
3207,
2646,
29901,
13206,
16637,
3983,
13,
4706,
584,
1853,
2646,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
3207,
269,
12358,
29877,
29901,
3443,
304,
3160,
269,
12358,
2878,
331,
6020,
2472,
13,
4706,
584,
1853,
269,
12358,
29877,
29901,
6120,
13,
4706,
584,
29878,
1853,
29901,
851,
13,
1678,
9995,
13,
13,
1678,
7975,
353,
1203,
29918,
517,
29918,
6800,
29659,
29918,
262,
4161,
29918,
1609,
29918,
1989,
29898,
13,
4706,
525,
4262,
742,
2646,
29892,
752,
29922,
29918,
18307,
29897,
13,
13,
1678,
565,
7975,
338,
6213,
29901,
13,
4706,
565,
451,
269,
12358,
29877,
470,
451,
756,
29918,
303,
406,
29877,
29898,
3874,
1125,
13,
9651,
7975,
29892,
903,
353,
297,
4161,
29918,
2541,
29918,
6605,
29918,
3166,
29918,
19156,
29898,
3874,
29897,
13,
9651,
7975,
353,
3918,
29918,
689,
29898,
436,
29892,
269,
12358,
29877,
29922,
303,
406,
29877,
29897,
13,
4706,
1683,
29901,
13,
9651,
2646,
353,
6261,
29898,
3874,
29897,
13,
9651,
1737,
29877,
29892,
1737,
29877,
29918,
13140,
29918,
29881,
312,
353,
25713,
29918,
303,
406,
29877,
29918,
19156,
29898,
3874,
29897,
13,
9651,
7975,
29892,
903,
353,
297,
4161,
29918,
2541,
29918,
6605,
29918,
3166,
29918,
19156,
29898,
13,
18884,
2646,
29892,
1737,
29877,
29922,
24756,
29892,
1737,
29877,
29918,
13140,
29918,
29881,
312,
29922,
24756,
29918,
13140,
29918,
29881,
312,
29897,
13,
13,
1678,
736,
7975,
13,
13,
13,
1753,
903,
18307,
29898,
3874,
29896,
29892,
2646,
29906,
1125,
13,
1678,
9995,
3831,
598,
278,
1250,
15933,
3829,
310,
1023,
13206,
1810,
598,
18445,
29889,
13,
13,
4706,
584,
3207,
2646,
29896,
29901,
13206,
16637,
3983,
29871,
29896,
13,
4706,
584,
1853,
2646,
29896,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
3207,
2646,
29906,
29901,
13206,
16637,
3983,
29871,
29906,
13,
4706,
584,
1853,
2646,
29906,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
29878,
1853,
29901,
6120,
13,
1678,
9995,
13,
13,
1678,
2646,
29896,
353,
1728,
29918,
29881,
11770,
29918,
271,
4835,
29898,
3874,
29896,
29897,
13,
1678,
2646,
29906,
353,
1728,
29918,
29881,
11770,
29918,
271,
4835,
29898,
3874,
29906,
29897,
13,
13,
1678,
736,
1250,
15933,
29918,
275,
16898,
29898,
3874,
29896,
29892,
2646,
29906,
29897,
13,
13,
13,
1753,
297,
4161,
29918,
2541,
29918,
6605,
29918,
3166,
29918,
19156,
29898,
3874,
29892,
1737,
29877,
29922,
8516,
29892,
1737,
29877,
29918,
13140,
29918,
29881,
312,
29922,
8516,
1125,
13,
1678,
9995,
3251,
403,
385,
512,
1451,
29902,
1347,
515,
263,
13206,
16637,
3983,
29889,
13,
4706,
960,
10350,
526,
4502,
297,
29892,
896,
526,
1304,
304,
8161,
269,
12358,
29877,
29889,
13,
13,
4706,
584,
3207,
2646,
29901,
13206,
16637,
3983,
13,
4706,
584,
1853,
2646,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
3207,
1737,
29877,
29901,
13206,
16637,
16303,
13,
4706,
584,
1853,
1737,
29877,
29901,
3345,
324,
16303,
848,
3829,
13,
4706,
584,
3207,
1737,
29877,
29918,
13140,
29918,
29881,
312,
29901,
13,
4706,
584,
1853,
1737,
29877,
29918,
13140,
29918,
29881,
312,
29901,
9657,
7503,
29962,
13,
4706,
584,
29878,
1853,
29901,
313,
710,
29892,
18761,
29898,
524,
876,
13,
1678,
9995,
13,
1678,
2646,
353,
1728,
29918,
29881,
11770,
29918,
271,
4835,
29898,
3874,
29897,
13,
1678,
2646,
353,
28526,
29918,
690,
265,
749,
29898,
3874,
29897,
13,
1678,
472,
29885,
29918,
8149,
353,
12705,
29898,
8678,
29918,
8149,
29898,
3874,
876,
13,
1678,
289,
299,
29918,
8149,
353,
1051,
29898,
29890,
898,
29918,
8149,
29898,
3874,
876,
13,
1678,
472,
29885,
29918,
11967,
29879,
353,
9657,
5396,
5975,
29918,
1609,
29918,
1989,
29898,
8678,
29918,
18098,
29879,
29898,
3874,
511,
472,
29885,
29918,
8149,
29897,
13,
1678,
472,
29885,
29918,
29890,
299,
29918,
20901,
2395,
353,
9657,
5396,
5975,
29918,
1609,
29918,
1989,
29898,
13,
4706,
12301,
29918,
29890,
898,
29918,
791,
2063,
29898,
3874,
511,
472,
29885,
29918,
8149,
29897,
13,
1678,
472,
29885,
29918,
3665,
29918,
20901,
2395,
353,
9657,
5396,
5975,
29918,
1609,
29918,
1989,
29898,
13,
4706,
12301,
29918,
6948,
1337,
630,
29918,
791,
2063,
29898,
3874,
511,
472,
29885,
29918,
8149,
29897,
13,
1678,
289,
299,
29918,
4339,
353,
9657,
5396,
5975,
29918,
1609,
29918,
1989,
29898,
29890,
898,
29918,
20488,
29898,
3874,
511,
289,
299,
29918,
8149,
29897,
13,
13,
1678,
565,
1737,
29877,
338,
451,
6213,
29901,
13,
4706,
4974,
1737,
29877,
29918,
13140,
29918,
29881,
312,
338,
451,
6213,
13,
4706,
472,
29885,
29918,
20230,
29879,
353,
10350,
29898,
24756,
29897,
13,
4706,
472,
29885,
29918,
20230,
29879,
353,
518,
271,
29885,
29918,
20230,
29879,
29961,
24756,
29918,
13140,
29918,
29881,
312,
29961,
271,
29885,
29918,
1989,
5262,
565,
472,
29885,
29918,
1989,
297,
1737,
29877,
29918,
13140,
29918,
29881,
312,
13,
462,
1678,
1683,
313,
29900,
1696,
29871,
29900,
1696,
29871,
29900,
1846,
363,
472,
29885,
29918,
1989,
297,
472,
29885,
29918,
8149,
29962,
13,
1678,
1683,
29901,
13,
4706,
472,
29885,
29918,
20230,
29879,
353,
6213,
13,
13,
1678,
286,
29880,
29888,
29892,
1820,
29918,
1958,
29918,
11569,
353,
903,
29885,
324,
1445,
29889,
3166,
29918,
1272,
29898,
13,
4706,
472,
29885,
29918,
8149,
29892,
289,
299,
29918,
8149,
29892,
472,
29885,
29918,
11967,
29879,
29892,
472,
29885,
29918,
29890,
299,
29918,
20901,
2395,
29892,
472,
29885,
29918,
3665,
29918,
20901,
2395,
29892,
289,
299,
29918,
4339,
29892,
13,
4706,
472,
29885,
29918,
20230,
29879,
29922,
271,
29885,
29918,
20230,
29879,
29897,
13,
1678,
364,
18933,
353,
903,
5499,
7354,
29889,
3166,
29918,
29885,
324,
1445,
29898,
828,
29888,
29897,
13,
1678,
7975,
29892,
3479,
29918,
3888,
353,
903,
5499,
7354,
29889,
517,
29918,
262,
4161,
29898,
5499,
29885,
29892,
411,
29918,
2993,
29918,
3888,
29922,
5574,
29897,
13,
1678,
954,
29879,
353,
903,
5510,
29918,
6605,
29918,
2098,
29918,
3166,
29918,
2993,
29918,
3888,
29898,
2993,
29918,
3888,
29897,
13,
1678,
954,
29879,
353,
18761,
29898,
1958,
29898,
1989,
29918,
1958,
29918,
11569,
17255,
657,
667,
1649,
29892,
954,
29879,
876,
13,
13,
1678,
736,
7975,
29892,
954,
29879,
13,
13,
13,
1753,
903,
5510,
29918,
6605,
29918,
2098,
29918,
3166,
29918,
2993,
29918,
3888,
29898,
2993,
29918,
3888,
1125,
13,
1678,
282,
698,
353,
623,
29889,
21587,
11219,
29940,
29901,
1495,
718,
623,
29889,
17885,
3864,
29898,
13,
4706,
623,
29889,
13757,
29898,
932,
29889,
29965,
3059,
17298,
3352,
29918,
1177,
4330,
17070,
29892,
525,
5501,
876,
13,
1678,
954,
29918,
710,
353,
3095,
29888,
29889,
4102,
29918,
17885,
545,
29898,
415,
29873,
29892,
3479,
29918,
3888,
29897,
13,
1678,
954,
29879,
353,
18761,
29898,
1958,
29898,
524,
29892,
954,
29918,
710,
29889,
5451,
29898,
3788,
4961,
13,
1678,
736,
954,
29879,
13,
13,
13,
1753,
16303,
29898,
3874,
1125,
13,
1678,
9995,
14806,
263,
13206,
16637,
3983,
304,
263,
13206,
16637,
16303,
29889,
13,
13,
4706,
584,
3207,
2646,
29901,
13206,
16637,
3983,
13,
4706,
584,
1853,
2646,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
29878,
1853,
29901,
3345,
324,
13206,
16637,
16303,
848,
3829,
13,
1678,
9995,
13,
13,
1678,
5016,
5824,
353,
12301,
29918,
18098,
29879,
29898,
3874,
29897,
13,
1678,
565,
7431,
29898,
11967,
5824,
29897,
2804,
29871,
29896,
29901,
13,
4706,
2646,
353,
6261,
29898,
3874,
29897,
13,
4706,
1737,
29877,
353,
8297,
29918,
19156,
29898,
3874,
29897,
13,
1678,
1683,
29901,
13,
4706,
5016,
29890,
353,
1051,
29898,
11967,
5824,
29889,
5975,
3101,
29961,
29900,
29962,
13,
4706,
396,
5016,
29890,
353,
1051,
29898,
11967,
5824,
29889,
8149,
3101,
29961,
29900,
29962,
13,
4706,
1737,
29877,
353,
5135,
11967,
29890,
29892,
313,
29900,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29900,
8243,
29897,
13,
13,
1678,
736,
1737,
29877,
13,
13,
13,
1753,
7063,
29898,
3874,
1125,
13,
1678,
9995,
3251,
403,
263,
6258,
18544,
14066,
7063,
8600,
515,
263,
13206,
16637,
3983,
29889,
13,
13,
4706,
584,
3207,
2646,
29901,
13206,
16637,
3983,
13,
4706,
584,
1853,
2646,
29901,
3345,
324,
3983,
848,
3829,
13,
4706,
584,
1853,
29901,
9657,
29961,
710,
29901,
938,
29962,
13,
1678,
9995,
13,
13,
1678,
2646,
353,
6261,
29898,
3874,
29897,
13,
1678,
5016,
29879,
353,
12301,
29918,
18098,
29879,
29898,
3874,
467,
5975,
580,
13,
1678,
285,
828,
353,
903,
4422,
29889,
689,
2497,
29898,
11967,
29879,
29897,
13,
13,
1678,
736,
285,
828,
13,
29937,
13,
29937,
13,
29937,
565,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29937,
268,
1053,
3345,
324,
13,
29937,
13,
29937,
268,
363,
306,
3210,
297,
518,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29946,
29950,
29955,
29949,
29906,
29914,
29883,
29896,
29899,
29941,
29899,
29946,
29898,
29906,
29897,
29953,
29899,
29945,
29914,
29882,
29941,
29899,
29945,
29950,
29892,
29896,
29899,
29906,
29950,
29906,
29914,
29873,
29946,
29899,
29914,
29885,
29900,
29914,
29879,
29896,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29946,
29950,
29955,
29949,
29914,
29883,
29896,
29899,
29946,
29898,
29906,
29897,
29941,
29899,
29945,
29914,
29882,
29941,
29899,
29946,
29950,
29892,
29896,
29950,
29906,
29892,
29906,
29950,
29941,
29914,
29873,
29946,
29899,
29914,
29885,
29896,
29914,
29879,
29896,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29945,
29950,
29955,
29914,
29883,
29896,
29899,
29941,
29899,
29945,
29899,
29946,
29899,
29906,
29914,
29882,
29896,
29892,
29945,
29950,
29892,
29946,
29950,
29906,
29892,
29906,
29950,
29941,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29945,
29950,
29929,
29914,
29883,
29896,
29899,
29946,
29899,
29945,
29898,
29906,
29897,
29941,
29914,
29882,
29946,
29899,
29945,
29950,
29892,
29896,
29899,
29906,
29950,
29906,
29892,
29941,
29950,
29941,
29914,
29873,
29945,
29899,
29914,
29885,
29896,
29914,
29879,
29896,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29945,
29950,
29945,
29949,
29914,
29883,
29896,
29899,
29906,
29899,
29941,
29899,
29946,
29899,
29945,
29899,
29953,
29914,
29882,
29896,
29899,
29945,
29950,
29914,
29890,
29946,
29899,
29941,
29974,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29945,
29950,
29955,
29949,
29914,
29883,
29896,
29899,
29945,
29899,
29941,
29899,
29906,
29899,
29946,
29899,
29953,
29899,
29945,
29914,
29882,
29906,
29899,
29945,
29950,
29892,
29896,
29950,
29941,
29914,
29873,
29945,
29899,
29914,
29885,
29900,
29914,
29879,
29896,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29953,
29950,
29896,
29896,
29914,
29883,
29896,
29899,
29945,
29898,
29906,
29897,
29953,
29898,
29941,
29897,
29946,
29914,
29882,
29945,
29950,
29892,
29896,
29892,
29941,
29950,
29906,
29892,
29906,
29892,
29946,
29950,
29941,
29914,
29873,
29945,
29899,
29914,
29885,
29896,
29914,
29879,
29896,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29953,
29950,
29953,
29949,
29914,
29883,
29955,
29899,
29953,
29899,
29946,
29899,
29906,
29899,
29896,
29899,
29941,
29899,
29945,
29899,
29953,
29914,
29882,
29896,
29899,
29906,
29892,
29946,
29899,
29945,
29950,
29892,
29941,
29950,
29906,
742,
13,
29937,
632,
525,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29947,
29950,
29896,
29945,
29949,
29906,
29914,
29883,
29896,
29899,
29955,
29898,
29906,
29897,
29945,
29899,
29947,
29898,
29941,
29892,
29946,
29897,
29953,
29899,
29896,
29900,
29899,
29929,
29914,
29882,
29945,
29892,
29929,
29950,
29892,
29941,
29892,
29953,
29950,
29906,
29892,
29896,
29899,
29906,
5501,
13,
29937,
632,
525,
29946,
29950,
29941,
29914,
29873,
29947,
29899,
29914,
29885,
29900,
29914,
29879,
29896,
742,
4514,
29901,
13,
29937,
308,
402,
29923,
29949,
353,
3345,
324,
29889,
262,
4161,
29889,
19156,
29898,
2965,
29950,
29897,
13,
29937,
308,
1596,
29898,
17405,
324,
29889,
479,
290,
29889,
1807,
29898,
1692,
29949,
876,
13,
29937,
308,
1596,
580,
13,
29937,
308,
402,
4717,
353,
3345,
324,
29889,
479,
290,
29889,
4262,
29898,
1692,
29949,
29897,
13,
29937,
308,
390,
3035,
29918,
14345,
29925,
29918,
29928,
1783,
353,
3345,
324,
29889,
4262,
29889,
3665,
936,
29918,
2972,
29918,
29881,
312,
29898,
29954,
4717,
29897,
13,
29937,
308,
363,
15531,
29924,
29892,
18016,
7024,
297,
390,
3035,
29918,
14345,
29925,
29918,
29928,
1783,
29889,
7076,
7295,
13,
29937,
632,
1596,
29898,
2435,
29898,
14345,
7024,
876,
13,
29937,
632,
363,
18016,
29925,
297,
18016,
7024,
29901,
13,
29937,
462,
1596,
29898,
2435,
29898,
14345,
29925,
876,
13,
29937,
462,
1596,
877,
8678,
742,
15531,
29924,
29897,
13,
29937,
462,
1596,
877,
2972,
742,
18016,
29925,
29897,
13,
29937,
462,
15531,
29924,
29918,
10818,
29903,
353,
3345,
324,
29889,
4262,
29889,
8678,
29918,
8149,
29898,
14345,
29925,
29897,
13,
29937,
462,
18016,
29925,
29918,
1692,
29949,
353,
3345,
324,
29889,
479,
290,
29889,
3166,
29918,
6484,
29898,
1692,
29949,
29892,
15531,
29924,
29918,
10818,
29903,
29897,
13,
29937,
462,
1596,
29898,
17405,
324,
29889,
479,
290,
29889,
1807,
29898,
14345,
29925,
29918,
1692,
29949,
876,
13,
29937,
462,
1596,
580,
13,
29937,
13,
29937,
462,
1596,
29898,
17405,
324,
29889,
4262,
29889,
1807,
29898,
14345,
29925,
29892,
697,
29918,
2248,
287,
29922,
8824,
876,
13,
29937,
462,
317,
4330,
29918,
1299,
29924,
29918,
10818,
29903,
353,
3345,
324,
29889,
4262,
29889,
303,
406,
6352,
293,
29918,
8678,
29918,
8149,
29898,
14345,
29925,
29897,
13,
29937,
462,
1596,
29898,
1254,
29923,
29918,
1299,
29924,
29918,
10818,
29903,
29897,
13,
29937,
462,
396,
18016,
29925,
29918,
2965,
29950,
353,
3345,
324,
29889,
4262,
29889,
262,
4161,
29898,
14345,
29925,
29892,
269,
12358,
29877,
29922,
8824,
29897,
13,
29937,
462,
396,
18016,
29925,
29918,
2965,
29950,
353,
3345,
324,
29889,
262,
4161,
29889,
1202,
29918,
303,
406,
29877,
29898,
14345,
29925,
29918,
2965,
29950,
29897,
13,
29937,
462,
396,
1596,
29898,
14345,
29925,
29918,
2965,
29950,
29897,
13,
29937,
462,
18016,
29925,
29918,
2965,
29950,
353,
3345,
324,
29889,
4262,
29889,
262,
4161,
29898,
14345,
29925,
29892,
269,
12358,
29877,
29922,
5574,
29897,
13,
2
] |
pipeline/ephys.py | Yi-61/map-ephys | 0 | 98929 |
import datajoint as dj
from . import lab, experiment, ccf
from . import get_schema_name
import numpy as np
from scipy.interpolate import CubicSpline
schema = dj.schema(get_schema_name('ephys'))
[lab, experiment, ccf] # NOQA flake8
@schema
class ProbeInsertion(dj.Manual):
definition = """
-> experiment.Session
insertion_number: int
---
-> lab.Probe
-> lab.ElectrodeConfig
"""
class InsertionLocation(dj.Part):
definition = """
-> master
---
-> lab.SkullReference
ap_location: decimal(6, 2) # (um) anterior-posterior; ref is 0; more anterior is more positive
ml_location: decimal(6, 2) # (um) medial axis; ref is 0 ; more right is more positive
depth: decimal(6, 2) # (um) manipulator depth relative to surface of the brain (0); more ventral is more negative
theta: decimal(5, 2) # (deg) - elevation - rotation about the ml-axis [0, 180] - w.r.t the z+ axis
phi: decimal(5, 2) # (deg) - azimuth - rotation about the dv-axis [0, 360] - w.r.t the x+ axis
beta: decimal(5, 2) # (deg) rotation about the shank of the probe [-180, 180] - clockwise is increasing in degree - 0 is the probe-front facing anterior
"""
class RecordableBrainRegion(dj.Part):
definition = """
-> master
-> lab.BrainArea
-> lab.Hemisphere
"""
class InsertionNote(dj.Part):
definition = """
-> master
---
insertion_note: varchar(1000)
"""
class RecordingSystemSetup(dj.Part):
definition = """
-> master
---
sampling_rate: int # (Hz)
"""
@schema
class LFP(dj.Imported):
definition = """
-> ProbeInsertion
---
lfp_sample_rate: float # (Hz)
lfp_time_stamps: longblob # timestamps with respect to the start of the recording (recording_timestamp)
lfp_mean: longblob # mean of LFP across electrodes
"""
class Channel(dj.Part):
definition = """
-> master
-> lab.ElectrodeConfig.Electrode
---
lfp: longblob # recorded lfp at this electrode
"""
@schema
class UnitQualityType(dj.Lookup):
definition = """
# Quality
unit_quality : varchar(100)
---
unit_quality_description : varchar(4000)
"""
contents = [
('good', 'single unit'),
('ok', 'probably a single unit, but could be contaminated'),
('multi', 'multi unit'),
('all', 'all units')
]
@schema
class CellType(dj.Lookup):
definition = """
#
cell_type : varchar(100)
---
cell_type_description : varchar(4000)
"""
contents = [
('Pyr', 'putative pyramidal'),
('FS', 'fast spiking'),
('not classified', 'intermediate spike-width that falls between spike-width thresholds for FS or Putative pyramidal cells'),
('all', 'all types')
]
@schema
class ClusteringMethod(dj.Lookup):
definition = """
clustering_method: varchar(16)
"""
# jrclust_v3 is the version Dave uses
# jrclust_v4 is the version Susu uses
contents = zip(['jrclust_v3', 'kilosort', 'jrclust_v4', 'kilosort2'])
@schema
class Unit(dj.Imported):
"""
A certain portion of the recording is used for clustering (could very well be the entire recording)
Thus, spike-times are relative to the 1st time point in this portion
E.g. if clustering is performed from trial 8 to trial 200, then spike-times are relative to the start of trial 8
"""
definition = """
# Sorted unit
-> ProbeInsertion
-> ClusteringMethod
unit: smallint
---
unit_uid : int # unique across sessions/animals
-> UnitQualityType
-> lab.ElectrodeConfig.Electrode # site on the electrode for which the unit has the largest amplitude
unit_posx : double # (um) estimated x position of the unit relative to probe's tip (0,0)
unit_posy : double # (um) estimated y position of the unit relative to probe's tip (0,0)
spike_times : longblob # (s) from the start of the first data point used in clustering
unit_amp : double
unit_snr : double
waveform : blob # average spike waveform
"""
class UnitTrial(dj.Part):
definition = """
# Entries for trials a unit is in
-> master
-> experiment.SessionTrial
"""
class TrialSpikes(dj.Part):
definition = """
#
-> Unit
-> experiment.SessionTrial
---
spike_times : longblob # (s) per-trial spike times relative to go-cue
"""
@schema
class ClusteringLabel(dj.Imported):
definition = """
-> Unit
---
clustering_time: datetime # time of generation of this set of clustering results
quality_control: bool # has this clustering results undergone quality control
manual_curation: bool # is manual curation performed on this clustering result
clustering_note=null: varchar(2000)
"""
@schema
class BrainAreaDepthCriteria(dj.Manual):
definition = """
-> ProbeInsertion
-> lab.BrainArea
---
depth_upper: float # (um)
depth_lower: float # (um)
"""
@schema
class UnitCoarseBrainLocation(dj.Computed):
definition = """
# Estimated unit position in the brain
-> Unit
---
-> [nullable] lab.BrainArea
-> [nullable] lab.Hemisphere
"""
key_source = Unit & BrainAreaDepthCriteria
def make(self, key):
posy = (Unit & key).fetch1('unit_posy')
# get brain location info from this ProbeInsertion
brain_area, hemi, skull_ref = (experiment.BrainLocation & (ProbeInsertion.InsertionLocation & key)).fetch1(
'brain_area', 'hemisphere', 'skull_reference')
brain_area_rules = (BrainAreaDepthCriteria & key).fetch(as_dict=True, order_by='depth_upper')
# validate rule - non-overlapping depth criteria
if len(brain_area_rules) > 1:
upper, lower = zip(*[(v['depth_upper'], v['depth_lower']) for v in brain_area_rules])
if ((np.array(lower)[:-1] - np.array(upper)[1:]) >= 0).all():
raise Exception('Overlapping depth criteria')
coarse_brain_area = None
for rule in brain_area_rules:
if rule['depth_upper'] < posy <= rule['depth_lower']:
coarse_brain_area = rule['brain_area']
break
if coarse_brain_area is None:
self.insert1(key)
else:
coarse_brain_location = (experiment.BrainLocation & {'brain_area': coarse_brain_area,
'hemisphere': hemi,
'skull_reference': skull_ref}).fetch1('KEY')
self.insert1({**key, **coarse_brain_location})
@schema
class UnitComment(dj.Manual):
definition = """
-> Unit
unit_comment : varchar(767)
"""
@schema
class UnitCellType(dj.Computed):
definition = """
-> Unit
---
-> CellType
"""
@property
def key_source(self):
return super().key_source & 'unit_quality != "all"'
def make(self, key):
upsample_factor = 100
ave_waveform, fs = (ProbeInsertion.RecordingSystemSetup * Unit & key).fetch1('waveform', 'sampling_rate')
cs = CubicSpline(range(len(ave_waveform)), ave_waveform)
ave_waveform = cs(np.linspace(0, len(ave_waveform) - 1, (len(ave_waveform))*upsample_factor))
fs = fs * upsample_factor
x_min = np.argmin(ave_waveform) / fs
x_max = np.argmax(ave_waveform) / fs
waveform_width = abs(x_max-x_min) * 1000 # convert to ms
self.insert1(dict(key,
cell_type='FS' if waveform_width < 0.4 else 'Pyr'))
@schema
class UnitStat(dj.Computed):
definition = """
-> Unit
---
isi_violation=null: float #
avg_firing_rate=null: float # (Hz)
"""
isi_threshold = 0.002 # threshold for isi violation of 2 ms
min_isi = 0 # threshold for duplicate spikes
# NOTE - this key_source logic relies on ALL TrialSpikes ingest all at once in a transaction
key_source = ProbeInsertion & Unit.TrialSpikes
def make(self, key):
# Following isi_violations() function
# Ref: https://github.com/AllenInstitute/ecephys_spike_sorting/blob/master/ecephys_spike_sorting/modules/quality_metrics/metrics.py
def make_insert():
for unit in (Unit & key).fetch('KEY'):
trial_spikes, tr_start, tr_stop = (Unit.TrialSpikes * experiment.SessionTrial & unit).fetch(
'spike_times', 'start_time', 'stop_time')
isis = np.hstack(np.diff(spks) for spks in trial_spikes)
if isis.size > 0:
# remove duplicated spikes
processed_trial_spikes = []
for spike_train in trial_spikes:
duplicate_spikes = np.where(np.diff(spike_train) <= self.min_isi)[0]
processed_trial_spikes.append(np.delete(spike_train, duplicate_spikes + 1))
num_spikes = len(np.hstack(processed_trial_spikes))
avg_firing_rate = num_spikes / float(sum(tr_stop - tr_start))
num_violations = sum(isis < self.isi_violation_thresh)
violation_time = 2 * num_spikes * (self.isi_threshold - self.min_isi)
violation_rate = num_violations / violation_time
fpRate = violation_rate / avg_firing_rate
yield {**unit, 'isi_violation': fpRate, 'avg_firing_rate': avg_firing_rate}
else:
yield {**unit, 'isi_violation': None, 'avg_firing_rate': None}
self.insert(make_insert())
@schema
class ClusterMetric(dj.Imported):
definition = """
# Quality metrics for sorted unit
# Ref: https://github.com/AllenInstitute/ecephys_spike_sorting/blob/master/ecephys_spike_sorting/modules/quality_metrics/README.md
-> Unit
epoch_name_quality_metrics: varchar(64)
---
presence_ratio: float # Fraction of epoch in which spikes are present
amplitude_cutoff: float # Estimate of miss rate based on amplitude histogram
isolation_distance=null: float # Distance to nearest cluster in Mahalanobis space
l_ratio=null: float #
d_prime=null: float # Classification accuracy based on LDA
nn_hit_rate=null: float #
nn_miss_rate=null: float
silhouette_score=null: float # Standard metric for cluster overlap
max_drift=null: float # Maximum change in spike depth throughout recording
cumulative_drift=null: float # Cumulative change in spike depth throughout recording
"""
@schema
class WaveformMetric(dj.Imported):
definition = """
-> Unit
epoch_name_waveform_metrics: varchar(64)
---
duration=null: float
halfwidth=null: float
pt_ratio=null: float
repolarization_slope=null: float
recovery_slope=null: float
spread=null: float
velocity_above=null: float
velocity_below=null: float
"""
# TODO: confirm the logic/need for this table
@schema
class UnitCCF(dj.Computed):
definition = """
-> Unit
---
-> ccf.CCF
"""
| [
1,
29871,
13,
5215,
848,
12090,
408,
270,
29926,
13,
13,
3166,
869,
1053,
9775,
29892,
7639,
29892,
274,
6854,
13,
3166,
869,
1053,
679,
29918,
11010,
29918,
978,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
4560,
2272,
29889,
1639,
3733,
403,
1053,
28618,
293,
29903,
572,
457,
13,
13,
11010,
353,
270,
29926,
29889,
11010,
29898,
657,
29918,
11010,
29918,
978,
877,
29872,
14017,
8785,
13,
29961,
8205,
29892,
7639,
29892,
274,
6854,
29962,
29871,
396,
11698,
29984,
29909,
17422,
446,
29947,
13,
13,
13,
29992,
11010,
13,
1990,
1019,
915,
17491,
291,
29898,
19776,
29889,
2517,
950,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
7639,
29889,
7317,
13,
1678,
4635,
291,
29918,
4537,
29901,
938,
13,
1678,
11474,
13,
1678,
1599,
9775,
29889,
1184,
915,
13,
1678,
1599,
9775,
29889,
29923,
781,
307,
311,
3991,
13,
1678,
9995,
13,
13,
1678,
770,
24505,
291,
6508,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
1599,
5835,
13,
4706,
11474,
13,
4706,
1599,
9775,
29889,
15797,
913,
7422,
13,
4706,
3095,
29918,
5479,
29901,
13677,
29898,
29953,
29892,
29871,
29906,
29897,
396,
313,
398,
29897,
14123,
29899,
2490,
261,
1611,
29936,
2143,
338,
29871,
29900,
29936,
901,
14123,
338,
901,
6374,
13,
4706,
286,
29880,
29918,
5479,
29901,
13677,
29898,
29953,
29892,
29871,
29906,
29897,
396,
313,
398,
29897,
1612,
616,
9685,
29936,
2143,
338,
29871,
29900,
2056,
901,
1492,
338,
901,
6374,
13,
4706,
10809,
29901,
539,
13677,
29898,
29953,
29892,
29871,
29906,
29897,
396,
313,
398,
29897,
11525,
9183,
10809,
6198,
304,
7101,
310,
278,
17294,
313,
29900,
416,
901,
9712,
1705,
338,
901,
8178,
13,
4706,
278,
941,
29901,
539,
13677,
29898,
29945,
29892,
29871,
29906,
29897,
396,
313,
12163,
29897,
448,
11858,
362,
448,
13733,
1048,
278,
286,
29880,
29899,
8990,
518,
29900,
29892,
29871,
29896,
29947,
29900,
29962,
448,
281,
29889,
29878,
29889,
29873,
278,
503,
29974,
9685,
13,
4706,
1374,
29875,
29901,
308,
13677,
29898,
29945,
29892,
29871,
29906,
29897,
396,
313,
12163,
29897,
448,
2698,
326,
2806,
448,
13733,
1048,
278,
14897,
29899,
8990,
518,
29900,
29892,
29871,
29941,
29953,
29900,
29962,
448,
281,
29889,
29878,
29889,
29873,
278,
921,
29974,
9685,
13,
4706,
21762,
29901,
4706,
13677,
29898,
29945,
29892,
29871,
29906,
29897,
396,
313,
12163,
29897,
13733,
1048,
278,
528,
804,
310,
278,
410,
915,
21069,
29896,
29947,
29900,
29892,
29871,
29896,
29947,
29900,
29962,
448,
12006,
3538,
338,
10231,
297,
7426,
448,
29871,
29900,
338,
278,
410,
915,
29899,
8862,
14870,
14123,
13,
4706,
9995,
13,
13,
1678,
770,
14164,
519,
22097,
18457,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
1599,
5835,
13,
4706,
1599,
9775,
29889,
22097,
13799,
13,
4706,
1599,
9775,
29889,
29950,
331,
275,
9085,
13,
4706,
9995,
13,
13,
1678,
770,
24505,
291,
9842,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
1599,
5835,
13,
4706,
11474,
13,
4706,
4635,
291,
29918,
6812,
29901,
15236,
29898,
29896,
29900,
29900,
29900,
29897,
13,
4706,
9995,
13,
13,
1678,
770,
3599,
3278,
3924,
26947,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
1599,
5835,
13,
4706,
11474,
13,
4706,
23460,
29918,
10492,
29901,
938,
29871,
396,
313,
12661,
29897,
13,
4706,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
365,
26353,
29898,
19776,
29889,
17518,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
1019,
915,
17491,
291,
13,
1678,
11474,
13,
1678,
301,
18091,
29918,
11249,
29918,
10492,
29901,
5785,
3986,
396,
313,
12661,
29897,
13,
1678,
301,
18091,
29918,
2230,
29918,
303,
15092,
29901,
1472,
10054,
539,
396,
5335,
342,
15092,
411,
3390,
304,
278,
1369,
310,
278,
16867,
313,
3757,
3278,
29918,
16394,
29897,
13,
1678,
301,
18091,
29918,
12676,
29901,
1472,
10054,
795,
396,
2099,
310,
365,
26353,
4822,
28118,
2783,
13,
1678,
9995,
13,
13,
1678,
770,
17368,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
259,
13,
4706,
1599,
5835,
13,
4706,
1599,
9775,
29889,
29923,
781,
307,
311,
3991,
29889,
29923,
781,
307,
311,
13,
4706,
11474,
13,
4706,
301,
18091,
29901,
1472,
10054,
965,
396,
10478,
301,
18091,
472,
445,
28118,
311,
13,
4706,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
24399,
537,
1542,
29898,
19776,
29889,
14959,
786,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
396,
751,
2877,
13,
1678,
5190,
29918,
29567,
29871,
584,
29871,
15236,
29898,
29896,
29900,
29900,
29897,
13,
1678,
11474,
13,
1678,
5190,
29918,
29567,
29918,
8216,
584,
29871,
15236,
29898,
29946,
29900,
29900,
29900,
29897,
13,
1678,
9995,
13,
1678,
8118,
353,
518,
13,
4706,
6702,
16773,
742,
525,
14369,
5190,
5477,
13,
4706,
6702,
554,
742,
525,
771,
14815,
263,
2323,
5190,
29892,
541,
1033,
367,
640,
9103,
630,
5477,
13,
4706,
6702,
9910,
742,
525,
9910,
5190,
5477,
13,
4706,
6702,
497,
742,
525,
497,
10340,
1495,
13,
1678,
4514,
13,
13,
13,
29992,
11010,
13,
1990,
19413,
1542,
29898,
19776,
29889,
14959,
786,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
396,
13,
1678,
3038,
29918,
1853,
29871,
584,
29871,
15236,
29898,
29896,
29900,
29900,
29897,
13,
1678,
11474,
13,
1678,
3038,
29918,
1853,
29918,
8216,
584,
29871,
15236,
29898,
29946,
29900,
29900,
29900,
29897,
13,
1678,
9995,
13,
1678,
8118,
353,
518,
13,
4706,
6702,
29925,
4316,
742,
525,
649,
1230,
11451,
2572,
23670,
5477,
13,
4706,
6702,
9998,
742,
525,
11255,
805,
638,
292,
5477,
13,
4706,
6702,
1333,
770,
2164,
742,
525,
1639,
13847,
805,
9345,
29899,
2103,
393,
20074,
1546,
805,
9345,
29899,
2103,
266,
3781,
3361,
363,
383,
29903,
470,
12065,
1230,
11451,
2572,
23670,
9101,
5477,
13,
4706,
6702,
497,
742,
525,
497,
4072,
1495,
13,
1678,
4514,
13,
13,
13,
29992,
11010,
13,
1990,
2233,
504,
3241,
4062,
29898,
19776,
29889,
14959,
786,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
16993,
3241,
29918,
5696,
29901,
15236,
29898,
29896,
29953,
29897,
13,
1678,
9995,
13,
1678,
396,
432,
29878,
695,
504,
29918,
29894,
29941,
338,
278,
1873,
17841,
3913,
13,
1678,
396,
432,
29878,
695,
504,
29918,
29894,
29946,
338,
278,
1873,
9511,
29884,
3913,
13,
13,
1678,
8118,
353,
14319,
18959,
29926,
29878,
695,
504,
29918,
29894,
29941,
742,
525,
16757,
359,
441,
742,
525,
29926,
29878,
695,
504,
29918,
29894,
29946,
742,
525,
16757,
359,
441,
29906,
11287,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
29898,
19776,
29889,
17518,
287,
1125,
13,
1678,
9995,
13,
1678,
319,
3058,
11910,
310,
278,
16867,
338,
1304,
363,
16993,
3241,
313,
26680,
1407,
1532,
367,
278,
4152,
16867,
29897,
13,
1678,
6549,
29892,
805,
9345,
29899,
3706,
526,
6198,
304,
278,
29871,
29896,
303,
931,
1298,
297,
445,
11910,
13,
1678,
382,
29889,
29887,
29889,
565,
16993,
3241,
338,
8560,
515,
14260,
29871,
29947,
304,
14260,
29871,
29906,
29900,
29900,
29892,
769,
805,
9345,
29899,
3706,
526,
6198,
304,
278,
1369,
310,
14260,
29871,
29947,
13,
1678,
9995,
13,
1678,
5023,
353,
9995,
13,
1678,
396,
317,
18054,
5190,
13,
1678,
1599,
1019,
915,
17491,
291,
13,
1678,
1599,
2233,
504,
3241,
4062,
13,
1678,
5190,
29901,
2319,
524,
13,
1678,
11474,
13,
1678,
5190,
29918,
5416,
584,
938,
396,
5412,
4822,
21396,
29914,
11576,
1338,
13,
1678,
1599,
13223,
24399,
537,
1542,
13,
1678,
1599,
9775,
29889,
29923,
781,
307,
311,
3991,
29889,
29923,
781,
307,
311,
396,
3268,
373,
278,
28118,
311,
363,
607,
278,
5190,
756,
278,
10150,
28347,
13,
1678,
5190,
29918,
1066,
29916,
584,
3765,
396,
313,
398,
29897,
15899,
921,
2602,
310,
278,
5190,
6198,
304,
410,
915,
29915,
29879,
6872,
313,
29900,
29892,
29900,
29897,
13,
1678,
5190,
29918,
1066,
29891,
584,
3765,
396,
313,
398,
29897,
15899,
343,
2602,
310,
278,
5190,
6198,
304,
410,
915,
29915,
29879,
6872,
313,
29900,
29892,
29900,
29897,
13,
1678,
805,
9345,
29918,
3706,
584,
1472,
10054,
29871,
396,
313,
29879,
29897,
515,
278,
1369,
310,
278,
937,
848,
1298,
1304,
297,
16993,
3241,
13,
1678,
5190,
29918,
1160,
584,
3765,
13,
1678,
5190,
29918,
16586,
29878,
584,
3765,
13,
1678,
10742,
689,
584,
23755,
396,
6588,
805,
9345,
10742,
689,
13,
1678,
9995,
13,
13,
1678,
770,
13223,
29911,
9315,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
396,
4284,
2722,
363,
3367,
1338,
263,
5190,
338,
297,
13,
4706,
1599,
5835,
13,
4706,
1599,
7639,
29889,
7317,
29911,
9315,
13,
4706,
9995,
13,
13,
1678,
770,
8602,
284,
5592,
29379,
29898,
19776,
29889,
7439,
1125,
13,
4706,
5023,
353,
9995,
13,
4706,
396,
13,
4706,
1599,
13223,
13,
4706,
1599,
7639,
29889,
7317,
29911,
9315,
13,
4706,
11474,
13,
4706,
805,
9345,
29918,
3706,
584,
1472,
10054,
396,
313,
29879,
29897,
639,
29899,
3626,
284,
805,
9345,
3064,
6198,
304,
748,
29899,
18376,
13,
4706,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
2233,
504,
3241,
4775,
29898,
19776,
29889,
17518,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
13223,
13,
1678,
11474,
13,
1678,
16993,
3241,
29918,
2230,
29901,
12865,
29871,
396,
931,
310,
12623,
310,
445,
731,
310,
16993,
3241,
2582,
29871,
13,
1678,
11029,
29918,
6451,
29901,
6120,
29871,
396,
756,
445,
16993,
3241,
2582,
1090,
29887,
650,
11029,
2761,
13,
1678,
12219,
29918,
29883,
2633,
29901,
6120,
29871,
396,
338,
12219,
274,
2633,
8560,
373,
445,
16993,
3241,
1121,
13,
1678,
16993,
3241,
29918,
6812,
29922,
4304,
29901,
15236,
29898,
29906,
29900,
29900,
29900,
29897,
259,
13,
1678,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
5032,
262,
13799,
8498,
386,
29907,
21977,
29898,
19776,
29889,
2517,
950,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
1019,
915,
17491,
291,
13,
1678,
1599,
9775,
29889,
22097,
13799,
13,
1678,
11474,
13,
1678,
10809,
29918,
21064,
29901,
5785,
29871,
396,
313,
398,
29897,
13,
1678,
10809,
29918,
13609,
29901,
5785,
29871,
396,
313,
398,
29897,
13,
1678,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
7967,
7989,
22097,
6508,
29898,
19776,
29889,
20606,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
396,
2661,
326,
630,
5190,
2602,
297,
278,
17294,
13,
1678,
1599,
13223,
13,
1678,
11474,
13,
1678,
1599,
518,
4304,
519,
29962,
9775,
29889,
22097,
13799,
13,
1678,
1599,
518,
4304,
519,
29962,
9775,
29889,
29950,
331,
275,
9085,
13,
1678,
9995,
13,
13,
1678,
1820,
29918,
4993,
353,
13223,
669,
5032,
262,
13799,
8498,
386,
29907,
21977,
13,
13,
1678,
822,
1207,
29898,
1311,
29892,
1820,
1125,
13,
4706,
926,
29891,
353,
313,
8325,
669,
1820,
467,
9155,
29896,
877,
5441,
29918,
1066,
29891,
1495,
13,
13,
4706,
396,
679,
17294,
4423,
5235,
515,
445,
1019,
915,
17491,
291,
13,
4706,
17294,
29918,
6203,
29892,
9736,
29875,
29892,
2071,
913,
29918,
999,
353,
313,
735,
15362,
29889,
22097,
6508,
669,
313,
1184,
915,
17491,
291,
29889,
17491,
291,
6508,
669,
1820,
8106,
9155,
29896,
29898,
13,
9651,
525,
2634,
262,
29918,
6203,
742,
525,
8008,
275,
9085,
742,
525,
808,
913,
29918,
5679,
1495,
13,
13,
4706,
17294,
29918,
6203,
29918,
19238,
353,
313,
22097,
13799,
8498,
386,
29907,
21977,
669,
1820,
467,
9155,
29898,
294,
29918,
8977,
29922,
5574,
29892,
1797,
29918,
1609,
2433,
19488,
29918,
21064,
1495,
13,
13,
4706,
396,
12725,
5751,
448,
1661,
29899,
957,
433,
3262,
10809,
16614,
13,
4706,
565,
7431,
29898,
2634,
262,
29918,
6203,
29918,
19238,
29897,
1405,
29871,
29896,
29901,
13,
9651,
7568,
29892,
5224,
353,
14319,
10456,
15625,
29894,
1839,
19488,
29918,
21064,
7464,
325,
1839,
19488,
29918,
13609,
11287,
363,
325,
297,
17294,
29918,
6203,
29918,
19238,
2314,
13,
9651,
565,
5135,
9302,
29889,
2378,
29898,
13609,
29897,
7503,
29899,
29896,
29962,
448,
7442,
29889,
2378,
29898,
21064,
9601,
29896,
29901,
2314,
6736,
29871,
29900,
467,
497,
7295,
13,
18884,
12020,
8960,
877,
3563,
433,
3262,
10809,
16614,
1495,
13,
13,
4706,
1302,
7989,
29918,
2634,
262,
29918,
6203,
353,
6213,
13,
4706,
363,
5751,
297,
17294,
29918,
6203,
29918,
19238,
29901,
13,
9651,
565,
5751,
1839,
19488,
29918,
21064,
2033,
529,
926,
29891,
5277,
5751,
1839,
19488,
29918,
13609,
2033,
29901,
13,
18884,
1302,
7989,
29918,
2634,
262,
29918,
6203,
353,
5751,
1839,
2634,
262,
29918,
6203,
2033,
13,
18884,
2867,
13,
13,
4706,
565,
1302,
7989,
29918,
2634,
262,
29918,
6203,
338,
6213,
29901,
13,
9651,
1583,
29889,
7851,
29896,
29898,
1989,
29897,
13,
4706,
1683,
29901,
13,
9651,
1302,
7989,
29918,
2634,
262,
29918,
5479,
353,
313,
735,
15362,
29889,
22097,
6508,
669,
11117,
2634,
262,
29918,
6203,
2396,
1302,
7989,
29918,
2634,
262,
29918,
6203,
29892,
13,
462,
462,
462,
462,
525,
8008,
275,
9085,
2396,
9736,
29875,
29892,
13,
462,
462,
462,
462,
525,
808,
913,
29918,
5679,
2396,
2071,
913,
29918,
999,
7690,
9155,
29896,
877,
10818,
1495,
13,
9651,
1583,
29889,
7851,
29896,
3319,
1068,
1989,
29892,
3579,
1111,
7989,
29918,
2634,
262,
29918,
5479,
1800,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
20001,
29898,
19776,
29889,
2517,
950,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
13223,
13,
1678,
5190,
29918,
9342,
584,
15236,
29898,
29955,
29953,
29955,
29897,
13,
1678,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
4617,
1542,
29898,
19776,
29889,
20606,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
13223,
13,
1678,
11474,
13,
1678,
1599,
19413,
1542,
13,
1678,
9995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1820,
29918,
4993,
29898,
1311,
1125,
13,
4706,
736,
2428,
2141,
1989,
29918,
4993,
669,
525,
5441,
29918,
29567,
2804,
376,
497,
29908,
29915,
13,
13,
1678,
822,
1207,
29898,
1311,
29892,
1820,
1125,
13,
4706,
24081,
981,
29918,
19790,
353,
29871,
29896,
29900,
29900,
13,
13,
4706,
8992,
29918,
27766,
689,
29892,
18920,
353,
313,
1184,
915,
17491,
291,
29889,
4789,
3278,
3924,
26947,
334,
13223,
669,
1820,
467,
9155,
29896,
877,
27766,
689,
742,
525,
13445,
10335,
29918,
10492,
1495,
13,
4706,
5939,
353,
28618,
293,
29903,
572,
457,
29898,
3881,
29898,
2435,
29898,
1351,
29918,
27766,
689,
8243,
8992,
29918,
27766,
689,
29897,
13,
4706,
8992,
29918,
27766,
689,
353,
5939,
29898,
9302,
29889,
1915,
3493,
29898,
29900,
29892,
7431,
29898,
1351,
29918,
27766,
689,
29897,
448,
29871,
29896,
29892,
313,
2435,
29898,
1351,
29918,
27766,
689,
876,
29930,
14340,
981,
29918,
19790,
876,
13,
13,
4706,
18920,
353,
18920,
334,
24081,
981,
29918,
19790,
13,
4706,
921,
29918,
1195,
353,
7442,
29889,
1191,
1195,
29898,
1351,
29918,
27766,
689,
29897,
847,
18920,
13,
4706,
921,
29918,
3317,
353,
7442,
29889,
1191,
3317,
29898,
1351,
29918,
27766,
689,
29897,
847,
18920,
13,
4706,
10742,
689,
29918,
2103,
353,
6425,
29898,
29916,
29918,
3317,
29899,
29916,
29918,
1195,
29897,
334,
29871,
29896,
29900,
29900,
29900,
29871,
396,
3588,
304,
10887,
13,
13,
4706,
1583,
29889,
7851,
29896,
29898,
8977,
29898,
1989,
29892,
13,
462,
3986,
3038,
29918,
1853,
2433,
9998,
29915,
565,
10742,
689,
29918,
2103,
529,
29871,
29900,
29889,
29946,
1683,
525,
29925,
4316,
8785,
13,
13,
13,
29992,
11010,
13,
1990,
13223,
9513,
29898,
19776,
29889,
20606,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
13223,
13,
1678,
11474,
13,
1678,
338,
29875,
29918,
1403,
22671,
29922,
4304,
29901,
5785,
1678,
396,
29871,
13,
1678,
1029,
29887,
29918,
29888,
8491,
29918,
10492,
29922,
4304,
29901,
5785,
29871,
396,
313,
12661,
29897,
13,
1678,
9995,
13,
13,
1678,
338,
29875,
29918,
386,
12268,
353,
29871,
29900,
29889,
29900,
29900,
29906,
29871,
396,
16897,
363,
338,
29875,
5537,
362,
310,
29871,
29906,
10887,
13,
1678,
1375,
29918,
10770,
353,
29871,
29900,
29871,
396,
16897,
363,
7929,
805,
29379,
13,
13,
1678,
396,
6058,
29923,
448,
445,
1820,
29918,
4993,
5900,
337,
3687,
373,
15149,
8602,
284,
5592,
29379,
2348,
342,
599,
472,
2748,
297,
263,
10804,
13,
1678,
1820,
29918,
4993,
353,
1019,
915,
17491,
291,
669,
13223,
29889,
29911,
9315,
5592,
29379,
13,
13,
1678,
822,
1207,
29898,
1311,
29892,
1820,
1125,
13,
4706,
396,
12206,
338,
29875,
29918,
1403,
324,
800,
580,
740,
13,
4706,
396,
9897,
29901,
2045,
597,
3292,
29889,
510,
29914,
3596,
264,
3379,
12356,
29914,
29872,
346,
14017,
29918,
1028,
9345,
29918,
6605,
292,
29914,
10054,
29914,
6207,
29914,
29872,
346,
14017,
29918,
1028,
9345,
29918,
6605,
292,
29914,
7576,
29914,
29567,
29918,
2527,
10817,
29914,
2527,
10817,
29889,
2272,
13,
4706,
822,
1207,
29918,
7851,
7295,
13,
9651,
363,
5190,
297,
313,
8325,
669,
1820,
467,
9155,
877,
10818,
29374,
13,
18884,
14260,
29918,
1028,
29379,
29892,
534,
29918,
2962,
29892,
534,
29918,
9847,
353,
313,
8325,
29889,
29911,
9315,
5592,
29379,
334,
7639,
29889,
7317,
29911,
9315,
669,
5190,
467,
9155,
29898,
13,
462,
1678,
525,
1028,
9345,
29918,
3706,
742,
525,
2962,
29918,
2230,
742,
525,
9847,
29918,
2230,
1495,
13,
13,
18884,
338,
275,
353,
7442,
29889,
29882,
1429,
29898,
9302,
29889,
12765,
29898,
1028,
2039,
29897,
363,
805,
2039,
297,
14260,
29918,
1028,
29379,
29897,
13,
13,
18884,
565,
338,
275,
29889,
2311,
1405,
29871,
29900,
29901,
13,
462,
1678,
396,
3349,
5141,
9169,
805,
29379,
13,
462,
1678,
19356,
29918,
3626,
284,
29918,
1028,
29379,
353,
5159,
13,
462,
1678,
363,
805,
9345,
29918,
14968,
297,
14260,
29918,
1028,
29379,
29901,
13,
462,
4706,
7929,
29918,
1028,
29379,
353,
7442,
29889,
3062,
29898,
9302,
29889,
12765,
29898,
1028,
9345,
29918,
14968,
29897,
5277,
1583,
29889,
1195,
29918,
10770,
9601,
29900,
29962,
13,
462,
4706,
19356,
29918,
3626,
284,
29918,
1028,
29379,
29889,
4397,
29898,
9302,
29889,
8143,
29898,
1028,
9345,
29918,
14968,
29892,
7929,
29918,
1028,
29379,
718,
29871,
29896,
876,
13,
13,
462,
1678,
954,
29918,
1028,
29379,
353,
7431,
29898,
9302,
29889,
29882,
1429,
29898,
5014,
287,
29918,
3626,
284,
29918,
1028,
29379,
876,
13,
462,
1678,
1029,
29887,
29918,
29888,
8491,
29918,
10492,
353,
954,
29918,
1028,
29379,
847,
5785,
29898,
2083,
29898,
509,
29918,
9847,
448,
534,
29918,
2962,
876,
13,
13,
462,
1678,
954,
29918,
1403,
324,
800,
353,
2533,
29898,
15773,
529,
1583,
29889,
10770,
29918,
1403,
22671,
29918,
386,
3781,
29897,
13,
462,
1678,
5537,
362,
29918,
2230,
353,
29871,
29906,
334,
954,
29918,
1028,
29379,
334,
313,
1311,
29889,
10770,
29918,
386,
12268,
448,
1583,
29889,
1195,
29918,
10770,
29897,
13,
462,
1678,
5537,
362,
29918,
10492,
353,
954,
29918,
1403,
324,
800,
847,
5537,
362,
29918,
2230,
13,
462,
1678,
285,
29886,
19907,
353,
5537,
362,
29918,
10492,
847,
1029,
29887,
29918,
29888,
8491,
29918,
10492,
13,
13,
462,
1678,
7709,
426,
1068,
5441,
29892,
525,
10770,
29918,
1403,
22671,
2396,
285,
29886,
19907,
29892,
525,
485,
29887,
29918,
29888,
8491,
29918,
10492,
2396,
1029,
29887,
29918,
29888,
8491,
29918,
10492,
29913,
13,
13,
18884,
1683,
29901,
13,
462,
1678,
7709,
426,
1068,
5441,
29892,
525,
10770,
29918,
1403,
22671,
2396,
6213,
29892,
525,
485,
29887,
29918,
29888,
8491,
29918,
10492,
2396,
6213,
29913,
13,
13,
4706,
1583,
29889,
7851,
29898,
5675,
29918,
7851,
3101,
13,
13,
13,
29992,
11010,
13,
1990,
2233,
5402,
10095,
2200,
29898,
19776,
29889,
17518,
287,
1125,
13,
1678,
5023,
353,
9995,
29871,
13,
1678,
396,
751,
2877,
21556,
363,
12705,
5190,
13,
1678,
396,
9897,
29901,
2045,
597,
3292,
29889,
510,
29914,
3596,
264,
3379,
12356,
29914,
29872,
346,
14017,
29918,
1028,
9345,
29918,
6605,
292,
29914,
10054,
29914,
6207,
29914,
29872,
346,
14017,
29918,
1028,
9345,
29918,
6605,
292,
29914,
7576,
29914,
29567,
29918,
2527,
10817,
29914,
16310,
2303,
29889,
3487,
13,
1678,
1599,
13223,
13,
1678,
21502,
305,
29918,
978,
29918,
29567,
29918,
2527,
10817,
29901,
15236,
29898,
29953,
29946,
29897,
13,
1678,
11474,
13,
1678,
10122,
29918,
3605,
601,
29901,
5785,
29871,
396,
7347,
428,
310,
21502,
305,
297,
607,
805,
29379,
526,
2198,
13,
1678,
28347,
29918,
7582,
2696,
29901,
5785,
29871,
396,
2661,
6490,
310,
3052,
6554,
2729,
373,
28347,
9825,
13342,
13,
1678,
11695,
362,
29918,
19244,
29922,
4304,
29901,
5785,
29871,
396,
6652,
749,
304,
20471,
9867,
297,
10082,
284,
273,
711,
275,
2913,
13,
1678,
301,
29918,
3605,
601,
29922,
4304,
29901,
5785,
29871,
396,
29871,
13,
1678,
270,
29918,
10080,
29922,
4304,
29901,
5785,
29871,
396,
23236,
13600,
2729,
373,
365,
7698,
13,
1678,
302,
29876,
29918,
27342,
29918,
10492,
29922,
4304,
29901,
5785,
29871,
396,
29871,
13,
1678,
302,
29876,
29918,
9894,
29918,
10492,
29922,
4304,
29901,
5785,
13,
1678,
4047,
10774,
2353,
29918,
13628,
29922,
4304,
29901,
5785,
29871,
396,
10117,
12714,
363,
9867,
25457,
13,
1678,
4236,
29918,
29881,
7532,
29922,
4304,
29901,
5785,
29871,
396,
5918,
12539,
1735,
297,
805,
9345,
10809,
10106,
16867,
13,
1678,
13299,
28524,
29918,
29881,
7532,
29922,
4304,
29901,
5785,
29871,
396,
315,
398,
28524,
1735,
297,
805,
9345,
10809,
10106,
16867,
29871,
13,
1678,
9995,
13,
13,
13,
29992,
11010,
13,
1990,
399,
1351,
689,
10095,
2200,
29898,
19776,
29889,
17518,
287,
1125,
13,
1678,
5023,
353,
9995,
13,
1678,
1599,
13223,
13,
1678,
21502,
305,
29918,
978,
29918,
27766,
689,
29918,
2527,
10817,
29901,
15236,
29898,
29953,
29946,
29897,
13,
1678,
11474,
13,
1678,
14385,
29922,
4304,
29901,
5785,
13,
1678,
4203,
2103,
29922,
4304,
29901,
5785,
13,
1678,
19592,
29918,
3605,
601,
29922,
4304,
29901,
5785,
13,
1678,
1634,
10170,
2133,
29918,
29879,
417,
412,
29922,
4304,
29901,
5785,
13,
1678,
24205,
29918,
29879,
417,
412,
29922,
4304,
29901,
5785,
13,
1678,
9677,
29922,
4304,
29901,
5785,
13,
1678,
12885,
29918,
27215,
29922,
4304,
29901,
5785,
13,
1678,
12885,
29918,
22503,
29922,
4304,
29901,
5785,
1678,
13,
1678,
9995,
13,
13,
13,
29937,
14402,
29901,
9659,
278,
5900,
29914,
26180,
363,
445,
1591,
13,
29992,
11010,
13,
1990,
13223,
4174,
29943,
29898,
19776,
29889,
20606,
287,
1125,
13,
1678,
5023,
353,
9995,
29871,
13,
1678,
1599,
13223,
13,
1678,
11474,
13,
1678,
1599,
274,
6854,
29889,
4174,
29943,
13,
1678,
9995,
13,
2
] |
vr_dashboard/tests/test_registration_views.py | SmartElect/SmartElect | 23 | 134993 | from datetime import timedelta
# 3rd party imports
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.timezone import now
from libya_site.tests.factories import DEFAULT_USER_PASSWORD, UserFactory
from register.models import Registration
from register.tests.factories import OfficeFactory, RegistrationCenterFactory
from reporting_api import create_test_data, tasks
from reporting_api.reports import empty_report_store
from voting.models import Election
from voting.tests.factories import ElectionFactory
from vr_dashboard.views.views import ELECTION_SESSION_KEY
URI_NAMESPACE = 'vr_dashboard:'
# all URIs which contain no parameters
ALL_URI_NAMES = ('csv', 'daily-csv', 'election-day', 'election-day-center', 'national', 'offices',
'offices-detail', 'regions', 'sms', 'subconstituencies', 'weekly',
'reports', 'center-csv',
'election-day-hq', 'election-day-preliminary')
PUBLIC_URI_NAMES = ('national', 'offices', 'regions')
# simple URIs that also support a CSV rendering
SUPPORT_CSV_FORMAT = ('election-day', 'election-day-center')
NUM_REGISTRATIONS = 100
class TestElectionSelection(TestCase):
def setUp(self):
self.election_1 = ElectionFactory(
polling_start_time=now() - timedelta(days=10),
polling_end_time=now() - timedelta(days=9)
)
self.election_2 = ElectionFactory(
polling_start_time=now() - timedelta(days=4),
polling_end_time=now() - timedelta(days=3)
)
self.staff_user = UserFactory()
self.staff_user.is_staff = True
self.staff_user.save()
def test_election_in_session(self):
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>_USER_PASSWORD)
self.client.get(reverse('vr_dashboard:election-day'))
self.assertEqual(self.client.session[ELECTION_SESSION_KEY],
Election.objects.get_most_current_election().id)
self.client.get(reverse('vr_dashboard:election-day') + '?election=%d' % self.election_1.id)
self.assertEqual(self.client.session[ELECTION_SESSION_KEY], self.election_1.id)
self.client.get(reverse('vr_dashboard:election-day-center'))
self.assertEqual(self.client.session[ELECTION_SESSION_KEY], self.election_1.id)
self.client.get(reverse('vr_dashboard:election-day-center')
+ '?election=%d' % self.election_2.id)
self.assertEqual(self.client.session[ELECTION_SESSION_KEY], self.election_2.id)
self.client.get(reverse('vr_dashboard:election-day'))
self.assertEqual(self.client.session[ELECTION_SESSION_KEY], self.election_2.id)
class TestRegistrationData(TestCase):
def setUp(self):
create_test_data.create(num_registrations=NUM_REGISTRATIONS)
self.unused_center = RegistrationCenterFactory()
self.unused_office = OfficeFactory()
tasks.election_day()
tasks.registrations()
self.staff_user = UserFactory()
self.staff_user.is_staff = True
self.staff_user.save()
@override_settings(HIDE_PUBLIC_DASHBOARD=True)
def test_auth_hiding_public(self):
"""
When user not logged in,
ensure that we get a redirect to the login page for non-public pages.
and to the HNEC site for public pages.
"""
for uri_name in ALL_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
if uri_name in PUBLIC_URI_NAMES:
self.assertRedirects(rsp, settings.PUBLIC_REDIRECT_URL,
fetch_redirect_response=False,
msg_prefix='Path %s not handled properly' % uri)
else:
self.assertRedirects(rsp, reverse(settings.LOGIN_URL) + "?next=" + uri,
msg_prefix='Path %s not handled properly' % uri)
@override_settings(HIDE_PUBLIC_DASHBOARD=False)
def test_auth_not_hiding_public(self):
"""
When user not logged in,
ensure that we get a redirect to the login page for non-public pages,
but not for public pages.
"""
for uri_name in ALL_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
if uri_name in PUBLIC_URI_NAMES:
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
else:
self.assertRedirects(rsp, reverse(settings.LOGIN_URL) + "?next=" + uri,
msg_prefix='Path %s not handled properly' % uri)
@override_settings(HIDE_PUBLIC_DASHBOARD=True)
def test_staff_not_hiding_public(self):
"""
When a staff user is logged in, they can view "public" pages
even if HIDE_PUBLIC_DASHBOARD is True.
"""
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>)
for uri_name in PUBLIC_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
def test_basic_operation(self):
""" For the time being, simply ensure that the VR dashboard pages don't blow up. """
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>)
for uri_name in ALL_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
if uri_name in SUPPORT_CSV_FORMAT:
rsp = self.client.get(uri + '?format=csv')
self.assertEqual(200, rsp.status_code,
'CSV request to %s failed with status %d' % (uri, rsp.status_code))
# pages without fixed paths
# test election-day-office-n with both default and CSV renderings
# First, we must find an office that actually has registrations
some_valid_office_id = Registration.objects.first().registration_center.office.id
uri = reverse(URI_NAMESPACE + 'election-day-office-n', args=[some_valid_office_id])
rsp = self.client.get(uri)
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
rsp = self.client.get(uri + '?format=csv')
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
def test_invalid_office_center(self):
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>)
# We should get 404 from truly bogus ids as well as from centers or offices that
# exist but aren't used.
for input_uri_name, invalid_id in [
('vr_dashboard:election-day-center-n', self.unused_center.id),
('vr_dashboard:election-day-center-n', 999999),
('vr_dashboard:election-day-office-n', self.unused_office.id),
('vr_dashboard:election-day-office-n', 999999)
]:
uri = reverse(input_uri_name, args=[invalid_id])
rsp = self.client.get(uri)
self.assertContains(rsp, str(invalid_id), status_code=404)
class TestWithNoRegistrationData(TestCase):
def setUp(self):
create_test_data.create(num_registrations=0, num_registration_dates=0)
tasks.election_day()
tasks.registrations()
self.staff_user = UserFactory()
self.staff_user.is_staff = True
self.staff_user.save()
def test_basic_operation(self):
""" For the time being, simply ensure that the VR dashboard pages (and report generation tasks)
don't blow up when there aren't any registrations. """
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>_<PASSWORD>)
for uri_name in ALL_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
self.assertEqual(200, rsp.status_code,
'Request to %s failed with status %d' % (uri, rsp.status_code))
class TestWithNoGeneratedReports(TestCase):
@classmethod
def setUpTestData(cls): # No database changes
empty_report_store()
def setUp(self):
self.staff_user = UserFactory()
self.staff_user.is_staff = True
self.staff_user.save()
def test_no_report_error(self):
expected_page_flags = {
'election-day': ['election_day_overview_page', 'staff_page'],
'election-day-center': ['election_day_center_page', 'staff_page'],
'election-day-hq': ['election_day_hq_page', 'staff_page'],
'election-day-preliminary': ['election_day_preliminary_votes_page', 'staff_page']
}
expected_status_code = 503
assert self.client.login(username=self.staff_user.username, password=<PASSWORD>)
for uri_name in ALL_URI_NAMES:
uri = reverse(URI_NAMESPACE + uri_name)
rsp = self.client.get(uri)
self.assertEqual(expected_status_code, rsp.status_code,
'Request to %s had status %d instead of %d'
% (uri, rsp.status_code, expected_status_code))
if uri_name in expected_page_flags:
for expected in expected_page_flags[uri_name]:
self.assertIn(
expected, rsp.context,
'Error page for %s doesn\'t set page flag "%s"' % (uri_name, expected)
)
for uri_name in ['election-day-office-n', 'election-day-center-n']:
uri = reverse(URI_NAMESPACE + uri_name, args=[999999])
rsp = self.client.get(uri)
self.assertEqual(expected_status_code, rsp.status_code,
'Request to %s had status %d instead of %d'
% (uri, rsp.status_code, expected_status_code))
class TestRedirects(TestCase):
@override_settings(HIDE_PUBLIC_DASHBOARD=False)
def test_dashboard_root_redirects(self):
""" /data goes to /data/ because it needs a trailing slash (via
Django), and /data/ goes to /data/national/ because that's the
default dashboard dashboard page (via a view).
"""
rsp = self.client.get('/data')
self.assertRedirects(rsp, '/data/', status_code=301,
fetch_redirect_response=False)
rsp = self.client.get('/data/')
self.assertRedirects(rsp, reverse(URI_NAMESPACE + 'national'),
fetch_redirect_response=False)
| [
1,
515,
12865,
1053,
5335,
287,
2554,
13,
13,
29937,
29871,
29941,
5499,
6263,
24802,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
1688,
1053,
4321,
8259,
13,
3166,
9557,
29889,
1688,
29889,
13239,
1053,
5712,
29918,
11027,
13,
3166,
9557,
29889,
26045,
1053,
11837,
13,
3166,
9557,
29889,
13239,
29889,
2230,
8028,
1053,
1286,
13,
13,
3166,
619,
1609,
29874,
29918,
2746,
29889,
21150,
29889,
17028,
3842,
1053,
22236,
29918,
11889,
29918,
25711,
17013,
29892,
4911,
5126,
13,
3166,
6036,
29889,
9794,
1053,
2169,
8306,
13,
3166,
6036,
29889,
21150,
29889,
17028,
3842,
1053,
11367,
5126,
29892,
2169,
8306,
13409,
5126,
13,
3166,
23415,
29918,
2754,
1053,
1653,
29918,
1688,
29918,
1272,
29892,
9595,
13,
3166,
23415,
29918,
2754,
29889,
276,
4011,
1053,
4069,
29918,
12276,
29918,
8899,
13,
3166,
28931,
29889,
9794,
1053,
382,
1464,
13,
3166,
28931,
29889,
21150,
29889,
17028,
3842,
1053,
382,
1464,
5126,
13,
3166,
11723,
29918,
14592,
3377,
29889,
7406,
29889,
7406,
1053,
382,
3281,
2725,
29918,
17493,
29918,
10818,
13,
13,
15551,
29918,
5813,
5550,
11538,
353,
525,
13416,
29918,
14592,
3377,
11283,
13,
13,
29937,
599,
501,
29934,
3624,
607,
1712,
694,
4128,
13,
9818,
29918,
15551,
29918,
5813,
29903,
353,
6702,
7638,
742,
525,
29881,
8683,
29899,
7638,
742,
525,
29872,
1464,
29899,
3250,
742,
525,
29872,
1464,
29899,
3250,
29899,
5064,
742,
525,
29876,
1288,
742,
525,
2696,
1575,
742,
13,
462,
525,
2696,
1575,
29899,
16432,
742,
525,
1727,
1080,
742,
525,
29879,
1516,
742,
525,
1491,
3075,
1981,
15942,
742,
525,
18448,
368,
742,
13,
462,
525,
276,
4011,
742,
525,
5064,
29899,
7638,
742,
13,
462,
525,
29872,
1464,
29899,
3250,
29899,
29882,
29939,
742,
525,
29872,
1464,
29899,
3250,
29899,
1457,
2576,
3821,
1495,
13,
7056,
13367,
2965,
29918,
15551,
29918,
5813,
29903,
353,
6702,
29876,
1288,
742,
525,
2696,
1575,
742,
525,
1727,
1080,
1495,
13,
29937,
2560,
501,
29934,
3624,
393,
884,
2304,
263,
16874,
15061,
13,
29903,
4897,
15082,
29918,
29907,
7597,
29918,
19094,
1299,
353,
6702,
29872,
1464,
29899,
3250,
742,
525,
29872,
1464,
29899,
3250,
29899,
5064,
1495,
13,
13,
13967,
29918,
18166,
9047,
29934,
8098,
29903,
353,
29871,
29896,
29900,
29900,
13,
13,
13,
1990,
4321,
29923,
1464,
15097,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
29872,
1464,
29918,
29896,
353,
382,
1464,
5126,
29898,
13,
9651,
1248,
1847,
29918,
2962,
29918,
2230,
29922,
3707,
580,
448,
5335,
287,
2554,
29898,
16700,
29922,
29896,
29900,
511,
13,
9651,
1248,
1847,
29918,
355,
29918,
2230,
29922,
3707,
580,
448,
5335,
287,
2554,
29898,
16700,
29922,
29929,
29897,
13,
4706,
1723,
13,
4706,
1583,
29889,
29872,
1464,
29918,
29906,
353,
382,
1464,
5126,
29898,
13,
9651,
1248,
1847,
29918,
2962,
29918,
2230,
29922,
3707,
580,
448,
5335,
287,
2554,
29898,
16700,
29922,
29946,
511,
13,
9651,
1248,
1847,
29918,
355,
29918,
2230,
29922,
3707,
580,
448,
5335,
287,
2554,
29898,
16700,
29922,
29941,
29897,
13,
4706,
1723,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
353,
4911,
5126,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
275,
29918,
303,
3470,
353,
5852,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
7620,
580,
13,
13,
1678,
822,
1243,
29918,
29872,
1464,
29918,
262,
29918,
7924,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
29958,
29918,
11889,
29918,
25711,
17013,
29897,
13,
4706,
1583,
29889,
4645,
29889,
657,
29898,
24244,
877,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
4645,
29889,
7924,
29961,
29923,
3281,
2725,
29918,
17493,
29918,
10818,
1402,
13,
462,
308,
382,
1464,
29889,
12650,
29889,
657,
29918,
3242,
29918,
3784,
29918,
29872,
1464,
2141,
333,
29897,
13,
4706,
1583,
29889,
4645,
29889,
657,
29898,
24244,
877,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
1495,
718,
525,
29973,
29872,
1464,
16328,
29881,
29915,
1273,
1583,
29889,
29872,
1464,
29918,
29896,
29889,
333,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
4645,
29889,
7924,
29961,
29923,
3281,
2725,
29918,
17493,
29918,
10818,
1402,
1583,
29889,
29872,
1464,
29918,
29896,
29889,
333,
29897,
13,
4706,
1583,
29889,
4645,
29889,
657,
29898,
24244,
877,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
5064,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
4645,
29889,
7924,
29961,
29923,
3281,
2725,
29918,
17493,
29918,
10818,
1402,
1583,
29889,
29872,
1464,
29918,
29896,
29889,
333,
29897,
13,
4706,
1583,
29889,
4645,
29889,
657,
29898,
24244,
877,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
5064,
1495,
13,
462,
4706,
718,
525,
29973,
29872,
1464,
16328,
29881,
29915,
1273,
1583,
29889,
29872,
1464,
29918,
29906,
29889,
333,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
4645,
29889,
7924,
29961,
29923,
3281,
2725,
29918,
17493,
29918,
10818,
1402,
1583,
29889,
29872,
1464,
29918,
29906,
29889,
333,
29897,
13,
4706,
1583,
29889,
4645,
29889,
657,
29898,
24244,
877,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
4645,
29889,
7924,
29961,
29923,
3281,
2725,
29918,
17493,
29918,
10818,
1402,
1583,
29889,
29872,
1464,
29918,
29906,
29889,
333,
29897,
13,
13,
13,
1990,
4321,
4597,
8306,
1469,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1653,
29918,
1688,
29918,
1272,
29889,
3258,
29898,
1949,
29918,
29238,
800,
29922,
13967,
29918,
18166,
9047,
29934,
8098,
29903,
29897,
13,
4706,
1583,
29889,
348,
3880,
29918,
5064,
353,
2169,
8306,
13409,
5126,
580,
13,
4706,
1583,
29889,
348,
3880,
29918,
20205,
353,
11367,
5126,
580,
13,
4706,
9595,
29889,
29872,
1464,
29918,
3250,
580,
13,
4706,
9595,
29889,
29238,
800,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
353,
4911,
5126,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
275,
29918,
303,
3470,
353,
5852,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
7620,
580,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
29950,
22027,
29918,
7056,
13367,
2965,
29918,
29928,
24943,
8456,
17011,
29922,
5574,
29897,
13,
1678,
822,
1243,
29918,
5150,
29918,
29882,
4821,
29918,
3597,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1932,
1404,
451,
13817,
297,
29892,
13,
4706,
9801,
393,
591,
679,
263,
6684,
304,
278,
6464,
1813,
363,
1661,
29899,
3597,
6515,
29889,
13,
4706,
322,
304,
278,
379,
8186,
29907,
3268,
363,
970,
6515,
29889,
13,
308,
9995,
13,
4706,
363,
21333,
29918,
978,
297,
15149,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
565,
21333,
29918,
978,
297,
349,
7466,
27888,
29918,
15551,
29918,
5813,
29903,
29901,
13,
18884,
1583,
29889,
9294,
24735,
29879,
29898,
29878,
1028,
29892,
6055,
29889,
7056,
13367,
2965,
29918,
1525,
4571,
26282,
29918,
4219,
29892,
13,
462,
462,
268,
6699,
29918,
17886,
29918,
5327,
29922,
8824,
29892,
13,
462,
462,
268,
10191,
29918,
13506,
2433,
2605,
1273,
29879,
451,
16459,
6284,
29915,
1273,
21333,
29897,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
9294,
24735,
29879,
29898,
29878,
1028,
29892,
11837,
29898,
11027,
29889,
14480,
1177,
29918,
4219,
29897,
718,
376,
29973,
4622,
543,
718,
21333,
29892,
13,
462,
462,
268,
10191,
29918,
13506,
2433,
2605,
1273,
29879,
451,
16459,
6284,
29915,
1273,
21333,
29897,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
29950,
22027,
29918,
7056,
13367,
2965,
29918,
29928,
24943,
8456,
17011,
29922,
8824,
29897,
13,
1678,
822,
1243,
29918,
5150,
29918,
1333,
29918,
29882,
4821,
29918,
3597,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1932,
1404,
451,
13817,
297,
29892,
13,
4706,
9801,
393,
591,
679,
263,
6684,
304,
278,
6464,
1813,
363,
1661,
29899,
3597,
6515,
29892,
13,
4706,
541,
451,
363,
970,
6515,
29889,
13,
4706,
9995,
13,
4706,
363,
21333,
29918,
978,
297,
15149,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
565,
21333,
29918,
978,
297,
349,
7466,
27888,
29918,
15551,
29918,
5813,
29903,
29901,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
462,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
9294,
24735,
29879,
29898,
29878,
1028,
29892,
11837,
29898,
11027,
29889,
14480,
1177,
29918,
4219,
29897,
718,
376,
29973,
4622,
543,
718,
21333,
29892,
13,
462,
462,
268,
10191,
29918,
13506,
2433,
2605,
1273,
29879,
451,
16459,
6284,
29915,
1273,
21333,
29897,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
29950,
22027,
29918,
7056,
13367,
2965,
29918,
29928,
24943,
8456,
17011,
29922,
5574,
29897,
13,
1678,
822,
1243,
29918,
303,
3470,
29918,
1333,
29918,
29882,
4821,
29918,
3597,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1932,
263,
13925,
1404,
338,
13817,
297,
29892,
896,
508,
1776,
376,
3597,
29908,
6515,
13,
4706,
1584,
565,
379,
22027,
29918,
7056,
13367,
2965,
29918,
29928,
24943,
8456,
17011,
338,
5852,
29889,
13,
4706,
9995,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
12948,
13,
4706,
363,
21333,
29918,
978,
297,
349,
7466,
27888,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
632,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
13,
1678,
822,
1243,
29918,
16121,
29918,
16453,
29898,
1311,
1125,
13,
4706,
9995,
29871,
1152,
278,
931,
1641,
29892,
3763,
9801,
393,
278,
478,
29934,
12569,
3377,
6515,
1016,
29915,
29873,
13031,
701,
29889,
9995,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
12948,
13,
4706,
363,
21333,
29918,
978,
297,
15149,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
632,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
9651,
565,
21333,
29918,
978,
297,
317,
4897,
15082,
29918,
29907,
7597,
29918,
19094,
1299,
29901,
13,
18884,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
718,
525,
29973,
4830,
29922,
7638,
1495,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
462,
525,
29907,
7597,
2009,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
4706,
396,
6515,
1728,
4343,
10898,
13,
4706,
396,
1243,
8271,
29899,
3250,
29899,
20205,
29899,
29876,
411,
1716,
2322,
322,
16874,
4050,
886,
13,
4706,
396,
3824,
29892,
591,
1818,
1284,
385,
8034,
393,
2869,
756,
21557,
800,
13,
4706,
777,
29918,
3084,
29918,
20205,
29918,
333,
353,
2169,
8306,
29889,
12650,
29889,
4102,
2141,
1727,
8306,
29918,
5064,
29889,
20205,
29889,
333,
13,
4706,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
525,
29872,
1464,
29899,
3250,
29899,
20205,
29899,
29876,
742,
6389,
11759,
5372,
29918,
3084,
29918,
20205,
29918,
333,
2314,
13,
4706,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
308,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
4706,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
718,
525,
29973,
4830,
29922,
7638,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
308,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
13,
1678,
822,
1243,
29918,
20965,
29918,
20205,
29918,
5064,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
12948,
13,
4706,
396,
1334,
881,
679,
29871,
29946,
29900,
29946,
515,
19781,
26652,
375,
18999,
408,
1532,
408,
515,
1644,
414,
470,
25222,
393,
13,
4706,
396,
1863,
541,
9455,
29915,
29873,
1304,
29889,
13,
4706,
363,
1881,
29918,
5338,
29918,
978,
29892,
8340,
29918,
333,
297,
518,
13,
9651,
6702,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
5064,
29899,
29876,
742,
1583,
29889,
348,
3880,
29918,
5064,
29889,
333,
511,
13,
9651,
6702,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
5064,
29899,
29876,
742,
29871,
29929,
29929,
29929,
29929,
29929,
29929,
511,
13,
9651,
6702,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
20205,
29899,
29876,
742,
1583,
29889,
348,
3880,
29918,
20205,
29889,
333,
511,
13,
9651,
6702,
13416,
29918,
14592,
3377,
29901,
29872,
1464,
29899,
3250,
29899,
20205,
29899,
29876,
742,
29871,
29929,
29929,
29929,
29929,
29929,
29929,
29897,
13,
4706,
4514,
29901,
13,
9651,
21333,
353,
11837,
29898,
2080,
29918,
5338,
29918,
978,
29892,
6389,
11759,
20965,
29918,
333,
2314,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
21409,
29898,
29878,
1028,
29892,
851,
29898,
20965,
29918,
333,
511,
4660,
29918,
401,
29922,
29946,
29900,
29946,
29897,
13,
13,
13,
1990,
4321,
3047,
3782,
4597,
8306,
1469,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1653,
29918,
1688,
29918,
1272,
29889,
3258,
29898,
1949,
29918,
29238,
800,
29922,
29900,
29892,
954,
29918,
1727,
8306,
29918,
15190,
29922,
29900,
29897,
13,
4706,
9595,
29889,
29872,
1464,
29918,
3250,
580,
13,
4706,
9595,
29889,
29238,
800,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
353,
4911,
5126,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
275,
29918,
303,
3470,
353,
5852,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
7620,
580,
13,
13,
1678,
822,
1243,
29918,
16121,
29918,
16453,
29898,
1311,
1125,
13,
4706,
9995,
29871,
1152,
278,
931,
1641,
29892,
3763,
9801,
393,
278,
478,
29934,
12569,
3377,
6515,
313,
392,
3461,
12623,
9595,
29897,
13,
4706,
1016,
29915,
29873,
13031,
701,
746,
727,
9455,
29915,
29873,
738,
21557,
800,
29889,
9995,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
29958,
29918,
29966,
25711,
17013,
12948,
13,
4706,
363,
21333,
29918,
978,
297,
15149,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
29906,
29900,
29900,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
632,
525,
3089,
304,
1273,
29879,
5229,
411,
4660,
1273,
29881,
29915,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
876,
13,
13,
13,
1990,
4321,
3047,
3782,
24565,
1123,
4011,
29898,
3057,
8259,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
731,
3373,
3057,
1469,
29898,
25932,
1125,
29871,
396,
1939,
2566,
3620,
13,
4706,
4069,
29918,
12276,
29918,
8899,
580,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
353,
4911,
5126,
580,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
275,
29918,
303,
3470,
353,
5852,
13,
4706,
1583,
29889,
303,
3470,
29918,
1792,
29889,
7620,
580,
13,
13,
1678,
822,
1243,
29918,
1217,
29918,
12276,
29918,
2704,
29898,
1311,
1125,
13,
4706,
3806,
29918,
3488,
29918,
15764,
353,
426,
13,
9651,
525,
29872,
1464,
29899,
3250,
2396,
6024,
29872,
1464,
29918,
3250,
29918,
957,
1493,
29918,
3488,
742,
525,
303,
3470,
29918,
3488,
7464,
13,
9651,
525,
29872,
1464,
29899,
3250,
29899,
5064,
2396,
6024,
29872,
1464,
29918,
3250,
29918,
5064,
29918,
3488,
742,
525,
303,
3470,
29918,
3488,
7464,
13,
9651,
525,
29872,
1464,
29899,
3250,
29899,
29882,
29939,
2396,
6024,
29872,
1464,
29918,
3250,
29918,
29882,
29939,
29918,
3488,
742,
525,
303,
3470,
29918,
3488,
7464,
13,
9651,
525,
29872,
1464,
29899,
3250,
29899,
1457,
2576,
3821,
2396,
6024,
29872,
1464,
29918,
3250,
29918,
1457,
2576,
3821,
29918,
29894,
4769,
29918,
3488,
742,
525,
303,
3470,
29918,
3488,
2033,
13,
4706,
500,
13,
4706,
3806,
29918,
4882,
29918,
401,
353,
29871,
29945,
29900,
29941,
13,
4706,
4974,
1583,
29889,
4645,
29889,
7507,
29898,
6786,
29922,
1311,
29889,
303,
3470,
29918,
1792,
29889,
6786,
29892,
4800,
29922,
29966,
25711,
17013,
12948,
13,
4706,
363,
21333,
29918,
978,
297,
15149,
29918,
15551,
29918,
5813,
29903,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29897,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
9684,
29918,
4882,
29918,
401,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
632,
525,
3089,
304,
1273,
29879,
750,
4660,
1273,
29881,
2012,
310,
1273,
29881,
29915,
13,
462,
632,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
3806,
29918,
4882,
29918,
401,
876,
13,
9651,
565,
21333,
29918,
978,
297,
3806,
29918,
3488,
29918,
15764,
29901,
13,
18884,
363,
3806,
297,
3806,
29918,
3488,
29918,
15764,
29961,
5338,
29918,
978,
5387,
13,
462,
1678,
1583,
29889,
9294,
797,
29898,
13,
462,
4706,
3806,
29892,
364,
1028,
29889,
4703,
29892,
13,
462,
4706,
525,
2392,
1813,
363,
1273,
29879,
1838,
20333,
29873,
731,
1813,
7353,
11860,
29879,
29908,
29915,
1273,
313,
5338,
29918,
978,
29892,
3806,
29897,
13,
462,
1678,
1723,
13,
4706,
363,
21333,
29918,
978,
297,
6024,
29872,
1464,
29899,
3250,
29899,
20205,
29899,
29876,
742,
525,
29872,
1464,
29899,
3250,
29899,
5064,
29899,
29876,
2033,
29901,
13,
9651,
21333,
353,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
21333,
29918,
978,
29892,
6389,
11759,
29929,
29929,
29929,
29929,
29929,
29929,
2314,
13,
9651,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
29898,
5338,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
9684,
29918,
4882,
29918,
401,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
13,
462,
632,
525,
3089,
304,
1273,
29879,
750,
4660,
1273,
29881,
2012,
310,
1273,
29881,
29915,
13,
462,
632,
1273,
313,
5338,
29892,
364,
1028,
29889,
4882,
29918,
401,
29892,
3806,
29918,
4882,
29918,
401,
876,
13,
13,
13,
1990,
4321,
24735,
29879,
29898,
3057,
8259,
1125,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
29950,
22027,
29918,
7056,
13367,
2965,
29918,
29928,
24943,
8456,
17011,
29922,
8824,
29897,
13,
1678,
822,
1243,
29918,
14592,
3377,
29918,
4632,
29918,
17886,
29879,
29898,
1311,
1125,
13,
4706,
9995,
847,
1272,
5771,
304,
847,
1272,
29914,
1363,
372,
4225,
263,
25053,
24765,
313,
6071,
13,
4706,
15337,
511,
322,
847,
1272,
29914,
5771,
304,
847,
1272,
29914,
29876,
1288,
29914,
1363,
393,
29915,
29879,
278,
13,
4706,
2322,
12569,
3377,
12569,
3377,
1813,
313,
6071,
263,
1776,
467,
13,
4706,
9995,
13,
4706,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
11219,
1272,
1495,
13,
4706,
1583,
29889,
9294,
24735,
29879,
29898,
29878,
1028,
29892,
8207,
1272,
29914,
742,
4660,
29918,
401,
29922,
29941,
29900,
29896,
29892,
13,
462,
632,
6699,
29918,
17886,
29918,
5327,
29922,
8824,
29897,
13,
4706,
364,
1028,
353,
1583,
29889,
4645,
29889,
657,
11219,
1272,
29914,
1495,
13,
4706,
1583,
29889,
9294,
24735,
29879,
29898,
29878,
1028,
29892,
11837,
29898,
15551,
29918,
5813,
5550,
11538,
718,
525,
29876,
1288,
5477,
13,
462,
632,
6699,
29918,
17886,
29918,
5327,
29922,
8824,
29897,
13,
2
] |
tool/mds.py | alexeyignatiev/minds | 5 | 164289 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
##
## mds.py
##
## Created on: Dec 3, 2017
## Author: <NAME>
## E-mail: <EMAIL>
##
# print function as in Python3
#==============================================================================
from __future__ import print_function
from minds.check import ConsistencyChecker
from minds.data import Data
from minds.minds1 import MinDS1Rules
from minds.mp92 import MP92Rules
from minds.options import Options
from minds.mxsatl import MaxSATLits
from minds.mxsatls import MaxSATLitsSep
from minds.mxsatsp import MaxSATSparse
from minds.satr import SATRules
from minds.satl import SATLits
from minds.satls import SATLitsSep
from minds.twostage import TwoStageApproach
import os
import resource
import six
import sys
#
#==============================================================================
def show_info():
"""
Print info message.
"""
print('c MDS: miner of (optimal) decision sets')
print('c author: <NAME> [email:<EMAIL>]')
print('')
#
#==============================================================================
def do_two_stage(data, options):
"""
Run the prime-based approach.
"""
ruler = TwoStageApproach(data, options)
covers = ruler.compute()
# save result to a CSV file
if options.rdump:
data.dump_result(primes, covers)
#
#==============================================================================
def do_single_stage(data, options):
"""
Run a single-stage SAT-based approach.
"""
if options.approach == 'mp92':
solver = MP92Rules(data, options) # MP92 approach
elif options.approach in ('satr', 'sr'):
solver = SATRules(data, options) # MinDS2 and MinDS2*
elif options.approach in ('satl', 'sl'):
solver = SATLits(data, options) # Opt
elif options.approach in ('satls', 'sls'):
solver = SATLitsSep(data, options) # OptSep
elif options.approach in ('mxsatls', 'mls'):
solver = MaxSATLitsSep(data, options) # MOptSep
elif options.approach in ('mxsatsparse', 'msparse', 'sparse'):
solver = MaxSATSparse(data, options) # Sparse
elif options.approach in ('mxsatl', 'ml'):
solver = MaxSATLits(data, options) # MOpt
else:
solver = MinDS1Rules(data, options) # MinDS1
covers = solver.compute()
# dealing with default rules (if any)
if options.verb:
wghts, label = [], None
if options.default:
# if the 'default' option is given
for lb in six.iterkeys(covers):
wghts.append(tuple([lb, sum(data.wghts[i] for i in solver.samps[lb])]))
label = max(wghts, key=lambda p: p[1])[0]
else:
# for the sparse model only:
# checking if there are default rules
# and selecting the best among them
for lb, premise in six.iteritems(covers):
if len(premise) == 1 and len(premise[0]) == 0:
wghts.append(tuple([lb, sum(data.wghts[i] for i in solver.samps[lb])]))
if wghts:
label = max(filter(lambda p: len(covers[p[0]]) != 1 or covers[p[0]] != [], wghts), key=lambda p: p[1])[0]
if label is not None:
print('c1 cover: true => {0}'.format(': '.join(data.fvmap.opp[label])))
print('c2 cover size: {0}'.format(sum([len(p) for p in six.itervalues(covers)])))
print('c2 cover wght: {0}'.format(solver.cost))
if hasattr(solver, 'accy'):
print('c2 accy filtr: {0:.2f}%'.format(solver.accy))
if hasattr(solver, 'accy_tot'):
print('c2 accy total: {0:.2f}%'.format(solver.accy_tot))
print('c2 cover time: {0:.4f}'.format(solver.time))
#
#==============================================================================
if __name__ == '__main__':
# parsing command-line options
options = Options(sys.argv)
# showing head
show_info()
# parsing data
if options.files:
data = Data(filename=options.files[0], mapfile=options.mapfile,
separator=options.separator, ranges=options.ranges)
else:
data = Data(fpointer=sys.stdin, mapfile=options.mapfile,
separator=options.separator)
if options.verb:
print('c0 # of samps: {0} ({1} weighted)'.format(sum(data.wghts), len(data.samps)))
print('c0 # of feats: {0} ({1} binary)'.format(len(data.names) - 1, len(list(filter(lambda x: x > 0, data.fvmap.opp.keys()))) - len(data.feats[-1])))
print('c0 # of labls: {0}'.format(len(data.feats[-1])))
used_time = resource.getrusage(resource.RUSAGE_SELF).ru_utime
print('c0 parse time: {0:.4f}'.format(used_time))
print('')
if options.noccheck == False:
# phase0: consistency check
checker = ConsistencyChecker(data, options)
if checker.status and checker.do() == False:
checker.remove_inconsistent()
if options.verb:
print('c0 data set is inconsistent')
print('c0 filtering out {0} samples ({1} left)'.format(data.samps_filt, len(data.samps)))
print('c0 filtering out {0} weights ({1} left)'.format(data.wghts_filt, sum(data.wghts)))
print('c0 check time: {0:.4f}'.format(checker.time))
print('')
if options.cdump:
checker.dump_consistent()
if checker.status == False:
print('c0 not enough classes => classification makes no sense')
sys.exit(1)
if options.approach in ('2', '2stage', 'pbased'):
do_two_stage(data, options)
else: # single-phase models (sat, mp92, minds1, opt, etc)
do_single_stage(data, options)
if options.verb:
total_time = resource.getrusage(resource.RUSAGE_CHILDREN).ru_utime + resource.getrusage(resource.RUSAGE_SELF).ru_utime
print('c3 total time: {0:.4f}'.format(total_time))
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
29899,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
2277,
13,
2277,
286,
6289,
29889,
2272,
13,
2277,
13,
2277,
29871,
6760,
630,
373,
29901,
3826,
29871,
29941,
29892,
29871,
29906,
29900,
29896,
29955,
13,
2277,
418,
13361,
29901,
529,
5813,
29958,
13,
2277,
418,
382,
29899,
2549,
29901,
529,
26862,
6227,
29958,
13,
2277,
13,
13,
29937,
1596,
740,
408,
297,
5132,
29941,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
27656,
29889,
3198,
1053,
2138,
391,
3819,
5596,
261,
13,
3166,
27656,
29889,
1272,
1053,
3630,
13,
3166,
27656,
29889,
29885,
12772,
29896,
1053,
3080,
8452,
29896,
29934,
2540,
13,
3166,
27656,
29889,
1526,
29929,
29906,
1053,
16379,
29929,
29906,
29934,
2540,
13,
3166,
27656,
29889,
6768,
1053,
25186,
13,
3166,
27656,
29889,
29885,
10351,
271,
29880,
1053,
5918,
29903,
1299,
29931,
1169,
13,
3166,
27656,
29889,
29885,
10351,
271,
3137,
1053,
5918,
29903,
1299,
29931,
1169,
29903,
1022,
13,
3166,
27656,
29889,
29885,
10351,
271,
1028,
1053,
5918,
29903,
1299,
29903,
5510,
13,
3166,
27656,
29889,
29879,
8141,
1053,
317,
1299,
29934,
2540,
13,
3166,
27656,
29889,
29879,
271,
29880,
1053,
317,
1299,
29931,
1169,
13,
3166,
27656,
29889,
29879,
271,
3137,
1053,
317,
1299,
29931,
1169,
29903,
1022,
13,
3166,
27656,
29889,
7516,
520,
482,
1053,
7803,
27276,
2052,
307,
496,
13,
5215,
2897,
13,
5215,
6503,
13,
5215,
4832,
13,
5215,
10876,
13,
13,
13,
29937,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
1753,
1510,
29918,
3888,
7295,
13,
1678,
9995,
13,
4706,
13905,
5235,
2643,
29889,
13,
1678,
9995,
13,
13,
1678,
1596,
877,
29883,
341,
8452,
29901,
1375,
261,
310,
313,
3670,
3039,
29897,
10608,
6166,
1495,
13,
1678,
1596,
877,
29883,
4148,
29901,
529,
5813,
29958,
518,
5269,
29901,
29966,
26862,
6227,
29958,
29962,
1495,
13,
1678,
1596,
877,
1495,
13,
13,
13,
29937,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
1753,
437,
29918,
10184,
29918,
19190,
29898,
1272,
29892,
3987,
1125,
13,
1678,
9995,
13,
4706,
7525,
278,
6019,
29899,
6707,
2948,
29889,
13,
1678,
9995,
13,
13,
1678,
364,
8584,
353,
7803,
27276,
2052,
307,
496,
29898,
1272,
29892,
3987,
29897,
13,
1678,
18469,
353,
364,
8584,
29889,
26017,
580,
13,
13,
1678,
396,
4078,
1121,
304,
263,
16874,
934,
13,
1678,
565,
3987,
29889,
5499,
3427,
29901,
13,
4706,
848,
29889,
15070,
29918,
2914,
29898,
558,
1355,
29892,
18469,
29897,
13,
13,
13,
29937,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
1753,
437,
29918,
14369,
29918,
19190,
29898,
1272,
29892,
3987,
1125,
13,
1678,
9995,
13,
4706,
7525,
263,
2323,
29899,
19190,
317,
1299,
29899,
6707,
2948,
29889,
13,
1678,
9995,
13,
13,
1678,
565,
3987,
29889,
9961,
496,
1275,
525,
1526,
29929,
29906,
2396,
13,
4706,
899,
369,
353,
16379,
29929,
29906,
29934,
2540,
29898,
1272,
29892,
3987,
29897,
29871,
396,
16379,
29929,
29906,
2948,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29879,
8141,
742,
525,
21935,
29374,
13,
4706,
899,
369,
353,
317,
1299,
29934,
2540,
29898,
1272,
29892,
3987,
29897,
29871,
396,
3080,
8452,
29906,
322,
3080,
8452,
29906,
29930,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29879,
271,
29880,
742,
525,
2536,
29374,
13,
4706,
899,
369,
353,
317,
1299,
29931,
1169,
29898,
1272,
29892,
3987,
29897,
29871,
396,
20693,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29879,
271,
3137,
742,
525,
2536,
29879,
29374,
13,
4706,
899,
369,
353,
317,
1299,
29931,
1169,
29903,
1022,
29898,
1272,
29892,
3987,
29897,
29871,
396,
20693,
29903,
1022,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29885,
10351,
271,
3137,
742,
525,
828,
29879,
29374,
13,
4706,
899,
369,
353,
5918,
29903,
1299,
29931,
1169,
29903,
1022,
29898,
1272,
29892,
3987,
29897,
29871,
396,
16999,
415,
29903,
1022,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29885,
10351,
1446,
5510,
742,
525,
1516,
5510,
742,
525,
29879,
5510,
29374,
13,
4706,
899,
369,
353,
5918,
29903,
1299,
29903,
5510,
29898,
1272,
29892,
3987,
29897,
29871,
396,
317,
5510,
13,
1678,
25342,
3987,
29889,
9961,
496,
297,
6702,
29885,
10351,
271,
29880,
742,
525,
828,
29374,
13,
4706,
899,
369,
353,
5918,
29903,
1299,
29931,
1169,
29898,
1272,
29892,
3987,
29897,
29871,
396,
16999,
415,
13,
1678,
1683,
29901,
13,
4706,
899,
369,
353,
3080,
8452,
29896,
29934,
2540,
29898,
1272,
29892,
3987,
29897,
29871,
396,
3080,
8452,
29896,
13,
13,
1678,
18469,
353,
899,
369,
29889,
26017,
580,
13,
13,
1678,
396,
16743,
411,
2322,
6865,
313,
361,
738,
29897,
13,
1678,
565,
3987,
29889,
18248,
29901,
13,
4706,
281,
29887,
400,
29879,
29892,
3858,
353,
19997,
6213,
13,
4706,
565,
3987,
29889,
4381,
29901,
13,
9651,
396,
565,
278,
525,
4381,
29915,
2984,
338,
2183,
13,
9651,
363,
27981,
297,
4832,
29889,
1524,
8149,
29898,
1111,
874,
1125,
13,
18884,
281,
29887,
400,
29879,
29889,
4397,
29898,
23583,
4197,
27728,
29892,
2533,
29898,
1272,
29889,
29893,
29887,
400,
29879,
29961,
29875,
29962,
363,
474,
297,
899,
369,
29889,
13445,
567,
29961,
27728,
2314,
12622,
13,
9651,
3858,
353,
4236,
29898,
29893,
29887,
400,
29879,
29892,
1820,
29922,
2892,
282,
29901,
282,
29961,
29896,
2314,
29961,
29900,
29962,
13,
4706,
1683,
29901,
13,
9651,
396,
363,
278,
29234,
1904,
871,
29901,
13,
9651,
396,
8454,
565,
727,
526,
2322,
6865,
13,
9651,
396,
322,
18851,
278,
1900,
4249,
963,
13,
9651,
363,
27981,
29892,
5188,
895,
297,
4832,
29889,
1524,
7076,
29898,
1111,
874,
1125,
13,
18884,
565,
7431,
29898,
1457,
29885,
895,
29897,
1275,
29871,
29896,
322,
7431,
29898,
1457,
29885,
895,
29961,
29900,
2314,
1275,
29871,
29900,
29901,
13,
462,
1678,
281,
29887,
400,
29879,
29889,
4397,
29898,
23583,
4197,
27728,
29892,
2533,
29898,
1272,
29889,
29893,
29887,
400,
29879,
29961,
29875,
29962,
363,
474,
297,
899,
369,
29889,
13445,
567,
29961,
27728,
2314,
12622,
13,
13,
9651,
565,
281,
29887,
400,
29879,
29901,
13,
18884,
3858,
353,
4236,
29898,
4572,
29898,
2892,
282,
29901,
7431,
29898,
1111,
874,
29961,
29886,
29961,
29900,
24960,
2804,
29871,
29896,
470,
18469,
29961,
29886,
29961,
29900,
5262,
2804,
19997,
281,
29887,
400,
29879,
511,
1820,
29922,
2892,
282,
29901,
282,
29961,
29896,
2314,
29961,
29900,
29962,
13,
13,
4706,
565,
3858,
338,
451,
6213,
29901,
13,
9651,
1596,
877,
29883,
29896,
4612,
29901,
1565,
1149,
426,
29900,
29913,
4286,
4830,
877,
29901,
15300,
7122,
29898,
1272,
29889,
29888,
29894,
1958,
29889,
9354,
29961,
1643,
29962,
4961,
13,
13,
1678,
1596,
877,
29883,
29906,
4612,
2159,
29901,
426,
29900,
29913,
4286,
4830,
29898,
2083,
4197,
2435,
29898,
29886,
29897,
363,
282,
297,
4832,
29889,
1524,
5975,
29898,
1111,
874,
4638,
4961,
13,
1678,
1596,
877,
29883,
29906,
4612,
281,
29887,
400,
29901,
426,
29900,
29913,
4286,
4830,
29898,
2929,
369,
29889,
18253,
876,
13,
13,
1678,
565,
756,
5552,
29898,
2929,
369,
29892,
525,
562,
1270,
29374,
13,
4706,
1596,
877,
29883,
29906,
1035,
29891,
977,
509,
29901,
426,
29900,
29901,
29889,
29906,
29888,
10560,
4286,
4830,
29898,
2929,
369,
29889,
562,
1270,
876,
13,
1678,
565,
756,
5552,
29898,
2929,
369,
29892,
525,
562,
1270,
29918,
4260,
29374,
13,
4706,
1596,
877,
29883,
29906,
1035,
29891,
3001,
29901,
426,
29900,
29901,
29889,
29906,
29888,
10560,
4286,
4830,
29898,
2929,
369,
29889,
562,
1270,
29918,
4260,
876,
13,
13,
1678,
1596,
877,
29883,
29906,
4612,
931,
29901,
426,
29900,
29901,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
2929,
369,
29889,
2230,
876,
13,
13,
13,
29937,
13,
29937,
9166,
9166,
9166,
9166,
4936,
2751,
1360,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
13755,
1899,
29899,
1220,
3987,
13,
1678,
3987,
353,
25186,
29898,
9675,
29889,
19218,
29897,
13,
13,
1678,
396,
6445,
2343,
13,
1678,
1510,
29918,
3888,
580,
13,
13,
1678,
396,
13755,
848,
13,
1678,
565,
3987,
29889,
5325,
29901,
13,
4706,
848,
353,
3630,
29898,
9507,
29922,
6768,
29889,
5325,
29961,
29900,
1402,
2910,
1445,
29922,
6768,
29889,
1958,
1445,
29892,
13,
18884,
28128,
29922,
6768,
29889,
344,
17954,
29892,
20238,
29922,
6768,
29889,
29878,
6916,
29897,
13,
1678,
1683,
29901,
13,
4706,
848,
353,
3630,
29898,
29888,
17226,
29922,
9675,
29889,
4172,
262,
29892,
2910,
1445,
29922,
6768,
29889,
1958,
1445,
29892,
13,
18884,
28128,
29922,
6768,
29889,
344,
17954,
29897,
13,
13,
1678,
565,
3987,
29889,
18248,
29901,
13,
4706,
1596,
877,
29883,
29900,
396,
310,
3514,
567,
29901,
426,
29900,
29913,
21313,
29896,
29913,
7688,
287,
29897,
4286,
4830,
29898,
2083,
29898,
1272,
29889,
29893,
29887,
400,
29879,
511,
7431,
29898,
1272,
29889,
13445,
567,
4961,
13,
4706,
1596,
877,
29883,
29900,
396,
310,
1238,
1446,
29901,
426,
29900,
29913,
21313,
29896,
29913,
7581,
29897,
4286,
4830,
29898,
2435,
29898,
1272,
29889,
7039,
29897,
448,
29871,
29896,
29892,
7431,
29898,
1761,
29898,
4572,
29898,
2892,
921,
29901,
921,
1405,
29871,
29900,
29892,
848,
29889,
29888,
29894,
1958,
29889,
9354,
29889,
8149,
580,
4961,
448,
7431,
29898,
1272,
29889,
1725,
1446,
14352,
29896,
29962,
4961,
13,
4706,
1596,
877,
29883,
29900,
396,
310,
9775,
3137,
29901,
426,
29900,
29913,
4286,
4830,
29898,
2435,
29898,
1272,
29889,
1725,
1446,
14352,
29896,
29962,
4961,
13,
13,
4706,
1304,
29918,
2230,
353,
6503,
29889,
657,
15816,
482,
29898,
10314,
29889,
29934,
3308,
10461,
29918,
1660,
29931,
29943,
467,
582,
29918,
329,
603,
13,
4706,
1596,
877,
29883,
29900,
6088,
931,
29901,
426,
29900,
29901,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
3880,
29918,
2230,
876,
13,
4706,
1596,
877,
1495,
13,
13,
1678,
565,
3987,
29889,
10763,
3198,
1275,
7700,
29901,
13,
4706,
396,
8576,
29900,
29901,
5718,
3819,
1423,
13,
4706,
1423,
261,
353,
2138,
391,
3819,
5596,
261,
29898,
1272,
29892,
3987,
29897,
13,
4706,
565,
1423,
261,
29889,
4882,
322,
1423,
261,
29889,
1867,
580,
1275,
7700,
29901,
13,
9651,
1423,
261,
29889,
5992,
29918,
262,
3200,
9696,
580,
13,
9651,
565,
3987,
29889,
18248,
29901,
13,
18884,
1596,
877,
29883,
29900,
848,
731,
338,
22435,
9696,
1495,
13,
18884,
1596,
877,
29883,
29900,
21166,
714,
426,
29900,
29913,
11916,
21313,
29896,
29913,
2175,
29897,
4286,
4830,
29898,
1272,
29889,
13445,
567,
29918,
1777,
29873,
29892,
7431,
29898,
1272,
29889,
13445,
567,
4961,
13,
18884,
1596,
877,
29883,
29900,
21166,
714,
426,
29900,
29913,
18177,
21313,
29896,
29913,
2175,
29897,
4286,
4830,
29898,
1272,
29889,
29893,
29887,
400,
29879,
29918,
1777,
29873,
29892,
2533,
29898,
1272,
29889,
29893,
29887,
400,
29879,
4961,
13,
18884,
1596,
877,
29883,
29900,
1423,
931,
29901,
426,
29900,
29901,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
3198,
261,
29889,
2230,
876,
13,
18884,
1596,
877,
1495,
13,
13,
9651,
565,
3987,
29889,
2252,
3427,
29901,
13,
18884,
1423,
261,
29889,
15070,
29918,
3200,
9696,
580,
13,
13,
4706,
565,
1423,
261,
29889,
4882,
1275,
7700,
29901,
13,
9651,
1596,
877,
29883,
29900,
451,
3307,
4413,
1149,
12965,
3732,
694,
4060,
1495,
13,
9651,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
565,
3987,
29889,
9961,
496,
297,
6702,
29906,
742,
525,
29906,
19190,
742,
525,
29886,
6707,
29374,
13,
4706,
437,
29918,
10184,
29918,
19190,
29898,
1272,
29892,
3987,
29897,
13,
1678,
1683,
29901,
29871,
396,
2323,
29899,
21646,
4733,
313,
29879,
271,
29892,
22326,
29929,
29906,
29892,
27656,
29896,
29892,
3523,
29892,
2992,
29897,
13,
4706,
437,
29918,
14369,
29918,
19190,
29898,
1272,
29892,
3987,
29897,
13,
13,
1678,
565,
3987,
29889,
18248,
29901,
13,
4706,
3001,
29918,
2230,
353,
6503,
29889,
657,
15816,
482,
29898,
10314,
29889,
29934,
3308,
10461,
29918,
3210,
6227,
8353,
1430,
467,
582,
29918,
329,
603,
718,
6503,
29889,
657,
15816,
482,
29898,
10314,
29889,
29934,
3308,
10461,
29918,
1660,
29931,
29943,
467,
582,
29918,
329,
603,
13,
4706,
1596,
877,
29883,
29941,
3001,
931,
29901,
426,
29900,
29901,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
7827,
29918,
2230,
876,
13,
2
] |
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/distribute/python/input_ops.py | JustinACoder/H22-GR3-UnrealAI | 6 | 66303 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Input-pipeline utilities for Distribution strategies."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops import readers
from tensorflow.python.data.util import nest
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.platform import tf_logging
# TODO(priyag): Any other reader datasets to consider here?
_READER_DATASET_OPS = [
"TextLineDataset",
"TFRecordDataset",
"FixedLengthRecordDataset"
]
# pylint: disable=protected-access
def auto_shard_dataset(dataset, num_shards, index):
"""Shard the input pipeline by sharding the underlying list of files.
Args:
dataset: A `tf.data.Dataset` instance, typically the result of a bunch of
dataset transformations.
num_shards: A `tf.int64` scalar `tf.Tensor`, representing the number of
shards operating in parallel. Same usage as in `Dataset.shard`.
index: A `tf.int64` scalar `tf.Tensor`, representing the worker index.
Same usage as in `Dataset.shard`.
Returns:
A modified `Dataset` obtained by updating the pipeline sharded by the
files. The input dataset will be returned if we cannot automatically
determine a good way to shard the input dataset.
"""
# TODO(priyag): Clone datasets instead of updating in place, similar to the
# clone method for TFRecordDataset.
def _auto_shard_impl(dataset, found_reader_op):
"""Recursive implementation of auto sharding."""
if not found_reader_op:
# TODO(priyag): Make this check more robust by enforcing some common
# property on reader datasets.
if (isinstance(dataset, readers.TextLineDataset) or
isinstance(dataset, readers.FixedLengthRecordDataset)):
filenames_tensor = dataset._filenames
num_files = array_ops.size(filenames_tensor)
sharded_filenames_tensor = array_ops.gather(
filenames_tensor, math_ops.range(index, num_files, num_shards))
dataset._filenames = sharded_filenames_tensor
return dataset
elif isinstance(dataset, readers.TFRecordDataset):
# `TFRecordDataset` needs to be handled separately than other readers
# because it converts filenames to a dataset first. Also, we clone it
# instead of updating in place because it has special logic in the
# constructor. Eventually we will change all cases to clone datasets
# instead of updating in-place.
return dataset._clone(
filenames=dataset._filenames.shard(num_shards, index))
elif hasattr(dataset, "_map_func"):
# TODO(priyag): Make this check more robust by enforcing some common
# property on all map/flatmap/interleave datasets.
map_func_def = dataset._map_func.definition
for node in map_func_def.node_def:
if node.op in _READER_DATASET_OPS:
found_reader_op = True
break
elif node.op == "FlatMapDataset":
# TODO(priyag): Should this check for other map datasets? Should it
# be recursive? It is too specific to implementation of
# TFRecordDataset right now.
nested_func_name = node.attr["f"].func.name
nested_func = ops.get_default_graph()._functions[nested_func_name]
for nested_node in nested_func.definition.node_def:
if nested_node.op in _READER_DATASET_OPS:
found_reader_op = True
break
if found_reader_op:
break
if found_reader_op:
dataset._input_dataset = _auto_shard_impl(
dataset._input_dataset, found_reader_op)
return dataset
# TODO(priyag): Make _input_dataset(s) a common property of all datasets to
# make this check more robust.
if hasattr(dataset, "_input_dataset"):
dataset._input_dataset = _auto_shard_impl(
dataset._input_dataset, found_reader_op)
if hasattr(dataset, "_dataset_to_concatenate"):
# Special case for `ConcatentateDataset`. We want to shard all input
# datasets.
dataset._dataset_to_concatenate = _auto_shard_impl(
dataset._dataset_to_concatenate, found_reader_op)
return dataset
if hasattr(dataset, "_datasets"):
# Special case for `ZipDataset`.
dataset._datasets = nest.pack_sequence_as(dataset._datasets, [
_auto_shard_impl(ds, found_reader_op)
for ds in nest.flatten(dataset._datasets)
])
return dataset
if not found_reader_op:
tf_logging.warn(
"Could not find a standard reader in the input pipeline"
"(one of TextLineDataset, TFRecordDataset, FixedLengthRecordDataset)."
"So auto-sharding is not done. Please verify correctness of "
"auto-sharding for your input.")
# TODO(yuefengz): maybe still shard it?
return dataset
# TODO(priyag): What do we want to do if the number of filenames is
# uneven in the number of shards? By default, this will just return as
# many items it can before throwing OutOfRangeError.
# TODO(priyag): This will shard the filenames before any shuffling of the
# filename dataset. It might be desirable to shard after shuffling
# filenames? If so, how do we achieve that?
return dataset.shard(num_shards, index)
return _auto_shard_impl(dataset=dataset, found_reader_op=False)
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
450,
323,
6073,
17907,
13189,
943,
29889,
2178,
26863,
2538,
9841,
22993,
13,
29937,
30004,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
18584,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
22993,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
30004,
13,
29937,
30004,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
30004,
13,
29937,
30004,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
30004,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
11167,
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,
22993,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
30004,
13,
29937,
27028,
1090,
278,
19245,
22993,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
2751,
30004,
13,
15945,
29908,
4290,
29899,
13096,
5570,
3667,
1907,
363,
17740,
16650,
583,
1213,
15945,
30004,
13,
30004,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
30004,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
30004,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
30004,
13,
30004,
13,
3166,
26110,
29889,
4691,
29889,
1272,
29889,
3554,
1053,
22176,
30004,
13,
3166,
26110,
29889,
4691,
29889,
1272,
29889,
4422,
1053,
17763,
30004,
13,
3166,
26110,
29889,
4691,
29889,
4468,
1053,
288,
567,
30004,
13,
3166,
26110,
29889,
4691,
29889,
3554,
1053,
1409,
29918,
3554,
30004,
13,
3166,
26110,
29889,
4691,
29889,
3554,
1053,
5844,
29918,
3554,
30004,
13,
3166,
26110,
29889,
4691,
29889,
12120,
1053,
15886,
29918,
21027,
30004,
13,
30004,
13,
29937,
14402,
29898,
29886,
374,
29891,
351,
1125,
3139,
916,
9591,
20035,
304,
2050,
1244,
29973,
30004,
13,
29918,
16310,
1001,
29918,
25832,
8127,
29911,
29918,
4590,
29903,
353,
518,
30004,
13,
1678,
376,
1626,
3542,
16390,
24541,
15231,
13,
1678,
376,
8969,
9182,
16390,
24541,
15231,
13,
1678,
376,
26262,
6513,
9182,
16390,
24541,
19451,
13,
29962,
30004,
13,
30004,
13,
30004,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
30004,
13,
1753,
4469,
29918,
845,
538,
29918,
24713,
29898,
24713,
29892,
954,
29918,
845,
3163,
29892,
2380,
1125,
30004,
13,
29871,
9995,
2713,
538,
278,
1881,
16439,
491,
528,
20272,
278,
14407,
1051,
310,
2066,
22993,
13,
30004,
13,
29871,
826,
3174,
29901,
30004,
13,
1678,
8783,
29901,
319,
421,
13264,
29889,
1272,
29889,
16390,
24541,
29952,
2777,
29892,
12234,
278,
1121,
310,
263,
14928,
310,
30004,
13,
418,
8783,
29304,
22993,
13,
1678,
954,
29918,
845,
3163,
29901,
319,
421,
13264,
29889,
524,
29953,
29946,
29952,
17336,
421,
13264,
29889,
29911,
6073,
1673,
15783,
278,
1353,
310,
30004,
13,
4706,
528,
3163,
13598,
297,
8943,
29889,
19491,
8744,
408,
297,
421,
16390,
24541,
29889,
845,
538,
1412,
30004,
13,
1678,
2380,
29901,
319,
421,
13264,
29889,
524,
29953,
29946,
29952,
17336,
421,
13264,
29889,
29911,
6073,
1673,
15783,
278,
15645,
2380,
22993,
13,
418,
19491,
8744,
408,
297,
421,
16390,
24541,
29889,
845,
538,
1412,
30004,
13,
30004,
13,
29871,
16969,
29901,
30004,
13,
1678,
319,
9120,
421,
16390,
24541,
29952,
7625,
491,
13271,
278,
16439,
528,
25600,
491,
278,
30004,
13,
1678,
2066,
29889,
450,
1881,
8783,
674,
367,
4133,
565,
591,
2609,
6336,
30004,
13,
1678,
8161,
263,
1781,
982,
304,
528,
538,
278,
1881,
8783,
22993,
13,
29871,
9995,
30004,
13,
30004,
13,
29871,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
2233,
650,
20035,
2012,
310,
13271,
297,
2058,
29892,
2788,
304,
278,
30004,
13,
29871,
396,
17432,
1158,
363,
323,
29943,
9182,
16390,
24541,
22993,
13,
29871,
822,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
24713,
29892,
1476,
29918,
16950,
29918,
459,
1125,
30004,
13,
1678,
9995,
4789,
25397,
5314,
310,
4469,
528,
20272,
1213,
15945,
30004,
13,
30004,
13,
1678,
565,
451,
1476,
29918,
16950,
29918,
459,
29901,
30004,
13,
418,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
8561,
445,
1423,
901,
16424,
491,
24555,
3277,
777,
3619,
30004,
13,
418,
396,
2875,
373,
9591,
20035,
22993,
13,
418,
565,
313,
275,
8758,
29898,
24713,
29892,
22176,
29889,
1626,
3542,
16390,
24541,
29897,
470,
30004,
13,
3986,
338,
8758,
29898,
24713,
29892,
22176,
29889,
26262,
6513,
9182,
16390,
24541,
22164,
30004,
13,
4706,
977,
264,
1280,
29918,
20158,
353,
8783,
3032,
1777,
264,
1280,
30004,
13,
4706,
954,
29918,
5325,
353,
1409,
29918,
3554,
29889,
2311,
29898,
1777,
264,
1280,
29918,
20158,
8443,
13,
4706,
528,
25600,
29918,
1777,
264,
1280,
29918,
20158,
353,
1409,
29918,
3554,
29889,
29887,
1624,
29898,
30004,
13,
9651,
977,
264,
1280,
29918,
20158,
29892,
5844,
29918,
3554,
29889,
3881,
29898,
2248,
29892,
954,
29918,
5325,
29892,
954,
29918,
845,
3163,
876,
30004,
13,
4706,
8783,
3032,
1777,
264,
1280,
353,
528,
25600,
29918,
1777,
264,
1280,
29918,
20158,
30004,
13,
4706,
736,
8783,
30004,
13,
418,
25342,
338,
8758,
29898,
24713,
29892,
22176,
29889,
8969,
9182,
16390,
24541,
1125,
30004,
13,
4706,
396,
421,
8969,
9182,
16390,
24541,
29952,
4225,
304,
367,
16459,
16949,
1135,
916,
22176,
30004,
13,
4706,
396,
1363,
372,
29436,
977,
264,
1280,
304,
263,
8783,
937,
29889,
3115,
29892,
591,
17432,
372,
30004,
13,
4706,
396,
2012,
310,
13271,
297,
2058,
1363,
372,
756,
4266,
5900,
297,
278,
30004,
13,
4706,
396,
5823,
29889,
6864,
1474,
591,
674,
1735,
599,
4251,
304,
17432,
20035,
30004,
13,
4706,
396,
2012,
310,
13271,
297,
29899,
6689,
22993,
13,
4706,
736,
8783,
3032,
16513,
29898,
30004,
13,
9651,
977,
264,
1280,
29922,
24713,
3032,
1777,
264,
1280,
29889,
845,
538,
29898,
1949,
29918,
845,
3163,
29892,
2380,
876,
30004,
13,
418,
25342,
756,
5552,
29898,
24713,
29892,
11119,
1958,
29918,
9891,
29908,
1125,
30004,
13,
4706,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
8561,
445,
1423,
901,
16424,
491,
24555,
3277,
777,
3619,
30004,
13,
4706,
396,
2875,
373,
599,
2910,
29914,
20620,
1958,
29914,
1639,
280,
1351,
20035,
22993,
13,
4706,
2910,
29918,
9891,
29918,
1753,
353,
8783,
3032,
1958,
29918,
9891,
29889,
16553,
30004,
13,
4706,
363,
2943,
297,
2910,
29918,
9891,
29918,
1753,
29889,
3177,
29918,
1753,
29901,
30004,
13,
3986,
565,
2943,
29889,
459,
297,
903,
16310,
1001,
29918,
25832,
8127,
29911,
29918,
4590,
29903,
29901,
30004,
13,
9651,
1476,
29918,
16950,
29918,
459,
353,
5852,
30004,
13,
9651,
2867,
30004,
13,
3986,
25342,
2943,
29889,
459,
1275,
376,
29943,
5066,
3388,
16390,
24541,
1115,
30004,
13,
9651,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
10575,
445,
1423,
363,
916,
2910,
20035,
29973,
10575,
372,
30004,
13,
9651,
396,
367,
16732,
29973,
739,
338,
2086,
2702,
304,
5314,
310,
30004,
13,
9651,
396,
323,
29943,
9182,
16390,
24541,
1492,
1286,
22993,
13,
9651,
9322,
29918,
9891,
29918,
978,
353,
2943,
29889,
5552,
3366,
29888,
16862,
9891,
29889,
978,
30004,
13,
9651,
9322,
29918,
9891,
353,
288,
567,
29889,
657,
29918,
4381,
29918,
4262,
2141,
29918,
12171,
29961,
27420,
29918,
9891,
29918,
978,
29962,
30004,
13,
9651,
363,
9322,
29918,
3177,
297,
9322,
29918,
9891,
29889,
16553,
29889,
3177,
29918,
1753,
29901,
30004,
13,
795,
565,
9322,
29918,
3177,
29889,
459,
297,
903,
16310,
1001,
29918,
25832,
8127,
29911,
29918,
4590,
29903,
29901,
30004,
13,
18884,
1476,
29918,
16950,
29918,
459,
353,
5852,
30004,
13,
18884,
2867,
30004,
13,
9651,
565,
1476,
29918,
16950,
29918,
459,
29901,
30004,
13,
795,
2867,
30004,
13,
4706,
565,
1476,
29918,
16950,
29918,
459,
29901,
30004,
13,
3986,
8783,
3032,
2080,
29918,
24713,
353,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
30004,
13,
795,
8783,
3032,
2080,
29918,
24713,
29892,
1476,
29918,
16950,
29918,
459,
8443,
13,
3986,
736,
8783,
30004,
13,
30004,
13,
1678,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
8561,
903,
2080,
29918,
24713,
29898,
29879,
29897,
263,
3619,
2875,
310,
599,
20035,
304,
30004,
13,
1678,
396,
1207,
445,
1423,
901,
16424,
22993,
13,
1678,
565,
756,
5552,
29898,
24713,
29892,
11119,
2080,
29918,
24713,
29908,
1125,
30004,
13,
418,
8783,
3032,
2080,
29918,
24713,
353,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
30004,
13,
3986,
8783,
3032,
2080,
29918,
24713,
29892,
1476,
29918,
16950,
29918,
459,
8443,
13,
418,
565,
756,
5552,
29898,
24713,
29892,
11119,
24713,
29918,
517,
29918,
535,
29883,
2579,
403,
29908,
1125,
30004,
13,
4706,
396,
12630,
1206,
363,
421,
1168,
4117,
296,
403,
16390,
24541,
1412,
1334,
864,
304,
528,
538,
599,
1881,
30004,
13,
4706,
396,
20035,
22993,
13,
4706,
8783,
3032,
24713,
29918,
517,
29918,
535,
29883,
2579,
403,
353,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
30004,
13,
9651,
8783,
3032,
24713,
29918,
517,
29918,
535,
29883,
2579,
403,
29892,
1476,
29918,
16950,
29918,
459,
8443,
13,
418,
736,
8783,
30004,
13,
30004,
13,
1678,
565,
756,
5552,
29898,
24713,
29892,
11119,
14538,
1691,
29908,
1125,
30004,
13,
418,
396,
12630,
1206,
363,
421,
26264,
16390,
24541,
1412,
30004,
13,
418,
8783,
3032,
14538,
1691,
353,
17763,
29889,
4058,
29918,
16506,
29918,
294,
29898,
24713,
3032,
14538,
1691,
29892,
518,
30004,
13,
3986,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
6289,
29892,
1476,
29918,
16950,
29918,
459,
8443,
13,
3986,
363,
18031,
297,
17763,
29889,
1579,
8606,
29898,
24713,
3032,
14538,
1691,
8443,
13,
539,
2314,
30004,
13,
418,
736,
8783,
30004,
13,
30004,
13,
1678,
565,
451,
1476,
29918,
16950,
29918,
459,
29901,
30004,
13,
418,
15886,
29918,
21027,
29889,
25442,
29898,
30004,
13,
3986,
376,
23323,
451,
1284,
263,
3918,
9591,
297,
278,
1881,
16439,
19451,
13,
3986,
18227,
650,
310,
3992,
3542,
16390,
24541,
29892,
323,
29943,
9182,
16390,
24541,
29892,
383,
11925,
6513,
9182,
16390,
24541,
467,
19451,
13,
3986,
376,
6295,
4469,
29899,
845,
20272,
338,
451,
2309,
29889,
3529,
11539,
1959,
2264,
310,
376,
30004,
13,
3986,
376,
6921,
29899,
845,
20272,
363,
596,
1881,
23157,
30004,
13,
418,
396,
14402,
29898,
29891,
434,
29888,
996,
29920,
1125,
5505,
1603,
528,
538,
372,
29973,
30004,
13,
418,
736,
8783,
30004,
13,
30004,
13,
1678,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
1724,
437,
591,
864,
304,
437,
565,
278,
1353,
310,
977,
264,
1280,
338,
30004,
13,
1678,
396,
1597,
854,
297,
278,
1353,
310,
528,
3163,
29973,
2648,
2322,
29892,
445,
674,
925,
736,
408,
30004,
13,
1678,
396,
1784,
4452,
372,
508,
1434,
17452,
4451,
2776,
6069,
2392,
22993,
13,
1678,
396,
14402,
29898,
29886,
374,
29891,
351,
1125,
910,
674,
528,
538,
278,
977,
264,
1280,
1434,
738,
528,
3096,
1847,
310,
278,
30004,
13,
1678,
396,
10422,
8783,
29889,
739,
1795,
367,
553,
27797,
304,
528,
538,
1156,
528,
3096,
1847,
30004,
13,
1678,
396,
977,
264,
1280,
29973,
960,
577,
29892,
920,
437,
591,
6176,
393,
29973,
30004,
13,
1678,
736,
8783,
29889,
845,
538,
29898,
1949,
29918,
845,
3163,
29892,
2380,
8443,
13,
30004,
13,
29871,
736,
903,
6921,
29918,
845,
538,
29918,
13699,
29898,
24713,
29922,
24713,
29892,
1476,
29918,
16950,
29918,
459,
29922,
8824,
8443,
13,
2
] |
src/rubrik_config/helpers.py | rubrikinc/rubrik-config-backup | 2 | 98149 | import importlib
import os
import re
import cli_ui
import rubrik_cdm
def config_class(module_name):
class_name = module_name.title().replace('_', '') + 'Config'
klass = getattr(importlib.import_module('rubrik_config.'+module_name), class_name)
return klass
def config_name(obj):
matches = re.findall('[A-Z][^A-Z]*', type(obj).__name__)
name = '_'.join(matches[:-1])
return name.lower()
def filter_fields(original, keepers):
return { k: v for k, v in original.items() if k in keepers }
def cluster_name(rubrik):
return rubrik.get('v1', '/cluster/me')['name']
def ask_multiline_string(ask):
cli_ui.info(cli_ui.green, '::', cli_ui.lightgray, ask, '(blank line will terminate)')
user_input = []
is_first_line = True
while True:
if is_first_line:
line = cli_ui.read_input()
is_first_line = False
else:
line = input()
if not line: # If line is blank
break
else:
user_input.append(line)
return '\n'.join(user_input)
def ask_or_default(name, label, defaults={}):
result = ''
if name not in defaults.keys():
result = cli_ui.ask_string(label+'?')
else:
result = defaults[name]
cli_ui.info_1(label+':', result)
return result
def status_color(status):
color = cli_ui.yellow
if status == 'SUCCEEDED': color = cli_ui.green
elif status == 'FAILED': color = cli_ui.red
return color
# Copied from https://github.com/pallets/werkzeug/blob/master/src/werkzeug/utils.py#L416
def secure_filename(filename: str) -> str:
r"""Pass it a filename and it will return a secure version of it. This
filename can then safely be stored on a regular file system and passed
to :func:`os.path.join`. The filename returned is an ASCII only string
for maximum portability.
On windows systems the function also makes sure that the file is not
named after one of the special device files.
>>> secure_filename("My cool movie.mov")
'My_cool_movie.mov'
>>> secure_filename("../../../etc/passwd")
'etc_passwd'
>>> secure_filename('i contain cool \xfcml\xe4uts.txt')
'i_contain_cool_umlauts.txt'
The function might return an empty filename. It's your responsibility
to ensure that the filename is unique and that you abort or
generate a random filename if the function returned an empty one.
.. versionadded:: 0.5
:param filename: the filename to secure
"""
if isinstance(filename, str):
from unicodedata import normalize
filename = normalize("NFKD", filename).encode("ascii", "ignore").decode("ascii")
for sep in os.path.sep, os.path.altsep:
if sep:
filename = filename.replace(sep, " ")
filename = str(re.compile(r"[^A-Za-z0-9_.-]").sub("", "_".join(filename.split()))).strip("._")
# On NT a couple of special files are present in each folder. We have to ensure that the target
# file is not such a filename. In this case we prepend an underline.
if (
os.name == "nt"
and filename
and filename.split(".")[0].upper() in ("CON", "AUX", "COM1", "COM2", "COM3", "COM4", "LPT1", "LPT2", "LPT3", "PRN", "NUL")
):
filename = f"_{filename}"
return filename
| [
1,
1053,
1053,
1982,
13,
5215,
2897,
13,
5215,
337,
13,
13,
5215,
9335,
29918,
1481,
13,
5215,
14051,
5357,
29918,
2252,
29885,
13,
13,
13,
1753,
2295,
29918,
1990,
29898,
5453,
29918,
978,
1125,
13,
1678,
770,
29918,
978,
353,
3883,
29918,
978,
29889,
3257,
2141,
6506,
877,
29918,
742,
27255,
718,
525,
3991,
29915,
13,
1678,
22902,
353,
679,
5552,
29898,
5215,
1982,
29889,
5215,
29918,
5453,
877,
29878,
431,
5357,
29918,
2917,
6169,
29974,
5453,
29918,
978,
511,
770,
29918,
978,
29897,
13,
1678,
736,
22902,
13,
13,
13,
1753,
2295,
29918,
978,
29898,
5415,
1125,
13,
1678,
7087,
353,
337,
29889,
2886,
497,
877,
29961,
29909,
29899,
29999,
3816,
29985,
29909,
29899,
29999,
14178,
742,
1134,
29898,
5415,
467,
1649,
978,
1649,
29897,
13,
1678,
1024,
353,
22868,
4286,
7122,
29898,
20317,
7503,
29899,
29896,
2314,
13,
1678,
736,
1024,
29889,
13609,
580,
13,
13,
13,
1753,
4175,
29918,
9621,
29898,
13492,
29892,
3013,
414,
1125,
13,
1678,
736,
426,
413,
29901,
325,
363,
413,
29892,
325,
297,
2441,
29889,
7076,
580,
565,
413,
297,
3013,
414,
500,
13,
13,
13,
1753,
9867,
29918,
978,
29898,
29878,
431,
5357,
1125,
13,
1678,
736,
14051,
5357,
29889,
657,
877,
29894,
29896,
742,
8207,
19594,
29914,
1004,
1495,
1839,
978,
2033,
13,
13,
13,
1753,
2244,
29918,
4713,
309,
457,
29918,
1807,
29898,
1278,
1125,
13,
1678,
9335,
29918,
1481,
29889,
3888,
29898,
11303,
29918,
1481,
29889,
12692,
29892,
525,
1057,
742,
9335,
29918,
1481,
29889,
4366,
21012,
29892,
2244,
29892,
525,
29898,
19465,
1196,
674,
29504,
29897,
1495,
13,
268,
13,
1678,
1404,
29918,
2080,
353,
5159,
13,
1678,
338,
29918,
4102,
29918,
1220,
353,
5852,
13,
1678,
1550,
5852,
29901,
13,
4706,
565,
338,
29918,
4102,
29918,
1220,
29901,
13,
9651,
1196,
353,
9335,
29918,
1481,
29889,
949,
29918,
2080,
580,
13,
9651,
338,
29918,
4102,
29918,
1220,
353,
7700,
13,
4706,
1683,
29901,
29871,
13,
9651,
1196,
353,
1881,
580,
13,
13,
4706,
565,
451,
1196,
29901,
396,
960,
1196,
338,
9654,
13,
9651,
2867,
13,
4706,
1683,
29901,
13,
9651,
1404,
29918,
2080,
29889,
4397,
29898,
1220,
29897,
13,
13,
1678,
736,
11297,
29876,
4286,
7122,
29898,
1792,
29918,
2080,
29897,
13,
13,
13,
1753,
2244,
29918,
272,
29918,
4381,
29898,
978,
29892,
3858,
29892,
21274,
3790,
29913,
1125,
13,
1678,
1121,
353,
6629,
13,
13,
1678,
565,
1024,
451,
297,
21274,
29889,
8149,
7295,
13,
4706,
1121,
353,
9335,
29918,
1481,
29889,
1278,
29918,
1807,
29898,
1643,
23097,
29973,
1495,
13,
1678,
1683,
29901,
13,
4706,
1121,
353,
21274,
29961,
978,
29962,
13,
4706,
9335,
29918,
1481,
29889,
3888,
29918,
29896,
29898,
1643,
29974,
2396,
742,
1121,
29897,
13,
268,
13,
1678,
736,
1121,
13,
13,
13,
1753,
4660,
29918,
2780,
29898,
4882,
1125,
13,
1678,
2927,
353,
9335,
29918,
1481,
29889,
29136,
13,
1678,
565,
4660,
1275,
525,
14605,
4174,
17896,
2287,
29928,
2396,
2927,
353,
9335,
29918,
1481,
29889,
12692,
13,
1678,
25342,
4660,
1275,
525,
4519,
29902,
20566,
2396,
2927,
353,
9335,
29918,
1481,
29889,
1127,
13,
1678,
736,
2927,
13,
13,
13,
29937,
10061,
1000,
515,
2045,
597,
3292,
29889,
510,
29914,
7830,
10376,
29914,
9888,
13289,
29914,
10054,
29914,
6207,
29914,
4351,
29914,
9888,
13289,
29914,
13239,
29889,
2272,
29937,
29931,
29946,
29896,
29953,
13,
1753,
11592,
29918,
9507,
29898,
9507,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
364,
15945,
29908,
7129,
372,
263,
10422,
322,
372,
674,
736,
263,
11592,
1873,
310,
372,
29889,
29871,
910,
13,
1678,
10422,
508,
769,
23511,
367,
6087,
373,
263,
4943,
934,
1788,
322,
4502,
13,
1678,
304,
584,
9891,
18078,
359,
29889,
2084,
29889,
7122,
1412,
29871,
450,
10422,
4133,
338,
385,
27196,
871,
1347,
13,
1678,
363,
7472,
2011,
3097,
29889,
13,
1678,
1551,
5417,
6757,
278,
740,
884,
3732,
1854,
393,
278,
934,
338,
451,
13,
1678,
4257,
1156,
697,
310,
278,
4266,
4742,
2066,
29889,
13,
1678,
8653,
11592,
29918,
9507,
703,
3421,
12528,
14064,
29889,
13529,
1159,
13,
1678,
525,
3421,
29918,
1111,
324,
29918,
27362,
29889,
13529,
29915,
13,
1678,
8653,
11592,
29918,
9507,
703,
21546,
6995,
7070,
29914,
3364,
9970,
1159,
13,
1678,
525,
7070,
29918,
3364,
9970,
29915,
13,
1678,
8653,
11592,
29918,
9507,
877,
29875,
1712,
12528,
320,
29916,
13801,
828,
29905,
17115,
29946,
8842,
29889,
3945,
1495,
13,
1678,
525,
29875,
29918,
1285,
475,
29918,
1111,
324,
29918,
398,
433,
8842,
29889,
3945,
29915,
13,
1678,
450,
740,
1795,
736,
385,
4069,
10422,
29889,
29871,
739,
29915,
29879,
596,
23134,
13,
1678,
304,
9801,
393,
278,
10422,
338,
5412,
322,
393,
366,
27450,
470,
13,
1678,
5706,
263,
4036,
10422,
565,
278,
740,
4133,
385,
4069,
697,
29889,
13,
1678,
6317,
1873,
23959,
1057,
29871,
29900,
29889,
29945,
13,
1678,
584,
3207,
10422,
29901,
278,
10422,
304,
11592,
13,
1678,
9995,
13,
1678,
565,
338,
8758,
29898,
9507,
29892,
851,
1125,
13,
4706,
515,
443,
293,
6797,
532,
1053,
4226,
675,
13,
13,
4706,
10422,
353,
4226,
675,
703,
22498,
29968,
29928,
613,
10422,
467,
12508,
703,
294,
18869,
613,
376,
17281,
2564,
13808,
703,
294,
18869,
1159,
13,
1678,
363,
16345,
297,
2897,
29889,
2084,
29889,
19570,
29892,
2897,
29889,
2084,
29889,
1997,
19570,
29901,
13,
4706,
565,
16345,
29901,
13,
9651,
10422,
353,
10422,
29889,
6506,
29898,
19570,
29892,
376,
16521,
13,
1678,
10422,
353,
851,
29898,
276,
29889,
12198,
29898,
29878,
29908,
22896,
29909,
29899,
29999,
29874,
29899,
29920,
29900,
29899,
29929,
5396,
29899,
29962,
2564,
1491,
703,
613,
11119,
1642,
7122,
29898,
9507,
29889,
5451,
22130,
467,
17010,
703,
3032,
1159,
13,
13,
1678,
396,
1551,
405,
29911,
263,
7303,
310,
4266,
2066,
526,
2198,
297,
1269,
4138,
29889,
29871,
1334,
505,
304,
9801,
393,
278,
3646,
29871,
13,
1678,
396,
934,
338,
451,
1316,
263,
10422,
29889,
512,
445,
1206,
591,
8273,
355,
385,
1090,
1220,
29889,
13,
1678,
565,
313,
13,
4706,
2897,
29889,
978,
1275,
376,
593,
29908,
13,
4706,
322,
10422,
13,
4706,
322,
10422,
29889,
5451,
17350,
1159,
29961,
29900,
1822,
21064,
580,
297,
4852,
6007,
613,
376,
25951,
29990,
613,
376,
19795,
29896,
613,
376,
19795,
29906,
613,
376,
19795,
29941,
613,
376,
19795,
29946,
613,
376,
29931,
7982,
29896,
613,
376,
29931,
7982,
29906,
613,
376,
29931,
7982,
29941,
613,
376,
10593,
29940,
613,
376,
11601,
29931,
1159,
13,
268,
1125,
13,
4706,
10422,
353,
285,
29908,
648,
9507,
5038,
13,
13,
1678,
736,
10422,
13,
2
] |
Python/Introduction CS-P/Problem Sets/ps04,/ps4c/ps4c.py | Alonoparag/my-datascience-prep | 0 | 178694 | # Problem Set 4C
# Name: <NAME>
# Collaborators:
# Start: 27.12.2020 14:50
# End: 29.12.2020 18:15
# EncryptedSubMessage decrypt_message() returns words that are not necessarily the original, though they are valid
# To run unit tests, type pytest in the terminal
import string
from ps4a import get_permutations
### HELPER CODE ###
def load_words(file_name):
'''
file_name (string): the name of the file containing
the list of words to load
Returns: a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word list, this function may
take a while to finish.
'''
print("Loading word list from file...")
# inFile: file
inFile = open(file_name, 'r')
# wordlist: list of strings
wordlist = []
for line in inFile:
wordlist.extend([word.lower() for word in line.split(' ')])
print(" ", len(wordlist), "words loaded.")
return wordlist
def is_word(word_list, word):
'''
Determines if word is a valid word, ignoring
capitalization and punctuation
word_list (list): list of words in the dictionary.
word (string): a possible word.
Returns: True if word is in word_list, False otherwise
Example:
>>> is_word(word_list, 'bat') returns
True
>>> is_word(word_list, 'asdf') returns
False
'''
word = word.lower()
word = word.strip(" !@#$%^&*()-_+={}[]|\\:;'<>?,./\"")
return word in word_list
### END HELPER CODE ###
WORDLIST_FILENAME = 'words.txt'
# you may find these constants helpful
VOWELS_LOWER = 'aeiou'
VOWELS_UPPER = 'AEIOU'
CONSONANTS_LOWER = 'bcdfghjklmnpqrstvwxyz'
CONSONANTS_UPPER = 'BCDFGHJKLMNPQRSTVWXYZ'
class SubMessage(object):
def __init__(self, text):
'''
Initializes a SubMessage object
text (string): the message's text
A SubMessage object has two attributes:
self.message_text (string, determined by input text)
self.valid_words (list, determined using helper function load_words)
'''
self.__message_text = text
self.__valid_words = []
for word in text.split():
if is_word(word_list, word): self.__valid_words.append(word)
def get_message_text(self):
'''
Used to safely access self.message_text outside of the class
Returns: self.message_text
'''
return self.__message_text
def get_valid_words(self):
'''
Used to safely access a copy of self.valid_words outside of the class.
This helps you avoid accidentally mutating class attributes.
Returns: a COPY of self.valid_words
'''
return self.__valid_words
def build_transpose_dict(self, vowels_permutation):
'''
vowels_permutation (string): a string containing a permutation of vowels (a, e, i, o, u)
Creates a dictionary that can be used to apply a cipher to a letter.
The dictionary maps every uppercase and lowercase letter to an
uppercase and lowercase letter, respectively. Vowels are shuffled
according to vowels_permutation. The first letter in vowels_permutation
corresponds to a, the second to e, and so on in the order a, e, i, o, u.
The consonants remain the same. The dictionary should have 52
keys of all the uppercase letters and all the lowercase letters.
Example: When input "eaiuo":
Mapping is a->e, e->a, i->i, o->u, u->o
and "Hello World!" maps to "<NAME>!"
Returns: a dictionary mapping a letter (string) to
another letter (string).
'''
base_dict = {'A':'', 'B':'', 'C':'', 'D':'', 'E':'', 'F':'', 'G':'', 'H':'', 'I':'', 'J':'', 'K':'', 'L':'', 'M':'', 'N':'', 'O':'', 'P':'', 'Q':'', 'R':'', 'S':'', 'T':'', 'U':'', 'V':'', 'W':'', 'X':'', 'Y':'', 'Z':'','a':'', 'b':'', 'c':'', 'd':'', 'e':'', 'f':'', 'g':'', 'h':'', 'i':'', 'j':'', 'k':'', 'l':'', 'm':'', 'n':'', 'o':'', 'p':'', 'q':'', 'r':'', 's':'', 't':'', 'u':'', 'v':'', 'w':'', 'x':'', 'y':'', 'z':''}
vowels_dict = { 'A':"", 'E':"",'I':"",'O':"",'U':"",'a':"",'e':"",'i':"",'o':"",'u':""}
counter = 0
for key in vowels_dict.keys():
if key == 'a':
break
else:
vowels_dict[key] = vowels_permutation[counter].upper()
vowels_dict[key.lower()] = vowels_permutation[counter]
counter +=1
for key in base_dict.keys():
if key in vowels_dict.keys():
base_dict[key] = vowels_dict[key]
else:
base_dict[key] = key
return base_dict.copy()
def apply_transpose(self, transpose_dict):
'''
transpose_dict (dict): a transpose dictionary
Returns: an encrypted version of the message text, based
on the dictionary
'''
encrypted_text = ''
for key in self.get_message_text():
if key in string.ascii_letters:
encrypted_text+= transpose_dict[key]
else:
encrypted_text += key
return encrypted_text
class EncryptedSubMessage(SubMessage):
def __init__(self, text):
'''
Initializes an EncryptedSubMessage object
text (string): the encrypted message text
An EncryptedSubMessage object inherits from SubMessage and has two attributes:
self.message_text (string, determined by input text)
self.valid_words (list, determined using helper function load_words)
'''
SubMessage.__init__(self, text)
def decrypt_message(self):
'''
Attempt to decrypt the encrypted message
Idea is to go through each permutation of the vowels and test it
on the encrypted message. For each permutation, check how many
words in the decrypted text are valid English words, and return
the decrypted message with the most English words.
If no good permutations are found (i.e. no permutations result in
at least 1 valid word), return the original string. If there are
multiple permutations that yield the maximum number of words, return any
one of them.
Returns: the best decrypted message
Hint: use your function from Part 4A
'''
# initialize a list of possible decryptions as list_decryptions
list_decryptions = []
#create a list of all possible permutations
vowels_permutations = get_permutations(VOWELS_LOWER)
#loop through all permutation, and transpose the encrypted text according to each permutation, then check it for the number of valid words, and add to the list of possible decryptions a tuple (numer of valid words, decrypted message)
for i in vowels_permutations:
decrypted = SubMessage(self.apply_transpose(self.build_transpose_dict(i)))
words_counter = len(decrypted.get_valid_words())
list_decryptions.append((words_counter, decrypted.get_message_text()))
#sort list_decryptions
list_decryptions.sort(reverse=True)
# return the message text if there are no valid permutations, or one of the highest ranking permutation
return self.get_message_text() if list_decryptions[0][0] == 0 else list_decryptions[0][1]
pass #delete this line and replace with your code here
word_list = load_words('../words.txt')
if __name__ == '__main__':
# Example test case
message = SubMessage("Into The System!")
permutation = "eaiuo"
enc_dict = message.build_transpose_dict(permutation)
print("Original message:", message.get_message_text(), "Permutation:", permutation)
print("Expected encryption:", "Intu tha systam!")
print("Actual encryption:", message.apply_transpose(enc_dict))
enc_message = EncryptedSubMessage(message.apply_transpose(enc_dict))
print("Decrypted message:", enc_message.decrypt_message())
#TODO: WRITE YOUR TEST CASES HERE | [
1,
396,
11583,
3789,
29871,
29946,
29907,
13,
29937,
4408,
29901,
529,
5813,
29958,
13,
29937,
13435,
3717,
4097,
29901,
13,
29937,
7370,
29901,
29871,
29906,
29955,
29889,
29896,
29906,
29889,
29906,
29900,
29906,
29900,
29871,
29896,
29946,
29901,
29945,
29900,
13,
29937,
2796,
29901,
29871,
29906,
29929,
29889,
29896,
29906,
29889,
29906,
29900,
29906,
29900,
29871,
29896,
29947,
29901,
29896,
29945,
13,
29937,
11346,
14740,
4035,
3728,
1602,
4641,
29918,
4906,
580,
3639,
3838,
393,
526,
451,
12695,
278,
2441,
29892,
2466,
896,
526,
2854,
13,
29937,
1763,
1065,
5190,
6987,
29892,
1134,
11451,
1688,
297,
278,
8638,
13,
13,
5215,
1347,
13,
3166,
6529,
29946,
29874,
1053,
679,
29918,
546,
6149,
800,
13,
13,
2277,
29937,
379,
6670,
13171,
4810,
2287,
835,
13,
1753,
2254,
29918,
9303,
29898,
1445,
29918,
978,
1125,
13,
1678,
14550,
13,
1678,
934,
29918,
978,
313,
1807,
1125,
278,
1024,
310,
278,
934,
6943,
29871,
13,
1678,
278,
1051,
310,
3838,
304,
2254,
268,
13,
268,
13,
1678,
16969,
29901,
263,
1051,
310,
2854,
3838,
29889,
399,
4339,
526,
6031,
310,
5224,
4878,
8721,
29889,
13,
268,
13,
1678,
28277,
373,
278,
2159,
310,
278,
1734,
1051,
29892,
445,
740,
1122,
13,
1678,
2125,
263,
1550,
304,
8341,
29889,
13,
1678,
14550,
13,
268,
13,
1678,
1596,
703,
23456,
1734,
1051,
515,
934,
856,
1159,
13,
1678,
396,
297,
2283,
29901,
934,
13,
1678,
297,
2283,
353,
1722,
29898,
1445,
29918,
978,
29892,
525,
29878,
1495,
13,
1678,
396,
1734,
1761,
29901,
1051,
310,
6031,
13,
1678,
1734,
1761,
353,
5159,
13,
1678,
363,
1196,
297,
297,
2283,
29901,
13,
4706,
1734,
1761,
29889,
21843,
4197,
1742,
29889,
13609,
580,
363,
1734,
297,
1196,
29889,
5451,
877,
25710,
2314,
13,
1678,
1596,
703,
29871,
9162,
7431,
29898,
1742,
1761,
511,
376,
9303,
7500,
23157,
13,
1678,
736,
1734,
1761,
13,
13,
1753,
338,
29918,
1742,
29898,
1742,
29918,
1761,
29892,
1734,
1125,
13,
1678,
14550,
13,
1678,
5953,
837,
1475,
565,
1734,
338,
263,
2854,
1734,
29892,
5330,
8253,
13,
1678,
7483,
2133,
322,
6035,
22999,
362,
13,
13,
1678,
1734,
29918,
1761,
313,
1761,
1125,
1051,
310,
3838,
297,
278,
8600,
29889,
13,
1678,
1734,
313,
1807,
1125,
263,
1950,
1734,
29889,
13,
268,
13,
1678,
16969,
29901,
5852,
565,
1734,
338,
297,
1734,
29918,
1761,
29892,
7700,
6467,
13,
13,
1678,
8741,
29901,
13,
1678,
8653,
338,
29918,
1742,
29898,
1742,
29918,
1761,
29892,
525,
10222,
1495,
3639,
13,
1678,
5852,
13,
1678,
8653,
338,
29918,
1742,
29898,
1742,
29918,
1761,
29892,
525,
294,
2176,
1495,
3639,
13,
1678,
7700,
13,
1678,
14550,
13,
1678,
1734,
353,
1734,
29889,
13609,
580,
13,
1678,
1734,
353,
1734,
29889,
17010,
703,
1738,
29992,
29937,
29938,
29995,
29985,
29987,
29930,
580,
29899,
28842,
3790,
29913,
2636,
29989,
1966,
29901,
29936,
29915,
25299,
14579,
6904,
5931,
1159,
13,
1678,
736,
1734,
297,
1734,
29918,
1761,
13,
13,
13,
2277,
29937,
11056,
379,
6670,
13171,
4810,
2287,
835,
13,
13,
17013,
24360,
29918,
7724,
5813,
353,
525,
9303,
29889,
3945,
29915,
13,
13,
29937,
366,
1122,
1284,
1438,
17727,
8444,
13,
29963,
9806,
6670,
29903,
29918,
27998,
1001,
353,
525,
3660,
29875,
283,
29915,
13,
29963,
9806,
6670,
29903,
29918,
4897,
13171,
353,
525,
16036,
5971,
29965,
29915,
13,
6007,
3094,
2190,
9375,
29918,
27998,
1001,
353,
525,
12328,
2176,
12443,
29926,
6321,
29885,
9302,
29939,
29878,
303,
29894,
29893,
20230,
29915,
13,
6007,
3094,
2190,
9375,
29918,
4897,
13171,
353,
525,
5371,
4037,
29954,
29950,
29967,
29968,
26369,
25500,
29984,
29934,
1254,
29963,
29956,
18454,
29999,
29915,
13,
13,
1990,
3323,
3728,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1426,
1125,
13,
4706,
14550,
13,
4706,
17250,
7093,
263,
3323,
3728,
1203,
13,
462,
13,
4706,
1426,
313,
1807,
1125,
278,
2643,
29915,
29879,
1426,
13,
13,
4706,
319,
3323,
3728,
1203,
756,
1023,
8393,
29901,
13,
9651,
1583,
29889,
4906,
29918,
726,
313,
1807,
29892,
10087,
491,
1881,
1426,
29897,
13,
9651,
1583,
29889,
3084,
29918,
9303,
313,
1761,
29892,
10087,
773,
16876,
740,
2254,
29918,
9303,
29897,
13,
4706,
14550,
13,
4706,
1583,
17255,
4906,
29918,
726,
353,
1426,
13,
4706,
1583,
17255,
3084,
29918,
9303,
353,
5159,
13,
4706,
363,
1734,
297,
1426,
29889,
5451,
7295,
13,
9651,
565,
338,
29918,
1742,
29898,
1742,
29918,
1761,
29892,
1734,
1125,
1583,
17255,
3084,
29918,
9303,
29889,
4397,
29898,
1742,
29897,
13,
268,
13,
1678,
822,
679,
29918,
4906,
29918,
726,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
501,
8485,
304,
23511,
2130,
1583,
29889,
4906,
29918,
726,
5377,
310,
278,
770,
13,
308,
13,
4706,
16969,
29901,
1583,
29889,
4906,
29918,
726,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
4906,
29918,
726,
13,
13,
1678,
822,
679,
29918,
3084,
29918,
9303,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
501,
8485,
304,
23511,
2130,
263,
3509,
310,
1583,
29889,
3084,
29918,
9303,
5377,
310,
278,
770,
29889,
13,
4706,
910,
6911,
366,
4772,
11423,
635,
5478,
1218,
770,
8393,
29889,
13,
308,
13,
4706,
16969,
29901,
263,
315,
4590,
29979,
310,
1583,
29889,
3084,
29918,
9303,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
3084,
29918,
9303,
13,
13,
1678,
822,
2048,
29918,
3286,
4220,
29918,
8977,
29898,
1311,
29892,
325,
340,
1379,
29918,
546,
6149,
362,
1125,
13,
4706,
14550,
13,
4706,
325,
340,
1379,
29918,
546,
6149,
362,
313,
1807,
1125,
263,
1347,
6943,
263,
20005,
362,
310,
325,
340,
1379,
313,
29874,
29892,
321,
29892,
474,
29892,
288,
29892,
318,
29897,
13,
308,
13,
4706,
6760,
1078,
263,
8600,
393,
508,
367,
1304,
304,
3394,
263,
4583,
8096,
304,
263,
5497,
29889,
13,
4706,
450,
8600,
11053,
1432,
7568,
4878,
322,
5224,
4878,
5497,
304,
385,
13,
4706,
7568,
4878,
322,
5224,
4878,
5497,
29892,
8307,
29889,
478,
340,
1379,
526,
528,
3096,
839,
29871,
13,
4706,
5034,
304,
325,
340,
1379,
29918,
546,
6149,
362,
29889,
450,
937,
5497,
297,
325,
340,
1379,
29918,
546,
6149,
362,
29871,
13,
4706,
16161,
304,
263,
29892,
278,
1473,
304,
321,
29892,
322,
577,
373,
297,
278,
1797,
263,
29892,
321,
29892,
474,
29892,
288,
29892,
318,
29889,
13,
4706,
450,
378,
1100,
1934,
3933,
278,
1021,
29889,
450,
8600,
881,
505,
29871,
29945,
29906,
29871,
13,
4706,
6611,
310,
599,
278,
7568,
4878,
8721,
322,
599,
278,
5224,
4878,
8721,
29889,
13,
13,
4706,
8741,
29901,
1932,
1881,
376,
29872,
1794,
25608,
1115,
13,
4706,
341,
20304,
338,
263,
976,
29872,
29892,
321,
976,
29874,
29892,
474,
976,
29875,
29892,
288,
976,
29884,
29892,
318,
976,
29877,
13,
4706,
322,
376,
10994,
2787,
3850,
11053,
304,
9872,
5813,
29958,
3850,
13,
13,
4706,
16969,
29901,
263,
8600,
10417,
263,
5497,
313,
1807,
29897,
304,
29871,
13,
462,
1790,
5497,
313,
1807,
467,
29871,
13,
4706,
14550,
13,
4706,
2967,
29918,
8977,
353,
11117,
29909,
22099,
742,
525,
29933,
22099,
742,
525,
29907,
22099,
742,
525,
29928,
22099,
742,
525,
29923,
22099,
742,
525,
29943,
22099,
742,
525,
29954,
22099,
742,
525,
29950,
22099,
742,
525,
29902,
22099,
742,
525,
29967,
22099,
742,
525,
29968,
22099,
742,
525,
29931,
22099,
742,
525,
29924,
22099,
742,
525,
29940,
22099,
742,
525,
29949,
22099,
742,
525,
29925,
22099,
742,
525,
29984,
22099,
742,
525,
29934,
22099,
742,
525,
29903,
22099,
742,
525,
29911,
22099,
742,
525,
29965,
22099,
742,
525,
29963,
22099,
742,
525,
29956,
22099,
742,
525,
29990,
22099,
742,
525,
29979,
22099,
742,
525,
29999,
22099,
3788,
29874,
22099,
742,
525,
29890,
22099,
742,
525,
29883,
22099,
742,
525,
29881,
22099,
742,
525,
29872,
22099,
742,
525,
29888,
22099,
742,
525,
29887,
22099,
742,
525,
29882,
22099,
742,
525,
29875,
22099,
742,
525,
29926,
22099,
742,
525,
29895,
22099,
742,
525,
29880,
22099,
742,
525,
29885,
22099,
742,
525,
29876,
22099,
742,
525,
29877,
22099,
742,
525,
29886,
22099,
742,
525,
29939,
22099,
742,
525,
29878,
22099,
742,
525,
29879,
22099,
742,
525,
29873,
22099,
742,
525,
29884,
22099,
742,
525,
29894,
22099,
742,
525,
29893,
22099,
742,
525,
29916,
22099,
742,
525,
29891,
22099,
742,
525,
29920,
2396,
4907,
29913,
13,
4706,
325,
340,
1379,
29918,
8977,
29871,
353,
426,
525,
29909,
2396,
29908,
613,
525,
29923,
2396,
29908,
613,
29915,
29902,
2396,
29908,
613,
29915,
29949,
2396,
29908,
613,
29915,
29965,
2396,
29908,
613,
29915,
29874,
2396,
29908,
613,
29915,
29872,
2396,
29908,
613,
29915,
29875,
2396,
29908,
613,
29915,
29877,
2396,
29908,
613,
29915,
29884,
2396,
29908,
9092,
13,
4706,
6795,
353,
29871,
29900,
13,
4706,
363,
1820,
297,
325,
340,
1379,
29918,
8977,
29889,
8149,
7295,
13,
9651,
565,
1820,
1275,
525,
29874,
2396,
13,
18884,
2867,
13,
9651,
1683,
29901,
13,
18884,
325,
340,
1379,
29918,
8977,
29961,
1989,
29962,
353,
325,
340,
1379,
29918,
546,
6149,
362,
29961,
11808,
1822,
21064,
580,
13,
18884,
325,
340,
1379,
29918,
8977,
29961,
1989,
29889,
13609,
580,
29962,
353,
325,
340,
1379,
29918,
546,
6149,
362,
29961,
11808,
29962,
13,
18884,
6795,
4619,
29896,
13,
4706,
363,
1820,
297,
2967,
29918,
8977,
29889,
8149,
7295,
13,
9651,
565,
1820,
297,
325,
340,
1379,
29918,
8977,
29889,
8149,
7295,
13,
18884,
2967,
29918,
8977,
29961,
1989,
29962,
353,
325,
340,
1379,
29918,
8977,
29961,
1989,
29962,
13,
9651,
1683,
29901,
13,
18884,
2967,
29918,
8977,
29961,
1989,
29962,
353,
1820,
13,
4706,
736,
2967,
29918,
8977,
29889,
8552,
580,
13,
13,
1678,
822,
3394,
29918,
3286,
4220,
29898,
1311,
29892,
1301,
4220,
29918,
8977,
1125,
13,
4706,
14550,
13,
4706,
1301,
4220,
29918,
8977,
313,
8977,
1125,
263,
1301,
4220,
8600,
13,
308,
13,
4706,
16969,
29901,
385,
23220,
1873,
310,
278,
2643,
1426,
29892,
2729,
29871,
13,
4706,
373,
278,
8600,
13,
4706,
14550,
13,
4706,
23220,
29918,
726,
353,
6629,
13,
4706,
363,
1820,
297,
1583,
29889,
657,
29918,
4906,
29918,
726,
7295,
13,
9651,
565,
1820,
297,
1347,
29889,
294,
18869,
29918,
1026,
2153,
29901,
13,
18884,
23220,
29918,
726,
23661,
1301,
4220,
29918,
8977,
29961,
1989,
29962,
13,
9651,
1683,
29901,
13,
18884,
23220,
29918,
726,
4619,
1820,
13,
4706,
736,
23220,
29918,
726,
13,
308,
13,
1990,
11346,
14740,
4035,
3728,
29898,
4035,
3728,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1426,
1125,
13,
4706,
14550,
13,
4706,
17250,
7093,
385,
11346,
14740,
4035,
3728,
1203,
13,
13,
4706,
1426,
313,
1807,
1125,
278,
23220,
2643,
1426,
13,
13,
4706,
530,
11346,
14740,
4035,
3728,
1203,
7846,
1169,
515,
3323,
3728,
322,
756,
1023,
8393,
29901,
13,
9651,
1583,
29889,
4906,
29918,
726,
313,
1807,
29892,
10087,
491,
1881,
1426,
29897,
13,
9651,
1583,
29889,
3084,
29918,
9303,
313,
1761,
29892,
10087,
773,
16876,
740,
2254,
29918,
9303,
29897,
13,
4706,
14550,
13,
4706,
3323,
3728,
17255,
2344,
12035,
1311,
29892,
1426,
29897,
13,
13,
1678,
822,
1602,
4641,
29918,
4906,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
6212,
3456,
304,
1602,
4641,
278,
23220,
2643,
29871,
13,
308,
13,
4706,
13001,
29874,
338,
304,
748,
1549,
1269,
20005,
362,
310,
278,
325,
340,
1379,
322,
1243,
372,
13,
4706,
373,
278,
23220,
2643,
29889,
1152,
1269,
20005,
362,
29892,
1423,
920,
1784,
13,
4706,
3838,
297,
278,
1602,
14740,
1426,
526,
2854,
4223,
3838,
29892,
322,
736,
13,
4706,
278,
1602,
14740,
2643,
411,
278,
1556,
4223,
3838,
29889,
13,
308,
13,
4706,
960,
694,
1781,
20005,
800,
526,
1476,
313,
29875,
29889,
29872,
29889,
694,
20005,
800,
1121,
297,
29871,
13,
4706,
472,
3203,
29871,
29896,
2854,
1734,
511,
736,
278,
2441,
1347,
29889,
960,
727,
526,
13,
4706,
2999,
20005,
800,
393,
7709,
278,
7472,
1353,
310,
3838,
29892,
736,
738,
13,
4706,
697,
310,
963,
29889,
13,
13,
4706,
16969,
29901,
278,
1900,
1602,
14740,
2643,
268,
13,
308,
13,
4706,
379,
524,
29901,
671,
596,
740,
515,
3455,
29871,
29946,
29909,
13,
4706,
14550,
13,
4706,
396,
11905,
263,
1051,
310,
1950,
1602,
719,
1980,
408,
1051,
29918,
7099,
719,
1980,
13,
4706,
1051,
29918,
7099,
719,
1980,
353,
5159,
13,
4706,
396,
3258,
263,
1051,
310,
599,
1950,
20005,
800,
13,
4706,
325,
340,
1379,
29918,
546,
6149,
800,
353,
679,
29918,
546,
6149,
800,
29898,
29963,
9806,
6670,
29903,
29918,
27998,
1001,
29897,
13,
4706,
396,
7888,
1549,
599,
20005,
362,
29892,
322,
1301,
4220,
278,
23220,
1426,
5034,
304,
1269,
20005,
362,
29892,
769,
1423,
372,
363,
278,
1353,
310,
2854,
3838,
29892,
322,
788,
304,
278,
1051,
310,
1950,
1602,
719,
1980,
263,
18761,
313,
8058,
310,
2854,
3838,
29892,
1602,
14740,
2643,
29897,
13,
4706,
363,
474,
297,
325,
340,
1379,
29918,
546,
6149,
800,
29901,
13,
9651,
1602,
14740,
353,
3323,
3728,
29898,
1311,
29889,
7302,
29918,
3286,
4220,
29898,
1311,
29889,
4282,
29918,
3286,
4220,
29918,
8977,
29898,
29875,
4961,
13,
9651,
3838,
29918,
11808,
353,
7431,
29898,
7099,
14740,
29889,
657,
29918,
3084,
29918,
9303,
3101,
13,
9651,
1051,
29918,
7099,
719,
1980,
29889,
4397,
3552,
9303,
29918,
11808,
29892,
1602,
14740,
29889,
657,
29918,
4906,
29918,
726,
22130,
13,
4706,
396,
6605,
1051,
29918,
7099,
719,
1980,
13,
4706,
1051,
29918,
7099,
719,
1980,
29889,
6605,
29898,
24244,
29922,
5574,
29897,
13,
4706,
396,
736,
278,
2643,
1426,
565,
727,
526,
694,
2854,
20005,
800,
29892,
470,
697,
310,
278,
9939,
24034,
20005,
362,
13,
4706,
736,
1583,
29889,
657,
29918,
4906,
29918,
726,
580,
565,
1051,
29918,
7099,
719,
1980,
29961,
29900,
3816,
29900,
29962,
1275,
29871,
29900,
1683,
1051,
29918,
7099,
719,
1980,
29961,
29900,
3816,
29896,
29962,
13,
4706,
1209,
396,
8143,
445,
1196,
322,
5191,
411,
596,
775,
1244,
13,
268,
13,
13,
1742,
29918,
1761,
353,
2254,
29918,
9303,
877,
6995,
9303,
29889,
3945,
1495,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
396,
8741,
1243,
1206,
13,
1678,
2643,
353,
3323,
3728,
703,
797,
517,
450,
2184,
29991,
1159,
13,
1678,
20005,
362,
353,
376,
29872,
1794,
25608,
29908,
13,
1678,
2094,
29918,
8977,
353,
2643,
29889,
4282,
29918,
3286,
4220,
29918,
8977,
29898,
546,
6149,
362,
29897,
13,
1678,
1596,
703,
26036,
2643,
29901,
613,
2643,
29889,
657,
29918,
4906,
29918,
726,
3285,
376,
15737,
329,
362,
29901,
613,
20005,
362,
29897,
13,
1678,
1596,
703,
1252,
6021,
20956,
29901,
613,
376,
2928,
29884,
266,
29874,
13107,
314,
29991,
1159,
13,
1678,
1596,
703,
2865,
950,
20956,
29901,
613,
2643,
29889,
7302,
29918,
3286,
4220,
29898,
3977,
29918,
8977,
876,
13,
1678,
2094,
29918,
4906,
353,
11346,
14740,
4035,
3728,
29898,
4906,
29889,
7302,
29918,
3286,
4220,
29898,
3977,
29918,
8977,
876,
13,
1678,
1596,
703,
6185,
14740,
2643,
29901,
613,
2094,
29918,
4906,
29889,
7099,
4641,
29918,
4906,
3101,
13,
418,
13,
1678,
396,
4986,
3970,
29901,
399,
29934,
9094,
612,
22970,
17067,
1254,
29134,
29903,
379,
27267,
2
] |
Lesson3/symmetric_square.py | Hayderhasan/Computer-Science-cs101 | 4 | 137237 | <gh_stars>1-10
# A list is symmetric if the first row is the same as the first column,
# the second row is the same as the second column and so on. Write a
# procedure, symmetric, which takes a list as input, and returns the
# boolean True if the list is symmetric and False if it is not.
def symmetric(lista):
if lista == []:
return True
if len(lista) != len(lista[0]):
return False
else:
i = 0
while len(lista) > i:
j = 0
while len(lista) > j:
if lista[i][j] != lista[j][i]:
return False
j += 1
i += 1
return True
print symmetric([[1, 2, 3],
[2, 3, 4],
[3, 4, 1]])
#>>> True
print symmetric([["cat", "dog", "fish"],
["dog", "dog", "fish"],
["fish", "fish", "cat"]])
#>>> True
print symmetric([["cat", "dog", "fish"],
["dog", "dog", "dog"],
["fish","fish","cat"]])
#>>> False
print symmetric([[1, 2],
[2, 1]])
#>>> True
print symmetric([[1, 2, 3, 4],
[2, 3, 4, 5],
[3, 4, 5, 6]])
#>>> False
print symmetric([[1,2,3],
[2,3,1]])
#>>> False
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
319,
1051,
338,
18348,
565,
278,
937,
1948,
338,
278,
1021,
408,
278,
937,
1897,
29892,
13,
29937,
278,
1473,
1948,
338,
278,
1021,
408,
278,
1473,
1897,
322,
577,
373,
29889,
14350,
263,
13,
29937,
8792,
29892,
18348,
29892,
607,
4893,
263,
1051,
408,
1881,
29892,
322,
3639,
278,
13,
29937,
7223,
5852,
565,
278,
1051,
338,
18348,
322,
7700,
565,
372,
338,
451,
29889,
13,
1753,
18348,
29898,
19641,
1125,
13,
1678,
565,
15023,
1275,
5159,
29901,
13,
4706,
736,
5852,
13,
268,
13,
1678,
565,
7431,
29898,
19641,
29897,
2804,
7431,
29898,
19641,
29961,
29900,
29962,
1125,
13,
4706,
736,
7700,
13,
1678,
1683,
29901,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
1550,
7431,
29898,
19641,
29897,
1405,
474,
29901,
13,
9651,
432,
353,
29871,
29900,
13,
9651,
1550,
7431,
29898,
19641,
29897,
1405,
432,
29901,
29871,
13,
18884,
565,
15023,
29961,
29875,
3816,
29926,
29962,
2804,
15023,
29961,
29926,
3816,
29875,
5387,
13,
462,
1678,
736,
7700,
13,
18884,
432,
4619,
29871,
29896,
13,
9651,
474,
4619,
29871,
29896,
308,
13,
4706,
736,
5852,
13,
13,
13,
2158,
18348,
4197,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
13,
18884,
518,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
1402,
13,
18884,
518,
29941,
29892,
29871,
29946,
29892,
29871,
29896,
24960,
13,
29937,
6778,
29958,
5852,
13,
13,
2158,
18348,
4197,
3366,
4117,
613,
376,
26169,
613,
376,
15161,
12436,
13,
18884,
6796,
26169,
613,
376,
26169,
613,
376,
15161,
12436,
13,
18884,
6796,
15161,
613,
376,
15161,
613,
376,
4117,
3108,
2314,
13,
29937,
6778,
29958,
5852,
13,
13,
2158,
18348,
4197,
3366,
4117,
613,
376,
26169,
613,
376,
15161,
12436,
13,
18884,
6796,
26169,
613,
376,
26169,
613,
376,
26169,
12436,
13,
18884,
6796,
15161,
3284,
15161,
3284,
4117,
3108,
2314,
13,
29937,
6778,
29958,
7700,
13,
13,
2158,
18348,
4197,
29961,
29896,
29892,
29871,
29906,
1402,
13,
18884,
518,
29906,
29892,
29871,
29896,
24960,
13,
29937,
6778,
29958,
5852,
13,
13,
2158,
18348,
4197,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
1402,
13,
18884,
518,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
1402,
13,
18884,
518,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
24960,
13,
29937,
6778,
29958,
7700,
13,
13,
2158,
18348,
4197,
29961,
29896,
29892,
29906,
29892,
29941,
1402,
13,
462,
518,
29906,
29892,
29941,
29892,
29896,
24960,
13,
29937,
6778,
29958,
7700,
13,
2
] |
python/cugraph/ktruss/ktruss_max.py | ogreen/cugraph | 0 | 98129 | <reponame>ogreen/cugraph<gh_stars>0
# Copyright (c) 2019, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from cugraph.ktruss import ktruss_max_wrapper
def ktruss_max(G):
"""
Finds the maximal k-truss of a graph.
The k-truss of a graph is subgraph where each edge is part of at least
(k−2) triangles. The maximal k-truss in a graph, denoted by
k=k_max is the largest k-truss in the graph where the set of satisfying
edges is not empty. k-trusses are used for finding tighlty knit groups of
vertices in a graph.
A k-truss is a relaxation of a k-clique in the graph and was define in
[1]. Finding cliques is computationally demanding and finding the maximal
k-clique is known to be NP-Hard.
In contrast, finding a k-truss is computationally tractable as its
key building block, namely triangle counting counting, can be
executed in polnymomial time. Typically, it takes many iterations of
triangle counting to find the k-truss of a graph.
Yet these iterations operate on a weakly monotonically shrinking graph.
Therefore, finding the k-truss of a graph can be done in a fairly
reasonable amount of time.
The solution in cuGraph is based on a GPU algorithm first shown
in [2] and uses the triangle counting algoritm from [3].
[1] <NAME>.,
"Trusses: Cohesive subgraphs for social network analysis"
National security agency technical report, 2008
[2] <NAME>, <NAME>, <NAME>, <NAME>, et al.
“Quickly Finding a Truss in a Haystack”
IEEE High Performance Extreme Computing Conference (HPEC), 2017
https://doi.org/10.1109/HPEC.2017.8091038
[3] <NAME>, <NAME>, <NAME>,
“Fast Triangle Counting on GPU”
Irregular Applications: Architectures and Algorithms (IA3), 2014
Parameters
----------
G : cuGraph.Graph
cuGraph graph descriptor with connectivity information. k-Trusses are
defined for only undirected graphs as they are defined for
undirected triangle in a graph.
Returns
-------
k_max : int
The largest k in the graph s.t. a non-empty k-truss in the
graph exists.
Examples
--------
>>> M = cudf.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> sources = cudf.Series(M['0'])
>>> destinations = cudf.Series(M['1'])
>>> G = cugraph.Graph()
>>> G.add_edge_list(sources, destinations, None)
>>> k_max = cugraph.ktruss_max(G)
"""
k_max = ktruss_max_wrapper.ktruss_max(G)
return k_max
| [
1,
529,
276,
1112,
420,
29958,
468,
2733,
29914,
29883,
688,
1140,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29929,
29892,
405,
13044,
10764,
315,
1955,
29925,
1955,
8098,
29889,
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,
268,
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,
274,
688,
1140,
29889,
12947,
1558,
1053,
413,
509,
1558,
29918,
3317,
29918,
17699,
13,
13,
13,
1753,
413,
509,
1558,
29918,
3317,
29898,
29954,
1125,
13,
1678,
9995,
13,
1678,
10987,
29879,
278,
23183,
413,
29899,
509,
1558,
310,
263,
3983,
29889,
13,
13,
1678,
450,
413,
29899,
509,
1558,
310,
263,
3983,
338,
1014,
4262,
988,
1269,
7636,
338,
760,
29871,
310,
29871,
472,
3203,
13,
1678,
313,
29895,
30120,
29906,
29897,
3367,
19536,
29889,
450,
23183,
413,
29899,
509,
1558,
297,
263,
3983,
29892,
27291,
491,
13,
1678,
413,
29922,
29895,
29918,
3317,
338,
278,
10150,
413,
29899,
509,
1558,
297,
278,
3983,
988,
278,
731,
310,
24064,
13,
1678,
12770,
338,
451,
4069,
29889,
413,
29899,
509,
1558,
267,
526,
1304,
363,
9138,
260,
1141,
29880,
1017,
889,
277,
6471,
310,
13,
1678,
13791,
297,
263,
3983,
29889,
13,
1678,
319,
413,
29899,
509,
1558,
338,
263,
26681,
362,
310,
263,
413,
29899,
29883,
9854,
297,
278,
3983,
322,
471,
4529,
297,
13,
1678,
518,
29896,
1822,
383,
4015,
9335,
1912,
338,
16287,
635,
9667,
292,
322,
9138,
278,
23183,
13,
1678,
413,
29899,
29883,
9854,
338,
2998,
304,
367,
405,
29925,
29899,
29950,
538,
29889,
13,
13,
1678,
512,
12814,
29892,
9138,
263,
413,
29899,
509,
1558,
338,
16287,
635,
22330,
519,
408,
967,
13,
1678,
1820,
5214,
2908,
29892,
18451,
17205,
21248,
21248,
29892,
508,
367,
13,
1678,
8283,
297,
1248,
9574,
7615,
931,
29889,
14213,
1711,
29892,
372,
4893,
1784,
24372,
310,
13,
1678,
17205,
21248,
304,
1284,
278,
413,
29899,
509,
1558,
310,
263,
3983,
29889,
13,
1678,
15175,
1438,
24372,
21994,
373,
263,
8062,
368,
21196,
265,
1711,
14653,
18159,
3983,
29889,
13,
1678,
7857,
29892,
9138,
278,
413,
29899,
509,
1558,
310,
263,
3983,
508,
367,
2309,
297,
263,
12558,
13,
1678,
15590,
5253,
310,
931,
29889,
13,
1678,
450,
1650,
297,
2723,
9527,
338,
2729,
373,
263,
22796,
5687,
937,
4318,
13,
1678,
297,
518,
29906,
29962,
322,
3913,
278,
17205,
21248,
3093,
272,
277,
29885,
515,
518,
29941,
1822,
13,
13,
1678,
518,
29896,
29962,
529,
5813,
29958,
1696,
13,
1678,
376,
2308,
1558,
267,
29901,
315,
1148,
267,
573,
1014,
4262,
29879,
363,
5264,
3564,
7418,
29908,
13,
1678,
3086,
6993,
946,
3819,
16905,
3461,
29892,
29871,
29906,
29900,
29900,
29947,
13,
13,
1678,
518,
29906,
29962,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
634,
394,
29889,
13,
1678,
1346,
2182,
860,
368,
383,
4015,
263,
1605,
1558,
297,
263,
11389,
1429,
30024,
13,
1678,
7159,
17896,
5057,
23768,
7338,
10291,
11796,
292,
16377,
313,
3954,
11206,
511,
29871,
29906,
29900,
29896,
29955,
13,
1678,
2045,
597,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
3954,
11206,
29889,
29906,
29900,
29896,
29955,
29889,
29947,
29900,
29929,
29896,
29900,
29941,
29947,
13,
13,
1678,
518,
29941,
29962,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
10202,
13,
1678,
1346,
29943,
579,
8602,
2521,
3917,
292,
373,
22796,
30024,
13,
1678,
6600,
15227,
2401,
5795,
29901,
2595,
4496,
1973,
322,
11545,
12404,
313,
10764,
29941,
511,
29871,
29906,
29900,
29896,
29946,
13,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
402,
584,
2723,
9527,
29889,
9527,
13,
4706,
2723,
9527,
3983,
553,
11709,
411,
4511,
2068,
2472,
29889,
413,
29899,
2308,
1558,
267,
526,
13,
4706,
3342,
363,
871,
563,
1088,
287,
18445,
408,
896,
526,
3342,
363,
13,
4706,
563,
1088,
287,
17205,
297,
263,
3983,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
413,
29918,
3317,
584,
938,
13,
4706,
450,
10150,
413,
297,
278,
3983,
269,
29889,
29873,
29889,
263,
1661,
29899,
6310,
413,
29899,
509,
1558,
297,
278,
13,
4706,
3983,
4864,
29889,
13,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
8653,
341,
353,
274,
566,
29888,
29889,
949,
29918,
7638,
877,
14538,
1691,
29914,
5689,
403,
29889,
7638,
742,
28552,
2433,
13420,
13,
1678,
8653,
462,
259,
26688,
29922,
1839,
524,
29941,
29906,
742,
525,
524,
29941,
29906,
742,
525,
7411,
29941,
29906,
7464,
4839,
29922,
8516,
29897,
13,
1678,
8653,
8974,
353,
274,
566,
29888,
29889,
19204,
29898,
29924,
1839,
29900,
11287,
13,
1678,
8653,
15422,
800,
353,
274,
566,
29888,
29889,
19204,
29898,
29924,
1839,
29896,
11287,
13,
1678,
8653,
402,
353,
274,
688,
1140,
29889,
9527,
580,
13,
1678,
8653,
402,
29889,
1202,
29918,
12864,
29918,
1761,
29898,
29879,
2863,
29892,
15422,
800,
29892,
6213,
29897,
13,
1678,
8653,
413,
29918,
3317,
353,
274,
688,
1140,
29889,
12947,
1558,
29918,
3317,
29898,
29954,
29897,
13,
1678,
9995,
13,
13,
1678,
413,
29918,
3317,
353,
413,
509,
1558,
29918,
3317,
29918,
17699,
29889,
12947,
1558,
29918,
3317,
29898,
29954,
29897,
13,
13,
1678,
736,
413,
29918,
3317,
13,
2
] |
xfel/ui/components/timeit.py | dperl-sol/cctbx_project | 155 | 100399 | <filename>xfel/ui/components/timeit.py
from __future__ import absolute_import, division, print_function
import time, math
def now():
return "%02d:%02d:%02d" % (time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)
def duration(t1, t2):
diff = t2 - t1
seconds = int(math.floor(diff))
frac = diff - seconds
hh = seconds // 3600
mm = seconds // 60
if hh > 0:
mm = mm % 60
ss = seconds % 60
return "%02dh %02dm %fs" % (hh, mm, ss + frac)
| [
1,
529,
9507,
29958,
29916,
13287,
29914,
1481,
29914,
14036,
29914,
2230,
277,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
13,
13,
5215,
931,
29892,
5844,
13,
13,
1753,
1286,
7295,
13,
29871,
736,
11860,
29900,
29906,
29881,
16664,
29900,
29906,
29881,
16664,
29900,
29906,
29881,
29908,
1273,
313,
2230,
29889,
2997,
2230,
2141,
18276,
29918,
18721,
29892,
931,
29889,
2997,
2230,
2141,
18276,
29918,
1195,
29892,
931,
29889,
2997,
2230,
2141,
18276,
29918,
3471,
29897,
13,
13,
1753,
14385,
29898,
29873,
29896,
29892,
260,
29906,
1125,
13,
29871,
2923,
353,
260,
29906,
448,
260,
29896,
13,
29871,
6923,
353,
938,
29898,
755,
29889,
14939,
29898,
12765,
876,
13,
29871,
285,
945,
353,
2923,
448,
6923,
13,
29871,
298,
29882,
353,
6923,
849,
29871,
29941,
29953,
29900,
29900,
13,
29871,
5654,
353,
6923,
849,
29871,
29953,
29900,
13,
29871,
565,
298,
29882,
1405,
29871,
29900,
29901,
13,
1678,
5654,
353,
5654,
1273,
29871,
29953,
29900,
13,
29871,
17971,
353,
6923,
1273,
29871,
29953,
29900,
13,
29871,
736,
11860,
29900,
29906,
12744,
1273,
29900,
29906,
18933,
1273,
5847,
29908,
1273,
313,
25446,
29892,
5654,
29892,
17971,
718,
285,
945,
29897,
13,
13,
2
] |
pkgs/controllers.py | pine/web-redirect | 5 | 154433 | <reponame>pine/web-redirect<filename>pkgs/controllers.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from datetime import datetime
from typing import List
from aiohttp import web
from aiohttp.web import (
HTTPMovedPermanently,
HTTPNotFound,
Request,
Response,
RouteDef,
)
from pkgs.repositories import LastAccessTimeRepository
class Controller:
def __init__(self, last_access_time_repository: LastAccessTimeRepository):
self._last_access_time_repository = last_access_time_repository
def routes(self) -> List[RouteDef]:
return [
web.get('/health', self.health),
web.get('/favicon.ico', self.not_found),
web.get('/robots.txt', self.not_found),
web.get('/sitemap.xml', self.not_found),
web.get('/{path:.*}', self.redirect),
]
async def health(self, _: Request) -> Response:
return Response(
body='OK',
content_type='text/plain',
charset='utf-8',
headers={
'Cache-Control': 'private, no-cache, no-store, must-revalidate',
}
)
async def redirect(self, request: Request) -> Response:
now = datetime.now()
await self._last_access_time_repository.set(now)
path = request.match_info['path']
return HTTPMovedPermanently(
'https://emoji-gen.ninja/{}'.format(path),
headers={
'Cache-Control': 'public, max-age=10',
}
)
async def not_found(self, _: Request) -> Response:
return HTTPNotFound(
headers={
'Cache-Control': 'public, max-age=10',
}
)
| [
1,
529,
276,
1112,
420,
29958,
26215,
29914,
2676,
29899,
17886,
29966,
9507,
29958,
20571,
3174,
29914,
1285,
11897,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
8025,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
3166,
12865,
1053,
12865,
13,
3166,
19229,
1053,
2391,
13,
13,
3166,
263,
601,
1124,
1053,
1856,
13,
3166,
263,
601,
1124,
29889,
2676,
1053,
313,
13,
1678,
7331,
29924,
8238,
29925,
3504,
2705,
29892,
13,
1678,
7331,
17413,
29892,
13,
1678,
10729,
29892,
13,
1678,
13291,
29892,
13,
1678,
12034,
3206,
29892,
13,
29897,
13,
13,
3166,
282,
29895,
3174,
29889,
276,
1066,
20106,
1053,
9208,
6638,
2481,
11481,
13,
13,
13,
1990,
15830,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1833,
29918,
5943,
29918,
2230,
29918,
19033,
29901,
9208,
6638,
2481,
11481,
1125,
13,
4706,
1583,
3032,
4230,
29918,
5943,
29918,
2230,
29918,
19033,
353,
1833,
29918,
5943,
29918,
2230,
29918,
19033,
13,
13,
1678,
822,
12049,
29898,
1311,
29897,
1599,
2391,
29961,
12085,
3206,
5387,
13,
4706,
736,
518,
13,
9651,
1856,
29889,
657,
11219,
354,
4298,
742,
1583,
29889,
354,
4298,
511,
13,
9651,
1856,
29889,
657,
11219,
29888,
485,
4144,
29889,
1417,
742,
1583,
29889,
1333,
29918,
11940,
511,
13,
9651,
1856,
29889,
657,
11219,
13716,
1862,
29889,
3945,
742,
1583,
29889,
1333,
29918,
11940,
511,
13,
9651,
1856,
29889,
657,
11219,
29879,
667,
481,
29889,
3134,
742,
1583,
29889,
1333,
29918,
11940,
511,
13,
9651,
1856,
29889,
657,
11219,
29912,
2084,
29901,
29889,
4044,
742,
1583,
29889,
17886,
511,
13,
4706,
4514,
13,
13,
1678,
7465,
822,
9045,
29898,
1311,
29892,
903,
29901,
10729,
29897,
1599,
13291,
29901,
13,
4706,
736,
13291,
29898,
13,
9651,
3573,
2433,
8949,
742,
13,
9651,
2793,
29918,
1853,
2433,
726,
29914,
24595,
742,
13,
9651,
17425,
2433,
9420,
29899,
29947,
742,
13,
9651,
9066,
3790,
13,
18884,
525,
10408,
29899,
4809,
2396,
525,
9053,
29892,
694,
29899,
8173,
29892,
694,
29899,
8899,
29892,
1818,
29899,
276,
15480,
742,
13,
9651,
500,
13,
4706,
1723,
13,
13,
1678,
7465,
822,
6684,
29898,
1311,
29892,
2009,
29901,
10729,
29897,
1599,
13291,
29901,
13,
4706,
1286,
353,
12865,
29889,
3707,
580,
13,
4706,
7272,
1583,
3032,
4230,
29918,
5943,
29918,
2230,
29918,
19033,
29889,
842,
29898,
3707,
29897,
13,
13,
4706,
2224,
353,
2009,
29889,
4352,
29918,
3888,
1839,
2084,
2033,
13,
4706,
736,
7331,
29924,
8238,
29925,
3504,
2705,
29898,
13,
9651,
525,
991,
597,
15810,
2397,
29899,
1885,
29889,
29876,
262,
1764,
29914,
8875,
4286,
4830,
29898,
2084,
511,
13,
9651,
9066,
3790,
13,
18884,
525,
10408,
29899,
4809,
2396,
525,
3597,
29892,
4236,
29899,
482,
29922,
29896,
29900,
742,
13,
9651,
500,
13,
4706,
1723,
13,
13,
1678,
7465,
822,
451,
29918,
11940,
29898,
1311,
29892,
903,
29901,
10729,
29897,
1599,
13291,
29901,
13,
4706,
736,
7331,
17413,
29898,
13,
9651,
9066,
3790,
13,
18884,
525,
10408,
29899,
4809,
2396,
525,
3597,
29892,
4236,
29899,
482,
29922,
29896,
29900,
742,
13,
9651,
500,
13,
4706,
1723,
13,
2
] |
pset6/hello.py | cristiand391/cs50 | 2 | 153586 | <filename>pset6/hello.py
from cs50 import get_string
# Prompt uset for name
n = get_string("What is your name? ")
print("hello,", n)
| [
1,
529,
9507,
29958,
567,
300,
29953,
29914,
12199,
29889,
2272,
13,
3166,
5939,
29945,
29900,
1053,
679,
29918,
1807,
13,
13,
29937,
9705,
415,
502,
300,
363,
1024,
13,
29876,
353,
679,
29918,
1807,
703,
5618,
338,
596,
1024,
29973,
16521,
13,
2158,
703,
12199,
29892,
613,
302,
29897,
13,
2
] |
Chapter 11/accounts.py | nescience8/starting-out-with-python-global-4th-edition | 35 | 111368 | <reponame>nescience8/starting-out-with-python-global-4th-edition
# The SavingsAccount class represents a
# savings account.
class SavingsAccount:
# The __init__ method accepts arguments for the
# account number, interest rate, and balance.
def __init__(self, account_num, int_rate, bal):
self.__account_num = account_num
self.__interest_rate = int_rate
self.__balance = bal
# The following methods are mutators for the
# data attributes.
def set_account_num(self, account_num):
self.__account_num = account_num
def set_interest_rate(self, int_rate):
self.__interest_rate = int_rate
def set_balance(self, bal):
self.__balance = bal
# The following methods are accessors for the
# data attributes.
def get_account_num(self):
return self.__account_num
def get_interest_rate(self):
return self.__interest_rate
def get_balance(self):
return self.__balance
# The CD account represents a certificate of
# deposit (CD) account. It is a subclass of
# the SavingsAccount class.
class CD(SavingsAccount):
# The init method accepts arguments for the
# account number, interest rate, balance, and
# maturity date.
def __init__(self, account_num, int_rate, bal, mat_date):
# Call the superclass __init__ method.
SavingsAccount.__init__(self, account_num, int_rate, bal)
# Initialize the __maturity_date attribute.
self.__maturity_date = mat_date
# The set_maturity_date is a mutator for the
# __maturity_date attribute.
def set_maturity_date(self, mat_date):
self.__maturity_date = mat_date
# The get_maturity_date method is an accessor
# for the __maturity_date attribute.
def get_maturity_date(self):
return self.__maturity_date
| [
1,
529,
276,
1112,
420,
29958,
4515,
15277,
29947,
29914,
2962,
292,
29899,
449,
29899,
2541,
29899,
4691,
29899,
10945,
29899,
29946,
386,
29899,
287,
654,
13,
29937,
450,
9583,
886,
10601,
770,
11524,
263,
13,
29937,
4048,
886,
3633,
29889,
13,
13,
1990,
9583,
886,
10601,
29901,
13,
268,
13,
1678,
396,
450,
4770,
2344,
1649,
1158,
21486,
6273,
363,
278,
13,
1678,
396,
3633,
1353,
29892,
4066,
6554,
29892,
322,
17346,
29889,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3633,
29918,
1949,
29892,
938,
29918,
10492,
29892,
6411,
1125,
13,
4706,
1583,
17255,
10149,
29918,
1949,
353,
3633,
29918,
1949,
13,
4706,
1583,
17255,
1639,
342,
29918,
10492,
353,
938,
29918,
10492,
13,
4706,
1583,
17255,
5521,
749,
353,
6411,
13,
13,
1678,
396,
450,
1494,
3519,
526,
5478,
4097,
363,
278,
13,
1678,
396,
848,
8393,
29889,
13,
13,
1678,
822,
731,
29918,
10149,
29918,
1949,
29898,
1311,
29892,
3633,
29918,
1949,
1125,
13,
4706,
1583,
17255,
10149,
29918,
1949,
353,
3633,
29918,
1949,
13,
13,
1678,
822,
731,
29918,
1639,
342,
29918,
10492,
29898,
1311,
29892,
938,
29918,
10492,
1125,
13,
4706,
1583,
17255,
1639,
342,
29918,
10492,
353,
938,
29918,
10492,
13,
13,
1678,
822,
731,
29918,
5521,
749,
29898,
1311,
29892,
6411,
1125,
13,
4706,
1583,
17255,
5521,
749,
353,
6411,
13,
13,
1678,
396,
450,
1494,
3519,
526,
2130,
943,
363,
278,
13,
1678,
396,
848,
8393,
29889,
13,
13,
1678,
822,
679,
29918,
10149,
29918,
1949,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
10149,
29918,
1949,
13,
13,
1678,
822,
679,
29918,
1639,
342,
29918,
10492,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
1639,
342,
29918,
10492,
13,
13,
1678,
822,
679,
29918,
5521,
749,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
5521,
749,
13,
13,
29937,
450,
7307,
3633,
11524,
263,
12289,
310,
13,
29937,
19754,
277,
313,
6530,
29897,
3633,
29889,
739,
338,
263,
19481,
310,
13,
29937,
278,
9583,
886,
10601,
770,
29889,
13,
13,
1990,
7307,
29898,
29903,
485,
886,
10601,
1125,
13,
13,
1678,
396,
450,
2069,
1158,
21486,
6273,
363,
278,
13,
1678,
396,
3633,
1353,
29892,
4066,
6554,
29892,
17346,
29892,
322,
13,
1678,
396,
286,
1337,
537,
2635,
29889,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3633,
29918,
1949,
29892,
938,
29918,
10492,
29892,
6411,
29892,
1775,
29918,
1256,
1125,
13,
4706,
396,
8251,
278,
2428,
1990,
4770,
2344,
1649,
1158,
29889,
13,
4706,
9583,
886,
10601,
17255,
2344,
12035,
1311,
29892,
3633,
29918,
1949,
29892,
938,
29918,
10492,
29892,
6411,
29897,
13,
13,
4706,
396,
25455,
278,
4770,
29885,
1337,
537,
29918,
1256,
5352,
29889,
13,
4706,
1583,
17255,
29885,
1337,
537,
29918,
1256,
353,
1775,
29918,
1256,
13,
13,
1678,
396,
450,
731,
29918,
29885,
1337,
537,
29918,
1256,
338,
263,
5478,
1061,
363,
278,
13,
1678,
396,
4770,
29885,
1337,
537,
29918,
1256,
5352,
29889,
13,
13,
1678,
822,
731,
29918,
29885,
1337,
537,
29918,
1256,
29898,
1311,
29892,
1775,
29918,
1256,
1125,
13,
4706,
1583,
17255,
29885,
1337,
537,
29918,
1256,
353,
1775,
29918,
1256,
13,
13,
1678,
396,
450,
679,
29918,
29885,
1337,
537,
29918,
1256,
1158,
338,
385,
2130,
272,
13,
1678,
396,
363,
278,
4770,
29885,
1337,
537,
29918,
1256,
5352,
29889,
13,
13,
1678,
822,
679,
29918,
29885,
1337,
537,
29918,
1256,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
29885,
1337,
537,
29918,
1256,
13,
2
] |
supervision/apps.py | drowolath/supervision | 1 | 118628 | <filename>supervision/apps.py
#!/usr/bin/env python
#encoding: utf-8
"""
Celery apps definitions
"""
from celery import Celery
from celery.schedules import crontab
from datetime import timedelta
from . import CAMERAS
__all__ = [
'cameras'
]
# CONFIG = ConfigParser(allow_no_value=True)
# CONFIG.read('/etc/supervision/supervision.ini')
# CAMERAS = []
# sections_cameras = filter(lambda x: x.startswith('camera_'),
# CONFIG.sections())
# for section in sections_cameras:
# CAMERAS.append(dict(CONFIG.items(section)))
cameras = Celery(
'supervision',
broker='amqp://',
include=['supervision.tasks']
)
cameras.conf.update(
CELERY_AMQP_TASK_RESULT_EXPIRES=10,
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml'],
CELERY_TIMEZONE = 'Indian/Antananarivo',
CELERY_ENABLE_UTC = True,
CELERYBEAT_SCHEDULE = {
'download-every-2-seconds': {
'task': 'supervision.tasks.download',
'schedule': timedelta(seconds=2),
'args': (CAMERAS,),
},
'purge-every-60-seconds': {
'task': 'supervision.tasks.purge',
'schedule': crontab(),
'args': (CAMERAS,),
}
},
CELERY_ROUTES = {
'supervision.tasks.get_image': {'queue': 'download'},
'supervision.tasks.download': {'queue': 'download'},
'supervision.tasks.rm': {'queue': 'purge'},
'supervision.tasks.purge_folder': {'queue': 'purge'},
'supervision.tasks.purge': {'queue': 'purge'},
}
)
| [
1,
529,
9507,
29958,
9136,
4924,
29914,
13371,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
22331,
29901,
23616,
29899,
29947,
13,
13,
15945,
29908,
13,
29907,
295,
708,
11446,
15848,
13,
15945,
29908,
13,
13,
13,
3166,
6432,
708,
1053,
14227,
708,
13,
3166,
6432,
708,
29889,
816,
287,
2540,
1053,
2181,
609,
370,
13,
3166,
12865,
1053,
5335,
287,
2554,
13,
3166,
869,
1053,
315,
5194,
1001,
3289,
13,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
29883,
4183,
294,
29915,
13,
1678,
4514,
13,
13,
29937,
8707,
18667,
353,
12782,
11726,
29898,
9536,
29918,
1217,
29918,
1767,
29922,
5574,
29897,
13,
29937,
8707,
18667,
29889,
949,
11219,
7070,
29914,
9136,
4924,
29914,
9136,
4924,
29889,
2172,
1495,
13,
29937,
315,
5194,
1001,
3289,
353,
5159,
13,
29937,
13926,
29918,
29883,
4183,
294,
353,
4175,
29898,
2892,
921,
29901,
921,
29889,
27382,
2541,
877,
26065,
29918,
5477,
13,
29937,
462,
965,
8707,
18667,
29889,
27117,
3101,
13,
29937,
363,
4004,
297,
13926,
29918,
29883,
4183,
294,
29901,
13,
29937,
268,
315,
5194,
1001,
3289,
29889,
4397,
29898,
8977,
29898,
25903,
29889,
7076,
29898,
2042,
4961,
13,
13,
13,
29883,
4183,
294,
353,
14227,
708,
29898,
13,
1678,
525,
9136,
4924,
742,
13,
1678,
2545,
3946,
2433,
314,
29939,
29886,
597,
742,
13,
1678,
3160,
29922,
1839,
9136,
4924,
29889,
20673,
2033,
13,
1678,
1723,
13,
13,
29883,
4183,
294,
29889,
5527,
29889,
5504,
29898,
13,
1678,
315,
6670,
24422,
29918,
5194,
29984,
29925,
29918,
29911,
3289,
29968,
29918,
15989,
8647,
29918,
5746,
2227,
15989,
29922,
29896,
29900,
29892,
13,
1678,
315,
6670,
24422,
29918,
29911,
3289,
29968,
29918,
15989,
8647,
29918,
5746,
2227,
15989,
29922,
29941,
29953,
29900,
29900,
29892,
13,
1678,
315,
6670,
24422,
29918,
2477,
4741,
7982,
29918,
22412,
3919,
353,
6024,
23945,
280,
742,
525,
3126,
742,
525,
7645,
4058,
742,
525,
25162,
7464,
13,
1678,
315,
6670,
24422,
29918,
15307,
29999,
12413,
353,
525,
2568,
713,
29914,
13448,
273,
273,
279,
4243,
742,
13,
1678,
315,
6670,
24422,
29918,
1430,
6181,
29918,
26913,
353,
5852,
29892,
13,
1678,
315,
6670,
24422,
15349,
1299,
29918,
29903,
3210,
3352,
29965,
1307,
353,
426,
13,
4706,
525,
10382,
29899,
17991,
29899,
29906,
29899,
23128,
2396,
426,
13,
9651,
525,
7662,
2396,
525,
9136,
4924,
29889,
20673,
29889,
10382,
742,
13,
9651,
525,
816,
11272,
2396,
5335,
287,
2554,
29898,
23128,
29922,
29906,
511,
13,
9651,
525,
5085,
2396,
313,
29907,
5194,
1001,
3289,
29892,
511,
13,
4706,
2981,
13,
4706,
525,
15503,
479,
29899,
17991,
29899,
29953,
29900,
29899,
23128,
2396,
426,
13,
9651,
525,
7662,
2396,
525,
9136,
4924,
29889,
20673,
29889,
15503,
479,
742,
13,
9651,
525,
816,
11272,
2396,
2181,
609,
370,
3285,
13,
9651,
525,
5085,
2396,
313,
29907,
5194,
1001,
3289,
29892,
511,
13,
4706,
500,
13,
1678,
2981,
13,
1678,
315,
6670,
24422,
29918,
1672,
2692,
2890,
353,
426,
13,
4706,
525,
9136,
4924,
29889,
20673,
29889,
657,
29918,
3027,
2396,
11117,
9990,
2396,
525,
10382,
16675,
13,
4706,
525,
9136,
4924,
29889,
20673,
29889,
10382,
2396,
11117,
9990,
2396,
525,
10382,
16675,
13,
4706,
525,
9136,
4924,
29889,
20673,
29889,
1758,
2396,
11117,
9990,
2396,
525,
15503,
479,
16675,
13,
4706,
525,
9136,
4924,
29889,
20673,
29889,
15503,
479,
29918,
12083,
2396,
11117,
9990,
2396,
525,
15503,
479,
16675,
13,
4706,
525,
9136,
4924,
29889,
20673,
29889,
15503,
479,
2396,
11117,
9990,
2396,
525,
15503,
479,
16675,
13,
4706,
500,
13,
1678,
1723,
13,
2
] |
pure_sklearn/feature_extraction/__init__.py | ashetty1-m/pure-predict | 62 | 29061 | <gh_stars>10-100
"""
The :mod:`pure_sklearn.feature_extraction` module deals with feature extraction
from raw data. It currently includes methods to extract features from text.
"""
from ._dict_vectorizer import DictVectorizerPure
from . import text
__all__ = ["DictVectorizerPure", "text"]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
15945,
29908,
13,
1576,
584,
1545,
18078,
29886,
545,
29918,
808,
19668,
29889,
14394,
29918,
1062,
13857,
29952,
3883,
316,
1338,
411,
4682,
4805,
428,
13,
3166,
10650,
848,
29889,
739,
5279,
7805,
3519,
304,
6597,
5680,
515,
1426,
29889,
13,
15945,
29908,
13,
13,
3166,
869,
29918,
8977,
29918,
8111,
3950,
1053,
360,
919,
12877,
3950,
29925,
545,
13,
3166,
869,
1053,
1426,
13,
13,
1649,
497,
1649,
353,
6796,
21533,
12877,
3950,
29925,
545,
613,
376,
726,
3108,
13,
2
] |
genius_scrape_gui.py | Namdrib/Genius_Scrape | 0 | 179558 | #!/usr/bin/env python3
from tkinter import Button
from tkinter import Entry
from tkinter import Label
from tkinter import OptionMenu
from tkinter import StringVar
from tkinter import Tk
from genius_scrape import enums
from genius_scrape import genius_scrape
class GeniusScrapeGui:
def __init__(self):
"""
Declare and set Tkinter elements
"""
self.window = Tk()
self.window.title("Genius Scrape")
self.window.resizable(width=False, height=False)
self.artist_label = Label(self.window, text="Artist", width=10)
self.artist_label.grid(column=0, row=0)
self.artist_input = Entry(self.window, width=30)
self.artist_input.grid(column=1, row=0)
self.artist_input.focus()
self.item_type_options = ["SONG", "ALBUM"]
self.item_type_variable = StringVar(self.window)
self.item_type_variable.set(self.item_type_options[0])
self.item_type_dropdown = OptionMenu(
self.window, self.item_type_variable, *self.item_type_options)
self.item_type_dropdown.grid(column=0, row=1)
self.item_input = Entry(self.window, width=30)
self.item_input.grid(column=1, row=1)
self.output_options = ["STD", "FILE", "CLIP"]
self.output_variable = StringVar(self.window)
self.output_variable.set(self.output_options[0])
self.output_dropdown = OptionMenu(
self.window, self.output_variable, *self.output_options)
self.output_dropdown.grid(column=0, row=3)
self.go_button = Button(self.window, text="Go!",
command=self.get_lyrics)
self.go_button.grid(column=1, row=3)
self.window.mainloop()
def get_lyrics(self):
"""
Makes calls to the genius_scrape module
"""
# Take user input
artist = self.artist_input.get().lower()
item = self.item_input.get().lower()
# Read the options and turn them into the enum value
item_type_str = self.item_type_variable.get()
item_type = enums.ItemType[item_type_str]
output_str = self.output_variable.get()
output = enums.OutputType[output_str]
# Check the inputs have been populated
if not artist:
print("artist field must be filled in")
return
if not item:
print("{} field must be filled in".format(item_type))
return
# Retrieve lyrics
if item_type is enums.ItemType.SONG:
lyrics = genius_scrape.get_genius_lyrics_from_parts(artist, item)
genius_scrape.write_lyrics(lyrics, output)
else:
genius_scrape.get_genius_album(artist, item, output)
def main():
gsg = GeniusScrapeGui()
if __name__ == '__main__':
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
3166,
18883,
1639,
1053,
11025,
13,
3166,
18883,
1639,
1053,
28236,
13,
3166,
18883,
1639,
1053,
15796,
13,
3166,
18883,
1639,
1053,
10831,
6823,
13,
3166,
18883,
1639,
1053,
1714,
9037,
13,
3166,
18883,
1639,
1053,
323,
29895,
13,
13,
3166,
26858,
29918,
1557,
336,
412,
1053,
427,
6762,
13,
3166,
26858,
29918,
1557,
336,
412,
1053,
26858,
29918,
1557,
336,
412,
13,
13,
13,
1990,
5739,
2482,
4421,
336,
412,
28707,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
9995,
13,
4706,
3826,
8663,
322,
731,
323,
29895,
1639,
3161,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
7165,
353,
323,
29895,
580,
13,
4706,
1583,
29889,
7165,
29889,
3257,
703,
15462,
2482,
2522,
336,
412,
1159,
13,
4706,
1583,
29889,
7165,
29889,
690,
13902,
29898,
2103,
29922,
8824,
29892,
3171,
29922,
8824,
29897,
13,
13,
4706,
1583,
29889,
442,
391,
29918,
1643,
353,
15796,
29898,
1311,
29889,
7165,
29892,
1426,
543,
9986,
391,
613,
2920,
29922,
29896,
29900,
29897,
13,
4706,
1583,
29889,
442,
391,
29918,
1643,
29889,
7720,
29898,
4914,
29922,
29900,
29892,
1948,
29922,
29900,
29897,
13,
13,
4706,
1583,
29889,
442,
391,
29918,
2080,
353,
28236,
29898,
1311,
29889,
7165,
29892,
2920,
29922,
29941,
29900,
29897,
13,
4706,
1583,
29889,
442,
391,
29918,
2080,
29889,
7720,
29898,
4914,
29922,
29896,
29892,
1948,
29922,
29900,
29897,
13,
4706,
1583,
29889,
442,
391,
29918,
2080,
29889,
18037,
580,
13,
13,
4706,
1583,
29889,
667,
29918,
1853,
29918,
6768,
353,
6796,
3094,
29954,
613,
376,
1964,
29933,
5005,
3108,
13,
4706,
1583,
29889,
667,
29918,
1853,
29918,
11918,
353,
1714,
9037,
29898,
1311,
29889,
7165,
29897,
13,
4706,
1583,
29889,
667,
29918,
1853,
29918,
11918,
29889,
842,
29898,
1311,
29889,
667,
29918,
1853,
29918,
6768,
29961,
29900,
2314,
13,
4706,
1583,
29889,
667,
29918,
1853,
29918,
19305,
353,
10831,
6823,
29898,
13,
9651,
1583,
29889,
7165,
29892,
1583,
29889,
667,
29918,
1853,
29918,
11918,
29892,
334,
1311,
29889,
667,
29918,
1853,
29918,
6768,
29897,
13,
4706,
1583,
29889,
667,
29918,
1853,
29918,
19305,
29889,
7720,
29898,
4914,
29922,
29900,
29892,
1948,
29922,
29896,
29897,
13,
13,
4706,
1583,
29889,
667,
29918,
2080,
353,
28236,
29898,
1311,
29889,
7165,
29892,
2920,
29922,
29941,
29900,
29897,
13,
4706,
1583,
29889,
667,
29918,
2080,
29889,
7720,
29898,
4914,
29922,
29896,
29892,
1948,
29922,
29896,
29897,
13,
13,
4706,
1583,
29889,
4905,
29918,
6768,
353,
6796,
1254,
29928,
613,
376,
7724,
613,
376,
27205,
29925,
3108,
13,
4706,
1583,
29889,
4905,
29918,
11918,
353,
1714,
9037,
29898,
1311,
29889,
7165,
29897,
13,
4706,
1583,
29889,
4905,
29918,
11918,
29889,
842,
29898,
1311,
29889,
4905,
29918,
6768,
29961,
29900,
2314,
13,
4706,
1583,
29889,
4905,
29918,
19305,
353,
10831,
6823,
29898,
13,
9651,
1583,
29889,
7165,
29892,
1583,
29889,
4905,
29918,
11918,
29892,
334,
1311,
29889,
4905,
29918,
6768,
29897,
13,
4706,
1583,
29889,
4905,
29918,
19305,
29889,
7720,
29898,
4914,
29922,
29900,
29892,
1948,
29922,
29941,
29897,
13,
13,
4706,
1583,
29889,
1484,
29918,
3092,
353,
11025,
29898,
1311,
29889,
7165,
29892,
1426,
543,
8120,
29991,
613,
13,
462,
18884,
1899,
29922,
1311,
29889,
657,
29918,
368,
10817,
29897,
13,
4706,
1583,
29889,
1484,
29918,
3092,
29889,
7720,
29898,
4914,
29922,
29896,
29892,
1948,
29922,
29941,
29897,
13,
13,
4706,
1583,
29889,
7165,
29889,
3396,
7888,
580,
13,
13,
1678,
822,
679,
29918,
368,
10817,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
341,
6926,
5717,
304,
278,
26858,
29918,
1557,
336,
412,
3883,
13,
4706,
9995,
13,
13,
4706,
396,
11190,
1404,
1881,
13,
4706,
7664,
353,
1583,
29889,
442,
391,
29918,
2080,
29889,
657,
2141,
13609,
580,
13,
4706,
2944,
353,
1583,
29889,
667,
29918,
2080,
29889,
657,
2141,
13609,
580,
13,
13,
4706,
396,
7523,
278,
3987,
322,
2507,
963,
964,
278,
14115,
995,
13,
4706,
2944,
29918,
1853,
29918,
710,
353,
1583,
29889,
667,
29918,
1853,
29918,
11918,
29889,
657,
580,
13,
4706,
2944,
29918,
1853,
353,
427,
6762,
29889,
2001,
1542,
29961,
667,
29918,
1853,
29918,
710,
29962,
13,
4706,
1962,
29918,
710,
353,
1583,
29889,
4905,
29918,
11918,
29889,
657,
580,
13,
4706,
1962,
353,
427,
6762,
29889,
6466,
1542,
29961,
4905,
29918,
710,
29962,
13,
13,
4706,
396,
5399,
278,
10970,
505,
1063,
24146,
13,
4706,
565,
451,
7664,
29901,
13,
9651,
1596,
703,
442,
391,
1746,
1818,
367,
10423,
297,
1159,
13,
9651,
736,
13,
4706,
565,
451,
2944,
29901,
13,
9651,
1596,
703,
8875,
1746,
1818,
367,
10423,
297,
1642,
4830,
29898,
667,
29918,
1853,
876,
13,
9651,
736,
13,
13,
4706,
396,
4649,
29878,
2418,
26627,
1199,
13,
4706,
565,
2944,
29918,
1853,
338,
427,
6762,
29889,
2001,
1542,
29889,
3094,
29954,
29901,
13,
9651,
26627,
1199,
353,
26858,
29918,
1557,
336,
412,
29889,
657,
29918,
1885,
2482,
29918,
368,
10817,
29918,
3166,
29918,
20895,
29898,
442,
391,
29892,
2944,
29897,
13,
9651,
26858,
29918,
1557,
336,
412,
29889,
3539,
29918,
368,
10817,
29898,
368,
10817,
29892,
1962,
29897,
13,
4706,
1683,
29901,
13,
9651,
26858,
29918,
1557,
336,
412,
29889,
657,
29918,
1885,
2482,
29918,
10336,
29898,
442,
391,
29892,
2944,
29892,
1962,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
330,
5311,
353,
5739,
2482,
4421,
336,
412,
28707,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
files/targets/ios_framework/config/config.py | uilianries/ezored | 0 | 50226 | def run(params={}):
return {
'project_name': 'Core',
'bitcode': True,
'min_version': '9.0',
'enable_arc': True,
'enable_visibility': True,
'conan_profile': 'ezored_ios_framework_profile',
'archs': [
{'arch': 'armv7', 'conan_arch': 'armv7', 'platform': 'OS'},
{'arch': 'armv7s', 'conan_arch': 'armv7s', 'platform': 'OS'},
{'arch': 'arm64', 'conan_arch': 'armv8', 'platform': 'OS64'},
{'arch': 'arm64e', 'conan_arch': 'armv8.3', 'platform': 'OS64'},
{'arch': 'x86_64', 'conan_arch': 'x86_64', 'platform': 'SIMULATOR64'},
],
'build_types': ['Debug', 'Release'],
'install_headers': [
{
'type': 'dir',
'path': 'files/djinni/001-app-domain/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/002-app-core/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/003-app-data-services/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/004-app-system-service/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/005-app-helpers/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/datetime/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/file-helper/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/httpclient/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/shared-data/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/logger/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/djinni/string-helper/generated-src/objc',
},
{
'type': 'dir',
'path': 'files/src/file-helper/objc',
},
{
'type': 'dir',
'path': 'files/src/httpclient/objc',
},
{
'type': 'dir',
'path': 'files/src/logger/objc',
},
{
'type': 'dir',
'path': 'files/src/shared-data/objc',
},
]
}
| [
1,
822,
1065,
29898,
7529,
3790,
29913,
1125,
13,
1678,
736,
426,
13,
4706,
525,
4836,
29918,
978,
2396,
525,
9203,
742,
13,
4706,
525,
2966,
401,
2396,
5852,
29892,
13,
4706,
525,
1195,
29918,
3259,
2396,
525,
29929,
29889,
29900,
742,
13,
4706,
525,
12007,
29918,
5666,
2396,
5852,
29892,
13,
4706,
525,
12007,
29918,
28814,
2396,
5852,
29892,
13,
4706,
525,
535,
273,
29918,
10185,
2396,
525,
6096,
4395,
29918,
2363,
29918,
4468,
29918,
10185,
742,
13,
4706,
525,
1279,
29879,
2396,
518,
13,
9651,
11117,
1279,
2396,
525,
2817,
29894,
29955,
742,
525,
535,
273,
29918,
1279,
2396,
525,
2817,
29894,
29955,
742,
525,
12120,
2396,
525,
3267,
16675,
13,
9651,
11117,
1279,
2396,
525,
2817,
29894,
29955,
29879,
742,
525,
535,
273,
29918,
1279,
2396,
525,
2817,
29894,
29955,
29879,
742,
525,
12120,
2396,
525,
3267,
16675,
13,
9651,
11117,
1279,
2396,
525,
2817,
29953,
29946,
742,
525,
535,
273,
29918,
1279,
2396,
525,
2817,
29894,
29947,
742,
525,
12120,
2396,
525,
3267,
29953,
29946,
16675,
13,
9651,
11117,
1279,
2396,
525,
2817,
29953,
29946,
29872,
742,
525,
535,
273,
29918,
1279,
2396,
525,
2817,
29894,
29947,
29889,
29941,
742,
525,
12120,
2396,
525,
3267,
29953,
29946,
16675,
13,
9651,
11117,
1279,
2396,
525,
29916,
29947,
29953,
29918,
29953,
29946,
742,
525,
535,
273,
29918,
1279,
2396,
525,
29916,
29947,
29953,
29918,
29953,
29946,
742,
525,
12120,
2396,
525,
5425,
29924,
13309,
1299,
1955,
29953,
29946,
16675,
13,
4706,
21251,
13,
4706,
525,
4282,
29918,
8768,
2396,
6024,
11862,
742,
525,
19729,
7464,
13,
4706,
525,
6252,
29918,
13662,
2396,
518,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
29900,
29900,
29896,
29899,
932,
29899,
7247,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
29900,
29900,
29906,
29899,
932,
29899,
3221,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
29900,
29900,
29941,
29899,
932,
29899,
1272,
29899,
9916,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
29900,
29900,
29946,
29899,
932,
29899,
5205,
29899,
5509,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
29900,
29900,
29945,
29899,
932,
29899,
3952,
6774,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
12673,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
1445,
29899,
20907,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
1124,
4645,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
12366,
29899,
1272,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
21707,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
19776,
262,
1240,
29914,
1807,
29899,
20907,
29914,
13525,
29899,
4351,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
4351,
29914,
1445,
29899,
20907,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
4351,
29914,
1124,
4645,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
4351,
29914,
21707,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3972,
742,
13,
18884,
525,
2084,
2396,
525,
5325,
29914,
4351,
29914,
12366,
29899,
1272,
29914,
5415,
29883,
742,
13,
9651,
2981,
13,
4706,
4514,
13,
1678,
500,
13,
2
] |
pyramm/config.py | nzta-captif/pyramm | 0 | 93495 | <reponame>nzta-captif/pyramm<filename>pyramm/config.py<gh_stars>0
from pathlib import Path
from configparser import ConfigParser
CONFIG_FILE = Path.home().joinpath(".pyramm.ini")
def config():
parser = ConfigParser()
parser.read(CONFIG_FILE)
return parser
| [
1,
529,
276,
1112,
420,
29958,
29876,
29920,
941,
29899,
17885,
361,
29914,
2272,
2572,
29885,
29966,
9507,
29958,
2272,
2572,
29885,
29914,
2917,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
2295,
16680,
1053,
12782,
11726,
13,
13,
13,
25903,
29918,
7724,
353,
10802,
29889,
5184,
2141,
7122,
2084,
17350,
2272,
2572,
29885,
29889,
2172,
1159,
13,
13,
13,
1753,
2295,
7295,
13,
1678,
13812,
353,
12782,
11726,
580,
13,
1678,
13812,
29889,
949,
29898,
25903,
29918,
7724,
29897,
13,
1678,
736,
13812,
13,
2
] |
test_code/testGPIO_DIN_read.py | bauchter-work/2445_git_repo | 0 | 122299 | import Adafruit_BBIO.GPIO as GPIO
import time
GPIO.setup("P8_16",GPIO.IN)
while True:
if GPIO.input("P8_16"):
print("Pin is HIGH")
else:
print("Pin is LOW")
time.sleep(1)
| [
1,
1053,
23255,
29888,
9216,
29918,
14388,
5971,
29889,
29954,
2227,
29949,
408,
402,
2227,
29949,
13,
5215,
931,
13,
13,
29954,
2227,
29949,
29889,
14669,
703,
29925,
29947,
29918,
29896,
29953,
613,
29954,
2227,
29949,
29889,
1177,
29897,
13,
13,
8000,
5852,
29901,
13,
1678,
565,
402,
2227,
29949,
29889,
2080,
703,
29925,
29947,
29918,
29896,
29953,
29908,
1125,
13,
4706,
1596,
703,
29925,
262,
338,
379,
6259,
29950,
1159,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
29925,
262,
338,
365,
9806,
1159,
13,
1678,
931,
29889,
17059,
29898,
29896,
29897,
13,
2
] |
setup.py | mochic/neuroglia | 0 | 138099 | import setuptools
setuptools.setup(
name="neuroglia",
version="0.1.0",
url="https://github.com/AllenInstitute/neuroglia",
author="<NAME>",
author_email="<EMAIL>",
description="scikit-learn compatible transformers for neural data science",
packages=setuptools.find_packages(),
install_requires=[
'pandas',
'xarray',
'scikit-learn',
],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| [
1,
1053,
731,
21245,
8789,
13,
13,
842,
21245,
8789,
29889,
14669,
29898,
13,
1678,
1024,
543,
484,
2192,
3820,
423,
613,
13,
1678,
1873,
543,
29900,
29889,
29896,
29889,
29900,
613,
13,
1678,
3142,
543,
991,
597,
3292,
29889,
510,
29914,
3596,
264,
3379,
12356,
29914,
484,
2192,
3820,
423,
613,
13,
13,
1678,
4148,
543,
29966,
5813,
28341,
13,
1678,
4148,
29918,
5269,
543,
29966,
26862,
6227,
28341,
13,
13,
1678,
6139,
543,
26167,
7354,
29899,
19668,
15878,
4327,
414,
363,
19677,
848,
10466,
613,
13,
13,
1678,
9741,
29922,
842,
21245,
8789,
29889,
2886,
29918,
8318,
3285,
13,
13,
1678,
2601,
29918,
276,
339,
2658,
11759,
13,
4706,
525,
15112,
742,
13,
4706,
525,
29916,
2378,
742,
13,
4706,
525,
26167,
7354,
29899,
19668,
742,
13,
1678,
21251,
13,
13,
1678,
770,
14903,
11759,
13,
4706,
525,
21956,
358,
16034,
4761,
29871,
29906,
448,
4721,
29899,
28630,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29906,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29906,
29889,
29955,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
29889,
29945,
742,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
29889,
29953,
742,
13,
1678,
21251,
13,
29897,
13,
2
] |
mbapi/tapi.py | btrevizan/mb_api | 5 | 114998 | """Mercado Bitcoin's Trade API implementation.
For more information about data structure, methods and stuff, go to
https://www.mercadobitcoin.com.br/trade-api
"""
import requests
import hashlib
import urllib
import hmac
import json
import time
from random import randint
from .labels import Coin, Url, Method
class Auth():
"""Athentication information."""
def __init__(self, **kwargs):
"""Set information needed for authentication.
Keyword arguments:
id -- user's tapi id
pin -- user's pin number
secret -- user's tapi secret
"""
self.__id = str(kwargs['id'])
self.__pin = str(kwargs['pin'])
self.__secret = bytes(str(kwargs['secret']), 'ASCII')
def id(self):
"""Return user's TAPI id."""
return self.__id
def pin(self):
"""Return user's PIN number."""
return self.__pin
def secret(self):
"""Return user's TAPI secret."""
return self.__secret
class Response():
"""Represent a TAPI response.
Properties:
data
status_code
error_msg (optional)
server_timestamp
"""
def __init__(self, response):
"""Set properties.
Keyword arguments:
response -- a dict with response
"""
self.data = response.get('response_data', None)
self.status_code = response['status_code']
self.server_timestamp = response['server_unix_timestamp']
self.error_msg = response.get('error_message', '')
def __str__(self):
"""A string representation of Response."""
return str({'data': self.data,
'status_code': self.status_code,
'server_timestamp': self.server_timestamp,
'error_msg': self.error_msg})
class Trade():
"""Implement Trade API methods.
Methods:
See method.__doc__ for method's description.
"""
def __init__(self, auth, coin=Coin.BRLBTC):
"""Set auth properties and coin type.
Keyword argument:
auth -- an Auth object
coin -- coin type (Default Coin.BRLBTC)
"""
self.__id = auth.id()
self.__pin = auth.pin()
self.__secret = auth.secret()
self.__coin = coin.value
self.__nonce = int(time.time())
@property
def nonce(self):
self.__nonce += 1
return self.__nonce
def list_system_messages(self, **kwargs):
"""Get the list of warnings, infos and error messages.
Keyword arguments:
level -- could be 'INFO', 'WARNING' or 'ERROR' (optional)
"""
self.__params = params(Method.SYS_MSG.value, self.nonce, **kwargs)
return self.__execute()
def get_account_info(self):
"""Get user's account balance and withdrawal limits."""
self.__params = params(Method.ACCOUNT_INFO.value, self.nonce)
return self.__execute()
def get_order(self, order_id):
"""Get an order information, according to the order id.
Keyword arguments:
order_id -- order id
"""
self.__params = params(Method.GET_ORDER.value,
self.nonce,
coin_pair=self.__coin,
order_id=order_id)
return self.__execute()
def list_orders(self, **kwargs):
"""Get a list of orders' information.
Keyword arguments (optional):
order_type -- (1)buy or (2)sell
status_list -- (2)open, (3)cancelled or (4)filled.
Ex.: [2,3] or [2]
has_fills -- true or false
from_id -- get orders FROM some id
to_id -- get orders UP TO some id
from_timestamp -- get orders FROM some timestamp
to_timestamp -- get orders UP TO some timestamp
"""
if 'status_list' in kwargs:
kwargs['status_list'] = json.dumps(kwargs['status_list'])
kwargs['coin_pair'] = self.__coin
self.__params = params(Method.ORDERS.value, self.nonce, **kwargs)
return self.__execute()
def list_orderbook(self, **kwargs):
"""Get information about bids and asks at Mercado Bitcoin.
Keyword arguments (optional):
full -- default False
True: 500 bids, 500 asks
False: 20 bids, 20 asks
"""
kwargs['coin_pair'] = self.__coin
self.__params = params(Method.LIST_ORDERBOOK.value, self.nonce, **kwargs)
return self.__execute()
def place_buy_order(self, quantity, limit):
"""Place a buy order at Mercado Bitcoin's orderbook.
Keyword arguments:
quantity -- coin quantity to buy
limit -- maximum buy value
Ex.: buy 0.5 BTC at 25000,
where 0.5 is the quantity and 2500 is the limit.
"""
self.__params = params(Method.BUY.value,
self.nonce,
coin_pair=self.__coin,
quantity=quantity,
limit_price=limit)
return self.__execute()
def place_sell_order(self, quantity, limit):
"""Place a sell order at Mercado Bitcoin's orderbook.
Keyword arguments:
quantity -- coin quantity to sell
limit -- minimum sell value
Ex.: sell 0.5 BTC at 25000,
where 0.5 is the quantity and 2500 is the limit.
"""
self.__params = params(Method.SELL.value,
self.nonce,
coin_pair=self.__coin,
quantity=quantity,
limit_price=limit)
return self.__execute()
def cancel_order(self, order_id):
"""Cancel an order that has been placed.
Keyword arguments:
order_id -- order's id to be cancelled
"""
self.__params = params(Method.CANCEL.value,
self.nonce,
coin_pair=self.__coin,
order_id=order_id)
return self.__execute()
def get_withdrawal(self, coin, withdrawal_id):
"""Get information about a withdrawal request.
Keyword arguments:
coin -- withdrawal's coin
BRL: Real
BTC: Bitcoin
LTC: Litecoin
BCH: BCash
withdrawal_id -- withdrawal's id
"""
self.__params = params(Method.WITHDRAWAL.value,
self.nonce,
coin=coin,
withdrawal_id=withdrawal_id)
return self.__execute()
def withdraw_coin(self, coin, **kwargs):
"""Get information about a withdrawal request.
Keyword arguments:
coin -- withdrawal's coin
BRL: Real
BTC: Bitcoin
LTC: Litecoin
BCH: BCash
description(optional) -- withdrawal description
To know more abotu additional parameters, see:
https://www.mercadobitcoin.com.br/trade-api/#withdraw_coin
"""
kwargs['coin'] = coin
self.__params = params(Method.WITHDRAW.value, self.nonce, **kwargs)
return self.__execute()
def __mac(self):
"""Generate a MAC using the secret key."""
mac = hmac.new(self.__secret, digestmod=hashlib.sha512)
params = urllib.parse.urlencode(self.__params)
params = Url.TAPI_PATH.value + '?' + params
mac.update(params.encode('utf-8'))
return mac.hexdigest()
def __header(self):
"""Construct the request's header."""
return {
'Content-type': 'application/x-www-form-urlencoded',
'TAPI-ID': self.__id,
'TAPI-MAC': self.__mac()
}
def __execute(self):
request = requests.post(Url.TAPI.value,
data=self.__params,
headers=self.__header())
data = request.content.decode('utf-8')
data = json.loads(data)
request.close()
return Response(data)
def params(method, nonce, **kwargs):
"""Represent a set of parameters for a Trade request.
Keyword arguments:
method -- TAPI method name
Other arguments are optional.
"""
parameters = kwargs
# Random (but incremental) number for request.
nonce = str(nonce)
# Dict with params fulfill.
parameters['tapi_nonce'] = nonce
parameters['tapi_method'] = method
return parameters
| [
1,
9995,
29924,
6269,
912,
18531,
1111,
262,
29915,
29879,
27226,
3450,
5314,
29889,
13,
13,
2831,
901,
2472,
1048,
848,
3829,
29892,
3519,
322,
6433,
29892,
748,
304,
13,
991,
597,
1636,
29889,
1050,
29883,
328,
711,
277,
1111,
262,
29889,
510,
29889,
1182,
29914,
3018,
311,
29899,
2754,
13,
15945,
29908,
13,
13,
13,
5215,
7274,
13,
5215,
6608,
1982,
13,
5215,
3142,
1982,
13,
5215,
298,
8628,
13,
5215,
4390,
13,
5215,
931,
13,
13,
3166,
4036,
1053,
20088,
524,
13,
3166,
869,
21134,
1053,
3189,
262,
29892,
501,
2096,
29892,
8108,
13,
13,
13,
1990,
13189,
7295,
13,
1678,
9995,
29909,
386,
6002,
2472,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2697,
2472,
4312,
363,
10760,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
1178,
1192,
1404,
29915,
29879,
260,
2754,
1178,
13,
9651,
12534,
1192,
1404,
29915,
29879,
12534,
1353,
13,
9651,
7035,
1192,
1404,
29915,
29879,
260,
2754,
7035,
13,
4706,
9995,
13,
4706,
1583,
17255,
333,
353,
851,
29898,
19290,
1839,
333,
11287,
13,
4706,
1583,
17255,
12687,
353,
851,
29898,
19290,
1839,
12687,
11287,
13,
4706,
1583,
17255,
19024,
353,
6262,
29898,
710,
29898,
19290,
1839,
19024,
2033,
511,
525,
28599,
2687,
1495,
13,
13,
1678,
822,
1178,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1404,
29915,
29879,
323,
8787,
1178,
1213,
15945,
13,
4706,
736,
1583,
17255,
333,
13,
13,
1678,
822,
12534,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1404,
29915,
29879,
349,
1177,
1353,
1213,
15945,
13,
4706,
736,
1583,
17255,
12687,
13,
13,
1678,
822,
7035,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1404,
29915,
29879,
323,
8787,
7035,
1213,
15945,
13,
4706,
736,
1583,
17255,
19024,
13,
13,
13,
1990,
13291,
7295,
13,
1678,
9995,
1123,
6338,
263,
323,
8787,
2933,
29889,
13,
13,
1678,
21582,
29901,
13,
4706,
848,
13,
4706,
4660,
29918,
401,
13,
4706,
1059,
29918,
7645,
313,
25253,
29897,
13,
4706,
1923,
29918,
16394,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2933,
1125,
13,
4706,
9995,
2697,
4426,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
2933,
1192,
263,
9657,
411,
2933,
13,
4706,
9995,
13,
4706,
1583,
29889,
1272,
353,
2933,
29889,
657,
877,
5327,
29918,
1272,
742,
6213,
29897,
13,
4706,
1583,
29889,
4882,
29918,
401,
353,
2933,
1839,
4882,
29918,
401,
2033,
13,
4706,
1583,
29889,
2974,
29918,
16394,
353,
2933,
1839,
2974,
29918,
24538,
29918,
16394,
2033,
13,
4706,
1583,
29889,
2704,
29918,
7645,
353,
2933,
29889,
657,
877,
2704,
29918,
4906,
742,
27255,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
9995,
29909,
1347,
8954,
310,
13291,
1213,
15945,
13,
4706,
736,
851,
3319,
29915,
1272,
2396,
1583,
29889,
1272,
29892,
13,
462,
1678,
525,
4882,
29918,
401,
2396,
1583,
29889,
4882,
29918,
401,
29892,
13,
462,
1678,
525,
2974,
29918,
16394,
2396,
1583,
29889,
2974,
29918,
16394,
29892,
13,
462,
1678,
525,
2704,
29918,
7645,
2396,
1583,
29889,
2704,
29918,
7645,
1800,
13,
13,
13,
1990,
27226,
7295,
13,
1678,
9995,
1888,
2037,
27226,
3450,
3519,
29889,
13,
13,
1678,
8108,
29879,
29901,
13,
13,
13,
1678,
2823,
1158,
17255,
1514,
1649,
363,
1158,
29915,
29879,
6139,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4817,
29892,
19480,
29922,
7967,
262,
29889,
29933,
2241,
29933,
9472,
1125,
13,
4706,
9995,
2697,
4817,
4426,
322,
19480,
1134,
29889,
13,
13,
4706,
7670,
1742,
2980,
29901,
13,
9651,
4817,
1192,
385,
13189,
1203,
13,
9651,
19480,
1192,
19480,
1134,
313,
4592,
3189,
262,
29889,
29933,
2241,
29933,
9472,
29897,
13,
4706,
9995,
13,
4706,
1583,
17255,
333,
353,
4817,
29889,
333,
580,
13,
4706,
1583,
17255,
12687,
353,
4817,
29889,
12687,
580,
13,
4706,
1583,
17255,
19024,
353,
4817,
29889,
19024,
580,
13,
13,
4706,
1583,
17255,
1111,
262,
353,
19480,
29889,
1767,
13,
4706,
1583,
17255,
5464,
346,
353,
938,
29898,
2230,
29889,
2230,
3101,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1661,
346,
29898,
1311,
1125,
13,
4706,
1583,
17255,
5464,
346,
4619,
29871,
29896,
13,
4706,
736,
1583,
17255,
5464,
346,
13,
13,
1678,
822,
1051,
29918,
5205,
29918,
19158,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2577,
278,
1051,
310,
18116,
29892,
3041,
359,
322,
1059,
7191,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
3233,
1192,
1033,
367,
525,
11690,
742,
525,
29956,
25614,
29915,
470,
525,
11432,
29915,
313,
25253,
29897,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
14816,
29903,
29918,
4345,
29954,
29889,
1767,
29892,
1583,
29889,
5464,
346,
29892,
3579,
19290,
29897,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
679,
29918,
10149,
29918,
3888,
29898,
1311,
1125,
13,
4706,
9995,
2577,
1404,
29915,
29879,
3633,
17346,
322,
28679,
284,
13071,
1213,
15945,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
2477,
18736,
29918,
11690,
29889,
1767,
29892,
1583,
29889,
5464,
346,
29897,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
679,
29918,
2098,
29898,
1311,
29892,
1797,
29918,
333,
1125,
13,
4706,
9995,
2577,
385,
1797,
2472,
29892,
5034,
304,
278,
1797,
1178,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
1797,
29918,
333,
1192,
1797,
1178,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
7194,
29918,
22364,
29889,
1767,
29892,
13,
462,
1669,
1583,
29889,
5464,
346,
29892,
13,
462,
1669,
19480,
29918,
18784,
29922,
1311,
17255,
1111,
262,
29892,
13,
462,
1669,
1797,
29918,
333,
29922,
2098,
29918,
333,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
1051,
29918,
20488,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2577,
263,
1051,
310,
11299,
29915,
2472,
29889,
13,
13,
4706,
7670,
1742,
6273,
313,
25253,
1125,
13,
9651,
1797,
29918,
1853,
1192,
313,
29896,
29897,
2423,
29891,
470,
313,
29906,
29897,
29879,
514,
13,
13,
9651,
4660,
29918,
1761,
1192,
313,
29906,
29897,
3150,
29892,
313,
29941,
29897,
20713,
839,
470,
313,
29946,
29897,
26940,
29889,
13,
9651,
1222,
4898,
518,
29906,
29892,
29941,
29962,
470,
518,
29906,
29962,
13,
13,
9651,
756,
29918,
5589,
29879,
1192,
1565,
470,
2089,
13,
13,
9651,
515,
29918,
333,
1192,
679,
11299,
3895,
777,
1178,
13,
13,
9651,
304,
29918,
333,
1192,
679,
11299,
11901,
7495,
777,
1178,
13,
13,
9651,
515,
29918,
16394,
1192,
679,
11299,
3895,
777,
14334,
13,
13,
9651,
304,
29918,
16394,
1192,
679,
11299,
11901,
7495,
777,
14334,
13,
4706,
9995,
13,
4706,
565,
525,
4882,
29918,
1761,
29915,
297,
9049,
5085,
29901,
13,
9651,
9049,
5085,
1839,
4882,
29918,
1761,
2033,
353,
4390,
29889,
29881,
17204,
29898,
19290,
1839,
4882,
29918,
1761,
11287,
13,
13,
4706,
9049,
5085,
1839,
1111,
262,
29918,
18784,
2033,
353,
1583,
17255,
1111,
262,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
22364,
29903,
29889,
1767,
29892,
1583,
29889,
5464,
346,
29892,
3579,
19290,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
1051,
29918,
2098,
2909,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2577,
2472,
1048,
289,
4841,
322,
19514,
472,
4702,
29883,
912,
18531,
1111,
262,
29889,
13,
13,
4706,
7670,
1742,
6273,
313,
25253,
1125,
13,
9651,
2989,
1192,
2322,
7700,
13,
18884,
5852,
29901,
29871,
29945,
29900,
29900,
289,
4841,
29892,
29871,
29945,
29900,
29900,
19514,
13,
18884,
7700,
29901,
29871,
29906,
29900,
289,
4841,
29892,
29871,
29906,
29900,
19514,
13,
4706,
9995,
13,
4706,
9049,
5085,
1839,
1111,
262,
29918,
18784,
2033,
353,
1583,
17255,
1111,
262,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
24360,
29918,
22364,
8456,
8949,
29889,
1767,
29892,
1583,
29889,
5464,
346,
29892,
3579,
19290,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
2058,
29918,
2423,
29891,
29918,
2098,
29898,
1311,
29892,
14728,
29892,
4046,
1125,
13,
4706,
9995,
22150,
263,
15649,
1797,
472,
4702,
29883,
912,
18531,
1111,
262,
29915,
29879,
1797,
2909,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
14728,
1192,
19480,
14728,
304,
15649,
13,
9651,
4046,
1192,
7472,
15649,
995,
13,
13,
4706,
1222,
4898,
15649,
29871,
29900,
29889,
29945,
350,
9472,
472,
29871,
29906,
29945,
29900,
29900,
29900,
29892,
13,
4706,
988,
29871,
29900,
29889,
29945,
338,
278,
14728,
322,
29871,
29906,
29945,
29900,
29900,
338,
278,
4046,
29889,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
7838,
29979,
29889,
1767,
29892,
13,
462,
1669,
1583,
29889,
5464,
346,
29892,
13,
462,
1669,
19480,
29918,
18784,
29922,
1311,
17255,
1111,
262,
29892,
13,
462,
1669,
14728,
29922,
22640,
29892,
13,
462,
1669,
4046,
29918,
9175,
29922,
13400,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
2058,
29918,
29879,
514,
29918,
2098,
29898,
1311,
29892,
14728,
29892,
4046,
1125,
13,
4706,
9995,
22150,
263,
19417,
1797,
472,
4702,
29883,
912,
18531,
1111,
262,
29915,
29879,
1797,
2909,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
14728,
1192,
19480,
14728,
304,
19417,
13,
9651,
4046,
1192,
9212,
19417,
995,
13,
13,
4706,
1222,
4898,
19417,
29871,
29900,
29889,
29945,
350,
9472,
472,
29871,
29906,
29945,
29900,
29900,
29900,
29892,
13,
4706,
988,
29871,
29900,
29889,
29945,
338,
278,
14728,
322,
29871,
29906,
29945,
29900,
29900,
338,
278,
4046,
29889,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
1660,
2208,
29889,
1767,
29892,
13,
462,
1669,
1583,
29889,
5464,
346,
29892,
13,
462,
1669,
19480,
29918,
18784,
29922,
1311,
17255,
1111,
262,
29892,
13,
462,
1669,
14728,
29922,
22640,
29892,
13,
462,
1669,
4046,
29918,
9175,
29922,
13400,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
12611,
29918,
2098,
29898,
1311,
29892,
1797,
29918,
333,
1125,
13,
4706,
9995,
19420,
385,
1797,
393,
756,
1063,
7180,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
1797,
29918,
333,
1192,
1797,
29915,
29879,
1178,
304,
367,
12611,
839,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
29907,
23219,
29931,
29889,
1767,
29892,
13,
462,
1669,
1583,
29889,
5464,
346,
29892,
13,
462,
1669,
19480,
29918,
18784,
29922,
1311,
17255,
1111,
262,
29892,
13,
462,
1669,
1797,
29918,
333,
29922,
2098,
29918,
333,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
679,
29918,
2541,
4012,
284,
29898,
1311,
29892,
19480,
29892,
28679,
284,
29918,
333,
1125,
13,
4706,
9995,
2577,
2472,
1048,
263,
28679,
284,
2009,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
19480,
1192,
28679,
284,
29915,
29879,
19480,
13,
18884,
350,
2241,
29901,
8195,
13,
18884,
350,
9472,
29901,
18531,
1111,
262,
13,
18884,
365,
9472,
29901,
365,
568,
1111,
262,
13,
18884,
350,
3210,
29901,
17403,
1161,
13,
13,
9651,
28679,
284,
29918,
333,
1192,
28679,
284,
29915,
29879,
1178,
13,
4706,
9995,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
29956,
13054,
29928,
4717,
29956,
1964,
29889,
1767,
29892,
13,
462,
1669,
1583,
29889,
5464,
346,
29892,
13,
462,
1669,
19480,
29922,
1111,
262,
29892,
13,
462,
1669,
28679,
284,
29918,
333,
29922,
2541,
4012,
284,
29918,
333,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
28679,
29918,
1111,
262,
29898,
1311,
29892,
19480,
29892,
3579,
19290,
1125,
13,
4706,
9995,
2577,
2472,
1048,
263,
28679,
284,
2009,
29889,
13,
13,
4706,
7670,
1742,
6273,
29901,
13,
9651,
19480,
1192,
28679,
284,
29915,
29879,
19480,
13,
18884,
350,
2241,
29901,
8195,
13,
18884,
350,
9472,
29901,
18531,
1111,
262,
13,
18884,
365,
9472,
29901,
365,
568,
1111,
262,
13,
18884,
350,
3210,
29901,
17403,
1161,
13,
13,
9651,
6139,
29898,
25253,
29897,
1192,
28679,
284,
6139,
13,
13,
4706,
1763,
1073,
901,
633,
327,
29884,
5684,
4128,
29892,
1074,
29901,
13,
4706,
2045,
597,
1636,
29889,
1050,
29883,
328,
711,
277,
1111,
262,
29889,
510,
29889,
1182,
29914,
3018,
311,
29899,
2754,
8484,
2541,
4012,
29918,
1111,
262,
13,
4706,
9995,
13,
4706,
9049,
5085,
1839,
1111,
262,
2033,
353,
19480,
13,
4706,
1583,
17255,
7529,
353,
8636,
29898,
4062,
29889,
29956,
13054,
29928,
4717,
29956,
29889,
1767,
29892,
1583,
29889,
5464,
346,
29892,
3579,
19290,
29897,
13,
13,
4706,
736,
1583,
17255,
7978,
580,
13,
13,
1678,
822,
4770,
8628,
29898,
1311,
1125,
13,
4706,
9995,
5631,
403,
263,
26750,
773,
278,
7035,
1820,
1213,
15945,
13,
4706,
5825,
353,
298,
8628,
29889,
1482,
29898,
1311,
17255,
19024,
29892,
4697,
342,
1545,
29922,
8568,
1982,
29889,
17051,
29945,
29896,
29906,
29897,
13,
13,
4706,
8636,
353,
3142,
1982,
29889,
5510,
29889,
2271,
12508,
29898,
1311,
17255,
7529,
29897,
13,
4706,
8636,
353,
501,
2096,
29889,
6040,
2227,
29918,
10145,
29889,
1767,
718,
525,
17901,
718,
8636,
13,
13,
4706,
5825,
29889,
5504,
29898,
7529,
29889,
12508,
877,
9420,
29899,
29947,
8785,
13,
13,
4706,
736,
5825,
29889,
20970,
7501,
342,
580,
13,
13,
1678,
822,
4770,
6672,
29898,
1311,
1125,
13,
4706,
9995,
1168,
4984,
278,
2009,
29915,
29879,
4839,
1213,
15945,
13,
4706,
736,
426,
13,
9651,
525,
3916,
29899,
1853,
2396,
525,
6214,
29914,
29916,
29899,
1636,
29899,
689,
29899,
2271,
26716,
742,
13,
9651,
525,
6040,
2227,
29899,
1367,
2396,
1583,
17255,
333,
29892,
13,
9651,
525,
6040,
2227,
29899,
1529,
29907,
2396,
1583,
17255,
8628,
580,
13,
4706,
500,
13,
13,
1678,
822,
4770,
7978,
29898,
1311,
1125,
13,
4706,
2009,
353,
7274,
29889,
2490,
29898,
5983,
29889,
6040,
2227,
29889,
1767,
29892,
13,
462,
18884,
848,
29922,
1311,
17255,
7529,
29892,
13,
462,
18884,
9066,
29922,
1311,
17255,
6672,
3101,
13,
13,
4706,
848,
353,
2009,
29889,
3051,
29889,
13808,
877,
9420,
29899,
29947,
1495,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
1272,
29897,
13,
13,
4706,
2009,
29889,
5358,
580,
13,
13,
4706,
736,
13291,
29898,
1272,
29897,
13,
13,
13,
1753,
8636,
29898,
5696,
29892,
1661,
346,
29892,
3579,
19290,
1125,
13,
1678,
9995,
1123,
6338,
263,
731,
310,
4128,
363,
263,
27226,
2009,
29889,
13,
13,
1678,
7670,
1742,
6273,
29901,
13,
4706,
1158,
1192,
323,
8787,
1158,
1024,
13,
13,
1678,
5901,
6273,
526,
13136,
29889,
13,
1678,
9995,
13,
1678,
4128,
353,
9049,
5085,
13,
13,
1678,
396,
16968,
313,
4187,
11924,
284,
29897,
1353,
363,
2009,
29889,
13,
1678,
1661,
346,
353,
851,
29898,
5464,
346,
29897,
13,
13,
1678,
396,
360,
919,
411,
8636,
6095,
5589,
29889,
13,
1678,
4128,
1839,
29873,
2754,
29918,
5464,
346,
2033,
353,
1661,
346,
13,
1678,
4128,
1839,
29873,
2754,
29918,
5696,
2033,
353,
1158,
13,
13,
1678,
736,
4128,
13,
2
] |
django-rgd-imagery/rgd_imagery/rest/download.py | ResonantGeoData/ResonantGeoData | 40 | 163222 | <filename>django-rgd-imagery/rgd_imagery/rest/download.py
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import api_view
from rgd.permissions import check_read_perm
from rgd_imagery import models
@swagger_auto_schema(
method='GET',
operation_summary='Download the associated Image data for this Image directly from S3.',
)
@api_view(['GET'])
def download_image_file(request, pk):
instance = get_object_or_404(models.Image, pk=pk)
check_read_perm(request.user, instance)
url = instance.file.get_url()
return HttpResponseRedirect(url)
| [
1,
529,
9507,
29958,
14095,
29899,
11007,
29881,
29899,
326,
351,
708,
29914,
11007,
29881,
29918,
326,
351,
708,
29914,
5060,
29914,
10382,
29889,
2272,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
24735,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
13,
3166,
4192,
29888,
29918,
29891,
294,
29887,
29889,
13239,
1053,
2381,
9921,
29918,
6921,
29918,
11010,
13,
3166,
1791,
29918,
4468,
29889,
19557,
4097,
1053,
7882,
29918,
1493,
13,
3166,
15552,
29881,
29889,
17858,
6847,
1053,
1423,
29918,
949,
29918,
17858,
13,
3166,
15552,
29881,
29918,
326,
351,
708,
1053,
4733,
13,
13,
13,
29992,
2774,
9921,
29918,
6921,
29918,
11010,
29898,
13,
1678,
1158,
2433,
7194,
742,
13,
1678,
5858,
29918,
7727,
2433,
22954,
278,
6942,
7084,
848,
363,
445,
7084,
4153,
515,
317,
29941,
29889,
742,
13,
29897,
13,
29992,
2754,
29918,
1493,
18959,
7194,
11287,
13,
1753,
5142,
29918,
3027,
29918,
1445,
29898,
3827,
29892,
282,
29895,
1125,
13,
1678,
2777,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9794,
29889,
2940,
29892,
282,
29895,
29922,
20571,
29897,
13,
1678,
1423,
29918,
949,
29918,
17858,
29898,
3827,
29889,
1792,
29892,
2777,
29897,
13,
1678,
3142,
353,
2777,
29889,
1445,
29889,
657,
29918,
2271,
580,
13,
1678,
736,
9056,
5103,
24735,
29898,
2271,
29897,
13,
2
] |
src/utils.py | NicolasKiely/acc_intel_mini_proj | 0 | 67856 | """ Miscellaneous utility functions """
import logging
import os
import pandas as pd
logger = logging.getLogger(__name__)
def load_df_from_dataset(file_name: str) -> pd.DataFrame:
""" Loads cleaned dataframe from csv
Fields with extra records get logged and dropped.
"""
df = pd.read_csv(file_name)
bad_column = None
bad_column_name = None
for column in df.columns:
if not column.startswith('Unnamed:'):
# Only care about unnamed columns
continue
column_id = column.split(':')[-1].strip()
if column_id == '0':
# Ignore unnamed column if it is the very first one (eg index)
continue
bad_column_name = column
bad_column = df[column]
logger.warning('Found suspicious column "%s"' % column)
if bad_column is not None:
# Drop records that have entries in trailing unnamed column
bad_records = df[bad_column.notna()]
for record in bad_records.iterrows():
logger.warning('Skipping record: #%s' % record[0])
df = df.drop(bad_records.index)
df = df.drop(columns=[bad_column_name])
return df
def get_default_dataset_filename() -> str:
""" Returns default dataset file name """
return os.environ.get('DATASET_NAME', 'data/movie_metadata.csv')
def nan_to_none(value, default=None):
""" Casts numpy/pandas nan values to none, or some other default """
if pd.isna(value):
return default
else:
return value
| [
1,
9995,
20929,
3729,
23584,
19725,
3168,
9995,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
11701,
408,
10518,
13,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
2254,
29918,
2176,
29918,
3166,
29918,
24713,
29898,
1445,
29918,
978,
29901,
851,
29897,
1599,
10518,
29889,
17271,
29901,
13,
1678,
9995,
4309,
7925,
5941,
287,
12205,
515,
11799,
13,
13,
1678,
8989,
29879,
411,
4805,
6475,
679,
13817,
322,
13700,
29889,
13,
1678,
9995,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
978,
29897,
13,
1678,
4319,
29918,
4914,
353,
6213,
13,
1678,
4319,
29918,
4914,
29918,
978,
353,
6213,
13,
1678,
363,
1897,
297,
4489,
29889,
13099,
29901,
13,
4706,
565,
451,
1897,
29889,
27382,
2541,
877,
2525,
17514,
11283,
1125,
13,
9651,
396,
9333,
2562,
1048,
443,
17514,
4341,
13,
9651,
6773,
13,
13,
4706,
1897,
29918,
333,
353,
1897,
29889,
5451,
877,
29901,
1495,
14352,
29896,
1822,
17010,
580,
13,
4706,
565,
1897,
29918,
333,
1275,
525,
29900,
2396,
13,
9651,
396,
18076,
487,
443,
17514,
1897,
565,
372,
338,
278,
1407,
937,
697,
313,
387,
2380,
29897,
13,
9651,
6773,
13,
13,
4706,
4319,
29918,
4914,
29918,
978,
353,
1897,
13,
4706,
4319,
29918,
4914,
353,
4489,
29961,
4914,
29962,
13,
4706,
17927,
29889,
27392,
877,
9692,
8872,
14803,
1897,
11860,
29879,
29908,
29915,
1273,
1897,
29897,
13,
13,
1678,
565,
4319,
29918,
4914,
338,
451,
6213,
29901,
13,
4706,
396,
20724,
6475,
393,
505,
9976,
297,
25053,
443,
17514,
1897,
13,
4706,
4319,
29918,
3757,
4339,
353,
4489,
29961,
12313,
29918,
4914,
29889,
1333,
1056,
580,
29962,
13,
4706,
363,
2407,
297,
4319,
29918,
3757,
4339,
29889,
1524,
5727,
7295,
13,
9651,
17927,
29889,
27392,
877,
29903,
1984,
3262,
2407,
29901,
396,
29995,
29879,
29915,
1273,
2407,
29961,
29900,
2314,
13,
13,
4706,
4489,
353,
4489,
29889,
8865,
29898,
12313,
29918,
3757,
4339,
29889,
2248,
29897,
13,
4706,
4489,
353,
4489,
29889,
8865,
29898,
13099,
11759,
12313,
29918,
4914,
29918,
978,
2314,
13,
13,
1678,
736,
4489,
13,
13,
13,
1753,
679,
29918,
4381,
29918,
24713,
29918,
9507,
580,
1599,
851,
29901,
13,
1678,
9995,
16969,
2322,
8783,
934,
1024,
9995,
13,
1678,
736,
2897,
29889,
21813,
29889,
657,
877,
25832,
8127,
29911,
29918,
5813,
742,
525,
1272,
29914,
27362,
29918,
19635,
29889,
7638,
1495,
13,
13,
13,
1753,
23432,
29918,
517,
29918,
9290,
29898,
1767,
29892,
2322,
29922,
8516,
1125,
13,
1678,
9995,
4834,
29879,
12655,
29914,
15112,
23432,
1819,
304,
5642,
29892,
470,
777,
916,
2322,
9995,
13,
1678,
565,
10518,
29889,
275,
1056,
29898,
1767,
1125,
13,
4706,
736,
2322,
13,
1678,
1683,
29901,
13,
4706,
736,
995,
13,
2
] |
hackerearth/Algorithms/Costly Phone Number/test.py | HBinhCT/Q-project | 4 | 190183 | import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'3',
'3 2 2 3 2 1 1 2 3 3 ',
'3',
'171',
'3 2 3 1 1 1 1 3 1 2 ',
'2',
'16',
'3 3 3 1 3 1 1 2 3 2 ',
'2',
'43',
])
def test_case_0(self, input_mock=None):
text_trap = io.StringIO()
with redirect_stdout(text_trap):
import solution
self.assertEqual(text_trap.getvalue(),
'6\n' +
'3\n' +
'4\n')
if __name__ == '__main__':
unittest.main()
| [
1,
1053,
12013,
13,
5215,
443,
27958,
13,
3166,
3030,
1982,
1053,
6684,
29918,
25393,
13,
3166,
443,
27958,
29889,
17640,
1053,
13261,
13,
13,
13,
1990,
4321,
29984,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
732,
5041,
877,
16145,
1144,
29889,
2080,
742,
2625,
29918,
15987,
11759,
13,
4706,
525,
29941,
742,
13,
4706,
525,
29941,
29871,
29906,
29871,
29906,
29871,
29941,
29871,
29906,
29871,
29896,
29871,
29896,
29871,
29906,
29871,
29941,
29871,
29941,
13420,
13,
4706,
525,
29941,
742,
13,
4706,
525,
29896,
29955,
29896,
742,
13,
4706,
525,
29941,
29871,
29906,
29871,
29941,
29871,
29896,
29871,
29896,
29871,
29896,
29871,
29896,
29871,
29941,
29871,
29896,
29871,
29906,
13420,
13,
4706,
525,
29906,
742,
13,
4706,
525,
29896,
29953,
742,
13,
4706,
525,
29941,
29871,
29941,
29871,
29941,
29871,
29896,
29871,
29941,
29871,
29896,
29871,
29896,
29871,
29906,
29871,
29941,
29871,
29906,
13420,
13,
4706,
525,
29906,
742,
13,
4706,
525,
29946,
29941,
742,
13,
268,
2314,
13,
1678,
822,
1243,
29918,
4878,
29918,
29900,
29898,
1311,
29892,
1881,
29918,
17640,
29922,
8516,
1125,
13,
4706,
1426,
29918,
29873,
2390,
353,
12013,
29889,
1231,
5971,
580,
13,
4706,
411,
6684,
29918,
25393,
29898,
726,
29918,
29873,
2390,
1125,
13,
9651,
1053,
1650,
13,
4706,
1583,
29889,
9294,
9843,
29898,
726,
29918,
29873,
2390,
29889,
657,
1767,
3285,
13,
462,
308,
525,
29953,
29905,
29876,
29915,
718,
13,
462,
308,
525,
29941,
29905,
29876,
29915,
718,
13,
462,
308,
525,
29946,
29905,
29876,
1495,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
test/boards/old_mqtt_board.py | jarzab3/smart_city_mdx | 1 | 169782 | __author__ = '<NAME>'
import time
import sys
from asip_client import AsipClient
from threading import Thread
try:
from Queue import Queue
except ImportError:
from queue import Queue
from asip_writer import AsipWriter
import paho.mqtt.client as mqtt
class SimpleMQTTBoard:
# ************ BEGIN CONSTANTS DEFINITION ****************
DEBUG = True
# ************ END CONSTANTS DEFINITION ****************
# ************ BEGIN PRIVATE FIELDS DEFINITION ****************
mqtt_client = None # self board uses mqtt
asip = None # The client for the aisp protocol
queue = Queue(10) # Buffer # TODO: use pipe instead of queue for better performances
# FIXME: fix Queue dimension?
Broker = ""
_TCPport = 1883
_ClientID = ""
_SUBTOPIC = ""
_PUBTOPIC = ""
# ************ END PRIVATE FIELDS DEFINITION ****************
# self constructor takes the Broker address
# Here the listener and the queue reader are started
def __init__(self, Broker, BoardID):
try:
self.Broker = Broker
self._ClientID = "Client"
self._SUBTOPIC = "asip/"+BoardID+"/out"
self._PUBTOPIC = "asip/"+BoardID+"/in"
self.mqtt_client = mqtt.Client(self._ClientID)
self.mqtt_client.on_connect = self.on_connect
self.connect()
self.buffer = ""
self.asip = AsipClient(self.SimpleMQTTWriter(self))
except Exception as e:
sys.stdout.write("Exception: caught {} while init tcp socket and asip protocols\n".format(e))
try:
# NOTICE: two request_port_mapping() are required. If this method is not called two times,
# the client won't be able to set the pin mapping
# time.sleep(0.5)
# self.request_port_mapping()
# time.sleep(1)
# self.request_port_mapping()
# time.sleep(1)
# ListenerThread is the one that reads incoming messages from mqtt
# ConsumerThread is the one that read the queue filled by ListenerThread and call the asip process_input
# Sender is the thread that publish messages
self.ListenerThread(self.queue, self.mqtt_client, True, self.DEBUG, self._SUBTOPIC).start()
self.ConsumerThread(self.queue, self.asip, True, self.DEBUG).start()
self.Sender(self).start()
self.mqtt_client.loop_start() # starting mqtt loop
# TODO: check following code
# while self.asip.isVersionOk() == False: # flag will be set to true when valid version message is received
# self.request_info()
# time.sleep(1.0)
while not self.asip.check_mapping():
print("Requesting mapping")
self.request_port_mapping()
time.sleep(0.25)
sys.stdout.write("**** Everything check ****\n")
except Exception as e:
#TODO: improve exception handling
sys.stdout.write("Exception: caught {} while launching threads\n".format(e))
# ************ BEGIN PUBLIC METHODS *************
# The following methods are just a replica from the asip class.
# TODO: add parameter checikng in each function (raise exception?)
def digital_read(self, pin):
return self.asip.digital_read(pin)
def analog_read(self, pin):
return self.asip.analog_read(pin)
def set_pin_mode(self, pin, mode):
self.asip.set_pin_mode(pin, mode)
def digital_write(self, pin, value):
self.asip.digital_write(pin, value)
def analog_write(self, pin, value):
self.asip.analog_write(pin, value)
def request_info(self):
self.asip.request_info()
def request_port_mapping(self):
self.asip.request_port_mapping()
def set_auto_report_interval(self, interval):
self.asip.set_auto_report_interval(interval)
def add_service(self, service_id, asip_service):
self.asip.add_service(service_id, asip_service)
def get_asip_client(self):
return self.asip
# ************ END PUBLIC METHODS *************
# ************ BEGIN PRIVATE METHODS *************
# The callback for when the client receives a CONNACK response from the server.
def on_connect(self, client, userdata, flags, rc):
if self.DEBUG:
sys.stdout.write("DEBUG: Connected with result code {}".format(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
#self.mqtt_client.subscribe("$SYS/#")
#self.mqtt_client.subscribe(self._SUBTOPIC)
def connect(self):
if self.DEBUG:
sys.stdout.write("DEBUG: Connecting to mqtt broker {} on port {}".format(self.Broker,self._TCPport))
self.mqtt_client.connect(self.Broker, self._TCPport, 180)
def sendData(self, msg):
self.mqtt_client.publish(self._PUBTOPIC, msg)
def disconnect(self):
if self.DEBUG:
sys.stdout.write("DEBUG: DEBUG: Disconnected from mqtt")
self.mqtt_client.disconnect()
# ************ END PRIVATE METHODS *************
# ************ BEGIN PRIVATE CLASSES *************
class Sender(Thread):
def __init__(self, parent):
Thread.__init__(self)
self.parent = parent
self.running = True
def run(self):
while self.running:
if not self.parent.buffer:
pass
else:
if self.parent.DEBUG:
sys.stdout.write("DEBUG: Sending: {}\n".format(self.parent.buffer[0:self.parent.buffer.index('\n')]))
self.parent.mqtt_client.publish(self.parent._PUBTOPIC,self.parent.buffer[0:self.parent.buffer.index('\n')])
self.parent.buffer = self.parent.buffer[self.parent.buffer.index('\n')+1:]
if self.parent.DEBUG:
sys.stdout.write("DEBUG: Rest of buffer {}\n".format(self.parent.buffer))
# As described above, SimpleMQTTBoard writes messages to the tcp stream.
# inner class SimpleMQTTWriter implements abstract class AsipWriter:
class SimpleMQTTWriter(AsipWriter):
parent = None
def __init__(self, parent):
self.parent = parent
# val is a string
# TODO: improve try catch
def write(self, val):
# TODO: insert a way to check weather the connection is still open or not
try:
# it fills a buffer
self.parent.buffer = self.parent.buffer + val + '\n'
if self.parent.DEBUG:
sys.stdout.write("DEBUG: Just sent {}".format(val))
except Exception as e:
pass
# ListenerThread and ConsumerThread are implemented following the Producer/Consumer pattern
# A class for a listener that read the tcp ip messages and put incoming messages on a queue
# TODO: implement try catch
class ListenerThread(Thread):
queue = None
mqtt_client = None
running = False
DEBUG = False
temp_buff = ""
# overriding constructor
def __init__(self, queue, mqtt_client, running, debug, subtopic):
Thread.__init__(self)
self.queue = queue
self.mqtt_client = mqtt_client
self.mqtt_client.on_message = self.on_message # callback
self.mqtt_client.subscribe(topic=subtopic)
self.running = running
self.DEBUG = debug
if self.DEBUG:
sys.stdout.write("DEBUG: listener thread process created \n")
# if needed, kill will stops the loop inside run method
def kill(self):
self.running = False
# The callback for when a PUBLISH message is received from the server.
def on_message(self, client, userdata, msg):
if not msg.payload:
pass
else:
temp = msg.payload.decode('utf-8')
self.queue.put(temp)
if self.DEBUG:
sys.stdout.write("DEBUG: Received {}\n".format(temp))
# A class that reads the queue and launch the processInput method of the AispClient.
class ConsumerThread(Thread):
queue = None
asip = None
running = False
DEBUG = False
# overriding constructor
def __init__(self, queue, asip, running, debug):
Thread.__init__(self)
self.queue = queue
self.asip = asip
self.running = running
self.DEBUG = debug
if self.DEBUG:
sys.stdout.write("DEBUG: consumer thread created \n")
# if needed, kill will stops the loop inside run method
def kill(self):
self.running = False
# overriding run method, thread activity
def run(self):
while self.running:
temp = self.queue.get()
self.asip.process_input(temp)
self.queue.task_done()
# ************ END PRIVATE CLASSES ************* | [
1,
4770,
8921,
1649,
353,
12801,
5813,
16299,
13,
13,
5215,
931,
13,
5215,
10876,
13,
3166,
408,
666,
29918,
4645,
1053,
1094,
666,
4032,
13,
3166,
3244,
292,
1053,
10480,
13,
2202,
29901,
13,
1678,
515,
5462,
434,
1053,
5462,
434,
13,
19499,
16032,
2392,
29901,
13,
1678,
515,
9521,
1053,
5462,
434,
13,
3166,
408,
666,
29918,
13236,
1053,
1094,
666,
10507,
13,
5215,
282,
29745,
29889,
28466,
698,
29889,
4645,
408,
286,
29939,
698,
13,
13,
13,
1990,
12545,
25566,
19988,
28397,
29901,
13,
13,
1678,
396,
334,
4189,
17435,
259,
22815,
8707,
1254,
2190,
9375,
5012,
29943,
1177,
22122,
334,
4189,
2328,
17435,
13,
13,
1678,
21681,
353,
5852,
13,
13,
1678,
396,
334,
4189,
17435,
259,
11056,
8707,
1254,
2190,
9375,
5012,
29943,
1177,
22122,
334,
4189,
2328,
17435,
13,
13,
1678,
396,
334,
4189,
17435,
259,
22815,
349,
3960,
29963,
3040,
9338,
6670,
8452,
5012,
29943,
1177,
22122,
334,
4189,
2328,
17435,
13,
13,
1678,
286,
29939,
698,
29918,
4645,
353,
6213,
29871,
396,
1583,
7613,
3913,
286,
29939,
698,
13,
1678,
408,
666,
353,
6213,
29871,
396,
450,
3132,
363,
278,
263,
11936,
9608,
13,
1678,
9521,
353,
5462,
434,
29898,
29896,
29900,
29897,
29871,
396,
16534,
396,
14402,
29901,
671,
14282,
2012,
310,
9521,
363,
2253,
21637,
13,
1678,
396,
29871,
383,
6415,
2303,
29901,
2329,
5462,
434,
9927,
29973,
13,
1678,
4358,
3946,
353,
5124,
13,
1678,
903,
29911,
6271,
637,
353,
29871,
29896,
29947,
29947,
29941,
13,
1678,
903,
4032,
1367,
353,
5124,
13,
1678,
903,
20633,
4986,
2227,
29907,
353,
5124,
13,
1678,
903,
7056,
29933,
4986,
2227,
29907,
353,
5124,
13,
13,
1678,
396,
334,
4189,
17435,
259,
11056,
349,
3960,
29963,
3040,
9338,
6670,
8452,
5012,
29943,
1177,
22122,
334,
4189,
2328,
17435,
13,
13,
1678,
396,
1583,
5823,
4893,
278,
4358,
3946,
3211,
13,
1678,
396,
2266,
278,
13254,
322,
278,
9521,
9591,
526,
4687,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4358,
3946,
29892,
12590,
1367,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29857,
3946,
353,
4358,
3946,
13,
9651,
1583,
3032,
4032,
1367,
353,
376,
4032,
29908,
13,
9651,
1583,
3032,
20633,
4986,
2227,
29907,
353,
376,
294,
666,
12975,
29974,
28397,
1367,
13578,
29914,
449,
29908,
13,
9651,
1583,
3032,
7056,
29933,
4986,
2227,
29907,
353,
376,
294,
666,
12975,
29974,
28397,
1367,
13578,
29914,
262,
29908,
13,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
353,
286,
29939,
698,
29889,
4032,
29898,
1311,
3032,
4032,
1367,
29897,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
29889,
265,
29918,
6915,
353,
1583,
29889,
265,
29918,
6915,
13,
9651,
1583,
29889,
6915,
580,
13,
9651,
1583,
29889,
9040,
353,
5124,
13,
13,
9651,
1583,
29889,
294,
666,
353,
1094,
666,
4032,
29898,
1311,
29889,
15427,
25566,
19988,
10507,
29898,
1311,
876,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
2451,
29901,
12624,
6571,
1550,
2069,
22729,
9909,
322,
408,
666,
9608,
29879,
29905,
29876,
1642,
4830,
29898,
29872,
876,
13,
13,
4706,
1018,
29901,
13,
9651,
396,
6058,
12107,
29901,
1023,
2009,
29918,
637,
29918,
20698,
580,
526,
3734,
29889,
960,
445,
1158,
338,
451,
2000,
1023,
3064,
29892,
13,
9651,
396,
278,
3132,
2113,
29915,
29873,
367,
2221,
304,
731,
278,
12534,
10417,
13,
9651,
396,
931,
29889,
17059,
29898,
29900,
29889,
29945,
29897,
13,
9651,
396,
1583,
29889,
3827,
29918,
637,
29918,
20698,
580,
13,
9651,
396,
931,
29889,
17059,
29898,
29896,
29897,
13,
9651,
396,
1583,
29889,
3827,
29918,
637,
29918,
20698,
580,
13,
9651,
396,
931,
29889,
17059,
29898,
29896,
29897,
13,
13,
9651,
396,
2391,
759,
4899,
338,
278,
697,
393,
13623,
23235,
7191,
515,
286,
29939,
698,
13,
9651,
396,
2138,
4680,
4899,
338,
278,
697,
393,
1303,
278,
9521,
10423,
491,
2391,
759,
4899,
322,
1246,
278,
408,
666,
1889,
29918,
2080,
13,
9651,
396,
317,
1581,
338,
278,
3244,
393,
9805,
7191,
13,
9651,
1583,
29889,
3962,
4899,
29898,
1311,
29889,
9990,
29892,
1583,
29889,
28466,
698,
29918,
4645,
29892,
5852,
29892,
1583,
29889,
18525,
29892,
1583,
3032,
20633,
4986,
2227,
29907,
467,
2962,
580,
13,
9651,
1583,
29889,
13696,
4680,
4899,
29898,
1311,
29889,
9990,
29892,
1583,
29889,
294,
666,
29892,
5852,
29892,
1583,
29889,
18525,
467,
2962,
580,
13,
9651,
1583,
29889,
29615,
29898,
1311,
467,
2962,
580,
13,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
29889,
7888,
29918,
2962,
580,
396,
6257,
286,
29939,
698,
2425,
13,
13,
9651,
396,
14402,
29901,
1423,
1494,
775,
13,
9651,
396,
1550,
1583,
29889,
294,
666,
29889,
275,
6594,
20434,
580,
1275,
7700,
29901,
29871,
396,
7353,
674,
367,
731,
304,
1565,
746,
2854,
1873,
2643,
338,
4520,
13,
9651,
396,
268,
1583,
29889,
3827,
29918,
3888,
580,
13,
9651,
396,
268,
931,
29889,
17059,
29898,
29896,
29889,
29900,
29897,
13,
9651,
1550,
451,
1583,
29889,
294,
666,
29889,
3198,
29918,
20698,
7295,
13,
18884,
1596,
703,
3089,
292,
10417,
1159,
13,
18884,
1583,
29889,
3827,
29918,
637,
29918,
20698,
580,
13,
18884,
931,
29889,
17059,
29898,
29900,
29889,
29906,
29945,
29897,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
2328,
17296,
1423,
334,
17435,
29905,
29876,
1159,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
396,
4986,
3970,
29901,
11157,
3682,
11415,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
2451,
29901,
12624,
6571,
1550,
6826,
292,
9717,
29905,
29876,
1642,
4830,
29898,
29872,
876,
13,
13,
13,
1678,
396,
334,
4189,
17435,
22815,
349,
7466,
27888,
341,
2544,
8187,
8452,
334,
4189,
2328,
13,
13,
1678,
396,
450,
1494,
3519,
526,
925,
263,
1634,
10123,
515,
278,
408,
666,
770,
29889,
13,
1678,
396,
14402,
29901,
788,
3443,
923,
455,
29895,
865,
297,
1269,
740,
313,
22692,
3682,
7897,
13,
1678,
822,
13436,
29918,
949,
29898,
1311,
29892,
12534,
1125,
13,
4706,
736,
1583,
29889,
294,
666,
29889,
7501,
2410,
29918,
949,
29898,
12687,
29897,
13,
13,
1678,
822,
15690,
29918,
949,
29898,
1311,
29892,
12534,
1125,
13,
4706,
736,
1583,
29889,
294,
666,
29889,
7054,
468,
29918,
949,
29898,
12687,
29897,
13,
13,
1678,
822,
731,
29918,
12687,
29918,
8513,
29898,
1311,
29892,
12534,
29892,
4464,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
842,
29918,
12687,
29918,
8513,
29898,
12687,
29892,
4464,
29897,
13,
13,
1678,
822,
13436,
29918,
3539,
29898,
1311,
29892,
12534,
29892,
995,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
7501,
2410,
29918,
3539,
29898,
12687,
29892,
995,
29897,
13,
13,
1678,
822,
15690,
29918,
3539,
29898,
1311,
29892,
12534,
29892,
995,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
7054,
468,
29918,
3539,
29898,
12687,
29892,
995,
29897,
13,
13,
1678,
822,
2009,
29918,
3888,
29898,
1311,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
3827,
29918,
3888,
580,
13,
13,
1678,
822,
2009,
29918,
637,
29918,
20698,
29898,
1311,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
3827,
29918,
637,
29918,
20698,
580,
13,
13,
1678,
822,
731,
29918,
6921,
29918,
12276,
29918,
19207,
29898,
1311,
29892,
7292,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
842,
29918,
6921,
29918,
12276,
29918,
19207,
29898,
19207,
29897,
13,
13,
1678,
822,
788,
29918,
5509,
29898,
1311,
29892,
2669,
29918,
333,
29892,
408,
666,
29918,
5509,
1125,
13,
4706,
1583,
29889,
294,
666,
29889,
1202,
29918,
5509,
29898,
5509,
29918,
333,
29892,
408,
666,
29918,
5509,
29897,
13,
13,
1678,
822,
679,
29918,
294,
666,
29918,
4645,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
294,
666,
13,
13,
1678,
396,
334,
4189,
17435,
11056,
349,
7466,
27888,
341,
2544,
8187,
8452,
334,
4189,
2328,
13,
13,
13,
1678,
396,
334,
4189,
17435,
22815,
349,
3960,
29963,
3040,
341,
2544,
8187,
8452,
334,
4189,
2328,
13,
13,
1678,
396,
450,
6939,
363,
746,
278,
3132,
20586,
263,
8707,
29940,
11375,
2933,
515,
278,
1923,
29889,
13,
1678,
822,
373,
29918,
6915,
29898,
1311,
29892,
3132,
29892,
1404,
1272,
29892,
13449,
29892,
364,
29883,
1125,
13,
4706,
565,
1583,
29889,
18525,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
1281,
484,
2954,
411,
1121,
775,
6571,
1642,
4830,
29898,
2214,
876,
13,
13,
4706,
396,
3323,
7588,
10549,
297,
373,
29918,
6915,
580,
2794,
393,
565,
591,
14074,
278,
3957,
322,
13,
4706,
396,
337,
6915,
769,
21696,
1980,
674,
367,
23011,
287,
29889,
13,
4706,
396,
1311,
29889,
28466,
698,
29918,
4645,
29889,
19496,
703,
29938,
14816,
29903,
8484,
1159,
13,
4706,
396,
1311,
29889,
28466,
698,
29918,
4645,
29889,
19496,
29898,
1311,
3032,
20633,
4986,
2227,
29907,
29897,
13,
13,
1678,
822,
4511,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
18525,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
14971,
292,
304,
286,
29939,
698,
2545,
3946,
6571,
373,
2011,
6571,
1642,
4830,
29898,
1311,
29889,
29857,
3946,
29892,
1311,
3032,
29911,
6271,
637,
876,
13,
4706,
1583,
29889,
28466,
698,
29918,
4645,
29889,
6915,
29898,
1311,
29889,
29857,
3946,
29892,
1583,
3032,
29911,
6271,
637,
29892,
29871,
29896,
29947,
29900,
29897,
13,
13,
1678,
822,
3638,
1469,
29898,
1311,
29892,
10191,
1125,
13,
4706,
1583,
29889,
28466,
698,
29918,
4645,
29889,
23679,
29898,
1311,
3032,
7056,
29933,
4986,
2227,
29907,
29892,
10191,
29897,
13,
13,
1678,
822,
766,
6915,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
18525,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
21681,
29901,
3295,
18045,
515,
286,
29939,
698,
1159,
13,
4706,
1583,
29889,
28466,
698,
29918,
4645,
29889,
2218,
6915,
580,
13,
13,
1678,
396,
334,
4189,
17435,
11056,
349,
3960,
29963,
3040,
341,
2544,
8187,
8452,
334,
4189,
2328,
13,
13,
13,
1678,
396,
334,
4189,
17435,
22815,
349,
3960,
29963,
3040,
17332,
3289,
1660,
29903,
334,
4189,
2328,
13,
13,
1678,
770,
317,
1581,
29898,
4899,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3847,
1125,
13,
9651,
10480,
17255,
2344,
12035,
1311,
29897,
13,
9651,
1583,
29889,
3560,
353,
3847,
13,
9651,
1583,
29889,
21094,
353,
5852,
13,
13,
4706,
822,
1065,
29898,
1311,
1125,
13,
9651,
1550,
1583,
29889,
21094,
29901,
13,
18884,
565,
451,
1583,
29889,
3560,
29889,
9040,
29901,
13,
462,
1678,
1209,
13,
18884,
1683,
29901,
13,
462,
1678,
565,
1583,
29889,
3560,
29889,
18525,
29901,
13,
462,
4706,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
317,
2548,
29901,
426,
1012,
29876,
1642,
4830,
29898,
1311,
29889,
3560,
29889,
9040,
29961,
29900,
29901,
1311,
29889,
3560,
29889,
9040,
29889,
2248,
28909,
29876,
1495,
12622,
13,
462,
1678,
1583,
29889,
3560,
29889,
28466,
698,
29918,
4645,
29889,
23679,
29898,
1311,
29889,
3560,
3032,
7056,
29933,
4986,
2227,
29907,
29892,
1311,
29889,
3560,
29889,
9040,
29961,
29900,
29901,
1311,
29889,
3560,
29889,
9040,
29889,
2248,
28909,
29876,
1495,
2314,
13,
462,
1678,
1583,
29889,
3560,
29889,
9040,
353,
1583,
29889,
3560,
29889,
9040,
29961,
1311,
29889,
3560,
29889,
9040,
29889,
2248,
28909,
29876,
1495,
29974,
29896,
17531,
13,
462,
1678,
565,
1583,
29889,
3560,
29889,
18525,
29901,
13,
462,
4706,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
11654,
310,
6835,
426,
1012,
29876,
1642,
4830,
29898,
1311,
29889,
3560,
29889,
9040,
876,
13,
13,
1678,
396,
1094,
5439,
2038,
29892,
12545,
25566,
19988,
28397,
15873,
7191,
304,
278,
22729,
4840,
29889,
13,
1678,
396,
6426,
770,
12545,
25566,
19988,
10507,
10703,
9846,
770,
1094,
666,
10507,
29901,
13,
1678,
770,
12545,
25566,
19988,
10507,
29898,
2887,
666,
10507,
1125,
13,
4706,
3847,
353,
6213,
13,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3847,
1125,
13,
9651,
1583,
29889,
3560,
353,
3847,
13,
13,
4706,
396,
659,
338,
263,
1347,
13,
4706,
396,
14402,
29901,
11157,
1018,
4380,
13,
4706,
822,
2436,
29898,
1311,
29892,
659,
1125,
13,
9651,
396,
14402,
29901,
4635,
263,
982,
304,
1423,
14826,
278,
3957,
338,
1603,
1722,
470,
451,
13,
9651,
1018,
29901,
13,
18884,
396,
372,
27793,
263,
6835,
13,
18884,
1583,
29889,
3560,
29889,
9040,
353,
1583,
29889,
3560,
29889,
9040,
718,
659,
718,
11297,
29876,
29915,
13,
18884,
565,
1583,
29889,
3560,
29889,
18525,
29901,
13,
462,
1678,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
3387,
2665,
6571,
1642,
4830,
29898,
791,
876,
13,
9651,
5174,
8960,
408,
321,
29901,
13,
18884,
1209,
13,
13,
1678,
396,
2391,
759,
4899,
322,
2138,
4680,
4899,
526,
8762,
1494,
278,
7138,
2265,
29914,
13696,
4680,
4766,
13,
1678,
396,
319,
770,
363,
263,
13254,
393,
1303,
278,
22729,
10377,
7191,
322,
1925,
23235,
7191,
373,
263,
9521,
13,
1678,
396,
14402,
29901,
2334,
1018,
4380,
13,
1678,
770,
2391,
759,
4899,
29898,
4899,
1125,
13,
13,
4706,
9521,
353,
6213,
13,
4706,
286,
29939,
698,
29918,
4645,
353,
6213,
13,
4706,
2734,
353,
7700,
13,
4706,
21681,
353,
7700,
13,
4706,
5694,
29918,
28040,
353,
5124,
13,
13,
4706,
396,
20831,
292,
5823,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
9521,
29892,
286,
29939,
698,
29918,
4645,
29892,
2734,
29892,
4744,
29892,
1014,
13010,
1125,
13,
9651,
10480,
17255,
2344,
12035,
1311,
29897,
13,
9651,
1583,
29889,
9990,
353,
9521,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
353,
286,
29939,
698,
29918,
4645,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
29889,
265,
29918,
4906,
353,
1583,
29889,
265,
29918,
4906,
396,
6939,
13,
9651,
1583,
29889,
28466,
698,
29918,
4645,
29889,
19496,
29898,
13010,
29922,
1491,
13010,
29897,
13,
9651,
1583,
29889,
21094,
353,
2734,
13,
9651,
1583,
29889,
18525,
353,
4744,
13,
9651,
565,
1583,
29889,
18525,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
13254,
3244,
1889,
2825,
320,
29876,
1159,
13,
13,
4706,
396,
565,
4312,
29892,
12088,
674,
17726,
278,
2425,
2768,
1065,
1158,
13,
4706,
822,
12088,
29898,
1311,
1125,
13,
9651,
1583,
29889,
21094,
353,
7700,
13,
13,
4706,
396,
450,
6939,
363,
746,
263,
349,
7466,
29931,
3235,
29950,
2643,
338,
4520,
515,
278,
1923,
29889,
13,
4706,
822,
373,
29918,
4906,
29898,
1311,
29892,
3132,
29892,
1404,
1272,
29892,
10191,
1125,
13,
9651,
565,
451,
10191,
29889,
23813,
29901,
13,
18884,
1209,
13,
9651,
1683,
29901,
13,
18884,
5694,
353,
10191,
29889,
23813,
29889,
13808,
877,
9420,
29899,
29947,
1495,
13,
18884,
1583,
29889,
9990,
29889,
649,
29898,
7382,
29897,
13,
18884,
565,
1583,
29889,
18525,
29901,
13,
462,
1678,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
24328,
2347,
426,
1012,
29876,
1642,
4830,
29898,
7382,
876,
13,
13,
1678,
396,
319,
770,
393,
13623,
278,
9521,
322,
6826,
278,
1889,
4290,
1158,
310,
278,
319,
11936,
4032,
29889,
13,
1678,
770,
2138,
4680,
4899,
29898,
4899,
1125,
13,
13,
4706,
9521,
353,
6213,
13,
4706,
408,
666,
353,
6213,
13,
4706,
2734,
353,
7700,
13,
4706,
21681,
353,
7700,
13,
13,
4706,
396,
20831,
292,
5823,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
9521,
29892,
408,
666,
29892,
2734,
29892,
4744,
1125,
13,
9651,
10480,
17255,
2344,
12035,
1311,
29897,
13,
9651,
1583,
29889,
9990,
353,
9521,
13,
9651,
1583,
29889,
294,
666,
353,
408,
666,
13,
9651,
1583,
29889,
21094,
353,
2734,
13,
9651,
1583,
29889,
18525,
353,
4744,
13,
9651,
565,
1583,
29889,
18525,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
703,
18525,
29901,
21691,
3244,
2825,
320,
29876,
1159,
13,
13,
4706,
396,
565,
4312,
29892,
12088,
674,
17726,
278,
2425,
2768,
1065,
1158,
13,
4706,
822,
12088,
29898,
1311,
1125,
13,
9651,
1583,
29889,
21094,
353,
7700,
13,
13,
4706,
396,
20831,
292,
1065,
1158,
29892,
3244,
6354,
13,
4706,
822,
1065,
29898,
1311,
1125,
13,
9651,
1550,
1583,
29889,
21094,
29901,
13,
18884,
5694,
353,
1583,
29889,
9990,
29889,
657,
580,
13,
18884,
1583,
29889,
294,
666,
29889,
5014,
29918,
2080,
29898,
7382,
29897,
13,
18884,
1583,
29889,
9990,
29889,
7662,
29918,
15091,
580,
13,
13,
1678,
396,
334,
4189,
17435,
11056,
349,
3960,
29963,
3040,
17332,
3289,
1660,
29903,
334,
4189,
2328,
2
] |
TestHowToUse/test_voting.py | GavrilovMike/EnsembleLearning | 0 | 66693 | <reponame>GavrilovMike/EnsembleLearning
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier, VotingClassifier
clf1 = LogisticRegression(multi_class='multinomial', random_state=1)
clf2 = RandomForestClassifier(n_estimators=50, random_state=1)
clf3 = GaussianNB()
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 2])
eclf1 = VotingClassifier(estimators=[
('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='hard')
eclf1 = eclf1.fit(X, y)
print(eclf1.predict(X))
np.array_equal(eclf1.named_estimators_.lr.predict(X),
eclf1.named_estimators_['lr'].predict(X))
eclf2 = VotingClassifier(estimators=[
('lr', clf1), ('rf', clf2), ('gnb', clf3)],
voting='soft')
eclf2 = eclf2.fit(X, y)
print(eclf2.predict(X))
eclf3 = VotingClassifier(estimators=[
('lr', clf1), ('rf', clf2), ('gnb', clf3)],
voting='soft', weights=[2,1,1],
flatten_transform=True)
eclf3 = eclf3.fit(X, y)
print(eclf3.predict(X))
print(eclf3.transform(X).shape) | [
1,
529,
276,
1112,
420,
29958,
29954,
485,
4115,
586,
29924,
9345,
29914,
29923,
1983,
6967,
29931,
799,
1076,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
19668,
29889,
10660,
29918,
4299,
1053,
4522,
4695,
4597,
23881,
13,
3166,
2071,
19668,
29889,
1056,
573,
29918,
27495,
267,
1053,
22477,
23189,
13,
3166,
2071,
19668,
29889,
24031,
1053,
16968,
2831,
342,
2385,
3709,
29892,
478,
11427,
2385,
3709,
13,
695,
29888,
29896,
353,
4522,
4695,
4597,
23881,
29898,
9910,
29918,
1990,
2433,
4713,
262,
7615,
742,
4036,
29918,
3859,
29922,
29896,
29897,
13,
695,
29888,
29906,
353,
16968,
2831,
342,
2385,
3709,
29898,
29876,
29918,
342,
326,
4097,
29922,
29945,
29900,
29892,
4036,
29918,
3859,
29922,
29896,
29897,
13,
695,
29888,
29941,
353,
22477,
23189,
580,
13,
29990,
353,
7442,
29889,
2378,
4197,
14352,
29896,
29892,
448,
29896,
1402,
21069,
29906,
29892,
448,
29896,
1402,
21069,
29941,
29892,
448,
29906,
1402,
518,
29896,
29892,
29871,
29896,
1402,
518,
29906,
29892,
29871,
29896,
1402,
518,
29941,
29892,
29871,
29906,
24960,
13,
29891,
353,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
2314,
13,
687,
29880,
29888,
29896,
353,
478,
11427,
2385,
3709,
29898,
342,
326,
4097,
11759,
13,
4706,
6702,
29212,
742,
1067,
29888,
29896,
511,
6702,
9600,
742,
1067,
29888,
29906,
511,
6702,
5138,
29890,
742,
1067,
29888,
29941,
29897,
1402,
28931,
2433,
6800,
1495,
13,
687,
29880,
29888,
29896,
353,
321,
695,
29888,
29896,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
2158,
29898,
687,
29880,
29888,
29896,
29889,
27711,
29898,
29990,
876,
13,
13,
9302,
29889,
2378,
29918,
11745,
29898,
687,
29880,
29888,
29896,
29889,
17514,
29918,
342,
326,
4097,
5396,
29212,
29889,
27711,
29898,
29990,
511,
13,
1669,
321,
695,
29888,
29896,
29889,
17514,
29918,
342,
326,
4097,
29918,
1839,
29212,
13359,
27711,
29898,
29990,
876,
13,
13,
687,
29880,
29888,
29906,
353,
478,
11427,
2385,
3709,
29898,
342,
326,
4097,
11759,
13,
4706,
6702,
29212,
742,
1067,
29888,
29896,
511,
6702,
9600,
742,
1067,
29888,
29906,
511,
6702,
5138,
29890,
742,
1067,
29888,
29941,
29897,
1402,
13,
4706,
28931,
2433,
2695,
1495,
13,
687,
29880,
29888,
29906,
353,
321,
695,
29888,
29906,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
2158,
29898,
687,
29880,
29888,
29906,
29889,
27711,
29898,
29990,
876,
13,
13,
687,
29880,
29888,
29941,
353,
478,
11427,
2385,
3709,
29898,
342,
326,
4097,
11759,
13,
539,
6702,
29212,
742,
1067,
29888,
29896,
511,
6702,
9600,
742,
1067,
29888,
29906,
511,
6702,
5138,
29890,
742,
1067,
29888,
29941,
29897,
1402,
13,
539,
28931,
2433,
2695,
742,
18177,
11759,
29906,
29892,
29896,
29892,
29896,
1402,
13,
539,
1652,
8606,
29918,
9067,
29922,
5574,
29897,
13,
687,
29880,
29888,
29941,
353,
321,
695,
29888,
29941,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
2158,
29898,
687,
29880,
29888,
29941,
29889,
27711,
29898,
29990,
876,
13,
13,
2158,
29898,
687,
29880,
29888,
29941,
29889,
9067,
29898,
29990,
467,
12181,
29897,
2
] |
serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | 0 | 8353 | <filename>serverPythonClient/client.py
import argparse
import cv2
import common
# from .utils.cropAtCenter import cropImageCenter
# from cropAtCenter import cropImageCenter
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.opencv_adapter import OpencvAdapter
DEFAULT_SERVER_HOST = '172.16.31.10'
DEFAULT_ZOOM_FACTOR = 10
def preprocess(frame):
# return frame
print(type(frame), frame.shape)
width, height = frame.shape[1], frame.shape[0]
left = int(width/2 * (1 - 1/DEFAULT_ZOOM_FACTOR))
top = int(height/2 * (1 - 1/DEFAULT_ZOOM_FACTOR))
right = int(width/2 * (1 + 1/DEFAULT_ZOOM_FACTOR))
bottom = int(height/2 * (1 + 1/DEFAULT_ZOOM_FACTOR))
cropped_frame = frame[top:bottom, left:right]
return cropped_frame
def produce_extras():
return None
def consume_frame(frame, _):
cv2.imshow('Image from server', frame)
cv2.waitKey(1)
def main():
common.configure_logging()
parser = argparse.ArgumentParser()
parser.add_argument(
'source_name', nargs='?', default=common.DEFAULT_SOURCE_NAME)
parser.add_argument('server_host', nargs='?', default=DEFAULT_SERVER_HOST)
args = parser.parse_args()
capture = cv2.VideoCapture(0)
opencv_adapter = OpencvAdapter(
preprocess, produce_extras, consume_frame, capture, args.source_name)
client = WebsocketClient(
args.server_host, common.WEBSOCKET_PORT,
opencv_adapter.get_producer_wrappers(), opencv_adapter.consumer)
client.launch()
if __name__ == '__main__':
main()
| [
1,
529,
9507,
29958,
2974,
11980,
4032,
29914,
4645,
29889,
2272,
13,
5215,
1852,
5510,
13,
5215,
13850,
29906,
13,
13,
5215,
3619,
13,
29937,
515,
869,
13239,
29889,
29883,
1336,
4178,
13409,
1053,
274,
1336,
2940,
13409,
13,
29937,
515,
274,
1336,
4178,
13409,
1053,
274,
1336,
2940,
13409,
13,
13,
3166,
11880,
12836,
29918,
4645,
29889,
2676,
11514,
29918,
4645,
1053,
2563,
11514,
4032,
13,
3166,
11880,
12836,
29918,
4645,
29889,
3150,
11023,
29918,
21412,
1053,
4673,
11023,
6168,
13,
13,
23397,
29918,
18603,
29918,
20832,
353,
525,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29941,
29896,
29889,
29896,
29900,
29915,
13,
23397,
29918,
29999,
29949,
6488,
29918,
4519,
1783,
1955,
353,
29871,
29896,
29900,
13,
13,
1753,
758,
5014,
29898,
2557,
1125,
13,
1678,
396,
736,
3515,
13,
13,
1678,
1596,
29898,
1853,
29898,
2557,
511,
3515,
29889,
12181,
29897,
13,
13,
1678,
2920,
29892,
3171,
353,
3515,
29889,
12181,
29961,
29896,
1402,
3515,
29889,
12181,
29961,
29900,
29962,
13,
13,
1678,
2175,
353,
938,
29898,
2103,
29914,
29906,
334,
313,
29896,
448,
29871,
29896,
29914,
23397,
29918,
29999,
29949,
6488,
29918,
4519,
1783,
1955,
876,
13,
1678,
2246,
353,
938,
29898,
3545,
29914,
29906,
334,
313,
29896,
448,
29871,
29896,
29914,
23397,
29918,
29999,
29949,
6488,
29918,
4519,
1783,
1955,
876,
13,
1678,
1492,
353,
938,
29898,
2103,
29914,
29906,
334,
313,
29896,
718,
29871,
29896,
29914,
23397,
29918,
29999,
29949,
6488,
29918,
4519,
1783,
1955,
876,
13,
1678,
5970,
353,
938,
29898,
3545,
29914,
29906,
334,
313,
29896,
718,
29871,
29896,
29914,
23397,
29918,
29999,
29949,
6488,
29918,
4519,
1783,
1955,
876,
13,
13,
1678,
8182,
2986,
29918,
2557,
353,
3515,
29961,
3332,
29901,
8968,
29892,
2175,
29901,
1266,
29962,
13,
1678,
736,
8182,
2986,
29918,
2557,
13,
13,
13,
1753,
7738,
29918,
1062,
3417,
7295,
13,
1678,
736,
6213,
13,
13,
13,
1753,
29151,
29918,
2557,
29898,
2557,
29892,
903,
1125,
13,
1678,
13850,
29906,
29889,
326,
4294,
877,
2940,
515,
1923,
742,
3515,
29897,
13,
1678,
13850,
29906,
29889,
10685,
2558,
29898,
29896,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
3619,
29889,
17591,
29918,
21027,
580,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
525,
4993,
29918,
978,
742,
302,
5085,
2433,
29973,
742,
2322,
29922,
9435,
29889,
23397,
29918,
27839,
4741,
29918,
5813,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
2974,
29918,
3069,
742,
302,
5085,
2433,
29973,
742,
2322,
29922,
23397,
29918,
18603,
29918,
20832,
29897,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
10446,
353,
13850,
29906,
29889,
15167,
21133,
545,
29898,
29900,
29897,
13,
1678,
1722,
11023,
29918,
21412,
353,
4673,
11023,
6168,
29898,
13,
4706,
758,
5014,
29892,
7738,
29918,
1062,
3417,
29892,
29151,
29918,
2557,
29892,
10446,
29892,
6389,
29889,
4993,
29918,
978,
29897,
13,
13,
1678,
3132,
353,
2563,
11514,
4032,
29898,
13,
4706,
6389,
29889,
2974,
29918,
3069,
29892,
3619,
29889,
8851,
29933,
6156,
7077,
2544,
29918,
15082,
29892,
13,
4706,
1722,
11023,
29918,
21412,
29889,
657,
29918,
5498,
2265,
29918,
29893,
336,
22437,
3285,
1722,
11023,
29918,
21412,
29889,
25978,
261,
29897,
13,
1678,
3132,
29889,
15343,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
P25010-Guangzhou-Jiachengwu/week5/ex_random2.py | coachafei/python-25 | 1 | 91715 | # 已知仓库中有若干商品,以及相应库存,类似:
# 袜子,10
# 鞋子,20
# 拖鞋,30
# 项链,40
# 要求随机返回一种商品,要求商品被返回的概率与其库存成正比。请描述实现的思路或者直接写一个实现的函数
import random
def randpick(n):
socks = ['wz'] * 10 * n
shoes = ['xz'] * 20 * n
slippers = ['tx'] * 30 * n
necklace = ['xl'] * 40 * n
for_all = socks + shoes + slippers + necklace
count={'wz':0,'xz':0,'tx':0,'xl':0}
for i in random.sample(for_all,n):
count[i]+=1
return count
a=randpick(10)
print(a)
a=randpick(210)
print(a)
a=randpick(230)
print(a)
a=randpick(440)
print(a)
a=randpick(500)
print(a)
a=randpick(5000)
print(a) | [
1,
396,
29871,
31290,
31043,
231,
190,
150,
31700,
30275,
30417,
31653,
232,
188,
181,
31427,
31399,
30214,
30651,
31436,
30990,
31370,
31700,
30946,
30214,
30832,
231,
191,
191,
30383,
13,
29937,
29871,
235,
165,
159,
30319,
30214,
29896,
29900,
13,
29937,
29871,
236,
161,
142,
30319,
30214,
29906,
29900,
13,
29937,
29871,
233,
142,
153,
236,
161,
142,
30214,
29941,
29900,
13,
29937,
29871,
31888,
236,
150,
193,
30214,
29946,
29900,
13,
29937,
29871,
30698,
31376,
236,
157,
146,
31429,
31086,
30742,
30287,
31893,
31427,
31399,
30214,
30698,
31376,
31427,
31399,
31407,
31086,
30742,
30210,
233,
169,
133,
234,
145,
138,
31267,
31149,
31700,
30946,
30494,
30724,
31419,
30267,
31088,
233,
146,
146,
235,
194,
179,
31195,
31424,
30210,
31579,
30874,
31391,
30767,
31157,
31092,
31479,
30287,
30502,
31195,
31424,
30210,
31629,
30354,
13,
13,
5215,
4036,
13,
13,
1753,
20088,
23945,
29898,
29876,
1125,
13,
1678,
577,
4684,
353,
6024,
29893,
29920,
2033,
334,
29871,
29896,
29900,
334,
302,
13,
1678,
17394,
267,
353,
6024,
29916,
29920,
2033,
334,
29871,
29906,
29900,
334,
302,
13,
1678,
20662,
22437,
353,
6024,
7508,
2033,
334,
29871,
29941,
29900,
334,
302,
13,
1678,
18873,
1265,
353,
6024,
15524,
2033,
334,
29871,
29946,
29900,
334,
302,
13,
1678,
363,
29918,
497,
353,
577,
4684,
718,
17394,
267,
718,
20662,
22437,
718,
18873,
1265,
13,
13,
1678,
2302,
3790,
29915,
29893,
29920,
2396,
29900,
5501,
29916,
29920,
2396,
29900,
5501,
7508,
2396,
29900,
5501,
15524,
2396,
29900,
29913,
13,
1678,
363,
474,
297,
4036,
29889,
11249,
29898,
1454,
29918,
497,
29892,
29876,
1125,
13,
4706,
2302,
29961,
29875,
10062,
29922,
29896,
13,
13,
1678,
736,
2302,
13,
13,
13,
13,
29874,
29922,
9502,
23945,
29898,
29896,
29900,
29897,
13,
2158,
29898,
29874,
29897,
13,
29874,
29922,
9502,
23945,
29898,
29906,
29896,
29900,
29897,
13,
2158,
29898,
29874,
29897,
13,
29874,
29922,
9502,
23945,
29898,
29906,
29941,
29900,
29897,
13,
2158,
29898,
29874,
29897,
13,
29874,
29922,
9502,
23945,
29898,
29946,
29946,
29900,
29897,
13,
2158,
29898,
29874,
29897,
13,
29874,
29922,
9502,
23945,
29898,
29945,
29900,
29900,
29897,
13,
2158,
29898,
29874,
29897,
13,
29874,
29922,
9502,
23945,
29898,
29945,
29900,
29900,
29900,
29897,
13,
2158,
29898,
29874,
29897,
2
] |
crosscompute/macros/package.py | kashfifahim/crosscompute | 0 | 101078 | from importlib import import_module
def import_attribute(attribute_string):
module_string, attribute_name = attribute_string.rsplit('.', maxsplit=1)
return getattr(import_module(module_string), attribute_name)
| [
1,
515,
1053,
1982,
1053,
1053,
29918,
5453,
13,
13,
13,
1753,
1053,
29918,
12715,
29898,
12715,
29918,
1807,
1125,
13,
1678,
3883,
29918,
1807,
29892,
5352,
29918,
978,
353,
5352,
29918,
1807,
29889,
2288,
2830,
12839,
742,
4236,
5451,
29922,
29896,
29897,
13,
1678,
736,
679,
5552,
29898,
5215,
29918,
5453,
29898,
5453,
29918,
1807,
511,
5352,
29918,
978,
29897,
13,
2
] |
CONTENT/DS-n-Algos/ALGO/__PYTHON/celeb.py | Web-Dev-Collaborative/DS-ALGO-OFFICIAL | 11 | 1036 | <reponame>Web-Dev-Collaborative/DS-ALGO-OFFICIAL<gh_stars>10-100
def orangesRotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
rotten.append((i, j))
mins = 0
def dfs(rotten):
count = []
for i, j in rotten:
if i > 0 and rotten[i - 1][j] == 1:
count.append((i - 1, j))
elemnts[i - 1][j] = 2
if j > 0 and rotten[i][j - 1] == 1:
count.append((i, j - 1))
elemnts[i][j - 1] = 2
if i < n - 1 and rotten[i][j] == 1:
count.append((i, j))
elemnts[i][j] = 2
if j < m - 1 and rotten[i][j] == 1:
count.append((i, j))
elemnts[i][j] = 2
return count
while rotten:
rotten = dfs(rotten)
if not rotten:
break
mins += 1
for i in range(n):
for j in range(m):
if elemnts[i][j] == 1:
return -1
return mins
| [
1,
529,
276,
1112,
420,
29958,
3609,
29899,
16618,
29899,
28377,
3717,
1230,
29914,
8452,
29899,
1964,
17080,
29899,
27681,
2965,
25758,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
1753,
470,
6916,
21281,
1259,
29898,
20461,
593,
29879,
1125,
30004,
13,
1678,
565,
451,
21268,
593,
29879,
470,
7431,
29898,
20461,
593,
29879,
29897,
1275,
29871,
29900,
29901,
30004,
13,
4706,
736,
29871,
29900,
30004,
13,
1678,
302,
353,
7431,
29898,
20461,
593,
29879,
8443,
13,
1678,
286,
353,
7431,
29898,
20461,
593,
29879,
29961,
29900,
2314,
30004,
13,
1678,
696,
698,
264,
353,
5159,
30004,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
1125,
30004,
13,
4706,
363,
432,
297,
3464,
29898,
29885,
1125,
30004,
13,
9651,
565,
21268,
593,
29879,
29961,
29875,
3816,
29926,
29962,
1275,
29871,
29906,
29901,
30004,
13,
18884,
696,
698,
264,
29889,
4397,
3552,
29875,
29892,
432,
876,
30004,
13,
1678,
286,
1144,
353,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
4489,
29879,
29898,
26970,
264,
1125,
30004,
13,
4706,
2302,
353,
5159,
30004,
13,
4706,
363,
474,
29892,
432,
297,
696,
698,
264,
29901,
30004,
13,
9651,
565,
474,
1405,
29871,
29900,
322,
696,
698,
264,
29961,
29875,
448,
29871,
29896,
3816,
29926,
29962,
1275,
29871,
29896,
29901,
30004,
13,
18884,
2302,
29889,
4397,
3552,
29875,
448,
29871,
29896,
29892,
432,
876,
30004,
13,
18884,
21268,
593,
29879,
29961,
29875,
448,
29871,
29896,
3816,
29926,
29962,
353,
29871,
29906,
30004,
13,
30004,
13,
9651,
565,
432,
1405,
29871,
29900,
322,
696,
698,
264,
29961,
29875,
3816,
29926,
448,
29871,
29896,
29962,
1275,
29871,
29896,
29901,
30004,
13,
18884,
2302,
29889,
4397,
3552,
29875,
29892,
432,
448,
29871,
29896,
876,
30004,
13,
18884,
21268,
593,
29879,
29961,
29875,
3816,
29926,
448,
29871,
29896,
29962,
353,
29871,
29906,
30004,
13,
30004,
13,
9651,
565,
474,
529,
302,
448,
29871,
29896,
322,
696,
698,
264,
29961,
29875,
3816,
29926,
29962,
1275,
29871,
29896,
29901,
30004,
13,
18884,
2302,
29889,
4397,
3552,
29875,
29892,
432,
876,
30004,
13,
18884,
21268,
593,
29879,
29961,
29875,
3816,
29926,
29962,
353,
29871,
29906,
30004,
13,
30004,
13,
9651,
565,
432,
529,
286,
448,
29871,
29896,
322,
696,
698,
264,
29961,
29875,
3816,
29926,
29962,
1275,
29871,
29896,
29901,
30004,
13,
18884,
2302,
29889,
4397,
3552,
29875,
29892,
432,
876,
30004,
13,
18884,
21268,
593,
29879,
29961,
29875,
3816,
29926,
29962,
353,
29871,
29906,
30004,
13,
30004,
13,
4706,
736,
2302,
30004,
13,
30004,
13,
1678,
1550,
696,
698,
264,
29901,
30004,
13,
4706,
696,
698,
264,
353,
4489,
29879,
29898,
26970,
264,
8443,
13,
4706,
565,
451,
696,
698,
264,
29901,
30004,
13,
9651,
2867,
30004,
13,
4706,
286,
1144,
4619,
29871,
29896,
30004,
13,
30004,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
1125,
30004,
13,
4706,
363,
432,
297,
3464,
29898,
29885,
1125,
30004,
13,
9651,
565,
21268,
593,
29879,
29961,
29875,
3816,
29926,
29962,
1275,
29871,
29896,
29901,
30004,
13,
18884,
736,
448,
29896,
30004,
13,
30004,
13,
1678,
736,
286,
1144,
30004,
13,
2
] |
crawler.py | wladimir-computin/LibScout-Crawler | 1 | 134737 | <reponame>wladimir-computin/LibScout-Crawler
import sqlite3
import sys
import os
import re
database = "lib_stats.db"
if os.path.exists(database):
os.remove(database)
conn = sqlite3.connect(database)
class Libset:
name = ""
category = ""
version = ""
release_date = ""
old_version = False
root_package = ""
fullmatch = False
comment = ""
class Appset:
filename = ""
packagename = ""
version = ""
vendor = ""
i = 0
currentvendor = ""
def analyze(contents):
app = classifyApp(contents)
c = conn.cursor()
c.execute("insert into apps values (?, ?, ?, ?)", (app.packagename, app.filename, app.version, app.vendor))
istart = contents.find("== Report ==")
contents = contents[istart:]
ifull = contents.find("- Full library matches:")
ipartial = contents.find("- Partial library matches:")
fullmatch = contents[ifull:ipartial]
partmatch = contents[ipartial:]
fullmatch = fullmatch.split("name:")
partmatch = partmatch.split("name:")
add(app.filename, fullmatch, True)
add(app.filename, partmatch, False)
def add(filename, matches, fullmatch):
global i
c = conn.cursor()
for match in matches:
if "category" in match:
result = classifyLib("name:" + match)
result.fullmatch = fullmatch
c.execute("insert into libs values (?, ?, ?, ?, ?, ?, ?, ?, ?)", (i, result.name, result.category, result.version, result.release_date, result.old_version, result.root_package, result.fullmatch, result.comment))
c.execute("insert into relations values (?, ?)", (filename, i))
i += 1
def classifyApp(contents):
app = Appset()
m = re.search("Package name:\s+(.+)", contents)
app.packagename = m.group(1)
if "LibraryIdentifier" in app.packagename:
app.packagename = "error"
m = re.search("Process app:\s+(.+)", contents)
app.filename = m.group(1)
m = re.search("Version code:\s+(.+)", contents)
app.version = m.group(1)
app.vendor = currentvendor
return app
def classifyLib(split):
out = Libset()
m = re.search("name:\s+(.*)", split)
out.name = m.group(1)
m = re.search("category:\s+(.*)", split)
out.category = m.group(1)
m = re.search("version:\s+(.*?)\s+(\[OLD VERSION\])?", split)
out.version = m.group(1)
if m.group(2):
out.old_version = True
m = re.search("release-date:\s+(.*)", split)
out.release_date = m.group(1)
m = re.search("lib root package:\s+(.*)", split)
out.root_package = m.group(1)
m = re.search("comment:\s+(.*)", split)
if(m):
out.comment = m.group(1)
return out
def main():
c = conn.cursor()
c.execute('''CREATE TABLE apps (package text, filename text, version number, vendor text)''')
c.execute('''CREATE TABLE relations (filename text, lib_id integer)''')
c.execute('''CREATE TABLE libs (lib_id integer primary key, name text, category text, version text, release_date text, old_version bool, root_package text, fullmatch bool, comment text)''')
global currentvendor
for folder in sys.argv:
if currentvendor == "":
currentvendor = "test"
continue
else:
currentvendor = folder
for fn in os.listdir(folder):
with open(folder + "/" + fn) as f:
s = f.read()
analyze(s)
conn.commit()
if __name__ == "__main__":
main()
| [
1,
529,
276,
1112,
420,
29958,
29893,
4528,
17216,
29899,
12097,
262,
29914,
14868,
4421,
449,
29899,
29907,
1610,
1358,
13,
5215,
21120,
29941,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
337,
13,
9803,
353,
376,
1982,
29918,
16202,
29889,
2585,
29908,
13,
12,
13,
361,
2897,
29889,
2084,
29889,
9933,
29898,
9803,
1125,
13,
1678,
2897,
29889,
5992,
29898,
9803,
29897,
13,
268,
13,
13082,
353,
21120,
29941,
29889,
6915,
29898,
9803,
29897,
13,
13,
1990,
8153,
842,
29901,
13,
12,
978,
353,
5124,
13,
12,
7320,
353,
5124,
13,
12,
3259,
353,
5124,
13,
12,
14096,
29918,
1256,
353,
5124,
13,
12,
1025,
29918,
3259,
353,
7700,
13,
12,
4632,
29918,
5113,
353,
5124,
13,
12,
8159,
4352,
353,
7700,
13,
12,
9342,
353,
5124,
13,
12,
13,
1990,
2401,
842,
29901,
13,
12,
9507,
353,
5124,
13,
12,
4058,
351,
3871,
353,
5124,
13,
12,
3259,
353,
5124,
13,
12,
19167,
353,
5124,
13,
12,
13,
29875,
353,
29871,
29900,
13,
3784,
19167,
353,
5124,
13,
13,
1753,
27599,
29898,
10853,
1125,
13,
12,
13,
12,
932,
353,
770,
1598,
2052,
29898,
10853,
29897,
13,
12,
13,
12,
29883,
353,
11009,
29889,
18127,
580,
13,
12,
29883,
29889,
7978,
703,
7851,
964,
11446,
1819,
313,
14579,
1577,
29892,
1577,
29892,
1577,
19123,
313,
932,
29889,
4058,
351,
3871,
29892,
623,
29889,
9507,
29892,
623,
29889,
3259,
29892,
623,
29889,
19167,
876,
13,
12,
13,
12,
391,
442,
353,
8118,
29889,
2886,
703,
1360,
13969,
353,
543,
29897,
13,
12,
10853,
353,
8118,
29961,
391,
442,
17531,
13,
12,
361,
913,
353,
8118,
29889,
2886,
703,
29899,
14846,
3489,
7087,
29901,
1159,
13,
12,
27494,
616,
353,
8118,
29889,
2886,
703,
29899,
3455,
616,
3489,
7087,
29901,
1159,
13,
12,
8159,
4352,
353,
8118,
29961,
361,
913,
29901,
27494,
616,
29962,
13,
12,
1595,
4352,
353,
8118,
29961,
27494,
616,
17531,
13,
12,
13,
12,
8159,
4352,
353,
2989,
4352,
29889,
5451,
703,
978,
29901,
1159,
13,
12,
1595,
4352,
353,
760,
4352,
29889,
5451,
703,
978,
29901,
1159,
13,
12,
13,
12,
1202,
29898,
932,
29889,
9507,
29892,
2989,
4352,
29892,
5852,
29897,
13,
12,
1202,
29898,
932,
29889,
9507,
29892,
760,
4352,
29892,
7700,
29897,
13,
12,
12,
12,
13,
13,
1753,
788,
29898,
9507,
29892,
7087,
29892,
2989,
4352,
1125,
13,
12,
10945,
474,
13,
12,
29883,
353,
11009,
29889,
18127,
580,
13,
12,
1454,
1993,
297,
7087,
29901,
13,
12,
12,
361,
376,
7320,
29908,
297,
1993,
29901,
13,
12,
12,
12,
2914,
353,
770,
1598,
14868,
703,
978,
6160,
718,
1993,
29897,
13,
12,
12,
12,
2914,
29889,
8159,
4352,
353,
2989,
4352,
13,
12,
12,
12,
29883,
29889,
7978,
703,
7851,
964,
4303,
29879,
1819,
313,
14579,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
29892,
1577,
19123,
313,
29875,
29892,
1121,
29889,
978,
29892,
1121,
29889,
7320,
29892,
1121,
29889,
3259,
29892,
1121,
29889,
14096,
29918,
1256,
29892,
1121,
29889,
1025,
29918,
3259,
29892,
1121,
29889,
4632,
29918,
5113,
29892,
1121,
29889,
8159,
4352,
29892,
1121,
29889,
9342,
876,
13,
12,
12,
12,
29883,
29889,
7978,
703,
7851,
964,
5302,
1819,
313,
14579,
1577,
19123,
313,
9507,
29892,
474,
876,
13,
12,
12,
12,
29875,
4619,
29871,
29896,
13,
13,
1753,
770,
1598,
2052,
29898,
10853,
1125,
13,
12,
932,
353,
2401,
842,
580,
13,
12,
13,
12,
13,
12,
29885,
353,
337,
29889,
4478,
703,
14459,
1024,
3583,
29879,
29974,
11891,
29974,
19123,
8118,
29897,
13,
12,
932,
29889,
4058,
351,
3871,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
361,
376,
12284,
12889,
29908,
297,
623,
29889,
4058,
351,
3871,
29901,
13,
12,
12,
932,
29889,
4058,
351,
3871,
353,
376,
2704,
29908,
13,
12,
29885,
353,
337,
29889,
4478,
703,
7032,
623,
3583,
29879,
29974,
11891,
29974,
19123,
8118,
29897,
13,
12,
932,
29889,
9507,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
29885,
353,
337,
29889,
4478,
703,
6594,
775,
3583,
29879,
29974,
11891,
29974,
19123,
8118,
29897,
13,
12,
932,
29889,
3259,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
932,
29889,
19167,
353,
1857,
19167,
13,
12,
13,
12,
2457,
623,
13,
13,
1753,
770,
1598,
14868,
29898,
5451,
1125,
13,
12,
449,
353,
8153,
842,
580,
13,
12,
29885,
353,
337,
29889,
4478,
703,
978,
3583,
29879,
17108,
5575,
19123,
6219,
29897,
13,
12,
449,
29889,
978,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
29885,
353,
337,
29889,
4478,
703,
7320,
3583,
29879,
17108,
5575,
19123,
6219,
29897,
13,
12,
449,
29889,
7320,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
29885,
353,
337,
29889,
4478,
703,
3259,
3583,
29879,
17108,
5575,
29973,
2144,
29879,
29974,
1194,
29961,
5607,
29928,
478,
1001,
13381,
29905,
2314,
29973,
613,
6219,
29897,
13,
12,
449,
29889,
3259,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
361,
286,
29889,
2972,
29898,
29906,
1125,
13,
12,
12,
449,
29889,
1025,
29918,
3259,
353,
5852,
13,
12,
29885,
353,
337,
29889,
4478,
703,
14096,
29899,
1256,
3583,
29879,
17108,
5575,
19123,
6219,
29897,
13,
12,
449,
29889,
14096,
29918,
1256,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
29885,
353,
337,
29889,
4478,
703,
1982,
3876,
3577,
3583,
29879,
17108,
5575,
19123,
6219,
29897,
13,
12,
449,
29889,
4632,
29918,
5113,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
29885,
353,
337,
29889,
4478,
703,
9342,
3583,
29879,
17108,
5575,
19123,
6219,
29897,
13,
12,
361,
29898,
29885,
1125,
13,
12,
12,
449,
29889,
9342,
353,
286,
29889,
2972,
29898,
29896,
29897,
13,
12,
13,
12,
2457,
714,
13,
12,
13,
12,
13,
12,
13,
1753,
1667,
7295,
13,
12,
13,
12,
29883,
353,
11009,
29889,
18127,
580,
13,
12,
29883,
29889,
7978,
877,
4907,
27045,
10911,
11446,
313,
5113,
1426,
29892,
10422,
1426,
29892,
1873,
1353,
29892,
27042,
1426,
29897,
4907,
1495,
13,
12,
29883,
29889,
7978,
877,
4907,
27045,
10911,
5302,
313,
9507,
1426,
29892,
4303,
29918,
333,
6043,
29897,
4907,
1495,
13,
12,
29883,
29889,
7978,
877,
4907,
27045,
10911,
4303,
29879,
313,
1982,
29918,
333,
6043,
7601,
1820,
29892,
1024,
1426,
29892,
7663,
1426,
29892,
1873,
1426,
29892,
6507,
29918,
1256,
1426,
29892,
2030,
29918,
3259,
6120,
29892,
3876,
29918,
5113,
1426,
29892,
2989,
4352,
6120,
29892,
3440,
1426,
29897,
4907,
1495,
13,
12,
10945,
1857,
19167,
13,
12,
1454,
4138,
297,
10876,
29889,
19218,
29901,
13,
12,
12,
361,
1857,
19167,
1275,
376,
1115,
13,
12,
12,
12,
3784,
19167,
353,
376,
1688,
29908,
13,
12,
12,
12,
19878,
13,
12,
12,
2870,
29901,
13,
12,
12,
12,
3784,
19167,
353,
4138,
13,
12,
12,
1454,
7876,
297,
2897,
29889,
1761,
3972,
29898,
12083,
1125,
13,
12,
12,
12,
2541,
1722,
29898,
12083,
718,
5591,
29908,
718,
7876,
29897,
408,
285,
29901,
13,
12,
12,
12,
12,
29879,
353,
285,
29889,
949,
580,
13,
12,
12,
12,
12,
24209,
911,
29898,
29879,
29897,
13,
12,
12,
13082,
29889,
15060,
580,
13,
12,
12,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
12,
3396,
580,
13,
2
] |
NURBSDiff/curve_eval.py | idealab-isu/NURBSDiff | 4 | 174065 | <filename>NURBSDiff/curve_eval.py
import torch
import numpy as np
from torch import nn
from torch.autograd import Function
from torch.autograd import Variable
from NURBSDiff.curve_eval_cpp import forward as cpp_forward, backward as cpp_backward, pre_compute_basis as cpp_pre_compute_basis
from NURBSDiff.curve_eval_cuda import pre_compute_basis, forward, backward
from .utils import gen_knot_vector
torch.manual_seed(120)
class CurveEval(torch.nn.Module):
"""
We can implement our own custom autograd Functions by subclassing
torch.autograd.Function and implementing the forward and backward passes
which operate on Tensors.
"""
def __init__(self, m, knot_v=None, dimension=3, p=2, out_dim=32, method='tc', dvc='cuda'):
super(CurveEval, self).__init__()
self.m = m
self._dimension = dimension
self.p = p
if knot_v is not None:
self.U = knot_v
else:
self.U = torch.Tensor(np.array(gen_knot_vector(self.p, self.m)))
self.u = torch.linspace(0.0, 1.0, steps=out_dim,dtype=torch.float32)
self.method = method
self.dvc = dvc
if self.dvc == 'cuda':
self.U = self.U.cuda()
self.u = self.u.cuda()
self.uspan, self.Nu = pre_compute_basis(self.u, self.U, m, p, out_dim, self._dimension)
else:
self.uspan, self.Nu = cpp_pre_compute_basis(self.u, self.U, m, p, out_dim, self._dimension)
def forward(self,input):
"""
In the forward pass we receive a Tensor containing the input and return
a Tensor containing the output. ctx is a context object that can be used
to stash information for backward computation. You can cache arbitrary
objects for use in the backward pass using the ctx.save_for_backward method.
"""
# input will be of dimension (batch_size, m+1, n+1, dimension+1)
if self.method == 'cpp':
out = CurveEvalFunc.apply(input, self.uspan, self.Nu, self.u, self.m, self.p, self._dimension, self.dvc)
return out
elif self.method == 'tc':
# input[:,:,:self._dimension] = input[:,:,:self._dimension]*input[:,:,self._dimension].unsqueeze(-1)
curves = self.Nu[:,0].unsqueeze(-1)*input[:,(self.uspan-self.p).type(torch.LongTensor),:]
for j in range(1,self.p+1):
curves += self.Nu[:,j].unsqueeze(-1)*input[:,(self.uspan-self.p+j).type(torch.LongTensor),:]
return curves[:,:,:self._dimension]/curves[:,:,self._dimension].unsqueeze(-1)
class CurveEvalFunc(torch.autograd.Function):
@staticmethod
def forward(ctx, ctrl_pts, uspan, Nu, u, m, p, _dimension, _device):
ctx.save_for_backward(ctrl_pts)
ctx.uspan = uspan
ctx.Nu = Nu
ctx.u = u
ctx.m = m
ctx.p = p
ctx._dimension = _dimension
ctx._device = _device
if _device == 'cuda':
curves = forward(ctrl_pts, uspan, Nu, u, m, p, _dimension)
else:
curves = cpp_forward(ctrl_pts.cpu(), uspan.cpu(), Nu.cpu(), u.cpu(), m, p, _dimension)
ctx.curves = curves
return curves[:,:,:_dimension]/curves[:,:,_dimension].unsqueeze(-1)
@staticmethod
def backward(ctx, grad_output):
ctrl_pts, = ctx.saved_tensors
uspan = ctx.uspan
Nu = ctx.Nu
u = ctx.u
m = ctx.m
p = ctx.p
_device = ctx._device
_dimension = ctx._dimension
curves = ctx.curves
grad_cw = torch.zeros((grad_output.size(0),grad_output.size(1),_dimension+1),dtype=torch.float32)
if _device == 'cuda':
grad_cw = grad_cw.cuda()
grad_cw[:,:,:_dimension] = grad_output
for d in range(_dimension):
grad_cw[:,:,_dimension] += grad_output[:,:,d]/curves[:,:,_dimension]
if _device == 'cuda':
grad_ctrl_pts = backward(grad_cw, ctrl_pts, uspan, Nu, u, m, p, _dimension)
else:
grad_ctrl_pts = cpp_backward(grad_cw, ctrl_pts, uspan, Nu, u, m, p, _dimension)
return Variable(grad_ctrl_pts[0]), None, None, None, None, None, None, None
| [
1,
529,
9507,
29958,
29940,
4574,
29933,
7230,
2593,
29914,
2764,
345,
29918,
14513,
29889,
2272,
13,
5215,
4842,
305,
13,
5215,
12655,
408,
7442,
13,
3166,
4842,
305,
1053,
302,
29876,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
6680,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
3166,
405,
4574,
29933,
7230,
2593,
29889,
2764,
345,
29918,
14513,
29918,
8223,
1053,
6375,
408,
274,
407,
29918,
11333,
29892,
1250,
1328,
408,
274,
407,
29918,
1627,
1328,
29892,
758,
29918,
26017,
29918,
6500,
275,
408,
274,
407,
29918,
1457,
29918,
26017,
29918,
6500,
275,
13,
3166,
405,
4574,
29933,
7230,
2593,
29889,
2764,
345,
29918,
14513,
29918,
29883,
6191,
1053,
758,
29918,
26017,
29918,
6500,
275,
29892,
6375,
29892,
1250,
1328,
13,
3166,
869,
13239,
1053,
2531,
29918,
29895,
1333,
29918,
8111,
13,
7345,
305,
29889,
11288,
29918,
26776,
29898,
29896,
29906,
29900,
29897,
13,
13,
13,
13,
1990,
10837,
345,
29923,
791,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
9995,
13,
1678,
1334,
508,
2334,
1749,
1914,
2888,
1120,
468,
3665,
6680,
29879,
491,
19481,
292,
13,
1678,
4842,
305,
29889,
1300,
468,
3665,
29889,
6678,
322,
16049,
278,
6375,
322,
1250,
1328,
14517,
13,
1678,
607,
21994,
373,
323,
575,
943,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
286,
29892,
889,
327,
29918,
29894,
29922,
8516,
29892,
29871,
9927,
29922,
29941,
29892,
282,
29922,
29906,
29892,
714,
29918,
6229,
29922,
29941,
29906,
29892,
1158,
2433,
14246,
742,
270,
7071,
2433,
29883,
6191,
29374,
13,
4706,
2428,
29898,
23902,
345,
29923,
791,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29885,
353,
286,
13,
4706,
1583,
3032,
6229,
2673,
353,
9927,
13,
4706,
1583,
29889,
29886,
353,
282,
13,
4706,
565,
889,
327,
29918,
29894,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
29965,
353,
889,
327,
29918,
29894,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29965,
353,
4842,
305,
29889,
29911,
6073,
29898,
9302,
29889,
2378,
29898,
1885,
29918,
29895,
1333,
29918,
8111,
29898,
1311,
29889,
29886,
29892,
1583,
29889,
29885,
4961,
13,
4706,
1583,
29889,
29884,
353,
4842,
305,
29889,
1915,
3493,
29898,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
6576,
29922,
449,
29918,
6229,
29892,
29881,
1853,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29897,
13,
4706,
1583,
29889,
5696,
353,
1158,
13,
4706,
1583,
29889,
29881,
7071,
353,
270,
7071,
13,
4706,
565,
1583,
29889,
29881,
7071,
1275,
525,
29883,
6191,
2396,
13,
9651,
1583,
29889,
29965,
353,
1583,
29889,
29965,
29889,
29883,
6191,
580,
13,
9651,
1583,
29889,
29884,
353,
1583,
29889,
29884,
29889,
29883,
6191,
580,
13,
9651,
1583,
29889,
375,
8357,
29892,
1583,
29889,
29940,
29884,
353,
758,
29918,
26017,
29918,
6500,
275,
29898,
1311,
29889,
29884,
29892,
1583,
29889,
29965,
29892,
286,
29892,
282,
29892,
714,
29918,
6229,
29892,
1583,
3032,
6229,
2673,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
375,
8357,
29892,
1583,
29889,
29940,
29884,
353,
274,
407,
29918,
1457,
29918,
26017,
29918,
6500,
275,
29898,
1311,
29889,
29884,
29892,
1583,
29889,
29965,
29892,
286,
29892,
282,
29892,
714,
29918,
6229,
29892,
1583,
3032,
6229,
2673,
29897,
13,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
2080,
1125,
13,
4706,
9995,
13,
4706,
512,
278,
6375,
1209,
591,
7150,
263,
323,
6073,
6943,
278,
1881,
322,
736,
13,
4706,
263,
323,
6073,
6943,
278,
1962,
29889,
12893,
338,
263,
3030,
1203,
393,
508,
367,
1304,
13,
4706,
304,
380,
1161,
2472,
363,
1250,
1328,
16287,
29889,
887,
508,
7090,
11472,
13,
4706,
3618,
363,
671,
297,
278,
1250,
1328,
1209,
773,
278,
12893,
29889,
7620,
29918,
1454,
29918,
1627,
1328,
1158,
29889,
13,
4706,
9995,
13,
4706,
396,
1881,
674,
367,
310,
9927,
313,
16175,
29918,
2311,
29892,
286,
29974,
29896,
29892,
302,
29974,
29896,
29892,
9927,
29974,
29896,
29897,
13,
13,
4706,
565,
1583,
29889,
5696,
1275,
525,
8223,
2396,
13,
9651,
714,
353,
10837,
345,
29923,
791,
14400,
29889,
7302,
29898,
2080,
29892,
1583,
29889,
375,
8357,
29892,
1583,
29889,
29940,
29884,
29892,
1583,
29889,
29884,
29892,
1583,
29889,
29885,
29892,
1583,
29889,
29886,
29892,
1583,
3032,
6229,
2673,
29892,
1583,
29889,
29881,
7071,
29897,
13,
9651,
736,
714,
13,
4706,
25342,
1583,
29889,
5696,
1275,
525,
14246,
2396,
13,
9651,
396,
1881,
7503,
29892,
29901,
29892,
29901,
1311,
3032,
6229,
2673,
29962,
353,
1881,
7503,
29892,
29901,
29892,
29901,
1311,
3032,
6229,
2673,
14178,
2080,
7503,
29892,
29901,
29892,
1311,
3032,
6229,
2673,
1822,
6948,
802,
29872,
911,
6278,
29896,
29897,
13,
9651,
19684,
353,
1583,
29889,
29940,
29884,
7503,
29892,
29900,
1822,
6948,
802,
29872,
911,
6278,
29896,
11877,
2080,
7503,
22657,
1311,
29889,
375,
8357,
29899,
1311,
29889,
29886,
467,
1853,
29898,
7345,
305,
29889,
8208,
29911,
6073,
511,
17531,
13,
9651,
363,
432,
297,
3464,
29898,
29896,
29892,
1311,
29889,
29886,
29974,
29896,
1125,
13,
18884,
19684,
4619,
1583,
29889,
29940,
29884,
7503,
29892,
29926,
1822,
6948,
802,
29872,
911,
6278,
29896,
11877,
2080,
7503,
22657,
1311,
29889,
375,
8357,
29899,
1311,
29889,
29886,
29974,
29926,
467,
1853,
29898,
7345,
305,
29889,
8208,
29911,
6073,
511,
17531,
13,
9651,
736,
19684,
7503,
29892,
29901,
29892,
29901,
1311,
3032,
6229,
2673,
16261,
2764,
1960,
7503,
29892,
29901,
29892,
1311,
3032,
6229,
2673,
1822,
6948,
802,
29872,
911,
6278,
29896,
29897,
13,
13,
13,
13,
1990,
10837,
345,
29923,
791,
14400,
29898,
7345,
305,
29889,
1300,
468,
3665,
29889,
6678,
1125,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6375,
29898,
13073,
29892,
274,
11742,
29918,
16485,
29892,
502,
8357,
29892,
12487,
29892,
318,
29892,
286,
29892,
282,
29892,
903,
6229,
2673,
29892,
903,
10141,
1125,
13,
4706,
12893,
29889,
7620,
29918,
1454,
29918,
1627,
1328,
29898,
24220,
29918,
16485,
29897,
13,
4706,
12893,
29889,
375,
8357,
353,
502,
8357,
13,
4706,
12893,
29889,
29940,
29884,
353,
12487,
13,
4706,
12893,
29889,
29884,
353,
318,
13,
4706,
12893,
29889,
29885,
353,
286,
13,
4706,
12893,
29889,
29886,
353,
282,
13,
4706,
12893,
3032,
6229,
2673,
353,
903,
6229,
2673,
13,
4706,
12893,
3032,
10141,
353,
903,
10141,
13,
4706,
565,
903,
10141,
1275,
525,
29883,
6191,
2396,
13,
9651,
19684,
353,
6375,
29898,
24220,
29918,
16485,
29892,
502,
8357,
29892,
12487,
29892,
318,
29892,
286,
29892,
282,
29892,
903,
6229,
2673,
29897,
13,
4706,
1683,
29901,
13,
9651,
19684,
353,
274,
407,
29918,
11333,
29898,
24220,
29918,
16485,
29889,
21970,
3285,
502,
8357,
29889,
21970,
3285,
12487,
29889,
21970,
3285,
318,
29889,
21970,
3285,
286,
29892,
282,
29892,
903,
6229,
2673,
29897,
13,
4706,
12893,
29889,
2764,
1960,
353,
19684,
13,
4706,
736,
19684,
7503,
29892,
29901,
29892,
29901,
29918,
6229,
2673,
16261,
2764,
1960,
7503,
29892,
29901,
29892,
29918,
6229,
2673,
1822,
6948,
802,
29872,
911,
6278,
29896,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1250,
1328,
29898,
13073,
29892,
4656,
29918,
4905,
1125,
13,
4706,
274,
11742,
29918,
16485,
29892,
29871,
353,
12893,
29889,
17314,
29918,
29873,
575,
943,
13,
4706,
502,
8357,
353,
12893,
29889,
375,
8357,
13,
4706,
12487,
353,
12893,
29889,
29940,
29884,
13,
4706,
318,
353,
12893,
29889,
29884,
13,
4706,
286,
353,
12893,
29889,
29885,
13,
4706,
282,
353,
12893,
29889,
29886,
13,
4706,
903,
10141,
353,
12893,
3032,
10141,
13,
4706,
903,
6229,
2673,
353,
12893,
3032,
6229,
2673,
13,
4706,
19684,
353,
12893,
29889,
2764,
1960,
13,
4706,
4656,
29918,
29883,
29893,
353,
4842,
305,
29889,
3298,
359,
3552,
5105,
29918,
4905,
29889,
2311,
29898,
29900,
511,
5105,
29918,
4905,
29889,
2311,
29898,
29896,
511,
29918,
6229,
2673,
29974,
29896,
511,
29881,
1853,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29897,
13,
4706,
565,
903,
10141,
1275,
525,
29883,
6191,
2396,
13,
9651,
4656,
29918,
29883,
29893,
353,
4656,
29918,
29883,
29893,
29889,
29883,
6191,
580,
13,
4706,
4656,
29918,
29883,
29893,
7503,
29892,
29901,
29892,
29901,
29918,
6229,
2673,
29962,
353,
4656,
29918,
4905,
13,
4706,
363,
270,
297,
3464,
7373,
6229,
2673,
1125,
13,
9651,
4656,
29918,
29883,
29893,
7503,
29892,
29901,
29892,
29918,
6229,
2673,
29962,
4619,
4656,
29918,
4905,
7503,
29892,
29901,
29892,
29881,
16261,
2764,
1960,
7503,
29892,
29901,
29892,
29918,
6229,
2673,
29962,
13,
4706,
565,
903,
10141,
1275,
525,
29883,
6191,
2396,
13,
9651,
4656,
29918,
24220,
29918,
16485,
29871,
353,
1250,
1328,
29898,
5105,
29918,
29883,
29893,
29892,
274,
11742,
29918,
16485,
29892,
502,
8357,
29892,
12487,
29892,
318,
29892,
286,
29892,
282,
29892,
903,
6229,
2673,
29897,
13,
4706,
1683,
29901,
13,
9651,
4656,
29918,
24220,
29918,
16485,
29871,
353,
274,
407,
29918,
1627,
1328,
29898,
5105,
29918,
29883,
29893,
29892,
274,
11742,
29918,
16485,
29892,
502,
8357,
29892,
12487,
29892,
318,
29892,
286,
29892,
282,
29892,
903,
6229,
2673,
29897,
13,
13,
4706,
736,
28736,
29898,
5105,
29918,
24220,
29918,
16485,
29961,
29900,
11724,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
29892,
6213,
13,
2
] |
app/libs/utils.py | zcxyun/snack-api-lin | 1 | 111005 | <gh_stars>1-10
"""
:copyright: © 2019 by the Lin team.
:license: MIT, see LICENSE for more details.
"""
import re
import time
from datetime import datetime, timedelta
from flask import current_app, jsonify, request
from lin.exception import ParameterException
def datetime_format(dt=None, fmt='%Y-%m-%d %H:%M:%S'):
if not dt:
dt = datetime.now()
return dt.strftime(fmt)
def get_count_from_query():
count_default = current_app.config.get('COUNT_DEFAULT')
count = int(request.args.get('count', count_default if count_default else 1))
return count
def get_page_from_query():
page_default = current_app.config.get('PAGE_DEFAULT')
page = int(request.args.get('page', page_default if page_default else 0))
return page
def paginate():
_count = get_count_from_query()
count = 15 if _count >= 15 else _count
start = get_page_from_query() * count
if start < 0 or count < 0:
raise ParameterException()
return start, count
def camel2line(camel: str):
p = re.compile(r'([a-z]|\d)([A-Z])')
line = re.sub(p, r'\1_\2', camel).lower()
return line
def json_res(**kwargs):
'''
将所有传入的关键字参数转变为dict后序列化为json格式的response
count, items, page, total, total_page ...
'''
return jsonify(kwargs)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
13,
1678,
584,
8552,
1266,
29901,
29871,
30211,
29871,
29906,
29900,
29896,
29929,
491,
278,
4342,
3815,
29889,
13,
1678,
584,
506,
1947,
29901,
341,
1806,
29892,
1074,
365,
2965,
1430,
1660,
363,
901,
4902,
29889,
13,
15945,
29908,
13,
13,
5215,
337,
13,
5215,
931,
13,
3166,
12865,
1053,
12865,
29892,
5335,
287,
2554,
13,
13,
3166,
29784,
1053,
1857,
29918,
932,
29892,
4390,
1598,
29892,
2009,
13,
3166,
6276,
29889,
11739,
1053,
24953,
2451,
13,
13,
13,
1753,
12865,
29918,
4830,
29898,
6008,
29922,
8516,
29892,
19200,
2433,
29995,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
29374,
13,
1678,
565,
451,
11636,
29901,
13,
4706,
11636,
353,
12865,
29889,
3707,
580,
13,
1678,
736,
11636,
29889,
710,
615,
603,
29898,
23479,
29897,
13,
13,
13,
1753,
679,
29918,
2798,
29918,
3166,
29918,
1972,
7295,
13,
1678,
2302,
29918,
4381,
353,
1857,
29918,
932,
29889,
2917,
29889,
657,
877,
18736,
29918,
23397,
1495,
13,
1678,
2302,
353,
938,
29898,
3827,
29889,
5085,
29889,
657,
877,
2798,
742,
2302,
29918,
4381,
565,
2302,
29918,
4381,
1683,
29871,
29896,
876,
13,
1678,
736,
2302,
13,
13,
13,
1753,
679,
29918,
3488,
29918,
3166,
29918,
1972,
7295,
13,
1678,
1813,
29918,
4381,
353,
1857,
29918,
932,
29889,
2917,
29889,
657,
877,
7228,
1692,
29918,
23397,
1495,
13,
1678,
1813,
353,
938,
29898,
3827,
29889,
5085,
29889,
657,
877,
3488,
742,
1813,
29918,
4381,
565,
1813,
29918,
4381,
1683,
29871,
29900,
876,
13,
1678,
736,
1813,
13,
13,
13,
1753,
10203,
16976,
7295,
13,
1678,
903,
2798,
353,
679,
29918,
2798,
29918,
3166,
29918,
1972,
580,
13,
1678,
2302,
353,
29871,
29896,
29945,
565,
903,
2798,
6736,
29871,
29896,
29945,
1683,
903,
2798,
13,
1678,
1369,
353,
679,
29918,
3488,
29918,
3166,
29918,
1972,
580,
334,
2302,
13,
1678,
565,
1369,
529,
29871,
29900,
470,
2302,
529,
29871,
29900,
29901,
13,
4706,
12020,
24953,
2451,
580,
13,
1678,
736,
1369,
29892,
2302,
13,
13,
13,
1753,
3949,
295,
29906,
1220,
29898,
11108,
295,
29901,
851,
1125,
13,
1678,
282,
353,
337,
29889,
12198,
29898,
29878,
29915,
4197,
29874,
29899,
29920,
29962,
4295,
29881,
29897,
4197,
29909,
29899,
29999,
2314,
1495,
13,
1678,
1196,
353,
337,
29889,
1491,
29898,
29886,
29892,
364,
12764,
29896,
3187,
29906,
742,
3949,
295,
467,
13609,
580,
13,
1678,
736,
1196,
13,
13,
13,
1753,
4390,
29918,
690,
29898,
1068,
19290,
1125,
13,
1678,
14550,
13,
268,
30998,
30744,
30417,
31471,
30752,
30210,
31057,
236,
151,
177,
30578,
31125,
30354,
31415,
31462,
30573,
8977,
30822,
31463,
31025,
30705,
30573,
3126,
31168,
30607,
30210,
5327,
13,
1678,
2302,
29892,
4452,
29892,
1813,
29892,
3001,
29892,
3001,
29918,
3488,
2023,
13,
1678,
14550,
13,
1678,
736,
4390,
1598,
29898,
19290,
29897,
13,
2
] |
heap_md.py | sorrento/sdopt-tearing | 0 | 30901 | # Copyright (C) 2014, 2015 University of Vienna
# All rights reserved.
# BSD license.
# Author: <NAME> <<EMAIL>>
# Heap-based minimum-degree ordering with NO lookahead.
#
# See also min_degree.py which uses lookahead, and simple_md.py which is a
# hacked version of min_degree.py that still uses repeated linear scans to find
# the minimum degree nodes but does not do lookahead.
from __future__ import print_function
from py3compat import cPickle_loads, cPickle_dumps, cPickle_HIGHEST_PROTOCOL
from itertools import chain
from networkx import max_weight_matching
from pqueue import PriorityQueue as heapdict
from py3compat import irange
from order_util import colp_to_spiked_form, get_hessenberg_order, check_spiked_form,\
coo_matrix_to_bipartite, partial_relabel, argsort, \
get_inverse_perm, get_row_weights
from plot_ordering import plot_hessenberg, plot_bipartite
def hessenberg(rows, cols, values, n_rows, n_cols, tie_breaking):
'Tie breaking options: MIN_FIRST, MAX_FIRST, IGNORE'
assert tie_breaking in ('IGNORE', 'MIN_FIRST', 'MAX_FIRST'), tie_breaking
# The col IDs in cols are shifted by n_rows, must undo later
g, eqs, _ = coo_matrix_to_bipartite(rows, cols, values, (n_rows, n_cols))
if tie_breaking != 'IGNORE':
# Relabel the rows such that they are ordered by weight
row_weights = get_row_weights(g, n_rows)
reverse = True if tie_breaking == 'MAX_FIRST' else False
row_pos = argsort(row_weights, reverse)
mapping = {n: i for i, n in enumerate(row_pos)}
#
eqs = set(mapping[eq] for eq in eqs)
g = partial_relabel(g, mapping)
#
rperm, cperm, _, _, _, _ = to_hessenberg_form(g, eqs)
# Finally, shift the colp such that it is a permutation of 0 .. n_cols-1
cperm = [c-n_rows for c in cperm]
#
if tie_breaking != 'IGNORE':
rperm = [row_pos[r] for r in rperm]
#
rowp, colp = get_inverse_perm(rperm, cperm)
assert sorted(rowp) == list(irange(n_rows))
assert sorted(colp) == list(irange(n_cols))
return rowp, colp
################################################################################
#
# TODO Hereafter, rowp and colp here seems to be consistently used for
# rperm and cperm, the permuted row and col identifiers.
#
################################################################################
def to_spiked_form(g, eqs, forbidden=None):
'''Returns the tuple of: bool singular, [row permutation],
[column permutation], [spike variables], [residual equations]. The spikes
and the residuals are ordered according to the permutation.'''
# Check singularity, apparently only the permutation to spiked form needs it
#assert 2*len(eqs) == len(g), 'Not a square matrix!'
matches = max_weight_matching(g)
print(len(matches))
#if len(matches) != 2*len(eqs):
# return (True, [], [], [], [])
if forbidden is None:
forbidden = set()
rowp, colp_hess, matches, tear_set, sink_set = min_degree(g, eqs, forbidden)
print('ok')
colp = colp_to_spiked_form(rowp, colp_hess, matches, tear_set, sink_set)
#check_spiked_form(g, rowp, colp, tear_set)
plot_hessenberg(g, rowp, colp_hess, [], '')
plot_bipartite(g, forbidden, rowp, colp)
tears = [c for c in colp if c in tear_set]
sinks = [r for r in rowp if r in sink_set]
return (False, rowp, colp, tears, sinks)
def to_hessenberg_form(g, eqs, forbidden=None):
'''Returns the tuple of: [row permutation], [column permutation],
[guessed variables], [residual equations], [row matches], [col matches].
Everything is ordered according to the permutation.'''
rowp, colp, matches, tear_set, sink_set = min_degree(g, eqs, forbidden)
tears = [c for c in colp if c in tear_set]
sinks = [r for r in rowp if r in sink_set]
row_matches = [r for r in rowp if r in matches]
col_matches = [c for c in colp if c in matches]
#plot_hessenberg(g, rowp, colp, [], '')
#plot_bipartite(g, forbidden, rowp, colp)
return (rowp, colp, tears, sinks, row_matches, col_matches)
def min_degree(g_orig, eqs, forbidden=None):
'''Returns: tuple([row permutation], [column permutation],
{eq: var and var: eq matches}, set(tear vars), set(residual equations)).'''
# Duplicated in bb_tear.initial_solution with none forbidden
assert eqs
if forbidden is None:
forbidden = set()
if not isinstance(eqs, (set, dict)):
eqs = set(eqs) # Make sure that `n in eqs` will be O(1).
g_allowed, g = setup_graphs(g_orig, forbidden)
eq_tot = create_heap(g_allowed, g, eqs)
rowp, matches = [ ], { }
while eq_tot:
(_cost, _tot, _eq), eq = eq_tot.popitem()
#assert _eq == eq, (_eq, eq)
#print('Eq:', eq)
rowp.append(eq)
if g_allowed[eq]:
var = sorted(g_allowed[eq])[0] # or [-1] for last
assert eq not in matches
assert var not in matches
matches[eq] = var
matches[var] = eq
#print('Var:', var)
vrs = sorted(g[eq])
eqs_update = set(chain.from_iterable(g[v] for v in vrs))
eqs_update.discard(eq)
g_allowed.remove_node(eq)
g.remove_node(eq)
g_allowed.remove_nodes_from(vrs)
g.remove_nodes_from(vrs)
for e in sorted(eqs_update): # keep in sync with create_heap
tot = len(g[e])
cost = tot-1 if g_allowed[e] else tot
eq_tot[e] = (cost, tot, e)
assert len(rowp) == len(eqs)
# The row permutation determines the column permutation, let's get it!
# get_hessenberg_order also asserts non-increasing envelope, among others
colp = get_hessenberg_order(g_orig, eqs, rowp)
sink_set = { n for n in rowp if n not in matches }
tear_set = { n for n in colp if n not in matches }
#
#print('Number of tears:', len(tear_set))
#print('Row permutation:', rowp)
#print('Col permutation:', colp)
#
return rowp, colp, matches, tear_set, sink_set
def setup_graphs(g_orig, forbidden):
# g is a copy of g_orig; g_allowed contains only the allowed edges of g_orig
g_pkl = cPickle_dumps(g_orig, cPickle_HIGHEST_PROTOCOL)
g = cPickle_loads(g_pkl)
g_allowed = cPickle_loads(g_pkl)
adj = g_allowed.adj
for u, v in forbidden:
g_allowed.remove_edge(u,v)
#del adj[u][v]
#del adj[v][u] # assumes no self loops
return g_allowed, g
def create_heap(g_allowed, g, eqs):
eq_tot = heapdict()
for e in sorted(eqs):
tot = len(g[e])
cost = tot-1 if g_allowed[e] else tot
eq_tot[e] = (cost, tot, e)
return eq_tot
def run_tests():
from test_tearing import gen_testproblems
for g, eqs, forbidden in gen_testproblems():
rowp, colp, tears, sinks, mr, mc = to_hessenberg_form(g, eqs, forbidden)
print('Rowp:', rowp)
print('Colp:', colp)
print('Tears:', tears)
print('Residuals:', sinks)
print('mr:', mr)
print('mc:', mc)
if __name__=='__main__':
run_tests()
| [
1,
396,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29946,
29892,
29871,
29906,
29900,
29896,
29945,
3014,
310,
25309,
13,
29937,
2178,
10462,
21676,
29889,
13,
29937,
350,
7230,
19405,
29889,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
29937,
940,
481,
29899,
6707,
9212,
29899,
12163,
929,
20520,
411,
11698,
1106,
29874,
2813,
29889,
13,
29937,
29871,
13,
29937,
2823,
884,
1375,
29918,
12163,
929,
29889,
2272,
607,
3913,
1106,
29874,
2813,
29892,
322,
2560,
29918,
3487,
29889,
2272,
607,
338,
263,
29871,
13,
29937,
15833,
287,
1873,
310,
1375,
29918,
12163,
929,
29889,
2272,
393,
1603,
3913,
10324,
5608,
885,
550,
304,
1284,
29871,
13,
29937,
278,
9212,
7426,
7573,
541,
947,
451,
437,
1106,
29874,
2813,
29889,
29871,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
11451,
29941,
12667,
1053,
274,
29925,
860,
280,
29918,
18132,
29892,
274,
29925,
860,
280,
29918,
29881,
17204,
29892,
274,
29925,
860,
280,
29918,
29950,
6259,
9606,
1254,
29918,
8618,
4986,
15032,
13,
3166,
4256,
8504,
1053,
9704,
13,
3166,
3564,
29916,
1053,
4236,
29918,
7915,
29918,
4352,
292,
13,
3166,
282,
9990,
1053,
22096,
537,
10620,
408,
16947,
8977,
13,
3166,
11451,
29941,
12667,
1053,
3805,
927,
13,
3166,
1797,
29918,
4422,
1053,
784,
29886,
29918,
517,
29918,
1028,
638,
287,
29918,
689,
29892,
679,
29918,
29882,
9957,
2552,
29918,
2098,
29892,
1423,
29918,
1028,
638,
287,
29918,
689,
2053,
13,
462,
539,
1302,
29877,
29918,
5344,
29918,
517,
29918,
29890,
27494,
568,
29892,
7687,
29918,
276,
1643,
29892,
6389,
441,
29892,
320,
13,
462,
539,
679,
29918,
262,
3901,
29918,
17858,
29892,
679,
29918,
798,
29918,
705,
5861,
13,
3166,
6492,
29918,
2098,
292,
1053,
6492,
29918,
29882,
9957,
2552,
29892,
6492,
29918,
29890,
27494,
568,
13,
13,
13,
1753,
298,
9957,
2552,
29898,
5727,
29892,
28730,
29892,
1819,
29892,
302,
29918,
5727,
29892,
302,
29918,
22724,
29892,
22134,
29918,
1030,
5086,
1125,
13,
1678,
525,
29911,
347,
16679,
3987,
29901,
341,
1177,
29918,
3738,
29934,
1254,
29892,
18134,
29918,
3738,
29934,
1254,
29892,
306,
29954,
6632,
1525,
29915,
13,
1678,
4974,
22134,
29918,
1030,
5086,
297,
6702,
6259,
6632,
1525,
742,
525,
16173,
29918,
3738,
29934,
1254,
742,
525,
12648,
29918,
3738,
29934,
1254,
5477,
22134,
29918,
1030,
5086,
13,
1678,
396,
450,
784,
23481,
297,
28730,
526,
9500,
287,
491,
302,
29918,
5727,
29892,
1818,
563,
29877,
2678,
13,
1678,
330,
29892,
11594,
29879,
29892,
903,
353,
1302,
29877,
29918,
5344,
29918,
517,
29918,
29890,
27494,
568,
29898,
5727,
29892,
28730,
29892,
1819,
29892,
313,
29876,
29918,
5727,
29892,
302,
29918,
22724,
876,
13,
1678,
565,
22134,
29918,
1030,
5086,
2804,
525,
6259,
6632,
1525,
2396,
13,
4706,
396,
6376,
1107,
278,
4206,
1316,
393,
896,
526,
10372,
491,
7688,
13,
4706,
1948,
29918,
705,
5861,
353,
679,
29918,
798,
29918,
705,
5861,
29898,
29887,
29892,
302,
29918,
5727,
29897,
13,
4706,
11837,
353,
5852,
565,
22134,
29918,
1030,
5086,
1275,
525,
12648,
29918,
3738,
29934,
1254,
29915,
1683,
7700,
13,
4706,
1948,
29918,
1066,
353,
6389,
441,
29898,
798,
29918,
705,
5861,
29892,
11837,
29897,
13,
4706,
10417,
353,
426,
29876,
29901,
474,
363,
474,
29892,
302,
297,
26985,
29898,
798,
29918,
1066,
2915,
13,
4706,
396,
13,
4706,
11594,
29879,
353,
731,
29898,
20698,
29961,
1837,
29962,
363,
11594,
297,
11594,
29879,
29897,
13,
4706,
330,
353,
7687,
29918,
276,
1643,
29898,
29887,
29892,
10417,
29897,
13,
1678,
396,
13,
1678,
364,
17858,
29892,
274,
17858,
29892,
17117,
17117,
17117,
903,
353,
304,
29918,
29882,
9957,
2552,
29918,
689,
29898,
29887,
29892,
11594,
29879,
29897,
13,
1678,
396,
9788,
29892,
9500,
278,
784,
29886,
1316,
393,
372,
338,
263,
20005,
362,
310,
29871,
29900,
6317,
302,
29918,
22724,
29899,
29896,
13,
1678,
274,
17858,
353,
518,
29883,
29899,
29876,
29918,
5727,
363,
274,
297,
274,
17858,
29962,
13,
1678,
396,
13,
1678,
565,
22134,
29918,
1030,
5086,
2804,
525,
6259,
6632,
1525,
2396,
13,
4706,
364,
17858,
353,
518,
798,
29918,
1066,
29961,
29878,
29962,
363,
364,
297,
364,
17858,
29962,
13,
1678,
396,
13,
1678,
1948,
29886,
29892,
784,
29886,
353,
679,
29918,
262,
3901,
29918,
17858,
29898,
29878,
17858,
29892,
274,
17858,
29897,
13,
1678,
4974,
12705,
29898,
798,
29886,
29897,
1275,
1051,
29898,
381,
927,
29898,
29876,
29918,
5727,
876,
13,
1678,
4974,
12705,
29898,
1054,
29886,
29897,
1275,
1051,
29898,
381,
927,
29898,
29876,
29918,
22724,
876,
259,
13,
1678,
736,
1948,
29886,
29892,
784,
29886,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
29937,
13,
29937,
14402,
2266,
7045,
29892,
1948,
29886,
322,
784,
29886,
1244,
2444,
304,
367,
5718,
2705,
1304,
363,
29871,
13,
29937,
364,
17858,
322,
274,
17858,
29892,
278,
3635,
3860,
1948,
322,
784,
2893,
14903,
29889,
13,
29937,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
1753,
304,
29918,
1028,
638,
287,
29918,
689,
29898,
29887,
29892,
11594,
29879,
29892,
19752,
4215,
29922,
8516,
1125,
13,
1678,
14550,
11609,
29879,
278,
18761,
310,
29901,
6120,
13512,
29892,
518,
798,
20005,
362,
1402,
29871,
13,
1678,
518,
4914,
20005,
362,
1402,
518,
1028,
9345,
3651,
1402,
518,
690,
333,
950,
10693,
1822,
450,
805,
29379,
29871,
13,
1678,
322,
278,
10995,
27101,
526,
10372,
5034,
304,
278,
20005,
362,
29889,
12008,
13,
1678,
396,
5399,
13512,
537,
29892,
13229,
871,
278,
20005,
362,
304,
805,
638,
287,
883,
4225,
372,
13,
1678,
396,
9294,
29871,
29906,
29930,
2435,
29898,
1837,
29879,
29897,
1275,
7431,
29898,
29887,
511,
29871,
525,
3664,
263,
6862,
4636,
20714,
13,
1678,
7087,
353,
4236,
29918,
7915,
29918,
4352,
292,
29898,
29887,
29897,
13,
1678,
1596,
29898,
2435,
29898,
20317,
876,
13,
1678,
396,
361,
7431,
29898,
20317,
29897,
2804,
29871,
29906,
29930,
2435,
29898,
1837,
29879,
1125,
13,
1678,
396,
1678,
736,
313,
5574,
29892,
19997,
19997,
19997,
518,
2314,
13,
1678,
565,
19752,
4215,
338,
6213,
29901,
13,
4706,
19752,
4215,
353,
731,
580,
13,
1678,
1948,
29886,
29892,
784,
29886,
29918,
29882,
404,
29892,
7087,
29892,
734,
279,
29918,
842,
29892,
28169,
29918,
842,
353,
1375,
29918,
12163,
929,
29898,
29887,
29892,
11594,
29879,
29892,
19752,
4215,
29897,
13,
268,
13,
1678,
1596,
877,
554,
1495,
13,
1678,
784,
29886,
353,
784,
29886,
29918,
517,
29918,
1028,
638,
287,
29918,
689,
29898,
798,
29886,
29892,
784,
29886,
29918,
29882,
404,
29892,
7087,
29892,
734,
279,
29918,
842,
29892,
28169,
29918,
842,
29897,
13,
1678,
396,
3198,
29918,
1028,
638,
287,
29918,
689,
29898,
29887,
29892,
1948,
29886,
29892,
784,
29886,
29892,
734,
279,
29918,
842,
29897,
13,
268,
13,
1678,
6492,
29918,
29882,
9957,
2552,
29898,
29887,
29892,
1948,
29886,
29892,
784,
29886,
29918,
29882,
404,
29892,
19997,
27255,
13,
1678,
6492,
29918,
29890,
27494,
568,
29898,
29887,
29892,
19752,
4215,
29892,
1948,
29886,
29892,
784,
29886,
29897,
13,
1678,
20190,
353,
518,
29883,
363,
274,
297,
784,
29886,
565,
274,
297,
734,
279,
29918,
842,
29962,
13,
1678,
269,
19363,
353,
518,
29878,
363,
364,
297,
1948,
29886,
565,
364,
297,
28169,
29918,
842,
29962,
13,
1678,
736,
313,
8824,
29892,
1948,
29886,
29892,
784,
29886,
29892,
20190,
29892,
269,
19363,
29897,
13,
13,
13,
1753,
304,
29918,
29882,
9957,
2552,
29918,
689,
29898,
29887,
29892,
11594,
29879,
29892,
19752,
4215,
29922,
8516,
1125,
13,
1678,
14550,
11609,
29879,
278,
18761,
310,
29901,
518,
798,
20005,
362,
1402,
518,
4914,
20005,
362,
1402,
29871,
13,
1678,
518,
2543,
11517,
3651,
1402,
518,
690,
333,
950,
10693,
1402,
518,
798,
7087,
1402,
518,
1054,
7087,
1822,
29871,
13,
1678,
17296,
338,
10372,
5034,
304,
278,
20005,
362,
29889,
12008,
13,
1678,
1948,
29886,
29892,
784,
29886,
29892,
7087,
29892,
734,
279,
29918,
842,
29892,
28169,
29918,
842,
353,
1375,
29918,
12163,
929,
29898,
29887,
29892,
11594,
29879,
29892,
19752,
4215,
29897,
13,
259,
13,
1678,
20190,
353,
518,
29883,
363,
274,
297,
784,
29886,
565,
274,
297,
734,
279,
29918,
842,
29962,
13,
1678,
269,
19363,
353,
518,
29878,
363,
364,
297,
1948,
29886,
565,
364,
297,
28169,
29918,
842,
29962,
13,
1678,
1948,
29918,
20317,
353,
518,
29878,
363,
364,
297,
1948,
29886,
565,
364,
297,
7087,
29962,
13,
1678,
784,
29918,
20317,
353,
518,
29883,
363,
274,
297,
784,
29886,
565,
274,
297,
7087,
29962,
13,
268,
13,
1678,
396,
5317,
29918,
29882,
9957,
2552,
29898,
29887,
29892,
1948,
29886,
29892,
784,
29886,
29892,
19997,
27255,
13,
1678,
396,
5317,
29918,
29890,
27494,
568,
29898,
29887,
29892,
19752,
4215,
29892,
1948,
29886,
29892,
784,
29886,
29897,
13,
1678,
736,
313,
798,
29886,
29892,
784,
29886,
29892,
20190,
29892,
269,
19363,
29892,
1948,
29918,
20317,
29892,
784,
29918,
20317,
29897,
13,
13,
13,
1753,
1375,
29918,
12163,
929,
29898,
29887,
29918,
12683,
29892,
11594,
29879,
29892,
19752,
4215,
29922,
8516,
1125,
13,
1678,
14550,
11609,
29879,
29901,
18761,
4197,
798,
20005,
362,
1402,
518,
4914,
20005,
362,
1402,
29871,
13,
1678,
426,
1837,
29901,
722,
322,
722,
29901,
11594,
7087,
1118,
731,
29898,
371,
279,
24987,
511,
731,
29898,
690,
333,
950,
10693,
8106,
12008,
13,
1678,
396,
18733,
9169,
297,
289,
29890,
29918,
371,
279,
29889,
11228,
29918,
2929,
918,
411,
5642,
19752,
4215,
13,
1678,
4974,
11594,
29879,
13,
1678,
565,
19752,
4215,
338,
6213,
29901,
13,
4706,
19752,
4215,
353,
731,
580,
13,
1678,
565,
451,
338,
8758,
29898,
1837,
29879,
29892,
313,
842,
29892,
9657,
22164,
13,
4706,
11594,
29879,
353,
731,
29898,
1837,
29879,
29897,
29871,
396,
8561,
1854,
393,
421,
29876,
297,
11594,
29879,
29952,
674,
367,
438,
29898,
29896,
467,
13,
1678,
330,
29918,
24622,
29892,
330,
353,
6230,
29918,
4262,
29879,
29898,
29887,
29918,
12683,
29892,
19752,
4215,
29897,
13,
1678,
11594,
29918,
4260,
353,
1653,
29918,
354,
481,
29898,
29887,
29918,
24622,
29892,
330,
29892,
11594,
29879,
29897,
13,
1678,
1948,
29886,
29892,
7087,
353,
518,
21251,
426,
500,
13,
1678,
1550,
11594,
29918,
4260,
29901,
13,
4706,
9423,
18253,
29892,
903,
4260,
29892,
903,
1837,
511,
11594,
353,
11594,
29918,
4260,
29889,
7323,
667,
580,
13,
4706,
396,
9294,
903,
1837,
1275,
11594,
29892,
9423,
1837,
29892,
11594,
29897,
13,
4706,
396,
2158,
877,
18630,
29901,
742,
11594,
29897,
13,
4706,
1948,
29886,
29889,
4397,
29898,
1837,
29897,
13,
308,
13,
4706,
565,
330,
29918,
24622,
29961,
1837,
5387,
13,
9651,
722,
353,
12705,
29898,
29887,
29918,
24622,
29961,
1837,
2314,
29961,
29900,
29962,
396,
470,
21069,
29896,
29962,
363,
1833,
13,
9651,
4974,
11594,
29871,
451,
297,
7087,
13,
9651,
4974,
722,
451,
297,
7087,
13,
9651,
7087,
29961,
1837,
29962,
29871,
353,
722,
13,
9651,
7087,
29961,
1707,
29962,
353,
11594,
13,
9651,
396,
2158,
877,
9037,
29901,
742,
722,
29897,
13,
308,
13,
4706,
325,
2288,
353,
12705,
29898,
29887,
29961,
1837,
2314,
13,
308,
13,
4706,
11594,
29879,
29918,
5504,
353,
731,
29898,
14153,
29889,
3166,
29918,
1524,
519,
29898,
29887,
29961,
29894,
29962,
363,
325,
297,
325,
2288,
876,
13,
4706,
11594,
29879,
29918,
5504,
29889,
2218,
7543,
29898,
1837,
29897,
13,
308,
13,
4706,
330,
29918,
24622,
29889,
5992,
29918,
3177,
29898,
1837,
29897,
13,
4706,
330,
29889,
5992,
29918,
3177,
29898,
1837,
29897,
13,
268,
13,
4706,
330,
29918,
24622,
29889,
5992,
29918,
18010,
29918,
3166,
29898,
29894,
2288,
29897,
13,
4706,
330,
29889,
5992,
29918,
18010,
29918,
3166,
29898,
29894,
2288,
29897,
13,
268,
13,
4706,
363,
321,
297,
12705,
29898,
1837,
29879,
29918,
5504,
1125,
396,
3013,
297,
16523,
411,
1653,
29918,
354,
481,
13,
9651,
2025,
353,
7431,
29898,
29887,
29961,
29872,
2314,
13,
9651,
3438,
353,
2025,
29899,
29896,
565,
330,
29918,
24622,
29961,
29872,
29962,
1683,
2025,
13,
9651,
11594,
29918,
4260,
29961,
29872,
29962,
29871,
353,
313,
18253,
29892,
2025,
29892,
321,
29897,
13,
268,
13,
1678,
4974,
7431,
29898,
798,
29886,
29897,
1275,
7431,
29898,
1837,
29879,
29897,
13,
1678,
396,
450,
1948,
20005,
362,
3683,
1475,
278,
1897,
20005,
362,
29892,
1235,
29915,
29879,
679,
372,
29991,
13,
1678,
396,
679,
29918,
29882,
9957,
2552,
29918,
2098,
884,
408,
643,
1372,
1661,
29899,
262,
1037,
5832,
427,
21367,
29892,
4249,
4045,
13,
1678,
784,
29886,
353,
679,
29918,
29882,
9957,
2552,
29918,
2098,
29898,
29887,
29918,
12683,
29892,
11594,
29879,
29892,
1948,
29886,
29897,
13,
1678,
28169,
29918,
842,
353,
426,
302,
363,
302,
297,
1948,
29886,
565,
302,
451,
297,
7087,
500,
13,
1678,
734,
279,
29918,
842,
353,
426,
302,
363,
302,
297,
784,
29886,
565,
302,
451,
297,
7087,
500,
13,
1678,
396,
13,
1678,
396,
2158,
877,
4557,
310,
20190,
29901,
742,
7431,
29898,
371,
279,
29918,
842,
876,
13,
1678,
396,
2158,
877,
4301,
20005,
362,
29901,
742,
1948,
29886,
29897,
13,
1678,
396,
2158,
877,
1625,
20005,
362,
29901,
742,
784,
29886,
29897,
13,
1678,
396,
13,
1678,
736,
1948,
29886,
29892,
784,
29886,
29892,
7087,
29892,
734,
279,
29918,
842,
29892,
28169,
29918,
842,
13,
13,
13,
1753,
6230,
29918,
4262,
29879,
29898,
29887,
29918,
12683,
29892,
19752,
4215,
1125,
13,
1678,
396,
330,
338,
263,
3509,
310,
330,
29918,
12683,
29936,
330,
29918,
24622,
3743,
871,
278,
6068,
12770,
310,
330,
29918,
12683,
13,
1678,
330,
29918,
29886,
6321,
353,
274,
29925,
860,
280,
29918,
29881,
17204,
29898,
29887,
29918,
12683,
29892,
274,
29925,
860,
280,
29918,
29950,
6259,
9606,
1254,
29918,
8618,
4986,
15032,
29897,
13,
1678,
330,
353,
274,
29925,
860,
280,
29918,
18132,
29898,
29887,
29918,
29886,
6321,
29897,
13,
1678,
330,
29918,
24622,
353,
274,
29925,
860,
280,
29918,
18132,
29898,
29887,
29918,
29886,
6321,
29897,
13,
1678,
12109,
353,
330,
29918,
24622,
29889,
26859,
13,
1678,
363,
318,
29892,
325,
297,
19752,
4215,
29901,
13,
4706,
330,
29918,
24622,
29889,
5992,
29918,
12864,
29898,
29884,
29892,
29894,
29897,
29871,
13,
4706,
396,
6144,
12109,
29961,
29884,
3816,
29894,
29962,
13,
4706,
396,
6144,
12109,
29961,
29894,
3816,
29884,
29962,
396,
15894,
694,
1583,
12104,
268,
13,
1678,
736,
330,
29918,
24622,
29892,
330,
13,
13,
13,
1753,
1653,
29918,
354,
481,
29898,
29887,
29918,
24622,
29892,
330,
29892,
11594,
29879,
1125,
13,
1678,
11594,
29918,
4260,
29871,
353,
16947,
8977,
580,
13,
1678,
363,
321,
297,
12705,
29898,
1837,
29879,
1125,
13,
4706,
2025,
353,
7431,
29898,
29887,
29961,
29872,
2314,
13,
4706,
3438,
353,
2025,
29899,
29896,
565,
330,
29918,
24622,
29961,
29872,
29962,
1683,
2025,
13,
4706,
11594,
29918,
4260,
29961,
29872,
29962,
29871,
353,
313,
18253,
29892,
2025,
29892,
321,
29897,
13,
1678,
736,
11594,
29918,
4260,
13,
13,
13,
1753,
1065,
29918,
21150,
7295,
13,
1678,
515,
1243,
29918,
371,
4362,
1053,
2531,
29918,
1688,
17199,
29879,
13,
1678,
363,
330,
29892,
11594,
29879,
29892,
19752,
4215,
297,
2531,
29918,
1688,
17199,
29879,
7295,
13,
4706,
1948,
29886,
29892,
784,
29886,
29892,
20190,
29892,
269,
19363,
29892,
286,
29878,
29892,
286,
29883,
353,
304,
29918,
29882,
9957,
2552,
29918,
689,
29898,
29887,
29892,
11594,
29879,
29892,
19752,
4215,
29897,
13,
308,
13,
308,
13,
4706,
1596,
877,
4301,
29886,
29901,
742,
1948,
29886,
29897,
13,
4706,
1596,
877,
1625,
29886,
29901,
742,
784,
29886,
29897,
13,
4706,
1596,
877,
29911,
15451,
29901,
742,
20190,
29897,
13,
4706,
1596,
877,
1666,
333,
27101,
29901,
742,
269,
19363,
29897,
13,
4706,
1596,
877,
29885,
29878,
29901,
742,
286,
29878,
29897,
13,
4706,
1596,
877,
14047,
29901,
742,
286,
29883,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1360,
29915,
1649,
3396,
1649,
2396,
13,
1678,
1065,
29918,
21150,
580,
13,
2
] |
pytorch/examples/SRNN/helpermethods.py | krantikiran/EdgeML | 719 | 127062 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import argparse
def getSRNN2Args():
def checkIntPos(value):
ivalue = int(value)
if ivalue <= 0:
raise argparse.ArgumentTypeError(
"%s is an invalid positive int value" % value)
return ivalue
def checkIntNneg(value):
ivalue = int(value)
if ivalue < 0:
raise argparse.ArgumentTypeError(
"%s is an invalid non-neg int value" % value)
return ivalue
def checkFloatNneg(value):
fvalue = float(value)
if fvalue < 0:
raise argparse.ArgumentTypeError(
"%s is an invalid non-neg float value" % value)
return fvalue
def checkFloatPos(value):
fvalue = float(value)
if fvalue <= 0:
raise argparse.ArgumentTypeError(
"%s is an invalid positive float value" % value)
return fvalue
parser = argparse.ArgumentParser(
description='Hyperparameters for 2 layer SRNN Algorithm')
parser.add_argument('-d', '--data-dir', required=True,
help='Directory containing processed data.')
parser.add_argument('-h0', '--hidden-dim0', type=checkIntPos, default=64,
help='Hidden dimension of lower layer RNN cell.')
parser.add_argument('-h1', '--hidden-dim1', type=checkIntPos, default=32,
help='Hidden dimension of upper layer RNN cell.')
parser.add_argument('-bz', '--brick-size', type=checkIntPos, required=True,
help='Brick size to be used at the lower layer.')
parser.add_argument('-c', '--cell-type', default='LSTM',
help='Type of RNN cell to use among [LSTM, FastRNN, ' +
'FastGRNN')
parser.add_argument('-p', '--num-prototypes', type=checkIntPos, default=20,
help='Number of prototypes.')
parser.add_argument('-g', '--gamma', type=checkFloatPos, default=None,
help='Gamma for Gaussian kernel. If not provided, ' +
'median heuristic will be used to estimate gamma.')
parser.add_argument('-e', '--epochs', type=checkIntPos, default=10,
help='Total training epochs.')
parser.add_argument('-b', '--batch-size', type=checkIntPos, default=128,
help='Batch size for each pass.')
parser.add_argument('-r', '--learning-rate', type=checkFloatPos,
default=0.01,
help='Learning rate for ADAM Optimizer.')
parser.add_argument('-pS', '--print-step', type=int, default=200,
help='The number of update steps between print ' +
'calls to console.')
parser.add_argument('-vS', '--val-step', type=int, default=5,
help='The number of epochs between validation' +
'performance evaluation')
return parser.parse_args()
| [
1,
396,
14187,
1266,
313,
29883,
29897,
7783,
15025,
29889,
2178,
10462,
21676,
29889,
13,
29937,
10413,
21144,
1090,
278,
341,
1806,
19405,
29889,
13,
13,
5215,
1852,
5510,
13,
13,
1753,
679,
14098,
10262,
29906,
7883,
7295,
13,
1678,
822,
1423,
2928,
9135,
29898,
1767,
1125,
13,
308,
2561,
434,
353,
938,
29898,
1767,
29897,
13,
4706,
565,
29871,
2561,
434,
5277,
29871,
29900,
29901,
13,
9651,
12020,
1852,
5510,
29889,
15730,
1542,
2392,
29898,
13,
18884,
11860,
29879,
338,
385,
8340,
6374,
938,
995,
29908,
1273,
995,
29897,
13,
4706,
736,
29871,
2561,
434,
13,
13,
1678,
822,
1423,
2928,
29940,
10052,
29898,
1767,
1125,
13,
308,
2561,
434,
353,
938,
29898,
1767,
29897,
13,
4706,
565,
29871,
2561,
434,
529,
29871,
29900,
29901,
13,
9651,
12020,
1852,
5510,
29889,
15730,
1542,
2392,
29898,
13,
18884,
11860,
29879,
338,
385,
8340,
1661,
29899,
10052,
938,
995,
29908,
1273,
995,
29897,
13,
4706,
736,
29871,
2561,
434,
13,
13,
1678,
822,
1423,
11031,
29940,
10052,
29898,
1767,
1125,
13,
4706,
285,
1767,
353,
5785,
29898,
1767,
29897,
13,
4706,
565,
285,
1767,
529,
29871,
29900,
29901,
13,
9651,
12020,
1852,
5510,
29889,
15730,
1542,
2392,
29898,
13,
18884,
11860,
29879,
338,
385,
8340,
1661,
29899,
10052,
5785,
995,
29908,
1273,
995,
29897,
13,
4706,
736,
285,
1767,
13,
13,
1678,
822,
1423,
11031,
9135,
29898,
1767,
1125,
13,
4706,
285,
1767,
353,
5785,
29898,
1767,
29897,
13,
4706,
565,
285,
1767,
5277,
29871,
29900,
29901,
13,
9651,
12020,
1852,
5510,
29889,
15730,
1542,
2392,
29898,
13,
18884,
11860,
29879,
338,
385,
8340,
6374,
5785,
995,
29908,
1273,
995,
29897,
13,
4706,
736,
285,
1767,
13,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
2433,
26322,
546,
16744,
363,
29871,
29906,
7546,
21020,
10262,
29068,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29881,
742,
525,
489,
1272,
29899,
3972,
742,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
9882,
6943,
19356,
848,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29882,
29900,
742,
525,
489,
10892,
29899,
6229,
29900,
742,
1134,
29922,
3198,
2928,
9135,
29892,
2322,
29922,
29953,
29946,
29892,
13,
462,
4706,
1371,
2433,
25108,
9927,
310,
5224,
7546,
390,
10262,
3038,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29882,
29896,
742,
525,
489,
10892,
29899,
6229,
29896,
742,
1134,
29922,
3198,
2928,
9135,
29892,
2322,
29922,
29941,
29906,
29892,
13,
462,
4706,
1371,
2433,
25108,
9927,
310,
7568,
7546,
390,
10262,
3038,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29890,
29920,
742,
525,
489,
1182,
860,
29899,
2311,
742,
1134,
29922,
3198,
2928,
9135,
29892,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
29933,
9131,
2159,
304,
367,
1304,
472,
278,
5224,
7546,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29883,
742,
525,
489,
3729,
29899,
1853,
742,
2322,
2433,
29931,
1254,
29924,
742,
13,
462,
4706,
1371,
2433,
1542,
310,
390,
10262,
3038,
304,
671,
4249,
518,
29931,
1254,
29924,
29892,
23786,
29934,
10262,
29892,
525,
718,
13,
462,
4706,
525,
29943,
579,
14345,
10262,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29886,
742,
525,
489,
1949,
29899,
771,
4260,
7384,
742,
1134,
29922,
3198,
2928,
9135,
29892,
2322,
29922,
29906,
29900,
29892,
13,
462,
4706,
1371,
2433,
4557,
310,
410,
4260,
7384,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29887,
742,
525,
489,
4283,
742,
1134,
29922,
3198,
11031,
9135,
29892,
2322,
29922,
8516,
29892,
13,
462,
4706,
1371,
2433,
6642,
363,
22477,
8466,
29889,
960,
451,
4944,
29892,
525,
718,
13,
462,
4706,
525,
2168,
713,
540,
332,
4695,
674,
367,
1304,
304,
12678,
330,
2735,
29889,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29872,
742,
525,
489,
1022,
2878,
29879,
742,
1134,
29922,
3198,
2928,
9135,
29892,
2322,
29922,
29896,
29900,
29892,
13,
462,
4706,
1371,
2433,
11536,
6694,
21502,
12168,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29890,
742,
525,
489,
16175,
29899,
2311,
742,
1134,
29922,
3198,
2928,
9135,
29892,
2322,
29922,
29896,
29906,
29947,
29892,
13,
462,
4706,
1371,
2433,
23145,
2159,
363,
1269,
1209,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29878,
742,
525,
489,
21891,
29899,
10492,
742,
1134,
29922,
3198,
11031,
9135,
29892,
13,
462,
4706,
2322,
29922,
29900,
29889,
29900,
29896,
29892,
13,
462,
4706,
1371,
2433,
29931,
799,
1076,
6554,
363,
11033,
5194,
20693,
326,
3950,
29889,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29886,
29903,
742,
525,
489,
2158,
29899,
10568,
742,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29900,
29900,
29892,
13,
462,
4706,
1371,
2433,
1576,
1353,
310,
2767,
6576,
1546,
1596,
525,
718,
13,
462,
4706,
525,
29883,
4293,
304,
2991,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29894,
29903,
742,
525,
489,
791,
29899,
10568,
742,
1134,
29922,
524,
29892,
2322,
29922,
29945,
29892,
13,
462,
4706,
1371,
2433,
1576,
1353,
310,
21502,
12168,
1546,
8845,
29915,
718,
13,
462,
4706,
525,
546,
13390,
17983,
1495,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
580,
13,
2
] |
cryptocompy/price.py | ttsteiger/cryptocompy | 90 | 136691 | # price.py
from .helper_functions import (build_url, load_data, timestamp_to_date,
date_to_timestamp)
def get_current_price(fsyms, tsyms, e='all', try_conversion=True, full=False,
format='raw'):
"""Get latest trading price or full trading information in display or raw
format for the specified FROM/TO currency pairs.
Args:
fsyms: Single string or list of FROM symbols.
tsyms: Single string or list of TO symbols.
e: Default returns average price across all exchanges.
Can be set to the name of a single exchange.
try_conversion: If the crypto does not trade directly into the toSymbol
requested, BTC will be used for conversion.
If set to false, it will try to get values
without using any conversion at all.
full: Default of False returns only the latest price. True returns the
following dictionary structure containing the full trading info:
format: Default returns the 'RAW' format. Can be set to 'DISPLAY'
format.
Returns:
Returns a dictionary containing the latest price pairs
if full is set to false:
{fsym1: {tsym1: ..., tsym2:..., ...},
fsym2: {...},
...}
or full trading info dictionaries for all the price pairs in the other
case:
{fsym1: {tsym1: {'CHANGE24HOUR': ...,
'CHANGEPCT24HOUR': ...,
'FLAGS': ...,
'FROMSYMBOL': ...,
'HIGH24HOUR': ...,
'LASTMARKET': ...,
'LASTTRADEID': ...,
'LASTUPDATE': ...,
'LASTVOLUME': ...,
'LASTVOLUMETO': ...,
'LOW24HOUR': ...,
'MARKET' ...,
'MKTCAP': ...,
'OPEN24HOUR': ...,
'PRICE': ...,
'SUPPLY': ...,
'TOSYMBOL': ...,
'TYPE': ...,
'VOLUME24HOUR': ...,
'VOLUME24HOURTO': ...},
tsym2: ..., ...},
fsym2: {...},
...}
"""
# select API function based on 'full' parameter value
if not full:
func = 'pricemulti'
else:
func = 'pricemultifull'
# convert single fsym and tsym input to single element lists
if not isinstance(fsyms, list):
fsyms = [fsyms]
if not isinstance(tsyms, list):
tsyms = [tsyms]
# load data
url = build_url(func, fsyms=fsyms, tsyms=tsyms, e=e,
try_conversion=try_conversion)
data = load_data(url)
# select right format to return for full requests
if full and format == 'raw':
data = data['RAW']
elif full and format == 'display':
data = data['DISPLAY']
return data
def get_current_trading_info(fsym, tsym, markets='all', try_conversion=True,
format='raw'):
"""
Get the latest trading info of the requested pair as a volume weighted
average based on the markets requested.
Args:
fsym: FROM symbol.
tsym: TO symbol.
markets: List containing the market names.
try_conversion: If the crypto does not trade directly into the toSymbol
requested, BTC will be used for conversion.
If set to false, it will try to get values
without using any conversion at all.
format: Default returns the 'RAW' format. Can be set to 'DISPLAY'
format.
Returns:
The returned latest average trading information dictionary contains
the following key value pairs:
{'PRICE': ...,
'LASTVOLUMETO': ...,
'TOSYMBOL': ...,
'LOW24HOUR': ...,
'CHANGE24HOUR': ...,
'FROMSYMBOL': ...,
'FLAGS': ...,
'VOLUME24HOUR': ...,
'HIGH24HOUR': ...,
'LASTUPDATE': ...,
'VOLUME24HOURT': ...,
'LASTMARKET': ...,
'CHANGEPCT24HOUR': ...,
'OPEN24HOUR': ...,
'MARKET': ...,
'LASTTRADEID': ...,
'LASTVOLUME': ...}
"""
# load data
url = build_url('generateAvg', fsym=fsym, tsym=tsym, markets=markets,
try_conversion=try_conversion)
data = load_data(url)
# select format to return
if format == 'raw':
data = data['RAW']
elif format == 'display':
data = data['DISPLAY']
return {fsym: {tsym: data}}
def get_day_average_price(fsym, tsym, e='all', try_conversion=True,
avg_type='HourVWAP', utc_hour_diff=0):
"""
Get the current days average price of a currency pair.
Args:
fsym: FROM symbol.
tsym: TO symbol.
e: Default returns average price across all exchanges.
Can be set to the name of a single exchange.
try_conversion: If the crypto does not trade directly into the toSymbol
requested, BTC will be used for conversion.
If set to false, it will try to get values
without using any conversion at all.
avg_type: 'HourVWAP' returns a volume weighted average of the hourly
close price.
The other option 'MidHighLow' gives the average
between the 24 hour high and low.
utc_hour_diff: Pass hour difference to UTC for different time zone.
# add 'toTs' parameter
######################
######################
######################
######################
######################
######################
Returns:
Returns a price dictionairy containing the current
days average price as float.
{fsym: {tsym: price}}
"""
# load data
url = build_url('dayAvg', fsym=fsym, tsym=tsym, e=e,
try_conversion=try_conversion, avg_type=avg_type,
utc_hour_diff=utc_hour_diff)
data = load_data(url)
# remove 'ConversionType' information
del data['ConversionType']
return {fsym: data}
def get_historical_eod_price(fsym, tsyms, date, e='all', try_conversion=True):
"""Get end of day price for cryptocurrency in any other currency for the
requested timestamp.
Args:
fsym: FROM symbol.
tsyms: Single string or list of TO symbols.
date: Date as string with this format: "Y-m-d H:M:S".
e: Default returns average price across all exchanges.
Can be set to the name of a single exchange.
try_conversion: If the crypto does not trade directly into the toSymbol
requested, BTC will be used for conversion.
If set to false, it will try to get values
without using any conversion at all.
Returns:
Returns a dictionary containing the end of day price pairs for the
provided date.
{fsym: {tsym1: ..., tsym2: ..., ...}}
"""
# convert single fsym and tsym input to single element lists
if not isinstance(tsyms, list):
tsyms = [tsyms]
# convert date to timestamp
ts = date_to_timestamp(date)
# load data
url = build_url("pricehistorical", fsym=fsym, tsyms=tsyms, ts=ts,
e=e, try_conversion=try_conversion)
data = load_data(url)
return data
def get_historical_data(fsym, tsym, freq, info='full', e='all',
try_conversion=True, aggregate=1, limit=1440,
to_ts=False):
"""Get minute-by-minute historical price and volume information for
the requested currency pair. Available data is limited to the last 7 days.
Args:
fsym: FROM symbol.
tsym: TO symbol.
freq: Frequency of the data. Can be set to 'minute', 'hour' or 'day'.
info: Select price or volume information to return. Default of 'full'
returns all of them. Can be set to 'high', 'low', 'open', 'close',
'volumefrom', and 'volumeto' or a list containing several of those
values.
e: Default returns average price across all exchanges.
Can be set to the name of a single exchange.
try_conversion: If the crypto does not trade directly into the toSymbol
requested, BTC will be used for conversion.
If set to false, it will try to get values
without using any conversion at all.
aggregate: Aggregates the minute prices into
bins of the specified size.
limit: Number of minute prices. The limit settings depend on the freq
selected:
minute: default = 1440, min = 1, max = 2000
hour: default = 168, min = 1, max 2000
day: default = 30, min = 1, max 2000
Using aggregate reduces the maximum number of points that can be
returned by a factor equal to the chosen bin size.
'toTs': get historical data at a specific date.
This parameter can be :
* a datetime.datetime object like :
datetime.datetime(2019, 5, 16, 18, 1, 48)
* a int timestamp like : 1558022508
* a string timestamp like : "1558022508"
Returns:
List of dictionairies containing the price and volume information for
each requested tick.
[{'time': ..., 'close': ..., 'high': ..., 'low': ..., 'open': ...,
'volumefrom': ..., 'volumeto': ...},
{...},
...]
"""
# load data
url = build_url(freq, fsym=fsym, tsym=tsym, freq=freq, e=e,
try_conversion=try_conversion, aggregate=aggregate,
limit=limit, to_ts=to_ts)
data = load_data(url)
data = data['Data']
# convert timestamps to nice date format
for d in data:
d['time'] = timestamp_to_date(d['time'])
# convert single input info to single element list
if not isinstance(info, list):
info = [info]
# select information to return
if info[0] == 'full':
return data
else:
for d in data:
for k, v in list(d.items()):
if k not in info and k != 'time':
del d[k]
return data
| [
1,
396,
8666,
29889,
2272,
30004,
13,
30004,
13,
3166,
869,
20907,
29918,
12171,
1053,
313,
4282,
29918,
2271,
29892,
2254,
29918,
1272,
29892,
14334,
29918,
517,
29918,
1256,
11167,
13,
462,
1669,
2635,
29918,
517,
29918,
16394,
8443,
13,
30004,
13,
30004,
13,
1753,
679,
29918,
3784,
29918,
9175,
29898,
5847,
962,
29879,
29892,
260,
11967,
29879,
29892,
321,
2433,
497,
742,
1018,
29918,
535,
3259,
29922,
5574,
29892,
2989,
29922,
8824,
11167,
13,
462,
418,
3402,
2433,
1610,
29374,
30004,
13,
1678,
9995,
2577,
9281,
3534,
292,
8666,
470,
2989,
3534,
292,
2472,
297,
2479,
470,
10650,
30004,
13,
1678,
3402,
363,
278,
6790,
3895,
29914,
4986,
27550,
11000,
22993,
13,
30004,
13,
1678,
826,
3174,
29901,
30004,
13,
4706,
285,
11967,
29879,
29901,
16740,
1347,
470,
1051,
310,
3895,
15072,
22993,
13,
4706,
260,
11967,
29879,
29901,
16740,
1347,
470,
1051,
310,
7495,
15072,
22993,
13,
4706,
321,
29901,
13109,
3639,
6588,
8666,
4822,
599,
429,
25990,
22993,
13,
9651,
1815,
367,
731,
304,
278,
1024,
310,
263,
2323,
14523,
22993,
13,
4706,
1018,
29918,
535,
3259,
29901,
960,
278,
274,
17929,
947,
451,
11302,
4153,
964,
278,
304,
14730,
30004,
13,
9651,
13877,
29892,
350,
9472,
674,
367,
1304,
363,
11301,
22993,
13,
9651,
960,
731,
304,
2089,
29892,
372,
674,
1018,
304,
679,
1819,
30004,
13,
9651,
1728,
773,
738,
11301,
472,
599,
22993,
13,
4706,
2989,
29901,
13109,
310,
7700,
3639,
871,
278,
9281,
8666,
29889,
5852,
3639,
278,
30004,
13,
9651,
1494,
8600,
3829,
6943,
278,
2989,
3534,
292,
5235,
29901,
30004,
13,
4706,
3402,
29901,
13109,
3639,
278,
525,
4717,
29956,
29915,
3402,
29889,
1815,
367,
731,
304,
525,
23711,
29925,
18799,
29915,
30004,
13,
9651,
3402,
22993,
13,
1678,
16969,
29901,
30004,
13,
4706,
16969,
263,
8600,
6943,
278,
9281,
8666,
11000,
30004,
13,
4706,
565,
2989,
338,
731,
304,
2089,
29901,
30004,
13,
30004,
13,
4706,
426,
5847,
962,
29896,
29901,
426,
1372,
962,
29896,
29901,
2023,
29892,
260,
11967,
29906,
29901,
16361,
2023,
1118,
30004,
13,
308,
285,
11967,
29906,
29901,
426,
856,
1118,
30004,
13,
308,
2023,
8117,
13,
30004,
13,
4706,
470,
2989,
3534,
292,
5235,
21503,
4314,
363,
599,
278,
8666,
11000,
297,
278,
916,
30004,
13,
4706,
1206,
29901,
30004,
13,
30004,
13,
4706,
426,
5847,
962,
29896,
29901,
426,
1372,
962,
29896,
29901,
11117,
3210,
24336,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
3986,
525,
3210,
24336,
29925,
1783,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
3986,
525,
18823,
10749,
2396,
2023,
11167,
13,
462,
3986,
525,
21482,
14816,
9486,
5607,
2396,
2023,
11167,
13,
462,
3986,
525,
29950,
6259,
29950,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
3986,
525,
4375,
1254,
1529,
29934,
29968,
2544,
2396,
2023,
11167,
13,
462,
3986,
525,
4375,
1254,
29911,
4717,
2287,
1367,
2396,
2023,
11167,
13,
462,
3986,
525,
4375,
1254,
14474,
2396,
2023,
11167,
13,
462,
3986,
525,
4375,
1254,
29963,
5607,
29965,
2303,
2396,
2023,
11167,
13,
462,
3986,
525,
4375,
1254,
29963,
5607,
29965,
2303,
4986,
2396,
2023,
11167,
13,
462,
3986,
525,
27998,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
3986,
525,
1529,
29934,
29968,
2544,
29915,
2023,
11167,
13,
462,
308,
525,
29924,
29968,
9472,
3301,
2396,
2023,
11167,
13,
462,
308,
525,
4590,
1430,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
308,
525,
10593,
12107,
2396,
2023,
11167,
13,
462,
3986,
525,
29903,
4897,
7390,
29979,
2396,
2023,
11167,
13,
462,
3986,
525,
29911,
3267,
29979,
9486,
5607,
2396,
2023,
11167,
13,
462,
3986,
525,
11116,
2396,
2023,
11167,
13,
462,
3986,
525,
29963,
5607,
29965,
2303,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
462,
3986,
525,
29963,
5607,
29965,
2303,
29906,
29946,
8187,
4574,
4986,
2396,
2023,
1118,
30004,
13,
462,
260,
11967,
29906,
29901,
2023,
29892,
2023,
1118,
30004,
13,
4706,
285,
11967,
29906,
29901,
426,
856,
1118,
30004,
13,
4706,
2023,
8117,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
1831,
3450,
740,
2729,
373,
525,
8159,
29915,
3443,
995,
30004,
13,
1678,
565,
451,
2989,
29901,
30004,
13,
4706,
3653,
353,
525,
558,
293,
331,
499,
29875,
29915,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
3653,
353,
525,
558,
293,
331,
499,
361,
913,
29915,
30004,
13,
30004,
13,
1678,
396,
3588,
2323,
285,
11967,
322,
260,
11967,
1881,
304,
2323,
1543,
8857,
30004,
13,
1678,
565,
451,
338,
8758,
29898,
5847,
962,
29879,
29892,
1051,
1125,
30004,
13,
4706,
285,
11967,
29879,
353,
518,
5847,
962,
29879,
29962,
30004,
13,
1678,
565,
451,
338,
8758,
29898,
1372,
962,
29879,
29892,
1051,
1125,
30004,
13,
4706,
260,
11967,
29879,
353,
518,
1372,
962,
29879,
29962,
30004,
13,
30004,
13,
1678,
396,
2254,
848,
30004,
13,
1678,
3142,
353,
2048,
29918,
2271,
29898,
9891,
29892,
285,
11967,
29879,
29922,
5847,
962,
29879,
29892,
260,
11967,
29879,
29922,
1372,
962,
29879,
29892,
321,
29922,
29872,
11167,
13,
462,
1678,
1018,
29918,
535,
3259,
29922,
2202,
29918,
535,
3259,
8443,
13,
1678,
848,
353,
2254,
29918,
1272,
29898,
2271,
8443,
13,
30004,
13,
1678,
396,
29871,
1831,
1492,
3402,
304,
736,
363,
2989,
7274,
30004,
13,
1678,
565,
2989,
322,
3402,
1275,
525,
1610,
2396,
30004,
13,
4706,
848,
353,
848,
1839,
4717,
29956,
2033,
30004,
13,
1678,
25342,
2989,
322,
3402,
1275,
525,
4990,
2396,
30004,
13,
4706,
848,
353,
848,
1839,
23711,
29925,
18799,
2033,
30004,
13,
30004,
13,
1678,
736,
848,
30004,
13,
30004,
13,
30004,
13,
1753,
679,
29918,
3784,
29918,
509,
9382,
29918,
3888,
29898,
5847,
962,
29892,
260,
11967,
29892,
2791,
1691,
2433,
497,
742,
1018,
29918,
535,
3259,
29922,
5574,
11167,
13,
462,
632,
3402,
2433,
1610,
29374,
30004,
13,
1678,
9995,
30004,
13,
1678,
3617,
278,
9281,
3534,
292,
5235,
310,
278,
13877,
5101,
408,
263,
7977,
7688,
287,
30004,
13,
1678,
6588,
2729,
373,
278,
2791,
1691,
13877,
22993,
13,
30004,
13,
1678,
826,
3174,
29901,
30004,
13,
4706,
285,
11967,
29901,
3895,
5829,
22993,
13,
4706,
260,
11967,
29901,
7495,
5829,
22993,
13,
4706,
2791,
1691,
29901,
2391,
6943,
278,
9999,
2983,
22993,
13,
4706,
1018,
29918,
535,
3259,
29901,
960,
278,
274,
17929,
947,
451,
11302,
4153,
964,
278,
304,
14730,
30004,
13,
9651,
13877,
29892,
350,
9472,
674,
367,
1304,
363,
11301,
22993,
13,
9651,
960,
731,
304,
2089,
29892,
372,
674,
1018,
304,
679,
1819,
30004,
13,
9651,
1728,
773,
738,
11301,
472,
599,
22993,
13,
4706,
3402,
29901,
13109,
3639,
278,
525,
4717,
29956,
29915,
3402,
29889,
1815,
367,
731,
304,
525,
23711,
29925,
18799,
29915,
30004,
13,
9651,
3402,
22993,
13,
30004,
13,
1678,
16969,
29901,
30004,
13,
4706,
450,
4133,
9281,
6588,
3534,
292,
2472,
8600,
3743,
30004,
13,
4706,
278,
1494,
1820,
995,
11000,
29901,
30004,
13,
30004,
13,
4706,
11117,
10593,
12107,
2396,
2023,
11167,
13,
308,
525,
4375,
1254,
29963,
5607,
29965,
2303,
4986,
2396,
2023,
11167,
13,
308,
525,
29911,
3267,
29979,
9486,
5607,
2396,
2023,
11167,
13,
308,
525,
27998,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
3210,
24336,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
21482,
14816,
9486,
5607,
2396,
2023,
11167,
13,
308,
525,
18823,
10749,
2396,
2023,
11167,
13,
308,
525,
29963,
5607,
29965,
2303,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
29950,
6259,
29950,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
4375,
1254,
14474,
2396,
2023,
11167,
13,
308,
525,
29963,
5607,
29965,
2303,
29906,
29946,
8187,
4574,
29911,
2396,
2023,
11167,
13,
308,
525,
4375,
1254,
1529,
29934,
29968,
2544,
2396,
2023,
11167,
13,
308,
525,
3210,
24336,
29925,
1783,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
4590,
1430,
29906,
29946,
8187,
4574,
2396,
2023,
11167,
13,
308,
525,
1529,
29934,
29968,
2544,
2396,
2023,
11167,
13,
308,
525,
4375,
1254,
29911,
4717,
2287,
1367,
2396,
2023,
11167,
13,
308,
525,
4375,
1254,
29963,
5607,
29965,
2303,
2396,
2023,
8117,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
2254,
848,
30004,
13,
1678,
3142,
353,
2048,
29918,
2271,
877,
17158,
12810,
29887,
742,
285,
11967,
29922,
5847,
962,
29892,
260,
11967,
29922,
1372,
962,
29892,
2791,
1691,
29922,
3502,
1691,
11167,
13,
462,
1678,
1018,
29918,
535,
3259,
29922,
2202,
29918,
535,
3259,
8443,
13,
1678,
848,
353,
2254,
29918,
1272,
29898,
2271,
8443,
13,
30004,
13,
1678,
396,
1831,
3402,
304,
736,
30004,
13,
1678,
565,
3402,
1275,
525,
1610,
2396,
30004,
13,
4706,
848,
353,
848,
1839,
4717,
29956,
2033,
30004,
13,
1678,
25342,
3402,
1275,
525,
4990,
2396,
30004,
13,
4706,
848,
353,
848,
1839,
23711,
29925,
18799,
2033,
30004,
13,
30004,
13,
1678,
736,
426,
5847,
962,
29901,
426,
1372,
962,
29901,
848,
930,
30004,
13,
30004,
13,
30004,
13,
1753,
679,
29918,
3250,
29918,
12483,
482,
29918,
9175,
29898,
5847,
962,
29892,
260,
11967,
29892,
321,
2433,
497,
742,
1018,
29918,
535,
3259,
29922,
5574,
11167,
13,
462,
3986,
1029,
29887,
29918,
1853,
2433,
29950,
473,
29963,
29956,
3301,
742,
3477,
29883,
29918,
18721,
29918,
12765,
29922,
29900,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
3617,
278,
1857,
3841,
6588,
8666,
310,
263,
27550,
5101,
22993,
13,
30004,
13,
1678,
826,
3174,
29901,
30004,
13,
4706,
285,
11967,
29901,
3895,
5829,
22993,
13,
4706,
260,
11967,
29901,
7495,
5829,
22993,
13,
4706,
321,
29901,
13109,
3639,
6588,
8666,
4822,
599,
429,
25990,
22993,
13,
9651,
1815,
367,
731,
304,
278,
1024,
310,
263,
2323,
14523,
22993,
13,
4706,
1018,
29918,
535,
3259,
29901,
960,
278,
274,
17929,
947,
451,
11302,
4153,
964,
278,
304,
14730,
30004,
13,
9651,
13877,
29892,
350,
9472,
674,
367,
1304,
363,
11301,
22993,
13,
9651,
960,
731,
304,
2089,
29892,
372,
674,
1018,
304,
679,
1819,
30004,
13,
9651,
1728,
773,
738,
11301,
472,
599,
22993,
13,
4706,
1029,
29887,
29918,
1853,
29901,
525,
29950,
473,
29963,
29956,
3301,
29915,
3639,
263,
7977,
7688,
287,
6588,
310,
278,
7234,
368,
30004,
13,
9651,
3802,
8666,
22993,
13,
9651,
450,
916,
2984,
525,
29924,
333,
16382,
29931,
340,
29915,
4076,
278,
6588,
30004,
13,
9651,
1546,
278,
29871,
29906,
29946,
7234,
1880,
322,
4482,
22993,
13,
4706,
3477,
29883,
29918,
18721,
29918,
12765,
29901,
6978,
7234,
4328,
304,
17998,
363,
1422,
931,
10640,
22993,
13,
30004,
13,
4706,
396,
788,
525,
517,
29911,
29879,
29915,
3443,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
4706,
835,
13383,
2277,
29937,
30004,
13,
30004,
13,
1678,
16969,
29901,
30004,
13,
4706,
16969,
263,
8666,
21503,
1466,
29891,
6943,
278,
1857,
30004,
13,
4706,
3841,
6588,
8666,
408,
5785,
22993,
13,
30004,
13,
4706,
426,
5847,
962,
29901,
426,
1372,
962,
29901,
8666,
930,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
2254,
848,
30004,
13,
1678,
3142,
353,
2048,
29918,
2271,
877,
3250,
12810,
29887,
742,
285,
11967,
29922,
5847,
962,
29892,
260,
11967,
29922,
1372,
962,
29892,
321,
29922,
29872,
11167,
13,
462,
1678,
1018,
29918,
535,
3259,
29922,
2202,
29918,
535,
3259,
29892,
1029,
29887,
29918,
1853,
29922,
485,
29887,
29918,
1853,
11167,
13,
462,
1678,
3477,
29883,
29918,
18721,
29918,
12765,
29922,
329,
29883,
29918,
18721,
29918,
12765,
8443,
13,
1678,
848,
353,
2254,
29918,
1272,
29898,
2271,
8443,
13,
30004,
13,
1678,
396,
3349,
525,
1168,
3259,
1542,
29915,
2472,
30004,
13,
1678,
628,
848,
1839,
1168,
3259,
1542,
2033,
30004,
13,
30004,
13,
1678,
736,
426,
5847,
962,
29901,
848,
8117,
13,
30004,
13,
30004,
13,
1753,
679,
29918,
16211,
936,
29918,
29872,
397,
29918,
9175,
29898,
5847,
962,
29892,
260,
11967,
29879,
29892,
2635,
29892,
321,
2433,
497,
742,
1018,
29918,
535,
3259,
29922,
5574,
1125,
30004,
13,
1678,
9995,
2577,
1095,
310,
2462,
8666,
363,
24941,
542,
10880,
297,
738,
916,
27550,
363,
278,
30004,
13,
1678,
13877,
14334,
22993,
13,
30004,
13,
1678,
826,
3174,
29901,
30004,
13,
4706,
285,
11967,
29901,
3895,
5829,
22993,
13,
4706,
260,
11967,
29879,
29901,
16740,
1347,
470,
1051,
310,
7495,
15072,
22993,
13,
4706,
2635,
29901,
4712,
408,
1347,
411,
445,
3402,
29901,
376,
29979,
29899,
29885,
29899,
29881,
379,
29901,
29924,
29901,
29903,
1642,
30004,
13,
4706,
321,
29901,
13109,
3639,
6588,
8666,
4822,
599,
429,
25990,
22993,
13,
965,
1815,
367,
731,
304,
278,
1024,
310,
263,
2323,
14523,
22993,
13,
4706,
1018,
29918,
535,
3259,
29901,
960,
278,
274,
17929,
947,
451,
11302,
4153,
964,
278,
304,
14730,
30004,
13,
9651,
13877,
29892,
350,
9472,
674,
367,
1304,
363,
11301,
22993,
13,
9651,
960,
731,
304,
2089,
29892,
372,
674,
1018,
304,
679,
1819,
30004,
13,
9651,
1728,
773,
738,
11301,
472,
599,
22993,
13,
30004,
13,
1678,
16969,
29901,
30004,
13,
4706,
16969,
263,
8600,
6943,
278,
1095,
310,
2462,
8666,
11000,
363,
278,
30004,
13,
4706,
4944,
2635,
22993,
13,
30004,
13,
4706,
426,
5847,
962,
29901,
426,
1372,
962,
29896,
29901,
2023,
29892,
260,
11967,
29906,
29901,
2023,
29892,
2023,
930,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
3588,
2323,
285,
11967,
322,
260,
11967,
1881,
304,
2323,
1543,
8857,
30004,
13,
1678,
565,
451,
338,
8758,
29898,
1372,
962,
29879,
29892,
1051,
1125,
30004,
13,
4706,
260,
11967,
29879,
353,
518,
1372,
962,
29879,
29962,
30004,
13,
30004,
13,
1678,
396,
3588,
2635,
304,
14334,
30004,
13,
1678,
18696,
353,
2635,
29918,
517,
29918,
16394,
29898,
1256,
8443,
13,
30004,
13,
1678,
396,
2254,
848,
30004,
13,
1678,
3142,
353,
2048,
29918,
2271,
703,
9175,
16211,
936,
613,
285,
11967,
29922,
5847,
962,
29892,
260,
11967,
29879,
29922,
1372,
962,
29879,
29892,
18696,
29922,
1372,
11167,
13,
462,
1678,
321,
29922,
29872,
29892,
1018,
29918,
535,
3259,
29922,
2202,
29918,
535,
3259,
8443,
13,
1678,
848,
353,
2254,
29918,
1272,
29898,
2271,
8443,
13,
30004,
13,
1678,
736,
848,
30004,
13,
30004,
13,
30004,
13,
1753,
679,
29918,
16211,
936,
29918,
1272,
29898,
5847,
962,
29892,
260,
11967,
29892,
3005,
29939,
29892,
5235,
2433,
8159,
742,
321,
2433,
497,
23592,
13,
462,
4706,
1018,
29918,
535,
3259,
29922,
5574,
29892,
20431,
29922,
29896,
29892,
4046,
29922,
29896,
29946,
29946,
29900,
11167,
13,
462,
4706,
304,
29918,
1372,
29922,
8824,
1125,
30004,
13,
1678,
9995,
2577,
11015,
29899,
1609,
29899,
1195,
1082,
15839,
8666,
322,
7977,
2472,
363,
30004,
13,
1678,
278,
13877,
27550,
5101,
29889,
7740,
3106,
848,
338,
9078,
304,
278,
1833,
29871,
29955,
3841,
22993,
13,
30004,
13,
1678,
826,
3174,
29901,
30004,
13,
4706,
285,
11967,
29901,
3895,
5829,
22993,
13,
4706,
260,
11967,
29901,
7495,
5829,
22993,
13,
4706,
3005,
29939,
29901,
3878,
23860,
310,
278,
848,
29889,
1815,
367,
731,
304,
525,
1195,
1082,
742,
525,
18721,
29915,
470,
525,
3250,
4286,
30004,
13,
4706,
5235,
29901,
7605,
8666,
470,
7977,
2472,
304,
736,
29889,
13109,
310,
525,
8159,
29915,
30004,
13,
9651,
3639,
599,
310,
963,
29889,
1815,
367,
731,
304,
525,
9812,
742,
525,
677,
742,
525,
3150,
742,
525,
5358,
23592,
13,
9651,
525,
1555,
398,
1389,
456,
742,
322,
525,
1555,
398,
10896,
29915,
470,
263,
1051,
6943,
3196,
310,
1906,
30004,
13,
9651,
1819,
22993,
13,
4706,
321,
29901,
13109,
3639,
6588,
8666,
4822,
599,
429,
25990,
22993,
13,
965,
1815,
367,
731,
304,
278,
1024,
310,
263,
2323,
14523,
22993,
13,
4706,
1018,
29918,
535,
3259,
29901,
960,
278,
274,
17929,
947,
451,
11302,
4153,
964,
278,
304,
14730,
30004,
13,
9651,
13877,
29892,
350,
9472,
674,
367,
1304,
363,
11301,
22993,
13,
9651,
960,
731,
304,
2089,
29892,
372,
674,
1018,
304,
679,
1819,
30004,
13,
9651,
1728,
773,
738,
11301,
472,
599,
22993,
13,
4706,
20431,
29901,
319,
26127,
1078,
278,
11015,
26094,
964,
30004,
13,
462,
259,
289,
1144,
310,
278,
6790,
2159,
22993,
13,
4706,
4046,
29901,
9681,
310,
11015,
26094,
29889,
450,
4046,
6055,
8839,
373,
278,
3005,
29939,
30004,
13,
9651,
4629,
29901,
30004,
13,
18884,
11015,
29901,
2322,
353,
29871,
29896,
29946,
29946,
29900,
29892,
1375,
353,
29871,
29896,
29892,
4236,
353,
29871,
29906,
29900,
29900,
29900,
30004,
13,
18884,
7234,
29901,
2322,
353,
29871,
29896,
29953,
29947,
29892,
1375,
353,
29871,
29896,
29892,
4236,
29871,
29906,
29900,
29900,
29900,
30004,
13,
18884,
2462,
29901,
2322,
353,
29871,
29941,
29900,
29892,
1375,
353,
29871,
29896,
29892,
4236,
29871,
29906,
29900,
29900,
29900,
30004,
13,
30004,
13,
9651,
5293,
20431,
26830,
278,
7472,
1353,
310,
3291,
393,
508,
367,
30004,
13,
9651,
4133,
491,
263,
7329,
5186,
304,
278,
10434,
9016,
2159,
22993,
13,
30004,
13,
4706,
525,
517,
29911,
29879,
2396,
679,
15839,
848,
472,
263,
2702,
2635,
22993,
13,
18884,
910,
3443,
508,
367,
584,
30004,
13,
462,
1678,
334,
263,
12865,
29889,
12673,
1203,
763,
584,
30004,
13,
462,
4706,
12865,
29889,
12673,
29898,
29906,
29900,
29896,
29929,
29892,
29871,
29945,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29947,
29892,
29871,
29896,
29892,
29871,
29946,
29947,
8443,
13,
462,
1678,
334,
263,
938,
14334,
763,
584,
29871,
29896,
29945,
29945,
29947,
29900,
29906,
29906,
29945,
29900,
29947,
30004,
13,
462,
1678,
334,
263,
1347,
14334,
763,
584,
376,
29896,
29945,
29945,
29947,
29900,
29906,
29906,
29945,
29900,
29947,
19451,
13,
30004,
13,
1678,
16969,
29901,
30004,
13,
4706,
2391,
310,
21503,
1794,
2722,
6943,
278,
8666,
322,
7977,
2472,
363,
30004,
13,
4706,
1269,
13877,
16892,
22993,
13,
30004,
13,
4706,
518,
10998,
2230,
2396,
2023,
29892,
525,
5358,
2396,
2023,
29892,
525,
9812,
2396,
2023,
29892,
525,
677,
2396,
2023,
29892,
525,
3150,
2396,
2023,
11167,
13,
3986,
525,
1555,
398,
1389,
456,
2396,
2023,
29892,
525,
1555,
398,
10896,
2396,
2023,
1118,
30004,
13,
3986,
426,
856,
1118,
30004,
13,
308,
2023,
29962,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
396,
2254,
848,
30004,
13,
1678,
3142,
353,
2048,
29918,
2271,
29898,
29888,
7971,
29892,
285,
11967,
29922,
5847,
962,
29892,
260,
11967,
29922,
1372,
962,
29892,
3005,
29939,
29922,
29888,
7971,
29892,
321,
29922,
29872,
11167,
13,
462,
1678,
1018,
29918,
535,
3259,
29922,
2202,
29918,
535,
3259,
29892,
20431,
29922,
26193,
403,
11167,
13,
462,
1678,
4046,
29922,
13400,
29892,
304,
29918,
1372,
29922,
517,
29918,
1372,
8443,
13,
1678,
848,
353,
2254,
29918,
1272,
29898,
2271,
8443,
13,
1678,
848,
353,
848,
1839,
1469,
2033,
30004,
13,
30004,
13,
1678,
396,
3588,
5335,
342,
15092,
304,
7575,
2635,
3402,
30004,
13,
1678,
363,
270,
297,
848,
29901,
30004,
13,
4706,
270,
1839,
2230,
2033,
353,
14334,
29918,
517,
29918,
1256,
29898,
29881,
1839,
2230,
2033,
8443,
13,
30004,
13,
1678,
396,
3588,
2323,
1881,
5235,
304,
2323,
1543,
1051,
30004,
13,
1678,
565,
451,
338,
8758,
29898,
3888,
29892,
1051,
1125,
30004,
13,
4706,
5235,
353,
518,
3888,
29962,
30004,
13,
30004,
13,
1678,
396,
1831,
2472,
304,
736,
30004,
13,
1678,
565,
5235,
29961,
29900,
29962,
1275,
525,
8159,
2396,
30004,
13,
4706,
736,
848,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
363,
270,
297,
848,
29901,
30004,
13,
9651,
363,
413,
29892,
325,
297,
1051,
29898,
29881,
29889,
7076,
580,
1125,
30004,
13,
18884,
565,
413,
451,
297,
5235,
322,
413,
2804,
525,
2230,
2396,
30004,
13,
462,
1678,
628,
270,
29961,
29895,
29962,
30004,
13,
30004,
13,
4706,
736,
848,
30004,
13,
2
] |
web/app.py | thyme4soup/pi-plant | 0 | 80569 | <gh_stars>0
#!/usr/bin/env python
from importlib import import_module
import os
import sys
import json
import datetime
import random
import string
import sqlite3 as lite
import logging
from logging.handlers import RotatingFileHandler
from flask import (
Flask, render_template, Response,
request, flash, send_from_directory,
redirect, jsonify
)
path = sys.path[0] + '/' if sys.path[0] else ''
database = path + 'plant.db'
log = path + 'app.log'
metric_fields = ['moisture']
log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(funcName)s(%(lineno)d) %(message)s')
my_handler = RotatingFileHandler(log, mode='a', maxBytes=5*1024,
backupCount=2, encoding=None, delay=0)
my_handler.setFormatter(log_formatter)
my_handler.setLevel(logging.INFO)
app_log = logging.getLogger()
app_log.setLevel(logging.INFO)
app_log.addHandler(my_handler)
app = Flask(__name__)
app.secret_key = ''.join(random.choice(string.ascii_lowercase) for i in range(random.randrange(8, 15)))
def get_metrics():
con = lite.connect(database)
moisture = []
with con:
cur = con.cursor()
for row in cur.execute("select * from moisture order by timestamp DESC limit 50"):
moisture.append(row)
print(moisture)
metrics = {
'moisture': moisture
}
return metrics
def add_metrics(metrics):
con = lite.connect(database)
with con:
for key, val in metrics.items():
if key not in metric_fields:
continue
cur = con.cursor()
cur.execute("insert into moisture (timestamp, value) values(datetime('now'), {})".format(val))
app_log.info(f'stored field {key} with value {val}')
@app.route('/', methods=['POST', 'GET'])
def index():
"""Video streaming home page."""
metrics = get_metrics()
auto_enabled = True
con = lite.connect(database)
print(con)
if request.method == 'POST':
if request.form['action'] == 'water':
os.system('python water.py manual &')
elif request.form['action'] == 'auto-toggle-on':
with con:
# set db value
cur = con.cursor()
cur.execute("update auto set is_auto = 1")
print("set true")
elif request.form['action'] == 'auto-toggle-off':
with con:
# set db value
cur = con.cursor()
cur.execute("update auto set is_auto = 0")
print("set false")
with con:
# set db value
cur = con.cursor()
cur.execute("select is_auto from auto")
auto_enabled = False if cur.fetchone()[0] == 0 else True
cur.execute("select hours from frequency")
hours = cur.fetchone()[0]
return render_template('index.html',
metrics=json.dumps(metrics),
auto_enabled = auto_enabled,
hours = hours)
@app.route('/status', methods=['GET'])
def get_status():
return jsonify(get_metrics())
@app.route('/report/<datatype>', methods=['POST'])
def receive_report(datatype):
if datatype == 'data':
try:
content = request.get_json()
add_metrics(content['data'])
except e:
msg = "payload must be a valid json"
return jsonify({"error": msg}), 400
elif datatype == 'image':
pass
else:
msg = "invalid report endpoint"
return jsonify({"error": msg}), 404
return Response(200)
@app.route('/video_feed', methods=['GET'])
def video_feed():
return send_from_directory('resources/', 'plantgif.gif')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80, threaded=True, use_reloader=True, debug=True)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
3166,
1053,
1982,
1053,
1053,
29918,
5453,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
4390,
13,
5215,
12865,
13,
5215,
4036,
13,
5215,
1347,
13,
5215,
21120,
29941,
408,
301,
568,
13,
5215,
12183,
13,
3166,
12183,
29889,
3179,
9306,
1053,
9664,
1218,
2283,
4598,
13,
3166,
29784,
1053,
313,
13,
1678,
2379,
1278,
29892,
4050,
29918,
6886,
29892,
13291,
29892,
13,
1678,
2009,
29892,
11013,
29892,
3638,
29918,
3166,
29918,
12322,
29892,
13,
1678,
6684,
29892,
4390,
1598,
13,
29897,
13,
13,
13,
2084,
353,
10876,
29889,
2084,
29961,
29900,
29962,
718,
8207,
29915,
565,
10876,
29889,
2084,
29961,
29900,
29962,
1683,
6629,
13,
9803,
353,
2224,
718,
525,
24389,
29889,
2585,
29915,
13,
1188,
353,
2224,
718,
525,
932,
29889,
1188,
29915,
13,
13,
16414,
29918,
9621,
353,
6024,
4346,
391,
545,
2033,
13,
13,
1188,
29918,
689,
2620,
353,
12183,
29889,
18522,
877,
29995,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
5563,
978,
29897,
29879,
1273,
29898,
9891,
1170,
29897,
29879,
29414,
29898,
1915,
8154,
29897,
29881,
29897,
1273,
29898,
4906,
29897,
29879,
1495,
13,
1357,
29918,
13789,
353,
9664,
1218,
2283,
4598,
29898,
1188,
29892,
4464,
2433,
29874,
742,
4236,
11207,
29922,
29945,
29930,
29896,
29900,
29906,
29946,
29892,
13,
462,
462,
16199,
3981,
29922,
29906,
29892,
8025,
29922,
8516,
29892,
9055,
29922,
29900,
29897,
13,
1357,
29918,
13789,
29889,
842,
18522,
29898,
1188,
29918,
689,
2620,
29897,
13,
1357,
29918,
13789,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
932,
29918,
1188,
353,
12183,
29889,
657,
16363,
580,
13,
932,
29918,
1188,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
932,
29918,
1188,
29889,
1202,
4598,
29898,
1357,
29918,
13789,
29897,
13,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
932,
29889,
19024,
29918,
1989,
353,
525,
4286,
7122,
29898,
8172,
29889,
16957,
29898,
1807,
29889,
294,
18869,
29918,
13609,
4878,
29897,
363,
474,
297,
3464,
29898,
8172,
29889,
9502,
3881,
29898,
29947,
29892,
29871,
29896,
29945,
4961,
13,
13,
1753,
679,
29918,
2527,
10817,
7295,
13,
13,
1678,
378,
353,
301,
568,
29889,
6915,
29898,
9803,
29897,
13,
1678,
2730,
391,
545,
353,
5159,
13,
1678,
411,
378,
29901,
13,
4706,
3151,
353,
378,
29889,
18127,
580,
13,
4706,
363,
1948,
297,
3151,
29889,
7978,
703,
2622,
334,
515,
2730,
391,
545,
1797,
491,
14334,
23050,
4046,
29871,
29945,
29900,
29908,
1125,
13,
9651,
2730,
391,
545,
29889,
4397,
29898,
798,
29897,
13,
1678,
1596,
29898,
4346,
391,
545,
29897,
13,
13,
1678,
21556,
353,
426,
13,
4706,
525,
4346,
391,
545,
2396,
2730,
391,
545,
13,
1678,
500,
13,
1678,
736,
21556,
13,
13,
1753,
788,
29918,
2527,
10817,
29898,
2527,
10817,
1125,
13,
1678,
378,
353,
301,
568,
29889,
6915,
29898,
9803,
29897,
13,
1678,
411,
378,
29901,
13,
4706,
363,
1820,
29892,
659,
297,
21556,
29889,
7076,
7295,
13,
9651,
565,
1820,
451,
297,
12714,
29918,
9621,
29901,
13,
18884,
6773,
13,
9651,
3151,
353,
378,
29889,
18127,
580,
13,
9651,
3151,
29889,
7978,
703,
7851,
964,
2730,
391,
545,
313,
16394,
29892,
995,
29897,
1819,
29898,
12673,
877,
3707,
5477,
426,
1800,
1642,
4830,
29898,
791,
876,
13,
9651,
623,
29918,
1188,
29889,
3888,
29898,
29888,
29915,
303,
4395,
1746,
426,
1989,
29913,
411,
995,
426,
791,
29913,
1495,
13,
13,
29992,
932,
29889,
13134,
11219,
742,
3519,
29922,
1839,
5438,
742,
525,
7194,
11287,
13,
1753,
2380,
7295,
13,
1678,
9995,
15167,
24820,
3271,
1813,
1213,
15945,
13,
1678,
21556,
353,
679,
29918,
2527,
10817,
580,
13,
1678,
4469,
29918,
17590,
353,
5852,
13,
1678,
378,
353,
301,
568,
29889,
6915,
29898,
9803,
29897,
13,
1678,
1596,
29898,
535,
29897,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
565,
2009,
29889,
689,
1839,
2467,
2033,
1275,
525,
13405,
2396,
13,
9651,
2897,
29889,
5205,
877,
4691,
4094,
29889,
2272,
12219,
669,
1495,
13,
13,
4706,
25342,
2009,
29889,
689,
1839,
2467,
2033,
1275,
525,
6921,
29899,
13270,
29899,
265,
2396,
13,
9651,
411,
378,
29901,
13,
18884,
396,
731,
4833,
995,
13,
18884,
3151,
353,
378,
29889,
18127,
580,
13,
18884,
3151,
29889,
7978,
703,
5504,
4469,
731,
338,
29918,
6921,
353,
29871,
29896,
1159,
13,
18884,
1596,
703,
842,
1565,
1159,
13,
13,
4706,
25342,
2009,
29889,
689,
1839,
2467,
2033,
1275,
525,
6921,
29899,
13270,
29899,
2696,
2396,
13,
9651,
411,
378,
29901,
13,
18884,
396,
731,
4833,
995,
13,
18884,
3151,
353,
378,
29889,
18127,
580,
13,
18884,
3151,
29889,
7978,
703,
5504,
4469,
731,
338,
29918,
6921,
353,
29871,
29900,
1159,
13,
18884,
1596,
703,
842,
2089,
1159,
13,
13,
1678,
411,
378,
29901,
13,
4706,
396,
731,
4833,
995,
13,
4706,
3151,
353,
378,
29889,
18127,
580,
13,
4706,
3151,
29889,
7978,
703,
2622,
338,
29918,
6921,
515,
4469,
1159,
13,
4706,
4469,
29918,
17590,
353,
7700,
565,
3151,
29889,
9155,
650,
580,
29961,
29900,
29962,
1275,
29871,
29900,
1683,
5852,
13,
4706,
3151,
29889,
7978,
703,
2622,
6199,
515,
10868,
1159,
13,
4706,
6199,
353,
3151,
29889,
9155,
650,
580,
29961,
29900,
29962,
13,
13,
1678,
736,
4050,
29918,
6886,
877,
2248,
29889,
1420,
742,
13,
462,
9651,
21556,
29922,
3126,
29889,
29881,
17204,
29898,
2527,
10817,
511,
13,
462,
9651,
4469,
29918,
17590,
353,
4469,
29918,
17590,
29892,
13,
462,
9651,
6199,
353,
6199,
29897,
13,
13,
29992,
932,
29889,
13134,
11219,
4882,
742,
3519,
29922,
1839,
7194,
11287,
13,
1753,
679,
29918,
4882,
7295,
13,
1678,
736,
4390,
1598,
29898,
657,
29918,
2527,
10817,
3101,
13,
13,
29992,
932,
29889,
13134,
11219,
12276,
29914,
29966,
4130,
23179,
29958,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
7150,
29918,
12276,
29898,
4130,
23179,
1125,
13,
1678,
565,
1418,
23179,
1275,
525,
1272,
2396,
13,
4706,
1018,
29901,
13,
9651,
2793,
353,
2009,
29889,
657,
29918,
3126,
580,
13,
9651,
788,
29918,
2527,
10817,
29898,
3051,
1839,
1272,
11287,
13,
4706,
5174,
321,
29901,
13,
9651,
10191,
353,
376,
23813,
1818,
367,
263,
2854,
4390,
29908,
13,
9651,
736,
4390,
1598,
3319,
29908,
2704,
1115,
10191,
9594,
29871,
29946,
29900,
29900,
13,
1678,
25342,
1418,
23179,
1275,
525,
3027,
2396,
13,
4706,
1209,
13,
1678,
1683,
29901,
13,
4706,
10191,
353,
376,
20965,
3461,
16248,
29908,
13,
4706,
736,
4390,
1598,
3319,
29908,
2704,
1115,
10191,
9594,
29871,
29946,
29900,
29946,
13,
1678,
736,
13291,
29898,
29906,
29900,
29900,
29897,
13,
13,
29992,
932,
29889,
13134,
11219,
9641,
29918,
18798,
742,
3519,
29922,
1839,
7194,
11287,
13,
1753,
4863,
29918,
18798,
7295,
13,
1678,
736,
3638,
29918,
3166,
29918,
12322,
877,
13237,
29914,
742,
525,
24389,
18660,
29889,
18660,
1495,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
623,
29889,
3389,
29898,
3069,
2433,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
742,
2011,
29922,
29947,
29900,
29892,
3244,
287,
29922,
5574,
29892,
671,
29918,
276,
12657,
29922,
5574,
29892,
4744,
29922,
5574,
29897,
13,
2
] |
peerpy/exceptions.py | Rubilmax/python-p2p | 2 | 186162 | class HandlerMissingException(Exception):
"""Raised when an event handler is missing a handler for a specific event."""
pass
class DataTypeError(Exception):
"""Raised when data type doesn't correspond to the connection's data type."""
pass
class HeaderSizeError(Exception):
"""Raised when the header's size is greater than the protocol's header size."""
pass
class DataSizeError(Exception):
"""Raised the data size doesn't correspond to the connection's data size."""
pass
| [
1,
770,
5166,
1358,
18552,
292,
2451,
29898,
2451,
1125,
13,
1678,
9995,
29934,
1759,
287,
746,
385,
1741,
7834,
338,
4567,
263,
7834,
363,
263,
2702,
1741,
1213,
15945,
13,
1678,
1209,
13,
13,
13,
1990,
3630,
1542,
2392,
29898,
2451,
1125,
13,
1678,
9995,
29934,
1759,
287,
746,
848,
1134,
1838,
29915,
29873,
3928,
304,
278,
3957,
29915,
29879,
848,
1134,
1213,
15945,
13,
1678,
1209,
13,
13,
13,
1990,
19345,
3505,
2392,
29898,
2451,
1125,
13,
1678,
9995,
29934,
1759,
287,
746,
278,
4839,
29915,
29879,
2159,
338,
7621,
1135,
278,
9608,
29915,
29879,
4839,
2159,
1213,
15945,
13,
1678,
1209,
13,
13,
13,
1990,
3630,
3505,
2392,
29898,
2451,
1125,
13,
1678,
9995,
29934,
1759,
287,
278,
848,
2159,
1838,
29915,
29873,
3928,
304,
278,
3957,
29915,
29879,
848,
2159,
1213,
15945,
13,
1678,
1209,
13,
2
] |
TemporalDifference/QLearning/maze.py | onimaru/Reinforcement_Learning | 1 | 180309 | import pandas as pd
import numpy as np
class Maze:
def __init__(self,goal=[3,3],trap1=[0,3],trap2=[3,1],position=0):
pass
'''
def printTable(self,p=None):
p = random_position()
table = pd.DataFrame(np.zeros((4,4),dtype=int),columns=None)
table.iloc[3,3]='X'
table.iloc[3,1]='T'
table.iloc[0,3]='T'
T = pd.DataFrame({
'linhas':[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3],\
'colunas':[0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3]
})
table = table.replace(0,'_')
table.iloc[T['linhas'][p],T['colunas'][p]] = 'o'
print(table.to_string(index=False,header=False))
print('')
'''
@property
def random_position(self):
return np.random.randint(0,16)
def set_traps(self,trap1,trap2):
self.trap1 = trap1
self.trap2 = trap2
def set_goal(self,goal):
self.goal = goal
def get_goal(self):
return self.goal
def set_position(self,position):
self.position = position
def get_posisiotn(self):
return self.position
def make_maze(self,goal,trap1,trap2,position):
self.table = pd.DataFrame(np.zeros((4,4),dtype=int),columns=None)
self.table.iloc[goal[0],goal[1]]='X'
self.table.iloc[self.trap1[0],self.trap1[1]]='T'
self.table.iloc[self.trap2[0],self.trap2[1]]='T'
T = pd.DataFrame({
'linhas':[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3],\
'colunas':[0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3]
})
self.table = self.table.replace(0,'_')
self.table.iloc[T['linhas'][self.position],T['colunas'][self.position]] = 'o'
return self.table
def print_maze(self,table):
print(self.table.to_string(index=False,header=False))
print('') | [
1,
1053,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
13,
1990,
17326,
29872,
29901,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28111,
11759,
29941,
29892,
29941,
1402,
29873,
2390,
29896,
11759,
29900,
29892,
29941,
1402,
29873,
2390,
29906,
11759,
29941,
29892,
29896,
1402,
3283,
29922,
29900,
1125,
13,
4706,
1209,
13,
308,
13,
1678,
14550,
13,
1678,
822,
1596,
3562,
29898,
1311,
29892,
29886,
29922,
8516,
1125,
13,
4706,
282,
353,
4036,
29918,
3283,
580,
13,
4706,
1591,
353,
10518,
29889,
17271,
29898,
9302,
29889,
3298,
359,
3552,
29946,
29892,
29946,
511,
29881,
1853,
29922,
524,
511,
13099,
29922,
8516,
29897,
13,
4706,
1591,
29889,
309,
542,
29961,
29941,
29892,
29941,
29962,
2433,
29990,
29915,
13,
4706,
1591,
29889,
309,
542,
29961,
29941,
29892,
29896,
29962,
2433,
29911,
29915,
13,
4706,
1591,
29889,
309,
542,
29961,
29900,
29892,
29941,
29962,
2433,
29911,
29915,
13,
4706,
323,
353,
10518,
29889,
17271,
3319,
13,
795,
525,
1915,
5349,
2396,
29961,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
1402,
29905,
13,
795,
525,
1054,
17496,
2396,
29961,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29906,
29892,
29906,
29892,
29906,
29892,
29906,
29892,
29941,
29892,
29941,
29892,
29941,
29892,
29941,
29962,
13,
462,
3986,
5615,
13,
4706,
1591,
353,
1591,
29889,
6506,
29898,
29900,
5501,
29918,
1495,
13,
4706,
1591,
29889,
309,
542,
29961,
29911,
1839,
1915,
5349,
2033,
29961,
29886,
1402,
29911,
1839,
1054,
17496,
2033,
29961,
29886,
5262,
353,
525,
29877,
29915,
13,
4706,
1596,
29898,
2371,
29889,
517,
29918,
1807,
29898,
2248,
29922,
8824,
29892,
6672,
29922,
8824,
876,
13,
4706,
1596,
877,
1495,
13,
1678,
14550,
13,
1678,
732,
6799,
13,
1678,
822,
4036,
29918,
3283,
29898,
1311,
1125,
13,
4706,
736,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29896,
29953,
29897,
13,
268,
13,
1678,
822,
731,
29918,
3018,
567,
29898,
1311,
29892,
29873,
2390,
29896,
29892,
29873,
2390,
29906,
1125,
13,
4706,
1583,
29889,
29873,
2390,
29896,
353,
26505,
29896,
13,
4706,
1583,
29889,
29873,
2390,
29906,
353,
26505,
29906,
13,
268,
13,
1678,
822,
731,
29918,
28111,
29898,
1311,
29892,
28111,
1125,
13,
4706,
1583,
29889,
28111,
353,
7306,
13,
268,
13,
1678,
822,
679,
29918,
28111,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
28111,
13,
268,
13,
1678,
822,
731,
29918,
3283,
29898,
1311,
29892,
3283,
1125,
13,
4706,
1583,
29889,
3283,
353,
2602,
13,
308,
13,
1678,
822,
679,
29918,
1066,
10770,
327,
29876,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3283,
13,
268,
13,
1678,
822,
1207,
29918,
655,
911,
29898,
1311,
29892,
28111,
29892,
29873,
2390,
29896,
29892,
29873,
2390,
29906,
29892,
3283,
1125,
13,
4706,
1583,
29889,
2371,
353,
10518,
29889,
17271,
29898,
9302,
29889,
3298,
359,
3552,
29946,
29892,
29946,
511,
29881,
1853,
29922,
524,
511,
13099,
29922,
8516,
29897,
13,
4706,
1583,
29889,
2371,
29889,
309,
542,
29961,
28111,
29961,
29900,
1402,
28111,
29961,
29896,
5262,
2433,
29990,
29915,
13,
4706,
1583,
29889,
2371,
29889,
309,
542,
29961,
1311,
29889,
29873,
2390,
29896,
29961,
29900,
1402,
1311,
29889,
29873,
2390,
29896,
29961,
29896,
5262,
2433,
29911,
29915,
13,
4706,
1583,
29889,
2371,
29889,
309,
542,
29961,
1311,
29889,
29873,
2390,
29906,
29961,
29900,
1402,
1311,
29889,
29873,
2390,
29906,
29961,
29896,
5262,
2433,
29911,
29915,
13,
4706,
323,
353,
10518,
29889,
17271,
3319,
13,
795,
525,
1915,
5349,
2396,
29961,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29892,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
1402,
29905,
13,
795,
525,
1054,
17496,
2396,
29961,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29906,
29892,
29906,
29892,
29906,
29892,
29906,
29892,
29941,
29892,
29941,
29892,
29941,
29892,
29941,
29962,
13,
462,
3986,
5615,
13,
4706,
1583,
29889,
2371,
353,
1583,
29889,
2371,
29889,
6506,
29898,
29900,
5501,
29918,
1495,
13,
4706,
1583,
29889,
2371,
29889,
309,
542,
29961,
29911,
1839,
1915,
5349,
2033,
29961,
1311,
29889,
3283,
1402,
29911,
1839,
1054,
17496,
2033,
29961,
1311,
29889,
3283,
5262,
353,
525,
29877,
29915,
13,
4706,
736,
1583,
29889,
2371,
13,
268,
13,
1678,
822,
1596,
29918,
655,
911,
29898,
1311,
29892,
2371,
1125,
13,
4706,
1596,
29898,
1311,
29889,
2371,
29889,
517,
29918,
1807,
29898,
2248,
29922,
8824,
29892,
6672,
29922,
8824,
876,
13,
4706,
1596,
877,
1495,
2
] |
cloudcafe/blockstorage/volumes_api/common/models/requests.py | rcbops-qa/cloudcafe | 0 | 167512 | from cafe.engine.models.base import AutoMarshallingModel
import json
class StatusResetRequest(AutoMarshallingModel):
def __init__(self, status=None):
super(StatusResetRequest, self).__init__()
self.status = status
def _obj_to_json(self):
data = {"os-reset_status": {"status": self.status}}
return json.dumps(data)
| [
1,
515,
5777,
1725,
29889,
10599,
29889,
9794,
29889,
3188,
1053,
11133,
7083,
845,
27855,
3195,
13,
5215,
4390,
13,
13,
13,
1990,
16034,
27175,
3089,
29898,
12300,
7083,
845,
27855,
3195,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4660,
29922,
8516,
1125,
13,
4706,
2428,
29898,
5709,
27175,
3089,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
4882,
353,
4660,
13,
13,
1678,
822,
903,
5415,
29918,
517,
29918,
3126,
29898,
1311,
1125,
13,
4706,
848,
353,
8853,
359,
29899,
12071,
29918,
4882,
1115,
8853,
4882,
1115,
1583,
29889,
4882,
930,
13,
4706,
736,
4390,
29889,
29881,
17204,
29898,
1272,
29897,
13,
2
] |
polls/views.py | alejandro-medici/django_docker | 1 | 29333 | from django.shortcuts import render
from django.http import HttpResponse
from django.template.loader import get_template
from .models import Poll
from time import timezone
from datetime import date
# Create your views here.
def index(request):
myTemplate = get_template('./index.html')
print(myTemplate)
return render(request, myTemplate)
def detail(request, poll_id):
return HttpResponse("You're looking at poll %s." % poll_id)
def results(request, poll_id):
return HttpResponse("You're looking at the results of poll %s." % poll_id)
# CRUD
def create(request):
newPoll = Poll(question="What's up?", pub_date= date.today())
newPoll.save()
return HttpResponse("You're creating a new poll with id %s." % newPoll.id)
def update(request, id):
response = HttpResponse("You must send data using POST")
if request.method == 'POST':
response = HttpResponse("You're updating poll %s." % id)
myPoll = Poll.objects.get(id=id)
myPoll.question = request.POST['question']
myPoll.save()
return response
def delete(request, id):
myPoll = Poll.objects.get(id=id)
myPoll.delete()
return HttpResponse("You're deleting poll %s." % id)
def read(request, id):
myPoll = Poll.objects.get(id=id)
return HttpResponse("You're reading a poll. %s " % myPoll)
#### SECURITY PENDING TOPICS
# Toda conexion con el back deberia tener un token.
# Todo API/CRUD tiene que tener un limite de queries... | [
1,
515,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
13,
3166,
9557,
29889,
6886,
29889,
12657,
1053,
679,
29918,
6886,
13,
3166,
869,
9794,
1053,
2043,
29880,
13,
3166,
931,
1053,
29431,
13,
3166,
12865,
1053,
2635,
13,
13,
13,
13,
29937,
6204,
596,
8386,
1244,
29889,
13,
1753,
2380,
29898,
3827,
1125,
13,
1678,
590,
6733,
353,
679,
29918,
6886,
877,
6904,
2248,
29889,
1420,
1495,
13,
1678,
1596,
29898,
1357,
6733,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
590,
6733,
29897,
13,
13,
1753,
9493,
29898,
3827,
29892,
21180,
29918,
333,
1125,
13,
1678,
736,
9056,
5103,
703,
3492,
29915,
276,
3063,
472,
21180,
1273,
29879,
1213,
1273,
21180,
29918,
333,
29897,
13,
13,
1753,
2582,
29898,
3827,
29892,
21180,
29918,
333,
1125,
13,
1678,
736,
9056,
5103,
703,
3492,
29915,
276,
3063,
472,
278,
2582,
310,
21180,
1273,
29879,
1213,
1273,
21180,
29918,
333,
29897,
13,
13,
29937,
15600,
15789,
13,
1753,
1653,
29898,
3827,
1125,
13,
1678,
716,
29925,
3028,
353,
2043,
29880,
29898,
12470,
543,
5618,
29915,
29879,
701,
29973,
613,
2529,
29918,
1256,
29922,
2635,
29889,
27765,
3101,
13,
1678,
716,
29925,
3028,
29889,
7620,
580,
13,
1678,
736,
9056,
5103,
703,
3492,
29915,
276,
4969,
263,
716,
21180,
411,
1178,
1273,
29879,
1213,
29871,
1273,
716,
29925,
3028,
29889,
333,
29897,
13,
13,
1753,
2767,
29898,
3827,
29892,
1178,
1125,
13,
1678,
2933,
353,
9056,
5103,
703,
3492,
1818,
3638,
848,
773,
11971,
1159,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
2933,
353,
9056,
5103,
703,
3492,
29915,
276,
13271,
21180,
1273,
29879,
1213,
1273,
1178,
29897,
13,
4706,
590,
29925,
3028,
353,
2043,
29880,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
4706,
590,
29925,
3028,
29889,
12470,
353,
2009,
29889,
5438,
1839,
12470,
2033,
13,
4706,
590,
29925,
3028,
29889,
7620,
580,
13,
1678,
736,
2933,
13,
13,
1753,
5217,
29898,
3827,
29892,
1178,
1125,
13,
1678,
590,
29925,
3028,
353,
2043,
29880,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
1678,
590,
29925,
3028,
29889,
8143,
580,
13,
1678,
736,
9056,
5103,
703,
3492,
29915,
276,
21228,
21180,
1273,
29879,
1213,
1273,
1178,
29897,
13,
13,
1753,
1303,
29898,
3827,
29892,
1178,
1125,
13,
1678,
590,
29925,
3028,
353,
2043,
29880,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
1678,
736,
9056,
5103,
703,
3492,
29915,
276,
5183,
263,
21180,
29889,
1273,
29879,
376,
1273,
590,
29925,
3028,
29897,
13,
13,
13,
4136,
3725,
22484,
11937,
349,
11794,
4214,
7495,
2227,
9295,
13,
29937,
7561,
29874,
378,
735,
291,
378,
560,
1250,
316,
495,
423,
22975,
443,
5993,
29889,
13,
29937,
7561,
29877,
3450,
29914,
11341,
15789,
10258,
712,
22975,
443,
2485,
568,
316,
9365,
856,
2
] |
app/__init__.py | mamu234/pitch3 | 0 | 94759 | <gh_stars>0
from sqlite3 import dbapi2
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from os import path
DB_NAME = "database.db"
def create_up():
app = Flask(__name__)
app.config['SECRET_KEY'] = '123'
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}'
db = SQLAlchemy(app)
db.init_app(app)
from .views import views
from .auth import auth
app.register_blueprint(views, url_prefix='/')
app.register_blueprint(auth, url_prefix='/')
from .models import User, Pitch
create_database(app)
return app
def create_database(app):
if not path.exists('app/' + DB_NAME):
db.create_all(app=app)
print('Created database')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
21120,
29941,
1053,
4833,
2754,
29906,
13,
3166,
29784,
1053,
2379,
1278,
13,
3166,
29871,
29784,
29918,
2850,
284,
305,
6764,
1053,
3758,
2499,
305,
6764,
13,
3166,
2897,
1053,
2224,
13,
13,
13,
13,
268,
13,
13,
4051,
29918,
5813,
353,
376,
9803,
29889,
2585,
29908,
13,
13,
13,
13,
1753,
1653,
29918,
786,
7295,
13,
1678,
623,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
1678,
623,
29889,
2917,
1839,
1660,
22245,
29911,
29918,
10818,
2033,
353,
525,
29896,
29906,
29941,
29915,
13,
1678,
623,
29889,
2917,
1839,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
2033,
353,
285,
29915,
22793,
597,
19248,
4051,
29918,
5813,
10162,
13,
268,
13,
1678,
4833,
353,
3758,
2499,
305,
6764,
29898,
932,
29897,
13,
1678,
4833,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
13,
1678,
13,
13,
1678,
515,
869,
7406,
1053,
8386,
13,
1678,
515,
869,
5150,
1053,
4817,
13,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
7406,
29892,
3142,
29918,
13506,
2433,
29914,
1495,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
5150,
29892,
3142,
29918,
13506,
2433,
29914,
1495,
13,
268,
13,
1678,
515,
869,
9794,
1053,
4911,
29892,
349,
2335,
13,
13,
1678,
1653,
29918,
9803,
29898,
932,
29897,
13,
13,
1678,
13,
1678,
736,
623,
13,
13,
1753,
1653,
29918,
9803,
29898,
932,
1125,
13,
1678,
565,
451,
2224,
29889,
9933,
877,
932,
22208,
718,
6535,
29918,
5813,
1125,
13,
4706,
4833,
29889,
3258,
29918,
497,
29898,
932,
29922,
932,
29897,
13,
4706,
1596,
877,
20399,
2566,
1495,
13,
2
] |
habixbackend/api/migrations/0001_initial.py | Tiqur/habix-backend | 1 | 148863 | # Generated by Django 3.1.4 on 2021-01-03 04:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='HabixUser',
fields=[
('uuid', models.BigIntegerField(max_length=20, primary_key=True, serialize=False)),
('timezone', models.IntegerField(verbose_name='UTC offset')),
],
),
migrations.CreateModel(
name='DailyTasks',
fields=[
('habixuser_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='api.habixuser')),
('task_name', models.CharField(max_length=200)),
('streak_graph', models.CharField(max_length=50000)),
('created_at', models.DateField(auto_now_add=True)),
('best_streak', models.PositiveIntegerField(default=0)),
],
bases=('api.habixuser',),
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29941,
29889,
29896,
29889,
29946,
373,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29941,
29871,
29900,
29946,
29901,
29906,
29941,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
2847,
353,
5852,
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,
29950,
370,
861,
2659,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
25118,
742,
4733,
29889,
6970,
7798,
3073,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
28755,
29922,
8824,
8243,
13,
18884,
6702,
2230,
8028,
742,
4733,
29889,
7798,
3073,
29898,
369,
15828,
29918,
978,
2433,
26913,
9210,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
29928,
8683,
26249,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
7308,
861,
1792,
29918,
7414,
742,
4733,
29889,
6716,
1762,
6716,
3073,
29898,
6921,
29918,
11600,
29922,
5574,
29892,
373,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
3847,
29918,
2324,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
28755,
29922,
8824,
29892,
304,
2433,
2754,
29889,
7308,
861,
1792,
1495,
511,
13,
18884,
6702,
7662,
29918,
978,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29900,
8243,
13,
18884,
6702,
13045,
557,
29918,
4262,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29945,
29900,
29900,
29900,
29900,
8243,
13,
18884,
6702,
11600,
29918,
271,
742,
4733,
29889,
2539,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
8243,
13,
18884,
6702,
13318,
29918,
13045,
557,
742,
4733,
29889,
9135,
3321,
7798,
3073,
29898,
4381,
29922,
29900,
8243,
13,
9651,
21251,
13,
9651,
22561,
29922,
877,
2754,
29889,
7308,
861,
1792,
742,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
python/bifrost/blocks/quantize.py | Radio-Camera-Initiative/bifrost | 0 | 67737 |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Bifrost Authors nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import absolute_import
import bifrost as bf
import bifrost.quantize
from bifrost.pipeline import TransformBlock
from bifrost.DataType import DataType
from copy import deepcopy
class QuantizeBlock(TransformBlock):
def __init__(self, iring, dtype, scale=1.,
*args, **kwargs):
super(QuantizeBlock, self).__init__(iring, *args, **kwargs)
self.dtype = dtype
self.scale = scale
def define_valid_input_spaces(self):
"""Return set of valid spaces (or 'any') for each input"""
return ('system',)
def on_sequence(self, iseq):
ihdr = iseq.header
ohdr = deepcopy(ihdr)
itype = DataType(ihdr['_tensor']['dtype'])
self.itype = itype
# Allow user to pass nbit instead of explicit dtype
if isinstance(self.dtype, int):
nbit = self.dtype
otype = itype.as_integer(nbit)
else:
otype = self.dtype
ohdr['_tensor']['dtype'] = otype
return ohdr
def on_data(self, ispan, ospan):
idata = ispan.data
odata = ospan.data
bf.quantize.quantize(idata, odata, self.scale)
def quantize(iring, dtype, scale=1., *args, **kwargs):
"""Apply a requantization of bit depth for the data.
Args:
iring (Ring or Block): Input data source.
dtype: Output data type or number of bits.
scale (float): Scale factor to apply before quantizing.
*args: Arguments to ``bifrost.pipeline.TransformBlock``.
**kwargs: Keyword Arguments to ``bifrost.pipeline.TransformBlock``.
**Tensor semantics**::
Input: [...], dtype = [c]f32, space = SYSTEM
Output: [...], dtype = any (complex) integer type, space = SYSTEM
Returns:
QuantizeBlock: A new block instance.
"""
return QuantizeBlock(iring, dtype, *args, **kwargs)
| [
1,
29871,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29953,
29892,
450,
350,
361,
17627,
13189,
943,
29889,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
4367,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
29937,
21733,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
13,
29937,
526,
1539,
29901,
13,
29937,
334,
4367,
391,
3224,
29879,
310,
2752,
775,
1818,
11551,
278,
2038,
3509,
1266,
13,
29937,
259,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
29889,
13,
29937,
334,
4367,
391,
3224,
29879,
297,
7581,
883,
1818,
18532,
278,
2038,
3509,
1266,
13,
29937,
259,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
297,
278,
13,
29937,
259,
5106,
322,
29914,
272,
916,
17279,
4944,
411,
278,
4978,
29889,
13,
29937,
334,
2448,
2121,
278,
1024,
310,
450,
350,
361,
17627,
13189,
943,
3643,
278,
2983,
310,
967,
13,
29937,
259,
17737,
29560,
1122,
367,
1304,
304,
1095,
272,
344,
470,
27391,
9316,
10723,
13,
29937,
259,
515,
445,
7047,
1728,
2702,
7536,
3971,
10751,
29889,
13,
29937,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
4954,
3289,
8519,
4907,
5300,
13764,
29979,
13,
29937,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
13,
29937,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
13,
29937,
349,
4574,
13152,
1660,
319,
1525,
28657,
13875,
8890,
29928,
29889,
29871,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
315,
4590,
29979,
22789,
3912,
438,
29956,
13865,
6323,
13,
29937,
8707,
29911,
3960,
29933,
2692,
24125,
20700,
17705,
6181,
15842,
13764,
29979,
22471,
26282,
29892,
2672,
4571,
26282,
29892,
2672,
29907,
1367,
3919,
1964,
29892,
317,
4162,
8426,
1964,
29892,
13,
29937,
8528,
29923,
3580,
29931,
19926,
29892,
6323,
8707,
1660,
13356,
3919,
25758,
21330,
1529,
1692,
29903,
313,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
13,
29937,
13756,
29907,
11499,
13780,
8079,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
26996,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
6323,
13,
29937,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
29832,
8851,
5348,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
13,
29937,
8079,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
8707,
29911,
4717,
1783,
29892,
6850,
3960,
1783,
17705,
2882,
6227,
11937,
29892,
6323,
323,
8476,
13,
29937,
313,
1177,
6154,
15789,
4214,
405,
11787,
5265,
24647,
4741,
6323,
438,
29911,
4448,
22119,
1660,
29897,
9033,
3235,
4214,
2672,
13764,
29979,
399,
29909,
29979,
19474,
8079,
6093,
501,
1660,
13,
29937,
8079,
3446,
3235,
7791,
7818,
12982,
1525,
29892,
382,
29963,
1430,
10762,
11033,
18118,
1660,
29928,
8079,
6093,
21521,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
13,
5215,
289,
361,
17627,
408,
289,
29888,
13,
5215,
289,
361,
17627,
29889,
12150,
675,
13,
3166,
289,
361,
17627,
29889,
13096,
5570,
1053,
4103,
689,
7445,
13,
3166,
289,
361,
17627,
29889,
1469,
1542,
1053,
3630,
1542,
13,
13,
3166,
3509,
1053,
6483,
8552,
13,
13,
1990,
22746,
675,
7445,
29898,
13372,
7445,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3805,
292,
29892,
26688,
29892,
6287,
29922,
29896,
1696,
13,
462,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
22930,
675,
7445,
29892,
1583,
467,
1649,
2344,
12035,
8491,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
29881,
1853,
353,
26688,
13,
4706,
1583,
29889,
7052,
353,
6287,
13,
1678,
822,
4529,
29918,
3084,
29918,
2080,
29918,
22854,
29898,
1311,
1125,
13,
4706,
9995,
11609,
731,
310,
2854,
8162,
313,
272,
525,
1384,
1495,
363,
1269,
1881,
15945,
29908,
13,
4706,
736,
6702,
5205,
742,
29897,
13,
1678,
822,
373,
29918,
16506,
29898,
1311,
29892,
338,
1837,
1125,
13,
4706,
4686,
7707,
353,
338,
1837,
29889,
6672,
13,
4706,
9360,
7707,
353,
6483,
8552,
29898,
4861,
7707,
29897,
13,
4706,
372,
668,
353,
3630,
1542,
29898,
4861,
7707,
1839,
29918,
20158,
16215,
29881,
1853,
11287,
13,
4706,
1583,
29889,
537,
412,
353,
372,
668,
13,
4706,
396,
29408,
1404,
304,
1209,
302,
2966,
2012,
310,
6261,
26688,
13,
4706,
565,
338,
8758,
29898,
1311,
29889,
29881,
1853,
29892,
938,
1125,
13,
9651,
302,
2966,
353,
1583,
29889,
29881,
1853,
13,
9651,
288,
1853,
353,
372,
668,
29889,
294,
29918,
16031,
29898,
29876,
2966,
29897,
13,
4706,
1683,
29901,
13,
9651,
288,
1853,
353,
1583,
29889,
29881,
1853,
13,
4706,
9360,
7707,
1839,
29918,
20158,
16215,
29881,
1853,
2033,
353,
288,
1853,
13,
4706,
736,
9360,
7707,
13,
1678,
822,
373,
29918,
1272,
29898,
1311,
29892,
338,
8357,
29892,
288,
9653,
1125,
13,
4706,
1178,
532,
353,
338,
8357,
29889,
1272,
13,
4706,
288,
1272,
353,
288,
9653,
29889,
1272,
13,
4706,
289,
29888,
29889,
12150,
675,
29889,
12150,
675,
29898,
333,
532,
29892,
288,
1272,
29892,
1583,
29889,
7052,
29897,
13,
13,
1753,
4323,
675,
29898,
8491,
29892,
26688,
29892,
6287,
29922,
29896,
1696,
334,
5085,
29892,
3579,
19290,
1125,
13,
1678,
9995,
2052,
368,
263,
5054,
424,
2133,
310,
2586,
10809,
363,
278,
848,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
3805,
292,
313,
29934,
292,
470,
15658,
1125,
10567,
848,
2752,
29889,
13,
4706,
26688,
29901,
10604,
848,
1134,
470,
1353,
310,
9978,
29889,
13,
4706,
6287,
313,
7411,
1125,
2522,
744,
7329,
304,
3394,
1434,
4323,
5281,
29889,
13,
4706,
334,
5085,
29901,
11842,
9331,
304,
4954,
29890,
361,
17627,
29889,
13096,
5570,
29889,
13372,
7445,
29952,
1412,
13,
4706,
3579,
19290,
29901,
7670,
1742,
11842,
9331,
304,
4954,
29890,
361,
17627,
29889,
13096,
5570,
29889,
13372,
7445,
29952,
1412,
13,
13,
1678,
3579,
29911,
6073,
29505,
1068,
1057,
13,
13,
4706,
10567,
29901,
29871,
518,
856,
1402,
26688,
353,
518,
29883,
29962,
29888,
29941,
29906,
29892,
2913,
353,
28962,
1254,
12665,
13,
4706,
10604,
29901,
518,
856,
1402,
26688,
353,
738,
313,
19676,
29897,
6043,
1134,
29892,
2913,
353,
28962,
1254,
12665,
13,
13,
1678,
16969,
29901,
13,
4706,
22746,
675,
7445,
29901,
319,
716,
2908,
2777,
29889,
13,
1678,
9995,
13,
1678,
736,
22746,
675,
7445,
29898,
8491,
29892,
26688,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
2
] |
inference/run.py | motrom/voxeljones | 2 | 173405 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
last mod 7/16/19
much of this code is highly optimized to the point of being pretty unreadable
The algorithm has this general layout
- modify boosted tree for fast use, generate lookup table of detection overlaps
- for each detection
- transform lidar points to local ground coordinates & order by 3mx3m tile
- for each 3mx3m tile (where kitti has annotations) and angle
- fill in binary voxel array with lidar presence
- take cumulative sum in all directions (integral image)
- for subgrids of 4 voxel offsets (1/8m) in this tile and 4 cardinal directions
- run initial boosted tree on integral image
- if initial score is high enough, for each voxel offset
- run rest of boosted tree
- store highest-scoring location and cardinal direction
- keep small number of highest-scoring detections from this tile
- using nms lookups
- use normal nms to maintain sorted list of the top detections
"""
import numpy as np
import numba as nb
from math import floor as mathfloor
from time import time
from ctypes import CDLL, RTLD_GLOBAL, c_void_p
from config import grndstart, grndstep, grndlen
from config import anchorstart, anchorstep, anchorlen
from config import grnd2checkgrid
from config import anchorinlocalgrid_strided, anchorinlocalgrid
from config import anchorangles as anchorangles
from config import anchornangles as anchornangles
from ground import planes2Transforms
localgridlen = (72,72)
anchorinlocalgrid = anchorinlocalgrid + (0,8)
anchorinlocalgrid_strided = anchorinlocalgrid_strided + (0,8)
anchorcossins = np.column_stack((np.cos(anchorangles), np.sin(anchorangles)))
anchorcenterpoints = (anchorinlocalgrid + (24,16) - 36)*anchorstep[:2]
anchorcenter2 = np.einsum(anchorcenterpoints, [0,1], anchorcossins[:,0], [2], [2,0,1])
anchorcenter2[:,:,0] -= np.outer(anchorcossins[:,1], anchorcenterpoints[:,1])
anchorcenter2[:,:,1] += np.outer(anchorcossins[:,1], anchorcenterpoints[:,0])
anchorcenterpoints = anchorcenter2
"""
transforms pts to ground plane
pts outside of ground region are kept in array, but not indexed by tileidxs
"""
@nb.njit(nb.void(nb.f8[:,::1], nb.f8[:,::1], nb.i8[:], nb.f8[:,:,:,::1]))
def tilePoints(pts, newpts, tileidxs, groundTs):
npts = pts.shape[0]
maxtileval = grndlen[0]*grndlen[1] # 1 more than maximum location
grndidx = np.full(pts.shape[0], maxtileval, dtype=np.int64)
groundTs[:,:,2,:] *= 8
for ptidx in range(npts):
pt = pts[ptidx]
tilex = int(mathfloor(pt[0]/grndstep[0])) - grndstart[0]
tiley = int(mathfloor(pt[1]/grndstep[1])) - grndstart[1]
if tilex >= 0 and tiley >= 0 and tilex < grndlen[0] and tiley < grndlen[1]:
groundT = groundTs[tilex,tiley]
#pt = groundTs[tilex,tiley,:3,:3].dot(pt) + groundTs[tilex,tiley,:3,3]
ptz = mathfloor(groundT[2,:3].dot(pt) + groundT[2,3])-1
# go ahead and transform ptz
#ptz = mathfloor(pt[2]*8)-1
if ptz >= 0 and ptz < anchorlen[2]:
grndidx[ptidx] = tilex*grndlen[1]+tiley
pt[:2] += groundT[:2,3]
pt[2] = ptz
grndorder = np.argsort(grndidx)
# tileidxs = np.searchsorted(grndidx[grndorder], range(grndlen[0]*grndlen[1]+1))
# newpts[:tileidxs[-1]] = pts[grndorder[:tileidxs[-1]]]
# below is single loop version of the above
currenttile = 0
tileidxs[0] = 0
for ptidx in range(npts):
oldptidx = grndorder[ptidx]
newpts[ptidx] = pts[oldptidx]
tileval = grndidx[oldptidx]
while tileval > currenttile:
currenttile += 1
tileidxs[currenttile] = ptidx
if currenttile == maxtileval:
break
""" takes pre-transformed points """
@nb.njit(nb.void(nb.f8[:,::1], nb.i8[:], nb.i8, nb.i8, nb.f8,
nb.f8, nb.u1[:,:,::1]))
def fillLocalGrid(pts, tileidxs, tilex, tiley, cos, sin, grid):
grid[:] = 0
cos8 = cos*8
sin8 = sin*8
#offz = 1 - anchorstart[2]
for tilex2, tiley2 in np.ndindex(5,5):
tile = (tilex+tilex2-2)*grndlen[1] + tiley+tiley2-2
pts_idxstart = tileidxs[tile]
pts_idxend = tileidxs[tile+1]
offx = (cos8*(tilex2-2) + sin8*(tiley2-2))*3. + 36
offy = (cos8*(tiley2-2) - sin8*(tilex2-2))*3. + 36
for ptsidx in range(pts_idxstart, pts_idxend):
pt = pts[ptsidx]
#z = int(mathfloor(pt[2]*8)) - 1 # taken care of in tilePoints
#if z >= 0 and z < 20:
x = int(mathfloor(cos8*pt[0] + sin8*pt[1] + offx))
y = int(mathfloor(cos8*pt[1] - sin8*pt[0] + offy))
if x >= 0 and x < 72 and y >= 0 and y < 72:
z = int(pt[2])
grid[x,y,z] = 1
lib = CDLL('./cumsum3d.so', RTLD_GLOBAL)
makeIntegralGrid = lib.cumsum3d
makeIntegralGrid.argtypes = [c_void_p, c_void_p]
@nb.njit(nb.b1(nb.f8,nb.f8,nb.f8,nb.f8,nb.f8,nb.f8,
nb.f8,nb.f8,nb.f8,nb.f8,nb.f8,nb.f8, nb.f8))
def rectOverlap(x1,y1,c1,s1,l1,w1, x2,y2,c2,s2,l2,w2, overlap_buffer):
x2in1 = (x2-x1)*c1 + (y2-y1)*s1
y2in1 = (y2-y1)*c1 - (x2-x1)*s1
x1in2 = (x1-x2)*c2 + (y1-y2)*s2
y1in2 = (y1-y2)*c2 - (x1-x2)*s2
cos = abs(c1*c2+s1*s2)
sin = abs(c1*s2-c2*s1)
return not (l1 + l2*cos + w2*sin - abs(x2in1) < overlap_buffer or
w1 + l2*sin + w2*cos - abs(y2in1) < overlap_buffer or
l2 + l1*cos + w1*sin - abs(x1in2) < overlap_buffer or
w2 + l1*sin + w1*cos - abs(y1in2) < overlap_buffer)
@nb.njit(nb.b1[:,:,:,:,:,::1]())
def prepLocalNms():
nanchors = anchorinlocalgrid.shape[0]
overlaps = np.zeros((anchornangles//2,nanchors,2, anchornangles//2,nanchors,2),
dtype=np.bool8)
obj_len = 2.
obj_wid = 1.#.9
overlap_buffer = .4#.3
obj_hypot = np.hypot(obj_len, obj_wid)
for angleidx1, angleidx2, anchoridx1, anchoridx2, dir1, dir2 in np.ndindex(
anchornangles//2, anchornangles//2, nanchors, nanchors,2,2):
if angleidx2 < angleidx1:
continue
x1, y1 = anchorcenterpoints[angleidx1, anchoridx1]
x2, y2 = anchorcenterpoints[angleidx2, anchoridx2]
overlap = False
centerdist = np.hypot(x1-x2, y1-y2)
if centerdist < obj_wid*2 - overlap_buffer:
overlap = True
elif centerdist > obj_hypot*2 - overlap_buffer:
overlap = False
else:
cos1, sin1 = anchorcossins[angleidx1]
cos2, sin2 = anchorcossins[angleidx2]
if dir1:
cos1, sin1 = -sin1, cos1
if dir2:
cos2, sin2 = -sin2, cos2
overlap = rectOverlap(x1,y1,cos1,sin1,obj_len,obj_wid,
x2,y2,cos2,sin2,obj_len,obj_wid, .5)#.45)
if overlap:
overlaps[angleidx1, anchoridx1, dir1, angleidx2, anchoridx2, dir2] = True
overlaps[angleidx2, anchoridx2, dir2, angleidx1, anchoridx1, dir1] = True
return overlaps
@nb.njit(nb.f8(nb.u4[:], nb.i8, nb.i8[:,:,::1], nb.f8[:,::1], nb.i8, nb.i8, nb.f8))
def useBoostedTree(grid, anchoroffset, btsplits, btleaves, tree1,tree2, score):
for tree in range(tree1,tree2):
splitidx = 0
for depth in range(3):
startp, xmove, ymove, zmove = btsplits[tree, splitidx]
startp = startp + anchoroffset
npoints = (grid[startp+zmove] - grid[startp] + grid[startp+ymove] -
grid[startp+ymove+zmove] + grid[startp+xmove] -
grid[startp+xmove+zmove] - grid[startp+xmove+ymove] +
grid[startp+xmove+ymove+zmove])
splitidx <<= 1
splitidx += 1 if npoints else 2
score += btleaves[tree, splitidx - 7]
if score < btleaves[tree,8]:
return -50. + tree
return score
@nb.njit(nb.void(nb.f8[:,::1], nb.f8[:,:,:,::1], nb.i8[:,:,:,::1], nb.f8[:,::1],
nb.i8[:,:], nb.f8[:], nb.b1[:,:,:,:,:,::1]))
def predict(pts, groundTs, btsplits, btleaves, globaldetections, globalscores,
anchoroverlaps):
newpts = np.zeros(pts.shape, dtype=np.float64)
tileidxs = np.zeros(grndlen[0]*grndlen[1]+1, dtype=np.int64)
tilePoints(pts, newpts, tileidxs, groundTs)
pts = newpts # name change for convenience
gridshape = (73,73,21)
#grid = np.empty(gridshape, dtype=np.int16)
grid = np.empty((72,72,20), dtype=np.uint8)
cumgrid = np.zeros(gridshape, dtype=np.uint32)
gridflat = cumgrid.reshape((-1,))
nanchors_strided = anchorinlocalgrid_strided.shape[0]
ntrees = btsplits.shape[1]
guysforotherangle = np.zeros((36,4), dtype=np.float64)
nlocaldetections = 4
localdetections = np.zeros((nlocaldetections, 3), dtype=np.int64)
localscores = np.zeros(nlocaldetections, dtype=np.float64)
nglobaldetections = globaldetections.shape[0]
for grnd2checkgrididx in range(grnd2checkgrid.shape[0]):
centerx, centery = grnd2checkgrid[grnd2checkgrididx]
localscores[:] = -100.
for angle in range(0,anchornangles//2):
cos, sin = anchorcossins[angle]
fillLocalGrid(pts, tileidxs, centerx, centery, cos, sin, grid)
makeIntegralGrid(grid.ctypes.data, cumgrid.ctypes.data)
altangle = angle%2 > 0
for anchoridx in range(nanchors_strided):
anchorx, anchory = anchorinlocalgrid_strided[anchoridx]
bestlocalscore = -30
bestlocalanchorx = 0
bestlocalanchory = 8
bestlocaldirection = 0
anchoroffset = anchorx*gridshape[1]*gridshape[2]+anchory*gridshape[2] # TEMP 7/12
for direction in range(4):
if altangle:
score = guysforotherangle[anchoridx,direction]
else:
score = useBoostedTree(gridflat, anchoroffset,
btsplits[direction], btleaves,
0,10, 0.)
guysforotherangle[anchoridx,direction] = score
if score > -30:
for anchorx2 in range(anchorx-1, anchorx+3):
for anchory2 in range(anchory-1, anchory+3):
anchor2off = (anchorx2*gridshape[1]+anchory2)*gridshape[2]
score2 = useBoostedTree(gridflat, anchor2off,
btsplits[direction],btleaves,
10,ntrees,score)
if score2 > bestlocalscore:
bestlocalscore = score2
bestlocalanchorx = anchorx2
bestlocalanchory = anchory2
bestlocaldirection = direction
#keep top local detections, while also performing nms
anchoridx2 = bestlocalanchorx*24 + bestlocalanchory-8
dirover2 = bestlocaldirection//2
notsuppressed = True
for detectionidx in range(nlocaldetections):
otherangle, otheranchor, otherdir = localdetections[detectionidx]
if anchoroverlaps[angle, anchoridx2, dirover2,
otherangle, otheranchor, otherdir//2]:
notsuppressed &= localscores[detectionidx] < bestlocalscore
if notsuppressed:
for detectionidx in range(nlocaldetections):
otherangle, otheranchor, otherdir = localdetections[detectionidx]
if anchoroverlaps[angle, anchoridx2, dirover2,
otherangle, otheranchor, otherdir//2]:
localscores[detectionidx] = -100.
detectiontoreplace = np.argmin(localscores)
if bestlocalscore > localscores[detectiontoreplace]:
localdetections[detectiontoreplace] = (angle, anchoridx2,
bestlocaldirection)
localscores[detectiontoreplace] = bestlocalscore
# add top local detections to global sorted detections
# basically inplace merge sort step
localorder = np.argsort(localscores)
fromglobalidx = 0
toglobalidx = -nlocaldetections
for detectionidx in range(nlocaldetections):
score = localscores[localorder[detectionidx]]
while fromglobalidx < nglobaldetections and score > globalscores[fromglobalidx]:
if toglobalidx >= 0:
globalscores[toglobalidx] = globalscores[fromglobalidx]
globaldetections[toglobalidx] = globaldetections[fromglobalidx]
toglobalidx += 1
fromglobalidx += 1
if toglobalidx >= 0:
angle, anchoridx, direction = localdetections[localorder[detectionidx]]
globalscores[toglobalidx] = score
globaldetections[toglobalidx] = (centerx, centery, angle,
anchoridx, direction)
toglobalidx += 1
def grayer(img): return ((img.astype(float)-128)*.75 + 128).astype(np.uint8)
if __name__ == '__main__':
from imageio import imread
from cv2 import imshow, waitKey, destroyWindow
from evaluate import MetricAvgPrec
from calibs import calib_extrinsics, calib_map, view_by_day, calib_projections
from plotStuff import base_image, plotRectangle, drawLine, plotPoints
from plotStuff import reference as plotReference
from kittiGT import readGroundTruthFile, formatForKittiScore
from myio import lidar_files, gt_files, img_files, output_files
from myio import ground_planes_by_file, model_file, files2use
ndetections = 32
# alter tree format for fast lookups
# four models are created, one for each cardinal direction
# each model is "flattened" to look up the integral image in a flattened array
# (the array's size must be known)
# the nice thing about this representation is that the positional offset for
# each detection requires a single add, and only 4 numbers define a split
BTstruct = np.load(model_file)
btsplits = BTstruct['splits'][:].copy()
btleaves = BTstruct['leaves'][:].copy()
ntrees = btsplits.shape[0]
btsplitsall = np.zeros((4,ntrees,7,6), dtype=np.int64)
btsplitsall[0] = btsplits[:,:7] # forward
btsplitsall[1] = btsplits[:,:7] # backward
btsplitsall[1,:,:,0] = 48 - btsplits[:,:7,3]
btsplitsall[1,:,:,1] = 32 - btsplits[:,:7,4]
btsplitsall[1,:,:,3] = 48 - btsplits[:,:7,0]
btsplitsall[1,:,:,4] = 32 - btsplits[:,:7,1]
btsplitsall[2] = btsplits[:,:7] # left
btsplitsall[2,:,:,0] = 8 + btsplits[:,:7,1]
btsplitsall[2,:,:,1] = 40 - btsplits[:,:7,3]
btsplitsall[2,:,:,3] = 8 + btsplits[:,:7,4]
btsplitsall[2,:,:,4] = 40 - btsplits[:,:7,0]
btsplitsall[3] = btsplits[:,:7] # right
btsplitsall[3,:,:,0] = 40 - btsplits[:,:7,4]
btsplitsall[3,:,:,1] = -8 + btsplits[:,:7,0]
btsplitsall[3,:,:,3] = 40 - btsplits[:,:7,1]
btsplitsall[3,:,:,4] = -8 + btsplits[:,:7,3]
btsplitsflat = np.zeros((4,ntrees,7,4), dtype=np.int64)
btsplitsflat[:,:,:,0] = (btsplitsall[:,:,:,0] * 73*21 +
btsplitsall[:,:,:,1] * 21 +
btsplitsall[:,:,:,2])
btsplitsflat[:,:,:,1] = (btsplitsall[:,:,:,3]-btsplitsall[:,:,:,0])*73*21
btsplitsflat[:,:,:,2] = (btsplitsall[:,:,:,4]-btsplitsall[:,:,:,1])*21
btsplitsflat[:,:,:,3] = (btsplitsall[:,:,:,5]-btsplitsall[:,:,:,2])
predicttime = 0.
anchoroverlaps = prepLocalNms()
globaldetections = np.zeros((ndetections, 5), dtype=int)
globalscores = np.zeros(ndetections)
metricAvgPrec = MetricAvgPrec()
for file_idx in files2use:
globalscores[:] = -100.
data = np.fromfile(lidar_files.format(file_idx),
dtype=np.float32).reshape((-1,4))[:,:3]
calib_extrinsic = calib_extrinsics[calib_map[file_idx]].copy()
calib_extrinsic[2,3] += 1.65
calib_projection = calib_projections[calib_map[file_idx]]
calib_projection = calib_projection.dot(np.linalg.inv(calib_extrinsic))
view_angle = view_by_day[calib_map[file_idx]]
data = data.dot(calib_extrinsic[:3,:3].T) + calib_extrinsic[:3,3]
img = imread(img_files.format(file_idx))[:,:,::-1]
img = grayer(img)
ground = np.load(ground_planes_by_file.format(file_idx))
groundTs = planes2Transforms(ground)
# just use ground elevation, no tilt
groundTs[:,:,:3,:3] == np.eye(3)
groundTs[:,:,0,3] = -(np.arange(grndlen[0])[:,None]+grndstart[0]+.5)*grndstep[0]
groundTs[:,:,1,3] = -(np.arange(grndlen[1])[None,:]+grndstart[1]+.5)*grndstep[1]
groundTs[:,:,2,0] = ground[:,:,0]
groundTs[:,:,2,1] = ground[:,:,1]
groundTs[:,:,2,3] = -ground[:,:,3]
data2 = data.copy()
starttime = time()
predict(data2, groundTs, btsplitsflat, btleaves,
globaldetections, globalscores, anchoroverlaps)
if file_idx != files2use[0]:
predicttime += time() - starttime
# convert detections to global positions
detections = np.zeros((ndetections, 5))
detections[:,3] = 2.
detections[:,4] = .88
for detectionidx in range(ndetections):
centerx, centery, angle, anchoridx, direction = globaldetections[detectionidx]
groundT = groundTs[centerx, centery]
anchorx, anchory = anchorinlocalgrid[anchoridx]
anchorptx = (anchorx+anchorlen[0]*.5 - localgridlen[0]//2 )*anchorstep[0]
anchorpty = (anchory+anchorlen[1]*.5 - localgridlen[1]//2 )*anchorstep[1]
anchorcos, anchorsin = anchorcossins[angle]
localx = anchorcos*anchorptx - anchorsin*anchorpty
localy = anchorcos*anchorpty + anchorsin*anchorptx
globalpt = np.linalg.solve(groundT, (localx, localy, 0., 1.))
globalangle = anchorangles[angle] +\
(direction%2)*np.pi + (direction//2)*np.pi/2
detections[detectionidx,:3] = (globalpt[0], globalpt[1], globalangle)
# perform nms on top detections
notsuppress = np.ones(ndetections, dtype=bool)
#scoreorder = np.argsort(globalscores) globalscores is ordered increasing
for detectionid1 in range(ndetections-1,-1,-1):
if notsuppress[detectionid1]:
x1,y1,angle,l1,w1 = detections[detectionid1]
c1,s1 = (np.cos(angle), np.sin(angle))
for detectionid2 in range(detectionid1-1,-1,-1):
if notsuppress[detectionid2]:
x2,y2,angle,l2,w2 = detections[detectionid2]
c2,s2 = (np.cos(angle), np.sin(angle))
notsuppress[detectionid2] = not rectOverlap(x1,y1,c1,s1,l1,w1,
x2,y2,c2,s2,l2,w2, .3)
detections = detections[notsuppress]
globalscoresS = globalscores[notsuppress]
globaldetectionsS = globaldetections[notsuppress]
# output to file in kitti scoring format
detections4output = np.zeros((detections.shape[0], 8))
for detectionid1 in range(detections.shape[0]):
x1,y1,angle,l1,w1 = detections[detectionid1,:5]
detections4output[detectionid1,:5] = detections[detectionid1,:5]
centerx, centery = globaldetectionsS[detectionid1, :2]
groundtile = ground[centerx, centery]
height = groundtile[3] - x1*groundtile[0] - y1*groundtile[1]
detections4output[detectionid1,5:] = (height,1.7, globalscoresS[detectionid1])
detections4output = detections4output[detections4output[:,7]>-20]
outputstr = formatForKittiScore(detections4output, calib_projection, img.shape)
if output_files is not None:
outputfname = output_files.format(file_idx)
with open(outputfname, 'w') as outputfile: outputfile.write(outputstr)
with open(gt_files.format(file_idx), 'r') as fd: gtstr = fd.read()
gtstuff = readGroundTruthFile(gtstr, ('Car', 'Van'))
estsformetric = []; scoresformetric = []
for outputline in outputstr.split('\n'):
if outputline=='': continue
outputline = outputline.split(' ')
gtang = 4.7124 - float(outputline[14])
gtang = gtang - 6.2832 if gtang > 3.1416 else gtang
gtbox = (float(outputline[13]), -float(outputline[11]),
gtang, float(outputline[10])/2, float(outputline[9])/2)
scoresformetric.append(float(outputline[15]))
estsformetric.append(gtbox)
metricAvgPrec.add(np.array(gtstuff[1]), np.array(gtstuff[4]), np.array(gtstuff[3]),
np.array(estsformetric), np.array(scoresformetric))
# # plot measurements and compare to ground truth boxes
# plot_img = base_image.copy()
# # draw lines to show visualized part of map
# linestart = (639, 320)
# lineend = plotReference(int(.95/view_angle), .95)
# drawx, drawy = drawLine(linestart[0], linestart[1], lineend[0], lineend[1])
# lineend = plotReference(int(.95/view_angle), -.95)
# drawx2, drawy2 = drawLine(linestart[0], linestart[1], lineend[0], lineend[1])
# plot_img[drawx, drawy] = [240,240,240]
# plot_img[drawx2, drawy2] = [240,240,240]
# plot_img2 = plot_img.copy()
# # add ground truth boxes, if available:
# for gtbox, gtscored in zip(gtstuff[1], gtstuff[4]):
# box = np.array(gtbox)
# box[[0,1,3,4]] /= 30.
# box[:2] = plotReference(*box[:2])
# box[3:] *= 320
# if gtscored:
# plotRectangle(plot_img2, box, [0,0,210])
# else:
# plotRectangle(plot_img2, box, [30, 80, 255])
#
# # plot lidar points post ground removal
# pts = np.zeros(data.shape, dtype=np.float64)
# tileidxs = np.zeros(grndlen[0]*grndlen[1]+1, dtype=np.int64)
# tilePoints(data, pts, tileidxs, groundTs)
# heights = np.zeros(pts.shape[0])
# for grndxidx, grndyidx in np.ndindex(*grndlen):
# ptsintilestart = tileidxs[grndxidx*grndlen[1]+grndyidx]
# ptsintileend = tileidxs[grndxidx*grndlen[1]+grndyidx+1]
# groundtile = ground[grndxidx, grndyidx]
# ptsintile = pts[ptsintilestart:ptsintileend]
# heights[ptsintilestart:ptsintileend] = ptsintile.dot(groundtile[:3])-groundtile[3]
# plotpoints_x = pts[heights>.2,0] / 30.
# plotpoints_y = pts[heights>.2,1] / 30.
# include_scatter = ((plotpoints_x > .01) & (plotpoints_x < 1.99) &
# (plotpoints_y > -.99) & (plotpoints_y < .99))
# plotpoints_x, plotpoints_y = plotReference(plotpoints_x[include_scatter],
# plotpoints_y[include_scatter])
# plotpoints_x = plotpoints_x.astype(int)
# plotpoints_y = plotpoints_y.astype(int)
# plotPoints(plot_img, plotpoints_x, plotpoints_y, ((0,0),), (0.,0.,0.))
# plotPoints(plot_img2, plotpoints_x, plotpoints_y, ((0,0),), (0.,0.,0.))
#
# for detection, score in zip(detections, globalscoresS):
# box = detection.copy()
# box[[0,1,3,4]] /= 30.
# box[:2] = plotReference(*box[:2])
# box[3:] *= 320
# if score < -20: continue
# score = 1./(1+np.exp(-score))
# colorb = int(200 + 55*score**.5)
# colorg = 255 - int(55*score**.5)
# plotRectangle(plot_img, box, (colorb, colorg, 0))
#
# eeee = plot_img.astype(int)+plot_img2.astype(int)
# eeee += np.maximum(plot_img, plot_img2) - np.max(eeee, axis=2)[:,:,None]
# eeee = np.maximum(eeee, 0)
# plot_img = eeee.astype(np.uint8)
# # put the plot on top of the camera image to view, display for 3 seconds
# display_img = np.zeros((plot_img.shape[0]+img.shape[0], img.shape[1], 3),
# dtype=np.uint8)
# display_img[:plot_img.shape[0], (img.shape[1]-plot_img.shape[1])//2:
# (img.shape[1]+plot_img.shape[1])//2] = plot_img
# display_img[plot_img.shape[0]:] = img
# imshow('a', display_img);
# qkey = waitKey(100)
# if qkey == ord('q'): break
# destroyWindow('a')
print("predict time {:.2f}".format(predicttime/(len(files2use)-1)))
print("avg precision (not kitti's) {:.3f},{:.3f},{:.3f}".format(
*metricAvgPrec.calc()[:3])) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
4230,
878,
29871,
29955,
29914,
29896,
29953,
29914,
29896,
29929,
13,
13,
29885,
987,
310,
445,
775,
338,
10712,
27545,
304,
278,
1298,
310,
1641,
5051,
443,
949,
519,
13,
1576,
5687,
756,
445,
2498,
5912,
13,
29899,
6623,
14505,
287,
5447,
363,
5172,
671,
29892,
5706,
16280,
1591,
310,
15326,
975,
14128,
13,
29899,
363,
1269,
15326,
13,
1678,
448,
4327,
17343,
279,
3291,
304,
1887,
5962,
10350,
669,
1797,
491,
29871,
29941,
16838,
29941,
29885,
25900,
13,
1678,
448,
363,
1269,
29871,
29941,
16838,
29941,
29885,
25900,
313,
3062,
413,
986,
29875,
756,
25495,
29897,
322,
10696,
13,
4706,
448,
5445,
297,
7581,
992,
29916,
295,
1409,
411,
17343,
279,
10122,
13,
4706,
448,
2125,
13299,
28524,
2533,
297,
599,
18112,
313,
14146,
284,
1967,
29897,
13,
4706,
448,
363,
1014,
629,
4841,
310,
29871,
29946,
992,
29916,
295,
1283,
7224,
313,
29896,
29914,
29947,
29885,
29897,
297,
445,
25900,
322,
29871,
29946,
21008,
18112,
13,
9651,
448,
1065,
2847,
14505,
287,
5447,
373,
10160,
1967,
13,
9651,
448,
565,
2847,
8158,
338,
1880,
3307,
29892,
363,
1269,
992,
29916,
295,
9210,
13,
18884,
448,
1065,
1791,
310,
14505,
287,
5447,
13,
9651,
448,
3787,
9939,
29899,
1557,
8253,
4423,
322,
21008,
5305,
13,
4706,
448,
3013,
2319,
1353,
310,
9939,
29899,
1557,
8253,
1439,
29872,
1953,
515,
445,
25900,
13,
9651,
448,
773,
302,
1516,
1106,
14340,
13,
1678,
448,
671,
4226,
302,
1516,
304,
7344,
12705,
1051,
310,
278,
2246,
1439,
29872,
1953,
13,
15945,
29908,
13,
5215,
12655,
408,
7442,
13,
5215,
954,
2291,
408,
302,
29890,
13,
3166,
5844,
1053,
11904,
408,
5844,
14939,
13,
3166,
931,
1053,
931,
13,
3166,
274,
8768,
1053,
7307,
2208,
29892,
390,
29911,
10249,
29918,
29954,
28902,
1964,
29892,
274,
29918,
5405,
29918,
29886,
13,
13,
3166,
2295,
1053,
867,
299,
2962,
29892,
867,
299,
10568,
29892,
867,
299,
2435,
13,
3166,
2295,
1053,
17360,
2962,
29892,
17360,
10568,
29892,
17360,
2435,
13,
3166,
2295,
1053,
867,
299,
29906,
3198,
7720,
13,
3166,
2295,
1053,
17360,
262,
2997,
7720,
29918,
710,
2618,
29892,
17360,
262,
2997,
7720,
13,
3166,
2295,
1053,
17360,
19536,
408,
17360,
19536,
13,
3166,
2295,
1053,
23791,
1398,
19536,
408,
23791,
1398,
19536,
13,
3166,
5962,
1053,
3814,
267,
29906,
4300,
9514,
13,
13,
2997,
7720,
2435,
353,
313,
29955,
29906,
29892,
29955,
29906,
29897,
13,
25367,
262,
2997,
7720,
353,
17360,
262,
2997,
7720,
718,
313,
29900,
29892,
29947,
29897,
13,
25367,
262,
2997,
7720,
29918,
710,
2618,
353,
17360,
262,
2997,
7720,
29918,
710,
2618,
718,
313,
29900,
29892,
29947,
29897,
13,
13,
25367,
29883,
2209,
1144,
353,
7442,
29889,
4914,
29918,
1429,
3552,
9302,
29889,
3944,
29898,
25367,
19536,
511,
7442,
29889,
5223,
29898,
25367,
19536,
4961,
13,
13,
25367,
5064,
9748,
353,
313,
25367,
262,
2997,
7720,
718,
313,
29906,
29946,
29892,
29896,
29953,
29897,
448,
29871,
29941,
29953,
11877,
25367,
10568,
7503,
29906,
29962,
13,
25367,
5064,
29906,
353,
7442,
29889,
29872,
1144,
398,
29898,
25367,
5064,
9748,
29892,
518,
29900,
29892,
29896,
1402,
17360,
29883,
2209,
1144,
7503,
29892,
29900,
1402,
518,
29906,
1402,
518,
29906,
29892,
29900,
29892,
29896,
2314,
13,
25367,
5064,
29906,
7503,
29892,
29901,
29892,
29900,
29962,
22361,
7442,
29889,
5561,
29898,
25367,
29883,
2209,
1144,
7503,
29892,
29896,
1402,
17360,
5064,
9748,
7503,
29892,
29896,
2314,
13,
25367,
5064,
29906,
7503,
29892,
29901,
29892,
29896,
29962,
4619,
7442,
29889,
5561,
29898,
25367,
29883,
2209,
1144,
7503,
29892,
29896,
1402,
17360,
5064,
9748,
7503,
29892,
29900,
2314,
13,
25367,
5064,
9748,
353,
17360,
5064,
29906,
13,
13,
15945,
29908,
13,
9067,
29879,
282,
1372,
304,
5962,
10694,
13,
16485,
5377,
310,
5962,
5120,
526,
8126,
297,
1409,
29892,
541,
451,
27541,
491,
25900,
333,
10351,
13,
15945,
29908,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
5405,
29898,
9877,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29875,
29947,
7503,
1402,
302,
29890,
29889,
29888,
29947,
7503,
29892,
29901,
29892,
29901,
29892,
1057,
29896,
12622,
13,
1753,
25900,
20325,
29898,
16485,
29892,
716,
16485,
29892,
25900,
333,
10351,
29892,
5962,
29911,
29879,
1125,
13,
1678,
302,
16485,
353,
282,
1372,
29889,
12181,
29961,
29900,
29962,
13,
1678,
611,
486,
488,
791,
353,
867,
299,
2435,
29961,
29900,
14178,
629,
299,
2435,
29961,
29896,
29962,
396,
29871,
29896,
901,
1135,
7472,
4423,
13,
1678,
867,
299,
13140,
353,
7442,
29889,
8159,
29898,
16485,
29889,
12181,
29961,
29900,
1402,
611,
486,
488,
791,
29892,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
1678,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29906,
29892,
17531,
334,
29922,
29871,
29947,
13,
1678,
363,
19592,
13140,
297,
3464,
29898,
29876,
16485,
1125,
13,
4706,
19592,
353,
282,
1372,
29961,
415,
13140,
29962,
13,
4706,
25900,
29916,
353,
938,
29898,
755,
14939,
29898,
415,
29961,
29900,
16261,
629,
299,
10568,
29961,
29900,
12622,
448,
867,
299,
2962,
29961,
29900,
29962,
13,
4706,
260,
15168,
353,
938,
29898,
755,
14939,
29898,
415,
29961,
29896,
16261,
629,
299,
10568,
29961,
29896,
12622,
448,
867,
299,
2962,
29961,
29896,
29962,
13,
4706,
565,
25900,
29916,
6736,
29871,
29900,
322,
260,
15168,
6736,
29871,
29900,
322,
25900,
29916,
529,
867,
299,
2435,
29961,
29900,
29962,
322,
260,
15168,
529,
867,
299,
2435,
29961,
29896,
5387,
13,
9651,
5962,
29911,
353,
5962,
29911,
29879,
29961,
29873,
488,
29916,
29892,
29873,
15168,
29962,
13,
9651,
396,
415,
353,
5962,
29911,
29879,
29961,
29873,
488,
29916,
29892,
29873,
15168,
29892,
29901,
29941,
29892,
29901,
29941,
1822,
6333,
29898,
415,
29897,
718,
5962,
29911,
29879,
29961,
29873,
488,
29916,
29892,
29873,
15168,
29892,
29901,
29941,
29892,
29941,
29962,
13,
9651,
282,
17559,
353,
5844,
14939,
29898,
2057,
29911,
29961,
29906,
29892,
29901,
29941,
1822,
6333,
29898,
415,
29897,
718,
5962,
29911,
29961,
29906,
29892,
29941,
2314,
29899,
29896,
13,
9651,
396,
748,
14432,
322,
4327,
282,
17559,
13,
9651,
396,
415,
29920,
353,
5844,
14939,
29898,
415,
29961,
29906,
14178,
29947,
6817,
29896,
13,
9651,
565,
282,
17559,
6736,
29871,
29900,
322,
282,
17559,
529,
17360,
2435,
29961,
29906,
5387,
13,
18884,
867,
299,
13140,
29961,
415,
13140,
29962,
353,
25900,
29916,
29930,
629,
299,
2435,
29961,
29896,
10062,
29873,
15168,
13,
18884,
19592,
7503,
29906,
29962,
4619,
5962,
29911,
7503,
29906,
29892,
29941,
29962,
13,
18884,
19592,
29961,
29906,
29962,
353,
282,
17559,
13,
1678,
867,
299,
2098,
353,
7442,
29889,
5085,
441,
29898,
629,
299,
13140,
29897,
13,
1678,
396,
25900,
333,
10351,
353,
7442,
29889,
4478,
24582,
29898,
629,
299,
13140,
29961,
629,
299,
2098,
1402,
3464,
29898,
629,
299,
2435,
29961,
29900,
14178,
629,
299,
2435,
29961,
29896,
10062,
29896,
876,
13,
1678,
396,
716,
16485,
7503,
29873,
488,
333,
10351,
14352,
29896,
5262,
353,
282,
1372,
29961,
629,
299,
2098,
7503,
29873,
488,
333,
10351,
14352,
29896,
5262,
29962,
13,
1678,
396,
2400,
338,
2323,
2425,
1873,
310,
278,
2038,
13,
1678,
1857,
29873,
488,
353,
29871,
29900,
13,
1678,
25900,
333,
10351,
29961,
29900,
29962,
353,
29871,
29900,
13,
1678,
363,
19592,
13140,
297,
3464,
29898,
29876,
16485,
1125,
13,
4706,
2030,
415,
13140,
353,
867,
299,
2098,
29961,
415,
13140,
29962,
13,
4706,
716,
16485,
29961,
415,
13140,
29962,
353,
282,
1372,
29961,
1025,
415,
13140,
29962,
13,
4706,
25900,
791,
353,
867,
299,
13140,
29961,
1025,
415,
13140,
29962,
13,
4706,
1550,
25900,
791,
1405,
1857,
29873,
488,
29901,
13,
9651,
1857,
29873,
488,
4619,
29871,
29896,
13,
9651,
25900,
333,
10351,
29961,
3784,
29873,
488,
29962,
353,
19592,
13140,
13,
4706,
565,
1857,
29873,
488,
1275,
611,
486,
488,
791,
29901,
13,
9651,
2867,
13,
13,
15945,
29908,
4893,
758,
29899,
9067,
287,
3291,
9995,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
5405,
29898,
9877,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29875,
29947,
7503,
1402,
302,
29890,
29889,
29875,
29947,
29892,
302,
29890,
29889,
29875,
29947,
29892,
302,
29890,
29889,
29888,
29947,
29892,
13,
462,
302,
29890,
29889,
29888,
29947,
29892,
302,
29890,
29889,
29884,
29896,
7503,
29892,
29901,
29892,
1057,
29896,
12622,
13,
1753,
5445,
7717,
5756,
29898,
16485,
29892,
25900,
333,
10351,
29892,
25900,
29916,
29892,
260,
15168,
29892,
6776,
29892,
4457,
29892,
6856,
1125,
13,
1678,
6856,
7503,
29962,
353,
29871,
29900,
13,
1678,
6776,
29947,
353,
6776,
29930,
29947,
13,
1678,
4457,
29947,
353,
4457,
29930,
29947,
13,
1678,
396,
2696,
29920,
353,
29871,
29896,
448,
17360,
2962,
29961,
29906,
29962,
13,
1678,
363,
25900,
29916,
29906,
29892,
260,
15168,
29906,
297,
7442,
29889,
299,
2248,
29898,
29945,
29892,
29945,
1125,
13,
4706,
25900,
353,
313,
29873,
488,
29916,
29974,
29873,
488,
29916,
29906,
29899,
29906,
11877,
629,
299,
2435,
29961,
29896,
29962,
718,
260,
15168,
29974,
29873,
15168,
29906,
29899,
29906,
13,
4706,
282,
1372,
29918,
13140,
2962,
353,
25900,
333,
10351,
29961,
29873,
488,
29962,
13,
4706,
282,
1372,
29918,
13140,
355,
353,
25900,
333,
10351,
29961,
29873,
488,
29974,
29896,
29962,
13,
4706,
1283,
29916,
353,
313,
3944,
29947,
16395,
29873,
488,
29916,
29906,
29899,
29906,
29897,
718,
4457,
29947,
16395,
29873,
15168,
29906,
29899,
29906,
876,
29930,
29941,
29889,
718,
29871,
29941,
29953,
13,
4706,
1283,
29891,
353,
313,
3944,
29947,
16395,
29873,
15168,
29906,
29899,
29906,
29897,
448,
4457,
29947,
16395,
29873,
488,
29916,
29906,
29899,
29906,
876,
29930,
29941,
29889,
718,
29871,
29941,
29953,
13,
4706,
363,
282,
1372,
13140,
297,
3464,
29898,
16485,
29918,
13140,
2962,
29892,
282,
1372,
29918,
13140,
355,
1125,
13,
9651,
19592,
353,
282,
1372,
29961,
16485,
13140,
29962,
13,
9651,
396,
29920,
353,
938,
29898,
755,
14939,
29898,
415,
29961,
29906,
14178,
29947,
876,
448,
29871,
29896,
396,
4586,
2562,
310,
297,
25900,
20325,
13,
9651,
396,
361,
503,
6736,
29871,
29900,
322,
503,
529,
29871,
29906,
29900,
29901,
13,
9651,
921,
353,
938,
29898,
755,
14939,
29898,
3944,
29947,
29930,
415,
29961,
29900,
29962,
718,
4457,
29947,
29930,
415,
29961,
29896,
29962,
718,
1283,
29916,
876,
13,
9651,
343,
353,
938,
29898,
755,
14939,
29898,
3944,
29947,
29930,
415,
29961,
29896,
29962,
448,
4457,
29947,
29930,
415,
29961,
29900,
29962,
718,
1283,
29891,
876,
13,
9651,
565,
921,
6736,
29871,
29900,
322,
921,
529,
29871,
29955,
29906,
322,
343,
6736,
29871,
29900,
322,
343,
529,
29871,
29955,
29906,
29901,
13,
18884,
503,
353,
938,
29898,
415,
29961,
29906,
2314,
13,
18884,
6856,
29961,
29916,
29892,
29891,
29892,
29920,
29962,
353,
29871,
29896,
13,
13,
1982,
353,
7307,
2208,
877,
6904,
29883,
398,
2083,
29941,
29881,
29889,
578,
742,
390,
29911,
10249,
29918,
29954,
28902,
1964,
29897,
13,
5675,
23573,
284,
5756,
353,
4303,
29889,
29883,
398,
2083,
29941,
29881,
13,
5675,
23573,
284,
5756,
29889,
1191,
8768,
353,
518,
29883,
29918,
5405,
29918,
29886,
29892,
274,
29918,
5405,
29918,
29886,
29962,
13,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
29890,
29896,
29898,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
13,
1669,
302,
29890,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
9877,
29889,
29888,
29947,
29892,
302,
29890,
29889,
29888,
29947,
876,
13,
1753,
7705,
3563,
6984,
29898,
29916,
29896,
29892,
29891,
29896,
29892,
29883,
29896,
29892,
29879,
29896,
29892,
29880,
29896,
29892,
29893,
29896,
29892,
921,
29906,
29892,
29891,
29906,
29892,
29883,
29906,
29892,
29879,
29906,
29892,
29880,
29906,
29892,
29893,
29906,
29892,
25457,
29918,
9040,
1125,
13,
1678,
921,
29906,
262,
29896,
353,
313,
29916,
29906,
29899,
29916,
29896,
11877,
29883,
29896,
718,
313,
29891,
29906,
29899,
29891,
29896,
11877,
29879,
29896,
13,
1678,
343,
29906,
262,
29896,
353,
313,
29891,
29906,
29899,
29891,
29896,
11877,
29883,
29896,
448,
313,
29916,
29906,
29899,
29916,
29896,
11877,
29879,
29896,
13,
1678,
921,
29896,
262,
29906,
353,
313,
29916,
29896,
29899,
29916,
29906,
11877,
29883,
29906,
718,
313,
29891,
29896,
29899,
29891,
29906,
11877,
29879,
29906,
13,
1678,
343,
29896,
262,
29906,
353,
313,
29891,
29896,
29899,
29891,
29906,
11877,
29883,
29906,
448,
313,
29916,
29896,
29899,
29916,
29906,
11877,
29879,
29906,
13,
1678,
6776,
353,
6425,
29898,
29883,
29896,
29930,
29883,
29906,
29974,
29879,
29896,
29930,
29879,
29906,
29897,
13,
1678,
4457,
353,
6425,
29898,
29883,
29896,
29930,
29879,
29906,
29899,
29883,
29906,
29930,
29879,
29896,
29897,
13,
1678,
736,
451,
313,
29880,
29896,
718,
301,
29906,
29930,
3944,
718,
281,
29906,
29930,
5223,
448,
6425,
29898,
29916,
29906,
262,
29896,
29897,
529,
25457,
29918,
9040,
470,
13,
18884,
281,
29896,
718,
301,
29906,
29930,
5223,
718,
281,
29906,
29930,
3944,
448,
6425,
29898,
29891,
29906,
262,
29896,
29897,
529,
25457,
29918,
9040,
470,
13,
18884,
301,
29906,
718,
301,
29896,
29930,
3944,
718,
281,
29896,
29930,
5223,
448,
6425,
29898,
29916,
29896,
262,
29906,
29897,
529,
25457,
29918,
9040,
470,
13,
18884,
281,
29906,
718,
301,
29896,
29930,
5223,
718,
281,
29896,
29930,
3944,
448,
6425,
29898,
29891,
29896,
262,
29906,
29897,
529,
25457,
29918,
9040,
29897,
13,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
29890,
29896,
7503,
29892,
29901,
29892,
29901,
29892,
29901,
29892,
29901,
29892,
1057,
29896,
29962,
3101,
13,
1753,
8273,
7717,
29940,
1516,
7295,
13,
1678,
302,
14588,
943,
353,
17360,
262,
2997,
7720,
29889,
12181,
29961,
29900,
29962,
13,
1678,
975,
14128,
353,
7442,
29889,
3298,
359,
3552,
14588,
1398,
19536,
458,
29906,
29892,
13707,
305,
943,
29892,
29906,
29892,
23791,
1398,
19536,
458,
29906,
29892,
13707,
305,
943,
29892,
29906,
511,
13,
462,
4706,
26688,
29922,
9302,
29889,
11227,
29947,
29897,
13,
1678,
5446,
29918,
2435,
353,
29871,
29906,
29889,
13,
1678,
5446,
29918,
9163,
353,
29871,
29896,
29889,
29937,
29889,
29929,
13,
1678,
25457,
29918,
9040,
353,
869,
29946,
29937,
29889,
29941,
13,
1678,
5446,
29918,
29882,
1478,
327,
353,
7442,
29889,
29882,
1478,
327,
29898,
5415,
29918,
2435,
29892,
5446,
29918,
9163,
29897,
13,
1678,
363,
10696,
13140,
29896,
29892,
10696,
13140,
29906,
29892,
17360,
13140,
29896,
29892,
17360,
13140,
29906,
29892,
4516,
29896,
29892,
4516,
29906,
297,
7442,
29889,
299,
2248,
29898,
13,
462,
1678,
23791,
1398,
19536,
458,
29906,
29892,
23791,
1398,
19536,
458,
29906,
29892,
302,
14588,
943,
29892,
302,
14588,
943,
29892,
29906,
29892,
29906,
1125,
13,
4706,
565,
10696,
13140,
29906,
529,
10696,
13140,
29896,
29901,
13,
9651,
6773,
13,
308,
13,
4706,
921,
29896,
29892,
343,
29896,
353,
17360,
5064,
9748,
29961,
2521,
13140,
29896,
29892,
17360,
13140,
29896,
29962,
13,
4706,
921,
29906,
29892,
343,
29906,
353,
17360,
5064,
9748,
29961,
2521,
13140,
29906,
29892,
17360,
13140,
29906,
29962,
13,
4706,
25457,
353,
7700,
13,
4706,
1644,
2018,
391,
353,
7442,
29889,
29882,
1478,
327,
29898,
29916,
29896,
29899,
29916,
29906,
29892,
343,
29896,
29899,
29891,
29906,
29897,
13,
4706,
565,
1644,
2018,
391,
529,
5446,
29918,
9163,
29930,
29906,
448,
25457,
29918,
9040,
29901,
13,
9651,
25457,
353,
5852,
13,
4706,
25342,
1644,
2018,
391,
1405,
5446,
29918,
29882,
1478,
327,
29930,
29906,
448,
25457,
29918,
9040,
29901,
13,
9651,
25457,
353,
7700,
13,
4706,
1683,
29901,
13,
9651,
6776,
29896,
29892,
4457,
29896,
353,
17360,
29883,
2209,
1144,
29961,
2521,
13140,
29896,
29962,
13,
9651,
6776,
29906,
29892,
4457,
29906,
353,
17360,
29883,
2209,
1144,
29961,
2521,
13140,
29906,
29962,
13,
9651,
565,
4516,
29896,
29901,
13,
18884,
6776,
29896,
29892,
4457,
29896,
353,
448,
5223,
29896,
29892,
6776,
29896,
13,
9651,
565,
4516,
29906,
29901,
13,
18884,
6776,
29906,
29892,
4457,
29906,
353,
448,
5223,
29906,
29892,
6776,
29906,
13,
9651,
25457,
353,
7705,
3563,
6984,
29898,
29916,
29896,
29892,
29891,
29896,
29892,
3944,
29896,
29892,
5223,
29896,
29892,
5415,
29918,
2435,
29892,
5415,
29918,
9163,
29892,
13,
462,
462,
29871,
921,
29906,
29892,
29891,
29906,
29892,
3944,
29906,
29892,
5223,
29906,
29892,
5415,
29918,
2435,
29892,
5415,
29918,
9163,
29892,
869,
29945,
29897,
29937,
29889,
29946,
29945,
29897,
13,
4706,
565,
25457,
29901,
13,
9651,
975,
14128,
29961,
2521,
13140,
29896,
29892,
17360,
13140,
29896,
29892,
4516,
29896,
29892,
10696,
13140,
29906,
29892,
17360,
13140,
29906,
29892,
4516,
29906,
29962,
353,
5852,
13,
9651,
975,
14128,
29961,
2521,
13140,
29906,
29892,
17360,
13140,
29906,
29892,
4516,
29906,
29892,
10696,
13140,
29896,
29892,
17360,
13140,
29896,
29892,
4516,
29896,
29962,
353,
5852,
13,
1678,
736,
975,
14128,
13,
268,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
29888,
29947,
29898,
9877,
29889,
29884,
29946,
7503,
1402,
302,
29890,
29889,
29875,
29947,
29892,
302,
29890,
29889,
29875,
29947,
7503,
29892,
29901,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29875,
29947,
29892,
302,
29890,
29889,
29875,
29947,
29892,
302,
29890,
29889,
29888,
29947,
876,
13,
1753,
671,
8431,
520,
287,
9643,
29898,
7720,
29892,
17360,
10289,
29892,
289,
1372,
572,
1169,
29892,
289,
29873,
280,
5989,
29892,
5447,
29896,
29892,
8336,
29906,
29892,
8158,
1125,
13,
1678,
363,
5447,
297,
3464,
29898,
8336,
29896,
29892,
8336,
29906,
1125,
13,
4706,
6219,
13140,
353,
29871,
29900,
13,
4706,
363,
10809,
297,
3464,
29898,
29941,
1125,
13,
9651,
1369,
29886,
29892,
921,
11631,
29892,
343,
11631,
29892,
503,
11631,
353,
289,
1372,
572,
1169,
29961,
8336,
29892,
6219,
13140,
29962,
13,
9651,
1369,
29886,
353,
1369,
29886,
718,
17360,
10289,
13,
9651,
302,
9748,
353,
313,
7720,
29961,
2962,
29886,
29974,
29920,
11631,
29962,
448,
6856,
29961,
2962,
29886,
29962,
718,
6856,
29961,
2962,
29886,
29974,
962,
994,
29962,
448,
13,
462,
539,
6856,
29961,
2962,
29886,
29974,
962,
994,
29974,
29920,
11631,
29962,
718,
6856,
29961,
2962,
29886,
29974,
29916,
11631,
29962,
448,
29871,
13,
462,
539,
6856,
29961,
2962,
29886,
29974,
29916,
11631,
29974,
29920,
11631,
29962,
448,
6856,
29961,
2962,
29886,
29974,
29916,
11631,
29974,
962,
994,
29962,
718,
13,
462,
539,
6856,
29961,
2962,
29886,
29974,
29916,
11631,
29974,
962,
994,
29974,
29920,
11631,
2314,
13,
9651,
6219,
13140,
3532,
29922,
29871,
29896,
13,
9651,
6219,
13140,
4619,
29871,
29896,
565,
302,
9748,
1683,
29871,
29906,
13,
4706,
8158,
4619,
289,
29873,
280,
5989,
29961,
8336,
29892,
6219,
13140,
448,
29871,
29955,
29962,
13,
4706,
565,
8158,
529,
289,
29873,
280,
5989,
29961,
8336,
29892,
29947,
5387,
13,
9651,
736,
448,
29945,
29900,
29889,
718,
5447,
13,
1678,
736,
8158,
13,
13,
13,
13,
29992,
9877,
29889,
29876,
29926,
277,
29898,
9877,
29889,
5405,
29898,
9877,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29888,
29947,
7503,
29892,
29901,
29892,
29901,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29875,
29947,
7503,
29892,
29901,
29892,
29901,
29892,
1057,
29896,
1402,
302,
29890,
29889,
29888,
29947,
7503,
29892,
1057,
29896,
1402,
13,
462,
302,
29890,
29889,
29875,
29947,
7503,
29892,
29901,
1402,
302,
29890,
29889,
29888,
29947,
7503,
1402,
302,
29890,
29889,
29890,
29896,
7503,
29892,
29901,
29892,
29901,
29892,
29901,
29892,
29901,
29892,
1057,
29896,
12622,
13,
1753,
8500,
29898,
16485,
29892,
5962,
29911,
29879,
29892,
289,
1372,
572,
1169,
29892,
289,
29873,
280,
5989,
29892,
13149,
2741,
2650,
1953,
29892,
13149,
1338,
29883,
2361,
29892,
13,
9651,
17360,
957,
14128,
1125,
13,
1678,
716,
16485,
353,
7442,
29889,
3298,
359,
29898,
16485,
29889,
12181,
29892,
26688,
29922,
9302,
29889,
7411,
29953,
29946,
29897,
13,
1678,
25900,
333,
10351,
353,
7442,
29889,
3298,
359,
29898,
629,
299,
2435,
29961,
29900,
14178,
629,
299,
2435,
29961,
29896,
10062,
29896,
29892,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
1678,
25900,
20325,
29898,
16485,
29892,
716,
16485,
29892,
25900,
333,
10351,
29892,
5962,
29911,
29879,
29897,
13,
1678,
282,
1372,
353,
716,
16485,
396,
1024,
1735,
363,
29703,
13,
268,
13,
1678,
6856,
12181,
353,
313,
29955,
29941,
29892,
29955,
29941,
29892,
29906,
29896,
29897,
13,
1678,
396,
7720,
353,
7442,
29889,
6310,
29898,
7720,
12181,
29892,
26688,
29922,
9302,
29889,
524,
29896,
29953,
29897,
13,
1678,
6856,
353,
7442,
29889,
6310,
3552,
29955,
29906,
29892,
29955,
29906,
29892,
29906,
29900,
511,
26688,
29922,
9302,
29889,
13470,
29947,
29897,
13,
1678,
13299,
7720,
353,
7442,
29889,
3298,
359,
29898,
7720,
12181,
29892,
26688,
29922,
9302,
29889,
13470,
29941,
29906,
29897,
13,
1678,
6856,
20620,
353,
13299,
7720,
29889,
690,
14443,
3552,
29899,
29896,
29892,
876,
13,
268,
13,
1678,
302,
14588,
943,
29918,
710,
2618,
353,
17360,
262,
2997,
7720,
29918,
710,
2618,
29889,
12181,
29961,
29900,
29962,
13,
1678,
302,
28737,
353,
289,
1372,
572,
1169,
29889,
12181,
29961,
29896,
29962,
13,
1678,
18239,
1454,
1228,
2521,
353,
7442,
29889,
3298,
359,
3552,
29941,
29953,
29892,
29946,
511,
26688,
29922,
9302,
29889,
7411,
29953,
29946,
29897,
13,
268,
13,
1678,
302,
2997,
29881,
2650,
1953,
353,
29871,
29946,
13,
1678,
1887,
29881,
2650,
1953,
353,
7442,
29889,
3298,
359,
3552,
29876,
2997,
29881,
2650,
1953,
29892,
29871,
29941,
511,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
1678,
1180,
1338,
29883,
2361,
353,
7442,
29889,
3298,
359,
29898,
29876,
2997,
29881,
2650,
1953,
29892,
26688,
29922,
9302,
29889,
7411,
29953,
29946,
29897,
13,
1678,
8736,
2127,
2741,
2650,
1953,
353,
13149,
2741,
2650,
1953,
29889,
12181,
29961,
29900,
29962,
13,
268,
13,
1678,
363,
867,
299,
29906,
3198,
7720,
13140,
297,
3464,
29898,
629,
299,
29906,
3198,
7720,
29889,
12181,
29961,
29900,
29962,
1125,
13,
4706,
4818,
29916,
29892,
1644,
708,
353,
867,
299,
29906,
3198,
7720,
29961,
629,
299,
29906,
3198,
7720,
13140,
29962,
13,
4706,
1180,
1338,
29883,
2361,
7503,
29962,
353,
448,
29896,
29900,
29900,
29889,
13,
308,
13,
4706,
363,
10696,
297,
3464,
29898,
29900,
29892,
14588,
1398,
19536,
458,
29906,
1125,
13,
9651,
6776,
29892,
4457,
353,
17360,
29883,
2209,
1144,
29961,
2521,
29962,
13,
9651,
5445,
7717,
5756,
29898,
16485,
29892,
25900,
333,
10351,
29892,
4818,
29916,
29892,
1644,
708,
29892,
6776,
29892,
4457,
29892,
6856,
29897,
13,
9651,
1207,
23573,
284,
5756,
29898,
7720,
29889,
312,
7384,
29889,
1272,
29892,
13299,
7720,
29889,
312,
7384,
29889,
1272,
29897,
13,
9651,
5272,
2521,
353,
10696,
29995,
29906,
1405,
29871,
29900,
13,
632,
13,
9651,
363,
17360,
13140,
297,
3464,
29898,
13707,
305,
943,
29918,
710,
2618,
1125,
13,
18884,
17360,
29916,
29892,
23791,
706,
353,
17360,
262,
2997,
7720,
29918,
710,
2618,
29961,
25367,
13140,
29962,
13,
18884,
1900,
2997,
13628,
353,
448,
29941,
29900,
13,
18884,
1900,
2997,
25367,
29916,
353,
29871,
29900,
13,
18884,
1900,
2997,
14588,
706,
353,
29871,
29947,
13,
18884,
1900,
2997,
20845,
353,
29871,
29900,
13,
18884,
17360,
10289,
353,
17360,
29916,
29930,
7720,
12181,
29961,
29896,
14178,
7720,
12181,
29961,
29906,
10062,
14588,
706,
29930,
7720,
12181,
29961,
29906,
29962,
396,
17067,
3580,
29871,
29955,
29914,
29896,
29906,
13,
462,
13,
18884,
363,
5305,
297,
3464,
29898,
29946,
1125,
13,
462,
1678,
565,
5272,
2521,
29901,
13,
462,
4706,
8158,
353,
18239,
1454,
1228,
2521,
29961,
25367,
13140,
29892,
20845,
29962,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
8158,
353,
671,
8431,
520,
287,
9643,
29898,
7720,
20620,
29892,
17360,
10289,
29892,
13,
462,
462,
1669,
289,
1372,
572,
1169,
29961,
20845,
1402,
289,
29873,
280,
5989,
29892,
13,
462,
462,
18884,
29900,
29892,
29896,
29900,
29892,
29871,
29900,
1846,
13,
462,
4706,
18239,
1454,
1228,
2521,
29961,
25367,
13140,
29892,
20845,
29962,
353,
8158,
13,
462,
1678,
565,
8158,
1405,
448,
29941,
29900,
29901,
13,
462,
4706,
363,
17360,
29916,
29906,
297,
3464,
29898,
25367,
29916,
29899,
29896,
29892,
17360,
29916,
29974,
29941,
1125,
13,
462,
9651,
363,
23791,
706,
29906,
297,
3464,
29898,
14588,
706,
29899,
29896,
29892,
23791,
706,
29974,
29941,
1125,
13,
462,
18884,
17360,
29906,
2696,
353,
313,
25367,
29916,
29906,
29930,
7720,
12181,
29961,
29896,
10062,
14588,
706,
29906,
11877,
7720,
12181,
29961,
29906,
29962,
13,
462,
18884,
8158,
29906,
353,
671,
8431,
520,
287,
9643,
29898,
7720,
20620,
29892,
17360,
29906,
2696,
29892,
13,
462,
462,
462,
4706,
289,
1372,
572,
1169,
29961,
20845,
1402,
3116,
280,
5989,
29892,
13,
462,
462,
462,
308,
29896,
29900,
29892,
593,
11003,
29892,
13628,
29897,
13,
462,
18884,
565,
8158,
29906,
1405,
1900,
2997,
13628,
29901,
13,
462,
462,
1678,
1900,
2997,
13628,
353,
8158,
29906,
13,
462,
462,
1678,
1900,
2997,
25367,
29916,
353,
17360,
29916,
29906,
13,
462,
462,
1678,
1900,
2997,
14588,
706,
353,
23791,
706,
29906,
13,
462,
462,
1678,
1900,
2997,
20845,
353,
5305,
13,
462,
13,
18884,
396,
17462,
2246,
1887,
1439,
29872,
1953,
29892,
1550,
884,
15859,
302,
1516,
13,
18884,
17360,
13140,
29906,
353,
1900,
2997,
25367,
29916,
29930,
29906,
29946,
718,
1900,
2997,
14588,
706,
29899,
29947,
13,
18884,
652,
307,
369,
29906,
353,
1900,
2997,
20845,
458,
29906,
13,
18884,
451,
19303,
1253,
287,
353,
5852,
13,
18884,
363,
15326,
13140,
297,
3464,
29898,
29876,
2997,
29881,
2650,
1953,
1125,
13,
462,
1678,
916,
2521,
29892,
916,
25367,
29892,
916,
3972,
353,
1887,
29881,
2650,
1953,
29961,
29881,
2650,
428,
13140,
29962,
13,
462,
1678,
565,
17360,
957,
14128,
29961,
2521,
29892,
17360,
13140,
29906,
29892,
652,
307,
369,
29906,
29892,
13,
462,
462,
418,
916,
2521,
29892,
916,
25367,
29892,
916,
3972,
458,
29906,
5387,
13,
462,
4706,
451,
19303,
1253,
287,
7878,
1180,
1338,
29883,
2361,
29961,
29881,
2650,
428,
13140,
29962,
529,
1900,
2997,
13628,
13,
18884,
565,
451,
19303,
1253,
287,
29901,
13,
462,
1678,
363,
15326,
13140,
297,
3464,
29898,
29876,
2997,
29881,
2650,
1953,
1125,
13,
462,
4706,
916,
2521,
29892,
916,
25367,
29892,
916,
3972,
353,
1887,
29881,
2650,
1953,
29961,
29881,
2650,
428,
13140,
29962,
13,
462,
4706,
565,
17360,
957,
14128,
29961,
2521,
29892,
17360,
13140,
29906,
29892,
652,
307,
369,
29906,
29892,
13,
462,
462,
3986,
916,
2521,
29892,
916,
25367,
29892,
916,
3972,
458,
29906,
5387,
13,
462,
9651,
1180,
1338,
29883,
2361,
29961,
29881,
2650,
428,
13140,
29962,
353,
448,
29896,
29900,
29900,
29889,
13,
462,
1678,
15326,
29873,
487,
6689,
353,
7442,
29889,
1191,
1195,
29898,
2997,
1557,
2361,
29897,
13,
462,
1678,
565,
1900,
2997,
13628,
1405,
1180,
1338,
29883,
2361,
29961,
29881,
2650,
428,
29873,
487,
6689,
5387,
13,
462,
4706,
1887,
29881,
2650,
1953,
29961,
29881,
2650,
428,
29873,
487,
6689,
29962,
353,
313,
2521,
29892,
17360,
13140,
29906,
29892,
13,
462,
462,
462,
1669,
1900,
2997,
20845,
29897,
13,
462,
4706,
1180,
1338,
29883,
2361,
29961,
29881,
2650,
428,
29873,
487,
6689,
29962,
353,
1900,
2997,
13628,
13,
462,
268,
13,
4706,
396,
788,
2246,
1887,
1439,
29872,
1953,
304,
5534,
12705,
1439,
29872,
1953,
13,
4706,
396,
8830,
297,
6689,
10366,
2656,
4331,
13,
4706,
1887,
2098,
353,
7442,
29889,
5085,
441,
29898,
2997,
1557,
2361,
29897,
13,
4706,
515,
10945,
13140,
353,
29871,
29900,
13,
4706,
3996,
3157,
13140,
353,
448,
29876,
2997,
29881,
2650,
1953,
13,
4706,
363,
15326,
13140,
297,
3464,
29898,
29876,
2997,
29881,
2650,
1953,
1125,
13,
9651,
8158,
353,
1180,
1338,
29883,
2361,
29961,
2997,
2098,
29961,
29881,
2650,
428,
13140,
5262,
13,
9651,
1550,
515,
10945,
13140,
529,
8736,
2127,
2741,
2650,
1953,
322,
8158,
1405,
13149,
1338,
29883,
2361,
29961,
3166,
10945,
13140,
5387,
13,
18884,
565,
3996,
3157,
13140,
6736,
29871,
29900,
29901,
13,
462,
1678,
13149,
1338,
29883,
2361,
29961,
29873,
468,
3157,
13140,
29962,
353,
13149,
1338,
29883,
2361,
29961,
3166,
10945,
13140,
29962,
13,
462,
1678,
13149,
2741,
2650,
1953,
29961,
29873,
468,
3157,
13140,
29962,
353,
13149,
2741,
2650,
1953,
29961,
3166,
10945,
13140,
29962,
13,
18884,
3996,
3157,
13140,
4619,
29871,
29896,
13,
18884,
515,
10945,
13140,
4619,
29871,
29896,
13,
9651,
565,
3996,
3157,
13140,
6736,
29871,
29900,
29901,
13,
18884,
10696,
29892,
17360,
13140,
29892,
5305,
353,
1887,
29881,
2650,
1953,
29961,
2997,
2098,
29961,
29881,
2650,
428,
13140,
5262,
13,
18884,
13149,
1338,
29883,
2361,
29961,
29873,
468,
3157,
13140,
29962,
353,
8158,
13,
18884,
13149,
2741,
2650,
1953,
29961,
29873,
468,
3157,
13140,
29962,
353,
313,
5064,
29916,
29892,
1644,
708,
29892,
10696,
29892,
13,
462,
462,
462,
17360,
13140,
29892,
5305,
29897,
13,
9651,
3996,
3157,
13140,
4619,
29871,
29896,
13,
632,
13,
13,
1753,
16749,
261,
29898,
2492,
1125,
736,
5135,
2492,
29889,
579,
668,
29898,
7411,
6817,
29896,
29906,
29947,
29897,
10521,
29955,
29945,
718,
29871,
29896,
29906,
29947,
467,
579,
668,
29898,
9302,
29889,
13470,
29947,
29897,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
515,
1967,
601,
1053,
527,
949,
13,
1678,
515,
13850,
29906,
1053,
527,
4294,
29892,
4480,
2558,
29892,
8174,
5907,
13,
1678,
515,
14707,
1053,
4737,
2200,
12810,
29887,
29925,
3757,
13,
1678,
515,
1208,
747,
29879,
1053,
1208,
747,
29918,
1062,
29878,
1144,
1199,
29892,
1208,
747,
29918,
1958,
29892,
1776,
29918,
1609,
29918,
3250,
29892,
1208,
747,
29918,
771,
24247,
13,
1678,
515,
6492,
855,
3096,
1053,
2967,
29918,
3027,
29892,
6492,
7364,
2521,
29892,
4216,
3542,
29892,
6492,
20325,
13,
1678,
515,
6492,
855,
3096,
1053,
3407,
408,
6492,
7422,
13,
1678,
515,
413,
986,
29875,
23799,
1053,
1303,
3338,
618,
2308,
2806,
2283,
29892,
3402,
2831,
29968,
986,
29875,
20097,
13,
268,
13,
1678,
515,
590,
601,
1053,
17343,
279,
29918,
5325,
29892,
330,
29873,
29918,
5325,
29892,
10153,
29918,
5325,
29892,
1962,
29918,
5325,
13,
1678,
515,
590,
601,
1053,
5962,
29918,
9018,
267,
29918,
1609,
29918,
1445,
29892,
1904,
29918,
1445,
29892,
2066,
29906,
1509,
13,
268,
13,
268,
299,
2650,
1953,
353,
29871,
29941,
29906,
13,
268,
13,
1678,
396,
10551,
5447,
3402,
363,
5172,
1106,
14340,
13,
1678,
396,
3023,
4733,
526,
2825,
29892,
697,
363,
1269,
21008,
5305,
13,
1678,
396,
1269,
1904,
338,
376,
1579,
8606,
287,
29908,
304,
1106,
701,
278,
10160,
1967,
297,
263,
1652,
8606,
287,
1409,
13,
1678,
396,
313,
1552,
1409,
29915,
29879,
2159,
1818,
367,
2998,
29897,
13,
1678,
396,
278,
7575,
2655,
1048,
445,
8954,
338,
393,
278,
2602,
284,
9210,
363,
13,
1678,
396,
1269,
15326,
6858,
263,
2323,
788,
29892,
322,
871,
29871,
29946,
3694,
4529,
263,
6219,
13,
1678,
350,
29911,
4984,
353,
7442,
29889,
1359,
29898,
4299,
29918,
1445,
29897,
13,
1678,
289,
1372,
572,
1169,
353,
350,
29911,
4984,
1839,
23579,
1169,
2033,
7503,
1822,
8552,
580,
13,
1678,
289,
29873,
280,
5989,
353,
350,
29911,
4984,
1839,
280,
5989,
2033,
7503,
1822,
8552,
580,
13,
1678,
302,
28737,
353,
289,
1372,
572,
1169,
29889,
12181,
29961,
29900,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
353,
7442,
29889,
3298,
359,
3552,
29946,
29892,
593,
11003,
29892,
29955,
29892,
29953,
511,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29900,
29962,
353,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29962,
396,
6375,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29896,
29962,
353,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29962,
396,
1250,
1328,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29896,
29892,
29901,
29892,
29901,
29892,
29900,
29962,
353,
29871,
29946,
29947,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29941,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29896,
29892,
29901,
29892,
29901,
29892,
29896,
29962,
353,
29871,
29941,
29906,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29946,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29896,
29892,
29901,
29892,
29901,
29892,
29941,
29962,
353,
29871,
29946,
29947,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29900,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29896,
29892,
29901,
29892,
29901,
29892,
29946,
29962,
353,
29871,
29941,
29906,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29896,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29906,
29962,
353,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29962,
396,
2175,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29906,
29892,
29901,
29892,
29901,
29892,
29900,
29962,
353,
259,
29947,
718,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29896,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29906,
29892,
29901,
29892,
29901,
29892,
29896,
29962,
353,
29871,
29946,
29900,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29941,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29906,
29892,
29901,
29892,
29901,
29892,
29941,
29962,
353,
259,
29947,
718,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29946,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29906,
29892,
29901,
29892,
29901,
29892,
29946,
29962,
353,
29871,
29946,
29900,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29900,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29941,
29962,
353,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29962,
396,
1492,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29941,
29892,
29901,
29892,
29901,
29892,
29900,
29962,
353,
29871,
29946,
29900,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29946,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29941,
29892,
29901,
29892,
29901,
29892,
29896,
29962,
353,
448,
29947,
718,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29900,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29941,
29892,
29901,
29892,
29901,
29892,
29941,
29962,
353,
29871,
29946,
29900,
448,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29896,
29962,
13,
1678,
289,
1372,
572,
1169,
497,
29961,
29941,
29892,
29901,
29892,
29901,
29892,
29946,
29962,
353,
448,
29947,
718,
289,
1372,
572,
1169,
7503,
29892,
29901,
29955,
29892,
29941,
29962,
13,
1678,
289,
1372,
572,
1169,
20620,
353,
7442,
29889,
3298,
359,
3552,
29946,
29892,
593,
11003,
29892,
29955,
29892,
29946,
511,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
1678,
289,
1372,
572,
1169,
20620,
7503,
29892,
29901,
29892,
29901,
29892,
29900,
29962,
353,
313,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29900,
29962,
334,
29871,
29955,
29941,
29930,
29906,
29896,
718,
13,
462,
632,
289,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29896,
29962,
334,
29871,
29906,
29896,
718,
13,
462,
632,
289,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29906,
2314,
13,
1678,
289,
1372,
572,
1169,
20620,
7503,
29892,
29901,
29892,
29901,
29892,
29896,
29962,
353,
313,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29941,
29962,
29899,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29900,
2314,
29930,
29955,
29941,
29930,
29906,
29896,
13,
1678,
289,
1372,
572,
1169,
20620,
7503,
29892,
29901,
29892,
29901,
29892,
29906,
29962,
353,
313,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29946,
29962,
29899,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29896,
2314,
29930,
29906,
29896,
13,
1678,
289,
1372,
572,
1169,
20620,
7503,
29892,
29901,
29892,
29901,
29892,
29941,
29962,
353,
313,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29945,
29962,
29899,
29890,
1372,
572,
1169,
497,
7503,
29892,
29901,
29892,
29901,
29892,
29906,
2314,
13,
268,
13,
268,
13,
1678,
4450,
293,
698,
603,
353,
29871,
29900,
29889,
13,
268,
13,
1678,
17360,
957,
14128,
353,
8273,
7717,
29940,
1516,
580,
13,
268,
13,
1678,
13149,
2741,
2650,
1953,
353,
7442,
29889,
3298,
359,
3552,
299,
2650,
1953,
29892,
29871,
29945,
511,
26688,
29922,
524,
29897,
13,
1678,
13149,
1338,
29883,
2361,
353,
7442,
29889,
3298,
359,
29898,
299,
2650,
1953,
29897,
13,
268,
13,
1678,
12714,
12810,
29887,
29925,
3757,
353,
4737,
2200,
12810,
29887,
29925,
3757,
580,
13,
13,
1678,
363,
934,
29918,
13140,
297,
2066,
29906,
1509,
29901,
13,
4706,
13149,
1338,
29883,
2361,
7503,
29962,
353,
448,
29896,
29900,
29900,
29889,
13,
308,
13,
4706,
848,
353,
7442,
29889,
3166,
1445,
29898,
29880,
333,
279,
29918,
5325,
29889,
4830,
29898,
1445,
29918,
13140,
511,
13,
462,
965,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
467,
690,
14443,
3552,
29899,
29896,
29892,
29946,
876,
7503,
29892,
29901,
29941,
29962,
13,
4706,
1208,
747,
29918,
1062,
29878,
28594,
353,
1208,
747,
29918,
1062,
29878,
1144,
1199,
29961,
1052,
747,
29918,
1958,
29961,
1445,
29918,
13140,
29962,
1822,
8552,
580,
13,
4706,
1208,
747,
29918,
1062,
29878,
28594,
29961,
29906,
29892,
29941,
29962,
4619,
29871,
29896,
29889,
29953,
29945,
13,
4706,
1208,
747,
29918,
771,
6929,
353,
1208,
747,
29918,
771,
24247,
29961,
1052,
747,
29918,
1958,
29961,
1445,
29918,
13140,
5262,
13,
4706,
1208,
747,
29918,
771,
6929,
353,
1208,
747,
29918,
771,
6929,
29889,
6333,
29898,
9302,
29889,
29880,
979,
29887,
29889,
11569,
29898,
1052,
747,
29918,
1062,
29878,
28594,
876,
13,
4706,
1776,
29918,
2521,
353,
1776,
29918,
1609,
29918,
3250,
29961,
1052,
747,
29918,
1958,
29961,
1445,
29918,
13140,
5262,
13,
4706,
848,
353,
848,
29889,
6333,
29898,
1052,
747,
29918,
1062,
29878,
28594,
7503,
29941,
29892,
29901,
29941,
1822,
29911,
29897,
718,
1208,
747,
29918,
1062,
29878,
28594,
7503,
29941,
29892,
29941,
29962,
13,
4706,
10153,
353,
527,
949,
29898,
2492,
29918,
5325,
29889,
4830,
29898,
1445,
29918,
13140,
876,
7503,
29892,
29901,
29892,
1057,
29899,
29896,
29962,
13,
4706,
10153,
353,
16749,
261,
29898,
2492,
29897,
13,
268,
13,
4706,
5962,
353,
7442,
29889,
1359,
29898,
2057,
29918,
9018,
267,
29918,
1609,
29918,
1445,
29889,
4830,
29898,
1445,
29918,
13140,
876,
13,
4706,
5962,
29911,
29879,
353,
3814,
267,
29906,
4300,
9514,
29898,
2057,
29897,
13,
4706,
396,
925,
671,
5962,
11858,
362,
29892,
694,
260,
2782,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29901,
29941,
29892,
29901,
29941,
29962,
1275,
7442,
29889,
1032,
29872,
29898,
29941,
29897,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29900,
29892,
29941,
29962,
353,
19691,
9302,
29889,
279,
927,
29898,
629,
299,
2435,
29961,
29900,
2314,
7503,
29892,
8516,
10062,
629,
299,
2962,
29961,
29900,
10062,
29889,
29945,
11877,
629,
299,
10568,
29961,
29900,
29962,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29896,
29892,
29941,
29962,
353,
19691,
9302,
29889,
279,
927,
29898,
629,
299,
2435,
29961,
29896,
2314,
29961,
8516,
29892,
29901,
10062,
629,
299,
2962,
29961,
29896,
10062,
29889,
29945,
11877,
629,
299,
10568,
29961,
29896,
29962,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29906,
29892,
29900,
29962,
353,
5962,
7503,
29892,
29901,
29892,
29900,
29962,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29906,
29892,
29896,
29962,
353,
5962,
7503,
29892,
29901,
29892,
29896,
29962,
13,
4706,
5962,
29911,
29879,
7503,
29892,
29901,
29892,
29906,
29892,
29941,
29962,
353,
448,
2057,
7503,
29892,
29901,
29892,
29941,
29962,
13,
268,
13,
4706,
848,
29906,
353,
848,
29889,
8552,
580,
13,
4706,
1369,
2230,
353,
931,
580,
13,
4706,
8500,
29898,
1272,
29906,
29892,
5962,
29911,
29879,
29892,
289,
1372,
572,
1169,
20620,
29892,
289,
29873,
280,
5989,
29892,
13,
462,
268,
13149,
2741,
2650,
1953,
29892,
13149,
1338,
29883,
2361,
29892,
17360,
957,
14128,
29897,
13,
4706,
565,
934,
29918,
13140,
2804,
2066,
29906,
1509,
29961,
29900,
5387,
13,
9651,
4450,
293,
698,
603,
4619,
931,
580,
448,
1369,
2230,
13,
308,
13,
4706,
396,
3588,
1439,
29872,
1953,
304,
5534,
11909,
13,
4706,
1439,
29872,
1953,
353,
7442,
29889,
3298,
359,
3552,
299,
2650,
1953,
29892,
29871,
29945,
876,
13,
4706,
1439,
29872,
1953,
7503,
29892,
29941,
29962,
353,
29871,
29906,
29889,
13,
4706,
1439,
29872,
1953,
7503,
29892,
29946,
29962,
353,
869,
29947,
29947,
13,
4706,
363,
15326,
13140,
297,
3464,
29898,
299,
2650,
1953,
1125,
13,
9651,
4818,
29916,
29892,
1644,
708,
29892,
10696,
29892,
17360,
13140,
29892,
5305,
353,
13149,
2741,
2650,
1953,
29961,
29881,
2650,
428,
13140,
29962,
13,
9651,
5962,
29911,
353,
5962,
29911,
29879,
29961,
5064,
29916,
29892,
1644,
708,
29962,
13,
9651,
17360,
29916,
29892,
23791,
706,
353,
17360,
262,
2997,
7720,
29961,
25367,
13140,
29962,
13,
9651,
17360,
415,
29916,
353,
313,
25367,
29916,
29974,
25367,
2435,
29961,
29900,
29962,
10521,
29945,
448,
1887,
7720,
2435,
29961,
29900,
29962,
458,
29906,
1723,
29930,
25367,
10568,
29961,
29900,
29962,
13,
9651,
17360,
2349,
353,
313,
14588,
706,
29974,
25367,
2435,
29961,
29896,
29962,
10521,
29945,
448,
1887,
7720,
2435,
29961,
29896,
29962,
458,
29906,
1723,
29930,
25367,
10568,
29961,
29896,
29962,
13,
9651,
17360,
3944,
29892,
23791,
943,
262,
353,
17360,
29883,
2209,
1144,
29961,
2521,
29962,
13,
9651,
1887,
29916,
353,
17360,
3944,
29930,
25367,
415,
29916,
448,
23791,
943,
262,
29930,
25367,
2349,
13,
9651,
1887,
29891,
353,
17360,
3944,
29930,
25367,
2349,
718,
23791,
943,
262,
29930,
25367,
415,
29916,
13,
9651,
5534,
415,
353,
7442,
29889,
29880,
979,
29887,
29889,
2929,
345,
29898,
2057,
29911,
29892,
313,
2997,
29916,
29892,
1887,
29891,
29892,
29871,
29900,
1696,
29871,
29896,
29889,
876,
13,
9651,
5534,
2521,
353,
17360,
19536,
29961,
2521,
29962,
17501,
13,
462,
3986,
313,
20845,
29995,
29906,
11877,
9302,
29889,
1631,
718,
313,
20845,
458,
29906,
11877,
9302,
29889,
1631,
29914,
29906,
13,
9651,
1439,
29872,
1953,
29961,
29881,
2650,
428,
13140,
29892,
29901,
29941,
29962,
353,
313,
10945,
415,
29961,
29900,
1402,
5534,
415,
29961,
29896,
1402,
5534,
2521,
29897,
13,
632,
13,
4706,
396,
2189,
302,
1516,
373,
2246,
1439,
29872,
1953,
13,
4706,
451,
19303,
1253,
353,
7442,
29889,
2873,
29898,
299,
2650,
1953,
29892,
26688,
29922,
11227,
29897,
13,
4706,
396,
13628,
2098,
353,
7442,
29889,
5085,
441,
29898,
23705,
1338,
29883,
2361,
29897,
13149,
1338,
29883,
2361,
338,
10372,
10231,
13,
4706,
363,
15326,
333,
29896,
297,
3464,
29898,
299,
2650,
1953,
29899,
29896,
6653,
29896,
6653,
29896,
1125,
13,
9651,
565,
451,
19303,
1253,
29961,
29881,
2650,
428,
333,
29896,
5387,
13,
18884,
921,
29896,
29892,
29891,
29896,
29892,
2521,
29892,
29880,
29896,
29892,
29893,
29896,
353,
1439,
29872,
1953,
29961,
29881,
2650,
428,
333,
29896,
29962,
13,
18884,
274,
29896,
29892,
29879,
29896,
353,
313,
9302,
29889,
3944,
29898,
2521,
511,
7442,
29889,
5223,
29898,
2521,
876,
13,
18884,
363,
15326,
333,
29906,
297,
3464,
29898,
29881,
2650,
428,
333,
29896,
29899,
29896,
6653,
29896,
6653,
29896,
1125,
13,
462,
1678,
565,
451,
19303,
1253,
29961,
29881,
2650,
428,
333,
29906,
5387,
13,
462,
4706,
921,
29906,
29892,
29891,
29906,
29892,
2521,
29892,
29880,
29906,
29892,
29893,
29906,
353,
1439,
29872,
1953,
29961,
29881,
2650,
428,
333,
29906,
29962,
13,
462,
4706,
274,
29906,
29892,
29879,
29906,
353,
313,
9302,
29889,
3944,
29898,
2521,
511,
7442,
29889,
5223,
29898,
2521,
876,
13,
462,
4706,
451,
19303,
1253,
29961,
29881,
2650,
428,
333,
29906,
29962,
353,
451,
7705,
3563,
6984,
29898,
29916,
29896,
29892,
29891,
29896,
29892,
29883,
29896,
29892,
29879,
29896,
29892,
29880,
29896,
29892,
29893,
29896,
29892,
13,
462,
462,
462,
632,
921,
29906,
29892,
29891,
29906,
29892,
29883,
29906,
29892,
29879,
29906,
29892,
29880,
29906,
29892,
29893,
29906,
29892,
869,
29941,
29897,
13,
4706,
1439,
29872,
1953,
353,
1439,
29872,
1953,
29961,
1333,
19303,
1253,
29962,
13,
4706,
13149,
1338,
29883,
2361,
29903,
353,
13149,
1338,
29883,
2361,
29961,
1333,
19303,
1253,
29962,
13,
4706,
13149,
2741,
2650,
1953,
29903,
353,
13149,
2741,
2650,
1953,
29961,
1333,
19303,
1253,
29962,
13,
308,
13,
4706,
396,
1962,
304,
934,
297,
413,
986,
29875,
26654,
3402,
13,
4706,
1439,
29872,
1953,
29946,
4905,
353,
7442,
29889,
3298,
359,
3552,
29881,
2650,
1953,
29889,
12181,
29961,
29900,
1402,
29871,
29947,
876,
13,
4706,
363,
15326,
333,
29896,
297,
3464,
29898,
29881,
2650,
1953,
29889,
12181,
29961,
29900,
29962,
1125,
13,
9651,
921,
29896,
29892,
29891,
29896,
29892,
2521,
29892,
29880,
29896,
29892,
29893,
29896,
353,
1439,
29872,
1953,
29961,
29881,
2650,
428,
333,
29896,
29892,
29901,
29945,
29962,
13,
9651,
1439,
29872,
1953,
29946,
4905,
29961,
29881,
2650,
428,
333,
29896,
29892,
29901,
29945,
29962,
353,
1439,
29872,
1953,
29961,
29881,
2650,
428,
333,
29896,
29892,
29901,
29945,
29962,
13,
9651,
4818,
29916,
29892,
1644,
708,
353,
13149,
2741,
2650,
1953,
29903,
29961,
29881,
2650,
428,
333,
29896,
29892,
584,
29906,
29962,
13,
9651,
5962,
29873,
488,
353,
5962,
29961,
5064,
29916,
29892,
1644,
708,
29962,
13,
9651,
3171,
353,
5962,
29873,
488,
29961,
29941,
29962,
448,
921,
29896,
29930,
2057,
29873,
488,
29961,
29900,
29962,
448,
343,
29896,
29930,
2057,
29873,
488,
29961,
29896,
29962,
13,
9651,
1439,
29872,
1953,
29946,
4905,
29961,
29881,
2650,
428,
333,
29896,
29892,
29945,
17531,
353,
313,
3545,
29892,
29896,
29889,
29955,
29892,
13149,
1338,
29883,
2361,
29903,
29961,
29881,
2650,
428,
333,
29896,
2314,
13,
4706,
1439,
29872,
1953,
29946,
4905,
353,
1439,
29872,
1953,
29946,
4905,
29961,
29881,
2650,
1953,
29946,
4905,
7503,
29892,
29955,
29962,
29958,
29899,
29906,
29900,
29962,
13,
4706,
1962,
710,
353,
3402,
2831,
29968,
986,
29875,
20097,
29898,
29881,
2650,
1953,
29946,
4905,
29892,
1208,
747,
29918,
771,
6929,
29892,
10153,
29889,
12181,
29897,
13,
4706,
565,
1962,
29918,
5325,
338,
451,
6213,
29901,
13,
9651,
1962,
29888,
978,
353,
1962,
29918,
5325,
29889,
4830,
29898,
1445,
29918,
13140,
29897,
13,
9651,
411,
1722,
29898,
4905,
29888,
978,
29892,
525,
29893,
1495,
408,
1962,
1445,
29901,
1962,
1445,
29889,
3539,
29898,
4905,
710,
29897,
13,
308,
13,
308,
13,
4706,
411,
1722,
29898,
4141,
29918,
5325,
29889,
4830,
29898,
1445,
29918,
13140,
511,
525,
29878,
1495,
408,
285,
29881,
29901,
330,
29873,
710,
353,
285,
29881,
29889,
949,
580,
13,
4706,
330,
29873,
303,
3096,
353,
1303,
3338,
618,
2308,
2806,
2283,
29898,
4141,
710,
29892,
6702,
8179,
742,
525,
29963,
273,
8785,
13,
308,
13,
4706,
707,
29879,
689,
300,
2200,
353,
13769,
19435,
689,
300,
2200,
353,
5159,
13,
4706,
363,
1962,
1220,
297,
1962,
710,
29889,
5451,
28909,
29876,
29374,
13,
9651,
565,
1962,
1220,
1360,
29915,
2396,
6773,
13,
9651,
1962,
1220,
353,
1962,
1220,
29889,
5451,
877,
25710,
13,
9651,
330,
29873,
574,
353,
29871,
29946,
29889,
29955,
29896,
29906,
29946,
448,
5785,
29898,
4905,
1220,
29961,
29896,
29946,
2314,
13,
9651,
330,
29873,
574,
353,
330,
29873,
574,
448,
29871,
29953,
29889,
29906,
29947,
29941,
29906,
565,
330,
29873,
574,
1405,
29871,
29941,
29889,
29896,
29946,
29896,
29953,
1683,
330,
29873,
574,
13,
9651,
330,
29873,
1884,
353,
313,
7411,
29898,
4905,
1220,
29961,
29896,
29941,
11724,
448,
7411,
29898,
4905,
1220,
29961,
29896,
29896,
11724,
13,
462,
268,
330,
29873,
574,
29892,
5785,
29898,
4905,
1220,
29961,
29896,
29900,
2314,
29914,
29906,
29892,
5785,
29898,
4905,
1220,
29961,
29929,
2314,
29914,
29906,
29897,
13,
9651,
19435,
689,
300,
2200,
29889,
4397,
29898,
7411,
29898,
4905,
1220,
29961,
29896,
29945,
12622,
13,
9651,
707,
29879,
689,
300,
2200,
29889,
4397,
29898,
4141,
1884,
29897,
13,
4706,
12714,
12810,
29887,
29925,
3757,
29889,
1202,
29898,
9302,
29889,
2378,
29898,
4141,
303,
3096,
29961,
29896,
11724,
7442,
29889,
2378,
29898,
4141,
303,
3096,
29961,
29946,
11724,
7442,
29889,
2378,
29898,
4141,
303,
3096,
29961,
29941,
11724,
13,
462,
3986,
7442,
29889,
2378,
29898,
9197,
689,
300,
2200,
511,
7442,
29889,
2378,
29898,
1557,
2361,
689,
300,
2200,
876,
13,
308,
13,
29937,
4706,
396,
6492,
20398,
322,
7252,
304,
5962,
8760,
16273,
13,
29937,
4706,
6492,
29918,
2492,
353,
2967,
29918,
3027,
29889,
8552,
580,
13,
29937,
4706,
396,
4216,
3454,
304,
1510,
7604,
1891,
760,
310,
2910,
13,
29937,
4706,
6276,
342,
442,
353,
313,
29953,
29941,
29929,
29892,
29871,
29941,
29906,
29900,
29897,
13,
29937,
4706,
1196,
355,
353,
6492,
7422,
29898,
524,
11891,
29929,
29945,
29914,
1493,
29918,
2521,
511,
869,
29929,
29945,
29897,
13,
29937,
4706,
4216,
29916,
29892,
4216,
29891,
353,
4216,
3542,
29898,
1915,
342,
442,
29961,
29900,
1402,
6276,
342,
442,
29961,
29896,
1402,
1196,
355,
29961,
29900,
1402,
1196,
355,
29961,
29896,
2314,
13,
29937,
4706,
1196,
355,
353,
6492,
7422,
29898,
524,
11891,
29929,
29945,
29914,
1493,
29918,
2521,
511,
448,
29889,
29929,
29945,
29897,
13,
29937,
4706,
4216,
29916,
29906,
29892,
4216,
29891,
29906,
353,
4216,
3542,
29898,
1915,
342,
442,
29961,
29900,
1402,
6276,
342,
442,
29961,
29896,
1402,
1196,
355,
29961,
29900,
1402,
1196,
355,
29961,
29896,
2314,
13,
29937,
4706,
6492,
29918,
2492,
29961,
4012,
29916,
29892,
4216,
29891,
29962,
353,
518,
29906,
29946,
29900,
29892,
29906,
29946,
29900,
29892,
29906,
29946,
29900,
29962,
13,
29937,
4706,
6492,
29918,
2492,
29961,
4012,
29916,
29906,
29892,
4216,
29891,
29906,
29962,
353,
518,
29906,
29946,
29900,
29892,
29906,
29946,
29900,
29892,
29906,
29946,
29900,
29962,
13,
29937,
4706,
6492,
29918,
2492,
29906,
353,
6492,
29918,
2492,
29889,
8552,
580,
13,
29937,
4706,
396,
788,
5962,
8760,
16273,
29892,
565,
3625,
29901,
13,
29937,
4706,
363,
330,
29873,
1884,
29892,
330,
1372,
2616,
287,
297,
14319,
29898,
4141,
303,
3096,
29961,
29896,
1402,
330,
29873,
303,
3096,
29961,
29946,
29962,
1125,
13,
29937,
9651,
3800,
353,
7442,
29889,
2378,
29898,
4141,
1884,
29897,
13,
29937,
9651,
3800,
8999,
29900,
29892,
29896,
29892,
29941,
29892,
29946,
5262,
847,
29922,
29871,
29941,
29900,
29889,
13,
29937,
9651,
3800,
7503,
29906,
29962,
353,
6492,
7422,
10456,
1884,
7503,
29906,
2314,
13,
29937,
9651,
3800,
29961,
29941,
17531,
334,
29922,
29871,
29941,
29906,
29900,
13,
29937,
9651,
565,
330,
1372,
2616,
287,
29901,
13,
29937,
18884,
6492,
7364,
2521,
29898,
5317,
29918,
2492,
29906,
29892,
3800,
29892,
518,
29900,
29892,
29900,
29892,
29906,
29896,
29900,
2314,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
6492,
7364,
2521,
29898,
5317,
29918,
2492,
29906,
29892,
3800,
29892,
518,
29941,
29900,
29892,
29871,
29947,
29900,
29892,
29871,
29906,
29945,
29945,
2314,
13,
29937,
308,
13,
29937,
4706,
396,
6492,
17343,
279,
3291,
1400,
5962,
28744,
13,
29937,
4706,
282,
1372,
353,
7442,
29889,
3298,
359,
29898,
1272,
29889,
12181,
29892,
26688,
29922,
9302,
29889,
7411,
29953,
29946,
29897,
13,
29937,
4706,
25900,
333,
10351,
353,
7442,
29889,
3298,
359,
29898,
629,
299,
2435,
29961,
29900,
14178,
629,
299,
2435,
29961,
29896,
10062,
29896,
29892,
26688,
29922,
9302,
29889,
524,
29953,
29946,
29897,
13,
29937,
4706,
25900,
20325,
29898,
1272,
29892,
282,
1372,
29892,
25900,
333,
10351,
29892,
5962,
29911,
29879,
29897,
13,
29937,
4706,
3171,
29879,
353,
7442,
29889,
3298,
359,
29898,
16485,
29889,
12181,
29961,
29900,
2314,
13,
29937,
4706,
363,
867,
299,
29916,
13140,
29892,
867,
299,
29891,
13140,
297,
7442,
29889,
299,
2248,
10456,
629,
299,
2435,
1125,
13,
29937,
9651,
282,
1372,
524,
309,
342,
442,
353,
25900,
333,
10351,
29961,
629,
299,
29916,
13140,
29930,
629,
299,
2435,
29961,
29896,
10062,
629,
299,
29891,
13140,
29962,
13,
29937,
9651,
282,
1372,
524,
488,
355,
353,
25900,
333,
10351,
29961,
629,
299,
29916,
13140,
29930,
629,
299,
2435,
29961,
29896,
10062,
629,
299,
29891,
13140,
29974,
29896,
29962,
13,
29937,
9651,
5962,
29873,
488,
353,
5962,
29961,
629,
299,
29916,
13140,
29892,
867,
299,
29891,
13140,
29962,
13,
29937,
9651,
282,
1372,
524,
488,
353,
282,
1372,
29961,
16485,
524,
309,
342,
442,
29901,
16485,
524,
488,
355,
29962,
13,
29937,
9651,
3171,
29879,
29961,
16485,
524,
309,
342,
442,
29901,
16485,
524,
488,
355,
29962,
353,
282,
1372,
524,
488,
29889,
6333,
29898,
2057,
29873,
488,
7503,
29941,
2314,
29899,
2057,
29873,
488,
29961,
29941,
29962,
13,
29937,
4706,
6492,
9748,
29918,
29916,
353,
282,
1372,
29961,
3545,
29879,
15513,
29906,
29892,
29900,
29962,
847,
29871,
29941,
29900,
29889,
13,
29937,
4706,
6492,
9748,
29918,
29891,
353,
282,
1372,
29961,
3545,
29879,
15513,
29906,
29892,
29896,
29962,
847,
29871,
29941,
29900,
29889,
13,
29937,
4706,
3160,
29918,
1557,
2620,
353,
5135,
5317,
9748,
29918,
29916,
1405,
869,
29900,
29896,
29897,
669,
313,
5317,
9748,
29918,
29916,
529,
29871,
29896,
29889,
29929,
29929,
29897,
669,
13,
29937,
462,
965,
313,
5317,
9748,
29918,
29891,
1405,
448,
29889,
29929,
29929,
29897,
669,
313,
5317,
9748,
29918,
29891,
529,
869,
29929,
29929,
876,
13,
29937,
4706,
6492,
9748,
29918,
29916,
29892,
6492,
9748,
29918,
29891,
353,
6492,
7422,
29898,
5317,
9748,
29918,
29916,
29961,
2856,
29918,
1557,
2620,
1402,
13,
29937,
462,
462,
462,
259,
6492,
9748,
29918,
29891,
29961,
2856,
29918,
1557,
2620,
2314,
13,
29937,
4706,
6492,
9748,
29918,
29916,
353,
6492,
9748,
29918,
29916,
29889,
579,
668,
29898,
524,
29897,
13,
29937,
4706,
6492,
9748,
29918,
29891,
353,
6492,
9748,
29918,
29891,
29889,
579,
668,
29898,
524,
29897,
13,
29937,
4706,
6492,
20325,
29898,
5317,
29918,
2492,
29892,
29871,
6492,
9748,
29918,
29916,
29892,
6492,
9748,
29918,
29891,
29892,
5135,
29900,
29892,
29900,
511,
511,
313,
29900,
1696,
29900,
1696,
29900,
29889,
876,
13,
29937,
4706,
6492,
20325,
29898,
5317,
29918,
2492,
29906,
29892,
6492,
9748,
29918,
29916,
29892,
6492,
9748,
29918,
29891,
29892,
5135,
29900,
29892,
29900,
511,
511,
313,
29900,
1696,
29900,
1696,
29900,
29889,
876,
13,
29937,
462,
13,
29937,
4706,
363,
15326,
29892,
8158,
297,
14319,
29898,
29881,
2650,
1953,
29892,
13149,
1338,
29883,
2361,
29903,
1125,
13,
29937,
9651,
3800,
353,
15326,
29889,
8552,
580,
13,
29937,
9651,
3800,
8999,
29900,
29892,
29896,
29892,
29941,
29892,
29946,
5262,
847,
29922,
29871,
29941,
29900,
29889,
13,
29937,
9651,
3800,
7503,
29906,
29962,
353,
6492,
7422,
10456,
1884,
7503,
29906,
2314,
13,
29937,
9651,
3800,
29961,
29941,
17531,
334,
29922,
29871,
29941,
29906,
29900,
13,
29937,
9651,
565,
8158,
529,
448,
29906,
29900,
29901,
6773,
13,
29937,
9651,
8158,
353,
29871,
29896,
6904,
29898,
29896,
29974,
9302,
29889,
4548,
6278,
13628,
876,
13,
29937,
9651,
2927,
29890,
353,
938,
29898,
29906,
29900,
29900,
718,
29871,
29945,
29945,
29930,
13628,
1068,
29889,
29945,
29897,
13,
29937,
9651,
784,
990,
353,
29871,
29906,
29945,
29945,
448,
938,
29898,
29945,
29945,
29930,
13628,
1068,
29889,
29945,
29897,
13,
29937,
9651,
6492,
7364,
2521,
29898,
5317,
29918,
2492,
29892,
3800,
29892,
313,
2780,
29890,
29892,
784,
990,
29892,
29871,
29900,
876,
13,
29937,
632,
13,
29937,
4706,
321,
3905,
29872,
353,
6492,
29918,
2492,
29889,
579,
668,
29898,
524,
7240,
5317,
29918,
2492,
29906,
29889,
579,
668,
29898,
524,
29897,
13,
29937,
4706,
321,
3905,
29872,
4619,
7442,
29889,
27525,
398,
29898,
5317,
29918,
2492,
29892,
6492,
29918,
2492,
29906,
29897,
448,
7442,
29889,
3317,
29898,
3905,
3905,
29892,
9685,
29922,
29906,
29897,
7503,
29892,
29901,
29892,
8516,
29962,
13,
29937,
4706,
321,
3905,
29872,
353,
7442,
29889,
27525,
398,
29898,
3905,
3905,
29892,
29871,
29900,
29897,
13,
29937,
4706,
6492,
29918,
2492,
353,
321,
3905,
29872,
29889,
579,
668,
29898,
9302,
29889,
13470,
29947,
29897,
13,
29937,
4706,
396,
1925,
278,
6492,
373,
2246,
310,
278,
10656,
1967,
304,
1776,
29892,
2479,
363,
29871,
29941,
6923,
539,
13,
29937,
4706,
2479,
29918,
2492,
353,
7442,
29889,
3298,
359,
3552,
5317,
29918,
2492,
29889,
12181,
29961,
29900,
10062,
2492,
29889,
12181,
29961,
29900,
1402,
10153,
29889,
12181,
29961,
29896,
1402,
29871,
29941,
511,
13,
29937,
462,
1669,
26688,
29922,
9302,
29889,
13470,
29947,
29897,
13,
29937,
4706,
2479,
29918,
2492,
7503,
5317,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
313,
2492,
29889,
12181,
29961,
29896,
29962,
29899,
5317,
29918,
2492,
29889,
12181,
29961,
29896,
2314,
458,
29906,
29901,
13,
29937,
462,
1678,
313,
2492,
29889,
12181,
29961,
29896,
10062,
5317,
29918,
2492,
29889,
12181,
29961,
29896,
2314,
458,
29906,
29962,
353,
6492,
29918,
2492,
13,
29937,
4706,
2479,
29918,
2492,
29961,
5317,
29918,
2492,
29889,
12181,
29961,
29900,
5387,
29962,
353,
10153,
13,
29937,
4706,
527,
4294,
877,
29874,
742,
2479,
29918,
2492,
416,
13,
29937,
4706,
3855,
1989,
353,
4480,
2558,
29898,
29896,
29900,
29900,
29897,
13,
29937,
4706,
565,
3855,
1989,
1275,
4356,
877,
29939,
29374,
2867,
13,
29937,
1678,
8174,
5907,
877,
29874,
1495,
13,
1678,
1596,
703,
27711,
931,
12365,
29889,
29906,
29888,
29913,
1642,
4830,
29898,
11965,
293,
698,
603,
14571,
2435,
29898,
5325,
29906,
1509,
6817,
29896,
4961,
13,
1678,
1596,
703,
485,
29887,
16716,
313,
1333,
413,
986,
29875,
29915,
29879,
29897,
12365,
29889,
29941,
29888,
1118,
25641,
29889,
29941,
29888,
1118,
25641,
29889,
29941,
29888,
29913,
1642,
4830,
29898,
13,
462,
462,
462,
1678,
334,
16414,
12810,
29887,
29925,
3757,
29889,
28667,
580,
7503,
29941,
12622,
2
] |
protobuf/__main__.py | Axonny/Protobuf | 0 | 195606 | from protobuf.generate_class import main
main()
| [
1,
515,
17814,
9721,
29889,
17158,
29918,
1990,
1053,
1667,
13,
13,
3396,
580,
13,
2
] |
test/test_tokenizer.py | ArielTriana/battle-sim | 2 | 177014 | import pytest
from src.language.tokenizer import Tokenizer
def test_1():
case1 = "number a = 3.34"
tokens = Tokenizer()(case1)
assert len(tokens) == 5
assert tokens[3].lexeme == "3.34"
def test_2():
case2 = "function number fibo(number n) -> {\nif n lte 1 -> {\n return 1 \n} return fibo(n- 1) + fibo(n - 2)}"
tokens = Tokenizer()(case2)
assert len(tokens) == 34
| [
1,
1053,
11451,
1688,
13,
13,
3166,
4765,
29889,
11675,
29889,
6979,
3950,
1053,
25159,
3950,
13,
13,
13,
1753,
1243,
29918,
29896,
7295,
13,
1678,
1206,
29896,
353,
376,
4537,
263,
353,
29871,
29941,
29889,
29941,
29946,
29908,
13,
13,
1678,
18897,
353,
25159,
3950,
580,
29898,
4878,
29896,
29897,
13,
13,
1678,
4974,
7431,
29898,
517,
12360,
29897,
1275,
29871,
29945,
13,
13,
1678,
4974,
18897,
29961,
29941,
1822,
2506,
2004,
1275,
376,
29941,
29889,
29941,
29946,
29908,
13,
13,
1753,
1243,
29918,
29906,
7295,
13,
1678,
1206,
29906,
353,
376,
2220,
1353,
18755,
29877,
29898,
4537,
302,
29897,
1599,
2802,
29876,
361,
302,
301,
371,
29871,
29896,
1599,
2802,
29876,
736,
29871,
29896,
320,
29876,
29913,
736,
18755,
29877,
29898,
29876,
29899,
29871,
29896,
29897,
718,
18755,
29877,
29898,
29876,
448,
29871,
29906,
2915,
29908,
13,
268,
13,
1678,
18897,
353,
25159,
3950,
580,
29898,
4878,
29906,
29897,
13,
268,
13,
1678,
4974,
7431,
29898,
517,
12360,
29897,
1275,
29871,
29941,
29946,
13,
13,
2
] |
src/utils/modelling.py | juanhuguetgarcia/ml_project_template | 0 | 61301 | <reponame>juanhuguetgarcia/ml_project_template
"""Modelling
Utils to use during modelling stage
"""
import pickle
from datetime import datetime
from pathlib import Path
PROJECT_DIR = Path(__file__).resolve().parents[2]
class ArtifactSaverLoader(object):
def __init__(self, models_filepath=PROJECT_DIR.joinpath('models')):
self.models_filepath = models_filepath
def save_artifact(self, artifact, artifact_name=None):
"""Persists artifact as a pickle
"""
today = datetime.today()
today_str = datetime.strftime(today, '%Y-%m-%dT%H-%M-%SZ')
artifact_unique_name = f'{artifact_name}-{today_str}.p' if artifact_name else f'artifact-{today_str}.p'
artifact_filepath = self.models_filepath.joinpath(artifact_unique_name)
pickle.dump(artifact, open(artifact_filepath, 'wb'))
return artifact_filepath.is_file()
def load_artifact(self, artifact_name):
artifact_filepath = self.models_filepath.joinpath(artifact_name)
if artifact_filepath.is_file():
model = pickle.load(open(artifact_filepath, 'rb'))
else:
raise FileNotFoundError('Artifact does not exist')
return model
| [
1,
529,
276,
1112,
420,
29958,
4900,
27731,
688,
14484,
5397,
1512,
29914,
828,
29918,
4836,
29918,
6886,
13,
15945,
29908,
2111,
7807,
13,
13,
12177,
304,
671,
2645,
878,
7807,
7408,
13,
15945,
29908,
13,
13,
5215,
5839,
280,
13,
3166,
12865,
1053,
12865,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
8618,
17637,
29918,
9464,
353,
10802,
22168,
1445,
1649,
467,
17863,
2141,
862,
1237,
29961,
29906,
29962,
13,
13,
13,
1990,
3012,
7060,
29903,
12483,
10036,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4733,
29918,
1445,
2084,
29922,
8618,
17637,
29918,
9464,
29889,
7122,
2084,
877,
9794,
8785,
29901,
13,
4706,
1583,
29889,
9794,
29918,
1445,
2084,
353,
4733,
29918,
1445,
2084,
13,
13,
1678,
822,
4078,
29918,
8813,
29898,
1311,
29892,
24238,
29892,
24238,
29918,
978,
29922,
8516,
1125,
13,
4706,
9995,
15136,
2879,
24238,
408,
263,
5839,
280,
13,
4706,
9995,
13,
4706,
9826,
353,
12865,
29889,
27765,
580,
13,
4706,
9826,
29918,
710,
353,
12865,
29889,
710,
615,
603,
29898,
27765,
29892,
14210,
29979,
19222,
29885,
19222,
29881,
29911,
29995,
29950,
19222,
29924,
19222,
29903,
29999,
1495,
13,
4706,
24238,
29918,
13092,
29918,
978,
353,
285,
29915,
29912,
8813,
29918,
978,
7402,
29912,
27765,
29918,
710,
1836,
29886,
29915,
565,
24238,
29918,
978,
1683,
285,
29915,
8813,
29899,
29912,
27765,
29918,
710,
1836,
29886,
29915,
13,
13,
4706,
24238,
29918,
1445,
2084,
353,
1583,
29889,
9794,
29918,
1445,
2084,
29889,
7122,
2084,
29898,
8813,
29918,
13092,
29918,
978,
29897,
13,
4706,
5839,
280,
29889,
15070,
29898,
8813,
29892,
1722,
29898,
8813,
29918,
1445,
2084,
29892,
525,
29893,
29890,
8785,
13,
4706,
736,
24238,
29918,
1445,
2084,
29889,
275,
29918,
1445,
580,
13,
13,
1678,
822,
2254,
29918,
8813,
29898,
1311,
29892,
24238,
29918,
978,
1125,
13,
4706,
24238,
29918,
1445,
2084,
353,
1583,
29889,
9794,
29918,
1445,
2084,
29889,
7122,
2084,
29898,
8813,
29918,
978,
29897,
13,
4706,
565,
24238,
29918,
1445,
2084,
29889,
275,
29918,
1445,
7295,
13,
9651,
1904,
353,
5839,
280,
29889,
1359,
29898,
3150,
29898,
8813,
29918,
1445,
2084,
29892,
525,
6050,
8785,
13,
4706,
1683,
29901,
13,
9651,
12020,
3497,
17413,
2392,
877,
9986,
7060,
947,
451,
1863,
1495,
13,
4706,
736,
1904,
13,
2
] |
src/losses/__init__.py | johanattia/tensorflow-saint | 3 | 70926 | <gh_stars>1-10
from .barlow_twins import BarlowTwins
from .simclr import SimCLR
from .vicreg import VICReg
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
869,
1646,
677,
29918,
7516,
1144,
1053,
2261,
677,
27418,
1144,
13,
3166,
869,
3601,
695,
29878,
1053,
3439,
6154,
29934,
13,
3166,
869,
26311,
1727,
1053,
478,
2965,
4597,
13,
2
] |
brainframe_qt/ui/resources/alarms/alarm_bundle/alarm_card/alert_log/__init__.py | aotuai/brainframe-qt | 17 | 110878 | <reponame>aotuai/brainframe-qt
from .alert_log import AlertLog
| [
1,
529,
276,
1112,
420,
29958,
29874,
327,
29884,
1794,
29914,
2634,
262,
2557,
29899,
17915,
13,
3166,
869,
12888,
29918,
1188,
1053,
28861,
3403,
13,
2
] |
conftest.py | detrack/elasticroute-python | 2 | 1617658 | from dotenv import load_dotenv
from pathlib import Path # python3 only
import elasticroute
import os
"""
env_path = Path('tests') / '.env'
load_dotenv(dotenv_path=env_path)
elasticroute.defaults.API_KEY = os.getenv("ELASTICROUTE_API_KEY")
elasticroute.defaults.BASE_URL = os.getenv("ELASTICROUTE_PATH")
print("Default API Key registered as: {}".format(elasticroute.defaults.API_KEY))
print("BASE URL registered as: {}".format(elasticroute.defaults.BASE_URL))
"""
| [
1,
515,
8329,
6272,
1053,
2254,
29918,
6333,
6272,
13,
3166,
2224,
1982,
1053,
10802,
29871,
396,
3017,
29941,
871,
13,
5215,
560,
6288,
13134,
13,
5215,
2897,
13,
13,
15945,
29908,
13,
6272,
29918,
2084,
353,
10802,
877,
21150,
1495,
847,
15300,
6272,
29915,
13,
1359,
29918,
6333,
6272,
29898,
6333,
6272,
29918,
2084,
29922,
6272,
29918,
2084,
29897,
13,
13,
295,
6288,
13134,
29889,
4381,
29879,
29889,
8787,
29918,
10818,
353,
2897,
29889,
657,
6272,
703,
29923,
4375,
1254,
2965,
1672,
26027,
29918,
8787,
29918,
10818,
1159,
13,
295,
6288,
13134,
29889,
4381,
29879,
29889,
25416,
29918,
4219,
353,
2897,
29889,
657,
6272,
703,
29923,
4375,
1254,
2965,
1672,
26027,
29918,
10145,
1159,
13,
13,
2158,
703,
4592,
3450,
7670,
15443,
408,
29901,
6571,
1642,
4830,
29898,
295,
6288,
13134,
29889,
4381,
29879,
29889,
8787,
29918,
10818,
876,
13,
2158,
703,
25416,
3988,
15443,
408,
29901,
6571,
1642,
4830,
29898,
295,
6288,
13134,
29889,
4381,
29879,
29889,
25416,
29918,
4219,
876,
13,
15945,
29908,
13,
2
] |
eleanor/visualize.py | afeinstein20/ELLIE | 6 | 72097 | <reponame>afeinstein20/ELLIE<filename>eleanor/visualize.py
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
import warnings, os, requests
import lightkurve as lk
from bs4 import BeautifulSoup
from pylab import *
from astropy.timeseries import LombScargle
from astropy.wcs import WCS
import astropy.units as u
from astropy.coordinates import SkyCoord, Angle
from .ffi import use_pointing_model, load_pointing_model
from .mast import *
__all__ = []
class Visualize(object):
"""
The main class for creating figures, movies, and interactive plots.
Allows the user to have a grand ole time playing with their data!
Parameters
----------
obj :
Object must have minimum attributes of 2D array of flux.
Will allow for plotting of both postcards & tpfs.
obj_type :
Object type can be set to "tpf" or "postcard". Default is "tpf".
"""
def __init__(self, object, obj_type="tpf"):
self.obj = object
self.obj_type = obj_type.lower()
if self.obj_type == "tpf":
self.flux = self.obj.tpf
self.center = (np.nanmedian(self.obj.centroid_xs),
np.nanmedian(self.obj.centroid_ys))
self.dimensions = self.obj.tpf[0].shape
else:
self.flux = self.obj.flux
self.center = self.obj.center_xy
self.dimensions = self.obj.dimensions
def aperture_contour(self, aperture=None, ap_color='w', ap_linewidth=4, ax=None, **kwargs):
"""
Overplots the countour of an aperture on a target pixel file.
Contribution from <NAME>.
Parameters
----------
aperture : np.2darray, optional
A 2D mask the same size as the target pixel file. Default
is the eleanor default aperture.
ap_color : str, optional
The color of the aperture contour. Takes a matplotlib color.
Default is red.
ap_linewidth : int, optional
The linewidth of the aperture contour. Default is 4.
ax : matplotlib.axes._subplots.AxesSubplot, optional
Axes to plot on.
"""
if ax == None:
fig, ax = plt.subplots(nrows=1)
if aperture is None:
aperture = self.obj.aperture
ax.imshow(self.obj.tpf[0], origin='lower', **kwargs)
f = lambda x,y: aperture[int(y),int(x) ]
g = np.vectorize(f)
x = np.linspace(0,aperture.shape[1], aperture.shape[1]*100)
y = np.linspace(0,aperture.shape[0], aperture.shape[0]*100)
X, Y= np.meshgrid(x[:-1],y[:-1])
Z = g(X[:-1],Y[:-1])
ax.contour(Z, [0.05], colors=ap_color, linewidths=[ap_linewidth],
extent=[0-0.5, x[:-1].max()-0.5,0-0.5, y[:-1].max()-0.5])
if ax == None:
return fig
def pixel_by_pixel(self, colrange=None, rowrange=None, cmap='viridis',
data_type="corrected", mask=None, xlim=None,
ylim=None, color_by_pixel=False, color_by_aperture=True,
freq_range=[1/20., 1/0.1], FAP=None, aperture=None, ap_color='r',
ap_linewidth=2):
"""
Creates a pixel-by-pixel light curve using the corrected flux.
Contribution from Oliver Hall.
Parameters
----------
colrange : np.array, optional
A list of start column and end column you're interested in
zooming in on.
rowrange : np.array, optional
A list of start row and end row you're interested in zooming
in on.
cmap : str, optional
Name of a matplotlib colormap. Default is 'viridis'.
data_type : str, optional
The type of flux used. Either: 'raw', 'corrected', 'amplitude',
or 'periodogram'. If not, default set to 'corrected'.
mask : np.array, optional
Specifies the cadences used in the light curve. If not, default
set to good quality cadences.
xlim : np.array, optional
Specifies the xlim on the subplots. If not, default is set to
the entire light curve.
ylim : np.array, optional
Specifies the ylim on the subplots, If not, default is set to
the entire light curve flux range.
color_by_pixel : bool, optional
Colors the light curve given the color of the pixel. If not,
default is set to False.
freq_range : list, optional
List of minimum and maximum frequency to search in Lomb Scargle
periodogram. Only used if data_type = 'periodogram'. If None,
default = [1/20., 1/0.1].
FAP: np.array, optional.
False Alarm Probability levels to include in periodogram.
Ensure that the values are < 1.
For example: FAP = np.array([0.1, 0.01]), will plot the 10% and 1% FAP levels.
"""
if self.obj.lite:
print('This is an eleanor-lite object. No pixel_by_pixel visualization can be created.')
print('Please create a regular eleanor.TargetData object (lite=False) to use this tool.')
return
if colrange is None:
colrange = [0, self.dimensions[1]]
if rowrange is None:
rowrange = [0, self.dimensions[0]]
nrows = int(np.round(colrange[1]-colrange[0]))
ncols = int(np.round(rowrange[1]-rowrange[0]))
if (colrange[1] > self.dimensions[1]) or (rowrange[1] > self.dimensions[0]):
raise ValueError("Asking for more pixels than available in the TPF.")
figure = plt.figure(figsize=(20,8))
outer = gridspec.GridSpec(1,2, width_ratios=[1,4])
inner = gridspec.GridSpecFromSubplotSpec(ncols, nrows, hspace=0.1, wspace=0.1,
subplot_spec=outer[1])
i, j = rowrange[0], colrange[0]
if mask is None:
q = self.obj.quality == 0
else:
q = mask == 0
## PLOTS TARGET PIXEL FILE ##
ax = plt.subplot(outer[0])
if aperture is None:
aperture = self.obj.aperture
plotflux = np.nanmedian(self.flux[:, rowrange[0]:rowrange[1],
colrange[0]:colrange[1]], axis=0)
c = ax.imshow(plotflux, origin='lower',
vmax=np.percentile(plotflux, 95),
cmap=cmap)
divider = make_axes_locatable(ax)
cax = divider.append_axes('right', size='5%', pad=0.15)
plt.colorbar(c, cax=cax, orientation='vertical')
f = lambda x,y: aperture[int(y),int(x) ]
g = np.vectorize(f)
x = np.linspace(colrange[0],colrange[1], nrows*100)
y = np.linspace(rowrange[0],rowrange[1], ncols*100)
X, Y= np.meshgrid(x[:-1],y[:-1])
Z = g(X[:-1],Y[:-1])
ax.contour(Z, [0.05],
colors=ap_color, linewidths=[ap_linewidth],
extent=[0-0.5, nrows-0.5,0-0.5, ncols-0.5])
## PLOTS PIXEL LIGHT CURVES ##
for ind in range( int(nrows * ncols) ):
if ind == 0:
ax = plt.Subplot(figure, inner[ind])
origax = ax
else:
ax = plt.Subplot(figure, inner[ind], sharex=origax)
flux = self.flux[:,i,j]
time = self.obj.time
corr_flux = self.obj.corrected_flux(flux=flux)
if data_type.lower() == 'corrected':
y = corr_flux[q]/np.nanmedian(corr_flux[q])
x = time[q]
elif data_type.lower() == 'amplitude':
lc = lk.LightCurve(time=time, flux=corr_flux)
pg = lc.normalize().to_periodogram()
x = pg.frequency.value
y = pg.power.value
elif data_type.lower() == 'raw':
y = flux[q]/np.nanmedian(flux[q])
x = time[q]
elif data_type.lower() == 'periodogram':
LS = LombScargle(time, corr_flux)
freq, power = LS.autopower(minimum_frequency=freq_range[0],
maximum_frequency=freq_range[1],
method='fast')
y = power
x = 1/freq
if (FAP is not None):
if np.all(FAP<1): # Ensure that the probabilities are all < 1
if type(FAP) == list: FAP = np.array(FAP)
FAPlevel = LS.false_alarm_level(FAP, method='baluev')
if color_by_pixel is False:
color = 'k'
else:
rgb = c.cmap(c.norm(self.flux[100,i,j]))
color = matplotlib.colors.rgb2hex(rgb)
ax.plot(x, y, c=color)
if (data_type.lower() == 'periodogram') & (FAP is not None):
if np.all(FAP<1):
_ = [ax.axhline(f, color='k', ls='--', alpha=0.3) for f in FAPlevel]
if color_by_aperture and aperture[i,j] > 0:
for iax in ['top', 'bottom', 'left', 'right']:
ax.spines[iax].set_color(ap_color)
ax.spines[iax].set_linewidth(ap_linewidth)
j += 1
if j == colrange[1]:
i += 1
j = colrange[0]
if ylim is None:
ax.set_ylim(np.percentile(y, 1), np.percentile(y, 99))
else:
ax.set_ylim(ylim[0], ylim[1])
if xlim is None:
ax.set_xlim(np.min(x)-0.1, np.max(x)+0.1)
else:
ax.set_xlim(xlim[0], xlim[1])
if data_type.lower() == 'amplitude':
ax.set_yscale('log')
ax.set_xscale('log')
ax.set_ylim(y.min(), y.max())
ax.set_xlim(np.min(x),
np.max(x))
ax.set_xticks([])
ax.set_yticks([])
figure.add_subplot(ax)
return figure
def tess_the_movie(self):
"""
Opens the link to <NAME>'s TESS: The Movie YouTube videos for
the sector your target is observed in.
Parameters
----------
Attributes
----------
movie_url : str
"""
def type_of_script():
try:
ipy_str = str(type(get_ipython()))
if 'zmqshell' in ipy_str:
return 'jupyter'
if 'terminal' in ipy_str:
return 'ipython'
except:
return 'terminal'
sector = self.obj.source_info.sector
base="https://www.youtube.com/results?search_query="
query="TESS+the+movie+sector+{0}+ethankruse".format(sector)
soup = BeautifulSoup(requests.get(base+query).text, "html.parser").find_all('script')[26]
items = soup.text
items = items.split('\n')[1].split('title')
good_sector=0
for subitem in items:
j = subitem.find('Sector')
if j > 0 and 'TESS: The Movie' in subitem:
sect = subitem[j:j+100].split(',')[0].split(' ')[-1]
if int(sect) == int(sector):
i = subitem.find('/watch?v')
ext = subitem[i:i+100].split('"')[0]
good_sector=1
break
if good_sector == 1:
self.movie_url = 'https://www.youtube.com{0}'.format(ext)
call_location = type_of_script()
if (call_location == 'terminal') or (call_location == 'ipython'):
os.system('python -m webbrowser -t "{0}"'.format(self.movie_url))
elif (call_location == 'jupyter'):
from IPython.display import YouTubeVideo
id = self.movie_url.split('=')[-1]
return YouTubeVideo(id=id, width=900, height=500)
else:
print('No movie is available yet.')
return
def plot_gaia_overlay(self, tic=None, tpf=None, magnitude_limit=18):
"""Check if the source is contaminated."""
if tic is None:
tic = self.obj.source_info.tic
if tpf is None:
tpf = lk.search_tesscut(f'TIC {tic}')[0].download(cutout_size=(self.obj.tpf.shape[1],
self.obj.tpf.shape[2]))
fig = tpf.plot(show_colorbar=False, title='TIC {0}'.format(tic))
fig = self._add_gaia_figure_elements(tpf, fig, magnitude_limit=magnitude_limit)
return fig
def _add_gaia_figure_elements(self, tpf, fig, magnitude_limit=18):
"""Make the Gaia Figure Elements"""
# Get the positions of the Gaia sources
c1 = SkyCoord(tpf.ra, tpf.dec, frame='icrs', unit='deg')
# Use pixel scale for query size
pix_scale = 21.0
# We are querying with a diameter as the radius, overfilling by 2x.
from astroquery.vizier import Vizier
Vizier.ROW_LIMIT = -1
result = Vizier.query_region(c1, catalog=["I/345/gaia2"],
radius=Angle(np.max(tpf.shape[1:]) * pix_scale, "arcsec"))
no_targets_found_message = ValueError('Either no sources were found in the query region '
'or Vizier is unavailable')
too_few_found_message = ValueError('No sources found brighter than {:0.1f}'.format(magnitude_limit))
if result is None:
raise no_targets_found_message
elif len(result) == 0:
raise too_few_found_message
result = result["I/345/gaia2"].to_pandas()
result = result[result.Gmag < magnitude_limit]
if len(result) == 0:
raise no_targets_found_message
radecs = np.vstack([result['RA_ICRS'], result['DE_ICRS']]).T
coords = tpf.wcs.all_world2pix(radecs, 0)
try:
year = ((tpf.time[0].jd - 2457206.375) * u.day).to(u.year)
except:
year = ((tpf.astropy_time[0].jd - 2457206.375) * u.day).to(u.year)
pmra = ((np.nan_to_num(np.asarray(result.pmRA)) * u.milliarcsecond/u.year) * year).to(u.arcsec).value
pmdec = ((np.nan_to_num(np.asarray(result.pmDE)) * u.milliarcsecond/u.year) * year).to(u.arcsec).value
result.RA_ICRS += pmra
result.DE_ICRS += pmdec
# Gently size the points by their Gaia magnitude
sizes = 10000.0 / 2**(result['Gmag']/2)
target = tpf.wcs.world_to_pixel(c1)
plt.scatter(target[0]+tpf.column, target[1]+tpf.row, s=50, zorder=1000, c='k', marker='x')
plt.scatter(coords[:, 0]+tpf.column, coords[:, 1]+tpf.row, c='firebrick', alpha=0.5, edgecolors='r', s=sizes)
plt.scatter(coords[:, 0]+tpf.column, coords[:, 1]+tpf.row, c='None', edgecolors='r', s=sizes)
plt.xlim([tpf.column-0.5, tpf.column+tpf.shape[1]-0.5])
plt.ylim([tpf.row-0.5, tpf.row+tpf.shape[2]-0.5])
return fig
| [
1,
529,
276,
1112,
420,
29958,
29874,
1725,
262,
5465,
29906,
29900,
29914,
29923,
2208,
8673,
29966,
9507,
29958,
6146,
273,
272,
29914,
20119,
675,
29889,
2272,
13,
5215,
10876,
13,
5215,
22889,
408,
286,
572,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
22889,
29889,
629,
4841,
3135,
408,
867,
4841,
3135,
13,
3166,
286,
572,
29918,
10154,
29895,
1169,
29889,
1165,
267,
29918,
7720,
29896,
1053,
1207,
29918,
1165,
267,
29918,
2029,
17219,
13,
5215,
12655,
408,
7442,
13,
5215,
18116,
29892,
2897,
29892,
7274,
13,
5215,
3578,
23843,
345,
408,
301,
29895,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
13,
3166,
282,
2904,
370,
1053,
334,
13,
3166,
8717,
14441,
29889,
3706,
6358,
1053,
24869,
4421,
1191,
280,
13,
3166,
8717,
14441,
29889,
29893,
2395,
1053,
399,
9295,
13,
5215,
8717,
14441,
29889,
348,
1169,
408,
318,
13,
3166,
8717,
14441,
29889,
1111,
24266,
1053,
16572,
7967,
536,
29892,
3218,
280,
13,
13,
3166,
869,
600,
29875,
1053,
671,
29918,
3149,
292,
29918,
4299,
29892,
2254,
29918,
3149,
292,
29918,
4299,
13,
3166,
869,
29885,
579,
1053,
334,
13,
13,
1649,
497,
1649,
353,
5159,
13,
13,
13,
1990,
9249,
675,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
450,
1667,
770,
363,
4969,
13994,
29892,
2351,
583,
29892,
322,
28923,
24580,
29889,
13,
1678,
2178,
1242,
278,
1404,
304,
505,
263,
4595,
288,
280,
931,
8743,
411,
1009,
848,
29991,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
5446,
584,
13,
4706,
4669,
1818,
505,
9212,
8393,
310,
29871,
29906,
29928,
1409,
310,
19389,
29889,
13,
4706,
2811,
2758,
363,
6492,
1259,
310,
1716,
1400,
28160,
669,
260,
29886,
5847,
29889,
13,
1678,
5446,
29918,
1853,
584,
13,
4706,
4669,
1134,
508,
367,
731,
304,
376,
29873,
7810,
29908,
470,
376,
2490,
7543,
1642,
13109,
338,
376,
29873,
7810,
1642,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1203,
29892,
5446,
29918,
1853,
543,
29873,
7810,
29908,
1125,
13,
4706,
1583,
29889,
5415,
418,
353,
1203,
13,
4706,
1583,
29889,
5415,
29918,
1853,
353,
5446,
29918,
1853,
29889,
13609,
580,
13,
13,
4706,
565,
1583,
29889,
5415,
29918,
1853,
1275,
376,
29873,
7810,
1115,
13,
9651,
1583,
29889,
1579,
1314,
259,
353,
1583,
29889,
5415,
29889,
29873,
7810,
13,
9651,
1583,
29889,
5064,
353,
313,
9302,
29889,
13707,
2168,
713,
29898,
1311,
29889,
5415,
29889,
1760,
1007,
29918,
10351,
511,
13,
462,
632,
7442,
29889,
13707,
2168,
713,
29898,
1311,
29889,
5415,
29889,
1760,
1007,
29918,
952,
876,
13,
9651,
1583,
29889,
6229,
5580,
353,
1583,
29889,
5415,
29889,
29873,
7810,
29961,
29900,
1822,
12181,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1579,
1314,
259,
353,
1583,
29889,
5415,
29889,
1579,
1314,
13,
9651,
1583,
29889,
5064,
353,
1583,
29889,
5415,
29889,
5064,
29918,
3594,
13,
9651,
1583,
29889,
6229,
5580,
353,
1583,
29889,
5415,
29889,
6229,
5580,
13,
13,
13,
1678,
822,
263,
10700,
545,
29918,
1285,
473,
29898,
1311,
29892,
263,
10700,
545,
29922,
8516,
29892,
3095,
29918,
2780,
2433,
29893,
742,
3095,
29918,
16292,
29922,
29946,
29892,
4853,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
6811,
26762,
278,
2302,
473,
310,
385,
263,
10700,
545,
373,
263,
3646,
15526,
934,
29889,
13,
4706,
2866,
3224,
515,
529,
5813,
15513,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
263,
10700,
545,
584,
7442,
29889,
29906,
29881,
2378,
29892,
13136,
13,
9651,
319,
29871,
29906,
29928,
11105,
278,
1021,
2159,
408,
278,
3646,
15526,
934,
29889,
13109,
13,
9651,
338,
278,
4552,
273,
272,
2322,
263,
10700,
545,
29889,
13,
4706,
3095,
29918,
2780,
584,
851,
29892,
13136,
13,
9651,
450,
2927,
310,
278,
263,
10700,
545,
640,
473,
29889,
323,
6926,
263,
22889,
2927,
29889,
13,
9651,
13109,
338,
2654,
29889,
13,
4706,
3095,
29918,
16292,
584,
938,
29892,
13136,
13,
9651,
450,
1196,
2103,
310,
278,
263,
10700,
545,
640,
473,
29889,
13109,
338,
29871,
29946,
29889,
13,
4706,
4853,
584,
22889,
29889,
1165,
267,
3032,
1491,
26762,
29889,
29909,
9100,
4035,
5317,
29892,
13136,
13,
9651,
319,
9100,
304,
6492,
373,
29889,
13,
4706,
9995,
13,
4706,
565,
4853,
1275,
6213,
29901,
13,
9651,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
29898,
29876,
5727,
29922,
29896,
29897,
13,
13,
4706,
565,
263,
10700,
545,
338,
6213,
29901,
13,
9651,
263,
10700,
545,
353,
1583,
29889,
5415,
29889,
481,
814,
545,
13,
13,
4706,
4853,
29889,
326,
4294,
29898,
1311,
29889,
5415,
29889,
29873,
7810,
29961,
29900,
1402,
3978,
2433,
13609,
742,
3579,
19290,
29897,
13,
13,
4706,
285,
353,
14013,
921,
29892,
29891,
29901,
263,
10700,
545,
29961,
524,
29898,
29891,
511,
524,
29898,
29916,
29897,
4514,
13,
4706,
330,
353,
7442,
29889,
8111,
675,
29898,
29888,
29897,
13,
13,
4706,
921,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
481,
814,
545,
29889,
12181,
29961,
29896,
1402,
263,
10700,
545,
29889,
12181,
29961,
29896,
14178,
29896,
29900,
29900,
29897,
13,
4706,
343,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
481,
814,
545,
29889,
12181,
29961,
29900,
1402,
263,
10700,
545,
29889,
12181,
29961,
29900,
14178,
29896,
29900,
29900,
29897,
13,
4706,
1060,
29892,
612,
29922,
7442,
29889,
4467,
29882,
7720,
29898,
29916,
7503,
29899,
29896,
1402,
29891,
7503,
29899,
29896,
2314,
13,
4706,
796,
353,
330,
29898,
29990,
7503,
29899,
29896,
1402,
29979,
7503,
29899,
29896,
2314,
13,
13,
4706,
4853,
29889,
1285,
473,
29898,
29999,
29892,
518,
29900,
29889,
29900,
29945,
1402,
11955,
29922,
481,
29918,
2780,
29892,
1196,
2103,
29879,
11759,
481,
29918,
16292,
1402,
13,
462,
1678,
15834,
11759,
29900,
29899,
29900,
29889,
29945,
29892,
921,
7503,
29899,
29896,
1822,
3317,
580,
29899,
29900,
29889,
29945,
29892,
29900,
29899,
29900,
29889,
29945,
29892,
343,
7503,
29899,
29896,
1822,
3317,
580,
29899,
29900,
29889,
29945,
2314,
13,
13,
4706,
565,
4853,
1275,
6213,
29901,
13,
9651,
736,
2537,
13,
13,
13,
13,
1678,
822,
15526,
29918,
1609,
29918,
29886,
15711,
29898,
1311,
29892,
784,
3881,
29922,
8516,
29892,
1948,
3881,
29922,
8516,
29892,
274,
1958,
2433,
2405,
333,
275,
742,
13,
462,
539,
848,
29918,
1853,
543,
15728,
287,
613,
11105,
29922,
8516,
29892,
921,
2576,
29922,
8516,
29892,
13,
462,
539,
343,
2576,
29922,
8516,
29892,
2927,
29918,
1609,
29918,
29886,
15711,
29922,
8824,
29892,
2927,
29918,
1609,
29918,
481,
814,
545,
29922,
5574,
29892,
13,
462,
539,
3005,
29939,
29918,
3881,
11759,
29896,
29914,
29906,
29900,
1696,
29871,
29896,
29914,
29900,
29889,
29896,
1402,
383,
3301,
29922,
8516,
29892,
263,
10700,
545,
29922,
8516,
29892,
3095,
29918,
2780,
2433,
29878,
742,
13,
462,
539,
3095,
29918,
16292,
29922,
29906,
1125,
13,
4706,
9995,
13,
4706,
6760,
1078,
263,
15526,
29899,
1609,
29899,
29886,
15711,
3578,
11672,
773,
278,
24114,
19389,
29889,
13,
4706,
2866,
3224,
515,
19731,
6573,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
784,
3881,
584,
7442,
29889,
2378,
29892,
13136,
13,
632,
319,
1051,
310,
1369,
1897,
322,
1095,
1897,
366,
29915,
276,
8852,
297,
13,
632,
19342,
292,
297,
373,
29889,
13,
4706,
1948,
3881,
584,
7442,
29889,
2378,
29892,
13136,
13,
632,
319,
1051,
310,
1369,
1948,
322,
1095,
1948,
366,
29915,
276,
8852,
297,
19342,
292,
13,
632,
297,
373,
29889,
13,
4706,
274,
1958,
584,
851,
29892,
13136,
13,
632,
4408,
310,
263,
22889,
784,
555,
481,
29889,
13109,
338,
525,
2405,
333,
275,
4286,
13,
4706,
848,
29918,
1853,
584,
851,
29892,
13136,
13,
632,
450,
1134,
310,
19389,
1304,
29889,
20370,
29901,
525,
1610,
742,
525,
15728,
287,
742,
525,
314,
2830,
1151,
742,
13,
632,
470,
525,
19145,
13342,
4286,
960,
451,
29892,
2322,
731,
304,
525,
15728,
287,
4286,
13,
4706,
11105,
584,
7442,
29889,
2378,
29892,
13136,
13,
632,
12048,
11057,
278,
13840,
2063,
1304,
297,
278,
3578,
11672,
29889,
960,
451,
29892,
2322,
13,
632,
731,
304,
1781,
11029,
13840,
2063,
29889,
13,
4706,
921,
2576,
584,
7442,
29889,
2378,
29892,
13136,
13,
632,
12048,
11057,
278,
921,
2576,
373,
278,
1014,
26762,
29889,
960,
451,
29892,
2322,
338,
731,
304,
13,
632,
278,
4152,
3578,
11672,
29889,
13,
4706,
343,
2576,
584,
7442,
29889,
2378,
29892,
13136,
13,
632,
12048,
11057,
278,
343,
2576,
373,
278,
1014,
26762,
29892,
960,
451,
29892,
2322,
338,
731,
304,
13,
632,
278,
4152,
3578,
11672,
19389,
3464,
29889,
13,
4706,
2927,
29918,
1609,
29918,
29886,
15711,
584,
6120,
29892,
13136,
13,
632,
29183,
278,
3578,
11672,
2183,
278,
2927,
310,
278,
15526,
29889,
960,
451,
29892,
13,
632,
2322,
338,
731,
304,
7700,
29889,
13,
4706,
3005,
29939,
29918,
3881,
584,
1051,
29892,
13136,
13,
632,
2391,
310,
9212,
322,
7472,
10868,
304,
2740,
297,
24869,
2522,
1191,
280,
13,
632,
3785,
13342,
29889,
9333,
1304,
565,
848,
29918,
1853,
353,
525,
19145,
13342,
4286,
960,
6213,
29892,
13,
632,
2322,
353,
518,
29896,
29914,
29906,
29900,
1696,
29871,
29896,
29914,
29900,
29889,
29896,
1822,
13,
4706,
383,
3301,
29901,
7442,
29889,
2378,
29892,
13136,
29889,
29871,
13,
632,
7700,
838,
2817,
1019,
29890,
3097,
11174,
304,
3160,
297,
3785,
13342,
29889,
13,
632,
22521,
545,
393,
278,
1819,
526,
529,
29871,
29896,
29889,
29871,
13,
632,
1152,
1342,
29901,
383,
3301,
353,
7442,
29889,
2378,
4197,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29900,
29896,
11724,
674,
6492,
278,
29871,
29896,
29900,
29995,
322,
29871,
29896,
29995,
383,
3301,
11174,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
5415,
29889,
29880,
568,
29901,
13,
9651,
1596,
877,
4013,
338,
385,
4552,
273,
272,
29899,
29880,
568,
1203,
29889,
1939,
15526,
29918,
1609,
29918,
29886,
15711,
7604,
2133,
508,
367,
2825,
29889,
1495,
13,
9651,
1596,
877,
12148,
1653,
263,
4943,
4552,
273,
272,
29889,
8667,
1469,
1203,
313,
29880,
568,
29922,
8824,
29897,
304,
671,
445,
5780,
29889,
1495,
13,
9651,
736,
13,
13,
4706,
565,
784,
3881,
338,
6213,
29901,
13,
9651,
784,
3881,
353,
518,
29900,
29892,
1583,
29889,
6229,
5580,
29961,
29896,
5262,
13,
13,
4706,
565,
1948,
3881,
338,
6213,
29901,
13,
9651,
1948,
3881,
353,
518,
29900,
29892,
1583,
29889,
6229,
5580,
29961,
29900,
5262,
13,
13,
4706,
302,
5727,
353,
938,
29898,
9302,
29889,
14486,
29898,
1054,
3881,
29961,
29896,
29962,
29899,
1054,
3881,
29961,
29900,
12622,
13,
4706,
302,
22724,
353,
938,
29898,
9302,
29889,
14486,
29898,
798,
3881,
29961,
29896,
29962,
29899,
798,
3881,
29961,
29900,
12622,
13,
13,
4706,
565,
313,
1054,
3881,
29961,
29896,
29962,
1405,
1583,
29889,
6229,
5580,
29961,
29896,
2314,
470,
313,
798,
3881,
29961,
29896,
29962,
1405,
1583,
29889,
6229,
5580,
29961,
29900,
29962,
1125,
13,
9651,
12020,
7865,
2392,
703,
29909,
808,
292,
363,
901,
17036,
1135,
3625,
297,
278,
323,
13691,
23157,
13,
13,
13,
4706,
4377,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29947,
876,
13,
4706,
11420,
353,
867,
4841,
3135,
29889,
5756,
10299,
29898,
29896,
29892,
29906,
29892,
2920,
29918,
29878,
2219,
359,
11759,
29896,
29892,
29946,
2314,
13,
13,
4706,
6426,
353,
867,
4841,
3135,
29889,
5756,
10299,
4591,
4035,
5317,
10299,
29898,
29876,
22724,
29892,
302,
5727,
29892,
298,
3493,
29922,
29900,
29889,
29896,
29892,
281,
3493,
29922,
29900,
29889,
29896,
29892,
13,
462,
462,
462,
1014,
5317,
29918,
6550,
29922,
5561,
29961,
29896,
2314,
13,
13,
4706,
474,
29892,
432,
353,
1948,
3881,
29961,
29900,
1402,
784,
3881,
29961,
29900,
29962,
13,
13,
4706,
565,
11105,
338,
6213,
29901,
13,
9651,
3855,
353,
1583,
29889,
5415,
29889,
29567,
1275,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
3855,
353,
11105,
1275,
29871,
29900,
13,
13,
13,
4706,
444,
16507,
2891,
29903,
323,
1718,
7194,
349,
6415,
6670,
24080,
444,
13,
13,
4706,
4853,
353,
14770,
29889,
1491,
5317,
29898,
5561,
29961,
29900,
2314,
13,
13,
4706,
565,
263,
10700,
545,
338,
6213,
29901,
13,
9651,
263,
10700,
545,
353,
1583,
29889,
5415,
29889,
481,
814,
545,
13,
13,
4706,
6492,
1579,
1314,
353,
7442,
29889,
13707,
2168,
713,
29898,
1311,
29889,
1579,
1314,
7503,
29892,
1948,
3881,
29961,
29900,
5387,
798,
3881,
29961,
29896,
1402,
13,
462,
462,
3986,
784,
3881,
29961,
29900,
5387,
1054,
3881,
29961,
29896,
20526,
9685,
29922,
29900,
29897,
13,
4706,
274,
353,
4853,
29889,
326,
4294,
29898,
5317,
1579,
1314,
29892,
3978,
2433,
13609,
742,
13,
462,
418,
325,
3317,
29922,
9302,
29889,
25376,
488,
29898,
5317,
1579,
1314,
29892,
29871,
29929,
29945,
511,
13,
462,
418,
274,
1958,
29922,
29883,
1958,
29897,
13,
4706,
1933,
1241,
353,
1207,
29918,
1165,
267,
29918,
2029,
17219,
29898,
1165,
29897,
13,
4706,
274,
1165,
353,
1933,
1241,
29889,
4397,
29918,
1165,
267,
877,
1266,
742,
2159,
2433,
29945,
29995,
742,
17132,
29922,
29900,
29889,
29896,
29945,
29897,
13,
4706,
14770,
29889,
2780,
1646,
29898,
29883,
29892,
274,
1165,
29922,
1113,
29916,
29892,
19843,
2433,
18575,
1495,
13,
13,
4706,
285,
353,
14013,
921,
29892,
29891,
29901,
263,
10700,
545,
29961,
524,
29898,
29891,
511,
524,
29898,
29916,
29897,
4514,
13,
4706,
330,
353,
7442,
29889,
8111,
675,
29898,
29888,
29897,
13,
13,
4706,
921,
353,
7442,
29889,
1915,
3493,
29898,
1054,
3881,
29961,
29900,
1402,
1054,
3881,
29961,
29896,
1402,
302,
5727,
29930,
29896,
29900,
29900,
29897,
13,
4706,
343,
353,
7442,
29889,
1915,
3493,
29898,
798,
3881,
29961,
29900,
1402,
798,
3881,
29961,
29896,
1402,
302,
22724,
29930,
29896,
29900,
29900,
29897,
13,
4706,
1060,
29892,
612,
29922,
7442,
29889,
4467,
29882,
7720,
29898,
29916,
7503,
29899,
29896,
1402,
29891,
7503,
29899,
29896,
2314,
13,
4706,
796,
353,
330,
29898,
29990,
7503,
29899,
29896,
1402,
29979,
7503,
29899,
29896,
2314,
13,
13,
4706,
4853,
29889,
1285,
473,
29898,
29999,
29892,
518,
29900,
29889,
29900,
29945,
1402,
13,
462,
259,
11955,
29922,
481,
29918,
2780,
29892,
1196,
2103,
29879,
11759,
481,
29918,
16292,
1402,
13,
462,
1678,
15834,
11759,
29900,
29899,
29900,
29889,
29945,
29892,
302,
5727,
29899,
29900,
29889,
29945,
29892,
29900,
29899,
29900,
29889,
29945,
29892,
302,
22724,
29899,
29900,
29889,
29945,
2314,
13,
13,
4706,
444,
16507,
2891,
29903,
349,
6415,
6670,
365,
22530,
315,
4574,
29963,
2890,
444,
13,
4706,
363,
1399,
297,
3464,
29898,
938,
29898,
29876,
5727,
334,
302,
22724,
29897,
29871,
1125,
13,
9651,
565,
1399,
1275,
29871,
29900,
29901,
13,
18884,
4853,
353,
14770,
29889,
4035,
5317,
29898,
4532,
29892,
6426,
29961,
513,
2314,
13,
18884,
1677,
1165,
353,
4853,
13,
9651,
1683,
29901,
13,
18884,
4853,
353,
14770,
29889,
4035,
5317,
29898,
4532,
29892,
6426,
29961,
513,
1402,
6232,
29916,
29922,
12683,
1165,
29897,
13,
13,
9651,
19389,
353,
1583,
29889,
1579,
1314,
7503,
29892,
29875,
29892,
29926,
29962,
13,
9651,
931,
353,
1583,
29889,
5415,
29889,
2230,
13,
9651,
27760,
29918,
1579,
1314,
353,
1583,
29889,
5415,
29889,
15728,
287,
29918,
1579,
1314,
29898,
1579,
1314,
29922,
1579,
1314,
29897,
13,
13,
9651,
565,
848,
29918,
1853,
29889,
13609,
580,
1275,
525,
15728,
287,
2396,
13,
18884,
343,
353,
27760,
29918,
1579,
1314,
29961,
29939,
16261,
9302,
29889,
13707,
2168,
713,
29898,
29725,
29918,
1579,
1314,
29961,
29939,
2314,
13,
18884,
921,
353,
931,
29961,
29939,
29962,
13,
13,
9651,
25342,
848,
29918,
1853,
29889,
13609,
580,
1275,
525,
314,
2830,
1151,
2396,
13,
18884,
301,
29883,
353,
301,
29895,
29889,
20769,
23902,
345,
29898,
2230,
29922,
2230,
29892,
19389,
29922,
29725,
29918,
1579,
1314,
29897,
13,
18884,
23822,
353,
301,
29883,
29889,
8945,
675,
2141,
517,
29918,
19145,
13342,
580,
13,
18884,
921,
353,
23822,
29889,
10745,
23860,
29889,
1767,
13,
18884,
343,
353,
23822,
29889,
13519,
29889,
1767,
13,
13,
9651,
25342,
848,
29918,
1853,
29889,
13609,
580,
1275,
525,
1610,
2396,
13,
18884,
343,
353,
19389,
29961,
29939,
16261,
9302,
29889,
13707,
2168,
713,
29898,
1579,
1314,
29961,
29939,
2314,
13,
18884,
921,
353,
931,
29961,
29939,
29962,
13,
13,
9651,
25342,
848,
29918,
1853,
29889,
13609,
580,
1275,
525,
19145,
13342,
2396,
13,
18884,
365,
29903,
353,
24869,
4421,
1191,
280,
29898,
2230,
29892,
27760,
29918,
1579,
1314,
29897,
13,
18884,
3005,
29939,
29892,
3081,
353,
365,
29903,
29889,
1300,
459,
1680,
29898,
1195,
12539,
29918,
10745,
23860,
29922,
29888,
7971,
29918,
3881,
29961,
29900,
1402,
13,
462,
462,
462,
462,
268,
7472,
29918,
10745,
23860,
29922,
29888,
7971,
29918,
3881,
29961,
29896,
1402,
13,
462,
462,
462,
462,
268,
1158,
2433,
11255,
1495,
13,
18884,
343,
353,
3081,
13,
18884,
921,
353,
29871,
29896,
29914,
29888,
7971,
13,
13,
18884,
565,
313,
29943,
3301,
338,
451,
6213,
1125,
13,
462,
1678,
565,
7442,
29889,
497,
29898,
29943,
3301,
29966,
29896,
1125,
396,
22521,
545,
393,
278,
2070,
11614,
526,
599,
529,
29871,
29896,
29871,
13,
462,
4706,
565,
1134,
29898,
29943,
3301,
29897,
1275,
1051,
29901,
383,
3301,
353,
7442,
29889,
2378,
29898,
29943,
3301,
29897,
13,
462,
4706,
383,
3301,
5563,
353,
365,
29903,
29889,
4541,
29918,
284,
2817,
29918,
5563,
29898,
29943,
3301,
29892,
1158,
2433,
5521,
434,
29894,
1495,
29871,
13,
13,
9651,
565,
2927,
29918,
1609,
29918,
29886,
15711,
338,
7700,
29901,
13,
18884,
2927,
353,
525,
29895,
29915,
13,
9651,
1683,
29901,
13,
18884,
15552,
29890,
353,
274,
29889,
29883,
1958,
29898,
29883,
29889,
12324,
29898,
1311,
29889,
1579,
1314,
29961,
29896,
29900,
29900,
29892,
29875,
29892,
29926,
12622,
13,
18884,
2927,
353,
22889,
29889,
27703,
29889,
23973,
29906,
20970,
29898,
23973,
29897,
13,
13,
9651,
4853,
29889,
5317,
29898,
29916,
29892,
343,
29892,
274,
29922,
2780,
29897,
13,
13,
9651,
565,
313,
1272,
29918,
1853,
29889,
13609,
580,
1275,
525,
19145,
13342,
1495,
669,
313,
29943,
3301,
338,
451,
6213,
1125,
13,
18884,
565,
7442,
29889,
497,
29898,
29943,
3301,
29966,
29896,
1125,
29871,
13,
462,
1678,
903,
353,
518,
1165,
29889,
1165,
7760,
29898,
29888,
29892,
2927,
2433,
29895,
742,
19375,
2433,
489,
742,
15595,
29922,
29900,
29889,
29941,
29897,
363,
285,
297,
383,
3301,
5563,
29962,
13,
13,
13,
9651,
565,
2927,
29918,
1609,
29918,
481,
814,
545,
322,
263,
10700,
545,
29961,
29875,
29892,
29926,
29962,
1405,
29871,
29900,
29901,
13,
18884,
363,
29871,
423,
29916,
297,
6024,
3332,
742,
525,
8968,
742,
525,
1563,
742,
525,
1266,
2033,
29901,
13,
462,
1678,
4853,
29889,
1028,
1475,
29961,
423,
29916,
1822,
842,
29918,
2780,
29898,
481,
29918,
2780,
29897,
13,
462,
1678,
4853,
29889,
1028,
1475,
29961,
423,
29916,
1822,
842,
29918,
16292,
29898,
481,
29918,
16292,
29897,
13,
13,
9651,
432,
4619,
29871,
29896,
13,
9651,
565,
432,
1275,
784,
3881,
29961,
29896,
5387,
13,
18884,
474,
4619,
29871,
29896,
13,
18884,
432,
29871,
353,
784,
3881,
29961,
29900,
29962,
13,
13,
9651,
565,
343,
2576,
338,
6213,
29901,
13,
18884,
4853,
29889,
842,
29918,
29891,
2576,
29898,
9302,
29889,
25376,
488,
29898,
29891,
29892,
29871,
29896,
511,
7442,
29889,
25376,
488,
29898,
29891,
29892,
29871,
29929,
29929,
876,
13,
9651,
1683,
29901,
13,
18884,
4853,
29889,
842,
29918,
29891,
2576,
29898,
29891,
2576,
29961,
29900,
1402,
343,
2576,
29961,
29896,
2314,
13,
13,
9651,
565,
921,
2576,
338,
6213,
29901,
13,
18884,
4853,
29889,
842,
29918,
29916,
2576,
29898,
9302,
29889,
1195,
29898,
29916,
6817,
29900,
29889,
29896,
29892,
7442,
29889,
3317,
29898,
29916,
7240,
29900,
29889,
29896,
29897,
13,
9651,
1683,
29901,
13,
18884,
4853,
29889,
842,
29918,
29916,
2576,
29898,
29916,
2576,
29961,
29900,
1402,
921,
2576,
29961,
29896,
2314,
13,
13,
9651,
565,
848,
29918,
1853,
29889,
13609,
580,
1275,
525,
314,
2830,
1151,
2396,
13,
18884,
4853,
29889,
842,
29918,
952,
29883,
744,
877,
1188,
1495,
13,
18884,
4853,
29889,
842,
29918,
29916,
7052,
877,
1188,
1495,
13,
18884,
4853,
29889,
842,
29918,
29891,
2576,
29898,
29891,
29889,
1195,
3285,
343,
29889,
3317,
3101,
13,
18884,
4853,
29889,
842,
29918,
29916,
2576,
29898,
9302,
29889,
1195,
29898,
29916,
511,
13,
462,
9651,
7442,
29889,
3317,
29898,
29916,
876,
13,
13,
9651,
4853,
29889,
842,
29918,
486,
7358,
4197,
2314,
13,
9651,
4853,
29889,
842,
29918,
3637,
7358,
4197,
2314,
13,
13,
9651,
4377,
29889,
1202,
29918,
1491,
5317,
29898,
1165,
29897,
13,
13,
4706,
736,
4377,
13,
13,
13,
1678,
822,
260,
404,
29918,
1552,
29918,
27362,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
6461,
575,
278,
1544,
304,
529,
5813,
16299,
29879,
17067,
1799,
29901,
450,
7871,
14711,
19707,
363,
13,
4706,
278,
17535,
596,
3646,
338,
8900,
297,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
13,
4706,
6212,
5026,
13,
4706,
448,
1378,
29899,
13,
4706,
14064,
29918,
2271,
584,
851,
13,
13,
4706,
9995,
13,
4706,
822,
1134,
29918,
974,
29918,
2154,
7295,
13,
9651,
1018,
29901,
13,
18884,
474,
2272,
29918,
710,
353,
851,
29898,
1853,
29898,
657,
29918,
666,
1656,
22130,
13,
18884,
565,
525,
14018,
29939,
15903,
29915,
297,
474,
2272,
29918,
710,
29901,
13,
462,
1678,
736,
525,
29926,
786,
25547,
29915,
13,
18884,
565,
525,
8489,
979,
29915,
297,
474,
2272,
29918,
710,
29901,
13,
462,
1678,
736,
525,
666,
1656,
29915,
13,
9651,
5174,
29901,
13,
18884,
736,
525,
8489,
979,
29915,
13,
13,
4706,
17535,
353,
1583,
29889,
5415,
29889,
4993,
29918,
3888,
29889,
344,
2801,
13,
13,
4706,
2967,
543,
991,
597,
1636,
29889,
19567,
29889,
510,
29914,
9902,
29973,
4478,
29918,
1972,
543,
13,
4706,
2346,
543,
4330,
1799,
29974,
1552,
29974,
27362,
29974,
344,
2801,
29974,
29912,
29900,
7517,
621,
804,
582,
344,
1642,
4830,
29898,
344,
2801,
29897,
13,
13,
4706,
22300,
353,
25685,
29903,
1132,
29898,
24830,
29889,
657,
29898,
3188,
29974,
1972,
467,
726,
29892,
376,
1420,
29889,
16680,
2564,
2886,
29918,
497,
877,
2154,
29861,
29906,
29953,
29962,
13,
13,
4706,
4452,
353,
22300,
29889,
726,
13,
4706,
4452,
353,
4452,
29889,
5451,
28909,
29876,
29861,
29896,
1822,
5451,
877,
3257,
1495,
13,
13,
4706,
1781,
29918,
344,
2801,
29922,
29900,
13,
13,
4706,
363,
1014,
667,
297,
4452,
29901,
13,
9651,
432,
353,
1014,
667,
29889,
2886,
877,
29903,
3019,
1495,
13,
9651,
565,
432,
1405,
29871,
29900,
322,
525,
4330,
1799,
29901,
450,
7871,
29915,
297,
1014,
667,
29901,
13,
13,
18884,
21149,
353,
1014,
667,
29961,
29926,
29901,
29926,
29974,
29896,
29900,
29900,
1822,
5451,
29317,
29861,
29900,
1822,
5451,
877,
525,
9601,
29899,
29896,
29962,
13,
13,
18884,
565,
938,
29898,
8803,
29897,
1275,
938,
29898,
344,
2801,
1125,
13,
462,
1678,
474,
353,
1014,
667,
29889,
2886,
11219,
12344,
29973,
29894,
1495,
13,
462,
1678,
1294,
353,
1014,
667,
29961,
29875,
29901,
29875,
29974,
29896,
29900,
29900,
1822,
5451,
877,
29908,
29861,
29900,
29962,
13,
462,
1678,
1781,
29918,
344,
2801,
29922,
29896,
13,
462,
1678,
2867,
13,
13,
4706,
565,
1781,
29918,
344,
2801,
1275,
29871,
29896,
29901,
13,
9651,
1583,
29889,
27362,
29918,
2271,
353,
525,
991,
597,
1636,
29889,
19567,
29889,
510,
29912,
29900,
29913,
4286,
4830,
29898,
1062,
29897,
13,
13,
9651,
1246,
29918,
5479,
353,
1134,
29918,
974,
29918,
2154,
580,
13,
13,
9651,
565,
313,
4804,
29918,
5479,
1275,
525,
8489,
979,
1495,
470,
313,
4804,
29918,
5479,
1275,
525,
666,
1656,
29374,
13,
18884,
2897,
29889,
5205,
877,
4691,
448,
29885,
591,
1327,
8777,
448,
29873,
29850,
29900,
5038,
4286,
4830,
29898,
1311,
29889,
27362,
29918,
2271,
876,
13,
13,
9651,
25342,
313,
4804,
29918,
5479,
1275,
525,
29926,
786,
25547,
29374,
13,
18884,
515,
5641,
1656,
29889,
4990,
1053,
14711,
15167,
13,
18884,
1178,
353,
1583,
29889,
27362,
29918,
2271,
29889,
5451,
877,
29922,
1495,
14352,
29896,
29962,
13,
18884,
736,
14711,
15167,
29898,
333,
29922,
333,
29892,
2920,
29922,
29929,
29900,
29900,
29892,
3171,
29922,
29945,
29900,
29900,
29897,
13,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
3782,
14064,
338,
3625,
3447,
29889,
1495,
13,
9651,
736,
13,
13,
13,
1678,
822,
6492,
29918,
3249,
423,
29918,
957,
8387,
29898,
1311,
29892,
260,
293,
29922,
8516,
29892,
260,
7810,
29922,
8516,
29892,
18497,
29918,
13400,
29922,
29896,
29947,
1125,
13,
4706,
9995,
5596,
565,
278,
2752,
338,
640,
9103,
630,
1213,
15945,
13,
13,
4706,
565,
260,
293,
338,
6213,
29901,
13,
9651,
260,
293,
353,
1583,
29889,
5415,
29889,
4993,
29918,
3888,
29889,
29873,
293,
13,
13,
4706,
565,
260,
7810,
338,
6213,
29901,
13,
9651,
260,
7810,
353,
301,
29895,
29889,
4478,
29918,
29873,
404,
7582,
29898,
29888,
29915,
29911,
2965,
426,
29873,
293,
29913,
29861,
29900,
1822,
10382,
29898,
7582,
449,
29918,
2311,
7607,
1311,
29889,
5415,
29889,
29873,
7810,
29889,
12181,
29961,
29896,
1402,
13,
462,
462,
462,
462,
965,
1583,
29889,
5415,
29889,
29873,
7810,
29889,
12181,
29961,
29906,
12622,
13,
13,
4706,
2537,
353,
260,
7810,
29889,
5317,
29898,
4294,
29918,
2780,
1646,
29922,
8824,
29892,
3611,
2433,
29911,
2965,
426,
29900,
29913,
4286,
4830,
29898,
29873,
293,
876,
13,
4706,
2537,
353,
1583,
3032,
1202,
29918,
3249,
423,
29918,
4532,
29918,
17664,
29898,
29873,
7810,
29892,
2537,
29892,
18497,
29918,
13400,
29922,
29885,
4211,
4279,
29918,
13400,
29897,
13,
13,
4706,
736,
2537,
13,
13,
1678,
822,
903,
1202,
29918,
3249,
423,
29918,
4532,
29918,
17664,
29898,
1311,
29892,
260,
7810,
29892,
2537,
29892,
18497,
29918,
13400,
29922,
29896,
29947,
1125,
13,
4706,
9995,
9984,
278,
10415,
423,
11479,
10619,
29879,
15945,
29908,
13,
4706,
396,
3617,
278,
11909,
310,
278,
10415,
423,
8974,
13,
4706,
274,
29896,
353,
16572,
7967,
536,
29898,
29873,
7810,
29889,
336,
29892,
260,
7810,
29889,
7099,
29892,
3515,
2433,
293,
2288,
742,
5190,
2433,
12163,
1495,
13,
4706,
396,
4803,
15526,
6287,
363,
2346,
2159,
13,
4706,
9277,
29918,
7052,
353,
29871,
29906,
29896,
29889,
29900,
13,
4706,
396,
1334,
526,
2346,
292,
411,
263,
24235,
408,
278,
11855,
29892,
975,
5589,
292,
491,
29871,
29906,
29916,
29889,
13,
4706,
515,
8717,
307,
1972,
29889,
29894,
466,
631,
1053,
478,
466,
631,
13,
4706,
478,
466,
631,
29889,
25180,
29918,
5265,
26349,
353,
448,
29896,
13,
4706,
1121,
353,
478,
466,
631,
29889,
1972,
29918,
12803,
29898,
29883,
29896,
29892,
16653,
29922,
3366,
29902,
29914,
29941,
29946,
29945,
29914,
3249,
423,
29906,
12436,
13,
462,
462,
268,
11855,
29922,
19582,
29898,
9302,
29889,
3317,
29898,
29873,
7810,
29889,
12181,
29961,
29896,
29901,
2314,
334,
9277,
29918,
7052,
29892,
376,
5666,
3471,
5783,
13,
4706,
694,
29918,
5182,
29879,
29918,
11940,
29918,
4906,
353,
7865,
2392,
877,
29923,
2121,
694,
8974,
892,
1476,
297,
278,
2346,
5120,
525,
13,
462,
462,
795,
525,
272,
478,
466,
631,
338,
443,
16515,
1495,
13,
4706,
2086,
29918,
29888,
809,
29918,
11940,
29918,
4906,
353,
7865,
2392,
877,
3782,
8974,
1476,
1506,
14643,
1135,
12365,
29900,
29889,
29896,
29888,
29913,
4286,
4830,
29898,
29885,
4211,
4279,
29918,
13400,
876,
13,
4706,
565,
1121,
338,
6213,
29901,
13,
9651,
12020,
694,
29918,
5182,
29879,
29918,
11940,
29918,
4906,
13,
4706,
25342,
7431,
29898,
2914,
29897,
1275,
29871,
29900,
29901,
13,
9651,
12020,
2086,
29918,
29888,
809,
29918,
11940,
29918,
4906,
13,
4706,
1121,
353,
1121,
3366,
29902,
29914,
29941,
29946,
29945,
29914,
3249,
423,
29906,
16862,
517,
29918,
15112,
580,
13,
4706,
1121,
353,
1121,
29961,
2914,
29889,
29954,
11082,
529,
18497,
29918,
13400,
29962,
13,
4706,
565,
7431,
29898,
2914,
29897,
1275,
29871,
29900,
29901,
13,
9651,
12020,
694,
29918,
5182,
29879,
29918,
11940,
29918,
4906,
13,
4706,
1153,
311,
2395,
353,
7442,
29889,
29894,
1429,
4197,
2914,
1839,
4717,
29918,
2965,
12445,
7464,
1121,
1839,
2287,
29918,
2965,
12445,
2033,
14664,
29911,
13,
4706,
1302,
4339,
353,
260,
7810,
29889,
29893,
2395,
29889,
497,
29918,
11526,
29906,
29886,
861,
29898,
15464,
2395,
29892,
29871,
29900,
29897,
13,
4706,
1018,
29901,
13,
9651,
1629,
353,
5135,
29873,
7810,
29889,
2230,
29961,
29900,
1822,
26012,
448,
29871,
29906,
29946,
29945,
29955,
29906,
29900,
29953,
29889,
29941,
29955,
29945,
29897,
334,
318,
29889,
3250,
467,
517,
29898,
29884,
29889,
6360,
29897,
13,
4706,
5174,
29901,
13,
9651,
1629,
353,
5135,
29873,
7810,
29889,
579,
14441,
29918,
2230,
29961,
29900,
1822,
26012,
448,
29871,
29906,
29946,
29945,
29955,
29906,
29900,
29953,
29889,
29941,
29955,
29945,
29897,
334,
318,
29889,
3250,
467,
517,
29898,
29884,
29889,
6360,
29897,
13,
4706,
26354,
336,
353,
5135,
9302,
29889,
13707,
29918,
517,
29918,
1949,
29898,
9302,
29889,
294,
2378,
29898,
2914,
29889,
3358,
4717,
876,
334,
318,
29889,
19958,
4447,
29883,
7496,
29914,
29884,
29889,
6360,
29897,
334,
1629,
467,
517,
29898,
29884,
29889,
5666,
3471,
467,
1767,
13,
4706,
26354,
7099,
353,
5135,
9302,
29889,
13707,
29918,
517,
29918,
1949,
29898,
9302,
29889,
294,
2378,
29898,
2914,
29889,
3358,
2287,
876,
334,
318,
29889,
19958,
4447,
29883,
7496,
29914,
29884,
29889,
6360,
29897,
334,
1629,
467,
517,
29898,
29884,
29889,
5666,
3471,
467,
1767,
13,
4706,
1121,
29889,
4717,
29918,
2965,
12445,
4619,
26354,
336,
13,
4706,
1121,
29889,
2287,
29918,
2965,
12445,
4619,
26354,
7099,
13,
13,
4706,
396,
402,
2705,
2159,
278,
3291,
491,
1009,
10415,
423,
18497,
13,
4706,
15786,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29889,
29900,
847,
29871,
29906,
1068,
29898,
2914,
1839,
29954,
11082,
2033,
29914,
29906,
29897,
13,
13,
4706,
3646,
353,
260,
7810,
29889,
29893,
2395,
29889,
11526,
29918,
517,
29918,
29886,
15711,
29898,
29883,
29896,
29897,
13,
4706,
14770,
29889,
1557,
2620,
29898,
5182,
29961,
29900,
10062,
29873,
7810,
29889,
4914,
29892,
3646,
29961,
29896,
10062,
29873,
7810,
29889,
798,
29892,
269,
29922,
29945,
29900,
29892,
503,
2098,
29922,
29896,
29900,
29900,
29900,
29892,
274,
2433,
29895,
742,
17456,
2433,
29916,
1495,
13,
13,
4706,
14770,
29889,
1557,
2620,
29898,
1111,
4339,
7503,
29892,
29871,
29900,
10062,
29873,
7810,
29889,
4914,
29892,
1302,
4339,
7503,
29892,
29871,
29896,
10062,
29873,
7810,
29889,
798,
29892,
274,
2433,
8696,
1182,
860,
742,
15595,
29922,
29900,
29889,
29945,
29892,
7636,
27703,
2433,
29878,
742,
269,
29922,
29879,
7093,
29897,
13,
4706,
14770,
29889,
1557,
2620,
29898,
1111,
4339,
7503,
29892,
29871,
29900,
10062,
29873,
7810,
29889,
4914,
29892,
1302,
4339,
7503,
29892,
29871,
29896,
10062,
29873,
7810,
29889,
798,
29892,
274,
2433,
8516,
742,
7636,
27703,
2433,
29878,
742,
269,
29922,
29879,
7093,
29897,
13,
4706,
14770,
29889,
29916,
2576,
4197,
29873,
7810,
29889,
4914,
29899,
29900,
29889,
29945,
29892,
260,
7810,
29889,
4914,
29974,
29873,
7810,
29889,
12181,
29961,
29896,
29962,
29899,
29900,
29889,
29945,
2314,
13,
4706,
14770,
29889,
29891,
2576,
4197,
29873,
7810,
29889,
798,
29899,
29900,
29889,
29945,
29892,
260,
7810,
29889,
798,
29974,
29873,
7810,
29889,
12181,
29961,
29906,
29962,
29899,
29900,
29889,
29945,
2314,
13,
13,
4706,
736,
2537,
13,
13,
2
] |
npd_well_decoder/__init__.py | fmell/npd-well-name-decoder | 0 | 16754 | <reponame>fmell/npd-well-name-decoder
from .npd import parse_wellbore_name
| [
1,
529,
276,
1112,
420,
29958,
24826,
514,
29914,
9302,
29881,
29899,
5872,
29899,
978,
29899,
7099,
6119,
13,
3166,
869,
9302,
29881,
1053,
6088,
29918,
5872,
29890,
487,
29918,
978,
13,
2
] |
simple/management/commands/parse_future_committee_meetings.py | navotsil/Open-Knesset | 7 | 94251 | #### encoding: cp1255 ####
from collections import namedtuple
import urllib2
import re
import logging
import csv
import datetime
from django.core.management.base import BaseCommand
from django.contrib.contenttypes.models import ContentType
from dateutil import zoneinfo
from mks.models import Member
from committees.models import Committee
from events.models import Event
# NB: All dates scraped from the knesset site are assumed to be in timezone Israel.
isr_tz = zoneinfo.gettz('Israel')
utc_tz = zoneinfo.gettz('UTC')
logger = logging.getLogger("open-knesset.parse_future_committee_meetings")
spamWriter = csv.writer(open('eggs.csv', 'wb'))
ParsedResult = namedtuple('ParseResult',
'name, year, month, day, hour, minute, '
+'title, end_hour, end_minute, end_guessed')
class Command(BaseCommand):
args = ''
help = 'Parses commitee members from the Knesset website'
committee_ct = ContentType.objects.get_for_model(Committee)
def parse_future_committee_meetings(self):
retval = []
url = 'http://knesset.gov.il/agenda/heb/CommitteesByDate.asp'
data = urllib2.urlopen(url).read()
committee_re = re.compile('<td class="Day" bgcolor="#990000" >\s+\xf1\xe3\xf8 \xe4\xe9\xe5\xed \xec.+, <span style=color:#c0c0c0>')
committee_name = re.compile('<td class="Day" bgcolor="#990000" >\s+\xf1\xe3\xf8 \xe4\xe9\xe5\xed \xec(.+), <span style=color:#c0c0c0>')
date_re = re.compile("<nobr>\((\d+)/(\d+)/(\d+)\)</nobr>")
time_re = re.compile('\xe1\xf9\xf2\xe4 (\d\d):(\d\d)')
meeting_title_re = re.compile('TitleCommittee')
meeting_agenda_re = re.compile('class="Agenda"')
meeting_agenda_text_re = re.compile('<[Tt]d class=AgendaText>([^<]+)</[Tt]d>')
datas = committee_re.split( data )[1:]
committee_names = committee_name.findall( data )
committee_names = [ name.decode('cp1255') for name in committee_names ]
committee_data = zip( committee_names, datas )
def parse_meeting_data(meeting_data):
meeting_time = time_re.findall(meeting_data)[0]
hour, minute = int(meeting_time[0]), int(meeting_time[1])
meeting_agenda_data = meeting_agenda_re.split(meeting_data)[1]
titles = meeting_agenda_text_re.findall( meeting_agenda_data )
titles = [ title.decode('cp1255').strip() for title in titles ]
title = " ".join( titles )
# XXX Note the + 2 HACK:
# because knesset.gov lacks information on the expected end of the last
# meeting in any committees daily schedule. NOTE: we can guess a little better (use
# lunch for instance, or look for members other meetings)
return ParsedResult(name=name, year=year, month=month,
day=day, hour=hour, minute=minute, title=title,
end_hour=hour + 2, end_minute=minute,
end_guessed=True)
for name, data in committee_data:
date = date_re.findall(data)[0]
year, month, day = int(date[2]), int(date[1]), int(date[0])
meeting_datas = meeting_title_re.split(data)[1:]
for i, meeting_data in enumerate(meeting_datas):
parsed = parse_meeting_data(meeting_data)
if i > 0:
last = retval[-1]
# ugly, but it's a tuple, can't assign
new_last = ParsedResult(
name=last.name, year=last.year, month=last.month,
day=last.day, hour=last.hour, minute=last.minute,
title=last.title,
end_hour=parsed.hour,
end_minute=parsed.minute,
end_guessed=False)
retval[-1] = new_last
retval.append(parsed)
# since this is now a two pass, kinda, do the logging after.
for p in retval:
spamWriter.writerow( [ p.name.encode('utf8'), p.year, p.month,
p.day, p.hour, p.minute, p.end_hour,
p.end_minute, p.end_guessed,
p.title.encode('utf8') ] )
return retval
def update_future_committee_meetings_db(self, r):
for p in r:
try:
committee = Committee.objects.get(name=p.name)
when_over = datetime.datetime(
year=p.year, month=p.month, day=p.day, hour=p.end_hour,
minute=p.end_minute, second=0, tzinfo=isr_tz).astimezone(utc_tz)
when = datetime.datetime(
year=p.year, month=p.month, day=p.day, hour=p.hour,
minute=p.minute, second=0, tzinfo=isr_tz).astimezone(utc_tz)
ev, created = Event.objects.get_or_create( when = when,
when_over = when_over,
when_over_guessed = p.end_guessed,
where = unicode(committee),
what = p.title,
which_pk = committee.id,
which_type = self.committee_ct,
)
logger.debug("new event at %s - %s%s: %s" % (ev.when, ev.when_over,
'' if not ev.when_over_guessed else '(guess)',
ev.what))
except Committee.DoesNotExist:
logger.debug("couldn't find committee %s" % p.name)
try:
ev, created = Event.objects.get_or_create(
when = datetime.datetime( year=p.year, month=p.month,
day=p.day, hour=p.hour,
minute=p.minute, second=0 ),
what=p.title)
except Event.MultipleObjectsReturned:
created = False
if created:
logger.debug("created %s" % ev)
def handle(self, *args, **options):
logger.debug('Events objects count before update: %d' % Event.objects.count())
r = self.parse_future_committee_meetings()
#logger.debug(r)
self.update_future_committee_meetings_db(r)
logger.debug('Events objects count after update: %d' % Event.objects.count())
| [
1,
3191,
8025,
29901,
21447,
29896,
29906,
29945,
29945,
3191,
13,
13,
3166,
16250,
1053,
4257,
23583,
13,
5215,
3142,
1982,
29906,
13,
5215,
337,
13,
5215,
12183,
13,
5215,
11799,
13,
5215,
12865,
13,
3166,
9557,
29889,
3221,
29889,
21895,
29889,
3188,
1053,
7399,
6255,
13,
3166,
9557,
29889,
21570,
29889,
3051,
8768,
29889,
9794,
1053,
10576,
1542,
13,
3166,
2635,
4422,
1053,
10640,
3888,
13,
13,
3166,
286,
2039,
29889,
9794,
1053,
19495,
13,
3166,
844,
5388,
267,
29889,
9794,
1053,
12930,
13,
3166,
4959,
29889,
9794,
1053,
6864,
13,
13,
29937,
405,
29933,
29901,
2178,
10116,
885,
2390,
287,
515,
278,
889,
404,
300,
3268,
526,
12023,
304,
367,
297,
29431,
11996,
29889,
13,
275,
29878,
29918,
17559,
353,
10640,
3888,
29889,
657,
17559,
877,
3624,
9058,
1495,
13,
329,
29883,
29918,
17559,
353,
10640,
3888,
29889,
657,
17559,
877,
26913,
1495,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
703,
3150,
29899,
29895,
2264,
300,
29889,
5510,
29918,
29888,
9130,
29918,
2055,
9309,
29918,
1004,
300,
886,
1159,
13,
1028,
314,
10507,
353,
11799,
29889,
13236,
29898,
3150,
877,
387,
3174,
29889,
7638,
742,
525,
29893,
29890,
8785,
13,
13,
29925,
1503,
287,
3591,
353,
4257,
23583,
877,
12914,
3591,
742,
13,
1678,
525,
978,
29892,
1629,
29892,
4098,
29892,
2462,
29892,
7234,
29892,
11015,
29892,
525,
13,
259,
718,
29915,
3257,
29892,
1095,
29918,
18721,
29892,
1095,
29918,
1195,
1082,
29892,
1095,
29918,
2543,
11517,
1495,
13,
13,
1990,
10516,
29898,
5160,
6255,
1125,
13,
13,
1678,
6389,
353,
6629,
13,
1678,
1371,
353,
525,
29925,
1503,
267,
844,
568,
29872,
5144,
515,
278,
476,
2264,
300,
4700,
29915,
13,
1678,
21118,
29918,
312,
353,
10576,
1542,
29889,
12650,
29889,
657,
29918,
1454,
29918,
4299,
29898,
1523,
2415,
371,
29872,
29897,
13,
13,
1678,
822,
6088,
29918,
29888,
9130,
29918,
2055,
9309,
29918,
1004,
300,
886,
29898,
1311,
1125,
13,
4706,
3240,
791,
353,
5159,
13,
13,
4706,
3142,
353,
525,
1124,
597,
29895,
2264,
300,
29889,
13513,
29889,
309,
29914,
351,
8395,
29914,
25842,
29914,
1523,
2415,
371,
267,
2059,
2539,
29889,
4692,
29915,
13,
13,
4706,
848,
353,
3142,
1982,
29906,
29889,
332,
417,
2238,
29898,
2271,
467,
949,
580,
13,
13,
4706,
21118,
29918,
276,
353,
337,
29889,
12198,
877,
29966,
1594,
770,
543,
12742,
29908,
25989,
2780,
9880,
29929,
29929,
29900,
29900,
29900,
29900,
29908,
1405,
29905,
29879,
3124,
24660,
29896,
29905,
17115,
29941,
29905,
24660,
29947,
320,
17115,
29946,
29905,
17115,
29929,
29905,
17115,
29945,
29905,
29916,
287,
320,
29916,
687,
29889,
29974,
29892,
529,
9653,
3114,
29922,
2780,
21968,
29883,
29900,
29883,
29900,
29883,
29900,
29958,
1495,
13,
4706,
21118,
29918,
978,
353,
337,
29889,
12198,
877,
29966,
1594,
770,
543,
12742,
29908,
25989,
2780,
9880,
29929,
29929,
29900,
29900,
29900,
29900,
29908,
1405,
29905,
29879,
3124,
24660,
29896,
29905,
17115,
29941,
29905,
24660,
29947,
320,
17115,
29946,
29905,
17115,
29929,
29905,
17115,
29945,
29905,
29916,
287,
320,
29916,
687,
11891,
29974,
511,
529,
9653,
3114,
29922,
2780,
21968,
29883,
29900,
29883,
29900,
29883,
29900,
29958,
1495,
13,
4706,
2635,
29918,
276,
353,
337,
29889,
12198,
28945,
29876,
711,
29878,
14247,
29898,
1194,
29881,
29974,
6802,
1194,
29881,
29974,
6802,
1194,
29881,
29974,
27779,
829,
29876,
711,
29878,
29958,
1159,
13,
4706,
931,
29918,
276,
353,
337,
29889,
12198,
28909,
17115,
29896,
29905,
24660,
29929,
29905,
24660,
29906,
29905,
17115,
29946,
29987,
14239,
29936,
1194,
29881,
29905,
29881,
1125,
1194,
29881,
29905,
29881,
29897,
1495,
13,
4706,
11781,
29918,
3257,
29918,
276,
353,
337,
29889,
12198,
877,
7030,
1523,
2415,
371,
29872,
1495,
13,
4706,
11781,
29918,
351,
8395,
29918,
276,
353,
337,
29889,
12198,
877,
1990,
543,
14769,
8395,
29908,
1495,
13,
4706,
11781,
29918,
351,
8395,
29918,
726,
29918,
276,
353,
337,
29889,
12198,
877,
29966,
29961,
29911,
29873,
29962,
29881,
770,
29922,
14769,
8395,
1626,
29958,
4197,
29985,
29966,
10062,
29897,
829,
29961,
29911,
29873,
29962,
29881,
29958,
1495,
13,
13,
4706,
6155,
353,
21118,
29918,
276,
29889,
5451,
29898,
848,
1723,
29961,
29896,
17531,
13,
13,
4706,
21118,
29918,
7039,
353,
21118,
29918,
978,
29889,
2886,
497,
29898,
848,
1723,
13,
4706,
21118,
29918,
7039,
353,
518,
1024,
29889,
13808,
877,
6814,
29896,
29906,
29945,
29945,
1495,
363,
1024,
297,
21118,
29918,
7039,
4514,
13,
13,
4706,
21118,
29918,
1272,
353,
14319,
29898,
21118,
29918,
7039,
29892,
6155,
1723,
13,
4706,
822,
6088,
29918,
1004,
15133,
29918,
1272,
29898,
1004,
15133,
29918,
1272,
1125,
13,
9651,
11781,
29918,
2230,
353,
931,
29918,
276,
29889,
2886,
497,
29898,
1004,
15133,
29918,
1272,
9601,
29900,
29962,
13,
9651,
7234,
29892,
11015,
353,
938,
29898,
1004,
15133,
29918,
2230,
29961,
29900,
11724,
938,
29898,
1004,
15133,
29918,
2230,
29961,
29896,
2314,
13,
9651,
11781,
29918,
351,
8395,
29918,
1272,
353,
11781,
29918,
351,
8395,
29918,
276,
29889,
5451,
29898,
1004,
15133,
29918,
1272,
9601,
29896,
29962,
13,
9651,
17735,
353,
11781,
29918,
351,
8395,
29918,
726,
29918,
276,
29889,
2886,
497,
29898,
11781,
29918,
351,
8395,
29918,
1272,
1723,
13,
9651,
17735,
353,
518,
3611,
29889,
13808,
877,
6814,
29896,
29906,
29945,
29945,
2824,
17010,
580,
363,
3611,
297,
17735,
4514,
13,
9651,
3611,
353,
376,
11393,
7122,
29898,
17735,
1723,
13,
9651,
396,
22615,
3940,
278,
718,
29871,
29906,
379,
11375,
29901,
13,
9651,
396,
1363,
889,
404,
300,
29889,
13513,
425,
4684,
2472,
373,
278,
3806,
1095,
310,
278,
1833,
13,
9651,
396,
11781,
297,
738,
844,
5388,
267,
14218,
20410,
29889,
6058,
29923,
29901,
591,
508,
4140,
263,
2217,
2253,
313,
1509,
13,
9651,
396,
301,
3322,
363,
2777,
29892,
470,
1106,
363,
5144,
916,
5870,
886,
29897,
13,
9651,
736,
1459,
8485,
3591,
29898,
978,
29922,
978,
29892,
1629,
29922,
6360,
29892,
4098,
29922,
10874,
29892,
13,
462,
462,
2462,
29922,
3250,
29892,
7234,
29922,
18721,
29892,
11015,
29922,
1195,
1082,
29892,
3611,
29922,
3257,
29892,
13,
462,
462,
1095,
29918,
18721,
29922,
18721,
718,
29871,
29906,
29892,
1095,
29918,
1195,
1082,
29922,
1195,
1082,
29892,
13,
462,
462,
1095,
29918,
2543,
11517,
29922,
5574,
29897,
13,
4706,
363,
1024,
29892,
848,
297,
21118,
29918,
1272,
29901,
13,
9651,
2635,
353,
2635,
29918,
276,
29889,
2886,
497,
29898,
1272,
9601,
29900,
29962,
13,
9651,
1629,
29892,
4098,
29892,
2462,
353,
938,
29898,
1256,
29961,
29906,
11724,
938,
29898,
1256,
29961,
29896,
11724,
938,
29898,
1256,
29961,
29900,
2314,
13,
13,
9651,
11781,
29918,
14538,
353,
11781,
29918,
3257,
29918,
276,
29889,
5451,
29898,
1272,
9601,
29896,
17531,
13,
13,
9651,
363,
474,
29892,
11781,
29918,
1272,
297,
26985,
29898,
1004,
15133,
29918,
14538,
1125,
13,
18884,
21213,
353,
6088,
29918,
1004,
15133,
29918,
1272,
29898,
1004,
15133,
29918,
1272,
29897,
13,
18884,
565,
474,
1405,
29871,
29900,
29901,
13,
462,
1678,
1833,
353,
3240,
791,
14352,
29896,
29962,
13,
462,
1678,
396,
22769,
29892,
541,
372,
29915,
29879,
263,
18761,
29892,
508,
29915,
29873,
3566,
13,
462,
1678,
716,
29918,
4230,
353,
1459,
8485,
3591,
29898,
13,
462,
4706,
1024,
29922,
4230,
29889,
978,
29892,
1629,
29922,
4230,
29889,
6360,
29892,
4098,
29922,
4230,
29889,
10874,
29892,
13,
462,
4706,
2462,
29922,
4230,
29889,
3250,
29892,
7234,
29922,
4230,
29889,
18721,
29892,
11015,
29922,
4230,
29889,
1195,
1082,
29892,
13,
462,
4706,
3611,
29922,
4230,
29889,
3257,
29892,
13,
462,
4706,
1095,
29918,
18721,
29922,
862,
8485,
29889,
18721,
29892,
13,
462,
4706,
1095,
29918,
1195,
1082,
29922,
862,
8485,
29889,
1195,
1082,
29892,
13,
462,
4706,
1095,
29918,
2543,
11517,
29922,
8824,
29897,
13,
462,
1678,
3240,
791,
14352,
29896,
29962,
353,
716,
29918,
4230,
13,
18884,
3240,
791,
29889,
4397,
29898,
862,
8485,
29897,
13,
13,
4706,
396,
1951,
445,
338,
1286,
263,
1023,
1209,
29892,
2924,
29874,
29892,
437,
278,
12183,
1156,
29889,
13,
4706,
363,
282,
297,
3240,
791,
29901,
13,
9651,
805,
314,
10507,
29889,
13236,
340,
29898,
518,
282,
29889,
978,
29889,
12508,
877,
9420,
29947,
5477,
282,
29889,
6360,
29892,
282,
29889,
10874,
29892,
13,
462,
462,
259,
282,
29889,
3250,
29892,
282,
29889,
18721,
29892,
282,
29889,
1195,
1082,
29892,
282,
29889,
355,
29918,
18721,
29892,
13,
462,
462,
259,
282,
29889,
355,
29918,
1195,
1082,
29892,
282,
29889,
355,
29918,
2543,
11517,
29892,
13,
462,
462,
259,
282,
29889,
3257,
29889,
12508,
877,
9420,
29947,
1495,
4514,
1723,
13,
4706,
736,
3240,
791,
13,
13,
1678,
822,
2767,
29918,
29888,
9130,
29918,
2055,
9309,
29918,
1004,
300,
886,
29918,
2585,
29898,
1311,
29892,
364,
1125,
13,
4706,
363,
282,
297,
364,
29901,
13,
9651,
1018,
29901,
13,
18884,
21118,
353,
12930,
29889,
12650,
29889,
657,
29898,
978,
29922,
29886,
29889,
978,
29897,
13,
18884,
746,
29918,
957,
353,
12865,
29889,
12673,
29898,
13,
462,
1678,
1629,
29922,
29886,
29889,
6360,
29892,
4098,
29922,
29886,
29889,
10874,
29892,
2462,
29922,
29886,
29889,
3250,
29892,
7234,
29922,
29886,
29889,
355,
29918,
18721,
29892,
13,
462,
1678,
11015,
29922,
29886,
29889,
355,
29918,
1195,
1082,
29892,
1473,
29922,
29900,
29892,
260,
29920,
3888,
29922,
275,
29878,
29918,
17559,
467,
579,
603,
8028,
29898,
329,
29883,
29918,
17559,
29897,
13,
18884,
746,
353,
12865,
29889,
12673,
29898,
13,
462,
1678,
1629,
29922,
29886,
29889,
6360,
29892,
4098,
29922,
29886,
29889,
10874,
29892,
2462,
29922,
29886,
29889,
3250,
29892,
7234,
29922,
29886,
29889,
18721,
29892,
13,
462,
1678,
11015,
29922,
29886,
29889,
1195,
1082,
29892,
1473,
29922,
29900,
29892,
260,
29920,
3888,
29922,
275,
29878,
29918,
17559,
467,
579,
603,
8028,
29898,
329,
29883,
29918,
17559,
29897,
13,
18884,
3415,
29892,
2825,
353,
6864,
29889,
12650,
29889,
657,
29918,
272,
29918,
3258,
29898,
746,
353,
746,
29892,
13,
462,
462,
462,
965,
746,
29918,
957,
353,
746,
29918,
957,
29892,
13,
462,
462,
462,
965,
746,
29918,
957,
29918,
2543,
11517,
353,
282,
29889,
355,
29918,
2543,
11517,
29892,
13,
462,
462,
462,
965,
988,
353,
29104,
29898,
2055,
9309,
511,
13,
462,
462,
462,
965,
825,
353,
282,
29889,
3257,
29892,
13,
462,
462,
462,
965,
607,
29918,
20571,
353,
21118,
29889,
333,
29892,
13,
462,
462,
462,
965,
607,
29918,
1853,
353,
1583,
29889,
2055,
9309,
29918,
312,
29892,
13,
462,
462,
462,
965,
1723,
13,
18884,
17927,
29889,
8382,
703,
1482,
1741,
472,
1273,
29879,
448,
1273,
29879,
29995,
29879,
29901,
1273,
29879,
29908,
1273,
313,
5750,
29889,
8256,
29892,
3415,
29889,
8256,
29918,
957,
29892,
13,
462,
462,
462,
632,
6629,
565,
451,
3415,
29889,
8256,
29918,
957,
29918,
2543,
11517,
1683,
525,
29898,
2543,
404,
29897,
742,
13,
462,
462,
462,
632,
3415,
29889,
5816,
876,
13,
9651,
5174,
12930,
29889,
25125,
3664,
1252,
391,
29901,
13,
18884,
17927,
29889,
8382,
703,
26680,
29876,
29915,
29873,
1284,
21118,
29871,
1273,
29879,
29908,
1273,
282,
29889,
978,
29897,
13,
18884,
1018,
29901,
13,
462,
1678,
3415,
29892,
2825,
353,
6864,
29889,
12650,
29889,
657,
29918,
272,
29918,
3258,
29898,
13,
462,
4706,
746,
353,
12865,
29889,
12673,
29898,
1629,
29922,
29886,
29889,
6360,
29892,
4098,
29922,
29886,
29889,
10874,
29892,
13,
462,
462,
462,
29871,
2462,
29922,
29886,
29889,
3250,
29892,
7234,
29922,
29886,
29889,
18721,
29892,
13,
462,
462,
462,
29871,
11015,
29922,
29886,
29889,
1195,
1082,
29892,
1473,
29922,
29900,
10353,
13,
462,
462,
462,
29871,
825,
29922,
29886,
29889,
3257,
29897,
13,
18884,
5174,
6864,
29889,
15329,
552,
12724,
11609,
287,
29901,
13,
462,
1678,
2825,
353,
7700,
13,
9651,
565,
2825,
29901,
13,
18884,
17927,
29889,
8382,
703,
11600,
1273,
29879,
29908,
1273,
3415,
29897,
13,
13,
1678,
822,
4386,
29898,
1311,
29892,
334,
5085,
29892,
3579,
6768,
1125,
13,
4706,
17927,
29889,
8382,
877,
13634,
3618,
2302,
1434,
2767,
29901,
1273,
29881,
29915,
1273,
6864,
29889,
12650,
29889,
2798,
3101,
13,
4706,
364,
353,
1583,
29889,
5510,
29918,
29888,
9130,
29918,
2055,
9309,
29918,
1004,
300,
886,
580,
13,
4706,
396,
21707,
29889,
8382,
29898,
29878,
29897,
13,
4706,
1583,
29889,
5504,
29918,
29888,
9130,
29918,
2055,
9309,
29918,
1004,
300,
886,
29918,
2585,
29898,
29878,
29897,
13,
4706,
17927,
29889,
8382,
877,
13634,
3618,
2302,
1156,
2767,
29901,
1273,
29881,
29915,
1273,
6864,
29889,
12650,
29889,
2798,
3101,
13,
2
] |
tests/unit/__init__.py | deepakpesumalnai/Tornado_API_Python_Development_Testing | 46 | 95663 | # Copyright (c) 2020. All rights reserved.
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29900,
29889,
2178,
10462,
21676,
29889,
13,
2
] |
data-science/exercicios/livro-introducao-a-programacao-com-python/capitulo-2/exercicio2-6.py | joaovictor-loureiro/data-science | 0 | 43540 | # Exercício 2.6 - Modifique o programa da listagem 2.11, de forma que ele calcule um
# aumento de 15% para um salário de R$ 750
salario = 750.00
taxa_aumento = 0.15
aumento = salario * taxa_aumento
novo_salario = salario + aumento
print('\nSálario de R$750.00 + aumento de 15' + '% = ' + 'R$%.2f\n' % (novo_salario)) | [
1,
396,
1222,
6269,
24394,
29871,
29906,
29889,
29953,
448,
3382,
22781,
288,
16914,
1146,
1051,
13904,
29871,
29906,
29889,
29896,
29896,
29892,
316,
5954,
712,
4552,
22235,
1297,
1922,
13,
29937,
19291,
29877,
316,
29871,
29896,
29945,
29995,
1702,
1922,
4497,
12288,
316,
390,
29938,
29871,
29955,
29945,
29900,
13,
13,
19585,
2628,
353,
29871,
29955,
29945,
29900,
29889,
29900,
29900,
13,
941,
17367,
29918,
585,
358,
29877,
353,
29871,
29900,
29889,
29896,
29945,
13,
585,
358,
29877,
353,
4497,
2628,
334,
8818,
29874,
29918,
585,
358,
29877,
13,
29876,
6962,
29918,
19585,
2628,
353,
4497,
2628,
718,
19291,
29877,
13,
13,
2158,
28909,
29876,
29903,
2464,
2628,
316,
390,
29938,
29955,
29945,
29900,
29889,
29900,
29900,
718,
19291,
29877,
316,
29871,
29896,
29945,
29915,
718,
14210,
353,
525,
718,
525,
29934,
29938,
15543,
29906,
29888,
29905,
29876,
29915,
1273,
313,
29876,
6962,
29918,
19585,
2628,
876,
2
] |
03.py | SnowWolf75/aoc-2020 | 0 | 5759 | #!/usr/bin/env python3
import sys, os
import unittest
from lib.common import *
filename = "inputs/2020_12_03_input.txt"
class day03:
def __init__(self):
pass
class day03part1(day03):
def solve(self, args):
pass
class day03part2(day03):
def solve(self, args):
pass
class examples(unittest.TestCase):
def test_examples_part1(self):
day3 = day03part1()
# self.assetTrue()
def test_examples_part2(self):
day3 = day03part2()
# self.assetTrue()
class solutions(unittest.TestCase):
def test_part1(self):
day3 = day03part1()
def test_part2(self):
day3 = day03part2()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
10876,
29892,
2897,
13,
5215,
443,
27958,
13,
3166,
4303,
29889,
9435,
1053,
334,
13,
13,
9507,
353,
376,
2080,
29879,
29914,
29906,
29900,
29906,
29900,
29918,
29896,
29906,
29918,
29900,
29941,
29918,
2080,
29889,
3945,
29908,
13,
1990,
2462,
29900,
29941,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
2462,
29900,
29941,
1595,
29896,
29898,
3250,
29900,
29941,
1125,
13,
1678,
822,
4505,
29898,
1311,
29892,
6389,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
2462,
29900,
29941,
1595,
29906,
29898,
3250,
29900,
29941,
1125,
13,
1678,
822,
4505,
29898,
1311,
29892,
6389,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
6455,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
19057,
29918,
1595,
29896,
29898,
1311,
1125,
13,
4706,
2462,
29941,
353,
2462,
29900,
29941,
1595,
29896,
580,
13,
4706,
396,
1583,
29889,
24129,
5574,
580,
13,
13,
1678,
822,
1243,
29918,
19057,
29918,
1595,
29906,
29898,
1311,
1125,
13,
4706,
2462,
29941,
353,
2462,
29900,
29941,
1595,
29906,
580,
13,
4706,
396,
1583,
29889,
24129,
5574,
580,
13,
13,
13,
1990,
6851,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
1595,
29896,
29898,
1311,
1125,
13,
4706,
2462,
29941,
353,
2462,
29900,
29941,
1595,
29896,
580,
13,
13,
1678,
822,
1243,
29918,
1595,
29906,
29898,
1311,
1125,
13,
4706,
2462,
29941,
353,
2462,
29900,
29941,
1595,
29906,
580,
13,
13,
2
] |
helpers.py | robbiemu/Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming | 0 | 83298 | from collections import namedtuple, defaultdict
Edge = namedtuple('Edge', ['left', 'right', 'cost'])
Adjacency = namedtuple('Adjacency', ['to', 'cost'])
PrioritizedItem = namedtuple('PrioritizedItem', ['priority', 'item'])
def indices(l):
return [i for i in range(len(l))]
def process_weighted_edges(data):
v = []
for edge in data.split(b'\n'):
sa = edge.decode('utf-8').split(' ')
if len(sa) > 2:
v.append(Edge(left=int(sa[0]), right=int(sa[1]), cost=int(sa[2])))
return v
def undirected_graph_of_weighted_edges(edges):
graph = defaultdict(list)
for r in edges:
graph[r.left].append( Adjacency(to=r.right, cost=r.cost) )
graph[r.right].append( Adjacency(to=r.left, cost=r.cost) )
return graph
def flatten(t):
return [item for sublist in t for item in sublist]
def obfuscate(value):
with open('values.p', 'a') as fp:
fp.write(str(value) + '\n') | [
1,
515,
16250,
1053,
4257,
23583,
29892,
2322,
8977,
13,
13,
23894,
353,
4257,
23583,
877,
23894,
742,
6024,
1563,
742,
525,
1266,
742,
525,
18253,
11287,
13,
3253,
29926,
562,
3819,
353,
4257,
23583,
877,
3253,
29926,
562,
3819,
742,
6024,
517,
742,
525,
18253,
11287,
13,
29925,
13479,
277,
1891,
2001,
353,
4257,
23583,
877,
29925,
13479,
277,
1891,
2001,
742,
6024,
29886,
21766,
742,
525,
667,
11287,
13,
13,
1753,
16285,
29898,
29880,
1125,
13,
29871,
736,
518,
29875,
363,
474,
297,
3464,
29898,
2435,
29898,
29880,
28166,
13,
13,
1753,
1889,
29918,
7915,
287,
29918,
287,
2710,
29898,
1272,
1125,
13,
29871,
325,
353,
5159,
13,
29871,
363,
7636,
297,
848,
29889,
5451,
29898,
29890,
12764,
29876,
29374,
13,
1678,
872,
353,
7636,
29889,
13808,
877,
9420,
29899,
29947,
2824,
5451,
877,
25710,
13,
1678,
565,
7431,
29898,
4977,
29897,
1405,
29871,
29906,
29901,
13,
4706,
325,
29889,
4397,
29898,
23894,
29898,
1563,
29922,
524,
29898,
4977,
29961,
29900,
11724,
1492,
29922,
524,
29898,
4977,
29961,
29896,
11724,
3438,
29922,
524,
29898,
4977,
29961,
29906,
29962,
4961,
13,
29871,
736,
325,
13,
13,
1753,
563,
1088,
287,
29918,
4262,
29918,
974,
29918,
7915,
287,
29918,
287,
2710,
29898,
287,
2710,
1125,
13,
29871,
3983,
353,
2322,
8977,
29898,
1761,
29897,
13,
29871,
363,
364,
297,
12770,
29901,
13,
1678,
3983,
29961,
29878,
29889,
1563,
1822,
4397,
29898,
2087,
29926,
562,
3819,
29898,
517,
29922,
29878,
29889,
1266,
29892,
3438,
29922,
29878,
29889,
18253,
29897,
1723,
13,
1678,
3983,
29961,
29878,
29889,
1266,
1822,
4397,
29898,
2087,
29926,
562,
3819,
29898,
517,
29922,
29878,
29889,
1563,
29892,
3438,
29922,
29878,
29889,
18253,
29897,
1723,
13,
29871,
736,
3983,
13,
13,
1753,
1652,
8606,
29898,
29873,
1125,
13,
1678,
736,
518,
667,
363,
1014,
1761,
297,
260,
363,
2944,
297,
1014,
1761,
29962,
13,
13,
1753,
704,
29888,
22142,
403,
29898,
1767,
1125,
13,
29871,
411,
1722,
877,
5975,
29889,
29886,
742,
525,
29874,
1495,
408,
285,
29886,
29901,
13,
1678,
285,
29886,
29889,
3539,
29898,
710,
29898,
1767,
29897,
718,
11297,
29876,
1495,
2
] |
4-motokimura/code/tools/track_polys.py | remtav/SpaceNet7_Multi-Temporal_Solutions | 38 | 165136 | #!/usr/bin/env python3
import multiprocessing as mp
import os
import timeit
import pandas as pd
import _init_path
from spacenet7_model.configs import load_config
from spacenet7_model.utils import (convert_geojsons_to_csv, ensemble_subdir,
get_subdirs, interpolate_polys, map_wrapper,
remove_polygon_empty_row_if_polygon_exists,
solution_filename,
track_footprint_identifiers)
from tqdm import tqdm
if __name__ == '__main__':
t0 = timeit.default_timer()
config = load_config()
assert len(config.ENSEMBLE_EXP_IDS) >= 1
subdir = ensemble_subdir(config.ENSEMBLE_EXP_IDS)
input_root = os.path.join(config.POLY_ROOT, subdir)
aois = get_subdirs(input_root)
# prepare json and output directories
tracked_poly_root = os.path.join(config.TRACKED_POLY_ROOT, subdir)
os.makedirs(tracked_poly_root, exist_ok=False)
if config.SOLUTION_OUTPUT_PATH and config.SOLUTION_OUTPUT_PATH != 'none':
# only for deployment phase
out_path = config.SOLUTION_OUTPUT_PATH
else:
out_path = os.path.join(tracked_poly_root, solution_filename())
# some parameters
verbose = True
super_verbose = False
n_thread = config.TRACKING_NUM_THREADS
n_thread = n_thread if n_thread > 0 else mp.cpu_count()
print(f'N_thread for multiprocessing: {n_thread}')
# track footprint and save the results as geojson files
# prepare args and output directories
input_args = []
for i, aoi in enumerate(aois):
json_dir = os.path.join(tracked_poly_root, aoi)
os.makedirs(json_dir, exist_ok=False)
input_dir = os.path.join(input_root, aoi)
input_args.append([
track_footprint_identifiers, config, input_dir, json_dir, verbose,
super_verbose
])
# run multiprocessing
with mp.Pool(processes=n_thread) as pool:
with tqdm(total=len(input_args)) as t:
for _ in pool.imap_unordered(map_wrapper, input_args):
t.update(1)
# convert the geojson files into a dataframe
json_dirs = [
os.path.join(tracked_poly_root, aoi)
for aoi in get_subdirs(tracked_poly_root)
]
solution_df = convert_geojsons_to_csv(json_dirs,
output_csv_path=None,
population='proposal')
solution_df = pd.DataFrame(solution_df) # GeoDataFrame to DataFrame
# interpolate master polys
if config.TRACKING_ENABLE_POST_INTERPOLATION:
print('running post interpolation. this may take ~10 min...')
# XXX: SN7 train dir is hard coded...
test_root = '/data/spacenet7/spacenet7/train' if config.TEST_TO_VAL else config.INPUT.TEST_DIR
# prepare args and output directories
input_args = []
for aoi in aois:
aoi_mask = solution_df.filename.str.endswith(aoi)
solution_df_aoi = solution_df[aoi_mask]
input_args.append([
interpolate_polys, aoi, solution_df_aoi, tracked_poly_root,
test_root
])
# run multiprocessing
pool = mp.Pool(processes=n_thread)
polys_to_interpolate_tmp = pool.map(map_wrapper, input_args)
pool.close()
# do interpolation
polys_to_interpolate = []
for polys in polys_to_interpolate_tmp:
polys_to_interpolate.extend(polys)
polys_to_interpolate = pd.DataFrame(polys_to_interpolate)
solution_df = solution_df.append(polys_to_interpolate)
# remove "POLYGON EMPTY" row if needed
solution_df = remove_polygon_empty_row_if_polygon_exists(solution_df)
print('saving solution csv file...')
solution_df.to_csv(out_path, index=False)
print(f'saved solution csv to {out_path}')
elapsed = timeit.default_timer() - t0
print('Time: {:.3f} min'.format(elapsed / 60.0))
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
6674,
307,
985,
292,
408,
22326,
13,
5215,
2897,
13,
5215,
931,
277,
13,
13,
5215,
11701,
408,
10518,
13,
13,
5215,
903,
2344,
29918,
2084,
13,
3166,
26325,
264,
300,
29955,
29918,
4299,
29889,
2917,
29879,
1053,
2254,
29918,
2917,
13,
3166,
26325,
264,
300,
29955,
29918,
4299,
29889,
13239,
1053,
313,
13441,
29918,
24756,
1315,
787,
29918,
517,
29918,
7638,
29892,
21285,
29918,
1491,
3972,
29892,
13,
462,
462,
259,
679,
29918,
1491,
3972,
29879,
29892,
20064,
403,
29918,
3733,
952,
29892,
2910,
29918,
17699,
29892,
13,
462,
462,
259,
3349,
29918,
3733,
17125,
29918,
6310,
29918,
798,
29918,
361,
29918,
3733,
17125,
29918,
9933,
29892,
13,
462,
462,
259,
1650,
29918,
9507,
29892,
13,
462,
462,
259,
5702,
29918,
6661,
2158,
29918,
1693,
14903,
29897,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
260,
29900,
353,
931,
277,
29889,
4381,
29918,
20404,
580,
13,
13,
1678,
2295,
353,
2254,
29918,
2917,
580,
13,
13,
1678,
4974,
7431,
29898,
2917,
29889,
1430,
1660,
9486,
1307,
29918,
5746,
29925,
29918,
1367,
29903,
29897,
6736,
29871,
29896,
13,
13,
1678,
1014,
3972,
353,
21285,
29918,
1491,
3972,
29898,
2917,
29889,
1430,
1660,
9486,
1307,
29918,
5746,
29925,
29918,
1367,
29903,
29897,
13,
1678,
1881,
29918,
4632,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
29889,
29925,
5607,
29979,
29918,
21289,
29892,
1014,
3972,
29897,
13,
1678,
5017,
275,
353,
679,
29918,
1491,
3972,
29879,
29898,
2080,
29918,
4632,
29897,
13,
13,
1678,
396,
19012,
4390,
322,
1962,
17525,
13,
1678,
5702,
287,
29918,
22678,
29918,
4632,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2917,
29889,
5659,
11375,
3352,
29918,
29925,
5607,
29979,
29918,
21289,
29892,
1014,
3972,
29897,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
11294,
287,
29918,
22678,
29918,
4632,
29892,
1863,
29918,
554,
29922,
8824,
29897,
13,
13,
1678,
565,
2295,
29889,
29903,
5607,
2692,
2725,
29918,
12015,
12336,
29918,
10145,
322,
2295,
29889,
29903,
5607,
2692,
2725,
29918,
12015,
12336,
29918,
10145,
2804,
525,
9290,
2396,
13,
4706,
396,
871,
363,
18209,
8576,
13,
4706,
714,
29918,
2084,
353,
2295,
29889,
29903,
5607,
2692,
2725,
29918,
12015,
12336,
29918,
10145,
13,
1678,
1683,
29901,
13,
4706,
714,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
11294,
287,
29918,
22678,
29918,
4632,
29892,
1650,
29918,
9507,
3101,
13,
13,
1678,
396,
777,
4128,
13,
1678,
26952,
353,
5852,
13,
1678,
2428,
29918,
369,
15828,
353,
7700,
13,
13,
1678,
302,
29918,
7097,
353,
2295,
29889,
5659,
11375,
4214,
29918,
13967,
29918,
4690,
16310,
29903,
13,
1678,
302,
29918,
7097,
353,
302,
29918,
7097,
565,
302,
29918,
7097,
1405,
29871,
29900,
1683,
22326,
29889,
21970,
29918,
2798,
580,
13,
1678,
1596,
29898,
29888,
29915,
29940,
29918,
7097,
363,
6674,
307,
985,
292,
29901,
426,
29876,
29918,
7097,
29913,
1495,
13,
13,
1678,
396,
5702,
3661,
2158,
322,
4078,
278,
2582,
408,
1737,
29877,
3126,
2066,
13,
1678,
396,
19012,
6389,
322,
1962,
17525,
13,
1678,
1881,
29918,
5085,
353,
5159,
13,
1678,
363,
474,
29892,
5017,
29875,
297,
26985,
29898,
6241,
275,
1125,
13,
4706,
4390,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
11294,
287,
29918,
22678,
29918,
4632,
29892,
5017,
29875,
29897,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
3126,
29918,
3972,
29892,
1863,
29918,
554,
29922,
8824,
29897,
13,
13,
4706,
1881,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2080,
29918,
4632,
29892,
5017,
29875,
29897,
13,
13,
4706,
1881,
29918,
5085,
29889,
4397,
4197,
13,
9651,
5702,
29918,
6661,
2158,
29918,
1693,
14903,
29892,
2295,
29892,
1881,
29918,
3972,
29892,
4390,
29918,
3972,
29892,
26952,
29892,
13,
9651,
2428,
29918,
369,
15828,
13,
308,
2314,
13,
13,
1678,
396,
1065,
6674,
307,
985,
292,
13,
1678,
411,
22326,
29889,
11426,
29898,
5014,
267,
29922,
29876,
29918,
7097,
29897,
408,
11565,
29901,
13,
4706,
411,
260,
29939,
18933,
29898,
7827,
29922,
2435,
29898,
2080,
29918,
5085,
876,
408,
260,
29901,
13,
9651,
363,
903,
297,
11565,
29889,
326,
481,
29918,
348,
21693,
29898,
1958,
29918,
17699,
29892,
1881,
29918,
5085,
1125,
13,
18884,
260,
29889,
5504,
29898,
29896,
29897,
13,
13,
1678,
396,
3588,
278,
1737,
29877,
3126,
2066,
964,
263,
12205,
13,
1678,
4390,
29918,
3972,
29879,
353,
518,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
11294,
287,
29918,
22678,
29918,
4632,
29892,
5017,
29875,
29897,
13,
4706,
363,
5017,
29875,
297,
679,
29918,
1491,
3972,
29879,
29898,
11294,
287,
29918,
22678,
29918,
4632,
29897,
13,
1678,
4514,
13,
1678,
1650,
29918,
2176,
353,
3588,
29918,
24756,
1315,
787,
29918,
517,
29918,
7638,
29898,
3126,
29918,
3972,
29879,
29892,
13,
462,
462,
3986,
1962,
29918,
7638,
29918,
2084,
29922,
8516,
29892,
13,
462,
462,
3986,
4665,
2433,
771,
1066,
284,
1495,
13,
1678,
1650,
29918,
2176,
353,
10518,
29889,
17271,
29898,
2929,
918,
29918,
2176,
29897,
29871,
396,
1879,
29877,
17271,
304,
3630,
4308,
13,
13,
1678,
396,
20064,
403,
5835,
1248,
952,
13,
1678,
565,
2295,
29889,
5659,
11375,
4214,
29918,
1430,
6181,
29918,
5438,
29918,
23845,
29925,
5607,
8098,
29901,
13,
4706,
1596,
877,
21094,
1400,
29694,
29889,
445,
1122,
2125,
3695,
29896,
29900,
1375,
856,
1495,
13,
13,
4706,
396,
22615,
29901,
21989,
29955,
7945,
4516,
338,
2898,
274,
6797,
856,
13,
4706,
1243,
29918,
4632,
353,
8207,
1272,
29914,
1028,
562,
264,
300,
29955,
29914,
1028,
562,
264,
300,
29955,
29914,
14968,
29915,
565,
2295,
29889,
18267,
29918,
4986,
29918,
8932,
1683,
2295,
29889,
1177,
12336,
29889,
18267,
29918,
9464,
13,
13,
4706,
396,
19012,
6389,
322,
1962,
17525,
13,
4706,
1881,
29918,
5085,
353,
5159,
13,
4706,
363,
5017,
29875,
297,
5017,
275,
29901,
13,
9651,
5017,
29875,
29918,
13168,
353,
1650,
29918,
2176,
29889,
9507,
29889,
710,
29889,
1975,
2541,
29898,
6241,
29875,
29897,
13,
9651,
1650,
29918,
2176,
29918,
6241,
29875,
353,
1650,
29918,
2176,
29961,
6241,
29875,
29918,
13168,
29962,
13,
9651,
1881,
29918,
5085,
29889,
4397,
4197,
13,
18884,
20064,
403,
29918,
3733,
952,
29892,
5017,
29875,
29892,
1650,
29918,
2176,
29918,
6241,
29875,
29892,
5702,
287,
29918,
22678,
29918,
4632,
29892,
13,
18884,
1243,
29918,
4632,
13,
632,
2314,
13,
13,
4706,
396,
1065,
6674,
307,
985,
292,
13,
4706,
11565,
353,
22326,
29889,
11426,
29898,
5014,
267,
29922,
29876,
29918,
7097,
29897,
13,
4706,
1248,
952,
29918,
517,
29918,
1639,
3733,
403,
29918,
7050,
353,
11565,
29889,
1958,
29898,
1958,
29918,
17699,
29892,
1881,
29918,
5085,
29897,
13,
4706,
11565,
29889,
5358,
580,
13,
13,
4706,
396,
437,
29694,
13,
4706,
1248,
952,
29918,
517,
29918,
1639,
3733,
403,
353,
5159,
13,
4706,
363,
1248,
952,
297,
1248,
952,
29918,
517,
29918,
1639,
3733,
403,
29918,
7050,
29901,
13,
9651,
1248,
952,
29918,
517,
29918,
1639,
3733,
403,
29889,
21843,
29898,
3733,
952,
29897,
13,
4706,
1248,
952,
29918,
517,
29918,
1639,
3733,
403,
353,
10518,
29889,
17271,
29898,
3733,
952,
29918,
517,
29918,
1639,
3733,
403,
29897,
13,
4706,
1650,
29918,
2176,
353,
1650,
29918,
2176,
29889,
4397,
29898,
3733,
952,
29918,
517,
29918,
1639,
3733,
403,
29897,
13,
13,
4706,
396,
3349,
376,
29925,
5607,
29979,
29954,
1164,
382,
3580,
15631,
29908,
1948,
565,
4312,
13,
4706,
1650,
29918,
2176,
353,
3349,
29918,
3733,
17125,
29918,
6310,
29918,
798,
29918,
361,
29918,
3733,
17125,
29918,
9933,
29898,
2929,
918,
29918,
2176,
29897,
13,
13,
1678,
1596,
877,
29879,
5555,
1650,
11799,
934,
856,
1495,
13,
1678,
1650,
29918,
2176,
29889,
517,
29918,
7638,
29898,
449,
29918,
2084,
29892,
2380,
29922,
8824,
29897,
13,
1678,
1596,
29898,
29888,
29915,
17314,
1650,
11799,
304,
426,
449,
29918,
2084,
29913,
1495,
13,
13,
1678,
560,
28170,
353,
931,
277,
29889,
4381,
29918,
20404,
580,
448,
260,
29900,
13,
1678,
1596,
877,
2481,
29901,
12365,
29889,
29941,
29888,
29913,
1375,
4286,
4830,
29898,
295,
28170,
847,
29871,
29953,
29900,
29889,
29900,
876,
13,
2
] |
year-2021/day-19/part-1.py | sdatko/advent-of-code | 4 | 151403 | #!/usr/bin/env python3
#
# --- Day 19: Beacon Scanner ---
#
# As your probe drifted down through this area, it released an assortment
# of beacons and scanners into the water. It's difficult to navigate in the
# pitch black open waters of the ocean trench, but if you can build a map
# of the trench using data from the scanners, you should be able to safely
# reach the bottom.
#
# The beacons and scanners float motionless in the water; they're designed
# to maintain the same position for long periods of time. Each scanner is
# capable of detecting all beacons in a large cube centered on the scanner;
# beacons that are at most 1000 units away from the scanner in each of the
# three axes (x, y, and z) have their precise position determined relative
# to the scanner. However, scanners cannot detect other scanners. The submarin
# has automatically summarized the relative positions of beacons detected
# by each scanner (your puzzle input).
#
# For example, if a scanner is at x,y,z coordinates 500,0,-500 and there are
# beacons at -500,1000,-1500 and 1501,0,-500, the scanner could report that
# the first beacon is at -1000,1000,-1000 (relative to the scanner) but would
# not detect the second beacon at all.
#
# Unfortunately, while each scanner can report the positions of all detected
# beacons relative to itself, the scanners do not know their own position.
# You'll need to determine the positions of the beacons and scanners yourself.
#
# The scanners and beacons map a single contiguous 3d region. This region can
# be reconstructed by finding pairs of scanners that have overlapping detection
# regions such that there are at least 12 beacons that both scanners detect
# within the overlap. By establishing 12 common beacons, you can precisely
# determine where the scanners are relative to each other, allowing you
# to reconstruct the beacon map one scanner at a time.
#
# For a moment, consider only two dimensions. Suppose you have the following
# scanner reports:
# --- scanner 0 ---
# 0,2
# 4,1
# 3,3
#
# --- scanner 1 ---
# -1,-1
# -5,0
# -2,1
#
# Drawing x increasing rightward, y increasing upward, scanners as S,
# and beacons as B, scanner 0 detects this:
# ...B.
# B....
# ....B
# S....
#
# Scanner 1 detects this:
# ...B..
# B....S
# ....B.
#
# For this example, assume scanners only need 3 overlapping beacons. Then,
# the beacons visible to both scanners overlap to produce the following
# complete map:
# ...B..
# B....S
# ....B.
# S.....
#
# Unfortunately, there's a second problem: the scanners also don't know their
# rotation or facing direction. Due to magnetic alignment, each scanner is
# rotated some integer number of 90-degree turns around all of the x, y, and z
# axes. That is, one scanner might call a direction positive x, while another
# scanner might call that direction negative y. Or, two scanners might agree
# on which direction is positive x, but one scanner might be upside-down from
# the perspective of the other scanner. In total, each scanner could be in any
# of 24 different orientations: facing positive or negative x, y, or z, and
# considering any of four directions "up" from that facing.
#
# For example, here is an arrangement of beacons as seen from a scanner in the
# same position but in different orientations:
# --- scanner 0 ---
# -1,-1,1
# -2,-2,2
# -3,-3,3
# -2,-3,1
# 5,6,-4
# 8,0,7
#
# --- scanner 0 ---
# 1,-1,1
# 2,-2,2
# 3,-3,3
# 2,-1,3
# -5,4,-6
# -8,-7,0
#
# --- scanner 0 ---
# -1,-1,-1
# -2,-2,-2
# -3,-3,-3
# -1,-3,-2
# 4,6,5
# -7,0,8
#
# --- scanner 0 ---
# 1,1,-1
# 2,2,-2
# 3,3,-3
# 1,3,-2
# -4,-6,5
# 7,0,8
#
# --- scanner 0 ---
# 1,1,1
# 2,2,2
# 3,3,3
# 3,1,2
# -6,-4,-5
# 0,7,-8
#
# By finding pairs of scanners that both see at least 12 of the same beacons,
# you can assemble the entire map. For example, consider the following report:
# --- scanner 0 ---
# 404,-588,-901
# 528,-643,409
# -838,591,734
# 390,-675,-793
# -537,-823,-458
# -485,-357,347
# -345,-311,381
# -661,-816,-575
# -876,649,763
# -618,-824,-621
# 553,345,-567
# 474,580,667
# -447,-329,318
# -584,868,-557
# 544,-627,-890
# 564,392,-477
# 455,729,728
# -892,524,684
# -689,845,-530
# 423,-701,434
# 7,-33,-71
# 630,319,-379
# 443,580,662
# -789,900,-551
# 459,-707,401
#
# --- scanner 1 ---
# 686,422,578
# 605,423,415
# 515,917,-361
# -336,658,858
# 95,138,22
# -476,619,847
# -340,-569,-846
# 567,-361,727
# -460,603,-452
# 669,-402,600
# 729,430,532
# -500,-761,534
# -322,571,750
# -466,-666,-811
# -429,-592,574
# -355,545,-477
# 703,-491,-529
# -328,-685,520
# 413,935,-424
# -391,539,-444
# 586,-435,557
# -364,-763,-893
# 807,-499,-711
# 755,-354,-619
# 553,889,-390
#
# --- scanner 2 ---
# 649,640,665
# 682,-795,504
# -784,533,-524
# -644,584,-595
# -588,-843,648
# -30,6,44
# -674,560,763
# 500,723,-460
# 609,671,-379
# -555,-800,653
# -675,-892,-343
# 697,-426,-610
# 578,704,681
# 493,664,-388
# -671,-858,530
# -667,343,800
# 571,-461,-707
# -138,-166,112
# -889,563,-600
# 646,-828,498
# 640,759,510
# -630,509,768
# -681,-892,-333
# 673,-379,-804
# -742,-814,-386
# 577,-820,562
#
# --- scanner 3 ---
# -589,542,597
# 605,-692,669
# -500,565,-823
# -660,373,557
# -458,-679,-417
# -488,449,543
# -626,468,-788
# 338,-750,-386
# 528,-832,-391
# 562,-778,733
# -938,-730,414
# 543,643,-506
# -524,371,-870
# 407,773,750
# -104,29,83
# 378,-903,-323
# -778,-728,485
# 426,699,580
# -438,-605,-362
# -469,-447,-387
# 509,732,623
# 647,635,-688
# -868,-804,481
# 614,-800,639
# 595,780,-596
#
# --- scanner 4 ---
# 727,592,562
# -293,-554,779
# 441,611,-461
# -714,465,-776
# -743,427,-804
# -660,-479,-426
# 832,-632,460
# 927,-485,-438
# 408,393,-506
# 466,436,-512
# 110,16,151
# -258,-428,682
# -393,719,612
# -211,-452,876
# 808,-476,-593
# -575,615,604
# -485,667,467
# -680,325,-822
# -627,-443,-432
# 872,-547,-609
# 833,512,582
# 807,604,487
# 839,-516,451
# 891,-625,532
# -652,-548,-490
# 30,-46,-14
#
# Because all coordinates are relative, in this example, all "absolute"
# positions will be expressed relative to scanner 0 (using the orientation
# of scanner 0 and as if scanner 0 is at coordinates 0,0,0).
#
# Scanners 0 and 1 have overlapping detection cubes; the 12 beacons they both
# detect (relative to scanner 0) are at the following coordinates:
# -618,-824,-621
# -537,-823,-458
# -447,-329,318
# 404,-588,-901
# 544,-627,-890
# 528,-643,409
# -661,-816,-575
# 390,-675,-793
# 423,-701,434
# -345,-311,381
# 459,-707,401
# -485,-357,347
#
# These same 12 beacons (in the same order) but from the perspective
# of scanner 1 are:
# 686,422,578
# 605,423,415
# 515,917,-361
# -336,658,858
# -476,619,847
# -460,603,-452
# 729,430,532
# -322,571,750
# -355,545,-477
# 413,935,-424
# -391,539,-444
# 553,889,-390
#
# Because of this, scanner 1 must be at 68,-1246,-43 (relative to scanner 0).
#
# Scanner 4 overlaps with scanner 1; the 12 beacons they both detect
# (relative to scanner 0) are:
# 459,-707,401
# -739,-1745,668
# -485,-357,347
# 432,-2009,850
# 528,-643,409
# 423,-701,434
# -345,-311,381
# 408,-1815,803
# 534,-1912,768
# -687,-1600,576
# -447,-329,318
# -635,-1737,486
#
# So, scanner 4 is at -20,-1133,1061 (relative to scanner 0).
#
# Following this process, scanner 2 must be at 1105,-1205,1229 (relative
# to scanner 0) and scanner 3 must be at -92,-2380,-20 (relative to scanner 0).
#
# The full list of beacons (relative to scanner 0) is:
# -892,524,684
# -876,649,763
# -838,591,734
# -789,900,-551
# -739,-1745,668
# -706,-3180,-659
# -697,-3072,-689
# -689,845,-530
# -687,-1600,576
# -661,-816,-575
# -654,-3158,-753
# -635,-1737,486
# -631,-672,1502
# -624,-1620,1868
# -620,-3212,371
# -618,-824,-621
# -612,-1695,1788
# -601,-1648,-643
# -584,868,-557
# -537,-823,-458
# -532,-1715,1894
# -518,-1681,-600
# -499,-1607,-770
# -485,-357,347
# -470,-3283,303
# -456,-621,1527
# -447,-329,318
# -430,-3130,366
# -413,-627,1469
# -345,-311,381
# -36,-1284,1171
# -27,-1108,-65
# 7,-33,-71
# 12,-2351,-103
# 26,-1119,1091
# 346,-2985,342
# 366,-3059,397
# 377,-2827,367
# 390,-675,-793
# 396,-1931,-563
# 404,-588,-901
# 408,-1815,803
# 423,-701,434
# 432,-2009,850
# 443,580,662
# 455,729,728
# 456,-540,1869
# 459,-707,401
# 465,-695,1988
# 474,580,667
# 496,-1584,1900
# 497,-1838,-617
# 527,-524,1933
# 528,-643,409
# 534,-1912,768
# 544,-627,-890
# 553,345,-567
# 564,392,-477
# 568,-2007,-577
# 605,-1665,1952
# 612,-1593,1893
# 630,319,-379
# 686,-3108,-505
# 776,-3184,-501
# 846,-3110,-434
# 1135,-1161,1235
# 1243,-1093,1063
# 1660,-552,429
# 1693,-557,386
# 1735,-437,1738
# 1749,-1800,1813
# 1772,-405,1572
# 1776,-675,371
# 1779,-442,1789
# 1780,-1548,337
# 1786,-1538,337
# 1847,-1591,415
# 1889,-1729,1762
# 1994,-1805,1792
#
# In total, there are 79 beacons.
#
# Assemble the full map of beacons. How many beacons are there?
#
#
# --- Solution ---
#
# We start by reading the input file and splitting it by single empty line.
# Then for each entry we drop the first line (header with scanner identifier)
# and map remaining to list of integers (the coordinates). Then we produce
# a set of all possible rotations about X, Y and Z axes – for this we implement
# the rotation equations from the matrix forms and other helper functions.
# Ultimately this set gives us all unique transformations we can perform:
# how to remap the indexes and flip the axes. For example a tuple: ((1, 0, 2),
# (-1, 1, -1)) describes we should put Y (1) as first index, X (0) as second,
# Z (2) as third and invert the first and last element in final vector.
# Next we take a single set of readings from scanners and we treat it as our
# base with origin/reference point (0, 0, 0). Then in a loop, as long as there
# are some unmapped scanners, we attempt to find a transformations that will
# cause some readings to overlap in at least 12 points. To find a mapping for
# a given scanner, we consider all possible rotations of a scanner beacon
# readings and then we compute the translation vectors between each rotated
# beacon position and each already mapped (known/recognized/unique) beacon.
# Finally for each of translations we produce a set of translated beacons
# positions and we get an intersection of this set and our set of already
# mapped beacons (i.e. we find a list of all common elements between two sets)
# – if there are at least 12 common elements, we found the proper translation
# that allows us to join the sets and recognize new beacons positions by simply
# adding two sets (an union operation). In the end we remove the just mapped
# scanner from the list and start this procedure again for all remaining
# scanners, every time with a bigger set of identified unique beacons.
# As an answer, we print the length of generated set after there are no more
# unmapped scanners.
#
INPUT_FILE = 'input.txt'
def sin(angle):
angle %= 360
if angle == 0 or angle == 180:
return 0
elif angle == 90:
return 1
elif angle == 270:
return -1
raise ValueError('Only the multiples of the right angle are supported.')
def cos(angle):
return sin(angle + 90)
def rotation_x(angle, vec):
return [
vec[0],
cos(angle) * vec[1] + -sin(angle) * vec[2],
sin(angle) * vec[1] + cos(angle) * vec[2],
]
def rotation_y(angle, vec):
return [
cos(angle) * vec[0] + sin(angle) * vec[2],
vec[1],
-sin(angle) * vec[0] + cos(angle) * vec[2],
]
def rotation_z(angle, vec):
return [
cos(angle) * vec[0] + -sin(angle) * vec[1],
sin(angle) * vec[0] + cos(angle) * vec[1],
vec[2],
]
def rotation_xyz(angle_x, angle_y, angle_z, vec):
return rotation_z(angle_z, rotation_y(angle_y, rotation_x(angle_x, vec)))
def abs(value):
if value >= 0:
return value
else:
return -value
def sign(value):
if value >= 0:
return 1
elif value < 0:
return -1
def main():
with open(INPUT_FILE, 'r') as file:
scanners = file.read().strip().split('\n\n')
for i, scanner in enumerate(scanners):
scanners[i] = [tuple(map(int, line.split(',')))
for line in scanner.split('\n')[1:]]
rotations = set()
transformations = set()
for angle1 in [0, 90, 180, 270]:
for angle2 in [0, 90, 180, 270]:
for angle3 in [0, 90, 180, 270]:
vec = rotation_xyz(angle1, angle2, angle3, [1, 2, 3])
rotations.add(tuple(vec))
for transformation in rotations:
indexes = tuple([abs(component) - 1 for component in transformation])
signs = tuple([sign(component) for component in transformation])
transformations.add((indexes, signs))
known = set(scanners.pop(0)) # first scanner is our origin point (0, 0, 0)
while scanners:
matched = False
for scanner in scanners:
for transformation in transformations:
indexes, signs = transformation
nx, ny, nz = indexes
s1, s2, s3 = signs
rotated = [(s1 * beacon[nx], s2 * beacon[ny], s3 * beacon[nz])
for beacon in scanner]
for reading in known:
for beacon in rotated:
dx, dy, dz = [b_i - r_i
for b_i, r_i in zip(beacon, reading)]
translated = set([(x - dx, y - dy, z - dz)
for candidate in rotated
for x, y, z in [candidate]])
common_points = known.intersection(translated)
if len(common_points) >= 12:
known = known.union(translated)
matched = True
break
if matched:
break
if matched:
break
if matched:
break
if matched:
scanners.remove(scanner)
else:
print('Went through all, no match – something is wrong!')
break
print(len(known))
if __name__ == '__main__':
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
13,
29937,
11474,
8373,
29871,
29896,
29929,
29901,
1522,
23074,
23412,
11474,
13,
29937,
13,
29937,
1094,
596,
410,
915,
4192,
2027,
287,
1623,
1549,
445,
4038,
29892,
372,
5492,
385,
1223,
441,
358,
13,
29937,
310,
367,
29874,
3200,
322,
885,
812,
414,
964,
278,
4094,
29889,
739,
29915,
29879,
5189,
304,
23624,
297,
278,
13,
29937,
15905,
4628,
1722,
19922,
310,
278,
23474,
20639,
305,
29892,
541,
565,
366,
508,
2048,
263,
2910,
13,
29937,
310,
278,
20639,
305,
773,
848,
515,
278,
885,
812,
414,
29892,
366,
881,
367,
2221,
304,
23511,
13,
29937,
6159,
278,
5970,
29889,
13,
29937,
13,
29937,
450,
367,
29874,
3200,
322,
885,
812,
414,
5785,
10884,
2222,
297,
278,
4094,
29936,
896,
29915,
276,
8688,
13,
29937,
304,
7344,
278,
1021,
2602,
363,
1472,
23704,
310,
931,
29889,
7806,
885,
7310,
338,
13,
29937,
15390,
310,
6459,
292,
599,
367,
29874,
3200,
297,
263,
2919,
28704,
24764,
373,
278,
885,
7310,
29936,
13,
29937,
367,
29874,
3200,
393,
526,
472,
1556,
29871,
29896,
29900,
29900,
29900,
10340,
3448,
515,
278,
885,
7310,
297,
1269,
310,
278,
13,
29937,
2211,
27815,
313,
29916,
29892,
343,
29892,
322,
503,
29897,
505,
1009,
18378,
2602,
10087,
6198,
13,
29937,
304,
278,
885,
7310,
29889,
2398,
29892,
885,
812,
414,
2609,
6459,
916,
885,
812,
414,
29889,
450,
1014,
3034,
262,
13,
29937,
756,
6336,
19138,
1891,
278,
6198,
11909,
310,
367,
29874,
3200,
17809,
13,
29937,
491,
1269,
885,
7310,
313,
8066,
20285,
280,
1881,
467,
13,
29937,
13,
29937,
1152,
1342,
29892,
565,
263,
885,
7310,
338,
472,
921,
29892,
29891,
29892,
29920,
10350,
29871,
29945,
29900,
29900,
29892,
29900,
6653,
29945,
29900,
29900,
322,
727,
526,
13,
29937,
367,
29874,
3200,
472,
448,
29945,
29900,
29900,
29892,
29896,
29900,
29900,
29900,
6653,
29896,
29945,
29900,
29900,
322,
29871,
29896,
29945,
29900,
29896,
29892,
29900,
6653,
29945,
29900,
29900,
29892,
278,
885,
7310,
1033,
3461,
393,
13,
29937,
278,
937,
367,
23074,
338,
472,
448,
29896,
29900,
29900,
29900,
29892,
29896,
29900,
29900,
29900,
6653,
29896,
29900,
29900,
29900,
313,
22925,
304,
278,
885,
7310,
29897,
541,
723,
13,
29937,
451,
6459,
278,
1473,
367,
23074,
472,
599,
29889,
13,
29937,
13,
29937,
11511,
29892,
1550,
1269,
885,
7310,
508,
3461,
278,
11909,
310,
599,
17809,
13,
29937,
367,
29874,
3200,
6198,
304,
3528,
29892,
278,
885,
812,
414,
437,
451,
1073,
1009,
1914,
2602,
29889,
13,
29937,
887,
29915,
645,
817,
304,
8161,
278,
11909,
310,
278,
367,
29874,
3200,
322,
885,
812,
414,
7535,
29889,
13,
29937,
13,
29937,
450,
885,
812,
414,
322,
367,
29874,
3200,
2910,
263,
2323,
640,
5526,
681,
29871,
29941,
29881,
5120,
29889,
910,
5120,
508,
13,
29937,
367,
337,
11433,
287,
491,
9138,
11000,
310,
885,
812,
414,
393,
505,
975,
433,
3262,
15326,
13,
29937,
12786,
1316,
393,
727,
526,
472,
3203,
29871,
29896,
29906,
367,
29874,
3200,
393,
1716,
885,
812,
414,
6459,
13,
29937,
2629,
278,
25457,
29889,
2648,
10127,
292,
29871,
29896,
29906,
3619,
367,
29874,
3200,
29892,
366,
508,
17503,
13,
29937,
8161,
988,
278,
885,
812,
414,
526,
6198,
304,
1269,
916,
29892,
14372,
366,
13,
29937,
304,
337,
11433,
278,
367,
23074,
2910,
697,
885,
7310,
472,
263,
931,
29889,
13,
29937,
13,
29937,
1152,
263,
3256,
29892,
2050,
871,
1023,
13391,
29889,
12142,
366,
505,
278,
1494,
13,
29937,
885,
7310,
13676,
29901,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
1678,
29900,
29892,
29906,
13,
29937,
1678,
29946,
29892,
29896,
13,
29937,
1678,
29941,
29892,
29941,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29896,
11474,
13,
29937,
259,
448,
29896,
6653,
29896,
13,
29937,
259,
448,
29945,
29892,
29900,
13,
29937,
259,
448,
29906,
29892,
29896,
13,
29937,
13,
29937,
18492,
292,
921,
10231,
1492,
1328,
29892,
343,
10231,
701,
1328,
29892,
885,
812,
414,
408,
317,
29892,
13,
29937,
322,
367,
29874,
3200,
408,
350,
29892,
885,
7310,
29871,
29900,
6459,
29879,
445,
29901,
13,
29937,
259,
2023,
29933,
29889,
13,
29937,
259,
350,
3045,
13,
29937,
259,
13035,
29933,
13,
29937,
259,
317,
3045,
13,
29937,
13,
29937,
23412,
29871,
29896,
6459,
29879,
445,
29901,
13,
29937,
259,
2023,
29933,
636,
13,
29937,
259,
350,
3045,
29903,
13,
29937,
259,
13035,
29933,
29889,
13,
29937,
13,
29937,
1152,
445,
1342,
29892,
5251,
885,
812,
414,
871,
817,
29871,
29941,
975,
433,
3262,
367,
29874,
3200,
29889,
1987,
29892,
13,
29937,
278,
367,
29874,
3200,
7962,
304,
1716,
885,
812,
414,
25457,
304,
7738,
278,
1494,
13,
29937,
4866,
2910,
29901,
13,
29937,
259,
2023,
29933,
636,
13,
29937,
259,
350,
3045,
29903,
13,
29937,
259,
13035,
29933,
29889,
13,
29937,
259,
317,
18598,
13,
29937,
13,
29937,
11511,
29892,
727,
29915,
29879,
263,
1473,
1108,
29901,
278,
885,
812,
414,
884,
1016,
29915,
29873,
1073,
1009,
13,
29937,
13733,
470,
14870,
5305,
29889,
16809,
304,
15611,
22239,
29892,
1269,
885,
7310,
338,
13,
29937,
5731,
630,
777,
6043,
1353,
310,
29871,
29929,
29900,
29899,
12163,
929,
12169,
2820,
599,
310,
278,
921,
29892,
343,
29892,
322,
503,
13,
29937,
27815,
29889,
2193,
338,
29892,
697,
885,
7310,
1795,
1246,
263,
5305,
6374,
921,
29892,
1550,
1790,
13,
29937,
885,
7310,
1795,
1246,
393,
5305,
8178,
343,
29889,
1394,
29892,
1023,
885,
812,
414,
1795,
8661,
13,
29937,
373,
607,
5305,
338,
6374,
921,
29892,
541,
697,
885,
7310,
1795,
367,
24081,
680,
29899,
3204,
515,
13,
29937,
278,
18520,
310,
278,
916,
885,
7310,
29889,
512,
3001,
29892,
1269,
885,
7310,
1033,
367,
297,
738,
13,
29937,
310,
29871,
29906,
29946,
1422,
7769,
800,
29901,
14870,
6374,
470,
8178,
921,
29892,
343,
29892,
470,
503,
29892,
322,
13,
29937,
13858,
738,
310,
3023,
18112,
376,
786,
29908,
515,
393,
14870,
29889,
13,
29937,
13,
29937,
1152,
1342,
29892,
1244,
338,
385,
24628,
310,
367,
29874,
3200,
408,
3595,
515,
263,
885,
7310,
297,
278,
13,
29937,
1021,
2602,
541,
297,
1422,
7769,
800,
29901,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
259,
448,
29896,
6653,
29896,
29892,
29896,
13,
29937,
259,
448,
29906,
6653,
29906,
29892,
29906,
13,
29937,
259,
448,
29941,
6653,
29941,
29892,
29941,
13,
29937,
259,
448,
29906,
6653,
29941,
29892,
29896,
13,
29937,
1678,
29945,
29892,
29953,
6653,
29946,
13,
29937,
1678,
29947,
29892,
29900,
29892,
29955,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
1678,
29896,
6653,
29896,
29892,
29896,
13,
29937,
1678,
29906,
6653,
29906,
29892,
29906,
13,
29937,
1678,
29941,
6653,
29941,
29892,
29941,
13,
29937,
1678,
29906,
6653,
29896,
29892,
29941,
13,
29937,
259,
448,
29945,
29892,
29946,
6653,
29953,
13,
29937,
259,
448,
29947,
6653,
29955,
29892,
29900,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
259,
448,
29896,
6653,
29896,
6653,
29896,
13,
29937,
259,
448,
29906,
6653,
29906,
6653,
29906,
13,
29937,
259,
448,
29941,
6653,
29941,
6653,
29941,
13,
29937,
259,
448,
29896,
6653,
29941,
6653,
29906,
13,
29937,
1678,
29946,
29892,
29953,
29892,
29945,
13,
29937,
259,
448,
29955,
29892,
29900,
29892,
29947,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
1678,
29896,
29892,
29896,
6653,
29896,
13,
29937,
1678,
29906,
29892,
29906,
6653,
29906,
13,
29937,
1678,
29941,
29892,
29941,
6653,
29941,
13,
29937,
1678,
29896,
29892,
29941,
6653,
29906,
13,
29937,
259,
448,
29946,
6653,
29953,
29892,
29945,
13,
29937,
1678,
29955,
29892,
29900,
29892,
29947,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
1678,
29896,
29892,
29896,
29892,
29896,
13,
29937,
1678,
29906,
29892,
29906,
29892,
29906,
13,
29937,
1678,
29941,
29892,
29941,
29892,
29941,
13,
29937,
1678,
29941,
29892,
29896,
29892,
29906,
13,
29937,
259,
448,
29953,
6653,
29946,
6653,
29945,
13,
29937,
1678,
29900,
29892,
29955,
6653,
29947,
13,
29937,
13,
29937,
2648,
9138,
11000,
310,
885,
812,
414,
393,
1716,
1074,
472,
3203,
29871,
29896,
29906,
310,
278,
1021,
367,
29874,
3200,
29892,
13,
29937,
366,
508,
24940,
278,
4152,
2910,
29889,
1152,
1342,
29892,
2050,
278,
1494,
3461,
29901,
13,
29937,
259,
11474,
885,
7310,
29871,
29900,
11474,
13,
29937,
1678,
29946,
29900,
29946,
6653,
29945,
29947,
29947,
6653,
29929,
29900,
29896,
13,
29937,
1678,
29945,
29906,
29947,
6653,
29953,
29946,
29941,
29892,
29946,
29900,
29929,
13,
29937,
259,
448,
29947,
29941,
29947,
29892,
29945,
29929,
29896,
29892,
29955,
29941,
29946,
13,
29937,
1678,
29941,
29929,
29900,
6653,
29953,
29955,
29945,
6653,
29955,
29929,
29941,
13,
29937,
259,
448,
29945,
29941,
29955,
6653,
29947,
29906,
29941,
6653,
29946,
29945,
29947,
13,
29937,
259,
448,
29946,
29947,
29945,
6653,
29941,
29945,
29955,
29892,
29941,
29946,
29955,
13,
29937,
259,
448,
29941,
29946,
29945,
6653,
29941,
29896,
29896,
29892,
29941,
29947,
29896,
13,
29937,
259,
448,
29953,
29953,
29896,
6653,
29947,
29896,
29953,
6653,
29945,
29955,
29945,
13,
29937,
259,
448,
29947,
29955,
29953,
29892,
29953,
29946,
29929,
29892,
29955,
29953,
29941,
13,
29937,
259,
448,
29953,
29896,
29947,
6653,
29947,
29906,
29946,
6653,
29953,
29906,
29896,
13,
29937,
1678,
29945,
29945,
29941,
29892,
29941,
29946,
29945,
6653,
29945,
29953,
29955,
13,
29937,
1678,
29946,
29955,
29946,
29892,
29945,
29947,
29900,
29892,
29953,
29953,
29955,
13,
29937,
259,
448,
29946,
29946,
29955,
6653,
29941,
29906,
29929,
29892,
29941,
29896,
29947,
13,
29937,
259,
448,
29945,
29947,
29946,
29892,
29947,
29953,
29947,
6653,
29945,
29945,
29955,
13,
29937,
1678,
29945,
29946,
29946,
6653,
29953,
29906,
29955,
6653,
29947,
29929,
29900,
13,
29937,
1678,
29945,
29953,
29946,
29892,
29941,
29929,
29906,
6653,
29946,
29955,
29955,
13,
29937,
1678,
29946,
29945,
29945,
29892,
29955,
29906,
29929,
29892,
29955,
29906,
29947,
13,
29937,
259,
448,
29947,
29929,
29906,
29892,
29945,
29906,
29946,
29892,
29953,
29947,
29946,
13,
29937,
259,
448,
29953,
29947,
29929,
29892,
29947,
29946,
29945,
6653,
29945,
29941,
29900,
13,
29937,
1678,
29946,
29906,
29941,
6653,
29955,
29900,
29896,
29892,
29946,
29941,
29946,
13,
29937,
1678,
29955,
6653,
29941,
29941,
6653,
29955,
29896,
13,
29937,
1678,
29953,
29941,
29900,
29892,
29941,
29896,
29929,
6653,
29941,
29955,
29929,
13,
29937,
1678,
29946,
29946,
29941,
29892,
29945,
29947,
29900,
29892,
29953,
29953,
29906,
13,
29937,
259,
448,
29955,
29947,
29929,
29892,
29929,
29900,
29900,
6653,
29945,
29945,
29896,
13,
29937,
1678,
29946,
29945,
29929,
6653,
29955,
29900,
29955,
29892,
29946,
29900,
29896,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29896,
11474,
13,
29937,
1678,
29953,
29947,
29953,
29892,
29946,
29906,
29906,
29892,
29945,
29955,
29947,
13,
29937,
1678,
29953,
29900,
29945,
29892,
29946,
29906,
29941,
29892,
29946,
29896,
29945,
13,
29937,
1678,
29945,
29896,
29945,
29892,
29929,
29896,
29955,
6653,
29941,
29953,
29896,
13,
29937,
259,
448,
29941,
29941,
29953,
29892,
29953,
29945,
29947,
29892,
29947,
29945,
29947,
13,
29937,
1678,
29929,
29945,
29892,
29896,
29941,
29947,
29892,
29906,
29906,
13,
29937,
259,
448,
29946,
29955,
29953,
29892,
29953,
29896,
29929,
29892,
29947,
29946,
29955,
13,
29937,
259,
448,
29941,
29946,
29900,
6653,
29945,
29953,
29929,
6653,
29947,
29946,
29953,
13,
29937,
1678,
29945,
29953,
29955,
6653,
29941,
29953,
29896,
29892,
29955,
29906,
29955,
13,
29937,
259,
448,
29946,
29953,
29900,
29892,
29953,
29900,
29941,
6653,
29946,
29945,
29906,
13,
29937,
1678,
29953,
29953,
29929,
6653,
29946,
29900,
29906,
29892,
29953,
29900,
29900,
13,
29937,
1678,
29955,
29906,
29929,
29892,
29946,
29941,
29900,
29892,
29945,
29941,
29906,
13,
29937,
259,
448,
29945,
29900,
29900,
6653,
29955,
29953,
29896,
29892,
29945,
29941,
29946,
13,
29937,
259,
448,
29941,
29906,
29906,
29892,
29945,
29955,
29896,
29892,
29955,
29945,
29900,
13,
29937,
259,
448,
29946,
29953,
29953,
6653,
29953,
29953,
29953,
6653,
29947,
29896,
29896,
13,
29937,
259,
448,
29946,
29906,
29929,
6653,
29945,
29929,
29906,
29892,
29945,
29955,
29946,
13,
29937,
259,
448,
29941,
29945,
29945,
29892,
29945,
29946,
29945,
6653,
29946,
29955,
29955,
13,
29937,
1678,
29955,
29900,
29941,
6653,
29946,
29929,
29896,
6653,
29945,
29906,
29929,
13,
29937,
259,
448,
29941,
29906,
29947,
6653,
29953,
29947,
29945,
29892,
29945,
29906,
29900,
13,
29937,
1678,
29946,
29896,
29941,
29892,
29929,
29941,
29945,
6653,
29946,
29906,
29946,
13,
29937,
259,
448,
29941,
29929,
29896,
29892,
29945,
29941,
29929,
6653,
29946,
29946,
29946,
13,
29937,
1678,
29945,
29947,
29953,
6653,
29946,
29941,
29945,
29892,
29945,
29945,
29955,
13,
29937,
259,
448,
29941,
29953,
29946,
6653,
29955,
29953,
29941,
6653,
29947,
29929,
29941,
13,
29937,
1678,
29947,
29900,
29955,
6653,
29946,
29929,
29929,
6653,
29955,
29896,
29896,
13,
29937,
1678,
29955,
29945,
29945,
6653,
29941,
29945,
29946,
6653,
29953,
29896,
29929,
13,
29937,
1678,
29945,
29945,
29941,
29892,
29947,
29947,
29929,
6653,
29941,
29929,
29900,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29906,
11474,
13,
29937,
1678,
29953,
29946,
29929,
29892,
29953,
29946,
29900,
29892,
29953,
29953,
29945,
13,
29937,
1678,
29953,
29947,
29906,
6653,
29955,
29929,
29945,
29892,
29945,
29900,
29946,
13,
29937,
259,
448,
29955,
29947,
29946,
29892,
29945,
29941,
29941,
6653,
29945,
29906,
29946,
13,
29937,
259,
448,
29953,
29946,
29946,
29892,
29945,
29947,
29946,
6653,
29945,
29929,
29945,
13,
29937,
259,
448,
29945,
29947,
29947,
6653,
29947,
29946,
29941,
29892,
29953,
29946,
29947,
13,
29937,
259,
448,
29941,
29900,
29892,
29953,
29892,
29946,
29946,
13,
29937,
259,
448,
29953,
29955,
29946,
29892,
29945,
29953,
29900,
29892,
29955,
29953,
29941,
13,
29937,
1678,
29945,
29900,
29900,
29892,
29955,
29906,
29941,
6653,
29946,
29953,
29900,
13,
29937,
1678,
29953,
29900,
29929,
29892,
29953,
29955,
29896,
6653,
29941,
29955,
29929,
13,
29937,
259,
448,
29945,
29945,
29945,
6653,
29947,
29900,
29900,
29892,
29953,
29945,
29941,
13,
29937,
259,
448,
29953,
29955,
29945,
6653,
29947,
29929,
29906,
6653,
29941,
29946,
29941,
13,
29937,
1678,
29953,
29929,
29955,
6653,
29946,
29906,
29953,
6653,
29953,
29896,
29900,
13,
29937,
1678,
29945,
29955,
29947,
29892,
29955,
29900,
29946,
29892,
29953,
29947,
29896,
13,
29937,
1678,
29946,
29929,
29941,
29892,
29953,
29953,
29946,
6653,
29941,
29947,
29947,
13,
29937,
259,
448,
29953,
29955,
29896,
6653,
29947,
29945,
29947,
29892,
29945,
29941,
29900,
13,
29937,
259,
448,
29953,
29953,
29955,
29892,
29941,
29946,
29941,
29892,
29947,
29900,
29900,
13,
29937,
1678,
29945,
29955,
29896,
6653,
29946,
29953,
29896,
6653,
29955,
29900,
29955,
13,
29937,
259,
448,
29896,
29941,
29947,
6653,
29896,
29953,
29953,
29892,
29896,
29896,
29906,
13,
29937,
259,
448,
29947,
29947,
29929,
29892,
29945,
29953,
29941,
6653,
29953,
29900,
29900,
13,
29937,
1678,
29953,
29946,
29953,
6653,
29947,
29906,
29947,
29892,
29946,
29929,
29947,
13,
29937,
1678,
29953,
29946,
29900,
29892,
29955,
29945,
29929,
29892,
29945,
29896,
29900,
13,
29937,
259,
448,
29953,
29941,
29900,
29892,
29945,
29900,
29929,
29892,
29955,
29953,
29947,
13,
29937,
259,
448,
29953,
29947,
29896,
6653,
29947,
29929,
29906,
6653,
29941,
29941,
29941,
13,
29937,
1678,
29953,
29955,
29941,
6653,
29941,
29955,
29929,
6653,
29947,
29900,
29946,
13,
29937,
259,
448,
29955,
29946,
29906,
6653,
29947,
29896,
29946,
6653,
29941,
29947,
29953,
13,
29937,
1678,
29945,
29955,
29955,
6653,
29947,
29906,
29900,
29892,
29945,
29953,
29906,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29941,
11474,
13,
29937,
259,
448,
29945,
29947,
29929,
29892,
29945,
29946,
29906,
29892,
29945,
29929,
29955,
13,
29937,
1678,
29953,
29900,
29945,
6653,
29953,
29929,
29906,
29892,
29953,
29953,
29929,
13,
29937,
259,
448,
29945,
29900,
29900,
29892,
29945,
29953,
29945,
6653,
29947,
29906,
29941,
13,
29937,
259,
448,
29953,
29953,
29900,
29892,
29941,
29955,
29941,
29892,
29945,
29945,
29955,
13,
29937,
259,
448,
29946,
29945,
29947,
6653,
29953,
29955,
29929,
6653,
29946,
29896,
29955,
13,
29937,
259,
448,
29946,
29947,
29947,
29892,
29946,
29946,
29929,
29892,
29945,
29946,
29941,
13,
29937,
259,
448,
29953,
29906,
29953,
29892,
29946,
29953,
29947,
6653,
29955,
29947,
29947,
13,
29937,
1678,
29941,
29941,
29947,
6653,
29955,
29945,
29900,
6653,
29941,
29947,
29953,
13,
29937,
1678,
29945,
29906,
29947,
6653,
29947,
29941,
29906,
6653,
29941,
29929,
29896,
13,
29937,
1678,
29945,
29953,
29906,
6653,
29955,
29955,
29947,
29892,
29955,
29941,
29941,
13,
29937,
259,
448,
29929,
29941,
29947,
6653,
29955,
29941,
29900,
29892,
29946,
29896,
29946,
13,
29937,
1678,
29945,
29946,
29941,
29892,
29953,
29946,
29941,
6653,
29945,
29900,
29953,
13,
29937,
259,
448,
29945,
29906,
29946,
29892,
29941,
29955,
29896,
6653,
29947,
29955,
29900,
13,
29937,
1678,
29946,
29900,
29955,
29892,
29955,
29955,
29941,
29892,
29955,
29945,
29900,
13,
29937,
259,
448,
29896,
29900,
29946,
29892,
29906,
29929,
29892,
29947,
29941,
13,
29937,
1678,
29941,
29955,
29947,
6653,
29929,
29900,
29941,
6653,
29941,
29906,
29941,
13,
29937,
259,
448,
29955,
29955,
29947,
6653,
29955,
29906,
29947,
29892,
29946,
29947,
29945,
13,
29937,
1678,
29946,
29906,
29953,
29892,
29953,
29929,
29929,
29892,
29945,
29947,
29900,
13,
29937,
259,
448,
29946,
29941,
29947,
6653,
29953,
29900,
29945,
6653,
29941,
29953,
29906,
13,
29937,
259,
448,
29946,
29953,
29929,
6653,
29946,
29946,
29955,
6653,
29941,
29947,
29955,
13,
29937,
1678,
29945,
29900,
29929,
29892,
29955,
29941,
29906,
29892,
29953,
29906,
29941,
13,
29937,
1678,
29953,
29946,
29955,
29892,
29953,
29941,
29945,
6653,
29953,
29947,
29947,
13,
29937,
259,
448,
29947,
29953,
29947,
6653,
29947,
29900,
29946,
29892,
29946,
29947,
29896,
13,
29937,
1678,
29953,
29896,
29946,
6653,
29947,
29900,
29900,
29892,
29953,
29941,
29929,
13,
29937,
1678,
29945,
29929,
29945,
29892,
29955,
29947,
29900,
6653,
29945,
29929,
29953,
13,
29937,
13,
29937,
259,
11474,
885,
7310,
29871,
29946,
11474,
13,
29937,
1678,
29955,
29906,
29955,
29892,
29945,
29929,
29906,
29892,
29945,
29953,
29906,
13,
29937,
259,
448,
29906,
29929,
29941,
6653,
29945,
29945,
29946,
29892,
29955,
29955,
29929,
13,
29937,
1678,
29946,
29946,
29896,
29892,
29953,
29896,
29896,
6653,
29946,
29953,
29896,
13,
29937,
259,
448,
29955,
29896,
29946,
29892,
29946,
29953,
29945,
6653,
29955,
29955,
29953,
13,
29937,
259,
448,
29955,
29946,
29941,
29892,
29946,
29906,
29955,
6653,
29947,
29900,
29946,
13,
29937,
259,
448,
29953,
29953,
29900,
6653,
29946,
29955,
29929,
6653,
29946,
29906,
29953,
13,
29937,
1678,
29947,
29941,
29906,
6653,
29953,
29941,
29906,
29892,
29946,
29953,
29900,
13,
29937,
1678,
29929,
29906,
29955,
6653,
29946,
29947,
29945,
6653,
29946,
29941,
29947,
13,
29937,
1678,
29946,
29900,
29947,
29892,
29941,
29929,
29941,
6653,
29945,
29900,
29953,
13,
29937,
1678,
29946,
29953,
29953,
29892,
29946,
29941,
29953,
6653,
29945,
29896,
29906,
13,
29937,
1678,
29896,
29896,
29900,
29892,
29896,
29953,
29892,
29896,
29945,
29896,
13,
29937,
259,
448,
29906,
29945,
29947,
6653,
29946,
29906,
29947,
29892,
29953,
29947,
29906,
13,
29937,
259,
448,
29941,
29929,
29941,
29892,
29955,
29896,
29929,
29892,
29953,
29896,
29906,
13,
29937,
259,
448,
29906,
29896,
29896,
6653,
29946,
29945,
29906,
29892,
29947,
29955,
29953,
13,
29937,
1678,
29947,
29900,
29947,
6653,
29946,
29955,
29953,
6653,
29945,
29929,
29941,
13,
29937,
259,
448,
29945,
29955,
29945,
29892,
29953,
29896,
29945,
29892,
29953,
29900,
29946,
13,
29937,
259,
448,
29946,
29947,
29945,
29892,
29953,
29953,
29955,
29892,
29946,
29953,
29955,
13,
29937,
259,
448,
29953,
29947,
29900,
29892,
29941,
29906,
29945,
6653,
29947,
29906,
29906,
13,
29937,
259,
448,
29953,
29906,
29955,
6653,
29946,
29946,
29941,
6653,
29946,
29941,
29906,
13,
29937,
1678,
29947,
29955,
29906,
6653,
29945,
29946,
29955,
6653,
29953,
29900,
29929,
13,
29937,
1678,
29947,
29941,
29941,
29892,
29945,
29896,
29906,
29892,
29945,
29947,
29906,
13,
29937,
1678,
29947,
29900,
29955,
29892,
29953,
29900,
29946,
29892,
29946,
29947,
29955,
13,
29937,
1678,
29947,
29941,
29929,
6653,
29945,
29896,
29953,
29892,
29946,
29945,
29896,
13,
29937,
1678,
29947,
29929,
29896,
6653,
29953,
29906,
29945,
29892,
29945,
29941,
29906,
13,
29937,
259,
448,
29953,
29945,
29906,
6653,
29945,
29946,
29947,
6653,
29946,
29929,
29900,
13,
29937,
1678,
29941,
29900,
6653,
29946,
29953,
6653,
29896,
29946,
13,
29937,
13,
29937,
7311,
599,
10350,
526,
6198,
29892,
297,
445,
1342,
29892,
599,
376,
23552,
29908,
13,
29937,
11909,
674,
367,
13384,
6198,
304,
885,
7310,
29871,
29900,
313,
4746,
278,
19843,
13,
29937,
310,
885,
7310,
29871,
29900,
322,
408,
565,
885,
7310,
29871,
29900,
338,
472,
10350,
29871,
29900,
29892,
29900,
29892,
29900,
467,
13,
29937,
13,
29937,
2522,
812,
414,
29871,
29900,
322,
29871,
29896,
505,
975,
433,
3262,
15326,
13630,
267,
29936,
278,
29871,
29896,
29906,
367,
29874,
3200,
896,
1716,
13,
29937,
6459,
313,
22925,
304,
885,
7310,
29871,
29900,
29897,
526,
472,
278,
1494,
10350,
29901,
13,
29937,
259,
448,
29953,
29896,
29947,
6653,
29947,
29906,
29946,
6653,
29953,
29906,
29896,
13,
29937,
259,
448,
29945,
29941,
29955,
6653,
29947,
29906,
29941,
6653,
29946,
29945,
29947,
13,
29937,
259,
448,
29946,
29946,
29955,
6653,
29941,
29906,
29929,
29892,
29941,
29896,
29947,
13,
29937,
1678,
29946,
29900,
29946,
6653,
29945,
29947,
29947,
6653,
29929,
29900,
29896,
13,
29937,
1678,
29945,
29946,
29946,
6653,
29953,
29906,
29955,
6653,
29947,
29929,
29900,
13,
29937,
1678,
29945,
29906,
29947,
6653,
29953,
29946,
29941,
29892,
29946,
29900,
29929,
13,
29937,
259,
448,
29953,
29953,
29896,
6653,
29947,
29896,
29953,
6653,
29945,
29955,
29945,
13,
29937,
1678,
29941,
29929,
29900,
6653,
29953,
29955,
29945,
6653,
29955,
29929,
29941,
13,
29937,
1678,
29946,
29906,
29941,
6653,
29955,
29900,
29896,
29892,
29946,
29941,
29946,
13,
29937,
259,
448,
29941,
29946,
29945,
6653,
29941,
29896,
29896,
29892,
29941,
29947,
29896,
13,
29937,
1678,
29946,
29945,
29929,
6653,
29955,
29900,
29955,
29892,
29946,
29900,
29896,
13,
29937,
259,
448,
29946,
29947,
29945,
6653,
29941,
29945,
29955,
29892,
29941,
29946,
29955,
13,
29937,
13,
29937,
4525,
1021,
29871,
29896,
29906,
367,
29874,
3200,
313,
262,
278,
1021,
1797,
29897,
541,
515,
278,
18520,
13,
29937,
310,
885,
7310,
29871,
29896,
526,
29901,
13,
29937,
1678,
29953,
29947,
29953,
29892,
29946,
29906,
29906,
29892,
29945,
29955,
29947,
13,
29937,
1678,
29953,
29900,
29945,
29892,
29946,
29906,
29941,
29892,
29946,
29896,
29945,
13,
29937,
1678,
29945,
29896,
29945,
29892,
29929,
29896,
29955,
6653,
29941,
29953,
29896,
13,
29937,
259,
448,
29941,
29941,
29953,
29892,
29953,
29945,
29947,
29892,
29947,
29945,
29947,
13,
29937,
259,
448,
29946,
29955,
29953,
29892,
29953,
29896,
29929,
29892,
29947,
29946,
29955,
13,
29937,
259,
448,
29946,
29953,
29900,
29892,
29953,
29900,
29941,
6653,
29946,
29945,
29906,
13,
29937,
1678,
29955,
29906,
29929,
29892,
29946,
29941,
29900,
29892,
29945,
29941,
29906,
13,
29937,
259,
448,
29941,
29906,
29906,
29892,
29945,
29955,
29896,
29892,
29955,
29945,
29900,
13,
29937,
259,
448,
29941,
29945,
29945,
29892,
29945,
29946,
29945,
6653,
29946,
29955,
29955,
13,
29937,
1678,
29946,
29896,
29941,
29892,
29929,
29941,
29945,
6653,
29946,
29906,
29946,
13,
29937,
259,
448,
29941,
29929,
29896,
29892,
29945,
29941,
29929,
6653,
29946,
29946,
29946,
13,
29937,
1678,
29945,
29945,
29941,
29892,
29947,
29947,
29929,
6653,
29941,
29929,
29900,
13,
29937,
13,
29937,
7311,
310,
445,
29892,
885,
7310,
29871,
29896,
1818,
367,
472,
29871,
29953,
29947,
6653,
29896,
29906,
29946,
29953,
6653,
29946,
29941,
313,
22925,
304,
885,
7310,
29871,
29900,
467,
13,
29937,
13,
29937,
23412,
29871,
29946,
975,
14128,
411,
885,
7310,
29871,
29896,
29936,
278,
29871,
29896,
29906,
367,
29874,
3200,
896,
1716,
6459,
13,
29937,
313,
22925,
304,
885,
7310,
29871,
29900,
29897,
526,
29901,
13,
29937,
1678,
29946,
29945,
29929,
6653,
29955,
29900,
29955,
29892,
29946,
29900,
29896,
13,
29937,
259,
448,
29955,
29941,
29929,
6653,
29896,
29955,
29946,
29945,
29892,
29953,
29953,
29947,
13,
29937,
259,
448,
29946,
29947,
29945,
6653,
29941,
29945,
29955,
29892,
29941,
29946,
29955,
13,
29937,
1678,
29946,
29941,
29906,
6653,
29906,
29900,
29900,
29929,
29892,
29947,
29945,
29900,
13,
29937,
1678,
29945,
29906,
29947,
6653,
29953,
29946,
29941,
29892,
29946,
29900,
29929,
13,
29937,
1678,
29946,
29906,
29941,
6653,
29955,
29900,
29896,
29892,
29946,
29941,
29946,
13,
29937,
259,
448,
29941,
29946,
29945,
6653,
29941,
29896,
29896,
29892,
29941,
29947,
29896,
13,
29937,
1678,
29946,
29900,
29947,
6653,
29896,
29947,
29896,
29945,
29892,
29947,
29900,
29941,
13,
29937,
1678,
29945,
29941,
29946,
6653,
29896,
29929,
29896,
29906,
29892,
29955,
29953,
29947,
13,
29937,
259,
448,
29953,
29947,
29955,
6653,
29896,
29953,
29900,
29900,
29892,
29945,
29955,
29953,
13,
29937,
259,
448,
29946,
29946,
29955,
6653,
29941,
29906,
29929,
29892,
29941,
29896,
29947,
13,
29937,
259,
448,
29953,
29941,
29945,
6653,
29896,
29955,
29941,
29955,
29892,
29946,
29947,
29953,
13,
29937,
13,
29937,
1105,
29892,
885,
7310,
29871,
29946,
338,
472,
448,
29906,
29900,
6653,
29896,
29896,
29941,
29941,
29892,
29896,
29900,
29953,
29896,
313,
22925,
304,
885,
7310,
29871,
29900,
467,
13,
29937,
13,
29937,
12206,
445,
1889,
29892,
885,
7310,
29871,
29906,
1818,
367,
472,
29871,
29896,
29896,
29900,
29945,
6653,
29896,
29906,
29900,
29945,
29892,
29896,
29906,
29906,
29929,
313,
22925,
13,
29937,
304,
885,
7310,
29871,
29900,
29897,
322,
885,
7310,
29871,
29941,
1818,
367,
472,
448,
29929,
29906,
6653,
29906,
29941,
29947,
29900,
6653,
29906,
29900,
313,
22925,
304,
885,
7310,
29871,
29900,
467,
13,
29937,
13,
29937,
450,
2989,
1051,
310,
367,
29874,
3200,
313,
22925,
304,
885,
7310,
29871,
29900,
29897,
338,
29901,
13,
29937,
259,
448,
29947,
29929,
29906,
29892,
29945,
29906,
29946,
29892,
29953,
29947,
29946,
13,
29937,
259,
448,
29947,
29955,
29953,
29892,
29953,
29946,
29929,
29892,
29955,
29953,
29941,
13,
29937,
259,
448,
29947,
29941,
29947,
29892,
29945,
29929,
29896,
29892,
29955,
29941,
29946,
13,
29937,
259,
448,
29955,
29947,
29929,
29892,
29929,
29900,
29900,
6653,
29945,
29945,
29896,
13,
29937,
259,
448,
29955,
29941,
29929,
6653,
29896,
29955,
29946,
29945,
29892,
29953,
29953,
29947,
13,
29937,
259,
448,
29955,
29900,
29953,
6653,
29941,
29896,
29947,
29900,
6653,
29953,
29945,
29929,
13,
29937,
259,
448,
29953,
29929,
29955,
6653,
29941,
29900,
29955,
29906,
6653,
29953,
29947,
29929,
13,
29937,
259,
448,
29953,
29947,
29929,
29892,
29947,
29946,
29945,
6653,
29945,
29941,
29900,
13,
29937,
259,
448,
29953,
29947,
29955,
6653,
29896,
29953,
29900,
29900,
29892,
29945,
29955,
29953,
13,
29937,
259,
448,
29953,
29953,
29896,
6653,
29947,
29896,
29953,
6653,
29945,
29955,
29945,
13,
29937,
259,
448,
29953,
29945,
29946,
6653,
29941,
29896,
29945,
29947,
6653,
29955,
29945,
29941,
13,
29937,
259,
448,
29953,
29941,
29945,
6653,
29896,
29955,
29941,
29955,
29892,
29946,
29947,
29953,
13,
29937,
259,
448,
29953,
29941,
29896,
6653,
29953,
29955,
29906,
29892,
29896,
29945,
29900,
29906,
13,
29937,
259,
448,
29953,
29906,
29946,
6653,
29896,
29953,
29906,
29900,
29892,
29896,
29947,
29953,
29947,
13,
29937,
259,
448,
29953,
29906,
29900,
6653,
29941,
29906,
29896,
29906,
29892,
29941,
29955,
29896,
13,
29937,
259,
448,
29953,
29896,
29947,
6653,
29947,
29906,
29946,
6653,
29953,
29906,
29896,
13,
29937,
259,
448,
29953,
29896,
29906,
6653,
29896,
29953,
29929,
29945,
29892,
29896,
29955,
29947,
29947,
13,
29937,
259,
448,
29953,
29900,
29896,
6653,
29896,
29953,
29946,
29947,
6653,
29953,
29946,
29941,
13,
29937,
259,
448,
29945,
29947,
29946,
29892,
29947,
29953,
29947,
6653,
29945,
29945,
29955,
13,
29937,
259,
448,
29945,
29941,
29955,
6653,
29947,
29906,
29941,
6653,
29946,
29945,
29947,
13,
29937,
259,
448,
29945,
29941,
29906,
6653,
29896,
29955,
29896,
29945,
29892,
29896,
29947,
29929,
29946,
13,
29937,
259,
448,
29945,
29896,
29947,
6653,
29896,
29953,
29947,
29896,
6653,
29953,
29900,
29900,
13,
29937,
259,
448,
29946,
29929,
29929,
6653,
29896,
29953,
29900,
29955,
6653,
29955,
29955,
29900,
13,
29937,
259,
448,
29946,
29947,
29945,
6653,
29941,
29945,
29955,
29892,
29941,
29946,
29955,
13,
29937,
259,
448,
29946,
29955,
29900,
6653,
29941,
29906,
29947,
29941,
29892,
29941,
29900,
29941,
13,
29937,
259,
448,
29946,
29945,
29953,
6653,
29953,
29906,
29896,
29892,
29896,
29945,
29906,
29955,
13,
29937,
259,
448,
29946,
29946,
29955,
6653,
29941,
29906,
29929,
29892,
29941,
29896,
29947,
13,
29937,
259,
448,
29946,
29941,
29900,
6653,
29941,
29896,
29941,
29900,
29892,
29941,
29953,
29953,
13,
29937,
259,
448,
29946,
29896,
29941,
6653,
29953,
29906,
29955,
29892,
29896,
29946,
29953,
29929,
13,
29937,
259,
448,
29941,
29946,
29945,
6653,
29941,
29896,
29896,
29892,
29941,
29947,
29896,
13,
29937,
259,
448,
29941,
29953,
6653,
29896,
29906,
29947,
29946,
29892,
29896,
29896,
29955,
29896,
13,
29937,
259,
448,
29906,
29955,
6653,
29896,
29896,
29900,
29947,
6653,
29953,
29945,
13,
29937,
1678,
29955,
6653,
29941,
29941,
6653,
29955,
29896,
13,
29937,
1678,
29896,
29906,
6653,
29906,
29941,
29945,
29896,
6653,
29896,
29900,
29941,
13,
29937,
1678,
29906,
29953,
6653,
29896,
29896,
29896,
29929,
29892,
29896,
29900,
29929,
29896,
13,
29937,
1678,
29941,
29946,
29953,
6653,
29906,
29929,
29947,
29945,
29892,
29941,
29946,
29906,
13,
29937,
1678,
29941,
29953,
29953,
6653,
29941,
29900,
29945,
29929,
29892,
29941,
29929,
29955,
13,
29937,
1678,
29941,
29955,
29955,
6653,
29906,
29947,
29906,
29955,
29892,
29941,
29953,
29955,
13,
29937,
1678,
29941,
29929,
29900,
6653,
29953,
29955,
29945,
6653,
29955,
29929,
29941,
13,
29937,
1678,
29941,
29929,
29953,
6653,
29896,
29929,
29941,
29896,
6653,
29945,
29953,
29941,
13,
29937,
1678,
29946,
29900,
29946,
6653,
29945,
29947,
29947,
6653,
29929,
29900,
29896,
13,
29937,
1678,
29946,
29900,
29947,
6653,
29896,
29947,
29896,
29945,
29892,
29947,
29900,
29941,
13,
29937,
1678,
29946,
29906,
29941,
6653,
29955,
29900,
29896,
29892,
29946,
29941,
29946,
13,
29937,
1678,
29946,
29941,
29906,
6653,
29906,
29900,
29900,
29929,
29892,
29947,
29945,
29900,
13,
29937,
1678,
29946,
29946,
29941,
29892,
29945,
29947,
29900,
29892,
29953,
29953,
29906,
13,
29937,
1678,
29946,
29945,
29945,
29892,
29955,
29906,
29929,
29892,
29955,
29906,
29947,
13,
29937,
1678,
29946,
29945,
29953,
6653,
29945,
29946,
29900,
29892,
29896,
29947,
29953,
29929,
13,
29937,
1678,
29946,
29945,
29929,
6653,
29955,
29900,
29955,
29892,
29946,
29900,
29896,
13,
29937,
1678,
29946,
29953,
29945,
6653,
29953,
29929,
29945,
29892,
29896,
29929,
29947,
29947,
13,
29937,
1678,
29946,
29955,
29946,
29892,
29945,
29947,
29900,
29892,
29953,
29953,
29955,
13,
29937,
1678,
29946,
29929,
29953,
6653,
29896,
29945,
29947,
29946,
29892,
29896,
29929,
29900,
29900,
13,
29937,
1678,
29946,
29929,
29955,
6653,
29896,
29947,
29941,
29947,
6653,
29953,
29896,
29955,
13,
29937,
1678,
29945,
29906,
29955,
6653,
29945,
29906,
29946,
29892,
29896,
29929,
29941,
29941,
13,
29937,
1678,
29945,
29906,
29947,
6653,
29953,
29946,
29941,
29892,
29946,
29900,
29929,
13,
29937,
1678,
29945,
29941,
29946,
6653,
29896,
29929,
29896,
29906,
29892,
29955,
29953,
29947,
13,
29937,
1678,
29945,
29946,
29946,
6653,
29953,
29906,
29955,
6653,
29947,
29929,
29900,
13,
29937,
1678,
29945,
29945,
29941,
29892,
29941,
29946,
29945,
6653,
29945,
29953,
29955,
13,
29937,
1678,
29945,
29953,
29946,
29892,
29941,
29929,
29906,
6653,
29946,
29955,
29955,
13,
29937,
1678,
29945,
29953,
29947,
6653,
29906,
29900,
29900,
29955,
6653,
29945,
29955,
29955,
13,
29937,
1678,
29953,
29900,
29945,
6653,
29896,
29953,
29953,
29945,
29892,
29896,
29929,
29945,
29906,
13,
29937,
1678,
29953,
29896,
29906,
6653,
29896,
29945,
29929,
29941,
29892,
29896,
29947,
29929,
29941,
13,
29937,
1678,
29953,
29941,
29900,
29892,
29941,
29896,
29929,
6653,
29941,
29955,
29929,
13,
29937,
1678,
29953,
29947,
29953,
6653,
29941,
29896,
29900,
29947,
6653,
29945,
29900,
29945,
13,
29937,
1678,
29955,
29955,
29953,
6653,
29941,
29896,
29947,
29946,
6653,
29945,
29900,
29896,
13,
29937,
1678,
29947,
29946,
29953,
6653,
29941,
29896,
29896,
29900,
6653,
29946,
29941,
29946,
13,
29937,
1678,
29896,
29896,
29941,
29945,
6653,
29896,
29896,
29953,
29896,
29892,
29896,
29906,
29941,
29945,
13,
29937,
1678,
29896,
29906,
29946,
29941,
6653,
29896,
29900,
29929,
29941,
29892,
29896,
29900,
29953,
29941,
13,
29937,
1678,
29896,
29953,
29953,
29900,
6653,
29945,
29945,
29906,
29892,
29946,
29906,
29929,
13,
29937,
1678,
29896,
29953,
29929,
29941,
6653,
29945,
29945,
29955,
29892,
29941,
29947,
29953,
13,
29937,
1678,
29896,
29955,
29941,
29945,
6653,
29946,
29941,
29955,
29892,
29896,
29955,
29941,
29947,
13,
29937,
1678,
29896,
29955,
29946,
29929,
6653,
29896,
29947,
29900,
29900,
29892,
29896,
29947,
29896,
29941,
13,
29937,
1678,
29896,
29955,
29955,
29906,
6653,
29946,
29900,
29945,
29892,
29896,
29945,
29955,
29906,
13,
29937,
1678,
29896,
29955,
29955,
29953,
6653,
29953,
29955,
29945,
29892,
29941,
29955,
29896,
13,
29937,
1678,
29896,
29955,
29955,
29929,
6653,
29946,
29946,
29906,
29892,
29896,
29955,
29947,
29929,
13,
29937,
1678,
29896,
29955,
29947,
29900,
6653,
29896,
29945,
29946,
29947,
29892,
29941,
29941,
29955,
13,
29937,
1678,
29896,
29955,
29947,
29953,
6653,
29896,
29945,
29941,
29947,
29892,
29941,
29941,
29955,
13,
29937,
1678,
29896,
29947,
29946,
29955,
6653,
29896,
29945,
29929,
29896,
29892,
29946,
29896,
29945,
13,
29937,
1678,
29896,
29947,
29947,
29929,
6653,
29896,
29955,
29906,
29929,
29892,
29896,
29955,
29953,
29906,
13,
29937,
1678,
29896,
29929,
29929,
29946,
6653,
29896,
29947,
29900,
29945,
29892,
29896,
29955,
29929,
29906,
13,
29937,
13,
29937,
512,
3001,
29892,
727,
526,
29871,
29955,
29929,
367,
29874,
3200,
29889,
13,
29937,
13,
29937,
4007,
6967,
278,
2989,
2910,
310,
367,
29874,
3200,
29889,
1128,
1784,
367,
29874,
3200,
526,
727,
29973,
13,
29937,
13,
29937,
13,
29937,
11474,
24380,
11474,
13,
29937,
13,
29937,
1334,
1369,
491,
5183,
278,
1881,
934,
322,
24368,
372,
491,
2323,
4069,
1196,
29889,
13,
29937,
1987,
363,
1269,
6251,
591,
5768,
278,
937,
1196,
313,
6672,
411,
885,
7310,
15882,
29897,
13,
29937,
322,
2910,
9886,
304,
1051,
310,
11920,
313,
1552,
10350,
467,
1987,
591,
7738,
13,
29937,
263,
731,
310,
599,
1950,
5731,
800,
1048,
1060,
29892,
612,
322,
796,
27815,
785,
363,
445,
591,
2334,
13,
29937,
278,
13733,
10693,
515,
278,
4636,
7190,
322,
916,
16876,
3168,
29889,
13,
29937,
18514,
15084,
445,
731,
4076,
502,
599,
5412,
29304,
591,
508,
2189,
29901,
13,
29937,
920,
304,
1083,
481,
278,
18111,
322,
285,
3466,
278,
27815,
29889,
1152,
1342,
263,
18761,
29901,
5135,
29896,
29892,
29871,
29900,
29892,
29871,
29906,
511,
13,
29937,
8521,
29896,
29892,
29871,
29896,
29892,
448,
29896,
876,
16612,
591,
881,
1925,
612,
313,
29896,
29897,
408,
937,
2380,
29892,
1060,
313,
29900,
29897,
408,
1473,
29892,
13,
29937,
796,
313,
29906,
29897,
408,
4654,
322,
21292,
278,
937,
322,
1833,
1543,
297,
2186,
4608,
29889,
13,
29937,
8084,
591,
2125,
263,
2323,
731,
310,
1303,
886,
515,
885,
812,
414,
322,
591,
7539,
372,
408,
1749,
13,
29937,
2967,
411,
3978,
29914,
5679,
1298,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
467,
1987,
297,
263,
2425,
29892,
408,
1472,
408,
727,
13,
29937,
526,
777,
443,
655,
2986,
885,
812,
414,
29892,
591,
4218,
304,
1284,
263,
29304,
393,
674,
13,
29937,
4556,
777,
1303,
886,
304,
25457,
297,
472,
3203,
29871,
29896,
29906,
3291,
29889,
1763,
1284,
263,
10417,
363,
13,
29937,
263,
2183,
885,
7310,
29892,
591,
2050,
599,
1950,
5731,
800,
310,
263,
885,
7310,
367,
23074,
13,
29937,
1303,
886,
322,
769,
591,
10272,
278,
13962,
12047,
1546,
1269,
5731,
630,
13,
29937,
367,
23074,
2602,
322,
1269,
2307,
20545,
313,
5203,
29914,
29423,
1891,
29914,
13092,
29897,
367,
23074,
29889,
13,
29937,
9788,
363,
1269,
310,
5578,
800,
591,
7738,
263,
731,
310,
20512,
367,
29874,
3200,
13,
29937,
11909,
322,
591,
679,
385,
17686,
310,
445,
731,
322,
1749,
731,
310,
2307,
13,
29937,
20545,
367,
29874,
3200,
313,
29875,
29889,
29872,
29889,
591,
1284,
263,
1051,
310,
599,
3619,
3161,
1546,
1023,
6166,
29897,
13,
29937,
785,
565,
727,
526,
472,
3203,
29871,
29896,
29906,
3619,
3161,
29892,
591,
1476,
278,
1571,
13962,
13,
29937,
393,
6511,
502,
304,
5988,
278,
6166,
322,
18720,
716,
367,
29874,
3200,
11909,
491,
3763,
13,
29937,
4417,
1023,
6166,
313,
273,
9833,
5858,
467,
512,
278,
1095,
591,
3349,
278,
925,
20545,
13,
29937,
885,
7310,
515,
278,
1051,
322,
1369,
445,
8792,
1449,
363,
599,
9886,
13,
29937,
885,
812,
414,
29892,
1432,
931,
411,
263,
16600,
731,
310,
15659,
5412,
367,
29874,
3200,
29889,
13,
29937,
1094,
385,
1234,
29892,
591,
1596,
278,
3309,
310,
5759,
731,
1156,
727,
526,
694,
901,
13,
29937,
443,
655,
2986,
885,
812,
414,
29889,
13,
29937,
13,
13,
1177,
12336,
29918,
7724,
353,
525,
2080,
29889,
3945,
29915,
13,
13,
13,
1753,
4457,
29898,
2521,
1125,
13,
1678,
10696,
1273,
29922,
29871,
29941,
29953,
29900,
13,
1678,
565,
10696,
1275,
29871,
29900,
470,
10696,
1275,
29871,
29896,
29947,
29900,
29901,
13,
4706,
736,
29871,
29900,
13,
1678,
25342,
10696,
1275,
29871,
29929,
29900,
29901,
13,
4706,
736,
29871,
29896,
13,
1678,
25342,
10696,
1275,
29871,
29906,
29955,
29900,
29901,
13,
4706,
736,
448,
29896,
13,
1678,
12020,
7865,
2392,
877,
11730,
278,
2473,
2701,
310,
278,
1492,
10696,
526,
6969,
29889,
1495,
13,
13,
13,
1753,
6776,
29898,
2521,
1125,
13,
1678,
736,
4457,
29898,
2521,
718,
29871,
29929,
29900,
29897,
13,
13,
13,
1753,
13733,
29918,
29916,
29898,
2521,
29892,
9649,
1125,
13,
1678,
736,
518,
13,
4706,
9649,
29961,
29900,
1402,
13,
4706,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29896,
29962,
718,
448,
5223,
29898,
2521,
29897,
334,
9649,
29961,
29906,
1402,
13,
4706,
4457,
29898,
2521,
29897,
334,
9649,
29961,
29896,
29962,
718,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29906,
1402,
13,
1678,
4514,
13,
13,
13,
1753,
13733,
29918,
29891,
29898,
2521,
29892,
9649,
1125,
13,
1678,
736,
518,
13,
4706,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29900,
29962,
718,
4457,
29898,
2521,
29897,
334,
9649,
29961,
29906,
1402,
13,
4706,
9649,
29961,
29896,
1402,
13,
4706,
448,
5223,
29898,
2521,
29897,
334,
9649,
29961,
29900,
29962,
718,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29906,
1402,
13,
1678,
4514,
13,
13,
13,
1753,
13733,
29918,
29920,
29898,
2521,
29892,
9649,
1125,
13,
1678,
736,
518,
13,
4706,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29900,
29962,
718,
448,
5223,
29898,
2521,
29897,
334,
9649,
29961,
29896,
1402,
13,
4706,
4457,
29898,
2521,
29897,
334,
9649,
29961,
29900,
29962,
718,
6776,
29898,
2521,
29897,
334,
9649,
29961,
29896,
1402,
13,
4706,
9649,
29961,
29906,
1402,
13,
1678,
4514,
13,
13,
13,
1753,
13733,
29918,
20230,
29898,
2521,
29918,
29916,
29892,
10696,
29918,
29891,
29892,
10696,
29918,
29920,
29892,
9649,
1125,
13,
1678,
736,
13733,
29918,
29920,
29898,
2521,
29918,
29920,
29892,
13733,
29918,
29891,
29898,
2521,
29918,
29891,
29892,
13733,
29918,
29916,
29898,
2521,
29918,
29916,
29892,
9649,
4961,
13,
13,
13,
1753,
6425,
29898,
1767,
1125,
13,
1678,
565,
995,
6736,
29871,
29900,
29901,
13,
4706,
736,
995,
13,
1678,
1683,
29901,
13,
4706,
736,
448,
1767,
13,
13,
13,
1753,
1804,
29898,
1767,
1125,
13,
1678,
565,
995,
6736,
29871,
29900,
29901,
13,
4706,
736,
29871,
29896,
13,
1678,
25342,
995,
529,
29871,
29900,
29901,
13,
4706,
736,
448,
29896,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
411,
1722,
29898,
1177,
12336,
29918,
7724,
29892,
525,
29878,
1495,
408,
934,
29901,
13,
4706,
885,
812,
414,
353,
934,
29889,
949,
2141,
17010,
2141,
5451,
28909,
29876,
29905,
29876,
1495,
13,
13,
1678,
363,
474,
29892,
885,
7310,
297,
26985,
29898,
1557,
812,
414,
1125,
13,
4706,
885,
812,
414,
29961,
29875,
29962,
353,
518,
23583,
29898,
1958,
29898,
524,
29892,
1196,
29889,
5451,
29898,
3788,
4961,
13,
462,
539,
363,
1196,
297,
885,
7310,
29889,
5451,
28909,
29876,
29861,
29896,
29901,
5262,
13,
13,
1678,
5731,
800,
353,
731,
580,
13,
1678,
29304,
353,
731,
580,
13,
13,
1678,
363,
10696,
29896,
297,
518,
29900,
29892,
29871,
29929,
29900,
29892,
29871,
29896,
29947,
29900,
29892,
29871,
29906,
29955,
29900,
5387,
13,
4706,
363,
10696,
29906,
297,
518,
29900,
29892,
29871,
29929,
29900,
29892,
29871,
29896,
29947,
29900,
29892,
29871,
29906,
29955,
29900,
5387,
13,
9651,
363,
10696,
29941,
297,
518,
29900,
29892,
29871,
29929,
29900,
29892,
29871,
29896,
29947,
29900,
29892,
29871,
29906,
29955,
29900,
5387,
13,
18884,
9649,
353,
13733,
29918,
20230,
29898,
2521,
29896,
29892,
10696,
29906,
29892,
10696,
29941,
29892,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
2314,
13,
18884,
5731,
800,
29889,
1202,
29898,
23583,
29898,
2003,
876,
13,
13,
1678,
363,
13852,
297,
5731,
800,
29901,
13,
4706,
18111,
353,
18761,
4197,
6897,
29898,
9700,
29897,
448,
29871,
29896,
363,
4163,
297,
13852,
2314,
13,
4706,
18906,
353,
18761,
4197,
4530,
29898,
9700,
29897,
363,
4163,
297,
13852,
2314,
13,
4706,
29304,
29889,
1202,
3552,
2248,
267,
29892,
18906,
876,
13,
13,
1678,
2998,
353,
731,
29898,
1557,
812,
414,
29889,
7323,
29898,
29900,
876,
29871,
396,
937,
885,
7310,
338,
1749,
3978,
1298,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
1550,
885,
812,
414,
29901,
13,
4706,
19228,
353,
7700,
13,
4706,
363,
885,
7310,
297,
885,
812,
414,
29901,
13,
9651,
363,
13852,
297,
29304,
29901,
13,
18884,
18111,
29892,
18906,
353,
13852,
13,
18884,
302,
29916,
29892,
7098,
29892,
302,
29920,
353,
18111,
13,
18884,
269,
29896,
29892,
269,
29906,
29892,
269,
29941,
353,
18906,
13,
18884,
5731,
630,
353,
17288,
29879,
29896,
334,
367,
23074,
29961,
23818,
1402,
269,
29906,
334,
367,
23074,
29961,
1460,
1402,
269,
29941,
334,
367,
23074,
29961,
29876,
29920,
2314,
13,
462,
965,
363,
367,
23074,
297,
885,
7310,
29962,
13,
13,
18884,
363,
5183,
297,
2998,
29901,
13,
462,
1678,
363,
367,
23074,
297,
5731,
630,
29901,
13,
462,
4706,
15414,
29892,
13475,
29892,
9275,
353,
518,
29890,
29918,
29875,
448,
364,
29918,
29875,
13,
462,
462,
418,
363,
289,
29918,
29875,
29892,
364,
29918,
29875,
297,
14319,
29898,
915,
23074,
29892,
5183,
4638,
13,
13,
462,
4706,
20512,
353,
731,
4197,
29898,
29916,
448,
15414,
29892,
343,
448,
13475,
29892,
503,
448,
9275,
29897,
13,
462,
462,
3986,
363,
14020,
297,
5731,
630,
13,
462,
462,
3986,
363,
921,
29892,
343,
29892,
503,
297,
518,
29883,
5380,
403,
24960,
13,
13,
462,
4706,
3619,
29918,
9748,
353,
2998,
29889,
1639,
2042,
29898,
3286,
29880,
630,
29897,
13,
13,
462,
4706,
565,
7431,
29898,
9435,
29918,
9748,
29897,
6736,
29871,
29896,
29906,
29901,
13,
462,
9651,
2998,
353,
2998,
29889,
13094,
29898,
3286,
29880,
630,
29897,
13,
462,
9651,
19228,
353,
5852,
13,
462,
9651,
2867,
13,
13,
462,
1678,
565,
19228,
29901,
13,
462,
4706,
2867,
13,
13,
18884,
565,
19228,
29901,
13,
462,
1678,
2867,
13,
13,
9651,
565,
19228,
29901,
13,
18884,
2867,
13,
13,
4706,
565,
19228,
29901,
13,
9651,
885,
812,
414,
29889,
5992,
29898,
1557,
7310,
29897,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
29956,
296,
1549,
599,
29892,
694,
1993,
785,
1554,
338,
2743,
29991,
1495,
13,
9651,
2867,
13,
13,
1678,
1596,
29898,
2435,
29898,
5203,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
tests/ast/nodes/test_from_node.py | upgradvisor/vyper | 1,471 | 351 | from vyper import ast as vy_ast
def test_output_class():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert isinstance(new_node, vy_ast.Int)
def test_source():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert old_node.src == new_node.src
assert old_node.node_source_code == new_node.node_source_code
def test_kwargs():
old_node = vy_ast.parse_to_ast("42").body[0].value
new_node = vy_ast.Int.from_node(old_node, value=666)
assert old_node.value == 42
assert new_node.value == 666
def test_compare_nodes():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert not vy_ast.compare_nodes(old_node, new_node)
def test_new_node_has_no_parent():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert new_node._parent is None
assert new_node._depth == 0
| [
1,
515,
10195,
546,
1053,
8717,
408,
10195,
29918,
579,
13,
13,
13,
1753,
1243,
29918,
4905,
29918,
1990,
7295,
13,
1678,
2030,
29918,
3177,
353,
10195,
29918,
579,
29889,
5510,
29918,
517,
29918,
579,
703,
5431,
353,
29871,
29946,
29906,
1159,
13,
1678,
716,
29918,
3177,
353,
10195,
29918,
579,
29889,
2928,
29889,
3166,
29918,
3177,
29898,
1025,
29918,
3177,
29892,
995,
29922,
29953,
29953,
29953,
29897,
13,
13,
1678,
4974,
338,
8758,
29898,
1482,
29918,
3177,
29892,
10195,
29918,
579,
29889,
2928,
29897,
13,
13,
13,
1753,
1243,
29918,
4993,
7295,
13,
1678,
2030,
29918,
3177,
353,
10195,
29918,
579,
29889,
5510,
29918,
517,
29918,
579,
703,
5431,
353,
29871,
29946,
29906,
1159,
13,
1678,
716,
29918,
3177,
353,
10195,
29918,
579,
29889,
2928,
29889,
3166,
29918,
3177,
29898,
1025,
29918,
3177,
29892,
995,
29922,
29953,
29953,
29953,
29897,
13,
13,
1678,
4974,
2030,
29918,
3177,
29889,
4351,
1275,
716,
29918,
3177,
29889,
4351,
13,
1678,
4974,
2030,
29918,
3177,
29889,
3177,
29918,
4993,
29918,
401,
1275,
716,
29918,
3177,
29889,
3177,
29918,
4993,
29918,
401,
13,
13,
13,
1753,
1243,
29918,
19290,
7295,
13,
1678,
2030,
29918,
3177,
353,
10195,
29918,
579,
29889,
5510,
29918,
517,
29918,
579,
703,
29946,
29906,
2564,
2587,
29961,
29900,
1822,
1767,
13,
1678,
716,
29918,
3177,
353,
10195,
29918,
579,
29889,
2928,
29889,
3166,
29918,
3177,
29898,
1025,
29918,
3177,
29892,
995,
29922,
29953,
29953,
29953,
29897,
13,
13,
1678,
4974,
2030,
29918,
3177,
29889,
1767,
1275,
29871,
29946,
29906,
13,
1678,
4974,
716,
29918,
3177,
29889,
1767,
1275,
29871,
29953,
29953,
29953,
13,
13,
13,
1753,
1243,
29918,
18307,
29918,
18010,
7295,
13,
1678,
2030,
29918,
3177,
353,
10195,
29918,
579,
29889,
5510,
29918,
517,
29918,
579,
703,
5431,
353,
29871,
29946,
29906,
1159,
13,
1678,
716,
29918,
3177,
353,
10195,
29918,
579,
29889,
2928,
29889,
3166,
29918,
3177,
29898,
1025,
29918,
3177,
29892,
995,
29922,
29953,
29953,
29953,
29897,
13,
13,
1678,
4974,
451,
10195,
29918,
579,
29889,
18307,
29918,
18010,
29898,
1025,
29918,
3177,
29892,
716,
29918,
3177,
29897,
13,
13,
13,
1753,
1243,
29918,
1482,
29918,
3177,
29918,
5349,
29918,
1217,
29918,
3560,
7295,
13,
1678,
2030,
29918,
3177,
353,
10195,
29918,
579,
29889,
5510,
29918,
517,
29918,
579,
703,
5431,
353,
29871,
29946,
29906,
1159,
13,
1678,
716,
29918,
3177,
353,
10195,
29918,
579,
29889,
2928,
29889,
3166,
29918,
3177,
29898,
1025,
29918,
3177,
29892,
995,
29922,
29953,
29953,
29953,
29897,
13,
13,
1678,
4974,
716,
29918,
3177,
3032,
3560,
338,
6213,
13,
1678,
4974,
716,
29918,
3177,
3032,
19488,
1275,
29871,
29900,
13,
2
] |
test/means/test_zero_mean.py | bdecost/gpytorch | 0 | 4465 | <gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import unittest
from gpytorch.means import ZeroMean
class TestZeroMean(unittest.TestCase):
def setUp(self):
self.mean = ZeroMean()
def test_forward(self):
a = torch.Tensor([[1, 2], [2, 4]])
res = self.mean(a)
self.assertEqual(tuple(res.size()), (2,))
self.assertTrue(res.eq(0).all())
def test_forward_batch(self):
a = torch.Tensor([[[1, 2], [1, 2], [2, 4]], [[2, 3], [2, 3], [1, 3]]])
res = self.mean(a)
self.assertEqual(tuple(res.size()), (2, 3))
self.assertTrue(res.eq(0).all())
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
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,
5215,
4842,
305,
13,
5215,
443,
27958,
13,
3166,
330,
2272,
7345,
305,
29889,
1004,
550,
1053,
28933,
6816,
273,
13,
13,
13,
1990,
4321,
24214,
6816,
273,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
12676,
353,
28933,
6816,
273,
580,
13,
13,
1678,
822,
1243,
29918,
11333,
29898,
1311,
1125,
13,
4706,
263,
353,
4842,
305,
29889,
29911,
6073,
4197,
29961,
29896,
29892,
29871,
29906,
1402,
518,
29906,
29892,
29871,
29946,
24960,
13,
4706,
620,
353,
1583,
29889,
12676,
29898,
29874,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
23583,
29898,
690,
29889,
2311,
25739,
313,
29906,
29892,
876,
13,
4706,
1583,
29889,
9294,
5574,
29898,
690,
29889,
1837,
29898,
29900,
467,
497,
3101,
13,
13,
1678,
822,
1243,
29918,
11333,
29918,
16175,
29898,
1311,
1125,
13,
4706,
263,
353,
4842,
305,
29889,
29911,
6073,
4197,
8999,
29896,
29892,
29871,
29906,
1402,
518,
29896,
29892,
29871,
29906,
1402,
518,
29906,
29892,
29871,
29946,
20526,
5519,
29906,
29892,
29871,
29941,
1402,
518,
29906,
29892,
29871,
29941,
1402,
518,
29896,
29892,
29871,
29941,
5262,
2314,
13,
4706,
620,
353,
1583,
29889,
12676,
29898,
29874,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
23583,
29898,
690,
29889,
2311,
25739,
313,
29906,
29892,
29871,
29941,
876,
13,
4706,
1583,
29889,
9294,
5574,
29898,
690,
29889,
1837,
29898,
29900,
467,
497,
3101,
13,
2
] |
Interfaces/Simulations/p3do.py | tulasinandan/TurbAn | 0 | 94866 | #!/usr/bin/env python
###########################################################################
##
## The class to handle P3D simulation data in python. An object is created
## that has the run parameters attached with it. The basic usage of the
## class can be done in the following ways.
##
## Example 1:
## > from p3do import p3do
## > r1=p3do('OTV')
## > r1.vars2load(['bx','by','bz'])
## > for i in range(20):
## > r1.loadslice(i)
## > DO WHATEVER!!!
## > r1.fin()
##
##
## Example 2:
## > from p3do import p3do
## > r1=p3do('OTV')
## > bxf=open('bx','rb')
## > bx=r1.readslice(bxf,10)
## > DO WHATEVER!!!
## > r1.fin()
##
## Methods in the class:
## 1) self.__init__(): Initialize the run object and load run parameters
## 2) self.print_params(): Print the run parameters
## 3) self.vars2load(): Define what variables to load, create variables
## and open files for reading data.
## 4) self.readslice(): Read a time slice from an open file.
## 5) self.loadslice(): Load a snapshot of time for all the defined variables.
## 6)
##
## <NAME>
## 2014/08/23
## Hat tip to ColbyCH for teaching me the basics of classes in python.
##
###########################################################################
import numpy as np
from subprocess import getstatusoutput as syscomout
from os.path import basename, realpath, exists
import TurbAn.Analysis.Simulations as af
from scipy.ndimage import gaussian_filter as gf
class p3do(object):
"""p3do object:
Tulasi Parashar's version of python library
to read P3D data from older versions of the code.
Created on 08/22/2014
Last modified on 02/26/2016
"""
def __init__(self,shelldirname="",code_type="",data_type="",filenum=""):
# If no rundir specified
if len(shelldirname) == 0: # Start init prompt
shelldirname = input('Please enter the rundir: ')
self.rundir = realpath(shelldirname)
self.dirname= basename(realpath(shelldirname))
# If code type not specified
if len(code_type) == 0:
self.code_type=input("GIT or PIC or Hybrid? (type g or p or h): ")
else:
self.code_type = code_type
# If Git version of the code AND filenum not given
if self.code_type == 'g' and len(filenum) == 0:
self.filenum=input("Please enter the file number to load (e.g. 000): ")
else:
self.filenum=filenum
# If data type not specified
if len(data_type) == 0:
self.data_type=input("Data Type? [(b)yte/ double (bb)yte/ (f)our byte/ (d)ouble precision] ")
else:
self.data_type = data_type
# Check where the paramfile is
if exists(self.rundir+'/param_'+self.dirname):
self.paramfile=self.rundir+'/param_'+self.dirname
elif exists(self.rundir+'/staging/param_'+self.dirname):
self.paramfile=self.rundir+'/staging/param_'+self.dirname
elif exists(self.rundir+'/paramfile'):
self.paramfile=self.rundir+'/paramfile'
else:
raise ValueError('Paramfile not found in '+self.dirname)
# load parameters
self.__loadparams__()
# If byte or double byte data, open the log file.
if self.data_type in ("b", "bb"):
print(self.rundir+'/staging/movie.log.'+self.filenum)
self.logfile=open(self.rundir+"/staging/movie.log."+self.filenum,"r")
self.logvars=['rho', 'jx', 'jy', 'jz', 'bx', 'by', 'bz', 'ex', 'ey'\
, 'ez', 'ne', 'jex', 'jey', 'jez', 'pexx', 'peyy', 'pezz', 'pexy', \
'peyz', 'pexz', 'ni', 'jix', 'jiy', 'jiz', 'pixx', 'piyy', 'pizz', \
'pixy', 'piyz', 'pixz']
self.szl=size(self.logvars)
if code_type == "h":
self.primitives=['bx','by','bz','jix','jiy','jiz','jx','jy','jz','ni'\
,'pixx','piyy','pizz','pixy','pixz','piyz','pe']
self.fls2l={'bx':'bx','by':'by','bz':'bz','jix':'jix','jiy':'jiy',\
'jiz':'jiz','jx':'jtotx','jy':'jtoty','jz':'jtotz','ni':'n','pixx':'pxx',\
'piyy':'pyy','pizz':'pzz','pixy':'pxy','pixz':'pxz','piyz':'pyz','pe':'pe'}
###
### Method to load parameters
###
def __loadparams__(self):
## Parameters to load
self.params=['pex','pey','pez','nx','ny','nz','lx','ly','lz',\
'movieout_full','dt','T_i','T_e','n_0','b0x','b0y','b0z','m_e'\
,'d_e2','c_2','ppg']
# Read parameters from file
for i in self.params:
comm="awk '/^#define/ && / "+i+" / {print $3}' "+self.paramfile
if syscomout("grep "+i+" "+self.paramfile)[0] == 0:
exec('self.'+i+'=float(syscomout(comm)[1])')
else:
exec('self.'+i+'=float(0.)')
## For hybrid code, set electron mass to extremely small
## and speed of light to extremely large.
HYBRID=syscomout("grep 'define hybrid' "+self.paramfile+" |awk '{print $2}'")[1]
if HYBRID != '':
self.m_e = self.d_e2
self.c_2 = 1e9
self.dtmovie=self.movieout_full
# Derive some others
self.nx=int(self.pex*self.nx)
self.ny=int(self.pey*self.ny)
self.nz=int(self.pez*self.nz)
self.dx=self.lx/self.nx
self.dy=self.ly/self.ny
self.dz=self.lz/self.nz
self.xx=np.linspace(0.,self.lx,self.nx)
self.yy=np.linspace(0.,self.ly,self.ny)
self.zz=np.linspace(0.,self.lz,self.nz)
self.xxt=np.linspace(0.,2*np.pi,self.nx)
self.yyt=np.linspace(0.,2*np.pi,self.ny)
self.zzt=np.linspace(0.,2*np.pi,self.nz)
self.B0 =np.sqrt(self.b0x**2+self.b0y**2+self.b0z**2)
self.betai = 2*self.n_0*self.T_i/self.B0**2
self.betae = 2*self.n_0*self.T_e/self.B0**2
self.nprocs = int(self.pex*self.pey*self.pez)
self.lambdae=np.sqrt(self.T_e/(self.n_0*self.c_2))
###
#### Method to print the parameters associated with the run
####
def print_params(self):
"""
A quick method to print the parameters and variables attached with
the p3d run object.
"""
for i in self.params:
exec('print i," = ",self.'+i)
####
#### Method to read a particular time slice from an open file.
####
def readslice(self,f,timeslice,v=""):
"""
This method reads a particular slice of time from a given file. The
explicit inputs are file name, time slice and data type. It is used
as:
output=self.readslice(filename,time)
"""
### Byte data #########################################################
if self.data_type == 'b':
f.seek(timeslice*self.nx*self.ny*self.nz)
field = np.fromfile(f,dtype='int8',count=self.nx*self.ny*self.nz)
field = np.reshape(field,(self.nx,self.ny,self.nz),order='F')
exec('minmax=self.'+v+'minmax[timeslice]')
field = minmax[0]+(minmax[1]-minmax[0])*field/255.
### Double byte data #################################################
elif self.data_type == 'bb':
f.seek(2*timeslice*self.nx*self.ny*self.nz)
field = np.fromfile(f,dtype='int16',count=self.nx*self.ny*self.nz)
field = np.reshape(field,(self.nx,self.ny,self.nz),order='F')
exec('minmax=self.'+v+'minmax[timeslice]')
field = minmax[0]+(minmax[1]-minmax[0])*(field+32678.)/65535.
### Four byte (single precision) data ################################
elif self.data_type == 'f':
f.seek(4*timeslice*self.nx*self.ny*self.nz)
field = np.fromfile(f,dtype='float32',count=self.nx*self.ny*self.nz)
field = np.reshape(field,(self.nx,self.ny,self.nz),order='F')
### Double precision data ############################################
elif self.data_type == 'd':
f.seek(8*timeslice*self.nx*self.ny*self.nz)
field = np.fromfile(f,dtype='float64',count=self.nx*self.ny*self.nz)
field = np.reshape(field,(self.nx,self.ny,self.nz),order='F')
return field
####
#### Method to define the variables to load, create variables and
#### open corresponding files.
####
def vars2load(self,v2l):
"""
Define the variables to load, define corresponding numpy arrays &
open the files
"""
if len(v2l) == 1:
if v2l[0] == 'min':
if self.code_type in ('p', 'g'):
self.vars2l=['bx','by','bz','jix','jiy','jiz','ni']
else:
self.vars2l=['bx','by','bz','jix','jiy','jiz','n']
elif v2l[0] == 'all':
if self.code_type in ('p', 'g'):
self.vars2l=['bx','by','bz','ex','ey','ez','jix','jiy','jiz','jex','jey'\
,'jez','jx','jy','jz','ni','pixx','piyy','pizz','pixy','pixz','piyz'\
,'pexx','pexy','pexz','peyy','peyz','pezz','ne','rho']
else:
self.vars2l=['bx','by','bz','jix','jiy','jiz','jx','jy','jz','ni'\
,'pixx','piyy','pizz','pixy','pixz','piyz','pe']
else:
self.vars2l=v2l
else:
self.vars2l = v2l
# Create arrays and open files
for i in self.vars2l:
exec('self.'+i+'=np.array(('+str(self.nx)+','+str(self.ny)+','+str(self.nz)+'))')
if self.code_type == 'p':
exec('self.'+i+'f=open("'+self.rundir+'/FPData/'+i+'","rb")')
elif self.code_type == 'h':
exec('self.'+i+'f=open("'+self.rundir+'/FPData/'+self.fls2l[i]+'","rb")')
elif self.code_type == 'g':
exec('self.'+i+'f=open("'+self.rundir+'/staging/movie.'+i+'.'+self.filenum+'","rb")')
# If 'b' or 'bb' data type, load minmax for each loaded variable
if self.data_type in ('b', 'bb'):
d=loadtxt(self.logfile)
for i in self.vars2l:
exec('self.'+i+'minmax=d[self.logvars.index("'+i+'")::len(self.logvars),:]')
# Find out the number of slices for the open file
self.__dict__[self.vars2l[0]+'f'].seek(0,2)
filesize=self.__dict__[self.vars2l[0]+'f'].tell()
numbersize=2**['b','bb','f','d'].index(self.data_type)
self.numslices=filesize/(self.nx*self.ny*self.nz*numbersize)
####
#### Method to load time slices for the loaded variables.
####
def loadslice(self,it,smth=None):
"""
Load the variables initialized by self.vars2load()
"""
if self.data_type in ('b', 'bb'):
for i in self.vars2l:
exec('self.'+i+'=self.readslice(self.'+i+'f,'+str(it)+',"'+i+'")')
else:
for i in self.vars2l:
exec('self.'+i+'=self.readslice(self.'+i+'f,'+str(it)+')')
self.mmd={}
for i in self.vars2l:
if smth is not None:
exec('self.'+i+'=gf(self.'+i+',sigma='+str(smth)+')')
exec('self.mmd["'+i+'"]=[self.'+i+'.min(),self.'+i+'.max()]')
self.time=it*self.movieout_full
####
#### Method to add attributes to the object
####
def addattr(self,key,val):
for i in key:
print('Adding '+i)
comm='self.'+i+'=val[key.index("'+i+'")]'; exec(comm)
if isinstance(val[key.index(i)],np.ndarray):
exec('self.mmd["'+i+'"]=[self.'+i+'.min(),self.'+i+'.max()]')
####
#### Method to compute derived quantities
####
def computevars(self,v2c,smth=None):
if 'tempi' in v2c:
self.tix = self.pixx/self.ni
self.tiy = self.piyy/self.ni
self.tiz = self.pizz/self.ni
self.ti = (self.tix+self.tiy+self.tiz)/3.
if 'tempe' in v2c:
if self.code_type == 'h':
self.te = self.pe/self.ni
else:
self.tex = self.pexx/self.ne
self.tey = self.peyy/self.ne
self.tez = self.pezz/self.ne
self.te = (self.tex+self.tey+self.tez)/3.
if any([1 for i in ['vi','ve','omi','dui','zpzm','udgpi','udgpe','ome','due'] if i in v2c]):
# if 'vi' in v2c or 've' in v2c or 'omi' in v2c or 'dui' in v2c or 'zpzm' in v2c or 'udgpi' in v2c\
# or 'udgpe' in v2c or 'ome' in v2c or 'due' in v2c:
self.vix = self.jix/self.ni
self.viy = self.jiy/self.ni
self.viz = self.jiz/self.ni
if 'omi' in v2c:
self.omxi,self.omyi,self.omzi = af.pcurl(self.vix,self.viy,\
self.viz,dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if 'dui' in v2c:
self.dui = af.pdiv(self.vix,self.viy,self.viz,dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if 'udgpi' in v2c:
self.udgpi = self.vix*af.pdiv(self.pixx, self.pixy, self.pixz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth) +\
self.viy*af.pdiv(self.pixy, self.piyy, self.piyz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth) +\
self.viz*af.pdiv(self.pixz, self.piyz, self.pizz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if any([1 for i in ['ve','ome', 'due','zpzm','udgpe'] if i in v2c]):
# if 've' in v2c or 'ome' in v2c or 'due' in v2c or 'zpzm' in v2c or 'udgpe' in v2c:
if self.code_type == 'h':
self.vex = self.vix - self.jx/self.ni
self.vey = self.viy - self.jy/self.ni
self.vez = self.viz - self.jz/self.ni
if 'udgpe' in v2c:
gp = af.pgrad(self.pe, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
self.udgpe = self.vex*gp[0] + self.vey*gp[1] + self.vez*gp[2]
else:
self.vex = -self.jex/self.ne
self.vey = -self.jey/self.ne
self.vez = -self.jez/self.ne
if 'udgpe' in v2c:
self.udgpe = self.vex*af.pdiv(self.pexx, self.pexy, self.pexz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth) +\
self.vey*af.pdiv(self.pexy, self.peyy, self.peyz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth) +\
self.vez*af.pdiv(self.pexz, self.peyz, self.pezz, dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if 'ome' in v2c:
self.omxe,self.omye,self.omze = af.pcurl(self.vex,self.vey,\
self.vez,dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if 'due' in v2c:
self.due = af.pdiv(self.vex,self.vey,self.vez,dx=self.dx,dy=self.dy,dz=self.dz,smth=smth)
if 'zpzm' in v2c:
cmx = (self.vix+self.m_e*self.vex)/(1+self.m_e)
cmy = (self.viy+self.m_e*self.vey)/(1+self.m_e)
cmz = (self.viz+self.m_e*self.vez)/(1+self.m_e)
den = self.ni+self.m_e*self.ne
self.zpx = self.bx/np.sqrt(den) + cmx
self.zpy = self.by/np.sqrt(den) + cmy
self.zpz = self.bz/np.sqrt(den) + cmz
self.zmx = self.bx/np.sqrt(den) - cmx
self.zmy = self.by/np.sqrt(den) - cmy
self.zmz = self.bz/np.sqrt(den) - cmz
####
#### Method to close opened files.
####
def fin(self):
"""
close the run files.
"""
for i in self.vars2l:
exec('self.'+i+'f.close()')
####
#### Load energies for the run
####
def loadenergies(self):
if self.code_type in ('p','g'):
self.evars=['t', 'eges', 'ebx' , 'eby' , 'ebz' , 'eex' , 'eey' , 'eez' ,\
'eem' , 'ekix', 'ekiy', 'ekiz', 'ekex', 'ekey', 'ekez', 'ekin', 'eifx', \
'eify', 'eifz', 'eefx', 'eefy', 'eefz', 'eipx', 'eipy', 'eipz', 'eepx', \
'eepy', 'eepz']
if self.code_type == 'h':
self.evars=['t','eges','eb','ebx','eby','ebz','eef','ION','ekix','ekiy',\
'ekiz','eif','eifx','eify','eifz','eep','eip','eipx','eipy','eipz','VIP','VIX',\
'VIY','VIZ','BIP','BIX','BIY','BIZ','BNU','ETA']
data=np.loadtxt(self.rundir+'/Energies.dat')
for i in range(np.size(self.evars)):
exec('self.'+self.evars[i]+'=data[:,'+str(i)+']')
self.eb0=0.5*(self.b0x**2+self.b0y**2+self.b0z**2)
if self.code_type in ('p','g'):
self.eb =self.ebx +self.eby +self.ebz
self.eip=self.eipx+self.eipy+self.eipz
self.eep=self.eepx+self.eepy+self.eepz
self.eif=self.eifx+self.eify+self.eifz
self.eef=self.eefx+self.eefy+self.eefz
self.ee =self.eex +self.eey +self.eez
self.edz=self.eb-self.eb0+self.eif+self.eef
self.tnl=self.t*np.sqrt(2*self.edz[0])*2*np.pi/self.lx
self.ltnl=self.lx/(np.sqrt(self.edz)*4*np.pi)
self.ta=np.zeros(len(self.eb))
for i in range(1,len(self.eb)):
self.ta[i]=self.ta[i-1]+self.dt*2./(self.ltnl[i-1]+self.ltnl[i])
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
2277,
13,
2277,
450,
770,
304,
4386,
349,
29941,
29928,
17402,
848,
297,
3017,
29889,
530,
1203,
338,
2825,
29871,
13,
2277,
393,
756,
278,
1065,
4128,
10959,
411,
372,
29889,
450,
6996,
8744,
310,
278,
29871,
13,
2277,
29871,
770,
508,
367,
2309,
297,
278,
1494,
5837,
29889,
13,
2277,
13,
2277,
8741,
29871,
29896,
29901,
13,
2277,
1405,
515,
282,
29941,
1867,
1053,
282,
29941,
1867,
13,
2277,
1405,
364,
29896,
29922,
29886,
29941,
1867,
877,
2891,
29963,
1495,
13,
2277,
1405,
364,
29896,
29889,
16908,
29906,
1359,
18959,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
11287,
13,
2277,
1405,
363,
474,
297,
3464,
29898,
29906,
29900,
1125,
13,
2277,
1405,
268,
364,
29896,
29889,
18132,
5897,
29898,
29875,
29897,
13,
2277,
1405,
268,
11662,
12317,
3040,
5348,
21004,
13,
2277,
1405,
364,
29896,
29889,
4951,
580,
13,
2277,
13,
2277,
13,
2277,
8741,
29871,
29906,
29901,
13,
2277,
1405,
515,
282,
29941,
1867,
1053,
282,
29941,
1867,
13,
2277,
1405,
364,
29896,
29922,
29886,
29941,
1867,
877,
2891,
29963,
1495,
13,
2277,
1405,
289,
24660,
29922,
3150,
877,
29890,
29916,
3788,
6050,
1495,
13,
2277,
1405,
289,
29916,
29922,
29878,
29896,
29889,
949,
18337,
29898,
29890,
24660,
29892,
29896,
29900,
29897,
13,
2277,
1405,
11662,
12317,
3040,
5348,
21004,
13,
2277,
1405,
364,
29896,
29889,
4951,
580,
13,
2277,
13,
2277,
8108,
29879,
297,
278,
770,
29901,
13,
2277,
29871,
29896,
29897,
1583,
17255,
2344,
1649,
7295,
25455,
278,
1065,
1203,
322,
2254,
1065,
4128,
13,
2277,
29871,
29906,
29897,
1583,
29889,
2158,
29918,
7529,
7295,
13905,
278,
1065,
4128,
13,
2277,
29871,
29941,
29897,
1583,
29889,
16908,
29906,
1359,
7295,
22402,
825,
3651,
304,
2254,
29892,
1653,
3651,
13,
2277,
1678,
322,
1722,
2066,
363,
5183,
848,
29889,
13,
2277,
29871,
29946,
29897,
1583,
29889,
949,
18337,
7295,
7523,
263,
931,
22780,
515,
385,
1722,
934,
29889,
13,
2277,
29871,
29945,
29897,
1583,
29889,
18132,
5897,
7295,
16012,
263,
22395,
310,
931,
363,
599,
278,
3342,
3651,
29889,
13,
2277,
29871,
29953,
29897,
29871,
13,
2277,
13,
2277,
462,
462,
4706,
529,
5813,
29958,
13,
2277,
462,
462,
308,
29906,
29900,
29896,
29946,
29914,
29900,
29947,
29914,
29906,
29941,
13,
2277,
25966,
6872,
304,
1530,
1609,
3210,
363,
18819,
592,
278,
2362,
1199,
310,
4413,
297,
3017,
29889,
13,
2277,
13,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
1014,
5014,
1053,
679,
4882,
4905,
408,
10876,
510,
449,
13,
3166,
2897,
29889,
2084,
1053,
2362,
3871,
29892,
1855,
2084,
29892,
4864,
13,
5215,
5383,
29890,
2744,
29889,
21067,
4848,
29889,
8942,
8250,
408,
2511,
13,
3166,
4560,
2272,
29889,
299,
3027,
1053,
330,
17019,
29918,
4572,
408,
330,
29888,
13,
1678,
13,
1990,
282,
29941,
1867,
29898,
3318,
1125,
13,
259,
9995,
29886,
29941,
1867,
1203,
29901,
13,
308,
27415,
6840,
1459,
1161,
279,
29915,
29879,
1873,
310,
3017,
3489,
13,
308,
304,
1303,
349,
29941,
29928,
848,
515,
9642,
6910,
310,
278,
775,
29889,
13,
308,
6760,
630,
373,
29871,
29900,
29947,
29914,
29906,
29906,
29914,
29906,
29900,
29896,
29946,
13,
308,
9208,
9120,
373,
29871,
29900,
29906,
29914,
29906,
29953,
29914,
29906,
29900,
29896,
29953,
13,
259,
9995,
13,
259,
822,
4770,
2344,
12035,
1311,
29892,
845,
295,
430,
381,
978,
543,
613,
401,
29918,
1853,
543,
613,
1272,
29918,
1853,
543,
613,
1777,
18605,
13776,
1125,
13,
418,
396,
960,
694,
17048,
381,
6790,
13,
418,
565,
7431,
29898,
845,
295,
430,
381,
978,
29897,
1275,
29871,
29900,
29901,
396,
7370,
2069,
9508,
13,
308,
528,
295,
430,
381,
978,
353,
1881,
877,
12148,
3896,
278,
17048,
381,
29901,
25710,
29871,
13,
418,
1583,
29889,
29160,
381,
353,
1855,
2084,
29898,
845,
295,
430,
381,
978,
29897,
13,
418,
1583,
29889,
25721,
29922,
2362,
3871,
29898,
6370,
2084,
29898,
845,
295,
430,
381,
978,
876,
13,
418,
396,
960,
775,
1134,
451,
6790,
13,
418,
565,
7431,
29898,
401,
29918,
1853,
29897,
1275,
29871,
29900,
29901,
13,
308,
1583,
29889,
401,
29918,
1853,
29922,
2080,
703,
29954,
1806,
470,
349,
2965,
470,
9665,
19515,
29973,
313,
1853,
330,
470,
282,
470,
298,
1125,
16521,
13,
418,
1683,
29901,
13,
308,
1583,
29889,
401,
29918,
1853,
353,
775,
29918,
1853,
13,
418,
396,
960,
11786,
1873,
310,
278,
775,
5300,
977,
18605,
451,
2183,
13,
418,
565,
1583,
29889,
401,
29918,
1853,
1275,
525,
29887,
29915,
322,
7431,
29898,
1777,
18605,
29897,
1275,
29871,
29900,
29901,
13,
308,
1583,
29889,
1777,
18605,
29922,
2080,
703,
12148,
3896,
278,
934,
1353,
304,
2254,
313,
29872,
29889,
29887,
29889,
29871,
29900,
29900,
29900,
1125,
16521,
13,
418,
1683,
29901,
13,
308,
1583,
29889,
1777,
18605,
29922,
1777,
18605,
13,
418,
396,
960,
848,
1134,
451,
6790,
13,
418,
565,
7431,
29898,
1272,
29918,
1853,
29897,
1275,
29871,
29900,
29901,
13,
308,
1583,
29889,
1272,
29918,
1853,
29922,
2080,
703,
1469,
5167,
29973,
17288,
29890,
29897,
29891,
371,
29914,
3765,
313,
1327,
29897,
29891,
371,
29914,
313,
29888,
29897,
473,
7023,
29914,
313,
29881,
29897,
2074,
16716,
29962,
16521,
13,
418,
1683,
29901,
13,
308,
1583,
29889,
1272,
29918,
1853,
353,
848,
29918,
1853,
13,
13,
418,
396,
5399,
988,
278,
1828,
1445,
338,
13,
418,
565,
4864,
29898,
1311,
29889,
29160,
381,
23097,
29914,
3207,
29918,
18717,
1311,
29889,
25721,
1125,
13,
308,
1583,
29889,
3207,
1445,
29922,
1311,
29889,
29160,
381,
23097,
29914,
3207,
29918,
18717,
1311,
29889,
25721,
13,
418,
25342,
4864,
29898,
1311,
29889,
29160,
381,
23097,
29914,
303,
6751,
29914,
3207,
29918,
18717,
1311,
29889,
25721,
1125,
13,
308,
1583,
29889,
3207,
1445,
29922,
1311,
29889,
29160,
381,
23097,
29914,
303,
6751,
29914,
3207,
29918,
18717,
1311,
29889,
25721,
13,
418,
25342,
4864,
29898,
1311,
29889,
29160,
381,
23097,
29914,
3207,
1445,
29374,
13,
308,
1583,
29889,
3207,
1445,
29922,
1311,
29889,
29160,
381,
23097,
29914,
3207,
1445,
29915,
13,
418,
1683,
29901,
13,
308,
12020,
7865,
2392,
877,
4736,
1445,
451,
1476,
297,
525,
29974,
1311,
29889,
25721,
29897,
13,
418,
396,
2254,
4128,
13,
418,
1583,
17255,
1359,
7529,
1649,
580,
13,
13,
418,
396,
960,
7023,
470,
3765,
7023,
848,
29892,
1722,
278,
1480,
934,
29889,
13,
418,
565,
1583,
29889,
1272,
29918,
1853,
297,
4852,
29890,
613,
376,
1327,
29908,
1125,
13,
308,
1596,
29898,
1311,
29889,
29160,
381,
23097,
29914,
303,
6751,
29914,
27362,
29889,
1188,
6169,
29974,
1311,
29889,
1777,
18605,
29897,
13,
308,
1583,
29889,
1188,
1445,
29922,
3150,
29898,
1311,
29889,
29160,
381,
13578,
29914,
303,
6751,
29914,
27362,
29889,
1188,
1213,
29974,
1311,
29889,
1777,
18605,
1699,
29878,
1159,
13,
308,
1583,
29889,
1188,
16908,
29922,
1839,
4650,
742,
525,
29926,
29916,
742,
525,
29926,
29891,
742,
525,
29926,
29920,
742,
525,
29890,
29916,
742,
525,
1609,
742,
525,
29890,
29920,
742,
525,
735,
742,
525,
1032,
12764,
13,
308,
1919,
525,
6096,
742,
525,
484,
742,
525,
29926,
735,
742,
525,
29926,
1032,
742,
525,
1324,
29920,
742,
525,
412,
4419,
742,
525,
412,
8071,
742,
525,
412,
5617,
742,
525,
412,
3594,
742,
320,
13,
308,
525,
412,
12339,
742,
525,
412,
29916,
29920,
742,
525,
1240,
742,
525,
29926,
861,
742,
525,
2397,
29891,
742,
525,
29926,
466,
742,
525,
29886,
861,
29916,
742,
525,
1631,
8071,
742,
525,
29886,
4981,
742,
320,
13,
308,
525,
29886,
861,
29891,
742,
525,
1631,
12339,
742,
525,
29886,
861,
29920,
2033,
13,
308,
1583,
29889,
3616,
29880,
29922,
2311,
29898,
1311,
29889,
1188,
16908,
29897,
13,
418,
565,
775,
29918,
1853,
1275,
376,
29882,
1115,
13,
308,
1583,
29889,
9469,
277,
3145,
29922,
1839,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
3788,
29926,
861,
3788,
2397,
29891,
3788,
29926,
466,
3788,
29926,
29916,
3788,
29926,
29891,
3788,
29926,
29920,
3788,
1240,
12764,
13,
308,
1919,
29915,
29886,
861,
29916,
3788,
1631,
8071,
3788,
29886,
4981,
3788,
29886,
861,
29891,
3788,
29886,
861,
29920,
3788,
1631,
12339,
3788,
412,
2033,
13,
308,
1583,
29889,
1579,
29879,
29906,
29880,
3790,
29915,
29890,
29916,
22099,
29890,
29916,
3788,
1609,
22099,
1609,
3788,
29890,
29920,
22099,
29890,
29920,
3788,
29926,
861,
22099,
29926,
861,
3788,
2397,
29891,
22099,
2397,
29891,
742,
29905,
13,
308,
525,
29926,
466,
22099,
29926,
466,
3788,
29926,
29916,
22099,
29926,
4260,
29916,
3788,
29926,
29891,
22099,
29926,
4260,
29891,
3788,
29926,
29920,
22099,
29926,
4260,
29920,
3788,
1240,
22099,
29876,
3788,
29886,
861,
29916,
22099,
1756,
29916,
742,
29905,
13,
308,
525,
1631,
8071,
22099,
2272,
29891,
3788,
29886,
4981,
22099,
29886,
5617,
3788,
29886,
861,
29891,
22099,
1756,
29891,
3788,
29886,
861,
29920,
22099,
1756,
29920,
3788,
1631,
12339,
22099,
2272,
29920,
3788,
412,
22099,
412,
10827,
13,
3986,
13,
2277,
29937,
13,
2277,
29937,
8108,
304,
2254,
4128,
13,
2277,
29937,
13,
259,
822,
4770,
1359,
7529,
12035,
1311,
1125,
13,
418,
444,
12662,
2699,
304,
2254,
13,
418,
1583,
29889,
7529,
29922,
1839,
412,
29916,
3788,
412,
29891,
3788,
14001,
3788,
23818,
3788,
1460,
3788,
29876,
29920,
3788,
29880,
29916,
3788,
368,
3788,
29880,
29920,
742,
29905,
13,
418,
525,
27362,
449,
29918,
8159,
3788,
6008,
3788,
29911,
29918,
29875,
3788,
29911,
29918,
29872,
3788,
29876,
29918,
29900,
3788,
29890,
29900,
29916,
3788,
29890,
29900,
29891,
3788,
29890,
29900,
29920,
3788,
29885,
29918,
29872,
12764,
13,
418,
1919,
29915,
29881,
29918,
29872,
29906,
3788,
29883,
29918,
29906,
3788,
407,
29887,
2033,
13,
418,
396,
7523,
4128,
515,
934,
13,
418,
363,
474,
297,
1583,
29889,
7529,
29901,
13,
308,
844,
543,
20011,
8207,
29985,
29937,
7922,
29914,
2607,
847,
15691,
29875,
13578,
847,
426,
2158,
395,
29941,
10162,
15691,
1311,
29889,
3207,
1445,
13,
308,
565,
10876,
510,
449,
703,
22385,
15691,
29875,
13578,
15691,
1311,
29889,
3207,
1445,
9601,
29900,
29962,
1275,
29871,
29900,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
7411,
29898,
9675,
510,
449,
29898,
2055,
9601,
29896,
2314,
1495,
13,
308,
1683,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
7411,
29898,
29900,
1846,
1495,
13,
13,
418,
444,
1152,
7498,
19515,
775,
29892,
731,
11966,
4158,
304,
14154,
2319,
29871,
13,
418,
444,
322,
6210,
310,
3578,
304,
14154,
2919,
29889,
13,
418,
379,
29979,
15176,
1367,
29922,
9675,
510,
449,
703,
22385,
525,
7922,
7498,
19515,
29915,
15691,
1311,
29889,
3207,
1445,
13578,
891,
20011,
22372,
2158,
395,
29906,
10162,
1159,
29961,
29896,
29962,
13,
418,
565,
379,
29979,
15176,
1367,
2804,
525,
2396,
13,
308,
1583,
29889,
29885,
29918,
29872,
353,
1583,
29889,
29881,
29918,
29872,
29906,
13,
308,
1583,
29889,
29883,
29918,
29906,
353,
29871,
29896,
29872,
29929,
13,
13,
418,
1583,
29889,
6008,
27362,
29922,
1311,
29889,
27362,
449,
29918,
8159,
13,
418,
396,
2452,
573,
777,
4045,
13,
418,
1583,
29889,
23818,
29922,
524,
29898,
1311,
29889,
412,
29916,
29930,
1311,
29889,
23818,
29897,
13,
418,
1583,
29889,
1460,
29922,
524,
29898,
1311,
29889,
412,
29891,
29930,
1311,
29889,
1460,
29897,
13,
418,
1583,
29889,
29876,
29920,
29922,
524,
29898,
1311,
29889,
14001,
29930,
1311,
29889,
29876,
29920,
29897,
13,
418,
1583,
29889,
8235,
29922,
1311,
29889,
29880,
29916,
29914,
1311,
29889,
23818,
13,
418,
1583,
29889,
4518,
29922,
1311,
29889,
368,
29914,
1311,
29889,
1460,
13,
418,
1583,
29889,
5601,
29922,
1311,
29889,
29880,
29920,
29914,
1311,
29889,
29876,
29920,
13,
418,
1583,
29889,
4419,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
1311,
29889,
29880,
29916,
29892,
1311,
29889,
23818,
29897,
13,
418,
1583,
29889,
8071,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
1311,
29889,
368,
29892,
1311,
29889,
1460,
29897,
13,
418,
1583,
29889,
5617,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
1311,
29889,
29880,
29920,
29892,
1311,
29889,
29876,
29920,
29897,
13,
418,
1583,
29889,
29916,
486,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
29906,
29930,
9302,
29889,
1631,
29892,
1311,
29889,
23818,
29897,
13,
418,
1583,
29889,
29891,
3637,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
29906,
29930,
9302,
29889,
1631,
29892,
1311,
29889,
1460,
29897,
13,
418,
1583,
29889,
29920,
2065,
29922,
9302,
29889,
1915,
3493,
29898,
29900,
1696,
29906,
29930,
9302,
29889,
1631,
29892,
1311,
29889,
29876,
29920,
29897,
13,
418,
1583,
29889,
29933,
29900,
353,
9302,
29889,
3676,
29898,
1311,
29889,
29890,
29900,
29916,
1068,
29906,
29974,
1311,
29889,
29890,
29900,
29891,
1068,
29906,
29974,
1311,
29889,
29890,
29900,
29920,
1068,
29906,
29897,
13,
418,
1583,
29889,
3571,
29875,
353,
29871,
29906,
29930,
1311,
29889,
29876,
29918,
29900,
29930,
1311,
29889,
29911,
29918,
29875,
29914,
1311,
29889,
29933,
29900,
1068,
29906,
13,
418,
1583,
29889,
3571,
29872,
353,
29871,
29906,
29930,
1311,
29889,
29876,
29918,
29900,
29930,
1311,
29889,
29911,
29918,
29872,
29914,
1311,
29889,
29933,
29900,
1068,
29906,
13,
418,
1583,
29889,
29876,
771,
2395,
353,
938,
29898,
1311,
29889,
412,
29916,
29930,
1311,
29889,
412,
29891,
29930,
1311,
29889,
14001,
29897,
13,
418,
1583,
29889,
2892,
29872,
29922,
9302,
29889,
3676,
29898,
1311,
29889,
29911,
29918,
29872,
14571,
1311,
29889,
29876,
29918,
29900,
29930,
1311,
29889,
29883,
29918,
29906,
876,
13,
539,
13,
2277,
29937,
13,
4136,
8108,
304,
1596,
278,
4128,
6942,
411,
278,
1065,
13,
4136,
13,
259,
822,
1596,
29918,
7529,
29898,
1311,
1125,
13,
418,
9995,
13,
308,
319,
4996,
1158,
304,
1596,
278,
4128,
322,
3651,
10959,
411,
13,
308,
278,
282,
29941,
29881,
1065,
1203,
29889,
13,
418,
9995,
13,
418,
363,
474,
297,
1583,
29889,
7529,
29901,
13,
308,
2279,
877,
2158,
474,
1699,
353,
9162,
1311,
6169,
29974,
29875,
29897,
13,
4136,
13,
4136,
8108,
304,
1303,
263,
3153,
931,
22780,
515,
385,
1722,
934,
29889,
13,
4136,
29871,
13,
259,
822,
13623,
5897,
29898,
1311,
29892,
29888,
29892,
3706,
5897,
29892,
29894,
13776,
1125,
13,
418,
9995,
13,
308,
910,
1158,
13623,
263,
3153,
22780,
310,
931,
515,
263,
2183,
934,
29889,
450,
13,
308,
6261,
10970,
526,
934,
1024,
29892,
931,
22780,
322,
848,
1134,
29889,
739,
338,
1304,
29871,
13,
308,
408,
29901,
13,
9651,
1962,
29922,
1311,
29889,
949,
18337,
29898,
9507,
29892,
2230,
29897,
13,
418,
9995,
13,
418,
835,
19831,
848,
835,
13383,
13383,
13383,
4136,
2277,
13,
418,
565,
1583,
29889,
1272,
29918,
1853,
1275,
525,
29890,
2396,
13,
308,
285,
29889,
344,
1416,
29898,
3706,
5897,
29930,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
3166,
1445,
29898,
29888,
29892,
29881,
1853,
2433,
524,
29947,
742,
2798,
29922,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
690,
14443,
29898,
2671,
22657,
1311,
29889,
23818,
29892,
1311,
29889,
1460,
29892,
1311,
29889,
29876,
29920,
511,
2098,
2433,
29943,
1495,
13,
308,
2279,
877,
1195,
3317,
29922,
1311,
6169,
29974,
29894,
23097,
1195,
3317,
29961,
3706,
5897,
29962,
1495,
13,
308,
1746,
353,
1375,
3317,
29961,
29900,
10062,
29898,
1195,
3317,
29961,
29896,
29962,
29899,
1195,
3317,
29961,
29900,
2314,
29930,
2671,
29914,
29906,
29945,
29945,
29889,
13,
418,
835,
11599,
7023,
848,
835,
13383,
13383,
7346,
4136,
2277,
13,
418,
25342,
1583,
29889,
1272,
29918,
1853,
1275,
525,
1327,
2396,
13,
308,
285,
29889,
344,
1416,
29898,
29906,
29930,
3706,
5897,
29930,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
3166,
1445,
29898,
29888,
29892,
29881,
1853,
2433,
524,
29896,
29953,
742,
2798,
29922,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
690,
14443,
29898,
2671,
22657,
1311,
29889,
23818,
29892,
1311,
29889,
1460,
29892,
1311,
29889,
29876,
29920,
511,
2098,
2433,
29943,
1495,
13,
308,
2279,
877,
1195,
3317,
29922,
1311,
6169,
29974,
29894,
23097,
1195,
3317,
29961,
3706,
5897,
29962,
1495,
13,
308,
1746,
353,
1375,
3317,
29961,
29900,
10062,
29898,
1195,
3317,
29961,
29896,
29962,
29899,
1195,
3317,
29961,
29900,
2314,
16395,
2671,
29974,
29941,
29906,
29953,
29955,
29947,
1846,
29914,
29953,
29945,
29945,
29941,
29945,
29889,
13,
418,
835,
12458,
7023,
313,
14369,
16716,
29897,
848,
835,
13383,
7346,
4136,
29937,
13,
418,
25342,
1583,
29889,
1272,
29918,
1853,
1275,
525,
29888,
2396,
13,
308,
285,
29889,
344,
1416,
29898,
29946,
29930,
3706,
5897,
29930,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
3166,
1445,
29898,
29888,
29892,
29881,
1853,
2433,
7411,
29941,
29906,
742,
2798,
29922,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
690,
14443,
29898,
2671,
22657,
1311,
29889,
23818,
29892,
1311,
29889,
1460,
29892,
1311,
29889,
29876,
29920,
511,
2098,
2433,
29943,
1495,
13,
418,
835,
11599,
16716,
848,
835,
13383,
13383,
7346,
29937,
13,
418,
25342,
1583,
29889,
1272,
29918,
1853,
1275,
525,
29881,
2396,
13,
308,
285,
29889,
344,
1416,
29898,
29947,
29930,
3706,
5897,
29930,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
3166,
1445,
29898,
29888,
29892,
29881,
1853,
2433,
7411,
29953,
29946,
742,
2798,
29922,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29897,
13,
308,
1746,
353,
7442,
29889,
690,
14443,
29898,
2671,
22657,
1311,
29889,
23818,
29892,
1311,
29889,
1460,
29892,
1311,
29889,
29876,
29920,
511,
2098,
2433,
29943,
1495,
13,
418,
736,
1746,
13,
4136,
13,
4136,
8108,
304,
4529,
278,
3651,
304,
2254,
29892,
1653,
3651,
322,
13,
4136,
1722,
6590,
2066,
29889,
13,
4136,
29871,
13,
259,
822,
24987,
29906,
1359,
29898,
1311,
29892,
29894,
29906,
29880,
1125,
13,
418,
9995,
13,
308,
22402,
278,
3651,
304,
2254,
29892,
4529,
6590,
12655,
7049,
669,
13,
308,
1722,
278,
2066,
13,
418,
9995,
13,
418,
565,
7431,
29898,
29894,
29906,
29880,
29897,
1275,
29871,
29896,
29901,
13,
308,
565,
325,
29906,
29880,
29961,
29900,
29962,
1275,
525,
1195,
2396,
13,
9651,
565,
1583,
29889,
401,
29918,
1853,
297,
6702,
29886,
742,
525,
29887,
29374,
13,
1669,
1583,
29889,
16908,
29906,
29880,
29922,
1839,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
3788,
29926,
861,
3788,
2397,
29891,
3788,
29926,
466,
3788,
1240,
2033,
13,
9651,
1683,
29901,
13,
1669,
1583,
29889,
16908,
29906,
29880,
29922,
1839,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
3788,
29926,
861,
3788,
2397,
29891,
3788,
29926,
466,
3788,
29876,
2033,
13,
308,
25342,
325,
29906,
29880,
29961,
29900,
29962,
1275,
525,
497,
2396,
13,
9651,
565,
1583,
29889,
401,
29918,
1853,
297,
6702,
29886,
742,
525,
29887,
29374,
13,
1669,
1583,
29889,
16908,
29906,
29880,
29922,
1839,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
3788,
735,
3788,
1032,
3788,
6096,
3788,
29926,
861,
3788,
2397,
29891,
3788,
29926,
466,
3788,
29926,
735,
3788,
29926,
1032,
12764,
13,
1669,
1919,
29915,
1324,
29920,
3788,
29926,
29916,
3788,
29926,
29891,
3788,
29926,
29920,
3788,
1240,
3788,
29886,
861,
29916,
3788,
1631,
8071,
3788,
29886,
4981,
3788,
29886,
861,
29891,
3788,
29886,
861,
29920,
3788,
1631,
12339,
12764,
13,
1669,
1919,
29915,
412,
4419,
3788,
412,
3594,
3788,
412,
29916,
29920,
3788,
412,
8071,
3788,
412,
12339,
3788,
412,
5617,
3788,
484,
3788,
4650,
2033,
13,
9651,
1683,
29901,
13,
1669,
1583,
29889,
16908,
29906,
29880,
29922,
1839,
29890,
29916,
3788,
1609,
3788,
29890,
29920,
3788,
29926,
861,
3788,
2397,
29891,
3788,
29926,
466,
3788,
29926,
29916,
3788,
29926,
29891,
3788,
29926,
29920,
3788,
1240,
12764,
13,
1669,
1919,
29915,
29886,
861,
29916,
3788,
1631,
8071,
3788,
29886,
4981,
3788,
29886,
861,
29891,
3788,
29886,
861,
29920,
3788,
1631,
12339,
3788,
412,
2033,
13,
308,
1683,
29901,
13,
1669,
1583,
29889,
16908,
29906,
29880,
29922,
29894,
29906,
29880,
13,
418,
1683,
29901,
13,
308,
1583,
29889,
16908,
29906,
29880,
353,
325,
29906,
29880,
13,
418,
396,
6204,
7049,
322,
1722,
2066,
13,
418,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
308,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
9302,
29889,
2378,
29898,
877,
29974,
710,
29898,
1311,
29889,
23818,
7240,
3788,
29974,
710,
29898,
1311,
29889,
1460,
7240,
3788,
29974,
710,
29898,
1311,
29889,
29876,
29920,
7240,
8785,
1495,
13,
308,
565,
1583,
29889,
401,
29918,
1853,
1275,
525,
29886,
2396,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29888,
29922,
3150,
703,
18717,
1311,
29889,
29160,
381,
23097,
29914,
26353,
1469,
29914,
18717,
29875,
23097,
3284,
6050,
1159,
1495,
13,
308,
25342,
1583,
29889,
401,
29918,
1853,
1275,
525,
29882,
2396,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29888,
29922,
3150,
703,
18717,
1311,
29889,
29160,
381,
23097,
29914,
26353,
1469,
29914,
18717,
1311,
29889,
1579,
29879,
29906,
29880,
29961,
29875,
10062,
29915,
3284,
6050,
1159,
1495,
13,
308,
25342,
1583,
29889,
401,
29918,
1853,
1275,
525,
29887,
2396,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29888,
29922,
3150,
703,
18717,
1311,
29889,
29160,
381,
23097,
29914,
303,
6751,
29914,
27362,
6169,
29974,
29875,
29974,
4286,
18717,
1311,
29889,
1777,
18605,
23097,
3284,
6050,
1159,
1495,
13,
418,
396,
960,
525,
29890,
29915,
470,
525,
1327,
29915,
848,
1134,
29892,
2254,
1375,
3317,
363,
1269,
7500,
2286,
13,
418,
565,
1583,
29889,
1272,
29918,
1853,
297,
6702,
29890,
742,
525,
1327,
29374,
13,
308,
270,
29922,
1359,
3945,
29898,
1311,
29889,
1188,
1445,
29897,
13,
308,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
1195,
3317,
29922,
29881,
29961,
1311,
29889,
1188,
16908,
29889,
2248,
703,
18717,
29875,
23097,
1159,
1057,
2435,
29898,
1311,
29889,
1188,
16908,
511,
17531,
1495,
13,
418,
396,
10987,
714,
278,
1353,
310,
269,
29399,
363,
278,
1722,
934,
13,
418,
1583,
17255,
8977,
1649,
29961,
1311,
29889,
16908,
29906,
29880,
29961,
29900,
10062,
29915,
29888,
13359,
344,
1416,
29898,
29900,
29892,
29906,
29897,
13,
418,
2066,
675,
29922,
1311,
17255,
8977,
1649,
29961,
1311,
29889,
16908,
29906,
29880,
29961,
29900,
10062,
29915,
29888,
13359,
29873,
514,
580,
13,
418,
3694,
675,
29922,
29906,
1068,
1839,
29890,
3788,
1327,
3788,
29888,
3788,
29881,
13359,
2248,
29898,
1311,
29889,
1272,
29918,
1853,
29897,
13,
418,
1583,
29889,
1949,
29879,
29399,
29922,
5325,
675,
14571,
1311,
29889,
23818,
29930,
1311,
29889,
1460,
29930,
1311,
29889,
29876,
29920,
29930,
20326,
675,
29897,
13,
13,
4136,
13,
4136,
8108,
304,
2254,
931,
269,
29399,
363,
278,
7500,
3651,
29889,
13,
4136,
13,
259,
822,
15376,
5897,
29898,
1311,
29892,
277,
29892,
3844,
386,
29922,
8516,
1125,
13,
418,
9995,
13,
308,
16012,
278,
3651,
16601,
491,
1583,
29889,
16908,
29906,
1359,
580,
13,
418,
9995,
13,
418,
565,
1583,
29889,
1272,
29918,
1853,
297,
6702,
29890,
742,
525,
1327,
29374,
13,
308,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
1311,
29889,
949,
18337,
29898,
1311,
6169,
29974,
29875,
23097,
29888,
5501,
29974,
710,
29898,
277,
7240,
742,
29908,
18717,
29875,
23097,
1159,
1495,
13,
418,
1683,
29901,
13,
308,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
1311,
29889,
949,
18337,
29898,
1311,
6169,
29974,
29875,
23097,
29888,
5501,
29974,
710,
29898,
277,
7240,
1495,
1495,
13,
418,
1583,
29889,
29885,
3487,
3790,
29913,
13,
418,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
308,
565,
1560,
386,
338,
451,
6213,
29901,
13,
9651,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29922,
29887,
29888,
29898,
1311,
6169,
29974,
29875,
29974,
742,
3754,
2433,
29974,
710,
29898,
3844,
386,
7240,
1495,
1495,
13,
308,
2279,
877,
1311,
29889,
29885,
3487,
3366,
18717,
29875,
23097,
3108,
11759,
1311,
6169,
29974,
29875,
29974,
4286,
1195,
3285,
1311,
6169,
29974,
29875,
29974,
4286,
3317,
580,
29962,
1495,
13,
418,
1583,
29889,
2230,
29922,
277,
29930,
1311,
29889,
27362,
449,
29918,
8159,
13,
4136,
13,
4136,
8108,
304,
788,
8393,
304,
278,
1203,
13,
4136,
13,
259,
822,
788,
5552,
29898,
1311,
29892,
1989,
29892,
791,
1125,
13,
418,
363,
474,
297,
1820,
29901,
13,
308,
1596,
877,
2528,
292,
525,
29974,
29875,
29897,
29871,
13,
308,
844,
2433,
1311,
6169,
29974,
29875,
23097,
29922,
791,
29961,
1989,
29889,
2248,
703,
18717,
29875,
23097,
13531,
2670,
2279,
29898,
2055,
29897,
13,
308,
565,
338,
8758,
29898,
791,
29961,
1989,
29889,
2248,
29898,
29875,
29897,
1402,
9302,
29889,
299,
2378,
1125,
13,
9651,
2279,
877,
1311,
29889,
29885,
3487,
3366,
18717,
29875,
23097,
3108,
11759,
1311,
6169,
29974,
29875,
29974,
4286,
1195,
3285,
1311,
6169,
29974,
29875,
29974,
4286,
3317,
580,
29962,
1495,
13,
13,
4136,
13,
4136,
8108,
304,
10272,
10723,
26855,
13,
4136,
13,
259,
822,
2912,
5750,
1503,
29898,
1311,
29892,
29894,
29906,
29883,
29892,
3844,
386,
29922,
8516,
1125,
13,
418,
565,
525,
1356,
1631,
29915,
297,
325,
29906,
29883,
29901,
13,
308,
1583,
29889,
29873,
861,
353,
1583,
29889,
29886,
861,
29916,
29914,
1311,
29889,
1240,
13,
308,
1583,
29889,
2034,
29891,
353,
1583,
29889,
1631,
8071,
29914,
1311,
29889,
1240,
13,
308,
1583,
29889,
29873,
466,
353,
1583,
29889,
29886,
4981,
29914,
1311,
29889,
1240,
13,
308,
1583,
29889,
2034,
29871,
353,
313,
1311,
29889,
29873,
861,
29974,
1311,
29889,
2034,
29891,
29974,
1311,
29889,
29873,
466,
6802,
29941,
29889,
13,
13,
418,
565,
525,
1356,
412,
29915,
297,
325,
29906,
29883,
29901,
13,
308,
565,
1583,
29889,
401,
29918,
1853,
1275,
525,
29882,
2396,
13,
9651,
1583,
29889,
371,
29871,
353,
1583,
29889,
412,
29914,
1311,
29889,
1240,
13,
308,
1683,
29901,
13,
9651,
1583,
29889,
4776,
353,
1583,
29889,
412,
4419,
29914,
1311,
29889,
484,
13,
9651,
1583,
29889,
371,
29891,
353,
1583,
29889,
412,
8071,
29914,
1311,
29889,
484,
13,
9651,
1583,
29889,
371,
29920,
353,
1583,
29889,
412,
5617,
29914,
1311,
29889,
484,
13,
9651,
1583,
29889,
371,
29871,
353,
313,
1311,
29889,
4776,
29974,
1311,
29889,
371,
29891,
29974,
1311,
29889,
371,
29920,
6802,
29941,
29889,
13,
13,
418,
565,
738,
4197,
29896,
363,
474,
297,
6024,
1403,
3788,
345,
3788,
21019,
3788,
700,
29875,
3788,
29920,
29886,
14018,
3788,
566,
29887,
1631,
3788,
566,
29887,
412,
3788,
608,
3788,
29123,
2033,
565,
474,
297,
325,
29906,
29883,
29962,
1125,
13,
29937,
268,
565,
525,
1403,
29915,
297,
325,
29906,
29883,
470,
525,
345,
29915,
297,
325,
29906,
29883,
470,
525,
21019,
29915,
297,
325,
29906,
29883,
470,
525,
700,
29875,
29915,
297,
325,
29906,
29883,
470,
525,
29920,
29886,
14018,
29915,
297,
325,
29906,
29883,
470,
525,
566,
29887,
1631,
29915,
297,
325,
29906,
29883,
29905,
13,
29937,
268,
470,
525,
566,
29887,
412,
29915,
297,
325,
29906,
29883,
470,
525,
608,
29915,
297,
325,
29906,
29883,
470,
525,
29123,
29915,
297,
325,
29906,
29883,
29901,
13,
308,
1583,
29889,
29894,
861,
353,
1583,
29889,
29926,
861,
29914,
1311,
29889,
1240,
13,
308,
1583,
29889,
1403,
29891,
353,
1583,
29889,
2397,
29891,
29914,
1311,
29889,
1240,
13,
308,
1583,
29889,
29894,
466,
353,
1583,
29889,
29926,
466,
29914,
1311,
29889,
1240,
13,
308,
565,
525,
21019,
29915,
297,
325,
29906,
29883,
29901,
13,
9651,
1583,
29889,
290,
5389,
29892,
1311,
29889,
16103,
29875,
29892,
1311,
29889,
290,
2526,
353,
2511,
29889,
6739,
2271,
29898,
1311,
29889,
29894,
861,
29892,
1311,
29889,
1403,
29891,
2053,
13,
9651,
1583,
29889,
29894,
466,
29892,
8235,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
13,
308,
565,
525,
700,
29875,
29915,
297,
325,
29906,
29883,
29901,
13,
9651,
1583,
29889,
700,
29875,
353,
2511,
29889,
29886,
4563,
29898,
1311,
29889,
29894,
861,
29892,
1311,
29889,
1403,
29891,
29892,
1311,
29889,
29894,
466,
29892,
8235,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
13,
308,
565,
525,
566,
29887,
1631,
29915,
297,
325,
29906,
29883,
29901,
13,
9651,
1583,
29889,
566,
29887,
1631,
353,
1583,
29889,
29894,
861,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
29886,
861,
29916,
29892,
1583,
29889,
29886,
861,
29891,
29892,
1583,
29889,
29886,
861,
29920,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
17501,
13,
462,
308,
1583,
29889,
1403,
29891,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
29886,
861,
29891,
29892,
1583,
29889,
1631,
8071,
29892,
1583,
29889,
1631,
12339,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
17501,
13,
462,
308,
1583,
29889,
29894,
466,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
29886,
861,
29920,
29892,
1583,
29889,
1631,
12339,
29892,
1583,
29889,
29886,
4981,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
29871,
13,
13,
308,
565,
738,
4197,
29896,
363,
474,
297,
6024,
345,
3788,
608,
742,
525,
29123,
3788,
29920,
29886,
14018,
3788,
566,
29887,
412,
2033,
565,
474,
297,
325,
29906,
29883,
29962,
1125,
13,
29937,
4706,
565,
525,
345,
29915,
297,
325,
29906,
29883,
470,
525,
608,
29915,
297,
325,
29906,
29883,
470,
525,
29123,
29915,
297,
325,
29906,
29883,
470,
525,
29920,
29886,
14018,
29915,
297,
325,
29906,
29883,
470,
525,
566,
29887,
412,
29915,
297,
325,
29906,
29883,
29901,
13,
9651,
565,
1583,
29889,
401,
29918,
1853,
1275,
525,
29882,
2396,
13,
1669,
1583,
29889,
13809,
353,
1583,
29889,
29894,
861,
448,
1583,
29889,
29926,
29916,
29914,
1311,
29889,
1240,
13,
1669,
1583,
29889,
6950,
353,
1583,
29889,
1403,
29891,
448,
1583,
29889,
29926,
29891,
29914,
1311,
29889,
1240,
13,
1669,
1583,
29889,
13325,
353,
1583,
29889,
29894,
466,
448,
1583,
29889,
29926,
29920,
29914,
1311,
29889,
1240,
13,
1669,
565,
525,
566,
29887,
412,
29915,
297,
325,
29906,
29883,
29901,
13,
462,
29871,
330,
29886,
353,
2511,
29889,
29886,
5105,
29898,
1311,
29889,
412,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
13,
462,
29871,
1583,
29889,
566,
29887,
412,
353,
1583,
29889,
13809,
29930,
29887,
29886,
29961,
29900,
29962,
718,
1583,
29889,
6950,
29930,
29887,
29886,
29961,
29896,
29962,
718,
1583,
29889,
13325,
29930,
29887,
29886,
29961,
29906,
29962,
29871,
13,
9651,
1683,
29901,
13,
1669,
1583,
29889,
13809,
353,
448,
1311,
29889,
29926,
735,
29914,
1311,
29889,
484,
13,
1669,
1583,
29889,
6950,
353,
448,
1311,
29889,
29926,
1032,
29914,
1311,
29889,
484,
13,
1669,
1583,
29889,
13325,
353,
448,
1311,
29889,
1324,
29920,
29914,
1311,
29889,
484,
13,
1669,
565,
525,
566,
29887,
412,
29915,
297,
325,
29906,
29883,
29901,
13,
462,
29871,
1583,
29889,
566,
29887,
412,
353,
1583,
29889,
13809,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
412,
4419,
29892,
1583,
29889,
412,
3594,
29892,
1583,
29889,
412,
29916,
29920,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
17501,
13,
462,
1669,
1583,
29889,
6950,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
412,
3594,
29892,
1583,
29889,
412,
8071,
29892,
1583,
29889,
412,
12339,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
17501,
13,
462,
1669,
1583,
29889,
13325,
29930,
2142,
29889,
29886,
4563,
29898,
1311,
29889,
412,
29916,
29920,
29892,
1583,
29889,
412,
12339,
29892,
1583,
29889,
412,
5617,
29892,
15414,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
29871,
13,
9651,
565,
525,
608,
29915,
297,
325,
29906,
29883,
29901,
13,
1669,
1583,
29889,
290,
17115,
29892,
1311,
29889,
290,
4099,
29892,
1311,
29889,
290,
911,
353,
2511,
29889,
6739,
2271,
29898,
1311,
29889,
13809,
29892,
1311,
29889,
6950,
2053,
13,
1669,
1583,
29889,
13325,
29892,
8235,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
13,
9651,
565,
525,
29123,
29915,
297,
325,
29906,
29883,
29901,
13,
1669,
1583,
29889,
29123,
353,
2511,
29889,
29886,
4563,
29898,
1311,
29889,
13809,
29892,
1311,
29889,
6950,
29892,
1311,
29889,
13325,
29892,
8235,
29922,
1311,
29889,
8235,
29892,
4518,
29922,
1311,
29889,
4518,
29892,
5601,
29922,
1311,
29889,
5601,
29892,
3844,
386,
29922,
3844,
386,
29897,
13,
13,
308,
565,
525,
29920,
29886,
14018,
29915,
297,
325,
29906,
29883,
29901,
13,
9651,
7477,
29916,
353,
313,
1311,
29889,
29894,
861,
29974,
1311,
29889,
29885,
29918,
29872,
29930,
1311,
29889,
13809,
6802,
29898,
29896,
29974,
1311,
29889,
29885,
29918,
29872,
29897,
13,
9651,
274,
1357,
353,
313,
1311,
29889,
1403,
29891,
29974,
1311,
29889,
29885,
29918,
29872,
29930,
1311,
29889,
6950,
6802,
29898,
29896,
29974,
1311,
29889,
29885,
29918,
29872,
29897,
13,
9651,
7477,
29920,
353,
313,
1311,
29889,
29894,
466,
29974,
1311,
29889,
29885,
29918,
29872,
29930,
1311,
29889,
13325,
6802,
29898,
29896,
29974,
1311,
29889,
29885,
29918,
29872,
29897,
13,
9651,
972,
353,
1583,
29889,
1240,
29974,
1311,
29889,
29885,
29918,
29872,
29930,
1311,
29889,
484,
13,
9651,
1583,
29889,
29920,
1756,
353,
1583,
29889,
29890,
29916,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
718,
7477,
29916,
13,
9651,
1583,
29889,
29920,
2272,
353,
1583,
29889,
1609,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
718,
274,
1357,
13,
9651,
1583,
29889,
29920,
29886,
29920,
353,
1583,
29889,
29890,
29920,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
718,
7477,
29920,
13,
9651,
1583,
29889,
14018,
29916,
353,
1583,
29889,
29890,
29916,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
448,
7477,
29916,
13,
9651,
1583,
29889,
29920,
1357,
353,
1583,
29889,
1609,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
448,
274,
1357,
13,
9651,
1583,
29889,
14018,
29920,
353,
1583,
29889,
29890,
29920,
29914,
9302,
29889,
3676,
29898,
1145,
29897,
448,
7477,
29920,
13,
13,
13,
4136,
13,
4136,
8108,
304,
3802,
6496,
2066,
29889,
13,
4136,
13,
259,
822,
1436,
29898,
1311,
1125,
13,
418,
9995,
13,
308,
3802,
278,
1065,
2066,
29889,
13,
418,
9995,
13,
418,
363,
474,
297,
1583,
29889,
16908,
29906,
29880,
29901,
13,
308,
2279,
877,
1311,
6169,
29974,
29875,
23097,
29888,
29889,
5358,
580,
1495,
13,
4136,
13,
4136,
16012,
18190,
583,
363,
278,
1065,
13,
4136,
13,
259,
822,
2254,
759,
29887,
583,
29898,
1311,
1125,
13,
418,
565,
1583,
29889,
401,
29918,
1853,
297,
6702,
29886,
3788,
29887,
29374,
13,
539,
12,
1583,
29889,
5750,
1503,
29922,
1839,
29873,
742,
525,
387,
267,
742,
525,
774,
29916,
29915,
1919,
525,
774,
29891,
29915,
1919,
525,
774,
29920,
29915,
1919,
525,
29872,
735,
29915,
1919,
525,
29872,
1032,
29915,
1919,
525,
3905,
29920,
29915,
1919,
29905,
13,
539,
12,
525,
29872,
331,
29915,
1919,
525,
1416,
861,
742,
525,
1416,
19881,
742,
525,
1416,
466,
742,
525,
29872,
446,
29916,
742,
525,
29872,
1989,
742,
525,
29872,
446,
29920,
742,
525,
1416,
262,
742,
525,
29872,
361,
29916,
742,
320,
13,
539,
12,
525,
29872,
1598,
742,
525,
29872,
361,
29920,
742,
525,
29872,
1389,
29916,
742,
525,
29872,
1389,
29891,
742,
525,
29872,
1389,
29920,
742,
525,
29872,
666,
29916,
742,
525,
29872,
666,
29891,
742,
525,
29872,
666,
29920,
742,
525,
29872,
1022,
29916,
742,
320,
13,
539,
12,
525,
29872,
1022,
29891,
742,
525,
29872,
1022,
29920,
2033,
13,
418,
565,
1583,
29889,
401,
29918,
1853,
1275,
525,
29882,
2396,
13,
539,
12,
1583,
29889,
5750,
1503,
29922,
1839,
29873,
3788,
387,
267,
3788,
774,
3788,
774,
29916,
3788,
774,
29891,
3788,
774,
29920,
3788,
29872,
1389,
3788,
2725,
3788,
1416,
861,
3788,
1416,
19881,
742,
29905,
13,
539,
12,
525,
1416,
466,
3788,
29872,
361,
3788,
29872,
361,
29916,
3788,
29872,
1598,
3788,
29872,
361,
29920,
3788,
29872,
1022,
3788,
29872,
666,
3788,
29872,
666,
29916,
3788,
29872,
666,
29891,
3788,
29872,
666,
29920,
3788,
29963,
5690,
3788,
29963,
6415,
742,
29905,
13,
539,
12,
525,
18118,
29979,
3788,
18118,
29999,
3788,
29933,
5690,
3788,
29933,
6415,
3788,
12809,
29979,
3788,
12809,
29999,
3788,
29933,
11601,
3788,
2544,
29909,
2033,
13,
539,
13,
418,
848,
29922,
9302,
29889,
1359,
3945,
29898,
1311,
29889,
29160,
381,
23097,
29914,
29923,
1089,
29887,
583,
29889,
4130,
1495,
13,
418,
363,
474,
297,
3464,
29898,
9302,
29889,
2311,
29898,
1311,
29889,
5750,
1503,
22164,
13,
308,
2279,
877,
1311,
6169,
29974,
1311,
29889,
5750,
1503,
29961,
29875,
10062,
29915,
29922,
1272,
7503,
5501,
29974,
710,
29898,
29875,
7240,
2033,
1495,
13,
418,
1583,
29889,
774,
29900,
29922,
29900,
29889,
29945,
16395,
1311,
29889,
29890,
29900,
29916,
1068,
29906,
29974,
1311,
29889,
29890,
29900,
29891,
1068,
29906,
29974,
1311,
29889,
29890,
29900,
29920,
1068,
29906,
29897,
13,
418,
565,
1583,
29889,
401,
29918,
1853,
297,
6702,
29886,
3788,
29887,
29374,
13,
539,
12,
1583,
29889,
774,
353,
1311,
29889,
774,
29916,
718,
1311,
29889,
774,
29891,
718,
1311,
29889,
774,
29920,
13,
539,
12,
1583,
29889,
29872,
666,
29922,
1311,
29889,
29872,
666,
29916,
29974,
1311,
29889,
29872,
666,
29891,
29974,
1311,
29889,
29872,
666,
29920,
13,
539,
12,
1583,
29889,
29872,
1022,
29922,
1311,
29889,
29872,
1022,
29916,
29974,
1311,
29889,
29872,
1022,
29891,
29974,
1311,
29889,
29872,
1022,
29920,
13,
539,
12,
1583,
29889,
29872,
361,
29922,
1311,
29889,
29872,
361,
29916,
29974,
1311,
29889,
29872,
1598,
29974,
1311,
29889,
29872,
361,
29920,
13,
539,
12,
1583,
29889,
29872,
1389,
29922,
1311,
29889,
29872,
1389,
29916,
29974,
1311,
29889,
29872,
1389,
29891,
29974,
1311,
29889,
29872,
1389,
29920,
13,
539,
12,
1583,
29889,
3905,
353,
1311,
29889,
29872,
735,
718,
1311,
29889,
29872,
1032,
718,
1311,
29889,
3905,
29920,
13,
418,
1583,
29889,
287,
29920,
29922,
1311,
29889,
774,
29899,
1311,
29889,
774,
29900,
29974,
1311,
29889,
29872,
361,
29974,
1311,
29889,
29872,
1389,
13,
418,
1583,
29889,
6277,
29880,
29922,
1311,
29889,
29873,
29930,
9302,
29889,
3676,
29898,
29906,
29930,
1311,
29889,
287,
29920,
29961,
29900,
2314,
29930,
29906,
29930,
9302,
29889,
1631,
29914,
1311,
29889,
29880,
29916,
13,
418,
1583,
29889,
1896,
12938,
29922,
1311,
29889,
29880,
29916,
14571,
9302,
29889,
3676,
29898,
1311,
29889,
287,
29920,
11877,
29946,
29930,
9302,
29889,
1631,
29897,
13,
418,
1583,
29889,
941,
29922,
9302,
29889,
3298,
359,
29898,
2435,
29898,
1311,
29889,
774,
876,
13,
418,
363,
474,
297,
3464,
29898,
29896,
29892,
2435,
29898,
1311,
29889,
774,
22164,
13,
308,
1583,
29889,
941,
29961,
29875,
13192,
1311,
29889,
941,
29961,
29875,
29899,
29896,
10062,
1311,
29889,
6008,
29930,
29906,
6904,
29898,
1311,
29889,
1896,
12938,
29961,
29875,
29899,
29896,
10062,
1311,
29889,
1896,
12938,
29961,
29875,
2314,
13,
2
] |
tests/test_config.py | savilard/flask-ecom-api | 1 | 10746 | import os
def test_development_config(test_app):
test_app.config.from_object('flask_ecom_api.config.DevelopmentConfig')
assert not test_app.config['TESTING']
assert test_app.config['SQLALCHEMY_DATABASE_URI'] == os.environ.get('DATABASE_URL')
def test_testing_config(test_app):
test_app.config.from_object('flask_ecom_api.config.TestingConfig')
assert test_app.config['TESTING']
assert test_app.config['SQLALCHEMY_DATABASE_URI'] == os.environ.get('DATABASE_TEST_URL')
def test_production_config(test_app):
test_app.config.from_object('flask_ecom_api.config.ProductionConfig')
assert not test_app.config['TESTING']
assert test_app.config['SQLALCHEMY_DATABASE_URI'] == os.environ.get('DATABASE_URL')
| [
1,
1053,
2897,
13,
13,
13,
1753,
1243,
29918,
25431,
29918,
2917,
29898,
1688,
29918,
932,
1125,
13,
1678,
1243,
29918,
932,
29889,
2917,
29889,
3166,
29918,
3318,
877,
1579,
1278,
29918,
29872,
510,
29918,
2754,
29889,
2917,
29889,
21956,
358,
3991,
1495,
13,
1678,
4974,
451,
1243,
29918,
932,
29889,
2917,
1839,
18267,
4214,
2033,
13,
1678,
4974,
1243,
29918,
932,
29889,
2917,
1839,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
2033,
1275,
2897,
29889,
21813,
29889,
657,
877,
25832,
27982,
29918,
4219,
1495,
13,
13,
13,
1753,
1243,
29918,
13424,
29918,
2917,
29898,
1688,
29918,
932,
1125,
13,
1678,
1243,
29918,
932,
29889,
2917,
29889,
3166,
29918,
3318,
877,
1579,
1278,
29918,
29872,
510,
29918,
2754,
29889,
2917,
29889,
3057,
292,
3991,
1495,
13,
1678,
4974,
1243,
29918,
932,
29889,
2917,
1839,
18267,
4214,
2033,
13,
1678,
4974,
1243,
29918,
932,
29889,
2917,
1839,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
2033,
1275,
2897,
29889,
21813,
29889,
657,
877,
25832,
27982,
29918,
18267,
29918,
4219,
1495,
13,
13,
13,
1753,
1243,
29918,
24601,
29918,
2917,
29898,
1688,
29918,
932,
1125,
13,
1678,
1243,
29918,
932,
29889,
2917,
29889,
3166,
29918,
3318,
877,
1579,
1278,
29918,
29872,
510,
29918,
2754,
29889,
2917,
29889,
23665,
428,
3991,
1495,
13,
1678,
4974,
451,
1243,
29918,
932,
29889,
2917,
1839,
18267,
4214,
2033,
13,
1678,
4974,
1243,
29918,
932,
29889,
2917,
1839,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
2033,
1275,
2897,
29889,
21813,
29889,
657,
877,
25832,
27982,
29918,
4219,
1495,
13,
2
] |
e2e/Tests/Consensus/MeritRemoval/VerifyCompetingTest.py | rikublock/Meros | 0 | 84198 | <gh_stars>0
#Tests proper handling of a MeritRemoval created from Verifications verifying competing Transactions.
#Types.
from typing import Dict, List, IO, Any
#Transactions classes.
from e2e.Classes.Transactions.Data import Data
from e2e.Classes.Transactions.Transactions import Transactions
#Element classes.
from e2e.Classes.Consensus.Verification import SignedVerification
from e2e.Classes.Consensus.MeritRemoval import SignedMeritRemoval
#Meros classes.
from e2e.Meros.Meros import MessageType
from e2e.Meros.RPC import RPC
from e2e.Meros.Liver import Liver
from e2e.Meros.Syncer import Syncer
#MeritRemoval verifier.
from e2e.Tests.Consensus.Verify import verifyMeritRemoval
#TestError Exception.
from e2e.Tests.Errors import TestError
#JSON standard lib.
import json
def VerifyCompetingTest(
rpc: RPC
) -> None:
file: IO[Any] = open("e2e/Vectors/Consensus/MeritRemoval/VerifyCompeting.json", "r")
vectors: Dict[str, Any] = json.loads(file.read())
file.close()
#Datas.
datas: List[Data] = [
Data.fromJSON(vectors["datas"][0]),
Data.fromJSON(vectors["datas"][1]),
Data.fromJSON(vectors["datas"][2])
]
#Transactions.
transactions: Transactions = Transactions()
for data in datas:
transactions.add(data)
#Initial Data's Verification.
verif: SignedVerification = SignedVerification.fromSignedJSON(vectors["verification"])
#MeritRemoval.
#pylint: disable=no-member
removal: SignedMeritRemoval = SignedMeritRemoval.fromSignedJSON(vectors["removal"])
#Create and execute a Liver to cause a Signed MeritRemoval.
def sendElements() -> None:
#Send the Datas.
for data in datas:
if rpc.meros.liveTransaction(data) != rpc.meros.live.recv():
raise TestError("Meros didn't send us the Data.")
#Send the initial Data's verification.
if rpc.meros.signedElement(verif) != rpc.meros.live.recv():
raise TestError("Meros didn't us the initial Data's Verification.")
#Send the first Element.
if rpc.meros.signedElement(removal.se1) != rpc.meros.live.recv():
raise TestError("Meros didn't send us the Verification.")
#Trigger the MeritRemoval.
rpc.meros.signedElement(removal.se2)
if rpc.meros.live.recv() != (
MessageType.SignedMeritRemoval.toByte() +
removal.signedSerialize()
):
raise TestError("Meros didn't send us the Merit Removal.")
verifyMeritRemoval(rpc, 1, 1, removal.holder, True)
Liver(
rpc,
vectors["blockchain"],
transactions,
callbacks={
1: sendElements,
2: lambda: verifyMeritRemoval(rpc, 1, 1, removal.holder, False)
}
).live()
#Create and execute a Liver to handle a Signed MeritRemoval.
def sendMeritRemoval() -> None:
#Send the Datas.
for data in datas:
if rpc.meros.liveTransaction(data) != rpc.meros.live.recv():
raise TestError("Meros didn't send us the Data.")
#Send the initial Data's verification.
if rpc.meros.signedElement(verif) != rpc.meros.live.recv():
raise TestError("Meros didn't us the initial Data's Verification.")
#Send and verify the MeritRemoval.
if rpc.meros.signedElement(removal) != rpc.meros.live.recv():
raise TestError("Meros didn't send us the Merit Removal.")
verifyMeritRemoval(rpc, 1, 1, removal.holder, True)
Liver(
rpc,
vectors["blockchain"],
transactions,
callbacks={
1: sendMeritRemoval,
2: lambda: verifyMeritRemoval(rpc, 1, 1, removal.holder, False)
}
).live()
#Create and execute a Syncer to handle a Signed MeritRemoval.
Syncer(rpc, vectors["blockchain"], transactions).sync()
verifyMeritRemoval(rpc, 1, 1, removal.holder, False)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
24376,
1571,
11415,
310,
263,
4702,
277,
7301,
10611,
2825,
515,
1798,
8232,
1147,
9215,
5100,
292,
4103,
7387,
29889,
13,
13,
29937,
10562,
29889,
13,
3166,
19229,
1053,
360,
919,
29892,
2391,
29892,
10663,
29892,
3139,
13,
13,
29937,
4300,
7387,
4413,
29889,
13,
3166,
321,
29906,
29872,
29889,
27403,
29889,
4300,
7387,
29889,
1469,
1053,
3630,
13,
3166,
321,
29906,
29872,
29889,
27403,
29889,
4300,
7387,
29889,
4300,
7387,
1053,
4103,
7387,
13,
13,
29937,
2642,
4413,
29889,
13,
3166,
321,
29906,
29872,
29889,
27403,
29889,
13696,
8841,
29889,
6565,
2450,
1053,
9954,
287,
6565,
2450,
13,
3166,
321,
29906,
29872,
29889,
27403,
29889,
13696,
8841,
29889,
15836,
277,
7301,
10611,
1053,
9954,
287,
15836,
277,
7301,
10611,
13,
13,
29937,
29924,
9672,
4413,
29889,
13,
3166,
321,
29906,
29872,
29889,
29924,
9672,
29889,
29924,
9672,
1053,
7777,
1542,
13,
3166,
321,
29906,
29872,
29889,
29924,
9672,
29889,
29934,
9026,
1053,
390,
9026,
13,
3166,
321,
29906,
29872,
29889,
29924,
9672,
29889,
29931,
2147,
1053,
22469,
13,
3166,
321,
29906,
29872,
29889,
29924,
9672,
29889,
29216,
2265,
1053,
10829,
2265,
13,
13,
29937,
15836,
277,
7301,
10611,
1147,
3709,
29889,
13,
3166,
321,
29906,
29872,
29889,
24376,
29889,
13696,
8841,
29889,
6565,
1598,
1053,
11539,
15836,
277,
7301,
10611,
13,
13,
29937,
3057,
2392,
8960,
29889,
13,
3166,
321,
29906,
29872,
29889,
24376,
29889,
22463,
1053,
4321,
2392,
13,
13,
29937,
7249,
3918,
4303,
29889,
13,
5215,
4390,
13,
13,
1753,
1798,
1598,
6843,
15133,
3057,
29898,
13,
29871,
364,
6739,
29901,
390,
9026,
13,
29897,
1599,
6213,
29901,
13,
29871,
934,
29901,
10663,
29961,
10773,
29962,
353,
1722,
703,
29872,
29906,
29872,
29914,
29963,
11142,
29914,
13696,
8841,
29914,
15836,
277,
7301,
10611,
29914,
6565,
1598,
6843,
15133,
29889,
3126,
613,
376,
29878,
1159,
13,
29871,
12047,
29901,
360,
919,
29961,
710,
29892,
3139,
29962,
353,
4390,
29889,
18132,
29898,
1445,
29889,
949,
3101,
13,
29871,
934,
29889,
5358,
580,
13,
13,
29871,
396,
16390,
294,
29889,
13,
29871,
6155,
29901,
2391,
29961,
1469,
29962,
353,
518,
13,
1678,
3630,
29889,
3166,
7249,
29898,
345,
14359,
3366,
14538,
3108,
29961,
29900,
11724,
13,
1678,
3630,
29889,
3166,
7249,
29898,
345,
14359,
3366,
14538,
3108,
29961,
29896,
11724,
13,
1678,
3630,
29889,
3166,
7249,
29898,
345,
14359,
3366,
14538,
3108,
29961,
29906,
2314,
13,
29871,
4514,
13,
13,
29871,
396,
4300,
7387,
29889,
13,
29871,
22160,
29901,
4103,
7387,
353,
4103,
7387,
580,
13,
29871,
363,
848,
297,
6155,
29901,
13,
1678,
22160,
29889,
1202,
29898,
1272,
29897,
13,
13,
29871,
396,
15514,
3630,
29915,
29879,
1798,
2450,
29889,
13,
29871,
1147,
361,
29901,
9954,
287,
6565,
2450,
353,
9954,
287,
6565,
2450,
29889,
3166,
10140,
287,
7249,
29898,
345,
14359,
3366,
369,
2450,
20068,
13,
13,
29871,
396,
15836,
277,
7301,
10611,
29889,
13,
29871,
396,
2272,
27854,
29901,
11262,
29922,
1217,
29899,
14242,
13,
29871,
28744,
29901,
9954,
287,
15836,
277,
7301,
10611,
353,
9954,
287,
15836,
277,
7301,
10611,
29889,
3166,
10140,
287,
7249,
29898,
345,
14359,
3366,
1745,
10611,
20068,
13,
13,
29871,
396,
4391,
322,
6222,
263,
22469,
304,
4556,
263,
9954,
287,
4702,
277,
7301,
10611,
29889,
13,
29871,
822,
3638,
18868,
580,
1599,
6213,
29901,
13,
1678,
396,
12600,
278,
13373,
294,
29889,
13,
1678,
363,
848,
297,
6155,
29901,
13,
418,
565,
364,
6739,
29889,
1050,
359,
29889,
9258,
12460,
29898,
1272,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
4706,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
3638,
502,
278,
3630,
23157,
13,
13,
1678,
396,
12600,
278,
2847,
3630,
29915,
29879,
1147,
2450,
29889,
13,
1678,
565,
364,
6739,
29889,
1050,
359,
29889,
7433,
2642,
29898,
369,
361,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
418,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
502,
278,
2847,
3630,
29915,
29879,
1798,
2450,
23157,
13,
13,
1678,
396,
12600,
278,
937,
10619,
29889,
13,
1678,
565,
364,
6739,
29889,
1050,
359,
29889,
7433,
2642,
29898,
1745,
10611,
29889,
344,
29896,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
418,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
3638,
502,
278,
1798,
2450,
23157,
13,
13,
1678,
396,
20211,
278,
4702,
277,
7301,
10611,
29889,
13,
1678,
364,
6739,
29889,
1050,
359,
29889,
7433,
2642,
29898,
1745,
10611,
29889,
344,
29906,
29897,
13,
1678,
565,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
580,
2804,
313,
13,
418,
7777,
1542,
29889,
10140,
287,
15836,
277,
7301,
10611,
29889,
517,
12901,
580,
718,
13,
418,
28744,
29889,
7433,
1748,
6646,
580,
13,
268,
1125,
13,
418,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
3638,
502,
278,
4702,
277,
5240,
10611,
23157,
13,
1678,
11539,
15836,
277,
7301,
10611,
29898,
29878,
6739,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
28744,
29889,
7694,
29892,
5852,
29897,
13,
13,
29871,
22469,
29898,
13,
1678,
364,
6739,
29892,
13,
1678,
12047,
3366,
1271,
14153,
12436,
13,
1678,
22160,
29892,
13,
1678,
6939,
29879,
3790,
13,
539,
29896,
29901,
3638,
18868,
29892,
13,
539,
29906,
29901,
14013,
29901,
11539,
15836,
277,
7301,
10611,
29898,
29878,
6739,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
28744,
29889,
7694,
29892,
7700,
29897,
13,
1678,
500,
13,
29871,
13742,
9258,
580,
13,
13,
29871,
396,
4391,
322,
6222,
263,
22469,
304,
4386,
263,
9954,
287,
4702,
277,
7301,
10611,
29889,
13,
29871,
822,
3638,
15836,
277,
7301,
10611,
580,
1599,
6213,
29901,
13,
1678,
396,
12600,
278,
13373,
294,
29889,
13,
1678,
363,
848,
297,
6155,
29901,
13,
418,
565,
364,
6739,
29889,
1050,
359,
29889,
9258,
12460,
29898,
1272,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
4706,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
3638,
502,
278,
3630,
23157,
13,
13,
1678,
396,
12600,
278,
2847,
3630,
29915,
29879,
1147,
2450,
29889,
13,
1678,
565,
364,
6739,
29889,
1050,
359,
29889,
7433,
2642,
29898,
369,
361,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
418,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
502,
278,
2847,
3630,
29915,
29879,
1798,
2450,
23157,
13,
13,
1678,
396,
12600,
322,
11539,
278,
4702,
277,
7301,
10611,
29889,
13,
1678,
565,
364,
6739,
29889,
1050,
359,
29889,
7433,
2642,
29898,
1745,
10611,
29897,
2804,
364,
6739,
29889,
1050,
359,
29889,
9258,
29889,
3757,
29894,
7295,
13,
418,
12020,
4321,
2392,
703,
29924,
9672,
3282,
29915,
29873,
3638,
502,
278,
4702,
277,
5240,
10611,
23157,
13,
1678,
11539,
15836,
277,
7301,
10611,
29898,
29878,
6739,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
28744,
29889,
7694,
29892,
5852,
29897,
13,
13,
29871,
22469,
29898,
13,
1678,
364,
6739,
29892,
13,
1678,
12047,
3366,
1271,
14153,
12436,
13,
1678,
22160,
29892,
13,
1678,
6939,
29879,
3790,
13,
539,
29896,
29901,
3638,
15836,
277,
7301,
10611,
29892,
13,
539,
29906,
29901,
14013,
29901,
11539,
15836,
277,
7301,
10611,
29898,
29878,
6739,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
28744,
29889,
7694,
29892,
7700,
29897,
13,
1678,
500,
13,
29871,
13742,
9258,
580,
13,
13,
29871,
396,
4391,
322,
6222,
263,
10829,
2265,
304,
4386,
263,
9954,
287,
4702,
277,
7301,
10611,
29889,
13,
29871,
10829,
2265,
29898,
29878,
6739,
29892,
12047,
3366,
1271,
14153,
12436,
22160,
467,
16593,
580,
13,
29871,
11539,
15836,
277,
7301,
10611,
29898,
29878,
6739,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
28744,
29889,
7694,
29892,
7700,
29897,
13,
2
] |
code/ard/_filter.py | ms860309/AutomatedReactionMechanismDiscovery | 1 | 103676 | import os
import sys
from openbabel import openbabel as ob
from openbabel import pybel as pb
import gen3D
import numpy as np
from statistics import mean
import props
ELEMENT_TABLE = props.ElementData()
class FILTER(object):
def __init__(self, reactant_file, cluster_bond_file = None, fixed_atoms = None):
self.reactant_file = reactant_file
self.cluster_bond_file = cluster_bond_file
self.fixed_atoms = fixed_atoms
if self.fixed_atoms:
with open(self.fixed_atoms, 'r') as f:
lines = f.read()
self.fixed_atoms = eval(lines)
def initialization(self):
mol = next(pb.readfile('xyz', self.reactant_file))
if self.cluster_bond_file:
m = pb.ob.OBMol()
m.BeginModify()
for atom in mol:
coords = [coord for coord in atom.coords]
atomno = atom.atomicnum
obatom = ob.OBAtom()
obatom.thisown = 0
obatom.SetAtomicNum(atomno)
obatom.SetVector(*coords)
m.AddAtom(obatom)
del obatom
with open(self.cluster_bond_file, 'r') as f:
lines = f.read()
cluster_bond = eval(lines)
bonds = [(bond.GetBeginAtomIdx(), bond.GetEndAtomIdx(), bond.GetBondOrder())
for bond in pb.ob.OBMolBondIter(mol.OBMol)]
bonds.extend(cluster_bond)
for bond in bonds:
m.AddBond(bond[0], bond[1], bond[2])
# m.ConnectTheDots()
m.PerceiveBondOrders()
# m.SetTotalSpinMultiplicity(1)
m.SetTotalCharge(int(mol.charge))
m.Center()
m.EndModify()
self.mol = gen3D.Molecule(m)
else:
self.mol = gen3D.Molecule(mol.OBMol)
self.atoms = tuple(atom.atomicnum for atom in self.mol)
for frag in self.mol.write('can').split()[0].split('.'):
if '[OH]' in frag and 'Sn' not in frag:
return 'job_fail', 'non-bonded OH group'
return 'pass', 'pass'
def check_feasible_rxn(self, check_mm_overlap = True, qmmm = None, qm_atoms = 23, threshold_ratio = 0.6):
status, msg = self.initialization()
if status == 'job_fail':
return 'job_fail', msg
if check_mm_overlap:
status, msg = self.check_overlap_mm_region_v2(qmmm = qmmm, qm_atoms = qm_atoms, threshold_ratio = threshold_ratio)
else:
status = True
if status:
status, msg = self.check_reactant_bonds()
if status:
status, msg = self.check_unreasonable_connection()
if status:
return 'job_success', msg
else:
return 'job_fail', msg
else:
return 'job_fail', msg
else:
return 'job_fail', msg
def check_reactant_bonds(self):
# extract reactant bonds
reactant_bonds = [tuple(sorted((bond.GetBeginAtomIdx() - 1, bond.GetEndAtomIdx() - 1)) + [bond.GetBondOrder()])
for bond in pb.ob.OBMolBondIter(self.mol.OBMol)]
self.reactant_bonds = tuple(sorted(reactant_bonds))
# check the bond order and save in a dict
bond_type = {}
for i in range(len(self.atoms)):
num = 0
for j in reactant_bonds:
if j[0] == i or j[1] == i:
num += j[2]
bond_type[i] = num
if 0 in bond_type.values(): # The dissociated atom
return False, 'Have dissociated atom.'
else:
for idx, i in enumerate(self.atoms):
# use != or > need test
if i == 6 and idx not in self.fixed_atoms:
if bond_type[idx] < 3 or bond_type[idx] > 4: # remove only C=O
return False, 'reactant carbon bond type is invalid.({})'.format(bond_type[idx])
# use != or > need test
elif i == 8 and bond_type[idx] > 2 and idx not in self.fixed_atoms: # Here we can't use !=2 because some time reactant O don't detect bind on Sn
return False, 'reactant oxygen bond type is invalid.({})'.format(bond_type[idx])
# use != or > need test
elif i == 14 and bond_type[idx] != 4 and idx not in self.fixed_atoms:
return False, 'reactant silicon bond type is invalid.({})'.format(bond_type[idx])
# While the bronsted acid already have proton on the active site, then aborted.
elif i == 8 and bond_type[idx] > 3:
return False, 'oxygen have more than 4 connection.({})'.format(bond_type[idx])
return True, 'bond type check is pass.'
def check_unreasonable_connection(self):
# Use generator is more efficient
reactant_carbon = [idx for idx, reactant_atoms in enumerate(self.atoms) if idx not in self.fixed_atoms and reactant_atoms == 6]
reactant_oxygen = [idx for idx, reactant_atoms in enumerate(self.atoms) if idx not in self.fixed_atoms and reactant_atoms == 8]
active_site_oxygen = [active_site_atom for active_site_atom in self.fixed_atoms if self.atoms[active_site_atom] == 8]
active_site_silicon = [active_site_atom for active_site_atom in self.fixed_atoms if self.atoms[active_site_atom] == 14]
active_site_metal = [active_site_atom for active_site_atom in self.fixed_atoms if self.atoms[active_site_atom] in [42, 50, 74]]
hcap = [active_site_atom for active_site_atom in self.fixed_atoms if self.atoms[active_site_atom] == 1]
for bond in self.reactant_bonds:
if (bond[0] in reactant_oxygen and bond[1] in active_site_silicon) or (bond[1] in reactant_oxygen and bond[0] in active_site_silicon):
return False, 'reactant oxygen have connection with active site silicon.'
elif (bond[0] not in self.fixed_atoms and bond[1] in hcap) or (bond[1] not in self.fixed_atoms and bond[0] in hcap):
return False, 'reactant have connection with hcap.'
elif (bond[0] in reactant_carbon and bond[1] in active_site_oxygen) or (bond[1] in reactant_carbon and bond[0] in active_site_oxygen):
return False, 'reactant carbon have connection with active site oxygen.'
elif (bond[0] in reactant_oxygen and bond[1] in active_site_oxygen) or (bond[1] in reactant_oxygen and bond[0] in active_site_oxygen):
return False, 'reactant oxygen have connection with active site oxygen.'
return True, 'check_unreasonable_connection is pass.'
def check_overlap_mm_region(self, qm_silicon = [], threshold = 5.4):
# mm silicon index start from 0
# Choose the silicon in cluster model which is in mm region
self.mol.gen3D(self.fixed_atoms, make3D=False)
if len(self.mol.mols) == 1:
return True, 'pass'
else:
nodes_1 = [mol.toNode() for mol in self.mol.mols]
fd1 = [node.getCentroid() for node in nodes_1]
tmps, dist2 = [], []
for idx, i in enumerate(self.mol.mols):
if all(idx2 not in self.fixed_atoms for idx2 in i.mols_indices[idx]):
if any(self.atoms[idx2] == 6 or self.atoms[idx2] == 8 for idx2 in i.mols_indices[idx]):
tmps.append(idx)
for tmp in tmps:
for qm_si in qm_silicon:
diff2 = self.mol[qm_si].coords - fd1[tmp]
dist2.append(np.linalg.norm(diff2))
# print(max(dist2))
# print(mean(dist2))
if max(dist2) > 6.5 and mean(dist2) > 5.4:
# print(max(dist2))
# print(mean(dist2))
return False, 'Overlap with the mm region'
else:
return True, 'pass'
def check_overlap_mm_region_v2(self, qmmm = None, qm_atoms = 23, threshold_ratio = 0.6):
"""
The distance between qm atoms and mm atoms should greater than 0.6 vdw radius.
"""
dist2 = []
for idx1, qm_atom in enumerate(self.mol):
if idx1 >= qm_atoms:
continue
for idx2, mm_atom in enumerate(qmmm):
if idx2 < qm_atoms:
continue
diff2 = np.array(qm_atom.coords) - np.array(mm_atom.coords)
dist = np.linalg.norm(diff2)
element = ELEMENT_TABLE.from_atomic_number(qm_atom.OBAtom.GetAtomicNum())
vdw_rad = element.vdw_radius
if dist < vdw_rad * threshold_ratio:
dist2.append(dist)
if dist2:
return False, 'Maybe overlap with the mm region'
else:
return True, 'pass'
# cluster_bond = '/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/script/bonds.txt'
# fixed_atoms = '/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/script/fixed_atoms.txt'
# qmmm = '/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/code/ard/qmmm.xyz'
# qmmm_mol = next(pb.readfile('xyz', qmmm))
# # reactant_file = os.path.join('/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/code/ard/reactions', 'UYFCJUSUJARWAH-UHFFFAOYSA-N_9/product.xyz')
# # f = FILTER(reactant_file=reactant_file, cluster_bond_file=cluster_bond, fixed_atoms = fixed_atoms)
# # msg = f.check_overlap_mm_region_2(qmmm = qmmm_mol, qm_atoms = 23)
# a = os.listdir('/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/code/ard/reactions')
# for i in a:
# print('---------')
# print(i)
# b = os.path.join('/mnt/d/Lab/QMproject/AutomaticReactionDiscovery/code/ard/reactions', i)
# reactant_file = os.path.join(b, 'reactant.xyz')
# f = FILTER(reactant_file, cluster_bond_file=cluster_bond, fixed_atoms = fixed_atoms)
# status, msg = f.check_feasible_rxn(check_mm_overlap = True, qmmm = qmmm_mol, qm_atoms = 23, threshold_ratio = 0.6)
# # state, msg = f.check_feasible_rxn(check_mm_overlap=True)
# # print(state)
# # print(msg) | [
1,
1053,
2897,
30004,
13,
5215,
10876,
30004,
13,
3166,
1722,
28727,
1053,
1722,
28727,
408,
704,
30004,
13,
3166,
1722,
28727,
1053,
11451,
6596,
408,
282,
29890,
30004,
13,
5215,
2531,
29941,
29928,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
3166,
13964,
1053,
2099,
30004,
13,
5215,
17761,
30004,
13,
30004,
13,
29923,
1307,
13780,
29918,
21009,
353,
17761,
29889,
2642,
1469,
26471,
13,
30004,
13,
1990,
383,
6227,
4945,
29898,
3318,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7657,
424,
29918,
1445,
29892,
9867,
29918,
29890,
898,
29918,
1445,
353,
6213,
29892,
4343,
29918,
271,
4835,
353,
6213,
1125,
30004,
13,
4706,
1583,
29889,
8423,
424,
29918,
1445,
353,
7657,
424,
29918,
1445,
30004,
13,
4706,
1583,
29889,
19594,
29918,
29890,
898,
29918,
1445,
353,
9867,
29918,
29890,
898,
29918,
1445,
30004,
13,
4706,
1583,
29889,
20227,
29918,
271,
4835,
353,
4343,
29918,
271,
4835,
30004,
13,
4706,
565,
1583,
29889,
20227,
29918,
271,
4835,
29901,
30004,
13,
9651,
411,
1722,
29898,
1311,
29889,
20227,
29918,
271,
4835,
29892,
525,
29878,
1495,
408,
285,
29901,
30004,
13,
18884,
3454,
353,
285,
29889,
949,
26471,
13,
9651,
1583,
29889,
20227,
29918,
271,
4835,
353,
19745,
29898,
9012,
8443,
13,
4706,
6756,
13,
1678,
822,
17865,
29898,
1311,
1125,
30004,
13,
4706,
6062,
353,
2446,
29898,
24381,
29889,
949,
1445,
877,
20230,
742,
1583,
29889,
8423,
424,
29918,
1445,
876,
30004,
13,
4706,
565,
1583,
29889,
19594,
29918,
29890,
898,
29918,
1445,
29901,
30004,
13,
9651,
286,
353,
282,
29890,
29889,
711,
29889,
14824,
29924,
324,
26471,
13,
9651,
286,
29889,
17946,
2111,
1598,
26471,
13,
9651,
363,
12301,
297,
6062,
29901,
30004,
13,
18884,
1302,
4339,
353,
518,
1111,
536,
363,
29311,
297,
12301,
29889,
1111,
4339,
29962,
30004,
13,
18884,
12301,
1217,
353,
12301,
29889,
21641,
1949,
30004,
13,
18884,
704,
8678,
353,
704,
29889,
14824,
4178,
290,
26471,
13,
18884,
704,
8678,
29889,
1366,
776,
353,
29871,
29900,
30004,
13,
18884,
704,
8678,
29889,
2697,
4178,
25426,
8009,
29898,
8678,
1217,
8443,
13,
18884,
704,
8678,
29889,
2697,
12877,
10456,
1111,
4339,
8443,
13,
18884,
286,
29889,
2528,
4178,
290,
29898,
711,
8678,
8443,
13,
18884,
628,
704,
8678,
30004,
13,
30004,
13,
9651,
411,
1722,
29898,
1311,
29889,
19594,
29918,
29890,
898,
29918,
1445,
29892,
525,
29878,
1495,
408,
285,
29901,
30004,
13,
18884,
3454,
353,
285,
29889,
949,
26471,
13,
9651,
9867,
29918,
29890,
898,
353,
19745,
29898,
9012,
8443,
13,
9651,
289,
13788,
353,
17288,
29890,
898,
29889,
2577,
17946,
4178,
290,
1204,
29916,
3285,
21224,
29889,
2577,
5044,
4178,
290,
1204,
29916,
3285,
21224,
29889,
2577,
29933,
898,
7514,
3101,
30004,
13,
462,
1678,
363,
21224,
297,
282,
29890,
29889,
711,
29889,
14824,
29924,
324,
29933,
898,
13463,
29898,
29885,
324,
29889,
14824,
29924,
324,
4638,
30004,
13,
9651,
289,
13788,
29889,
21843,
29898,
19594,
29918,
29890,
898,
8443,
13,
9651,
363,
21224,
297,
289,
13788,
29901,
30004,
13,
18884,
286,
29889,
2528,
29933,
898,
29898,
29890,
898,
29961,
29900,
1402,
21224,
29961,
29896,
1402,
21224,
29961,
29906,
2314,
30004,
13,
9651,
396,
286,
29889,
17918,
1576,
29928,
1862,
26471,
13,
9651,
286,
29889,
5894,
346,
573,
29933,
898,
2816,
8623,
26471,
13,
9651,
396,
286,
29889,
2697,
11536,
5592,
262,
6857,
666,
17024,
29898,
29896,
8443,
13,
9651,
286,
29889,
2697,
11536,
5914,
479,
29898,
524,
29898,
29885,
324,
29889,
23367,
876,
30004,
13,
9651,
286,
29889,
13409,
26471,
13,
9651,
286,
29889,
5044,
2111,
1598,
26471,
13,
9651,
1583,
29889,
29885,
324,
353,
2531,
29941,
29928,
29889,
29924,
1772,
29883,
1297,
29898,
29885,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
1583,
29889,
29885,
324,
353,
2531,
29941,
29928,
29889,
29924,
1772,
29883,
1297,
29898,
29885,
324,
29889,
14824,
29924,
324,
8443,
13,
4706,
1583,
29889,
271,
4835,
353,
18761,
29898,
8678,
29889,
21641,
1949,
363,
12301,
297,
1583,
29889,
29885,
324,
8443,
13,
30004,
13,
4706,
363,
13855,
297,
1583,
29889,
29885,
324,
29889,
3539,
877,
3068,
2824,
5451,
580,
29961,
29900,
1822,
5451,
877,
6169,
1125,
30004,
13,
9651,
565,
525,
29961,
23170,
29962,
29915,
297,
13855,
322,
525,
29903,
29876,
29915,
451,
297,
13855,
29901,
30004,
13,
18884,
736,
525,
9057,
29918,
14057,
742,
525,
5464,
29899,
29890,
898,
287,
438,
29950,
2318,
29915,
30004,
13,
4706,
736,
525,
3364,
742,
525,
3364,
29915,
30004,
13,
30004,
13,
1678,
822,
1423,
29918,
1725,
294,
1821,
29918,
17697,
29876,
29898,
1311,
29892,
1423,
29918,
4317,
29918,
957,
6984,
353,
5852,
29892,
3855,
4317,
29885,
353,
6213,
29892,
3855,
29885,
29918,
271,
4835,
353,
29871,
29906,
29941,
29892,
16897,
29918,
3605,
601,
353,
29871,
29900,
29889,
29953,
1125,
30004,
13,
4706,
4660,
29892,
10191,
353,
1583,
29889,
11228,
2133,
26471,
13,
4706,
565,
4660,
1275,
525,
9057,
29918,
14057,
2396,
30004,
13,
9651,
736,
525,
9057,
29918,
14057,
742,
10191,
30004,
13,
30004,
13,
4706,
565,
1423,
29918,
4317,
29918,
957,
6984,
29901,
30004,
13,
9651,
4660,
29892,
10191,
353,
1583,
29889,
3198,
29918,
957,
6984,
29918,
4317,
29918,
12803,
29918,
29894,
29906,
29898,
29939,
4317,
29885,
353,
3855,
4317,
29885,
29892,
3855,
29885,
29918,
271,
4835,
353,
3855,
29885,
29918,
271,
4835,
29892,
16897,
29918,
3605,
601,
353,
16897,
29918,
3605,
601,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
4660,
353,
5852,
30004,
13,
9651,
6756,
13,
4706,
565,
4660,
29901,
30004,
13,
9651,
4660,
29892,
10191,
353,
1583,
29889,
3198,
29918,
8423,
424,
29918,
29890,
13788,
26471,
13,
9651,
565,
4660,
29901,
30004,
13,
18884,
4660,
29892,
10191,
353,
1583,
29889,
3198,
29918,
348,
23147,
519,
29918,
9965,
26471,
13,
18884,
565,
4660,
29901,
30004,
13,
462,
1678,
736,
525,
9057,
29918,
8698,
742,
10191,
30004,
13,
18884,
1683,
29901,
30004,
13,
462,
1678,
736,
525,
9057,
29918,
14057,
742,
10191,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
736,
525,
9057,
29918,
14057,
742,
10191,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
525,
9057,
29918,
14057,
742,
10191,
30004,
13,
30004,
13,
1678,
822,
1423,
29918,
8423,
424,
29918,
29890,
13788,
29898,
1311,
1125,
30004,
13,
4706,
396,
6597,
7657,
424,
289,
13788,
30004,
13,
4706,
7657,
424,
29918,
29890,
13788,
353,
518,
23583,
29898,
24582,
3552,
29890,
898,
29889,
2577,
17946,
4178,
290,
1204,
29916,
580,
448,
29871,
29896,
29892,
21224,
29889,
2577,
5044,
4178,
290,
1204,
29916,
580,
448,
29871,
29896,
876,
718,
518,
29890,
898,
29889,
2577,
29933,
898,
7514,
580,
2314,
30004,
13,
462,
9651,
363,
21224,
297,
282,
29890,
29889,
711,
29889,
14824,
29924,
324,
29933,
898,
13463,
29898,
1311,
29889,
29885,
324,
29889,
14824,
29924,
324,
4638,
30004,
13,
4706,
1583,
29889,
8423,
424,
29918,
29890,
13788,
353,
18761,
29898,
24582,
29898,
8423,
424,
29918,
29890,
13788,
876,
30004,
13,
4706,
396,
1423,
278,
21224,
1797,
322,
4078,
297,
263,
9657,
30004,
13,
4706,
21224,
29918,
1853,
353,
6571,
30004,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
1311,
29889,
271,
4835,
22164,
30004,
13,
9651,
954,
353,
29871,
29900,
30004,
13,
9651,
363,
432,
297,
7657,
424,
29918,
29890,
13788,
29901,
30004,
13,
18884,
565,
432,
29961,
29900,
29962,
1275,
474,
470,
432,
29961,
29896,
29962,
1275,
474,
29901,
30004,
13,
462,
1678,
954,
4619,
432,
29961,
29906,
29962,
30004,
13,
9651,
21224,
29918,
1853,
29961,
29875,
29962,
353,
954,
30004,
13,
4706,
565,
29871,
29900,
297,
21224,
29918,
1853,
29889,
5975,
7295,
396,
450,
766,
2839,
630,
12301,
30004,
13,
9651,
736,
7700,
29892,
525,
25559,
766,
2839,
630,
12301,
6169,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
363,
22645,
29892,
474,
297,
26985,
29898,
1311,
29889,
271,
4835,
1125,
30004,
13,
18884,
396,
671,
2804,
29871,
470,
29871,
1405,
259,
817,
1243,
30004,
13,
18884,
565,
474,
1275,
29871,
29953,
322,
22645,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
29901,
30004,
13,
462,
1678,
565,
21224,
29918,
1853,
29961,
13140,
29962,
529,
29871,
29941,
470,
21224,
29918,
1853,
29961,
13140,
29962,
1405,
29871,
29946,
29901,
396,
3349,
871,
315,
29922,
29949,
30004,
13,
462,
4706,
736,
7700,
29892,
525,
8423,
424,
22004,
21224,
1134,
338,
8340,
29889,
3319,
1800,
4286,
4830,
29898,
29890,
898,
29918,
1853,
29961,
13140,
2314,
30004,
13,
18884,
396,
671,
2804,
29871,
470,
29871,
1405,
259,
817,
1243,
30004,
13,
18884,
25342,
474,
1275,
29871,
29947,
322,
21224,
29918,
1853,
29961,
13140,
29962,
1405,
29871,
29906,
322,
22645,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
29901,
396,
2266,
591,
508,
29915,
29873,
671,
2804,
29906,
1363,
777,
931,
7657,
424,
438,
1016,
29915,
29873,
6459,
7868,
373,
22639,
30004,
13,
462,
1678,
736,
7700,
29892,
525,
8423,
424,
288,
28596,
21224,
1134,
338,
8340,
29889,
3319,
1800,
4286,
4830,
29898,
29890,
898,
29918,
1853,
29961,
13140,
2314,
30004,
13,
18884,
396,
671,
2804,
29871,
470,
29871,
1405,
259,
817,
1243,
30004,
13,
18884,
25342,
474,
1275,
29871,
29896,
29946,
322,
21224,
29918,
1853,
29961,
13140,
29962,
2804,
29871,
29946,
322,
22645,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
29901,
30004,
13,
462,
1678,
736,
7700,
29892,
525,
8423,
424,
4047,
4144,
21224,
1134,
338,
8340,
29889,
3319,
1800,
4286,
4830,
29898,
29890,
898,
29918,
1853,
29961,
13140,
2314,
30004,
13,
18884,
396,
5806,
278,
12246,
16470,
22193,
2307,
505,
410,
880,
373,
278,
6136,
3268,
29892,
769,
633,
18054,
22993,
13,
18884,
25342,
474,
1275,
29871,
29947,
322,
21224,
29918,
1853,
29961,
13140,
29962,
1405,
29871,
29941,
29901,
30004,
13,
462,
1678,
736,
7700,
29892,
525,
2251,
29891,
1885,
505,
901,
1135,
29871,
29946,
3957,
29889,
3319,
1800,
4286,
4830,
29898,
29890,
898,
29918,
1853,
29961,
13140,
2314,
30004,
13,
9651,
736,
5852,
29892,
525,
29890,
898,
1134,
1423,
338,
1209,
6169,
30004,
13,
1678,
6756,
13,
1678,
822,
1423,
29918,
348,
23147,
519,
29918,
9965,
29898,
1311,
1125,
30004,
13,
4706,
396,
4803,
15299,
338,
901,
8543,
30004,
13,
4706,
7657,
424,
29918,
4287,
6718,
353,
518,
13140,
363,
22645,
29892,
7657,
424,
29918,
271,
4835,
297,
26985,
29898,
1311,
29889,
271,
4835,
29897,
565,
22645,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
322,
7657,
424,
29918,
271,
4835,
1275,
29871,
29953,
29962,
30004,
13,
4706,
7657,
424,
29918,
2251,
29891,
1885,
353,
518,
13140,
363,
22645,
29892,
7657,
424,
29918,
271,
4835,
297,
26985,
29898,
1311,
29889,
271,
4835,
29897,
565,
22645,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
322,
7657,
424,
29918,
271,
4835,
1275,
29871,
29947,
29962,
30004,
13,
4706,
6136,
29918,
2746,
29918,
2251,
29891,
1885,
353,
518,
4925,
29918,
2746,
29918,
8678,
363,
6136,
29918,
2746,
29918,
8678,
297,
1583,
29889,
20227,
29918,
271,
4835,
565,
1583,
29889,
271,
4835,
29961,
4925,
29918,
2746,
29918,
8678,
29962,
1275,
29871,
29947,
29962,
30004,
13,
4706,
6136,
29918,
2746,
29918,
25590,
4144,
353,
518,
4925,
29918,
2746,
29918,
8678,
363,
6136,
29918,
2746,
29918,
8678,
297,
1583,
29889,
20227,
29918,
271,
4835,
565,
1583,
29889,
271,
4835,
29961,
4925,
29918,
2746,
29918,
8678,
29962,
1275,
29871,
29896,
29946,
29962,
30004,
13,
4706,
6136,
29918,
2746,
29918,
2527,
284,
353,
518,
4925,
29918,
2746,
29918,
8678,
363,
6136,
29918,
2746,
29918,
8678,
297,
1583,
29889,
20227,
29918,
271,
4835,
565,
1583,
29889,
271,
4835,
29961,
4925,
29918,
2746,
29918,
8678,
29962,
297,
518,
29946,
29906,
29892,
29871,
29945,
29900,
29892,
29871,
29955,
29946,
5262,
30004,
13,
4706,
298,
5030,
353,
518,
4925,
29918,
2746,
29918,
8678,
363,
6136,
29918,
2746,
29918,
8678,
297,
1583,
29889,
20227,
29918,
271,
4835,
565,
1583,
29889,
271,
4835,
29961,
4925,
29918,
2746,
29918,
8678,
29962,
1275,
29871,
29896,
29962,
30004,
13,
30004,
13,
4706,
363,
21224,
297,
1583,
29889,
8423,
424,
29918,
29890,
13788,
29901,
30004,
13,
9651,
565,
313,
29890,
898,
29961,
29900,
29962,
297,
7657,
424,
29918,
2251,
29891,
1885,
322,
21224,
29961,
29896,
29962,
297,
6136,
29918,
2746,
29918,
25590,
4144,
29897,
470,
313,
29890,
898,
29961,
29896,
29962,
297,
7657,
424,
29918,
2251,
29891,
1885,
322,
21224,
29961,
29900,
29962,
297,
6136,
29918,
2746,
29918,
25590,
4144,
1125,
30004,
13,
18884,
736,
7700,
29892,
525,
8423,
424,
288,
28596,
505,
3957,
411,
6136,
3268,
4047,
4144,
6169,
30004,
13,
9651,
25342,
313,
29890,
898,
29961,
29900,
29962,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
322,
21224,
29961,
29896,
29962,
297,
298,
5030,
29897,
470,
313,
29890,
898,
29961,
29896,
29962,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
322,
21224,
29961,
29900,
29962,
297,
298,
5030,
1125,
30004,
13,
18884,
736,
7700,
29892,
525,
8423,
424,
505,
3957,
411,
298,
5030,
6169,
30004,
13,
9651,
25342,
313,
29890,
898,
29961,
29900,
29962,
297,
7657,
424,
29918,
4287,
6718,
322,
21224,
29961,
29896,
29962,
297,
6136,
29918,
2746,
29918,
2251,
29891,
1885,
29897,
470,
313,
29890,
898,
29961,
29896,
29962,
297,
7657,
424,
29918,
4287,
6718,
322,
21224,
29961,
29900,
29962,
297,
6136,
29918,
2746,
29918,
2251,
29891,
1885,
1125,
30004,
13,
18884,
736,
7700,
29892,
525,
8423,
424,
22004,
505,
3957,
411,
6136,
3268,
288,
28596,
6169,
30004,
13,
9651,
25342,
313,
29890,
898,
29961,
29900,
29962,
297,
7657,
424,
29918,
2251,
29891,
1885,
322,
21224,
29961,
29896,
29962,
297,
6136,
29918,
2746,
29918,
2251,
29891,
1885,
29897,
470,
313,
29890,
898,
29961,
29896,
29962,
297,
7657,
424,
29918,
2251,
29891,
1885,
322,
21224,
29961,
29900,
29962,
297,
6136,
29918,
2746,
29918,
2251,
29891,
1885,
1125,
268,
6756,
13,
18884,
736,
7700,
29892,
525,
8423,
424,
288,
28596,
505,
3957,
411,
6136,
3268,
288,
28596,
6169,
30004,
13,
4706,
736,
5852,
29892,
525,
3198,
29918,
348,
23147,
519,
29918,
9965,
338,
1209,
6169,
30004,
13,
30004,
13,
1678,
822,
1423,
29918,
957,
6984,
29918,
4317,
29918,
12803,
29898,
1311,
29892,
3855,
29885,
29918,
25590,
4144,
353,
19997,
16897,
353,
29871,
29945,
29889,
29946,
1125,
30004,
13,
4706,
396,
5654,
4047,
4144,
2380,
1369,
515,
29871,
29900,
30004,
13,
4706,
396,
14542,
852,
278,
4047,
4144,
297,
9867,
1904,
607,
338,
297,
5654,
5120,
30004,
13,
4706,
1583,
29889,
29885,
324,
29889,
1885,
29941,
29928,
29898,
1311,
29889,
20227,
29918,
271,
4835,
29892,
1207,
29941,
29928,
29922,
8824,
8443,
13,
4706,
565,
7431,
29898,
1311,
29889,
29885,
324,
29889,
29885,
3775,
29897,
1275,
29871,
29896,
29901,
30004,
13,
9651,
736,
5852,
29892,
525,
3364,
29915,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
7573,
29918,
29896,
353,
518,
29885,
324,
29889,
517,
4247,
580,
363,
6062,
297,
1583,
29889,
29885,
324,
29889,
29885,
3775,
29962,
30004,
13,
9651,
285,
29881,
29896,
353,
518,
3177,
29889,
657,
23369,
1007,
580,
363,
2943,
297,
7573,
29918,
29896,
29962,
30004,
13,
9651,
27702,
567,
29892,
1320,
29906,
353,
19997,
5159,
30004,
13,
9651,
363,
22645,
29892,
474,
297,
26985,
29898,
1311,
29889,
29885,
324,
29889,
29885,
3775,
1125,
30004,
13,
18884,
565,
599,
29898,
13140,
29906,
451,
297,
1583,
29889,
20227,
29918,
271,
4835,
363,
22645,
29906,
297,
474,
29889,
29885,
3775,
29918,
513,
1575,
29961,
13140,
29962,
1125,
30004,
13,
462,
1678,
565,
738,
29898,
1311,
29889,
271,
4835,
29961,
13140,
29906,
29962,
1275,
29871,
29953,
470,
1583,
29889,
271,
4835,
29961,
13140,
29906,
29962,
1275,
29871,
29947,
363,
22645,
29906,
297,
474,
29889,
29885,
3775,
29918,
513,
1575,
29961,
13140,
29962,
1125,
30004,
13,
462,
4706,
27702,
567,
29889,
4397,
29898,
13140,
8443,
13,
30004,
13,
9651,
363,
13128,
297,
27702,
567,
29901,
30004,
13,
18884,
363,
3855,
29885,
29918,
1039,
297,
3855,
29885,
29918,
25590,
4144,
29901,
30004,
13,
462,
1678,
2923,
29906,
353,
1583,
29889,
29885,
324,
29961,
29939,
29885,
29918,
1039,
1822,
1111,
4339,
448,
285,
29881,
29896,
29961,
7050,
29962,
30004,
13,
462,
1678,
1320,
29906,
29889,
4397,
29898,
9302,
29889,
29880,
979,
29887,
29889,
12324,
29898,
12765,
29906,
876,
30004,
13,
9651,
396,
1596,
29898,
3317,
29898,
5721,
29906,
876,
30004,
13,
9651,
396,
1596,
29898,
12676,
29898,
5721,
29906,
876,
30004,
13,
9651,
565,
4236,
29898,
5721,
29906,
29897,
1405,
29871,
29953,
29889,
29945,
322,
2099,
29898,
5721,
29906,
29897,
1405,
29871,
29945,
29889,
29946,
29901,
30004,
13,
18884,
396,
1596,
29898,
3317,
29898,
5721,
29906,
876,
30004,
13,
18884,
396,
1596,
29898,
12676,
29898,
5721,
29906,
876,
30004,
13,
18884,
736,
7700,
29892,
525,
3563,
6984,
411,
278,
5654,
5120,
29915,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
736,
5852,
29892,
525,
3364,
29915,
30004,
13,
30004,
13,
1678,
822,
1423,
29918,
957,
6984,
29918,
4317,
29918,
12803,
29918,
29894,
29906,
29898,
1311,
29892,
3855,
4317,
29885,
353,
6213,
29892,
3855,
29885,
29918,
271,
4835,
353,
29871,
29906,
29941,
29892,
16897,
29918,
3605,
601,
353,
29871,
29900,
29889,
29953,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
450,
5418,
1546,
3855,
29885,
28422,
322,
5654,
28422,
881,
7621,
1135,
29871,
29900,
29889,
29953,
325,
28012,
11855,
22993,
13,
4706,
9995,
30004,
13,
4706,
1320,
29906,
353,
5159,
30004,
13,
4706,
363,
22645,
29896,
29892,
3855,
29885,
29918,
8678,
297,
26985,
29898,
1311,
29889,
29885,
324,
1125,
30004,
13,
9651,
565,
22645,
29896,
6736,
3855,
29885,
29918,
271,
4835,
29901,
30004,
13,
18884,
6773,
30004,
13,
9651,
363,
22645,
29906,
29892,
5654,
29918,
8678,
297,
26985,
29898,
29939,
4317,
29885,
1125,
30004,
13,
18884,
565,
22645,
29906,
529,
3855,
29885,
29918,
271,
4835,
29901,
30004,
13,
462,
1678,
6773,
30004,
13,
18884,
2923,
29906,
353,
7442,
29889,
2378,
29898,
29939,
29885,
29918,
8678,
29889,
1111,
4339,
29897,
448,
7442,
29889,
2378,
29898,
4317,
29918,
8678,
29889,
1111,
4339,
8443,
13,
18884,
1320,
353,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
12765,
29906,
8443,
13,
18884,
1543,
353,
382,
1307,
13780,
29918,
21009,
29889,
3166,
29918,
21641,
29918,
4537,
29898,
29939,
29885,
29918,
8678,
29889,
14824,
4178,
290,
29889,
2577,
4178,
25426,
8009,
3101,
30004,
13,
18884,
325,
28012,
29918,
3665,
353,
1543,
29889,
27491,
29893,
29918,
13471,
30004,
13,
18884,
565,
1320,
529,
325,
28012,
29918,
3665,
334,
16897,
29918,
3605,
601,
29901,
30004,
13,
462,
1678,
1320,
29906,
29889,
4397,
29898,
5721,
8443,
13,
4706,
565,
1320,
29906,
29901,
30004,
13,
9651,
736,
7700,
29892,
525,
22762,
25457,
411,
278,
5654,
5120,
29915,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
5852,
29892,
525,
3364,
29915,
30004,
13,
30004,
13,
30004,
13,
29937,
9867,
29918,
29890,
898,
353,
8207,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
2154,
29914,
29890,
13788,
29889,
3945,
29915,
30004,
13,
29937,
4343,
29918,
271,
4835,
353,
8207,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
2154,
29914,
20227,
29918,
271,
4835,
29889,
3945,
29915,
30004,
13,
29937,
3855,
4317,
29885,
353,
8207,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
401,
29914,
538,
29914,
29939,
4317,
29885,
29889,
20230,
29915,
30004,
13,
29937,
3855,
4317,
29885,
29918,
29885,
324,
353,
2446,
29898,
24381,
29889,
949,
1445,
877,
20230,
742,
3855,
4317,
29885,
876,
30004,
13,
29937,
396,
7657,
424,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
11219,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
401,
29914,
538,
29914,
5638,
1953,
742,
525,
29965,
29979,
8610,
29967,
3308,
29965,
29967,
1718,
12982,
29950,
29899,
29965,
29950,
4198,
4519,
29949,
29979,
8132,
29899,
29940,
29918,
29929,
29914,
4704,
29889,
20230,
1495,
30004,
13,
29937,
396,
285,
353,
383,
6227,
4945,
29898,
8423,
424,
29918,
1445,
29922,
8423,
424,
29918,
1445,
29892,
9867,
29918,
29890,
898,
29918,
1445,
29922,
19594,
29918,
29890,
898,
29892,
4343,
29918,
271,
4835,
353,
4343,
29918,
271,
4835,
8443,
13,
29937,
396,
10191,
353,
285,
29889,
3198,
29918,
957,
6984,
29918,
4317,
29918,
12803,
29918,
29906,
29898,
29939,
4317,
29885,
353,
3855,
4317,
29885,
29918,
29885,
324,
29892,
3855,
29885,
29918,
271,
4835,
353,
29871,
29906,
29941,
8443,
13,
30004,
13,
30004,
13,
29937,
263,
353,
2897,
29889,
1761,
3972,
11219,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
401,
29914,
538,
29914,
5638,
1953,
1495,
30004,
13,
29937,
363,
474,
297,
263,
29901,
30004,
13,
29937,
268,
1596,
877,
1378,
29899,
1495,
30004,
13,
29937,
268,
1596,
29898,
29875,
8443,
13,
29937,
268,
289,
353,
2897,
29889,
2084,
29889,
7122,
11219,
29885,
593,
29914,
29881,
29914,
28632,
29914,
29984,
29924,
4836,
29914,
28451,
2454,
1123,
2467,
4205,
11911,
29891,
29914,
401,
29914,
538,
29914,
5638,
1953,
742,
474,
8443,
13,
29937,
268,
7657,
424,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29890,
29892,
525,
8423,
424,
29889,
20230,
1495,
30004,
13,
29937,
268,
285,
353,
383,
6227,
4945,
29898,
8423,
424,
29918,
1445,
29892,
9867,
29918,
29890,
898,
29918,
1445,
29922,
19594,
29918,
29890,
898,
29892,
4343,
29918,
271,
4835,
353,
4343,
29918,
271,
4835,
8443,
13,
29937,
268,
4660,
29892,
10191,
353,
285,
29889,
3198,
29918,
1725,
294,
1821,
29918,
17697,
29876,
29898,
3198,
29918,
4317,
29918,
957,
6984,
353,
5852,
29892,
3855,
4317,
29885,
353,
3855,
4317,
29885,
29918,
29885,
324,
29892,
3855,
29885,
29918,
271,
4835,
353,
29871,
29906,
29941,
29892,
16897,
29918,
3605,
601,
353,
29871,
29900,
29889,
29953,
8443,
13,
29937,
268,
396,
2106,
29892,
10191,
353,
285,
29889,
3198,
29918,
1725,
294,
1821,
29918,
17697,
29876,
29898,
3198,
29918,
4317,
29918,
957,
6984,
29922,
5574,
8443,
13,
29937,
268,
396,
1596,
29898,
3859,
8443,
13,
29937,
268,
396,
1596,
29898,
7645,
29897,
2
] |
pylibcontainer/image.py | joaompinto/pylibcontainer | 7 | 8939 | from __future__ import print_function
import os
import shutil
import hashlib
import requests
import click
from tempfile import NamedTemporaryFile
from hashlib import sha256
from os.path import expanduser, join, exists, basename
from .utils import HumanSize
from .tar import extract_layer
from . import trust
from . import container
from .colorhelper import print_info, print_error, print_warn, print_success
from .colorhelper import success
from .image_index import get_url
from clint.textui import progress
from dateutil.parser import parse as parsedate
from datetime import datetime
CACHE_PATH = join(expanduser("~"), ".pylibcontainer", "images_cache")
class Cache(object):
cache_dir = CACHE_PATH
""" Provides an image caching mechanism on disk """
def __init__(self):
if not exists(CACHE_PATH):
os.makedirs(CACHE_PATH, 0o700)
def get(self, cache_key, default=None):
""" return info for cached file """
cache_hash = sha256(cache_key.encode()).hexdigest()
cache_fn = join(CACHE_PATH, "url_" + cache_hash)
if exists(cache_fn):
file_stat = os.stat(cache_fn)
last_modified = datetime.fromtimestamp(file_stat.st_mtime)
file_size = file_stat.st_size
return cache_fn, cache_hash, last_modified, file_size
return default
def put(self, filename, cache_key):
""" put a file into cache """
cache_hash = sha256(cache_key.encode()).hexdigest()
cache_fn = join(CACHE_PATH, "url_" + cache_hash)
shutil.move(filename, cache_fn)
return cache_hash, cache_fn
def download(image_url):
""" Download image (if not found in cache) and return it's filename """
response = requests.head(image_url)
file_size = remote_file_size = int(response.headers.get("Content-Length"))
remote_last_modified = parsedate(response.headers.get("Last-Modified")).replace(
tzinfo=None
)
remote_is_valid = response.status_code == 200 and file_size and remote_last_modified
# Check if image is on cache
cache = Cache()
cached_image = cache.get(image_url)
if cached_image:
if remote_is_valid:
cache_fn, cache_hash, last_modified, file_size = cached_image
if remote_file_size == file_size and remote_last_modified < last_modified:
print_info("Using file from cache", CACHE_PATH)
return cache_hash, cache_fn
print_info("Downloading new remote file because an update was found")
else:
print_warn("Unable to check the status for " + image_url)
print_warn("Assuming local cache is valid")
# Not cached, and no valid remote information was found
if not remote_is_valid:
print_error(
"Unable to get file, http_code=%s, size=%s, last_modified=%s"
% (response.status_code, remote_file_size, remote_last_modified)
)
exit(2)
# Dowload image
print_info(
"Downloading image... ",
"{0} [{1:.2S}]".format(basename(image_url), HumanSize(file_size)),
)
remote_sha256 = hashlib.sha256()
response = requests.get(image_url, stream=True)
with NamedTemporaryFile(delete=False) as tmp_file:
for chunk in progress.bar(
response.iter_content(chunk_size=1024), expected_size=(file_size / 1024) + 1
):
if chunk:
remote_sha256.update(chunk)
tmp_file.write(chunk)
tmp_file.flush()
# Verify image integrity
trust_verify = trust.verify(image_url, tmp_file.name, remote_sha256.hexdigest())
if not trust_verify or not trust_verify.valid or not trust_verify.username:
print_error("Integrity/authenticity error - GPG signature mismatch!")
exit(3)
print("{0:>10}: {1}".format("GPG Signer", success(trust_verify.username)))
print("{0:>10}: {1}".format("GPG ID", success(trust_verify.pubkey_fingerprint)))
print("{0:>10}: {1}".format("Creation", success(trust_verify.creation_date)))
return cache.put(tmp_file.name, image_url)
@click.command()
@click.argument("image_url")
@click.option("--as_root", is_flag=True)
@click.option("--overlay", "-o", multiple=True)
@click.argument("command", nargs=-1)
def run(image_url, command, as_root, overlay):
url = get_url(image_url)
image_url = url or image_url
if not image_url:
print_info("No index was found for image", image_url)
exit(5)
is_validate_only = False
if not command:
command = ["/bin/sh"]
image_protocol = image_url.split(":")[0].lower()
if image_protocol in ["http", "https"]:
_, image_fn = download(image_url)
else:
_, image_fn = sha256(image_url).hexdigest(), image_url
rootfs = extract_layer(image_fn)
if len(command) == 1 and command[0] == "-":
is_validate_only = True
print("Validating container setup with the rootfs")
else:
print_info("Executing", " ".join(command))
_, exit_code = container.runc(rootfs, command, as_root, overlay)
if exit_code != 0:
print_error("Last command returned an error")
elif is_validate_only:
print_success("OK")
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
6608,
1982,
13,
5215,
7274,
13,
5215,
2828,
13,
3166,
5694,
1445,
1053,
405,
2795,
5776,
1971,
653,
2283,
13,
3166,
6608,
1982,
1053,
528,
29874,
29906,
29945,
29953,
13,
3166,
2897,
29889,
2084,
1053,
7985,
1792,
29892,
5988,
29892,
4864,
29892,
2362,
3871,
13,
3166,
869,
13239,
1053,
12968,
3505,
13,
3166,
869,
12637,
1053,
6597,
29918,
13148,
13,
3166,
869,
1053,
9311,
13,
3166,
869,
1053,
5639,
13,
3166,
869,
2780,
20907,
1053,
1596,
29918,
3888,
29892,
1596,
29918,
2704,
29892,
1596,
29918,
25442,
29892,
1596,
29918,
8698,
13,
3166,
869,
2780,
20907,
1053,
2551,
13,
3166,
869,
3027,
29918,
2248,
1053,
679,
29918,
2271,
13,
3166,
1067,
524,
29889,
726,
1481,
1053,
6728,
13,
3166,
2635,
4422,
29889,
16680,
1053,
6088,
408,
21213,
403,
13,
3166,
12865,
1053,
12865,
13,
13,
29907,
2477,
9606,
29918,
10145,
353,
5988,
29898,
18837,
1792,
703,
30022,
4968,
11393,
2272,
1982,
7611,
613,
376,
8346,
29918,
8173,
1159,
13,
13,
13,
1990,
28540,
29898,
3318,
1125,
13,
1678,
7090,
29918,
3972,
353,
315,
2477,
9606,
29918,
10145,
13,
13,
1678,
9995,
9133,
2247,
385,
1967,
22488,
13336,
373,
8086,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
565,
451,
4864,
29898,
29907,
2477,
9606,
29918,
10145,
1125,
13,
9651,
2897,
29889,
29885,
12535,
12935,
29898,
29907,
2477,
9606,
29918,
10145,
29892,
29871,
29900,
29877,
29955,
29900,
29900,
29897,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
7090,
29918,
1989,
29892,
2322,
29922,
8516,
1125,
13,
4706,
9995,
736,
5235,
363,
22152,
934,
9995,
13,
4706,
7090,
29918,
8568,
353,
528,
29874,
29906,
29945,
29953,
29898,
8173,
29918,
1989,
29889,
12508,
16655,
20970,
7501,
342,
580,
13,
4706,
7090,
29918,
9144,
353,
5988,
29898,
29907,
2477,
9606,
29918,
10145,
29892,
376,
2271,
27508,
718,
7090,
29918,
8568,
29897,
13,
13,
4706,
565,
4864,
29898,
8173,
29918,
9144,
1125,
13,
9651,
934,
29918,
6112,
353,
2897,
29889,
6112,
29898,
8173,
29918,
9144,
29897,
13,
9651,
1833,
29918,
1545,
2164,
353,
12865,
29889,
3166,
16394,
29898,
1445,
29918,
6112,
29889,
303,
29918,
29885,
2230,
29897,
13,
9651,
934,
29918,
2311,
353,
934,
29918,
6112,
29889,
303,
29918,
2311,
13,
9651,
736,
7090,
29918,
9144,
29892,
7090,
29918,
8568,
29892,
1833,
29918,
1545,
2164,
29892,
934,
29918,
2311,
13,
13,
4706,
736,
2322,
13,
13,
1678,
822,
1925,
29898,
1311,
29892,
10422,
29892,
7090,
29918,
1989,
1125,
13,
4706,
9995,
1925,
263,
934,
964,
7090,
9995,
13,
4706,
7090,
29918,
8568,
353,
528,
29874,
29906,
29945,
29953,
29898,
8173,
29918,
1989,
29889,
12508,
16655,
20970,
7501,
342,
580,
13,
4706,
7090,
29918,
9144,
353,
5988,
29898,
29907,
2477,
9606,
29918,
10145,
29892,
376,
2271,
27508,
718,
7090,
29918,
8568,
29897,
13,
4706,
528,
4422,
29889,
11631,
29898,
9507,
29892,
7090,
29918,
9144,
29897,
13,
4706,
736,
7090,
29918,
8568,
29892,
7090,
29918,
9144,
13,
13,
13,
1753,
5142,
29898,
3027,
29918,
2271,
1125,
13,
1678,
9995,
25553,
1967,
313,
361,
451,
1476,
297,
7090,
29897,
322,
736,
372,
29915,
29879,
10422,
9995,
13,
13,
1678,
2933,
353,
7274,
29889,
2813,
29898,
3027,
29918,
2271,
29897,
13,
1678,
934,
29918,
2311,
353,
7592,
29918,
1445,
29918,
2311,
353,
938,
29898,
5327,
29889,
13662,
29889,
657,
703,
3916,
29899,
6513,
5783,
13,
1678,
7592,
29918,
4230,
29918,
1545,
2164,
353,
21213,
403,
29898,
5327,
29889,
13662,
29889,
657,
703,
8897,
29899,
2111,
2164,
1159,
467,
6506,
29898,
13,
4706,
260,
29920,
3888,
29922,
8516,
13,
1678,
1723,
13,
1678,
7592,
29918,
275,
29918,
3084,
353,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
322,
934,
29918,
2311,
322,
7592,
29918,
4230,
29918,
1545,
2164,
13,
13,
1678,
396,
5399,
565,
1967,
338,
373,
7090,
13,
1678,
7090,
353,
28540,
580,
13,
1678,
22152,
29918,
3027,
353,
7090,
29889,
657,
29898,
3027,
29918,
2271,
29897,
13,
1678,
565,
22152,
29918,
3027,
29901,
13,
4706,
565,
7592,
29918,
275,
29918,
3084,
29901,
13,
9651,
7090,
29918,
9144,
29892,
7090,
29918,
8568,
29892,
1833,
29918,
1545,
2164,
29892,
934,
29918,
2311,
353,
22152,
29918,
3027,
13,
9651,
565,
7592,
29918,
1445,
29918,
2311,
1275,
934,
29918,
2311,
322,
7592,
29918,
4230,
29918,
1545,
2164,
529,
1833,
29918,
1545,
2164,
29901,
13,
18884,
1596,
29918,
3888,
703,
15156,
934,
515,
7090,
613,
315,
2477,
9606,
29918,
10145,
29897,
13,
18884,
736,
7090,
29918,
8568,
29892,
7090,
29918,
9144,
13,
9651,
1596,
29918,
3888,
703,
6767,
13234,
716,
7592,
934,
1363,
385,
2767,
471,
1476,
1159,
13,
4706,
1683,
29901,
13,
9651,
1596,
29918,
25442,
703,
2525,
519,
304,
1423,
278,
4660,
363,
376,
718,
1967,
29918,
2271,
29897,
13,
9651,
1596,
29918,
25442,
703,
7900,
9929,
1887,
7090,
338,
2854,
1159,
13,
13,
1678,
396,
2216,
22152,
29892,
322,
694,
2854,
7592,
2472,
471,
1476,
13,
1678,
565,
451,
7592,
29918,
275,
29918,
3084,
29901,
13,
4706,
1596,
29918,
2704,
29898,
13,
9651,
376,
2525,
519,
304,
679,
934,
29892,
1732,
29918,
401,
16328,
29879,
29892,
2159,
16328,
29879,
29892,
1833,
29918,
1545,
2164,
16328,
29879,
29908,
13,
9651,
1273,
313,
5327,
29889,
4882,
29918,
401,
29892,
7592,
29918,
1445,
29918,
2311,
29892,
7592,
29918,
4230,
29918,
1545,
2164,
29897,
13,
4706,
1723,
13,
4706,
6876,
29898,
29906,
29897,
13,
13,
1678,
396,
26028,
1359,
1967,
13,
1678,
1596,
29918,
3888,
29898,
13,
4706,
376,
6767,
13234,
1967,
856,
9162,
13,
4706,
29850,
29900,
29913,
15974,
29896,
29901,
29889,
29906,
29903,
6525,
1642,
4830,
29898,
6500,
3871,
29898,
3027,
29918,
2271,
511,
12968,
3505,
29898,
1445,
29918,
2311,
8243,
13,
1678,
1723,
13,
1678,
7592,
29918,
17051,
29906,
29945,
29953,
353,
6608,
1982,
29889,
17051,
29906,
29945,
29953,
580,
13,
1678,
2933,
353,
7274,
29889,
657,
29898,
3027,
29918,
2271,
29892,
4840,
29922,
5574,
29897,
13,
1678,
411,
405,
2795,
5776,
1971,
653,
2283,
29898,
8143,
29922,
8824,
29897,
408,
13128,
29918,
1445,
29901,
13,
4706,
363,
19875,
297,
6728,
29889,
1646,
29898,
13,
9651,
2933,
29889,
1524,
29918,
3051,
29898,
29812,
29918,
2311,
29922,
29896,
29900,
29906,
29946,
511,
3806,
29918,
2311,
7607,
1445,
29918,
2311,
847,
29871,
29896,
29900,
29906,
29946,
29897,
718,
29871,
29896,
13,
308,
1125,
13,
9651,
565,
19875,
29901,
13,
18884,
7592,
29918,
17051,
29906,
29945,
29953,
29889,
5504,
29898,
29812,
29897,
13,
18884,
13128,
29918,
1445,
29889,
3539,
29898,
29812,
29897,
13,
18884,
13128,
29918,
1445,
29889,
23126,
580,
13,
13,
1678,
396,
1798,
1598,
1967,
28410,
13,
1678,
9311,
29918,
27902,
353,
9311,
29889,
27902,
29898,
3027,
29918,
2271,
29892,
13128,
29918,
1445,
29889,
978,
29892,
7592,
29918,
17051,
29906,
29945,
29953,
29889,
20970,
7501,
342,
3101,
13,
1678,
565,
451,
9311,
29918,
27902,
470,
451,
9311,
29918,
27902,
29889,
3084,
470,
451,
9311,
29918,
27902,
29889,
6786,
29901,
13,
4706,
1596,
29918,
2704,
703,
23573,
537,
29914,
27218,
537,
1059,
448,
402,
16903,
12608,
29635,
29991,
1159,
13,
4706,
6876,
29898,
29941,
29897,
13,
1678,
1596,
703,
29912,
29900,
29901,
29958,
29896,
29900,
6177,
426,
29896,
29913,
1642,
4830,
703,
29954,
16903,
9954,
261,
613,
2551,
29898,
509,
504,
29918,
27902,
29889,
6786,
4961,
13,
1678,
1596,
703,
29912,
29900,
29901,
29958,
29896,
29900,
6177,
426,
29896,
29913,
1642,
4830,
703,
29954,
16903,
3553,
613,
2551,
29898,
509,
504,
29918,
27902,
29889,
5467,
1989,
29918,
29888,
5621,
2158,
4961,
13,
1678,
1596,
703,
29912,
29900,
29901,
29958,
29896,
29900,
6177,
426,
29896,
29913,
1642,
4830,
703,
9832,
362,
613,
2551,
29898,
509,
504,
29918,
27902,
29889,
1037,
362,
29918,
1256,
4961,
13,
13,
1678,
736,
7090,
29889,
649,
29898,
7050,
29918,
1445,
29889,
978,
29892,
1967,
29918,
2271,
29897,
13,
13,
13,
29992,
3808,
29889,
6519,
580,
13,
29992,
3808,
29889,
23516,
703,
3027,
29918,
2271,
1159,
13,
29992,
3808,
29889,
3385,
703,
489,
294,
29918,
4632,
613,
338,
29918,
15581,
29922,
5574,
29897,
13,
29992,
3808,
29889,
3385,
703,
489,
957,
8387,
613,
11663,
29877,
613,
2999,
29922,
5574,
29897,
13,
29992,
3808,
29889,
23516,
703,
6519,
613,
302,
5085,
10457,
29896,
29897,
13,
1753,
1065,
29898,
3027,
29918,
2271,
29892,
1899,
29892,
408,
29918,
4632,
29892,
27292,
1125,
13,
1678,
3142,
353,
679,
29918,
2271,
29898,
3027,
29918,
2271,
29897,
13,
1678,
1967,
29918,
2271,
353,
3142,
470,
1967,
29918,
2271,
13,
1678,
565,
451,
1967,
29918,
2271,
29901,
13,
4706,
1596,
29918,
3888,
703,
3782,
2380,
471,
1476,
363,
1967,
613,
1967,
29918,
2271,
29897,
13,
4706,
6876,
29898,
29945,
29897,
13,
1678,
338,
29918,
15480,
29918,
6194,
353,
7700,
13,
1678,
565,
451,
1899,
29901,
13,
4706,
1899,
353,
6796,
29914,
2109,
29914,
845,
3108,
13,
1678,
1967,
29918,
20464,
353,
1967,
29918,
2271,
29889,
5451,
703,
29901,
1159,
29961,
29900,
1822,
13609,
580,
13,
1678,
565,
1967,
29918,
20464,
297,
6796,
1124,
613,
376,
991,
3108,
29901,
13,
4706,
17117,
1967,
29918,
9144,
353,
5142,
29898,
3027,
29918,
2271,
29897,
13,
1678,
1683,
29901,
13,
4706,
17117,
1967,
29918,
9144,
353,
528,
29874,
29906,
29945,
29953,
29898,
3027,
29918,
2271,
467,
20970,
7501,
342,
3285,
1967,
29918,
2271,
13,
1678,
3876,
5847,
353,
6597,
29918,
13148,
29898,
3027,
29918,
9144,
29897,
13,
1678,
565,
7431,
29898,
6519,
29897,
1275,
29871,
29896,
322,
1899,
29961,
29900,
29962,
1275,
11663,
1115,
13,
4706,
338,
29918,
15480,
29918,
6194,
353,
5852,
13,
4706,
1596,
703,
7211,
1218,
5639,
6230,
411,
278,
3876,
5847,
1159,
13,
1678,
1683,
29901,
13,
4706,
1596,
29918,
3888,
703,
5379,
17068,
613,
376,
11393,
7122,
29898,
6519,
876,
13,
1678,
17117,
6876,
29918,
401,
353,
5639,
29889,
3389,
29883,
29898,
4632,
5847,
29892,
1899,
29892,
408,
29918,
4632,
29892,
27292,
29897,
13,
1678,
565,
6876,
29918,
401,
2804,
29871,
29900,
29901,
13,
4706,
1596,
29918,
2704,
703,
8897,
1899,
4133,
385,
1059,
1159,
13,
1678,
25342,
338,
29918,
15480,
29918,
6194,
29901,
13,
4706,
1596,
29918,
8698,
703,
8949,
1159,
13,
2
] |
shared/modules/xccdf2csv_stig_module.py | gregelin/scap-security-guide | 1 | 142125 | <filename>shared/modules/xccdf2csv_stig_module.py
#!/usr/bin/python
import sys
import csv
import lxml.etree as ET
# This script creates a CSV file from an XCCDF file formatted in the
# structure of a STIG. This should enable its ingestion into VMS,
# as well as its comparison with VMS output.
xccdf_ns = "http://checklists.nist.gov/xccdf/1.1"
disa_cciuri = "http://iase.disa.mil/stigs/cci/Pages/index.aspx"
disa_srguri = "http://iase.disa.mil/stigs/srgs/Pages/index.aspx"
def parse_xml_file(xmlfile):
with open(xmlfile, 'r') as xml_file:
filestring = xml_file.read()
tree = ET.fromstring(filestring)
return tree
def reflist(refs):
refstring = ', '.join(refs)
return refstring
def node_to_text(node):
textslist = node.xpath(".//text()")
return ''.join(textslist)
def main():
if len(sys.argv) < 2:
print "Provide an XCCDF file to convert into a CSV file."
sys.exit(1)
xccdffile = sys.argv[1]
xccdftree = parse_xml_file(xccdffile)
rules = xccdftree.findall(".//{%s}Rule" % xccdf_ns)
rulewriter = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL)
for rule in rules:
cci_refs = [ref.text for ref in rule.findall("{%s}ident[@system='%s']"
% (xccdf_ns, disa_cciuri))]
srg_refs = [ref.text for ref in rule.findall("{%s}ident[@system='%s']"
% (xccdf_ns, disa_srguri))]
title = rule.find("{%s}title" % xccdf_ns).text
description = node_to_text(rule.find("{%s}description" % xccdf_ns))
fixtext = node_to_text(rule.find("{%s}fixtext" % xccdf_ns))
checktext = node_to_text(rule.find(".//{%s}check-content" % xccdf_ns))
row = [reflist(cci_refs), reflist(srg_refs), title, description, fixtext, checktext]
rulewriter.writerow(row)
sys.exit(0)
if __name__ == "__main__":
main()
| [
1,
529,
9507,
29958,
12366,
29914,
7576,
29914,
29916,
617,
2176,
29906,
7638,
29918,
303,
335,
29918,
5453,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
13,
13,
5215,
10876,
13,
5215,
11799,
13,
5215,
301,
3134,
29889,
300,
929,
408,
382,
29911,
13,
13,
29937,
910,
2471,
10017,
263,
16874,
934,
515,
385,
1060,
4174,
4037,
934,
20917,
297,
278,
13,
29937,
3829,
310,
263,
6850,
6259,
29889,
29871,
910,
881,
9025,
967,
2348,
602,
964,
478,
4345,
29892,
13,
29937,
408,
1532,
408,
967,
10230,
411,
478,
4345,
1962,
29889,
13,
13,
29916,
617,
2176,
29918,
1983,
353,
376,
1124,
597,
3198,
21513,
29889,
29876,
391,
29889,
13513,
29914,
29916,
617,
2176,
29914,
29896,
29889,
29896,
29908,
13,
2218,
29874,
29918,
29883,
455,
5338,
353,
376,
1124,
597,
29875,
559,
29889,
2218,
29874,
29889,
23853,
29914,
303,
23379,
29914,
29883,
455,
29914,
27514,
29914,
2248,
29889,
6307,
29908,
13,
2218,
29874,
29918,
29879,
11007,
5338,
353,
376,
1124,
597,
29875,
559,
29889,
2218,
29874,
29889,
23853,
29914,
303,
23379,
29914,
21935,
3174,
29914,
27514,
29914,
2248,
29889,
6307,
29908,
13,
13,
13,
1753,
6088,
29918,
3134,
29918,
1445,
29898,
3134,
1445,
1125,
13,
1678,
411,
1722,
29898,
3134,
1445,
29892,
525,
29878,
1495,
408,
4903,
29918,
1445,
29901,
13,
4706,
977,
342,
5393,
353,
4903,
29918,
1445,
29889,
949,
580,
13,
4706,
5447,
353,
382,
29911,
29889,
3166,
1807,
29898,
1777,
342,
5393,
29897,
13,
1678,
736,
5447,
13,
13,
13,
1753,
337,
1579,
391,
29898,
24539,
1125,
13,
1678,
2143,
1807,
353,
13420,
15300,
7122,
29898,
24539,
29897,
13,
1678,
736,
2143,
1807,
13,
13,
13,
1753,
2943,
29918,
517,
29918,
726,
29898,
3177,
1125,
13,
1678,
26442,
1761,
353,
2943,
29889,
23635,
17350,
458,
726,
580,
1159,
13,
1678,
736,
525,
4286,
7122,
29898,
726,
29879,
1761,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29906,
29901,
13,
4706,
1596,
376,
1184,
29894,
680,
385,
1060,
4174,
4037,
934,
304,
3588,
964,
263,
16874,
934,
1213,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
921,
617,
29881,
600,
488,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
1678,
921,
617,
29881,
615,
929,
353,
6088,
29918,
3134,
29918,
1445,
29898,
29916,
617,
29881,
600,
488,
29897,
13,
1678,
6865,
353,
921,
617,
29881,
615,
929,
29889,
2886,
497,
17350,
458,
18255,
29879,
29913,
10740,
29908,
1273,
921,
617,
2176,
29918,
1983,
29897,
13,
1678,
5751,
13236,
353,
11799,
29889,
13236,
29898,
9675,
29889,
25393,
29892,
439,
11427,
29922,
7638,
29889,
13356,
2891,
29923,
29918,
9818,
29897,
13,
13,
1678,
363,
5751,
297,
6865,
29901,
13,
4706,
274,
455,
29918,
24539,
353,
518,
999,
29889,
726,
363,
2143,
297,
5751,
29889,
2886,
497,
703,
18255,
29879,
29913,
1693,
17548,
5205,
2433,
29995,
29879,
2033,
29908,
13,
462,
462,
462,
268,
1273,
313,
29916,
617,
2176,
29918,
1983,
29892,
766,
29874,
29918,
29883,
455,
5338,
28166,
13,
4706,
269,
11007,
29918,
24539,
353,
518,
999,
29889,
726,
363,
2143,
297,
5751,
29889,
2886,
497,
703,
18255,
29879,
29913,
1693,
17548,
5205,
2433,
29995,
29879,
2033,
29908,
13,
462,
462,
462,
268,
1273,
313,
29916,
617,
2176,
29918,
1983,
29892,
766,
29874,
29918,
29879,
11007,
5338,
28166,
13,
4706,
3611,
353,
5751,
29889,
2886,
703,
18255,
29879,
29913,
3257,
29908,
1273,
921,
617,
2176,
29918,
1983,
467,
726,
13,
4706,
6139,
353,
2943,
29918,
517,
29918,
726,
29898,
7491,
29889,
2886,
703,
18255,
29879,
29913,
8216,
29908,
1273,
921,
617,
2176,
29918,
1983,
876,
13,
4706,
2329,
726,
353,
2943,
29918,
517,
29918,
726,
29898,
7491,
29889,
2886,
703,
18255,
29879,
29913,
5878,
726,
29908,
1273,
921,
617,
2176,
29918,
1983,
876,
13,
4706,
1423,
726,
353,
2943,
29918,
517,
29918,
726,
29898,
7491,
29889,
2886,
17350,
458,
18255,
29879,
29913,
3198,
29899,
3051,
29908,
1273,
921,
617,
2176,
29918,
1983,
876,
13,
4706,
1948,
353,
518,
999,
1761,
29898,
29883,
455,
29918,
24539,
511,
337,
1579,
391,
29898,
29879,
11007,
29918,
24539,
511,
3611,
29892,
6139,
29892,
2329,
726,
29892,
1423,
726,
29962,
13,
4706,
5751,
13236,
29889,
13236,
340,
29898,
798,
29897,
13,
13,
1678,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
tests/unit_tests/utils/test_handlers/__init__.py | openjusticebaltimore/ResponseBot | 16 | 69411 | from responsebot.handlers import BaseTweetHandler, register_handler
@register_handler
class HandlerClassInInit(BaseTweetHandler):
def on_tweet(self, tweet):
print('HandlerClassInInit')
| [
1,
515,
2933,
7451,
29889,
3179,
9306,
1053,
7399,
29911,
16668,
4598,
29892,
6036,
29918,
13789,
13,
13,
13,
29992,
9573,
29918,
13789,
13,
1990,
5166,
1358,
2385,
797,
6644,
29898,
5160,
29911,
16668,
4598,
1125,
13,
1678,
822,
373,
29918,
29873,
16668,
29898,
1311,
29892,
7780,
300,
1125,
13,
4706,
1596,
877,
4598,
2385,
797,
6644,
1495,
13,
2
] |
settings/__init__.py | suuuuumod/awmepost | 1 | 129721 | import os
DEBUG="false"
# telegram
BOT_TOKEN="YOURTOKEN"
TEST_CHANNEL_ID="@CHANELID"
# reddit
REDDIT_CHANNEL_ID = TEST_CHANNEL_ID
REDDIT_USERNAME="USERNAME_REDDIT"
# imgur
IMGUR_CLIENT_ID="APP_CLIENT_ID_IMGUR"
IMGUR_CHANNEL_ID = TEST_CHANNEL_ID
# heroku
HEROKU_APP_NAME="APP_NAME_HEROKU"
PORT=8000
HOST="0.0.0.0"
# database
MONGO_URI ="MONGO_DB_HERE"
CLEAR_AGE = eval('2 * 24 * 60 * 60')
CLEAR_INTERVAL = eval('2 * 24 * 60 * 60')
# misc
ADMINS=[ADMINS_ID]
FETCH_LIMIT=10
| [
1,
1053,
2897,
13,
13,
18525,
543,
4541,
29908,
13,
13,
13,
13,
29937,
4382,
1393,
13,
29933,
2891,
29918,
4986,
29968,
1430,
543,
29979,
22970,
4986,
29968,
1430,
29908,
13,
18267,
29918,
3210,
2190,
29940,
6670,
29918,
1367,
5213,
3210,
2190,
6670,
1367,
29908,
13,
13,
29937,
337,
1289,
277,
13,
1525,
7858,
1806,
29918,
3210,
2190,
29940,
6670,
29918,
1367,
353,
17067,
1254,
29918,
3210,
2190,
29940,
6670,
29918,
1367,
13,
1525,
7858,
1806,
29918,
11889,
5813,
543,
11889,
5813,
29918,
1525,
7858,
1806,
29908,
13,
13,
13,
29937,
10153,
332,
13,
7833,
29954,
4574,
29918,
27205,
3919,
29918,
1367,
543,
20576,
29918,
27205,
3919,
29918,
1367,
29918,
7833,
29954,
4574,
29908,
13,
7833,
29954,
4574,
29918,
3210,
2190,
29940,
6670,
29918,
1367,
353,
17067,
1254,
29918,
3210,
2190,
29940,
6670,
29918,
1367,
13,
13,
13,
29937,
902,
9154,
13,
4448,
8949,
29965,
29918,
20576,
29918,
5813,
543,
20576,
29918,
5813,
29918,
4448,
8949,
29965,
29908,
13,
15082,
29922,
29947,
29900,
29900,
29900,
13,
20832,
543,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
29908,
13,
13,
29937,
2566,
13,
22877,
17080,
29918,
15551,
29465,
22877,
17080,
29918,
4051,
29918,
5006,
29908,
13,
29907,
1307,
1718,
29918,
10461,
353,
19745,
877,
29906,
334,
29871,
29906,
29946,
334,
29871,
29953,
29900,
334,
29871,
29953,
29900,
1495,
13,
29907,
1307,
1718,
29918,
23845,
8932,
353,
19745,
877,
29906,
334,
29871,
29906,
29946,
334,
29871,
29953,
29900,
334,
29871,
29953,
29900,
1495,
13,
13,
13,
29937,
3984,
29883,
13,
3035,
16173,
29903,
11759,
3035,
16173,
29903,
29918,
1367,
29962,
13,
29943,
2544,
3210,
29918,
5265,
26349,
29922,
29896,
29900,
13,
2
] |
run_all.py | EinariTuukkanen/line-search-comparison | 0 | 20370 | import numpy as np
from example_functions import target_function_dict
from line_search_methods import line_search_dict
from main_methods import main_method_dict
from config import best_params
from helpers import generate_x0
def run_one(_theta, _main_method, _ls_method, params, ls_params):
theta = _theta()
x0 = generate_x0(theta.n, *theta.bounds)
ls_method = _ls_method(ls_params)
main_method = _main_method(params, ls_method)
# print('Correct solution: ', theta.min_values)
result = main_method(theta, np.array(x0))
# print('Found solution: ', result['min_value'])
# print(result_to_string(result))
return result
def result_to_string(result):
perf = result['performance']
ls_perf = perf['line_search']
return ', '.join([str(s) for s in [
result['status'], perf['iterations'], f"{perf['duration']} ms",
ls_perf['iterations'], f"{round(ls_perf['duration'], 2)} ms",
]])
np.warnings.filterwarnings('ignore', category=RuntimeWarning)
for theta in best_params:
for main_method in best_params[theta]:
for line_search in best_params[theta][main_method]:
result = run_one(
target_function_dict[theta],
main_method_dict[main_method],
line_search_dict[line_search],
best_params[theta][main_method][line_search]['params'],
best_params[theta][main_method][line_search]['ls_params'],
)
status = result['status']
print(f"{status}: {theta},{main_method},{line_search}")
| [
1,
1053,
12655,
408,
7442,
13,
13,
3166,
1342,
29918,
12171,
1053,
3646,
29918,
2220,
29918,
8977,
13,
3166,
1196,
29918,
4478,
29918,
23515,
1053,
1196,
29918,
4478,
29918,
8977,
13,
3166,
1667,
29918,
23515,
1053,
1667,
29918,
5696,
29918,
8977,
13,
3166,
2295,
1053,
1900,
29918,
7529,
13,
3166,
1371,
414,
1053,
5706,
29918,
29916,
29900,
13,
13,
13,
1753,
1065,
29918,
650,
7373,
3416,
29892,
903,
3396,
29918,
5696,
29892,
903,
3137,
29918,
5696,
29892,
8636,
29892,
19375,
29918,
7529,
1125,
13,
1678,
278,
941,
353,
903,
3416,
580,
13,
1678,
921,
29900,
353,
5706,
29918,
29916,
29900,
29898,
3416,
29889,
29876,
29892,
334,
3416,
29889,
23687,
29897,
13,
1678,
19375,
29918,
5696,
353,
903,
3137,
29918,
5696,
29898,
3137,
29918,
7529,
29897,
13,
1678,
1667,
29918,
5696,
353,
903,
3396,
29918,
5696,
29898,
7529,
29892,
19375,
29918,
5696,
29897,
13,
13,
1678,
396,
1596,
877,
12521,
1621,
1650,
29901,
13420,
278,
941,
29889,
1195,
29918,
5975,
29897,
13,
1678,
1121,
353,
1667,
29918,
5696,
29898,
3416,
29892,
7442,
29889,
2378,
29898,
29916,
29900,
876,
13,
1678,
396,
1596,
877,
9692,
1650,
29901,
13420,
1121,
1839,
1195,
29918,
1767,
11287,
13,
1678,
396,
1596,
29898,
2914,
29918,
517,
29918,
1807,
29898,
2914,
876,
13,
1678,
736,
1121,
13,
13,
13,
1753,
1121,
29918,
517,
29918,
1807,
29898,
2914,
1125,
13,
1678,
23895,
353,
1121,
1839,
546,
13390,
2033,
13,
1678,
19375,
29918,
546,
29888,
353,
23895,
1839,
1220,
29918,
4478,
2033,
13,
1678,
736,
13420,
15300,
7122,
4197,
710,
29898,
29879,
29897,
363,
269,
297,
518,
13,
4706,
1121,
1839,
4882,
7464,
23895,
1839,
1524,
800,
7464,
285,
29908,
29912,
546,
29888,
1839,
19708,
2033,
29913,
10887,
613,
13,
4706,
19375,
29918,
546,
29888,
1839,
1524,
800,
7464,
285,
29908,
29912,
14486,
29898,
3137,
29918,
546,
29888,
1839,
19708,
7464,
29871,
29906,
2915,
10887,
613,
13,
1678,
4514,
2314,
13,
13,
13,
9302,
29889,
25442,
886,
29889,
4572,
25442,
886,
877,
17281,
742,
7663,
29922,
7944,
22709,
29897,
13,
13,
1454,
278,
941,
297,
1900,
29918,
7529,
29901,
13,
1678,
363,
1667,
29918,
5696,
297,
1900,
29918,
7529,
29961,
3416,
5387,
13,
4706,
363,
1196,
29918,
4478,
297,
1900,
29918,
7529,
29961,
3416,
3816,
3396,
29918,
5696,
5387,
13,
9651,
1121,
353,
1065,
29918,
650,
29898,
13,
18884,
3646,
29918,
2220,
29918,
8977,
29961,
3416,
1402,
13,
18884,
1667,
29918,
5696,
29918,
8977,
29961,
3396,
29918,
5696,
1402,
13,
18884,
1196,
29918,
4478,
29918,
8977,
29961,
1220,
29918,
4478,
1402,
13,
18884,
1900,
29918,
7529,
29961,
3416,
3816,
3396,
29918,
5696,
3816,
1220,
29918,
4478,
22322,
7529,
7464,
13,
18884,
1900,
29918,
7529,
29961,
3416,
3816,
3396,
29918,
5696,
3816,
1220,
29918,
4478,
22322,
3137,
29918,
7529,
7464,
13,
9651,
1723,
13,
9651,
4660,
353,
1121,
1839,
4882,
2033,
13,
9651,
1596,
29898,
29888,
29908,
29912,
4882,
6177,
426,
3416,
29087,
3396,
29918,
5696,
29087,
1220,
29918,
4478,
27195,
13,
2
] |
qaHelper/fetcher/qhDataStructFactory.py | pchaos/quanttesting | 5 | 69416 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""QA_Struture工厂模式
"""
import pandas as pd
from QUANTAXIS.QAData.QADataStruct import QA_DataStruct_Index_day, QA_DataStruct_Index_min
from QUANTAXIS.QAData.QADataStruct import QA_DataStruct_Stock_day, QA_DataStruct_Stock_min
from QUANTAXIS.QAData.QADataStruct import QA_DataStruct_Future_day, QA_DataStruct_Future_min
from QUANTAXIS.QAUtil import DATABASE
class QhDataStructFactory(object):
"""QA_DataStruct工厂类
"""
def __init__(self, frequence=9, type='stock'):
"""
Args:
frequence: 周期
type: ‘stock’:股票
‘index’:指数或etf
‘future’:期货
‘auto’:自动识别
"""
if type == 'stock':
if 5 <= frequence != 8:
# 日线以上周期
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Stock_day(df, dtype=type,
if_fq=if_fq)
else:
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Stock_min(df, dtype=type,
if_fq=if_fq)
elif type == 'index':
if 5 <= frequence != 8:
# 日线以上周期
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Index_day(df, dtype=type,
if_fq=if_fq)
else:
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Index_min(df, dtype=type,
if_fq=if_fq)
elif type == 'future':
if 5 <= frequence != 8:
# 日线以上周期
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Future_day(df, dtype=type,
if_fq=if_fq)
else:
self._dataStruct = lambda df, dtype=type, if_fq='bfq': QA_DataStruct_Future_min(df, dtype=type,
if_fq=if_fq)
else:
raise Exception("不支持的类型")
def dataStruct(self, df: pd.DataFrame, if_fq='bfq'):
"""返回QA_Struture结构数据
Args:
df: pd.DataFrame格式数据 。
Returns:
"""
if df is not None and len(df.index.names) == 1:
if df['date'].dtype != 'datetime64':
df['date'] = pd.to_datetime(df['date'])
# 设置index
df = df.set_index(['date', 'code'], drop=True)
return self._dataStruct(df)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
29984,
29909,
29918,
5015,
9130,
31041,
232,
145,
133,
31382,
30607,
13,
13,
15945,
29908,
13,
13,
5215,
11701,
408,
10518,
13,
3166,
660,
29965,
2190,
6040,
29990,
3235,
29889,
29984,
29909,
1469,
29889,
29984,
29909,
1469,
19560,
1053,
660,
29909,
29918,
1469,
19560,
29918,
3220,
29918,
3250,
29892,
660,
29909,
29918,
1469,
19560,
29918,
3220,
29918,
1195,
13,
3166,
660,
29965,
2190,
6040,
29990,
3235,
29889,
29984,
29909,
1469,
29889,
29984,
29909,
1469,
19560,
1053,
660,
29909,
29918,
1469,
19560,
29918,
20754,
384,
29918,
3250,
29892,
660,
29909,
29918,
1469,
19560,
29918,
20754,
384,
29918,
1195,
13,
3166,
660,
29965,
2190,
6040,
29990,
3235,
29889,
29984,
29909,
1469,
29889,
29984,
29909,
1469,
19560,
1053,
660,
29909,
29918,
1469,
19560,
29918,
20154,
29918,
3250,
29892,
660,
29909,
29918,
1469,
19560,
29918,
20154,
29918,
1195,
13,
3166,
660,
29965,
2190,
6040,
29990,
3235,
29889,
29984,
29909,
7270,
1053,
27640,
27982,
13,
13,
13,
1990,
660,
29882,
1469,
19560,
5126,
29898,
3318,
1125,
13,
1678,
9995,
29984,
29909,
29918,
1469,
19560,
31041,
232,
145,
133,
30832,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3005,
3910,
29922,
29929,
29892,
1134,
2433,
17712,
29374,
13,
4706,
9995,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
3005,
3910,
29901,
29871,
31109,
31117,
13,
9651,
1134,
29901,
5129,
17712,
30010,
30383,
235,
133,
164,
234,
168,
171,
13,
18884,
5129,
2248,
30010,
30383,
31084,
30354,
31391,
300,
29888,
13,
18884,
5129,
29888,
9130,
30010,
30383,
31117,
235,
183,
170,
13,
18884,
5129,
6921,
30010,
30383,
30688,
30846,
235,
178,
137,
232,
139,
174,
13,
4706,
9995,
13,
4706,
565,
1134,
1275,
525,
17712,
2396,
13,
9651,
565,
29871,
29945,
5277,
3005,
3910,
2804,
29871,
29947,
29901,
13,
18884,
396,
29871,
30325,
31532,
30651,
30429,
31109,
31117,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
20754,
384,
29918,
3250,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
1669,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
9651,
1683,
29901,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
20754,
384,
29918,
1195,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
1669,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
4706,
25342,
1134,
1275,
525,
2248,
2396,
13,
9651,
565,
29871,
29945,
5277,
3005,
3910,
2804,
29871,
29947,
29901,
13,
18884,
396,
29871,
30325,
31532,
30651,
30429,
31109,
31117,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
3220,
29918,
3250,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
1669,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
9651,
1683,
29901,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
3220,
29918,
1195,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
1669,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
4706,
25342,
1134,
1275,
525,
29888,
9130,
2396,
13,
9651,
565,
29871,
29945,
5277,
3005,
3910,
2804,
29871,
29947,
29901,
13,
18884,
396,
29871,
30325,
31532,
30651,
30429,
31109,
31117,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
20154,
29918,
3250,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
18884,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
9651,
1683,
29901,
13,
18884,
1583,
3032,
1272,
19560,
353,
14013,
4489,
29892,
26688,
29922,
1853,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
2396,
660,
29909,
29918,
1469,
19560,
29918,
20154,
29918,
1195,
29898,
2176,
29892,
26688,
29922,
1853,
29892,
13,
462,
462,
462,
462,
462,
18884,
565,
29918,
29888,
29939,
29922,
361,
29918,
29888,
29939,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
8960,
703,
30413,
31541,
31695,
30210,
30832,
30883,
1159,
13,
13,
1678,
822,
848,
19560,
29898,
1311,
29892,
4489,
29901,
10518,
29889,
17271,
29892,
565,
29918,
29888,
29939,
2433,
1635,
29939,
29374,
13,
4706,
9995,
31086,
30742,
29984,
29909,
29918,
5015,
9130,
31320,
31901,
30354,
30763,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
4489,
29901,
10518,
29889,
17271,
31168,
30607,
30354,
30763,
29871,
30267,
13,
13,
4706,
16969,
29901,
13,
13,
4706,
9995,
13,
4706,
565,
4489,
338,
451,
6213,
322,
7431,
29898,
2176,
29889,
2248,
29889,
7039,
29897,
1275,
29871,
29896,
29901,
13,
9651,
565,
4489,
1839,
1256,
13359,
29881,
1853,
2804,
525,
12673,
29953,
29946,
2396,
13,
18884,
4489,
1839,
1256,
2033,
353,
10518,
29889,
517,
29918,
12673,
29898,
2176,
1839,
1256,
11287,
13,
9651,
396,
29871,
30872,
30669,
2248,
13,
9651,
4489,
353,
4489,
29889,
842,
29918,
2248,
18959,
1256,
742,
525,
401,
7464,
5768,
29922,
5574,
29897,
13,
4706,
736,
1583,
3032,
1272,
19560,
29898,
2176,
29897,
13,
2
] |
Examples/MFP_figlet_fonts.py | Shoeboxam/Neural_Network | 3 | 171367 | <gh_stars>1-10
import numpy as np
import pyfiglet
from MFP import *
# Two learning modes:
# 1. Autoencoder for font denoising
# 2. Classifier for character identification
""" #######
# # #### # ###### #####
# # # # # # #
##### # # # ##### #
# # # ### # # #
# # # # # # #
# # #### ###### ###### # """
# http://www.figlet.org/
class FigletFonts:
def __init__(self, font='banner', noise=0., autoencoder=False, ascii_vals=None):
self.noise = noise
self.autoencoder = autoencoder
self.stimuli = []
self.character_set = set()
self.max_width = 0
if not ascii_vals:
ascii_vals = [i for i in range(32, 127)]
self.ascii_vals = ascii_vals
# Initial pass to determine letter width
for letter in ascii_vals:
raw = pyfiglet.figlet_format(chr(letter), font=font)
width = len(raw.splitlines()[0])
self.max_width = self.max_width if self.max_width > width else width
numerical = []
for line in raw.splitlines():
numerical.append([ord(cha) for cha in line])
processed = np.array(numerical)
self.character_set.update(np.unique(processed))
self.stimuli.append(np.array(processed))
self.character_set = {idx: char for idx, char in enumerate(self.character_set)}
# Convert stimuli to padded categorical flattened arrays
for idx in range(len(self.stimuli)):
for classidx, char_class in self.character_set.items():
self.stimuli[idx][np.where(self.stimuli[idx] == char_class)] = classidx
self.stimuli[idx] = np.pad(self.stimuli[idx], ((0, 0), (0, self.max_width - self.stimuli[idx].shape[1])), 'constant')
self.stimuli[idx] = self.stimuli[idx].flatten()
self.stimuli = np.array(self.stimuli)
self.expected = np.eye(len(ascii_vals))
def sample(self, quantity=1):
x = np.random.randint(len(self.ascii_vals), size=quantity)
if self.noise:
generated_noise = np.random.normal(0., scale=len(self.character_set) // 2, size=self.stimuli[x].shape).astype(int)
mask = np.random.binomial(1, self.noise, size=self.stimuli[x].shape)
stimuli = np.mod(self.stimuli[x] + generated_noise * mask, len(self.character_set))
else:
stimuli = self.stimuli[x]
if self.autoencoder:
return [stimuli.T, self.stimuli[x].T]
else:
return [stimuli.T, self.expected[x].T]
def survey(self, quantity=None):
if not quantity:
quantity = len(self.ascii_vals)
# x = np.linspace(0, len(self.ascii_vals) - 1, quantity).astype(int) # Size changes error granularity
x = np.random.randint(len(self.ascii_vals), size=quantity)
if self.noise:
generated_noise = np.random.normal(0., scale=len(self.character_set) // 2, size=self.stimuli[x].shape).astype(int)
mask = np.random.binomial(1, self.noise, size=self.stimuli[x].shape)
stimuli = np.mod(self.stimuli[x] + generated_noise * mask, len(self.character_set))
else:
stimuli = self.stimuli[x]
print(self.reformat(stimuli))
if self.autoencoder:
return [stimuli.T, self.stimuli[x].T]
else:
return [stimuli.T, self.expected[x].T]
def size_input(self):
return np.size(self.stimuli[0])
def size_output(self):
if self.autoencoder:
return np.size(self.stimuli[0])
else:
return np.size(self.expected[0])
def plot(self, plt, predict):
# Do not attempt to plot an image
pass
def error(self, expect, predict):
if self.autoencoder:
x = np.random.randint(0, expect.shape[1])
print(self.reformat(predict[:, x]))
print(self.reformat(expect[:, x]))
return np.linalg.norm(expect - predict)
predict_id = np.argmax(predict, axis=0)
expect_id = np.argmax(expect, axis=0)
return int((1.0 - np.mean((predict_id == expect_id).astype(float))) * 100)
def reformat(self, data):
data = np.round(np.clip(data.reshape((-1, self.max_width)), 0, len(self.character_set) - 1)).astype(int)
ascii_valued = np.zeros(data.shape)
for classidx, char_class in self.character_set.items():
ascii_valued[np.where(data == classidx)] = char_class
output = ''
for line in ascii_valued:
output += ''.join([chr(int(round(symbol))) for symbol in line]) + '\n'
return output
ascii_vals = [i for i in range(33, 126)]
environment = FigletFonts('banner3', noise=0.2, autoencoder=True, ascii_vals=ascii_vals)
# ~~~ Create the network ~~~
network_params = {
# Shape of network
"units": [environment.size_input(), 100, environment.size_output()],
# Basis function(s) from network's Function.py
"basis": basis_bent,
"basis_final": basis_logistic,
# Distribution to use for weight initialization
"distribute": dist_normal
}
network = MFP(**network_params)
# ~~~ Train the network ~~~
optimizer_params = {
# Source of stimuli
"batch_size": 10,
"cost": cost_cross_entropy,
"normalize": False,
# Learning rate
"learn_step": 0.01,
"learn_anneal": anneal_fixed,
# "batch_norm_step": 0.0001,
"batch_norm_decay": 0.0,
"epsilon": 0.0, # error allowance
"iteration_limit": None, # limit on number of iterations to run
"debug_frequency": 10,
"debug_count": 1,
"debug": True,
"graph": True
}
Adagrad(network, environment, **optimizer_params).minimize()
# ~~~ Test the network ~~~
[stimuli, expectation] = environment.survey()
# print(network.predict(stimuli))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
12655,
408,
7442,
13,
5215,
11451,
1003,
1026,
13,
13,
3166,
341,
26353,
1053,
334,
13,
13,
29937,
7803,
6509,
18893,
29901,
13,
29937,
1678,
29896,
29889,
11133,
3977,
6119,
363,
4079,
972,
29877,
5921,
13,
29937,
1678,
29906,
29889,
4134,
3709,
363,
2931,
29769,
13,
13,
15945,
29908,
268,
835,
4136,
13,
4706,
396,
539,
396,
29871,
3191,
29871,
396,
418,
16101,
29937,
16101,
13,
4706,
396,
539,
396,
396,
1678,
396,
396,
418,
396,
4706,
396,
13,
4706,
16101,
259,
396,
396,
418,
396,
418,
16101,
1678,
396,
13,
4706,
396,
539,
396,
396,
29871,
835,
396,
418,
396,
4706,
396,
13,
4706,
396,
539,
396,
396,
1678,
396,
396,
418,
396,
4706,
396,
13,
4706,
396,
539,
396,
29871,
3191,
29871,
16101,
29937,
16101,
29937,
259,
396,
418,
9995,
13,
13,
29937,
1732,
597,
1636,
29889,
1003,
1026,
29889,
990,
29914,
13,
13,
13,
1990,
5104,
1026,
9824,
29879,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4079,
2433,
29890,
7310,
742,
11462,
29922,
29900,
1696,
4469,
3977,
6119,
29922,
8824,
29892,
408,
18869,
29918,
791,
29879,
29922,
8516,
1125,
13,
4706,
1583,
29889,
1217,
895,
353,
11462,
13,
4706,
1583,
29889,
6921,
3977,
6119,
353,
4469,
3977,
6119,
13,
13,
4706,
1583,
29889,
303,
326,
14549,
353,
5159,
13,
4706,
1583,
29889,
18609,
29918,
842,
353,
731,
580,
13,
13,
4706,
1583,
29889,
3317,
29918,
2103,
353,
29871,
29900,
13,
13,
4706,
565,
451,
408,
18869,
29918,
791,
29879,
29901,
13,
9651,
408,
18869,
29918,
791,
29879,
353,
518,
29875,
363,
474,
297,
3464,
29898,
29941,
29906,
29892,
29871,
29896,
29906,
29955,
4638,
13,
4706,
1583,
29889,
294,
18869,
29918,
791,
29879,
353,
408,
18869,
29918,
791,
29879,
13,
13,
4706,
396,
17250,
1209,
304,
8161,
5497,
2920,
13,
4706,
363,
5497,
297,
408,
18869,
29918,
791,
29879,
29901,
13,
9651,
10650,
353,
11451,
1003,
1026,
29889,
1003,
1026,
29918,
4830,
29898,
22495,
29898,
15670,
511,
4079,
29922,
5657,
29897,
13,
13,
9651,
2920,
353,
7431,
29898,
1610,
29889,
5451,
9012,
580,
29961,
29900,
2314,
13,
9651,
1583,
29889,
3317,
29918,
2103,
353,
1583,
29889,
3317,
29918,
2103,
565,
1583,
29889,
3317,
29918,
2103,
1405,
2920,
1683,
2920,
13,
13,
9651,
16259,
353,
5159,
13,
9651,
363,
1196,
297,
10650,
29889,
5451,
9012,
7295,
13,
18884,
16259,
29889,
4397,
4197,
536,
29898,
5815,
29897,
363,
10329,
297,
1196,
2314,
13,
13,
9651,
19356,
353,
7442,
29889,
2378,
29898,
8058,
936,
29897,
13,
9651,
1583,
29889,
18609,
29918,
842,
29889,
5504,
29898,
9302,
29889,
13092,
29898,
5014,
287,
876,
13,
9651,
1583,
29889,
303,
326,
14549,
29889,
4397,
29898,
9302,
29889,
2378,
29898,
5014,
287,
876,
13,
13,
4706,
1583,
29889,
18609,
29918,
842,
353,
426,
13140,
29901,
1373,
363,
22645,
29892,
1373,
297,
26985,
29898,
1311,
29889,
18609,
29918,
842,
2915,
13,
13,
4706,
396,
14806,
20436,
14549,
304,
282,
23959,
11608,
936,
1652,
8606,
287,
7049,
13,
4706,
363,
22645,
297,
3464,
29898,
2435,
29898,
1311,
29889,
303,
326,
14549,
22164,
13,
9651,
363,
770,
13140,
29892,
1373,
29918,
1990,
297,
1583,
29889,
18609,
29918,
842,
29889,
7076,
7295,
13,
18884,
1583,
29889,
303,
326,
14549,
29961,
13140,
3816,
9302,
29889,
3062,
29898,
1311,
29889,
303,
326,
14549,
29961,
13140,
29962,
1275,
1373,
29918,
1990,
4638,
353,
770,
13140,
13,
13,
9651,
1583,
29889,
303,
326,
14549,
29961,
13140,
29962,
353,
7442,
29889,
8305,
29898,
1311,
29889,
303,
326,
14549,
29961,
13140,
1402,
5135,
29900,
29892,
29871,
29900,
511,
313,
29900,
29892,
1583,
29889,
3317,
29918,
2103,
448,
1583,
29889,
303,
326,
14549,
29961,
13140,
1822,
12181,
29961,
29896,
2314,
511,
525,
23362,
1495,
13,
9651,
1583,
29889,
303,
326,
14549,
29961,
13140,
29962,
353,
1583,
29889,
303,
326,
14549,
29961,
13140,
1822,
1579,
8606,
580,
13,
13,
4706,
1583,
29889,
303,
326,
14549,
353,
7442,
29889,
2378,
29898,
1311,
29889,
303,
326,
14549,
29897,
13,
4706,
1583,
29889,
9684,
353,
7442,
29889,
1032,
29872,
29898,
2435,
29898,
294,
18869,
29918,
791,
29879,
876,
13,
13,
1678,
822,
4559,
29898,
1311,
29892,
14728,
29922,
29896,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
2435,
29898,
1311,
29889,
294,
18869,
29918,
791,
29879,
511,
2159,
29922,
22640,
29897,
13,
13,
4706,
565,
1583,
29889,
1217,
895,
29901,
13,
9651,
5759,
29918,
1217,
895,
353,
7442,
29889,
8172,
29889,
8945,
29898,
29900,
1696,
6287,
29922,
2435,
29898,
1311,
29889,
18609,
29918,
842,
29897,
849,
29871,
29906,
29892,
2159,
29922,
1311,
29889,
303,
326,
14549,
29961,
29916,
1822,
12181,
467,
579,
668,
29898,
524,
29897,
13,
9651,
11105,
353,
7442,
29889,
8172,
29889,
2109,
7615,
29898,
29896,
29892,
1583,
29889,
1217,
895,
29892,
2159,
29922,
1311,
29889,
303,
326,
14549,
29961,
29916,
1822,
12181,
29897,
13,
9651,
20436,
14549,
353,
7442,
29889,
1545,
29898,
1311,
29889,
303,
326,
14549,
29961,
29916,
29962,
718,
5759,
29918,
1217,
895,
334,
11105,
29892,
7431,
29898,
1311,
29889,
18609,
29918,
842,
876,
13,
4706,
1683,
29901,
13,
9651,
20436,
14549,
353,
1583,
29889,
303,
326,
14549,
29961,
29916,
29962,
13,
13,
4706,
565,
1583,
29889,
6921,
3977,
6119,
29901,
13,
9651,
736,
518,
303,
326,
14549,
29889,
29911,
29892,
1583,
29889,
303,
326,
14549,
29961,
29916,
1822,
29911,
29962,
13,
4706,
1683,
29901,
13,
9651,
736,
518,
303,
326,
14549,
29889,
29911,
29892,
1583,
29889,
9684,
29961,
29916,
1822,
29911,
29962,
13,
13,
1678,
822,
18994,
29898,
1311,
29892,
14728,
29922,
8516,
1125,
13,
4706,
565,
451,
14728,
29901,
13,
9651,
14728,
353,
7431,
29898,
1311,
29889,
294,
18869,
29918,
791,
29879,
29897,
13,
4706,
396,
921,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
7431,
29898,
1311,
29889,
294,
18869,
29918,
791,
29879,
29897,
448,
29871,
29896,
29892,
14728,
467,
579,
668,
29898,
524,
29897,
29871,
396,
21179,
3620,
1059,
3803,
1070,
537,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
2435,
29898,
1311,
29889,
294,
18869,
29918,
791,
29879,
511,
2159,
29922,
22640,
29897,
13,
13,
4706,
565,
1583,
29889,
1217,
895,
29901,
13,
9651,
5759,
29918,
1217,
895,
353,
7442,
29889,
8172,
29889,
8945,
29898,
29900,
1696,
6287,
29922,
2435,
29898,
1311,
29889,
18609,
29918,
842,
29897,
849,
29871,
29906,
29892,
2159,
29922,
1311,
29889,
303,
326,
14549,
29961,
29916,
1822,
12181,
467,
579,
668,
29898,
524,
29897,
13,
9651,
11105,
353,
7442,
29889,
8172,
29889,
2109,
7615,
29898,
29896,
29892,
1583,
29889,
1217,
895,
29892,
2159,
29922,
1311,
29889,
303,
326,
14549,
29961,
29916,
1822,
12181,
29897,
13,
9651,
20436,
14549,
353,
7442,
29889,
1545,
29898,
1311,
29889,
303,
326,
14549,
29961,
29916,
29962,
718,
5759,
29918,
1217,
895,
334,
11105,
29892,
7431,
29898,
1311,
29889,
18609,
29918,
842,
876,
13,
4706,
1683,
29901,
13,
9651,
20436,
14549,
353,
1583,
29889,
303,
326,
14549,
29961,
29916,
29962,
13,
13,
4706,
1596,
29898,
1311,
29889,
276,
4830,
29898,
303,
326,
14549,
876,
13,
13,
4706,
565,
1583,
29889,
6921,
3977,
6119,
29901,
13,
9651,
736,
518,
303,
326,
14549,
29889,
29911,
29892,
1583,
29889,
303,
326,
14549,
29961,
29916,
1822,
29911,
29962,
13,
4706,
1683,
29901,
13,
9651,
736,
518,
303,
326,
14549,
29889,
29911,
29892,
1583,
29889,
9684,
29961,
29916,
1822,
29911,
29962,
13,
13,
1678,
822,
2159,
29918,
2080,
29898,
1311,
1125,
13,
4706,
736,
7442,
29889,
2311,
29898,
1311,
29889,
303,
326,
14549,
29961,
29900,
2314,
13,
13,
1678,
822,
2159,
29918,
4905,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
6921,
3977,
6119,
29901,
13,
9651,
736,
7442,
29889,
2311,
29898,
1311,
29889,
303,
326,
14549,
29961,
29900,
2314,
13,
4706,
1683,
29901,
13,
9651,
736,
7442,
29889,
2311,
29898,
1311,
29889,
9684,
29961,
29900,
2314,
13,
13,
1678,
822,
6492,
29898,
1311,
29892,
14770,
29892,
8500,
1125,
13,
4706,
396,
1938,
451,
4218,
304,
6492,
385,
1967,
13,
4706,
1209,
13,
13,
1678,
822,
1059,
29898,
1311,
29892,
2149,
29892,
8500,
1125,
13,
4706,
565,
1583,
29889,
6921,
3977,
6119,
29901,
13,
9651,
921,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
2149,
29889,
12181,
29961,
29896,
2314,
13,
9651,
1596,
29898,
1311,
29889,
276,
4830,
29898,
27711,
7503,
29892,
921,
12622,
13,
9651,
1596,
29898,
1311,
29889,
276,
4830,
29898,
17854,
7503,
29892,
921,
12622,
13,
9651,
736,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
17854,
448,
8500,
29897,
13,
13,
4706,
8500,
29918,
333,
353,
7442,
29889,
1191,
3317,
29898,
27711,
29892,
9685,
29922,
29900,
29897,
13,
4706,
2149,
29918,
333,
353,
7442,
29889,
1191,
3317,
29898,
17854,
29892,
9685,
29922,
29900,
29897,
13,
13,
4706,
736,
938,
3552,
29896,
29889,
29900,
448,
7442,
29889,
12676,
3552,
27711,
29918,
333,
1275,
2149,
29918,
333,
467,
579,
668,
29898,
7411,
4961,
334,
29871,
29896,
29900,
29900,
29897,
13,
13,
1678,
822,
337,
4830,
29898,
1311,
29892,
848,
1125,
13,
4706,
848,
353,
7442,
29889,
14486,
29898,
9302,
29889,
24049,
29898,
1272,
29889,
690,
14443,
3552,
29899,
29896,
29892,
1583,
29889,
3317,
29918,
2103,
8243,
29871,
29900,
29892,
7431,
29898,
1311,
29889,
18609,
29918,
842,
29897,
448,
29871,
29896,
8106,
579,
668,
29898,
524,
29897,
13,
4706,
408,
18869,
29918,
4387,
287,
353,
7442,
29889,
3298,
359,
29898,
1272,
29889,
12181,
29897,
13,
4706,
363,
770,
13140,
29892,
1373,
29918,
1990,
297,
1583,
29889,
18609,
29918,
842,
29889,
7076,
7295,
13,
9651,
408,
18869,
29918,
4387,
287,
29961,
9302,
29889,
3062,
29898,
1272,
1275,
770,
13140,
4638,
353,
1373,
29918,
1990,
13,
13,
4706,
1962,
353,
6629,
13,
4706,
363,
1196,
297,
408,
18869,
29918,
4387,
287,
29901,
13,
9651,
1962,
4619,
525,
4286,
7122,
4197,
22495,
29898,
524,
29898,
14486,
29898,
18098,
4961,
363,
5829,
297,
1196,
2314,
718,
11297,
29876,
29915,
13,
4706,
736,
1962,
13,
13,
13,
294,
18869,
29918,
791,
29879,
353,
518,
29875,
363,
474,
297,
3464,
29898,
29941,
29941,
29892,
29871,
29896,
29906,
29953,
4638,
13,
20944,
353,
5104,
1026,
9824,
29879,
877,
29890,
7310,
29941,
742,
11462,
29922,
29900,
29889,
29906,
29892,
4469,
3977,
6119,
29922,
5574,
29892,
408,
18869,
29918,
791,
29879,
29922,
294,
18869,
29918,
791,
29879,
29897,
13,
13,
29937,
3695,
7377,
6204,
278,
3564,
3695,
7377,
13,
11618,
29918,
7529,
353,
426,
13,
1678,
396,
1383,
4085,
310,
3564,
13,
1678,
376,
348,
1169,
1115,
518,
20944,
29889,
2311,
29918,
2080,
3285,
29871,
29896,
29900,
29900,
29892,
5177,
29889,
2311,
29918,
4905,
580,
1402,
13,
13,
1678,
396,
4886,
275,
740,
29898,
29879,
29897,
515,
3564,
29915,
29879,
6680,
29889,
2272,
13,
1678,
376,
6500,
275,
1115,
8405,
29918,
29890,
296,
29892,
13,
1678,
376,
6500,
275,
29918,
8394,
1115,
8405,
29918,
1188,
4695,
29892,
13,
13,
1678,
396,
17740,
304,
671,
363,
7688,
17865,
13,
1678,
376,
5721,
2666,
1115,
1320,
29918,
8945,
13,
1678,
500,
13,
13,
11618,
353,
341,
26353,
29898,
1068,
11618,
29918,
7529,
29897,
13,
13,
29937,
3695,
7377,
28186,
278,
3564,
3695,
7377,
13,
20640,
3950,
29918,
7529,
353,
426,
13,
1678,
396,
7562,
310,
20436,
14549,
13,
1678,
376,
16175,
29918,
2311,
1115,
29871,
29896,
29900,
29892,
13,
13,
1678,
376,
18253,
1115,
3438,
29918,
19128,
29918,
296,
14441,
29892,
13,
1678,
376,
8945,
675,
1115,
7700,
29892,
13,
13,
1678,
396,
29257,
6554,
13,
1678,
376,
19668,
29918,
10568,
1115,
29871,
29900,
29889,
29900,
29896,
29892,
13,
1678,
376,
19668,
29918,
11276,
284,
1115,
385,
484,
284,
29918,
20227,
29892,
13,
13,
1678,
396,
376,
16175,
29918,
12324,
29918,
10568,
1115,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
29892,
13,
1678,
376,
16175,
29918,
12324,
29918,
7099,
388,
1115,
29871,
29900,
29889,
29900,
29892,
13,
13,
1678,
376,
5463,
1115,
29871,
29900,
29889,
29900,
29892,
965,
396,
1059,
2758,
749,
13,
1678,
376,
1524,
362,
29918,
13400,
1115,
6213,
29892,
29871,
396,
4046,
373,
1353,
310,
24372,
304,
1065,
13,
13,
1678,
376,
8382,
29918,
10745,
23860,
1115,
29871,
29896,
29900,
29892,
13,
1678,
376,
8382,
29918,
2798,
1115,
29871,
29896,
29892,
13,
1678,
376,
8382,
1115,
5852,
29892,
13,
1678,
376,
4262,
1115,
5852,
13,
1678,
500,
13,
13,
3253,
351,
3665,
29898,
11618,
29892,
5177,
29892,
3579,
20640,
3950,
29918,
7529,
467,
1195,
326,
675,
580,
13,
13,
29937,
3695,
7377,
4321,
278,
3564,
3695,
7377,
13,
29961,
303,
326,
14549,
29892,
23227,
29962,
353,
5177,
29889,
7610,
6950,
580,
13,
13,
29937,
1596,
29898,
11618,
29889,
27711,
29898,
303,
326,
14549,
876,
13,
2
] |
src/stts.py | georgsp/mdmTerminal2 | 24 | 125928 | #!/usr/bin/env python3
import hashlib
import os
import os.path
import random
import threading
import time
import wave
import pyaudio
import lib.STT as STT
import lib.TTS as TTS
import lib.sr_wrapper as sr
import logger
import utils
from languages import F
from lib.audio_utils import StreamRecognition, StreamDetector
from owner import Owner
class TextToSpeech:
def __init__(self, cfg, log):
self._log = log
self.cfg = cfg
def tts(self, msg, realtime: bool = True):
if callable(msg):
# Audio already synthesized
return msg
return _TTSWorker(self.cfg, self._log, msg, realtime).get
class _TTSWorker(threading.Thread):
WAIT = 600
def __init__(self, cfg, log, msg, realtime):
super().__init__(name='TTSWorker')
self.cfg = cfg
self.log = log
self._msg = str(msg)
self._provider = msg.provider if isinstance(msg, utils.TextBox) else None
self._provider = self._provider or self.cfg.gts('providertts')
self._realtime = realtime
self._event = threading.Event()
self._buff_size = 1024
self._file_path, self._stream, self._ext = None, None, None
self._work_time = None
self._start_time = time.time()
self.start()
if not self.cfg.get('optimistic_nonblock_tts'):
self._wait()
def get(self):
self._wait()
self._unlock()
return self._file_path, self._stream, self._ext
def run(self):
if not TTS.support(self._provider) :
self.log(F('Неизвестный провайдер: {}', self._provider), logger.CRIT)
self._file_path = self.cfg.path['tts_error']
return self._unlock()
msg = F('{} за {}{}: {}', *self._generating(), self._file_path)
self.log(msg, logger.DEBUG if self._realtime else logger.INFO)
def _generating(self):
sha1 = hashlib.sha1(self._msg.encode()).hexdigest()
ext = 'opus' if self.cfg.yandex_api(self._provider) in (2, 3) else 'mp3'
find_part = ''.join(('_', sha1, '.'))
rname = find_part + ext
use_cache = self.cfg.gt('cache', 'tts_size', 50) > 0
msg_gen = '\'{}\' '.format(self._msg)
if self._realtime:
self.log('say {}'.format(msg_gen), logger.INFO)
msg_gen = ''
if use_cache and self._found_in_cache(find_part, ext):
self._unlock()
work_time = time.time() - self._start_time
action = F('{}найдено в кэше', msg_gen)
time_diff = ''
else:
if not use_cache and self._provider in ('rhvoice-rest', 'rhvoice'):
ext = 'wav'
self._buff_size *= 4
self._file_path = os.path.join(self.cfg.gt('cache', 'path'), self._provider + rname) if use_cache else \
'<{}><{}>'.format(sha1, ext)
self._tts_gen(self._file_path if use_cache else None, ext, self._msg)
self._unlock()
work_time = time.time() - self._start_time
action = F('{}сгенерированно {}', msg_gen, self._provider)
reply = utils.pretty_time(self._work_time)
diff = utils.pretty_time(work_time - self._work_time)
time_diff = ' [reply:{}, diff:{}]'.format(reply, diff)
return action, utils.pretty_time(work_time), time_diff
def _unlock(self):
if self._work_time is None:
self._work_time = time.time() - self._start_time
self._event.set()
def _wait(self):
self._event.wait(self.WAIT)
def _found_in_cache(self, rname: str, ext: str):
prov_priority = self.cfg.gt('cache', 'tts_priority', '')
self._file_path = None
if TTS.support(prov_priority): # Приоритет
self._file_path = self._file_check(prov_priority, rname, ext)
if not self._file_path and prov_priority != self._provider: # Обычная, второй раз не чекаем
self._file_path = self._file_check(self._provider, rname, ext)
if not self._file_path and prov_priority == '*': # Ищем всех
for key in TTS.PROVIDERS:
if key != self._provider:
self._file_path = self._file_check(key, rname, ext)
if self._file_path:
break
return self._file_path
def _file_check(self, prov, rname, ext):
if prov == 'yandex':
for ext_ in ('mp3', 'opus'):
file = os.path.join(self.cfg.gt('cache', 'path'), prov + rname + ext_)
if os.path.isfile(file):
return file
return None
file = os.path.join(self.cfg.gt('cache', 'path'), prov + rname + ext)
return file if os.path.isfile(file) else None
def _tts_gen(self, file, format_, msg: str):
key = None
sets = utils.rhvoice_rest_sets(self.cfg[self._provider]) if self._provider == 'rhvoice-rest' else {}
try:
key = self.cfg.key(self._provider, 'apikeytts')
tts = TTS.GetTTS(
self._provider,
text=msg,
buff_size=self._buff_size,
speaker=self.cfg.gt(self._provider, 'speaker'),
audio_format=format_,
key=key,
lang=self.cfg.tts_lang(self._provider),
emotion=self.cfg.gt(self._provider, 'emotion'),
url=self.cfg.gt(self._provider, 'server'),
sets=sets,
speed=self.cfg.gt(self._provider, 'speed'),
slow=self.cfg.gt(self._provider, 'slow'),
yandex_api=self.cfg.yandex_api(self._provider)
)
except Exception as e:
self._synthesis_error(key, e)
self._file_path = self.cfg.path['tts_error']
return
self._stream = utils.FakeFP()
write_to = [self._stream]
if file:
write_to.append(open(file, 'wb'))
self._ext = '.{}'.format(format_) if not file else None
self._unlock()
try:
tts.stream_to_fps(write_to)
except Exception as e:
self._synthesis_error(key, e)
for fp in write_to:
fp.close()
def _synthesis_error(self, key, e):
if not isinstance(e, RuntimeError):
e = utils.PrettyException(e)
self.log(F('Ошибка синтеза речи от {}, ключ \'{}\'. ({})', self._provider, utils.mask_off(key), e), logger.CRIT)
class SpeechToText:
def __init__(self, cfg, log, owner: Owner):
self.log = log
self.cfg = cfg
self.own = owner
self.sys_say = Phrases(log, cfg)
self._lock = threading.Lock()
self._work = True
self._start_stt_event = owner.registration('start_stt_event')
self._stop_stt_event = owner.registration('stop_stt_event')
try:
self.max_mic_index = len(sr.Microphone().list_microphone_names()) - 1
try:
with sr.Microphone(device_index=self.get_mic_index()) as _:
pass
except OSError as e:
if e.errno == -9996:
raise
except OSError as e:
self.log('Error get list microphones: {}'.format(e), logger.CRIT)
self.max_mic_index = -2
def reload(self):
self.sys_say = Phrases(self.log, self.cfg)
def start(self):
self._work = True
self.log('start.', logger.INFO)
self._select_sample_rate()
self._print_mic_info()
def stop(self):
self._work = False
self.log('stop.', logger.INFO)
def busy(self):
return self._lock.locked() and self._work
def listen(self, hello: str = '', deaf: bool = True, voice: bool = False) -> tuple:
msg, rms = '', None
if not self._work:
pass
elif self.max_mic_index != -2:
self._lock.acquire()
self._start_stt_event()
try:
msg, rms = self._listen_and_take(hello, deaf, voice)
finally:
self._stop_stt_event()
self._lock.release()
else:
msg = F('Микрофоны не найдены')
self.log(msg, logger.ERROR)
return msg, rms
def _listen_and_take(self, hello, deaf, voice) -> tuple:
ask_me_again = self.cfg.get_uint('ask_me_again')
msg, rms = self._listen(hello, voice)
again = msg is None and ask_me_again > 0
while again: # Переспрашиваем
self.own.ask_again_callback()
msg, rms = self._listen(self.sys_say.ask, False)
ask_me_again -= 1
again = msg is None and ask_me_again
if msg is None and deaf:
say = self.sys_say.deaf
if say:
self.own.say(say, blocking=120 if self.cfg.gts('blocking_listener') else 0)
return msg or '', rms
def get_mic_index(self):
device_index = self.cfg.gts('mic_index', -1)
if device_index > self.max_mic_index:
if self.max_mic_index >= 0:
mics = F('Доступны {}, от 0 до {}.', self.max_mic_index + 1, self.max_mic_index)
else:
mics = F('Микрофоны не найдены')
self.log(F('Не верный индекс микрофона {}. {}', device_index, mics), logger.WARN)
return None
return None if device_index < 0 else device_index
def _listen(self, hello: str, voice) -> tuple:
lvl = 5 # Включаем монопольный режим
commands = None
if self.cfg.gts('alarmkwactivated'):
self.own.play(self.cfg.path['ding'], lvl, blocking=2)
else:
self.own.set_lvl(lvl)
self.own.kill_popen()
self.log('audio devices: {}'.format(pyaudio.PyAudio().get_device_count() - 1), logger.DEBUG)
hello = hello or self.sys_say.hello
file_path = self.own.tts(hello) if not voice and hello else None
if self.cfg.gts('blocking_listener'):
audio, record_time, energy, rms = self._block_listen(hello, lvl, file_path)
else:
audio, record_time, energy, rms = self._non_block_listen(hello, lvl, file_path)
self.log(F('Голос записан за {}', utils.pretty_time(record_time)), logger.INFO)
# Выключаем монопольный режим
self.own.clear_lvl()
if self.cfg.gts('alarmstt'):
self.own.play(self.cfg.path['dong'])
if audio is not None:
commands = self.voice_recognition(audio)
if commands:
self.log(utils.recognition_msg(commands, energy, rms), logger.INFO)
return commands, rms
def _non_block_listen(self, hello, lvl, file_path):
max_play_time = 120 # максимальное время воспроизведения приветствия
max_wait_time = 10 # ожидание после приветствия
listener = self.own.background_listen()
start_wait = time.time()
if file_path:
self.own.say(file_path, lvl, False if hello else None, is_file=True)
elif self.cfg.gts('alarmtts') and not hello:
self.own.say(self.cfg.path['dong'], lvl, False, is_file=True)
# Начинаем фоновое распознавание голосом после того как запустился плей.
listener.start()
self.own.record_callback(True)
if file_path:
while listener.work() and self.own.really_busy() and \
time.time() - start_wait < max_play_time and self._work:
# Ждем пока время не выйдет, голос не распознался и файл играет
time.sleep(0.01)
self.own.quiet()
start_wait2 = time.time()
while listener.work() and time.time() - start_wait2 < max_wait_time and self._work:
# ждем еще секунд 10
time.sleep(0.01)
record_time = time.time() - start_wait
listener.stop()
self.own.record_callback(False)
return listener.audio, record_time, listener.energy_threshold, listener.rms
def _block_listen(self, hello, lvl, file_path, self_call=False):
r = sr.Recognizer(self.own.record_callback, self.cfg.gt('listener', 'silent_multiplier'))
mic = sr.Microphone(device_index=self.get_mic_index())
alarm = self.cfg.gts('alarmtts') and not hello
if alarm or file_path:
self.own.say_callback(True)
try:
if alarm:
self.own.play(self.cfg.path['dong'], lvl, blocking=2)
vad = self.own.get_vad_detector(mic)
if file_path:
self.own.play(file_path, lvl, blocking=120)
finally:
if alarm or file_path:
self.own.say_callback(False)
audio, record_time, energy_threshold, rms = self.own.listener_listen(r, mic, vad)
if record_time < 0.5 and not self_call:
# Если от инициализации микрофона до записи прошло больше 20-35 сек, то запись ломается
# Игнорируем полученную запись и запускаем новую, без приветствий
self.log('Long ask fix!', logger.DEBUG)
return self._block_listen(hello=True, lvl=lvl, file_path=None, self_call=True)
else:
return audio, record_time, energy_threshold, rms
def voice_record(self, hello: str or None, save_to: str, convert_rate=None, convert_width=None, limit=8):
if self.max_mic_index == -2:
self.log(F('Микрофоны не найдены'), logger.ERROR)
return F('Микрофоны не найдены')
self._lock.acquire()
self._start_stt_event()
try:
return self._voice_record(hello, save_to, convert_rate, convert_width, limit)
finally:
self.own.clear_lvl()
self._stop_stt_event()
self._lock.release()
def _voice_record(self, hello: str or None, save_to: str, convert_rate, convert_width, limit):
lvl = 5 # Включаем монопольный режим
if hello is not None:
self.own.say(self.own.tts(hello)(), lvl, True, is_file=True, blocking=120)
else:
self.own.set_lvl(lvl)
r = sr.Recognizer(record_callback=self.own.record_callback)
mic = sr.Microphone(device_index=self.get_mic_index())
vad = self.own.get_vad_detector(mic)
self.own.play(self.cfg.path['ding'], lvl, blocking=3)
with mic as source:
record_time = time.time()
try:
adata = r.listen1(source=source, vad=vad, timeout=5, phrase_time_limit=limit)
except sr.WaitTimeoutError as e:
return str(e)
if time.time() - record_time < 0.5:
return F('Во время записи произошел сбой, это нужно исправить')
try:
os.makedirs(os.path.dirname(save_to), exist_ok=True)
with open(save_to, "wb") as f:
f.write(adata.get_wav_data(convert_rate, convert_width))
except IOError as err:
return str(err)
else:
return None
def voice_recognition(self, audio, quiet: bool = False, fusion=None) -> str:
if (isinstance(audio, StreamRecognition) and fusion is None) or isinstance(audio, StreamDetector):
return audio.text
self.own.speech_recognized(True)
try:
return self._voice_recognition(audio, quiet, fusion)
finally:
self.own.speech_recognized(False)
def _voice_recognition(self, audio, quiet: bool = False, fusion=None, provider=None) -> utils.TextBox:
def say(text: str):
if not quiet:
self.own.say(text)
quiet = quiet or not self.cfg.gts('say_stt_error')
prov = provider or self.cfg.gts('providerstt', 'unset')
if not self.own.is_stt_provider(prov):
self.log(F('Ошибка распознавания - неизвестный провайдер {}', prov), logger.CRIT)
say(F('Ошибка распознавания - неизвестный провайдер {}', ''))
return utils.TextBox('', prov)
self.log(F('Для распознавания используем {}', prov), logger.DEBUG)
wtime = time.time()
key = None
try:
key = self.cfg.key(prov, 'apikeystt')
command = STT.GetSTT(
prov,
audio_data=audio,
key=key,
lang=self.cfg.stt_lang(prov),
url=self.cfg.gt(prov, 'server'),
yandex_api=self.cfg.yandex_api(prov),
grpc=self.cfg.gt(prov, 'grpc'),
).text()
except STT.UnknownValueError:
command = ''
except Exception as e:
say(F('Произошла ошибка распознавания'))
msg = 'Ошибка распознавания речи от {}, ключ \'{}\'. ({})'
if not isinstance(e, RuntimeError):
e = utils.PrettyException(e)
self.log(F(msg, prov, utils.mask_off(key), e), logger.ERROR)
return utils.TextBox('', prov)
if fusion:
wtime = fusion()
w_time = time.time() - wtime
self.log(F('Распознано за {}', utils.pretty_time(w_time)), logger.DEBUG)
return utils.TextBox(command or '', prov, w_time)
def phrase_from_files(self, files: list):
if not files:
return '', 0
workers = [RecognitionWorker(self._voice_recognition, file) for file in files]
result = [worker.get for worker in workers]
del workers
# Фраза с 50% + 1 побеждает
consensus = len(result) // 2 + 1
phrase = ''
match_count = 0
for say in result:
if not say:
continue
match_count = result.count(say)
if match_count >= consensus:
phrase = say
break
self.log(F('Распознано: {}. Консенсус: {}', ', '.join([str(x) for x in result]), phrase), logger.DEBUG)
return phrase, match_count
def multiple_recognition(self, file_or_adata, providers: list) -> list:
if not providers:
return []
adata = adata_from_file(file_or_adata)
workers = [RecognitionWorker(self._voice_recognition, adata, provider) for provider in providers]
return [worker.get for worker in workers]
def _print_mic_info(self):
if self.max_mic_index < 0:
return
index = self.cfg.gts('mic_index', -1)
name = sr.Microphone.get_microphone_name(index if index > -1 else None)
self.log('Microphone: "{}: {}"'.format(index if index > -1 else 'Default', name), logger.INFO)
def _select_sample_rate(self):
try:
self._sample_rate_tester()
except RuntimeError as e:
self.log(e, logger.CRIT)
time.sleep(0.2)
raise RuntimeError()
def _sample_rate_tester(self):
def tester():
rates = (32000, 8000, 48000, 44100, None)
if self.max_mic_index == -2:
return
if self._test_rate():
return
for rate in rates:
msg = 'Microphone does not support sample rate {}, fallback to {}'.format(
sr.Microphone.DEFAULT_RATE, rate)
self.log(msg, logger.WARN)
sr.Microphone.DEFAULT_RATE = rate
if self._test_rate():
return
raise RuntimeError('Microphone is broken. Supported sample rate not found')
try:
tester()
except RuntimeError as e:
self.max_mic_index = -2
self.log(e, logger.ERROR)
def _test_rate(self):
try:
with sr.Microphone(device_index=self.get_mic_index()) as _:
pass
except OSError as e:
if e.errno == -9997:
return False
raise RuntimeError('Microphone is broken: {}'.format(e))
else:
return True
class RecognitionWorker(threading.Thread):
def __init__(self, voice_recognition, file_or_adata, provider=None):
super().__init__()
self._voice_recognition = voice_recognition
self._file_or_adata = file_or_adata
self._provider = provider
self._result = utils.TextBox('', provider)
self.start()
def run(self):
self._result = self._voice_recognition(adata_from_file(self._file_or_adata), True, provider=self._provider)
@property
def get(self):
super().join()
return self._result
class Phrases:
def __init__(self, log, cfg):
name = 'phrases_{}'.format(cfg.language_name())
self._phrases = cfg.load_dict(name)
try:
utils.check_phrases(self._phrases)
except ValueError as e:
log('Error phrases loading, restore default phrases: {}'.format(e), logger.ERROR)
self._phrases = None
if not self._phrases:
self._phrases = {
'hello': [F('Привет'), F('Слушаю'), F('На связи'), F('Привет-Привет')],
'deaf': [F('Я ничего не услышала'), F('Вы ничего не сказали'), F('Ничего не слышно'), F('Не поняла')],
'ask': [F('Ничего не слышно, повторите ваш запрос')],
'chance': 25
}
cfg.save_dict(name, self._phrases, True)
@property
def hello(self) -> str:
return self._choice('hello')
@property
def deaf(self) -> str:
return self._choice('deaf')
@property
def ask(self) -> str:
return self._choice('ask')
@property
def chance(self) -> bool:
return random.SystemRandom().randint(1, 100) <= self._phrases['chance']
def _choice(self, name: str) -> str:
return random.SystemRandom().choice(self._phrases[name])
def adata_from_file(file_or_adata: str or sr.AudioData) -> sr.AudioData:
if isinstance(file_or_adata, sr.AudioData):
return file_or_adata
else:
with wave.open(file_or_adata, 'rb') as fp:
return sr.AudioData(fp.readframes(fp.getnframes()), fp.getframerate(), fp.getsampwidth())
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
6608,
1982,
13,
5215,
2897,
13,
5215,
2897,
29889,
2084,
13,
5215,
4036,
13,
5215,
3244,
292,
13,
5215,
931,
13,
5215,
10742,
13,
13,
5215,
282,
3761,
2881,
13,
13,
5215,
4303,
29889,
1254,
29911,
408,
6850,
29911,
13,
5215,
4303,
29889,
29911,
9375,
408,
323,
9375,
13,
5215,
4303,
29889,
21935,
29918,
17699,
408,
27236,
13,
5215,
17927,
13,
5215,
3667,
29879,
13,
3166,
10276,
1053,
383,
13,
3166,
4303,
29889,
18494,
29918,
13239,
1053,
13763,
23122,
654,
29892,
13763,
6362,
3019,
13,
3166,
12271,
1053,
438,
23007,
13,
13,
13,
1990,
3992,
1762,
10649,
5309,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
274,
16434,
29892,
1480,
1125,
13,
4706,
1583,
3032,
1188,
353,
1480,
13,
4706,
1583,
29889,
16859,
353,
274,
16434,
13,
13,
1678,
822,
260,
1372,
29898,
1311,
29892,
10191,
29892,
1855,
2230,
29901,
6120,
353,
5852,
1125,
13,
4706,
565,
1246,
519,
29898,
7645,
1125,
13,
9651,
396,
21764,
2307,
14710,
267,
1891,
13,
9651,
736,
10191,
13,
4706,
736,
903,
29911,
9375,
16164,
29898,
1311,
29889,
16859,
29892,
1583,
3032,
1188,
29892,
10191,
29892,
1855,
2230,
467,
657,
13,
13,
13,
1990,
903,
29911,
9375,
16164,
29898,
7097,
292,
29889,
4899,
1125,
13,
1678,
399,
29909,
1806,
353,
29871,
29953,
29900,
29900,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
274,
16434,
29892,
1480,
29892,
10191,
29892,
1855,
2230,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
978,
2433,
29911,
9375,
16164,
1495,
13,
4706,
1583,
29889,
16859,
353,
274,
16434,
13,
4706,
1583,
29889,
1188,
353,
1480,
13,
4706,
1583,
3032,
7645,
353,
851,
29898,
7645,
29897,
13,
4706,
1583,
3032,
18121,
353,
10191,
29889,
18121,
565,
338,
8758,
29898,
7645,
29892,
3667,
29879,
29889,
15102,
29897,
1683,
6213,
13,
4706,
1583,
3032,
18121,
353,
1583,
3032,
18121,
470,
1583,
29889,
16859,
29889,
29887,
1372,
877,
18121,
698,
29879,
1495,
13,
4706,
1583,
3032,
276,
1997,
603,
353,
1855,
2230,
13,
4706,
1583,
3032,
3696,
353,
3244,
292,
29889,
2624,
580,
13,
4706,
1583,
3032,
28040,
29918,
2311,
353,
29871,
29896,
29900,
29906,
29946,
13,
13,
4706,
1583,
3032,
1445,
29918,
2084,
29892,
1583,
3032,
5461,
29892,
1583,
3032,
1062,
353,
6213,
29892,
6213,
29892,
6213,
13,
13,
4706,
1583,
3032,
1287,
29918,
2230,
353,
6213,
13,
4706,
1583,
3032,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
1583,
29889,
2962,
580,
13,
13,
4706,
565,
451,
1583,
29889,
16859,
29889,
657,
877,
20640,
4695,
29918,
5464,
1271,
29918,
698,
29879,
29374,
13,
9651,
1583,
3032,
10685,
580,
13,
13,
1678,
822,
679,
29898,
1311,
1125,
13,
4706,
1583,
3032,
10685,
580,
13,
4706,
1583,
3032,
348,
908,
580,
13,
4706,
736,
1583,
3032,
1445,
29918,
2084,
29892,
1583,
3032,
5461,
29892,
1583,
3032,
1062,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
565,
451,
323,
9375,
29889,
5924,
29898,
1311,
3032,
18121,
29897,
584,
13,
9651,
1583,
29889,
1188,
29898,
29943,
877,
30029,
29919,
6531,
10411,
2370,
469,
4962,
29977,
6620,
29901,
6571,
742,
1583,
3032,
18121,
511,
17927,
29889,
11341,
1806,
29897,
13,
9651,
1583,
3032,
1445,
29918,
2084,
353,
1583,
29889,
16859,
29889,
2084,
1839,
698,
29879,
29918,
2704,
2033,
13,
9651,
736,
1583,
3032,
348,
908,
580,
13,
4706,
10191,
353,
383,
877,
8875,
1077,
426,
1157,
6177,
6571,
742,
334,
1311,
3032,
4738,
1218,
3285,
1583,
3032,
1445,
29918,
2084,
29897,
13,
4706,
1583,
29889,
1188,
29898,
7645,
29892,
17927,
29889,
18525,
565,
1583,
3032,
276,
1997,
603,
1683,
17927,
29889,
11690,
29897,
13,
13,
1678,
822,
903,
4738,
1218,
29898,
1311,
1125,
13,
4706,
528,
29874,
29896,
353,
6608,
1982,
29889,
17051,
29896,
29898,
1311,
3032,
7645,
29889,
12508,
16655,
20970,
7501,
342,
580,
13,
4706,
1294,
353,
525,
26466,
29915,
565,
1583,
29889,
16859,
29889,
10094,
1390,
29918,
2754,
29898,
1311,
3032,
18121,
29897,
297,
313,
29906,
29892,
29871,
29941,
29897,
1683,
525,
1526,
29941,
29915,
13,
4706,
1284,
29918,
1595,
353,
525,
4286,
7122,
29898,
877,
29918,
742,
528,
29874,
29896,
29892,
525,
6169,
876,
13,
4706,
364,
978,
353,
1284,
29918,
1595,
718,
1294,
13,
4706,
671,
29918,
8173,
353,
1583,
29889,
16859,
29889,
4141,
877,
8173,
742,
525,
698,
29879,
29918,
2311,
742,
29871,
29945,
29900,
29897,
1405,
29871,
29900,
13,
4706,
10191,
29918,
1885,
353,
11297,
29915,
29912,
1012,
29915,
15300,
4830,
29898,
1311,
3032,
7645,
29897,
13,
13,
4706,
565,
1583,
3032,
276,
1997,
603,
29901,
13,
9651,
1583,
29889,
1188,
877,
20834,
6571,
4286,
4830,
29898,
7645,
29918,
1885,
511,
17927,
29889,
11690,
29897,
13,
9651,
10191,
29918,
1885,
353,
6629,
13,
13,
4706,
565,
671,
29918,
8173,
322,
1583,
3032,
11940,
29918,
262,
29918,
8173,
29898,
2886,
29918,
1595,
29892,
1294,
1125,
13,
9651,
1583,
3032,
348,
908,
580,
13,
9651,
664,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1583,
3032,
2962,
29918,
2230,
13,
9651,
3158,
353,
383,
877,
8875,
477,
29977,
1216,
570,
490,
1186,
30051,
2237,
742,
10191,
29918,
1885,
29897,
13,
9651,
931,
29918,
12765,
353,
6629,
13,
4706,
1683,
29901,
13,
9651,
565,
451,
671,
29918,
8173,
322,
1583,
3032,
18121,
297,
6702,
19046,
14917,
29899,
5060,
742,
525,
19046,
14917,
29374,
13,
18884,
1294,
353,
525,
29893,
485,
29915,
13,
18884,
1583,
3032,
28040,
29918,
2311,
334,
29922,
29871,
29946,
13,
9651,
1583,
3032,
1445,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
16859,
29889,
4141,
877,
8173,
742,
525,
2084,
5477,
1583,
3032,
18121,
718,
364,
978,
29897,
565,
671,
29918,
8173,
1683,
320,
13,
18884,
12801,
8875,
5299,
8875,
29958,
4286,
4830,
29898,
17051,
29896,
29892,
1294,
29897,
13,
9651,
1583,
3032,
698,
29879,
29918,
1885,
29898,
1311,
3032,
1445,
29918,
2084,
565,
671,
29918,
8173,
1683,
6213,
29892,
1294,
29892,
1583,
3032,
7645,
29897,
13,
9651,
1583,
3032,
348,
908,
580,
13,
9651,
664,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1583,
3032,
2962,
29918,
2230,
13,
9651,
3158,
353,
383,
877,
8875,
29935,
29969,
5755,
641,
11866,
570,
6571,
742,
10191,
29918,
1885,
29892,
1583,
3032,
18121,
29897,
13,
9651,
8908,
353,
3667,
29879,
29889,
1457,
4349,
29918,
2230,
29898,
1311,
3032,
1287,
29918,
2230,
29897,
13,
9651,
2923,
353,
3667,
29879,
29889,
1457,
4349,
29918,
2230,
29898,
1287,
29918,
2230,
448,
1583,
3032,
1287,
29918,
2230,
29897,
13,
9651,
931,
29918,
12765,
353,
525,
518,
3445,
368,
26254,
1118,
2923,
26254,
6525,
4286,
4830,
29898,
3445,
368,
29892,
2923,
29897,
13,
4706,
736,
3158,
29892,
3667,
29879,
29889,
1457,
4349,
29918,
2230,
29898,
1287,
29918,
2230,
511,
931,
29918,
12765,
13,
13,
1678,
822,
903,
348,
908,
29898,
1311,
1125,
13,
4706,
565,
1583,
3032,
1287,
29918,
2230,
338,
6213,
29901,
13,
9651,
1583,
3032,
1287,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1583,
3032,
2962,
29918,
2230,
13,
4706,
1583,
3032,
3696,
29889,
842,
580,
13,
13,
1678,
822,
903,
10685,
29898,
1311,
1125,
13,
4706,
1583,
3032,
3696,
29889,
10685,
29898,
1311,
29889,
12982,
1806,
29897,
13,
13,
1678,
822,
903,
11940,
29918,
262,
29918,
8173,
29898,
1311,
29892,
364,
978,
29901,
851,
29892,
1294,
29901,
851,
1125,
13,
4706,
1326,
29918,
29886,
21766,
353,
1583,
29889,
16859,
29889,
4141,
877,
8173,
742,
525,
698,
29879,
29918,
29886,
21766,
742,
27255,
13,
4706,
1583,
3032,
1445,
29918,
2084,
353,
6213,
13,
4706,
565,
323,
9375,
29889,
5924,
29898,
16123,
29918,
29886,
21766,
1125,
29871,
396,
7203,
29904,
641,
13562,
13,
9651,
1583,
3032,
1445,
29918,
2084,
353,
1583,
3032,
1445,
29918,
3198,
29898,
16123,
29918,
29886,
21766,
29892,
364,
978,
29892,
1294,
29897,
13,
13,
4706,
565,
451,
1583,
3032,
1445,
29918,
2084,
322,
1326,
29918,
29886,
21766,
2804,
1583,
3032,
18121,
29901,
29871,
396,
1651,
6326,
23006,
29892,
27619,
3212,
1538,
2950,
642,
3098,
13,
9651,
1583,
3032,
1445,
29918,
2084,
353,
1583,
3032,
1445,
29918,
3198,
29898,
1311,
3032,
18121,
29892,
364,
978,
29892,
1294,
29897,
13,
13,
4706,
565,
451,
1583,
3032,
1445,
29918,
2084,
322,
1326,
29918,
29886,
21766,
1275,
525,
29930,
2396,
29871,
396,
2081,
2402,
29959,
23103,
13,
9651,
363,
1820,
297,
323,
9375,
29889,
8618,
13044,
23598,
29901,
13,
18884,
565,
1820,
2804,
1583,
3032,
18121,
29901,
13,
462,
1678,
1583,
3032,
1445,
29918,
2084,
353,
1583,
3032,
1445,
29918,
3198,
29898,
1989,
29892,
364,
978,
29892,
1294,
29897,
13,
18884,
565,
1583,
3032,
1445,
29918,
2084,
29901,
13,
462,
1678,
2867,
13,
4706,
736,
1583,
3032,
1445,
29918,
2084,
13,
13,
1678,
822,
903,
1445,
29918,
3198,
29898,
1311,
29892,
1326,
29892,
364,
978,
29892,
1294,
1125,
13,
4706,
565,
1326,
1275,
525,
10094,
1390,
2396,
13,
9651,
363,
1294,
29918,
297,
6702,
1526,
29941,
742,
525,
26466,
29374,
13,
18884,
934,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
16859,
29889,
4141,
877,
8173,
742,
525,
2084,
5477,
1326,
718,
364,
978,
718,
1294,
19925,
13,
18884,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
1445,
1125,
13,
462,
1678,
736,
934,
13,
9651,
736,
6213,
13,
4706,
934,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
16859,
29889,
4141,
877,
8173,
742,
525,
2084,
5477,
1326,
718,
364,
978,
718,
1294,
29897,
13,
4706,
736,
934,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
1445,
29897,
1683,
6213,
13,
13,
1678,
822,
903,
698,
29879,
29918,
1885,
29898,
1311,
29892,
934,
29892,
3402,
3383,
10191,
29901,
851,
1125,
13,
4706,
1820,
353,
6213,
13,
4706,
6166,
353,
3667,
29879,
29889,
19046,
14917,
29918,
5060,
29918,
7224,
29898,
1311,
29889,
16859,
29961,
1311,
3032,
18121,
2314,
565,
1583,
3032,
18121,
1275,
525,
19046,
14917,
29899,
5060,
29915,
1683,
6571,
13,
4706,
1018,
29901,
13,
9651,
1820,
353,
1583,
29889,
16859,
29889,
1989,
29898,
1311,
3032,
18121,
29892,
525,
2754,
1989,
698,
29879,
1495,
13,
9651,
260,
1372,
353,
323,
9375,
29889,
2577,
29911,
9375,
29898,
13,
18884,
1583,
3032,
18121,
29892,
13,
18884,
1426,
29922,
7645,
29892,
13,
18884,
20487,
29918,
2311,
29922,
1311,
3032,
28040,
29918,
2311,
29892,
13,
18884,
25657,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
1311,
3032,
18121,
29892,
525,
5965,
5790,
5477,
13,
18884,
10348,
29918,
4830,
29922,
4830,
3383,
13,
18884,
1820,
29922,
1989,
29892,
13,
18884,
6361,
29922,
1311,
29889,
16859,
29889,
698,
29879,
29918,
3893,
29898,
1311,
3032,
18121,
511,
13,
18884,
953,
8194,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
1311,
3032,
18121,
29892,
525,
331,
8194,
5477,
13,
18884,
3142,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
1311,
3032,
18121,
29892,
525,
2974,
5477,
13,
18884,
6166,
29922,
7224,
29892,
13,
18884,
6210,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
1311,
3032,
18121,
29892,
525,
19322,
5477,
13,
18884,
5232,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
1311,
3032,
18121,
29892,
525,
28544,
5477,
13,
18884,
343,
273,
1390,
29918,
2754,
29922,
1311,
29889,
16859,
29889,
10094,
1390,
29918,
2754,
29898,
1311,
3032,
18121,
29897,
13,
9651,
1723,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1583,
3032,
19274,
26533,
29918,
2704,
29898,
1989,
29892,
321,
29897,
13,
9651,
1583,
3032,
1445,
29918,
2084,
353,
1583,
29889,
16859,
29889,
2084,
1839,
698,
29879,
29918,
2704,
2033,
13,
9651,
736,
13,
13,
4706,
1583,
3032,
5461,
353,
3667,
29879,
29889,
29943,
1296,
26353,
580,
13,
4706,
2436,
29918,
517,
353,
518,
1311,
3032,
5461,
29962,
13,
4706,
565,
934,
29901,
13,
9651,
2436,
29918,
517,
29889,
4397,
29898,
3150,
29898,
1445,
29892,
525,
29893,
29890,
8785,
13,
4706,
1583,
3032,
1062,
353,
15300,
8875,
4286,
4830,
29898,
4830,
19925,
565,
451,
934,
1683,
6213,
13,
4706,
1583,
3032,
348,
908,
580,
13,
4706,
1018,
29901,
13,
9651,
260,
1372,
29889,
5461,
29918,
517,
29918,
29888,
567,
29898,
3539,
29918,
517,
29897,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1583,
3032,
19274,
26533,
29918,
2704,
29898,
1989,
29892,
321,
29897,
13,
4706,
363,
285,
29886,
297,
2436,
29918,
517,
29901,
13,
9651,
285,
29886,
29889,
5358,
580,
13,
13,
1678,
822,
903,
19274,
26533,
29918,
2704,
29898,
1311,
29892,
1820,
29892,
321,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
29872,
29892,
24875,
2392,
1125,
13,
9651,
321,
353,
3667,
29879,
29889,
6572,
4349,
2451,
29898,
29872,
29897,
13,
4706,
1583,
29889,
1188,
29898,
29943,
877,
30038,
1911,
23348,
24066,
730,
1902,
1909,
1499,
1685,
24335,
1186,
2583,
29981,
320,
29915,
29912,
1012,
4286,
21313,
1800,
742,
1583,
3032,
18121,
29892,
3667,
29879,
29889,
13168,
29918,
2696,
29898,
1989,
511,
321,
511,
17927,
29889,
11341,
1806,
29897,
13,
13,
13,
1990,
5013,
5309,
1762,
1626,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
274,
16434,
29892,
1480,
29892,
12271,
29901,
438,
23007,
1125,
13,
4706,
1583,
29889,
1188,
353,
1480,
13,
4706,
1583,
29889,
16859,
353,
274,
16434,
13,
4706,
1583,
29889,
776,
353,
12271,
13,
4706,
1583,
29889,
9675,
29918,
20834,
353,
349,
1092,
2129,
29898,
1188,
29892,
274,
16434,
29897,
13,
4706,
1583,
3032,
908,
353,
3244,
292,
29889,
16542,
580,
13,
4706,
1583,
3032,
1287,
353,
5852,
13,
4706,
1583,
3032,
2962,
29918,
303,
29873,
29918,
3696,
353,
12271,
29889,
1727,
8306,
877,
2962,
29918,
303,
29873,
29918,
3696,
1495,
13,
4706,
1583,
3032,
9847,
29918,
303,
29873,
29918,
3696,
353,
12271,
29889,
1727,
8306,
877,
9847,
29918,
303,
29873,
29918,
3696,
1495,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
353,
7431,
29898,
21935,
29889,
29924,
2357,
6710,
2141,
1761,
29918,
29885,
2357,
6710,
29918,
7039,
3101,
448,
29871,
29896,
13,
9651,
1018,
29901,
13,
18884,
411,
27236,
29889,
29924,
2357,
6710,
29898,
10141,
29918,
2248,
29922,
1311,
29889,
657,
29918,
13076,
29918,
2248,
3101,
408,
903,
29901,
13,
462,
1678,
1209,
13,
9651,
5174,
438,
29173,
408,
321,
29901,
13,
18884,
565,
321,
29889,
3127,
1217,
1275,
448,
29929,
29929,
29929,
29953,
29901,
13,
462,
1678,
12020,
13,
4706,
5174,
438,
29173,
408,
321,
29901,
13,
9651,
1583,
29889,
1188,
877,
2392,
679,
1051,
9200,
561,
2873,
29901,
6571,
4286,
4830,
29898,
29872,
511,
17927,
29889,
11341,
1806,
29897,
13,
9651,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
353,
448,
29906,
13,
13,
1678,
822,
19763,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9675,
29918,
20834,
353,
349,
1092,
2129,
29898,
1311,
29889,
1188,
29892,
1583,
29889,
16859,
29897,
13,
13,
1678,
822,
1369,
29898,
1311,
1125,
13,
4706,
1583,
3032,
1287,
353,
5852,
13,
4706,
1583,
29889,
1188,
877,
2962,
29889,
742,
17927,
29889,
11690,
29897,
13,
4706,
1583,
3032,
2622,
29918,
11249,
29918,
10492,
580,
13,
4706,
1583,
3032,
2158,
29918,
13076,
29918,
3888,
580,
13,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
1583,
3032,
1287,
353,
7700,
13,
4706,
1583,
29889,
1188,
877,
9847,
29889,
742,
17927,
29889,
11690,
29897,
13,
13,
1678,
822,
19587,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
908,
29889,
29113,
580,
322,
1583,
3032,
1287,
13,
13,
1678,
822,
11621,
29898,
1311,
29892,
22172,
29901,
851,
353,
15516,
316,
2142,
29901,
6120,
353,
5852,
29892,
7314,
29901,
6120,
353,
7700,
29897,
1599,
18761,
29901,
13,
4706,
10191,
29892,
364,
1516,
353,
15516,
6213,
13,
4706,
565,
451,
1583,
3032,
1287,
29901,
13,
9651,
1209,
13,
4706,
25342,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
2804,
448,
29906,
29901,
13,
9651,
1583,
3032,
908,
29889,
562,
1548,
580,
13,
9651,
1583,
3032,
2962,
29918,
303,
29873,
29918,
3696,
580,
13,
9651,
1018,
29901,
13,
18884,
10191,
29892,
364,
1516,
353,
1583,
3032,
20631,
29918,
392,
29918,
19730,
29898,
12199,
29892,
316,
2142,
29892,
7314,
29897,
13,
9651,
7146,
29901,
13,
18884,
1583,
3032,
9847,
29918,
303,
29873,
29918,
3696,
580,
13,
18884,
1583,
3032,
908,
29889,
14096,
580,
13,
4706,
1683,
29901,
13,
9651,
10191,
353,
383,
877,
30017,
29917,
25041,
20079,
933,
1538,
11714,
4466,
29982,
1495,
13,
9651,
1583,
29889,
1188,
29898,
7645,
29892,
17927,
29889,
11432,
29897,
13,
4706,
736,
10191,
29892,
364,
1516,
13,
13,
1678,
822,
903,
20631,
29918,
392,
29918,
19730,
29898,
1311,
29892,
22172,
29892,
316,
2142,
29892,
7314,
29897,
1599,
18761,
29901,
13,
4706,
2244,
29918,
1004,
29918,
351,
475,
353,
1583,
29889,
16859,
29889,
657,
29918,
13470,
877,
1278,
29918,
1004,
29918,
351,
475,
1495,
13,
4706,
10191,
29892,
364,
1516,
353,
1583,
3032,
20631,
29898,
12199,
29892,
7314,
29897,
13,
4706,
1449,
353,
10191,
338,
6213,
322,
2244,
29918,
1004,
29918,
351,
475,
1405,
29871,
29900,
13,
13,
4706,
1550,
1449,
29901,
29871,
396,
16204,
29935,
8821,
1911,
846,
3098,
13,
9651,
1583,
29889,
776,
29889,
1278,
29918,
351,
475,
29918,
14035,
580,
13,
9651,
10191,
29892,
364,
1516,
353,
1583,
3032,
20631,
29898,
1311,
29889,
9675,
29918,
20834,
29889,
1278,
29892,
7700,
29897,
13,
9651,
2244,
29918,
1004,
29918,
351,
475,
22361,
29871,
29896,
13,
9651,
1449,
353,
10191,
338,
6213,
322,
2244,
29918,
1004,
29918,
351,
475,
13,
4706,
565,
10191,
338,
6213,
322,
316,
2142,
29901,
13,
9651,
1827,
353,
1583,
29889,
9675,
29918,
20834,
29889,
311,
2142,
13,
9651,
565,
1827,
29901,
13,
18884,
1583,
29889,
776,
29889,
20834,
29898,
20834,
29892,
23473,
29922,
29896,
29906,
29900,
565,
1583,
29889,
16859,
29889,
29887,
1372,
877,
1271,
292,
29918,
25894,
1495,
1683,
29871,
29900,
29897,
13,
4706,
736,
10191,
470,
15516,
364,
1516,
13,
13,
1678,
822,
679,
29918,
13076,
29918,
2248,
29898,
1311,
1125,
13,
4706,
4742,
29918,
2248,
353,
1583,
29889,
16859,
29889,
29887,
1372,
877,
13076,
29918,
2248,
742,
448,
29896,
29897,
13,
4706,
565,
4742,
29918,
2248,
1405,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
29901,
13,
9651,
565,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
6736,
29871,
29900,
29901,
13,
18884,
286,
1199,
353,
383,
877,
30032,
29904,
8412,
933,
24335,
1685,
29871,
29900,
1447,
426,
1836,
742,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
718,
29871,
29896,
29892,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
29897,
13,
9651,
1683,
29901,
13,
18884,
286,
1199,
353,
383,
877,
30017,
29917,
25041,
20079,
933,
1538,
11714,
4466,
29982,
1495,
13,
9651,
1583,
29889,
1188,
29898,
29943,
877,
30029,
29919,
8060,
2370,
5068,
1216,
4399,
4157,
25041,
30011,
2953,
426,
1836,
6571,
742,
4742,
29918,
2248,
29892,
286,
1199,
511,
17927,
29889,
29956,
15249,
29897,
13,
9651,
736,
6213,
13,
4706,
736,
6213,
565,
4742,
29918,
2248,
529,
29871,
29900,
1683,
4742,
29918,
2248,
13,
13,
1678,
822,
903,
20631,
29898,
1311,
29892,
22172,
29901,
851,
29892,
7314,
29897,
1599,
18761,
29901,
13,
4706,
301,
20901,
353,
29871,
29945,
29871,
396,
939,
8776,
1282,
3098,
2569,
570,
18360,
2370,
16223,
29959,
13,
4706,
8260,
353,
6213,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
29887,
1372,
877,
284,
2817,
11022,
11236,
630,
29374,
13,
9651,
1583,
29889,
776,
29889,
1456,
29898,
1311,
29889,
16859,
29889,
2084,
1839,
8497,
7464,
301,
20901,
29892,
23473,
29922,
29906,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
776,
29889,
842,
29918,
29880,
20901,
29898,
29880,
20901,
29897,
13,
9651,
1583,
29889,
776,
29889,
21174,
29918,
29886,
3150,
580,
13,
4706,
1583,
29889,
1188,
877,
18494,
9224,
29901,
6571,
4286,
4830,
29898,
2272,
18494,
29889,
19737,
17111,
2141,
657,
29918,
10141,
29918,
2798,
580,
448,
29871,
29896,
511,
17927,
29889,
18525,
29897,
13,
13,
4706,
22172,
353,
22172,
470,
1583,
29889,
9675,
29918,
20834,
29889,
12199,
13,
4706,
934,
29918,
2084,
353,
1583,
29889,
776,
29889,
698,
29879,
29898,
12199,
29897,
565,
451,
7314,
322,
22172,
1683,
6213,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
29887,
1372,
877,
1271,
292,
29918,
25894,
29374,
13,
9651,
10348,
29892,
2407,
29918,
2230,
29892,
5864,
29892,
364,
1516,
353,
1583,
3032,
1271,
29918,
20631,
29898,
12199,
29892,
301,
20901,
29892,
934,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
10348,
29892,
2407,
29918,
2230,
29892,
5864,
29892,
364,
1516,
353,
1583,
3032,
5464,
29918,
1271,
29918,
20631,
29898,
12199,
29892,
301,
20901,
29892,
934,
29918,
2084,
29897,
13,
13,
4706,
1583,
29889,
1188,
29898,
29943,
877,
30040,
6157,
29935,
1077,
25736,
1077,
6571,
742,
3667,
29879,
29889,
1457,
4349,
29918,
2230,
29898,
11651,
29918,
2230,
8243,
17927,
29889,
11690,
29897,
13,
4706,
396,
14966,
8776,
1282,
3098,
2569,
570,
18360,
2370,
16223,
29959,
13,
4706,
1583,
29889,
776,
29889,
8551,
29918,
29880,
20901,
580,
13,
13,
4706,
565,
1583,
29889,
16859,
29889,
29887,
1372,
877,
284,
2817,
303,
29873,
29374,
13,
9651,
1583,
29889,
776,
29889,
1456,
29898,
1311,
29889,
16859,
29889,
2084,
1839,
29881,
549,
11287,
13,
4706,
565,
10348,
338,
451,
6213,
29901,
13,
9651,
8260,
353,
1583,
29889,
14917,
29918,
29423,
654,
29898,
18494,
29897,
13,
13,
4706,
565,
8260,
29901,
13,
9651,
1583,
29889,
1188,
29898,
13239,
29889,
29423,
654,
29918,
7645,
29898,
26381,
29892,
5864,
29892,
364,
1516,
511,
17927,
29889,
11690,
29897,
13,
4706,
736,
8260,
29892,
364,
1516,
13,
13,
1678,
822,
903,
5464,
29918,
1271,
29918,
20631,
29898,
1311,
29892,
22172,
29892,
301,
20901,
29892,
934,
29918,
2084,
1125,
13,
4706,
4236,
29918,
1456,
29918,
2230,
353,
29871,
29896,
29906,
29900,
29871,
396,
2394,
11153,
28494,
5209,
8409,
16335,
5945,
6531,
25321,
1695,
7616,
7926,
29970,
13,
4706,
4236,
29918,
10685,
29918,
2230,
353,
29871,
29896,
29900,
29871,
396,
614,
1969,
840,
1755,
9017,
1695,
7616,
7926,
29970,
13,
13,
4706,
13254,
353,
1583,
29889,
776,
29889,
7042,
29918,
20631,
580,
13,
13,
4706,
1369,
29918,
10685,
353,
931,
29889,
2230,
580,
13,
4706,
565,
934,
29918,
2084,
29901,
13,
9651,
1583,
29889,
776,
29889,
20834,
29898,
1445,
29918,
2084,
29892,
301,
20901,
29892,
7700,
565,
22172,
1683,
6213,
29892,
338,
29918,
1445,
29922,
5574,
29897,
13,
4706,
25342,
1583,
29889,
16859,
29889,
29887,
1372,
877,
284,
2817,
698,
29879,
1495,
322,
451,
22172,
29901,
13,
9651,
1583,
29889,
776,
29889,
20834,
29898,
1311,
29889,
16859,
29889,
2084,
1839,
29881,
549,
7464,
301,
20901,
29892,
7700,
29892,
338,
29918,
1445,
29922,
5574,
29897,
13,
13,
4706,
396,
2372,
14005,
3098,
15779,
1930,
29919,
13124,
4372,
846,
1755,
27187,
13139,
9017,
11453,
5413,
1077,
2968,
1415,
4633,
469,
6188,
29889,
13,
4706,
13254,
29889,
2962,
580,
13,
4706,
1583,
29889,
776,
29889,
11651,
29918,
14035,
29898,
5574,
29897,
13,
4706,
565,
934,
29918,
2084,
29901,
13,
9651,
1550,
13254,
29889,
1287,
580,
322,
1583,
29889,
776,
29889,
276,
635,
29918,
8262,
29891,
580,
322,
320,
13,
462,
1678,
931,
29889,
2230,
580,
448,
1369,
29918,
10685,
529,
4236,
29918,
1456,
29918,
2230,
322,
1583,
3032,
1287,
29901,
13,
18884,
396,
7007,
1216,
29959,
25693,
8409,
1538,
2771,
29977,
1216,
29932,
29892,
27187,
29935,
1538,
13124,
4372,
4633,
606,
6725,
29977,
29944,
13781,
1257,
13,
18884,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29896,
29897,
13,
4706,
1583,
29889,
776,
29889,
339,
2035,
580,
13,
13,
4706,
1369,
29918,
10685,
29906,
353,
931,
29889,
2230,
580,
13,
4706,
1550,
13254,
29889,
1287,
580,
322,
931,
29889,
2230,
580,
448,
1369,
29918,
10685,
29906,
529,
4236,
29918,
10685,
29918,
2230,
322,
1583,
3032,
1287,
29901,
13,
9651,
396,
5571,
1216,
29959,
1694,
2402,
1586,
1382,
14651,
29871,
29896,
29900,
13,
9651,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29896,
29897,
13,
13,
4706,
2407,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
1369,
29918,
10685,
13,
4706,
13254,
29889,
9847,
580,
13,
4706,
1583,
29889,
776,
29889,
11651,
29918,
14035,
29898,
8824,
29897,
13,
4706,
736,
13254,
29889,
18494,
29892,
2407,
29918,
2230,
29892,
13254,
29889,
27548,
29918,
386,
12268,
29892,
13254,
29889,
29878,
1516,
13,
13,
1678,
822,
903,
1271,
29918,
20631,
29898,
1311,
29892,
22172,
29892,
301,
20901,
29892,
934,
29918,
2084,
29892,
1583,
29918,
4804,
29922,
8824,
1125,
13,
4706,
364,
353,
27236,
29889,
27475,
29898,
1311,
29889,
776,
29889,
11651,
29918,
14035,
29892,
1583,
29889,
16859,
29889,
4141,
877,
25894,
742,
525,
25590,
296,
29918,
18056,
4926,
8785,
13,
4706,
20710,
353,
27236,
29889,
29924,
2357,
6710,
29898,
10141,
29918,
2248,
29922,
1311,
29889,
657,
29918,
13076,
29918,
2248,
3101,
13,
4706,
21200,
353,
1583,
29889,
16859,
29889,
29887,
1372,
877,
284,
2817,
698,
29879,
1495,
322,
451,
22172,
13,
13,
4706,
565,
21200,
470,
934,
29918,
2084,
29901,
13,
9651,
1583,
29889,
776,
29889,
20834,
29918,
14035,
29898,
5574,
29897,
13,
4706,
1018,
29901,
13,
9651,
565,
21200,
29901,
13,
18884,
1583,
29889,
776,
29889,
1456,
29898,
1311,
29889,
16859,
29889,
2084,
1839,
29881,
549,
7464,
301,
20901,
29892,
23473,
29922,
29906,
29897,
13,
9651,
325,
328,
353,
1583,
29889,
776,
29889,
657,
29918,
29894,
328,
29918,
4801,
3019,
29898,
13076,
29897,
13,
9651,
565,
934,
29918,
2084,
29901,
13,
18884,
1583,
29889,
776,
29889,
1456,
29898,
1445,
29918,
2084,
29892,
301,
20901,
29892,
23473,
29922,
29896,
29906,
29900,
29897,
13,
4706,
7146,
29901,
13,
9651,
565,
21200,
470,
934,
29918,
2084,
29901,
13,
18884,
1583,
29889,
776,
29889,
20834,
29918,
14035,
29898,
8824,
29897,
13,
13,
4706,
10348,
29892,
2407,
29918,
2230,
29892,
5864,
29918,
386,
12268,
29892,
364,
1516,
353,
1583,
29889,
776,
29889,
25894,
29918,
20631,
29898,
29878,
29892,
20710,
29892,
325,
328,
29897,
13,
4706,
565,
2407,
29918,
2230,
529,
29871,
29900,
29889,
29945,
322,
451,
1583,
29918,
4804,
29901,
13,
9651,
396,
3337,
12068,
1685,
606,
11026,
12172,
1902,
3540,
4157,
25041,
30011,
2953,
1447,
1077,
17307,
1471,
26866,
9935,
2237,
29871,
29906,
29900,
29899,
29941,
29945,
1586,
29951,
29892,
2721,
1077,
1668,
1210,
13860,
1155,
4364,
13,
9651,
396,
2081,
29969,
570,
641,
1086,
3098,
6961,
4896,
6627,
1077,
1668,
1210,
606,
1077,
2968,
2494,
3098,
13074,
29744,
29892,
10642,
1695,
7616,
7926,
29977,
13,
9651,
1583,
29889,
1188,
877,
8208,
2244,
2329,
29991,
742,
17927,
29889,
18525,
29897,
13,
9651,
736,
1583,
3032,
1271,
29918,
20631,
29898,
12199,
29922,
5574,
29892,
301,
20901,
29922,
29880,
20901,
29892,
934,
29918,
2084,
29922,
8516,
29892,
1583,
29918,
4804,
29922,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
10348,
29892,
2407,
29918,
2230,
29892,
5864,
29918,
386,
12268,
29892,
364,
1516,
13,
13,
1678,
822,
7314,
29918,
11651,
29898,
1311,
29892,
22172,
29901,
851,
470,
6213,
29892,
4078,
29918,
517,
29901,
851,
29892,
3588,
29918,
10492,
29922,
8516,
29892,
3588,
29918,
2103,
29922,
8516,
29892,
4046,
29922,
29947,
1125,
13,
4706,
565,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
1275,
448,
29906,
29901,
13,
9651,
1583,
29889,
1188,
29898,
29943,
877,
30017,
29917,
25041,
20079,
933,
1538,
11714,
4466,
29982,
5477,
17927,
29889,
11432,
29897,
13,
9651,
736,
383,
877,
30017,
29917,
25041,
20079,
933,
1538,
11714,
4466,
29982,
1495,
13,
4706,
1583,
3032,
908,
29889,
562,
1548,
580,
13,
4706,
1583,
3032,
2962,
29918,
303,
29873,
29918,
3696,
580,
13,
4706,
1018,
29901,
13,
9651,
736,
1583,
3032,
14917,
29918,
11651,
29898,
12199,
29892,
4078,
29918,
517,
29892,
3588,
29918,
10492,
29892,
3588,
29918,
2103,
29892,
4046,
29897,
13,
4706,
7146,
29901,
13,
9651,
1583,
29889,
776,
29889,
8551,
29918,
29880,
20901,
580,
13,
9651,
1583,
3032,
9847,
29918,
303,
29873,
29918,
3696,
580,
13,
9651,
1583,
3032,
908,
29889,
14096,
580,
13,
13,
1678,
822,
903,
14917,
29918,
11651,
29898,
1311,
29892,
22172,
29901,
851,
470,
6213,
29892,
4078,
29918,
517,
29901,
851,
29892,
3588,
29918,
10492,
29892,
3588,
29918,
2103,
29892,
4046,
1125,
13,
4706,
301,
20901,
353,
29871,
29945,
29871,
396,
939,
8776,
1282,
3098,
2569,
570,
18360,
2370,
16223,
29959,
13,
13,
4706,
565,
22172,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
776,
29889,
20834,
29898,
1311,
29889,
776,
29889,
698,
29879,
29898,
12199,
29897,
3285,
301,
20901,
29892,
5852,
29892,
338,
29918,
1445,
29922,
5574,
29892,
23473,
29922,
29896,
29906,
29900,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
776,
29889,
842,
29918,
29880,
20901,
29898,
29880,
20901,
29897,
13,
4706,
364,
353,
27236,
29889,
27475,
29898,
11651,
29918,
14035,
29922,
1311,
29889,
776,
29889,
11651,
29918,
14035,
29897,
13,
4706,
20710,
353,
27236,
29889,
29924,
2357,
6710,
29898,
10141,
29918,
2248,
29922,
1311,
29889,
657,
29918,
13076,
29918,
2248,
3101,
13,
4706,
325,
328,
353,
1583,
29889,
776,
29889,
657,
29918,
29894,
328,
29918,
4801,
3019,
29898,
13076,
29897,
13,
4706,
1583,
29889,
776,
29889,
1456,
29898,
1311,
29889,
16859,
29889,
2084,
1839,
8497,
7464,
301,
20901,
29892,
23473,
29922,
29941,
29897,
13,
4706,
411,
20710,
408,
2752,
29901,
13,
9651,
2407,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
9651,
1018,
29901,
13,
18884,
594,
532,
353,
364,
29889,
20631,
29896,
29898,
4993,
29922,
4993,
29892,
325,
328,
29922,
29894,
328,
29892,
11815,
29922,
29945,
29892,
16549,
29918,
2230,
29918,
13400,
29922,
13400,
29897,
13,
9651,
5174,
27236,
29889,
15716,
10851,
2392,
408,
321,
29901,
13,
18884,
736,
851,
29898,
29872,
29897,
13,
9651,
565,
931,
29889,
2230,
580,
448,
2407,
29918,
2230,
529,
29871,
29900,
29889,
29945,
29901,
13,
18884,
736,
383,
877,
27129,
8409,
1077,
17307,
1471,
29917,
4734,
2237,
29944,
531,
18595,
29892,
6408,
26367,
9907,
9971,
19524,
1413,
1495,
13,
4706,
1018,
29901,
13,
9651,
2897,
29889,
29885,
12535,
12935,
29898,
359,
29889,
2084,
29889,
25721,
29898,
7620,
29918,
517,
511,
1863,
29918,
554,
29922,
5574,
29897,
13,
9651,
411,
1722,
29898,
7620,
29918,
517,
29892,
376,
29893,
29890,
1159,
408,
285,
29901,
13,
18884,
285,
29889,
3539,
29898,
7221,
29889,
657,
29918,
29893,
485,
29918,
1272,
29898,
13441,
29918,
10492,
29892,
3588,
29918,
2103,
876,
13,
4706,
5174,
10663,
2392,
408,
4589,
29901,
13,
9651,
736,
851,
29898,
3127,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
13,
1678,
822,
7314,
29918,
29423,
654,
29898,
1311,
29892,
10348,
29892,
11813,
29901,
6120,
353,
7700,
29892,
21736,
29922,
8516,
29897,
1599,
851,
29901,
13,
4706,
565,
313,
275,
8758,
29898,
18494,
29892,
13763,
23122,
654,
29897,
322,
21736,
338,
6213,
29897,
470,
338,
8758,
29898,
18494,
29892,
13763,
6362,
3019,
1125,
13,
9651,
736,
10348,
29889,
726,
13,
4706,
1583,
29889,
776,
29889,
5965,
5309,
29918,
29423,
1891,
29898,
5574,
29897,
13,
4706,
1018,
29901,
13,
9651,
736,
1583,
3032,
14917,
29918,
29423,
654,
29898,
18494,
29892,
11813,
29892,
21736,
29897,
13,
4706,
7146,
29901,
13,
9651,
1583,
29889,
776,
29889,
5965,
5309,
29918,
29423,
1891,
29898,
8824,
29897,
13,
13,
1678,
822,
903,
14917,
29918,
29423,
654,
29898,
1311,
29892,
10348,
29892,
11813,
29901,
6120,
353,
7700,
29892,
21736,
29922,
8516,
29892,
13113,
29922,
8516,
29897,
1599,
3667,
29879,
29889,
15102,
29901,
13,
4706,
822,
1827,
29898,
726,
29901,
851,
1125,
13,
9651,
565,
451,
11813,
29901,
13,
18884,
1583,
29889,
776,
29889,
20834,
29898,
726,
29897,
13,
4706,
11813,
353,
11813,
470,
451,
1583,
29889,
16859,
29889,
29887,
1372,
877,
20834,
29918,
303,
29873,
29918,
2704,
1495,
13,
4706,
1326,
353,
13113,
470,
1583,
29889,
16859,
29889,
29887,
1372,
877,
18121,
303,
29873,
742,
525,
348,
842,
1495,
13,
4706,
565,
451,
1583,
29889,
776,
29889,
275,
29918,
303,
29873,
29918,
18121,
29898,
16123,
1125,
13,
9651,
1583,
29889,
1188,
29898,
29943,
877,
30038,
1911,
23348,
13124,
4372,
22185,
448,
1538,
6531,
10411,
2370,
469,
4962,
29977,
6620,
6571,
742,
1326,
511,
17927,
29889,
11341,
1806,
29897,
13,
9651,
1827,
29898,
29943,
877,
30038,
1911,
23348,
13124,
4372,
22185,
448,
1538,
6531,
10411,
2370,
469,
4962,
29977,
6620,
6571,
742,
6629,
876,
13,
9651,
736,
3667,
29879,
29889,
15102,
877,
742,
1326,
29897,
13,
4706,
1583,
29889,
1188,
29898,
29943,
877,
30032,
1225,
13124,
4372,
22185,
24160,
3098,
6571,
742,
1326,
511,
17927,
29889,
18525,
29897,
13,
4706,
281,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
1820,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
1820,
353,
1583,
29889,
16859,
29889,
1989,
29898,
16123,
29892,
525,
2754,
446,
858,
29873,
1495,
13,
9651,
1899,
353,
6850,
29911,
29889,
2577,
1254,
29911,
29898,
13,
18884,
1326,
29892,
13,
18884,
10348,
29918,
1272,
29922,
18494,
29892,
13,
18884,
1820,
29922,
1989,
29892,
13,
18884,
6361,
29922,
1311,
29889,
16859,
29889,
303,
29873,
29918,
3893,
29898,
16123,
511,
13,
18884,
3142,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
16123,
29892,
525,
2974,
5477,
13,
18884,
343,
273,
1390,
29918,
2754,
29922,
1311,
29889,
16859,
29889,
10094,
1390,
29918,
2754,
29898,
16123,
511,
13,
18884,
867,
6739,
29922,
1311,
29889,
16859,
29889,
4141,
29898,
16123,
29892,
525,
629,
6739,
5477,
13,
9651,
13742,
726,
580,
13,
4706,
5174,
6850,
29911,
29889,
14148,
1917,
2392,
29901,
13,
9651,
1899,
353,
6629,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1827,
29898,
29943,
877,
30013,
13551,
4734,
18774,
614,
1911,
23348,
13124,
4372,
22185,
8785,
13,
9651,
10191,
353,
525,
30038,
1911,
23348,
13124,
4372,
22185,
1909,
1499,
1685,
24335,
1186,
2583,
29981,
320,
29915,
29912,
1012,
4286,
21313,
1800,
29915,
13,
9651,
565,
451,
338,
8758,
29898,
29872,
29892,
24875,
2392,
1125,
13,
18884,
321,
353,
3667,
29879,
29889,
6572,
4349,
2451,
29898,
29872,
29897,
13,
9651,
1583,
29889,
1188,
29898,
29943,
29898,
7645,
29892,
1326,
29892,
3667,
29879,
29889,
13168,
29918,
2696,
29898,
1989,
511,
321,
511,
17927,
29889,
11432,
29897,
13,
9651,
736,
3667,
29879,
29889,
15102,
877,
742,
1326,
29897,
13,
4706,
565,
21736,
29901,
13,
9651,
281,
2230,
353,
21736,
580,
13,
4706,
281,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
281,
2230,
13,
4706,
1583,
29889,
1188,
29898,
29943,
877,
30027,
29910,
3565,
4372,
570,
1077,
6571,
742,
3667,
29879,
29889,
1457,
4349,
29918,
2230,
29898,
29893,
29918,
2230,
8243,
17927,
29889,
18525,
29897,
13,
4706,
736,
3667,
29879,
29889,
15102,
29898,
6519,
470,
15516,
1326,
29892,
281,
29918,
2230,
29897,
13,
13,
1678,
822,
16549,
29918,
3166,
29918,
5325,
29898,
1311,
29892,
2066,
29901,
1051,
1125,
13,
4706,
565,
451,
2066,
29901,
13,
9651,
736,
15516,
29871,
29900,
13,
4706,
17162,
353,
518,
23122,
654,
16164,
29898,
1311,
3032,
14917,
29918,
29423,
654,
29892,
934,
29897,
363,
934,
297,
2066,
29962,
13,
4706,
1121,
353,
518,
24602,
29889,
657,
363,
15645,
297,
17162,
29962,
13,
4706,
628,
17162,
13,
4706,
396,
2515,
494,
1902,
531,
29871,
29945,
29900,
29995,
718,
29871,
29896,
15393,
12393,
1257,
13,
4706,
1136,
8841,
353,
7431,
29898,
2914,
29897,
849,
29871,
29906,
718,
29871,
29896,
13,
4706,
16549,
353,
6629,
13,
4706,
1993,
29918,
2798,
353,
29871,
29900,
13,
4706,
363,
1827,
297,
1121,
29901,
13,
9651,
565,
451,
1827,
29901,
13,
18884,
6773,
13,
9651,
1993,
29918,
2798,
353,
1121,
29889,
2798,
29898,
20834,
29897,
13,
9651,
565,
1993,
29918,
2798,
6736,
1136,
8841,
29901,
13,
18884,
16549,
353,
1827,
13,
18884,
2867,
13,
4706,
1583,
29889,
1188,
29898,
29943,
877,
30027,
29910,
3565,
4372,
570,
29901,
426,
1836,
10698,
17287,
2937,
29935,
29901,
6571,
742,
13420,
15300,
7122,
4197,
710,
29898,
29916,
29897,
363,
921,
297,
1121,
11724,
16549,
511,
17927,
29889,
18525,
29897,
13,
4706,
736,
16549,
29892,
1993,
29918,
2798,
13,
13,
1678,
822,
2999,
29918,
29423,
654,
29898,
1311,
29892,
934,
29918,
272,
29918,
7221,
29892,
1326,
11376,
29901,
1051,
29897,
1599,
1051,
29901,
13,
4706,
565,
451,
1326,
11376,
29901,
13,
9651,
736,
5159,
13,
4706,
594,
532,
353,
594,
532,
29918,
3166,
29918,
1445,
29898,
1445,
29918,
272,
29918,
7221,
29897,
13,
4706,
17162,
353,
518,
23122,
654,
16164,
29898,
1311,
3032,
14917,
29918,
29423,
654,
29892,
594,
532,
29892,
13113,
29897,
363,
13113,
297,
1326,
11376,
29962,
13,
4706,
736,
518,
24602,
29889,
657,
363,
15645,
297,
17162,
29962,
13,
13,
1678,
822,
903,
2158,
29918,
13076,
29918,
3888,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
529,
29871,
29900,
29901,
13,
9651,
736,
13,
4706,
2380,
353,
1583,
29889,
16859,
29889,
29887,
1372,
877,
13076,
29918,
2248,
742,
448,
29896,
29897,
13,
4706,
1024,
353,
27236,
29889,
29924,
2357,
6710,
29889,
657,
29918,
29885,
2357,
6710,
29918,
978,
29898,
2248,
565,
2380,
1405,
448,
29896,
1683,
6213,
29897,
13,
4706,
1583,
29889,
1188,
877,
29924,
2357,
6710,
29901,
29850,
6177,
426,
5038,
4286,
4830,
29898,
2248,
565,
2380,
1405,
448,
29896,
1683,
525,
4592,
742,
1024,
511,
17927,
29889,
11690,
29897,
13,
13,
1678,
822,
903,
2622,
29918,
11249,
29918,
10492,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
3032,
11249,
29918,
10492,
29918,
1688,
261,
580,
13,
4706,
5174,
24875,
2392,
408,
321,
29901,
13,
9651,
1583,
29889,
1188,
29898,
29872,
29892,
17927,
29889,
11341,
1806,
29897,
13,
9651,
931,
29889,
17059,
29898,
29900,
29889,
29906,
29897,
13,
9651,
12020,
24875,
2392,
580,
13,
13,
1678,
822,
903,
11249,
29918,
10492,
29918,
1688,
261,
29898,
1311,
1125,
13,
4706,
822,
1243,
261,
7295,
13,
9651,
19257,
353,
313,
29941,
29906,
29900,
29900,
29900,
29892,
29871,
29947,
29900,
29900,
29900,
29892,
29871,
29946,
29947,
29900,
29900,
29900,
29892,
29871,
29946,
29946,
29896,
29900,
29900,
29892,
6213,
29897,
13,
9651,
565,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
1275,
448,
29906,
29901,
13,
18884,
736,
13,
9651,
565,
1583,
3032,
1688,
29918,
10492,
7295,
13,
18884,
736,
13,
9651,
363,
6554,
297,
19257,
29901,
13,
18884,
10191,
353,
525,
29924,
2357,
6710,
947,
451,
2304,
4559,
6554,
24335,
6416,
1627,
304,
6571,
4286,
4830,
29898,
13,
462,
1678,
27236,
29889,
29924,
2357,
6710,
29889,
23397,
29918,
29934,
3040,
29892,
6554,
29897,
13,
18884,
1583,
29889,
1188,
29898,
7645,
29892,
17927,
29889,
29956,
15249,
29897,
13,
18884,
27236,
29889,
29924,
2357,
6710,
29889,
23397,
29918,
29934,
3040,
353,
6554,
13,
18884,
565,
1583,
3032,
1688,
29918,
10492,
7295,
13,
462,
1678,
736,
13,
9651,
12020,
24875,
2392,
877,
29924,
2357,
6710,
338,
9391,
29889,
18601,
287,
4559,
6554,
451,
1476,
1495,
13,
4706,
1018,
29901,
13,
9651,
1243,
261,
580,
13,
4706,
5174,
24875,
2392,
408,
321,
29901,
13,
9651,
1583,
29889,
3317,
29918,
13076,
29918,
2248,
353,
448,
29906,
13,
9651,
1583,
29889,
1188,
29898,
29872,
29892,
17927,
29889,
11432,
29897,
13,
13,
1678,
822,
903,
1688,
29918,
10492,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
411,
27236,
29889,
29924,
2357,
6710,
29898,
10141,
29918,
2248,
29922,
1311,
29889,
657,
29918,
13076,
29918,
2248,
3101,
408,
903,
29901,
13,
18884,
1209,
13,
4706,
5174,
438,
29173,
408,
321,
29901,
13,
9651,
565,
321,
29889,
3127,
1217,
1275,
448,
29929,
29929,
29929,
29955,
29901,
13,
18884,
736,
7700,
13,
9651,
12020,
24875,
2392,
877,
29924,
2357,
6710,
338,
9391,
29901,
6571,
4286,
4830,
29898,
29872,
876,
13,
4706,
1683,
29901,
13,
9651,
736,
5852,
13,
13,
13,
1990,
3599,
3811,
654,
16164,
29898,
7097,
292,
29889,
4899,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7314,
29918,
29423,
654,
29892,
934,
29918,
272,
29918,
7221,
29892,
13113,
29922,
8516,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
3032,
14917,
29918,
29423,
654,
353,
7314,
29918,
29423,
654,
13,
4706,
1583,
3032,
1445,
29918,
272,
29918,
7221,
353,
934,
29918,
272,
29918,
7221,
13,
4706,
1583,
3032,
18121,
353,
13113,
13,
4706,
1583,
3032,
2914,
353,
3667,
29879,
29889,
15102,
877,
742,
13113,
29897,
13,
4706,
1583,
29889,
2962,
580,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2914,
353,
1583,
3032,
14917,
29918,
29423,
654,
29898,
7221,
29918,
3166,
29918,
1445,
29898,
1311,
3032,
1445,
29918,
272,
29918,
7221,
511,
5852,
29892,
13113,
29922,
1311,
3032,
18121,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
679,
29898,
1311,
1125,
13,
4706,
2428,
2141,
7122,
580,
13,
4706,
736,
1583,
3032,
2914,
13,
13,
13,
1990,
349,
1092,
2129,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1480,
29892,
274,
16434,
1125,
13,
4706,
1024,
353,
525,
24588,
2129,
648,
29913,
4286,
4830,
29898,
16859,
29889,
11675,
29918,
978,
3101,
13,
4706,
1583,
3032,
24588,
2129,
353,
274,
16434,
29889,
1359,
29918,
8977,
29898,
978,
29897,
13,
4706,
1018,
29901,
13,
9651,
3667,
29879,
29889,
3198,
29918,
24588,
2129,
29898,
1311,
3032,
24588,
2129,
29897,
13,
4706,
5174,
7865,
2392,
408,
321,
29901,
13,
9651,
1480,
877,
2392,
12216,
2129,
8363,
29892,
17749,
2322,
12216,
2129,
29901,
6571,
4286,
4830,
29898,
29872,
511,
17927,
29889,
11432,
29897,
13,
9651,
1583,
3032,
24588,
2129,
353,
6213,
13,
4706,
565,
451,
1583,
3032,
24588,
2129,
29901,
13,
9651,
1583,
3032,
24588,
2129,
353,
426,
13,
18884,
525,
12199,
2396,
518,
29943,
877,
30013,
641,
7616,
5477,
383,
877,
30008,
1844,
4604,
30005,
5477,
383,
877,
19193,
26874,
5477,
383,
877,
30013,
641,
7616,
29899,
30013,
641,
7616,
1495,
1402,
13,
18884,
525,
311,
2142,
2396,
29871,
518,
29943,
877,
30096,
7380,
1093,
588,
1538,
10053,
5985,
4604,
684,
5477,
383,
877,
30012,
29982,
7380,
1093,
588,
1538,
531,
8664,
644,
5477,
383,
877,
30029,
29917,
1093,
588,
1538,
531,
5985,
30002,
570,
5477,
383,
877,
30029,
29919,
733,
1200,
684,
1495,
1402,
13,
18884,
525,
1278,
2396,
518,
29943,
877,
30029,
29917,
1093,
588,
1538,
531,
5985,
30002,
570,
29892,
5885,
702,
23314,
8935,
30002,
1077,
5945,
29935,
1495,
1402,
13,
18884,
525,
305,
749,
2396,
29871,
29906,
29945,
13,
9651,
500,
13,
9651,
274,
16434,
29889,
7620,
29918,
8977,
29898,
978,
29892,
1583,
3032,
24588,
2129,
29892,
5852,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
22172,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
16957,
877,
12199,
1495,
13,
13,
1678,
732,
6799,
13,
1678,
822,
316,
2142,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
16957,
877,
311,
2142,
1495,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2244,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
16957,
877,
1278,
1495,
13,
13,
1678,
732,
6799,
13,
1678,
822,
8825,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
736,
4036,
29889,
3924,
17875,
2141,
9502,
524,
29898,
29896,
29892,
29871,
29896,
29900,
29900,
29897,
5277,
1583,
3032,
24588,
2129,
1839,
305,
749,
2033,
13,
13,
1678,
822,
903,
16957,
29898,
1311,
29892,
1024,
29901,
851,
29897,
1599,
851,
29901,
13,
4706,
736,
4036,
29889,
3924,
17875,
2141,
16957,
29898,
1311,
3032,
24588,
2129,
29961,
978,
2314,
13,
13,
13,
1753,
594,
532,
29918,
3166,
29918,
1445,
29898,
1445,
29918,
272,
29918,
7221,
29901,
851,
470,
27236,
29889,
17111,
1469,
29897,
1599,
27236,
29889,
17111,
1469,
29901,
13,
1678,
565,
338,
8758,
29898,
1445,
29918,
272,
29918,
7221,
29892,
27236,
29889,
17111,
1469,
1125,
13,
4706,
736,
934,
29918,
272,
29918,
7221,
13,
1678,
1683,
29901,
13,
4706,
411,
10742,
29889,
3150,
29898,
1445,
29918,
272,
29918,
7221,
29892,
525,
6050,
1495,
408,
285,
29886,
29901,
13,
9651,
736,
27236,
29889,
17111,
1469,
29898,
18091,
29889,
949,
19935,
29898,
18091,
29889,
657,
29876,
19935,
25739,
285,
29886,
29889,
657,
1341,
4183,
403,
3285,
285,
29886,
29889,
20078,
1160,
2103,
3101,
13,
2
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.