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
|
---|---|---|---|---|---|
tools/prepare_macaque_data/split_trainval.py | MeowMeowLady/Towards-Neuro-Seg-Macaque-Brain | 1 | 172353 | <reponame>MeowMeowLady/Towards-Neuro-Seg-Macaque-Brain<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on 19-7-31 下午6:02
IDE PyCharm
@author: <NAME>
this script is used to split training and validation sets by generating list-txt.
"""
from os.path import join as opj
import random
from glob import glob
import os
txt_save_path = ''
total_list = os.listdir('/')
random.shuffle(total_list)
random.shuffle(total_list)
train_list = open(opj(txt_save_path, 'train.txt'), 'w+')
valid_list = open(opj(txt_save_path, 'valid.txt'), 'w+')
for i in range(3500):
train_list.write('{}\n'.format(total_list[i][:-3]))
for i in range(1000):
valid_list.write('{}\n'.format(total_list[i+3500][:-3]))
train_list.close()
valid_list.close()
| [
1,
529,
276,
1112,
420,
29958,
6816,
340,
6816,
340,
29931,
3714,
29914,
29911,
340,
3163,
29899,
8139,
2192,
29899,
17669,
29899,
29924,
11989,
802,
29899,
22097,
29966,
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,
20399,
373,
29871,
29896,
29929,
29899,
29955,
29899,
29941,
29896,
29871,
30557,
232,
144,
139,
29953,
29901,
29900,
29906,
13,
22027,
10772,
1451,
2817,
29871,
13,
13,
29992,
8921,
29901,
529,
5813,
29958,
13,
1366,
2471,
338,
1304,
304,
6219,
6694,
322,
8845,
6166,
491,
14655,
1051,
29899,
3945,
29889,
13,
15945,
29908,
13,
13,
3166,
2897,
29889,
2084,
1053,
5988,
408,
1015,
29926,
13,
5215,
4036,
13,
3166,
13149,
1053,
13149,
13,
5215,
2897,
13,
13,
3945,
29918,
7620,
29918,
2084,
353,
6629,
13,
13,
7827,
29918,
1761,
353,
2897,
29889,
1761,
3972,
11219,
1495,
13,
8172,
29889,
845,
21897,
29898,
7827,
29918,
1761,
29897,
13,
8172,
29889,
845,
21897,
29898,
7827,
29918,
1761,
29897,
13,
13,
14968,
29918,
1761,
353,
1722,
29898,
459,
29926,
29898,
3945,
29918,
7620,
29918,
2084,
29892,
525,
14968,
29889,
3945,
5477,
525,
29893,
29974,
1495,
13,
3084,
29918,
1761,
353,
1722,
29898,
459,
29926,
29898,
3945,
29918,
7620,
29918,
2084,
29892,
525,
3084,
29889,
3945,
5477,
525,
29893,
29974,
1495,
13,
13,
1454,
474,
297,
3464,
29898,
29941,
29945,
29900,
29900,
1125,
13,
1678,
7945,
29918,
1761,
29889,
3539,
877,
29912,
1012,
29876,
4286,
4830,
29898,
7827,
29918,
1761,
29961,
29875,
3816,
13018,
29941,
12622,
13,
13,
1454,
474,
297,
3464,
29898,
29896,
29900,
29900,
29900,
1125,
13,
1678,
2854,
29918,
1761,
29889,
3539,
877,
29912,
1012,
29876,
4286,
4830,
29898,
7827,
29918,
1761,
29961,
29875,
29974,
29941,
29945,
29900,
29900,
3816,
13018,
29941,
12622,
13,
13,
14968,
29918,
1761,
29889,
5358,
580,
13,
3084,
29918,
1761,
29889,
5358,
580,
13,
13,
13,
2
] |
productdb/testing/unittests/products.py | tspycher/python-productdb | 0 | 38248 | from . import BasicTestCase
class ProductsTestCase(BasicTestCase):
def test_basic(self):
rv = self.client.get('/')
assert rv.status_code == 200
data = self.parseJsonResponse(rv)
assert '_links' in data
def test_get_all_products(self):
rv = self.client.get('/product')
assert rv.status_code == 200
data = self.parseJsonResponse(rv)
assert '_items' in data
# add further data tests here, load basic data by fixtures
pass
| [
1,
515,
869,
1053,
19219,
3057,
8259,
13,
13,
1990,
10969,
29879,
3057,
8259,
29898,
16616,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
16121,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1583,
29889,
4645,
29889,
657,
11219,
1495,
13,
4706,
4974,
364,
29894,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
4706,
848,
353,
1583,
29889,
5510,
8148,
5103,
29898,
15291,
29897,
13,
4706,
4974,
22868,
4965,
29915,
297,
848,
13,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
497,
29918,
14456,
29898,
1311,
1125,
13,
4706,
364,
29894,
353,
1583,
29889,
4645,
29889,
657,
11219,
4704,
1495,
13,
4706,
4974,
364,
29894,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
13,
4706,
848,
353,
1583,
29889,
5510,
8148,
5103,
29898,
15291,
29897,
13,
4706,
4974,
22868,
7076,
29915,
297,
848,
13,
4706,
396,
788,
4340,
848,
6987,
1244,
29892,
2254,
6996,
848,
491,
5713,
486,
1973,
13,
13,
4706,
1209,
13,
13,
13,
2
] |
core/cdag/node/sub.py | prorevizor/noc | 84 | 16518 | # ----------------------------------------------------------------------
# SubNode
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python modules
from typing import Optional
# NOC modules
from .base import BaseCDAGNode, ValueType, Category
class SubNode(BaseCDAGNode):
"""
Subtract `y` from `y`
"""
name = "sub"
categories = [Category.OPERATION]
def get_value(self, x: ValueType, y: ValueType) -> Optional[ValueType]:
return x - y
| [
1,
396,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
3323,
4247,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29900,
29955,
29899,
29906,
29900,
29906,
29900,
450,
11698,
29907,
8010,
13,
29937,
2823,
365,
2965,
1430,
1660,
363,
4902,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
13,
29937,
5132,
10585,
13,
3166,
19229,
1053,
28379,
13,
13,
29937,
11698,
29907,
10585,
13,
3166,
869,
3188,
1053,
7399,
6530,
10051,
4247,
29892,
7865,
1542,
29892,
17943,
13,
13,
13,
1990,
3323,
4247,
29898,
5160,
6530,
10051,
4247,
1125,
13,
1678,
9995,
13,
1678,
3323,
29873,
1461,
421,
29891,
29952,
515,
421,
29891,
29952,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
376,
1491,
29908,
13,
1678,
13997,
353,
518,
10900,
29889,
4590,
1001,
8098,
29962,
13,
13,
1678,
822,
679,
29918,
1767,
29898,
1311,
29892,
921,
29901,
7865,
1542,
29892,
343,
29901,
7865,
1542,
29897,
1599,
28379,
29961,
1917,
1542,
5387,
13,
4706,
736,
921,
448,
343,
13,
2
] |
kubeflow/utils/kaggle.py | GalaxyIT/kubeflow-utils | 0 | 172939 | <filename>kubeflow/utils/kaggle.py
import json
from pathlib import Path
class Kaggle:
def login(self, username, apikey):
kaggle_json = Kaggle.__generate_kaggle_json_string(username, apikey)
Kaggle.__save_kaggle_json(kaggle_json)
@staticmethod
def __generate_kaggle_json_string(username, apikey):
data = {
"username": username,
"key": apikey
}
return json.dumps(data)
@staticmethod
def __save_kaggle_json(json_str):
kaggle_path = Path.home().joinpath('.kaggle')
if not kaggle_path.exists(): kaggle_path.mkdir(parents=True)
with open(str(kaggle_path.joinpath('kaggle.json')), 'w+') as kaggle_json:
print(json_str, file=kaggle_json)
| [
1,
529,
9507,
29958,
29895,
431,
1389,
677,
29914,
13239,
29914,
29895,
351,
6234,
29889,
2272,
13,
5215,
4390,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
13,
1990,
476,
351,
6234,
29901,
13,
1678,
822,
6464,
29898,
1311,
29892,
8952,
29892,
7882,
1989,
1125,
13,
4706,
413,
351,
6234,
29918,
3126,
353,
476,
351,
6234,
17255,
17158,
29918,
29895,
351,
6234,
29918,
3126,
29918,
1807,
29898,
6786,
29892,
7882,
1989,
29897,
13,
4706,
476,
351,
6234,
17255,
7620,
29918,
29895,
351,
6234,
29918,
3126,
29898,
29895,
351,
6234,
29918,
3126,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4770,
17158,
29918,
29895,
351,
6234,
29918,
3126,
29918,
1807,
29898,
6786,
29892,
7882,
1989,
1125,
13,
4706,
848,
353,
426,
13,
9651,
376,
6786,
1115,
8952,
29892,
13,
9651,
376,
1989,
1115,
7882,
1989,
13,
4706,
500,
13,
13,
4706,
736,
4390,
29889,
29881,
17204,
29898,
1272,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4770,
7620,
29918,
29895,
351,
6234,
29918,
3126,
29898,
3126,
29918,
710,
1125,
13,
4706,
413,
351,
6234,
29918,
2084,
353,
10802,
29889,
5184,
2141,
7122,
2084,
12839,
29895,
351,
6234,
1495,
13,
4706,
565,
451,
413,
351,
6234,
29918,
2084,
29889,
9933,
7295,
413,
351,
6234,
29918,
2084,
29889,
11256,
3972,
29898,
862,
1237,
29922,
5574,
29897,
13,
13,
4706,
411,
1722,
29898,
710,
29898,
29895,
351,
6234,
29918,
2084,
29889,
7122,
2084,
877,
29895,
351,
6234,
29889,
3126,
1495,
511,
525,
29893,
29974,
1495,
408,
413,
351,
6234,
29918,
3126,
29901,
13,
9651,
1596,
29898,
3126,
29918,
710,
29892,
934,
29922,
29895,
351,
6234,
29918,
3126,
29897,
13,
2
] |
all_raspi_code_backup/DriveTesting.py | lord-pradhan/SnowBot | 2 | 15482 | <reponame>lord-pradhan/SnowBot<gh_stars>1-10
"""
Program: DriveTesting.py
Revised On: 12/01/2019
"""
### Library Imports
from DriveArduino import DriveArduino
import numpy as np
from time import sleep
from sys import exit
from signal import signal, SIGINT
###
### CTRL + C Signal Handler & Resource Cleanup
def signal_handler(sig, frame):
"""Handler for CTRL + C clean exit."""
print('Quitting program.')
cleanup()
def cleanup():
"""Resource cleanup."""
drive.close()
print('Resource cleanup completed.')
exit(0)
signal(SIGINT, signal_handler)
###
### Arduino Configuration
addr = 0x08
drive = DriveArduino(addr)
###
### Main Program
print('Press CTRL + C to exit.')
while True:
setpoints = np.array([25, 25, -25, -25])
drive.set_rpm(setpoints)
sleep(1)
drive.update()
print(drive.rpm)
print(drive.pwm)
print()
###
| [
1,
529,
276,
1112,
420,
29958,
29880,
536,
29899,
558,
328,
5403,
29914,
29903,
3707,
29933,
327,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
13,
9283,
29901,
268,
22850,
3057,
292,
29889,
2272,
13,
1123,
11292,
1551,
29901,
259,
29896,
29906,
29914,
29900,
29896,
29914,
29906,
29900,
29896,
29929,
13,
15945,
29908,
13,
13,
2277,
29937,
9538,
1954,
4011,
13,
3166,
22850,
1433,
28955,
1053,
22850,
1433,
28955,
13,
5215,
12655,
408,
7442,
13,
3166,
931,
1053,
8709,
13,
3166,
10876,
1053,
6876,
13,
3166,
7182,
1053,
7182,
29892,
317,
6259,
10192,
13,
2277,
29937,
13,
13,
13,
2277,
29937,
26637,
2241,
718,
315,
9954,
284,
5166,
1358,
669,
18981,
315,
14044,
786,
13,
1753,
7182,
29918,
13789,
29898,
18816,
29892,
3515,
1125,
13,
1678,
9995,
4598,
363,
26637,
2241,
718,
315,
5941,
6876,
1213,
15945,
13,
1678,
1596,
877,
2182,
5367,
1824,
29889,
1495,
13,
1678,
5941,
786,
580,
13,
13,
1753,
5941,
786,
7295,
13,
1678,
9995,
6848,
5941,
786,
1213,
15945,
13,
1678,
7899,
29889,
5358,
580,
13,
1678,
1596,
877,
6848,
5941,
786,
8676,
29889,
1495,
13,
1678,
6876,
29898,
29900,
29897,
13,
13,
25436,
29898,
5425,
29954,
10192,
29892,
7182,
29918,
13789,
29897,
13,
2277,
29937,
13,
13,
13,
2277,
29937,
826,
28955,
20999,
13,
10030,
353,
29871,
29900,
29916,
29900,
29947,
13,
21594,
353,
22850,
1433,
28955,
29898,
10030,
29897,
13,
2277,
29937,
13,
13,
13,
2277,
29937,
4241,
7835,
13,
2158,
877,
10923,
26637,
2241,
718,
315,
304,
6876,
29889,
1495,
13,
13,
8000,
5852,
29901,
13,
1678,
731,
9748,
353,
7442,
29889,
2378,
4197,
29906,
29945,
29892,
29871,
29906,
29945,
29892,
448,
29906,
29945,
29892,
448,
29906,
29945,
2314,
13,
1678,
7899,
29889,
842,
29918,
29878,
3358,
29898,
842,
9748,
29897,
13,
1678,
8709,
29898,
29896,
29897,
13,
268,
13,
1678,
7899,
29889,
5504,
580,
13,
1678,
1596,
29898,
21594,
29889,
29878,
3358,
29897,
13,
1678,
1596,
29898,
21594,
29889,
29886,
29893,
29885,
29897,
13,
1678,
1596,
580,
13,
2277,
29937,
13,
2
] |
waterbutler/providers/dropbox/settings.py | laurenrevere/waterbutler | 0 | 149895 | <reponame>laurenrevere/waterbutler
try:
from waterbutler import settings
except ImportError:
settings = {}
config = settings.get('DROPBOX_PROVIDER_CONFIG', {})
BASE_URL = config.get('BASE_URL', 'https://api.dropbox.com/1/')
BASE_CONTENT_URL = config.get('BASE_CONTENT_URL', 'https://api-content.dropbox.com/1/')
| [
1,
529,
276,
1112,
420,
29958,
433,
10732,
276,
9359,
29914,
13405,
4187,
1358,
13,
2202,
29901,
13,
1678,
515,
4094,
4187,
1358,
1053,
6055,
13,
19499,
16032,
2392,
29901,
13,
1678,
6055,
353,
6571,
13,
13,
2917,
353,
6055,
29889,
657,
877,
29928,
29366,
8456,
29990,
29918,
8618,
13044,
1001,
29918,
25903,
742,
426,
1800,
13,
13,
13,
25416,
29918,
4219,
353,
2295,
29889,
657,
877,
25416,
29918,
4219,
742,
525,
991,
597,
2754,
29889,
8865,
1884,
29889,
510,
29914,
29896,
29914,
1495,
13,
25416,
29918,
22412,
3919,
29918,
4219,
353,
2295,
29889,
657,
877,
25416,
29918,
22412,
3919,
29918,
4219,
742,
525,
991,
597,
2754,
29899,
3051,
29889,
8865,
1884,
29889,
510,
29914,
29896,
29914,
1495,
13,
2
] |
restrictive_growth_strings.py | oversj96/PyKabe | 1 | 36889 | """restrictive_growth_strings.py: Constructs the lexicographic
restrictive growth string representation of all the way to partition a set,
given the length of the set."""
__author__ = "<NAME>"
__copyright__ = "oversj96.github.io"
def set_to_zero(working_set, index):
"""Given a set and an index, set all elements to 0 after the index."""
if index == len(working_set) - 1:
return working_set
else:
for i in range(index + 1, len(working_set)):
working_set[i] = 0
return working_set
def update_b_row(a_row, b_row):
"""Update b row to reflect the max value of a sequence range in row a"""
for i in range(1, len(a_row)):
b_row[i - 1] = max(a_row[:i]) + 1
return b_row
def restrictive_growth_strings(length):
"""Returns the set of all partitions of a set in a lexicographic integer format.
The algorithm is based on Donald Knuth's volume 4A on combinatoric algorithms.
Algorithm H."""
n = length - 1
a_string = [0 for i in range(0, length)]
b_string = [1 for i in range(0, n)]
lexico_string = [a_string.copy()]
incrementable = True
while incrementable:
incrementable = False
for index in range(n, 0, -1):
if a_string[index] < n and a_string[index] < b_string[index - 1]:
incrementable = True
a_string[index] += 1
a_string = set_to_zero(a_string, index)
b_string = update_b_row(a_string, b_string)
lexico_string.append(a_string.copy())
break
return lexico_string
if __name__ == "__main__":
"""A quick way to check if the module works correctly is to compare
the partition count to the bell number of the correct 'n' size.
For a set of 7 elements, the partition count should be 877 by Bell's numbers."""
strings = restrictive_growth_strings(7)
for string in strings:
print(string)
print(len(strings))
| [
1,
9995,
5060,
4146,
573,
29918,
29887,
798,
386,
29918,
19651,
29889,
2272,
29901,
1281,
4984,
29879,
278,
19566,
293,
12122,
13,
9250,
573,
14321,
1347,
8954,
310,
599,
278,
982,
304,
8877,
263,
731,
29892,
13,
2183,
278,
3309,
310,
278,
731,
1213,
15945,
13,
13,
1649,
8921,
1649,
353,
9872,
5813,
11903,
13,
1649,
8552,
1266,
1649,
353,
376,
29877,
874,
29926,
29929,
29953,
29889,
3292,
29889,
601,
29908,
13,
13,
13,
1753,
731,
29918,
517,
29918,
9171,
29898,
22899,
29918,
842,
29892,
2380,
1125,
13,
1678,
9995,
29954,
5428,
263,
731,
322,
385,
2380,
29892,
731,
599,
3161,
304,
29871,
29900,
1156,
278,
2380,
1213,
15945,
13,
1678,
565,
2380,
1275,
7431,
29898,
22899,
29918,
842,
29897,
448,
29871,
29896,
29901,
13,
4706,
736,
1985,
29918,
842,
13,
1678,
1683,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
2248,
718,
29871,
29896,
29892,
7431,
29898,
22899,
29918,
842,
22164,
13,
9651,
1985,
29918,
842,
29961,
29875,
29962,
353,
29871,
29900,
13,
4706,
736,
1985,
29918,
842,
13,
13,
13,
1753,
2767,
29918,
29890,
29918,
798,
29898,
29874,
29918,
798,
29892,
289,
29918,
798,
1125,
13,
1678,
9995,
6422,
289,
1948,
304,
9432,
278,
4236,
995,
310,
263,
5665,
3464,
297,
1948,
263,
15945,
29908,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
29874,
29918,
798,
22164,
13,
4706,
289,
29918,
798,
29961,
29875,
448,
29871,
29896,
29962,
353,
4236,
29898,
29874,
29918,
798,
7503,
29875,
2314,
718,
29871,
29896,
13,
1678,
736,
289,
29918,
798,
13,
13,
13,
1753,
9250,
573,
29918,
29887,
798,
386,
29918,
19651,
29898,
2848,
1125,
13,
1678,
9995,
11609,
29879,
278,
731,
310,
599,
23629,
310,
263,
731,
297,
263,
19566,
293,
12122,
6043,
3402,
29889,
13,
1678,
450,
5687,
338,
2729,
373,
18935,
8360,
2806,
29915,
29879,
7977,
29871,
29946,
29909,
373,
5769,
1061,
293,
14009,
29889,
13,
1678,
29068,
379,
1213,
15945,
13,
1678,
302,
353,
3309,
448,
29871,
29896,
13,
1678,
263,
29918,
1807,
353,
518,
29900,
363,
474,
297,
3464,
29898,
29900,
29892,
3309,
4638,
13,
1678,
289,
29918,
1807,
353,
518,
29896,
363,
474,
297,
3464,
29898,
29900,
29892,
302,
4638,
13,
1678,
454,
13821,
29918,
1807,
353,
518,
29874,
29918,
1807,
29889,
8552,
580,
29962,
13,
1678,
11924,
519,
353,
5852,
13,
1678,
1550,
11924,
519,
29901,
13,
4706,
11924,
519,
353,
7700,
13,
4706,
363,
2380,
297,
3464,
29898,
29876,
29892,
29871,
29900,
29892,
448,
29896,
1125,
13,
9651,
565,
263,
29918,
1807,
29961,
2248,
29962,
529,
302,
322,
263,
29918,
1807,
29961,
2248,
29962,
529,
289,
29918,
1807,
29961,
2248,
448,
29871,
29896,
5387,
13,
18884,
11924,
519,
353,
5852,
13,
18884,
263,
29918,
1807,
29961,
2248,
29962,
4619,
29871,
29896,
13,
18884,
263,
29918,
1807,
353,
731,
29918,
517,
29918,
9171,
29898,
29874,
29918,
1807,
29892,
2380,
29897,
13,
18884,
289,
29918,
1807,
353,
2767,
29918,
29890,
29918,
798,
29898,
29874,
29918,
1807,
29892,
289,
29918,
1807,
29897,
13,
18884,
454,
13821,
29918,
1807,
29889,
4397,
29898,
29874,
29918,
1807,
29889,
8552,
3101,
13,
18884,
2867,
13,
1678,
736,
454,
13821,
29918,
1807,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
9995,
29909,
4996,
982,
304,
1423,
565,
278,
3883,
1736,
5149,
338,
304,
7252,
13,
1678,
278,
8877,
2302,
304,
278,
22623,
1353,
310,
278,
1959,
525,
29876,
29915,
2159,
29889,
13,
1678,
1152,
263,
731,
310,
29871,
29955,
3161,
29892,
278,
8877,
2302,
881,
367,
29871,
29947,
29955,
29955,
491,
10914,
29915,
29879,
3694,
1213,
15945,
13,
1678,
6031,
353,
9250,
573,
29918,
29887,
798,
386,
29918,
19651,
29898,
29955,
29897,
13,
1678,
363,
1347,
297,
6031,
29901,
13,
4706,
1596,
29898,
1807,
29897,
13,
1678,
1596,
29898,
2435,
29898,
19651,
876,
13,
2
] |
tests/test_inchi.py | ginkgobioworks/pychemy | 3 | 25988 | <filename>tests/test_inchi.py
from __future__ import print_function
import unittest
import six
from pychemy.inchi import InChI
class InchiTest(unittest.TestCase):
def test_unicode_inchi(self):
inchi_str = six.u('InChI=1S/C14H18O8/c1-20-9-4-7(5-15)2-3-8(9)21-14-13(19)12(18)11(17)10(6-16)22-14/h2-5,10-14,16-19H,6H2,1H3/t10-,11-,12+,13-,14-/m1/s1')
inchi = InChI(inchi_str)
formula = inchi.formula
self.assertEqual(formula.formula, 'C14H18O8')
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
262,
4161,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
5215,
443,
27958,
13,
13,
5215,
4832,
13,
3166,
282,
3376,
6764,
29889,
262,
4161,
1053,
512,
1451,
29902,
13,
13,
1990,
512,
4161,
3057,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
29871,
822,
1243,
29918,
2523,
356,
29918,
262,
4161,
29898,
1311,
1125,
13,
1678,
297,
4161,
29918,
710,
353,
4832,
29889,
29884,
877,
797,
1451,
29902,
29922,
29896,
29903,
29914,
29907,
29896,
29946,
29950,
29896,
29947,
29949,
29947,
29914,
29883,
29896,
29899,
29906,
29900,
29899,
29929,
29899,
29946,
29899,
29955,
29898,
29945,
29899,
29896,
29945,
29897,
29906,
29899,
29941,
29899,
29947,
29898,
29929,
29897,
29906,
29896,
29899,
29896,
29946,
29899,
29896,
29941,
29898,
29896,
29929,
29897,
29896,
29906,
29898,
29896,
29947,
29897,
29896,
29896,
29898,
29896,
29955,
29897,
29896,
29900,
29898,
29953,
29899,
29896,
29953,
29897,
29906,
29906,
29899,
29896,
29946,
29914,
29882,
29906,
29899,
29945,
29892,
29896,
29900,
29899,
29896,
29946,
29892,
29896,
29953,
29899,
29896,
29929,
29950,
29892,
29953,
29950,
29906,
29892,
29896,
29950,
29941,
29914,
29873,
29896,
29900,
15767,
29896,
29896,
15767,
29896,
29906,
29974,
29892,
29896,
29941,
15767,
29896,
29946,
29899,
29914,
29885,
29896,
29914,
29879,
29896,
1495,
13,
1678,
297,
4161,
353,
512,
1451,
29902,
29898,
262,
4161,
29918,
710,
29897,
13,
1678,
7063,
353,
297,
4161,
29889,
689,
2497,
13,
1678,
1583,
29889,
9294,
9843,
29898,
689,
2497,
29889,
689,
2497,
29892,
525,
29907,
29896,
29946,
29950,
29896,
29947,
29949,
29947,
1495,
13,
2
] |
aser/server/cli.py | HKUST-KnowComp/CSKB-Population | 13 | 170992 | <gh_stars>10-100
def main():
from aser.server import ASERServer
from aser.utils.config import get_server_args_parser
parser = get_server_args_parser()
args = parser.parse_args()
ASERServer(args)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
1753,
1667,
7295,
13,
1678,
515,
408,
261,
29889,
2974,
1053,
3339,
1001,
6004,
13,
1678,
515,
408,
261,
29889,
13239,
29889,
2917,
1053,
679,
29918,
2974,
29918,
5085,
29918,
16680,
13,
1678,
13812,
353,
679,
29918,
2974,
29918,
5085,
29918,
16680,
580,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
3339,
1001,
6004,
29898,
5085,
29897,
13,
13,
2
] |
order/models/customers.py | fbsamples/cp_reference | 2 | 26310 | <reponame>fbsamples/cp_reference
# Copyright 2004-present, Facebook. All Rights Reserved.
from django.db import models
from core.models import BaseModel
class Customer(BaseModel):
"""Represent a single customer instance
fields:
store: the store this customer belongs to
full_name: customer full name
email: customer email
addr: customer shipping addr
"""
store = models.ForeignKey("shop.Store", null=True, on_delete=models.SET_NULL)
full_name = models.CharField(max_length=255)
email = models.CharField(max_length=255)
addr = models.TextField(blank=True, null=True)
def __str__(self):
return self.full_name
| [
1,
529,
276,
1112,
420,
29958,
29888,
5824,
9422,
29914,
6814,
29918,
5679,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29900,
29946,
29899,
6338,
29892,
13327,
29889,
2178,
26863,
2538,
9841,
29889,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
7136,
29889,
9794,
1053,
7399,
3195,
13,
13,
13,
1990,
21886,
29898,
5160,
3195,
1125,
13,
1678,
9995,
1123,
6338,
263,
2323,
11962,
2777,
13,
13,
1678,
4235,
29901,
13,
1678,
3787,
29901,
278,
3787,
445,
11962,
14393,
304,
13,
1678,
2989,
29918,
978,
29901,
11962,
2989,
1024,
13,
1678,
4876,
29901,
11962,
4876,
13,
1678,
28915,
29901,
11962,
528,
17347,
28915,
13,
1678,
9995,
13,
13,
1678,
3787,
353,
4733,
29889,
27755,
2558,
703,
19032,
29889,
9044,
613,
1870,
29922,
5574,
29892,
373,
29918,
8143,
29922,
9794,
29889,
10490,
29918,
10074,
29897,
13,
1678,
2989,
29918,
978,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29897,
13,
1678,
4876,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29897,
13,
1678,
28915,
353,
4733,
29889,
15778,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
8159,
29918,
978,
13,
2
] |
pysoundcloud/client.py | omarcostahamido/PySoundCloud | 4 | 14144 | <filename>pysoundcloud/client.py
import re
import requests
from typing import Union
from pysoundcloud.soundcloudplaylists import SoundCloudPlaylists
from pysoundcloud.soundcloudsearchresults import SoundCloudSearchResults
from pysoundcloud.soundcloudlikedtracks import SoundCloudLikedTracks
from pysoundcloud.soundcloudplaylist import SoundCloudPlaylist
from pysoundcloud.soundcloudtrack import SoundCloudTrack
from pysoundcloud.soundcloudrelatedtracks import SoundCloudRelatedTracks
class Client:
base_url: str = "https://api-v2.soundcloud.com/"
client_id: str = ""
"""
:var base_url: The base url for all requests to the SoundCloud API
:var client_id: The client ID to use with the SoundCloud API
"""
def __init__(self, client_id: str) -> None:
"""
Setup the SoundCloud client to interact with the API
:param client_id: Your SoundCloud client ID
:return: None
"""
self.client_id = client_id
def search(self,
query: str,
limit: int = 10,
offset: int = 0) -> Union[bool, SoundCloudSearchResults]:
"""
Search SoundCloud for the specified query
For some reason it doesn't always work and I have no clue why
:param query: The query to search for
:param limit: The number of results to return
:param offset: The start position from 0
:return: SoundCloudSearchResults, or False if response is not 200
"""
parameters = {"q": query,
"limit": limit,
"offset": offset,
"client_id": self.client_id}
url = self.base_url + "search"
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudSearchResults(response, client_id=self.client_id, parent=self)
def track(self, track_id: int) -> Union[bool, SoundCloudTrack]:
"""
Gets data about the track with the specified track_id
:param track_id: The track id to search for
:return: a SoundCloudTrack with data about the track, or False if response is not 200
"""
parameters = {"client_id": self.client_id}
url = self.base_url + "tracks/{}".format(track_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudTrack(response.json(), self.client_id, parent=self)
def related(self, track_id: int, limit: int = 10, offset: int = 0) -> Union[bool, SoundCloudRelatedTracks]:
"""
Gets tracks related to the specified track_id
:param track_id: The track id to find related tracks for
:param limit: The number of tracks to find
:param offset: The number of tracks to search for from zero, so offset 10 and limit 10 means find tracks 10-20
:return: SoundCloudRelatedTracks with the tracks, or False if response is not 200
"""
parameters = {"limit": limit,
"offset": offset,
"client_id": self.client_id}
url = self.base_url + "tracks/{}/related".format(track_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudRelatedTracks(response.json(), self.client_id)
def playlists(self,
track_id: int,
representation: str = "mini",
limit: int = 10,
offset: int = 0) -> Union[bool, SoundCloudPlaylists]:
"""
Gets playlists containing a specified track
:param track_id: The track ID to find playlists containing
:param representation: The type of representation (either full or mini)
:param limit: The number of results to return
:param offset: The start position from 0
:return: SoundCloudPlaylists containing the track, or False if response is not 200
"""
parameters = {"representation": representation,
"limit": limit,
"offset": offset,
"client_id": self.client_id}
url = self.base_url + "tracks/{}/playlists_without_albums".format(track_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudPlaylists(response.json(), self.client_id, parent=self)
def albums(self,
track_id: int,
representation: str = "mini",
limit: int = 10,
offset: int = 0) -> Union[bool, SoundCloudPlaylists]:
"""
Gets albums containing a specified track
:param track_id: The track ID to find albums containing
:param representation: The type of representation (either full or mini)
:param limit: The number of results to return
:param offset: The start position from 0
:return: SoundCloudPlaylists containing the track, or False if response is not 200
"""
parameters = {"representation": representation,
"limit": limit,
"offset": offset,
"client_id": self.client_id}
url = self.base_url + "tracks/{}/albums".format(track_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
if (len(response.json()["collection"]) == 0):
return False
return SoundCloudPlaylists(response.json(), self.client_id)
def comments(self):
"""
.. todo::
Add a function to get comments on a specific track or by a specific user
"""
pass # Todo: add comments
def web_profiles(self):
"""
.. todo::
Add a function to get the "web profiles" of a specific user
"""
pass # Todo: add web_profiles
def liked_tracks(self,
user_id: int,
limit: int = 24,
offset: int = 0) -> Union[bool, SoundCloudLikedTracks]:
"""
Gets the user's liked tracks
:param user_id: The ID of the user to find liked tracks for
:param limit: The number of results to return
:param offset: The start position from 0
:return: SoundCloudLikedTracks containing all the tracks, or False if response is not 200
"""
parameters = {"client_id": self.client_id,
"limit": limit,
"offset": offset}
url = self.base_url + "users/{}/track_likes".format(user_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudLikedTracks(response, client_id=self.client_id)
def playlist(self,
playlist_id: int = None,
playlist_url: str = None,
representation: str = "full",
secret_token: str = None) -> Union[bool, SoundCloudPlaylist]:
"""
Get a playlist based on a specified playlist_id or playlist_url
:param playlist_id: The ID of the playlist
:param playlist_url: The URL of the playlist
:param representation: The playlist representation (either fill or mini)
:param secret_token: An optional secret token
:return: A SoundCloudPlaylist, or False if response is not 200
"""
if (playlist_id is None):
if (playlist_url is not None):
response = requests.get(playlist_url)
patterns = [
r'<meta property="twitter:app:url:(?:googleplay|iphone|ipad)'
r'content="soundcloud:\/\/playlists:([0-9]+)">',
r'<meta property="twitter:player" content="https:\/\/w\.soundcloud\.com\/player\/\?url=https'
r'%3(?:a|A)%2(?:f|F)%2(?:f|F)api\.soundcloud\.com%2(?:f|F)playlists%2(?:f|F)([0-9]+)',
r'<meta property="al:(?:ios|android):url" content="soundcloud:\/\/playlists:([0-9]+)">',
r'<link rel="alternate" href="android-app:\/\/com\.soundcloud\.android\/soundcloud\/'
r'playlists:([0-9]+)">',
r'<link rel="alternate" href="ios-app:\/\/336353151\/soundcloud\/playlists:([0-9]+)">'
]
for pattern in patterns:
if (playlist_id is None):
search_results = re.search(pattern,
response.text)
if (search_results is not None):
playlist_id = search_results.group(1)
if (playlist_id is None):
print("Error: Could not find the playlist id from the url \"{}\"".format(playlist_url))
return False
parameters = {"representation": representation,
"client_id": self.client_id}
if (secret_token is not None):
parameters["secret_token"] = secret_token
url = self.base_url + "playlists/{}".format(playlist_id)
response = requests.get(url, params=parameters)
if (response.status_code != 200):
print("Error: Received code {}".format(response.status_code))
return False
return SoundCloudPlaylist(response.json(),
self.client_id,
parent=self)
| [
1,
529,
9507,
29958,
29886,
952,
618,
9274,
29914,
4645,
29889,
2272,
13,
5215,
337,
30004,
13,
5215,
7274,
30004,
13,
30004,
13,
3166,
19229,
1053,
7761,
30004,
13,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
1456,
21513,
1053,
14976,
20442,
13454,
21513,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
4478,
9902,
1053,
14976,
20442,
7974,
12191,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
5081,
287,
3018,
4684,
1053,
14976,
20442,
29931,
638,
287,
5323,
4684,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
1456,
1761,
1053,
14976,
20442,
13454,
1761,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
11294,
1053,
14976,
20442,
17936,
30004,
13,
3166,
282,
952,
618,
9274,
29889,
29802,
9274,
12817,
3018,
4684,
1053,
14976,
20442,
9662,
630,
5323,
4684,
30004,
13,
30004,
13,
30004,
13,
1990,
12477,
29901,
30004,
13,
1678,
2967,
29918,
2271,
29901,
851,
353,
376,
991,
597,
2754,
29899,
29894,
29906,
29889,
29802,
9274,
29889,
510,
12975,
30004,
13,
1678,
3132,
29918,
333,
29901,
851,
353,
5124,
30004,
13,
30004,
13,
1678,
9995,
30004,
13,
1678,
584,
1707,
2967,
29918,
2271,
29901,
450,
2967,
3142,
363,
599,
7274,
304,
278,
14976,
20442,
3450,
30004,
13,
1678,
584,
1707,
3132,
29918,
333,
29901,
450,
3132,
3553,
304,
671,
411,
278,
14976,
20442,
3450,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3132,
29918,
333,
29901,
851,
29897,
1599,
6213,
29901,
30004,
13,
4706,
9995,
30004,
13,
4706,
3789,
786,
278,
14976,
20442,
3132,
304,
16254,
411,
278,
3450,
30004,
13,
30004,
13,
4706,
584,
3207,
3132,
29918,
333,
29901,
3575,
14976,
20442,
3132,
3553,
30004,
13,
4706,
584,
2457,
29901,
6213,
30004,
13,
4706,
9995,
30004,
13,
4706,
1583,
29889,
4645,
29918,
333,
353,
3132,
29918,
333,
30004,
13,
30004,
13,
1678,
822,
2740,
29898,
1311,
11167,
13,
1669,
2346,
29901,
851,
11167,
13,
1669,
4046,
29901,
938,
353,
29871,
29896,
29900,
11167,
13,
1669,
9210,
29901,
938,
353,
29871,
29900,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
7974,
12191,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
11856,
14976,
20442,
363,
278,
6790,
2346,
30004,
13,
4706,
1152,
777,
2769,
372,
1838,
29915,
29873,
2337,
664,
322,
306,
505,
694,
23960,
2020,
30004,
13,
30004,
13,
4706,
584,
3207,
2346,
29901,
450,
2346,
304,
2740,
363,
30004,
13,
4706,
584,
3207,
4046,
29901,
450,
1353,
310,
2582,
304,
736,
30004,
13,
4706,
584,
3207,
9210,
29901,
450,
1369,
2602,
515,
29871,
29900,
30004,
13,
4706,
584,
2457,
29901,
14976,
20442,
7974,
12191,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
29939,
1115,
2346,
11167,
13,
462,
418,
376,
13400,
1115,
4046,
11167,
13,
462,
418,
376,
10289,
1115,
9210,
11167,
13,
462,
418,
376,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
4478,
19451,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
30004,
13,
4706,
736,
14976,
20442,
7974,
12191,
29898,
5327,
29892,
3132,
29918,
333,
29922,
1311,
29889,
4645,
29918,
333,
29892,
3847,
29922,
1311,
8443,
13,
30004,
13,
1678,
822,
5702,
29898,
1311,
29892,
5702,
29918,
333,
29901,
938,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
17936,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
402,
1691,
848,
1048,
278,
5702,
411,
278,
6790,
5702,
29918,
333,
30004,
13,
30004,
13,
4706,
584,
3207,
5702,
29918,
333,
29901,
450,
5702,
1178,
304,
2740,
363,
30004,
13,
4706,
584,
2457,
29901,
263,
14976,
20442,
17936,
411,
848,
1048,
278,
5702,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
3018,
4684,
29914,
8875,
1642,
4830,
29898,
11294,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
736,
14976,
20442,
17936,
29898,
5327,
29889,
3126,
3285,
1583,
29889,
4645,
29918,
333,
29892,
3847,
29922,
1311,
8443,
13,
30004,
13,
1678,
822,
4475,
29898,
1311,
29892,
5702,
29918,
333,
29901,
938,
29892,
4046,
29901,
938,
353,
29871,
29896,
29900,
29892,
9210,
29901,
938,
353,
29871,
29900,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
9662,
630,
5323,
4684,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
402,
1691,
16257,
4475,
304,
278,
6790,
5702,
29918,
333,
30004,
13,
30004,
13,
4706,
584,
3207,
5702,
29918,
333,
29901,
450,
5702,
1178,
304,
1284,
4475,
16257,
363,
30004,
13,
4706,
584,
3207,
4046,
29901,
450,
1353,
310,
16257,
304,
1284,
30004,
13,
4706,
584,
3207,
9210,
29901,
450,
1353,
310,
16257,
304,
2740,
363,
515,
5225,
29892,
577,
9210,
29871,
29896,
29900,
322,
4046,
29871,
29896,
29900,
2794,
1284,
16257,
29871,
29896,
29900,
29899,
29906,
29900,
30004,
13,
4706,
584,
2457,
29901,
14976,
20442,
9662,
630,
5323,
4684,
411,
278,
16257,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
13400,
1115,
4046,
11167,
13,
462,
418,
376,
10289,
1115,
9210,
11167,
13,
462,
418,
376,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
3018,
4684,
19248,
6822,
12817,
1642,
4830,
29898,
11294,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
736,
14976,
20442,
9662,
630,
5323,
4684,
29898,
5327,
29889,
3126,
3285,
1583,
29889,
4645,
29918,
333,
8443,
13,
30004,
13,
1678,
822,
1708,
21513,
29898,
1311,
11167,
13,
462,
29871,
5702,
29918,
333,
29901,
938,
11167,
13,
462,
29871,
8954,
29901,
851,
353,
376,
1195,
29875,
15231,
13,
462,
29871,
4046,
29901,
938,
353,
29871,
29896,
29900,
11167,
13,
462,
29871,
9210,
29901,
938,
353,
29871,
29900,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
13454,
21513,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
402,
1691,
1708,
21513,
6943,
263,
6790,
5702,
30004,
13,
30004,
13,
4706,
584,
3207,
5702,
29918,
333,
29901,
450,
5702,
3553,
304,
1284,
1708,
21513,
6943,
30004,
13,
4706,
584,
3207,
8954,
29901,
450,
1134,
310,
8954,
313,
29872,
2121,
2989,
470,
20629,
8443,
13,
4706,
584,
3207,
4046,
29901,
450,
1353,
310,
2582,
304,
736,
30004,
13,
4706,
584,
3207,
9210,
29901,
450,
1369,
2602,
515,
29871,
29900,
30004,
13,
4706,
584,
2457,
29901,
14976,
20442,
13454,
21513,
6943,
278,
5702,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
276,
26081,
1115,
8954,
11167,
13,
462,
418,
376,
13400,
1115,
4046,
11167,
13,
462,
418,
376,
10289,
1115,
9210,
11167,
13,
462,
418,
376,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
3018,
4684,
19248,
6822,
1456,
21513,
29918,
14037,
29918,
10336,
29879,
1642,
4830,
29898,
11294,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
736,
14976,
20442,
13454,
21513,
29898,
5327,
29889,
3126,
3285,
1583,
29889,
4645,
29918,
333,
29892,
3847,
29922,
1311,
8443,
13,
30004,
13,
1678,
822,
20618,
29898,
1311,
11167,
13,
1669,
5702,
29918,
333,
29901,
938,
11167,
13,
1669,
8954,
29901,
851,
353,
376,
1195,
29875,
15231,
13,
1669,
4046,
29901,
938,
353,
29871,
29896,
29900,
11167,
13,
1669,
9210,
29901,
938,
353,
29871,
29900,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
13454,
21513,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
402,
1691,
20618,
6943,
263,
6790,
5702,
30004,
13,
30004,
13,
4706,
584,
3207,
5702,
29918,
333,
29901,
450,
5702,
3553,
304,
1284,
20618,
6943,
30004,
13,
4706,
584,
3207,
8954,
29901,
450,
1134,
310,
8954,
313,
29872,
2121,
2989,
470,
20629,
8443,
13,
4706,
584,
3207,
4046,
29901,
450,
1353,
310,
2582,
304,
736,
30004,
13,
4706,
584,
3207,
9210,
29901,
450,
1369,
2602,
515,
29871,
29900,
30004,
13,
4706,
584,
2457,
29901,
14976,
20442,
13454,
21513,
6943,
278,
5702,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
276,
26081,
1115,
8954,
11167,
13,
462,
418,
376,
13400,
1115,
4046,
11167,
13,
462,
418,
376,
10289,
1115,
9210,
11167,
13,
462,
418,
376,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
3018,
4684,
19248,
6822,
10336,
29879,
1642,
4830,
29898,
11294,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
565,
313,
2435,
29898,
5327,
29889,
3126,
580,
3366,
10855,
20068,
1275,
29871,
29900,
1125,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
736,
14976,
20442,
13454,
21513,
29898,
5327,
29889,
3126,
3285,
1583,
29889,
4645,
29918,
333,
8443,
13,
30004,
13,
1678,
822,
6589,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
6317,
10481,
1057,
30004,
13,
9651,
3462,
263,
740,
304,
679,
6589,
373,
263,
2702,
5702,
470,
491,
263,
2702,
1404,
30004,
13,
4706,
9995,
30004,
13,
4706,
1209,
29871,
396,
7561,
29877,
29901,
788,
6589,
30004,
13,
30004,
13,
1678,
822,
1856,
29918,
771,
5325,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
6317,
10481,
1057,
30004,
13,
9651,
3462,
263,
740,
304,
679,
278,
376,
2676,
28723,
29908,
310,
263,
2702,
1404,
30004,
13,
4706,
9995,
30004,
13,
4706,
1209,
29871,
396,
7561,
29877,
29901,
788,
1856,
29918,
771,
5325,
30004,
13,
30004,
13,
1678,
822,
23289,
29918,
3018,
4684,
29898,
1311,
11167,
13,
462,
268,
1404,
29918,
333,
29901,
938,
11167,
13,
462,
268,
4046,
29901,
938,
353,
29871,
29906,
29946,
11167,
13,
462,
268,
9210,
29901,
938,
353,
29871,
29900,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
29931,
638,
287,
5323,
4684,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
402,
1691,
278,
1404,
29915,
29879,
23289,
16257,
30004,
13,
30004,
13,
4706,
584,
3207,
1404,
29918,
333,
29901,
450,
3553,
310,
278,
1404,
304,
1284,
23289,
16257,
363,
30004,
13,
4706,
584,
3207,
4046,
29901,
450,
1353,
310,
2582,
304,
736,
30004,
13,
4706,
584,
3207,
9210,
29901,
450,
1369,
2602,
515,
29871,
29900,
30004,
13,
4706,
584,
2457,
29901,
14976,
20442,
29931,
638,
287,
5323,
4684,
6943,
599,
278,
16257,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
4128,
353,
8853,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
11167,
13,
462,
418,
376,
13400,
1115,
4046,
11167,
13,
462,
418,
376,
10289,
1115,
9210,
8117,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
7193,
19248,
6822,
11294,
29918,
5081,
267,
1642,
4830,
29898,
1792,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
30004,
13,
4706,
736,
14976,
20442,
29931,
638,
287,
5323,
4684,
29898,
5327,
29892,
3132,
29918,
333,
29922,
1311,
29889,
4645,
29918,
333,
8443,
13,
30004,
13,
1678,
822,
1708,
1761,
29898,
1311,
11167,
13,
462,
1708,
1761,
29918,
333,
29901,
938,
353,
6213,
11167,
13,
462,
1708,
1761,
29918,
2271,
29901,
851,
353,
6213,
11167,
13,
462,
8954,
29901,
851,
353,
376,
8159,
15231,
13,
462,
7035,
29918,
6979,
29901,
851,
353,
6213,
29897,
1599,
7761,
29961,
11227,
29892,
14976,
20442,
13454,
1761,
5387,
30004,
13,
4706,
9995,
30004,
13,
4706,
3617,
263,
1708,
1761,
2729,
373,
263,
6790,
1708,
1761,
29918,
333,
470,
1708,
1761,
29918,
2271,
30004,
13,
30004,
13,
4706,
584,
3207,
1708,
1761,
29918,
333,
29901,
450,
3553,
310,
278,
1708,
1761,
30004,
13,
4706,
584,
3207,
1708,
1761,
29918,
2271,
29901,
450,
3988,
310,
278,
1708,
1761,
30004,
13,
4706,
584,
3207,
8954,
29901,
450,
1708,
1761,
8954,
313,
29872,
2121,
5445,
470,
20629,
8443,
13,
4706,
584,
3207,
7035,
29918,
6979,
29901,
530,
13136,
7035,
5993,
30004,
13,
4706,
584,
2457,
29901,
319,
14976,
20442,
13454,
1761,
29892,
470,
7700,
565,
2933,
338,
451,
29871,
29906,
29900,
29900,
30004,
13,
4706,
9995,
30004,
13,
4706,
565,
313,
1456,
1761,
29918,
333,
338,
6213,
1125,
30004,
13,
9651,
565,
313,
1456,
1761,
29918,
2271,
338,
451,
6213,
1125,
30004,
13,
18884,
2933,
353,
7274,
29889,
657,
29898,
1456,
1761,
29918,
2271,
8443,
13,
18884,
15038,
353,
518,
30004,
13,
462,
1678,
364,
29915,
29966,
7299,
2875,
543,
24946,
29901,
932,
29901,
2271,
5919,
25825,
3608,
1456,
29989,
29875,
6710,
29989,
666,
328,
16029,
30004,
13,
462,
1678,
364,
29915,
3051,
543,
29802,
9274,
3583,
7998,
29914,
1456,
21513,
29901,
4197,
29900,
29899,
29929,
10062,
29897,
1013,
23592,
13,
462,
1678,
364,
29915,
29966,
7299,
2875,
543,
24946,
29901,
9106,
29908,
2793,
543,
991,
3583,
7998,
29914,
29893,
23301,
29802,
9274,
23301,
510,
25558,
9106,
29905,
7998,
29973,
2271,
29922,
991,
29915,
30004,
13,
462,
1678,
364,
29915,
29995,
29941,
10780,
29901,
29874,
29989,
29909,
29897,
29995,
29906,
10780,
29901,
29888,
29989,
29943,
29897,
29995,
29906,
10780,
29901,
29888,
29989,
29943,
29897,
2754,
23301,
29802,
9274,
23301,
510,
29995,
29906,
10780,
29901,
29888,
29989,
29943,
29897,
1456,
21513,
29995,
29906,
10780,
29901,
29888,
29989,
29943,
29897,
4197,
29900,
29899,
29929,
10062,
29897,
23592,
13,
462,
1678,
364,
29915,
29966,
7299,
2875,
543,
284,
5919,
25825,
2363,
29989,
2843,
1125,
2271,
29908,
2793,
543,
29802,
9274,
3583,
7998,
29914,
1456,
21513,
29901,
4197,
29900,
29899,
29929,
10062,
29897,
1013,
23592,
13,
462,
1678,
364,
29915,
29966,
2324,
1104,
543,
26123,
403,
29908,
2822,
543,
2843,
29899,
932,
3583,
7998,
29914,
510,
23301,
29802,
9274,
23301,
2843,
25558,
29802,
9274,
29905,
22208,
30004,
13,
462,
1678,
364,
29915,
1456,
21513,
29901,
4197,
29900,
29899,
29929,
10062,
29897,
1013,
23592,
13,
462,
1678,
364,
29915,
29966,
2324,
1104,
543,
26123,
403,
29908,
2822,
543,
2363,
29899,
932,
3583,
7998,
29914,
29941,
29941,
29953,
29941,
29945,
29941,
29896,
29945,
29896,
25558,
29802,
9274,
25558,
1456,
21513,
29901,
4197,
29900,
29899,
29929,
10062,
29897,
1013,
29915,
30004,
13,
18884,
4514,
30004,
13,
30004,
13,
18884,
363,
4766,
297,
15038,
29901,
30004,
13,
462,
1678,
565,
313,
1456,
1761,
29918,
333,
338,
6213,
1125,
30004,
13,
462,
4706,
2740,
29918,
9902,
353,
337,
29889,
4478,
29898,
11037,
11167,
13,
462,
462,
462,
259,
2933,
29889,
726,
8443,
13,
462,
4706,
565,
313,
4478,
29918,
9902,
338,
451,
6213,
1125,
30004,
13,
462,
9651,
1708,
1761,
29918,
333,
353,
2740,
29918,
9902,
29889,
2972,
29898,
29896,
8443,
13,
4706,
565,
313,
1456,
1761,
29918,
333,
338,
6213,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
6527,
451,
1284,
278,
1708,
1761,
1178,
515,
278,
3142,
13218,
29912,
1012,
29908,
1642,
4830,
29898,
1456,
1761,
29918,
2271,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
30004,
13,
4706,
4128,
353,
8853,
276,
26081,
1115,
8954,
11167,
13,
462,
418,
376,
4645,
29918,
333,
1115,
1583,
29889,
4645,
29918,
333,
8117,
13,
4706,
565,
313,
19024,
29918,
6979,
338,
451,
6213,
1125,
30004,
13,
9651,
4128,
3366,
19024,
29918,
6979,
3108,
353,
7035,
29918,
6979,
30004,
13,
4706,
3142,
353,
1583,
29889,
3188,
29918,
2271,
718,
376,
1456,
21513,
29914,
8875,
1642,
4830,
29898,
1456,
1761,
29918,
333,
8443,
13,
4706,
2933,
353,
7274,
29889,
657,
29898,
2271,
29892,
8636,
29922,
16744,
8443,
13,
4706,
565,
313,
5327,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
1125,
30004,
13,
9651,
1596,
703,
2392,
29901,
24328,
2347,
775,
6571,
1642,
4830,
29898,
5327,
29889,
4882,
29918,
401,
876,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
736,
14976,
20442,
13454,
1761,
29898,
5327,
29889,
3126,
3285,
30004,
13,
462,
462,
29871,
1583,
29889,
4645,
29918,
333,
11167,
13,
462,
462,
29871,
3847,
29922,
1311,
8443,
13,
2
] |
app/api/handler/PersonSearch.py | jormanfernandez/crud | 0 | 110207 | import falcon
import json
from data.operators.PersonOperator import PersonOperator
from utils.logger import Log
from utils.form.fields import Fields
fields = Fields()
class PersonSearchHandler(object):
"""
It handles the request to no specific persons
Args:
object (object): No info
"""
def on_get(self, req, resp, mode, value):
"""
Handles the GET for search of persons and gives a list of people that match the search
Args:
req (Falcon HTTP Request): Request received by the server
resp (Falcon HTTP Response): Response constructed by the server
mode (str): The search method to be used (name, lastname, phone, email)
value (str, int): The value to be search
Returns:
None
"""
Log(f"GET Request Received", req=req)
resp.content_type = "application/json"
if mode not in getattr(fields, "field"):
resp.status = falcon.HTTP_400
resp.body = json.dumps({
"msg": "Search method not allowed"
})
else:
resp.status = falcon.HTTP_200
resp.body = json.dumps(PersonOperator.searchBy(key=mode, value=value), ensure_ascii=False)
resp.body += "\n"
| [
1,
1053,
11092,
535,
13,
5215,
4390,
13,
3166,
848,
29889,
3372,
4097,
29889,
7435,
26486,
1053,
5196,
26486,
13,
3166,
3667,
29879,
29889,
21707,
1053,
4522,
13,
3166,
3667,
29879,
29889,
689,
29889,
9621,
1053,
8989,
29879,
13,
13,
9621,
353,
8989,
29879,
580,
13,
13,
1990,
5196,
7974,
4598,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
739,
17766,
278,
2009,
304,
694,
2702,
12407,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1203,
313,
3318,
1125,
1939,
5235,
13,
1678,
9995,
13,
1678,
822,
373,
29918,
657,
29898,
1311,
29892,
12428,
29892,
4613,
29892,
4464,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
5166,
793,
278,
12354,
363,
2740,
310,
12407,
322,
4076,
263,
1051,
310,
2305,
393,
1993,
278,
2740,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
12428,
313,
29943,
284,
535,
7331,
10729,
1125,
10729,
4520,
491,
278,
1923,
13,
9651,
4613,
313,
29943,
284,
535,
7331,
13291,
1125,
13291,
13319,
491,
278,
1923,
13,
9651,
4464,
313,
710,
1125,
450,
2740,
1158,
304,
367,
1304,
313,
978,
29892,
1833,
978,
29892,
9008,
29892,
4876,
29897,
13,
9651,
995,
313,
710,
29892,
938,
1125,
450,
995,
304,
367,
2740,
13,
13,
4706,
16969,
29901,
13,
9651,
6213,
13,
4706,
9995,
13,
4706,
4522,
29898,
29888,
29908,
7194,
10729,
24328,
2347,
613,
12428,
29922,
7971,
29897,
13,
4706,
4613,
29889,
3051,
29918,
1853,
353,
376,
6214,
29914,
3126,
29908,
13,
13,
4706,
565,
4464,
451,
297,
679,
5552,
29898,
9621,
29892,
376,
2671,
29908,
1125,
13,
9651,
4613,
29889,
4882,
353,
11092,
535,
29889,
10493,
29918,
29946,
29900,
29900,
13,
9651,
4613,
29889,
2587,
353,
4390,
29889,
29881,
17204,
3319,
13,
18884,
376,
7645,
1115,
376,
7974,
1158,
451,
6068,
29908,
13,
9651,
5615,
13,
4706,
1683,
29901,
13,
9651,
4613,
29889,
4882,
353,
11092,
535,
29889,
10493,
29918,
29906,
29900,
29900,
13,
9651,
4613,
29889,
2587,
353,
4390,
29889,
29881,
17204,
29898,
7435,
26486,
29889,
4478,
2059,
29898,
1989,
29922,
8513,
29892,
995,
29922,
1767,
511,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
308,
13,
4706,
4613,
29889,
2587,
4619,
6634,
29876,
29908,
13,
268,
2
] |
taut_euler_class.py | henryseg/Veering | 2 | 7614 | <reponame>henryseg/Veering
#
# taut_euler_class.py
#
from file_io import parse_data_file, write_data_file
from taut import liberal, isosig_to_tri_angle
from transverse_taut import is_transverse_taut
from sage.matrix.constructor import Matrix
from sage.modules.free_module_element import vector
from sage.arith.misc import gcd
from sage.arith.functions import lcm
#
# Goal - given a transverse taut triangulation, decide if the
# associated "absolute" euler class is torsion or not. If it is
# torsion, determine its order.
#
# Contents and overview:
# 1. References.
#
# 2. Background.
#
# 3. Helper functions.
#
# 4. Truncate. We build the correct "truncated" cell structure \calT'
# from (M, \calT) and give generators for the cochain groups
# C^k(\calT', \ZZ) (k = 1, 2).
#
# 5. Representative. We find a two-cocycle E \in Z^2(\calT', \ZZ)
# that represents E(\calT) \in H^2(M, \ZZ).
#
# 6. Coboundary. We find the matrix for the coboundary operator
# \delta^1.
#
# 7. Linear algebra. We solve the linear problem to decide if E is a
# coboundary - that is, if E lies in B^2(\calT', \ZZ) - that is, if E
# is in the image of \delta^1.
#
# 8. Remarks.
#
# 9. Calling code
#
# 1. References.
#
# <NAME> - Orderability and Dehn filling
# Ghys - Groups acting on the circle
# Thurston - A norm for the homology of three-manifolds
# <NAME> - Foliations, chapter four
# 2. Background:
# Suppose that (M, \calT) is a transverse taut triangulation. Then
# \calT^{2} is the "horizontal branched surface". This caries various
# laminations, which extend to foliations on M. All of these have the
# same Euler class, which we will denote E(\calT) \in H^2(M, \ZZ).
# Suppose that \calF is a carried foliation and let UT\calF be the
# unit tangent bundle over \calF. The Euler class E vanishes exactly
# when UT\calF has a section; that is, when the unit tangent bundle is
# trivialisable.
# Recall:
# Suppose that X is an F-bundle over B. We have
#
# i
# F -------> X <--.
# | |
# | |
# p| |s
# | |
# v |
# B ---'
#
# So s \from B \to X is a \emph{section} if p \circ s = Id_B
# 3. Helper functions
def diagonal(D):
return [D[i][i] for i in range(min(D.dimensions()))]
# 4. Truncate.
# Suppose that M is a connected, cusped, oriented three-manifold. Let
# C = C(M) \geq 1 be the number of cusps of M. Suppose that \calT is a
# transverse taut ideal triangulation of M. Let T = T(\calT) \geq 1
# be the number of tetrahedra of \calT.
# We use Regina to number and orient the edges \{e_i\}_{i = 0}^{T-1},
# the faces \{f_i\}_{i = 0}^{2T-1}, and the tetrahedra \{t_i\}_{i =
# 0}^{T-1} of \calT. We call all of these \emph{ideal} cells. Note
# that the transverse structure also gives us co-orientations of the
# e_i and the f_i, called "upwards"
# We remove a small open neighbourbood of all ideal vertices of all
# model tetrahedra. This gives the \emph{truncated} cell structure
# \calT'. The remains of the ideal cells are called \emph{truncated}
# cells; we abuse and reuse the notations e_i and f_i for these. The
# truncated cells inherit orientations and co-orientations. The new
# cells are called \emph{peripheral} cells. We number these as
# follows:
# e_{ij} is the peripheral edge cutting vertex v_j off of ideal face f_i
# f_{ij} is the peripheral face cutting vertex v_j off of ideal tetrahedron t_i
# Note that every truncated face is combinatorially a hexagon. The
# boundary of this hexagon contains three truncated edges alternating
# with three peripheral edges. We orient each peripheral edge e_{ij}
# so that the orientation of e_{ij} agrees with the orientation
# induced by \bdy f_i. We orient each peripheral face f_{ij}
# anti-clockwise, as viewed from infinity (that is, from outside of
# M). Also, we equip e_{ij} and f_{ij} with co-orientations pointing
# out of M, called "outward".
# e_{i0}
# ---
# / \
# e_2 / \ e_1
# / \
# / f_i \
# \ /
# e_{i1} --------- e_{i2}
# e_0
# For an edge e or a face f we use e^* and f^* to denote the dual in
# C^1(\calT', \ZZ) or C^2(\calT', \ZZ). Thus \{e^*_i\} \cup
# \{e^*_{ij}\} generates C^1(\calT', \ZZ) while \{f^*_i\} \cup
# \{f^*_{ij}\} generates C^2(\calT', \ZZ).
# For more pictures, see
# /Veering_code/NotesPictures/euler_notes_from_nathan.jpg
# 5. Representative
# We now construct a two-cocycle E \in Z^2(\calT', \ZZ). For every
# peripheral face f we take
# E(f) = 0.
# \begin{remark}
# To see that this is correct, let \calF be any foliation of M,
# transverse to the boundary. Suppose that f is the given peripheral
# triangle. We have a section of the restriction of UT\calF to \bdy
# f; namely the outward field. This extends over f to give a section
# of UT\calF restricted to f. So there is no obstruction to the
# extension. See below for a more precise discussion in terms of
# "Poincar\'e-Hopf index".
# \end{remark}
# Now suppose that f is a truncated face. Suppose that e_0, e_1, e_2
# are its three truncated edges. Recall that these are all oriented.
# Let AC(f) be the number of the edges e_0, e_1, e_2 that are
# oriented anti-clockwise (that is, agree with their induced
# orientation coming from f). We take
# E(f) = AC(f) - 2
# If we flip the transverse direction: AC(f') = 3 - AC(f),
# so E(f') = AC(f') - 2 = 1 - AC(f) = 2 - AC(f) - 1 = -E(f) - 1
# \begin{remark}
# Here is one way to remember (and explain!) this rule. Suppose that
# f is the given truncated face. Suppose that s is a section of UTf |
# \bdy f. Then index(s) is the total rotation of s with respect to
# the tangent field, _plus_ one. This can be rephrased in terms of
# the index of tangent vector fields extending s over all of f.
# Our choices of orientations of edges determine a section of UTf |
# \bdy f. Since all of the boundary edges e_{ij} of f are oriented
# the same way, we choose a standard framing there; Nathan tells us to
# just use the outward pointing section on all of the e_{ij}. Our
# choice of section on e_0 (say) has to (a) depend only on the
# orientation of e_0 and (b) has to be outward at the endpoints of
# e_0. The simplest choice is the section that rotates by +\pi with
# respect to the tangent along \bdy f_i, as we move forward along e_0.
# So s points _back_ at the beginning of e_0, points _right_ in the
# middle of e_0, and points _forwards_ at the end of e_0. The total
# rotation of the resulting field (with respect to the tangent field)
# is AC(f) - 3. Thus E(f) = AC(f) - 2 is the index. You can check
# this works by drawing the four possible pictures and computing the index
# of any extension of s over f.
# \end{remark}
# Claim: \delta^2 E = 0.
# That is, E is a cocycle.
# Proof of claim: Fix a truncated tetrahedron t and fix some oriention
# of its truncated edges. A direct calculation shows that
# \delta E (t) = E \bdy t = 0.
# Likewise, a direct computation shows that switching the orientation
# of a single edge leaves E \bdy t unchanged. QED.
### It would be nice to have a less computational proof!
def euler_cocycle(tri, angle):
"""
Given a regina triangulation "tri", with oriented edges, and a
transverse taut angle structure "angle", returns the associated
two-cocycle E representing the Euler class E(tri).
"""
assert is_transverse_taut(tri, angle)
face_coorientations = is_transverse_taut(tri, angle, return_type = "face_coorientations")
# E will be a _row_ vector, because it eats column vectors.
E = []
# First deal with the truncated faces
for face in tri.faces(2): # 2 = dimension
# First we compute the number of Regina oriented edges that agree with the Regina orientation on face
AC = 0
for i in range(3):
perm = face.faceMapping(1, i)
# print perm[0], perm[1]
if perm[1] == ((perm[0] + 1) % 3): # the edge and face orientations agree so,
AC = AC + 1
# print "AC", AC
# Now we condition on whether or not Regina and angle agree on the (co-)orientation of the face.
if face_coorientations[face.index()] == 1:
E.append(AC - 2)
else:
E.append(1 - AC)
# Now deal with the peripheral faces
for tet in tri.tetrahedra():
for j in range(4):
E.append(0)
return E
# 6. Coboundary
# Suppose that e is a truncated edge. Let LF be the set of truncated
# faces to the left of e and let RF be the set of faces to the right. Then
# \delta e^* = \sum_{f \in LF} f^* - \sum_{f \in RF} f^*.
# Suppose that e is a peripheral edge. So there is a unique truncated
# face f meeting e. Note that f is to the left of e. There are
# also a pair of boundary faces meeting e: say f' _above_ e and f''
# _below_ e. Then
# \delta e^* = f^* + (f')^* - (f'')^*.
def coboundary(tri, angle):
"""
Given a triangulation "tri" (T), with oriented edges, and a
transverse taut angle structure "angle", returns the co-boundary
operator delta^1 \from C^1(T', ZZ) \to C^2(T', ZZ), as a matrix,
for the truncated triangulation T'. Note that, strictly speaking,
we don't need to use "angle" for this, but we use it to determine
orientation on faces for the Euler class, so we might as well use
it again here.
"""
# \delta^1 takes row vectors (functions on edges) and spits out
# row vectors (functions on faces). So, if c is a one-cochain
# then c \cdot \delta is a two-cochain.
delta = []
assert is_transverse_taut(tri, angle)
tet_vert_coorientations = is_transverse_taut(tri, angle, return_type = "tet_vert_coorientations")
face_coorientations = is_transverse_taut(tri, angle, return_type = "face_coorientations")
for edge in tri.edges():
# A row for every truncated edge
row = []
for face in tri.triangles():
# A row entry for every truncated face
count = 0
for i in range(3):
if face.edge(i) == edge:
perm = face.faceMapping(1, i)
if perm[1] == ((perm[0] + 1) % 3):
# the edge and face orientations agree so,
count += 1
else:
count -= 1
row.append(count * face_coorientations[face.index()])
# +1 if face is to the left of the edge, -1 if face is to
# the right of the edge, using Regina's edge orientation
# when viewed from above (using the transverse taut notion
# of up)
# ,'|
# ,' |
# ,' |
# ,' CCW | gets a +1
# `. ^
# `. |
# `. |
# `.|
for tet in tri.simplices():
for i in range(4):
row.append(0)
delta.append(row)
for face in tri.triangles():
face_embeddings = []
for j in range(2):
face_embeddings.append( face.embedding(j) )
for i in range(3): # vertices of the face
# A row for every peripheral edge
row = []
for face2 in tri.triangles():
# A row entry for every truncated face
if face2 == face:
row.append(1)
else:
row.append(0)
for tet in tri.simplices():
for k in range(4):
# A row entry for every peripheral face
count = 0
for j in range(2):
if (tet == face_embeddings[j].simplex()) and (face_embeddings[j].vertices()[i] == k):
# the tetrahedron is on the jth side of the
# face and the ith vertex of face is the kth
# vertex of tet
face_num_in_tet = face_embeddings[j].vertices()[3]
count -= tet_vert_coorientations[tet.index()][face_num_in_tet]
# tet_vert_coorientations is +1 if
# coorientation on face points out of the
# tetrahedron, and we want count += 1 if
# the peripheral face is above the
# peripheral edge
row.append(count)
delta.append(row)
return delta
# 7. Linear algebra
# We ask: is there a one-cocycle C \in C^1(\calT', \ZZ) so that
# \delta C = E? If so, then [E] = E(\calT) is zero in H^2, as
# desired.
# This is a linear algebra problem, so can be solved by, say, sage.
def order_of_euler_class(delta, E):
"""
Given the coboundary operator delta and an Euler two-cocycle E,
returns k if [E] is k--torsion. By convention, returns zero if
[E] is non-torsion. Note that the trivial element is 1--torsion.
"""
delta = Matrix(delta)
E = vector(E)
# Note that E is a coboundary if there is a one-cocycle C solving
#
# E = C*delta
#
# We can find C (if it exists at all) using Smith normal form.
D, U, V = delta.smith_form()
assert D == U*delta*V
# So we are trying to solve
#
# C*delta = C*U.inverse()*D*V.inverse() = E
#
# for a one-cochain C. Multiply by V to get
#
# C*delta*V = C*U.inverse()*D = E*V
#
# Now set
#
# B = C*U.inverse(), and so B*U = C
#
# and rewrite to get
#
# B*U*delta*V = B*D = E*V
#
# So define E' by:
Ep = E*V
# Finally we attempt to solve B * D = Ep. Note that D is
# diagonal: so if we can solve all of the equations
# B[i] * D[i][i] == Ep[i]
# with B[i] integers, then [E] = 0 in cohomology.
diag = diagonal(D)
if any( (diag[i] == 0 and Ep[i] != 0) for i in range(len(Ep)) ):
return 0
# All zeros are at the end in Smith normal form. Since we've
# passed the above we can now remove them.
first_zero = diag.index(0)
diag = diag[:first_zero]
Ep = Ep[:first_zero]
# Since diag[i] is (now) never zero we can divide to get the
# fractions Ep[i]/diag[i] and then find the scaling that makes
# them simultaneously integral.
denoms = [ diag[i] / gcd(Ep[i], diag[i]) for i in range(len(Ep)) ]
return lcm(denoms)
# 8. Remarks
# a) Here is a nice trick that proves [E] = 0 in some cases. Suppose
# that \gamma is an oriented path in \bdy M. Suppose that \gamma is
# transverse to the one-skeleton of \calT'. We form a one-cocycle
# D_\gamma by adding up the boundary edges that \gamma crosses, with
# sign. The sign is positive if \gamma crosses from below to above,
# and negative otherwise. Note that \delta D_\gamma vanishes on all
# boundary faces.
# b) <NAME> says that we should take the paths that go up
# through the centres of tetrahedra and take the Poincare dual. BUT I
# think this is not what we want... Marc is thinking of the relative
# Euler class as discussed on page 390 of his paper "Taut ideal
# triangulations of three-manifolds". The relative Euler class lives
# in H^2(M, \bdy M), so is Poincare dual to an element of H_1(M),
# represented by a collection of loops.
# c) [2019-03-31] It seems that, for transverse veering triangulations
# in the 16 census, the Euler class is always zero or two-torsion.
# Note that there are manifolds M in the census where H^2(M, \ZZ) has
# positive rank... What about odd torsion?
# Question: If the veering triangulation is edge-orientable, does the
# Euler class vanish?
# Answer: Yes. Here is a version of a discussion with Nathan
# [2020-04-03] - he says the following:
# Suppose that F is a foliation carried by the horizontal branched
# surface. Let UTF be the unit tangent bundle to F. We think of
# e(UTF) as being the obstruction to UTF having a section. Let G be
# the foliation carried by the upper (aka green) branched surface. If
# G is transversely orientable (aka edge-orientability of the veering
# triangulation) then G \cap F gives the desired section, and e(UTF) =
# 0. Note that G \cap F gives, for every point, a pair of points in
# the unit tangent circle. So let PUTF be the projective unit tangent
# bundle to F. This definitely has a section, so e(PUTF) = 0. Now,
# the bundle UTF is a double cover of the bundle PUTF.
# Claim: The euler class is multiplicative with respect to covers (in
# both senses).
# With the claim in hand, we have
# 2 * e(UTF) = e(PUTF) = 0
# We deduce that e(UTF) is either zero or two-torsion.
# 9. Calling code
@liberal
def order_of_euler_class_wrapper(tri, angle):
"""
Returns the order of the euler class.
"""
return order_of_euler_class(coboundary(tri, angle), euler_cocycle(tri, angle))
def compute_order_of_euler_classes(file_in, number=None, file_out=None):
data_in = parse_data_file(file_in)
data_in = [line.split(" ") for line in data_in]
if number != None:
data_in = data_in[:number]
data_out = []
evil = []
for i, line in enumerate(data_in):
if i % 50 == 0:
print( ((1.0*i)/(1.0*len(data_in)), len(data_out)) )
sig = line[0]
tri, angle = isosig_to_tri_angle(sig)
# angle = [int(letter) for letter in angle_s]
curr_euler = order_of_euler_class(coboundary(tri, angle), euler_cocycle(tri, angle))
if curr_euler == "non-torsion":
evil.append(sig)
print(sig + " has non-torsion Euler class!!!!")
elif curr_euler == 1: # order is one so [E] = 0. Boring.
pass
else:
line_out = [sig, str(curr_euler)]
line_out.extend(line[1:])
data_out.append(line_out)
if file_out != None:
write_data_file(data_out, file_out)
print( ("list of evil:", evil) )
return data_out
| [
1,
529,
276,
1112,
420,
29958,
3169,
719,
10199,
29914,
29963,
29872,
3241,
13,
29937,
13,
29937,
260,
1300,
29918,
29872,
8584,
29918,
1990,
29889,
2272,
13,
29937,
13,
13,
13,
3166,
934,
29918,
601,
1053,
6088,
29918,
1272,
29918,
1445,
29892,
2436,
29918,
1272,
29918,
1445,
13,
3166,
260,
1300,
1053,
26054,
29892,
338,
359,
335,
29918,
517,
29918,
3626,
29918,
2521,
13,
3166,
1301,
3901,
29918,
941,
329,
1053,
338,
29918,
3286,
3901,
29918,
941,
329,
13,
13,
3166,
269,
482,
29889,
5344,
29889,
27821,
1053,
22513,
13,
3166,
269,
482,
29889,
7576,
29889,
9021,
29918,
5453,
29918,
5029,
1053,
4608,
13,
3166,
269,
482,
29889,
23830,
29889,
29885,
10669,
1053,
330,
2252,
13,
3166,
269,
482,
29889,
23830,
29889,
12171,
1053,
301,
4912,
13,
13,
13,
29937,
13,
29937,
2921,
284,
448,
2183,
263,
1301,
3901,
260,
1300,
3367,
574,
2785,
29892,
11097,
565,
278,
13,
29937,
6942,
376,
23552,
29908,
321,
8584,
770,
338,
260,
943,
291,
470,
451,
29889,
29871,
960,
372,
338,
13,
29937,
260,
943,
291,
29892,
8161,
967,
1797,
29889,
13,
29937,
13,
13,
13,
29937,
2866,
1237,
322,
975,
1493,
29901,
13,
13,
13,
29937,
29871,
29896,
29889,
28318,
29889,
13,
29937,
13,
29937,
29871,
29906,
29889,
16585,
29889,
13,
29937,
13,
29937,
29871,
29941,
29889,
6162,
546,
3168,
29889,
13,
29937,
13,
29937,
29871,
29946,
29889,
1605,
4661,
403,
29889,
29871,
1334,
2048,
278,
1959,
376,
509,
4661,
630,
29908,
3038,
3829,
320,
1052,
29911,
29915,
13,
29937,
515,
313,
29924,
29892,
320,
1052,
29911,
29897,
322,
2367,
1176,
4097,
363,
278,
1302,
14153,
6471,
13,
29937,
315,
29985,
29895,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
313,
29895,
353,
29871,
29896,
29892,
29871,
29906,
467,
13,
29937,
13,
29937,
29871,
29945,
29889,
16314,
1230,
29889,
29871,
1334,
1284,
263,
1023,
29899,
29883,
542,
13317,
382,
320,
262,
796,
29985,
29906,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
13,
29937,
393,
11524,
382,
1194,
1052,
29911,
29897,
320,
262,
379,
29985,
29906,
29898,
29924,
29892,
320,
29999,
29999,
467,
13,
29937,
13,
29937,
29871,
29953,
29889,
24991,
618,
653,
29889,
29871,
1334,
1284,
278,
4636,
363,
278,
274,
711,
618,
653,
5455,
13,
29937,
320,
4181,
29985,
29896,
29889,
13,
29937,
13,
29937,
29871,
29955,
29889,
22985,
9623,
29889,
29871,
1334,
4505,
278,
5608,
1108,
304,
11097,
565,
382,
338,
263,
13,
29937,
274,
711,
618,
653,
448,
393,
338,
29892,
565,
382,
12185,
297,
350,
29985,
29906,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
448,
393,
338,
29892,
565,
382,
13,
29937,
338,
297,
278,
1967,
310,
320,
4181,
29985,
29896,
29889,
13,
29937,
13,
29937,
29871,
29947,
29889,
5240,
17862,
29889,
13,
29937,
13,
29937,
29871,
29929,
29889,
8251,
292,
775,
13,
29937,
13,
13,
13,
29937,
29871,
29896,
29889,
28318,
29889,
13,
29937,
13,
29937,
529,
5813,
29958,
448,
8170,
3097,
322,
897,
3123,
27523,
13,
29937,
13491,
952,
448,
1632,
4410,
16684,
373,
278,
8607,
13,
29937,
498,
332,
7352,
448,
319,
6056,
363,
278,
3632,
3002,
310,
2211,
29899,
1171,
361,
3361,
13,
29937,
529,
5813,
29958,
448,
383,
5079,
800,
29892,
16385,
3023,
13,
13,
13,
29937,
29871,
29906,
29889,
16585,
29901,
13,
13,
29937,
12142,
393,
313,
29924,
29892,
320,
1052,
29911,
29897,
338,
263,
1301,
3901,
260,
1300,
3367,
574,
2785,
29889,
29871,
1987,
13,
29937,
320,
1052,
29911,
998,
29906,
29913,
338,
278,
376,
22672,
5443,
287,
7101,
1642,
29871,
910,
1559,
583,
5164,
13,
29937,
301,
9103,
800,
29892,
607,
10985,
304,
900,
29875,
800,
373,
341,
29889,
29871,
2178,
310,
1438,
505,
278,
13,
29937,
1021,
382,
8584,
770,
29892,
607,
591,
674,
13530,
382,
1194,
1052,
29911,
29897,
320,
262,
379,
29985,
29906,
29898,
29924,
29892,
320,
29999,
29999,
467,
13,
29937,
12142,
393,
320,
1052,
29943,
338,
263,
8988,
900,
11685,
322,
1235,
501,
29911,
29905,
1052,
29943,
367,
278,
13,
29937,
5190,
18806,
296,
11846,
975,
320,
1052,
29943,
29889,
29871,
450,
382,
8584,
770,
382,
1109,
17006,
3721,
13,
29937,
746,
501,
29911,
29905,
1052,
29943,
756,
263,
4004,
29936,
393,
338,
29892,
746,
278,
5190,
18806,
296,
11846,
338,
13,
29937,
12604,
275,
519,
29889,
13,
13,
13,
29937,
3599,
497,
29901,
13,
29937,
12142,
393,
1060,
338,
385,
383,
29899,
16718,
975,
350,
29889,
29871,
1334,
505,
13,
29937,
13,
29937,
418,
474,
13,
29937,
383,
448,
807,
15110,
1060,
529,
489,
29889,
13,
29937,
9651,
891,
1678,
891,
13,
29937,
9651,
891,
1678,
891,
13,
29937,
965,
282,
29989,
1678,
891,
29879,
13,
29937,
9651,
891,
1678,
891,
13,
29937,
9651,
325,
1678,
891,
13,
29937,
9651,
350,
11474,
29915,
13,
29937,
13,
29937,
1105,
269,
320,
3166,
350,
320,
517,
1060,
338,
263,
320,
7278,
29912,
2042,
29913,
565,
282,
320,
6034,
269,
353,
5163,
29918,
29933,
13,
13,
13,
29937,
29871,
29941,
29889,
6162,
546,
3168,
13,
13,
13,
1753,
19640,
29898,
29928,
1125,
13,
1678,
736,
518,
29928,
29961,
29875,
3816,
29875,
29962,
363,
474,
297,
3464,
29898,
1195,
29898,
29928,
29889,
6229,
5580,
22130,
29962,
13,
13,
13,
29937,
29871,
29946,
29889,
1605,
4661,
403,
29889,
13,
13,
29937,
12142,
393,
341,
338,
263,
6631,
29892,
274,
375,
9795,
29892,
7769,
287,
2211,
29899,
1171,
361,
1025,
29889,
29871,
2803,
13,
29937,
315,
353,
315,
29898,
29924,
29897,
320,
6279,
29871,
29896,
367,
278,
1353,
310,
274,
375,
567,
310,
341,
29889,
29871,
12142,
393,
320,
1052,
29911,
338,
263,
13,
29937,
1301,
3901,
260,
1300,
10839,
3367,
574,
2785,
310,
341,
29889,
29871,
2803,
323,
353,
323,
1194,
1052,
29911,
29897,
320,
6279,
29871,
29896,
13,
29937,
367,
278,
1353,
310,
260,
27280,
17143,
336,
310,
320,
1052,
29911,
29889,
13,
13,
29937,
1334,
671,
28124,
29874,
304,
1353,
322,
7769,
278,
12770,
9991,
29872,
29918,
29875,
29905,
3227,
29875,
353,
29871,
29900,
2844,
29911,
29899,
29896,
1118,
13,
29937,
278,
17240,
9991,
29888,
29918,
29875,
29905,
3227,
29875,
353,
29871,
29900,
2844,
29906,
29911,
29899,
29896,
1118,
322,
278,
260,
27280,
17143,
336,
9991,
29873,
29918,
29875,
29905,
3227,
29875,
353,
13,
29937,
29871,
29900,
2844,
29911,
29899,
29896,
29913,
310,
320,
1052,
29911,
29889,
29871,
1334,
1246,
599,
310,
1438,
320,
7278,
29912,
680,
284,
29913,
9101,
29889,
29871,
3940,
13,
29937,
393,
278,
1301,
3901,
3829,
884,
4076,
502,
1302,
29899,
12236,
800,
310,
278,
13,
29937,
321,
29918,
29875,
322,
278,
285,
29918,
29875,
29892,
2000,
376,
786,
2935,
29908,
13,
13,
29937,
1334,
3349,
263,
2319,
1722,
17647,
833,
397,
310,
599,
10839,
13791,
310,
599,
13,
29937,
1904,
260,
27280,
17143,
336,
29889,
29871,
910,
4076,
278,
320,
7278,
29912,
509,
4661,
630,
29913,
3038,
3829,
13,
29937,
320,
1052,
29911,
4286,
29871,
450,
9242,
310,
278,
10839,
9101,
526,
2000,
320,
7278,
29912,
509,
4661,
630,
29913,
13,
29937,
9101,
29936,
591,
633,
1509,
322,
24270,
278,
451,
800,
321,
29918,
29875,
322,
285,
29918,
29875,
363,
1438,
29889,
29871,
450,
13,
29937,
21022,
630,
9101,
13125,
7769,
800,
322,
1302,
29899,
12236,
800,
29889,
29871,
450,
716,
13,
29937,
9101,
526,
2000,
320,
7278,
29912,
546,
29875,
8096,
284,
29913,
9101,
29889,
29871,
1334,
1353,
1438,
408,
13,
29937,
4477,
29901,
13,
13,
29937,
321,
648,
823,
29913,
338,
278,
23603,
8096,
284,
7636,
28967,
12688,
325,
29918,
29926,
1283,
310,
10839,
3700,
285,
29918,
29875,
13,
29937,
285,
648,
823,
29913,
338,
278,
23603,
8096,
284,
3700,
28967,
12688,
325,
29918,
29926,
1283,
310,
10839,
260,
27280,
17143,
1617,
260,
29918,
29875,
13,
13,
29937,
3940,
393,
1432,
21022,
630,
3700,
338,
5769,
24737,
368,
263,
15090,
12841,
29889,
29871,
450,
13,
29937,
10452,
310,
445,
15090,
12841,
3743,
2211,
21022,
630,
12770,
5136,
1218,
13,
29937,
411,
2211,
23603,
8096,
284,
12770,
29889,
29871,
1334,
7769,
1269,
23603,
8096,
284,
7636,
321,
648,
823,
29913,
13,
29937,
577,
393,
278,
19843,
310,
321,
648,
823,
29913,
8571,
267,
411,
278,
19843,
13,
29937,
20974,
491,
320,
29890,
4518,
285,
29918,
29875,
29889,
29871,
1334,
7769,
1269,
23603,
8096,
284,
3700,
285,
648,
823,
29913,
13,
29937,
9418,
29899,
13058,
3538,
29892,
408,
24774,
515,
27971,
313,
5747,
338,
29892,
515,
5377,
310,
13,
29937,
341,
467,
29871,
3115,
29892,
591,
7462,
321,
648,
823,
29913,
322,
285,
648,
823,
29913,
411,
1302,
29899,
12236,
800,
13330,
13,
29937,
714,
310,
341,
29892,
2000,
376,
449,
1328,
1642,
13,
13,
29937,
632,
321,
648,
29875,
29900,
29913,
13,
29937,
795,
11474,
13,
29937,
632,
847,
259,
320,
13,
29937,
539,
321,
29918,
29906,
29871,
847,
268,
320,
29871,
321,
29918,
29896,
13,
29937,
965,
847,
539,
320,
13,
29937,
3986,
847,
259,
285,
29918,
29875,
259,
320,
13,
29937,
3986,
320,
308,
847,
13,
29937,
259,
321,
648,
29875,
29896,
29913,
29871,
448,
1378,
29871,
321,
648,
29875,
29906,
29913,
13,
29937,
795,
321,
29918,
29900,
13,
13,
29937,
1152,
385,
7636,
321,
470,
263,
3700,
285,
591,
671,
321,
6622,
322,
285,
6622,
304,
13530,
278,
14581,
297,
13,
29937,
315,
29985,
29896,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
470,
315,
29985,
29906,
1194,
1052,
29911,
742,
320,
29999,
29999,
467,
29871,
6549,
9991,
29872,
6622,
29918,
29875,
18105,
320,
5231,
13,
29937,
9991,
29872,
6622,
648,
823,
1012,
29913,
16785,
315,
29985,
29896,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
1550,
9991,
29888,
6622,
29918,
29875,
18105,
320,
5231,
13,
29937,
9991,
29888,
6622,
648,
823,
1012,
29913,
16785,
315,
29985,
29906,
1194,
1052,
29911,
742,
320,
29999,
29999,
467,
13,
13,
29937,
1152,
901,
14956,
29892,
1074,
13,
29937,
847,
29963,
29872,
3241,
29918,
401,
29914,
3664,
267,
29925,
10373,
29914,
29872,
8584,
29918,
16953,
29918,
3166,
29918,
29876,
11385,
29889,
6173,
13,
13,
13,
29937,
29871,
29945,
29889,
16314,
1230,
13,
13,
29937,
1334,
1286,
3386,
263,
1023,
29899,
29883,
542,
13317,
382,
320,
262,
796,
29985,
29906,
1194,
1052,
29911,
742,
320,
29999,
29999,
467,
29871,
1152,
1432,
13,
29937,
23603,
8096,
284,
3700,
285,
591,
2125,
13,
13,
29937,
382,
29898,
29888,
29897,
353,
29871,
29900,
29889,
13,
13,
29937,
320,
463,
29912,
26294,
29913,
13,
29937,
1763,
1074,
393,
445,
338,
1959,
29892,
1235,
320,
1052,
29943,
367,
738,
900,
11685,
310,
341,
29892,
13,
29937,
1301,
3901,
304,
278,
10452,
29889,
29871,
12142,
393,
285,
338,
278,
2183,
23603,
8096,
284,
13,
29937,
17205,
29889,
29871,
1334,
505,
263,
4004,
310,
278,
24345,
310,
501,
29911,
29905,
1052,
29943,
304,
320,
29890,
4518,
13,
29937,
285,
29936,
18451,
278,
714,
1328,
1746,
29889,
29871,
910,
4988,
975,
285,
304,
2367,
263,
4004,
13,
29937,
310,
501,
29911,
29905,
1052,
29943,
22078,
304,
285,
29889,
29871,
1105,
727,
338,
694,
14979,
4080,
304,
278,
13,
29937,
6081,
29889,
29871,
2823,
2400,
363,
263,
901,
18378,
10679,
297,
4958,
310,
13,
29937,
376,
9837,
3742,
279,
20333,
29872,
29899,
29950,
15818,
2380,
1642,
13,
29937,
320,
355,
29912,
26294,
29913,
13,
13,
29937,
2567,
7755,
393,
285,
338,
263,
21022,
630,
3700,
29889,
29871,
12142,
393,
321,
29918,
29900,
29892,
321,
29918,
29896,
29892,
321,
29918,
29906,
13,
29937,
526,
967,
2211,
21022,
630,
12770,
29889,
29871,
3599,
497,
393,
1438,
526,
599,
7769,
287,
29889,
13,
29937,
2803,
14614,
29898,
29888,
29897,
367,
278,
1353,
310,
278,
12770,
321,
29918,
29900,
29892,
321,
29918,
29896,
29892,
321,
29918,
29906,
393,
526,
13,
29937,
7769,
287,
9418,
29899,
13058,
3538,
313,
5747,
338,
29892,
8661,
411,
1009,
20974,
13,
29937,
19843,
6421,
515,
285,
467,
29871,
1334,
2125,
13,
13,
29937,
382,
29898,
29888,
29897,
353,
14614,
29898,
29888,
29897,
448,
29871,
29906,
13,
13,
29937,
960,
591,
285,
3466,
278,
1301,
3901,
5305,
29901,
14614,
29898,
29888,
1495,
353,
29871,
29941,
448,
14614,
29898,
29888,
511,
13,
29937,
577,
382,
29898,
29888,
1495,
353,
14614,
29898,
29888,
1495,
448,
29871,
29906,
353,
29871,
29896,
448,
14614,
29898,
29888,
29897,
353,
29871,
29906,
448,
14614,
29898,
29888,
29897,
448,
29871,
29896,
353,
448,
29923,
29898,
29888,
29897,
448,
29871,
29896,
13,
13,
29937,
320,
463,
29912,
26294,
29913,
13,
29937,
2266,
338,
697,
982,
304,
6456,
313,
392,
5649,
14366,
445,
5751,
29889,
29871,
12142,
393,
13,
29937,
285,
338,
278,
2183,
21022,
630,
3700,
29889,
29871,
12142,
393,
269,
338,
263,
4004,
310,
501,
29911,
29888,
891,
13,
29937,
320,
29890,
4518,
285,
29889,
29871,
1987,
2380,
29898,
29879,
29897,
338,
278,
3001,
13733,
310,
269,
411,
3390,
304,
13,
29937,
278,
18806,
296,
1746,
29892,
903,
11242,
29918,
697,
29889,
29871,
910,
508,
367,
337,
24588,
1463,
297,
4958,
310,
13,
29937,
278,
2380,
310,
18806,
296,
4608,
4235,
23771,
269,
975,
599,
310,
285,
29889,
13,
13,
29937,
8680,
19995,
310,
7769,
800,
310,
12770,
8161,
263,
4004,
310,
501,
29911,
29888,
891,
13,
29937,
320,
29890,
4518,
285,
29889,
29871,
4001,
599,
310,
278,
10452,
12770,
321,
648,
823,
29913,
310,
285,
526,
7769,
287,
13,
29937,
278,
1021,
982,
29892,
591,
6755,
263,
3918,
1424,
11500,
727,
29936,
27650,
10603,
502,
304,
13,
29937,
925,
671,
278,
714,
1328,
13330,
4004,
373,
599,
310,
278,
321,
648,
823,
1836,
29871,
8680,
13,
29937,
7348,
310,
4004,
373,
321,
29918,
29900,
313,
20834,
29897,
756,
304,
313,
29874,
29897,
8839,
871,
373,
278,
13,
29937,
19843,
310,
321,
29918,
29900,
322,
313,
29890,
29897,
756,
304,
367,
714,
1328,
472,
278,
1095,
9748,
310,
13,
29937,
321,
29918,
29900,
29889,
29871,
450,
20393,
7348,
338,
278,
4004,
393,
5731,
1078,
491,
17501,
1631,
411,
13,
29937,
3390,
304,
278,
18806,
296,
3412,
320,
29890,
4518,
285,
29918,
29875,
29892,
408,
591,
4337,
6375,
3412,
321,
29918,
29900,
29889,
13,
29937,
1105,
269,
3291,
903,
1627,
29918,
472,
278,
6763,
310,
321,
29918,
29900,
29892,
3291,
903,
1266,
29918,
297,
278,
13,
29937,
7256,
310,
321,
29918,
29900,
29892,
322,
3291,
903,
1454,
2935,
29918,
472,
278,
1095,
310,
321,
29918,
29900,
29889,
29871,
450,
3001,
13,
29937,
13733,
310,
278,
9819,
1746,
313,
2541,
3390,
304,
278,
18806,
296,
1746,
29897,
13,
29937,
338,
14614,
29898,
29888,
29897,
448,
29871,
29941,
29889,
29871,
6549,
382,
29898,
29888,
29897,
353,
14614,
29898,
29888,
29897,
448,
29871,
29906,
338,
278,
2380,
29889,
29871,
887,
508,
1423,
13,
29937,
445,
1736,
491,
11580,
278,
3023,
1950,
14956,
322,
20602,
278,
2380,
13,
29937,
310,
738,
6081,
310,
269,
975,
285,
29889,
13,
29937,
320,
355,
29912,
26294,
29913,
13,
13,
29937,
6015,
326,
29901,
320,
4181,
29985,
29906,
382,
353,
29871,
29900,
29889,
13,
13,
29937,
2193,
338,
29892,
382,
338,
263,
274,
542,
13317,
29889,
13,
13,
29937,
18319,
310,
5995,
29901,
24778,
263,
21022,
630,
260,
27280,
17143,
1617,
260,
322,
2329,
777,
7769,
291,
13,
29937,
310,
967,
21022,
630,
12770,
29889,
29871,
319,
1513,
13944,
3697,
393,
13,
13,
29937,
320,
4181,
382,
313,
29873,
29897,
353,
382,
320,
29890,
4518,
260,
353,
29871,
29900,
29889,
13,
13,
29937,
8502,
3538,
29892,
263,
1513,
16287,
3697,
393,
21293,
278,
19843,
13,
29937,
310,
263,
2323,
7636,
11308,
382,
320,
29890,
4518,
260,
443,
15033,
29889,
660,
3352,
29889,
13,
13,
2277,
29937,
739,
723,
367,
7575,
304,
505,
263,
3109,
26845,
5296,
29991,
13,
13,
13,
1753,
321,
8584,
29918,
29883,
542,
13317,
29898,
3626,
29892,
10696,
1125,
13,
1678,
9995,
13,
1678,
11221,
263,
1072,
1099,
3367,
574,
2785,
376,
3626,
613,
411,
7769,
287,
12770,
29892,
322,
263,
13,
1678,
1301,
3901,
260,
1300,
10696,
3829,
376,
2521,
613,
3639,
278,
6942,
13,
1678,
1023,
29899,
29883,
542,
13317,
382,
15783,
278,
382,
8584,
770,
382,
29898,
3626,
467,
13,
1678,
9995,
13,
1678,
4974,
338,
29918,
3286,
3901,
29918,
941,
329,
29898,
3626,
29892,
10696,
29897,
13,
1678,
3700,
29918,
1111,
12236,
800,
353,
338,
29918,
3286,
3901,
29918,
941,
329,
29898,
3626,
29892,
10696,
29892,
736,
29918,
1853,
353,
376,
2161,
29918,
1111,
12236,
800,
1159,
13,
1678,
396,
382,
674,
367,
263,
903,
798,
29918,
4608,
29892,
1363,
372,
321,
1446,
1897,
12047,
29889,
13,
1678,
382,
353,
5159,
13,
1678,
396,
3824,
5376,
411,
278,
21022,
630,
17240,
13,
1678,
363,
3700,
297,
3367,
29889,
8726,
29898,
29906,
1125,
29871,
396,
29871,
29906,
353,
9927,
13,
4706,
396,
3824,
591,
10272,
278,
1353,
310,
28124,
29874,
7769,
287,
12770,
393,
8661,
411,
278,
28124,
29874,
19843,
373,
3700,
13,
4706,
14614,
353,
29871,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
9651,
3635,
353,
3700,
29889,
2161,
15845,
29898,
29896,
29892,
474,
29897,
13,
9651,
396,
1596,
3635,
29961,
29900,
1402,
3635,
29961,
29896,
29962,
13,
9651,
565,
3635,
29961,
29896,
29962,
1275,
5135,
17858,
29961,
29900,
29962,
718,
29871,
29896,
29897,
1273,
29871,
29941,
1125,
29871,
396,
278,
7636,
322,
3700,
7769,
800,
8661,
577,
29892,
13,
18884,
14614,
353,
14614,
718,
29871,
29896,
13,
4706,
396,
1596,
376,
2477,
613,
14614,
13,
4706,
396,
2567,
591,
4195,
373,
3692,
470,
451,
28124,
29874,
322,
10696,
8661,
373,
278,
313,
1111,
15805,
20659,
310,
278,
3700,
29889,
13,
4706,
565,
3700,
29918,
1111,
12236,
800,
29961,
2161,
29889,
2248,
580,
29962,
1275,
29871,
29896,
29901,
13,
9651,
382,
29889,
4397,
29898,
2477,
448,
29871,
29906,
29897,
13,
4706,
1683,
29901,
13,
9651,
382,
29889,
4397,
29898,
29896,
448,
14614,
29897,
13,
1678,
396,
2567,
5376,
411,
278,
23603,
8096,
284,
17240,
13,
1678,
363,
260,
300,
297,
3367,
29889,
29873,
27280,
17143,
336,
7295,
13,
4706,
363,
432,
297,
3464,
29898,
29946,
1125,
13,
9651,
382,
29889,
4397,
29898,
29900,
29897,
13,
1678,
736,
382,
13,
13,
13,
29937,
29871,
29953,
29889,
24991,
618,
653,
13,
13,
29937,
12142,
393,
321,
338,
263,
21022,
630,
7636,
29889,
29871,
2803,
365,
29943,
367,
278,
731,
310,
21022,
630,
13,
29937,
17240,
304,
278,
2175,
310,
321,
322,
1235,
390,
29943,
367,
278,
731,
310,
17240,
304,
278,
1492,
29889,
29871,
1987,
13,
13,
29937,
320,
4181,
321,
6622,
353,
320,
2083,
648,
29888,
320,
262,
365,
29943,
29913,
285,
6622,
448,
320,
2083,
648,
29888,
320,
262,
390,
29943,
29913,
285,
6622,
29889,
13,
13,
29937,
12142,
393,
321,
338,
263,
23603,
8096,
284,
7636,
29889,
29871,
1105,
727,
338,
263,
5412,
21022,
630,
13,
29937,
3700,
285,
11781,
321,
29889,
29871,
3940,
393,
285,
338,
304,
278,
2175,
310,
321,
29889,
29871,
1670,
526,
13,
29937,
884,
263,
5101,
310,
10452,
17240,
11781,
321,
29901,
1827,
285,
29915,
903,
27215,
29918,
321,
322,
285,
4907,
13,
29937,
903,
22503,
29918,
321,
29889,
29871,
1987,
13,
13,
29937,
320,
4181,
321,
6622,
353,
285,
6622,
718,
313,
29888,
1495,
6622,
448,
313,
29888,
29915,
1495,
6622,
29889,
13,
13,
13,
1753,
274,
711,
618,
653,
29898,
3626,
29892,
10696,
1125,
13,
1678,
9995,
13,
1678,
11221,
263,
3367,
574,
2785,
376,
3626,
29908,
313,
29911,
511,
411,
7769,
287,
12770,
29892,
322,
263,
13,
1678,
1301,
3901,
260,
1300,
10696,
3829,
376,
2521,
613,
3639,
278,
1302,
29899,
9917,
653,
13,
1678,
5455,
19471,
29985,
29896,
320,
3166,
315,
29985,
29896,
29898,
29911,
742,
796,
29999,
29897,
320,
517,
315,
29985,
29906,
29898,
29911,
742,
796,
29999,
511,
408,
263,
4636,
29892,
13,
1678,
363,
278,
21022,
630,
3367,
574,
2785,
323,
4286,
29871,
3940,
393,
29892,
18719,
13590,
29892,
13,
1678,
591,
1016,
29915,
29873,
817,
304,
671,
376,
2521,
29908,
363,
445,
29892,
541,
591,
671,
372,
304,
8161,
13,
1678,
19843,
373,
17240,
363,
278,
382,
8584,
770,
29892,
577,
591,
1795,
408,
1532,
671,
13,
1678,
372,
1449,
1244,
29889,
13,
1678,
9995,
13,
1678,
396,
320,
4181,
29985,
29896,
4893,
1948,
12047,
313,
12171,
373,
12770,
29897,
322,
805,
1169,
714,
13,
1678,
396,
1948,
12047,
313,
12171,
373,
17240,
467,
29871,
1105,
29892,
565,
274,
338,
263,
697,
29899,
1111,
14153,
13,
1678,
396,
769,
274,
320,
3822,
320,
4181,
338,
263,
1023,
29899,
1111,
14153,
29889,
13,
1678,
19471,
353,
5159,
13,
1678,
4974,
338,
29918,
3286,
3901,
29918,
941,
329,
29898,
3626,
29892,
10696,
29897,
13,
1678,
260,
300,
29918,
1765,
29918,
1111,
12236,
800,
353,
338,
29918,
3286,
3901,
29918,
941,
329,
29898,
3626,
29892,
10696,
29892,
736,
29918,
1853,
353,
376,
29873,
300,
29918,
1765,
29918,
1111,
12236,
800,
1159,
13,
1678,
3700,
29918,
1111,
12236,
800,
353,
338,
29918,
3286,
3901,
29918,
941,
329,
29898,
3626,
29892,
10696,
29892,
736,
29918,
1853,
353,
376,
2161,
29918,
1111,
12236,
800,
1159,
13,
13,
1678,
363,
7636,
297,
3367,
29889,
287,
2710,
7295,
13,
4706,
396,
319,
1948,
363,
1432,
21022,
630,
7636,
13,
4706,
1948,
353,
5159,
13,
4706,
363,
3700,
297,
3367,
29889,
3626,
19536,
7295,
13,
9651,
396,
319,
1948,
6251,
363,
1432,
21022,
630,
3700,
13,
9651,
2302,
353,
29871,
29900,
13,
9651,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
18884,
565,
3700,
29889,
12864,
29898,
29875,
29897,
1275,
7636,
29901,
13,
462,
1678,
3635,
353,
3700,
29889,
2161,
15845,
29898,
29896,
29892,
474,
29897,
13,
462,
1678,
565,
3635,
29961,
29896,
29962,
1275,
5135,
17858,
29961,
29900,
29962,
718,
29871,
29896,
29897,
1273,
29871,
29941,
1125,
13,
462,
4706,
396,
278,
7636,
322,
3700,
7769,
800,
8661,
577,
29892,
13,
462,
4706,
2302,
4619,
29871,
29896,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
2302,
22361,
29871,
29896,
13,
9651,
1948,
29889,
4397,
29898,
2798,
334,
3700,
29918,
1111,
12236,
800,
29961,
2161,
29889,
2248,
580,
2314,
13,
9651,
396,
718,
29896,
565,
3700,
338,
304,
278,
2175,
310,
278,
7636,
29892,
448,
29896,
565,
3700,
338,
304,
13,
9651,
396,
278,
1492,
310,
278,
7636,
29892,
773,
28124,
29874,
29915,
29879,
7636,
19843,
13,
9651,
396,
746,
24774,
515,
2038,
313,
4746,
278,
1301,
3901,
260,
1300,
17837,
13,
9651,
396,
310,
701,
29897,
13,
13,
9651,
396,
4706,
1919,
29915,
29989,
13,
9651,
396,
418,
1919,
29915,
29871,
891,
13,
9651,
396,
1678,
1919,
29915,
1678,
891,
13,
9651,
396,
29871,
1919,
29915,
29871,
19178,
29956,
891,
29871,
4947,
263,
718,
29896,
13,
9651,
396,
29871,
5050,
418,
6228,
13,
9651,
396,
1678,
5050,
1678,
891,
13,
9651,
396,
418,
5050,
29871,
891,
13,
9651,
396,
4706,
5050,
29989,
13,
13,
4706,
363,
260,
300,
297,
3367,
29889,
14739,
29399,
7295,
13,
9651,
363,
474,
297,
3464,
29898,
29946,
1125,
13,
18884,
1948,
29889,
4397,
29898,
29900,
29897,
13,
4706,
19471,
29889,
4397,
29898,
798,
29897,
13,
13,
1678,
363,
3700,
297,
3367,
29889,
3626,
19536,
7295,
13,
4706,
3700,
29918,
17987,
29881,
886,
353,
5159,
13,
4706,
363,
432,
297,
3464,
29898,
29906,
1125,
13,
9651,
3700,
29918,
17987,
29881,
886,
29889,
4397,
29898,
3700,
29889,
17987,
8497,
29898,
29926,
29897,
1723,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
29871,
396,
13791,
310,
278,
3700,
13,
9651,
396,
319,
1948,
363,
1432,
23603,
8096,
284,
7636,
13,
9651,
1948,
353,
5159,
13,
13,
9651,
363,
3700,
29906,
297,
3367,
29889,
3626,
19536,
7295,
13,
18884,
396,
319,
1948,
6251,
363,
1432,
21022,
630,
3700,
13,
18884,
565,
3700,
29906,
1275,
3700,
29901,
13,
462,
1678,
1948,
29889,
4397,
29898,
29896,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
1948,
29889,
4397,
29898,
29900,
29897,
13,
13,
9651,
363,
260,
300,
297,
3367,
29889,
14739,
29399,
7295,
13,
18884,
363,
413,
297,
3464,
29898,
29946,
1125,
13,
462,
1678,
396,
319,
1948,
6251,
363,
1432,
23603,
8096,
284,
3700,
13,
462,
1678,
2302,
353,
29871,
29900,
13,
462,
1678,
363,
432,
297,
3464,
29898,
29906,
1125,
13,
462,
4706,
565,
313,
29873,
300,
1275,
3700,
29918,
17987,
29881,
886,
29961,
29926,
1822,
3601,
10709,
3101,
322,
313,
2161,
29918,
17987,
29881,
886,
29961,
29926,
1822,
1765,
1575,
580,
29961,
29875,
29962,
1275,
413,
1125,
13,
462,
9651,
396,
278,
260,
27280,
17143,
1617,
338,
373,
278,
432,
386,
2625,
310,
278,
13,
462,
9651,
396,
3700,
322,
278,
372,
29882,
12688,
310,
3700,
338,
278,
413,
386,
13,
462,
9651,
396,
12688,
310,
260,
300,
13,
462,
9651,
3700,
29918,
1949,
29918,
262,
29918,
29873,
300,
353,
3700,
29918,
17987,
29881,
886,
29961,
29926,
1822,
1765,
1575,
580,
29961,
29941,
29962,
13,
462,
9651,
2302,
22361,
260,
300,
29918,
1765,
29918,
1111,
12236,
800,
29961,
29873,
300,
29889,
2248,
580,
3816,
2161,
29918,
1949,
29918,
262,
29918,
29873,
300,
29962,
13,
462,
9651,
396,
260,
300,
29918,
1765,
29918,
1111,
12236,
800,
338,
718,
29896,
565,
13,
462,
9651,
396,
1302,
20659,
373,
3700,
3291,
714,
310,
278,
13,
462,
9651,
396,
260,
27280,
17143,
1617,
29892,
322,
591,
864,
2302,
4619,
29871,
29896,
565,
13,
462,
9651,
396,
278,
23603,
8096,
284,
3700,
338,
2038,
278,
13,
462,
9651,
396,
23603,
8096,
284,
7636,
13,
462,
1678,
1948,
29889,
4397,
29898,
2798,
29897,
13,
9651,
19471,
29889,
4397,
29898,
798,
29897,
13,
1678,
736,
19471,
13,
13,
13,
29937,
29871,
29955,
29889,
22985,
9623,
13,
13,
29937,
1334,
2244,
29901,
338,
727,
263,
697,
29899,
29883,
542,
13317,
315,
320,
262,
315,
29985,
29896,
1194,
1052,
29911,
742,
320,
29999,
29999,
29897,
577,
393,
13,
29937,
320,
4181,
315,
353,
382,
29973,
29871,
960,
577,
29892,
769,
518,
29923,
29962,
353,
382,
1194,
1052,
29911,
29897,
338,
5225,
297,
379,
29985,
29906,
29892,
408,
13,
29937,
7429,
29889,
13,
13,
29937,
910,
338,
263,
5608,
9623,
1108,
29892,
577,
508,
367,
7484,
491,
29892,
1827,
29892,
269,
482,
29889,
13,
13,
13,
1753,
1797,
29918,
974,
29918,
29872,
8584,
29918,
1990,
29898,
4181,
29892,
382,
1125,
13,
1678,
9995,
13,
1678,
11221,
278,
274,
711,
618,
653,
5455,
19471,
322,
385,
382,
8584,
1023,
29899,
29883,
542,
13317,
382,
29892,
13,
1678,
3639,
413,
565,
518,
29923,
29962,
338,
413,
489,
29873,
943,
291,
29889,
29871,
2648,
15687,
29892,
3639,
5225,
565,
13,
1678,
518,
29923,
29962,
338,
1661,
29899,
29873,
943,
291,
29889,
29871,
3940,
393,
278,
12604,
1543,
338,
29871,
29896,
489,
29873,
943,
291,
29889,
13,
1678,
9995,
13,
13,
1678,
19471,
353,
22513,
29898,
4181,
29897,
13,
1678,
382,
353,
4608,
29898,
29923,
29897,
13,
13,
1678,
396,
3940,
393,
382,
338,
263,
274,
711,
618,
653,
565,
727,
338,
263,
697,
29899,
29883,
542,
13317,
315,
17069,
13,
1678,
396,
13,
1678,
396,
382,
353,
315,
29930,
4181,
13,
1678,
396,
13,
1678,
396,
1334,
508,
1284,
315,
313,
361,
372,
4864,
472,
599,
29897,
773,
7075,
4226,
883,
29889,
13,
13,
1678,
360,
29892,
501,
29892,
478,
353,
19471,
29889,
3844,
389,
29918,
689,
580,
13,
1678,
4974,
360,
1275,
501,
29930,
4181,
29930,
29963,
13,
13,
1678,
396,
1105,
591,
526,
1811,
304,
4505,
13,
1678,
396,
13,
1678,
396,
315,
29930,
4181,
353,
315,
29930,
29965,
29889,
262,
3901,
580,
29930,
29928,
29930,
29963,
29889,
262,
3901,
580,
353,
382,
13,
1678,
396,
13,
1678,
396,
363,
263,
697,
29899,
1111,
14153,
315,
29889,
29871,
9683,
666,
368,
491,
478,
304,
679,
13,
1678,
396,
13,
1678,
396,
315,
29930,
4181,
29930,
29963,
353,
315,
29930,
29965,
29889,
262,
3901,
580,
29930,
29928,
353,
382,
29930,
29963,
13,
1678,
396,
13,
1678,
396,
2567,
731,
13,
1678,
396,
13,
1678,
396,
350,
353,
315,
29930,
29965,
29889,
262,
3901,
3285,
322,
577,
350,
29930,
29965,
353,
315,
13,
1678,
396,
13,
1678,
396,
322,
10683,
304,
679,
13,
1678,
396,
13,
1678,
396,
350,
29930,
29965,
29930,
4181,
29930,
29963,
353,
350,
29930,
29928,
353,
382,
29930,
29963,
13,
1678,
396,
13,
1678,
396,
1105,
4529,
382,
29915,
491,
29901,
13,
13,
1678,
14055,
353,
382,
29930,
29963,
13,
13,
1678,
396,
9788,
591,
4218,
304,
4505,
350,
334,
360,
353,
14055,
29889,
29871,
3940,
393,
360,
338,
13,
1678,
396,
19640,
29901,
577,
565,
591,
508,
4505,
599,
310,
278,
10693,
13,
13,
1678,
396,
350,
29961,
29875,
29962,
334,
360,
29961,
29875,
3816,
29875,
29962,
1275,
14055,
29961,
29875,
29962,
13,
13,
1678,
396,
411,
350,
29961,
29875,
29962,
11920,
29892,
769,
518,
29923,
29962,
353,
29871,
29900,
297,
16165,
290,
3002,
29889,
13,
13,
1678,
7936,
353,
19640,
29898,
29928,
29897,
13,
13,
1678,
565,
738,
29898,
313,
6051,
351,
29961,
29875,
29962,
1275,
29871,
29900,
322,
14055,
29961,
29875,
29962,
2804,
29871,
29900,
29897,
363,
474,
297,
3464,
29898,
2435,
29898,
29923,
29886,
876,
29871,
1125,
13,
4706,
736,
29871,
29900,
13,
13,
1678,
396,
2178,
24786,
526,
472,
278,
1095,
297,
7075,
4226,
883,
29889,
29871,
4001,
591,
29915,
345,
13,
1678,
396,
4502,
278,
2038,
591,
508,
1286,
3349,
963,
29889,
13,
13,
1678,
937,
29918,
9171,
353,
7936,
29889,
2248,
29898,
29900,
29897,
13,
1678,
7936,
353,
7936,
7503,
4102,
29918,
9171,
29962,
13,
1678,
14055,
353,
14055,
7503,
4102,
29918,
9171,
29962,
13,
13,
1678,
396,
4001,
7936,
29961,
29875,
29962,
338,
313,
3707,
29897,
2360,
5225,
591,
508,
16429,
304,
679,
278,
13,
1678,
396,
5227,
1953,
14055,
29961,
29875,
16261,
6051,
351,
29961,
29875,
29962,
322,
769,
1284,
278,
21640,
393,
3732,
13,
1678,
396,
963,
21699,
10160,
29889,
13,
13,
1678,
972,
4835,
353,
518,
7936,
29961,
29875,
29962,
847,
330,
2252,
29898,
29923,
29886,
29961,
29875,
1402,
7936,
29961,
29875,
2314,
363,
474,
297,
3464,
29898,
2435,
29898,
29923,
29886,
876,
4514,
13,
1678,
736,
301,
4912,
29898,
1145,
4835,
29897,
13,
13,
13,
29937,
29871,
29947,
29889,
5240,
17862,
13,
13,
29937,
263,
29897,
2266,
338,
263,
7575,
8938,
393,
28281,
518,
29923,
29962,
353,
29871,
29900,
297,
777,
4251,
29889,
29871,
12142,
13,
29937,
393,
320,
4283,
338,
385,
7769,
287,
2224,
297,
320,
29890,
4518,
341,
29889,
29871,
12142,
393,
320,
4283,
338,
13,
29937,
1301,
3901,
304,
278,
697,
29899,
26050,
11285,
310,
320,
1052,
29911,
4286,
29871,
1334,
883,
263,
697,
29899,
29883,
542,
13317,
13,
29937,
360,
3187,
4283,
491,
4417,
701,
278,
10452,
12770,
393,
320,
4283,
4891,
267,
29892,
411,
13,
29937,
1804,
29889,
29871,
450,
1804,
338,
6374,
565,
320,
4283,
4891,
267,
515,
2400,
304,
2038,
29892,
13,
29937,
322,
8178,
6467,
29889,
29871,
3940,
393,
320,
4181,
360,
3187,
4283,
1109,
17006,
373,
599,
13,
29937,
10452,
17240,
29889,
13,
13,
29937,
289,
29897,
529,
5813,
29958,
4083,
393,
591,
881,
2125,
278,
10898,
393,
748,
701,
13,
29937,
1549,
278,
1644,
690,
310,
260,
27280,
17143,
336,
322,
2125,
278,
3929,
3742,
598,
14581,
29889,
29871,
350,
2692,
306,
13,
29937,
1348,
445,
338,
451,
825,
591,
864,
856,
14440,
338,
7291,
310,
278,
6198,
13,
29937,
382,
8584,
770,
408,
15648,
373,
1813,
29871,
29941,
29929,
29900,
310,
670,
5650,
376,
29911,
1300,
10839,
13,
29937,
3367,
574,
8250,
310,
2211,
29899,
1171,
361,
3361,
1642,
29871,
450,
6198,
382,
8584,
770,
12080,
13,
29937,
297,
379,
29985,
29906,
29898,
29924,
29892,
320,
29890,
4518,
341,
511,
577,
338,
3929,
3742,
598,
14581,
304,
385,
1543,
310,
379,
29918,
29896,
29898,
29924,
511,
13,
29937,
9875,
491,
263,
4333,
310,
12104,
29889,
13,
13,
29937,
274,
29897,
518,
29906,
29900,
29896,
29929,
29899,
29900,
29941,
29899,
29941,
29896,
29962,
739,
2444,
393,
29892,
363,
1301,
3901,
2453,
3241,
3367,
574,
8250,
13,
29937,
297,
278,
29871,
29896,
29953,
16411,
29892,
278,
382,
8584,
770,
338,
2337,
5225,
470,
1023,
29899,
29873,
943,
291,
29889,
13,
29937,
3940,
393,
727,
526,
14682,
3361,
341,
297,
278,
16411,
988,
379,
29985,
29906,
29898,
29924,
29892,
320,
29999,
29999,
29897,
756,
13,
29937,
6374,
7115,
856,
29871,
1724,
1048,
7736,
260,
943,
291,
29973,
13,
13,
29937,
894,
29901,
960,
278,
2453,
3241,
3367,
574,
2785,
338,
7636,
29899,
12236,
519,
29892,
947,
278,
13,
29937,
382,
8584,
770,
1109,
728,
29973,
13,
13,
29937,
673,
29901,
3869,
29889,
29871,
2266,
338,
263,
1873,
310,
263,
10679,
411,
27650,
13,
29937,
518,
29906,
29900,
29906,
29900,
29899,
29900,
29946,
29899,
29900,
29941,
29962,
448,
540,
4083,
278,
1494,
29901,
13,
13,
29937,
12142,
393,
383,
338,
263,
900,
11685,
8988,
491,
278,
14698,
5443,
287,
13,
29937,
7101,
29889,
29871,
2803,
18351,
367,
278,
5190,
18806,
296,
11846,
304,
383,
29889,
29871,
1334,
1348,
310,
13,
29937,
321,
29898,
10496,
29897,
408,
1641,
278,
14979,
4080,
304,
18351,
2534,
263,
4004,
29889,
29871,
2803,
402,
367,
13,
29937,
278,
900,
11685,
8988,
491,
278,
7568,
313,
8245,
7933,
29897,
5443,
287,
7101,
29889,
29871,
960,
13,
29937,
402,
338,
1301,
874,
873,
7769,
519,
313,
8245,
7636,
29899,
12236,
3097,
310,
278,
2453,
3241,
13,
29937,
3367,
574,
2785,
29897,
769,
402,
320,
5030,
383,
4076,
278,
7429,
4004,
29892,
322,
321,
29898,
10496,
29897,
353,
13,
29937,
29871,
29900,
29889,
29871,
3940,
393,
402,
320,
5030,
383,
4076,
29892,
363,
1432,
1298,
29892,
263,
5101,
310,
3291,
297,
13,
29937,
278,
5190,
18806,
296,
8607,
29889,
29871,
1105,
1235,
349,
10496,
367,
278,
2060,
573,
5190,
18806,
296,
13,
29937,
11846,
304,
383,
29889,
29871,
910,
11630,
756,
263,
4004,
29892,
577,
321,
29898,
29925,
10496,
29897,
353,
29871,
29900,
29889,
29871,
2567,
29892,
13,
29937,
278,
11846,
18351,
338,
263,
3765,
4612,
310,
278,
11846,
349,
10496,
29889,
13,
13,
29937,
6015,
326,
29901,
450,
321,
8584,
770,
338,
6674,
506,
1230,
411,
3390,
304,
18469,
313,
262,
13,
29937,
1716,
4771,
267,
467,
13,
13,
29937,
2973,
278,
5995,
297,
1361,
29892,
591,
505,
13,
13,
29937,
29871,
29906,
334,
321,
29898,
10496,
29897,
353,
321,
29898,
29925,
10496,
29897,
353,
29871,
29900,
13,
13,
29937,
1334,
21049,
346,
393,
321,
29898,
10496,
29897,
338,
2845,
5225,
470,
1023,
29899,
29873,
943,
291,
29889,
13,
13,
13,
29937,
29871,
29929,
29889,
8251,
292,
775,
13,
13,
13,
29992,
492,
495,
284,
13,
1753,
1797,
29918,
974,
29918,
29872,
8584,
29918,
1990,
29918,
17699,
29898,
3626,
29892,
10696,
1125,
13,
1678,
9995,
13,
1678,
16969,
278,
1797,
310,
278,
321,
8584,
770,
29889,
13,
1678,
9995,
13,
1678,
736,
1797,
29918,
974,
29918,
29872,
8584,
29918,
1990,
29898,
29883,
711,
618,
653,
29898,
3626,
29892,
10696,
511,
321,
8584,
29918,
29883,
542,
13317,
29898,
3626,
29892,
10696,
876,
13,
13,
13,
1753,
10272,
29918,
2098,
29918,
974,
29918,
29872,
8584,
29918,
13203,
29898,
1445,
29918,
262,
29892,
1353,
29922,
8516,
29892,
934,
29918,
449,
29922,
8516,
1125,
13,
1678,
848,
29918,
262,
353,
6088,
29918,
1272,
29918,
1445,
29898,
1445,
29918,
262,
29897,
13,
1678,
848,
29918,
262,
353,
518,
1220,
29889,
5451,
703,
16521,
363,
1196,
297,
848,
29918,
262,
29962,
13,
1678,
565,
1353,
2804,
6213,
29901,
13,
4706,
848,
29918,
262,
353,
848,
29918,
262,
7503,
4537,
29962,
13,
1678,
848,
29918,
449,
353,
5159,
13,
1678,
16126,
353,
5159,
13,
1678,
363,
474,
29892,
1196,
297,
26985,
29898,
1272,
29918,
262,
1125,
13,
4706,
565,
474,
1273,
29871,
29945,
29900,
1275,
29871,
29900,
29901,
13,
9651,
1596,
29898,
5135,
29896,
29889,
29900,
29930,
29875,
6802,
29898,
29896,
29889,
29900,
29930,
2435,
29898,
1272,
29918,
262,
8243,
7431,
29898,
1272,
29918,
449,
876,
1723,
13,
4706,
4365,
353,
1196,
29961,
29900,
29962,
13,
4706,
3367,
29892,
10696,
353,
338,
359,
335,
29918,
517,
29918,
3626,
29918,
2521,
29898,
18816,
29897,
13,
4706,
396,
10696,
353,
518,
524,
29898,
15670,
29897,
363,
5497,
297,
10696,
29918,
29879,
29962,
13,
4706,
16256,
29918,
29872,
8584,
353,
1797,
29918,
974,
29918,
29872,
8584,
29918,
1990,
29898,
29883,
711,
618,
653,
29898,
3626,
29892,
10696,
511,
321,
8584,
29918,
29883,
542,
13317,
29898,
3626,
29892,
10696,
876,
13,
4706,
565,
16256,
29918,
29872,
8584,
1275,
376,
5464,
29899,
29873,
943,
291,
1115,
13,
9651,
16126,
29889,
4397,
29898,
18816,
29897,
13,
9651,
1596,
29898,
18816,
718,
376,
756,
1661,
29899,
29873,
943,
291,
382,
8584,
770,
6824,
6824,
1159,
13,
4706,
25342,
16256,
29918,
29872,
8584,
1275,
29871,
29896,
29901,
29871,
396,
1797,
338,
697,
577,
518,
29923,
29962,
353,
29871,
29900,
29889,
29871,
6780,
292,
29889,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1196,
29918,
449,
353,
518,
18816,
29892,
851,
29898,
21962,
29918,
29872,
8584,
4638,
13,
9651,
1196,
29918,
449,
29889,
21843,
29898,
1220,
29961,
29896,
29901,
2314,
13,
9651,
848,
29918,
449,
29889,
4397,
29898,
1220,
29918,
449,
29897,
13,
1678,
565,
934,
29918,
449,
2804,
6213,
29901,
13,
4706,
2436,
29918,
1272,
29918,
1445,
29898,
1272,
29918,
449,
29892,
934,
29918,
449,
29897,
13,
1678,
1596,
29898,
4852,
1761,
310,
16126,
29901,
613,
16126,
29897,
1723,
13,
1678,
736,
848,
29918,
449,
13,
2
] |
tests/test_utils.py | nhoffman/static_html_demo | 0 | 104010 | <filename>tests/test_utils.py<gh_stars>0
"""
Test utils module.
"""
import logging
from static_html_demo.utils import opener
from __init__ import TestBase, get_testfile
log = logging.getLogger(__name__)
class TestOpener(TestBase):
def setUp(self):
with open(get_testfile('lorem.txt')) as f:
self.firstline = f.next()
def test01(self):
for suffix in ['txt', 'gz', 'bz2']:
fn = get_testfile('lorem.'+suffix)
fobj = opener(fn)
self.assertEqual(fobj.next(), self.firstline)
def test02(self):
for suffix in ['txt', 'gz', 'bz2']:
fn = get_testfile('lorem.'+suffix)
fobj = opener(fn, 'r')
self.assertEqual(fobj.next(), self.firstline)
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
13239,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
3057,
3667,
29879,
3883,
29889,
13,
15945,
29908,
13,
13,
5215,
12183,
13,
13,
3166,
2294,
29918,
1420,
29918,
17482,
29889,
13239,
1053,
1015,
759,
13,
13,
3166,
4770,
2344,
1649,
1053,
4321,
5160,
29892,
679,
29918,
1688,
1445,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
4321,
11746,
759,
29898,
3057,
5160,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
411,
1722,
29898,
657,
29918,
1688,
1445,
877,
29880,
3668,
29889,
3945,
8785,
408,
285,
29901,
13,
9651,
1583,
29889,
4102,
1220,
353,
285,
29889,
4622,
580,
13,
13,
1678,
822,
1243,
29900,
29896,
29898,
1311,
1125,
13,
4706,
363,
25557,
297,
6024,
3945,
742,
525,
18828,
742,
525,
29890,
29920,
29906,
2033,
29901,
13,
9651,
7876,
353,
679,
29918,
1688,
1445,
877,
29880,
3668,
6169,
29974,
2146,
600,
861,
29897,
13,
9651,
285,
5415,
353,
1015,
759,
29898,
9144,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
29888,
5415,
29889,
4622,
3285,
1583,
29889,
4102,
1220,
29897,
13,
13,
1678,
822,
1243,
29900,
29906,
29898,
1311,
1125,
13,
4706,
363,
25557,
297,
6024,
3945,
742,
525,
18828,
742,
525,
29890,
29920,
29906,
2033,
29901,
13,
9651,
7876,
353,
679,
29918,
1688,
1445,
877,
29880,
3668,
6169,
29974,
2146,
600,
861,
29897,
13,
9651,
285,
5415,
353,
1015,
759,
29898,
9144,
29892,
525,
29878,
1495,
13,
9651,
1583,
29889,
9294,
9843,
29898,
29888,
5415,
29889,
4622,
3285,
1583,
29889,
4102,
1220,
29897,
13,
2
] |
src/scout_apm/core/cli/core_agent_manager.py | tim-schilling/scout_apm_python | 60 | 168454 | <gh_stars>10-100
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import logging
from scout_apm.core import CoreAgentManager
logger = logging.getLogger(__name__)
def main(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument(
"-v", "--verbose", help="increase output verbosity", action="count"
)
subparsers = parser.add_subparsers(
title="subcommands", description="valid subcommands", dest="subparser"
)
subparsers.add_parser("download")
subparsers.add_parser("launch")
args = parser.parse_args(argv)
if args.verbose is not None:
if args.verbose >= 2:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
core_agent_manager = CoreAgentManager()
getattr(core_agent_manager, args.subparser)()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
14137,
29922,
9420,
29899,
29947,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
13,
13,
5215,
1852,
5510,
13,
5215,
12183,
13,
13,
3166,
885,
449,
29918,
481,
29885,
29889,
3221,
1053,
10239,
19661,
3260,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
1667,
29898,
19218,
29922,
8516,
1125,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29894,
613,
376,
489,
369,
15828,
613,
1371,
543,
262,
1037,
559,
1962,
9750,
359,
537,
613,
3158,
543,
2798,
29908,
13,
1678,
1723,
13,
13,
1678,
1014,
862,
4253,
353,
13812,
29889,
1202,
29918,
1491,
862,
4253,
29898,
13,
4706,
3611,
543,
1491,
26381,
613,
6139,
543,
3084,
1014,
26381,
613,
2731,
543,
1491,
16680,
29908,
13,
1678,
1723,
13,
1678,
1014,
862,
4253,
29889,
1202,
29918,
16680,
703,
10382,
1159,
13,
1678,
1014,
862,
4253,
29889,
1202,
29918,
16680,
703,
15343,
1159,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
29898,
19218,
29897,
13,
13,
1678,
565,
6389,
29889,
369,
15828,
338,
451,
6213,
29901,
13,
4706,
565,
6389,
29889,
369,
15828,
6736,
29871,
29906,
29901,
13,
9651,
12183,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
18525,
29897,
13,
4706,
1683,
29901,
13,
9651,
12183,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
29897,
13,
13,
1678,
7136,
29918,
14748,
29918,
12847,
353,
10239,
19661,
3260,
580,
13,
1678,
679,
5552,
29898,
3221,
29918,
14748,
29918,
12847,
29892,
6389,
29889,
1491,
16680,
29897,
580,
13,
2
] |
retry_requests.py | cube3x3x3/get_radio | 0 | 197518 | import logging
import unittest
import requests
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def custom_session(
retries=5,
backoff_factor=0.5,
status_forcelist=(500, 502, 504),
session=None,
):
session = session or requests.Session()
retry = requests.packages.urllib3.util.retry.Retry(
total=retries,
read=retries,
connect=retries,
backoff_factor=backoff_factor,
status_forcelist=status_forcelist,
)
adapter = requests.adapters.HTTPAdapter(max_retries=retry)
session.mount('http://', adapter)
session.mount('https://', adapter)
return session
class TestRequestsMethods(unittest.TestCase):
def test_retry(self):
logger.info('start test_retry')
with self.assertRaises(requests.exceptions.ConnectionError) as x:
response = custom_session(2, 0.2).get(
'http://localhost:9999',
)
logger.info('test_retry %s', x.exception)
logger.info('end test_retry')
def test_timeout(self):
logger.info('start test_timeout2')
with self.assertRaises(requests.exceptions.Timeout) as x:
response = custom_session(2, 0.2).get(
'http://httpbin.org/delay/10',
timeout=0.001
)
logger.info('test_timeout2 %s', x.exception)
logger.info('end test_timeout2')
def test_status500(self):
logger.info('start test_status')
with self.assertRaises(requests.exceptions.RetryError) as x:
response = custom_session(2, 0.2).get(
'http://httpbin.org/status/500',
)
logger.info('test_status500 %s', x.exception)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
unittest.main(verbosity=2)
| [
1,
1053,
12183,
30004,
13,
5215,
443,
27958,
30004,
13,
5215,
7274,
30004,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
8443,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
11690,
8443,
13,
30004,
13,
1753,
2888,
29918,
7924,
29898,
30004,
13,
1678,
3240,
2722,
29922,
29945,
11167,
13,
1678,
1250,
2696,
29918,
19790,
29922,
29900,
29889,
29945,
11167,
13,
1678,
4660,
29918,
1454,
2242,
391,
7607,
29945,
29900,
29900,
29892,
29871,
29945,
29900,
29906,
29892,
29871,
29945,
29900,
29946,
511,
30004,
13,
1678,
4867,
29922,
8516,
11167,
13,
1125,
30004,
13,
1678,
4867,
353,
4867,
470,
7274,
29889,
7317,
26471,
13,
1678,
337,
2202,
353,
7274,
29889,
8318,
29889,
2271,
1982,
29941,
29889,
4422,
29889,
276,
2202,
29889,
8015,
719,
29898,
30004,
13,
4706,
3001,
29922,
2267,
2722,
11167,
13,
4706,
1303,
29922,
2267,
2722,
11167,
13,
4706,
4511,
29922,
2267,
2722,
11167,
13,
4706,
1250,
2696,
29918,
19790,
29922,
1627,
2696,
29918,
19790,
11167,
13,
4706,
4660,
29918,
1454,
2242,
391,
29922,
4882,
29918,
1454,
2242,
391,
11167,
13,
1678,
1723,
30004,
13,
1678,
13304,
353,
7274,
29889,
328,
481,
2153,
29889,
10493,
6168,
29898,
3317,
29918,
2267,
2722,
29922,
276,
2202,
8443,
13,
1678,
4867,
29889,
16476,
877,
1124,
597,
742,
13304,
8443,
13,
1678,
4867,
29889,
16476,
877,
991,
597,
742,
13304,
8443,
13,
1678,
736,
4867,
30004,
13,
30004,
13,
1990,
4321,
3089,
29879,
26112,
29898,
348,
27958,
29889,
3057,
8259,
1125,
30004,
13,
1678,
822,
1243,
29918,
276,
2202,
29898,
1311,
1125,
30004,
13,
4706,
17927,
29889,
3888,
877,
2962,
1243,
29918,
276,
2202,
1495,
30004,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
24830,
29889,
11739,
29879,
29889,
5350,
2392,
29897,
408,
921,
29901,
30004,
13,
9651,
2933,
353,
2888,
29918,
7924,
29898,
29906,
29892,
29871,
29900,
29889,
29906,
467,
657,
29898,
30004,
13,
18884,
525,
1124,
597,
7640,
29901,
29929,
29929,
29929,
29929,
23592,
13,
9651,
1723,
30004,
13,
4706,
17927,
29889,
3888,
877,
1688,
29918,
276,
2202,
1273,
29879,
742,
921,
29889,
11739,
8443,
13,
4706,
17927,
29889,
3888,
877,
355,
1243,
29918,
276,
2202,
1495,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
15619,
29898,
1311,
1125,
30004,
13,
4706,
17927,
29889,
3888,
877,
2962,
1243,
29918,
15619,
29906,
1495,
30004,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
24830,
29889,
11739,
29879,
29889,
10851,
29897,
408,
921,
29901,
30004,
13,
9651,
2933,
353,
2888,
29918,
7924,
29898,
29906,
29892,
29871,
29900,
29889,
29906,
467,
657,
29898,
30004,
13,
18884,
525,
1124,
597,
1124,
2109,
29889,
990,
29914,
18829,
29914,
29896,
29900,
23592,
13,
18884,
11815,
29922,
29900,
29889,
29900,
29900,
29896,
30004,
13,
9651,
1723,
30004,
13,
4706,
17927,
29889,
3888,
877,
1688,
29918,
15619,
29906,
1273,
29879,
742,
921,
29889,
11739,
8443,
13,
4706,
17927,
29889,
3888,
877,
355,
1243,
29918,
15619,
29906,
1495,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
4882,
29945,
29900,
29900,
29898,
1311,
1125,
30004,
13,
4706,
17927,
29889,
3888,
877,
2962,
1243,
29918,
4882,
1495,
30004,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
24830,
29889,
11739,
29879,
29889,
8015,
719,
2392,
29897,
408,
921,
29901,
30004,
13,
18884,
2933,
353,
2888,
29918,
7924,
29898,
29906,
29892,
29871,
29900,
29889,
29906,
467,
657,
29898,
30004,
13,
462,
1678,
525,
1124,
597,
1124,
2109,
29889,
990,
29914,
4882,
29914,
29945,
29900,
29900,
23592,
13,
18884,
1723,
30004,
13,
4706,
17927,
29889,
3888,
877,
1688,
29918,
4882,
29945,
29900,
29900,
1273,
29879,
742,
921,
29889,
11739,
8443,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
12183,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
8443,
13,
1678,
443,
27958,
29889,
3396,
29898,
18248,
359,
537,
29922,
29906,
8443,
13,
30004,
13,
30004,
13,
2
] |
janny/utils.py | icyphox/janny | 5 | 117830 | import json
import re
from datetime import timedelta
from types import SimpleNamespace
from janny.config import API_HOST
from janny.auth import SESSION
def get(path: str) -> SimpleNamespace:
"""Convert a JSON response into a Python object"""
s = SESSION
data = s.get(API_HOST + path).content
obj = json.loads(data, object_hook=lambda d: SimpleNamespace(**d))
return obj
timedelta_regex = (
r"((?P<days>-?\d+)d)?" r"((?P<hours>-?\d+)h)?" r"((?P<minutes>-?\d+)m)?"
)
timedelta_pattern = re.compile(timedelta_regex, re.IGNORECASE)
def parse_delta(delta: str) -> timedelta:
"""Parses a human readable timedelta (3d5h19m) into a datetime.timedelta.
Delta includes:
* Xd days
* Xh hours
* Xm minutes
Values can be negative following timedelta's rules. Eg: -5h-30m
"""
match = timedelta_pattern.match(delta)
if match:
parts = {k: int(v) for k, v in match.groupdict().items() if v}
return timedelta(**parts)
return timedelta(0)
# List of running threads. Storing it here to prevent circular imports.
RUNNING = list()
| [
1,
1053,
4390,
13,
5215,
337,
13,
3166,
12865,
1053,
5335,
287,
2554,
13,
3166,
4072,
1053,
12545,
23335,
13,
13,
3166,
432,
14763,
29889,
2917,
1053,
3450,
29918,
20832,
13,
3166,
432,
14763,
29889,
5150,
1053,
3725,
13507,
13,
13,
13,
1753,
679,
29898,
2084,
29901,
851,
29897,
1599,
12545,
23335,
29901,
13,
1678,
9995,
18455,
263,
4663,
2933,
964,
263,
5132,
1203,
15945,
29908,
13,
1678,
269,
353,
3725,
13507,
13,
1678,
848,
353,
269,
29889,
657,
29898,
8787,
29918,
20832,
718,
2224,
467,
3051,
13,
1678,
5446,
353,
4390,
29889,
18132,
29898,
1272,
29892,
1203,
29918,
20849,
29922,
2892,
270,
29901,
12545,
23335,
29898,
1068,
29881,
876,
13,
1678,
736,
5446,
13,
13,
13,
9346,
287,
2554,
29918,
13087,
353,
313,
13,
1678,
364,
29908,
3552,
29973,
29925,
29966,
16700,
29958,
29899,
29973,
29905,
29881,
28135,
29881,
29897,
3026,
364,
29908,
3552,
29973,
29925,
29966,
29882,
2470,
29958,
29899,
29973,
29905,
29881,
28135,
29882,
29897,
3026,
364,
29908,
3552,
29973,
29925,
29966,
1195,
2667,
29958,
29899,
29973,
29905,
29881,
28135,
29885,
29897,
3026,
13,
29897,
13,
13,
9346,
287,
2554,
29918,
11037,
353,
337,
29889,
12198,
29898,
9346,
287,
2554,
29918,
13087,
29892,
337,
29889,
6259,
6632,
1525,
23487,
29897,
13,
13,
13,
1753,
6088,
29918,
4181,
29898,
4181,
29901,
851,
29897,
1599,
5335,
287,
2554,
29901,
13,
1678,
9995,
29925,
1503,
267,
263,
5199,
19909,
5335,
287,
2554,
313,
29941,
29881,
29945,
29882,
29896,
29929,
29885,
29897,
964,
263,
12865,
29889,
9346,
287,
2554,
29889,
13,
1678,
360,
2554,
7805,
29901,
13,
1678,
334,
1060,
29881,
3841,
13,
1678,
334,
1060,
29882,
6199,
13,
1678,
334,
1060,
29885,
6233,
13,
1678,
2630,
1041,
508,
367,
8178,
1494,
5335,
287,
2554,
29915,
29879,
6865,
29889,
14304,
29901,
448,
29945,
29882,
29899,
29941,
29900,
29885,
13,
1678,
9995,
13,
1678,
1993,
353,
5335,
287,
2554,
29918,
11037,
29889,
4352,
29898,
4181,
29897,
13,
1678,
565,
1993,
29901,
13,
4706,
5633,
353,
426,
29895,
29901,
938,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
1993,
29889,
2972,
8977,
2141,
7076,
580,
565,
325,
29913,
13,
4706,
736,
5335,
287,
2554,
29898,
1068,
20895,
29897,
13,
1678,
736,
5335,
287,
2554,
29898,
29900,
29897,
13,
13,
13,
29937,
2391,
310,
2734,
9717,
29889,
624,
8253,
372,
1244,
304,
5557,
19308,
24802,
29889,
13,
29934,
3904,
29940,
4214,
353,
1051,
580,
13,
2
] |
w11-functional-programming/teach-sort-lambda/pupils.py | carloswm85/2021-cs111-programming-with-functions | 0 | 145744 | import csv
# Each row in the pupils.csv file contains three elements.
# These are the indexes of the elements in each row.
GIVEN_NAME_INDEX = 0
SURNAME_INDEX = 1
BIRTHDATE_INDEX = 2
def main():
path = "E:/GitHub/2021-cs111-programming-with-functions/w11-functional-programming/teach-sort/pupils.csv"
# Call the read_compound_list function to read the pupils.csv file into a list named students_list.
students_list = read_compound_list(path)
# Write a lambda function that will extract the birthdate from a student.
birthdate_func = lambda birthdate: birthdate[BIRTHDATE_INDEX]
given_name_func = lambda given_name: given_name[GIVEN_NAME_INDEX]
birthdate_func_2 = lambda birthdate: birthdate[BIRTHDATE_INDEX]
# Write a call to the sorted function that will sort the students_list by birthdate from oldest to youngest.
sorted_students_list_bd = sorted(students_list, key = birthdate_func)
sorted_students_list_gn = sorted(students_list, key = given_name_func)
sorted_students_list_bd_2 = sorted(students_list, key = birthdate_func_2)
print("\nLISTA #1:")
print_list(students_list)
# Print the students_list by calling the print_list function.
print("\nLISTA #2:")
print_list(sorted_students_list_bd)
# Within the main function, replace the code that sorts the students_list by birthdate, with code that sorts the students_list by given name.
print("\nLISTA #3:")
print_list(sorted_students_list_gn)
# Within the main function, replace the code that sorts the students_list by birthdate, with code that sorts the students_list by birth month and day. In other words, the code should sort the students_list by birthdate but ignore the year when a student was born.
print("\nLISTA #4:")
print_list(sorted_students_list_bd_2)
def read_compound_list(filename):
"""Read the text from a CSV file into a compound list.
The compound list will contain small lists. Each small
list will contain the data from one row of the CSV file.
Parameter
filename: the name of the CSV file to read.
Return: the compound list
"""
# Create an empty list.
compound_list = []
# Open the CSV file for reading.
with open(filename, "rt") as csv_file:
# Use the csv module to create a reader
# object that will read from the opened file.
reader = csv.reader(csv_file)
# The first line of the CSV file contains column headings
# and not a student's I-Number and name, so this statement
# skips the first line of the CSV file.
next(reader)
# Process each row in the CSV file.
for row in reader:
# Append the current row at the end of the compound list.
compound_list.append(row)
return compound_list
def print_list(lista):
for element in lista:
print(element)
if __name__ == "__main__":
main()
| [
1,
1053,
11799,
13,
13,
13,
29937,
7806,
1948,
297,
278,
23449,
2719,
29889,
7638,
934,
3743,
2211,
3161,
29889,
13,
29937,
4525,
526,
278,
18111,
310,
278,
3161,
297,
1269,
1948,
29889,
13,
29954,
5667,
1430,
29918,
5813,
29918,
27992,
353,
29871,
29900,
13,
29903,
4574,
5813,
29918,
27992,
353,
29871,
29896,
13,
29933,
8193,
4690,
6248,
29918,
27992,
353,
29871,
29906,
13,
13,
1753,
1667,
7295,
13,
1678,
2224,
353,
376,
29923,
8419,
28712,
16046,
29914,
29906,
29900,
29906,
29896,
29899,
2395,
29896,
29896,
29896,
29899,
28426,
29899,
2541,
29899,
12171,
29914,
29893,
29896,
29896,
29899,
2220,
284,
29899,
28426,
29914,
371,
496,
29899,
6605,
29914,
29886,
786,
2719,
29889,
7638,
29908,
13,
13,
1678,
396,
8251,
278,
1303,
29918,
2388,
618,
29918,
1761,
740,
304,
1303,
278,
23449,
2719,
29889,
7638,
934,
964,
263,
1051,
4257,
8041,
29918,
1761,
29889,
13,
1678,
8041,
29918,
1761,
353,
1303,
29918,
2388,
618,
29918,
1761,
29898,
2084,
29897,
13,
13,
1678,
396,
14350,
263,
14013,
740,
393,
674,
6597,
278,
12060,
1256,
515,
263,
8368,
29889,
13,
1678,
12060,
1256,
29918,
9891,
353,
14013,
12060,
1256,
29901,
12060,
1256,
29961,
29933,
8193,
4690,
6248,
29918,
27992,
29962,
13,
1678,
2183,
29918,
978,
29918,
9891,
353,
14013,
2183,
29918,
978,
29901,
2183,
29918,
978,
29961,
29954,
5667,
1430,
29918,
5813,
29918,
27992,
29962,
13,
1678,
12060,
1256,
29918,
9891,
29918,
29906,
353,
14013,
12060,
1256,
29901,
12060,
1256,
29961,
29933,
8193,
4690,
6248,
29918,
27992,
29962,
13,
13,
1678,
396,
14350,
263,
1246,
304,
278,
12705,
740,
393,
674,
2656,
278,
8041,
29918,
1761,
491,
12060,
1256,
515,
23947,
304,
4123,
342,
29889,
13,
1678,
12705,
29918,
18082,
1237,
29918,
1761,
29918,
6448,
353,
12705,
29898,
18082,
1237,
29918,
1761,
29892,
1820,
353,
12060,
1256,
29918,
9891,
29897,
268,
13,
1678,
12705,
29918,
18082,
1237,
29918,
1761,
29918,
5138,
353,
12705,
29898,
18082,
1237,
29918,
1761,
29892,
1820,
353,
2183,
29918,
978,
29918,
9891,
29897,
29871,
13,
1678,
12705,
29918,
18082,
1237,
29918,
1761,
29918,
6448,
29918,
29906,
353,
12705,
29898,
18082,
1237,
29918,
1761,
29892,
1820,
353,
12060,
1256,
29918,
9891,
29918,
29906,
29897,
268,
13,
13,
1678,
1596,
14182,
29876,
24360,
29909,
396,
29896,
29901,
1159,
13,
1678,
1596,
29918,
1761,
29898,
18082,
1237,
29918,
1761,
29897,
13,
13,
1678,
396,
13905,
278,
8041,
29918,
1761,
491,
5432,
278,
1596,
29918,
1761,
740,
29889,
13,
1678,
1596,
14182,
29876,
24360,
29909,
396,
29906,
29901,
1159,
13,
1678,
1596,
29918,
1761,
29898,
24582,
29918,
18082,
1237,
29918,
1761,
29918,
6448,
29897,
13,
13,
1678,
396,
23732,
278,
1667,
740,
29892,
5191,
278,
775,
393,
23551,
278,
8041,
29918,
1761,
491,
12060,
1256,
29892,
411,
775,
393,
23551,
278,
8041,
29918,
1761,
491,
2183,
1024,
29889,
13,
1678,
1596,
14182,
29876,
24360,
29909,
396,
29941,
29901,
1159,
13,
1678,
1596,
29918,
1761,
29898,
24582,
29918,
18082,
1237,
29918,
1761,
29918,
5138,
29897,
13,
13,
1678,
396,
23732,
278,
1667,
740,
29892,
5191,
278,
775,
393,
23551,
278,
8041,
29918,
1761,
491,
12060,
1256,
29892,
411,
775,
393,
23551,
278,
8041,
29918,
1761,
491,
12060,
4098,
322,
2462,
29889,
512,
916,
3838,
29892,
278,
775,
881,
2656,
278,
8041,
29918,
1761,
491,
12060,
1256,
541,
11455,
278,
1629,
746,
263,
8368,
471,
6345,
29889,
13,
1678,
1596,
14182,
29876,
24360,
29909,
396,
29946,
29901,
1159,
13,
1678,
1596,
29918,
1761,
29898,
24582,
29918,
18082,
1237,
29918,
1761,
29918,
6448,
29918,
29906,
29897,
13,
13,
268,
13,
13,
1753,
1303,
29918,
2388,
618,
29918,
1761,
29898,
9507,
1125,
13,
1678,
9995,
6359,
278,
1426,
515,
263,
16874,
934,
964,
263,
752,
618,
1051,
29889,
13,
1678,
450,
752,
618,
1051,
674,
1712,
2319,
8857,
29889,
7806,
2319,
13,
1678,
1051,
674,
1712,
278,
848,
515,
697,
1948,
310,
278,
16874,
934,
29889,
13,
13,
1678,
24953,
13,
4706,
10422,
29901,
278,
1024,
310,
278,
16874,
934,
304,
1303,
29889,
13,
1678,
7106,
29901,
278,
752,
618,
1051,
13,
1678,
9995,
13,
1678,
396,
6204,
385,
4069,
1051,
29889,
13,
1678,
752,
618,
29918,
1761,
353,
5159,
13,
13,
1678,
396,
4673,
278,
16874,
934,
363,
5183,
29889,
13,
1678,
411,
1722,
29898,
9507,
29892,
376,
2273,
1159,
408,
11799,
29918,
1445,
29901,
13,
13,
4706,
396,
4803,
278,
11799,
3883,
304,
1653,
263,
9591,
13,
4706,
396,
1203,
393,
674,
1303,
515,
278,
6496,
934,
29889,
13,
4706,
9591,
353,
11799,
29889,
16950,
29898,
7638,
29918,
1445,
29897,
13,
13,
4706,
396,
450,
937,
1196,
310,
278,
16874,
934,
3743,
1897,
2343,
886,
13,
4706,
396,
322,
451,
263,
8368,
29915,
29879,
306,
29899,
4557,
322,
1024,
29892,
577,
445,
3229,
13,
4706,
396,
14993,
567,
278,
937,
1196,
310,
278,
16874,
934,
29889,
13,
4706,
2446,
29898,
16950,
29897,
13,
13,
4706,
396,
10554,
1269,
1948,
297,
278,
16874,
934,
29889,
13,
4706,
363,
1948,
297,
9591,
29901,
13,
13,
9651,
396,
22871,
278,
1857,
1948,
472,
278,
1095,
310,
278,
752,
618,
1051,
29889,
13,
9651,
752,
618,
29918,
1761,
29889,
4397,
29898,
798,
29897,
13,
13,
1678,
736,
752,
618,
29918,
1761,
13,
13,
1753,
1596,
29918,
1761,
29898,
19641,
1125,
13,
1678,
363,
1543,
297,
15023,
29901,
13,
4706,
1596,
29898,
5029,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
chaban/bots/telegram_bot.py | ibrag8998/botchaban | 1 | 92335 | import typing as typ
import httpx
from chaban.config import global_settings, settings
from chaban.core.exceptions import HttpMethodNotAllowed, TelegramAPIError
from chaban.handlers.base import mh_registry
from chaban.utils import MetaSingleton
from .telegram_methods import TelegramMethodsMixin
class TelegramBot(TelegramMethodsMixin, metaclass=MetaSingleton):
"""
Main telegram bot class.
All methods related to telegram api are defined in ``TelegramMethodsMixin``.
On init, get ``TELEGRAM_TOKEN`` from settings.
Settings are getting that token from env.
"""
_allowed_http_methods = global_settings.TELEGRAM_ALLOWED_HTTP_METHODS
def __init__(self):
# bot don't need the token as a separate constant, token is only used as part of
# the telegram api endpoint url
self._endpoint = "https://api.telegram.org/bot{}/".format(
settings.TELEGRAM_TOKEN
)
def _build_url(self, method_name: str) -> str:
return self._endpoint + method_name.lstrip("/")
def request(
self, method_name: str, http_method: str = "get", **kwargs
) -> typ.Dict[str, typ.Any]:
"""
Perform an HTTP :param http_method: request and pass the kwargs as params.
Returns a JSON.
"""
http_method = http_method.lower()
if http_method not in self._allowed_http_methods:
raise HttpMethodNotAllowed
return httpx.request(
http_method, self._build_url(method_name), params=kwargs
).json()
def start_polling(self):
for message in self._poll_updates():
mh_registry.get_handler_and_handle(message)
def _poll_updates(self) -> typ.Iterator[typ.Dict[str, typ.Any]]:
"""
Main loop.
Getting updates from telegram, handling offset, yielding each update's message
"""
# set offset to 0
offset = 0
# start loop
while True:
# get json response from telegram
resp = self.get_updates(offset=offset)
# if not ok, raise the error
if not resp["ok"]:
raise TelegramAPIError("Response JSON: {}".format(resp))
# iterate through updates from resp json
for update in resp["result"]:
# update offset
offset = max(offset, update["update_id"] + 1)
# yield message
yield update.get("message", update.get("edited_message"))
| [
1,
1053,
19229,
408,
2393,
13,
13,
5215,
1732,
29916,
13,
13,
3166,
521,
10910,
29889,
2917,
1053,
5534,
29918,
11027,
29892,
6055,
13,
3166,
521,
10910,
29889,
3221,
29889,
11739,
29879,
1053,
9056,
4062,
3664,
15930,
287,
29892,
9699,
1393,
8787,
2392,
13,
3166,
521,
10910,
29889,
3179,
9306,
29889,
3188,
1053,
286,
29882,
29918,
1727,
6020,
13,
3166,
521,
10910,
29889,
13239,
1053,
20553,
10873,
11285,
13,
13,
3166,
869,
15494,
1393,
29918,
23515,
1053,
9699,
1393,
26112,
29924,
861,
262,
13,
13,
13,
1990,
9699,
1393,
29933,
327,
29898,
29911,
6146,
1393,
26112,
29924,
861,
262,
29892,
1539,
562,
605,
29922,
19346,
10873,
11285,
1125,
13,
1678,
9995,
13,
1678,
4241,
4382,
1393,
9225,
770,
29889,
13,
13,
1678,
2178,
3519,
4475,
304,
4382,
1393,
7882,
526,
3342,
297,
4954,
29911,
6146,
1393,
26112,
29924,
861,
262,
29952,
1412,
13,
13,
1678,
1551,
2069,
29892,
679,
4954,
4330,
1307,
29954,
25058,
29918,
4986,
29968,
1430,
16159,
515,
6055,
29889,
13,
1678,
19215,
526,
2805,
393,
5993,
515,
8829,
29889,
13,
1678,
9995,
13,
13,
1678,
903,
24622,
29918,
1124,
29918,
23515,
353,
5534,
29918,
11027,
29889,
4330,
1307,
29954,
25058,
29918,
1964,
27998,
3352,
29918,
10493,
29918,
2303,
4690,
29949,
8452,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
396,
9225,
1016,
29915,
29873,
817,
278,
5993,
408,
263,
5004,
4868,
29892,
5993,
338,
871,
1304,
408,
760,
310,
13,
4706,
396,
278,
4382,
1393,
7882,
16248,
3142,
13,
4706,
1583,
3032,
29734,
353,
376,
991,
597,
2754,
29889,
15494,
1393,
29889,
990,
29914,
7451,
29912,
6822,
1642,
4830,
29898,
13,
9651,
6055,
29889,
4330,
1307,
29954,
25058,
29918,
4986,
29968,
1430,
13,
4706,
1723,
13,
13,
1678,
822,
903,
4282,
29918,
2271,
29898,
1311,
29892,
1158,
29918,
978,
29901,
851,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
29734,
718,
1158,
29918,
978,
29889,
29880,
17010,
11974,
1159,
13,
13,
1678,
822,
2009,
29898,
13,
4706,
1583,
29892,
1158,
29918,
978,
29901,
851,
29892,
1732,
29918,
5696,
29901,
851,
353,
376,
657,
613,
3579,
19290,
13,
1678,
1723,
1599,
2393,
29889,
21533,
29961,
710,
29892,
2393,
29889,
10773,
5387,
13,
4706,
9995,
13,
4706,
27313,
385,
7331,
584,
3207,
1732,
29918,
5696,
29901,
2009,
322,
1209,
278,
9049,
5085,
408,
8636,
29889,
13,
13,
4706,
16969,
263,
4663,
29889,
13,
4706,
9995,
13,
4706,
1732,
29918,
5696,
353,
1732,
29918,
5696,
29889,
13609,
580,
13,
13,
4706,
565,
1732,
29918,
5696,
451,
297,
1583,
3032,
24622,
29918,
1124,
29918,
23515,
29901,
13,
9651,
12020,
9056,
4062,
3664,
15930,
287,
13,
13,
4706,
736,
1732,
29916,
29889,
3827,
29898,
13,
9651,
1732,
29918,
5696,
29892,
1583,
3032,
4282,
29918,
2271,
29898,
5696,
29918,
978,
511,
8636,
29922,
19290,
13,
4706,
13742,
3126,
580,
13,
13,
1678,
822,
1369,
29918,
3733,
1847,
29898,
1311,
1125,
13,
4706,
363,
2643,
297,
1583,
3032,
29886,
3028,
29918,
786,
15190,
7295,
13,
9651,
286,
29882,
29918,
1727,
6020,
29889,
657,
29918,
13789,
29918,
392,
29918,
8411,
29898,
4906,
29897,
13,
13,
1678,
822,
903,
29886,
3028,
29918,
786,
15190,
29898,
1311,
29897,
1599,
2393,
29889,
20277,
29961,
22449,
29889,
21533,
29961,
710,
29892,
2393,
29889,
10773,
5262,
29901,
13,
4706,
9995,
13,
4706,
4241,
2425,
29889,
13,
13,
4706,
24162,
11217,
515,
4382,
1393,
29892,
11415,
9210,
29892,
7709,
292,
1269,
2767,
29915,
29879,
2643,
13,
4706,
9995,
13,
4706,
396,
731,
9210,
304,
29871,
29900,
13,
4706,
9210,
353,
29871,
29900,
13,
13,
4706,
396,
1369,
2425,
13,
4706,
1550,
5852,
29901,
13,
9651,
396,
679,
4390,
2933,
515,
4382,
1393,
13,
9651,
4613,
353,
1583,
29889,
657,
29918,
786,
15190,
29898,
10289,
29922,
10289,
29897,
13,
13,
9651,
396,
565,
451,
3431,
29892,
12020,
278,
1059,
13,
9651,
565,
451,
4613,
3366,
554,
3108,
29901,
13,
18884,
12020,
9699,
1393,
8787,
2392,
703,
5103,
4663,
29901,
6571,
1642,
4830,
29898,
13713,
876,
13,
13,
9651,
396,
13649,
1549,
11217,
515,
4613,
4390,
13,
9651,
363,
2767,
297,
4613,
3366,
2914,
3108,
29901,
13,
18884,
396,
2767,
9210,
13,
18884,
9210,
353,
4236,
29898,
10289,
29892,
2767,
3366,
5504,
29918,
333,
3108,
718,
29871,
29896,
29897,
13,
18884,
396,
7709,
2643,
13,
18884,
7709,
2767,
29889,
657,
703,
4906,
613,
2767,
29889,
657,
703,
287,
1573,
29918,
4906,
5783,
13,
2
] |
tests/build_feedstock_test.py | jayfurmanek/open-ce-builder | 0 | 1609967 | <gh_stars>0
# *****************************************************************
# (C) Copyright IBM Corp. 2020, 2021. 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.
# *****************************************************************
import os
import pathlib
import logging
import pytest
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
test_dir = pathlib.Path(__file__).parent.absolute()
spec = spec_from_loader("opence", SourceFileLoader("opence", os.path.join(test_dir, '..', 'open_ce', 'open-ce')))
opence = module_from_spec(spec)
spec.loader.exec_module(opence)
import helpers
import open_ce.utils as utils
from open_ce.errors import OpenCEError
import open_ce.build_feedstock as build_feedstock
def test_build_feedstock_default(mocker):
"""
Tests that the default arguments for 'build_feedstock' generate the correct 'conda_build.api.build' input args.
"""
mocker.patch(
'os.getcwd',
return_value="/test/test_recipe"
)
mocker.patch(
'os.path.exists',
return_value=False
)
expect_recipe = os.path.join(os.getcwd(),'recipe')
expect_config = {'variant_config_files' : [],
'output_folder' : utils.DEFAULT_OUTPUT_FOLDER}
mocker.patch(
'conda_build.api.build',
side_effect=(lambda x, **kwargs: helpers.validate_conda_build_args(x, expect_recipe=expect_recipe, expect_config=expect_config, **kwargs))
)
opence._main(["build", build_feedstock.COMMAND])
def test_build_feedstock_failure(mocker):
"""
Tests that a 'conda_build.api.build' failure is handled correctly.
"""
mocker.patch(
'os.getcwd',
return_value="/test/test_recipe"
)
mocker.patch(
'os.path.exists',
return_value=False
)
mocker.patch(
'conda_build.api.build',
side_effect=ValueError("invalid literal for int() with base 10: 'xy'") #using ValueError to simulate a failure.
)
with pytest.raises(OpenCEError) as exc:
opence._main(["build", build_feedstock.COMMAND])
assert "Unable to build recipe: test_recipe" in str(exc.value)
def test_build_feedstock_working_dir(mocker):
"""
Tests that the 'working_dir' argument is correctly handled and the original working directory is restored after execution.
"""
dirTracker = helpers.DirTracker("/test/starting_dir")
mocker.patch(
'os.getcwd',
side_effect=dirTracker.mocked_getcwd
)
mocker.patch(
'os.path.exists',
return_value=False
)
mocker.patch(
'conda_build.api.build',
return_value=[]
)
working_dir = "/test/my_work_dir"
mocker.patch(
'os.chdir',
side_effect=(lambda x: dirTracker.validate_chdir(x, expected_dirs=[working_dir, # First the working directory should be changed to the arg.
"/test/starting_dir"])) # And then changed back to the starting directory.
)
opence._main(["build", build_feedstock.COMMAND, "--working_directory", working_dir])
def test_build_feedstock_config_file(mocker):
"""
Tests that the 'recipe_config_file' argument is correctly handled..
"""
expect_recipe = os.path.join(os.getcwd(),'cuda_recipe_path') #Checks that the value from the input config file is used.
mocker.patch(
'conda_build.api.build',
side_effect=(lambda x, **kwargs: helpers.validate_conda_build_args(x, expect_recipe=expect_recipe, **kwargs))
)
opence._main(["build", build_feedstock.COMMAND, "--recipe-config-file", os.path.join(test_dir, "my_config.yaml"), "--build_type", "cuda"])
def test_build_feedstock_default_config_file(mocker):
"""
Tests that the default config file is loaded when no argument is specified.
"""
mocker.patch(
'os.getcwd',
return_value="/test/test_recipe"
)
mocker.patch(
'os.path.exists',
return_value=True #True for default config file.
)
expect_recipe = os.path.join(os.getcwd(),'variants_from_default_config')#Checks that the value from the default config file is used.
mocker.patch(
'conda_build.api.build',
side_effect=(lambda x, **kwargs: helpers.validate_conda_build_args(x, expect_recipe=expect_recipe, **kwargs))
)
test_recipe_config = {'recipes' : [{'name' : 'my_variant', 'path' : 'variants_from_default_config'}]}
mocker.patch('open_ce.conda_utils.render_yaml', return_value=test_recipe_config)
opence._main(["build", build_feedstock.COMMAND])
def test_build_feedstock_nonexist_config_file(mocker):
"""
Tests that execution fails and the correct error message is shown if the default config file doesn't exist.
"""
mocker.patch(
'os.getcwd',
return_value="/test/test_recipe"
)
mocker.patch(
'os.path.exists',
return_value=False
)
with pytest.raises(OpenCEError) as exc:
opence._main(["build", build_feedstock.COMMAND, "--recipe-config-file", "my_config.yml"])
assert "Unable to open provided config file: my_config.yml" in str(exc.value)
def test_recipe_config_file_for_inapplicable_configuration(mocker, caplog):
"""
Tests the case when build is triggered for a configuration for which no recipes are applicable.
"""
expect_recipe = os.path.join(os.getcwd(),'cuda_recipe_path') #Checks that the value from the input config file is used.
mocker.patch(
'conda_build.api.build',
side_effect=(lambda x, **kwargs: helpers.validate_conda_build_args(x, expect_recipe=expect_recipe, **kwargs))
)
opence._main(["build", build_feedstock.COMMAND, "--recipe-config-file", os.path.join(test_dir, "my_config.yaml"), "--python_versions", "4.1"])
assert ("OPEN-CE", logging.INFO, "No recipe to build for given configuration.") in caplog.record_tuples
def test_build_feedstock_local_src_dir_args(mocker):
"""
Tests that providing the local_src_dir argument sets the LOCAL_SRC_DIR environment variable correctly.
"""
mocker.patch(
'os.path.exists',
return_value=True
)
build_feedstock._set_local_src_dir("my_src_dir", None, None)
assert os.environ["LOCAL_SRC_DIR"] == "my_src_dir"
def test_build_feedstock_local_src_dir_args_fail(mocker):
"""
Tests that providing the local_src_dir argument to a non-existant file fails properly.
"""
mocker.patch(
'os.path.exists',
return_value=False
)
with pytest.raises(OpenCEError) as exc:
build_feedstock._set_local_src_dir("my_src_dir", { 'local_src_dir' : "my_other_src_dir" }, None)
assert "local_src_dir path \"my_src_dir\" specified doesn't exist" in str(exc.value)
def test_build_feedstock_local_src_dir_recipe(mocker):
"""
Tests that providing the local_src_dir in a recipe sets the LOCAL_SRC_DIR environment variable correctly.
"""
mocker.patch(
'os.path.exists',
return_value=True
)
build_feedstock._set_local_src_dir(None, { 'local_src_dir' : "my_other_src_dir" } , "/test/location/recipe.yaml")
assert os.environ["LOCAL_SRC_DIR"] == "/test/location/my_other_src_dir"
def test_build_feedstock_extra_args(mocker):
"""
Tests that additional arguments add the expected values to the 'conda_build.api.build' arguments.
"""
mocker.patch(
'os.getcwd',
return_value="/test/test_recipe"
)
mocker.patch(
'os.path.exists',
return_value=True
)
expect_config = { 'channel_urls' : ['/test/test_recipe/condabuild', 'test_channel', 'test_channel_2', 'test_channel_from_config']}
expect_variants = {'python': '3.6', 'build_type': 'cpu', 'mpi_type': 'openmpi'}
reject_recipe = os.path.join(os.getcwd(),'test_recipe_extra')
mocker.patch(
'conda_build.api.build',
side_effect=(lambda x, **kwargs: helpers.validate_conda_build_args(x, expect_config=expect_config, expect_variants=expect_variants, reject_recipe=reject_recipe, **kwargs))
)
test_recipe_config = { 'recipes' : [{ 'name' : 'my_project', 'path' : 'recipe'},
{ 'name' : 'my_variant', 'path': 'variants'},
{ 'name' : 'test_recipe_extra', 'path' : 'extra'}],
'channels' : ['test_channel_from_config']}
mocker.patch('open_ce.conda_utils.render_yaml', return_value=test_recipe_config)
arg_input = ["build", build_feedstock.COMMAND,
"--channels", "test_channel",
"--channels", "test_channel_2",
"--recipes", "my_project,my_variant",
"--python_versions", "3.6",
"--build_types", "cpu",
"--mpi_types", "openmpi",
"--cuda_versions", "10.2"]
opence._main(arg_input)
def test_build_feedstock_if_no_conda_build(mocker):
'''
Test that build_feedstock should fail if conda_build isn't present
'''
mocker.patch('pkg_resources.get_distribution', return_value=None)
with pytest.raises(OpenCEError):
assert opence._main(["build", build_feedstock.COMMAND]) == 1
def test_build_feedstock_conda_pkg_format(mocker):
'''
Test that the --conda_pkg_format argument is correctly handled.
'''
mocker.patch(
'conda_build.api.build',
)
pkg_format = "conda"
opence._main(["build", build_feedstock.COMMAND, "--conda_pkg_format", pkg_format])
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
334,
7775,
7775,
7775,
7775,
13,
29937,
313,
29907,
29897,
14187,
1266,
27955,
2994,
29886,
29889,
29871,
29906,
29900,
29906,
29900,
29892,
29871,
29906,
29900,
29906,
29896,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
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,
29937,
334,
7775,
7775,
7775,
7775,
13,
13,
5215,
2897,
13,
5215,
2224,
1982,
13,
5215,
12183,
13,
5215,
11451,
1688,
13,
3166,
1053,
1982,
29889,
4422,
1053,
1580,
29918,
3166,
29918,
12657,
29892,
3883,
29918,
3166,
29918,
6550,
13,
3166,
1053,
1982,
29889,
29885,
496,
262,
708,
1053,
7562,
2283,
10036,
13,
13,
1688,
29918,
3972,
353,
2224,
1982,
29889,
2605,
22168,
1445,
1649,
467,
3560,
29889,
23552,
580,
13,
13,
6550,
353,
1580,
29918,
3166,
29918,
12657,
703,
459,
663,
613,
7562,
2283,
10036,
703,
459,
663,
613,
2897,
29889,
2084,
29889,
7122,
29898,
1688,
29918,
3972,
29892,
525,
636,
742,
525,
3150,
29918,
346,
742,
525,
3150,
29899,
346,
29915,
4961,
13,
459,
663,
353,
3883,
29918,
3166,
29918,
6550,
29898,
6550,
29897,
13,
6550,
29889,
12657,
29889,
4258,
29918,
5453,
29898,
459,
663,
29897,
13,
13,
5215,
1371,
414,
13,
5215,
1722,
29918,
346,
29889,
13239,
408,
3667,
29879,
13,
3166,
1722,
29918,
346,
29889,
12523,
1053,
4673,
4741,
2392,
13,
5215,
1722,
29918,
346,
29889,
4282,
29918,
18798,
17712,
408,
2048,
29918,
18798,
17712,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
4381,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
278,
2322,
6273,
363,
525,
4282,
29918,
18798,
17712,
29915,
5706,
278,
1959,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
29915,
1881,
6389,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
736,
29918,
1767,
13802,
1688,
29914,
1688,
29918,
4361,
412,
29908,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
8824,
13,
1678,
1723,
13,
1678,
2149,
29918,
4361,
412,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
4361,
412,
1495,
13,
1678,
2149,
29918,
2917,
353,
11117,
19365,
29918,
2917,
29918,
5325,
29915,
584,
19997,
13,
18884,
525,
4905,
29918,
12083,
29915,
584,
3667,
29879,
29889,
23397,
29918,
12015,
12336,
29918,
29943,
5607,
8032,
29913,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29892,
3579,
19290,
29901,
1371,
414,
29889,
15480,
29918,
18050,
29918,
4282,
29918,
5085,
29898,
29916,
29892,
2149,
29918,
4361,
412,
29922,
17854,
29918,
4361,
412,
29892,
2149,
29918,
2917,
29922,
17854,
29918,
2917,
29892,
3579,
19290,
876,
13,
1678,
1723,
13,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
2314,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
14057,
545,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
263,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
29915,
10672,
338,
16459,
5149,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
736,
29918,
1767,
13802,
1688,
29914,
1688,
29918,
4361,
412,
29908,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
8824,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
29922,
1917,
2392,
703,
20965,
16333,
363,
938,
580,
411,
2967,
29871,
29896,
29900,
29901,
525,
3594,
29915,
1159,
396,
4746,
7865,
2392,
304,
29611,
263,
10672,
29889,
13,
1678,
1723,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
6585,
4741,
2392,
29897,
408,
5566,
29901,
13,
4706,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
2314,
13,
1678,
4974,
376,
2525,
519,
304,
2048,
9522,
412,
29901,
1243,
29918,
4361,
412,
29908,
297,
851,
29898,
735,
29883,
29889,
1767,
29897,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
22899,
29918,
3972,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
278,
525,
22899,
29918,
3972,
29915,
2980,
338,
5149,
16459,
322,
278,
2441,
1985,
3884,
338,
23119,
1156,
8225,
29889,
13,
1678,
9995,
13,
1678,
4516,
5323,
4937,
353,
1371,
414,
29889,
9170,
5323,
4937,
11974,
1688,
29914,
2962,
292,
29918,
3972,
1159,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
2625,
29918,
15987,
29922,
3972,
5323,
4937,
29889,
17640,
287,
29918,
657,
29883,
9970,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
8824,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
736,
29918,
1767,
29922,
2636,
13,
1678,
1723,
13,
1678,
1985,
29918,
3972,
353,
5591,
1688,
29914,
1357,
29918,
1287,
29918,
3972,
29908,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
305,
3972,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29901,
4516,
5323,
4937,
29889,
15480,
29918,
305,
3972,
29898,
29916,
29892,
3806,
29918,
3972,
29879,
11759,
22899,
29918,
3972,
29892,
396,
3824,
278,
1985,
3884,
881,
367,
3939,
304,
278,
1852,
29889,
13,
462,
462,
462,
462,
965,
5591,
1688,
29914,
2962,
292,
29918,
3972,
3108,
876,
396,
1126,
769,
3939,
1250,
304,
278,
6257,
3884,
29889,
13,
1678,
1723,
13,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
376,
489,
22899,
29918,
12322,
613,
1985,
29918,
3972,
2314,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
2917,
29918,
1445,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
278,
525,
4361,
412,
29918,
2917,
29918,
1445,
29915,
2980,
338,
5149,
16459,
636,
13,
1678,
9995,
13,
1678,
2149,
29918,
4361,
412,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
29883,
6191,
29918,
4361,
412,
29918,
2084,
1495,
396,
5596,
29879,
393,
278,
995,
515,
278,
1881,
2295,
934,
338,
1304,
29889,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29892,
3579,
19290,
29901,
1371,
414,
29889,
15480,
29918,
18050,
29918,
4282,
29918,
5085,
29898,
29916,
29892,
2149,
29918,
4361,
412,
29922,
17854,
29918,
4361,
412,
29892,
3579,
19290,
876,
13,
1678,
1723,
13,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
376,
489,
4361,
412,
29899,
2917,
29899,
1445,
613,
2897,
29889,
2084,
29889,
7122,
29898,
1688,
29918,
3972,
29892,
376,
1357,
29918,
2917,
29889,
25162,
4968,
376,
489,
4282,
29918,
1853,
613,
376,
29883,
6191,
20068,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
4381,
29918,
2917,
29918,
1445,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
278,
2322,
2295,
934,
338,
7500,
746,
694,
2980,
338,
6790,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
736,
29918,
1767,
13802,
1688,
29914,
1688,
29918,
4361,
412,
29908,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
5574,
396,
5574,
363,
2322,
2295,
934,
29889,
13,
1678,
1723,
13,
1678,
2149,
29918,
4361,
412,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
5927,
1934,
29918,
3166,
29918,
4381,
29918,
2917,
1495,
29937,
5596,
29879,
393,
278,
995,
515,
278,
2322,
2295,
934,
338,
1304,
29889,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29892,
3579,
19290,
29901,
1371,
414,
29889,
15480,
29918,
18050,
29918,
4282,
29918,
5085,
29898,
29916,
29892,
2149,
29918,
4361,
412,
29922,
17854,
29918,
4361,
412,
29892,
3579,
19290,
876,
13,
1678,
1723,
13,
13,
1678,
1243,
29918,
4361,
412,
29918,
2917,
353,
11117,
4361,
5547,
29915,
584,
518,
10998,
978,
29915,
584,
525,
1357,
29918,
19365,
742,
525,
2084,
29915,
584,
525,
5927,
1934,
29918,
3166,
29918,
4381,
29918,
2917,
29915,
6525,
29913,
13,
13,
1678,
286,
8658,
29889,
5041,
877,
3150,
29918,
346,
29889,
18050,
29918,
13239,
29889,
9482,
29918,
25162,
742,
736,
29918,
1767,
29922,
1688,
29918,
4361,
412,
29918,
2917,
29897,
13,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
2314,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
9290,
29916,
391,
29918,
2917,
29918,
1445,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
8225,
8465,
322,
278,
1959,
1059,
2643,
338,
4318,
565,
278,
2322,
2295,
934,
1838,
29915,
29873,
1863,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
736,
29918,
1767,
13802,
1688,
29914,
1688,
29918,
4361,
412,
29908,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
8824,
13,
1678,
1723,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
6585,
4741,
2392,
29897,
408,
5566,
29901,
13,
4706,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
376,
489,
4361,
412,
29899,
2917,
29899,
1445,
613,
376,
1357,
29918,
2917,
29889,
21053,
20068,
13,
1678,
4974,
376,
2525,
519,
304,
1722,
4944,
2295,
934,
29901,
590,
29918,
2917,
29889,
21053,
29908,
297,
851,
29898,
735,
29883,
29889,
1767,
29897,
13,
13,
1753,
1243,
29918,
4361,
412,
29918,
2917,
29918,
1445,
29918,
1454,
29918,
262,
932,
506,
519,
29918,
13305,
29898,
29885,
8658,
29892,
2117,
1188,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
278,
1206,
746,
2048,
338,
19799,
363,
263,
5285,
363,
607,
694,
9522,
5547,
526,
22903,
29889,
13,
1678,
9995,
13,
13,
1678,
2149,
29918,
4361,
412,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
29883,
6191,
29918,
4361,
412,
29918,
2084,
1495,
396,
5596,
29879,
393,
278,
995,
515,
278,
1881,
2295,
934,
338,
1304,
29889,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29892,
3579,
19290,
29901,
1371,
414,
29889,
15480,
29918,
18050,
29918,
4282,
29918,
5085,
29898,
29916,
29892,
2149,
29918,
4361,
412,
29922,
17854,
29918,
4361,
412,
29892,
3579,
19290,
876,
13,
1678,
1723,
13,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
376,
489,
4361,
412,
29899,
2917,
29899,
1445,
613,
2897,
29889,
2084,
29889,
7122,
29898,
1688,
29918,
3972,
29892,
376,
1357,
29918,
2917,
29889,
25162,
4968,
376,
489,
4691,
29918,
26100,
613,
376,
29946,
29889,
29896,
20068,
13,
1678,
4974,
4852,
4590,
1430,
29899,
4741,
613,
12183,
29889,
11690,
29892,
376,
3782,
9522,
412,
304,
2048,
363,
2183,
5285,
23157,
297,
2117,
1188,
29889,
11651,
29918,
9161,
2701,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
2997,
29918,
4351,
29918,
3972,
29918,
5085,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
13138,
278,
1887,
29918,
4351,
29918,
3972,
2980,
6166,
278,
11247,
29907,
1964,
29918,
29903,
10363,
29918,
9464,
5177,
2286,
5149,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
2048,
29918,
18798,
17712,
3032,
842,
29918,
2997,
29918,
4351,
29918,
3972,
703,
1357,
29918,
4351,
29918,
3972,
613,
6213,
29892,
6213,
29897,
13,
1678,
4974,
2897,
29889,
21813,
3366,
16652,
1964,
29918,
29903,
10363,
29918,
9464,
3108,
1275,
376,
1357,
29918,
4351,
29918,
3972,
29908,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
2997,
29918,
4351,
29918,
3972,
29918,
5085,
29918,
14057,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
13138,
278,
1887,
29918,
4351,
29918,
3972,
2980,
304,
263,
1661,
29899,
735,
22137,
934,
8465,
6284,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
8824,
13,
1678,
1723,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
6585,
4741,
2392,
29897,
408,
5566,
29901,
13,
4706,
2048,
29918,
18798,
17712,
3032,
842,
29918,
2997,
29918,
4351,
29918,
3972,
703,
1357,
29918,
4351,
29918,
3972,
613,
426,
525,
2997,
29918,
4351,
29918,
3972,
29915,
584,
376,
1357,
29918,
1228,
29918,
4351,
29918,
3972,
29908,
2981,
6213,
29897,
13,
1678,
4974,
376,
2997,
29918,
4351,
29918,
3972,
2224,
13218,
1357,
29918,
4351,
29918,
3972,
5931,
6790,
1838,
29915,
29873,
1863,
29908,
297,
851,
29898,
735,
29883,
29889,
1767,
29897,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
2997,
29918,
4351,
29918,
3972,
29918,
4361,
412,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
13138,
278,
1887,
29918,
4351,
29918,
3972,
297,
263,
9522,
412,
6166,
278,
11247,
29907,
1964,
29918,
29903,
10363,
29918,
9464,
5177,
2286,
5149,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
2048,
29918,
18798,
17712,
3032,
842,
29918,
2997,
29918,
4351,
29918,
3972,
29898,
8516,
29892,
426,
525,
2997,
29918,
4351,
29918,
3972,
29915,
584,
376,
1357,
29918,
1228,
29918,
4351,
29918,
3972,
29908,
500,
1919,
5591,
1688,
29914,
5479,
29914,
4361,
412,
29889,
25162,
1159,
13,
1678,
4974,
2897,
29889,
21813,
3366,
16652,
1964,
29918,
29903,
10363,
29918,
9464,
3108,
1275,
5591,
1688,
29914,
5479,
29914,
1357,
29918,
1228,
29918,
4351,
29918,
3972,
29908,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
17833,
29918,
5085,
29898,
29885,
8658,
1125,
13,
1678,
9995,
13,
1678,
4321,
29879,
393,
5684,
6273,
788,
278,
3806,
1819,
304,
278,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
29915,
6273,
29889,
13,
1678,
9995,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
657,
29883,
9970,
742,
13,
4706,
736,
29918,
1767,
13802,
1688,
29914,
1688,
29918,
4361,
412,
29908,
13,
1678,
1723,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
359,
29889,
2084,
29889,
9933,
742,
13,
4706,
736,
29918,
1767,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
2149,
29918,
2917,
353,
426,
525,
12719,
29918,
26045,
29915,
584,
6024,
29914,
1688,
29914,
1688,
29918,
4361,
412,
29914,
1116,
370,
29884,
789,
742,
525,
1688,
29918,
12719,
742,
525,
1688,
29918,
12719,
29918,
29906,
742,
525,
1688,
29918,
12719,
29918,
3166,
29918,
2917,
2033,
29913,
13,
1678,
2149,
29918,
5927,
1934,
353,
11117,
4691,
2396,
525,
29941,
29889,
29953,
742,
525,
4282,
29918,
1853,
2396,
525,
21970,
742,
525,
1526,
29875,
29918,
1853,
2396,
525,
3150,
1526,
29875,
10827,
13,
1678,
12560,
29918,
4361,
412,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
1688,
29918,
4361,
412,
29918,
17833,
1495,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
4706,
2625,
29918,
15987,
7607,
2892,
921,
29892,
3579,
19290,
29901,
1371,
414,
29889,
15480,
29918,
18050,
29918,
4282,
29918,
5085,
29898,
29916,
29892,
2149,
29918,
2917,
29922,
17854,
29918,
2917,
29892,
2149,
29918,
5927,
1934,
29922,
17854,
29918,
5927,
1934,
29892,
12560,
29918,
4361,
412,
29922,
276,
622,
29918,
4361,
412,
29892,
3579,
19290,
876,
13,
1678,
1723,
13,
13,
1678,
1243,
29918,
4361,
412,
29918,
2917,
353,
426,
525,
4361,
5547,
29915,
584,
15974,
525,
978,
29915,
584,
525,
1357,
29918,
4836,
742,
525,
2084,
29915,
584,
525,
4361,
412,
16675,
13,
462,
462,
4706,
426,
525,
978,
29915,
584,
525,
1357,
29918,
19365,
742,
525,
2084,
2396,
525,
5927,
1934,
16675,
13,
462,
462,
4706,
426,
525,
978,
29915,
584,
525,
1688,
29918,
4361,
412,
29918,
17833,
742,
525,
2084,
29915,
584,
525,
17833,
10827,
1402,
13,
462,
965,
525,
305,
12629,
29915,
584,
6024,
1688,
29918,
12719,
29918,
3166,
29918,
2917,
2033,
29913,
13,
13,
1678,
286,
8658,
29889,
5041,
877,
3150,
29918,
346,
29889,
18050,
29918,
13239,
29889,
9482,
29918,
25162,
742,
736,
29918,
1767,
29922,
1688,
29918,
4361,
412,
29918,
2917,
29897,
13,
13,
1678,
1852,
29918,
2080,
353,
6796,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
13,
462,
376,
489,
305,
12629,
613,
376,
1688,
29918,
12719,
613,
13,
462,
376,
489,
305,
12629,
613,
376,
1688,
29918,
12719,
29918,
29906,
613,
13,
462,
376,
489,
4361,
5547,
613,
376,
1357,
29918,
4836,
29892,
1357,
29918,
19365,
613,
13,
462,
376,
489,
4691,
29918,
26100,
613,
376,
29941,
29889,
29953,
613,
13,
462,
376,
489,
4282,
29918,
8768,
613,
376,
21970,
613,
13,
462,
376,
489,
1526,
29875,
29918,
8768,
613,
376,
3150,
1526,
29875,
613,
13,
462,
376,
489,
29883,
6191,
29918,
26100,
613,
376,
29896,
29900,
29889,
29906,
3108,
13,
1678,
1015,
663,
3032,
3396,
29898,
1191,
29918,
2080,
29897,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
361,
29918,
1217,
29918,
18050,
29918,
4282,
29898,
29885,
8658,
1125,
13,
1678,
14550,
13,
1678,
4321,
393,
2048,
29918,
18798,
17712,
881,
4418,
565,
378,
1388,
29918,
4282,
3508,
29915,
29873,
2198,
13,
1678,
14550,
13,
1678,
286,
8658,
29889,
5041,
877,
15865,
29918,
13237,
29889,
657,
29918,
27691,
742,
736,
29918,
1767,
29922,
8516,
29897,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
6585,
4741,
2392,
1125,
13,
4706,
4974,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
2314,
1275,
29871,
29896,
13,
13,
1753,
1243,
29918,
4282,
29918,
18798,
17712,
29918,
18050,
29918,
15865,
29918,
4830,
29898,
29885,
8658,
1125,
13,
1678,
14550,
13,
1678,
4321,
393,
278,
1192,
18050,
29918,
15865,
29918,
4830,
2980,
338,
5149,
16459,
29889,
13,
1678,
14550,
13,
13,
1678,
286,
8658,
29889,
5041,
29898,
13,
4706,
525,
18050,
29918,
4282,
29889,
2754,
29889,
4282,
742,
13,
1678,
1723,
12,
13,
13,
1678,
282,
9415,
29918,
4830,
353,
376,
18050,
29908,
13,
1678,
1015,
663,
3032,
3396,
29898,
3366,
4282,
613,
2048,
29918,
18798,
17712,
29889,
19795,
1529,
2797,
29892,
376,
489,
18050,
29918,
15865,
29918,
4830,
613,
282,
9415,
29918,
4830,
2314,
13,
2
] |
resources/migrations/0021_change_image_file_to_char.py | City-of-Helsinki/berth-reservations | 3 | 65894 | <reponame>City-of-Helsinki/berth-reservations
# Generated by Django 3.1 on 2020-10-05 12:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("resources", "0020_change_berth_number_to_char"),
]
operations = [
migrations.AlterField(
model_name="harbor",
name="image_file",
field=models.CharField(
blank=True, max_length=400, null=True, verbose_name="Image file"
),
),
migrations.AlterField(
model_name="winterstoragearea",
name="image_file",
field=models.CharField(
blank=True, max_length=400, null=True, verbose_name="Image file"
),
),
]
| [
1,
529,
276,
1112,
420,
29958,
16885,
29899,
974,
29899,
29950,
1379,
682,
29875,
29914,
495,
386,
29899,
690,
6972,
800,
13,
29937,
3251,
630,
491,
15337,
29871,
29941,
29889,
29896,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29896,
29900,
29899,
29900,
29945,
29871,
29896,
29906,
29901,
29946,
29955,
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,
4852,
13237,
613,
376,
29900,
29900,
29906,
29900,
29918,
3167,
29918,
495,
386,
29918,
4537,
29918,
517,
29918,
3090,
4968,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
543,
8222,
4089,
613,
13,
9651,
1024,
543,
3027,
29918,
1445,
613,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
13,
18884,
9654,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29946,
29900,
29900,
29892,
1870,
29922,
5574,
29892,
26952,
29918,
978,
543,
2940,
934,
29908,
13,
9651,
10353,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
543,
29893,
1639,
12925,
6203,
613,
13,
9651,
1024,
543,
3027,
29918,
1445,
613,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
13,
18884,
9654,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29946,
29900,
29900,
29892,
1870,
29922,
5574,
29892,
26952,
29918,
978,
543,
2940,
934,
29908,
13,
9651,
10353,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
examples/DogsVsCats.py | YiweiLi4/tensorbay-python-sdk | 0 | 130343 | <filename>examples/DogsVsCats.py
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
# pylint: disable=wrong-import-position
# pylint: disable=wrong-import-order
# pylint: disable=not-callable
# pylint: disable=ungrouped-imports
# pylint: disable=import-error
# pylint: disable=pointless-string-statement
# pylint: disable=invalid-name
# pylint: disable=unused-import
# flake8: noqa: F401
"""This files includes the python code example in dogsvscats.rst."""
"""Authorize a Client Instance"""
from tensorbay import GAS
ACCESS_KEY = "Accesskey-*****"
gas = GAS(ACCESS_KEY)
""""""
"""Create Dataset"""
gas.create_dataset("DogsVsCats")
""""""
"""Organize Dataset / regular import"""
from tensorbay.dataset import Data, Dataset
from tensorbay.label import Classification
""""""
"""Organize dataset / import dataloader"""
from tensorbay.opendataset import DogsVsCats
dataset = DogsVsCats("path/to/dataset/directory")
""""""
"""Upload Dataset"""
dataset_client = gas.upload_dataset(dataset)
dataset_client.commit("initial commit")
""""""
"""Read Dataset / get dataset"""
dataset_client = gas.get_dataset("DogsVsCats")
""""""
"""Read Dataset / list segment names"""
dataset_client.list_segment_names()
""""""
"""Read Dataset Class / get a segment"""
train_segment = dataset.get_segment_by_name("train")
first_segment = dataset[0]
""""""
"""Read Dataset / get segment"""
from tensorbay.dataset import Segment
train_segment = Segment("train", dataset_client)
""""""
"""Read Dataset / get data"""
data = train_segment[0]
""""""
"""Read Dataset / get label"""
category = data.label.classification.category
""""""
"""Delete Dataset"""
gas.delete_dataset("DogsVsCats")
""""""
| [
1,
529,
9507,
29958,
19057,
29914,
29928,
12099,
29963,
29879,
29907,
1446,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
4989,
29894,
4812,
29889,
10413,
21144,
1090,
341,
1806,
19245,
29889,
13,
29937,
13,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
15866,
549,
29899,
5215,
29899,
3283,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
15866,
549,
29899,
5215,
29899,
2098,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
1333,
29899,
4804,
519,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
348,
2972,
287,
29899,
326,
4011,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
5215,
29899,
2704,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
3149,
2222,
29899,
1807,
29899,
20788,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
348,
3880,
29899,
5215,
13,
29937,
17422,
446,
29947,
29901,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
13,
15945,
29908,
4013,
2066,
7805,
278,
3017,
775,
1342,
297,
26361,
29894,
1557,
1446,
29889,
29878,
303,
1213,
15945,
13,
13,
15945,
29908,
13720,
675,
263,
12477,
2799,
749,
15945,
29908,
13,
3166,
12489,
27495,
1053,
402,
3289,
13,
13,
2477,
23524,
29918,
10818,
353,
376,
6638,
1989,
29899,
2328,
20605,
13,
25496,
353,
402,
3289,
29898,
2477,
23524,
29918,
10818,
29897,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
4391,
13373,
24541,
15945,
29908,
13,
25496,
29889,
3258,
29918,
24713,
703,
29928,
12099,
29963,
29879,
29907,
1446,
1159,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
27356,
675,
13373,
24541,
847,
4943,
1053,
15945,
29908,
13,
3166,
12489,
27495,
29889,
24713,
1053,
3630,
29892,
13373,
24541,
13,
3166,
12489,
27495,
29889,
1643,
1053,
23236,
13,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
27356,
675,
8783,
847,
1053,
1418,
7003,
1664,
15945,
29908,
13,
3166,
12489,
27495,
29889,
459,
355,
271,
24541,
1053,
360,
12099,
29963,
29879,
29907,
1446,
13,
13,
24713,
353,
360,
12099,
29963,
29879,
29907,
1446,
703,
2084,
29914,
517,
29914,
24713,
29914,
12322,
1159,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
17553,
13373,
24541,
15945,
29908,
13,
24713,
29918,
4645,
353,
10489,
29889,
9009,
29918,
24713,
29898,
24713,
29897,
13,
24713,
29918,
4645,
29889,
15060,
703,
11228,
9063,
1159,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
847,
679,
8783,
15945,
29908,
13,
24713,
29918,
4645,
353,
10489,
29889,
657,
29918,
24713,
703,
29928,
12099,
29963,
29879,
29907,
1446,
1159,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
847,
1051,
10768,
2983,
15945,
29908,
13,
24713,
29918,
4645,
29889,
1761,
29918,
28192,
29918,
7039,
580,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
4134,
847,
679,
263,
10768,
15945,
29908,
13,
14968,
29918,
28192,
353,
8783,
29889,
657,
29918,
28192,
29918,
1609,
29918,
978,
703,
14968,
1159,
13,
4102,
29918,
28192,
353,
8783,
29961,
29900,
29962,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
847,
679,
10768,
15945,
29908,
13,
3166,
12489,
27495,
29889,
24713,
1053,
6667,
358,
13,
13,
14968,
29918,
28192,
353,
6667,
358,
703,
14968,
613,
8783,
29918,
4645,
29897,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
847,
679,
848,
15945,
29908,
13,
1272,
353,
7945,
29918,
28192,
29961,
29900,
29962,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
6359,
13373,
24541,
847,
679,
3858,
15945,
29908,
13,
7320,
353,
848,
29889,
1643,
29889,
1990,
2450,
29889,
7320,
13,
15945,
15945,
15945,
13,
13,
15945,
29908,
12498,
13373,
24541,
15945,
29908,
13,
25496,
29889,
8143,
29918,
24713,
703,
29928,
12099,
29963,
29879,
29907,
1446,
1159,
13,
15945,
15945,
15945,
13,
2
] |
django_storage_url/base.py | hoopoe/django-storage-url | 2 | 117242 | <reponame>hoopoe/django-storage-url
from django.conf import settings
from django.utils.functional import LazyObject
import furl
from .backends import get_storage_class
from .backends.not_implemented import NotImplementedStorage
class _DSNConfiguredStorage(LazyObject):
def _setup(self):
dsn = getattr(settings, self._setting_name, None)
if not dsn:
args = []
storage_class = NotImplementedStorage
else:
url = furl.furl(dsn)
storage_class = get_storage_class(url.scheme)
args = [url]
# Django >= 1.9 now knows about LazyObject and sets them up before
# serializing them. To work around this behavior, the storage class
# itself needs to be deconstructible.
storage_class = type(
storage_class.__name__,
(storage_class,),
{"deconstruct": self._deconstructor},
)
self._wrapped = storage_class(*args)
def dsn_configured_storage_class(setting_name):
path = "{}.{}".format(
dsn_configured_storage.__module__, dsn_configured_storage.__name__
)
return type(
"DSNConfiguredStorage",
(_DSNConfiguredStorage,),
{
"_setting_name": setting_name,
"_deconstructor": lambda self: (path, [setting_name], {}),
},
)
def dsn_configured_storage(setting_name):
return dsn_configured_storage_class(setting_name)()
def get_storage(dsn):
url = furl.furl(dsn)
storage_class = get_storage_class(url.scheme)
return storage_class(url)
| [
1,
529,
276,
1112,
420,
29958,
1251,
459,
7297,
29914,
14095,
29899,
12925,
29899,
2271,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
13239,
29889,
2220,
284,
1053,
19575,
29891,
2061,
13,
13,
5215,
285,
2271,
13,
13,
3166,
869,
1627,
1975,
1053,
679,
29918,
12925,
29918,
1990,
13,
3166,
869,
1627,
1975,
29889,
1333,
29918,
326,
2037,
287,
1053,
2216,
1888,
2037,
287,
10486,
13,
13,
13,
1990,
903,
8452,
29940,
3991,
2955,
10486,
29898,
29931,
24683,
2061,
1125,
13,
1678,
822,
903,
14669,
29898,
1311,
1125,
13,
4706,
270,
16586,
353,
679,
5552,
29898,
11027,
29892,
1583,
3032,
26740,
29918,
978,
29892,
6213,
29897,
13,
4706,
565,
451,
270,
16586,
29901,
13,
9651,
6389,
353,
5159,
13,
9651,
8635,
29918,
1990,
353,
2216,
1888,
2037,
287,
10486,
13,
4706,
1683,
29901,
13,
9651,
3142,
353,
285,
2271,
29889,
29888,
2271,
29898,
6289,
29876,
29897,
13,
9651,
8635,
29918,
1990,
353,
679,
29918,
12925,
29918,
1990,
29898,
2271,
29889,
816,
2004,
29897,
13,
9651,
6389,
353,
518,
2271,
29962,
13,
13,
4706,
396,
15337,
6736,
29871,
29896,
29889,
29929,
1286,
9906,
1048,
19575,
29891,
2061,
322,
6166,
963,
701,
1434,
13,
4706,
396,
7797,
5281,
963,
29889,
1763,
664,
2820,
445,
6030,
29892,
278,
8635,
770,
13,
4706,
396,
3528,
4225,
304,
367,
316,
11433,
1821,
29889,
13,
4706,
8635,
29918,
1990,
353,
1134,
29898,
13,
9651,
8635,
29918,
1990,
17255,
978,
1649,
29892,
13,
9651,
313,
12925,
29918,
1990,
29892,
511,
13,
9651,
8853,
311,
11433,
1115,
1583,
3032,
311,
27821,
1118,
13,
4706,
1723,
13,
4706,
1583,
3032,
29893,
336,
2986,
353,
8635,
29918,
1990,
10456,
5085,
29897,
13,
13,
13,
1753,
270,
16586,
29918,
2917,
2955,
29918,
12925,
29918,
1990,
29898,
26740,
29918,
978,
1125,
13,
1678,
2224,
353,
29850,
1836,
8875,
1642,
4830,
29898,
13,
4706,
270,
16586,
29918,
2917,
2955,
29918,
12925,
17255,
5453,
1649,
29892,
270,
16586,
29918,
2917,
2955,
29918,
12925,
17255,
978,
1649,
13,
1678,
1723,
13,
1678,
736,
1134,
29898,
13,
4706,
376,
8452,
29940,
3991,
2955,
10486,
613,
13,
4706,
9423,
8452,
29940,
3991,
2955,
10486,
29892,
511,
13,
4706,
426,
13,
9651,
11119,
26740,
29918,
978,
1115,
4444,
29918,
978,
29892,
13,
9651,
11119,
311,
27821,
1115,
14013,
1583,
29901,
313,
2084,
29892,
518,
26740,
29918,
978,
1402,
6571,
511,
13,
4706,
2981,
13,
1678,
1723,
13,
13,
13,
1753,
270,
16586,
29918,
2917,
2955,
29918,
12925,
29898,
26740,
29918,
978,
1125,
13,
1678,
736,
270,
16586,
29918,
2917,
2955,
29918,
12925,
29918,
1990,
29898,
26740,
29918,
978,
29897,
580,
13,
13,
13,
1753,
679,
29918,
12925,
29898,
6289,
29876,
1125,
13,
1678,
3142,
353,
285,
2271,
29889,
29888,
2271,
29898,
6289,
29876,
29897,
13,
1678,
8635,
29918,
1990,
353,
679,
29918,
12925,
29918,
1990,
29898,
2271,
29889,
816,
2004,
29897,
13,
1678,
736,
8635,
29918,
1990,
29898,
2271,
29897,
13,
2
] |
grpclib/server.py | panaetov/grpclib | 0 | 12979 | import abc
import socket
import logging
import asyncio
import warnings
import h2.config
import h2.exceptions
from .utils import DeadlineWrapper
from .const import Status
from .stream import send_message, recv_message
from .stream import StreamIterator
from .metadata import Metadata, Deadline
from .protocol import H2Protocol, AbstractHandler
from .exceptions import GRPCError, ProtocolError
from .encoding.base import GRPC_CONTENT_TYPE
from .encoding.proto import ProtoCodec
log = logging.getLogger(__name__)
class Stream(StreamIterator):
"""
Represents gRPC method call – HTTP/2 request/stream, and everything you
need to communicate with client in order to handle this request.
As you can see, every method handler accepts single positional argument -
stream:
.. code-block:: python
async def MakeLatte(self, stream: grpclib.server.Stream):
task: cafe_pb2.LatteOrder = await stream.recv_message()
...
await stream.send_message(empty_pb2.Empty())
This is true for every gRPC method type.
"""
# stream state
_send_initial_metadata_done = False
_send_message_count = 0
_send_trailing_metadata_done = False
_cancel_done = False
def __init__(self, stream, cardinality, codec, recv_type, send_type,
*, metadata, deadline=None):
self._stream = stream
self._cardinality = cardinality
self._codec = codec
self._recv_type = recv_type
self._send_type = send_type
self.metadata = metadata
self.deadline = deadline
async def recv_message(self):
"""Coroutine to receive incoming message from the client.
If client sends UNARY request, then you can call this coroutine
only once. If client sends STREAM request, then you should call this
coroutine several times, until it returns None. To simplify your code
in this case, :py:class:`Stream` class implements async iteration
protocol, so you can use it like this:
.. code-block:: python
async for massage in stream:
do_smth_with(message)
or even like this:
.. code-block:: python
messages = [msg async for msg in stream]
HTTP/2 has flow control mechanism, so server will acknowledge received
DATA frames as a message only after user consumes this coroutine.
:returns: message
"""
return await recv_message(self._stream, self._codec, self._recv_type)
async def send_initial_metadata(self):
"""Coroutine to send headers with initial metadata to the client.
In gRPC you can send initial metadata as soon as possible, because
gRPC doesn't use `:status` pseudo header to indicate success or failure
of the current request. gRPC uses trailers for this purpose, and
trailers are sent during :py:meth:`send_trailing_metadata` call, which
should be called in the end.
.. note:: This coroutine will be called implicitly during first
:py:meth:`send_message` coroutine call, if not called before
explicitly.
"""
if self._send_initial_metadata_done:
raise ProtocolError('Initial metadata was already sent')
await self._stream.send_headers([
(':status', '200'),
('content-type', (GRPC_CONTENT_TYPE + '+'
+ self._codec.__content_subtype__)),
])
self._send_initial_metadata_done = True
async def send_message(self, message, **kwargs):
"""Coroutine to send message to the client.
If server sends UNARY response, then you should call this coroutine only
once. If server sends STREAM response, then you can call this coroutine
as many times as you need.
:param message: message object
"""
if 'end' in kwargs:
warnings.warn('"end" argument is deprecated, use '
'"stream.send_trailing_metadata" explicitly',
stacklevel=2)
end = kwargs.pop('end', False)
assert not kwargs, kwargs
if not self._send_initial_metadata_done:
await self.send_initial_metadata()
if not self._cardinality.server_streaming:
if self._send_message_count:
raise ProtocolError('Server should send exactly one message '
'in response')
await send_message(self._stream, self._codec, message, self._send_type)
self._send_message_count += 1
if end:
await self.send_trailing_metadata()
async def send_trailing_metadata(self, *, status=Status.OK,
status_message=None):
"""Coroutine to send trailers with trailing metadata to the client.
This coroutine allows sending trailers-only responses, in case of some
failure conditions during handling current request, i.e. when
``status is not OK``.
.. note:: This coroutine will be called implicitly at exit from
request handler, with appropriate status code, if not called
explicitly during handler execution.
:param status: resulting status of this coroutine call
:param status_message: description for a status
"""
if self._send_trailing_metadata_done:
raise ProtocolError('Trailing metadata was already sent')
if not self._send_message_count and status is Status.OK:
raise ProtocolError('{!r} requires non-empty response'
.format(status))
if self._send_initial_metadata_done:
headers = []
else:
# trailers-only response
headers = [(':status', '200')]
headers.append(('grpc-status', str(status.value)))
if status_message is not None:
headers.append(('grpc-message', status_message))
await self._stream.send_headers(headers, end_stream=True)
self._send_trailing_metadata_done = True
if status != Status.OK and self._stream.closable:
self._stream.reset_nowait()
async def cancel(self):
"""Coroutine to cancel this request/stream.
Server will send RST_STREAM frame to the client, so it will be
explicitly informed that there is nothing to expect from the server
regarding this request/stream.
"""
if self._cancel_done:
raise ProtocolError('Stream was already cancelled')
await self._stream.reset() # TODO: specify error code
self._cancel_done = True
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
if (
self._send_trailing_metadata_done
or self._cancel_done
or self._stream._transport.is_closing()
):
# to suppress exception propagation
return True
if exc_val is not None:
if isinstance(exc_val, GRPCError):
status = exc_val.status
status_message = exc_val.message
elif isinstance(exc_val, Exception):
status = Status.UNKNOWN
status_message = 'Internal Server Error'
else:
# propagate exception
return
elif not self._send_message_count:
status = Status.UNKNOWN
status_message = 'Empty response'
else:
status = Status.OK
status_message = None
try:
await self.send_trailing_metadata(status=status,
status_message=status_message)
except h2.exceptions.StreamClosedError:
pass
# to suppress exception propagation
return True
async def request_handler(mapping, _stream, headers, codec, release_stream):
try:
headers_map = dict(headers)
if headers_map[':method'] != 'POST':
await _stream.send_headers([
(':status', '405'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
content_type = headers_map.get('content-type')
if content_type is None:
await _stream.send_headers([
(':status', '415'),
('grpc-status', str(Status.UNKNOWN.value)),
('grpc-message', 'Missing content-type header'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
base_content_type, _, sub_type = content_type.partition('+')
sub_type = sub_type or ProtoCodec.__content_subtype__
if (
base_content_type != GRPC_CONTENT_TYPE
or sub_type != codec.__content_subtype__
):
await _stream.send_headers([
(':status', '415'),
('grpc-status', str(Status.UNKNOWN.value)),
('grpc-message', 'Unacceptable content-type header'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
if headers_map.get('te') != 'trailers':
await _stream.send_headers([
(':status', '400'),
('grpc-status', str(Status.UNKNOWN.value)),
('grpc-message', 'Required "te: trailers" header is missing'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
h2_path = headers_map[':path']
method = mapping.get(h2_path)
if method is None:
await _stream.send_headers([
(':status', '200'),
('grpc-status', str(Status.UNIMPLEMENTED.value)),
('grpc-message', 'Method not found'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
metadata = Metadata.from_headers(headers)
try:
deadline = Deadline.from_metadata(metadata)
except ValueError:
await _stream.send_headers([
(':status', '200'),
('grpc-status', str(Status.UNKNOWN.value)),
('grpc-message', 'Invalid grpc-timeout header'),
], end_stream=True)
if _stream.closable:
_stream.reset_nowait()
return
async with Stream(_stream, method.cardinality, codec,
method.request_type, method.reply_type,
metadata=metadata, deadline=deadline) as stream:
deadline_wrapper = None
try:
if deadline:
deadline_wrapper = DeadlineWrapper()
with deadline_wrapper.start(deadline):
with deadline_wrapper:
await method.func(stream)
else:
await method.func(stream)
except asyncio.TimeoutError:
if deadline_wrapper and deadline_wrapper.cancelled:
log.exception('Deadline exceeded')
raise GRPCError(Status.DEADLINE_EXCEEDED)
else:
log.exception('Timeout occurred')
raise
except asyncio.CancelledError:
log.exception('Request was cancelled')
raise
except Exception:
log.exception('Application error')
raise
except Exception:
log.exception('Server error')
finally:
release_stream()
class _GC(abc.ABC):
_gc_counter = 0
@property
@abc.abstractmethod
def __gc_interval__(self):
raise NotImplementedError
@abc.abstractmethod
def __gc_collect__(self):
pass
def __gc_step__(self):
self._gc_counter += 1
if not (self._gc_counter % self.__gc_interval__):
self.__gc_collect__()
class Handler(_GC, AbstractHandler):
__gc_interval__ = 10
closing = False
def __init__(self, mapping, codec, *, loop):
self.mapping = mapping
self.codec = codec
self.loop = loop
self._tasks = {}
self._cancelled = set()
def __gc_collect__(self):
self._tasks = {s: t for s, t in self._tasks.items()
if not t.done()}
self._cancelled = {t for t in self._cancelled
if not t.done()}
def accept(self, stream, headers, release_stream):
self.__gc_step__()
self._tasks[stream] = self.loop.create_task(
request_handler(self.mapping, stream, headers, self.codec,
release_stream)
)
def cancel(self, stream):
task = self._tasks.pop(stream)
task.cancel()
self._cancelled.add(task)
def close(self):
for task in self._tasks.values():
task.cancel()
self._cancelled.update(self._tasks.values())
self.closing = True
async def wait_closed(self):
if self._cancelled:
await asyncio.wait(self._cancelled, loop=self.loop)
def check_closed(self):
self.__gc_collect__()
return not self._tasks and not self._cancelled
class Server(_GC, asyncio.AbstractServer):
"""
HTTP/2 server, which uses gRPC service handlers to handle requests.
Handler is a subclass of the abstract base class, which was generated
from .proto file:
.. code-block:: python
class CoffeeMachine(cafe_grpc.CoffeeMachineBase):
async def MakeLatte(self, stream):
task: cafe_pb2.LatteOrder = await stream.recv_message()
...
await stream.send_message(empty_pb2.Empty())
server = Server([CoffeeMachine()], loop=loop)
"""
__gc_interval__ = 10
def __init__(self, handlers, *, loop, codec=None):
"""
:param handlers: list of handlers
:param loop: asyncio-compatible event loop
"""
mapping = {}
for handler in handlers:
mapping.update(handler.__mapping__())
self._mapping = mapping
self._loop = loop
self._codec = codec or ProtoCodec()
self._config = h2.config.H2Configuration(
client_side=False,
header_encoding='utf-8',
)
self._tcp_server = None
self._handlers = set()
def __gc_collect__(self):
self._handlers = {h for h in self._handlers
if not (h.closing and h.check_closed())}
def _protocol_factory(self):
self.__gc_step__()
handler = Handler(self._mapping, self._codec, loop=self._loop)
self._handlers.add(handler)
return H2Protocol(handler, self._config, loop=self._loop)
async def start(self, host=None, port=None, *,
family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE,
sock=None, backlog=100, ssl=None, reuse_address=None,
reuse_port=None):
"""Coroutine to start the server.
:param host: can be a string, containing IPv4/v6 address or domain name.
If host is None, server will be bound to all available interfaces.
:param port: port number.
:param family: can be set to either :py:data:`python:socket.AF_INET` or
:py:data:`python:socket.AF_INET6` to force the socket to use IPv4 or
IPv6. If not set it will be determined from host.
:param flags: is a bitmask for
:py:meth:`~python:asyncio.AbstractEventLoop.getaddrinfo`.
:param sock: sock can optionally be specified in order to use a
preexisting socket object. If specified, host and port should be
omitted (must be None).
:param backlog: is the maximum number of queued connections passed to
listen().
:param ssl: can be set to an :py:class:`~python:ssl.SSLContext`
to enable SSL over the accepted connections.
:param reuse_address: tells the kernel to reuse a local socket in
TIME_WAIT state, without waiting for its natural timeout to expire.
:param reuse_port: tells the kernel to allow this endpoint to be bound
to the same port as other existing endpoints are bound to,
so long as they all set this flag when being created.
"""
if self._tcp_server is not None:
raise RuntimeError('Server is already started')
self._tcp_server = await self._loop.create_server(
self._protocol_factory, host, port,
family=family, flags=flags, sock=sock, backlog=backlog, ssl=ssl,
reuse_address=reuse_address, reuse_port=reuse_port
)
def close(self):
"""Stops accepting new connections, cancels all currently running
requests. Request handlers are able to handle `CancelledError` and
exit properly.
"""
if self._tcp_server is None:
raise RuntimeError('Server is not started')
self._tcp_server.close()
for handler in self._handlers:
handler.close()
async def wait_closed(self):
"""Coroutine to wait until all existing request handlers will exit
properly.
"""
if self._tcp_server is None:
raise RuntimeError('Server is not started')
await self._tcp_server.wait_closed()
if self._handlers:
await asyncio.wait({h.wait_closed() for h in self._handlers},
loop=self._loop)
| [
1,
1053,
25638,
13,
5215,
9909,
13,
5215,
12183,
13,
5215,
408,
948,
3934,
13,
5215,
18116,
13,
13,
5215,
298,
29906,
29889,
2917,
13,
5215,
298,
29906,
29889,
11739,
29879,
13,
13,
3166,
869,
13239,
1053,
16992,
1220,
15646,
13,
3166,
869,
3075,
1053,
16034,
13,
3166,
869,
5461,
1053,
3638,
29918,
4906,
29892,
1162,
29894,
29918,
4906,
13,
3166,
869,
5461,
1053,
13763,
20277,
13,
3166,
869,
19635,
1053,
4737,
7221,
29892,
16992,
1220,
13,
3166,
869,
20464,
1053,
379,
29906,
17830,
29892,
25513,
4598,
13,
3166,
869,
11739,
29879,
1053,
18016,
9026,
2392,
29892,
1019,
5770,
2392,
13,
3166,
869,
22331,
29889,
3188,
1053,
18016,
9026,
29918,
22412,
3919,
29918,
11116,
13,
3166,
869,
22331,
29889,
17529,
1053,
1019,
517,
3399,
29883,
13,
13,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
13763,
29898,
3835,
20277,
1125,
13,
1678,
9995,
13,
1678,
830,
4569,
1237,
330,
29934,
9026,
1158,
1246,
785,
7331,
29914,
29906,
2009,
29914,
5461,
29892,
322,
4129,
366,
13,
1678,
817,
304,
23120,
411,
3132,
297,
1797,
304,
4386,
445,
2009,
29889,
13,
13,
1678,
1094,
366,
508,
1074,
29892,
1432,
1158,
7834,
21486,
2323,
2602,
284,
2980,
448,
13,
1678,
4840,
29901,
13,
13,
1678,
6317,
775,
29899,
1271,
1057,
3017,
13,
13,
4706,
7465,
822,
8561,
13992,
371,
29898,
1311,
29892,
4840,
29901,
867,
6739,
1982,
29889,
2974,
29889,
3835,
1125,
13,
9651,
3414,
29901,
5777,
1725,
29918,
24381,
29906,
29889,
13992,
371,
7514,
353,
7272,
4840,
29889,
3757,
29894,
29918,
4906,
580,
13,
9651,
2023,
13,
9651,
7272,
4840,
29889,
6717,
29918,
4906,
29898,
6310,
29918,
24381,
29906,
29889,
8915,
3101,
13,
13,
1678,
910,
338,
1565,
363,
1432,
330,
29934,
9026,
1158,
1134,
29889,
13,
1678,
9995,
13,
1678,
396,
4840,
2106,
13,
1678,
903,
6717,
29918,
11228,
29918,
19635,
29918,
15091,
353,
7700,
13,
1678,
903,
6717,
29918,
4906,
29918,
2798,
353,
29871,
29900,
13,
1678,
903,
6717,
29918,
3018,
6504,
29918,
19635,
29918,
15091,
353,
7700,
13,
1678,
903,
20713,
29918,
15091,
353,
7700,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4840,
29892,
21008,
537,
29892,
775,
29883,
29892,
1162,
29894,
29918,
1853,
29892,
3638,
29918,
1853,
29892,
13,
462,
334,
29892,
15562,
29892,
7123,
1220,
29922,
8516,
1125,
13,
4706,
1583,
3032,
5461,
353,
4840,
13,
4706,
1583,
3032,
7543,
979,
537,
353,
21008,
537,
13,
4706,
1583,
3032,
401,
29883,
353,
775,
29883,
13,
4706,
1583,
3032,
3757,
29894,
29918,
1853,
353,
1162,
29894,
29918,
1853,
13,
4706,
1583,
3032,
6717,
29918,
1853,
353,
3638,
29918,
1853,
13,
4706,
1583,
29889,
19635,
353,
15562,
13,
4706,
1583,
29889,
311,
328,
1220,
353,
7123,
1220,
13,
13,
1678,
7465,
822,
1162,
29894,
29918,
4906,
29898,
1311,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
7150,
23235,
2643,
515,
278,
3132,
29889,
13,
13,
4706,
960,
3132,
16003,
8291,
19926,
2009,
29892,
769,
366,
508,
1246,
445,
1034,
449,
457,
13,
4706,
871,
2748,
29889,
960,
3132,
16003,
6850,
1525,
5194,
2009,
29892,
769,
366,
881,
1246,
445,
13,
4706,
1034,
449,
457,
3196,
3064,
29892,
2745,
372,
3639,
6213,
29889,
1763,
21092,
596,
775,
13,
4706,
297,
445,
1206,
29892,
584,
2272,
29901,
1990,
18078,
3835,
29952,
770,
10703,
7465,
12541,
13,
4706,
9608,
29892,
577,
366,
508,
671,
372,
763,
445,
29901,
13,
13,
4706,
6317,
775,
29899,
1271,
1057,
3017,
13,
13,
9651,
7465,
363,
4158,
482,
297,
4840,
29901,
13,
18884,
437,
29918,
3844,
386,
29918,
2541,
29898,
4906,
29897,
13,
13,
4706,
470,
1584,
763,
445,
29901,
13,
13,
4706,
6317,
775,
29899,
1271,
1057,
3017,
13,
13,
9651,
7191,
353,
518,
7645,
7465,
363,
10191,
297,
4840,
29962,
13,
13,
4706,
7331,
29914,
29906,
756,
4972,
2761,
13336,
29892,
577,
1923,
674,
18145,
5485,
4520,
13,
4706,
360,
8254,
16608,
408,
263,
2643,
871,
1156,
1404,
1136,
9351,
445,
1034,
449,
457,
29889,
13,
13,
4706,
584,
18280,
29901,
2643,
13,
4706,
9995,
13,
4706,
736,
7272,
1162,
29894,
29918,
4906,
29898,
1311,
3032,
5461,
29892,
1583,
3032,
401,
29883,
29892,
1583,
3032,
3757,
29894,
29918,
1853,
29897,
13,
13,
1678,
7465,
822,
3638,
29918,
11228,
29918,
19635,
29898,
1311,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
3638,
9066,
411,
2847,
15562,
304,
278,
3132,
29889,
13,
13,
4706,
512,
330,
29934,
9026,
366,
508,
3638,
2847,
15562,
408,
4720,
408,
1950,
29892,
1363,
13,
4706,
330,
29934,
9026,
1838,
29915,
29873,
671,
22507,
4882,
29952,
17381,
4839,
304,
12266,
2551,
470,
10672,
13,
4706,
310,
278,
1857,
2009,
29889,
330,
29934,
9026,
3913,
1020,
22058,
363,
445,
6437,
29892,
322,
13,
4706,
1020,
22058,
526,
2665,
2645,
584,
2272,
29901,
29885,
621,
18078,
6717,
29918,
3018,
6504,
29918,
19635,
29952,
1246,
29892,
607,
13,
4706,
881,
367,
2000,
297,
278,
1095,
29889,
13,
13,
4706,
6317,
4443,
1057,
910,
1034,
449,
457,
674,
367,
2000,
27063,
2645,
937,
13,
9651,
584,
2272,
29901,
29885,
621,
18078,
6717,
29918,
4906,
29952,
1034,
449,
457,
1246,
29892,
565,
451,
2000,
1434,
13,
9651,
9479,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
6717,
29918,
11228,
29918,
19635,
29918,
15091,
29901,
13,
9651,
12020,
1019,
5770,
2392,
877,
15514,
15562,
471,
2307,
2665,
1495,
13,
13,
4706,
7272,
1583,
3032,
5461,
29889,
6717,
29918,
13662,
4197,
13,
9651,
313,
2396,
4882,
742,
525,
29906,
29900,
29900,
5477,
13,
9651,
6702,
3051,
29899,
1853,
742,
313,
14345,
9026,
29918,
22412,
3919,
29918,
11116,
718,
525,
23097,
13,
462,
795,
718,
1583,
3032,
401,
29883,
17255,
3051,
29918,
1491,
1853,
1649,
8243,
13,
308,
2314,
13,
4706,
1583,
3032,
6717,
29918,
11228,
29918,
19635,
29918,
15091,
353,
5852,
13,
13,
1678,
7465,
822,
3638,
29918,
4906,
29898,
1311,
29892,
2643,
29892,
3579,
19290,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
3638,
2643,
304,
278,
3132,
29889,
13,
13,
4706,
960,
1923,
16003,
8291,
19926,
2933,
29892,
769,
366,
881,
1246,
445,
1034,
449,
457,
871,
13,
4706,
2748,
29889,
960,
1923,
16003,
6850,
1525,
5194,
2933,
29892,
769,
366,
508,
1246,
445,
1034,
449,
457,
13,
4706,
408,
1784,
3064,
408,
366,
817,
29889,
13,
13,
4706,
584,
3207,
2643,
29901,
2643,
1203,
13,
4706,
9995,
13,
4706,
565,
525,
355,
29915,
297,
9049,
5085,
29901,
13,
9651,
18116,
29889,
25442,
877,
29908,
355,
29908,
2980,
338,
18164,
29892,
671,
525,
13,
462,
3986,
18793,
5461,
29889,
6717,
29918,
3018,
6504,
29918,
19635,
29908,
9479,
742,
13,
462,
3986,
5096,
5563,
29922,
29906,
29897,
13,
13,
4706,
1095,
353,
9049,
5085,
29889,
7323,
877,
355,
742,
7700,
29897,
13,
4706,
4974,
451,
9049,
5085,
29892,
9049,
5085,
13,
13,
4706,
565,
451,
1583,
3032,
6717,
29918,
11228,
29918,
19635,
29918,
15091,
29901,
13,
9651,
7272,
1583,
29889,
6717,
29918,
11228,
29918,
19635,
580,
13,
13,
4706,
565,
451,
1583,
3032,
7543,
979,
537,
29889,
2974,
29918,
5461,
292,
29901,
13,
9651,
565,
1583,
3032,
6717,
29918,
4906,
29918,
2798,
29901,
13,
18884,
12020,
1019,
5770,
2392,
877,
6004,
881,
3638,
3721,
697,
2643,
525,
13,
462,
462,
1678,
525,
262,
2933,
1495,
13,
13,
4706,
7272,
3638,
29918,
4906,
29898,
1311,
3032,
5461,
29892,
1583,
3032,
401,
29883,
29892,
2643,
29892,
1583,
3032,
6717,
29918,
1853,
29897,
13,
4706,
1583,
3032,
6717,
29918,
4906,
29918,
2798,
4619,
29871,
29896,
13,
13,
4706,
565,
1095,
29901,
13,
9651,
7272,
1583,
29889,
6717,
29918,
3018,
6504,
29918,
19635,
580,
13,
13,
1678,
7465,
822,
3638,
29918,
3018,
6504,
29918,
19635,
29898,
1311,
29892,
334,
29892,
4660,
29922,
5709,
29889,
8949,
29892,
13,
462,
462,
268,
4660,
29918,
4906,
29922,
8516,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
3638,
1020,
22058,
411,
25053,
15562,
304,
278,
3132,
29889,
13,
13,
4706,
910,
1034,
449,
457,
6511,
9348,
1020,
22058,
29899,
6194,
20890,
29892,
297,
1206,
310,
777,
13,
4706,
10672,
5855,
2645,
11415,
1857,
2009,
29892,
474,
29889,
29872,
29889,
746,
13,
4706,
4954,
4882,
338,
451,
9280,
29952,
1412,
13,
13,
4706,
6317,
4443,
1057,
910,
1034,
449,
457,
674,
367,
2000,
27063,
472,
6876,
515,
13,
9651,
2009,
7834,
29892,
411,
8210,
4660,
775,
29892,
565,
451,
2000,
13,
9651,
9479,
2645,
7834,
8225,
29889,
13,
13,
4706,
584,
3207,
4660,
29901,
9819,
4660,
310,
445,
1034,
449,
457,
1246,
13,
4706,
584,
3207,
4660,
29918,
4906,
29901,
6139,
363,
263,
4660,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
6717,
29918,
3018,
6504,
29918,
19635,
29918,
15091,
29901,
13,
9651,
12020,
1019,
5770,
2392,
877,
5323,
6504,
15562,
471,
2307,
2665,
1495,
13,
13,
4706,
565,
451,
1583,
3032,
6717,
29918,
4906,
29918,
2798,
322,
4660,
338,
16034,
29889,
8949,
29901,
13,
9651,
12020,
1019,
5770,
2392,
877,
29912,
29991,
29878,
29913,
6858,
1661,
29899,
6310,
2933,
29915,
13,
462,
18884,
869,
4830,
29898,
4882,
876,
13,
13,
4706,
565,
1583,
3032,
6717,
29918,
11228,
29918,
19635,
29918,
15091,
29901,
13,
9651,
9066,
353,
5159,
13,
4706,
1683,
29901,
13,
9651,
396,
1020,
22058,
29899,
6194,
2933,
13,
9651,
9066,
353,
518,
877,
29901,
4882,
742,
525,
29906,
29900,
29900,
1495,
29962,
13,
13,
4706,
9066,
29889,
4397,
29898,
877,
629,
6739,
29899,
4882,
742,
851,
29898,
4882,
29889,
1767,
4961,
13,
4706,
565,
4660,
29918,
4906,
338,
451,
6213,
29901,
13,
9651,
9066,
29889,
4397,
29898,
877,
629,
6739,
29899,
4906,
742,
4660,
29918,
4906,
876,
13,
13,
4706,
7272,
1583,
3032,
5461,
29889,
6717,
29918,
13662,
29898,
13662,
29892,
1095,
29918,
5461,
29922,
5574,
29897,
13,
4706,
1583,
3032,
6717,
29918,
3018,
6504,
29918,
19635,
29918,
15091,
353,
5852,
13,
13,
4706,
565,
4660,
2804,
16034,
29889,
8949,
322,
1583,
3032,
5461,
29889,
11291,
519,
29901,
13,
9651,
1583,
3032,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
13,
1678,
7465,
822,
12611,
29898,
1311,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
12611,
445,
2009,
29914,
5461,
29889,
13,
13,
4706,
5656,
674,
3638,
390,
1254,
29918,
1254,
1525,
5194,
3515,
304,
278,
3132,
29892,
577,
372,
674,
367,
13,
4706,
9479,
23388,
393,
727,
338,
3078,
304,
2149,
515,
278,
1923,
13,
4706,
11211,
445,
2009,
29914,
5461,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
20713,
29918,
15091,
29901,
13,
9651,
12020,
1019,
5770,
2392,
877,
3835,
471,
2307,
12611,
839,
1495,
13,
13,
4706,
7272,
1583,
3032,
5461,
29889,
12071,
580,
29871,
396,
14402,
29901,
6084,
1059,
775,
13,
4706,
1583,
3032,
20713,
29918,
15091,
353,
5852,
13,
13,
1678,
7465,
822,
4770,
29874,
5893,
12035,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
7465,
822,
4770,
29874,
13322,
12035,
1311,
29892,
5566,
29918,
1853,
29892,
5566,
29918,
791,
29892,
5566,
29918,
22625,
1125,
13,
4706,
565,
313,
13,
9651,
1583,
3032,
6717,
29918,
3018,
6504,
29918,
19635,
29918,
15091,
13,
9651,
470,
1583,
3032,
20713,
29918,
15091,
13,
9651,
470,
1583,
3032,
5461,
3032,
27882,
29889,
275,
29918,
11291,
292,
580,
13,
308,
1125,
13,
9651,
396,
304,
21301,
3682,
13089,
362,
13,
9651,
736,
5852,
13,
13,
4706,
565,
5566,
29918,
791,
338,
451,
6213,
29901,
13,
9651,
565,
338,
8758,
29898,
735,
29883,
29918,
791,
29892,
18016,
9026,
2392,
1125,
13,
18884,
4660,
353,
5566,
29918,
791,
29889,
4882,
13,
18884,
4660,
29918,
4906,
353,
5566,
29918,
791,
29889,
4906,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29918,
791,
29892,
8960,
1125,
13,
18884,
4660,
353,
16034,
29889,
3904,
29968,
6632,
16048,
13,
18884,
4660,
29918,
4906,
353,
525,
16491,
5656,
4829,
29915,
13,
9651,
1683,
29901,
13,
18884,
396,
13089,
403,
3682,
13,
18884,
736,
13,
4706,
25342,
451,
1583,
3032,
6717,
29918,
4906,
29918,
2798,
29901,
13,
9651,
4660,
353,
16034,
29889,
3904,
29968,
6632,
16048,
13,
9651,
4660,
29918,
4906,
353,
525,
8915,
2933,
29915,
13,
4706,
1683,
29901,
13,
9651,
4660,
353,
16034,
29889,
8949,
13,
9651,
4660,
29918,
4906,
353,
6213,
13,
13,
4706,
1018,
29901,
13,
9651,
7272,
1583,
29889,
6717,
29918,
3018,
6504,
29918,
19635,
29898,
4882,
29922,
4882,
29892,
13,
462,
462,
795,
4660,
29918,
4906,
29922,
4882,
29918,
4906,
29897,
13,
4706,
5174,
298,
29906,
29889,
11739,
29879,
29889,
3835,
6821,
2662,
2392,
29901,
13,
9651,
1209,
13,
13,
4706,
396,
304,
21301,
3682,
13089,
362,
13,
4706,
736,
5852,
13,
13,
13,
12674,
822,
2009,
29918,
13789,
29898,
20698,
29892,
903,
5461,
29892,
9066,
29892,
775,
29883,
29892,
6507,
29918,
5461,
1125,
13,
1678,
1018,
29901,
13,
4706,
9066,
29918,
1958,
353,
9657,
29898,
13662,
29897,
13,
13,
4706,
565,
9066,
29918,
1958,
1839,
29901,
5696,
2033,
2804,
525,
5438,
2396,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29946,
29900,
29945,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
2793,
29918,
1853,
353,
9066,
29918,
1958,
29889,
657,
877,
3051,
29899,
1853,
1495,
13,
4706,
565,
2793,
29918,
1853,
338,
6213,
29901,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29946,
29896,
29945,
5477,
13,
18884,
6702,
629,
6739,
29899,
4882,
742,
851,
29898,
5709,
29889,
3904,
29968,
6632,
16048,
29889,
1767,
8243,
13,
18884,
6702,
629,
6739,
29899,
4906,
742,
525,
18552,
292,
2793,
29899,
1853,
4839,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
2967,
29918,
3051,
29918,
1853,
29892,
17117,
1014,
29918,
1853,
353,
2793,
29918,
1853,
29889,
16707,
877,
29974,
1495,
13,
4706,
1014,
29918,
1853,
353,
1014,
29918,
1853,
470,
1019,
517,
3399,
29883,
17255,
3051,
29918,
1491,
1853,
1649,
13,
4706,
565,
313,
13,
9651,
2967,
29918,
3051,
29918,
1853,
2804,
18016,
9026,
29918,
22412,
3919,
29918,
11116,
13,
9651,
470,
1014,
29918,
1853,
2804,
775,
29883,
17255,
3051,
29918,
1491,
1853,
1649,
13,
308,
1125,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29946,
29896,
29945,
5477,
13,
18884,
6702,
629,
6739,
29899,
4882,
742,
851,
29898,
5709,
29889,
3904,
29968,
6632,
16048,
29889,
1767,
8243,
13,
18884,
6702,
629,
6739,
29899,
4906,
742,
525,
2525,
16044,
519,
2793,
29899,
1853,
4839,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
565,
9066,
29918,
1958,
29889,
657,
877,
371,
1495,
2804,
525,
3018,
22058,
2396,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29946,
29900,
29900,
5477,
13,
18884,
6702,
629,
6739,
29899,
4882,
742,
851,
29898,
5709,
29889,
3904,
29968,
6632,
16048,
29889,
1767,
8243,
13,
18884,
6702,
629,
6739,
29899,
4906,
742,
525,
19347,
376,
371,
29901,
1020,
22058,
29908,
4839,
338,
4567,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
298,
29906,
29918,
2084,
353,
9066,
29918,
1958,
1839,
29901,
2084,
2033,
13,
4706,
1158,
353,
10417,
29889,
657,
29898,
29882,
29906,
29918,
2084,
29897,
13,
4706,
565,
1158,
338,
6213,
29901,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29906,
29900,
29900,
5477,
13,
18884,
6702,
629,
6739,
29899,
4882,
742,
851,
29898,
5709,
29889,
3904,
29902,
3580,
1307,
13780,
3352,
29889,
1767,
8243,
13,
18884,
6702,
629,
6739,
29899,
4906,
742,
525,
4062,
451,
1476,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
15562,
353,
4737,
7221,
29889,
3166,
29918,
13662,
29898,
13662,
29897,
13,
4706,
1018,
29901,
13,
9651,
7123,
1220,
353,
16992,
1220,
29889,
3166,
29918,
19635,
29898,
19635,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
7272,
903,
5461,
29889,
6717,
29918,
13662,
4197,
13,
18884,
313,
2396,
4882,
742,
525,
29906,
29900,
29900,
5477,
13,
18884,
6702,
629,
6739,
29899,
4882,
742,
851,
29898,
5709,
29889,
3904,
29968,
6632,
16048,
29889,
1767,
8243,
13,
18884,
6702,
629,
6739,
29899,
4906,
742,
525,
13919,
867,
6739,
29899,
15619,
4839,
5477,
13,
9651,
21251,
1095,
29918,
5461,
29922,
5574,
29897,
13,
9651,
565,
903,
5461,
29889,
11291,
519,
29901,
13,
18884,
903,
5461,
29889,
12071,
29918,
3707,
1249,
580,
13,
9651,
736,
13,
13,
4706,
7465,
411,
13763,
7373,
5461,
29892,
1158,
29889,
7543,
979,
537,
29892,
775,
29883,
29892,
13,
462,
3986,
1158,
29889,
3827,
29918,
1853,
29892,
1158,
29889,
3445,
368,
29918,
1853,
29892,
13,
462,
3986,
15562,
29922,
19635,
29892,
7123,
1220,
29922,
311,
328,
1220,
29897,
408,
4840,
29901,
13,
9651,
7123,
1220,
29918,
17699,
353,
6213,
13,
9651,
1018,
29901,
13,
18884,
565,
7123,
1220,
29901,
13,
462,
1678,
7123,
1220,
29918,
17699,
353,
16992,
1220,
15646,
580,
13,
462,
1678,
411,
7123,
1220,
29918,
17699,
29889,
2962,
29898,
311,
328,
1220,
1125,
13,
462,
4706,
411,
7123,
1220,
29918,
17699,
29901,
13,
462,
9651,
7272,
1158,
29889,
9891,
29898,
5461,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
7272,
1158,
29889,
9891,
29898,
5461,
29897,
13,
9651,
5174,
408,
948,
3934,
29889,
10851,
2392,
29901,
13,
18884,
565,
7123,
1220,
29918,
17699,
322,
7123,
1220,
29918,
17699,
29889,
20713,
839,
29901,
13,
462,
1678,
1480,
29889,
11739,
877,
29928,
1479,
1220,
13461,
287,
1495,
13,
462,
1678,
12020,
18016,
9026,
2392,
29898,
5709,
29889,
2287,
3035,
18521,
29918,
5746,
4741,
29923,
2287,
29928,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
1480,
29889,
11739,
877,
10851,
10761,
1495,
13,
462,
1678,
12020,
13,
9651,
5174,
408,
948,
3934,
29889,
19420,
839,
2392,
29901,
13,
18884,
1480,
29889,
11739,
877,
3089,
471,
12611,
839,
1495,
13,
18884,
12020,
13,
9651,
5174,
8960,
29901,
13,
18884,
1480,
29889,
11739,
877,
4873,
1059,
1495,
13,
18884,
12020,
13,
1678,
5174,
8960,
29901,
13,
4706,
1480,
29889,
11739,
877,
6004,
1059,
1495,
13,
1678,
7146,
29901,
13,
4706,
6507,
29918,
5461,
580,
13,
13,
13,
1990,
903,
8766,
29898,
10736,
29889,
19658,
1125,
13,
1678,
903,
27354,
29918,
11808,
353,
29871,
29900,
13,
13,
1678,
732,
6799,
13,
1678,
732,
10736,
29889,
16595,
5696,
13,
1678,
822,
4770,
27354,
29918,
19207,
12035,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
732,
10736,
29889,
16595,
5696,
13,
1678,
822,
4770,
27354,
29918,
15914,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
27354,
29918,
10568,
12035,
1311,
1125,
13,
4706,
1583,
3032,
27354,
29918,
11808,
4619,
29871,
29896,
13,
4706,
565,
451,
313,
1311,
3032,
27354,
29918,
11808,
1273,
1583,
17255,
27354,
29918,
19207,
1649,
1125,
13,
9651,
1583,
17255,
27354,
29918,
15914,
1649,
580,
13,
13,
13,
1990,
5166,
1358,
7373,
8766,
29892,
25513,
4598,
1125,
13,
1678,
4770,
27354,
29918,
19207,
1649,
353,
29871,
29896,
29900,
13,
13,
1678,
14382,
353,
7700,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10417,
29892,
775,
29883,
29892,
334,
29892,
2425,
1125,
13,
4706,
1583,
29889,
20698,
353,
10417,
13,
4706,
1583,
29889,
401,
29883,
353,
775,
29883,
13,
4706,
1583,
29889,
7888,
353,
2425,
13,
4706,
1583,
3032,
20673,
353,
6571,
13,
4706,
1583,
3032,
20713,
839,
353,
731,
580,
13,
13,
1678,
822,
4770,
27354,
29918,
15914,
12035,
1311,
1125,
13,
4706,
1583,
3032,
20673,
353,
426,
29879,
29901,
260,
363,
269,
29892,
260,
297,
1583,
3032,
20673,
29889,
7076,
580,
13,
462,
539,
565,
451,
260,
29889,
15091,
28296,
13,
4706,
1583,
3032,
20713,
839,
353,
426,
29873,
363,
260,
297,
1583,
3032,
20713,
839,
13,
462,
965,
565,
451,
260,
29889,
15091,
28296,
13,
13,
1678,
822,
3544,
29898,
1311,
29892,
4840,
29892,
9066,
29892,
6507,
29918,
5461,
1125,
13,
4706,
1583,
17255,
27354,
29918,
10568,
1649,
580,
13,
4706,
1583,
3032,
20673,
29961,
5461,
29962,
353,
1583,
29889,
7888,
29889,
3258,
29918,
7662,
29898,
13,
9651,
2009,
29918,
13789,
29898,
1311,
29889,
20698,
29892,
4840,
29892,
9066,
29892,
1583,
29889,
401,
29883,
29892,
13,
462,
9651,
6507,
29918,
5461,
29897,
13,
4706,
1723,
13,
13,
1678,
822,
12611,
29898,
1311,
29892,
4840,
1125,
13,
4706,
3414,
353,
1583,
3032,
20673,
29889,
7323,
29898,
5461,
29897,
13,
4706,
3414,
29889,
20713,
580,
13,
4706,
1583,
3032,
20713,
839,
29889,
1202,
29898,
7662,
29897,
13,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
363,
3414,
297,
1583,
3032,
20673,
29889,
5975,
7295,
13,
9651,
3414,
29889,
20713,
580,
13,
4706,
1583,
3032,
20713,
839,
29889,
5504,
29898,
1311,
3032,
20673,
29889,
5975,
3101,
13,
4706,
1583,
29889,
11291,
292,
353,
5852,
13,
13,
1678,
7465,
822,
4480,
29918,
15603,
29898,
1311,
1125,
13,
4706,
565,
1583,
3032,
20713,
839,
29901,
13,
9651,
7272,
408,
948,
3934,
29889,
10685,
29898,
1311,
3032,
20713,
839,
29892,
2425,
29922,
1311,
29889,
7888,
29897,
13,
13,
1678,
822,
1423,
29918,
15603,
29898,
1311,
1125,
13,
4706,
1583,
17255,
27354,
29918,
15914,
1649,
580,
13,
4706,
736,
451,
1583,
3032,
20673,
322,
451,
1583,
3032,
20713,
839,
13,
13,
13,
1990,
5656,
7373,
8766,
29892,
408,
948,
3934,
29889,
9118,
6004,
1125,
13,
1678,
9995,
13,
1678,
7331,
29914,
29906,
1923,
29892,
607,
3913,
330,
29934,
9026,
2669,
25795,
304,
4386,
7274,
29889,
13,
13,
1678,
5166,
1358,
338,
263,
19481,
310,
278,
9846,
2967,
770,
29892,
607,
471,
5759,
13,
1678,
515,
869,
17529,
934,
29901,
13,
13,
1678,
6317,
775,
29899,
1271,
1057,
3017,
13,
13,
4706,
770,
315,
2696,
3905,
29076,
29898,
1113,
1725,
29918,
629,
6739,
29889,
29907,
2696,
3905,
29076,
5160,
1125,
13,
13,
9651,
7465,
822,
8561,
13992,
371,
29898,
1311,
29892,
4840,
1125,
13,
18884,
3414,
29901,
5777,
1725,
29918,
24381,
29906,
29889,
13992,
371,
7514,
353,
7272,
4840,
29889,
3757,
29894,
29918,
4906,
580,
13,
18884,
2023,
13,
18884,
7272,
4840,
29889,
6717,
29918,
4906,
29898,
6310,
29918,
24381,
29906,
29889,
8915,
3101,
13,
13,
4706,
1923,
353,
5656,
4197,
29907,
2696,
3905,
29076,
580,
1402,
2425,
29922,
7888,
29897,
13,
1678,
9995,
13,
1678,
4770,
27354,
29918,
19207,
1649,
353,
29871,
29896,
29900,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
25795,
29892,
334,
29892,
2425,
29892,
775,
29883,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
25795,
29901,
1051,
310,
25795,
13,
4706,
584,
3207,
2425,
29901,
408,
948,
3934,
29899,
23712,
1741,
2425,
13,
4706,
9995,
13,
4706,
10417,
353,
6571,
13,
4706,
363,
7834,
297,
25795,
29901,
13,
9651,
10417,
29889,
5504,
29898,
13789,
17255,
20698,
1649,
3101,
13,
13,
4706,
1583,
3032,
20698,
353,
10417,
13,
4706,
1583,
3032,
7888,
353,
2425,
13,
4706,
1583,
3032,
401,
29883,
353,
775,
29883,
470,
1019,
517,
3399,
29883,
580,
13,
4706,
1583,
3032,
2917,
353,
298,
29906,
29889,
2917,
29889,
29950,
29906,
8614,
29898,
13,
9651,
3132,
29918,
2975,
29922,
8824,
29892,
13,
9651,
4839,
29918,
22331,
2433,
9420,
29899,
29947,
742,
13,
4706,
1723,
13,
13,
4706,
1583,
3032,
23981,
29918,
2974,
353,
6213,
13,
4706,
1583,
3032,
3179,
9306,
353,
731,
580,
13,
13,
1678,
822,
4770,
27354,
29918,
15914,
12035,
1311,
1125,
13,
4706,
1583,
3032,
3179,
9306,
353,
426,
29882,
363,
298,
297,
1583,
3032,
3179,
9306,
13,
462,
3986,
565,
451,
313,
29882,
29889,
11291,
292,
322,
298,
29889,
3198,
29918,
15603,
580,
2915,
13,
13,
1678,
822,
903,
20464,
29918,
14399,
29898,
1311,
1125,
13,
4706,
1583,
17255,
27354,
29918,
10568,
1649,
580,
13,
4706,
7834,
353,
5166,
1358,
29898,
1311,
3032,
20698,
29892,
1583,
3032,
401,
29883,
29892,
2425,
29922,
1311,
3032,
7888,
29897,
13,
4706,
1583,
3032,
3179,
9306,
29889,
1202,
29898,
13789,
29897,
13,
4706,
736,
379,
29906,
17830,
29898,
13789,
29892,
1583,
3032,
2917,
29892,
2425,
29922,
1311,
3032,
7888,
29897,
13,
13,
1678,
7465,
822,
1369,
29898,
1311,
29892,
3495,
29922,
8516,
29892,
2011,
29922,
8516,
29892,
334,
29892,
13,
462,
1678,
3942,
29922,
11514,
29889,
5098,
29918,
29965,
3059,
4162,
29907,
29892,
13449,
29922,
11514,
29889,
23869,
29918,
25711,
18474,
29892,
13,
462,
1678,
577,
384,
29922,
8516,
29892,
1250,
1188,
29922,
29896,
29900,
29900,
29892,
24250,
29922,
8516,
29892,
24270,
29918,
7328,
29922,
8516,
29892,
13,
462,
1678,
24270,
29918,
637,
29922,
8516,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
1369,
278,
1923,
29889,
13,
13,
4706,
584,
3207,
3495,
29901,
508,
367,
263,
1347,
29892,
6943,
5641,
29894,
29946,
29914,
29894,
29953,
3211,
470,
5354,
1024,
29889,
13,
9651,
960,
3495,
338,
6213,
29892,
1923,
674,
367,
3216,
304,
599,
3625,
19510,
29889,
13,
13,
4706,
584,
3207,
2011,
29901,
2011,
1353,
29889,
13,
13,
4706,
584,
3207,
3942,
29901,
508,
367,
731,
304,
2845,
584,
2272,
29901,
1272,
18078,
4691,
29901,
11514,
29889,
5098,
29918,
1177,
2544,
29952,
470,
13,
9651,
584,
2272,
29901,
1272,
18078,
4691,
29901,
11514,
29889,
5098,
29918,
1177,
2544,
29953,
29952,
304,
4889,
278,
9909,
304,
671,
5641,
29894,
29946,
470,
13,
9651,
5641,
29894,
29953,
29889,
960,
451,
731,
372,
674,
367,
10087,
515,
3495,
29889,
13,
13,
4706,
584,
3207,
13449,
29901,
338,
263,
2586,
13168,
363,
13,
9651,
584,
2272,
29901,
29885,
621,
18078,
30022,
4691,
29901,
294,
948,
3934,
29889,
9118,
2624,
18405,
29889,
657,
10030,
3888,
1412,
13,
13,
4706,
584,
3207,
577,
384,
29901,
577,
384,
508,
2984,
635,
367,
6790,
297,
1797,
304,
671,
263,
13,
9651,
758,
735,
15423,
9909,
1203,
29889,
960,
6790,
29892,
3495,
322,
2011,
881,
367,
13,
9651,
25811,
313,
21969,
367,
6213,
467,
13,
13,
4706,
584,
3207,
1250,
1188,
29901,
338,
278,
7472,
1353,
310,
712,
6742,
12368,
4502,
304,
13,
9651,
11621,
2141,
13,
13,
4706,
584,
3207,
24250,
29901,
508,
367,
731,
304,
385,
584,
2272,
29901,
1990,
18078,
30022,
4691,
29901,
16265,
29889,
18641,
2677,
29952,
13,
9651,
304,
9025,
17122,
975,
278,
9259,
12368,
29889,
13,
13,
4706,
584,
3207,
24270,
29918,
7328,
29901,
10603,
278,
8466,
304,
24270,
263,
1887,
9909,
297,
13,
9651,
323,
8890,
29918,
12982,
1806,
2106,
29892,
1728,
10534,
363,
967,
5613,
11815,
304,
1518,
533,
29889,
13,
13,
4706,
584,
3207,
24270,
29918,
637,
29901,
10603,
278,
8466,
304,
2758,
445,
16248,
304,
367,
3216,
13,
9651,
304,
278,
1021,
2011,
408,
916,
5923,
1095,
9748,
526,
3216,
304,
29892,
13,
9651,
577,
1472,
408,
896,
599,
731,
445,
7353,
746,
1641,
2825,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
23981,
29918,
2974,
338,
451,
6213,
29901,
13,
9651,
12020,
24875,
2392,
877,
6004,
338,
2307,
4687,
1495,
13,
13,
4706,
1583,
3032,
23981,
29918,
2974,
353,
7272,
1583,
3032,
7888,
29889,
3258,
29918,
2974,
29898,
13,
9651,
1583,
3032,
20464,
29918,
14399,
29892,
3495,
29892,
2011,
29892,
13,
9651,
3942,
29922,
11922,
29892,
13449,
29922,
15764,
29892,
577,
384,
29922,
21852,
29892,
1250,
1188,
29922,
1627,
1188,
29892,
24250,
29922,
16265,
29892,
13,
9651,
24270,
29918,
7328,
29922,
276,
1509,
29918,
7328,
29892,
24270,
29918,
637,
29922,
276,
1509,
29918,
637,
13,
4706,
1723,
13,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
9995,
855,
3554,
25967,
716,
12368,
29892,
508,
29883,
1379,
599,
5279,
2734,
13,
4706,
7274,
29889,
10729,
25795,
526,
2221,
304,
4386,
421,
19420,
839,
2392,
29952,
322,
13,
4706,
6876,
6284,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
23981,
29918,
2974,
338,
6213,
29901,
13,
9651,
12020,
24875,
2392,
877,
6004,
338,
451,
4687,
1495,
13,
4706,
1583,
3032,
23981,
29918,
2974,
29889,
5358,
580,
13,
4706,
363,
7834,
297,
1583,
3032,
3179,
9306,
29901,
13,
9651,
7834,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
4480,
29918,
15603,
29898,
1311,
1125,
13,
4706,
9995,
12521,
449,
457,
304,
4480,
2745,
599,
5923,
2009,
25795,
674,
6876,
13,
4706,
6284,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
3032,
23981,
29918,
2974,
338,
6213,
29901,
13,
9651,
12020,
24875,
2392,
877,
6004,
338,
451,
4687,
1495,
13,
4706,
7272,
1583,
3032,
23981,
29918,
2974,
29889,
10685,
29918,
15603,
580,
13,
4706,
565,
1583,
3032,
3179,
9306,
29901,
13,
9651,
7272,
408,
948,
3934,
29889,
10685,
3319,
29882,
29889,
10685,
29918,
15603,
580,
363,
298,
297,
1583,
3032,
3179,
9306,
1118,
13,
462,
1669,
2425,
29922,
1311,
3032,
7888,
29897,
13,
2
] |
pg_dicreate.py | zhuyeaini9/pytorch_test | 0 | 23677 | <reponame>zhuyeaini9/pytorch_test<filename>pg_dicreate.py
import torch
import torch.nn.functional as F
import torch.nn as nn
import gym
from gym import spaces
import torch.optim as optim
from torch.distributions import Categorical
import random
import numpy as np
class Net(nn.Module):
def __init__(self, input_space, output_space):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_space, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, output_space)
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = F.softmax(self.fc3(x), dim=-1)
return x
class PGAgent(object):
def __init__(self, env_name,batch_size = 3):
self.m_batch_size = batch_size
self.m_env = gym.make(env_name)
self.m_env._max_episode_steps = 1000
self.m_action_type = self.get_action_type()
self.m_action_size = self.get_action_size()
self.m_net = Net(self.get_input_space(), self.get_output_space())
self.m_adam = optim.Adam(params=self.m_net.parameters(), lr=0.01)
self.m_batch_reward = []
self.m_batch_state = []
self.m_batch_action = []
def get_input_space(self):
return self.m_env.observation_space.shape[0]
def get_action_size(self):
if self.m_action_type == 1:
return self.m_env.action_space.n
def get_output_space(self):
if self.m_action_type == 1:
return self.m_env.action_space.n
def get_action_type(self):
if isinstance(self.m_env.action_space, spaces.Discrete):
action_type = 1
else:
action_type = 2
return action_type
def get_action(self, police_action, step_index, step_all):
if self.m_action_type == 1:
action_distribution = Categorical(police_action)
return action_distribution.sample().item()
def calculate_discounted_rewards_normal(self, reward_list):
re = self.calculate_discounted_rewards(reward_list)
return self.normalise_rewards(re)
def calculate_discounted_rewards(self, reward_list):
cur_re = 0
re_discounted_reward = []
for re in reversed(reward_list):
re = re + 0.99 * cur_re
cur_re = re
re_discounted_reward.append(re)
re_discounted_reward.reverse()
return re_discounted_reward
def normalise_rewards(self, rewards):
mean_reward = np.mean(rewards)
std_reward = np.std(rewards)
return (rewards - mean_reward) / (std_reward + 1e-8)
def reset(self):
self.m_batch_state = []
self.m_batch_action = []
self.m_batch_reward = []
def step(self, step_index, step_all):
self.reset()
state = self.m_env.reset()
batch = 0
reward_record = []
reward_list = []
action_list = []
state_list = []
while True:
#be careful of detach
out_action = self.m_net(torch.tensor(state).float().unsqueeze(dim=0)).detach()
out_action = out_action.squeeze(0)
tar_action = self.get_action(out_action, step_index, step_all)
new_state, reward, done, _ = self.m_env.step(tar_action)
reward_list.append(reward)
action_list.append(tar_action)
state_list.append(state)
state = new_state
if done:
batch += 1
self.m_batch_reward.extend(self.calculate_discounted_rewards_normal(reward_list))
self.m_batch_action.extend(action_list)
self.m_batch_state.extend(state_list)
reward_record.append(sum(reward_list))
reward_list = []
action_list = []
state_list = []
state = self.m_env.reset()
if batch == self.m_batch_size:
break
print(step_index, reward_record)
state_tensor = torch.FloatTensor(self.m_batch_state)
reward_tensor = torch.FloatTensor(self.m_batch_reward)
action_tensor = torch.LongTensor(self.m_batch_action)
# Calculate loss
log_prob = torch.log(self.m_net(state_tensor))
selected_logprobs = reward_tensor * log_prob[np.arange(len(action_tensor)), action_tensor]
loss = -selected_logprobs.mean()
self.m_adam.zero_grad()
# Calculate gradients
loss.backward()
# Apply gradients
self.m_adam.step()
def run_n_step(self, n):
for i in range(n):
self.step(i, n)
agent = PGAgent('CartPole-v0')
agent.run_n_step(300)
| [
1,
529,
276,
1112,
420,
29958,
29920,
6905,
4099,
475,
29875,
29929,
29914,
2272,
7345,
305,
29918,
1688,
29966,
9507,
29958,
4061,
29918,
27774,
3015,
29889,
2272,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
330,
962,
13,
3166,
330,
962,
1053,
8162,
13,
5215,
4842,
305,
29889,
20640,
408,
5994,
13,
3166,
4842,
305,
29889,
27691,
29879,
1053,
315,
20440,
936,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1990,
12670,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1881,
29918,
3493,
29892,
1962,
29918,
3493,
1125,
13,
4706,
2428,
29898,
6779,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
13801,
29896,
353,
302,
29876,
29889,
12697,
29898,
2080,
29918,
3493,
29892,
29871,
29953,
29946,
29897,
13,
4706,
1583,
29889,
13801,
29906,
353,
302,
29876,
29889,
12697,
29898,
29953,
29946,
29892,
29871,
29953,
29946,
29897,
13,
4706,
1583,
29889,
13801,
29941,
353,
302,
29876,
29889,
12697,
29898,
29953,
29946,
29892,
1962,
29918,
3493,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
13,
4706,
921,
353,
383,
29889,
2674,
29884,
29898,
1311,
29889,
13801,
29896,
29898,
29916,
876,
13,
4706,
921,
353,
383,
29889,
2674,
29884,
29898,
1311,
29889,
13801,
29906,
29898,
29916,
876,
13,
4706,
921,
353,
383,
29889,
2695,
3317,
29898,
1311,
29889,
13801,
29941,
29898,
29916,
511,
3964,
10457,
29896,
29897,
13,
4706,
736,
921,
13,
13,
13,
1990,
349,
12739,
5362,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8829,
29918,
978,
29892,
16175,
29918,
2311,
353,
29871,
29941,
1125,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
2311,
353,
9853,
29918,
2311,
13,
4706,
1583,
29889,
29885,
29918,
6272,
353,
330,
962,
29889,
5675,
29898,
6272,
29918,
978,
29897,
13,
4706,
1583,
29889,
29885,
29918,
6272,
3032,
3317,
29918,
1022,
275,
356,
29918,
24530,
353,
29871,
29896,
29900,
29900,
29900,
13,
4706,
1583,
29889,
29885,
29918,
2467,
29918,
1853,
353,
1583,
29889,
657,
29918,
2467,
29918,
1853,
580,
13,
4706,
1583,
29889,
29885,
29918,
2467,
29918,
2311,
353,
1583,
29889,
657,
29918,
2467,
29918,
2311,
580,
13,
4706,
1583,
29889,
29885,
29918,
1212,
353,
12670,
29898,
1311,
29889,
657,
29918,
2080,
29918,
3493,
3285,
1583,
29889,
657,
29918,
4905,
29918,
3493,
3101,
13,
4706,
1583,
29889,
29885,
29918,
328,
314,
353,
5994,
29889,
3253,
314,
29898,
7529,
29922,
1311,
29889,
29885,
29918,
1212,
29889,
16744,
3285,
301,
29878,
29922,
29900,
29889,
29900,
29896,
29897,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
276,
1328,
353,
5159,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
3859,
353,
5159,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
2467,
353,
5159,
13,
13,
1678,
822,
679,
29918,
2080,
29918,
3493,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29885,
29918,
6272,
29889,
26739,
362,
29918,
3493,
29889,
12181,
29961,
29900,
29962,
13,
13,
1678,
822,
679,
29918,
2467,
29918,
2311,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
29885,
29918,
2467,
29918,
1853,
1275,
29871,
29896,
29901,
13,
9651,
736,
1583,
29889,
29885,
29918,
6272,
29889,
2467,
29918,
3493,
29889,
29876,
13,
13,
1678,
822,
679,
29918,
4905,
29918,
3493,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
29885,
29918,
2467,
29918,
1853,
1275,
29871,
29896,
29901,
13,
9651,
736,
1583,
29889,
29885,
29918,
6272,
29889,
2467,
29918,
3493,
29889,
29876,
13,
13,
1678,
822,
679,
29918,
2467,
29918,
1853,
29898,
1311,
1125,
13,
4706,
565,
338,
8758,
29898,
1311,
29889,
29885,
29918,
6272,
29889,
2467,
29918,
3493,
29892,
8162,
29889,
4205,
9084,
1125,
13,
9651,
3158,
29918,
1853,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
3158,
29918,
1853,
353,
29871,
29906,
13,
4706,
736,
3158,
29918,
1853,
13,
13,
1678,
822,
679,
29918,
2467,
29898,
1311,
29892,
10974,
29918,
2467,
29892,
4331,
29918,
2248,
29892,
4331,
29918,
497,
1125,
13,
4706,
565,
1583,
29889,
29885,
29918,
2467,
29918,
1853,
1275,
29871,
29896,
29901,
13,
9651,
3158,
29918,
27691,
353,
315,
20440,
936,
29898,
3733,
625,
29918,
2467,
29897,
13,
9651,
736,
3158,
29918,
27691,
29889,
11249,
2141,
667,
580,
13,
13,
1678,
822,
8147,
29918,
2218,
2798,
287,
29918,
276,
2935,
29918,
8945,
29898,
1311,
29892,
20751,
29918,
1761,
1125,
13,
4706,
337,
353,
1583,
29889,
15807,
403,
29918,
2218,
2798,
287,
29918,
276,
2935,
29898,
276,
1328,
29918,
1761,
29897,
13,
4706,
736,
1583,
29889,
8945,
895,
29918,
276,
2935,
29898,
276,
29897,
13,
13,
1678,
822,
8147,
29918,
2218,
2798,
287,
29918,
276,
2935,
29898,
1311,
29892,
20751,
29918,
1761,
1125,
13,
4706,
3151,
29918,
276,
353,
29871,
29900,
13,
4706,
337,
29918,
2218,
2798,
287,
29918,
276,
1328,
353,
5159,
13,
4706,
363,
337,
297,
18764,
287,
29898,
276,
1328,
29918,
1761,
1125,
13,
9651,
337,
353,
337,
718,
29871,
29900,
29889,
29929,
29929,
334,
3151,
29918,
276,
13,
9651,
3151,
29918,
276,
353,
337,
13,
9651,
337,
29918,
2218,
2798,
287,
29918,
276,
1328,
29889,
4397,
29898,
276,
29897,
13,
4706,
337,
29918,
2218,
2798,
287,
29918,
276,
1328,
29889,
24244,
580,
13,
4706,
736,
337,
29918,
2218,
2798,
287,
29918,
276,
1328,
13,
13,
1678,
822,
4226,
895,
29918,
276,
2935,
29898,
1311,
29892,
337,
2935,
1125,
13,
4706,
2099,
29918,
276,
1328,
353,
7442,
29889,
12676,
29898,
276,
2935,
29897,
13,
4706,
3659,
29918,
276,
1328,
353,
7442,
29889,
4172,
29898,
276,
2935,
29897,
13,
4706,
736,
313,
276,
2935,
448,
2099,
29918,
276,
1328,
29897,
847,
313,
4172,
29918,
276,
1328,
718,
29871,
29896,
29872,
29899,
29947,
29897,
13,
13,
1678,
822,
10092,
29898,
1311,
1125,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
3859,
353,
5159,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
2467,
353,
5159,
13,
4706,
1583,
29889,
29885,
29918,
16175,
29918,
276,
1328,
353,
5159,
13,
13,
1678,
822,
4331,
29898,
1311,
29892,
4331,
29918,
2248,
29892,
4331,
29918,
497,
1125,
13,
4706,
1583,
29889,
12071,
580,
13,
4706,
2106,
353,
1583,
29889,
29885,
29918,
6272,
29889,
12071,
580,
13,
4706,
9853,
353,
29871,
29900,
13,
4706,
20751,
29918,
11651,
353,
5159,
13,
4706,
20751,
29918,
1761,
353,
5159,
13,
4706,
3158,
29918,
1761,
353,
5159,
13,
4706,
2106,
29918,
1761,
353,
5159,
13,
4706,
1550,
5852,
29901,
13,
9651,
396,
915,
16010,
310,
1439,
496,
13,
9651,
714,
29918,
2467,
353,
1583,
29889,
29885,
29918,
1212,
29898,
7345,
305,
29889,
20158,
29898,
3859,
467,
7411,
2141,
6948,
802,
29872,
911,
29898,
6229,
29922,
29900,
8106,
4801,
496,
580,
13,
9651,
714,
29918,
2467,
353,
714,
29918,
2467,
29889,
29879,
802,
29872,
911,
29898,
29900,
29897,
13,
9651,
9913,
29918,
2467,
353,
1583,
29889,
657,
29918,
2467,
29898,
449,
29918,
2467,
29892,
4331,
29918,
2248,
29892,
4331,
29918,
497,
29897,
13,
9651,
716,
29918,
3859,
29892,
20751,
29892,
2309,
29892,
903,
353,
1583,
29889,
29885,
29918,
6272,
29889,
10568,
29898,
12637,
29918,
2467,
29897,
13,
13,
9651,
20751,
29918,
1761,
29889,
4397,
29898,
276,
1328,
29897,
13,
9651,
3158,
29918,
1761,
29889,
4397,
29898,
12637,
29918,
2467,
29897,
13,
9651,
2106,
29918,
1761,
29889,
4397,
29898,
3859,
29897,
13,
13,
9651,
2106,
353,
716,
29918,
3859,
13,
13,
9651,
565,
2309,
29901,
13,
18884,
9853,
4619,
29871,
29896,
13,
13,
18884,
1583,
29889,
29885,
29918,
16175,
29918,
276,
1328,
29889,
21843,
29898,
1311,
29889,
15807,
403,
29918,
2218,
2798,
287,
29918,
276,
2935,
29918,
8945,
29898,
276,
1328,
29918,
1761,
876,
13,
18884,
1583,
29889,
29885,
29918,
16175,
29918,
2467,
29889,
21843,
29898,
2467,
29918,
1761,
29897,
13,
18884,
1583,
29889,
29885,
29918,
16175,
29918,
3859,
29889,
21843,
29898,
3859,
29918,
1761,
29897,
13,
13,
18884,
20751,
29918,
11651,
29889,
4397,
29898,
2083,
29898,
276,
1328,
29918,
1761,
876,
13,
13,
18884,
20751,
29918,
1761,
353,
5159,
13,
18884,
3158,
29918,
1761,
353,
5159,
13,
18884,
2106,
29918,
1761,
353,
5159,
13,
18884,
2106,
353,
1583,
29889,
29885,
29918,
6272,
29889,
12071,
580,
13,
13,
18884,
565,
9853,
1275,
1583,
29889,
29885,
29918,
16175,
29918,
2311,
29901,
13,
462,
1678,
2867,
13,
13,
4706,
1596,
29898,
10568,
29918,
2248,
29892,
20751,
29918,
11651,
29897,
13,
13,
4706,
2106,
29918,
20158,
353,
4842,
305,
29889,
11031,
29911,
6073,
29898,
1311,
29889,
29885,
29918,
16175,
29918,
3859,
29897,
13,
4706,
20751,
29918,
20158,
353,
4842,
305,
29889,
11031,
29911,
6073,
29898,
1311,
29889,
29885,
29918,
16175,
29918,
276,
1328,
29897,
13,
4706,
3158,
29918,
20158,
353,
4842,
305,
29889,
8208,
29911,
6073,
29898,
1311,
29889,
29885,
29918,
16175,
29918,
2467,
29897,
13,
13,
4706,
396,
20535,
403,
6410,
13,
4706,
1480,
29918,
22795,
353,
4842,
305,
29889,
1188,
29898,
1311,
29889,
29885,
29918,
1212,
29898,
3859,
29918,
20158,
876,
13,
4706,
4629,
29918,
1188,
771,
5824,
353,
20751,
29918,
20158,
334,
1480,
29918,
22795,
29961,
9302,
29889,
279,
927,
29898,
2435,
29898,
2467,
29918,
20158,
8243,
3158,
29918,
20158,
29962,
13,
4706,
6410,
353,
448,
8391,
29918,
1188,
771,
5824,
29889,
12676,
580,
13,
13,
4706,
1583,
29889,
29885,
29918,
328,
314,
29889,
9171,
29918,
5105,
580,
13,
4706,
396,
20535,
403,
4656,
10070,
13,
4706,
6410,
29889,
1627,
1328,
580,
13,
4706,
396,
2401,
368,
4656,
10070,
13,
4706,
1583,
29889,
29885,
29918,
328,
314,
29889,
10568,
580,
13,
13,
1678,
822,
1065,
29918,
29876,
29918,
10568,
29898,
1311,
29892,
302,
1125,
13,
4706,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
9651,
1583,
29889,
10568,
29898,
29875,
29892,
302,
29897,
13,
13,
13,
14748,
353,
349,
12739,
5362,
877,
25233,
29925,
1772,
29899,
29894,
29900,
1495,
13,
14748,
29889,
3389,
29918,
29876,
29918,
10568,
29898,
29941,
29900,
29900,
29897,
13,
2
] |
boo/dataframe/canonic.py | AirVetra/boo | 1 | 47840 | import numpy
import pandas as pd
from boo.columns import SHORT_COLUMNS
from boo.errors import UnclassifiableCodeError
QUOTE_CHAR = '"'
EMPTY = int(0)
NUMERIC_COLUMNS = SHORT_COLUMNS.numeric
def adjust_rub(df, cols=NUMERIC_COLUMNS):
rows = (df.unit == "385")
df.loc[rows, cols] = df.loc[rows, cols].multiply(1000)
df.loc[rows, "unit"] = "384"
rows = (df.unit == "383")
df.loc[rows, cols] = df.loc[rows, cols].divide(1000).round(0).astype(int)
df.loc[rows, "unit"] = "384"
return df
def dequote(name: str):
"""Split company *name* to organisation and title."""
# Warning: will not work well on company names with more than 4 quotechars
parts = name.split(QUOTE_CHAR)
org = parts[0].strip()
cnt = name.count(QUOTE_CHAR)
if cnt == 2:
title = parts[1].strip()
elif cnt > 2:
title = QUOTE_CHAR.join(parts[1:])
else:
title = name
return org, title.strip()
def replace_names(title: str):
return title .replace(
"ПУБЛИЧНОЕ АКЦИОНЕРНОЕ ОБЩЕСТВО",
"ПАО") .replace(
"ОТКРЫТОЕ АКЦИОНЕРНОЕ ОБЩЕСТВО",
"ОАО") .replace(
"АКЦИОНЕРНОЕ ОБЩЕСТВО ЭНЕРГЕТИКИ И ЭЛЕКТРИФИКАЦИИ",
"AO энерго") .replace(
"НЕФТЕПЕРЕРАБАТЫВАЮЩИЙ ЗАВОД",
"НПЗ") .replace(
"ГЕНЕРИРУЮЩАЯ КОМПАНИЯ ОПТОВОГО РЫНКА ЭЛЕКТРОЭНЕРГИИ",
"ОГК") .replace(
"ГОРНО-ОБОГАТИТЕЛЬНЫЙ КОМБИНАТ",
"ГОК")
def add_title(df):
s_ = df.name.apply(dequote)
df['org'] = s_.apply(lambda x: x[0])
df['title'] = s_.apply(lambda x: replace_names(x[1]))
return df
def rename_rows(df):
RENAME_DICT = {
'2460066195': "РусГидро",
'4716016979': "ФСК ЕЭС",
'7702038150': "Московский метрополитен",
'7721632827': "Концерн Росэнергоатом",
'7706664260': "Атомэнергопром",
'7703683145': "Холдинг ВТБ Капитал АЙ БИ",
'9102048801': "Черноморнефтегаз",
'7736036626': "РИТЭК"
}
keys = RENAME_DICT.keys()
ix = df.index.isin(keys)
if not ix.any():
return df
sub = df.loc[ix, 'title']
for k, v in RENAME_DICT.items():
if k in sub.index:
sub.loc[k] = v
df.loc[ix, 'title'] = sub
return df
def split_okved(code_string: str):
"""Get 3 levels of OKVED codes from *code_string*."""
if code_string.count(".") > 2:
raise UnclassifiableCodeError(code_string)
try:
codes = [int(x) for x in code_string.split(".")]
except ValueError:
raise UnclassifiableCodeError(code_string)
return codes + [0] * (3 - len(codes))
def add_okved_subcode(df):
df['ok1'], df['ok2'], df['ok3'] = zip(*df.okved.apply(split_okved))
return df
def fst(x):
try:
return int(x[0:2])
except TypeError:
return 0
def add_region(df):
df['region'] = df.inn.apply(fst)
return df
def more_columns(df):
return add_okved_subcode(add_region(add_title(df)))
def canonic_df(df):
"""Преобразовать данные внтури датафрейма:
- Привести все строки к одинаковым единицам измерения (тыс. руб.)
- Убрать неиспользуемые колонки (date_revised, report_type)
- Новые колонки:
* короткое название компании
* три уровня кода ОКВЭД
* регион (по ИНН)
"""
df_ = add_okved_subcode(add_region(add_title(df)))
df_ = adjust_rub(df_)
df_ = df_.set_index('inn')
df_ = rename_rows(df_)
return df_[canonic_columns()]
def canonic_columns(numeric=SHORT_COLUMNS.numeric):
return (['title', 'org', 'okpo', 'okopf', 'okfs', 'okved'] +
['unit'] +
['ok1', 'ok2', 'ok3', 'region'] +
numeric)
def is_numeric_column(name, numeric=SHORT_COLUMNS.numeric):
return name in numeric
def columns_typed_as_integer(numeric=SHORT_COLUMNS.numeric):
return numeric + ['ok1', 'ok2', 'ok3', 'region']
def canonic_dtypes():
def switch(col):
int_columns = columns_typed_as_integer()
return numpy.int64 if (col in int_columns) else str
result = {col: switch(col) for col in canonic_columns()}
result['inn'] = str
return result
| [
1,
1053,
12655,
13,
5215,
11701,
408,
10518,
13,
3166,
1045,
29877,
29889,
13099,
1053,
24972,
8476,
29918,
15032,
5005,
3059,
13,
3166,
1045,
29877,
29889,
12523,
1053,
853,
1990,
28677,
3399,
2392,
13,
13,
13,
13356,
2891,
29923,
29918,
11282,
353,
18793,
29915,
13,
29923,
3580,
15631,
353,
938,
29898,
29900,
29897,
13,
13967,
1001,
2965,
29918,
15032,
5005,
3059,
353,
24972,
8476,
29918,
15032,
5005,
3059,
29889,
21574,
13,
13,
13,
1753,
10365,
29918,
29878,
431,
29898,
2176,
29892,
28730,
29922,
13967,
1001,
2965,
29918,
15032,
5005,
3059,
1125,
13,
1678,
4206,
353,
313,
2176,
29889,
5441,
1275,
376,
29941,
29947,
29945,
1159,
13,
1678,
4489,
29889,
2029,
29961,
5727,
29892,
28730,
29962,
353,
4489,
29889,
2029,
29961,
5727,
29892,
28730,
1822,
18056,
368,
29898,
29896,
29900,
29900,
29900,
29897,
13,
1678,
4489,
29889,
2029,
29961,
5727,
29892,
376,
5441,
3108,
353,
376,
29941,
29947,
29946,
29908,
13,
1678,
4206,
353,
313,
2176,
29889,
5441,
1275,
376,
29941,
29947,
29941,
1159,
13,
1678,
4489,
29889,
2029,
29961,
5727,
29892,
28730,
29962,
353,
4489,
29889,
2029,
29961,
5727,
29892,
28730,
1822,
4563,
680,
29898,
29896,
29900,
29900,
29900,
467,
14486,
29898,
29900,
467,
579,
668,
29898,
524,
29897,
13,
1678,
4489,
29889,
2029,
29961,
5727,
29892,
376,
5441,
3108,
353,
376,
29941,
29947,
29946,
29908,
13,
1678,
736,
4489,
13,
13,
13,
1753,
316,
1396,
29898,
978,
29901,
851,
1125,
13,
1678,
9995,
18772,
5001,
334,
978,
29930,
304,
24788,
322,
3611,
1213,
15945,
13,
1678,
396,
24412,
29901,
674,
451,
664,
1532,
373,
5001,
2983,
411,
901,
1135,
29871,
29946,
14978,
305,
1503,
13,
1678,
5633,
353,
1024,
29889,
5451,
29898,
13356,
2891,
29923,
29918,
11282,
29897,
13,
1678,
1638,
353,
5633,
29961,
29900,
1822,
17010,
580,
13,
1678,
274,
593,
353,
1024,
29889,
2798,
29898,
13356,
2891,
29923,
29918,
11282,
29897,
13,
1678,
565,
274,
593,
1275,
29871,
29906,
29901,
13,
4706,
3611,
353,
5633,
29961,
29896,
1822,
17010,
580,
13,
1678,
25342,
274,
593,
1405,
29871,
29906,
29901,
13,
4706,
3611,
353,
660,
29965,
2891,
29923,
29918,
11282,
29889,
7122,
29898,
20895,
29961,
29896,
29901,
2314,
13,
1678,
1683,
29901,
13,
4706,
3611,
353,
1024,
13,
1678,
736,
1638,
29892,
3611,
29889,
17010,
580,
13,
13,
13,
1753,
5191,
29918,
7039,
29898,
3257,
29901,
851,
1125,
13,
1678,
736,
3611,
869,
6506,
29898,
13,
4706,
376,
30013,
30053,
30031,
30050,
30054,
30076,
30029,
30038,
30070,
1291,
30014,
30092,
30054,
30038,
30029,
30070,
30027,
30029,
30038,
30070,
1651,
30031,
30186,
30070,
30008,
30041,
30012,
30038,
613,
13,
4706,
376,
30013,
30018,
30038,
1159,
869,
6506,
29898,
13,
4706,
376,
30038,
30041,
30014,
30027,
30570,
30041,
30038,
30070,
1291,
30014,
30092,
30054,
30038,
30029,
30070,
30027,
30029,
30038,
30070,
1651,
30031,
30186,
30070,
30008,
30041,
30012,
30038,
613,
13,
4706,
376,
30038,
30018,
30038,
1159,
869,
6506,
29898,
13,
9651,
376,
30018,
30014,
30092,
30054,
30038,
30029,
30070,
30027,
30029,
30038,
30070,
1651,
30031,
30186,
30070,
30008,
30041,
30012,
30038,
4767,
30029,
30070,
30027,
30040,
30070,
30041,
30054,
30014,
30054,
2081,
4767,
30050,
30070,
30014,
30041,
30027,
30054,
30061,
30054,
30014,
30018,
30092,
30054,
30054,
613,
13,
9651,
376,
29909,
29949,
2352,
17466,
588,
1159,
869,
6506,
29898,
13,
18884,
376,
30029,
30070,
30061,
30041,
30070,
30013,
30070,
30027,
30070,
30027,
30018,
30031,
30018,
30041,
30570,
30012,
30018,
30101,
30186,
30054,
30134,
2419,
30018,
30012,
30038,
30032,
613,
13,
18884,
376,
30029,
30013,
30060,
1159,
869,
6506,
29898,
13,
462,
1678,
376,
30040,
30070,
30029,
30070,
30027,
30054,
30027,
30053,
30101,
30186,
30018,
30096,
1069,
30038,
30017,
30013,
27875,
30054,
30096,
1651,
30013,
30041,
30038,
30012,
30038,
30040,
30038,
1483,
30570,
30029,
30014,
30018,
4767,
30050,
30070,
30014,
30041,
30027,
30038,
30082,
30029,
30070,
30027,
30040,
30054,
30054,
613,
13,
462,
1678,
376,
30038,
30040,
30014,
1159,
869,
6506,
29898,
13,
462,
4706,
376,
30040,
30038,
30027,
30029,
30038,
29899,
30038,
30031,
30038,
30040,
30018,
30041,
30054,
30041,
30070,
30050,
30523,
30029,
30570,
30134,
1069,
30038,
30017,
30031,
30054,
30029,
30018,
30041,
613,
13,
4706,
376,
30040,
30038,
30014,
1159,
13,
13,
13,
1753,
788,
29918,
3257,
29898,
2176,
1125,
13,
1678,
269,
29918,
353,
4489,
29889,
978,
29889,
7302,
29898,
311,
1396,
29897,
13,
1678,
4489,
1839,
990,
2033,
353,
269,
5396,
7302,
29898,
2892,
921,
29901,
921,
29961,
29900,
2314,
13,
1678,
4489,
1839,
3257,
2033,
353,
269,
5396,
7302,
29898,
2892,
921,
29901,
5191,
29918,
7039,
29898,
29916,
29961,
29896,
12622,
13,
1678,
736,
4489,
13,
13,
13,
1753,
19508,
29918,
5727,
29898,
2176,
1125,
13,
1678,
390,
1430,
25797,
29918,
4571,
1783,
353,
426,
13,
4706,
525,
29906,
29946,
29953,
29900,
29900,
29953,
29953,
29896,
29929,
29945,
2396,
376,
30027,
22375,
30040,
29917,
26166,
613,
13,
4706,
525,
29946,
29955,
29896,
29953,
29900,
29896,
29953,
29929,
29955,
29929,
2396,
376,
30061,
30008,
30014,
3337,
30082,
30008,
613,
13,
4706,
525,
29955,
29955,
29900,
29906,
29900,
29941,
29947,
29896,
29945,
29900,
2396,
376,
30017,
3264,
2530,
2542,
17194,
576,
22929,
12087,
613,
13,
4706,
525,
29955,
29955,
29906,
29896,
29953,
29941,
29906,
29947,
29906,
29955,
2396,
376,
30014,
2031,
17267,
29921,
6412,
30051,
17466,
588,
29910,
4816,
613,
13,
4706,
525,
29955,
29955,
29900,
29953,
29953,
29953,
29946,
29906,
29953,
29900,
2396,
376,
30018,
4816,
30051,
17466,
588,
29964,
4416,
613,
13,
4706,
525,
29955,
29955,
29900,
29941,
29953,
29947,
29941,
29896,
29946,
29945,
2396,
376,
30068,
29904,
29944,
6395,
29969,
939,
30041,
30031,
3397,
1668,
9829,
1291,
30134,
1386,
30054,
613,
13,
4706,
525,
29929,
29896,
29900,
29906,
29900,
29946,
29947,
29947,
29900,
29896,
2396,
376,
30076,
780,
2815,
1419,
821,
30011,
730,
1779,
29972,
613,
13,
4706,
525,
29955,
29955,
29941,
29953,
29900,
29941,
29953,
29953,
29906,
29953,
2396,
376,
30027,
30054,
30041,
30082,
30014,
29908,
13,
1678,
500,
13,
1678,
6611,
353,
390,
1430,
25797,
29918,
4571,
1783,
29889,
8149,
580,
13,
1678,
474,
29916,
353,
4489,
29889,
2248,
29889,
275,
262,
29898,
8149,
29897,
13,
1678,
565,
451,
474,
29916,
29889,
1384,
7295,
13,
4706,
736,
4489,
13,
1678,
1014,
353,
4489,
29889,
2029,
29961,
861,
29892,
525,
3257,
2033,
13,
1678,
363,
413,
29892,
325,
297,
390,
1430,
25797,
29918,
4571,
1783,
29889,
7076,
7295,
13,
4706,
565,
413,
297,
1014,
29889,
2248,
29901,
13,
9651,
1014,
29889,
2029,
29961,
29895,
29962,
353,
325,
13,
1678,
4489,
29889,
2029,
29961,
861,
29892,
525,
3257,
2033,
353,
1014,
13,
1678,
736,
4489,
13,
13,
13,
1753,
6219,
29918,
554,
1490,
29898,
401,
29918,
1807,
29901,
851,
1125,
13,
1678,
9995,
2577,
29871,
29941,
11174,
310,
9280,
29963,
3352,
11561,
515,
334,
401,
29918,
1807,
29930,
1213,
15945,
13,
1678,
565,
775,
29918,
1807,
29889,
2798,
17350,
1159,
1405,
29871,
29906,
29901,
13,
4706,
12020,
853,
1990,
28677,
3399,
2392,
29898,
401,
29918,
1807,
29897,
13,
1678,
1018,
29901,
13,
4706,
11561,
353,
518,
524,
29898,
29916,
29897,
363,
921,
297,
775,
29918,
1807,
29889,
5451,
17350,
13531,
13,
1678,
5174,
7865,
2392,
29901,
13,
4706,
12020,
853,
1990,
28677,
3399,
2392,
29898,
401,
29918,
1807,
29897,
13,
1678,
736,
11561,
718,
518,
29900,
29962,
334,
313,
29941,
448,
7431,
29898,
18137,
876,
13,
13,
13,
1753,
788,
29918,
554,
1490,
29918,
1491,
401,
29898,
2176,
1125,
13,
1678,
4489,
1839,
554,
29896,
7464,
4489,
1839,
554,
29906,
7464,
4489,
1839,
554,
29941,
2033,
353,
14319,
10456,
2176,
29889,
554,
1490,
29889,
7302,
29898,
5451,
29918,
554,
1490,
876,
13,
1678,
736,
4489,
13,
13,
13,
1753,
285,
303,
29898,
29916,
1125,
13,
1678,
1018,
29901,
13,
4706,
736,
938,
29898,
29916,
29961,
29900,
29901,
29906,
2314,
13,
1678,
5174,
20948,
29901,
13,
4706,
736,
29871,
29900,
13,
13,
13,
1753,
788,
29918,
12803,
29898,
2176,
1125,
13,
1678,
4489,
1839,
12803,
2033,
353,
4489,
29889,
2559,
29889,
7302,
29898,
29888,
303,
29897,
13,
1678,
736,
4489,
13,
13,
13,
1753,
901,
29918,
13099,
29898,
2176,
1125,
13,
1678,
736,
788,
29918,
554,
1490,
29918,
1491,
401,
29898,
1202,
29918,
12803,
29898,
1202,
29918,
3257,
29898,
2176,
4961,
13,
13,
13,
1753,
508,
8927,
29918,
2176,
29898,
2176,
1125,
13,
1678,
9995,
30013,
587,
23944,
1263,
1413,
11650,
3029,
490,
29921,
21663,
3574,
676,
30011,
10786,
1155,
29901,
13,
13,
1678,
448,
7203,
1521,
1415,
6495,
2091,
576,
717,
1186,
614,
16489,
2530,
16970,
29082,
11519,
29959,
1866,
1488,
587,
1587,
313,
3327,
29935,
29889,
5368,
29975,
1846,
13,
1678,
448,
2014,
8355,
1413,
29871,
1538,
29917,
3565,
693,
3923,
3098,
11489,
20427,
29921,
717,
313,
1256,
29918,
276,
11292,
29892,
3461,
29918,
1853,
29897,
13,
1678,
448,
27527,
11489,
20427,
29921,
717,
29901,
13,
4706,
334,
10210,
29932,
551,
29919,
24143,
16944,
3849,
13,
4706,
334,
10357,
23155,
1200,
1046,
840,
1651,
30014,
30012,
30082,
30032,
13,
4706,
334,
16487,
2031,
313,
1268,
2081,
30029,
30029,
29897,
13,
13,
1678,
9995,
13,
1678,
4489,
29918,
353,
788,
29918,
554,
1490,
29918,
1491,
401,
29898,
1202,
29918,
12803,
29898,
1202,
29918,
3257,
29898,
2176,
4961,
13,
1678,
4489,
29918,
353,
10365,
29918,
29878,
431,
29898,
2176,
19925,
13,
1678,
4489,
29918,
353,
4489,
5396,
842,
29918,
2248,
877,
2559,
1495,
13,
1678,
4489,
29918,
353,
19508,
29918,
5727,
29898,
2176,
19925,
13,
1678,
736,
4489,
29918,
29961,
3068,
8927,
29918,
13099,
580,
29962,
13,
13,
13,
1753,
508,
8927,
29918,
13099,
29898,
21574,
29922,
7068,
8476,
29918,
15032,
5005,
3059,
29889,
21574,
1125,
13,
1678,
736,
313,
1839,
3257,
742,
525,
990,
742,
525,
554,
1129,
742,
525,
554,
15818,
742,
525,
554,
5847,
742,
525,
554,
1490,
2033,
718,
13,
9651,
6024,
5441,
2033,
718,
13,
9651,
6024,
554,
29896,
742,
525,
554,
29906,
742,
525,
554,
29941,
742,
525,
12803,
2033,
718,
13,
9651,
16985,
29897,
13,
13,
13,
1753,
338,
29918,
21574,
29918,
4914,
29898,
978,
29892,
16985,
29922,
7068,
8476,
29918,
15032,
5005,
3059,
29889,
21574,
1125,
13,
1678,
736,
1024,
297,
16985,
13,
13,
13,
1753,
4341,
29918,
1017,
9795,
29918,
294,
29918,
16031,
29898,
21574,
29922,
7068,
8476,
29918,
15032,
5005,
3059,
29889,
21574,
1125,
13,
1678,
736,
16985,
718,
6024,
554,
29896,
742,
525,
554,
29906,
742,
525,
554,
29941,
742,
525,
12803,
2033,
13,
13,
13,
1753,
508,
8927,
29918,
29881,
8768,
7295,
13,
1678,
822,
4607,
29898,
1054,
1125,
13,
4706,
938,
29918,
13099,
353,
4341,
29918,
1017,
9795,
29918,
294,
29918,
16031,
580,
13,
4706,
736,
12655,
29889,
524,
29953,
29946,
565,
313,
1054,
297,
938,
29918,
13099,
29897,
1683,
851,
13,
1678,
1121,
353,
426,
1054,
29901,
4607,
29898,
1054,
29897,
363,
784,
297,
508,
8927,
29918,
13099,
28296,
13,
1678,
1121,
1839,
2559,
2033,
353,
851,
13,
1678,
736,
1121,
13,
2
] |
src/obmak_debug.py | jeppeter/py-obcode | 0 | 44426 | #! /usr/bin/env python
import sys
import os
import extargsparse
import re
import time
##importdebugstart
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from strparser import *
from filehdl import *
from fmthdl import *
from extract_ob import *
from obmaklib import *
##importdebugend
REPLACE_IMPORT_LIB=1
REPLACE_STR_PARSER=1
REPLACE_FILE_HDL=1
REPLACE_FMT_HDL=1
REPLACE_EXTRACT_OB=1
REPLACE_OBMAK_LIB=1
def main():
commandline='''
{
"verbose|v" : "+",
"version|V" : false,
"dump|D" : "obcode.json",
"benchmark|B" : false,
"makob<makob_handler>##srcfile to give the other code file ,this need environment variable MAKOB_FILE to get the default (makob.json)##" : {
"namemin" : 5,
"namemax" : 20,
"$" : "+"
},
"unmakob<unmakob_handler>##dstfile to give the origin ,this need environment variable MAKOB_FILE to get the default (makob.json)##" : {
"short" : false,
"$" : "+"
},
"basename<basename_handler>##to make basename##" : {
"$" : "+"
},
"obtrans<obtrans_handler>##translate the srcdir to dstdir in makob file##" : {
"srcdir" : "",
"dstdir" : "",
"$" : "+"
},
"oblist<oblist_handler>##to list files ob files##" : {
"$" : "*"
},
"obuntrans<obuntrans_handler>##inputfile [outputfile] to trans file from MAKOB_FILE##" : {
"$" : "+"
},
"obunfunc<obunfunc_handler>##inputfile;outfile;funcs... to set obfuncs##" : {
"$" : "+"
}
}
'''
d = dict()
d['version'] = "VERSION_RELACE_STRING"
options = extargsparse.ExtArgsOptions(d)
stime = time.time()
parser = extargsparse.ExtArgsParse(options)
parser.load_command_line_string(commandline)
args = parser.parse_command_line(None,parser)
if args.version:
sys.stdout.write('%s\n'%(options.version))
sys.exit(0)
if args.benchmark:
etime = time.time()
sys.stderr.write('run %s time %s second\n'%(sys.argv[1:],etime - stime))
return
##importdebugstart
from obrelease import *
import re
def debug_release():
if '-v' in sys.argv[1:]:
#sys.stderr.write('will make verbose\n')
loglvl = logging.DEBUG
if logging.root is not None and len(logging.root.handlers) > 0:
logging.root.handlers = []
logging.basicConfig(level=loglvl,format='%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d\t%(message)s')
topdir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
tofile= os.path.abspath(os.path.join(topdir,'obmak.py'))
curdir = os.path.abspath(os.path.dirname(__file__))
rlfiles = ReleaseFiles(__file__)
rlfiles.add_python_file(os.path.abspath(os.path.join(curdir,'strparser.py')),r'REPLACE_STR_PARSER=1')
rlfiles.add_python_file(os.path.abspath(os.path.join(curdir,'fmthdl.py')),r'REPLACE_FMT_HDL=1')
rlfiles.add_python_file(os.path.abspath(os.path.join(curdir,'filehdl.py')),r'REPLACE_FILE_HDL=1')
rlfiles.add_python_file(os.path.abspath(os.path.join(curdir,'obmaklib.py')),r'REPLACE_OBMAK_LIB=1')
rlfiles.add_python_file(os.path.abspath(os.path.join(curdir,'extract_ob.py')),r'REPLACE_EXTRACT_OB=1')
if len(sys.argv) > 2:
for k in sys.argv[1:]:
if not k.startswith('-'):
tofile = k
break
versionfile = os.path.abspath(os.path.join(topdir,'VERSION'))
if not os.path.exists(versionfile):
raise Exception('can not find VERSION file')
with open(versionfile,'r') as f:
for l in f:
l = l.rstrip('\r\n')
vernum = l
break
#logging.info('str_c\n%s'%(strparser_c))
sarr = re.split('\.',vernum)
if len(sarr) != 3:
raise Exception('version (%s) not format x.x.x'%(vernum))
VERSIONNUMBER = vernum
import_rets = fromat_ext_import_files(__file__,rlfiles.get_includes())
logging.info('import_rets\n%s'%(import_rets))
rlfiles.add_repls(r'VERSION_RELACE_STRING',VERSIONNUMBER)
rlfiles.add_repls(r'debug_main','main')
rlfiles.add_repls(r'REPLACE_IMPORT_LIB=1',make_string_slash_ok(import_rets))
#logging.info('repls %s'%(repls.keys()))
disttools.release_file('__main__',tofile,[],[[r'##importdebugstart.*',r'##importdebugend.*']],[],rlfiles.get_repls())
return
def debug_main():
if '--release' in sys.argv[1:]:
debug_release()
return
main()
return
##importdebugend
if __name__ == '__main__':
debug_main()
| [
1,
396,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
1294,
5085,
5510,
13,
5215,
337,
13,
5215,
931,
13,
13,
2277,
5215,
8382,
2962,
13,
9675,
29889,
2084,
29889,
4397,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
4961,
13,
3166,
851,
16680,
1053,
334,
13,
3166,
934,
29882,
11671,
1053,
334,
13,
3166,
285,
29885,
386,
11671,
1053,
334,
13,
3166,
6597,
29918,
711,
1053,
334,
13,
3166,
704,
29885,
557,
1982,
1053,
334,
13,
2277,
5215,
8382,
355,
13,
13,
1525,
7390,
11538,
29918,
29902,
3580,
8476,
29918,
5265,
29933,
29922,
29896,
13,
13,
1525,
7390,
11538,
29918,
10810,
29918,
16320,
6304,
29922,
29896,
13,
1525,
7390,
11538,
29918,
7724,
29918,
29950,
19558,
29922,
29896,
13,
1525,
7390,
11538,
29918,
29943,
11490,
29918,
29950,
19558,
29922,
29896,
13,
1525,
7390,
11538,
29918,
12194,
4717,
1783,
29918,
14824,
29922,
29896,
13,
1525,
7390,
11538,
29918,
14824,
1529,
29968,
29918,
5265,
29933,
29922,
29896,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1899,
1220,
2433,
4907,
13,
1678,
426,
13,
4706,
376,
369,
15828,
29989,
29894,
29908,
584,
15691,
613,
13,
4706,
376,
3259,
29989,
29963,
29908,
584,
2089,
29892,
13,
4706,
376,
15070,
29989,
29928,
29908,
584,
376,
711,
401,
29889,
3126,
613,
13,
4706,
376,
1785,
16580,
29989,
29933,
29908,
584,
2089,
29892,
13,
4706,
376,
29885,
557,
711,
29966,
29885,
557,
711,
29918,
13789,
29958,
2277,
4351,
1445,
304,
2367,
278,
916,
775,
934,
1919,
1366,
817,
5177,
2286,
14861,
29968,
14824,
29918,
7724,
304,
679,
278,
2322,
313,
29885,
557,
711,
29889,
3126,
29897,
2277,
29908,
584,
426,
13,
9651,
376,
8588,
331,
262,
29908,
584,
29871,
29945,
29892,
13,
9651,
376,
8588,
331,
1165,
29908,
584,
29871,
29906,
29900,
29892,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
2981,
13,
4706,
376,
348,
29885,
557,
711,
29966,
348,
29885,
557,
711,
29918,
13789,
29958,
2277,
22992,
1445,
304,
2367,
278,
3978,
1919,
1366,
817,
5177,
2286,
14861,
29968,
14824,
29918,
7724,
304,
679,
278,
2322,
313,
29885,
557,
711,
29889,
3126,
29897,
2277,
29908,
584,
426,
13,
9651,
376,
12759,
29908,
584,
2089,
29892,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
2981,
13,
4706,
376,
6500,
3871,
29966,
6500,
3871,
29918,
13789,
29958,
2277,
517,
1207,
2362,
3871,
2277,
29908,
584,
426,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
2981,
13,
4706,
376,
711,
3286,
29966,
711,
3286,
29918,
13789,
29958,
2277,
21652,
278,
4765,
3972,
304,
29743,
3972,
297,
2136,
711,
934,
2277,
29908,
584,
426,
13,
9651,
376,
4351,
3972,
29908,
584,
12633,
13,
9651,
376,
22992,
3972,
29908,
584,
12633,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
2981,
13,
4706,
376,
711,
1761,
29966,
711,
1761,
29918,
13789,
29958,
2277,
517,
1051,
2066,
704,
2066,
2277,
29908,
584,
426,
13,
9651,
3908,
29908,
584,
376,
20605,
13,
4706,
2981,
13,
4706,
376,
711,
348,
3286,
29966,
711,
348,
3286,
29918,
13789,
29958,
2277,
2080,
1445,
518,
4905,
1445,
29962,
304,
1301,
934,
515,
14861,
29968,
14824,
29918,
7724,
2277,
29908,
584,
426,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
2981,
13,
4706,
376,
711,
348,
9891,
29966,
711,
348,
9891,
29918,
13789,
29958,
2277,
2080,
1445,
29936,
449,
1445,
29936,
7692,
2395,
856,
29871,
304,
731,
704,
7692,
2395,
2277,
29908,
584,
426,
13,
9651,
3908,
29908,
584,
376,
13578,
13,
4706,
500,
13,
1678,
500,
13,
1678,
14550,
13,
1678,
270,
353,
9657,
580,
13,
1678,
270,
1839,
3259,
2033,
353,
376,
16358,
29918,
1525,
29931,
11538,
29918,
20785,
29908,
13,
1678,
3987,
353,
1294,
5085,
5510,
29889,
5647,
7883,
5856,
29898,
29881,
29897,
13,
1678,
380,
603,
353,
931,
29889,
2230,
580,
13,
1678,
13812,
353,
1294,
5085,
5510,
29889,
5647,
7883,
12914,
29898,
6768,
29897,
13,
1678,
13812,
29889,
1359,
29918,
6519,
29918,
1220,
29918,
1807,
29898,
6519,
1220,
29897,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
6519,
29918,
1220,
29898,
8516,
29892,
16680,
29897,
13,
1678,
565,
6389,
29889,
3259,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
877,
29995,
29879,
29905,
29876,
29915,
29995,
29898,
6768,
29889,
3259,
876,
13,
4706,
10876,
29889,
13322,
29898,
29900,
29897,
13,
1678,
565,
6389,
29889,
1785,
16580,
29901,
13,
4706,
634,
603,
353,
931,
29889,
2230,
580,
13,
4706,
10876,
29889,
303,
20405,
29889,
3539,
877,
3389,
1273,
29879,
931,
1273,
29879,
1473,
29905,
29876,
29915,
29995,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
1402,
5410,
448,
380,
603,
876,
13,
1678,
736,
13,
13,
2277,
5215,
8382,
2962,
13,
3166,
704,
14096,
1053,
334,
13,
5215,
337,
13,
13,
1753,
4744,
29918,
14096,
7295,
13,
1678,
565,
17411,
29894,
29915,
297,
10876,
29889,
19218,
29961,
29896,
29901,
5387,
13,
4706,
396,
9675,
29889,
303,
20405,
29889,
3539,
877,
14043,
1207,
26952,
29905,
29876,
1495,
13,
4706,
1480,
29880,
20901,
353,
29871,
12183,
29889,
18525,
13,
4706,
565,
12183,
29889,
4632,
338,
451,
6213,
322,
7431,
29898,
21027,
29889,
4632,
29889,
3179,
9306,
29897,
1405,
29871,
29900,
29901,
13,
9651,
12183,
29889,
4632,
29889,
3179,
9306,
353,
5159,
13,
4706,
12183,
29889,
16121,
3991,
29898,
5563,
29922,
1188,
29880,
20901,
29892,
4830,
2433,
29995,
29898,
294,
312,
603,
29897,
29879,
16664,
29898,
9507,
29897,
29879,
16664,
29898,
9891,
1170,
29897,
29879,
16664,
29898,
1915,
8154,
29897,
29881,
29905,
29873,
29995,
29898,
4906,
29897,
29879,
1495,
13,
1678,
2246,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
29915,
636,
8785,
13,
1678,
304,
1445,
29922,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3332,
3972,
5501,
711,
29885,
557,
29889,
2272,
8785,
13,
1678,
3151,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
876,
13,
1678,
364,
29880,
5325,
353,
23708,
10547,
22168,
1445,
1649,
29897,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
4691,
29918,
1445,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2764,
3972,
5501,
710,
16680,
29889,
2272,
1495,
511,
29878,
29915,
1525,
7390,
11538,
29918,
10810,
29918,
16320,
6304,
29922,
29896,
1495,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
4691,
29918,
1445,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2764,
3972,
5501,
24826,
386,
11671,
29889,
2272,
1495,
511,
29878,
29915,
1525,
7390,
11538,
29918,
29943,
11490,
29918,
29950,
19558,
29922,
29896,
1495,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
4691,
29918,
1445,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2764,
3972,
5501,
1445,
29882,
11671,
29889,
2272,
1495,
511,
29878,
29915,
1525,
7390,
11538,
29918,
7724,
29918,
29950,
19558,
29922,
29896,
1495,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
4691,
29918,
1445,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2764,
3972,
5501,
711,
29885,
557,
1982,
29889,
2272,
1495,
511,
29878,
29915,
1525,
7390,
11538,
29918,
14824,
1529,
29968,
29918,
5265,
29933,
29922,
29896,
1495,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
4691,
29918,
1445,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2764,
3972,
5501,
21111,
29918,
711,
29889,
2272,
1495,
511,
29878,
29915,
1525,
7390,
11538,
29918,
12194,
4717,
1783,
29918,
14824,
29922,
29896,
1495,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29906,
29901,
13,
4706,
363,
413,
297,
10876,
29889,
19218,
29961,
29896,
29901,
5387,
13,
9651,
565,
451,
413,
29889,
27382,
2541,
877,
29899,
29374,
13,
18884,
304,
1445,
353,
413,
13,
18884,
2867,
13,
1678,
1873,
1445,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3332,
3972,
5501,
16358,
8785,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3259,
1445,
1125,
13,
4706,
12020,
8960,
877,
3068,
451,
1284,
478,
1001,
13381,
934,
1495,
13,
1678,
411,
1722,
29898,
3259,
1445,
5501,
29878,
1495,
408,
285,
29901,
13,
4706,
363,
301,
297,
285,
29901,
13,
9651,
301,
353,
301,
29889,
29878,
17010,
28909,
29878,
29905,
29876,
1495,
13,
9651,
24604,
398,
353,
301,
13,
9651,
2867,
13,
1678,
396,
21027,
29889,
3888,
877,
710,
29918,
29883,
29905,
29876,
29995,
29879,
29915,
29995,
29898,
710,
16680,
29918,
29883,
876,
13,
1678,
269,
2749,
353,
337,
29889,
5451,
877,
23301,
742,
369,
1949,
29897,
13,
1678,
565,
7431,
29898,
29879,
2749,
29897,
2804,
29871,
29941,
29901,
13,
4706,
12020,
8960,
877,
3259,
313,
29995,
29879,
29897,
451,
3402,
921,
29889,
29916,
29889,
29916,
29915,
29995,
29898,
369,
1949,
876,
13,
1678,
478,
1001,
13381,
23207,
353,
24604,
398,
13,
1678,
1053,
29918,
27487,
353,
515,
271,
29918,
1062,
29918,
5215,
29918,
5325,
22168,
1445,
1649,
29892,
2096,
5325,
29889,
657,
29918,
24572,
3101,
13,
1678,
12183,
29889,
3888,
877,
5215,
29918,
27487,
29905,
29876,
29995,
29879,
29915,
29995,
29898,
5215,
29918,
27487,
876,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
276,
572,
29879,
29898,
29878,
29915,
16358,
29918,
1525,
29931,
11538,
29918,
20785,
742,
16358,
23207,
29897,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
276,
572,
29879,
29898,
29878,
29915,
8382,
29918,
3396,
3788,
3396,
1495,
13,
1678,
364,
29880,
5325,
29889,
1202,
29918,
276,
572,
29879,
29898,
29878,
29915,
1525,
7390,
11538,
29918,
29902,
3580,
8476,
29918,
5265,
29933,
29922,
29896,
742,
5675,
29918,
1807,
29918,
17057,
29918,
554,
29898,
5215,
29918,
27487,
876,
13,
1678,
396,
21027,
29889,
3888,
877,
276,
572,
29879,
1273,
29879,
29915,
29995,
29898,
276,
572,
29879,
29889,
8149,
22130,
13,
1678,
1320,
8504,
29889,
14096,
29918,
1445,
877,
1649,
3396,
1649,
742,
517,
1445,
17094,
1402,
8999,
29878,
29915,
2277,
5215,
8382,
2962,
5575,
742,
29878,
29915,
2277,
5215,
8382,
355,
5575,
2033,
16272,
1402,
2096,
5325,
29889,
657,
29918,
276,
572,
29879,
3101,
13,
1678,
736,
13,
13,
1753,
4744,
29918,
3396,
7295,
13,
1678,
565,
525,
489,
14096,
29915,
297,
10876,
29889,
19218,
29961,
29896,
29901,
5387,
13,
4706,
4744,
29918,
14096,
580,
13,
4706,
736,
13,
1678,
1667,
580,
13,
1678,
736,
13,
13,
2277,
5215,
8382,
355,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4744,
29918,
3396,
580,
13,
2
] |
snmn/nmn.py | jiangycTarheel/NMN-MultiHopQA | 20 | 86347 | <filename>snmn/nmn.py<gh_stars>10-100
import numpy as np
import tensorflow as tf
from tensorflow import convert_to_tensor as to_T, newaxis as ax
from tensorflow.python.ops import tensor_array_ops, control_flow_ops
from my.tensorflow.ops import bi_cudnn_rnn_encoder
from snmn.config import cfg
from snmn.util.cnn import fc_layer as fc, conv_layer as conv
from basic.attention_modules import weighted_biattention
from my.tensorflow.nn import dense
from my.tensorflow.nn import linear_logits
MODULE_INPUT_NUM = {
'_NoOp': 2,
'_Find': 0,
'_Relocate': 1,
'_Compare': 2,
}
MODULE_OUTPUT_NUM = {
'_NoOp': 2,
'_Find': 1,
'_Relocate': 1,
'_Compare': 1,
}
class NMN:
def __init__(self, config, kb_batch, kb_mask_batch, kb_len_batch, c_list,
cv_list, q, q_mask, module_names, module_prob_list, is_train,
q_len, max_para_size=None, scope='NMN', reuse=None):
"""
NMN v4 with an attention stack
"""
with tf.variable_scope(scope, reuse=reuse):
self.is_train = is_train
self.main_config = config
self.kb_batch = kb_batch
self.kb_mask_batch = kb_mask_batch
self.kb_len_batch = kb_len_batch
self.c_list = c_list
self.cv_list = cv_list
self.q = q
self.q_len = q_len
self.q_mask = q_mask
self.module_prob_list = module_prob_list
self.kb_dim = cfg.MODEL.KB_DIM
if self.main_config.nmn_relocate_move_ptr:
MODULE_OUTPUT_NUM['_Relocate'] = MODULE_INPUT_NUM['_Relocate'] + 1
else:
MODULE_OUTPUT_NUM['_Relocate'] = MODULE_INPUT_NUM['_Relocate']
self.T_ctrl = cfg.MODEL.T_CTRL
self.mem_dim = cfg.MODEL.NMN.MEM_DIM
self.N = tf.shape(kb_batch)[0]
self.M = tf.shape(kb_batch)[1]
self.JX = tf.shape(kb_batch)[2]
self.att_shape = to_T([self.N, self.M, self.JX, 1])
self.max_para_size = max_para_size
self.stack_len = cfg.MODEL.NMN.STACK.LENGTH
# The initialial stack values are all zeros everywhere
self.att_stack_init = tf.zeros(
to_T([self.N, self.M, self.JX, self.kb_dim, self.stack_len]))
# The initial stack pointer points to the stack bottom
self.stack_ptr_init = tf.one_hot(
tf.zeros(to_T([self.N]), tf.int32), self.stack_len)
self.mem_init = tf.zeros(to_T([self.N, self.mem_dim]))
# zero-outputs that can be easily used by the modules
self.att_zero = tf.zeros(self.att_shape, tf.float32)
if config.nmn_mem_init == 'zero':
self.mem_zero = tf.zeros(to_T([self.N, self.mem_dim]), tf.float32)
elif config.nmn_mem_init == 'random':
self.mem_zero = tf.random.uniform(to_T([self.N, self.mem_dim]), minval=-100, maxval=100, dtype=tf.float32)
else:
raise NotImplementedError
self.score_zero = tf.zeros(to_T([self.N, 1]), tf.float32)
# the set of modules and functions (e.g. "_Find" -> Find)
self.module_names = module_names
self.module_funcs = [getattr(self, m[1:]) for m in module_names]
self.num_module = len(module_names)
self.module_validity_mat = _build_module_validity_mat(module_names)
# unroll the modules with a fixed number of timestep T_ctrl
self.att_list = []
self.att_stack_list = []
self.stack_ptr_list = []
self.mem_list = []
self.score_list = []
self.att_in_1, self.att_in_2 = None, None
att_stack_prev = self.att_stack_init
stack_ptr_prev = self.stack_ptr_init
mem_prev = self.mem_init
self.module_validity = []
for t in range(self.T_ctrl):
c_i = self.c_list[t]
cv_i = self.cv_list[t]
module_prob = self.module_prob_list[t]
# only keep the prob of valid modules (i.e. those won't cause
# stack underflow or overflow. e.g. _Filter can't be run at
# t = 0 since the stack is empty).
if cfg.MODEL.NMN.VALIDATE_MODULES:
module_validity = tf.matmul(
stack_ptr_prev, self.module_validity_mat)
if cfg.MODEL.NMN.HARD_MODULE_VALIDATION:
module_validity = tf.round(module_validity)
self.module_validity.append(module_validity)
module_prob *= module_validity
module_prob /= tf.reduce_sum(
module_prob, axis=1, keepdims=True)
self.module_prob_list[t] = module_prob
# run all the modules, and average their results wrt module_w
res = [f(att_stack_prev, stack_ptr_prev, mem_prev, c_i, cv_i,
t, reuse=(t > 0)) for f in self.module_funcs]
att_stack_avg = tf.reduce_sum(
module_prob[:, ax, ax, ax, ax, :] *
tf.stack([r[0] for r in res], axis=-1), axis=-1)
stack_ptr_avg = _sharpen_ptr(tf.reduce_sum(
module_prob[:, ax, :] *
tf.stack([r[1] for r in res], axis=2), axis=-1))
mem_avg = tf.reduce_sum(
module_prob[:, ax, :] *
tf.stack([r[2] for r in res], axis=2), axis=-1)
score_avg = tf.reduce_sum(
module_prob[:, ax, :] *
tf.stack([r[3] for r in res], axis=2), axis=-1)
self.att_list.append(_read_from_stack(att_stack_avg, stack_ptr_avg))
self.att_stack_list.append(att_stack_avg)
self.stack_ptr_list.append(stack_ptr_avg)
self.mem_list.append(mem_avg)
self.score_list.append(score_avg)
att_stack_prev = att_stack_avg
stack_ptr_prev = stack_ptr_avg
mem_prev = mem_avg
self.att_last = self.att_list[-1]
self.att_first = self.att_list[0]
self.att_second = self.att_list[1]
self.mem_last = self.mem_list[-1]
self.score_last = self.score_list[-1]
def NoOp(self, att_stack, stack_ptr, mem_in, c_i, cv_i, t, scope='NoOp', reuse=None):
"""
Does nothing. It leaves the stack pointer, the stack and mem vector
as-is.
"""
return att_stack, stack_ptr, mem_in, self.score_zero
def Find(self, att_stack, stack_ptr, mem_in, c_i, cv_i, t, scope='Find', reuse=None):
"""
Performs localization, and updates memory vector.
"""
with tf.variable_scope(scope, reuse=reuse):
# Get attention
# 1) linearly map the controller vectors to the KB dimension
# 2) elementwise product with KB
# 3) 1x1 convolution to get attention logits
c_mapped = fc('fc_c_mapped', c_i, output_dim=cfg.MODEL.KB_DIM, \
is_train=self.is_train, dropout=self.main_config.nmn_dropout)
kb_batch = self.kb_batch
elt_prod = tf.nn.l2_normalize(
kb_batch * c_mapped[:, ax, ax, :], axis=-1)
att_out = self.apply_attention(elt_prod, cv_i, t)
# Push to stack
stack_ptr = _move_ptr_fw(stack_ptr)
att_stack = _write_to_stack(att_stack, stack_ptr, att_out)
# Find bridge entity
if t == 0 and (self.main_config.supervise_bridge_entity):
g1, _ = bi_cudnn_rnn_encoder('lstm', self.main_config.hidden_size, 1, 1-self.main_config.input_keep_prob, \
tf.squeeze(att_out, axis=1), tf.squeeze(self.kb_len_batch, axis=1), self.is_train)
g1 = g1[:, ax, :, :]
bridge_logits = linear_logits([g1, att_out], True, input_keep_prob=self.main_config.input_keep_prob, \
mask=self.kb_mask_batch, is_train=self.is_train, scope='logits_bridge')
self.bridge_logits = tf.squeeze(bridge_logits, axis=1)
bridge_attn = tf.nn.softmax(self.bridge_logits)
self.bridge_attn = bridge_attn
new_mem = tf.einsum('ijk,ij->ik', tf.squeeze(kb_batch, axis=1), bridge_attn)
if t == 0:
self.inferred_bridge = new_mem
return att_stack, stack_ptr, self.mem_zero, self.score_zero
def Compare(self, att_stack, stack_ptr, mem_in, c_i, cv_i, t, scope='Compare', reuse=None):
# Pop from stack
att_in_2 = tf.squeeze(_read_from_stack(att_stack, stack_ptr), axis=-1)
stack_ptr = _move_ptr_bw(stack_ptr)
att_in_1 = tf.squeeze(_read_from_stack(att_stack, stack_ptr), axis=-1)
#stack_ptr = _move_ptr_bw(stack_ptr)
stack_ptr = _move_ptr_fw(stack_ptr)
with tf.variable_scope(scope, reuse=reuse):
att_prob_in_1 = linear_logits([att_in_1], True, input_keep_prob=self.main_config.input_keep_prob, \
mask=self.kb_mask_batch, is_train=self.is_train)
att_prob_in_2 = linear_logits([att_in_2], True, input_keep_prob=self.main_config.input_keep_prob, \
mask=self.kb_mask_batch, is_train=self.is_train, reuse=True)
att_prob_in_1, att_prob_in_2 = tf.squeeze(att_prob_in_1, axis=1), tf.squeeze(att_prob_in_2, axis=1)
self.att_in_1 = att_prob_in_1
self.att_in_2 = att_prob_in_2
c_mapped = fc('fc_c_mapped', c_i, output_dim=cfg.MODEL.KB_DIM, is_train=self.is_train, dropout=self.main_config.nmn_dropout)
kb_att_in_1 = _extract_softmax_avg(self.kb_batch, att_prob_in_1[:, ax, :])
kb_att_in_2 = _extract_softmax_avg(self.kb_batch, att_prob_in_2[:, ax, :])
fc_in_1 = tf.concat([c_mapped, c_mapped * kb_att_in_1, c_mapped*kb_att_in_2, kb_att_in_1-kb_att_in_2], axis=1)
mem_out = tf.nn.tanh(fc('fc_mem_out_1', fc_in_1, output_dim=self.mem_dim, is_train=self.is_train, dropout=self.main_config.nmn_dropout))
return att_stack, stack_ptr, mem_out, self.score_zero
def Relocate(self, att_stack, stack_ptr, mem_in, c_i, cv_i, t, scope='Transform', reuse=None):
"""
Relocates the previous attention, and updates memory vector.
"""
kb_batch = self.kb_batch
with tf.variable_scope(scope, reuse=reuse):
c_mapped = fc('fc_c_mapped', c_i, output_dim=cfg.MODEL.KB_DIM, is_train=self.is_train, dropout=self.main_config.nmn_dropout)
# Get attention
# 1) linearly map the controller vectors to the KB dimension
# 2) extract attended features from the input attention
# 2) elementwise product with KB
# 3) 1x1 convolution to get attention logits
if t == 0:
elt_prod = tf.nn.l2_normalize(
kb_batch * c_mapped[:, ax, ax, :], axis=-1)
else:
elt_prod = tf.nn.l2_normalize(
kb_batch * c_mapped[:, ax, ax, :] *
self.inferred_bridge[:, ax, ax, :], axis=-1)
att_out = self.apply_attention(elt_prod, cv_i, t, module='relocate')
# Push to stack
if self.main_config.nmn_relocate_move_ptr:
stack_ptr = _move_ptr_fw(stack_ptr) # cancel-out above
att_stack = _write_to_stack(att_stack, stack_ptr, att_out)
return att_stack, stack_ptr, self.mem_zero, self.score_zero
def apply_attention(self, h, u_weights, t, module='find'):
if self.main_config.nmn_attention_type == 'conv':
out = _1x1conv('conv_att_out', h, output_dim=1)
logits = apply_mask(out, self.kb_mask_batch)
elif self.main_config.nmn_attention_type == 'biattn':
out = self.bi_attention(h, u_weights, t, module=module)
else:
raise NotImplementedError
return out
def bi_attention(self, h, u_weights, t, module='find'):
u_weights = tf.transpose(tf.squeeze(u_weights, axis=-1), perm=[1, 0])
q, q_mask = self.q, self.q_mask
p0, context_dim, weight_one = weighted_biattention(
h, q, self.kb_dim, h_mask=self.kb_mask_batch, u_mask=tf.cast(q_mask, 'bool'),
u_weights=u_weights, scope='biattn')
if module == 'find' and t == 1:
self.weight_one = weight_one
p0 = dense(p0, self.main_config.hidden_size*2, scope='biattn_dense')
return p0
def _move_ptr_fw(stack_ptr):
"""
Move the stack pointer forward (i.e. to push to stack).
"""
# Note: in TF, conv1d is implemented as auto-correlation (instead of
# mathmatical convolution), so no flipping of the filter.
filter_fw = to_T(np.array([1, 0, 0], np.float32).reshape((3, 1, 1)))
new_stack_ptr = tf.squeeze(
tf.nn.conv1d(stack_ptr[..., ax], filter_fw, 1, 'SAME'), axis=[2])
# when the stack pointer is already at the stack top, keep
# the pointer in the same location (otherwise the pointer will be all zero)
if cfg.MODEL.NMN.STACK.GUARD_STACK_PTR:
stack_len = cfg.MODEL.NMN.STACK.LENGTH
stack_top_mask = tf.one_hot(stack_len - 1, stack_len)
new_stack_ptr += stack_top_mask * stack_ptr
return new_stack_ptr
def _move_ptr_bw(stack_ptr):
"""
Move the stack pointer backward (i.e. to pop from stack).
"""
# Note: in TF, conv1d is implemented as auto-correlation (instead of
# mathmatical convolution), so no flipping of the filter.
filter_fw = to_T(np.array([0, 0, 1], np.float32).reshape((3, 1, 1)))
new_stack_ptr = tf.squeeze(
tf.nn.conv1d(stack_ptr[..., ax], filter_fw, 1, 'SAME'), axis=[2])
# when the stack pointer is already at the stack bottom, keep
# the pointer in the same location (otherwise the pointer will be all zero)
if cfg.MODEL.NMN.STACK.GUARD_STACK_PTR:
stack_len = cfg.MODEL.NMN.STACK.LENGTH
stack_bottom_mask = tf.one_hot(0, stack_len)
new_stack_ptr += stack_bottom_mask * stack_ptr
return new_stack_ptr
def _read_from_stack(att_stack, stack_ptr):
"""
Read the value at the given stack pointer.
"""
stack_ptr_expand = stack_ptr[:, ax, ax, ax, :]
# The stack pointer is a one-hot vector, so just do dot product
att = tf.reduce_sum(att_stack * stack_ptr_expand, axis=-1, keepdims=True)
return att
def _write_to_stack(att_stack, stack_ptr, att):
"""
Write value 'att' into the stack at the given stack pointer. Note that the
result needs to be assigned back to att_stack
"""
stack_ptr_expand = stack_ptr[:, ax, ax, ax, :]
att_stack = att[:, :, :, :, ax] * stack_ptr_expand + att_stack * (1 - stack_ptr_expand)
return att_stack
def _sharpen_ptr(stack_ptr):
"""
Sharpen the stack pointers into (nearly) one-hot vectors, using argmax
or softmax. The stack values should always sum up to one for each instance.
"""
hard = cfg.MODEL.NMN.STACK.USE_HARD_SHARPEN
if hard:
# hard (non-differentiable) sharpening with argmax
new_stack_ptr = tf.one_hot(
tf.argmax(stack_ptr, axis=1), tf.shape(stack_ptr)[1])
else:
# soft (differentiable) sharpening with softmax
temperature = cfg.MODEL.NMN.STACK.SOFT_SHARPEN_TEMP
new_stack_ptr = tf.nn.softmax(stack_ptr / temperature)
return new_stack_ptr
def _1x1conv(name, bottom, output_dim, reuse=None):
return conv(name, bottom, kernel_size=1, stride=1, output_dim=output_dim,
reuse=reuse)
def apply_mask(x, mask):
return x - 1e30 * (1. - tf.cast(mask[:, :, :, ax], 'float32'))
def _spatial_softmax(att_raw):
att_shape = tf.shape(att_raw)
N = att_shape[0]
att_softmax = tf.nn.softmax(tf.reshape(att_raw, to_T([N, -1])), axis=1)
att_softmax = tf.reshape(att_softmax, att_shape)
return att_softmax
def _extract_softmax_avg(kb_batch, att_raw):
att_softmax = _spatial_softmax(att_raw)[:, :, :, ax]
return tf.reduce_sum(kb_batch * att_softmax, axis=[1, 2])
def _build_module_validity_mat(module_names):
"""
Build a module validity matrix, ensuring that only valid modules will have
non-zero probabilities. A module is only valid to run if there are enough
attentions to be popped from the stack, and have space to push into
(e.g. _Find), so that stack will not underflow or overflow by design.
module_validity_mat is a stack_len x num_module matrix, and is used to
multiply with stack_ptr to get validity boolean vector for the modules.
"""
stack_len = cfg.MODEL.NMN.STACK.LENGTH
module_validity_mat = np.zeros((stack_len, len(module_names)), np.float32)
for n_m, m in enumerate(module_names):
# a module can be run only when stack ptr position satisfies
# (min_ptr_pos <= ptr <= max_ptr_pos), where max_ptr_pos is inclusive
# 1) minimum position:
# stack need to have MODULE_INPUT_NUM[m] things to pop from
min_ptr_pos = MODULE_INPUT_NUM[m]
# the stack ptr diff=(MODULE_OUTPUT_NUM[m] - MODULE_INPUT_NUM[m])
# ensure that ptr + diff <= stack_len - 1 (stack top)
max_ptr_pos = (
stack_len - 1 + MODULE_INPUT_NUM[m] - MODULE_OUTPUT_NUM[m])
module_validity_mat[min_ptr_pos:max_ptr_pos+1, n_m] = 1.
return to_T(module_validity_mat)
| [
1,
529,
9507,
29958,
16586,
23521,
29914,
22882,
29876,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
3166,
26110,
1053,
3588,
29918,
517,
29918,
20158,
408,
304,
29918,
29911,
29892,
716,
8990,
408,
4853,
13,
3166,
26110,
29889,
4691,
29889,
3554,
1053,
12489,
29918,
2378,
29918,
3554,
29892,
2761,
29918,
1731,
29918,
3554,
13,
3166,
590,
29889,
29056,
29889,
3554,
1053,
4768,
29918,
29883,
566,
15755,
29918,
29878,
15755,
29918,
3977,
6119,
13,
13,
3166,
5807,
23521,
29889,
2917,
1053,
274,
16434,
13,
3166,
5807,
23521,
29889,
4422,
29889,
29883,
15755,
1053,
285,
29883,
29918,
13148,
408,
285,
29883,
29892,
7602,
29918,
13148,
408,
7602,
13,
3166,
6996,
29889,
1131,
2509,
29918,
7576,
1053,
7688,
287,
29918,
5365,
1131,
2509,
13,
3166,
590,
29889,
29056,
29889,
15755,
1053,
20619,
13,
3166,
590,
29889,
29056,
29889,
15755,
1053,
5608,
29918,
1188,
1169,
13,
13,
13,
6720,
14849,
1307,
29918,
1177,
12336,
29918,
13967,
353,
426,
13,
29871,
22868,
3782,
11746,
2396,
29871,
29906,
29892,
13,
29871,
22868,
12542,
2396,
29871,
29900,
29892,
13,
29871,
22868,
9662,
542,
403,
2396,
29871,
29896,
29892,
13,
29871,
22868,
6843,
598,
2396,
29871,
29906,
29892,
13,
29913,
13,
13,
6720,
14849,
1307,
29918,
12015,
12336,
29918,
13967,
353,
426,
13,
29871,
22868,
3782,
11746,
2396,
29871,
29906,
29892,
13,
29871,
22868,
12542,
2396,
29871,
29896,
29892,
13,
29871,
22868,
9662,
542,
403,
2396,
29871,
29896,
29892,
13,
29871,
22868,
6843,
598,
2396,
29871,
29896,
29892,
13,
29913,
13,
13,
13,
1990,
405,
29924,
29940,
29901,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
2295,
29892,
413,
29890,
29918,
16175,
29892,
413,
29890,
29918,
13168,
29918,
16175,
29892,
413,
29890,
29918,
2435,
29918,
16175,
29892,
274,
29918,
1761,
29892,
29871,
13,
1669,
13850,
29918,
1761,
29892,
3855,
29892,
3855,
29918,
13168,
29892,
3883,
29918,
7039,
29892,
3883,
29918,
22795,
29918,
1761,
29892,
338,
29918,
14968,
29892,
29871,
13,
1669,
3855,
29918,
2435,
29892,
4236,
29918,
22752,
29918,
2311,
29922,
8516,
29892,
6874,
2433,
29940,
29924,
29940,
742,
24270,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
405,
29924,
29940,
325,
29946,
411,
385,
8570,
5096,
13,
1678,
9995,
13,
1678,
411,
15886,
29889,
11918,
29918,
6078,
29898,
6078,
29892,
24270,
29922,
276,
1509,
1125,
13,
418,
1583,
29889,
275,
29918,
14968,
353,
338,
29918,
14968,
13,
418,
1583,
29889,
3396,
29918,
2917,
353,
2295,
13,
418,
1583,
29889,
21066,
29918,
16175,
353,
413,
29890,
29918,
16175,
13,
418,
1583,
29889,
21066,
29918,
13168,
29918,
16175,
353,
413,
29890,
29918,
13168,
29918,
16175,
13,
418,
1583,
29889,
21066,
29918,
2435,
29918,
16175,
353,
413,
29890,
29918,
2435,
29918,
16175,
13,
418,
1583,
29889,
29883,
29918,
1761,
353,
274,
29918,
1761,
13,
418,
1583,
29889,
11023,
29918,
1761,
353,
13850,
29918,
1761,
13,
418,
1583,
29889,
29939,
353,
3855,
13,
418,
1583,
29889,
29939,
29918,
2435,
353,
3855,
29918,
2435,
13,
418,
1583,
29889,
29939,
29918,
13168,
353,
3855,
29918,
13168,
13,
418,
1583,
29889,
5453,
29918,
22795,
29918,
1761,
353,
3883,
29918,
22795,
29918,
1761,
13,
418,
1583,
29889,
21066,
29918,
6229,
353,
274,
16434,
29889,
20387,
29931,
29889,
26067,
29918,
4571,
29924,
13,
418,
565,
1583,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
276,
2029,
403,
29918,
11631,
29918,
7414,
29901,
13,
4706,
341,
13668,
29965,
1307,
29918,
12015,
12336,
29918,
13967,
1839,
29918,
9662,
542,
403,
2033,
353,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
1839,
29918,
9662,
542,
403,
2033,
718,
29871,
29896,
13,
418,
1683,
29901,
13,
4706,
341,
13668,
29965,
1307,
29918,
12015,
12336,
29918,
13967,
1839,
29918,
9662,
542,
403,
2033,
353,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
1839,
29918,
9662,
542,
403,
2033,
13,
539,
13,
418,
1583,
29889,
29911,
29918,
24220,
353,
274,
16434,
29889,
20387,
29931,
29889,
29911,
29918,
1783,
2241,
13,
418,
1583,
29889,
6954,
29918,
6229,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
2303,
29924,
29918,
4571,
29924,
13,
418,
1583,
29889,
29940,
353,
15886,
29889,
12181,
29898,
21066,
29918,
16175,
9601,
29900,
29962,
13,
418,
1583,
29889,
29924,
353,
15886,
29889,
12181,
29898,
21066,
29918,
16175,
9601,
29896,
29962,
13,
418,
1583,
29889,
29967,
29990,
353,
15886,
29889,
12181,
29898,
21066,
29918,
16175,
9601,
29906,
29962,
13,
418,
1583,
29889,
1131,
29918,
12181,
353,
304,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
1583,
29889,
29924,
29892,
1583,
29889,
29967,
29990,
29892,
29871,
29896,
2314,
13,
418,
1583,
29889,
3317,
29918,
22752,
29918,
2311,
353,
4236,
29918,
22752,
29918,
2311,
13,
539,
13,
418,
1583,
29889,
1429,
29918,
2435,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
19433,
13,
418,
396,
450,
2847,
616,
5096,
1819,
526,
599,
24786,
16978,
13,
418,
1583,
29889,
1131,
29918,
1429,
29918,
2344,
353,
15886,
29889,
3298,
359,
29898,
13,
4706,
304,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
1583,
29889,
29924,
29892,
1583,
29889,
29967,
29990,
29892,
1583,
29889,
21066,
29918,
6229,
29892,
1583,
29889,
1429,
29918,
2435,
12622,
13,
418,
396,
450,
2847,
5096,
4879,
3291,
304,
278,
5096,
5970,
13,
418,
1583,
29889,
1429,
29918,
7414,
29918,
2344,
353,
15886,
29889,
650,
29918,
8711,
29898,
13,
4706,
15886,
29889,
3298,
359,
29898,
517,
29918,
29911,
4197,
1311,
29889,
29940,
11724,
15886,
29889,
524,
29941,
29906,
511,
1583,
29889,
1429,
29918,
2435,
29897,
13,
418,
1583,
29889,
6954,
29918,
2344,
353,
15886,
29889,
3298,
359,
29898,
517,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
1583,
29889,
6954,
29918,
6229,
12622,
13,
13,
418,
396,
5225,
29899,
4905,
29879,
393,
508,
367,
5948,
1304,
491,
278,
10585,
13,
418,
1583,
29889,
1131,
29918,
9171,
353,
15886,
29889,
3298,
359,
29898,
1311,
29889,
1131,
29918,
12181,
29892,
15886,
29889,
7411,
29941,
29906,
29897,
13,
418,
565,
2295,
29889,
22882,
29876,
29918,
6954,
29918,
2344,
1275,
525,
9171,
2396,
13,
4706,
1583,
29889,
6954,
29918,
9171,
353,
15886,
29889,
3298,
359,
29898,
517,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
1583,
29889,
6954,
29918,
6229,
11724,
15886,
29889,
7411,
29941,
29906,
29897,
13,
418,
25342,
2295,
29889,
22882,
29876,
29918,
6954,
29918,
2344,
1275,
525,
8172,
2396,
13,
4706,
1583,
29889,
6954,
29918,
9171,
353,
15886,
29889,
8172,
29889,
29590,
29898,
517,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
1583,
29889,
6954,
29918,
6229,
11724,
1375,
791,
10457,
29896,
29900,
29900,
29892,
4236,
791,
29922,
29896,
29900,
29900,
29892,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
29897,
13,
418,
1683,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
418,
1583,
29889,
13628,
29918,
9171,
353,
15886,
29889,
3298,
359,
29898,
517,
29918,
29911,
4197,
1311,
29889,
29940,
29892,
29871,
29896,
11724,
15886,
29889,
7411,
29941,
29906,
29897,
13,
13,
418,
396,
278,
731,
310,
10585,
322,
3168,
313,
29872,
29889,
29887,
29889,
11119,
12542,
29908,
1599,
10987,
29897,
13,
418,
1583,
29889,
5453,
29918,
7039,
353,
3883,
29918,
7039,
13,
418,
1583,
29889,
5453,
29918,
7692,
2395,
353,
518,
657,
5552,
29898,
1311,
29892,
286,
29961,
29896,
29901,
2314,
363,
286,
297,
3883,
29918,
7039,
29962,
13,
418,
1583,
29889,
1949,
29918,
5453,
353,
7431,
29898,
5453,
29918,
7039,
29897,
13,
418,
1583,
29889,
5453,
29918,
3084,
537,
29918,
2922,
353,
903,
4282,
29918,
5453,
29918,
3084,
537,
29918,
2922,
29898,
5453,
29918,
7039,
29897,
13,
13,
418,
396,
443,
1245,
278,
10585,
411,
263,
4343,
1353,
310,
5335,
342,
1022,
323,
29918,
24220,
13,
418,
1583,
29889,
1131,
29918,
1761,
353,
5159,
13,
418,
1583,
29889,
1131,
29918,
1429,
29918,
1761,
353,
5159,
13,
418,
1583,
29889,
1429,
29918,
7414,
29918,
1761,
353,
5159,
13,
418,
1583,
29889,
6954,
29918,
1761,
353,
5159,
13,
418,
1583,
29889,
13628,
29918,
1761,
353,
5159,
13,
418,
1583,
29889,
1131,
29918,
262,
29918,
29896,
29892,
1583,
29889,
1131,
29918,
262,
29918,
29906,
353,
6213,
29892,
6213,
13,
418,
1098,
29918,
1429,
29918,
16304,
353,
1583,
29889,
1131,
29918,
1429,
29918,
2344,
13,
418,
5096,
29918,
7414,
29918,
16304,
353,
1583,
29889,
1429,
29918,
7414,
29918,
2344,
13,
418,
2626,
29918,
16304,
353,
1583,
29889,
6954,
29918,
2344,
13,
539,
13,
418,
1583,
29889,
5453,
29918,
3084,
537,
353,
5159,
13,
418,
363,
260,
297,
3464,
29898,
1311,
29889,
29911,
29918,
24220,
1125,
13,
4706,
274,
29918,
29875,
353,
1583,
29889,
29883,
29918,
1761,
29961,
29873,
29962,
13,
4706,
13850,
29918,
29875,
353,
1583,
29889,
11023,
29918,
1761,
29961,
29873,
29962,
13,
4706,
3883,
29918,
22795,
353,
1583,
29889,
5453,
29918,
22795,
29918,
1761,
29961,
29873,
29962,
13,
4706,
396,
871,
3013,
278,
2070,
310,
2854,
10585,
313,
29875,
29889,
29872,
29889,
1906,
2113,
29915,
29873,
4556,
13,
4706,
396,
5096,
1090,
1731,
470,
11969,
29889,
321,
29889,
29887,
29889,
903,
5072,
508,
29915,
29873,
367,
1065,
472,
13,
4706,
396,
260,
353,
29871,
29900,
1951,
278,
5096,
338,
4069,
467,
13,
4706,
565,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
26707,
3040,
29918,
6720,
14849,
17101,
29901,
13,
3986,
3883,
29918,
3084,
537,
353,
15886,
29889,
2922,
16109,
29898,
13,
9651,
5096,
29918,
7414,
29918,
16304,
29892,
1583,
29889,
5453,
29918,
3084,
537,
29918,
2922,
29897,
13,
3986,
565,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
29950,
17011,
29918,
6720,
14849,
1307,
29918,
26707,
8098,
29901,
13,
9651,
3883,
29918,
3084,
537,
353,
15886,
29889,
14486,
29898,
5453,
29918,
3084,
537,
29897,
13,
3986,
1583,
29889,
5453,
29918,
3084,
537,
29889,
4397,
29898,
5453,
29918,
3084,
537,
29897,
13,
3986,
3883,
29918,
22795,
334,
29922,
3883,
29918,
3084,
537,
13,
3986,
3883,
29918,
22795,
847,
29922,
15886,
29889,
17469,
29918,
2083,
29898,
13,
9651,
3883,
29918,
22795,
29892,
9685,
29922,
29896,
29892,
3013,
6229,
29879,
29922,
5574,
29897,
13,
3986,
1583,
29889,
5453,
29918,
22795,
29918,
1761,
29961,
29873,
29962,
353,
3883,
29918,
22795,
13,
13,
4706,
396,
1065,
599,
278,
10585,
29892,
322,
6588,
1009,
2582,
281,
2273,
3883,
29918,
29893,
13,
4706,
620,
353,
518,
29888,
29898,
1131,
29918,
1429,
29918,
16304,
29892,
5096,
29918,
7414,
29918,
16304,
29892,
2626,
29918,
16304,
29892,
274,
29918,
29875,
29892,
13850,
29918,
29875,
29892,
29871,
13,
18884,
260,
29892,
24270,
7607,
29873,
1405,
29871,
29900,
876,
363,
285,
297,
1583,
29889,
5453,
29918,
7692,
2395,
29962,
13,
13,
4706,
1098,
29918,
1429,
29918,
485,
29887,
353,
15886,
29889,
17469,
29918,
2083,
29898,
13,
3986,
3883,
29918,
22795,
7503,
29892,
4853,
29892,
4853,
29892,
4853,
29892,
4853,
29892,
584,
29962,
334,
13,
3986,
15886,
29889,
1429,
4197,
29878,
29961,
29900,
29962,
363,
364,
297,
620,
1402,
9685,
10457,
29896,
511,
9685,
10457,
29896,
29897,
13,
4706,
5096,
29918,
7414,
29918,
485,
29887,
353,
903,
845,
279,
2238,
29918,
7414,
29898,
13264,
29889,
17469,
29918,
2083,
29898,
13,
3986,
3883,
29918,
22795,
7503,
29892,
4853,
29892,
584,
29962,
334,
13,
3986,
15886,
29889,
1429,
4197,
29878,
29961,
29896,
29962,
363,
364,
297,
620,
1402,
9685,
29922,
29906,
511,
9685,
10457,
29896,
876,
13,
4706,
2626,
29918,
485,
29887,
353,
15886,
29889,
17469,
29918,
2083,
29898,
13,
3986,
3883,
29918,
22795,
7503,
29892,
4853,
29892,
584,
29962,
334,
13,
3986,
15886,
29889,
1429,
4197,
29878,
29961,
29906,
29962,
363,
364,
297,
620,
1402,
9685,
29922,
29906,
511,
9685,
10457,
29896,
29897,
13,
4706,
8158,
29918,
485,
29887,
353,
15886,
29889,
17469,
29918,
2083,
29898,
13,
3986,
3883,
29918,
22795,
7503,
29892,
4853,
29892,
584,
29962,
334,
29871,
13,
3986,
15886,
29889,
1429,
4197,
29878,
29961,
29941,
29962,
363,
364,
297,
620,
1402,
9685,
29922,
29906,
511,
9685,
10457,
29896,
29897,
13,
13,
4706,
1583,
29889,
1131,
29918,
1761,
29889,
4397,
7373,
949,
29918,
3166,
29918,
1429,
29898,
1131,
29918,
1429,
29918,
485,
29887,
29892,
5096,
29918,
7414,
29918,
485,
29887,
876,
13,
4706,
1583,
29889,
1131,
29918,
1429,
29918,
1761,
29889,
4397,
29898,
1131,
29918,
1429,
29918,
485,
29887,
29897,
13,
4706,
1583,
29889,
1429,
29918,
7414,
29918,
1761,
29889,
4397,
29898,
1429,
29918,
7414,
29918,
485,
29887,
29897,
13,
4706,
1583,
29889,
6954,
29918,
1761,
29889,
4397,
29898,
6954,
29918,
485,
29887,
29897,
13,
4706,
1583,
29889,
13628,
29918,
1761,
29889,
4397,
29898,
13628,
29918,
485,
29887,
29897,
13,
4706,
1098,
29918,
1429,
29918,
16304,
353,
1098,
29918,
1429,
29918,
485,
29887,
13,
4706,
5096,
29918,
7414,
29918,
16304,
353,
5096,
29918,
7414,
29918,
485,
29887,
13,
4706,
2626,
29918,
16304,
353,
2626,
29918,
485,
29887,
13,
13,
418,
1583,
29889,
1131,
29918,
4230,
353,
1583,
29889,
1131,
29918,
1761,
14352,
29896,
29962,
13,
418,
1583,
29889,
1131,
29918,
4102,
353,
1583,
29889,
1131,
29918,
1761,
29961,
29900,
29962,
13,
418,
1583,
29889,
1131,
29918,
7496,
353,
1583,
29889,
1131,
29918,
1761,
29961,
29896,
29962,
13,
418,
1583,
29889,
6954,
29918,
4230,
353,
1583,
29889,
6954,
29918,
1761,
14352,
29896,
29962,
13,
418,
1583,
29889,
13628,
29918,
4230,
353,
1583,
29889,
13628,
29918,
1761,
14352,
29896,
29962,
13,
13,
13,
29871,
822,
1939,
11746,
29898,
1311,
29892,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
262,
29892,
274,
29918,
29875,
29892,
13850,
29918,
29875,
29892,
260,
29892,
6874,
2433,
3782,
11746,
742,
24270,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
5538,
3078,
29889,
739,
11308,
278,
5096,
4879,
29892,
278,
5096,
322,
2626,
4608,
13,
1678,
408,
29899,
275,
29889,
13,
1678,
9995,
13,
1678,
736,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
262,
29892,
1583,
29889,
13628,
29918,
9171,
13,
13,
13,
29871,
822,
10987,
29898,
1311,
29892,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
262,
29892,
274,
29918,
29875,
29892,
13850,
29918,
29875,
29892,
260,
29892,
6874,
2433,
12542,
742,
24270,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
2431,
9514,
1887,
2133,
29892,
322,
11217,
3370,
4608,
29889,
13,
1678,
9995,
13,
1678,
411,
15886,
29889,
11918,
29918,
6078,
29898,
6078,
29892,
24270,
29922,
276,
1509,
1125,
13,
418,
396,
3617,
8570,
13,
418,
396,
1678,
29896,
29897,
5608,
368,
2910,
278,
4701,
12047,
304,
278,
476,
29933,
9927,
13,
418,
396,
1678,
29906,
29897,
1543,
3538,
3234,
411,
476,
29933,
13,
418,
396,
1678,
29941,
29897,
29871,
29896,
29916,
29896,
26851,
304,
679,
8570,
1480,
1169,
13,
418,
274,
29918,
655,
2986,
353,
285,
29883,
877,
13801,
29918,
29883,
29918,
655,
2986,
742,
274,
29918,
29875,
29892,
1962,
29918,
6229,
29922,
16859,
29889,
20387,
29931,
29889,
26067,
29918,
4571,
29924,
29892,
320,
13,
3986,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
5768,
449,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
8865,
449,
29897,
13,
13,
418,
413,
29890,
29918,
16175,
353,
1583,
29889,
21066,
29918,
16175,
13,
13,
418,
560,
29873,
29918,
10633,
353,
15886,
29889,
15755,
29889,
29880,
29906,
29918,
8945,
675,
29898,
13,
3986,
413,
29890,
29918,
16175,
334,
274,
29918,
655,
2986,
7503,
29892,
4853,
29892,
4853,
29892,
584,
1402,
9685,
10457,
29896,
29897,
13,
13,
418,
1098,
29918,
449,
353,
1583,
29889,
7302,
29918,
1131,
2509,
29898,
2152,
29918,
10633,
29892,
13850,
29918,
29875,
29892,
260,
29897,
13,
13,
418,
396,
349,
1878,
304,
5096,
13,
418,
5096,
29918,
7414,
353,
903,
11631,
29918,
7414,
29918,
25051,
29898,
1429,
29918,
7414,
29897,
13,
418,
1098,
29918,
1429,
353,
903,
3539,
29918,
517,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
1098,
29918,
449,
29897,
13,
539,
13,
418,
396,
10987,
12945,
7855,
13,
418,
565,
29871,
260,
1275,
29871,
29900,
322,
313,
1311,
29889,
3396,
29918,
2917,
29889,
9136,
29894,
895,
29918,
18419,
29918,
10041,
1125,
13,
4706,
330,
29896,
29892,
903,
353,
4768,
29918,
29883,
566,
15755,
29918,
29878,
15755,
29918,
3977,
6119,
877,
20155,
29885,
742,
1583,
29889,
3396,
29918,
2917,
29889,
10892,
29918,
2311,
29892,
29871,
29896,
29892,
29871,
29896,
29899,
1311,
29889,
3396,
29918,
2917,
29889,
2080,
29918,
17462,
29918,
22795,
29892,
320,
13,
462,
462,
1678,
15886,
29889,
29879,
802,
29872,
911,
29898,
1131,
29918,
449,
29892,
9685,
29922,
29896,
511,
15886,
29889,
29879,
802,
29872,
911,
29898,
1311,
29889,
21066,
29918,
2435,
29918,
16175,
29892,
9685,
29922,
29896,
511,
1583,
29889,
275,
29918,
14968,
29897,
13,
4706,
330,
29896,
353,
330,
29896,
7503,
29892,
4853,
29892,
584,
29892,
584,
29962,
13,
4706,
12945,
29918,
1188,
1169,
353,
5608,
29918,
1188,
1169,
4197,
29887,
29896,
29892,
1098,
29918,
449,
1402,
5852,
29892,
1881,
29918,
17462,
29918,
22795,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
2080,
29918,
17462,
29918,
22795,
29892,
320,
13,
462,
462,
268,
11105,
29922,
1311,
29889,
21066,
29918,
13168,
29918,
16175,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
6874,
2433,
1188,
1169,
29918,
18419,
1495,
13,
4706,
1583,
29889,
18419,
29918,
1188,
1169,
353,
15886,
29889,
29879,
802,
29872,
911,
29898,
18419,
29918,
1188,
1169,
29892,
9685,
29922,
29896,
29897,
13,
4706,
12945,
29918,
1131,
29876,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29898,
1311,
29889,
18419,
29918,
1188,
1169,
29897,
13,
4706,
1583,
29889,
18419,
29918,
1131,
29876,
353,
12945,
29918,
1131,
29876,
13,
4706,
716,
29918,
6954,
353,
15886,
29889,
29872,
1144,
398,
877,
13535,
29892,
823,
976,
638,
742,
15886,
29889,
29879,
802,
29872,
911,
29898,
21066,
29918,
16175,
29892,
9685,
29922,
29896,
511,
12945,
29918,
1131,
29876,
29897,
13,
4706,
565,
260,
1275,
29871,
29900,
29901,
13,
3986,
1583,
29889,
262,
14373,
29918,
18419,
353,
716,
29918,
6954,
13,
13,
1678,
736,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
1583,
29889,
6954,
29918,
9171,
29892,
1583,
29889,
13628,
29918,
9171,
13,
13,
13,
29871,
822,
3831,
598,
29898,
1311,
29892,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
262,
29892,
274,
29918,
29875,
29892,
13850,
29918,
29875,
29892,
260,
29892,
6874,
2433,
6843,
598,
742,
24270,
29922,
8516,
1125,
13,
1678,
396,
6977,
515,
5096,
13,
1678,
1098,
29918,
262,
29918,
29906,
353,
15886,
29889,
29879,
802,
29872,
911,
7373,
949,
29918,
3166,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
511,
9685,
10457,
29896,
29897,
13,
1678,
5096,
29918,
7414,
353,
903,
11631,
29918,
7414,
29918,
29890,
29893,
29898,
1429,
29918,
7414,
29897,
13,
1678,
1098,
29918,
262,
29918,
29896,
353,
15886,
29889,
29879,
802,
29872,
911,
7373,
949,
29918,
3166,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
511,
9685,
10457,
29896,
29897,
13,
1678,
396,
1429,
29918,
7414,
353,
903,
11631,
29918,
7414,
29918,
29890,
29893,
29898,
1429,
29918,
7414,
29897,
29871,
13,
1678,
5096,
29918,
7414,
353,
903,
11631,
29918,
7414,
29918,
25051,
29898,
1429,
29918,
7414,
29897,
13,
268,
13,
1678,
411,
15886,
29889,
11918,
29918,
6078,
29898,
6078,
29892,
24270,
29922,
276,
1509,
1125,
13,
13,
418,
1098,
29918,
22795,
29918,
262,
29918,
29896,
353,
5608,
29918,
1188,
1169,
4197,
1131,
29918,
262,
29918,
29896,
1402,
5852,
29892,
1881,
29918,
17462,
29918,
22795,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
2080,
29918,
17462,
29918,
22795,
29892,
320,
13,
462,
18884,
11105,
29922,
1311,
29889,
21066,
29918,
13168,
29918,
16175,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29897,
13,
418,
1098,
29918,
22795,
29918,
262,
29918,
29906,
353,
5608,
29918,
1188,
1169,
4197,
1131,
29918,
262,
29918,
29906,
1402,
5852,
29892,
1881,
29918,
17462,
29918,
22795,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
2080,
29918,
17462,
29918,
22795,
29892,
320,
13,
462,
18884,
11105,
29922,
1311,
29889,
21066,
29918,
13168,
29918,
16175,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
24270,
29922,
5574,
29897,
13,
418,
1098,
29918,
22795,
29918,
262,
29918,
29896,
29892,
1098,
29918,
22795,
29918,
262,
29918,
29906,
353,
15886,
29889,
29879,
802,
29872,
911,
29898,
1131,
29918,
22795,
29918,
262,
29918,
29896,
29892,
9685,
29922,
29896,
511,
15886,
29889,
29879,
802,
29872,
911,
29898,
1131,
29918,
22795,
29918,
262,
29918,
29906,
29892,
9685,
29922,
29896,
29897,
29871,
13,
13,
418,
1583,
29889,
1131,
29918,
262,
29918,
29896,
353,
1098,
29918,
22795,
29918,
262,
29918,
29896,
13,
418,
1583,
29889,
1131,
29918,
262,
29918,
29906,
353,
1098,
29918,
22795,
29918,
262,
29918,
29906,
13,
418,
274,
29918,
655,
2986,
353,
285,
29883,
877,
13801,
29918,
29883,
29918,
655,
2986,
742,
274,
29918,
29875,
29892,
1962,
29918,
6229,
29922,
16859,
29889,
20387,
29931,
29889,
26067,
29918,
4571,
29924,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
5768,
449,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
8865,
449,
29897,
13,
418,
413,
29890,
29918,
1131,
29918,
262,
29918,
29896,
353,
903,
21111,
29918,
2695,
3317,
29918,
485,
29887,
29898,
1311,
29889,
21066,
29918,
16175,
29892,
1098,
29918,
22795,
29918,
262,
29918,
29896,
7503,
29892,
4853,
29892,
584,
2314,
13,
418,
413,
29890,
29918,
1131,
29918,
262,
29918,
29906,
353,
903,
21111,
29918,
2695,
3317,
29918,
485,
29887,
29898,
1311,
29889,
21066,
29918,
16175,
29892,
1098,
29918,
22795,
29918,
262,
29918,
29906,
7503,
29892,
4853,
29892,
584,
2314,
13,
13,
418,
285,
29883,
29918,
262,
29918,
29896,
353,
15886,
29889,
17685,
4197,
29883,
29918,
655,
2986,
29892,
274,
29918,
655,
2986,
334,
413,
29890,
29918,
1131,
29918,
262,
29918,
29896,
29892,
274,
29918,
655,
2986,
29930,
21066,
29918,
1131,
29918,
262,
29918,
29906,
29892,
413,
29890,
29918,
1131,
29918,
262,
29918,
29896,
29899,
21066,
29918,
1131,
29918,
262,
29918,
29906,
1402,
9685,
29922,
29896,
29897,
13,
418,
2626,
29918,
449,
353,
15886,
29889,
15755,
29889,
13161,
29882,
29898,
13801,
877,
13801,
29918,
6954,
29918,
449,
29918,
29896,
742,
285,
29883,
29918,
262,
29918,
29896,
29892,
1962,
29918,
6229,
29922,
1311,
29889,
6954,
29918,
6229,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
5768,
449,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
8865,
449,
876,
13,
418,
13,
1678,
736,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
449,
29892,
1583,
29889,
13628,
29918,
9171,
13,
13,
13,
29871,
822,
6376,
542,
403,
29898,
1311,
29892,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
2626,
29918,
262,
29892,
274,
29918,
29875,
29892,
13850,
29918,
29875,
29892,
260,
29892,
6874,
2433,
13372,
742,
24270,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
6376,
542,
1078,
278,
3517,
8570,
29892,
322,
11217,
3370,
4608,
29889,
13,
1678,
9995,
13,
13,
1678,
413,
29890,
29918,
16175,
353,
1583,
29889,
21066,
29918,
16175,
13,
13,
1678,
411,
15886,
29889,
11918,
29918,
6078,
29898,
6078,
29892,
24270,
29922,
276,
1509,
1125,
13,
418,
274,
29918,
655,
2986,
353,
285,
29883,
877,
13801,
29918,
29883,
29918,
655,
2986,
742,
274,
29918,
29875,
29892,
1962,
29918,
6229,
29922,
16859,
29889,
20387,
29931,
29889,
26067,
29918,
4571,
29924,
29892,
338,
29918,
14968,
29922,
1311,
29889,
275,
29918,
14968,
29892,
5768,
449,
29922,
1311,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
8865,
449,
29897,
13,
13,
418,
396,
3617,
8570,
13,
418,
396,
1678,
29896,
29897,
5608,
368,
2910,
278,
4701,
12047,
304,
278,
476,
29933,
9927,
13,
418,
396,
1678,
29906,
29897,
6597,
14283,
5680,
515,
278,
1881,
8570,
13,
418,
396,
1678,
29906,
29897,
1543,
3538,
3234,
411,
476,
29933,
13,
418,
396,
1678,
29941,
29897,
29871,
29896,
29916,
29896,
26851,
304,
679,
8570,
1480,
1169,
13,
13,
418,
565,
260,
1275,
29871,
29900,
29901,
13,
4706,
560,
29873,
29918,
10633,
353,
15886,
29889,
15755,
29889,
29880,
29906,
29918,
8945,
675,
29898,
13,
3986,
413,
29890,
29918,
16175,
334,
274,
29918,
655,
2986,
7503,
29892,
4853,
29892,
4853,
29892,
584,
1402,
9685,
10457,
29896,
29897,
13,
418,
1683,
29901,
13,
4706,
560,
29873,
29918,
10633,
353,
15886,
29889,
15755,
29889,
29880,
29906,
29918,
8945,
675,
29898,
13,
3986,
413,
29890,
29918,
16175,
334,
274,
29918,
655,
2986,
7503,
29892,
4853,
29892,
4853,
29892,
584,
29962,
334,
13,
3986,
1583,
29889,
262,
14373,
29918,
18419,
7503,
29892,
4853,
29892,
4853,
29892,
584,
1402,
9685,
10457,
29896,
29897,
13,
13,
418,
1098,
29918,
449,
353,
1583,
29889,
7302,
29918,
1131,
2509,
29898,
2152,
29918,
10633,
29892,
13850,
29918,
29875,
29892,
260,
29892,
3883,
2433,
276,
2029,
403,
1495,
13,
13,
418,
396,
349,
1878,
304,
5096,
13,
418,
565,
1583,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
276,
2029,
403,
29918,
11631,
29918,
7414,
29901,
13,
4706,
5096,
29918,
7414,
353,
903,
11631,
29918,
7414,
29918,
25051,
29898,
1429,
29918,
7414,
29897,
29871,
396,
12611,
29899,
449,
2038,
13,
418,
1098,
29918,
1429,
353,
903,
3539,
29918,
517,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
1098,
29918,
449,
29897,
13,
13,
1678,
736,
1098,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
1583,
29889,
6954,
29918,
9171,
29892,
1583,
29889,
13628,
29918,
9171,
13,
13,
13,
29871,
822,
3394,
29918,
1131,
2509,
29898,
1311,
29892,
298,
29892,
318,
29918,
705,
5861,
29892,
260,
29892,
3883,
2433,
2886,
29374,
13,
1678,
565,
1583,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
1131,
2509,
29918,
1853,
1275,
525,
20580,
2396,
13,
418,
714,
353,
903,
29896,
29916,
29896,
20580,
877,
20580,
29918,
1131,
29918,
449,
742,
298,
29892,
1962,
29918,
6229,
29922,
29896,
29897,
13,
418,
1480,
1169,
353,
3394,
29918,
13168,
29898,
449,
29892,
1583,
29889,
21066,
29918,
13168,
29918,
16175,
29897,
13,
1678,
25342,
1583,
29889,
3396,
29918,
2917,
29889,
22882,
29876,
29918,
1131,
2509,
29918,
1853,
1275,
525,
5365,
1131,
29876,
2396,
13,
418,
714,
353,
1583,
29889,
5365,
29918,
1131,
2509,
29898,
29882,
29892,
318,
29918,
705,
5861,
29892,
260,
29892,
3883,
29922,
5453,
29897,
13,
1678,
1683,
29901,
13,
418,
12020,
2216,
1888,
2037,
287,
2392,
13,
1678,
736,
714,
13,
13,
13,
29871,
822,
4768,
29918,
1131,
2509,
29898,
1311,
29892,
298,
29892,
318,
29918,
705,
5861,
29892,
260,
29892,
3883,
2433,
2886,
29374,
13,
1678,
318,
29918,
705,
5861,
353,
15886,
29889,
3286,
4220,
29898,
13264,
29889,
29879,
802,
29872,
911,
29898,
29884,
29918,
705,
5861,
29892,
9685,
10457,
29896,
511,
3635,
11759,
29896,
29892,
29871,
29900,
2314,
13,
1678,
3855,
29892,
3855,
29918,
13168,
353,
1583,
29889,
29939,
29892,
1583,
29889,
29939,
29918,
13168,
13,
13,
1678,
282,
29900,
29892,
3030,
29918,
6229,
29892,
7688,
29918,
650,
353,
7688,
287,
29918,
5365,
1131,
2509,
29898,
13,
4706,
298,
29892,
3855,
29892,
1583,
29889,
21066,
29918,
6229,
29892,
298,
29918,
13168,
29922,
1311,
29889,
21066,
29918,
13168,
29918,
16175,
29892,
318,
29918,
13168,
29922,
13264,
29889,
4384,
29898,
29939,
29918,
13168,
29892,
525,
11227,
5477,
29871,
13,
4706,
318,
29918,
705,
5861,
29922,
29884,
29918,
705,
5861,
29892,
6874,
2433,
5365,
1131,
29876,
1495,
13,
1678,
565,
3883,
1275,
525,
2886,
29915,
322,
260,
1275,
29871,
29896,
29901,
13,
418,
1583,
29889,
7915,
29918,
650,
353,
7688,
29918,
650,
13,
268,
13,
1678,
282,
29900,
353,
20619,
29898,
29886,
29900,
29892,
1583,
29889,
3396,
29918,
2917,
29889,
10892,
29918,
2311,
29930,
29906,
29892,
6874,
2433,
5365,
1131,
29876,
29918,
1145,
344,
1495,
13,
1678,
736,
282,
29900,
13,
13,
13,
1753,
903,
11631,
29918,
7414,
29918,
25051,
29898,
1429,
29918,
7414,
1125,
13,
29871,
9995,
13,
29871,
25249,
278,
5096,
4879,
6375,
313,
29875,
29889,
29872,
29889,
304,
5503,
304,
5096,
467,
13,
29871,
9995,
13,
29871,
396,
3940,
29901,
297,
323,
29943,
29892,
7602,
29896,
29881,
338,
8762,
408,
4469,
29899,
2616,
23445,
313,
2611,
1479,
310,
13,
29871,
396,
5844,
2922,
936,
26851,
511,
577,
694,
285,
492,
3262,
310,
278,
4175,
29889,
13,
29871,
4175,
29918,
25051,
353,
304,
29918,
29911,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
7442,
29889,
7411,
29941,
29906,
467,
690,
14443,
3552,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
4961,
13,
29871,
716,
29918,
1429,
29918,
7414,
353,
15886,
29889,
29879,
802,
29872,
911,
29898,
13,
1678,
15886,
29889,
15755,
29889,
20580,
29896,
29881,
29898,
1429,
29918,
7414,
29961,
16361,
4853,
1402,
4175,
29918,
25051,
29892,
29871,
29896,
29892,
525,
8132,
2303,
5477,
9685,
11759,
29906,
2314,
13,
29871,
396,
746,
278,
5096,
4879,
338,
2307,
472,
278,
5096,
2246,
29892,
3013,
13,
29871,
396,
278,
4879,
297,
278,
1021,
4423,
313,
1228,
3538,
278,
4879,
674,
367,
599,
5225,
29897,
13,
29871,
565,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
29954,
29965,
17011,
29918,
1254,
11375,
29918,
29925,
5659,
29901,
13,
1678,
5096,
29918,
2435,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
19433,
13,
1678,
5096,
29918,
3332,
29918,
13168,
353,
15886,
29889,
650,
29918,
8711,
29898,
1429,
29918,
2435,
448,
29871,
29896,
29892,
5096,
29918,
2435,
29897,
13,
1678,
716,
29918,
1429,
29918,
7414,
4619,
5096,
29918,
3332,
29918,
13168,
334,
5096,
29918,
7414,
13,
29871,
736,
716,
29918,
1429,
29918,
7414,
13,
13,
13,
1753,
903,
11631,
29918,
7414,
29918,
29890,
29893,
29898,
1429,
29918,
7414,
1125,
13,
29871,
9995,
13,
29871,
25249,
278,
5096,
4879,
1250,
1328,
313,
29875,
29889,
29872,
29889,
304,
1835,
515,
5096,
467,
13,
29871,
9995,
13,
29871,
396,
3940,
29901,
297,
323,
29943,
29892,
7602,
29896,
29881,
338,
8762,
408,
4469,
29899,
2616,
23445,
313,
2611,
1479,
310,
13,
29871,
396,
5844,
2922,
936,
26851,
511,
577,
694,
285,
492,
3262,
310,
278,
4175,
29889,
13,
29871,
4175,
29918,
25051,
353,
304,
29918,
29911,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
7442,
29889,
7411,
29941,
29906,
467,
690,
14443,
3552,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
4961,
13,
29871,
716,
29918,
1429,
29918,
7414,
353,
15886,
29889,
29879,
802,
29872,
911,
29898,
13,
1678,
15886,
29889,
15755,
29889,
20580,
29896,
29881,
29898,
1429,
29918,
7414,
29961,
16361,
4853,
1402,
4175,
29918,
25051,
29892,
29871,
29896,
29892,
525,
8132,
2303,
5477,
9685,
11759,
29906,
2314,
13,
29871,
396,
746,
278,
5096,
4879,
338,
2307,
472,
278,
5096,
5970,
29892,
3013,
13,
29871,
396,
278,
4879,
297,
278,
1021,
4423,
313,
1228,
3538,
278,
4879,
674,
367,
599,
5225,
29897,
13,
29871,
565,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
29954,
29965,
17011,
29918,
1254,
11375,
29918,
29925,
5659,
29901,
13,
1678,
5096,
29918,
2435,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
19433,
13,
1678,
5096,
29918,
8968,
29918,
13168,
353,
15886,
29889,
650,
29918,
8711,
29898,
29900,
29892,
5096,
29918,
2435,
29897,
13,
1678,
716,
29918,
1429,
29918,
7414,
4619,
5096,
29918,
8968,
29918,
13168,
334,
5096,
29918,
7414,
13,
29871,
736,
716,
29918,
1429,
29918,
7414,
13,
13,
13,
1753,
903,
949,
29918,
3166,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
1125,
13,
29871,
9995,
13,
29871,
7523,
278,
995,
472,
278,
2183,
5096,
4879,
29889,
13,
29871,
9995,
13,
29871,
5096,
29918,
7414,
29918,
18837,
353,
5096,
29918,
7414,
7503,
29892,
4853,
29892,
4853,
29892,
4853,
29892,
584,
29962,
13,
29871,
396,
450,
5096,
4879,
338,
263,
697,
29899,
8711,
4608,
29892,
577,
925,
437,
8329,
3234,
13,
29871,
1098,
353,
15886,
29889,
17469,
29918,
2083,
29898,
1131,
29918,
1429,
334,
5096,
29918,
7414,
29918,
18837,
29892,
9685,
10457,
29896,
29892,
3013,
6229,
29879,
29922,
5574,
29897,
13,
29871,
736,
1098,
13,
13,
13,
1753,
903,
3539,
29918,
517,
29918,
1429,
29898,
1131,
29918,
1429,
29892,
5096,
29918,
7414,
29892,
1098,
1125,
13,
29871,
9995,
13,
29871,
14350,
995,
525,
1131,
29915,
964,
278,
5096,
472,
278,
2183,
5096,
4879,
29889,
3940,
393,
278,
13,
29871,
1121,
4225,
304,
367,
9859,
1250,
304,
1098,
29918,
1429,
13,
29871,
9995,
13,
29871,
5096,
29918,
7414,
29918,
18837,
353,
5096,
29918,
7414,
7503,
29892,
4853,
29892,
4853,
29892,
4853,
29892,
584,
29962,
13,
29871,
1098,
29918,
1429,
353,
1098,
7503,
29892,
584,
29892,
584,
29892,
584,
29892,
4853,
29962,
334,
5096,
29918,
7414,
29918,
18837,
718,
1098,
29918,
1429,
334,
313,
29896,
448,
5096,
29918,
7414,
29918,
18837,
29897,
13,
29871,
736,
1098,
29918,
1429,
13,
13,
13,
1753,
903,
845,
279,
2238,
29918,
7414,
29898,
1429,
29918,
7414,
1125,
13,
29871,
9995,
13,
29871,
1383,
279,
2238,
278,
5096,
12589,
964,
313,
28502,
368,
29897,
697,
29899,
8711,
12047,
29892,
773,
1852,
3317,
13,
29871,
470,
4964,
3317,
29889,
450,
5096,
1819,
881,
2337,
2533,
701,
304,
697,
363,
1269,
2777,
29889,
13,
29871,
9995,
13,
29871,
2898,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
17171,
29918,
29950,
17011,
29918,
7068,
1718,
29925,
1430,
13,
29871,
565,
2898,
29901,
13,
1678,
396,
2898,
313,
5464,
29899,
29881,
8349,
7268,
519,
29897,
528,
279,
2238,
292,
411,
1852,
3317,
13,
1678,
716,
29918,
1429,
29918,
7414,
353,
15886,
29889,
650,
29918,
8711,
29898,
13,
418,
15886,
29889,
1191,
3317,
29898,
1429,
29918,
7414,
29892,
9685,
29922,
29896,
511,
15886,
29889,
12181,
29898,
1429,
29918,
7414,
9601,
29896,
2314,
13,
29871,
1683,
29901,
13,
1678,
396,
4964,
313,
29881,
8349,
7268,
519,
29897,
528,
279,
2238,
292,
411,
4964,
3317,
13,
1678,
10430,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
6156,
7818,
29918,
7068,
1718,
29925,
1430,
29918,
4330,
3580,
13,
1678,
716,
29918,
1429,
29918,
7414,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29898,
1429,
29918,
7414,
847,
10430,
29897,
13,
29871,
736,
716,
29918,
1429,
29918,
7414,
13,
13,
13,
1753,
903,
29896,
29916,
29896,
20580,
29898,
978,
29892,
5970,
29892,
1962,
29918,
6229,
29892,
24270,
29922,
8516,
1125,
13,
29871,
736,
7602,
29898,
978,
29892,
5970,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
380,
2426,
29922,
29896,
29892,
1962,
29918,
6229,
29922,
4905,
29918,
6229,
29892,
13,
4706,
24270,
29922,
276,
1509,
29897,
13,
13,
13,
1753,
3394,
29918,
13168,
29898,
29916,
29892,
11105,
1125,
13,
29871,
736,
921,
448,
29871,
29896,
29872,
29941,
29900,
334,
313,
29896,
29889,
448,
15886,
29889,
4384,
29898,
13168,
7503,
29892,
584,
29892,
584,
29892,
4853,
1402,
525,
7411,
29941,
29906,
8785,
13,
13,
13,
1753,
903,
1028,
15238,
29918,
2695,
3317,
29898,
1131,
29918,
1610,
1125,
13,
29871,
1098,
29918,
12181,
353,
15886,
29889,
12181,
29898,
1131,
29918,
1610,
29897,
13,
29871,
405,
353,
1098,
29918,
12181,
29961,
29900,
29962,
13,
29871,
1098,
29918,
2695,
3317,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29898,
13264,
29889,
690,
14443,
29898,
1131,
29918,
1610,
29892,
304,
29918,
29911,
4197,
29940,
29892,
448,
29896,
2314,
511,
9685,
29922,
29896,
29897,
13,
29871,
1098,
29918,
2695,
3317,
353,
15886,
29889,
690,
14443,
29898,
1131,
29918,
2695,
3317,
29892,
1098,
29918,
12181,
29897,
13,
29871,
736,
1098,
29918,
2695,
3317,
13,
13,
13,
1753,
903,
21111,
29918,
2695,
3317,
29918,
485,
29887,
29898,
21066,
29918,
16175,
29892,
1098,
29918,
1610,
1125,
13,
29871,
1098,
29918,
2695,
3317,
353,
903,
1028,
15238,
29918,
2695,
3317,
29898,
1131,
29918,
1610,
29897,
7503,
29892,
584,
29892,
584,
29892,
4853,
29962,
13,
29871,
736,
15886,
29889,
17469,
29918,
2083,
29898,
21066,
29918,
16175,
334,
1098,
29918,
2695,
3317,
29892,
9685,
11759,
29896,
29892,
29871,
29906,
2314,
13,
13,
13,
1753,
903,
4282,
29918,
5453,
29918,
3084,
537,
29918,
2922,
29898,
5453,
29918,
7039,
1125,
13,
29871,
9995,
13,
29871,
8878,
263,
3883,
2854,
537,
4636,
29892,
5662,
3864,
393,
871,
2854,
10585,
674,
505,
13,
29871,
1661,
29899,
9171,
2070,
11614,
29889,
319,
3883,
338,
871,
2854,
304,
1065,
565,
727,
526,
3307,
13,
29871,
1098,
296,
1080,
304,
367,
772,
2986,
515,
278,
5096,
29892,
322,
505,
2913,
304,
5503,
964,
13,
29871,
313,
29872,
29889,
29887,
29889,
903,
12542,
511,
577,
393,
5096,
674,
451,
1090,
1731,
470,
11969,
491,
2874,
29889,
13,
13,
29871,
3883,
29918,
3084,
537,
29918,
2922,
338,
263,
5096,
29918,
2435,
921,
954,
29918,
5453,
4636,
29892,
322,
338,
1304,
304,
13,
29871,
22932,
411,
5096,
29918,
7414,
304,
679,
2854,
537,
7223,
4608,
363,
278,
10585,
29889,
13,
29871,
9995,
13,
29871,
5096,
29918,
2435,
353,
274,
16434,
29889,
20387,
29931,
29889,
29940,
29924,
29940,
29889,
1254,
11375,
29889,
19433,
13,
29871,
3883,
29918,
3084,
537,
29918,
2922,
353,
7442,
29889,
3298,
359,
3552,
1429,
29918,
2435,
29892,
7431,
29898,
5453,
29918,
7039,
8243,
7442,
29889,
7411,
29941,
29906,
29897,
13,
29871,
363,
302,
29918,
29885,
29892,
286,
297,
26985,
29898,
5453,
29918,
7039,
1125,
13,
1678,
396,
263,
3883,
508,
367,
1065,
871,
746,
5096,
23246,
2602,
17150,
13,
1678,
396,
313,
1195,
29918,
7414,
29918,
1066,
5277,
23246,
5277,
4236,
29918,
7414,
29918,
1066,
511,
988,
4236,
29918,
7414,
29918,
1066,
338,
20978,
573,
13,
1678,
396,
29871,
29896,
29897,
9212,
2602,
29901,
13,
1678,
396,
1678,
5096,
817,
304,
505,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
29961,
29885,
29962,
2712,
304,
1835,
515,
13,
1678,
1375,
29918,
7414,
29918,
1066,
353,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
29961,
29885,
29962,
13,
1678,
396,
278,
5096,
23246,
2923,
7607,
6720,
14849,
1307,
29918,
12015,
12336,
29918,
13967,
29961,
29885,
29962,
448,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
29961,
29885,
2314,
13,
1678,
396,
9801,
393,
23246,
718,
2923,
5277,
5096,
29918,
2435,
448,
29871,
29896,
313,
1429,
2246,
29897,
13,
1678,
4236,
29918,
7414,
29918,
1066,
353,
313,
13,
418,
5096,
29918,
2435,
448,
29871,
29896,
718,
341,
13668,
29965,
1307,
29918,
1177,
12336,
29918,
13967,
29961,
29885,
29962,
448,
341,
13668,
29965,
1307,
29918,
12015,
12336,
29918,
13967,
29961,
29885,
2314,
13,
1678,
3883,
29918,
3084,
537,
29918,
2922,
29961,
1195,
29918,
7414,
29918,
1066,
29901,
3317,
29918,
7414,
29918,
1066,
29974,
29896,
29892,
302,
29918,
29885,
29962,
353,
29871,
29896,
29889,
13,
13,
29871,
736,
304,
29918,
29911,
29898,
5453,
29918,
3084,
537,
29918,
2922,
29897,
13,
2
] |
bhr_site/urls.py | amerck/bhr-site | 23 | 172853 | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic.base import RedirectView
from django.contrib.auth import views as auth_views
urlpatterns = [
# Examples:
# url(r'^$', 'bhr_site.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', admin.site.urls),
url(r'^bhr/', include('bhr.urls')),
url(r'^accounts/login/$', auth_views.LoginView.as_view(), {'template_name': 'login.html'}, name='accounts_login'),
url(r'^accounts/logout/$', auth_views.LogoutView.as_view(), name='logout'),
url(r'^$', RedirectView.as_view(url='/bhr', permanent=False), name='siteroot'),
]
| [
1,
515,
9557,
29889,
5527,
29889,
26045,
1053,
3160,
29892,
3142,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
3166,
9557,
29889,
7406,
29889,
19206,
29889,
3188,
1053,
4367,
1088,
1043,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
8386,
408,
4817,
29918,
7406,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
396,
1222,
9422,
29901,
13,
1678,
396,
3142,
29898,
29878,
29915,
29985,
29938,
742,
525,
29890,
1092,
29918,
2746,
29889,
7406,
29889,
5184,
742,
1024,
2433,
5184,
5477,
13,
1678,
396,
3142,
29898,
29878,
29915,
29985,
7312,
29914,
742,
3160,
877,
7312,
29889,
26045,
1495,
511,
13,
13,
1678,
3142,
29898,
29878,
29915,
29985,
6406,
29914,
742,
4113,
29889,
2746,
29889,
26045,
511,
13,
1678,
3142,
29898,
29878,
29915,
29985,
29890,
1092,
29914,
742,
3160,
877,
29890,
1092,
29889,
26045,
1495,
511,
13,
1678,
3142,
29898,
29878,
29915,
29985,
10149,
29879,
29914,
7507,
13346,
742,
4817,
29918,
7406,
29889,
11049,
1043,
29889,
294,
29918,
1493,
3285,
11117,
6886,
29918,
978,
2396,
525,
7507,
29889,
1420,
16675,
1024,
2433,
10149,
29879,
29918,
7507,
5477,
13,
1678,
3142,
29898,
29878,
29915,
29985,
10149,
29879,
29914,
1188,
449,
13346,
742,
4817,
29918,
7406,
29889,
3403,
449,
1043,
29889,
294,
29918,
1493,
3285,
1024,
2433,
1188,
449,
5477,
13,
13,
1678,
3142,
29898,
29878,
29915,
29985,
29938,
742,
4367,
1088,
1043,
29889,
294,
29918,
1493,
29898,
2271,
2433,
29914,
29890,
1092,
742,
17667,
29922,
8824,
511,
1024,
2433,
29879,
277,
1489,
327,
5477,
13,
29962,
13,
2
] |
NVIDIA/benchmarks/ssd/implementations/pytorch/utils.py | goswamig/training_results_v0.7 | 48 | 24705 | <gh_stars>10-100
# MIT License
#
# Copyright (c) 2018 kuangliu
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# ------------------------------------------------------------------------------
#
# MIT License
#
# Copyright (c) 2017 <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# ------------------------------------------------------------------------------
#
# Copyright (c) 2018-2019, NVIDIA CORPORATION. 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.
import torch
import torchvision
import torchvision.transforms as transforms
import torch.utils.data as data
from PIL import Image
from xml.etree import ElementTree
import os
import glob
from pathlib import Path
import numpy as np
import random
import itertools
import torch.nn.functional as F
try:
import ujson as json
except ImportError:
import json
import gc
import time
import bz2
import pickle
from math import sqrt, ceil, cos, sin, pi
from mlperf_logging.mllog import constants
from mlperf_logger import log_event
from SSD import _C as C
from fused_color_jitter import FusedColorJitter
# This function is from https://github.com/kuangliu/pytorch-ssd
def calc_iou_tensor(box1, box2):
""" Calculation of IoU based on two boxes tensor,
Reference to https://github.com/kuangliu/pytorch-ssd
input:
box1 (N, 4)
box2 (M, 4)
output:
IoU (N, M)
"""
N = box1.size(0)
M = box2.size(0)
be1 = box1.unsqueeze(1).expand(-1, M, -1)
be2 = box2.unsqueeze(0).expand(N, -1, -1)
# Left Top & Right Bottom
lt = torch.max(be1[:,:,:2], be2[:,:,:2])
#mask1 = (be1[:,:, 0] < be2[:,:, 0]) ^ (be1[:,:, 1] < be2[:,:, 1])
#mask1 = ~mask1
rb = torch.min(be1[:,:,2:], be2[:,:,2:])
#mask2 = (be1[:,:, 2] < be2[:,:, 2]) ^ (be1[:,:, 3] < be2[:,:, 3])
#mask2 = ~mask2
delta = rb - lt
delta[delta < 0] = 0
intersect = delta[:,:,0]*delta[:,:,1]
#*mask1.float()*mask2.float()
delta1 = be1[:,:,2:] - be1[:,:,:2]
area1 = delta1[:,:,0]*delta1[:,:,1]
delta2 = be2[:,:,2:] - be2[:,:,:2]
area2 = delta2[:,:,0]*delta2[:,:,1]
iou = intersect/(area1 + area2 - intersect)
return iou
# This class is from https://github.com/chauhan-utk/ssd.DomainAdaptation
class SSDCropping(object):
""" Cropping for SSD, according to original paper
Choose between following 3 conditions:
1. Preserve the original image
2. Random crop minimum IoU is among 0.1, 0.3, 0.5, 0.7, 0.9
3. Random crop
Reference to https://github.com/chauhan-utk/ssd.DomainAdaptation
"""
def __init__(self):
self.sample_options = (
# Do nothing
None,
# min IoU, max IoU
(0.1, None),
(0.3, None),
(0.5, None),
(0.7, None),
(0.9, None),
# no IoU requirements
(None, None),
)
# Implementation uses 1 iteration to find a possible candidate, this
# was shown to produce the same mAP as using more iterations.
self.num_cropping_iterations = 1
log_event(key=constants.MAX_SAMPLES,
value=self.num_cropping_iterations)
def __call__(self, img, img_size, bboxes, labels):
# Ensure always return cropped image
while True:
mode = random.choice(self.sample_options)
if mode is None:
return img, img_size, bboxes, labels
htot, wtot = img_size
min_iou, max_iou = mode
min_iou = float("-inf") if min_iou is None else min_iou
max_iou = float("+inf") if max_iou is None else max_iou
# Implementation use 50 iteration to find possible candidate
for _ in range(self.num_cropping_iterations):
# suze of each sampled path in [0.1, 1] 0.3*0.3 approx. 0.1
w = random.uniform(0.3 , 1.0)
h = random.uniform(0.3 , 1.0)
if w/h < 0.5 or w/h > 2:
continue
# left 0 ~ wtot - w, top 0 ~ htot - h
left = random.uniform(0, 1.0 - w)
top = random.uniform(0, 1.0 - h)
right = left + w
bottom = top + h
ious = calc_iou_tensor(bboxes, torch.tensor([[left, top, right, bottom]]))
# tailor all the bboxes and return
if not ((ious > min_iou) & (ious < max_iou)).all():
continue
# discard any bboxes whose center not in the cropped image
xc = 0.5*(bboxes[:, 0] + bboxes[:, 2])
yc = 0.5*(bboxes[:, 1] + bboxes[:, 3])
masks = (xc > left) & (xc < right) & (yc > top) & (yc < bottom)
# if no such boxes, continue searching again
if not masks.any():
continue
bboxes[bboxes[:, 0] < left, 0] = left
bboxes[bboxes[:, 1] < top, 1] = top
bboxes[bboxes[:, 2] > right, 2] = right
bboxes[bboxes[:, 3] > bottom, 3] = bottom
#print(left, top, right, bottom)
#print(labels, bboxes, masks)
bboxes = bboxes[masks, :]
labels = labels[masks]
left_idx = int(left*wtot)
top_idx = int(top*htot)
right_idx = int(right*wtot)
bottom_idx = int(bottom*htot)
#print(left_idx,top_idx,right_idx,bottom_idx)
#img = img[:, top_idx:bottom_idx, left_idx:right_idx]
img = img.crop((left_idx, top_idx, right_idx, bottom_idx))
bboxes[:, 0] = (bboxes[:, 0] - left)/w
bboxes[:, 1] = (bboxes[:, 1] - top)/h
bboxes[:, 2] = (bboxes[:, 2] - left)/w
bboxes[:, 3] = (bboxes[:, 3] - top)/h
htot = bottom_idx - top_idx
wtot = right_idx - left_idx
return img, (htot, wtot), bboxes, labels
# Don't need to cast to float, already there (from FusedColorJitter)
class ToTensor(object):
def __init__(self):
pass
def __call__(self, img):
img = torch.Tensor(np.array(img))
# Transform from HWC to CHW
img = img.permute(2, 0 ,1).div(255)
return img
class RandomHorizontalFlip(object):
def __init__(self, p=0.5):
self.p = p
def __call__(self, image, bboxes):
if random.random() < self.p:
bboxes[:, 0], bboxes[:, 2] = 1.0 - bboxes[:, 2], 1.0 - bboxes[:, 0]
return image.transpose(Image.FLIP_LEFT_RIGHT), bboxes
return image, bboxes
# Do data augumentation
class SSDTransformer(object):
""" SSD Data Augumentation, according to original paper
Composed by several steps:
Cropping
Resize
Flipping
Jittering
"""
def __init__(self, size = (300, 300), val=False):
# define vgg16 mean
self.size = size
self.val = val
self.crop = SSDCropping()
self.img_trans = transforms.Compose([
transforms.Resize(self.size),
#transforms.ColorJitter(brightness=0.125, contrast=0.5,
# saturation=0.5, hue=0.05
#),
#transforms.ToTensor(),
FusedColorJitter(),
ToTensor(),
])
self.hflip = RandomHorizontalFlip()
# All Pytorch Tensor will be normalized
# https://discuss.pytorch.org/t/how-to-preprocess-input-for-pre-trained-networks/683
normalization_mean = [0.485, 0.456, 0.406]
normalization_std = [0.229, 0.224, 0.225]
self.normalize = transforms.Normalize(mean=normalization_mean,
std=normalization_std)
self.trans_val = transforms.Compose([
transforms.Resize(self.size),
transforms.ToTensor(),
self.normalize,])
def __call__(self, img, img_size, bbox=None, label=None, max_num=200):
#img = torch.tensor(img)
if self.val:
bbox_out = torch.zeros(max_num, 4)
label_out = torch.zeros(max_num, dtype=torch.long)
bbox_out[:bbox.size(0), :] = bbox
label_out[:label.size(0)] = label
return self.trans_val(img), img_size, bbox_out, label_out
# random crop
img, img_size, bbox, label = self.crop(img, img_size, bbox, label)
# random horiz. flip
img, bbox = self.hflip(img, bbox)
# [Resize, ColorJitter, ToTensor]
img = self.img_trans(img).contiguous()
img = self.normalize(img)
return img, img_size, bbox, label
# Implement a datareader for COCO dataset
class COCODetection(data.Dataset):
def __init__(self, img_folder, annotate_file, transform=None, data=None):
self.img_folder = img_folder
self.annotate_file = annotate_file
if data:
self.data = data
else:
# Start processing annotation
with open(annotate_file) as fin:
# loading huge json files tends to cause the gc (cycle collector) to
# waste a lot of time so:
gc_old = gc.isenabled()
gc.disable()
self.data = json.load(fin)
if gc_old: gc.enable()
self.images = {}
self.label_map = {}
self.label_info = {}
#print("Parsing COCO data...")
start_time = time.time()
# 0 stand for the background
cnt = 0
self.label_info[cnt] = "background"
for cat in self.data["categories"]:
cnt += 1
self.label_map[cat["id"]] = cnt
self.label_info[cnt] = cat["name"]
# build inference for images
for img in self.data["images"]:
img_id = img["id"]
img_name = img["file_name"]
img_size = (img["height"],img["width"])
#print(img_name)
if img_id in self.images: raise Exception("dulpicated image record")
self.images[img_id] = (img_name, img_size, [])
# read bboxes
for bboxes in self.data["annotations"]:
img_id = bboxes["image_id"]
category_id = bboxes["category_id"]
bbox = bboxes["bbox"]
bbox_label = self.label_map[bboxes["category_id"]]
self.images[img_id][2].append((bbox, bbox_label))
for k, v in list(self.images.items()):
if len(v[2]) == 0:
#print("empty image: {}".format(k))
self.images.pop(k)
self.img_keys = list(self.images.keys())
self.transform = transform
#print("End parsing COCO data, total time {}".format(time.time()-start_time))
@property
def labelnum(self):
return len(self.label_info)
@staticmethod
def load(pklfile):
#print("Loading from {}".format(pklfile))
with bz2.open(pklfile, "rb") as fin:
ret = pickle.load(fin)
return ret
def save(self, pklfile):
#print("Saving to {}".format(pklfile))
with bz2.open(pklfile, "wb") as fout:
pickle.dump(self, fout)
def __len__(self):
return len(self.images)
def __getitem__(self, idx):
img_id = self.img_keys[idx]
img_data = self.images[img_id]
fn = img_data[0]
img_path = os.path.join(self.img_folder, fn)
s = time.time()
img = Image.open(img_path).convert("RGB")
e = time.time()
decode_time = e - s
htot, wtot = img_data[1]
bbox_sizes = []
bbox_labels = []
#for (xc, yc, w, h), bbox_label in img_data[2]:
for (l,t,w,h), bbox_label in img_data[2]:
r = l + w
b = t + h
#l, t, r, b = xc - 0.5*w, yc - 0.5*h, xc + 0.5*w, yc + 0.5*h
bbox_size = (l/wtot, t/htot, r/wtot, b/htot)
# filter out zero-size bboxes
if l == r or t == b:
continue
bbox_sizes.append(bbox_size)
bbox_labels.append(bbox_label)
bbox_sizes = torch.tensor(bbox_sizes)
bbox_labels = torch.tensor(bbox_labels)
s = time.time()
if self.transform != None:
img, (htot, wtot), bbox_sizes, bbox_labels = \
self.transform(img, (htot, wtot), bbox_sizes, bbox_labels)
else:
pass # img = transforms.ToTensor()(img)
return img, img_id, (htot, wtot), bbox_sizes, bbox_labels
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
341,
1806,
19245,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29947,
413,
29884,
574,
492,
29884,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
29937,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
29937,
13,
29937,
341,
1806,
19245,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
529,
5813,
10202,
529,
5813,
29958,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
29937,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
29899,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29947,
29899,
29906,
29900,
29896,
29929,
29892,
405,
13044,
10764,
315,
1955,
29925,
1955,
8098,
29889,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
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,
5215,
4842,
305,
13,
5215,
4842,
305,
4924,
13,
5215,
4842,
305,
4924,
29889,
9067,
29879,
408,
4327,
29879,
13,
5215,
4842,
305,
29889,
13239,
29889,
1272,
408,
848,
13,
3166,
349,
6227,
1053,
7084,
13,
3166,
4903,
29889,
300,
929,
1053,
10619,
9643,
13,
5215,
2897,
13,
5215,
13149,
13,
3166,
2224,
1982,
1053,
10802,
13,
5215,
12655,
408,
7442,
13,
5215,
4036,
13,
5215,
4256,
8504,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
2202,
29901,
13,
1678,
1053,
318,
3126,
408,
4390,
13,
19499,
16032,
2392,
29901,
13,
1678,
1053,
4390,
13,
5215,
330,
29883,
13,
5215,
931,
13,
5215,
289,
29920,
29906,
13,
5215,
5839,
280,
13,
3166,
5844,
1053,
18074,
2273,
29892,
2257,
309,
29892,
6776,
29892,
4457,
29892,
2930,
13,
3166,
286,
29880,
546,
29888,
29918,
21027,
29889,
828,
1188,
1053,
17727,
13,
3166,
286,
29880,
546,
29888,
29918,
21707,
1053,
1480,
29918,
3696,
13,
13,
3166,
5886,
29928,
1053,
903,
29907,
408,
315,
13,
13,
3166,
285,
3880,
29918,
2780,
29918,
29926,
5171,
1053,
383,
3880,
3306,
29967,
5171,
13,
13,
29937,
910,
740,
338,
515,
2045,
597,
3292,
29889,
510,
29914,
2120,
574,
492,
29884,
29914,
2272,
7345,
305,
29899,
893,
29881,
13,
1753,
22235,
29918,
29875,
283,
29918,
20158,
29898,
1884,
29896,
29892,
3800,
29906,
1125,
13,
1678,
9995,
20535,
362,
310,
22244,
29965,
2729,
373,
1023,
16273,
12489,
29892,
13,
4706,
12105,
304,
2045,
597,
3292,
29889,
510,
29914,
2120,
574,
492,
29884,
29914,
2272,
7345,
305,
29899,
893,
29881,
13,
4706,
1881,
29901,
13,
9651,
3800,
29896,
313,
29940,
29892,
29871,
29946,
29897,
13,
9651,
3800,
29906,
313,
29924,
29892,
29871,
29946,
29897,
13,
4706,
1962,
29901,
13,
9651,
22244,
29965,
313,
29940,
29892,
341,
29897,
13,
1678,
9995,
13,
1678,
405,
353,
3800,
29896,
29889,
2311,
29898,
29900,
29897,
13,
1678,
341,
353,
3800,
29906,
29889,
2311,
29898,
29900,
29897,
13,
13,
1678,
367,
29896,
353,
3800,
29896,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
6278,
29896,
29892,
341,
29892,
448,
29896,
29897,
13,
1678,
367,
29906,
353,
3800,
29906,
29889,
6948,
802,
29872,
911,
29898,
29900,
467,
18837,
29898,
29940,
29892,
448,
29896,
29892,
448,
29896,
29897,
13,
13,
1678,
396,
19941,
7488,
669,
10428,
350,
3570,
13,
1678,
301,
29873,
353,
4842,
305,
29889,
3317,
29898,
915,
29896,
7503,
29892,
29901,
29892,
29901,
29906,
1402,
367,
29906,
7503,
29892,
29901,
29892,
29901,
29906,
2314,
13,
1678,
396,
13168,
29896,
353,
313,
915,
29896,
7503,
29892,
29901,
29892,
29871,
29900,
29962,
529,
367,
29906,
7503,
29892,
29901,
29892,
29871,
29900,
2314,
6228,
313,
915,
29896,
7503,
29892,
29901,
29892,
29871,
29896,
29962,
529,
367,
29906,
7503,
29892,
29901,
29892,
29871,
29896,
2314,
13,
1678,
396,
13168,
29896,
353,
3695,
13168,
29896,
13,
1678,
364,
29890,
353,
4842,
305,
29889,
1195,
29898,
915,
29896,
7503,
29892,
29901,
29892,
29906,
29901,
1402,
367,
29906,
7503,
29892,
29901,
29892,
29906,
29901,
2314,
13,
1678,
396,
13168,
29906,
353,
313,
915,
29896,
7503,
29892,
29901,
29892,
29871,
29906,
29962,
529,
367,
29906,
7503,
29892,
29901,
29892,
29871,
29906,
2314,
6228,
313,
915,
29896,
7503,
29892,
29901,
29892,
29871,
29941,
29962,
529,
367,
29906,
7503,
29892,
29901,
29892,
29871,
29941,
2314,
13,
1678,
396,
13168,
29906,
353,
3695,
13168,
29906,
13,
13,
1678,
19471,
353,
364,
29890,
448,
301,
29873,
13,
1678,
19471,
29961,
4181,
529,
29871,
29900,
29962,
353,
29871,
29900,
13,
1678,
25869,
353,
19471,
7503,
29892,
29901,
29892,
29900,
14178,
4181,
7503,
29892,
29901,
29892,
29896,
29962,
13,
1678,
396,
29930,
13168,
29896,
29889,
7411,
580,
29930,
13168,
29906,
29889,
7411,
580,
13,
13,
1678,
19471,
29896,
353,
367,
29896,
7503,
29892,
29901,
29892,
29906,
17531,
448,
367,
29896,
7503,
29892,
29901,
29892,
29901,
29906,
29962,
13,
1678,
4038,
29896,
353,
19471,
29896,
7503,
29892,
29901,
29892,
29900,
14178,
4181,
29896,
7503,
29892,
29901,
29892,
29896,
29962,
13,
1678,
19471,
29906,
353,
367,
29906,
7503,
29892,
29901,
29892,
29906,
17531,
448,
367,
29906,
7503,
29892,
29901,
29892,
29901,
29906,
29962,
13,
1678,
4038,
29906,
353,
19471,
29906,
7503,
29892,
29901,
29892,
29900,
14178,
4181,
29906,
7503,
29892,
29901,
29892,
29896,
29962,
13,
13,
1678,
474,
283,
353,
25869,
14571,
6203,
29896,
718,
4038,
29906,
448,
25869,
29897,
13,
1678,
736,
474,
283,
13,
13,
29937,
910,
770,
338,
515,
2045,
597,
3292,
29889,
510,
29914,
305,
585,
5403,
29899,
329,
29895,
29914,
893,
29881,
29889,
15951,
29909,
1388,
415,
362,
13,
1990,
5886,
12696,
307,
3262,
29898,
3318,
1125,
13,
1678,
9995,
8764,
3262,
363,
5886,
29928,
29892,
5034,
304,
2441,
5650,
13,
4706,
14542,
852,
1546,
1494,
29871,
29941,
5855,
29901,
13,
308,
29896,
29889,
4360,
7143,
278,
2441,
1967,
13,
308,
29906,
29889,
16968,
274,
1336,
9212,
22244,
29965,
338,
4249,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29955,
29892,
29871,
29900,
29889,
29929,
13,
308,
29941,
29889,
16968,
274,
1336,
13,
4706,
12105,
304,
2045,
597,
3292,
29889,
510,
29914,
305,
585,
5403,
29899,
329,
29895,
29914,
893,
29881,
29889,
15951,
29909,
1388,
415,
362,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
13,
4706,
1583,
29889,
11249,
29918,
6768,
353,
313,
13,
9651,
396,
1938,
3078,
13,
9651,
6213,
29892,
13,
9651,
396,
1375,
22244,
29965,
29892,
4236,
22244,
29965,
13,
9651,
313,
29900,
29889,
29896,
29892,
6213,
511,
13,
9651,
313,
29900,
29889,
29941,
29892,
6213,
511,
13,
9651,
313,
29900,
29889,
29945,
29892,
6213,
511,
13,
9651,
313,
29900,
29889,
29955,
29892,
6213,
511,
13,
9651,
313,
29900,
29889,
29929,
29892,
6213,
511,
13,
9651,
396,
694,
22244,
29965,
11780,
13,
9651,
313,
8516,
29892,
6213,
511,
13,
4706,
1723,
13,
4706,
396,
1954,
14607,
3913,
29871,
29896,
12541,
304,
1284,
263,
1950,
14020,
29892,
445,
13,
4706,
396,
471,
4318,
304,
7738,
278,
1021,
286,
3301,
408,
773,
901,
24372,
29889,
13,
4706,
1583,
29889,
1949,
29918,
24077,
3262,
29918,
1524,
800,
353,
29871,
29896,
13,
4706,
1480,
29918,
3696,
29898,
1989,
29922,
3075,
1934,
29889,
12648,
29918,
8132,
3580,
17101,
29892,
13,
462,
29871,
995,
29922,
1311,
29889,
1949,
29918,
24077,
3262,
29918,
1524,
800,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10153,
29892,
10153,
29918,
2311,
29892,
289,
1884,
267,
29892,
11073,
1125,
13,
13,
4706,
396,
22521,
545,
2337,
736,
8182,
2986,
1967,
13,
4706,
1550,
5852,
29901,
13,
9651,
4464,
353,
4036,
29889,
16957,
29898,
1311,
29889,
11249,
29918,
6768,
29897,
13,
13,
9651,
565,
4464,
338,
6213,
29901,
13,
18884,
736,
10153,
29892,
10153,
29918,
2311,
29892,
289,
1884,
267,
29892,
11073,
13,
13,
9651,
298,
4260,
29892,
281,
4260,
353,
10153,
29918,
2311,
13,
13,
9651,
1375,
29918,
29875,
283,
29892,
4236,
29918,
29875,
283,
353,
4464,
13,
9651,
1375,
29918,
29875,
283,
353,
5785,
703,
29899,
7192,
1159,
565,
1375,
29918,
29875,
283,
338,
6213,
1683,
1375,
29918,
29875,
283,
13,
9651,
4236,
29918,
29875,
283,
353,
5785,
703,
29974,
7192,
1159,
565,
4236,
29918,
29875,
283,
338,
6213,
1683,
4236,
29918,
29875,
283,
13,
13,
9651,
396,
1954,
14607,
671,
29871,
29945,
29900,
12541,
304,
1284,
1950,
14020,
13,
9651,
363,
903,
297,
3464,
29898,
1311,
29889,
1949,
29918,
24077,
3262,
29918,
1524,
800,
1125,
13,
18884,
396,
480,
911,
310,
1269,
4559,
29881,
2224,
297,
518,
29900,
29889,
29896,
29892,
29871,
29896,
29962,
29871,
29900,
29889,
29941,
29930,
29900,
29889,
29941,
2134,
29916,
29889,
29871,
29900,
29889,
29896,
13,
18884,
281,
353,
4036,
29889,
29590,
29898,
29900,
29889,
29941,
1919,
29871,
29896,
29889,
29900,
29897,
13,
18884,
298,
353,
4036,
29889,
29590,
29898,
29900,
29889,
29941,
1919,
29871,
29896,
29889,
29900,
29897,
13,
13,
18884,
565,
281,
29914,
29882,
529,
29871,
29900,
29889,
29945,
470,
281,
29914,
29882,
1405,
29871,
29906,
29901,
13,
462,
1678,
6773,
13,
13,
18884,
396,
2175,
29871,
29900,
3695,
281,
4260,
448,
281,
29892,
2246,
29871,
29900,
3695,
298,
4260,
448,
298,
13,
18884,
2175,
353,
4036,
29889,
29590,
29898,
29900,
29892,
29871,
29896,
29889,
29900,
448,
281,
29897,
13,
18884,
2246,
353,
4036,
29889,
29590,
29898,
29900,
29892,
29871,
29896,
29889,
29900,
448,
298,
29897,
13,
13,
18884,
1492,
353,
2175,
718,
281,
13,
18884,
5970,
353,
2246,
718,
298,
13,
13,
18884,
474,
681,
353,
22235,
29918,
29875,
283,
29918,
20158,
29898,
29890,
1884,
267,
29892,
4842,
305,
29889,
20158,
4197,
29961,
1563,
29892,
2246,
29892,
1492,
29892,
5970,
5262,
876,
13,
13,
18884,
396,
12464,
272,
599,
278,
289,
1884,
267,
322,
736,
13,
18884,
565,
451,
5135,
2738,
1405,
1375,
29918,
29875,
283,
29897,
669,
313,
2738,
529,
4236,
29918,
29875,
283,
8106,
497,
7295,
13,
462,
1678,
6773,
13,
13,
18884,
396,
2313,
538,
738,
289,
1884,
267,
5069,
4818,
451,
297,
278,
8182,
2986,
1967,
13,
18884,
921,
29883,
353,
29871,
29900,
29889,
29945,
16395,
29890,
1884,
267,
7503,
29892,
29871,
29900,
29962,
718,
289,
1884,
267,
7503,
29892,
29871,
29906,
2314,
13,
18884,
343,
29883,
353,
29871,
29900,
29889,
29945,
16395,
29890,
1884,
267,
7503,
29892,
29871,
29896,
29962,
718,
289,
1884,
267,
7503,
29892,
29871,
29941,
2314,
13,
13,
18884,
11105,
29879,
353,
313,
21791,
1405,
2175,
29897,
669,
313,
21791,
529,
1492,
29897,
669,
313,
11078,
1405,
2246,
29897,
669,
313,
11078,
529,
5970,
29897,
13,
13,
18884,
396,
565,
694,
1316,
16273,
29892,
6773,
11975,
1449,
13,
18884,
565,
451,
11105,
29879,
29889,
1384,
7295,
13,
462,
1678,
6773,
13,
13,
18884,
289,
1884,
267,
29961,
29890,
1884,
267,
7503,
29892,
29871,
29900,
29962,
529,
2175,
29892,
29871,
29900,
29962,
353,
2175,
13,
18884,
289,
1884,
267,
29961,
29890,
1884,
267,
7503,
29892,
29871,
29896,
29962,
529,
2246,
29892,
29871,
29896,
29962,
353,
2246,
13,
18884,
289,
1884,
267,
29961,
29890,
1884,
267,
7503,
29892,
29871,
29906,
29962,
1405,
1492,
29892,
29871,
29906,
29962,
353,
1492,
13,
18884,
289,
1884,
267,
29961,
29890,
1884,
267,
7503,
29892,
29871,
29941,
29962,
1405,
5970,
29892,
29871,
29941,
29962,
353,
5970,
13,
13,
18884,
396,
2158,
29898,
1563,
29892,
2246,
29892,
1492,
29892,
5970,
29897,
13,
18884,
396,
2158,
29898,
21134,
29892,
289,
1884,
267,
29892,
11105,
29879,
29897,
13,
18884,
289,
1884,
267,
353,
289,
1884,
267,
29961,
13168,
29879,
29892,
584,
29962,
13,
18884,
11073,
353,
11073,
29961,
13168,
29879,
29962,
13,
13,
18884,
2175,
29918,
13140,
353,
938,
29898,
1563,
29930,
29893,
4260,
29897,
13,
18884,
2246,
29918,
13140,
353,
29871,
938,
29898,
3332,
29930,
400,
327,
29897,
13,
18884,
1492,
29918,
13140,
353,
938,
29898,
1266,
29930,
29893,
4260,
29897,
13,
18884,
5970,
29918,
13140,
353,
938,
29898,
8968,
29930,
400,
327,
29897,
13,
18884,
396,
2158,
29898,
1563,
29918,
13140,
29892,
3332,
29918,
13140,
29892,
1266,
29918,
13140,
29892,
8968,
29918,
13140,
29897,
13,
18884,
396,
2492,
353,
10153,
7503,
29892,
2246,
29918,
13140,
29901,
8968,
29918,
13140,
29892,
2175,
29918,
13140,
29901,
1266,
29918,
13140,
29962,
13,
18884,
10153,
353,
10153,
29889,
29883,
1336,
3552,
1563,
29918,
13140,
29892,
2246,
29918,
13140,
29892,
1492,
29918,
13140,
29892,
5970,
29918,
13140,
876,
13,
13,
18884,
289,
1884,
267,
7503,
29892,
29871,
29900,
29962,
353,
313,
29890,
1884,
267,
7503,
29892,
29871,
29900,
29962,
448,
2175,
6802,
29893,
13,
18884,
289,
1884,
267,
7503,
29892,
29871,
29896,
29962,
353,
313,
29890,
1884,
267,
7503,
29892,
29871,
29896,
29962,
448,
2246,
6802,
29882,
13,
18884,
289,
1884,
267,
7503,
29892,
29871,
29906,
29962,
353,
313,
29890,
1884,
267,
7503,
29892,
29871,
29906,
29962,
448,
2175,
6802,
29893,
13,
18884,
289,
1884,
267,
7503,
29892,
29871,
29941,
29962,
353,
313,
29890,
1884,
267,
7503,
29892,
29871,
29941,
29962,
448,
2246,
6802,
29882,
13,
13,
18884,
298,
4260,
353,
5970,
29918,
13140,
448,
2246,
29918,
13140,
13,
18884,
281,
4260,
353,
1492,
29918,
13140,
448,
2175,
29918,
13140,
13,
18884,
736,
10153,
29892,
313,
400,
327,
29892,
281,
4260,
511,
289,
1884,
267,
29892,
11073,
13,
13,
29937,
3872,
29915,
29873,
817,
304,
4320,
304,
5785,
29892,
2307,
727,
313,
3166,
383,
3880,
3306,
29967,
5171,
29897,
13,
1990,
1763,
29911,
6073,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10153,
1125,
13,
4706,
10153,
353,
4842,
305,
29889,
29911,
6073,
29898,
9302,
29889,
2378,
29898,
2492,
876,
13,
4706,
396,
4103,
689,
515,
379,
29956,
29907,
304,
5868,
29956,
13,
4706,
10153,
353,
10153,
29889,
17858,
1082,
29898,
29906,
29892,
29871,
29900,
1919,
29896,
467,
4563,
29898,
29906,
29945,
29945,
29897,
13,
4706,
736,
10153,
13,
13,
1990,
16968,
24932,
29943,
3466,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
282,
29922,
29900,
29889,
29945,
1125,
13,
4706,
1583,
29889,
29886,
353,
282,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
1967,
29892,
289,
1884,
267,
1125,
13,
4706,
565,
4036,
29889,
8172,
580,
529,
1583,
29889,
29886,
29901,
13,
9651,
289,
1884,
267,
7503,
29892,
29871,
29900,
1402,
289,
1884,
267,
7503,
29892,
29871,
29906,
29962,
353,
29871,
29896,
29889,
29900,
448,
289,
1884,
267,
7503,
29892,
29871,
29906,
1402,
29871,
29896,
29889,
29900,
448,
289,
1884,
267,
7503,
29892,
29871,
29900,
29962,
13,
9651,
736,
1967,
29889,
3286,
4220,
29898,
2940,
29889,
29943,
5265,
29925,
29918,
28024,
29918,
22789,
3912,
511,
289,
1884,
267,
13,
4706,
736,
1967,
29892,
289,
1884,
267,
13,
13,
29937,
1938,
848,
11307,
942,
362,
13,
1990,
5886,
29928,
13372,
261,
29898,
3318,
1125,
13,
1678,
9995,
5886,
29928,
3630,
22333,
942,
362,
29892,
5034,
304,
2441,
5650,
13,
4706,
422,
4752,
491,
3196,
6576,
29901,
13,
4706,
8764,
3262,
13,
4706,
2538,
675,
13,
4706,
383,
492,
3262,
13,
4706,
435,
5171,
292,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2159,
353,
313,
29941,
29900,
29900,
29892,
29871,
29941,
29900,
29900,
511,
659,
29922,
8824,
1125,
13,
13,
4706,
396,
4529,
325,
1505,
29896,
29953,
2099,
13,
4706,
1583,
29889,
2311,
353,
2159,
13,
4706,
1583,
29889,
791,
353,
659,
13,
13,
4706,
1583,
29889,
29883,
1336,
353,
5886,
12696,
307,
3262,
580,
13,
4706,
1583,
29889,
2492,
29918,
3286,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
9651,
4327,
29879,
29889,
1666,
675,
29898,
1311,
29889,
2311,
511,
13,
9651,
396,
9067,
29879,
29889,
3306,
29967,
5171,
29898,
1182,
523,
2264,
29922,
29900,
29889,
29896,
29906,
29945,
29892,
12814,
29922,
29900,
29889,
29945,
29892,
13,
9651,
396,
1678,
269,
1337,
362,
29922,
29900,
29889,
29945,
29892,
298,
434,
29922,
29900,
29889,
29900,
29945,
13,
9651,
396,
511,
13,
9651,
396,
9067,
29879,
29889,
1762,
29911,
6073,
3285,
13,
9651,
383,
3880,
3306,
29967,
5171,
3285,
13,
9651,
1763,
29911,
6073,
3285,
13,
308,
2314,
13,
4706,
1583,
29889,
29882,
29888,
3466,
353,
16968,
24932,
29943,
3466,
580,
13,
13,
4706,
396,
2178,
349,
3637,
25350,
323,
6073,
674,
367,
4226,
1891,
13,
4706,
396,
2045,
597,
2218,
13571,
29889,
2272,
7345,
305,
29889,
990,
29914,
29873,
29914,
3525,
29899,
517,
29899,
1457,
5014,
29899,
2080,
29899,
1454,
29899,
1457,
29899,
3018,
1312,
29899,
11618,
29879,
29914,
29953,
29947,
29941,
13,
13,
4706,
4226,
2133,
29918,
12676,
353,
518,
29900,
29889,
29946,
29947,
29945,
29892,
29871,
29900,
29889,
29946,
29945,
29953,
29892,
29871,
29900,
29889,
29946,
29900,
29953,
29962,
13,
4706,
4226,
2133,
29918,
4172,
353,
518,
29900,
29889,
29906,
29906,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29946,
29892,
29871,
29900,
29889,
29906,
29906,
29945,
29962,
13,
4706,
1583,
29889,
8945,
675,
353,
4327,
29879,
29889,
19077,
675,
29898,
12676,
29922,
8945,
2133,
29918,
12676,
29892,
13,
462,
462,
795,
3659,
29922,
8945,
2133,
29918,
4172,
29897,
13,
13,
4706,
1583,
29889,
3286,
29918,
791,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
9651,
4327,
29879,
29889,
1666,
675,
29898,
1311,
29889,
2311,
511,
13,
9651,
4327,
29879,
29889,
1762,
29911,
6073,
3285,
13,
9651,
1583,
29889,
8945,
675,
29892,
2314,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10153,
29892,
10153,
29918,
2311,
29892,
289,
1884,
29922,
8516,
29892,
3858,
29922,
8516,
29892,
4236,
29918,
1949,
29922,
29906,
29900,
29900,
1125,
13,
4706,
396,
2492,
353,
4842,
305,
29889,
20158,
29898,
2492,
29897,
13,
4706,
565,
1583,
29889,
791,
29901,
13,
9651,
289,
1884,
29918,
449,
353,
4842,
305,
29889,
3298,
359,
29898,
3317,
29918,
1949,
29892,
29871,
29946,
29897,
13,
9651,
3858,
29918,
449,
353,
29871,
4842,
305,
29889,
3298,
359,
29898,
3317,
29918,
1949,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29897,
13,
9651,
289,
1884,
29918,
449,
7503,
29890,
1884,
29889,
2311,
29898,
29900,
511,
584,
29962,
353,
289,
1884,
13,
9651,
3858,
29918,
449,
7503,
1643,
29889,
2311,
29898,
29900,
4638,
353,
3858,
13,
9651,
736,
1583,
29889,
3286,
29918,
791,
29898,
2492,
511,
10153,
29918,
2311,
29892,
289,
1884,
29918,
449,
29892,
3858,
29918,
449,
13,
13,
4706,
396,
4036,
274,
1336,
13,
4706,
10153,
29892,
10153,
29918,
2311,
29892,
289,
1884,
29892,
3858,
353,
1583,
29889,
29883,
1336,
29898,
2492,
29892,
10153,
29918,
2311,
29892,
289,
1884,
29892,
3858,
29897,
13,
13,
4706,
396,
4036,
4029,
466,
29889,
285,
3466,
13,
4706,
10153,
29892,
289,
1884,
353,
1583,
29889,
29882,
29888,
3466,
29898,
2492,
29892,
289,
1884,
29897,
13,
13,
4706,
396,
518,
1666,
675,
29892,
9159,
29967,
5171,
29892,
1763,
29911,
6073,
29962,
13,
4706,
10153,
353,
1583,
29889,
2492,
29918,
3286,
29898,
2492,
467,
1285,
5526,
681,
580,
13,
13,
4706,
10153,
353,
1583,
29889,
8945,
675,
29898,
2492,
29897,
13,
13,
4706,
736,
10153,
29892,
10153,
29918,
2311,
29892,
289,
1884,
29892,
3858,
13,
13,
29937,
1954,
2037,
263,
848,
16950,
363,
4810,
3217,
8783,
13,
1990,
4810,
3217,
29928,
2650,
428,
29898,
1272,
29889,
16390,
24541,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10153,
29918,
12083,
29892,
9732,
403,
29918,
1445,
29892,
4327,
29922,
8516,
29892,
848,
29922,
8516,
1125,
13,
4706,
1583,
29889,
2492,
29918,
12083,
353,
10153,
29918,
12083,
13,
4706,
1583,
29889,
6735,
403,
29918,
1445,
353,
9732,
403,
29918,
1445,
13,
13,
4706,
565,
848,
29901,
13,
9651,
1583,
29889,
1272,
353,
848,
13,
4706,
1683,
29901,
13,
9651,
396,
7370,
9068,
17195,
13,
9651,
411,
1722,
29898,
6735,
403,
29918,
1445,
29897,
408,
1436,
29901,
13,
18884,
396,
8363,
12176,
4390,
2066,
29867,
304,
4556,
278,
330,
29883,
313,
23090,
6314,
272,
29897,
304,
13,
18884,
396,
19863,
263,
3287,
310,
931,
577,
29901,
13,
18884,
330,
29883,
29918,
1025,
353,
330,
29883,
29889,
7674,
3606,
580,
13,
18884,
330,
29883,
29889,
20472,
580,
13,
13,
18884,
1583,
29889,
1272,
353,
4390,
29889,
1359,
29898,
4951,
29897,
13,
13,
18884,
565,
330,
29883,
29918,
1025,
29901,
330,
29883,
29889,
12007,
580,
13,
13,
4706,
1583,
29889,
8346,
353,
6571,
13,
13,
4706,
1583,
29889,
1643,
29918,
1958,
353,
6571,
13,
4706,
1583,
29889,
1643,
29918,
3888,
353,
6571,
13,
4706,
396,
2158,
703,
29925,
1503,
292,
4810,
3217,
848,
856,
1159,
13,
4706,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
396,
29871,
29900,
2317,
363,
278,
3239,
13,
4706,
274,
593,
353,
29871,
29900,
13,
4706,
1583,
29889,
1643,
29918,
3888,
29961,
20047,
29962,
353,
376,
7042,
29908,
13,
4706,
363,
6635,
297,
1583,
29889,
1272,
3366,
20683,
3108,
29901,
13,
9651,
274,
593,
4619,
29871,
29896,
13,
9651,
1583,
29889,
1643,
29918,
1958,
29961,
4117,
3366,
333,
3108,
29962,
353,
274,
593,
13,
9651,
1583,
29889,
1643,
29918,
3888,
29961,
20047,
29962,
353,
6635,
3366,
978,
3108,
13,
13,
4706,
396,
2048,
27262,
363,
4558,
13,
4706,
363,
10153,
297,
1583,
29889,
1272,
3366,
8346,
3108,
29901,
13,
9651,
10153,
29918,
333,
353,
10153,
3366,
333,
3108,
13,
9651,
10153,
29918,
978,
353,
10153,
3366,
1445,
29918,
978,
3108,
13,
9651,
10153,
29918,
2311,
353,
313,
2492,
3366,
3545,
12436,
2492,
3366,
2103,
20068,
13,
9651,
396,
2158,
29898,
2492,
29918,
978,
29897,
13,
9651,
565,
10153,
29918,
333,
297,
1583,
29889,
8346,
29901,
12020,
8960,
703,
29881,
15323,
293,
630,
1967,
2407,
1159,
13,
9651,
1583,
29889,
8346,
29961,
2492,
29918,
333,
29962,
353,
313,
2492,
29918,
978,
29892,
10153,
29918,
2311,
29892,
518,
2314,
13,
13,
4706,
396,
1303,
289,
1884,
267,
13,
4706,
363,
289,
1884,
267,
297,
1583,
29889,
1272,
3366,
6735,
800,
3108,
29901,
13,
9651,
10153,
29918,
333,
353,
289,
1884,
267,
3366,
3027,
29918,
333,
3108,
13,
9651,
7663,
29918,
333,
353,
289,
1884,
267,
3366,
7320,
29918,
333,
3108,
13,
9651,
289,
1884,
353,
289,
1884,
267,
3366,
29890,
1884,
3108,
13,
9651,
289,
1884,
29918,
1643,
353,
1583,
29889,
1643,
29918,
1958,
29961,
29890,
1884,
267,
3366,
7320,
29918,
333,
3108,
29962,
13,
9651,
1583,
29889,
8346,
29961,
2492,
29918,
333,
3816,
29906,
1822,
4397,
3552,
29890,
1884,
29892,
289,
1884,
29918,
1643,
876,
13,
13,
4706,
363,
413,
29892,
325,
297,
1051,
29898,
1311,
29889,
8346,
29889,
7076,
580,
1125,
13,
9651,
565,
7431,
29898,
29894,
29961,
29906,
2314,
1275,
29871,
29900,
29901,
13,
18884,
396,
2158,
703,
6310,
1967,
29901,
6571,
1642,
4830,
29898,
29895,
876,
13,
18884,
1583,
29889,
8346,
29889,
7323,
29898,
29895,
29897,
13,
13,
4706,
1583,
29889,
2492,
29918,
8149,
353,
1051,
29898,
1311,
29889,
8346,
29889,
8149,
3101,
13,
4706,
1583,
29889,
9067,
353,
4327,
13,
4706,
396,
2158,
703,
5044,
13755,
4810,
3217,
848,
29892,
3001,
931,
6571,
1642,
4830,
29898,
2230,
29889,
2230,
580,
29899,
2962,
29918,
2230,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3858,
1949,
29898,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
1643,
29918,
3888,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2254,
29898,
29886,
6321,
1445,
1125,
13,
4706,
396,
2158,
703,
23456,
515,
6571,
1642,
4830,
29898,
29886,
6321,
1445,
876,
13,
4706,
411,
289,
29920,
29906,
29889,
3150,
29898,
29886,
6321,
1445,
29892,
376,
6050,
1159,
408,
1436,
29901,
13,
9651,
3240,
353,
5839,
280,
29889,
1359,
29898,
4951,
29897,
13,
4706,
736,
3240,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
282,
6321,
1445,
1125,
13,
4706,
396,
2158,
703,
29903,
5555,
304,
6571,
1642,
4830,
29898,
29886,
6321,
1445,
876,
13,
4706,
411,
289,
29920,
29906,
29889,
3150,
29898,
29886,
6321,
1445,
29892,
376,
29893,
29890,
1159,
408,
285,
449,
29901,
13,
9651,
5839,
280,
29889,
15070,
29898,
1311,
29892,
285,
449,
29897,
13,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
8346,
29897,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
22645,
1125,
13,
4706,
10153,
29918,
333,
353,
1583,
29889,
2492,
29918,
8149,
29961,
13140,
29962,
13,
4706,
10153,
29918,
1272,
353,
1583,
29889,
8346,
29961,
2492,
29918,
333,
29962,
13,
4706,
7876,
353,
10153,
29918,
1272,
29961,
29900,
29962,
13,
4706,
10153,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
2492,
29918,
12083,
29892,
7876,
29897,
13,
4706,
269,
353,
931,
29889,
2230,
580,
13,
4706,
10153,
353,
7084,
29889,
3150,
29898,
2492,
29918,
2084,
467,
13441,
703,
28212,
1159,
13,
4706,
321,
353,
931,
29889,
2230,
580,
13,
4706,
21822,
29918,
2230,
353,
321,
448,
269,
13,
13,
4706,
298,
4260,
29892,
281,
4260,
353,
10153,
29918,
1272,
29961,
29896,
29962,
13,
4706,
289,
1884,
29918,
29879,
7093,
353,
5159,
13,
4706,
289,
1884,
29918,
21134,
353,
5159,
13,
13,
4706,
396,
1454,
313,
21791,
29892,
343,
29883,
29892,
281,
29892,
298,
511,
289,
1884,
29918,
1643,
297,
10153,
29918,
1272,
29961,
29906,
5387,
13,
4706,
363,
313,
29880,
29892,
29873,
29892,
29893,
29892,
29882,
511,
289,
1884,
29918,
1643,
297,
10153,
29918,
1272,
29961,
29906,
5387,
13,
9651,
364,
353,
301,
718,
281,
13,
9651,
289,
353,
260,
718,
298,
13,
9651,
396,
29880,
29892,
260,
29892,
364,
29892,
289,
353,
921,
29883,
448,
29871,
29900,
29889,
29945,
29930,
29893,
29892,
343,
29883,
448,
29871,
29900,
29889,
29945,
29930,
29882,
29892,
921,
29883,
718,
29871,
29900,
29889,
29945,
29930,
29893,
29892,
343,
29883,
718,
29871,
29900,
29889,
29945,
29930,
29882,
13,
9651,
289,
1884,
29918,
2311,
353,
313,
29880,
29914,
29893,
4260,
29892,
260,
29914,
400,
327,
29892,
364,
29914,
29893,
4260,
29892,
289,
29914,
400,
327,
29897,
13,
9651,
396,
4175,
714,
5225,
29899,
2311,
289,
1884,
267,
13,
9651,
565,
301,
1275,
364,
470,
260,
1275,
289,
29901,
13,
18884,
6773,
13,
9651,
289,
1884,
29918,
29879,
7093,
29889,
4397,
29898,
29890,
1884,
29918,
2311,
29897,
13,
9651,
289,
1884,
29918,
21134,
29889,
4397,
29898,
29890,
1884,
29918,
1643,
29897,
13,
13,
4706,
289,
1884,
29918,
29879,
7093,
353,
4842,
305,
29889,
20158,
29898,
29890,
1884,
29918,
29879,
7093,
29897,
13,
4706,
289,
1884,
29918,
21134,
353,
29871,
4842,
305,
29889,
20158,
29898,
29890,
1884,
29918,
21134,
29897,
13,
13,
4706,
269,
353,
931,
29889,
2230,
580,
13,
4706,
565,
1583,
29889,
9067,
2804,
6213,
29901,
13,
9651,
10153,
29892,
313,
400,
327,
29892,
281,
4260,
511,
289,
1884,
29918,
29879,
7093,
29892,
289,
1884,
29918,
21134,
353,
320,
13,
18884,
1583,
29889,
9067,
29898,
2492,
29892,
313,
400,
327,
29892,
281,
4260,
511,
289,
1884,
29918,
29879,
7093,
29892,
289,
1884,
29918,
21134,
29897,
13,
4706,
1683,
29901,
13,
9651,
1209,
396,
10153,
353,
4327,
29879,
29889,
1762,
29911,
6073,
580,
29898,
2492,
29897,
13,
13,
4706,
736,
10153,
29892,
10153,
29918,
333,
29892,
313,
400,
327,
29892,
281,
4260,
511,
289,
1884,
29918,
29879,
7093,
29892,
289,
1884,
29918,
21134,
13,
13,
2
] |
world_creator/objects.py | lilSpeedwagon/zaWRka-project | 1 | 48455 | <gh_stars>1-10
#!/usr/bin/env python3
from data_structures import *
import copy
import logging as log
import converter
import math as m
from enum import Enum
import os
APP_VERSION = 1.0
class SignsTypes(Enum):
STOP = "stop sign"
ONLY_FORWARD = "only forward sign"
ONLY_RIGHT = "only right sign"
ONLY_LEFT = "only left sign"
FORWARD_OR_RIGHT = "forward or right sign"
FORWARD_OR_LEFT = "forward or left sign"
class ImagesPaths():
PATH_TO_IMAGE = 'models'
STOP = os.path.join(PATH_TO_IMAGE, 'brick-sign/brick.png')
ONLY_FORWARD = os.path.join(PATH_TO_IMAGE, 'forward-sign/forward.png')
ONLY_LEFT = os.path.join(PATH_TO_IMAGE, 'left-sign/left.png')
ONLY_RIGHT = os.path.join(PATH_TO_IMAGE, 'right-sign/right.png')
FORWARD_OR_LEFT = os.path.join(PATH_TO_IMAGE, 'forward-left-sign/frwd_left.png')
FORWARD_OR_RIGHT = os.path.join(PATH_TO_IMAGE, 'forward-right-sign/frwd_right.png')
def sign_path_to_sign_type(img_path):
if img_path is ImagesPaths.STOP:
return SignsTypes.STOP.value
elif img_path is ImagesPaths.ONLY_FORWARD:
return SignsTypes.ONLY_FORWARD.value
elif img_path is ImagesPaths.ONLY_LEFT:
return SignsTypes.ONLY_LEFT.value
elif img_path is ImagesPaths.ONLY_RIGHT:
return SignsTypes.ONLY_RIGHT.value
elif img_path is ImagesPaths.FORWARD_OR_LEFT:
return SignsTypes.FORWARD_OR_LEFT.value
elif img_path is ImagesPaths.FORWARD_OR_RIGHT:
return SignsTypes.FORWARD_OR_RIGHT.value
else:
return " "
def sign_type_to_sign_path(sign_type):
if sign_type == SignsTypes.STOP.value:
return ImagesPaths.STOP
elif sign_type == SignsTypes.ONLY_FORWARD.value:
return ImagesPaths.ONLY_FORWARD
elif sign_type == SignsTypes.ONLY_LEFT.value:
return ImagesPaths.ONLY_LEFT
elif sign_type == SignsTypes.ONLY_RIGHT.value:
return ImagesPaths.ONLY_RIGHT
elif sign_type == SignsTypes.FORWARD_OR_LEFT.value:
return ImagesPaths.FORWARD_OR_LEFT
elif sign_type == SignsTypes.FORWARD_OR_RIGHT.value:
return ImagesPaths.FORWARD_OR_RIGHT
else:
return " "
class ObjectType(Enum):
START = 10,
WALL = 11,
BOX = 12,
SQUARE = 13,
SIGN = 14,
TRAFFIC_LIGHT = 15
class CellQuarter(Enum):
RIGHT_TOP = 0
RIGHT_BOT = 1
LEFT_TOP = 2
LEFT_BOT = 3
class MapParams:
def __init__(self, n_cells: Size2D, cell_sz: Size2D):
self.n_cells = n_cells
self.cell_sz = cell_sz
self.phys_size = Size2D(self.n_cells.x * self.cell_sz.x,
self.n_cells.y * self.cell_sz.y)
print("World cells: count={0},size={1}".format(self.n_cells, self.cell_sz))
def serialize(self):
data = {
'cell_cnt': self.n_cells.as_list(),
'cell_sz': self.cell_sz.as_list()
}
return data
def __str__(self):
return 'Map params: count({}) / size({})'.format(self.n_cells, self.cell_sz)
@staticmethod
def deserialize(data: dict):
return MapParams(Point2D.from_list(data['cell_cnt']), Point2D.from_list(data['cell_sz']))
class Object:
def render(self):
pass
def serialized(self):
pass
@staticmethod
def deserialize(data: dict):
if data['name'] not in SERIALIZATION_SUPPORT:
log.error('Object type \'{}\' not found'.format(data['name']))
return None
return SERIALIZATION_SUPPORT[data['name']].deserialize(data)
class Wall():
TYPE = ObjectType.WALL
def __init__(self, point1, point2):
self.p1 = point1
self.p2 = point2
def __str__(self):
return "[({}) p1 = {}, p2 = {}]".format(type(self), self.p1, self.p2)
def distance_2_point(self, pnt):
import numpy
from numpy import arccos, array, dot, pi, cross
from numpy.linalg import det, norm
A = numpy.array(self.p1.as_list())
B = numpy.array(self.p2.as_list())
P = numpy.array(pnt.as_list())
if arccos(dot((P - A) / norm(P - A), (B - A) / norm(B - A))) > m.pi / 2:
return norm(P - A)
if arccos(dot((P - B) / norm(P - B), (A - B) / norm(A - B))) > m.pi / 2:
return norm(P - B)
return norm(cross(A-B, A-P))/norm(B-A)
def render(self, qp):
qp.drawWallLine(self.p1, self.p2, color=(0, 0, 0))
def serialized(self):
for name, _class in SERIALIZATION_SUPPORT.items():
if type(self) == _class:
break
data = {
'name': name,
'pnts': self.p1.as_list() + self.p2.as_list()
}
return data
@staticmethod
def deserialize(data: dict):
return Wall(Point2D.from_list(data['pnts'][0:2]),
Point2D.from_list(data['pnts'][2:4]))
class Sign(Object):
TYPE = ObjectType.SIGN
def __init__(self, pos, orient, signType):
self.pos = pos
self.type = signType
self.orient = orient
def __str__(self):
return "[({}) pose = {}, orient = {}, type = {}]".format(type(self), self.pos, self.orient, self.type)
def render(self, qp):
qp.drawQuarterImg(self.pos, self.orient, sign_type_to_sign_path(self.type))
def serialized(self):
for name, _class in SERIALIZATION_SUPPORT.items():
if type(self) == _class:
break
data = {
'name': name,
'pos': self.pos.as_list(),
'orient': self.orient.value,
'type': self.type
}
return data
@staticmethod
def deserialize(data: dict):
return Sign(Point2D.from_list(data['pos']),
CellQuarter(data['orient']),
data['type'])
class Box(Object):
TYPE = ObjectType.BOX
def __init__(self, pos: Point2D):
self.pos = pos
def render(self, qp):
qp.fillCell(self.pos, color=(150, 150, 150))
def serialized(self):
for name, _class in SERIALIZATION_SUPPORT.items():
if type(self) == _class:
break
data = {
'name': name,
'pos': self.pos.as_list()
}
return data
@staticmethod
def deserialize(data: dict):
return Box(Point2D.from_list(data['pos']))
SERIALIZATION_SUPPORT = {
'wall': Wall,
'sign': Sign,
'box': Box
}
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
3166,
848,
29918,
4984,
1973,
1053,
334,
13,
5215,
3509,
13,
5215,
12183,
408,
1480,
13,
5215,
29105,
13,
5215,
5844,
408,
286,
13,
3166,
14115,
1053,
1174,
398,
13,
5215,
2897,
13,
13,
20576,
29918,
16358,
353,
29871,
29896,
29889,
29900,
13,
13,
1990,
9954,
29879,
10562,
29898,
16854,
1125,
13,
1678,
6850,
4590,
353,
376,
9847,
1804,
29908,
13,
1678,
6732,
16786,
29918,
22051,
29956,
17011,
353,
376,
6194,
6375,
1804,
29908,
13,
1678,
6732,
16786,
29918,
22789,
3912,
353,
376,
6194,
1492,
1804,
29908,
13,
1678,
6732,
16786,
29918,
28024,
353,
376,
6194,
2175,
1804,
29908,
13,
1678,
15842,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
353,
376,
11333,
470,
1492,
1804,
29908,
13,
1678,
15842,
29956,
17011,
29918,
1955,
29918,
28024,
353,
376,
11333,
470,
2175,
1804,
29908,
13,
13,
1990,
1954,
1179,
2605,
29879,
7295,
13,
1678,
23611,
29918,
4986,
29918,
2382,
353,
525,
9794,
29915,
13,
1678,
6850,
4590,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
1182,
860,
29899,
4530,
29914,
1182,
860,
29889,
2732,
1495,
13,
1678,
6732,
16786,
29918,
22051,
29956,
17011,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
11333,
29899,
4530,
29914,
11333,
29889,
2732,
1495,
13,
1678,
6732,
16786,
29918,
28024,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
1563,
29899,
4530,
29914,
1563,
29889,
2732,
1495,
13,
1678,
6732,
16786,
29918,
22789,
3912,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
1266,
29899,
4530,
29914,
1266,
29889,
2732,
1495,
13,
1678,
15842,
29956,
17011,
29918,
1955,
29918,
28024,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
11333,
29899,
1563,
29899,
4530,
29914,
1341,
9970,
29918,
1563,
29889,
2732,
1495,
13,
1678,
15842,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
353,
2897,
29889,
2084,
29889,
7122,
29898,
10145,
29918,
4986,
29918,
2382,
29892,
525,
11333,
29899,
1266,
29899,
4530,
29914,
1341,
9970,
29918,
1266,
29889,
2732,
1495,
13,
13,
1753,
1804,
29918,
2084,
29918,
517,
29918,
4530,
29918,
1853,
29898,
2492,
29918,
2084,
1125,
13,
1678,
565,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
1254,
4590,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
1254,
4590,
29889,
1767,
13,
1678,
25342,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
22051,
29956,
17011,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
22051,
29956,
17011,
29889,
1767,
13,
1678,
25342,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
28024,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
28024,
29889,
1767,
13,
1678,
25342,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
22789,
3912,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
22789,
3912,
29889,
1767,
13,
1678,
25342,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
28024,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
28024,
29889,
1767,
13,
1678,
25342,
10153,
29918,
2084,
338,
1954,
1179,
2605,
29879,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
29901,
13,
4706,
736,
9954,
29879,
10562,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
29889,
1767,
13,
1678,
1683,
29901,
13,
4706,
736,
376,
376,
13,
13,
1753,
1804,
29918,
1853,
29918,
517,
29918,
4530,
29918,
2084,
29898,
4530,
29918,
1853,
1125,
13,
1678,
565,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
1254,
4590,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
1254,
4590,
13,
1678,
25342,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
22051,
29956,
17011,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
22051,
29956,
17011,
13,
1678,
25342,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
28024,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
28024,
13,
1678,
25342,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
1164,
16786,
29918,
22789,
3912,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
1164,
16786,
29918,
22789,
3912,
13,
1678,
25342,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
28024,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
28024,
13,
1678,
25342,
1804,
29918,
1853,
1275,
9954,
29879,
10562,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
29889,
1767,
29901,
13,
4706,
736,
1954,
1179,
2605,
29879,
29889,
22051,
29956,
17011,
29918,
1955,
29918,
22789,
3912,
13,
1678,
1683,
29901,
13,
4706,
736,
376,
376,
13,
13,
1990,
4669,
1542,
29898,
16854,
1125,
13,
1678,
6850,
8322,
353,
29871,
29896,
29900,
29892,
13,
1678,
399,
9818,
353,
29871,
29896,
29896,
29892,
13,
1678,
16437,
29990,
353,
29871,
29896,
29906,
29892,
13,
1678,
317,
13356,
29909,
1525,
353,
29871,
29896,
29941,
29892,
13,
1678,
317,
17298,
353,
29871,
29896,
29946,
29892,
13,
1678,
323,
4717,
4198,
2965,
29918,
5265,
29954,
3912,
353,
29871,
29896,
29945,
13,
13,
1990,
19413,
2182,
4254,
29898,
16854,
1125,
13,
1678,
390,
22530,
29918,
29911,
4590,
353,
29871,
29900,
13,
1678,
390,
22530,
29918,
29933,
2891,
353,
29871,
29896,
13,
1678,
19246,
29918,
29911,
4590,
353,
29871,
29906,
13,
1678,
19246,
29918,
29933,
2891,
353,
29871,
29941,
13,
13,
13,
1990,
7315,
9629,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
302,
29918,
3729,
29879,
29901,
21179,
29906,
29928,
29892,
3038,
29918,
3616,
29901,
21179,
29906,
29928,
1125,
13,
4706,
1583,
29889,
29876,
29918,
3729,
29879,
353,
302,
29918,
3729,
29879,
13,
4706,
1583,
29889,
3729,
29918,
3616,
353,
3038,
29918,
3616,
13,
4706,
1583,
29889,
14017,
29918,
2311,
353,
21179,
29906,
29928,
29898,
1311,
29889,
29876,
29918,
3729,
29879,
29889,
29916,
334,
1583,
29889,
3729,
29918,
3616,
29889,
29916,
29892,
29871,
13,
462,
18884,
1583,
29889,
29876,
29918,
3729,
29879,
29889,
29891,
334,
1583,
29889,
3729,
29918,
3616,
29889,
29891,
29897,
13,
4706,
1596,
703,
14058,
9101,
29901,
2302,
3790,
29900,
1118,
2311,
3790,
29896,
29913,
1642,
4830,
29898,
1311,
29889,
29876,
29918,
3729,
29879,
29892,
1583,
29889,
3729,
29918,
3616,
876,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
848,
353,
426,
13,
9651,
525,
3729,
29918,
20047,
2396,
1583,
29889,
29876,
29918,
3729,
29879,
29889,
294,
29918,
1761,
3285,
13,
9651,
525,
3729,
29918,
3616,
2396,
1583,
29889,
3729,
29918,
3616,
29889,
294,
29918,
1761,
580,
13,
4706,
500,
13,
308,
13,
4706,
736,
848,
13,
268,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
525,
3388,
8636,
29901,
2302,
3319,
1800,
847,
2159,
3319,
1800,
4286,
4830,
29898,
1311,
29889,
29876,
29918,
3729,
29879,
29892,
1583,
29889,
3729,
29918,
3616,
29897,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29898,
1272,
29901,
9657,
1125,
13,
4706,
736,
7315,
9629,
29898,
5228,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
3729,
29918,
20047,
2033,
511,
8984,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
3729,
29918,
3616,
25901,
13,
13,
308,
13,
1990,
4669,
29901,
13,
1678,
822,
4050,
29898,
1311,
1125,
13,
4706,
1209,
13,
1678,
822,
7797,
1891,
29898,
1311,
1125,
13,
4706,
1209,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29898,
1272,
29901,
9657,
1125,
13,
4706,
565,
848,
1839,
978,
2033,
451,
297,
26996,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
29901,
13,
9651,
1480,
29889,
2704,
877,
2061,
1134,
320,
29915,
29912,
1012,
29915,
451,
1476,
4286,
4830,
29898,
1272,
1839,
978,
25901,
13,
9651,
736,
6213,
13,
308,
13,
4706,
736,
26996,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
29961,
1272,
1839,
978,
2033,
1822,
2783,
261,
6646,
29898,
1272,
29897,
13,
13,
13,
1990,
14406,
7295,
13,
1678,
323,
6959,
353,
4669,
1542,
29889,
29956,
9818,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1298,
29896,
29892,
1298,
29906,
1125,
13,
4706,
1583,
29889,
29886,
29896,
353,
1298,
29896,
13,
4706,
1583,
29889,
29886,
29906,
353,
1298,
29906,
13,
268,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
14704,
3319,
1800,
282,
29896,
353,
24335,
282,
29906,
353,
426,
6525,
1642,
4830,
29898,
1853,
29898,
1311,
511,
1583,
29889,
29886,
29896,
29892,
1583,
29889,
29886,
29906,
29897,
13,
268,
13,
1678,
822,
5418,
29918,
29906,
29918,
3149,
29898,
1311,
29892,
282,
593,
1125,
13,
4706,
1053,
12655,
13,
4706,
515,
12655,
1053,
564,
617,
359,
29892,
1409,
29892,
8329,
29892,
2930,
29892,
4891,
13,
4706,
515,
12655,
29889,
29880,
979,
29887,
1053,
1439,
29892,
6056,
13,
13,
4706,
319,
353,
12655,
29889,
2378,
29898,
1311,
29889,
29886,
29896,
29889,
294,
29918,
1761,
3101,
13,
4706,
350,
353,
12655,
29889,
2378,
29898,
1311,
29889,
29886,
29906,
29889,
294,
29918,
1761,
3101,
13,
4706,
349,
353,
12655,
29889,
2378,
29898,
29886,
593,
29889,
294,
29918,
1761,
3101,
13,
13,
4706,
565,
564,
617,
359,
29898,
6333,
3552,
29925,
448,
319,
29897,
847,
6056,
29898,
29925,
448,
319,
511,
313,
29933,
448,
319,
29897,
847,
6056,
29898,
29933,
448,
319,
4961,
1405,
286,
29889,
1631,
847,
29871,
29906,
29901,
13,
9651,
736,
6056,
29898,
29925,
448,
319,
29897,
13,
4706,
565,
564,
617,
359,
29898,
6333,
3552,
29925,
448,
350,
29897,
847,
6056,
29898,
29925,
448,
350,
511,
313,
29909,
448,
350,
29897,
847,
6056,
29898,
29909,
448,
350,
4961,
1405,
286,
29889,
1631,
847,
29871,
29906,
29901,
13,
9651,
736,
6056,
29898,
29925,
448,
350,
29897,
13,
4706,
736,
6056,
29898,
19128,
29898,
29909,
29899,
29933,
29892,
319,
29899,
29925,
876,
29914,
12324,
29898,
29933,
29899,
29909,
29897,
13,
13,
1678,
822,
4050,
29898,
1311,
29892,
3855,
29886,
1125,
13,
4706,
3855,
29886,
29889,
4012,
29956,
497,
3542,
29898,
1311,
29889,
29886,
29896,
29892,
1583,
29889,
29886,
29906,
29892,
2927,
7607,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
876,
13,
308,
13,
1678,
822,
7797,
1891,
29898,
1311,
1125,
13,
4706,
363,
1024,
29892,
903,
1990,
297,
26996,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
29889,
7076,
7295,
13,
9651,
565,
1134,
29898,
1311,
29897,
1275,
903,
1990,
29901,
13,
18884,
2867,
13,
308,
13,
4706,
848,
353,
426,
13,
9651,
525,
978,
2396,
1024,
29892,
13,
9651,
525,
29886,
593,
29879,
2396,
1583,
29889,
29886,
29896,
29889,
294,
29918,
1761,
580,
718,
1583,
29889,
29886,
29906,
29889,
294,
29918,
1761,
580,
13,
4706,
500,
13,
308,
13,
4706,
736,
848,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29898,
1272,
29901,
9657,
1125,
13,
4706,
736,
14406,
29898,
5228,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
29886,
593,
29879,
2033,
29961,
29900,
29901,
29906,
11724,
29871,
13,
462,
1678,
8984,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
29886,
593,
29879,
2033,
29961,
29906,
29901,
29946,
12622,
13,
268,
13,
268,
13,
1990,
9954,
29898,
2061,
1125,
13,
1678,
323,
6959,
353,
4669,
1542,
29889,
5425,
20728,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
926,
29892,
7769,
29892,
1804,
1542,
1125,
13,
4706,
1583,
29889,
1066,
353,
926,
13,
4706,
1583,
29889,
1853,
353,
1804,
1542,
13,
4706,
1583,
29889,
12236,
353,
7769,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
14704,
3319,
1800,
18593,
353,
24335,
7769,
353,
24335,
1134,
353,
426,
6525,
1642,
4830,
29898,
1853,
29898,
1311,
511,
1583,
29889,
1066,
29892,
1583,
29889,
12236,
29892,
1583,
29889,
1853,
29897,
13,
268,
13,
1678,
822,
4050,
29898,
1311,
29892,
3855,
29886,
1125,
13,
4706,
3855,
29886,
29889,
4012,
2182,
4254,
25518,
29898,
1311,
29889,
1066,
29892,
1583,
29889,
12236,
29892,
1804,
29918,
1853,
29918,
517,
29918,
4530,
29918,
2084,
29898,
1311,
29889,
1853,
876,
13,
268,
13,
1678,
822,
7797,
1891,
29898,
1311,
1125,
13,
4706,
363,
1024,
29892,
903,
1990,
297,
26996,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
29889,
7076,
7295,
13,
9651,
565,
1134,
29898,
1311,
29897,
1275,
903,
1990,
29901,
13,
18884,
2867,
13,
308,
13,
4706,
848,
353,
426,
13,
9651,
525,
978,
2396,
1024,
29892,
13,
9651,
525,
1066,
2396,
1583,
29889,
1066,
29889,
294,
29918,
1761,
3285,
13,
9651,
525,
12236,
2396,
1583,
29889,
12236,
29889,
1767,
29892,
13,
9651,
525,
1853,
2396,
1583,
29889,
1853,
13,
4706,
500,
13,
308,
13,
4706,
736,
848,
308,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29898,
1272,
29901,
9657,
1125,
13,
4706,
736,
9954,
29898,
5228,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
1066,
2033,
511,
29871,
13,
462,
1678,
19413,
2182,
4254,
29898,
1272,
1839,
12236,
2033,
511,
13,
462,
1678,
848,
1839,
1853,
11287,
13,
268,
13,
268,
13,
1990,
11773,
29898,
2061,
1125,
13,
1678,
323,
6959,
353,
4669,
1542,
29889,
8456,
29990,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
926,
29901,
8984,
29906,
29928,
1125,
13,
4706,
1583,
29889,
1066,
353,
926,
13,
1678,
13,
1678,
822,
4050,
29898,
1311,
29892,
3855,
29886,
1125,
13,
4706,
3855,
29886,
29889,
5589,
4617,
29898,
1311,
29889,
1066,
29892,
2927,
7607,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
876,
13,
308,
13,
1678,
822,
7797,
1891,
29898,
1311,
1125,
13,
4706,
363,
1024,
29892,
903,
1990,
297,
26996,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
29889,
7076,
7295,
13,
9651,
565,
1134,
29898,
1311,
29897,
1275,
903,
1990,
29901,
13,
18884,
2867,
13,
308,
13,
4706,
848,
353,
426,
13,
9651,
525,
978,
2396,
1024,
29892,
13,
9651,
525,
1066,
2396,
1583,
29889,
1066,
29889,
294,
29918,
1761,
580,
13,
4706,
500,
13,
308,
13,
4706,
736,
848,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29898,
1272,
29901,
9657,
1125,
13,
4706,
736,
11773,
29898,
5228,
29906,
29928,
29889,
3166,
29918,
1761,
29898,
1272,
1839,
1066,
25901,
13,
418,
13,
308,
13,
6304,
25758,
26664,
8098,
29918,
29903,
4897,
15082,
353,
426,
13,
1678,
525,
11358,
2396,
14406,
29892,
13,
1678,
525,
4530,
2396,
9954,
29892,
13,
1678,
525,
1884,
2396,
11773,
29871,
13,
29913,
13,
268,
2
] |
main project.py | Kshitijkrishnadas/haribol | 0 | 139569 | import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',passwd='<PASSWORD>',database='electronic_shop')
cur=conn.cursor()
if conn.is_connected:
print(' ELECTRONIC SHOP SYSTEM')
print(' 1.Admin')
print(' 2.Customers')
choice=int(input(' Enter the choice: '))
if choice == 1:
pw = '<PASSWORD>'
passwrd = input('Enter the password: ')
if passwrd == pw:
print(' 1.Enter data for Items')
print(' 2.Enter data for Labour')
print(' 3.Enter data for Customers')
choose = int(input('Enter the choice for adding data: '))
if choose == 1:
item = input('Enter the name of item: ')
availability = int(input('Availability of the item: '))
price = int(input('Enter the price of item in rupees: '))
cur.execute("INSERT INTO ITEMS VALUES('" + item + "'," + str(availability) + "," + str(price) + ")")
print('ENTRY SUCCESSFUL.')
conn.commit()
elif choose == 2:
name = input('Enter the name of labour: ')
age = int(input('Enter the age: '))
place = input('Enter the place of the labour: ')
dept = input('Enter the name of the department: ')
cur.execute("INSERT INTO LABOURS VALUES('" + name + "','" + str(age) + "','" + place + "','" + dept + "')")
print('ENTRY SUCCESSFUL.')
conn.commit()
elif choose == 3:
name = input('Enter the name of the customer: ')
age = int(input('Enter the age: '))
place = input('Enter the place of the customer: ')
item = input('Enter the item bought: ')
cur.execute("INSERT INTO CUSTOMER VALUES('" + name + "','" + str(age) + "','" + place + "','" + item + "')")
print('ENTRY SUCCESSFUL.')
conn.commit()
else:
print('Invalid Login!')
elif choice == 2:
print(' 1.Display the list of Items.')
print(' 2.Display the list of Labours.')
print(' 3.Display the list of Customers.')
ch = int(input('Enter the choice: '))
if ch == 1:
print()
cur.execute('SELECT * FROM ITEMS')
dataa = cur.fetchall()
print('List of items: ')
for row in dataa:
print()
print('Item: ',row[0])
print('Availablity: ',row[1])
print('Price: ',row[2])
elif ch == 2:
print()
cur.execute('SELECT * FROM LABOURS')
data = cur.fetchall()
print('List of Labours:')
for row in data:
print()
print('Name: ',row[0])
print('Age: ',row[1])
print('Place: ',row[2])
print('Department: ',row[3])
elif ch == 3:
print()
cur.execute('SELECT * FROM CUSTOMER')
datas = cur.fetchall()
print('List of customers:')
for row in datas:
print()
print('Name: ',row[0])
print('Age: ',row[1])
print('Place: ',row[2])
print('Item bought: ',row[3])
| [
1,
1053,
5749,
29889,
11958,
2801,
408,
4576,
13,
13082,
29922,
2850,
29889,
6915,
29898,
3069,
2433,
7640,
742,
1792,
2433,
4632,
742,
3364,
9970,
2433,
29966,
25711,
17013,
29958,
742,
9803,
2433,
15436,
1617,
293,
29918,
19032,
1495,
13,
2764,
29922,
13082,
29889,
18127,
580,
13,
361,
11009,
29889,
275,
29918,
18045,
29901,
13,
1678,
1596,
877,
462,
462,
632,
382,
3281,
29934,
1164,
2965,
24972,
4590,
28962,
1254,
12665,
1495,
13,
1678,
1596,
877,
462,
462,
795,
29896,
29889,
12754,
1495,
13,
1678,
1596,
877,
462,
462,
795,
29906,
29889,
7281,
414,
1495,
13,
16957,
29922,
524,
29898,
2080,
877,
462,
462,
632,
9041,
278,
7348,
29901,
525,
876,
13,
361,
7348,
1275,
29871,
29896,
29901,
13,
1678,
282,
29893,
353,
12801,
25711,
17013,
16299,
13,
1678,
1209,
29893,
5499,
353,
1881,
877,
10399,
278,
4800,
29901,
25710,
13,
1678,
565,
1209,
29893,
5499,
1275,
282,
29893,
29901,
13,
4706,
1596,
877,
462,
462,
795,
29896,
29889,
10399,
848,
363,
25085,
1495,
13,
4706,
1596,
877,
462,
462,
795,
29906,
29889,
10399,
848,
363,
29453,
1495,
13,
4706,
1596,
877,
462,
462,
795,
29941,
29889,
10399,
848,
363,
8701,
414,
1495,
13,
4706,
6755,
353,
938,
29898,
2080,
877,
10399,
278,
7348,
363,
4417,
848,
29901,
525,
876,
13,
4706,
565,
6755,
1275,
29871,
29896,
29901,
13,
9651,
2944,
353,
1881,
877,
10399,
278,
1024,
310,
2944,
29901,
25710,
13,
9651,
20847,
3097,
353,
938,
29898,
2080,
877,
12810,
737,
3097,
310,
278,
2944,
29901,
525,
876,
13,
9651,
8666,
353,
938,
29898,
2080,
877,
10399,
278,
8666,
310,
2944,
297,
5796,
412,
267,
29901,
525,
876,
13,
9651,
3151,
29889,
7978,
703,
19460,
11646,
306,
4330,
4345,
15673,
877,
29908,
718,
2944,
718,
376,
742,
29908,
718,
851,
29898,
485,
737,
3097,
29897,
718,
28796,
718,
851,
29898,
9175,
29897,
718,
16521,
1159,
13,
9651,
1596,
877,
3919,
13207,
20134,
26925,
29943,
13309,
29889,
1495,
13,
9651,
11009,
29889,
15060,
580,
13,
4706,
25342,
6755,
1275,
29871,
29906,
29901,
13,
9651,
1024,
353,
1881,
877,
10399,
278,
1024,
310,
23390,
29901,
25710,
13,
9651,
5046,
353,
938,
29898,
2080,
877,
10399,
278,
5046,
29901,
525,
876,
13,
9651,
2058,
353,
1881,
877,
10399,
278,
2058,
310,
278,
23390,
29901,
25710,
13,
9651,
316,
415,
353,
1881,
877,
10399,
278,
1024,
310,
278,
14311,
29901,
25710,
13,
9651,
3151,
29889,
7978,
703,
19460,
11646,
365,
2882,
22970,
29903,
15673,
877,
29908,
718,
1024,
718,
376,
3788,
29908,
718,
851,
29898,
482,
29897,
718,
376,
3788,
29908,
718,
2058,
718,
376,
3788,
29908,
718,
316,
415,
718,
376,
1495,
1159,
13,
9651,
1596,
877,
3919,
13207,
20134,
26925,
29943,
13309,
29889,
1495,
13,
9651,
11009,
29889,
15060,
580,
13,
4706,
25342,
6755,
1275,
29871,
29941,
29901,
13,
9651,
1024,
353,
1881,
877,
10399,
278,
1024,
310,
278,
11962,
29901,
25710,
13,
9651,
5046,
353,
938,
29898,
2080,
877,
10399,
278,
5046,
29901,
525,
876,
13,
9651,
2058,
353,
1881,
877,
10399,
278,
2058,
310,
278,
11962,
29901,
25710,
13,
9651,
2944,
353,
1881,
877,
10399,
278,
2944,
18093,
29901,
25710,
13,
9651,
3151,
29889,
7978,
703,
19460,
11646,
315,
17321,
6488,
1001,
15673,
877,
29908,
718,
1024,
718,
376,
3788,
29908,
718,
851,
29898,
482,
29897,
718,
376,
3788,
29908,
718,
2058,
718,
376,
3788,
29908,
718,
2944,
718,
376,
1495,
1159,
13,
9651,
1596,
877,
3919,
13207,
20134,
26925,
29943,
13309,
29889,
1495,
13,
9651,
11009,
29889,
15060,
580,
13,
1678,
1683,
29901,
13,
4706,
1596,
877,
13919,
19130,
29991,
1495,
13,
23681,
7348,
1275,
29871,
29906,
29901,
13,
1678,
1596,
877,
462,
462,
795,
29896,
29889,
9323,
278,
1051,
310,
25085,
29889,
1495,
13,
1678,
1596,
877,
462,
462,
795,
29906,
29889,
9323,
278,
1051,
310,
12016,
2470,
29889,
1495,
13,
1678,
1596,
877,
462,
462,
795,
29941,
29889,
9323,
278,
1051,
310,
8701,
414,
29889,
1495,
13,
1678,
521,
353,
938,
29898,
2080,
877,
10399,
278,
7348,
29901,
525,
876,
13,
1678,
565,
521,
1275,
29871,
29896,
29901,
13,
965,
1596,
580,
13,
965,
3151,
29889,
7978,
877,
6404,
334,
3895,
306,
4330,
4345,
1495,
13,
965,
848,
29874,
353,
3151,
29889,
9155,
497,
580,
13,
965,
1596,
877,
1293,
310,
4452,
29901,
25710,
13,
965,
363,
1948,
297,
848,
29874,
29901,
13,
1669,
1596,
580,
13,
1669,
1596,
877,
2001,
29901,
13420,
798,
29961,
29900,
2314,
13,
1669,
1596,
877,
12810,
737,
12478,
537,
29901,
13420,
798,
29961,
29896,
2314,
13,
1669,
1596,
877,
13026,
29901,
13420,
798,
29961,
29906,
2314,
13,
1678,
25342,
521,
1275,
29871,
29906,
29901,
13,
4706,
1596,
580,
13,
4706,
3151,
29889,
7978,
877,
6404,
334,
3895,
365,
2882,
22970,
29903,
1495,
13,
4706,
848,
353,
3151,
29889,
9155,
497,
580,
13,
4706,
1596,
877,
1293,
310,
12016,
2470,
29901,
1495,
13,
4706,
363,
1948,
297,
848,
29901,
13,
9651,
1596,
580,
13,
9651,
1596,
877,
1170,
29901,
13420,
798,
29961,
29900,
2314,
13,
9651,
1596,
877,
22406,
29901,
13420,
798,
29961,
29896,
2314,
13,
9651,
1596,
877,
22150,
29901,
13420,
798,
29961,
29906,
2314,
13,
9651,
1596,
877,
8498,
442,
358,
29901,
13420,
798,
29961,
29941,
2314,
13,
1678,
25342,
521,
1275,
29871,
29941,
29901,
13,
4706,
1596,
580,
13,
4706,
3151,
29889,
7978,
877,
6404,
334,
3895,
315,
17321,
6488,
1001,
1495,
13,
4706,
6155,
353,
3151,
29889,
9155,
497,
580,
13,
4706,
1596,
877,
1293,
310,
20330,
29901,
1495,
13,
4706,
363,
1948,
297,
6155,
29901,
13,
9651,
1596,
580,
13,
9651,
1596,
877,
1170,
29901,
13420,
798,
29961,
29900,
2314,
13,
9651,
1596,
877,
22406,
29901,
13420,
798,
29961,
29896,
2314,
13,
9651,
1596,
877,
22150,
29901,
13420,
798,
29961,
29906,
2314,
13,
9651,
1596,
877,
2001,
18093,
29901,
13420,
798,
29961,
29941,
2314,
13,
2
] |
gooey/gui/processor.py | Jacke/Gooey | 13,430 | 1610714 | import os
import re
import subprocess
import sys
from functools import partial
from threading import Thread
from gooey.gui import events
from gooey.gui.pubsub import pub
from gooey.gui.util.casting import safe_float
from gooey.gui.util.taskkill import taskkill
from gooey.util.functional import unit, bind
class ProcessController(object):
def __init__(self, progress_regex, progress_expr, hide_progress_msg,encoding, shell=True):
self._process = None
self.progress_regex = progress_regex
self.progress_expr = progress_expr
self.hide_progress_msg = hide_progress_msg
self.encoding = encoding
self.wasForcefullyStopped = False
self.shell_execution = shell
def was_success(self):
self._process.communicate()
return self._process.returncode == 0
def poll(self):
if not self._process:
raise Exception('Not started!')
return self._process.poll()
def stop(self):
if self.running():
self.wasForcefullyStopped = True
taskkill(self._process.pid)
def running(self):
return self._process and self.poll() is None
def run(self, command):
self.wasForcefullyStopped = False
env = os.environ.copy()
env["GOOEY"] = "1"
env["PYTHONIOENCODING"] = self.encoding
try:
self._process = subprocess.Popen(
command.encode(sys.getfilesystemencoding()),
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=self.shell_execution, env=env)
except:
self._process = subprocess.Popen(
command,
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr = subprocess.STDOUT, shell = self.shell_execution, env=env)
t = Thread(target=self._forward_stdout, args=(self._process,))
t.start()
def _forward_stdout(self, process):
'''
Reads the stdout of `process` and forwards lines and progress
to any interested subscribers
'''
while True:
line = process.stdout.readline()
if not line:
break
_progress = self._extract_progress(line)
pub.send_message(events.PROGRESS_UPDATE, progress=_progress)
if _progress is None or self.hide_progress_msg is False:
pub.send_message(events.CONSOLE_UPDATE,
msg=line.decode(self.encoding))
pub.send_message(events.EXECUTION_COMPLETE)
def _extract_progress(self, text):
'''
Finds progress information in the text using the
user-supplied regex and calculation instructions
'''
# monad-ish dispatch to avoid the if/else soup
find = partial(re.search, string=text.strip().decode(self.encoding))
regex = unit(self.progress_regex)
match = bind(regex, find)
result = bind(match, self._calculate_progress)
return result
def _calculate_progress(self, match):
'''
Calculates the final progress value found by the regex
'''
if not self.progress_expr:
return safe_float(match.group(1))
else:
return self._eval_progress(match)
def _eval_progress(self, match):
'''
Runs the user-supplied progress calculation rule
'''
_locals = {k: safe_float(v) for k, v in match.groupdict().items()}
if "x" not in _locals:
_locals["x"] = [safe_float(x) for x in match.groups()]
try:
return int(eval(self.progress_expr, {}, _locals))
except:
return None
| [
1,
1053,
2897,
30004,
13,
5215,
337,
30004,
13,
5215,
1014,
5014,
30004,
13,
5215,
10876,
30004,
13,
3166,
2090,
312,
8789,
1053,
7687,
30004,
13,
3166,
3244,
292,
1053,
10480,
30004,
13,
30004,
13,
3166,
748,
29877,
1032,
29889,
23569,
1053,
4959,
30004,
13,
3166,
748,
29877,
1032,
29889,
23569,
29889,
5467,
1491,
1053,
2529,
30004,
13,
3166,
748,
29877,
1032,
29889,
23569,
29889,
4422,
29889,
4384,
292,
1053,
9109,
29918,
7411,
30004,
13,
3166,
748,
29877,
1032,
29889,
23569,
29889,
4422,
29889,
7662,
21174,
1053,
3414,
21174,
30004,
13,
3166,
748,
29877,
1032,
29889,
4422,
29889,
2220,
284,
1053,
5190,
29892,
7868,
30004,
13,
30004,
13,
30004,
13,
1990,
10554,
2956,
29898,
3318,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6728,
29918,
13087,
29892,
6728,
29918,
13338,
29892,
9563,
29918,
18035,
29918,
7645,
29892,
22331,
29892,
6473,
29922,
5574,
1125,
30004,
13,
4706,
1583,
3032,
5014,
353,
6213,
30004,
13,
4706,
1583,
29889,
18035,
29918,
13087,
353,
6728,
29918,
13087,
30004,
13,
4706,
1583,
29889,
18035,
29918,
13338,
353,
6728,
29918,
13338,
30004,
13,
4706,
1583,
29889,
11458,
29918,
18035,
29918,
7645,
353,
9563,
29918,
18035,
29918,
7645,
30004,
13,
4706,
1583,
29889,
22331,
353,
8025,
30004,
13,
4706,
1583,
29889,
11102,
2831,
346,
3730,
20754,
2986,
353,
7700,
30004,
13,
4706,
1583,
29889,
15903,
29918,
22256,
353,
6473,
30004,
13,
30004,
13,
1678,
822,
471,
29918,
8698,
29898,
1311,
1125,
30004,
13,
4706,
1583,
3032,
5014,
29889,
27820,
403,
26471,
13,
4706,
736,
1583,
3032,
5014,
29889,
2457,
401,
1275,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
21180,
29898,
1311,
1125,
30004,
13,
4706,
565,
451,
1583,
3032,
5014,
29901,
30004,
13,
9651,
12020,
8960,
877,
3664,
4687,
29991,
1495,
30004,
13,
4706,
736,
1583,
3032,
5014,
29889,
29886,
3028,
26471,
13,
30004,
13,
1678,
822,
5040,
29898,
1311,
1125,
30004,
13,
4706,
565,
1583,
29889,
21094,
7295,
30004,
13,
9651,
1583,
29889,
11102,
2831,
346,
3730,
20754,
2986,
353,
5852,
30004,
13,
9651,
3414,
21174,
29898,
1311,
3032,
5014,
29889,
5935,
8443,
13,
30004,
13,
1678,
822,
2734,
29898,
1311,
1125,
30004,
13,
4706,
736,
1583,
3032,
5014,
322,
1583,
29889,
29886,
3028,
580,
338,
6213,
30004,
13,
30004,
13,
1678,
822,
1065,
29898,
1311,
29892,
1899,
1125,
30004,
13,
4706,
1583,
29889,
11102,
2831,
346,
3730,
20754,
2986,
353,
7700,
30004,
13,
4706,
8829,
353,
2897,
29889,
21813,
29889,
8552,
26471,
13,
4706,
8829,
3366,
17080,
29949,
13282,
3108,
353,
376,
29896,
19451,
13,
4706,
8829,
3366,
20055,
4690,
1164,
5971,
1430,
3217,
29928,
4214,
3108,
353,
1583,
29889,
22331,
30004,
13,
4706,
1018,
29901,
30004,
13,
9651,
1583,
3032,
5014,
353,
1014,
5014,
29889,
29925,
3150,
29898,
30004,
13,
18884,
1899,
29889,
12508,
29898,
9675,
29889,
657,
5325,
973,
22331,
25739,
30004,
13,
18884,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
3659,
262,
29922,
1491,
5014,
29889,
2227,
4162,
11167,
13,
18884,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29892,
6473,
29922,
1311,
29889,
15903,
29918,
22256,
29892,
8829,
29922,
6272,
8443,
13,
4706,
5174,
29901,
30004,
13,
9651,
1583,
3032,
5014,
353,
1014,
5014,
29889,
29925,
3150,
29898,
30004,
13,
18884,
1899,
11167,
13,
18884,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
3659,
262,
29922,
1491,
5014,
29889,
2227,
4162,
11167,
13,
18884,
380,
20405,
353,
1014,
5014,
29889,
1254,
3970,
2692,
29892,
6473,
353,
1583,
29889,
15903,
29918,
22256,
29892,
8829,
29922,
6272,
8443,
13,
30004,
13,
4706,
260,
353,
10480,
29898,
5182,
29922,
1311,
3032,
11333,
29918,
25393,
29892,
6389,
7607,
1311,
3032,
5014,
29892,
876,
30004,
13,
4706,
260,
29889,
2962,
26471,
13,
30004,
13,
1678,
822,
903,
11333,
29918,
25393,
29898,
1311,
29892,
1889,
1125,
30004,
13,
4706,
14550,
30004,
13,
4706,
7523,
29879,
278,
27591,
310,
421,
5014,
29952,
322,
363,
2935,
3454,
322,
6728,
30004,
13,
4706,
304,
738,
8852,
21696,
2596,
30004,
13,
4706,
14550,
30004,
13,
4706,
1550,
5852,
29901,
30004,
13,
9651,
1196,
353,
1889,
29889,
25393,
29889,
949,
1220,
26471,
13,
9651,
565,
451,
1196,
29901,
30004,
13,
18884,
2867,
30004,
13,
9651,
903,
18035,
353,
1583,
3032,
21111,
29918,
18035,
29898,
1220,
8443,
13,
30004,
13,
9651,
2529,
29889,
6717,
29918,
4906,
29898,
13604,
29889,
8618,
29954,
26785,
29918,
14474,
29892,
6728,
29922,
29918,
18035,
8443,
13,
9651,
565,
903,
18035,
338,
6213,
470,
1583,
29889,
11458,
29918,
18035,
29918,
7645,
338,
7700,
29901,
30004,
13,
18884,
2529,
29889,
6717,
29918,
4906,
29898,
13604,
29889,
6007,
6156,
1307,
29918,
14474,
11167,
13,
462,
462,
10191,
29922,
1220,
29889,
13808,
29898,
1311,
29889,
22331,
876,
30004,
13,
4706,
2529,
29889,
6717,
29918,
4906,
29898,
13604,
29889,
5746,
11206,
2692,
2725,
29918,
21514,
18476,
8443,
13,
30004,
13,
1678,
822,
903,
21111,
29918,
18035,
29898,
1311,
29892,
1426,
1125,
30004,
13,
4706,
14550,
30004,
13,
4706,
10987,
29879,
6728,
2472,
297,
278,
1426,
773,
278,
30004,
13,
4706,
1404,
29899,
19303,
2957,
6528,
322,
13944,
11994,
30004,
13,
4706,
14550,
30004,
13,
4706,
396,
1601,
328,
29899,
728,
13916,
304,
4772,
278,
565,
29914,
2870,
22300,
30004,
13,
4706,
1284,
353,
7687,
29898,
276,
29889,
4478,
29892,
1347,
29922,
726,
29889,
17010,
2141,
13808,
29898,
1311,
29889,
22331,
876,
30004,
13,
4706,
6528,
353,
5190,
29898,
1311,
29889,
18035,
29918,
13087,
8443,
13,
4706,
1993,
353,
7868,
29898,
13087,
29892,
1284,
8443,
13,
4706,
1121,
353,
7868,
29898,
4352,
29892,
1583,
3032,
15807,
403,
29918,
18035,
8443,
13,
4706,
736,
1121,
30004,
13,
30004,
13,
1678,
822,
903,
15807,
403,
29918,
18035,
29898,
1311,
29892,
1993,
1125,
30004,
13,
4706,
14550,
30004,
13,
4706,
20535,
1078,
278,
2186,
6728,
995,
1476,
491,
278,
6528,
30004,
13,
4706,
14550,
30004,
13,
4706,
565,
451,
1583,
29889,
18035,
29918,
13338,
29901,
30004,
13,
9651,
736,
9109,
29918,
7411,
29898,
4352,
29889,
2972,
29898,
29896,
876,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
1583,
3032,
14513,
29918,
18035,
29898,
4352,
8443,
13,
30004,
13,
1678,
822,
903,
14513,
29918,
18035,
29898,
1311,
29892,
1993,
1125,
30004,
13,
4706,
14550,
30004,
13,
4706,
390,
6948,
278,
1404,
29899,
19303,
2957,
6728,
13944,
5751,
30004,
13,
4706,
14550,
30004,
13,
4706,
903,
2997,
29879,
353,
426,
29895,
29901,
9109,
29918,
7411,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
1993,
29889,
2972,
8977,
2141,
7076,
580,
8117,
13,
4706,
565,
376,
29916,
29908,
451,
297,
903,
2997,
29879,
29901,
30004,
13,
9651,
903,
2997,
29879,
3366,
29916,
3108,
353,
518,
11177,
29918,
7411,
29898,
29916,
29897,
363,
921,
297,
1993,
29889,
13155,
580,
29962,
30004,
13,
4706,
1018,
29901,
30004,
13,
9651,
736,
938,
29898,
14513,
29898,
1311,
29889,
18035,
29918,
13338,
29892,
24335,
903,
2997,
29879,
876,
30004,
13,
4706,
5174,
29901,
30004,
13,
9651,
736,
6213,
30004,
13,
2
] |
thermo/property_package_constants.py | RoryKurek/thermo | 380 | 117506 | <filename>thermo/property_package_constants.py
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2018, 2019 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
.. warning::
These classes were a first attempt at rigorous multiphase equilibrium.
They may be useful in some special cases but they are not complete and
further development will not happen. They were never documented as well.
It is recommended to switch over to the :obj:`thermo.flash` interface
which seeks to be more modular, easier to maintain and extend,
higher-performance, and easier to modify.
'''
from __future__ import division
__all__ = ['PropertyPackageConstants', 'IDEAL_PKG', 'NRTL_PKG', 'UNIFAC_PKG',
'UNIFAC_DORTMUND_PKG', 'PR_PKG', 'SRK_PKG']
from fluids.numerics import brenth, ridder, derivative, numpy as np
from chemicals.utils import log, exp
from fluids.constants import R, pi, N_A
from chemicals.identifiers import IDs_to_CASs
from chemicals.rachford_rice import flash_inner_loop
from thermo.eos_mix import PRMIX, SRKMIX
from thermo.eos import PR, SRK
from thermo.chemical import Chemical
from thermo.mixture import Mixture
from thermo.property_package import *
IDEAL_PKG = 'Ideal'
NRTL_PKG = 'NRTL'
UNIFAC_PKG = 'Unifac'
UNIFAC_DORTMUND_PKG = 'Unifac Dortmund'
PR_PKG = 'PR'
SRK_PKG = 'SRK'
property_packages = [IDEAL_PKG, NRTL_PKG, UNIFAC_PKG, UNIFAC_DORTMUND_PKG,
PR_PKG, SRK_PKG]
property_packages_cubic = [PR_PKG, SRK_PKG]
property_package_to_eos = {PR_PKG: PRMIX, SRK_PKG: SRKMIX}
property_package_to_eos_pures = {PR_PKG: PR, SRK_PKG: SRK}
property_package_names_to_objs = {IDEAL_PKG: IdealCaloric,
NRTL_PKG: Nrtl, # Not complete - enthalpy missing
UNIFAC_PKG: UnifacCaloric,
UNIFAC_DORTMUND_PKG: UnifacDortmundCaloric,
PR_PKG: GceosBase,
SRK_PKG: GceosBase,
}
class PropertyPackageConstants(object):
'''Class to store kijs, as well as allow properties to be edited; load
them from the database and then be ready to store them.
'''
def __init__(self, mixture, name=IDEAL_PKG, **kwargs):
if isinstance(mixture, list):
self.CASs = IDs_to_CASs(mixture)
self.Chemicals = [Chemical(CAS) for CAS in self.CASs]
elif isinstance(mixture, Mixture):
self.Chemicals = mixture.Chemicals
self.name = name
if name not in property_packages_cubic:
eos_mix = PRMIX
eos = PR
else:
eos_mix = property_package_to_eos[name]
eos = property_package_to_eos_pures[name]
self.eos = eos
self.eos_mix = eos_mix
self.eos_in_a_box = [eos_mix]
self.pkg_obj = property_package_names_to_objs[self.name]
self.set_chemical_constants()
self.set_Chemical_property_objects()
self.set_TP_sources()
self.kwargs = kwargs
self.pkg = self.new_package()
def new_package(self):
pkg_args = {'VaporPressures': self.VaporPressures,
'Tms': self.Tms, 'Tbs': self.Tbs, 'Tcs': self.Tcs,
'Pcs': self.Pcs, 'omegas': self.omegas, 'VolumeLiquids': self.VolumeLiquids,
'HeatCapacityLiquids': self.HeatCapacityLiquids,
'HeatCapacityGases': self.HeatCapacityGases,
'EnthalpyVaporizations': self.EnthalpyVaporizations,
'VolumeLiquids': self.VolumeLiquids,
'VolumeGases': self.VolumeGases,
'eos': self.eos, 'eos_mix': self.eos_mix,
'MWs': self.MWs,
'atomss': self.atomss,
'Hfs': self.Hfgms,
'Gfs': self.Gfgms,
}
pkg_args.update(self.kwargs)
if self.name == UNIFAC_PKG:
pkg_args['UNIFAC_groups'] = self.UNIFAC_groups
elif self.name == UNIFAC_DORTMUND_PKG:
pkg_args['UNIFAC_groups'] = self.UNIFAC_Dortmund_groups
return self.pkg_obj(**pkg_args)
def from_json(self, json):
self.__dict__.update(json)
self.set_Chemical_property_objects()
self.set_TP_sources()
transfer_methods = ['set_chemical_constants', 'set_Chemical_property_objects',
'set_TP_sources', 'UNIFAC_Dortmund_groups', 'UNIFAC_groups',
'atomss']
try:
for method in transfer_methods:
attr = Mixture.__dict__[method]
setattr(PropertyPackageConstants, method, attr)
except:
for method in transfer_methods:
setattr(PropertyPackageConstants, method, getattr(Mixture, method))
| [
1,
529,
9507,
29958,
721,
4346,
29914,
6799,
29918,
5113,
29918,
3075,
1934,
29889,
2272,
13,
29871,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
12008,
1451,
331,
936,
22557,
12037,
9538,
313,
1451,
3352,
29931,
467,
22310,
1907,
363,
1889,
1904,
292,
29889,
13,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29947,
29892,
29871,
29906,
29900,
29896,
29929,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
27293,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
974,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
262,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
517,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
9708,
583,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29888,
595,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
13,
1576,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
9708,
583,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
13,
28350,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29902,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29943,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
20656,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
5265,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
12015,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
6156,
7818,
12982,
1525,
29889,
13,
13,
636,
9177,
1057,
13,
1678,
4525,
4413,
892,
263,
937,
4218,
472,
12912,
20657,
2473,
21646,
26440,
29889,
13,
1678,
2688,
1122,
367,
5407,
297,
777,
4266,
4251,
541,
896,
526,
451,
4866,
322,
13,
1678,
4340,
5849,
674,
451,
3799,
29889,
2688,
892,
2360,
23531,
408,
1532,
29889,
13,
13,
1678,
739,
338,
13622,
304,
4607,
975,
304,
278,
584,
5415,
18078,
721,
4346,
29889,
28041,
29952,
5067,
13,
1678,
607,
1074,
2039,
304,
367,
901,
878,
1070,
29892,
6775,
304,
7344,
322,
10985,
29892,
13,
1678,
6133,
29899,
546,
13390,
29892,
322,
6775,
304,
6623,
29889,
13,
13,
12008,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
13,
1649,
497,
1649,
353,
6024,
4854,
14459,
26570,
742,
525,
22027,
1964,
29918,
21738,
29954,
742,
525,
29940,
13079,
29931,
29918,
21738,
29954,
742,
525,
3904,
6545,
2477,
29918,
21738,
29954,
742,
13,
965,
525,
3904,
6545,
2477,
29918,
29928,
8476,
29924,
18783,
29918,
21738,
29954,
742,
525,
10593,
29918,
21738,
29954,
742,
525,
14098,
29968,
29918,
21738,
29954,
2033,
13,
13,
3166,
20501,
4841,
29889,
8058,
1199,
1053,
1506,
9097,
29892,
8177,
672,
29892,
16291,
29892,
12655,
408,
7442,
13,
13,
3166,
22233,
29879,
29889,
13239,
1053,
1480,
29892,
1518,
13,
3166,
20501,
4841,
29889,
3075,
1934,
1053,
390,
29892,
2930,
29892,
405,
29918,
29909,
13,
3166,
22233,
29879,
29889,
1693,
14903,
1053,
23481,
29918,
517,
29918,
29907,
3289,
29879,
13,
3166,
22233,
29879,
29889,
10221,
4006,
29918,
11674,
1053,
11013,
29918,
3993,
29918,
7888,
13,
3166,
14563,
29877,
29889,
29872,
359,
29918,
28084,
1053,
12089,
29924,
6415,
29892,
21020,
29968,
29924,
6415,
13,
3166,
14563,
29877,
29889,
29872,
359,
1053,
12089,
29892,
21020,
29968,
13,
3166,
14563,
29877,
29889,
14969,
936,
1053,
12677,
936,
13,
3166,
14563,
29877,
29889,
2460,
15546,
1053,
5493,
15546,
13,
3166,
14563,
29877,
29889,
6799,
29918,
5113,
1053,
334,
13,
13,
13,
13,
13,
22027,
1964,
29918,
21738,
29954,
353,
525,
29902,
311,
284,
29915,
13,
29940,
13079,
29931,
29918,
21738,
29954,
353,
525,
29940,
13079,
29931,
29915,
13,
3904,
6545,
2477,
29918,
21738,
29954,
353,
525,
2525,
361,
562,
29915,
13,
3904,
6545,
2477,
29918,
29928,
8476,
29924,
18783,
29918,
21738,
29954,
353,
525,
2525,
361,
562,
19845,
15282,
29915,
13,
13,
10593,
29918,
21738,
29954,
353,
525,
10593,
29915,
13,
14098,
29968,
29918,
21738,
29954,
353,
525,
14098,
29968,
29915,
13,
13,
6799,
29918,
8318,
353,
518,
22027,
1964,
29918,
21738,
29954,
29892,
405,
13079,
29931,
29918,
21738,
29954,
29892,
8291,
6545,
2477,
29918,
21738,
29954,
29892,
8291,
6545,
2477,
29918,
29928,
8476,
29924,
18783,
29918,
21738,
29954,
29892,
13,
462,
268,
12089,
29918,
21738,
29954,
29892,
21020,
29968,
29918,
21738,
29954,
29962,
13,
6799,
29918,
8318,
29918,
29883,
431,
293,
353,
518,
10593,
29918,
21738,
29954,
29892,
21020,
29968,
29918,
21738,
29954,
29962,
13,
13,
6799,
29918,
5113,
29918,
517,
29918,
29872,
359,
353,
426,
10593,
29918,
21738,
29954,
29901,
12089,
29924,
6415,
29892,
21020,
29968,
29918,
21738,
29954,
29901,
21020,
29968,
29924,
6415,
29913,
13,
6799,
29918,
5113,
29918,
517,
29918,
29872,
359,
29918,
29886,
1973,
353,
426,
10593,
29918,
21738,
29954,
29901,
12089,
29892,
21020,
29968,
29918,
21738,
29954,
29901,
21020,
29968,
29913,
13,
13,
6799,
29918,
5113,
29918,
7039,
29918,
517,
29918,
711,
1315,
353,
426,
22027,
1964,
29918,
21738,
29954,
29901,
13001,
284,
7856,
272,
293,
29892,
13,
462,
462,
29871,
405,
13079,
29931,
29918,
21738,
29954,
29901,
405,
2273,
29880,
29892,
396,
2216,
4866,
29871,
448,
875,
4077,
2272,
4567,
13,
462,
462,
29871,
8291,
6545,
2477,
29918,
21738,
29954,
29901,
853,
361,
562,
7856,
272,
293,
29892,
13,
462,
462,
29871,
8291,
6545,
2477,
29918,
29928,
8476,
29924,
18783,
29918,
21738,
29954,
29901,
853,
361,
562,
29928,
441,
15282,
7856,
272,
293,
29892,
13,
462,
462,
29871,
12089,
29918,
21738,
29954,
29901,
402,
346,
359,
5160,
29892,
13,
462,
462,
29871,
21020,
29968,
29918,
21738,
29954,
29901,
402,
346,
359,
5160,
29892,
13,
462,
462,
500,
13,
13,
13,
1990,
9079,
14459,
26570,
29898,
3318,
1125,
13,
1678,
14550,
2385,
304,
3787,
413,
823,
29879,
29892,
408,
1532,
408,
2758,
4426,
304,
367,
8788,
29936,
2254,
13,
1678,
963,
515,
278,
2566,
322,
769,
367,
7960,
304,
3787,
963,
29889,
13,
1678,
14550,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29544,
29892,
1024,
29922,
22027,
1964,
29918,
21738,
29954,
29892,
3579,
19290,
1125,
13,
4706,
565,
338,
8758,
29898,
2460,
15546,
29892,
1051,
1125,
13,
9651,
1583,
29889,
29907,
3289,
29879,
353,
23481,
29918,
517,
29918,
29907,
3289,
29879,
29898,
2460,
15546,
29897,
13,
9651,
1583,
29889,
1451,
331,
936,
29879,
353,
518,
1451,
331,
936,
29898,
29907,
3289,
29897,
363,
315,
3289,
297,
1583,
29889,
29907,
3289,
29879,
29962,
13,
4706,
25342,
338,
8758,
29898,
2460,
15546,
29892,
5493,
15546,
1125,
13,
9651,
1583,
29889,
1451,
331,
936,
29879,
353,
29544,
29889,
1451,
331,
936,
29879,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
13,
4706,
565,
1024,
451,
297,
2875,
29918,
8318,
29918,
29883,
431,
293,
29901,
13,
9651,
321,
359,
29918,
28084,
353,
12089,
29924,
6415,
13,
9651,
321,
359,
353,
12089,
13,
4706,
1683,
29901,
13,
9651,
321,
359,
29918,
28084,
353,
2875,
29918,
5113,
29918,
517,
29918,
29872,
359,
29961,
978,
29962,
13,
9651,
321,
359,
353,
2875,
29918,
5113,
29918,
517,
29918,
29872,
359,
29918,
29886,
1973,
29961,
978,
29962,
13,
13,
4706,
1583,
29889,
29872,
359,
353,
321,
359,
13,
4706,
1583,
29889,
29872,
359,
29918,
28084,
353,
321,
359,
29918,
28084,
13,
13,
4706,
1583,
29889,
29872,
359,
29918,
262,
29918,
29874,
29918,
1884,
353,
518,
29872,
359,
29918,
28084,
29962,
13,
13,
4706,
1583,
29889,
15865,
29918,
5415,
353,
2875,
29918,
5113,
29918,
7039,
29918,
517,
29918,
711,
1315,
29961,
1311,
29889,
978,
29962,
13,
13,
4706,
1583,
29889,
842,
29918,
14969,
936,
29918,
3075,
1934,
580,
13,
4706,
1583,
29889,
842,
29918,
1451,
331,
936,
29918,
6799,
29918,
12650,
580,
13,
4706,
1583,
29889,
842,
29918,
3557,
29918,
29879,
2863,
580,
13,
13,
4706,
1583,
29889,
19290,
353,
9049,
5085,
13,
4706,
1583,
29889,
15865,
353,
1583,
29889,
1482,
29918,
5113,
580,
13,
13,
1678,
822,
716,
29918,
5113,
29898,
1311,
1125,
13,
4706,
282,
9415,
29918,
5085,
353,
11117,
29963,
26191,
10923,
1973,
2396,
1583,
29889,
29963,
26191,
10923,
1973,
29892,
13,
462,
259,
525,
29911,
1516,
2396,
1583,
29889,
29911,
1516,
29892,
525,
29911,
5824,
2396,
1583,
29889,
29911,
5824,
29892,
525,
29911,
2395,
2396,
1583,
29889,
29911,
2395,
29892,
13,
462,
259,
525,
29925,
2395,
2396,
1583,
29889,
29925,
2395,
29892,
525,
290,
387,
294,
2396,
1583,
29889,
290,
387,
294,
29892,
525,
24679,
29931,
8105,
4841,
2396,
1583,
29889,
24679,
29931,
8105,
4841,
29892,
13,
462,
259,
525,
3868,
271,
12415,
5946,
29931,
8105,
4841,
2396,
1583,
29889,
3868,
271,
12415,
5946,
29931,
8105,
4841,
29892,
13,
462,
259,
525,
3868,
271,
12415,
5946,
29954,
2129,
2396,
1583,
29889,
3868,
271,
12415,
5946,
29954,
2129,
29892,
13,
462,
259,
525,
2369,
386,
284,
2272,
29963,
26191,
17063,
2396,
1583,
29889,
2369,
386,
284,
2272,
29963,
26191,
17063,
29892,
13,
462,
259,
525,
24679,
29931,
8105,
4841,
2396,
1583,
29889,
24679,
29931,
8105,
4841,
29892,
13,
462,
259,
525,
24679,
29954,
2129,
2396,
1583,
29889,
24679,
29954,
2129,
29892,
13,
462,
1678,
525,
29872,
359,
2396,
1583,
29889,
29872,
359,
29892,
525,
29872,
359,
29918,
28084,
2396,
1583,
29889,
29872,
359,
29918,
28084,
29892,
13,
462,
1678,
525,
25365,
29879,
2396,
1583,
29889,
25365,
29879,
29892,
13,
462,
1678,
525,
8678,
893,
2396,
1583,
29889,
8678,
893,
29892,
13,
462,
1678,
525,
29950,
5847,
2396,
1583,
29889,
29950,
16434,
1516,
29892,
13,
462,
1678,
525,
29954,
5847,
2396,
1583,
29889,
29954,
16434,
1516,
29892,
13,
462,
259,
500,
13,
4706,
282,
9415,
29918,
5085,
29889,
5504,
29898,
1311,
29889,
19290,
29897,
13,
13,
4706,
565,
1583,
29889,
978,
1275,
8291,
6545,
2477,
29918,
21738,
29954,
29901,
13,
9651,
282,
9415,
29918,
5085,
1839,
3904,
6545,
2477,
29918,
13155,
2033,
353,
1583,
29889,
3904,
6545,
2477,
29918,
13155,
13,
4706,
25342,
1583,
29889,
978,
1275,
8291,
6545,
2477,
29918,
29928,
8476,
29924,
18783,
29918,
21738,
29954,
29901,
13,
9651,
282,
9415,
29918,
5085,
1839,
3904,
6545,
2477,
29918,
13155,
2033,
353,
1583,
29889,
3904,
6545,
2477,
29918,
29928,
441,
15282,
29918,
13155,
13,
13,
4706,
736,
1583,
29889,
15865,
29918,
5415,
29898,
1068,
15865,
29918,
5085,
29897,
13,
13,
1678,
822,
515,
29918,
3126,
29898,
1311,
29892,
4390,
1125,
13,
4706,
1583,
17255,
8977,
26914,
5504,
29898,
3126,
29897,
13,
4706,
1583,
29889,
842,
29918,
1451,
331,
936,
29918,
6799,
29918,
12650,
580,
13,
4706,
1583,
29889,
842,
29918,
3557,
29918,
29879,
2863,
580,
13,
13,
13,
3286,
571,
29918,
23515,
353,
6024,
842,
29918,
14969,
936,
29918,
3075,
1934,
742,
525,
842,
29918,
1451,
331,
936,
29918,
6799,
29918,
12650,
742,
13,
462,
259,
525,
842,
29918,
3557,
29918,
29879,
2863,
742,
525,
3904,
6545,
2477,
29918,
29928,
441,
15282,
29918,
13155,
742,
525,
3904,
6545,
2477,
29918,
13155,
742,
13,
462,
259,
525,
8678,
893,
2033,
13,
13,
2202,
29901,
13,
1678,
363,
1158,
297,
6782,
29918,
23515,
29901,
13,
4706,
12421,
353,
5493,
15546,
17255,
8977,
1649,
29961,
5696,
29962,
13,
4706,
731,
5552,
29898,
4854,
14459,
26570,
29892,
1158,
29892,
12421,
29897,
13,
19499,
29901,
13,
1678,
363,
1158,
297,
6782,
29918,
23515,
29901,
13,
4706,
731,
5552,
29898,
4854,
14459,
26570,
29892,
1158,
29892,
679,
5552,
29898,
29924,
29875,
15546,
29892,
1158,
876,
13,
13,
2
] |
mlcomp/parallelm/common/buff_to_lines.py | lisapm/mlpiper | 7 | 172185 |
class BufferToLines(object):
def __init__(self):
self._acc_buff = ""
self._last_line = ""
self._in_middle_of_line = False
def add(self, buff):
self._acc_buff += buff.decode()
self._in_middle_of_line = False if self._acc_buff[-1] == '\n' else True
def lines(self):
lines = self._acc_buff.split('\n')
up_to_index = len(lines) - 2 if self._in_middle_of_line else len(lines) - 1
self._acc_buff = lines[-1] if self._in_middle_of_line else ""
for iii in range(up_to_index):
yield lines[iii]
| [
1,
29871,
13,
1990,
16534,
1762,
20261,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
5753,
29918,
28040,
353,
5124,
13,
4706,
1583,
3032,
4230,
29918,
1220,
353,
5124,
13,
4706,
1583,
3032,
262,
29918,
17662,
29918,
974,
29918,
1220,
353,
7700,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
20487,
1125,
13,
4706,
1583,
3032,
5753,
29918,
28040,
4619,
20487,
29889,
13808,
580,
13,
4706,
1583,
3032,
262,
29918,
17662,
29918,
974,
29918,
1220,
353,
7700,
565,
1583,
3032,
5753,
29918,
28040,
14352,
29896,
29962,
1275,
11297,
29876,
29915,
1683,
5852,
13,
13,
1678,
822,
3454,
29898,
1311,
1125,
13,
4706,
3454,
353,
1583,
3032,
5753,
29918,
28040,
29889,
5451,
28909,
29876,
1495,
13,
4706,
701,
29918,
517,
29918,
2248,
353,
7431,
29898,
9012,
29897,
448,
29871,
29906,
565,
1583,
3032,
262,
29918,
17662,
29918,
974,
29918,
1220,
1683,
7431,
29898,
9012,
29897,
448,
29871,
29896,
13,
4706,
1583,
3032,
5753,
29918,
28040,
353,
3454,
14352,
29896,
29962,
565,
1583,
3032,
262,
29918,
17662,
29918,
974,
29918,
1220,
1683,
5124,
13,
13,
4706,
363,
474,
2236,
297,
3464,
29898,
786,
29918,
517,
29918,
2248,
1125,
13,
9651,
7709,
3454,
29961,
25609,
29962,
13,
2
] |
motion_detection.py | udelblue/cv | 0 | 165772 | import cv2
import numpy as np
def main():
#window_name="Cam feed"
#cv2.namedWindow(window_name)
cap=cv2.VideoCapture(0)
#filename = 'F:\sample.avi'
#codec=cv2.VideoWriter_fourcc('X','V','I','D')
#framerate=30
#resolution = (500,500)
# VideoFileOutput = cv2.VideoWriter(filename,codec,framerate,resolution)
if cap.isOpened():
ret,frame = cap.read()
else:
ret =False
ret,frame1 = cap.read()
ret,frame2 = cap.read()
while ret:
ret,frame = cap.read()
#VideoFileOutput.write(frame)
d=cv2.absdiff(frame1,frame2)
grey=cv2.cvtColor(d,cv2.COLOR_BGR2GRAY)
blur =cv2.GaussianBlur(grey,(5,5),0)
ret,th=cv2.threshold(blur,20,255,cv2.THRESH_BINARY)
dilated=cv2.dilate(th,np.ones((3,3),np.uint8),iterations=3)
img,c,h=cv2.findContours(dilated,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(frame1,c,-1,(0,255,0),2)
#cv2.imshow("win1",frame2)
cv2.imshow("inter",frame1)
if cv2.waitKey(40) == 27:
break
frame1 = frame2
ret,frame2= cap.read()
cv2.destroyAllWindows()
#VideoFileOutput.release()
cap.release()
main()
| [
1,
1053,
13850,
29906,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
1753,
1667,
7295,
30004,
13,
259,
396,
7165,
29918,
978,
543,
14353,
8343,
19451,
13,
259,
396,
11023,
29906,
29889,
17514,
5907,
29898,
7165,
29918,
978,
8443,
13,
259,
2117,
29922,
11023,
29906,
29889,
15167,
21133,
545,
29898,
29900,
8443,
13,
30004,
13,
259,
396,
9507,
353,
525,
29943,
3583,
11249,
29889,
17345,
29915,
30004,
13,
259,
396,
401,
29883,
29922,
11023,
29906,
29889,
15167,
10507,
29918,
17823,
617,
877,
29990,
3788,
29963,
3788,
29902,
3788,
29928,
1495,
30004,
13,
259,
396,
1341,
4183,
403,
29922,
29941,
29900,
30004,
13,
259,
396,
9778,
918,
353,
313,
29945,
29900,
29900,
29892,
29945,
29900,
29900,
8443,
13,
30004,
13,
396,
29871,
13987,
2283,
6466,
353,
13850,
29906,
29889,
15167,
10507,
29898,
9507,
29892,
401,
29883,
29892,
1341,
4183,
403,
29892,
9778,
918,
8443,
13,
30004,
13,
259,
6756,
13,
259,
565,
2117,
29889,
275,
6585,
287,
7295,
30004,
13,
418,
6756,
13,
418,
3240,
29892,
2557,
353,
2117,
29889,
949,
26471,
13,
30004,
13,
259,
1683,
29901,
30004,
13,
418,
3240,
353,
8824,
30004,
13,
30004,
13,
259,
3240,
29892,
2557,
29896,
353,
2117,
29889,
949,
26471,
13,
259,
3240,
29892,
2557,
29906,
353,
2117,
29889,
949,
26471,
13,
30004,
13,
259,
1550,
3240,
29901,
30004,
13,
418,
3240,
29892,
2557,
353,
2117,
29889,
949,
26471,
13,
418,
396,
15167,
2283,
6466,
29889,
3539,
29898,
2557,
8443,
13,
30004,
13,
418,
270,
29922,
11023,
29906,
29889,
370,
4928,
2593,
29898,
2557,
29896,
29892,
2557,
29906,
8443,
13,
30004,
13,
418,
18345,
29922,
11023,
29906,
29889,
11023,
29873,
3306,
29898,
29881,
29892,
11023,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29954,
22800,
8443,
13,
30004,
13,
418,
1999,
332,
353,
11023,
29906,
29889,
29954,
17019,
10358,
332,
29898,
7979,
29891,
22657,
29945,
29892,
29945,
511,
29900,
8443,
13,
418,
3240,
29892,
386,
29922,
11023,
29906,
29889,
386,
12268,
29898,
2204,
332,
29892,
29906,
29900,
29892,
29906,
29945,
29945,
29892,
11023,
29906,
29889,
4690,
1525,
7068,
29918,
29933,
1177,
19926,
8443,
13,
418,
21749,
630,
29922,
11023,
29906,
29889,
29881,
309,
403,
29898,
386,
29892,
9302,
29889,
2873,
3552,
29941,
29892,
29941,
511,
9302,
29889,
13470,
29947,
511,
1524,
800,
29922,
29941,
8443,
13,
418,
10153,
29892,
29883,
29892,
29882,
29922,
11023,
29906,
29889,
2886,
1323,
2470,
29898,
29881,
309,
630,
29892,
11023,
29906,
29889,
1525,
5659,
29918,
29911,
21661,
29892,
11023,
29906,
29889,
3210,
29909,
1177,
29918,
3301,
8618,
29990,
29918,
5425,
3580,
1307,
8443,
13,
418,
6756,
13,
418,
13850,
29906,
29889,
4012,
1323,
2470,
29898,
2557,
29896,
29892,
29883,
6653,
29896,
22657,
29900,
29892,
29906,
29945,
29945,
29892,
29900,
511,
29906,
8443,
13,
30004,
13,
418,
396,
11023,
29906,
29889,
326,
4294,
703,
5080,
29896,
613,
2557,
29906,
8443,
13,
418,
13850,
29906,
29889,
326,
4294,
703,
1639,
613,
2557,
29896,
8443,
13,
418,
6756,
13,
418,
565,
13850,
29906,
29889,
10685,
2558,
29898,
29946,
29900,
29897,
1275,
29871,
29906,
29955,
29901,
30004,
13,
308,
2867,
30004,
13,
418,
3515,
29896,
353,
3515,
29906,
30004,
13,
418,
3240,
29892,
2557,
29906,
29922,
2117,
29889,
949,
26471,
13,
259,
13850,
29906,
29889,
20524,
3596,
7685,
26471,
13,
259,
396,
15167,
2283,
6466,
29889,
14096,
26471,
13,
259,
2117,
29889,
14096,
26471,
13,
3396,
580,
259,
6756,
13,
1678,
6756,
13,
2
] |
leetcode/389.py | GihwanKim/Baekjoon | 0 | 187508 | """
File: 389.py
Title: Find the Difference
Difficulty: Easy
URL: https://leetcode.com/problems/find-the-difference/
"""
import unittest
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
sorted_s = list(sorted(s))
sorted_t = list(sorted(t))
for i in range(len(s)):
if sorted_s[i] != sorted_t[i]:
return sorted_t[i]
return sorted_t[-1]
class SolutionTestCase(unittest.TestCase):
def test_example1(self):
# Input
s = "abcd"
t = "abcde"
# Output
output = "e"
solution = Solution()
self.assertEqual(solution.findTheDifference(s, t), output)
def test_example2(self):
# Input
s = ""
t = "y"
# Output
output = "y"
solution = Solution()
self.assertEqual(solution.findTheDifference(s, t), output)
def test_example3(self):
# Input
s = "a"
t = "aa"
# Output
output = "a"
solution = Solution()
self.assertEqual(solution.findTheDifference(s, t), output)
def test_example3(self):
# Input
s = "ae"
t = "aea"
# Output
output = "a"
solution = Solution()
self.assertEqual(solution.findTheDifference(s, t), output)
if __name__ == "__main__":
unittest.main()
| [
1,
9995,
13,
1678,
3497,
29901,
29871,
29941,
29947,
29929,
29889,
2272,
13,
1678,
18527,
29901,
10987,
278,
360,
17678,
13,
1678,
360,
2593,
3953,
29891,
29901,
382,
8995,
13,
1678,
3988,
29901,
2045,
597,
280,
300,
401,
29889,
510,
29914,
17199,
29879,
29914,
2886,
29899,
1552,
29899,
29881,
17678,
29914,
13,
15945,
29908,
13,
13,
5215,
443,
27958,
13,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
1284,
1576,
29928,
17678,
29898,
1311,
29892,
269,
29901,
851,
29892,
260,
29901,
851,
29897,
1599,
851,
29901,
13,
4706,
12705,
29918,
29879,
353,
1051,
29898,
24582,
29898,
29879,
876,
13,
4706,
12705,
29918,
29873,
353,
1051,
29898,
24582,
29898,
29873,
876,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
29879,
22164,
13,
9651,
565,
12705,
29918,
29879,
29961,
29875,
29962,
2804,
12705,
29918,
29873,
29961,
29875,
5387,
13,
18884,
736,
12705,
29918,
29873,
29961,
29875,
29962,
13,
4706,
736,
12705,
29918,
29873,
14352,
29896,
29962,
13,
13,
13,
1990,
24380,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
4773,
29896,
29898,
1311,
1125,
13,
4706,
396,
10567,
13,
4706,
269,
353,
376,
370,
2252,
29908,
13,
4706,
260,
353,
376,
10736,
311,
29908,
13,
4706,
396,
10604,
13,
4706,
1962,
353,
376,
29872,
29908,
13,
13,
4706,
1650,
353,
24380,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2929,
918,
29889,
2886,
1576,
29928,
17678,
29898,
29879,
29892,
260,
511,
1962,
29897,
13,
13,
1678,
822,
1243,
29918,
4773,
29906,
29898,
1311,
1125,
13,
4706,
396,
10567,
13,
4706,
269,
353,
5124,
13,
4706,
260,
353,
376,
29891,
29908,
13,
4706,
396,
10604,
13,
4706,
1962,
353,
376,
29891,
29908,
13,
13,
4706,
1650,
353,
24380,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2929,
918,
29889,
2886,
1576,
29928,
17678,
29898,
29879,
29892,
260,
511,
1962,
29897,
13,
13,
1678,
822,
1243,
29918,
4773,
29941,
29898,
1311,
1125,
13,
4706,
396,
10567,
13,
4706,
269,
353,
376,
29874,
29908,
13,
4706,
260,
353,
376,
7340,
29908,
13,
4706,
396,
10604,
13,
4706,
1962,
353,
376,
29874,
29908,
13,
13,
4706,
1650,
353,
24380,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2929,
918,
29889,
2886,
1576,
29928,
17678,
29898,
29879,
29892,
260,
511,
1962,
29897,
13,
13,
1678,
822,
1243,
29918,
4773,
29941,
29898,
1311,
1125,
13,
4706,
396,
10567,
13,
4706,
269,
353,
376,
3660,
29908,
13,
4706,
260,
353,
376,
3660,
29874,
29908,
13,
4706,
396,
10604,
13,
4706,
1962,
353,
376,
29874,
29908,
13,
13,
4706,
1650,
353,
24380,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2929,
918,
29889,
2886,
1576,
29928,
17678,
29898,
29879,
29892,
260,
511,
1962,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
parser/reader/__init__.py | cheery/better_web_language | 136 | 56597 | from stream import CStream
from tokenizer import L2
from data import Expr, Literal, Position
#import space
#table = {
# u'(': u'lp', u')': u'rp',
# u'[': u'lb', u']': u'rb',
# u'{': u'lc', u'}': u'rc',
# u'and': u'and', u'or': u'or', u'not': u'not',
# u'=': u'let', u':=': u'set',
# u'<': u'chain',
# u'>': u'chain',
# u'<=': u'chain',
# u'>=': u'chain',
# u'==': u'chain',
# u'!=': u'chain',
# u'^': u'op', u'&': u'op', u'<<': u'op',
# u'>>': u'op', u'!': u'op', u'*': u'op',
# u'/': u'op', u'%': u'op', u'+': u'op',
# u'-': u'op', u'|': u'op', u'++': u'op',
# u':': u'symbol',
# u'.': u'dot'}
#binops = {
# u'|': 10,
# u'^': 10,
# u'&': 20,
# u'<<': 30, u'>>': 40,
# u'++': 40, u'+': 40, u'-': 40,
# u'*': 50, u'/': 50, u'%': 50,
#}
#right_binding = []
#prefixes = {
# u'~': 90,
# u'-': 90,
# u'+': 90,
#}
#postfixes = {
# u'!': 100,
#}
#
#def read(source):
# exps = []
# ts = L2(CStream(source), table)
# while ts.filled:
# if ts.position.col != 0:
# raise space.Error(u"%s: layout error" % ts.first.start.repr())
# exps.append(toplevel(ts, 0))
# return exps
#
#def toplevel(ts, col):
# head = expression(ts)
# if head.dcf is not None and ts.filled:
# if head.stop.lno == ts.position.lno:
# head.dcf.capture = [toplevel(ts, col)]
# elif ts.position.col > col:
# head.dcf.capture = exps = []
# scol = ts.position.col
# while ts.filled and ts.position.col == scol:
# exp = toplevel(ts, scol)
# exps.append(exp)
# while ts.filled and ts.position.lno == exp.stop.lno and ts.position.col > scol:
# exps.append(toplevel(ts, scol))
# return head
#
#def expressions(ts):
# exps = []
# while ts.filled:
# if match_some(ts.first, [u'rp', u'rb', u'rc']):
# break
# exps.append(expression(ts))
# return exps
#
#def expression(ts):
# left = expression_and(ts)
# if match(ts.first, u'or'):
# op = ts.advance()
# op.name = u'symbol'
# right = expression(ts)
# return Expr(left.start, right.stop, u'form', [op, left, right])
# return left
#
#def expression_and(ts):
# left = expression_chain(ts)
# if match(ts.first, u'and'):
# op = ts.advance()
# op.name = u'symbol'
# right = expression_and(ts)
# return Expr(left.start, right.stop, u'form', [op, left, right])
# return left
#
#def expression_chain(ts):
# left = expression_bare(ts, 0)
# if match(ts.first, u'chain'):
# exps = [left]
# while match(ts.first, u'chain'):
# op = ts.advance()
# op.name = u'symbol'
# exps.append(op)
# exps.append(expression_bare(ts, 0))
# left = Expr(exps[0].start, exps[len(exps)-1].stop, u'chain', exps)
# return left
#
#def expression_bare(ts, rbp):
# if on_prefix(ts):
# op = ts.advance()
# exp = expression_bare(ts, prefixes[op.value])
# op.name = u'symbol'
# op.value = op.value+u'expr'
# left = Expr(op.start, exp.stop, u'form', [op, exp])
# else:
# left = terminal(ts)
# while ts.filled:
# if match(ts.first, u'dot'):
# dot = ts.advance()
# symbol = ts.advance()
# if not match(symbol, u'symbol'):
# raise space.Error(u"%s: expected symbol" % symbol.start.repr())
# left = Expr(left.start, symbol.stop, u'attr', [left, symbol])
# elif match(ts.first, u'lb') and left.stop.eq(ts.first.start):
# lb = ts.advance()
# exps = expressions(ts)
# if not match(ts.first, u'rb'):
# raise space.Error(u"%s: [] truncates at %s" % (lb.start.repr(), ts.position.repr()))
# rb = ts.advance()
# left = Expr(left.start, rb.stop, u'index', [left] + exps)
# elif match_some(ts.first, [u'let', u'set']):
# let = ts.advance()
# exp = expression(ts)
# left = Expr(left.start, exp.stop, let.name, [left, exp])
# elif match(ts.first, u'op') and match(ts.second, u'let') and ts.first.value in binops:
# aug = ts.advance()
# aug.name = u'symbol'
# let = ts.advance()
# exp = expression(ts)
# left = Expr(left.start, exp.stop, u'aug', [aug, left, exp])
# else:
# break
# while ts.filled:
# if on_binop(left, ts) and rbp < binops.get(ts.first.value, 0):
# op = ts.advance()
# op.name = u'symbol'
# lbp = binops.get(op.value, 0)
# right = expression_bare(ts, lbp - (ts.first.value in right_binding))
# left = Expr(left.start, right.stop, u'form', [op, left, right])
# elif on_postfix(left, ts) and rbp < postfixes.get(ts.first.value, 0):
# op = ts.advance()
# op.name = u'symbol'
# lbp = postfixes.get(op.value, 0)
# op.value = u'expr'+op.value
# left = Expr(left.start, op.stop, u'form', [op, left])
# else:
# break
# return left
#
#def terminal(ts):
# if match_some(ts.first, [u'symbol', u'string', u'int', u'hex', u'float']):
# return ts.advance()
# elif match(ts.first, u'lp'):
# lp = ts.advance()
# exps = expressions(ts)
# if not match(ts.first, u'rp'):
# raise space.Error(u"%s: form truncates at %s" % (lp.start.repr(), ts.position.repr()))
# rp = ts.advance()
# exp = Expr(lp.start, rp.stop, u'form', exps)
# exp.dcf = exp
# return exp
# elif match(ts.first, u'lb'):
# lb = ts.advance()
# exps = expressions(ts)
# if not match(ts.first, u'rb'):
# raise space.Error(u"%s: list truncates at %s" % (lb.start.repr(), ts.position.repr()))
# rb = ts.advance()
# exp = Expr(lb.start, rb.stop, u'list', exps)
# exp.dcf = exp
# return exp
# elif match(ts.first, u'lc'):
# lc = ts.advance()
# if match(ts.second, u'rc'):
# exp = ts.advance()
# exp.name = u'symbol'
# else:
# exp = expression(ts)
# rc = ts.advance()
# return exp
# elif match(ts.first, u'not'):
# op = ts.advance()
# op.name = u'symbol'
# exp = expression_chain(ts)
# return Expr(op.start, exp.stop, u'form', [op, exp])
# if ts.filled:
# raise space.Error(u"%s: expected term, got %s" % (ts.position.repr(), ts.first.value))
# raise space.Error(u"%s: expected term, got eof" % ts.position.repr())
#
#def match_some(t, names):
# return t is not None and t.name in names
#
#def match(t, name):
# return t is not None and t.name == name
#
#def on_prefix(ts):
# if match(ts.first, u'op') and ts.second is not None:
# return ts.first.stop.eq(ts.second.start)
# return False
#
#def on_binop(left, ts):
# if match(ts.first, u'op') and ts.second is not None:
# l = left.stop.eq(ts.first.start)
# r = ts.first.stop.eq(ts.second.start)
# return l == r
# return False
#
#def on_postfix(left, ts):
# if match(ts.first, u'op'):
# l = left.stop.eq(ts.first.start)
# r = ts.second is not None and ts.first.stop.eq(ts.second.start)
# return l and not r
# return False
| [
1,
515,
4840,
1053,
315,
3835,
13,
3166,
5993,
3950,
1053,
365,
29906,
13,
3166,
848,
1053,
1222,
558,
29892,
5449,
284,
29892,
20627,
13,
29937,
5215,
2913,
13,
13,
29937,
2371,
353,
426,
13,
29937,
1678,
318,
29915,
877,
29901,
318,
29915,
22833,
742,
318,
1495,
2396,
318,
29915,
19080,
742,
13,
29937,
1678,
318,
29915,
1839,
29901,
318,
29915,
27728,
742,
318,
2033,
2396,
318,
29915,
6050,
742,
13,
29937,
1678,
318,
29915,
29912,
2396,
318,
29915,
29880,
29883,
742,
318,
10827,
2396,
318,
29915,
2214,
742,
13,
29937,
1678,
318,
29915,
392,
2396,
318,
29915,
392,
742,
318,
29915,
272,
2396,
318,
29915,
272,
742,
318,
29915,
1333,
2396,
318,
29915,
1333,
742,
13,
29937,
1678,
318,
29915,
29922,
2396,
318,
29915,
1026,
742,
318,
2396,
29922,
2396,
318,
29915,
842,
742,
13,
29937,
1678,
318,
29915,
29966,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
11041,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
29915,
14065,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
11041,
29922,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
29915,
1360,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
29915,
19216,
2396,
318,
29915,
14153,
742,
13,
29937,
1678,
318,
29915,
29985,
2396,
318,
29915,
459,
742,
318,
29915,
29987,
2396,
318,
29915,
459,
742,
318,
29915,
9314,
2396,
318,
29915,
459,
742,
13,
29937,
1678,
318,
29915,
6778,
2396,
318,
29915,
459,
742,
318,
29915,
29991,
2396,
318,
29915,
459,
742,
318,
29915,
29930,
2396,
318,
29915,
459,
742,
13,
29937,
1678,
318,
29915,
29914,
2396,
318,
29915,
459,
742,
318,
29915,
29995,
2396,
318,
29915,
459,
742,
318,
18717,
2396,
318,
29915,
459,
742,
13,
29937,
1678,
318,
28560,
2396,
318,
29915,
459,
742,
318,
29915,
29989,
2396,
318,
29915,
459,
742,
318,
29915,
1817,
2396,
318,
29915,
459,
742,
13,
29937,
1678,
318,
2396,
2396,
318,
29915,
18098,
742,
13,
29937,
1678,
318,
4286,
2396,
318,
29915,
6333,
10827,
13,
29937,
2109,
3554,
353,
426,
13,
29937,
1678,
318,
29915,
29989,
2396,
29871,
29896,
29900,
29892,
13,
29937,
1678,
318,
29915,
29985,
2396,
29871,
29896,
29900,
29892,
13,
29937,
1678,
318,
29915,
29987,
2396,
29871,
29906,
29900,
29892,
13,
29937,
1678,
318,
29915,
9314,
2396,
29871,
29941,
29900,
29892,
318,
29915,
6778,
2396,
29871,
29946,
29900,
29892,
13,
29937,
1678,
318,
29915,
1817,
2396,
29871,
29946,
29900,
29892,
318,
18717,
2396,
29871,
29946,
29900,
29892,
318,
28560,
2396,
29871,
29946,
29900,
29892,
13,
29937,
1678,
318,
29915,
29930,
2396,
29871,
29945,
29900,
29892,
318,
29915,
29914,
2396,
29871,
29945,
29900,
29892,
318,
29915,
29995,
2396,
29871,
29945,
29900,
29892,
13,
29937,
29913,
13,
29937,
1266,
29918,
19672,
353,
5159,
13,
29937,
13506,
267,
353,
426,
13,
29937,
1678,
318,
29915,
30022,
2396,
29871,
29929,
29900,
29892,
13,
29937,
1678,
318,
28560,
2396,
29871,
29929,
29900,
29892,
13,
29937,
1678,
318,
18717,
2396,
29871,
29929,
29900,
29892,
13,
29937,
29913,
13,
29937,
2490,
5878,
267,
353,
426,
13,
29937,
1678,
318,
29915,
29991,
2396,
29871,
29896,
29900,
29900,
29892,
13,
29937,
29913,
13,
29937,
13,
29937,
1753,
1303,
29898,
4993,
1125,
13,
29937,
1678,
429,
567,
353,
5159,
13,
29937,
1678,
18696,
353,
365,
29906,
29898,
29907,
3835,
29898,
4993,
511,
1591,
29897,
13,
29937,
1678,
1550,
18696,
29889,
26940,
29901,
13,
29937,
4706,
565,
18696,
29889,
3283,
29889,
1054,
2804,
29871,
29900,
29901,
13,
29937,
9651,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
5912,
1059,
29908,
1273,
18696,
29889,
4102,
29889,
2962,
29889,
276,
558,
3101,
13,
29937,
4706,
429,
567,
29889,
4397,
29898,
29873,
1991,
955,
29898,
1372,
29892,
29871,
29900,
876,
13,
29937,
1678,
736,
429,
567,
13,
29937,
13,
29937,
1753,
304,
552,
955,
29898,
1372,
29892,
784,
1125,
13,
29937,
1678,
2343,
353,
4603,
29898,
1372,
29897,
13,
29937,
1678,
565,
2343,
29889,
29881,
6854,
338,
451,
6213,
322,
18696,
29889,
26940,
29901,
13,
29937,
4706,
565,
2343,
29889,
9847,
29889,
29880,
1217,
1275,
18696,
29889,
3283,
29889,
29880,
1217,
29901,
13,
29937,
9651,
2343,
29889,
29881,
6854,
29889,
17885,
545,
353,
518,
29873,
1991,
955,
29898,
1372,
29892,
784,
4638,
13,
29937,
4706,
25342,
18696,
29889,
3283,
29889,
1054,
1405,
784,
29901,
13,
29937,
9651,
2343,
29889,
29881,
6854,
29889,
17885,
545,
353,
429,
567,
353,
5159,
13,
29937,
9651,
885,
324,
353,
18696,
29889,
3283,
29889,
1054,
13,
29937,
9651,
1550,
18696,
29889,
26940,
322,
18696,
29889,
3283,
29889,
1054,
1275,
885,
324,
29901,
13,
29937,
18884,
1518,
353,
304,
552,
955,
29898,
1372,
29892,
885,
324,
29897,
13,
29937,
18884,
429,
567,
29889,
4397,
29898,
4548,
29897,
13,
29937,
18884,
1550,
18696,
29889,
26940,
322,
18696,
29889,
3283,
29889,
29880,
1217,
1275,
1518,
29889,
9847,
29889,
29880,
1217,
322,
18696,
29889,
3283,
29889,
1054,
1405,
885,
324,
29901,
13,
29937,
462,
1678,
429,
567,
29889,
4397,
29898,
29873,
1991,
955,
29898,
1372,
29892,
885,
324,
876,
13,
29937,
1678,
736,
2343,
13,
29937,
13,
29937,
1753,
12241,
29898,
1372,
1125,
13,
29937,
1678,
429,
567,
353,
5159,
13,
29937,
1678,
1550,
18696,
29889,
26940,
29901,
13,
29937,
4706,
565,
1993,
29918,
5372,
29898,
1372,
29889,
4102,
29892,
518,
29884,
29915,
19080,
742,
318,
29915,
6050,
742,
318,
29915,
2214,
2033,
1125,
13,
29937,
9651,
2867,
13,
29937,
4706,
429,
567,
29889,
4397,
29898,
17471,
29898,
1372,
876,
13,
29937,
1678,
736,
429,
567,
13,
29937,
13,
29937,
1753,
4603,
29898,
1372,
1125,
13,
29937,
1678,
2175,
353,
4603,
29918,
392,
29898,
1372,
29897,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
272,
29374,
13,
29937,
4706,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
4706,
1492,
353,
4603,
29898,
1372,
29897,
13,
29937,
4706,
736,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1492,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
2175,
29892,
1492,
2314,
13,
29937,
1678,
736,
2175,
13,
29937,
13,
29937,
1753,
4603,
29918,
392,
29898,
1372,
1125,
13,
29937,
1678,
2175,
353,
4603,
29918,
14153,
29898,
1372,
29897,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
392,
29374,
13,
29937,
4706,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
4706,
1492,
353,
4603,
29918,
392,
29898,
1372,
29897,
13,
29937,
4706,
736,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1492,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
2175,
29892,
1492,
2314,
13,
29937,
1678,
736,
2175,
13,
29937,
13,
29937,
1753,
4603,
29918,
14153,
29898,
1372,
1125,
13,
29937,
1678,
2175,
353,
4603,
29918,
18354,
29898,
1372,
29892,
29871,
29900,
29897,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
14153,
29374,
13,
29937,
4706,
429,
567,
353,
518,
1563,
29962,
13,
29937,
4706,
1550,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
14153,
29374,
13,
29937,
9651,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
9651,
429,
567,
29889,
4397,
29898,
459,
29897,
13,
29937,
9651,
429,
567,
29889,
4397,
29898,
17471,
29918,
18354,
29898,
1372,
29892,
29871,
29900,
876,
13,
29937,
4706,
2175,
353,
1222,
558,
29898,
735,
567,
29961,
29900,
1822,
2962,
29892,
429,
567,
29961,
2435,
29898,
735,
567,
6817,
29896,
1822,
9847,
29892,
318,
29915,
14153,
742,
429,
567,
29897,
13,
29937,
1678,
736,
2175,
13,
29937,
13,
29937,
1753,
4603,
29918,
18354,
29898,
1372,
29892,
364,
25288,
1125,
13,
29937,
1678,
565,
373,
29918,
13506,
29898,
1372,
1125,
13,
29937,
4706,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1518,
353,
4603,
29918,
18354,
29898,
1372,
29892,
10944,
267,
29961,
459,
29889,
1767,
2314,
13,
29937,
4706,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
4706,
1015,
29889,
1767,
353,
1015,
29889,
1767,
29974,
29884,
29915,
13338,
29915,
13,
29937,
4706,
2175,
353,
1222,
558,
29898,
459,
29889,
2962,
29892,
1518,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
1518,
2314,
13,
29937,
1678,
1683,
29901,
13,
29937,
4706,
2175,
353,
8638,
29898,
1372,
29897,
13,
29937,
1678,
1550,
18696,
29889,
26940,
29901,
13,
29937,
4706,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
6333,
29374,
13,
29937,
9651,
8329,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
5829,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
565,
451,
1993,
29898,
18098,
29892,
318,
29915,
18098,
29374,
13,
29937,
18884,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
3806,
5829,
29908,
1273,
5829,
29889,
2962,
29889,
276,
558,
3101,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
5829,
29889,
9847,
29892,
318,
29915,
5552,
742,
518,
1563,
29892,
5829,
2314,
13,
29937,
4706,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
27728,
1495,
322,
2175,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
4102,
29889,
2962,
1125,
13,
29937,
9651,
27981,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
429,
567,
353,
12241,
29898,
1372,
29897,
13,
29937,
9651,
565,
451,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
6050,
29374,
13,
29937,
18884,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
5159,
21022,
1078,
472,
1273,
29879,
29908,
1273,
313,
27728,
29889,
2962,
29889,
276,
558,
3285,
18696,
29889,
3283,
29889,
276,
558,
22130,
13,
29937,
9651,
364,
29890,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
364,
29890,
29889,
9847,
29892,
318,
29915,
2248,
742,
518,
1563,
29962,
718,
429,
567,
29897,
13,
29937,
4706,
25342,
1993,
29918,
5372,
29898,
1372,
29889,
4102,
29892,
518,
29884,
29915,
1026,
742,
318,
29915,
842,
2033,
1125,
13,
29937,
9651,
1235,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1518,
353,
4603,
29898,
1372,
29897,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1518,
29889,
9847,
29892,
1235,
29889,
978,
29892,
518,
1563,
29892,
1518,
2314,
13,
29937,
4706,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
459,
1495,
322,
1993,
29898,
1372,
29889,
7496,
29892,
318,
29915,
1026,
1495,
322,
18696,
29889,
4102,
29889,
1767,
297,
9016,
3554,
29901,
13,
29937,
9651,
11307,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
11307,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
9651,
1235,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1518,
353,
4603,
29898,
1372,
29897,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1518,
29889,
9847,
29892,
318,
29915,
2987,
742,
518,
2987,
29892,
2175,
29892,
1518,
2314,
13,
29937,
4706,
1683,
29901,
13,
29937,
9651,
2867,
13,
29937,
1678,
1550,
18696,
29889,
26940,
29901,
13,
29937,
4706,
565,
373,
29918,
2109,
459,
29898,
1563,
29892,
18696,
29897,
322,
364,
25288,
529,
9016,
3554,
29889,
657,
29898,
1372,
29889,
4102,
29889,
1767,
29892,
29871,
29900,
1125,
13,
29937,
9651,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
9651,
301,
25288,
353,
9016,
3554,
29889,
657,
29898,
459,
29889,
1767,
29892,
29871,
29900,
29897,
13,
29937,
9651,
1492,
353,
4603,
29918,
18354,
29898,
1372,
29892,
301,
25288,
448,
313,
1372,
29889,
4102,
29889,
1767,
297,
1492,
29918,
19672,
876,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1492,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
2175,
29892,
1492,
2314,
13,
29937,
4706,
25342,
373,
29918,
2490,
5878,
29898,
1563,
29892,
18696,
29897,
322,
364,
25288,
529,
1400,
5878,
267,
29889,
657,
29898,
1372,
29889,
4102,
29889,
1767,
29892,
29871,
29900,
1125,
13,
29937,
9651,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
9651,
301,
25288,
353,
1400,
5878,
267,
29889,
657,
29898,
459,
29889,
1767,
29892,
29871,
29900,
29897,
13,
29937,
9651,
1015,
29889,
1767,
353,
318,
29915,
13338,
18717,
459,
29889,
1767,
13,
29937,
9651,
2175,
353,
1222,
558,
29898,
1563,
29889,
2962,
29892,
1015,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
2175,
2314,
13,
29937,
4706,
1683,
29901,
13,
29937,
9651,
2867,
13,
29937,
1678,
736,
2175,
13,
29937,
13,
29937,
1753,
8638,
29898,
1372,
1125,
13,
29937,
1678,
565,
1993,
29918,
5372,
29898,
1372,
29889,
4102,
29892,
518,
29884,
29915,
18098,
742,
318,
29915,
1807,
742,
318,
29915,
524,
742,
318,
29915,
20970,
742,
318,
29915,
7411,
2033,
1125,
13,
29937,
4706,
736,
18696,
29889,
17263,
749,
580,
13,
29937,
1678,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
22833,
29374,
13,
29937,
4706,
301,
29886,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
429,
567,
353,
12241,
29898,
1372,
29897,
13,
29937,
4706,
565,
451,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
19080,
29374,
13,
29937,
9651,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
883,
21022,
1078,
472,
1273,
29879,
29908,
1273,
313,
22833,
29889,
2962,
29889,
276,
558,
3285,
18696,
29889,
3283,
29889,
276,
558,
22130,
13,
29937,
4706,
364,
29886,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1518,
353,
1222,
558,
29898,
22833,
29889,
2962,
29892,
364,
29886,
29889,
9847,
29892,
318,
29915,
689,
742,
429,
567,
29897,
13,
29937,
4706,
1518,
29889,
29881,
6854,
353,
1518,
13,
29937,
4706,
736,
1518,
13,
29937,
1678,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
27728,
29374,
13,
29937,
4706,
27981,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
429,
567,
353,
12241,
29898,
1372,
29897,
13,
29937,
4706,
565,
451,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
6050,
29374,
13,
29937,
9651,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
1051,
21022,
1078,
472,
1273,
29879,
29908,
1273,
313,
27728,
29889,
2962,
29889,
276,
558,
3285,
18696,
29889,
3283,
29889,
276,
558,
22130,
13,
29937,
4706,
364,
29890,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1518,
353,
1222,
558,
29898,
27728,
29889,
2962,
29892,
364,
29890,
29889,
9847,
29892,
318,
29915,
1761,
742,
429,
567,
29897,
13,
29937,
4706,
1518,
29889,
29881,
6854,
353,
1518,
13,
29937,
4706,
736,
1518,
13,
29937,
1678,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
29880,
29883,
29374,
13,
29937,
4706,
301,
29883,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
565,
1993,
29898,
1372,
29889,
7496,
29892,
318,
29915,
2214,
29374,
13,
29937,
9651,
1518,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
9651,
1518,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
4706,
1683,
29901,
13,
29937,
9651,
1518,
353,
4603,
29898,
1372,
29897,
13,
29937,
4706,
364,
29883,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
736,
1518,
13,
29937,
1678,
25342,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
1333,
29374,
13,
29937,
4706,
1015,
353,
18696,
29889,
17263,
749,
580,
13,
29937,
4706,
1015,
29889,
978,
353,
318,
29915,
18098,
29915,
13,
29937,
4706,
1518,
353,
4603,
29918,
14153,
29898,
1372,
29897,
13,
29937,
4706,
736,
1222,
558,
29898,
459,
29889,
2962,
29892,
1518,
29889,
9847,
29892,
318,
29915,
689,
742,
518,
459,
29892,
1518,
2314,
13,
29937,
1678,
565,
18696,
29889,
26940,
29901,
13,
29937,
4706,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
3806,
1840,
29892,
2355,
1273,
29879,
29908,
1273,
313,
1372,
29889,
3283,
29889,
276,
558,
3285,
18696,
29889,
4102,
29889,
1767,
876,
13,
29937,
1678,
12020,
2913,
29889,
2392,
29898,
29884,
29908,
29995,
29879,
29901,
3806,
1840,
29892,
2355,
321,
974,
29908,
1273,
18696,
29889,
3283,
29889,
276,
558,
3101,
13,
29937,
13,
29937,
1753,
1993,
29918,
5372,
29898,
29873,
29892,
2983,
1125,
13,
29937,
1678,
736,
260,
338,
451,
6213,
322,
260,
29889,
978,
297,
2983,
13,
29937,
13,
29937,
1753,
1993,
29898,
29873,
29892,
1024,
1125,
13,
29937,
1678,
736,
260,
338,
451,
6213,
322,
260,
29889,
978,
1275,
1024,
13,
29937,
13,
29937,
1753,
373,
29918,
13506,
29898,
1372,
1125,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
459,
1495,
322,
18696,
29889,
7496,
338,
451,
6213,
29901,
13,
29937,
4706,
736,
18696,
29889,
4102,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
7496,
29889,
2962,
29897,
13,
29937,
1678,
736,
7700,
13,
29937,
13,
29937,
1753,
373,
29918,
2109,
459,
29898,
1563,
29892,
18696,
1125,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
459,
1495,
322,
18696,
29889,
7496,
338,
451,
6213,
29901,
13,
29937,
4706,
301,
353,
2175,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
4102,
29889,
2962,
29897,
13,
29937,
4706,
364,
353,
18696,
29889,
4102,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
7496,
29889,
2962,
29897,
13,
29937,
4706,
736,
301,
1275,
364,
13,
29937,
1678,
736,
7700,
13,
29937,
13,
29937,
1753,
373,
29918,
2490,
5878,
29898,
1563,
29892,
18696,
1125,
13,
29937,
1678,
565,
1993,
29898,
1372,
29889,
4102,
29892,
318,
29915,
459,
29374,
13,
29937,
4706,
301,
353,
2175,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
4102,
29889,
2962,
29897,
13,
29937,
4706,
364,
353,
18696,
29889,
7496,
338,
451,
6213,
322,
18696,
29889,
4102,
29889,
9847,
29889,
1837,
29898,
1372,
29889,
7496,
29889,
2962,
29897,
13,
29937,
4706,
736,
301,
322,
451,
364,
13,
29937,
1678,
736,
7700,
13,
2
] |
testfixtures/tests/test_roundcomparison.py | Alexhuszagh/XLDiscoverer | 0 | 17953 | # Copyright (c) 2014 Simplistix Ltd
# See license.txt for license details.
from decimal import Decimal
from testfixtures import RoundComparison as R, compare, ShouldRaise
from unittest import TestCase
from ..compat import PY2, PY3
class Tests(TestCase):
def test_equal_yes_rhs(self):
self.assertTrue(0.123457 == R(0.123456, 5))
def test_equal_yes_lhs(self):
self.assertTrue(R(0.123456, 5) == 0.123457)
def test_equal_no_rhs(self):
self.assertFalse(0.123453 == R(0.123456, 5))
def test_equal_no_lhs(self):
self.assertFalse(R(0.123456, 5) == 0.123453)
def test_not_equal_yes_rhs(self):
self.assertFalse(0.123457 != R(0.123456, 5))
def test_not_equal_yes_lhs(self):
self.assertFalse(R(0.123456, 5) != 0.123457)
def test_not_equal_no_rhs(self):
self.assertTrue(0.123453 != R(0.123456, 5))
def test_not_equal_no_lhs(self):
self.assertTrue(R(0.123456, 5) != 0.123453)
def test_equal_in_sequence_rhs(self):
self.assertEqual((1, 2, 0.123457),
(1, 2, R(0.123456, 5)))
def test_equal_in_sequence_lhs(self):
self.assertEqual((1, 2, R(0.123456, 5)),
(1, 2, 0.123457))
def test_not_equal_in_sequence_rhs(self):
self.assertNotEqual((1, 2, 0.1236),
(1, 2, R(0.123456, 5)))
def test_not_equal_in_sequence_lhs(self):
self.assertNotEqual((1, 2, R(0.123456, 5)),
(1, 2, 0.1236))
def test_not_numeric_rhs(self):
with ShouldRaise(TypeError):
'abc' == R(0.123456, 5)
def test_not_numeric_lhs(self):
with ShouldRaise(TypeError):
R(0.123456, 5) == 'abc'
def test_repr(self):
compare('<R:0.12346 to 5 digits>',
repr(R(0.123456, 5)))
def test_str(self):
compare('<R:0.12346 to 5 digits>',
repr(R(0.123456, 5)))
def test_str_negative(self):
if PY3:
expected = '<R:123500 to -2 digits>'
else:
expected = '<R:123500.0 to -2 digits>'
compare(expected, repr(R(123456, -2)))
TYPE_ERROR_DECIMAL = TypeError(
"Cannot compare <R:0.12346 to 5 digits> with <class 'decimal.Decimal'>"
)
def test_equal_yes_decimal_to_float_rhs(self):
with ShouldRaise(self.TYPE_ERROR_DECIMAL, unless=PY2):
self.assertTrue(Decimal("0.123457") == R(0.123456, 5))
def test_equal_yes_decimal_to_float_lhs(self):
with ShouldRaise(self.TYPE_ERROR_DECIMAL, unless=PY2):
self.assertTrue(R(0.123456, 5) == Decimal("0.123457"))
def test_equal_no_decimal_to_float_rhs(self):
with ShouldRaise(self.TYPE_ERROR_DECIMAL, unless=PY2):
self.assertFalse(Decimal("0.123453") == R(0.123456, 5))
def test_equal_no_decimal_to_float_lhs(self):
with ShouldRaise(self.TYPE_ERROR_DECIMAL, unless=PY2):
self.assertFalse(R(0.123456, 5) == Decimal("0.123453"))
TYPE_ERROR_FLOAT = TypeError(
"Cannot compare <R:0.12346 to 5 digits> with <class 'float'>"
)
def test_equal_yes_float_to_decimal_rhs(self):
with ShouldRaise(self.TYPE_ERROR_FLOAT, unless=PY2):
self.assertTrue(0.123457 == R(Decimal("0.123456"), 5))
def test_equal_yes_float_to_decimal_lhs(self):
with ShouldRaise(self.TYPE_ERROR_FLOAT, unless=PY2):
self.assertTrue(R(Decimal("0.123456"), 5) == 0.123457)
def test_equal_no_float_to_decimal_rhs(self):
with ShouldRaise(self.TYPE_ERROR_FLOAT, unless=PY2):
self.assertFalse(0.123453 == R(Decimal("0.123456"), 5))
def test_equal_no_float_to_decimal_lhs(self):
with ShouldRaise(self.TYPE_ERROR_FLOAT, unless=PY2):
self.assertFalse(R(Decimal("0.123456"), 5) == 0.123453)
def test_integer_float(self):
with ShouldRaise(TypeError, unless=PY2):
1 == R(1.000001, 5)
def test_float_integer(self):
with ShouldRaise(TypeError, unless=PY2):
R(1.000001, 5) == 1
def test_equal_yes_integer_other_rhs(self):
self.assertTrue(10 == R(11, -1))
def test_equal_yes_integer_lhs(self):
self.assertTrue(R(11, -1) == 10)
def test_equal_no_integer_rhs(self):
self.assertFalse(10 == R(16, -1))
def test_equal_no_integer_lhs(self):
self.assertFalse(R(16, -1) == 10)
def test_equal_integer_zero_precision(self):
self.assertTrue(1 == R(1, 0))
def test_equal_yes_negative_precision(self):
self.assertTrue(149.123 == R(101.123, -2))
def test_equal_no_negative_precision(self):
self.assertFalse(149.123 == R(150.001, -2))
def test_decimal_yes_rhs(self):
self.assertTrue(Decimal('0.123457') == R(Decimal('0.123456'), 5))
def test_decimal_yes_lhs(self):
self.assertTrue(R(Decimal('0.123456'), 5) == Decimal('0.123457'))
def test_decimal_no_rhs(self):
self.assertFalse(Decimal('0.123453') == R(Decimal('0.123456'), 5))
def test_decimal_no_lhs(self):
self.assertFalse(R(Decimal('0.123456'), 5) == Decimal('0.123453'))
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29946,
3439,
572,
391,
861,
19806,
13,
29937,
2823,
19405,
29889,
3945,
363,
19405,
4902,
29889,
13,
13,
3166,
13677,
1053,
3826,
3039,
13,
3166,
1243,
7241,
486,
1973,
1053,
21595,
1523,
20941,
408,
390,
29892,
7252,
29892,
10575,
29934,
29874,
895,
13,
3166,
443,
27958,
1053,
4321,
8259,
13,
13,
3166,
6317,
12667,
1053,
349,
29979,
29906,
29892,
349,
29979,
29941,
13,
13,
13,
1990,
4321,
29879,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
1275,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
1275,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
1275,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
1275,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
3582,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
2804,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
3582,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
2804,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
1217,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
2804,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
1217,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
2804,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
262,
29918,
16506,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
511,
13,
462,
308,
313,
29896,
29892,
29871,
29906,
29892,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
4961,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
262,
29918,
16506,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29896,
29892,
29871,
29906,
29892,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
8243,
13,
462,
308,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
262,
29918,
16506,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
3664,
9843,
3552,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29906,
29941,
29953,
511,
13,
462,
9651,
313,
29896,
29892,
29871,
29906,
29892,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
4961,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
11745,
29918,
262,
29918,
16506,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
3664,
9843,
3552,
29896,
29892,
29871,
29906,
29892,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
8243,
13,
462,
9651,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29906,
29941,
29953,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
21574,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1542,
2392,
1125,
13,
9651,
525,
10736,
29915,
1275,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
21574,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1542,
2392,
1125,
13,
9651,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
1275,
525,
10736,
29915,
13,
13,
1678,
822,
1243,
29918,
276,
558,
29898,
1311,
1125,
13,
4706,
7252,
877,
29966,
29934,
29901,
29900,
29889,
29896,
29906,
29941,
29946,
29953,
304,
29871,
29945,
13340,
29958,
742,
13,
18884,
2062,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
4961,
13,
13,
1678,
822,
1243,
29918,
710,
29898,
1311,
1125,
13,
4706,
7252,
877,
29966,
29934,
29901,
29900,
29889,
29896,
29906,
29941,
29946,
29953,
304,
29871,
29945,
13340,
29958,
742,
13,
18884,
2062,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
4961,
13,
13,
1678,
822,
1243,
29918,
710,
29918,
22198,
29898,
1311,
1125,
13,
4706,
565,
349,
29979,
29941,
29901,
13,
9651,
3806,
353,
12801,
29934,
29901,
29896,
29906,
29941,
29945,
29900,
29900,
304,
448,
29906,
13340,
16299,
13,
4706,
1683,
29901,
13,
9651,
3806,
353,
12801,
29934,
29901,
29896,
29906,
29941,
29945,
29900,
29900,
29889,
29900,
304,
448,
29906,
13340,
16299,
13,
4706,
7252,
29898,
9684,
29892,
2062,
29898,
29934,
29898,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
448,
29906,
4961,
13,
13,
1678,
323,
6959,
29918,
11432,
29918,
2287,
29907,
2260,
29931,
353,
20948,
29898,
13,
4706,
376,
29089,
7252,
529,
29934,
29901,
29900,
29889,
29896,
29906,
29941,
29946,
29953,
304,
29871,
29945,
13340,
29958,
411,
529,
1990,
525,
7099,
3039,
29889,
23307,
11041,
29908,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
7099,
3039,
29918,
517,
29918,
7411,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
2287,
29907,
2260,
29931,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
5574,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
1159,
1275,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
7099,
3039,
29918,
517,
29918,
7411,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
2287,
29907,
2260,
29931,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
1275,
3826,
3039,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
5783,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
7099,
3039,
29918,
517,
29918,
7411,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
2287,
29907,
2260,
29931,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
8824,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
1159,
1275,
390,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
7099,
3039,
29918,
517,
29918,
7411,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
2287,
29907,
2260,
29931,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
29892,
29871,
29945,
29897,
1275,
3826,
3039,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
5783,
13,
13,
1678,
323,
6959,
29918,
11432,
29918,
29943,
3927,
1299,
353,
20948,
29898,
13,
4706,
376,
29089,
7252,
529,
29934,
29901,
29900,
29889,
29896,
29906,
29941,
29946,
29953,
304,
29871,
29945,
13340,
29958,
411,
529,
1990,
525,
7411,
11041,
29908,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
7411,
29918,
517,
29918,
7099,
3039,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
29943,
3927,
1299,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
5574,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
1275,
390,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
4968,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
7411,
29918,
517,
29918,
7099,
3039,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
29943,
3927,
1299,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
4968,
29871,
29945,
29897,
1275,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
7411,
29918,
517,
29918,
7099,
3039,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
29943,
3927,
1299,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
8824,
29898,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
1275,
390,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
4968,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
7411,
29918,
517,
29918,
7099,
3039,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1311,
29889,
11116,
29918,
11432,
29918,
29943,
3927,
1299,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
23307,
703,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
4968,
29871,
29945,
29897,
1275,
29871,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
16031,
29918,
7411,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1542,
2392,
29892,
6521,
29922,
20055,
29906,
1125,
13,
632,
29896,
1275,
390,
29898,
29896,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
29892,
29871,
29945,
29897,
13,
13,
1678,
822,
1243,
29918,
7411,
29918,
16031,
29898,
1311,
1125,
13,
4706,
411,
10575,
29934,
29874,
895,
29898,
1542,
2392,
29892,
6521,
29922,
20055,
29906,
1125,
13,
9651,
390,
29898,
29896,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
29892,
29871,
29945,
29897,
1275,
29871,
29896,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
16031,
29918,
1228,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29896,
29900,
1275,
390,
29898,
29896,
29896,
29892,
448,
29896,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
16031,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
29896,
29896,
29892,
448,
29896,
29897,
1275,
29871,
29896,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
16031,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29896,
29900,
1275,
390,
29898,
29896,
29953,
29892,
448,
29896,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
16031,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
29896,
29953,
29892,
448,
29896,
29897,
1275,
29871,
29896,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
16031,
29918,
9171,
29918,
17990,
2459,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29896,
1275,
390,
29898,
29896,
29892,
29871,
29900,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
3582,
29918,
22198,
29918,
17990,
2459,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29896,
29946,
29929,
29889,
29896,
29906,
29941,
1275,
390,
29898,
29896,
29900,
29896,
29889,
29896,
29906,
29941,
29892,
448,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
11745,
29918,
1217,
29918,
22198,
29918,
17990,
2459,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29896,
29946,
29929,
29889,
29896,
29906,
29941,
1275,
390,
29898,
29896,
29945,
29900,
29889,
29900,
29900,
29896,
29892,
448,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
7099,
3039,
29918,
3582,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
1495,
1275,
390,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
5477,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
7099,
3039,
29918,
3582,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
29934,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
5477,
29871,
29945,
29897,
1275,
3826,
3039,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29955,
8785,
13,
13,
1678,
822,
1243,
29918,
7099,
3039,
29918,
1217,
29918,
29878,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
1495,
1275,
390,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
5477,
29871,
29945,
876,
13,
13,
1678,
822,
1243,
29918,
7099,
3039,
29918,
1217,
29918,
29880,
9499,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
29934,
29898,
23307,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29953,
5477,
29871,
29945,
29897,
1275,
3826,
3039,
877,
29900,
29889,
29896,
29906,
29941,
29946,
29945,
29941,
8785,
13,
2
] |
benchmarks/solve.py | Kludex/di | 0 | 187816 | """Run this file like python benchmarks/solve.py
It will print out results to the console and open web browser windows.
"""
import anyio
from pyinstrument.profiler import Profiler
from benchmarks.utils import GraphSize, SleepTimes, generate_dag
from di import Container, Dependant, Depends
from di.executors import ConcurrentAsyncExecutor, SimpleSyncExecutor
INTERVAL = 10e-6 # 10 us
async def async_bench(sleep: SleepTimes, graph: GraphSize, iters: int) -> None:
container = Container(executor=ConcurrentAsyncExecutor())
solved = container.solve(
Dependant(generate_dag(Depends, graph, sync=False, sleep=sleep))
)
p = Profiler()
await container.execute_async(solved)
p.start()
for _ in range(iters):
await container.execute_async(solved)
p.stop()
p.print()
p.open_in_browser()
def sync_bench(sleep: SleepTimes, graph: GraphSize, iters: int) -> None:
container = Container(executor=SimpleSyncExecutor())
solved = container.solve(
Dependant(generate_dag(Depends, graph, sync=True, sleep=sleep))
)
p = Profiler()
container.execute_sync(solved)
p.start()
for _ in range(iters):
container.execute_sync(solved)
p.stop()
p.print()
p.open_in_browser()
LARGE_GRAPH = GraphSize(25, 5, 5)
SMALL_GRAPH = GraphSize(1, 1, 1)
FAST_DEPS = SleepTimes(0, 0)
SLOW_DEPS = SleepTimes(1e-3, 1e-3)
if __name__ == "__main__":
anyio.run(async_bench, FAST_DEPS, SMALL_GRAPH, 1_000)
anyio.run(async_bench, FAST_DEPS, LARGE_GRAPH, 1_000)
anyio.run(async_bench, SLOW_DEPS, SMALL_GRAPH, 1_000)
anyio.run(async_bench, SLOW_DEPS, LARGE_GRAPH, 100)
sync_bench(FAST_DEPS, SMALL_GRAPH, iters=1_000)
sync_bench(FAST_DEPS, LARGE_GRAPH, iters=1_000)
sync_bench(SLOW_DEPS, SMALL_GRAPH, iters=1_000)
sync_bench(SLOW_DEPS, LARGE_GRAPH, iters=10)
| [
1,
9995,
6558,
445,
934,
763,
3017,
23513,
29879,
29914,
2929,
345,
29889,
2272,
13,
13,
3112,
674,
1596,
714,
2582,
304,
278,
2991,
322,
1722,
1856,
4714,
5417,
29889,
13,
15945,
29908,
13,
5215,
738,
601,
13,
3166,
11451,
2611,
15461,
29889,
771,
1777,
261,
1053,
23202,
261,
13,
13,
3166,
23513,
29879,
29889,
13239,
1053,
12367,
3505,
29892,
317,
5436,
29164,
29892,
5706,
29918,
24157,
13,
3166,
652,
1053,
21679,
29892,
10034,
5818,
29892,
10034,
1975,
13,
3166,
652,
29889,
4258,
29560,
1053,
1281,
3784,
8123,
13366,
29892,
12545,
21077,
13366,
13,
13,
23845,
8932,
353,
29871,
29896,
29900,
29872,
29899,
29953,
29871,
396,
29871,
29896,
29900,
502,
13,
13,
13,
12674,
822,
7465,
29918,
1785,
305,
29898,
17059,
29901,
317,
5436,
29164,
29892,
3983,
29901,
12367,
3505,
29892,
372,
414,
29901,
938,
29897,
1599,
6213,
29901,
13,
1678,
5639,
353,
21679,
29898,
4258,
3406,
29922,
1168,
3784,
8123,
13366,
3101,
13,
1678,
7484,
353,
5639,
29889,
2929,
345,
29898,
13,
4706,
10034,
5818,
29898,
17158,
29918,
24157,
29898,
8498,
1975,
29892,
3983,
29892,
16523,
29922,
8824,
29892,
8709,
29922,
17059,
876,
13,
1678,
1723,
13,
1678,
282,
353,
23202,
261,
580,
13,
1678,
7272,
5639,
29889,
7978,
29918,
12674,
29898,
2929,
1490,
29897,
13,
1678,
282,
29889,
2962,
580,
13,
1678,
363,
903,
297,
3464,
29898,
277,
414,
1125,
13,
4706,
7272,
5639,
29889,
7978,
29918,
12674,
29898,
2929,
1490,
29897,
13,
1678,
282,
29889,
9847,
580,
13,
1678,
282,
29889,
2158,
580,
13,
1678,
282,
29889,
3150,
29918,
262,
29918,
15965,
580,
13,
13,
13,
1753,
16523,
29918,
1785,
305,
29898,
17059,
29901,
317,
5436,
29164,
29892,
3983,
29901,
12367,
3505,
29892,
372,
414,
29901,
938,
29897,
1599,
6213,
29901,
13,
1678,
5639,
353,
21679,
29898,
4258,
3406,
29922,
15427,
21077,
13366,
3101,
13,
1678,
7484,
353,
5639,
29889,
2929,
345,
29898,
13,
4706,
10034,
5818,
29898,
17158,
29918,
24157,
29898,
8498,
1975,
29892,
3983,
29892,
16523,
29922,
5574,
29892,
8709,
29922,
17059,
876,
13,
1678,
1723,
13,
1678,
282,
353,
23202,
261,
580,
13,
1678,
5639,
29889,
7978,
29918,
16593,
29898,
2929,
1490,
29897,
13,
1678,
282,
29889,
2962,
580,
13,
1678,
363,
903,
297,
3464,
29898,
277,
414,
1125,
13,
4706,
5639,
29889,
7978,
29918,
16593,
29898,
2929,
1490,
29897,
13,
1678,
282,
29889,
9847,
580,
13,
1678,
282,
29889,
2158,
580,
13,
1678,
282,
29889,
3150,
29918,
262,
29918,
15965,
580,
13,
13,
13,
29931,
1718,
1692,
29918,
14345,
3301,
29950,
353,
12367,
3505,
29898,
29906,
29945,
29892,
29871,
29945,
29892,
29871,
29945,
29897,
13,
29903,
1529,
2208,
29918,
14345,
3301,
29950,
353,
12367,
3505,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4519,
1254,
29918,
2287,
7024,
353,
317,
5436,
29164,
29898,
29900,
29892,
29871,
29900,
29897,
13,
29903,
27998,
29918,
2287,
7024,
353,
317,
5436,
29164,
29898,
29896,
29872,
29899,
29941,
29892,
29871,
29896,
29872,
29899,
29941,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
738,
601,
29889,
3389,
29898,
12674,
29918,
1785,
305,
29892,
13515,
1254,
29918,
2287,
7024,
29892,
317,
1529,
2208,
29918,
14345,
3301,
29950,
29892,
29871,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
738,
601,
29889,
3389,
29898,
12674,
29918,
1785,
305,
29892,
13515,
1254,
29918,
2287,
7024,
29892,
365,
1718,
1692,
29918,
14345,
3301,
29950,
29892,
29871,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
738,
601,
29889,
3389,
29898,
12674,
29918,
1785,
305,
29892,
317,
27998,
29918,
2287,
7024,
29892,
317,
1529,
2208,
29918,
14345,
3301,
29950,
29892,
29871,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
738,
601,
29889,
3389,
29898,
12674,
29918,
1785,
305,
29892,
317,
27998,
29918,
2287,
7024,
29892,
365,
1718,
1692,
29918,
14345,
3301,
29950,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
16523,
29918,
1785,
305,
29898,
4519,
1254,
29918,
2287,
7024,
29892,
317,
1529,
2208,
29918,
14345,
3301,
29950,
29892,
372,
414,
29922,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
16523,
29918,
1785,
305,
29898,
4519,
1254,
29918,
2287,
7024,
29892,
365,
1718,
1692,
29918,
14345,
3301,
29950,
29892,
372,
414,
29922,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
16523,
29918,
1785,
305,
29898,
29903,
27998,
29918,
2287,
7024,
29892,
317,
1529,
2208,
29918,
14345,
3301,
29950,
29892,
372,
414,
29922,
29896,
29918,
29900,
29900,
29900,
29897,
13,
1678,
16523,
29918,
1785,
305,
29898,
29903,
27998,
29918,
2287,
7024,
29892,
365,
1718,
1692,
29918,
14345,
3301,
29950,
29892,
372,
414,
29922,
29896,
29900,
29897,
13,
2
] |
djl10n/views.py | ralkan/django-l10n | 1 | 61672 | <gh_stars>1-10
import json
from django.conf import settings
from django.template import Context, Template
from django.http import HttpResponse
from .helpers import get_translations
js_catalog_template = r"""
{% autoescape off %}
(function (globals) {
String.prototype.toTitleCase = function() {
return this.replace(
/([^\W_]+[^\s-_]*) */g,
function(txt){
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
String.prototype.toUpperCaseFirstChar = function() {
return this.substr(0, 1).toUpperCase() + this.substr(1);
};
String.prototype.isUpperCase = function() {
return this == this.toUpperCase();
};
String.prototype.isTitleCase = function() {
return this == this.toTitleCase();
};
String.prototype.isUpperCaseFirstChar = function() {
return this == this.toUpperCaseFirstChar();
};
var django = globals.django || (globals.django = {});
/* gettext library */
django.translations = {{ catalog_str }};
django.localize = function (key, fallback, placeholders) {
fallback = typeof(fallback) == "undefined" ? key : fallback;
var value = django.translations[key.toLowerCase()];
if (typeof(value) == 'undefined') {
{% if not debug %}
value = fallback;
{% else %}
value = '\{\{' + key + '\}\}';
{% endif %}
}
if (placeholders && placeholders['plural']) {
var plural = parseInt(placeholders['plural']);
var values = value.split('|');
delete placeholders['plural'];
if (plural == 1 || values.length < 2) {
value = value.split('|')[0];
} else {
value = value.split('|')[1];
}
}
for (var ph in placeholders) {
value = value.replace(':' + ph, placeholders[ph]);
}
if (key.isUpperCase()) {
value = value.toUpperCase();
} else if (key.isTitleCase()) {
value = value.toTitleCase();
} else if (key.isUpperCaseFirstChar()) {
value = value.toUpperCaseFirstChar();
}
return value;
};
/* formatting library */
globals.localize = django.localize;
}(this));
{% endautoescape %}
"""
def render_javascript_catalog(translations=None):
def _indent(s):
return s.replace('\n', '\n ')
template = Template(js_catalog_template)
context = Context({
'catalog_str': _indent(json.dumps(
translations, sort_keys=True, indent=2)) if translations else {},
'debug': settings.LOCALIZE_DEBUG
})
return HttpResponse(template.render(context), 'text/javascript')
def javascript_catalog(request, domain='globaljs', packages=None):
locale = request.LANGUAGE_CODE
translations = get_translations(locale, domain)
return render_javascript_catalog(translations)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
4390,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
6886,
1053,
15228,
29892,
25663,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
13,
13,
3166,
869,
3952,
6774,
1053,
679,
29918,
3286,
29880,
800,
13,
13,
13,
1315,
29918,
28045,
29918,
6886,
353,
364,
15945,
29908,
13,
18255,
4469,
21587,
1283,
15493,
13,
29898,
2220,
313,
23705,
1338,
29897,
426,
13,
29871,
1714,
29889,
16309,
29889,
517,
7030,
8259,
353,
740,
580,
426,
13,
1678,
736,
445,
29889,
6506,
29898,
13,
418,
847,
4197,
3823,
29956,
29918,
10062,
29961,
3823,
29879,
29899,
29918,
29962,
7528,
3776,
29887,
29892,
13,
418,
740,
29898,
3945,
2597,
13,
4706,
736,
13872,
29889,
3090,
4178,
29898,
29900,
467,
517,
26214,
8259,
580,
718,
13872,
29889,
27790,
29898,
29896,
467,
517,
19357,
8259,
890,
13,
418,
2604,
13,
29871,
500,
13,
29871,
1714,
29889,
16309,
29889,
517,
26214,
8259,
6730,
5914,
353,
740,
580,
426,
13,
1678,
736,
445,
29889,
27790,
29898,
29900,
29892,
29871,
29896,
467,
517,
26214,
8259,
580,
718,
445,
29889,
27790,
29898,
29896,
416,
13,
29871,
3980,
13,
13,
29871,
1714,
29889,
16309,
29889,
275,
26214,
8259,
353,
740,
580,
426,
13,
1678,
736,
445,
1275,
445,
29889,
517,
26214,
8259,
890,
13,
29871,
3980,
13,
29871,
1714,
29889,
16309,
29889,
275,
7030,
8259,
353,
740,
580,
426,
13,
1678,
736,
445,
1275,
445,
29889,
517,
7030,
8259,
890,
13,
29871,
3980,
13,
29871,
1714,
29889,
16309,
29889,
275,
26214,
8259,
6730,
5914,
353,
740,
580,
426,
13,
1678,
736,
445,
1275,
445,
29889,
517,
26214,
8259,
6730,
5914,
890,
13,
29871,
3980,
13,
13,
13,
29871,
722,
9557,
353,
13149,
1338,
29889,
14095,
3830,
313,
23705,
1338,
29889,
14095,
353,
426,
3680,
13,
13,
29871,
4949,
679,
726,
3489,
3776,
13,
13,
29871,
9557,
29889,
3286,
29880,
800,
353,
8620,
16653,
29918,
710,
500,
3400,
13,
13,
29871,
9557,
29889,
2997,
675,
353,
740,
313,
1989,
29892,
6416,
1627,
29892,
2058,
8948,
414,
29897,
426,
13,
1678,
6416,
1627,
353,
20086,
29898,
11950,
1627,
29897,
1275,
376,
15955,
29908,
1577,
1820,
584,
6416,
1627,
29936,
13,
1678,
722,
995,
353,
9557,
29889,
3286,
29880,
800,
29961,
1989,
29889,
517,
19357,
8259,
580,
1385,
13,
1678,
565,
313,
18059,
29898,
1767,
29897,
1275,
525,
15955,
1495,
426,
13,
418,
18674,
565,
451,
4744,
15493,
13,
418,
995,
353,
6416,
1627,
29936,
13,
418,
18674,
1683,
15493,
13,
418,
995,
353,
11297,
741,
10998,
718,
1820,
718,
11297,
1012,
29913,
2670,
13,
418,
18674,
1095,
361,
15493,
13,
1678,
500,
13,
1678,
565,
313,
6689,
8948,
414,
2607,
2058,
8948,
414,
1839,
572,
3631,
11287,
426,
13,
418,
722,
715,
3631,
353,
6088,
2928,
29898,
6689,
8948,
414,
1839,
572,
3631,
17077,
13,
418,
722,
1819,
353,
995,
29889,
5451,
877,
29989,
2157,
13,
418,
5217,
2058,
8948,
414,
1839,
572,
3631,
8219,
13,
418,
565,
313,
572,
3631,
1275,
29871,
29896,
3830,
1819,
29889,
2848,
529,
29871,
29906,
29897,
426,
13,
4706,
995,
353,
995,
29889,
5451,
877,
29989,
29861,
29900,
1385,
13,
418,
500,
1683,
426,
13,
4706,
995,
353,
995,
29889,
5451,
877,
29989,
29861,
29896,
1385,
13,
418,
500,
13,
1678,
500,
13,
1678,
363,
313,
1707,
1374,
297,
2058,
8948,
414,
29897,
426,
13,
418,
995,
353,
995,
29889,
6506,
877,
11283,
718,
1374,
29892,
2058,
8948,
414,
29961,
561,
5691,
13,
1678,
500,
13,
13,
1678,
565,
313,
1989,
29889,
275,
26214,
8259,
3101,
426,
13,
418,
995,
353,
995,
29889,
517,
26214,
8259,
890,
13,
1678,
500,
1683,
565,
313,
1989,
29889,
275,
7030,
8259,
3101,
426,
13,
418,
995,
353,
995,
29889,
517,
7030,
8259,
890,
13,
1678,
500,
1683,
565,
313,
1989,
29889,
275,
26214,
8259,
6730,
5914,
3101,
426,
13,
418,
995,
353,
995,
29889,
517,
26214,
8259,
6730,
5914,
890,
13,
1678,
500,
13,
13,
1678,
736,
995,
29936,
13,
29871,
3980,
13,
13,
29871,
4949,
15998,
3489,
3776,
13,
13,
29871,
13149,
1338,
29889,
2997,
675,
353,
9557,
29889,
2997,
675,
29936,
13,
13,
2119,
1366,
2483,
13,
18255,
1095,
6921,
21587,
15493,
13,
15945,
29908,
13,
13,
13,
1753,
4050,
29918,
7729,
29918,
28045,
29898,
3286,
29880,
800,
29922,
8516,
1125,
13,
1678,
822,
903,
12860,
29898,
29879,
1125,
13,
4706,
736,
269,
29889,
6506,
28909,
29876,
742,
11297,
29876,
29871,
25710,
13,
13,
1678,
4472,
353,
25663,
29898,
1315,
29918,
28045,
29918,
6886,
29897,
13,
1678,
3030,
353,
15228,
3319,
13,
4706,
525,
28045,
29918,
710,
2396,
903,
12860,
29898,
3126,
29889,
29881,
17204,
29898,
13,
9651,
5578,
800,
29892,
2656,
29918,
8149,
29922,
5574,
29892,
29536,
29922,
29906,
876,
565,
5578,
800,
1683,
24335,
13,
4706,
525,
8382,
2396,
6055,
29889,
16652,
1964,
29902,
10721,
29918,
18525,
13,
1678,
5615,
13,
13,
1678,
736,
9056,
5103,
29898,
6886,
29889,
9482,
29898,
4703,
511,
525,
726,
29914,
7729,
1495,
13,
13,
13,
1753,
3513,
29918,
28045,
29898,
3827,
29892,
5354,
2433,
10945,
1315,
742,
9741,
29922,
8516,
1125,
13,
1678,
15068,
353,
2009,
29889,
29931,
19453,
29965,
10461,
29918,
16524,
13,
13,
1678,
5578,
800,
353,
679,
29918,
3286,
29880,
800,
29898,
23337,
29892,
5354,
29897,
13,
1678,
736,
4050,
29918,
7729,
29918,
28045,
29898,
3286,
29880,
800,
29897,
13,
2
] |
tests/__init__.py | jdeepe/Dynamodb-ORM-Demo | 0 | 121281 | from api.dataset.models import DataSchema, Dataset
def verify_settings(model, p_key, settings):
details = eval(model).get(p_key)
for key, setting in settings.items():
print(getattr(details, key), setting)
setting = setting if setting else None
assert getattr(details, key) == setting
def load_data():
load_dataschema_data()
load_dataset()
def load_dataschema_data():
DataSchema.create_table(read_capacity_units=1, write_capacity_units=1, wait=True)
for i in range(50):
name = "WorkOrder_v%d" % i
data_schema = DataSchema(name)
data = {
"dataset": name,
"status": "RETIRED",
"description": "Schema for %s" % name,
"creation_timestamp": "2017-04-24T11:38:41.164Z",
"last_updated_timestamp": "2017-12-24T22:38:47.346Z",
}
for key in data:
setattr(data_schema, key, data[key])
data_schema.save()
def load_dataset():
for i in range(50):
data = {
"name": "Forecast_v%d" % i,
"description": "Providing a demand forecast",
"status": "ACTIVE",
"type": "TRANSACTIONAL",
"frequency": "DAILY",
"classification": "Orange",
"owner": "Forecast team",
"owner_contact": "forecast@",
"service_arn": "arn:aws:s3:::org.ent-data-lake",
"location_pointer": "my.org/Forecasting/Forecast_v1",
"creation_timestamp": "2017-01-12T11:39:43.164Z",
"derived_from": None,
"replaced_by": None,
"from_date": "2017-01-03",
"to_date": None,
"schema_name": "Forecast_schema_v1",
"schema_location": None,
"data_lineage": None,
"compliance": None,
"enforce_sla": None,
"sla_cron": "0 6 * * *",
"tags": [
{"key": "org", "value": "CRM"},
{"key": "cost", "value": "SupplyChain"},
],
"retention": None,
"encryption": None,
"encryption_type": None,
"encryption_kms_id": None,
"cross_region_replication": None,
"config_crr": None,
"password": None,
"s3_logging_enabled": None,
"config_s3_logging": None,
"requestor_pays_enabled": None,
}
name = "Forecast_v%d" % i
dataset = Dataset(name)
for key in data:
setattr(dataset, key, data[key])
dataset.save()
| [
1,
515,
7882,
29889,
24713,
29889,
9794,
1053,
3630,
12763,
29892,
13373,
24541,
13,
13,
13,
1753,
11539,
29918,
11027,
29898,
4299,
29892,
282,
29918,
1989,
29892,
6055,
1125,
13,
1678,
4902,
353,
19745,
29898,
4299,
467,
657,
29898,
29886,
29918,
1989,
29897,
13,
1678,
363,
1820,
29892,
4444,
297,
6055,
29889,
7076,
7295,
13,
4706,
1596,
29898,
657,
5552,
29898,
14144,
29892,
1820,
511,
4444,
29897,
13,
4706,
4444,
353,
4444,
565,
4444,
1683,
6213,
13,
4706,
4974,
679,
5552,
29898,
14144,
29892,
1820,
29897,
1275,
4444,
13,
13,
13,
1753,
2254,
29918,
1272,
7295,
13,
1678,
2254,
29918,
14538,
305,
2603,
29918,
1272,
580,
13,
1678,
2254,
29918,
24713,
580,
13,
13,
13,
1753,
2254,
29918,
14538,
305,
2603,
29918,
1272,
7295,
13,
1678,
3630,
12763,
29889,
3258,
29918,
2371,
29898,
949,
29918,
5030,
5946,
29918,
348,
1169,
29922,
29896,
29892,
2436,
29918,
5030,
5946,
29918,
348,
1169,
29922,
29896,
29892,
4480,
29922,
5574,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29945,
29900,
1125,
13,
4706,
1024,
353,
376,
5531,
7514,
29918,
29894,
29995,
29881,
29908,
1273,
474,
13,
4706,
848,
29918,
11010,
353,
3630,
12763,
29898,
978,
29897,
13,
4706,
848,
353,
426,
13,
9651,
376,
24713,
1115,
1024,
29892,
13,
9651,
376,
4882,
1115,
376,
1525,
24301,
19386,
613,
13,
9651,
376,
8216,
1115,
376,
12763,
363,
1273,
29879,
29908,
1273,
1024,
29892,
13,
9651,
376,
1037,
362,
29918,
16394,
1115,
376,
29906,
29900,
29896,
29955,
29899,
29900,
29946,
29899,
29906,
29946,
29911,
29896,
29896,
29901,
29941,
29947,
29901,
29946,
29896,
29889,
29896,
29953,
29946,
29999,
613,
13,
9651,
376,
4230,
29918,
21402,
29918,
16394,
1115,
376,
29906,
29900,
29896,
29955,
29899,
29896,
29906,
29899,
29906,
29946,
29911,
29906,
29906,
29901,
29941,
29947,
29901,
29946,
29955,
29889,
29941,
29946,
29953,
29999,
613,
13,
4706,
500,
13,
4706,
363,
1820,
297,
848,
29901,
13,
9651,
731,
5552,
29898,
1272,
29918,
11010,
29892,
1820,
29892,
848,
29961,
1989,
2314,
13,
4706,
848,
29918,
11010,
29889,
7620,
580,
13,
13,
13,
1753,
2254,
29918,
24713,
7295,
13,
1678,
363,
474,
297,
3464,
29898,
29945,
29900,
1125,
13,
4706,
848,
353,
426,
13,
9651,
376,
978,
1115,
376,
29943,
487,
4384,
29918,
29894,
29995,
29881,
29908,
1273,
474,
29892,
13,
9651,
376,
8216,
1115,
376,
1184,
29894,
4821,
263,
9667,
29821,
579,
613,
13,
9651,
376,
4882,
1115,
376,
17923,
18474,
613,
13,
9651,
376,
1853,
1115,
376,
26813,
8132,
9838,
1964,
613,
13,
9651,
376,
10745,
23860,
1115,
376,
7698,
6227,
29979,
613,
13,
9651,
376,
1990,
2450,
1115,
376,
29949,
3881,
613,
13,
9651,
376,
20348,
1115,
376,
29943,
487,
4384,
3815,
613,
13,
9651,
376,
20348,
29918,
12346,
1115,
376,
1079,
4384,
24695,
13,
9651,
376,
5509,
29918,
2753,
1115,
376,
2753,
29901,
10467,
29901,
29879,
29941,
1057,
29901,
990,
29889,
296,
29899,
1272,
29899,
433,
446,
613,
13,
9651,
376,
5479,
29918,
17226,
1115,
376,
1357,
29889,
990,
29914,
29943,
487,
4384,
292,
29914,
29943,
487,
4384,
29918,
29894,
29896,
613,
13,
9651,
376,
1037,
362,
29918,
16394,
1115,
376,
29906,
29900,
29896,
29955,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29896,
29901,
29941,
29929,
29901,
29946,
29941,
29889,
29896,
29953,
29946,
29999,
613,
13,
9651,
376,
672,
2347,
29918,
3166,
1115,
6213,
29892,
13,
9651,
376,
3445,
433,
1133,
29918,
1609,
1115,
6213,
29892,
13,
9651,
376,
3166,
29918,
1256,
1115,
376,
29906,
29900,
29896,
29955,
29899,
29900,
29896,
29899,
29900,
29941,
613,
13,
9651,
376,
517,
29918,
1256,
1115,
6213,
29892,
13,
9651,
376,
11010,
29918,
978,
1115,
376,
29943,
487,
4384,
29918,
11010,
29918,
29894,
29896,
613,
13,
9651,
376,
11010,
29918,
5479,
1115,
6213,
29892,
13,
9651,
376,
1272,
29918,
1220,
482,
1115,
6213,
29892,
13,
9651,
376,
2388,
13036,
1115,
6213,
29892,
13,
9651,
376,
264,
10118,
29918,
29879,
433,
1115,
6213,
29892,
13,
9651,
376,
29879,
433,
29918,
29883,
1617,
1115,
376,
29900,
29871,
29953,
334,
334,
334,
613,
13,
9651,
376,
11338,
1115,
518,
13,
18884,
8853,
1989,
1115,
376,
990,
613,
376,
1767,
1115,
376,
11341,
29924,
10758,
13,
18884,
8853,
1989,
1115,
376,
18253,
613,
376,
1767,
1115,
376,
20182,
368,
14688,
10758,
13,
9651,
21251,
13,
9651,
376,
2267,
2509,
1115,
6213,
29892,
13,
9651,
376,
3977,
14272,
1115,
6213,
29892,
13,
9651,
376,
3977,
14272,
29918,
1853,
1115,
6213,
29892,
13,
9651,
376,
3977,
14272,
29918,
29895,
1516,
29918,
333,
1115,
6213,
29892,
13,
9651,
376,
19128,
29918,
12803,
29918,
3445,
1414,
1115,
6213,
29892,
13,
9651,
376,
2917,
29918,
7283,
29878,
1115,
6213,
29892,
13,
9651,
376,
5630,
1115,
6213,
29892,
13,
9651,
376,
29879,
29941,
29918,
21027,
29918,
17590,
1115,
6213,
29892,
13,
9651,
376,
2917,
29918,
29879,
29941,
29918,
21027,
1115,
6213,
29892,
13,
9651,
376,
3827,
272,
29918,
29886,
1036,
29918,
17590,
1115,
6213,
29892,
13,
4706,
500,
13,
4706,
1024,
353,
376,
29943,
487,
4384,
29918,
29894,
29995,
29881,
29908,
1273,
474,
13,
4706,
8783,
353,
13373,
24541,
29898,
978,
29897,
13,
4706,
363,
1820,
297,
848,
29901,
13,
9651,
731,
5552,
29898,
24713,
29892,
1820,
29892,
848,
29961,
1989,
2314,
13,
4706,
8783,
29889,
7620,
580,
13,
2
] |
lib/base_folder.py | collinahn/file_name_changer | 1 | 1613963 | # working dir 를 저장하는 싱글턴 클래스
from dataclasses import (
dataclass,
field
)
class MetaSingleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super().__call__(*args, **kwargs)
return cls._instances[cls]
@dataclass(frozen=True)
class WorkingDir(metaclass=MetaSingleton):
abs_path: str = field(default_factory='')
rel_path: str = field(default_factory='')
if __name__ == '__main__':
import utils
p1 = WorkingDir(utils.extract_dir(), utils.get_relative_path('.'))
print(p1) # Config(name='John', age='25')
p2 = WorkingDir('', '')
print(p2) # Config(name='John', age='25')
print(p1 == p2) # True
print(p1 is p2) # True | [
1,
396,
1985,
4516,
29871,
31517,
29871,
239,
163,
131,
31299,
30944,
31081,
29871,
239,
142,
180,
237,
187,
131,
240,
135,
183,
29871,
240,
132,
183,
238,
161,
155,
30784,
13,
13,
3166,
848,
13203,
1053,
313,
13,
1678,
848,
1990,
29892,
13,
1678,
1746,
13,
29897,
13,
13,
13,
1990,
20553,
10873,
11285,
29898,
1853,
1125,
13,
1678,
903,
2611,
2925,
353,
6571,
13,
13,
1678,
822,
4770,
4804,
12035,
25932,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
565,
1067,
29879,
451,
297,
1067,
29879,
3032,
2611,
2925,
29901,
13,
9651,
1067,
29879,
3032,
2611,
2925,
29961,
25932,
29962,
353,
2428,
2141,
1649,
4804,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
736,
1067,
29879,
3032,
2611,
2925,
29961,
25932,
29962,
13,
13,
13,
29992,
1272,
1990,
29898,
29888,
307,
2256,
29922,
5574,
29897,
13,
1990,
24176,
9170,
29898,
2527,
562,
605,
29922,
19346,
10873,
11285,
1125,
13,
1678,
6425,
29918,
2084,
29901,
851,
353,
1746,
29898,
4381,
29918,
14399,
2433,
1495,
13,
1678,
1104,
29918,
2084,
29901,
851,
353,
1746,
29898,
4381,
29918,
14399,
2433,
1495,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
1053,
3667,
29879,
13,
1678,
282,
29896,
353,
24176,
9170,
29898,
13239,
29889,
21111,
29918,
3972,
3285,
3667,
29879,
29889,
657,
29918,
22925,
29918,
2084,
877,
6169,
876,
13,
1678,
1596,
29898,
29886,
29896,
29897,
29871,
396,
12782,
29898,
978,
2433,
11639,
742,
5046,
2433,
29906,
29945,
1495,
13,
1678,
282,
29906,
353,
24176,
9170,
877,
742,
27255,
13,
1678,
1596,
29898,
29886,
29906,
29897,
29871,
396,
12782,
29898,
978,
2433,
11639,
742,
5046,
2433,
29906,
29945,
1495,
13,
13,
1678,
1596,
29898,
29886,
29896,
1275,
282,
29906,
29897,
29871,
396,
5852,
13,
1678,
1596,
29898,
29886,
29896,
338,
282,
29906,
29897,
29871,
396,
5852,
2
] |
changelogger/urls.py | zhelyabuzhsky/changelogger | 1 | 45431 | from django.conf.urls import include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path
urlpatterns = [
path("", include("changelogs.urls")),
path("admin/", admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
path("login/", auth_views.LoginView.as_view()),
path("logout/", auth_views.LogoutView.as_view()),
path("oauth/", include("social_django.urls", namespace="social")),
]
| [
1,
515,
9557,
29889,
5527,
29889,
26045,
1053,
3160,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
8386,
408,
4817,
29918,
7406,
13,
3166,
9557,
29889,
26045,
1053,
2224,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
2224,
703,
613,
3160,
703,
305,
9477,
12099,
29889,
26045,
1159,
511,
13,
1678,
2224,
703,
6406,
29914,
613,
4113,
29889,
2746,
29889,
26045,
511,
13,
1678,
2224,
703,
10149,
29879,
29914,
613,
3160,
703,
14095,
29889,
21570,
29889,
5150,
29889,
26045,
1159,
511,
13,
1678,
2224,
703,
7507,
29914,
613,
4817,
29918,
7406,
29889,
11049,
1043,
29889,
294,
29918,
1493,
25739,
13,
1678,
2224,
703,
1188,
449,
29914,
613,
4817,
29918,
7406,
29889,
3403,
449,
1043,
29889,
294,
29918,
1493,
25739,
13,
1678,
2224,
703,
23106,
29914,
613,
3160,
703,
24911,
29918,
14095,
29889,
26045,
613,
7397,
543,
24911,
1159,
511,
13,
29962,
13,
2
] |
rnafbinv/mutator.py | matandro/RNAsfbinv | 3 | 137545 | <filename>rnafbinv/mutator.py
#!/usr/bin/env python3
'''
enter description
'''
import random
from rnafbinv import IUPAC, tree_aligner
from typing import Dict, Any
import enum
'''
1) select motif? / select index -> identify motif? (single / double on stem)
2) identify sequence constrains ( / missing constraints)
3) select random possible mutation (addition, removal or modification)
'''
class Action(enum.Enum):
REPLACE = 1
ADD = 2
REMOVE = 3
def perturbate(current_sequence: str, match_tree: tree_aligner.Tree, options: Dict[str, Any]) -> str:
min_length = len(options.get('target_structure')) - options.get('vlength')
max_length = len(options.get('target_structure')) + options.get('vlength')
actions = [Action.REPLACE]
if len(current_sequence) < max_length:
actions.append(Action.ADD)
if len(current_sequence) > min_length:
actions.append(Action.REMOVE)
# mutated_sequence = simple_point_mutation(current_sequence, random.choice(actions))
mutated_sequence = multi_point_mutation(current_sequence, min_length, max_length, random.choice(actions))
return mutated_sequence
def simple_point_mutation(old_sequence: str, action: Action=Action.REPLACE) -> str:
index = random.randint(0, len(old_sequence) - 1)
if action == Action.REPLACE:
sequence = old_sequence[:index] + random.choice(IUPAC.IUPAC_RNA_BASE.replace(old_sequence[index], '')) + \
old_sequence[index + 1:]
elif action == Action.ADD:
sequence = old_sequence[:index] + random.choice(IUPAC.IUPAC_RNA_BASE.replace(old_sequence[index], '')) + \
old_sequence[index:]
elif action == Action.REMOVE:
sequence = old_sequence[:index] + old_sequence[index + 1:]
return sequence
def multi_point_mutation(old_sequence: str, min_length:int, max_length: int, action: Action=Action.REPLACE,
max_size: int=5) -> str:
def gen_sequence(gen_size: int, old_seq: str= None) -> str:
res = ''
# if we replace, select an index to be different for sure
rand_loc = None
if old_seq is not None:
rand_loc = random.randint(0, len(old_seq) - 1)
# generate new subseq
for i in range(0, gen_size):
selection = IUPAC.IUPAC_RNA_BASE
if i == rand_loc:
selection = selection.replace(old_seq[rand_loc], '')
res += random.choice(selection)
return res
index = random.randint(0, len(old_sequence) - 1)
dist = []
for i in range(1, max_size):
dist += [i] * (max_size - i + 1)
if action == Action.REPLACE:
size = min(random.choice(dist), len(old_sequence) - index)
new_part = gen_sequence(size, old_sequence[index : index + size])
sequence = old_sequence[:index] + new_part + old_sequence[index + size:]
elif action == Action.ADD:
size = min(random.choice(dist), max_length - len(old_sequence))
new_part = gen_sequence(size)
sequence = old_sequence[:index] + new_part + old_sequence[index:]
elif action == Action.REMOVE:
size = min(random.choice(dist), len(old_sequence) - index, max(1, len(old_sequence) - min_length))
sequence = old_sequence[:index] + old_sequence[index + size:]
return sequence
| [
1,
529,
9507,
29958,
29878,
1056,
29888,
2109,
29894,
29914,
6149,
1061,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
12008,
13,
5893,
6139,
13,
12008,
13,
13,
5215,
4036,
13,
3166,
364,
1056,
29888,
2109,
29894,
1053,
306,
4897,
2477,
29892,
5447,
29918,
2520,
261,
13,
3166,
19229,
1053,
360,
919,
29892,
3139,
13,
5215,
14115,
13,
13,
12008,
13,
29896,
29897,
1831,
3184,
361,
29973,
847,
1831,
2380,
1599,
12439,
3184,
361,
29973,
313,
14369,
847,
3765,
373,
20805,
29897,
13,
29906,
29897,
12439,
5665,
1040,
336,
1144,
313,
847,
4567,
11938,
29897,
13,
29941,
29897,
1831,
4036,
1950,
5478,
362,
313,
1202,
654,
29892,
28744,
470,
21733,
29897,
13,
12008,
13,
13,
13,
1990,
9123,
29898,
18605,
29889,
16854,
1125,
13,
1678,
5195,
7390,
11538,
353,
29871,
29896,
13,
1678,
27827,
353,
29871,
29906,
13,
1678,
5195,
6720,
12064,
353,
29871,
29941,
13,
13,
13,
1753,
22786,
403,
29898,
3784,
29918,
16506,
29901,
851,
29892,
1993,
29918,
8336,
29901,
5447,
29918,
2520,
261,
29889,
9643,
29892,
3987,
29901,
360,
919,
29961,
710,
29892,
3139,
2314,
1599,
851,
29901,
13,
1678,
1375,
29918,
2848,
353,
7431,
29898,
6768,
29889,
657,
877,
5182,
29918,
23905,
8785,
448,
3987,
29889,
657,
877,
29894,
2848,
1495,
13,
1678,
4236,
29918,
2848,
353,
7431,
29898,
6768,
29889,
657,
877,
5182,
29918,
23905,
8785,
718,
3987,
29889,
657,
877,
29894,
2848,
1495,
13,
1678,
8820,
353,
518,
4276,
29889,
1525,
7390,
11538,
29962,
13,
1678,
565,
7431,
29898,
3784,
29918,
16506,
29897,
529,
4236,
29918,
2848,
29901,
13,
4706,
8820,
29889,
4397,
29898,
4276,
29889,
17744,
29897,
13,
1678,
565,
7431,
29898,
3784,
29918,
16506,
29897,
1405,
1375,
29918,
2848,
29901,
13,
4706,
8820,
29889,
4397,
29898,
4276,
29889,
1525,
6720,
12064,
29897,
13,
1678,
396,
5478,
630,
29918,
16506,
353,
2560,
29918,
3149,
29918,
6149,
362,
29898,
3784,
29918,
16506,
29892,
4036,
29889,
16957,
29898,
7387,
876,
13,
1678,
5478,
630,
29918,
16506,
353,
2473,
29918,
3149,
29918,
6149,
362,
29898,
3784,
29918,
16506,
29892,
1375,
29918,
2848,
29892,
4236,
29918,
2848,
29892,
4036,
29889,
16957,
29898,
7387,
876,
13,
1678,
736,
5478,
630,
29918,
16506,
13,
13,
13,
1753,
2560,
29918,
3149,
29918,
6149,
362,
29898,
1025,
29918,
16506,
29901,
851,
29892,
3158,
29901,
9123,
29922,
4276,
29889,
1525,
7390,
11538,
29897,
1599,
851,
29901,
13,
1678,
2380,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1025,
29918,
16506,
29897,
448,
29871,
29896,
29897,
13,
1678,
565,
3158,
1275,
9123,
29889,
1525,
7390,
11538,
29901,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
4036,
29889,
16957,
29898,
29902,
4897,
2477,
29889,
29902,
4897,
2477,
29918,
29934,
3521,
29918,
25416,
29889,
6506,
29898,
1025,
29918,
16506,
29961,
2248,
1402,
6629,
876,
718,
320,
13,
462,
259,
2030,
29918,
16506,
29961,
2248,
718,
29871,
29896,
17531,
13,
1678,
25342,
3158,
1275,
9123,
29889,
17744,
29901,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
4036,
29889,
16957,
29898,
29902,
4897,
2477,
29889,
29902,
4897,
2477,
29918,
29934,
3521,
29918,
25416,
29889,
6506,
29898,
1025,
29918,
16506,
29961,
2248,
1402,
6629,
876,
718,
320,
13,
462,
259,
2030,
29918,
16506,
29961,
2248,
17531,
13,
1678,
25342,
3158,
1275,
9123,
29889,
1525,
6720,
12064,
29901,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
2030,
29918,
16506,
29961,
2248,
718,
29871,
29896,
17531,
13,
1678,
736,
5665,
13,
13,
13,
1753,
2473,
29918,
3149,
29918,
6149,
362,
29898,
1025,
29918,
16506,
29901,
851,
29892,
1375,
29918,
2848,
29901,
524,
29892,
4236,
29918,
2848,
29901,
938,
29892,
3158,
29901,
9123,
29922,
4276,
29889,
1525,
7390,
11538,
29892,
13,
462,
308,
4236,
29918,
2311,
29901,
938,
29922,
29945,
29897,
1599,
851,
29901,
13,
1678,
822,
2531,
29918,
16506,
29898,
1885,
29918,
2311,
29901,
938,
29892,
2030,
29918,
11762,
29901,
851,
29922,
6213,
29897,
1599,
851,
29901,
13,
4706,
620,
353,
6629,
13,
4706,
396,
565,
591,
5191,
29892,
1831,
385,
2380,
304,
367,
1422,
363,
1854,
13,
4706,
20088,
29918,
2029,
353,
6213,
13,
4706,
565,
2030,
29918,
11762,
338,
451,
6213,
29901,
13,
9651,
20088,
29918,
2029,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1025,
29918,
11762,
29897,
448,
29871,
29896,
29897,
13,
4706,
396,
5706,
716,
1014,
11762,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
2531,
29918,
2311,
1125,
13,
9651,
9262,
353,
306,
4897,
2477,
29889,
29902,
4897,
2477,
29918,
29934,
3521,
29918,
25416,
13,
9651,
565,
474,
1275,
20088,
29918,
2029,
29901,
13,
18884,
9262,
353,
9262,
29889,
6506,
29898,
1025,
29918,
11762,
29961,
9502,
29918,
2029,
1402,
27255,
13,
9651,
620,
4619,
4036,
29889,
16957,
29898,
21731,
29897,
13,
4706,
736,
620,
13,
1678,
2380,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1025,
29918,
16506,
29897,
448,
29871,
29896,
29897,
13,
1678,
1320,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
4236,
29918,
2311,
1125,
13,
4706,
1320,
4619,
518,
29875,
29962,
334,
313,
3317,
29918,
2311,
448,
474,
718,
29871,
29896,
29897,
13,
1678,
565,
3158,
1275,
9123,
29889,
1525,
7390,
11538,
29901,
13,
4706,
2159,
353,
1375,
29898,
8172,
29889,
16957,
29898,
5721,
511,
7431,
29898,
1025,
29918,
16506,
29897,
448,
2380,
29897,
13,
4706,
716,
29918,
1595,
353,
2531,
29918,
16506,
29898,
2311,
29892,
2030,
29918,
16506,
29961,
2248,
584,
2380,
718,
2159,
2314,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
716,
29918,
1595,
718,
2030,
29918,
16506,
29961,
2248,
718,
2159,
17531,
13,
1678,
25342,
3158,
1275,
9123,
29889,
17744,
29901,
13,
4706,
2159,
353,
1375,
29898,
8172,
29889,
16957,
29898,
5721,
511,
4236,
29918,
2848,
448,
7431,
29898,
1025,
29918,
16506,
876,
13,
4706,
716,
29918,
1595,
353,
2531,
29918,
16506,
29898,
2311,
29897,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
716,
29918,
1595,
718,
2030,
29918,
16506,
29961,
2248,
17531,
13,
1678,
25342,
3158,
1275,
9123,
29889,
1525,
6720,
12064,
29901,
13,
4706,
2159,
353,
1375,
29898,
8172,
29889,
16957,
29898,
5721,
511,
7431,
29898,
1025,
29918,
16506,
29897,
448,
2380,
29892,
4236,
29898,
29896,
29892,
7431,
29898,
1025,
29918,
16506,
29897,
448,
1375,
29918,
2848,
876,
13,
4706,
5665,
353,
2030,
29918,
16506,
7503,
2248,
29962,
718,
2030,
29918,
16506,
29961,
2248,
718,
2159,
17531,
13,
1678,
736,
5665,
13,
2
] |
skp_edu_docker/code/cluster/preprocess/pre_node_feed_text2fasttext.py | TensorMSA/hoyai_docker | 8 | 104401 | from cluster.preprocess.pre_node_feed import PreNodeFeed
import os,h5py
import numpy as np
class PreNodeFeedText2FastText(PreNodeFeed):
"""
"""
def run(self, conf_data):
"""
override init class
"""
super(PreNodeFeedText2FastText, self).run(conf_data)
self._init_node_parm(conf_data['node_id'])
def _convert_data_format(self, file_path, index):
"""
just pass hdf5 file chunk
:param file_path:
:param index:
:return:
"""
try:
h5file = h5py.File(file_path, mode='r')
raw_data = h5file['rawdata']
data_set = raw_data[index.start: index.stop]
filtered_data = [data_set[np.logical_not(data_set == '#')].tolist()]
return filtered_data
except Exception as e:
raise Exception(e)
finally:
h5file.close()
def data_size(self):
try:
h5file = h5py.File(self.input_paths[self.pointer], mode='r')
return h5file['rawdata'].len()
except Exception as e:
raise Exception(e)
finally:
h5file.close() | [
1,
515,
9867,
29889,
1457,
5014,
29889,
1457,
29918,
3177,
29918,
18798,
1053,
4721,
4247,
29737,
13,
5215,
2897,
29892,
29882,
29945,
2272,
13,
5215,
12655,
408,
7442,
13,
13,
1990,
4721,
4247,
29737,
1626,
29906,
29943,
579,
1626,
29898,
6572,
4247,
29737,
1125,
13,
1678,
9995,
13,
13,
1678,
9995,
13,
1678,
822,
1065,
29898,
1311,
29892,
1970,
29918,
1272,
1125,
13,
4706,
9995,
13,
4706,
5712,
2069,
770,
13,
4706,
9995,
13,
4706,
2428,
29898,
6572,
4247,
29737,
1626,
29906,
29943,
579,
1626,
29892,
1583,
467,
3389,
29898,
5527,
29918,
1272,
29897,
13,
4706,
1583,
3032,
2344,
29918,
3177,
29918,
862,
29885,
29898,
5527,
29918,
1272,
1839,
3177,
29918,
333,
11287,
13,
13,
13,
1678,
822,
903,
13441,
29918,
1272,
29918,
4830,
29898,
1311,
29892,
934,
29918,
2084,
29892,
2380,
1125,
13,
4706,
9995,
13,
4706,
925,
1209,
298,
2176,
29945,
934,
19875,
13,
4706,
584,
3207,
934,
29918,
2084,
29901,
13,
4706,
584,
3207,
2380,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
1018,
29901,
13,
9651,
298,
29945,
1445,
353,
298,
29945,
2272,
29889,
2283,
29898,
1445,
29918,
2084,
29892,
4464,
2433,
29878,
1495,
13,
9651,
10650,
29918,
1272,
353,
298,
29945,
1445,
1839,
1610,
1272,
2033,
13,
9651,
848,
29918,
842,
353,
10650,
29918,
1272,
29961,
2248,
29889,
2962,
29901,
2380,
29889,
9847,
29962,
13,
9651,
22289,
29918,
1272,
353,
518,
1272,
29918,
842,
29961,
9302,
29889,
1188,
936,
29918,
1333,
29898,
1272,
29918,
842,
1275,
16321,
1495,
1822,
25027,
391,
580,
29962,
13,
9651,
736,
22289,
29918,
1272,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
12020,
8960,
29898,
29872,
29897,
13,
4706,
7146,
29901,
13,
9651,
298,
29945,
1445,
29889,
5358,
580,
13,
13,
1678,
822,
848,
29918,
2311,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
298,
29945,
1445,
353,
298,
29945,
2272,
29889,
2283,
29898,
1311,
29889,
2080,
29918,
24772,
29961,
1311,
29889,
17226,
1402,
4464,
2433,
29878,
1495,
13,
9651,
736,
298,
29945,
1445,
1839,
1610,
1272,
13359,
2435,
580,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
12020,
8960,
29898,
29872,
29897,
13,
4706,
7146,
29901,
13,
9651,
298,
29945,
1445,
29889,
5358,
580,
2
] |
source/NVDAObjects/IAccessible/adobeFlash.py | SWEN-712/screen-reader-brandonp728 | 0 | 63706 | <reponame>SWEN-712/screen-reader-brandonp728
#NVDAObjects/IAccessible/adobeFlash.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2009 NVDA Contributors <http://www.nvda-project.org/>
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import winUser
import oleacc
from . import IAccessible, getNVDAObjectFromEvent
from NVDAObjects import NVDAObjectTextInfo
from NVDAObjects.behaviors import EditableTextWithoutAutoSelectDetection
from comtypes import COMError, IServiceProvider, hresult
from comtypes.gen.FlashAccessibility import ISimpleTextSelection, IFlashAccessibility
from logHandler import log
class InputTextFieldTextInfo(NVDAObjectTextInfo):
def _getStoryText(self):
return self.obj.value or ""
def _getRawSelectionOffsets(self):
try:
return self.obj.ISimpleTextSelectionObject.GetSelection()
except COMError as e:
if e.hresult == hresult.E_FAIL:
# The documentation says that an empty field should return 0 for both values, but instead, we seem to get E_FAIL.
# An empty field still has a valid caret.
return 0, 0
else:
raise RuntimeError
except AttributeError:
raise RuntimeError
def _getCaretOffset(self):
# We want the active (moving) end of the selection.
return self._getRawSelectionOffsets()[1]
def _getSelectionOffsets(self):
# This might be a backwards selection, but for now, we should always return the values in ascending order.
return sorted(self._getRawSelectionOffsets())
class InputTextField(EditableTextWithoutAutoSelectDetection, IAccessible):
TextInfo = InputTextFieldTextInfo
class Root(IAccessible):
def _get_presentationType(self):
return self.presType_content
def _get_treeInterceptorClass(self):
import virtualBuffers.adobeFlash
return virtualBuffers.adobeFlash.AdobeFlash
#Flash root client has broken accParent, force to return the flash root window root IAccessible
def _get_parent(self):
return getNVDAObjectFromEvent(self.windowHandle,0,0)
class PluginClientWithBrokenFocus(IAccessible):
"""The client of a Flash plugin with broken focus behaviour.
#2546: In Flash protected mode, the Flash content is in another window beneath the plugin window.
Unfortunately, Flash doesn't bother to set focus to this window.
To work around this, when focus hits this object, focus is forced to the child.
"""
def event_gainFocus(self):
try:
self.firstChild.firstChild.setFocus()
except AttributeError:
super(PluginClientWithBrokenFocus, self).event_gainFocus()
def findExtraOverlayClasses(obj, clsList):
"""Determine the most appropriate class if this is a Flash object.
This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.
"""
iaRole = obj.IAccessibleRole
if obj.windowClassName == "GeckoPluginWindow" and iaRole == oleacc.ROLE_SYSTEM_CLIENT and obj.childCount == 1 and obj.firstChild.windowClassName == "GeckoFPSandboxChildWindow":
clsList.append(PluginClientWithBrokenFocus)
return
try:
servProv = obj.IAccessibleObject.QueryInterface(IServiceProvider)
except COMError:
return
# Check whether this is the Flash root accessible.
if iaRole == oleacc.ROLE_SYSTEM_CLIENT:
try:
servProv.QueryService(IFlashAccessibility._iid_, IFlashAccessibility)
clsList.append(Root)
except COMError:
pass
# If this is a client and IFlashAccessibility wasn't present, this is not a Flash object.
return
# Check whether this is a Flash input text field.
try:
# We have to fetch ISimpleTextSelectionObject in order to check whether this is an input text field, so store it on the instance.
obj.ISimpleTextSelectionObject = servProv.QueryService(ISimpleTextSelection._iid_, ISimpleTextSelection)
clsList.append(InputTextField)
except COMError:
pass
| [
1,
529,
276,
1112,
420,
29958,
23066,
1430,
29899,
29955,
29896,
29906,
29914,
10525,
29899,
16950,
29899,
1182,
9214,
29886,
29955,
29906,
29947,
13,
29937,
29940,
29963,
7698,
12724,
29914,
29902,
6638,
1821,
29914,
328,
16945,
8754,
1161,
29889,
2272,
13,
29937,
29909,
760,
310,
10050,
16227,
2726,
6883,
11028,
313,
29940,
29963,
7698,
29897,
13,
29937,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29900,
29929,
405,
29963,
7698,
2866,
1091,
29560,
529,
1124,
597,
1636,
29889,
29876,
29894,
1388,
29899,
4836,
29889,
990,
3779,
13,
29937,
4013,
934,
338,
10664,
491,
278,
15143,
4593,
5236,
19245,
29889,
13,
29937,
13393,
278,
934,
315,
4590,
29979,
4214,
363,
901,
4902,
29889,
13,
13,
5215,
5401,
2659,
13,
5215,
288,
280,
5753,
13,
3166,
869,
1053,
306,
6638,
1821,
29892,
679,
29940,
29963,
7698,
2061,
4591,
2624,
13,
3166,
405,
29963,
7698,
12724,
1053,
405,
29963,
7698,
2061,
1626,
3401,
13,
3166,
405,
29963,
7698,
12724,
29889,
915,
8708,
18930,
1053,
7641,
519,
1626,
3047,
449,
12300,
3549,
29928,
2650,
428,
13,
3166,
419,
8768,
1053,
23353,
2392,
29892,
306,
3170,
6980,
29892,
298,
2914,
13,
3166,
419,
8768,
29889,
1885,
29889,
8754,
1161,
6638,
4127,
1053,
8519,
326,
552,
1626,
15097,
29892,
306,
8754,
1161,
6638,
4127,
13,
3166,
1480,
4598,
1053,
1480,
13,
13,
1990,
10567,
15778,
1626,
3401,
29898,
29940,
29963,
7698,
2061,
1626,
3401,
1125,
13,
13,
12,
1753,
903,
657,
29359,
1626,
29898,
1311,
1125,
13,
12,
12,
2457,
1583,
29889,
5415,
29889,
1767,
470,
5124,
13,
13,
12,
1753,
903,
657,
22131,
15097,
6880,
7224,
29898,
1311,
1125,
13,
12,
12,
2202,
29901,
13,
12,
12,
12,
2457,
1583,
29889,
5415,
29889,
3235,
326,
552,
1626,
15097,
2061,
29889,
2577,
15097,
580,
13,
12,
12,
19499,
23353,
2392,
408,
321,
29901,
13,
12,
12,
12,
361,
321,
29889,
29882,
2914,
1275,
298,
2914,
29889,
29923,
29918,
4519,
6227,
29901,
13,
12,
12,
12,
12,
29937,
450,
5106,
4083,
393,
385,
4069,
1746,
881,
736,
29871,
29900,
363,
1716,
1819,
29892,
541,
2012,
29892,
591,
2833,
304,
679,
382,
29918,
4519,
6227,
29889,
13,
12,
12,
12,
12,
29937,
530,
4069,
1746,
1603,
756,
263,
2854,
2562,
29873,
29889,
13,
12,
12,
12,
12,
2457,
29871,
29900,
29892,
29871,
29900,
13,
12,
12,
12,
2870,
29901,
13,
12,
12,
12,
12,
22692,
24875,
2392,
13,
12,
12,
19499,
23833,
2392,
29901,
13,
12,
12,
12,
22692,
24875,
2392,
13,
13,
12,
1753,
903,
657,
29907,
10474,
10302,
29898,
1311,
1125,
13,
12,
12,
29937,
1334,
864,
278,
6136,
313,
13529,
292,
29897,
1095,
310,
278,
9262,
29889,
13,
12,
12,
2457,
1583,
3032,
657,
22131,
15097,
6880,
7224,
580,
29961,
29896,
29962,
13,
13,
12,
1753,
903,
657,
15097,
6880,
7224,
29898,
1311,
1125,
13,
12,
12,
29937,
910,
1795,
367,
263,
28953,
9262,
29892,
541,
363,
1286,
29892,
591,
881,
2337,
736,
278,
1819,
297,
12066,
2548,
1797,
29889,
13,
12,
12,
2457,
12705,
29898,
1311,
3032,
657,
22131,
15097,
6880,
7224,
3101,
13,
13,
1990,
10567,
15778,
29898,
6103,
519,
1626,
3047,
449,
12300,
3549,
29928,
2650,
428,
29892,
306,
6638,
1821,
1125,
13,
12,
1626,
3401,
353,
10567,
15778,
1626,
3401,
13,
13,
1990,
28272,
29898,
29902,
6638,
1821,
1125,
13,
13,
12,
1753,
903,
657,
29918,
26081,
1542,
29898,
1311,
1125,
13,
12,
12,
2457,
1583,
29889,
4569,
1542,
29918,
3051,
13,
13,
12,
1753,
903,
657,
29918,
8336,
24923,
2385,
29898,
1311,
1125,
13,
12,
12,
5215,
6901,
29933,
3096,
414,
29889,
328,
16945,
8754,
1161,
13,
12,
12,
2457,
6901,
29933,
3096,
414,
29889,
328,
16945,
8754,
1161,
29889,
3253,
16945,
8754,
1161,
13,
13,
12,
29937,
8754,
1161,
3876,
3132,
756,
9391,
1035,
9780,
29892,
4889,
304,
736,
278,
11013,
3876,
3474,
3876,
306,
6638,
1821,
13,
12,
1753,
903,
657,
29918,
3560,
29898,
1311,
1125,
13,
12,
12,
2457,
679,
29940,
29963,
7698,
2061,
4591,
2624,
29898,
1311,
29889,
7165,
13554,
29892,
29900,
29892,
29900,
29897,
13,
13,
1990,
1858,
3851,
4032,
3047,
29857,
1717,
20560,
29898,
29902,
6638,
1821,
1125,
13,
12,
15945,
29908,
1576,
3132,
310,
263,
21967,
7079,
411,
9391,
8569,
10468,
29889,
13,
12,
29937,
29906,
29945,
29946,
29953,
29901,
512,
21967,
6364,
4464,
29892,
278,
21967,
2793,
338,
297,
1790,
3474,
19540,
278,
7079,
3474,
29889,
13,
12,
2525,
7524,
29892,
21967,
1838,
29915,
29873,
24738,
304,
731,
8569,
304,
445,
3474,
29889,
13,
12,
1762,
664,
2820,
445,
29892,
746,
8569,
19572,
445,
1203,
29892,
8569,
338,
11826,
304,
278,
2278,
29889,
13,
12,
15945,
29908,
13,
13,
12,
1753,
1741,
29918,
29887,
475,
20560,
29898,
1311,
1125,
13,
12,
12,
2202,
29901,
13,
12,
12,
12,
1311,
29889,
4102,
5938,
29889,
4102,
5938,
29889,
842,
20560,
580,
13,
12,
12,
19499,
23833,
2392,
29901,
13,
12,
12,
12,
9136,
29898,
16288,
4032,
3047,
29857,
1717,
20560,
29892,
1583,
467,
3696,
29918,
29887,
475,
20560,
580,
13,
13,
1753,
1284,
18126,
3563,
8387,
27403,
29898,
5415,
29892,
1067,
29879,
1293,
1125,
13,
12,
15945,
29908,
6362,
837,
457,
278,
1556,
8210,
770,
565,
445,
338,
263,
21967,
1203,
29889,
13,
12,
4013,
1736,
22829,
304,
365,
29912,
29940,
29963,
7698,
12724,
29889,
29940,
29963,
7698,
2061,
29889,
2886,
3563,
8387,
27403,
29913,
5174,
393,
372,
2360,
5717,
738,
916,
1284,
3563,
8387,
27403,
1158,
29889,
13,
12,
15945,
29908,
13,
12,
423,
16727,
353,
5446,
29889,
29902,
6638,
1821,
16727,
13,
12,
361,
5446,
29889,
7165,
23607,
1275,
376,
7999,
27604,
16288,
5907,
29908,
322,
29871,
423,
16727,
1275,
288,
280,
5753,
29889,
1672,
1307,
29918,
14816,
1254,
12665,
29918,
27205,
3919,
322,
5446,
29889,
5145,
3981,
1275,
29871,
29896,
322,
5446,
29889,
4102,
5938,
29889,
7165,
23607,
1275,
376,
7999,
27604,
29943,
7024,
26738,
5938,
5907,
1115,
13,
12,
12,
25932,
1293,
29889,
4397,
29898,
16288,
4032,
3047,
29857,
1717,
20560,
29897,
13,
12,
12,
2457,
13,
13,
12,
2202,
29901,
13,
12,
12,
2140,
1184,
29894,
353,
5446,
29889,
29902,
6638,
1821,
2061,
29889,
3010,
10448,
29898,
29902,
3170,
6980,
29897,
13,
12,
19499,
23353,
2392,
29901,
13,
12,
12,
2457,
13,
13,
12,
29937,
5399,
3692,
445,
338,
278,
21967,
3876,
15579,
29889,
13,
12,
361,
29871,
423,
16727,
1275,
288,
280,
5753,
29889,
1672,
1307,
29918,
14816,
1254,
12665,
29918,
27205,
3919,
29901,
13,
12,
12,
2202,
29901,
13,
12,
12,
12,
2140,
1184,
29894,
29889,
3010,
3170,
29898,
6545,
29880,
1161,
6638,
4127,
3032,
29875,
333,
3383,
306,
8754,
1161,
6638,
4127,
29897,
13,
12,
12,
12,
25932,
1293,
29889,
4397,
29898,
10303,
29897,
13,
12,
12,
19499,
23353,
2392,
29901,
13,
12,
12,
12,
3364,
13,
12,
12,
29937,
960,
445,
338,
263,
3132,
322,
306,
8754,
1161,
6638,
4127,
9007,
29915,
29873,
2198,
29892,
445,
338,
451,
263,
21967,
1203,
29889,
13,
12,
12,
2457,
13,
13,
12,
29937,
5399,
3692,
445,
338,
263,
21967,
1881,
1426,
1746,
29889,
13,
12,
2202,
29901,
13,
12,
12,
29937,
1334,
505,
304,
6699,
8519,
326,
552,
1626,
15097,
2061,
297,
1797,
304,
1423,
3692,
445,
338,
385,
1881,
1426,
1746,
29892,
577,
3787,
372,
373,
278,
2777,
29889,
13,
12,
12,
5415,
29889,
3235,
326,
552,
1626,
15097,
2061,
353,
3348,
1184,
29894,
29889,
3010,
3170,
29898,
3235,
326,
552,
1626,
15097,
3032,
29875,
333,
3383,
8519,
326,
552,
1626,
15097,
29897,
13,
12,
12,
25932,
1293,
29889,
4397,
29898,
4290,
15778,
29897,
13,
12,
19499,
23353,
2392,
29901,
13,
12,
12,
3364,
13,
2
] |
utils.py | nhh1501/E2E_MLT_VN | 0 | 59579 | #!/usr/bin/python
# encoding: utf-8
import torch
import albumentations as A
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import Dataset
import collections
from PIL import Image, ImageFilter
import matplotlib.pyplot as plt
import math
import random
import numpy as np
import cv2
import os
import PIL
from data_gen import generate_rbox, generate_rbox2
from data_gen import load_gt_annoataion
from data_gen import get_images
import torchvision.transforms as transforms
import tensorflow as tf
from data_gen import draw_box_points
class ImgAugTransform:
def __init__(self):
self.aug = A.Compose([
A.OneOf([
A.Blur(blur_limit=10,p=0.5),
A.MedianBlur(blur_limit=5,p=0.5),
]),
A.OneOf([
A.CoarseDropout(max_holes=7, min_holes=3, min_height=3, min_width=1, max_height=16, max_width=4,
fill_value=255,
p=0.5),
A.CoarseDropout(max_holes=7, min_holes=3, min_height=3, min_width=1, max_height=16, max_width=4,
fill_value=170,
p=0.5),
A.CoarseDropout(max_holes=7, min_holes=3, min_height=3, min_width=1, max_height=16, max_width=4,
fill_value=85,
p=0.5),
A.CoarseDropout(max_holes=7, min_holes=3, min_height=3, min_width=1, max_height=16, max_width=4,
fill_value=0,
p=0.5),
]),
# A.RandomContrast(limit=0.05, p=0.75),
# A.RandomBrightness(limit=0.05, p=0.75),
# A.RandomBrightnessContrast(contrast_limit=0.05, brightness_limit=0.05, p=0.75),
])
def __call__(self, img):
img = np.array(img)
transformed_img = self.aug(image=img)['image']
return Image.fromarray(transformed_img)
# return transformed_img
def to_array(img):
img = np.asarray(img, dtype=np.float32)
img /= 128
img -= 1
return img
# return img
def random_dilate(img):
img = np.array(img)
img = cv2.dilate(img, np.ones(shape=(random.randint(1, 3), random.randint(1, 3)), dtype=np.uint8))
return Image.fromarray(img)
# return img
def random_erode(img):
img = np.array(img)
img = cv2.erode(img, np.ones(shape=(random.randint(1, 3), random.randint(1, 3)), dtype=np.uint8))
return Image.fromarray(img)
# return img
def train_transforms(is_crnn = True):
if is_crnn:
transform = transforms.Compose([
transforms.RandomApply(
[
random_dilate,
],
p=0.15),
transforms.RandomApply(
[
random_erode,
],
p=0.15),
transforms.RandomAffine(degrees=3, scale=(0.95, 1.05), shear=3, resample=Image.NEAREST, fillcolor=(255,255,255)),
# transforms.RandomApply(
# [
# to_array,
# ],
# p=1),
transforms.RandomApply(
[
ImgAugTransform(),
],
p=0.6),
transforms.Grayscale(),
transforms.ToTensor()
])
else:
transform = transforms.Compose([
transforms.RandomApply(
[
random_dilate,
],
p=0.15),
transforms.RandomApply(
[
random_erode,
],
p=0.15),
transforms.RandomAffine(degrees=3, scale=(0.95, 1.05), shear=3, resample=Image.NEAREST,
fillcolor=(255, 255, 255)),
# transforms.RandomApply(
# [
# to_array,
# ],
# p=1),
transforms.RandomApply(
[
ImgAugTransform(),
],
p=0.6),
transforms.ToTensor()
])
return transform
def test_transforms(is_crnn = True):
if is_crnn:
transform = transforms.Compose([
transforms.Grayscale(),
transforms.ToTensor()
])
else:
transform = transforms.Compose([
transforms.ToTensor()
])
return transform
def cut_image(img, new_size, word_gto):
if len(word_gto) > 0:
rep = True
cnt = 0
while rep:
if cnt > 30:
return img
text_poly = word_gto[random.randint(0, len(word_gto) - 1)]
center = text_poly.sum(0) / 4
xs = int(center[0] - random.uniform(-100, 100) - new_size[1] / 2)
xs = max(xs, 1)
ys = int(center[1] - random.uniform(-100, 100) - new_size[0] / 2)
ys = max(ys, 1)
crop_rect = (xs, ys, xs + new_size[1], ys + new_size[0])
crop_img = img[crop_rect[1]:crop_rect[3], crop_rect[0]:crop_rect[2]]
# cv2.imshow('dasd',crop_img)
if crop_img.shape[0] == crop_img.shape[1]:
rep = False
else:
cnt += 1
else:
xs = int(random.uniform(0, img.shape[1]))
ys = int(random.uniform(0, img.shape[0]))
crop_rect = (xs, ys, xs + new_size[1], ys + new_size[0])
crop_img = img[crop_rect[1]:crop_rect[3], crop_rect[0]:crop_rect[2]]
if len(word_gto) > 0:
word_gto[:, :, 0] -= xs
word_gto[:, :, 1] -= ys
return crop_img
class ocrDataset(Dataset):
def __init__(self, root, norm_height = 48,in_train = True, target_transform=None,is_crnn = True):
self.norm_height = norm_height
self.path = self.get_path(root)
self.root = root
self.train_transform = train_transforms(is_crnn)
self.test_transform = test_transforms(is_crnn)
self.in_train = in_train
self.target_transform = target_transform
def get_path(self,data_path):
base_dir = os.path.dirname(data_path)
files_out = []
cnt = 0
with open(data_path) as f:
while True:
line = f.readline()
if not line:
break
line = line.strip()
if len(line) == 0:
continue
if not line[0] == '/':
line = '{0}/{1}'.format(base_dir, line)
files_out.append(line)
cnt += 1
# if cnt > 100:
# break
return files_out
def get_data(self,image_name):
src_del = " "
spl = image_name.split(" ")
if len(spl) == 1:
spl = image_name.split(",")
src_del = ","
image_name = spl[0].strip()
# image_name = (spl[0] + ' '+ spl[1]).strip()
gt_txt = ''
if len(spl) > 1:
gt_txt = ""
delim = ""
for k in range(1, len(spl)):
gt_txt += delim + spl[k]
delim = src_del
if len(gt_txt) > 1 and gt_txt[0] == '"' and gt_txt[-1] == '"':
gt_txt = gt_txt[1:-1]
if image_name[len(image_name) - 1] == ',':
image_name = image_name[0:-1]
im = cv2.imread(image_name)
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
# im = im[2:im.shape[0]-2,:,:]
# im_zero = np.zeros((self.norm_height,im.shape[1],3), np.uint8)
if self.norm_height > im.shape[0]:
im_samp = np.ones((self.norm_height,im.shape[1],3), np.uint8)*255
rand = np.random.randint(0,self.norm_height - im.shape[0])
im_samp[rand:rand + im.shape[0],:,:] = im
else:
scale = self.norm_height / float(im.shape[0])
width = int(im.shape[1] * scale)
im_samp = cv2.resize(im, (int(width), self.norm_height))
image = PIL.Image.fromarray(np.uint8(im_samp))
# image = np.asarray(im, dtype=np.float32)
# image /= 128
# image -= 1
#get labels
# gt_labels = []
# for k in range(len(gt_txt)):
# if gt_txt[k] in self.codec_rev:
# gt_labels.append(self.codec_rev[gt_txt[k]])
# else:
# gt_labels.append(3)
#
# return image,gt_labels
return image,gt_txt
def __len__(self):
return len(self.path)
def __getitem__(self, index):
try:
image,label = self.get_data(self.path[index])
except IOError:
print('Corrupted image for %d' % index)
return self[index + 1]
if self.in_train :
image = self.train_transform(image)
else:
image = self.test_transform(image)
# image = np.array(image)
if self.target_transform is not None:
label = self.target_transform(label)
return (image, label)
class alignCollate(object):
def __init__(self):
pass
def __call__(self, batch):
images, labels = zip(*batch)
c = images[0].size(0)
h = max([p.size(1) for p in images])
w = max([p.size(2) for p in images])
batch_images = torch.zeros(len(images), c, h, w).fill_(1)
for i, image in enumerate(images):
started_h = max(0, random.randint(0, h - image.size(1)))
started_w = max(0, random.randint(0, w - image.size(2)))
batch_images[i, :, started_h:started_h + image.size(1), started_w:started_w + image.size(2)] = image
return batch_images, labels
# Transform
class E2Edataset(Dataset):
def __init__(self, train_list, input_size=512, normalize = True):
super(E2Edataset, self).__init__()
self.image_list = np.array(get_images(train_list))
self.input_size = input_size
self.normalize = normalize
print('{} training images in {}'.format(self.image_list.shape[0], train_list))
self.transform = transforms.Compose([
transforms.ColorJitter(.3,.3,.3,.3),
transforms.RandomGrayscale(p=0.1) ])
def __len__(self):
return len(self.image_list)
def __getitem__(self, index):
im_name = self.image_list[index]
im = cv2.imread(im_name) # 图片
# cv2.imshow('sad',im)
txt_fn = im_name.replace(os.path.basename(im_name).split('.')[1], 'txt')
base_name = os.path.basename(txt_fn)
txt_fn_gt = '{0}/gt_{1}'.format(os.path.dirname(im_name), base_name)
text_polys, text_tags, labels_txt = load_gt_annoataion(txt_fn_gt, True)
# 载入标注信息
resize_w = self.input_size
resize_h = self.input_size
scaled = cut_image(im, (self.input_size, self.input_size), text_polys)
if scaled.shape[0] == 0 or scaled.shape[1] == 0:
scaled = im
if scaled.shape[1] != resize_w or scaled.shape[0] != resize_h:
ratio_img= min(scaled.shape[1]/scaled.shape[0],scaled.shape[0]/scaled.shape[1])
if scaled.shape[0] > scaled.shape[1]:
resize_w =resize_w * ratio_img
scalex = scaled.shape[1] / resize_w
scaley = scaled.shape[0] / resize_h
scaled = cv2.resize(scaled, dsize=(int(resize_w), int(resize_h)))
else :
resize_h = resize_h * ratio_img
scalex = scaled.shape[1] / resize_w
scaley = scaled.shape[0] / resize_h
scaled = cv2.resize(scaled, dsize=(int(resize_w), int(resize_h)))
# continue
if len(text_polys) > 0:
text_polys[:, :, 0] /= scalex
text_polys[:, :, 1] /= scaley
scaled = cv2.copyMakeBorder(scaled, 0, self.input_size - scaled.shape[0], 0, self.input_size - scaled.shape[1], cv2.BORDER_CONSTANT,value=[255,255,255])
# scaled_show = scaled.copy()
# for (i, c) in enumerate(text_polys):
# draw_box_points(scaled_show, c, color=(0, 255, 0), thickness=1)
# # instead of creating a new image, I simply modify the old one
#
#
# # show the modified image with all the rectangles at the end.
# cv2.imshow('img', scaled_show)
pim = PIL.Image.fromarray(np.uint8(scaled))
if self.transform:
pim = self.transform(pim)
im = np.array(pim)
new_h, new_w, _ = im.shape
score_map, geo_map, training_mask, gt_idx, gt_out, labels_out = generate_rbox(im, (new_h, new_w), text_polys, text_tags, labels_txt, vis=False)
im = np.asarray(im)
##
if self.normalize:
im = im.astype(np.float32)
im /= 128
im -= 1
im = torch.from_numpy(im).permute(2,0,1)
return im, score_map, geo_map, training_mask, gt_idx, gt_out, labels_out
def E2Ecollate(batch):
img = []
gt_boxes = []
texts = []
scores = []
training_masks = []
for per_batch in batch:
img.append(per_batch[0])
scores.append(per_batch[1])
training_masks.append(per_batch[3])
gt_boxes.append(per_batch[5])
texts.append(per_batch[6])
return torch.stack(img, 0), gt_boxes, texts,scores,training_masks
class BeamSearchDecoder():
def __init__(self, lib, corpus, chars, word_chars, beam_width=20, lm_type='Words', lm_smoothing=0.01, tfsess=None):
word_beam_search_module = tf.load_op_library(lib)
self.mat = tf.placeholder(tf.float32)
corpus = open(corpus).read()
chars = open(chars).read()
word_chars = open(word_chars).read()
self.beamsearch_decoder = word_beam_search_module.word_beam_search(self.mat, beam_width, lm_type, lm_smoothing,
corpus, chars, word_chars)
self.tfsess = tfsess or tf.Session()
self.idx2char = dict(zip(range(0, len(chars)), chars))
def beamsearch(self, mat):
mat = np.concatenate((mat[:, :, 1:], mat[:, :, :1]), axis=-1)
results = self.tfsess.run(self.beamsearch_decoder, {self.mat: mat})
return results
def decode(self, preds_idx):
return [''.join([self.idx2char[idx] for idx in row if idx < len(self.idx2char)]) for row in preds_idx]
if __name__ == '__main__':
llist = './data/ICDAR2015.txt'
data = E2Edataset(train_list=llist)
E2Edataloader = torch.utils.data.DataLoader(data, batch_size=2, shuffle=False, collate_fn=E2Ecollate)
for index, data in enumerate(E2Edataloader):
im = data | [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
29937,
8025,
29901,
23616,
29899,
29947,
13,
13,
5215,
4842,
305,
13,
5215,
27234,
942,
800,
408,
319,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
13373,
24541,
13,
5215,
16250,
13,
3166,
349,
6227,
1053,
7084,
29892,
7084,
5072,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
5844,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
5215,
13850,
29906,
13,
5215,
2897,
13,
5215,
349,
6227,
13,
3166,
848,
29918,
1885,
1053,
5706,
29918,
29878,
1884,
29892,
5706,
29918,
29878,
1884,
29906,
13,
3166,
848,
29918,
1885,
1053,
2254,
29918,
4141,
29918,
7665,
532,
291,
13,
3166,
848,
29918,
1885,
1053,
679,
29918,
8346,
13,
5215,
4842,
305,
4924,
29889,
9067,
29879,
408,
4327,
29879,
13,
5215,
26110,
408,
15886,
13,
3166,
848,
29918,
1885,
1053,
4216,
29918,
1884,
29918,
9748,
13,
13,
13,
1990,
1954,
29887,
29909,
688,
13372,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
2987,
353,
319,
29889,
1523,
4220,
4197,
13,
13,
4706,
319,
29889,
6716,
2776,
4197,
13,
9651,
319,
29889,
10358,
332,
29898,
2204,
332,
29918,
13400,
29922,
29896,
29900,
29892,
29886,
29922,
29900,
29889,
29945,
511,
13,
9651,
319,
29889,
19302,
713,
10358,
332,
29898,
2204,
332,
29918,
13400,
29922,
29945,
29892,
29886,
29922,
29900,
29889,
29945,
511,
13,
4706,
4514,
511,
13,
4706,
319,
29889,
6716,
2776,
4197,
13,
9651,
319,
29889,
7967,
7989,
15063,
449,
29898,
3317,
29918,
5391,
267,
29922,
29955,
29892,
1375,
29918,
5391,
267,
29922,
29941,
29892,
1375,
29918,
3545,
29922,
29941,
29892,
1375,
29918,
2103,
29922,
29896,
29892,
4236,
29918,
3545,
29922,
29896,
29953,
29892,
4236,
29918,
2103,
29922,
29946,
29892,
13,
462,
9651,
5445,
29918,
1767,
29922,
29906,
29945,
29945,
29892,
13,
462,
9651,
282,
29922,
29900,
29889,
29945,
511,
13,
9651,
319,
29889,
7967,
7989,
15063,
449,
29898,
3317,
29918,
5391,
267,
29922,
29955,
29892,
1375,
29918,
5391,
267,
29922,
29941,
29892,
1375,
29918,
3545,
29922,
29941,
29892,
1375,
29918,
2103,
29922,
29896,
29892,
4236,
29918,
3545,
29922,
29896,
29953,
29892,
4236,
29918,
2103,
29922,
29946,
29892,
13,
462,
9651,
5445,
29918,
1767,
29922,
29896,
29955,
29900,
29892,
13,
462,
9651,
282,
29922,
29900,
29889,
29945,
511,
13,
9651,
319,
29889,
7967,
7989,
15063,
449,
29898,
3317,
29918,
5391,
267,
29922,
29955,
29892,
1375,
29918,
5391,
267,
29922,
29941,
29892,
1375,
29918,
3545,
29922,
29941,
29892,
1375,
29918,
2103,
29922,
29896,
29892,
4236,
29918,
3545,
29922,
29896,
29953,
29892,
4236,
29918,
2103,
29922,
29946,
29892,
13,
462,
9651,
5445,
29918,
1767,
29922,
29947,
29945,
29892,
13,
462,
9651,
282,
29922,
29900,
29889,
29945,
511,
13,
9651,
319,
29889,
7967,
7989,
15063,
449,
29898,
3317,
29918,
5391,
267,
29922,
29955,
29892,
1375,
29918,
5391,
267,
29922,
29941,
29892,
1375,
29918,
3545,
29922,
29941,
29892,
1375,
29918,
2103,
29922,
29896,
29892,
4236,
29918,
3545,
29922,
29896,
29953,
29892,
4236,
29918,
2103,
29922,
29946,
29892,
13,
462,
9651,
5445,
29918,
1767,
29922,
29900,
29892,
13,
462,
4706,
282,
29922,
29900,
29889,
29945,
511,
13,
13,
4706,
4514,
511,
13,
13,
4706,
396,
319,
29889,
17875,
1168,
509,
579,
29898,
13400,
29922,
29900,
29889,
29900,
29945,
29892,
282,
29922,
29900,
29889,
29955,
29945,
511,
13,
4706,
396,
319,
29889,
17875,
29933,
1266,
2264,
29898,
13400,
29922,
29900,
29889,
29900,
29945,
29892,
282,
29922,
29900,
29889,
29955,
29945,
511,
13,
4706,
396,
319,
29889,
17875,
29933,
1266,
2264,
1168,
509,
579,
29898,
9996,
579,
29918,
13400,
29922,
29900,
29889,
29900,
29945,
29892,
11785,
2264,
29918,
13400,
29922,
29900,
29889,
29900,
29945,
29892,
282,
29922,
29900,
29889,
29955,
29945,
511,
13,
268,
2314,
13,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10153,
1125,
13,
4706,
10153,
353,
7442,
29889,
2378,
29898,
2492,
29897,
13,
4706,
27615,
29918,
2492,
353,
29871,
1583,
29889,
2987,
29898,
3027,
29922,
2492,
29897,
1839,
3027,
2033,
13,
13,
4706,
736,
7084,
29889,
3166,
2378,
29898,
9067,
287,
29918,
2492,
29897,
13,
4706,
396,
736,
27615,
29918,
2492,
13,
13,
13,
1753,
304,
29918,
2378,
29898,
2492,
1125,
13,
1678,
10153,
353,
7442,
29889,
294,
2378,
29898,
2492,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
1678,
10153,
847,
29922,
29871,
29896,
29906,
29947,
13,
1678,
10153,
22361,
29871,
29896,
13,
1678,
736,
10153,
13,
1678,
396,
736,
10153,
13,
13,
1753,
4036,
29918,
29881,
309,
403,
29898,
2492,
1125,
13,
1678,
10153,
353,
7442,
29889,
2378,
29898,
2492,
29897,
13,
1678,
10153,
353,
13850,
29906,
29889,
29881,
309,
403,
29898,
2492,
29892,
7442,
29889,
2873,
29898,
12181,
7607,
8172,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29941,
511,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29941,
8243,
26688,
29922,
9302,
29889,
13470,
29947,
876,
13,
1678,
736,
7084,
29889,
3166,
2378,
29898,
2492,
29897,
13,
1678,
396,
736,
10153,
13,
13,
13,
1753,
4036,
29918,
261,
356,
29898,
2492,
1125,
13,
1678,
10153,
353,
7442,
29889,
2378,
29898,
2492,
29897,
13,
1678,
10153,
353,
13850,
29906,
29889,
261,
356,
29898,
2492,
29892,
7442,
29889,
2873,
29898,
12181,
7607,
8172,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29941,
511,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29941,
8243,
26688,
29922,
9302,
29889,
13470,
29947,
876,
13,
1678,
736,
7084,
29889,
3166,
2378,
29898,
2492,
29897,
13,
1678,
396,
736,
10153,
13,
13,
1753,
7945,
29918,
9067,
29879,
29898,
275,
29918,
7283,
15755,
353,
5852,
1125,
13,
1678,
565,
338,
29918,
7283,
15755,
29901,
13,
4706,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
4036,
29918,
29881,
309,
403,
29892,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29896,
29945,
511,
13,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
4036,
29918,
261,
356,
29892,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29896,
29945,
511,
13,
13,
9651,
4327,
29879,
29889,
17875,
27867,
457,
29898,
311,
7979,
267,
29922,
29941,
29892,
6287,
7607,
29900,
29889,
29929,
29945,
29892,
29871,
29896,
29889,
29900,
29945,
511,
1183,
279,
29922,
29941,
29892,
620,
981,
29922,
2940,
29889,
8186,
29909,
1525,
1254,
29892,
5445,
2780,
7607,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
8243,
13,
9651,
396,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
9651,
396,
268,
518,
13,
9651,
396,
308,
304,
29918,
2378,
29892,
13,
9651,
396,
268,
21251,
13,
9651,
396,
268,
282,
29922,
29896,
511,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
1954,
29887,
29909,
688,
13372,
3285,
13,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29953,
511,
13,
9651,
4327,
29879,
29889,
29954,
764,
7052,
3285,
13,
9651,
4327,
29879,
29889,
1762,
29911,
6073,
580,
13,
13,
632,
2314,
13,
1678,
1683,
29901,
13,
4706,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
4036,
29918,
29881,
309,
403,
29892,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29896,
29945,
511,
13,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
4036,
29918,
261,
356,
29892,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29896,
29945,
511,
13,
13,
9651,
4327,
29879,
29889,
17875,
27867,
457,
29898,
311,
7979,
267,
29922,
29941,
29892,
6287,
7607,
29900,
29889,
29929,
29945,
29892,
29871,
29896,
29889,
29900,
29945,
511,
1183,
279,
29922,
29941,
29892,
620,
981,
29922,
2940,
29889,
8186,
29909,
1525,
1254,
29892,
13,
462,
462,
1678,
5445,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
8243,
13,
9651,
396,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
9651,
396,
268,
518,
13,
9651,
396,
308,
304,
29918,
2378,
29892,
13,
9651,
396,
268,
21251,
13,
9651,
396,
268,
282,
29922,
29896,
511,
13,
9651,
4327,
29879,
29889,
17875,
2052,
368,
29898,
13,
18884,
518,
13,
462,
1678,
1954,
29887,
29909,
688,
13372,
3285,
13,
13,
18884,
21251,
13,
18884,
282,
29922,
29900,
29889,
29953,
511,
13,
9651,
4327,
29879,
29889,
1762,
29911,
6073,
580,
13,
13,
268,
2314,
13,
13,
13,
13,
1678,
736,
4327,
13,
13,
13,
1753,
1243,
29918,
9067,
29879,
29898,
275,
29918,
7283,
15755,
353,
5852,
1125,
13,
1678,
565,
338,
29918,
7283,
15755,
29901,
13,
4706,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
4706,
4327,
29879,
29889,
29954,
764,
7052,
3285,
13,
4706,
4327,
29879,
29889,
1762,
29911,
6073,
580,
13,
539,
2314,
13,
1678,
1683,
29901,
13,
4706,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
4706,
4327,
29879,
29889,
1762,
29911,
6073,
580,
13,
308,
2314,
13,
1678,
736,
4327,
13,
13,
13,
1753,
5700,
29918,
3027,
29898,
2492,
29892,
716,
29918,
2311,
29892,
1734,
29918,
29887,
517,
1125,
13,
13,
29871,
565,
7431,
29898,
1742,
29918,
29887,
517,
29897,
1405,
29871,
29900,
29901,
13,
1678,
1634,
353,
5852,
13,
1678,
274,
593,
353,
29871,
29900,
13,
1678,
1550,
1634,
29901,
13,
13,
418,
565,
274,
593,
1405,
29871,
29941,
29900,
29901,
13,
4706,
736,
10153,
13,
13,
418,
1426,
29918,
22678,
353,
1734,
29918,
29887,
517,
29961,
8172,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1742,
29918,
29887,
517,
29897,
448,
29871,
29896,
4638,
13,
13,
418,
4818,
353,
1426,
29918,
22678,
29889,
2083,
29898,
29900,
29897,
847,
29871,
29946,
13,
13,
418,
14492,
353,
938,
29898,
5064,
29961,
29900,
29962,
448,
4036,
29889,
29590,
6278,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
448,
716,
29918,
2311,
29961,
29896,
29962,
847,
29871,
29906,
29897,
13,
418,
14492,
353,
4236,
29898,
10351,
29892,
29871,
29896,
29897,
13,
418,
343,
29879,
353,
938,
29898,
5064,
29961,
29896,
29962,
448,
4036,
29889,
29590,
6278,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
448,
716,
29918,
2311,
29961,
29900,
29962,
847,
29871,
29906,
29897,
13,
418,
343,
29879,
353,
4236,
29898,
952,
29892,
29871,
29896,
29897,
13,
13,
418,
274,
1336,
29918,
1621,
353,
313,
10351,
29892,
343,
29879,
29892,
14492,
718,
716,
29918,
2311,
29961,
29896,
1402,
343,
29879,
718,
716,
29918,
2311,
29961,
29900,
2314,
13,
418,
274,
1336,
29918,
2492,
353,
10153,
29961,
29883,
1336,
29918,
1621,
29961,
29896,
5387,
29883,
1336,
29918,
1621,
29961,
29941,
1402,
274,
1336,
29918,
1621,
29961,
29900,
5387,
29883,
1336,
29918,
1621,
29961,
29906,
5262,
13,
418,
396,
13850,
29906,
29889,
326,
4294,
877,
17370,
29881,
742,
29883,
1336,
29918,
2492,
29897,
13,
13,
418,
565,
274,
1336,
29918,
2492,
29889,
12181,
29961,
29900,
29962,
1275,
274,
1336,
29918,
2492,
29889,
12181,
29961,
29896,
5387,
13,
4706,
1634,
353,
7700,
13,
418,
1683,
29901,
13,
4706,
274,
593,
4619,
29871,
29896,
13,
13,
13,
29871,
1683,
29901,
13,
1678,
14492,
353,
938,
29898,
8172,
29889,
29590,
29898,
29900,
29892,
10153,
29889,
12181,
29961,
29896,
12622,
13,
1678,
343,
29879,
353,
938,
29898,
8172,
29889,
29590,
29898,
29900,
29892,
10153,
29889,
12181,
29961,
29900,
12622,
13,
1678,
274,
1336,
29918,
1621,
353,
313,
10351,
29892,
343,
29879,
29892,
14492,
718,
716,
29918,
2311,
29961,
29896,
1402,
343,
29879,
718,
716,
29918,
2311,
29961,
29900,
2314,
13,
1678,
274,
1336,
29918,
2492,
353,
10153,
29961,
29883,
1336,
29918,
1621,
29961,
29896,
5387,
29883,
1336,
29918,
1621,
29961,
29941,
1402,
274,
1336,
29918,
1621,
29961,
29900,
5387,
29883,
1336,
29918,
1621,
29961,
29906,
5262,
13,
13,
29871,
565,
7431,
29898,
1742,
29918,
29887,
517,
29897,
1405,
29871,
29900,
29901,
13,
1678,
1734,
29918,
29887,
517,
7503,
29892,
584,
29892,
29871,
29900,
29962,
22361,
14492,
13,
1678,
1734,
29918,
29887,
517,
7503,
29892,
584,
29892,
29871,
29896,
29962,
22361,
343,
29879,
13,
13,
29871,
736,
274,
1336,
29918,
2492,
13,
13,
1990,
288,
7283,
16390,
24541,
29898,
16390,
24541,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3876,
29892,
6056,
29918,
3545,
353,
29871,
29946,
29947,
29892,
262,
29918,
14968,
353,
5852,
29892,
3646,
29918,
9067,
29922,
8516,
29892,
275,
29918,
7283,
15755,
353,
5852,
1125,
13,
4706,
1583,
29889,
12324,
29918,
3545,
353,
6056,
29918,
3545,
13,
4706,
1583,
29889,
2084,
353,
1583,
29889,
657,
29918,
2084,
29898,
4632,
29897,
13,
4706,
1583,
29889,
4632,
353,
3876,
13,
4706,
1583,
29889,
14968,
29918,
9067,
353,
7945,
29918,
9067,
29879,
29898,
275,
29918,
7283,
15755,
29897,
13,
4706,
1583,
29889,
1688,
29918,
9067,
353,
1243,
29918,
9067,
29879,
29898,
275,
29918,
7283,
15755,
29897,
13,
4706,
1583,
29889,
262,
29918,
14968,
353,
297,
29918,
14968,
13,
4706,
1583,
29889,
5182,
29918,
9067,
353,
3646,
29918,
9067,
13,
13,
1678,
822,
679,
29918,
2084,
29898,
1311,
29892,
1272,
29918,
2084,
1125,
13,
4706,
2967,
29918,
3972,
353,
2897,
29889,
2084,
29889,
25721,
29898,
1272,
29918,
2084,
29897,
13,
4706,
2066,
29918,
449,
353,
5159,
13,
4706,
274,
593,
353,
29871,
29900,
13,
4706,
411,
1722,
29898,
1272,
29918,
2084,
29897,
408,
285,
29901,
13,
9651,
1550,
5852,
29901,
13,
18884,
1196,
353,
285,
29889,
949,
1220,
580,
13,
18884,
565,
451,
1196,
29901,
13,
462,
1678,
2867,
13,
18884,
1196,
353,
1196,
29889,
17010,
580,
13,
18884,
565,
7431,
29898,
1220,
29897,
1275,
29871,
29900,
29901,
13,
462,
1678,
6773,
13,
18884,
565,
451,
1196,
29961,
29900,
29962,
1275,
8207,
2396,
13,
462,
1678,
1196,
353,
22372,
29900,
6822,
29912,
29896,
29913,
4286,
4830,
29898,
3188,
29918,
3972,
29892,
1196,
29897,
13,
18884,
2066,
29918,
449,
29889,
4397,
29898,
1220,
29897,
13,
18884,
274,
593,
4619,
29871,
29896,
13,
18884,
396,
565,
274,
593,
1405,
29871,
29896,
29900,
29900,
29901,
13,
18884,
396,
29871,
2867,
13,
4706,
736,
2066,
29918,
449,
13,
1678,
822,
679,
29918,
1272,
29898,
1311,
29892,
3027,
29918,
978,
1125,
13,
4706,
4765,
29918,
6144,
353,
376,
376,
13,
4706,
8536,
353,
1967,
29918,
978,
29889,
5451,
703,
16521,
13,
4706,
565,
7431,
29898,
23579,
29897,
1275,
29871,
29896,
29901,
13,
9651,
8536,
353,
1967,
29918,
978,
29889,
5451,
28165,
1159,
13,
9651,
4765,
29918,
6144,
353,
28796,
13,
4706,
1967,
29918,
978,
353,
8536,
29961,
29900,
1822,
17010,
580,
13,
4706,
396,
1967,
29918,
978,
353,
313,
23579,
29961,
29900,
29962,
718,
525,
525,
29974,
8536,
29961,
29896,
14664,
17010,
580,
13,
4706,
330,
29873,
29918,
3945,
353,
6629,
13,
4706,
565,
7431,
29898,
23579,
29897,
1405,
29871,
29896,
29901,
13,
9651,
330,
29873,
29918,
3945,
353,
5124,
13,
9651,
628,
326,
353,
5124,
13,
9651,
363,
413,
297,
3464,
29898,
29896,
29892,
7431,
29898,
23579,
22164,
13,
18884,
330,
29873,
29918,
3945,
4619,
628,
326,
718,
8536,
29961,
29895,
29962,
13,
18884,
628,
326,
353,
4765,
29918,
6144,
13,
9651,
565,
7431,
29898,
4141,
29918,
3945,
29897,
1405,
29871,
29896,
322,
330,
29873,
29918,
3945,
29961,
29900,
29962,
1275,
18793,
29915,
322,
330,
29873,
29918,
3945,
14352,
29896,
29962,
1275,
18793,
2396,
13,
18884,
330,
29873,
29918,
3945,
353,
330,
29873,
29918,
3945,
29961,
29896,
13018,
29896,
29962,
13,
13,
13,
4706,
565,
1967,
29918,
978,
29961,
2435,
29898,
3027,
29918,
978,
29897,
448,
29871,
29896,
29962,
1275,
13420,
2396,
13,
9651,
1967,
29918,
978,
353,
1967,
29918,
978,
29961,
29900,
13018,
29896,
29962,
13,
13,
4706,
527,
353,
13850,
29906,
29889,
326,
949,
29898,
3027,
29918,
978,
29897,
13,
4706,
527,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
326,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
28212,
29897,
13,
4706,
396,
527,
353,
527,
29961,
29906,
29901,
326,
29889,
12181,
29961,
29900,
29962,
29899,
29906,
29892,
29901,
29892,
17531,
13,
13,
4706,
396,
527,
29918,
9171,
353,
7442,
29889,
3298,
359,
3552,
1311,
29889,
12324,
29918,
3545,
29892,
326,
29889,
12181,
29961,
29896,
1402,
29941,
511,
7442,
29889,
13470,
29947,
29897,
13,
4706,
565,
1583,
29889,
12324,
29918,
3545,
1405,
527,
29889,
12181,
29961,
29900,
5387,
13,
13,
9651,
527,
29918,
29879,
1160,
353,
7442,
29889,
2873,
3552,
1311,
29889,
12324,
29918,
3545,
29892,
326,
29889,
12181,
29961,
29896,
1402,
29941,
511,
7442,
29889,
13470,
29947,
11877,
29906,
29945,
29945,
13,
9651,
20088,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
1311,
29889,
12324,
29918,
3545,
448,
527,
29889,
12181,
29961,
29900,
2314,
13,
9651,
527,
29918,
29879,
1160,
29961,
9502,
29901,
9502,
718,
527,
29889,
12181,
29961,
29900,
1402,
29901,
29892,
17531,
353,
527,
13,
4706,
1683,
29901,
13,
13,
9651,
6287,
353,
1583,
29889,
12324,
29918,
3545,
847,
5785,
29898,
326,
29889,
12181,
29961,
29900,
2314,
13,
9651,
2920,
353,
938,
29898,
326,
29889,
12181,
29961,
29896,
29962,
334,
6287,
29897,
13,
9651,
527,
29918,
29879,
1160,
353,
13850,
29906,
29889,
21476,
29898,
326,
29892,
313,
524,
29898,
2103,
511,
1583,
29889,
12324,
29918,
3545,
876,
13,
13,
4706,
1967,
353,
349,
6227,
29889,
2940,
29889,
3166,
2378,
29898,
9302,
29889,
13470,
29947,
29898,
326,
29918,
29879,
1160,
876,
13,
4706,
396,
1967,
353,
7442,
29889,
294,
2378,
29898,
326,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
4706,
396,
1967,
847,
29922,
29871,
29896,
29906,
29947,
13,
4706,
396,
1967,
22361,
29871,
29896,
13,
29937,
657,
11073,
13,
4706,
396,
330,
29873,
29918,
21134,
353,
5159,
13,
4706,
396,
363,
413,
297,
3464,
29898,
2435,
29898,
4141,
29918,
3945,
22164,
13,
4706,
396,
268,
565,
330,
29873,
29918,
3945,
29961,
29895,
29962,
297,
1583,
29889,
401,
29883,
29918,
13478,
29901,
13,
4706,
396,
308,
330,
29873,
29918,
21134,
29889,
4397,
29898,
1311,
29889,
401,
29883,
29918,
13478,
29961,
4141,
29918,
3945,
29961,
29895,
24960,
13,
4706,
396,
268,
1683,
29901,
13,
4706,
396,
308,
330,
29873,
29918,
21134,
29889,
4397,
29898,
29941,
29897,
13,
4706,
396,
13,
4706,
396,
736,
1967,
29892,
4141,
29918,
21134,
13,
4706,
736,
1967,
29892,
4141,
29918,
3945,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
2084,
29897,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
1018,
29901,
13,
9651,
1967,
29892,
1643,
353,
1583,
29889,
657,
29918,
1272,
29898,
1311,
29889,
2084,
29961,
2248,
2314,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
1596,
877,
12521,
14214,
1967,
363,
1273,
29881,
29915,
1273,
2380,
29897,
13,
9651,
736,
1583,
29961,
2248,
718,
29871,
29896,
29962,
13,
4706,
565,
1583,
29889,
262,
29918,
14968,
584,
13,
9651,
1967,
353,
1583,
29889,
14968,
29918,
9067,
29898,
3027,
29897,
13,
4706,
1683,
29901,
13,
9651,
1967,
353,
1583,
29889,
1688,
29918,
9067,
29898,
3027,
29897,
13,
9651,
396,
1967,
353,
7442,
29889,
2378,
29898,
3027,
29897,
13,
4706,
565,
1583,
29889,
5182,
29918,
9067,
338,
451,
6213,
29901,
13,
9651,
3858,
353,
1583,
29889,
5182,
29918,
9067,
29898,
1643,
29897,
13,
4706,
736,
313,
3027,
29892,
3858,
29897,
13,
13,
13,
1990,
7595,
1625,
9632,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
9853,
1125,
13,
4706,
4558,
29892,
11073,
353,
14319,
10456,
16175,
29897,
13,
4706,
274,
353,
4558,
29961,
29900,
1822,
2311,
29898,
29900,
29897,
13,
4706,
298,
353,
4236,
4197,
29886,
29889,
2311,
29898,
29896,
29897,
363,
282,
297,
4558,
2314,
13,
4706,
281,
353,
4236,
4197,
29886,
29889,
2311,
29898,
29906,
29897,
363,
282,
297,
4558,
2314,
13,
4706,
9853,
29918,
8346,
353,
4842,
305,
29889,
3298,
359,
29898,
2435,
29898,
8346,
511,
274,
29892,
298,
29892,
281,
467,
5589,
23538,
29896,
29897,
13,
4706,
363,
474,
29892,
1967,
297,
26985,
29898,
8346,
1125,
13,
9651,
4687,
29918,
29882,
353,
4236,
29898,
29900,
29892,
4036,
29889,
9502,
524,
29898,
29900,
29892,
298,
448,
1967,
29889,
2311,
29898,
29896,
4961,
13,
9651,
4687,
29918,
29893,
353,
4236,
29898,
29900,
29892,
4036,
29889,
9502,
524,
29898,
29900,
29892,
281,
448,
1967,
29889,
2311,
29898,
29906,
4961,
13,
9651,
9853,
29918,
8346,
29961,
29875,
29892,
584,
29892,
4687,
29918,
29882,
29901,
2962,
287,
29918,
29882,
718,
1967,
29889,
2311,
29898,
29896,
511,
4687,
29918,
29893,
29901,
2962,
287,
29918,
29893,
718,
1967,
29889,
2311,
29898,
29906,
4638,
353,
1967,
13,
4706,
736,
9853,
29918,
8346,
29892,
11073,
13,
13,
1678,
396,
4103,
689,
13,
13,
13,
1990,
382,
29906,
3853,
271,
24541,
29898,
16390,
24541,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7945,
29918,
1761,
29892,
1881,
29918,
2311,
29922,
29945,
29896,
29906,
29892,
4226,
675,
353,
5852,
1125,
13,
4706,
2428,
29898,
29923,
29906,
3853,
271,
24541,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
3027,
29918,
1761,
353,
7442,
29889,
2378,
29898,
657,
29918,
8346,
29898,
14968,
29918,
1761,
876,
13,
4706,
1583,
29889,
2080,
29918,
2311,
353,
1881,
29918,
2311,
13,
4706,
1583,
29889,
8945,
675,
353,
4226,
675,
13,
13,
4706,
1596,
877,
8875,
6694,
4558,
297,
6571,
4286,
4830,
29898,
1311,
29889,
3027,
29918,
1761,
29889,
12181,
29961,
29900,
1402,
7945,
29918,
1761,
876,
13,
13,
4706,
1583,
29889,
9067,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
462,
1678,
4327,
29879,
29889,
3306,
29967,
5171,
11891,
29941,
7671,
29941,
7671,
29941,
7671,
29941,
511,
13,
462,
1678,
4327,
29879,
29889,
17875,
29954,
764,
7052,
29898,
29886,
29922,
29900,
29889,
29896,
29897,
259,
2314,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
3027,
29918,
1761,
29897,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
527,
29918,
978,
353,
1583,
29889,
3027,
29918,
1761,
29961,
2248,
29962,
13,
13,
4706,
527,
353,
13850,
29906,
29889,
326,
949,
29898,
326,
29918,
978,
29897,
18884,
396,
29871,
30861,
31122,
13,
4706,
396,
13850,
29906,
29889,
326,
4294,
877,
29879,
328,
742,
326,
29897,
13,
4706,
13872,
29918,
9144,
353,
527,
29918,
978,
29889,
6506,
29898,
359,
29889,
2084,
29889,
6500,
3871,
29898,
326,
29918,
978,
467,
5451,
12839,
29861,
29896,
1402,
525,
3945,
1495,
13,
4706,
2967,
29918,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
3945,
29918,
9144,
29897,
13,
4706,
13872,
29918,
9144,
29918,
4141,
353,
22372,
29900,
6822,
4141,
648,
29896,
29913,
4286,
4830,
29898,
359,
29889,
2084,
29889,
25721,
29898,
326,
29918,
978,
511,
2967,
29918,
978,
29897,
13,
13,
4706,
1426,
29918,
3733,
952,
29892,
1426,
29918,
11338,
29892,
11073,
29918,
3945,
353,
2254,
29918,
4141,
29918,
7665,
532,
291,
29898,
3945,
29918,
9144,
29918,
4141,
29892,
5852,
29897,
13,
4706,
396,
29871,
31526,
30752,
31062,
31368,
30689,
31021,
13,
4706,
19490,
29918,
29893,
353,
1583,
29889,
2080,
29918,
2311,
13,
4706,
19490,
29918,
29882,
353,
1583,
29889,
2080,
29918,
2311,
13,
13,
4706,
6287,
29881,
353,
5700,
29918,
3027,
29898,
326,
29892,
313,
1311,
29889,
2080,
29918,
2311,
29892,
1583,
29889,
2080,
29918,
2311,
511,
1426,
29918,
3733,
952,
29897,
13,
4706,
565,
6287,
29881,
29889,
12181,
29961,
29900,
29962,
1275,
29871,
29900,
470,
6287,
29881,
29889,
12181,
29961,
29896,
29962,
1275,
29871,
29900,
29901,
13,
9651,
6287,
29881,
353,
527,
13,
13,
4706,
565,
6287,
29881,
29889,
12181,
29961,
29896,
29962,
2804,
19490,
29918,
29893,
470,
6287,
29881,
29889,
12181,
29961,
29900,
29962,
2804,
19490,
29918,
29882,
29901,
13,
9651,
11959,
29918,
2492,
29922,
1375,
29898,
7052,
29881,
29889,
12181,
29961,
29896,
16261,
7052,
29881,
29889,
12181,
29961,
29900,
1402,
7052,
29881,
29889,
12181,
29961,
29900,
16261,
7052,
29881,
29889,
12181,
29961,
29896,
2314,
13,
9651,
565,
6287,
29881,
29889,
12181,
29961,
29900,
29962,
1405,
6287,
29881,
29889,
12181,
29961,
29896,
5387,
13,
18884,
19490,
29918,
29893,
353,
21476,
29918,
29893,
334,
11959,
29918,
2492,
13,
18884,
6287,
29916,
353,
6287,
29881,
29889,
12181,
29961,
29896,
29962,
847,
19490,
29918,
29893,
13,
18884,
6287,
29891,
353,
6287,
29881,
29889,
12181,
29961,
29900,
29962,
847,
19490,
29918,
29882,
13,
18884,
6287,
29881,
353,
13850,
29906,
29889,
21476,
29898,
7052,
29881,
29892,
270,
2311,
7607,
524,
29898,
21476,
29918,
29893,
511,
938,
29898,
21476,
29918,
29882,
4961,
13,
9651,
1683,
584,
13,
18884,
19490,
29918,
29882,
353,
19490,
29918,
29882,
334,
11959,
29918,
2492,
13,
18884,
6287,
29916,
353,
6287,
29881,
29889,
12181,
29961,
29896,
29962,
847,
19490,
29918,
29893,
13,
18884,
6287,
29891,
353,
6287,
29881,
29889,
12181,
29961,
29900,
29962,
847,
19490,
29918,
29882,
13,
18884,
6287,
29881,
353,
13850,
29906,
29889,
21476,
29898,
7052,
29881,
29892,
270,
2311,
7607,
524,
29898,
21476,
29918,
29893,
511,
938,
29898,
21476,
29918,
29882,
4961,
13,
9651,
396,
6773,
13,
13,
9651,
565,
7431,
29898,
726,
29918,
3733,
952,
29897,
1405,
29871,
29900,
29901,
13,
18884,
1426,
29918,
3733,
952,
7503,
29892,
584,
29892,
29871,
29900,
29962,
847,
29922,
6287,
29916,
13,
18884,
1426,
29918,
3733,
952,
7503,
29892,
584,
29892,
29871,
29896,
29962,
847,
29922,
6287,
29891,
13,
9651,
6287,
29881,
353,
13850,
29906,
29889,
8552,
9984,
17025,
29898,
7052,
29881,
29892,
29871,
29900,
29892,
1583,
29889,
2080,
29918,
2311,
448,
6287,
29881,
29889,
12181,
29961,
29900,
1402,
29871,
29900,
29892,
1583,
29889,
2080,
29918,
2311,
448,
6287,
29881,
29889,
12181,
29961,
29896,
1402,
13850,
29906,
29889,
29933,
22364,
29918,
6007,
1254,
13566,
29892,
1767,
11759,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
2314,
13,
13,
13,
9651,
396,
6287,
29881,
29918,
4294,
353,
6287,
29881,
29889,
8552,
580,
13,
9651,
396,
363,
313,
29875,
29892,
274,
29897,
297,
26985,
29898,
726,
29918,
3733,
952,
1125,
13,
9651,
396,
268,
4216,
29918,
1884,
29918,
9748,
29898,
7052,
29881,
29918,
4294,
29892,
274,
29892,
2927,
7607,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
511,
12003,
2264,
29922,
29896,
29897,
13,
9651,
396,
268,
396,
2012,
310,
4969,
263,
716,
1967,
29892,
306,
3763,
6623,
278,
2030,
697,
13,
9651,
396,
13,
9651,
396,
13,
9651,
396,
396,
1510,
278,
9120,
1967,
411,
599,
278,
7705,
19536,
472,
278,
1095,
29889,
13,
9651,
396,
13850,
29906,
29889,
326,
4294,
877,
2492,
742,
6287,
29881,
29918,
4294,
29897,
13,
13,
4706,
282,
326,
353,
349,
6227,
29889,
2940,
29889,
3166,
2378,
29898,
9302,
29889,
13470,
29947,
29898,
7052,
29881,
876,
13,
4706,
565,
1583,
29889,
9067,
29901,
13,
9651,
282,
326,
353,
1583,
29889,
9067,
29898,
29886,
326,
29897,
13,
4706,
527,
353,
7442,
29889,
2378,
29898,
29886,
326,
29897,
13,
13,
13,
4706,
716,
29918,
29882,
29892,
716,
29918,
29893,
29892,
903,
353,
527,
29889,
12181,
13,
4706,
8158,
29918,
1958,
29892,
1737,
29877,
29918,
1958,
29892,
6694,
29918,
13168,
29892,
330,
29873,
29918,
13140,
29892,
330,
29873,
29918,
449,
29892,
11073,
29918,
449,
353,
5706,
29918,
29878,
1884,
29898,
326,
29892,
313,
1482,
29918,
29882,
29892,
716,
29918,
29893,
511,
1426,
29918,
3733,
952,
29892,
1426,
29918,
11338,
29892,
11073,
29918,
3945,
29892,
1998,
29922,
8824,
29897,
13,
13,
13,
4706,
527,
353,
7442,
29889,
294,
2378,
29898,
326,
29897,
13,
4706,
444,
13,
4706,
565,
1583,
29889,
8945,
675,
29901,
13,
9651,
527,
353,
527,
29889,
579,
668,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
9651,
527,
847,
29922,
29871,
29896,
29906,
29947,
13,
9651,
527,
22361,
29871,
29896,
13,
4706,
527,
353,
4842,
305,
29889,
3166,
29918,
23749,
29898,
326,
467,
17858,
1082,
29898,
29906,
29892,
29900,
29892,
29896,
29897,
13,
13,
13,
13,
4706,
736,
527,
29892,
8158,
29918,
1958,
29892,
1737,
29877,
29918,
1958,
29892,
6694,
29918,
13168,
29892,
330,
29873,
29918,
13140,
29892,
330,
29873,
29918,
449,
29892,
11073,
29918,
449,
13,
13,
13,
1753,
382,
29906,
29923,
1054,
9632,
29898,
16175,
1125,
13,
1678,
10153,
353,
5159,
13,
1678,
330,
29873,
29918,
1884,
267,
353,
5159,
13,
1678,
26442,
353,
5159,
13,
1678,
19435,
353,
5159,
13,
1678,
6694,
29918,
13168,
29879,
353,
5159,
13,
1678,
363,
639,
29918,
16175,
297,
9853,
29901,
13,
4706,
10153,
29889,
4397,
29898,
546,
29918,
16175,
29961,
29900,
2314,
13,
4706,
19435,
29889,
4397,
29898,
546,
29918,
16175,
29961,
29896,
2314,
13,
4706,
6694,
29918,
13168,
29879,
29889,
4397,
29898,
546,
29918,
16175,
29961,
29941,
2314,
13,
4706,
330,
29873,
29918,
1884,
267,
29889,
4397,
29898,
546,
29918,
16175,
29961,
29945,
2314,
13,
4706,
26442,
29889,
4397,
29898,
546,
29918,
16175,
29961,
29953,
2314,
13,
13,
13,
1678,
736,
4842,
305,
29889,
1429,
29898,
2492,
29892,
29871,
29900,
511,
330,
29873,
29918,
1884,
267,
29892,
26442,
29892,
1557,
2361,
29892,
26495,
29918,
13168,
29879,
13,
13,
13,
1990,
1522,
314,
7974,
6185,
6119,
7295,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4303,
29892,
1034,
13364,
29892,
22524,
29892,
1734,
29918,
305,
1503,
29892,
22913,
29918,
2103,
29922,
29906,
29900,
29892,
301,
29885,
29918,
1853,
2433,
29956,
4339,
742,
301,
29885,
29918,
3844,
29877,
6046,
29922,
29900,
29889,
29900,
29896,
29892,
260,
5847,
404,
29922,
8516,
1125,
13,
4706,
1734,
29918,
915,
314,
29918,
4478,
29918,
5453,
353,
15886,
29889,
1359,
29918,
459,
29918,
5258,
29898,
1982,
29897,
13,
4706,
1583,
29889,
2922,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29897,
13,
4706,
1034,
13364,
353,
1722,
29898,
2616,
13364,
467,
949,
580,
13,
4706,
22524,
353,
1722,
29898,
305,
1503,
467,
949,
580,
13,
4706,
1734,
29918,
305,
1503,
353,
1722,
29898,
1742,
29918,
305,
1503,
467,
949,
580,
13,
13,
4706,
1583,
29889,
915,
314,
4478,
29918,
7099,
6119,
353,
1734,
29918,
915,
314,
29918,
4478,
29918,
5453,
29889,
1742,
29918,
915,
314,
29918,
4478,
29898,
1311,
29889,
2922,
29892,
22913,
29918,
2103,
29892,
301,
29885,
29918,
1853,
29892,
301,
29885,
29918,
3844,
29877,
6046,
29892,
13,
462,
462,
462,
462,
965,
1034,
13364,
29892,
22524,
29892,
1734,
29918,
305,
1503,
29897,
13,
4706,
1583,
29889,
29873,
5847,
404,
353,
260,
5847,
404,
470,
15886,
29889,
7317,
580,
13,
4706,
1583,
29889,
13140,
29906,
3090,
353,
9657,
29898,
7554,
29898,
3881,
29898,
29900,
29892,
7431,
29898,
305,
1503,
8243,
22524,
876,
13,
13,
1678,
822,
22913,
4478,
29898,
1311,
29892,
1775,
1125,
13,
4706,
1775,
353,
7442,
29889,
535,
29883,
2579,
403,
3552,
2922,
7503,
29892,
584,
29892,
29871,
29896,
29901,
1402,
1775,
7503,
29892,
584,
29892,
584,
29896,
11724,
9685,
10457,
29896,
29897,
13,
4706,
2582,
353,
1583,
29889,
29873,
5847,
404,
29889,
3389,
29898,
1311,
29889,
915,
314,
4478,
29918,
7099,
6119,
29892,
426,
1311,
29889,
2922,
29901,
1775,
1800,
13,
4706,
736,
2582,
13,
13,
1678,
822,
21822,
29898,
1311,
29892,
4450,
29879,
29918,
13140,
1125,
13,
4706,
736,
6024,
4286,
7122,
4197,
1311,
29889,
13140,
29906,
3090,
29961,
13140,
29962,
363,
22645,
297,
1948,
565,
22645,
529,
7431,
29898,
1311,
29889,
13140,
29906,
3090,
29897,
2314,
363,
1948,
297,
4450,
29879,
29918,
13140,
29962,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
301,
1761,
353,
19283,
1272,
29914,
2965,
29928,
1718,
29906,
29900,
29896,
29945,
29889,
3945,
29915,
13,
13,
1678,
848,
353,
382,
29906,
3853,
271,
24541,
29898,
14968,
29918,
1761,
29922,
645,
391,
29897,
13,
13,
1678,
382,
29906,
3853,
2075,
29877,
1664,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
1272,
29892,
9853,
29918,
2311,
29922,
29906,
29892,
528,
21897,
29922,
8824,
29892,
5321,
403,
29918,
9144,
29922,
29923,
29906,
29923,
1054,
9632,
29897,
13,
13,
1678,
363,
2380,
29892,
848,
297,
26985,
29898,
29923,
29906,
3853,
2075,
29877,
1664,
1125,
13,
4706,
527,
353,
848,
2
] |
nnef/fold_os.py | lahplover/nnef | 2 | 37534 | import numpy as np
import pandas as pd
import torch
from physics.protein_os import Protein
import options
from utils import write_pdb, write_pdb_sample, transform_profile, load_protein
from physics.anneal import AnnealCoords, AnnealFrag
# from physics.move import SampleICNext
from physics.grad_minimizer import *
from physics.dynamics import *
import os
import mdtraj as md
from utils import test_setup
import h5py
#################################################
parser = options.get_fold_parser()
args = options.parse_args_and_arch(parser)
device, model, energy_fn, ProteinBase = test_setup(args)
# position_weights = torch.zeros((1, args.seq_len + 1), device=device)
# position_weights[:, 0:5] = 1
# energy_fn.energy_fn.position_weights = position_weights
#################################################
data_path = 'data/fold/cullpdb_val_deep'
protein_sample = pd.read_csv(f'{data_path}/sample.csv')
pdb_selected = protein_sample['pdb'].values
np.random.shuffle(pdb_selected)
fold_engine = args.fold_engine
mode = args.mode
# sample_ic = SampleICNext(mode)
exp_id = args.load_exp[-5:]
save_dir = args.save_dir
# if not os.path.exists(f'data/fold/{exp_id}'):
# os.mkdir(f'data/fold/{exp_id}')
if not os.path.exists(f'data/fold/{save_dir}'):
os.mkdir(f'data/fold/{save_dir}')
for pdb_id in pdb_selected:
seq, coords_native, profile = load_protein(data_path, pdb_id, mode, device, args)
protein_native = Protein(seq, coords_native, profile)
energy_native = protein_native.get_energy(energy_fn).item()
print('energy_native:', energy_native)
rg2, collision = protein_native.get_rad_gyration(coords_native)
print('native radius of gyration square:', rg2.item())
# residue_energy = protein_native.get_residue_energy(energy_fn)
# print(residue_energy)
# write_pdb(seq, coords_native, pdb_id, 'native', exp_id)
protein = Protein(seq, coords_native.clone(), profile.clone())
if args.random_init:
# random_coords_int = sample_ic.random_coords_int(len(seq)-3).to(device)
# protein.update_coords_internal(random_coords_int)
# extend_coords_int = torch.tensor([[5.367, 1.6, 0.0]], device=device).repeat((len(seq)-3, 1))
extend_coords_int = torch.tensor([[5.367, 0.1, 0.0]], device=device).repeat((len(seq)-3, 1))
protein.update_coords_internal(extend_coords_int)
protein.update_cartesian_from_internal()
coords_init = protein.coords
energy_init = protein.get_energy(energy_fn).item()
print('energy_init:', energy_init)
# write_pdb(seq, coords_init, pdb_id, f'init_{mode}', exp_id)
if fold_engine == 'anneal':
# simulated annealing
torch.set_grad_enabled(False)
if args.anneal_type == 'int_one':
annealer = AnnealCoords(energy_fn, protein, mode=mode, ic_move_std=args.ic_move_std,
T_max=args.T_max, T_min=args.T_min, L=args.L)
elif args.anneal_type == 'frag':
frag_file = h5py.File(f'data/fragment/{pdb_id}/{pdb_id}_int.h5', 'r')
query_pos = torch.tensor(frag_file['query_pos'][()], device=device)
frag_int = torch.tensor(frag_file['coords_int'][()], device=device)
annealer = AnnealFrag(energy_fn, protein, frag=(query_pos, frag_int), use_rg=args.use_rg,
T_max=args.T_max, T_min=args.T_min, L=args.L)
else:
raise ValueError('anneal_type should be int_one / frag.')
annealer.run()
coords_best = annealer.x_best
energy_best = annealer.energy_best
sample = annealer.sample
sample_energy = annealer.sample_energy
elif fold_engine == 'grad':
if args.x_type == 'cart':
minimizer = GradMinimizerCartesian(energy_fn, protein, lr=args.lr, num_steps=args.L)
elif args.x_type == 'internal':
minimizer = GradMinimizerInternal(energy_fn, protein, lr=args.lr, num_steps=args.L, momentum=0.0)
elif args.x_type == 'int_fast':
minimizer = GradMinimizerIntFast(energy_fn, protein, lr=args.lr, num_steps=args.L)
elif args.x_type == 'mixed':
minimizer = GradMinimizerMixed(energy_fn, protein, lr=args.lr, num_steps=args.L)
elif args.x_type == 'mix_fast':
minimizer = GradMinimizerMixFast(energy_fn, protein, lr=args.lr, num_steps=args.L)
else:
raise ValueError('x_type should be cart / internal / mixed / int_fast / mix_fast.')
minimizer.run()
coords_best = minimizer.x_best
energy_best = minimizer.energy_best
sample = minimizer.sample
sample_energy = minimizer.sample_energy
elif fold_engine == 'dynamics':
if args.x_type == 'cart':
minimizer = Dynamics(energy_fn, protein, num_steps=args.L, lr=args.lr, t_noise=args.T_max)
elif args.x_type == 'internal':
minimizer = DynamicsInternal(energy_fn, protein, num_steps=args.L, lr=args.lr, t_noise=args.T_max)
elif args.x_type == 'int_fast':
minimizer = DynamicsIntFast(energy_fn, protein, num_steps=args.L, lr=args.lr, t_noise=args.T_max)
elif args.x_type == 'mixed':
minimizer = DynamicsMixed(energy_fn, protein, num_steps=args.L, lr=args.lr, t_noise=args.T_max)
elif args.x_type == 'mix_fast':
minimizer = DynamicsMixFast(energy_fn, protein, num_steps=args.L, lr=args.lr, t_noise=args.T_max)
else:
raise ValueError('x_type should be cart / internal / mixed / int_fast / mix_fast.')
minimizer.run()
coords_best = minimizer.x_best
energy_best = minimizer.energy_best
sample = minimizer.sample
sample_energy = minimizer.sample_energy
else:
raise ValueError('fold_engine should be anneal / grad / dynamics')
# protein.update_coords(coords_best)
# residue_energy = protein.get_residue_energy(energy_fn)
# print(residue_energy)
# write_pdb(seq, coords_best, pdb_id, f'best_{mode}', exp_id)
# save sampled structures
sample = [coords_native.cpu(), coords_best.cpu(), coords_init.cpu()] + sample
sample_energy = [energy_native, energy_best, energy_init] + sample_energy
# write_pdb_sample(seq, sample, pdb_id, 'sample', exp_id)
# pd.DataFrame({'sample_energy': sample_energy}).to_csv(f'data/fold/{exp_id}/{pdb_id}_energy.csv', index=False)
write_pdb_sample(seq, sample, pdb_id, 'sample', save_dir)
# compute RMSD,
sample_xyz = torch.stack(sample, 0).cpu().detach().numpy()
print(sample_xyz.shape)
t = md.Trajectory(xyz=sample_xyz, topology=None)
t = t.superpose(t, frame=0)
write_pdb_sample(seq, t.xyz, pdb_id, 'sample2', save_dir)
sample_rmsd = md.rmsd(t, t, frame=0) # computation will change sample_xyz;
print(f'best RMSD: {sample_rmsd[1]}')
df = pd.DataFrame({'sample_energy': sample_energy,
'sample_rmsd': sample_rmsd})
df.to_csv(f'data/fold/{save_dir}/{pdb_id}_energy.csv', index=False)
| [
1,
1053,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
4842,
305,
13,
3166,
17558,
29889,
14676,
262,
29918,
359,
1053,
14409,
262,
13,
5215,
3987,
13,
3166,
3667,
29879,
1053,
2436,
29918,
29886,
2585,
29892,
2436,
29918,
29886,
2585,
29918,
11249,
29892,
4327,
29918,
10185,
29892,
2254,
29918,
14676,
262,
13,
3166,
17558,
29889,
11276,
284,
1053,
10558,
284,
7967,
4339,
29892,
10558,
284,
29943,
1431,
13,
29937,
515,
17558,
29889,
11631,
1053,
21029,
2965,
9190,
13,
3166,
17558,
29889,
5105,
29918,
1195,
326,
3950,
1053,
334,
13,
3166,
17558,
29889,
29881,
2926,
1199,
1053,
334,
13,
5215,
2897,
13,
5215,
22821,
3018,
29926,
408,
22821,
13,
3166,
3667,
29879,
1053,
1243,
29918,
14669,
13,
5215,
298,
29945,
2272,
13,
13,
13,
13383,
13383,
13383,
29937,
13,
16680,
353,
3987,
29889,
657,
29918,
8771,
29918,
16680,
580,
13,
5085,
353,
3987,
29889,
5510,
29918,
5085,
29918,
392,
29918,
1279,
29898,
16680,
29897,
13,
13,
10141,
29892,
1904,
29892,
5864,
29918,
9144,
29892,
14409,
262,
5160,
353,
1243,
29918,
14669,
29898,
5085,
29897,
13,
13,
29937,
2602,
29918,
705,
5861,
353,
4842,
305,
29889,
3298,
359,
3552,
29896,
29892,
6389,
29889,
11762,
29918,
2435,
718,
29871,
29896,
511,
4742,
29922,
10141,
29897,
13,
29937,
2602,
29918,
705,
5861,
7503,
29892,
29871,
29900,
29901,
29945,
29962,
353,
29871,
29896,
13,
29937,
5864,
29918,
9144,
29889,
27548,
29918,
9144,
29889,
3283,
29918,
705,
5861,
353,
2602,
29918,
705,
5861,
13,
13,
13,
13383,
13383,
13383,
29937,
13,
1272,
29918,
2084,
353,
525,
1272,
29914,
8771,
29914,
29883,
913,
29886,
2585,
29918,
791,
29918,
24535,
29915,
13,
14676,
262,
29918,
11249,
353,
10518,
29889,
949,
29918,
7638,
29898,
29888,
29915,
29912,
1272,
29918,
2084,
6822,
11249,
29889,
7638,
1495,
13,
29886,
2585,
29918,
8391,
353,
26823,
29918,
11249,
1839,
29886,
2585,
13359,
5975,
13,
9302,
29889,
8172,
29889,
845,
21897,
29898,
29886,
2585,
29918,
8391,
29897,
13,
13,
8771,
29918,
10599,
353,
6389,
29889,
8771,
29918,
10599,
13,
8513,
353,
6389,
29889,
8513,
13,
29937,
4559,
29918,
293,
353,
21029,
2965,
9190,
29898,
8513,
29897,
13,
4548,
29918,
333,
353,
6389,
29889,
1359,
29918,
4548,
14352,
29945,
17531,
13,
7620,
29918,
3972,
353,
6389,
29889,
7620,
29918,
3972,
13,
29937,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
4548,
29918,
333,
10162,
1125,
13,
29937,
268,
2897,
29889,
11256,
3972,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
4548,
29918,
333,
29913,
1495,
13,
361,
451,
2897,
29889,
2084,
29889,
9933,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
7620,
29918,
3972,
10162,
1125,
13,
1678,
2897,
29889,
11256,
3972,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
7620,
29918,
3972,
29913,
1495,
13,
13,
13,
1454,
282,
2585,
29918,
333,
297,
282,
2585,
29918,
8391,
29901,
13,
13,
1678,
19359,
29892,
1302,
4339,
29918,
11487,
29892,
8722,
353,
2254,
29918,
14676,
262,
29898,
1272,
29918,
2084,
29892,
282,
2585,
29918,
333,
29892,
4464,
29892,
4742,
29892,
6389,
29897,
13,
13,
1678,
26823,
29918,
11487,
353,
14409,
262,
29898,
11762,
29892,
1302,
4339,
29918,
11487,
29892,
8722,
29897,
13,
1678,
5864,
29918,
11487,
353,
26823,
29918,
11487,
29889,
657,
29918,
27548,
29898,
27548,
29918,
9144,
467,
667,
580,
13,
1678,
1596,
877,
27548,
29918,
11487,
29901,
742,
5864,
29918,
11487,
29897,
13,
1678,
15552,
29906,
29892,
22369,
353,
26823,
29918,
11487,
29889,
657,
29918,
3665,
29918,
1927,
29878,
362,
29898,
1111,
4339,
29918,
11487,
29897,
13,
1678,
1596,
877,
11487,
11855,
310,
330,
4316,
362,
6862,
29901,
742,
15552,
29906,
29889,
667,
3101,
13,
1678,
396,
10995,
434,
29918,
27548,
353,
26823,
29918,
11487,
29889,
657,
29918,
690,
333,
434,
29918,
27548,
29898,
27548,
29918,
9144,
29897,
13,
1678,
396,
1596,
29898,
690,
333,
434,
29918,
27548,
29897,
13,
1678,
396,
2436,
29918,
29886,
2585,
29898,
11762,
29892,
1302,
4339,
29918,
11487,
29892,
282,
2585,
29918,
333,
29892,
525,
11487,
742,
1518,
29918,
333,
29897,
13,
13,
1678,
26823,
353,
14409,
262,
29898,
11762,
29892,
1302,
4339,
29918,
11487,
29889,
16513,
3285,
8722,
29889,
16513,
3101,
13,
1678,
565,
6389,
29889,
8172,
29918,
2344,
29901,
13,
4706,
396,
4036,
29918,
1111,
4339,
29918,
524,
353,
4559,
29918,
293,
29889,
8172,
29918,
1111,
4339,
29918,
524,
29898,
2435,
29898,
11762,
6817,
29941,
467,
517,
29898,
10141,
29897,
13,
4706,
396,
26823,
29889,
5504,
29918,
1111,
4339,
29918,
7564,
29898,
8172,
29918,
1111,
4339,
29918,
524,
29897,
13,
4706,
396,
10985,
29918,
1111,
4339,
29918,
524,
353,
4842,
305,
29889,
20158,
4197,
29961,
29945,
29889,
29941,
29953,
29955,
29892,
29871,
29896,
29889,
29953,
29892,
29871,
29900,
29889,
29900,
20526,
4742,
29922,
10141,
467,
14358,
3552,
2435,
29898,
11762,
6817,
29941,
29892,
29871,
29896,
876,
13,
4706,
10985,
29918,
1111,
4339,
29918,
524,
353,
4842,
305,
29889,
20158,
4197,
29961,
29945,
29889,
29941,
29953,
29955,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29900,
20526,
4742,
29922,
10141,
467,
14358,
3552,
2435,
29898,
11762,
6817,
29941,
29892,
29871,
29896,
876,
13,
4706,
26823,
29889,
5504,
29918,
1111,
4339,
29918,
7564,
29898,
21843,
29918,
1111,
4339,
29918,
524,
29897,
13,
4706,
26823,
29889,
5504,
29918,
13823,
18970,
29918,
3166,
29918,
7564,
580,
13,
1678,
1302,
4339,
29918,
2344,
353,
26823,
29889,
1111,
4339,
13,
13,
1678,
5864,
29918,
2344,
353,
26823,
29889,
657,
29918,
27548,
29898,
27548,
29918,
9144,
467,
667,
580,
13,
1678,
1596,
877,
27548,
29918,
2344,
29901,
742,
5864,
29918,
2344,
29897,
13,
1678,
396,
2436,
29918,
29886,
2585,
29898,
11762,
29892,
1302,
4339,
29918,
2344,
29892,
282,
2585,
29918,
333,
29892,
285,
29915,
2344,
648,
8513,
29913,
742,
1518,
29918,
333,
29897,
13,
13,
1678,
565,
900,
29881,
29918,
10599,
1275,
525,
11276,
284,
2396,
13,
4706,
396,
1027,
7964,
385,
484,
12818,
13,
4706,
4842,
305,
29889,
842,
29918,
5105,
29918,
17590,
29898,
8824,
29897,
13,
4706,
565,
6389,
29889,
11276,
284,
29918,
1853,
1275,
525,
524,
29918,
650,
2396,
13,
9651,
385,
484,
18362,
353,
10558,
284,
7967,
4339,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
4464,
29922,
8513,
29892,
16077,
29918,
11631,
29918,
4172,
29922,
5085,
29889,
293,
29918,
11631,
29918,
4172,
29892,
13,
462,
462,
1678,
323,
29918,
3317,
29922,
5085,
29889,
29911,
29918,
3317,
29892,
323,
29918,
1195,
29922,
5085,
29889,
29911,
29918,
1195,
29892,
365,
29922,
5085,
29889,
29931,
29897,
13,
4706,
25342,
6389,
29889,
11276,
284,
29918,
1853,
1275,
525,
29888,
1431,
2396,
13,
9651,
13855,
29918,
1445,
353,
298,
29945,
2272,
29889,
2283,
29898,
29888,
29915,
1272,
29914,
20777,
19248,
29886,
2585,
29918,
333,
6822,
29912,
29886,
2585,
29918,
333,
2403,
524,
29889,
29882,
29945,
742,
525,
29878,
1495,
13,
9651,
2346,
29918,
1066,
353,
4842,
305,
29889,
20158,
29898,
29888,
1431,
29918,
1445,
1839,
1972,
29918,
1066,
2033,
29961,
580,
1402,
4742,
29922,
10141,
29897,
13,
9651,
13855,
29918,
524,
353,
4842,
305,
29889,
20158,
29898,
29888,
1431,
29918,
1445,
1839,
1111,
4339,
29918,
524,
2033,
29961,
580,
1402,
4742,
29922,
10141,
29897,
13,
9651,
385,
484,
18362,
353,
10558,
284,
29943,
1431,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
13855,
7607,
1972,
29918,
1066,
29892,
13855,
29918,
524,
511,
671,
29918,
11007,
29922,
5085,
29889,
1509,
29918,
11007,
29892,
13,
462,
462,
29871,
323,
29918,
3317,
29922,
5085,
29889,
29911,
29918,
3317,
29892,
323,
29918,
1195,
29922,
5085,
29889,
29911,
29918,
1195,
29892,
365,
29922,
5085,
29889,
29931,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
877,
11276,
284,
29918,
1853,
881,
367,
938,
29918,
650,
847,
13855,
29889,
1495,
13,
4706,
385,
484,
18362,
29889,
3389,
580,
13,
4706,
1302,
4339,
29918,
13318,
353,
385,
484,
18362,
29889,
29916,
29918,
13318,
13,
4706,
5864,
29918,
13318,
353,
385,
484,
18362,
29889,
27548,
29918,
13318,
13,
4706,
4559,
353,
385,
484,
18362,
29889,
11249,
13,
4706,
4559,
29918,
27548,
353,
385,
484,
18362,
29889,
11249,
29918,
27548,
13,
1678,
25342,
900,
29881,
29918,
10599,
1275,
525,
5105,
2396,
13,
4706,
565,
6389,
29889,
29916,
29918,
1853,
1275,
525,
13823,
2396,
13,
9651,
6260,
3950,
353,
19295,
8140,
326,
3950,
25233,
18970,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
7564,
2396,
13,
9651,
6260,
3950,
353,
19295,
8140,
326,
3950,
16491,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
19399,
29922,
29900,
29889,
29900,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
524,
29918,
11255,
2396,
13,
9651,
6260,
3950,
353,
19295,
8140,
326,
3950,
2928,
29943,
579,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
29885,
11925,
2396,
13,
9651,
6260,
3950,
353,
19295,
8140,
326,
3950,
29924,
11925,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
28084,
29918,
11255,
2396,
13,
9651,
6260,
3950,
353,
19295,
8140,
326,
3950,
29924,
861,
29943,
579,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
877,
29916,
29918,
1853,
881,
367,
7774,
847,
7463,
847,
12849,
847,
938,
29918,
11255,
847,
6837,
29918,
11255,
29889,
1495,
13,
13,
4706,
6260,
3950,
29889,
3389,
580,
13,
4706,
1302,
4339,
29918,
13318,
353,
6260,
3950,
29889,
29916,
29918,
13318,
13,
4706,
5864,
29918,
13318,
353,
6260,
3950,
29889,
27548,
29918,
13318,
13,
4706,
4559,
353,
6260,
3950,
29889,
11249,
13,
4706,
4559,
29918,
27548,
353,
6260,
3950,
29889,
11249,
29918,
27548,
13,
1678,
25342,
900,
29881,
29918,
10599,
1275,
525,
29881,
2926,
1199,
2396,
13,
4706,
565,
6389,
29889,
29916,
29918,
1853,
1275,
525,
13823,
2396,
13,
9651,
6260,
3950,
353,
22554,
1199,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
260,
29918,
1217,
895,
29922,
5085,
29889,
29911,
29918,
3317,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
7564,
2396,
13,
9651,
6260,
3950,
353,
22554,
1199,
16491,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
260,
29918,
1217,
895,
29922,
5085,
29889,
29911,
29918,
3317,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
524,
29918,
11255,
2396,
13,
9651,
6260,
3950,
353,
22554,
1199,
2928,
29943,
579,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
260,
29918,
1217,
895,
29922,
5085,
29889,
29911,
29918,
3317,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
29885,
11925,
2396,
13,
9651,
6260,
3950,
353,
22554,
1199,
29924,
11925,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
260,
29918,
1217,
895,
29922,
5085,
29889,
29911,
29918,
3317,
29897,
13,
4706,
25342,
6389,
29889,
29916,
29918,
1853,
1275,
525,
28084,
29918,
11255,
2396,
13,
9651,
6260,
3950,
353,
22554,
1199,
29924,
861,
29943,
579,
29898,
27548,
29918,
9144,
29892,
26823,
29892,
954,
29918,
24530,
29922,
5085,
29889,
29931,
29892,
301,
29878,
29922,
5085,
29889,
29212,
29892,
260,
29918,
1217,
895,
29922,
5085,
29889,
29911,
29918,
3317,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
877,
29916,
29918,
1853,
881,
367,
7774,
847,
7463,
847,
12849,
847,
938,
29918,
11255,
847,
6837,
29918,
11255,
29889,
1495,
13,
13,
4706,
6260,
3950,
29889,
3389,
580,
13,
4706,
1302,
4339,
29918,
13318,
353,
6260,
3950,
29889,
29916,
29918,
13318,
13,
4706,
5864,
29918,
13318,
353,
6260,
3950,
29889,
27548,
29918,
13318,
13,
4706,
4559,
353,
6260,
3950,
29889,
11249,
13,
4706,
4559,
29918,
27548,
353,
6260,
3950,
29889,
11249,
29918,
27548,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
877,
8771,
29918,
10599,
881,
367,
385,
484,
284,
847,
4656,
847,
19753,
1495,
13,
13,
1678,
396,
26823,
29889,
5504,
29918,
1111,
4339,
29898,
1111,
4339,
29918,
13318,
29897,
13,
1678,
396,
10995,
434,
29918,
27548,
353,
26823,
29889,
657,
29918,
690,
333,
434,
29918,
27548,
29898,
27548,
29918,
9144,
29897,
13,
1678,
396,
1596,
29898,
690,
333,
434,
29918,
27548,
29897,
13,
1678,
396,
2436,
29918,
29886,
2585,
29898,
11762,
29892,
1302,
4339,
29918,
13318,
29892,
282,
2585,
29918,
333,
29892,
285,
29915,
13318,
648,
8513,
29913,
742,
1518,
29918,
333,
29897,
13,
13,
1678,
396,
4078,
4559,
29881,
12286,
13,
1678,
4559,
353,
518,
1111,
4339,
29918,
11487,
29889,
21970,
3285,
1302,
4339,
29918,
13318,
29889,
21970,
3285,
1302,
4339,
29918,
2344,
29889,
21970,
580,
29962,
718,
4559,
13,
1678,
4559,
29918,
27548,
353,
518,
27548,
29918,
11487,
29892,
5864,
29918,
13318,
29892,
5864,
29918,
2344,
29962,
718,
4559,
29918,
27548,
13,
1678,
396,
2436,
29918,
29886,
2585,
29918,
11249,
29898,
11762,
29892,
4559,
29892,
282,
2585,
29918,
333,
29892,
525,
11249,
742,
1518,
29918,
333,
29897,
13,
1678,
396,
10518,
29889,
17271,
3319,
29915,
11249,
29918,
27548,
2396,
4559,
29918,
27548,
7690,
517,
29918,
7638,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
4548,
29918,
333,
6822,
29912,
29886,
2585,
29918,
333,
2403,
27548,
29889,
7638,
742,
2380,
29922,
8824,
29897,
13,
1678,
2436,
29918,
29886,
2585,
29918,
11249,
29898,
11762,
29892,
4559,
29892,
282,
2585,
29918,
333,
29892,
525,
11249,
742,
4078,
29918,
3972,
29897,
13,
13,
1678,
396,
10272,
390,
4345,
29928,
29892,
13,
1678,
4559,
29918,
20230,
353,
4842,
305,
29889,
1429,
29898,
11249,
29892,
29871,
29900,
467,
21970,
2141,
4801,
496,
2141,
23749,
580,
13,
1678,
1596,
29898,
11249,
29918,
20230,
29889,
12181,
29897,
13,
1678,
260,
353,
22821,
29889,
5323,
622,
706,
29898,
20230,
29922,
11249,
29918,
20230,
29892,
20159,
29922,
8516,
29897,
13,
1678,
260,
353,
260,
29889,
9136,
4220,
29898,
29873,
29892,
3515,
29922,
29900,
29897,
13,
1678,
2436,
29918,
29886,
2585,
29918,
11249,
29898,
11762,
29892,
260,
29889,
20230,
29892,
282,
2585,
29918,
333,
29892,
525,
11249,
29906,
742,
4078,
29918,
3972,
29897,
13,
1678,
4559,
29918,
29878,
1516,
29881,
353,
22821,
29889,
29878,
1516,
29881,
29898,
29873,
29892,
260,
29892,
3515,
29922,
29900,
29897,
29871,
396,
16287,
674,
1735,
4559,
29918,
20230,
29936,
13,
13,
1678,
1596,
29898,
29888,
29915,
13318,
390,
4345,
29928,
29901,
426,
11249,
29918,
29878,
1516,
29881,
29961,
29896,
12258,
1495,
13,
1678,
4489,
353,
10518,
29889,
17271,
3319,
29915,
11249,
29918,
27548,
2396,
4559,
29918,
27548,
29892,
13,
462,
539,
525,
11249,
29918,
29878,
1516,
29881,
2396,
4559,
29918,
29878,
1516,
29881,
1800,
13,
1678,
4489,
29889,
517,
29918,
7638,
29898,
29888,
29915,
1272,
29914,
8771,
19248,
7620,
29918,
3972,
6822,
29912,
29886,
2585,
29918,
333,
2403,
27548,
29889,
7638,
742,
2380,
29922,
8824,
29897,
13,
13,
13,
13,
13,
13,
2
] |
seatsvotes/cvtools.py | ljwolf/seatsvotes | 0 | 45282 | <filename>seatsvotes/cvtools.py
import numpy as np
import statsmodels as __sm
import pandas as pd
sm = __sm.api
def leverage(results):
"""
Compute the leverage matrix from a WLS model:
H = W^.5 X(X'WX)^-1X'W^.5
where W^.5 is the scalar square root.
"""
if isinstance(results.model, sm.WLS):
W = np.diag(results.model.weights)
elif isinstance(results.model, sm.OLS):
W = np.eye(results.model.exog.shape[0])
X = results.model.exog
emp_cov = results.cov_params(scale=1)
unW_H = X.dot(emp_cov).dot(X.T)
return (W**.5).dot(unW_H).dot(W**.5)
def jackknife(candidate, full=False, **kw):
"""
Estimate each leave-one-out model given the input data.
Arguments
---------
candidate: model
statsmodels regression model or a pysal regression model.
full : bool
whether to return all reestimated models, or just the parameter
estimates from the models.
kw : keywords
keyword arguments passed down to the resulting model estimation statement.
If for a statsmodels model, should be separated into fit_kw and init_kw.
"""
if isinstance(candidate, __sm.base.wrapper.ResultsWrapper):
out = _sm_jackknife(candidate, **kw)
if not full:
out = pd.DataFrame(np.vstack([mod.params.reshape(1,-1) for mod in out]),
columns=candidate.params.index)
return out
else:
_pysal_jackknife(candidate, **kw)
def _sm_jackknife(results, init_kw=dict(), fit_kw=dict()):
"""
Jackknife the results object, meaning the model is
re-estimated with a single observation left out each time.
"""
endog, exog = results.model.endog, results.model.exog
if isinstance(results.model, sm.WLS):
weights = results.model.weights
elif isinstance(results.model, sm.OLS):
weights = np.ones_like(endog)
deletions = [sm.WLS(np.delete(endog, i),
np.delete(exog, i, axis=0),
weights=np.delete(weights, i),
**init_kw).fit(**fit_kw)
for i in range(len(endog))]
return deletions
def _pysal_jackknife(model, **kw):
raise NotImplementedError
X = model.X
Y = model.Y
yend = getattr(model, 'yend', None)
z = getattr(model, 'z', None)
W = getattr(model, 'W', None)
fit = type(model)
| [
1,
529,
9507,
29958,
344,
1446,
29894,
4769,
29914,
11023,
8504,
29889,
2272,
13,
5215,
12655,
408,
7442,
13,
5215,
22663,
9794,
408,
4770,
3844,
13,
5215,
11701,
408,
10518,
13,
13,
3844,
353,
4770,
3844,
29889,
2754,
13,
13,
1753,
454,
19698,
29898,
9902,
1125,
13,
1678,
9995,
13,
1678,
11796,
29872,
278,
454,
19698,
4636,
515,
263,
399,
8547,
1904,
29901,
13,
13,
1678,
379,
353,
399,
29985,
29889,
29945,
1060,
29898,
29990,
29915,
29956,
29990,
4887,
29899,
29896,
29990,
29915,
29956,
29985,
29889,
29945,
13,
13,
1678,
988,
399,
29985,
29889,
29945,
338,
278,
17336,
6862,
3876,
29889,
13,
1678,
9995,
13,
1678,
565,
338,
8758,
29898,
9902,
29889,
4299,
29892,
1560,
29889,
29956,
8547,
1125,
13,
4706,
399,
353,
7442,
29889,
6051,
351,
29898,
9902,
29889,
4299,
29889,
705,
5861,
29897,
13,
1678,
25342,
338,
8758,
29898,
9902,
29889,
4299,
29892,
1560,
29889,
5607,
29903,
1125,
13,
4706,
399,
353,
7442,
29889,
1032,
29872,
29898,
9902,
29889,
4299,
29889,
735,
468,
29889,
12181,
29961,
29900,
2314,
13,
1678,
1060,
353,
2582,
29889,
4299,
29889,
735,
468,
13,
1678,
3710,
29918,
24542,
353,
2582,
29889,
24542,
29918,
7529,
29898,
7052,
29922,
29896,
29897,
13,
1678,
443,
29956,
29918,
29950,
353,
1060,
29889,
6333,
29898,
3451,
29918,
24542,
467,
6333,
29898,
29990,
29889,
29911,
29897,
13,
1678,
736,
313,
29956,
1068,
29889,
29945,
467,
6333,
29898,
348,
29956,
29918,
29950,
467,
6333,
29898,
29956,
1068,
29889,
29945,
29897,
13,
13,
1753,
28015,
3959,
1607,
29898,
29883,
5380,
403,
29892,
2989,
29922,
8824,
29892,
3579,
11022,
1125,
13,
1678,
9995,
13,
1678,
2661,
6490,
1269,
5967,
29899,
650,
29899,
449,
1904,
2183,
278,
1881,
848,
29889,
29871,
13,
13,
1678,
11842,
9331,
13,
1678,
448,
1378,
13,
1678,
14020,
29901,
1904,
13,
1669,
22663,
9794,
17855,
1904,
470,
263,
282,
952,
284,
17855,
1904,
29889,
13,
1678,
2989,
268,
584,
6120,
13,
1669,
3692,
304,
736,
599,
337,
342,
326,
630,
4733,
29892,
470,
925,
278,
3443,
29871,
13,
1669,
21875,
515,
278,
4733,
29889,
29871,
13,
1678,
9049,
539,
584,
29361,
13,
1669,
13553,
6273,
4502,
1623,
304,
278,
9819,
1904,
23248,
3229,
29889,
13,
1669,
960,
363,
263,
22663,
9794,
1904,
29892,
881,
367,
13055,
964,
6216,
29918,
11022,
322,
2069,
29918,
11022,
29889,
29871,
13,
1678,
9995,
13,
1678,
565,
338,
8758,
29898,
29883,
5380,
403,
29892,
4770,
3844,
29889,
3188,
29889,
17699,
29889,
12191,
15646,
1125,
13,
4706,
714,
353,
903,
3844,
29918,
21452,
3959,
1607,
29898,
29883,
5380,
403,
29892,
3579,
11022,
29897,
13,
4706,
565,
451,
2989,
29901,
13,
9651,
714,
353,
10518,
29889,
17271,
29898,
9302,
29889,
29894,
1429,
4197,
1545,
29889,
7529,
29889,
690,
14443,
29898,
29896,
6653,
29896,
29897,
363,
878,
297,
714,
11724,
13,
462,
1669,
4341,
29922,
29883,
5380,
403,
29889,
7529,
29889,
2248,
29897,
13,
4706,
736,
714,
13,
1678,
1683,
29901,
13,
4706,
903,
29886,
952,
284,
29918,
21452,
3959,
1607,
29898,
29883,
5380,
403,
29892,
3579,
11022,
29897,
13,
13,
13,
13,
1753,
903,
3844,
29918,
21452,
3959,
1607,
29898,
9902,
29892,
2069,
29918,
11022,
29922,
8977,
3285,
6216,
29918,
11022,
29922,
8977,
580,
1125,
13,
1678,
9995,
13,
1678,
5457,
3959,
1607,
278,
2582,
1203,
29892,
6593,
278,
1904,
338,
29871,
13,
1678,
337,
29899,
342,
326,
630,
411,
263,
2323,
15500,
2175,
714,
1269,
931,
29889,
13,
1678,
9995,
13,
1678,
1095,
468,
29892,
429,
468,
353,
2582,
29889,
4299,
29889,
355,
468,
29892,
2582,
29889,
4299,
29889,
735,
468,
13,
1678,
565,
338,
8758,
29898,
9902,
29889,
4299,
29892,
1560,
29889,
29956,
8547,
1125,
13,
4706,
18177,
353,
2582,
29889,
4299,
29889,
705,
5861,
13,
1678,
25342,
338,
8758,
29898,
9902,
29889,
4299,
29892,
1560,
29889,
5607,
29903,
1125,
13,
4706,
18177,
353,
7442,
29889,
2873,
29918,
4561,
29898,
355,
468,
29897,
13,
1678,
7374,
1080,
353,
518,
3844,
29889,
29956,
8547,
29898,
9302,
29889,
8143,
29898,
355,
468,
29892,
474,
511,
13,
462,
4706,
7442,
29889,
8143,
29898,
735,
468,
29892,
474,
29892,
9685,
29922,
29900,
511,
13,
462,
4706,
18177,
29922,
9302,
29889,
8143,
29898,
705,
5861,
29892,
474,
511,
13,
462,
4706,
3579,
2344,
29918,
11022,
467,
9202,
29898,
1068,
9202,
29918,
11022,
29897,
13,
462,
363,
474,
297,
3464,
29898,
2435,
29898,
355,
468,
28166,
13,
1678,
736,
7374,
1080,
13,
13,
1753,
903,
29886,
952,
284,
29918,
21452,
3959,
1607,
29898,
4299,
29892,
3579,
11022,
1125,
13,
1678,
12020,
2216,
1888,
2037,
287,
2392,
13,
1678,
1060,
353,
1904,
29889,
29990,
13,
1678,
612,
353,
1904,
29889,
29979,
13,
1678,
343,
355,
353,
679,
5552,
29898,
4299,
29892,
525,
29891,
355,
742,
6213,
29897,
13,
1678,
503,
353,
679,
5552,
29898,
4299,
29892,
525,
29920,
742,
6213,
29897,
13,
1678,
399,
353,
679,
5552,
29898,
4299,
29892,
525,
29956,
742,
6213,
29897,
13,
1678,
6216,
353,
1134,
29898,
4299,
29897,
13,
2
] |
org.beerware.empty.app/assets/axp.py | pmp-p/projects | 0 | 27484 |
from android import *
print(widget.Button)
from android.widget import TextView
| [
1,
29871,
13,
3166,
1442,
1053,
334,
13,
13,
13,
2158,
29898,
8030,
29889,
3125,
29897,
13,
13,
13,
3166,
1442,
29889,
8030,
1053,
19633,
13,
2
] |
Lecture 12/Lecture12HWAssignment2.py | AtharvaJoshi21/PythonPOC | 1 | 127065 | # WAP to accept an unsorted list of integers from user and sort it using
# a. Bubble Sort
# b. Insertion Sort
def BubbleSort(inputList):
listCount = len(inputList)
for x in range(listCount - 1):
alreadySorted = True
print('Iteration', x)
for y in range(x+1, listCount - 1):
if inputList[x] > inputList[y]:
temp = inputList[x]
inputList[x] = inputList[y]
inputList[y] = temp
alreadySorted = False
else:
alreadySorted = True
if alreadySorted:
continue
return inputList
def main():
unsortedList = eval(input('Please enter a list to be sorted: '))
print(BubbleSort(unsortedList))
if __name__ == '__main__':
main() | [
1,
396,
399,
3301,
304,
3544,
385,
443,
24582,
1051,
310,
11920,
515,
1404,
322,
2656,
372,
773,
29871,
13,
29937,
29871,
12,
29874,
29889,
350,
23232,
20025,
13,
29937,
29871,
12,
29890,
29889,
24505,
291,
20025,
13,
13,
1753,
350,
23232,
13685,
29898,
2080,
1293,
1125,
13,
1678,
1051,
3981,
353,
7431,
29898,
2080,
1293,
29897,
13,
1678,
363,
921,
297,
3464,
29898,
1761,
3981,
448,
29871,
29896,
1125,
13,
4706,
2307,
13685,
287,
353,
5852,
13,
4706,
1596,
877,
13463,
362,
742,
921,
29897,
13,
4706,
363,
343,
297,
3464,
29898,
29916,
29974,
29896,
29892,
1051,
3981,
448,
29871,
29896,
1125,
13,
9651,
565,
1881,
1293,
29961,
29916,
29962,
1405,
1881,
1293,
29961,
29891,
5387,
13,
18884,
5694,
353,
1881,
1293,
29961,
29916,
29962,
13,
18884,
1881,
1293,
29961,
29916,
29962,
353,
1881,
1293,
29961,
29891,
29962,
13,
18884,
1881,
1293,
29961,
29891,
29962,
353,
5694,
13,
18884,
2307,
13685,
287,
353,
7700,
13,
9651,
1683,
29901,
13,
18884,
2307,
13685,
287,
353,
5852,
13,
4706,
565,
2307,
13685,
287,
29901,
13,
9651,
6773,
13,
13,
1678,
736,
1881,
1293,
13,
13,
1753,
1667,
7295,
13,
1678,
443,
24582,
1293,
353,
19745,
29898,
2080,
877,
12148,
3896,
263,
1051,
304,
367,
12705,
29901,
525,
876,
13,
1678,
1596,
29898,
29933,
23232,
13685,
29898,
348,
24582,
1293,
876,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
2
] |
1-100/1-10/6-zigZagConversion/zigZagConversion.py | xuychen/Leetcode | 0 | 44831 | <reponame>xuychen/Leetcode<gh_stars>0
import operator
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows == 1:
return s
period = (numRows - 1) * 2
result = ""
end = ""
length = len(s)
i = 0
while i * period < length:
result += s[i*period]
if i * period + numRows - 1< length:
end += s[i * period + numRows - 1]
i += 1
for i in range(1, numRows-1):
j = 0
while j * period < length:
lowerBase = j * period
upperBase = lowerBase + period
if (lowerBase + i < length):
result += s[lowerBase+i]
if (upperBase - i < length):
result += s[upperBase-i]
j += 1
return result + end
def convert2(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows == 1:
return s
num_groups = 2 * (numRows - 1)
strings = [""] * numRows
for i in range(len(s)):
mod = i % num_groups
if mod > num_groups / 2:
strings[num_groups-mod] += s[i]
else:
strings[mod] += s[i]
return reduce(operator.__add__, strings) | [
1,
529,
276,
1112,
420,
29958,
29916,
8631,
2724,
29914,
3226,
300,
401,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
5455,
13,
13,
1990,
24380,
29898,
3318,
1125,
13,
1678,
822,
3588,
29898,
1311,
29892,
269,
29892,
954,
10661,
1125,
13,
4706,
9995,
13,
4706,
584,
1853,
269,
29901,
851,
13,
4706,
584,
1853,
954,
10661,
29901,
938,
13,
4706,
584,
29878,
1853,
29901,
851,
13,
4706,
9995,
13,
13,
4706,
565,
954,
10661,
1275,
29871,
29896,
29901,
13,
9651,
736,
269,
13,
13,
4706,
3785,
353,
313,
1949,
10661,
448,
29871,
29896,
29897,
334,
29871,
29906,
13,
4706,
1121,
353,
5124,
13,
4706,
1095,
353,
5124,
13,
4706,
3309,
353,
7431,
29898,
29879,
29897,
13,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
1550,
474,
334,
3785,
529,
3309,
29901,
13,
9651,
1121,
4619,
269,
29961,
29875,
29930,
19145,
29962,
13,
9651,
565,
474,
334,
3785,
718,
954,
10661,
448,
29871,
29896,
29966,
3309,
29901,
13,
18884,
1095,
4619,
269,
29961,
29875,
334,
3785,
718,
954,
10661,
448,
29871,
29896,
29962,
13,
9651,
474,
4619,
29871,
29896,
13,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
954,
10661,
29899,
29896,
1125,
13,
9651,
432,
353,
29871,
29900,
13,
9651,
1550,
432,
334,
3785,
529,
3309,
29901,
13,
18884,
5224,
5160,
353,
432,
334,
3785,
13,
18884,
7568,
5160,
353,
5224,
5160,
718,
3785,
13,
18884,
565,
313,
13609,
5160,
718,
474,
529,
3309,
1125,
13,
462,
1678,
1121,
4619,
269,
29961,
13609,
5160,
29974,
29875,
29962,
13,
462,
1678,
565,
313,
21064,
5160,
448,
474,
529,
3309,
1125,
13,
462,
4706,
1121,
4619,
269,
29961,
21064,
5160,
29899,
29875,
29962,
13,
13,
18884,
432,
4619,
29871,
29896,
13,
13,
4706,
736,
1121,
718,
1095,
13,
13,
1678,
822,
3588,
29906,
29898,
1311,
29892,
269,
29892,
954,
10661,
1125,
13,
4706,
9995,
13,
4706,
584,
1853,
269,
29901,
851,
13,
4706,
584,
1853,
954,
10661,
29901,
938,
13,
4706,
584,
29878,
1853,
29901,
851,
13,
4706,
9995,
13,
13,
4706,
565,
954,
10661,
1275,
29871,
29896,
29901,
13,
9651,
736,
269,
13,
13,
4706,
954,
29918,
13155,
353,
29871,
29906,
334,
313,
1949,
10661,
448,
29871,
29896,
29897,
13,
4706,
6031,
353,
6796,
3108,
334,
954,
10661,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
29879,
22164,
13,
9651,
878,
353,
474,
1273,
954,
29918,
13155,
13,
9651,
565,
878,
1405,
954,
29918,
13155,
847,
29871,
29906,
29901,
13,
18884,
6031,
29961,
1949,
29918,
13155,
29899,
1545,
29962,
4619,
269,
29961,
29875,
29962,
13,
9651,
1683,
29901,
13,
18884,
6031,
29961,
1545,
29962,
4619,
269,
29961,
29875,
29962,
13,
13,
4706,
736,
10032,
29898,
6891,
17255,
1202,
1649,
29892,
6031,
29897,
2
] |
testtube/renderer.py | blaix/testtube | 0 | 95743 | <filename>testtube/renderer.py
"""Renderer that outputs formatted messaging for end users."""
import sys
from termcolor import colored
from testtube.conf import Settings
# For python3 support, we must use print as a function rather than a statement
class Renderer(object):
"""Utility that outputs formatted messages."""
def failure(self, message=''):
"""Print the passed message in red."""
print(colored(message, 'red'))
def notice(self, message=''):
"""Print the passed message."""
print(message)
def success(self, message=''):
"""Print the passed message in green."""
print(colored(message, 'green'))
def divider(self):
"""Print a divider."""
print('=' * 71)
def report(self, results):
"""Print a test report."""
self.notice("Test Report\n")
for count, group in enumerate(results, 1):
results = (self._format_test(test, res) for test, res in group)
results = (', ').join(results)
self.notice("Test group %s:\t%s" % (count, results))
self.divider()
def audible_alert(self, count):
"""Beep the number of times specified."""
sys.stdout.write('\a' * count)
def _format_test(self, test, result):
color = 'green' if result else 'red'
files = ''
if not test.all_files:
files = ' (%s)' % Settings.short_path(test.changed)
return colored('%s%s' % (test.name, files), color)
| [
1,
529,
9507,
29958,
1688,
29873,
4003,
29914,
9482,
261,
29889,
2272,
13,
15945,
29908,
21323,
393,
14391,
20917,
4473,
6751,
363,
1095,
4160,
1213,
15945,
13,
5215,
10876,
13,
13,
3166,
1840,
2780,
1053,
28684,
13,
13,
3166,
1243,
29873,
4003,
29889,
5527,
1053,
19215,
13,
13,
29937,
1152,
3017,
29941,
2304,
29892,
591,
1818,
671,
1596,
408,
263,
740,
3265,
1135,
263,
3229,
13,
13,
13,
1990,
26000,
261,
29898,
3318,
1125,
13,
13,
1678,
9995,
7270,
537,
393,
14391,
20917,
7191,
1213,
15945,
13,
13,
1678,
822,
10672,
29898,
1311,
29892,
2643,
2433,
29374,
13,
4706,
9995,
11816,
278,
4502,
2643,
297,
2654,
1213,
15945,
13,
4706,
1596,
29898,
2780,
287,
29898,
4906,
29892,
525,
1127,
8785,
13,
13,
1678,
822,
8369,
29898,
1311,
29892,
2643,
2433,
29374,
13,
4706,
9995,
11816,
278,
4502,
2643,
1213,
15945,
13,
4706,
1596,
29898,
4906,
29897,
13,
13,
1678,
822,
2551,
29898,
1311,
29892,
2643,
2433,
29374,
13,
4706,
9995,
11816,
278,
4502,
2643,
297,
7933,
1213,
15945,
13,
4706,
1596,
29898,
2780,
287,
29898,
4906,
29892,
525,
12692,
8785,
13,
13,
1678,
822,
1933,
1241,
29898,
1311,
1125,
13,
4706,
9995,
11816,
263,
1933,
1241,
1213,
15945,
13,
4706,
1596,
877,
2433,
334,
29871,
29955,
29896,
29897,
13,
13,
1678,
822,
3461,
29898,
1311,
29892,
2582,
1125,
13,
4706,
9995,
11816,
263,
1243,
3461,
1213,
15945,
13,
4706,
1583,
29889,
1333,
625,
703,
3057,
13969,
29905,
29876,
1159,
13,
13,
4706,
363,
2302,
29892,
2318,
297,
26985,
29898,
9902,
29892,
29871,
29896,
1125,
13,
9651,
2582,
353,
313,
1311,
3032,
4830,
29918,
1688,
29898,
1688,
29892,
620,
29897,
363,
1243,
29892,
620,
297,
2318,
29897,
13,
9651,
2582,
353,
313,
742,
525,
467,
7122,
29898,
9902,
29897,
13,
9651,
1583,
29889,
1333,
625,
703,
3057,
2318,
1273,
29879,
3583,
29873,
29995,
29879,
29908,
1273,
313,
2798,
29892,
2582,
876,
13,
13,
4706,
1583,
29889,
4563,
1241,
580,
13,
13,
1678,
822,
12990,
1821,
29918,
12888,
29898,
1311,
29892,
2302,
1125,
13,
4706,
9995,
3629,
1022,
278,
1353,
310,
3064,
6790,
1213,
15945,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29874,
29915,
334,
2302,
29897,
13,
13,
1678,
822,
903,
4830,
29918,
1688,
29898,
1311,
29892,
1243,
29892,
1121,
1125,
13,
4706,
2927,
353,
525,
12692,
29915,
565,
1121,
1683,
525,
1127,
29915,
13,
4706,
2066,
353,
6629,
13,
13,
4706,
565,
451,
1243,
29889,
497,
29918,
5325,
29901,
13,
9651,
2066,
353,
525,
313,
29995,
29879,
16029,
1273,
19215,
29889,
12759,
29918,
2084,
29898,
1688,
29889,
15033,
29897,
13,
13,
4706,
736,
28684,
877,
29995,
29879,
29995,
29879,
29915,
1273,
313,
1688,
29889,
978,
29892,
2066,
511,
2927,
29897,
13,
2
] |
pipelinePhase.py | armbrustsamuel/PythonPipelineEmulator | 0 | 166917 | # PIPELINE PHASES
import re
import miscellaneous as misc
import calculator as calc
instructionMemory = []
# Search phase
# @param program counter
# @return a instruction such as "dadd","daddi","dsub" ...
def search(pc):
# Retrieve next instruction in memory
instruction = misc.readInstructions("inputfile.txt")
dummyReturn = [" "," "," "]
if pc >= len(instruction):
return dummyReturn
return instruction[pc]
#returnIntruction = ["lw", "$s1", "$s2", "$s3"]
#return returnIntruction
# Decode phase
# @param
# @return
def decode(pc):
# Decode instruction and call execute
instructionMemory = misc.readInstructions("inputfile.txt")
dummyDecode = [" "," "," "," "," "]
# Adjust length
if pc >= len(instructionMemory):
return dummyDecode
else:
instructionMemory[pc].append(" ")
# -- print(len(instructionMemory[pc]))
if len(instructionMemory[pc]) > 3 :
instructionMemory[pc][3] = instructionMemory[pc][2]
if len(instructionMemory[pc]) > 2:
instructionMemory[pc][2] = instructionMemory[pc][1]
instructionMemory[pc][1] = instructionMemory[pc][0][5:].strip()
instructionMemory[pc][0] = instructionMemory[pc][0][:5].strip()
return instructionMemory[pc]
# To be removed
#misc.printInstruction(instructionMemory,pc)
# Execute phase
# @param
# @return exit[code, message]
# - 0 - correct execution , result of calculation
# - 1 - wrong execution , "Wrong instruction"
# - 2 - shift address , "ok" or "nok"
def execute(opCode,reg1,reg2):
# Read registers
registers = misc.readRegisters('registers.txt')
if reg1 != " ":
op1 = registers[int(reg1)]
if reg1 != " ":
op2 = registers[int(reg2)]
if opCode.find("dadd") != -1:
return calc.sum(op1,op2)
elif opCode.find("daddi") != -1:
return calc.daddi(op1,op2)
elif opCode.find("dsub") != -1:
return calc.sub(op1,op2)
elif opCode.find("lw") != -1:
return "LW"
elif opCode.find("dsubi") != -1:
return calc.sub(int(op1),int(op2))
elif opCode.find("beqz") != -1:
return calc.beqz(op1)
elif opCode.find("bnez") != -1:
return calc.bnez(op1)
elif opCode.find("beq") != -1:
return calc.beq(op1,op2)
elif opCode.find("bne") != -1:
return calc.bne(op1,op2)
elif opCode.find("j") != -1:
return "JUMP"
elif opCode.find(" ") != -1:
return 0
else:
#print("Wrong instruction - review code")
return 1
# MEMORY phase
# Reuse already created function
# Writeback
# @param
# @return
def saveAtRegister(data, address, registers):
registers[address] = data
if ( misc.writeRegisters('registers.txt', registers) == 0):
return 0
else:
print("Error saving registers")
return 1
| [
1,
396,
259,
349,
29902,
4162,
18521,
349,
29950,
8127,
29903,
13,
13,
5215,
337,
13,
5215,
3984,
3729,
23584,
408,
3984,
29883,
13,
5215,
3408,
1061,
408,
22235,
13,
13,
2611,
4080,
16015,
353,
5159,
13,
13,
29937,
11856,
8576,
13,
29937,
732,
3207,
1824,
6795,
13,
29937,
732,
2457,
263,
15278,
1316,
408,
376,
29881,
1202,
3284,
29881,
1202,
29875,
3284,
29881,
1491,
29908,
2023,
13,
1753,
2740,
29898,
6739,
1125,
13,
12,
29937,
4649,
29878,
2418,
2446,
15278,
297,
3370,
13,
12,
2611,
4080,
353,
3984,
29883,
29889,
949,
3379,
582,
1953,
703,
2080,
1445,
29889,
3945,
1159,
13,
13,
12,
29881,
11770,
11609,
353,
6796,
539,
28796,
28796,
376,
29962,
13,
12,
361,
22844,
6736,
7431,
29898,
2611,
4080,
1125,
13,
12,
12,
2457,
20254,
11609,
13,
12,
2457,
15278,
29961,
6739,
29962,
13,
12,
29937,
2457,
797,
509,
29884,
428,
353,
6796,
29880,
29893,
613,
3908,
29879,
29896,
613,
3908,
29879,
29906,
613,
3908,
29879,
29941,
3108,
13,
12,
29937,
2457,
736,
797,
509,
29884,
428,
13,
13,
29937,
897,
401,
8576,
13,
29937,
732,
3207,
13,
29937,
732,
2457,
13,
1753,
21822,
29898,
6739,
1125,
13,
12,
29937,
897,
401,
15278,
322,
1246,
6222,
13,
12,
2611,
4080,
16015,
353,
3984,
29883,
29889,
949,
3379,
582,
1953,
703,
2080,
1445,
29889,
3945,
1159,
13,
13,
12,
29881,
11770,
2772,
401,
353,
6796,
28796,
28796,
28796,
28796,
376,
29962,
13,
12,
29937,
2087,
5143,
3309,
13,
12,
361,
22844,
6736,
7431,
29898,
2611,
4080,
16015,
1125,
13,
12,
12,
2457,
20254,
2772,
401,
13,
12,
2870,
29901,
13,
12,
12,
2611,
4080,
16015,
29961,
6739,
1822,
4397,
703,
16521,
13,
12,
12,
29937,
1192,
1596,
29898,
2435,
29898,
2611,
4080,
16015,
29961,
6739,
12622,
13,
12,
12,
361,
7431,
29898,
2611,
4080,
16015,
29961,
6739,
2314,
1405,
29871,
29941,
584,
13,
12,
12,
12,
2611,
4080,
16015,
29961,
6739,
3816,
29941,
29962,
353,
15278,
16015,
29961,
6739,
3816,
29906,
29962,
13,
12,
12,
361,
7431,
29898,
2611,
4080,
16015,
29961,
6739,
2314,
1405,
29871,
29906,
29901,
13,
12,
12,
12,
2611,
4080,
16015,
29961,
6739,
3816,
29906,
29962,
353,
15278,
16015,
29961,
6739,
3816,
29896,
29962,
13,
12,
12,
2611,
4080,
16015,
29961,
6739,
3816,
29896,
29962,
353,
15278,
16015,
29961,
6739,
3816,
29900,
3816,
29945,
29901,
1822,
17010,
580,
13,
12,
12,
2611,
4080,
16015,
29961,
6739,
3816,
29900,
29962,
353,
15278,
16015,
29961,
6739,
3816,
29900,
3816,
29901,
29945,
1822,
17010,
580,
13,
12,
12,
2457,
15278,
16015,
29961,
6739,
29962,
13,
13,
12,
29937,
1763,
367,
6206,
13,
12,
29937,
29885,
10669,
29889,
2158,
3379,
4080,
29898,
2611,
4080,
16015,
29892,
6739,
29897,
13,
13,
29937,
11080,
1082,
8576,
13,
29937,
732,
3207,
13,
29937,
732,
2457,
6876,
29961,
401,
29892,
2643,
29962,
13,
29937,
29871,
448,
29871,
29900,
448,
1959,
8225,
12,
29892,
1121,
310,
13944,
13,
29937,
29871,
448,
29871,
29896,
448,
2743,
8225,
12,
29892,
376,
29956,
29373,
15278,
29908,
13,
29937,
29871,
448,
29871,
29906,
448,
9500,
3211,
12,
12,
29892,
376,
554,
29908,
470,
376,
29876,
554,
29908,
13,
1753,
6222,
29898,
459,
3399,
29892,
1727,
29896,
29892,
1727,
29906,
1125,
13,
13,
12,
29937,
7523,
28975,
13,
12,
9573,
29879,
353,
3984,
29883,
29889,
949,
15213,
29879,
877,
9573,
29879,
29889,
3945,
1495,
13,
12,
361,
1072,
29896,
2804,
376,
29242,
13,
12,
12,
459,
29896,
353,
28975,
29961,
524,
29898,
1727,
29896,
4638,
13,
12,
361,
1072,
29896,
2804,
376,
29242,
13,
12,
12,
459,
29906,
353,
28975,
29961,
524,
29898,
1727,
29906,
4638,
13,
13,
12,
361,
1015,
3399,
29889,
2886,
703,
29881,
1202,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
2083,
29898,
459,
29896,
29892,
459,
29906,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29881,
1202,
29875,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
29881,
1202,
29875,
29898,
459,
29896,
29892,
459,
29906,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29881,
1491,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
1491,
29898,
459,
29896,
29892,
459,
29906,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29880,
29893,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
376,
29931,
29956,
29908,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29881,
1491,
29875,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
1491,
29898,
524,
29898,
459,
29896,
511,
524,
29898,
459,
29906,
876,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
915,
29939,
29920,
1159,
29871,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
915,
29939,
29920,
29898,
459,
29896,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29890,
16617,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
29890,
16617,
29898,
459,
29896,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
915,
29939,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
915,
29939,
29898,
459,
29896,
29892,
459,
29906,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29890,
484,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
22235,
29889,
29890,
484,
29898,
459,
29896,
29892,
459,
29906,
29897,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
29926,
1159,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
376,
29967,
29965,
3580,
29908,
13,
12,
23681,
1015,
3399,
29889,
2886,
703,
259,
16521,
2804,
448,
29896,
29901,
13,
12,
12,
2457,
29871,
29900,
13,
12,
2870,
29901,
13,
12,
12,
29937,
2158,
703,
29956,
29373,
15278,
448,
9076,
775,
1159,
13,
12,
12,
2457,
29871,
29896,
13,
13,
29937,
341,
12665,
18929,
8576,
13,
29937,
830,
1509,
2307,
2825,
740,
13,
13,
29937,
14350,
1627,
13,
29937,
732,
3207,
13,
29937,
732,
2457,
13,
1753,
4078,
4178,
15213,
29898,
1272,
29892,
3211,
29892,
28975,
1125,
13,
13,
12,
9573,
29879,
29961,
7328,
29962,
353,
848,
13,
13,
12,
361,
313,
3984,
29883,
29889,
3539,
15213,
29879,
877,
9573,
29879,
29889,
3945,
742,
28975,
29897,
1275,
29871,
29900,
1125,
13,
12,
12,
2457,
29871,
29900,
13,
12,
2870,
29901,
13,
12,
12,
2158,
703,
2392,
14238,
28975,
1159,
13,
12,
12,
2457,
29871,
29896,
13,
13,
2
] |
awstin/dynamodb/orm.py | k2bd/awstin | 1 | 5047 | <reponame>k2bd/awstin
import uuid
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Union
from boto3.dynamodb.conditions import Attr as BotoAttr
from boto3.dynamodb.conditions import Key as BotoKey
from awstin.dynamodb.utils import from_decimal, to_decimal
class NotSet:
"""
A value of an attribute on a data model is not present in a DynamoDB result
"""
def __str__(self):
return "<<Attribute not set>>"
def __repr__(self):
return "<<Attribute not set>>"
NOT_SET = NotSet()
class BaseAttribute:
def __init__(self, attribute_name: Union[str, None] = None):
"""
Parameters
----------
attribute_name : str, optional
Name of the property in the DynamoDB table. Defaults to the name of
the attribute on the DynamoModel class.
"""
# Set by user
self._attribute_name = attribute_name
# Set by Model
self._name_on_model = None
@property
def _awstin_name(self):
if self._attribute_name is not None:
return self._attribute_name
else:
return self._name_on_model
def __getattr__(self, name):
"""
Support for nested mapping queries
"""
try:
return super().__getattr__(name)
except AttributeError:
return type(self)(attribute_name=f"{self._awstin_name}.{name}")
def __getitem__(self, index):
"""
Support for nested container queries
"""
return type(self)(attribute_name=f"{self._awstin_name}[{index}]")
# --- Query and scan filter expressions ---
def begins_with(self, value):
"""
Filter results by a key or attribute beginning with a value
Parameters
----------
value : str
Starting string for returned results
"""
return self._query_type(self._awstin_name).begins_with(to_decimal(value))
def between(self, low, high):
"""
Filter results by range (inclusive)
Parameters
----------
low : Any
Low end of the range
high : Any
High end of the range
"""
return self._query_type(self._awstin_name).between(
to_decimal(low),
to_decimal(high),
)
def __eq__(self, value):
return self._query_type(self._awstin_name).eq(to_decimal(value))
def __gt__(self, value):
return self._query_type(self._awstin_name).gt(to_decimal(value))
def __ge__(self, value):
return self._query_type(self._awstin_name).gte(to_decimal(value))
def __lt__(self, value):
return self._query_type(self._awstin_name).lt(to_decimal(value))
def __le__(self, value):
return self._query_type(self._awstin_name).lte(to_decimal(value))
def attribute_type(self, value):
"""
Filter results by attribute type
Parameters
----------
value : str
Index for a DynamoDB attribute type (e.g. "N" for Number)
"""
return BotoAttr(self._awstin_name).attribute_type(to_decimal(value))
def contains(self, value):
"""
Filter results by attributes that are containers and contain the target
value
Parameters
----------
values : Any
Result must contain this item
"""
return BotoAttr(self._awstin_name).contains(to_decimal(value))
def exists(self):
"""
Filter results by existence of an attribute
"""
return BotoAttr(self._awstin_name).exists()
def in_(self, values):
"""
Filter results by existence in a set
Parameters
----------
values : list of Any
Allowed values of returned results
"""
in_values = [to_decimal(value) for value in values]
return BotoAttr(self._awstin_name).is_in(in_values)
def __ne__(self, value):
return BotoAttr(self._awstin_name).ne(to_decimal(value))
def not_exists(self):
"""
Filter results by non-existence of an attribute
"""
return BotoAttr(self._awstin_name).not_exists()
def size(self):
"""
Filter by size of a collection
"""
return Size(self._awstin_name)
# --- Update expressions ---
def set(self, expression):
"""
Set an attribute to a new value.
Corresponds to SET as part of the update expression in
``Table.update_item``.
Parameters
----------
expression : UpdateOperand
New value, or an expression defining a new value
"""
return SetOperator(self, UpdateOperand(expression))
def remove(self):
"""
Remove an attribute.
Corresponds to REMOVE as part of the update expression in
``Table.update_item``.
"""
return RemoveOperator(self)
def add(self, expression):
"""
Add to an attribute (numerical add or addition to a set).
Corresponds to ADD as part of the update expression in
``Table.update_item``.
Parameters
----------
expression : UpdateOperand
Value to add
"""
return AddOperator(self, UpdateOperand(expression))
def delete(self, expression):
"""
Delete part of a set attribute.
Corresponds to DELETE as part of the update expression in
``Table.update_item``.
Parameters
----------
expression : UpdateOperand
Value to delete
"""
return DeleteOperator(self, UpdateOperand(expression))
def __add__(self, other):
return CombineOperand(UpdateOperand(self), UpdateOperand(other), "+")
def __sub__(self, other):
return CombineOperand(UpdateOperand(self), UpdateOperand(other), "-")
def __radd__(self, other):
return CombineOperand(UpdateOperand(other), UpdateOperand(self), "+")
def __rsub__(self, other):
return CombineOperand(UpdateOperand(other), UpdateOperand(self), "-")
def if_not_exists(self, value):
"""
Conditionally return a value if this attribute doesn't exist on the
model
"""
return IfNotExistsOperand(UpdateOperand(self), UpdateOperand(value))
class Key(BaseAttribute):
"""
Used to define and query hash and sort key attributes on a dynamodb table
data model
"""
_query_type = BotoKey
class Attr(BaseAttribute):
"""
Used to define and query non-key attributes on a dynamodb table data model
"""
_query_type = BotoAttr
def size_query(self, *args, **kwargs):
return BotoAttr(self._awstin_name).size()
class Size(BaseAttribute):
_query_type = size_query
class DynamoModelMeta(type):
def __getattribute__(self, name):
attr = super().__getattribute__(name)
if isinstance(attr, BaseAttribute):
attr._name_on_model = name
return attr
else:
return attr
def _dynamodb_attributes(self):
result = {
getattr(self, attr)._awstin_name: attr
for attr in dir(self)
if isinstance(getattr(self, attr), BaseAttribute)
}
return result
def _get_kwargs(self):
"""
Kwargs that should be passed to query, scan, get_item
"""
return {
**self._dynamo_projection(),
**self._index_kwargs(),
}
def _dynamo_projection(self):
"""
Attributes to request when retrieving data from DynamoDB
Returns
-------
dict
kwargs to be passed to DynamoDB get attribute calls to employ
a projection expression and placeholders
"""
placeholders = {
"#" + str(uuid.uuid4())[:8]: value
for value in self._dynamodb_attributes().keys()
}
expression = ", ".join(placeholders.keys())
return dict(
ProjectionExpression=expression,
ExpressionAttributeNames=placeholders,
)
def _index_kwargs(self):
if hasattr(self, "_index_name_"):
return dict(
IndexName=self._index_name_,
)
else:
return {}
class DynamoModel(metaclass=DynamoModelMeta):
"""
Class defining an ORM model for a DynamoDB table.
Subclasses must have a ``_table_name_`` attribute. Attributes making up
the data model should be Attr or Key instances.
Subclasses representing indexes should also have an ``_index_name_``
attribute
"""
def __init__(self, **kwargs):
"""
Parameters
----------
**kwargs : dict of (str, Any)
Initialization of Attr and Key attributes.
"""
model_attrs = type(self)._dynamodb_attributes().values()
for name in model_attrs:
setattr(self, name, NOT_SET)
for name, value in kwargs.items():
if name not in model_attrs:
msg = f"{type(self)!r} has no attribute {name!r}"
raise AttributeError(msg)
setattr(self, name, value)
@classmethod
def deserialize(cls, data):
"""
Deserialize JSON into a DynamoModel subclass. Internally converts
Decimal to float in the deserialization.
Parameters
----------
data : dict of (str, Any)
Serialized model
Returns
-------
DynamoModel
The deserialized data model
"""
model_attrs = cls._dynamodb_attributes()
result = cls()
for attr in model_attrs.values():
setattr(result, attr, NOT_SET)
for db_attr, value in data.items():
if db_attr in model_attrs.keys():
if type(value) in [list, set, tuple]:
value = type(value)(from_decimal(v) for v in value)
elif type(value) is dict:
value = {from_decimal(k): from_decimal(v) for k, v in value.items()}
else:
value = from_decimal(value)
setattr(result, model_attrs[db_attr], value)
return result
def serialize(self):
"""
Serialize a DynamoModel subclass to JSON that can be inserted into
DynamoDB. Internally converts float to Decimal.
Returns
-------
dict of (str, Any)
The serialized JSON entry
"""
model_attrs = type(self)._dynamodb_attributes()
result = {}
for dynamo_name, model_name in model_attrs.items():
value = getattr(self, model_name)
if value is not NOT_SET:
if type(value) in [list, set, tuple]:
value = type(value)(to_decimal(v) for v in value)
elif type(value) is dict:
value = {to_decimal(k): to_decimal(v) for k, v in value.items()}
else:
value = to_decimal(value)
result[dynamo_name] = value
return result
# ---- Update Operators
class UpdateOperator(ABC):
"""
A representation of an UpdateItem expression
"""
def __and__(self, other):
"""
Combine two update expressions
"""
return CombineOperator(self, other)
@abstractmethod
def update_dict(self):
pass
@staticmethod
def update_expression(update_dict):
expressions = []
for operation in "SET", "ADD", "DELETE", "REMOVE":
if update_dict.get(operation):
expressions.append(operation + " " + ", ".join(update_dict[operation]))
return " ".join(expressions)
def serialize(self):
"""
Produce kwargs to be passed to DynamoDB Table.update_item.
Keys and values are:
"UpdateExpression": string representing the update expression
"ExpressionAttributeNames": Placeholder map for attribute names
"ExpressionAttributeValues": Placeholder map for attribute values
Returns
-------
dict
Kwargs for update_item
"""
update_dict = self.update_dict()
result = {
"UpdateExpression": self.update_expression(update_dict),
}
if update_dict["ExpressionAttributeNames"]:
result["ExpressionAttributeNames"] = update_dict["ExpressionAttributeNames"]
if update_dict["ExpressionAttributeValues"]:
result["ExpressionAttributeValues"] = update_dict[
"ExpressionAttributeValues"
]
return result
class CombineOperator(UpdateOperator):
"""
Combine two update expressions
"""
def __init__(self, left, right):
self.left = left
self.right = right
def update_dict(self):
result = defaultdict(list)
ser_left = self.left.update_dict()
ser_right = self.right.update_dict()
items = list(ser_left.items()) + list(ser_right.items())
for key, values in items:
if key in ["SET", "ADD", "DELETE", "REMOVE"]:
result[key].extend(values)
result["ExpressionAttributeNames"] = dict(
**ser_left["ExpressionAttributeNames"],
**ser_right["ExpressionAttributeNames"],
)
result["ExpressionAttributeValues"] = dict(
**ser_left["ExpressionAttributeValues"],
**ser_right["ExpressionAttributeValues"],
)
return result
class SetOperator(UpdateOperator):
"""
Support for SET
"""
def __init__(self, attr, operand):
self.attr = attr
self.operand = operand
def update_dict(self):
serialized_attr = itemize_attr(self.attr)
serialized_operand = self.operand.serialize()
attribute_names = dict(
**serialized_operand["ExpressionAttributeNames"],
**serialized_attr["ExpressionAttributeNames"],
)
return {
"SET": [
f"{serialized_attr['UpdateExpression']} = "
+ serialized_operand["UpdateExpression"]
],
"ExpressionAttributeNames": attribute_names,
"ExpressionAttributeValues": serialized_operand[
"ExpressionAttributeValues"
],
}
class AddOperator(UpdateOperator):
def __init__(self, attr, operand):
self.attr = attr
self.operand = operand
def update_dict(self):
serialized_attr = itemize_attr(self.attr)
serialized_operand = self.operand.serialize()
attribute_names = dict(
**serialized_operand["ExpressionAttributeNames"],
**serialized_attr["ExpressionAttributeNames"],
)
return {
"ADD": [
f"{serialized_attr['UpdateExpression']} "
+ serialized_operand["UpdateExpression"]
],
"ExpressionAttributeNames": attribute_names,
"ExpressionAttributeValues": serialized_operand[
"ExpressionAttributeValues"
],
}
class RemoveOperator(UpdateOperator):
def __init__(self, attr):
self.attr = attr
def update_dict(self):
serialized_attr = itemize_attr(self.attr)
return {
"REMOVE": [serialized_attr["UpdateExpression"]],
"ExpressionAttributeNames": serialized_attr["ExpressionAttributeNames"],
"ExpressionAttributeValues": {},
}
class DeleteOperator(UpdateOperator):
def __init__(self, attr, operand):
self.attr = attr
self.operand = operand
def update_dict(self):
serialized_attr = itemize_attr(self.attr)
serialized_operand = self.operand.serialize()
attribute_names = dict(
**serialized_operand["ExpressionAttributeNames"],
**serialized_attr["ExpressionAttributeNames"],
)
return {
"DELETE": [
f"{serialized_attr['UpdateExpression']} "
+ serialized_operand["UpdateExpression"]
],
"ExpressionAttributeNames": attribute_names,
"ExpressionAttributeValues": serialized_operand[
"ExpressionAttributeValues"
],
}
# ---- Update Operands
def serialize_operand(value):
name = str(uuid.uuid4())[:8]
if isinstance(value, UpdateOperand):
return value.serialize()
elif isinstance(value, BaseAttribute):
return itemize_attr(value)
elif type(value) in [list, set, tuple]:
name = ":" + name
value = type(value)([to_decimal(v) for v in value])
return {
"UpdateExpression": name,
"ExpressionAttributeNames": {},
"ExpressionAttributeValues": {name: value},
}
else:
name = ":" + name
return {
"UpdateExpression": name,
"ExpressionAttributeNames": {},
"ExpressionAttributeValues": {name: to_decimal(value)},
}
def itemize_attr(attr):
# Separate indexes
parts = []
current_section = ""
for letter in attr._awstin_name:
if letter == "[":
parts.append(current_section)
current_section = "["
elif letter == "]":
parts.append(current_section + "]")
current_section = ""
else:
current_section += letter
if current_section:
parts.append(current_section)
serialized = ""
name_map = {}
# Separate attributes
for part in parts:
if "[" in part and "]" in part:
serialized += part
else:
if part.startswith("."):
serialized += "."
part = part[1:]
sections = part.split(".")
serialized_sections = []
for section in sections:
name = "#" + str(uuid.uuid4())[:8]
name_map[name] = section
serialized_sections.append(name)
serialized += ".".join(serialized_sections)
result = {
"UpdateExpression": serialized,
"ExpressionAttributeNames": name_map,
"ExpressionAttributeValues": {},
}
return result
class UpdateOperand:
"""
Inner part of an update expression
"""
def __init__(self, value):
self.value = value
def serialize(self):
return serialize_operand(self.value)
class CombineOperand(UpdateOperand):
"""
Add or subtact two expressions
"""
def __init__(self, left, right, symbol):
self.left = left
self.right = right
self.symbol = symbol
def serialize(self):
ser_left = serialize_operand(self.left)
ser_right = serialize_operand(self.right)
expression = (
f"{ser_left['UpdateExpression']} "
f"{self.symbol} "
f"{ser_right['UpdateExpression']}"
)
return {
"UpdateExpression": expression,
"ExpressionAttributeNames": dict(
**ser_left["ExpressionAttributeNames"],
**ser_right["ExpressionAttributeNames"],
),
"ExpressionAttributeValues": dict(
**ser_left["ExpressionAttributeValues"],
**ser_right["ExpressionAttributeValues"],
),
}
class IfNotExistsOperand(UpdateOperand):
"""
Set a value if the given attribute does not exist
"""
def __init__(self, attr, value):
self.attr = attr
self.value = value
def serialize(self):
ser_attr = serialize_operand(self.attr)
ser_value = serialize_operand(self.value)
expression = (
f"if_not_exists({ser_attr['UpdateExpression']}, "
f"{ser_value['UpdateExpression']})"
)
return {
"UpdateExpression": expression,
"ExpressionAttributeNames": dict(
**ser_attr["ExpressionAttributeNames"],
**ser_value["ExpressionAttributeNames"],
),
"ExpressionAttributeValues": dict(
**ser_attr["ExpressionAttributeValues"],
**ser_value["ExpressionAttributeValues"],
),
}
class ListAppendOperand(UpdateOperand):
"""
Combine two lists
"""
def __init__(self, left, right):
self.left = left
self.right = right
def serialize(self):
ser_left = serialize_operand(self.left)
ser_right = serialize_operand(self.right)
expression = (
f"list_append({ser_left['UpdateExpression']}, "
f"{ser_right['UpdateExpression']})"
)
return {
"UpdateExpression": expression,
"ExpressionAttributeNames": dict(
**ser_left["ExpressionAttributeNames"],
**ser_right["ExpressionAttributeNames"],
),
"ExpressionAttributeValues": dict(
**ser_left["ExpressionAttributeValues"],
**ser_right["ExpressionAttributeValues"],
),
}
def list_append(left, right):
"""
Set a value to the combination of two lists in an update expression
"""
return ListAppendOperand(UpdateOperand(left), UpdateOperand(right))
| [
1,
529,
276,
1112,
420,
29958,
29895,
29906,
6448,
29914,
1450,
303,
262,
13,
5215,
318,
5416,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
3166,
16250,
1053,
2322,
8977,
13,
3166,
19229,
1053,
7761,
13,
13,
3166,
289,
3747,
29941,
29889,
29881,
2926,
10396,
29889,
1116,
2187,
1053,
2180,
509,
408,
350,
3747,
25098,
13,
3166,
289,
3747,
29941,
29889,
29881,
2926,
10396,
29889,
1116,
2187,
1053,
7670,
408,
350,
3747,
2558,
13,
13,
3166,
3773,
303,
262,
29889,
29881,
2926,
10396,
29889,
13239,
1053,
515,
29918,
7099,
3039,
29892,
304,
29918,
7099,
3039,
13,
13,
13,
1990,
2216,
2697,
29901,
13,
1678,
9995,
13,
1678,
319,
995,
310,
385,
5352,
373,
263,
848,
1904,
338,
451,
2198,
297,
263,
22554,
29877,
4051,
1121,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
376,
9314,
6708,
451,
731,
6778,
29908,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
376,
9314,
6708,
451,
731,
6778,
29908,
13,
13,
13,
12256,
29918,
10490,
353,
2216,
2697,
580,
13,
13,
13,
1990,
7399,
6708,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5352,
29918,
978,
29901,
7761,
29961,
710,
29892,
6213,
29962,
353,
6213,
1125,
13,
4706,
9995,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
5352,
29918,
978,
584,
851,
29892,
13136,
13,
9651,
4408,
310,
278,
2875,
297,
278,
22554,
29877,
4051,
1591,
29889,
13109,
29879,
304,
278,
1024,
310,
13,
9651,
278,
5352,
373,
278,
22554,
29877,
3195,
770,
29889,
13,
4706,
9995,
13,
4706,
396,
3789,
491,
1404,
13,
4706,
1583,
3032,
12715,
29918,
978,
353,
5352,
29918,
978,
13,
13,
4706,
396,
3789,
491,
8125,
13,
4706,
1583,
3032,
978,
29918,
265,
29918,
4299,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
903,
1450,
303,
262,
29918,
978,
29898,
1311,
1125,
13,
4706,
565,
1583,
3032,
12715,
29918,
978,
338,
451,
6213,
29901,
13,
9651,
736,
1583,
3032,
12715,
29918,
978,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
3032,
978,
29918,
265,
29918,
4299,
13,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
1024,
1125,
13,
4706,
9995,
13,
4706,
18601,
363,
9322,
10417,
9365,
13,
4706,
9995,
13,
4706,
1018,
29901,
13,
9651,
736,
2428,
2141,
1649,
657,
5552,
12035,
978,
29897,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
736,
1134,
29898,
1311,
5033,
12715,
29918,
978,
29922,
29888,
29908,
29912,
1311,
3032,
1450,
303,
262,
29918,
978,
1836,
29912,
978,
27195,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
9995,
13,
4706,
18601,
363,
9322,
5639,
9365,
13,
4706,
9995,
13,
4706,
736,
1134,
29898,
1311,
5033,
12715,
29918,
978,
29922,
29888,
29908,
29912,
1311,
3032,
1450,
303,
262,
29918,
978,
4400,
29912,
2248,
6525,
1159,
13,
13,
1678,
396,
11474,
13641,
322,
12812,
4175,
12241,
11474,
13,
13,
1678,
822,
16410,
29918,
2541,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
263,
1820,
470,
5352,
6763,
411,
263,
995,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
995,
584,
851,
13,
9651,
23748,
1347,
363,
4133,
2582,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
463,
29879,
29918,
2541,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
1546,
29898,
1311,
29892,
4482,
29892,
1880,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
3464,
313,
262,
7009,
573,
29897,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4482,
584,
3139,
13,
9651,
17511,
1095,
310,
278,
3464,
13,
4706,
1880,
584,
3139,
13,
9651,
5057,
1095,
310,
278,
3464,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
14811,
29898,
13,
9651,
304,
29918,
7099,
3039,
29898,
677,
511,
13,
9651,
304,
29918,
7099,
3039,
29898,
9812,
511,
13,
4706,
1723,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
1837,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
4770,
4141,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
4141,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
4770,
479,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
29887,
371,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
4770,
1896,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
1896,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
4770,
280,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
1583,
3032,
1972,
29918,
1853,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
29880,
371,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
5352,
29918,
1853,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
5352,
1134,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
995,
584,
851,
13,
9651,
11374,
363,
263,
22554,
29877,
4051,
5352,
1134,
313,
29872,
29889,
29887,
29889,
376,
29940,
29908,
363,
9681,
29897,
13,
4706,
9995,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
12715,
29918,
1853,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
3743,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
8393,
393,
526,
22637,
322,
1712,
278,
3646,
13,
4706,
995,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1819,
584,
3139,
13,
9651,
7867,
1818,
1712,
445,
2944,
13,
4706,
9995,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
11516,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
4864,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
10379,
310,
385,
5352,
13,
4706,
9995,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
9933,
580,
13,
13,
1678,
822,
297,
23538,
1311,
29892,
1819,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
10379,
297,
263,
731,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1819,
584,
1051,
310,
3139,
13,
9651,
2178,
20937,
1819,
310,
4133,
2582,
13,
4706,
9995,
13,
4706,
297,
29918,
5975,
353,
518,
517,
29918,
7099,
3039,
29898,
1767,
29897,
363,
995,
297,
1819,
29962,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
275,
29918,
262,
29898,
262,
29918,
5975,
29897,
13,
13,
1678,
822,
4770,
484,
12035,
1311,
29892,
995,
1125,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
484,
29898,
517,
29918,
7099,
3039,
29898,
1767,
876,
13,
13,
1678,
822,
451,
29918,
9933,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
19916,
2582,
491,
1661,
29899,
735,
11416,
310,
385,
5352,
13,
4706,
9995,
13,
4706,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
1333,
29918,
9933,
580,
13,
13,
1678,
822,
2159,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
19916,
491,
2159,
310,
263,
4333,
13,
4706,
9995,
13,
4706,
736,
21179,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
29897,
13,
13,
1678,
396,
11474,
10318,
12241,
11474,
13,
13,
1678,
822,
731,
29898,
1311,
29892,
4603,
1125,
13,
4706,
9995,
13,
4706,
3789,
385,
5352,
304,
263,
716,
995,
29889,
13,
4706,
2994,
3636,
29879,
304,
11368,
408,
760,
310,
278,
2767,
4603,
297,
13,
4706,
4954,
3562,
29889,
5504,
29918,
667,
29952,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4603,
584,
10318,
7094,
392,
13,
9651,
1570,
995,
29892,
470,
385,
4603,
16184,
263,
716,
995,
13,
4706,
9995,
13,
4706,
736,
3789,
26486,
29898,
1311,
29892,
10318,
7094,
392,
29898,
17471,
876,
13,
13,
1678,
822,
3349,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
15154,
385,
5352,
29889,
13,
4706,
2994,
3636,
29879,
304,
5195,
6720,
12064,
408,
760,
310,
278,
2767,
4603,
297,
13,
4706,
4954,
3562,
29889,
5504,
29918,
667,
29952,
1412,
13,
4706,
9995,
13,
4706,
736,
15154,
26486,
29898,
1311,
29897,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
4603,
1125,
13,
4706,
9995,
13,
4706,
3462,
304,
385,
5352,
313,
8058,
936,
788,
470,
6124,
304,
263,
731,
467,
13,
4706,
2994,
3636,
29879,
304,
27827,
408,
760,
310,
278,
2767,
4603,
297,
13,
4706,
4954,
3562,
29889,
5504,
29918,
667,
29952,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4603,
584,
10318,
7094,
392,
13,
9651,
7865,
304,
788,
13,
4706,
9995,
13,
4706,
736,
3462,
26486,
29898,
1311,
29892,
10318,
7094,
392,
29898,
17471,
876,
13,
13,
1678,
822,
5217,
29898,
1311,
29892,
4603,
1125,
13,
4706,
9995,
13,
4706,
21267,
760,
310,
263,
731,
5352,
29889,
13,
4706,
2994,
3636,
29879,
304,
5012,
18476,
408,
760,
310,
278,
2767,
4603,
297,
13,
4706,
4954,
3562,
29889,
5504,
29918,
667,
29952,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4603,
584,
10318,
7094,
392,
13,
9651,
7865,
304,
5217,
13,
4706,
9995,
13,
4706,
736,
21267,
26486,
29898,
1311,
29892,
10318,
7094,
392,
29898,
17471,
876,
13,
13,
1678,
822,
4770,
1202,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
422,
26062,
7094,
392,
29898,
6422,
7094,
392,
29898,
1311,
511,
10318,
7094,
392,
29898,
1228,
511,
15691,
1159,
13,
13,
1678,
822,
4770,
1491,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
422,
26062,
7094,
392,
29898,
6422,
7094,
392,
29898,
1311,
511,
10318,
7094,
392,
29898,
1228,
511,
11663,
1159,
13,
13,
1678,
822,
4770,
29878,
1202,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
422,
26062,
7094,
392,
29898,
6422,
7094,
392,
29898,
1228,
511,
10318,
7094,
392,
29898,
1311,
511,
15691,
1159,
13,
13,
1678,
822,
4770,
29878,
1491,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
422,
26062,
7094,
392,
29898,
6422,
7094,
392,
29898,
1228,
511,
10318,
7094,
392,
29898,
1311,
511,
11663,
1159,
13,
13,
1678,
822,
565,
29918,
1333,
29918,
9933,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
11790,
17658,
736,
263,
995,
565,
445,
5352,
1838,
29915,
29873,
1863,
373,
278,
13,
4706,
1904,
13,
4706,
9995,
13,
4706,
736,
960,
3664,
24217,
7094,
392,
29898,
6422,
7094,
392,
29898,
1311,
511,
10318,
7094,
392,
29898,
1767,
876,
13,
13,
13,
1990,
7670,
29898,
5160,
6708,
1125,
13,
1678,
9995,
13,
1678,
501,
8485,
304,
4529,
322,
2346,
6608,
322,
2656,
1820,
8393,
373,
263,
4292,
10396,
1591,
13,
1678,
848,
1904,
13,
1678,
9995,
13,
13,
1678,
903,
1972,
29918,
1853,
353,
350,
3747,
2558,
13,
13,
13,
1990,
2180,
509,
29898,
5160,
6708,
1125,
13,
1678,
9995,
13,
1678,
501,
8485,
304,
4529,
322,
2346,
1661,
29899,
1989,
8393,
373,
263,
4292,
10396,
1591,
848,
1904,
13,
1678,
9995,
13,
13,
1678,
903,
1972,
29918,
1853,
353,
350,
3747,
25098,
13,
13,
13,
1753,
2159,
29918,
1972,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
1678,
736,
350,
3747,
25098,
29898,
1311,
3032,
1450,
303,
262,
29918,
978,
467,
2311,
580,
13,
13,
13,
1990,
21179,
29898,
5160,
6708,
1125,
13,
1678,
903,
1972,
29918,
1853,
353,
2159,
29918,
1972,
13,
13,
13,
1990,
22554,
29877,
3195,
19346,
29898,
1853,
1125,
13,
1678,
822,
4770,
657,
12715,
12035,
1311,
29892,
1024,
1125,
13,
4706,
12421,
353,
2428,
2141,
1649,
657,
12715,
12035,
978,
29897,
13,
4706,
565,
338,
8758,
29898,
5552,
29892,
7399,
6708,
1125,
13,
9651,
12421,
3032,
978,
29918,
265,
29918,
4299,
353,
1024,
13,
9651,
736,
12421,
13,
4706,
1683,
29901,
13,
9651,
736,
12421,
13,
13,
1678,
822,
903,
29881,
2926,
10396,
29918,
15697,
29898,
1311,
1125,
13,
4706,
1121,
353,
426,
13,
9651,
679,
5552,
29898,
1311,
29892,
12421,
467,
29918,
1450,
303,
262,
29918,
978,
29901,
12421,
13,
9651,
363,
12421,
297,
4516,
29898,
1311,
29897,
13,
9651,
565,
338,
8758,
29898,
657,
5552,
29898,
1311,
29892,
12421,
511,
7399,
6708,
29897,
13,
4706,
500,
13,
4706,
736,
1121,
13,
13,
1678,
822,
903,
657,
29918,
19290,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
476,
29893,
5085,
393,
881,
367,
4502,
304,
2346,
29892,
12812,
29892,
679,
29918,
667,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
3579,
1311,
3032,
29881,
2926,
29877,
29918,
771,
6929,
3285,
13,
9651,
3579,
1311,
3032,
2248,
29918,
19290,
3285,
13,
4706,
500,
13,
13,
1678,
822,
903,
29881,
2926,
29877,
29918,
771,
6929,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
6212,
5026,
304,
2009,
746,
5663,
15387,
848,
515,
22554,
29877,
4051,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
13,
9651,
9049,
5085,
304,
367,
4502,
304,
22554,
29877,
4051,
679,
5352,
5717,
304,
5703,
13,
9651,
263,
18246,
4603,
322,
2058,
8948,
414,
13,
4706,
9995,
13,
4706,
2058,
8948,
414,
353,
426,
13,
9651,
12305,
29908,
718,
851,
29898,
25118,
29889,
25118,
29946,
3101,
7503,
29947,
5387,
995,
13,
9651,
363,
995,
297,
1583,
3032,
29881,
2926,
10396,
29918,
15697,
2141,
8149,
580,
13,
4706,
500,
13,
4706,
4603,
353,
9162,
11393,
7122,
29898,
6689,
8948,
414,
29889,
8149,
3101,
13,
4706,
736,
9657,
29898,
13,
9651,
1019,
6929,
10960,
29922,
17471,
29892,
13,
9651,
21444,
6708,
8659,
29922,
6689,
8948,
414,
29892,
13,
4706,
1723,
13,
13,
1678,
822,
903,
2248,
29918,
19290,
29898,
1311,
1125,
13,
4706,
565,
756,
5552,
29898,
1311,
29892,
11119,
2248,
29918,
978,
27508,
1125,
13,
9651,
736,
9657,
29898,
13,
18884,
11374,
1170,
29922,
1311,
3032,
2248,
29918,
978,
3383,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
736,
6571,
13,
13,
13,
1990,
22554,
29877,
3195,
29898,
2527,
562,
605,
29922,
29928,
2926,
29877,
3195,
19346,
1125,
13,
1678,
9995,
13,
1678,
4134,
16184,
385,
6323,
29924,
1904,
363,
263,
22554,
29877,
4051,
1591,
29889,
13,
13,
1678,
3323,
13203,
1818,
505,
263,
4954,
29918,
2371,
29918,
978,
29918,
16159,
5352,
29889,
6212,
5026,
3907,
701,
13,
1678,
278,
848,
1904,
881,
367,
2180,
509,
470,
7670,
8871,
29889,
13,
13,
1678,
3323,
13203,
15783,
18111,
881,
884,
505,
385,
4954,
29918,
2248,
29918,
978,
29918,
16159,
13,
1678,
5352,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3579,
19290,
584,
9657,
310,
313,
710,
29892,
3139,
29897,
13,
9651,
17250,
2133,
310,
2180,
509,
322,
7670,
8393,
29889,
13,
4706,
9995,
13,
4706,
1904,
29918,
5552,
29879,
353,
1134,
29898,
1311,
467,
29918,
29881,
2926,
10396,
29918,
15697,
2141,
5975,
580,
13,
13,
4706,
363,
1024,
297,
1904,
29918,
5552,
29879,
29901,
13,
9651,
731,
5552,
29898,
1311,
29892,
1024,
29892,
6058,
29918,
10490,
29897,
13,
13,
4706,
363,
1024,
29892,
995,
297,
9049,
5085,
29889,
7076,
7295,
13,
9651,
565,
1024,
451,
297,
1904,
29918,
5552,
29879,
29901,
13,
18884,
10191,
353,
285,
29908,
29912,
1853,
29898,
1311,
20198,
29878,
29913,
756,
694,
5352,
426,
978,
29991,
29878,
5038,
13,
18884,
12020,
23833,
2392,
29898,
7645,
29897,
13,
9651,
731,
5552,
29898,
1311,
29892,
1024,
29892,
995,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
16964,
6646,
29898,
25932,
29892,
848,
1125,
13,
4706,
9995,
13,
4706,
2726,
261,
6646,
4663,
964,
263,
22554,
29877,
3195,
19481,
29889,
2422,
635,
29436,
13,
4706,
3826,
3039,
304,
5785,
297,
278,
16964,
616,
2133,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
848,
584,
9657,
310,
313,
710,
29892,
3139,
29897,
13,
9651,
18896,
1891,
1904,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
22554,
29877,
3195,
13,
9651,
450,
16964,
616,
1891,
848,
1904,
13,
4706,
9995,
13,
4706,
1904,
29918,
5552,
29879,
353,
1067,
29879,
3032,
29881,
2926,
10396,
29918,
15697,
580,
13,
13,
4706,
1121,
353,
1067,
29879,
580,
13,
13,
4706,
363,
12421,
297,
1904,
29918,
5552,
29879,
29889,
5975,
7295,
13,
9651,
731,
5552,
29898,
2914,
29892,
12421,
29892,
6058,
29918,
10490,
29897,
13,
13,
4706,
363,
4833,
29918,
5552,
29892,
995,
297,
848,
29889,
7076,
7295,
13,
9651,
565,
4833,
29918,
5552,
297,
1904,
29918,
5552,
29879,
29889,
8149,
7295,
13,
18884,
565,
1134,
29898,
1767,
29897,
297,
518,
1761,
29892,
731,
29892,
18761,
5387,
13,
462,
1678,
995,
353,
1134,
29898,
1767,
5033,
3166,
29918,
7099,
3039,
29898,
29894,
29897,
363,
325,
297,
995,
29897,
13,
18884,
25342,
1134,
29898,
1767,
29897,
338,
9657,
29901,
13,
462,
1678,
995,
353,
426,
3166,
29918,
7099,
3039,
29898,
29895,
1125,
515,
29918,
7099,
3039,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
995,
29889,
7076,
28296,
13,
18884,
1683,
29901,
13,
462,
1678,
995,
353,
515,
29918,
7099,
3039,
29898,
1767,
29897,
13,
18884,
731,
5552,
29898,
2914,
29892,
1904,
29918,
5552,
29879,
29961,
2585,
29918,
5552,
1402,
995,
29897,
13,
13,
4706,
736,
1121,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
1816,
6646,
263,
22554,
29877,
3195,
19481,
304,
4663,
393,
508,
367,
15478,
964,
13,
4706,
22554,
29877,
4051,
29889,
2422,
635,
29436,
5785,
304,
3826,
3039,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
310,
313,
710,
29892,
3139,
29897,
13,
9651,
450,
7797,
1891,
4663,
6251,
13,
4706,
9995,
13,
4706,
1904,
29918,
5552,
29879,
353,
1134,
29898,
1311,
467,
29918,
29881,
2926,
10396,
29918,
15697,
580,
13,
13,
4706,
1121,
353,
6571,
13,
13,
4706,
363,
4292,
29877,
29918,
978,
29892,
1904,
29918,
978,
297,
1904,
29918,
5552,
29879,
29889,
7076,
7295,
13,
9651,
995,
353,
679,
5552,
29898,
1311,
29892,
1904,
29918,
978,
29897,
13,
9651,
565,
995,
338,
451,
6058,
29918,
10490,
29901,
13,
18884,
565,
1134,
29898,
1767,
29897,
297,
518,
1761,
29892,
731,
29892,
18761,
5387,
13,
462,
1678,
995,
353,
1134,
29898,
1767,
5033,
517,
29918,
7099,
3039,
29898,
29894,
29897,
363,
325,
297,
995,
29897,
13,
18884,
25342,
1134,
29898,
1767,
29897,
338,
9657,
29901,
13,
462,
1678,
995,
353,
426,
517,
29918,
7099,
3039,
29898,
29895,
1125,
304,
29918,
7099,
3039,
29898,
29894,
29897,
363,
413,
29892,
325,
297,
995,
29889,
7076,
28296,
13,
18884,
1683,
29901,
13,
462,
1678,
995,
353,
304,
29918,
7099,
3039,
29898,
1767,
29897,
13,
18884,
1121,
29961,
29881,
2926,
29877,
29918,
978,
29962,
353,
995,
13,
13,
4706,
736,
1121,
13,
13,
13,
29937,
23250,
10318,
6607,
4097,
13,
13,
13,
1990,
10318,
26486,
29898,
19658,
1125,
13,
1678,
9995,
13,
1678,
319,
8954,
310,
385,
10318,
2001,
4603,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
392,
12035,
1311,
29892,
916,
1125,
13,
4706,
9995,
13,
4706,
422,
26062,
1023,
2767,
12241,
13,
4706,
9995,
13,
4706,
736,
422,
26062,
26486,
29898,
1311,
29892,
916,
29897,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2767,
29918,
17471,
29898,
5504,
29918,
8977,
1125,
13,
4706,
12241,
353,
5159,
13,
13,
4706,
363,
5858,
297,
376,
10490,
613,
376,
17744,
613,
376,
2287,
18476,
613,
376,
1525,
6720,
12064,
1115,
13,
9651,
565,
2767,
29918,
8977,
29889,
657,
29898,
16453,
1125,
13,
18884,
12241,
29889,
4397,
29898,
16453,
718,
376,
376,
718,
9162,
11393,
7122,
29898,
5504,
29918,
8977,
29961,
16453,
12622,
13,
13,
4706,
736,
376,
11393,
7122,
29898,
17073,
1080,
29897,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
7138,
346,
9049,
5085,
304,
367,
4502,
304,
22554,
29877,
4051,
6137,
29889,
5504,
29918,
667,
29889,
13,
13,
4706,
4813,
952,
322,
1819,
526,
29901,
13,
9651,
376,
6422,
10960,
1115,
1347,
15783,
278,
2767,
4603,
13,
9651,
376,
10960,
6708,
8659,
1115,
15484,
7694,
2910,
363,
5352,
2983,
13,
9651,
376,
10960,
6708,
9065,
1115,
15484,
7694,
2910,
363,
5352,
1819,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
9657,
13,
9651,
476,
29893,
5085,
363,
2767,
29918,
667,
13,
4706,
9995,
13,
4706,
2767,
29918,
8977,
353,
1583,
29889,
5504,
29918,
8977,
580,
13,
4706,
1121,
353,
426,
13,
9651,
376,
6422,
10960,
1115,
1583,
29889,
5504,
29918,
17471,
29898,
5504,
29918,
8977,
511,
13,
4706,
500,
13,
4706,
565,
2767,
29918,
8977,
3366,
10960,
6708,
8659,
3108,
29901,
13,
9651,
1121,
3366,
10960,
6708,
8659,
3108,
353,
2767,
29918,
8977,
3366,
10960,
6708,
8659,
3108,
13,
4706,
565,
2767,
29918,
8977,
3366,
10960,
6708,
9065,
3108,
29901,
13,
9651,
1121,
3366,
10960,
6708,
9065,
3108,
353,
2767,
29918,
8977,
29961,
13,
18884,
376,
10960,
6708,
9065,
29908,
13,
9651,
4514,
13,
4706,
736,
1121,
13,
13,
13,
1990,
422,
26062,
26486,
29898,
6422,
26486,
1125,
13,
1678,
9995,
13,
1678,
422,
26062,
1023,
2767,
12241,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2175,
29892,
1492,
1125,
13,
4706,
1583,
29889,
1563,
353,
2175,
13,
4706,
1583,
29889,
1266,
353,
1492,
13,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
1121,
353,
2322,
8977,
29898,
1761,
29897,
13,
4706,
724,
29918,
1563,
353,
1583,
29889,
1563,
29889,
5504,
29918,
8977,
580,
13,
4706,
724,
29918,
1266,
353,
1583,
29889,
1266,
29889,
5504,
29918,
8977,
580,
13,
13,
4706,
4452,
353,
1051,
29898,
643,
29918,
1563,
29889,
7076,
3101,
718,
1051,
29898,
643,
29918,
1266,
29889,
7076,
3101,
13,
4706,
363,
1820,
29892,
1819,
297,
4452,
29901,
13,
9651,
565,
1820,
297,
6796,
10490,
613,
376,
17744,
613,
376,
2287,
18476,
613,
376,
1525,
6720,
12064,
3108,
29901,
13,
18884,
1121,
29961,
1989,
1822,
21843,
29898,
5975,
29897,
13,
13,
4706,
1121,
3366,
10960,
6708,
8659,
3108,
353,
9657,
29898,
13,
9651,
3579,
643,
29918,
1563,
3366,
10960,
6708,
8659,
12436,
13,
9651,
3579,
643,
29918,
1266,
3366,
10960,
6708,
8659,
12436,
13,
4706,
1723,
13,
4706,
1121,
3366,
10960,
6708,
9065,
3108,
353,
9657,
29898,
13,
9651,
3579,
643,
29918,
1563,
3366,
10960,
6708,
9065,
12436,
13,
9651,
3579,
643,
29918,
1266,
3366,
10960,
6708,
9065,
12436,
13,
4706,
1723,
13,
13,
4706,
736,
1121,
13,
13,
13,
1990,
3789,
26486,
29898,
6422,
26486,
1125,
13,
1678,
9995,
13,
1678,
18601,
363,
11368,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12421,
29892,
1751,
392,
1125,
13,
4706,
1583,
29889,
5552,
353,
12421,
13,
4706,
1583,
29889,
3372,
392,
353,
1751,
392,
13,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
7797,
1891,
29918,
5552,
353,
2944,
675,
29918,
5552,
29898,
1311,
29889,
5552,
29897,
13,
4706,
7797,
1891,
29918,
3372,
392,
353,
1583,
29889,
3372,
392,
29889,
643,
6646,
580,
13,
13,
4706,
5352,
29918,
7039,
353,
9657,
29898,
13,
9651,
3579,
15550,
1891,
29918,
3372,
392,
3366,
10960,
6708,
8659,
12436,
13,
9651,
3579,
15550,
1891,
29918,
5552,
3366,
10960,
6708,
8659,
12436,
13,
4706,
1723,
13,
4706,
736,
426,
13,
9651,
376,
10490,
1115,
518,
13,
18884,
285,
29908,
29912,
15550,
1891,
29918,
5552,
1839,
6422,
10960,
2033,
29913,
353,
376,
13,
18884,
718,
7797,
1891,
29918,
3372,
392,
3366,
6422,
10960,
3108,
13,
9651,
21251,
13,
9651,
376,
10960,
6708,
8659,
1115,
5352,
29918,
7039,
29892,
13,
9651,
376,
10960,
6708,
9065,
1115,
7797,
1891,
29918,
3372,
392,
29961,
13,
18884,
376,
10960,
6708,
9065,
29908,
13,
9651,
21251,
13,
4706,
500,
13,
13,
13,
1990,
3462,
26486,
29898,
6422,
26486,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12421,
29892,
1751,
392,
1125,
13,
4706,
1583,
29889,
5552,
353,
12421,
13,
4706,
1583,
29889,
3372,
392,
353,
1751,
392,
13,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
7797,
1891,
29918,
5552,
353,
2944,
675,
29918,
5552,
29898,
1311,
29889,
5552,
29897,
13,
4706,
7797,
1891,
29918,
3372,
392,
353,
1583,
29889,
3372,
392,
29889,
643,
6646,
580,
13,
13,
4706,
5352,
29918,
7039,
353,
9657,
29898,
13,
9651,
3579,
15550,
1891,
29918,
3372,
392,
3366,
10960,
6708,
8659,
12436,
13,
9651,
3579,
15550,
1891,
29918,
5552,
3366,
10960,
6708,
8659,
12436,
13,
4706,
1723,
13,
4706,
736,
426,
13,
9651,
376,
17744,
1115,
518,
13,
18884,
285,
29908,
29912,
15550,
1891,
29918,
5552,
1839,
6422,
10960,
2033,
29913,
376,
13,
18884,
718,
7797,
1891,
29918,
3372,
392,
3366,
6422,
10960,
3108,
13,
9651,
21251,
13,
9651,
376,
10960,
6708,
8659,
1115,
5352,
29918,
7039,
29892,
13,
9651,
376,
10960,
6708,
9065,
1115,
7797,
1891,
29918,
3372,
392,
29961,
13,
18884,
376,
10960,
6708,
9065,
29908,
13,
9651,
21251,
13,
4706,
500,
13,
13,
13,
1990,
15154,
26486,
29898,
6422,
26486,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12421,
1125,
13,
4706,
1583,
29889,
5552,
353,
12421,
13,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
7797,
1891,
29918,
5552,
353,
2944,
675,
29918,
5552,
29898,
1311,
29889,
5552,
29897,
13,
13,
4706,
736,
426,
13,
9651,
376,
1525,
6720,
12064,
1115,
518,
15550,
1891,
29918,
5552,
3366,
6422,
10960,
3108,
1402,
13,
9651,
376,
10960,
6708,
8659,
1115,
7797,
1891,
29918,
5552,
3366,
10960,
6708,
8659,
12436,
13,
9651,
376,
10960,
6708,
9065,
1115,
24335,
13,
4706,
500,
13,
13,
13,
1990,
21267,
26486,
29898,
6422,
26486,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12421,
29892,
1751,
392,
1125,
13,
4706,
1583,
29889,
5552,
353,
12421,
13,
4706,
1583,
29889,
3372,
392,
353,
1751,
392,
13,
13,
1678,
822,
2767,
29918,
8977,
29898,
1311,
1125,
13,
4706,
7797,
1891,
29918,
5552,
353,
2944,
675,
29918,
5552,
29898,
1311,
29889,
5552,
29897,
13,
4706,
7797,
1891,
29918,
3372,
392,
353,
1583,
29889,
3372,
392,
29889,
643,
6646,
580,
13,
13,
4706,
5352,
29918,
7039,
353,
9657,
29898,
13,
9651,
3579,
15550,
1891,
29918,
3372,
392,
3366,
10960,
6708,
8659,
12436,
13,
9651,
3579,
15550,
1891,
29918,
5552,
3366,
10960,
6708,
8659,
12436,
13,
4706,
1723,
13,
4706,
736,
426,
13,
9651,
376,
2287,
18476,
1115,
518,
13,
18884,
285,
29908,
29912,
15550,
1891,
29918,
5552,
1839,
6422,
10960,
2033,
29913,
376,
13,
18884,
718,
7797,
1891,
29918,
3372,
392,
3366,
6422,
10960,
3108,
13,
9651,
21251,
13,
9651,
376,
10960,
6708,
8659,
1115,
5352,
29918,
7039,
29892,
13,
9651,
376,
10960,
6708,
9065,
1115,
7797,
1891,
29918,
3372,
392,
29961,
13,
18884,
376,
10960,
6708,
9065,
29908,
13,
9651,
21251,
13,
4706,
500,
13,
13,
13,
29937,
23250,
10318,
6607,
4167,
13,
13,
13,
1753,
28755,
29918,
3372,
392,
29898,
1767,
1125,
13,
1678,
1024,
353,
851,
29898,
25118,
29889,
25118,
29946,
3101,
7503,
29947,
29962,
13,
13,
1678,
565,
338,
8758,
29898,
1767,
29892,
10318,
7094,
392,
1125,
13,
4706,
736,
995,
29889,
643,
6646,
580,
13,
1678,
25342,
338,
8758,
29898,
1767,
29892,
7399,
6708,
1125,
13,
4706,
736,
2944,
675,
29918,
5552,
29898,
1767,
29897,
13,
1678,
25342,
1134,
29898,
1767,
29897,
297,
518,
1761,
29892,
731,
29892,
18761,
5387,
13,
4706,
1024,
353,
376,
6160,
718,
1024,
13,
13,
4706,
995,
353,
1134,
29898,
1767,
29897,
4197,
517,
29918,
7099,
3039,
29898,
29894,
29897,
363,
325,
297,
995,
2314,
13,
13,
4706,
736,
426,
13,
9651,
376,
6422,
10960,
1115,
1024,
29892,
13,
9651,
376,
10960,
6708,
8659,
1115,
24335,
13,
9651,
376,
10960,
6708,
9065,
1115,
426,
978,
29901,
995,
1118,
13,
4706,
500,
13,
1678,
1683,
29901,
13,
4706,
1024,
353,
376,
6160,
718,
1024,
13,
4706,
736,
426,
13,
9651,
376,
6422,
10960,
1115,
1024,
29892,
13,
9651,
376,
10960,
6708,
8659,
1115,
24335,
13,
9651,
376,
10960,
6708,
9065,
1115,
426,
978,
29901,
304,
29918,
7099,
3039,
29898,
1767,
19230,
13,
4706,
500,
13,
13,
13,
1753,
2944,
675,
29918,
5552,
29898,
5552,
1125,
13,
1678,
396,
922,
862,
403,
18111,
13,
1678,
5633,
353,
5159,
13,
13,
1678,
1857,
29918,
2042,
353,
5124,
13,
1678,
363,
5497,
297,
12421,
3032,
1450,
303,
262,
29918,
978,
29901,
13,
4706,
565,
5497,
1275,
14704,
1115,
13,
9651,
5633,
29889,
4397,
29898,
3784,
29918,
2042,
29897,
13,
9651,
1857,
29918,
2042,
353,
376,
3366,
13,
4706,
25342,
5497,
1275,
376,
29962,
1115,
13,
9651,
5633,
29889,
4397,
29898,
3784,
29918,
2042,
718,
376,
29962,
1159,
13,
9651,
1857,
29918,
2042,
353,
5124,
13,
4706,
1683,
29901,
13,
9651,
1857,
29918,
2042,
4619,
5497,
13,
1678,
565,
1857,
29918,
2042,
29901,
13,
4706,
5633,
29889,
4397,
29898,
3784,
29918,
2042,
29897,
13,
13,
1678,
7797,
1891,
353,
5124,
13,
1678,
1024,
29918,
1958,
353,
6571,
13,
13,
1678,
396,
922,
862,
403,
8393,
13,
1678,
363,
760,
297,
5633,
29901,
13,
4706,
565,
376,
3366,
297,
760,
322,
376,
18017,
297,
760,
29901,
13,
9651,
7797,
1891,
4619,
760,
13,
4706,
1683,
29901,
13,
9651,
565,
760,
29889,
27382,
2541,
703,
1213,
1125,
13,
18884,
7797,
1891,
4619,
376,
1213,
13,
18884,
760,
353,
760,
29961,
29896,
17531,
13,
9651,
13926,
353,
760,
29889,
5451,
17350,
1159,
13,
9651,
7797,
1891,
29918,
27117,
353,
5159,
13,
13,
9651,
363,
4004,
297,
13926,
29901,
13,
18884,
1024,
353,
12305,
29908,
718,
851,
29898,
25118,
29889,
25118,
29946,
3101,
7503,
29947,
29962,
13,
18884,
1024,
29918,
1958,
29961,
978,
29962,
353,
4004,
13,
18884,
7797,
1891,
29918,
27117,
29889,
4397,
29898,
978,
29897,
13,
9651,
7797,
1891,
4619,
376,
1213,
29889,
7122,
29898,
15550,
1891,
29918,
27117,
29897,
13,
13,
1678,
1121,
353,
426,
13,
4706,
376,
6422,
10960,
1115,
7797,
1891,
29892,
13,
4706,
376,
10960,
6708,
8659,
1115,
1024,
29918,
1958,
29892,
13,
4706,
376,
10960,
6708,
9065,
1115,
24335,
13,
1678,
500,
13,
1678,
736,
1121,
13,
13,
13,
1990,
10318,
7094,
392,
29901,
13,
1678,
9995,
13,
1678,
25665,
760,
310,
385,
2767,
4603,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
995,
1125,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
736,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1767,
29897,
13,
13,
13,
1990,
422,
26062,
7094,
392,
29898,
6422,
7094,
392,
1125,
13,
1678,
9995,
13,
1678,
3462,
470,
12059,
627,
1023,
12241,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2175,
29892,
1492,
29892,
5829,
1125,
13,
4706,
1583,
29889,
1563,
353,
2175,
13,
4706,
1583,
29889,
1266,
353,
1492,
13,
4706,
1583,
29889,
18098,
353,
5829,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
724,
29918,
1563,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1563,
29897,
13,
4706,
724,
29918,
1266,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1266,
29897,
13,
13,
4706,
4603,
353,
313,
13,
9651,
285,
29908,
29912,
643,
29918,
1563,
1839,
6422,
10960,
2033,
29913,
376,
13,
9651,
285,
29908,
29912,
1311,
29889,
18098,
29913,
376,
13,
9651,
285,
29908,
29912,
643,
29918,
1266,
1839,
6422,
10960,
2033,
5038,
13,
4706,
1723,
13,
13,
4706,
736,
426,
13,
9651,
376,
6422,
10960,
1115,
4603,
29892,
13,
9651,
376,
10960,
6708,
8659,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
1563,
3366,
10960,
6708,
8659,
12436,
13,
18884,
3579,
643,
29918,
1266,
3366,
10960,
6708,
8659,
12436,
13,
9651,
10353,
13,
9651,
376,
10960,
6708,
9065,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
1563,
3366,
10960,
6708,
9065,
12436,
13,
18884,
3579,
643,
29918,
1266,
3366,
10960,
6708,
9065,
12436,
13,
9651,
10353,
13,
4706,
500,
13,
13,
13,
1990,
960,
3664,
24217,
7094,
392,
29898,
6422,
7094,
392,
1125,
13,
1678,
9995,
13,
1678,
3789,
263,
995,
565,
278,
2183,
5352,
947,
451,
1863,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12421,
29892,
995,
1125,
13,
4706,
1583,
29889,
5552,
353,
12421,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
724,
29918,
5552,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
5552,
29897,
13,
4706,
724,
29918,
1767,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1767,
29897,
13,
13,
4706,
4603,
353,
313,
13,
9651,
285,
29908,
361,
29918,
1333,
29918,
9933,
3319,
643,
29918,
5552,
1839,
6422,
10960,
2033,
1118,
376,
13,
9651,
285,
29908,
29912,
643,
29918,
1767,
1839,
6422,
10960,
2033,
1800,
29908,
13,
4706,
1723,
13,
13,
4706,
736,
426,
13,
9651,
376,
6422,
10960,
1115,
4603,
29892,
13,
9651,
376,
10960,
6708,
8659,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
5552,
3366,
10960,
6708,
8659,
12436,
13,
18884,
3579,
643,
29918,
1767,
3366,
10960,
6708,
8659,
12436,
13,
9651,
10353,
13,
9651,
376,
10960,
6708,
9065,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
5552,
3366,
10960,
6708,
9065,
12436,
13,
18884,
3579,
643,
29918,
1767,
3366,
10960,
6708,
9065,
12436,
13,
9651,
10353,
13,
4706,
500,
13,
13,
13,
1990,
2391,
18277,
7094,
392,
29898,
6422,
7094,
392,
1125,
13,
1678,
9995,
13,
1678,
422,
26062,
1023,
8857,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2175,
29892,
1492,
1125,
13,
4706,
1583,
29889,
1563,
353,
2175,
13,
4706,
1583,
29889,
1266,
353,
1492,
13,
13,
1678,
822,
28755,
29898,
1311,
1125,
13,
4706,
724,
29918,
1563,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1563,
29897,
13,
4706,
724,
29918,
1266,
353,
28755,
29918,
3372,
392,
29898,
1311,
29889,
1266,
29897,
13,
13,
4706,
4603,
353,
313,
13,
9651,
285,
29908,
1761,
29918,
4397,
3319,
643,
29918,
1563,
1839,
6422,
10960,
2033,
1118,
376,
13,
9651,
285,
29908,
29912,
643,
29918,
1266,
1839,
6422,
10960,
2033,
1800,
29908,
13,
4706,
1723,
13,
13,
4706,
736,
426,
13,
9651,
376,
6422,
10960,
1115,
4603,
29892,
13,
9651,
376,
10960,
6708,
8659,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
1563,
3366,
10960,
6708,
8659,
12436,
13,
18884,
3579,
643,
29918,
1266,
3366,
10960,
6708,
8659,
12436,
13,
9651,
10353,
13,
9651,
376,
10960,
6708,
9065,
1115,
9657,
29898,
13,
18884,
3579,
643,
29918,
1563,
3366,
10960,
6708,
9065,
12436,
13,
18884,
3579,
643,
29918,
1266,
3366,
10960,
6708,
9065,
12436,
13,
9651,
10353,
13,
4706,
500,
13,
13,
13,
1753,
1051,
29918,
4397,
29898,
1563,
29892,
1492,
1125,
13,
1678,
9995,
13,
1678,
3789,
263,
995,
304,
278,
10296,
310,
1023,
8857,
297,
385,
2767,
4603,
13,
1678,
9995,
13,
1678,
736,
2391,
18277,
7094,
392,
29898,
6422,
7094,
392,
29898,
1563,
511,
10318,
7094,
392,
29898,
1266,
876,
13,
2
] |
tests/testapp/urls.py | matthiask/django-keyed-urls | 0 | 105180 | <reponame>matthiask/django-keyed-urls
from django.conf.urls import include, patterns, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += i18n_patterns(
'',
url(r'^ku/', include('keyed_urls.urls')),
)
| [
1,
529,
276,
1112,
420,
29958,
2922,
386,
29875,
1278,
29914,
14095,
29899,
1989,
287,
29899,
26045,
13,
3166,
9557,
29889,
5527,
29889,
26045,
1053,
3160,
29892,
15038,
29892,
3142,
13,
3166,
9557,
29889,
5527,
29889,
26045,
29889,
29875,
29896,
29947,
29876,
1053,
474,
29896,
29947,
29876,
29918,
11037,
29879,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
13,
13,
6406,
29889,
1300,
397,
10669,
957,
580,
13,
13,
13,
2271,
11037,
29879,
353,
15038,
29898,
13,
1678,
15516,
13,
1678,
3142,
29898,
29878,
29915,
29985,
6406,
29914,
742,
3160,
29898,
6406,
29889,
2746,
29889,
26045,
8243,
13,
29897,
13,
13,
2271,
11037,
29879,
4619,
474,
29896,
29947,
29876,
29918,
11037,
29879,
29898,
13,
1678,
15516,
13,
1678,
3142,
29898,
29878,
29915,
29985,
2120,
29914,
742,
3160,
877,
1989,
287,
29918,
26045,
29889,
26045,
1495,
511,
13,
29897,
13,
2
] |
LED2Net/Projection/Cube2Equirec.py | zhigangjiang/LED2-Net | 57 | 96369 | import os
import sys
import cv2
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import scipy.misc as sic
class Cube2Equirec(nn.Module):
def __init__(self, cube_length, equ_h):
super().__init__()
self.cube_length = cube_length
self.equ_h = equ_h
equ_w = equ_h * 2
self.equ_w = equ_w
theta = (np.arange(equ_w) / (equ_w-1) - 0.5) * 2 *np.pi
phi = (np.arange(equ_h) / (equ_h-1) - 0.5) * np.pi
theta, phi = np.meshgrid(theta, phi)
x = np.sin(theta) * np.cos(phi)
y = np.sin(phi)
z = np.cos(theta) * np.cos(phi)
xyz = np.concatenate([x[..., None], y[..., None], z[..., None]], axis=-1)
planes = np.asarray([
[0, 0, 1, 1], # z = -1
[0, 1, 0, -1], # y = 1
[0, 0, 1, -1], # z = 1
[1, 0, 0, 1], # x = -1
[1, 0, 0, -1], # x = 1
[0, 1, 0, 1] # y = -1
])
r_lst = np.array([
[0, 1, 0],
[0.5, 0, 0],
[0, 0, 0],
[0, 0.5, 0],
[0, -0.5, 0],
[-0.5, 0, 0]
]) * np.pi
f = cube_length / 2.0
self.K = np.array([
[f, 0, (cube_length-1)/2.0],
[0, f, (cube_length-1)/2.0],
[0, 0, 1]
])
self.R_lst = [cv2.Rodrigues(x)[0] for x in r_lst]
self.mask, self.XY = self._intersection(xyz, planes)
def forward(self, x, mode='bilinear'):
assert mode in ['nearest', 'bilinear']
assert x.shape[0] % 6 == 0
equ_count = x.shape[0] // 6
equi = torch.zeros(equ_count, x.shape[1], self.equ_h, self.equ_w).to(x.device)
for i in range(6):
now = x[i::6, ...]
mask = self.mask[i].to(x.device)
mask = mask[None, ...].repeat(equ_count, x.shape[1], 1, 1)
XY = (self.XY[i].to(x.device)[None, None, :, :].repeat(equ_count, 1, 1, 1) / (self.cube_length-1) - 0.5) * 2
sample = F.grid_sample(now, XY, mode=mode, align_corners=True)[..., 0, :]
equi[mask] = sample.view(-1)
return equi
def _intersection(self, xyz, planes):
abc = planes[:, :-1]
depth = -planes[:, 3][None, None, ...] / np.dot(xyz, abc.T)
depth[depth < 0] = np.inf
arg = np.argmin(depth, axis=-1)
depth = np.min(depth, axis=-1)
pts = depth[..., None] * xyz
mask_lst = []
mapping_XY = []
for i in range(6):
mask = arg == i
mask = np.tile(mask[..., None], [1, 1, 3])
XY = np.dot(np.dot(pts[mask].reshape([-1, 3]), self.R_lst[i].T), self.K.T)
XY = np.clip(XY[..., :2].copy() / XY[..., 2:], 0, self.cube_length-1)
mask_lst.append(mask[..., 0])
mapping_XY.append(XY)
mask_lst = [torch.BoolTensor(x) for x in mask_lst]
mapping_XY = [torch.FloatTensor(x) for x in mapping_XY]
return mask_lst, mapping_XY
if __name__ == '__main__':
import matplotlib.pyplot as plt
batch = torch.zeros(12, 3, 256, 256) + 20
c2e = Cube2Equirec(256, 512)
equi = c2e(batch)
plt.imshow(equi[0, ...].permute(1, 2, 0).cpu().numpy())
plt.show()
| [
1,
1053,
2897,
13,
5215,
10876,
13,
5215,
13850,
29906,
13,
5215,
5844,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
5215,
4560,
2272,
29889,
29885,
10669,
408,
24801,
13,
13,
1990,
315,
4003,
29906,
29923,
1548,
29883,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28704,
29918,
2848,
29892,
1592,
29918,
29882,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29883,
4003,
29918,
2848,
353,
28704,
29918,
2848,
13,
4706,
1583,
29889,
1686,
29918,
29882,
353,
1592,
29918,
29882,
13,
4706,
1592,
29918,
29893,
353,
1592,
29918,
29882,
334,
29871,
29906,
13,
4706,
1583,
29889,
1686,
29918,
29893,
353,
1592,
29918,
29893,
13,
4706,
278,
941,
353,
313,
9302,
29889,
279,
927,
29898,
1686,
29918,
29893,
29897,
847,
313,
1686,
29918,
29893,
29899,
29896,
29897,
448,
29871,
29900,
29889,
29945,
29897,
334,
29871,
29906,
334,
9302,
29889,
1631,
13,
4706,
1374,
29875,
353,
313,
9302,
29889,
279,
927,
29898,
1686,
29918,
29882,
29897,
847,
313,
1686,
29918,
29882,
29899,
29896,
29897,
448,
29871,
29900,
29889,
29945,
29897,
334,
7442,
29889,
1631,
13,
308,
13,
4706,
278,
941,
29892,
1374,
29875,
353,
7442,
29889,
4467,
29882,
7720,
29898,
3416,
29892,
1374,
29875,
29897,
13,
4706,
921,
353,
7442,
29889,
5223,
29898,
3416,
29897,
334,
7442,
29889,
3944,
29898,
2876,
29897,
13,
4706,
343,
353,
7442,
29889,
5223,
29898,
2876,
29897,
13,
4706,
503,
353,
7442,
29889,
3944,
29898,
3416,
29897,
334,
7442,
29889,
3944,
29898,
2876,
29897,
13,
4706,
921,
12339,
353,
7442,
29889,
535,
29883,
2579,
403,
4197,
29916,
29961,
16361,
6213,
1402,
343,
29961,
16361,
6213,
1402,
503,
29961,
16361,
6213,
20526,
9685,
10457,
29896,
29897,
13,
13,
4706,
3814,
267,
353,
7442,
29889,
294,
2378,
4197,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
259,
29896,
1402,
396,
503,
353,
448,
29896,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
448,
29896,
1402,
396,
343,
353,
259,
29896,
13,
462,
1678,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
448,
29896,
1402,
396,
503,
353,
259,
29896,
13,
462,
1678,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
259,
29896,
1402,
396,
921,
353,
448,
29896,
13,
462,
1678,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
448,
29896,
1402,
396,
921,
353,
259,
29896,
13,
462,
1678,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
259,
29896,
29962,
29871,
396,
343,
353,
448,
29896,
13,
462,
2314,
13,
4706,
364,
29918,
20155,
353,
7442,
29889,
2378,
4197,
13,
18884,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
18884,
518,
29900,
29889,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
18884,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
18884,
518,
29900,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
1402,
13,
18884,
518,
29900,
29892,
448,
29900,
29889,
29945,
29892,
29871,
29900,
1402,
13,
18884,
21069,
29900,
29889,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
632,
2314,
334,
7442,
29889,
1631,
13,
4706,
285,
353,
28704,
29918,
2848,
847,
29871,
29906,
29889,
29900,
13,
4706,
1583,
29889,
29968,
353,
7442,
29889,
2378,
4197,
13,
18884,
518,
29888,
29892,
29871,
29900,
29892,
313,
29883,
4003,
29918,
2848,
29899,
29896,
6802,
29906,
29889,
29900,
1402,
13,
18884,
518,
29900,
29892,
285,
29892,
313,
29883,
4003,
29918,
2848,
29899,
29896,
6802,
29906,
29889,
29900,
1402,
13,
18884,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29962,
13,
632,
2314,
13,
4706,
1583,
29889,
29934,
29918,
20155,
353,
518,
11023,
29906,
29889,
29934,
397,
8966,
1041,
29898,
29916,
9601,
29900,
29962,
363,
921,
297,
364,
29918,
20155,
29962,
13,
13,
4706,
1583,
29889,
13168,
29892,
1583,
29889,
18454,
353,
1583,
3032,
1639,
2042,
29898,
20230,
29892,
3814,
267,
29897,
13,
268,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
4464,
2433,
18152,
457,
279,
29374,
13,
4706,
4974,
4464,
297,
6024,
28502,
342,
742,
525,
18152,
457,
279,
2033,
13,
4706,
4974,
921,
29889,
12181,
29961,
29900,
29962,
1273,
29871,
29953,
1275,
29871,
29900,
13,
4706,
1592,
29918,
2798,
353,
921,
29889,
12181,
29961,
29900,
29962,
849,
29871,
29953,
13,
4706,
1592,
29875,
353,
4842,
305,
29889,
3298,
359,
29898,
1686,
29918,
2798,
29892,
921,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
1686,
29918,
29882,
29892,
1583,
29889,
1686,
29918,
29893,
467,
517,
29898,
29916,
29889,
10141,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29953,
1125,
13,
9651,
1286,
353,
921,
29961,
29875,
1057,
29953,
29892,
2023,
29962,
13,
9651,
11105,
353,
1583,
29889,
13168,
29961,
29875,
1822,
517,
29898,
29916,
29889,
10141,
29897,
13,
9651,
11105,
353,
11105,
29961,
8516,
29892,
2023,
1822,
14358,
29898,
1686,
29918,
2798,
29892,
921,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
29892,
29871,
29896,
29897,
13,
13,
9651,
1060,
29979,
353,
313,
1311,
29889,
18454,
29961,
29875,
1822,
517,
29898,
29916,
29889,
10141,
9601,
8516,
29892,
6213,
29892,
584,
29892,
584,
1822,
14358,
29898,
1686,
29918,
2798,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
847,
313,
1311,
29889,
29883,
4003,
29918,
2848,
29899,
29896,
29897,
448,
29871,
29900,
29889,
29945,
29897,
334,
29871,
29906,
13,
9651,
4559,
353,
383,
29889,
7720,
29918,
11249,
29898,
3707,
29892,
1060,
29979,
29892,
4464,
29922,
8513,
29892,
7595,
29918,
29883,
1398,
414,
29922,
5574,
9601,
16361,
29871,
29900,
29892,
584,
29962,
13,
9651,
1592,
29875,
29961,
13168,
29962,
353,
4559,
29889,
1493,
6278,
29896,
29897,
13,
13,
4706,
736,
1592,
29875,
13,
13,
1678,
822,
903,
1639,
2042,
29898,
1311,
29892,
921,
12339,
29892,
3814,
267,
1125,
13,
4706,
25638,
353,
3814,
267,
7503,
29892,
8956,
29896,
29962,
13,
308,
13,
4706,
10809,
353,
448,
9018,
267,
7503,
29892,
29871,
29941,
3816,
8516,
29892,
6213,
29892,
2023,
29962,
847,
7442,
29889,
6333,
29898,
20230,
29892,
25638,
29889,
29911,
29897,
13,
4706,
10809,
29961,
19488,
529,
29871,
29900,
29962,
353,
7442,
29889,
7192,
13,
4706,
1852,
353,
7442,
29889,
1191,
1195,
29898,
19488,
29892,
9685,
10457,
29896,
29897,
13,
4706,
10809,
353,
7442,
29889,
1195,
29898,
19488,
29892,
9685,
10457,
29896,
29897,
13,
13,
13,
4706,
282,
1372,
353,
10809,
29961,
16361,
6213,
29962,
334,
921,
12339,
13,
308,
13,
4706,
11105,
29918,
20155,
353,
5159,
13,
4706,
10417,
29918,
18454,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
29953,
1125,
13,
9651,
11105,
353,
1852,
1275,
474,
13,
9651,
11105,
353,
7442,
29889,
29873,
488,
29898,
13168,
29961,
16361,
6213,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
2314,
13,
13,
9651,
1060,
29979,
353,
7442,
29889,
6333,
29898,
9302,
29889,
6333,
29898,
16485,
29961,
13168,
1822,
690,
14443,
4197,
29899,
29896,
29892,
29871,
29941,
11724,
1583,
29889,
29934,
29918,
20155,
29961,
29875,
1822,
29911,
511,
1583,
29889,
29968,
29889,
29911,
29897,
13,
9651,
1060,
29979,
353,
7442,
29889,
24049,
29898,
18454,
29961,
16361,
584,
29906,
1822,
8552,
580,
847,
1060,
29979,
29961,
16361,
29871,
29906,
29901,
1402,
29871,
29900,
29892,
1583,
29889,
29883,
4003,
29918,
2848,
29899,
29896,
29897,
13,
9651,
11105,
29918,
20155,
29889,
4397,
29898,
13168,
29961,
16361,
29871,
29900,
2314,
13,
9651,
10417,
29918,
18454,
29889,
4397,
29898,
18454,
29897,
13,
4706,
11105,
29918,
20155,
353,
518,
7345,
305,
29889,
24693,
29911,
6073,
29898,
29916,
29897,
363,
921,
297,
11105,
29918,
20155,
29962,
13,
4706,
10417,
29918,
18454,
353,
518,
7345,
305,
29889,
11031,
29911,
6073,
29898,
29916,
29897,
363,
921,
297,
10417,
29918,
18454,
29962,
13,
13,
4706,
736,
11105,
29918,
20155,
29892,
10417,
29918,
18454,
13,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
1678,
9853,
353,
4842,
305,
29889,
3298,
359,
29898,
29896,
29906,
29892,
29871,
29941,
29892,
29871,
29906,
29945,
29953,
29892,
29871,
29906,
29945,
29953,
29897,
718,
29871,
29906,
29900,
13,
1678,
274,
29906,
29872,
353,
315,
4003,
29906,
29923,
1548,
29883,
29898,
29906,
29945,
29953,
29892,
29871,
29945,
29896,
29906,
29897,
13,
1678,
1592,
29875,
353,
274,
29906,
29872,
29898,
16175,
29897,
29871,
13,
13,
1678,
14770,
29889,
326,
4294,
29898,
1686,
29875,
29961,
29900,
29892,
2023,
1822,
17858,
1082,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
467,
21970,
2141,
23749,
3101,
13,
1678,
14770,
29889,
4294,
580,
13,
2
] |
favicons/_constants.py | checktheroads/favicons | 7 | 197913 | <filename>favicons/_constants.py<gh_stars>1-10
"""Static values for one way import."""
SUPPORTED_FORMATS = (".svg", ".jpeg", ".jpg", ".png", ".tiff", ".tif")
HTML_LINK = '<link rel="{rel}" type="{type}" href="{href}" />'
ICON_TYPES = (
{"image_fmt": "ico", "rel": None, "dimensions": (64, 64), "prefix": "favicon"},
{"image_fmt": "png", "rel": "icon", "dimensions": (16, 16), "prefix": "favicon"},
{"image_fmt": "png", "rel": "icon", "dimensions": (32, 32), "prefix": "favicon"},
{"image_fmt": "png", "rel": "icon", "dimensions": (64, 64), "prefix": "favicon"},
{"image_fmt": "png", "rel": "icon", "dimensions": (96, 96), "prefix": "favicon"},
{"image_fmt": "png", "rel": "icon", "dimensions": (180, 180), "prefix": "favicon"},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (57, 57),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (60, 60),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (72, 72),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (76, 76),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (114, 114),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (120, 120),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (144, 144),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (152, 152),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (167, 167),
"prefix": "apple-touch-icon",
},
{
"image_fmt": "png",
"rel": "apple-touch-icon",
"dimensions": (180, 180),
"prefix": "apple-touch-icon",
},
{"image_fmt": "png", "rel": None, "dimensions": (70, 70), "prefix": "mstile"},
{"image_fmt": "png", "rel": None, "dimensions": (270, 270), "prefix": "mstile"},
{"image_fmt": "png", "rel": None, "dimensions": (310, 310), "prefix": "mstile"},
{"image_fmt": "png", "rel": None, "dimensions": (310, 150), "prefix": "mstile"},
{"image_fmt": "png", "rel": "shortcut icon", "dimensions": (196, 196), "prefix": "favicon"},
)
| [
1,
529,
9507,
29958,
29888,
485,
27078,
19891,
3075,
1934,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
17046,
1819,
363,
697,
982,
1053,
1213,
15945,
13,
13,
29903,
4897,
15082,
3352,
29918,
19094,
1299,
29903,
353,
313,
1642,
15120,
613,
11393,
26568,
613,
11393,
6173,
613,
11393,
2732,
613,
11393,
29873,
2593,
613,
11393,
29873,
361,
1159,
13,
13,
7020,
29918,
23714,
29968,
353,
12801,
2324,
1104,
10724,
2674,
5038,
1134,
10724,
1853,
5038,
2822,
10724,
12653,
5038,
2900,
29915,
13,
13,
2965,
1164,
29918,
15631,
29925,
2890,
353,
313,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
1417,
613,
376,
2674,
1115,
6213,
29892,
376,
6229,
5580,
1115,
313,
29953,
29946,
29892,
29871,
29953,
29946,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
4144,
613,
376,
6229,
5580,
1115,
313,
29896,
29953,
29892,
29871,
29896,
29953,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
4144,
613,
376,
6229,
5580,
1115,
313,
29941,
29906,
29892,
29871,
29941,
29906,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
4144,
613,
376,
6229,
5580,
1115,
313,
29953,
29946,
29892,
29871,
29953,
29946,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
4144,
613,
376,
6229,
5580,
1115,
313,
29929,
29953,
29892,
29871,
29929,
29953,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
4144,
613,
376,
6229,
5580,
1115,
313,
29896,
29947,
29900,
29892,
29871,
29896,
29947,
29900,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29945,
29955,
29892,
29871,
29945,
29955,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29953,
29900,
29892,
29871,
29953,
29900,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29955,
29906,
29892,
29871,
29955,
29906,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29955,
29953,
29892,
29871,
29955,
29953,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29896,
29946,
29892,
29871,
29896,
29896,
29946,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29906,
29900,
29892,
29871,
29896,
29906,
29900,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29946,
29946,
29892,
29871,
29896,
29946,
29946,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29945,
29906,
29892,
29871,
29896,
29945,
29906,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29953,
29955,
29892,
29871,
29896,
29953,
29955,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
376,
3027,
29918,
23479,
1115,
376,
2732,
613,
13,
4706,
376,
2674,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
4706,
376,
6229,
5580,
1115,
313,
29896,
29947,
29900,
29892,
29871,
29896,
29947,
29900,
511,
13,
4706,
376,
13506,
1115,
376,
11548,
29899,
16747,
29899,
4144,
613,
13,
1678,
2981,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
6213,
29892,
376,
6229,
5580,
1115,
313,
29955,
29900,
29892,
29871,
29955,
29900,
511,
376,
13506,
1115,
376,
29885,
303,
488,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
6213,
29892,
376,
6229,
5580,
1115,
313,
29906,
29955,
29900,
29892,
29871,
29906,
29955,
29900,
511,
376,
13506,
1115,
376,
29885,
303,
488,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
6213,
29892,
376,
6229,
5580,
1115,
313,
29941,
29896,
29900,
29892,
29871,
29941,
29896,
29900,
511,
376,
13506,
1115,
376,
29885,
303,
488,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
6213,
29892,
376,
6229,
5580,
1115,
313,
29941,
29896,
29900,
29892,
29871,
29896,
29945,
29900,
511,
376,
13506,
1115,
376,
29885,
303,
488,
10758,
13,
1678,
8853,
3027,
29918,
23479,
1115,
376,
2732,
613,
376,
2674,
1115,
376,
12759,
7582,
9849,
613,
376,
6229,
5580,
1115,
313,
29896,
29929,
29953,
29892,
29871,
29896,
29929,
29953,
511,
376,
13506,
1115,
376,
29888,
485,
4144,
10758,
13,
29897,
13,
2
] |
unittest/buildtool/util_test.py | rantav/spinnaker | 0 | 140841 | <gh_stars>0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# pylint: disable=missing-docstring
import datetime
import logging
import os
import shutil
import tempfile
import unittest
from buildtool import (
ensure_dir_exists,
timedelta_string,
write_to_path)
class TestRunner(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.base_temp_dir = tempfile.mkdtemp(prefix='buildtool.util_test')
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.base_temp_dir)
def test_ensure_dir(self):
want = os.path.join(self.base_temp_dir, 'ensure', 'a', 'b', 'c')
self.assertFalse(os.path.exists(want))
ensure_dir_exists(want)
self.assertTrue(os.path.exists(want))
# Ok if already exists
ensure_dir_exists(want)
self.assertTrue(os.path.exists(want))
def test_write_to_path(self):
path = os.path.join(self.base_temp_dir, 'test_write', 'file')
content = 'First Line\nSecond Line'
write_to_path(content, path)
with open(path, 'r') as f:
self.assertEquals(content, f.read())
def test_deltatime_string(self):
timedelta = datetime.timedelta
tests = [
(timedelta(1, 60 * 60 * 4 + 60 * 5 + 2, 123456), 'days=1 + 04:05:02'),
(timedelta(1, 60 * 5 + 2, 123456), 'days=1 + 00:05:02'),
(timedelta(1, 2, 123456), 'days=1 + 00:00:02'),
(timedelta(0, 60 * 60 * 4 + 60 * 5 + 2, 123456), '04:05:02'),
(timedelta(0, 60 * 5 + 2, 123456), '05:02'),
(timedelta(0, 2, 123456), '2.123 secs')
]
for test in tests:
self.assertEquals(test[1], timedelta_string(test[0]))
if __name__ == '__main__':
logging.basicConfig(
format='%(levelname).1s %(asctime)s.%(msecs)03d %(message)s',
datefmt='%H:%M:%S',
level=logging.DEBUG)
unittest.main(verbosity=2)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
5087,
9266,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
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,
29937,
282,
2904,
524,
29901,
11262,
29922,
27259,
29899,
1514,
1807,
13,
13,
5215,
12865,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
5694,
1445,
13,
5215,
443,
27958,
13,
13,
3166,
2048,
10154,
1053,
313,
13,
1678,
9801,
29918,
3972,
29918,
9933,
29892,
13,
1678,
5335,
287,
2554,
29918,
1807,
29892,
13,
1678,
2436,
29918,
517,
29918,
2084,
29897,
13,
13,
13,
1990,
4321,
16802,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
731,
3373,
2385,
29898,
25932,
1125,
13,
1678,
1067,
29879,
29889,
3188,
29918,
7382,
29918,
3972,
353,
5694,
1445,
29889,
11256,
29881,
7382,
29898,
13506,
2433,
4282,
10154,
29889,
4422,
29918,
1688,
1495,
13,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
734,
279,
6767,
2385,
29898,
25932,
1125,
13,
1678,
528,
4422,
29889,
1758,
8336,
29898,
25932,
29889,
3188,
29918,
7382,
29918,
3972,
29897,
13,
13,
29871,
822,
1243,
29918,
7469,
29918,
3972,
29898,
1311,
1125,
13,
1678,
864,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
7382,
29918,
3972,
29892,
525,
7469,
742,
525,
29874,
742,
525,
29890,
742,
525,
29883,
1495,
13,
1678,
1583,
29889,
9294,
8824,
29898,
359,
29889,
2084,
29889,
9933,
29898,
29893,
424,
876,
13,
1678,
9801,
29918,
3972,
29918,
9933,
29898,
29893,
424,
29897,
13,
1678,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
9933,
29898,
29893,
424,
876,
13,
13,
1678,
396,
3674,
565,
2307,
4864,
13,
1678,
9801,
29918,
3972,
29918,
9933,
29898,
29893,
424,
29897,
13,
1678,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
9933,
29898,
29893,
424,
876,
13,
13,
29871,
822,
1243,
29918,
3539,
29918,
517,
29918,
2084,
29898,
1311,
1125,
13,
1678,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
7382,
29918,
3972,
29892,
525,
1688,
29918,
3539,
742,
525,
1445,
1495,
13,
1678,
2793,
353,
525,
6730,
7407,
29905,
29876,
11863,
7407,
29915,
13,
1678,
2436,
29918,
517,
29918,
2084,
29898,
3051,
29892,
2224,
29897,
13,
1678,
411,
1722,
29898,
2084,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
418,
1583,
29889,
9294,
14776,
29898,
3051,
29892,
285,
29889,
949,
3101,
13,
13,
29871,
822,
1243,
29918,
29881,
2152,
271,
603,
29918,
1807,
29898,
1311,
1125,
13,
1678,
5335,
287,
2554,
353,
12865,
29889,
9346,
287,
2554,
13,
1678,
6987,
353,
518,
13,
4706,
313,
9346,
287,
2554,
29898,
29896,
29892,
29871,
29953,
29900,
334,
29871,
29953,
29900,
334,
29871,
29946,
718,
29871,
29953,
29900,
334,
29871,
29945,
718,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
16700,
29922,
29896,
718,
29871,
29900,
29946,
29901,
29900,
29945,
29901,
29900,
29906,
5477,
13,
4706,
313,
9346,
287,
2554,
29898,
29896,
29892,
29871,
29953,
29900,
334,
29871,
29945,
718,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
16700,
29922,
29896,
718,
29871,
29900,
29900,
29901,
29900,
29945,
29901,
29900,
29906,
5477,
13,
4706,
313,
9346,
287,
2554,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
16700,
29922,
29896,
718,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29906,
5477,
13,
4706,
313,
9346,
287,
2554,
29898,
29900,
29892,
29871,
29953,
29900,
334,
29871,
29953,
29900,
334,
29871,
29946,
718,
29871,
29953,
29900,
334,
29871,
29945,
718,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
29900,
29946,
29901,
29900,
29945,
29901,
29900,
29906,
5477,
13,
4706,
313,
9346,
287,
2554,
29898,
29900,
29892,
29871,
29953,
29900,
334,
29871,
29945,
718,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
29900,
29945,
29901,
29900,
29906,
5477,
13,
4706,
313,
9346,
287,
2554,
29898,
29900,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
511,
525,
29906,
29889,
29896,
29906,
29941,
409,
2395,
1495,
13,
1678,
4514,
13,
1678,
363,
1243,
297,
6987,
29901,
13,
418,
1583,
29889,
9294,
14776,
29898,
1688,
29961,
29896,
1402,
5335,
287,
2554,
29918,
1807,
29898,
1688,
29961,
29900,
12622,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29871,
12183,
29889,
16121,
3991,
29898,
13,
418,
3402,
2433,
29995,
29898,
5563,
978,
467,
29896,
29879,
1273,
29898,
294,
312,
603,
29897,
29879,
29889,
29995,
29898,
29885,
344,
2395,
29897,
29900,
29941,
29881,
1273,
29898,
4906,
29897,
29879,
742,
13,
418,
2635,
23479,
2433,
29995,
29950,
16664,
29924,
16664,
29903,
742,
13,
418,
3233,
29922,
21027,
29889,
18525,
29897,
13,
13,
29871,
443,
27958,
29889,
3396,
29898,
18248,
359,
537,
29922,
29906,
29897,
13,
2
] |
notebooks/bqml/track_meta.py | roannav/learntools | 359 | 32140 | # See also examples/example_track/track_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
course_name='Machine Learning',
course_url='https://www.kaggle.com/learn/intro-to-machine-learning'
)
lessons = [
dict(
topic='Your First BiqQuery ML Model',
),
]
notebooks = [
dict(
filename='tut1.ipynb',
lesson_idx=0,
type='tutorial',
scriptid=4076893,
),
dict(
filename='ex1.ipynb',
lesson_idx=0,
type='exercise',
scriptid=4077160,
),
]
| [
1,
396,
2823,
884,
6455,
29914,
4773,
29918,
11294,
29914,
11294,
29918,
7299,
29889,
2272,
363,
263,
5520,
29892,
19952,
1342,
13,
11294,
353,
9657,
29898,
13,
1678,
4148,
29918,
6786,
2433,
29881,
550,
915,
4937,
742,
13,
1678,
3236,
29918,
978,
2433,
29076,
29257,
742,
13,
1678,
3236,
29918,
2271,
2433,
991,
597,
1636,
29889,
29895,
351,
6234,
29889,
510,
29914,
19668,
29914,
23333,
29899,
517,
29899,
23523,
29899,
21891,
29915,
13,
29897,
13,
13,
2222,
787,
353,
518,
13,
4706,
9657,
29898,
13,
9651,
11261,
2433,
10858,
3824,
3457,
29939,
3010,
23158,
8125,
742,
13,
9651,
10353,
13,
29962,
13,
13,
1333,
19273,
29879,
353,
518,
13,
1678,
9657,
29898,
13,
4706,
10422,
2433,
29873,
329,
29896,
29889,
666,
948,
29890,
742,
13,
4706,
3109,
265,
29918,
13140,
29922,
29900,
29892,
13,
4706,
1134,
2433,
12631,
742,
13,
4706,
2471,
333,
29922,
29946,
29900,
29955,
29953,
29947,
29929,
29941,
29892,
13,
4706,
10353,
13,
1678,
9657,
29898,
13,
4706,
10422,
2433,
735,
29896,
29889,
666,
948,
29890,
742,
13,
4706,
3109,
265,
29918,
13140,
29922,
29900,
29892,
13,
4706,
1134,
2433,
735,
6269,
895,
742,
13,
4706,
2471,
333,
29922,
29946,
29900,
29955,
29955,
29896,
29953,
29900,
29892,
13,
4706,
10353,
13,
29962,
13,
13,
13,
2
] |
Exercicios/068-ParouImparV2.py | LuisDjay/Python-Curso-em-Video | 0 | 61669 | <filename>Exercicios/068-ParouImparV2.py
print('=====Desafio 068=====')
from random import randint
cont = 0
while True:
jog = int(input('Diga Um valor: '))
resp = str(input('Par ou Ímpar? [P/I] ').upper())
comp = randint(0, 10)
result = jog + comp
result2 = result % 2
if result2 == 0 and resp == 'P':
print(f'Voce Jogou {jog} e o computador jogou {comp}. O total é {result} Deu PAR')
print(f'Você Venceu!')
print(f'Vamos jogar novamente')
elif result2 == 0 and resp == 'I':
print(f'Voce Jogou {jog} e o computador jogou {comp}. O total é {result} Deu PAR')
print(f'Você Perdeu!')
break
elif result2 != 0 and resp == 'I':
print(f'Voce Jogou {jog} e o computador jogou {comp}. O total é {result} Deu IMPAR')
print(f'Você Venceu!')
print(f'Vamos jogar novamente')
cont += 1
elif result2 != 0 and resp == 'P':
print(f'Voce Jogou {jog} e o computador jogou {comp}. O total é {result} Deu IMPAR')
print(f'Você Perdeu!')
break
cont += 1
print(f'Você venceu {cont} vezes.')
| [
1,
529,
9507,
29958,
1252,
6269,
19382,
29914,
29900,
29953,
29947,
29899,
2177,
283,
1888,
862,
29963,
29906,
29889,
2272,
13,
2158,
877,
2751,
29922,
4002,
2142,
601,
29871,
29900,
29953,
29947,
2751,
29922,
1495,
13,
3166,
4036,
1053,
20088,
524,
13,
13,
1285,
353,
29871,
29900,
13,
8000,
5852,
29901,
13,
1678,
16812,
353,
938,
29898,
2080,
877,
29928,
4324,
6379,
16497,
29901,
525,
876,
13,
1678,
4613,
353,
851,
29898,
2080,
877,
2177,
2123,
27614,
29885,
862,
29973,
518,
29925,
29914,
29902,
29962,
525,
467,
21064,
3101,
13,
1678,
752,
353,
20088,
524,
29898,
29900,
29892,
29871,
29896,
29900,
29897,
13,
1678,
1121,
353,
16812,
718,
752,
13,
1678,
1121,
29906,
353,
1121,
1273,
29871,
29906,
13,
1678,
565,
1121,
29906,
1275,
29871,
29900,
322,
4613,
1275,
525,
29925,
2396,
13,
4706,
1596,
29898,
29888,
29915,
29963,
25802,
435,
468,
283,
426,
29926,
468,
29913,
321,
288,
2912,
3136,
16812,
283,
426,
2388,
1836,
438,
3001,
904,
426,
2914,
29913,
897,
29884,
349,
1718,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
542,
30037,
478,
663,
29884,
29991,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
14054,
16812,
279,
2420,
2503,
1495,
13,
1678,
25342,
1121,
29906,
1275,
29871,
29900,
322,
4613,
1275,
525,
29902,
2396,
13,
4706,
1596,
29898,
29888,
29915,
29963,
25802,
435,
468,
283,
426,
29926,
468,
29913,
321,
288,
2912,
3136,
16812,
283,
426,
2388,
1836,
438,
3001,
904,
426,
2914,
29913,
897,
29884,
349,
1718,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
542,
30037,
2431,
311,
29884,
29991,
1495,
13,
4706,
2867,
13,
1678,
25342,
1121,
29906,
2804,
29871,
29900,
322,
4613,
1275,
525,
29902,
2396,
13,
4706,
1596,
29898,
29888,
29915,
29963,
25802,
435,
468,
283,
426,
29926,
468,
29913,
321,
288,
2912,
3136,
16812,
283,
426,
2388,
1836,
438,
3001,
904,
426,
2914,
29913,
897,
29884,
306,
3580,
1718,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
542,
30037,
478,
663,
29884,
29991,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
14054,
16812,
279,
2420,
2503,
1495,
13,
4706,
640,
4619,
29871,
29896,
13,
1678,
25342,
1121,
29906,
2804,
29871,
29900,
322,
4613,
1275,
525,
29925,
2396,
13,
4706,
1596,
29898,
29888,
29915,
29963,
25802,
435,
468,
283,
426,
29926,
468,
29913,
321,
288,
2912,
3136,
16812,
283,
426,
2388,
1836,
438,
3001,
904,
426,
2914,
29913,
897,
29884,
306,
3580,
1718,
1495,
13,
4706,
1596,
29898,
29888,
29915,
29963,
542,
30037,
2431,
311,
29884,
29991,
1495,
13,
4706,
2867,
13,
1678,
640,
4619,
29871,
29896,
13,
2158,
29898,
29888,
29915,
29963,
542,
30037,
325,
663,
29884,
426,
1285,
29913,
7763,
267,
29889,
1495,
13,
2
] |
page/playground_page.py | fnrcum/pytest_playwright_framework | 0 | 1608143 | from playwright.sync_api import Page
class PlaygroundPage:
def __init__(self, page: Page):
self.page = page
@property
def bad_button(self):
return self.page.wait_for_selector("#badButton") | [
1,
515,
1708,
29893,
1266,
29889,
16593,
29918,
2754,
1053,
9305,
13,
13,
13,
1990,
7412,
2057,
5074,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1813,
29901,
9305,
1125,
13,
4706,
1583,
29889,
3488,
353,
1813,
13,
13,
1678,
732,
6799,
13,
1678,
822,
4319,
29918,
3092,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3488,
29889,
10685,
29918,
1454,
29918,
14357,
14822,
12313,
3125,
1159,
2
] |
api/authentication/tests.py | app-generator/api-server-django-sample | 2 | 76597 | from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
class AuthenticationTest(APITestCase):
base_url_register = reverse("api-users:register-list")
base_url_login = reverse("api-users:login-list")
base_url_logout = reverse("api-users:logout-list")
base_url_check_session = reverse("api-users:check-session-list")
data_register = {"username": "test", "password": "<PASSWORD>", "email": "<EMAIL>"}
data_login = {"password": "<PASSWORD>", "email": "<EMAIL>"}
def test_register(self):
response = self.client.post(
f"{self.base_url_register}", data=self.data_register
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
response_data = response.json()
self.assertEqual(response_data["success"], True)
def test_login(self):
response = self.client.post(f"{self.base_url_login}", data=self.data_login)
self.assertEqual(response.status_code, status.HTTP_200_OK)
response_data = response.json()
self.assertEqual(response_data["success"], True)
def test_logout(self):
# Login to retrieve token
response = self.client.post(f"{self.base_url_login}", data=self.data_login)
response_data = response.json()
token = response_data["token"]
self.client.credentials(HTTP_AUTHORIZATION=token)
# Logout
response = self.client.post(f"{self.base_url_logout}", data={"token": token})
self.assertEqual(response.status_code, status.HTTP_200_OK)
response_data = response.json()
self.assertEqual(response_data["success"], True)
def test_check_session(self):
# Login to retrieve token
response = self.client.post(f"{self.base_url_login}", data=self.data_login)
response_data = response.json()
token = response_data["token"]
self.client.credentials(HTTP_AUTHORIZATION=token)
# Check session
response = self.client.post(f"{self.base_url_check_session}")
self.assertEqual(response.status_code, status.HTTP_200_OK)
response_data = response.json()
self.assertEqual(response_data["success"], True)
| [
1,
515,
9557,
29889,
26045,
1053,
11837,
13,
3166,
1791,
29918,
4468,
29889,
1688,
1053,
12279,
1806,
342,
8259,
13,
3166,
1791,
29918,
4468,
1053,
4660,
13,
13,
13,
1990,
27241,
3057,
29898,
3301,
1806,
342,
8259,
1125,
13,
1678,
2967,
29918,
2271,
29918,
9573,
353,
11837,
703,
2754,
29899,
7193,
29901,
9573,
29899,
1761,
1159,
13,
1678,
2967,
29918,
2271,
29918,
7507,
353,
11837,
703,
2754,
29899,
7193,
29901,
7507,
29899,
1761,
1159,
13,
1678,
2967,
29918,
2271,
29918,
1188,
449,
353,
11837,
703,
2754,
29899,
7193,
29901,
1188,
449,
29899,
1761,
1159,
13,
1678,
2967,
29918,
2271,
29918,
3198,
29918,
7924,
353,
11837,
703,
2754,
29899,
7193,
29901,
3198,
29899,
7924,
29899,
1761,
1159,
13,
13,
1678,
848,
29918,
9573,
353,
8853,
6786,
1115,
376,
1688,
613,
376,
5630,
1115,
9872,
25711,
17013,
28341,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
13,
13,
1678,
848,
29918,
7507,
353,
8853,
5630,
1115,
9872,
25711,
17013,
28341,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
13,
13,
1678,
822,
1243,
29918,
9573,
29898,
1311,
1125,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
13,
9651,
285,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
9573,
17671,
848,
29922,
1311,
29889,
1272,
29918,
9573,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29918,
1272,
3366,
8698,
12436,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
7507,
29898,
1311,
1125,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
29888,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
7507,
17671,
848,
29922,
1311,
29889,
1272,
29918,
7507,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29918,
1272,
3366,
8698,
12436,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
1188,
449,
29898,
1311,
1125,
13,
4706,
396,
19130,
304,
10563,
5993,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
29888,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
7507,
17671,
848,
29922,
1311,
29889,
1272,
29918,
7507,
29897,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
13,
4706,
5993,
353,
2933,
29918,
1272,
3366,
6979,
3108,
13,
13,
4706,
1583,
29889,
4645,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
29922,
6979,
29897,
13,
13,
4706,
396,
4522,
449,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
29888,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
1188,
449,
17671,
848,
3790,
29908,
6979,
1115,
5993,
1800,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29918,
1272,
3366,
8698,
12436,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
3198,
29918,
7924,
29898,
1311,
1125,
13,
4706,
396,
19130,
304,
10563,
5993,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
29888,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
7507,
17671,
848,
29922,
1311,
29889,
1272,
29918,
7507,
29897,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
13,
4706,
5993,
353,
2933,
29918,
1272,
3366,
6979,
3108,
13,
13,
4706,
1583,
29889,
4645,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
29922,
6979,
29897,
13,
13,
4706,
396,
5399,
4867,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
29888,
29908,
29912,
1311,
29889,
3188,
29918,
2271,
29918,
3198,
29918,
7924,
27195,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
13,
4706,
2933,
29918,
1272,
353,
2933,
29889,
3126,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29918,
1272,
3366,
8698,
12436,
5852,
29897,
13,
2
] |
thuum/__main__.py | nickcoutsos/thuum | 0 | 40802 | import argparse
import functools
import sys
from tornado import (
httpclient,
ioloop,
)
def add_package_to_path():
if not (__name__ == "__main__" and __package__ == ""):
return
import os
sys.path.append(os.path.abspath(os.path.join(
os.path.abspath(__file__),
"..",
"..")))
add_package_to_path()
from thuum import (
reporters,
runners,
stats,
)
class UsageError(Exception):
def __init__(self, message, parser):
super(UsageError, self).__init__(message)
self.parser = parser
class AddBody(argparse.Action):
def __call__(self, parser, namespace, body, option_string=None):
if namespace.body is not None:
raise UsageError("Cannot specify -b/--body more than once.", parser)
if namespace.method not in ("PATCH", "POST", "PUT"):
raise UsageError(
"Cannot specify -b/--body with %r." % namespace.method,
parser)
if body.startswith("py:"):
pass
elif body.startswith("@"):
pass
namespace.body = body
class AddHeader(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
header = tuple(values.split(":"))
namespace.headers.append(header)
if len(header) != 2:
raise UsageError("Headers must be of the form 'name:value'", parser)
class StoreMappedChoice(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
choice = self.choices[values]
setattr(namespace, self.dest, choice)
def get_argument_parser(parser=None):
parser = parser or argparse.ArgumentParser(
description="Simple HTTP Load runner.")
parser.add_argument(
"-m", "--method",
choices=("DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"),
help="HTTP Method to use for request",
default="GET")
parser.add_argument(
"-b", "--body",
action=AddBody,
default=None,
help=(
"Request body. Prefix with 'py:' to indicate a fully-qualified "
"python callable. Prefix with '@' to indicate a file path."
))
parser.add_argument(
"-c", "--concurrency",
help="Number of requests to make concurrently.",
dest="concurrency",
default=1,
type=int)
parser.add_argument(
"-H", "--header", dest="headers",
help="Custom header. name:value",
default=[], action=AddHeader)
parser.add_argument(
"--reporter", dest="reporter_class",
help="Stats report format.",
action=StoreMappedChoice,
default=reporters.TerminalReporter,
choices={
"csv": reporters.CSVReporter,
"json": reporters.JSONReporter,
"term": reporters.TerminalReporter,
})
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
"-n", "--requests",
help="Number of requests",
type=int)
group.add_argument(
"-d", "--duration",
help="Run load test for specified length of time.",
type=float)
parser.add_argument("url", help="URL to hit")
return parser
def main(argv=sys.argv[1:], stdout=sys.stdout):
parser = get_argument_parser()
try:
args = parser.parse_args(argv)
except UsageError as exception:
sys.exit("%s\n\n%s" % (
exception.message,
exception.parser.format_usage()
))
httpclient.AsyncHTTPClient.configure(None, max_clients=args.concurrency)
client = httpclient.AsyncHTTPClient(io_loop=ioloop.IOLoop.current())
try:
make_request = functools.partial(
httpclient.HTTPRequest,
args.url,
args.method,
args.headers,
args.body)
if args.duration:
runner = runners.DurationRunner(client, make_request, args.duration)
else:
runner = runners.QuantityRunner(client, make_request, args.requests)
reporter = args.reporter_class(stdout)
progress = functools.partial(reporter.progress, runner)
tracker = stats.Tracker(runner)
tracker.events.on("request_finished", reporter.record)
tracker.events.on("tests_finished", lambda t: progress())
tracker.events.on("tests_finished", reporter.summarize)
client.io_loop.add_callback(progress)
ioloop.PeriodicCallback(progress, 500, client.io_loop).start()
runner.run()
except KeyboardInterrupt:
sys.exit("Tests interrupted.")
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
| [
1,
1053,
1852,
5510,
13,
5215,
2090,
312,
8789,
13,
5215,
10876,
13,
13,
3166,
10146,
912,
1053,
313,
13,
1678,
1732,
4645,
29892,
13,
1678,
474,
3543,
459,
29892,
13,
29897,
13,
13,
1753,
788,
29918,
5113,
29918,
517,
29918,
2084,
7295,
13,
1678,
565,
451,
313,
1649,
978,
1649,
1275,
376,
1649,
3396,
1649,
29908,
322,
4770,
5113,
1649,
1275,
5124,
1125,
13,
4706,
736,
13,
1678,
1053,
2897,
13,
1678,
10876,
29889,
2084,
29889,
4397,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
13,
4706,
2897,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
511,
13,
4706,
376,
636,
613,
13,
4706,
376,
636,
29908,
4961,
13,
13,
1202,
29918,
5113,
29918,
517,
29918,
2084,
580,
13,
13,
3166,
266,
29884,
398,
1053,
313,
13,
1678,
1634,
272,
2153,
29892,
13,
1678,
1065,
8397,
29892,
13,
1678,
22663,
29892,
13,
29897,
13,
13,
1990,
10783,
482,
2392,
29898,
2451,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2643,
29892,
13812,
1125,
13,
4706,
2428,
29898,
27573,
2392,
29892,
1583,
467,
1649,
2344,
12035,
4906,
29897,
13,
4706,
1583,
29889,
16680,
353,
13812,
13,
13,
1990,
3462,
8434,
29898,
1191,
5510,
29889,
4276,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
13812,
29892,
7397,
29892,
3573,
29892,
2984,
29918,
1807,
29922,
8516,
1125,
13,
4706,
565,
7397,
29889,
2587,
338,
451,
6213,
29901,
13,
9651,
12020,
10783,
482,
2392,
703,
29089,
6084,
448,
29890,
29914,
489,
2587,
901,
1135,
2748,
19602,
13812,
29897,
13,
4706,
565,
7397,
29889,
5696,
451,
297,
4852,
29925,
14789,
613,
376,
5438,
613,
376,
12336,
29908,
1125,
13,
9651,
12020,
10783,
482,
2392,
29898,
13,
18884,
376,
29089,
6084,
448,
29890,
29914,
489,
2587,
411,
1273,
29878,
1213,
1273,
7397,
29889,
5696,
29892,
13,
18884,
13812,
29897,
13,
13,
4706,
565,
3573,
29889,
27382,
2541,
703,
2272,
6160,
1125,
13,
9651,
1209,
13,
4706,
25342,
3573,
29889,
27382,
2541,
703,
5507,
1125,
13,
9651,
1209,
13,
4706,
7397,
29889,
2587,
353,
3573,
13,
13,
1990,
3462,
7850,
29898,
1191,
5510,
29889,
4276,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
13812,
29892,
7397,
29892,
1819,
29892,
2984,
29918,
1807,
29922,
8516,
1125,
13,
4706,
4839,
353,
18761,
29898,
5975,
29889,
5451,
703,
29901,
5783,
13,
4706,
7397,
29889,
13662,
29889,
4397,
29898,
6672,
29897,
13,
4706,
565,
7431,
29898,
6672,
29897,
2804,
29871,
29906,
29901,
13,
9651,
12020,
10783,
482,
2392,
703,
18163,
1818,
367,
310,
278,
883,
525,
978,
29901,
1767,
29915,
613,
13812,
29897,
13,
13,
1990,
14491,
9689,
287,
29620,
29898,
1191,
5510,
29889,
4276,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
13812,
29892,
7397,
29892,
1819,
29892,
2984,
29918,
1807,
29922,
8516,
1125,
13,
4706,
7348,
353,
1583,
29889,
1859,
1575,
29961,
5975,
29962,
13,
4706,
731,
5552,
29898,
22377,
29892,
1583,
29889,
7854,
29892,
7348,
29897,
13,
13,
1753,
679,
29918,
23516,
29918,
16680,
29898,
16680,
29922,
8516,
1125,
13,
1678,
13812,
353,
13812,
470,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
543,
15427,
7331,
16012,
28877,
23157,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29885,
613,
376,
489,
5696,
613,
13,
4706,
19995,
29922,
703,
2287,
18476,
613,
376,
7194,
613,
376,
23252,
613,
376,
14094,
27946,
613,
376,
5438,
613,
376,
12336,
4968,
13,
4706,
1371,
543,
10493,
8108,
304,
671,
363,
2009,
613,
13,
4706,
2322,
543,
7194,
1159,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29890,
613,
376,
489,
2587,
613,
13,
4706,
3158,
29922,
2528,
8434,
29892,
13,
4706,
2322,
29922,
8516,
29892,
13,
4706,
1371,
7607,
13,
9651,
376,
3089,
3573,
29889,
349,
9569,
411,
525,
2272,
11283,
304,
12266,
263,
8072,
29899,
15380,
2164,
376,
13,
9651,
376,
4691,
1246,
519,
29889,
349,
9569,
411,
18803,
29915,
304,
12266,
263,
934,
2224,
1213,
13,
308,
876,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29883,
613,
376,
489,
535,
26095,
613,
13,
4706,
1371,
543,
4557,
310,
7274,
304,
1207,
21984,
368,
19602,
13,
4706,
2731,
543,
535,
26095,
613,
13,
4706,
2322,
29922,
29896,
29892,
13,
4706,
1134,
29922,
524,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29950,
613,
376,
489,
6672,
613,
2731,
543,
13662,
613,
13,
4706,
1371,
543,
7281,
4839,
29889,
1024,
29901,
1767,
613,
13,
4706,
2322,
11759,
1402,
3158,
29922,
2528,
7850,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
276,
18505,
613,
2731,
543,
276,
18505,
29918,
1990,
613,
13,
4706,
1371,
543,
25060,
3461,
3402,
19602,
13,
4706,
3158,
29922,
9044,
9689,
287,
29620,
29892,
13,
4706,
2322,
29922,
276,
1971,
2153,
29889,
14343,
979,
5612,
9555,
29892,
13,
4706,
19995,
3790,
13,
9651,
376,
7638,
1115,
1634,
272,
2153,
29889,
29907,
7597,
5612,
9555,
29892,
13,
9651,
376,
3126,
1115,
1634,
272,
2153,
29889,
7249,
5612,
9555,
29892,
13,
9651,
376,
8489,
1115,
1634,
272,
2153,
29889,
14343,
979,
5612,
9555,
29892,
13,
4706,
5615,
13,
13,
1678,
2318,
353,
13812,
29889,
1202,
29918,
6149,
1474,
29918,
735,
7009,
573,
29918,
2972,
29898,
12403,
29922,
5574,
29897,
13,
1678,
2318,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29876,
613,
376,
489,
24830,
613,
13,
4706,
1371,
543,
4557,
310,
7274,
613,
13,
4706,
1134,
29922,
524,
29897,
13,
13,
1678,
2318,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29881,
613,
376,
489,
19708,
613,
13,
4706,
1371,
543,
6558,
2254,
1243,
363,
6790,
3309,
310,
931,
19602,
13,
4706,
1134,
29922,
7411,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
2271,
613,
1371,
543,
4219,
304,
7124,
1159,
13,
1678,
736,
13812,
13,
13,
13,
1753,
1667,
29898,
19218,
29922,
9675,
29889,
19218,
29961,
29896,
29901,
1402,
27591,
29922,
9675,
29889,
25393,
1125,
13,
1678,
13812,
353,
679,
29918,
23516,
29918,
16680,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
6389,
353,
13812,
29889,
5510,
29918,
5085,
29898,
19218,
29897,
13,
1678,
5174,
10783,
482,
2392,
408,
3682,
29901,
13,
4706,
10876,
29889,
13322,
11702,
29879,
29905,
29876,
29905,
29876,
29995,
29879,
29908,
1273,
313,
13,
9651,
3682,
29889,
4906,
29892,
13,
9651,
3682,
29889,
16680,
29889,
4830,
29918,
21125,
580,
13,
308,
876,
13,
13,
1678,
1732,
4645,
29889,
8123,
10493,
4032,
29889,
17591,
29898,
8516,
29892,
4236,
29918,
11303,
1237,
29922,
5085,
29889,
535,
26095,
29897,
13,
1678,
3132,
353,
1732,
4645,
29889,
8123,
10493,
4032,
29898,
601,
29918,
7888,
29922,
29875,
3543,
459,
29889,
5971,
18405,
29889,
3784,
3101,
13,
13,
1678,
1018,
29901,
13,
4706,
1207,
29918,
3827,
353,
2090,
312,
8789,
29889,
3846,
29898,
13,
9651,
1732,
4645,
29889,
10493,
3089,
29892,
13,
9651,
6389,
29889,
2271,
29892,
13,
9651,
6389,
29889,
5696,
29892,
13,
9651,
6389,
29889,
13662,
29892,
13,
9651,
6389,
29889,
2587,
29897,
13,
13,
4706,
565,
6389,
29889,
19708,
29901,
13,
9651,
28877,
353,
1065,
8397,
29889,
18984,
16802,
29898,
4645,
29892,
1207,
29918,
3827,
29892,
6389,
29889,
19708,
29897,
13,
4706,
1683,
29901,
13,
9651,
28877,
353,
1065,
8397,
29889,
22930,
537,
16802,
29898,
4645,
29892,
1207,
29918,
3827,
29892,
6389,
29889,
24830,
29897,
13,
13,
4706,
1634,
9555,
353,
6389,
29889,
276,
18505,
29918,
1990,
29898,
25393,
29897,
13,
4706,
6728,
353,
2090,
312,
8789,
29889,
3846,
29898,
276,
18505,
29889,
18035,
29892,
28877,
29897,
13,
13,
4706,
1020,
4937,
353,
22663,
29889,
5323,
4937,
29898,
27492,
29897,
13,
4706,
1020,
4937,
29889,
13604,
29889,
265,
703,
3827,
29918,
4951,
3276,
613,
1634,
9555,
29889,
11651,
29897,
13,
4706,
1020,
4937,
29889,
13604,
29889,
265,
703,
21150,
29918,
4951,
3276,
613,
14013,
260,
29901,
6728,
3101,
13,
4706,
1020,
4937,
29889,
13604,
29889,
265,
703,
21150,
29918,
4951,
3276,
613,
1634,
9555,
29889,
2083,
3034,
675,
29897,
13,
13,
4706,
3132,
29889,
601,
29918,
7888,
29889,
1202,
29918,
14035,
29898,
18035,
29897,
13,
4706,
474,
3543,
459,
29889,
29853,
293,
10717,
29898,
18035,
29892,
29871,
29945,
29900,
29900,
29892,
3132,
29889,
601,
29918,
7888,
467,
2962,
580,
13,
13,
4706,
28877,
29889,
3389,
580,
13,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
13,
4706,
10876,
29889,
13322,
703,
24376,
27803,
23157,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
10876,
29889,
13322,
29898,
3396,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
12622,
13,
2
] |
silica/transformations/replace_symbols.py | leonardt/fsm_dsl | 0 | 195340 | <reponame>leonardt/fsm_dsl
import ast
from copy import deepcopy
class SymbolReplacer(ast.NodeTransformer):
def __init__(self, symbol_table, ctx):
self.symbol_table = symbol_table
self.ctx = ctx
def visit_Name(self, node):
if node.id in self.symbol_table:
if self.ctx is None:
new_node = deepcopy(self.symbol_table[node.id])
new_node.ctx = node.ctx
return new_node
elif isinstance(node.ctx, self.ctx):
return deepcopy(self.symbol_table[node.id])
return node
def replace_symbols(tree, symbol_table, ctx=None):
return SymbolReplacer(symbol_table, ctx).visit(tree)
| [
1,
529,
276,
1112,
420,
29958,
280,
265,
538,
29873,
29914,
29888,
3844,
29918,
29881,
2536,
13,
5215,
8717,
13,
3166,
3509,
1053,
6483,
8552,
13,
13,
13,
1990,
23858,
5612,
433,
2265,
29898,
579,
29889,
4247,
13372,
261,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5829,
29918,
2371,
29892,
12893,
1125,
13,
4706,
1583,
29889,
18098,
29918,
2371,
353,
5829,
29918,
2371,
13,
4706,
1583,
29889,
13073,
353,
12893,
13,
13,
1678,
822,
6493,
29918,
1170,
29898,
1311,
29892,
2943,
1125,
13,
4706,
565,
2943,
29889,
333,
297,
1583,
29889,
18098,
29918,
2371,
29901,
13,
9651,
565,
1583,
29889,
13073,
338,
6213,
29901,
13,
18884,
716,
29918,
3177,
353,
6483,
8552,
29898,
1311,
29889,
18098,
29918,
2371,
29961,
3177,
29889,
333,
2314,
13,
18884,
716,
29918,
3177,
29889,
13073,
353,
2943,
29889,
13073,
13,
18884,
736,
716,
29918,
3177,
13,
9651,
25342,
338,
8758,
29898,
3177,
29889,
13073,
29892,
1583,
29889,
13073,
1125,
13,
18884,
736,
6483,
8552,
29898,
1311,
29889,
18098,
29918,
2371,
29961,
3177,
29889,
333,
2314,
13,
4706,
736,
2943,
13,
13,
1753,
5191,
29918,
18098,
29879,
29898,
8336,
29892,
5829,
29918,
2371,
29892,
12893,
29922,
8516,
1125,
13,
1678,
736,
23858,
5612,
433,
2265,
29898,
18098,
29918,
2371,
29892,
12893,
467,
1730,
277,
29898,
8336,
29897,
13,
2
] |
1701-1800/1711-1720/1711-countGoodMeals/countGoodMeals.py | xuychen/Leetcode | 0 | 27963 | <gh_stars>0
from collections import defaultdict
class Solution(object):
def countPairs(self, deliciousness):
"""
:type deliciousness: List[int]
:rtype: int
"""
max_sum = max(deliciousness) * 2
count = 0
dictionary = defaultdict(int)
for value in deliciousness:
summation = 1
while summation <= max_sum:
count = (count + dictionary[summation-value]) % 1000000007
summation <<= 1
dictionary[value] += 1
return count
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
16250,
1053,
2322,
8977,
13,
13,
1990,
24380,
29898,
3318,
1125,
13,
1678,
822,
2302,
29925,
7121,
29898,
1311,
29892,
628,
14803,
2264,
1125,
13,
4706,
9995,
13,
4706,
584,
1853,
628,
14803,
2264,
29901,
2391,
29961,
524,
29962,
13,
4706,
584,
29878,
1853,
29901,
938,
13,
4706,
9995,
13,
13,
4706,
4236,
29918,
2083,
353,
4236,
29898,
6144,
14803,
2264,
29897,
334,
29871,
29906,
13,
4706,
2302,
353,
29871,
29900,
13,
4706,
8600,
353,
2322,
8977,
29898,
524,
29897,
13,
13,
4706,
363,
995,
297,
628,
14803,
2264,
29901,
13,
9651,
22792,
362,
353,
29871,
29896,
13,
9651,
1550,
22792,
362,
5277,
4236,
29918,
2083,
29901,
13,
18884,
2302,
353,
313,
2798,
718,
8600,
29961,
2083,
29885,
362,
29899,
1767,
2314,
1273,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29955,
13,
18884,
22792,
362,
3532,
29922,
29871,
29896,
13,
13,
9651,
8600,
29961,
1767,
29962,
4619,
29871,
29896,
13,
13,
4706,
736,
2302,
13,
2
] |
modin/pandas/datetimes.py | alclol/modin | 0 | 68697 | <reponame>alclol/modin
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
import pandas
from .dataframe import DataFrame
from .series import Series
def to_datetime(
arg,
errors="raise",
dayfirst=False,
yearfirst=False,
utc=None,
format=None,
exact=True,
unit=None,
infer_datetime_format=False,
origin="unix",
cache=True,
):
"""Convert the arg to datetime format. If not Ray DataFrame, this falls
back on pandas.
Args:
errors ('raise' or 'ignore'): If 'ignore', errors are silenced.
Pandas blatantly ignores this argument so we will too.
dayfirst (bool): Date format is passed in as day first.
yearfirst (bool): Date format is passed in as year first.
utc (bool): retuns a UTC DatetimeIndex if True.
box (bool): If True, returns a DatetimeIndex.
format (string): strftime to parse time, eg "%d/%m/%Y".
exact (bool): If True, require an exact format match.
unit (string, default 'ns'): unit of the arg.
infer_datetime_format (bool): Whether or not to infer the format.
origin (string): Define the reference date.
Returns:
Type depends on input:
- list-like: DatetimeIndex
- Series: Series of datetime64 dtype
- scalar: Timestamp
"""
if not isinstance(arg, (DataFrame, Series)):
return pandas.to_datetime(
arg,
errors=errors,
dayfirst=dayfirst,
yearfirst=yearfirst,
utc=utc,
format=format,
exact=exact,
unit=unit,
infer_datetime_format=infer_datetime_format,
origin=origin,
cache=cache,
)
return arg._default_to_pandas(
pandas.to_datetime,
errors=errors,
dayfirst=dayfirst,
yearfirst=yearfirst,
utc=utc,
format=format,
exact=exact,
unit=unit,
infer_datetime_format=infer_datetime_format,
origin=origin,
cache=cache,
)
| [
1,
529,
276,
1112,
420,
29958,
284,
695,
324,
29914,
1545,
262,
13,
29937,
10413,
21144,
304,
3382,
262,
14650,
8583,
1090,
697,
470,
901,
17737,
3406,
19405,
8571,
4110,
29889,
13,
29937,
2823,
278,
6058,
12107,
934,
13235,
411,
445,
664,
363,
5684,
2472,
11211,
13,
29937,
3509,
1266,
27428,
29889,
29871,
450,
3382,
262,
14650,
8583,
7794,
11259,
445,
934,
304,
366,
1090,
278,
13,
29937,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
13,
29937,
752,
13036,
411,
278,
19245,
29889,
29871,
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,
13235,
1090,
13,
29937,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13,
29937,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
19245,
363,
278,
2702,
4086,
13,
29937,
14765,
1076,
11239,
322,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
11701,
13,
13,
3166,
869,
1272,
2557,
1053,
3630,
4308,
13,
3166,
869,
13757,
1053,
10488,
13,
13,
13,
1753,
304,
29918,
12673,
29898,
13,
1678,
1852,
29892,
13,
1678,
4436,
543,
22692,
613,
13,
1678,
2462,
4102,
29922,
8824,
29892,
13,
1678,
1629,
4102,
29922,
8824,
29892,
13,
1678,
3477,
29883,
29922,
8516,
29892,
13,
1678,
3402,
29922,
8516,
29892,
13,
1678,
2684,
29922,
5574,
29892,
13,
1678,
5190,
29922,
8516,
29892,
13,
1678,
10115,
29918,
12673,
29918,
4830,
29922,
8824,
29892,
13,
1678,
3978,
543,
24538,
613,
13,
1678,
7090,
29922,
5574,
29892,
13,
1125,
13,
1678,
9995,
18455,
278,
1852,
304,
12865,
3402,
29889,
960,
451,
9596,
3630,
4308,
29892,
445,
20074,
13,
539,
1250,
373,
11701,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
4436,
6702,
22692,
29915,
470,
525,
17281,
29374,
960,
525,
17281,
742,
4436,
526,
4047,
9223,
29889,
13,
9651,
349,
7086,
1999,
271,
10835,
5330,
2361,
445,
2980,
577,
591,
674,
2086,
29889,
13,
4706,
2462,
4102,
313,
11227,
1125,
4712,
3402,
338,
4502,
297,
408,
2462,
937,
29889,
13,
4706,
1629,
4102,
313,
11227,
1125,
4712,
3402,
338,
4502,
297,
408,
1629,
937,
29889,
13,
4706,
3477,
29883,
313,
11227,
1125,
3240,
6948,
263,
17998,
13373,
5410,
3220,
565,
5852,
29889,
13,
4706,
3800,
313,
11227,
1125,
960,
5852,
29892,
3639,
263,
13373,
5410,
3220,
29889,
13,
4706,
3402,
313,
1807,
1125,
851,
615,
603,
304,
6088,
931,
29892,
8087,
11860,
29881,
22584,
29885,
22584,
29979,
1642,
13,
4706,
2684,
313,
11227,
1125,
960,
5852,
29892,
1996,
385,
2684,
3402,
1993,
29889,
13,
4706,
5190,
313,
1807,
29892,
2322,
525,
1983,
29374,
5190,
310,
278,
1852,
29889,
13,
4706,
10115,
29918,
12673,
29918,
4830,
313,
11227,
1125,
26460,
470,
451,
304,
10115,
278,
3402,
29889,
13,
4706,
3978,
313,
1807,
1125,
22402,
278,
3407,
2635,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
5167,
7111,
373,
1881,
29901,
13,
13,
4706,
448,
1051,
29899,
4561,
29901,
13373,
5410,
3220,
13,
4706,
448,
10488,
29901,
10488,
310,
12865,
29953,
29946,
26688,
13,
4706,
448,
17336,
29901,
7870,
7416,
13,
1678,
9995,
13,
1678,
565,
451,
338,
8758,
29898,
1191,
29892,
313,
17271,
29892,
10488,
22164,
13,
4706,
736,
11701,
29889,
517,
29918,
12673,
29898,
13,
9651,
1852,
29892,
13,
9651,
4436,
29922,
12523,
29892,
13,
9651,
2462,
4102,
29922,
3250,
4102,
29892,
13,
9651,
1629,
4102,
29922,
6360,
4102,
29892,
13,
9651,
3477,
29883,
29922,
329,
29883,
29892,
13,
9651,
3402,
29922,
4830,
29892,
13,
9651,
2684,
29922,
735,
627,
29892,
13,
9651,
5190,
29922,
5441,
29892,
13,
9651,
10115,
29918,
12673,
29918,
4830,
29922,
262,
571,
29918,
12673,
29918,
4830,
29892,
13,
9651,
3978,
29922,
12574,
29892,
13,
9651,
7090,
29922,
8173,
29892,
13,
4706,
1723,
13,
1678,
736,
1852,
3032,
4381,
29918,
517,
29918,
15112,
29898,
13,
4706,
11701,
29889,
517,
29918,
12673,
29892,
13,
4706,
4436,
29922,
12523,
29892,
13,
4706,
2462,
4102,
29922,
3250,
4102,
29892,
13,
4706,
1629,
4102,
29922,
6360,
4102,
29892,
13,
4706,
3477,
29883,
29922,
329,
29883,
29892,
13,
4706,
3402,
29922,
4830,
29892,
13,
4706,
2684,
29922,
735,
627,
29892,
13,
4706,
5190,
29922,
5441,
29892,
13,
4706,
10115,
29918,
12673,
29918,
4830,
29922,
262,
571,
29918,
12673,
29918,
4830,
29892,
13,
4706,
3978,
29922,
12574,
29892,
13,
4706,
7090,
29922,
8173,
29892,
13,
1678,
1723,
13,
2
] |
tests/test_gpreg.py | cdgreenidge/gdec | 0 | 12283 | <filename>tests/test_gpreg.py
"""Test gpreg.py."""
from typing import Tuple
import numpy as np
import pytest
from gdec import gpreg, npgp
@pytest.fixture(scope="module")
def dataset() -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
np.random.seed(42)
amplitude = 1.0
lengthscale = 12
sigma = 0.5
n = 128
def spectrum_fn(w: np.ndarray) -> np.ndarray:
return npgp.rbf_spectrum(w, amplitude, lengthscale)
basis, freqs = npgp.real_fourier_basis(n)
coef_vars = npgp.rbf_spectrum(freqs, amplitude, lengthscale)
z = np.arange(n)
w = np.sqrt(coef_vars) * np.random.randn(n)
f = basis @ w
x = z.repeat(1)
f_x = f.repeat(1)
y = sigma * np.random.randn(*f_x.shape) + f_x
return x[:, None], y, z[:, None], f
def test_you_can_train_periodic_gp_regression_on_the_synthetic_dataset(dataset):
X, y, z, f = dataset
grid_size = np.unique(X).size
model = gpreg.PeriodicGPRegression()
model.fit(X, y, grid_size=grid_size)
f_est = model.predict(z)
error = np.max(np.abs(f - f_est))
assert error < 0.3
def test_training_pid_on_float_dataset_raises_value_error(dataset):
X, y, _, _ = dataset
X = X.astype(np.float32)
grid_size = np.unique(X).size
model = gpreg.PeriodicGPRegression()
with pytest.raises(ValueError):
model.fit(X, y, grid_size=grid_size)
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
29887,
1457,
29887,
29889,
2272,
13,
15945,
29908,
3057,
330,
1457,
29887,
29889,
2272,
1213,
15945,
13,
3166,
19229,
1053,
12603,
552,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11451,
1688,
13,
13,
3166,
330,
7099,
1053,
330,
1457,
29887,
29892,
302,
4061,
29886,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
6078,
543,
5453,
1159,
13,
1753,
8783,
580,
1599,
12603,
552,
29961,
9302,
29889,
299,
2378,
29892,
7442,
29889,
299,
2378,
29892,
7442,
29889,
299,
2378,
29892,
7442,
29889,
299,
2378,
5387,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
29946,
29906,
29897,
13,
1678,
28347,
353,
29871,
29896,
29889,
29900,
13,
1678,
3309,
7052,
353,
29871,
29896,
29906,
13,
1678,
269,
2934,
353,
29871,
29900,
29889,
29945,
13,
1678,
302,
353,
29871,
29896,
29906,
29947,
13,
13,
1678,
822,
18272,
29918,
9144,
29898,
29893,
29901,
7442,
29889,
299,
2378,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
736,
302,
4061,
29886,
29889,
29878,
1635,
29918,
21494,
5848,
29898,
29893,
29892,
28347,
29892,
3309,
7052,
29897,
13,
13,
1678,
8405,
29892,
3005,
29939,
29879,
353,
302,
4061,
29886,
29889,
6370,
29918,
29888,
283,
4336,
29918,
6500,
275,
29898,
29876,
29897,
13,
1678,
1302,
1389,
29918,
16908,
353,
302,
4061,
29886,
29889,
29878,
1635,
29918,
21494,
5848,
29898,
29888,
7971,
29879,
29892,
28347,
29892,
3309,
7052,
29897,
13,
1678,
503,
353,
7442,
29889,
279,
927,
29898,
29876,
29897,
13,
13,
1678,
281,
353,
7442,
29889,
3676,
29898,
1111,
1389,
29918,
16908,
29897,
334,
7442,
29889,
8172,
29889,
9502,
29876,
29898,
29876,
29897,
13,
1678,
285,
353,
8405,
732,
281,
13,
13,
1678,
921,
353,
503,
29889,
14358,
29898,
29896,
29897,
13,
1678,
285,
29918,
29916,
353,
285,
29889,
14358,
29898,
29896,
29897,
13,
1678,
343,
353,
269,
2934,
334,
7442,
29889,
8172,
29889,
9502,
29876,
10456,
29888,
29918,
29916,
29889,
12181,
29897,
718,
285,
29918,
29916,
13,
1678,
736,
921,
7503,
29892,
6213,
1402,
343,
29892,
503,
7503,
29892,
6213,
1402,
285,
13,
13,
13,
1753,
1243,
29918,
6293,
29918,
3068,
29918,
14968,
29918,
19145,
293,
29918,
29887,
29886,
29918,
276,
11476,
29918,
265,
29918,
1552,
29918,
19274,
386,
7492,
29918,
24713,
29898,
24713,
1125,
13,
1678,
1060,
29892,
343,
29892,
503,
29892,
285,
353,
8783,
13,
1678,
6856,
29918,
2311,
353,
7442,
29889,
13092,
29898,
29990,
467,
2311,
13,
1678,
1904,
353,
330,
1457,
29887,
29889,
29853,
293,
19903,
4597,
23881,
580,
13,
1678,
1904,
29889,
9202,
29898,
29990,
29892,
343,
29892,
6856,
29918,
2311,
29922,
7720,
29918,
2311,
29897,
13,
1678,
285,
29918,
342,
353,
1904,
29889,
27711,
29898,
29920,
29897,
13,
1678,
1059,
353,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29888,
448,
285,
29918,
342,
876,
13,
1678,
4974,
1059,
529,
29871,
29900,
29889,
29941,
13,
13,
13,
1753,
1243,
29918,
26495,
29918,
5935,
29918,
265,
29918,
7411,
29918,
24713,
29918,
336,
4637,
29918,
1767,
29918,
2704,
29898,
24713,
1125,
13,
1678,
1060,
29892,
343,
29892,
17117,
903,
353,
8783,
13,
1678,
1060,
353,
1060,
29889,
579,
668,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
1678,
6856,
29918,
2311,
353,
7442,
29889,
13092,
29898,
29990,
467,
2311,
13,
1678,
1904,
353,
330,
1457,
29887,
29889,
29853,
293,
19903,
4597,
23881,
580,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
4706,
1904,
29889,
9202,
29898,
29990,
29892,
343,
29892,
6856,
29918,
2311,
29922,
7720,
29918,
2311,
29897,
13,
2
] |
evaluate.py | OlinSTEP/silent_speech | 0 | 144329 | import sys
import os
import logging
import torch
from torch import nn
from transduction_model import test, save_output, Model
from read_emg import EMGDataset
from asr import evaluate
from data_utils import phoneme_inventory, print_confusion
from absl import flags
FLAGS = flags.FLAGS
flags.DEFINE_list('models', [], 'identifiers of models to evaluate')
class EnsembleModel(nn.Module):
def __init__(self, models):
super().__init__()
self.models = nn.ModuleList(models)
def forward(self, x, x_raw, sess):
ys = []
ps = []
for model in self.models:
y, p = model(x, x_raw, sess)
ys.append(y)
ps.append(p)
return torch.stack(ys,0).mean(0), torch.stack(ps,0).mean(0)
def main():
os.makedirs(FLAGS.output_directory, exist_ok=True)
logging.basicConfig(handlers=[
logging.FileHandler(os.path.join(FLAGS.output_directory, 'eval_log.txt'), 'w'),
logging.StreamHandler()
], level=logging.INFO, format="%(message)s")
testset = EMGDataset(test=True)
device = 'cuda' if torch.cuda.is_available() and not FLAGS.debug else 'cpu'
models = []
for fname in FLAGS.models:
state_dict = torch.load(fname)
n_sess = 1 if FLAGS.no_session_embed else state_dict["session_emb.weight"].size(0)
model = Model(testset.num_features, testset.num_speech_features, len(phoneme_inventory), n_sess).to(device)
model.load_state_dict(state_dict)
models.append(model)
ensemble = EnsembleModel(models)
_, _, confusion = test(ensemble, testset, device)
print_confusion(confusion)
for i, datapoint in enumerate(testset):
save_output(ensemble, datapoint, os.path.join(FLAGS.output_directory, f'example_output_{i}.wav'), device)
evaluate(testset, FLAGS.output_directory)
if __name__ == "__main__":
FLAGS(sys.argv)
main()
| [
1,
1053,
10876,
13,
5215,
2897,
13,
5215,
12183,
13,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
1053,
302,
29876,
13,
13,
3166,
1301,
700,
428,
29918,
4299,
1053,
1243,
29892,
4078,
29918,
4905,
29892,
8125,
13,
3166,
1303,
29918,
331,
29887,
1053,
27295,
29954,
16390,
24541,
13,
3166,
408,
29878,
1053,
14707,
13,
3166,
848,
29918,
13239,
1053,
1374,
265,
2004,
29918,
262,
23886,
29892,
1596,
29918,
5527,
3958,
13,
13,
3166,
633,
2536,
1053,
13449,
13,
18823,
10749,
353,
13449,
29889,
18823,
10749,
13,
15764,
29889,
24405,
8895,
29918,
1761,
877,
9794,
742,
19997,
525,
1693,
14903,
310,
4733,
304,
14707,
1495,
13,
13,
1990,
22521,
6967,
3195,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4733,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
9794,
353,
302,
29876,
29889,
7355,
1293,
29898,
9794,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
921,
29918,
1610,
29892,
27937,
1125,
13,
4706,
343,
29879,
353,
5159,
13,
4706,
6529,
353,
5159,
13,
4706,
363,
1904,
297,
1583,
29889,
9794,
29901,
13,
9651,
343,
29892,
282,
353,
1904,
29898,
29916,
29892,
921,
29918,
1610,
29892,
27937,
29897,
13,
9651,
343,
29879,
29889,
4397,
29898,
29891,
29897,
13,
9651,
6529,
29889,
4397,
29898,
29886,
29897,
13,
4706,
736,
4842,
305,
29889,
1429,
29898,
952,
29892,
29900,
467,
12676,
29898,
29900,
511,
4842,
305,
29889,
1429,
29898,
567,
29892,
29900,
467,
12676,
29898,
29900,
29897,
13,
13,
1753,
1667,
7295,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
18823,
10749,
29889,
4905,
29918,
12322,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
1678,
12183,
29889,
16121,
3991,
29898,
3179,
9306,
11759,
13,
9651,
12183,
29889,
2283,
4598,
29898,
359,
29889,
2084,
29889,
7122,
29898,
18823,
10749,
29889,
4905,
29918,
12322,
29892,
525,
14513,
29918,
1188,
29889,
3945,
5477,
525,
29893,
5477,
13,
9651,
12183,
29889,
3835,
4598,
580,
13,
9651,
21251,
3233,
29922,
21027,
29889,
11690,
29892,
3402,
543,
29995,
29898,
4906,
29897,
29879,
1159,
13,
13,
1678,
1243,
842,
353,
27295,
29954,
16390,
24541,
29898,
1688,
29922,
5574,
29897,
13,
13,
1678,
4742,
353,
525,
29883,
6191,
29915,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
322,
451,
383,
4375,
10749,
29889,
8382,
1683,
525,
21970,
29915,
13,
13,
1678,
4733,
353,
5159,
13,
1678,
363,
285,
978,
297,
383,
4375,
10749,
29889,
9794,
29901,
13,
4706,
2106,
29918,
8977,
353,
4842,
305,
29889,
1359,
29898,
29888,
978,
29897,
13,
4706,
302,
29918,
29879,
404,
353,
29871,
29896,
565,
383,
4375,
10749,
29889,
1217,
29918,
7924,
29918,
17987,
1683,
2106,
29918,
8977,
3366,
7924,
29918,
1590,
29889,
7915,
16862,
2311,
29898,
29900,
29897,
13,
4706,
1904,
353,
8125,
29898,
1688,
842,
29889,
1949,
29918,
22100,
29892,
1243,
842,
29889,
1949,
29918,
5965,
5309,
29918,
22100,
29892,
7431,
29898,
17607,
2004,
29918,
262,
23886,
511,
302,
29918,
29879,
404,
467,
517,
29898,
10141,
29897,
13,
4706,
1904,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
3859,
29918,
8977,
29897,
13,
4706,
4733,
29889,
4397,
29898,
4299,
29897,
13,
1678,
21285,
353,
22521,
6967,
3195,
29898,
9794,
29897,
13,
13,
1678,
17117,
17117,
14679,
353,
1243,
29898,
24031,
29892,
1243,
842,
29892,
4742,
29897,
13,
1678,
1596,
29918,
5527,
3958,
29898,
5527,
3958,
29897,
13,
13,
1678,
363,
474,
29892,
1418,
481,
2461,
297,
26985,
29898,
1688,
842,
1125,
13,
418,
4078,
29918,
4905,
29898,
24031,
29892,
1418,
481,
2461,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
18823,
10749,
29889,
4905,
29918,
12322,
29892,
285,
29915,
4773,
29918,
4905,
648,
29875,
1836,
29893,
485,
5477,
4742,
29897,
13,
13,
1678,
14707,
29898,
1688,
842,
29892,
383,
4375,
10749,
29889,
4905,
29918,
12322,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
383,
4375,
10749,
29898,
9675,
29889,
19218,
29897,
13,
1678,
1667,
580,
13,
2
] |
RNAPuzzles/RNAPuzzles/settings.py | whinyadventure/RNA-Puzzles | 0 | 174781 | """
Django settings for RNAPuzzles project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv("SECRET_KEY", '<KEY>')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv("DEBUG", "False") == "True"
ALLOWED_HOSTS = ["127.0.0.1", "django-service"]
LOGOUT_REDIRECT_URL = '/'
DOMAIN_URL = "lepus.cs.put.poznan.pl"
LOGIN_URL = "/accounts/signin/"
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'martor',
'crispy_forms',
'guardian',
'publications',
'captcha',
'tempus_dominus',
'rnapuzzles',
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # default
'guardian.backends.ObjectPermissionBackend',
)
ANONYMOUS_USER_NAME = "<EMAIL>"
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'rnapuzzles.middleware.request.GuardianAuthenticationMiddleware',
]
ROOT_URLCONF = 'RNAPuzzles.urls'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "rnapuzzles/templates")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'RNAPuzzles.wsgi.application'
AUTH_USER_MODEL = 'rnapuzzles.CustomUser'
if os.getenv("EMAIL_HOST_USER") and os.getenv("EMAIL_HOST_PASSWORD"):
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER",False)
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD",False)
else:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
messages.DEBUG: 'alert-info',
messages.INFO: 'alert-info',
messages.SUCCESS: 'alert-success',
messages.WARNING: 'alert-warning',
messages.ERROR: 'alert-danger',
}
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.getenv("DB_NAME", 'rna'),
'USER': os.getenv("DB_USER",'postgres'),
'PASSWORD': os.getenv("DB_PASSWORD",'password'),
'HOST': os.getenv("DB_HOST", 'localhost'),
'PORT': os.getenv("DB_PORT", '5432'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
#LANGUAGE_CODE = 'en-GB'
TIME_ZONE = 'CET'
#USE_I18N = True
USE_L10N = False
USE_TZ = True
DATETIME_FORMAT = 'd M Y, H:i '
DATETIME_INPUT_FORMATS = ['%d-%m-%Y %H:%M']
TEMPUS_DOMINUS_LOCALIZE = False
TEMPUS_DOMINUS_INCLUDE_ASSETS = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = "/var/www/html/"#os.path.join(PROJECT_ROOT, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_SUBMISSIONS = "submissions"
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "rnapuzzles/static"),
)
# Global martor settings
# Input: string boolean, `true/false`
MARTOR_ENABLE_CONFIGS = {
'imgur': 'false', # to enable/disable imgur/custom uploader.
'mention': 'false', # to enable/disable mention
'jquery': 'true', # to include/revoke jquery (require for admin default django)
'living': 'false', # to enable/disable live updates in preview
'spellcheck': 'true',
}
# To setup the martor editor with label or not (default is False)
MARTOR_ENABLE_LABEL = True
# Imgur API Keys
MARTOR_IMGUR_CLIENT_ID = 'your-client-id'
MARTOR_IMGUR_API_KEY = 'your-api-key'
# Safe Mode
MARTOR_MARKDOWN_SAFE_MODE = True # default
# Markdownify
MARTOR_MARKDOWNIFY_FUNCTION = 'martor.utils.markdownify' # default
MARTOR_MARKDOWNIFY_URL = '/martor/markdownify/' # default
# Markdown extensions (default)
MARTOR_MARKDOWN_EXTENSIONS = [
'markdown.extensions.extra',
'markdown.extensions.nl2br',
'markdown.extensions.smarty',
'markdown.extensions.fenced_code',
# Custom markdown extensions.
'martor.extensions.urlize',
'martor.extensions.del_ins', # ~~strikethrough~~ and ++underscores++
'martor.extensions.mention', # to parse markdown mention
'martor.extensions.emoji', # to parse markdown emoji
'martor.extensions.mdx_video', # to parse embed/iframe video
]
# Markdown Extensions Configs
MARTOR_MARKDOWN_EXTENSION_CONFIGS = {}
# Markdown urls
MARTOR_UPLOAD_URL = '/martor/uploader/' # default
MARTOR_SEARCH_USERS_URL = '/martor/search-user/' # default
# Markdown Extensions
# MARTOR_MARKDOWN_BASE_EMOJI_URL = 'https://www.webfx.com/tools/emoji-cheat-sheet/graphics/emojis/' # from webfx
MARTOR_MARKDOWN_BASE_EMOJI_URL = 'https://github.githubassets.com/images/icons/emoji/' # default from github
MARTOR_MARKDOWN_BASE_MENTION_URL = 'https://python.web.id/author/'
SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
# RabbitMq
CELERY_BROKER_URL = 'amqp://{user}:{password}@{host}:{port}'.format(
host=os.getenv('RABBITMQ_HOST', 'localhost'),
port=os.getenv('RABBITMQ_PORT', '5672'),
user=os.getenv("RABBITMQ_USER", "user"),
password=os.getenv("RABBITMQ_PASSWORD", "password")
)
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
| [
1,
9995,
13,
29928,
5364,
6055,
363,
390,
29940,
3301,
18813,
793,
2060,
29889,
13,
13,
24565,
491,
525,
14095,
29899,
6406,
1369,
4836,
29915,
773,
15337,
29871,
29906,
29889,
29906,
29889,
13,
13,
2831,
901,
2472,
373,
445,
934,
29892,
1074,
13,
991,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
3332,
1199,
29914,
11027,
29914,
13,
13,
2831,
278,
2989,
1051,
310,
6055,
322,
1009,
1819,
29892,
1074,
13,
991,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
999,
29914,
11027,
29914,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
13,
29937,
8878,
10898,
2768,
278,
2060,
763,
445,
29901,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
9464,
29892,
29757,
13,
25416,
29918,
9464,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
4961,
13,
13,
13,
29937,
26141,
29899,
2962,
5849,
6055,
448,
443,
2146,
8270,
363,
5802,
13,
29937,
2823,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
3525,
517,
29914,
16519,
358,
29914,
3198,
1761,
29914,
13,
13,
29937,
3725,
22484,
11937,
399,
25614,
29901,
3013,
278,
7035,
1820,
1304,
297,
5802,
7035,
29991,
13,
1660,
22245,
29911,
29918,
10818,
353,
2897,
29889,
657,
6272,
703,
1660,
22245,
29911,
29918,
10818,
613,
12801,
10818,
29958,
1495,
13,
13,
29937,
3725,
22484,
11937,
399,
25614,
29901,
1016,
29915,
29873,
1065,
411,
4744,
6077,
373,
297,
5802,
29991,
13,
18525,
353,
2897,
29889,
657,
6272,
703,
18525,
613,
376,
8824,
1159,
1275,
376,
5574,
29908,
13,
13,
1964,
27998,
3352,
29918,
20832,
29903,
353,
6796,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
613,
376,
14095,
29899,
5509,
3108,
13,
14480,
12015,
29918,
1525,
4571,
26282,
29918,
4219,
353,
8207,
29915,
13,
3970,
29032,
29918,
4219,
353,
376,
280,
13364,
29889,
2395,
29889,
649,
29889,
1129,
3749,
273,
29889,
572,
29908,
13,
14480,
1177,
29918,
4219,
353,
5591,
10149,
29879,
29914,
4530,
262,
12975,
13,
13,
29937,
8427,
5023,
13,
13,
25580,
1964,
20566,
29918,
3301,
7024,
353,
518,
13,
1678,
525,
14095,
29889,
21570,
29889,
6406,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
5150,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
3051,
8768,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
29879,
10964,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
19158,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
7959,
5325,
742,
13,
1678,
525,
28402,
272,
742,
13,
1678,
525,
29883,
3780,
2272,
29918,
9514,
742,
13,
1678,
525,
17728,
713,
742,
13,
1678,
525,
3597,
800,
742,
13,
1678,
525,
17885,
5815,
742,
13,
1678,
525,
7382,
375,
29918,
3129,
13419,
742,
13,
1678,
525,
29878,
8971,
18813,
793,
742,
13,
29962,
13,
13,
11341,
3235,
20055,
29918,
4330,
3580,
29931,
3040,
29918,
29925,
11375,
353,
525,
8704,
29946,
29915,
13,
13,
20656,
29950,
3919,
28541,
29918,
29933,
11375,
1430,
8452,
353,
313,
13,
13,
1678,
525,
14095,
29889,
21570,
29889,
5150,
29889,
1627,
1975,
29889,
3195,
5841,
355,
742,
29871,
396,
2322,
13,
1678,
525,
17728,
713,
29889,
1627,
1975,
29889,
2061,
27293,
5841,
355,
742,
13,
29897,
13,
13,
2190,
1164,
29979,
6720,
3308,
29918,
11889,
29918,
5813,
353,
9872,
26862,
6227,
11903,
13,
13,
29924,
1367,
29928,
1307,
12982,
1525,
353,
518,
13,
1678,
525,
14095,
29889,
17662,
2519,
29889,
8926,
29889,
13228,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
29879,
10964,
29889,
17662,
2519,
29889,
7317,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
17662,
2519,
29889,
9435,
29889,
18877,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
17662,
2519,
29889,
2395,
9600,
29889,
29907,
29879,
9600,
1043,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
5150,
29889,
17662,
2519,
29889,
16746,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
19158,
29889,
17662,
2519,
29889,
3728,
25411,
2519,
742,
13,
1678,
525,
14095,
29889,
17662,
2519,
29889,
3808,
21452,
292,
29889,
29990,
4308,
5856,
25411,
2519,
742,
13,
1678,
525,
29878,
8971,
18813,
793,
29889,
17662,
2519,
29889,
3827,
29889,
9485,
538,
713,
16746,
25411,
2519,
742,
13,
29962,
13,
13,
21289,
29918,
4219,
6007,
29943,
353,
525,
29934,
29940,
3301,
18813,
793,
29889,
26045,
29915,
13,
13,
4330,
3580,
29931,
3040,
29918,
29428,
23598,
353,
313,
13,
1678,
525,
14095,
29889,
6886,
29889,
1359,
414,
29889,
5325,
973,
29889,
10036,
742,
13,
1678,
525,
14095,
29889,
6886,
29889,
1359,
414,
29889,
932,
29918,
11851,
3842,
29889,
10036,
742,
13,
29897,
13,
13,
4330,
3580,
29931,
1299,
2890,
353,
518,
13,
1678,
426,
13,
4706,
525,
29933,
11375,
11794,
2396,
525,
14095,
29889,
6886,
29889,
1627,
1975,
29889,
14095,
29889,
29928,
5364,
5776,
9884,
742,
13,
4706,
525,
9464,
29903,
2396,
518,
359,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
9464,
29892,
376,
29878,
8971,
18813,
793,
29914,
20943,
1159,
1402,
13,
4706,
525,
20576,
29918,
9464,
29903,
2396,
5852,
29892,
13,
4706,
525,
14094,
27946,
2396,
426,
13,
9651,
525,
4703,
29918,
5014,
943,
2396,
518,
13,
18884,
525,
14095,
29889,
6886,
29889,
4703,
29918,
5014,
943,
29889,
8382,
742,
13,
18884,
525,
14095,
29889,
6886,
29889,
4703,
29918,
5014,
943,
29889,
3827,
742,
13,
18884,
525,
14095,
29889,
21570,
29889,
5150,
29889,
4703,
29918,
5014,
943,
29889,
5150,
742,
13,
18884,
525,
14095,
29889,
21570,
29889,
19158,
29889,
4703,
29918,
5014,
943,
29889,
19158,
742,
13,
9651,
21251,
13,
4706,
2981,
13,
13,
1678,
2981,
13,
29962,
13,
13,
7811,
29954,
29902,
29918,
3301,
7390,
28541,
353,
525,
29934,
29940,
3301,
18813,
793,
29889,
5652,
3146,
29889,
6214,
29915,
13,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
353,
525,
29878,
8971,
18813,
793,
29889,
7281,
2659,
29915,
13,
13,
361,
2897,
29889,
657,
6272,
703,
26862,
6227,
29918,
20832,
29918,
11889,
1159,
322,
2897,
29889,
657,
6272,
703,
26862,
6227,
29918,
20832,
29918,
25711,
17013,
29908,
1125,
13,
1678,
382,
1529,
6227,
29918,
29933,
11375,
11794,
353,
525,
14095,
29889,
3221,
29889,
2549,
29889,
1627,
1975,
29889,
3844,
9392,
29889,
9823,
5841,
355,
29915,
13,
1678,
382,
1529,
6227,
29918,
20832,
353,
525,
3844,
9392,
29889,
21980,
29889,
510,
29915,
13,
1678,
382,
1529,
6227,
29918,
17171,
29918,
29911,
8547,
353,
5852,
13,
1678,
382,
1529,
6227,
29918,
15082,
353,
29871,
29945,
29947,
29955,
13,
1678,
382,
1529,
6227,
29918,
20832,
29918,
11889,
353,
2897,
29889,
657,
6272,
703,
26862,
6227,
29918,
20832,
29918,
11889,
613,
8824,
29897,
13,
1678,
382,
1529,
6227,
29918,
20832,
29918,
25711,
17013,
353,
2897,
29889,
657,
6272,
703,
26862,
6227,
29918,
20832,
29918,
25711,
17013,
613,
8824,
29897,
13,
2870,
29901,
13,
1678,
382,
1529,
6227,
29918,
29933,
11375,
11794,
353,
525,
14095,
29889,
3221,
29889,
2549,
29889,
1627,
1975,
29889,
11058,
29889,
9823,
5841,
355,
29915,
13,
13,
3166,
9557,
29889,
21570,
29889,
19158,
1053,
17727,
408,
7191,
13,
2303,
1799,
10461,
29918,
6040,
10749,
353,
426,
13,
1678,
7191,
29889,
18525,
29901,
525,
12888,
29899,
3888,
742,
13,
1678,
7191,
29889,
11690,
29901,
525,
12888,
29899,
3888,
742,
13,
1678,
7191,
29889,
14605,
26925,
29901,
525,
12888,
29899,
8698,
742,
13,
1678,
7191,
29889,
29956,
25614,
29901,
525,
12888,
29899,
27392,
742,
13,
1678,
7191,
29889,
11432,
29901,
525,
12888,
29899,
29881,
4600,
742,
13,
29913,
13,
13,
29937,
5470,
13,
29937,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
999,
29914,
11027,
8484,
29503,
2129,
13,
13,
25832,
27982,
29903,
353,
426,
13,
1678,
525,
4381,
2396,
426,
13,
4706,
525,
1430,
29954,
8895,
2396,
525,
14095,
29889,
2585,
29889,
1627,
1975,
29889,
29272,
29918,
567,
29891,
9708,
29887,
29906,
742,
13,
4706,
525,
5813,
2396,
2897,
29889,
657,
6272,
703,
4051,
29918,
5813,
613,
525,
29878,
1056,
5477,
13,
4706,
525,
11889,
2396,
2897,
29889,
657,
6272,
703,
4051,
29918,
11889,
613,
29915,
2490,
7201,
5477,
13,
4706,
525,
25711,
17013,
2396,
2897,
29889,
657,
6272,
703,
4051,
29918,
25711,
17013,
613,
29915,
5630,
5477,
13,
4706,
525,
20832,
2396,
2897,
29889,
657,
6272,
703,
4051,
29918,
20832,
613,
525,
7640,
5477,
13,
4706,
525,
15082,
2396,
2897,
29889,
657,
6272,
703,
4051,
29918,
15082,
613,
525,
29945,
29946,
29941,
29906,
5477,
13,
1678,
500,
13,
29913,
13,
13,
13,
29937,
25280,
8845,
13,
29937,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
999,
29914,
11027,
8484,
5150,
29899,
5630,
29899,
3084,
4097,
13,
13,
20656,
29950,
29918,
25711,
17013,
29918,
26707,
1299,
24125,
353,
518,
13,
1678,
426,
13,
4706,
525,
5813,
2396,
525,
14095,
29889,
21570,
29889,
5150,
29889,
5630,
29918,
18157,
29889,
2659,
6708,
8942,
2327,
537,
24204,
742,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
525,
5813,
2396,
525,
14095,
29889,
21570,
29889,
5150,
29889,
5630,
29918,
18157,
29889,
8140,
12539,
6513,
24204,
742,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
525,
5813,
2396,
525,
14095,
29889,
21570,
29889,
5150,
29889,
5630,
29918,
18157,
29889,
18877,
10048,
24204,
742,
13,
1678,
2981,
13,
1678,
426,
13,
4706,
525,
5813,
2396,
525,
14095,
29889,
21570,
29889,
5150,
29889,
5630,
29918,
18157,
29889,
29940,
25099,
10048,
24204,
742,
13,
1678,
2981,
13,
29962,
13,
13,
13,
29937,
4623,
2133,
13,
29937,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
3332,
1199,
29914,
29875,
29896,
29947,
29876,
29914,
13,
13,
29937,
29931,
19453,
29965,
10461,
29918,
16524,
353,
525,
264,
29899,
7210,
29915,
13,
13,
15307,
29918,
29999,
12413,
353,
525,
29907,
2544,
29915,
13,
13,
29937,
17171,
29918,
29902,
29896,
29947,
29940,
353,
5852,
13,
13,
17171,
29918,
29931,
29896,
29900,
29940,
353,
7700,
13,
13,
17171,
29918,
29911,
29999,
353,
5852,
13,
13,
25832,
2544,
8890,
29918,
19094,
1299,
353,
525,
29881,
341,
612,
29892,
379,
29901,
29875,
525,
13,
25832,
2544,
8890,
29918,
1177,
12336,
29918,
19094,
1299,
29903,
353,
6024,
29995,
29881,
19222,
29885,
19222,
29979,
1273,
29950,
16664,
29924,
2033,
13,
13,
4330,
3580,
3308,
29918,
3970,
16173,
3308,
29918,
16652,
1964,
29902,
10721,
353,
7700,
13,
4330,
3580,
3308,
29918,
3970,
16173,
3308,
29918,
1177,
6154,
29965,
2287,
29918,
3289,
1660,
9375,
353,
5852,
13,
13,
13,
29937,
624,
2454,
2066,
313,
19407,
29892,
8286,
29892,
1954,
1179,
29897,
13,
29937,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
29906,
29889,
29906,
29914,
3525,
517,
29914,
7959,
29899,
5325,
29914,
13,
8618,
17637,
29918,
21289,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
876,
13,
13,
17816,
2965,
29918,
4219,
353,
8207,
7959,
22208,
13,
17816,
2965,
29918,
21289,
353,
5591,
1707,
29914,
1636,
29914,
1420,
12975,
29937,
359,
29889,
2084,
29889,
7122,
29898,
8618,
17637,
29918,
21289,
29892,
525,
7959,
1495,
13,
13,
2303,
4571,
29909,
29918,
4219,
353,
8207,
9799,
22208,
13,
2303,
4571,
29909,
29918,
21289,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
9464,
29892,
525,
9799,
1495,
13,
2303,
4571,
29909,
29918,
20633,
10403,
13507,
29903,
353,
376,
1491,
29885,
6847,
29908,
13,
13,
17816,
2965,
24483,
29918,
29943,
1177,
8032,
29903,
353,
313,
13,
1678,
525,
14095,
29889,
21570,
29889,
7959,
5325,
29889,
2886,
414,
29889,
2283,
3924,
29943,
4995,
742,
13,
1678,
525,
14095,
29889,
21570,
29889,
7959,
5325,
29889,
2886,
414,
29889,
2052,
17392,
3842,
29943,
4995,
742,
13,
29937,
1678,
525,
14095,
29889,
21570,
29889,
7959,
5325,
29889,
2886,
414,
29889,
4592,
10486,
29943,
4995,
742,
13,
29897,
13,
13,
17816,
2965,
24483,
29918,
9464,
29903,
353,
313,
13,
1678,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
9464,
29892,
376,
29878,
8971,
18813,
793,
29914,
7959,
4968,
13,
29897,
13,
13,
29937,
12002,
14436,
272,
6055,
13,
29937,
10567,
29901,
1347,
7223,
29892,
421,
3009,
29914,
4541,
29952,
13,
1529,
13079,
1955,
29918,
1430,
6181,
29918,
6007,
3738,
10749,
353,
426,
13,
1678,
525,
3320,
2396,
525,
4541,
742,
268,
396,
304,
9025,
29914,
20472,
10153,
332,
29914,
6341,
6441,
261,
29889,
13,
1678,
525,
358,
291,
2396,
525,
4541,
742,
29871,
396,
304,
9025,
29914,
20472,
3585,
13,
1678,
525,
5880,
2396,
525,
3009,
742,
1678,
396,
304,
3160,
29914,
276,
5744,
5804,
313,
12277,
363,
4113,
2322,
9557,
29897,
13,
1678,
525,
29880,
4357,
2396,
525,
4541,
742,
259,
396,
304,
9025,
29914,
20472,
5735,
11217,
297,
25267,
13,
1678,
525,
1028,
514,
3198,
2396,
525,
3009,
742,
13,
29913,
13,
13,
29937,
1763,
6230,
278,
14436,
272,
6920,
411,
3858,
470,
451,
313,
4381,
338,
7700,
29897,
13,
1529,
13079,
1955,
29918,
1430,
6181,
29918,
24461,
6670,
353,
5852,
13,
13,
29937,
1954,
29887,
332,
3450,
4813,
952,
13,
1529,
13079,
1955,
29918,
7833,
29954,
4574,
29918,
27205,
3919,
29918,
1367,
353,
525,
8066,
29899,
4645,
29899,
333,
29915,
13,
1529,
13079,
1955,
29918,
7833,
29954,
4574,
29918,
8787,
29918,
10818,
353,
525,
8066,
29899,
2754,
29899,
1989,
29915,
13,
13,
29937,
5701,
1725,
21864,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
29903,
5098,
29923,
29918,
20387,
353,
5852,
396,
2322,
13,
13,
29937,
4485,
3204,
1598,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
6545,
29979,
29918,
29943,
28700,
353,
525,
28402,
272,
29889,
13239,
29889,
3502,
3204,
1598,
29915,
396,
2322,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
6545,
29979,
29918,
4219,
353,
8207,
28402,
272,
29914,
3502,
3204,
1598,
22208,
396,
2322,
13,
13,
29937,
4485,
3204,
17752,
313,
4381,
29897,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
12194,
1430,
13381,
29903,
353,
518,
13,
1678,
525,
3502,
3204,
29889,
24299,
29889,
17833,
742,
13,
1678,
525,
3502,
3204,
29889,
24299,
29889,
12938,
29906,
1182,
742,
13,
1678,
525,
3502,
3204,
29889,
24299,
29889,
3844,
442,
29891,
742,
13,
1678,
525,
3502,
3204,
29889,
24299,
29889,
29888,
9223,
29918,
401,
742,
13,
13,
1678,
396,
8701,
2791,
3204,
17752,
29889,
13,
1678,
525,
28402,
272,
29889,
24299,
29889,
2271,
675,
742,
13,
1678,
525,
28402,
272,
29889,
24299,
29889,
6144,
29918,
1144,
742,
1678,
396,
3695,
30022,
303,
5357,
621,
10573,
7377,
322,
8445,
870,
414,
29883,
2361,
1817,
13,
1678,
525,
28402,
272,
29889,
24299,
29889,
358,
291,
742,
1678,
396,
304,
6088,
2791,
3204,
3585,
13,
1678,
525,
28402,
272,
29889,
24299,
29889,
15810,
2397,
742,
418,
396,
304,
6088,
2791,
3204,
953,
29877,
2397,
13,
1678,
525,
28402,
272,
29889,
24299,
29889,
3487,
29916,
29918,
9641,
742,
29871,
396,
304,
6088,
8297,
29914,
22000,
4863,
13,
29962,
13,
13,
29937,
4485,
3204,
7338,
5580,
12782,
29879,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
12194,
1430,
13381,
29918,
6007,
3738,
10749,
353,
6571,
13,
13,
29937,
4485,
3204,
23942,
13,
1529,
13079,
1955,
29918,
4897,
29428,
29918,
4219,
353,
8207,
28402,
272,
29914,
9009,
261,
22208,
396,
2322,
13,
1529,
13079,
1955,
29918,
1660,
1718,
3210,
29918,
11889,
29903,
29918,
4219,
353,
8207,
28402,
272,
29914,
4478,
29899,
1792,
22208,
396,
2322,
13,
13,
29937,
4485,
3204,
7338,
5580,
13,
29937,
341,
8322,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
25416,
29918,
29923,
6720,
29967,
29902,
29918,
4219,
353,
525,
991,
597,
1636,
29889,
705,
1635,
29916,
29889,
510,
29914,
8504,
29914,
15810,
2397,
29899,
1173,
271,
29899,
9855,
29914,
6420,
29914,
331,
3848,
275,
22208,
268,
396,
515,
591,
1635,
29916,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
25416,
29918,
29923,
6720,
29967,
29902,
29918,
4219,
353,
525,
991,
597,
3292,
29889,
3292,
16596,
29889,
510,
29914,
8346,
29914,
27078,
29914,
15810,
2397,
22208,
462,
29871,
396,
2322,
515,
18546,
13,
1529,
13079,
1955,
29918,
1529,
29934,
29968,
3970,
16048,
29918,
25416,
29918,
13780,
2725,
29918,
4219,
353,
525,
991,
597,
4691,
29889,
2676,
29889,
333,
29914,
8921,
22208,
13,
13,
5425,
1307,
15868,
3352,
29918,
14816,
1254,
12665,
29918,
3210,
16658,
29903,
353,
6024,
17885,
5815,
29889,
276,
17885,
5815,
29918,
1688,
29918,
1989,
29918,
2704,
2033,
13,
13,
13,
29937,
16155,
2966,
29924,
29939,
13,
4741,
29931,
24422,
29918,
29933,
1672,
29968,
1001,
29918,
4219,
353,
525,
314,
29939,
29886,
597,
29912,
1792,
6177,
29912,
5630,
29913,
28312,
3069,
6177,
29912,
637,
29913,
4286,
4830,
29898,
13,
1678,
3495,
29922,
359,
29889,
657,
6272,
877,
29934,
2882,
22698,
25566,
29918,
20832,
742,
525,
7640,
5477,
13,
1678,
2011,
29922,
359,
29889,
657,
6272,
877,
29934,
2882,
22698,
25566,
29918,
15082,
742,
525,
29945,
29953,
29955,
29906,
5477,
13,
1678,
1404,
29922,
359,
29889,
657,
6272,
703,
29934,
2882,
22698,
25566,
29918,
11889,
613,
376,
1792,
4968,
13,
1678,
4800,
29922,
359,
29889,
657,
6272,
703,
29934,
2882,
22698,
25566,
29918,
25711,
17013,
613,
376,
5630,
1159,
13,
29897,
13,
13,
13,
13,
4741,
29931,
24422,
29918,
2477,
4741,
7982,
29918,
22412,
3919,
353,
6024,
6214,
29914,
3126,
2033,
13,
4741,
29931,
24422,
29918,
29911,
3289,
29968,
29918,
6304,
25758,
26664,
1001,
353,
525,
3126,
29915,
13,
4741,
29931,
24422,
29918,
15989,
8647,
29918,
6304,
25758,
26664,
1001,
353,
525,
3126,
29915,
13,
2
] |
python/depthcharge/register/cp.py | youssefms/depthcharge | 0 | 61757 | # SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
Implements FDTCrashRegisterReader
"""
from ..operation import Operation
from .data_abort import DataAbortRegisterReader
class CpCrashRegisterReader(DataAbortRegisterReader):
"""
This is a :py:class:`~.DataAbortRegisterReader` that uses the ``cp``
console command to trigger the Data Abort used to read registers.
"""
_required = {
'arch': 'ARM',
'commands': ['cp'],
'crash_or_reboot': True,
}
@classmethod
def rank(cls, **_kwargs):
return 10
# This is by intent; we are not using another memory reader.
# pylint: disable=method-hidden
def _trigger_data_abort(self):
cmd = 'cp.l {addr:x} {addr:x} 1'.format(addr=self._crash_addr)
return self._ctx.send_command(cmd)
Operation.register(CpCrashRegisterReader)
| [
1,
396,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
350,
7230,
29899,
29941,
29899,
20216,
1509,
13,
29937,
10034,
386,
23367,
29901,
529,
991,
597,
3292,
29889,
510,
29914,
29876,
617,
2972,
29914,
19488,
23367,
29958,
13,
13,
15945,
29908,
13,
1888,
9711,
383,
29928,
9472,
29878,
1161,
15213,
6982,
13,
15945,
29908,
13,
13,
3166,
6317,
16453,
1053,
20462,
13,
3166,
869,
1272,
29918,
370,
441,
1053,
3630,
4920,
441,
15213,
6982,
13,
13,
13,
1990,
315,
29886,
20647,
1161,
15213,
6982,
29898,
1469,
4920,
441,
15213,
6982,
1125,
13,
1678,
9995,
13,
1678,
910,
338,
263,
584,
2272,
29901,
1990,
18078,
30022,
29889,
1469,
4920,
441,
15213,
6982,
29952,
393,
3913,
278,
4954,
6814,
16159,
13,
1678,
2991,
1899,
304,
7135,
278,
3630,
1976,
441,
1304,
304,
1303,
28975,
29889,
13,
1678,
9995,
13,
13,
1678,
903,
12403,
353,
426,
13,
4706,
525,
1279,
2396,
525,
1718,
29924,
742,
13,
4706,
525,
26381,
2396,
6024,
6814,
7464,
13,
4706,
525,
7283,
1161,
29918,
272,
29918,
276,
4777,
2396,
5852,
29892,
13,
1678,
500,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
7115,
29898,
25932,
29892,
3579,
29918,
19290,
1125,
13,
4706,
736,
29871,
29896,
29900,
13,
13,
1678,
396,
910,
338,
491,
7609,
29936,
591,
526,
451,
773,
1790,
3370,
9591,
29889,
13,
1678,
396,
282,
2904,
524,
29901,
11262,
29922,
5696,
29899,
10892,
13,
1678,
822,
903,
21001,
29918,
1272,
29918,
370,
441,
29898,
1311,
1125,
13,
4706,
9920,
353,
525,
6814,
29889,
29880,
426,
10030,
29901,
29916,
29913,
426,
10030,
29901,
29916,
29913,
29871,
29896,
4286,
4830,
29898,
10030,
29922,
1311,
3032,
7283,
1161,
29918,
10030,
29897,
13,
4706,
736,
1583,
3032,
13073,
29889,
6717,
29918,
6519,
29898,
9006,
29897,
13,
13,
13,
10925,
29889,
9573,
29898,
29907,
29886,
20647,
1161,
15213,
6982,
29897,
13,
2
] |
Day01-15/code/Day15/excel1.py | EngrSaad2/Python-100-Days | 6 | 44704 | <reponame>EngrSaad2/Python-100-Days<gh_stars>1-10
"""
创建Excel文件
Version: 0.1
Author: 骆昊
Date: 2018-03-26
"""
from openpyxl import Workbook
from openpyxl.worksheet.table import Table, TableStyleInfo
workbook = Workbook()
sheet = workbook.active
data = [
[1001, '白元芳', '男', '13123456789'],
[1002, '白洁', '女', '13233445566']
]
sheet.append(['学号', '姓名', '性别', '电话'])
for row in data:
sheet.append(row)
tab = Table(displayName="Table1", ref="A1:E5")
tab.tableStyleInfo = TableStyleInfo(
name="TableStyleMedium9", showFirstColumn=False,
showLastColumn=False, showRowStripes=True, showColumnStripes=True)
sheet.add_table(tab)
workbook.save('./res/全班学生数据.xlsx')
| [
1,
529,
276,
1112,
420,
29958,
2369,
629,
17618,
328,
29906,
29914,
11980,
29899,
29896,
29900,
29900,
29899,
25991,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
13,
31441,
30886,
22926,
30333,
30631,
13,
13,
6594,
29901,
29871,
29900,
29889,
29896,
13,
13720,
29901,
29871,
236,
173,
137,
233,
155,
141,
13,
2539,
29901,
29871,
29906,
29900,
29896,
29947,
29899,
29900,
29941,
29899,
29906,
29953,
13,
15945,
29908,
13,
3166,
1722,
2272,
15524,
1053,
5244,
2909,
13,
3166,
1722,
2272,
15524,
29889,
1287,
9855,
29889,
2371,
1053,
6137,
29892,
6137,
5568,
3401,
13,
13,
1287,
2909,
353,
5244,
2909,
580,
13,
9855,
353,
664,
2909,
29889,
4925,
13,
1272,
353,
518,
13,
1678,
518,
29896,
29900,
29900,
29896,
29892,
525,
30868,
30824,
235,
141,
182,
742,
525,
31203,
742,
525,
29896,
29941,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
7464,
13,
1678,
518,
29896,
29900,
29900,
29906,
29892,
525,
30868,
233,
183,
132,
742,
525,
30647,
742,
525,
29896,
29941,
29906,
29941,
29941,
29946,
29946,
29945,
29945,
29953,
29953,
2033,
13,
29962,
13,
9855,
29889,
4397,
18959,
30415,
30850,
742,
525,
232,
170,
150,
30548,
742,
525,
30952,
232,
139,
174,
742,
525,
31679,
31852,
11287,
13,
1454,
1948,
297,
848,
29901,
13,
1678,
9869,
29889,
4397,
29898,
798,
29897,
13,
3891,
353,
6137,
29898,
4990,
1170,
543,
3562,
29896,
613,
2143,
543,
29909,
29896,
29901,
29923,
29945,
1159,
13,
13,
3891,
29889,
2371,
5568,
3401,
353,
6137,
5568,
3401,
29898,
13,
1678,
1024,
543,
3562,
5568,
19302,
1974,
29929,
613,
1510,
6730,
4409,
29922,
8824,
29892,
13,
1678,
1510,
8897,
4409,
29922,
8824,
29892,
1510,
4301,
855,
374,
5547,
29922,
5574,
29892,
1510,
4409,
855,
374,
5547,
29922,
5574,
29897,
13,
9855,
29889,
1202,
29918,
2371,
29898,
3891,
29897,
13,
1287,
2909,
29889,
7620,
877,
6904,
690,
29914,
30753,
234,
146,
176,
30415,
30486,
30354,
30763,
29889,
20267,
29916,
1495,
13,
2
] |
playsound.py | Tony1527/playsound | 2 | 89492 | <reponame>Tony1527/playsound
class PlaysoundException(Exception):
pass
def _playsoundWin(sound, block = True):
'''
Utilizes windll.winmm. Tested and known to work with MP3 and WAVE on
Windows 7 with Python 2.7. Probably works with more file formats.
Probably works on Windows XP thru Windows 10. Probably works with all
versions of Python.
Inspired by (but not copied from) <NAME> <<EMAIL>>'s mp3play:
https://github.com/michaelgundlach/mp3play
I never would have tried using windll.winmm without seeing his code.
'''
from ctypes import c_buffer, windll
from random import random
from time import sleep
from sys import getfilesystemencoding
def winCommand(*command):
buf = c_buffer(255)
command = ' '.join(command).encode(getfilesystemencoding())
errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
if errorCode:
errorBuffer = c_buffer(255)
windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:'
'\n ' + command.decode() +
'\n ' + errorBuffer.value.decode())
raise PlaysoundException(exceptionMessage)
return buf.value
alias = 'playsound_' + str(random())
winCommand('open "' + sound + '" alias', alias)
winCommand('set', alias, 'time format milliseconds')
durationInMS = winCommand('status', alias, 'length')
winCommand('play', alias, 'from 0 to', durationInMS.decode())
if block:
sleep(float(durationInMS) / 1000.0)
def _playsoundOSX(sound, block = True):
'''
Utilizes AppKit.NSSound. Tested and known to work with MP3 and WAVE on
OS X 10.11 with Python 2.7. Probably works with anything QuickTime supports.
Probably works on OS X 10.5 and newer. Probably works with all versions of
Python.
Inspired by (but not copied from) Aaron's Stack Overflow answer here:
http://stackoverflow.com/a/34568298/901641
I never would have tried using AppKit.NSSound without seeing his code.
'''
from AppKit import NSSound
from Foundation import NSURL
from time import sleep
if '://' not in sound:
if not sound.startswith('/'):
from os import getcwd
sound = getcwd() + '/' + sound
sound = 'file://' + sound
url = NSURL.URLWithString_(sound)
nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, True)
if not nssound:
raise IOError('Unable to load sound named: ' + sound)
nssound.play()
if block:
sleep(nssound.duration())
def _playsoundNix(sound, block=True):
"""Play a sound using GStreamer.
Inspired by this:
https://gstreamer.freedesktop.org/documentation/tutorials/playback/playbin-usage.html
"""
if not block:
raise NotImplementedError(
"block=False cannot be used on this platform yet")
# pathname2url escapes non-URL-safe characters
import os
try:
from urllib.request import pathname2url
except ImportError:
# python 2
from urllib import pathname2url
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
playbin = Gst.ElementFactory.make('playbin', 'playbin')
if sound.startswith(('http://', 'https://')):
playbin.props.uri = sound
else:
playbin.props.uri = 'file://' + pathname2url(os.path.abspath(sound))
set_result = playbin.set_state(Gst.State.PLAYING)
if set_result != Gst.StateChangeReturn.ASYNC:
raise PlaysoundException(
"playbin.set_state returned " + repr(set_result))
# FIXME: use some other bus method than poll() with block=False
# https://lazka.github.io/pgi-docs/#Gst-1.0/classes/Bus.html
bus = playbin.get_bus()
bus.poll(Gst.MessageType.EOS, Gst.CLOCK_TIME_NONE)
playbin.set_state(Gst.State.NULL)
from platform import system
system = system()
if system == 'Windows':
playsound = _playsoundWin
elif system == 'Darwin':
playsound = _playsoundOSX
else:
playsound = _playsoundNix
del system
from ctypes import c_buffer, windll
from random import random
from time import sleep
from sys import getfilesystemencoding
def winCommand(*command):
buf = c_buffer(255)
command = ' '.join(command).encode(getfilesystemencoding())
errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
if errorCode:
errorBuffer = c_buffer(255)
windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:'
'\n ' + command.decode() +
'\n ' + errorBuffer.value.decode())
raise PlaysoundException(exceptionMessage)
return buf.value
from threading import Thread,Event,Lock
from queue import Queue,Empty
from collections import deque
'''
music class which uses windows mci to play the music
'''
class _music(object):
__alias=None
__running_idx=None
__sound=None
__start=None
__end=None
__is_repeat=False
__id=-1
music_list=None
'''
initialize the music object
'''
def __init__(self,sound,id):
self.__alias=['','']
self.__running_idx=0
self.__id=id
self.preload(sound)
def set_music_list(self,music_list):
self.music_list = music_list
def __eq__(self,value):
return self.__id==value
'''
clear the music object
music will be closed
'''
def close(self):
self.stop()
self.__clear()
'''
get id of music
music will not be affected
'''
def get_id(self):
return self.__id
'''
return whether music plays repeatly
music will not be affected
'''
def is_repeat(self):
return self.__is_repeat
'''
return the range from start to end
music will not be affected
'''
def length(self):
if self.__check_alias():
return self.__end-self.__start
'''
return the mode of the music object
music will not be affected
'''
def mode(self):
if self.__check_alias():
return winCommand('status',self.__get_alias(),'mode').decode()
'''
pause the music
music will be paused
'''
def pause(self):
if self.__check_alias():
winCommand('pause '+self.__get_alias())
'''
play the music from start to end
music will be playing
'''
def play(self,start=0,end=-1):
self.__start,self.__end=self.__parse_start_end(start,end,self.total_length())
self.__play_implement(self.__start,self.__end)
'''
return the position of the music
music will not be affected
'''
def position(self):
if self.__check_alias():
return int(winCommand('status',self.__get_alias(),'position').decode())
'''
preload the music information
'''
def preload(self,sound):
self.__sound=sound
for i in range(2):
self.__alias[i]='playsound_'+str(random())
winCommand('open "'+self.__sound+'" alias',self.__alias[i])
winCommand('set',self.__alias[i],'time format milliseconds')
length=self.total_length()
self.__start=0
self.__end=length
return length
'''
resume playing
music will be playing
'''
def resume(self):
if self.__check_alias():
if self.__is_repeat:
self.__play_implement(self.position(),self.__end)
else:
winCommand('resume '+self.__get_alias())
'''
seek the music to pos.
music will bee paused
'''
def seek(self,pos):
if self.__check_alias():
if pos>self.__end or pos<self.__start:
raise PlaysoundException('position exceed range')
winCommand('seek',self.__get_alias(),'to',str(pos))
winCommand('play',self.__get_alias(),'from '+ str(pos) +' to',str(self.__end))
self.pause()
'''
set repeat flag of the music
music will repeatly play
'''
def set_repeat(self,repeat):
self.__is_repeat=repeat
'''
set id for music object
music will not be affected
'''
def set_id(self,id):
self.__id=id
'''
stop the music.
music will be stopped
'''
def stop(self):
if self.__check_alias():
self.seek(self.__start)
winCommand('stop '+self.__get_alias())
'''
total_length of the music object, the difference that total_length is the range is total music,
but length is only range from start to end
music will not be affected
'''
def total_length(self):
if self.__check_alias():
return int(winCommand('status',self.__get_alias(),'length').decode())
'''
update the record time of the music,
'''
def update_mode(self,delay=0):
mod = self.mode()
if mod =='playing':
#if self.__end-self.position()<delay then repeat the music
if self.__is_repeat==True:
if self.__end-self.position()<=delay:
self.__running_idx=(self.__running_idx+1)%2
self.__play_implement(self.__start,self.__end)
return mod
def __get_alias(self):
return self.__alias[self.__running_idx]
def __check_alias(self):
if self.__get_alias()!='':
return True
def __parse_start_end(self,start,end,length):
if not (isinstance(start,int) and isinstance(end,int)):
raise PlaysoundException('start and end must be int')
_start=0
_end=0
if end==-1:
_end = length
elif end<=length:
_end = end
else:
raise PlaysoundException('music range exceed limits')
if start<0 or start>length:
raise PlaysoundException('music range exceed limits')
elif _end<start:
raise PlaysoundException('end must be bigger than start')
else:
_start=start
return _start,_end
def __del__(self):
self.__clear()
def __clear(self):
if self.__check_alias():
for i in range(2):
winCommand('close '+self.__alias[i])
self.__alias=['','']
self.__start=None
self.__end=None
self.__is_repeat=False
def __play_implement(self,start,end):
winCommand('play',self.__get_alias(),'from '+ str(start) +' to',str(end))
def print(self):
if self.__check_alias():
def format_miliseconds(t):
return '%d:%d:%d.%d'%(t//3600000,(t%3600000)//60000,(t%60000)//1000,t%1000)
print('music name:',self.__sound)
print('mode:',self.mode())
print('total_length:',self.total_length())
print('position:',str(self.position()))
print('start - end: {} - {}'.format(format_miliseconds(self.__start),format_miliseconds(self.__end)))
'''
singleton
'''
class _singleton(object):
_mutex=Lock()
def __init__(self):
pass
@classmethod
def GetInstance(cls,*args,**kwargs):
if not hasattr(cls,'_instance'):
cls._mutex.acquire()
if not hasattr(cls,'_instance'):
cls._instance = cls()
print('create instance',cls._instance)
cls._mutex.release()
return cls._instance
'''
music tag is used to send message for music manager
'''
class _music_tag(object):
id=-1 #id is the connection between music player and _music object
operator='' #operator of _music object
args=None #parameters
block_event=None
block=False
retval=None #return value for some methods of music player
music_list=None #special deal with music list
def __init__(self,id,operator,block=False,*args):
self.id=id
self.operator = operator
self.args = args
if block:
self.block_event=Event()
self.block=True
def set_music_list(self,music_list):
self.music_list = music_list
'''
music player is the client who sends music tags to music manager which indeed plays music.
music player controls music once you open the music.
'''
class music_player(object):
__id=-1 #identity of every _music object
__music=None #sound
static_id=0 #static variables
mutex=Lock() #lock of static_id
music_list=None #this music player belong to which music list
def __init__(self,music_list=None):
'''
if music player belongs to one of music list,then set music_list,
otherwise you can ignore music_list parameter
'''
self.music_list = music_list
def get_music(self):
'''
get name of sound
'''
return self.__music
def close(self):
'''
close sound
'''
self.__send('close',False)
self.__id=-1
def length(self):
'''
get the length of music.
@warning: this method blocks current thread until music manager respond this functions
'''
return self.__send('length',True)
def mode(self):
'''
get the mode of music.
@warning: this method blocks current thread until music manager respond this functions
'''
return self.__send('mode',True)
def open(self,music):
'''
open the music
'''
self.__music=music
self.mutex.acquire()
self.__id=music_player.static_id
music_player.static_id=music_player.static_id+1
self.mutex.release()
self.__send('open',False,self.__music,self.__id)
def pause(self):
'''
pause the music
'''
self.__send('pause',False)
def play(self,start=0,end=-1):
'''
play the music
'''
self.__send('play',False,start,end)
def position(self):
'''
get the mode of music.
@warning: this method blocks current thread until music manager respond this functions
'''
return self.__send('position',True)
def resume(self):
'''
resume the music
'''
self.__send('resume',False)
def seek(self,pos):
'''
seek the music to pos, which is defined in miliseconds
'''
self.__send('seek',False,pos)
def set_repeat(self,repeat):
'''
play music repeatly
'''
self.__send('set_repeat',False,repeat)
def stop(self):
'''
stop the music
'''
self.__send('stop',False)
def total_length(self):
'''
get the total length of music.
@warning: this method blocks current thread until music manager respond this functions
'''
return self.__send('total_length',True)
def __send(self,operator,block,*args):
'''
send music tag to music manager
'''
if self.__id==-1:
raise PlaysoundException('No music has been opened')
tag=_music_tag(self.__id,operator,block,*args)
tag.music_list=self.music_list
return music_manager.GetInstance().put_tag(tag)
class music_list(object):
__music_list=deque()
def append_music(self,sound,repeat=False):
music = music_player(self)
music.open(sound)
music.set_repeat(repeat)
self.__music_list.append(music)
if len(self.__music_list)==1:
self.top().play()
def play_next(self):
if len(self.__music_list)>=2:
self.__music_list[1].play()
self.__music_list.popleft().close()
def pause_music(self):
if len(self.__music_list)>0 and self.mode()=='playing':
self.top().pause()
def resume_music(self):
if len(self.__music_list)>0 and self.mode()=='paused':
self.top().resume()
def mode(self):
return self.top().mode()
def top(self):
return self.__music_list[0]
class music_manager(_singleton):
__mutex=Lock()
__sounds=[]
# __music_list=[]
__tag_queue=Queue()
__running_event=Event()
__end_running_event=Event()
def __init__(self):
self.reset_event()
def reset_event(self):
self.__running_event.set()
self.__end_running_event.clear()
def put_tag(self,tag):
'''
push a music tag to music_manager
@warning: if tag.block is True ,this method will block current thread until music manager respond this functions
'''
if tag.block:
tag.block_event.clear()
self.__tag_queue.put(tag)
if tag.block:
tag.block_event.wait()
return tag.retval
def get_tag(self):
try:
#if there is no task for music player, then sleep the music manager,
#otherwise get a tag immediately
if len(self.__sounds)>0:
tag=self.__tag_queue.get_nowait()
else:
tag=self.__tag_queue.get()
retval=None
if tag.operator == 'open':
m=self.__add_music(*tag.args)
m.set_music_list(tag.music_list)
elif tag.operator == 'close':
#remove the music from self.__sounds
self.__rm_music(tag.id)
else:
(idx,item)=self.__get_music_idx_and_item(tag.id)
#reflect
retval=getattr(item,tag.operator)(*tag.args)
#set return values in tag
if tag.block==True:
tag.retval=retval
tag.block_event.set()
except Empty:
pass
def __add_music(self,sound,id):
m=_music(sound,id)
self.__mutex.acquire()
self.__sounds.append(m)
self.__mutex.release()
return m
def __rm_music(self,id):
idx,rm_item=self.__get_music_idx_and_item(id)
rm_item.close()
rm_item.set_id(-1)
self.__mutex.acquire()
self.__sounds.pop(idx)
self.__mutex.release()
def __get_music_idx_and_item(self,id):
for i,x in enumerate(self.__sounds):
if x.get_id()==id:
return i,x
raise PlaysoundException('Unknown music object found')
@classmethod
def start(cls):
'''
start the music manager
'''
Thread(target=music_manager._start_music_manager_impl).start()
@classmethod
def stop(cls):
'''
stop the music manager
'''
manager = cls.GetInstance()
manager.__running_event.clear()
manager.__end_running_event.wait()
manager.reset_event()
print('stop manager',manager)
'''
main loop of music manager
'''
@classmethod
def _start_music_manager_impl(cls):
manager = cls.GetInstance()
print('start manager',manager)
delay=100
while(manager.__running_event.isSet()):
for m in manager.__sounds:
mode = m.update_mode(delay)
#callback the music_list
if m.music_list!=None and mode=='playing' and not m.is_repeat():
pos = m.position()
total_length=m.total_length()
if total_length-pos<=delay:
m.music_list.play_next()
manager.get_tag()
for x in manager.__sounds:
x.close()
manager.__end_running_event.set()
music_manager.start() | [
1,
529,
276,
1112,
420,
29958,
29911,
2592,
29896,
29945,
29906,
29955,
29914,
12922,
618,
13,
1990,
1858,
1036,
618,
2451,
29898,
2451,
1125,
13,
1678,
1209,
13,
13,
1753,
903,
12922,
618,
17734,
29898,
29802,
29892,
2908,
353,
5852,
1125,
13,
1678,
14550,
13,
1678,
22310,
7093,
8805,
645,
29889,
5080,
4317,
29889,
323,
2868,
322,
2998,
304,
664,
411,
16379,
29941,
322,
399,
7520,
29923,
373,
13,
1678,
3852,
29871,
29955,
411,
5132,
29871,
29906,
29889,
29955,
29889,
21606,
1736,
411,
901,
934,
21971,
29889,
13,
1678,
21606,
1736,
373,
3852,
28932,
266,
582,
3852,
29871,
29896,
29900,
29889,
21606,
1736,
411,
599,
13,
1678,
6910,
310,
5132,
29889,
13,
13,
1678,
512,
1028,
2859,
491,
313,
4187,
451,
13746,
515,
29897,
529,
5813,
29958,
3532,
26862,
6227,
6778,
29915,
29879,
22326,
29941,
1456,
29901,
13,
1678,
2045,
597,
3292,
29889,
510,
29914,
29885,
436,
4271,
29887,
870,
22617,
29914,
1526,
29941,
1456,
13,
13,
1678,
306,
2360,
723,
505,
1898,
773,
8805,
645,
29889,
5080,
4317,
1728,
8790,
670,
775,
29889,
13,
1678,
14550,
13,
1678,
515,
274,
8768,
1053,
274,
29918,
9040,
29892,
8805,
645,
13,
1678,
515,
4036,
1053,
4036,
13,
1678,
515,
931,
259,
1053,
8709,
13,
1678,
515,
10876,
1678,
1053,
679,
5325,
973,
22331,
13,
1678,
822,
5401,
6255,
10456,
6519,
1125,
13,
4706,
18392,
353,
274,
29918,
9040,
29898,
29906,
29945,
29945,
29897,
13,
4706,
1899,
353,
525,
15300,
7122,
29898,
6519,
467,
12508,
29898,
657,
5325,
973,
22331,
3101,
13,
4706,
1059,
3399,
353,
938,
29898,
14800,
645,
29889,
5080,
4317,
29889,
29885,
455,
12600,
1231,
29909,
29898,
6519,
29892,
18392,
29892,
29871,
29906,
29945,
29946,
29892,
29871,
29900,
876,
13,
4706,
565,
1059,
3399,
29901,
13,
9651,
1059,
7701,
353,
274,
29918,
9040,
29898,
29906,
29945,
29945,
29897,
13,
9651,
8805,
645,
29889,
5080,
4317,
29889,
29885,
455,
2577,
2392,
1231,
29909,
29898,
2704,
3399,
29892,
1059,
7701,
29892,
29871,
29906,
29945,
29946,
29897,
13,
9651,
3682,
3728,
353,
6702,
29905,
29876,
1678,
4829,
525,
718,
851,
29898,
2704,
3399,
29897,
718,
525,
363,
1899,
11283,
13,
462,
18884,
11297,
29876,
4706,
525,
718,
1899,
29889,
13808,
580,
718,
13,
462,
18884,
11297,
29876,
1678,
525,
718,
1059,
7701,
29889,
1767,
29889,
13808,
3101,
13,
9651,
12020,
1858,
1036,
618,
2451,
29898,
11739,
3728,
29897,
13,
4706,
736,
18392,
29889,
1767,
13,
13,
1678,
13995,
353,
525,
12922,
618,
29918,
29915,
718,
851,
29898,
8172,
3101,
13,
1678,
5401,
6255,
877,
3150,
13577,
718,
6047,
718,
18793,
13995,
742,
13995,
29897,
13,
1678,
5401,
6255,
877,
842,
742,
13995,
29892,
525,
2230,
3402,
3533,
21462,
1495,
13,
1678,
14385,
797,
4345,
353,
5401,
6255,
877,
4882,
742,
13995,
29892,
525,
2848,
1495,
13,
1678,
5401,
6255,
877,
1456,
742,
13995,
29892,
525,
3166,
29871,
29900,
304,
742,
14385,
797,
4345,
29889,
13808,
3101,
13,
13,
1678,
565,
2908,
29901,
13,
4706,
8709,
29898,
7411,
29898,
19708,
797,
4345,
29897,
847,
29871,
29896,
29900,
29900,
29900,
29889,
29900,
29897,
13,
13,
1753,
903,
12922,
618,
3267,
29990,
29898,
29802,
29892,
2908,
353,
5852,
1125,
13,
1678,
14550,
13,
1678,
22310,
7093,
2401,
13117,
29889,
29940,
1799,
618,
29889,
323,
2868,
322,
2998,
304,
664,
411,
16379,
29941,
322,
399,
7520,
29923,
373,
13,
1678,
6570,
1060,
29871,
29896,
29900,
29889,
29896,
29896,
411,
5132,
29871,
29906,
29889,
29955,
29889,
21606,
1736,
411,
3099,
26141,
2481,
11286,
29889,
13,
1678,
21606,
1736,
373,
6570,
1060,
29871,
29896,
29900,
29889,
29945,
322,
20687,
29889,
21606,
1736,
411,
599,
6910,
310,
13,
1678,
5132,
29889,
13,
13,
1678,
512,
1028,
2859,
491,
313,
4187,
451,
13746,
515,
29897,
319,
5022,
29915,
29879,
10292,
28845,
1234,
1244,
29901,
13,
1678,
1732,
597,
2417,
29889,
510,
29914,
29874,
29914,
29941,
29946,
29945,
29953,
29947,
29906,
29929,
29947,
29914,
29929,
29900,
29896,
29953,
29946,
29896,
13,
13,
1678,
306,
2360,
723,
505,
1898,
773,
2401,
13117,
29889,
29940,
1799,
618,
1728,
8790,
670,
775,
29889,
13,
1678,
14550,
13,
1678,
515,
2401,
13117,
268,
1053,
405,
1799,
618,
13,
1678,
515,
10606,
1053,
3865,
4219,
13,
1678,
515,
931,
539,
1053,
8709,
13,
13,
1678,
565,
525,
597,
29915,
451,
297,
6047,
29901,
13,
4706,
565,
451,
6047,
29889,
27382,
2541,
11219,
29374,
13,
9651,
515,
2897,
1053,
679,
29883,
9970,
13,
9651,
6047,
353,
679,
29883,
9970,
580,
718,
8207,
29915,
718,
6047,
13,
4706,
6047,
353,
525,
1445,
597,
29915,
718,
6047,
13,
1678,
3142,
259,
353,
3865,
4219,
29889,
4219,
3047,
1231,
23538,
29802,
29897,
13,
1678,
302,
893,
618,
353,
405,
1799,
618,
29889,
15956,
2141,
2344,
3047,
21002,
2776,
4219,
29918,
1609,
7422,
23538,
2271,
29892,
5852,
29897,
13,
1678,
565,
451,
302,
893,
618,
29901,
13,
4706,
12020,
10663,
2392,
877,
2525,
519,
304,
2254,
6047,
4257,
29901,
525,
718,
6047,
29897,
13,
1678,
302,
893,
618,
29889,
1456,
580,
13,
13,
1678,
565,
2908,
29901,
13,
4706,
8709,
29898,
29876,
893,
618,
29889,
19708,
3101,
13,
13,
1753,
903,
12922,
618,
29940,
861,
29898,
29802,
29892,
2908,
29922,
5574,
1125,
13,
1678,
9995,
13454,
263,
6047,
773,
402,
3835,
261,
29889,
13,
13,
1678,
512,
1028,
2859,
491,
445,
29901,
13,
1678,
2045,
597,
29887,
5461,
261,
29889,
10745,
11696,
6883,
29889,
990,
29914,
12663,
29914,
12631,
29879,
29914,
1456,
1627,
29914,
1456,
2109,
29899,
21125,
29889,
1420,
13,
1678,
9995,
13,
1678,
565,
451,
2908,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
29898,
13,
9651,
376,
1271,
29922,
8824,
2609,
367,
1304,
373,
445,
7481,
3447,
1159,
13,
13,
1678,
396,
2224,
978,
29906,
2271,
3966,
11603,
1661,
29899,
4219,
29899,
11177,
4890,
13,
1678,
1053,
2897,
13,
1678,
1018,
29901,
13,
4706,
515,
3142,
1982,
29889,
3827,
1053,
2224,
978,
29906,
2271,
13,
1678,
5174,
16032,
2392,
29901,
13,
4706,
396,
3017,
29871,
29906,
13,
4706,
515,
3142,
1982,
1053,
2224,
978,
29906,
2271,
13,
13,
1678,
1053,
4005,
13,
1678,
4005,
29889,
12277,
29918,
3259,
877,
29954,
303,
742,
525,
29896,
29889,
29900,
1495,
13,
1678,
515,
4005,
29889,
19033,
1053,
402,
303,
13,
13,
1678,
402,
303,
29889,
2344,
29898,
8516,
29897,
13,
13,
1678,
1708,
2109,
353,
402,
303,
29889,
2642,
5126,
29889,
5675,
877,
1456,
2109,
742,
525,
1456,
2109,
1495,
13,
1678,
565,
6047,
29889,
27382,
2541,
29898,
877,
1124,
597,
742,
525,
991,
597,
8785,
29901,
13,
4706,
1708,
2109,
29889,
11030,
29889,
5338,
353,
6047,
13,
1678,
1683,
29901,
13,
4706,
1708,
2109,
29889,
11030,
29889,
5338,
353,
525,
1445,
597,
29915,
718,
2224,
978,
29906,
2271,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
29802,
876,
13,
13,
1678,
731,
29918,
2914,
353,
1708,
2109,
29889,
842,
29918,
3859,
29898,
29954,
303,
29889,
2792,
29889,
29925,
18799,
4214,
29897,
13,
1678,
565,
731,
29918,
2914,
2804,
402,
303,
29889,
2792,
7277,
11609,
29889,
3289,
29979,
15868,
29901,
13,
4706,
12020,
1858,
1036,
618,
2451,
29898,
13,
9651,
376,
1456,
2109,
29889,
842,
29918,
3859,
4133,
376,
718,
2062,
29898,
842,
29918,
2914,
876,
13,
13,
1678,
396,
383,
6415,
2303,
29901,
671,
777,
916,
3593,
1158,
1135,
21180,
580,
411,
2908,
29922,
8824,
13,
1678,
396,
2045,
597,
21051,
1335,
29889,
3292,
29889,
601,
29914,
29886,
3146,
29899,
2640,
8484,
29954,
303,
29899,
29896,
29889,
29900,
29914,
13203,
29914,
16890,
29889,
1420,
13,
1678,
3593,
353,
1708,
2109,
29889,
657,
29918,
8262,
580,
13,
1678,
3593,
29889,
29886,
3028,
29898,
29954,
303,
29889,
3728,
1542,
29889,
29923,
3267,
29892,
402,
303,
29889,
29907,
21339,
29918,
15307,
29918,
29940,
12413,
29897,
13,
1678,
1708,
2109,
29889,
842,
29918,
3859,
29898,
29954,
303,
29889,
2792,
29889,
10074,
29897,
13,
13,
13,
3166,
7481,
1053,
1788,
13,
5205,
353,
1788,
580,
13,
13,
361,
1788,
1275,
525,
7685,
2396,
13,
1678,
13582,
618,
353,
903,
12922,
618,
17734,
13,
23681,
1788,
1275,
525,
29928,
279,
5080,
2396,
13,
1678,
13582,
618,
353,
903,
12922,
618,
3267,
29990,
13,
2870,
29901,
13,
1678,
13582,
618,
353,
903,
12922,
618,
29940,
861,
13,
13,
6144,
1788,
13,
13,
13,
3166,
274,
8768,
1053,
274,
29918,
9040,
29892,
8805,
645,
13,
3166,
4036,
1053,
4036,
13,
3166,
931,
259,
1053,
8709,
13,
3166,
10876,
1678,
1053,
679,
5325,
973,
22331,
13,
1753,
5401,
6255,
10456,
6519,
1125,
13,
1678,
18392,
353,
274,
29918,
9040,
29898,
29906,
29945,
29945,
29897,
13,
1678,
1899,
353,
525,
15300,
7122,
29898,
6519,
467,
12508,
29898,
657,
5325,
973,
22331,
3101,
13,
1678,
1059,
3399,
353,
938,
29898,
14800,
645,
29889,
5080,
4317,
29889,
29885,
455,
12600,
1231,
29909,
29898,
6519,
29892,
18392,
29892,
29871,
29906,
29945,
29946,
29892,
29871,
29900,
876,
13,
1678,
565,
1059,
3399,
29901,
13,
4706,
1059,
7701,
353,
274,
29918,
9040,
29898,
29906,
29945,
29945,
29897,
13,
4706,
8805,
645,
29889,
5080,
4317,
29889,
29885,
455,
2577,
2392,
1231,
29909,
29898,
2704,
3399,
29892,
1059,
7701,
29892,
29871,
29906,
29945,
29946,
29897,
13,
4706,
3682,
3728,
353,
6702,
29905,
29876,
1678,
4829,
525,
718,
851,
29898,
2704,
3399,
29897,
718,
525,
363,
1899,
11283,
13,
462,
9651,
11297,
29876,
4706,
525,
718,
1899,
29889,
13808,
580,
718,
13,
462,
9651,
11297,
29876,
1678,
525,
718,
1059,
7701,
29889,
1767,
29889,
13808,
3101,
13,
4706,
12020,
1858,
1036,
618,
2451,
29898,
11739,
3728,
29897,
13,
1678,
736,
18392,
29889,
1767,
13,
13,
13,
13,
3166,
3244,
292,
1053,
10480,
29892,
2624,
29892,
16542,
13,
3166,
9521,
1053,
5462,
434,
29892,
8915,
13,
3166,
16250,
1053,
316,
802,
13,
13,
12008,
13,
1678,
4696,
770,
607,
3913,
5417,
286,
455,
304,
1708,
278,
4696,
13,
12008,
13,
1990,
903,
23596,
29898,
3318,
1125,
13,
268,
13,
1678,
4770,
19973,
29922,
8516,
13,
1678,
4770,
21094,
29918,
13140,
29922,
8516,
13,
1678,
4770,
29802,
29922,
8516,
13,
1678,
4770,
2962,
29922,
8516,
13,
1678,
4770,
355,
29922,
8516,
13,
1678,
4770,
275,
29918,
14358,
29922,
8824,
13,
1678,
4770,
333,
10457,
29896,
13,
1678,
4696,
29918,
1761,
29922,
8516,
13,
1678,
14550,
13,
4706,
11905,
278,
4696,
1203,
13,
1678,
14550,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29802,
29892,
333,
1125,
13,
4706,
1583,
17255,
19973,
29922,
1839,
3788,
2033,
13,
4706,
1583,
17255,
21094,
29918,
13140,
29922,
29900,
13,
4706,
1583,
17255,
333,
29922,
333,
13,
4706,
1583,
29889,
1457,
1359,
29898,
29802,
29897,
13,
308,
13,
1678,
822,
731,
29918,
23596,
29918,
1761,
29898,
1311,
29892,
23596,
29918,
1761,
1125,
13,
4706,
1583,
29889,
23596,
29918,
1761,
353,
4696,
29918,
1761,
13,
268,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
1767,
1125,
13,
4706,
736,
1583,
17255,
333,
1360,
1767,
13,
268,
13,
13,
1678,
14550,
13,
4706,
2821,
278,
4696,
1203,
13,
4706,
4696,
674,
367,
5764,
13,
1678,
14550,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9847,
580,
13,
4706,
1583,
17255,
8551,
580,
13,
13,
1678,
14550,
13,
4706,
679,
1178,
310,
4696,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
679,
29918,
333,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
333,
13,
13,
1678,
14550,
13,
4706,
736,
3692,
4696,
13582,
12312,
368,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
338,
29918,
14358,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
275,
29918,
14358,
13,
13,
13,
1678,
14550,
13,
4706,
736,
278,
3464,
515,
1369,
304,
1095,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
3309,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
736,
1583,
17255,
355,
29899,
1311,
17255,
2962,
13,
13,
1678,
14550,
13,
4706,
736,
278,
4464,
310,
278,
4696,
1203,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
4464,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
736,
5401,
6255,
877,
4882,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
8513,
2824,
13808,
580,
13,
13,
1678,
14550,
13,
4706,
19957,
278,
4696,
13,
4706,
4696,
674,
367,
28454,
13,
1678,
14550,
13,
1678,
822,
19957,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
5401,
6255,
877,
29886,
1071,
525,
29974,
1311,
17255,
657,
29918,
19973,
3101,
13,
462,
13,
1678,
14550,
13,
4706,
1708,
278,
4696,
515,
1369,
304,
1095,
13,
4706,
4696,
674,
367,
8743,
13,
1678,
14550,
13,
1678,
822,
1708,
29898,
1311,
29892,
2962,
29922,
29900,
29892,
355,
10457,
29896,
1125,
13,
308,
13,
4706,
1583,
17255,
2962,
29892,
1311,
17255,
355,
29922,
1311,
17255,
5510,
29918,
2962,
29918,
355,
29898,
2962,
29892,
355,
29892,
1311,
29889,
7827,
29918,
2848,
3101,
13,
4706,
1583,
17255,
1456,
29918,
326,
2037,
29898,
1311,
17255,
2962,
29892,
1311,
17255,
355,
29897,
13,
268,
13,
13,
1678,
14550,
13,
4706,
736,
278,
2602,
310,
278,
4696,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
2602,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
736,
938,
29898,
5080,
6255,
877,
4882,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
3283,
2824,
13808,
3101,
13,
13,
1678,
14550,
13,
4706,
758,
1359,
278,
4696,
2472,
13,
1678,
14550,
13,
1678,
822,
758,
1359,
29898,
1311,
29892,
29802,
1125,
13,
4706,
1583,
17255,
29802,
29922,
29802,
13,
4706,
363,
474,
297,
3464,
29898,
29906,
1125,
13,
9651,
1583,
17255,
19973,
29961,
29875,
29962,
2433,
12922,
618,
29918,
18717,
710,
29898,
8172,
3101,
13,
9651,
5401,
6255,
877,
3150,
13577,
29974,
1311,
17255,
29802,
29974,
11838,
13995,
742,
1311,
17255,
19973,
29961,
29875,
2314,
13,
9651,
5401,
6255,
877,
842,
742,
1311,
17255,
19973,
29961,
29875,
1402,
29915,
2230,
3402,
3533,
21462,
1495,
13,
308,
13,
308,
13,
4706,
3309,
29922,
1311,
29889,
7827,
29918,
2848,
580,
13,
4706,
1583,
17255,
2962,
29922,
29900,
13,
4706,
1583,
17255,
355,
29922,
2848,
13,
4706,
736,
3309,
13,
13,
268,
13,
1678,
14550,
13,
4706,
620,
2017,
8743,
13,
4706,
4696,
674,
367,
8743,
13,
1678,
14550,
13,
1678,
822,
620,
2017,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
565,
1583,
17255,
275,
29918,
14358,
29901,
13,
18884,
1583,
17255,
1456,
29918,
326,
2037,
29898,
1311,
29889,
3283,
3285,
1311,
17255,
355,
29897,
13,
9651,
1683,
29901,
13,
18884,
5401,
6255,
877,
690,
2017,
525,
29974,
1311,
17255,
657,
29918,
19973,
3101,
13,
268,
13,
1678,
14550,
13,
4706,
16508,
278,
4696,
304,
926,
29889,
13,
4706,
4696,
674,
367,
29872,
28454,
13,
1678,
14550,
13,
1678,
822,
16508,
29898,
1311,
29892,
1066,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
565,
926,
29958,
1311,
17255,
355,
470,
926,
29966,
1311,
17255,
2962,
29901,
13,
18884,
12020,
1858,
1036,
618,
2451,
877,
3283,
13461,
3464,
1495,
13,
632,
13,
9651,
5401,
6255,
877,
344,
1416,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
517,
742,
710,
29898,
1066,
876,
13,
9651,
5401,
6255,
877,
1456,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
3166,
525,
29974,
851,
29898,
1066,
29897,
718,
29915,
304,
742,
710,
29898,
1311,
17255,
355,
876,
13,
9651,
1583,
29889,
29886,
1071,
580,
13,
632,
13,
13,
1678,
14550,
13,
4706,
731,
29871,
12312,
7353,
310,
278,
4696,
13,
4706,
4696,
674,
12312,
368,
1708,
13,
1678,
14550,
13,
1678,
822,
731,
29918,
14358,
29898,
1311,
29892,
14358,
1125,
13,
4706,
1583,
17255,
275,
29918,
14358,
29922,
14358,
13,
13,
13,
1678,
14550,
13,
4706,
731,
1178,
363,
4696,
1203,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
731,
29918,
333,
29898,
1311,
29892,
333,
1125,
13,
4706,
1583,
17255,
333,
29922,
333,
13,
13,
1678,
14550,
13,
4706,
5040,
278,
4696,
29889,
13,
4706,
4696,
674,
367,
11084,
13,
1678,
14550,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
1583,
29889,
344,
1416,
29898,
1311,
17255,
2962,
29897,
13,
9651,
5401,
6255,
877,
9847,
525,
29974,
1311,
17255,
657,
29918,
19973,
3101,
13,
13,
632,
13,
1678,
14550,
13,
4706,
3001,
29918,
2848,
310,
278,
4696,
1203,
29892,
278,
4328,
393,
3001,
29918,
2848,
338,
278,
3464,
338,
3001,
4696,
29892,
13,
4706,
541,
3309,
338,
871,
3464,
515,
1369,
304,
1095,
13,
4706,
4696,
674,
451,
367,
15201,
13,
1678,
14550,
13,
1678,
822,
3001,
29918,
2848,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
736,
938,
29898,
5080,
6255,
877,
4882,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
2848,
2824,
13808,
3101,
13,
268,
13,
13,
1678,
14550,
13,
4706,
2767,
278,
2407,
931,
310,
278,
4696,
29892,
29871,
13,
1678,
14550,
13,
1678,
822,
2767,
29918,
8513,
29898,
1311,
29892,
18829,
29922,
29900,
1125,
13,
4706,
878,
353,
1583,
29889,
8513,
580,
13,
13,
4706,
565,
878,
1275,
29915,
1456,
292,
2396,
13,
18884,
396,
361,
1583,
17255,
355,
29899,
1311,
29889,
3283,
580,
29966,
18829,
769,
12312,
278,
4696,
13,
18884,
565,
1583,
17255,
275,
29918,
14358,
1360,
5574,
29901,
13,
462,
1678,
565,
1583,
17255,
355,
29899,
1311,
29889,
3283,
580,
14065,
18829,
29901,
13,
462,
4706,
1583,
17255,
21094,
29918,
13140,
7607,
1311,
17255,
21094,
29918,
13140,
29974,
29896,
29897,
29995,
29906,
13,
462,
4706,
1583,
17255,
1456,
29918,
326,
2037,
29898,
1311,
17255,
2962,
29892,
1311,
17255,
355,
29897,
13,
4706,
736,
878,
13,
4706,
13,
308,
13,
268,
13,
308,
13,
268,
13,
1678,
822,
4770,
657,
29918,
19973,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
19973,
29961,
1311,
17255,
21094,
29918,
13140,
29962,
13,
268,
13,
268,
13,
1678,
822,
4770,
3198,
29918,
19973,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
657,
29918,
19973,
580,
29991,
2433,
2396,
13,
9651,
736,
5852,
13,
13,
1678,
822,
4770,
5510,
29918,
2962,
29918,
355,
29898,
1311,
29892,
2962,
29892,
355,
29892,
2848,
1125,
13,
4706,
565,
451,
313,
275,
8758,
29898,
2962,
29892,
524,
29897,
322,
338,
8758,
29898,
355,
29892,
524,
22164,
13,
9651,
12020,
1858,
1036,
618,
2451,
877,
2962,
322,
1095,
1818,
367,
938,
1495,
13,
4706,
903,
2962,
29922,
29900,
13,
4706,
903,
355,
29922,
29900,
13,
4706,
565,
1095,
1360,
29899,
29896,
29901,
13,
9651,
903,
355,
353,
3309,
13,
4706,
25342,
1095,
14065,
2848,
29901,
13,
9651,
903,
355,
353,
1095,
13,
4706,
1683,
29901,
13,
9651,
12020,
1858,
1036,
618,
2451,
877,
23596,
3464,
13461,
13071,
1495,
13,
4706,
565,
1369,
29966,
29900,
470,
1369,
29958,
2848,
29901,
13,
9651,
12020,
1858,
1036,
618,
2451,
877,
23596,
3464,
13461,
13071,
1495,
13,
4706,
25342,
903,
355,
29966,
2962,
29901,
13,
9651,
12020,
1858,
1036,
618,
2451,
877,
355,
1818,
367,
16600,
1135,
1369,
1495,
13,
4706,
1683,
29901,
13,
9651,
903,
2962,
29922,
2962,
13,
4706,
736,
903,
2962,
29892,
29918,
355,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
1583,
17255,
8551,
580,
13,
268,
13,
1678,
822,
4770,
8551,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
363,
474,
297,
3464,
29898,
29906,
1125,
13,
18884,
5401,
6255,
877,
5358,
525,
29974,
1311,
17255,
19973,
29961,
29875,
2314,
13,
9651,
1583,
17255,
19973,
29922,
1839,
3788,
2033,
13,
9651,
1583,
17255,
2962,
29922,
8516,
13,
9651,
1583,
17255,
355,
29922,
8516,
13,
9651,
1583,
17255,
275,
29918,
14358,
29922,
8824,
13,
13,
1678,
822,
4770,
1456,
29918,
326,
2037,
29898,
1311,
29892,
2962,
29892,
355,
1125,
13,
4706,
5401,
6255,
877,
1456,
742,
1311,
17255,
657,
29918,
19973,
3285,
29915,
3166,
525,
29974,
851,
29898,
2962,
29897,
718,
29915,
304,
742,
710,
29898,
355,
876,
13,
268,
13,
13,
1678,
822,
1596,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
3198,
29918,
19973,
7295,
13,
9651,
822,
3402,
29918,
23853,
21462,
29898,
29873,
1125,
13,
18884,
736,
14210,
29881,
16664,
29881,
16664,
29881,
29889,
29995,
29881,
29915,
29995,
29898,
29873,
458,
29941,
29953,
29900,
29900,
29900,
29900,
29900,
22657,
29873,
29995,
29941,
29953,
29900,
29900,
29900,
29900,
29900,
29897,
458,
29953,
29900,
29900,
29900,
29900,
22657,
29873,
29995,
29953,
29900,
29900,
29900,
29900,
29897,
458,
29896,
29900,
29900,
29900,
29892,
29873,
29995,
29896,
29900,
29900,
29900,
29897,
13,
13,
9651,
1596,
877,
23596,
1024,
29901,
742,
1311,
17255,
29802,
29897,
13,
9651,
1596,
877,
8513,
30383,
742,
1311,
29889,
8513,
3101,
13,
9651,
1596,
877,
7827,
29918,
2848,
30383,
742,
1311,
29889,
7827,
29918,
2848,
3101,
13,
9651,
1596,
877,
3283,
29901,
742,
710,
29898,
1311,
29889,
3283,
22130,
13,
9651,
1596,
877,
2962,
448,
1095,
29901,
6571,
448,
6571,
4286,
4830,
29898,
4830,
29918,
23853,
21462,
29898,
1311,
17255,
2962,
511,
4830,
29918,
23853,
21462,
29898,
1311,
17255,
355,
4961,
13,
13,
12008,
13,
1678,
27130,
13,
12008,
13,
1990,
903,
2976,
11285,
29898,
3318,
1125,
13,
1678,
903,
6149,
735,
29922,
16542,
580,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
268,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
3617,
4998,
29898,
25932,
29892,
29930,
5085,
29892,
1068,
19290,
1125,
13,
4706,
565,
451,
756,
5552,
29898,
25932,
5501,
29918,
8758,
29374,
13,
9651,
1067,
29879,
3032,
6149,
735,
29889,
562,
1548,
580,
259,
13,
9651,
565,
451,
756,
5552,
29898,
25932,
5501,
29918,
8758,
29374,
13,
18884,
1067,
29879,
3032,
8758,
353,
1067,
29879,
580,
13,
18884,
1596,
877,
3258,
2777,
742,
25932,
3032,
8758,
29897,
13,
9651,
1067,
29879,
3032,
6149,
735,
29889,
14096,
580,
13,
4706,
736,
1067,
29879,
3032,
8758,
13,
13,
12008,
13,
1678,
4696,
4055,
338,
1304,
304,
3638,
2643,
363,
4696,
8455,
13,
12008,
13,
1990,
903,
23596,
29918,
4039,
29898,
3318,
1125,
13,
1678,
1178,
10457,
29896,
1669,
396,
333,
338,
278,
3957,
1546,
4696,
4847,
322,
903,
23596,
1203,
13,
1678,
5455,
2433,
29915,
308,
396,
6891,
310,
903,
23596,
1203,
13,
1678,
6389,
29922,
8516,
965,
396,
16744,
13,
1678,
2908,
29918,
3696,
29922,
8516,
268,
13,
1678,
2908,
29922,
8824,
13,
1678,
3240,
791,
29922,
8516,
308,
396,
2457,
995,
363,
777,
3519,
310,
4696,
4847,
13,
1678,
4696,
29918,
1761,
29922,
8516,
268,
396,
18732,
5376,
411,
4696,
1051,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
333,
29892,
6891,
29892,
1271,
29922,
8824,
29892,
29930,
5085,
1125,
13,
4706,
1583,
29889,
333,
29922,
333,
13,
4706,
1583,
29889,
6891,
353,
5455,
13,
4706,
1583,
29889,
5085,
353,
6389,
13,
4706,
565,
2908,
29901,
13,
9651,
1583,
29889,
1271,
29918,
3696,
29922,
2624,
580,
13,
9651,
1583,
29889,
1271,
29922,
5574,
13,
13,
1678,
822,
731,
29918,
23596,
29918,
1761,
29898,
1311,
29892,
23596,
29918,
1761,
1125,
13,
4706,
1583,
29889,
23596,
29918,
1761,
353,
4696,
29918,
1761,
13,
13,
12008,
13,
1678,
4696,
4847,
338,
278,
3132,
1058,
16003,
4696,
8282,
304,
4696,
8455,
607,
6200,
13582,
4696,
29889,
13,
1678,
4696,
4847,
11761,
4696,
2748,
366,
1722,
278,
4696,
29889,
13,
12008,
13,
1990,
4696,
29918,
9106,
29898,
3318,
1125,
13,
1678,
4770,
333,
10457,
29896,
308,
396,
22350,
310,
1432,
903,
23596,
1203,
13,
1678,
4770,
23596,
29922,
8516,
1678,
396,
29802,
13,
1678,
2294,
29918,
333,
29922,
29900,
268,
396,
7959,
3651,
13,
1678,
5478,
735,
29922,
16542,
580,
1678,
396,
908,
310,
2294,
29918,
333,
13,
1678,
4696,
29918,
1761,
29922,
8516,
396,
1366,
4696,
4847,
6852,
304,
607,
4696,
1051,
29871,
13,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
23596,
29918,
1761,
29922,
8516,
1125,
13,
4706,
14550,
13,
9651,
565,
4696,
4847,
14393,
304,
697,
310,
4696,
1051,
29892,
6098,
731,
4696,
29918,
1761,
29892,
13,
9651,
6467,
366,
508,
11455,
4696,
29918,
1761,
3443,
13,
4706,
14550,
13,
4706,
1583,
29889,
23596,
29918,
1761,
353,
4696,
29918,
1761,
13,
13,
268,
13,
1678,
822,
679,
29918,
23596,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
679,
1024,
310,
6047,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
23596,
13,
13,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
3802,
6047,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
5358,
742,
8824,
29897,
13,
4706,
1583,
17255,
333,
10457,
29896,
13,
13,
268,
13,
1678,
822,
3309,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
679,
278,
3309,
310,
4696,
29889,
13,
13,
9651,
732,
27392,
29901,
445,
1158,
10930,
1857,
3244,
2745,
4696,
8455,
10049,
445,
3168,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
6717,
877,
2848,
742,
5574,
29897,
13,
13,
268,
13,
1678,
822,
4464,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
679,
278,
4464,
310,
4696,
29889,
13,
13,
9651,
732,
27392,
29901,
445,
1158,
10930,
1857,
3244,
2745,
4696,
8455,
10049,
445,
3168,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
6717,
877,
8513,
742,
5574,
29897,
13,
13,
268,
13,
1678,
822,
1722,
29898,
1311,
29892,
23596,
1125,
13,
4706,
14550,
13,
9651,
1722,
278,
4696,
13,
4706,
14550,
13,
4706,
1583,
17255,
23596,
29922,
23596,
13,
13,
4706,
1583,
29889,
6149,
735,
29889,
562,
1548,
580,
13,
4706,
1583,
17255,
333,
29922,
23596,
29918,
9106,
29889,
7959,
29918,
333,
13,
4706,
4696,
29918,
9106,
29889,
7959,
29918,
333,
29922,
23596,
29918,
9106,
29889,
7959,
29918,
333,
29974,
29896,
13,
4706,
1583,
29889,
6149,
735,
29889,
14096,
580,
13,
13,
4706,
1583,
17255,
6717,
877,
3150,
742,
8824,
29892,
1311,
17255,
23596,
29892,
1311,
17255,
333,
29897,
13,
13,
268,
13,
1678,
822,
19957,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
19957,
278,
4696,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
29886,
1071,
742,
8824,
29897,
13,
13,
268,
13,
1678,
822,
1708,
29898,
1311,
29892,
2962,
29922,
29900,
29892,
355,
10457,
29896,
1125,
13,
4706,
14550,
13,
9651,
1708,
278,
4696,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
1456,
742,
8824,
29892,
2962,
29892,
355,
29897,
13,
13,
13,
268,
13,
1678,
822,
2602,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
679,
278,
4464,
310,
4696,
29889,
13,
13,
9651,
732,
27392,
29901,
445,
1158,
10930,
1857,
3244,
2745,
4696,
8455,
10049,
445,
3168,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
6717,
877,
3283,
742,
5574,
29897,
13,
13,
1678,
822,
620,
2017,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
620,
2017,
278,
4696,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
690,
2017,
742,
8824,
29897,
13,
13,
268,
13,
1678,
822,
16508,
29898,
1311,
29892,
1066,
1125,
13,
4706,
14550,
13,
9651,
16508,
278,
4696,
304,
926,
29892,
607,
338,
3342,
297,
2316,
21462,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
344,
1416,
742,
8824,
29892,
1066,
29897,
13,
13,
268,
13,
1678,
822,
731,
29918,
14358,
29898,
1311,
29892,
14358,
1125,
13,
4706,
14550,
13,
9651,
1708,
4696,
12312,
368,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
842,
29918,
14358,
742,
8824,
29892,
14358,
29897,
13,
13,
268,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
5040,
278,
4696,
13,
4706,
14550,
13,
4706,
1583,
17255,
6717,
877,
9847,
742,
8824,
29897,
13,
13,
13,
268,
13,
1678,
822,
3001,
29918,
2848,
29898,
1311,
1125,
13,
4706,
14550,
13,
9651,
679,
278,
3001,
3309,
310,
4696,
29889,
13,
632,
13,
9651,
732,
27392,
29901,
445,
1158,
10930,
1857,
3244,
2745,
4696,
8455,
10049,
445,
3168,
13,
4706,
14550,
13,
4706,
736,
1583,
17255,
6717,
877,
7827,
29918,
2848,
742,
5574,
29897,
13,
13,
268,
13,
1678,
822,
4770,
6717,
29898,
1311,
29892,
6891,
29892,
1271,
29892,
29930,
5085,
1125,
13,
4706,
14550,
13,
9651,
3638,
4696,
4055,
304,
4696,
8455,
13,
4706,
14550,
13,
4706,
565,
1583,
17255,
333,
1360,
29899,
29896,
29901,
13,
9651,
12020,
1858,
1036,
618,
2451,
877,
3782,
4696,
756,
1063,
6496,
1495,
13,
4706,
4055,
29922,
29918,
23596,
29918,
4039,
29898,
1311,
17255,
333,
29892,
6891,
29892,
1271,
29892,
29930,
5085,
29897,
13,
4706,
4055,
29889,
23596,
29918,
1761,
29922,
1311,
29889,
23596,
29918,
1761,
13,
4706,
736,
4696,
29918,
12847,
29889,
2577,
4998,
2141,
649,
29918,
4039,
29898,
4039,
29897,
13,
13,
13,
1990,
4696,
29918,
1761,
29898,
3318,
1125,
13,
1678,
4770,
23596,
29918,
1761,
29922,
311,
802,
580,
13,
1678,
822,
9773,
29918,
23596,
29898,
1311,
29892,
29802,
29892,
14358,
29922,
8824,
1125,
13,
4706,
4696,
353,
4696,
29918,
9106,
29898,
1311,
29897,
13,
308,
13,
4706,
4696,
29889,
3150,
29898,
29802,
29897,
13,
4706,
4696,
29889,
842,
29918,
14358,
29898,
14358,
29897,
13,
4706,
1583,
17255,
23596,
29918,
1761,
29889,
4397,
29898,
23596,
29897,
13,
4706,
565,
7431,
29898,
1311,
17255,
23596,
29918,
1761,
29897,
1360,
29896,
29901,
13,
9651,
1583,
29889,
3332,
2141,
1456,
580,
13,
13,
1678,
822,
1708,
29918,
4622,
29898,
1311,
1125,
13,
4706,
565,
7431,
29898,
1311,
17255,
23596,
29918,
1761,
15410,
29922,
29906,
29901,
13,
9651,
1583,
17255,
23596,
29918,
1761,
29961,
29896,
1822,
1456,
580,
13,
9651,
1583,
17255,
23596,
29918,
1761,
29889,
7323,
1563,
2141,
5358,
580,
13,
632,
13,
13,
268,
13,
1678,
822,
19957,
29918,
23596,
29898,
1311,
1125,
13,
4706,
565,
7431,
29898,
1311,
17255,
23596,
29918,
1761,
15410,
29900,
322,
1583,
29889,
8513,
580,
1360,
29915,
1456,
292,
2396,
13,
9651,
1583,
29889,
3332,
2141,
29886,
1071,
580,
13,
308,
13,
1678,
822,
620,
2017,
29918,
23596,
29898,
1311,
1125,
13,
4706,
565,
7431,
29898,
1311,
17255,
23596,
29918,
1761,
15410,
29900,
322,
1583,
29889,
8513,
580,
1360,
29915,
29886,
15244,
2396,
13,
9651,
1583,
29889,
3332,
2141,
690,
2017,
580,
13,
13,
1678,
822,
4464,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3332,
2141,
8513,
580,
13,
268,
13,
1678,
822,
2246,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
23596,
29918,
1761,
29961,
29900,
29962,
13,
13,
13,
1990,
4696,
29918,
12847,
7373,
2976,
11285,
1125,
13,
1678,
4770,
6149,
735,
29922,
16542,
580,
13,
1678,
4770,
29879,
3885,
29922,
2636,
13,
1678,
396,
4770,
23596,
29918,
1761,
29922,
2636,
13,
1678,
4770,
4039,
29918,
9990,
29922,
10620,
580,
13,
1678,
4770,
21094,
29918,
3696,
29922,
2624,
580,
13,
1678,
4770,
355,
29918,
21094,
29918,
3696,
29922,
2624,
580,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
12071,
29918,
3696,
580,
13,
13,
1678,
822,
10092,
29918,
3696,
29898,
1311,
1125,
13,
4706,
1583,
17255,
21094,
29918,
3696,
29889,
842,
580,
13,
4706,
1583,
17255,
355,
29918,
21094,
29918,
3696,
29889,
8551,
580,
13,
13,
1678,
822,
1925,
29918,
4039,
29898,
1311,
29892,
4039,
1125,
13,
4706,
14550,
13,
9651,
5503,
263,
4696,
4055,
304,
4696,
29918,
12847,
13,
13,
9651,
732,
27392,
29901,
565,
4055,
29889,
1271,
338,
5852,
1919,
1366,
1158,
674,
2908,
1857,
3244,
2745,
4696,
8455,
10049,
445,
3168,
13,
4706,
14550,
13,
4706,
565,
4055,
29889,
1271,
29901,
13,
9651,
4055,
29889,
1271,
29918,
3696,
29889,
8551,
580,
13,
4706,
1583,
17255,
4039,
29918,
9990,
29889,
649,
29898,
4039,
29897,
13,
4706,
565,
4055,
29889,
1271,
29901,
13,
9651,
4055,
29889,
1271,
29918,
3696,
29889,
10685,
580,
13,
632,
13,
4706,
736,
4055,
29889,
2267,
791,
13,
13,
1678,
822,
679,
29918,
4039,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
396,
361,
727,
338,
694,
3414,
363,
4696,
4847,
29892,
769,
8709,
278,
4696,
8455,
29892,
13,
9651,
396,
1228,
3538,
679,
263,
4055,
7389,
13,
9651,
565,
7431,
29898,
1311,
17255,
29879,
3885,
15410,
29900,
29901,
13,
18884,
4055,
29922,
1311,
17255,
4039,
29918,
9990,
29889,
657,
29918,
3707,
1249,
580,
13,
9651,
1683,
29901,
13,
18884,
4055,
29922,
1311,
17255,
4039,
29918,
9990,
29889,
657,
580,
13,
9651,
3240,
791,
29922,
8516,
13,
9651,
565,
4055,
29889,
6891,
1275,
525,
3150,
2396,
13,
18884,
286,
29922,
1311,
17255,
1202,
29918,
23596,
10456,
4039,
29889,
5085,
29897,
13,
18884,
286,
29889,
842,
29918,
23596,
29918,
1761,
29898,
4039,
29889,
23596,
29918,
1761,
29897,
13,
9651,
25342,
4055,
29889,
6891,
1275,
525,
5358,
2396,
13,
18884,
396,
5992,
278,
4696,
515,
1583,
17255,
29879,
3885,
13,
18884,
1583,
17255,
1758,
29918,
23596,
29898,
4039,
29889,
333,
29897,
13,
9651,
1683,
29901,
13,
18884,
313,
13140,
29892,
667,
3892,
1311,
17255,
657,
29918,
23596,
29918,
13140,
29918,
392,
29918,
667,
29898,
4039,
29889,
333,
29897,
13,
18884,
396,
13191,
13,
18884,
3240,
791,
29922,
657,
5552,
29898,
667,
29892,
4039,
29889,
6891,
5033,
29930,
4039,
29889,
5085,
29897,
13,
632,
13,
9651,
396,
842,
736,
1819,
297,
4055,
13,
9651,
565,
4055,
29889,
1271,
1360,
5574,
29901,
13,
18884,
4055,
29889,
2267,
791,
29922,
2267,
791,
13,
18884,
4055,
29889,
1271,
29918,
3696,
29889,
842,
580,
13,
4706,
5174,
2812,
2349,
29901,
13,
9651,
1209,
13,
268,
13,
1678,
822,
4770,
1202,
29918,
23596,
29898,
1311,
29892,
29802,
29892,
333,
1125,
29871,
13,
4706,
286,
29922,
29918,
23596,
29898,
29802,
29892,
333,
29897,
13,
4706,
1583,
17255,
6149,
735,
29889,
562,
1548,
580,
13,
4706,
1583,
17255,
29879,
3885,
29889,
4397,
29898,
29885,
29897,
13,
4706,
1583,
17255,
6149,
735,
29889,
14096,
580,
13,
13,
4706,
736,
286,
13,
13,
1678,
822,
4770,
1758,
29918,
23596,
29898,
1311,
29892,
333,
1125,
13,
4706,
22645,
29892,
1758,
29918,
667,
29922,
1311,
17255,
657,
29918,
23596,
29918,
13140,
29918,
392,
29918,
667,
29898,
333,
29897,
13,
4706,
20241,
29918,
667,
29889,
5358,
580,
13,
4706,
20241,
29918,
667,
29889,
842,
29918,
333,
6278,
29896,
29897,
13,
4706,
1583,
17255,
6149,
735,
29889,
562,
1548,
580,
13,
4706,
1583,
17255,
29879,
3885,
29889,
7323,
29898,
13140,
29897,
13,
4706,
1583,
17255,
6149,
735,
29889,
14096,
580,
13,
13,
1678,
822,
4770,
657,
29918,
23596,
29918,
13140,
29918,
392,
29918,
667,
29898,
1311,
29892,
333,
1125,
13,
4706,
363,
474,
29892,
29916,
297,
26985,
29898,
1311,
17255,
29879,
3885,
1125,
13,
9651,
565,
921,
29889,
657,
29918,
333,
580,
1360,
333,
29901,
13,
18884,
736,
474,
29892,
29916,
13,
4706,
12020,
1858,
1036,
618,
2451,
877,
14148,
4696,
1203,
1476,
1495,
13,
13,
268,
13,
13,
632,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1369,
29898,
25932,
1125,
13,
4706,
14550,
13,
9651,
1369,
278,
4696,
8455,
13,
4706,
14550,
13,
4706,
10480,
29898,
5182,
29922,
23596,
29918,
12847,
3032,
2962,
29918,
23596,
29918,
12847,
29918,
13699,
467,
2962,
580,
13,
13,
268,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
5040,
29898,
25932,
1125,
13,
4706,
14550,
13,
9651,
5040,
278,
4696,
8455,
13,
4706,
14550,
13,
4706,
8455,
353,
1067,
29879,
29889,
2577,
4998,
580,
13,
4706,
8455,
17255,
21094,
29918,
3696,
29889,
8551,
580,
13,
4706,
8455,
17255,
355,
29918,
21094,
29918,
3696,
29889,
10685,
580,
13,
4706,
8455,
29889,
12071,
29918,
3696,
580,
13,
4706,
1596,
877,
9847,
8455,
742,
12847,
29897,
13,
13,
13,
1678,
14550,
13,
4706,
1667,
2425,
310,
4696,
8455,
13,
1678,
14550,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
903,
2962,
29918,
23596,
29918,
12847,
29918,
13699,
29898,
25932,
1125,
13,
4706,
8455,
353,
1067,
29879,
29889,
2577,
4998,
580,
13,
4706,
1596,
877,
2962,
8455,
742,
12847,
29897,
13,
4706,
9055,
29922,
29896,
29900,
29900,
13,
308,
13,
308,
13,
4706,
1550,
29898,
12847,
17255,
21094,
29918,
3696,
29889,
275,
2697,
580,
1125,
13,
9651,
363,
286,
297,
8455,
17255,
29879,
3885,
29901,
13,
18884,
4464,
353,
286,
29889,
5504,
29918,
8513,
29898,
18829,
29897,
13,
13,
18884,
396,
14035,
278,
4696,
29918,
1761,
13,
18884,
565,
286,
29889,
23596,
29918,
1761,
19216,
8516,
322,
4464,
1360,
29915,
1456,
292,
29915,
322,
451,
286,
29889,
275,
29918,
14358,
7295,
13,
462,
1678,
926,
353,
286,
29889,
3283,
580,
13,
462,
1678,
3001,
29918,
2848,
29922,
29885,
29889,
7827,
29918,
2848,
580,
13,
462,
1678,
565,
29871,
3001,
29918,
2848,
29899,
1066,
14065,
18829,
29901,
13,
462,
4706,
286,
29889,
23596,
29918,
1761,
29889,
1456,
29918,
4622,
580,
632,
13,
13,
9651,
8455,
29889,
657,
29918,
4039,
580,
13,
632,
13,
632,
13,
4706,
363,
921,
297,
8455,
17255,
29879,
3885,
29901,
13,
9651,
921,
29889,
5358,
580,
13,
308,
13,
4706,
8455,
17255,
355,
29918,
21094,
29918,
3696,
29889,
842,
580,
13,
13,
13,
23596,
29918,
12847,
29889,
2962,
580,
2
] |
stage2/models/FuseNet.py | YU-Zhiyang/WEVI | 14 | 193019 | import torch
import torch.nn as nn
from models.baseModule import FuseBlock, BaseNet, Interp
class FuseNet(BaseNet):
def __init__(self):
super(FuseNet, self).__init__()
self.ConvIn = nn.Conv2d(in_channels=512, out_channels=512, kernel_size=1, stride=1, bias=False)
self.AADBlk1 = FuseBlock(cin=512, cout=256, c_ef=512)
self.AADBlk2 = FuseBlock(cin=256, cout=128, c_ef=256)
self.AADBlk3 = FuseBlock(cin=128, cout=64, c_ef=128)
self.AADBlk4 = FuseBlock(cin=64, cout=32, c_ef=64)
self.Up2x = Interp(scale=2)
self.ItStage1 = nn.Sequential(nn.ReplicationPad2d([1, 1, 1, 1]),
nn.Conv2d(in_channels=32, out_channels=32, kernel_size=3),
nn.LeakyReLU(negative_slope=0.1, inplace=True),
nn.Conv2d(in_channels=32, out_channels=3, kernel_size=1),
)
self.randomInitNet()
def forward(self, z_e, z_f):
ST16x = self.ConvIn(torch.cat([z_e[0], z_f[0]], dim=1)) # 64
ST8x = self.AADBlk1(self.Up2x(ST16x), z_e[1], z_f[1]) # 32
ST4x = self.AADBlk2(self.Up2x(ST8x), z_e[2], z_f[2]) # 16
ST2x = self.AADBlk3(self.Up2x(ST4x), z_e[3], z_f[3]) # 8
ST1x = self.AADBlk4(self.Up2x(ST2x), z_e[4], z_f[4]) # 4
ItStage1 = self.ItStage1(ST1x)
return ItStage1, ST4x, ST2x, ST1x
| [
1,
1053,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
3166,
4733,
29889,
3188,
7355,
1053,
383,
1509,
7445,
29892,
7399,
6779,
29892,
4124,
29886,
13,
13,
13,
1990,
383,
1509,
6779,
29898,
5160,
6779,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
29943,
1509,
6779,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
1168,
29894,
797,
353,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
262,
29918,
305,
12629,
29922,
29945,
29896,
29906,
29892,
714,
29918,
305,
12629,
29922,
29945,
29896,
29906,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
380,
2426,
29922,
29896,
29892,
24003,
29922,
8824,
29897,
13,
4706,
1583,
29889,
29909,
3035,
10358,
29895,
29896,
353,
383,
1509,
7445,
29898,
16381,
29922,
29945,
29896,
29906,
29892,
11196,
29922,
29906,
29945,
29953,
29892,
274,
29918,
1389,
29922,
29945,
29896,
29906,
29897,
13,
4706,
1583,
29889,
29909,
3035,
10358,
29895,
29906,
353,
383,
1509,
7445,
29898,
16381,
29922,
29906,
29945,
29953,
29892,
11196,
29922,
29896,
29906,
29947,
29892,
274,
29918,
1389,
29922,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
29909,
3035,
10358,
29895,
29941,
353,
383,
1509,
7445,
29898,
16381,
29922,
29896,
29906,
29947,
29892,
11196,
29922,
29953,
29946,
29892,
274,
29918,
1389,
29922,
29896,
29906,
29947,
29897,
13,
4706,
1583,
29889,
29909,
3035,
10358,
29895,
29946,
353,
383,
1509,
7445,
29898,
16381,
29922,
29953,
29946,
29892,
11196,
29922,
29941,
29906,
29892,
274,
29918,
1389,
29922,
29953,
29946,
29897,
13,
4706,
1583,
29889,
3373,
29906,
29916,
353,
4124,
29886,
29898,
7052,
29922,
29906,
29897,
13,
4706,
1583,
29889,
3112,
27276,
29896,
353,
302,
29876,
29889,
16941,
2556,
29898,
15755,
29889,
5612,
1414,
20369,
29906,
29881,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
11724,
13,
462,
462,
418,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
262,
29918,
305,
12629,
29922,
29941,
29906,
29892,
714,
29918,
305,
12629,
29922,
29941,
29906,
29892,
8466,
29918,
2311,
29922,
29941,
511,
13,
462,
462,
418,
302,
29876,
29889,
3226,
557,
29891,
1123,
29931,
29965,
29898,
22198,
29918,
29879,
417,
412,
29922,
29900,
29889,
29896,
29892,
297,
6689,
29922,
5574,
511,
13,
462,
462,
418,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
262,
29918,
305,
12629,
29922,
29941,
29906,
29892,
714,
29918,
305,
12629,
29922,
29941,
29892,
8466,
29918,
2311,
29922,
29896,
511,
13,
462,
462,
418,
1723,
13,
13,
4706,
1583,
29889,
8172,
6644,
6779,
580,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
503,
29918,
29872,
29892,
503,
29918,
29888,
1125,
13,
4706,
6850,
29896,
29953,
29916,
353,
1583,
29889,
1168,
29894,
797,
29898,
7345,
305,
29889,
4117,
4197,
29920,
29918,
29872,
29961,
29900,
1402,
503,
29918,
29888,
29961,
29900,
20526,
3964,
29922,
29896,
876,
29871,
396,
29871,
29953,
29946,
13,
13,
4706,
6850,
29947,
29916,
353,
1583,
29889,
29909,
3035,
10358,
29895,
29896,
29898,
1311,
29889,
3373,
29906,
29916,
29898,
1254,
29896,
29953,
29916,
511,
503,
29918,
29872,
29961,
29896,
1402,
503,
29918,
29888,
29961,
29896,
2314,
29871,
396,
29871,
29941,
29906,
13,
13,
4706,
6850,
29946,
29916,
353,
1583,
29889,
29909,
3035,
10358,
29895,
29906,
29898,
1311,
29889,
3373,
29906,
29916,
29898,
1254,
29947,
29916,
511,
503,
29918,
29872,
29961,
29906,
1402,
503,
29918,
29888,
29961,
29906,
2314,
29871,
396,
29871,
29896,
29953,
13,
13,
4706,
6850,
29906,
29916,
353,
1583,
29889,
29909,
3035,
10358,
29895,
29941,
29898,
1311,
29889,
3373,
29906,
29916,
29898,
1254,
29946,
29916,
511,
503,
29918,
29872,
29961,
29941,
1402,
503,
29918,
29888,
29961,
29941,
2314,
29871,
396,
29871,
29947,
13,
13,
4706,
6850,
29896,
29916,
353,
1583,
29889,
29909,
3035,
10358,
29895,
29946,
29898,
1311,
29889,
3373,
29906,
29916,
29898,
1254,
29906,
29916,
511,
503,
29918,
29872,
29961,
29946,
1402,
503,
29918,
29888,
29961,
29946,
2314,
29871,
396,
29871,
29946,
13,
13,
4706,
739,
27276,
29896,
353,
1583,
29889,
3112,
27276,
29896,
29898,
1254,
29896,
29916,
29897,
13,
13,
4706,
736,
739,
27276,
29896,
29892,
6850,
29946,
29916,
29892,
6850,
29906,
29916,
29892,
6850,
29896,
29916,
13,
2
] |
Tutorial 6 - Ptychography/ePIE_code/ptycho_recon/postProcess.py | paradimdata/Cornell_EM_SummerSchool_2021 | 8 | 112593 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 1 23:29:40 2021
@author: <NAME>
Converted from Yi Jiang's 'postProcess.m''
"""
import numpy as np
from skimage.transform import rotate, rescale
def sind(x):
return np.sin(x * np.pi / 180)
def cosd(x):
return np.cos(x * np.pi / 180)
def removePhaseRamp(input, dx):
Ny = input.shape[0]
Nx = input.shape[1]
y = np.linspace(-np.floor(Ny/2),np.ceil(Ny/2)-1,Ny)
x = np.linspace(-np.floor(Nx/2),np.ceil(Nx/2)-1,Nx)
[X,Y] = np.meshgrid(x,y)
X = X*dx
Y = Y*dx
phase_image = np.angle(input)
#fit ramp
Xf = X.flatten()
Yf = Y.flatten()
A = np.array([Xf*0+1, Xf, Yf]).T
B = phase_image.flatten()
coeff, r, rank, s = np.linalg.lstsq(A, B)
background = X*coeff[1]+Y*coeff[2]
output = phase_image - background
return output
def postProcess(obj, rot_angle, px, py, dx):
#Post process reconstructed object
# Convert from Matlab postProcess.m Y<NAME> (<EMAIL>)
#rotate object to 0 degree
py_rot = px*-sind(-rot_angle) + py*cosd(-rot_angle)
px_rot = px*cosd(-rot_angle) + py*sind(-rot_angle)
obj_rot_r = rescale(obj.real,2)
obj_rot_i = rescale(obj.imag,2)#upsample to reduce rotation artifacts
obj_rot_r = rotate(obj_rot_r, -rot_angle)
obj_rot_i = rotate(obj_rot_i, -rot_angle)
obj_rot = obj_rot_r + 1j*obj_rot_i
cen_rot = np.floor(np.size(obj_rot,1)/2)+1
dx = dx/2
y_lb = np.ceil(min(py_rot[0])/dx+cen_rot)
y_ub = np.floor(max(py_rot[0])/dx+cen_rot)
x_lb = np.ceil(min(px_rot[0])/dx+cen_rot)
x_ub = np.floor(max(px_rot[0])/dx+cen_rot)
obj_crop = obj_rot[int(y_lb):int(y_ub),int(x_lb):int(x_ub)]
#remove phase ramp
obj_crop_phase = removePhaseRamp(obj_crop, dx)
obj_crop = abs(obj_crop) * np.exp(1j*obj_crop_phase)
obj_crop_r = rescale(obj_crop.real,1/2)
obj_crop_i = rescale(obj_crop.imag,1/2) #scale back to original size
obj_crop = obj_crop_r + 1j*obj_crop_i
return obj_crop | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
323,
434,
8378,
259,
29896,
29871,
29906,
29941,
29901,
29906,
29929,
29901,
29946,
29900,
29871,
29906,
29900,
29906,
29896,
13,
13,
29992,
8921,
29901,
529,
5813,
29958,
13,
18455,
287,
515,
612,
29875,
18122,
574,
29915,
29879,
525,
2490,
7032,
29889,
29885,
4907,
13,
15945,
29908,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
3027,
29889,
9067,
1053,
16734,
29892,
620,
29883,
744,
13,
13,
1753,
3937,
29898,
29916,
1125,
13,
1678,
736,
7442,
29889,
5223,
29898,
29916,
334,
7442,
29889,
1631,
847,
29871,
29896,
29947,
29900,
29897,
13,
13,
1753,
6776,
29881,
29898,
29916,
1125,
13,
1678,
736,
7442,
29889,
3944,
29898,
29916,
334,
7442,
29889,
1631,
847,
29871,
29896,
29947,
29900,
29897,
13,
13,
1753,
3349,
4819,
559,
29934,
1160,
29898,
2080,
29892,
15414,
1125,
13,
1678,
16693,
353,
1881,
29889,
12181,
29961,
29900,
29962,
13,
1678,
405,
29916,
353,
1881,
29889,
12181,
29961,
29896,
29962,
13,
1678,
343,
353,
7442,
29889,
1915,
3493,
6278,
9302,
29889,
14939,
29898,
29940,
29891,
29914,
29906,
511,
9302,
29889,
27696,
29898,
29940,
29891,
29914,
29906,
6817,
29896,
29892,
29940,
29891,
29897,
13,
1678,
921,
353,
7442,
29889,
1915,
3493,
6278,
9302,
29889,
14939,
29898,
29940,
29916,
29914,
29906,
511,
9302,
29889,
27696,
29898,
29940,
29916,
29914,
29906,
6817,
29896,
29892,
29940,
29916,
29897,
13,
1678,
518,
29990,
29892,
29979,
29962,
353,
7442,
29889,
4467,
29882,
7720,
29898,
29916,
29892,
29891,
29897,
13,
1678,
1060,
353,
1060,
29930,
8235,
13,
1678,
612,
353,
612,
29930,
8235,
13,
1678,
8576,
29918,
3027,
353,
7442,
29889,
2521,
29898,
2080,
29897,
13,
13,
1678,
396,
9202,
364,
1160,
13,
1678,
1060,
29888,
353,
1060,
29889,
1579,
8606,
580,
13,
1678,
612,
29888,
353,
612,
29889,
1579,
8606,
580,
13,
1678,
319,
353,
7442,
29889,
2378,
4197,
29990,
29888,
29930,
29900,
29974,
29896,
29892,
1060,
29888,
29892,
612,
29888,
14664,
29911,
13,
1678,
350,
353,
8576,
29918,
3027,
29889,
1579,
8606,
580,
13,
1678,
1302,
12352,
29892,
364,
29892,
7115,
29892,
269,
353,
7442,
29889,
29880,
979,
29887,
29889,
20155,
3044,
29898,
29909,
29892,
350,
29897,
13,
1678,
3239,
353,
1060,
29930,
1111,
12352,
29961,
29896,
10062,
29979,
29930,
1111,
12352,
29961,
29906,
29962,
13,
1678,
1962,
353,
8576,
29918,
3027,
448,
3239,
13,
1678,
736,
1962,
13,
13,
13,
1753,
1400,
7032,
29898,
5415,
29892,
5731,
29918,
2521,
29892,
282,
29916,
29892,
11451,
29892,
15414,
1125,
13,
1678,
396,
6747,
1889,
337,
11433,
287,
1203,
13,
1678,
396,
14806,
515,
5345,
8205,
1400,
7032,
29889,
29885,
29871,
612,
29966,
5813,
29958,
313,
29966,
26862,
6227,
12948,
13,
13,
1678,
396,
23361,
1203,
304,
29871,
29900,
7426,
13,
1678,
11451,
29918,
5450,
353,
282,
29916,
29930,
29899,
29879,
513,
6278,
5450,
29918,
2521,
29897,
718,
11451,
29930,
3944,
29881,
6278,
5450,
29918,
2521,
29897,
13,
1678,
282,
29916,
29918,
5450,
353,
282,
29916,
29930,
3944,
29881,
6278,
5450,
29918,
2521,
29897,
718,
11451,
29930,
29879,
513,
6278,
5450,
29918,
2521,
29897,
13,
13,
1678,
5446,
29918,
5450,
29918,
29878,
353,
620,
29883,
744,
29898,
5415,
29889,
6370,
29892,
29906,
29897,
29871,
13,
1678,
5446,
29918,
5450,
29918,
29875,
353,
620,
29883,
744,
29898,
5415,
29889,
326,
351,
29892,
29906,
29897,
29937,
14340,
981,
304,
10032,
13733,
24238,
29879,
13,
1678,
5446,
29918,
5450,
29918,
29878,
353,
16734,
29898,
5415,
29918,
5450,
29918,
29878,
29892,
448,
5450,
29918,
2521,
29897,
13,
1678,
5446,
29918,
5450,
29918,
29875,
353,
16734,
29898,
5415,
29918,
5450,
29918,
29875,
29892,
448,
5450,
29918,
2521,
29897,
13,
1678,
5446,
29918,
5450,
353,
5446,
29918,
5450,
29918,
29878,
718,
29871,
29896,
29926,
29930,
5415,
29918,
5450,
29918,
29875,
13,
13,
1678,
274,
264,
29918,
5450,
353,
7442,
29889,
14939,
29898,
9302,
29889,
2311,
29898,
5415,
29918,
5450,
29892,
29896,
6802,
29906,
7240,
29896,
13,
13,
1678,
15414,
353,
15414,
29914,
29906,
13,
1678,
343,
29918,
27728,
353,
7442,
29889,
27696,
29898,
1195,
29898,
2272,
29918,
5450,
29961,
29900,
2314,
29914,
8235,
29974,
10278,
29918,
5450,
29897,
13,
1678,
343,
29918,
431,
353,
7442,
29889,
14939,
29898,
3317,
29898,
2272,
29918,
5450,
29961,
29900,
2314,
29914,
8235,
29974,
10278,
29918,
5450,
29897,
268,
13,
1678,
921,
29918,
27728,
353,
7442,
29889,
27696,
29898,
1195,
29898,
1756,
29918,
5450,
29961,
29900,
2314,
29914,
8235,
29974,
10278,
29918,
5450,
29897,
1678,
13,
1678,
921,
29918,
431,
353,
7442,
29889,
14939,
29898,
3317,
29898,
1756,
29918,
5450,
29961,
29900,
2314,
29914,
8235,
29974,
10278,
29918,
5450,
29897,
13,
268,
13,
1678,
5446,
29918,
29883,
1336,
353,
5446,
29918,
5450,
29961,
524,
29898,
29891,
29918,
27728,
1125,
524,
29898,
29891,
29918,
431,
511,
524,
29898,
29916,
29918,
27728,
1125,
524,
29898,
29916,
29918,
431,
4638,
13,
268,
13,
1678,
396,
5992,
8576,
364,
1160,
13,
1678,
5446,
29918,
29883,
1336,
29918,
21646,
353,
3349,
4819,
559,
29934,
1160,
29898,
5415,
29918,
29883,
1336,
29892,
15414,
29897,
13,
1678,
5446,
29918,
29883,
1336,
353,
6425,
29898,
5415,
29918,
29883,
1336,
29897,
334,
7442,
29889,
4548,
29898,
29896,
29926,
29930,
5415,
29918,
29883,
1336,
29918,
21646,
29897,
13,
1678,
5446,
29918,
29883,
1336,
29918,
29878,
353,
620,
29883,
744,
29898,
5415,
29918,
29883,
1336,
29889,
6370,
29892,
29896,
29914,
29906,
29897,
29871,
13,
1678,
5446,
29918,
29883,
1336,
29918,
29875,
353,
620,
29883,
744,
29898,
5415,
29918,
29883,
1336,
29889,
326,
351,
29892,
29896,
29914,
29906,
29897,
396,
7052,
1250,
304,
2441,
2159,
13,
1678,
5446,
29918,
29883,
1336,
353,
5446,
29918,
29883,
1336,
29918,
29878,
718,
29871,
29896,
29926,
29930,
5415,
29918,
29883,
1336,
29918,
29875,
13,
13,
1678,
736,
5446,
29918,
29883,
1336,
2
] |
data_sqlalchemy/word.py | natter1/estonian_learner | 0 | 29159 | import datetime
from data_sqlalchemy.modelbase import SqlAlchemyBase
import sqlalchemy as sa
class Word(SqlAlchemyBase):
__tablename__ = "words"
# id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
id = sa.Column(sa.String, primary_key=True)
created_date = sa.Column(sa.DateTime, default=datetime.datetime.now, index=True)
hint = sa.String() # not supported by sqlite: nullable=True
def __repr__(self): # for more useful debug messages
return f"<Package {self.id}>"
| [
1,
1053,
12865,
13,
13,
3166,
848,
29918,
2850,
284,
305,
6764,
29889,
4299,
3188,
1053,
13093,
2499,
305,
6764,
5160,
13,
5215,
4576,
284,
305,
6764,
408,
872,
13,
13,
13,
1990,
10803,
29898,
10520,
2499,
305,
6764,
5160,
1125,
13,
1678,
4770,
3891,
2435,
420,
1649,
353,
376,
9303,
29908,
13,
1678,
396,
1178,
353,
872,
29889,
4409,
29898,
4977,
29889,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
4469,
25629,
29922,
5574,
29897,
13,
1678,
1178,
353,
872,
29889,
4409,
29898,
4977,
29889,
1231,
29892,
7601,
29918,
1989,
29922,
5574,
29897,
13,
1678,
2825,
29918,
1256,
353,
872,
29889,
4409,
29898,
4977,
29889,
11384,
29892,
2322,
29922,
12673,
29889,
12673,
29889,
3707,
29892,
2380,
29922,
5574,
29897,
13,
1678,
13182,
353,
872,
29889,
1231,
580,
29871,
396,
451,
6969,
491,
21120,
29901,
1870,
519,
29922,
5574,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
29871,
396,
363,
901,
5407,
4744,
7191,
13,
4706,
736,
285,
29908,
29966,
14459,
426,
1311,
29889,
333,
29913,
11903,
13,
2
] |
src/features/junjie_features.py | davidjurgens/prosocial-conversation-forecasting | 3 | 41252 | import os
import pandas as pd
import datetime
from genderperformr import GenderPerformr
from agreementr import Agreementr
from politenessr import Politenessr
from supportr import Supportr
import enchant
import requests
import json
from googleapiclient import discovery
from enchant.checker import SpellChecker
from enchant.tokenize import get_tokenizer
from nltk.tokenize import word_tokenize
import nltk
import time
nltk.download('punkt')
def clean_text(text):
tokens = word_tokenize(text)
words = [word for word in tokens if word.isalpha()]
return ' '.join(words)
def extract_features(tlc):
"""extract features from the text
Args:
tlc (dict[str]): all the attributes of a tlc
Returns:
[dict]: a dictionary of features extracted
"""
text = clean_text(tlc['body'])
fields = dict()
# add features here #
fields['Top_comment_word_count'] = len(text.split(' '))
fields['Top_comment_text'] = text
# Extract time-based features
def get_day_of_week(text):
return datetime.datetime.strptime(text, '%Y-%m-%d %H:%M:%S').weekday() + 1
def get_day_of_month(text):
return datetime.datetime.strptime(text, '%Y-%m-%d %H:%M:%S').day
def get_time_of_day(text):
return datetime.datetime.strptime(text, '%Y-%m-%d %H:%M:%S').hour
time_local = time.localtime(tlc['created_utc'])
time_local = time.strftime("%Y-%m-%d %H:%M:%S", time_local)
fields['Top_comment_day'] = get_day_of_month(time_local)
fields['Top_comment_day_of_week'] = get_day_of_week(time_local)
fields['Top_comment_hour'] = get_time_of_day(time_local)
# Extract gender value
gp = GenderPerformr()
probs, _ = gp.predict(tlc['author'])
# Rescale it from [0,1] to [-1,1]
fields['Top_comment_author_gender_value'] = 2 * probs - 1
# Extract percentage of mispellings
check = SpellChecker("en_US")
tokenizer = get_tokenizer("en_US")
# Prevent the denominator from 0
def weird_division(n, d):
return n / d if d else 0
def get_mispellings_percentage(text):
mispelling_count = 0
total_count = 0
if text == 'nan':
return total_count
else:
check.set_text(text)
for err in check:
mispelling_count = mispelling_count + 1
for w in tokenizer(text):
total_count = total_count + 1
value = weird_division(mispelling_count, total_count)
return value
fields['Top_comment_mispellings'] = get_mispellings_percentage(text)
# Get politeness, agreement, support scores, and rescale them from [1,5] to [-1,1]
ar = Agreementr()
pr = Politenessr()
sr = Supportr()
fields['Top_comment_agreement_value'] = 0.5*float(ar.predict([text]))-1.5
fields['Top_comment_politeness_value'] = 0.5*float(pr.predict([text]))-1.5
fields['Top_comment_support_value'] = 0.5*float(sr.predict([text]))-1.5
# Get toxicity scores
KEY = "yourkey.txt" # os.getenv("GOOGLE_API_KEY")
service = discovery.build('commentanalyzer', 'v1alpha1', developerKey=KEY)
def get_results(request_id, response, exception):
toxicity_scores.append((request_id, response))
toxicity_scores = []
count = 0
batch = service.new_batch_http_request(callback=get_results)
analyze_request = {
'comment': {'text': text},
"requestedAttributes": {
"TOXICITY": {},
"SEVERE_TOXICITY": {},
"ATTACK_ON_COMMENTER": {}
}
}
batch.add(service.comments().analyze(body=analyze_request), request_id=str(count))
batch.execute()
toxic_score = toxicity_scores[0][1]['attributeScores']['TOXICITY']['summaryScore']['value']
attack_score = toxicity_scores[0][1]['attributeScores']['ATTACK_ON_COMMENTER']['summaryScore']['value']
if toxic_score > 0.5:
fields['Top_comment_untuned_toxicity'] = 1
else:
fields['Top_comment_untuned_toxicity'] = 0
if toxic_score > 0.8 and attack_score > 0.5:
fields['Top_comment_tuned_toxicity'] = 1
else:
fields['Top_comment_tuned_toxicity'] = 0
# end of feature extractions #
return fields
def close(istream):
"""call deconstructors if needed
"""
# e.g. close files or disconnect apis
istream.close()
def main():
istream, df = init()
data = ["what's the date today?"]
features = map(extract_features, data)
close(istream)
main()
| [
1,
1053,
2897,
13,
5215,
11701,
408,
10518,
13,
5215,
12865,
13,
3166,
23346,
19826,
29878,
1053,
402,
1581,
5894,
689,
29878,
13,
3166,
17327,
29878,
1053,
4059,
276,
882,
29878,
13,
3166,
2832,
18543,
29878,
1053,
2043,
3537,
404,
29878,
13,
3166,
2304,
29878,
1053,
18601,
29878,
13,
5215,
427,
13775,
13,
5215,
7274,
13,
5215,
4390,
13,
3166,
5386,
481,
293,
1593,
1053,
20699,
13,
3166,
427,
13775,
29889,
3198,
261,
1053,
1706,
514,
5596,
261,
13,
3166,
427,
13775,
29889,
6979,
675,
1053,
679,
29918,
6979,
3950,
13,
3166,
302,
1896,
29895,
29889,
6979,
675,
1053,
1734,
29918,
6979,
675,
13,
5215,
302,
1896,
29895,
13,
5215,
931,
13,
29876,
1896,
29895,
29889,
10382,
877,
19294,
1495,
13,
13,
13,
1753,
5941,
29918,
726,
29898,
726,
1125,
13,
1678,
18897,
353,
1734,
29918,
6979,
675,
29898,
726,
29897,
13,
1678,
3838,
353,
518,
1742,
363,
1734,
297,
18897,
565,
1734,
29889,
275,
2312,
580,
29962,
13,
1678,
736,
525,
15300,
7122,
29898,
9303,
29897,
13,
13,
13,
1753,
6597,
29918,
22100,
29898,
15206,
29883,
1125,
13,
1678,
9995,
21111,
5680,
515,
278,
1426,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
260,
29880,
29883,
313,
8977,
29961,
710,
29962,
1125,
599,
278,
8393,
310,
263,
260,
29880,
29883,
13,
13,
1678,
16969,
29901,
13,
4706,
518,
8977,
5387,
263,
8600,
310,
5680,
23892,
13,
1678,
9995,
13,
1678,
1426,
353,
5941,
29918,
726,
29898,
15206,
29883,
1839,
2587,
11287,
13,
1678,
4235,
353,
9657,
580,
13,
1678,
396,
788,
5680,
1244,
396,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
1742,
29918,
2798,
2033,
353,
7431,
29898,
726,
29889,
5451,
877,
525,
876,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
726,
2033,
353,
1426,
13,
13,
1678,
396,
7338,
1461,
931,
29899,
6707,
5680,
13,
1678,
822,
679,
29918,
3250,
29918,
974,
29918,
18448,
29898,
726,
1125,
13,
4706,
736,
12865,
29889,
12673,
29889,
710,
415,
603,
29898,
726,
29892,
14210,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
2824,
18448,
3250,
580,
718,
29871,
29896,
13,
13,
1678,
822,
679,
29918,
3250,
29918,
974,
29918,
10874,
29898,
726,
1125,
13,
4706,
736,
12865,
29889,
12673,
29889,
710,
415,
603,
29898,
726,
29892,
14210,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
2824,
3250,
13,
13,
1678,
822,
679,
29918,
2230,
29918,
974,
29918,
3250,
29898,
726,
1125,
13,
4706,
736,
12865,
29889,
12673,
29889,
710,
415,
603,
29898,
726,
29892,
14210,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
2824,
18721,
13,
1678,
931,
29918,
2997,
353,
931,
29889,
2997,
2230,
29898,
15206,
29883,
1839,
11600,
29918,
329,
29883,
11287,
13,
1678,
931,
29918,
2997,
353,
931,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
613,
931,
29918,
2997,
29897,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
3250,
2033,
353,
679,
29918,
3250,
29918,
974,
29918,
10874,
29898,
2230,
29918,
2997,
29897,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
3250,
29918,
974,
29918,
18448,
2033,
353,
679,
29918,
3250,
29918,
974,
29918,
18448,
29898,
2230,
29918,
2997,
29897,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
18721,
2033,
353,
679,
29918,
2230,
29918,
974,
29918,
3250,
29898,
2230,
29918,
2997,
29897,
13,
13,
1678,
396,
7338,
1461,
23346,
995,
13,
1678,
330,
29886,
353,
402,
1581,
5894,
689,
29878,
580,
13,
1678,
2070,
29879,
29892,
903,
353,
330,
29886,
29889,
27711,
29898,
15206,
29883,
1839,
8921,
11287,
13,
1678,
396,
2538,
29883,
744,
372,
515,
518,
29900,
29892,
29896,
29962,
304,
21069,
29896,
29892,
29896,
29962,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
8921,
29918,
26098,
29918,
1767,
2033,
353,
29871,
29906,
334,
2070,
29879,
448,
29871,
29896,
13,
13,
1678,
396,
7338,
1461,
19649,
310,
3984,
29886,
514,
886,
13,
1678,
1423,
353,
1706,
514,
5596,
261,
703,
264,
29918,
3308,
1159,
13,
1678,
5993,
3950,
353,
679,
29918,
6979,
3950,
703,
264,
29918,
3308,
1159,
13,
1678,
396,
4721,
794,
278,
14267,
1061,
515,
29871,
29900,
13,
1678,
822,
13543,
29918,
4563,
2459,
29898,
29876,
29892,
270,
1125,
13,
4706,
736,
302,
847,
270,
565,
270,
1683,
29871,
29900,
13,
13,
1678,
822,
679,
29918,
29885,
11936,
514,
886,
29918,
25376,
482,
29898,
726,
1125,
13,
4706,
3984,
29886,
7807,
29918,
2798,
353,
29871,
29900,
13,
4706,
3001,
29918,
2798,
353,
29871,
29900,
13,
4706,
565,
1426,
1275,
525,
13707,
2396,
13,
9651,
736,
3001,
29918,
2798,
13,
4706,
1683,
29901,
13,
9651,
1423,
29889,
842,
29918,
726,
29898,
726,
29897,
13,
9651,
363,
4589,
297,
1423,
29901,
13,
18884,
3984,
29886,
7807,
29918,
2798,
353,
3984,
29886,
7807,
29918,
2798,
718,
29871,
29896,
13,
9651,
363,
281,
297,
5993,
3950,
29898,
726,
1125,
13,
18884,
3001,
29918,
2798,
353,
3001,
29918,
2798,
718,
29871,
29896,
13,
9651,
995,
353,
13543,
29918,
4563,
2459,
29898,
29885,
11936,
7807,
29918,
2798,
29892,
3001,
29918,
2798,
29897,
13,
9651,
736,
995,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
29885,
11936,
514,
886,
2033,
353,
679,
29918,
29885,
11936,
514,
886,
29918,
25376,
482,
29898,
726,
29897,
13,
13,
1678,
396,
3617,
2832,
18543,
29892,
17327,
29892,
2304,
19435,
29892,
322,
620,
29883,
744,
963,
515,
518,
29896,
29892,
29945,
29962,
304,
21069,
29896,
29892,
29896,
29962,
13,
1678,
564,
353,
4059,
276,
882,
29878,
580,
13,
1678,
544,
353,
2043,
3537,
404,
29878,
580,
13,
1678,
27236,
353,
18601,
29878,
580,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
351,
276,
882,
29918,
1767,
2033,
353,
29871,
29900,
29889,
29945,
29930,
7411,
29898,
279,
29889,
27711,
4197,
726,
12622,
29899,
29896,
29889,
29945,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
3733,
3537,
404,
29918,
1767,
2033,
353,
29871,
29900,
29889,
29945,
29930,
7411,
29898,
558,
29889,
27711,
4197,
726,
12622,
29899,
29896,
29889,
29945,
13,
1678,
4235,
1839,
7031,
29918,
9342,
29918,
5924,
29918,
1767,
2033,
353,
29871,
29900,
29889,
29945,
29930,
7411,
29898,
21935,
29889,
27711,
4197,
726,
12622,
29899,
29896,
29889,
29945,
13,
13,
1678,
396,
3617,
304,
29916,
24798,
19435,
13,
1678,
14636,
353,
376,
8066,
1989,
29889,
3945,
29908,
396,
2897,
29889,
657,
6272,
703,
17080,
29949,
29954,
1307,
29918,
8787,
29918,
10818,
1159,
13,
1678,
2669,
353,
20699,
29889,
4282,
877,
9342,
24209,
3298,
742,
525,
29894,
29896,
2312,
29896,
742,
13897,
2558,
29922,
10818,
29897,
13,
13,
1678,
822,
679,
29918,
9902,
29898,
3827,
29918,
333,
29892,
2933,
29892,
3682,
1125,
13,
4706,
304,
29916,
24798,
29918,
1557,
2361,
29889,
4397,
3552,
3827,
29918,
333,
29892,
2933,
876,
13,
13,
1678,
304,
29916,
24798,
29918,
1557,
2361,
353,
5159,
13,
1678,
2302,
353,
29871,
29900,
13,
1678,
9853,
353,
2669,
29889,
1482,
29918,
16175,
29918,
1124,
29918,
3827,
29898,
14035,
29922,
657,
29918,
9902,
29897,
13,
1678,
27599,
29918,
3827,
353,
426,
13,
4706,
525,
9342,
2396,
11117,
726,
2396,
1426,
1118,
13,
4706,
376,
3827,
287,
15801,
1115,
426,
13,
9651,
376,
4986,
29990,
2965,
11937,
1115,
24335,
13,
9651,
376,
1660,
5348,
29923,
29918,
4986,
29990,
2965,
11937,
1115,
24335,
13,
9651,
376,
1299,
8687,
29968,
29918,
1164,
29918,
3217,
7428,
3919,
1001,
1115,
6571,
13,
4706,
500,
13,
1678,
500,
13,
1678,
9853,
29889,
1202,
29898,
5509,
29889,
21032,
2141,
24209,
911,
29898,
2587,
29922,
24209,
911,
29918,
3827,
511,
2009,
29918,
333,
29922,
710,
29898,
2798,
876,
13,
1678,
9853,
29889,
7978,
580,
13,
1678,
304,
27375,
29918,
13628,
353,
304,
29916,
24798,
29918,
1557,
2361,
29961,
29900,
3816,
29896,
22322,
12715,
4421,
2361,
16215,
4986,
29990,
2965,
11937,
16215,
7727,
20097,
16215,
1767,
2033,
13,
1678,
5337,
29918,
13628,
353,
304,
29916,
24798,
29918,
1557,
2361,
29961,
29900,
3816,
29896,
22322,
12715,
4421,
2361,
16215,
1299,
8687,
29968,
29918,
1164,
29918,
3217,
7428,
3919,
1001,
16215,
7727,
20097,
16215,
1767,
2033,
13,
1678,
565,
304,
27375,
29918,
13628,
1405,
29871,
29900,
29889,
29945,
29901,
13,
4706,
4235,
1839,
7031,
29918,
9342,
29918,
1657,
348,
287,
29918,
517,
29916,
24798,
2033,
353,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
4235,
1839,
7031,
29918,
9342,
29918,
1657,
348,
287,
29918,
517,
29916,
24798,
2033,
353,
29871,
29900,
13,
1678,
565,
304,
27375,
29918,
13628,
1405,
29871,
29900,
29889,
29947,
322,
5337,
29918,
13628,
1405,
29871,
29900,
29889,
29945,
29901,
13,
4706,
4235,
1839,
7031,
29918,
9342,
29918,
29873,
348,
287,
29918,
517,
29916,
24798,
2033,
353,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
4235,
1839,
7031,
29918,
9342,
29918,
29873,
348,
287,
29918,
517,
29916,
24798,
2033,
353,
29871,
29900,
13,
1678,
396,
1095,
310,
4682,
4805,
1953,
396,
13,
1678,
736,
4235,
13,
13,
13,
1753,
3802,
29898,
391,
1633,
1125,
13,
1678,
9995,
4804,
316,
11433,
943,
565,
4312,
13,
1678,
9995,
13,
1678,
396,
321,
29889,
29887,
29889,
3802,
2066,
470,
766,
6915,
3095,
275,
13,
1678,
1752,
1633,
29889,
5358,
580,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1752,
1633,
29892,
4489,
353,
2069,
580,
13,
1678,
848,
353,
6796,
5816,
29915,
29879,
278,
2635,
9826,
3026,
29962,
13,
1678,
5680,
353,
2910,
29898,
21111,
29918,
22100,
29892,
848,
29897,
13,
1678,
3802,
29898,
391,
1633,
29897,
13,
13,
13,
3396,
580,
13,
2
] |
social_auth/fields.py | thesealion/django-social-auth | 0 | 67994 | <reponame>thesealion/django-social-auth
import json
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import smart_unicode
class SubfieldBase(type):
"""
A metaclass for custom Field subclasses. This ensures the model's attribute
has the descriptor protocol attached to it.
"""
def __new__(cls, name, bases, attrs):
new_class = super(SubfieldBase, cls).__new__(cls, name, bases, attrs)
new_class.contribute_to_class = make_contrib(
new_class, attrs.get('contribute_to_class')
)
return new_class
class Creator(object):
"""
A placeholder class that provides a way to set the attribute on the model.
"""
def __init__(self, field):
self.field = field
def __get__(self, obj, type=None):
if obj is None:
return self
return obj.__dict__[self.field.name]
def __set__(self, obj, value):
obj.__dict__[self.field.name] = self.field.to_python(value)
def make_contrib(superclass, func=None):
"""
Returns a suitable contribute_to_class() method for the Field subclass.
If 'func' is passed in, it is the existing contribute_to_class() method on
the subclass and it is called before anything else. It is assumed in this
case that the existing contribute_to_class() calls all the necessary
superclass methods.
"""
def contribute_to_class(self, cls, name, **kwargs):
if func:
func(self, cls, name, **kwargs)
else:
super(superclass, self).contribute_to_class(cls, name, **kwargs)
setattr(cls, self.name, Creator(self))
return contribute_to_class
class JSONField(models.TextField):
"""Simple JSON field that stores python structures as JSON strings
on database.
"""
__metaclass__ = SubfieldBase
def to_python(self, value):
"""
Convert the input JSON value into python structures, raises
django.core.exceptions.ValidationError if the data can't be converted.
"""
if self.blank and not value:
return None
if isinstance(value, basestring):
try:
return json.loads(value)
except Exception, e:
raise ValidationError(str(e))
else:
return value
def validate(self, value, model_instance):
"""Check value is a valid JSON string, raise ValidationError on
error."""
super(JSONField, self).validate(value, model_instance)
try:
return json.loads(value)
except Exception, e:
raise ValidationError(str(e))
def get_prep_value(self, value):
"""Convert value to JSON string before save"""
try:
return json.dumps(value)
except Exception, e:
raise ValidationError(str(e))
def value_to_string(self, obj):
"""Return value from object converted to string properly"""
return smart_unicode(self.get_prep_value(self._get_val_from_obj(obj)))
| [
1,
529,
276,
1112,
420,
29958,
386,
968,
20235,
29914,
14095,
29899,
24911,
29899,
5150,
13,
5215,
4390,
13,
13,
3166,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
15758,
362,
2392,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
13239,
29889,
22331,
1053,
15040,
29918,
2523,
356,
13,
13,
1990,
3323,
2671,
5160,
29898,
1853,
1125,
13,
1678,
9995,
13,
1678,
319,
1539,
562,
605,
363,
2888,
8989,
1014,
13203,
29889,
910,
5662,
1973,
278,
1904,
29915,
29879,
5352,
13,
1678,
756,
278,
553,
11709,
9608,
10959,
304,
372,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
1482,
12035,
25932,
29892,
1024,
29892,
22561,
29892,
12421,
29879,
1125,
13,
4706,
716,
29918,
1990,
353,
2428,
29898,
4035,
2671,
5160,
29892,
1067,
29879,
467,
1649,
1482,
12035,
25932,
29892,
1024,
29892,
22561,
29892,
12421,
29879,
29897,
13,
4706,
716,
29918,
1990,
29889,
1285,
2666,
29918,
517,
29918,
1990,
353,
1207,
29918,
21570,
29898,
13,
9651,
716,
29918,
1990,
29892,
12421,
29879,
29889,
657,
877,
1285,
2666,
29918,
517,
29918,
1990,
1495,
13,
4706,
1723,
13,
4706,
736,
716,
29918,
1990,
13,
13,
13,
1990,
6760,
1061,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
319,
12983,
770,
393,
8128,
263,
982,
304,
731,
278,
5352,
373,
278,
1904,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1746,
1125,
13,
4706,
1583,
29889,
2671,
353,
1746,
13,
13,
1678,
822,
4770,
657,
12035,
1311,
29892,
5446,
29892,
1134,
29922,
8516,
1125,
13,
4706,
565,
5446,
338,
6213,
29901,
13,
9651,
736,
1583,
13,
4706,
736,
5446,
17255,
8977,
1649,
29961,
1311,
29889,
2671,
29889,
978,
29962,
13,
13,
1678,
822,
4770,
842,
12035,
1311,
29892,
5446,
29892,
995,
1125,
13,
4706,
5446,
17255,
8977,
1649,
29961,
1311,
29889,
2671,
29889,
978,
29962,
353,
1583,
29889,
2671,
29889,
517,
29918,
4691,
29898,
1767,
29897,
13,
13,
13,
1753,
1207,
29918,
21570,
29898,
9136,
1990,
29892,
3653,
29922,
8516,
1125,
13,
1678,
9995,
13,
1678,
16969,
263,
13907,
29126,
29918,
517,
29918,
1990,
580,
1158,
363,
278,
8989,
19481,
29889,
13,
1678,
960,
525,
9891,
29915,
338,
4502,
297,
29892,
372,
338,
278,
5923,
29126,
29918,
517,
29918,
1990,
580,
1158,
373,
13,
1678,
278,
19481,
322,
372,
338,
2000,
1434,
3099,
1683,
29889,
739,
338,
12023,
297,
445,
13,
1678,
1206,
393,
278,
5923,
29126,
29918,
517,
29918,
1990,
580,
5717,
599,
278,
5181,
13,
1678,
2428,
1990,
3519,
29889,
13,
1678,
9995,
13,
1678,
822,
29126,
29918,
517,
29918,
1990,
29898,
1311,
29892,
1067,
29879,
29892,
1024,
29892,
3579,
19290,
1125,
13,
4706,
565,
3653,
29901,
13,
9651,
3653,
29898,
1311,
29892,
1067,
29879,
29892,
1024,
29892,
3579,
19290,
29897,
13,
4706,
1683,
29901,
13,
9651,
2428,
29898,
9136,
1990,
29892,
1583,
467,
1285,
2666,
29918,
517,
29918,
1990,
29898,
25932,
29892,
1024,
29892,
3579,
19290,
29897,
13,
4706,
731,
5552,
29898,
25932,
29892,
1583,
29889,
978,
29892,
6760,
1061,
29898,
1311,
876,
13,
13,
1678,
736,
29126,
29918,
517,
29918,
1990,
13,
13,
13,
1990,
4663,
3073,
29898,
9794,
29889,
15778,
1125,
13,
1678,
9995,
15427,
4663,
1746,
393,
14422,
3017,
12286,
408,
4663,
6031,
13,
1678,
373,
2566,
29889,
13,
1678,
9995,
13,
13,
1678,
4770,
2527,
562,
605,
1649,
353,
3323,
2671,
5160,
13,
13,
1678,
822,
304,
29918,
4691,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
13,
4706,
14806,
278,
1881,
4663,
995,
964,
3017,
12286,
29892,
1153,
4637,
13,
4706,
9557,
29889,
3221,
29889,
11739,
29879,
29889,
19448,
2392,
565,
278,
848,
508,
29915,
29873,
367,
11543,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
19465,
322,
451,
995,
29901,
13,
9651,
736,
6213,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
2362,
342,
5393,
1125,
13,
9651,
1018,
29901,
13,
18884,
736,
4390,
29889,
18132,
29898,
1767,
29897,
13,
9651,
5174,
8960,
29892,
321,
29901,
13,
18884,
12020,
15758,
362,
2392,
29898,
710,
29898,
29872,
876,
13,
4706,
1683,
29901,
13,
9651,
736,
995,
13,
13,
1678,
822,
12725,
29898,
1311,
29892,
995,
29892,
1904,
29918,
8758,
1125,
13,
4706,
9995,
5596,
995,
338,
263,
2854,
4663,
1347,
29892,
12020,
15758,
362,
2392,
373,
13,
4706,
1059,
1213,
15945,
13,
4706,
2428,
29898,
7249,
3073,
29892,
1583,
467,
15480,
29898,
1767,
29892,
1904,
29918,
8758,
29897,
13,
4706,
1018,
29901,
13,
9651,
736,
4390,
29889,
18132,
29898,
1767,
29897,
13,
4706,
5174,
8960,
29892,
321,
29901,
13,
9651,
12020,
15758,
362,
2392,
29898,
710,
29898,
29872,
876,
13,
13,
1678,
822,
679,
29918,
15287,
29918,
1767,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
18455,
995,
304,
4663,
1347,
1434,
4078,
15945,
29908,
13,
4706,
1018,
29901,
13,
9651,
736,
4390,
29889,
29881,
17204,
29898,
1767,
29897,
13,
4706,
5174,
8960,
29892,
321,
29901,
13,
9651,
12020,
15758,
362,
2392,
29898,
710,
29898,
29872,
876,
13,
13,
1678,
822,
995,
29918,
517,
29918,
1807,
29898,
1311,
29892,
5446,
1125,
13,
4706,
9995,
11609,
995,
515,
1203,
11543,
304,
1347,
6284,
15945,
29908,
13,
4706,
736,
15040,
29918,
2523,
356,
29898,
1311,
29889,
657,
29918,
15287,
29918,
1767,
29898,
1311,
3032,
657,
29918,
791,
29918,
3166,
29918,
5415,
29898,
5415,
4961,
13,
2
] |
pages/admin.py | nnscr/nnscr.de | 0 | 100200 | <reponame>nnscr/nnscr.de
from django.contrib import admin
from django import forms
from . import models
from nnmarkdown.form import MarkdownWidget
from nnscr.admin import site
class PageAdminForm(forms.ModelForm):
class Meta:
model = models.Page
exclude = ("slug",)
widgets = {
"text": MarkdownWidget
}
class PageAdmin(admin.ModelAdmin):
form = PageAdminForm
site.register(models.Page, PageAdmin)
| [
1,
529,
276,
1112,
420,
29958,
15755,
10526,
29914,
15755,
10526,
29889,
311,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
3166,
9557,
1053,
7190,
13,
3166,
869,
1053,
4733,
13,
3166,
302,
29876,
3502,
3204,
29889,
689,
1053,
4485,
3204,
8801,
13,
3166,
302,
29876,
10526,
29889,
6406,
1053,
3268,
13,
13,
13,
1990,
9305,
12754,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4733,
29889,
5074,
13,
4706,
19060,
353,
4852,
29517,
613,
29897,
13,
4706,
11109,
29879,
353,
426,
13,
9651,
376,
726,
1115,
4485,
3204,
8801,
13,
4706,
500,
13,
13,
13,
1990,
9305,
12754,
29898,
6406,
29889,
3195,
12754,
1125,
13,
1678,
883,
353,
9305,
12754,
2500,
13,
13,
13,
2746,
29889,
9573,
29898,
9794,
29889,
5074,
29892,
9305,
12754,
29897,
13,
2
] |
imageclassification/training/session.py | aisosalo/CIFAR-10 | 4 | 30637 | <gh_stars>1-10
import sys
import os
import time
import random
import numpy as np
from termcolor import colored
from functools import partial
from tensorboardX import SummaryWriter
import torch
from torch.utils.data import DataLoader
from torchvision import transforms as tv_transforms
import solt.transforms as slt
import solt.core as slc
import operator
from imageclassification.training.arguments import parse_args
from imageclassification.training.dataset import ImageClassificationDataset
from imageclassification.training.dataset import apply_by_index, img_labels2solt, unpack_solt_data
from imageclassification.training.transformations import init_train_augs
from imageclassification.kvs import GlobalKVS
import imageclassification.training.transformations as trnsfs
PAD_TO = 34
CROP_SIZE = 32
DEBUG = sys.gettrace() is not None
def init_session():
if not torch.cuda.is_available():
raise EnvironmentError('The code must be run on GPU.')
kvs = GlobalKVS()
args = parse_args()
if DEBUG:
args.n_threads = 0
torch.manual_seed(args.seed)
torch.cuda.manual_seed(args.seed)
random.seed(args.seed)
np.random.seed(args.seed)
snapshot_name = time.strftime('%Y_%m_%d_%H_%M')
os.makedirs(os.path.join(args.snapshots, args.dataset_name, snapshot_name), exist_ok=True)
kvs.update('pytorch_version', torch.__version__)
print('Pytorch version: ', torch.__version__)
if torch.cuda.is_available():
kvs.update('cuda', torch.version.cuda)
kvs.update('gpus', torch.cuda.device_count())
print('CUDA version: ', torch.version.cuda)
else:
kvs.update('cuda', None)
kvs.update('gpus', None)
kvs.update('snapshot_name', snapshot_name)
kvs.update('args', args)
kvs.save_pkl(os.path.join(args.snapshots, args.dataset_name, snapshot_name, 'session.pkl'))
return args, snapshot_name
def init_data_processing(ds):
kvs = GlobalKVS()
train_augs = init_train_augs(crop_mode='r', pad_mode='r') # random crop, reflective padding
dataset = ImageClassificationDataset(ds, split=kvs['metadata'], color_space=kvs['args'].color_space, transformations=train_augs)
mean_vector, std_vector = trnsfs.init_mean_std(dataset=dataset,
batch_size=kvs['args'].bs,
n_threads=kvs['args'].n_threads,
save_mean_std=kvs['args'].snapshots + '/' + kvs['args'].dataset_name,
color_space=kvs['args'].color_space)
print('Color space: ', kvs['args'].color_space)
print(colored('====> ', 'red') + 'Mean:', mean_vector)
print(colored('====> ', 'red') + 'Std:', std_vector)
norm_trf = tv_transforms.Normalize(torch.from_numpy(mean_vector).float(),
torch.from_numpy(std_vector).float())
train_trf = tv_transforms.Compose([
train_augs,
partial(apply_by_index, transform=norm_trf, idx=0)
])
val_trf = tv_transforms.Compose([
img_labels2solt,
slc.Stream([
slt.PadTransform(pad_to=(PAD_TO, PAD_TO)),
slt.CropTransform(crop_size=(CROP_SIZE, CROP_SIZE), crop_mode='c'), # center crop
]),
unpack_solt_data,
partial(apply_by_index, transform=tv_transforms.ToTensor(), idx=0),
partial(apply_by_index, transform=norm_trf, idx=0)
])
kvs.update('train_trf', train_trf)
kvs.update('val_trf', val_trf)
kvs.save_pkl(os.path.join(kvs['args'].snapshots, kvs['args'].dataset_name, kvs['snapshot_name'], 'session.pkl'))
def init_loaders(dataset, x_train, x_val):
kvs = GlobalKVS()
train_dataset = ImageClassificationDataset(dataset,
split=x_train,
color_space=kvs['args'].color_space,
transformations=kvs['train_trf'])
val_dataset = ImageClassificationDataset(dataset,
split=x_val,
color_space=kvs['args'].color_space,
transformations=kvs['val_trf'])
train_loader = DataLoader(train_dataset,
batch_size=kvs['args'].bs,
num_workers=kvs['args'].n_threads,
drop_last=True,
worker_init_fn=lambda wid: np.random.seed(np.uint32(torch.initial_seed() + wid)))
val_loader = DataLoader(val_dataset,
batch_size=kvs['args'].val_bs,
num_workers=kvs['args'].n_threads)
return train_loader, val_loader
def init_folds():
kvs = GlobalKVS()
writers = {}
cv_split_train = {}
for fold_id, split in enumerate(kvs['cv_split_all_folds']):
if kvs['args'].fold != -1 and fold_id != kvs['args'].fold:
continue
kvs.update(f'losses_fold_[{fold_id}]', None, list)
kvs.update(f'val_metrics_fold_[{fold_id}]', None, list)
cv_split_train[fold_id] = split
writers[fold_id] = SummaryWriter(os.path.join(kvs['args'].logs,
kvs['args'].dataset_name,
'fold_{}'.format(fold_id), kvs['snapshot_name']))
kvs.update('cv_split_train', cv_split_train)
kvs.save_pkl(os.path.join(kvs['args'].snapshots, kvs['args'].dataset_name, kvs['snapshot_name'], 'session.pkl'))
return writers
def save_checkpoint(model, val_metric_name, comparator='lt'): # lt, less than
if isinstance(model, torch.nn.DataParallel):
model = model.module
kvs = GlobalKVS()
fold_id = kvs['cur_fold']
epoch = kvs['cur_epoch']
val_metric = kvs[f'val_metrics_fold_[{fold_id}]'][-1][0][val_metric_name]
comparator = getattr(operator, comparator)
cur_snapshot_name = os.path.join(kvs['args'].snapshots, kvs['args'].dataset_name, kvs['snapshot_name'],
f'fold_{fold_id}_epoch_{epoch+1}.pth')
if kvs['prev_model'] is None:
print(colored('====> ', 'red') + 'Snapshot was saved to', cur_snapshot_name)
torch.save(model.state_dict(), cur_snapshot_name)
kvs.update('prev_model', cur_snapshot_name)
kvs.update('best_val_metric', val_metric)
else:
if comparator(val_metric, kvs['best_val_metric']):
print(colored('====> ', 'red') + 'Snapshot was saved to', cur_snapshot_name)
os.remove(kvs['prev_model'])
torch.save(model.state_dict(), cur_snapshot_name)
kvs.update('prev_model', cur_snapshot_name)
kvs.update('best_val_metric', val_metric)
kvs.save_pkl(os.path.join(kvs['args'].snapshots, kvs['args'].dataset_name, kvs['snapshot_name'], 'session.pkl'))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
931,
13,
5215,
4036,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
1840,
2780,
1053,
28684,
13,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
13,
3166,
12489,
3377,
29990,
1053,
6991,
5219,
10507,
13,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
13,
13,
3166,
4842,
305,
4924,
1053,
4327,
29879,
408,
9631,
29918,
9067,
29879,
13,
13,
5215,
899,
29873,
29889,
9067,
29879,
408,
269,
1896,
13,
5215,
899,
29873,
29889,
3221,
408,
2243,
29883,
13,
13,
5215,
5455,
13,
13,
3166,
1967,
1990,
2450,
29889,
26495,
29889,
25699,
1053,
6088,
29918,
5085,
13,
3166,
1967,
1990,
2450,
29889,
26495,
29889,
24713,
1053,
7084,
2385,
2450,
16390,
24541,
13,
3166,
1967,
1990,
2450,
29889,
26495,
29889,
24713,
1053,
3394,
29918,
1609,
29918,
2248,
29892,
10153,
29918,
21134,
29906,
2929,
29873,
29892,
443,
4058,
29918,
2929,
29873,
29918,
1272,
13,
3166,
1967,
1990,
2450,
29889,
26495,
29889,
9067,
800,
1053,
2069,
29918,
14968,
29918,
2987,
29879,
13,
3166,
1967,
1990,
2450,
29889,
29895,
4270,
1053,
12002,
29968,
21819,
13,
5215,
1967,
1990,
2450,
29889,
26495,
29889,
9067,
800,
408,
534,
1983,
5847,
13,
13,
29925,
3035,
29918,
4986,
353,
29871,
29941,
29946,
13,
29907,
29366,
29918,
14226,
353,
29871,
29941,
29906,
13,
13,
18525,
353,
10876,
29889,
657,
15003,
580,
338,
451,
6213,
13,
13,
13,
1753,
2069,
29918,
7924,
7295,
13,
1678,
565,
451,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
7295,
13,
4706,
12020,
16738,
2392,
877,
1576,
775,
1818,
367,
1065,
373,
22796,
29889,
1495,
13,
13,
1678,
413,
4270,
353,
12002,
29968,
21819,
580,
13,
13,
1678,
6389,
353,
6088,
29918,
5085,
580,
13,
268,
13,
1678,
565,
21681,
29901,
13,
4706,
6389,
29889,
29876,
29918,
28993,
353,
29871,
29900,
13,
13,
1678,
4842,
305,
29889,
11288,
29918,
26776,
29898,
5085,
29889,
26776,
29897,
13,
1678,
4842,
305,
29889,
29883,
6191,
29889,
11288,
29918,
26776,
29898,
5085,
29889,
26776,
29897,
13,
1678,
4036,
29889,
26776,
29898,
5085,
29889,
26776,
29897,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
5085,
29889,
26776,
29897,
13,
13,
1678,
22395,
29918,
978,
353,
931,
29889,
710,
615,
603,
877,
29995,
29979,
29918,
29995,
29885,
29918,
29995,
29881,
29918,
29995,
29950,
29918,
29995,
29924,
1495,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
29879,
8971,
845,
1862,
29892,
6389,
29889,
24713,
29918,
978,
29892,
22395,
29918,
978,
511,
1863,
29918,
554,
29922,
5574,
29897,
13,
13,
1678,
413,
4270,
29889,
5504,
877,
2272,
7345,
305,
29918,
3259,
742,
4842,
305,
17255,
3259,
1649,
29897,
13,
1678,
1596,
877,
29925,
3637,
25350,
1873,
29901,
13420,
4842,
305,
17255,
3259,
1649,
29897,
13,
13,
1678,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
7295,
13,
4706,
413,
4270,
29889,
5504,
877,
29883,
6191,
742,
4842,
305,
29889,
3259,
29889,
29883,
6191,
29897,
13,
4706,
413,
4270,
29889,
5504,
877,
29887,
13364,
742,
4842,
305,
29889,
29883,
6191,
29889,
10141,
29918,
2798,
3101,
13,
4706,
1596,
877,
29907,
29965,
7698,
1873,
29901,
13420,
4842,
305,
29889,
3259,
29889,
29883,
6191,
29897,
13,
1678,
1683,
29901,
13,
4706,
413,
4270,
29889,
5504,
877,
29883,
6191,
742,
6213,
29897,
13,
4706,
413,
4270,
29889,
5504,
877,
29887,
13364,
742,
6213,
29897,
13,
13,
1678,
413,
4270,
29889,
5504,
877,
29879,
14551,
29918,
978,
742,
22395,
29918,
978,
29897,
13,
1678,
413,
4270,
29889,
5504,
877,
5085,
742,
6389,
29897,
13,
1678,
413,
4270,
29889,
7620,
29918,
29886,
6321,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
29879,
8971,
845,
1862,
29892,
6389,
29889,
24713,
29918,
978,
29892,
22395,
29918,
978,
29892,
525,
7924,
29889,
29886,
6321,
8785,
13,
13,
1678,
736,
6389,
29892,
22395,
29918,
978,
13,
13,
13,
1753,
2069,
29918,
1272,
29918,
19170,
29898,
6289,
1125,
13,
1678,
413,
4270,
353,
12002,
29968,
21819,
580,
13,
13,
1678,
7945,
29918,
2987,
29879,
353,
2069,
29918,
14968,
29918,
2987,
29879,
29898,
29883,
1336,
29918,
8513,
2433,
29878,
742,
17132,
29918,
8513,
2433,
29878,
1495,
29871,
396,
4036,
274,
1336,
29892,
9432,
573,
7164,
13,
13,
1678,
8783,
353,
7084,
2385,
2450,
16390,
24541,
29898,
6289,
29892,
6219,
29922,
29895,
4270,
1839,
19635,
7464,
2927,
29918,
3493,
29922,
29895,
4270,
1839,
5085,
13359,
2780,
29918,
3493,
29892,
29304,
29922,
14968,
29918,
2987,
29879,
29897,
13,
13,
1678,
2099,
29918,
8111,
29892,
3659,
29918,
8111,
353,
534,
1983,
5847,
29889,
2344,
29918,
12676,
29918,
4172,
29898,
24713,
29922,
24713,
29892,
13,
462,
462,
462,
259,
9853,
29918,
2311,
29922,
29895,
4270,
1839,
5085,
13359,
5824,
29892,
13,
462,
462,
462,
259,
302,
29918,
28993,
29922,
29895,
4270,
1839,
5085,
13359,
29876,
29918,
28993,
29892,
13,
462,
462,
462,
259,
4078,
29918,
12676,
29918,
4172,
29922,
29895,
4270,
1839,
5085,
13359,
29879,
8971,
845,
1862,
718,
8207,
29915,
718,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
13,
462,
462,
462,
259,
2927,
29918,
3493,
29922,
29895,
4270,
1839,
5085,
13359,
2780,
29918,
3493,
29897,
13,
13,
1678,
1596,
877,
3306,
2913,
29901,
13420,
413,
4270,
1839,
5085,
13359,
2780,
29918,
3493,
29897,
13,
13,
1678,
1596,
29898,
2780,
287,
877,
2751,
29958,
13420,
525,
1127,
1495,
718,
525,
6816,
273,
29901,
742,
2099,
29918,
8111,
29897,
13,
1678,
1596,
29898,
2780,
287,
877,
2751,
29958,
13420,
525,
1127,
1495,
718,
525,
855,
29881,
29901,
742,
3659,
29918,
8111,
29897,
13,
13,
1678,
6056,
29918,
509,
29888,
353,
9631,
29918,
9067,
29879,
29889,
19077,
675,
29898,
7345,
305,
29889,
3166,
29918,
23749,
29898,
12676,
29918,
8111,
467,
7411,
3285,
13,
462,
462,
539,
4842,
305,
29889,
3166,
29918,
23749,
29898,
4172,
29918,
8111,
467,
7411,
3101,
13,
13,
1678,
7945,
29918,
509,
29888,
353,
9631,
29918,
9067,
29879,
29889,
1523,
4220,
4197,
13,
4706,
7945,
29918,
2987,
29879,
29892,
13,
4706,
7687,
29898,
7302,
29918,
1609,
29918,
2248,
29892,
4327,
29922,
12324,
29918,
509,
29888,
29892,
22645,
29922,
29900,
29897,
13,
268,
2314,
13,
13,
1678,
659,
29918,
509,
29888,
353,
9631,
29918,
9067,
29879,
29889,
1523,
4220,
4197,
13,
4706,
10153,
29918,
21134,
29906,
2929,
29873,
29892,
13,
4706,
2243,
29883,
29889,
3835,
4197,
13,
9651,
269,
1896,
29889,
20369,
13372,
29898,
8305,
29918,
517,
7607,
29925,
3035,
29918,
4986,
29892,
349,
3035,
29918,
4986,
8243,
13,
9651,
269,
1896,
29889,
29907,
1336,
13372,
29898,
29883,
1336,
29918,
2311,
7607,
29907,
29366,
29918,
14226,
29892,
315,
29366,
29918,
14226,
511,
274,
1336,
29918,
8513,
2433,
29883,
5477,
29871,
396,
4818,
274,
1336,
13,
4706,
4514,
511,
13,
4706,
443,
4058,
29918,
2929,
29873,
29918,
1272,
29892,
13,
4706,
7687,
29898,
7302,
29918,
1609,
29918,
2248,
29892,
4327,
29922,
12427,
29918,
9067,
29879,
29889,
1762,
29911,
6073,
3285,
22645,
29922,
29900,
511,
13,
4706,
7687,
29898,
7302,
29918,
1609,
29918,
2248,
29892,
4327,
29922,
12324,
29918,
509,
29888,
29892,
22645,
29922,
29900,
29897,
13,
268,
2314,
13,
13,
1678,
413,
4270,
29889,
5504,
877,
14968,
29918,
509,
29888,
742,
7945,
29918,
509,
29888,
29897,
13,
1678,
413,
4270,
29889,
5504,
877,
791,
29918,
509,
29888,
742,
659,
29918,
509,
29888,
29897,
13,
1678,
413,
4270,
29889,
7620,
29918,
29886,
6321,
29898,
359,
29889,
2084,
29889,
7122,
29898,
29895,
4270,
1839,
5085,
13359,
29879,
8971,
845,
1862,
29892,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
413,
4270,
1839,
29879,
14551,
29918,
978,
7464,
525,
7924,
29889,
29886,
6321,
8785,
13,
13,
13,
1753,
2069,
29918,
1359,
414,
29898,
24713,
29892,
921,
29918,
14968,
29892,
921,
29918,
791,
1125,
13,
1678,
413,
4270,
353,
12002,
29968,
21819,
580,
13,
13,
1678,
7945,
29918,
24713,
353,
7084,
2385,
2450,
16390,
24541,
29898,
24713,
29892,
13,
462,
462,
308,
6219,
29922,
29916,
29918,
14968,
29892,
13,
462,
462,
308,
2927,
29918,
3493,
29922,
29895,
4270,
1839,
5085,
13359,
2780,
29918,
3493,
29892,
13,
462,
462,
308,
29304,
29922,
29895,
4270,
1839,
14968,
29918,
509,
29888,
11287,
13,
13,
1678,
659,
29918,
24713,
353,
7084,
2385,
2450,
16390,
24541,
29898,
24713,
29892,
13,
462,
462,
539,
6219,
29922,
29916,
29918,
791,
29892,
13,
462,
462,
539,
2927,
29918,
3493,
29922,
29895,
4270,
1839,
5085,
13359,
2780,
29918,
3493,
29892,
13,
462,
462,
539,
29304,
29922,
29895,
4270,
1839,
791,
29918,
509,
29888,
11287,
13,
13,
1678,
7945,
29918,
12657,
353,
3630,
10036,
29898,
14968,
29918,
24713,
29892,
13,
462,
795,
9853,
29918,
2311,
29922,
29895,
4270,
1839,
5085,
13359,
5824,
29892,
13,
462,
795,
954,
29918,
1287,
414,
29922,
29895,
4270,
1839,
5085,
13359,
29876,
29918,
28993,
29892,
13,
462,
795,
5768,
29918,
4230,
29922,
5574,
29892,
13,
462,
795,
15645,
29918,
2344,
29918,
9144,
29922,
2892,
9449,
29901,
7442,
29889,
8172,
29889,
26776,
29898,
9302,
29889,
13470,
29941,
29906,
29898,
7345,
305,
29889,
11228,
29918,
26776,
580,
718,
9449,
4961,
13,
13,
1678,
659,
29918,
12657,
353,
3630,
10036,
29898,
791,
29918,
24713,
29892,
13,
462,
9651,
9853,
29918,
2311,
29922,
29895,
4270,
1839,
5085,
13359,
791,
29918,
5824,
29892,
13,
462,
9651,
954,
29918,
1287,
414,
29922,
29895,
4270,
1839,
5085,
13359,
29876,
29918,
28993,
29897,
13,
13,
1678,
736,
7945,
29918,
12657,
29892,
659,
29918,
12657,
13,
13,
13,
1753,
2069,
29918,
29888,
3361,
7295,
13,
1678,
413,
4270,
353,
12002,
29968,
21819,
580,
13,
1678,
23550,
353,
6571,
13,
1678,
13850,
29918,
5451,
29918,
14968,
353,
6571,
13,
1678,
363,
900,
29881,
29918,
333,
29892,
6219,
297,
26985,
29898,
29895,
4270,
1839,
11023,
29918,
5451,
29918,
497,
29918,
29888,
3361,
2033,
1125,
13,
4706,
565,
413,
4270,
1839,
5085,
13359,
8771,
2804,
448,
29896,
322,
900,
29881,
29918,
333,
2804,
413,
4270,
1839,
5085,
13359,
8771,
29901,
13,
9651,
6773,
13,
4706,
413,
4270,
29889,
5504,
29898,
29888,
29915,
6758,
267,
29918,
8771,
29918,
19660,
8771,
29918,
333,
6525,
742,
6213,
29892,
1051,
29897,
13,
4706,
413,
4270,
29889,
5504,
29898,
29888,
29915,
791,
29918,
2527,
10817,
29918,
8771,
29918,
19660,
8771,
29918,
333,
6525,
742,
6213,
29892,
1051,
29897,
13,
4706,
13850,
29918,
5451,
29918,
14968,
29961,
8771,
29918,
333,
29962,
353,
6219,
13,
4706,
23550,
29961,
8771,
29918,
333,
29962,
353,
6991,
5219,
10507,
29898,
359,
29889,
2084,
29889,
7122,
29898,
29895,
4270,
1839,
5085,
13359,
20756,
29892,
13,
462,
462,
462,
418,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
13,
462,
462,
462,
418,
525,
8771,
648,
29913,
4286,
4830,
29898,
8771,
29918,
333,
511,
413,
4270,
1839,
29879,
14551,
29918,
978,
25901,
13,
13,
1678,
413,
4270,
29889,
5504,
877,
11023,
29918,
5451,
29918,
14968,
742,
13850,
29918,
5451,
29918,
14968,
29897,
13,
1678,
413,
4270,
29889,
7620,
29918,
29886,
6321,
29898,
359,
29889,
2084,
29889,
7122,
29898,
29895,
4270,
1839,
5085,
13359,
29879,
8971,
845,
1862,
29892,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
413,
4270,
1839,
29879,
14551,
29918,
978,
7464,
525,
7924,
29889,
29886,
6321,
8785,
13,
13,
1678,
736,
23550,
13,
13,
13,
1753,
4078,
29918,
3198,
3149,
29898,
4299,
29892,
659,
29918,
16414,
29918,
978,
29892,
5734,
1061,
2433,
1896,
29374,
396,
301,
29873,
29892,
3109,
1135,
13,
1678,
565,
338,
8758,
29898,
4299,
29892,
4842,
305,
29889,
15755,
29889,
1469,
2177,
6553,
1125,
13,
4706,
1904,
353,
1904,
29889,
5453,
13,
13,
1678,
413,
4270,
353,
12002,
29968,
21819,
580,
13,
1678,
900,
29881,
29918,
333,
353,
413,
4270,
1839,
2764,
29918,
8771,
2033,
13,
1678,
21502,
305,
353,
413,
4270,
1839,
2764,
29918,
1022,
2878,
2033,
13,
1678,
659,
29918,
16414,
353,
413,
4270,
29961,
29888,
29915,
791,
29918,
2527,
10817,
29918,
8771,
29918,
19660,
8771,
29918,
333,
6525,
2033,
14352,
29896,
3816,
29900,
3816,
791,
29918,
16414,
29918,
978,
29962,
13,
1678,
5734,
1061,
353,
679,
5552,
29898,
6891,
29892,
5734,
1061,
29897,
13,
1678,
3151,
29918,
29879,
14551,
29918,
978,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29895,
4270,
1839,
5085,
13359,
29879,
8971,
845,
1862,
29892,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
413,
4270,
1839,
29879,
14551,
29918,
978,
7464,
13,
462,
462,
268,
285,
29915,
8771,
648,
8771,
29918,
333,
2403,
1022,
2878,
648,
1022,
2878,
29974,
29896,
1836,
29886,
386,
1495,
13,
13,
1678,
565,
413,
4270,
1839,
16304,
29918,
4299,
2033,
338,
6213,
29901,
13,
4706,
1596,
29898,
2780,
287,
877,
2751,
29958,
13420,
525,
1127,
1495,
718,
525,
21913,
471,
7160,
304,
742,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
4706,
4842,
305,
29889,
7620,
29898,
4299,
29889,
3859,
29918,
8977,
3285,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
4706,
413,
4270,
29889,
5504,
877,
16304,
29918,
4299,
742,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
4706,
413,
4270,
29889,
5504,
877,
13318,
29918,
791,
29918,
16414,
742,
659,
29918,
16414,
29897,
13,
13,
1678,
1683,
29901,
13,
4706,
565,
5734,
1061,
29898,
791,
29918,
16414,
29892,
413,
4270,
1839,
13318,
29918,
791,
29918,
16414,
2033,
1125,
13,
9651,
1596,
29898,
2780,
287,
877,
2751,
29958,
13420,
525,
1127,
1495,
718,
525,
21913,
471,
7160,
304,
742,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
9651,
2897,
29889,
5992,
29898,
29895,
4270,
1839,
16304,
29918,
4299,
11287,
13,
9651,
4842,
305,
29889,
7620,
29898,
4299,
29889,
3859,
29918,
8977,
3285,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
9651,
413,
4270,
29889,
5504,
877,
16304,
29918,
4299,
742,
3151,
29918,
29879,
14551,
29918,
978,
29897,
13,
9651,
413,
4270,
29889,
5504,
877,
13318,
29918,
791,
29918,
16414,
742,
659,
29918,
16414,
29897,
13,
13,
1678,
413,
4270,
29889,
7620,
29918,
29886,
6321,
29898,
359,
29889,
2084,
29889,
7122,
29898,
29895,
4270,
1839,
5085,
13359,
29879,
8971,
845,
1862,
29892,
413,
4270,
1839,
5085,
13359,
24713,
29918,
978,
29892,
413,
4270,
1839,
29879,
14551,
29918,
978,
7464,
525,
7924,
29889,
29886,
6321,
8785,
13,
13,
2
] |
OneTrack/MAIN/UI/Widget/__init__.py | aragubas/OneTrack | 0 | 126759 | <reponame>aragubas/OneTrack
#!/usr/bin/python3.7
# Copyright 2020 Aragubas
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
import pygame
import Library.CoreUtils as Utils
import Library.CorePrimitives as Shape
from OneTrack import MAIN as Main
from OneTrack.MAIN import UI
class Widget_Controller:
def __init__(self, Rectangle):
self.Rectangle = Utils.Convert.List_PygameRect(Rectangle)
self.WidgetCollection = list()
self.LastInteractionID = -1
self.LastInteractionType = None
self.Active = False
self.ClickOffset = (0, 0)
def Clear(self):
self.WidgetCollection.clear()
def Draw(self, DISPLAY):
for widget in self.WidgetCollection:
widget.Render(DISPLAY)
if not self.LastInteractionID == -1:
try:
self.WidgetCollection[self.LastInteractionID].InteractionType = None
except IndexError:
print("Can't set property to unexistent widget.")
def Append(self, Widget):
self.WidgetCollection.append(Widget)
for widget in self.WidgetCollection:
widget.Update()
def Update(self):
self.LastInteractionID = -1
self.LastInteractionType = None
self.Active = pygame.Rect(self.Rectangle[0] + self.ClickOffset[0], self.Rectangle[1] + self.ClickOffset[1], self.Rectangle[2], self.Rectangle[3]).collidepoint((pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1]))
if not self.Active:
for widget in self.WidgetCollection:
widget.Active = False
return
for widget in self.WidgetCollection:
widget.Update()
if not widget.InteractionType is None:
self.LastInteractionID = widget.ID
self.LastInteractionType = widget.InteractionType
def EventUpdate(self, event):
for widget in self.WidgetCollection:
if widget.AwaysUpdate: # -- If always update, update it no matter what
if widget.EventUpdateable:
widget.EventUpdate(event)
continue
else: # -- If not, only update when mouse is hovering it
ColideRect = pygame.Rect(self.ClickOffset[0] + self.Rectangle[0] + widget.Rectangle[0], self.ClickOffset[1] + self.Rectangle[1] + widget.Rectangle[1], widget.Rectangle[2], widget.Rectangle[3])
if ColideRect.collidepoint(pygame.mouse.get_pos()):
if widget.EventUpdateable:
widget.CursorOffset = (ColideRect[0], ColideRect[1])
widget.EventUpdate(event)
widget.Active = True
else:
widget.Active = False
def GetWidget(self, WidgetID):
for widget in self.WidgetCollection:
if widget.ID == WidgetID:
return widget
class Widget_PictureBox:
def __init__(self, Rectangle, ImageName, WidgetID):
if WidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.Rectangle = Utils.Convert.List_PygameRect(Rectangle)
self.ImageName = ImageName
self.ID = WidgetID
self.InteractionType = None
self.Active = False
self.EventUpdateable = False
self.AwaysUpdate = False
self.CursorOffset = (0, 0)
def Render(self, DISPLAY):
UI.ContentManager.ImageRender(DISPLAY, self.ImageName, self.Rectangle[0], self.Rectangle[1], self.Rectangle[2], self.Rectangle[3])
def Update(self):
pass
def EventUpdate(self, event):
pass
class Widget_ValueChanger:
def __init__(self, Position, TitleName, ChangerInitialValue, WidgetID):
if WidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.Rectangle = Utils.Convert.List_PygameRect((Position[0], Position[1], 48, 34))
self.TitleName = TitleName
self.ID = WidgetID
self.Changer = UI.EditableNumberView(pygame.Rect(self.Rectangle[0], self.Rectangle[1] + 17, self.Rectangle[2], self.Rectangle[3] - 17), ChangerInitialValue)
self.LastValue = ChangerInitialValue
self.InteractionType = None
self.Active = False
self.EventUpdateable = True
self.AwaysUpdate = False
self.CursorOffset = (0, 0)
def Render(self, DISPLAY):
# -- Render Background -- #
BGColor = UI.ThemesManager_GetProperty("Button_BackgroundColor")
LineColor = UI.ThemesManager_GetProperty("Button_Active_IndicatorColor")
if not self.Active:
LineColor = UI.ThemesManager_GetProperty("Button_Inactive_IndicatorColor")
Shape.Shape_Rectangle(DISPLAY, BGColor, self.Rectangle)
Shape.Shape_Rectangle(DISPLAY, LineColor, self.Rectangle, 1)
# -- Render Change Title -- #
TitleX = self.Rectangle[0] + self.Rectangle[2] / 2 - UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", 12, self.TitleName) / 2
UI.ContentManager.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 12, self.TitleName, (230, 230, 230), TitleX, self.Rectangle[1])
# -- Render EditableNumberView -- #
self.Changer.Render(DISPLAY)
def Update(self):
self.Changer.Update()
if not self.Changer.Value == self.LastValue:
self.LastValue = self.Changer.Value
self.InteractionType = self.Changer.Value
if UI.ContentManager.GetFont_width("/PressStart2P.ttf", 12, self.Changer.Value) > self.Rectangle[2]:
self.Rectangle[2] = self.Rectangle[2] + UI.ContentManager.GetFont_width("/PressStart2P.ttf", 12, self.Changer.Value) + 5
if UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", 12, self.TitleName) > self.Rectangle[2]:
self.Rectangle[2] = self.Rectangle[2] + UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", 12, self.TitleName)
self.Changer.Rectangle[0] = self.Rectangle[0] + self.Rectangle[2] / 2 - UI.ContentManager.GetFont_width("/PressStart2P.ttf", 12, self.Changer.Value) / 2
def EventUpdate(self, event):
self.Changer.EventUpdate(event)
class Widget_Label:
def __init__(self, FontName, Text, FontSize, Color, X, Y, WidgetID):
if WidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.ID = WidgetID
self.InteractionType = None
self.Active = False
self.EventUpdateable = False
self.Text = Text
self.FontSize = FontSize
self.FontName = FontName
self.Color = Color
self.X = X
self.Y = Y
self.Rectangle = Utils.Convert.List_PygameRect((X, Y, UI.ContentManager.GetFont_width(self.FontName, FontSize, self.Text), UI.ContentManager.GetFont_height(self.FontName, FontSize, self.Text)))
self.AwaysUpdate = False
self.CursorOffset = (0, 0)
def Render(self, DISPLAY):
UI.ContentManager.FontRender(DISPLAY, self.FontName, self.FontSize, self.Text, self.Color, self.Rectangle[0], self.Rectangle[1])
def Update(self):
self.Rectangle = Utils.Convert.List_PygameRect((self.X, self.Y, UI.ContentManager.GetFont_width(self.FontName, self.FontSize, self.Text), UI.ContentManager.GetFont_height(self.FontName, self.FontSize, self.Text)))
def EventUpdate(self, event):
pass
class Widget_PianoKeys:
def __init__(self, X, Y, WidgetID):
if WidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.ID = WidgetID
self.InteractionType = None
self.Active = True
self.EventUpdateable = True
self.X = X
self.Y = Y
self.Rectangle = Utils.Convert.List_PygameRect((X, Y, 380, 45))
self.Surface = pygame.Surface((self.Rectangle[2], self.Rectangle[3]))
self.LastRect = pygame.Rect(0, 0, 0, 0)
self.LastNote = -1
self.AwaysUpdate = True
self.CursorOffset = (0, 0)
pygame.key.set_repeat(0, 0)
def Render(self, DISPLAY):
if not self.LastRect == self.Rectangle:
self.Surface = pygame.Surface((self.Rectangle[2], self.Rectangle[3]))
# -- Render Background -- #
self.Surface.fill((190, 190, 190))
Shape.Shape_Rectangle(self.Surface, (100, 100, 100), (0, 0, self.Rectangle[2], self.Rectangle[3]), 5)
for i in range(12):
NoteLabel = self.GetNote_ByIndex(i)
# -- Variables -- #
Width = 30
Height = 25
X = i * (Width + 2)
Y = self.Rectangle[3] - Height
BackgroundColor = (100, 105, 155)
TextColor = (0, 5, 100)
IsHighNote = False
if "#" in NoteLabel:
Width = 30
X = i * (Width + 2)
Width = 35
X -= 2
Y = 0
BackgroundColor = (10, 15, 25)
TextColor = (200, 205, 255)
IsHighNote = True
TextX = X + (Width / 2 - UI.ContentManager.GetFont_width("/PressStart2P.ttf", 12, NoteLabel) / 2)
if self.LastNote == i:
BackgroundColor = (200, 205, 255)
TextColor = (0, 0, 0)
if not IsHighNote:
Shape.Shape_Rectangle(self.Surface, BackgroundColor, (X, Y, Width, Height), 0, 0, 5, 5)
else:
Shape.Shape_Rectangle(self.Surface, BackgroundColor, (X, Y, Width, Height), 0, 0, 0, 0, 5, 5)
UI.ContentManager.FontRender(self.Surface, "/PressStart2P.ttf", 12, NoteLabel, TextColor, TextX, Y + 5)
DISPLAY.blit(self.Surface, (self.Rectangle[0], self.Rectangle[1]))
def GetNote_ByIndex(self, i):
if i == 0:
return "C"
elif i == 1:
return "C#"
elif i == 2:
return "D"
elif i == 3:
return "D#"
elif i == 4:
return "E"
elif i == 5:
return "F"
elif i == 6:
return "F#"
elif i == 7:
return "G"
elif i == 8:
return "G#"
elif i == 9:
return "A"
elif i == 10:
return "A#"
elif i == 11:
return "B"
def Update(self):
pass
def EventUpdate(self, event):
if event.type == pygame.KEYUP:
self.LastNote = -1
if event.type == pygame.KEYDOWN:
# -- Note C -- #
if event.key == pygame.K_z:
self.LastNote = 0
# -- Note C# -- #
if event.key == pygame.K_s:
self.LastNote = 1
# -- Note D -- #
if event.key == pygame.K_x:
self.LastNote = 2
# -- Note D# -- #
if event.key == pygame.K_d:
self.LastNote = 3
# -- Note E -- #
if event.key == pygame.K_c:
self.LastNote = 4
# -- Note F -- #
if event.key == pygame.K_v:
self.LastNote = 5
# -- Note F# -- #
if event.key == pygame.K_g:
self.LastNote = 6
# -- Note G -- #
if event.key == pygame.K_b:
self.LastNote = 7
# -- Note G# -- #
if event.key == pygame.K_h:
self.LastNote = 8
# -- Note A -- #
if event.key == pygame.K_n:
self.LastNote = 9
# -- Note A# -- #
if event.key == pygame.K_j:
self.LastNote = 10
# -- Note B -- #
if event.key == pygame.K_m:
self.LastNote = 11
class Widget_Button:
def __init__(self, Text, FontSize, X, Y, WidgetID):
if WidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.ID = WidgetID
self.InteractionType = None
self.Active = True
self.EventUpdateable = True
self.AwaysUpdate = False
self.X = X
self.Y = Y
self.Text = Text
self.FontSize = FontSize
self.TextWidth = UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", self.FontSize, self.Text)
self.TextHeight = UI.ContentManager.GetFont_height("/Ubuntu_Bold.ttf", self.FontSize, self.Text)
self.Rectangle = Utils.Convert.List_PygameRect((X - 2, Y - 2, self.TextWidth + 4, self.TextHeight + 4))
self.LastRect = self.Rectangle
self.Surface = pygame.Surface((self.Rectangle[2], self.Rectangle[3]))
self.Centred_X = self.Rectangle[2] / 2 - UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", self.FontSize - 2, self.Text) / 2
self.Centred_Y = self.Rectangle[3] / 2 - UI.ContentManager.GetFont_height("/Ubuntu_Bold.ttf", self.FontSize - 2, self.Text) / 2
self.ButtonState = 0
self.CursorOffset = (0, 0)
self.BgColor = UI.ThemesManager_GetProperty("Button_BackgroundColor")
self.IndicatorColor = UI.ThemesManager_GetProperty("Button_Inactive_IndicatorColor")
def Render(self, DISPLAY):
# -- Render Background -- #
Shape.Shape_Rectangle(self.Surface, self.BgColor, (0, 0, self.Rectangle[2], self.Rectangle[3]))
# -- Render Indicator -- #
Shape.Shape_Rectangle(self.Surface, self.IndicatorColor, (0, 0, self.Rectangle[2], self.Rectangle[3]), 1)
# -- Render the Button Text -- #
UI.ContentManager.FontRender(self.Surface, "/Ubuntu_Bold.ttf", self.FontSize - 2, self.Text, (240, 240, 240), self.Centred_X, self.Centred_Y)
DISPLAY.blit(self.Surface, (self.Rectangle[0], self.Rectangle[1]))
if self.ButtonState == 2:
self.ButtonState = 0
def Update(self):
# -- Check if surface has the correct size -- #
if not self.LastRect == self.Rectangle:
self.Surface = pygame.Surface((self.Rectangle[2], self.Rectangle[3]))
# -- Update all Size and Position Variables -- #
self.TextWidth = UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", self.FontSize, self.Text)
self.TextHeight = UI.ContentManager.GetFont_height("/Ubuntu_Bold.ttf", self.FontSize, self.Text)
self.Rectangle = Utils.Convert.List_PygameRect((self.Rectangle[0] - 2, self.Rectangle[1] - 2, self.TextWidth + 4, self.TextHeight + 4))
self.Centred_X = self.Rectangle[2] / 2 - UI.ContentManager.GetFont_width("/Ubuntu_Bold.ttf", self.FontSize - 2, self.Text) / 2
self.Centred_Y = self.Rectangle[3] / 2 - UI.ContentManager.GetFont_height("/Ubuntu_Bold.ttf", self.FontSize - 2, self.Text) / 2
self.LastRect = self.Rectangle
self.BgColor = UI.ThemesManager_GetProperty("Button_BackgroundColor")
self.IndicatorColor = UI.ThemesManager_GetProperty("Button_Inactive_IndicatorColor")
if not self.Active:
self.IndicatorColor = UI.ThemesManager_GetProperty("Button_Inactive_IndicatorColor")
return
if self.ButtonState == 0:
self.IndicatorColor = UI.ThemesManager_GetProperty("Button_Inactive_IndicatorColor")
elif self.ButtonState == 1:
self.IndicatorColor = UI.ThemesManager_GetProperty("Button_Active_IndicatorColor")
def EventUpdate(self, event):
if event.type == pygame.MOUSEBUTTONDOWN:
self.ButtonState = 1
if event.type == pygame.MOUSEBUTTONUP:
self.ButtonState = 0
self.InteractionType = True
class Widget_Textbox:
def __init__(self, pFontName, pDefaultText, pFontSize, pColor, pX, pY, pWidgetID):
if pWidgetID == -1:
raise ValueError("WidgetID cannot be -1")
self.ID = pWidgetID
self.InteractionType = None
self.Active = False
self.EventUpdateable = True
self.DefaultText = pDefaultText
self.Text = self.DefaultText
self.FontSize = pFontSize
self.FontName = pFontName
self.Color = pColor
self.X = pX
self.Y = pY
self.Width = UI.ContentManager.GetFont_width(pFontName, pFontSize, pDefaultText)
self.Height = UI.ContentManager.GetFont_height(pFontName, pFontSize, "ABC")
self.AwaysUpdate = False
self.CursorOffset = (0, 0)
self.Rectangle = pygame.Rect(self.X, self.Y, self.Width, self.Height)
self.LastHeight = 1
self.CustomWidth = False
self.CharacterLimit = 0
def Set_X(self, Value):
if not self.Rectangle[0] == Value:
self.Rectangle = pygame.Rect(Value, self.Rectangle[1], self.Rectangle[2], self.Rectangle[3])
def Set_Y(self, Value):
if not self.Rectangle[1] == Value:
self.Rectangle = pygame.Rect(self.Rectangle[0], Value, self.Rectangle[2], self.Rectangle[3])
def Render(self, DISPLAY):
# Blit the rect.
Shape.Shape_Rectangle(DISPLAY, (15, 15, 15), self.Rectangle)
if self.Text == self.DefaultText:
UI.ContentManager.FontRender(DISPLAY, UI.ThemesManager_GetProperty("InputBox_FontFile"), self.FontSize, self.Text, (140, 140, 140), self.Rectangle[0], self.Rectangle[1])
else:
if not self.Text == "":
UI.ContentManager.FontRender(DISPLAY, UI.ThemesManager_GetProperty("InputBox_FontFile"), self.FontSize, self.Text, (240, 240, 240), self.Rectangle[0], self.Rectangle[1])
if not self.Active:
Shape.Shape_Rectangle(DISPLAY, (255, 51, 102), (self.Rectangle[0], self.Rectangle[1] - 1, self.Rectangle[2], 1))
else:
Shape.Shape_Rectangle(DISPLAY, (46, 196, 182), (self.Rectangle[0], self.Rectangle[1] - 1, self.Rectangle[2], 1))
def Update(self):
# -- Resize the Textbox -- #
try:
if not self.CustomWidth:
self.Width = max(100, UI.ContentManager.GetFont_width(UI.ThemesManager_GetProperty("InputBox_FontFile"), self.FontSize, self.Text) + 10)
self.Rectangle[2] = self.Width
self.Rectangle[3] = UI.ContentManager.GetFont_height(UI.ThemesManager_GetProperty("InputBox_FontFile"), self.FontSize, self.Text)
self.LastHeight = self.Rectangle[3]
except:
if not self.CustomWidth:
self.Rectangle[2] = 100
self.Rectangle[3] = self.LastHeight
if self.Text == "":
self.Rectangle = pygame.Rect(self.Rectangle[0], self.Rectangle[1], self.Rectangle[2], self.Height)
def EventUpdate(self, event):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_BACKSPACE:
if len(self.Text) > 0:
self.Text = self.Text[:-1]
else:
self.Text = self.DefaultText
else:
if not self.CharacterLimit == 0:
if len(self.Text) < self.CharacterLimit:
self.Text += event.unicode
else:
self.Text += event.unicode
self.InteractionType = self.Text
| [
1,
529,
276,
1112,
420,
29958,
279,
351,
431,
294,
29914,
6716,
17936,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
29941,
29889,
29955,
13,
29937,
259,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
24350,
431,
294,
13,
29937,
13,
29937,
259,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
259,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
259,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
259,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
259,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
259,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
259,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
259,
27028,
1090,
278,
19245,
29889,
13,
29937,
13,
29937,
13,
5215,
22028,
13,
5215,
9538,
29889,
9203,
12177,
408,
22310,
29879,
13,
5215,
9538,
29889,
9203,
4040,
13083,
3145,
408,
1383,
4085,
13,
3166,
3118,
17936,
1053,
14861,
1177,
408,
4241,
13,
3166,
3118,
17936,
29889,
29032,
1053,
3740,
13,
13,
1990,
27080,
29918,
2956,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
22914,
2521,
1125,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
29898,
7364,
2521,
29897,
13,
4706,
1583,
29889,
8801,
7196,
353,
1051,
580,
13,
4706,
1583,
29889,
8897,
4074,
2467,
1367,
353,
448,
29896,
13,
4706,
1583,
29889,
8897,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
7700,
13,
4706,
1583,
29889,
4164,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
17732,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8801,
7196,
29889,
8551,
580,
13,
13,
1678,
822,
18492,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
9651,
11109,
29889,
10716,
29898,
23711,
29925,
18799,
29897,
13,
13,
4706,
565,
451,
1583,
29889,
8897,
4074,
2467,
1367,
1275,
448,
29896,
29901,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
8801,
7196,
29961,
1311,
29889,
8897,
4074,
2467,
1367,
1822,
4074,
2467,
1542,
353,
6213,
13,
13,
9651,
5174,
11374,
2392,
29901,
13,
18884,
1596,
703,
6028,
29915,
29873,
731,
2875,
304,
443,
735,
9696,
11109,
23157,
13,
13,
1678,
822,
22871,
29898,
1311,
29892,
27080,
1125,
13,
4706,
1583,
29889,
8801,
7196,
29889,
4397,
29898,
8801,
29897,
13,
13,
4706,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
9651,
11109,
29889,
6422,
580,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8897,
4074,
2467,
1367,
353,
448,
29896,
13,
4706,
1583,
29889,
8897,
4074,
2467,
1542,
353,
6213,
13,
13,
4706,
1583,
29889,
9966,
353,
22028,
29889,
7364,
29898,
1311,
29889,
7364,
2521,
29961,
29900,
29962,
718,
1583,
29889,
4164,
10302,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
718,
1583,
29889,
4164,
10302,
29961,
29896,
1402,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
14664,
1054,
7459,
3149,
3552,
2272,
11802,
29889,
15769,
29889,
657,
29918,
1066,
580,
29961,
29900,
1402,
22028,
29889,
15769,
29889,
657,
29918,
1066,
580,
29961,
29896,
12622,
13,
13,
4706,
565,
451,
1583,
29889,
9966,
29901,
13,
9651,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
18884,
11109,
29889,
9966,
353,
7700,
13,
9651,
736,
13,
13,
4706,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
9651,
11109,
29889,
6422,
580,
13,
13,
9651,
565,
451,
11109,
29889,
4074,
2467,
1542,
338,
6213,
29901,
13,
18884,
1583,
29889,
8897,
4074,
2467,
1367,
353,
11109,
29889,
1367,
13,
18884,
1583,
29889,
8897,
4074,
2467,
1542,
353,
11109,
29889,
4074,
2467,
1542,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
9651,
565,
11109,
29889,
29909,
1994,
6422,
29901,
29871,
396,
1192,
960,
2337,
2767,
29892,
2767,
372,
694,
4383,
825,
13,
18884,
565,
11109,
29889,
2624,
6422,
519,
29901,
13,
462,
1678,
11109,
29889,
2624,
6422,
29898,
3696,
29897,
13,
462,
1678,
6773,
13,
13,
9651,
1683,
29901,
29871,
396,
1192,
960,
451,
29892,
871,
2767,
746,
9495,
338,
16758,
292,
372,
13,
18884,
1530,
680,
7364,
353,
22028,
29889,
7364,
29898,
1311,
29889,
4164,
10302,
29961,
29900,
29962,
718,
1583,
29889,
7364,
2521,
29961,
29900,
29962,
718,
11109,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
4164,
10302,
29961,
29896,
29962,
718,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
718,
11109,
29889,
7364,
2521,
29961,
29896,
1402,
11109,
29889,
7364,
2521,
29961,
29906,
1402,
11109,
29889,
7364,
2521,
29961,
29941,
2314,
13,
13,
18884,
565,
1530,
680,
7364,
29889,
1054,
7459,
3149,
29898,
2272,
11802,
29889,
15769,
29889,
657,
29918,
1066,
580,
1125,
13,
462,
1678,
565,
11109,
29889,
2624,
6422,
519,
29901,
13,
462,
4706,
11109,
29889,
19890,
10302,
353,
313,
1625,
680,
7364,
29961,
29900,
1402,
1530,
680,
7364,
29961,
29896,
2314,
13,
462,
4706,
11109,
29889,
2624,
6422,
29898,
3696,
29897,
13,
462,
1678,
11109,
29889,
9966,
353,
5852,
13,
18884,
1683,
29901,
13,
462,
1678,
11109,
29889,
9966,
353,
7700,
13,
13,
1678,
822,
3617,
8801,
29898,
1311,
29892,
27080,
1367,
1125,
13,
4706,
363,
11109,
297,
1583,
29889,
8801,
7196,
29901,
13,
9651,
565,
11109,
29889,
1367,
1275,
27080,
1367,
29901,
13,
18884,
736,
11109,
13,
13,
1990,
27080,
29918,
28210,
3313,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
22914,
2521,
29892,
7084,
1170,
29892,
27080,
1367,
1125,
13,
4706,
565,
27080,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
29898,
7364,
2521,
29897,
13,
4706,
1583,
29889,
2940,
1170,
353,
7084,
1170,
13,
4706,
1583,
29889,
1367,
353,
27080,
1367,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
7700,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
7700,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
7700,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
3740,
29889,
3916,
3260,
29889,
2940,
10716,
29898,
23711,
29925,
18799,
29892,
1583,
29889,
2940,
1170,
29892,
1583,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
1402,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
2314,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
1209,
13,
13,
1990,
27080,
29918,
1917,
1451,
4600,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
20627,
29892,
18527,
1170,
29892,
678,
4600,
15514,
1917,
29892,
27080,
1367,
1125,
13,
4706,
565,
27080,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
8003,
29961,
29900,
1402,
20627,
29961,
29896,
1402,
29871,
29946,
29947,
29892,
29871,
29941,
29946,
876,
13,
4706,
1583,
29889,
7030,
1170,
353,
18527,
1170,
13,
4706,
1583,
29889,
1367,
353,
27080,
1367,
13,
4706,
1583,
29889,
1451,
4600,
353,
3740,
29889,
6103,
519,
4557,
1043,
29898,
2272,
11802,
29889,
7364,
29898,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
718,
29871,
29896,
29955,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
448,
29871,
29896,
29955,
511,
678,
4600,
15514,
1917,
29897,
13,
4706,
1583,
29889,
8897,
1917,
353,
678,
4600,
15514,
1917,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
7700,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
5852,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
7700,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
396,
1192,
26000,
16585,
1192,
396,
13,
4706,
350,
29954,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
10581,
3306,
1159,
13,
4706,
7407,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
9966,
29918,
28013,
3306,
1159,
13,
13,
4706,
565,
451,
1583,
29889,
9966,
29901,
13,
9651,
7407,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
797,
4925,
29918,
28013,
3306,
1159,
13,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
23711,
29925,
18799,
29892,
350,
29954,
3306,
29892,
1583,
29889,
7364,
2521,
29897,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
23711,
29925,
18799,
29892,
7407,
3306,
29892,
1583,
29889,
7364,
2521,
29892,
29871,
29896,
29897,
13,
13,
4706,
396,
1192,
26000,
10726,
18527,
1192,
396,
13,
4706,
18527,
29990,
353,
1583,
29889,
7364,
2521,
29961,
29900,
29962,
718,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
7030,
1170,
29897,
847,
29871,
29906,
13,
13,
4706,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
23711,
29925,
18799,
29892,
5591,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
7030,
1170,
29892,
313,
29906,
29941,
29900,
29892,
29871,
29906,
29941,
29900,
29892,
29871,
29906,
29941,
29900,
511,
18527,
29990,
29892,
1583,
29889,
7364,
2521,
29961,
29896,
2314,
13,
13,
4706,
396,
1192,
26000,
7641,
519,
4557,
1043,
1192,
396,
13,
4706,
1583,
29889,
1451,
4600,
29889,
10716,
29898,
23711,
29925,
18799,
29897,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1451,
4600,
29889,
6422,
580,
13,
13,
4706,
565,
451,
1583,
29889,
1451,
4600,
29889,
1917,
1275,
1583,
29889,
8897,
1917,
29901,
13,
9651,
1583,
29889,
8897,
1917,
353,
1583,
29889,
1451,
4600,
29889,
1917,
13,
9651,
1583,
29889,
4074,
2467,
1542,
353,
1583,
29889,
1451,
4600,
29889,
1917,
13,
13,
4706,
565,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
10923,
4763,
29906,
29925,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
1451,
4600,
29889,
1917,
29897,
1405,
1583,
29889,
7364,
2521,
29961,
29906,
5387,
13,
9651,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
353,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
718,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
10923,
4763,
29906,
29925,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
1451,
4600,
29889,
1917,
29897,
718,
29871,
29945,
13,
13,
4706,
565,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
7030,
1170,
29897,
1405,
1583,
29889,
7364,
2521,
29961,
29906,
5387,
13,
9651,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
353,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
718,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
7030,
1170,
29897,
13,
13,
4706,
1583,
29889,
1451,
4600,
29889,
7364,
2521,
29961,
29900,
29962,
353,
1583,
29889,
7364,
2521,
29961,
29900,
29962,
718,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
10923,
4763,
29906,
29925,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
1583,
29889,
1451,
4600,
29889,
1917,
29897,
847,
29871,
29906,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
1583,
29889,
1451,
4600,
29889,
2624,
6422,
29898,
3696,
29897,
13,
13,
1990,
27080,
29918,
4775,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10928,
1170,
29892,
3992,
29892,
10928,
3505,
29892,
9159,
29892,
1060,
29892,
612,
29892,
27080,
1367,
1125,
13,
4706,
565,
27080,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
13,
4706,
1583,
29889,
1367,
353,
27080,
1367,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
7700,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
7700,
13,
4706,
1583,
29889,
1626,
353,
3992,
13,
4706,
1583,
29889,
9824,
3505,
353,
10928,
3505,
13,
4706,
1583,
29889,
9824,
1170,
353,
10928,
1170,
13,
4706,
1583,
29889,
3306,
353,
9159,
13,
4706,
1583,
29889,
29990,
353,
1060,
13,
4706,
1583,
29889,
29979,
353,
612,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
29990,
29892,
612,
29892,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
29898,
1311,
29889,
9824,
1170,
29892,
10928,
3505,
29892,
1583,
29889,
1626,
511,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
29898,
1311,
29889,
9824,
1170,
29892,
10928,
3505,
29892,
1583,
29889,
1626,
4961,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
7700,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
23711,
29925,
18799,
29892,
1583,
29889,
9824,
1170,
29892,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29892,
1583,
29889,
3306,
29892,
1583,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
2314,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
1311,
29889,
29990,
29892,
1583,
29889,
29979,
29892,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
29898,
1311,
29889,
9824,
1170,
29892,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
511,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
29898,
1311,
29889,
9824,
1170,
29892,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
4961,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
1209,
13,
13,
1990,
27080,
29918,
29925,
3328,
15506,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1060,
29892,
612,
29892,
27080,
1367,
1125,
13,
4706,
565,
27080,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
13,
4706,
1583,
29889,
1367,
353,
27080,
1367,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
5852,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
5852,
13,
4706,
1583,
29889,
29990,
353,
1060,
13,
4706,
1583,
29889,
29979,
353,
612,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
29990,
29892,
612,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29946,
29945,
876,
13,
4706,
1583,
29889,
18498,
2161,
353,
22028,
29889,
18498,
2161,
3552,
1311,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
12622,
13,
4706,
1583,
29889,
8897,
7364,
353,
22028,
29889,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
8897,
9842,
353,
448,
29896,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
5852,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
4706,
22028,
29889,
1989,
29889,
842,
29918,
14358,
29898,
29900,
29892,
29871,
29900,
29897,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
565,
451,
1583,
29889,
8897,
7364,
1275,
1583,
29889,
7364,
2521,
29901,
13,
9651,
1583,
29889,
18498,
2161,
353,
22028,
29889,
18498,
2161,
3552,
1311,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
12622,
13,
13,
4706,
396,
1192,
26000,
16585,
1192,
396,
13,
4706,
1583,
29889,
18498,
2161,
29889,
5589,
3552,
29896,
29929,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29896,
29929,
29900,
876,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
1311,
29889,
18498,
2161,
29892,
313,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
511,
313,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
11724,
29871,
29945,
29897,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29906,
1125,
13,
9651,
3940,
4775,
353,
1583,
29889,
2577,
9842,
29918,
2059,
3220,
29898,
29875,
29897,
13,
13,
9651,
396,
1192,
9586,
1849,
1192,
396,
13,
9651,
21485,
353,
29871,
29941,
29900,
13,
9651,
22907,
353,
29871,
29906,
29945,
13,
9651,
1060,
353,
474,
334,
313,
6110,
718,
29871,
29906,
29897,
13,
9651,
612,
353,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
448,
22907,
13,
9651,
16585,
3306,
353,
313,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29945,
29892,
29871,
29896,
29945,
29945,
29897,
13,
9651,
3992,
3306,
353,
313,
29900,
29892,
29871,
29945,
29892,
29871,
29896,
29900,
29900,
29897,
13,
9651,
1317,
16382,
9842,
353,
7700,
13,
13,
9651,
565,
12305,
29908,
297,
3940,
4775,
29901,
13,
18884,
21485,
353,
29871,
29941,
29900,
13,
18884,
1060,
353,
474,
334,
313,
6110,
718,
29871,
29906,
29897,
13,
18884,
21485,
353,
29871,
29941,
29945,
13,
18884,
1060,
22361,
29871,
29906,
13,
18884,
612,
353,
29871,
29900,
13,
18884,
16585,
3306,
353,
313,
29896,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29906,
29945,
29897,
13,
18884,
3992,
3306,
353,
313,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29945,
29892,
29871,
29906,
29945,
29945,
29897,
13,
18884,
1317,
16382,
9842,
353,
5852,
13,
13,
9651,
3992,
29990,
353,
1060,
718,
313,
6110,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
10923,
4763,
29906,
29925,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
3940,
4775,
29897,
847,
29871,
29906,
29897,
13,
13,
9651,
565,
1583,
29889,
8897,
9842,
1275,
474,
29901,
13,
18884,
16585,
3306,
353,
313,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29945,
29892,
29871,
29906,
29945,
29945,
29897,
13,
18884,
3992,
3306,
353,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
13,
9651,
565,
451,
1317,
16382,
9842,
29901,
13,
18884,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
1311,
29889,
18498,
2161,
29892,
16585,
3306,
29892,
313,
29990,
29892,
612,
29892,
21485,
29892,
22907,
511,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29945,
29897,
13,
9651,
1683,
29901,
13,
18884,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
1311,
29889,
18498,
2161,
29892,
16585,
3306,
29892,
313,
29990,
29892,
612,
29892,
21485,
29892,
22907,
511,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29945,
29897,
13,
13,
9651,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
1311,
29889,
18498,
2161,
29892,
5591,
10923,
4763,
29906,
29925,
29889,
698,
29888,
613,
29871,
29896,
29906,
29892,
3940,
4775,
29892,
3992,
3306,
29892,
3992,
29990,
29892,
612,
718,
29871,
29945,
29897,
13,
13,
4706,
28657,
29925,
18799,
29889,
2204,
277,
29898,
1311,
29889,
18498,
2161,
29892,
313,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
12622,
13,
13,
1678,
822,
3617,
9842,
29918,
2059,
3220,
29898,
1311,
29892,
474,
1125,
13,
4706,
565,
474,
1275,
29871,
29900,
29901,
13,
9651,
736,
376,
29907,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29896,
29901,
13,
9651,
736,
376,
29907,
29937,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29906,
29901,
13,
9651,
736,
376,
29928,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29941,
29901,
13,
9651,
736,
376,
29928,
29937,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29946,
29901,
13,
9651,
736,
376,
29923,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29945,
29901,
13,
9651,
736,
376,
29943,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29953,
29901,
13,
9651,
736,
376,
29943,
29937,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29955,
29901,
13,
9651,
736,
376,
29954,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29947,
29901,
13,
9651,
736,
376,
29954,
29937,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29929,
29901,
13,
9651,
736,
376,
29909,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29896,
29900,
29901,
13,
9651,
736,
376,
29909,
29937,
29908,
13,
13,
4706,
25342,
474,
1275,
29871,
29896,
29896,
29901,
13,
9651,
736,
376,
29933,
29908,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
4897,
29901,
13,
9651,
1583,
29889,
8897,
9842,
353,
448,
29896,
13,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
29901,
13,
9651,
396,
1192,
3940,
315,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29920,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29900,
13,
13,
9651,
396,
1192,
3940,
315,
29937,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29879,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29896,
13,
13,
9651,
396,
1192,
3940,
360,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29916,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29906,
13,
13,
9651,
396,
1192,
3940,
360,
29937,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29881,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29941,
13,
13,
9651,
396,
1192,
3940,
382,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29883,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29946,
13,
13,
9651,
396,
1192,
3940,
383,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29894,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29945,
13,
13,
9651,
396,
1192,
3940,
383,
29937,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29887,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29953,
13,
13,
9651,
396,
1192,
3940,
402,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29890,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29955,
13,
13,
9651,
396,
1192,
3940,
402,
29937,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29882,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29947,
13,
13,
9651,
396,
1192,
3940,
319,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29876,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29929,
13,
13,
9651,
396,
1192,
3940,
319,
29937,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29926,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29896,
29900,
13,
13,
9651,
396,
1192,
3940,
350,
1192,
396,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29885,
29901,
13,
18884,
1583,
29889,
8897,
9842,
353,
29871,
29896,
29896,
13,
13,
1990,
27080,
29918,
3125,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3992,
29892,
10928,
3505,
29892,
1060,
29892,
612,
29892,
27080,
1367,
1125,
13,
4706,
565,
27080,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
4706,
1583,
29889,
1367,
353,
27080,
1367,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
5852,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
5852,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
7700,
13,
4706,
1583,
29889,
29990,
353,
1060,
13,
4706,
1583,
29889,
29979,
353,
612,
13,
4706,
1583,
29889,
1626,
353,
3992,
13,
4706,
1583,
29889,
9824,
3505,
353,
10928,
3505,
13,
4706,
1583,
29889,
1626,
6110,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
13,
4706,
1583,
29889,
1626,
7011,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
13,
4706,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
29990,
448,
29871,
29906,
29892,
612,
448,
29871,
29906,
29892,
1583,
29889,
1626,
6110,
718,
29871,
29946,
29892,
1583,
29889,
1626,
7011,
718,
29871,
29946,
876,
13,
4706,
1583,
29889,
8897,
7364,
353,
1583,
29889,
7364,
2521,
13,
4706,
1583,
29889,
18498,
2161,
353,
22028,
29889,
18498,
2161,
3552,
1311,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
12622,
13,
4706,
1583,
29889,
23369,
1127,
29918,
29990,
353,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
448,
29871,
29906,
29892,
1583,
29889,
1626,
29897,
847,
29871,
29906,
13,
4706,
1583,
29889,
23369,
1127,
29918,
29979,
353,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
448,
29871,
29906,
29892,
1583,
29889,
1626,
29897,
847,
29871,
29906,
13,
4706,
1583,
29889,
3125,
2792,
353,
29871,
29900,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
29933,
29887,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
10581,
3306,
1159,
13,
4706,
1583,
29889,
28013,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
797,
4925,
29918,
28013,
3306,
1159,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
396,
1192,
26000,
16585,
1192,
396,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
1311,
29889,
18498,
2161,
29892,
1583,
29889,
29933,
29887,
3306,
29892,
313,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
12622,
13,
4706,
396,
1192,
26000,
1894,
20485,
1192,
396,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
1311,
29889,
18498,
2161,
29892,
1583,
29889,
28013,
3306,
29892,
313,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
11724,
29871,
29896,
29897,
13,
13,
4706,
396,
1192,
26000,
278,
11025,
3992,
1192,
396,
13,
4706,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
1311,
29889,
18498,
2161,
29892,
5591,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
448,
29871,
29906,
29892,
1583,
29889,
1626,
29892,
313,
29906,
29946,
29900,
29892,
29871,
29906,
29946,
29900,
29892,
29871,
29906,
29946,
29900,
511,
1583,
29889,
23369,
1127,
29918,
29990,
29892,
1583,
29889,
23369,
1127,
29918,
29979,
29897,
13,
13,
4706,
28657,
29925,
18799,
29889,
2204,
277,
29898,
1311,
29889,
18498,
2161,
29892,
313,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
12622,
13,
13,
4706,
565,
1583,
29889,
3125,
2792,
1275,
29871,
29906,
29901,
13,
9651,
1583,
29889,
3125,
2792,
353,
29871,
29900,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
396,
1192,
5399,
565,
7101,
756,
278,
1959,
2159,
1192,
396,
13,
4706,
565,
451,
1583,
29889,
8897,
7364,
1275,
1583,
29889,
7364,
2521,
29901,
13,
9651,
1583,
29889,
18498,
2161,
353,
22028,
29889,
18498,
2161,
3552,
1311,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
12622,
13,
13,
9651,
396,
1192,
10318,
599,
21179,
322,
20627,
9586,
1849,
1192,
396,
13,
9651,
1583,
29889,
1626,
6110,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
13,
9651,
1583,
29889,
1626,
7011,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
13,
9651,
1583,
29889,
7364,
2521,
353,
22310,
29879,
29889,
18455,
29889,
1293,
29918,
29925,
4790,
420,
7364,
3552,
1311,
29889,
7364,
2521,
29961,
29900,
29962,
448,
29871,
29906,
29892,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
448,
29871,
29906,
29892,
1583,
29889,
1626,
6110,
718,
29871,
29946,
29892,
1583,
29889,
1626,
7011,
718,
29871,
29946,
876,
13,
9651,
1583,
29889,
23369,
1127,
29918,
29990,
353,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
448,
29871,
29906,
29892,
1583,
29889,
1626,
29897,
847,
29871,
29906,
13,
9651,
1583,
29889,
23369,
1127,
29918,
29979,
353,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
847,
29871,
29906,
448,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
11974,
29965,
6037,
29918,
29933,
1025,
29889,
698,
29888,
613,
1583,
29889,
9824,
3505,
448,
29871,
29906,
29892,
1583,
29889,
1626,
29897,
847,
29871,
29906,
13,
13,
9651,
1583,
29889,
8897,
7364,
353,
1583,
29889,
7364,
2521,
13,
13,
4706,
1583,
29889,
29933,
29887,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
10581,
3306,
1159,
13,
4706,
1583,
29889,
28013,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
797,
4925,
29918,
28013,
3306,
1159,
13,
13,
4706,
565,
451,
1583,
29889,
9966,
29901,
13,
9651,
1583,
29889,
28013,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
797,
4925,
29918,
28013,
3306,
1159,
13,
9651,
736,
13,
13,
4706,
565,
1583,
29889,
3125,
2792,
1275,
29871,
29900,
29901,
13,
9651,
1583,
29889,
28013,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
797,
4925,
29918,
28013,
3306,
1159,
13,
13,
4706,
25342,
1583,
29889,
3125,
2792,
1275,
29871,
29896,
29901,
13,
9651,
1583,
29889,
28013,
3306,
353,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
3125,
29918,
9966,
29918,
28013,
3306,
1159,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
29901,
13,
9651,
1583,
29889,
3125,
2792,
353,
29871,
29896,
13,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
4897,
29901,
13,
9651,
1583,
29889,
3125,
2792,
353,
29871,
29900,
13,
9651,
1583,
29889,
4074,
2467,
1542,
353,
5852,
13,
13,
13,
1990,
27080,
29918,
1626,
1884,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
282,
9824,
1170,
29892,
282,
4592,
1626,
29892,
282,
9824,
3505,
29892,
282,
3306,
29892,
282,
29990,
29892,
282,
29979,
29892,
282,
8801,
1367,
1125,
13,
4706,
565,
282,
8801,
1367,
1275,
448,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
8801,
1367,
2609,
367,
448,
29896,
1159,
13,
13,
4706,
1583,
29889,
1367,
353,
282,
8801,
1367,
13,
4706,
1583,
29889,
4074,
2467,
1542,
353,
6213,
13,
4706,
1583,
29889,
9966,
353,
7700,
13,
4706,
1583,
29889,
2624,
6422,
519,
353,
5852,
13,
4706,
1583,
29889,
4592,
1626,
353,
282,
4592,
1626,
13,
4706,
1583,
29889,
1626,
353,
1583,
29889,
4592,
1626,
13,
4706,
1583,
29889,
9824,
3505,
353,
282,
9824,
3505,
13,
4706,
1583,
29889,
9824,
1170,
353,
282,
9824,
1170,
13,
4706,
1583,
29889,
3306,
353,
282,
3306,
13,
4706,
1583,
29889,
29990,
353,
282,
29990,
13,
4706,
1583,
29889,
29979,
353,
282,
29979,
13,
4706,
1583,
29889,
6110,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
29898,
29886,
9824,
1170,
29892,
282,
9824,
3505,
29892,
282,
4592,
1626,
29897,
13,
4706,
1583,
29889,
7011,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
29898,
29886,
9824,
1170,
29892,
282,
9824,
3505,
29892,
376,
19658,
1159,
13,
4706,
1583,
29889,
29909,
1994,
6422,
353,
7700,
13,
4706,
1583,
29889,
19890,
10302,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
7364,
2521,
353,
22028,
29889,
7364,
29898,
1311,
29889,
29990,
29892,
1583,
29889,
29979,
29892,
1583,
29889,
6110,
29892,
1583,
29889,
7011,
29897,
13,
4706,
1583,
29889,
8897,
7011,
353,
29871,
29896,
13,
4706,
1583,
29889,
7281,
6110,
353,
7700,
13,
4706,
1583,
29889,
20755,
24445,
353,
29871,
29900,
13,
13,
1678,
822,
3789,
29918,
29990,
29898,
1311,
29892,
7865,
1125,
13,
4706,
565,
451,
1583,
29889,
7364,
2521,
29961,
29900,
29962,
1275,
7865,
29901,
13,
9651,
1583,
29889,
7364,
2521,
353,
22028,
29889,
7364,
29898,
1917,
29892,
1583,
29889,
7364,
2521,
29961,
29896,
1402,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
2314,
13,
13,
1678,
822,
3789,
29918,
29979,
29898,
1311,
29892,
7865,
1125,
13,
4706,
565,
451,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
1275,
7865,
29901,
13,
9651,
1583,
29889,
7364,
2521,
353,
22028,
29889,
7364,
29898,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
7865,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7364,
2521,
29961,
29941,
2314,
13,
13,
1678,
822,
26000,
29898,
1311,
29892,
28657,
29925,
18799,
1125,
13,
4706,
396,
3164,
277,
278,
7705,
29889,
13,
4706,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
23711,
29925,
18799,
29892,
313,
29896,
29945,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29945,
511,
1583,
29889,
7364,
2521,
29897,
13,
13,
4706,
565,
1583,
29889,
1626,
1275,
1583,
29889,
4592,
1626,
29901,
13,
9651,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
23711,
29925,
18799,
29892,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
4290,
3313,
29918,
9824,
2283,
4968,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29892,
313,
29896,
29946,
29900,
29892,
29871,
29896,
29946,
29900,
29892,
29871,
29896,
29946,
29900,
511,
1583,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
2314,
13,
4706,
1683,
29901,
13,
9651,
565,
451,
1583,
29889,
1626,
1275,
376,
1115,
13,
18884,
3740,
29889,
3916,
3260,
29889,
9824,
10716,
29898,
23711,
29925,
18799,
29892,
3740,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
4290,
3313,
29918,
9824,
2283,
4968,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29892,
313,
29906,
29946,
29900,
29892,
29871,
29906,
29946,
29900,
29892,
29871,
29906,
29946,
29900,
511,
1583,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
2314,
13,
13,
4706,
565,
451,
1583,
29889,
9966,
29901,
13,
9651,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
23711,
29925,
18799,
29892,
313,
29906,
29945,
29945,
29892,
29871,
29945,
29896,
29892,
29871,
29896,
29900,
29906,
511,
313,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
448,
29871,
29896,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
29871,
29896,
876,
13,
4706,
1683,
29901,
13,
9651,
1383,
4085,
29889,
24111,
29918,
7364,
2521,
29898,
23711,
29925,
18799,
29892,
313,
29946,
29953,
29892,
29871,
29896,
29929,
29953,
29892,
29871,
29896,
29947,
29906,
511,
313,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
29962,
448,
29871,
29896,
29892,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
29871,
29896,
876,
13,
13,
1678,
822,
10318,
29898,
1311,
1125,
13,
4706,
396,
1192,
2538,
675,
278,
3992,
1884,
1192,
396,
13,
4706,
1018,
29901,
13,
9651,
565,
451,
1583,
29889,
7281,
6110,
29901,
13,
18884,
1583,
29889,
6110,
353,
4236,
29898,
29896,
29900,
29900,
29892,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
2103,
29898,
3120,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
4290,
3313,
29918,
9824,
2283,
4968,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
718,
29871,
29896,
29900,
29897,
13,
9651,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
353,
1583,
29889,
6110,
13,
9651,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
353,
3740,
29889,
3916,
3260,
29889,
2577,
9824,
29918,
3545,
29898,
3120,
29889,
1349,
13826,
3260,
29918,
2577,
4854,
703,
4290,
3313,
29918,
9824,
2283,
4968,
1583,
29889,
9824,
3505,
29892,
1583,
29889,
1626,
29897,
13,
9651,
1583,
29889,
8897,
7011,
353,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
13,
4706,
5174,
29901,
13,
9651,
565,
451,
1583,
29889,
7281,
6110,
29901,
13,
18884,
1583,
29889,
7364,
2521,
29961,
29906,
29962,
353,
29871,
29896,
29900,
29900,
13,
9651,
1583,
29889,
7364,
2521,
29961,
29941,
29962,
353,
1583,
29889,
8897,
7011,
13,
13,
4706,
565,
1583,
29889,
1626,
1275,
376,
1115,
13,
9651,
1583,
29889,
7364,
2521,
353,
22028,
29889,
7364,
29898,
1311,
29889,
7364,
2521,
29961,
29900,
1402,
1583,
29889,
7364,
2521,
29961,
29896,
1402,
1583,
29889,
7364,
2521,
29961,
29906,
1402,
1583,
29889,
7011,
29897,
13,
13,
1678,
822,
6864,
6422,
29898,
1311,
29892,
1741,
1125,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
29901,
13,
9651,
565,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
29933,
11375,
5550,
11538,
29901,
13,
18884,
565,
7431,
29898,
1311,
29889,
1626,
29897,
1405,
29871,
29900,
29901,
13,
462,
1678,
1583,
29889,
1626,
353,
1583,
29889,
1626,
7503,
29899,
29896,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
1626,
353,
1583,
29889,
4592,
1626,
13,
13,
9651,
1683,
29901,
13,
18884,
565,
451,
1583,
29889,
20755,
24445,
1275,
29871,
29900,
29901,
13,
462,
1678,
565,
7431,
29898,
1311,
29889,
1626,
29897,
529,
1583,
29889,
20755,
24445,
29901,
13,
462,
4706,
1583,
29889,
1626,
4619,
1741,
29889,
2523,
356,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
1626,
4619,
1741,
29889,
2523,
356,
13,
13,
9651,
1583,
29889,
4074,
2467,
1542,
353,
1583,
29889,
1626,
13,
13,
2
] |
model/model.py | shubhMaheshwari/NeuralTracking | 1 | 158319 | <filename>model/model.py<gh_stars>1-10
import sys,os
import torch
import torch.nn as nn
import numpy as np
from timeit import default_timer as timer
import math
import kornia
from timeit import default_timer as timer
from decimal import Decimal
import options as opt
import utils.query as query
from utils.nnutils import make_conv_2d, make_upscale_2d, make_downscale_2d, ResBlock2d, Identity
from model import pwcnet
from NeuralNRT._C import compute_pixel_anchors_geodesic as compute_pixel_anchors_geodesic_c
from NeuralNRT._C import compute_pixel_anchors_euclidean as compute_pixel_anchors_euclidean_c
from NeuralNRT._C import compute_mesh_from_depth as compute_mesh_from_depth_c
from NeuralNRT._C import erode_mesh as erode_mesh_c
from NeuralNRT._C import sample_nodes as sample_nodes_c
from NeuralNRT._C import compute_edges_geodesic as compute_edges_geodesic_c
from NeuralNRT._C import compute_edges_euclidean as compute_edges_euclidean_c
class MaskNet(torch.nn.Module):
def __init__(self):
super().__init__()
fn_0 = 16
self.input_fn = fn_0 + 6 * 2
fn_1 = 16
self.upconv1 = torch.nn.ConvTranspose2d(in_channels=565, out_channels=2*fn_0, kernel_size=4, stride=2, padding=1)
self.upconv2 = torch.nn.ConvTranspose2d(in_channels=2*fn_0, out_channels=fn_0, kernel_size=4, stride=2, padding=1)
if opt.use_batch_norm:
custom_batch_norm = torch.nn.BatchNorm2d
else:
custom_batch_norm = Identity
self.model = nn.Sequential(
make_conv_2d(self.input_fn, fn_1, n_blocks=1, normalization=custom_batch_norm),
ResBlock2d(fn_1, normalization=custom_batch_norm),
ResBlock2d(fn_1, normalization=custom_batch_norm),
ResBlock2d(fn_1, normalization=custom_batch_norm),
nn.Conv2d(fn_1, 1, kernel_size=3, padding=1),
torch.nn.Sigmoid()
)
def forward(self, features, x):
# Reduce number of channels and upscale to highest resolution
features = self.upconv1(features)
features = self.upconv2(features)
x = torch.cat([features, x], 1)
assert x.shape[1] == self.input_fn
return self.model(x)
class LinearSolverLU(torch.autograd.Function):
"""
LU linear solver.
"""
@staticmethod
def forward(ctx, A, b):
A_LU, pivots = torch.lu(A)
x = torch.lu_solve(b, A_LU, pivots)
ctx.save_for_backward(A_LU, pivots, x)
return x
@staticmethod
def backward(ctx, grad_x):
A_LU, pivots, x = ctx.saved_tensors
# Math:
# A * grad_b = grad_x
# grad_A = -grad_b * x^T
grad_b = torch.lu_solve(grad_x, A_LU, pivots)
grad_A = -torch.matmul(grad_b, x.view(1, -1))
return grad_A, grad_b
class DeformNet(torch.nn.Module):
def __init__(self):
super().__init__()
self.gn_num_iter = 10
self.gn_data_flow = 0.001
self.gn_data_depth = 1.0
self.gn_arap = 1.0
self.gn_lm_factor = 0.1
# Optimizer fails for > 3 iterations. Current hack is to stop update is loss increases by 1
self.stop_loss_diff = 1
# Optical flow network
self.flow_net = pwcnet.PWCNet()
if opt.freeze_optical_flow_net:
# Freeze
for param in self.flow_net.parameters():
param.requires_grad = False
# Weight prediction network
self.mask_net = MaskNet()
if opt.freeze_mask_net:
# Freeze
for param in self.mask_net.parameters():
param.requires_grad = False
vec_to_skew_mat_np = np.array([
[0, 0, 0],
[0, 0, -1],
[0, 1, 0],
[0, 0, 1],
[0, 0, 0],
[-1, 0, 0],
[0, -1, 0],
[1, 0, 0],
[0, 0, 0]
], dtype=np.float32)
self.vec_to_skew_mat = torch.from_numpy(vec_to_skew_mat_np).to('cuda')
def forward(
self, x1, x2,
graph_nodes, graph_edges, graph_edges_weights, graph_clusters,
pixel_anchors, pixel_weights,
num_nodes_vec, intrinsics,
evaluate=False, split="train",
prev_rot=None,prev_trans=None
):
batch_size = x1.shape[0]
image_width = x1.shape[3]
image_height = x1.shape[2]
convergence_info = []
for i in range(batch_size):
convergence_info.append({
"total": [],
"arap": [],
"data": [],
"condition_numbers": [],
"valid": 0,
"errors": []
})
########################################################################
# Compute dense flow from source to target.
########################################################################
flow2, flow3, flow4, flow5, flow6, features2 = self.flow_net.forward(x1[:,:3,:,:], x2[:,:3,:,:])
assert torch.isfinite(flow2).all()
assert torch.isfinite(features2).all()
flow = 20.0 * torch.nn.functional.interpolate(input=flow2, size=(image_height, image_width), mode='bilinear', align_corners=False)
########################################################################
# Initialize graph data.
########################################################################
num_nodes_total = graph_nodes.shape[1]
num_neighbors = graph_edges.shape[2]
# We assume we always use 4 nearest anchors.
assert pixel_anchors.shape[3] == 4
########################################################################
# Apply dense flow to warp the source points to target frame.
########################################################################
x_coords = torch.arange(image_width, dtype=torch.float32, device=x1.device).unsqueeze(0).expand(image_height, image_width).unsqueeze(0)
y_coords = torch.arange(image_height, dtype=torch.float32, device=x1.device).unsqueeze(1).expand(image_height, image_width).unsqueeze(0)
xy_coords = torch.cat([x_coords, y_coords], 0)
xy_coords = xy_coords.unsqueeze(0).repeat(batch_size, 1, 1, 1) # (bs, 2, 448, 640)
# Apply the flow to pixel coordinates.
xy_coords_warped = xy_coords + flow
xy_pixels_warped = xy_coords_warped.clone()
# Normalize to be between -1, and 1.
# Since we use "align_corners=False", the boundaries of corner pixels
# are -1 and 1, not their centers.
xy_coords_warped[:,0,:,:] = (xy_coords_warped[:,0,:,:]) / (image_width - 1)
xy_coords_warped[:,1,:,:] = (xy_coords_warped[:,1,:,:]) / (image_height - 1)
xy_coords_warped = xy_coords_warped * 2 - 1
# Permute the warped coordinates to fit the grid_sample format.
xy_coords_warped = xy_coords_warped.permute(0, 2, 3, 1)
########################################################################
# Construct point-to-point correspondences between source <-> target points.
########################################################################
# Mask out invalid source points.
source_points = x1[:, 3:, :, :].clone()
source_anchor_validity = torch.all(pixel_anchors >= 0.0, dim=3)
# Sample target points at computed pixel locations.
target_points = x2[:, 3:, :, :].clone()
target_matches = torch.nn.functional.grid_sample(
target_points, xy_coords_warped, mode=opt.gn_depth_sampling_mode, padding_mode='zeros', align_corners=False
)
# We filter out any boundary matches, where any of the 4 pixels is invalid.
target_validity = ((target_points > 0.0) & (target_points <= opt.gn_max_depth)).type(torch.float32)
target_matches_validity = torch.nn.functional.grid_sample(
target_validity, xy_coords_warped, mode="bilinear", padding_mode='zeros', align_corners=False
)
target_matches_validity = target_matches_validity[:, 2, :, :] >= 0.999
# Prepare masks for both valid source points and target matches
valid_source_points = (source_points[:, 2, :, :] > 0.0) & (source_points[:, 2, :, :] <= opt.gn_max_depth) & source_anchor_validity
valid_target_matches = (target_matches[:, 2, :, :] > 0.0) & (target_matches[:, 2, :, :] <= opt.gn_max_depth) & target_matches_validity
# Prepare the input of both the MaskNet and AttentionNet, if we actually use either of them
if opt.use_mask:
target_rgb = x2[:, :3, :, :].clone()
target_rgb_warped = torch.nn.functional.grid_sample(target_rgb, xy_coords_warped, padding_mode='zeros', align_corners=False)
mask_input = torch.cat([x1, target_rgb_warped, target_matches], 1)
########################################################################
# MaskNet
########################################################################
# We predict correspondence weights [0, 1], if we use mask network.
mask_pred = None
if opt.use_mask:
mask_pred = self.mask_net(features2, mask_input).view(batch_size, image_height, image_width)
# mask_pred[:,:,:] = 1.0
# print(mask_pred)
# Compute mask of valid correspondences
valid_correspondences = valid_source_points & valid_target_matches
# Initialize correspondence weights with 1's. We might overwrite them with MaskNet-predicted weights next
correspondence_weights = torch.ones(valid_target_matches.shape, dtype=torch.float32, device=valid_target_matches.device)
# We invalidate target matches later, when we assign a weight to each match.
if opt.use_mask:
correspondence_weights = mask_pred
if evaluate:
# Hard threshold
if opt.threshold_mask_predictions:
correspondence_weights = torch.where(mask_pred < opt.threshold, torch.zeros_like(mask_pred), mask_pred)
# Patch-wise threshold
elif opt.patchwise_threshold_mask_predictions:
pooled = torch.nn.functional.max_pool2d(input=mask_pred, kernel_size=opt.patch_size, stride=opt.patch_size)
pooled = torch.nn.functional.interpolate(input=pooled.unsqueeze(1), size=(opt.image_height, opt.image_width), mode='nearest').squeeze(1)
selected = (torch.abs(mask_pred - pooled) <= 1e-8).type(torch.float32)
correspondence_weights = mask_pred * selected #* opt.patch_size**2
num_valid_correspondences = torch.sum(valid_correspondences, dim=(1, 2))
########################################################################
# Initialize graph data.
########################################################################
num_nodes_total = graph_nodes.shape[1]
num_neighbors = graph_edges.shape[2]
# We assume we always use 4 nearest anchors.
assert pixel_anchors.shape[3] == 4
node_rotations = torch.eye(3, dtype=x1.dtype, device=x1.device).view(1, 1, 3, 3).repeat(batch_size, num_nodes_total, 1, 1)
node_translations = torch.zeros((batch_size, num_nodes_total, 3), dtype=x1.dtype, device=x1.device)
deformations_validity = torch.zeros((batch_size, num_nodes_total), dtype=x1.dtype, device=x1.device)
valid_solve = torch.zeros((batch_size), dtype=torch.uint8, device=x1.device)
deformed_points_pred = torch.zeros((batch_size, opt.gn_max_warped_points, 3), dtype=x1.dtype, device=x1.device)
deformed_points_idxs = torch.zeros((batch_size, opt.gn_max_warped_points), dtype=torch.int64, device=x1.device)
deformed_points_subsampled = torch.zeros((batch_size), dtype=torch.uint8, device=x1.device)
# Skip the solver
if not evaluate and opt.skip_solver:
return {
"flow_data": [flow2, flow3, flow4, flow5, flow6],
"node_rotations": node_rotations,
"node_translations": node_translations,
"deformations_validity": deformations_validity,
"deformed_points_pred": deformed_points_pred,
"valid_solve": valid_solve,
"mask_pred": mask_pred,
"correspondence_info": {
"xy_coords_warped":xy_coords_warped,
"source_points":source_points,
"valid_source_points":valid_source_points,
"target_matches":target_matches,
"valid_target_matches":valid_target_matches,
"valid_correspondences":None,
"deformed_points_idxs":deformed_points_idxs,
"deformed_points_subsampled": deformed_points_subsampled
},
"convergence_info": convergence_info,
"weight_info": {
"total_corres_num": 0,
"total_corres_weight": 0.0
}
}
########################################################################
# Estimate node deformations using differentiable Gauss-Newton.
########################################################################
correspondences_exist = num_valid_correspondences > 0
total_num_matches_per_batch = 0
weight_info = {
"total_corres_num": 0,
"total_corres_weight": 0.0
}
self.vec_to_skew_mat.to(x1.device)
for i in range(batch_size):
if opt.gn_debug:
print()
print("--Sample", i, "in batch--")
num_nodes_i = num_nodes_vec[i]
if num_nodes_i > opt.gn_max_nodes or num_nodes_i < opt.gn_min_nodes:
print(f"\tSolver failed: Invalid number of nodes: {num_nodes_i}. Allowed Range=> {opt.gn_min_nodes}:{opt.gn_max_nodes}. Change node coverage parameter during graph creation.")
convergence_info[i]["errors"].append(f"Solver failed: Invalid number of nodes: {num_nodes_i}. Allowed Range=> {opt.gn_min_nodes}:{opt.gn_max_nodes}. Change node coverage parameter during graph creation.")
continue
if not correspondences_exist[i]:
print("\tSolver failed: No valid correspondences before filtering")
convergence_info[i]["errors"].append("Solver failed: No valid correspondences before filtering")
continue
timer_start = timer()
graph_nodes_i = graph_nodes[i, :num_nodes_i, :] # (num_nodes_i, 3)
graph_edges_i = graph_edges[i, :num_nodes_i, :] # (num_nodes_i, 8)
graph_edges_weights_i = graph_edges_weights[i, :num_nodes_i, :] # (num_nodes_i, 8)
graph_clusters_i = graph_clusters[i, :num_nodes_i, :] # (num_nodes_i, 1)
fx = intrinsics[i, 0]
fy = intrinsics[i, 1]
cx = intrinsics[i, 2]
cy = intrinsics[i, 3]
###############################################################################################################
# Filter invalid matches.
###############################################################################################################
valid_correspondences_idxs = torch.where(valid_correspondences[i])
source_points_filtered = source_points[i].permute(1, 2, 0)
source_points_filtered = source_points_filtered[valid_correspondences_idxs[0], valid_correspondences_idxs[1], :].view(-1, 3, 1)
target_matches_filtered = target_matches[i].permute(1, 2, 0)
target_matches_filtered = target_matches_filtered[valid_correspondences_idxs[0], valid_correspondences_idxs[1], :].view(-1, 3, 1)
xy_pixels_warped_filtered = xy_pixels_warped[i].permute(1, 2, 0) # (height, width, 2)
xy_pixels_warped_filtered = xy_pixels_warped_filtered[valid_correspondences_idxs[0], valid_correspondences_idxs[1], :].view(-1, 2, 1)
correspondence_weights_filtered = correspondence_weights[i, valid_correspondences_idxs[0], valid_correspondences_idxs[1]].view(-1) # (num_matches)
source_anchors = pixel_anchors[i, valid_correspondences_idxs[0], valid_correspondences_idxs[1], :] # (num_matches, 4)
source_weights = pixel_weights[i, valid_correspondences_idxs[0], valid_correspondences_idxs[1], :] # (num_matches, 4)
num_matches = source_points_filtered.shape[0]
###############################################################################################################
# Generate weight info to estimate average weight.
###############################################################################################################
weight_info = {
"total_corres_num": correspondence_weights_filtered.shape[0],
"total_corres_weight": float(correspondence_weights_filtered.sum())
}
###############################################################################################################
# Randomly subsample matches, if necessary.
###############################################################################################################
if split == "val" or split == "test":
max_num_matches = opt.gn_max_matches_eval
elif split == "train":
max_num_matches = opt.gn_max_matches_train
else:
raise Exception("Split {} is not defined".format(split))
if num_matches > max_num_matches:
sampled_idxs = torch.randperm(num_matches)[:max_num_matches]
source_points_filtered = source_points_filtered[sampled_idxs]
target_matches_filtered = target_matches_filtered[sampled_idxs]
xy_pixels_warped_filtered = xy_pixels_warped_filtered[sampled_idxs]
correspondence_weights_filtered = correspondence_weights_filtered[sampled_idxs]
source_anchors = source_anchors[sampled_idxs]
source_weights = source_weights[sampled_idxs]
num_matches = max_num_matches
###############################################################################################################
# Remove nodes if their corresponding clusters don't have enough correspondences
# (Correspondences that have "bad" nodes as anchors will also be removed)
###############################################################################################################
map_opt_nodes_to_complete_nodes_i = list(range(0, num_nodes_i))
opt_num_nodes_i = num_nodes_i
if opt.gn_remove_clusters_with_few_matches:
source_anchors_numpy = source_anchors.clone().cpu().numpy()
source_weights_numpy = source_weights.clone().cpu().numpy()
# Compute number of correspondences (or matches) per node in the form of the
# match weight sum
match_weights_per_node = np.zeros(num_nodes_i)
# This method adds weight contribution of each match to the corresponding node,
# allowing duplicate node ids in the flattened array.
np.add.at(match_weights_per_node, source_anchors_numpy.flatten(), source_weights_numpy.flatten())
total_match_weights = 0.0
match_weights_per_cluster = {}
for node_id in range(num_nodes_i):
# Get sum of weights for current node.
match_weights = match_weights_per_node[node_id]
# Get cluster id for current node
cluster_id = graph_clusters_i[node_id].item()
if cluster_id in match_weights_per_cluster:
match_weights_per_cluster[cluster_id] += match_weights
else:
match_weights_per_cluster[cluster_id] = match_weights
total_match_weights += match_weights
# we'll build a mask that stores which nodes will survive
valid_nodes_mask_i = torch.ones((num_nodes_i), dtype=torch.bool, device=x1.device)
# if not enough matches in a cluster, mark all cluster's nodes for removal
node_ids_for_removal = []
for cluster_id, cluster_match_weights in match_weights_per_cluster.items():
if opt.gn_debug:
print('cluster_id', cluster_id, cluster_match_weights)
if cluster_match_weights < opt.gn_min_num_correspondences_per_cluster:
x = torch.where(graph_clusters_i == cluster_id)[0].tolist()
node_ids_for_removal += x
if opt.gn_debug:
print("node_ids_for_removal", node_ids_for_removal)
if len(node_ids_for_removal) > 0:
# Mark invalid nodes
valid_nodes_mask_i[node_ids_for_removal] = False
# Kepp only nodes and edges for valid nodes
graph_nodes_i = graph_nodes_i[valid_nodes_mask_i.squeeze()]
graph_edges_i = graph_edges_i[valid_nodes_mask_i.squeeze()]
graph_edges_weights_i = graph_edges_weights_i[valid_nodes_mask_i.squeeze()]
# Update number of nodes
opt_num_nodes_i = graph_nodes_i.shape[0]
# Get mask of correspondences for which any one of their anchors is an invalid node
valid_corresp_mask = torch.ones((num_matches), dtype=torch.bool, device=x1.device)
for node_id_for_removal in node_ids_for_removal:
valid_corresp_mask = valid_corresp_mask & torch.all(source_anchors != node_id_for_removal, axis=1)
source_points_filtered = source_points_filtered[valid_corresp_mask]
target_matches_filtered = target_matches_filtered[valid_corresp_mask]
xy_pixels_warped_filtered = xy_pixels_warped_filtered[valid_corresp_mask]
correspondence_weights_filtered = correspondence_weights_filtered[valid_corresp_mask]
source_anchors = source_anchors[valid_corresp_mask]
source_weights = source_weights[valid_corresp_mask]
num_matches = source_points_filtered.shape[0]
# Update node_ids in edges and anchors by mapping old indices to new indices
map_opt_nodes_to_complete_nodes_i = []
node_count = 0
for node_id, is_node_valid in enumerate(valid_nodes_mask_i):
if is_node_valid:
graph_edges_i[graph_edges_i == node_id] = node_count
source_anchors[source_anchors == node_id] = node_count
map_opt_nodes_to_complete_nodes_i.append(node_id)
node_count += 1
if num_matches == 0:
if opt.gn_debug:
print("\tSolver failed: No valid correspondences")
convergence_info[i]["errors"].append("Solver failed: No valid correspondences after filtering")
continue
if opt_num_nodes_i > opt.gn_max_nodes or opt_num_nodes_i < opt.gn_min_nodes:
if opt.gn_debug:
print(f"\tSolver failed: Invalid number of nodes: {num_nodes_i}. Allowed Range=> {opt.gn_min_nodes}:{opt.gn_max_nodes}. Change node coverage parameter during graph creation.")
convergence_info[i]["errors"].append(f"Solver failed: Invalid number of nodes: {num_nodes_i}. Allowed Range=> {opt.gn_min_nodes}:{opt.gn_max_nodes}. Change node coverage parameter during graph creation.")
continue
# Since source anchor ids need to be long in order to be used as indices,
# we need to convert them.
assert torch.all(source_anchors >= 0)
source_anchors = source_anchors.type(torch.int64)
###############################################################################################################
# Filter invalid edges.
###############################################################################################################
node_ids = torch.arange(opt_num_nodes_i, dtype=torch.int32, device=x1.device).view(-1, 1).repeat(1, num_neighbors) # (opt_num_nodes_i, num_neighbors)
graph_edge_pairs = torch.cat([node_ids.view(-1, num_neighbors, 1), graph_edges_i.view(-1, num_neighbors, 1)], 2) # (opt_num_nodes_i, num_neighbors, 2)
valid_edges = graph_edges_i >= 0
valid_edge_idxs = torch.where(valid_edges)
graph_edge_pairs_filtered = graph_edge_pairs[valid_edge_idxs[0], valid_edge_idxs[1], :].type(torch.int64)
graph_edge_weights_pairs = graph_edges_weights_i[valid_edge_idxs[0], valid_edge_idxs[1]]
num_edges_i = graph_edge_pairs_filtered.shape[0]
###############################################################################################################
# Execute Gauss-Newton solver.
###############################################################################################################
num_gn_iter = self.gn_num_iter
lambda_data_flow = math.sqrt(self.gn_data_flow)
lambda_data_depth = math.sqrt(self.gn_data_depth)
lambda_arap = math.sqrt(self.gn_arap)
lm_factor = self.gn_lm_factor
# The parameters in GN solver are 3 parameters for rotation and 3 parameters for
# translation for every node. All node rotation parameters are listed first, and
# then all node translation parameters are listed.
# x = [w_current_all, t_current_all]
if prev_rot is None and prev_trans is None:
R_current = torch.eye(3, dtype=x1.dtype, device=x1.device).view(1, 3, 3).repeat(opt_num_nodes_i, 1, 1)
t_current = torch.zeros((opt_num_nodes_i, 3, 1), dtype=x1.dtype, device=x1.device)
else:
R_current = torch.tensor(prev_rot[map_opt_nodes_to_complete_nodes_i, :, :],dtype=x1.dtype,device=x1.device).view(opt_num_nodes_i, 3, 3)
t_current = torch.tensor(prev_trans[map_opt_nodes_to_complete_nodes_i, :],dtype=x1.dtype,device=x1.device).view(opt_num_nodes_i, 3, 1)
if opt.gn_debug:
print("\tNum. matches: {0} || Num. nodes: {1} || Num. edges: {2}".format(num_matches, opt_num_nodes_i, num_edges_i))
# Helper structures.
data_increment_vec_0_3 = torch.arange(0, num_matches * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_matches)
data_increment_vec_1_3 = torch.arange(1, num_matches * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_matches)
data_increment_vec_2_3 = torch.arange(2, num_matches * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_matches)
if num_edges_i > 0:
arap_increment_vec_0_3 = torch.arange(0, num_edges_i * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_edges_i)
arap_increment_vec_1_3 = torch.arange(1, num_edges_i * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_edges_i)
arap_increment_vec_2_3 = torch.arange(2, num_edges_i * 3, 3, out=torch.cuda.LongTensor(), device=x1.device) # (num_edges_i)
arap_one_vec = torch.ones((num_edges_i), dtype=x1.dtype, device=x1.device)
ill_posed_system = False
for gn_i in range(num_gn_iter):
if gn_i % 3 == 2:
lm_factor /= 2;
timer_data_start = timer()
##########################################
# Compute data residual and jacobian.
##########################################
jacobian_data = torch.zeros((num_matches * 3, opt_num_nodes_i * 6), dtype=x1.dtype, device=x1.device) # (num_matches*3, opt_num_nodes_i*6)
deformed_points = torch.zeros((num_matches, 3, 1), dtype=x1.dtype, device=x1.device)
for k in range(4): # Our data uses 4 anchors for every point
node_idxs_k = source_anchors[:, k] # (num_matches)
nodes_k = graph_nodes_i[node_idxs_k].view(num_matches, 3, 1) # (num_matches, 3, 1)
# Compute deformed point contribution.
rotated_points_k = torch.matmul(R_current[node_idxs_k], source_points_filtered - nodes_k) # (num_matches, 3, 1) = (num_matches, 3, 3) * (num_matches, 3, 1)
deformed_points_k = rotated_points_k + nodes_k + t_current[node_idxs_k]
deformed_points += source_weights[:, k].view(num_matches, 1, 1).repeat(1, 3, 1) * deformed_points_k # (num_matches, 3, 1)
# Get necessary components of deformed points.
eps = 1e-7 # Just as good practice, although matches should all have valid depth at this stage
deformed_x = deformed_points[:, 0, :].view(num_matches) # (num_matches)
deformed_y = deformed_points[:, 1, :].view(num_matches) # (num_matches)
deformed_z_inverse = torch.div(1.0, deformed_points[:, 2, :].view(num_matches) + eps) # (num_matches)
fx_mul_x = fx * deformed_x # (num_matches)
fy_mul_y = fy * deformed_y # (num_matches)
fx_div_z = fx * deformed_z_inverse # (num_matches)
fy_div_z = fy * deformed_z_inverse # (num_matches)
fx_mul_x_div_z = fx_mul_x * deformed_z_inverse # (num_matches)
fy_mul_y_div_z = fy_mul_y * deformed_z_inverse # (num_matches)
minus_fx_mul_x_div_z_2 = -fx_mul_x_div_z * deformed_z_inverse # (num_matches)
minus_fy_mul_y_div_z_2 = -fy_mul_y_div_z * deformed_z_inverse # (num_matches)
for k in range(4): # Our data uses 4 anchors for every point
node_idxs_k = source_anchors[:, k] # (num_matches)
nodes_k = graph_nodes_i[node_idxs_k].view(num_matches, 3, 1) # (num_matches, 3, 1)
weights_k = source_weights[:, k] * correspondence_weights_filtered # (num_matches)
# Compute skew symetric part.
rotated_points_k = torch.matmul(R_current[node_idxs_k], source_points_filtered - nodes_k) # (num_matches, 3, 1) = (num_matches, 3, 3) * (num_matches, 3, 1)
weighted_rotated_points_k = weights_k.view(num_matches, 1, 1).repeat(1, 3, 1) * rotated_points_k # (num_matches, 3, 1)
skew_symetric_mat_data = -torch.matmul(self.vec_to_skew_mat, weighted_rotated_points_k).view(num_matches, 3, 3) # (num_matches, 3, 3)
# Compute jacobian wrt. TRANSLATION.
# FLOW PART
jacobian_data[data_increment_vec_0_3, 3 * opt_num_nodes_i + 3 * node_idxs_k + 0] += lambda_data_flow * weights_k * fx_div_z # (num_matches)
jacobian_data[data_increment_vec_0_3, 3 * opt_num_nodes_i + 3 * node_idxs_k + 2] += lambda_data_flow * weights_k * minus_fx_mul_x_div_z_2 # (num_matches)
jacobian_data[data_increment_vec_1_3, 3 * opt_num_nodes_i + 3 * node_idxs_k + 1] += lambda_data_flow * weights_k * fy_div_z # (num_matches)
jacobian_data[data_increment_vec_1_3, 3 * opt_num_nodes_i + 3 * node_idxs_k + 2] += lambda_data_flow * weights_k * minus_fy_mul_y_div_z_2 # (num_matches)
# DEPTH PART
jacobian_data[data_increment_vec_2_3, 3 * opt_num_nodes_i + 3 * node_idxs_k + 2] += lambda_data_depth * weights_k # (num_matches)
# Compute jacobian wrt. ROTATION.
# FLOW PART
jacobian_data[data_increment_vec_0_3, 3 * node_idxs_k + 0] += lambda_data_flow * fx_div_z * skew_symetric_mat_data[:, 0, 0] + minus_fx_mul_x_div_z_2 * skew_symetric_mat_data[:, 2, 0]
jacobian_data[data_increment_vec_0_3, 3 * node_idxs_k + 1] += lambda_data_flow * fx_div_z * skew_symetric_mat_data[:, 0, 1] + minus_fx_mul_x_div_z_2 * skew_symetric_mat_data[:, 2, 1]
jacobian_data[data_increment_vec_0_3, 3 * node_idxs_k + 2] += lambda_data_flow * fx_div_z * skew_symetric_mat_data[:, 0, 2] + minus_fx_mul_x_div_z_2 * skew_symetric_mat_data[:, 2, 2]
jacobian_data[data_increment_vec_1_3, 3 * node_idxs_k + 0] += lambda_data_flow * fy_div_z * skew_symetric_mat_data[:, 1, 0] + minus_fy_mul_y_div_z_2 * skew_symetric_mat_data[:, 2, 0]
jacobian_data[data_increment_vec_1_3, 3 * node_idxs_k + 1] += lambda_data_flow * fy_div_z * skew_symetric_mat_data[:, 1, 1] + minus_fy_mul_y_div_z_2 * skew_symetric_mat_data[:, 2, 1]
jacobian_data[data_increment_vec_1_3, 3 * node_idxs_k + 2] += lambda_data_flow * fy_div_z * skew_symetric_mat_data[:, 1, 2] + minus_fy_mul_y_div_z_2 * skew_symetric_mat_data[:, 2, 2]
# DEPTH PART
jacobian_data[data_increment_vec_2_3, 3 * node_idxs_k + 0] += lambda_data_depth * skew_symetric_mat_data[:, 2, 0]
jacobian_data[data_increment_vec_2_3, 3 * node_idxs_k + 1] += lambda_data_depth * skew_symetric_mat_data[:, 2, 1]
jacobian_data[data_increment_vec_2_3, 3 * node_idxs_k + 2] += lambda_data_depth * skew_symetric_mat_data[:, 2, 2]
assert torch.isfinite(jacobian_data).all(), jacobian_data
res_data = torch.zeros((num_matches * 3, 1), dtype=x1.dtype, device=x1.device)
# FLOW PART
res_data[data_increment_vec_0_3, 0] = lambda_data_flow * correspondence_weights_filtered * (fx_mul_x_div_z + cx - xy_pixels_warped_filtered[:, 0, :].view(num_matches))
res_data[data_increment_vec_1_3, 0] = lambda_data_flow * correspondence_weights_filtered * (fy_mul_y_div_z + cy - xy_pixels_warped_filtered[:, 1, :].view(num_matches))
# DEPTH PART
res_data[data_increment_vec_2_3, 0] = lambda_data_depth * correspondence_weights_filtered * (deformed_points[:, 2, :] - target_matches_filtered[:, 2, :]).view(num_matches)
if opt.gn_print_timings: print("\t\tData term: {:.3f} s".format(timer() - timer_data_start))
timer_arap_start = timer()
##########################################
# Compute arap residual and jacobian.
##########################################
if num_edges_i > 0:
jacobian_arap = torch.zeros((num_edges_i * 3, opt_num_nodes_i * 6), dtype=x1.dtype, device=x1.device) # (num_edges_i*3, opt_num_nodes_i*6)
node_idxs_0 = graph_edge_pairs_filtered[:, 0] # i node
node_idxs_1 = graph_edge_pairs_filtered[:, 1] # j node
w = torch.ones_like(graph_edge_weights_pairs)
if opt.gn_use_edge_weighting:
# Since graph edge weights sum up to 1 for all neighbors, we multiply
# it by the number of neighbors to make the setting in the same scale
# as in the case of not using edge weights (they are all 1 then).
w = float(num_neighbors) * graph_edge_weights_pairs
w_repeat = w.unsqueeze(-1).repeat(1, 3).unsqueeze(-1)
w_repeat_repeat = w_repeat.repeat(1, 1, 3)
nodes_0 = graph_nodes_i[node_idxs_0].view(num_edges_i, 3, 1)
nodes_1 = graph_nodes_i[node_idxs_1].view(num_edges_i, 3, 1)
# Compute residual.
rotated_node_delta = torch.matmul(R_current[node_idxs_0], nodes_1 - nodes_0) # (num_edges_i, 3)
res_arap = lambda_arap * w_repeat * (rotated_node_delta + nodes_0 + t_current[node_idxs_0] - (nodes_1 + t_current[node_idxs_1]))
res_arap = res_arap.view(num_edges_i * 3, 1)
# Compute jacobian wrt. translations.
jacobian_arap[arap_increment_vec_0_3, 3 * opt_num_nodes_i + 3 * node_idxs_0 + 0] += lambda_arap * w * arap_one_vec # (num_edges_i)
jacobian_arap[arap_increment_vec_1_3, 3 * opt_num_nodes_i + 3 * node_idxs_0 + 1] += lambda_arap * w * arap_one_vec # (num_edges_i)
jacobian_arap[arap_increment_vec_2_3, 3 * opt_num_nodes_i + 3 * node_idxs_0 + 2] += lambda_arap * w * arap_one_vec # (num_edges_i)
jacobian_arap[arap_increment_vec_0_3, 3 * opt_num_nodes_i + 3 * node_idxs_1 + 0] += -lambda_arap * w * arap_one_vec # (num_edges_i)
jacobian_arap[arap_increment_vec_1_3, 3 * opt_num_nodes_i + 3 * node_idxs_1 + 1] += -lambda_arap * w * arap_one_vec # (num_edges_i)
jacobian_arap[arap_increment_vec_2_3, 3 * opt_num_nodes_i + 3 * node_idxs_1 + 2] += -lambda_arap * w * arap_one_vec # (num_edges_i)
# Compute jacobian wrt. rotations.
# Derivative wrt. R_1 is equal to 0.
skew_symetric_mat_arap = -lambda_arap * w_repeat_repeat * torch.matmul(self.vec_to_skew_mat, rotated_node_delta).view(num_edges_i, 3, 3) # (num_edges_i, 3, 3)
jacobian_arap[arap_increment_vec_0_3, 3 * node_idxs_0 + 0] += skew_symetric_mat_arap[:, 0, 0]
jacobian_arap[arap_increment_vec_0_3, 3 * node_idxs_0 + 1] += skew_symetric_mat_arap[:, 0, 1]
jacobian_arap[arap_increment_vec_0_3, 3 * node_idxs_0 + 2] += skew_symetric_mat_arap[:, 0, 2]
jacobian_arap[arap_increment_vec_1_3, 3 * node_idxs_0 + 0] += skew_symetric_mat_arap[:, 1, 0]
jacobian_arap[arap_increment_vec_1_3, 3 * node_idxs_0 + 1] += skew_symetric_mat_arap[:, 1, 1]
jacobian_arap[arap_increment_vec_1_3, 3 * node_idxs_0 + 2] += skew_symetric_mat_arap[:, 1, 2]
jacobian_arap[arap_increment_vec_2_3, 3 * node_idxs_0 + 0] += skew_symetric_mat_arap[:, 2, 0]
jacobian_arap[arap_increment_vec_2_3, 3 * node_idxs_0 + 1] += skew_symetric_mat_arap[:, 2, 1]
jacobian_arap[arap_increment_vec_2_3, 3 * node_idxs_0 + 2] += skew_symetric_mat_arap[:, 2, 2]
assert torch.isfinite(jacobian_arap).all(), jacobian_arap
if opt.gn_print_timings: print("\t\tARAP term: {:.3f} s".format(timer() - timer_arap_start))
##########################################
# Solve linear system.
##########################################
if num_edges_i > 0:
res = torch.cat((res_data, res_arap), 0)
jac = torch.cat((jacobian_data, jacobian_arap), 0)
else:
res = res_data
jac = jacobian_data
timer_system_start = timer()
# Compute A = J^TJ and b = -J^Tr.
jac_t = torch.transpose(jac, 0, 1)
A = torch.matmul(jac_t, jac)
b = torch.matmul(-jac_t, res)
# Solve linear system Ax = b.
A = A + torch.eye(A.shape[0], dtype=A.dtype, device=A.device) * lm_factor
assert torch.isfinite(A).all(), A
if opt.gn_print_timings: print("\t\tSystem computation: {:.3f} s".format(timer() - timer_system_start))
timer_cond_start = timer()
# Check the determinant/condition number.
# If unstable, we break optimization.
if opt.gn_check_condition_num:
with torch.no_grad():
# Condition number.
values, _ = torch.eig(A)
real_values = values[:, 0]
assert torch.isfinite(real_values).all(), real_values
max_eig_value = torch.max(torch.abs(real_values))
min_eig_value = torch.min(torch.abs(real_values))
condition_number = max_eig_value / min_eig_value
condition_number = condition_number.item()
convergence_info[i]["condition_numbers"].append(condition_number)
if opt.gn_break_on_condition_num and (not math.isfinite(condition_number) or condition_number > opt.gn_max_condition_num):
print("\t\tToo high condition number: {0:e} (max: {1:.3f}, min: {2:.3f}). Discarding sample".format(condition_number, max_eig_value.item(), min_eig_value.item()))
convergence_info[i]["errors"].append("Too high condition number: {0:e} (max: {1:.3f}, min: {2:.3f}). Discarding sample".format(condition_number, max_eig_value.item(), min_eig_value.item()))
ill_posed_system = True
break
elif opt.gn_debug:
print("\t\tCondition number: {0:e} (max: {1:.3f}, min: {2:.3f})".format(condition_number, max_eig_value.item(), min_eig_value.item()))
if opt.gn_print_timings: print("\t\tComputation of cond. num.: {:.3f} s".format(timer() - timer_cond_start))
timer_solve_start = timer()
linear_solver = LinearSolverLU.apply
try:
x = linear_solver(A, b)
except RuntimeError as e:
ill_posed_system = True
print("\t\tSolver failed: Ill-posed system!", e)
convergence_info[i]["errors"].append("Solver failed: Ill-posed system!")
break
if not torch.isfinite(x).all():
ill_posed_system = True
print("\t\tSolver failed: Non-finite solution x!")
convergence_info[i]["errors"].append("Solver failed: Non-finite solution x!")
break
if opt.gn_print_timings: print("\t\tLinear solve: {:.3f} s".format(timer() - timer_solve_start))
loss_data = torch.norm(res_data).item()
loss_total = torch.norm(res).item()
if len(convergence_info[i]["total"]):
if loss_total - convergence_info[i]["total"][-1] > self.stop_loss_diff:
print("As loss is greater than before breaking optimization")
break
convergence_info[i]["data"].append(loss_data)
convergence_info[i]["total"].append(loss_total)
# Increment the current rotation and translation.
R_inc = kornia.angle_axis_to_rotation_matrix(x[:opt_num_nodes_i*3].view(opt_num_nodes_i, 3))
t_inc = x[opt_num_nodes_i*3:].view(opt_num_nodes_i, 3, 1)
R_current = torch.matmul(R_inc, R_current)
t_current = t_current + t_inc
if num_edges_i > 0:
loss_arap = torch.norm(res_arap).item()
convergence_info[i]["arap"].append(loss_arap)
if opt.gn_debug:
if num_edges_i > 0:
print("\t\t-->Iteration: {0}. Lm:{1:.3f} Loss: \tdata = {2:.3f}, \tarap = {3:.3f}, \ttotal = {4:.3f}".format(gn_i, lm_factor,loss_data, loss_arap, loss_total))
else:
print("\t\t-->Iteration: {0}. Loss: \tdata = {1:.3f}, \ttotal = {2:.3f}".format(gn_i, loss_data, loss_total))
###############################################################################################################
# Write the solutions.
###############################################################################################################
if not ill_posed_system and torch.isfinite(res).all():
node_rotations[i, map_opt_nodes_to_complete_nodes_i, :, :] = R_current.view(opt_num_nodes_i, 3, 3)
node_translations[i, map_opt_nodes_to_complete_nodes_i, :] = t_current.view(opt_num_nodes_i, 3)
deformations_validity[i, map_opt_nodes_to_complete_nodes_i] = 1
valid_solve[i] = 1
###############################################################################################################
# Warp all valid source points using estimated deformations.
###############################################################################################################
if valid_solve[i]:
# Filter out any invalid pixel anchors, and invalid source points.
source_points_i = source_points[i].permute(1, 2, 0)
source_points_i = source_points_i[valid_correspondences_idxs[0], valid_correspondences_idxs[1], :].view(-1, 3, 1)
source_anchors_i = pixel_anchors[i, valid_correspondences_idxs[0], valid_correspondences_idxs[1], :] # (num_matches, 4)
source_weights_i = pixel_weights[i, valid_correspondences_idxs[0], valid_correspondences_idxs[1], :] # (num_matches, 4)
num_points = source_points_i.shape[0]
# Filter out points randomly, if too many are still left.
if num_points > opt.gn_max_warped_points:
sampled_idxs = torch.randperm(num_points)[:opt.gn_max_warped_points]
source_points_i = source_points_i[sampled_idxs]
source_anchors_i = source_anchors_i[sampled_idxs]
source_weights_i = source_weights_i[sampled_idxs]
num_points = opt.gn_max_warped_points
deformed_points_idxs[i] = sampled_idxs
deformed_points_subsampled[i] = 1
source_anchors_i = source_anchors_i.type(torch.int64)
# Now we deform all source points.
deformed_points_i = torch.zeros((num_points, 3, 1), dtype=x1.dtype, device=x1.device)
graph_nodes_complete_i = graph_nodes[i, :num_nodes_i, :]
R_final = node_rotations[i, :num_nodes_i, :, :].view(num_nodes_i, 3, 3)
t_final = node_translations[i, :num_nodes_i, :].view(num_nodes_i, 3, 1)
for k in range(4): # Our data uses 4 anchors for every point
node_idxs_k = source_anchors_i[:, k] # (num_points)
nodes_k = graph_nodes_complete_i[node_idxs_k].view(num_points, 3, 1) # (num_points, 3, 1)
# Compute deformed point contribution.
rotated_points_k = torch.matmul(R_final[node_idxs_k], source_points_i - nodes_k) # (num_points, 3, 1) = (num_points, 3, 3) * (num_points, 3, 1)
deformed_points_k = rotated_points_k + nodes_k + t_final[node_idxs_k]
deformed_points_i += source_weights_i[:, k].view(num_points, 1, 1).repeat(1, 3, 1) * deformed_points_k # (num_points, 3, 1)
deformed_points_i = deformed_points_i.view(num_points, 3)
# Store the results.
deformed_points_pred[i, :num_points, :] = deformed_points_i.view(1, num_points, 3)
if valid_solve[i]:
total_num_matches_per_batch += num_matches
if opt.gn_debug:
if int(valid_solve[i].cpu().numpy()):
print("\t\tValid solve ({:.3f} s)".format(timer() - timer_start))
else:
print("\t\tInvalid solve ({:.3f} s)".format(timer() - timer_start))
convergence_info[i]["valid"] = int(valid_solve[i].item())
###############################################################################################################
# We invalidate complete batch if we have too many matches in total (otherwise backprop crashes)
###############################################################################################################
if not evaluate and total_num_matches_per_batch > opt.gn_max_matches_train_per_batch:
print("\t\tSolver failed: Too many matches per batch: {}".format(total_num_matches_per_batch))
for i in range(batch_size):
convergence_info[i]["errors"].append("Solver failed: Too many matches per batch: {}".format(total_num_matches_per_batch))
valid_solve[i] = 0
return {
"flow_data": [flow2, flow3, flow4, flow5, flow6],
"node_rotations": node_rotations,
"node_translations": node_translations,
"deformations_validity": deformations_validity,
"deformed_points_pred": deformed_points_pred,
"valid_solve": valid_solve,
"mask_pred": mask_pred,
"correspondence_info": {
"xy_coords_warped":xy_coords_warped,
"source_points":source_points,
"valid_source_points":valid_source_points,
"target_matches":target_matches,
"valid_target_matches":valid_target_matches,
"valid_correspondences":valid_correspondences,
"deformed_points_idxs":deformed_points_idxs,
"deformed_points_subsampled":deformed_points_subsampled
},
"convergence_info": convergence_info,
"weight_info": weight_info
} | [
1,
529,
9507,
29958,
4299,
29914,
4299,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
10876,
29892,
359,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
12655,
408,
7442,
13,
3166,
931,
277,
1053,
2322,
29918,
20404,
408,
12237,
13,
5215,
5844,
13,
5215,
413,
1398,
423,
13,
3166,
931,
277,
1053,
2322,
29918,
20404,
408,
12237,
13,
3166,
13677,
1053,
3826,
3039,
13,
5215,
3987,
408,
3523,
13,
5215,
3667,
29879,
29889,
1972,
408,
2346,
13,
3166,
3667,
29879,
29889,
15755,
13239,
1053,
1207,
29918,
20580,
29918,
29906,
29881,
29892,
1207,
29918,
14340,
29883,
744,
29918,
29906,
29881,
29892,
1207,
29918,
3204,
7052,
29918,
29906,
29881,
29892,
2538,
7445,
29906,
29881,
29892,
27486,
13,
3166,
1904,
1053,
282,
29893,
29883,
1212,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
10272,
29918,
29886,
15711,
29918,
14588,
943,
29918,
479,
2631,
293,
408,
10272,
29918,
29886,
15711,
29918,
14588,
943,
29918,
479,
2631,
293,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
10272,
29918,
29886,
15711,
29918,
14588,
943,
29918,
29872,
27511,
408,
10272,
29918,
29886,
15711,
29918,
14588,
943,
29918,
29872,
27511,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
10272,
29918,
4467,
29882,
29918,
3166,
29918,
19488,
408,
10272,
29918,
4467,
29882,
29918,
3166,
29918,
19488,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
604,
356,
29918,
4467,
29882,
408,
604,
356,
29918,
4467,
29882,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
4559,
29918,
18010,
408,
4559,
29918,
18010,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
10272,
29918,
287,
2710,
29918,
479,
2631,
293,
408,
10272,
29918,
287,
2710,
29918,
479,
2631,
293,
29918,
29883,
13,
3166,
2448,
3631,
29940,
13079,
3032,
29907,
1053,
10272,
29918,
287,
2710,
29918,
29872,
27511,
408,
10272,
29918,
287,
2710,
29918,
29872,
27511,
29918,
29883,
13,
13,
13,
1990,
341,
1278,
6779,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
7876,
29918,
29900,
353,
29871,
29896,
29953,
13,
4706,
1583,
29889,
2080,
29918,
9144,
353,
7876,
29918,
29900,
718,
29871,
29953,
334,
29871,
29906,
13,
4706,
7876,
29918,
29896,
353,
29871,
29896,
29953,
13,
13,
4706,
1583,
29889,
786,
20580,
29896,
353,
4842,
305,
29889,
15755,
29889,
1168,
29894,
4300,
4220,
29906,
29881,
29898,
262,
29918,
305,
12629,
29922,
29945,
29953,
29945,
29892,
1678,
714,
29918,
305,
12629,
29922,
29906,
29930,
9144,
29918,
29900,
29892,
8466,
29918,
2311,
29922,
29946,
29892,
380,
2426,
29922,
29906,
29892,
7164,
29922,
29896,
29897,
13,
4706,
1583,
29889,
786,
20580,
29906,
353,
4842,
305,
29889,
15755,
29889,
1168,
29894,
4300,
4220,
29906,
29881,
29898,
262,
29918,
305,
12629,
29922,
29906,
29930,
9144,
29918,
29900,
29892,
714,
29918,
305,
12629,
29922,
9144,
29918,
29900,
29892,
259,
8466,
29918,
2311,
29922,
29946,
29892,
380,
2426,
29922,
29906,
29892,
7164,
29922,
29896,
29897,
13,
13,
4706,
565,
3523,
29889,
1509,
29918,
16175,
29918,
12324,
29901,
13,
9651,
2888,
29918,
16175,
29918,
12324,
353,
4842,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
13,
4706,
1683,
29901,
13,
9651,
2888,
29918,
16175,
29918,
12324,
353,
27486,
13,
13,
4706,
1583,
29889,
4299,
353,
302,
29876,
29889,
16941,
2556,
29898,
13,
9651,
1207,
29918,
20580,
29918,
29906,
29881,
29898,
1311,
29889,
2080,
29918,
9144,
29892,
7876,
29918,
29896,
29892,
302,
29918,
1271,
29879,
29922,
29896,
29892,
4226,
2133,
29922,
6341,
29918,
16175,
29918,
12324,
511,
29871,
13,
9651,
2538,
7445,
29906,
29881,
29898,
9144,
29918,
29896,
29892,
4226,
2133,
29922,
6341,
29918,
16175,
29918,
12324,
511,
13,
9651,
2538,
7445,
29906,
29881,
29898,
9144,
29918,
29896,
29892,
4226,
2133,
29922,
6341,
29918,
16175,
29918,
12324,
511,
13,
9651,
2538,
7445,
29906,
29881,
29898,
9144,
29918,
29896,
29892,
4226,
2133,
29922,
6341,
29918,
16175,
29918,
12324,
511,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
9144,
29918,
29896,
29892,
29871,
29896,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
7164,
29922,
29896,
511,
13,
9651,
4842,
305,
29889,
15755,
29889,
29903,
335,
29885,
3398,
580,
13,
4706,
1723,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
5680,
29892,
921,
1125,
13,
4706,
396,
4367,
24551,
1353,
310,
18196,
322,
24081,
29883,
744,
304,
9939,
10104,
13,
4706,
5680,
353,
1583,
29889,
786,
20580,
29896,
29898,
22100,
29897,
13,
4706,
5680,
353,
1583,
29889,
786,
20580,
29906,
29898,
22100,
29897,
13,
13,
4706,
921,
353,
4842,
305,
29889,
4117,
4197,
22100,
29892,
921,
1402,
29871,
29896,
29897,
13,
4706,
4974,
921,
29889,
12181,
29961,
29896,
29962,
1275,
1583,
29889,
2080,
29918,
9144,
13,
13,
4706,
736,
1583,
29889,
4299,
29898,
29916,
29897,
13,
13,
13,
1990,
22985,
13296,
369,
29931,
29965,
29898,
7345,
305,
29889,
1300,
468,
3665,
29889,
6678,
1125,
13,
1678,
9995,
13,
1678,
365,
29965,
5608,
899,
369,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6375,
29898,
13073,
29892,
319,
29892,
289,
1125,
13,
4706,
319,
29918,
29931,
29965,
29892,
282,
440,
1862,
353,
4842,
305,
29889,
6092,
29898,
29909,
29897,
13,
4706,
921,
353,
4842,
305,
29889,
6092,
29918,
2929,
345,
29898,
29890,
29892,
319,
29918,
29931,
29965,
29892,
282,
440,
1862,
29897,
13,
13,
4706,
12893,
29889,
7620,
29918,
1454,
29918,
1627,
1328,
29898,
29909,
29918,
29931,
29965,
29892,
282,
440,
1862,
29892,
921,
29897,
13,
308,
13,
4706,
736,
921,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1250,
1328,
29898,
13073,
29892,
4656,
29918,
29916,
1125,
13,
4706,
319,
29918,
29931,
29965,
29892,
282,
440,
1862,
29892,
921,
353,
12893,
29889,
17314,
29918,
29873,
575,
943,
13,
13,
4706,
396,
5792,
29901,
13,
4706,
396,
319,
334,
4656,
29918,
29890,
353,
4656,
29918,
29916,
13,
4706,
396,
4656,
29918,
29909,
353,
448,
5105,
29918,
29890,
334,
921,
29985,
29911,
13,
13,
4706,
4656,
29918,
29890,
353,
4842,
305,
29889,
6092,
29918,
2929,
345,
29898,
5105,
29918,
29916,
29892,
319,
29918,
29931,
29965,
29892,
282,
440,
1862,
29897,
13,
4706,
4656,
29918,
29909,
353,
448,
7345,
305,
29889,
2922,
16109,
29898,
5105,
29918,
29890,
29892,
921,
29889,
1493,
29898,
29896,
29892,
448,
29896,
876,
13,
308,
13,
4706,
736,
4656,
29918,
29909,
29892,
4656,
29918,
29890,
13,
13,
13,
1990,
897,
689,
6779,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
5138,
29918,
1949,
29918,
1524,
353,
29871,
29896,
29900,
13,
4706,
1583,
29889,
5138,
29918,
1272,
29918,
1731,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
4706,
1583,
29889,
5138,
29918,
1272,
29918,
19488,
353,
29871,
29896,
29889,
29900,
13,
4706,
1583,
29889,
5138,
29918,
279,
481,
353,
29871,
29896,
29889,
29900,
13,
4706,
1583,
29889,
5138,
29918,
21457,
29918,
19790,
353,
29871,
29900,
29889,
29896,
13,
13,
4706,
396,
20693,
326,
3950,
8465,
363,
1405,
29871,
29941,
24372,
29889,
9626,
15833,
338,
304,
5040,
2767,
338,
6410,
16415,
491,
29871,
29896,
13,
4706,
1583,
29889,
9847,
29918,
6758,
29918,
12765,
353,
29871,
29896,
13,
13,
4706,
396,
20693,
936,
4972,
3564,
13,
4706,
1583,
29889,
1731,
29918,
1212,
353,
282,
29893,
29883,
1212,
29889,
29925,
29956,
29907,
6779,
580,
13,
4706,
565,
3523,
29889,
9021,
911,
29918,
3670,
936,
29918,
1731,
29918,
1212,
29901,
13,
9651,
396,
12362,
911,
13,
9651,
363,
1828,
297,
1583,
29889,
1731,
29918,
1212,
29889,
16744,
7295,
13,
18884,
1828,
29889,
276,
339,
2658,
29918,
5105,
353,
7700,
13,
13,
4706,
396,
1334,
523,
18988,
3564,
13,
4706,
1583,
29889,
13168,
29918,
1212,
353,
341,
1278,
6779,
580,
13,
4706,
565,
3523,
29889,
9021,
911,
29918,
13168,
29918,
1212,
29901,
13,
9651,
396,
12362,
911,
13,
9651,
363,
1828,
297,
1583,
29889,
13168,
29918,
1212,
29889,
16744,
7295,
13,
18884,
1828,
29889,
276,
339,
2658,
29918,
5105,
353,
7700,
13,
13,
4706,
9649,
29918,
517,
29918,
26050,
29893,
29918,
2922,
29918,
9302,
353,
7442,
29889,
2378,
4197,
13,
9651,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
9651,
518,
29900,
29892,
29871,
29900,
29892,
448,
29896,
1402,
13,
9651,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
13,
9651,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1402,
13,
9651,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
9651,
21069,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
9651,
518,
29900,
29892,
448,
29896,
29892,
29871,
29900,
1402,
13,
9651,
518,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
9651,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
21251,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
4706,
1583,
29889,
2003,
29918,
517,
29918,
26050,
29893,
29918,
2922,
353,
4842,
305,
29889,
3166,
29918,
23749,
29898,
2003,
29918,
517,
29918,
26050,
29893,
29918,
2922,
29918,
9302,
467,
517,
877,
29883,
6191,
1495,
13,
13,
13,
13,
1678,
822,
6375,
29898,
13,
4706,
1583,
29892,
921,
29896,
29892,
921,
29906,
29892,
29871,
13,
4706,
3983,
29918,
18010,
29892,
3983,
29918,
287,
2710,
29892,
3983,
29918,
287,
2710,
29918,
705,
5861,
29892,
3983,
29918,
695,
504,
414,
29892,
13,
4706,
15526,
29918,
14588,
943,
29892,
15526,
29918,
705,
5861,
29892,
29871,
13,
4706,
954,
29918,
18010,
29918,
2003,
29892,
11158,
1144,
1199,
29892,
29871,
13,
4706,
14707,
29922,
8824,
29892,
6219,
543,
14968,
613,
29871,
13,
4706,
12379,
29918,
5450,
29922,
8516,
29892,
16304,
29918,
3286,
29922,
8516,
13,
268,
1125,
13,
4706,
9853,
29918,
2311,
353,
921,
29896,
29889,
12181,
29961,
29900,
29962,
13,
13,
4706,
1967,
29918,
2103,
353,
921,
29896,
29889,
12181,
29961,
29941,
29962,
13,
4706,
1967,
29918,
3545,
353,
921,
29896,
29889,
12181,
29961,
29906,
29962,
13,
13,
4706,
17221,
29918,
3888,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
16175,
29918,
2311,
1125,
13,
9651,
17221,
29918,
3888,
29889,
4397,
3319,
13,
18884,
376,
7827,
1115,
19997,
13,
18884,
376,
279,
481,
1115,
19997,
13,
18884,
376,
1272,
1115,
19997,
13,
18884,
376,
16122,
29918,
20326,
1115,
19997,
13,
18884,
376,
3084,
1115,
29871,
29900,
29892,
13,
18884,
376,
12523,
1115,
5159,
13,
9651,
5615,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
11796,
29872,
20619,
4972,
515,
2752,
304,
3646,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
4972,
29906,
29892,
4972,
29941,
29892,
4972,
29946,
29892,
4972,
29945,
29892,
4972,
29953,
29892,
5680,
29906,
353,
1583,
29889,
1731,
29918,
1212,
29889,
11333,
29898,
29916,
29896,
7503,
29892,
29901,
29941,
29892,
29901,
29892,
29901,
1402,
921,
29906,
7503,
29892,
29901,
29941,
29892,
29901,
29892,
29901,
2314,
13,
308,
13,
4706,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
1731,
29906,
467,
497,
580,
13,
4706,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
22100,
29906,
467,
497,
580,
13,
308,
13,
4706,
4972,
353,
29871,
29906,
29900,
29889,
29900,
334,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
1639,
3733,
403,
29898,
2080,
29922,
1731,
29906,
29892,
2159,
7607,
3027,
29918,
3545,
29892,
1967,
29918,
2103,
511,
4464,
2433,
18152,
457,
279,
742,
7595,
29918,
29883,
1398,
414,
29922,
8824,
29897,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
25455,
3983,
848,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
954,
29918,
18010,
29918,
7827,
353,
3983,
29918,
18010,
29889,
12181,
29961,
29896,
29962,
13,
4706,
954,
29918,
484,
1141,
29890,
943,
353,
3983,
29918,
287,
2710,
29889,
12181,
29961,
29906,
29962,
13,
13,
4706,
396,
1334,
5251,
591,
2337,
671,
29871,
29946,
20471,
23791,
943,
29889,
13,
4706,
4974,
15526,
29918,
14588,
943,
29889,
12181,
29961,
29941,
29962,
1275,
29871,
29946,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
2401,
368,
20619,
4972,
304,
1370,
29886,
278,
2752,
3291,
304,
3646,
3515,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
921,
29918,
1111,
4339,
353,
4842,
305,
29889,
279,
927,
29898,
3027,
29918,
2103,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
467,
6948,
802,
29872,
911,
29898,
29900,
467,
18837,
29898,
3027,
29918,
3545,
29892,
1967,
29918,
2103,
467,
6948,
802,
29872,
911,
29898,
29900,
29897,
13,
4706,
343,
29918,
1111,
4339,
353,
4842,
305,
29889,
279,
927,
29898,
3027,
29918,
3545,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
467,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
29898,
3027,
29918,
3545,
29892,
1967,
29918,
2103,
467,
6948,
802,
29872,
911,
29898,
29900,
29897,
13,
13,
4706,
921,
29891,
29918,
1111,
4339,
353,
4842,
305,
29889,
4117,
4197,
29916,
29918,
1111,
4339,
29892,
343,
29918,
1111,
4339,
1402,
29871,
29900,
29897,
13,
4706,
921,
29891,
29918,
1111,
4339,
353,
921,
29891,
29918,
1111,
4339,
29889,
6948,
802,
29872,
911,
29898,
29900,
467,
14358,
29898,
16175,
29918,
2311,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
396,
313,
5824,
29892,
29871,
29906,
29892,
29871,
29946,
29946,
29947,
29892,
29871,
29953,
29946,
29900,
29897,
13,
13,
4706,
396,
2401,
368,
278,
4972,
304,
15526,
10350,
29889,
13,
4706,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
353,
921,
29891,
29918,
1111,
4339,
718,
4972,
13,
4706,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
353,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
29889,
16513,
580,
13,
13,
4706,
396,
21981,
675,
304,
367,
1546,
448,
29896,
29892,
322,
29871,
29896,
29889,
13,
4706,
396,
4001,
591,
671,
376,
2520,
29918,
29883,
1398,
414,
29922,
8824,
613,
278,
24371,
310,
11155,
17036,
13,
4706,
396,
526,
448,
29896,
322,
29871,
29896,
29892,
451,
1009,
1644,
414,
29889,
13,
4706,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
7503,
29892,
29900,
29892,
29901,
29892,
17531,
353,
313,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
7503,
29892,
29900,
29892,
29901,
29892,
29901,
2314,
847,
313,
3027,
29918,
2103,
448,
29871,
29896,
29897,
13,
4706,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
7503,
29892,
29896,
29892,
29901,
29892,
17531,
353,
313,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
7503,
29892,
29896,
29892,
29901,
29892,
29901,
2314,
847,
313,
3027,
29918,
3545,
448,
29871,
29896,
29897,
13,
4706,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
353,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
334,
29871,
29906,
448,
29871,
29896,
13,
13,
4706,
396,
20894,
1082,
278,
1370,
9795,
10350,
304,
6216,
278,
6856,
29918,
11249,
3402,
29889,
13,
4706,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
353,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
29889,
17858,
1082,
29898,
29900,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
4706,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
1281,
4984,
1298,
29899,
517,
29899,
3149,
3928,
2063,
1546,
2752,
529,
976,
3646,
3291,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
341,
1278,
714,
8340,
2752,
3291,
29889,
13,
4706,
2752,
29918,
9748,
353,
921,
29896,
7503,
29892,
29871,
29941,
29901,
29892,
584,
29892,
584,
1822,
16513,
580,
13,
4706,
2752,
29918,
25367,
29918,
3084,
537,
353,
4842,
305,
29889,
497,
29898,
29886,
15711,
29918,
14588,
943,
6736,
29871,
29900,
29889,
29900,
29892,
3964,
29922,
29941,
29897,
965,
13,
13,
4706,
396,
21029,
3646,
3291,
472,
15712,
15526,
14354,
29889,
13,
4706,
3646,
29918,
9748,
353,
921,
29906,
7503,
29892,
29871,
29941,
29901,
29892,
584,
29892,
584,
1822,
16513,
580,
13,
4706,
3646,
29918,
20317,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
7720,
29918,
11249,
29898,
13,
9651,
3646,
29918,
9748,
29892,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
29892,
4464,
29922,
3670,
29889,
5138,
29918,
19488,
29918,
13445,
10335,
29918,
8513,
29892,
7164,
29918,
8513,
2433,
3298,
359,
742,
7595,
29918,
29883,
1398,
414,
29922,
8824,
13,
4706,
1723,
13,
13,
4706,
396,
1334,
4175,
714,
738,
10452,
7087,
29892,
988,
738,
310,
278,
29871,
29946,
17036,
338,
8340,
29889,
13,
4706,
3646,
29918,
3084,
537,
353,
5135,
5182,
29918,
9748,
1405,
29871,
29900,
29889,
29900,
29897,
669,
313,
5182,
29918,
9748,
5277,
3523,
29889,
5138,
29918,
3317,
29918,
19488,
8106,
1853,
29898,
7345,
305,
29889,
7411,
29941,
29906,
29897,
13,
4706,
3646,
29918,
20317,
29918,
3084,
537,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
7720,
29918,
11249,
29898,
13,
9651,
3646,
29918,
3084,
537,
29892,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
29892,
4464,
543,
18152,
457,
279,
613,
7164,
29918,
8513,
2433,
3298,
359,
742,
7595,
29918,
29883,
1398,
414,
29922,
8824,
13,
4706,
1723,
13,
4706,
3646,
29918,
20317,
29918,
3084,
537,
353,
3646,
29918,
20317,
29918,
3084,
537,
7503,
29892,
29871,
29906,
29892,
584,
29892,
584,
29962,
6736,
29871,
29900,
29889,
29929,
29929,
29929,
13,
13,
4706,
396,
349,
3445,
598,
11105,
29879,
363,
1716,
2854,
2752,
3291,
322,
3646,
7087,
13,
4706,
2854,
29918,
4993,
29918,
9748,
29871,
353,
313,
4993,
29918,
9748,
7503,
29892,
29871,
29906,
29892,
584,
29892,
584,
29962,
1405,
29871,
29900,
29889,
29900,
29897,
29871,
669,
313,
4993,
29918,
9748,
7503,
29892,
29871,
29906,
29892,
584,
29892,
584,
29962,
5277,
3523,
29889,
5138,
29918,
3317,
29918,
19488,
29897,
29871,
669,
2752,
29918,
25367,
29918,
3084,
537,
13,
4706,
2854,
29918,
5182,
29918,
20317,
353,
313,
5182,
29918,
20317,
7503,
29892,
29871,
29906,
29892,
584,
29892,
584,
29962,
1405,
29871,
29900,
29889,
29900,
29897,
669,
313,
5182,
29918,
20317,
7503,
29892,
29871,
29906,
29892,
584,
29892,
584,
29962,
5277,
3523,
29889,
5138,
29918,
3317,
29918,
19488,
29897,
669,
3646,
29918,
20317,
29918,
3084,
537,
13,
13,
4706,
396,
349,
3445,
598,
278,
1881,
310,
1716,
278,
341,
1278,
6779,
322,
6212,
2509,
6779,
29892,
565,
591,
2869,
671,
2845,
310,
963,
13,
4706,
565,
3523,
29889,
1509,
29918,
13168,
29901,
13,
9651,
3646,
29918,
23973,
353,
921,
29906,
7503,
29892,
584,
29941,
29892,
584,
29892,
584,
1822,
16513,
580,
13,
9651,
3646,
29918,
23973,
29918,
4495,
9795,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
7720,
29918,
11249,
29898,
5182,
29918,
23973,
29892,
921,
29891,
29918,
1111,
4339,
29918,
4495,
9795,
29892,
7164,
29918,
8513,
2433,
3298,
359,
742,
7595,
29918,
29883,
1398,
414,
29922,
8824,
29897,
13,
13,
9651,
11105,
29918,
2080,
353,
4842,
305,
29889,
4117,
4197,
29916,
29896,
29892,
3646,
29918,
23973,
29918,
4495,
9795,
29892,
3646,
29918,
20317,
1402,
29871,
29896,
29897,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
341,
1278,
6779,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
1334,
8500,
3928,
663,
18177,
518,
29900,
29892,
29871,
29896,
1402,
565,
591,
671,
11105,
3564,
29889,
13,
4706,
11105,
29918,
11965,
353,
6213,
13,
4706,
565,
3523,
29889,
1509,
29918,
13168,
29901,
13,
9651,
11105,
29918,
11965,
353,
1583,
29889,
13168,
29918,
1212,
29898,
22100,
29906,
29892,
11105,
29918,
2080,
467,
1493,
29898,
16175,
29918,
2311,
29892,
1967,
29918,
3545,
29892,
1967,
29918,
2103,
29897,
13,
9651,
396,
11105,
29918,
11965,
7503,
29892,
29901,
29892,
17531,
353,
29871,
29896,
29889,
29900,
13,
9651,
396,
1596,
29898,
13168,
29918,
11965,
29897,
13,
13,
4706,
396,
11796,
29872,
11105,
310,
2854,
3928,
2063,
13,
4706,
2854,
29918,
2616,
3636,
2063,
353,
2854,
29918,
4993,
29918,
9748,
669,
2854,
29918,
5182,
29918,
20317,
13,
13,
4706,
396,
25455,
3928,
663,
18177,
411,
29871,
29896,
29915,
29879,
29889,
1334,
1795,
26556,
963,
411,
341,
1278,
6779,
29899,
11965,
18186,
18177,
2446,
13,
4706,
3928,
663,
29918,
705,
5861,
353,
4842,
305,
29889,
2873,
29898,
3084,
29918,
5182,
29918,
20317,
29889,
12181,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
3084,
29918,
5182,
29918,
20317,
29889,
10141,
29897,
13,
13,
4706,
396,
1334,
8340,
403,
3646,
7087,
2678,
29892,
746,
591,
3566,
263,
7688,
304,
1269,
1993,
29889,
13,
4706,
565,
3523,
29889,
1509,
29918,
13168,
29901,
13,
9651,
3928,
663,
29918,
705,
5861,
353,
11105,
29918,
11965,
13,
632,
13,
9651,
565,
14707,
29901,
13,
18884,
396,
10999,
16897,
13,
18884,
565,
3523,
29889,
386,
12268,
29918,
13168,
29918,
27711,
1080,
29901,
13,
462,
1678,
3928,
663,
29918,
705,
5861,
353,
4842,
305,
29889,
3062,
29898,
13168,
29918,
11965,
529,
3523,
29889,
386,
12268,
29892,
4842,
305,
29889,
3298,
359,
29918,
4561,
29898,
13168,
29918,
11965,
511,
11105,
29918,
11965,
29897,
13,
13,
18884,
396,
349,
905,
29899,
3538,
16897,
13,
18884,
25342,
3523,
29889,
5041,
3538,
29918,
386,
12268,
29918,
13168,
29918,
27711,
1080,
29901,
13,
462,
1678,
772,
29877,
839,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
3317,
29918,
10109,
29906,
29881,
29898,
2080,
29922,
13168,
29918,
11965,
29892,
8466,
29918,
2311,
29922,
3670,
29889,
5041,
29918,
2311,
29892,
380,
2426,
29922,
3670,
29889,
5041,
29918,
2311,
29897,
13,
462,
1678,
772,
29877,
839,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
1639,
3733,
403,
29898,
2080,
29922,
1129,
29877,
839,
29889,
6948,
802,
29872,
911,
29898,
29896,
511,
2159,
7607,
3670,
29889,
3027,
29918,
3545,
29892,
3523,
29889,
3027,
29918,
2103,
511,
4464,
2433,
28502,
342,
2824,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
462,
1678,
4629,
353,
313,
7345,
305,
29889,
6897,
29898,
13168,
29918,
11965,
448,
772,
29877,
839,
29897,
5277,
29871,
29896,
29872,
29899,
29947,
467,
1853,
29898,
7345,
305,
29889,
7411,
29941,
29906,
29897,
29871,
13,
13,
462,
1678,
3928,
663,
29918,
705,
5861,
353,
11105,
29918,
11965,
334,
4629,
396,
29930,
3523,
29889,
5041,
29918,
2311,
1068,
29906,
13,
13,
4706,
954,
29918,
3084,
29918,
2616,
3636,
2063,
353,
4842,
305,
29889,
2083,
29898,
3084,
29918,
2616,
3636,
2063,
29892,
3964,
7607,
29896,
29892,
29871,
29906,
876,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
25455,
3983,
848,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
954,
29918,
18010,
29918,
7827,
353,
3983,
29918,
18010,
29889,
12181,
29961,
29896,
29962,
13,
4706,
954,
29918,
484,
1141,
29890,
943,
353,
3983,
29918,
287,
2710,
29889,
12181,
29961,
29906,
29962,
13,
13,
4706,
396,
1334,
5251,
591,
2337,
671,
29871,
29946,
20471,
23791,
943,
29889,
13,
4706,
4974,
15526,
29918,
14588,
943,
29889,
12181,
29961,
29941,
29962,
1275,
29871,
29946,
13,
13,
4706,
2943,
29918,
5450,
800,
353,
4842,
305,
29889,
1032,
29872,
29898,
29941,
29892,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
467,
1493,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
29892,
29871,
29941,
467,
14358,
29898,
16175,
29918,
2311,
29892,
954,
29918,
18010,
29918,
7827,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
2943,
29918,
3286,
29880,
800,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
29892,
954,
29918,
18010,
29918,
7827,
29892,
29871,
29941,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
4706,
316,
689,
800,
29918,
3084,
537,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
29892,
954,
29918,
18010,
29918,
7827,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
4706,
2854,
29918,
2929,
345,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
511,
26688,
29922,
7345,
305,
29889,
13470,
29947,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
4706,
316,
15628,
29918,
9748,
29918,
11965,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
29892,
3523,
29889,
5138,
29918,
3317,
29918,
4495,
9795,
29918,
9748,
29892,
29871,
29941,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
4706,
316,
15628,
29918,
9748,
29918,
333,
10351,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
29892,
3523,
29889,
5138,
29918,
3317,
29918,
4495,
9795,
29918,
9748,
511,
26688,
29922,
7345,
305,
29889,
524,
29953,
29946,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
4706,
316,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
353,
4842,
305,
29889,
3298,
359,
3552,
16175,
29918,
2311,
511,
26688,
29922,
7345,
305,
29889,
13470,
29947,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
13,
4706,
396,
4971,
666,
278,
899,
369,
13,
4706,
565,
451,
14707,
322,
3523,
29889,
11014,
29918,
2929,
369,
29901,
13,
9651,
736,
426,
13,
18884,
376,
1731,
29918,
1272,
1115,
518,
1731,
29906,
29892,
4972,
29941,
29892,
4972,
29946,
29892,
4972,
29945,
29892,
4972,
29953,
1402,
29871,
13,
18884,
376,
3177,
29918,
5450,
800,
1115,
2943,
29918,
5450,
800,
29892,
13,
18884,
376,
3177,
29918,
3286,
29880,
800,
1115,
2943,
29918,
3286,
29880,
800,
29892,
13,
18884,
376,
311,
689,
800,
29918,
3084,
537,
1115,
316,
689,
800,
29918,
3084,
537,
29892,
13,
18884,
376,
311,
15628,
29918,
9748,
29918,
11965,
1115,
316,
15628,
29918,
9748,
29918,
11965,
29892,
29871,
13,
18884,
376,
3084,
29918,
2929,
345,
1115,
2854,
29918,
2929,
345,
29892,
29871,
13,
18884,
376,
13168,
29918,
11965,
1115,
11105,
29918,
11965,
29892,
13,
18884,
376,
2616,
3636,
663,
29918,
3888,
1115,
426,
13,
462,
1678,
376,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
1115,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
29892,
29871,
13,
462,
1678,
376,
4993,
29918,
9748,
1115,
4993,
29918,
9748,
29892,
13,
462,
1678,
376,
3084,
29918,
4993,
29918,
9748,
1115,
3084,
29918,
4993,
29918,
9748,
29892,
29871,
13,
462,
1678,
376,
5182,
29918,
20317,
1115,
5182,
29918,
20317,
29892,
13,
462,
1678,
376,
3084,
29918,
5182,
29918,
20317,
1115,
3084,
29918,
5182,
29918,
20317,
29892,
13,
462,
1678,
376,
3084,
29918,
2616,
3636,
2063,
1115,
8516,
29892,
29871,
13,
462,
1678,
376,
311,
15628,
29918,
9748,
29918,
333,
10351,
1115,
311,
15628,
29918,
9748,
29918,
333,
10351,
29892,
29871,
13,
462,
1678,
376,
311,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
1115,
316,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
13,
18884,
2981,
29871,
13,
18884,
376,
535,
369,
10238,
29918,
3888,
1115,
17221,
29918,
3888,
29892,
13,
18884,
376,
7915,
29918,
3888,
1115,
426,
13,
462,
1678,
376,
7827,
29918,
2616,
690,
29918,
1949,
1115,
29871,
29900,
29892,
13,
462,
1678,
376,
7827,
29918,
2616,
690,
29918,
7915,
1115,
29871,
29900,
29889,
29900,
13,
18884,
500,
13,
9651,
500,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
396,
2661,
6490,
2943,
316,
689,
800,
773,
17473,
519,
402,
11214,
29899,
4373,
880,
29889,
13,
4706,
835,
13383,
13383,
13383,
13383,
4136,
29937,
13,
4706,
3928,
2063,
29918,
28997,
353,
954,
29918,
3084,
29918,
2616,
3636,
2063,
1405,
29871,
29900,
13,
13,
4706,
3001,
29918,
1949,
29918,
20317,
29918,
546,
29918,
16175,
353,
29871,
29900,
13,
13,
4706,
7688,
29918,
3888,
353,
426,
13,
9651,
376,
7827,
29918,
2616,
690,
29918,
1949,
1115,
29871,
29900,
29892,
13,
9651,
376,
7827,
29918,
2616,
690,
29918,
7915,
1115,
29871,
29900,
29889,
29900,
13,
4706,
500,
13,
13,
4706,
1583,
29889,
2003,
29918,
517,
29918,
26050,
29893,
29918,
2922,
29889,
517,
29898,
29916,
29896,
29889,
10141,
29897,
308,
13,
13,
4706,
363,
474,
297,
3464,
29898,
16175,
29918,
2311,
1125,
13,
9651,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
18884,
1596,
580,
13,
18884,
1596,
703,
489,
17708,
613,
474,
29892,
376,
262,
9853,
489,
1159,
13,
13,
9651,
954,
29918,
18010,
29918,
29875,
353,
954,
29918,
18010,
29918,
2003,
29961,
29875,
29962,
13,
9651,
565,
954,
29918,
18010,
29918,
29875,
1405,
3523,
29889,
5138,
29918,
3317,
29918,
18010,
470,
954,
29918,
18010,
29918,
29875,
529,
3523,
29889,
5138,
29918,
1195,
29918,
18010,
29901,
29871,
13,
18884,
1596,
29898,
29888,
26732,
29873,
13296,
369,
5229,
29901,
21403,
1353,
310,
7573,
29901,
426,
1949,
29918,
18010,
29918,
29875,
1836,
2178,
20937,
12146,
4261,
426,
3670,
29889,
5138,
29918,
1195,
29918,
18010,
6177,
29912,
3670,
29889,
5138,
29918,
3317,
29918,
18010,
1836,
10726,
2943,
23746,
3443,
2645,
3983,
11265,
23157,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
29898,
29888,
29908,
13296,
369,
5229,
29901,
21403,
1353,
310,
7573,
29901,
426,
1949,
29918,
18010,
29918,
29875,
1836,
2178,
20937,
12146,
4261,
426,
3670,
29889,
5138,
29918,
1195,
29918,
18010,
6177,
29912,
3670,
29889,
5138,
29918,
3317,
29918,
18010,
1836,
10726,
2943,
23746,
3443,
2645,
3983,
11265,
23157,
13,
18884,
6773,
13,
13,
9651,
565,
451,
3928,
2063,
29918,
28997,
29961,
29875,
5387,
29871,
13,
18884,
1596,
14182,
29873,
13296,
369,
5229,
29901,
1939,
2854,
3928,
2063,
1434,
21166,
1159,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
13296,
369,
5229,
29901,
1939,
2854,
3928,
2063,
1434,
21166,
1159,
13,
18884,
6773,
13,
13,
9651,
12237,
29918,
2962,
353,
12237,
580,
13,
13,
9651,
3983,
29918,
18010,
29918,
29875,
308,
353,
3983,
29918,
18010,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29962,
632,
396,
313,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29897,
13,
9651,
3983,
29918,
287,
2710,
29918,
29875,
308,
353,
3983,
29918,
287,
2710,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29962,
632,
396,
313,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29947,
29897,
13,
9651,
3983,
29918,
287,
2710,
29918,
705,
5861,
29918,
29875,
353,
3983,
29918,
287,
2710,
29918,
705,
5861,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29962,
268,
396,
313,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29947,
29897,
13,
9651,
3983,
29918,
695,
504,
414,
29918,
29875,
418,
353,
3983,
29918,
695,
504,
414,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29962,
3986,
396,
313,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29896,
29897,
13,
13,
9651,
285,
29916,
353,
11158,
1144,
1199,
29961,
29875,
29892,
29871,
29900,
29962,
13,
9651,
285,
29891,
353,
11158,
1144,
1199,
29961,
29875,
29892,
29871,
29896,
29962,
13,
9651,
28232,
353,
11158,
1144,
1199,
29961,
29875,
29892,
29871,
29906,
29962,
13,
9651,
5094,
353,
11158,
1144,
1199,
29961,
29875,
29892,
29871,
29941,
29962,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
19916,
8340,
7087,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
353,
4842,
305,
29889,
3062,
29898,
3084,
29918,
2616,
3636,
2063,
29961,
29875,
2314,
13,
13,
9651,
2752,
29918,
9748,
29918,
4572,
287,
353,
2752,
29918,
9748,
29961,
29875,
1822,
17858,
1082,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29897,
13,
9651,
2752,
29918,
9748,
29918,
4572,
287,
353,
2752,
29918,
9748,
29918,
4572,
287,
29961,
3084,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
1822,
1493,
6278,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
632,
13,
9651,
3646,
29918,
20317,
29918,
4572,
287,
353,
3646,
29918,
20317,
29961,
29875,
1822,
17858,
1082,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29897,
13,
9651,
3646,
29918,
20317,
29918,
4572,
287,
353,
3646,
29918,
20317,
29918,
4572,
287,
29961,
3084,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
1822,
1493,
6278,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
9651,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
353,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29961,
29875,
1822,
17858,
1082,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29897,
396,
313,
3545,
29892,
2920,
29892,
29871,
29906,
29897,
13,
9651,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
353,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
29961,
3084,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
1822,
1493,
6278,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29897,
13,
13,
9651,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
353,
3928,
663,
29918,
705,
5861,
29961,
29875,
29892,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
29962,
1822,
1493,
6278,
29896,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
13,
9651,
2752,
29918,
14588,
943,
353,
15526,
29918,
14588,
943,
29961,
29875,
29892,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
29962,
396,
313,
1949,
29918,
20317,
29892,
29871,
29946,
29897,
13,
9651,
2752,
29918,
705,
5861,
353,
15526,
29918,
705,
5861,
29961,
29875,
29892,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
29962,
396,
313,
1949,
29918,
20317,
29892,
29871,
29946,
29897,
13,
13,
9651,
954,
29918,
20317,
353,
2752,
29918,
9748,
29918,
4572,
287,
29889,
12181,
29961,
29900,
29962,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
3251,
403,
7688,
5235,
304,
12678,
6588,
7688,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
7688,
29918,
3888,
353,
426,
13,
18884,
376,
7827,
29918,
2616,
690,
29918,
1949,
1115,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
29889,
12181,
29961,
29900,
1402,
13,
18884,
376,
7827,
29918,
2616,
690,
29918,
7915,
1115,
5785,
29898,
2616,
3636,
663,
29918,
705,
5861,
29918,
4572,
287,
29889,
2083,
3101,
13,
9651,
500,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
16968,
368,
1014,
11249,
7087,
29892,
565,
5181,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
565,
6219,
1275,
376,
791,
29908,
470,
6219,
1275,
376,
1688,
1115,
13,
18884,
4236,
29918,
1949,
29918,
20317,
353,
3523,
29889,
5138,
29918,
3317,
29918,
20317,
29918,
14513,
13,
9651,
25342,
6219,
1275,
376,
14968,
1115,
13,
18884,
4236,
29918,
1949,
29918,
20317,
353,
3523,
29889,
5138,
29918,
3317,
29918,
20317,
29918,
14968,
13,
9651,
1683,
29901,
13,
18884,
12020,
8960,
703,
18772,
6571,
338,
451,
3342,
1642,
4830,
29898,
5451,
876,
13,
13,
9651,
565,
954,
29918,
20317,
1405,
4236,
29918,
1949,
29918,
20317,
29901,
13,
18884,
4559,
29881,
29918,
333,
10351,
353,
4842,
305,
29889,
9502,
17858,
29898,
1949,
29918,
20317,
29897,
7503,
3317,
29918,
1949,
29918,
20317,
29962,
13,
13,
18884,
2752,
29918,
9748,
29918,
4572,
287,
3986,
353,
2752,
29918,
9748,
29918,
4572,
287,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
18884,
3646,
29918,
20317,
29918,
4572,
287,
308,
353,
3646,
29918,
20317,
29918,
4572,
287,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
18884,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
539,
353,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
18884,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
353,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
18884,
2752,
29918,
14588,
943,
462,
29871,
353,
2752,
29918,
14588,
943,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
18884,
2752,
29918,
705,
5861,
462,
29871,
353,
2752,
29918,
705,
5861,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
13,
18884,
954,
29918,
20317,
353,
4236,
29918,
1949,
29918,
20317,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
15154,
7573,
565,
1009,
6590,
24554,
1016,
29915,
29873,
505,
3307,
3928,
2063,
13,
9651,
396,
313,
12521,
3636,
2063,
393,
505,
376,
12313,
29908,
7573,
408,
23791,
943,
674,
884,
367,
6206,
29897,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
353,
1051,
29898,
3881,
29898,
29900,
29892,
954,
29918,
18010,
29918,
29875,
876,
13,
9651,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
353,
954,
29918,
18010,
29918,
29875,
13,
13,
9651,
565,
3523,
29889,
5138,
29918,
5992,
29918,
695,
504,
414,
29918,
2541,
29918,
29888,
809,
29918,
20317,
29901,
13,
18884,
2752,
29918,
14588,
943,
29918,
23749,
308,
353,
2752,
29918,
14588,
943,
29889,
16513,
2141,
21970,
2141,
23749,
580,
13,
18884,
2752,
29918,
705,
5861,
29918,
23749,
308,
353,
2752,
29918,
705,
5861,
29889,
16513,
2141,
21970,
2141,
23749,
580,
13,
13,
18884,
396,
11796,
29872,
1353,
310,
3928,
2063,
313,
272,
7087,
29897,
639,
2943,
297,
278,
883,
310,
278,
13,
18884,
396,
1993,
7688,
2533,
13,
18884,
1993,
29918,
705,
5861,
29918,
546,
29918,
3177,
353,
7442,
29889,
3298,
359,
29898,
1949,
29918,
18010,
29918,
29875,
29897,
13,
13,
18884,
396,
910,
1158,
12778,
7688,
11896,
310,
1269,
1993,
304,
278,
6590,
2943,
29892,
13,
18884,
396,
14372,
7929,
2943,
18999,
297,
278,
1652,
8606,
287,
1409,
29889,
13,
18884,
7442,
29889,
1202,
29889,
271,
29898,
4352,
29918,
705,
5861,
29918,
546,
29918,
3177,
29892,
2752,
29918,
14588,
943,
29918,
23749,
29889,
1579,
8606,
3285,
2752,
29918,
705,
5861,
29918,
23749,
29889,
1579,
8606,
3101,
13,
462,
13,
18884,
3001,
29918,
4352,
29918,
705,
5861,
353,
29871,
29900,
29889,
29900,
13,
18884,
1993,
29918,
705,
5861,
29918,
546,
29918,
19594,
353,
6571,
13,
18884,
363,
2943,
29918,
333,
297,
3464,
29898,
1949,
29918,
18010,
29918,
29875,
1125,
13,
462,
1678,
396,
3617,
2533,
310,
18177,
363,
1857,
2943,
29889,
13,
462,
1678,
1993,
29918,
705,
5861,
353,
1993,
29918,
705,
5861,
29918,
546,
29918,
3177,
29961,
3177,
29918,
333,
29962,
13,
13,
462,
1678,
396,
3617,
9867,
1178,
363,
1857,
2943,
13,
462,
1678,
9867,
29918,
333,
353,
3983,
29918,
695,
504,
414,
29918,
29875,
29961,
3177,
29918,
333,
1822,
667,
580,
13,
462,
268,
13,
462,
1678,
565,
9867,
29918,
333,
297,
1993,
29918,
705,
5861,
29918,
546,
29918,
19594,
29901,
13,
462,
4706,
1993,
29918,
705,
5861,
29918,
546,
29918,
19594,
29961,
19594,
29918,
333,
29962,
4619,
1993,
29918,
705,
5861,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1993,
29918,
705,
5861,
29918,
546,
29918,
19594,
29961,
19594,
29918,
333,
29962,
353,
1993,
29918,
705,
5861,
13,
13,
462,
1678,
3001,
29918,
4352,
29918,
705,
5861,
4619,
1993,
29918,
705,
5861,
13,
13,
18884,
396,
591,
29915,
645,
2048,
263,
11105,
393,
14422,
607,
7573,
674,
10503,
573,
13,
18884,
2854,
29918,
18010,
29918,
13168,
29918,
29875,
353,
4842,
305,
29889,
2873,
3552,
1949,
29918,
18010,
29918,
29875,
511,
26688,
29922,
7345,
305,
29889,
11227,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
13,
462,
13,
18884,
396,
565,
451,
3307,
7087,
297,
263,
9867,
29892,
2791,
599,
9867,
29915,
29879,
7573,
363,
28744,
13,
18884,
2943,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
353,
5159,
13,
18884,
363,
9867,
29918,
333,
29892,
9867,
29918,
4352,
29918,
705,
5861,
297,
1993,
29918,
705,
5861,
29918,
546,
29918,
19594,
29889,
7076,
7295,
13,
462,
1678,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
462,
4706,
1596,
877,
19594,
29918,
333,
742,
9867,
29918,
333,
29892,
9867,
29918,
4352,
29918,
705,
5861,
29897,
13,
13,
462,
1678,
565,
9867,
29918,
4352,
29918,
705,
5861,
529,
3523,
29889,
5138,
29918,
1195,
29918,
1949,
29918,
2616,
3636,
2063,
29918,
546,
29918,
19594,
29901,
13,
462,
4706,
921,
353,
4842,
305,
29889,
3062,
29898,
4262,
29918,
695,
504,
414,
29918,
29875,
1275,
9867,
29918,
333,
9601,
29900,
1822,
25027,
391,
580,
13,
462,
4706,
2943,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
4619,
921,
13,
13,
18884,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
462,
1678,
1596,
703,
3177,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
613,
2943,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
29897,
13,
13,
18884,
565,
7431,
29898,
3177,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
29897,
1405,
29871,
29900,
29901,
13,
462,
1678,
396,
4485,
8340,
7573,
13,
462,
1678,
2854,
29918,
18010,
29918,
13168,
29918,
29875,
29961,
3177,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
29962,
353,
7700,
13,
13,
462,
1678,
396,
4813,
407,
871,
7573,
322,
12770,
363,
2854,
7573,
13,
462,
1678,
3983,
29918,
18010,
29918,
29875,
308,
353,
3983,
29918,
18010,
29918,
29875,
29961,
3084,
29918,
18010,
29918,
13168,
29918,
29875,
29889,
29879,
802,
29872,
911,
580,
29962,
13,
462,
1678,
3983,
29918,
287,
2710,
29918,
29875,
308,
353,
3983,
29918,
287,
2710,
29918,
29875,
29961,
3084,
29918,
18010,
29918,
13168,
29918,
29875,
29889,
29879,
802,
29872,
911,
580,
29962,
29871,
13,
462,
1678,
3983,
29918,
287,
2710,
29918,
705,
5861,
29918,
29875,
353,
3983,
29918,
287,
2710,
29918,
705,
5861,
29918,
29875,
29961,
3084,
29918,
18010,
29918,
13168,
29918,
29875,
29889,
29879,
802,
29872,
911,
580,
29962,
29871,
13,
13,
462,
1678,
396,
10318,
1353,
310,
7573,
13,
462,
1678,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
353,
3983,
29918,
18010,
29918,
29875,
29889,
12181,
29961,
29900,
29962,
13,
13,
462,
1678,
396,
3617,
11105,
310,
3928,
2063,
363,
607,
738,
697,
310,
1009,
23791,
943,
338,
385,
8340,
2943,
13,
462,
1678,
2854,
29918,
2616,
13713,
29918,
13168,
353,
4842,
305,
29889,
2873,
3552,
1949,
29918,
20317,
511,
26688,
29922,
7345,
305,
29889,
11227,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
13,
462,
1678,
363,
2943,
29918,
333,
29918,
1454,
29918,
1745,
10611,
297,
2943,
29918,
4841,
29918,
1454,
29918,
1745,
10611,
29901,
13,
462,
4706,
2854,
29918,
2616,
13713,
29918,
13168,
353,
2854,
29918,
2616,
13713,
29918,
13168,
669,
4842,
305,
29889,
497,
29898,
4993,
29918,
14588,
943,
2804,
2943,
29918,
333,
29918,
1454,
29918,
1745,
10611,
29892,
9685,
29922,
29896,
29897,
13,
13,
462,
1678,
2752,
29918,
9748,
29918,
4572,
287,
965,
353,
2752,
29918,
9748,
29918,
4572,
287,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
462,
1678,
3646,
29918,
20317,
29918,
4572,
287,
3986,
353,
3646,
29918,
20317,
29918,
4572,
287,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
462,
1678,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
4706,
353,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
462,
1678,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
29871,
353,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
462,
1678,
2752,
29918,
14588,
943,
462,
259,
353,
2752,
29918,
14588,
943,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
462,
1678,
2752,
29918,
705,
5861,
462,
259,
353,
2752,
29918,
705,
5861,
29961,
3084,
29918,
2616,
13713,
29918,
13168,
29962,
13,
13,
462,
1678,
954,
29918,
20317,
353,
2752,
29918,
9748,
29918,
4572,
287,
29889,
12181,
29961,
29900,
29962,
13,
13,
462,
1678,
396,
10318,
2943,
29918,
4841,
297,
12770,
322,
23791,
943,
491,
10417,
2030,
16285,
304,
716,
16285,
13,
462,
1678,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
353,
5159,
13,
462,
1678,
2943,
29918,
2798,
353,
29871,
29900,
13,
462,
1678,
363,
2943,
29918,
333,
29892,
338,
29918,
3177,
29918,
3084,
297,
26985,
29898,
3084,
29918,
18010,
29918,
13168,
29918,
29875,
1125,
13,
462,
4706,
565,
338,
29918,
3177,
29918,
3084,
29901,
13,
462,
9651,
3983,
29918,
287,
2710,
29918,
29875,
29961,
4262,
29918,
287,
2710,
29918,
29875,
1275,
2943,
29918,
333,
29962,
268,
353,
2943,
29918,
2798,
13,
462,
9651,
2752,
29918,
14588,
943,
29961,
4993,
29918,
14588,
943,
1275,
2943,
29918,
333,
29962,
259,
353,
2943,
29918,
2798,
13,
462,
9651,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29889,
4397,
29898,
3177,
29918,
333,
29897,
13,
462,
9651,
2943,
29918,
2798,
4619,
29871,
29896,
13,
462,
268,
13,
9651,
565,
954,
29918,
20317,
1275,
29871,
29900,
29901,
29871,
13,
18884,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
462,
1678,
1596,
14182,
29873,
13296,
369,
5229,
29901,
1939,
2854,
3928,
2063,
1159,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
13296,
369,
5229,
29901,
1939,
2854,
3928,
2063,
1156,
21166,
1159,
13,
18884,
6773,
13,
13,
9651,
565,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
1405,
3523,
29889,
5138,
29918,
3317,
29918,
18010,
470,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
529,
3523,
29889,
5138,
29918,
1195,
29918,
18010,
29901,
13,
18884,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
462,
1678,
1596,
29898,
29888,
26732,
29873,
13296,
369,
5229,
29901,
21403,
1353,
310,
7573,
29901,
426,
1949,
29918,
18010,
29918,
29875,
1836,
2178,
20937,
12146,
4261,
426,
3670,
29889,
5138,
29918,
1195,
29918,
18010,
6177,
29912,
3670,
29889,
5138,
29918,
3317,
29918,
18010,
1836,
10726,
2943,
23746,
3443,
2645,
3983,
11265,
23157,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
29898,
29888,
29908,
13296,
369,
5229,
29901,
21403,
1353,
310,
7573,
29901,
426,
1949,
29918,
18010,
29918,
29875,
1836,
2178,
20937,
12146,
4261,
426,
3670,
29889,
5138,
29918,
1195,
29918,
18010,
6177,
29912,
3670,
29889,
5138,
29918,
3317,
29918,
18010,
1836,
10726,
2943,
23746,
3443,
2645,
3983,
11265,
23157,
13,
18884,
6773,
13,
13,
9651,
396,
4001,
2752,
17360,
18999,
817,
304,
367,
1472,
297,
1797,
304,
367,
1304,
408,
16285,
29892,
13,
9651,
396,
591,
817,
304,
3588,
963,
29889,
13,
9651,
4974,
4842,
305,
29889,
497,
29898,
4993,
29918,
14588,
943,
6736,
29871,
29900,
29897,
13,
9651,
2752,
29918,
14588,
943,
353,
2752,
29918,
14588,
943,
29889,
1853,
29898,
7345,
305,
29889,
524,
29953,
29946,
29897,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
19916,
8340,
12770,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
2943,
29918,
4841,
353,
4842,
305,
29889,
279,
927,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
26688,
29922,
7345,
305,
29889,
524,
29941,
29906,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
467,
1493,
6278,
29896,
29892,
29871,
29896,
467,
14358,
29898,
29896,
29892,
954,
29918,
484,
1141,
29890,
943,
29897,
396,
313,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
954,
29918,
484,
1141,
29890,
943,
29897,
13,
9651,
3983,
29918,
12864,
29918,
29886,
7121,
353,
4842,
305,
29889,
4117,
4197,
3177,
29918,
4841,
29889,
1493,
6278,
29896,
29892,
954,
29918,
484,
1141,
29890,
943,
29892,
29871,
29896,
511,
3983,
29918,
287,
2710,
29918,
29875,
29889,
1493,
6278,
29896,
29892,
954,
29918,
484,
1141,
29890,
943,
29892,
29871,
29896,
29897,
1402,
29871,
29906,
29897,
396,
313,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
954,
29918,
484,
1141,
29890,
943,
29892,
29871,
29906,
29897,
13,
13,
9651,
2854,
29918,
287,
2710,
353,
3983,
29918,
287,
2710,
29918,
29875,
6736,
29871,
29900,
13,
9651,
2854,
29918,
12864,
29918,
333,
10351,
353,
4842,
305,
29889,
3062,
29898,
3084,
29918,
287,
2710,
29897,
13,
9651,
3983,
29918,
12864,
29918,
29886,
7121,
29918,
4572,
287,
353,
3983,
29918,
12864,
29918,
29886,
7121,
29961,
3084,
29918,
12864,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
12864,
29918,
333,
10351,
29961,
29896,
1402,
584,
1822,
1853,
29898,
7345,
305,
29889,
524,
29953,
29946,
29897,
13,
9651,
3983,
29918,
12864,
29918,
705,
5861,
29918,
29886,
7121,
29871,
353,
3983,
29918,
287,
2710,
29918,
705,
5861,
29918,
29875,
29961,
3084,
29918,
12864,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
12864,
29918,
333,
10351,
29961,
29896,
5262,
13,
632,
13,
9651,
954,
29918,
287,
2710,
29918,
29875,
353,
3983,
29918,
12864,
29918,
29886,
7121,
29918,
4572,
287,
29889,
12181,
29961,
29900,
29962,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
11080,
1082,
402,
11214,
29899,
4373,
880,
899,
369,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
954,
29918,
5138,
29918,
1524,
353,
1583,
29889,
5138,
29918,
1949,
29918,
1524,
13,
9651,
14013,
29918,
1272,
29918,
1731,
353,
5844,
29889,
3676,
29898,
1311,
29889,
5138,
29918,
1272,
29918,
1731,
29897,
13,
9651,
14013,
29918,
1272,
29918,
19488,
353,
5844,
29889,
3676,
29898,
1311,
29889,
5138,
29918,
1272,
29918,
19488,
29897,
13,
9651,
14013,
29918,
279,
481,
353,
5844,
29889,
3676,
29898,
1311,
29889,
5138,
29918,
279,
481,
29897,
13,
9651,
301,
29885,
29918,
19790,
353,
1583,
29889,
5138,
29918,
21457,
29918,
19790,
13,
632,
13,
9651,
396,
450,
4128,
297,
402,
29940,
899,
369,
526,
29871,
29941,
4128,
363,
13733,
322,
29871,
29941,
4128,
363,
13,
9651,
396,
13962,
363,
1432,
2943,
29889,
2178,
2943,
13733,
4128,
526,
9904,
937,
29892,
322,
13,
9651,
396,
769,
599,
2943,
13962,
4128,
526,
9904,
29889,
13,
9651,
396,
462,
4706,
921,
353,
518,
29893,
29918,
3784,
29918,
497,
29892,
260,
29918,
3784,
29918,
497,
29962,
13,
13,
9651,
565,
12379,
29918,
5450,
338,
6213,
322,
12379,
29918,
3286,
338,
6213,
29901,
13,
18884,
390,
29918,
3784,
353,
4842,
305,
29889,
1032,
29872,
29898,
29941,
29892,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
467,
1493,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29941,
467,
14358,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
18884,
260,
29918,
3784,
353,
4842,
305,
29889,
3298,
359,
3552,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
9651,
1683,
29901,
13,
18884,
390,
29918,
3784,
353,
4842,
305,
29889,
20158,
29898,
16304,
29918,
5450,
29961,
1958,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29892,
584,
29892,
584,
1402,
29881,
1853,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
10141,
29922,
29916,
29896,
29889,
10141,
467,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
13,
18884,
260,
29918,
3784,
353,
4842,
305,
29889,
20158,
29898,
16304,
29918,
3286,
29961,
1958,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29892,
584,
1402,
29881,
1853,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
10141,
29922,
29916,
29896,
29889,
10141,
467,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
9651,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
18884,
1596,
14182,
29873,
8009,
29889,
7087,
29901,
426,
29900,
29913,
3830,
11848,
29889,
7573,
29901,
426,
29896,
29913,
3830,
11848,
29889,
12770,
29901,
426,
29906,
29913,
1642,
4830,
29898,
1949,
29918,
20317,
29892,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
954,
29918,
287,
2710,
29918,
29875,
876,
13,
13,
9651,
396,
6162,
546,
12286,
29889,
13,
9651,
848,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29900,
29892,
954,
29918,
20317,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
9651,
848,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29896,
29892,
954,
29918,
20317,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
9651,
848,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29906,
29892,
954,
29918,
20317,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
13,
9651,
565,
954,
29918,
287,
2710,
29918,
29875,
1405,
29871,
29900,
29901,
13,
18884,
263,
2390,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29900,
29892,
954,
29918,
287,
2710,
29918,
29875,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
18884,
263,
2390,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29896,
29892,
954,
29918,
287,
2710,
29918,
29875,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
18884,
263,
2390,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
353,
4842,
305,
29889,
279,
927,
29898,
29906,
29892,
954,
29918,
287,
2710,
29918,
29875,
334,
29871,
29941,
29892,
29871,
29941,
29892,
714,
29922,
7345,
305,
29889,
29883,
6191,
29889,
8208,
29911,
6073,
3285,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
18884,
263,
2390,
29918,
650,
29918,
2003,
353,
4842,
305,
29889,
2873,
3552,
1949,
29918,
287,
2710,
29918,
29875,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
13,
13,
9651,
4486,
29918,
4752,
29918,
5205,
353,
7700,
13,
13,
9651,
363,
330,
29876,
29918,
29875,
297,
3464,
29898,
1949,
29918,
5138,
29918,
1524,
1125,
13,
13,
18884,
565,
330,
29876,
29918,
29875,
1273,
29871,
29941,
1275,
29871,
29906,
29901,
13,
462,
1678,
301,
29885,
29918,
19790,
847,
29922,
29871,
29906,
29936,
13,
13,
18884,
12237,
29918,
1272,
29918,
2962,
353,
12237,
580,
13,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
396,
11796,
29872,
848,
10995,
950,
322,
432,
562,
711,
713,
29889,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
432,
562,
711,
713,
29918,
1272,
353,
4842,
305,
29889,
3298,
359,
3552,
1949,
29918,
20317,
334,
29871,
29941,
29892,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
334,
29871,
29953,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
20317,
29930,
29941,
29892,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
29930,
29953,
29897,
13,
18884,
316,
15628,
29918,
9748,
353,
4842,
305,
29889,
3298,
359,
3552,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
13,
18884,
363,
413,
297,
3464,
29898,
29946,
1125,
396,
8680,
848,
3913,
29871,
29946,
23791,
943,
363,
1432,
1298,
13,
462,
1678,
2943,
29918,
333,
10351,
29918,
29895,
353,
2752,
29918,
14588,
943,
7503,
29892,
413,
29962,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
1678,
7573,
29918,
29895,
353,
3983,
29918,
18010,
29918,
29875,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1822,
1493,
29898,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
316,
15628,
1298,
11896,
29889,
462,
268,
13,
462,
1678,
5731,
630,
29918,
9748,
29918,
29895,
353,
4842,
305,
29889,
2922,
16109,
29898,
29934,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1402,
2752,
29918,
9748,
29918,
4572,
287,
448,
7573,
29918,
29895,
29897,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
353,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
334,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
1678,
316,
15628,
29918,
9748,
29918,
29895,
353,
5731,
630,
29918,
9748,
29918,
29895,
718,
7573,
29918,
29895,
718,
260,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29895,
29962,
13,
462,
1678,
316,
15628,
29918,
9748,
4619,
2752,
29918,
705,
5861,
7503,
29892,
413,
1822,
1493,
29898,
1949,
29918,
20317,
29892,
29871,
29896,
29892,
29871,
29896,
467,
14358,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
334,
316,
15628,
29918,
9748,
29918,
29895,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
18884,
396,
3617,
5181,
7117,
310,
316,
15628,
3291,
29889,
13,
18884,
321,
567,
353,
29871,
29896,
29872,
29899,
29955,
396,
3387,
408,
1781,
6944,
29892,
5998,
7087,
881,
599,
505,
2854,
10809,
472,
445,
7408,
13,
13,
18884,
316,
15628,
29918,
29916,
353,
316,
15628,
29918,
9748,
7503,
29892,
29871,
29900,
29892,
584,
1822,
1493,
29898,
1949,
29918,
20317,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
316,
15628,
29918,
29891,
353,
316,
15628,
29918,
9748,
7503,
29892,
29871,
29896,
29892,
584,
1822,
1493,
29898,
1949,
29918,
20317,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
316,
15628,
29918,
29920,
29918,
262,
3901,
353,
4842,
305,
29889,
4563,
29898,
29896,
29889,
29900,
29892,
316,
15628,
29918,
9748,
7503,
29892,
29871,
29906,
29892,
584,
1822,
1493,
29898,
1949,
29918,
20317,
29897,
718,
321,
567,
29897,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29916,
29918,
16109,
29918,
29916,
353,
285,
29916,
334,
316,
15628,
29918,
29916,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29891,
29918,
16109,
29918,
29891,
353,
285,
29891,
334,
316,
15628,
29918,
29891,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29916,
29918,
4563,
29918,
29920,
353,
285,
29916,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29891,
29918,
4563,
29918,
29920,
353,
285,
29891,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29916,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
353,
285,
29916,
29918,
16109,
29918,
29916,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
285,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
353,
285,
29891,
29918,
16109,
29918,
29891,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
26134,
29918,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
29918,
29906,
353,
448,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
18884,
26134,
29918,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
29918,
29906,
353,
448,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
334,
316,
15628,
29918,
29920,
29918,
262,
3901,
396,
313,
1949,
29918,
20317,
29897,
13,
13,
18884,
363,
413,
297,
3464,
29898,
29946,
1125,
396,
8680,
848,
3913,
29871,
29946,
23791,
943,
363,
1432,
1298,
13,
462,
1678,
2943,
29918,
333,
10351,
29918,
29895,
353,
2752,
29918,
14588,
943,
7503,
29892,
413,
29962,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
1678,
7573,
29918,
29895,
353,
3983,
29918,
18010,
29918,
29875,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1822,
1493,
29898,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
462,
1678,
18177,
29918,
29895,
353,
2752,
29918,
705,
5861,
7503,
29892,
413,
29962,
334,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
396,
313,
1949,
29918,
20317,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
18109,
29893,
5016,
300,
2200,
760,
29889,
462,
13,
462,
1678,
5731,
630,
29918,
9748,
29918,
29895,
353,
4842,
305,
29889,
2922,
16109,
29898,
29934,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1402,
2752,
29918,
9748,
29918,
4572,
287,
448,
7573,
29918,
29895,
29897,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
353,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
334,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
1678,
7688,
287,
29918,
5450,
630,
29918,
9748,
29918,
29895,
353,
18177,
29918,
29895,
29889,
1493,
29898,
1949,
29918,
20317,
29892,
29871,
29896,
29892,
29871,
29896,
467,
14358,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
334,
5731,
630,
29918,
9748,
29918,
29895,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
1678,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
353,
448,
7345,
305,
29889,
2922,
16109,
29898,
1311,
29889,
2003,
29918,
517,
29918,
26050,
29893,
29918,
2922,
29892,
7688,
287,
29918,
5450,
630,
29918,
9748,
29918,
29895,
467,
1493,
29898,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
396,
313,
1949,
29918,
20317,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
432,
562,
711,
713,
281,
2273,
29889,
10014,
2190,
12750,
8098,
29889,
13,
462,
1678,
396,
383,
27998,
349,
8322,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29900,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
18177,
29918,
29895,
334,
285,
29916,
29918,
4563,
29918,
29920,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
18177,
29918,
29895,
334,
26134,
29918,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
29918,
29906,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29896,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
18177,
29918,
29895,
334,
285,
29891,
29918,
4563,
29918,
29920,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
18177,
29918,
29895,
334,
26134,
29918,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
29918,
29906,
396,
313,
1949,
29918,
20317,
29897,
13,
462,
268,
13,
462,
1678,
396,
5012,
29925,
4690,
349,
8322,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
19488,
334,
18177,
29918,
29895,
396,
313,
1949,
29918,
20317,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
432,
562,
711,
713,
281,
2273,
29889,
390,
2891,
8098,
29889,
13,
462,
1678,
396,
383,
27998,
349,
8322,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29900,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29916,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
718,
26134,
29918,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29896,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29916,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29900,
29892,
29871,
29896,
29962,
718,
26134,
29918,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29916,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29900,
29892,
29871,
29906,
29962,
718,
26134,
29918,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29906,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29900,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29891,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29896,
29892,
29871,
29900,
29962,
718,
26134,
29918,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29896,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29891,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
718,
26134,
29918,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
1731,
334,
285,
29891,
29918,
4563,
29918,
29920,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29896,
29892,
29871,
29906,
29962,
718,
26134,
29918,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
29918,
29906,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29906,
29962,
13,
462,
268,
13,
462,
1678,
396,
5012,
29925,
4690,
349,
8322,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29900,
29962,
4619,
14013,
29918,
1272,
29918,
19488,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29896,
29962,
4619,
14013,
29918,
1272,
29918,
19488,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29895,
718,
29871,
29906,
29962,
4619,
14013,
29918,
1272,
29918,
19488,
334,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
1272,
7503,
29892,
29871,
29906,
29892,
29871,
29906,
29962,
13,
13,
462,
1678,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
29926,
562,
711,
713,
29918,
1272,
467,
497,
3285,
432,
562,
711,
713,
29918,
1272,
13,
13,
18884,
620,
29918,
1272,
353,
4842,
305,
29889,
3298,
359,
3552,
1949,
29918,
20317,
334,
29871,
29941,
29892,
29871,
29896,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
13,
13,
18884,
396,
383,
27998,
349,
8322,
13,
18884,
620,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
29871,
29900,
29962,
353,
14013,
29918,
1272,
29918,
1731,
334,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
334,
313,
11093,
29918,
16109,
29918,
29916,
29918,
4563,
29918,
29920,
718,
28232,
448,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
7503,
29892,
29871,
29900,
29892,
584,
1822,
1493,
29898,
1949,
29918,
20317,
876,
13,
18884,
620,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
29871,
29900,
29962,
353,
14013,
29918,
1272,
29918,
1731,
334,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
334,
313,
29888,
29891,
29918,
16109,
29918,
29891,
29918,
4563,
29918,
29920,
718,
5094,
448,
921,
29891,
29918,
29886,
861,
1379,
29918,
4495,
9795,
29918,
4572,
287,
7503,
29892,
29871,
29896,
29892,
584,
1822,
1493,
29898,
1949,
29918,
20317,
876,
13,
462,
13,
18884,
396,
5012,
29925,
4690,
349,
8322,
13,
18884,
620,
29918,
1272,
29961,
1272,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
29871,
29900,
29962,
353,
14013,
29918,
1272,
29918,
19488,
334,
3928,
663,
29918,
705,
5861,
29918,
4572,
287,
334,
313,
311,
15628,
29918,
9748,
7503,
29892,
29871,
29906,
29892,
584,
29962,
448,
3646,
29918,
20317,
29918,
4572,
287,
7503,
29892,
29871,
29906,
29892,
584,
14664,
1493,
29898,
1949,
29918,
20317,
29897,
13,
13,
13,
18884,
565,
3523,
29889,
5138,
29918,
2158,
29918,
9346,
886,
29901,
1596,
14182,
29873,
29905,
29873,
1469,
1840,
29901,
12365,
29889,
29941,
29888,
29913,
269,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
1272,
29918,
2962,
876,
13,
18884,
12237,
29918,
279,
481,
29918,
2962,
353,
12237,
580,
13,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
396,
11796,
29872,
263,
2390,
10995,
950,
322,
432,
562,
711,
713,
29889,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
565,
954,
29918,
287,
2710,
29918,
29875,
1405,
29871,
29900,
29901,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
353,
4842,
305,
29889,
3298,
359,
3552,
1949,
29918,
287,
2710,
29918,
29875,
334,
29871,
29941,
29892,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
334,
29871,
29953,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29930,
29941,
29892,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
29930,
29953,
29897,
13,
13,
462,
1678,
2943,
29918,
333,
10351,
29918,
29900,
353,
3983,
29918,
12864,
29918,
29886,
7121,
29918,
4572,
287,
7503,
29892,
29871,
29900,
29962,
396,
474,
2943,
13,
462,
1678,
2943,
29918,
333,
10351,
29918,
29896,
353,
3983,
29918,
12864,
29918,
29886,
7121,
29918,
4572,
287,
7503,
29892,
29871,
29896,
29962,
396,
432,
2943,
13,
13,
462,
1678,
281,
353,
4842,
305,
29889,
2873,
29918,
4561,
29898,
4262,
29918,
12864,
29918,
705,
5861,
29918,
29886,
7121,
29897,
13,
462,
1678,
565,
3523,
29889,
5138,
29918,
1509,
29918,
12864,
29918,
7915,
292,
29901,
13,
462,
4706,
396,
4001,
3983,
7636,
18177,
2533,
701,
304,
29871,
29896,
363,
599,
22092,
943,
29892,
591,
22932,
13,
462,
4706,
396,
372,
491,
278,
1353,
310,
22092,
943,
304,
1207,
278,
4444,
297,
278,
1021,
6287,
13,
462,
4706,
396,
408,
297,
278,
1206,
310,
451,
773,
7636,
18177,
313,
19562,
526,
599,
29871,
29896,
769,
467,
13,
462,
4706,
281,
353,
5785,
29898,
1949,
29918,
484,
1141,
29890,
943,
29897,
334,
3983,
29918,
12864,
29918,
705,
5861,
29918,
29886,
7121,
13,
13,
462,
1678,
281,
29918,
14358,
4706,
353,
281,
29889,
6948,
802,
29872,
911,
6278,
29896,
467,
14358,
29898,
29896,
29892,
29871,
29941,
467,
6948,
802,
29872,
911,
6278,
29896,
29897,
13,
462,
1678,
281,
29918,
14358,
29918,
14358,
353,
281,
29918,
14358,
29889,
14358,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
29897,
13,
13,
462,
1678,
7573,
29918,
29900,
353,
3983,
29918,
18010,
29918,
29875,
29961,
3177,
29918,
333,
10351,
29918,
29900,
1822,
1493,
29898,
1949,
29918,
287,
2710,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
1678,
7573,
29918,
29896,
353,
3983,
29918,
18010,
29918,
29875,
29961,
3177,
29918,
333,
10351,
29918,
29896,
1822,
1493,
29898,
1949,
29918,
287,
2710,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
10995,
950,
29889,
13,
462,
1678,
5731,
630,
29918,
3177,
29918,
4181,
353,
4842,
305,
29889,
2922,
16109,
29898,
29934,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29900,
1402,
7573,
29918,
29896,
448,
7573,
29918,
29900,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29892,
29871,
29941,
29897,
13,
462,
1678,
620,
29918,
279,
481,
353,
14013,
29918,
279,
481,
334,
281,
29918,
14358,
334,
313,
5450,
630,
29918,
3177,
29918,
4181,
718,
7573,
29918,
29900,
718,
260,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29900,
29962,
448,
313,
18010,
29918,
29896,
718,
260,
29918,
3784,
29961,
3177,
29918,
333,
10351,
29918,
29896,
12622,
13,
462,
1678,
620,
29918,
279,
481,
353,
620,
29918,
279,
481,
29889,
1493,
29898,
1949,
29918,
287,
2710,
29918,
29875,
334,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
432,
562,
711,
713,
281,
2273,
29889,
5578,
800,
29889,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29900,
29962,
4619,
14013,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29896,
29962,
4619,
14013,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29906,
29962,
4619,
14013,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29896,
718,
29871,
29900,
29962,
4619,
448,
2892,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29896,
718,
29871,
29896,
29962,
4619,
448,
2892,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
29871,
29941,
334,
3523,
29918,
1949,
29918,
18010,
29918,
29875,
718,
29871,
29941,
334,
2943,
29918,
333,
10351,
29918,
29896,
718,
29871,
29906,
29962,
4619,
448,
2892,
29918,
279,
481,
334,
281,
334,
263,
2390,
29918,
650,
29918,
2003,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
432,
562,
711,
713,
281,
2273,
29889,
5731,
800,
29889,
13,
462,
1678,
396,
2452,
440,
1230,
281,
2273,
29889,
390,
29918,
29896,
338,
5186,
304,
29871,
29900,
29889,
13,
462,
1678,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
353,
448,
2892,
29918,
279,
481,
334,
281,
29918,
14358,
29918,
14358,
334,
4842,
305,
29889,
2922,
16109,
29898,
1311,
29889,
2003,
29918,
517,
29918,
26050,
29893,
29918,
2922,
29892,
5731,
630,
29918,
3177,
29918,
4181,
467,
1493,
29898,
1949,
29918,
287,
2710,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
396,
313,
1949,
29918,
287,
2710,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
13,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29900,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29896,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29900,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29900,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29906,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29900,
29892,
29871,
29906,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29900,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29896,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29896,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29896,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29906,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29896,
29892,
29871,
29906,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29900,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29906,
29892,
29871,
29900,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29896,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29906,
29892,
29871,
29896,
29962,
13,
462,
1678,
432,
562,
711,
713,
29918,
279,
481,
29961,
279,
481,
29918,
25629,
29918,
2003,
29918,
29906,
29918,
29941,
29892,
462,
1678,
29941,
334,
2943,
29918,
333,
10351,
29918,
29900,
718,
29871,
29906,
29962,
4619,
18109,
29893,
29918,
11967,
300,
2200,
29918,
2922,
29918,
279,
481,
7503,
29892,
29871,
29906,
29892,
29871,
29906,
29962,
13,
13,
462,
1678,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
29926,
562,
711,
713,
29918,
279,
481,
467,
497,
3285,
432,
562,
711,
713,
29918,
279,
481,
13,
462,
268,
13,
18884,
565,
3523,
29889,
5138,
29918,
2158,
29918,
9346,
886,
29901,
1596,
14182,
29873,
29905,
29873,
1718,
3301,
1840,
29901,
12365,
29889,
29941,
29888,
29913,
269,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
279,
481,
29918,
2962,
876,
13,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
396,
4956,
345,
5608,
1788,
29889,
13,
18884,
835,
13383,
13383,
4136,
2277,
29937,
13,
18884,
565,
954,
29918,
287,
2710,
29918,
29875,
1405,
29871,
29900,
29901,
13,
462,
1678,
620,
353,
4842,
305,
29889,
4117,
3552,
690,
29918,
1272,
29892,
620,
29918,
279,
481,
511,
29871,
29900,
29897,
13,
462,
1678,
432,
562,
353,
4842,
305,
29889,
4117,
3552,
29926,
562,
711,
713,
29918,
1272,
29892,
432,
562,
711,
713,
29918,
279,
481,
511,
29871,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
620,
353,
620,
29918,
1272,
13,
462,
1678,
432,
562,
353,
432,
562,
711,
713,
29918,
1272,
13,
13,
18884,
12237,
29918,
5205,
29918,
2962,
353,
12237,
580,
13,
13,
18884,
396,
11796,
29872,
319,
353,
435,
29985,
29911,
29967,
322,
289,
353,
448,
29967,
29985,
2308,
29889,
13,
18884,
432,
562,
29918,
29873,
353,
4842,
305,
29889,
3286,
4220,
29898,
29926,
562,
29892,
29871,
29900,
29892,
29871,
29896,
29897,
13,
18884,
319,
353,
4842,
305,
29889,
2922,
16109,
29898,
29926,
562,
29918,
29873,
29892,
432,
562,
29897,
13,
18884,
289,
353,
4842,
305,
29889,
2922,
16109,
6278,
29926,
562,
29918,
29873,
29892,
620,
29897,
13,
13,
18884,
396,
4956,
345,
5608,
1788,
22523,
353,
289,
29889,
13,
18884,
319,
353,
319,
718,
4842,
305,
29889,
1032,
29872,
29898,
29909,
29889,
12181,
29961,
29900,
1402,
26688,
29922,
29909,
29889,
29881,
1853,
29892,
4742,
29922,
29909,
29889,
10141,
29897,
334,
301,
29885,
29918,
19790,
13,
13,
18884,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
29909,
467,
497,
3285,
319,
13,
13,
18884,
565,
3523,
29889,
5138,
29918,
2158,
29918,
9346,
886,
29901,
1596,
14182,
29873,
29905,
29873,
3924,
16287,
29901,
12365,
29889,
29941,
29888,
29913,
269,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
5205,
29918,
2962,
876,
13,
18884,
12237,
29918,
1116,
29918,
2962,
353,
12237,
580,
13,
13,
18884,
396,
5399,
278,
11806,
424,
29914,
16122,
1353,
29889,
13,
18884,
396,
960,
443,
13844,
29892,
591,
2867,
13883,
29889,
13,
18884,
565,
3523,
29889,
5138,
29918,
3198,
29918,
16122,
29918,
1949,
29901,
13,
462,
1678,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
462,
4706,
396,
11790,
654,
1353,
29889,
13,
462,
4706,
1819,
29892,
903,
353,
4842,
305,
29889,
29872,
335,
29898,
29909,
29897,
13,
462,
4706,
1855,
29918,
5975,
353,
1819,
7503,
29892,
29871,
29900,
29962,
13,
462,
4706,
4974,
4842,
305,
29889,
4492,
262,
568,
29898,
6370,
29918,
5975,
467,
497,
3285,
1855,
29918,
5975,
29871,
13,
462,
4706,
4236,
29918,
29872,
335,
29918,
1767,
353,
4842,
305,
29889,
3317,
29898,
7345,
305,
29889,
6897,
29898,
6370,
29918,
5975,
876,
13,
462,
4706,
1375,
29918,
29872,
335,
29918,
1767,
353,
4842,
305,
29889,
1195,
29898,
7345,
305,
29889,
6897,
29898,
6370,
29918,
5975,
876,
13,
462,
4706,
4195,
29918,
4537,
353,
4236,
29918,
29872,
335,
29918,
1767,
847,
1375,
29918,
29872,
335,
29918,
1767,
13,
462,
4706,
4195,
29918,
4537,
353,
4195,
29918,
4537,
29889,
667,
580,
13,
462,
4706,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
16122,
29918,
20326,
16862,
4397,
29898,
16122,
29918,
4537,
29897,
13,
13,
462,
4706,
565,
3523,
29889,
5138,
29918,
8690,
29918,
265,
29918,
16122,
29918,
1949,
322,
313,
1333,
5844,
29889,
4492,
262,
568,
29898,
16122,
29918,
4537,
29897,
470,
4195,
29918,
4537,
1405,
3523,
29889,
5138,
29918,
3317,
29918,
16122,
29918,
1949,
1125,
13,
462,
9651,
1596,
14182,
29873,
29905,
29873,
1762,
29877,
1880,
4195,
1353,
29901,
426,
29900,
29901,
29872,
29913,
313,
3317,
29901,
426,
29896,
29901,
29889,
29941,
29888,
1118,
1375,
29901,
426,
29906,
29901,
29889,
29941,
29888,
7690,
3295,
7543,
292,
4559,
1642,
4830,
29898,
16122,
29918,
4537,
29892,
4236,
29918,
29872,
335,
29918,
1767,
29889,
667,
3285,
1375,
29918,
29872,
335,
29918,
1767,
29889,
667,
22130,
13,
462,
9651,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
1762,
29877,
1880,
4195,
1353,
29901,
426,
29900,
29901,
29872,
29913,
313,
3317,
29901,
426,
29896,
29901,
29889,
29941,
29888,
1118,
1375,
29901,
426,
29906,
29901,
29889,
29941,
29888,
7690,
3295,
7543,
292,
4559,
1642,
4830,
29898,
16122,
29918,
4537,
29892,
4236,
29918,
29872,
335,
29918,
1767,
29889,
667,
3285,
1375,
29918,
29872,
335,
29918,
1767,
29889,
667,
22130,
13,
462,
9651,
4486,
29918,
4752,
29918,
5205,
353,
5852,
13,
462,
9651,
2867,
13,
462,
4706,
25342,
3523,
29889,
5138,
29918,
8382,
29901,
29871,
13,
462,
9651,
1596,
14182,
29873,
29905,
29873,
25255,
1353,
29901,
426,
29900,
29901,
29872,
29913,
313,
3317,
29901,
426,
29896,
29901,
29889,
29941,
29888,
1118,
1375,
29901,
426,
29906,
29901,
29889,
29941,
29888,
1800,
1642,
4830,
29898,
16122,
29918,
4537,
29892,
4236,
29918,
29872,
335,
29918,
1767,
29889,
667,
3285,
1375,
29918,
29872,
335,
29918,
1767,
29889,
667,
22130,
13,
13,
18884,
565,
3523,
29889,
5138,
29918,
2158,
29918,
9346,
886,
29901,
1596,
14182,
29873,
29905,
29873,
1523,
14584,
310,
2148,
29889,
954,
4898,
12365,
29889,
29941,
29888,
29913,
269,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
1116,
29918,
2962,
876,
13,
18884,
12237,
29918,
2929,
345,
29918,
2962,
353,
12237,
580,
13,
13,
18884,
5608,
29918,
2929,
369,
353,
22985,
13296,
369,
29931,
29965,
29889,
7302,
13,
13,
18884,
1018,
29901,
13,
462,
1678,
921,
353,
5608,
29918,
2929,
369,
29898,
29909,
29892,
289,
29897,
13,
13,
18884,
5174,
24875,
2392,
408,
321,
29901,
13,
462,
1678,
4486,
29918,
4752,
29918,
5205,
353,
5852,
13,
462,
1678,
1596,
14182,
29873,
29905,
29873,
13296,
369,
5229,
29901,
8408,
29899,
4752,
1788,
29991,
613,
321,
29897,
13,
462,
1678,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
13296,
369,
5229,
29901,
8408,
29899,
4752,
1788,
29991,
1159,
13,
462,
1678,
2867,
13,
13,
18884,
565,
451,
4842,
305,
29889,
4492,
262,
568,
29898,
29916,
467,
497,
7295,
13,
462,
1678,
4486,
29918,
4752,
29918,
5205,
353,
5852,
13,
462,
1678,
1596,
14182,
29873,
29905,
29873,
13296,
369,
5229,
29901,
10050,
29899,
18925,
1650,
921,
29991,
1159,
13,
462,
1678,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
13296,
369,
5229,
29901,
10050,
29899,
18925,
1650,
921,
29991,
1159,
13,
462,
1678,
2867,
13,
632,
13,
18884,
565,
3523,
29889,
5138,
29918,
2158,
29918,
9346,
886,
29901,
1596,
14182,
29873,
29905,
29873,
12697,
4505,
29901,
12365,
29889,
29941,
29888,
29913,
269,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
2929,
345,
29918,
2962,
876,
13,
462,
268,
13,
18884,
6410,
29918,
1272,
353,
4842,
305,
29889,
12324,
29898,
690,
29918,
1272,
467,
667,
580,
13,
18884,
6410,
29918,
7827,
353,
4842,
305,
29889,
12324,
29898,
690,
467,
667,
580,
13,
13,
18884,
565,
7431,
29898,
535,
369,
10238,
29918,
3888,
29961,
29875,
29962,
3366,
7827,
3108,
1125,
29871,
13,
462,
1678,
565,
6410,
29918,
7827,
448,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
7827,
3108,
14352,
29896,
29962,
1405,
1583,
29889,
9847,
29918,
6758,
29918,
12765,
29901,
13,
462,
4706,
1596,
703,
2887,
6410,
338,
7621,
1135,
1434,
16679,
13883,
1159,
13,
462,
4706,
2867,
13,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
1272,
16862,
4397,
29898,
6758,
29918,
1272,
29897,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
7827,
16862,
4397,
29898,
6758,
29918,
7827,
29897,
13,
13,
18884,
396,
512,
17053,
278,
1857,
13733,
322,
13962,
29889,
13,
18884,
390,
29918,
3742,
353,
413,
1398,
423,
29889,
2521,
29918,
8990,
29918,
517,
29918,
5450,
362,
29918,
5344,
29898,
29916,
7503,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29930,
29941,
1822,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
876,
13,
18884,
260,
29918,
3742,
353,
921,
29961,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29930,
29941,
29901,
1822,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
18884,
390,
29918,
3784,
353,
4842,
305,
29889,
2922,
16109,
29898,
29934,
29918,
3742,
29892,
390,
29918,
3784,
29897,
13,
18884,
260,
29918,
3784,
353,
260,
29918,
3784,
718,
260,
29918,
3742,
13,
13,
13,
18884,
565,
954,
29918,
287,
2710,
29918,
29875,
1405,
29871,
29900,
29901,
13,
462,
1678,
6410,
29918,
279,
481,
353,
4842,
305,
29889,
12324,
29898,
690,
29918,
279,
481,
467,
667,
580,
13,
462,
1678,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
279,
481,
16862,
4397,
29898,
6758,
29918,
279,
481,
29897,
13,
13,
18884,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
462,
1678,
565,
954,
29918,
287,
2710,
29918,
29875,
1405,
29871,
29900,
29901,
13,
462,
4706,
1596,
14182,
29873,
29905,
29873,
15110,
13463,
362,
29901,
426,
29900,
1836,
365,
29885,
26254,
29896,
29901,
29889,
29941,
29888,
29913,
365,
2209,
29901,
320,
29873,
1272,
353,
426,
29906,
29901,
29889,
29941,
29888,
1118,
320,
12637,
481,
353,
426,
29941,
29901,
29889,
29941,
29888,
1118,
320,
698,
7288,
353,
426,
29946,
29901,
29889,
29941,
29888,
29913,
1642,
4830,
29898,
5138,
29918,
29875,
29892,
301,
29885,
29918,
19790,
29892,
6758,
29918,
1272,
29892,
6410,
29918,
279,
481,
29892,
6410,
29918,
7827,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1596,
14182,
29873,
29905,
29873,
15110,
13463,
362,
29901,
426,
29900,
1836,
365,
2209,
29901,
320,
29873,
1272,
353,
426,
29896,
29901,
29889,
29941,
29888,
1118,
320,
698,
7288,
353,
426,
29906,
29901,
29889,
29941,
29888,
29913,
1642,
4830,
29898,
5138,
29918,
29875,
29892,
6410,
29918,
1272,
29892,
6410,
29918,
7827,
876,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
14350,
278,
6851,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
565,
451,
4486,
29918,
4752,
29918,
5205,
322,
4842,
305,
29889,
4492,
262,
568,
29898,
690,
467,
497,
7295,
13,
18884,
2943,
29918,
5450,
800,
29961,
29875,
29892,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29892,
584,
29892,
584,
29962,
353,
390,
29918,
3784,
29889,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
13,
18884,
2943,
29918,
3286,
29880,
800,
29961,
29875,
29892,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29892,
584,
29962,
353,
260,
29918,
3784,
29889,
1493,
29898,
3670,
29918,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29897,
13,
18884,
316,
689,
800,
29918,
3084,
537,
29961,
29875,
29892,
2910,
29918,
3670,
29918,
18010,
29918,
517,
29918,
8835,
29918,
18010,
29918,
29875,
29962,
353,
29871,
29896,
29871,
13,
18884,
2854,
29918,
2929,
345,
29961,
29875,
29962,
353,
29871,
29896,
13,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
396,
3362,
29886,
599,
2854,
2752,
3291,
773,
15899,
316,
689,
800,
29889,
13,
9651,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
9651,
565,
2854,
29918,
2929,
345,
29961,
29875,
5387,
13,
18884,
396,
19916,
714,
738,
8340,
15526,
23791,
943,
29892,
322,
8340,
2752,
3291,
29889,
13,
18884,
2752,
29918,
9748,
29918,
29875,
353,
2752,
29918,
9748,
29961,
29875,
1822,
17858,
1082,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
29897,
13,
18884,
2752,
29918,
9748,
29918,
29875,
353,
2752,
29918,
9748,
29918,
29875,
29961,
3084,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
1822,
1493,
6278,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
13,
18884,
2752,
29918,
14588,
943,
29918,
29875,
353,
15526,
29918,
14588,
943,
29961,
29875,
29892,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
29962,
396,
313,
1949,
29918,
20317,
29892,
29871,
29946,
29897,
13,
18884,
2752,
29918,
705,
5861,
29918,
29875,
353,
15526,
29918,
705,
5861,
29961,
29875,
29892,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29900,
1402,
2854,
29918,
2616,
3636,
2063,
29918,
333,
10351,
29961,
29896,
1402,
584,
29962,
396,
313,
1949,
29918,
20317,
29892,
29871,
29946,
29897,
13,
13,
18884,
954,
29918,
9748,
353,
2752,
29918,
9748,
29918,
29875,
29889,
12181,
29961,
29900,
29962,
13,
13,
18884,
396,
19916,
714,
3291,
20459,
29892,
565,
2086,
1784,
526,
1603,
2175,
29889,
13,
18884,
565,
954,
29918,
9748,
1405,
3523,
29889,
5138,
29918,
3317,
29918,
4495,
9795,
29918,
9748,
29901,
13,
462,
1678,
4559,
29881,
29918,
333,
10351,
353,
4842,
305,
29889,
9502,
17858,
29898,
1949,
29918,
9748,
29897,
7503,
3670,
29889,
5138,
29918,
3317,
29918,
4495,
9795,
29918,
9748,
29962,
13,
13,
462,
1678,
2752,
29918,
9748,
29918,
29875,
462,
353,
2752,
29918,
9748,
29918,
29875,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
462,
1678,
2752,
29918,
14588,
943,
29918,
29875,
18884,
353,
2752,
29918,
14588,
943,
29918,
29875,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
462,
1678,
2752,
29918,
705,
5861,
29918,
29875,
18884,
353,
2752,
29918,
705,
5861,
29918,
29875,
29961,
11249,
29881,
29918,
333,
10351,
29962,
13,
13,
462,
1678,
954,
29918,
9748,
353,
3523,
29889,
5138,
29918,
3317,
29918,
4495,
9795,
29918,
9748,
13,
13,
462,
1678,
316,
15628,
29918,
9748,
29918,
333,
10351,
29961,
29875,
29962,
353,
4559,
29881,
29918,
333,
10351,
13,
462,
1678,
316,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
29961,
29875,
29962,
353,
29871,
29896,
13,
13,
18884,
2752,
29918,
14588,
943,
29918,
29875,
353,
2752,
29918,
14588,
943,
29918,
29875,
29889,
1853,
29898,
7345,
305,
29889,
524,
29953,
29946,
29897,
13,
13,
18884,
396,
2567,
591,
316,
689,
599,
2752,
3291,
29889,
13,
18884,
316,
15628,
29918,
9748,
29918,
29875,
353,
4842,
305,
29889,
3298,
359,
3552,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
511,
26688,
29922,
29916,
29896,
29889,
29881,
1853,
29892,
4742,
29922,
29916,
29896,
29889,
10141,
29897,
29871,
13,
18884,
3983,
29918,
18010,
29918,
8835,
29918,
29875,
353,
3983,
29918,
18010,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29962,
13,
13,
18884,
390,
29918,
8394,
353,
2943,
29918,
5450,
800,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
29892,
584,
1822,
1493,
29898,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
13,
18884,
260,
29918,
8394,
353,
2943,
29918,
3286,
29880,
800,
29961,
29875,
29892,
584,
1949,
29918,
18010,
29918,
29875,
29892,
584,
1822,
1493,
29898,
1949,
29918,
18010,
29918,
29875,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
18884,
363,
413,
297,
3464,
29898,
29946,
1125,
396,
8680,
848,
3913,
29871,
29946,
23791,
943,
363,
1432,
1298,
13,
462,
1678,
2943,
29918,
333,
10351,
29918,
29895,
353,
2752,
29918,
14588,
943,
29918,
29875,
7503,
29892,
413,
29962,
396,
313,
1949,
29918,
9748,
29897,
13,
462,
1678,
7573,
29918,
29895,
353,
3983,
29918,
18010,
29918,
8835,
29918,
29875,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1822,
1493,
29898,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
396,
313,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
462,
1678,
396,
11796,
29872,
316,
15628,
1298,
11896,
29889,
462,
268,
13,
462,
1678,
5731,
630,
29918,
9748,
29918,
29895,
353,
4842,
305,
29889,
2922,
16109,
29898,
29934,
29918,
8394,
29961,
3177,
29918,
333,
10351,
29918,
29895,
1402,
2752,
29918,
9748,
29918,
29875,
448,
7573,
29918,
29895,
29897,
396,
313,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
353,
313,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29941,
29897,
334,
313,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
462,
1678,
316,
15628,
29918,
9748,
29918,
29895,
353,
5731,
630,
29918,
9748,
29918,
29895,
718,
7573,
29918,
29895,
718,
260,
29918,
8394,
29961,
3177,
29918,
333,
10351,
29918,
29895,
29962,
13,
462,
1678,
316,
15628,
29918,
9748,
29918,
29875,
4619,
2752,
29918,
705,
5861,
29918,
29875,
7503,
29892,
413,
1822,
1493,
29898,
1949,
29918,
9748,
29892,
29871,
29896,
29892,
29871,
29896,
467,
14358,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
334,
316,
15628,
29918,
9748,
29918,
29895,
396,
313,
1949,
29918,
9748,
29892,
29871,
29941,
29892,
29871,
29896,
29897,
13,
13,
18884,
316,
15628,
29918,
9748,
29918,
29875,
353,
316,
15628,
29918,
9748,
29918,
29875,
29889,
1493,
29898,
1949,
29918,
9748,
29892,
29871,
29941,
29897,
13,
13,
18884,
396,
14491,
278,
2582,
29889,
13,
18884,
316,
15628,
29918,
9748,
29918,
11965,
29961,
29875,
29892,
584,
1949,
29918,
9748,
29892,
584,
29962,
353,
316,
15628,
29918,
9748,
29918,
29875,
29889,
1493,
29898,
29896,
29892,
954,
29918,
9748,
29892,
29871,
29941,
29897,
13,
13,
9651,
565,
2854,
29918,
2929,
345,
29961,
29875,
5387,
13,
18884,
3001,
29918,
1949,
29918,
20317,
29918,
546,
29918,
16175,
4619,
954,
29918,
20317,
13,
13,
9651,
565,
3523,
29889,
5138,
29918,
8382,
29901,
13,
18884,
565,
938,
29898,
3084,
29918,
2929,
345,
29961,
29875,
1822,
21970,
2141,
23749,
580,
1125,
13,
462,
1678,
1596,
14182,
29873,
29905,
29873,
7211,
4505,
259,
21313,
29901,
29889,
29941,
29888,
29913,
269,
29897,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
2962,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
1596,
14182,
29873,
29905,
29873,
13919,
4505,
21313,
29901,
29889,
29941,
29888,
29913,
269,
29897,
1642,
4830,
29898,
20404,
580,
448,
12237,
29918,
2962,
876,
13,
13,
9651,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
3084,
3108,
353,
938,
29898,
3084,
29918,
2929,
345,
29961,
29875,
1822,
667,
3101,
13,
13,
4706,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
4706,
396,
1334,
8340,
403,
4866,
9853,
565,
591,
505,
2086,
1784,
7087,
297,
3001,
313,
1228,
3538,
1250,
7728,
21985,
29897,
13,
4706,
835,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
4706,
565,
451,
14707,
322,
3001,
29918,
1949,
29918,
20317,
29918,
546,
29918,
16175,
1405,
3523,
29889,
5138,
29918,
3317,
29918,
20317,
29918,
14968,
29918,
546,
29918,
16175,
29901,
13,
9651,
1596,
14182,
29873,
29905,
29873,
13296,
369,
5229,
29901,
1763,
29877,
1784,
7087,
639,
9853,
29901,
6571,
1642,
4830,
29898,
7827,
29918,
1949,
29918,
20317,
29918,
546,
29918,
16175,
876,
13,
9651,
363,
474,
297,
3464,
29898,
16175,
29918,
2311,
1125,
13,
18884,
17221,
29918,
3888,
29961,
29875,
29962,
3366,
12523,
16862,
4397,
703,
13296,
369,
5229,
29901,
1763,
29877,
1784,
7087,
639,
9853,
29901,
6571,
1642,
4830,
29898,
7827,
29918,
1949,
29918,
20317,
29918,
546,
29918,
16175,
876,
13,
18884,
2854,
29918,
2929,
345,
29961,
29875,
29962,
353,
29871,
29900,
13,
13,
4706,
736,
426,
13,
9651,
376,
1731,
29918,
1272,
1115,
518,
1731,
29906,
29892,
4972,
29941,
29892,
4972,
29946,
29892,
4972,
29945,
29892,
4972,
29953,
1402,
29871,
13,
9651,
376,
3177,
29918,
5450,
800,
1115,
2943,
29918,
5450,
800,
29892,
13,
9651,
376,
3177,
29918,
3286,
29880,
800,
1115,
2943,
29918,
3286,
29880,
800,
29892,
13,
9651,
376,
311,
689,
800,
29918,
3084,
537,
1115,
316,
689,
800,
29918,
3084,
537,
29892,
13,
9651,
376,
311,
15628,
29918,
9748,
29918,
11965,
1115,
316,
15628,
29918,
9748,
29918,
11965,
29892,
29871,
13,
9651,
376,
3084,
29918,
2929,
345,
1115,
2854,
29918,
2929,
345,
29892,
29871,
13,
9651,
376,
13168,
29918,
11965,
1115,
11105,
29918,
11965,
29892,
13,
9651,
376,
2616,
3636,
663,
29918,
3888,
1115,
426,
13,
18884,
376,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
1115,
3594,
29918,
1111,
4339,
29918,
4495,
9795,
29892,
29871,
13,
18884,
376,
4993,
29918,
9748,
1115,
4993,
29918,
9748,
29892,
29871,
13,
18884,
376,
3084,
29918,
4993,
29918,
9748,
1115,
3084,
29918,
4993,
29918,
9748,
29892,
29871,
13,
18884,
376,
5182,
29918,
20317,
1115,
5182,
29918,
20317,
29892,
29871,
13,
18884,
376,
3084,
29918,
5182,
29918,
20317,
1115,
3084,
29918,
5182,
29918,
20317,
29892,
13,
18884,
376,
3084,
29918,
2616,
3636,
2063,
1115,
3084,
29918,
2616,
3636,
2063,
29892,
29871,
13,
18884,
376,
311,
15628,
29918,
9748,
29918,
333,
10351,
1115,
311,
15628,
29918,
9748,
29918,
333,
10351,
29892,
13,
18884,
376,
311,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
1115,
311,
15628,
29918,
9748,
29918,
1491,
11249,
29881,
13,
9651,
2981,
29871,
13,
9651,
376,
535,
369,
10238,
29918,
3888,
1115,
17221,
29918,
3888,
29892,
13,
9651,
376,
7915,
29918,
3888,
1115,
7688,
29918,
3888,
13,
4706,
500,
2
] |
datasets/nhse_stats/topics/msa.py | nhsengland/publish-o-matic | 0 | 198135 | """ Scrapes the data at http://www.england.nhs.uk/statistics/statistical-work-areas/mixed-sex-accommodation/msa-data/ """
import calendar
import datetime
import re
from lxml.html import fromstring, tostring
import requests
import slugify
from publish.lib.helpers import to_markdown, anchor_to_resource
TITLE_ROOT = "Mixed-Sex Accommodation Data"
ROOT = "http://www.england.nhs.uk/statistics/statistical-work-areas/mixed-sex-accommodation/msa-data/"
DATE_RE = re.compile(".*\s(.*)\s(\d{4})")
MONTHS_LOOKUP = dict((v,k) for k,v in enumerate(calendar.month_name))
def process_block(p, title, description, current_year):
if not current_year:
return None
dataset = {
"title": "{} - {}".format(TITLE_ROOT, title),
"notes": description,
"tags": ["Statistics", current_year],
"resources": [],
"origin": "http://www.england.nhs.uk/statistics/statistical-work-areas/mixed-sex-accommodation/msa-data/",
"groups": ["msa"]
}
for resource in p.cssselect('a'):
r = anchor_to_resource(resource)
if r['format'] == 'XLSM':
r['format'] = 'XLS'
dataset["resources"].append(r)
dataset["name"] = slugify.slugify(dataset['title']).lower()
return dataset
def process_latest(datasets, latest):
"""
We process the latest data as a special case because it is
all munged together in a separate block. We need to find the
links, parse them, try and group them by name, and then decide
how we're going to label the dataset.
"""
for anchor in latest:
resource = anchor_to_resource(anchor)
y = int(string_to_date(resource['description'])[:4])
finder = "{}-{}".format(y-1, str(y)[2:4])
finder = "{} - {}".format(TITLE_ROOT, finder)
# We can find the first dataset in the list (datasets) whose
# title starts with finder as the most recent years go at
# the top of the list on the page.
for dataset in datasets:
if dataset['title'].startswith(finder):
print "We think ", resource['description'], "goes in", dataset['title']
dataset['resources'].insert(0, resource)
break
def string_to_date(s, start=True):
m = DATE_RE.match(s)
if not m:
return ""
if not len(m.groups()) == 2:
return ""
mnth = MONTHS_LOOKUP.get(m.groups()[0].strip(), "")
year = int(m.groups()[1].strip())
if not mnth:
return ""
day = 1
_, mend = calendar.monthrange(year, mnth)
if not start:
day = mend
d = datetime.datetime(year=year, month=mnth, day=day)
return d.strftime("%Y-%m-%d")
def process_dates(datasets):
for dataset in datasets:
start_date = string_to_date(dataset["resources"][-1]['description'])
end_date = string_to_date(dataset["resources"][0]['description'], start=False)
dataset["coverage_start_date"] = start_date
dataset["coverage_end_date"] = end_date
dataset["frequency"] = "Monthly"
qrtrs = [1 for r in dataset['resources'] if 'Quarter' in r['description']]
if any(qrtrs):
dataset["frequency"] = "Quarterly"
def scrape(workspace):
print "Scraping MSA with workspace {}".format(workspace)
datasets = []
page = requests.get(ROOT)
html = fromstring(page.content)
center = html.cssselect('.column.center')[0]
paras = list(center.cssselect('P'))
current_year = None
# Iterate through all of the Ps. From here until we find a <strong>
# is the description
description = []
num_p = 0
for p in paras:
if len(p.cssselect('STRONG')) > 0:
break
num_p += 1
description.append(tostring(p))
description = to_markdown(''.join(description))
latest_data_links = []
# Process the individual datasets
current_label = ""
generator = (p for p in paras[num_p:])
for p in generator:
strong = p.cssselect('STRONG')
if len(strong) > 0:
current_label = strong[0].text_content().strip()
else:
if current_label == 'Latest Data':
latest_data_links = p.cssselect('a')
continue
datasets.append(process_block(p, current_label, description, current_label))
datasets = filter(lambda x: x is not None, datasets)
process_dates(datasets)
process_latest(datasets, latest_data_links)
print len(datasets)
return datasets
| [
1,
9995,
2522,
2390,
267,
278,
848,
472,
1732,
597,
1636,
29889,
996,
1049,
29889,
29876,
9499,
29889,
2679,
29914,
6112,
6765,
29914,
6112,
391,
936,
29899,
1287,
29899,
598,
294,
29914,
29885,
11925,
29899,
14167,
29899,
562,
510,
1545,
362,
29914,
1516,
29874,
29899,
1272,
29914,
9995,
13,
13,
5215,
17684,
13,
5215,
12865,
13,
5215,
337,
13,
13,
13,
3166,
301,
3134,
29889,
1420,
1053,
515,
1807,
29892,
304,
1807,
13,
5215,
7274,
13,
5215,
2243,
688,
1598,
13,
13,
3166,
9805,
29889,
1982,
29889,
3952,
6774,
1053,
304,
29918,
3502,
3204,
29892,
17360,
29918,
517,
29918,
10314,
13,
13,
13,
29911,
1806,
1307,
29918,
21289,
353,
376,
29924,
11925,
29899,
29903,
735,
7255,
510,
1545,
362,
3630,
29908,
13,
21289,
353,
376,
1124,
597,
1636,
29889,
996,
1049,
29889,
29876,
9499,
29889,
2679,
29914,
6112,
6765,
29914,
6112,
391,
936,
29899,
1287,
29899,
598,
294,
29914,
29885,
11925,
29899,
14167,
29899,
562,
510,
1545,
362,
29914,
1516,
29874,
29899,
1272,
12975,
13,
13,
6248,
29918,
1525,
353,
337,
29889,
12198,
703,
5575,
29905,
29879,
28104,
2144,
29879,
1194,
29881,
29912,
29946,
1800,
1159,
13,
22877,
4690,
29903,
29918,
3927,
8949,
4897,
353,
9657,
3552,
29894,
29892,
29895,
29897,
363,
413,
29892,
29894,
297,
26985,
29898,
23392,
29889,
10874,
29918,
978,
876,
13,
13,
13,
1753,
1889,
29918,
1271,
29898,
29886,
29892,
3611,
29892,
6139,
29892,
1857,
29918,
6360,
1125,
13,
1678,
565,
451,
1857,
29918,
6360,
29901,
13,
4706,
736,
6213,
13,
13,
1678,
8783,
353,
426,
13,
4706,
376,
3257,
1115,
376,
8875,
448,
6571,
1642,
4830,
29898,
29911,
1806,
1307,
29918,
21289,
29892,
3611,
511,
13,
4706,
376,
16953,
1115,
6139,
29892,
13,
4706,
376,
11338,
1115,
6796,
9513,
6765,
613,
1857,
29918,
6360,
1402,
13,
4706,
376,
13237,
1115,
19997,
13,
4706,
376,
12574,
1115,
376,
1124,
597,
1636,
29889,
996,
1049,
29889,
29876,
9499,
29889,
2679,
29914,
6112,
6765,
29914,
6112,
391,
936,
29899,
1287,
29899,
598,
294,
29914,
29885,
11925,
29899,
14167,
29899,
562,
510,
1545,
362,
29914,
1516,
29874,
29899,
1272,
29914,
613,
13,
4706,
376,
13155,
1115,
6796,
1516,
29874,
3108,
13,
1678,
500,
13,
13,
1678,
363,
6503,
297,
282,
29889,
4268,
2622,
877,
29874,
29374,
13,
4706,
364,
353,
17360,
29918,
517,
29918,
10314,
29898,
10314,
29897,
13,
4706,
565,
364,
1839,
4830,
2033,
1275,
525,
29990,
8547,
29924,
2396,
13,
9651,
364,
1839,
4830,
2033,
353,
525,
29990,
8547,
29915,
13,
4706,
8783,
3366,
13237,
16862,
4397,
29898,
29878,
29897,
13,
13,
1678,
8783,
3366,
978,
3108,
353,
2243,
688,
1598,
29889,
29517,
1598,
29898,
24713,
1839,
3257,
2033,
467,
13609,
580,
13,
13,
1678,
736,
8783,
13,
13,
1753,
1889,
29918,
12333,
29898,
14538,
1691,
29892,
9281,
1125,
13,
1678,
9995,
13,
1678,
1334,
1889,
278,
9281,
848,
408,
263,
4266,
1206,
1363,
372,
338,
13,
1678,
599,
286,
686,
287,
4208,
297,
263,
5004,
2908,
29889,
29871,
1334,
817,
304,
1284,
278,
13,
1678,
2988,
29892,
6088,
963,
29892,
1018,
322,
2318,
963,
491,
1024,
29892,
322,
769,
11097,
13,
1678,
920,
591,
29915,
276,
2675,
304,
3858,
278,
8783,
29889,
13,
1678,
9995,
13,
1678,
363,
17360,
297,
9281,
29901,
13,
4706,
6503,
353,
17360,
29918,
517,
29918,
10314,
29898,
25367,
29897,
13,
4706,
343,
353,
938,
29898,
1807,
29918,
517,
29918,
1256,
29898,
10314,
1839,
8216,
11287,
7503,
29946,
2314,
13,
4706,
1284,
261,
353,
29850,
7402,
8875,
1642,
4830,
29898,
29891,
29899,
29896,
29892,
851,
29898,
29891,
9601,
29906,
29901,
29946,
2314,
13,
4706,
1284,
261,
353,
376,
8875,
448,
6571,
1642,
4830,
29898,
29911,
1806,
1307,
29918,
21289,
29892,
1284,
261,
29897,
13,
13,
4706,
396,
1334,
508,
1284,
278,
937,
8783,
297,
278,
1051,
313,
14538,
1691,
29897,
5069,
13,
4706,
396,
3611,
8665,
411,
1284,
261,
408,
278,
1556,
7786,
2440,
748,
472,
13,
4706,
396,
278,
2246,
310,
278,
1051,
373,
278,
1813,
29889,
13,
4706,
363,
8783,
297,
20035,
29901,
13,
9651,
565,
8783,
1839,
3257,
13359,
27382,
2541,
29898,
2886,
261,
1125,
13,
18884,
1596,
376,
4806,
1348,
9162,
6503,
1839,
8216,
7464,
376,
1484,
267,
297,
613,
8783,
1839,
3257,
2033,
13,
18884,
8783,
1839,
13237,
13359,
7851,
29898,
29900,
29892,
6503,
29897,
13,
18884,
2867,
13,
13,
1753,
1347,
29918,
517,
29918,
1256,
29898,
29879,
29892,
1369,
29922,
5574,
1125,
13,
13,
1678,
286,
353,
20231,
29918,
1525,
29889,
4352,
29898,
29879,
29897,
13,
1678,
565,
451,
286,
29901,
13,
4706,
736,
5124,
13,
13,
1678,
565,
451,
7431,
29898,
29885,
29889,
13155,
3101,
1275,
29871,
29906,
29901,
13,
4706,
736,
5124,
13,
13,
1678,
286,
20800,
353,
341,
1164,
4690,
29903,
29918,
3927,
8949,
4897,
29889,
657,
29898,
29885,
29889,
13155,
580,
29961,
29900,
1822,
17010,
3285,
20569,
13,
1678,
1629,
353,
938,
29898,
29885,
29889,
13155,
580,
29961,
29896,
1822,
17010,
3101,
13,
13,
1678,
565,
451,
286,
20800,
29901,
13,
4706,
736,
5124,
13,
13,
1678,
2462,
353,
29871,
29896,
13,
1678,
17117,
286,
355,
353,
17684,
29889,
10874,
3881,
29898,
6360,
29892,
286,
20800,
29897,
13,
1678,
565,
451,
1369,
29901,
13,
4706,
2462,
353,
286,
355,
13,
13,
1678,
270,
353,
12865,
29889,
12673,
29898,
6360,
29922,
6360,
29892,
4098,
29922,
29885,
20800,
29892,
2462,
29922,
3250,
29897,
13,
1678,
736,
270,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
1159,
13,
13,
1753,
1889,
29918,
15190,
29898,
14538,
1691,
1125,
13,
13,
1678,
363,
8783,
297,
20035,
29901,
13,
4706,
1369,
29918,
1256,
353,
1347,
29918,
517,
29918,
1256,
29898,
24713,
3366,
13237,
3108,
14352,
29896,
22322,
8216,
11287,
13,
4706,
1095,
29918,
1256,
353,
1347,
29918,
517,
29918,
1256,
29898,
24713,
3366,
13237,
3108,
29961,
29900,
22322,
8216,
7464,
1369,
29922,
8824,
29897,
13,
4706,
8783,
3366,
11911,
482,
29918,
2962,
29918,
1256,
3108,
353,
1369,
29918,
1256,
13,
4706,
8783,
3366,
11911,
482,
29918,
355,
29918,
1256,
3108,
353,
1095,
29918,
1256,
13,
4706,
8783,
3366,
10745,
23860,
3108,
353,
376,
13953,
368,
29908,
13,
13,
4706,
3855,
29878,
509,
29879,
353,
518,
29896,
363,
364,
297,
8783,
1839,
13237,
2033,
565,
525,
2182,
4254,
29915,
297,
364,
1839,
8216,
2033,
29962,
13,
4706,
565,
738,
29898,
29939,
29878,
509,
29879,
1125,
13,
9651,
8783,
3366,
10745,
23860,
3108,
353,
376,
2182,
4254,
368,
29908,
13,
13,
1753,
24559,
412,
29898,
1287,
3493,
1125,
13,
1678,
1596,
376,
4421,
2390,
292,
341,
8132,
411,
664,
3493,
6571,
1642,
4830,
29898,
1287,
3493,
29897,
13,
13,
1678,
20035,
353,
5159,
13,
13,
1678,
1813,
353,
7274,
29889,
657,
29898,
21289,
29897,
13,
1678,
3472,
353,
515,
1807,
29898,
3488,
29889,
3051,
29897,
13,
13,
1678,
4818,
353,
3472,
29889,
4268,
2622,
12839,
4914,
29889,
5064,
29861,
29900,
29962,
13,
13,
1678,
610,
294,
353,
1051,
29898,
5064,
29889,
4268,
2622,
877,
29925,
8785,
13,
13,
1678,
1857,
29918,
6360,
353,
6213,
13,
13,
1678,
396,
20504,
403,
1549,
599,
310,
278,
10144,
29889,
3645,
1244,
2745,
591,
1284,
263,
529,
1110,
29958,
13,
1678,
396,
338,
278,
6139,
13,
1678,
6139,
353,
5159,
13,
1678,
954,
29918,
29886,
353,
29871,
29900,
13,
1678,
363,
282,
297,
610,
294,
29901,
13,
4706,
565,
7431,
29898,
29886,
29889,
4268,
2622,
877,
10810,
20614,
8785,
1405,
29871,
29900,
29901,
13,
9651,
2867,
13,
4706,
954,
29918,
29886,
4619,
29871,
29896,
13,
4706,
6139,
29889,
4397,
29898,
517,
1807,
29898,
29886,
876,
13,
1678,
6139,
353,
304,
29918,
3502,
3204,
877,
4286,
7122,
29898,
8216,
876,
13,
13,
1678,
9281,
29918,
1272,
29918,
4965,
353,
5159,
13,
13,
1678,
396,
10554,
278,
5375,
20035,
13,
1678,
1857,
29918,
1643,
353,
5124,
13,
1678,
15299,
353,
313,
29886,
363,
282,
297,
610,
294,
29961,
1949,
29918,
29886,
29901,
2314,
13,
1678,
363,
282,
297,
15299,
29901,
13,
4706,
4549,
353,
282,
29889,
4268,
2622,
877,
10810,
20614,
1495,
13,
4706,
565,
7431,
29898,
1110,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1857,
29918,
1643,
353,
4549,
29961,
29900,
1822,
726,
29918,
3051,
2141,
17010,
580,
13,
4706,
1683,
29901,
13,
9651,
565,
1857,
29918,
1643,
1275,
525,
13992,
342,
3630,
2396,
13,
18884,
9281,
29918,
1272,
29918,
4965,
353,
282,
29889,
4268,
2622,
877,
29874,
1495,
13,
18884,
6773,
13,
13,
9651,
20035,
29889,
4397,
29898,
5014,
29918,
1271,
29898,
29886,
29892,
1857,
29918,
1643,
29892,
6139,
29892,
1857,
29918,
1643,
876,
13,
13,
1678,
20035,
353,
4175,
29898,
2892,
921,
29901,
921,
338,
451,
6213,
29892,
20035,
29897,
13,
1678,
1889,
29918,
15190,
29898,
14538,
1691,
29897,
13,
1678,
1889,
29918,
12333,
29898,
14538,
1691,
29892,
9281,
29918,
1272,
29918,
4965,
29897,
13,
13,
1678,
1596,
7431,
29898,
14538,
1691,
29897,
13,
1678,
736,
20035,
13,
2
] |
test/test_ostool.py | JukeboxPipeline/jukebox-core | 2 | 139610 | from jukeboxcore import ostool
def test_detect_sys():
""" Detect Platform
:returns: None
:rtype: None
:raises: None
"""
ostool.detect_sys()
def test_get_interface():
""" Get PlatformInterface for your Platform
:returns: None
:rtype: None
:raises: None
"""
ostool.get_interface()
def test_interface():
""" Run PlatformInterface methods
:returns: None
:rtype: None
:raises: None
"""
inter = ostool.get_interface()
loc = inter.get_maya_location()
assert loc
site = inter.get_maya_sitepackage_dir()
assert site
mayapy = inter.get_maya_python()
assert mayapy
exe = inter.get_maya_exe()
assert exe
| [
1,
515,
3623,
446,
1884,
3221,
1053,
14750,
1507,
13,
13,
13,
1753,
1243,
29918,
4801,
522,
29918,
9675,
7295,
13,
1678,
9995,
5953,
522,
28096,
13,
13,
1678,
584,
18280,
29901,
6213,
13,
1678,
584,
29878,
1853,
29901,
6213,
13,
1678,
584,
336,
4637,
29901,
6213,
13,
1678,
9995,
13,
1678,
14750,
1507,
29889,
4801,
522,
29918,
9675,
580,
13,
13,
13,
1753,
1243,
29918,
657,
29918,
13248,
7295,
13,
1678,
9995,
3617,
28096,
10448,
363,
596,
28096,
13,
13,
1678,
584,
18280,
29901,
6213,
13,
1678,
584,
29878,
1853,
29901,
6213,
13,
1678,
584,
336,
4637,
29901,
6213,
13,
1678,
9995,
13,
1678,
14750,
1507,
29889,
657,
29918,
13248,
580,
13,
13,
13,
1753,
1243,
29918,
13248,
7295,
13,
1678,
9995,
7525,
28096,
10448,
3519,
13,
13,
1678,
584,
18280,
29901,
6213,
13,
1678,
584,
29878,
1853,
29901,
6213,
13,
1678,
584,
336,
4637,
29901,
6213,
13,
1678,
9995,
13,
1678,
1006,
353,
14750,
1507,
29889,
657,
29918,
13248,
580,
13,
1678,
1180,
353,
1006,
29889,
657,
29918,
29885,
9010,
29918,
5479,
580,
13,
1678,
4974,
1180,
13,
1678,
3268,
353,
1006,
29889,
657,
29918,
29885,
9010,
29918,
2746,
5113,
29918,
3972,
580,
13,
1678,
4974,
3268,
13,
1678,
1122,
27580,
353,
1006,
29889,
657,
29918,
29885,
9010,
29918,
4691,
580,
13,
1678,
4974,
1122,
27580,
13,
1678,
429,
29872,
353,
1006,
29889,
657,
29918,
29885,
9010,
29918,
8097,
580,
13,
1678,
4974,
429,
29872,
13,
2
] |
wxnat/tests/__init__.py | pauldmccarthy/wxnatpy | 1 | 56129 | <gh_stars>1-10
#!/usr/bin/env python
#
# __init__.py - unit tests for wxnatpy
#
# Author: <NAME> <<EMAIL>>
#
import time
import wx
def run_with_wx(func, *args, **kwargs):
propagateRaise = kwargs.pop('propagateRaise', True)
startingDelay = kwargs.pop('startingDelay', 500)
finishingDelay = kwargs.pop('finishingDelay', 500)
callAfterApp = kwargs.pop('callAfterApp', None)
result = [None]
raised = [None]
app = wx.App()
frame = wx.Frame(None)
if callAfterApp is not None:
callAfterApp()
def wrap():
try:
if func is not None:
result[0] = func(*args, **kwargs)
except Exception as e:
print(e)
raised[0] = e
finally:
def finish():
frame.Destroy()
app.ExitMainLoop()
wx.CallLater(finishingDelay, finish)
frame.Show()
wx.CallLater(startingDelay, wrap)
app.MainLoop()
if raised[0] and propagateRaise:
raise raised[0]
return result[0]
def yield_until(condition):
while not condition():
time.sleep(0.1)
wx.Yield()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
13,
29937,
4770,
2344,
26914,
2272,
448,
5190,
6987,
363,
26437,
8924,
2272,
13,
29937,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
13,
5215,
931,
13,
13,
5215,
26437,
13,
13,
13,
13,
1753,
1065,
29918,
2541,
29918,
23310,
29898,
9891,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
13,
1678,
13089,
403,
29934,
29874,
895,
353,
9049,
5085,
29889,
7323,
877,
7728,
351,
403,
29934,
29874,
895,
742,
5852,
29897,
13,
1678,
6257,
24996,
29871,
353,
9049,
5085,
29889,
7323,
877,
2962,
292,
24996,
742,
259,
29945,
29900,
29900,
29897,
13,
1678,
28321,
24996,
353,
9049,
5085,
29889,
7323,
877,
4951,
14424,
24996,
742,
29871,
29945,
29900,
29900,
29897,
13,
1678,
1246,
13555,
2052,
259,
353,
9049,
5085,
29889,
7323,
877,
4804,
13555,
2052,
742,
259,
6213,
29897,
13,
13,
1678,
1121,
353,
518,
8516,
29962,
13,
1678,
10425,
353,
518,
8516,
29962,
13,
13,
1678,
623,
1678,
353,
26437,
29889,
2052,
580,
13,
1678,
3515,
29871,
353,
26437,
29889,
4308,
29898,
8516,
29897,
13,
13,
1678,
565,
1246,
13555,
2052,
338,
451,
6213,
29901,
13,
4706,
1246,
13555,
2052,
580,
13,
13,
1678,
822,
12244,
7295,
13,
13,
4706,
1018,
29901,
13,
9651,
565,
3653,
338,
451,
6213,
29901,
13,
18884,
1121,
29961,
29900,
29962,
353,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1596,
29898,
29872,
29897,
13,
9651,
10425,
29961,
29900,
29962,
353,
321,
13,
13,
4706,
7146,
29901,
13,
9651,
822,
8341,
7295,
13,
18884,
3515,
29889,
14994,
4727,
580,
13,
18884,
623,
29889,
24365,
6330,
18405,
580,
13,
9651,
26437,
29889,
5594,
29931,
1008,
29898,
4951,
14424,
24996,
29892,
8341,
29897,
13,
13,
1678,
3515,
29889,
8964,
580,
13,
13,
1678,
26437,
29889,
5594,
29931,
1008,
29898,
2962,
292,
24996,
29892,
12244,
29897,
13,
13,
1678,
623,
29889,
6330,
18405,
580,
13,
13,
1678,
565,
10425,
29961,
29900,
29962,
322,
13089,
403,
29934,
29874,
895,
29901,
13,
4706,
12020,
10425,
29961,
29900,
29962,
13,
13,
1678,
736,
1121,
29961,
29900,
29962,
13,
13,
13,
1753,
7709,
29918,
29305,
29898,
16122,
1125,
13,
1678,
1550,
451,
4195,
7295,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
4706,
26437,
29889,
29979,
969,
580,
13,
2
] |
examples/test_yield_8.py | MateuszG/django_auth | 2 | 9014 | import pytest
@pytest.yield_fixture
def passwd():
print ("\nsetup before yield")
f = open("/etc/passwd")
yield f.readlines()
print ("teardown after yield")
f.close()
def test_has_lines(passwd):
print ("test called")
assert passwd
| [
1,
1053,
11451,
1688,
13,
13,
29992,
2272,
1688,
29889,
29891,
969,
29918,
7241,
15546,
13,
1753,
1209,
9970,
7295,
13,
1678,
1596,
4852,
29905,
29876,
14669,
1434,
7709,
1159,
13,
1678,
285,
353,
1722,
11974,
7070,
29914,
3364,
9970,
1159,
13,
1678,
7709,
285,
29889,
949,
9012,
580,
13,
1678,
1596,
4852,
371,
538,
776,
1156,
7709,
1159,
13,
1678,
285,
29889,
5358,
580,
13,
13,
1753,
1243,
29918,
5349,
29918,
9012,
29898,
3364,
9970,
1125,
13,
1678,
1596,
4852,
1688,
2000,
1159,
13,
1678,
4974,
1209,
9970,
13,
2
] |
examples/Oscillators/MallsOscillator/plotresults.py | doublefloyd/beluga | 20 | 174838 | from beluga.utils import load
import matplotlib.pyplot as plt
data = load('data.beluga')
sol_set = data['solutions']
traj = sol_set[-1][-1]
continuation = sol_set[-1]
L = len(continuation)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.y[:, 0], sol.y[:, 1], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('Phase Plot')
plt.xlabel('$x_1$')
plt.ylabel('$x_2$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.u[:, 0], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.plot([traj.t[0], traj.t[-1]], [1, 1], color='k', linestyle='--')
plt.plot([traj.t[0], traj.t[-1]], [-1, -1], color='k', linestyle='--')
plt.title('Control History Plot')
plt.xlabel('Time [s]')
plt.ylabel('Control, $u$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.dual[:, 0], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('$\\lambda_{x1}$ History Plot')
plt.xlabel('Time [s]')
plt.ylabel('$\\lambda_{x1}$')
plt.grid(True)
plt.figure()
for ind, sol in enumerate(continuation):
plt.plot(sol.t, sol.dual[:, 1], linestyle='-', color=(1*(ind/L), 0, 1*(L-ind)/L))
plt.title('$\\lambda_{x2}$ History Plot')
plt.xlabel('Time [s]')
plt.ylabel('$\\lambda_{x2}$')
plt.grid(True)
plt.show()
| [
1,
515,
1339,
26281,
29889,
13239,
1053,
2254,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
1272,
353,
2254,
877,
1272,
29889,
6596,
26281,
1495,
13,
13,
2929,
29918,
842,
353,
848,
1839,
2929,
17925,
2033,
13,
3018,
29926,
353,
899,
29918,
842,
14352,
29896,
3816,
29899,
29896,
29962,
13,
20621,
362,
353,
899,
29918,
842,
14352,
29896,
29962,
13,
29931,
353,
7431,
29898,
20621,
362,
29897,
13,
13,
572,
29873,
29889,
4532,
580,
13,
1454,
1399,
29892,
899,
297,
26985,
29898,
20621,
362,
1125,
13,
1678,
14770,
29889,
5317,
29898,
2929,
29889,
29891,
7503,
29892,
29871,
29900,
1402,
899,
29889,
29891,
7503,
29892,
29871,
29896,
1402,
6276,
342,
1508,
2433,
29899,
742,
2927,
7607,
29896,
16395,
513,
29914,
29931,
511,
29871,
29900,
29892,
29871,
29896,
16395,
29931,
29899,
513,
6802,
29931,
876,
13,
13,
572,
29873,
29889,
3257,
877,
4819,
559,
18399,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
29938,
29916,
29918,
29896,
29938,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
29938,
29916,
29918,
29906,
29938,
1495,
13,
572,
29873,
29889,
7720,
29898,
5574,
29897,
13,
13,
572,
29873,
29889,
4532,
580,
13,
1454,
1399,
29892,
899,
297,
26985,
29898,
20621,
362,
1125,
13,
1678,
14770,
29889,
5317,
29898,
2929,
29889,
29873,
29892,
899,
29889,
29884,
7503,
29892,
29871,
29900,
1402,
6276,
342,
1508,
2433,
29899,
742,
2927,
7607,
29896,
16395,
513,
29914,
29931,
511,
29871,
29900,
29892,
29871,
29896,
16395,
29931,
29899,
513,
6802,
29931,
876,
13,
13,
572,
29873,
29889,
5317,
4197,
3018,
29926,
29889,
29873,
29961,
29900,
1402,
1020,
29926,
29889,
29873,
14352,
29896,
20526,
518,
29896,
29892,
29871,
29896,
1402,
2927,
2433,
29895,
742,
6276,
342,
1508,
2433,
489,
1495,
13,
572,
29873,
29889,
5317,
4197,
3018,
29926,
29889,
29873,
29961,
29900,
1402,
1020,
29926,
29889,
29873,
14352,
29896,
20526,
21069,
29896,
29892,
448,
29896,
1402,
2927,
2433,
29895,
742,
6276,
342,
1508,
2433,
489,
1495,
13,
572,
29873,
29889,
3257,
877,
4809,
5298,
18399,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
2481,
518,
29879,
29962,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
4809,
29892,
395,
29884,
29938,
1495,
13,
572,
29873,
29889,
7720,
29898,
5574,
29897,
13,
13,
572,
29873,
29889,
4532,
580,
13,
1454,
1399,
29892,
899,
297,
26985,
29898,
20621,
362,
1125,
13,
1678,
14770,
29889,
5317,
29898,
2929,
29889,
29873,
29892,
899,
29889,
700,
284,
7503,
29892,
29871,
29900,
1402,
6276,
342,
1508,
2433,
29899,
742,
2927,
7607,
29896,
16395,
513,
29914,
29931,
511,
29871,
29900,
29892,
29871,
29896,
16395,
29931,
29899,
513,
6802,
29931,
876,
13,
13,
572,
29873,
29889,
3257,
877,
29938,
1966,
2892,
648,
29916,
29896,
1042,
5298,
18399,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
2481,
518,
29879,
29962,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
29938,
1966,
2892,
648,
29916,
29896,
1042,
1495,
13,
572,
29873,
29889,
7720,
29898,
5574,
29897,
13,
13,
572,
29873,
29889,
4532,
580,
13,
1454,
1399,
29892,
899,
297,
26985,
29898,
20621,
362,
1125,
13,
1678,
14770,
29889,
5317,
29898,
2929,
29889,
29873,
29892,
899,
29889,
700,
284,
7503,
29892,
29871,
29896,
1402,
6276,
342,
1508,
2433,
29899,
742,
2927,
7607,
29896,
16395,
513,
29914,
29931,
511,
29871,
29900,
29892,
29871,
29896,
16395,
29931,
29899,
513,
6802,
29931,
876,
13,
13,
572,
29873,
29889,
3257,
877,
29938,
1966,
2892,
648,
29916,
29906,
1042,
5298,
18399,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
2481,
518,
29879,
29962,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
29938,
1966,
2892,
648,
29916,
29906,
1042,
1495,
13,
572,
29873,
29889,
7720,
29898,
5574,
29897,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
src/lib/earlystopping.py | dreizehnutters/pcapae | 0 | 34665 | from os import path, makedirs, walk ,remove, scandir, unlink
from numpy import inf
from torch import save as t_save
from lib.utils import sort_human, BOLD, CLR
class EarlyStopping:
def __init__(self, log_path, patience=7, model=None, verbose=False, exp_tag=""):
"""Early stops the training if validation loss doesn't improve after a given patience.
Args:
patience (int): How long to wait after last time validation loss improved.
Default: 7
verbose (bool): If True, prints a message for each validation loss improvement.
Default: False
"""
self.patience = patience
self.verbose = verbose
self.counter = 0
self.best_score = None
self.early_stop = False
self.val_loss_min = inf
self.global_min_loss = inf
save_dir = f"{log_path}/save_model/{exp_tag}"
self.save_path = save_dir
if not path.isdir(save_dir):
makedirs(save_dir)
save_dir = f"{self.save_path}/best/"
if not path.isdir(save_dir):
makedirs(save_dir)
if model is not None:
self.meta_info = {'meta':(model.encoder_params,\
model.decoder_params,\
model.n_frames_input,\
model.n_frames_output)}
else:
self.meta_info = {}
def __str__(self):
return '\n'.join(f"{k}={v}" for k, v in vars(self).items())
def __call__(self, val_loss, model, epoch, step=0):
"""Summary
Args:
val_loss (TYPE): Description
model (TYPE): Description
epoch (TYPE): Description
"""
score = -val_loss
model.update(self.meta_info)
if step != 0:
self.save_checkpoint(val_loss, model, epoch, step)
else:
if self.best_score is None:
self.best_score = score
self.save_checkpoint(val_loss, model, epoch, step)
elif score < self.best_score:
self.counter += 1
if self.counter >= self.patience:
self.early_stop = True
print(f"{BOLD}[*] early stopping at epoch {epoch} !{CLR}")
else:
print(f"[*] early stopping counter: {BOLD}{self.counter}/{self.patience}{CLR}")
# self.del_old_models()
else:
self.best_score = score
self.save_checkpoint(val_loss, model, epoch, step)
self.counter = 0
t_save(model, f"{self.save_path}/LAST_checkpoint_{epoch}_{step}_{val_loss:.6f}.pth.tar")
def del_old_models(self, keep=10):
_, _, files = next(walk(self.save_path))
file_count = len(files)
if file_count > keep:
for old_model in sort_human(files)[:keep//2]:
remove(path.join(self.save_path, old_model))
def save_checkpoint(self, val_loss, model, epoch, step=0):
"""Saves model when validation loss decrease
Args:
val_loss (TYPE): Description
model (TYPE): Description
epoch (TYPE): Description
"""
# save best model
if step != 0:
save_flag = "IE"
print(f"[$] saveing model at step: {step} in epoch {epoch}")
self.del_old_models()
t_save(model, f"{self.save_path}/{save_flag}checkpoint_{epoch}_{step}_{val_loss}.pth.tar")
else:
if val_loss < self.global_min_loss:
if self.verbose:
print(f"[*] validation loss record {BOLD}{val_loss}{CLR} in epoch: {BOLD}{epoch}{CLR}@{step}")
self.global_min_loss = val_loss
save_flag = "best/"
for file in scandir(f"{self.save_path}/{save_flag}"):
unlink(file.path)
else:
save_flag = ""
#self.del_old_models()
t_save(model, f"{self.save_path}/{save_flag}checkpoint_{epoch}_{step}_{val_loss}.pth.tar")
self.val_loss_min = val_loss
| [
1,
515,
2897,
1053,
2224,
29892,
2136,
287,
12935,
29892,
6686,
1919,
5992,
29892,
885,
392,
381,
29892,
443,
2324,
13,
13,
3166,
12655,
1053,
3041,
13,
3166,
4842,
305,
1053,
4078,
408,
260,
29918,
7620,
13,
13,
3166,
4303,
29889,
13239,
1053,
2656,
29918,
26029,
29892,
350,
5607,
29928,
29892,
17332,
29934,
13,
13,
13,
1990,
11095,
20754,
3262,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1480,
29918,
2084,
29892,
282,
24701,
29922,
29955,
29892,
1904,
29922,
8516,
29892,
26952,
29922,
8824,
29892,
1518,
29918,
4039,
13776,
1125,
13,
4706,
9995,
29923,
279,
368,
17726,
278,
6694,
565,
8845,
6410,
1838,
29915,
29873,
11157,
1156,
263,
2183,
282,
24701,
29889,
13,
4706,
826,
3174,
29901,
13,
9651,
282,
24701,
313,
524,
1125,
1128,
1472,
304,
4480,
1156,
1833,
931,
8845,
6410,
16710,
29889,
13,
462,
9651,
13109,
29901,
29871,
29955,
13,
9651,
26952,
313,
11227,
1125,
960,
5852,
29892,
14677,
263,
2643,
363,
1269,
8845,
6410,
20414,
29889,
29871,
13,
462,
9651,
13109,
29901,
7700,
13,
4706,
9995,
13,
4706,
1583,
29889,
29886,
24701,
353,
282,
24701,
13,
4706,
1583,
29889,
369,
15828,
353,
26952,
13,
4706,
1583,
29889,
11808,
353,
29871,
29900,
13,
4706,
1583,
29889,
13318,
29918,
13628,
353,
6213,
13,
4706,
1583,
29889,
799,
368,
29918,
9847,
353,
7700,
13,
4706,
1583,
29889,
791,
29918,
6758,
29918,
1195,
353,
3041,
13,
4706,
1583,
29889,
10945,
29918,
1195,
29918,
6758,
353,
3041,
13,
4706,
4078,
29918,
3972,
353,
285,
29908,
29912,
1188,
29918,
2084,
6822,
7620,
29918,
4299,
19248,
4548,
29918,
4039,
5038,
13,
4706,
1583,
29889,
7620,
29918,
2084,
353,
4078,
29918,
3972,
13,
4706,
565,
451,
2224,
29889,
275,
3972,
29898,
7620,
29918,
3972,
1125,
13,
9651,
2136,
287,
12935,
29898,
7620,
29918,
3972,
29897,
13,
4706,
4078,
29918,
3972,
353,
285,
29908,
29912,
1311,
29889,
7620,
29918,
2084,
6822,
13318,
12975,
13,
4706,
565,
451,
2224,
29889,
275,
3972,
29898,
7620,
29918,
3972,
1125,
13,
9651,
2136,
287,
12935,
29898,
7620,
29918,
3972,
29897,
13,
4706,
565,
1904,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
7299,
29918,
3888,
353,
11117,
7299,
2396,
29898,
4299,
29889,
3977,
6119,
29918,
7529,
2053,
13,
462,
462,
418,
1904,
29889,
7099,
6119,
29918,
7529,
2053,
13,
462,
462,
418,
1904,
29889,
29876,
29918,
19935,
29918,
2080,
2053,
13,
462,
462,
418,
1904,
29889,
29876,
29918,
19935,
29918,
4905,
2915,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
7299,
29918,
3888,
353,
6571,
13,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
11297,
29876,
4286,
7122,
29898,
29888,
29908,
29912,
29895,
29913,
3790,
29894,
5038,
363,
413,
29892,
325,
297,
24987,
29898,
1311,
467,
7076,
3101,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
659,
29918,
6758,
29892,
1904,
29892,
21502,
305,
29892,
4331,
29922,
29900,
1125,
13,
4706,
9995,
26289,
13,
4706,
826,
3174,
29901,
13,
9651,
659,
29918,
6758,
313,
11116,
1125,
12953,
13,
9651,
1904,
313,
11116,
1125,
12953,
13,
9651,
21502,
305,
313,
11116,
1125,
12953,
13,
4706,
9995,
13,
4706,
8158,
353,
448,
791,
29918,
6758,
13,
13,
4706,
1904,
29889,
5504,
29898,
1311,
29889,
7299,
29918,
3888,
29897,
13,
13,
4706,
565,
4331,
2804,
29871,
29900,
29901,
13,
9651,
1583,
29889,
7620,
29918,
3198,
3149,
29898,
791,
29918,
6758,
29892,
1904,
29892,
21502,
305,
29892,
4331,
29897,
13,
4706,
1683,
29901,
13,
9651,
565,
1583,
29889,
13318,
29918,
13628,
338,
6213,
29901,
13,
18884,
1583,
29889,
13318,
29918,
13628,
353,
8158,
13,
18884,
1583,
29889,
7620,
29918,
3198,
3149,
29898,
791,
29918,
6758,
29892,
1904,
29892,
21502,
305,
29892,
4331,
29897,
13,
9651,
25342,
8158,
529,
1583,
29889,
13318,
29918,
13628,
29901,
13,
18884,
1583,
29889,
11808,
4619,
29871,
29896,
13,
18884,
565,
1583,
29889,
11808,
6736,
1583,
29889,
29886,
24701,
29901,
13,
462,
1678,
1583,
29889,
799,
368,
29918,
9847,
353,
5852,
13,
462,
1678,
1596,
29898,
29888,
29908,
29912,
29933,
5607,
29928,
4400,
29930,
29962,
4688,
25480,
472,
21502,
305,
426,
1022,
2878,
29913,
1738,
29912,
6154,
29934,
27195,
13,
18884,
1683,
29901,
13,
462,
1678,
1596,
29898,
29888,
29908,
29961,
29930,
29962,
4688,
25480,
6795,
29901,
426,
29933,
5607,
29928,
1157,
1311,
29889,
11808,
6822,
29912,
1311,
29889,
29886,
24701,
1157,
6154,
29934,
27195,
13,
18884,
396,
1583,
29889,
6144,
29918,
1025,
29918,
9794,
580,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
13318,
29918,
13628,
353,
8158,
13,
18884,
1583,
29889,
7620,
29918,
3198,
3149,
29898,
791,
29918,
6758,
29892,
1904,
29892,
21502,
305,
29892,
4331,
29897,
13,
18884,
1583,
29889,
11808,
353,
29871,
29900,
13,
9651,
260,
29918,
7620,
29898,
4299,
29892,
285,
29908,
29912,
1311,
29889,
7620,
29918,
2084,
6822,
4375,
1254,
29918,
3198,
3149,
648,
1022,
2878,
3227,
10568,
3227,
791,
29918,
6758,
29901,
29889,
29953,
29888,
1836,
29886,
386,
29889,
12637,
1159,
13,
13,
1678,
822,
628,
29918,
1025,
29918,
9794,
29898,
1311,
29892,
3013,
29922,
29896,
29900,
1125,
13,
4706,
17117,
17117,
2066,
353,
2446,
29898,
20919,
29898,
1311,
29889,
7620,
29918,
2084,
876,
13,
4706,
934,
29918,
2798,
353,
7431,
29898,
5325,
29897,
13,
4706,
565,
934,
29918,
2798,
1405,
3013,
29901,
13,
9651,
363,
2030,
29918,
4299,
297,
2656,
29918,
26029,
29898,
5325,
29897,
7503,
17462,
458,
29906,
5387,
13,
18884,
3349,
29898,
2084,
29889,
7122,
29898,
1311,
29889,
7620,
29918,
2084,
29892,
2030,
29918,
4299,
876,
13,
13,
1678,
822,
4078,
29918,
3198,
3149,
29898,
1311,
29892,
659,
29918,
6758,
29892,
1904,
29892,
21502,
305,
29892,
4331,
29922,
29900,
1125,
13,
4706,
9995,
29903,
5989,
1904,
746,
8845,
6410,
23806,
13,
4706,
826,
3174,
29901,
13,
9651,
659,
29918,
6758,
313,
11116,
1125,
12953,
13,
9651,
1904,
313,
11116,
1125,
12953,
13,
9651,
21502,
305,
313,
11116,
1125,
12953,
13,
4706,
9995,
13,
4706,
396,
4078,
1900,
1904,
13,
4706,
565,
4331,
2804,
29871,
29900,
29901,
13,
9651,
4078,
29918,
15581,
353,
376,
8673,
29908,
13,
9651,
1596,
29898,
29888,
29908,
8308,
29962,
4078,
292,
1904,
472,
4331,
29901,
426,
10568,
29913,
297,
21502,
305,
426,
1022,
2878,
27195,
13,
9651,
1583,
29889,
6144,
29918,
1025,
29918,
9794,
580,
13,
9651,
260,
29918,
7620,
29898,
4299,
29892,
285,
29908,
29912,
1311,
29889,
7620,
29918,
2084,
6822,
29912,
7620,
29918,
15581,
29913,
3198,
3149,
648,
1022,
2878,
3227,
10568,
3227,
791,
29918,
6758,
1836,
29886,
386,
29889,
12637,
1159,
13,
4706,
1683,
29901,
13,
9651,
565,
659,
29918,
6758,
529,
1583,
29889,
10945,
29918,
1195,
29918,
6758,
29901,
13,
18884,
565,
1583,
29889,
369,
15828,
29901,
13,
462,
1678,
1596,
29898,
29888,
29908,
29961,
29930,
29962,
8845,
6410,
2407,
426,
29933,
5607,
29928,
1157,
791,
29918,
6758,
1157,
6154,
29934,
29913,
297,
21502,
305,
29901,
426,
29933,
5607,
29928,
1157,
1022,
2878,
1157,
6154,
29934,
29913,
28312,
10568,
27195,
13,
18884,
1583,
29889,
10945,
29918,
1195,
29918,
6758,
353,
659,
29918,
6758,
13,
18884,
4078,
29918,
15581,
353,
376,
13318,
12975,
13,
18884,
363,
934,
297,
885,
392,
381,
29898,
29888,
29908,
29912,
1311,
29889,
7620,
29918,
2084,
6822,
29912,
7620,
29918,
15581,
5038,
1125,
13,
462,
1678,
443,
2324,
29898,
1445,
29889,
2084,
29897,
13,
9651,
1683,
29901,
13,
18884,
4078,
29918,
15581,
353,
5124,
13,
13,
9651,
396,
1311,
29889,
6144,
29918,
1025,
29918,
9794,
580,
13,
13,
9651,
260,
29918,
7620,
29898,
4299,
29892,
285,
29908,
29912,
1311,
29889,
7620,
29918,
2084,
6822,
29912,
7620,
29918,
15581,
29913,
3198,
3149,
648,
1022,
2878,
3227,
10568,
3227,
791,
29918,
6758,
1836,
29886,
386,
29889,
12637,
1159,
13,
9651,
1583,
29889,
791,
29918,
6758,
29918,
1195,
353,
659,
29918,
6758,
13,
2
] |
ccn/graph_data.py | noahtren/Cooperative-Communication-Networks | 13 | 102389 | <reponame>noahtren/Cooperative-Communication-Networks
"""Representing trees as a subset of graph data structures, where all
information is provided as TensorFlow tensors during training time.
"""
import os
import random
import code
from typing import Dict
import tensorflow as tf
import numpy as np
from graphviz import Digraph
from tqdm import tqdm
class NodeType:
def __init__(self, token:str=None, is_value:bool=None, ordered_children:bool=None,
min_children:int=None, max_children:int=None, parent_blacklist=[]):
# input validation
assert (token is None) ^ (is_value is None), 'node type must be value XOR token'
if token:
assert ordered_children is not None, 'order_children must be specified for token node type'
assert max_children is not None, 'max_children must be specified for token node type'
assert min_children is not None, 'min_children must be specified for token node type'
else:
assert ordered_children is None, 'order_children should not be specified for value node type'
assert max_children is None, 'max_children should not be specified for token node type'
assert min_children is None, 'min_children should not be specified for token node type'
# assignment
self.token = token
self.is_value = is_value
self.ordered_children = ordered_children
self.min_children = min_children
self.max_children = max_children
self.parent_blacklist = parent_blacklist
LanguageSpecs = {
'arithmetic': {
'data_structure': 'tree',
'node_types': [
NodeType(is_value=True),
NodeType(token='+', ordered_children=False, min_children=2, max_children=3),
NodeType(token='-', ordered_children=True, min_children=2, max_children=2),
NodeType(token='*', ordered_children=False, min_children=2, max_children=3),
NodeType(token='/', ordered_children=True, min_children=2, max_children=2),
NodeType(token='abs', ordered_children=False, min_children=1, max_children=1, parent_blacklist=['abs']),
],
'value_tokens': ['a', 'b', 'c', 'd'],
'max_children': 3
}
}
class TensorGraph:
"""Representation of a graph data structure as TensorFlow tensors. All graphs
are defined by an adjacency matrix (adj) and node-wise features (nodes and
order.)
This implementation requires that edges are directed but not weighted.
`adj` is a matrix of shape [N, N] where the i, j index is 1 if i has a
directed edge to j, otherwise it is 0.
`node_features` is a dictionary of named node features, each of shape [n, ?]
where n is the maximum number of nodes and ? is the encoded feature space of
that feature.
`num_nodes` is an integer that is less than or equal to N. It is the number of
nodes that are actually in the graph.
"""
def __init__(self, adj:tf.Tensor, node_features:Dict[str, tf.Tensor],
num_nodes:int, attrs:dict, language_spec:str):
N = adj.shape[0]
assert adj.shape[0] == adj.shape[1]
for nf_name, node_feature in node_features.items():
assert node_feature.shape[0] == N, f'{nf_name} first dimension should match N ({N}), but was {node_feature.shape[0]}'
self.adj = adj
self.node_features = node_features
self.num_nodes = num_nodes
self.attrs = attrs
self.language_spec = language_spec
def visualize(self, name='unnamed', view=True):
dot = Digraph(name=name)
# nodes
node_names = []
for n_i in range(self.num_nodes):
ord_ = np.argmax(self.node_features['order'][n_i]) - 1
node_name = f"{self.attrs['value_tokens_list'][n_i]} ord={ord_}, i={n_i}"
dot.node(node_name)
node_names.append(node_name)
# edges
for n_i in range(self.num_nodes):
src_name = node_names[n_i]
for a_i, adj_bool in enumerate(self.adj[n_i]):
if adj_bool:
targ_name = node_names[a_i]
dot.edge(src_name, targ_name)
os.makedirs('gviz', exist_ok=True)
dot.render(os.path.join('gviz', f'{name}'), format='pdf', view=view)
@classmethod
def tree_to_instance(cls, adj_list:list, values_list:list, value_tokens_list:list,
order_list:list, max_nodes:int, language_spec:str):
"""Convert Python data types to a TensorGraph instance with max_nodes, using
padding where necessary. If the Python data has too many nodes (more than
`max_nodes`), then this function returns none.
"""
if len(adj_list) > max_nodes:
return None
pad_amt = max_nodes - len(adj_list)
# values and order lists are already in correct numpy format. they just need
# to be padded. padding only needs to occur along the first axis
values = np.stack(values_list)
order = np.stack(order_list)
values = np.pad(values, [[0, pad_amt], [0, 0]])
order = np.pad(order, [[0, pad_amt], [0, 0]])
adj_arrs = []
for adj_indices in adj_list:
adj_arr = np.zeros((len(adj_list)), dtype=np.int32)
for n_i in adj_indices:
adj_arr[n_i] = 1
adj_arrs.append(adj_arr)
adj = np.stack(adj_arrs)
adj = np.pad(adj, [[0, pad_amt], [0, pad_amt]])
return TensorGraph(adj,
node_features={
'values': values,
'order': order
},
num_nodes=len(adj_list),
attrs={
'value_tokens_list': value_tokens_list
},
language_spec=language_spec
)
@classmethod
def random_tree(cls, language_spec:str, min_num_values:int,
max_num_values:int, **kwargs):
"""Generate a random, valid tree based on a language spec. Trees are
generated as NumPy arrays and can be converted to TensorFlow tensors later.
"""
SPEC = LanguageSpecs[language_spec]
assert SPEC['data_structure'] == 'tree', \
f'can not make tree batch with {language_spec} because it is not for trees.'
adj_list = []
values_list = []
value_tokens_list = []
order_list = []
NUM_VALUE_TOKENS = len(SPEC['value_tokens'])
NON_VALUE_NODE_TYPES = [nt for nt in SPEC['node_types'] if not nt.is_value]
NUM_NODE_VALUES = len(NON_VALUE_NODE_TYPES) + NUM_VALUE_TOKENS
NUM_ORDER_INDICES = 1 + SPEC['max_children']
# make initial values
num_values = random.randint(min_num_values, max_num_values)
values = []
for val_num in range(num_values):
adj = []
val = np.zeros((NUM_NODE_VALUES), dtype=np.int32)
val_idx = random.randint(0, NUM_VALUE_TOKENS - 1)
val[val_idx] = 1
val_token = SPEC['value_tokens'][val_idx]
order = np.zeros((NUM_ORDER_INDICES), dtype=np.int32)
adj_list.append(adj)
values_list.append(val)
value_tokens_list.append(val_token)
order_list.append(order)
# build tree from node stack until it has a single value
tree_stack = list(range(num_values))
next_idx = len(tree_stack)
while len(tree_stack) != 1:
node_type_i = random.randint(0, len(NON_VALUE_NODE_TYPES) - 1)
new_node_type = NON_VALUE_NODE_TYPES[node_type_i]
child_select_num = min([
len(tree_stack),
random.randint(new_node_type.min_children, new_node_type.max_children)
])
valid_children = []
for child_i in tree_stack:
child_token = value_tokens_list[child_i]
if child_token not in new_node_type.parent_blacklist:
valid_children.append(child_i)
else:
pass
# print(f'IGNORE INDEX {child_i}')
children = random.sample(tree_stack, k=child_select_num)
# update child information
for o_i, child_i in enumerate(children):
if new_node_type.ordered_children:
order_list[child_i][o_i + 1] = 1
else:
order_list[child_i][0] = 1
# create parent information
p_adj = children
p_val = np.zeros((NUM_NODE_VALUES), dtype=np.int32)
p_val[NUM_VALUE_TOKENS + node_type_i] = 1
p_val_token = new_node_type.token
p_order = np.zeros((NUM_ORDER_INDICES), dtype=np.int32)
adj_list.append(p_adj)
values_list.append(p_val)
value_tokens_list.append(p_val_token)
order_list.append(p_order)
# update stack
for child_i in children:
tree_stack.remove(child_i)
tree_stack.append(next_idx)
next_idx += 1
# set root node order to unordered
order_list[-1][0] = 1
return adj_list, values_list, value_tokens_list, order_list
@classmethod
def parse_tree(cls, language_spec, adj_list, value_tokens_list, order_list, max_nodes):
"""Given an adjacency matrix, token names, and a list of token orders,
validate that it is a tree and then produce an instance of the tree as
a TensorGraph.
"""
SPEC = LanguageSpecs[language_spec]
NON_VALUE_NODE_TYPES = [nt for nt in SPEC['node_types'] if not nt.is_value]
NON_VALUE_NODE_TOKENS = [nt.token for nt in NON_VALUE_NODE_TYPES]
values = []
for token in value_tokens_list:
if token in NON_VALUE_NODE_TOKENS:
token_i = NON_VALUE_NODE_TOKENS.index(token) + len(NON_VALUE_NODE_TOKENS)
elif token in SPEC['value_tokens']:
token_i = SPEC['value_tokens'].index(token)
else:
raise RuntimeError(f"token {token} doesn't exist in spec '{language_spec}'")
value = np.zeros((len(NON_VALUE_NODE_TOKENS) + len(SPEC['value_tokens'])),
dtype=np.int32)
value[token_i] = 1
values.append(value)
orders = []
for order_idx in order_list:
order = np.zeros((1 + SPEC['max_children']), dtype=np.int32)
order[order_idx + 1] = 1
orders.append(order)
return adj_list, values, value_tokens_list, orders
@classmethod
def instances_to_tensors(cls, tensor_graphs:list):
"""Given a list of instances of this class, turn it into a training dataset
stored in memory.
Returns:
batched adj tensor
batched dictionary of node feature tensors
node_feature_specs dictionary, mapping node feature names to dimensionality
"""
adj = []
node_features = {}
node_feature_specs = {}
num_nodes = []
for tg in tensor_graphs:
adj.append(tg.adj)
num_nodes.append(tg.num_nodes)
for name, tensor in tg.node_features.items():
if name not in node_feature_specs:
node_features[name] = [tensor]
node_feature_specs[name] = tensor.shape[-1]
else:
node_features[name].append(tensor)
# stack along batch axis
adj = tf.stack(adj, axis=0)
node_features = {name: tf.cast(tf.stack(nf_list, axis=0), tf.float32) for name, nf_list in
node_features.items()}
num_nodes = tf.stack(num_nodes, axis=0)
return adj, node_features, node_feature_specs, num_nodes
def label_data(node_features, adj, num_nodes):
# postprocessing for data labels
nf_labels = {}
for name in node_features.keys():
empty_rows = (tf.math.reduce_max(node_features[name], axis=-1) == 0)[:, :, tf.newaxis]
empty_rows = tf.cast(empty_rows, tf.float32)
nf_labels[name] = tf.concat([node_features[name], empty_rows], axis=-1)
identity = tf.eye(adj.shape[1], adj.shape[1],
batch_shape=[adj.shape[0]], dtype=tf.int32)
# only apply identity matrix to nodes that exist
r = tf.range(adj.shape[1])
grid_max_idxs = tf.tile(
tf.expand_dims(
tf.math.maximum(r[tf.newaxis], r[:, tf.newaxis]), 0),
[num_nodes.shape[0], 1, 1]
)
identity = tf.where(grid_max_idxs < num_nodes[:, tf.newaxis, tf.newaxis],
identity, tf.zeros_like(identity))
# NOTE: I ran 2 experiments to prove that this provides a significant
# performance boost
adj_labels = adj + identity
return nf_labels, adj_labels
def get_dataset(language_spec:str, min_num_values:int, max_num_values:int,
max_nodes:int, num_samples:int, vis_first=False, test=False,
dummy=False, **kwargs):
instances = []
gen_name = 'train'
if test:
gen_name = 'test'
if dummy:
gen_name = 'dummy'
print(f"Generating {gen_name} dataset")
num_samples = num_samples // 5 if test else num_samples
pbar = tqdm(total=num_samples)
while len(instances) < num_samples:
# make tree
adj_list, values_list, value_tokens_list, order_list = \
TensorGraph.random_tree(language_spec, min_num_values, max_num_values)
# convert to instance
instance = TensorGraph.tree_to_instance(adj_list, values_list, value_tokens_list,
order_list, max_nodes, language_spec)
if instance is not None:
instances.append(instance)
pbar.update(1)
if vis_first and len(instances) == 1:
instance.visualize()
pbar.close()
adj, node_features, node_feature_specs, num_nodes = TensorGraph.instances_to_tensors(instances)
nf_labels, adj_labels = label_data(node_features, adj, num_nodes)
ds = {
'adj': adj,
'node_features': node_features,
'num_nodes': num_nodes,
'adj_labels': adj_labels,
'nf_labels': nf_labels
}
return ds, node_feature_specs
if __name__ == "__main__":
for _ in range(10000):
adj_list, values_list, value_tokens_list, order_list = TensorGraph.random_tree('arithmetic', 3, 5)
tg = TensorGraph.tree_to_instance(adj_list, values_list, value_tokens_list, order_list, 6, 'arithmetic')
if tg is not None:
tg.visualize()
code.interact(local={**locals(), **globals()})
| [
1,
529,
276,
1112,
420,
29958,
1217,
29874,
400,
1267,
29914,
7967,
3372,
1230,
29899,
5261,
2523,
362,
29899,
13724,
29879,
13,
15945,
29908,
1123,
6338,
292,
10697,
408,
263,
11306,
310,
3983,
848,
12286,
29892,
988,
599,
13,
19678,
338,
4944,
408,
323,
6073,
17907,
25187,
943,
2645,
6694,
931,
29889,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
5215,
4036,
13,
5215,
775,
13,
3166,
19229,
1053,
360,
919,
13,
13,
5215,
26110,
408,
15886,
13,
5215,
12655,
408,
7442,
13,
3166,
3983,
29894,
466,
1053,
10951,
1140,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
13,
13,
1990,
9071,
1542,
29901,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
5993,
29901,
710,
29922,
8516,
29892,
338,
29918,
1767,
29901,
11227,
29922,
8516,
29892,
10372,
29918,
11991,
29901,
11227,
29922,
8516,
29892,
29871,
13,
1669,
1375,
29918,
11991,
29901,
524,
29922,
8516,
29892,
4236,
29918,
11991,
29901,
524,
29922,
8516,
29892,
3847,
29918,
8517,
1761,
29922,
2636,
1125,
13,
1678,
396,
1881,
8845,
13,
1678,
4974,
313,
6979,
338,
6213,
29897,
6228,
313,
275,
29918,
1767,
338,
6213,
511,
525,
3177,
1134,
1818,
367,
995,
1060,
1955,
5993,
29915,
13,
1678,
565,
5993,
29901,
13,
418,
4974,
10372,
29918,
11991,
338,
451,
6213,
29892,
525,
2098,
29918,
11991,
1818,
367,
6790,
363,
5993,
2943,
1134,
29915,
13,
418,
4974,
4236,
29918,
11991,
338,
451,
6213,
29892,
525,
3317,
29918,
11991,
1818,
367,
6790,
363,
5993,
2943,
1134,
29915,
13,
418,
4974,
1375,
29918,
11991,
338,
451,
6213,
29892,
525,
1195,
29918,
11991,
1818,
367,
6790,
363,
5993,
2943,
1134,
29915,
13,
1678,
1683,
29901,
13,
418,
4974,
10372,
29918,
11991,
338,
6213,
29892,
525,
2098,
29918,
11991,
881,
451,
367,
6790,
363,
995,
2943,
1134,
29915,
13,
418,
4974,
4236,
29918,
11991,
338,
6213,
29892,
525,
3317,
29918,
11991,
881,
451,
367,
6790,
363,
5993,
2943,
1134,
29915,
13,
418,
4974,
1375,
29918,
11991,
338,
6213,
29892,
525,
1195,
29918,
11991,
881,
451,
367,
6790,
363,
5993,
2943,
1134,
29915,
13,
1678,
396,
12827,
13,
1678,
1583,
29889,
6979,
353,
5993,
13,
1678,
1583,
29889,
275,
29918,
1767,
353,
338,
29918,
1767,
13,
1678,
1583,
29889,
21693,
29918,
11991,
353,
10372,
29918,
11991,
13,
1678,
1583,
29889,
1195,
29918,
11991,
353,
1375,
29918,
11991,
13,
1678,
1583,
29889,
3317,
29918,
11991,
353,
4236,
29918,
11991,
13,
1678,
1583,
29889,
3560,
29918,
8517,
1761,
353,
3847,
29918,
8517,
1761,
13,
13,
13,
21233,
10649,
2395,
353,
426,
13,
29871,
525,
279,
18542,
2396,
426,
13,
1678,
525,
1272,
29918,
23905,
2396,
525,
8336,
742,
13,
1678,
525,
3177,
29918,
8768,
2396,
518,
13,
418,
9071,
1542,
29898,
275,
29918,
1767,
29922,
5574,
511,
13,
418,
9071,
1542,
29898,
6979,
2433,
29974,
742,
10372,
29918,
11991,
29922,
8824,
29892,
1375,
29918,
11991,
29922,
29906,
29892,
4236,
29918,
11991,
29922,
29941,
511,
13,
418,
9071,
1542,
29898,
6979,
2433,
29899,
742,
10372,
29918,
11991,
29922,
5574,
29892,
1375,
29918,
11991,
29922,
29906,
29892,
4236,
29918,
11991,
29922,
29906,
511,
13,
418,
9071,
1542,
29898,
6979,
2433,
29930,
742,
10372,
29918,
11991,
29922,
8824,
29892,
1375,
29918,
11991,
29922,
29906,
29892,
4236,
29918,
11991,
29922,
29941,
511,
13,
418,
9071,
1542,
29898,
6979,
2433,
29914,
742,
10372,
29918,
11991,
29922,
5574,
29892,
1375,
29918,
11991,
29922,
29906,
29892,
4236,
29918,
11991,
29922,
29906,
511,
13,
418,
9071,
1542,
29898,
6979,
2433,
6897,
742,
10372,
29918,
11991,
29922,
8824,
29892,
1375,
29918,
11991,
29922,
29896,
29892,
4236,
29918,
11991,
29922,
29896,
29892,
3847,
29918,
8517,
1761,
29922,
1839,
6897,
2033,
511,
13,
1678,
21251,
13,
1678,
525,
1767,
29918,
517,
12360,
2396,
6024,
29874,
742,
525,
29890,
742,
525,
29883,
742,
525,
29881,
7464,
13,
1678,
525,
3317,
29918,
11991,
2396,
29871,
29941,
13,
29871,
500,
13,
29913,
13,
13,
13,
1990,
323,
6073,
9527,
29901,
13,
29871,
9995,
1123,
26081,
310,
263,
3983,
848,
3829,
408,
323,
6073,
17907,
25187,
943,
29889,
2178,
18445,
13,
29871,
526,
3342,
491,
385,
12109,
562,
3819,
4636,
313,
26859,
29897,
322,
2943,
29899,
3538,
5680,
313,
18010,
322,
13,
29871,
1797,
1846,
13,
13,
29871,
910,
5314,
6858,
393,
12770,
526,
10624,
541,
451,
7688,
287,
29889,
13,
259,
13,
29871,
421,
26859,
29952,
338,
263,
4636,
310,
8267,
518,
29940,
29892,
405,
29962,
988,
278,
474,
29892,
432,
2380,
338,
29871,
29896,
565,
474,
756,
263,
13,
29871,
10624,
7636,
304,
432,
29892,
6467,
372,
338,
29871,
29900,
29889,
13,
13,
29871,
421,
3177,
29918,
22100,
29952,
338,
263,
8600,
310,
4257,
2943,
5680,
29892,
1269,
310,
8267,
518,
29876,
29892,
1577,
29962,
13,
29871,
988,
302,
338,
278,
7472,
1353,
310,
7573,
322,
1577,
338,
278,
18511,
4682,
2913,
310,
13,
29871,
393,
4682,
29889,
13,
13,
29871,
421,
1949,
29918,
18010,
29952,
338,
385,
6043,
393,
338,
3109,
1135,
470,
5186,
304,
405,
29889,
739,
338,
278,
1353,
310,
13,
29871,
7573,
393,
526,
2869,
297,
278,
3983,
29889,
13,
29871,
9995,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
12109,
29901,
13264,
29889,
29911,
6073,
29892,
2943,
29918,
22100,
29901,
21533,
29961,
710,
29892,
15886,
29889,
29911,
6073,
1402,
13,
1669,
954,
29918,
18010,
29901,
524,
29892,
12421,
29879,
29901,
8977,
29892,
4086,
29918,
6550,
29901,
710,
1125,
13,
1678,
405,
353,
12109,
29889,
12181,
29961,
29900,
29962,
13,
1678,
4974,
12109,
29889,
12181,
29961,
29900,
29962,
1275,
12109,
29889,
12181,
29961,
29896,
29962,
13,
1678,
363,
302,
29888,
29918,
978,
29892,
2943,
29918,
14394,
297,
2943,
29918,
22100,
29889,
7076,
7295,
13,
418,
4974,
2943,
29918,
14394,
29889,
12181,
29961,
29900,
29962,
1275,
405,
29892,
285,
29915,
29912,
29876,
29888,
29918,
978,
29913,
937,
9927,
881,
1993,
405,
21313,
29940,
9594,
541,
471,
426,
3177,
29918,
14394,
29889,
12181,
29961,
29900,
29962,
10162,
13,
1678,
1583,
29889,
26859,
353,
12109,
13,
1678,
1583,
29889,
3177,
29918,
22100,
353,
2943,
29918,
22100,
13,
1678,
1583,
29889,
1949,
29918,
18010,
353,
954,
29918,
18010,
13,
1678,
1583,
29889,
5552,
29879,
353,
12421,
29879,
13,
1678,
1583,
29889,
11675,
29918,
6550,
353,
4086,
29918,
6550,
13,
13,
13,
29871,
822,
7604,
675,
29898,
1311,
29892,
1024,
2433,
5963,
2795,
742,
1776,
29922,
5574,
1125,
13,
1678,
8329,
353,
10951,
1140,
29898,
978,
29922,
978,
29897,
13,
13,
1678,
396,
7573,
13,
1678,
2943,
29918,
7039,
353,
5159,
13,
1678,
363,
302,
29918,
29875,
297,
3464,
29898,
1311,
29889,
1949,
29918,
18010,
1125,
13,
418,
4356,
29918,
353,
7442,
29889,
1191,
3317,
29898,
1311,
29889,
3177,
29918,
22100,
1839,
2098,
2033,
29961,
29876,
29918,
29875,
2314,
448,
29871,
29896,
13,
418,
2943,
29918,
978,
353,
285,
29908,
29912,
1311,
29889,
5552,
29879,
1839,
1767,
29918,
517,
12360,
29918,
1761,
2033,
29961,
29876,
29918,
29875,
12258,
4356,
3790,
536,
29918,
1118,
474,
3790,
29876,
29918,
29875,
5038,
13,
418,
8329,
29889,
3177,
29898,
3177,
29918,
978,
29897,
13,
418,
2943,
29918,
7039,
29889,
4397,
29898,
3177,
29918,
978,
29897,
13,
13,
1678,
396,
12770,
13,
1678,
363,
302,
29918,
29875,
297,
3464,
29898,
1311,
29889,
1949,
29918,
18010,
1125,
13,
418,
4765,
29918,
978,
353,
2943,
29918,
7039,
29961,
29876,
29918,
29875,
29962,
13,
418,
363,
263,
29918,
29875,
29892,
12109,
29918,
11227,
297,
26985,
29898,
1311,
29889,
26859,
29961,
29876,
29918,
29875,
29962,
1125,
13,
4706,
565,
12109,
29918,
11227,
29901,
13,
3986,
260,
1191,
29918,
978,
353,
2943,
29918,
7039,
29961,
29874,
29918,
29875,
29962,
13,
3986,
8329,
29889,
12864,
29898,
4351,
29918,
978,
29892,
260,
1191,
29918,
978,
29897,
13,
13,
1678,
2897,
29889,
29885,
12535,
12935,
877,
29887,
29894,
466,
742,
1863,
29918,
554,
29922,
5574,
29897,
13,
1678,
8329,
29889,
9482,
29898,
359,
29889,
2084,
29889,
7122,
877,
29887,
29894,
466,
742,
285,
29915,
29912,
978,
29913,
5477,
3402,
2433,
5140,
742,
1776,
29922,
1493,
29897,
13,
13,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
5447,
29918,
517,
29918,
8758,
29898,
25932,
29892,
12109,
29918,
1761,
29901,
1761,
29892,
1819,
29918,
1761,
29901,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29901,
1761,
29892,
13,
462,
539,
1797,
29918,
1761,
29901,
1761,
29892,
4236,
29918,
18010,
29901,
524,
29892,
4086,
29918,
6550,
29901,
710,
1125,
13,
1678,
9995,
18455,
5132,
848,
4072,
304,
263,
323,
6073,
9527,
2777,
411,
4236,
29918,
18010,
29892,
773,
13,
1678,
7164,
988,
5181,
29889,
960,
278,
5132,
848,
756,
2086,
1784,
7573,
313,
5514,
1135,
13,
1678,
421,
3317,
29918,
18010,
19775,
769,
445,
740,
3639,
5642,
29889,
13,
1678,
9995,
13,
1678,
565,
7431,
29898,
26859,
29918,
1761,
29897,
1405,
4236,
29918,
18010,
29901,
13,
418,
736,
6213,
13,
13,
1678,
17132,
29918,
8035,
353,
4236,
29918,
18010,
448,
7431,
29898,
26859,
29918,
1761,
29897,
13,
1678,
396,
1819,
322,
1797,
8857,
526,
2307,
297,
1959,
12655,
3402,
29889,
896,
925,
817,
13,
1678,
396,
304,
367,
282,
23959,
29889,
7164,
871,
4225,
304,
6403,
3412,
278,
937,
9685,
13,
1678,
1819,
353,
7442,
29889,
1429,
29898,
5975,
29918,
1761,
29897,
13,
1678,
1797,
353,
7442,
29889,
1429,
29898,
2098,
29918,
1761,
29897,
13,
1678,
1819,
353,
7442,
29889,
8305,
29898,
5975,
29892,
5519,
29900,
29892,
17132,
29918,
8035,
1402,
518,
29900,
29892,
29871,
29900,
24960,
13,
1678,
1797,
353,
7442,
29889,
8305,
29898,
2098,
29892,
5519,
29900,
29892,
17132,
29918,
8035,
1402,
518,
29900,
29892,
29871,
29900,
24960,
13,
13,
1678,
12109,
29918,
279,
2288,
353,
5159,
13,
1678,
363,
12109,
29918,
513,
1575,
297,
12109,
29918,
1761,
29901,
13,
418,
12109,
29918,
2749,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
26859,
29918,
1761,
8243,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
363,
302,
29918,
29875,
297,
12109,
29918,
513,
1575,
29901,
13,
4706,
12109,
29918,
2749,
29961,
29876,
29918,
29875,
29962,
353,
29871,
29896,
13,
418,
12109,
29918,
279,
2288,
29889,
4397,
29898,
26859,
29918,
2749,
29897,
13,
268,
13,
1678,
12109,
353,
7442,
29889,
1429,
29898,
26859,
29918,
279,
2288,
29897,
13,
1678,
12109,
353,
7442,
29889,
8305,
29898,
26859,
29892,
5519,
29900,
29892,
17132,
29918,
8035,
1402,
518,
29900,
29892,
17132,
29918,
8035,
24960,
13,
13,
1678,
736,
323,
6073,
9527,
29898,
26859,
29892,
13,
418,
2943,
29918,
22100,
3790,
13,
4706,
525,
5975,
2396,
1819,
29892,
13,
4706,
525,
2098,
2396,
1797,
13,
418,
2981,
13,
418,
954,
29918,
18010,
29922,
2435,
29898,
26859,
29918,
1761,
511,
13,
418,
12421,
29879,
3790,
13,
4706,
525,
1767,
29918,
517,
12360,
29918,
1761,
2396,
995,
29918,
517,
12360,
29918,
1761,
13,
418,
2981,
13,
418,
4086,
29918,
6550,
29922,
11675,
29918,
6550,
13,
1678,
1723,
13,
13,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
4036,
29918,
8336,
29898,
25932,
29892,
4086,
29918,
6550,
29901,
710,
29892,
1375,
29918,
1949,
29918,
5975,
29901,
524,
29892,
13,
462,
29871,
4236,
29918,
1949,
29918,
5975,
29901,
524,
29892,
3579,
19290,
1125,
13,
1678,
9995,
5631,
403,
263,
4036,
29892,
2854,
5447,
2729,
373,
263,
4086,
1580,
29889,
6479,
267,
526,
13,
1678,
5759,
408,
11848,
19737,
7049,
322,
508,
367,
11543,
304,
323,
6073,
17907,
25187,
943,
2678,
29889,
13,
1678,
9995,
13,
1678,
317,
4162,
29907,
353,
17088,
10649,
2395,
29961,
11675,
29918,
6550,
29962,
13,
1678,
4974,
317,
4162,
29907,
1839,
1272,
29918,
23905,
2033,
1275,
525,
8336,
742,
320,
13,
418,
285,
29915,
3068,
451,
1207,
5447,
9853,
411,
426,
11675,
29918,
6550,
29913,
1363,
372,
338,
451,
363,
10697,
6169,
13,
13,
1678,
12109,
29918,
1761,
353,
5159,
13,
1678,
1819,
29918,
1761,
353,
5159,
13,
1678,
995,
29918,
517,
12360,
29918,
1761,
353,
5159,
13,
1678,
1797,
29918,
1761,
353,
5159,
13,
13,
1678,
28019,
29918,
19143,
29918,
4986,
29968,
1430,
29903,
353,
7431,
29898,
29903,
4162,
29907,
1839,
1767,
29918,
517,
12360,
11287,
13,
1678,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
353,
518,
593,
363,
302,
29873,
297,
317,
4162,
29907,
1839,
3177,
29918,
8768,
2033,
565,
451,
302,
29873,
29889,
275,
29918,
1767,
29962,
13,
1678,
28019,
29918,
6632,
2287,
29918,
8932,
12996,
353,
7431,
29898,
29940,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
29897,
718,
28019,
29918,
19143,
29918,
4986,
29968,
1430,
29903,
13,
1678,
28019,
29918,
22364,
29918,
22255,
2965,
2890,
353,
29871,
29896,
718,
317,
4162,
29907,
1839,
3317,
29918,
11991,
2033,
13,
13,
1678,
396,
1207,
2847,
1819,
13,
1678,
954,
29918,
5975,
353,
4036,
29889,
9502,
524,
29898,
1195,
29918,
1949,
29918,
5975,
29892,
4236,
29918,
1949,
29918,
5975,
29897,
13,
1678,
1819,
353,
5159,
13,
1678,
363,
659,
29918,
1949,
297,
3464,
29898,
1949,
29918,
5975,
1125,
13,
418,
12109,
353,
5159,
13,
418,
659,
353,
7442,
29889,
3298,
359,
3552,
13967,
29918,
6632,
2287,
29918,
8932,
12996,
511,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
659,
29918,
13140,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
28019,
29918,
19143,
29918,
4986,
29968,
1430,
29903,
448,
29871,
29896,
29897,
13,
418,
659,
29961,
791,
29918,
13140,
29962,
353,
29871,
29896,
13,
418,
659,
29918,
6979,
353,
317,
4162,
29907,
1839,
1767,
29918,
517,
12360,
2033,
29961,
791,
29918,
13140,
29962,
13,
418,
1797,
353,
7442,
29889,
3298,
359,
3552,
13967,
29918,
22364,
29918,
22255,
2965,
2890,
511,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
12109,
29918,
1761,
29889,
4397,
29898,
26859,
29897,
13,
418,
1819,
29918,
1761,
29889,
4397,
29898,
791,
29897,
13,
418,
995,
29918,
517,
12360,
29918,
1761,
29889,
4397,
29898,
791,
29918,
6979,
29897,
13,
418,
1797,
29918,
1761,
29889,
4397,
29898,
2098,
29897,
13,
268,
13,
1678,
396,
2048,
5447,
515,
2943,
5096,
2745,
372,
756,
263,
2323,
995,
13,
1678,
5447,
29918,
1429,
353,
1051,
29898,
3881,
29898,
1949,
29918,
5975,
876,
13,
13,
1678,
2446,
29918,
13140,
353,
7431,
29898,
8336,
29918,
1429,
29897,
13,
1678,
1550,
7431,
29898,
8336,
29918,
1429,
29897,
2804,
29871,
29896,
29901,
13,
418,
2943,
29918,
1853,
29918,
29875,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
29940,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
29897,
448,
29871,
29896,
29897,
13,
418,
716,
29918,
3177,
29918,
1853,
353,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
29961,
3177,
29918,
1853,
29918,
29875,
29962,
13,
418,
2278,
29918,
2622,
29918,
1949,
353,
1375,
4197,
13,
4706,
7431,
29898,
8336,
29918,
1429,
511,
13,
4706,
4036,
29889,
9502,
524,
29898,
1482,
29918,
3177,
29918,
1853,
29889,
1195,
29918,
11991,
29892,
716,
29918,
3177,
29918,
1853,
29889,
3317,
29918,
11991,
29897,
13,
539,
2314,
13,
418,
2854,
29918,
11991,
353,
5159,
13,
418,
363,
2278,
29918,
29875,
297,
5447,
29918,
1429,
29901,
13,
4706,
2278,
29918,
6979,
353,
995,
29918,
517,
12360,
29918,
1761,
29961,
5145,
29918,
29875,
29962,
13,
4706,
565,
2278,
29918,
6979,
451,
297,
716,
29918,
3177,
29918,
1853,
29889,
3560,
29918,
8517,
1761,
29901,
13,
3986,
2854,
29918,
11991,
29889,
4397,
29898,
5145,
29918,
29875,
29897,
13,
4706,
1683,
29901,
13,
3986,
1209,
13,
3986,
396,
1596,
29898,
29888,
29915,
6259,
6632,
1525,
2672,
19577,
426,
5145,
29918,
29875,
29913,
1495,
13,
13,
418,
4344,
353,
4036,
29889,
11249,
29898,
8336,
29918,
1429,
29892,
413,
29922,
5145,
29918,
2622,
29918,
1949,
29897,
13,
539,
13,
418,
396,
2767,
2278,
2472,
13,
418,
363,
288,
29918,
29875,
29892,
2278,
29918,
29875,
297,
26985,
29898,
11991,
1125,
13,
4706,
565,
716,
29918,
3177,
29918,
1853,
29889,
21693,
29918,
11991,
29901,
13,
3986,
1797,
29918,
1761,
29961,
5145,
29918,
29875,
3816,
29877,
29918,
29875,
718,
29871,
29896,
29962,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
3986,
1797,
29918,
1761,
29961,
5145,
29918,
29875,
3816,
29900,
29962,
353,
29871,
29896,
13,
13,
418,
396,
1653,
3847,
2472,
13,
418,
282,
29918,
26859,
353,
4344,
13,
418,
282,
29918,
791,
353,
7442,
29889,
3298,
359,
3552,
13967,
29918,
6632,
2287,
29918,
8932,
12996,
511,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
282,
29918,
791,
29961,
13967,
29918,
19143,
29918,
4986,
29968,
1430,
29903,
718,
2943,
29918,
1853,
29918,
29875,
29962,
353,
29871,
29896,
13,
418,
282,
29918,
791,
29918,
6979,
353,
716,
29918,
3177,
29918,
1853,
29889,
6979,
13,
418,
282,
29918,
2098,
353,
7442,
29889,
3298,
359,
3552,
13967,
29918,
22364,
29918,
22255,
2965,
2890,
511,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
12109,
29918,
1761,
29889,
4397,
29898,
29886,
29918,
26859,
29897,
13,
418,
1819,
29918,
1761,
29889,
4397,
29898,
29886,
29918,
791,
29897,
13,
418,
995,
29918,
517,
12360,
29918,
1761,
29889,
4397,
29898,
29886,
29918,
791,
29918,
6979,
29897,
13,
418,
1797,
29918,
1761,
29889,
4397,
29898,
29886,
29918,
2098,
29897,
13,
13,
418,
396,
2767,
5096,
13,
418,
363,
2278,
29918,
29875,
297,
4344,
29901,
13,
4706,
5447,
29918,
1429,
29889,
5992,
29898,
5145,
29918,
29875,
29897,
13,
418,
5447,
29918,
1429,
29889,
4397,
29898,
4622,
29918,
13140,
29897,
13,
418,
2446,
29918,
13140,
4619,
29871,
29896,
13,
268,
13,
1678,
396,
731,
3876,
2943,
1797,
304,
443,
21693,
13,
1678,
1797,
29918,
1761,
14352,
29896,
3816,
29900,
29962,
353,
29871,
29896,
13,
1678,
736,
12109,
29918,
1761,
29892,
1819,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
1797,
29918,
1761,
13,
13,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
6088,
29918,
8336,
29898,
25932,
29892,
4086,
29918,
6550,
29892,
12109,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
1797,
29918,
1761,
29892,
4236,
29918,
18010,
1125,
13,
1678,
9995,
29954,
5428,
385,
12109,
562,
3819,
4636,
29892,
5993,
2983,
29892,
322,
263,
1051,
310,
5993,
11299,
29892,
13,
1678,
12725,
393,
372,
338,
263,
5447,
322,
769,
7738,
385,
2777,
310,
278,
5447,
408,
13,
1678,
263,
323,
6073,
9527,
29889,
13,
1678,
9995,
13,
1678,
317,
4162,
29907,
353,
17088,
10649,
2395,
29961,
11675,
29918,
6550,
29962,
13,
1678,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
353,
518,
593,
363,
302,
29873,
297,
317,
4162,
29907,
1839,
3177,
29918,
8768,
2033,
565,
451,
302,
29873,
29889,
275,
29918,
1767,
29962,
13,
1678,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
4986,
29968,
1430,
29903,
353,
518,
593,
29889,
6979,
363,
302,
29873,
297,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
15631,
29925,
2890,
29962,
13,
13,
1678,
1819,
353,
5159,
13,
1678,
363,
5993,
297,
995,
29918,
517,
12360,
29918,
1761,
29901,
13,
418,
565,
5993,
297,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
4986,
29968,
1430,
29903,
29901,
13,
4706,
5993,
29918,
29875,
353,
405,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
4986,
29968,
1430,
29903,
29889,
2248,
29898,
6979,
29897,
718,
7431,
29898,
29940,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
4986,
29968,
1430,
29903,
29897,
13,
418,
25342,
5993,
297,
317,
4162,
29907,
1839,
1767,
29918,
517,
12360,
2033,
29901,
13,
4706,
5993,
29918,
29875,
353,
317,
4162,
29907,
1839,
1767,
29918,
517,
12360,
13359,
2248,
29898,
6979,
29897,
13,
418,
1683,
29901,
13,
4706,
12020,
24875,
2392,
29898,
29888,
29908,
6979,
426,
6979,
29913,
1838,
29915,
29873,
1863,
297,
1580,
22372,
11675,
29918,
6550,
10162,
1159,
13,
418,
995,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
29940,
1164,
29918,
19143,
29918,
6632,
2287,
29918,
4986,
29968,
1430,
29903,
29897,
718,
7431,
29898,
29903,
4162,
29907,
1839,
1767,
29918,
517,
12360,
2033,
8243,
13,
4706,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
995,
29961,
6979,
29918,
29875,
29962,
353,
29871,
29896,
13,
418,
1819,
29889,
4397,
29898,
1767,
29897,
13,
268,
13,
1678,
11299,
353,
5159,
13,
1678,
363,
1797,
29918,
13140,
297,
1797,
29918,
1761,
29901,
13,
418,
1797,
353,
7442,
29889,
3298,
359,
3552,
29896,
718,
317,
4162,
29907,
1839,
3317,
29918,
11991,
2033,
511,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
418,
1797,
29961,
2098,
29918,
13140,
718,
29871,
29896,
29962,
353,
29871,
29896,
13,
418,
11299,
29889,
4397,
29898,
2098,
29897,
13,
268,
13,
1678,
736,
12109,
29918,
1761,
29892,
1819,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
11299,
13,
13,
13,
29871,
732,
1990,
5696,
13,
29871,
822,
8871,
29918,
517,
29918,
29873,
575,
943,
29898,
25932,
29892,
12489,
29918,
4262,
29879,
29901,
1761,
1125,
13,
1678,
9995,
29954,
5428,
263,
1051,
310,
8871,
310,
445,
770,
29892,
2507,
372,
964,
263,
6694,
8783,
13,
1678,
6087,
297,
3370,
29889,
13,
13,
1678,
16969,
29901,
13,
418,
9853,
287,
12109,
12489,
13,
418,
9853,
287,
8600,
310,
2943,
4682,
25187,
943,
13,
418,
2943,
29918,
14394,
29918,
5965,
2395,
8600,
29892,
10417,
2943,
4682,
2983,
304,
22112,
537,
13,
1678,
9995,
13,
1678,
12109,
353,
5159,
13,
1678,
2943,
29918,
22100,
353,
6571,
13,
1678,
2943,
29918,
14394,
29918,
5965,
2395,
353,
6571,
13,
1678,
954,
29918,
18010,
353,
5159,
13,
1678,
363,
260,
29887,
297,
12489,
29918,
4262,
29879,
29901,
13,
418,
12109,
29889,
4397,
29898,
29873,
29887,
29889,
26859,
29897,
13,
418,
954,
29918,
18010,
29889,
4397,
29898,
29873,
29887,
29889,
1949,
29918,
18010,
29897,
13,
418,
363,
1024,
29892,
12489,
297,
260,
29887,
29889,
3177,
29918,
22100,
29889,
7076,
7295,
13,
4706,
565,
1024,
451,
297,
2943,
29918,
14394,
29918,
5965,
2395,
29901,
13,
3986,
2943,
29918,
22100,
29961,
978,
29962,
353,
518,
20158,
29962,
13,
3986,
2943,
29918,
14394,
29918,
5965,
2395,
29961,
978,
29962,
353,
12489,
29889,
12181,
14352,
29896,
29962,
13,
4706,
1683,
29901,
13,
3986,
2943,
29918,
22100,
29961,
978,
1822,
4397,
29898,
20158,
29897,
13,
1678,
396,
5096,
3412,
9853,
9685,
13,
1678,
12109,
353,
15886,
29889,
1429,
29898,
26859,
29892,
9685,
29922,
29900,
29897,
13,
1678,
2943,
29918,
22100,
353,
426,
978,
29901,
15886,
29889,
4384,
29898,
13264,
29889,
1429,
29898,
29876,
29888,
29918,
1761,
29892,
9685,
29922,
29900,
511,
15886,
29889,
7411,
29941,
29906,
29897,
363,
1024,
29892,
302,
29888,
29918,
1761,
297,
13,
418,
2943,
29918,
22100,
29889,
7076,
28296,
13,
1678,
954,
29918,
18010,
353,
15886,
29889,
1429,
29898,
1949,
29918,
18010,
29892,
9685,
29922,
29900,
29897,
13,
1678,
736,
12109,
29892,
2943,
29918,
22100,
29892,
2943,
29918,
14394,
29918,
5965,
2395,
29892,
954,
29918,
18010,
13,
13,
13,
1753,
3858,
29918,
1272,
29898,
3177,
29918,
22100,
29892,
12109,
29892,
954,
29918,
18010,
1125,
13,
29871,
396,
1400,
19170,
363,
848,
11073,
13,
29871,
302,
29888,
29918,
21134,
353,
6571,
13,
29871,
363,
1024,
297,
2943,
29918,
22100,
29889,
8149,
7295,
13,
1678,
4069,
29918,
5727,
353,
313,
13264,
29889,
755,
29889,
17469,
29918,
3317,
29898,
3177,
29918,
22100,
29961,
978,
1402,
9685,
10457,
29896,
29897,
1275,
29871,
29900,
29897,
7503,
29892,
584,
29892,
15886,
29889,
1482,
8990,
29962,
13,
1678,
4069,
29918,
5727,
353,
15886,
29889,
4384,
29898,
6310,
29918,
5727,
29892,
15886,
29889,
7411,
29941,
29906,
29897,
13,
1678,
302,
29888,
29918,
21134,
29961,
978,
29962,
353,
15886,
29889,
17685,
4197,
3177,
29918,
22100,
29961,
978,
1402,
4069,
29918,
5727,
1402,
9685,
10457,
29896,
29897,
13,
13,
29871,
10110,
353,
15886,
29889,
1032,
29872,
29898,
26859,
29889,
12181,
29961,
29896,
1402,
12109,
29889,
12181,
29961,
29896,
1402,
13,
1678,
9853,
29918,
12181,
11759,
26859,
29889,
12181,
29961,
29900,
20526,
26688,
29922,
13264,
29889,
524,
29941,
29906,
29897,
13,
29871,
396,
871,
3394,
10110,
4636,
304,
7573,
393,
1863,
13,
29871,
364,
353,
15886,
29889,
3881,
29898,
26859,
29889,
12181,
29961,
29896,
2314,
13,
29871,
6856,
29918,
3317,
29918,
333,
10351,
353,
15886,
29889,
29873,
488,
29898,
13,
1678,
15886,
29889,
18837,
29918,
6229,
29879,
29898,
13,
418,
15886,
29889,
755,
29889,
27525,
398,
29898,
29878,
29961,
13264,
29889,
1482,
8990,
1402,
364,
7503,
29892,
15886,
29889,
1482,
8990,
11724,
29871,
29900,
511,
13,
1678,
518,
1949,
29918,
18010,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
29892,
29871,
29896,
29962,
13,
29871,
1723,
13,
29871,
10110,
353,
15886,
29889,
3062,
29898,
7720,
29918,
3317,
29918,
333,
10351,
529,
954,
29918,
18010,
7503,
29892,
15886,
29889,
1482,
8990,
29892,
15886,
29889,
1482,
8990,
1402,
13,
1678,
10110,
29892,
15886,
29889,
3298,
359,
29918,
4561,
29898,
22350,
876,
13,
29871,
396,
6058,
29923,
29901,
306,
6350,
29871,
29906,
15729,
304,
6356,
393,
445,
8128,
263,
7282,
13,
29871,
396,
4180,
14505,
13,
29871,
12109,
29918,
21134,
353,
12109,
718,
10110,
13,
29871,
736,
302,
29888,
29918,
21134,
29892,
12109,
29918,
21134,
13,
13,
13,
1753,
679,
29918,
24713,
29898,
11675,
29918,
6550,
29901,
710,
29892,
1375,
29918,
1949,
29918,
5975,
29901,
524,
29892,
4236,
29918,
1949,
29918,
5975,
29901,
524,
29892,
13,
18884,
4236,
29918,
18010,
29901,
524,
29892,
954,
29918,
27736,
29901,
524,
29892,
1998,
29918,
4102,
29922,
8824,
29892,
1243,
29922,
8824,
29892,
13,
18884,
20254,
29922,
8824,
29892,
3579,
19290,
1125,
13,
29871,
8871,
353,
5159,
13,
29871,
2531,
29918,
978,
353,
525,
14968,
29915,
13,
29871,
565,
1243,
29901,
13,
1678,
2531,
29918,
978,
353,
525,
1688,
29915,
13,
29871,
565,
20254,
29901,
13,
1678,
2531,
29918,
978,
353,
525,
29881,
11770,
29915,
13,
29871,
1596,
29898,
29888,
29908,
5631,
1218,
426,
1885,
29918,
978,
29913,
8783,
1159,
13,
29871,
954,
29918,
27736,
353,
954,
29918,
27736,
849,
29871,
29945,
565,
1243,
1683,
954,
29918,
27736,
13,
29871,
282,
1646,
353,
260,
29939,
18933,
29898,
7827,
29922,
1949,
29918,
27736,
29897,
13,
29871,
1550,
7431,
29898,
2611,
2925,
29897,
529,
954,
29918,
27736,
29901,
13,
1678,
396,
1207,
5447,
13,
1678,
12109,
29918,
1761,
29892,
1819,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
1797,
29918,
1761,
353,
320,
13,
418,
323,
6073,
9527,
29889,
8172,
29918,
8336,
29898,
11675,
29918,
6550,
29892,
1375,
29918,
1949,
29918,
5975,
29892,
4236,
29918,
1949,
29918,
5975,
29897,
13,
1678,
396,
3588,
304,
2777,
13,
1678,
2777,
353,
323,
6073,
9527,
29889,
8336,
29918,
517,
29918,
8758,
29898,
26859,
29918,
1761,
29892,
1819,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
13,
418,
1797,
29918,
1761,
29892,
4236,
29918,
18010,
29892,
4086,
29918,
6550,
29897,
13,
1678,
565,
2777,
338,
451,
6213,
29901,
13,
418,
8871,
29889,
4397,
29898,
8758,
29897,
13,
418,
282,
1646,
29889,
5504,
29898,
29896,
29897,
13,
418,
565,
1998,
29918,
4102,
322,
7431,
29898,
2611,
2925,
29897,
1275,
29871,
29896,
29901,
13,
4706,
2777,
29889,
20119,
675,
580,
13,
29871,
282,
1646,
29889,
5358,
580,
13,
29871,
12109,
29892,
2943,
29918,
22100,
29892,
2943,
29918,
14394,
29918,
5965,
2395,
29892,
954,
29918,
18010,
353,
323,
6073,
9527,
29889,
2611,
2925,
29918,
517,
29918,
29873,
575,
943,
29898,
2611,
2925,
29897,
13,
29871,
302,
29888,
29918,
21134,
29892,
12109,
29918,
21134,
353,
3858,
29918,
1272,
29898,
3177,
29918,
22100,
29892,
12109,
29892,
954,
29918,
18010,
29897,
13,
29871,
18031,
353,
426,
13,
1678,
525,
26859,
2396,
12109,
29892,
13,
1678,
525,
3177,
29918,
22100,
2396,
2943,
29918,
22100,
29892,
13,
1678,
525,
1949,
29918,
18010,
2396,
954,
29918,
18010,
29892,
13,
1678,
525,
26859,
29918,
21134,
2396,
12109,
29918,
21134,
29892,
13,
1678,
525,
29876,
29888,
29918,
21134,
2396,
302,
29888,
29918,
21134,
13,
29871,
500,
13,
29871,
736,
18031,
29892,
2943,
29918,
14394,
29918,
5965,
2395,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
29871,
363,
903,
297,
3464,
29898,
29896,
29900,
29900,
29900,
29900,
1125,
13,
1678,
12109,
29918,
1761,
29892,
1819,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
1797,
29918,
1761,
353,
323,
6073,
9527,
29889,
8172,
29918,
8336,
877,
279,
18542,
742,
29871,
29941,
29892,
29871,
29945,
29897,
13,
1678,
260,
29887,
353,
323,
6073,
9527,
29889,
8336,
29918,
517,
29918,
8758,
29898,
26859,
29918,
1761,
29892,
1819,
29918,
1761,
29892,
995,
29918,
517,
12360,
29918,
1761,
29892,
1797,
29918,
1761,
29892,
29871,
29953,
29892,
525,
279,
18542,
1495,
13,
1678,
565,
260,
29887,
338,
451,
6213,
29901,
13,
418,
260,
29887,
29889,
20119,
675,
580,
13,
418,
775,
29889,
1639,
627,
29898,
2997,
3790,
1068,
2997,
29879,
3285,
3579,
23705,
1338,
580,
1800,
13,
2
] |
week_1/prime_num.py | Ashutosh781/QSTP-Kratos_electronics-Solutions | 0 | 109823 | <reponame>Ashutosh781/QSTP-Kratos_electronics-Solutions
#! /usr/bin/env python
#Asking for input until a list of 10 integers given
while True:
num = input("Enter a list of 10 integers separated by a ',' : ").split(',')
l = len(num)
try:
for i in range(l):
num[i] = int(num[i])
p = (l==10)
if p:
break
except:
continue
#Finding prime numbers
prime_num = []
for x in num:
if x > 1:
for i in range(2,((x//2)+1)):
if x % i == 0:
break
else:
prime_num.append(x)
elif x == 1: #Number 1 is not considered as prime
continue
else: #For any negative numbers or 0
continue
if len(prime_num) > 0:
print(f'Prime numbers from the given list are : {prime_num}')
else:
print("There were no prime numbers in the given list")
print("\nEnd") | [
1,
529,
276,
1112,
420,
29958,
29909,
845,
329,
10578,
29955,
29947,
29896,
29914,
29984,
1254,
29925,
29899,
29968,
3605,
359,
29918,
15436,
1617,
1199,
29899,
13296,
17925,
13,
29937,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
29937,
29909,
808,
292,
363,
1881,
2745,
263,
1051,
310,
29871,
29896,
29900,
11920,
2183,
13,
8000,
5852,
29901,
13,
1678,
954,
353,
1881,
703,
10399,
263,
1051,
310,
29871,
29896,
29900,
11920,
13055,
491,
263,
525,
5501,
584,
376,
467,
5451,
29317,
1495,
13,
1678,
301,
353,
7431,
29898,
1949,
29897,
13,
1678,
1018,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
29880,
1125,
13,
9651,
954,
29961,
29875,
29962,
353,
938,
29898,
1949,
29961,
29875,
2314,
13,
4706,
282,
353,
313,
29880,
1360,
29896,
29900,
29897,
13,
4706,
565,
282,
29901,
13,
9651,
2867,
13,
1678,
5174,
29901,
13,
4706,
6773,
13,
13,
13,
13,
29937,
29943,
4015,
6019,
3694,
13,
13,
10080,
29918,
1949,
353,
5159,
13,
13,
1454,
921,
297,
954,
29901,
13,
1678,
565,
921,
1405,
29871,
29896,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
29906,
29892,
3552,
29916,
458,
29906,
7240,
29896,
22164,
13,
9651,
565,
921,
1273,
474,
1275,
29871,
29900,
29901,
13,
18884,
2867,
13,
4706,
1683,
29901,
13,
9651,
6019,
29918,
1949,
29889,
4397,
29898,
29916,
29897,
13,
268,
13,
1678,
25342,
921,
1275,
29871,
29896,
29901,
396,
4557,
29871,
29896,
338,
451,
5545,
408,
6019,
13,
4706,
6773,
13,
1678,
1683,
29901,
396,
2831,
738,
8178,
3694,
470,
29871,
29900,
13,
4706,
6773,
13,
13,
361,
7431,
29898,
10080,
29918,
1949,
29897,
1405,
29871,
29900,
29901,
13,
1678,
1596,
29898,
29888,
29915,
4040,
603,
3694,
515,
278,
2183,
1051,
526,
584,
426,
10080,
29918,
1949,
29913,
1495,
13,
2870,
29901,
13,
1678,
1596,
703,
8439,
892,
694,
6019,
3694,
297,
278,
2183,
1051,
1159,
13,
13,
2158,
14182,
29876,
5044,
1159,
2
] |
TWT/apps/challenges/views/__init__.py | avibn/twtcodejam.net | 0 | 49488 | from .home import HomeView
from .logout import LogoutView
from .new import NewChallengeView
from .view import DetailView
from .test import TestView
from .end import EndView
from .start import StartView
from .stop_team import StopTeams
from .start_submission import StartSubmission
from .stop_submission import StopSubmission
from .start_team import StartTeams
from .unreleased import UnreleasedView
from .delete_challenge import DeleteView
from .start_voting import StartVoting
from .stop_voting import StopVoting
from .custom_page_view import CustomView
start = StartView.as_view()
end = EndView.as_view()
test = TestView.as_view()
logout = LogoutView.as_view()
new = NewChallengeView.as_view()
view = DetailView.as_view()
start_team = StartTeams.as_view()
stop_team = StopTeams.as_view()
start_submission = StartSubmission.as_view()
stop_submission = StopSubmission.as_view()
unreleased_view = UnreleasedView.as_view()
delete_view = DeleteView.as_view()
start_voting = StartVoting.as_view()
stop_voting = StopVoting.as_view()
view_custom = CustomView.as_view() | [
1,
515,
869,
5184,
1053,
8778,
1043,
13,
3166,
869,
1188,
449,
1053,
4522,
449,
1043,
13,
3166,
869,
1482,
1053,
1570,
1451,
11768,
1043,
13,
3166,
869,
1493,
1053,
5953,
737,
1043,
13,
3166,
869,
1688,
1053,
4321,
1043,
13,
3166,
869,
355,
1053,
2796,
1043,
13,
3166,
869,
2962,
1053,
7370,
1043,
13,
3166,
869,
9847,
29918,
14318,
1053,
22303,
7141,
2232,
13,
3166,
869,
2962,
29918,
1491,
6737,
1053,
7370,
4035,
6737,
13,
3166,
869,
9847,
29918,
1491,
6737,
1053,
22303,
4035,
6737,
13,
3166,
869,
2962,
29918,
14318,
1053,
7370,
7141,
2232,
13,
3166,
869,
348,
276,
4611,
1053,
853,
276,
4611,
1043,
13,
3166,
869,
8143,
29918,
305,
11768,
1053,
21267,
1043,
13,
3166,
869,
2962,
29918,
29894,
11427,
1053,
7370,
29963,
11427,
13,
3166,
869,
9847,
29918,
29894,
11427,
1053,
22303,
29963,
11427,
13,
3166,
869,
6341,
29918,
3488,
29918,
1493,
1053,
8701,
1043,
13,
2962,
353,
7370,
1043,
29889,
294,
29918,
1493,
580,
13,
355,
353,
2796,
1043,
29889,
294,
29918,
1493,
580,
13,
1688,
353,
4321,
1043,
29889,
294,
29918,
1493,
580,
13,
1188,
449,
353,
4522,
449,
1043,
29889,
294,
29918,
1493,
580,
13,
1482,
353,
1570,
1451,
11768,
1043,
29889,
294,
29918,
1493,
580,
13,
1493,
353,
5953,
737,
1043,
29889,
294,
29918,
1493,
580,
13,
2962,
29918,
14318,
353,
7370,
7141,
2232,
29889,
294,
29918,
1493,
580,
13,
9847,
29918,
14318,
353,
22303,
7141,
2232,
29889,
294,
29918,
1493,
580,
13,
2962,
29918,
1491,
6737,
353,
7370,
4035,
6737,
29889,
294,
29918,
1493,
580,
13,
9847,
29918,
1491,
6737,
353,
22303,
4035,
6737,
29889,
294,
29918,
1493,
580,
13,
348,
276,
4611,
29918,
1493,
353,
853,
276,
4611,
1043,
29889,
294,
29918,
1493,
580,
13,
8143,
29918,
1493,
353,
21267,
1043,
29889,
294,
29918,
1493,
580,
13,
2962,
29918,
29894,
11427,
353,
7370,
29963,
11427,
29889,
294,
29918,
1493,
580,
13,
9847,
29918,
29894,
11427,
353,
22303,
29963,
11427,
29889,
294,
29918,
1493,
580,
13,
1493,
29918,
6341,
353,
8701,
1043,
29889,
294,
29918,
1493,
580,
2
] |
active_reward_learning/common/constants.py | david-lindner/idrl | 9 | 146690 | <gh_stars>1-10
import os
from collections import defaultdict, namedtuple
PLOTS_FOLDER = "plots"
ENV_FOLDER = "envs"
MODELS_FOLDER = "models"
BASE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")
PLOTS_PATH = os.path.join(BASE_PATH, PLOTS_FOLDER)
ENV_PATH = os.path.join(BASE_PATH, ENV_FOLDER)
MODELS_PATH = os.path.join(BASE_PATH, MODELS_FOLDER)
TELEGRAM_TOKEN = ""
TELEGRAM_MESSAGE_ID = 0
# source: https://gist.github.com/thriveth/8560036
color_cycle = [
"#377eb8",
"#ff7f00",
"#4daf4a",
"#e41a1c",
"#dede00",
"#999999",
"#f781bf",
"#a65628",
"#984ea3",
]
hatch_cycle = ["/", "\\", "|", "-", "+", "x", "o", "O", ".", "*"]
marker_cycle = ["*", "^", "o", "x", "d", "+", "v", "."]
# pygame keys
keys_nt = namedtuple(
"keys_nt",
[
"RIGHT",
"LEFT",
"UP",
"DOWN",
"ONE",
"TWO",
"THREE",
"FOUR",
"FIVE",
"SIX",
"SEVEN",
"EIGTH",
"NINE",
"ZERO",
],
)
KEYS = keys_nt(
275,
276,
273,
274,
ord("1"),
ord("2"),
ord("3"),
ord("4"),
ord("5"),
ord("6"),
ord("7"),
ord("8"),
ord("9"),
ord("0"),
)
# LEGACY
KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN = 275, 276, 273, 274
# Acquisition functions
LABELS = {
"rand": "random",
"rand_unobs": "random_unobserved",
"var": "variance",
"pi": "probability_of_improvement",
"ei": "expected_improvement",
"epd": "expected_policy_divergence",
"idrl": "directed_information_gain",
"evr": "expected_volume_removal",
"evrb": "expected_volume_removal_bernoulli",
"maxreg": "maximum_regret",
}
color_cycle = [
"#377eb8",
"#ff7f00",
"#4daf4a",
"#e41a1c",
"#dede00",
"#999999",
"#f781bf",
"#a65628",
"#984ea3",
]
## dig is deprecated but was still in some results
AF_COLORS = {
"rand": "#4daf4a",
"var": "#984ea3",
"ei": "#ff7f00",
"epd": "#377eb8",
"idrl": "#e41a1c",
"maxreg": "#b3b300",
}
AF_COLORS = defaultdict(lambda: "blue", AF_COLORS)
AF_MARKERS = {
"rand": "s",
"var": "^",
"ei": "d",
"epd": "x",
"idrl": "o",
"maxreg": "v",
}
AF_MARKERS = defaultdict(lambda: ".", AF_MARKERS)
AF_ALPHA = {
"idrl": 1.0,
}
AF_ALPHA = defaultdict(lambda: 0.6, AF_ALPHA)
AF_ZORDER = {
"idrl": 2,
}
AF_ZORDER = defaultdict(lambda: 1, AF_ZORDER)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
2897,
13,
3166,
16250,
1053,
2322,
8977,
29892,
4257,
23583,
13,
13,
7390,
2891,
29903,
29918,
29943,
5607,
8032,
353,
376,
26762,
29908,
13,
25838,
29918,
29943,
5607,
8032,
353,
376,
264,
4270,
29908,
13,
20387,
8547,
29918,
29943,
5607,
8032,
353,
376,
9794,
29908,
13,
13,
25416,
29918,
10145,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
8243,
376,
636,
613,
376,
636,
1159,
13,
7390,
2891,
29903,
29918,
10145,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
10145,
29892,
16507,
2891,
29903,
29918,
29943,
5607,
8032,
29897,
13,
25838,
29918,
10145,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
10145,
29892,
12524,
29963,
29918,
29943,
5607,
8032,
29897,
13,
20387,
8547,
29918,
10145,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25416,
29918,
10145,
29892,
16999,
2287,
8547,
29918,
29943,
5607,
8032,
29897,
13,
13,
4330,
1307,
29954,
25058,
29918,
4986,
29968,
1430,
353,
5124,
13,
4330,
1307,
29954,
25058,
29918,
2303,
1799,
10461,
29918,
1367,
353,
29871,
29900,
13,
13,
29937,
2752,
29901,
2045,
597,
29887,
391,
29889,
3292,
29889,
510,
29914,
386,
1150,
621,
29914,
29947,
29945,
29953,
29900,
29900,
29941,
29953,
13,
2780,
29918,
23090,
353,
518,
13,
1678,
12305,
29941,
29955,
29955,
774,
29947,
613,
13,
1678,
12305,
600,
29955,
29888,
29900,
29900,
613,
13,
1678,
12305,
29946,
1388,
29888,
29946,
29874,
613,
13,
1678,
12305,
29872,
29946,
29896,
29874,
29896,
29883,
613,
13,
1678,
12305,
29881,
2742,
29900,
29900,
613,
13,
1678,
12305,
29929,
29929,
29929,
29929,
29929,
29929,
613,
13,
1678,
12305,
29888,
29955,
29947,
29896,
1635,
613,
13,
1678,
12305,
29874,
29953,
29945,
29953,
29906,
29947,
613,
13,
1678,
12305,
29929,
29947,
29946,
11248,
29941,
613,
13,
29962,
13,
13,
29882,
905,
29918,
23090,
353,
6796,
29914,
613,
376,
1966,
613,
376,
29989,
613,
11663,
613,
15691,
613,
376,
29916,
613,
376,
29877,
613,
376,
29949,
613,
11393,
613,
26345,
3108,
13,
13,
22976,
29918,
23090,
353,
6796,
29930,
613,
13898,
613,
376,
29877,
613,
376,
29916,
613,
376,
29881,
613,
15691,
613,
376,
29894,
613,
376,
1213,
29962,
13,
13,
13,
29937,
22028,
6611,
13,
8149,
29918,
593,
353,
4257,
23583,
29898,
13,
1678,
376,
8149,
29918,
593,
613,
13,
1678,
518,
13,
4706,
376,
22789,
3912,
613,
13,
4706,
376,
28024,
613,
13,
4706,
376,
4897,
613,
13,
4706,
376,
3970,
16048,
613,
13,
4706,
376,
12413,
613,
13,
4706,
376,
16240,
29949,
613,
13,
4706,
376,
4690,
21661,
613,
13,
4706,
376,
5800,
4574,
613,
13,
4706,
376,
3738,
12064,
613,
13,
4706,
376,
5425,
29990,
613,
13,
4706,
376,
1660,
29963,
1430,
613,
13,
4706,
376,
29923,
6259,
4690,
613,
13,
4706,
376,
29940,
8895,
613,
13,
4706,
376,
29999,
1001,
29949,
613,
13,
1678,
21251,
13,
29897,
13,
10818,
29903,
353,
6611,
29918,
593,
29898,
13,
268,
29906,
29955,
29945,
29892,
13,
268,
29906,
29955,
29953,
29892,
13,
268,
29906,
29955,
29941,
29892,
13,
268,
29906,
29955,
29946,
29892,
13,
1678,
4356,
703,
29896,
4968,
13,
1678,
4356,
703,
29906,
4968,
13,
1678,
4356,
703,
29941,
4968,
13,
1678,
4356,
703,
29946,
4968,
13,
1678,
4356,
703,
29945,
4968,
13,
1678,
4356,
703,
29953,
4968,
13,
1678,
4356,
703,
29955,
4968,
13,
1678,
4356,
703,
29947,
4968,
13,
1678,
4356,
703,
29929,
4968,
13,
1678,
4356,
703,
29900,
4968,
13,
29897,
13,
13,
29937,
11060,
29954,
2477,
29979,
13,
10818,
29918,
22789,
3912,
29892,
14636,
29918,
28024,
29892,
14636,
29918,
4897,
29892,
14636,
29918,
3970,
16048,
353,
29871,
29906,
29955,
29945,
29892,
29871,
29906,
29955,
29953,
29892,
29871,
29906,
29955,
29941,
29892,
29871,
29906,
29955,
29946,
13,
13,
13,
29937,
7255,
23493,
3168,
13,
13,
24461,
6670,
29903,
353,
426,
13,
1678,
376,
9502,
1115,
376,
8172,
613,
13,
1678,
376,
9502,
29918,
348,
26290,
1115,
376,
8172,
29918,
348,
711,
643,
1490,
613,
13,
1678,
376,
1707,
1115,
376,
1707,
8837,
613,
13,
1678,
376,
1631,
1115,
376,
22795,
3097,
29918,
974,
29918,
326,
16123,
882,
613,
13,
1678,
376,
10096,
1115,
376,
9684,
29918,
326,
16123,
882,
613,
13,
1678,
376,
1022,
29881,
1115,
376,
9684,
29918,
22197,
29918,
29881,
2147,
10238,
613,
13,
1678,
376,
333,
2096,
1115,
376,
11851,
287,
29918,
19678,
29918,
29887,
475,
613,
13,
1678,
376,
5750,
29878,
1115,
376,
9684,
29918,
24623,
29918,
1745,
10611,
613,
13,
1678,
376,
5750,
6050,
1115,
376,
9684,
29918,
24623,
29918,
1745,
10611,
29918,
5892,
5059,
492,
613,
13,
1678,
376,
3317,
1727,
1115,
376,
27525,
398,
29918,
1727,
2267,
613,
13,
29913,
13,
13,
2780,
29918,
23090,
353,
518,
13,
1678,
12305,
29941,
29955,
29955,
774,
29947,
613,
13,
1678,
12305,
600,
29955,
29888,
29900,
29900,
613,
13,
1678,
12305,
29946,
1388,
29888,
29946,
29874,
613,
13,
1678,
12305,
29872,
29946,
29896,
29874,
29896,
29883,
613,
13,
1678,
12305,
29881,
2742,
29900,
29900,
613,
13,
1678,
12305,
29929,
29929,
29929,
29929,
29929,
29929,
613,
13,
1678,
12305,
29888,
29955,
29947,
29896,
1635,
613,
13,
1678,
12305,
29874,
29953,
29945,
29953,
29906,
29947,
613,
13,
1678,
12305,
29929,
29947,
29946,
11248,
29941,
613,
13,
29962,
13,
13,
2277,
4697,
338,
18164,
541,
471,
1603,
297,
777,
2582,
13,
13,
5098,
29918,
15032,
24125,
353,
426,
13,
1678,
376,
9502,
1115,
12305,
29946,
1388,
29888,
29946,
29874,
613,
13,
1678,
376,
1707,
1115,
12305,
29929,
29947,
29946,
11248,
29941,
613,
13,
1678,
376,
10096,
1115,
12305,
600,
29955,
29888,
29900,
29900,
613,
13,
1678,
376,
1022,
29881,
1115,
12305,
29941,
29955,
29955,
774,
29947,
613,
13,
1678,
376,
333,
2096,
1115,
12305,
29872,
29946,
29896,
29874,
29896,
29883,
613,
13,
1678,
376,
3317,
1727,
1115,
12305,
29890,
29941,
29890,
29941,
29900,
29900,
613,
13,
29913,
13,
5098,
29918,
15032,
24125,
353,
2322,
8977,
29898,
2892,
29901,
376,
9539,
613,
23844,
29918,
15032,
24125,
29897,
13,
13,
5098,
29918,
1529,
29934,
29968,
23598,
353,
426,
13,
1678,
376,
9502,
1115,
376,
29879,
613,
13,
1678,
376,
1707,
1115,
13898,
613,
13,
1678,
376,
10096,
1115,
376,
29881,
613,
13,
1678,
376,
1022,
29881,
1115,
376,
29916,
613,
13,
1678,
376,
333,
2096,
1115,
376,
29877,
613,
13,
1678,
376,
3317,
1727,
1115,
376,
29894,
613,
13,
29913,
13,
5098,
29918,
1529,
29934,
29968,
23598,
353,
2322,
8977,
29898,
2892,
29901,
11393,
613,
23844,
29918,
1529,
29934,
29968,
23598,
29897,
13,
13,
5098,
29918,
1964,
29925,
15715,
353,
426,
13,
1678,
376,
333,
2096,
1115,
29871,
29896,
29889,
29900,
29892,
13,
29913,
13,
5098,
29918,
1964,
29925,
15715,
353,
2322,
8977,
29898,
2892,
29901,
29871,
29900,
29889,
29953,
29892,
23844,
29918,
1964,
29925,
15715,
29897,
13,
13,
5098,
29918,
29999,
22364,
353,
426,
13,
1678,
376,
333,
2096,
1115,
29871,
29906,
29892,
13,
29913,
13,
5098,
29918,
29999,
22364,
353,
2322,
8977,
29898,
2892,
29901,
29871,
29896,
29892,
23844,
29918,
29999,
22364,
29897,
13,
2
] |
evaluation/lcnn/postprocess.py | mlpc-ucsd/LETR | 90 | 24271 | import numpy as np
def pline(x1, y1, x2, y2, x, y):
px = x2 - x1
py = y2 - y1
dd = px * px + py * py
u = ((x - x1) * px + (y - y1) * py) / max(1e-9, float(dd))
dx = x1 + u * px - x
dy = y1 + u * py - y
return dx * dx + dy * dy
def psegment(x1, y1, x2, y2, x, y):
px = x2 - x1
py = y2 - y1
dd = px * px + py * py
u = max(min(((x - x1) * px + (y - y1) * py) / float(dd), 1), 0)
dx = x1 + u * px - x
dy = y1 + u * py - y
return dx * dx + dy * dy
def plambda(x1, y1, x2, y2, x, y):
px = x2 - x1
py = y2 - y1
dd = px * px + py * py
return ((x - x1) * px + (y - y1) * py) / max(1e-9, float(dd))
def postprocess(lines, scores, threshold=0.01, tol=1e9, do_clip=False):
nlines, nscores = [], []
for (p, q), score in zip(lines, scores):
start, end = 0, 1
for a, b in nlines: # nlines: Selected lines.
if (
min(
max(pline(*p, *q, *a), pline(*p, *q, *b)),
max(pline(*a, *b, *p), pline(*a, *b, *q)),
)
> threshold ** 2
):
continue
lambda_a = plambda(*p, *q, *a)
lambda_b = plambda(*p, *q, *b)
if lambda_a > lambda_b:
lambda_a, lambda_b = lambda_b, lambda_a
lambda_a -= tol
lambda_b += tol
# case 1: skip (if not do_clip)
if start < lambda_a and lambda_b < end:
continue
# not intersect
if lambda_b < start or lambda_a > end:
continue
# cover
if lambda_a <= start and end <= lambda_b:
start = 10
break
# case 2 & 3:
if lambda_a <= start and start <= lambda_b:
start = lambda_b
if lambda_a <= end and end <= lambda_b:
end = lambda_a
if start >= end:
break
if start >= end:
continue
nlines.append(np.array([p + (q - p) * start, p + (q - p) * end]))
nscores.append(score)
return np.array(nlines), np.array(nscores)
| [
1,
1053,
12655,
408,
7442,
13,
13,
13,
1753,
715,
457,
29898,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29892,
921,
29892,
343,
1125,
13,
1678,
282,
29916,
353,
921,
29906,
448,
921,
29896,
13,
1678,
11451,
353,
343,
29906,
448,
343,
29896,
13,
1678,
24488,
353,
282,
29916,
334,
282,
29916,
718,
11451,
334,
11451,
13,
1678,
318,
353,
5135,
29916,
448,
921,
29896,
29897,
334,
282,
29916,
718,
313,
29891,
448,
343,
29896,
29897,
334,
11451,
29897,
847,
4236,
29898,
29896,
29872,
29899,
29929,
29892,
5785,
29898,
1289,
876,
13,
1678,
15414,
353,
921,
29896,
718,
318,
334,
282,
29916,
448,
921,
13,
1678,
13475,
353,
343,
29896,
718,
318,
334,
11451,
448,
343,
13,
1678,
736,
15414,
334,
15414,
718,
13475,
334,
13475,
13,
13,
13,
1753,
282,
28192,
29898,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29892,
921,
29892,
343,
1125,
13,
1678,
282,
29916,
353,
921,
29906,
448,
921,
29896,
13,
1678,
11451,
353,
343,
29906,
448,
343,
29896,
13,
1678,
24488,
353,
282,
29916,
334,
282,
29916,
718,
11451,
334,
11451,
13,
1678,
318,
353,
4236,
29898,
1195,
3552,
29898,
29916,
448,
921,
29896,
29897,
334,
282,
29916,
718,
313,
29891,
448,
343,
29896,
29897,
334,
11451,
29897,
847,
5785,
29898,
1289,
511,
29871,
29896,
511,
29871,
29900,
29897,
13,
1678,
15414,
353,
921,
29896,
718,
318,
334,
282,
29916,
448,
921,
13,
1678,
13475,
353,
343,
29896,
718,
318,
334,
11451,
448,
343,
13,
1678,
736,
15414,
334,
15414,
718,
13475,
334,
13475,
13,
13,
13,
1753,
715,
2269,
29898,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29892,
921,
29892,
343,
1125,
13,
1678,
282,
29916,
353,
921,
29906,
448,
921,
29896,
13,
1678,
11451,
353,
343,
29906,
448,
343,
29896,
13,
1678,
24488,
353,
282,
29916,
334,
282,
29916,
718,
11451,
334,
11451,
13,
1678,
736,
5135,
29916,
448,
921,
29896,
29897,
334,
282,
29916,
718,
313,
29891,
448,
343,
29896,
29897,
334,
11451,
29897,
847,
4236,
29898,
29896,
29872,
29899,
29929,
29892,
5785,
29898,
1289,
876,
13,
13,
13,
1753,
1400,
5014,
29898,
9012,
29892,
19435,
29892,
16897,
29922,
29900,
29889,
29900,
29896,
29892,
304,
29880,
29922,
29896,
29872,
29929,
29892,
437,
29918,
24049,
29922,
8824,
1125,
13,
1678,
302,
9012,
29892,
302,
1557,
2361,
353,
19997,
5159,
13,
1678,
363,
313,
29886,
29892,
3855,
511,
8158,
297,
14319,
29898,
9012,
29892,
19435,
1125,
13,
4706,
1369,
29892,
1095,
353,
29871,
29900,
29892,
29871,
29896,
13,
4706,
363,
263,
29892,
289,
297,
302,
9012,
29901,
29871,
396,
302,
9012,
29901,
22012,
3454,
29889,
13,
9651,
565,
313,
13,
18884,
1375,
29898,
13,
462,
1678,
4236,
29898,
572,
457,
10456,
29886,
29892,
334,
29939,
29892,
334,
29874,
511,
715,
457,
10456,
29886,
29892,
334,
29939,
29892,
334,
29890,
8243,
13,
462,
1678,
4236,
29898,
572,
457,
10456,
29874,
29892,
334,
29890,
29892,
334,
29886,
511,
715,
457,
10456,
29874,
29892,
334,
29890,
29892,
334,
29939,
8243,
13,
18884,
1723,
13,
18884,
1405,
16897,
3579,
29871,
29906,
13,
632,
1125,
13,
18884,
6773,
13,
9651,
14013,
29918,
29874,
353,
715,
2269,
10456,
29886,
29892,
334,
29939,
29892,
334,
29874,
29897,
13,
9651,
14013,
29918,
29890,
353,
715,
2269,
10456,
29886,
29892,
334,
29939,
29892,
334,
29890,
29897,
13,
9651,
565,
14013,
29918,
29874,
1405,
14013,
29918,
29890,
29901,
13,
18884,
14013,
29918,
29874,
29892,
14013,
29918,
29890,
353,
14013,
29918,
29890,
29892,
14013,
29918,
29874,
13,
9651,
14013,
29918,
29874,
22361,
304,
29880,
13,
9651,
14013,
29918,
29890,
4619,
304,
29880,
13,
13,
9651,
396,
1206,
29871,
29896,
29901,
14383,
313,
361,
451,
437,
29918,
24049,
29897,
13,
9651,
565,
1369,
529,
14013,
29918,
29874,
322,
14013,
29918,
29890,
529,
1095,
29901,
13,
18884,
6773,
13,
13,
9651,
396,
451,
25869,
13,
9651,
565,
14013,
29918,
29890,
529,
1369,
470,
14013,
29918,
29874,
1405,
1095,
29901,
13,
18884,
6773,
13,
13,
9651,
396,
4612,
13,
9651,
565,
14013,
29918,
29874,
5277,
1369,
322,
1095,
5277,
14013,
29918,
29890,
29901,
13,
18884,
1369,
353,
29871,
29896,
29900,
13,
18884,
2867,
13,
13,
9651,
396,
1206,
29871,
29906,
669,
29871,
29941,
29901,
13,
9651,
565,
14013,
29918,
29874,
5277,
1369,
322,
1369,
5277,
14013,
29918,
29890,
29901,
13,
18884,
1369,
353,
14013,
29918,
29890,
13,
9651,
565,
14013,
29918,
29874,
5277,
1095,
322,
1095,
5277,
14013,
29918,
29890,
29901,
13,
18884,
1095,
353,
14013,
29918,
29874,
13,
13,
9651,
565,
1369,
6736,
1095,
29901,
13,
18884,
2867,
13,
13,
4706,
565,
1369,
6736,
1095,
29901,
13,
9651,
6773,
13,
4706,
302,
9012,
29889,
4397,
29898,
9302,
29889,
2378,
4197,
29886,
718,
313,
29939,
448,
282,
29897,
334,
1369,
29892,
282,
718,
313,
29939,
448,
282,
29897,
334,
1095,
12622,
13,
4706,
302,
1557,
2361,
29889,
4397,
29898,
13628,
29897,
13,
1678,
736,
7442,
29889,
2378,
29898,
29876,
9012,
511,
7442,
29889,
2378,
29898,
29876,
1557,
2361,
29897,
13,
2
] |
config/users/views.py | sitepoint-editors/Django-photo-app | 0 | 25890 | from django.views.generic import CreateView
from django.contrib.auth import authenticate, login
from django.contrib.auth.views import LoginView
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
class SignUpView(CreateView):
template_name = 'users/signup.html'
form_class = UserCreationForm
success_url = reverse_lazy('photo:list')
def form_valid(self, form):
to_return = super().form_valid(form)
user = authenticate(
username=form.cleaned_data["username"],
password=form.cleaned_data["<PASSWORD>"],
)
login(self.request, user)
return to_return
class CustomLoginView(LoginView):
template_name = 'users/login.html' | [
1,
515,
9557,
29889,
7406,
29889,
19206,
1053,
6204,
1043,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
15585,
403,
29892,
6464,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
7406,
1053,
19130,
1043,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9514,
1053,
4911,
9832,
362,
2500,
13,
13,
3166,
9557,
29889,
26045,
1053,
11837,
29918,
433,
1537,
13,
13,
1990,
9954,
3373,
1043,
29898,
4391,
1043,
1125,
13,
13,
1678,
4472,
29918,
978,
353,
525,
7193,
29914,
4530,
786,
29889,
1420,
29915,
13,
268,
13,
1678,
883,
29918,
1990,
353,
4911,
9832,
362,
2500,
13,
13,
1678,
2551,
29918,
2271,
353,
11837,
29918,
433,
1537,
877,
21596,
29901,
1761,
1495,
13,
13,
1678,
822,
883,
29918,
3084,
29898,
1311,
29892,
883,
1125,
13,
4706,
304,
29918,
2457,
353,
2428,
2141,
689,
29918,
3084,
29898,
689,
29897,
13,
13,
4706,
1404,
353,
15585,
403,
29898,
13,
9651,
8952,
29922,
689,
29889,
14941,
287,
29918,
1272,
3366,
6786,
12436,
13,
9651,
4800,
29922,
689,
29889,
14941,
287,
29918,
1272,
3366,
29966,
25711,
17013,
11903,
1402,
13,
4706,
1723,
13,
13,
4706,
6464,
29898,
1311,
29889,
3827,
29892,
1404,
29897,
13,
13,
4706,
736,
304,
29918,
2457,
13,
268,
13,
1990,
8701,
11049,
1043,
29898,
11049,
1043,
1125,
13,
268,
13,
1678,
4472,
29918,
978,
353,
525,
7193,
29914,
7507,
29889,
1420,
29915,
2
] |
test_project/products/example.py | SzatmariA/CharmFL-dev | 0 | 140648 | <reponame>SzatmariA/CharmFL-dev<gh_stars>0
# This is a simple example script for FL
# It should represent a webshop, or at least part of it
cart = {}
def addToCart(product):
if(product not in cart.keys()):
cart[str(product)] = 1
else:
cart[str(product)] = cart[(str(product))] + 2 # bug -> should be 1
def removeFromCart(product):
if(product in cart.keys()):
if(cart[str(product)] > 1):
cart[str(product)] = cart[str(product)] - 1
elif(cart[str(product)] == 1):
del cart[str(product)]
else:
print("Something's fishy")
def printProductsInCart():
print("Your cart: ")
for product_name in cart.keys():
product_count = cart[str(product_name)]
#print("* " + str(product_name) + ": " + str(product_count))
def getProductCount(product):
if(product not in cart.keys()):
return 0
else:
return cart[str(product)]
"""
# We need
# 4 apples
# 1 orange juice
# cheeser mum
# U
for i in range(1,4):
addToCart("apple")
removeFromCart("apple")
addToCart("OJ")
addToCart("cheese")
addToCart("Ur mum")
printProductsInCart()
""" | [
1,
529,
276,
1112,
420,
29958,
29903,
22046,
29885,
1306,
29909,
29914,
1451,
2817,
10536,
29899,
3359,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
910,
338,
263,
2560,
1342,
2471,
363,
383,
29931,
13,
29937,
739,
881,
2755,
263,
1856,
19032,
29892,
470,
472,
3203,
760,
310,
372,
13,
13,
13823,
353,
6571,
13,
13,
13,
1753,
788,
1762,
25233,
29898,
4704,
1125,
13,
1678,
565,
29898,
4704,
451,
297,
7774,
29889,
8149,
580,
1125,
13,
4706,
7774,
29961,
710,
29898,
4704,
4638,
353,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
7774,
29961,
710,
29898,
4704,
4638,
353,
7774,
15625,
710,
29898,
4704,
28166,
718,
29871,
29906,
396,
6494,
1599,
881,
367,
29871,
29896,
13,
13,
13,
1753,
3349,
4591,
25233,
29898,
4704,
1125,
13,
1678,
565,
29898,
4704,
297,
7774,
29889,
8149,
580,
1125,
13,
4706,
565,
29898,
13823,
29961,
710,
29898,
4704,
4638,
1405,
29871,
29896,
1125,
13,
9651,
7774,
29961,
710,
29898,
4704,
4638,
353,
7774,
29961,
710,
29898,
4704,
4638,
448,
29871,
29896,
13,
4706,
25342,
29898,
13823,
29961,
710,
29898,
4704,
4638,
1275,
29871,
29896,
1125,
13,
9651,
628,
7774,
29961,
710,
29898,
4704,
4638,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
16804,
29915,
29879,
9427,
29891,
1159,
13,
13,
13,
1753,
1596,
25767,
797,
25233,
7295,
13,
1678,
1596,
703,
10858,
7774,
29901,
16521,
13,
1678,
363,
3234,
29918,
978,
297,
7774,
29889,
8149,
7295,
13,
4706,
3234,
29918,
2798,
353,
7774,
29961,
710,
29898,
4704,
29918,
978,
4638,
13,
4706,
396,
2158,
703,
29930,
376,
718,
851,
29898,
4704,
29918,
978,
29897,
718,
29242,
376,
718,
851,
29898,
4704,
29918,
2798,
876,
13,
13,
13,
1753,
679,
7566,
3981,
29898,
4704,
1125,
13,
1678,
565,
29898,
4704,
451,
297,
7774,
29889,
8149,
580,
1125,
13,
4706,
736,
29871,
29900,
13,
1678,
1683,
29901,
13,
4706,
736,
7774,
29961,
710,
29898,
4704,
4638,
13,
15945,
29908,
13,
29937,
1334,
817,
13,
29937,
308,
29946,
623,
793,
13,
29937,
308,
29896,
24841,
3623,
625,
13,
29937,
4706,
923,
267,
261,
286,
398,
13,
29937,
4706,
501,
13,
13,
1454,
474,
297,
3464,
29898,
29896,
29892,
29946,
1125,
13,
1678,
788,
1762,
25233,
703,
11548,
1159,
13,
13,
5992,
4591,
25233,
703,
11548,
1159,
13,
1202,
1762,
25233,
703,
29949,
29967,
1159,
13,
1202,
1762,
25233,
703,
1173,
968,
1159,
13,
1202,
1762,
25233,
703,
29965,
29878,
286,
398,
1159,
13,
13,
2158,
25767,
797,
25233,
580,
13,
15945,
29908,
2
] |
PopUp.py | Bogiasdroid/BackMeUp | 0 | 173676 | import sys
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Dialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.setupUi(self)
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.setFixedSize(293, 160)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setEnabled(True)
self.buttonBox.setGeometry(QtCore.QRect(120, 120, 161, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.textBrowser = QtGui.QTextBrowser(Dialog)
self.textBrowser.setEnabled(True)
self.textBrowser.setGeometry(QtCore.QRect(20, 10, 256, 101))
font = QtGui.QFont()
font.setFamily(_fromUtf8("Arial"))
font.setBold(True)
font.setWeight(75)
self.textBrowser.setFont(font)
self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
| [
1,
1053,
10876,
30004,
13,
30004,
13,
3166,
10772,
17303,
29946,
1053,
14705,
9203,
29892,
14705,
28707,
30004,
13,
30004,
13,
2202,
29901,
30004,
13,
1678,
903,
3166,
29965,
13264,
29947,
353,
14705,
9203,
29889,
29984,
1231,
29889,
3166,
29965,
13264,
29947,
30004,
13,
19499,
23833,
2392,
29901,
30004,
13,
1678,
822,
903,
3166,
29965,
13264,
29947,
29898,
29879,
1125,
30004,
13,
4706,
736,
269,
30004,
13,
30004,
13,
2202,
29901,
30004,
13,
1678,
903,
22331,
353,
14705,
28707,
29889,
29984,
4873,
29889,
2525,
12858,
10496,
29947,
30004,
13,
1678,
822,
903,
21652,
29898,
4703,
29892,
1426,
29892,
766,
1117,
335,
1125,
30004,
13,
4706,
736,
14705,
28707,
29889,
29984,
4873,
29889,
21652,
29898,
4703,
29892,
1426,
29892,
766,
1117,
335,
29892,
903,
22331,
8443,
13,
19499,
23833,
2392,
29901,
30004,
13,
1678,
822,
903,
21652,
29898,
4703,
29892,
1426,
29892,
766,
1117,
335,
1125,
30004,
13,
4706,
736,
14705,
28707,
29889,
29984,
4873,
29889,
21652,
29898,
4703,
29892,
1426,
29892,
766,
1117,
335,
8443,
13,
30004,
13,
1990,
501,
29875,
29918,
7647,
29898,
17303,
28707,
29889,
29984,
7647,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
30004,
13,
4706,
14705,
28707,
29889,
29984,
7647,
17255,
2344,
12035,
1311,
8443,
13,
4706,
1583,
29889,
14669,
29965,
29875,
29898,
1311,
8443,
13,
30004,
13,
1678,
822,
6230,
29965,
29875,
29898,
1311,
29892,
18878,
1125,
30004,
13,
4706,
18878,
29889,
842,
2061,
1170,
7373,
3166,
29965,
13264,
29947,
703,
7647,
5783,
30004,
13,
4706,
18878,
29889,
842,
26262,
3505,
29898,
29906,
29929,
29941,
29892,
29871,
29896,
29953,
29900,
8443,
13,
4706,
1583,
29889,
3092,
3313,
353,
14705,
28707,
29889,
29984,
7647,
3125,
3313,
29898,
7647,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
842,
10861,
29898,
5574,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29906,
29900,
29892,
29871,
29896,
29906,
29900,
29892,
29871,
29896,
29953,
29896,
29892,
29871,
29941,
29906,
876,
30004,
13,
4706,
1583,
29889,
3092,
3313,
29889,
842,
25231,
29898,
17303,
9203,
29889,
17303,
29889,
24932,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
842,
15449,
29819,
787,
29898,
17303,
28707,
29889,
29984,
7647,
3125,
3313,
29889,
20434,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
842,
2061,
1170,
7373,
3166,
29965,
13264,
29947,
703,
3092,
3313,
5783,
30004,
13,
4706,
1583,
29889,
726,
21537,
353,
14705,
28707,
29889,
29984,
1626,
21537,
29898,
7647,
8443,
13,
4706,
1583,
29889,
726,
21537,
29889,
842,
10861,
29898,
5574,
8443,
13,
4706,
1583,
29889,
726,
21537,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29945,
29953,
29892,
29871,
29896,
29900,
29896,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
27104,
7373,
3166,
29965,
13264,
29947,
703,
29909,
9315,
5783,
30004,
13,
4706,
4079,
29889,
842,
29933,
1025,
29898,
5574,
8443,
13,
4706,
4079,
29889,
842,
22676,
29898,
29955,
29945,
8443,
13,
4706,
1583,
29889,
726,
21537,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
726,
21537,
29889,
842,
2061,
1170,
7373,
3166,
29965,
13264,
29947,
703,
726,
21537,
5783,
30004,
13,
30004,
13,
4706,
1583,
29889,
276,
21652,
29965,
29875,
29898,
7647,
8443,
13,
4706,
14705,
9203,
29889,
29984,
2061,
29889,
6915,
29898,
1311,
29889,
3092,
3313,
29892,
14705,
9203,
29889,
5425,
20728,
1964,
7373,
3166,
29965,
13264,
29947,
703,
16044,
287,
580,
1159,
511,
18878,
29889,
16044,
8443,
13,
4706,
14705,
9203,
29889,
29984,
19346,
2061,
29889,
6915,
16973,
1862,
2059,
1170,
29898,
7647,
8443,
13,
30004,
13,
1678,
822,
337,
21652,
29965,
29875,
29898,
1311,
29892,
18878,
1125,
30004,
13,
4706,
18878,
29889,
842,
5907,
7030,
7373,
21652,
703,
7647,
613,
376,
7647,
613,
6213,
876,
30004,
13,
30004,
13,
30004,
13,
2
] |
main.py | guysoft/kivy-external-storage-permission | 1 | 22019 | import kivy
from kivy.app import App
from kivy.uix.button import Button
import android
import os
import time
from android.permissions import Permission, request_permission, check_permission
from kivy.clock import Clock
class MyApp(App):
def second_thread(self, data):
print("starting second thread")
permission_status = check_permission(Permission.WRITE_EXTERNAL_STORAGE)
print(permission_status)
if permission_status is not None and permission_status:
print("got permission")
path = os.environ["SECONDARY_STORAGE"]
test_path = os.path.join(path, "test_yay")
os.makedirs(test_path)
else:
Clock.schedule_once(self.second_thread, 1)
def callback(self, data):
print("Pushed button, running")
print("request permission")
print(request_permission(Permission.WRITE_EXTERNAL_STORAGE))
Clock.schedule_once(self.second_thread, 5)
def build(self):
return Button(text='Touch to test writing to ' + os.environ["SECONDARY_STORAGE"], on_press=self.callback)
if __name__ == '__main__':
MyApp().run()
| [
1,
1053,
413,
440,
29891,
13,
13,
3166,
413,
440,
29891,
29889,
932,
1053,
2401,
13,
3166,
413,
440,
29891,
29889,
29884,
861,
29889,
3092,
1053,
11025,
13,
5215,
1442,
13,
5215,
2897,
13,
5215,
931,
13,
3166,
1442,
29889,
17858,
6847,
1053,
20894,
2333,
29892,
2009,
29918,
16074,
29892,
1423,
29918,
16074,
13,
3166,
413,
440,
29891,
29889,
13058,
1053,
315,
908,
13,
13,
13,
13,
1990,
1619,
2052,
29898,
2052,
1125,
13,
1678,
822,
1473,
29918,
7097,
29898,
1311,
29892,
848,
1125,
13,
4706,
1596,
703,
2962,
292,
1473,
3244,
1159,
13,
4706,
10751,
29918,
4882,
353,
1423,
29918,
16074,
29898,
27293,
29889,
16365,
29918,
5746,
4945,
29940,
1964,
29918,
1254,
1955,
10461,
29897,
13,
4706,
1596,
29898,
16074,
29918,
4882,
29897,
13,
308,
13,
4706,
565,
10751,
29918,
4882,
338,
451,
6213,
322,
10751,
29918,
4882,
29901,
13,
9651,
1596,
703,
7085,
10751,
1159,
13,
9651,
2224,
353,
2897,
29889,
21813,
3366,
1660,
6007,
29928,
19926,
29918,
1254,
1955,
10461,
3108,
13,
9651,
1243,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
376,
1688,
29918,
29891,
388,
1159,
13,
9651,
2897,
29889,
29885,
12535,
12935,
29898,
1688,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
315,
908,
29889,
816,
11272,
29918,
10646,
29898,
1311,
29889,
7496,
29918,
7097,
29892,
29871,
29896,
29897,
13,
13,
308,
13,
13,
632,
13,
13,
1678,
822,
6939,
29898,
1311,
29892,
848,
1125,
13,
4706,
1596,
703,
29925,
15392,
2826,
29892,
2734,
1159,
13,
4706,
1596,
703,
3827,
10751,
1159,
13,
4706,
1596,
29898,
3827,
29918,
16074,
29898,
27293,
29889,
16365,
29918,
5746,
4945,
29940,
1964,
29918,
1254,
1955,
10461,
876,
13,
4706,
315,
908,
29889,
816,
11272,
29918,
10646,
29898,
1311,
29889,
7496,
29918,
7097,
29892,
29871,
29945,
29897,
13,
13,
13,
13,
1678,
822,
2048,
29898,
1311,
1125,
13,
13,
4706,
736,
11025,
29898,
726,
2433,
15852,
304,
1243,
5007,
304,
525,
718,
2897,
29889,
21813,
3366,
1660,
6007,
29928,
19926,
29918,
1254,
1955,
10461,
12436,
373,
29918,
2139,
29922,
1311,
29889,
14035,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1619,
2052,
2141,
3389,
580,
13,
2
] |
concepttordf/betydningsbeskrivelse.py | jimjyang/concepttordf | 0 | 1605641 | <filename>concepttordf/betydningsbeskrivelse.py<gh_stars>0
from abc import ABC
from enum import Enum
class RelationToSource(Enum):
sitatFraKilde = "quoteFromSource"
basertPåKilde = "basedOnSource"
egendefinert = "noSource"
class Betydningsbeskrivelse(ABC):
def __init__(self, b: dict = None):
if b is not None:
if 'text' in b:
self.text = b['text']
if 'remark' in b:
self.remark = b['remark']
if 'scope' in b:
self.scope = b['scope']
if 'relationtosource' in b:
self.relationtosource = b['relationtosource']
if 'source' in b:
self.source = b['source']
if 'modified' in b:
self.modified = b['modified']
@property
def type(self):
return self._type
@type.setter
def type(self, type):
self._type = type
@property
def text(self) -> dict:
return self._text
@text.setter
def text(self, text: dict):
self._text = text
@property
def remark(self) -> dict:
return self._remark
@remark.setter
def remark(self, remark: dict):
self._remark = remark
@property
def scope(self) -> dict:
return self._scope
@scope.setter
def scope(self, scope: dict):
self._scope = scope
@property
def relationtosource(self) -> str:
return self._relationtosource
@relationtosource.setter
def relationtosource(self, relationtosource: str):
self._relationtosource = relationtosource
@property
def source(self) -> dict:
return self._source
@source.setter
def source(self, source: dict):
self._source = source
@property
def modified(self) -> dict:
return self._modified
@modified.setter
def modified(self, modified: dict):
self._modified = modified
| [
1,
529,
9507,
29958,
535,
1547,
29873,
536,
29888,
29914,
6878,
2941,
11753,
5707,
29895,
374,
955,
344,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
25638,
1053,
16417,
13,
3166,
14115,
1053,
1174,
398,
13,
13,
13,
1990,
6376,
362,
1762,
4435,
29898,
16854,
1125,
13,
1678,
269,
7366,
29943,
336,
29968,
7154,
353,
376,
1396,
4591,
4435,
29908,
13,
1678,
2362,
814,
29925,
30020,
29968,
7154,
353,
376,
6707,
2951,
4435,
29908,
13,
1678,
321,
1885,
25476,
814,
353,
376,
1217,
4435,
29908,
13,
13,
13,
1990,
6313,
2941,
11753,
5707,
29895,
374,
955,
344,
29898,
19658,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
289,
29901,
9657,
353,
6213,
1125,
13,
4706,
565,
289,
338,
451,
6213,
29901,
13,
9651,
565,
525,
726,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
726,
353,
289,
1839,
726,
2033,
13,
9651,
565,
525,
26294,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
26294,
353,
289,
1839,
26294,
2033,
13,
9651,
565,
525,
6078,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
6078,
353,
289,
1839,
6078,
2033,
13,
9651,
565,
525,
23445,
29873,
359,
1167,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
23445,
29873,
359,
1167,
353,
289,
1839,
23445,
29873,
359,
1167,
2033,
13,
9651,
565,
525,
4993,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
4993,
353,
289,
1839,
4993,
2033,
13,
9651,
565,
525,
1545,
2164,
29915,
297,
289,
29901,
13,
18884,
1583,
29889,
1545,
2164,
353,
289,
1839,
1545,
2164,
2033,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1134,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
1853,
13,
13,
1678,
732,
1853,
29889,
842,
357,
13,
1678,
822,
1134,
29898,
1311,
29892,
1134,
1125,
13,
4706,
1583,
3032,
1853,
353,
1134,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1426,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
3032,
726,
13,
13,
1678,
732,
726,
29889,
842,
357,
13,
1678,
822,
1426,
29898,
1311,
29892,
1426,
29901,
9657,
1125,
13,
4706,
1583,
3032,
726,
353,
1426,
13,
13,
1678,
732,
6799,
13,
1678,
822,
8509,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
3032,
26294,
13,
13,
1678,
732,
26294,
29889,
842,
357,
13,
1678,
822,
8509,
29898,
1311,
29892,
8509,
29901,
9657,
1125,
13,
4706,
1583,
3032,
26294,
353,
8509,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6874,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
3032,
6078,
13,
13,
1678,
732,
6078,
29889,
842,
357,
13,
1678,
822,
6874,
29898,
1311,
29892,
6874,
29901,
9657,
1125,
13,
4706,
1583,
3032,
6078,
353,
6874,
13,
13,
1678,
732,
6799,
13,
1678,
822,
8220,
29873,
359,
1167,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
23445,
29873,
359,
1167,
13,
13,
1678,
732,
23445,
29873,
359,
1167,
29889,
842,
357,
13,
1678,
822,
8220,
29873,
359,
1167,
29898,
1311,
29892,
8220,
29873,
359,
1167,
29901,
851,
1125,
13,
4706,
1583,
3032,
23445,
29873,
359,
1167,
353,
8220,
29873,
359,
1167,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2752,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
3032,
4993,
13,
13,
1678,
732,
4993,
29889,
842,
357,
13,
1678,
822,
2752,
29898,
1311,
29892,
2752,
29901,
9657,
1125,
13,
4706,
1583,
3032,
4993,
353,
2752,
13,
13,
1678,
732,
6799,
13,
1678,
822,
9120,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
3032,
1545,
2164,
13,
13,
1678,
732,
1545,
2164,
29889,
842,
357,
13,
1678,
822,
9120,
29898,
1311,
29892,
9120,
29901,
9657,
1125,
13,
4706,
1583,
3032,
1545,
2164,
353,
9120,
13,
2
] |
ClassicFunction.py | gr0mph/SpringChallenge2020 | 0 | 93927 | import sys, copy, heapq
import math, random, time
import numpy as np
# Class
from Challenge import Pacman
def init_pacman_from_list(kanban_node, PACMAN_LIST):
for d1 in PACMAN_LIST:
pacman_new = Pacman(None)
pacman_new.mine, pacman_new.x, pacman_new.y = d1[1], d1[2], d1[3]
pacman_new.type = d1[4]
if pacman_new.mine == 0 :
pacman_new.id = -1 * (d1[0] + 1)
kanban_node.opp[pacman_new.id] = pacman_new
else :
pacman_new.id = 1 * (d1[0] + 1)
kanban_node.mine[pacman_new.id] = pacman_new
return kanban_node
def init_pellet_from_list(kanban_node, PELLET_LIST):
for _, c1 in kanban_node.cases.items():
c1.pellet = 1
for c1 in PELLET_LIST:
coord = c1[1], c1[0]
if coord in kanban_node.nodes : kanban_node.nodes[coord].pellet = 10
if coord in kanban_node.cases : kanban_node.cases[coord].pellet = 10
return kanban_node
| [
1,
1053,
10876,
29892,
3509,
29892,
16947,
29939,
13,
5215,
5844,
29892,
4036,
29892,
931,
13,
13,
5215,
12655,
408,
7442,
13,
13,
29937,
4134,
13,
3166,
27211,
1053,
9790,
1171,
13,
13,
1753,
2069,
29918,
29886,
562,
1171,
29918,
3166,
29918,
1761,
29898,
11052,
2571,
29918,
3177,
29892,
349,
2477,
27616,
29918,
24360,
1125,
13,
1678,
363,
270,
29896,
297,
349,
2477,
27616,
29918,
24360,
29901,
13,
4706,
22906,
1171,
29918,
1482,
353,
9790,
1171,
29898,
8516,
29897,
13,
4706,
22906,
1171,
29918,
1482,
29889,
24669,
29892,
22906,
1171,
29918,
1482,
29889,
29916,
29892,
22906,
1171,
29918,
1482,
29889,
29891,
353,
270,
29896,
29961,
29896,
1402,
270,
29896,
29961,
29906,
1402,
270,
29896,
29961,
29941,
29962,
13,
4706,
22906,
1171,
29918,
1482,
29889,
1853,
353,
270,
29896,
29961,
29946,
29962,
13,
4706,
565,
22906,
1171,
29918,
1482,
29889,
24669,
1275,
29871,
29900,
584,
13,
9651,
22906,
1171,
29918,
1482,
29889,
333,
353,
448,
29896,
334,
313,
29881,
29896,
29961,
29900,
29962,
718,
29871,
29896,
29897,
13,
9651,
6841,
2571,
29918,
3177,
29889,
9354,
29961,
29886,
562,
1171,
29918,
1482,
29889,
333,
29962,
353,
22906,
1171,
29918,
1482,
13,
4706,
1683,
584,
13,
9651,
22906,
1171,
29918,
1482,
29889,
333,
353,
29871,
29896,
334,
313,
29881,
29896,
29961,
29900,
29962,
718,
29871,
29896,
29897,
13,
9651,
6841,
2571,
29918,
3177,
29889,
24669,
29961,
29886,
562,
1171,
29918,
1482,
29889,
333,
29962,
353,
22906,
1171,
29918,
1482,
13,
1678,
736,
6841,
2571,
29918,
3177,
13,
13,
1753,
2069,
29918,
13111,
1026,
29918,
3166,
29918,
1761,
29898,
11052,
2571,
29918,
3177,
29892,
349,
6670,
1307,
29911,
29918,
24360,
1125,
13,
1678,
363,
17117,
274,
29896,
297,
6841,
2571,
29918,
3177,
29889,
11436,
29889,
7076,
7295,
13,
4706,
274,
29896,
29889,
13111,
1026,
353,
29871,
29896,
13,
1678,
363,
274,
29896,
297,
349,
6670,
1307,
29911,
29918,
24360,
29901,
13,
4706,
29311,
353,
274,
29896,
29961,
29896,
1402,
274,
29896,
29961,
29900,
29962,
13,
4706,
565,
29311,
297,
6841,
2571,
29918,
3177,
29889,
18010,
584,
6841,
2571,
29918,
3177,
29889,
18010,
29961,
1111,
536,
1822,
13111,
1026,
353,
29871,
29896,
29900,
13,
4706,
565,
29311,
297,
6841,
2571,
29918,
3177,
29889,
11436,
584,
6841,
2571,
29918,
3177,
29889,
11436,
29961,
1111,
536,
1822,
13111,
1026,
353,
29871,
29896,
29900,
13,
1678,
736,
6841,
2571,
29918,
3177,
13,
2
] |
Subsets and Splits